PATH:
home
/
lab2454c
/
argowells.com
/
wp-content
/
plugins
/
elementor
/
assets
/
js
/
packages
/
editor-global-classes
!function(){"use strict";var e={d:function(t,n){for(var a in n)e.o(n,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:n[a]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{GLOBAL_CLASSES_URI:function(){return K},init:function(){return Ut}});var n=window.elementorV2.editorMcp,a=window.elementorV2.editorStyles,r=window.elementorV2.editorStylesRepository,s=window.elementorV2.store,l=window.wp.i18n,o=window.elementorV2.editorV1Adapters;const i="elementor_global_classes_update_class";var c=window.elementorV2.utils;const d=(0,c.createError)({code:"global_class_not_found",message:"Global class not found."}),u=(0,c.createError)({code:"global_class_label_already_exists",message:"Class with this name already exists."}),m=(0,c.createError)({code:"global_class_tracking_error",message:"Error tracking global classes event."});function p({value:e,next:t,prev:n}){return{value:e,prev:n||null,next:t||null}}class g{static registry={};static get(e){return g.registry[e]||(g.registry[e]=new g(e)),g.registry[e]}first=null;current=null;constructor(e){this.namespace=e}transform(e){return JSON.parse(JSON.stringify(e))}reset(){this.first=this.current=null}prev(){return this.current&&this.current!==this.first?(this.current=this.current.prev,this.current?.value||null):null}isLast(){return!this.current||!this.current.next}next(e){if(e){if(!this.current)return this.first=p({value:this.transform(e)}),this.current=this.first,this.current.value;const t=p({value:this.transform(e),prev:this.current});return this.current.next=t,this.current=t,this.current.value}return this.current&&this.current.next?(this.current=this.current.next,this.current.value):null}}const h=g.get("global-classes"),y="globalClasses",f=(0,s.__createSlice)({name:y,initialState:{data:{items:{},order:[]},initialData:{frontend:{items:{},order:[]},preview:{items:{},order:[]}},isDirty:!1},reducers:{load(e,{payload:{frontend:t,preview:n}}){e.initialData.frontend=t,e.initialData.preview=n,e.data=n,e.isDirty=!1},add(e,{payload:t}){h.next(e.data),e.data.items[t.id]=t,e.data.order.unshift(t.id),e.isDirty=!0},delete(e,{payload:t}){h.next(e.data),e.data.items=Object.fromEntries(Object.entries(e.data.items).filter(([e])=>e!==t)),e.data.order=e.data.order.filter(e=>e!==t),e.isDirty=!0},setOrder(e,{payload:t}){h.next(e.data),e.data.order=t,e.isDirty=!0},update(e,{payload:t}){h.next(e.data);const n={...e.data.items[t.style.id],...t.style};e.data.items[t.style.id]=n,e.isDirty=!0},updateMultiple(e,{payload:t}){h.next(e.data),Object.entries(t).forEach(([t,{modified:n}])=>{e.data.items[t].label=n}),e.isDirty=!1},updateProps(e,{payload:t}){const n=e.data.items[t.id];if(!n)throw new d({context:{styleId:t.id}});h.next(e.data);const r=(0,a.getVariantByMeta)(n,t.meta);let s=("custom_css"in t?t.custom_css:r?.custom_css)??null;if(s=s?.raw?s:null,r){const e=JSON.parse(JSON.stringify(r.props)),a=JSON.parse(JSON.stringify(t.props));r.props=b(e,a),r.custom_css=s,n.variants=v(n)}else n.variants.push({meta:t.meta,props:t.props,custom_css:s});e.isDirty=!0},reset(e,{payload:{context:t}}){"frontend"===t&&(h.reset(),e.initialData.frontend=e.data,e.isDirty=!1),e.initialData.preview=e.data},undo(e){h.isLast()&&h.next(e.data);const t=h.prev();t?(e.data=t,e.isDirty=!0):e.data=e.initialData.preview},resetToInitialState(e,{payload:{context:t}}){h.reset(),e.data=e.initialData[t],e.isDirty=!1},redo(e){const t=h.next();h.isLast()&&h.prev(),t&&(e.data=t,e.isDirty=!0)}}}),b=(e,t)=>{const n=Array.isArray(e)?{}:e;return Object.entries(t).forEach(([e,t])=>{null==t?delete n[e]:n[e]=t}),n},v=e=>e.variants.filter(({props:e,custom_css:t})=>Object.keys(e).length||t?.raw),E=e=>e[y].data,w=e=>e[y].initialData.frontend,_=e=>e[y].initialData.preview,x=(0,s.__createSelector)(E,({order:e})=>e),C=(0,s.__createSelector)(E,({items:e})=>e),S=e=>e[y].isDirty,I=(0,s.__createSelector)(C,x,(e,t)=>t.map(t=>e[t])),D=(e,t)=>e[y].data.items[t]??null,T=(0,s.__createSelector)(E,({items:e})=>Object.values(e).filter(e=>0===e.variants.length));var P=window.elementorV2.mixpanel,k=window.elementorV2.httpClient;const O="/global-classes",A="elementor/v1",M=`${O}/usage`,z={usage:()=>(0,k.httpService)().get(`${A}${M}`),all:(e="preview")=>(0,k.httpService)().get(`${A}${O}`,{params:{context:e}}),publish:e=>(0,k.httpService)().put("elementor/v1"+O,e,{params:{context:"frontend"}}),saveDraft:e=>(0,k.httpService)().put("elementor/v1"+O,e,{params:{context:"preview"}})},L={DUPLICATED_LABEL:"DUPLICATED_LABEL"},j=async()=>{const e=await z.usage();return t=e?.data?.data||{},Object.entries(t).reduce((e,[t,n])=>(e[t]={content:n||[],total:n.reduce((e,t)=>e+(t?.total||0),0)},e),{});var t},B=async e=>{const{runAction:t}=e,n=await F(e);n&&(W(n),"classCreated"===n.event&&"classId"in n&&V(n.classId)),t?.()},V=async e=>{const t=await N(e);W({event:"classApplied",classId:e,...t,totalInstancesAfterApply:1})},F=async e=>{switch(e.event){case"classApplied":if("classId"in e&&e.classId){const t=await N(e.classId);return{...e,...t}}break;case"classRemoved":if("classId"in e&&e.classId){const t=q(e.classId);return{...e,...t}}break;case"classDeleted":if("classId"in e&&e.classId){const t=await $(e.classId);return{...e,...t}}break;case"classCreated":return"source"in e&&"created"!==e.source&&"classId"in e&&e.classId?{...e,classTitle:U(e.classId).label}:e;case"classStateClicked":if("classId"in e&&e.classId)return{...e,classTitle:U(e.classId).label};break;default:return e}},W=e=>{const{dispatchEvent:t,config:n}=(0,P.getMixpanel)();if(!n?.names?.global_classes?.[e.event])return void console.error("Global class tracking event not found",{event:e.event});const a=n.names.global_classes[e.event],{event:r,...s}=e;try{t?.(a,{event:r,...s})}catch(e){throw new m({cause:e})}},R=e=>({classTitle:U(e).label}),U=e=>{const t=D((0,s.__getState)(),e);if(!t)throw new Error(`CSS class with ID ${e} not found`);return t},$=async e=>({totalInstances:await G(e),classTitle:U(e).label}),G=async e=>{const t=await j();return t[e]?.total??1},N=async e=>{const{classTitle:t}=R(e);return{classTitle:t,totalInstancesAfterApply:await G(e)+1}},q=e=>{const{classTitle:t}=R(e);return{classTitle:t}},H="global-classes",Y=(0,r.createStylesProvider)({key:H,priority:30,limit:100,labels:{singular:(0,l.__)("class","elementor"),plural:(0,l.__)("classes","elementor")},subscribe:e=>J(e),capabilities:(()=>{if((0,o.isExperimentActive)("global_classes_should_enforce_capabilities"))return{update:i,create:i,delete:i,updateProps:i}})(),actions:{all:()=>{const e=I((0,s.__getState)());return localStorage.setItem("elementor-global-classes",JSON.stringify(e)),e},get:e=>D((0,s.__getState)(),e),resolveCssName:e=>D((0,s.__getState)(),e)?.label??e,create:(e,t=[])=>{const n=C((0,s.__getState)());if(Object.values(n).map(e=>e.label).includes(e))throw new u({context:{label:e}});const r=Object.keys(n),l=(0,a.generateId)("g-",r);return(0,s.__dispatch)(f.actions.add({id:l,type:"class",label:e,variants:t})),l},update:e=>{(0,s.__dispatch)(f.actions.update({style:e}))},delete:e=>{(0,s.__dispatch)(f.actions.delete(e))},updateProps:e=>{(0,s.__dispatch)(f.actions.updateProps({id:e.id,meta:e.meta,props:e.props}))},updateCustomCss:e=>{(0,s.__dispatch)(f.actions.updateProps({id:e.id,meta:e.meta,custom_css:e.custom_css,props:{}}))},tracking:e=>{B(e).catch(e=>{throw new m({cause:e})})}}}),J=e=>{let t=E((0,s.__getState)());return(0,s.__subscribeWithSelector)(e=>e.globalClasses,n=>{e(t.items,n.data.items),t=n.data})},K="elementor://global-classes";var Q=window.elementorV2.editor,X=window.elementorV2.editorEditingPanel,Z=window.elementorV2.editorPanels,ee=window.React,te=window.elementorV2.editorDocuments,ne=window.elementorV2.editorUi,ae=window.elementorV2.ui,re=window.elementorV2.query;const se="css-classes-usage";function le(){const e=(0,re.useQueryClient)();return{prefetchClassesUsage:()=>e.prefetchQuery({queryKey:[se],queryFn:j})}}const oe=()=>{const{prefetchClassesUsage:e}=le();return e(),null};var ie=window.elementorV2.icons;const ce=()=>(0,s.__useSelector)(x),de=()=>(0,s.__useSelector)(S),ue=(0,ee.createContext)(void 0),me={empty:!1,onThisPage:!1,unused:!1},pe=({children:e})=>{const[t,n]=ee.useState(me),{debouncedValue:a,inputValue:r,handleChange:s}=(0,c.useDebounceState)({delay:300,initialValue:(()=>{const e=localStorage.getItem("elementor-global-classes-search");return e?(localStorage.removeItem("elementor-global-classes-search"),e):""})()});return ee.createElement(ue.Provider,{value:{search:{debouncedValue:a,inputValue:r,handleChange:s,onClearSearch:()=>{s("")}},filters:{filters:t,setFilters:n,onClearFilter:()=>{n(me)}}}},e)},ge=()=>{const e=(0,ee.useContext)(ue);if(!e)throw new Error("useSearchContext must be used within a SearchContextProvider");return e},he=()=>(0,re.useQuery)({queryKey:[se],queryFn:j,refetchOnMount:!1,refetchOnWindowFocus:!0}),ye={empty:[],onThisPage:[],unused:[]},fe=()=>{const e=(0,te.__useActiveDocument)(),t=(0,s.__useSelector)(T),{data:n,isLoading:a}=he(),r=(()=>{const e=(0,s.__useSelector)(C);return Object.keys(e)})(),l=(0,ee.useMemo)(()=>t.map(({id:e})=>e),[t]),o=(0,ee.useMemo)(()=>n&&e?((e,t)=>{const n=[];for(const a in e)e[a].content.forEach(e=>{+e.pageId===t&&n.push(a)});return n})(n,e.id):[],[n,e]),i=(0,ee.useMemo)(()=>n?((e,t)=>{const n=new Set(e);return t.filter(e=>!n.has(e))})(Object.keys(n),r):[],[n,r]);return!a&&n&&e?{onThisPage:o,unused:i,empty:l}:ye},be=()=>{const{filters:{filters:e}}=ge(),t=fe();return(0,ee.useMemo)(()=>{const n=Object.entries(e).filter(([,e])=>e);return 0===n.length?null:n.reduce((e,[n],a)=>{const r=t[n]||[];return 0===a?r:e.filter(e=>r.includes(e))},[])},[e,t])},ve="DUP_",Ee=({modifiedLabels:e,onApprove:t})=>ee.createElement(ee.Fragment,null,ee.createElement(ae.DialogHeader,{logo:!1},ee.createElement(ae.Box,{display:"flex",alignItems:"center",gap:1},ee.createElement(ae.Icon,{color:"secondary"},ee.createElement(ie.InfoCircleFilledIcon,{fontSize:"medium"})),ee.createElement(ae.Typography,{variant:"subtitle1"},(0,l.__)("We've published your page and updated class names.","elementor")))),ee.createElement(ae.DialogContent,null,ee.createElement(ae.Stack,{spacing:2,direction:"column"},ee.createElement(ae.Typography,{variant:"body2"},(0,l.__)("Some new classes used the same names as existing ones. To prevent conflicts, we added the prefix","elementor"),ee.createElement("strong",null," ",ve)),ee.createElement(ae.Box,null,ee.createElement(ae.Box,{sx:{width:"100%",display:"flex",gap:2,alignItems:"flex-start"}},ee.createElement(ae.Typography,{variant:"subtitle2",sx:{fontWeight:"bold",flex:1,flexShrink:1,flexGrow:1,minWidth:0}},(0,l.__)("Before","elementor")),ee.createElement(ae.Typography,{variant:"subtitle2",sx:{minWidth:"200px",fontWeight:"bold",flexShrink:0,flexGrow:0,width:"200px",maxWidth:"200px"}},(0,l.__)("After","elementor"))),ee.createElement(ae.Divider,{sx:{mt:.5,mb:.5}}),ee.createElement(ae.Stack,{direction:"column",gap:.5,sx:{pb:2}},Object.values(e).map(({original:e,modified:t},n)=>ee.createElement(ae.Box,{key:n,sx:{width:"100%",display:"flex",gap:2,alignItems:"flex-start"}},ee.createElement(ae.Box,{sx:{flex:1,flexShrink:1,flexGrow:1,minWidth:0}},ee.createElement(ne.EllipsisWithTooltip,{title:e},ee.createElement(ae.Typography,{variant:"body2",sx:{color:"text.secondary"}},e))),ee.createElement(ae.Box,{sx:{minWidth:"200px",flexShrink:0,flexGrow:0,width:"200px",maxWidth:"200px"}},ee.createElement(ne.EllipsisWithTooltip,{title:t},ee.createElement(ae.Typography,{variant:"body2",sx:{color:"text.primary"}},t)))))),ee.createElement(ae.Box,null,ee.createElement(ae.Alert,{severity:"info",size:"small",color:"secondary"},ee.createElement("strong",null,(0,l.__)("Your designs and classes are safe.","elementor")),(0,l.__)("Only the prefixes were added. Find them in Class Manager by searching","elementor"),ee.createElement("strong",null,ve)))))),ee.createElement(ae.DialogActions,null,ee.createElement(ae.Button,{color:"secondary",variant:"text",onClick:()=>{localStorage.setItem("elementor-global-classes-search",ve),t?.(),(0,ne.closeDialog)()}},(0,l.__)("Go to Class Manager","elementor")),ee.createElement(ae.Button,{color:"secondary",variant:"contained",onClick:ne.closeDialog},(0,l.__)("Done","elementor"))));async function we({context:e,onApprove:t}){const n=E((0,s.__getState)()),a="preview"===e?z.saveDraft:z.publish,r="preview"===e?_:w,l=await a({items:n.items,order:n.order,changes:_e(n,r((0,s.__getState)()))});(0,s.__dispatch)(f.actions.reset({context:e})),l?.data?.data?.code===L.DUPLICATED_LABEL&&((0,s.__dispatch)(f.actions.updateMultiple(l.data.data.modifiedLabels)),B({event:"classPublishConflict",numOfConflicts:Object.keys(l.data.data.modifiedLabels).length}),(0,ne.openDialog)({component:ee.createElement(Ee,{modifiedLabels:l.data.data.modifiedLabels||[],onApprove:t})}))}function _e(e,t){const n=Object.keys(e.items),a=Object.keys(t.items);return{added:n.filter(e=>!a.includes(e)),deleted:a.filter(e=>!n.includes(e)),modified:n.filter(n=>n in t.items&&(0,c.hash)(e.items[n])!==(0,c.hash)(t.items[n]))}}const xe=({tooltipText:e,sx:t,trigger:n})=>{const{filters:{onClearFilter:a}}=ge();return ee.createElement(ae.Tooltip,{title:e,placement:"top",disableInteractive:!0},ee.createElement(ae.Box,null,ee.createElement(Ce,{"aria-label":e,size:"tiny",onClick:()=>{a(n),B({event:"classManagerFilterCleared",trigger:n})},sx:t},ee.createElement(ie.BrushBigIcon,{fontSize:"tiny"}))))},Ce=(0,ae.styled)(ae.IconButton)(({theme:e})=>({"&.Mui-disabled":{pointerEvents:"auto","&:hover":{color:e.palette.action.disabled}}})),Se={unused:(0,l.__)("Unused","elementor"),empty:(0,l.__)("Empty","elementor"),onThisPage:(0,l.__)("On this page","elementor")},Ie=()=>{const{filters:{filters:e,setFilters:t}}=ge(),n=fe(),a=n=>{t(e=>({...e,[n]:!e[n]})),B({event:"classManagerFilterUsed",action:e[n]?"remove":"apply",type:n,trigger:"menu"})};return ee.createElement(ae.MenuList,null,ee.createElement(ae.MenuItem,{onClick:()=>a("unused")},ee.createElement(De,{label:Se.unused,checked:e.unused,suffix:ee.createElement(ae.Chip,{size:"tiny",sx:{ml:"auto"},label:n.unused.length})})),ee.createElement(ae.MenuItem,{onClick:()=>a("empty")},ee.createElement(De,{label:Se.empty,checked:e.empty,suffix:ee.createElement(ae.Chip,{size:"tiny",sx:{ml:"auto"},label:n.empty.length})})),ee.createElement(ae.MenuItem,{onClick:()=>a("onThisPage")},ee.createElement(De,{label:Se.onThisPage,checked:e.onThisPage,suffix:ee.createElement(ae.Chip,{size:"tiny",sx:{ml:"auto"},label:n.onThisPage.length})})))},De=({label:e,suffix:t,checked:n})=>ee.createElement(ae.Stack,{direction:"row",alignItems:"center",gap:.5,flex:1},ee.createElement(ae.Checkbox,{size:"small",checked:n,sx:{padding:0,color:"text.tertiary","&.Mui-checked":{color:"text.tertiary"}}}),ee.createElement(ae.Typography,{variant:"caption",sx:{color:"text.secondary"}},e),t),Te=()=>{const{filters:{filters:e,setFilters:t}}=ge(),n=Object.keys(e).filter(t=>e[t]),a=n.length>0;return ee.createElement(ae.Stack,{direction:"row",alignItems:"center",justifyContent:"space-between"},ee.createElement(ae.Stack,{direction:"row",gap:.5,alignItems:"center",flexWrap:"wrap"},n.map(e=>ee.createElement(ae.Chip,{key:e,label:Se[e],onDelete:()=>(e=>{t(t=>({...t,[e]:!1})),B({event:"classManagerFilterUsed",action:"remove",type:e,trigger:"header"})})(e),sx:Pe,size:"tiny"}))),a&&ee.createElement(xe,{trigger:"header",tooltipText:(0,l.__)("Clear Filters","elementor"),sx:{margin:"0 0 auto auto"}}))},Pe={"& .MuiChip-deleteIcon":{display:"none",transition:"opacity 0.2s"},"&:hover .MuiChip-deleteIcon":{display:"block"}};function ke(){return ke=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},ke.apply(null,arguments)}const Oe=()=>{const{filters:{filters:e}}=ge(),t=(0,ae.usePopupState)({variant:"popover",disableAutoFocus:!0});ee.useEffect(()=>{t.isOpen&&B({event:"classManagerFiltersOpened"})},[t.isOpen]);const n=Object.values(e).some(e=>e);return ee.createElement(ee.Fragment,null,ee.createElement(ae.Tooltip,{title:(0,l.__)("Filters","elementor"),placement:"top"},ee.createElement(ae.ToggleButton,ke({value:"filter",size:"tiny",selected:t.isOpen},(0,ae.bindToggle)(t)),ee.createElement(ie.FilterIcon,{fontSize:"tiny"}))),ee.createElement(ae.Popover,ke({sx:{maxWidth:"344px"},anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:-21}},(0,ae.bindPopover)(t)),ee.createElement(ne.PopoverHeader,{actions:n?[ee.createElement(xe,{trigger:"menu",key:"clear-all-button",tooltipText:(0,l.__)("Clear all","elementor")})]:[],onClose:t.close,title:(0,l.__)("Filters","elementor"),icon:ee.createElement(ie.FilterIcon,{fontSize:"tiny"})}),ee.createElement(ae.Divider,{sx:{borderWidth:"1px 0 0 0"}}),ee.createElement(ne.PopoverBody,{width:344,height:125},ee.createElement(Ie,null))))},Ae=()=>{const{search:{inputValue:e,handleChange:t}}=ge();return ee.createElement(ae.Stack,{direction:"row",gap:.5,sx:{width:"100%"}},ee.createElement(ae.Box,{sx:{flexGrow:1}},ee.createElement(ae.TextField,{role:"search",fullWidth:!0,size:"tiny",value:e,onFocus:()=>{B({event:"classManagerSearched"})},placeholder:(0,l.__)("Search","elementor"),onChange:e=>t(e.target.value),InputProps:{startAdornment:ee.createElement(ae.InputAdornment,{position:"start"},ee.createElement(ie.SearchIcon,{fontSize:"tiny"}))}})))};var Me=window.elementorV2.editorCurrentUser;const ze=()=>{const[e,t]=(0,Me.useSuppressedMessage)("global-class-manager"),[n,a]=(0,ee.useState)(!e);return ee.createElement(ne.IntroductionModal,{open:n,title:(0,l.__)("Class Manager","elementor"),handleClose:e=>{e||t(),a(!1)}},ee.createElement(ae.Image,{sx:{width:"100%",aspectRatio:"16 / 9"},src:"https://assets.elementor.com/packages/v1/images/class-manager-intro.svg",alt:""}),ee.createElement(Le,null))},Le=()=>ee.createElement(ae.Box,{p:3},ee.createElement(ae.Typography,{variant:"body2"},(0,l.__)("The Class Manager lets you see all the classes you've created, plus adjust their priority, rename them, and delete unused classes to keep your CSS structured.","elementor")),ee.createElement("br",null),ee.createElement(ae.Typography,{variant:"body2"},(0,l.__)("Remember, when editing an item within a specific class, any changes you make will apply across all elements in that class.","elementor")));let je=!1;function Be(){return Be=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},Be.apply(null,arguments)}const Ve=({sx:e,...t})=>ee.createElement(ie.ColorSwatchIcon,Be({sx:{transform:"rotate(90deg)",...e}},t)),Fe=()=>(0,s.__useSelector)(I),We={total:0,content:[]},Re=e=>{const{data:t,...n}=he();return{...n,data:t?.[e]??We}},Ue={"wp-post":{label:(0,l.__)("Post","elementor"),icon:ee.createElement(ie.PostTypeIcon,{fontSize:"inherit"})},"wp-page":{label:(0,l.__)("Page","elementor"),icon:ee.createElement(ie.PagesIcon,{fontSize:"inherit"})},popup:{label:(0,l.__)("Popup","elementor"),icon:ee.createElement(ie.PopupTemplateIcon,{fontSize:"inherit"})},header:{label:(0,l.__)("Header","elementor"),icon:ee.createElement(ie.HeaderTemplateIcon,{fontSize:"inherit"})},footer:{label:(0,l.__)("Footer","elementor"),icon:ee.createElement(ie.FooterTemplateIcon,{fontSize:"inherit"})}},$e=({cssClassID:e,onClose:t})=>{const{data:n}=Re(e),a=(0,te.__useOpenDocumentInNewTab)(),r=n?.content.map(({title:e,elements:t,pageId:n,type:a})=>({type:"item",value:n,label:e,secondaryText:t.length.toString(),docType:a}))??[];return ee.createElement(ee.Fragment,null,ee.createElement(ne.PopoverHeader,{icon:ee.createElement(ie.CurrentLocationIcon,{fontSize:"tiny"}),title:ee.createElement(ae.Stack,{flexDirection:"row",gap:1,alignItems:"center"},ee.createElement(ae.Box,{"aria-label":"header-title"},(0,l.__)("Locator","elementor")),ee.createElement(ae.Box,null,ee.createElement(ae.Chip,{sx:{lineHeight:1},size:"tiny",label:n.total}))),onClose:t}),ee.createElement(ae.Divider,null),ee.createElement(ne.PopoverBody,{width:300},ee.createElement(ne.PopoverMenuList,{onSelect:t=>{a(+t),B({event:"classUsageLocate",classId:e})},items:r,onClose:()=>{},menuListTemplate:Ge,menuItemContentTemplate:e=>ee.createElement(ae.Stack,{flexDirection:"row",flex:1,alignItems:"center"},ee.createElement(ae.Box,{display:"flex",sx:{pr:1}},ee.createElement(ae.Tooltip,{disableInteractive:!0,title:Ue?.[e.docType]?.label??e.docType,placement:"top"},ee.createElement(ae.Icon,{fontSize:"small"},Ue?.[e.docType]?.icon||ee.createElement(ie.PagesIcon,{fontSize:"inherit"})))),ee.createElement(ae.Box,{sx:{pr:.5,maxWidth:"173px"},display:"flex"},ee.createElement(ne.EllipsisWithTooltip,{title:e.label,as:ae.Typography,variant:"caption",maxWidth:"173px",sx:{lineHeight:1}})),ee.createElement(ie.ExternalLinkIcon,{className:"hover-only-icon",fontSize:"tiny"}),ee.createElement(ae.Chip,{sx:{ml:"auto"},size:"tiny",label:e.secondaryText}))})))},Ge=(0,ae.styled)(ae.MenuList)(({theme:e})=>({"& > li":{display:"flex",cursor:"pointer",height:32,width:"100%"},'& > [role="option"]':{...e.typography.caption,lineHeight:"inherit",padding:e.spacing(.5,1,.5,2),textOverflow:"ellipsis",position:"absolute",top:0,left:0,opacity:1,".hover-only-icon":{color:e.palette.text.disabled,opacity:0},"&:hover":{borderRadius:e.spacing(.5),backgroundColor:e.palette.action.hover,".hover-only-icon":{color:e.palette.text.disabled,opacity:1}}},width:"100%",position:"relative"}));function Ne(){return Ne=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},Ne.apply(null,arguments)}const qe=({id:e,onClick:t})=>{const{data:{total:n},isLoading:a}=Re(e),r=(0,ae.usePopupState)({variant:"popover",popupId:"css-class-usage-popover"});if(a)return null;const s=0!==n?Ye:Je;return ee.createElement(ee.Fragment,null,ee.createElement(ae.Box,{position:"relative",onMouseEnter:()=>{B({event:"classUsageHovered",classId:e,usage:n})}},ee.createElement(s,{total:n},ee.createElement(He,Ne({disabled:0===n,size:"tiny"},(0,ae.bindTrigger)(r),{onClick:a=>{0!==n&&((0,ae.bindTrigger)(r).onClick(a),t(e),B({event:"classUsageClicked",classId:e}))}}),ee.createElement(ie.CurrentLocationIcon,{fontSize:"tiny"})))),ee.createElement(ae.Box,null,ee.createElement(ae.Popover,Ne({anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:15,horizontal:-50}},(0,ae.bindPopover)(r),{onClose:()=>{(0,ae.bindPopover)(r).onClose(),t("")}}),ee.createElement($e,{onClose:r.close,"aria-label":"css-class-usage-popover",cssClassID:e}))))},He=(0,ae.styled)(ae.IconButton)(({theme:e})=>({"&.Mui-disabled":{pointerEvents:"auto","&:hover":{color:e.palette.action.disabled}},height:"22px",width:"22px"})),Ye=({children:e,total:t})=>ee.createElement(ae.Tooltip,{disableInteractive:!0,placement:"top",title:`${(0,l.__)("Show {{number}} {{locations}}","elementor").replace("{{number}}",t.toString()).replace("{{locations}}",1===t?(0,l.__)("location","elementor"):(0,l.__)("locations","elementor"))}`},ee.createElement("span",null,e)),Je=({children:e})=>ee.createElement(ae.Infotip,{disableInteractive:!0,placement:"top",color:"secondary",content:ee.createElement(ne.InfoAlert,{sx:{mt:1}},(0,l.__)("This class isn’t being used yet.","elementor"))},ee.createElement("span",null,e)),Ke=(0,ee.createContext)(null),Qe=({children:e})=>{const[t,n]=(0,ee.useState)(null);return ee.createElement(Ke.Provider,{value:{openDialog:e=>{n(e)},closeDialog:()=>{n(null)},dialogProps:t}},e,!!t&&ee.createElement(Xe,t))},Xe=({label:e,id:t})=>{const{closeDialog:n}=Ze(),{data:{total:a,content:r}}=Re(t),o=a&&r.length?(0,l.__)("Will permanently remove it from your project and may affect the design across all elements using it. Used %1 times across %2 pages. This action cannot be undone.","elementor").replace("%1",a.toString()).replace("%2",r.length.toString()):(0,l.__)("Will permanently remove it from your project and may affect the design across all elements using it. This action cannot be undone.","elementor");return ee.createElement(ne.ConfirmationDialog,{open:!0,onClose:n},ee.createElement(ne.ConfirmationDialog.Title,null,(0,l.__)("Delete this class?","elementor")),ee.createElement(ne.ConfirmationDialog.Content,null,ee.createElement(ne.ConfirmationDialog.ContentText,null,(0,l.__)("Deleting","elementor"),ee.createElement(ae.Typography,{variant:"subtitle2",component:"span"}," ",e," "),o)),ee.createElement(ne.ConfirmationDialog.Actions,{onClose:n,onConfirm:()=>{n(),(e=>{B({event:"classDeleted",classId:e,runAction:()=>{(0,s.__dispatch)(f.actions.delete(e)),je=!0}})})(t)}}))},Ze=()=>{const e=(0,ee.useContext)(Ke);if(!e)throw new Error("useDeleteConfirmation must be used within a DeleteConfirmationProvider");return e};function et(){return et=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},et.apply(null,arguments)}const tt=e=>ee.createElement(ae.UnstableSortableProvider,et({restrictAxis:!0,variant:"static",dragPlaceholderStyle:{opacity:"1"}},e)),nt=e=>ee.createElement(rt,et({},e,{role:"button",className:"class-item-sortable-trigger","aria-label":"sort"}),ee.createElement(ie.GripVerticalIcon,{fontSize:"tiny"})),at=({children:e,id:t,...n})=>ee.createElement(ae.UnstableSortableItem,et({},n,{id:t,render:({itemProps:t,isDragged:n,triggerProps:a,itemStyle:r,triggerStyle:s,dropIndicationStyle:l,showDropIndication:o,isDragOverlay:i,isDragPlaceholder:c})=>ee.createElement(ae.Box,et({},t,{style:r,component:"li",role:"listitem",sx:{backgroundColor:i?"background.paper":void 0}}),e({itemProps:t,isDragged:n,triggerProps:a,itemStyle:r,triggerStyle:s,isDragPlaceholder:c}),o&&ee.createElement(st,{style:l}))})),rt=(0,ae.styled)("div")(({theme:e})=>({position:"absolute",left:0,top:"50%",transform:`translate( -${e.spacing(1.5)}, -50% )`,color:e.palette.action.active})),st=(0,ae.styled)(ae.Box)` width: 100%; height: 1px; background-color: ${({theme:e})=>e.palette.text.primary}; `;function lt(){return lt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},lt.apply(null,arguments)}const ot=({id:e,label:t,renameClass:n,selected:a,disabled:r,sortableTriggerProps:s,showSortIndicator:o})=>{const i=(0,ee.useRef)(null),{ref:c,openEditMode:d,isEditing:u,error:m,getProps:p}=(0,ne.useEditable)({value:t,onSubmit:n,validation:ut}),[g,h]=(0,ee.useState)(""),{openDialog:y}=Ze(),f=(0,ae.usePopupState)({variant:"popover",disableAutoFocus:!0}),b=(g===e||a||f.isOpen)&&!r;return ee.createElement(ee.Fragment,null,ee.createElement(ae.Stack,{p:0},ee.createElement(ne.WarningInfotip,{open:Boolean(m),text:m??"",placement:"bottom",width:i.current?.getBoundingClientRect().width,offset:[0,-15]},ee.createElement(it,{ref:i,dense:!0,disableGutters:!0,showSortIndicator:o,showActions:b||u,shape:"rounded",onDoubleClick:d,selected:b,disabled:r,focusVisibleClassName:"visible-class-item"},ee.createElement(nt,s),ee.createElement(ct,{isActive:u,isError:!!m},u?ee.createElement(ne.EditableField,lt({ref:c,as:ae.Typography,variant:"caption"},p())):ee.createElement(ne.EllipsisWithTooltip,{title:t,as:ae.Typography,variant:"caption"})),ee.createElement(ae.Box,{className:"class-item-locator"},ee.createElement(qe,{id:e,onClick:h})),ee.createElement(ae.Tooltip,{placement:"top",className:"class-item-more-actions",title:(0,l.__)("More actions","elementor")},ee.createElement(ae.IconButton,lt({size:"tiny"},(0,ae.bindTrigger)(f),{"aria-label":"More actions"}),ee.createElement(ie.DotsVerticalIcon,{fontSize:"tiny"})))))),ee.createElement(ae.Menu,lt({},(0,ae.bindMenu)(f),{anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"}}),ee.createElement(ne.MenuListItem,{sx:{minWidth:"160px"},onClick:()=>{f.close(),d()}},ee.createElement(ae.Typography,{variant:"caption",sx:{color:"text.primary"}},(0,l.__)("Rename","elementor"))),ee.createElement(ne.MenuListItem,{onClick:()=>{f.close(),y({id:e,label:t})}},ee.createElement(ae.Typography,{variant:"caption",sx:{color:"error.light"}},(0,l.__)("Delete","elementor")))))},it=(0,ae.styled)(ae.ListItemButton,{shouldForwardProp:e=>!["showActions","showSortIndicator"].includes(e)})(({showActions:e,showSortIndicator:t})=>`\n min-height: 36px;\n\n &.visible-class-item {\n box-shadow: none !important;\n }\n\n .class-item-locator {\n visibility: hidden;\n }\n\n .class-item-sortable-trigger {\n visibility: ${t&&e?"visible":"hidden"};\n }\n\n &:hover:not(:disabled) {\n .class-item-locator {\n visibility: visible;\n }\n\n .class-item-sortable-trigger {\n visibility: ${t?"visible":"hidden"};\n }\n }\n `),ct=(0,ae.styled)(ae.Box,{shouldForwardProp:e=>!["isActive","isError"].includes(e)})(({theme:e,isActive:t,isError:n})=>({display:"flex",width:"100%",flexGrow:1,borderRadius:e.spacing(.5),border:dt({isActive:t,isError:n,theme:e}),padding:`0 ${e.spacing(1)}`,marginLeft:t?e.spacing(1):0,minWidth:0})),dt=({isActive:e,isError:t,theme:n})=>t?`2px solid ${n.palette.error.main}`:e?`2px solid ${n.palette.secondary.main}`:"none",ut=e=>{const t=(0,r.validateStyleLabel)(e,"rename");return t.isValid?null:t.errorMessage};function mt(){return mt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},mt.apply(null,arguments)}const pt={filterAndSearch:{mainText:(0,l.__)("Sorry, nothing matched.","elementor"),sceneryText:(0,l.__)("Try something else.","elementor"),icon:ee.createElement(ie.PhotoIcon,{color:"inherit",fontSize:"large"})},search:{mainText:(0,l.__)("Sorry, nothing matched","elementor"),sceneryText:(0,l.__)("Clear your input and try something else.","elementor"),icon:ee.createElement(ie.PhotoIcon,{color:"inherit",fontSize:"large"})},filter:{mainText:(0,l.__)("Sorry, nothing matched that search.","elementor"),sceneryText:(0,l.__)("Clear the filters and try something else.","elementor"),icon:ee.createElement(ie.ColorSwatchIcon,{color:"inherit",fontSize:"large"})}},gt=({notFoundType:e})=>{const{search:{onClearSearch:t,inputValue:n},filters:{onClearFilter:a}}=ge();switch(e){case"filter":return ee.createElement(ht,mt({},pt.filter,{onClear:a}));case"search":return ee.createElement(ht,mt({},pt.search,{searchValue:n,onClear:t}));case"filterAndSearch":return ee.createElement(ht,mt({},pt.filterAndSearch,{onClear:()=>{a(),t()}}))}},ht=({onClear:e,searchValue:t,mainText:n,sceneryText:a,icon:r})=>ee.createElement(ae.Stack,{color:"text.secondary",pt:5,alignItems:"center",gap:1,overflow:"hidden",justifySelf:"center"},r,ee.createElement(ae.Box,{sx:{width:"100%"}},ee.createElement(ae.Typography,{align:"center",variant:"subtitle2",color:"inherit"},n),t&&ee.createElement(ae.Typography,{variant:"subtitle2",color:"inherit",sx:{display:"flex",width:"100%",justifyContent:"center"}},ee.createElement("span",null,"“"),ee.createElement("span",{style:{maxWidth:"80%",overflow:"hidden",textOverflow:"ellipsis"}},t),ee.createElement("span",null,"”."))),ee.createElement(ae.Typography,{align:"center",variant:"caption",color:"inherit"},a),ee.createElement(ae.Typography,{align:"center",variant:"caption",color:"inherit"},ee.createElement(ae.Link,{color:"secondary",variant:"caption",component:"button",onClick:e},(0,l.__)("Clear & try again","elementor")))),yt=({disabled:e})=>{const{search:{debouncedValue:t}}=ge(),n=Fe(),a=(0,s.__useDispatch)(),r=be(),[l,o]=ee.useState(null),i=n.find(e=>e.id===l)?.label??"",[c,d]=vt(l,o,i??""),u=Et();if((0,ee.useEffect)(()=>{const e=e=>{if("z"===e.key&&(e.ctrlKey||e.metaKey)){if(e.stopImmediatePropagation(),e.preventDefault(),e.shiftKey)return void a(f.actions.redo());a(f.actions.undo())}};return window.addEventListener("keydown",e,{capture:!0}),()=>window.removeEventListener("keydown",e)},[a]),!n?.length)return ee.createElement(ft,null);const m=((e,t,n)=>{const a=n.length<=0&&e.length>1,r=t&&0===t.length;return a&&r?"filterAndSearch":a?"search":r?"filter":void 0})(t,r,u);if(m)return ee.createElement(gt,{notFoundType:m});const p=r?.length||t,g=u.length>1&&!p;return ee.createElement(Qe,null,ee.createElement(ae.List,{sx:{display:"flex",flexDirection:"column",gap:.5}},ee.createElement(tt,{value:c,onChange:d,disableDragOverlay:!g},u?.map(({id:t,label:n})=>ee.createElement(at,{key:t,id:t},({isDragged:r,isDragPlaceholder:s,triggerProps:i,triggerStyle:c})=>(r&&!l&&o(t),ee.createElement(ot,{id:t,label:n,renameClass:e=>{B({event:"classRenamed",classId:t,oldValue:n,newValue:e,source:"class-manager"}),a(f.actions.update({style:{id:t,label:e}}))},selected:r,disabled:e||s,sortableTriggerProps:{...i,style:c},showSortIndicator:g})))))))},ft=()=>ee.createElement(ae.Stack,{alignItems:"center",gap:1.5,pt:10,px:.5,maxWidth:"260px",margin:"auto"},ee.createElement(Ve,{fontSize:"large"}),ee.createElement(bt,{variant:"subtitle2",component:"h2",color:"text.secondary"},(0,l.__)("There are no global classes yet.","elementor")),ee.createElement(ae.Typography,{align:"center",variant:"caption",color:"text.secondary"},(0,l.__)("CSS classes created in the editor panel will appear here. Once they are available, you can arrange their hierarchy, rename them, or delete them as needed.","elementor"))),bt=(0,ae.styled)(ae.Typography)(({theme:e,variant:t})=>({"&.MuiTypography-root":{...e.typography[t]}})),vt=(e,t,n)=>{const a=(0,s.__useDispatch)();return[ce(),r=>{a(f.actions.setOrder(r)),e&&(B({event:"classManagerReorder",classId:e,classTitle:n}),t(null))}]},Et=()=>{const e=Fe(),{search:{debouncedValue:t}}=ge(),n=be(),a=(0,ee.useMemo)(()=>e.map(e=>({...e,lowerLabel:e.label.toLowerCase()})),[e]),r=(0,ee.useMemo)(()=>t.length>1?a.filter(e=>e.lowerLabel.includes(t.toLowerCase())):e,[t,e,a]);return(0,ee.useMemo)(()=>n&&n.length>0?r.filter(e=>n.includes(e.id)):r,[r,n])};function wt(){return wt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},wt.apply(null,arguments)}const _t="global-classes-manager",{panel:xt,usePanelActions:Ct}=(0,Z.__createPanel)({id:_t,component:function(){const e=de(),{close:t}=Ct(),{open:n,close:a,isOpen:r}=(0,ne.useDialog)(),{mutateAsync:o,isPending:i}=Tt();return Dt(),ee.createElement(ne.ThemeProvider,null,ee.createElement(ae.ErrorBoundary,{fallback:ee.createElement(It,null)},ee.createElement(Z.Panel,null,ee.createElement(pe,null,ee.createElement(Z.PanelHeader,null,ee.createElement(ae.Stack,{p:1,pl:2,width:"100%",direction:"row",alignItems:"center"},ee.createElement(ae.Stack,{width:"100%",direction:"row",gap:1},ee.createElement(Z.PanelHeaderTitle,{sx:{display:"flex",alignItems:"center",gap:.5}},ee.createElement(Ve,{fontSize:"inherit"}),(0,l.__)("Class Manager","elementor")),ee.createElement(Pt,null)),ee.createElement(St,{sx:{marginLeft:"auto"},disabled:i,onClose:()=>{e?n():t()}}))),ee.createElement(Z.PanelBody,{sx:{display:"flex",flexDirection:"column",height:"100%"}},ee.createElement(ae.Box,{px:2,pb:1},ee.createElement(ae.Stack,{direction:"row",justifyContent:"spaceBetween",gap:.5,sx:{pb:.5}},ee.createElement(ae.Box,{sx:{flexGrow:1}},ee.createElement(Ae,null)),ee.createElement(Oe,null)),ee.createElement(Te,null)),ee.createElement(ae.Divider,null),ee.createElement(ae.Box,{px:2,sx:{flexGrow:1,overflowY:"auto"}},ee.createElement(yt,{disabled:i}))),ee.createElement(Z.PanelFooter,null,ee.createElement(ae.Button,{fullWidth:!0,size:"small",color:"global",variant:"contained",onClick:o,disabled:!e,loading:i},(0,l.__)("Save changes","elementor")))))),ee.createElement(ze,null),r&&ee.createElement(ne.SaveChangesDialog,null,ee.createElement(ae.DialogHeader,{onClose:a,logo:!1},ee.createElement(ne.SaveChangesDialog.Title,null,(0,l.__)("You have unsaved changes","elementor"))),ee.createElement(ne.SaveChangesDialog.Content,null,ee.createElement(ne.SaveChangesDialog.ContentText,null,(0,l.__)("You have unsaved changes in the Class Manager.","elementor")),ee.createElement(ne.SaveChangesDialog.ContentText,null,(0,l.__)("To avoid losing your updates, save your changes before leaving.","elementor"))),ee.createElement(ne.SaveChangesDialog.Actions,{actions:{discard:{label:(0,l.__)("Discard","elementor"),action:()=>{(0,s.__dispatch)(f.actions.resetToInitialState({context:"frontend"})),a()}},confirm:{label:(0,l.__)("Save & Continue","elementor"),action:async()=>{await o(),a(),t()}}}})))},allowedEditModes:["edit",_t],onOpen:()=>{(0,o.changeEditMode)(_t),function(){const e=window;e.$e?.components?.get?.("panel")?.blockUserInteractions?.()}()},onClose:async()=>{(0,o.changeEditMode)("edit"),await(()=>{const e=(0,te.getCurrentDocument)();return(0,te.getV1DocumentsManager)().invalidateCache(),(0,o.__privateRunCommand)("editor/documents/switch",{id:e?.id,shouldScroll:!1,shouldNavigateToDefaultRoute:!1})})(),function(){const e=window;e.$e?.components?.get?.("panel")?.unblockUserInteractions?.()}()},isOpenPreviousElement:!0}),St=({onClose:e,...t})=>ee.createElement(ae.IconButton,wt({size:"small",color:"secondary",onClick:e,"aria-label":"Close"},t),ee.createElement(ie.XIcon,{fontSize:"small"})),It=()=>ee.createElement(ae.Box,{role:"alert",sx:{minHeight:"100%",p:2}},ee.createElement(ae.Alert,{severity:"error",sx:{mb:2,maxWidth:400,textAlign:"center"}},ee.createElement("strong",null,(0,l.__)("Something went wrong","elementor")))),Dt=()=>{const e=de();(0,ee.useEffect)(()=>{const t=t=>{e&&t.preventDefault()};return window.addEventListener("beforeunload",t),()=>{window.removeEventListener("beforeunload",t)}},[e])},Tt=()=>(0,re.useMutation)({mutationFn:()=>we({context:"frontend"}),onSuccess:async()=>{(0,te.setDocumentModifiedStatus)(!1),je&&await(async()=>{je=!1})()}}),Pt=()=>{const e=be(),t=ce();return ee.createElement(ae.Chip,{size:"small",label:e?`${e.length} / ${t?.length}`:t?.length})},kt=()=>{B({event:"classManagerOpened",source:"style-panel"})},Ot=()=>{const e=(0,te.__useActiveDocument)(),{open:t}=Ct(),{save:n}=(0,te.__useActiveDocumentActions)(),{open:a,close:s,isOpen:o}=(0,ne.useDialog)(),{prefetchClassesUsage:i}=le(),{userCan:c}=(0,r.useUserStylesCapability)();return c(Y.getKey()).update?ee.createElement(ee.Fragment,null,ee.createElement(ae.Tooltip,{title:(0,l.__)("Class Manager","elementor"),placement:"top"},ee.createElement(ae.IconButton,{size:"tiny",onClick:()=>{e?.isDirty?a():(t(),kt(),B({event:"classManagerOpened",source:"style-panel"}),i())},sx:{marginInlineEnd:-.75}},ee.createElement(Ve,{fontSize:"tiny"}))),o&&ee.createElement(ne.SaveChangesDialog,null,ee.createElement(ne.SaveChangesDialog.Title,null,(0,l.__)("You have unsaved changes","elementor")),ee.createElement(ne.SaveChangesDialog.Content,null,ee.createElement(ne.SaveChangesDialog.ContentText,{sx:{mb:2}},(0,l.__)("To open the Class Manager, save your page first. You can't continue without saving.","elementor"))),ee.createElement(ne.SaveChangesDialog.Actions,{actions:{cancel:{label:(0,l.__)("Stay here","elementor"),action:s},confirm:{label:(0,l.__)("Save & Continue","elementor"),action:async()=>{await n(),s(),t(),kt(),i()}}}}))):null},At=e=>{const t=e.styleDef;return ee.createElement(ee.Fragment,null,ee.createElement(ne.MenuListItem,{disabled:!e.canConvert,onClick:()=>{const n=function(e){let t=1,n=`${e}${t}`;for(;!(0,r.validateStyleLabel)(n,"create").isValid;)n=`${e}${++t}`;return n}("converted-class-");if(!t)throw new Error("Style definition is required for converting local class to global class.");const a=Y.actions.create?.(n,t.variants);a&&(e.successCallback(a),B({classId:a,event:"classCreated",source:"converted",classTitle:n}))},dense:!0,sx:{"&.Mui-focusVisible":{border:"none",boxShadow:"none !important",backgroundColor:"transparent"}}},(0,l.__)("Convert to global class","elementor")),ee.createElement(ae.Divider,null))};function Mt(){const e=(0,s.__useDispatch)();return(0,ee.useEffect)(()=>{Promise.all([z.all("preview"),z.all("frontend")]).then(([t,n])=>{const{data:a}=t,{data:r}=n;e(f.actions.load({preview:{items:a.data,order:a.meta.order},frontend:{items:r.data,order:r.meta.order}}))})},[e]),null}var zt=window.elementorV2.schema,Lt=window.elementorV2.editorCanvas,jt=window.elementorV2.editorProps;const Bt={action:zt.z.enum(["create","modify","delete"]).describe("Operation to perform"),classId:zt.z.string().optional().describe("Global class ID (required for modify). Get from elementor://global-classes resource."),globalClassName:zt.z.string().optional().describe("Global class name (required for create)"),props:zt.z.record(zt.z.any()).describe('key-value of style-schema PropValues. Available properties at dynamic resource "elementor://styles/schema/{property-name}"'),breakpoint:zt.z.nullable(zt.z.string().describe("Responsive breakpoint name for styles. Defaults to desktop (null).")).default(null).describe("Responsive breakpoint name for styles. Defaults to desktop (null).")},Vt={status:zt.z.enum(["ok","error"]).describe("Operation status"),classId:zt.z.string().optional().describe("Class ID (returned on create success)"),message:zt.z.string().optional().describe("Error details if status is error")},Ft=async e=>{const{action:t,classId:n,globalClassName:r,props:s,breakpoint:l}=e;if("create"===t&&!r)return{status:"error",message:"Create requires globalClassName"};if("modify"===t&&!n)return{status:"error",message:"Modify requires classId"};if("delete"===t&&!n)return{status:"error",message:"Delete requires classId"};const{create:o,update:i,delete:c}=Y.actions;if(!o||!i||!c)return{status:"error",message:"Required actions not available"};const d=[],u=(0,a.getStylesSchema)(),m=Object.keys(u);if(Object.keys(s).forEach(e=>{const t=u[e];if(!t)return void d.push(`Property "${e}" does not exist in styles schema.`);const{valid:n,jsonSchema:a}=jt.Schema.validatePropValue(t,s[e]);n||d.push(`- Property "${e}" has invalid value\n Expected schema: ${a}\n`)}),d.length>0)return{status:"error",message:`Validation errors:\n${d.join("\n")}\nAvailable Properties: ${m.join(", ")}\nUpdate your input and try again.`};const p=window.elementorV2.editorVariables.Utils;Object.keys(s).forEach(e=>{s[e]=jt.Schema.adjustLlmPropValueSchema(s[e],{transformers:p.globalVariablesLLMResolvers})});const g=l??"desktop";try{switch(t){case"create":const e=await async function(e){const{props:t,breakpoint:n,className:a,stylesProvider:r}=e,{create:s,delete:l}=r.actions;if(!a)throw new Error("Global class name is a required for creation");if(!s||!l)throw new Error("User is unable to create global classes");const o=s(a,[{meta:{breakpoint:n,state:null},custom_css:null,props:t}]);try{return await we({context:"frontend"}),o}catch{return l(o),null}}({props:s,className:r,stylesProvider:Y,breakpoint:g});return e?{status:"ok",message:`created global class with ID ${e}`}:{status:"error",message:"error creating class"};case"modify":const t=await async function(e){const{props:t,breakpoint:n,classId:a,stylesProvider:r}=e,{updateProps:s,update:l}=r.actions;if(!a)throw new Error("Class ID is required for modification");if(!s||!l)throw new Error("User is unable to update global classes");const o=structuredClone(r.actions.all());try{return s({id:a,props:t,meta:{breakpoint:n,state:null}}),await we({context:"frontend"}),!0}catch{return o.forEach(e=>{l({id:e.id,variants:e.variants})}),await we({context:"frontend"}),!1}}({classId:n,props:s,stylesProvider:Y,breakpoint:g});return t?{status:"ok",classId:n}:{status:"error",message:"error modifying class"};case"delete":const a=await async function(e){const{classId:t,stylesProvider:n}=e,{delete:a,create:r}=n.actions;if(!t)throw new Error("Class ID is required for deletion");if(!a||!r)throw new Error("User is unable to delete global classes");if(!structuredClone(n.actions.all()).find(e=>e.id===t))throw new Error(`Class with ID "${t}" not found`);try{return a(t),await we({context:"frontend"}),!0}catch{return!1}}({classId:n,stylesProvider:Y});return a?{status:"ok",message:`deleted global class with ID ${n}`}:{status:"error",message:"error deleting class"}}}catch(e){return{status:"error",message:`${t} failed: ${e.message||"Unknown error"}`}}},Wt=()=>{const e=(0,n.getMCPByDomain)("classes",{instructions:"MCP server for management of Elementor global classes"});var t;(t=e).addTool({schema:{classId:zt.z.string().describe("The ID of the class to apply"),elementId:zt.z.string().describe("The ID of the element to which the class will be applied")},outputSchema:{result:zt.z.string().describe("Result message indicating the success of the apply operation")},name:"apply-global-class",modelPreferences:{intelligencePriority:.7,speedPriority:.8},description:'Apply a global class to an element, enabling consistent styling through your design system.\n\n## When to use this tool:\n**ALWAYS use this IMMEDIATELY AFTER building compositions** to apply the global classes you created beforehand:\n- After using "build-compositions" tool, apply semantic classes to the created elements\n- When applying consistent typography styles (heading-primary, text-body, etc.)\n- When applying theme colors or brand styles (bg-brand, button-cta, etc.)\n- When ensuring spacing consistency (spacing-section-large, etc.)\n\n**DO NOT use this tool** for:\n- Elements that don\'t share styles with other elements (use inline styles instead)\n- Layout-specific properties (those should remain inline in stylesConfig)\n\n## Prerequisites:\n- **REQUIRED**: Get the list of available global classes from \'elementor://global-classes\' resource\n- **REQUIRED**: Get element IDs from the composition XML returned by "build-compositions" tool\n- Ensure you have the most up-to-date list of classes applied to the element to avoid duplicates\n- Make sure you have the correct class ID that you want to apply\n\n## Best Practices:\n1. Apply multiple classes to a single element if needed (typography + color + spacing)\n2. After applying, the tool will remind you to remove duplicate inline styles from elementConfig\n3. Classes should describe purpose, not implementation (e.g., "heading-primary" not "big-red-text")',handler:async e=>{const{classId:t,elementId:n}=e,a=(0,X.doGetAppliedClasses)(n);return(0,X.doApplyClasses)(n,[...a,t]),{llm_instructions:"Please check the element-configuration, find DUPLICATES in the style schema that are in the class, and remove them",result:`Class ${t} applied to element ${n} successfully.`}}}),t.addTool({name:"unapply-global-class",schema:{classId:zt.z.string().describe("The ID of the class to unapply"),elementId:zt.z.string().describe("The ID of the element from which the class will be unapplied")},outputSchema:{result:zt.z.string().describe("Result message indicating the success of the unapply operation")},modelPreferences:{intelligencePriority:.7,speedPriority:.8},description:"Unapply a (global) class from the current element\n\n## When to use this tool:\n- When a user requests to unapply a global class or a class from an element in the Elementor editor.\n- When you need to remove a specific class from an element's applied classes.\n\n## Prerequisites:\n- Ensure you have the most up-to-date list of classes applied to the element to avoid errors.\n The list is available at always up-to-date resource 'elementor://global-classes'.\n- Make sure you have the correct class ID that you want to unapply.\n\n<note>\nIf the user want to unapply a class by it's name and not ID, retreive the id from the list, available at uri elementor://global-classes\n</note>\n",handler:async e=>{const{classId:t,elementId:n}=e;if(!(0,X.doUnapplyClass)(n,t))throw new Error(`Class ${t} is not applied to element ${n}, cannot unapply it.`);return{result:`Class ${t} unapplied from element ${n} successfully.`}}}),function(e){const{addTool:t}=e;t({name:"get-global-class-usages",modelPreferences:{intelligencePriority:.6,speedPriority:.8},description:"Retreive the usages of global-classes ACCROSS PAGES designed by Elementor editor.\n\n## Prequisites: CRITICAL\n- The list of global classes and their applid values is available at resource uri elementor://global-classes\n\n## When to use this tool:\n- When a user requests to see where a specific global class is being used accross the site.\n- When you need to manage or clean up unused global classes.\n- Before deleting a global class, to ensure it is not in use in any other pages.\n\n## When NOT to use this tool:\n- For getting the list of global classes, refer to the resource at uri elementor://global-classes\n",outputSchema:{usages:zt.z.array(zt.z.object({classId:zt.z.string().describe('The ID of the class, not visible to the user. To retreive the name of the class, use the "list-global-classes" tool'),usages:zt.z.array(zt.z.object({pageId:zt.z.string().describe("The ID of the page where the class is used"),title:zt.z.string().describe("The title of the page where the class is used"),total:zt.z.number().describe("The number of times the class is used on this page"),elements:zt.z.array(zt.z.string()).describe("List of element IDs using this class on the page")}))}))},handler:async()=>{const e=await j(),t={usages:[]};return Object.entries(e).forEach(([e,n])=>{const a={classId:e,usages:[]};if("number"!=typeof n){const{content:e}=n;e.forEach(e=>{a.usages.push({pageId:String(e.pageId),title:e.title,total:e.total,elements:e.elements})}),t.usages.push(a)}}),t}})}(e),(e=>{const{addTool:t}=e;t({name:"manage-global-classes",requiredResources:[{uri:K,description:"Global classes list"},{uri:Lt.STYLE_SCHEMA_URI,description:"Style schema resources"},{uri:Lt.BREAKPOINTS_SCHEMA_URI,description:"Breakpoints list"}],modelPreferences:{intelligencePriority:.85,speedPriority:.6},description:"Manages global classes (create/modify) in Elementor editor. Check [elementor://global-classes] and style schemas first.\n\nCREATE: Requires globalClassName, props. Use semantic naming (heading-primary, button-cta, text-muted). Check existing classes to avoid duplicates. ALWAYS create global classes BEFORE compositions for reusable styles.\nMODIFY: Requires classId, props. Get classId from [elementor://global-classes] resource.\n\nNaming pattern: [element-type]-[purpose/variant]-[modifier]\nDO NOT create global classes for: one-off styles, layout-specific properties.\n\nUse style schema at [elementor://styles/schema/{category}] for valid props. Errors include exact schema mismatch details.",schema:Bt,outputSchema:Vt,handler:Ft})})(e),[(0,n.getMCPByDomain)("canvas"),(0,n.getMCPByDomain)("classes")].forEach(e=>{const{mcpServer:t,resource:n,waitForReady:a}=e;n("global-classes",K,{description:"Global classes list."},async()=>({contents:[{uri:K,text:localStorage["elementor-global-classes"]??"{}"}]})),a().then(()=>{Y.subscribe(()=>{t.sendResourceListChanged()})})})};function Rt(){const e=Ct();return(0,ee.useEffect)(()=>{(0,o.__privateListenTo)((0,o.v1ReadyEvent)(),()=>{!function(e){const t=(0,s.__subscribeWithSelector)(S,()=>{S((0,s.__getState)())&&(0,te.setDocumentModifiedStatus)(!0)});(function(e){(0,o.registerDataHook)("dependency","document/save/save",t=>{const n=(0,Me.getCurrentUser)(),a=n?.capabilities.includes(i);return!a||(we({context:"publish"===t.status?"frontend":"preview",onApprove:e?.open}),!0)})})(e)}(e)})},[]),null}function Ut(){(0,s.__registerSlice)(f),(0,Z.__registerPanel)(xt),r.stylesRepository.register(Y),(0,Q.injectIntoLogic)({id:"global-classes-populate-store",component:Mt}),(0,Q.injectIntoLogic)({id:"global-classes-sync-with-document",component:Rt}),(0,Q.injectIntoLogic)({id:"global-classes-prefetch-css-class-usage",component:oe}),(0,X.injectIntoCssClassConvert)({id:"global-classes-convert-from-local-class",component:At}),(0,X.injectIntoClassSelectorActions)({id:"global-classes-manager-button",component:Ot}),(0,X.registerStyleProviderToColors)(H,{name:"global",getThemeColor:e=>e.palette.global.dark}),Wt()}(window.elementorV2=window.elementorV2||{}).editorGlobalClasses=t}(),window.elementorV2.editorGlobalClasses?.init?.();
[-] editor-global-classes.js.LICENSE.txt
[edit]
[+]
..
[-] editor-global-classes.js
[edit]
[-] editor-global-classes.asset.php
[edit]
[-] editor-global-classes.min.js
[edit]
[-] editor-global-classes.strings.js
[edit]