JezK
Edit File: editor-design-system.min.js
(function(){var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,__commonJSMin=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),__copyProps=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},__toESM=(n,r,a)=>(a=n==null?{}:e(i(n)),__copyProps(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n)),o=__toESM(__commonJSMin(((e,t)=>{var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,__export=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},__copyProps=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!s.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(o=i(t,c))||o.enumerable});return e},__toESM=(e,t,i)=>(i=e==null?{}:n(o(e)),__copyProps(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)),__toCommonJS=e=>__copyProps(r({},`__esModule`,{value:!0}),e),c={};__export(c,{getInitialDesignSystemTab:()=>getInitialDesignSystemTab,init:()=>init,panel:()=>X,persistDesignSystemTab:()=>persistDesignSystemTab,usePanelActions:()=>Q,usePanelStatus:()=>Z}),t.exports=__toCommonJS(c);var l=globalThis.elementorV2.editor,u=globalThis.elementorV2.editorAppBar,d=globalThis.elementorV2.editorPanels,f=__toESM(globalThis.React),p=globalThis.React,ee=globalThis.elementorV2.editorDocuments,m=globalThis.elementorV2.editorUi,h=globalThis.elementorV2.editorV1Adapters,g=globalThis.wp.i18n,te=__toESM(globalThis.React),_=globalThis.elementorV2.editorDocuments,v=globalThis.elementorV2.editorPanels,y=globalThis.elementorV2.editorV1Adapters,b=__toESM(globalThis.React),x=globalThis.React,ne=globalThis.elementorV2.editorDefaultStyles,re=globalThis.elementorV2.editorGlobalClasses,S=globalThis.elementorV2.editorPanels,ie=globalThis.elementorV2.editorUi,ae=globalThis.elementorV2.editorVariables,C=globalThis.elementorV2.icons,w=globalThis.elementorV2.ui,T=globalThis.wp.i18n,oe=`elementor_editor_design_system_active_tab`;function readStoredTab(){if(typeof window>`u`)return`defaults`;try{let e=window.localStorage.getItem(oe);if(e===`defaults`||e===`classes`||e===`variables`)return e}catch{}return`defaults`}var E=null,D=readStoredTab();function normalizeDesignSystemTab(e){return e}function setPendingDesignSystemTab(e){E=e}function getInitialDesignSystemTab(){if(E){let e=E;return E=null,D=e,persistDesignSystemTab(e),e}let e=readStoredTab();return D=e,e}function notifyDesignSystemTabChange(e){D=e}function getActiveDesignSystemTab(){return D}function persistDesignSystemTab(e){if(!(typeof window>`u`))try{window.localStorage.setItem(oe,e)}catch{}}var O=__toESM(globalThis.React),se=globalThis.elementorV2.editorCurrentUser,ce=globalThis.elementorV2.editorUi,k=globalThis.elementorV2.icons,le=globalThis.elementorV2.query,A=globalThis.elementorV2.ui,j=globalThis.wp.i18n,downloadBlob=(e,t)=>{let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,r.rel=`noopener`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)},M=globalThis.elementorV2.editorNotifications,N=globalThis.wp.i18n,P=`design-system-export-started`,ue=`design-system-export-succeeded`,de=`design-system-export-failed`,notifyExportInProgress=()=>{(0,M.notify)({id:P,type:`info`,message:(0,N.__)(`Export in progress. Your file will download when it’s ready.`,`elementor`)})},notifyExportSuccess=()=>{(0,M.dismissNotification)(P),(0,M.notify)({id:ue,type:`success`,message:(0,N.__)(`Design system exported`,`elementor`)})},notifyExportFailure=e=>{(0,M.dismissNotification)(P),(0,M.notify)({id:de,type:`error`,message:(0,N.__)(`Your design system export failed`,`elementor`),additionalActionProps:[{size:`small`,variant:`outlined`,color:`error`,children:(0,N.__)(`Try again`,`elementor`),onClick:()=>{(0,M.dismissNotification)(de),e()}}]})},fe=globalThis.elementorV2.httpClient,pe=globalThis.elementorV2.query,me=`elementor/v1/import-export-customization`,he=`design-system-export`,ge=`design-system-export.zip`,_e=12e4,ve={include:[`settings`],kitInfo:{title:`design-system`,description:``,source:`local`},customization:{settings:{theme:!1,classes:!0,variables:!0}}},DesignSystemExportError=class extends Error{constructor(e){super(`Design system export failed`),this.name=`DesignSystemExportError`,this.cause=e}},useExportRequest=()=>(0,pe.useMutation)({mutationKey:[he],mutationFn:async()=>{try{let{data:e}=await(0,fe.httpService)().post(`${me}/export`,ve,{timeout:_e});return{fileName:ge,blob:base64ToZipBlob(e.data.file)}}catch(e){throw new DesignSystemExportError(e)}}}),base64ToZipBlob=e=>{let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return new Blob([n],{type:`application/zip`})},ye=globalThis.elementorV2.editorCanvas,be=globalThis.elementorV2.editorV1Adapters,F=globalThis.elementorV2.httpClient,xe=globalThis.elementorV2.query,I=`elementor/v1/import-export-customization`,L=12e4,Se=[`global-classes`,`global-variables`],R=`design-system-import`,useImportRequest=()=>(0,xe.useMutation)({mutationKey:[R],mutationFn:async({file:e,conflictStrategy:t})=>{await(0,be.__privateRunCommand)(`document/save/auto`,{force:!0});let n=await uploadKit(e);await runRunners(n,await startImport(n,t)),window.dispatchEvent(new CustomEvent(ye.GLOBAL_STYLES_IMPORTED_EVENT))}}),DesignSystemUploadValidationError=class extends Error{constructor(e){super(`Design system upload validation failed`),this.name=`DesignSystemUploadValidationError`,this.cause=e}},uploadKit=async e=>{let t=new FormData;t.append(`e_import_file`,e);try{let{data:e}=await(0,F.httpService)().post(`${I}/upload`,t,{headers:{"Content-Type":`multipart/form-data`},timeout:L});return e.data.session}catch(e){throw new DesignSystemUploadValidationError(e)}},startImport=async(e,t)=>{let n={"design-system":{conflict_resolution:t===`keep`?`skip`:`replace`}},{data:r}=await(0,F.httpService)().post(`${I}/import`,{session:e,include:[`design-system`],customization:n},{timeout:L});return(r.data.runners??[]).filter(e=>Se.includes(e))},runRunners=async(e,t)=>{for(let n of t)await(0,F.httpService)().post(`${I}/import-runner`,{session:e,runner:n},{timeout:L})},z=__toESM(globalThis.React),B=globalThis.elementorV2.editorUi,Ce=globalThis.elementorV2.icons,V=globalThis.elementorV2.ui,H=globalThis.wp.i18n,U=__toESM(globalThis.React),W=globalThis.elementorV2.ui,G=globalThis.wp.i18n,getOptions=()=>[{value:`replace`,title:(0,G.__)(`Replace existing values`,`elementor`),description:(0,G.__)(`Imported design system values will overwrite existing variables and classes.`,`elementor`)},{value:`keep`,title:(0,G.__)(`Keep existing values`,`elementor`),description:(0,G.__)(`Existing variables and classes will not change.`,`elementor`)}],ConflictOptions=({value:e,onChange:t})=>{let n=getOptions();return U.createElement(W.Stack,{spacing:1},U.createElement(W.Typography,{variant:`body1`},(0,G.__)(`How to handle conflicts with existing variables or classes?`,`elementor`)),U.createElement(W.RadioGroup,{value:e??``,onChange:(e,n)=>t(n)},U.createElement(W.Stack,{spacing:1},n.map(n=>U.createElement(W.Card,{key:n.value,variant:`outlined`},U.createElement(W.CardActionArea,{onClick:()=>t(n.value)},U.createElement(W.Stack,{direction:`row`,alignItems:`center`,spacing:2,padding:2},U.createElement(W.Radio,{value:n.value,checked:e===n.value,inputProps:{"aria-label":n.title}}),U.createElement(W.Stack,{direction:`column`,spacing:.5},U.createElement(W.Typography,{variant:`subtitle2`},n.title),U.createElement(W.Typography,{variant:`caption`,color:`text.secondary`},n.description)))))))))},we=globalThis.React,Te={file:null,conflictStrategy:null},useDialogState=()=>{let[e,t]=(0,we.useState)(Te),setFile=e=>t(t=>({...t,file:e})),setConflictStrategy=e=>t(t=>({...t,conflictStrategy:e}));return{...e,setFile,setConflictStrategy}},K=globalThis.elementorV2.editorNotifications,Ee=globalThis.elementorV2.query,q=globalThis.wp.i18n,J=`design-system-import-started`,De=`design-system-import-succeeded`,Oe=`design-system-import-failed`,notifyImportInProgress=()=>{(0,K.notify)({id:J,type:`info`,message:(0,q.__)(`Import in Progress. You will be notified when the import is complete.`,`elementor`)})},notifyImportSuccess=()=>{(0,K.dismissNotification)(J),(0,K.notify)({id:De,type:`success`,message:(0,q.__)(`Design system imported`,`elementor`)})},notifyImportFailure=e=>{(0,K.dismissNotification)(J),(0,K.notify)({id:Oe,type:`error`,message:(0,q.__)(`Your design system import failed`,`elementor`),additionalActionProps:[{size:`small`,variant:`outlined`,color:`error`,children:(0,q.__)(`Try again`,`elementor`),onClick:()=>{(0,K.dismissNotification)(Oe),!((0,Ee.getQueryClient)().isMutating({mutationKey:[R]})>0)&&e()}}]})},ke=globalThis.elementorV2.events,Ae=`design_system`,trackDesignSystem=e=>{let{dispatchEvent:t,config:n}=(0,ke.getMixpanel)(),r=n?.names?.design_system?.[e.event];if(!r)return;let{event:i,...a}=e;try{t?.(r,{event:i,...a})}catch{}},je=[`application/zip`],Me=`application/zip,.zip`,Ne=3,Pe=`https://go.elementor.com/wp-dash-import-export-design-system/`,reopenSelf=()=>{trackDesignSystem({event:`importOpened`}),(0,B.openDialog)({component:z.createElement(ImportDesignSystemDialog,{onClose:B.closeDialog})})},ImportDesignSystemDialog=({onClose:e})=>{let{file:t,conflictStrategy:n,setFile:r,setConflictStrategy:i}=useDialogState(),a=useImportRequest(),o=!!(t&&n),handleFileSelected=e=>{r(e),trackDesignSystem({event:`fileSelected`,file_type:Ae})},handleConflictChange=e=>{i(e),trackDesignSystem({event:`conflictChoice`,choice:e})},handleImport=async()=>{if(!(!t||!n)){trackDesignSystem({event:`confirmed`,conflict_choice:n}),notifyImportInProgress(),e();try{await a.mutateAsync({file:t,conflictStrategy:n}),trackDesignSystem({event:`imported`}),notifyImportSuccess()}catch(e){e instanceof DesignSystemUploadValidationError?trackDesignSystem({event:`validationFailed`,file_type:Ae}):trackDesignSystem({event:`importFailed`}),notifyImportFailure(reopenSelf)}}};return z.createElement(z.Fragment,null,z.createElement(V.DialogHeader,{logo:!1},z.createElement(V.DialogTitle,null,(0,H.__)(`Import Design System`,`elementor`))),z.createElement(V.DialogContent,null,z.createElement(V.Stack,{spacing:3},t?z.createElement(B.FileUploadRow,{file:t,onRemove:()=>r(null)}):z.createElement(B.FileUploadDropzone,{onFileSelected:handleFileSelected,allowedFileTypes:je,accept:Me,regionLabel:(0,H.__)(`Design system file dropzone`,`elementor`),helperText:(0,H.sprintf)((0,H.__)(`zip (max. %dMB)`,`elementor`),Ne)}),z.createElement(ConflictOptions,{value:n,onChange:handleConflictChange}),z.createElement(V.Stack,{direction:`row`,spacing:.5,alignItems:`center`,justifyContent:`flex-start`},z.createElement(Ce.HelpIcon,{sx:{fontSize:16,color:`text.tertiary`}}),z.createElement(V.Link,{href:Pe,target:`_blank`,rel:`noopener noreferrer`,underline:`always`,variant:`caption`,color:`text.tertiary`},(0,H.__)(`Learn how design system imports work`,`elementor`))))),z.createElement(V.DialogActions,null,z.createElement(V.Button,{size:`medium`,color:`secondary`,onClick:e},(0,H.__)(`Cancel`,`elementor`)),z.createElement(V.Button,{size:`medium`,variant:`contained`,color:`primary`,disabled:!o,onClick:handleImport},(0,H.__)(`Import`,`elementor`))))},Fe=`design-system-header-menu`,DesignSystemHeaderMenu=()=>{let{isAdmin:e}=(0,se.useCurrentUserCapabilities)(),t=(0,A.usePopupState)({variant:`popover`,popupId:Fe}),n=useExportRequest(),r=(0,le.useIsMutating)({mutationKey:[R]})>0,i=(0,le.useIsMutating)({mutationKey:[he]})>0,a=r||i,o=(0,A.bindTrigger)(t),handleImport=()=>{t.close(),trackDesignSystem({event:`importOpened`}),(0,ce.openDialog)({component:O.createElement(ImportDesignSystemDialog,{onClose:ce.closeDialog})})},runExport=async()=>{notifyExportInProgress();try{let{blob:e,fileName:t}=await n.mutateAsync();downloadBlob(e,t),notifyExportSuccess()}catch{notifyExportFailure(runExport)}},handleExport=()=>{t.close(),trackDesignSystem({event:`export`}),runExport()},s=(0,j.__)(`Design system actions`,`elementor`),c=(0,j.__)(`Export is in progress. The file will be downloaded when it's complete.`,`elementor`),l=(0,j.__)(`Import is in progress. You will receive a notification when it's complete.`,`elementor`),u=s;return a&&(u=i?c:l),O.createElement(O.Fragment,null,e&&O.createElement(A.Tooltip,{title:u,placement:`top`},O.createElement(`span`,null,O.createElement(A.IconButton,{...o,size:`small`,"aria-label":s,disabled:a},O.createElement(k.DotsVerticalIcon,{fontSize:`small`})))),O.createElement(A.Menu,{...(0,A.bindMenu)(t),MenuListProps:{dense:!0},PaperProps:{elevation:6},anchorOrigin:{vertical:`bottom`,horizontal:`right`},transformOrigin:{vertical:`top`,horizontal:`right`}},O.createElement(A.MenuItem,{onClick:handleImport,disabled:r},O.createElement(A.ListItemIcon,null,O.createElement(k.DownloadIcon,{fontSize:`tiny`})),O.createElement(A.ListItemText,null,(0,j.__)(`Import`,`elementor`))),O.createElement(A.MenuItem,{onClick:handleExport,disabled:i},O.createElement(A.ListItemIcon,null,O.createElement(k.UploadIcon,{fontSize:`tiny`})),O.createElement(A.ListItemText,null,(0,j.__)(`Export`,`elementor`)))))},Ie={position:`sticky`,zIndex:1100,opacity:1,backgroundColor:`background.default`,transition:`top 300ms ease`},Le=`elementor/design-system/set-tab`,trackDesignSystemTabOpened=e=>{switch(e){case`classes`:(0,re.trackGlobalClasses)({event:`classManagerOpened`,source:`system-panel`});break;case`variables`:(0,ae.trackVariablesManagerEvent)({action:`openManager`,source:`system-panel`});break}};function DesignSystemPanelContent({onRequestClose:e}){let[t,n]=(0,x.useState)(()=>getInitialDesignSystemTab()),r=(0,x.useRef)(null),i=(0,x.useRef)(null),a=(0,x.useRef)(null),o=(0,x.useRef)(!1),{getTabProps:s,getTabPanelProps:c,getTabsProps:l}=(0,w.useTabs)(t),u=(0,x.useCallback)(()=>{if(!o.current&&a.current){o.current=!0,a.current(),o.current=!1;return}e()},[e]),d=(0,x.useCallback)(()=>{if(!o.current&&i.current){o.current=!0,i.current(),o.current=!1;return}e()},[e]),f=(0,x.useCallback)(()=>{if(!o.current&&r.current){o.current=!0,r.current(),o.current=!1;return}e()},[e]);(0,x.useEffect)(()=>{notifyDesignSystemTabChange(t)},[t]),(0,x.useEffect)(()=>{let handler=e=>{let t=e.detail?.tab;if(!t)return;let r=normalizeDesignSystemTab(t);n(r),persistDesignSystemTab(r),notifyDesignSystemTabChange(r),trackDesignSystemTabOpened(r)};return window.addEventListener(Le,handler),()=>{window.removeEventListener(Le,handler)}},[]);let handleHeaderClose=()=>{if(t===`defaults`&&r.current){r.current();return}if(t===`variables`&&i.current){i.current();return}if(t===`classes`&&a.current){a.current();return}e()};return b.createElement(ie.ThemeProvider,null,b.createElement(S.Panel,null,b.createElement(S.PanelHeader,null,b.createElement(w.Stack,{p:1,pl:2,width:`100%`,direction:`row`,alignItems:`center`,spacing:.5},b.createElement(S.PanelHeaderTitle,{sx:{flex:1,minWidth:0}},(0,T.__)(`Design system`,`elementor`)),b.createElement(DesignSystemHeaderMenu,null),b.createElement(w.CloseButton,{"aria-label":(0,T.__)(`Close`,`elementor`),sx:{flexShrink:0},onClick:()=>void handleHeaderClose()}))),b.createElement(S.PanelBody,{sx:{display:`flex`,flexDirection:`column`,height:`100%`,overflow:`hidden`,minHeight:0}},b.createElement(w.Stack,{direction:`column`,sx:{width:`100%`,flex:1,minHeight:0,overflow:`hidden`}},b.createElement(w.Stack,{sx:{...Ie,top:0,flexShrink:0}},b.createElement(w.Tabs,{variant:`fullWidth`,size:`small`,sx:{mt:.5},...l(),onChange:(e,t)=>{l().onChange(e,t),n(t),persistDesignSystemTab(t),notifyDesignSystemTabChange(t),trackDesignSystemTabOpened(t)}},b.createElement(w.Tab,{label:(0,T.__)(`Defaults`,`elementor`),icon:b.createElement(C.TextIcon,{fontSize:`small`}),iconPosition:`start`,...s(`defaults`)}),b.createElement(w.Tab,{label:(0,T.__)(`Variables`,`elementor`),icon:b.createElement(C.ColorFilterIcon,{fontSize:`small`}),iconPosition:`start`,...s(`variables`)}),b.createElement(w.Tab,{label:(0,T.__)(`Classes`,`elementor`),icon:b.createElement(C.ColorSwatchIcon,{fontSize:`small`}),iconPosition:`start`,...s(`classes`)})),b.createElement(w.Divider,null)),b.createElement(w.Box,{role:`tabpanel`,...c(`defaults`),sx:{flex:1,minHeight:0,display:t===`defaults`?`flex`:`none`,flexDirection:`column`,overflow:`hidden`,pt:1}},b.createElement(ne.DefaultStylesTabEmbedded,{onRequestClose:d,onExposeCloseAttempt:e=>{r.current=e}})),b.createElement(w.Box,{role:`tabpanel`,...c(`variables`),sx:{flex:1,minHeight:0,display:t===`variables`?`flex`:`none`,flexDirection:`column`,overflow:`hidden`,pt:1}},b.createElement(ae.VariablesManagerPanelEmbedded,{onRequestClose:u,onExposeCloseAttempt:e=>{i.current=e}})),b.createElement(w.Box,{role:`tabpanel`,...c(`classes`),sx:{flex:1,minHeight:0,display:t===`classes`?`flex`:`none`,flexDirection:`column`,overflow:`hidden`,pt:1}},b.createElement(re.ClassManagerPanelEmbedded,{onRequestClose:f,onExposeCloseAttempt:e=>{a.current=e},isActive:t===`classes`}))))))}var Y=`design-system`,{panel:X,usePanelStatus:Z,usePanelActions:Q}=(0,v.createPanel)({id:Y,component:DesignSystemPanelRoot,allowedEditModes:[`edit`,Y],onOpen:()=>{(0,y.changeEditMode)(Y)},onClose:async()=>{(0,y.changeEditMode)(`edit`),await(0,_.reloadCurrentDocument)()},isOpenPreviousElement:!0});function DesignSystemPanelRoot(){let{close:e}=Q();return te.createElement(DesignSystemPanelContent,{onRequestClose:e})}var $=`panel/elements/categories`,Re=`elementor/open-default-styles`,ze=`elementor/open-variables-manager`,Be=`elementor/open-global-classes-manager`,Ve=`elementor/toggle-design-system`,He=`elementor/design-system/set-tab`,Ue=`active-panel`,We=`design-system`,Ge=`default-styles`,Ke=`global-classes-manager`,qe=`variables-manager`,Je={defaults:Re,variables:ze,classes:Be};function DesignSystemEntrypoints(){let{open:e,close:t}=Q(),{isOpen:n}=Z(),r=(0,ee.__useActiveDocument)(),{save:i}=(0,ee.__useActiveDocumentActions)(),{open:a,close:o,isOpen:s}=(0,m.useDialog)(),c=(0,p.useRef)(r);c.current=r;let l=(0,p.useRef)(null),u=(0,p.useCallback)(e=>{if(c.current?.isDirty){l.current=e,a();return}e()},[a]),d=(0,p.useCallback)(async()=>{try{await i(),o(),l.current?.(),l.current=null}catch{}},[i,o]),te=(0,p.useCallback)(()=>{o(),l.current=null},[o]),_=(0,p.useRef)(n);_.current=n,(0,p.useEffect)(()=>{let handler=e=>{let n=e.detail?.tab;if(n===`defaults`||n===`variables`||n===`classes`){if(_.current&&getActiveDesignSystemTab()===n){t();return}if(_.current){window.dispatchEvent(new CustomEvent(He,{detail:{tab:n}}));return}u(()=>{window.dispatchEvent(new CustomEvent(Je[n]))})}};return window.addEventListener(Ve,handler),()=>{window.removeEventListener(Ve,handler)}},[t,u]);let v=(0,p.useRef)(null),[y,b]=(0,p.useState)(!1);(0,p.useEffect)(()=>{y&&(b(!1),e())},[y,e]),(0,p.useEffect)(()=>(0,h.__privateListenTo)((0,h.routeOpenEvent)($),()=>{let e=v.current;e&&(v.current=null,setPendingDesignSystemTab(e),b(!0))}),[]),(0,p.useEffect)(()=>{let bind=(e,t)=>{let handler=()=>{v.current=t,(0,h.__privateOpenRoute)($)};return window.addEventListener(e,handler),()=>window.removeEventListener(e,handler)},e=bind(Re,`defaults`),t=bind(ze,`variables`),n=bind(Be,`classes`);return()=>{e(),t(),n()}},[]);let x=(0,p.useRef)(!1);return(0,p.useEffect)(()=>{let t=new URLSearchParams(window.location.search),n=t.get(Ue);if(!n)return;let r=null;if(n===We){let e=t.get(`design-system-tab`);r=e===`classes`?`classes`:e===`variables`?`variables`:`defaults`}else if(n===Ge)r=`defaults`;else if(n===Ke)r=`classes`;else if(n===qe)r=`variables`;else return;return(0,h.__privateListenTo)((0,h.routeOpenEvent)($),()=>{x.current||(x.current=!0,requestAnimationFrame(()=>{r&&setPendingDesignSystemTab(r),u(()=>void e())}))})},[e,u]),s?f.createElement(m.ThemeProvider,null,f.createElement(m.SaveChangesDialog,null,f.createElement(m.SaveChangesDialog.Title,null,(0,g.__)(`You have unsaved changes`,`elementor`)),f.createElement(m.SaveChangesDialog.Content,null,f.createElement(m.SaveChangesDialog.ContentText,{sx:{mb:2}},(0,g.__)(`To open the Design System, save your page first. You can't continue without saving.`,`elementor`))),f.createElement(m.SaveChangesDialog.Actions,{actions:{cancel:{label:(0,g.__)(`Stay here`,`elementor`),action:te},confirm:{label:(0,g.__)(`Save & Continue`,`elementor`),action:d}}}))):null}var Ye=globalThis.elementorV2.icons,Xe=globalThis.wp.i18n,Ze=`elementor/toggle-design-system`;function useOpenDesignSystemToolbar(){let{isOpen:e}=Z();return{title:(0,Xe.__)(`Design System`,`elementor`),icon:Ye.DropletHalfFilledIcon,onClick:()=>{e||trackDesignSystem({event:`opened`});let t=getActiveDesignSystemTab();window.dispatchEvent(new CustomEvent(Ze,{detail:{tab:t}}))},selected:e}}function init(){(0,d.registerPanel)(X),(0,l.injectIntoLogic)({id:`design-system-entrypoints`,component:DesignSystemEntrypoints}),u.toolsMenu.registerToggleAction({id:`open-design-system-toolbar`,priority:4,useProps:useOpenDesignSystemToolbar})}0&&(t.exports={getInitialDesignSystemTab,init,panel:X,persistDesignSystemTab,usePanelActions:Q,usePanelStatus:Z})}))());(window.elementorV2=window.elementorV2||{}).editorDesignSystem=o})(),window.elementorV2.editorDesignSystem?.init?.();