Files
2026-07-02 15:54:39 -06:00

49 lines
40 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
(()=>{var e={6942(e,t){var n;!function(){"use strict";var a={}.hasOwnProperty;function s(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=l(e,r(n)))}return e}function r(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return s.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var n in e)a.call(e,n)&&e[n]&&(t=l(t,n));return t}function l(e,t){return t?e?e+" "+t:e+t:e}e.exports?(s.default=s,e.exports=s):void 0===(n=function(){return s}.apply(t,[]))||(e.exports=n)}()}},t={};function n(a){var s=t[a];if(void 0!==s)return s.exports;var r=t[a]={exports:{}};return e[a](r,r.exports,n),r.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 a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";const e=window.React,t=window.wp.i18n,a=window.wp.components,s=window.wp.element,r=window.wp.apiFetch;var l=n.n(r);const o=window.wp.url;async function i(e){var t;const n=await l()({path:(0,o.addQueryArgs)("/generateblocks-pro/v1/global-classes/get_styles",{globalClass:e}),method:"GET"});let a=null!==(t=n?.response?.data?.styles)&&void 0!==t?t:{};return Array.isArray(a)&&0===a.length&&(a={}),{classStyles:a,classPostId:n?.response?.data?.postId}}const c=window.wp.primitives,d=(0,s.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(c.Path,{d:"m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z"})),u=(0,s.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(c.Path,{d:"M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"})),p=window.wp.notices,g=window.wp.data;window.ReactDOM;"undefined"!=typeof window&&void 0!==window.document&&window.document.createElement;function m(e){const t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function b(e){return"nodeType"in e}function h(e){var t,n;return e?m(e)?e:b(e)&&null!=(t=null==(n=e.ownerDocument)?void 0:n.defaultView)?t:window:window}function y(e){const{Document:t}=h(e);return e instanceof t}function f(e){return!m(e)&&e instanceof h(e).HTMLElement}function _(e){return e instanceof h(e).SVGElement}function v(e){return e?m(e)?e.document:b(e)?y(e)?e:f(e)||_(e)?e.ownerDocument:document:document:document}function w(e){return function(t){for(var n=arguments.length,a=new Array(n>1?n-1:0),s=1;s<n;s++)a[s-1]=arguments[s];return a.reduce(((t,n)=>{const a=Object.entries(n);for(const[n,s]of a){const a=t[n];null!=a&&(t[n]=a+e*s)}return t}),{...t})}}const k=w(-1);function E(e){if(function(e){if(!e)return!1;const{TouchEvent:t}=h(e.target);return t&&e instanceof t}(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return function(e){return"clientX"in e&&"clientY"in e}(e)?{x:e.clientX,y:e.clientY}:null}var S;!function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"}(S||(S={}));const x=Object.freeze({x:0,y:0});var C,D,N;!function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"}(C||(C={}));class I{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach((e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)}))},this.target=e}add(e,t,n){var a;null==(a=this.target)||a.addEventListener(e,t,n),this.listeners.push([e,t,n])}}function T(e,t){const n=Math.abs(e.x),a=Math.abs(e.y);return"number"==typeof t?Math.sqrt(n**2+a**2)>t:"x"in t&&"y"in t?n>t.x&&a>t.y:"x"in t?n>t.x:"y"in t&&a>t.y}function R(e){e.preventDefault()}function B(e){e.stopPropagation()}!function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"}(D||(D={})),function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"}(N||(N={}));N.Space,N.Enter,N.Esc,N.Space,N.Enter,N.Tab;function M(e){return Boolean(e&&"distance"in e)}function A(e){return Boolean(e&&"delay"in e)}class O{constructor(e,t,n){var a;void 0===n&&(n=function(e){const{EventTarget:t}=h(e);return e instanceof t?e:v(e)}(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;const{event:s}=e,{target:r}=s;this.props=e,this.events=t,this.document=v(r),this.documentListeners=new I(this.document),this.listeners=new I(n),this.windowListeners=new I(h(r)),this.initialCoordinates=null!=(a=E(s))?a:x,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(D.Resize,this.handleCancel),this.windowListeners.add(D.DragStart,R),this.windowListeners.add(D.VisibilityChange,this.handleCancel),this.windowListeners.add(D.ContextMenu,R),this.documentListeners.add(D.Keydown,this.handleKeydown),t){if(null!=n&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(A(t))return this.timeoutId=setTimeout(this.handleStart,t.delay),void this.handlePending(t);if(M(t))return void this.handlePending(t)}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){const{active:n,onPending:a}=this.props;a(n,e,this.initialCoordinates,t)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(D.Click,B,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(D.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:n,initialCoordinates:a,props:s}=this,{onMove:r,options:{activationConstraint:l}}=s;if(!a)return;const o=null!=(t=E(e))?t:x,i=k(a,o);if(!n&&l){if(M(l)){if(null!=l.tolerance&&T(i,l.tolerance))return this.handleCancel();if(T(i,l.distance))return this.handleStart()}return A(l)&&T(i,l.tolerance)?this.handleCancel():void this.handlePending(l,i)}e.cancelable&&e.preventDefault(),r(o)}handleEnd(){const{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){const{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===N.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const P={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};(class extends O{constructor(e){const{event:t}=e,n=v(t.target);super(e,P,n)}}).activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:a}=t;return!(!n.isPrimary||0!==n.button||(null==a||a({event:n}),0))}}];const z={move:{name:"mousemove"},end:{name:"mouseup"}};var L;!function(e){e[e.RightClick=2]="RightClick"}(L||(L={})),class extends O{constructor(e){super(e,z,v(e.event.target))}}.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:a}=t;return n.button!==L.RightClick&&(null==a||a({event:n}),!0)}}];const $={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};var F,G,V,j,H;(class extends O{constructor(e){super(e,$)}static setup(){return window.addEventListener($.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener($.move.name,e)};function e(){}}}).activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:a}=t;const{touches:s}=n;return!(s.length>1||(null==a||a({event:n}),0))}}],function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"}(F||(F={})),function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"}(G||(G={})),C.Backward,C.Forward,C.Backward,C.Forward,function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"}(V||(V={})),function(e){e.Optimized="optimized"}(j||(j={})),V.WhileDragging,j.Optimized,Map,function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"}(H||(H={})),N.Down,N.Right,N.Up,N.Left;var U=n(6942),K=n.n(U);const W=window.gbp.stylesBuilder,Y=window.gbp.components,q=(0,s.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(c.Path,{d:"m11.3 17.2-5-5c-.1-.1-.1-.3 0-.4l2.3-2.3-1.1-1-2.3 2.3c-.7.7-.7 1.8 0 2.5l5 5H7.5v1.5h5.3v-5.2h-1.5v2.6zm7.5-6.4-5-5h2.7V4.2h-5.2v5.2h1.5V6.8l5 5c.1.1.1.3 0 .4l-2.3 2.3 1.1 1.1 2.3-2.3c.6-.7.6-1.9-.1-2.5z"})),Z=(0,s.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(c.Path,{d:"M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z"}));function X({usageData:n,loading:s,error:r,emptyMessage:l,onRetry:o,formatUsageType:i}){const c=i||(e=>({global_style_usage:(0,t.__)("Global Style Usage","generateblocks-pro"),manual_class_usage:(0,t.__)("Manual Class Usage","generateblocks-pro"),overlay_display_condition:(0,t.__)("Overlay Display Condition","generateblocks-pro"),block_conditions:(0,t.__)("Block Conditions","generateblocks-pro"),menu_item_conditions:(0,t.__)("Menu Item Conditions","generateblocks-pro")}[e]||e)),u=n&&n.usage&&0<Object.keys(n.usage).length,p=n?.limitations?.recent_post_scan,g=!!p,m=n?.has_more&&!g;return(0,e.createElement)("div",{className:"gb-modal-usage-content"},s&&(0,e.createElement)("div",{className:"gb-modal-loading"},(0,e.createElement)(a.Spinner,null),(0,e.createElement)("p",null,(0,t.__)("Searching for usage…","generateblocks-pro"))),!s&&r&&(0,e.createElement)("div",{className:"gb-modal-error"},(0,e.createElement)("p",{style:{color:"#d63638"}},r),(0,e.createElement)(a.Button,{variant:"secondary",onClick:o},(0,t.__)("Try Again","generateblocks-pro"))),n&&!r&&(0,e.createElement)("div",{className:"gb-modal-usage-body"},!u&&(0,e.createElement)("div",{className:"gb-modal-no-usage"},(0,e.createElement)("p",{style:{fontSize:"16px",textAlign:"center",color:"#666"}},l),g||m?(0,e.createElement)("div",{style:{background:"#fff8e1",border:"1px solid #f0b849",padding:"12px",borderRadius:"4px",marginTop:"16px"}},(0,e.createElement)("p",{style:{margin:0,fontSize:"13px"}},(0,e.createElement)("strong",null,(0,t.__)("Heads up:","generateblocks-pro"))," ",g&&p?.total_posts&&p.total_posts>p.scanned_posts?(0,t.sprintf)(/* translators: 1: number of posts scanned, 2: total eligible posts */ /* translators: 1: number of posts scanned, 2: total eligible posts */
(0,t.__)("Only the most recent %1$d of %2$d eligible posts were scanned. Older content may still reference this item — verify before deleting.","generateblocks-pro"),p.scanned_posts,p.total_posts):(0,t.__)("Usage search was limited for performance. Older content may still reference this item — verify before deleting.","generateblocks-pro"))):(0,e.createElement)("p",{style:{fontSize:"14px",textAlign:"center",color:"#999"}},(0,t.__)("You can safely delete it, or keep it for future use.","generateblocks-pro"))),u&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"gb-modal-usage-summary"},(0,e.createElement)("p",{style:{fontSize:"14px",color:"#666",margin:"0"}},(0,t.__)("Found usage in","generateblocks-pro")," ",(0,e.createElement)("strong",null,n.total),n.has_more&&"+"," ",1===n.total?(0,t.__)("location","generateblocks-pro"):(0,t.__)("locations","generateblocks-pro"))),n.cached&&n.cached_at&&(0,e.createElement)("div",{style:{background:"#f0f6fc",border:"1px solid #0969da",padding:"12px 16px",borderRadius:"4px",marginBottom:"16px",display:"flex",alignItems:"center",justifyContent:"space-between",gap:"5px"}},(0,e.createElement)("span",{style:{fontSize:"13px",color:"#0969da"}},(0,t.sprintf)(/* translators: %s: time ago (e.g., "5 minutes") */ /* translators: %s: time ago (e.g., "5 minutes") */
(0,t.__)("Showing cached results from %s ago.","generateblocks-pro"),(e=>{const n=Math.floor(Date.now()/1e3)-e;if(n<60)return(0,t.__)("less than a minute","generateblocks-pro");if(n<3600){const e=Math.max(1,Math.floor(n/60));return(0,t.sprintf)(/* translators: %d: number of minutes */ /* translators: %d: number of minutes */
(0,t._n)("%d minute","%d minutes",e,"generateblocks-pro"),e)}const a=Math.max(1,Math.floor(n/3600));return(0,t.sprintf)(/* translators: %d: number of hours */ /* translators: %d: number of hours */
(0,t._n)("%d hour","%d hours",a,"generateblocks-pro"),a)})(n.cached_at))),(0,e.createElement)(a.Button,{variant:"secondary",size:"compact",onClick:o,icon:q},(0,t.__)("Refresh","generateblocks-pro"))),g&&(0,e.createElement)("div",{style:{background:"#f0f6fc",border:"1px solid #0969da",padding:"12px",borderRadius:"4px",marginBottom:"16px"}},(0,e.createElement)("p",{style:{margin:"0",fontSize:"13px",color:"#0969da"}},(0,e.createElement)("strong",null,(0,t.__)("Heads up:","generateblocks-pro"))," ",p.total_posts&&p.total_posts>p.scanned_posts?(0,t.sprintf)(/* translators: 1: number of posts scanned, 2: total eligible posts */ /* translators: 1: number of posts scanned, 2: total eligible posts */
(0,t.__)("For performance, only the most recent %1$d of %2$d eligible posts were scanned. Older content may still reference this item.","generateblocks-pro"),p.scanned_posts,p.total_posts):(0,t.sprintf)(/* translators: %d: number of posts scanned */ /* translators: %d: number of posts scanned */
(0,t.__)("For performance, the search was limited to the most recent %d posts. Older content may still reference this item.","generateblocks-pro"),p.scanned_posts||p.max_posts))),m&&(0,e.createElement)("div",{style:{background:"#f0f6fc",border:"1px solid #0969da",padding:"12px",borderRadius:"4px",marginBottom:"16px"}},(0,e.createElement)("p",{style:{margin:"0",fontSize:"13px",color:"#0969da"}},(0,e.createElement)("strong",null,(0,t.__)("Note:","generateblocks-pro"))," ",(0,t.__)("Results limited to most recent posts for performance. There may be additional usage in older content.","generateblocks-pro"))),(0,e.createElement)("div",{className:"gb-modal-usage-sections"},Object.entries(n.usage).map((([n,s])=>(0,e.createElement)("div",{key:n,className:"gb-modal-usage-section"},(0,e.createElement)("h4",{className:"gb-modal-usage-section-title"},s.label,(0,e.createElement)("span",{className:"gb-modal-usage-count"},"(",s.items.length,s.has_more&&"+",")")),(0,e.createElement)("div",{className:"gb-modal-usage-items"},s.items.map((n=>(0,e.createElement)("div",{key:`${n.type}-${n.id}`,className:"gb-modal-usage-item"},(0,e.createElement)("div",{className:"gb-modal-usage-item-main"},(0,e.createElement)("div",{className:"gb-modal-usage-item-title"},(0,e.createElement)("strong",null,n.title),n.status&&(n=>{const a={publish:(0,t.__)("Published","generateblocks-pro"),draft:(0,t.__)("Draft","generateblocks-pro"),private:(0,t.__)("Private","generateblocks-pro")},s={publish:{bg:"#d1fae5",color:"#065f46",border:"#a7f3d0"},draft:{bg:"#fef3c7",color:"#92400e",border:"#fcd34d"},private:{bg:"#e0e7ff",color:"#3730a3",border:"#c7d2fe"}},r=s[n]||s.draft;return(0,e.createElement)("span",{style:{background:r.bg,color:r.color,border:`1px solid ${r.border}`,padding:"2px 6px",borderRadius:"4px",fontSize:"11px",fontWeight:"500",textTransform:"uppercase"}},a[n]||n)})(n.status)),(0,e.createElement)("div",{className:"gb-modal-usage-item-meta"},(0,e.createElement)("span",{className:"gb-modal-usage-item-type"},n.type_label),(0,e.createElement)("span",{className:"gb-modal-usage-item-usage-type"},c(n.usage_type),n.block_count>1&&(0,e.createElement)("span",{style:{marginLeft:"5px",opacity:.7}},"(",n.block_count," ",(0,t.__)("blocks","generateblocks-pro"),")")))),(0,e.createElement)("div",{className:"gb-modal-usage-item-actions"},n.edit_url&&(0,e.createElement)(a.Button,{variant:"secondary",size:"compact",icon:d,href:n.edit_url,target:"_blank",iconSize:"14"},(0,t.__)("Edit","generateblocks-pro")),n.view_url&&(0,e.createElement)(a.Button,{variant:"tertiary",size:"compact",icon:Z,href:n.view_url,target:"_blank",iconSize:"14"},(0,t.__)("View","generateblocks-pro"))))))))))))))}function Q({style:n,onClose:r}){const{usageData:o,loading:i,error:c,reload:d}=function(e,n=50){const[a,r]=(0,s.useState)(null),[o,i]=(0,s.useState)(!0),[c,d]=(0,s.useState)(null),u=(0,s.useRef)(null),p=(0,s.useCallback)((async(a=!1)=>{u.current&&u.current.abort(),u.current=new AbortController;const s=u.current;try{i(!0),d(null);const o=e.includes("?")?"&":"?",c=a?"&refresh=true":"",u=await l()({path:`${e}${o}limit=${n}${c}`,signal:s.signal});if(!u.success)return void d(u.response||(0,t.__)("Failed to load usage data","generateblocks-pro"));const p=u.response.data||u.response;r(p)}catch(e){if("AbortError"===e.name)return;console.error("Error loading usage data:",e);const n=e?.message||(0,t.__)("Error loading usage data. Please try again.","generateblocks-pro");d(n)}finally{i(!1)}}),[e,n]);return(0,s.useEffect)((()=>(p(!1),()=>{u.current&&u.current.abort()})),[p]),{usageData:a,loading:o,error:c,reload:(0,s.useCallback)((()=>{p(!0)}),[p])}}(`/generateblocks-pro/v1/global-classes/${n.id}/usage`);return(0,e.createElement)(a.Modal,{title:n.title?.rendered||n.title||(0,t.__)("Untitled Style","generateblocks-pro"),onRequestClose:r,className:"gb-modal-global-style-usage",size:"medium"},(0,e.createElement)(X,{usageData:o,loading:i,error:c,emptyMessage:(0,t.__)("This style is not currently being used anywhere on your site.","generateblocks-pro"),onRetry:d}))}var J;window.lodash;const ee="undefined"!=typeof gbGlobalStylePermissions&&null!==(J=gbGlobalStylePermissions?.canManageStyles)&&void 0!==J&&J,te=/[^a-zA-Z0-9-_]/g,ne=(e,t=!1,n=!0)=>{if(t)return e;let a=e.replace(te,"");for(;a.length>0&&!/^[a-zA-Z_]/.test(a);)a=a.substring(1);return!a.startsWith(".")&&n&&(a="."+a),a};async function ae({selector:e,postId:t,styles:n}){const{css:a,editorCss:s}=await async function(e,t){const[n,a]=await Promise.all([(0,W.getCss)(e,t),(0,W.getCss)(e,t,"editor")]);return{css:n,editorCss:a}}(e,n);await l()({path:`/wp/v2/gblocks_styles/${t}`,method:"POST",data:{title:e,gb_style_selector:e,gb_style_data:n,gb_style_css:a}}),function(e,t,n=null){var a,s;const r=(0,o.getPath)(window.location.href)?.includes("site-editor.php"),l=r?"core/edit-site":"core/editor",i=(0,g.select)(l);if(!i)return;const c=r?i.getSettings:i.getEditorSettings;if("function"!=typeof c)return;const d=c.call(i),u="gb_class:"+e,p=n&&n!==e?"gb_class:"+n:null,m=p?(null!==(a=d?.styles)&&void 0!==a?a:[]).filter((e=>e.source!==p)):null!==(s=d?.styles)&&void 0!==s?s:[],b=m.find((e=>u===e.source))?m.map((e=>u===e.source?{...e,css:t}:e)):[...m,{css:t,source:u}],h=r?(0,g.dispatch)(l).updateSettings:(0,g.dispatch)(l).updateEditorSettings;"function"==typeof h&&h({styles:b})}(e,s)}function se({globalStyles:n=[],"aria-labelledby":r,isLoading:o=!1,setStylesOrder:c}){const[m,b]=(0,s.useState)(n),h=(0,s.useRef)([]),[y,f]=(0,s.useState)(!1),[_,v]=(0,s.useState)(!1),{createSuccessNotice:w,createErrorNotice:k}=(0,g.useDispatch)(p.store),[E,S]=(0,s.useState)(!1),[x,C]=(0,s.useState)(null),[D,N]=(0,s.useState)(null),[I,T]=(0,s.useState)(!1),[R,B]=(0,s.useState)(null),M=(0,s.useRef)(0),[A,O]=(0,s.useState)(!1),[P,z]=(0,s.useState)(null),[L,$]=(0,s.useState)(null),[F,G]=(0,s.useState)({}),[V,j]=(0,s.useState)(!1),H=(0,s.useMemo)((()=>{let e=0;return Object.entries(F).forEach((([,t])=>{t&&e++})),e}),[F]),[U,q]=(0,s.useState)(null),[Z,X]=(0,s.useState)(""),[J,te]=(0,s.useState)(null),[se,re]=(0,s.useState)(!1),le=()=>{S(!1),z(null),te(null)};async function oe(e){const n=++M.current;C(e),N(null),B(null),T(!0);try{const{classStyles:a,classPostId:s}=await i(e);if(n!==M.current)return;if(!s)return void B((0,t.sprintf)(
// translators: %s: class name
// translators: %s: class name
(0,t.__)("No styles record found for %s.","generateblocks-pro"),e));N({postId:s,allStyles:a})}catch(a){if(n!==M.current)return;B(a?.message||(0,t.sprintf)(
// translators: %s: class name
// translators: %s: class name
(0,t.__)("Failed to load styles for %s.","generateblocks-pro"),e))}finally{n===M.current&&T(!1)}}function ie(){M.current++,C(null),N(null),B(null),T(!1)}(0,s.useEffect)((()=>{0===h.current.length&&Array.isArray(m)&&(h.current=m.map((e=>e.ID)))}),[m]);const ce=(0,s.useCallback)((async function(){const e=Object.entries(F).reduce(((e,[t,n])=>(n&&e.push(parseInt(t)),e)),[]);if(0!==e.length&&Z)if("delete"!==Z){j(!0);try{switch(Z){case"publish":await async function(e){const n=[];v(!0);for(const t of e)try{"publish"===(await l()({path:`/wp/v2/gblocks_styles/${t}`,method:"PATCH",data:{status:"publish"}})).status&&n.push(t)}catch(e){console.error(`Failed to publish post ID: ${t}`,e)}G({}),X(""),v(!1),n.length>0?(b(m.map((e=>(n.includes(e.ID)&&(e.status="publish"),e)))),w((0,t.sprintf)(/* translators: %s: number of styles */ /* translators: %s: number of styles */
(0,t.__)("Published %s styles successfully","generateblocks-pro"),n.length),{type:"snackbar"})):k((0,t.__)("Bulk publish failed. Please try again","generateblocks-pro"),{type:"snackbar"})}(e);break;case"draft":await async function(e){const n=[];v(!0);for(const t of e)try{"draft"===(await l()({path:`/wp/v2/gblocks_styles/${t}`,method:"PATCH",data:{status:"draft"}})).status&&n.push(t)}catch(e){console.error(`Failed to update status for post ID: ${t}`,e)}G({}),X(""),v(!1),n.length>0&&b(m.map((e=>(n.includes(e.ID)&&(e.status="draft"),e)))),n.length>0?w((0,t.sprintf)(/* translators: %s: number of styles */ /* translators: %s: number of styles */
(0,t.__)("Drafted %s styles successfully","generateblocks-pro"),n.length),{type:"snackbar"}):k((0,t.__)("Bulk draft failed. Please try again","generateblocks-pro"),{type:"snackbar"})}(e);break;default:console.error((0,t.__)("Invalid action","generateblocks-pro"))}}finally{j(!1)}}else S(!0)}),[Z,F]),de=(0,s.useCallback)((function(e){return!!m.find((t=>{const n=ne(e);return t.style===n}))}),[m]);function ue({title:n,status:r,id:o}){const[c,u]=(0,s.useState)(!1),[p,g]=(0,s.useState)(n),[h,y]=(0,s.useState)(!1),[f,_]=(0,s.useState)(null),[v,E]=(0,s.useState)(!1),[S,x]=(0,s.useState)(null),[C,D]=(0,s.useState)(!1);return(0,e.createElement)("div",{className:"gb-styles-table__label"},c?(0,e.createElement)(e.Fragment,null,(0,e.createElement)(a.TextControl,{value:p,onChange:g}),(0,e.createElement)(a.Button,{variant:"primary",size:"compact",isBusy:h,disabled:n===p,onClick:async()=>{y(!0),E(!0),await(async()=>{D(!0);try{const e=await l()({path:`/generateblocks-pro/v1/global-classes/${o}/usage?refresh=true`});e.success&&x(e.response.data)}catch(e){console.error("Error loading usage data:",e)}finally{D(!1)}})()}},(0,t.__)("Save","generateblocks-pro")),(0,e.createElement)(a.Button,{variant:"link",onClick:()=>{u(!1),g(n)}},(0,t.__)("Cancel","generateblocks-pro")),f&&(0,e.createElement)("span",{className:"gb-styles-table__error"},f)):(0,e.createElement)(e.Fragment,null,(0,e.createElement)("span",{className:"gb-styles-table__label-text"},n,"draft"===r&&(0,e.createElement)(e.Fragment,null," ",(0,e.createElement)("span",{className:"gb-styles-table__status"},"(",(0,t.__)("Draft","generateblocks-pro"),")"))),ee&&(0,e.createElement)(a.Button,{className:"gb-styles-table__edit",size:"compact",icon:d,label:(0,t.__)("Edit","generateblocks-pro"),onClick:()=>u(!0)})),v&&(0,e.createElement)(a.Modal,{title:(0,t.__)("Confirm Rename","generateblocks-pro"),onRequestClose:()=>{E(!1),y(!1),x(null)},className:"gb-styles-table-modal gb-styles-table-modal--rename",size:"small",focusOnMount:"firstContentElement",style:{width:"500px"}},(0,e.createElement)("div",{className:"gb-styles-table-modal__content"},C&&(0,e.createElement)("p",{style:{display:"flex",alignItems:"center",gap:"8px"}},(0,e.createElement)(a.Spinner,null),(0,t.__)("Checking usage…","generateblocks-pro")),!C&&S&&S.total>0&&(0,e.createElement)("p",{style:{background:"#fff3cd",border:"1px solid #ffc107",padding:"12px",borderRadius:"4px",marginBottom:"16px"}},(0,e.createElement)("strong",null,(0,t.__)("Warning:","generateblocks-pro"))," ",S.has_more?(0,t.sprintf)(/* translators: %s: number of locations where the style is used */ /* translators: %s: number of locations where the style is used */
(0,t.__)("This style is currently being used in at least %s locations.","generateblocks-pro"),S.total):(0,t.sprintf)(/* translators: %s: number of locations where the style is used */ /* translators: %s: number of locations where the style is used */
(0,t.__)("This style is currently being used in %s locations.","generateblocks-pro"),S.total)),(0,e.createElement)("p",null,(0,t.__)("Renaming this will only change the class name itself and will NOT update places the class name is used.","generateblocks-pro")),(0,e.createElement)("p",null,(0,t.__)("Elements and blocks using this class name may lose visual styles after this change.","generateblocks-pro"))),(0,e.createElement)("div",{className:"gb-styles-table-modal__actions"},(0,e.createElement)(a.Button,{variant:"primary",onClick:async()=>{await async function({postId:e,title:n,setError:a,setIsBusy:s,prevTitle:r}){try{var o,c;if(de(n))throw new Error((0,t.__)("Class already exists","generateblocks-pro"));const s=ne(n),d=await i(r),u=null!==(o=d?.classStyles)&&void 0!==o?o:{},p=await(0,W.getCss)(s,u),g=await l()({path:`/wp/v2/gblocks_styles/${e}`,method:"POST",data:{title:s,gb_style_selector:s,gb_style_css:p}}),h=null!==(c=g?.title?.raw)&&void 0!==c?c:"";h===s&&(a(null),b(m.map((t=>(t.ID===e&&(t.style=s),t)))),w((0,t.sprintf)(
// translators: %1$s: The original class name, %2$s: The new class name
// translators: %1$s: The original class name, %2$s: The new class name
(0,t.__)("Renamed %1$s to %2$s successfully","generateblocks-pro"),r,h),{type:"snackbar"}))}catch(n){console.error(`Failed to update menu order for post ID: ${e}`,n.message),a(n.message),k((0,t.__)("Rename failed. Please try again","generateblocks-pro"),{type:"snackbar"}),s(!1)}finally{s(!1)}}({postId:o,title:p,setError:_,setIsBusy:y,prevTitle:n}),E(!1),x(null)}},(0,t.__)("I'm sure","generateblocks-pro")))))}const pe=(0,s.useMemo)((()=>{let n=[];return ee&&(n=[{id:"checkbox",header:({table:n})=>(0,e.createElement)(Y.Table.HeaderRowCheckbox,{table:n,disabled:y,label:n.getIsAllRowsSelected()?(0,t.__)("Deselect all","generateblocks-pro"):(0,t.__)("Select all","generateblocks-pro")}),cell:({row:t})=>(0,e.createElement)(Y.Table.RowCheckbox,{disabled:y,row:t,onClick:e=>function(e,t){if(e.target.closest("tbody .gb-checkbox__input")&&t){const n=[t],a=e.shiftKey,s=e.target.checked;if(a&&null!==U){const e=[...m.map((e=>parseInt(e.ID))),t],a=Math.min(e.indexOf(U),e.indexOf(t)),s=Math.max(e.indexOf(U),e.indexOf(t));for(let t=a;t<=s;t++)n.push(e[t])}G((e=>({...e,...n.reduce(((e,t)=>(e[t]=s,e)),{})}))),s&&q(t)}}(e,t.id)}),colspan:2},{id:"dragHandle",header:null,cell:({row:t})=>(0,e.createElement)(Y.Table.RowHandle,{row:t,disabled:H>0})}]),[...n,{id:"style",header:null,cell:n=>{const s=n.row.original.status;return(0,e.createElement)("div",{className:`gb-styles-table__content gb-styles-table__content--${s}`},(0,e.createElement)(ue,{id:n.row.id,status:s,title:n.getValue()}),(0,e.createElement)(a.DropdownMenu,{icon:u,label:(0,t.__)("More options","generateblocks-pro"),className:"gb-styles-table__dropdown"},(({onClose:r})=>(0,e.createElement)(e.Fragment,null,(0,e.createElement)(a.MenuGroup,null,(0,e.createElement)(a.MenuItem,{onClick:()=>{O(!0),$({id:n.row.id,title:n.getValue()}),r()}},(0,t.__)("Check Usage","generateblocks-pro"))),ee&&(0,e.createElement)(a.MenuGroup,null,(0,e.createElement)(a.MenuItem,{onClick:()=>{oe(n.getValue()),r()}},(0,t.__)("Edit CSS","generateblocks-pro"))),ee&&(0,e.createElement)(a.MenuGroup,null,(0,e.createElement)(a.MenuItem,{onClick:()=>{!function(e){v(!0);const n=e.row.original.status,a="publish"===n?"draft":"publish";l()({path:`/wp/v2/gblocks_styles/${e.row.id}`,method:"PATCH",data:{status:a}}).then((()=>{w((0,t.sprintf)(
// translators: %1$s: style name, %2$s: new status
// translators: %1$s: style name, %2$s: new status
(0,t.__)('Class "%1$s" status updated to %2$s successfully',"generateblocks-pro"),e.getValue(),a),{type:"snackbar"}),b(m.map((t=>(t.ID===e.row.id&&(t.status=a),t)))),v(!1)})).catch((a=>{k((0,t.sprintf)(
// translators: %1$s: style name, %2$s: the old status
// translators: %1$s: style name, %2$s: the old status
(0,t.__)('Failed to update style "%1$s" status, reverting to %2$s',"generateblocks-pro"),e.getValue(),n),{type:"snackbar"}),console.error(a.message),v(!1)}))}(n),r()}},"publish"===s?(0,t.__)("Set as Draft","generateblocks-pro"):(0,t.__)("Publish","generateblocks-pro")),(0,e.createElement)(a.MenuItem,{isDestructive:!0,onClick:()=>{var e;e=n,S(!0),z(e),e&&e.row&&(async e=>{re(!0);try{const t=await l()({path:`/generateblocks-pro/v1/global-classes/${e}/usage`});t.success&&te(t.response.data)}catch(e){console.error("Error loading delete usage data:",e)}finally{re(!1)}})(e.row.id),r()}},(0,t.__)("Delete Style","generateblocks-pro")))))))},accessorKey:"style"}]}),[m,v,A,F,H,y]);(0,s.useEffect)((()=>{b(n)}),[n]);const ge=null===P&&H>0&&"delete"===Z;return(0,e.createElement)(e.Fragment,null,(Array.isArray(m)||ee)&&(0,e.createElement)("div",{className:"gb-styles-table-header"},ee&&(0,e.createElement)("div",{className:"gb-styles-table-controls"},(0,e.createElement)(a.SelectControl,{label:(0,t.__)("Bulk Actions","generateblocks-pro"),hideLabelFromVision:!0,value:Z,options:[{label:(0,t.__)("Bulk Actions","generateblocks-pro"),value:""},{label:(0,t.__)("Publish","generateblocks-pro"),value:"publish"},{label:(0,t.__)("Draft","generateblocks-pro"),value:"draft"},{label:(0,t.__)("Delete","generateblocks-pro"),value:"delete"}],labelPosition:"side",onChange:e=>{X(e)},disabled:y}),(0,e.createElement)(a.Button,{disabled:0===H||V,variant:"primary",onClick:ce,isBusy:V},(0,t.__)("Apply","generateblocks-pro")),y&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(a.Button,{className:"gb-styles-table-controls__save-order",variant:"primary",isBusy:_,onClick:()=>{!async function(e){v(!0);const n=e.map((e=>e.ID));c(n),b(m.sort(((e,t)=>n.indexOf(e.ID)-n.indexOf(t.ID))));try{await l()({path:"/generateblocks-pro/v1/global-styles/update_menu_order",method:"POST",data:{order:n}}),f(!1),v(!1),h.current=n,w((0,t.__)("Styles order updated","generateblocks-pro"),{type:"snackbar"})}catch(e){f(!0),console.error(e.message,e),k(e.message,{type:"snackbar"})}}(m)}},(0,t.__)("Save Order","generateblocks-pro")),(0,e.createElement)(a.Button,{className:"gb-styles-table-controls__reset-order",variant:"link",onClick:()=>{b(n),f(!1)}},(0,t.__)("Reset","generateblocks-pro")))),Array.isArray(m)&&(0,e.createElement)("div",{className:"gb-styles-table-counts"},(0,e.createElement)("span",{className:"gb-styles-table-counts__count"},(0,t.sprintf)(/* translators: %s: number of styles */ /* translators: %s: number of styles */
(0,t.__)("%s Published","generateblocks-pro"),m.filter((e=>"publish"===e.status)).length)),"|",(0,e.createElement)("span",{className:"gb-styles-table-counts__count"},(0,t.sprintf)(/* translators: %s: number of styles */ /* translators: %s: number of styles */
(0,t.__)("%s Draft","generateblocks-pro"),m.filter((e=>"draft"===e.status)).length)))),(0,e.createElement)("div",{className:K()("gb-styles-table-wrapper",o&&"is-loading")},(0,e.createElement)(e.Fragment,null,(_||o)&&(0,e.createElement)("div",{className:"gb-styles-table-wrapper__overlay"},(0,e.createElement)(a.Spinner,null)),(0,e.createElement)(Y.Table,{"aria-labelledby":r,className:K()("gb-styles-table",!ee&&"gb-styles-table--readonly"),getRowId:e=>e.ID,columns:pe,data:m,draggableRows:ee,onDragEnd:function(e){var t;const{active:n,over:a}=e,s=null!==(t=a?.data?.current?.disabled)&&void 0!==t&&t;if(n.id!==a.id&&!s){const e=m.findIndex((e=>e.ID===n.id)),t=m.findIndex((e=>e.ID===a.id)),s=function(e,t,n){const a=e.slice();return a.splice(n<0?a.length+n:n,0,a.splice(t,1)[0]),a}(m,e,t),r=s.map((e=>e.ID)),l=h.current.join(",")!==r.join(",");b(s),f(l)}},enableRowSelection:!0,rowSelection:F,onRowSelectionChange:G,showHeader:ee})),0===m.length&&!o&&(0,e.createElement)("p",{style:{marginTop:0,padding:"30px"}},(0,t.__)("No Global Styles found. These can be created in the editor while building your content.","generateblocks-pro")),x&&R&&(0,e.createElement)(a.Modal,{title:(0,t.__)("Edit CSS","generateblocks-pro"),onRequestClose:ie,className:"gb-styles-table-modal",size:"small"},(0,e.createElement)("p",null,R),(0,e.createElement)("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end"}},(0,e.createElement)(a.Button,{variant:"tertiary",onClick:ie},(0,t.__)("Cancel","generateblocks-pro")),(0,e.createElement)(a.Button,{variant:"primary",onClick:()=>oe(x)},(0,t.__)("Retry","generateblocks-pro")))),x&&!R&&I&&(0,e.createElement)(a.Modal,{title:(0,t.__)("Edit CSS","generateblocks-pro"),onRequestClose:ie,className:"gb-styles-table-modal",size:"small"},(0,e.createElement)("div",{style:{display:"flex",justifyContent:"center",padding:"24px"}},(0,e.createElement)(a.Spinner,null))),x&&!R&&!I&&D?.postId&&(0,e.createElement)(W.CssEditor,{allStyles:D.allStyles,selector:x,onApply:async function(e){if(!ee||!x||!D?.postId)return;const n=x,{postId:a}=D;try{await ae({selector:n,postId:a,styles:e})}catch(e){throw new Error((0,t.sprintf)(
// translators: %s: class name
// translators: %s: class name
(0,t.__)("Failed to save styles for %s.","generateblocks-pro"),n),{cause:e})}w((0,t.sprintf)(
// translators: %s: class name
// translators: %s: class name
(0,t.__)("%s updated successfully","generateblocks-pro"),n),{type:"snackbar"})},onClose:ie}),A&&L&&(0,e.createElement)(Q,{style:L,onClose:()=>{O(!1),$(null)}}),E&&(0,e.createElement)(a.Modal,{title:(0,t.__)("Confirm Delete","generateblocks-pro"),onRequestClose:le,className:"gb-styles-table-modal",size:"small",focusOnMount:"firstContentElement"},(0,e.createElement)("div",{className:"gb-styles-table-modal__content"},se&&!ge&&(0,e.createElement)("p",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"16px"}},(0,e.createElement)(a.Spinner,null),(0,t.__)("Checking usage…","generateblocks-pro")),!se&&!ge&&J&&J.total>0&&(0,e.createElement)("div",{style:{background:"#fee",border:"1px solid #dc3232",padding:"12px",borderRadius:"4px",marginBottom:"16px"}},(0,e.createElement)("p",{style:{margin:"0 0 8px 0"}},(0,e.createElement)("strong",null,(0,t.__)("Warning:","generateblocks-pro"))," ",J.has_more?(0,t.sprintf)(/* translators: %s: number of locations where the style is used */ /* translators: %s: number of locations where the style is used */
(0,t.__)("This style is currently being used in at least %s locations:","generateblocks-pro"),J.total):(0,t.sprintf)(/* translators: %s: number of locations where the style is used */ /* translators: %s: number of locations where the style is used */
(0,t.__)("This style is currently being used in %s locations:","generateblocks-pro"),J.total)),Object.entries(J.usage).slice(0,2).map((([n,a])=>(0,e.createElement)("div",{key:n,style:{marginTop:"8px"}},(0,e.createElement)("strong",null,a.label,":"),(0,e.createElement)("ul",{style:{margin:"4px 0 0 20px",padding:0}},a.items.slice(0,3).map((t=>(0,e.createElement)("li",{key:t.id},t.title))),a.items.length>3&&(0,e.createElement)("li",null,(0,t.sprintf)(/* translators: %s: number of additional items */ /* translators: %s: number of additional items */
(0,t.__)("…and %s more","generateblocks-pro"),a.items.length-3))))))),(0,e.createElement)("p",null,ge?(0,t.sprintf)(/* translators: %s is the number of styles the user is choosing to delete */ /* translators: %s is the number of styles the user is choosing to delete */
(0,t.__)("Are you sure you want to delete %s styles?","generateblocks-pro"),H):(0,t.sprintf)(/* translators: %s is the style the user is choosing to delete */ /* translators: %s is the style the user is choosing to delete */
(0,t.__)("Are you sure you want to delete %s?","generateblocks-pro"),`"${P.getValue()}"`)),(0,e.createElement)("p",null,(0,e.createElement)("strong",null,(0,t.__)("This cannot be undone","generateblocks-pro")),".")),(0,e.createElement)("div",{className:"gb-styles-table-modal__actions"},(0,e.createElement)(a.Button,{variant:"primary",isDestructive:!0,onClick:async()=>{try{if(ge){const e=Object.entries(F).filter((([,e])=>e)).map((([e])=>parseInt(e)));j(!0);try{await async function(e){const n=[];v(!0);for(const t of e)try{(await l()({path:`/wp/v2/gblocks_styles/${t}?force=true`,method:"DELETE"})).deleted&&n.push(t)}catch(e){console.error(`Failed to delete style, ID: ${t}`,e)}G({}),X(""),v(!1),n.length>0?(b(m.filter((e=>!n.includes(e.ID)))),w((0,t.sprintf)(/* translators: %s: number of styles */ /* translators: %s: number of styles */
(0,t.__)("Deleted %s styles successfully","generateblocks-pro"),n.length),{type:"snackbar"})):k((0,t.__)("Bulk delete failed. Please try again","generateblocks-pro"),{type:"snackbar"})}(e)}finally{j(!1)}}else P&&await async function(e){v(!0);try{await l()({path:`/wp/v2/gblocks_styles/${e.row.id}?force=true`,method:"DELETE"}),w((0,t.sprintf)(
// translators: %s: style name
// translators: %s: style name
(0,t.__)('Style "%s" deleted successfully',"generateblocks-pro"),e.getValue()),{type:"snackbar"}),b(m.filter((t=>t.ID!==e.row.id)))}catch(n){k((0,t.sprintf)(
// translators: %s: style name
// translators: %s: style name
(0,t.__)("Failed to delete style %s","generateblocks-pro"),e.getValue()),{type:"snackbar"}),console.error(n.message)}finally{v(!1)}}(P)}finally{le()}}},(0,t.__)("I'm sure","generateblocks-pro"))))))}function re({children:t}){return(0,e.createElement)("div",{className:"gblocks-settings-wrapper"},t)}window.wp.coreData,new Map;function le(){const n=(0,g.useSelect)((e=>e("core/notices").getNotices().filter((e=>"snackbar"===e.type))),[]),{removeNotice:r}=(0,g.useDispatch)("core/notices"),[i,c]=(0,s.useState)(!0),[d,u]=(0,s.useState)([]),[p,m]=(0,s.useState)((async()=>{const e=await async function(e="publish"){var t;const{success:n,response:a}=await l()({path:(0,o.addQueryArgs)("/generateblocks-pro/v1/global-classes/get",{status:e}),method:"GET"}),{data:s={}}=a;if(!n)throw new Error(s?.message);return null!==(t=s?.styles)&&void 0!==t?t:[]}(["publish","draft"]);Array.isArray(e)&&(d?m(e.sort(((e,t)=>d.indexOf(e.ID)-d.indexOf(t.ID)))):(m(e),u(e.map((e=>e.ID)))))})),b=Number(generateBlocksPro.legacyGlobalStylesCount?.publish)+Number(generateBlocksPro.legacyGlobalStylesCount?.draft)+Number(generateBlocksPro.legacyGlobalStylesCount?.trash),h="global-styles-title";return y=()=>{c(!1)},f=[p],v=(_=(0,e.useRef)(!0)).current?(_.current=!1,!0):_.current,(0,e.useEffect)((function(){if(!v)return y()}),f),(0,e.createElement)(e.Fragment,null,(0,e.createElement)(re,null,(0,e.createElement)("header",{className:"gblocks-settings-wrapper__header"},(0,e.createElement)("div",{style:{flexGrow:1}},!!b&&(0,e.createElement)(a.Notice,{isDismissible:!1,status:"info",className:"gblocks-has-legacy-global-styles"},(0,e.createElement)("p",{style:{marginTop:0}},(0,t.__)("You have legacy Global Styles on this website. You can manage them by clicking the button below.","generateblocks-pro")),(0,e.createElement)(a.Button,{href:generateBlocksPro.legacyGlobalStylesUrl,label:(0,t.__)("Go to Legacy Global Styles","generateblocks-pro"),showTooltip:!0,variant:"secondary"},(0,t.sprintf)(
// Translators: Number of legacy global styles.
// Translators: Number of legacy global styles.
(0,t.__)("Legacy Global Styles (%s)","generateblocks-pro"),b))),(0,e.createElement)("h1",{id:h},(0,t.__)("All Global Styles","generateblocks-pro")),(0,e.createElement)("p",{style:{marginTop:0,marginBottom:0}},(0,t.__)("View a list of all your global styles below. Styles will output their CSS in the order they appear in this list. Style specificity applies from top to bottom.","generateblocks-pro")," ",(0,e.createElement)("a",{href:"https://docs.generateblocks.com/article/global-styles-overview/",rel:"noopener noreferrer",target:"_blank"},(0,t.__)("Learn more about Global Styles.","generateblocks-pro"))))),(0,e.createElement)(se,{globalStyles:p,"aria-labelledby":h,isLoading:i,setStylesOrder:u})),(0,e.createElement)(a.SnackbarList,{notices:n,onRemove:r}));var y,f,_,v}window.addEventListener("DOMContentLoaded",(()=>{var t,n;t=(0,e.createElement)(le,null),n=document.getElementById("gblocks-global-classes"),void 0!==s.createRoot?(0,s.createRoot)(n).render(t):(0,s.render)(t,n)}))})()})();