From f3eafa8f82816e7dc56bbe04bff5fc69f3a37279 Mon Sep 17 00:00:00 2001 From: Utkarsh Patel Date: Fri, 24 Jul 2026 17:14:44 +0530 Subject: [PATCH 1/4] Ensure Gallery block compatibility with WordPress 7.1 WordPress 7.1 enforces the iframed post editor and ships React 19. Update the Cloudinary Gallery block accordingly: - Bump the block to Block API v2 (compatible with the plugin's declared minimum of WP 5.6) and wrap the edit output with useBlockProps so it renders correctly inside the enforced iframed editor. - Keep the save output unchanged (bare container div) so existing published galleries remain valid without a deprecation/migration. The front-end render only depends on the inner container class, not a block wrapper, so no markup change is needed. - Move the block editor stylesheet to enqueue_block_assets so WP injects it into the iframe correctly (avoids the "added to the iframe incorrectly" 7.1 warning). - Move the render-time setAttributes calls into effects to resolve the React 19 "Cannot update a component while rendering a different component" warning. - Fix the generated container id, which produced "undefined" now that className is no longer passed to Edit under API v2. Verified against WordPress 7.1-beta3: fresh insert/save/reload and the upgrade path (loading legacy v1 content) both validate with no console errors or block validation warnings. --- js/gallery-block.asset.php | 2 +- js/gallery-block.js | 2 +- php/media/class-gallery.php | 39 +++++++++++++++++++++++-------- src/js/gallery-block/edit.js | 44 +++++++++++++++++++++++++---------- src/js/gallery-block/index.js | 1 + 5 files changed, 64 insertions(+), 24 deletions(-) diff --git a/js/gallery-block.asset.php b/js/gallery-block.asset.php index 1dad068a1..53d46d3ca 100644 --- a/js/gallery-block.asset.php +++ b/js/gallery-block.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-components/build-style/style.css', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '98f4cd2c29395fad0b1e'); + array('wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-components/build-style/style.css', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => 'caea4a8d2a1e5abb8a75'); diff --git a/js/gallery-block.js b/js/gallery-block.js index c47aeda07..53cd31db9 100644 --- a/js/gallery-block.js +++ b/js/gallery-block.js @@ -1,2 +1,2 @@ -(()=>{var e={1780(e){"use strict";function t(e,t){var r,n;if("function"==typeof t)void 0!==(n=t(e))&&(e=n);else if(Array.isArray(t))for(r=0;r=0&&(e=e.replace(/\[/g,t).replace(/]/g,""));var r=e.split(t);if(r.filter(s).length!==r.length)throw Error("Refusing to update blacklisted property "+e);return r}var c=Object.prototype.hasOwnProperty;function u(e,t,r,n){if(!(this instanceof u))return new u(e,t,r,n);void 0===t&&(t=!1),void 0===r&&(r=!0),void 0===n&&(n=!0),this.separator=e||".",this.override=t,this.useArray=r,this.useBrackets=n,this.keepArray=!1,this.cleanup=[]}var p=new u(".",!1,!0,!0);function d(e){return function(){return p[e].apply(p,arguments)}}u.prototype._fill=function(e,r,n,i){var s=e.shift();if(e.length>0){if(r[s]=r[s]||(this.useArray&&function(e){return/^\d+$/.test(e)}(e[0])?[]:{}),!o(r[s])){if(!this.override){if(!o(n)||!a(n))throw new Error("Trying to redefine `"+s+"` which is a "+typeof r[s]);return}r[s]={}}this._fill(e,r[s],n,i)}else{if(!this.override&&o(r[s])&&!a(r[s])){if(!o(n)||!a(n))throw new Error("Trying to redefine non-empty obj['"+s+"']");return}r[s]=t(n,i)}},u.prototype.object=function(e,r){var n=this;return Object.keys(e).forEach(function(o){var a=void 0===r?null:r[o],i=l(o,n.separator).join(n.separator);-1!==i.indexOf(n.separator)?(n._fill(i.split(n.separator),e,e[o],a),delete e[o]):e[o]=t(e[o],a)}),e},u.prototype.str=function(e,r,n,o){var a=l(e,this.separator).join(this.separator);return-1!==e.indexOf(this.separator)?this._fill(a.split(this.separator),n,r,o):n[e]=t(r,o),n},u.prototype.pick=function(e,t,n,o){var a,i,s,c,u;for(i=l(e,this.separator),a=0;a-1&&e%1==0&&e-1}},1175(e,t,r){var n=r(6025);e.exports=function(e,t){var r=this.__data__,o=n(r,e);return o<0?(++this.size,r.push([e,t])):r[o][1]=t,this}},3040(e,t,r){var n=r(1549),o=r(79),a=r(8223);e.exports=function(){this.size=0,this.__data__={hash:new n,map:new(a||o),string:new n}}},7670(e,t,r){var n=r(2651);e.exports=function(e){var t=n(this,e).delete(e);return this.size-=t?1:0,t}},289(e,t,r){var n=r(2651);e.exports=function(e){return n(this,e).get(e)}},4509(e,t,r){var n=r(2651);e.exports=function(e){return n(this,e).has(e)}},2949(e,t,r){var n=r(2651);e.exports=function(e,t){var r=n(this,e),o=r.size;return r.set(e,t),this.size+=r.size==o?0:1,this}},1042(e,t,r){var n=r(6110)(Object,"create");e.exports=n},3650(e,t,r){var n=r(4335)(Object.keys,Object);e.exports=n},181(e){e.exports=function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}},6009(e,t,r){e=r.nmd(e);var n=r(4840),o=t&&!t.nodeType&&t,a=o&&e&&!e.nodeType&&e,i=a&&a.exports===o&&n.process,s=function(){try{var e=a&&a.require&&a.require("util").types;return e||i&&i.binding&&i.binding("util")}catch(e){}}();e.exports=s},9350(e){var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},4335(e){e.exports=function(e,t){return function(r){return e(t(r))}}},9325(e,t,r){var n=r(4840),o="object"==typeof self&&self&&self.Object===Object&&self,a=n||o||Function("return this")();e.exports=a},1420(e,t,r){var n=r(79);e.exports=function(){this.__data__=new n,this.size=0}},938(e){e.exports=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}},3605(e){e.exports=function(e){return this.__data__.get(e)}},9817(e){e.exports=function(e){return this.__data__.has(e)}},945(e,t,r){var n=r(79),o=r(8223),a=r(3661);e.exports=function(e,t){var r=this.__data__;if(r instanceof n){var i=r.__data__;if(!o||i.length<199)return i.push([e,t]),this.size=++r.size,this;r=this.__data__=new a(i)}return r.set(e,t),this.size=r.size,this}},7473(e){var t=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return t.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},8055(e,t,r){var n=r(9999);e.exports=function(e){return n(e,5)}},5288(e){e.exports=function(e,t){return e===t||e!=e&&t!=t}},2428(e,t,r){var n=r(7534),o=r(346),a=Object.prototype,i=a.hasOwnProperty,s=a.propertyIsEnumerable,l=n(function(){return arguments}())?n:function(e){return o(e)&&i.call(e,"callee")&&!s.call(e,"callee")};e.exports=l},6449(e){var t=Array.isArray;e.exports=t},4894(e,t,r){var n=r(1882),o=r(294);e.exports=function(e){return null!=e&&o(e.length)&&!n(e)}},3656(e,t,r){e=r.nmd(e);var n=r(9325),o=r(9935),a=t&&!t.nodeType&&t,i=a&&e&&!e.nodeType&&e,s=i&&i.exports===a?n.Buffer:void 0,l=(s?s.isBuffer:void 0)||o;e.exports=l},1882(e,t,r){var n=r(2552),o=r(3805);e.exports=function(e){if(!o(e))return!1;var t=n(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},294(e){e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},7730(e,t,r){var n=r(9172),o=r(7301),a=r(6009),i=a&&a.isMap,s=i?o(i):n;e.exports=s},3805(e){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},346(e){e.exports=function(e){return null!=e&&"object"==typeof e}},8440(e,t,r){var n=r(6038),o=r(7301),a=r(6009),i=a&&a.isSet,s=i?o(i):n;e.exports=s},7167(e,t,r){var n=r(4901),o=r(7301),a=r(6009),i=a&&a.isTypedArray,s=i?o(i):n;e.exports=s},5950(e,t,r){var n=r(695),o=r(8984),a=r(4894);e.exports=function(e){return a(e)?n(e):o(e)}},7241(e,t,r){var n=r(695),o=r(2903),a=r(4894);e.exports=function(e){return a(e)?n(e,!0):o(e)}},3345(e){e.exports=function(){return[]}},9935(e){e.exports=function(){return!1}},6087(e){"use strict";e.exports=window.wp.element},6942(e,t){var r;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e="",t=0;t{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{"use strict";const e=window.wp.i18n,t=window.wp.blocks;var n=r(1780),o=r.n(n);const a=window.wp.apiFetch;var i=r.n(a);const s=window.wp.components;window.wp["components/buildStyle/style.css"];var l=r(6087);const c=window.wp.blockEditor;var u=r(8055),p=r.n(u),d=r(6087);const f=()=>d.createElement("svg",{width:"18px",height:"18px",viewBox:"0 0 18 18",version:"1.1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"},d.createElement("title",null,"shape-round"),d.createElement("desc",null,"Created with Sketch."),d.createElement("g",{id:"Desktop-0.4",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},d.createElement("g",{id:"widgets/shape-round",transform:"translate(-3.000000, -3.000000)",fill:"#000000"},d.createElement("path",{d:"M12,3 C16.9705627,3 21,7.02943725 21,12 C21,16.9705627 16.9705627,21 12,21 C7.02943725,21 3,16.9705627 3,12 C3,7.02943725 7.02943725,3 12,3 Z M12,5 C8.13400675,5 5,8.13400675 5,12 C5,15.8659932 8.13400675,19 12,19 C15.8659932,19 19,15.8659932 19,12 C19,8.13400675 15.8659932,5 12,5 Z",id:"Combined-Shape"})))),m=()=>d.createElement("svg",{width:"18px",height:"18px",viewBox:"0 0 18 18",version:"1.1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"},d.createElement("title",null,"ratio-square"),d.createElement("desc",null,"Created with Sketch."),d.createElement("g",{id:"Desktop-0.4",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},d.createElement("g",{id:"widgets/shape-square",transform:"translate(-3.000000, -3.000000)",fill:"#000000"},d.createElement("path",{d:"M3,3 L3,21 L21,21 L21,3 L3,3 Z M5,5 L5,19 L19,19 L19,5 L5,5 Z",id:"shape"})))),v=()=>d.createElement("svg",{width:"18px",height:"18px",viewBox:"0 0 18 18",version:"1.1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"},d.createElement("title",null,"shape-radius"),d.createElement("desc",null,"Created with Sketch."),d.createElement("g",{id:"Desktop-0.4",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},d.createElement("g",{id:"widgets/shape-radius",transform:"translate(-3.000000, -3.000000)",fill:"#000000"},d.createElement("path",{d:"M17,3 C19.209139,3 21,4.790861 21,7 L21,17 C21,19.209139 19.209139,21 17,21 L7,21 C4.790861,21 3,19.209139 3,17 L3,7 C3,4.790861 4.790861,3 7,3 L17,3 Z M17,5 L7,5 C5.9456382,5 5.08183488,5.81587779 5.00548574,6.85073766 L5,7 L5,17 C5,18.0543618 5.81587779,18.9181651 6.85073766,18.9945143 L7,19 L17,19 C18.0543618,19 18.9181651,18.1841222 18.9945143,17.1492623 L19,17 L19,7 C19,5.9456382 18.1841222,5.08183488 17.1492623,5.00548574 L17,5 Z",id:"Rectangle"})))),h=()=>d.createElement("svg",{width:"18px",height:"18px",viewBox:"0 0 18 18",version:"1.1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"},d.createElement("title",null,"shape-none"),d.createElement("desc",null,"Created with Sketch."),d.createElement("g",{id:"Desktop-0.4",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},d.createElement("g",{id:"widgets/shape-none",transform:"translate(-3.000000, -3.000000)",fill:"#000000"},d.createElement("path",{d:"M5,19 L5,21 L3,21 L3,19 L5,19 Z M21,19 L21,21 L19,21 L19,19 L21,19 Z M13,19 L13,21 L11,21 L11,19 L13,19 Z M9,19 L9,21 L7,21 L7,19 L9,19 Z M17,19 L17,21 L15,21 L15,19 L17,19 Z M21,15 L21,17 L19,17 L19,15 L21,15 Z M21,11 L21,13 L19,13 L19,11 L21,11 Z M5,11 L5,13 L3,13 L3,11 L5,11 Z M21,7 L21,9 L19,9 L19,7 L21,7 Z M5,7 L5,9 L3,9 L3,7 L5,7 Z M13,3 L13,5 L11,5 L11,3 L13,3 Z M9,3 L9,5 L7,5 L7,3 L9,3 Z M17,3 L17,5 L15,5 L15,3 L17,3 Z M21,3 L21,5 L19,5 L19,3 L21,3 Z M5,3 L5,5 L3,5 L3,3 L5,3 Z M3,15 L5,15 L5,17 L3,17 L3,15 Z",id:"Shape"})))),y=[{value:{type:"expanded",columns:1},icon:()=>d.createElement("svg",{width:"17px",height:"20px",viewBox:"0 0 17 20",version:"1.1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"},d.createElement("title",null,"layout-modern"),d.createElement("desc",null,"Created with Sketch."),d.createElement("g",{id:"Desktop-0.4",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},d.createElement("g",{id:"widgets/layout-modern",transform:"translate(-2.000000, -3.000000)",fill:"#000000"},d.createElement("path",{d:"M2,10 L5,10 L5,7 L2,7 L2,10 Z M2,14 L5,14 L5,11 L2,11 L2,14 Z M2,6 L5,6 L5,3 L2,3 L2,6 Z M6,3 L6,17 L19,17 L19,3 L6,3 Z M8,5 L8,15 L17,15 L17,5 L8,5 Z M6,18 L6,23 L19,23 L19,18 L6,18 Z M8,20 L8,23 L17,23 L17,20 L8,20 Z",id:"shape"})))),label:(0,e.__)("Expanded - 1 Column","cloudinary")},{value:{type:"expanded",columns:2},icon:()=>d.createElement("svg",{width:"18px",height:"17px",viewBox:"0 0 18 17",version:"1.1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"},d.createElement("title",null,"layout-grid-2-column"),d.createElement("desc",null,"Created with Sketch."),d.createElement("g",{id:"Desktop-0.4",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},d.createElement("g",{id:"widgets/layout-gird-2-col",transform:"translate(-3.000000, -3.000000)",fill:"#000000"},d.createElement("path",{d:"M11,12 L11,20 L3,20 L3,12 L11,12 Z M21,12 L21,20 L13,20 L13,12 L21,12 Z M9,14 L5,14 L5,18 L9,18 L9,14 Z M19,14 L15,14 L15,18 L19,18 L19,14 Z M11,3 L11,11 L3,11 L3,3 L11,3 Z M21,3 L21,11 L13,11 L13,3 L21,3 Z M9,5 L5,5 L5,9 L9,9 L9,5 Z M19,5 L15,5 L15,9 L19,9 L19,5 Z",id:"Shape"})))),label:(0,e.__)("Expanded - 2 Column","cloudinary")},{value:{type:"expanded",columns:3},icon:()=>d.createElement("svg",{width:"20px",height:"13px",viewBox:"0 0 20 13",version:"1.1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"},d.createElement("title",null,"layout-grid-3-column"),d.createElement("desc",null,"Created with Sketch."),d.createElement("g",{id:"Desktop-0.4",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},d.createElement("g",{id:"widgets/layout-gird-3-col",transform:"translate(-2.000000, -5.000000)",fill:"#000000"},d.createElement("path",{d:"M8,12 L8,18 L2,18 L2,12 L8,12 Z M15,12 L15,18 L9,18 L9,12 L15,12 Z M22,12 L22,18 L16,18 L16,12 L22,12 Z M6,14 L4,14 L4,16 L6,16 L6,14 Z M13,14 L11,14 L11,16 L13,16 L13,14 Z M20,14 L18,14 L18,16 L20,16 L20,14 Z M8,5 L8,11 L2,11 L2,5 L8,5 Z M15,5 L15,11 L9,11 L9,5 L15,5 Z M22,5 L22,11 L16,11 L16,5 L22,5 Z M6,7 L4,7 L4,9 L6,9 L6,7 Z M13,7 L11,7 L11,9 L13,9 L13,7 Z M20,7 L18,7 L18,9 L20,9 L20,7 Z",id:"Combined-Shape"})))),label:(0,e.__)("Expanded - 3 Column","cloudinary")},{value:{type:"classic",columns:1},icon:()=>d.createElement("svg",{width:"17px",height:"14px",viewBox:"0 0 17 14",version:"1.1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"},d.createElement("title",null,"layout-classic"),d.createElement("desc",null,"Created with Sketch."),d.createElement("g",{id:"Desktop-0.4",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},d.createElement("g",{id:"widgets/layout-classic",transform:"translate(-3.000000, -5.000000)",fill:"#000000"},d.createElement("path",{d:"M3,12 L6,12 L6,9 L3,9 L3,12 Z M3,16 L6,16 L6,13 L3,13 L3,16 Z M3,8 L6,8 L6,5 L3,5 L3,8 Z M7,5 L7,19 L20,19 L20,5 L7,5 Z M9,7 L9,17 L18,17 L18,7 L9,7 Z",id:"shape"})))),label:(0,e.__)("Classic","cloudinary")}],g=["image"],b=[{label:(0,e.__)("1:1","cloudinary"),value:"1:1"},{label:(0,e.__)("3:4","cloudinary"),value:"3:4"},{label:(0,e.__)("4:3","cloudinary"),value:"4:3"},{label:(0,e.__)("4:6","cloudinary"),value:"4:6"},{label:(0,e.__)("6:4","cloudinary"),value:"6:4"},{label:(0,e.__)("5:7","cloudinary"),value:"5:7"},{label:(0,e.__)("7:5","cloudinary"),value:"7:5"},{label:(0,e.__)("8:5","cloudinary"),value:"8:5"},{label:(0,e.__)("5:8","cloudinary"),value:"5:8"},{label:(0,e.__)("9:16","cloudinary"),value:"9:16"},{label:(0,e.__)("16:9","cloudinary"),value:"16:9"}],_=[{label:(0,e.__)("None","cloudinary"),value:"none"},{label:(0,e.__)("Fade","cloudinary"),value:"fade"},{label:(0,e.__)("Slide","cloudinary"),value:"slide"}],x=[{label:(0,e.__)("Always","cloudinary"),value:"always"},{label:(0,e.__)("None","cloudinary"),value:"none"},{label:(0,e.__)("MouseOver","cloudinary"),value:"mouseover"}],w=[{label:(0,e.__)("Inline","cloudinary"),value:"inline"},{label:(0,e.__)("Flyout","cloudinary"),value:"flyout"},{label:(0,e.__)("Popup","cloudinary"),value:"popup"}],L=[{label:(0,e.__)("Top","cloudinary"),value:"top"},{label:(0,e.__)("Bottom","cloudinary"),value:"bottom"},{label:(0,e.__)("Left","cloudinary"),value:"left"},{label:(0,e.__)("Right","cloudinary"),value:"right"}],E=[{label:(0,e.__)("Click","cloudinary"),value:"click"},{label:(0,e.__)("Hover","cloudinary"),value:"hover"}],O=[{label:(0,e.__)("Left","cloudinary"),value:"left"},{label:(0,e.__)("Right","cloudinary"),value:"right"},{label:(0,e.__)("Top","cloudinary"),value:"top"},{label:(0,e.__)("Bottom","cloudinary"),value:"bottom"}],j=[{label:(0,e.__)("Thumbnails","cloudinary"),value:"thumbnails"},{label:(0,e.__)("Indicators","cloudinary"),value:"indicators"},{label:(0,e.__)("None","cloudinary"),value:"none"}],A=[{value:"round",icon:f,label:(0,e.__)("Round","cloudinary")},{value:"radius",icon:v,label:(0,e.__)("Radius","cloudinary")},{value:"none",icon:h,label:(0,e.__)("None","cloudinary")},{value:"square",icon:m,label:(0,e.__)("Square","cloudinary")},{value:"rectangle",icon:()=>d.createElement("svg",{width:"14px",height:"20px",viewBox:"0 0 14 20",version:"1.1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"},d.createElement("title",null,"ratio-9-16"),d.createElement("desc",null,"Created with Sketch."),d.createElement("g",{id:"Desktop-0.4",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},d.createElement("g",{id:"ratio/9-16",transform:"translate(-5.000000, -2.000000)",fill:"#000000"},d.createElement("path",{d:"M22,5.5 L22,18.5 L2,18.5 L2,5.5 L22,5.5 Z M20,7.5 L4,7.5 L4,16.5 L20,16.5 L20,7.5 Z",id:"Combined-Shape",transform:"translate(12.000000, 12.000000) rotate(-90.000000) translate(-12.000000, -12.000000) "})))),label:(0,e.__)("Rectangle","cloudinary")}],k=[{value:"round",icon:f,label:(0,e.__)("Round","cloudinary")},{value:"radius",icon:v,label:(0,e.__)("Radius","cloudinary")},{value:"square",icon:m,label:(0,e.__)("Square","cloudinary")}],P=[{label:(0,e.__)("All","cloudinary"),value:"all"},{label:(0,e.__)("Border","cloudinary"),value:"border"},{label:(0,e.__)("Gradient","cloudinary"),value:"gradient"}],S=[{label:(0,e.__)("All","cloudinary"),value:"all"},{label:(0,e.__)("Top","cloudinary"),value:"top"},{label:(0,e.__)("Top-Bottom","cloudinary"),value:"top-bottom"},{label:(0,e.__)("Left-Right","cloudinary"),value:"left-right"},{label:(0,e.__)("Bottom","cloudinary"),value:"bottom"},{label:(0,e.__)("Left","cloudinary"),value:"left"},{label:(0,e.__)("Right","cloudinary"),value:"right"}],C=[{value:"round",icon:f,label:(0,e.__)("Round","cloudinary")},{value:"radius",icon:v,label:(0,e.__)("Radius","cloudinary")},{value:"none",icon:h,label:(0,e.__)("None","cloudinary")},{value:"square",icon:m,label:(0,e.__)("Square","cloudinary")}],M=[{label:(0,e.__)("Pad","cloudinary"),value:"pad"},{label:(0,e.__)("Fill","cloudinary"),value:"fill"}],T=[{label:(0,e.__)("White padding","cloudinary"),value:"rgb:FFFFFF"},{label:(0,e.__)("Border color padding","cloudinary"),value:"auto"},{label:(0,e.__)("Predominant color padding","cloudinary"),value:"auto:predominant"},{label:(0,e.__)("Gradient fade padding","cloudinary"),value:"auto:predominant_gradient"}];var B=r(6942),D=r.n(B),N=r(6087);const R=({value:e,children:t,icon:r,onChange:n,current:o})=>{const a="object"==typeof e?JSON.stringify(e)===JSON.stringify(o):o===e;return N.createElement("button",{type:"button",onClick:()=>n(e),className:D()("radio-select",{"radio-select--active":a})},N.createElement(r,null),N.createElement("div",{className:"radio-select__label"},t))},Z=window.wp.data,z=e=>e<10?"0"+String(e):e.toString(16),F=e=>{const t=new Uint8Array((e||40)/2);return window.crypto.getRandomValues(t),Array.from(t,z).join("")},I=e=>{const t=/var\((.*)\)/g.exec(e);return t?getComputedStyle(document.documentElement).getPropertyValue(t[1]):e};function W(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function H(e){return e instanceof W(e).Element||e instanceof Element}function V(e){return e instanceof W(e).HTMLElement||e instanceof HTMLElement}function U(e){return"undefined"!=typeof ShadowRoot&&(e instanceof W(e).ShadowRoot||e instanceof ShadowRoot)}var q=Math.max,$=Math.min,G=Math.round;function X(){var e=navigator.userAgentData;return null!=e&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function J(){return!/^((?!chrome|android).)*safari/i.test(X())}function Y(e,t,r){void 0===t&&(t=!1),void 0===r&&(r=!1);var n=e.getBoundingClientRect(),o=1,a=1;t&&V(e)&&(o=e.offsetWidth>0&&G(n.width)/e.offsetWidth||1,a=e.offsetHeight>0&&G(n.height)/e.offsetHeight||1);var i=(H(e)?W(e):window).visualViewport,s=!J()&&r,l=(n.left+(s&&i?i.offsetLeft:0))/o,c=(n.top+(s&&i?i.offsetTop:0))/a,u=n.width/o,p=n.height/a;return{width:u,height:p,top:c,right:l+u,bottom:c+p,left:l,x:l,y:c}}function K(e){var t=W(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function Q(e){return e?(e.nodeName||"").toLowerCase():null}function ee(e){return((H(e)?e.ownerDocument:e.document)||window.document).documentElement}function te(e){return Y(ee(e)).left+K(e).scrollLeft}function re(e){return W(e).getComputedStyle(e)}function ne(e){var t=re(e),r=t.overflow,n=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(r+o+n)}function oe(e,t,r){void 0===r&&(r=!1);var n,o,a=V(t),i=V(t)&&function(e){var t=e.getBoundingClientRect(),r=G(t.width)/e.offsetWidth||1,n=G(t.height)/e.offsetHeight||1;return 1!==r||1!==n}(t),s=ee(t),l=Y(e,i,r),c={scrollLeft:0,scrollTop:0},u={x:0,y:0};return(a||!a&&!r)&&(("body"!==Q(t)||ne(s))&&(c=(n=t)!==W(n)&&V(n)?{scrollLeft:(o=n).scrollLeft,scrollTop:o.scrollTop}:K(n)),V(t)?((u=Y(t,!0)).x+=t.clientLeft,u.y+=t.clientTop):s&&(u.x=te(s))),{x:l.left+c.scrollLeft-u.x,y:l.top+c.scrollTop-u.y,width:l.width,height:l.height}}function ae(e){var t=Y(e),r=e.offsetWidth,n=e.offsetHeight;return Math.abs(t.width-r)<=1&&(r=t.width),Math.abs(t.height-n)<=1&&(n=t.height),{x:e.offsetLeft,y:e.offsetTop,width:r,height:n}}function ie(e){return"html"===Q(e)?e:e.assignedSlot||e.parentNode||(U(e)?e.host:null)||ee(e)}function se(e){return["html","body","#document"].indexOf(Q(e))>=0?e.ownerDocument.body:V(e)&&ne(e)?e:se(ie(e))}function le(e,t){var r;void 0===t&&(t=[]);var n=se(e),o=n===(null==(r=e.ownerDocument)?void 0:r.body),a=W(n),i=o?[a].concat(a.visualViewport||[],ne(n)?n:[]):n,s=t.concat(i);return o?s:s.concat(le(ie(i)))}function ce(e){return["table","td","th"].indexOf(Q(e))>=0}function ue(e){return V(e)&&"fixed"!==re(e).position?e.offsetParent:null}function pe(e){for(var t=W(e),r=ue(e);r&&ce(r)&&"static"===re(r).position;)r=ue(r);return r&&("html"===Q(r)||"body"===Q(r)&&"static"===re(r).position)?t:r||function(e){var t=/firefox/i.test(X());if(/Trident/i.test(X())&&V(e)&&"fixed"===re(e).position)return null;var r=ie(e);for(U(r)&&(r=r.host);V(r)&&["html","body"].indexOf(Q(r))<0;){var n=re(r);if("none"!==n.transform||"none"!==n.perspective||"paint"===n.contain||-1!==["transform","perspective"].indexOf(n.willChange)||t&&"filter"===n.willChange||t&&n.filter&&"none"!==n.filter)return r;r=r.parentNode}return null}(e)||t}var de="top",fe="bottom",me="right",ve="left",he="auto",ye=[de,fe,me,ve],ge="start",be="end",_e="viewport",xe="popper",we=ye.reduce(function(e,t){return e.concat([t+"-"+ge,t+"-"+be])},[]),Le=[].concat(ye,[he]).reduce(function(e,t){return e.concat([t,t+"-"+ge,t+"-"+be])},[]),Ee=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function Oe(e){var t=new Map,r=new Set,n=[];function o(e){r.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach(function(e){if(!r.has(e)){var n=t.get(e);n&&o(n)}}),n.push(e)}return e.forEach(function(e){t.set(e.name,e)}),e.forEach(function(e){r.has(e.name)||o(e)}),n}var je={placement:"bottom",modifiers:[],strategy:"absolute"};function Ae(){for(var e=arguments.length,t=new Array(e),r=0;r=0?"x":"y"}function Te(e){var t,r=e.reference,n=e.element,o=e.placement,a=o?Se(o):null,i=o?Ce(o):null,s=r.x+r.width/2-n.width/2,l=r.y+r.height/2-n.height/2;switch(a){case de:t={x:s,y:r.y-n.height};break;case fe:t={x:s,y:r.y+r.height};break;case me:t={x:r.x+r.width,y:l};break;case ve:t={x:r.x-n.width,y:l};break;default:t={x:r.x,y:r.y}}var c=a?Me(a):null;if(null!=c){var u="y"===c?"height":"width";switch(i){case ge:t[c]=t[c]-(r[u]/2-n[u]/2);break;case be:t[c]=t[c]+(r[u]/2-n[u]/2)}}return t}var Be={top:"auto",right:"auto",bottom:"auto",left:"auto"};function De(e){var t,r=e.popper,n=e.popperRect,o=e.placement,a=e.variation,i=e.offsets,s=e.position,l=e.gpuAcceleration,c=e.adaptive,u=e.roundOffsets,p=e.isFixed,d=i.x,f=void 0===d?0:d,m=i.y,v=void 0===m?0:m,h="function"==typeof u?u({x:f,y:v}):{x:f,y:v};f=h.x,v=h.y;var y=i.hasOwnProperty("x"),g=i.hasOwnProperty("y"),b=ve,_=de,x=window;if(c){var w=pe(r),L="clientHeight",E="clientWidth";if(w===W(r)&&"static"!==re(w=ee(r)).position&&"absolute"===s&&(L="scrollHeight",E="scrollWidth"),o===de||(o===ve||o===me)&&a===be)_=fe,v-=(p&&w===x&&x.visualViewport?x.visualViewport.height:w[L])-n.height,v*=l?1:-1;if(o===ve||(o===de||o===fe)&&a===be)b=me,f-=(p&&w===x&&x.visualViewport?x.visualViewport.width:w[E])-n.width,f*=l?1:-1}var O,j=Object.assign({position:s},c&&Be),A=!0===u?function(e,t){var r=e.x,n=e.y,o=t.devicePixelRatio||1;return{x:G(r*o)/o||0,y:G(n*o)/o||0}}({x:f,y:v},W(r)):{x:f,y:v};return f=A.x,v=A.y,l?Object.assign({},j,((O={})[_]=g?"0":"",O[b]=y?"0":"",O.transform=(x.devicePixelRatio||1)<=1?"translate("+f+"px, "+v+"px)":"translate3d("+f+"px, "+v+"px, 0)",O)):Object.assign({},j,((t={})[_]=g?v+"px":"",t[b]=y?f+"px":"",t.transform="",t))}const Ne={name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach(function(e){var r=t.styles[e]||{},n=t.attributes[e]||{},o=t.elements[e];V(o)&&Q(o)&&(Object.assign(o.style,r),Object.keys(n).forEach(function(e){var t=n[e];!1===t?o.removeAttribute(e):o.setAttribute(e,!0===t?"":t)}))})},effect:function(e){var t=e.state,r={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,r.popper),t.styles=r,t.elements.arrow&&Object.assign(t.elements.arrow.style,r.arrow),function(){Object.keys(t.elements).forEach(function(e){var n=t.elements[e],o=t.attributes[e]||{},a=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:r[e]).reduce(function(e,t){return e[t]="",e},{});V(n)&&Q(n)&&(Object.assign(n.style,a),Object.keys(o).forEach(function(e){n.removeAttribute(e)}))})}},requires:["computeStyles"]};const Re={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,r=e.options,n=e.name,o=r.offset,a=void 0===o?[0,0]:o,i=Le.reduce(function(e,r){return e[r]=function(e,t,r){var n=Se(e),o=[ve,de].indexOf(n)>=0?-1:1,a="function"==typeof r?r(Object.assign({},t,{placement:e})):r,i=a[0],s=a[1];return i=i||0,s=(s||0)*o,[ve,me].indexOf(n)>=0?{x:s,y:i}:{x:i,y:s}}(r,t.rects,a),e},{}),s=i[t.placement],l=s.x,c=s.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=c),t.modifiersData[n]=i}};var Ze={left:"right",right:"left",bottom:"top",top:"bottom"};function ze(e){return e.replace(/left|right|bottom|top/g,function(e){return Ze[e]})}var Fe={start:"end",end:"start"};function Ie(e){return e.replace(/start|end/g,function(e){return Fe[e]})}function We(e,t){var r=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(r&&U(r)){var n=t;do{if(n&&e.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}function He(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function Ve(e,t,r){return t===_e?He(function(e,t){var r=W(e),n=ee(e),o=r.visualViewport,a=n.clientWidth,i=n.clientHeight,s=0,l=0;if(o){a=o.width,i=o.height;var c=J();(c||!c&&"fixed"===t)&&(s=o.offsetLeft,l=o.offsetTop)}return{width:a,height:i,x:s+te(e),y:l}}(e,r)):H(t)?function(e,t){var r=Y(e,!1,"fixed"===t);return r.top=r.top+e.clientTop,r.left=r.left+e.clientLeft,r.bottom=r.top+e.clientHeight,r.right=r.left+e.clientWidth,r.width=e.clientWidth,r.height=e.clientHeight,r.x=r.left,r.y=r.top,r}(t,r):He(function(e){var t,r=ee(e),n=K(e),o=null==(t=e.ownerDocument)?void 0:t.body,a=q(r.scrollWidth,r.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),i=q(r.scrollHeight,r.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),s=-n.scrollLeft+te(e),l=-n.scrollTop;return"rtl"===re(o||r).direction&&(s+=q(r.clientWidth,o?o.clientWidth:0)-a),{width:a,height:i,x:s,y:l}}(ee(e)))}function Ue(e,t,r,n){var o="clippingParents"===t?function(e){var t=le(ie(e)),r=["absolute","fixed"].indexOf(re(e).position)>=0&&V(e)?pe(e):e;return H(r)?t.filter(function(e){return H(e)&&We(e,r)&&"body"!==Q(e)}):[]}(e):[].concat(t),a=[].concat(o,[r]),i=a[0],s=a.reduce(function(t,r){var o=Ve(e,r,n);return t.top=q(o.top,t.top),t.right=$(o.right,t.right),t.bottom=$(o.bottom,t.bottom),t.left=q(o.left,t.left),t},Ve(e,i,n));return s.width=s.right-s.left,s.height=s.bottom-s.top,s.x=s.left,s.y=s.top,s}function qe(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function $e(e,t){return t.reduce(function(t,r){return t[r]=e,t},{})}function Ge(e,t){void 0===t&&(t={});var r=t,n=r.placement,o=void 0===n?e.placement:n,a=r.strategy,i=void 0===a?e.strategy:a,s=r.boundary,l=void 0===s?"clippingParents":s,c=r.rootBoundary,u=void 0===c?_e:c,p=r.elementContext,d=void 0===p?xe:p,f=r.altBoundary,m=void 0!==f&&f,v=r.padding,h=void 0===v?0:v,y=qe("number"!=typeof h?h:$e(h,ye)),g=d===xe?"reference":xe,b=e.rects.popper,_=e.elements[m?g:d],x=Ue(H(_)?_:_.contextElement||ee(e.elements.popper),l,u,i),w=Y(e.elements.reference),L=Te({reference:w,element:b,strategy:"absolute",placement:o}),E=He(Object.assign({},b,L)),O=d===xe?E:w,j={top:x.top-O.top+y.top,bottom:O.bottom-x.bottom+y.bottom,left:x.left-O.left+y.left,right:O.right-x.right+y.right},A=e.modifiersData.offset;if(d===xe&&A){var k=A[o];Object.keys(j).forEach(function(e){var t=[me,fe].indexOf(e)>=0?1:-1,r=[de,fe].indexOf(e)>=0?"y":"x";j[e]+=k[r]*t})}return j}function Xe(e,t,r){return q(e,$(t,r))}const Je={name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,r=e.options,n=e.name,o=r.mainAxis,a=void 0===o||o,i=r.altAxis,s=void 0!==i&&i,l=r.boundary,c=r.rootBoundary,u=r.altBoundary,p=r.padding,d=r.tether,f=void 0===d||d,m=r.tetherOffset,v=void 0===m?0:m,h=Ge(t,{boundary:l,rootBoundary:c,padding:p,altBoundary:u}),y=Se(t.placement),g=Ce(t.placement),b=!g,_=Me(y),x="x"===_?"y":"x",w=t.modifiersData.popperOffsets,L=t.rects.reference,E=t.rects.popper,O="function"==typeof v?v(Object.assign({},t.rects,{placement:t.placement})):v,j="number"==typeof O?{mainAxis:O,altAxis:O}:Object.assign({mainAxis:0,altAxis:0},O),A=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,k={x:0,y:0};if(w){if(a){var P,S="y"===_?de:ve,C="y"===_?fe:me,M="y"===_?"height":"width",T=w[_],B=T+h[S],D=T-h[C],N=f?-E[M]/2:0,R=g===ge?L[M]:E[M],Z=g===ge?-E[M]:-L[M],z=t.elements.arrow,F=f&&z?ae(z):{width:0,height:0},I=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},W=I[S],H=I[C],V=Xe(0,L[M],F[M]),U=b?L[M]/2-N-V-W-j.mainAxis:R-V-W-j.mainAxis,G=b?-L[M]/2+N+V+H+j.mainAxis:Z+V+H+j.mainAxis,X=t.elements.arrow&&pe(t.elements.arrow),J=X?"y"===_?X.clientTop||0:X.clientLeft||0:0,Y=null!=(P=null==A?void 0:A[_])?P:0,K=T+G-Y,Q=Xe(f?$(B,T+U-Y-J):B,T,f?q(D,K):D);w[_]=Q,k[_]=Q-T}if(s){var ee,te="x"===_?de:ve,re="x"===_?fe:me,ne=w[x],oe="y"===x?"height":"width",ie=ne+h[te],se=ne-h[re],le=-1!==[de,ve].indexOf(y),ce=null!=(ee=null==A?void 0:A[x])?ee:0,ue=le?ie:ne-L[oe]-E[oe]-ce+j.altAxis,he=le?ne+L[oe]+E[oe]-ce-j.altAxis:se,ye=f&&le?function(e,t,r){var n=Xe(e,t,r);return n>r?r:n}(ue,ne,he):Xe(f?ue:ie,ne,f?he:se);w[x]=ye,k[x]=ye-ne}t.modifiersData[n]=k}},requiresIfExists:["offset"]};const Ye={name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,r=e.state,n=e.name,o=e.options,a=r.elements.arrow,i=r.modifiersData.popperOffsets,s=Se(r.placement),l=Me(s),c=[ve,me].indexOf(s)>=0?"height":"width";if(a&&i){var u=function(e,t){return qe("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:$e(e,ye))}(o.padding,r),p=ae(a),d="y"===l?de:ve,f="y"===l?fe:me,m=r.rects.reference[c]+r.rects.reference[l]-i[l]-r.rects.popper[c],v=i[l]-r.rects.reference[l],h=pe(a),y=h?"y"===l?h.clientHeight||0:h.clientWidth||0:0,g=m/2-v/2,b=u[d],_=y-p[c]-u[f],x=y/2-p[c]/2+g,w=Xe(b,x,_),L=l;r.modifiersData[n]=((t={})[L]=w,t.centerOffset=w-x,t)}},effect:function(e){var t=e.state,r=e.options.element,n=void 0===r?"[data-popper-arrow]":r;null!=n&&("string"!=typeof n||(n=t.elements.popper.querySelector(n)))&&We(t.elements.popper,n)&&(t.elements.arrow=n)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Ke(e,t,r){return void 0===r&&(r={x:0,y:0}),{top:e.top-t.height-r.y,right:e.right-t.width+r.x,bottom:e.bottom-t.height+r.y,left:e.left-t.width-r.x}}function Qe(e){return[de,me,fe,ve].some(function(t){return e[t]>=0})}var et=ke({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(e){var t=e.state,r=e.instance,n=e.options,o=n.scroll,a=void 0===o||o,i=n.resize,s=void 0===i||i,l=W(t.elements.popper),c=[].concat(t.scrollParents.reference,t.scrollParents.popper);return a&&c.forEach(function(e){e.addEventListener("scroll",r.update,Pe)}),s&&l.addEventListener("resize",r.update,Pe),function(){a&&c.forEach(function(e){e.removeEventListener("scroll",r.update,Pe)}),s&&l.removeEventListener("resize",r.update,Pe)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(e){var t=e.state,r=e.name;t.modifiersData[r]=Te({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(e){var t=e.state,r=e.options,n=r.gpuAcceleration,o=void 0===n||n,a=r.adaptive,i=void 0===a||a,s=r.roundOffsets,l=void 0===s||s,c={placement:Se(t.placement),variation:Ce(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:o,isFixed:"fixed"===t.options.strategy};null!=t.modifiersData.popperOffsets&&(t.styles.popper=Object.assign({},t.styles.popper,De(Object.assign({},c,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:i,roundOffsets:l})))),null!=t.modifiersData.arrow&&(t.styles.arrow=Object.assign({},t.styles.arrow,De(Object.assign({},c,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})},data:{}},Ne,Re,{name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,r=e.options,n=e.name;if(!t.modifiersData[n]._skip){for(var o=r.mainAxis,a=void 0===o||o,i=r.altAxis,s=void 0===i||i,l=r.fallbackPlacements,c=r.padding,u=r.boundary,p=r.rootBoundary,d=r.altBoundary,f=r.flipVariations,m=void 0===f||f,v=r.allowedAutoPlacements,h=t.options.placement,y=Se(h),g=l||(y===h||!m?[ze(h)]:function(e){if(Se(e)===he)return[];var t=ze(e);return[Ie(e),t,Ie(t)]}(h)),b=[h].concat(g).reduce(function(e,r){return e.concat(Se(r)===he?function(e,t){void 0===t&&(t={});var r=t,n=r.placement,o=r.boundary,a=r.rootBoundary,i=r.padding,s=r.flipVariations,l=r.allowedAutoPlacements,c=void 0===l?Le:l,u=Ce(n),p=u?s?we:we.filter(function(e){return Ce(e)===u}):ye,d=p.filter(function(e){return c.indexOf(e)>=0});0===d.length&&(d=p);var f=d.reduce(function(t,r){return t[r]=Ge(e,{placement:r,boundary:o,rootBoundary:a,padding:i})[Se(r)],t},{});return Object.keys(f).sort(function(e,t){return f[e]-f[t]})}(t,{placement:r,boundary:u,rootBoundary:p,padding:c,flipVariations:m,allowedAutoPlacements:v}):r)},[]),_=t.rects.reference,x=t.rects.popper,w=new Map,L=!0,E=b[0],O=0;O=0,S=P?"width":"height",C=Ge(t,{placement:j,boundary:u,rootBoundary:p,altBoundary:d,padding:c}),M=P?k?me:ve:k?fe:de;_[S]>x[S]&&(M=ze(M));var T=ze(M),B=[];if(a&&B.push(C[A]<=0),s&&B.push(C[M]<=0,C[T]<=0),B.every(function(e){return e})){E=j,L=!1;break}w.set(j,B)}if(L)for(var D=function(e){var t=b.find(function(t){var r=w.get(t);if(r)return r.slice(0,e).every(function(e){return e})});if(t)return E=t,"break"},N=m?3:1;N>0;N--){if("break"===D(N))break}t.placement!==E&&(t.modifiersData[n]._skip=!0,t.placement=E,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}},Je,Ye,{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(e){var t=e.state,r=e.name,n=t.rects.reference,o=t.rects.popper,a=t.modifiersData.preventOverflow,i=Ge(t,{elementContext:"reference"}),s=Ge(t,{altBoundary:!0}),l=Ke(i,n),c=Ke(s,o,a),u=Qe(l),p=Qe(c);t.modifiersData[r]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:p},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":p})}}]}),tt="tippy-content",rt="tippy-backdrop",nt="tippy-arrow",ot="tippy-svg-arrow",at={passive:!0,capture:!0},it=function(){return document.body};function st(e,t,r){if(Array.isArray(e)){var n=e[t];return null==n?Array.isArray(r)?r[t]:r:n}return e}function lt(e,t){var r={}.toString.call(e);return 0===r.indexOf("[object")&&r.indexOf(t+"]")>-1}function ct(e,t){return"function"==typeof e?e.apply(void 0,t):e}function ut(e,t){return 0===t?e:function(n){clearTimeout(r),r=setTimeout(function(){e(n)},t)};var r}function pt(e){return[].concat(e)}function dt(e,t){-1===e.indexOf(t)&&e.push(t)}function ft(e){return e.split("-")[0]}function mt(e){return[].slice.call(e)}function vt(e){return Object.keys(e).reduce(function(t,r){return void 0!==e[r]&&(t[r]=e[r]),t},{})}function ht(){return document.createElement("div")}function yt(e){return["Element","Fragment"].some(function(t){return lt(e,t)})}function gt(e){return lt(e,"MouseEvent")}function bt(e){return!(!e||!e._tippy||e._tippy.reference!==e)}function _t(e){return yt(e)?[e]:function(e){return lt(e,"NodeList")}(e)?mt(e):Array.isArray(e)?e:mt(document.querySelectorAll(e))}function xt(e,t){e.forEach(function(e){e&&(e.style.transitionDuration=t+"ms")})}function wt(e,t){e.forEach(function(e){e&&e.setAttribute("data-state",t)})}function Lt(e){var t,r=pt(e)[0];return null!=r&&null!=(t=r.ownerDocument)&&t.body?r.ownerDocument:document}function Et(e,t,r){var n=t+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(t){e[n](t,r)})}function Ot(e,t){for(var r=t;r;){var n;if(e.contains(r))return!0;r=null==r.getRootNode||null==(n=r.getRootNode())?void 0:n.host}return!1}var jt={isTouch:!1},At=0;function kt(){jt.isTouch||(jt.isTouch=!0,window.performance&&document.addEventListener("mousemove",Pt))}function Pt(){var e=performance.now();e-At<20&&(jt.isTouch=!1,document.removeEventListener("mousemove",Pt)),At=e}function St(){var e=document.activeElement;if(bt(e)){var t=e._tippy;e.blur&&!t.state.isVisible&&e.blur()}}var Ct=!!("undefined"!=typeof window&&"undefined"!=typeof document)&&!!window.msCrypto;var Mt={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},Tt=Object.assign({appendTo:it,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},Mt,{allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999}),Bt=Object.keys(Tt);function Dt(e){var t=(e.plugins||[]).reduce(function(t,r){var n,o=r.name,a=r.defaultValue;o&&(t[o]=void 0!==e[o]?e[o]:null!=(n=Tt[o])?n:a);return t},{});return Object.assign({},e,t)}function Nt(e,t){var r=Object.assign({},t,{content:ct(t.content,[e])},t.ignoreAttributes?{}:function(e,t){return(t?Object.keys(Dt(Object.assign({},Tt,{plugins:t}))):Bt).reduce(function(t,r){var n=(e.getAttribute("data-tippy-"+r)||"").trim();if(!n)return t;if("content"===r)t[r]=n;else try{t[r]=JSON.parse(n)}catch(e){t[r]=n}return t},{})}(e,t.plugins));return r.aria=Object.assign({},Tt.aria,r.aria),r.aria={expanded:"auto"===r.aria.expanded?t.interactive:r.aria.expanded,content:"auto"===r.aria.content?t.interactive?null:"describedby":r.aria.content},r}function Rt(e,t){e.innerHTML=t}function Zt(e){var t=ht();return!0===e?t.className=nt:(t.className=ot,yt(e)?t.appendChild(e):Rt(t,e)),t}function zt(e,t){yt(t.content)?(Rt(e,""),e.appendChild(t.content)):"function"!=typeof t.content&&(t.allowHTML?Rt(e,t.content):e.textContent=t.content)}function Ft(e){var t=e.firstElementChild,r=mt(t.children);return{box:t,content:r.find(function(e){return e.classList.contains(tt)}),arrow:r.find(function(e){return e.classList.contains(nt)||e.classList.contains(ot)}),backdrop:r.find(function(e){return e.classList.contains(rt)})}}function It(e){var t=ht(),r=ht();r.className="tippy-box",r.setAttribute("data-state","hidden"),r.setAttribute("tabindex","-1");var n=ht();function o(r,n){var o=Ft(t),a=o.box,i=o.content,s=o.arrow;n.theme?a.setAttribute("data-theme",n.theme):a.removeAttribute("data-theme"),"string"==typeof n.animation?a.setAttribute("data-animation",n.animation):a.removeAttribute("data-animation"),n.inertia?a.setAttribute("data-inertia",""):a.removeAttribute("data-inertia"),a.style.maxWidth="number"==typeof n.maxWidth?n.maxWidth+"px":n.maxWidth,n.role?a.setAttribute("role",n.role):a.removeAttribute("role"),r.content===n.content&&r.allowHTML===n.allowHTML||zt(i,e.props),n.arrow?s?r.arrow!==n.arrow&&(a.removeChild(s),a.appendChild(Zt(n.arrow))):a.appendChild(Zt(n.arrow)):s&&a.removeChild(s)}return n.className=tt,n.setAttribute("data-state","hidden"),zt(n,e.props),t.appendChild(r),r.appendChild(n),o(e.props,e.props),{popper:t,onUpdate:o}}It.$$tippy=!0;var Wt=1,Ht=[],Vt=[];function Ut(e,t){var r,n,o,a,i,s,l,c,u=Nt(e,Object.assign({},Tt,Dt(vt(t)))),p=!1,d=!1,f=!1,m=!1,v=[],h=ut($,u.interactiveDebounce),y=Wt++,g=(c=u.plugins).filter(function(e,t){return c.indexOf(e)===t}),b={id:y,reference:e,popper:ht(),popperInstance:null,props:u,state:{isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},plugins:g,clearDelayTimeouts:function(){clearTimeout(r),clearTimeout(n),cancelAnimationFrame(o)},setProps:function(t){0;if(b.state.isDestroyed)return;T("onBeforeUpdate",[b,t]),U();var r=b.props,n=Nt(e,Object.assign({},r,vt(t),{ignoreAttributes:!0}));b.props=n,V(),r.interactiveDebounce!==n.interactiveDebounce&&(N(),h=ut($,n.interactiveDebounce));r.triggerTarget&&!n.triggerTarget?pt(r.triggerTarget).forEach(function(e){e.removeAttribute("aria-expanded")}):n.triggerTarget&&e.removeAttribute("aria-expanded");D(),M(),w&&w(r,n);b.popperInstance&&(Y(),Q().forEach(function(e){requestAnimationFrame(e._tippy.popperInstance.forceUpdate)}));T("onAfterUpdate",[b,t])},setContent:function(e){b.setProps({content:e})},show:function(){0;var e=b.state.isVisible,t=b.state.isDestroyed,r=!b.state.isEnabled,n=jt.isTouch&&!b.props.touch,o=st(b.props.duration,0,Tt.duration);if(e||t||r||n)return;if(k().hasAttribute("disabled"))return;if(T("onShow",[b],!1),!1===b.props.onShow(b))return;b.state.isVisible=!0,A()&&(x.style.visibility="visible");M(),F(),b.state.isMounted||(x.style.transition="none");if(A()){var a=S();xt([a.box,a.content],0)}s=function(){var e;if(b.state.isVisible&&!m){if(m=!0,x.offsetHeight,x.style.transition=b.props.moveTransition,A()&&b.props.animation){var t=S(),r=t.box,n=t.content;xt([r,n],o),wt([r,n],"visible")}B(),D(),dt(Vt,b),null==(e=b.popperInstance)||e.forceUpdate(),T("onMount",[b]),b.props.animation&&A()&&function(e,t){W(e,t)}(o,function(){b.state.isShown=!0,T("onShown",[b])})}},function(){var e,t=b.props.appendTo,r=k();e=b.props.interactive&&t===it||"parent"===t?r.parentNode:ct(t,[r]);e.contains(x)||e.appendChild(x);b.state.isMounted=!0,Y(),!1}()},hide:function(){0;var e=!b.state.isVisible,t=b.state.isDestroyed,r=!b.state.isEnabled,n=st(b.props.duration,1,Tt.duration);if(e||t||r)return;if(T("onHide",[b],!1),!1===b.props.onHide(b))return;b.state.isVisible=!1,b.state.isShown=!1,m=!1,p=!1,A()&&(x.style.visibility="hidden");if(N(),I(),M(!0),A()){var o=S(),a=o.box,i=o.content;b.props.animation&&(xt([a,i],n),wt([a,i],"hidden"))}B(),D(),b.props.animation?A()&&function(e,t){W(e,function(){!b.state.isVisible&&x.parentNode&&x.parentNode.contains(x)&&t()})}(n,b.unmount):b.unmount()},hideWithInteractivity:function(e){0;P().addEventListener("mousemove",h),dt(Ht,h),h(e)},enable:function(){b.state.isEnabled=!0},disable:function(){b.hide(),b.state.isEnabled=!1},unmount:function(){0;b.state.isVisible&&b.hide();if(!b.state.isMounted)return;K(),Q().forEach(function(e){e._tippy.unmount()}),x.parentNode&&x.parentNode.removeChild(x);Vt=Vt.filter(function(e){return e!==b}),b.state.isMounted=!1,T("onHidden",[b])},destroy:function(){0;if(b.state.isDestroyed)return;b.clearDelayTimeouts(),b.unmount(),U(),delete e._tippy,b.state.isDestroyed=!0,T("onDestroy",[b])}};if(!u.render)return b;var _=u.render(b),x=_.popper,w=_.onUpdate;x.setAttribute("data-tippy-root",""),x.id="tippy-"+b.id,b.popper=x,e._tippy=b,x._tippy=b;var L=g.map(function(e){return e.fn(b)}),E=e.hasAttribute("aria-expanded");return V(),D(),M(),T("onCreate",[b]),u.showOnCreate&&ee(),x.addEventListener("mouseenter",function(){b.props.interactive&&b.state.isVisible&&b.clearDelayTimeouts()}),x.addEventListener("mouseleave",function(){b.props.interactive&&b.props.trigger.indexOf("mouseenter")>=0&&P().addEventListener("mousemove",h)}),b;function O(){var e=b.props.touch;return Array.isArray(e)?e:[e,0]}function j(){return"hold"===O()[0]}function A(){var e;return!(null==(e=b.props.render)||!e.$$tippy)}function k(){return l||e}function P(){var e=k().parentNode;return e?Lt(e):document}function S(){return Ft(x)}function C(e){return b.state.isMounted&&!b.state.isVisible||jt.isTouch||a&&"focus"===a.type?0:st(b.props.delay,e?0:1,Tt.delay)}function M(e){void 0===e&&(e=!1),x.style.pointerEvents=b.props.interactive&&!e?"":"none",x.style.zIndex=""+b.props.zIndex}function T(e,t,r){var n;(void 0===r&&(r=!0),L.forEach(function(r){r[e]&&r[e].apply(r,t)}),r)&&(n=b.props)[e].apply(n,t)}function B(){var t=b.props.aria;if(t.content){var r="aria-"+t.content,n=x.id;pt(b.props.triggerTarget||e).forEach(function(e){var t=e.getAttribute(r);if(b.state.isVisible)e.setAttribute(r,t?t+" "+n:n);else{var o=t&&t.replace(n,"").trim();o?e.setAttribute(r,o):e.removeAttribute(r)}})}}function D(){!E&&b.props.aria.expanded&&pt(b.props.triggerTarget||e).forEach(function(e){b.props.interactive?e.setAttribute("aria-expanded",b.state.isVisible&&e===k()?"true":"false"):e.removeAttribute("aria-expanded")})}function N(){P().removeEventListener("mousemove",h),Ht=Ht.filter(function(e){return e!==h})}function R(t){if(!jt.isTouch||!f&&"mousedown"!==t.type){var r=t.composedPath&&t.composedPath()[0]||t.target;if(!b.props.interactive||!Ot(x,r)){if(pt(b.props.triggerTarget||e).some(function(e){return Ot(e,r)})){if(jt.isTouch)return;if(b.state.isVisible&&b.props.trigger.indexOf("click")>=0)return}else T("onClickOutside",[b,t]);!0===b.props.hideOnClick&&(b.clearDelayTimeouts(),b.hide(),d=!0,setTimeout(function(){d=!1}),b.state.isMounted||I())}}}function Z(){f=!0}function z(){f=!1}function F(){var e=P();e.addEventListener("mousedown",R,!0),e.addEventListener("touchend",R,at),e.addEventListener("touchstart",z,at),e.addEventListener("touchmove",Z,at)}function I(){var e=P();e.removeEventListener("mousedown",R,!0),e.removeEventListener("touchend",R,at),e.removeEventListener("touchstart",z,at),e.removeEventListener("touchmove",Z,at)}function W(e,t){var r=S().box;function n(e){e.target===r&&(Et(r,"remove",n),t())}if(0===e)return t();Et(r,"remove",i),Et(r,"add",n),i=n}function H(t,r,n){void 0===n&&(n=!1),pt(b.props.triggerTarget||e).forEach(function(e){e.addEventListener(t,r,n),v.push({node:e,eventType:t,handler:r,options:n})})}function V(){var e;j()&&(H("touchstart",q,{passive:!0}),H("touchend",G,{passive:!0})),(e=b.props.trigger,e.split(/\s+/).filter(Boolean)).forEach(function(e){if("manual"!==e)switch(H(e,q),e){case"mouseenter":H("mouseleave",G);break;case"focus":H(Ct?"focusout":"blur",X);break;case"focusin":H("focusout",X)}})}function U(){v.forEach(function(e){var t=e.node,r=e.eventType,n=e.handler,o=e.options;t.removeEventListener(r,n,o)}),v=[]}function q(e){var t,r=!1;if(b.state.isEnabled&&!J(e)&&!d){var n="focus"===(null==(t=a)?void 0:t.type);a=e,l=e.currentTarget,D(),!b.state.isVisible&>(e)&&Ht.forEach(function(t){return t(e)}),"click"===e.type&&(b.props.trigger.indexOf("mouseenter")<0||p)&&!1!==b.props.hideOnClick&&b.state.isVisible?r=!0:ee(e),"click"===e.type&&(p=!r),r&&!n&&te(e)}}function $(e){var t=e.target,r=k().contains(t)||x.contains(t);if("mousemove"!==e.type||!r){var n=Q().concat(x).map(function(e){var t,r=null==(t=e._tippy.popperInstance)?void 0:t.state;return r?{popperRect:e.getBoundingClientRect(),popperState:r,props:u}:null}).filter(Boolean);(function(e,t){var r=t.clientX,n=t.clientY;return e.every(function(e){var t=e.popperRect,o=e.popperState,a=e.props.interactiveBorder,i=ft(o.placement),s=o.modifiersData.offset;if(!s)return!0;var l="bottom"===i?s.top.y:0,c="top"===i?s.bottom.y:0,u="right"===i?s.left.x:0,p="left"===i?s.right.x:0,d=t.top-n+l>a,f=n-t.bottom-c>a,m=t.left-r+u>a,v=r-t.right-p>a;return d||f||m||v})})(n,e)&&(N(),te(e))}}function G(e){J(e)||b.props.trigger.indexOf("click")>=0&&p||(b.props.interactive?b.hideWithInteractivity(e):te(e))}function X(e){b.props.trigger.indexOf("focusin")<0&&e.target!==k()||b.props.interactive&&e.relatedTarget&&x.contains(e.relatedTarget)||te(e)}function J(e){return!!jt.isTouch&&j()!==e.type.indexOf("touch")>=0}function Y(){K();var t=b.props,r=t.popperOptions,n=t.placement,o=t.offset,a=t.getReferenceClientRect,i=t.moveTransition,l=A()?Ft(x).arrow:null,c=a?{getBoundingClientRect:a,contextElement:a.contextElement||k()}:e,u={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(e){var t=e.state;if(A()){var r=S().box;["placement","reference-hidden","escaped"].forEach(function(e){"placement"===e?r.setAttribute("data-placement",t.placement):t.attributes.popper["data-popper-"+e]?r.setAttribute("data-"+e,""):r.removeAttribute("data-"+e)}),t.attributes.popper={}}}},p=[{name:"offset",options:{offset:o}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!i}},u];A()&&l&&p.push({name:"arrow",options:{element:l,padding:3}}),p.push.apply(p,(null==r?void 0:r.modifiers)||[]),b.popperInstance=et(c,x,Object.assign({},r,{placement:n,onFirstUpdate:s,modifiers:p}))}function K(){b.popperInstance&&(b.popperInstance.destroy(),b.popperInstance=null)}function Q(){return mt(x.querySelectorAll("[data-tippy-root]"))}function ee(e){b.clearDelayTimeouts(),e&&T("onTrigger",[b,e]),F();var t=C(!0),n=O(),o=n[0],a=n[1];jt.isTouch&&"hold"===o&&a&&(t=a),t?r=setTimeout(function(){b.show()},t):b.show()}function te(e){if(b.clearDelayTimeouts(),T("onUntrigger",[b,e]),b.state.isVisible){if(!(b.props.trigger.indexOf("mouseenter")>=0&&b.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(e.type)>=0&&p)){var t=C(!1);t?n=setTimeout(function(){b.state.isVisible&&b.hide()},t):o=requestAnimationFrame(function(){b.hide()})}}else I()}}function qt(e,t){void 0===t&&(t={});var r=Tt.plugins.concat(t.plugins||[]);document.addEventListener("touchstart",kt,at),window.addEventListener("blur",St);var n=Object.assign({},t,{plugins:r}),o=_t(e).reduce(function(e,t){var r=t&&Ut(t,n);return r&&e.push(r),e},[]);return yt(e)?o[0]:o}qt.defaultProps=Tt,qt.setDefaultProps=function(e){Object.keys(e).forEach(function(t){Tt[t]=e[t]})},qt.currentInput=jt;Object.assign({},Ne,{effect:function(e){var t=e.state,r={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(t.elements.popper.style,r.popper),t.styles=r,t.elements.arrow&&Object.assign(t.elements.arrow.style,r.arrow)}});qt.setDefaultProps({render:It});const $t=qt;var Gt=r(6087);const Xt=({children:e,value:t})=>Gt.createElement("div",{className:"colorpalette-color-label"},Gt.createElement("span",null,e),Gt.createElement("span",{className:"component-color-indicator","aria-label":`Color: ${t}`,style:{background:t}})),Jt=new(o())("_"),Yt=({attributes:t,setAttributes:r,colors:n})=>{const o=p()(t),a=Jt.object(o),[i,u]=(0,l.useState)(a.customSettings);t.transformation_crop||(t.transformation_crop="pad",t.transformation_background="rgb:FFFFFF"),"fill"===t.transformation_crop&&delete t.transformation_background;const d=(e,t)=>{const n={[t]:I(e)};r(n)},f=(e=>{const[t,r]=(0,l.useState)(null),n=(0,l.useCallback)(e=>r(e),[]);return(0,l.useEffect)(()=>{if(!t)return;const r=$t(t,{content:e});return()=>{r?.destroy()}},[t,e]),n})((0,e.__)("How to resize or crop images to fit the gallery. Pad adds padding around the image using the specified padding style. Fill crops the image from the center so it fills as much of the available space as possible.","cloudinary"));return Gt.createElement(Gt.Fragment,null,Gt.createElement(s.PanelBody,{title:(0,e.__)("Layout","cloudinary")},y.map(e=>Gt.createElement(R,{key:`${e.value.type}-${e.value.columns}-layout`,value:e.value,onChange:e=>{r({displayProps_mode:e.type,displayProps_columns:e.columns||1})},icon:e.icon,current:{type:t.displayProps_mode,columns:t.displayProps_columns||1}},e.label))),Gt.createElement(s.PanelBody,{title:(0,e.__)("Color Palette","cloudinary"),initialOpen:!1},Gt.createElement(Xt,{value:t.themeProps_primary},(0,e.__)("Primary","cloudinary")),Gt.createElement(c.ColorPalette,{value:t.themeProps_primary,colors:n,disableCustomColors:!1,onChange:e=>d(e,"themeProps_primary")}),Gt.createElement(Xt,{value:t.themeProps_onPrimary},(0,e.__)("On Primary","cloudinary")),Gt.createElement(c.ColorPalette,{value:t.themeProps_onPrimary,colors:n,disableCustomColors:!1,onChange:e=>d(e,"themeProps_onPrimary")}),Gt.createElement(Xt,{value:t.themeProps_active},(0,e.__)("Active","cloudinary")),Gt.createElement(c.ColorPalette,{value:t.themeProps_active,colors:n,disableCustomColors:!1,onChange:e=>d(e,"themeProps_active")})),"classic"===t.displayProps_mode&&Gt.createElement(s.PanelBody,{title:(0,e.__)("Fade Transition","cloudinary"),initialOpen:!1},Gt.createElement(s.SelectControl,{value:t.transition,options:_,onChange:e=>r({transition:e}),__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0})),Gt.createElement(s.PanelBody,{title:(0,e.__)("Main Viewer Parameters","cloudinary"),initialOpen:!1},Gt.createElement(s.SelectControl,{label:(0,e.__)("Aspect Ratio","cloudinary"),value:t.aspectRatio,options:b,onChange:e=>r({aspectRatio:e}),__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0}),Gt.createElement("p",null,Gt.createElement("div",{className:"cld-ui-title"},(0,e.__)("Resize/Crop Mode","cloudinary"),Gt.createElement("span",{className:"dashicons dashicons-info cld-tooltip",ref:f})),Gt.createElement(s.ButtonGroup,null,M.map(e=>Gt.createElement(s.Button,{key:e.value+"-look-and-feel",variant:"secondary",isSecondary:!0,isPressed:e.value===t.transformation_crop,onClick:()=>r({transformation_crop:e.value,transformation_background:null})},e.label)))),"pad"===t.transformation_crop&&Gt.createElement(s.SelectControl,{label:(0,e.__)("Pad style","cloudinary"),value:t.transformation_background,options:T,onChange:e=>{r({transformation_background:e})},__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0}),Gt.createElement("p",null,(0,e.__)("Navigation","cloudinary")),Gt.createElement("p",null,Gt.createElement(s.ButtonGroup,null,x.map(e=>Gt.createElement(s.Button,{key:e.value+"-navigation",variant:"secondary",isSecondary:!0,isPressed:e.value===t.navigation,onClick:()=>r({navigation:e.value})},e.label)))),Gt.createElement("div",{style:{marginTop:"30px"}},Gt.createElement(s.ToggleControl,{label:(0,e.__)("Show Zoom","cloudinary"),checked:t.zoom,onChange:()=>r({zoom:!t.zoom}),__nextHasNoMarginBottom:!0}),t.zoom&&Gt.createElement(Gt.Fragment,null,Gt.createElement("p",null,(0,e.__)("Zoom Type","cloudinary")),Gt.createElement("p",null,Gt.createElement(s.ButtonGroup,null,w.map(e=>Gt.createElement(s.Button,{key:e.value+"-zoom-type",variant:"secondary",isSecondary:!0,isPressed:e.value===t.zoomProps_type,onClick:()=>r({zoomProps_type:e.value})},e.label)))),"flyout"===t.zoomProps_type&&Gt.createElement(s.SelectControl,{label:(0,e.__)("Zoom Viewer Position","cloudinary"),value:t.zoomProps_viewerPosition,options:L,onChange:e=>r({zoomProps_viewerPosition:e}),__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0}),"popup"!==t.zoomProps_type&&Gt.createElement(Gt.Fragment,null,Gt.createElement("p",null,(0,e.__)("Zoom Trigger","cloudinary")),Gt.createElement("p",null,Gt.createElement(s.ButtonGroup,null,E.map(e=>Gt.createElement(s.Button,{key:e.value+"-zoom-trigger",variant:"secondary",isSecondary:!0,isPressed:e.value===t.zoomProps_trigger,onClick:()=>r({zoomProps_trigger:e.value})},e.label)))))))),Gt.createElement(s.PanelBody,{title:(0,e.__)("Carousel Parameters","cloudinary"),initialOpen:!1},Gt.createElement("p",null,(0,e.__)("Carousel Location","cloudinary")),Gt.createElement("p",null,Gt.createElement(s.ButtonGroup,null,O.map(e=>Gt.createElement(s.Button,{key:e.value+"-carousel-location",variant:"secondary",isSecondary:!0,isPressed:e.value===t.carouselLocation,onClick:()=>r({carouselLocation:e.value})},e.label)))),Gt.createElement(s.RangeControl,{label:(0,e.__)("Carousel Offset","cloudinary"),value:t.carouselOffset,onChange:e=>r({carouselOffset:e}),min:0,max:100,__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0}),Gt.createElement("p",null,(0,e.__)("Carousel Style","cloudinary")),Gt.createElement("p",null,Gt.createElement(s.ButtonGroup,null,j.map(e=>Gt.createElement(s.Button,{key:e.value+"-carousel-style",variant:"secondary",isSecondary:!0,isPressed:e.value===t.carouselStyle,onClick:()=>r({carouselStyle:e.value})},e.label)))),"thumbnails"===t.carouselStyle&&Gt.createElement(Gt.Fragment,null,Gt.createElement(s.RangeControl,{label:(0,e.__)("Width","cloudinary"),value:t.thumbnailProps_width,onChange:e=>r({thumbnailProps_width:e}),min:5,max:300,__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0}),Gt.createElement(s.RangeControl,{label:(0,e.__)("Height","cloudinary"),value:t.thumbnailProps_height,onChange:e=>r({thumbnailProps_height:e}),min:5,max:300,__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0}),Gt.createElement("p",null,(0,e.__)("Navigation Button Shape","cloudinary")),A.map(e=>Gt.createElement(R,{key:e.value+"-navigation-button-shape",value:e.value,onChange:e=>r({thumbnailProps_navigationShape:e}),icon:e.icon,current:t.thumbnailProps_navigationShape},e.label)),Gt.createElement("p",null,(0,e.__)("Selected Style","cloudinary")),Gt.createElement("p",null,Gt.createElement(s.ButtonGroup,null,P.map(e=>Gt.createElement(s.Button,{key:e.value+"-selected-style",variant:"secondary",isSecondary:!0,isPressed:e.value===t.thumbnailProps_selectedStyle,onClick:()=>r({thumbnailProps_selectedStyle:e.value})},e.label)))),Gt.createElement(s.SelectControl,{label:(0,e.__)("Selected Border Position","cloudinary"),value:t.thumbnailProps_selectedBorderPosition,options:S,onChange:e=>r({thumbnailProps_selectedBorderPosition:e}),__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0}),Gt.createElement(s.RangeControl,{label:(0,e.__)("Selected Border Width","cloudinary"),value:t.thumbnailProps_selectedBorderWidth,onChange:e=>r({thumbnailProps_selectedBorderWidth:e}),min:0,max:10,__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0}),Gt.createElement("p",null,(0,e.__)("Media Shape Icon","cloudinary")),C.map(e=>Gt.createElement(R,{key:e.value+"-media",value:e.value,onChange:e=>r({thumbnailProps_mediaSymbolShape:e}),icon:e.icon,current:t.thumbnailProps_mediaSymbolShape},e.label))),"indicators"===t.carouselStyle&&Gt.createElement(Gt.Fragment,null,Gt.createElement("p",null,(0,e.__)("Indicators Shape","cloudinary")),k.map(e=>Gt.createElement(R,{key:e.value+"-indicator",value:e.value,onChange:e=>r({indicatorProps_shape:e}),icon:e.icon,current:t.indicatorProps_shape},e.label)))),Gt.createElement(s.PanelBody,{title:(0,e.__)("Additional Settings","cloudinary"),initialOpen:!1},Gt.createElement(s.TextareaControl,{label:(0,e.__)("Custom Settings","cloudinary"),help:(0,e.__)("Provide a JSON string of the settings you want to add and/or override.","cloudinary"),value:i,onChange:e=>{let t={};u(e);try{t=JSON.parse(e)}catch(e){}if("object"==typeof t){const e={...a};e.customSettings=t,r({...a,...e})}},__nextHasNoMarginBottom:!0})))};var Kt=r(6087);const Qt=new(o())("_"),er=(0,e.__)("Drag images, upload new ones or select files from your library.","cloudinary"),tr=(e,t)=>({...e,container:"."+t,zoom:!1}),rr=({setAttributes:t,attributes:r,className:n,isSelected:a})=>{const[u,d]=(0,l.useState)(null),[f,m]=(0,l.useState)(!1),v=(0,l.useMemo)(()=>{if(0!==r.selectedImages.length)return r;const e={},{container:t,...n}=Qt.dot(CLD_GALLERY_CONFIG);return Object.keys(n).forEach(t=>{r[t]||(e[t]=n[t])}),{...r,...e}},[r]),h=(0,l.useMemo)(()=>r.selectedImages.length?r.selectedImages.map(({attachmentId:e})=>({id:e})):[],[r]);(0,l.useEffect)(()=>{if(u&&((({status:e,message:t,options:r={}})=>{(0,Z.dispatch)("core/notices").createNotice(e,t,{isDismissible:!0,...r})})({status:"error",message:u}),d(null)),r.selectedImages.length){let e;const{customSettings:t,...n}=(e=>{const t=new(o())("_"),r=p()(e),{selectedImages:n,...a}=t.object(r,{});return a.mediaAssets=n,"classic"!==a?.displayProps?.mode?delete a.transition:delete a.displayProps.columns,"pad"!==a?.transformation_crop&&delete a.transformation_background,"pad"!==a?.transformation?.crop&&delete a.transformation.background,a?.themeProps?.primary&&(a.themeProps.primary=I(a?.themeProps?.primary)),a?.themeProps?.onPrimary&&(a.themeProps.onPrimary=I(a?.themeProps?.onPrimary)),a?.themeProps?.active&&(a.themeProps.active=I(a?.themeProps?.active)),a})(r);try{e=cloudinary.galleryWidget(tr({...n,...t},r.container))}catch{e=cloudinary.galleryWidget(tr(n,r.container))}return e.render(),m(!1),()=>e.destroy()}},[u,r,t,n]);const y=!!r.selectedImages.length;return r.container||t({container:`${n}${F(15)}`}),t(v),Kt.createElement(Kt.Fragment,null,Kt.createElement(Kt.Fragment,null,Kt.createElement("div",{className:r.container||n}),Kt.createElement("div",{className:"wp-block-cloudinary-gallery"},Kt.createElement(c.MediaPlaceholder,{labels:{title:!y&&(0,e.__)("Cloudinary Gallery","cloudinary"),instructions:!y&&er},icon:"format-gallery",disableMediaButtons:y&&!a,allowedTypes:g,addToGallery:y,isAppender:y,onSelect:r=>(async r=>{m(!0);try{const e=await i()({path:CLD_REST_ENDPOINT+"/image_data",method:"POST",data:{images:r}});t({selectedImages:e})}catch{m(!1),d((0,e.__)("Could not load selected images. Please try again.","cloudinary"))}})(r),value:h,multiple:!0},f&&Kt.createElement("div",{className:"loading-spinner-container"},Kt.createElement(s.Spinner,null))))),Kt.createElement(c.InspectorControls,null,Kt.createElement(Yt,{attributes:r,setAttributes:t})))};var nr=r(6087);const or=({attributes:e})=>nr.createElement("div",{className:e.container}),ar=JSON.parse('{"aspectRatio":{"type":"string"},"navigation":{"type":"string"},"zoom":{"type":"boolean"},"carouselLocation":{"type":"string"},"carouselOffset":{"type":"number"},"carouselStyle":{"type":"string"},"displayProps_mode":{"type":"string"},"displayProps_columns":{"type":"number"},"indicatorProps_shape":{"type":"string"},"themeProps_primary":{"type":"string"},"themeProps_onPrimary":{"type":"string"},"themeProps_active":{"type":"string"},"zoomProps_type":{"type":"string"},"zoomProps_viewerPosition":{"type":"string"},"zoomProps_trigger":{"type":"string"},"thumbnailProps_width":{"type":"number"},"thumbnailProps_height":{"type":"number"},"thumbnailProps_navigationShape":{"type":"string"},"thumbnailProps_selectedStyle":{"type":"string"},"thumbnailProps_selectedBorderPosition":{"type":"string"},"thumbnailProps_selectedBorderWidth":{"type":"number"},"thumbnailProps_mediaSymbolShape":{"type":"string"},"cloudName":{"type":"string"},"container":{"type":"string"},"selectedImages":{"type":"array","default":[]},"transformation_crop":{"type":"string","default":"pad"},"transformation_background":{"type":"string"},"customSettings":{"type":"string"}}');(0,t.registerBlockType)("cloudinary/gallery",{title:(0,e.__)("Cloudinary Gallery","cloudinary"),description:(0,e.__)("Add a gallery powered by the Cloudinary Gallery Widget to your post.","cloudinary"),category:"widgets",icon:"format-gallery",attributes:ar,edit:rr,save:or})})()})(); +(()=>{var e={1780(e){"use strict";function t(e,t){var r,n;if("function"==typeof t)void 0!==(n=t(e))&&(e=n);else if(Array.isArray(t))for(r=0;r=0&&(e=e.replace(/\[/g,t).replace(/]/g,""));var r=e.split(t);if(r.filter(s).length!==r.length)throw Error("Refusing to update blacklisted property "+e);return r}var c=Object.prototype.hasOwnProperty;function u(e,t,r,n){if(!(this instanceof u))return new u(e,t,r,n);void 0===t&&(t=!1),void 0===r&&(r=!0),void 0===n&&(n=!0),this.separator=e||".",this.override=t,this.useArray=r,this.useBrackets=n,this.keepArray=!1,this.cleanup=[]}var p=new u(".",!1,!0,!0);function d(e){return function(){return p[e].apply(p,arguments)}}u.prototype._fill=function(e,r,n,i){var s=e.shift();if(e.length>0){if(r[s]=r[s]||(this.useArray&&function(e){return/^\d+$/.test(e)}(e[0])?[]:{}),!o(r[s])){if(!this.override){if(!o(n)||!a(n))throw new Error("Trying to redefine `"+s+"` which is a "+typeof r[s]);return}r[s]={}}this._fill(e,r[s],n,i)}else{if(!this.override&&o(r[s])&&!a(r[s])){if(!o(n)||!a(n))throw new Error("Trying to redefine non-empty obj['"+s+"']");return}r[s]=t(n,i)}},u.prototype.object=function(e,r){var n=this;return Object.keys(e).forEach(function(o){var a=void 0===r?null:r[o],i=l(o,n.separator).join(n.separator);-1!==i.indexOf(n.separator)?(n._fill(i.split(n.separator),e,e[o],a),delete e[o]):e[o]=t(e[o],a)}),e},u.prototype.str=function(e,r,n,o){var a=l(e,this.separator).join(this.separator);return-1!==e.indexOf(this.separator)?this._fill(a.split(this.separator),n,r,o):n[e]=t(r,o),n},u.prototype.pick=function(e,t,n,o){var a,i,s,c,u;for(i=l(e,this.separator),a=0;a-1&&e%1==0&&e-1}},1175(e,t,r){var n=r(6025);e.exports=function(e,t){var r=this.__data__,o=n(r,e);return o<0?(++this.size,r.push([e,t])):r[o][1]=t,this}},3040(e,t,r){var n=r(1549),o=r(79),a=r(8223);e.exports=function(){this.size=0,this.__data__={hash:new n,map:new(a||o),string:new n}}},7670(e,t,r){var n=r(2651);e.exports=function(e){var t=n(this,e).delete(e);return this.size-=t?1:0,t}},289(e,t,r){var n=r(2651);e.exports=function(e){return n(this,e).get(e)}},4509(e,t,r){var n=r(2651);e.exports=function(e){return n(this,e).has(e)}},2949(e,t,r){var n=r(2651);e.exports=function(e,t){var r=n(this,e),o=r.size;return r.set(e,t),this.size+=r.size==o?0:1,this}},1042(e,t,r){var n=r(6110)(Object,"create");e.exports=n},3650(e,t,r){var n=r(4335)(Object.keys,Object);e.exports=n},181(e){e.exports=function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}},6009(e,t,r){e=r.nmd(e);var n=r(4840),o=t&&!t.nodeType&&t,a=o&&e&&!e.nodeType&&e,i=a&&a.exports===o&&n.process,s=function(){try{var e=a&&a.require&&a.require("util").types;return e||i&&i.binding&&i.binding("util")}catch(e){}}();e.exports=s},9350(e){var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},4335(e){e.exports=function(e,t){return function(r){return e(t(r))}}},9325(e,t,r){var n=r(4840),o="object"==typeof self&&self&&self.Object===Object&&self,a=n||o||Function("return this")();e.exports=a},1420(e,t,r){var n=r(79);e.exports=function(){this.__data__=new n,this.size=0}},938(e){e.exports=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}},3605(e){e.exports=function(e){return this.__data__.get(e)}},9817(e){e.exports=function(e){return this.__data__.has(e)}},945(e,t,r){var n=r(79),o=r(8223),a=r(3661);e.exports=function(e,t){var r=this.__data__;if(r instanceof n){var i=r.__data__;if(!o||i.length<199)return i.push([e,t]),this.size=++r.size,this;r=this.__data__=new a(i)}return r.set(e,t),this.size=r.size,this}},7473(e){var t=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return t.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},8055(e,t,r){var n=r(9999);e.exports=function(e){return n(e,5)}},5288(e){e.exports=function(e,t){return e===t||e!=e&&t!=t}},2428(e,t,r){var n=r(7534),o=r(346),a=Object.prototype,i=a.hasOwnProperty,s=a.propertyIsEnumerable,l=n(function(){return arguments}())?n:function(e){return o(e)&&i.call(e,"callee")&&!s.call(e,"callee")};e.exports=l},6449(e){var t=Array.isArray;e.exports=t},4894(e,t,r){var n=r(1882),o=r(294);e.exports=function(e){return null!=e&&o(e.length)&&!n(e)}},3656(e,t,r){e=r.nmd(e);var n=r(9325),o=r(9935),a=t&&!t.nodeType&&t,i=a&&e&&!e.nodeType&&e,s=i&&i.exports===a?n.Buffer:void 0,l=(s?s.isBuffer:void 0)||o;e.exports=l},1882(e,t,r){var n=r(2552),o=r(3805);e.exports=function(e){if(!o(e))return!1;var t=n(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},294(e){e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},7730(e,t,r){var n=r(9172),o=r(7301),a=r(6009),i=a&&a.isMap,s=i?o(i):n;e.exports=s},3805(e){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},346(e){e.exports=function(e){return null!=e&&"object"==typeof e}},8440(e,t,r){var n=r(6038),o=r(7301),a=r(6009),i=a&&a.isSet,s=i?o(i):n;e.exports=s},7167(e,t,r){var n=r(4901),o=r(7301),a=r(6009),i=a&&a.isTypedArray,s=i?o(i):n;e.exports=s},5950(e,t,r){var n=r(695),o=r(8984),a=r(4894);e.exports=function(e){return a(e)?n(e):o(e)}},7241(e,t,r){var n=r(695),o=r(2903),a=r(4894);e.exports=function(e){return a(e)?n(e,!0):o(e)}},3345(e){e.exports=function(){return[]}},9935(e){e.exports=function(){return!1}},6087(e){"use strict";e.exports=window.wp.element},6942(e,t){var r;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e="",t=0;t{const t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{if(Array.isArray(t))for(var n=0;nObject.hasOwn(e,t),r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),r.dn=e=>{(Object.getOwnPropertyDescriptor(e,"name")||{}).writable||Object.defineProperty(e,"name",{value:"default",configurable:!0})},(()=>{"use strict";const e=window.wp.i18n,t=window.wp.blocks;var n=r(1780),o=r.n(n);const a=window.wp.apiFetch;var i=r.n(a);const s=window.wp.components;window.wp["components/buildStyle/style.css"];var l=r(6087);const c=window.wp.blockEditor;var u=r(8055),p=r.n(u),d=r(6087);const f=()=>d.createElement("svg",{width:"18px",height:"18px",viewBox:"0 0 18 18",version:"1.1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"},d.createElement("title",null,"shape-round"),d.createElement("desc",null,"Created with Sketch."),d.createElement("g",{id:"Desktop-0.4",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},d.createElement("g",{id:"widgets/shape-round",transform:"translate(-3.000000, -3.000000)",fill:"#000000"},d.createElement("path",{d:"M12,3 C16.9705627,3 21,7.02943725 21,12 C21,16.9705627 16.9705627,21 12,21 C7.02943725,21 3,16.9705627 3,12 C3,7.02943725 7.02943725,3 12,3 Z M12,5 C8.13400675,5 5,8.13400675 5,12 C5,15.8659932 8.13400675,19 12,19 C15.8659932,19 19,15.8659932 19,12 C19,8.13400675 15.8659932,5 12,5 Z",id:"Combined-Shape"})))),m=()=>d.createElement("svg",{width:"18px",height:"18px",viewBox:"0 0 18 18",version:"1.1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"},d.createElement("title",null,"ratio-square"),d.createElement("desc",null,"Created with Sketch."),d.createElement("g",{id:"Desktop-0.4",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},d.createElement("g",{id:"widgets/shape-square",transform:"translate(-3.000000, -3.000000)",fill:"#000000"},d.createElement("path",{d:"M3,3 L3,21 L21,21 L21,3 L3,3 Z M5,5 L5,19 L19,19 L19,5 L5,5 Z",id:"shape"})))),v=()=>d.createElement("svg",{width:"18px",height:"18px",viewBox:"0 0 18 18",version:"1.1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"},d.createElement("title",null,"shape-radius"),d.createElement("desc",null,"Created with Sketch."),d.createElement("g",{id:"Desktop-0.4",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},d.createElement("g",{id:"widgets/shape-radius",transform:"translate(-3.000000, -3.000000)",fill:"#000000"},d.createElement("path",{d:"M17,3 C19.209139,3 21,4.790861 21,7 L21,17 C21,19.209139 19.209139,21 17,21 L7,21 C4.790861,21 3,19.209139 3,17 L3,7 C3,4.790861 4.790861,3 7,3 L17,3 Z M17,5 L7,5 C5.9456382,5 5.08183488,5.81587779 5.00548574,6.85073766 L5,7 L5,17 C5,18.0543618 5.81587779,18.9181651 6.85073766,18.9945143 L7,19 L17,19 C18.0543618,19 18.9181651,18.1841222 18.9945143,17.1492623 L19,17 L19,7 C19,5.9456382 18.1841222,5.08183488 17.1492623,5.00548574 L17,5 Z",id:"Rectangle"})))),h=()=>d.createElement("svg",{width:"18px",height:"18px",viewBox:"0 0 18 18",version:"1.1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"},d.createElement("title",null,"shape-none"),d.createElement("desc",null,"Created with Sketch."),d.createElement("g",{id:"Desktop-0.4",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},d.createElement("g",{id:"widgets/shape-none",transform:"translate(-3.000000, -3.000000)",fill:"#000000"},d.createElement("path",{d:"M5,19 L5,21 L3,21 L3,19 L5,19 Z M21,19 L21,21 L19,21 L19,19 L21,19 Z M13,19 L13,21 L11,21 L11,19 L13,19 Z M9,19 L9,21 L7,21 L7,19 L9,19 Z M17,19 L17,21 L15,21 L15,19 L17,19 Z M21,15 L21,17 L19,17 L19,15 L21,15 Z M21,11 L21,13 L19,13 L19,11 L21,11 Z M5,11 L5,13 L3,13 L3,11 L5,11 Z M21,7 L21,9 L19,9 L19,7 L21,7 Z M5,7 L5,9 L3,9 L3,7 L5,7 Z M13,3 L13,5 L11,5 L11,3 L13,3 Z M9,3 L9,5 L7,5 L7,3 L9,3 Z M17,3 L17,5 L15,5 L15,3 L17,3 Z M21,3 L21,5 L19,5 L19,3 L21,3 Z M5,3 L5,5 L3,5 L3,3 L5,3 Z M3,15 L5,15 L5,17 L3,17 L3,15 Z",id:"Shape"})))),y=[{value:{type:"expanded",columns:1},icon:()=>d.createElement("svg",{width:"17px",height:"20px",viewBox:"0 0 17 20",version:"1.1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"},d.createElement("title",null,"layout-modern"),d.createElement("desc",null,"Created with Sketch."),d.createElement("g",{id:"Desktop-0.4",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},d.createElement("g",{id:"widgets/layout-modern",transform:"translate(-2.000000, -3.000000)",fill:"#000000"},d.createElement("path",{d:"M2,10 L5,10 L5,7 L2,7 L2,10 Z M2,14 L5,14 L5,11 L2,11 L2,14 Z M2,6 L5,6 L5,3 L2,3 L2,6 Z M6,3 L6,17 L19,17 L19,3 L6,3 Z M8,5 L8,15 L17,15 L17,5 L8,5 Z M6,18 L6,23 L19,23 L19,18 L6,18 Z M8,20 L8,23 L17,23 L17,20 L8,20 Z",id:"shape"})))),label:(0,e.__)("Expanded - 1 Column","cloudinary")},{value:{type:"expanded",columns:2},icon:()=>d.createElement("svg",{width:"18px",height:"17px",viewBox:"0 0 18 17",version:"1.1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"},d.createElement("title",null,"layout-grid-2-column"),d.createElement("desc",null,"Created with Sketch."),d.createElement("g",{id:"Desktop-0.4",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},d.createElement("g",{id:"widgets/layout-gird-2-col",transform:"translate(-3.000000, -3.000000)",fill:"#000000"},d.createElement("path",{d:"M11,12 L11,20 L3,20 L3,12 L11,12 Z M21,12 L21,20 L13,20 L13,12 L21,12 Z M9,14 L5,14 L5,18 L9,18 L9,14 Z M19,14 L15,14 L15,18 L19,18 L19,14 Z M11,3 L11,11 L3,11 L3,3 L11,3 Z M21,3 L21,11 L13,11 L13,3 L21,3 Z M9,5 L5,5 L5,9 L9,9 L9,5 Z M19,5 L15,5 L15,9 L19,9 L19,5 Z",id:"Shape"})))),label:(0,e.__)("Expanded - 2 Column","cloudinary")},{value:{type:"expanded",columns:3},icon:()=>d.createElement("svg",{width:"20px",height:"13px",viewBox:"0 0 20 13",version:"1.1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"},d.createElement("title",null,"layout-grid-3-column"),d.createElement("desc",null,"Created with Sketch."),d.createElement("g",{id:"Desktop-0.4",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},d.createElement("g",{id:"widgets/layout-gird-3-col",transform:"translate(-2.000000, -5.000000)",fill:"#000000"},d.createElement("path",{d:"M8,12 L8,18 L2,18 L2,12 L8,12 Z M15,12 L15,18 L9,18 L9,12 L15,12 Z M22,12 L22,18 L16,18 L16,12 L22,12 Z M6,14 L4,14 L4,16 L6,16 L6,14 Z M13,14 L11,14 L11,16 L13,16 L13,14 Z M20,14 L18,14 L18,16 L20,16 L20,14 Z M8,5 L8,11 L2,11 L2,5 L8,5 Z M15,5 L15,11 L9,11 L9,5 L15,5 Z M22,5 L22,11 L16,11 L16,5 L22,5 Z M6,7 L4,7 L4,9 L6,9 L6,7 Z M13,7 L11,7 L11,9 L13,9 L13,7 Z M20,7 L18,7 L18,9 L20,9 L20,7 Z",id:"Combined-Shape"})))),label:(0,e.__)("Expanded - 3 Column","cloudinary")},{value:{type:"classic",columns:1},icon:()=>d.createElement("svg",{width:"17px",height:"14px",viewBox:"0 0 17 14",version:"1.1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"},d.createElement("title",null,"layout-classic"),d.createElement("desc",null,"Created with Sketch."),d.createElement("g",{id:"Desktop-0.4",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},d.createElement("g",{id:"widgets/layout-classic",transform:"translate(-3.000000, -5.000000)",fill:"#000000"},d.createElement("path",{d:"M3,12 L6,12 L6,9 L3,9 L3,12 Z M3,16 L6,16 L6,13 L3,13 L3,16 Z M3,8 L6,8 L6,5 L3,5 L3,8 Z M7,5 L7,19 L20,19 L20,5 L7,5 Z M9,7 L9,17 L18,17 L18,7 L9,7 Z",id:"shape"})))),label:(0,e.__)("Classic","cloudinary")}],b=["image"],g=[{label:(0,e.__)("1:1","cloudinary"),value:"1:1"},{label:(0,e.__)("3:4","cloudinary"),value:"3:4"},{label:(0,e.__)("4:3","cloudinary"),value:"4:3"},{label:(0,e.__)("4:6","cloudinary"),value:"4:6"},{label:(0,e.__)("6:4","cloudinary"),value:"6:4"},{label:(0,e.__)("5:7","cloudinary"),value:"5:7"},{label:(0,e.__)("7:5","cloudinary"),value:"7:5"},{label:(0,e.__)("8:5","cloudinary"),value:"8:5"},{label:(0,e.__)("5:8","cloudinary"),value:"5:8"},{label:(0,e.__)("9:16","cloudinary"),value:"9:16"},{label:(0,e.__)("16:9","cloudinary"),value:"16:9"}],_=[{label:(0,e.__)("None","cloudinary"),value:"none"},{label:(0,e.__)("Fade","cloudinary"),value:"fade"},{label:(0,e.__)("Slide","cloudinary"),value:"slide"}],x=[{label:(0,e.__)("Always","cloudinary"),value:"always"},{label:(0,e.__)("None","cloudinary"),value:"none"},{label:(0,e.__)("MouseOver","cloudinary"),value:"mouseover"}],w=[{label:(0,e.__)("Inline","cloudinary"),value:"inline"},{label:(0,e.__)("Flyout","cloudinary"),value:"flyout"},{label:(0,e.__)("Popup","cloudinary"),value:"popup"}],L=[{label:(0,e.__)("Top","cloudinary"),value:"top"},{label:(0,e.__)("Bottom","cloudinary"),value:"bottom"},{label:(0,e.__)("Left","cloudinary"),value:"left"},{label:(0,e.__)("Right","cloudinary"),value:"right"}],E=[{label:(0,e.__)("Click","cloudinary"),value:"click"},{label:(0,e.__)("Hover","cloudinary"),value:"hover"}],O=[{label:(0,e.__)("Left","cloudinary"),value:"left"},{label:(0,e.__)("Right","cloudinary"),value:"right"},{label:(0,e.__)("Top","cloudinary"),value:"top"},{label:(0,e.__)("Bottom","cloudinary"),value:"bottom"}],j=[{label:(0,e.__)("Thumbnails","cloudinary"),value:"thumbnails"},{label:(0,e.__)("Indicators","cloudinary"),value:"indicators"},{label:(0,e.__)("None","cloudinary"),value:"none"}],A=[{value:"round",icon:f,label:(0,e.__)("Round","cloudinary")},{value:"radius",icon:v,label:(0,e.__)("Radius","cloudinary")},{value:"none",icon:h,label:(0,e.__)("None","cloudinary")},{value:"square",icon:m,label:(0,e.__)("Square","cloudinary")},{value:"rectangle",icon:()=>d.createElement("svg",{width:"14px",height:"20px",viewBox:"0 0 14 20",version:"1.1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"},d.createElement("title",null,"ratio-9-16"),d.createElement("desc",null,"Created with Sketch."),d.createElement("g",{id:"Desktop-0.4",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},d.createElement("g",{id:"ratio/9-16",transform:"translate(-5.000000, -2.000000)",fill:"#000000"},d.createElement("path",{d:"M22,5.5 L22,18.5 L2,18.5 L2,5.5 L22,5.5 Z M20,7.5 L4,7.5 L4,16.5 L20,16.5 L20,7.5 Z",id:"Combined-Shape",transform:"translate(12.000000, 12.000000) rotate(-90.000000) translate(-12.000000, -12.000000) "})))),label:(0,e.__)("Rectangle","cloudinary")}],P=[{value:"round",icon:f,label:(0,e.__)("Round","cloudinary")},{value:"radius",icon:v,label:(0,e.__)("Radius","cloudinary")},{value:"square",icon:m,label:(0,e.__)("Square","cloudinary")}],k=[{label:(0,e.__)("All","cloudinary"),value:"all"},{label:(0,e.__)("Border","cloudinary"),value:"border"},{label:(0,e.__)("Gradient","cloudinary"),value:"gradient"}],S=[{label:(0,e.__)("All","cloudinary"),value:"all"},{label:(0,e.__)("Top","cloudinary"),value:"top"},{label:(0,e.__)("Top-Bottom","cloudinary"),value:"top-bottom"},{label:(0,e.__)("Left-Right","cloudinary"),value:"left-right"},{label:(0,e.__)("Bottom","cloudinary"),value:"bottom"},{label:(0,e.__)("Left","cloudinary"),value:"left"},{label:(0,e.__)("Right","cloudinary"),value:"right"}],C=[{value:"round",icon:f,label:(0,e.__)("Round","cloudinary")},{value:"radius",icon:v,label:(0,e.__)("Radius","cloudinary")},{value:"none",icon:h,label:(0,e.__)("None","cloudinary")},{value:"square",icon:m,label:(0,e.__)("Square","cloudinary")}],M=[{label:(0,e.__)("Pad","cloudinary"),value:"pad"},{label:(0,e.__)("Fill","cloudinary"),value:"fill"}],B=[{label:(0,e.__)("White padding","cloudinary"),value:"rgb:FFFFFF"},{label:(0,e.__)("Border color padding","cloudinary"),value:"auto"},{label:(0,e.__)("Predominant color padding","cloudinary"),value:"auto:predominant"},{label:(0,e.__)("Gradient fade padding","cloudinary"),value:"auto:predominant_gradient"}];var T=r(6942),D=r.n(T),N=r(6087);const R=({value:e,children:t,icon:r,onChange:n,current:o})=>{const a="object"==typeof e?JSON.stringify(e)===JSON.stringify(o):o===e;return N.createElement("button",{type:"button",onClick:()=>n(e),className:D()("radio-select",{"radio-select--active":a})},N.createElement(r,null),N.createElement("div",{className:"radio-select__label"},t))};r.dn(R);const Z=window.wp.data,z=e=>e<10?"0"+String(e):e.toString(16),I=e=>{const t=new Uint8Array((e||40)/2);return window.crypto.getRandomValues(t),Array.from(t,z).join("")},F=e=>{const t=/var\((.*)\)/g.exec(e);return t?getComputedStyle(document.documentElement).getPropertyValue(t[1]):e};function W(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function H(e){return e instanceof W(e).Element||e instanceof Element}function V(e){return e instanceof W(e).HTMLElement||e instanceof HTMLElement}function U(e){return"undefined"!=typeof ShadowRoot&&(e instanceof W(e).ShadowRoot||e instanceof ShadowRoot)}var q=Math.max,$=Math.min,G=Math.round;function X(){var e=navigator.userAgentData;return null!=e&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function J(){return!/^((?!chrome|android).)*safari/i.test(X())}function Y(e,t,r){void 0===t&&(t=!1),void 0===r&&(r=!1);var n=e.getBoundingClientRect(),o=1,a=1;t&&V(e)&&(o=e.offsetWidth>0&&G(n.width)/e.offsetWidth||1,a=e.offsetHeight>0&&G(n.height)/e.offsetHeight||1);var i=(H(e)?W(e):window).visualViewport,s=!J()&&r,l=(n.left+(s&&i?i.offsetLeft:0))/o,c=(n.top+(s&&i?i.offsetTop:0))/a,u=n.width/o,p=n.height/a;return{width:u,height:p,top:c,right:l+u,bottom:c+p,left:l,x:l,y:c}}function K(e){var t=W(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function Q(e){return e?(e.nodeName||"").toLowerCase():null}function ee(e){return((H(e)?e.ownerDocument:e.document)||window.document).documentElement}function te(e){return Y(ee(e)).left+K(e).scrollLeft}function re(e){return W(e).getComputedStyle(e)}function ne(e){var t=re(e),r=t.overflow,n=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(r+o+n)}function oe(e,t,r){void 0===r&&(r=!1);var n,o,a=V(t),i=V(t)&&function(e){var t=e.getBoundingClientRect(),r=G(t.width)/e.offsetWidth||1,n=G(t.height)/e.offsetHeight||1;return 1!==r||1!==n}(t),s=ee(t),l=Y(e,i,r),c={scrollLeft:0,scrollTop:0},u={x:0,y:0};return(a||!a&&!r)&&(("body"!==Q(t)||ne(s))&&(c=(n=t)!==W(n)&&V(n)?{scrollLeft:(o=n).scrollLeft,scrollTop:o.scrollTop}:K(n)),V(t)?((u=Y(t,!0)).x+=t.clientLeft,u.y+=t.clientTop):s&&(u.x=te(s))),{x:l.left+c.scrollLeft-u.x,y:l.top+c.scrollTop-u.y,width:l.width,height:l.height}}function ae(e){var t=Y(e),r=e.offsetWidth,n=e.offsetHeight;return Math.abs(t.width-r)<=1&&(r=t.width),Math.abs(t.height-n)<=1&&(n=t.height),{x:e.offsetLeft,y:e.offsetTop,width:r,height:n}}function ie(e){return"html"===Q(e)?e:e.assignedSlot||e.parentNode||(U(e)?e.host:null)||ee(e)}function se(e){return["html","body","#document"].indexOf(Q(e))>=0?e.ownerDocument.body:V(e)&&ne(e)?e:se(ie(e))}function le(e,t){var r;void 0===t&&(t=[]);var n=se(e),o=n===(null==(r=e.ownerDocument)?void 0:r.body),a=W(n),i=o?[a].concat(a.visualViewport||[],ne(n)?n:[]):n,s=t.concat(i);return o?s:s.concat(le(ie(i)))}function ce(e){return["table","td","th"].indexOf(Q(e))>=0}function ue(e){return V(e)&&"fixed"!==re(e).position?e.offsetParent:null}function pe(e){for(var t=W(e),r=ue(e);r&&ce(r)&&"static"===re(r).position;)r=ue(r);return r&&("html"===Q(r)||"body"===Q(r)&&"static"===re(r).position)?t:r||function(e){var t=/firefox/i.test(X());if(/Trident/i.test(X())&&V(e)&&"fixed"===re(e).position)return null;var r=ie(e);for(U(r)&&(r=r.host);V(r)&&["html","body"].indexOf(Q(r))<0;){var n=re(r);if("none"!==n.transform||"none"!==n.perspective||"paint"===n.contain||-1!==["transform","perspective"].indexOf(n.willChange)||t&&"filter"===n.willChange||t&&n.filter&&"none"!==n.filter)return r;r=r.parentNode}return null}(e)||t}var de="top",fe="bottom",me="right",ve="left",he="auto",ye=[de,fe,me,ve],be="start",ge="end",_e="viewport",xe="popper",we=ye.reduce(function(e,t){return e.concat([t+"-"+be,t+"-"+ge])},[]),Le=[].concat(ye,[he]).reduce(function(e,t){return e.concat([t,t+"-"+be,t+"-"+ge])},[]),Ee=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function Oe(e){var t=new Map,r=new Set,n=[];function o(e){r.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach(function(e){if(!r.has(e)){var n=t.get(e);n&&o(n)}}),n.push(e)}return e.forEach(function(e){t.set(e.name,e)}),e.forEach(function(e){r.has(e.name)||o(e)}),n}var je={placement:"bottom",modifiers:[],strategy:"absolute"};function Ae(){for(var e=arguments.length,t=new Array(e),r=0;r=0?"x":"y"}function Be(e){var t,r=e.reference,n=e.element,o=e.placement,a=o?Se(o):null,i=o?Ce(o):null,s=r.x+r.width/2-n.width/2,l=r.y+r.height/2-n.height/2;switch(a){case de:t={x:s,y:r.y-n.height};break;case fe:t={x:s,y:r.y+r.height};break;case me:t={x:r.x+r.width,y:l};break;case ve:t={x:r.x-n.width,y:l};break;default:t={x:r.x,y:r.y}}var c=a?Me(a):null;if(null!=c){var u="y"===c?"height":"width";switch(i){case be:t[c]=t[c]-(r[u]/2-n[u]/2);break;case ge:t[c]=t[c]+(r[u]/2-n[u]/2)}}return t}var Te={top:"auto",right:"auto",bottom:"auto",left:"auto"};function De(e){var t,r=e.popper,n=e.popperRect,o=e.placement,a=e.variation,i=e.offsets,s=e.position,l=e.gpuAcceleration,c=e.adaptive,u=e.roundOffsets,p=e.isFixed,d=i.x,f=void 0===d?0:d,m=i.y,v=void 0===m?0:m,h="function"==typeof u?u({x:f,y:v}):{x:f,y:v};f=h.x,v=h.y;var y=i.hasOwnProperty("x"),b=i.hasOwnProperty("y"),g=ve,_=de,x=window;if(c){var w=pe(r),L="clientHeight",E="clientWidth";if(w===W(r)&&"static"!==re(w=ee(r)).position&&"absolute"===s&&(L="scrollHeight",E="scrollWidth"),o===de||(o===ve||o===me)&&a===ge)_=fe,v-=(p&&w===x&&x.visualViewport?x.visualViewport.height:w[L])-n.height,v*=l?1:-1;if(o===ve||(o===de||o===fe)&&a===ge)g=me,f-=(p&&w===x&&x.visualViewport?x.visualViewport.width:w[E])-n.width,f*=l?1:-1}var O,j=Object.assign({position:s},c&&Te),A=!0===u?function(e,t){var r=e.x,n=e.y,o=t.devicePixelRatio||1;return{x:G(r*o)/o||0,y:G(n*o)/o||0}}({x:f,y:v},W(r)):{x:f,y:v};return f=A.x,v=A.y,l?Object.assign({},j,((O={})[_]=b?"0":"",O[g]=y?"0":"",O.transform=(x.devicePixelRatio||1)<=1?"translate("+f+"px, "+v+"px)":"translate3d("+f+"px, "+v+"px, 0)",O)):Object.assign({},j,((t={})[_]=b?v+"px":"",t[g]=y?f+"px":"",t.transform="",t))}const Ne={name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach(function(e){var r=t.styles[e]||{},n=t.attributes[e]||{},o=t.elements[e];V(o)&&Q(o)&&(Object.assign(o.style,r),Object.keys(n).forEach(function(e){var t=n[e];!1===t?o.removeAttribute(e):o.setAttribute(e,!0===t?"":t)}))})},effect:function(e){var t=e.state,r={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,r.popper),t.styles=r,t.elements.arrow&&Object.assign(t.elements.arrow.style,r.arrow),function(){Object.keys(t.elements).forEach(function(e){var n=t.elements[e],o=t.attributes[e]||{},a=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:r[e]).reduce(function(e,t){return e[t]="",e},{});V(n)&&Q(n)&&(Object.assign(n.style,a),Object.keys(o).forEach(function(e){n.removeAttribute(e)}))})}},requires:["computeStyles"]};const Re={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,r=e.options,n=e.name,o=r.offset,a=void 0===o?[0,0]:o,i=Le.reduce(function(e,r){return e[r]=function(e,t,r){var n=Se(e),o=[ve,de].indexOf(n)>=0?-1:1,a="function"==typeof r?r(Object.assign({},t,{placement:e})):r,i=a[0],s=a[1];return i=i||0,s=(s||0)*o,[ve,me].indexOf(n)>=0?{x:s,y:i}:{x:i,y:s}}(r,t.rects,a),e},{}),s=i[t.placement],l=s.x,c=s.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=c),t.modifiersData[n]=i}};var Ze={left:"right",right:"left",bottom:"top",top:"bottom"};function ze(e){return e.replace(/left|right|bottom|top/g,function(e){return Ze[e]})}var Ie={start:"end",end:"start"};function Fe(e){return e.replace(/start|end/g,function(e){return Ie[e]})}function We(e,t){var r=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(r&&U(r)){var n=t;do{if(n&&e.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}function He(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function Ve(e,t,r){return t===_e?He(function(e,t){var r=W(e),n=ee(e),o=r.visualViewport,a=n.clientWidth,i=n.clientHeight,s=0,l=0;if(o){a=o.width,i=o.height;var c=J();(c||!c&&"fixed"===t)&&(s=o.offsetLeft,l=o.offsetTop)}return{width:a,height:i,x:s+te(e),y:l}}(e,r)):H(t)?function(e,t){var r=Y(e,!1,"fixed"===t);return r.top=r.top+e.clientTop,r.left=r.left+e.clientLeft,r.bottom=r.top+e.clientHeight,r.right=r.left+e.clientWidth,r.width=e.clientWidth,r.height=e.clientHeight,r.x=r.left,r.y=r.top,r}(t,r):He(function(e){var t,r=ee(e),n=K(e),o=null==(t=e.ownerDocument)?void 0:t.body,a=q(r.scrollWidth,r.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),i=q(r.scrollHeight,r.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),s=-n.scrollLeft+te(e),l=-n.scrollTop;return"rtl"===re(o||r).direction&&(s+=q(r.clientWidth,o?o.clientWidth:0)-a),{width:a,height:i,x:s,y:l}}(ee(e)))}function Ue(e,t,r,n){var o="clippingParents"===t?function(e){var t=le(ie(e)),r=["absolute","fixed"].indexOf(re(e).position)>=0&&V(e)?pe(e):e;return H(r)?t.filter(function(e){return H(e)&&We(e,r)&&"body"!==Q(e)}):[]}(e):[].concat(t),a=[].concat(o,[r]),i=a[0],s=a.reduce(function(t,r){var o=Ve(e,r,n);return t.top=q(o.top,t.top),t.right=$(o.right,t.right),t.bottom=$(o.bottom,t.bottom),t.left=q(o.left,t.left),t},Ve(e,i,n));return s.width=s.right-s.left,s.height=s.bottom-s.top,s.x=s.left,s.y=s.top,s}function qe(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function $e(e,t){return t.reduce(function(t,r){return t[r]=e,t},{})}function Ge(e,t){void 0===t&&(t={});var r=t,n=r.placement,o=void 0===n?e.placement:n,a=r.strategy,i=void 0===a?e.strategy:a,s=r.boundary,l=void 0===s?"clippingParents":s,c=r.rootBoundary,u=void 0===c?_e:c,p=r.elementContext,d=void 0===p?xe:p,f=r.altBoundary,m=void 0!==f&&f,v=r.padding,h=void 0===v?0:v,y=qe("number"!=typeof h?h:$e(h,ye)),b=d===xe?"reference":xe,g=e.rects.popper,_=e.elements[m?b:d],x=Ue(H(_)?_:_.contextElement||ee(e.elements.popper),l,u,i),w=Y(e.elements.reference),L=Be({reference:w,element:g,strategy:"absolute",placement:o}),E=He(Object.assign({},g,L)),O=d===xe?E:w,j={top:x.top-O.top+y.top,bottom:O.bottom-x.bottom+y.bottom,left:x.left-O.left+y.left,right:O.right-x.right+y.right},A=e.modifiersData.offset;if(d===xe&&A){var P=A[o];Object.keys(j).forEach(function(e){var t=[me,fe].indexOf(e)>=0?1:-1,r=[de,fe].indexOf(e)>=0?"y":"x";j[e]+=P[r]*t})}return j}function Xe(e,t,r){return q(e,$(t,r))}const Je={name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,r=e.options,n=e.name,o=r.mainAxis,a=void 0===o||o,i=r.altAxis,s=void 0!==i&&i,l=r.boundary,c=r.rootBoundary,u=r.altBoundary,p=r.padding,d=r.tether,f=void 0===d||d,m=r.tetherOffset,v=void 0===m?0:m,h=Ge(t,{boundary:l,rootBoundary:c,padding:p,altBoundary:u}),y=Se(t.placement),b=Ce(t.placement),g=!b,_=Me(y),x="x"===_?"y":"x",w=t.modifiersData.popperOffsets,L=t.rects.reference,E=t.rects.popper,O="function"==typeof v?v(Object.assign({},t.rects,{placement:t.placement})):v,j="number"==typeof O?{mainAxis:O,altAxis:O}:Object.assign({mainAxis:0,altAxis:0},O),A=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,P={x:0,y:0};if(w){if(a){var k,S="y"===_?de:ve,C="y"===_?fe:me,M="y"===_?"height":"width",B=w[_],T=B+h[S],D=B-h[C],N=f?-E[M]/2:0,R=b===be?L[M]:E[M],Z=b===be?-E[M]:-L[M],z=t.elements.arrow,I=f&&z?ae(z):{width:0,height:0},F=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},W=F[S],H=F[C],V=Xe(0,L[M],I[M]),U=g?L[M]/2-N-V-W-j.mainAxis:R-V-W-j.mainAxis,G=g?-L[M]/2+N+V+H+j.mainAxis:Z+V+H+j.mainAxis,X=t.elements.arrow&&pe(t.elements.arrow),J=X?"y"===_?X.clientTop||0:X.clientLeft||0:0,Y=null!=(k=null==A?void 0:A[_])?k:0,K=B+G-Y,Q=Xe(f?$(T,B+U-Y-J):T,B,f?q(D,K):D);w[_]=Q,P[_]=Q-B}if(s){var ee,te="x"===_?de:ve,re="x"===_?fe:me,ne=w[x],oe="y"===x?"height":"width",ie=ne+h[te],se=ne-h[re],le=-1!==[de,ve].indexOf(y),ce=null!=(ee=null==A?void 0:A[x])?ee:0,ue=le?ie:ne-L[oe]-E[oe]-ce+j.altAxis,he=le?ne+L[oe]+E[oe]-ce-j.altAxis:se,ye=f&&le?function(e,t,r){var n=Xe(e,t,r);return n>r?r:n}(ue,ne,he):Xe(f?ue:ie,ne,f?he:se);w[x]=ye,P[x]=ye-ne}t.modifiersData[n]=P}},requiresIfExists:["offset"]};const Ye={name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,r=e.state,n=e.name,o=e.options,a=r.elements.arrow,i=r.modifiersData.popperOffsets,s=Se(r.placement),l=Me(s),c=[ve,me].indexOf(s)>=0?"height":"width";if(a&&i){var u=function(e,t){return qe("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:$e(e,ye))}(o.padding,r),p=ae(a),d="y"===l?de:ve,f="y"===l?fe:me,m=r.rects.reference[c]+r.rects.reference[l]-i[l]-r.rects.popper[c],v=i[l]-r.rects.reference[l],h=pe(a),y=h?"y"===l?h.clientHeight||0:h.clientWidth||0:0,b=m/2-v/2,g=u[d],_=y-p[c]-u[f],x=y/2-p[c]/2+b,w=Xe(g,x,_),L=l;r.modifiersData[n]=((t={})[L]=w,t.centerOffset=w-x,t)}},effect:function(e){var t=e.state,r=e.options.element,n=void 0===r?"[data-popper-arrow]":r;null!=n&&("string"!=typeof n||(n=t.elements.popper.querySelector(n)))&&We(t.elements.popper,n)&&(t.elements.arrow=n)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Ke(e,t,r){return void 0===r&&(r={x:0,y:0}),{top:e.top-t.height-r.y,right:e.right-t.width+r.x,bottom:e.bottom-t.height+r.y,left:e.left-t.width-r.x}}function Qe(e){return[de,me,fe,ve].some(function(t){return e[t]>=0})}var et=Pe({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(e){var t=e.state,r=e.instance,n=e.options,o=n.scroll,a=void 0===o||o,i=n.resize,s=void 0===i||i,l=W(t.elements.popper),c=[].concat(t.scrollParents.reference,t.scrollParents.popper);return a&&c.forEach(function(e){e.addEventListener("scroll",r.update,ke)}),s&&l.addEventListener("resize",r.update,ke),function(){a&&c.forEach(function(e){e.removeEventListener("scroll",r.update,ke)}),s&&l.removeEventListener("resize",r.update,ke)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(e){var t=e.state,r=e.name;t.modifiersData[r]=Be({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(e){var t=e.state,r=e.options,n=r.gpuAcceleration,o=void 0===n||n,a=r.adaptive,i=void 0===a||a,s=r.roundOffsets,l=void 0===s||s,c={placement:Se(t.placement),variation:Ce(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:o,isFixed:"fixed"===t.options.strategy};null!=t.modifiersData.popperOffsets&&(t.styles.popper=Object.assign({},t.styles.popper,De(Object.assign({},c,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:i,roundOffsets:l})))),null!=t.modifiersData.arrow&&(t.styles.arrow=Object.assign({},t.styles.arrow,De(Object.assign({},c,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})},data:{}},Ne,Re,{name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,r=e.options,n=e.name;if(!t.modifiersData[n]._skip){for(var o=r.mainAxis,a=void 0===o||o,i=r.altAxis,s=void 0===i||i,l=r.fallbackPlacements,c=r.padding,u=r.boundary,p=r.rootBoundary,d=r.altBoundary,f=r.flipVariations,m=void 0===f||f,v=r.allowedAutoPlacements,h=t.options.placement,y=Se(h),b=l||(y===h||!m?[ze(h)]:function(e){if(Se(e)===he)return[];var t=ze(e);return[Fe(e),t,Fe(t)]}(h)),g=[h].concat(b).reduce(function(e,r){return e.concat(Se(r)===he?function(e,t){void 0===t&&(t={});var r=t,n=r.placement,o=r.boundary,a=r.rootBoundary,i=r.padding,s=r.flipVariations,l=r.allowedAutoPlacements,c=void 0===l?Le:l,u=Ce(n),p=u?s?we:we.filter(function(e){return Ce(e)===u}):ye,d=p.filter(function(e){return c.indexOf(e)>=0});0===d.length&&(d=p);var f=d.reduce(function(t,r){return t[r]=Ge(e,{placement:r,boundary:o,rootBoundary:a,padding:i})[Se(r)],t},{});return Object.keys(f).sort(function(e,t){return f[e]-f[t]})}(t,{placement:r,boundary:u,rootBoundary:p,padding:c,flipVariations:m,allowedAutoPlacements:v}):r)},[]),_=t.rects.reference,x=t.rects.popper,w=new Map,L=!0,E=g[0],O=0;O=0,S=k?"width":"height",C=Ge(t,{placement:j,boundary:u,rootBoundary:p,altBoundary:d,padding:c}),M=k?P?me:ve:P?fe:de;_[S]>x[S]&&(M=ze(M));var B=ze(M),T=[];if(a&&T.push(C[A]<=0),s&&T.push(C[M]<=0,C[B]<=0),T.every(function(e){return e})){E=j,L=!1;break}w.set(j,T)}if(L)for(var D=function(e){var t=g.find(function(t){var r=w.get(t);if(r)return r.slice(0,e).every(function(e){return e})});if(t)return E=t,"break"},N=m?3:1;N>0;N--){if("break"===D(N))break}t.placement!==E&&(t.modifiersData[n]._skip=!0,t.placement=E,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}},Je,Ye,{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(e){var t=e.state,r=e.name,n=t.rects.reference,o=t.rects.popper,a=t.modifiersData.preventOverflow,i=Ge(t,{elementContext:"reference"}),s=Ge(t,{altBoundary:!0}),l=Ke(i,n),c=Ke(s,o,a),u=Qe(l),p=Qe(c);t.modifiersData[r]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:p},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":p})}}]}),tt="tippy-content",rt="tippy-backdrop",nt="tippy-arrow",ot="tippy-svg-arrow",at={passive:!0,capture:!0},it=function(){return document.body};function st(e,t,r){if(Array.isArray(e)){var n=e[t];return n??(Array.isArray(r)?r[t]:r)}return e}function lt(e,t){var r={}.toString.call(e);return 0===r.indexOf("[object")&&r.indexOf(t+"]")>-1}function ct(e,t){return"function"==typeof e?e.apply(void 0,t):e}function ut(e,t){return 0===t?e:function(n){clearTimeout(r),r=setTimeout(function(){e(n)},t)};var r}function pt(e){return[].concat(e)}function dt(e,t){-1===e.indexOf(t)&&e.push(t)}function ft(e){return e.split("-")[0]}function mt(e){return[].slice.call(e)}function vt(e){return Object.keys(e).reduce(function(t,r){return void 0!==e[r]&&(t[r]=e[r]),t},{})}function ht(){return document.createElement("div")}function yt(e){return["Element","Fragment"].some(function(t){return lt(e,t)})}function bt(e){return lt(e,"MouseEvent")}function gt(e){return!(!e||!e._tippy||e._tippy.reference!==e)}function _t(e){return yt(e)?[e]:function(e){return lt(e,"NodeList")}(e)?mt(e):Array.isArray(e)?e:mt(document.querySelectorAll(e))}function xt(e,t){e.forEach(function(e){e&&(e.style.transitionDuration=t+"ms")})}function wt(e,t){e.forEach(function(e){e&&e.setAttribute("data-state",t)})}function Lt(e){var t,r=pt(e)[0];return null!=r&&null!=(t=r.ownerDocument)&&t.body?r.ownerDocument:document}function Et(e,t,r){var n=t+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(t){e[n](t,r)})}function Ot(e,t){for(var r=t;r;){var n;if(e.contains(r))return!0;r=null==r.getRootNode||null==(n=r.getRootNode())?void 0:n.host}return!1}var jt={isTouch:!1},At=0;function Pt(){jt.isTouch||(jt.isTouch=!0,window.performance&&document.addEventListener("mousemove",kt))}function kt(){var e=performance.now();e-At<20&&(jt.isTouch=!1,document.removeEventListener("mousemove",kt)),At=e}function St(){var e=document.activeElement;if(gt(e)){var t=e._tippy;e.blur&&!t.state.isVisible&&e.blur()}}var Ct=!!("undefined"!=typeof window&&"undefined"!=typeof document)&&!!window.msCrypto;var Mt={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},Bt=Object.assign({appendTo:it,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},Mt,{allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999}),Tt=Object.keys(Bt);function Dt(e){var t=(e.plugins||[]).reduce(function(t,r){var n,o=r.name,a=r.defaultValue;o&&(t[o]=void 0!==e[o]?e[o]:null!=(n=Bt[o])?n:a);return t},{});return Object.assign({},e,t)}function Nt(e,t){var r=Object.assign({},t,{content:ct(t.content,[e])},t.ignoreAttributes?{}:function(e,t){return(t?Object.keys(Dt(Object.assign({},Bt,{plugins:t}))):Tt).reduce(function(t,r){var n=(e.getAttribute("data-tippy-"+r)||"").trim();if(!n)return t;if("content"===r)t[r]=n;else try{t[r]=JSON.parse(n)}catch(e){t[r]=n}return t},{})}(e,t.plugins));return r.aria=Object.assign({},Bt.aria,r.aria),r.aria={expanded:"auto"===r.aria.expanded?t.interactive:r.aria.expanded,content:"auto"===r.aria.content?t.interactive?null:"describedby":r.aria.content},r}function Rt(e,t){e.innerHTML=t}function Zt(e){var t=ht();return!0===e?t.className=nt:(t.className=ot,yt(e)?t.appendChild(e):Rt(t,e)),t}function zt(e,t){yt(t.content)?(Rt(e,""),e.appendChild(t.content)):"function"!=typeof t.content&&(t.allowHTML?Rt(e,t.content):e.textContent=t.content)}function It(e){var t=e.firstElementChild,r=mt(t.children);return{box:t,content:r.find(function(e){return e.classList.contains(tt)}),arrow:r.find(function(e){return e.classList.contains(nt)||e.classList.contains(ot)}),backdrop:r.find(function(e){return e.classList.contains(rt)})}}function Ft(e){var t=ht(),r=ht();r.className="tippy-box",r.setAttribute("data-state","hidden"),r.setAttribute("tabindex","-1");var n=ht();function o(r,n){var o=It(t),a=o.box,i=o.content,s=o.arrow;n.theme?a.setAttribute("data-theme",n.theme):a.removeAttribute("data-theme"),"string"==typeof n.animation?a.setAttribute("data-animation",n.animation):a.removeAttribute("data-animation"),n.inertia?a.setAttribute("data-inertia",""):a.removeAttribute("data-inertia"),a.style.maxWidth="number"==typeof n.maxWidth?n.maxWidth+"px":n.maxWidth,n.role?a.setAttribute("role",n.role):a.removeAttribute("role"),r.content===n.content&&r.allowHTML===n.allowHTML||zt(i,e.props),n.arrow?s?r.arrow!==n.arrow&&(a.removeChild(s),a.appendChild(Zt(n.arrow))):a.appendChild(Zt(n.arrow)):s&&a.removeChild(s)}return n.className=tt,n.setAttribute("data-state","hidden"),zt(n,e.props),t.appendChild(r),r.appendChild(n),o(e.props,e.props),{popper:t,onUpdate:o}}Ft.$$tippy=!0;var Wt=1,Ht=[],Vt=[];function Ut(e,t){var r,n,o,a,i,s,l,c,u=Nt(e,Object.assign({},Bt,Dt(vt(t)))),p=!1,d=!1,f=!1,m=!1,v=[],h=ut($,u.interactiveDebounce),y=Wt++,b=(c=u.plugins).filter(function(e,t){return c.indexOf(e)===t}),g={id:y,reference:e,popper:ht(),popperInstance:null,props:u,state:{isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},plugins:b,clearDelayTimeouts:function(){clearTimeout(r),clearTimeout(n),cancelAnimationFrame(o)},setProps:function(t){0;if(g.state.isDestroyed)return;B("onBeforeUpdate",[g,t]),U();var r=g.props,n=Nt(e,Object.assign({},r,vt(t),{ignoreAttributes:!0}));g.props=n,V(),r.interactiveDebounce!==n.interactiveDebounce&&(N(),h=ut($,n.interactiveDebounce));r.triggerTarget&&!n.triggerTarget?pt(r.triggerTarget).forEach(function(e){e.removeAttribute("aria-expanded")}):n.triggerTarget&&e.removeAttribute("aria-expanded");D(),M(),w&&w(r,n);g.popperInstance&&(Y(),Q().forEach(function(e){requestAnimationFrame(e._tippy.popperInstance.forceUpdate)}));B("onAfterUpdate",[g,t])},setContent:function(e){g.setProps({content:e})},show:function(){0;var e=g.state.isVisible,t=g.state.isDestroyed,r=!g.state.isEnabled,n=jt.isTouch&&!g.props.touch,o=st(g.props.duration,0,Bt.duration);if(e||t||r||n)return;if(P().hasAttribute("disabled"))return;if(B("onShow",[g],!1),!1===g.props.onShow(g))return;g.state.isVisible=!0,A()&&(x.style.visibility="visible");M(),I(),g.state.isMounted||(x.style.transition="none");if(A()){var a=S();xt([a.box,a.content],0)}s=function(){var e;if(g.state.isVisible&&!m){if(m=!0,x.offsetHeight,x.style.transition=g.props.moveTransition,A()&&g.props.animation){var t=S(),r=t.box,n=t.content;xt([r,n],o),wt([r,n],"visible")}T(),D(),dt(Vt,g),null==(e=g.popperInstance)||e.forceUpdate(),B("onMount",[g]),g.props.animation&&A()&&function(e,t){W(e,t)}(o,function(){g.state.isShown=!0,B("onShown",[g])})}},function(){var e,t=g.props.appendTo,r=P();e=g.props.interactive&&t===it||"parent"===t?r.parentNode:ct(t,[r]);e.contains(x)||e.appendChild(x);g.state.isMounted=!0,Y(),!1}()},hide:function(){0;var e=!g.state.isVisible,t=g.state.isDestroyed,r=!g.state.isEnabled,n=st(g.props.duration,1,Bt.duration);if(e||t||r)return;if(B("onHide",[g],!1),!1===g.props.onHide(g))return;g.state.isVisible=!1,g.state.isShown=!1,m=!1,p=!1,A()&&(x.style.visibility="hidden");if(N(),F(),M(!0),A()){var o=S(),a=o.box,i=o.content;g.props.animation&&(xt([a,i],n),wt([a,i],"hidden"))}T(),D(),g.props.animation?A()&&function(e,t){W(e,function(){!g.state.isVisible&&x.parentNode&&x.parentNode.contains(x)&&t()})}(n,g.unmount):g.unmount()},hideWithInteractivity:function(e){0;k().addEventListener("mousemove",h),dt(Ht,h),h(e)},enable:function(){g.state.isEnabled=!0},disable:function(){g.hide(),g.state.isEnabled=!1},unmount:function(){0;g.state.isVisible&&g.hide();if(!g.state.isMounted)return;K(),Q().forEach(function(e){e._tippy.unmount()}),x.parentNode&&x.parentNode.removeChild(x);Vt=Vt.filter(function(e){return e!==g}),g.state.isMounted=!1,B("onHidden",[g])},destroy:function(){0;if(g.state.isDestroyed)return;g.clearDelayTimeouts(),g.unmount(),U(),delete e._tippy,g.state.isDestroyed=!0,B("onDestroy",[g])}};if(!u.render)return g;var _=u.render(g),x=_.popper,w=_.onUpdate;x.setAttribute("data-tippy-root",""),x.id="tippy-"+g.id,g.popper=x,e._tippy=g,x._tippy=g;var L=b.map(function(e){return e.fn(g)}),E=e.hasAttribute("aria-expanded");return V(),D(),M(),B("onCreate",[g]),u.showOnCreate&&ee(),x.addEventListener("mouseenter",function(){g.props.interactive&&g.state.isVisible&&g.clearDelayTimeouts()}),x.addEventListener("mouseleave",function(){g.props.interactive&&g.props.trigger.indexOf("mouseenter")>=0&&k().addEventListener("mousemove",h)}),g;function O(){var e=g.props.touch;return Array.isArray(e)?e:[e,0]}function j(){return"hold"===O()[0]}function A(){var e;return!(null==(e=g.props.render)||!e.$$tippy)}function P(){return l||e}function k(){var e=P().parentNode;return e?Lt(e):document}function S(){return It(x)}function C(e){return g.state.isMounted&&!g.state.isVisible||jt.isTouch||a&&"focus"===a.type?0:st(g.props.delay,e?0:1,Bt.delay)}function M(e){void 0===e&&(e=!1),x.style.pointerEvents=g.props.interactive&&!e?"":"none",x.style.zIndex=""+g.props.zIndex}function B(e,t,r){var n;(void 0===r&&(r=!0),L.forEach(function(r){r[e]&&r[e].apply(r,t)}),r)&&(n=g.props)[e].apply(n,t)}function T(){var t=g.props.aria;if(t.content){var r="aria-"+t.content,n=x.id;pt(g.props.triggerTarget||e).forEach(function(e){var t=e.getAttribute(r);if(g.state.isVisible)e.setAttribute(r,t?t+" "+n:n);else{var o=t&&t.replace(n,"").trim();o?e.setAttribute(r,o):e.removeAttribute(r)}})}}function D(){!E&&g.props.aria.expanded&&pt(g.props.triggerTarget||e).forEach(function(e){g.props.interactive?e.setAttribute("aria-expanded",g.state.isVisible&&e===P()?"true":"false"):e.removeAttribute("aria-expanded")})}function N(){k().removeEventListener("mousemove",h),Ht=Ht.filter(function(e){return e!==h})}function R(t){if(!jt.isTouch||!f&&"mousedown"!==t.type){var r=t.composedPath&&t.composedPath()[0]||t.target;if(!g.props.interactive||!Ot(x,r)){if(pt(g.props.triggerTarget||e).some(function(e){return Ot(e,r)})){if(jt.isTouch)return;if(g.state.isVisible&&g.props.trigger.indexOf("click")>=0)return}else B("onClickOutside",[g,t]);!0===g.props.hideOnClick&&(g.clearDelayTimeouts(),g.hide(),d=!0,setTimeout(function(){d=!1}),g.state.isMounted||F())}}}function Z(){f=!0}function z(){f=!1}function I(){var e=k();e.addEventListener("mousedown",R,!0),e.addEventListener("touchend",R,at),e.addEventListener("touchstart",z,at),e.addEventListener("touchmove",Z,at)}function F(){var e=k();e.removeEventListener("mousedown",R,!0),e.removeEventListener("touchend",R,at),e.removeEventListener("touchstart",z,at),e.removeEventListener("touchmove",Z,at)}function W(e,t){var r=S().box;function n(e){e.target===r&&(Et(r,"remove",n),t())}if(0===e)return t();Et(r,"remove",i),Et(r,"add",n),i=n}function H(t,r,n){void 0===n&&(n=!1),pt(g.props.triggerTarget||e).forEach(function(e){e.addEventListener(t,r,n),v.push({node:e,eventType:t,handler:r,options:n})})}function V(){var e;j()&&(H("touchstart",q,{passive:!0}),H("touchend",G,{passive:!0})),(e=g.props.trigger,e.split(/\s+/).filter(Boolean)).forEach(function(e){if("manual"!==e)switch(H(e,q),e){case"mouseenter":H("mouseleave",G);break;case"focus":H(Ct?"focusout":"blur",X);break;case"focusin":H("focusout",X)}})}function U(){v.forEach(function(e){var t=e.node,r=e.eventType,n=e.handler,o=e.options;t.removeEventListener(r,n,o)}),v=[]}function q(e){var t,r=!1;if(g.state.isEnabled&&!J(e)&&!d){var n="focus"===(null==(t=a)?void 0:t.type);a=e,l=e.currentTarget,D(),!g.state.isVisible&&bt(e)&&Ht.forEach(function(t){return t(e)}),"click"===e.type&&(g.props.trigger.indexOf("mouseenter")<0||p)&&!1!==g.props.hideOnClick&&g.state.isVisible?r=!0:ee(e),"click"===e.type&&(p=!r),r&&!n&&te(e)}}function $(e){var t=e.target,r=P().contains(t)||x.contains(t);if("mousemove"!==e.type||!r){var n=Q().concat(x).map(function(e){var t,r=null==(t=e._tippy.popperInstance)?void 0:t.state;return r?{popperRect:e.getBoundingClientRect(),popperState:r,props:u}:null}).filter(Boolean);(function(e,t){var r=t.clientX,n=t.clientY;return e.every(function(e){var t=e.popperRect,o=e.popperState,a=e.props.interactiveBorder,i=ft(o.placement),s=o.modifiersData.offset;if(!s)return!0;var l="bottom"===i?s.top.y:0,c="top"===i?s.bottom.y:0,u="right"===i?s.left.x:0,p="left"===i?s.right.x:0,d=t.top-n+l>a,f=n-t.bottom-c>a,m=t.left-r+u>a,v=r-t.right-p>a;return d||f||m||v})})(n,e)&&(N(),te(e))}}function G(e){J(e)||g.props.trigger.indexOf("click")>=0&&p||(g.props.interactive?g.hideWithInteractivity(e):te(e))}function X(e){g.props.trigger.indexOf("focusin")<0&&e.target!==P()||g.props.interactive&&e.relatedTarget&&x.contains(e.relatedTarget)||te(e)}function J(e){return!!jt.isTouch&&j()!==e.type.indexOf("touch")>=0}function Y(){K();var t=g.props,r=t.popperOptions,n=t.placement,o=t.offset,a=t.getReferenceClientRect,i=t.moveTransition,l=A()?It(x).arrow:null,c=a?{getBoundingClientRect:a,contextElement:a.contextElement||P()}:e,u={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(e){var t=e.state;if(A()){var r=S().box;["placement","reference-hidden","escaped"].forEach(function(e){"placement"===e?r.setAttribute("data-placement",t.placement):t.attributes.popper["data-popper-"+e]?r.setAttribute("data-"+e,""):r.removeAttribute("data-"+e)}),t.attributes.popper={}}}},p=[{name:"offset",options:{offset:o}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!i}},u];A()&&l&&p.push({name:"arrow",options:{element:l,padding:3}}),p.push.apply(p,(null==r?void 0:r.modifiers)||[]),g.popperInstance=et(c,x,Object.assign({},r,{placement:n,onFirstUpdate:s,modifiers:p}))}function K(){g.popperInstance&&(g.popperInstance.destroy(),g.popperInstance=null)}function Q(){return mt(x.querySelectorAll("[data-tippy-root]"))}function ee(e){g.clearDelayTimeouts(),e&&B("onTrigger",[g,e]),I();var t=C(!0),n=O(),o=n[0],a=n[1];jt.isTouch&&"hold"===o&&a&&(t=a),t?r=setTimeout(function(){g.show()},t):g.show()}function te(e){if(g.clearDelayTimeouts(),B("onUntrigger",[g,e]),g.state.isVisible){if(!(g.props.trigger.indexOf("mouseenter")>=0&&g.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(e.type)>=0&&p)){var t=C(!1);t?n=setTimeout(function(){g.state.isVisible&&g.hide()},t):o=requestAnimationFrame(function(){g.hide()})}}else F()}}function qt(e,t){void 0===t&&(t={});var r=Bt.plugins.concat(t.plugins||[]);document.addEventListener("touchstart",Pt,at),window.addEventListener("blur",St);var n=Object.assign({},t,{plugins:r}),o=_t(e).reduce(function(e,t){var r=t&&Ut(t,n);return r&&e.push(r),e},[]);return yt(e)?o[0]:o}qt.defaultProps=Bt,qt.setDefaultProps=function(e){Object.keys(e).forEach(function(t){Bt[t]=e[t]})},qt.currentInput=jt;Object.assign({},Ne,{effect:function(e){var t=e.state,r={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(t.elements.popper.style,r.popper),t.styles=r,t.elements.arrow&&Object.assign(t.elements.arrow.style,r.arrow)}});qt.setDefaultProps({render:Ft});const $t=qt;var Gt=r(6087);const Xt=({children:e,value:t})=>Gt.createElement("div",{className:"colorpalette-color-label"},Gt.createElement("span",null,e),Gt.createElement("span",{className:"component-color-indicator","aria-label":`Color: ${t}`,style:{background:t}})),Jt=new(o())("_"),Yt=({attributes:t,setAttributes:r,colors:n})=>{const o=p()(t),a=Jt.object(o),[i,u]=(0,l.useState)(a.customSettings);t.transformation_crop||(t.transformation_crop="pad",t.transformation_background="rgb:FFFFFF"),"fill"===t.transformation_crop&&delete t.transformation_background;const d=(e,t)=>{const n={[t]:F(e)};r(n)},f=(e=>{const[t,r]=(0,l.useState)(null),n=(0,l.useCallback)(e=>r(e),[]);return(0,l.useEffect)(()=>{if(!t)return;const r=$t(t,{content:e});return()=>{r?.destroy()}},[t,e]),n})((0,e.__)("How to resize or crop images to fit the gallery. Pad adds padding around the image using the specified padding style. Fill crops the image from the center so it fills as much of the available space as possible.","cloudinary"));return Gt.createElement(Gt.Fragment,null,Gt.createElement(s.PanelBody,{title:(0,e.__)("Layout","cloudinary")},y.map(e=>Gt.createElement(R,{key:`${e.value.type}-${e.value.columns}-layout`,value:e.value,onChange:e=>{r({displayProps_mode:e.type,displayProps_columns:e.columns||1})},icon:e.icon,current:{type:t.displayProps_mode,columns:t.displayProps_columns||1}},e.label))),Gt.createElement(s.PanelBody,{title:(0,e.__)("Color Palette","cloudinary"),initialOpen:!1},Gt.createElement(Xt,{value:t.themeProps_primary},(0,e.__)("Primary","cloudinary")),Gt.createElement(c.ColorPalette,{value:t.themeProps_primary,colors:n,disableCustomColors:!1,onChange:e=>d(e,"themeProps_primary")}),Gt.createElement(Xt,{value:t.themeProps_onPrimary},(0,e.__)("On Primary","cloudinary")),Gt.createElement(c.ColorPalette,{value:t.themeProps_onPrimary,colors:n,disableCustomColors:!1,onChange:e=>d(e,"themeProps_onPrimary")}),Gt.createElement(Xt,{value:t.themeProps_active},(0,e.__)("Active","cloudinary")),Gt.createElement(c.ColorPalette,{value:t.themeProps_active,colors:n,disableCustomColors:!1,onChange:e=>d(e,"themeProps_active")})),"classic"===t.displayProps_mode&&Gt.createElement(s.PanelBody,{title:(0,e.__)("Fade Transition","cloudinary"),initialOpen:!1},Gt.createElement(s.SelectControl,{value:t.transition,options:_,onChange:e=>r({transition:e}),__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0})),Gt.createElement(s.PanelBody,{title:(0,e.__)("Main Viewer Parameters","cloudinary"),initialOpen:!1},Gt.createElement(s.SelectControl,{label:(0,e.__)("Aspect Ratio","cloudinary"),value:t.aspectRatio,options:g,onChange:e=>r({aspectRatio:e}),__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0}),Gt.createElement("p",null,Gt.createElement("div",{className:"cld-ui-title"},(0,e.__)("Resize/Crop Mode","cloudinary"),Gt.createElement("span",{className:"dashicons dashicons-info cld-tooltip",ref:f})),Gt.createElement(s.ButtonGroup,null,M.map(e=>Gt.createElement(s.Button,{key:e.value+"-look-and-feel",variant:"secondary",isSecondary:!0,isPressed:e.value===t.transformation_crop,onClick:()=>r({transformation_crop:e.value,transformation_background:null})},e.label)))),"pad"===t.transformation_crop&&Gt.createElement(s.SelectControl,{label:(0,e.__)("Pad style","cloudinary"),value:t.transformation_background,options:B,onChange:e=>{r({transformation_background:e})},__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0}),Gt.createElement("p",null,(0,e.__)("Navigation","cloudinary")),Gt.createElement("p",null,Gt.createElement(s.ButtonGroup,null,x.map(e=>Gt.createElement(s.Button,{key:e.value+"-navigation",variant:"secondary",isSecondary:!0,isPressed:e.value===t.navigation,onClick:()=>r({navigation:e.value})},e.label)))),Gt.createElement("div",{style:{marginTop:"30px"}},Gt.createElement(s.ToggleControl,{label:(0,e.__)("Show Zoom","cloudinary"),checked:t.zoom,onChange:()=>r({zoom:!t.zoom}),__nextHasNoMarginBottom:!0}),t.zoom&&Gt.createElement(Gt.Fragment,null,Gt.createElement("p",null,(0,e.__)("Zoom Type","cloudinary")),Gt.createElement("p",null,Gt.createElement(s.ButtonGroup,null,w.map(e=>Gt.createElement(s.Button,{key:e.value+"-zoom-type",variant:"secondary",isSecondary:!0,isPressed:e.value===t.zoomProps_type,onClick:()=>r({zoomProps_type:e.value})},e.label)))),"flyout"===t.zoomProps_type&&Gt.createElement(s.SelectControl,{label:(0,e.__)("Zoom Viewer Position","cloudinary"),value:t.zoomProps_viewerPosition,options:L,onChange:e=>r({zoomProps_viewerPosition:e}),__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0}),"popup"!==t.zoomProps_type&&Gt.createElement(Gt.Fragment,null,Gt.createElement("p",null,(0,e.__)("Zoom Trigger","cloudinary")),Gt.createElement("p",null,Gt.createElement(s.ButtonGroup,null,E.map(e=>Gt.createElement(s.Button,{key:e.value+"-zoom-trigger",variant:"secondary",isSecondary:!0,isPressed:e.value===t.zoomProps_trigger,onClick:()=>r({zoomProps_trigger:e.value})},e.label)))))))),Gt.createElement(s.PanelBody,{title:(0,e.__)("Carousel Parameters","cloudinary"),initialOpen:!1},Gt.createElement("p",null,(0,e.__)("Carousel Location","cloudinary")),Gt.createElement("p",null,Gt.createElement(s.ButtonGroup,null,O.map(e=>Gt.createElement(s.Button,{key:e.value+"-carousel-location",variant:"secondary",isSecondary:!0,isPressed:e.value===t.carouselLocation,onClick:()=>r({carouselLocation:e.value})},e.label)))),Gt.createElement(s.RangeControl,{label:(0,e.__)("Carousel Offset","cloudinary"),value:t.carouselOffset,onChange:e=>r({carouselOffset:e}),min:0,max:100,__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0}),Gt.createElement("p",null,(0,e.__)("Carousel Style","cloudinary")),Gt.createElement("p",null,Gt.createElement(s.ButtonGroup,null,j.map(e=>Gt.createElement(s.Button,{key:e.value+"-carousel-style",variant:"secondary",isSecondary:!0,isPressed:e.value===t.carouselStyle,onClick:()=>r({carouselStyle:e.value})},e.label)))),"thumbnails"===t.carouselStyle&&Gt.createElement(Gt.Fragment,null,Gt.createElement(s.RangeControl,{label:(0,e.__)("Width","cloudinary"),value:t.thumbnailProps_width,onChange:e=>r({thumbnailProps_width:e}),min:5,max:300,__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0}),Gt.createElement(s.RangeControl,{label:(0,e.__)("Height","cloudinary"),value:t.thumbnailProps_height,onChange:e=>r({thumbnailProps_height:e}),min:5,max:300,__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0}),Gt.createElement("p",null,(0,e.__)("Navigation Button Shape","cloudinary")),A.map(e=>Gt.createElement(R,{key:e.value+"-navigation-button-shape",value:e.value,onChange:e=>r({thumbnailProps_navigationShape:e}),icon:e.icon,current:t.thumbnailProps_navigationShape},e.label)),Gt.createElement("p",null,(0,e.__)("Selected Style","cloudinary")),Gt.createElement("p",null,Gt.createElement(s.ButtonGroup,null,k.map(e=>Gt.createElement(s.Button,{key:e.value+"-selected-style",variant:"secondary",isSecondary:!0,isPressed:e.value===t.thumbnailProps_selectedStyle,onClick:()=>r({thumbnailProps_selectedStyle:e.value})},e.label)))),Gt.createElement(s.SelectControl,{label:(0,e.__)("Selected Border Position","cloudinary"),value:t.thumbnailProps_selectedBorderPosition,options:S,onChange:e=>r({thumbnailProps_selectedBorderPosition:e}),__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0}),Gt.createElement(s.RangeControl,{label:(0,e.__)("Selected Border Width","cloudinary"),value:t.thumbnailProps_selectedBorderWidth,onChange:e=>r({thumbnailProps_selectedBorderWidth:e}),min:0,max:10,__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0}),Gt.createElement("p",null,(0,e.__)("Media Shape Icon","cloudinary")),C.map(e=>Gt.createElement(R,{key:e.value+"-media",value:e.value,onChange:e=>r({thumbnailProps_mediaSymbolShape:e}),icon:e.icon,current:t.thumbnailProps_mediaSymbolShape},e.label))),"indicators"===t.carouselStyle&&Gt.createElement(Gt.Fragment,null,Gt.createElement("p",null,(0,e.__)("Indicators Shape","cloudinary")),P.map(e=>Gt.createElement(R,{key:e.value+"-indicator",value:e.value,onChange:e=>r({indicatorProps_shape:e}),icon:e.icon,current:t.indicatorProps_shape},e.label)))),Gt.createElement(s.PanelBody,{title:(0,e.__)("Additional Settings","cloudinary"),initialOpen:!1},Gt.createElement(s.TextareaControl,{label:(0,e.__)("Custom Settings","cloudinary"),help:(0,e.__)("Provide a JSON string of the settings you want to add and/or override.","cloudinary"),value:i,onChange:e=>{let t={};u(e);try{t=JSON.parse(e)}catch(e){}if("object"==typeof t){const e={...a};e.customSettings=t,r({...a,...e})}},__nextHasNoMarginBottom:!0})))};var Kt=r(6087);const Qt=new(o())("_"),er=(0,e.__)("Drag images, upload new ones or select files from your library.","cloudinary"),tr=(e,t)=>({...e,container:"."+t,zoom:!1}),rr=({setAttributes:t,attributes:r,isSelected:n})=>{const[a,u]=(0,l.useState)(null),[d,f]=(0,l.useState)(!1),m=(0,l.useMemo)(()=>{if(0!==r.selectedImages.length)return r;const e={},{container:t,...n}=Qt.dot(CLD_GALLERY_CONFIG);return Object.keys(n).forEach(t=>{r[t]||(e[t]=n[t])}),{...r,...e}},[r]),v=(0,l.useMemo)(()=>r.selectedImages.length?r.selectedImages.map(({attachmentId:e})=>({id:e})):[],[r]);(0,l.useEffect)(()=>{if(a&&((({status:e,message:t,options:r={}})=>{(0,Z.dispatch)("core/notices").createNotice(e,t,{isDismissible:!0,...r})})({status:"error",message:a}),u(null)),r.selectedImages.length){let e;const{customSettings:t,...n}=(e=>{const t=new(o())("_"),r=p()(e),{selectedImages:n,...a}=t.object(r,{});return a.mediaAssets=n,"classic"!==a?.displayProps?.mode?delete a.transition:delete a.displayProps.columns,"pad"!==a?.transformation_crop&&delete a.transformation_background,"pad"!==a?.transformation?.crop&&delete a.transformation.background,a?.themeProps?.primary&&(a.themeProps.primary=F(a?.themeProps?.primary)),a?.themeProps?.onPrimary&&(a.themeProps.onPrimary=F(a?.themeProps?.onPrimary)),a?.themeProps?.active&&(a.themeProps.active=F(a?.themeProps?.active)),a})(r);try{e=cloudinary.galleryWidget(tr({...n,...t},r.container))}catch{e=cloudinary.galleryWidget(tr(n,r.container))}return e.render(),f(!1),()=>e.destroy()}},[a,r,t]);const h=!!r.selectedImages.length;(0,l.useEffect)(()=>{r.container||t({container:`cld-gallery-${I(15)}`})},[r.container,t]),(0,l.useEffect)(()=>{t(m)},[m,t]);const y=(0,c.useBlockProps)();return Kt.createElement("div",y,Kt.createElement(Kt.Fragment,null,Kt.createElement("div",{className:r.container}),Kt.createElement("div",{className:"wp-block-cloudinary-gallery"},Kt.createElement(c.MediaPlaceholder,{labels:{title:!h&&(0,e.__)("Cloudinary Gallery","cloudinary"),instructions:!h&&er},icon:"format-gallery",disableMediaButtons:h&&!n,allowedTypes:b,addToGallery:h,isAppender:h,onSelect:r=>(async r=>{f(!0);try{const e=await i()({path:CLD_REST_ENDPOINT+"/image_data",method:"POST",data:{images:r}});t({selectedImages:e})}catch{f(!1),u((0,e.__)("Could not load selected images. Please try again.","cloudinary"))}})(r),value:v,multiple:!0},d&&Kt.createElement("div",{className:"loading-spinner-container"},Kt.createElement(s.Spinner,null))))),Kt.createElement(c.InspectorControls,null,Kt.createElement(Yt,{attributes:r,setAttributes:t})))};var nr=r(6087);const or=({attributes:e})=>nr.createElement("div",{className:e.container}),ar=JSON.parse('{"aspectRatio":{"type":"string"},"navigation":{"type":"string"},"zoom":{"type":"boolean"},"carouselLocation":{"type":"string"},"carouselOffset":{"type":"number"},"carouselStyle":{"type":"string"},"displayProps_mode":{"type":"string"},"displayProps_columns":{"type":"number"},"indicatorProps_shape":{"type":"string"},"themeProps_primary":{"type":"string"},"themeProps_onPrimary":{"type":"string"},"themeProps_active":{"type":"string"},"zoomProps_type":{"type":"string"},"zoomProps_viewerPosition":{"type":"string"},"zoomProps_trigger":{"type":"string"},"thumbnailProps_width":{"type":"number"},"thumbnailProps_height":{"type":"number"},"thumbnailProps_navigationShape":{"type":"string"},"thumbnailProps_selectedStyle":{"type":"string"},"thumbnailProps_selectedBorderPosition":{"type":"string"},"thumbnailProps_selectedBorderWidth":{"type":"number"},"thumbnailProps_mediaSymbolShape":{"type":"string"},"cloudName":{"type":"string"},"container":{"type":"string"},"selectedImages":{"type":"array","default":[]},"transformation_crop":{"type":"string","default":"pad"},"transformation_background":{"type":"string"},"customSettings":{"type":"string"}}');(0,t.registerBlockType)("cloudinary/gallery",{apiVersion:2,title:(0,e.__)("Cloudinary Gallery","cloudinary"),description:(0,e.__)("Add a gallery powered by the Cloudinary Gallery Widget to your post.","cloudinary"),category:"widgets",icon:"format-gallery",attributes:ar,edit:rr,save:or})})()})(); //# sourceMappingURL=gallery-block.js.map \ No newline at end of file diff --git a/php/media/class-gallery.php b/php/media/class-gallery.php index ba9df9d22..caf75d2a3 100644 --- a/php/media/class-gallery.php +++ b/php/media/class-gallery.php @@ -240,10 +240,12 @@ public function enqueue_admin_scripts() { /** * Retrieve asset dependencies. * + * @param string $script The script slug to get the generated asset file for. + * * @return array */ - private function get_asset() { - $asset = require $this->plugin->dir_path . 'js/gallery.asset.php'; // phpcs:ignore WordPressVIPMinimum.Files.IncludingFile.UsingVariable + private function get_asset( $script = 'gallery' ) { + $asset = require $this->plugin->dir_path . 'js/' . $script . '.asset.php'; // phpcs:ignore WordPressVIPMinimum.Files.IncludingFile.UsingVariable $asset['dependencies'] = array_filter( $asset['dependencies'], @@ -261,24 +263,40 @@ static function ( $dependency ) { public function block_editor_scripts_styles() { $this->enqueue_gallery_library(); - wp_enqueue_style( - 'cloudinary-gallery-block-css', - $this->plugin->dir_url . 'css/gallery-block.css', - array(), - $this->plugin->version - ); + $asset = $this->get_asset( 'gallery-block' ); wp_enqueue_script( 'cloudinary-gallery-block-js', $this->plugin->dir_url . 'js/gallery-block.js', - array( 'wp-blocks', 'wp-editor', 'wp-element', self::GALLERY_LIBRARY_HANDLE ), - $this->plugin->version, + array_merge( $asset['dependencies'], array( self::GALLERY_LIBRARY_HANDLE ) ), + $asset['version'], true ); wp_add_inline_script( 'cloudinary-gallery-block-js', 'var CLD_REST_ENDPOINT = "/' . REST_API::BASE . '";', 'before' ); } + /** + * Enqueue the gallery block editor styles. + * + * Registered on `enqueue_block_assets` so the styles are injected into the + * iframed block editor correctly. As of WordPress 7.1 the post editor is + * always iframed, and styles added via `enqueue_block_editor_assets` are + * flagged as being added to the iframe incorrectly. + */ + public function block_editor_styles() { + if ( ! is_admin() ) { + return; + } + + wp_enqueue_style( + 'cloudinary-gallery-block-css', + $this->plugin->dir_url . 'css/gallery-block.css', + array(), + $this->plugin->version + ); + } + /** * Fetches image public id and transformations. * @@ -688,6 +706,7 @@ public function inject_glb_metadata( $metadata, $attachment_id ) { public function setup_hooks() { add_filter( 'cloudinary_api_rest_endpoints', array( $this, 'rest_endpoints' ) ); add_action( 'enqueue_block_editor_assets', array( $this, 'block_editor_scripts_styles' ) ); + add_action( 'enqueue_block_assets', array( $this, 'block_editor_styles' ) ); add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_gallery_library' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) ); add_filter( 'render_block', array( $this, 'prepare_block_render' ), 10, 2 ); diff --git a/src/js/gallery-block/edit.js b/src/js/gallery-block/edit.js index bb095119a..fef9346ae 100644 --- a/src/js/gallery-block/edit.js +++ b/src/js/gallery-block/edit.js @@ -13,7 +13,11 @@ import apiFetch from '@wordpress/api-fetch'; import { Spinner } from '@wordpress/components'; import '@wordpress/components/build-style/style.css'; import { useEffect, useMemo, useState } from '@wordpress/element'; -import { InspectorControls, MediaPlaceholder } from '@wordpress/block-editor'; +import { + InspectorControls, + MediaPlaceholder, + useBlockProps, +} from '@wordpress/block-editor'; /** * Internal dependencies @@ -36,7 +40,13 @@ const galleryWidgetConfig = ( config, container ) => ( { zoom: false, } ); -const Edit = ( { setAttributes, attributes, className, isSelected } ) => { +// Prefix for the generated gallery container class. A literal prefix keeps +// the value a valid, unique CSS selector. Prior to the Block API v2 upgrade +// the block's `className` prop was used, but that prop is no longer passed to +// `Edit` in API v2, which produced containers named "undefined". +const CONTAINER_PREFIX = 'cld-gallery-'; + +const Edit = ( { setAttributes, attributes, isSelected } ) => { const [ errorMessage, setErrorMessage ] = useState( null ); const [ loading, setLoading ] = useState( false ); @@ -123,22 +133,32 @@ const Edit = ( { setAttributes, attributes, className, isSelected } ) => { return () => gallery.destroy(); } - }, [ errorMessage, attributes, setAttributes, className ] ); + }, [ errorMessage, attributes, setAttributes ] ); const hasImages = !! attributes.selectedImages.length; - if ( ! attributes.container ) { - setAttributes( { - container: `${ className }${ generateId( 15 ) }`, - } ); - } + // Persist the generated container id and prepared defaults after render. + // Calling setAttributes during render triggers a React "Cannot update a + // component while rendering a different component" warning under React 19 + // (WordPress 7.1). + useEffect( () => { + if ( ! attributes.container ) { + setAttributes( { + container: `${ CONTAINER_PREFIX }${ generateId( 15 ) }`, + } ); + } + }, [ attributes.container, setAttributes ] ); + + useEffect( () => { + setAttributes( preparedAttributes ); + }, [ preparedAttributes, setAttributes ] ); - setAttributes( preparedAttributes ); + const blockProps = useBlockProps(); return ( - <> +
<> -
+
{ setAttributes={ setAttributes } /> - +
); }; diff --git a/src/js/gallery-block/index.js b/src/js/gallery-block/index.js index d3ff0f894..3f6eac01e 100644 --- a/src/js/gallery-block/index.js +++ b/src/js/gallery-block/index.js @@ -12,6 +12,7 @@ import save from './save'; import attributes from './attributes.json'; registerBlockType( 'cloudinary/gallery', { + apiVersion: 2, title: __( 'Cloudinary Gallery', 'cloudinary' ), description: __( 'Add a gallery powered by the Cloudinary Gallery Widget to your post.', From 02432c8a90b50fecfe1f6c1dc124f6835df2a180 Mon Sep 17 00:00:00 2001 From: Utkarsh Patel Date: Mon, 27 Jul 2026 13:41:41 +0530 Subject: [PATCH 2/4] Fix core image/video block editor integration for WordPress 7.1 The Cloudinary inspector controls added to core/image and core/video blocks had two WordPress 7.1 issues: - setAttributes was called during render when the attachment had transformations, which triggers the React 19 "Cannot update a component while rendering a different component" warning. Moved into an effect. - The controls read InspectorControls from the deprecated wp.editor alias. Switched to wp.blockEditor and declared the script dependencies explicitly, since the block editor globals were previously relied on without being registered. --- js/block-editor.asset.php | 2 +- js/block-editor.js | 2 +- php/media/class-video.php | 8 +++++++- src/js/components/video.js | 17 ++++++++++++----- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/js/block-editor.asset.php b/js/block-editor.asset.php index 3766e7bab..e83ea2392 100644 --- a/js/block-editor.asset.php +++ b/js/block-editor.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => 'aab7b2e0606348e43cc2'); + array('wp-api-fetch', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '3a89e9388836c30baa53'); diff --git a/js/block-editor.js b/js/block-editor.js index 219b72806..59d76ba6d 100644 --- a/js/block-editor.js +++ b/js/block-editor.js @@ -1,2 +1,2 @@ -(()=>{"use strict";var e={6087(e){e.exports=window.wp.element}},t={};function r(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={exports:{}};return e[o](i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);const o=window.wp.apiFetch;var a=r.n(o);const i=window.wp.i18n,n=window.wp.data,s=window.wp.components;var l=r(6087);const d={_init(){"undefined"!=typeof CLD_VIDEO_PLAYER&&wp.hooks.addFilter("blocks.registerBlockType","Cloudinary/Media/Video",function(e,t){return"core/video"===t&&("off"!==CLD_VIDEO_PLAYER.video_autoplay_mode&&(e.attributes.autoplay.default=!0),"on"===CLD_VIDEO_PLAYER.video_loop&&(e.attributes.loop.default=!0),"off"===CLD_VIDEO_PLAYER.video_controls&&(e.attributes.controls.default=!1)),e})}};d._init();wp.hooks.addFilter("blocks.registerBlockType","cloudinary/addAttributes",function(e,t){return"core/image"!==t&&"core/video"!==t||(e.attributes||(e.attributes={}),e.attributes.overwrite_transformations={type:"boolean"},e.attributes.transformations={type:"boolean"}),e});const c=e=>{const{attributes:{overwrite_transformations:t},setAttributes:r}=e;return l.createElement(s.PanelBody,{title:(0,i.__)("Transformations","cloudinary")},l.createElement(s.ToggleControl,{label:(0,i.__)("Overwrite Global Transformations","cloudinary"),checked:t,onChange:e=>{r({overwrite_transformations:e})},__nextHasNoMarginBottom:!0}))};let u=e=>{const{setAttributes:t,media:r}=e,{InspectorControls:o}=wp.editor;return r&&r.transformations&&t({transformations:!0}),l.createElement(o,null,l.createElement(c,e))};u=(0,n.withSelect)((e,t)=>({...t,media:t.attributes.id?e("core").getMedia(t.attributes.id):null}))(u);wp.hooks.addFilter("editor.BlockEdit","cloudinary/filterEdit",e=>t=>{const{name:r}=t,o="core/image"===r||"core/video"===r;return l.createElement(l.Fragment,null,o?l.createElement(u,t):null,l.createElement(e,t))},20);var m=r(6087);let p=e=>m.createElement(m.Fragment,null,e.modalClass&&m.createElement(s.ToggleControl,{label:(0,i.__)("Overwrite Cloudinary Global Transformations","cloudinary"),checked:e.overwrite_featured_transformations,onChange:t=>e.setOverwrite(t),className:"cloudinary-overwrite-transformations",__nextHasNoMarginBottom:!0}));p=(0,n.withSelect)(e=>({overwrite_featured_transformations:e("core/editor")?.getEditedPostAttribute("meta")._cloudinary_featured_overwrite??!1}))(p),p=(0,n.withDispatch)(e=>({setOverwrite:t=>{e("core/editor").editPost({meta:{_cloudinary_featured_overwrite:t}})}}))(p);const h=e=>class extends e{render(){return m.createElement(m.Fragment,null,super.render(),!!this.props.value&&m.createElement(p,this.props))}},f={_init(){wp.hooks.addFilter("editor.MediaUpload","cloudinary/filter-featured-image",h)}};f._init();const _={wrapper:null,query:{per_page:-1,orderby:"name",order:"asc",_fields:"id,name,parent",context:"view"},available:{},taxonomies:null,fetchWait:null,_init(){if(this.wrapper=document.getElementById("cld-tax-items"),!this.wrapper)return;const{getTaxonomies:e}=(0,n.select)("core");this.fetchWait=setInterval(()=>{this.taxonomies=e(),this.taxonomies&&(clearInterval(this.fetchWait),this._init_listeners())},1e3)},_init_listeners(){this.taxonomies.forEach(e=>{e.rest_base&&e.visibility.public&&(0,n.subscribe)(()=>{const t=e.slug,r=e.hierarchical,{isResolving:o}=(0,n.select)("core/data"),a=["taxonomy",t,this.query];this.available[t]=null,r&&(this.available[t]=(0,n.select)("core").getEntityRecords("taxonomy",t,this.query)),o("core","getEntityRecords",a)||this.event(e)})})},event(e){const t=(0,n.select)("core/editor").getEditedPostAttribute(e.rest_base);if(!t)return;const r=[...t],o=Array.from(this.wrapper.querySelectorAll(`[data-item*="${e.slug}"]`));[...r].forEach(t=>{const r=this.wrapper.querySelector(`[data-item="${e.slug}:${t}"]`);o.splice(o.indexOf(r),1),null===r&&this.createItem(this.getItem(e,t))}),o.forEach(e=>{e.parentNode.removeChild(e)})},createItem(e){if(!e||!e.id)return;const t=document.createElement("li"),r=document.createElement("span"),o=document.createElement("input"),a=document.createTextNode(e.name);t.classList.add("cld-tax-order-list-item"),t.dataset.item=`${e.taxonomy}:${e.id}`,o.classList.add("cld-tax-order-list-item-input"),o.type="hidden",o.name="cld_tax_order[]",o.value=`${e.taxonomy}:${e.id}`,r.className="dashicons dashicons-menu cld-tax-order-list-item-handle",t.appendChild(r),t.appendChild(o),t.appendChild(a),this.wrapper.appendChild(t)},getItem(e,t){let r={};if(null===this.available[e.slug])r=(0,n.select)("core").getEntityRecord("taxonomy",e.slug,t);else for(const o of this.available[e.slug])if(o.id===t){r=o,r.taxonomy=e.slug;break}return r}};window.addEventListener("load",()=>_._init());window.$=window.jQuery,a().use((e,t)=>{if("cors"===e.mode)return t(e);if(e.url)try{const r=new URL(e.url,location.href);if(r.protocol!==location.protocol||r.hostname!==location.hostname||r.port!==location.port)return t(e)}catch{return t(e)}return e.headers||(e.headers={}),e.headers["x-cld-fetch-from-editor"]="true",t(e)})})(); +(()=>{"use strict";var e={6087(e){e.exports=window.wp.element}};const t={};function r(o){const a=t[o];if(void 0!==a)return a.exports;const i=t[o]={exports:{}};return e[o](i,i.exports,r),i.exports}r.n=e=>{const t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{if(Array.isArray(t))for(var o=0;oObject.hasOwn(e,t);const o=window.wp.apiFetch;var a=r.n(o);const i=window.wp.i18n,n=window.wp.data;var s=r(6087);const l=window.wp.components;var d=r(6087);const c={_init(){"undefined"!=typeof CLD_VIDEO_PLAYER&&wp.hooks.addFilter("blocks.registerBlockType","Cloudinary/Media/Video",function(e,t){return"core/video"===t&&("off"!==CLD_VIDEO_PLAYER.video_autoplay_mode&&(e.attributes.autoplay.default=!0),"on"===CLD_VIDEO_PLAYER.video_loop&&(e.attributes.loop.default=!0),"off"===CLD_VIDEO_PLAYER.video_controls&&(e.attributes.controls.default=!1)),e})}};c._init();wp.hooks.addFilter("blocks.registerBlockType","cloudinary/addAttributes",function(e,t){return"core/image"!==t&&"core/video"!==t||(e.attributes||(e.attributes={}),e.attributes.overwrite_transformations={type:"boolean"},e.attributes.transformations={type:"boolean"}),e});const u=e=>{const{attributes:{overwrite_transformations:t},setAttributes:r}=e;return d.createElement(l.PanelBody,{title:(0,i.__)("Transformations","cloudinary")},d.createElement(l.ToggleControl,{label:(0,i.__)("Overwrite Global Transformations","cloudinary"),checked:t,onChange:e=>{r({overwrite_transformations:e})},__nextHasNoMarginBottom:!0}))};let m=e=>{const{setAttributes:t,media:r}=e,{InspectorControls:o}=wp.blockEditor;return(0,s.useEffect)(()=>{r&&r.transformations&&t({transformations:!0})},[r,t]),d.createElement(o,null,d.createElement(u,e))};m=(0,n.withSelect)((e,t)=>({...t,media:t.attributes.id?e("core").getMedia(t.attributes.id):null}))(m);wp.hooks.addFilter("editor.BlockEdit","cloudinary/filterEdit",e=>t=>{const{name:r}=t,o="core/image"===r||"core/video"===r;return d.createElement(d.Fragment,null,o?d.createElement(m,t):null,d.createElement(e,t))},20);var p=r(6087);let f=e=>p.createElement(p.Fragment,null,e.modalClass&&p.createElement(l.ToggleControl,{label:(0,i.__)("Overwrite Cloudinary Global Transformations","cloudinary"),checked:e.overwrite_featured_transformations,onChange:t=>e.setOverwrite(t),className:"cloudinary-overwrite-transformations",__nextHasNoMarginBottom:!0}));f=(0,n.withSelect)(e=>({overwrite_featured_transformations:e("core/editor")?.getEditedPostAttribute("meta")._cloudinary_featured_overwrite??!1}))(f),f=(0,n.withDispatch)(e=>({setOverwrite:t=>{e("core/editor").editPost({meta:{_cloudinary_featured_overwrite:t}})}}))(f);const h=e=>class extends e{render(){return p.createElement(p.Fragment,null,super.render(),!!this.props.value&&p.createElement(f,this.props))}},_={_init(){wp.hooks.addFilter("editor.MediaUpload","cloudinary/filter-featured-image",h)}};_._init();const w={wrapper:null,query:{per_page:-1,orderby:"name",order:"asc",_fields:"id,name,parent",context:"view"},available:{},taxonomies:null,fetchWait:null,_init(){if(this.wrapper=document.getElementById("cld-tax-items"),!this.wrapper)return;const{getTaxonomies:e}=(0,n.select)("core");this.fetchWait=setInterval(()=>{this.taxonomies=e(),this.taxonomies&&(clearInterval(this.fetchWait),this._init_listeners())},1e3)},_init_listeners(){this.taxonomies.forEach(e=>{e.rest_base&&e.visibility.public&&(0,n.subscribe)(()=>{const t=e.slug,r=e.hierarchical,{isResolving:o}=(0,n.select)("core/data"),a=["taxonomy",t,this.query];this.available[t]=null,r&&(this.available[t]=(0,n.select)("core").getEntityRecords("taxonomy",t,this.query)),o("core","getEntityRecords",a)||this.event(e)})})},event(e){const t=(0,n.select)("core/editor").getEditedPostAttribute(e.rest_base);if(!t)return;const r=[...t],o=Array.from(this.wrapper.querySelectorAll(`[data-item*="${e.slug}"]`));[...r].forEach(t=>{const r=this.wrapper.querySelector(`[data-item="${e.slug}:${t}"]`);o.splice(o.indexOf(r),1),null===r&&this.createItem(this.getItem(e,t))}),o.forEach(e=>{e.parentNode.removeChild(e)})},createItem(e){if(!e||!e.id)return;const t=document.createElement("li"),r=document.createElement("span"),o=document.createElement("input"),a=document.createTextNode(e.name);t.classList.add("cld-tax-order-list-item"),t.dataset.item=`${e.taxonomy}:${e.id}`,o.classList.add("cld-tax-order-list-item-input"),o.type="hidden",o.name="cld_tax_order[]",o.value=`${e.taxonomy}:${e.id}`,r.className="dashicons dashicons-menu cld-tax-order-list-item-handle",t.appendChild(r),t.appendChild(o),t.appendChild(a),this.wrapper.appendChild(t)},getItem(e,t){let r={};if(null===this.available[e.slug])r=(0,n.select)("core").getEntityRecord("taxonomy",e.slug,t);else for(const o of this.available[e.slug])if(o.id===t){r=o,r.taxonomy=e.slug;break}return r}};window.addEventListener("load",()=>w._init());window.$=window.jQuery,a().use((e,t)=>{if("cors"===e.mode)return t(e);if(e.url)try{const r=new URL(e.url,location.href);if(r.protocol!==location.protocol||r.hostname!==location.hostname||r.port!==location.port)return t(e)}catch{return t(e)}return e.headers||(e.headers={}),e.headers["x-cld-fetch-from-editor"]="true",t(e)})})(); //# sourceMappingURL=block-editor.js.map \ No newline at end of file diff --git a/php/media/class-video.php b/php/media/class-video.php index 918134cbd..c33be85ec 100644 --- a/php/media/class-video.php +++ b/php/media/class-video.php @@ -153,7 +153,13 @@ public function filter_video_shortcode( $html, $attr ) { * Enqueue BLock Assets */ public function enqueue_block_assets() { - wp_enqueue_script( 'cloudinary-block', $this->media->plugin->dir_url . 'js/block-editor.js', array(), $this->media->plugin->version, true ); + wp_enqueue_script( + 'cloudinary-block', + $this->media->plugin->dir_url . 'js/block-editor.js', + array( 'wp-block-editor', 'wp-components', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n' ), + $this->media->plugin->version, + true + ); wp_add_inline_script( 'cloudinary-block', 'var CLD_VIDEO_PLAYER = ' . wp_json_encode( $this->config ), 'before' ); } diff --git a/src/js/components/video.js b/src/js/components/video.js index 7aecaa677..21c240485 100644 --- a/src/js/components/video.js +++ b/src/js/components/video.js @@ -2,6 +2,7 @@ import { __ } from '@wordpress/i18n'; import { withSelect } from '@wordpress/data'; +import { useEffect } from '@wordpress/element'; import { PanelBody, ToggleControl } from '@wordpress/components'; const Video = { @@ -87,11 +88,17 @@ const TransformationsToggle = ( props ) => { let ImageInspectorControls = ( props ) => { const { setAttributes, media } = props; - const { InspectorControls } = wp.editor; - - if ( media && media.transformations ) { - setAttributes( { transformations: true } ); - } + const { InspectorControls } = wp.blockEditor; + + // Flag the block as having transformations after render. Calling + // setAttributes during render triggers a React "Cannot update a component + // while rendering a different component" warning under React 19 + // (WordPress 7.1). + useEffect( () => { + if ( media && media.transformations ) { + setAttributes( { transformations: true } ); + } + }, [ media, setAttributes ] ); return ( From 444501e2a8d567362a1d33285267f422a69f99a5 Mon Sep 17 00:00:00 2001 From: Utkarsh Patel Date: Mon, 27 Jul 2026 14:17:21 +0530 Subject: [PATCH 3/4] Fix duplicate gallery settings app script enqueue The gallery settings page enqueued js/gallery.js under two handles: 'gallery_config' in enqueue_admin_scripts() and 'gallery-widget' via the React UI component's script param. The bundle executed twice, calling createRoot() twice on the same container, which React 19 (WordPress 7.1) reports as an error on every settings page load. Drop the script param from the React panel definition and keep the single enqueue that already carries the generated asset dependencies. --- php/media/class-gallery.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/php/media/class-gallery.php b/php/media/class-gallery.php index caf75d2a3..f16d9a024 100644 --- a/php/media/class-gallery.php +++ b/php/media/class-gallery.php @@ -428,13 +428,13 @@ public function register_settings( $pages ) { ); } + // The `js/gallery.js` app script is enqueued in `enqueue_admin_scripts()` + // with its generated asset dependencies. Adding a `script` here would + // enqueue the same file under a second handle, executing the bundle twice + // and calling `createRoot()` twice on the same container. $panel[] = array( - 'type' => 'react', - 'slug' => 'gallery_config', - 'script' => array( - 'slug' => 'gallery-widget', - 'src' => $this->plugin->dir_url . 'js/gallery.js', - ), + 'type' => 'react', + 'slug' => 'gallery_config', ); $panel[] = array( From b2ca7f258ae1334686b633de88916bcfe27ab49a Mon Sep 17 00:00:00 2001 From: Utkarsh Patel Date: Mon, 27 Jul 2026 14:27:00 +0530 Subject: [PATCH 4/4] Use generated asset dependencies for the block editor script src/js/blocks.js and its components accessed @wordpress packages through the wp.* globals (wp.hooks, wp.blockEditor), which the dependency extraction plugin cannot detect, so js/block-editor.asset.php was missing wp-block-editor and wp-hooks. The hand-written dependency list in class-video.php compensated for those but omitted wp-api-fetch, which blocks.js genuinely imports and only worked because other editor scripts loaded it first. Convert the wp.hooks/wp.blockEditor global usages to @wordpress/hooks and @wordpress/block-editor imports so the generated asset file is complete, and consume it in enqueue_block_assets() instead of the static list. --- js/block-editor.asset.php | 2 +- js/block-editor.js | 2 +- php/media/class-video.php | 6 ++++-- src/js/components/featured-image.js | 3 ++- src/js/components/video.js | 9 +++++---- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/js/block-editor.asset.php b/js/block-editor.asset.php index e83ea2392..af8fe4117 100644 --- a/js/block-editor.asset.php +++ b/js/block-editor.asset.php @@ -1 +1 @@ - array('wp-api-fetch', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '3a89e9388836c30baa53'); + array('wp-api-fetch', 'wp-block-editor', 'wp-components', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n'), 'version' => '58afb0a9ee7fa6faecd7'); diff --git a/js/block-editor.js b/js/block-editor.js index 59d76ba6d..73852db5f 100644 --- a/js/block-editor.js +++ b/js/block-editor.js @@ -1,2 +1,2 @@ -(()=>{"use strict";var e={6087(e){e.exports=window.wp.element}};const t={};function r(o){const a=t[o];if(void 0!==a)return a.exports;const i=t[o]={exports:{}};return e[o](i,i.exports,r),i.exports}r.n=e=>{const t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{if(Array.isArray(t))for(var o=0;oObject.hasOwn(e,t);const o=window.wp.apiFetch;var a=r.n(o);const i=window.wp.i18n,n=window.wp.data;var s=r(6087);const l=window.wp.components;var d=r(6087);const c={_init(){"undefined"!=typeof CLD_VIDEO_PLAYER&&wp.hooks.addFilter("blocks.registerBlockType","Cloudinary/Media/Video",function(e,t){return"core/video"===t&&("off"!==CLD_VIDEO_PLAYER.video_autoplay_mode&&(e.attributes.autoplay.default=!0),"on"===CLD_VIDEO_PLAYER.video_loop&&(e.attributes.loop.default=!0),"off"===CLD_VIDEO_PLAYER.video_controls&&(e.attributes.controls.default=!1)),e})}};c._init();wp.hooks.addFilter("blocks.registerBlockType","cloudinary/addAttributes",function(e,t){return"core/image"!==t&&"core/video"!==t||(e.attributes||(e.attributes={}),e.attributes.overwrite_transformations={type:"boolean"},e.attributes.transformations={type:"boolean"}),e});const u=e=>{const{attributes:{overwrite_transformations:t},setAttributes:r}=e;return d.createElement(l.PanelBody,{title:(0,i.__)("Transformations","cloudinary")},d.createElement(l.ToggleControl,{label:(0,i.__)("Overwrite Global Transformations","cloudinary"),checked:t,onChange:e=>{r({overwrite_transformations:e})},__nextHasNoMarginBottom:!0}))};let m=e=>{const{setAttributes:t,media:r}=e,{InspectorControls:o}=wp.blockEditor;return(0,s.useEffect)(()=>{r&&r.transformations&&t({transformations:!0})},[r,t]),d.createElement(o,null,d.createElement(u,e))};m=(0,n.withSelect)((e,t)=>({...t,media:t.attributes.id?e("core").getMedia(t.attributes.id):null}))(m);wp.hooks.addFilter("editor.BlockEdit","cloudinary/filterEdit",e=>t=>{const{name:r}=t,o="core/image"===r||"core/video"===r;return d.createElement(d.Fragment,null,o?d.createElement(m,t):null,d.createElement(e,t))},20);var p=r(6087);let f=e=>p.createElement(p.Fragment,null,e.modalClass&&p.createElement(l.ToggleControl,{label:(0,i.__)("Overwrite Cloudinary Global Transformations","cloudinary"),checked:e.overwrite_featured_transformations,onChange:t=>e.setOverwrite(t),className:"cloudinary-overwrite-transformations",__nextHasNoMarginBottom:!0}));f=(0,n.withSelect)(e=>({overwrite_featured_transformations:e("core/editor")?.getEditedPostAttribute("meta")._cloudinary_featured_overwrite??!1}))(f),f=(0,n.withDispatch)(e=>({setOverwrite:t=>{e("core/editor").editPost({meta:{_cloudinary_featured_overwrite:t}})}}))(f);const h=e=>class extends e{render(){return p.createElement(p.Fragment,null,super.render(),!!this.props.value&&p.createElement(f,this.props))}},_={_init(){wp.hooks.addFilter("editor.MediaUpload","cloudinary/filter-featured-image",h)}};_._init();const w={wrapper:null,query:{per_page:-1,orderby:"name",order:"asc",_fields:"id,name,parent",context:"view"},available:{},taxonomies:null,fetchWait:null,_init(){if(this.wrapper=document.getElementById("cld-tax-items"),!this.wrapper)return;const{getTaxonomies:e}=(0,n.select)("core");this.fetchWait=setInterval(()=>{this.taxonomies=e(),this.taxonomies&&(clearInterval(this.fetchWait),this._init_listeners())},1e3)},_init_listeners(){this.taxonomies.forEach(e=>{e.rest_base&&e.visibility.public&&(0,n.subscribe)(()=>{const t=e.slug,r=e.hierarchical,{isResolving:o}=(0,n.select)("core/data"),a=["taxonomy",t,this.query];this.available[t]=null,r&&(this.available[t]=(0,n.select)("core").getEntityRecords("taxonomy",t,this.query)),o("core","getEntityRecords",a)||this.event(e)})})},event(e){const t=(0,n.select)("core/editor").getEditedPostAttribute(e.rest_base);if(!t)return;const r=[...t],o=Array.from(this.wrapper.querySelectorAll(`[data-item*="${e.slug}"]`));[...r].forEach(t=>{const r=this.wrapper.querySelector(`[data-item="${e.slug}:${t}"]`);o.splice(o.indexOf(r),1),null===r&&this.createItem(this.getItem(e,t))}),o.forEach(e=>{e.parentNode.removeChild(e)})},createItem(e){if(!e||!e.id)return;const t=document.createElement("li"),r=document.createElement("span"),o=document.createElement("input"),a=document.createTextNode(e.name);t.classList.add("cld-tax-order-list-item"),t.dataset.item=`${e.taxonomy}:${e.id}`,o.classList.add("cld-tax-order-list-item-input"),o.type="hidden",o.name="cld_tax_order[]",o.value=`${e.taxonomy}:${e.id}`,r.className="dashicons dashicons-menu cld-tax-order-list-item-handle",t.appendChild(r),t.appendChild(o),t.appendChild(a),this.wrapper.appendChild(t)},getItem(e,t){let r={};if(null===this.available[e.slug])r=(0,n.select)("core").getEntityRecord("taxonomy",e.slug,t);else for(const o of this.available[e.slug])if(o.id===t){r=o,r.taxonomy=e.slug;break}return r}};window.addEventListener("load",()=>w._init());window.$=window.jQuery,a().use((e,t)=>{if("cors"===e.mode)return t(e);if(e.url)try{const r=new URL(e.url,location.href);if(r.protocol!==location.protocol||r.hostname!==location.hostname||r.port!==location.port)return t(e)}catch{return t(e)}return e.headers||(e.headers={}),e.headers["x-cld-fetch-from-editor"]="true",t(e)})})(); +(()=>{"use strict";var e={6087(e){e.exports=window.wp.element}};const t={};function r(o){const i=t[o];if(void 0!==i)return i.exports;const a=t[o]={exports:{}};return e[o](a,a.exports,r),a.exports}r.n=e=>{const t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{if(Array.isArray(t))for(var o=0;oObject.hasOwn(e,t);const o=window.wp.apiFetch;var i=r.n(o);const a=window.wp.i18n,n=window.wp.data;var s=r(6087);const l=window.wp.components,d=window.wp.hooks,c=window.wp.blockEditor;var u=r(6087);const m={_init(){"undefined"!=typeof CLD_VIDEO_PLAYER&&(0,d.addFilter)("blocks.registerBlockType","Cloudinary/Media/Video",function(e,t){return"core/video"===t&&("off"!==CLD_VIDEO_PLAYER.video_autoplay_mode&&(e.attributes.autoplay.default=!0),"on"===CLD_VIDEO_PLAYER.video_loop&&(e.attributes.loop.default=!0),"off"===CLD_VIDEO_PLAYER.video_controls&&(e.attributes.controls.default=!1)),e})}};m._init();(0,d.addFilter)("blocks.registerBlockType","cloudinary/addAttributes",function(e,t){return"core/image"!==t&&"core/video"!==t||(e.attributes||(e.attributes={}),e.attributes.overwrite_transformations={type:"boolean"},e.attributes.transformations={type:"boolean"}),e});const p=e=>{const{attributes:{overwrite_transformations:t},setAttributes:r}=e;return u.createElement(l.PanelBody,{title:(0,a.__)("Transformations","cloudinary")},u.createElement(l.ToggleControl,{label:(0,a.__)("Overwrite Global Transformations","cloudinary"),checked:t,onChange:e=>{r({overwrite_transformations:e})},__nextHasNoMarginBottom:!0}))};let f=e=>{const{setAttributes:t,media:r}=e;return(0,s.useEffect)(()=>{r&&r.transformations&&t({transformations:!0})},[r,t]),u.createElement(c.InspectorControls,null,u.createElement(p,e))};f=(0,n.withSelect)((e,t)=>({...t,media:t.attributes.id?e("core").getMedia(t.attributes.id):null}))(f);(0,d.addFilter)("editor.BlockEdit","cloudinary/filterEdit",e=>t=>{const{name:r}=t,o="core/image"===r||"core/video"===r;return u.createElement(u.Fragment,null,o?u.createElement(f,t):null,u.createElement(e,t))},20);var h=r(6087);let _=e=>h.createElement(h.Fragment,null,e.modalClass&&h.createElement(l.ToggleControl,{label:(0,a.__)("Overwrite Cloudinary Global Transformations","cloudinary"),checked:e.overwrite_featured_transformations,onChange:t=>e.setOverwrite(t),className:"cloudinary-overwrite-transformations",__nextHasNoMarginBottom:!0}));_=(0,n.withSelect)(e=>({overwrite_featured_transformations:e("core/editor")?.getEditedPostAttribute("meta")._cloudinary_featured_overwrite??!1}))(_),_=(0,n.withDispatch)(e=>({setOverwrite:t=>{e("core/editor").editPost({meta:{_cloudinary_featured_overwrite:t}})}}))(_);const w=e=>class extends e{render(){return h.createElement(h.Fragment,null,super.render(),!!this.props.value&&h.createElement(_,this.props))}},y={_init(){(0,d.addFilter)("editor.MediaUpload","cloudinary/filter-featured-image",w)}};y._init();const b={wrapper:null,query:{per_page:-1,orderby:"name",order:"asc",_fields:"id,name,parent",context:"view"},available:{},taxonomies:null,fetchWait:null,_init(){if(this.wrapper=document.getElementById("cld-tax-items"),!this.wrapper)return;const{getTaxonomies:e}=(0,n.select)("core");this.fetchWait=setInterval(()=>{this.taxonomies=e(),this.taxonomies&&(clearInterval(this.fetchWait),this._init_listeners())},1e3)},_init_listeners(){this.taxonomies.forEach(e=>{e.rest_base&&e.visibility.public&&(0,n.subscribe)(()=>{const t=e.slug,r=e.hierarchical,{isResolving:o}=(0,n.select)("core/data"),i=["taxonomy",t,this.query];this.available[t]=null,r&&(this.available[t]=(0,n.select)("core").getEntityRecords("taxonomy",t,this.query)),o("core","getEntityRecords",i)||this.event(e)})})},event(e){const t=(0,n.select)("core/editor").getEditedPostAttribute(e.rest_base);if(!t)return;const r=[...t],o=Array.from(this.wrapper.querySelectorAll(`[data-item*="${e.slug}"]`));[...r].forEach(t=>{const r=this.wrapper.querySelector(`[data-item="${e.slug}:${t}"]`);o.splice(o.indexOf(r),1),null===r&&this.createItem(this.getItem(e,t))}),o.forEach(e=>{e.parentNode.removeChild(e)})},createItem(e){if(!e||!e.id)return;const t=document.createElement("li"),r=document.createElement("span"),o=document.createElement("input"),i=document.createTextNode(e.name);t.classList.add("cld-tax-order-list-item"),t.dataset.item=`${e.taxonomy}:${e.id}`,o.classList.add("cld-tax-order-list-item-input"),o.type="hidden",o.name="cld_tax_order[]",o.value=`${e.taxonomy}:${e.id}`,r.className="dashicons dashicons-menu cld-tax-order-list-item-handle",t.appendChild(r),t.appendChild(o),t.appendChild(i),this.wrapper.appendChild(t)},getItem(e,t){let r={};if(null===this.available[e.slug])r=(0,n.select)("core").getEntityRecord("taxonomy",e.slug,t);else for(const o of this.available[e.slug])if(o.id===t){r=o,r.taxonomy=e.slug;break}return r}};window.addEventListener("load",()=>b._init());window.$=window.jQuery,i().use((e,t)=>{if("cors"===e.mode)return t(e);if(e.url)try{const r=new URL(e.url,location.href);if(r.protocol!==location.protocol||r.hostname!==location.hostname||r.port!==location.port)return t(e)}catch{return t(e)}return e.headers||(e.headers={}),e.headers["x-cld-fetch-from-editor"]="true",t(e)})})(); //# sourceMappingURL=block-editor.js.map \ No newline at end of file diff --git a/php/media/class-video.php b/php/media/class-video.php index c33be85ec..a1e8ea553 100644 --- a/php/media/class-video.php +++ b/php/media/class-video.php @@ -153,11 +153,13 @@ public function filter_video_shortcode( $html, $attr ) { * Enqueue BLock Assets */ public function enqueue_block_assets() { + $asset = require $this->media->plugin->dir_path . 'js/block-editor.asset.php'; // phpcs:ignore WordPressVIPMinimum.Files.IncludingFile.UsingVariable + wp_enqueue_script( 'cloudinary-block', $this->media->plugin->dir_url . 'js/block-editor.js', - array( 'wp-block-editor', 'wp-components', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n' ), - $this->media->plugin->version, + $asset['dependencies'], + $asset['version'], true ); wp_add_inline_script( 'cloudinary-block', 'var CLD_VIDEO_PLAYER = ' . wp_json_encode( $this->config ), 'before' ); diff --git a/src/js/components/featured-image.js b/src/js/components/featured-image.js index 61058c93d..ff985ac5d 100644 --- a/src/js/components/featured-image.js +++ b/src/js/components/featured-image.js @@ -5,6 +5,7 @@ import { __ } from '@wordpress/i18n'; import { ToggleControl } from '@wordpress/components'; import { withDispatch, withSelect } from '@wordpress/data'; +import { addFilter } from '@wordpress/hooks'; // Set our component. let FeaturedTransformationsToggle = ( props ) => { @@ -72,7 +73,7 @@ const Featured = { // the media object, to determine if an asset has transformations. // Also adds deeper support for other image types within Guttenberg. // @todo: find other locations (i.e Video poster). - wp.hooks.addFilter( + addFilter( 'editor.MediaUpload', 'cloudinary/filter-featured-image', cldFilterFeatured diff --git a/src/js/components/video.js b/src/js/components/video.js index 21c240485..737d8d8b6 100644 --- a/src/js/components/video.js +++ b/src/js/components/video.js @@ -4,6 +4,8 @@ import { __ } from '@wordpress/i18n'; import { withSelect } from '@wordpress/data'; import { useEffect } from '@wordpress/element'; import { PanelBody, ToggleControl } from '@wordpress/components'; +import { addFilter } from '@wordpress/hooks'; +import { InspectorControls } from '@wordpress/block-editor'; const Video = { _init() { @@ -12,7 +14,7 @@ const Video = { } // Gutenberg Video Settings - wp.hooks.addFilter( + addFilter( 'blocks.registerBlockType', 'Cloudinary/Media/Video', function ( settings, name ) { @@ -58,7 +60,7 @@ const cldAddToggle = function ( settings, name ) { return settings; }; -wp.hooks.addFilter( +addFilter( 'blocks.registerBlockType', 'cloudinary/addAttributes', cldAddToggle @@ -88,7 +90,6 @@ const TransformationsToggle = ( props ) => { let ImageInspectorControls = ( props ) => { const { setAttributes, media } = props; - const { InspectorControls } = wp.blockEditor; // Flag the block as having transformations after render. Calling // setAttributes during render triggers a React "Cannot update a component @@ -131,7 +132,7 @@ const cldFilterBlocksEdit = ( BlockEdit ) => { }; }; -wp.hooks.addFilter( +addFilter( 'editor.BlockEdit', 'cloudinary/filterEdit', cldFilterBlocksEdit,