WordPress/wp-includes/js/dist/customize-widgets.min.js
youknowriad e270f4f0f3 Block Editor: Include the fixes targetted for WordPress 5.8 RC3.
This includes the following fixes:
 - Safari: see if compositing layer size is more reasonable when position fixed divs are not inserted into content.
 - Site Logo Block: update Site Logo block UI and option syncing.
 - Fix moving inner blocks in the Widgets Customizer.
 - Allow themes to provide empty values for color.duotone and spacing.units
 - Update getTermsInfo() to workaround parsing issue for translatable strings.
 - Specify what settings can be part of settings.layout.
 - Update conditions to hide duotone panel.
 - Prevent entering invalid values in the Query Loop block config.
 - Prevent color panel from showing as empty.
 - Avoid calling gutenberg_ functions within code shipped through WordPress Core.

Props desrosj.
See #53397.

Built from https://develop.svn.wordpress.org/trunk@51421


git-svn-id: http://core.svn.wordpress.org/trunk@51032 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-13 16:41:28 +00:00

7 lines
35 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*! This file is auto-generated */
this.wp=this.wp||{},this.wp.customizeWidgets=function(e){var t={};function s(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,s),n.l=!0,n.exports}return s.m=e,s.c=t,s.d=function(e,t,i){s.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.t=function(e,t){if(1&t&&(e=s(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(s.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)s.d(i,n,function(t){return e[t]}.bind(null,n));return i},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="",s(s.s="9pbN")}({"1CF3":function(e,t){e.exports=window.wp.dom},"1ZqX":function(e,t){e.exports=window.wp.data},"6aBm":function(e,t){e.exports=window.wp.mediaUtils},"9pbN":function(e,t,s){"use strict";s.r(t),s.d(t,"initialize",(function(){return Se}));var i={};s.r(i),s.d(i,"__unstableIsFeatureActive",(function(){return M}));var n={};s.r(n),s.d(n,"__unstableToggleFeature",(function(){return F}));var c=s("GRId"),r=s("QyPg"),o=s("GLVC"),a=s("HSyU"),l=s("tI+e"),d=s("YLtl"),u=s("jZUy"),b=s("1ZqX"),m=s("axFQ"),h=s("6aBm"),p=s("wx14"),g=s("l3Sj");var O=function({inspector:e,closeMenu:t,...s}){const i=Object(b.useSelect)(e=>e(m.store).getSelectedBlockClientId(),[]),n=Object(c.useMemo)(()=>document.getElementById("block-"+i),[i]);return Object(c.createElement)(l.MenuItem,Object(p.a)({onClick:()=>{e.open({returnFocusWhenClose:n}),t()}},s),Object(g.__)("Show more settings"))},j=s("TSYQ"),w=s.n(j),f=s("RxS6"),_=s("Ntru"),y=s("K2cm"),v=s("Q4Sy"),E=s("K9lf"),k=s("bWcr");var C=function e({setIsOpened:t}){const s=Object(E.useInstanceId)(e,"customize-widget-layout__inserter-panel-title");return Object(c.createElement)("div",{className:"customize-widgets-layout__inserter-panel","aria-labelledby":s},Object(c.createElement)("div",{className:"customize-widgets-layout__inserter-panel-header"},Object(c.createElement)("h2",{id:s,className:"customize-widgets-layout__inserter-panel-header-title"},Object(g.__)("Add a block")),Object(c.createElement)(l.Button,{className:"customize-widgets-layout__inserter-panel-header-close-button",icon:k.a,onClick:()=>t(!1),"aria-label":Object(g.__)("Close inserter")})),Object(c.createElement)("div",{className:"customize-widgets-layout__inserter-panel-content"},Object(c.createElement)(m.__experimentalLibrary,{showInserterHelpPanel:!0,onSelect:()=>t(!1)})))},x=s("VKE3"),S=s("K+tz"),z=s("hF7m"),W=s("RMJe"),B=s("gdqT");const I=Object(d.flow)([b.combineReducers,(T={features:{fixedToolbar:!1,welcomeGuide:!0}},e=>(t=T,s)=>e(t,s))])({features:(e,t)=>"TOGGLE_FEATURE"===t.type?{...e,[t.feature]:!e[t.feature]}:e});var T;function M(e,t){return Object(d.get)(e.preferences.features,[t],!1)}function F(e){return{type:"TOGGLE_FEATURE",feature:e}}const A={reducer:Object(b.combineReducers)({preferences:I}),selectors:i,actions:n,persist:["preferences"]},N=Object(b.createReduxStore)("core/customize-widgets",A);function G({label:e,info:t,messageActivated:s,messageDeactivated:i,shortcut:n,feature:r}){const o=Object(b.useSelect)(e=>e(N).__unstableIsFeatureActive(r),[r]),{__unstableToggleFeature:a}=Object(b.useDispatch)(N);return Object(c.createElement)(l.MenuItem,{icon:o&&W.a,isSelected:o,onClick:()=>{a(r),o?Object(B.speak)(i||Object(g.__)("Feature deactivated")):Object(B.speak)(s||Object(g.__)("Feature activated"))},role:"menuitemcheckbox",info:t,shortcut:n},e)}Object(b.registerStore)("core/customize-widgets",A);const P=[{keyCombination:{modifier:"primary",character:"b"},description:Object(g.__)("Make the selected text bold.")},{keyCombination:{modifier:"primary",character:"i"},description:Object(g.__)("Make the selected text italic.")},{keyCombination:{modifier:"primary",character:"k"},description:Object(g.__)("Convert the selected text into a link.")},{keyCombination:{modifier:"primaryShift",character:"k"},description:Object(g.__)("Remove a link.")},{keyCombination:{modifier:"primary",character:"u"},description:Object(g.__)("Underline the selected text.")}];function L({keyCombination:e,forceAriaLabel:t}){const s=e.modifier?f.displayShortcutList[e.modifier](e.character):e.character,i=e.modifier?f.shortcutAriaLabel[e.modifier](e.character):e.character;return Object(c.createElement)("kbd",{className:"customize-widgets-keyboard-shortcut-help-modal__shortcut-key-combination","aria-label":t||i},Object(d.castArray)(s).map((e,t)=>"+"===e?Object(c.createElement)(c.Fragment,{key:t},e):Object(c.createElement)("kbd",{key:t,className:"customize-widgets-keyboard-shortcut-help-modal__shortcut-key"},e)))}var R=function({description:e,keyCombination:t,aliases:s=[],ariaLabel:i}){return Object(c.createElement)(c.Fragment,null,Object(c.createElement)("div",{className:"customize-widgets-keyboard-shortcut-help-modal__shortcut-description"},e),Object(c.createElement)("div",{className:"customize-widgets-keyboard-shortcut-help-modal__shortcut-term"},Object(c.createElement)(L,{keyCombination:t,forceAriaLabel:i}),s.map((e,t)=>Object(c.createElement)(L,{keyCombination:e,forceAriaLabel:i,key:t}))))};var H=function({name:e}){const{keyCombination:t,description:s,aliases:i}=Object(b.useSelect)(t=>{const{getShortcutKeyCombination:s,getShortcutDescription:i,getShortcutAliases:n}=t(z.store);return{keyCombination:s(e),aliases:n(e),description:i(e)}});return t?Object(c.createElement)(R,{keyCombination:t,description:s,aliases:i}):null};const D=({shortcuts:e})=>Object(c.createElement)("ul",{className:"customize-widgets-keyboard-shortcut-help-modal__shortcut-list",role:"list"},e.map((e,t)=>Object(c.createElement)("li",{className:"customize-widgets-keyboard-shortcut-help-modal__shortcut",key:t},Object(d.isString)(e)?Object(c.createElement)(H,{name:e}):Object(c.createElement)(R,e)))),V=({title:e,shortcuts:t,className:s})=>Object(c.createElement)("section",{className:w()("customize-widgets-keyboard-shortcut-help-modal__section",s)},!!e&&Object(c.createElement)("h2",{className:"customize-widgets-keyboard-shortcut-help-modal__section-title"},e),Object(c.createElement)(D,{shortcuts:t})),U=({title:e,categoryName:t,additionalShortcuts:s=[]})=>{const i=Object(b.useSelect)(e=>e(z.store).getCategoryShortcuts(t),[t]);return Object(c.createElement)(V,{title:e,shortcuts:i.concat(s)})};function q({isModalActive:e,toggleModal:t}){const{registerShortcut:s}=Object(b.useDispatch)(z.store);return s({name:"core/customize-widgets/keyboard-shortcuts",category:"main",description:Object(g.__)("Display these keyboard shortcuts."),keyCombination:{modifier:"access",character:"h"}}),Object(z.useShortcut)("core/customize-widgets/keyboard-shortcuts",t,{bindGlobal:!0}),e?Object(c.createElement)(l.Modal,{className:"customize-widgets-keyboard-shortcut-help-modal",title:Object(g.__)("Keyboard shortcuts"),closeLabel:Object(g.__)("Close"),onRequestClose:t},Object(c.createElement)(V,{className:"customize-widgets-keyboard-shortcut-help-modal__main-shortcuts",shortcuts:["core/customize-widgets/keyboard-shortcuts"]}),Object(c.createElement)(U,{title:Object(g.__)("Global shortcuts"),categoryName:"global"}),Object(c.createElement)(U,{title:Object(g.__)("Selection shortcuts"),categoryName:"selection"}),Object(c.createElement)(U,{title:Object(g.__)("Block shortcuts"),categoryName:"block",additionalShortcuts:[{keyCombination:{character:"/"},description:Object(g.__)("Change the block type after adding a new paragraph."),ariaLabel:Object(g.__)("Forward-slash")}]}),Object(c.createElement)(V,{title:Object(g.__)("Text formatting"),shortcuts:P})):null}const K={className:"customize-widgets-more-menu__content",position:"bottom left"},$={tooltipPosition:"bottom"};function Q(){const[e,t]=Object(c.useState)(!1),s=()=>t(!e);return Object(z.useShortcut)("core/customize-widgets/keyboard-shortcuts",s,{bindGlobal:!0}),Object(c.createElement)(c.Fragment,null,Object(c.createElement)(l.ToolbarDropdownMenu,{className:"customize-widgets-more-menu",icon:x.a,label:Object(g.__)("Options"),popoverProps:K,toggleProps:$},()=>Object(c.createElement)(c.Fragment,null,Object(c.createElement)(l.MenuGroup,{label:Object(g._x)("View","noun")},Object(c.createElement)(G,{feature:"fixedToolbar",label:Object(g.__)("Top toolbar"),info:Object(g.__)("Access all block and document tools in a single place"),messageActivated:Object(g.__)("Top toolbar activated"),messageDeactivated:Object(g.__)("Top toolbar deactivated")})),Object(c.createElement)(l.MenuGroup,{label:Object(g.__)("Tools")},Object(c.createElement)(l.MenuItem,{onClick:()=>{t(!0)},shortcut:f.displayShortcut.access("h")},Object(g.__)("Keyboard shortcuts")),Object(c.createElement)(G,{feature:"welcomeGuide",label:Object(g.__)("Welcome Guide")}),Object(c.createElement)(l.MenuItem,{role:"menuitem",icon:S.a,href:Object(g.__)("https://wordpress.org/support/article/wordpress-editor/"),target:"_blank",rel:"noopener noreferrer"},Object(g.__)("Help"),Object(c.createElement)(l.VisuallyHidden,{as:"span"},Object(g.__)("(opens in a new tab)")))),Object(c.createElement)(l.MenuGroup,{label:Object(g.__)("Preferences")},Object(c.createElement)(G,{feature:"keepCaretInsideBlock",label:Object(g.__)("Contain text cursor inside block"),info:Object(g.__)("Aids screen readers by stopping text caret from leaving blocks."),messageActivated:Object(g.__)("Contain text cursor inside block activated"),messageDeactivated:Object(g.__)("Contain text cursor inside block deactivated")})))),Object(c.createElement)(q,{isModalActive:e,toggleModal:s}))}var Y=function({sidebar:e,inserter:t,isInserterOpened:s,setIsInserterOpened:i,isFixedToolbarActive:n}){const[[r,o],a]=Object(c.useState)([e.hasUndo(),e.hasRedo()]);return Object(c.useEffect)(()=>e.subscribeHistory(()=>{a([e.hasUndo(),e.hasRedo()])}),[e]),Object(c.createElement)(c.Fragment,null,Object(c.createElement)("div",{className:w()("customize-widgets-header",{"is-fixed-toolbar-active":n})},Object(c.createElement)(m.NavigableToolbar,{className:"customize-widgets-header-toolbar","aria-label":Object(g.__)("Document tools")},Object(c.createElement)(l.ToolbarButton,{icon:Object(g.isRTL)()?y.a:_.a,label:Object(g.__)("Undo"),shortcut:f.displayShortcut.primary("z"),"aria-disabled":!r,onClick:e.undo,className:"customize-widgets-editor-history-button undo-button"}),Object(c.createElement)(l.ToolbarButton,{icon:Object(g.isRTL)()?_.a:y.a,label:Object(g.__)("Redo"),shortcut:f.displayShortcut.primaryShift("z"),"aria-disabled":!o,onClick:e.redo,className:"customize-widgets-editor-history-button redo-button"}),Object(c.createElement)(l.ToolbarButton,{className:"customize-widgets-header-toolbar__inserter-toggle",isPressed:s,isPrimary:!0,icon:v.a,label:Object(g._x)("Add block","Generic label for block inserter button"),onClick:()=>{i(e=>!e)}}),Object(c.createElement)(Q,null))),Object(c.createPortal)(Object(c.createElement)(C,{setIsOpened:i}),t.contentContainer[0]))};var Z=s("rl8x"),J=s.n(Z);function X(e){const t=e.match(/^widget_(.+)(?:\[(\d+)\])$/);if(t){return`${t[1]}-${parseInt(t[2],10)}`}return e}function ee(e,t=null){let s;if("core/legacy-widget"===e.name&&(e.attributes.id||e.attributes.instance))if(e.attributes.id)s={id:e.attributes.id};else{const{encoded:i,hash:n,raw:c,...r}=e.attributes.instance;s={idBase:e.attributes.idBase,instance:{...null==t?void 0:t.instance,is_widget_customizer_js_value:!0,encoded_serialized_instance:i,instance_hash_key:n,raw_instance:c,...r}}}else{s={idBase:"block",widgetClass:"WP_Widget_Block",instance:{raw_instance:{content:Object(a.serialize)(e)}}}}return{...Object(d.omit)(t,["form","rendered"]),...s}}function te({id:e,idBase:t,number:s,instance:i}){let n;const{encoded_serialized_instance:c,instance_hash_key:r,raw_instance:l,...d}=i;if("block"===t){const e=Object(a.parse)(l.content);n=e.length?e[0]:Object(a.createBlock)("core/paragraph",{})}else n=s?Object(a.createBlock)("core/legacy-widget",{idBase:t,instance:{encoded:c,hash:r,raw:l,...d}}):Object(a.createBlock)("core/legacy-widget",{id:e});return Object(o.addWidgetIdToBlock)(n,e)}function se(e){const[t,s]=Object(c.useState)(()=>e.getWidgets().map(e=>te(e)));Object(c.useEffect)(()=>e.subscribe((e,t)=>{s(s=>{const i=new Map(e.map(e=>[e.id,e])),n=new Map(s.map(e=>[Object(o.getWidgetIdFromBlock)(e),e])),c=t.map(e=>{const t=i.get(e.id);return t&&t===e?n.get(e.id):te(e)});return J()(s,c)?s:c})}),[e]);const i=Object(c.useCallback)(t=>{s(s=>{if(J()(s,t))return s;const i=new Map(s.map(e=>[Object(o.getWidgetIdFromBlock)(e),e])),n=t.map(t=>{const s=Object(o.getWidgetIdFromBlock)(t);if(s&&i.has(s)){const n=i.get(s),c=e.getWidget(s);return Object(d.isEqual)(t,n)&&c?c:ee(t,c)}return ee(t)});if(J()(e.getWidgets(),n))return s;const c=e.setWidgets(n);return t.reduce((e,s,i)=>{const n=c[i];return null!==n&&(e===t&&(e=t.slice()),e[i]=Object(o.addWidgetIdToBlock)(s,n)),e},t)})},[e]);return[t,i,i]}const ie=Object(c.createContext)();function ne({api:e,sidebarControls:t,children:s}){const[i,n]=Object(c.useState)({current:null}),r=Object(c.useCallback)(e=>{for(const s of t){if(s.setting.get().includes(e)){s.sectionInstance.expand({completeCallback(){n({current:e})}});break}}},[t]);Object(c.useEffect)(()=>{function t(e){const t=X(e);r(t)}function s(){e.previewer.preview.bind("focus-control-for-setting",t)}return e.previewer.bind("ready",s),()=>{e.previewer.unbind("ready",s),e.previewer.preview.unbind("focus-control-for-setting",t)}},[e,r]);const o=Object(c.useMemo)(()=>[i,r],[i,r]);return Object(c.createElement)(ie.Provider,{value:o},s)}const ce=()=>Object(c.useContext)(ie);function re({sidebar:e,settings:t,children:s}){const[i,n,r]=se(e);return function(e){const{selectBlock:t}=Object(b.useDispatch)(m.store),[s]=ce(),i=Object(c.useRef)(e);Object(c.useEffect)(()=>{i.current=e},[e]),Object(c.useEffect)(()=>{if(s.current){const e=i.current.find(e=>Object(o.getWidgetIdFromBlock)(e)===s.current);if(e){t(e.clientId);const s=document.querySelector(`[data-block="${e.clientId}"]`);null==s||s.focus()}}},[s,t])}(i),Object(c.createElement)(m.BlockEditorProvider,{value:i,onInput:n,onChange:r,settings:t,useSubRegistry:!1},s)}function oe({sidebar:e}){const{__unstableToggleFeature:t}=Object(b.useDispatch)(N),s=e.getWidgets().every(e=>e.id.startsWith("block-"));return Object(c.createElement)("div",{className:"customize-widgets-welcome-guide"},Object(c.createElement)("div",{className:"customize-widgets-welcome-guide__image__wrapper"},Object(c.createElement)("picture",null,Object(c.createElement)("source",{srcSet:"https://s.w.org/images/block-editor/welcome-editor.svg",media:"(prefers-reduced-motion: reduce)"}),Object(c.createElement)("img",{className:"customize-widgets-welcome-guide__image",src:"https://s.w.org/images/block-editor/welcome-editor.gif",width:"312",height:"240",alt:""}))),Object(c.createElement)("h1",{className:"customize-widgets-welcome-guide__heading"},Object(g.__)("Welcome to block Widgets")),Object(c.createElement)("p",{className:"customize-widgets-welcome-guide__text"},s?Object(g.__)("Your theme provides different “block” areas for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how theyll look on your site."):Object(g.__)("You can now add any block to your sites widget areas. Dont worry, all of your favorite widgets still work flawlessly.")),Object(c.createElement)(l.Button,{className:"customize-widgets-welcome-guide__button",isPrimary:!0,onClick:()=>t("welcomeGuide")},Object(g.__)("Got it")),Object(c.createElement)("hr",{className:"customize-widgets-welcome-guide__separator"}),!s&&Object(c.createElement)("p",{className:"customize-widgets-welcome-guide__more-info"},Object(g.__)("Want to stick with the old widgets?"),Object(c.createElement)("br",null),Object(c.createElement)(l.ExternalLink,{href:Object(g.__)("https://wordpress.org/plugins/classic-widgets/")},Object(g.__)("Get the Classic Widgets plugin."))),Object(c.createElement)("p",{className:"customize-widgets-welcome-guide__more-info"},Object(g.__)("New to the block editor?"),Object(c.createElement)("br",null),Object(c.createElement)(l.ExternalLink,{href:Object(g.__)("https://wordpress.org/support/article/wordpress-editor/")},Object(g.__)("Here's a detailed guide."))))}function ae({undo:e,redo:t,save:s}){return Object(z.useShortcut)("core/customize-widgets/undo",t=>{e(),t.preventDefault()},{bindGlobal:!0}),Object(z.useShortcut)("core/customize-widgets/redo",e=>{t(),e.preventDefault()},{bindGlobal:!0}),Object(z.useShortcut)("core/customize-widgets/save",e=>{e.preventDefault(),s()},{bindGlobal:!0}),null}ae.Register=function(){const{registerShortcut:e,unregisterShortcut:t}=Object(b.useDispatch)(z.store);return Object(c.useEffect)(()=>(e({name:"core/customize-widgets/undo",category:"global",description:Object(g.__)("Undo your last changes."),keyCombination:{modifier:"primary",character:"z"}}),e({name:"core/customize-widgets/redo",category:"global",description:Object(g.__)("Redo your last undo."),keyCombination:{modifier:"primaryShift",character:"z"}}),e({name:"core/customize-widgets/save",category:"global",description:Object(g.__)("Save your changes."),keyCombination:{modifier:"primary",character:"s"}}),()=>{t("core/customize-widgets/undo"),t("core/customize-widgets/redo"),t("core/customize-widgets/save")}),[e]),null};var le=ae;function de(e){const t=Object(c.useRef)(),s=Object(b.useSelect)(e=>0===e(m.store).getBlockCount());return Object(c.useEffect)(()=>{if(s&&t.current){const{ownerDocument:e}=t.current;e.activeElement&&e.activeElement!==e.body||t.current.focus()}},[s]),Object(c.createElement)(m.ButtonBlockAppender,Object(p.a)({},e,{ref:t}))}function ue({blockEditorSettings:e,sidebar:t,inserter:s,inspector:i}){const[n,r]=function(e){const[t,s]=Object(c.useState)(()=>e.isOpen);return Object(c.useEffect)(()=>e.subscribe(s),[e]),[t,Object(c.useCallback)(t=>{let s=t;"function"==typeof t&&(s=t(e.isOpen)),s?e.open():e.close()},[e])]}(s),{hasUploadPermissions:o,isFixedToolbarActive:a,keepCaretInsideBlock:l,isWelcomeGuideActive:p}=Object(b.useSelect)(e=>({hasUploadPermissions:Object(d.defaultTo)(e(u.store).canUser("create","media"),!0),isFixedToolbarActive:e(N).__unstableIsFeatureActive("fixedToolbar"),keepCaretInsideBlock:e(N).__unstableIsFeatureActive("keepCaretInsideBlock"),isWelcomeGuideActive:e(N).__unstableIsFeatureActive("welcomeGuide")}),[]),g=Object(c.useMemo)(()=>{let t;return o&&(t=({onError:t,...s})=>{Object(h.uploadMedia)({wpAllowedMimeTypes:e.allowedMimeTypes,onError:({message:e})=>t(e),...s})}),{...e,__experimentalSetIsInserterOpened:r,mediaUpload:t,hasFixedToolbar:a,keepCaretInsideBlock:l,__unstableHasCustomAppender:!0}},[o,e,a,l]);return p?Object(c.createElement)(oe,{sidebar:t}):Object(c.createElement)(c.Fragment,null,Object(c.createElement)(m.BlockEditorKeyboardShortcuts.Register,null),Object(c.createElement)(le.Register,null),Object(c.createElement)(re,{sidebar:t,settings:g},Object(c.createElement)(m.BlockEditorKeyboardShortcuts,null),Object(c.createElement)(le,{undo:t.undo,redo:t.redo,save:t.save}),Object(c.createElement)(Y,{sidebar:t,inserter:s,isInserterOpened:n,setIsInserterOpened:r,isFixedToolbarActive:a}),Object(c.createElement)(m.CopyHandler,null,Object(c.createElement)(m.BlockTools,null,Object(c.createElement)(m.BlockSelectionClearer,null,Object(c.createElement)(m.WritingFlow,null,Object(c.createElement)(m.ObserveTyping,null,Object(c.createElement)(m.BlockList,{renderAppender:de})))))),Object(c.createPortal)(Object(c.createElement)("form",{onSubmit:e=>e.preventDefault()},Object(c.createElement)(m.BlockInspector,null)),i.contentContainer[0])),Object(c.createElement)(m.__unstableBlockSettingsMenuFirstItem,null,({onClose:e})=>Object(c.createElement)(O,{inspector:i,closeMenu:e})))}const be=Object(c.createContext)();function me({sidebarControls:e,activeSidebarControl:t,children:s}){const i=Object(c.useMemo)(()=>({sidebarControls:e,activeSidebarControl:t}),[e,t]);return Object(c.createElement)(be.Provider,{value:i},s)}function he({api:e,sidebarControls:t,blockEditorSettings:s}){const[i,n]=Object(c.useState)(null),r=document.getElementById("customize-theme-controls"),o=Object(c.useRef)();!function(e,t){const{hasSelectedBlock:s,hasMultiSelection:i}=Object(b.useSelect)(m.store),{clearSelectedBlock:n}=Object(b.useDispatch)(m.store);Object(c.useEffect)(()=>{if(t.current&&e){const a=e.inspector,l=e.container[0],d=l.ownerDocument,u=d.defaultView;function c(e){!s()&&!i()||!e||!d.contains(e)||l.contains(e)||t.current.contains(e)||e.closest('[role="dialog"]')||a.expanded()||n()}function r(e){c(e.target)}function o(){c(d.activeElement)}return d.addEventListener("mousedown",r),u.addEventListener("blur",o),()=>{d.removeEventListener("mousedown",r),u.removeEventListener("blur",o)}}},[t,e,s,i,n])}(i,o),Object(c.useEffect)(()=>{const e=t.map(e=>e.subscribe(t=>{t&&n(e)}));return()=>{e.forEach(e=>e())}},[t]);const a=i&&Object(c.createPortal)(Object(c.createElement)(ue,{key:i.id,blockEditorSettings:s,sidebar:i.sidebarAdapter,inserter:i.inserter,inspector:i.inspector}),i.container[0]),d=r&&Object(c.createPortal)(Object(c.createElement)("div",{className:"customize-widgets-popover",ref:o},Object(c.createElement)(l.Popover.Slot,null)),r);return Object(c.createElement)(l.SlotFillProvider,null,Object(c.createElement)(me,{sidebarControls:t,activeSidebarControl:i},Object(c.createElement)(ne,{api:e,sidebarControls:t},a,d)))}function pe(){const{wp:{customize:e}}=window;return class extends e.Section{ready(){const t=function(){const{wp:{customize:e}}=window;return class extends e.Section{constructor(e,t){super(e,t),this.parentSection=t.parentSection,this.returnFocusWhenClose=null}ready(){this.contentContainer[0].classList.add("customize-widgets-layout__inspector")}onChangeExpanded(e,t){super.onChangeExpanded(e,t),this.parentSection&&!t.unchanged&&(e?this.parentSection.collapse({manualTransition:!0}):this.parentSection.expand({manualTransition:!0,completeCallback:()=>{this.returnFocusWhenClose&&!this.contentContainer[0].contains(this.returnFocusWhenClose)&&this.returnFocusWhenClose.focus()}}))}open({returnFocusWhenClose:e}={}){this.returnFocusWhenClose=e,this.expand({allowMultiple:!0})}close(){this.collapse({allowMultiple:!0})}}}();this.inspector=new t("widgets-inspector-"+this.id,{title:Object(g.__)("Block Settings"),parentSection:this,customizeAction:[Object(g.__)("Customizing"),Object(g.__)("Widgets"),this.params.title].join(" ▸ ")}),e.section.add(this.inspector),this.contentContainer[0].classList.add("customize-widgets__sidebar-section")}hasSubSectionOpened(){return this.inspector.expanded()}onChangeExpanded(e,t){const s=this.controls(),i={...t,completeCallback(){var n;s.forEach(t=>{t.onChangeSectionExpanded(e,i)}),null===(n=t.completeCallback)||void 0===n||n.call(t)}};i.manualTransition?e?(this.contentContainer.addClass(["busy","open"]),this.contentContainer.removeClass("is-sub-section-open"),this.contentContainer.closest(".wp-full-overlay").addClass("section-open"),this.contentContainer.one("transitionend",()=>{this.contentContainer.removeClass("busy"),i.completeCallback()})):(this.contentContainer.addClass(["busy","is-sub-section-open"]),this.contentContainer.closest(".wp-full-overlay").addClass("section-open"),this.contentContainer.removeClass("open"),this.contentContainer.one("transitionend",()=>{this.contentContainer.removeClass("busy"),i.completeCallback()})):super.onChangeExpanded(e,i)}}}const{wp:ge}=window;function Oe(e){const t=e.match(/^(.+)-(\d+)$/);return t?{idBase:t[1],number:parseInt(t[2],10)}:{idBase:e}}function je(e){const{idBase:t,number:s}=Oe(e);return s?`widget_${t}[${s}]`:"widget_"+t}class we{constructor(e,t){this.setting=e,this.api=t,this.locked=!1,this.widgetsCache=new WeakMap,this.subscribers=new Set,this.history=[this._getWidgetIds().map(e=>this.getWidget(e))],this.historyIndex=0,this.historySubscribers=new Set,this._debounceSetHistory=function(e,t,s){let i,n=!1;function c(...c){const r=(n?t:e).apply(this,c);return n=!0,clearTimeout(i),i=setTimeout(()=>{n=!1},s),r}return c.cancel=()=>{n=!1,clearTimeout(i)},c}(this._pushHistory,this._replaceHistory,1e3),this.setting.bind(this._handleSettingChange.bind(this)),this.api.bind("change",this._handleAllSettingsChange.bind(this)),this.undo=this.undo.bind(this),this.redo=this.redo.bind(this),this.save=this.save.bind(this)}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}getWidgets(){return this.history[this.historyIndex]}_emit(...e){for(const t of this.subscribers)t(...e)}_getWidgetIds(){return this.setting.get()}_pushHistory(){this.history=[...this.history.slice(0,this.historyIndex+1),this._getWidgetIds().map(e=>this.getWidget(e))],this.historyIndex+=1,this.historySubscribers.forEach(e=>e())}_replaceHistory(){this.history[this.historyIndex]=this._getWidgetIds().map(e=>this.getWidget(e))}_handleSettingChange(){if(this.locked)return;const e=this.getWidgets();this._pushHistory(),this._emit(e,this.getWidgets())}_handleAllSettingsChange(e){if(this.locked)return;if(!e.id.startsWith("widget_"))return;const t=X(e.id);if(!this.setting.get().includes(t))return;const s=this.getWidgets();this._pushHistory(),this._emit(s,this.getWidgets())}_createWidget(e){const t=ge.customize.Widgets.availableWidgets.findWhere({id_base:e.idBase});let s=e.number;t.get("is_multi")&&!s&&(t.set("multi_number",t.get("multi_number")+1),s=t.get("multi_number"));const i=s?`widget_${e.idBase}[${s}]`:"widget_"+e.idBase,n={transport:ge.customize.Widgets.data.selectiveRefreshableWidgets[t.get("id_base")]?"postMessage":"refresh",previewer:this.setting.previewer};this.api.create(i,i,"",n).set(e.instance);return X(i)}_removeWidget(e){const t=je(e.id),s=this.api(t);if(s){const e=s.get();this.widgetsCache.delete(e)}this.api.remove(t)}_updateWidget(e){const t=this.getWidget(e.id);if(t===e)return e.id;if(t.idBase&&e.idBase&&t.idBase===e.idBase){const t=je(e.id);return this.api(t).set(e.instance),e.id}return this._removeWidget(e),this._createWidget(e)}getWidget(e){if(!e)return null;const{idBase:t,number:s}=Oe(e),i=je(e),n=this.api(i);if(!n)return null;const c=n.get();if(this.widgetsCache.has(c))return this.widgetsCache.get(c);const r={id:e,idBase:t,number:s,instance:c};return this.widgetsCache.set(c,r),r}_updateWidgets(e){this.locked=!0;const t=[],s=e.map(e=>{if(e.id&&this.getWidget(e.id))return t.push(null),this._updateWidget(e);const s=this._createWidget(e);return t.push(s),s});return this.getWidgets().filter(e=>!s.includes(e.id)).forEach(e=>this._removeWidget(e)),this.setting.set(s),this.locked=!1,t}setWidgets(e){const t=this._updateWidgets(e);return this._debounceSetHistory(),t}hasUndo(){return this.historyIndex>0}hasRedo(){return this.historyIndex<this.history.length-1}_seek(e){const t=this.getWidgets();this.historyIndex=e;const s=this.history[this.historyIndex];this._updateWidgets(s),this._emit(t,this.getWidgets()),this.historySubscribers.forEach(e=>e()),this._debounceSetHistory.cancel()}undo(){this.hasUndo()&&this._seek(this.historyIndex-1)}redo(){this.hasRedo()&&this._seek(this.historyIndex+1)}subscribeHistory(e){return this.historySubscribers.add(e),()=>{this.historySubscribers.delete(e)}}save(){this.api.previewer.save()}}var fe=s("1CF3");function _e(){const{wp:{customize:e}}=window;return class extends e.Control{constructor(...e){super(...e),this.subscribers=new Set}ready(){const t=function(){const{wp:{customize:e}}=window,t=e.OuterSection;return e.OuterSection=class extends t{onChangeExpanded(t,s){return t&&e.section.each(e=>{"outer"===e.params.type&&e.id!==this.id&&e.expanded()&&e.collapse()}),super.onChangeExpanded(t,s)}},e.sectionConstructor.outer=e.OuterSection,class extends e.OuterSection{constructor(...e){super(...e),this.params.type="outer",this.activeElementBeforeExpanded=null;this.contentContainer[0].ownerDocument.defaultView.addEventListener("keydown",e=>{!this.isOpen||e.keyCode!==f.ESCAPE&&"Escape"!==e.code||(e.stopPropagation(),this.close())},!0),this.contentContainer.addClass("widgets-inserter")}get isOpen(){return this.expanded()}subscribe(e){return this.expanded.bind(e),()=>this.expanded.unbind(e)}open(){if(!this.isOpen){const e=this.contentContainer[0];this.activeElementBeforeExpanded=e.ownerDocument.activeElement,this.expand({completeCallback(){const t=fe.focus.tabbable.find(e)[1];t&&t.focus()}})}}close(){if(this.isOpen){const e=this.contentContainer[0],t=e.ownerDocument.activeElement;this.collapse({completeCallback(){e.contains(t)&&this.activeElementBeforeExpanded&&this.activeElementBeforeExpanded.focus()}})}}}}();this.inserter=new t("widgets-inserter-"+this.id,{}),e.section.add(this.inserter),this.sectionInstance=e.section(this.section()),this.inspector=this.sectionInstance.inspector,this.sidebarAdapter=new we(this.setting,e)}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}onChangeSectionExpanded(e,t){t.unchanged||(e||this.inserter.close(),this.subscribers.forEach(s=>s(e,t)))}}}var ye=s("g56x");const ve=Object(E.createHigherOrderComponent)(e=>t=>{let s=Object(o.getWidgetIdFromBlock)(t);const i=function(){const{sidebarControls:e}=Object(c.useContext)(be);return e}(),n=function(){const{activeSidebarControl:e}=Object(c.useContext)(be);return e}(),r=(null==i?void 0:i.length)>1,a=t.name,l=t.clientId,u=Object(b.useSelect)(e=>e(m.store).canInsertBlockType(a,""),[a]),h=Object(b.useSelect)(e=>e(m.store).getBlock(l),[l]),{removeBlock:p}=Object(b.useDispatch)(m.store),[,g]=ce();return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(e,t),r&&u&&Object(c.createElement)(m.BlockControls,null,Object(c.createElement)(o.MoveToWidgetArea,{widgetAreas:i.map(e=>({id:e.id,name:e.params.label,description:e.params.description})),currentWidgetAreaId:null==n?void 0:n.id,onSelect:function(e){const t=i.find(t=>t.id===e);if(s){const e=n.setting,i=t.setting;e(Object(d.without)(e(),s)),i([...i(),s])}else{const e=t.sidebarAdapter;p(l);const i=e.setWidgets([...e.getWidgets(),ee(h)]);s=i.reverse().find(e=>!!e)}g(s)}})))},"withMoveToSidebarToolbarItem");Object(ye.addFilter)("editor.BlockEdit","core/customize-widgets/block-edit",ve);Object(ye.addFilter)("editor.MediaUpload","core/edit-widgets/replace-media-upload",()=>h.MediaUpload);const{wp:Ee}=window,ke=Object(E.createHigherOrderComponent)(e=>t=>{var s,i;const{idBase:n}=t.attributes,r=null!==(s=null===(i=Ee.customize.Widgets.data.availableWidgets.find(e=>e.id_base===n))||void 0===i?void 0:i.is_wide)&&void 0!==s&&s;return Object(c.createElement)(e,Object(p.a)({},t,{isWide:r}))},"withWideWidgetDisplay");Object(ye.addFilter)("editor.BlockEdit","core/customize-widgets/wide-widget-display",ke);const{wp:Ce}=window,xe=["core/more","core/block","core/freeform"];function Se(e,t){const s=Object(r.__experimentalGetCoreBlocks)().filter(e=>!(xe.includes(e.name)||e.name.startsWith("core/post")||e.name.startsWith("core/query")||e.name.startsWith("core/site")));Object(r.registerCoreBlocks)(s),Object(o.registerLegacyWidgetBlock)(),Object(o.registerLegacyWidgetVariations)(t),Object(a.setFreeformContentHandlerName)("core/html");const i=_e();Ce.customize.sectionConstructor.sidebar=pe(),Ce.customize.controlConstructor.sidebar_block_editor=i;const n=document.createElement("div");document.body.appendChild(n),Ce.customize.bind("ready",()=>{const e=[];Ce.customize.control.each(t=>{t instanceof i&&e.push(t)}),Object(c.render)(Object(c.createElement)(he,{api:Ce.customize,sidebarControls:e,blockEditorSettings:t}),n)})}},GLVC:function(e,t){e.exports=window.wp.widgets},GRId:function(e,t){e.exports=window.wp.element},HSyU:function(e,t){e.exports=window.wp.blocks},"K+tz":function(e,t,s){"use strict";var i=s("GRId"),n=s("Tqx9");const c=Object(i.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(i.createElement)(n.Path,{d:"M18.2 17c0 .7-.6 1.2-1.2 1.2H7c-.7 0-1.2-.6-1.2-1.2V7c0-.7.6-1.2 1.2-1.2h3.2V4.2H7C5.5 4.2 4.2 5.5 4.2 7v10c0 1.5 1.2 2.8 2.8 2.8h10c1.5 0 2.8-1.2 2.8-2.8v-3.6h-1.5V17zM14.9 3v1.5h3.7l-6.4 6.4 1.1 1.1 6.4-6.4v3.7h1.5V3h-6.3z"}));t.a=c},K2cm:function(e,t,s){"use strict";var i=s("GRId"),n=s("Tqx9");const c=Object(i.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(i.createElement)(n.Path,{d:"M15.6 6.5l-1.1 1 2.9 3.3H8c-.9 0-1.7.3-2.3.9-1.4 1.5-1.4 4.2-1.4 5.6v.2h1.5v-.3c0-1.1 0-3.5 1-4.5.3-.3.7-.5 1.3-.5h9.2L14.5 15l1.1 1.1 4.6-4.6-4.6-5z"}));t.a=c},K9lf:function(e,t){e.exports=window.wp.compose},Ntru:function(e,t,s){"use strict";var i=s("GRId"),n=s("Tqx9");const c=Object(i.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(i.createElement)(n.Path,{d:"M18.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z"}));t.a=c},Q4Sy:function(e,t,s){"use strict";var i=s("GRId"),n=s("Tqx9");const c=Object(i.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(i.createElement)(n.Path,{d:"M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"}));t.a=c},QyPg:function(e,t){e.exports=window.wp.blockLibrary},RMJe:function(e,t,s){"use strict";var i=s("GRId"),n=s("Tqx9");const c=Object(i.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(i.createElement)(n.Path,{d:"M18.3 5.6L9.9 16.9l-4.6-3.4-.9 1.2 5.8 4.3 9.3-12.6z"}));t.a=c},RxS6:function(e,t){e.exports=window.wp.keycodes},TSYQ:function(e,t,s){var i;
/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/!function(){"use strict";var s={}.hasOwnProperty;function n(){for(var e=[],t=0;t<arguments.length;t++){var i=arguments[t];if(i){var c=typeof i;if("string"===c||"number"===c)e.push(i);else if(Array.isArray(i)){if(i.length){var r=n.apply(null,i);r&&e.push(r)}}else if("object"===c)if(i.toString===Object.prototype.toString)for(var o in i)s.call(i,o)&&i[o]&&e.push(o);else e.push(i.toString())}}return e.join(" ")}e.exports?(n.default=n,e.exports=n):void 0===(i=function(){return n}.apply(t,[]))||(e.exports=i)}()},Tqx9:function(e,t){e.exports=window.wp.primitives},VKE3:function(e,t,s){"use strict";var i=s("GRId"),n=s("Tqx9");const c=Object(i.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(i.createElement)(n.Path,{d:"M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"}));t.a=c},YLtl:function(e,t){e.exports=window.lodash},axFQ:function(e,t){e.exports=window.wp.blockEditor},bWcr:function(e,t,s){"use strict";var i=s("GRId"),n=s("Tqx9");const c=Object(i.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(i.createElement)(n.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"}));t.a=c},g56x:function(e,t){e.exports=window.wp.hooks},gdqT:function(e,t){e.exports=window.wp.a11y},hF7m:function(e,t){e.exports=window.wp.keyboardShortcuts},jZUy:function(e,t){e.exports=window.wp.coreData},l3Sj:function(e,t){e.exports=window.wp.i18n},rl8x:function(e,t){e.exports=window.wp.isShallowEqual},"tI+e":function(e,t){e.exports=window.wp.components},wx14:function(e,t,s){"use strict";function i(){return(i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(e[i]=s[i])}return e}).apply(this,arguments)}s.d(t,"a",(function(){return i}))}});