PATH:
home
/
lab2454c
/
argowells.com
/
wp-content
/
plugins
/
elementor
/
assets
/
js
/
packages
/
editor-variables
!function(){"use strict";var e={d:function(t,a){for(var r in a)e.o(a,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:a[r]})},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_VARIABLES_URI:function(){return ft},Utils:function(){return Ft},init:function(){return zt},registerVariableType:function(){return z},registerVariableTypes:function(){return Pt},service:function(){return O},sizeVariablePropTypeUtil:function(){return kt}});var a=window.elementorV2.editor,r=window.elementorV2.editorEditingPanel,n=window.elementorV2.editorPanels,l=window.elementorV2.editorProps,o=window.React,i=window.elementorV2.editorUi,s=window.elementorV2.editorV1Adapters,c=window.elementorV2.icons,u=window.elementorV2.ui,d=window.wp.i18n,p=window.elementorV2.mixpanel;const m=({varType:e,controlPath:t,action:a})=>{const{dispatchEvent:r,config:n}=(0,p.getMixpanel)();if(!n?.names?.variables?.[a])return;const l=n.names.variables[a];r?.(l,{location:n?.locations?.variables||"",secondaryLocation:n?.secondaryLocations?.variablesPopover||"",trigger:n?.triggers?.click||"",var_type:e,control_path:t,action_type:l})},b=({action:e,varType:t,controlPath:a})=>{const{dispatchEvent:r,config:n}=(0,p.getMixpanel)();if(!n?.names?.variables?.[e])return;const l=n.names.variables[e],o={location:n?.locations?.variablesManager||"",trigger:n?.triggers?.click||"",action_type:l};t&&(o.var_type=t),a&&(o.style_control_path=a),r?.(l,o)},v={MISSING_VARIABLE_NAME:(0,d.__)("Give your variable a name.","elementor"),MISSING_VARIABLE_VALUE:(0,d.__)("Add a value to complete your variable.","elementor"),INVALID_CHARACTERS:(0,d.__)("Use letters, numbers, dashes (-), or underscores (_) for the name.","elementor"),NO_NON_SPECIAL_CHARACTER:(0,d.__)("Names have to include at least one non-special character.","elementor"),VARIABLE_LABEL_MAX_LENGTH:(0,d.__)("Keep names up to 50 characters.","elementor"),DUPLICATED_LABEL:(0,d.__)("This variable name already exists. Please choose a unique name.","elementor"),UNEXPECTED_ERROR:(0,d.__)("There was a glitch. Try saving your variable again.","elementor"),BATCH:{DUPLICATED_LABELS:(e,t)=>(0,d.sprintf)((0,d.__)("We found %1$d duplicated %2$s.","elementor"),e,t),UNEXPECTED_ERROR:(0,d.__)("There was a glitch.","elementor"),DUPLICATED_LABEL_ACTION:(0,d.__)("Take me there","elementor"),DUPLICATED_LABEL_ACTION_MESSAGE:(0,d.__)("Please rename the variables.","elementor"),UNEXPECTED_ERROR_ACTION_MESSAGE:(0,d.__)("Try saving your variables again.","elementor")}},g=e=>{if("duplicated_label"===e?.response?.data?.code)return{field:"label",message:v.DUPLICATED_LABEL};if("batch_duplicated_label"===e?.response?.data?.code){const t=e?.response?.data?.data??{},a=Object.keys(t).length,r=1===a?"name":"names",n=Object.keys(t);return{field:"label",message:v.BATCH.DUPLICATED_LABELS(a,r),severity:"error",IconComponent:c.AlertTriangleFilledIcon,action:{label:v.BATCH.DUPLICATED_LABEL_ACTION,message:v.BATCH.DUPLICATED_LABEL_ACTION_MESSAGE,data:{duplicatedIds:n}}}}return"batch_operation_failed"===e?.response?.data?.code?{field:"label",message:v.BATCH.UNEXPECTED_ERROR,severity:"secondary",IconComponent:c.InfoCircleFilledIcon,action:{message:v.BATCH.UNEXPECTED_ERROR_ACTION_MESSAGE}}:void 0},E=e=>39<e.length?v.VARIABLE_LABEL_MAX_LENGTH:"",h=e=>e.trim()?"":v.MISSING_VARIABLE_VALUE;var y=window.elementorV2.editorCanvas;const f=(0,u.styled)(u.UnstableColorIndicator)(({theme:e})=>({borderRadius:e.shape.borderRadius/2+"px",marginRight:e.spacing(.25)}));var C=window.elementorV2.schema;const _=(0,l.createPropUtils)("global-color-variable",C.z.string());var T=window.elementorV2.httpClient;const w="elementor/v1/variables",S=e=>e.startsWith("tmp-"),k="elementor-global-variables",I="elementor-global-variables-watermark",P="RW",A=(0,l.createPropUtils)("global-font-variable",C.z.string()),x=(()=>{const e={};let t;const a=(t,a)=>!(t in e)||e[t].label!==a.label||e[t].value!==a.value||!(e[t]?.deleted||!a?.deleted)||!(!e[t]?.deleted||a?.deleted),r=e=>{if(e)try{((e,t="preview")=>{const a=window;a.elementor?.helpers?.enqueueFont?.(e,t)})(e)}catch{}};return{subscribe:e=>(t=e,()=>{t=()=>{}}),update:n=>{(t=>{let n=!1;for(const[l,o]of Object.entries(t))a(l,o)&&(e[l]=o,o.type===A.key&&r(o.value),n=!0);return n})(n)&&"function"==typeof t&&t({...e})}}})(),V=new class{notifyChange(){window.dispatchEvent(new Event("variables:updated"))}constructor(){this.state={watermark:-1,variables:{}}}load(){return this.state.watermark=parseInt(localStorage.getItem(I)||"-1"),this.state.variables=JSON.parse(localStorage.getItem(k)||"{}"),this.state.variables}fill(e,t){this.state.variables={},e&&Object.keys(e).length&&(this.state.variables=e),this.state.watermark=t,localStorage.setItem(I,this.state.watermark.toString()),localStorage.setItem(k,JSON.stringify(this.state.variables)),this.notifyChange()}add(e,t){this.load(),this.state.variables[e]=t,localStorage.setItem(k,JSON.stringify(this.state.variables)),this.notifyChange()}update(e,t){this.load(),this.state.variables[e]=t,localStorage.setItem(k,JSON.stringify(this.state.variables)),this.notifyChange()}watermark(e){this.state.watermark=e,localStorage.setItem(I,this.state.watermark.toString())}watermarkDiff(e,t){const a=t-this.state.watermark;return P===e?1!==a:"RO"===e&&0!==a}},O={variables:()=>V.load(),findIdByLabel(e){const t=Object.entries(this.variables()).find(([,t])=>t.label===e);if(!t)throw new Error(`Variable with label ${e} not found`);return t[0]},findVariableByLabel(e){return Object.values(this.variables()).find(t=>t.label===e)||null},getWatermark:()=>V.state.watermark,init:()=>O.load(),load:()=>(0,T.httpService)().get(w+"/list").then(e=>{const{success:t,data:a}=e.data;if(!t)throw new Error("Unexpected response from server");return a}).then(e=>{const{variables:t,watermark:a}=e;return V.fill(t,a),x.update(t),t}),create:({type:e,label:t,value:a})=>((e,t,a)=>(0,T.httpService)().post(w+"/create",{type:e,label:t,value:a}))(e,t,a).then(e=>{const{success:t,data:a}=e.data;if(!t){const e=a?.message||(0,d.__)("Unexpected response from server","elementor");throw new Error(e)}return a}).then(e=>{const{variable:t,watermark:a}=e;D(P,a);const{id:r,...n}=t;return V.add(r,n),x.update({[r]:n}),{id:r,variable:n}}),update:(e,{label:t,value:a,type:r})=>((e,t,a,r)=>(0,T.httpService)().put(w+"/update",{id:e,label:t,value:a,type:r}))(e,t,a,r).then(e=>{const{success:t,data:a}=e.data;if(!t){const e=a?.message||(0,d.__)("Unexpected response from server","elementor");throw new Error(e)}return a}).then(e=>{const{variable:t,watermark:a}=e;D(P,a);const{id:r,...n}=t;return V.update(r,n),x.update({[r]:n}),{id:r,variable:n}}),delete:e=>(e=>(0,T.httpService)().post(w+"/delete",{id:e}))(e).then(e=>{const{success:t,data:a}=e.data;if(!t)throw new Error("Unexpected response from server");return a}).then(e=>{const{variable:t,watermark:a}=e;D(P,a);const{id:r,...n}=t;return V.update(r,n),x.update({[r]:n}),{id:r,variable:n}}),restore:(e,t,a,r)=>((e,t,a,r)=>{const n={id:e};return t&&(n.label=t),a&&(n.value=a),r&&(n.type=r),(0,T.httpService)().post(w+"/restore",n)})(e,t,a,r).then(e=>{const{success:t,data:a}=e.data;if(!t)throw new Error("Unexpected response from server");return a}).then(e=>{const{variable:t,watermark:a}=e;D(P,a);const{id:r,...n}=t;return V.update(r,n),x.update({[r]:n}),{id:r,variable:n}}),batchSave:(e,t,a)=>{const r=((e,t,a)=>{const r=[];return Object.entries(t).forEach(([t,a])=>{if(S(t))r.push({type:"create",variable:{...a,id:t}});else if(e[t]){const n=e[t];n.deleted&&!a.deleted?r.push({type:"restore",id:t,...n.label!==a.label&&{label:a.label},...n.value!==a.value&&{value:a.value}}):a.deleted||n.label===a.label&&n.value===a.value&&n.order===a.order&&n.type===a.type||r.push({type:"update",id:t,variable:{...n.label!==a.label&&{label:a.label},...n.value!==a.value&&{value:a.value},...n.order!==a.order&&{order:a.order},...n.type!==a.type&&{type:a.type}}})}}),a.forEach(e=>{r.push({type:"delete",id:e})}),r.filter(e=>{const a=e.id||e.variable?.id;return a&&!(S(a)&&t[a]?.deleted)})})(e,t,a),n={operations:r,watermark:V.state.watermark};return 0===r.length?Promise.resolve({success:!0,watermark:V.state.watermark,operations:0}):(l=n,(0,T.httpService)().post(w+"/batch",l)).then(e=>{const{success:t,data:a}=e.data;if(!t)throw new Error("Unexpected response from server");return a}).then(e=>{const{results:t,watermark:a}=e;return D(P,a),t&&t.forEach(e=>{if(e.variable){const{id:t,...a}=e.variable;"create"===e.type?V.add(t,a):V.update(t,a),x.update({[t]:a})}}),{success:!0,watermark:a,operations:r.length}});var l}},D=(e,t)=>{V.watermarkDiff(e,t)&&setTimeout(()=>O.load(),500),V.watermark(t)},B=(e,t)=>{let a=e,r="";if(t&&(r=t.value),t&&!t.deleted&&(a=t.label),!a.trim())return null;const n=`--${a}`;return r.trim()?`var(${n}, ${r})`:`var(${n})`},L=(0,y.createTransformer)(e=>{const t=O.variables()[e];if(!t)return o.createElement("span",null,(0,d.__)("Missing variable","elementor"));const a=t.type===_.key,r=B(e,t);return o.createElement(u.Stack,{direction:"row",spacing:.5,sx:{paddingInline:"1px"},alignItems:"center"},a&&o.createElement(f,{size:"inherit",value:t.value}),o.createElement(u.Typography,{variant:"caption",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},r))}),R=(0,y.createTransformer)(e=>{const t=O.variables()[e]||O.findVariableByLabel(e);if(!t)return null;const a=O.findIdByLabel(t.label);return B(a,t)}),{registerVariableType:z,getVariableType:U,getVariableTypes:M,hasVariableType:F}=function(){const e={};return{registerVariableType:({key:t,icon:a,startIcon:n,valueField:l,propTypeUtil:o,variableType:i,defaultValue:s,selectionFilter:c,valueTransformer:u,styleTransformer:d,fallbackPropTypeUtil:p,isCompatible:m,emptyState:b,isActive:v=!0})=>{const g=t??o.key;m||(m=(e,t)=>"union"===e.kind&&t.type in e.prop_types),e[g]={icon:a,startIcon:n,valueField:l,propTypeUtil:o,variableType:i,defaultValue:s,selectionFilter:c,valueTransformer:u,fallbackPropTypeUtil:p,isCompatible:m,emptyState:b,isActive:v},((e,t)=>{y.styleTransformersRegistry.register(e,t??R)})(o.key,d),(e=>{r.stylesInheritanceTransformersRegistry.register(e,L)})(o.key)},getVariableType:t=>e[t],getVariableTypes:()=>e,hasVariableType:t=>t in e&&!!e[t].isActive}}(),N=({open:e,label:t,closeDialog:a,onConfirm:r})=>o.createElement(i.ConfirmationDialog,{open:e,onClose:a},o.createElement(i.ConfirmationDialog.Title,null,(0,d.__)("Delete this variable?","elementor")),o.createElement(i.ConfirmationDialog.Content,null,o.createElement(i.ConfirmationDialog.ContentText,null,(0,d.__)("All elements using","elementor")," ",o.createElement(u.Typography,{variant:"subtitle2",component:"span",sx:{lineBreak:"anywhere"}},t)," ",(0,d.__)("will keep their current values, but the variable itself will be removed.","elementor"))),o.createElement(i.ConfirmationDialog.Actions,{onClose:a,onConfirm:r}));var j=window.elementorV2.editorCurrentUser;const W=()=>{const{canUser:e,isAdmin:t}=(0,j.useCurrentUserCapabilities)();return{canAssign:()=>e("edit_posts"),canUnlink:()=>e("edit_posts"),canAdd:()=>t,canDelete:()=>t,canEdit:()=>t,canRestore:()=>t,canManageSettings:()=>t}},H=({icon:e,title:t,message:a,onAdd:r,children:n})=>{const l=W().canAdd(),i=l?t:(0,d.__)("There are no variables","elementor"),s=l?a:(0,d.__)("With your current role, you can only connect and detach variables.","elementor");return o.createElement(G,{title:i,message:s,icon:e},n||r&&o.createElement(u.Button,{variant:"outlined",color:"secondary",size:"small",onClick:r},(0,d.__)("Create a variable","elementor")))};function G({title:e,message:t,icon:a,children:r}){return o.createElement(u.Stack,{gap:1,alignItems:"center",justifyContent:"flex-start",height:"100%",color:"text.secondary",sx:{p:2.5,pt:8,pb:5.5}},a,o.createElement(u.Typography,{align:"center",variant:"subtitle2"},e),o.createElement(u.Typography,{align:"center",variant:"caption",maxWidth:"180px"},t),r)}const $=({searchValue:e,onClear:t,icon:a})=>o.createElement(u.Stack,{gap:1,alignItems:"center",justifyContent:"center",p:2.5,color:"text.secondary",sx:{pb:3.5,pt:8}},a,o.createElement(u.Typography,{align:"center",variant:"subtitle2"},(0,d.__)("Sorry, nothing matched","elementor"),o.createElement("br",null),"“",e,"”."),o.createElement(u.Typography,{align:"center",variant:"caption",sx:{display:"flex",flexDirection:"column"}},(0,d.__)("Try something else.","elementor"),o.createElement(u.Link,{color:"text.secondary",variant:"caption",component:"button",onClick:t},(0,d.__)("Clear & try again","elementor"))));var K=window.elementorV2.editorControls;const q=(0,o.createContext)(null);function X({children:e,propTypeKey:t}){return o.createElement(q.Provider,{value:t},e)}function J(){const e=(0,o.useContext)(q);if(null===e)throw new Error("useVariableType must be used within a VariableTypeProvider");return U(e)}function Y(e,t){const a=t.toLowerCase();return e.filter(e=>e.label.toLowerCase().includes(a))}const Z=e=>Object.entries(e).map(([e,t])=>({key:e,...t})),Q=({key:e,label:t,value:a,order:r})=>({key:e,label:t,value:a,order:r}),ee=(e=!0)=>{const t=O.variables();return e?t:Object.fromEntries(Object.entries(t).filter(([,e])=>!e.deleted))},te=e=>{const t=ee();return t?.[e]?{...t[e],key:e}:null},ae=e=>{const t=ee(!1),a=(e=>{const t=[],a=M(),r=U(e);return Object.entries(a).forEach(([e,a])=>{r.variableType===a.variableType&&t.push(e)}),t})(e);return Z(t).filter(e=>a.includes(e.type)).map(Q)},re=({id:e})=>e,ne=(e,t,a,r)=>O.restore(e,t,a,r).then(re);var le=window.elementorV2.utils;function oe(){return{hasPro:!!window.elementorPro}}const ie=e=>{const t=((window.ElementorVariablesQuotaConfig||{})[e]||0)>0;return{canAdd:()=>t||oe().hasPro,canEdit:()=>t||oe().hasPro}};function se(){return se=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)({}).hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},se.apply(null,arguments)}const ce="tiny",ue=({variables:e,onCreate:t,disabled:a,menuState:r})=>{const n=(0,o.useRef)(null),l=M(),i=(0,o.useMemo)(()=>Object.entries(l).filter(([,e])=>!!e.defaultValue).map(([e,t])=>({key:e,propTypeKey:t.propTypeUtil.key,variableType:t.variableType,defaultValue:t.defaultValue||"",icon:t.icon})),[l]);return o.createElement(o.Fragment,null,o.createElement(u.IconButton,se({},(0,u.bindTrigger)(r),{ref:n,disabled:a,size:ce,"aria-label":(0,d.__)("Add variable","elementor")}),o.createElement(c.PlusIcon,{fontSize:ce})),o.createElement(u.Menu,se({disablePortal:!0,MenuListProps:{dense:!0},PaperProps:{elevation:6}},(0,u.bindMenu)(r),{anchorEl:n.current,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},"data-testid":"variable-manager-create-menu"}),i.map(a=>o.createElement(de,{key:a.key,config:a,variables:e,onCreate:t,onClose:r.close}))))},de=({config:e,variables:t,onCreate:a,onClose:r})=>{const[n,l]=(0,o.useState)(!1),s=ie(e.propTypeKey),c=(0,le.capitalize)(e.variableType),p=!s.canAdd(),m=(0,d.sprintf)((0,d.__)("%s variables","elementor"),(0,le.capitalize)(e.variableType)),v=(0,d.sprintf)((0,d.__)("Upgrade to continue creating and editing %s variables.","elementor"),e.variableType);return o.createElement(u.MenuItem,{onClick:()=>{if(p)return void(n||l(!0));const o=pe(t,e.key,e.variableType);a(e.key,o,e.defaultValue),b({action:"add",varType:e.variableType}),r()},sx:{gap:1.5,cursor:"pointer"}},(0,o.createElement)(e.icon,{fontSize:ce,color:p?"disabled":"action"}),o.createElement(u.Typography,{variant:"caption",color:p?"text.disabled":"text.primary"},c),p&&o.createElement(i.PromotionPopover,{open:n,title:m,content:v,ctaText:(0,d.__)("Upgrade now","elementor"),ctaUrl:`https://go.elementor.com/go-pro-manager-${e.variableType}-variable/`,onClose:()=>{l(!1)}},o.createElement(i.PromotionChip,null)))},pe=(e,t,a)=>{const r=Object.values(e).filter(e=>e.type===t).map(e=>e.label);let n=1,l=`${a}-${n}`;for(;r.includes(l);)n++,l=`${a}-${n}`;return l};function me(){return me=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)({}).hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},me.apply(null,arguments)}function be(e,t){return e.trim().toLowerCase()===t.trim().toLowerCase()}const ve=e=>{const[t,a]=(0,o.useState)(e??{value:"",message:""});return{labelFieldError:t,setLabelFieldError:a}},ge=({value:e,error:t,onChange:a,id:r,onErrorChange:n,size:l="tiny",focusOnShow:s=!1,selectOnShow:c=!1,showWarningInfotip:d=!1,variables:p,onKeyDown:m})=>{const[b,g]=(0,o.useState)(e),[h,y]=(0,o.useState)(""),f=(0,o.useRef)(null);let C=h;be(b,t?.value??"")&&t?.message&&(C=t.message);const _=C?"":E(b),T=o.createElement(u.TextField,{ref:f,id:r,size:l,fullWidth:!0,value:b,error:!!C,onChange:e=>(e=>{g(e);const r=((e,t)=>e.trim()?/^[a-zA-Z0-9_-]+$/.test(e)?/[a-zA-Z0-9]/.test(e)?50<e.length?v.VARIABLE_LABEL_MAX_LENGTH:Object.values(t??{}).some(t=>t.label===e)?v.DUPLICATED_LABEL:"":v.NO_NON_SPECIAL_CHARACTER:v.INVALID_CHARACTERS:v.MISSING_VARIABLE_NAME)(e,p);y(r),n?.(r),a(be(e,t?.value??"")||r?"":e)})(e.target.value),inputProps:{maxLength:50,...c&&{onFocus:e=>e.target.select()},"aria-label":"Name",onKeyDown:m},autoFocus:s});if(d){const e=Math.max(240,f.current?.getBoundingClientRect().width??240);return o.createElement(i.WarningInfotip,me({open:Boolean(C||_),text:C||_,placement:"bottom-start",width:e,offset:[0,-15]},_&&{hasError:!1}),T)}return T};function Ee(){return Ee=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)({}).hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},Ee.apply(null,arguments)}const he=({menuActions:e,disabled:t,itemId:a})=>{const r=(0,u.usePopupState)({variant:"popover"});return o.createElement(o.Fragment,null,o.createElement(u.IconButton,Ee({},(0,u.bindTrigger)(r),{disabled:t,size:"tiny"}),o.createElement(c.DotsVerticalIcon,{fontSize:"tiny"})),o.createElement(u.Menu,Ee({disablePortal:!0,MenuListProps:{dense:!0},PaperProps:{elevation:6}},(0,u.bindMenu)(r),{anchorEl:r.anchorEl,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},open:r.isOpen,onClose:r.close}),e.map(e=>o.createElement(u.MenuItem,{key:e.name,onClick:()=>{e.onClick?.(a),r.close()},sx:{color:e.color,gap:1}},e.icon&&(0,o.createElement)(e.icon,{fontSize:"inherit"})," ",e.name))))},ye=({children:e,isHeader:t,width:a,maxWidth:r,align:n,noPadding:l,sx:i})=>{const s={maxWidth:r??150,cursor:"initial",typography:"caption",...t&&{color:"text.primary",fontWeight:"bold"},...t&&!l&&{padding:"10px 16px"},...a&&{width:a},...i};return o.createElement(u.TableCell,{size:"small",padding:l?"none":void 0,align:n,sx:s},e)},fe=o.memo(({initialValue:e,children:t,editableElement:a,onChange:r,prefixElement:n,autoEdit:l=!1,onRowRef:i,onAutoEditComplete:s,gap:c=1,fieldType:d})=>{const[p,m]=(0,o.useState)(e),[b,v]=(0,o.useState)(!1),{labelFieldError:g,setLabelFieldError:E}=ve(),[h,y]=(0,o.useState)(""),f=(0,o.useRef)(null),C=(0,o.useCallback)(()=>{"label"===d&&g?.message||"value"===d&&h||r(p),v(!1)},[p,r,d,g,h]);(0,o.useEffect)(()=>{i?.(f?.current)},[i]),(0,o.useEffect)(()=>{l&&!b&&(v(!0),s?.())},[l,b,s]);const _=()=>{v(!0)},T=e=>{"Enter"===e.key?C():"Escape"===e.key&&v(!1)," "!==e.key||b||(e.preventDefault(),v(!0))},w=(0,o.useCallback)(e=>{m(e)},[]),S=(0,o.useCallback)(e=>{"label"===d?E({value:p,message:e}):y(e)},[d,p,E,y]);let k;"label"===d?k=g:"value"===d&&(k={value:p,message:h});const I=a({value:p,onChange:w,onValidationChange:S,error:k});return b?o.createElement(u.ClickAwayListener,{onClickAway:C},o.createElement(u.Stack,{ref:f,direction:"row",alignItems:"center",gap:c,onDoubleClick:_,onKeyDown:T,tabIndex:0,role:"button","aria-label":"Double click or press Space to edit"},n,I)):o.createElement(u.Stack,{ref:f,direction:"row",alignItems:"center",gap:c,onDoubleClick:_,onKeyDown:T,tabIndex:0,role:"button","aria-label":"Double click or press Space to edit"},n,t)});function Ce(){return Ce=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)({}).hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},Ce.apply(null,arguments)}const _e=({menuActions:e,variables:t,onChange:a,autoEditVariableId:r,onAutoEditComplete:n,onFieldError:l})=>{const s=(0,o.useRef)(null),p=(0,o.useRef)(new Map);(0,o.useEffect)(()=>{if(r&&s.current){const e=p.current.get(r);e&&setTimeout(()=>{e.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})},100)}},[r]);const m=e=>t=>{t?p.current.set(e,t):p.current.delete(e)},b=Object.keys(t).sort(function(e){return(t,a)=>(e[t]?.order??Number.MAX_SAFE_INTEGER)-(e[a]?.order??Number.MAX_SAFE_INTEGER)}(t)),v=b.map(e=>{const a=t[e],r=U(a.type);return r?{id:e,type:a.type,name:a.label,value:a.value,...r}:null}).filter(Boolean),g={minWidth:250,tableLayout:"fixed"};return o.createElement(u.TableContainer,{ref:s,sx:{overflow:"initial"}},o.createElement(u.Table,{sx:g,"aria-label":"Variables manager list with drag and drop reordering",stickyHeader:!0},o.createElement(u.TableHead,null,o.createElement(u.TableRow,null,o.createElement(ye,{isHeader:!0,noPadding:!0,width:10,maxWidth:10}),o.createElement(ye,{isHeader:!0},(0,d.__)("Name","elementor")),o.createElement(ye,{isHeader:!0},(0,d.__)("Value","elementor")),o.createElement(ye,{isHeader:!0,noPadding:!0,width:16,maxWidth:16}))),o.createElement(u.TableBody,null,o.createElement(u.UnstableSortableProvider,{value:b,onChange:e=>{const r={...t};e.forEach((e,t)=>{const a=r[e];a&&(r[e]=Object.assign({},a,{order:t+1}))}),a(r)},variant:"static",restrictAxis:!0,dragOverlay:({children:e,...t})=>o.createElement(u.Table,Ce({sx:g},t),o.createElement(u.TableBody,null,e))},v.map(s=>o.createElement(u.UnstableSortableItem,{key:s.id,id:s.id,render:({itemProps:d,showDropIndication:p,triggerProps:b,itemStyle:v,triggerStyle:g,isDragged:E,dropPosition:h,setTriggerRef:y,isSorting:f})=>{const C=p&&"before"===h,_=p&&"after"===h;return o.createElement(u.TableRow,Ce({},d,{ref:d.ref,selected:E,sx:{...C&&{"& td, & th":{borderTop:"2px solid",borderTopColor:"primary.main"}},..._&&{"& td, & th":{borderBottom:"2px solid",borderBottomColor:"primary.main"}},'& [role="toolbar"], & [draggable]':{opacity:0},"&:hover, &:focus-within":{backgroundColor:"action.hover",'& [role="toolbar"], & [draggable]':{opacity:1}}},style:{...v,...g}}),o.createElement(ye,{noPadding:!0,width:10,maxWidth:10},o.createElement(u.IconButton,Ce({size:"small",ref:y},b,{disabled:f,draggable:!0}),o.createElement(c.GripVerticalIcon,{fontSize:"inherit"}))),o.createElement(ye,null,o.createElement(fe,{initialValue:s.name,onChange:e=>{e!==s.name&&a({...t,[s.id]:{...t[s.id],label:e}})},prefixElement:(0,o.createElement)(s.icon,{fontSize:"inherit"}),editableElement:({value:e,onChange:a,onValidationChange:n,error:i})=>o.createElement(ge,{id:"variable-label-"+s.id,size:"tiny",value:e,onChange:a,onErrorChange:e=>{n?.(e),l?.(!!e)},error:i,focusOnShow:!0,selectOnShow:r===s.id,showWarningInfotip:!0,variables:t}),autoEdit:r===s.id,onRowRef:m(s.id),onAutoEditComplete:r===s.id?n:void 0,fieldType:"label"},o.createElement(i.EllipsisWithTooltip,{title:s.name,sx:{border:"4px solid transparent"}},s.name))),o.createElement(ye,null,o.createElement(fe,{initialValue:s.value,onChange:e=>{e!==s.value&&a({...t,[s.id]:{...t[s.id],value:e}})},editableElement:({value:e,onChange:r,onValidationChange:n,error:i})=>s.valueField?.({value:e,onChange:r,onPropTypeKeyChange:e=>{a({...t,[s.id]:{...t[s.id],type:e}})},propTypeKey:s.type,onValidationChange:e=>{n?.(e),l?.(!!e)},error:i})??o.createElement(o.Fragment,null),onRowRef:m(s.id),gap:.25,fieldType:"value"},s.startIcon&&s.startIcon({value:s.value}),o.createElement(i.EllipsisWithTooltip,{title:s.value,sx:{border:"4px solid transparent",lineHeight:"1",pt:.25}},s.value))),o.createElement(ye,{align:"right",noPadding:!0,width:16,maxWidth:16,sx:{paddingInlineEnd:1}},o.createElement(u.Stack,{role:"toolbar",direction:"row",justifyContent:"flex-end"},o.createElement(he,{menuActions:e,disabled:f,itemId:s.id}))))}}))))))},Te="variables-manager",{panel:we,usePanelActions:Se}=(0,n.__createPanel)({id:Te,component:function(){const{close:e}=Se(),{open:t,close:a,isOpen:r}=(0,i.useDialog)(),l=(0,u.usePopupState)({variant:"popover"}),{variables:s,isDirty:p,searchValue:m,isSaveDisabled:v,handleOnChange:E,createVariable:h,handleDeleteVariable:y,handleSave:f,isSaving:C,handleSearch:_,setIsSaving:T,setIsSaveDisabled:w}=(()=>{const[e,t]=(0,o.useState)(()=>ee(!1)),[a,r]=(0,o.useState)([]),[n,l]=(0,o.useState)(!1),[i,s]=(0,o.useState)(!1),[c,u]=(0,o.useState)(!1),[d,p]=(0,o.useState)(""),m=(0,o.useCallback)(a=>{t({...e,...a}),s(!0)},[e]),b=(0,o.useCallback)((e,a,r)=>{const n=`tmp-${Date.now().toString(36)}-${Math.random().toString(36).substring(2,8)}`,l={id:n,label:a.trim(),value:r.trim(),type:e};return t(e=>({...e,[n]:l})),s(!0),n},[]),v=(0,o.useCallback)(e=>{r(t=>[...t,e]),t(t=>({...t,[e]:{...t[e],deleted:!0}})),s(!0)},[]),g=(0,o.useCallback)(async()=>{const n=ee(!1);u(!0);const l=await O.batchSave(n,e,a);if(l.success){await O.load();const e=O.variables();t(e),r([]),s(!1)}return{success:l.success}},[e,a]),E=(0,o.useCallback)(()=>{const t=((e,t)=>{const a={};return e.forEach(e=>(a[e.type]??=[]).push(e)),Object.entries(a).flatMap(([e,a])=>{const r=t[e]?.selectionFilter,n=a.map(Q);return(r?.(n)??n).map(t=>({...t,type:e}))})})(Z(e).filter(e=>!e.deleted),M()),a=Y(t,d);return Object.fromEntries(a.map(({key:e,...t})=>[e,t]))},[e,d]);return{variables:E(),deletedVariables:a,isDirty:i,isSaveDisabled:n,handleOnChange:m,createVariable:b,handleDeleteVariable:v,handleSave:g,isSaving:c,handleSearch:e=>{p(e)},searchValue:d,setIsSaving:u,setIsSaveDisabled:l}})(),{autoEditVariableId:S,startAutoEdit:k,handleAutoEditComplete:I}=(()=>{const[e,t]=(0,o.useState)(void 0);return{autoEditVariableId:e,startAutoEdit:(0,o.useCallback)(e=>{t(e)},[]),handleAutoEditComplete:(0,o.useCallback)(()=>{setTimeout(()=>{t(void 0)},100)},[])}})(),{createNavigationCallback:P,resetNavigation:A}=(()=>{const e=(0,o.useRef)(0);return{createNavigationCallback:(0,o.useCallback)((t,a,r)=>()=>{if(!t?.length)return;const n=e.current,l=t[n];if(l){a(l);const o=n+1;o>=t.length?(r(),e.current=0):e.current=o}},[]),resetNavigation:(0,o.useCallback)(()=>{e.current=0},[])}})(),[x,V]=(0,o.useState)(null),[D,B]=(0,o.useState)(null);ke(p);const L=(0,o.useCallback)((e,t,a)=>{const r=h(e,t,a);r&&k(r)},[h,k]),R=async()=>{try{B(null),A();const e=await f();return b({action:"saveChanges"}),e}catch(e){const t=g(e),a=t?.action?.data?.duplicatedIds;return t&&"label"===t.field&&(a&&t.action&&(t.action.callback=P(a,k,()=>{w(!1)})),B(t),w(!0),A()),{success:!1,error:t}}finally{T(!1)}},z=(0,o.useCallback)(e=>{y(e),V(null)},[y]),F=[{name:(0,d.__)("Delete","elementor"),icon:c.TrashIcon,color:"error.main",onClick:e=>{const t=s[e];if(t){V({id:e,label:t.label});const a=U(t.type);b({action:"delete",varType:a?.variableType})}}}],j=Object.keys(s).length>0;return o.createElement(i.ThemeProvider,null,o.createElement(n.Panel,null,o.createElement(n.PanelHeader,{sx:{height:"unset"}},o.createElement(u.Stack,{width:"100%",direction:"column",alignItems:"center"},o.createElement(u.Stack,{p:1,pl:2,width:"100%",direction:"row",alignItems:"center"},o.createElement(u.Stack,{width:"100%",direction:"row",gap:1},o.createElement(n.PanelHeaderTitle,{sx:{display:"flex",alignItems:"center",gap:.5}},o.createElement(c.ColorFilterIcon,{fontSize:"inherit"}),(0,d.__)("Variables Manager","elementor"))),o.createElement(u.Stack,{direction:"row",gap:.5,alignItems:"center"},o.createElement(ue,{onCreate:L,variables:s,menuState:l}),o.createElement(u.CloseButton,{"aria-label":"Close",slotProps:{icon:{fontSize:ce}},onClick:()=>{p?t():e()}}))),o.createElement(u.Stack,{width:"100%",direction:"row",gap:1},o.createElement(i.SearchField,{sx:{display:"flex",flex:1},placeholder:(0,d.__)("Search","elementor"),value:m,onSearch:_})),o.createElement(u.Divider,{sx:{width:"100%"}}))),o.createElement(n.PanelBody,{sx:{display:"flex",flexDirection:"column",height:"100%"}},j&&o.createElement(_e,{menuActions:F,variables:s,onChange:E,autoEditVariableId:S,onAutoEditComplete:I,onFieldError:w}),!j&&m&&o.createElement($,{searchValue:m,onClear:()=>_(""),icon:o.createElement(c.ColorFilterIcon,{fontSize:"large"})}),!j&&!m&&o.createElement(H,{title:(0,d.__)("Create your first variable","elementor"),message:(0,d.__)("Variables are saved attributes that you can apply anywhere on your site.","elementor"),icon:o.createElement(c.ColorFilterIcon,{fontSize:"large"}),onAdd:l.open})),o.createElement(n.PanelFooter,null,o.createElement(u.Infotip,{placement:"right",open:!!D,content:D?o.createElement(u.Alert,{severity:D.severity??"error",action:D.action?.label?o.createElement(u.AlertAction,{onClick:D.action.callback},D.action.label):void 0,onClose:D.action?.label?void 0:()=>{B(null),w(!1)},icon:D.IconComponent?o.createElement(D.IconComponent,null):o.createElement(c.AlertTriangleFilledIcon,null)},o.createElement(u.AlertTitle,null,D.message),D.action?.message):null,arrow:!1,slotProps:{popper:{modifiers:[{name:"offset",options:{offset:[-10,10]}}]}}},o.createElement(u.Button,{fullWidth:!0,size:"small",color:"global",variant:"contained",disabled:v||!p||C,onClick:R,loading:C},(0,d.__)("Save changes","elementor"))))),x&&o.createElement(N,{open:!0,label:x.label,onConfirm:()=>z(x.id),closeDialog:()=>V(null)}),r&&o.createElement(i.SaveChangesDialog,null,o.createElement(i.SaveChangesDialog.Title,{onClose:a},(0,d.__)("You have unsaved changes","elementor")),o.createElement(i.SaveChangesDialog.Content,null,o.createElement(i.SaveChangesDialog.ContentText,null,(0,d.__)("To avoid losing your updates, save your changes before leaving.","elementor"))),o.createElement(i.SaveChangesDialog.Actions,{actions:{discard:{label:(0,d.__)("Discard","elementor"),action:()=>{a(),e()}},confirm:{label:(0,d.__)("Save","elementor"),action:async()=>{const t=await R();a(),t?.success&&e()}}}})))},allowedEditModes:["edit",Te],onOpen:()=>{(0,s.changeEditMode)(Te)},onClose:async()=>{(0,s.changeEditMode)("edit")},isOpenPreviousElement:!0}),ke=e=>{(0,o.useEffect)(()=>{const t=t=>{e&&t.preventDefault()};return window.addEventListener("beforeunload",t),()=>{window.removeEventListener("beforeunload",t)}},[e])};function Ie(e,t,a){return()=>{const{fallbackPropTypeUtil:r}=U(t),n=function(e,t){const{valueTransformer:a}=U(t);return a?a(e.value,e.type):e.value}(e,t);a(r.create(n))}}const Pe=(0,o.createContext)(null),Ae=({children:e})=>{const[t,a]=(0,o.useState)(null);return o.createElement(Pe.Provider,{value:t},o.createElement(u.Box,{ref:a},e))},xe=()=>(0,o.useContext)(Pe),Ve=()=>{const{propTypeUtil:e}=J(),t=(0,K.useBoundProp)(e);return{...t,setVariableValue:e=>Oe(e,t),variableId:t.value??t.placeholder}},Oe=(e,t)=>{const a=De(t.value),r=De(t.placeholder),n=De(e);return a||r!==n?t.setValue(e):t.setValue(null)},De=e=>(0,l.isTransformable)(e)?e.value:e,Be=({id:e,label:t,errorMsg:a,noticeMsg:r,children:n})=>o.createElement(u.Grid,{container:!0,gap:.75,alignItems:"center"},o.createElement(u.Grid,{item:!0,xs:12},o.createElement(u.FormLabel,{htmlFor:e,size:"tiny"},t)),o.createElement(u.Grid,{item:!0,xs:12},n,a&&o.createElement(u.FormHelperText,{error:!0},a),r&&o.createElement(u.FormHelperText,null,r))),Le="tiny",Re=({onGoBack:e,onClose:t})=>{const{icon:a,valueField:n,variableType:l,propTypeUtil:s}=J(),{setVariableValue:p,path:b}=Ve(),{propType:h}=(0,K.useBoundProp)(),y=(()=>{const{value:e}=(0,K.useBoundProp)(),t=F(e?.$$type)&&Boolean(e?.value),a=te(t?e.value:"");return t?a?a.value:"":e?.value??""})(),[f,C]=(0,o.useState)(y),[_,T]=(0,o.useState)(""),[w,S]=(0,o.useState)(""),[k,I]=(0,o.useState)(""),[P,A]=(0,o.useState)(s.key),{labelFieldError:x,setLabelFieldError:V}=ve(),D=()=>{C(""),T(""),S(""),I(""),t()},B=()=>{var e;(e={value:f,label:_,type:P},O.create(e).then(re)).then(e=>{p(e),D()}).catch(e=>{const t=g(e);if(t&&"label"===t.field)return T(""),void V({value:_,message:t.message});S(v.UNEXPECTED_ERROR)}),m({varType:l,controlPath:b.join("."),action:"save"})},L=""===_.trim()||("string"==typeof f?""===f.trim():!1===Boolean(f))||!!w,R=e=>{"Enter"!==e.key||L||(e.preventDefault(),B())};return o.createElement(r.PopoverBody,{height:"auto"},o.createElement(i.PopoverHeader,{icon:o.createElement(o.Fragment,null,e&&o.createElement(u.IconButton,{size:Le,"aria-label":(0,d.__)("Go Back","elementor"),onClick:e},o.createElement(c.ArrowLeftIcon,{fontSize:Le})),o.createElement(a,{fontSize:Le})),title:(0,d.__)("Create variable","elementor"),onClose:D}),o.createElement(u.Divider,null),o.createElement(K.PopoverContent,{p:2},o.createElement(Be,{id:"variable-label",label:(0,d.__)("Name","elementor"),errorMsg:x?.message,noticeMsg:E(_)},o.createElement(ge,{id:"variable-label",value:_,error:x,onChange:e=>{T(e),S("")},onErrorChange:e=>{V({value:_,message:e})},onKeyDown:R})),n&&o.createElement(Be,{errorMsg:k,label:(0,d.__)("Value","elementor")},o.createElement(u.Typography,{variant:"h5",id:"variable-value-wrapper"},o.createElement(n,{value:f,onPropTypeKeyChange:e=>A(e),onChange:e=>{C(e),S(""),I("")},onValidationChange:I,propType:h,onKeyDown:R}))),w&&o.createElement(u.FormHelperText,{error:!0},w)),o.createElement(u.CardActions,{sx:{pt:.5,pb:1}},o.createElement(u.Button,{id:"create-variable-button",size:"small",variant:"contained",disabled:L,onClick:B},(0,d.__)("Create","elementor"))))},ze=({closeDialog:e,onConfirm:t,onSuppressMessage:a})=>{const[r,n]=(0,o.useState)(!1);return o.createElement(u.Dialog,{open:!0,onClose:e,maxWidth:"xs"},o.createElement(u.DialogTitle,{display:"flex",alignItems:"center",gap:1},o.createElement(c.AlertTriangleFilledIcon,{color:"secondary"}),(0,d.__)("Changes to variables go live right away.","elementor")),o.createElement(u.DialogContent,null,o.createElement(u.DialogContentText,{variant:"body2",color:"textPrimary"},(0,d.__)("Don't worry - all other changes you make will wait until you publish your site.","elementor"))),o.createElement(u.DialogActions,{sx:{justifyContent:"space-between",alignItems:"center"}},o.createElement(u.FormControlLabel,{control:o.createElement(u.Checkbox,{checked:r,onChange:e=>n(e.target.checked),size:"small"}),label:o.createElement(u.Typography,{variant:"body2"},(0,d.__)("Don't show me again","elementor"))}),o.createElement("div",null,o.createElement(u.Button,{color:"secondary",onClick:e},(0,d.__)("Keep editing","elementor")),o.createElement(u.Button,{variant:"contained",color:"secondary",onClick:()=>{r&&a?.(),t?.()},sx:{ml:1}},(0,d.__)("Save","elementor")))))},Ue="tiny",Me=(0,d.__)("Delete variable","elementor"),Fe=({onClose:e,onGoBack:t,onSubmit:a,editId:n})=>{const{icon:l,valueField:s,variableType:p,propTypeUtil:m}=J(),{setVariableValue:b,variableId:h}=Ve(),{propType:y}=(0,K.useBoundProp)(),[f,C]=(0,j.useSuppressedMessage)("edit-confirmation-dialog"),[_,T]=(0,o.useState)(!1),[w,S]=(0,o.useState)(!1),[k,I]=(0,o.useState)(""),[P,A]=(0,o.useState)(""),{labelFieldError:V,setLabelFieldError:D}=ve(),B=te(n),[L,R]=(0,o.useState)(B?.type??m.key);if(!B)throw new Error(`Global ${p} variable not found`);const z=W(),[U,M]=(0,o.useState)(()=>B.value),[F,H]=(0,o.useState)(()=>B.label);(0,o.useEffect)(()=>(x.update({[n]:{...B,value:U}}),()=>{x.update({[n]:{...B}})}),[n,U,B]);const G=()=>{f?$():S(!0)},$=()=>{const e=L!==B.type;((e,{value:t,label:a,type:r})=>O.update(e,{value:t,label:a,type:r}).then(re))(n,e?{value:U,label:F,type:L}:{value:U,label:F}).then(()=>{q(),a?.()}).catch(e=>{const t=g(e);if(t&&"label"===t.field)return H(""),void D({value:F,message:t.message});I(v.UNEXPECTED_ERROR)})},q=()=>{n===h&&b(n)},X=[];z.canDelete()&&X.push(o.createElement(u.Tooltip,{key:"delete",placement:"top",title:Me},o.createElement(u.IconButton,{size:Ue,onClick:()=>{T(!0)},"aria-label":Me},o.createElement(c.TrashIcon,{fontSize:Ue}))));const Y=U===B.value&&F===B.label||""===F.trim()||("string"==typeof U?""===U.trim():!1===Boolean(U))||!!k,Z=e=>{"Enter"!==e.key||Y||(e.preventDefault(),G())};return o.createElement(o.Fragment,null,o.createElement(r.PopoverBody,{height:"auto"},o.createElement(i.PopoverHeader,{title:(0,d.__)("Edit variable","elementor"),onClose:e,icon:o.createElement(o.Fragment,null,t&&o.createElement(u.IconButton,{size:Ue,"aria-label":(0,d.__)("Go Back","elementor"),onClick:t},o.createElement(c.ArrowLeftIcon,{fontSize:Ue})),o.createElement(l,{fontSize:Ue})),actions:X}),o.createElement(u.Divider,null),o.createElement(K.PopoverContent,{p:2},o.createElement(Be,{id:"variable-label",label:(0,d.__)("Name","elementor"),errorMsg:V?.message,noticeMsg:E(F)},o.createElement(ge,{id:"variable-label",value:F,error:V,onChange:e=>{H(e),I("")},onErrorChange:e=>{D({value:F,message:e})},onKeyDown:Z})),s&&o.createElement(Be,{errorMsg:P,label:(0,d.__)("Value","elementor")},o.createElement(u.Typography,{variant:"h5"},o.createElement(s,{propTypeKey:B.type,onPropTypeKeyChange:e=>R(e),value:U,onChange:e=>{M(e),I(""),A("")},onKeyDown:Z,onValidationChange:A,propType:y}))),k&&o.createElement(u.FormHelperText,{error:!0},k)),o.createElement(u.CardActions,{sx:{pt:.5,pb:1}},o.createElement(u.Button,{size:"small",variant:"contained",disabled:Y,onClick:G},(0,d.__)("Save","elementor")))),_&&o.createElement(N,{open:!0,label:F,onConfirm:()=>{var e;(e=n,O.delete(e).then(re)).then(()=>{q(),a?.()})},closeDialog:()=>{T(!1)}}),w&&!f&&o.createElement(ze,{closeDialog:()=>{S(!1)},onConfirm:$,onSuppressMessage:C}))},Ne=(0,d.__)("Edit variable","elementor"),je=({item:e})=>{const t=e.onEdit;return o.createElement(o.Fragment,null,o.createElement(u.ListItemIcon,null,e.icon),o.createElement(u.Box,{sx:{flex:1,minWidth:0,display:"flex",alignItems:"center",gap:1}},o.createElement(i.EllipsisWithTooltip,{title:e.label||e.value,as:u.Typography,variant:"caption",color:"text.primary",sx:{marginTop:"1px",lineHeight:"2"},maxWidth:"50%"}),e.secondaryText&&o.createElement(i.EllipsisWithTooltip,{title:e.secondaryText,as:u.Typography,variant:"caption",color:"text.tertiary",sx:{marginTop:"1px",lineHeight:"1"},maxWidth:"50%"})),!!t&&o.createElement(u.Tooltip,{placement:"top",title:Ne},o.createElement(u.IconButton,{sx:{mx:1,opacity:"0"},onClick:a=>{a.stopPropagation(),t(e.value)},"aria-label":Ne},o.createElement(c.EditIcon,{color:"action",fontSize:"tiny"}))))},We=(0,u.styled)(u.MenuList)(({theme:e})=>({"& > li":{height:32,width:"100%",display:"flex",alignItems:"center"},'& > [role="option"]':{...e.typography.caption,lineHeight:"inherit",padding:e.spacing(.5,1,.5,2),"&:hover, &:focus":{backgroundColor:e.palette.action.hover},'&[aria-selected="true"]':{backgroundColor:e.palette.action.selected},cursor:"pointer",textOverflow:"ellipsis",position:"absolute",top:0,left:0,"&:hover .MuiIconButton-root, .MuiIconButton-root:focus":{opacity:1}},width:"100%",position:"relative"})),He="tiny",Ge=(0,d.__)("Create variable","elementor"),$e=(0,d.__)("Variables Manager","elementor"),Ke=({closePopover:e,onAdd:t,onEdit:a,onSettings:n,disabled:l=!1})=>{const{icon:s,startIcon:p,variableType:v,propTypeUtil:g,emptyState:E}=J(),{value:h,setValue:y,path:f}=Ve(),[C,_]=(0,o.useState)(""),{list:T,hasMatches:w,isSourceNotEmpty:S,hasNoCompatibleVariables:k}=((e,t)=>{const a=(l=t,(0,o.useMemo)(()=>ae(l),[l])),r=(e=>{const{selectionFilter:t}=J(),{propType:a}=(0,K.useBoundProp)();return t?t(e,a):e})(a),n=Y(r,e);var l;return{list:n.sort((e,t)=>(e.order??Number.MAX_SAFE_INTEGER)-(t.order??Number.MAX_SAFE_INTEGER)),hasMatches:n.length>0,isSourceNotEmpty:r.length>0,hasNoCompatibleVariables:a.length>0&&0===r.length}})(C,g.key),I=[];if(t&&I.push(o.createElement(u.Tooltip,{key:"add",placement:"top",title:Ge},o.createElement("span",null,o.createElement(u.IconButton,{id:"add-variable-button",size:He,onClick:()=>{t?.(),m({varType:v,controlPath:f.join("."),action:"add"})},"aria-label":Ge,disabled:l},o.createElement(c.PlusIcon,{fontSize:He}))))),n){const e=()=>{n(),b({action:"openManager",varType:v,controlPath:f.join(".")})};I.push(o.createElement(u.Tooltip,{key:"settings",placement:"top",title:$e},o.createElement(u.IconButton,{id:"variables-manager-button",size:He,onClick:e,"aria-label":$e},o.createElement(c.SettingsIcon,{fontSize:He}))))}const P=p||(()=>o.createElement(s,{fontSize:He})),A=T.map(({value:e,label:t,key:r})=>({type:"item",value:r,label:t,icon:o.createElement(P,{value:e}),secondaryText:e,onEdit:a?()=>a?.(r):void 0}));return o.createElement(r.PopoverBody,null,o.createElement(i.PopoverHeader,{title:(0,d.__)("Variables","elementor"),icon:o.createElement(c.ColorFilterIcon,{fontSize:He}),onClose:e,actions:I}),S&&o.createElement(i.SearchField,{value:C,onSearch:e=>{_(e)},placeholder:(0,d.__)("Search","elementor")}),o.createElement(u.Divider,null),S&&w&&o.createElement(i.PopoverMenuList,{items:A,onSelect:t=>{y(t),m({varType:v,controlPath:f.join("."),action:"connect"}),e()},onClose:()=>{},selectedValue:h,"data-testid":`${v}-variables-list`,menuListTemplate:We,menuItemContentTemplate:e=>o.createElement(je,{item:e})}),!w&&S&&o.createElement($,{searchValue:C,onClear:()=>{_("")},icon:o.createElement(s,{fontSize:"large"})}),l&&o.createElement(H,{title:(0,d.sprintf)((0,d.__)("No %s variables yet","elementor"),v),message:(0,d.sprintf)((0,d.__)("Upgrade to create %s variables and maintain consistent element sizing.","elementor"),v),icon:o.createElement(s,{fontSize:"large"})},E),!S&&!k&&!l&&o.createElement(H,{title:(0,d.sprintf)((0,d.__)("Create your first %s variable","elementor"),v),message:(0,d.__)("Variables are saved attributes that you can apply anywhere on your site.","elementor"),icon:o.createElement(s,{fontSize:"large"}),onAdd:t}),k&&!l&&o.createElement(H,{title:(0,d.__)("No compatible variables","elementor"),message:(0,d.__)("Looks like none of your variables work with this control. Create a new variable to use it here.","elementor"),icon:o.createElement(s,{fontSize:"large"}),onAdd:t}))},qe="list",Xe="edit",Je=({closePopover:e,propTypeKey:t,selectedVariable:a})=>{const[r,n]=(0,o.useState)(qe),[l,i]=(0,o.useState)(""),{open:c}=Se(),u=(0,s.isExperimentActive)("e_variables_manager")?()=>{c()}:void 0;return o.createElement(X,{propTypeKey:t},o.createElement(Ae,null,function(e){const t=W(),a=ie(e.propTypeKey),r={onClose:()=>{e.closePopover()},onGoBack:()=>{e.setCurrentView(qe)}};t.canAdd()&&(r.onAdd=()=>{e.setCurrentView("add")}),t.canEdit()&&(r.onEdit=t=>{e.setEditId(t),e.setCurrentView(Xe)}),t.canManageSettings()&&e.onSettings&&(r.onSettings=()=>{e.closePopover(),e.onSettings?.()});return qe===e.currentView?o.createElement(Ke,{closePopover:r.onClose,onAdd:r.onAdd,onEdit:r.onEdit,onSettings:r.onSettings,disabled:!a.canAdd()}):"add"===e.currentView?o.createElement(Re,{onGoBack:r.onGoBack,onClose:r.onClose}):Xe===e.currentView?o.createElement(Fe,{editId:e.editId,onGoBack:r.onGoBack,onClose:r.onClose,onSubmit:()=>{e?.selectedVariable?.key===e.editId?r.onClose():r.onGoBack?.()}}):null}({propTypeKey:t,currentView:r,selectedVariable:a,editId:l,setEditId:i,setCurrentView:n,closePopover:e,onSettings:u})))};function Ye(){return Ye=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)({}).hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},Ye.apply(null,arguments)}const Ze="tiny",Qe=(0,d.__)("Unlink variable","elementor"),et=({startIcon:e,label:t,onUnlink:a,...r})=>{const n=[];return a&&n.push(o.createElement(u.Tooltip,{key:"unlink",title:Qe,placement:"bottom"},o.createElement(u.IconButton,{size:Ze,onClick:a,"aria-label":Qe},o.createElement(c.DetachIcon,{fontSize:Ze})))),o.createElement(u.Tooltip,{title:t,placement:"top"},o.createElement(u.UnstableTag,Ye({fullWidth:!0,showActionsOnHover:!0,startIcon:o.createElement(u.Stack,{gap:.5,direction:"row",alignItems:"center"},e),label:o.createElement(u.Box,{sx:{display:"inline-grid",minWidth:0}},o.createElement(u.Typography,{sx:{lineHeight:1.34},variant:"caption",noWrap:!0},t)),actions:n},r)))};function tt(){return tt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)({}).hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},tt.apply(null,arguments)}const at=({variable:e,propTypeKey:t})=>{const{startIcon:a,propTypeUtil:r}=U(t),{setValue:n}=(0,K.useBoundProp)(),l=(0,o.useRef)(null),i=(0,o.useId)(),s=(0,u.usePopupState)({variant:"popover",popupId:`elementor-variables-list-${i}`}),d=Ie(e,t,n),p=a||(()=>null);return o.createElement(u.Box,{ref:l},o.createElement(et,tt({label:e.label,startIcon:o.createElement(o.Fragment,null,o.createElement(c.ColorFilterIcon,{fontSize:Ze}),o.createElement(p,{value:e.value})),onUnlink:d},(0,u.bindTrigger)(s))),o.createElement(u.Popover,tt({disableScrollLock:!0,anchorEl:l.current,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},PaperProps:{sx:{my:1}}},(0,u.bindPopover)(s)),o.createElement(Je,{selectedVariable:e,closePopover:s.close,propTypeKey:r.key})))},rt=({variableId:e,onClose:t,onSubmit:a})=>{const{icon:n,valueField:l,variableType:s,propTypeUtil:c}=J(),{setVariableValue:p}=Ve(),{propType:m}=(0,K.useBoundProp)(),b=te(e);if(!b)throw new Error(`Global ${s} variable not found`);const[h,y]=(0,o.useState)(""),[f,C]=(0,o.useState)(""),[_,T]=(0,o.useState)(b.label),[w,S]=(0,o.useState)(b.value),[k,I]=(0,o.useState)(b?.type??c.key),{labelFieldError:P,setLabelFieldError:A}=ve({value:b.label,message:v.DUPLICATED_LABEL}),x=()=>{(k!==b.type?ne(e,_,w,k):ne(e,_,w)).then(()=>{p(e),a?.()}).catch(e=>{const t=g(e);if(t&&"label"===t.field)return T(""),void A({value:_,message:t.message});y(v.UNEXPECTED_ERROR)})},V=w===b.value&&_===b.label||""===_.trim()||("string"==typeof w?""===w.trim():!1===Boolean(w))||!!h,O=e=>{"Enter"!==e.key||V||(e.preventDefault(),x())};return o.createElement(Ae,null,o.createElement(r.PopoverBody,{height:"auto"},o.createElement(i.PopoverHeader,{icon:o.createElement(n,{fontSize:"tiny"}),title:(0,d.__)("Restore variable","elementor"),onClose:t}),o.createElement(u.Divider,null),o.createElement(K.PopoverContent,{p:2},o.createElement(Be,{id:"variable-label",label:(0,d.__)("Name","elementor"),errorMsg:P?.message,noticeMsg:E(_)},o.createElement(ge,{id:"variable-label",value:_,error:P,onChange:e=>{T(e),y("")},onErrorChange:e=>{A({value:_,message:e})},onKeyDown:O})),l&&o.createElement(Be,{errorMsg:f,label:(0,d.__)("Value","elementor")},o.createElement(u.Typography,{variant:"h5"},o.createElement(l,{propTypeKey:k,onPropTypeKeyChange:e=>I(e),value:w,onChange:e=>{S(e),y(""),C("")},onValidationChange:C,propType:m,onKeyDown:O}))),h&&o.createElement(u.FormHelperText,{error:!0},h)),o.createElement(u.CardActions,{sx:{pt:.5,pb:1}},o.createElement(u.Button,{size:"small",variant:"contained",disabled:V,onClick:x},(0,d.__)("Restore","elementor")))))},nt=({onClose:e,onUnlink:t,onRestore:a,label:r})=>o.createElement(u.ClickAwayListener,{onClickAway:e},o.createElement(u.Alert,{variant:"standard",severity:"warning",onClose:e,action:o.createElement(o.Fragment,null,t&&o.createElement(u.AlertAction,{variant:"contained",onClick:t},(0,d.__)("Unlink","elementor")),a&&o.createElement(u.AlertAction,{variant:"outlined",onClick:a},(0,d.__)("Restore","elementor"))),sx:{maxWidth:300}},o.createElement(u.AlertTitle,null,(0,d.__)("Deleted variable","elementor")),o.createElement(u.Typography,{variant:"body2",color:"textPrimary"},(0,d.__)("The variable","elementor")," '",o.createElement(u.Typography,{variant:"body2",component:"span",sx:{lineBreak:"anywhere"}},r),"' ",(0,d.__)("has been deleted, but it is still referenced in this location. You may restore the variable or unlink it to assign a different value.","elementor"))));function lt(){return lt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)({}).hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},lt.apply(null,arguments)}const ot=o.forwardRef(({label:e,suffix:t,onClick:a,icon:r,...n},l)=>{const i=t?`${e} (${t})`:e;return o.createElement(u.Chip,lt({ref:l,size:"tiny",color:"warning",shape:"rounded",variant:"standard",onClick:a,icon:o.createElement(c.AlertTriangleFilledIcon,null),label:o.createElement(u.Tooltip,{title:i,placement:"top"},o.createElement(u.Box,{sx:{display:"inline-grid",minWidth:0}},o.createElement(u.Typography,{variant:"caption",noWrap:!0,sx:{lineHeight:1.34}},i))),sx:{height:e=>e.spacing(3.5),borderRadius:e=>e.spacing(1),justifyContent:"flex-start",width:"100%"}},n))});function it(){return it=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)({}).hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},it.apply(null,arguments)}ot.displayName="WarningVariableTag";const st=({variable:e,propTypeKey:t})=>{const{propTypeUtil:a}=U(t),r=(0,K.useBoundProp)(),n=W(),[l,i]=(0,o.useState)(!1),s=()=>i(!1),c=(0,o.useRef)(null),p=(0,o.useId)(),m=(0,u.usePopupState)({variant:"popover",popupId:`elementor-variables-restore-${p}`}),b={};return n.canUnlink()&&(b.onUnlink=Ie(e,t,r.setValue)),n.canRestore()&&(b.onRestore=()=>{e.key&&ne(e.key).then(e=>{Oe(a.create(e),r),s()}).catch(()=>{s(),m.setAnchorEl(c.current),m.open()})}),o.createElement(o.Fragment,null,o.createElement(u.Box,{ref:c},l&&o.createElement(u.Backdrop,{open:!0,onClick:s,invisible:!0}),o.createElement(u.Infotip,{color:"warning",placement:"right-start",open:l,disableHoverListener:!0,onClose:s,content:o.createElement(nt,{onClose:s,onUnlink:b.onUnlink,onRestore:b.onRestore,label:e.label}),slotProps:{popper:{modifiers:[{name:"offset",options:{offset:[0,24]}}]}}},o.createElement(ot,{label:e.label,onClick:()=>i(e=>!e),suffix:(0,d.__)("deleted","elementor")})),o.createElement(u.Popover,it({disableScrollLock:!0,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},PaperProps:{sx:{my:1}}},(0,u.bindPopover)(m)),o.createElement(X,{propTypeKey:t},o.createElement(rt,{variableId:e.key??"",onClose:m.close,onSubmit:()=>{m.close()}})))))},ct={title:(0,d.__)("Variable has changed","elementor"),message:(0,d.__)("This variable is no longer compatible with this property. You can clear it or select a different one.","elementor"),buttons:{clear:(0,d.__)("Clear","elementor"),select:(0,d.__)("Select variable","elementor")}},ut=({onClose:e,onClear:t,triggerSelect:a})=>o.createElement(u.ClickAwayListener,{onClickAway:e},o.createElement(u.Alert,{variant:"standard",severity:"warning",onClose:e,action:o.createElement(o.Fragment,null,t&&o.createElement(u.AlertAction,{variant:"contained",onClick:t},ct.buttons.clear),a&&o.createElement(u.AlertAction,{variant:"outlined",onClick:a},ct.buttons.select)),sx:{maxWidth:300}},o.createElement(u.AlertTitle,null,ct.title),o.createElement(u.Typography,{variant:"body2",color:"textPrimary"},ct.message)));function dt(){return dt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)({}).hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},dt.apply(null,arguments)}const pt=({variable:e})=>{const{setValue:t,value:a}=(0,K.useBoundProp)(),r=(0,o.useRef)(null),n=(0,o.useId)(),l=(0,u.usePopupState)({variant:"popover",popupId:`elementor-variables-list-${n}`}),[i,s]=(0,o.useState)(!1),c=()=>s(!1),p=!!a;return o.createElement(u.Box,{ref:r},i&&o.createElement(u.Backdrop,{open:!0,onClick:c,invisible:!0}),o.createElement(u.Infotip,{color:"warning",placement:"right-start",open:i,disableHoverListener:!0,onClose:c,content:o.createElement(ut,{onClose:c,onClear:p?()=>{c(),t(null)}:void 0,triggerSelect:()=>{c(),l.setAnchorEl(r.current),l.open()}}),slotProps:{popper:{modifiers:[{name:"offset",options:{offset:[0,24]}}]}}},o.createElement(ot,{label:e.label,onClick:()=>s(e=>!e),suffix:(0,d.__)("changed","elementor")})),o.createElement(u.Popover,dt({disableScrollLock:!0,anchorEl:r.current,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},PaperProps:{sx:{my:1}}},(0,u.bindPopover)(l)),o.createElement(Je,{selectedVariable:e,closePopover:l.close,propTypeKey:e.type})))},mt=({onClose:e,onClear:t})=>o.createElement(u.ClickAwayListener,{onClickAway:e},o.createElement(u.Alert,{variant:"standard",severity:"warning",onClose:e,action:o.createElement(o.Fragment,null,t&&o.createElement(u.AlertAction,{variant:"contained",onClick:t},(0,d.__)("Clear","elementor"))),sx:{maxWidth:300}},o.createElement(u.AlertTitle,null,(0,d.__)("This variable is missing","elementor")),o.createElement(u.Typography,{variant:"body2",color:"textPrimary"},(0,d.__)("It may have been deleted. Try clearing this field and select a different value or variable.","elementor")))),bt=()=>{const{setValue:e}=(0,K.useBoundProp)(),[t,a]=(0,o.useState)(!1),r=()=>a(!1);return o.createElement(o.Fragment,null,t&&o.createElement(u.Backdrop,{open:!0,onClick:r,invisible:!0}),o.createElement(u.Infotip,{color:"warning",placement:"right-start",open:t,disableHoverListener:!0,onClose:r,content:o.createElement(mt,{onClose:r,onClear:()=>e(null)}),slotProps:{popper:{modifiers:[{name:"offset",options:{offset:[0,24]}}]}}},o.createElement(ot,{label:(0,d.__)("Missing variable","elementor"),onClick:()=>a(e=>!e)})))},vt=()=>{const e=(0,K.useBoundProp)(),t=e.value??e.placeholder,a=te(t?.value);if(!a)return o.createElement(bt,null);const{$$type:r}=t;if(a?.deleted)return o.createElement(st,{variable:a,propTypeKey:r});const{isCompatible:n}=U(a.type);return n&&!n(e?.propType,a)?o.createElement(pt,{variable:a}):o.createElement(at,{variable:a,propTypeKey:r})},gt=()=>{const{propType:e,path:t}=(0,r.useBoundProp)(),a=Et(e);return{visible:Boolean(a),icon:c.ColorFilterIcon,title:(0,d.__)("Variables","elementor"),content:({close:e})=>a?(ht(t,a.variableType),o.createElement(Je,{closePopover:e,propTypeKey:a.propTypeUtil.key})):null}},Et=e=>{if("union"===e.kind)for(const t of Object.keys(e.prop_types)){const e=U(t);if(e)return e}},ht=(e,t)=>{m({varType:t,controlPath:e.join("."),action:"open"})};var yt=window.elementorV2.editorMcp;const ft="elementor://global-variables",Ct=()=>{[(0,yt.getMCPByDomain)("canvas"),(0,yt.getMCPByDomain)("variables")].forEach(e=>{const{mcpServer:t}=e;t.resource("global-variables",ft,{description:"List of Global variables. Defined as a key-value store (ID as key, global-variable object as value)"},async()=>{const e={};return Object.entries(O.variables()).forEach(([t,a])=>{a.deleted||(e[t]=a)}),{contents:[{uri:ft,text:JSON.stringify(e)}]}}),window.addEventListener("variables:updated",()=>{t.server.sendResourceUpdated({uri:ft,contents:[{uri:ft,text:localStorage["elementor-global-variables"]}]})})})},_t=()=>{(0,yt.getMCPByDomain)("variables").addTool({name:"manage-global-variable",schema:{action:C.z.enum(["create","update","delete"]).describe("Operation to perform"),id:C.z.string().optional().describe("Variable id (required for update/delete). Get from list-global-variables."),type:C.z.string().optional().describe('Variable type: "global-color-variable" or "global-font-variable" (required for create)'),label:C.z.string().optional().describe("Variable label (required for create/update)"),value:C.z.string().optional().describe("Variable value (required for create/update)")},outputSchema:{status:C.z.enum(["ok"]).describe("Operation status"),message:C.z.string().optional().describe("Error details if status is error")},modelPreferences:{intelligencePriority:.75,speedPriority:.75},requiredResources:[{uri:ft,description:"Global variables"}],description:'Manages global variables (create/update/delete). Existing variables available in resources.\nCREATE: requires type, label, value. Ensure label is unique.\nUPDATE: requires id, label, value. When renaming: keep existing value. When updating value: keep exact label.\nDELETE: requires id. DESTRUCTIVE - confirm with user first.\n\n# NAMING - IMPORTANT\nthe variables names should ALWAYS be lowercased and dashed spaced. example: "Headline Primary" should be "headline-primary"\n',handler:async e=>{const t=(a=O,{create({type:e,label:t,value:r}){if(!e||!t||!r)throw new Error("Create requires type, label, and value");return a.create({type:e,label:t,value:r})},update({id:e,label:t,value:r}){if(!e||!t||!r)throw new Error("Update requires id, label, and value");return a.update(e,{label:t,value:r})},delete({id:e}){if(!e)throw new Error("delete requires id");return a.delete(e)}});var a;const r=t[e.action];if(r)return await r(e),{status:"ok"};throw new Error(`Unknown action ${e.action}`)},isDestructive:!0})},Tt=({value:e,onChange:t,onValidationChange:a})=>{const[r,n]=(0,o.useState)(e),[l,i]=(0,o.useState)(""),s=(0,o.useRef)(null),c=xe()??s.current;return o.createElement(u.UnstableColorField,{id:"color-variable-field",size:"tiny",fullWidth:!0,value:r,onChange:e=>{n(e);const r=h(e);i(r),a?.(r),t(r?"":e)},error:l||void 0,slotProps:{colorPicker:{anchorEl:c,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:-10},slotProps:{colorIndicator:{size:"inherit",sx:{borderRadius:.5}}}}}})};function wt(){return wt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)({}).hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},wt.apply(null,arguments)}const St=({value:e,onChange:t,onValidationChange:a})=>{const[n,l]=(0,o.useState)(e),i=(0,o.useRef)(null),s=xe()??i.current,p=(0,u.usePopupState)({variant:"popover"}),m=(0,r.useFontFamilies)(),b=(0,r.useSectionWidth)(),v=o.useMemo(()=>m.map(({label:e,fonts:t})=>({label:e,items:t})),[m]),g=(0,o.useId)();return o.createElement(o.Fragment,null,o.createElement(u.UnstableTag,wt({id:g,variant:"outlined",label:n,endIcon:o.createElement(c.ChevronDownIcon,{fontSize:"tiny"})},(0,u.bindTrigger)(p),{fullWidth:!0})),o.createElement(u.Popover,wt({disablePortal:!0,disableScrollLock:!0,anchorEl:s,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:-28}},(0,u.bindPopover)(p)),o.createElement(K.ItemSelector,{id:"font-family-variables-selector",itemsList:v,selectedItem:n,onItemChange:e=>{(e=>{l(e);const r=h(e);a?.(r),t(r?"":e)})(e),p.close()},onClose:p.close,sectionWidth:b,title:(0,d.__)("Font family","elementor"),itemStyle:e=>({fontFamily:e.value}),onDebounce:K.enqueueFont,icon:c.TextIcon})))},kt=(0,l.createPropUtils)("global-size-variable",C.z.string()),It=(0,y.createTransformer)(e=>null);function Pt(){z({key:_.key,valueField:Tt,icon:c.BrushIcon,propTypeUtil:_,fallbackPropTypeUtil:l.colorPropTypeUtil,variableType:"color",startIcon:({value:e})=>o.createElement(f,{size:"inherit",component:"span",value:e}),defaultValue:"#ffffff"}),z({key:A.key,valueField:St,icon:c.TextIcon,propTypeUtil:A,fallbackPropTypeUtil:l.stringPropTypeUtil,variableType:"font",defaultValue:"Roboto"});const e={isActive:!1,icon:c.ExpandDiagonalIcon,propTypeUtil:kt,fallbackPropTypeUtil:l.sizePropTypeUtil,styleTransformer:It,variableType:"size",selectionFilter:()=>[],emptyState:o.createElement(i.CtaButton,{size:"small",href:"https://go.elementor.com/go-pro-panel-size-variable/"})};z({...e,key:kt.key,defaultValue:"0px"}),z({...e,key:"global-custom-size-variable"})}const At="body";function xt(){const e=(0,s.__privateUseListenTo)((0,s.commandEndEvent)("editor/documents/attach-preview"),()=>(0,s.getCanvasIframeDocument)()?.head),t=function(){const[e,t]=(0,o.useState)({});return(0,o.useEffect)(()=>{const e=x.subscribe(t);return()=>{e()}},[]),e}(),a=Object.keys(t).length>0;if(!e||!a)return null;const r=(n=t,Object.entries(n).map(([e,t])=>function(e,t){return`--${t?.deleted?e:t.label}:${t.value};`}(e,t)).join(""));var n;const l=`${At}{${r}}`;return o.createElement(u.Portal,{container:e},o.createElement("style",{"data-e-style-id":"e-variables",key:l},l))}const Vt=e=>{const t=e?.value?.color?.value;return te(t||"")},Ot=({value:e})=>{const t=Vt(e);return o.createElement(f,{component:"span",size:"inherit",value:t?.value})},Dt=({value:e})=>{const t=Vt(e);return o.createElement("span",null,t?.label)},Bt=({value:e})=>{const t=Vt(e);return o.createElement(f,{component:"span",size:"inherit",value:t?.value})},Lt=e=>!!_.isValid(e),{registerPopoverAction:Rt}=r.controlActionsMenu;function zt(){Pt(),(0,K.injectIntoRepeaterItemIcon)({id:"color-variables-background-icon",component:Ot,condition:({value:e})=>Lt(l.backgroundColorOverlayPropTypeUtil.extract(e)?.color)}),(0,K.injectIntoRepeaterItemIcon)({id:"color-variables-icon",component:Bt,condition:({value:e})=>Lt(l.shadowPropTypeUtil.extract(e)?.color)}),(0,K.injectIntoRepeaterItemLabel)({id:"color-variables-label",component:Dt,condition:({value:e})=>Lt(l.backgroundColorOverlayPropTypeUtil.extract(e)?.color)}),(0,r.registerControlReplacement)({component:vt,condition:({value:e,placeholder:t})=>!!Ut(e)||!e&&Ut(t)}),Rt({id:"variables",useProps:gt}),O.init().then(()=>{(0,yt.isAngieAvailable)()&&(_t(),Ct())}),(0,a.injectIntoTop)({id:"canvas-style-variables-render",component:xt}),(0,n.__registerPanel)(we)}function Ut(e){return!!(0,l.isTransformable)(e)&&F(e.$$type)}const Mt=e=>t=>{const a=String(t);return{$$type:e,value:O.variables()[a]?a:O.findIdByLabel(a)}},Ft={globalVariablesLLMResolvers:{"global-color-variable":Mt("global-color-variable"),"global-font-variable":Mt("global-font-variable"),"global-size-variable":Mt("global-size-variable")}};(window.elementorV2=window.elementorV2||{}).editorVariables=t}(),window.elementorV2.editorVariables?.init?.();
[+]
..
[-] editor-variables.min.js
[edit]
[-] editor-variables.js.LICENSE.txt
[edit]
[-] editor-variables.js
[edit]
[-] editor-variables.strings.js
[edit]
[-] editor-variables.asset.php
[edit]