(()=>{var e={758:e=>{var t;globalThis,t=()=>(()=>{"use strict";var e={17:e=>{e.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var r,s,o;if(Array.isArray(t)){if((r=t.length)!=n.length)return!1;for(s=r;0!=s--;)if(!e(t[s],n[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(o=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(s=r;0!=s--;)if(!Object.prototype.hasOwnProperty.call(n,o[s]))return!1;for(s=r;0!=s--;){var l=o[s];if(!e(t[l],n[l]))return!1}return!0}return t!=t&&n!=n}}},t={};function n(r){var s=t[r];if(void 0!==s)return s.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{n.r(r),n.d(r,{BlockStyles:()=>b,Style:()=>w,buildChangedStylesObject:()=>I,getPreviewDevice:()=>h,getSelector:()=>E,useAtRuleEffect:()=>O,useCurrentAtRule:()=>T,useDecodeStyleKeys:()=>G,useDeviceType:()=>C,useGenerateCSSEffect:()=>x,useSetStyles:()=>_,useStyleSelectorEffect:()=>q,withUniqueId:()=>k});const e=window.React,t=window.wp.components,s=window.wp.primitives,o=(0,e.createElement)(s.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(s.Path,{fillRule:"evenodd",d:"M10.289 4.836A1 1 0 0111.275 4h1.306a1 1 0 01.987.836l.244 1.466c.787.26 1.503.679 2.108 1.218l1.393-.522a1 1 0 011.216.437l.653 1.13a1 1 0 01-.23 1.273l-1.148.944a6.025 6.025 0 010 2.435l1.149.946a1 1 0 01.23 1.272l-.653 1.13a1 1 0 01-1.216.437l-1.394-.522c-.605.54-1.32.958-2.108 1.218l-.244 1.466a1 1 0 01-.987.836h-1.306a1 1 0 01-.986-.836l-.244-1.466a5.995 5.995 0 01-2.108-1.218l-1.394.522a1 1 0 01-1.217-.436l-.653-1.131a1 1 0 01.23-1.272l1.149-.946a6.026 6.026 0 010-2.435l-1.148-.944a1 1 0 01-.23-1.272l.653-1.131a1 1 0 011.217-.437l1.393.522a5.994 5.994 0 012.108-1.218l.244-1.466zM14.929 12a3 3 0 11-6 0 3 3 0 016 0z",clipRule:"evenodd"})),l=(0,e.createElement)(s.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)(s.Path,{d:"M12 4c-4.4 0-8 3.6-8 8v.1c0 4.1 3.2 7.5 7.2 7.9h.8c4.4 0 8-3.6 8-8s-3.6-8-8-8zm0 15V5c3.9 0 7 3.1 7 7s-3.1 7-7 7z"})),c=window.wp.element,i=window.wp.i18n;function u(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var s=e.length;for(t=0;tnull,stylesTab:r=()=>null,onTabSelect:s=()=>null}){var u;const b=null!==(u=sessionStorage.getItem(f))&&void 0!==u?u:"settings",[p,y]=(0,c.useState)(b),g=(0,c.useMemo)((()=>[{name:"settings",icon:o,title:(0,i.__)("Settings","generateblocks")},{name:"styles",icon:l,title:(0,i.__)("Styles","generateblocks")}]),[]);return(0,e.createElement)(t.TabPanel,{className:a(d.panel,"gb-block-styles-tab-panel",d[p]),activeClass:"is-active",onSelect:e=>{!function(e){sessionStorage.setItem(f,e)}(e),y(e),s(e)},initialTabName:p,tabs:g},(()=>(0,e.createElement)(e.Fragment,null,"settings"===p&&(0,e.createElement)(e.Fragment,null,n),"styles"===p&&(0,e.createElement)(e.Fragment,null,r))))}const p=window.wp.data,y=e=>e.reduce(((e,t)=>{if(t.name&&t.name.includes("generateblocks")&&t.attributes&&t.attributes.uniqueId&&(e.uniqueIds.push(t.attributes.uniqueId),e.clientIds.push(t.clientId)),t.innerBlocks){const{uniqueIds:n,clientIds:r}=y(t.innerBlocks);e.uniqueIds=e.uniqueIds.concat(n),e.clientIds=e.clientIds.concat(r)}return e}),{uniqueIds:[],clientIds:[]}),g=e=>e.substr(2,9).replace("-",""),m=(e,t,n)=>e.filter(((e,r)=>e===t&&r!==n)).length>0;function k(t){return n=>{const{clientId:r,attributes:s,setAttributes:o}=n;return(0,c.useEffect)((()=>{const e=function(){const e=(0,p.select)("core/block-editor").getBlocks(),t=e=>e.map((e=>{if("core/widget-area"===e.name){const n=(0,p.select)("core/block-editor").getBlocks(e.clientId);return{...e,innerBlocks:t(n)}}return{...e,innerBlocks:t(e.innerBlocks||[])}}));return t(e)}(),{uniqueIds:t,clientIds:n}=y(e);if(!s.uniqueId||m(t,s.uniqueId,n.indexOf(r))){const e=g(r);o({uniqueId:e})}}),[r]),(0,e.createElement)(t,{...n})}}const v=window.wp.hooks;function S({editorCss:t,id:n}){return t?(0,e.createElement)("style",{id:n},t):null}function w({selector:t,styles:n,getCss:r,clientId:s,name:o}){const l=(0,c.useMemo)((()=>t.replace(".","")),[t]),[i,u]=(0,c.useState)(""),[a,d]=(0,c.useState)(null),[f,b]=(0,c.useState)(!1);(0,c.useEffect)((()=>{const e=document.querySelector('iframe[name="editor-canvas"]')?.contentDocument||document,t=e.querySelector(".is-root-container");let n=null;t&&(n=e.getElementById("generateblocks-block-styles"),n||(n=e.createElement("div"),n.style.display="none",n.id="generateblocks-block-styles",t.insertBefore(n,t.firstChild)),d(n),b(null!==n.closest(".block-editor-block-preview__content-iframe")))}),[]),(0,c.useEffect)((()=>{if(!t)return;let e=!0;return(async()=>{try{const s=await r(t,n,"editor");e&&u(s)}catch(e){console.error("Failed to fetch CSS:",e)}})(),()=>{e=!1}}),[n,t,r]);const p=(0,v.applyFilters)("generateblocks.editor.blockCss",i,{clientId:s,name:o});return!a||f?(0,e.createElement)(S,{editorCss:p,id:l}):(0,c.createPortal)((0,e.createElement)(S,{editorCss:p,id:l}),a)}function h(e){let t="Desktop";return t=e>1024?"Desktop":e>767?"Tablet":"Mobile",t}function I(e,t,n){return t&&n?{[n]:{[t]:e}}:t?{[t]:e}:n?{[n]:e}:e}function E(e,t){const n=(0,v.applyFilters)("generateblocks.blockStyles.selectors",{"generateblocks/text":"text","generateblocks/element":"element","generateblocks/loop-item":"loop-item","generateblocks/looper":"looper","generateblocks/media":"media","generateblocks/query":"query","generateblocks/query-page-numbers":"query-page-numbers","generateblocks/shape":"shape"},{blockName:e,uniqueId:t});if(n[e])return`.gb-${n[e]}-${t}`}function j(e,t=[]){var n;return null!==(n=t?.find((t=>t.value===e))?.id)&&void 0!==n?n:"all"}function A(e,t=[]){var n;return null!==(n=t.find((t=>t.id===e))?.value)&&void 0!==n?n:""}function O({deviceType:e,atRule:t,setAtRule:n,defaultAtRules:r=[],isSelected:s,getPreviewWidth:o=()=>null}){(0,c.useEffect)((()=>{if(!s)return;let l="";switch(e){case"Desktop":l="";break;case"Tablet":l="mediumSmallWidth";break;case"Mobile":l="smallWidth";break;default:return}if(j(t,r)!==l){const s=h(o(t));if(e===s)return;const c=A(l,r);n(c)}}),[e,t,n,j,A,r,s])}function x({selector:e,styles:t,setAttributes:n,getCss:r,getSelector:s,isSelected:o,blockCss:l="",clientId:i=""}){const u=(0,p.useSelect)((e=>e("core/block-editor")?.getMultiSelectedBlocks()||[]),[]),{updateBlockAttributes:a,__unstableMarkNextChangeAsNotPersistent:d}=(0,p.useDispatch)("core/block-editor"),f=(0,c.useMemo)((()=>t),[JSON.stringify(t)]),b=(0,c.useMemo)((()=>u.some((e=>e.clientId===i))),[u,i]);(0,c.useEffect)((()=>{if(null===e||""===e)return;const c=function(e,t,n,r,s){const o=Object.keys(r||{}).length>0,l=s?.trim().length>0||!1;return e||t||o&&!l||!o&&l||l&&!s.includes(n)}(o,b,e,f,l);if(!c)return;let i=!0;return async function(){if(b&&u.length>0){const e=u.map((async e=>{const t=s(e?.name,e?.attributes?.uniqueId);if(!t)return;const n=await r(t,e?.attributes?.styles);return n===(e?.attributes?.css||"")?null:{clientId:e.clientId,blockAttrs:{css:n}}})),t=(await Promise.all(e)).filter(Boolean);if(i&&t.length>0){const e=t.map((e=>e.clientId)),n=t.reduce(((e,t)=>(e[t.clientId]=t.blockAttrs,e)),{});"function"==typeof d&&d(),a(e,n,!0)}return}const o=await r(e,t);i&&o!==l&&("function"==typeof d&&d(),n({css:o}))}(),()=>{i=!1}}),[e,f,n,r,s,o,b,l,u,a,i])}function q({isSelected:e,currentStyle:t,selector:n,setCurrentStyle:r,setNestedRule:s}){(0,c.useEffect)((()=>{e&&(t?.selector&&n===t?.selector||(r({selector:n}),s("")))}),[e,t?.selector,n,r,s])}function C(){const{setDeviceType:e=()=>null}=(0,p.useDispatch)("core/editor");return{deviceType:(0,p.useSelect)((e=>{const{getDeviceType:t=()=>"Desktop"}=e("core/editor");return t()}),[]),setDeviceType:e}}const D={Desktop:"all",Tablet:"mediumSmallWidth",Mobile:"smallWidth"};function T(e=[]){const{deviceType:t}=C();return(0,c.useMemo)((()=>{var n;if(!t||"Desktop"===t)return"";const r=D[t];return null!==(n=e.find((e=>e.id===r))?.value)&&void 0!==n?n:""}),[t])}function B(e,...t){if(!t.length)return e;const n=t.shift();if(M(e)&&M(n))for(const t in n)M(n[t])?(e[t]||Object.assign(e,{[t]:{}}),B(e[t],n[t])):Object.assign(e,{[t]:n[t]});return B(e,...t)}function M(e){return e&&"object"==typeof e&&!Array.isArray(e)}function _(e,{cleanStylesObject:t}){const{setAttributes:n,clientId:r}=e,s=(0,p.useSelect)((e=>e("core/block-editor")?.getMultiSelectedBlocks()||[]),[]),o=(0,p.useSelect)((e=>e("core/block-editor")?.getBlock),[]),{updateBlockAttributes:l}=(0,p.useDispatch)("core/block-editor");return function(e){if(Array.isArray(s)&&s.length>0){const n=s.map((n=>{const r=o(n?.clientId)?.attributes?.styles,s=t(B({...r},e));return{clientId:n.clientId,blockAttrs:{styles:s}}})),r=n.map((e=>e.clientId)),c=n.reduce(((e,t)=>(e[t.clientId]=t.blockAttrs,e)),{});return void l(r,c,!0)}const c=o(r)?.attributes?.styles,i=t(B({...c},e));n({styles:i})}}const P=window.wp.blockEditor,R=window.wp.htmlEntities,W=new Set(["amp;","lt;","gt;","quot;","apos;","#39;"]);function N(e){return"object"!=typeof e||null===e?e:Object.entries(e).reduce(((e,[t,n])=>(e[(0,R.decodeEntities)(t)]="object"==typeof n?N(n):n,e)),{})}var F=n(17),z=n.n(F);function G({styles:e,setAttributes:t}){const{__unstableMarkNextChangeAsNotPersistent:n}=(0,p.useDispatch)(P.store);(0,c.useEffect)((()=>{if(e&&"object"==typeof e&&function(e){if("object"!=typeof e||null===e)return!1;const t=[e];for(;t.length>0;){const e=t.pop();for(const n in e){for(const e of W)if(n.includes(e))return!0;"object"==typeof e[n]&&null!==e[n]&&t.push(e[n])}}return!1}(e)){const r=N(e);z()(r,e)||("function"==typeof n&&n(),t({styles:r}))}}),[e,t])}})(),r})(),e.exports=t()}},t={},n=function n(r){var s=t[r];if(void 0!==s)return s.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}(758);(window.gb=window.gb||{}).blockStyles=n})();