/*! This file is auto-generated */ !function(){var e={6411:function(e,t){var n,o,r; /*! autosize 4.0.4 license: MIT http://www.jacklmoore.com/autosize */o=[e,t],n=function(e,t){"use strict";var n,o,r="function"==typeof Map?new Map:(n=[],o=[],{has:function(e){return n.indexOf(e)>-1},get:function(e){return o[n.indexOf(e)]},set:function(e,t){-1===n.indexOf(e)&&(n.push(e),o.push(t))},delete:function(e){var t=n.indexOf(e);t>-1&&(n.splice(t,1),o.splice(t,1))}}),i=function(e){return new Event(e,{bubbles:!0})};try{new Event("test")}catch(e){i=function(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!1),t}}function s(e){if(e&&e.nodeName&&"TEXTAREA"===e.nodeName&&!r.has(e)){var t=null,n=null,o=null,s=function(){e.clientWidth!==n&&p()},a=function(t){window.removeEventListener("resize",s,!1),e.removeEventListener("input",p,!1),e.removeEventListener("keyup",p,!1),e.removeEventListener("autosize:destroy",a,!1),e.removeEventListener("autosize:update",p,!1),Object.keys(t).forEach((function(n){e.style[n]=t[n]})),r.delete(e)}.bind(e,{height:e.style.height,resize:e.style.resize,overflowY:e.style.overflowY,overflowX:e.style.overflowX,wordWrap:e.style.wordWrap});e.addEventListener("autosize:destroy",a,!1),"onpropertychange"in e&&"oninput"in e&&e.addEventListener("keyup",p,!1),window.addEventListener("resize",s,!1),e.addEventListener("input",p,!1),e.addEventListener("autosize:update",p,!1),e.style.overflowX="hidden",e.style.wordWrap="break-word",r.set(e,{destroy:a,update:p}),l()}function l(){var n=window.getComputedStyle(e,null);"vertical"===n.resize?e.style.resize="none":"both"===n.resize&&(e.style.resize="horizontal"),t="content-box"===n.boxSizing?-(parseFloat(n.paddingTop)+parseFloat(n.paddingBottom)):parseFloat(n.borderTopWidth)+parseFloat(n.borderBottomWidth),isNaN(t)&&(t=0),p()}function c(t){var n=e.style.width;e.style.width="0px",e.offsetWidth,e.style.width=n,e.style.overflowY=t}function u(e){for(var t=[];e&&e.parentNode&&e.parentNode instanceof Element;)e.parentNode.scrollTop&&t.push({node:e.parentNode,scrollTop:e.parentNode.scrollTop}),e=e.parentNode;return t}function d(){if(0!==e.scrollHeight){var o=u(e),r=document.documentElement&&document.documentElement.scrollTop;e.style.height="",e.style.height=e.scrollHeight+t+"px",n=e.clientWidth,o.forEach((function(e){e.node.scrollTop=e.scrollTop})),r&&(document.documentElement.scrollTop=r)}}function p(){d();var t=Math.round(parseFloat(e.style.height)),n=window.getComputedStyle(e,null),r="content-box"===n.boxSizing?Math.round(parseFloat(n.height)):e.offsetHeight;if(r]/;e.exports=function(e){var n,o=""+e,r=t.exec(o);if(!r)return o;var i="",s=0,a=0;for(s=r.index;s0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0;return"SETUP_EDITOR_STATE"===t.type?t.post.id:e},postType:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0;return"SETUP_EDITOR_STATE"===t.type?t.post.type:e},saving:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"REQUEST_POST_UPDATE_START":case"REQUEST_POST_UPDATE_FINISH":return{pending:"REQUEST_POST_UPDATE_START"===t.type,options:t.options||{}}}return e},deleting:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"REQUEST_POST_DELETE_START":case"REQUEST_POST_DELETE_FINISH":return{pending:"REQUEST_POST_DELETE_START"===t.type}}return e},postLock:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{isLocked:!1},t=arguments.length>1?arguments[1]:void 0;return"UPDATE_POST_LOCK"===t.type?t.lock:e},template:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{isValid:!0},t=arguments.length>1?arguments[1]:void 0;return"SET_TEMPLATE_VALIDITY"===t.type?{...e,isValid:t.isValid}:e},postSavingLock:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"LOCK_POST_SAVING":return{...e,[t.lockName]:!0};case"UNLOCK_POST_SAVING":{const{[t.lockName]:n,...o}=e;return o}}return e},isReady:function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SETUP_EDITOR_STATE":return!0;case"TEAR_DOWN_EDITOR":return!1}return e},editorSettings:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:m,t=arguments.length>1?arguments[1]:void 0;return"UPDATE_EDITOR_SETTINGS"===t.type?{...e,...t.settings}:e},postAutosavingLock:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"LOCK_POST_AUTOSAVING":return{...e,[t.lockName]:!0};case"UNLOCK_POST_AUTOSAVING":{const{[t.lockName]:n,...o}=e;return o}}return e}}),f={};function v(e){return[e]}function _(e,t,n){var o;if(e.length!==t.length)return!1;for(o=n;o()=>e(c.store).hasUndo())),z=(0,l.createRegistrySelector)((e=>()=>e(c.store).hasRedo()));function H(e){return"auto-draft"===G(e).status}function V(e){return"content"in X(e)}const W=(0,l.createRegistrySelector)((e=>t=>{const n=K(t),o=Y(t);return!!e(c.store).hasEditsForEntityRecord("postType",n,o)})),j=(0,l.createRegistrySelector)((e=>t=>{const n=e(c.store).__experimentalGetDirtyEntityRecords(),{type:o,id:r}=G(t);return n.some((e=>"postType"!==e.kind||e.name!==o||e.key!==r))}));function $(e){return!W(e)&&H(e)}const G=(0,l.createRegistrySelector)((e=>t=>{const n=Y(t),o=K(t),r=e(c.store).getRawEntityRecord("postType",o,n);return r||U}));function K(e){return e.postType}function Y(e){return e.postId}function q(e){var t,n,o,r;return null!==(t=null===(n=G(e)._links)||void 0===n||null===(o=n["version-history"])||void 0===o||null===(r=o[0])||void 0===r?void 0:r.count)&&void 0!==t?t:0}function Q(e){var t,n,o,r;return null!==(t=null===(n=G(e)._links)||void 0===n||null===(o=n["predecessor-version"])||void 0===o||null===(r=o[0])||void 0===r?void 0:r.id)&&void 0!==t?t:null}const X=(0,l.createRegistrySelector)((e=>t=>{const n=K(t),o=Y(t);return e(c.store).getEntityRecordEdits("postType",n,o)||U}));function Z(e,t){switch(t){case"type":return K(e);case"id":return Y(e);default:const n=G(e);if(!n.hasOwnProperty(t))break;return h(n[t])}}function J(e,t){if("content"===t)return be(e);const n=X(e);return n.hasOwnProperty(t)?T.has(t)?((e,t)=>{const n=X(e);return n.hasOwnProperty(t)?{...Z(e,t),...n[t]}:Z(e,t)})(e,t):n[t]:Z(e,t)}const ee=(0,l.createRegistrySelector)((e=>(t,n)=>{var o;if(!I.includes(n)&&"preview_link"!==n)return;const r=K(t),i=Y(t),s=null===(o=e(c.store).getCurrentUser())||void 0===o?void 0:o.id,a=e(c.store).getAutosave(r,i,s);return a?h(a[n]):void 0}));function te(e){if("private"===J(e,"status"))return"private";return J(e,"password")?"password":"public"}function ne(e){return"pending"===G(e).status}function oe(e,t){const n=t||G(e);return-1!==["publish","private"].indexOf(n.status)||"future"===n.status&&!(0,b.isInTheFuture)(new Date(Number((0,b.getDate)(n.date))-6e4))}function re(e){return"future"===G(e).status&&!oe(e)}function ie(e){const t=G(e);return W(e)||-1===["publish","private","future"].indexOf(t.status)}function se(e){return!pe(e)&&(!!J(e,"title")||!!J(e,"excerpt")||!ae(e)||"native"===i.Platform.OS)}function ae(e){const t=Re(e);if(t.length){if(t.length>1)return!1;const e=t[0].name;if(e!==(0,a.getDefaultBlockName)()&&e!==(0,a.getFreeformContentHandlerName)())return!1}return!be(e)}const le=(0,l.createRegistrySelector)((e=>t=>{var n;if(!se(t))return!1;if(xe(t))return!1;const o=K(t),r=Y(t),i=e(c.store).hasFetchedAutosaves(o,r),s=null===(n=e(c.store).getCurrentUser())||void 0===n?void 0:n.id,a=e(c.store).getAutosave(o,r,s);return!!i&&(!a||(!!V(t)||["title","excerpt"].some((e=>h(a[e])!==J(t,e)))))}));function ce(e){const t=J(e,"date"),n=new Date(Number((0,b.getDate)(t))-6e4);return(0,b.isInTheFuture)(n)}function ue(e){const t=J(e,"date"),n=J(e,"modified"),o=G(e).status;return("draft"===o||"auto-draft"===o||"pending"===o)&&(t===n||null===t)}function de(e){return!!e.deleting.pending}const pe=(0,l.createRegistrySelector)((e=>t=>{const n=K(t),o=Y(t);return e(c.store).isSavingEntityRecord("postType",n,o)})),me=(0,l.createRegistrySelector)((e=>t=>{const n=e(c.store).__experimentalGetEntitiesBeingSaved(),{type:o,id:r}=G(t);return n.some((e=>"postType"!==e.kind||e.name!==o||e.key!==r))})),he=(0,l.createRegistrySelector)((e=>t=>{const n=K(t),o=Y(t);return!e(c.store).getLastEntitySaveError("postType",n,o)})),ge=(0,l.createRegistrySelector)((e=>t=>{const n=K(t),o=Y(t);return!!e(c.store).getLastEntitySaveError("postType",n,o)}));function fe(e){var t;return!!pe(e)&&Boolean(null===(t=e.saving.options)||void 0===t?void 0:t.isAutosave)}function ve(e){var t;return!!pe(e)&&Boolean(null===(t=e.saving.options)||void 0===t?void 0:t.isPreview)}function _e(e){if(e.saving.pending||pe(e))return;let t=ee(e,"preview_link");t&&"draft"!==G(e).status||(t=J(e,"link"),t&&(t=(0,E.addQueryArgs)(t,{preview:!0})));const n=J(e,"featured_media");return t&&n?(0,E.addQueryArgs)(t,{_thumbnail_id:n}):t}function ye(e){const t=Re(e);if(t.length>2)return null;let n;if(1===t.length&&(n=t[0].name,"core/embed"===n)){var o;const e=null===(o=t[0].attributes)||void 0===o?void 0:o.providerNameSlug;["youtube","vimeo"].includes(e)?n="core/video":["spotify","soundcloud"].includes(e)&&(n="core/audio")}switch(2===t.length&&"core/paragraph"===t[1].name&&(n=t[0].name),n){case"core/image":return"image";case"core/quote":case"core/pullquote":return"quote";case"core/gallery":return"gallery";case"core/video":return"video";case"core/audio":return"audio";default:return null}}const be=(0,l.createRegistrySelector)((e=>t=>{const n=Y(t),o=K(t),r=e(c.store).getEditedEntityRecord("postType",o,n);if(r){if("function"==typeof r.content)return r.content(r);if(r.blocks)return(0,a.__unstableSerializeAndClean)(r.blocks);if(r.content)return r.content}return""}));function Ee(e){return pe(e)&&!oe(e)&&"publish"===J(e,"status")}function we(e){const t=J(e,"permalink_template");return A.test(t)}function Se(e){const t=ke(e);if(!t)return null;const{prefix:n,postName:o,suffix:r}=t;return we(e)?n+o+r:n}function Pe(e){return J(e,"slug")||(0,E.cleanForSlug)(J(e,"title"))||Y(e)}function ke(e){const t=J(e,"permalink_template");if(!t)return null;const n=J(e,"slug")||J(e,"generated_slug"),[o,r]=t.split(A);return{prefix:o,postName:n,suffix:r}}function Ce(e){return e.postLock.isLocked}function Te(e){return Object.keys(e.postSavingLock).length>0}function xe(e){return Object.keys(e.postAutosavingLock).length>0}function Be(e){return e.postLock.isTakeover}function Ae(e){return e.postLock.user}function Ie(e){return e.postLock.activePostLock}function Ne(e){var t;return Boolean(null===(t=G(e)._links)||void 0===t?void 0:t.hasOwnProperty("wp:action-unfiltered-html"))}const De=(0,l.createRegistrySelector)((e=>()=>!!e(C.store).get("core/edit-post","isPublishSidebarEnabled")));function Re(e){return J(e,"blocks")||M}function Le(e){var t;return S()("select('core/editor').getEditorSelectionStart",{since:"5.8",alternative:"select('core/editor').getEditorSelection"}),null===(t=J(e,"selection"))||void 0===t?void 0:t.selectionStart}function Oe(e){var t;return S()("select('core/editor').getEditorSelectionStart",{since:"5.8",alternative:"select('core/editor').getEditorSelection"}),null===(t=J(e,"selection"))||void 0===t?void 0:t.selectionEnd}function Ue(e){return J(e,"selection")}function Me(e){return e.isReady}function Fe(e){return e.editorSettings}function ze(){return S()("select('core/editor').getStateBeforeOptimisticTransaction",{since:"5.7",hint:"No state history is kept on this store anymore"}),null}function He(){return S()("select('core/editor').inSomeHistory",{since:"5.7",hint:"No state history is kept on this store anymore"}),!1}function Ve(e){return(0,l.createRegistrySelector)((t=>function(n){S()("`wp.data.select( 'core/editor' )."+e+"`",{since:"5.3",alternative:"`wp.data.select( 'core/block-editor' )."+e+"`",version:"6.2"});for(var o=arguments.length,r=new Array(o>1?o-1:0),i=1;i{var t;const n=(null===(t=Fe(e))||void 0===t?void 0:t.defaultTemplatePartAreas)||[];return null==n?void 0:n.map((e=>({...e,icon:O(e.icon)})))}),(e=>{var t;return[null===(t=Fe(e))||void 0===t?void 0:t.defaultTemplatePartAreas]})),Vt=y(((e,t)=>{var n;const o=zt(e);return o&&null!==(n=Object.values(o).find((e=>e.slug===t)))&&void 0!==n?n:U}),((e,t)=>[zt(e),t]));function Wt(e,t){var n;if(!t)return U;const{description:o,slug:r,title:i,area:s}=t,{title:a,description:l}=Vt(e,r),c="string"==typeof i?i:null==i?void 0:i.rendered;return{title:c&&c!==r?c:a||r,description:("string"==typeof o?o:null==o?void 0:o.raw)||l,icon:(null===(n=Ht(e).find((e=>s===e.area)))||void 0===n?void 0:n.icon)||k}}const jt=(0,l.createRegistrySelector)((e=>t=>{var n;const o=K(t),r=e(c.store).getPostType(o);return null==r||null===(n=r.labels)||void 0===n?void 0:n.singular_name}));var $t=window.wp.apiFetch,Gt=n.n($t),Kt=window.wp.notices;function Yt(e,t){return`wp-autosave-block-editor-post-${t?"auto-draft":e}`}function qt(e,t,n,o,r){window.sessionStorage.setItem(Yt(e,t),JSON.stringify({post_title:n,content:o,excerpt:r}))}function Qt(e,t){window.sessionStorage.removeItem(Yt(e,t))}var Xt=window.wp.i18n;function Zt(e){const{previousPost:t,post:n,postType:o}=e;if((0,s.get)(e.options,["isAutosave"]))return[];if("trash"===n.status&&"trash"!==t.status)return[];const r=["publish","private","future"],i=r.includes(t.status),a=r.includes(n.status);let l,c,u=(0,s.get)(o,["viewable"],!1);i||a?i&&!a?(l=o.labels.item_reverted_to_draft,u=!1):l=!i&&a?{publish:o.labels.item_published,private:o.labels.item_published_privately,future:o.labels.item_scheduled}[n.status]:o.labels.item_updated:(l=(0,Xt.__)("Draft saved."),c=!0);const d=[];return u&&d.push({label:c?(0,Xt.__)("View Preview"):o.labels.view_item,url:n.link}),[l,{id:x,type:"snackbar",actions:d}]}function Jt(e){const{post:t,edits:n,error:o}=e;if(o&&"rest_autosave_no_changes"===o.code)return[];const r=["publish","private","future"],i=-1!==r.indexOf(t.status),s={publish:(0,Xt.__)("Publishing failed."),private:(0,Xt.__)("Publishing failed."),future:(0,Xt.__)("Scheduling failed.")};let a=i||-1===r.indexOf(n.status)?(0,Xt.__)("Updating failed."):s[n.status];return o.message&&!/<\/?[^>]*>/.test(o.message)&&(a=[a,o.message].join(" ")),[a,{id:x}]}const en=(e,t,n)=>o=>{let{dispatch:r}=o;r.setupEditorState(e);if("auto-draft"===e.status&&n){let o;o="content"in t?t.content:e.content.raw;let i=(0,a.parse)(o);i=(0,a.synchronizeBlocksWithTemplate)(i,n),r.resetEditorBlocks(i,{__unstableShouldCreateUndoLevel:!1})}t&&Object.values(t).some((t=>{var n,o;let[r,i]=t;return i!==(null!==(n=null===(o=e[r])||void 0===o?void 0:o.raw)&&void 0!==n?n:e[r])}))&&r.editPost(t)};function tn(){return{type:"TEAR_DOWN_EDITOR"}}function nn(){return S()("wp.data.dispatch( 'core/editor' ).resetPost",{since:"6.0",version:"6.3",alternative:"Initialize the editor with the setupEditorState action"}),{type:"DO_NOTHING"}}function on(){return S()("wp.data.dispatch( 'core/editor' ).updatePost",{since:"5.7",alternative:"Use the core entities store instead"}),{type:"DO_NOTHING"}}function rn(e){return{type:"SETUP_EDITOR_STATE",post:e}}const sn=(e,t)=>n=>{let{select:o,registry:r}=n;const{id:i,type:s}=o.getCurrentPost();r.dispatch(c.store).editEntityRecord("postType",s,i,e,t)},an=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return async t=>{let{select:n,dispatch:o,registry:r}=t;if(!n.isEditedPostSaveable())return;const i=n.getEditedPostContent();e.isAutosave||o.editPost({content:i},{undoIgnore:!0});const s=n.getCurrentPost(),a={id:s.id,...r.select(c.store).getEntityRecordNonTransientEdits("postType",s.type,s.id),content:i};o({type:"REQUEST_POST_UPDATE_START",options:e}),await r.dispatch(c.store).saveEntityRecord("postType",s.type,a,e),o({type:"REQUEST_POST_UPDATE_FINISH",options:e});const l=r.select(c.store).getLastEntitySaveError("postType",s.type,s.id);if(l){const e=Jt({post:s,edits:a,error:l});e.length&&r.dispatch(Kt.store).createErrorNotice(...e)}else{const t=n.getCurrentPost(),o=Zt({previousPost:s,post:t,postType:await r.resolveSelect(c.store).getPostType(t.type),options:e});o.length&&r.dispatch(Kt.store).createSuccessNotice(...o),e.isAutosave||r.dispatch(p.store).__unstableMarkLastChangeAsPersistent()}}};function ln(){return S()("wp.data.dispatch( 'core/editor' ).refreshPost",{since:"6.0",version:"6.3",alternative:"Use the core entities store instead"}),{type:"DO_NOTHING"}}const cn=()=>async e=>{let{select:t,dispatch:n,registry:o}=e;const r=t.getCurrentPostType(),i=await o.resolveSelect(c.store).getPostType(r);o.dispatch(Kt.store).removeNotice(B);const{rest_base:s,rest_namespace:a="wp/v2"}=i;n({type:"REQUEST_POST_DELETE_START"});try{const e=t.getCurrentPost();await Gt()({path:`/${a}/${s}/${e.id}`,method:"DELETE"}),await n.savePost()}catch(e){o.dispatch(Kt.store).createErrorNotice(...(l={error:e},[l.error.message&&"unknown_error"!==l.error.code?l.error.message:(0,Xt.__)("Trashing failed"),{id:B}]))}var l;n({type:"REQUEST_POST_DELETE_FINISH"})},un=function(){let{local:e=!1,...t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return async n=>{let{select:o,dispatch:r}=n;if(e){const e=o.getCurrentPost(),t=o.isEditedPostNew(),n=o.getEditedPostAttribute("title"),r=o.getEditedPostAttribute("content"),i=o.getEditedPostAttribute("excerpt");qt(e.id,t,n,r,i)}else await r.savePost({isAutosave:!0,...t})}},dn=()=>e=>{let{registry:t}=e;t.dispatch(c.store).redo()},pn=()=>e=>{let{registry:t}=e;t.dispatch(c.store).undo()};function mn(){return S()("wp.data.dispatch( 'core/editor' ).createUndoLevel",{since:"6.0",version:"6.3",alternative:"Use the core entities store instead"}),{type:"DO_NOTHING"}}function hn(e){return{type:"UPDATE_POST_LOCK",lock:e}}const gn=()=>e=>{let{registry:t}=e;t.dispatch(C.store).set("core/edit-post","isPublishSidebarEnabled",!0)},fn=()=>e=>{let{registry:t}=e;t.dispatch(C.store).set("core/edit-post","isPublishSidebarEnabled",!1)};function vn(e){return{type:"LOCK_POST_SAVING",lockName:e}}function _n(e){return{type:"UNLOCK_POST_SAVING",lockName:e}}function yn(e){return{type:"LOCK_POST_AUTOSAVING",lockName:e}}function bn(e){return{type:"UNLOCK_POST_AUTOSAVING",lockName:e}}const En=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return n=>{let{select:o,dispatch:r,registry:i}=n;const{__unstableShouldCreateUndoLevel:s,selection:l}=t,u={blocks:e,selection:l};if(!1!==s){const{id:e,type:t}=o.getCurrentPost();if(i.select(c.store).getEditedEntityRecord("postType",t,e).blocks===u.blocks)return void i.dispatch(c.store).__unstableCreateUndoLevel("postType",t,e);u.content=e=>{let{blocks:t=[]}=e;return(0,a.__unstableSerializeAndClean)(t)}}r.editPost(u)}};function wn(e){return{type:"UPDATE_EDITOR_SETTINGS",settings:e}}const Sn=e=>function(){for(var t=arguments.length,n=new Array(t),o=0;o{let{registry:o}=t;S()("`wp.data.dispatch( 'core/editor' )."+e+"`",{since:"5.3",alternative:"`wp.data.dispatch( 'core/block-editor' )."+e+"`",version:"6.2"}),o.dispatch(p.store)[e](...n)}},Pn=Sn("resetBlocks"),kn=Sn("receiveBlocks"),Cn=Sn("updateBlock"),Tn=Sn("updateBlockAttributes"),xn=Sn("selectBlock"),Bn=Sn("startMultiSelect"),An=Sn("stopMultiSelect"),In=Sn("multiSelect"),Nn=Sn("clearSelectedBlock"),Dn=Sn("toggleSelection"),Rn=Sn("replaceBlocks"),Ln=Sn("replaceBlock"),On=Sn("moveBlocksDown"),Un=Sn("moveBlocksUp"),Mn=Sn("moveBlockToPosition"),Fn=Sn("insertBlock"),zn=Sn("insertBlocks"),Hn=Sn("showInsertionPoint"),Vn=Sn("hideInsertionPoint"),Wn=Sn("setTemplateValidity"),jn=Sn("synchronizeTemplate"),$n=Sn("mergeBlocks"),Gn=Sn("removeBlocks"),Kn=Sn("removeBlock"),Yn=Sn("toggleBlockMode"),qn=Sn("startTyping"),Qn=Sn("stopTyping"),Xn=Sn("enterFormattedText"),Zn=Sn("exitFormattedText"),Jn=Sn("insertDefaultBlock"),eo=Sn("updateBlockListSettings"),to={reducer:g,selectors:e,actions:t},no=(0,l.createReduxStore)("core/editor",{...to});(0,l.register)(no);function oo(e){var t;const n=(0,s.mapValues)(Object.fromEntries(Object.entries(null!==(t=e.attributes)&&void 0!==t?t:{}).filter((e=>{let[,{source:t}]=e;return"meta"===t}))),"meta");return(0,s.isEmpty)(n)||(e.edit=(e=>(0,u.createHigherOrderComponent)((t=>n=>{let{attributes:o,setAttributes:a,...u}=n;const d=(0,l.useSelect)((e=>e(no).getCurrentPostType()),[]),[p,m]=(0,c.useEntityProp)("postType",d,"meta"),h=(0,i.useMemo)((()=>({...o,...(0,s.mapValues)(e,(e=>p[e]))})),[o,p]);return(0,i.createElement)(t,r({attributes:h,setAttributes:t=>{const n=Object.fromEntries(Object.entries(null!=t?t:{}).filter((t=>{let[n]=t;return n in e})).map((t=>{let[n,o]=t;return[e[n],o]})));(0,s.isEmpty)(n)||m(n),a(t)}},u))}),"withMetaAttributeSource"))(n)(e.edit)),e}function ro(e){const t=e.avatar_urls&&e.avatar_urls[24]?(0,i.createElement)("img",{className:"editor-autocompleters__user-avatar",alt:"",src:e.avatar_urls[24]}):(0,i.createElement)("span",{className:"editor-autocompleters__no-avatar"});return(0,i.createElement)(i.Fragment,null,t,(0,i.createElement)("span",{className:"editor-autocompleters__user-name"},e.name),(0,i.createElement)("span",{className:"editor-autocompleters__user-slug"},e.slug))}(0,d.addFilter)("blocks.registerBlockType","core/editor/custom-sources-backwards-compatibility/shim-attribute-source",oo),(0,l.select)(a.store).getBlockTypes().map((e=>{let{name:t}=e;return(0,l.select)(a.store).getBlockType(t)})).forEach(oo);var io={name:"users",className:"editor-autocompleters__user",triggerPrefix:"@",useItems(e){const t=(0,l.useSelect)((t=>{const{getUsers:n}=t(c.store);return n({context:"view",search:encodeURIComponent(e)})}),[e]),n=(0,i.useMemo)((()=>t?t.map((e=>({key:`user-${e.slug}`,value:e,label:ro(e)}))):[]),[t]);return[n]},getOptionCompletion(e){return`@${e.slug}`}};(0,d.addFilter)("editor.Autocomplete.completers","editor/autocompleters/set-default-completers",(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.push({...io}),e}));class so extends i.Component{constructor(e){super(e),this.needsAutosave=!(!e.isDirty||!e.isAutosaveable)}componentDidMount(){this.props.disableIntervalChecks||this.setAutosaveTimer()}componentDidUpdate(e){this.props.disableIntervalChecks?this.props.editsReference!==e.editsReference&&this.props.autosave():(this.props.interval!==e.interval&&(clearTimeout(this.timerId),this.setAutosaveTimer()),this.props.isDirty&&(!this.props.isAutosaving||e.isAutosaving)?this.props.editsReference!==e.editsReference&&(this.needsAutosave=!0):this.needsAutosave=!1)}componentWillUnmount(){clearTimeout(this.timerId)}setAutosaveTimer(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3*this.props.interval;this.timerId=setTimeout((()=>{this.autosaveTimerHandler()}),e)}autosaveTimerHandler(){this.props.isAutosaveable?(this.needsAutosave&&(this.needsAutosave=!1,this.props.autosave()),this.setAutosaveTimer()):this.setAutosaveTimer(1e3)}render(){return null}}var ao=(0,u.compose)([(0,l.withSelect)(((e,t)=>{const{getReferenceByDistinctEdits:n}=e(c.store),{isEditedPostDirty:o,isEditedPostAutosaveable:r,isAutosavingPost:i,getEditorSettings:s}=e(no),{interval:a=s().autosaveInterval}=t;return{editsReference:n(),isDirty:o(),isAutosaveable:r(),isAutosaving:i(),interval:a}})),(0,l.withDispatch)(((e,t)=>({autosave(){const{autosave:n=e(no).autosave}=t;n()}})))])(so),lo=window.wp.richText,co=n(4403),uo=n.n(co);var po=e=>{let{children:t,isValid:n,level:o,href:r,onSelect:s}=e;return(0,i.createElement)("li",{className:uo()("document-outline__item",`is-${o.toLowerCase()}`,{"is-invalid":!n})},(0,i.createElement)("a",{href:r,className:"document-outline__button",onClick:s},(0,i.createElement)("span",{className:"document-outline__emdash","aria-hidden":"true"}),(0,i.createElement)("strong",{className:"document-outline__level"},o),(0,i.createElement)("span",{className:"document-outline__item-content"},t)))};const mo=(0,i.createElement)("em",null,(0,Xt.__)("(Empty heading)")),ho=[(0,i.createElement)("br",{key:"incorrect-break"}),(0,i.createElement)("em",{key:"incorrect-message"},(0,Xt.__)("(Incorrect heading level)"))],go=[(0,i.createElement)("br",{key:"incorrect-break-h1"}),(0,i.createElement)("em",{key:"incorrect-message-h1"},(0,Xt.__)("(Your theme may already use a H1 for the post title)"))],fo=[(0,i.createElement)("br",{key:"incorrect-break-multiple-h1"}),(0,i.createElement)("em",{key:"incorrect-message-multiple-h1"},(0,Xt.__)("(Multiple H1 headings are not recommended)"))],vo=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.flatMap((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return"core/heading"===e.name?{...e,level:e.attributes.level,isEmpty:_o(e)}:vo(e.innerBlocks)}))},_o=e=>!e.attributes.content||0===e.attributes.content.length;var yo=(0,u.compose)((0,l.withSelect)((e=>{var t,n;const{getBlocks:o}=e(p.store),{getEditedPostAttribute:r}=e(no),{getPostType:i}=e(c.store),s=i(r("type"));return{title:r("title"),blocks:o(),isTitleSupported:null!==(t=null==s||null===(n=s.supports)||void 0===n?void 0:n.title)&&void 0!==t&&t}})))((e=>{let{blocks:t=[],title:n,onSelect:o,isTitleSupported:r,hasOutlineItemsDisabled:s}=e;const a=vo(t);if(a.length<1)return null;let l=1;const c=document.querySelector(".editor-post-title__input"),u=r&&n&&c,d=a.reduce(((e,t)=>({...e,[t.level]:(e[t.level]||0)+1})),{})[1]>1;return(0,i.createElement)("div",{className:"document-outline"},(0,i.createElement)("ul",null,u&&(0,i.createElement)(po,{level:(0,Xt.__)("Title"),isValid:!0,onSelect:o,href:`#${c.id}`,isDisabled:s},n),a.map(((e,t)=>{const n=e.level>l+1,r=!(e.isEmpty||n||!e.level||1===e.level&&(d||u));return l=e.level,(0,i.createElement)(po,{key:t,level:`H${e.level}`,isValid:r,isDisabled:s,href:`#block-${e.clientId}`,onSelect:o},e.isEmpty?mo:(0,lo.getTextContent)((0,lo.create)({html:e.attributes.content})),n&&ho,1===e.level&&d&&fo,u&&1===e.level&&!d&&go)}))))}));var bo=(0,l.withSelect)((e=>({blocks:e(p.store).getBlocks()})))((function(e){let{blocks:t,children:n}=e;return t.filter((e=>"core/heading"===e.name)).length<1?null:n})),Eo=window.wp.keyboardShortcuts;var wo=function(e){let{resetBlocksOnSave:t}=e;const{resetEditorBlocks:n,savePost:o}=(0,l.useDispatch)(no),{isEditedPostDirty:r,getPostEdits:i,isPostSavingLocked:s}=(0,l.useSelect)(no);return(0,Eo.useShortcut)("core/editor/save",(e=>{if(e.preventDefault(),!s()&&r()){if(t){const e=i();if(e.content&&"string"==typeof e.content){const t=(0,a.parse)(e.content);n(t)}}o()}})),null};var So=function(){const{redo:e,undo:t}=(0,l.useDispatch)(no);return(0,Eo.useShortcut)("core/editor/undo",(e=>{t(),e.preventDefault()})),(0,Eo.useShortcut)("core/editor/redo",(t=>{e(),t.preventDefault()})),(0,i.createElement)(wo,null)};function Po(){return(0,i.createElement)(wo,{resetBlocksOnSave:!0})}var ko=window.wp.keycodes;var Co=function(){const{registerShortcut:e}=(0,l.useDispatch)(Eo.store);return(0,i.useEffect)((()=>{e({name:"core/editor/save",category:"global",description:(0,Xt.__)("Save your changes."),keyCombination:{modifier:"primary",character:"s"}}),e({name:"core/editor/undo",category:"global",description:(0,Xt.__)("Undo your last changes."),keyCombination:{modifier:"primary",character:"z"}}),e({name:"core/editor/redo",category:"global",description:(0,Xt.__)("Redo your last undo."),keyCombination:{modifier:"primaryShift",character:"z"},aliases:(0,ko.isAppleOS)()?[]:[{modifier:"primary",character:"y"}]})}),[e]),(0,i.createElement)(p.BlockEditorKeyboardShortcuts.Register,null)},To=window.wp.components;var xo=(0,i.createElement)(P.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,i.createElement)(P.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"}));var Bo=(0,i.createElement)(P.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,i.createElement)(P.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"}));var Ao=(0,i.forwardRef)((function(e,t){const n=(0,ko.isAppleOS)()?ko.displayShortcut.primaryShift("z"):ko.displayShortcut.primary("y"),o=(0,l.useSelect)((e=>e(no).hasEditorRedo()),[]),{redo:s}=(0,l.useDispatch)(no);return(0,i.createElement)(To.Button,r({},e,{ref:t,icon:(0,Xt.isRTL)()?Bo:xo,label:(0,Xt.__)("Redo"),shortcut:n,"aria-disabled":!o,onClick:o?s:void 0,className:"editor-history__redo"}))}));var Io=(0,i.forwardRef)((function(e,t){const n=(0,l.useSelect)((e=>e(no).hasEditorUndo()),[]),{undo:o}=(0,l.useDispatch)(no);return(0,i.createElement)(To.Button,r({},e,{ref:t,icon:(0,Xt.isRTL)()?xo:Bo,label:(0,Xt.__)("Undo"),shortcut:ko.displayShortcut.primary("z"),"aria-disabled":!n,onClick:n?o:void 0,className:"editor-history__undo"}))}));var No=(0,u.compose)([(0,l.withSelect)((e=>({isValid:e(p.store).isValidTemplate()}))),(0,l.withDispatch)((e=>{const{setTemplateValidity:t,synchronizeTemplate:n}=e(p.store);return{resetTemplateValidity:()=>t(!0),synchronizeTemplate:n}}))])((function(e){let{isValid:t,...n}=e;return t?null:(0,i.createElement)(To.Notice,{className:"editor-template-validation-notice",isDismissible:!1,status:"warning",actions:[{label:(0,Xt.__)("Keep it as is"),onClick:n.resetTemplateValidity},{label:(0,Xt.__)("Reset the template"),onClick:()=>{window.confirm((0,Xt.__)("Resetting the template may result in loss of content, do you want to continue?"))&&n.synchronizeTemplate()}}]},(0,Xt.__)("The content of your post doesn’t match the template assigned to your post type."))}));var Do=(0,u.compose)([(0,l.withSelect)((e=>({notices:e(Kt.store).getNotices()}))),(0,l.withDispatch)((e=>({onRemove:e(Kt.store).removeNotice})))])((function(e){let{notices:t,onRemove:n}=e;const o=t.filter((e=>{let{isDismissible:t,type:n}=e;return t&&"default"===n})),r=t.filter((e=>{let{isDismissible:t,type:n}=e;return!t&&"default"===n}));return(0,i.createElement)(i.Fragment,null,(0,i.createElement)(To.NoticeList,{notices:r,className:"components-editor-notices__pinned"}),(0,i.createElement)(To.NoticeList,{notices:o,className:"components-editor-notices__dismissible",onRemove:n},(0,i.createElement)(No,null)))}));function Ro(){const e=(0,l.useSelect)((e=>e(Kt.store).getNotices()),[]),{removeNotice:t}=(0,l.useDispatch)(Kt.store),n=e.filter((e=>{let{type:t}=e;return"snackbar"===t}));return(0,i.createElement)(To.SnackbarList,{notices:n,className:"components-editor-notices__snackbar",onRemove:t})}var Lo=window.wp.htmlEntities;function Oo(e){let{record:t,checked:n,onChange:o,closePanel:r}=e;const{name:s,kind:a,title:u,key:d}=t,m=(0,l.useSelect)((e=>{var t;const{blocks:n=[]}=e(c.store).getEditedEntityRecord(a,s,d),o=e(p.store).getBlockParents(null===(t=n[0])||void 0===t?void 0:t.clientId);return o[o.length-1]}),[]),h=(0,l.useSelect)((e=>{if("postType"!==a||"wp_template"!==s)return u;const t=e(c.store).getEditedEntityRecord(a,s,d);return e(no).__experimentalGetTemplateInfo(t).title}),[s,a,u,d]),g=(0,l.useSelect)((e=>e(p.store).getSelectedBlockClientId()===m),[m]),f=g?(0,Xt.__)("Selected"):(0,Xt.__)("Select"),{selectBlock:v}=(0,l.useDispatch)(p.store),_=(0,i.useCallback)((()=>v(m)),[m]),y=(0,i.useCallback)((()=>{v(m),r()}),[m]);return(0,i.createElement)(To.PanelRow,null,(0,i.createElement)(To.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,i.createElement)("strong",null,(0,Lo.decodeEntities)(h)||(0,Xt.__)("Untitled")),checked:n,onChange:o}),m?(0,i.createElement)(i.Fragment,null,(0,i.createElement)(To.Button,{onClick:_,className:"entities-saved-states__find-entity",disabled:g},f),(0,i.createElement)(To.Button,{onClick:y,className:"entities-saved-states__find-entity-small",disabled:g},f)):null)}function Uo(e){let{list:t,unselectedEntities:n,setUnselectedEntities:o,closePanel:r}=e;const s=t.length,a=t[0],u=(0,l.useSelect)((e=>e(c.store).getEntityConfig(a.kind,a.name)),[a.kind,a.name]),{name:d}=a;let p=u.label;"wp_template_part"===d&&(p=1===s?(0,Xt.__)("Template Part"):(0,Xt.__)("Template Parts"));const m=function(e,t){switch(e){case"site":return 1===t?(0,Xt.__)("This change will affect your whole site."):(0,Xt.__)("These changes will affect your whole site.");case"wp_template":return(0,Xt.__)("This change will affect pages and posts that use this template.");case"page":case"post":return(0,Xt.__)("The following content has been modified.")}}(d,s);return(0,i.createElement)(To.PanelBody,{title:p,initialOpen:!0},m&&(0,i.createElement)(To.PanelRow,null,m),t.map((e=>(0,i.createElement)(Oo,{key:e.key||e.property,record:e,checked:!n.some((t=>t.kind===e.kind&&t.name===e.name&&t.key===e.key&&t.property===e.property)),onChange:t=>o(e,t),closePanel:r}))))}const Mo={title:(0,Xt.__)("Title"),description:(0,Xt.__)("Tagline"),site_logo:(0,Xt.__)("Logo"),site_icon:(0,Xt.__)("Icon"),show_on_front:(0,Xt.__)("Show on front"),page_on_front:(0,Xt.__)("Page on front")},Fo=[{kind:"postType",name:"wp_navigation"}];function zo(e){let{close:t}=e;const n=(0,i.useRef)(),{dirtyEntityRecords:o}=(0,l.useSelect)((e=>{const t=e(c.store).__experimentalGetDirtyEntityRecords().filter((e=>!("root"===e.kind&&"site"===e.name))),n=e(c.store).getEntityRecordEdits("root","site"),o=[];for(const e in n)o.push({kind:"root",name:"site",title:Mo[e]||e,property:e});return{dirtyEntityRecords:[...t,...o]}}),[]),{editEntityRecord:a,saveEditedEntityRecord:d,__experimentalSaveSpecifiedEntityEdits:m}=(0,l.useDispatch)(c.store),{__unstableMarkLastChangeAsPersistent:h}=(0,l.useDispatch)(p.store),{createSuccessNotice:g,createErrorNotice:f}=(0,l.useDispatch)(Kt.store),v=(0,s.groupBy)(o,"name"),{site:_,wp_template:y,wp_template_part:b,...E}=v,w=[_,y,b,...Object.values(E)].filter(Array.isArray),[S,P]=(0,i.useState)([]),k=(e,t)=>{let{kind:n,name:o,key:r,property:i}=e;P(t?S.filter((e=>e.kind!==n||e.name!==o||e.key!==r||e.property!==i)):[...S,{kind:n,name:o,key:r,property:i}])},C=(0,i.useCallback)((()=>t()),[t]),[T,x]=(0,u.__experimentalUseDialog)({onClose:()=>C()});return(0,i.createElement)("div",r({ref:T},x,{className:"entities-saved-states__panel"}),(0,i.createElement)(To.Flex,{className:"entities-saved-states__panel-header",gap:2},(0,i.createElement)(To.FlexItem,{isBlock:!0,as:To.Button,ref:n,variant:"primary",disabled:o.length-S.length==0,onClick:()=>{const e=o.filter((e=>{let{kind:t,name:n,key:o,property:r}=e;return!S.some((e=>e.kind===t&&e.name===n&&e.key===o&&e.property===r))}));t(e);const n=[],r=[];e.forEach((e=>{let{kind:t,name:o,key:i,property:s}=e;"root"===t&&"site"===o?n.push(s):(Fo.some((e=>e.kind===t&&e.name===o))&&a(t,o,i,{status:"publish"}),r.push(d(t,o,i)))})),n.length&&r.push(m("root","site",void 0,n)),h(),Promise.all(r).then((e=>{e.some((e=>void 0===e))?f((0,Xt.__)("Saving failed.")):g((0,Xt.__)("Site updated."),{type:"snackbar"})})).catch((e=>f(`${(0,Xt.__)("Saving failed.")} ${e}`)))},className:"editor-entities-saved-states__save-button"},(0,Xt.__)("Save")),(0,i.createElement)(To.FlexItem,{isBlock:!0,as:To.Button,variant:"secondary",onClick:C},(0,Xt.__)("Cancel"))),(0,i.createElement)("div",{className:"entities-saved-states__text-prompt"},(0,i.createElement)("strong",null,(0,Xt.__)("Are you ready to save?")),(0,i.createElement)("p",null,(0,Xt.__)("The following changes have been made to your site, templates, and content."))),w.map((e=>(0,i.createElement)(Uo,{key:e[0].name,list:e,closePanel:C,unselectedEntities:S,setUnselectedEntities:k}))))}function Ho(){try{return(0,l.select)(no).getEditedPostContent()}catch(e){}}function Vo(e){let{text:t,children:n}=e;const o=(0,u.useCopyToClipboard)(t);return(0,i.createElement)(To.Button,{variant:"secondary",ref:o},n)}class Wo extends i.Component{constructor(){super(...arguments),this.state={error:null}}componentDidCatch(e){(0,d.doAction)("editor.ErrorBoundary.errorLogged",e)}static getDerivedStateFromError(e){return{error:e}}render(){const{error:e}=this.state;if(!e)return this.props.children;const t=[(0,i.createElement)(Vo,{key:"copy-post",text:Ho},(0,Xt.__)("Copy Post Text")),(0,i.createElement)(Vo,{key:"copy-error",text:e.stack},(0,Xt.__)("Copy Error"))];return(0,i.createElement)(p.Warning,{className:"editor-error-boundary",actions:t},(0,Xt.__)("The editor has encountered an unexpected error."))}}var jo=Wo;const $o=window.requestIdleCallback?window.requestIdleCallback:window.requestAnimationFrame;let Go;function Ko(){const{postId:e,isEditedPostNew:t,hasRemoteAutosave:n}=(0,l.useSelect)((e=>({postId:e(no).getCurrentPostId(),isEditedPostNew:e(no).isEditedPostNew(),hasRemoteAutosave:!!e(no).getEditorSettings().autosave})),[]),{getEditedPostAttribute:o}=(0,l.useSelect)(no),{createWarningNotice:r,removeNotice:s}=(0,l.useDispatch)(Kt.store),{editPost:c,resetEditorBlocks:u}=(0,l.useDispatch)(no);(0,i.useEffect)((()=>{let i=function(e,t){return window.sessionStorage.getItem(Yt(e,t))}(e,t);if(!i)return;try{i=JSON.parse(i)}catch{return}const{post_title:l,content:d,excerpt:p}=i,m={title:l,content:d,excerpt:p};if(!Object.keys(m).some((e=>m[e]!==o(e))))return void Qt(e,t);if(n)return;const h="wpEditorAutosaveRestore";r((0,Xt.__)("The backup of this post in your browser is different from the version below."),{id:h,actions:[{label:(0,Xt.__)("Restore the backup"),onClick(){const{content:e,...t}=m;c(t),u((0,a.parse)(m.content)),s(h)}}]})}),[t,e])}var Yo=(0,u.ifCondition)((()=>{if(void 0!==Go)return Go;try{window.sessionStorage.setItem("__wpEditorTestSessionStorage",""),window.sessionStorage.removeItem("__wpEditorTestSessionStorage"),Go=!0}catch{Go=!1}return Go}))((function(){const{autosave:e}=(0,l.useDispatch)(no),t=(0,i.useCallback)((()=>{$o((()=>e({local:!0})))}),[]);Ko(),function(){const{postId:e,isEditedPostNew:t,isDirty:n,isAutosaving:o,didError:r}=(0,l.useSelect)((e=>({postId:e(no).getCurrentPostId(),isEditedPostNew:e(no).isEditedPostNew(),isDirty:e(no).isEditedPostDirty(),isAutosaving:e(no).isAutosavingPost(),didError:e(no).didPostSaveRequestFail()})),[]),s=(0,i.useRef)(n),a=(0,i.useRef)(o);(0,i.useEffect)((()=>{!r&&(a.current&&!o||s.current&&!n)&&Qt(e,t),s.current=n,a.current=o}),[n,o,r]);const c=(0,u.usePrevious)(t),d=(0,u.usePrevious)(e);(0,i.useEffect)((()=>{d===e&&c&&!t&&Qt(e,!0)}),[t,e])}();const n=(0,l.useSelect)((e=>e(no).getEditorSettings().localAutosaveInterval),[]);return(0,i.createElement)(ao,{interval:n,autosave:t})}));var qo=function(e){let{children:t}=e;const n=(0,l.useSelect)((e=>{const{getEditedPostAttribute:t}=e(no),{getPostType:n}=e(c.store);return n(t("type"))}),[]);return(0,s.get)(n,["supports","page-attributes"],!1)?t:null};var Qo=(0,l.withSelect)((e=>{const{getEditedPostAttribute:t}=e(no),{getPostType:n}=e(c.store);return{postType:n(t("type"))}}))((function(e){let{postType:t,children:n,supportKeys:o}=e,r=!0;return t&&(r=(Array.isArray(o)?o:[o]).some((e=>!!t.supports[e]))),r?n:null}));const Xo=e=>{let{onUpdateOrder:t,order:n=0}=e;const[o,r]=(0,i.useState)(null),s=null===o?n:o;return(0,i.createElement)(To.TextControl,{className:"editor-page-attributes__order",type:"number",label:(0,Xt.__)("Order"),value:s,onChange:e=>{var n;r(e);const o=Number(e);Number.isInteger(o)&&""!==(null===(n=e.trim)||void 0===n?void 0:n.call(e))&&t(Number(e))},size:6,onBlur:()=>{r(null)}})};var Zo=(0,u.compose)([(0,l.withSelect)((e=>({order:e(no).getEditedPostAttribute("menu_order")}))),(0,l.withDispatch)((e=>({onUpdateOrder(t){e(no).editPost({menu_order:t})}})))])((function(e){return(0,i.createElement)(Qo,{supportKeys:"page-attributes"},(0,i.createElement)(Xo,e))})),Jo=n(4793),er=n.n(Jo);function tr(e){const t=e.map((e=>({children:[],parent:null,...e}))),n=(0,s.groupBy)(t,"parent");if(n.null&&n.null.length)return t;const o=e=>e.map((e=>{const t=n[e.id];return{...e,children:t&&t.length?o(t):[]}}));return o(n[0]||[])}const nr=e=>(0,Lo.decodeEntities)(e),or=e=>({...e,name:nr(e.name)});function rr(e){var t;return null!=e&&null!==(t=e.title)&&void 0!==t&&t.rendered?(0,Lo.decodeEntities)(e.title.rendered):`#${e.id} (${(0,Xt.__)("no title")})`}const ir=(e,t)=>{const n=er()(e||"").toLowerCase(),o=er()(t||"").toLowerCase();return n===o?0:n.startsWith(o)?n.length:1/0};var sr=function(){const{editPost:e}=(0,l.useDispatch)(no),[t,n]=(0,i.useState)(!1),{parentPost:o,parentPostId:r,items:a,postType:d}=(0,l.useSelect)((e=>{const{getPostType:n,getEntityRecords:o,getEntityRecord:r}=e(c.store),{getCurrentPostId:i,getEditedPostAttribute:a}=e(no),l=a("type"),u=a("parent"),d=n(l),p=i(),m=(0,s.get)(d,["hierarchical"],!1),h={per_page:100,exclude:p,parent_exclude:p,orderby:"menu_order",order:"asc",_fields:"id,title,parent"};return t&&(h.search=t),{parentPostId:u,parentPost:u?r("postType",l,u):null,items:m?o("postType",l,h):[],postType:d}}),[t]),p=(0,s.get)(d,["hierarchical"],!1),m=(0,s.get)(d,["labels","parent_item_colon"]),h=a||[],g=(0,i.useMemo)((()=>{const e=function(n){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const r=n.map((t=>[{value:t.id,label:"— ".repeat(o)+(0,Lo.decodeEntities)(t.name),rawName:t.name},...e(t.children||[],o+1)])),i=r.sort(((e,n)=>{let[o]=e,[r]=n;return ir(o.rawName,t)>=ir(r.rawName,t)?1:-1}));return i.flat()};let n=h.map((e=>({id:e.id,parent:e.parent,name:rr(e)})));t||(n=tr(n));const i=e(n),s=i.find((e=>e.value===r));return o&&!s&&i.unshift({value:r,label:rr(o)}),i}),[h,t]);return p&&m?(0,i.createElement)(To.ComboboxControl,{__nextHasNoMarginBottom:!0,className:"editor-page-attributes__parent",label:m,value:r,options:g,onFilterValueChange:(0,u.debounce)((e=>{n(e)}),300),onChange:t=>{e({parent:t})}}):null};var ar=function(){const{availableTemplates:e,selectedTemplate:t,isViewable:n}=(0,l.useSelect)((e=>{var t,n;const{getEditedPostAttribute:o,getEditorSettings:r,getCurrentPostType:i}=e(no),{getPostType:s}=e(c.store);return{selectedTemplate:o("template"),availableTemplates:r().availableTemplates,isViewable:null!==(t=null===(n=s(i()))||void 0===n?void 0:n.viewable)&&void 0!==t&&t}}),[]),{editPost:o}=(0,l.useDispatch)(no);return!n||(0,s.isEmpty)(e)?null:(0,i.createElement)(To.SelectControl,{__nextHasNoMarginBottom:!0,label:(0,Xt.__)("Template:"),value:t,onChange:e=>{o({template:e||""})},options:Object.entries(null!=e?e:{}).map((e=>{let[t,n]=e;return{value:t,label:n}}))})};const lr={who:"authors",per_page:50,_fields:"id,name",context:"view"};var cr=function(){const[e,t]=(0,i.useState)(),{authorId:n,isLoading:o,authors:r,postAuthor:s}=(0,l.useSelect)((t=>{const{getUser:n,getUsers:o,isResolving:r}=t(c.store),{getEditedPostAttribute:i}=t(no),s=n(i("author"),{context:"view"}),a={...lr};return e&&(a.search=e),{authorId:i("author"),postAuthor:s,authors:o(a),isLoading:r("core","getUsers",[a])}}),[e]),{editPost:a}=(0,l.useDispatch)(no),d=(0,i.useMemo)((()=>{const e=(null!=r?r:[]).map((e=>({value:e.id,label:(0,Lo.decodeEntities)(e.name)})));return e.findIndex((e=>{let{value:t}=e;return(null==s?void 0:s.id)===t}))<0&&s?[{value:s.id,label:(0,Lo.decodeEntities)(s.name)},...e]:e}),[r,s]);return s?(0,i.createElement)(To.ComboboxControl,{__nextHasNoMarginBottom:!0,label:(0,Xt.__)("Author"),options:d,value:n,onFilterValueChange:(0,u.debounce)((e=>{t(e)}),300),onChange:e=>{e&&a({author:e})},isLoading:o,allowReset:!1}):null};var ur=function(){const{editPost:e}=(0,l.useDispatch)(no),{postAuthor:t,authors:n}=(0,l.useSelect)((e=>({postAuthor:e(no).getEditedPostAttribute("author"),authors:e(c.store).getUsers(lr)})),[]),o=(0,i.useMemo)((()=>(null!=n?n:[]).map((e=>({value:e.id,label:(0,Lo.decodeEntities)(e.name)})))),[n]);return(0,i.createElement)(To.SelectControl,{__nextHasNoMarginBottom:!0,className:"post-author-selector",label:(0,Xt.__)("Author"),options:o,onChange:t=>{const n=Number(t);e({author:n})},value:t})};var dr=function(){return(0,l.useSelect)((e=>{const t=e(c.store).getUsers(lr);return(null==t?void 0:t.length)>=25}),[])?(0,i.createElement)(cr,null):(0,i.createElement)(ur,null)};function pr(e){let{children:t}=e;const{hasAssignAuthorAction:n,hasAuthors:o}=(0,l.useSelect)((e=>{const t=e(no).getCurrentPost(),n=e(c.store).getUsers(lr);return{hasAssignAuthorAction:(0,s.get)(t,["_links","wp:action-assign-author"],!1),hasAuthors:(null==n?void 0:n.length)>=1}}),[]);return n&&o?(0,i.createElement)(Qo,{supportKeys:"author"},t):null}var mr=(0,u.compose)([(0,l.withSelect)((e=>({commentStatus:e(no).getEditedPostAttribute("comment_status")}))),(0,l.withDispatch)((e=>({editPost:e(no).editPost})))])((function(e){let{commentStatus:t="open",...n}=e;return(0,i.createElement)(To.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,Xt.__)("Allow comments"),checked:"open"===t,onChange:()=>n.editPost({comment_status:"open"===t?"closed":"open"})})}));var hr=(0,u.compose)([(0,l.withSelect)((e=>({excerpt:e(no).getEditedPostAttribute("excerpt")}))),(0,l.withDispatch)((e=>({onUpdateExcerpt(t){e(no).editPost({excerpt:t})}})))])((function(e){let{excerpt:t,onUpdateExcerpt:n}=e;return(0,i.createElement)("div",{className:"editor-post-excerpt"},(0,i.createElement)(To.TextareaControl,{__nextHasNoMarginBottom:!0,label:(0,Xt.__)("Write an excerpt (optional)"),className:"editor-post-excerpt__textarea",onChange:e=>n(e),value:t}),(0,i.createElement)(To.ExternalLink,{href:(0,Xt.__)("https://wordpress.org/support/article/settings-sidebar/#excerpt")},(0,Xt.__)("Learn more about manual excerpts")))}));var gr=function(e){return(0,i.createElement)(Qo,r({},e,{supportKeys:"excerpt"}))},fr=window.wp.blob;var vr=(0,l.withSelect)((e=>{const{getThemeSupports:t}=e(c.store),{getEditedPostAttribute:n}=e(no);return{postType:n("type"),themeSupports:t()}}))((function(e){let{themeSupports:t,children:n,postType:o,supportKeys:r}=e;return(Array.isArray(r)?r:[r]).some((e=>{const n=(0,s.get)(t,[e],!1);return"post-thumbnails"===e&&Array.isArray(n)?n.includes(o):n}))?n:null}));var _r=function(e){return(0,i.createElement)(vr,{supportKeys:"post-thumbnails"},(0,i.createElement)(Qo,r({},e,{supportKeys:"thumbnail"})))};const yr=["image"],br=(0,Xt.__)("Featured image"),Er=(0,Xt.__)("Set featured image"),wr=(0,Xt.__)("Remove image"),Sr=(0,i.createElement)("p",null,(0,Xt.__)("To edit the featured image, you need permission to upload media."));const Pr=(0,l.withSelect)((e=>{const{getMedia:t,getPostType:n}=e(c.store),{getCurrentPostId:o,getEditedPostAttribute:r}=e(no),i=r("featured_media");return{media:i?t(i,{context:"view"}):null,currentPostId:o(),postType:n(r("type")),featuredImageId:i}})),kr=(0,l.withDispatch)(((e,t,n)=>{let{noticeOperations:o}=t,{select:r}=n;const{editPost:i}=e(no);return{onUpdateImage(e){i({featured_media:e.id})},onDropImage(e){r(p.store).getSettings().mediaUpload({allowedTypes:["image"],filesList:e,onFileChange(e){let[t]=e;i({featured_media:t.id})},onError(e){o.removeAllNotices(),o.createErrorNotice(e)}})},onRemoveImage(){i({featured_media:0})}}}));var Cr=(0,u.compose)(To.withNotices,Pr,kr,(0,To.withFilters)("editor.PostFeaturedImage"))((function(e){var t,n;let{currentPostId:o,featuredImageId:r,onUpdateImage:a,onRemoveImage:c,media:u,postType:m,noticeUI:h,noticeOperations:g}=e;const[f,v]=(0,i.useState)(!1),_=(0,l.useSelect)((e=>e(p.store).getSettings().mediaUpload),[]),y=(0,s.get)(m,["labels"],{}),{mediaWidth:b,mediaHeight:E,mediaSourceUrl:w}=function(e,t){var n,o,r,i;if(!e)return{};const s=(0,d.applyFilters)("editor.PostFeaturedImage.imageSize","large",e.id,t);if(s in(null!==(n=null==e||null===(o=e.media_details)||void 0===o?void 0:o.sizes)&&void 0!==n?n:{}))return{mediaWidth:e.media_details.sizes[s].width,mediaHeight:e.media_details.sizes[s].height,mediaSourceUrl:e.media_details.sizes[s].source_url};const a=(0,d.applyFilters)("editor.PostFeaturedImage.imageSize","thumbnail",e.id,t);return a in(null!==(r=null==e||null===(i=e.media_details)||void 0===i?void 0:i.sizes)&&void 0!==r?r:{})?{mediaWidth:e.media_details.sizes[a].width,mediaHeight:e.media_details.sizes[a].height,mediaSourceUrl:e.media_details.sizes[a].source_url}:{mediaWidth:e.media_details.width,mediaHeight:e.media_details.height,mediaSourceUrl:e.source_url}}(u,o);function S(e){_({allowedTypes:["image"],filesList:e,onFileChange(e){let[t]=e;(0,fr.isBlobURL)(null==t?void 0:t.url)?v(!0):(a(t),v(!1))},onError(e){g.removeAllNotices(),g.createErrorNotice(e)}})}return(0,i.createElement)(_r,null,h,(0,i.createElement)("div",{className:"editor-post-featured-image"},u&&(0,i.createElement)("div",{id:`editor-post-featured-image-${r}-describedby`,className:"hidden"},u.alt_text&&(0,Xt.sprintf)((0,Xt.__)("Current image: %s"),u.alt_text),!u.alt_text&&(0,Xt.sprintf)((0,Xt.__)("The current image has no alternative text. The file name is: %s"),(null===(t=u.media_details.sizes)||void 0===t||null===(n=t.full)||void 0===n?void 0:n.file)||u.slug)),(0,i.createElement)(p.MediaUploadCheck,{fallback:Sr},(0,i.createElement)(p.MediaUpload,{title:y.featured_image||br,onSelect:a,unstableFeaturedImageFlow:!0,allowedTypes:yr,modalClass:"editor-post-featured-image__media-modal",render:e=>{let{open:t}=e;return(0,i.createElement)("div",{className:"editor-post-featured-image__container"},(0,i.createElement)(To.Button,{className:r?"editor-post-featured-image__preview":"editor-post-featured-image__toggle",onClick:t,"aria-label":r?(0,Xt.__)("Edit or update the image"):null,"aria-describedby":r?`editor-post-featured-image-${r}-describedby`:null},!!r&&u&&(0,i.createElement)(To.ResponsiveWrapper,{naturalWidth:b,naturalHeight:E,isInline:!0},(0,i.createElement)("img",{src:w,alt:""})),f&&(0,i.createElement)(To.Spinner,null),!r&&!f&&(y.set_featured_image||Er)),(0,i.createElement)(To.DropZone,{onFilesDrop:S}))},value:r})),!!r&&(0,i.createElement)(p.MediaUploadCheck,null,u&&(0,i.createElement)(p.MediaUpload,{title:y.featured_image||br,onSelect:a,unstableFeaturedImageFlow:!0,allowedTypes:yr,modalClass:"editor-post-featured-image__media-modal",render:e=>{let{open:t}=e;return(0,i.createElement)(To.Button,{onClick:t,variant:"secondary"},(0,Xt.__)("Replace Image"))}}),(0,i.createElement)(To.Button,{onClick:c,variant:"link",isDestructive:!0},y.remove_featured_image||wr))))}));var Tr=(0,l.withSelect)((e=>({disablePostFormats:e(no).getEditorSettings().disablePostFormats})))((function(e){let{disablePostFormats:t,...n}=e;return!t&&(0,i.createElement)(Qo,r({},n,{supportKeys:"post-formats"}))}));const xr=[{id:"aside",caption:(0,Xt.__)("Aside")},{id:"audio",caption:(0,Xt.__)("Audio")},{id:"chat",caption:(0,Xt.__)("Chat")},{id:"gallery",caption:(0,Xt.__)("Gallery")},{id:"image",caption:(0,Xt.__)("Image")},{id:"link",caption:(0,Xt.__)("Link")},{id:"quote",caption:(0,Xt.__)("Quote")},{id:"standard",caption:(0,Xt.__)("Standard")},{id:"status",caption:(0,Xt.__)("Status")},{id:"video",caption:(0,Xt.__)("Video")}].sort(((e,t)=>{const n=e.caption.toUpperCase(),o=t.caption.toUpperCase();return no?1:0}));function Br(){const e=`post-format-selector-${(0,u.useInstanceId)(Br)}`,{postFormat:t,suggestedFormat:n,supportedFormats:o}=(0,l.useSelect)((e=>{const{getEditedPostAttribute:t,getSuggestedPostFormat:n}=e(no),o=t("format"),r=e(c.store).getThemeSupports();return{postFormat:null!=o?o:"standard",suggestedFormat:n(),supportedFormats:r.formats}}),[]),r=xr.filter((e=>(null==o?void 0:o.includes(e.id))||t===e.id)),s=r.find((e=>e.id===n)),{editPost:a}=(0,l.useDispatch)(no),d=e=>a({format:e});return(0,i.createElement)(Tr,null,(0,i.createElement)("div",{className:"editor-post-format"},(0,i.createElement)(To.SelectControl,{__nextHasNoMarginBottom:!0,label:(0,Xt.__)("Post Format"),value:t,onChange:e=>d(e),id:e,options:r.map((e=>({label:e.caption,value:e.id})))}),s&&s.id!==t&&(0,i.createElement)("p",{className:"editor-post-format__suggestion"},(0,i.createElement)(To.Button,{variant:"link",onClick:()=>d(s.id)},(0,Xt.sprintf)((0,Xt.__)("Apply suggested format: %s"),s.caption)))))}var Ar=(0,i.createElement)(P.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,i.createElement)(P.Path,{d:"M5.5 12h1.75l-2.5 3-2.5-3H4a8 8 0 113.134 6.35l.907-1.194A6.5 6.5 0 105.5 12zm9.53 1.97l-2.28-2.28V8.5a.75.75 0 00-1.5 0V12a.747.747 0 00.218.529l1.282-.84-1.28.842 2.5 2.5a.75.75 0 101.06-1.061z"}));var Ir=(0,l.withSelect)((e=>{const{getCurrentPostLastRevisionId:t,getCurrentPostRevisionsCount:n}=e(no);return{lastRevisionId:t(),revisionsCount:n()}}))((function(e){let{lastRevisionId:t,revisionsCount:n,children:o}=e;return!t||n<2?null:(0,i.createElement)(Qo,{supportKeys:"revisions"},o)}));var Nr=(0,l.withSelect)((e=>{const{getCurrentPostLastRevisionId:t,getCurrentPostRevisionsCount:n}=e(no);return{lastRevisionId:t(),revisionsCount:n()}}))((function(e){let{lastRevisionId:t,revisionsCount:n}=e;return(0,i.createElement)(Ir,null,(0,i.createElement)(To.Button,{href:(0,E.addQueryArgs)("revision.php",{revision:t,gutenberg:!0}),className:"editor-post-last-revision__title",icon:Ar},(0,Xt.sprintf)((0,Xt._n)("%d Revision","%d Revisions",n),n)))}));function Dr(){const e="core/editor/post-locked-modal-"+(0,u.useInstanceId)(Dr),{autosave:t,updatePostLock:n}=(0,l.useDispatch)(no),{isLocked:o,isTakeover:r,user:a,postId:p,postLockUtils:m,activePostLock:h,postType:g,previewLink:f}=(0,l.useSelect)((e=>{const{isPostLocked:t,isPostLockTakeover:n,getPostLockUser:o,getCurrentPostId:r,getActivePostLock:i,getEditedPostAttribute:s,getEditedPostPreviewLink:a,getEditorSettings:l}=e(no),{getPostType:u}=e(c.store);return{isLocked:t(),isTakeover:n(),user:o(),postId:r(),postLockUtils:l().postLockUtils,activePostLock:i(),postType:u(s("type")),previewLink:a()}}),[]);if((0,i.useEffect)((()=>{function r(){if(o||!h)return;const e=new window.FormData;if(e.append("action","wp-remove-post-lock"),e.append("_wpnonce",m.unlockNonce),e.append("post_ID",p),e.append("active_post_lock",h),window.navigator.sendBeacon)window.navigator.sendBeacon(m.ajaxUrl,e);else{const t=new window.XMLHttpRequest;t.open("POST",m.ajaxUrl,!1),t.send(e)}}return(0,d.addAction)("heartbeat.send",e,(function(e){o||(e["wp-refresh-post-lock"]={lock:h,post_id:p})})),(0,d.addAction)("heartbeat.tick",e,(function(e){if(!e["wp-refresh-post-lock"])return;const o=e["wp-refresh-post-lock"];o.lock_error?(t(),n({isLocked:!0,isTakeover:!0,user:{name:o.lock_error.name,avatar:o.lock_error.avatar_src_2x}})):o.new_lock&&n({isLocked:!1,activePostLock:o.new_lock})})),window.addEventListener("beforeunload",r),()=>{(0,d.removeAction)("heartbeat.send",e),(0,d.removeAction)("heartbeat.tick",e),window.removeEventListener("beforeunload",r)}}),[]),!o)return null;const v=a.name,_=a.avatar,y=(0,E.addQueryArgs)("post.php",{"get-post-lock":"1",lockKey:!0,post:p,action:"edit",_wpnonce:m.nonce}),b=(0,E.addQueryArgs)("edit.php",{post_type:(0,s.get)(g,["slug"])}),w=(0,Xt.__)("Exit editor");return(0,i.createElement)(To.Modal,{title:r?(0,Xt.__)("Someone else has taken over this post"):(0,Xt.__)("This post is already being edited"),focusOnMount:!0,shouldCloseOnClickOutside:!1,shouldCloseOnEsc:!1,isDismissible:!1,className:"editor-post-locked-modal"},!!_&&(0,i.createElement)("img",{src:_,alt:(0,Xt.__)("Avatar"),className:"editor-post-locked-modal__avatar",width:64,height:64}),(0,i.createElement)("div",null,!!r&&(0,i.createElement)("p",null,(0,i.createInterpolateElement)(v?(0,Xt.sprintf)((0,Xt.__)("%s now has editing control of this post (). Don’t worry, your changes up to this moment have been saved."),v):(0,Xt.__)("Another user now has editing control of this post (). Don’t worry, your changes up to this moment have been saved."),{strong:(0,i.createElement)("strong",null),PreviewLink:(0,i.createElement)(To.ExternalLink,{href:f},(0,Xt.__)("preview"))})),!r&&(0,i.createElement)(i.Fragment,null,(0,i.createElement)("p",null,(0,i.createInterpolateElement)(v?(0,Xt.sprintf)((0,Xt.__)("%s is currently working on this post (), which means you cannot make changes, unless you take over."),v):(0,Xt.__)("Another user is currently working on this post (), which means you cannot make changes, unless you take over."),{strong:(0,i.createElement)("strong",null),PreviewLink:(0,i.createElement)(To.ExternalLink,{href:f},(0,Xt.__)("preview"))})),(0,i.createElement)("p",null,(0,Xt.__)("If you take over, the other user will lose editing control to the post, but their changes will be saved."))),(0,i.createElement)(To.Flex,{className:"editor-post-locked-modal__buttons",justify:"flex-end",expanded:!1},!r&&(0,i.createElement)(To.FlexItem,null,(0,i.createElement)(To.Button,{variant:"tertiary",href:y},(0,Xt.__)("Take over"))),(0,i.createElement)(To.FlexItem,null,(0,i.createElement)(To.Button,{variant:"primary",href:b},w)))))}var Rr=(0,u.compose)((0,l.withSelect)((e=>{const{isCurrentPostPublished:t,getCurrentPostType:n,getCurrentPost:o}=e(no);return{hasPublishAction:(0,s.get)(o(),["_links","wp:action-publish"],!1),isPublished:t(),postType:n()}})))((function(e){let{hasPublishAction:t,isPublished:n,children:o}=e;return n||!t?null:o}));var Lr=(0,u.compose)((0,l.withSelect)((e=>({status:e(no).getEditedPostAttribute("status")}))),(0,l.withDispatch)((e=>({onUpdateStatus(t){e(no).editPost({status:t})}}))))((function(e){let{status:t,onUpdateStatus:n}=e;return(0,i.createElement)(Rr,null,(0,i.createElement)(To.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,Xt.__)("Pending review"),checked:"pending"===t,onChange:()=>{n("pending"===t?"draft":"pending")}}))}));var Or=(0,u.compose)([(0,l.withSelect)((e=>({pingStatus:e(no).getEditedPostAttribute("ping_status")}))),(0,l.withDispatch)((e=>({editPost:e(no).editPost})))])((function(e){let{pingStatus:t="open",...n}=e;return(0,i.createElement)(To.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,Xt.__)("Allow pingbacks & trackbacks"),checked:"open"===t,onChange:()=>n.editPost({ping_status:"open"===t?"closed":"open"})})}));class Ur extends i.Component{constructor(){super(...arguments),this.buttonRef=(0,i.createRef)(),this.openPreviewWindow=this.openPreviewWindow.bind(this)}componentDidUpdate(e){const{previewLink:t}=this.props;t&&!e.previewLink&&this.setPreviewWindowLink(t)}setPreviewWindowLink(e){const{previewWindow:t}=this;t&&!t.closed&&(t.location=e,this.buttonRef.current&&this.buttonRef.current.focus())}getWindowTarget(){const{postId:e}=this.props;return`wp-preview-${e}`}openPreviewWindow(e){e.preventDefault(),this.previewWindow&&!this.previewWindow.closed||(this.previewWindow=window.open("",this.getWindowTarget())),this.previewWindow.focus(),this.props.isAutosaveable&&!this.props.isPostLocked?(this.props.isDraft?this.props.savePost({isPreview:!0}):this.props.autosave({isPreview:!0}),function(e){let t=(0,i.renderToString)((0,i.createElement)("div",{className:"editor-post-preview-button__interstitial-message"},(0,i.createElement)(To.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 96 96"},(0,i.createElement)(To.Path,{className:"outer",d:"M48 12c19.9 0 36 16.1 36 36S67.9 84 48 84 12 67.9 12 48s16.1-36 36-36",fill:"none"}),(0,i.createElement)(To.Path,{className:"inner",d:"M69.5 46.4c0-3.9-1.4-6.7-2.6-8.8-1.6-2.6-3.1-4.9-3.1-7.5 0-2.9 2.2-5.7 5.4-5.7h.4C63.9 19.2 56.4 16 48 16c-11.2 0-21 5.7-26.7 14.4h2.1c3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3L40 67.5l7-20.9L42 33c-1.7-.1-3.3-.3-3.3-.3-1.7-.1-1.5-2.7.2-2.6 0 0 5.3.4 8.4.4 3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3l11.5 34.3 3.3-10.4c1.6-4.5 2.4-7.8 2.4-10.5zM16.1 48c0 12.6 7.3 23.5 18 28.7L18.8 35c-1.7 4-2.7 8.4-2.7 13zm32.5 2.8L39 78.6c2.9.8 5.9 1.3 9 1.3 3.7 0 7.3-.6 10.6-1.8-.1-.1-.2-.3-.2-.4l-9.8-26.9zM76.2 36c0 3.2-.6 6.9-2.4 11.4L64 75.6c9.5-5.5 15.9-15.8 15.9-27.6 0-5.5-1.4-10.8-3.9-15.3.1 1 .2 2.1.2 3.3z",fill:"none"})),(0,i.createElement)("p",null,(0,Xt.__)("Generating preview…"))));t+='\n\t\t\n\t',t=(0,d.applyFilters)("editor.PostPreview.interstitialMarkup",t),e.write(t),e.title=(0,Xt.__)("Generating preview…"),e.close()}(this.previewWindow.document)):this.setPreviewWindowLink(e.target.href)}render(){const{previewLink:e,currentPostLink:t,isSaveable:n,role:o}=this.props,r=e||t,s=uo()({"editor-post-preview":!this.props.className},this.props.className);return(0,i.createElement)(To.Button,{variant:this.props.className?void 0:"tertiary",className:s,href:r,target:this.getWindowTarget(),disabled:!n,onClick:this.openPreviewWindow,ref:this.buttonRef,role:o},this.props.textContent?this.props.textContent:(0,i.createElement)(i.Fragment,null,(0,Xt._x)("Preview","imperative verb"),(0,i.createElement)(To.VisuallyHidden,{as:"span"},(0,Xt.__)("(opens in a new tab)"))))}}var Mr=(0,u.compose)([(0,l.withSelect)(((e,t)=>{let{forcePreviewLink:n,forceIsAutosaveable:o}=t;const{getCurrentPostId:r,getCurrentPostAttribute:i,getEditedPostAttribute:a,isEditedPostSaveable:l,isEditedPostAutosaveable:u,getEditedPostPreviewLink:d,isPostLocked:p}=e(no),{getPostType:m}=e(c.store),h=d(),g=m(a("type"));return{postId:r(),currentPostLink:i("link"),previewLink:void 0!==n?n:h,isSaveable:l(),isAutosaveable:o||u(),isViewable:(0,s.get)(g,["viewable"],!1),isDraft:-1!==["draft","auto-draft"].indexOf(a("status")),isPostLocked:p()}})),(0,l.withDispatch)((e=>({autosave:e(no).autosave,savePost:e(no).savePost}))),(0,u.ifCondition)((e=>{let{isViewable:t}=e;return t}))])(Ur);var Fr=(0,u.compose)([(0,l.withSelect)(((e,t)=>{let{forceIsSaving:n}=t;const{isCurrentPostPublished:o,isEditedPostBeingScheduled:r,isSavingPost:i,isPublishingPost:a,getCurrentPost:l,getCurrentPostType:c,isAutosavingPost:u}=e(no);return{isPublished:o(),isBeingScheduled:r(),isSaving:n||i(),isPublishing:a(),hasPublishAction:(0,s.get)(l(),["_links","wp:action-publish"],!1),postType:c(),isAutosaving:u()}}))])((function(e){let{isPublished:t,isBeingScheduled:n,isSaving:o,isPublishing:r,hasPublishAction:i,isAutosaving:s,hasNonPostEntityChanges:a}=e;return r?(0,Xt.__)("Publishing…"):t&&o&&!s?(0,Xt.__)("Updating…"):n&&o&&!s?(0,Xt.__)("Scheduling…"):i?t?a?(0,Xt.__)("Update…"):(0,Xt.__)("Update"):n?a?(0,Xt.__)("Schedule…"):(0,Xt.__)("Schedule"):(0,Xt.__)("Publish"):a?(0,Xt.__)("Submit for Review…"):(0,Xt.__)("Submit for Review")}));const zr=()=>{};class Hr extends i.Component{constructor(e){super(e),this.buttonNode=(0,i.createRef)(),this.createOnClick=this.createOnClick.bind(this),this.closeEntitiesSavedStates=this.closeEntitiesSavedStates.bind(this),this.state={entitiesSavedStatesCallback:!1}}componentDidMount(){this.props.focusOnMount&&(this.timeoutID=setTimeout((()=>{this.buttonNode.current.focus()}),0))}componentWillUnmount(){clearTimeout(this.timeoutID)}createOnClick(e){var t=this;return function(){for(var n=arguments.length,o=new Array(n),r=0;re(...o)}),s((()=>t.closeEntitiesSavedStates)),zr):e(...o)}}closeEntitiesSavedStates(e){const{postType:t,postId:n}=this.props,{entitiesSavedStatesCallback:o}=this.state;this.setState({entitiesSavedStatesCallback:!1},(()=>{e&&e.some((e=>"postType"===e.kind&&e.name===t&&e.key===n))&&o()}))}render(){const{forceIsDirty:e,forceIsSaving:t,hasPublishAction:n,isBeingScheduled:o,isOpen:s,isPostSavingLocked:a,isPublishable:l,isPublished:c,isSaveable:u,isSaving:d,isAutoSaving:p,isToggle:m,onSave:h,onStatusChange:g,onSubmit:f=zr,onToggle:v,visibility:_,hasNonPostEntityChanges:y,isSavingNonPostEntityChanges:b}=this.props,E=(d||t||!u||a||!l&&!e)&&(!y||b),w=(c||d||t||!u||!l&&!e)&&(!y||b);let S;S=n?"private"===_?"private":o?"future":"publish":"pending";const P={"aria-disabled":E,className:"editor-post-publish-button",isBusy:!p&&d&&c,variant:"primary",onClick:this.createOnClick((()=>{E||(f(),g(S),h())}))},k={"aria-disabled":w,"aria-expanded":s,className:"editor-post-publish-panel__toggle",isBusy:d&&c,variant:"primary",onClick:this.createOnClick((()=>{w||v()}))},C=o?(0,Xt.__)("Schedule…"):(0,Xt.__)("Publish"),T=(0,i.createElement)(Fr,{forceIsSaving:t,hasNonPostEntityChanges:y}),x=m?k:P,B=m?C:T;return(0,i.createElement)(i.Fragment,null,(0,i.createElement)(To.Button,r({ref:this.buttonNode},x,{className:uo()(x.className,"editor-post-publish-button__button",{"has-changes-dot":y})}),B))}}var Vr=(0,u.compose)([(0,l.withSelect)((e=>{const{isSavingPost:t,isAutosavingPost:n,isEditedPostBeingScheduled:o,getEditedPostVisibility:r,isCurrentPostPublished:i,isEditedPostSaveable:a,isEditedPostPublishable:l,isPostSavingLocked:c,getCurrentPost:u,getCurrentPostType:d,getCurrentPostId:p,hasNonPostEntityChanges:m,isSavingNonPostEntityChanges:h}=e(no),g=n();return{isSaving:t()||g,isAutoSaving:g,isBeingScheduled:o(),visibility:r(),isSaveable:a(),isPostSavingLocked:c(),isPublishable:l(),isPublished:i(),hasPublishAction:(0,s.get)(u(),["_links","wp:action-publish"],!1),postType:d(),postId:p(),hasNonPostEntityChanges:m(),isSavingNonPostEntityChanges:h()}})),(0,l.withDispatch)((e=>{const{editPost:t,savePost:n}=e(no);return{onStatusChange:e=>t({status:e},{undoIgnore:!0}),onSave:n}}))])(Hr);var Wr=(0,i.createElement)(P.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,i.createElement)(P.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"}));var jr=(0,i.createElement)(P.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},(0,i.createElement)(P.Path,{d:"M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z"}));const $r={public:{label:(0,Xt.__)("Public"),info:(0,Xt.__)("Visible to everyone.")},private:{label:(0,Xt.__)("Private"),info:(0,Xt.__)("Only visible to site admins and editors.")},password:{label:(0,Xt.__)("Password protected"),info:(0,Xt.__)("Only those with the password can view this post.")}};function Gr(e){let{onClose:t}=e;const n=(0,u.useInstanceId)(Gr),{status:o,visibility:r,password:s}=(0,l.useSelect)((e=>({status:e(no).getEditedPostAttribute("status"),visibility:e(no).getEditedPostVisibility(),password:e(no).getEditedPostAttribute("password")}))),{editPost:a,savePost:c}=(0,l.useDispatch)(no),[d,m]=(0,i.useState)(!!s),[h,g]=(0,i.useState)(!1);return(0,i.createElement)("div",{className:"editor-post-visibility"},(0,i.createElement)(p.__experimentalInspectorPopoverHeader,{title:(0,Xt.__)("Visibility"),help:(0,Xt.__)("Control how this post is viewed."),onClose:t}),(0,i.createElement)("fieldset",{className:"editor-post-visibility__fieldset"},(0,i.createElement)(To.VisuallyHidden,{as:"legend"},(0,Xt.__)("Visibility")),(0,i.createElement)(Kr,{instanceId:n,value:"public",label:$r.public.label,info:$r.public.info,checked:"public"===r&&!d,onChange:()=>{a({status:"private"===r?"draft":o,password:""}),m(!1)}}),(0,i.createElement)(Kr,{instanceId:n,value:"private",label:$r.private.label,info:$r.private.info,checked:"private"===r,onChange:()=>{g(!0)}}),(0,i.createElement)(Kr,{instanceId:n,value:"password",label:$r.password.label,info:$r.password.info,checked:d,onChange:()=>{a({status:"private"===r?"draft":o,password:s||""}),m(!0)}}),d&&(0,i.createElement)("div",{className:"editor-post-visibility__password"},(0,i.createElement)(To.VisuallyHidden,{as:"label",htmlFor:`editor-post-visibility__password-input-${n}`},(0,Xt.__)("Create password")),(0,i.createElement)("input",{className:"editor-post-visibility__password-input",id:`editor-post-visibility__password-input-${n}`,type:"text",onChange:e=>{a({password:e.target.value})},value:s,placeholder:(0,Xt.__)("Use a secure password")}))),(0,i.createElement)(To.__experimentalConfirmDialog,{isOpen:h,onConfirm:()=>{a({status:"private",password:""}),m(!1),g(!1),c()},onCancel:()=>{g(!1)}},(0,Xt.__)("Would you like to privately publish this post now?")))}function Kr(e){let{instanceId:t,value:n,label:o,info:s,...a}=e;return(0,i.createElement)("div",{className:"editor-post-visibility__choice"},(0,i.createElement)("input",r({type:"radio",name:`editor-post-visibility__setting-${t}`,value:n,id:`editor-post-${n}-${t}`,"aria-describedby":`editor-post-${n}-${t}-description`,className:"editor-post-visibility__radio"},a)),(0,i.createElement)("label",{htmlFor:`editor-post-${n}-${t}`,className:"editor-post-visibility__label"},o),(0,i.createElement)("p",{id:`editor-post-${n}-${t}-description`,className:"editor-post-visibility__info"},s))}function Yr(){return qr()}function qr(){var e;const t=(0,l.useSelect)((e=>e(no).getEditedPostVisibility()));return null===(e=$r[t])||void 0===e?void 0:e.label}function Qr(e,t){if(t.length1?"s":"")+" required, but only "+t.length+" present")}function Xr(e){return Xr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Xr(e)}function Zr(e){Qr(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||"object"===Xr(e)&&"[object Date]"===t?new Date(e.getTime()):"number"==typeof e||"[object Number]"===t?new Date(e):("string"!=typeof e&&"[object String]"!==t||"undefined"==typeof console||(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn((new Error).stack)),new Date(NaN))}function Jr(e){Qr(1,arguments);var t=Zr(e);return t.setDate(1),t.setHours(0,0,0,0),t}function ei(e){Qr(1,arguments);var t=Zr(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}Math.pow(10,8);var ti=36e5;function ni(e){if(null===e||!0===e||!1===e)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}var oi={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},ri=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,ii=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,si=/^([+-])(\d{2})(?::?(\d{2}))?$/;function ai(e){var t,n={},o=e.split(oi.dateTimeDelimiter);if(o.length>2)return n;if(/:/.test(o[0])?t=o[0]:(n.date=o[0],t=o[1],oi.timeZoneDelimiter.test(n.date)&&(n.date=e.split(oi.timeZoneDelimiter)[0],t=e.substr(n.date.length,e.length))),t){var r=oi.timezone.exec(t);r?(n.time=t.replace(r[1],""),n.timezone=r[1]):n.time=t}return n}function li(e,t){var n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),o=e.match(n);if(!o)return{year:NaN,restDateString:""};var r=o[1]?parseInt(o[1]):null,i=o[2]?parseInt(o[2]):null;return{year:null===i?r:100*i,restDateString:e.slice((o[1]||o[2]).length)}}function ci(e,t){if(null===t)return new Date(NaN);var n=e.match(ri);if(!n)return new Date(NaN);var o=!!n[4],r=ui(n[1]),i=ui(n[2])-1,s=ui(n[3]),a=ui(n[4]),l=ui(n[5])-1;if(o)return function(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}(0,a,l)?function(e,t,n){var o=new Date(0);o.setUTCFullYear(e,0,4);var r=o.getUTCDay()||7,i=7*(t-1)+n+1-r;return o.setUTCDate(o.getUTCDate()+i),o}(t,a,l):new Date(NaN);var c=new Date(0);return function(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(hi[t]||(gi(e)?29:28))}(t,i,s)&&function(e,t){return t>=1&&t<=(gi(e)?366:365)}(t,r)?(c.setUTCFullYear(t,i,Math.max(r,s)),c):new Date(NaN)}function ui(e){return e?parseInt(e):1}function di(e){var t=e.match(ii);if(!t)return NaN;var n=pi(t[1]),o=pi(t[2]),r=pi(t[3]);return function(e,t,n){if(24===e)return 0===t&&0===n;return n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}(n,o,r)?n*ti+6e4*o+1e3*r:NaN}function pi(e){return e&&parseFloat(e.replace(",","."))||0}function mi(e){if("Z"===e)return 0;var t=e.match(si);if(!t)return 0;var n="+"===t[1]?-1:1,o=parseInt(t[2]),r=t[3]&&parseInt(t[3])||0;return function(e,t){return t>=0&&t<=59}(0,r)?n*(o*ti+6e4*r):NaN}var hi=[31,null,31,30,31,30,31,31,30,31,30,31];function gi(e){return e%400==0||e%4==0&&e%100!=0}function fi(e){let{onClose:t}=e;const{postDate:n,postType:o}=(0,l.useSelect)((e=>({postDate:e(no).getEditedPostAttribute("date"),postType:e(no).getCurrentPostType()})),[]),{editPost:r}=(0,l.useDispatch)(no),[s,a]=(0,i.useState)(Jr(new Date(n))),u=(0,l.useSelect)((e=>e(c.store).getEntityRecords("postType",o,{status:"publish,future",after:Jr(s).toISOString(),before:ei(s).toISOString(),exclude:[e(no).getCurrentPostId()],per_page:100,_fields:"id,date"})),[s,o]),d=(0,i.useMemo)((()=>(u||[]).map((e=>{let{date:t}=e;return{date:new Date(t)}}))),[u]),m=(0,b.getSettings)(),h=/a(?!\\)/i.test(m.formats.time.toLowerCase().replace(/\\\\/g,"").split("").reverse().join(""));return(0,i.createElement)(p.__experimentalPublishDateTimePicker,{currentDate:n,onChange:e=>r({date:e}),is12Hour:h,events:d,onMonthPreviewed:e=>a(function(e,t){var n;Qr(1,arguments);var o=ni(null!==(n=null==t?void 0:t.additionalDigits)&&void 0!==n?n:2);if(2!==o&&1!==o&&0!==o)throw new RangeError("additionalDigits must be 0, 1 or 2");if("string"!=typeof e&&"[object String]"!==Object.prototype.toString.call(e))return new Date(NaN);var r,i=ai(e);if(i.date){var s=li(i.date,o);r=ci(s.restDateString,s.year)}if(!r||isNaN(r.getTime()))return new Date(NaN);var a,l=r.getTime(),c=0;if(i.time&&(c=di(i.time),isNaN(c)))return new Date(NaN);if(!i.timezone){var u=new Date(l+c),d=new Date(0);return d.setFullYear(u.getUTCFullYear(),u.getUTCMonth(),u.getUTCDate()),d.setHours(u.getUTCHours(),u.getUTCMinutes(),u.getUTCSeconds(),u.getUTCMilliseconds()),d}return a=mi(i.timezone),isNaN(a)?new Date(NaN):new Date(l+c+a)}(e)),onClose:t})}function vi(e){return _i(e)}function _i(){let{full:e=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{date:t,isFloating:n}=(0,l.useSelect)((e=>({date:e(no).getEditedPostAttribute("date"),isFloating:e(no).isEditedPostDateFloating()})),[]);return e?yi(t):bi(t,{isFloating:n})}function yi(e){const t=(0,b.getDate)(e),n=function(){const{timezone:e}=(0,b.getSettings)();if(e.abbr&&isNaN(Number(e.abbr)))return e.abbr;return`UTC${e.offset<0?"":"+"}${e.offset}`}(),o=(0,b.dateI18n)((0,Xt._x)("F j, Y g:i a","post schedule full date format"),t);return(0,Xt.isRTL)()?`${n} ${o}`:`${o} ${n}`}function bi(e){let{isFloating:t=!1,now:n=new Date}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e||t)return(0,Xt.__)("Immediately");if(!Ei(n))return yi(e);const o=(0,b.getDate)(e);if(wi(o,n))return(0,Xt.sprintf)((0,Xt.__)("Today at %s"),(0,b.dateI18n)((0,Xt._x)("g:i a","post schedule time format"),o));const r=new Date(n);return r.setDate(r.getDate()+1),wi(o,r)?(0,Xt.sprintf)((0,Xt.__)("Tomorrow at %s"),(0,b.dateI18n)((0,Xt._x)("g:i a","post schedule time format"),o)):o.getFullYear()===n.getFullYear()?(0,b.dateI18n)((0,Xt._x)("F j g:i a","post schedule date format without year"),o):(0,b.dateI18n)((0,Xt._x)("F j, Y g:i a","post schedule full date format"),o)}function Ei(e){const{timezone:t}=(0,b.getSettings)();return Number(t.offset)===e.getTimezoneOffset()/60*-1}function wi(e,t){return e.getDate()===t.getDate()&&e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear()}var Si=n(3613),Pi=n.n(Si),ki=window.wp.a11y;const Ci={per_page:10,orderby:"count",order:"desc",hide_empty:!0,_fields:"id,name,count",context:"view"};function Ti(e){let{onSelect:t,taxonomy:n}=e;const{_terms:o,showTerms:r}=(0,l.useSelect)((e=>{const t=e(c.store).getEntityRecords("taxonomy",n.slug,Ci);return{_terms:t,showTerms:(null==t?void 0:t.length)>=3}}),[]);if(!r)return null;const a=(e=>(null!=e?e:[]).map(or))(o),u=(0,s.get)(n,["labels","most_used"]);return(0,i.createElement)("div",{className:"editor-post-taxonomies__flat-term-most-used"},(0,i.createElement)(To.BaseControl.VisualLabel,{as:"h3",className:"editor-post-taxonomies__flat-term-most-used-label"},u),(0,i.createElement)("ul",{role:"list",className:"editor-post-taxonomies__flat-term-most-used-list"},a.map((e=>(0,i.createElement)("li",{key:e.id},(0,i.createElement)(To.Button,{variant:"link",onClick:()=>t(e)},e.name))))))}const xi=[],Bi={per_page:20,orderby:"count",order:"desc",_fields:"id,name",context:"view"},Ai=(e,t)=>nr(e).toLowerCase()===nr(t).toLowerCase(),Ii=(e,t)=>e.map((e=>t.find((t=>Ai(t.name,e))).id));function Ni(e){let{slug:t}=e;const[n,o]=(0,i.useState)([]),[r,a]=(0,i.useState)(""),d=(0,u.useDebounce)(a,500),{terms:p,termIds:m,taxonomy:h,hasAssignAction:g,hasCreateAction:f,hasResolvedTerms:v}=(0,l.useSelect)((e=>{const{getCurrentPost:n,getEditedPostAttribute:o}=e(no),{getEntityRecords:r,getTaxonomy:i,hasFinishedResolution:a}=e(c.store),l=n(),u=i(t),d=u?o(u.rest_base):xi,p={...Bi,include:d.join(","),per_page:-1};return{hasCreateAction:!!u&&(0,s.get)(l,["_links","wp:action-create-"+u.rest_base],!1),hasAssignAction:!!u&&(0,s.get)(l,["_links","wp:action-assign-"+u.rest_base],!1),taxonomy:u,termIds:d,terms:d.length?r("taxonomy",t,p):xi,hasResolvedTerms:a("getEntityRecords",["taxonomy",t,p])}}),[t]),{searchResults:_}=(0,l.useSelect)((e=>{const{getEntityRecords:n}=e(c.store);return{searchResults:r?n("taxonomy",t,{...Bi,search:r}):xi}}),[r]);(0,i.useEffect)((()=>{if(v){const e=(null!=p?p:[]).map((e=>nr(e.name)));o(e)}}),[p,v]);const y=(0,i.useMemo)((()=>(null!=_?_:[]).map((e=>nr(e.name)))),[_]),{editPost:b}=(0,l.useDispatch)(no);if(!g)return null;function E(e){b({[h.rest_base]:e})}const w=(0,s.get)(h,["labels","add_new_item"],"post_tag"===t?(0,Xt.__)("Add new tag"):(0,Xt.__)("Add new Term")),S=(0,s.get)(h,["labels","singular_name"],"post_tag"===t?(0,Xt.__)("Tag"):(0,Xt.__)("Term")),P=(0,Xt.sprintf)((0,Xt._x)("%s added","term"),S),k=(0,Xt.sprintf)((0,Xt._x)("%s removed","term"),S),C=(0,Xt.sprintf)((0,Xt._x)("Remove %s","term"),S);return(0,i.createElement)(i.Fragment,null,(0,i.createElement)(To.FormTokenField,{value:n,suggestions:y,onChange:function(e){var t;const n=[...null!=p?p:[],...null!=_?_:[]],r=e.reduce(((e,t)=>(e.some((e=>e.toLowerCase()===t.toLowerCase()))||e.push(t),e)),[]),i=r.filter((e=>!n.find((t=>Ai(t.name,e)))));if(o(r),0===i.length)return E(Ii(r,n));if(!f)return;const s=null!==(t=null==h?void 0:h.rest_namespace)&&void 0!==t?t:"wp/v2";Promise.all(i.map((e=>function(e,t,n){const o=Pi()(e);return Gt()({path:`/${n}/${t}`,method:"POST",data:{name:o}}).catch((t=>"term_exists"!==t.code?Promise.reject(t):Promise.resolve({id:t.data.term_id,name:e}))).then(or)}(e,h.rest_base,s)))).then((e=>{const t=n.concat(e);return E(Ii(r,t))}))},onInputChange:d,maxSuggestions:20,label:w,messages:{added:P,removed:k,remove:C}}),(0,i.createElement)(Ti,{taxonomy:h,onSelect:function(e){if(m.includes(e.id))return;const n=[...m,e.id],o=(0,Xt.sprintf)((0,Xt._x)("%s added","term"),(0,s.get)(h,["labels","singular_name"],"post_tag"===t?(0,Xt.__)("Tag"):(0,Xt.__)("Term")));(0,ki.speak)(o,"assertive"),E(n)}}))}var Di=(0,To.withFilters)("editor.PostTaxonomyType")(Ni);const Ri=()=>{const e=[(0,Xt.__)("Suggestion:"),(0,i.createElement)("span",{className:"editor-post-publish-panel__link",key:"label"},(0,Xt.__)("Add tags"))];return(0,i.createElement)(To.PanelBody,{initialOpen:!1,title:e},(0,i.createElement)("p",null,(0,Xt.__)("Tags help users and search engines navigate your site and find your content. Add a few keywords to describe your post.")),(0,i.createElement)(Di,{slug:"post_tag"}))};class Li extends i.Component{constructor(e){super(e),this.state={hadTagsWhenOpeningThePanel:e.hasTags}}render(){return this.state.hadTagsWhenOpeningThePanel?null:(0,i.createElement)(Ri,null)}}var Oi=(0,u.compose)((0,l.withSelect)((e=>{const t=e(no).getCurrentPostType(),n=e(c.store).getTaxonomy("post_tag"),o=n&&e(no).getEditedPostAttribute(n.rest_base);return{areTagsFetched:void 0!==n,isPostTypeSupported:n&&n.types.some((e=>e===t)),hasTags:o&&o.length}})),(0,u.ifCondition)((e=>{let{areTagsFetched:t,isPostTypeSupported:n}=e;return n&&t})))(Li);const Ui=(e,t)=>xr.filter((t=>null==e?void 0:e.includes(t.id))).find((e=>e.id===t)),Mi=e=>{let{suggestedPostFormat:t,suggestionText:n,onUpdatePostFormat:o}=e;return(0,i.createElement)(To.Button,{variant:"link",onClick:()=>o(t)},n)};function Fi(){const{currentPostFormat:e,suggestion:t}=(0,l.useSelect)((e=>{const{getEditedPostAttribute:t,getSuggestedPostFormat:n}=e(no),o=(0,s.get)(e(c.store).getThemeSupports(),["formats"],[]);return{currentPostFormat:t("format"),suggestion:Ui(o,n())}}),[]),{editPost:n}=(0,l.useDispatch)(no),o=[(0,Xt.__)("Suggestion:"),(0,i.createElement)("span",{className:"editor-post-publish-panel__link",key:"label"},(0,Xt.__)("Use a post format"))];return t&&t.id!==e?(0,i.createElement)(To.PanelBody,{initialOpen:!1,title:o},(0,i.createElement)("p",null,(0,Xt.__)("Your theme uses post formats to highlight different kinds of content, like images or videos. Apply a post format to see this special styling.")),(0,i.createElement)("p",null,(0,i.createElement)(Mi,{onUpdatePostFormat:e=>n({format:e}),suggestedPostFormat:t.id,suggestionText:(0,Xt.sprintf)((0,Xt.__)('Apply the "%1$s" format.'),t.caption)}))):null}const zi={per_page:-1,orderby:"name",order:"asc",_fields:"id,name,parent",context:"view"},Hi=[];function Vi(e){let{slug:t}=e;const[n,o]=(0,i.useState)(!1),[r,a]=(0,i.useState)(""),[d,p]=(0,i.useState)(""),[m,h]=(0,i.useState)(!1),[g,f]=(0,i.useState)(""),[v,_]=(0,i.useState)([]),y=(0,u.useDebounce)(ki.speak,500),{hasCreateAction:b,hasAssignAction:E,terms:w,loading:S,availableTerms:P,taxonomy:k}=(0,l.useSelect)((e=>{const{getCurrentPost:n,getEditedPostAttribute:o}=e(no),{getTaxonomy:r,getEntityRecords:i,isResolving:a}=e(c.store),l=r(t);return{hasCreateAction:!!l&&(0,s.get)(n(),["_links","wp:action-create-"+l.rest_base],!1),hasAssignAction:!!l&&(0,s.get)(n(),["_links","wp:action-assign-"+l.rest_base],!1),terms:l?o(l.rest_base):Hi,loading:a("getEntityRecords",["taxonomy",t,zi]),availableTerms:i("taxonomy",t,zi)||Hi,taxonomy:l}}),[t]),{editPost:C}=(0,l.useDispatch)(no),{saveEntityRecord:T}=(0,l.useDispatch)(c.store),x=(0,i.useMemo)((()=>function(e,t){const n=e=>-1!==t.indexOf(e.id)||void 0!==e.children&&e.children.map(n).filter((e=>e)).length>0,o=[...e];return o.sort(((e,t)=>{const o=n(e),r=n(t);return o===r?0:o&&!r?-1:!o&&r?1:0})),o}(tr(P),w)),[P]);if(!E)return null;const B=e=>{C({[k.rest_base]:e})},A=e=>e.map((e=>(0,i.createElement)("div",{key:e.id,className:"editor-post-taxonomies__hierarchical-terms-choice"},(0,i.createElement)(To.CheckboxControl,{__nextHasNoMarginBottom:!0,checked:-1!==w.indexOf(e.id),onChange:()=>{(e=>{const t=w.includes(e)?w.filter((t=>t!==e)):[...w,e];B(t)})(parseInt(e.id,10))},label:(0,Lo.decodeEntities)(e.name)}),!!e.children.length&&(0,i.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-subchoices"},A(e.children))))),I=(e,n,o)=>(0,s.get)(k,["labels",e],"category"===t?n:o),N=I("add_new_item",(0,Xt.__)("Add new category"),(0,Xt.__)("Add new term")),D=I("new_item_name",(0,Xt.__)("Add new category"),(0,Xt.__)("Add new term")),R=I("parent_item",(0,Xt.__)("Parent Category"),(0,Xt.__)("Parent Term")),L=`— ${R} —`,O=N,U=(0,s.get)(k,["labels","search_items"],(0,Xt.__)("Search Terms")),M=(0,s.get)(k,["name"],(0,Xt.__)("Terms")),F=P.length>=8;return(0,i.createElement)(i.Fragment,null,F&&(0,i.createElement)(To.TextControl,{__nextHasNoMarginBottom:!0,className:"editor-post-taxonomies__hierarchical-terms-filter",label:U,value:g,onChange:e=>{const t=x.map(function(e){const t=n=>{if(""===e)return n;const o={...n};return o.children.length>0&&(o.children=o.children.map(t).filter((e=>e))),(-1!==o.name.toLowerCase().indexOf(e.toLowerCase())||o.children.length>0)&&o};return t}(e)).filter((e=>e)),n=e=>{let t=0;for(let o=0;o{h(!m)},className:"editor-post-taxonomies__hierarchical-terms-add","aria-expanded":m,variant:"link"},N),m&&(0,i.createElement)("form",{onSubmit:async e=>{if(e.preventDefault(),""===r||n)return;const i=function(e,t,n){return e.find((e=>(!e.parent&&!t||parseInt(e.parent)===parseInt(t))&&e.name.toLowerCase()===n.toLowerCase()))}(P,d,r);if(i)return w.some((e=>e===i.id))||B([...w,i.id]),a(""),void p("");o(!0);const l=await(c={name:r,parent:d||void 0},T("taxonomy",t,c));var c;const u=(0,Xt.sprintf)((0,Xt._x)("%s added","term"),(0,s.get)(k,["labels","singular_name"],"category"===t?(0,Xt.__)("Category"):(0,Xt.__)("Term")));(0,ki.speak)(u,"assertive"),o(!1),a(""),p(""),B([...w,l.id])}},(0,i.createElement)(To.__experimentalVStack,null,(0,i.createElement)(To.TextControl,{__nextHasNoMarginBottom:!0,className:"editor-post-taxonomies__hierarchical-terms-input",label:D,value:r,onChange:e=>{a(e)},required:!0}),!!P.length&&(0,i.createElement)(To.TreeSelect,{label:R,noOptionLabel:L,onChange:e=>{p(e)},selectedId:d,tree:x})),(0,i.createElement)(To.Button,{variant:"secondary",type:"submit",className:"editor-post-taxonomies__hierarchical-terms-submit"},O)))}var Wi=(0,To.withFilters)("editor.PostTaxonomyType")(Vi);var ji=function(){const e=(0,l.useSelect)((e=>{var t;const n=e(no).getCurrentPostType(),{canUser:o,getEntityRecord:r,getTaxonomy:i}=e(c.store),s=i("category"),a=o("read","settings")?null===(t=r("root","site"))||void 0===t?void 0:t.default_category:void 0,l=a?r("taxonomy","category",a):void 0,u=s&&s.types.some((e=>e===n)),d=s&&e(no).getEditedPostAttribute(s.rest_base);return!!s&&!!l&&u&&(0===(null==d?void 0:d.length)||1===(null==d?void 0:d.length)&&(null==l?void 0:l.id)===d[0])}),[]),[t,n]=(0,i.useState)(!1);if((0,i.useEffect)((()=>{e&&n(!0)}),[e]),!t)return null;const o=[(0,Xt.__)("Suggestion:"),(0,i.createElement)("span",{className:"editor-post-publish-panel__link",key:"label"},(0,Xt.__)("Assign a category"))];return(0,i.createElement)(To.PanelBody,{initialOpen:!1,title:o},(0,i.createElement)("p",null,(0,Xt.__)("Categories provide a helpful way to group related posts together and to quickly tell readers what a post is about.")),(0,i.createElement)(Wi,{slug:"category"}))};var $i=function(e){let{children:t}=e;const{isBeingScheduled:n,isRequestingSiteIcon:o,hasPublishAction:r,siteIconUrl:a,siteTitle:u,siteHome:d}=(0,l.useSelect)((e=>{const{getCurrentPost:t,isEditedPostBeingScheduled:n}=e(no),{getEntityRecord:o,isResolving:r}=e(c.store),i=o("root","__unstableBase",void 0)||{};return{hasPublishAction:(0,s.get)(t(),["_links","wp:action-publish"],!1),isBeingScheduled:n(),isRequestingSiteIcon:r("getEntityRecord",["root","__unstableBase",void 0]),siteIconUrl:i.site_icon_url,siteTitle:i.name,siteHome:i.home&&(0,E.filterURLForDisplay)(i.home)}}),[]);let p,m,h=(0,i.createElement)(To.Icon,{className:"components-site-icon",size:"36px",icon:jr});return a&&(h=(0,i.createElement)("img",{alt:(0,Xt.__)("Site Icon"),className:"components-site-icon",src:a})),o&&(h=null),r?n?(p=(0,Xt.__)("Are you ready to schedule?"),m=(0,Xt.__)("Your work will be published at the specified date and time.")):(p=(0,Xt.__)("Are you ready to publish?"),m=(0,Xt.__)("Double-check your settings before publishing.")):(p=(0,Xt.__)("Are you ready to submit for review?"),m=(0,Xt.__)("When you’re ready, submit your work for review, and an Editor will be able to approve it for you.")),(0,i.createElement)("div",{className:"editor-post-publish-panel__prepublish"},(0,i.createElement)("div",null,(0,i.createElement)("strong",null,p)),(0,i.createElement)("p",null,m),(0,i.createElement)("div",{className:"components-site-card"},h,(0,i.createElement)("div",{className:"components-site-info"},(0,i.createElement)("span",{className:"components-site-name"},(0,Lo.decodeEntities)(u)||(0,Xt.__)("(Untitled)")),(0,i.createElement)("span",{className:"components-site-home"},d))),r&&(0,i.createElement)(i.Fragment,null,(0,i.createElement)(To.PanelBody,{initialOpen:!1,title:[(0,Xt.__)("Visibility:"),(0,i.createElement)("span",{className:"editor-post-publish-panel__link",key:"label"},(0,i.createElement)(Yr,null))]},(0,i.createElement)(Gr,null)),(0,i.createElement)(To.PanelBody,{initialOpen:!1,title:[(0,Xt.__)("Publish:"),(0,i.createElement)("span",{className:"editor-post-publish-panel__link",key:"label"},(0,i.createElement)(vi,null))]},(0,i.createElement)(fi,null))),(0,i.createElement)(Fi,null),(0,i.createElement)(Oi,null),(0,i.createElement)(ji,null),t)};const Gi="%postname%";function Ki(e){let{text:t,onCopy:n,children:o}=e;const r=(0,u.useCopyToClipboard)(t,n);return(0,i.createElement)(To.Button,{variant:"secondary",ref:r},o)}class Yi extends i.Component{constructor(){super(...arguments),this.state={showCopyConfirmation:!1},this.onCopy=this.onCopy.bind(this),this.onSelectInput=this.onSelectInput.bind(this),this.postLink=(0,i.createRef)()}componentDidMount(){this.props.focusOnMount&&this.postLink.current.focus()}componentWillUnmount(){clearTimeout(this.dismissCopyConfirmation)}onCopy(){this.setState({showCopyConfirmation:!0}),clearTimeout(this.dismissCopyConfirmation),this.dismissCopyConfirmation=setTimeout((()=>{this.setState({showCopyConfirmation:!1})}),4e3)}onSelectInput(e){e.target.select()}render(){const{children:e,isScheduled:t,post:n,postType:o}=this.props,r=(0,s.get)(o,["labels","singular_name"]),a=(0,s.get)(o,["labels","view_item"]),l=(0,s.get)(o,["labels","add_new_item"]),c="future"===n.status?(e=>{const{slug:t}=e;return e.permalink_template.includes(Gi)?e.permalink_template.replace(Gi,t):e.permalink_template})(n):n.link,u=(0,E.addQueryArgs)("post-new.php",{post_type:n.type}),d=t?(0,i.createElement)(i.Fragment,null,(0,Xt.__)("is now scheduled. It will go live on")," ",(0,i.createElement)(vi,null),"."):(0,Xt.__)("is now live.");return(0,i.createElement)("div",{className:"post-publish-panel__postpublish"},(0,i.createElement)(To.PanelBody,{className:"post-publish-panel__postpublish-header"},(0,i.createElement)("a",{ref:this.postLink,href:c},(0,Lo.decodeEntities)(n.title)||(0,Xt.__)("(no title)"))," ",d),(0,i.createElement)(To.PanelBody,null,(0,i.createElement)("p",{className:"post-publish-panel__postpublish-subheader"},(0,i.createElement)("strong",null,(0,Xt.__)("What’s next?"))),(0,i.createElement)("div",{className:"post-publish-panel__postpublish-post-address-container"},(0,i.createElement)(To.TextControl,{__nextHasNoMarginBottom:!0,className:"post-publish-panel__postpublish-post-address",readOnly:!0,label:(0,Xt.sprintf)((0,Xt.__)("%s address"),r),value:(0,E.safeDecodeURIComponent)(c),onFocus:this.onSelectInput}),(0,i.createElement)("div",{className:"post-publish-panel__postpublish-post-address__copy-button-wrap"},(0,i.createElement)(Ki,{text:c,onCopy:this.onCopy},this.state.showCopyConfirmation?(0,Xt.__)("Copied!"):(0,Xt.__)("Copy")))),(0,i.createElement)("div",{className:"post-publish-panel__postpublish-buttons"},!t&&(0,i.createElement)(To.Button,{variant:"primary",href:c},a),(0,i.createElement)(To.Button,{variant:t?"primary":"secondary",href:u},l))),e)}}var qi=(0,l.withSelect)((e=>{const{getEditedPostAttribute:t,getCurrentPost:n,isCurrentPostScheduled:o}=e(no),{getPostType:r}=e(c.store);return{post:n(),postType:r(t("type")),isScheduled:o()}}))(Yi);class Qi extends i.Component{constructor(){super(...arguments),this.onSubmit=this.onSubmit.bind(this)}componentDidUpdate(e){e.isPublished&&!this.props.isSaving&&this.props.isDirty&&this.props.onClose()}onSubmit(){const{onClose:e,hasPublishAction:t,isPostTypeViewable:n}=this.props;t&&n||e()}render(){const{forceIsDirty:e,forceIsSaving:t,isBeingScheduled:n,isPublished:o,isPublishSidebarEnabled:s,isScheduled:a,isSaving:l,isSavingNonPostEntityChanges:c,onClose:u,onTogglePublishSidebar:d,PostPublishExtension:p,PrePublishExtension:m,...h}=this.props,{hasPublishAction:g,isDirty:f,isPostTypeViewable:v,..._}=h,y=o||a&&n,b=!y&&!l,E=y&&!l;return(0,i.createElement)("div",r({className:"editor-post-publish-panel"},_),(0,i.createElement)("div",{className:"editor-post-publish-panel__header"},E?(0,i.createElement)(To.Button,{onClick:u,icon:Wr,label:(0,Xt.__)("Close panel")}):(0,i.createElement)(i.Fragment,null,(0,i.createElement)("div",{className:"editor-post-publish-panel__header-publish-button"},(0,i.createElement)(Vr,{focusOnMount:!0,onSubmit:this.onSubmit,forceIsDirty:e,forceIsSaving:t})),(0,i.createElement)("div",{className:"editor-post-publish-panel__header-cancel-button"},(0,i.createElement)(To.Button,{disabled:c,onClick:u,variant:"secondary"},(0,Xt.__)("Cancel"))))),(0,i.createElement)("div",{className:"editor-post-publish-panel__content"},b&&(0,i.createElement)($i,null,m&&(0,i.createElement)(m,null)),E&&(0,i.createElement)(qi,{focusOnMount:!0},p&&(0,i.createElement)(p,null)),l&&(0,i.createElement)(To.Spinner,null)),(0,i.createElement)("div",{className:"editor-post-publish-panel__footer"},(0,i.createElement)(To.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,Xt.__)("Always show pre-publish checks."),checked:s,onChange:d})))}}var Xi=(0,u.compose)([(0,l.withSelect)((e=>{const{getPostType:t}=e(c.store),{getCurrentPost:n,getEditedPostAttribute:o,isCurrentPostPublished:r,isCurrentPostScheduled:i,isEditedPostBeingScheduled:a,isEditedPostDirty:l,isSavingPost:u,isSavingNonPostEntityChanges:d}=e(no),{isPublishSidebarEnabled:p}=e(no),m=t(o("type"));return{hasPublishAction:(0,s.get)(n(),["_links","wp:action-publish"],!1),isPostTypeViewable:(0,s.get)(m,["viewable"],!1),isBeingScheduled:a(),isDirty:l(),isPublished:r(),isPublishSidebarEnabled:p(),isSaving:u(),isSavingNonPostEntityChanges:d(),isScheduled:i()}})),(0,l.withDispatch)(((e,t)=>{let{isPublishSidebarEnabled:n}=t;const{disablePublishSidebar:o,enablePublishSidebar:r}=e(no);return{onTogglePublishSidebar:()=>{n?o():r()}}})),To.withFocusReturn,To.withConstrainedTabbing])(Qi);var Zi=(0,i.createElement)(P.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,i.createElement)(P.Path,{d:"M17.3 10.1c0-2.5-2.1-4.4-4.8-4.4-2.2 0-4.1 1.4-4.6 3.3h-.2C5.7 9 4 10.7 4 12.8c0 2.1 1.7 3.8 3.7 3.8h9c1.8 0 3.2-1.5 3.2-3.3.1-1.6-1.1-2.9-2.6-3.2zm-.5 5.1h-4v-2.4L14 14l1-1-3-3-3 3 1 1 1.2-1.2v2.4H7.7c-1.2 0-2.2-1.1-2.2-2.3s1-2.4 2.2-2.4H9l.3-1.1c.4-1.3 1.7-2.2 3.2-2.2 1.8 0 3.3 1.3 3.3 2.9v1.3l1.3.2c.8.1 1.4.9 1.4 1.8 0 1-.8 1.8-1.7 1.8z"}));var Ji=function(e){let{icon:t,size:n=24,...o}=e;return(0,i.cloneElement)(t,{width:n,height:n,...o})};var es=(0,i.createElement)(P.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,i.createElement)(P.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"}));var ts=(0,i.createElement)(P.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,i.createElement)(P.Path,{d:"M17.3 10.1c0-2.5-2.1-4.4-4.8-4.4-2.2 0-4.1 1.4-4.6 3.3h-.2C5.7 9 4 10.7 4 12.8c0 2.1 1.7 3.8 3.7 3.8h9c1.8 0 3.2-1.5 3.2-3.3.1-1.6-1.1-2.9-2.6-3.2zm-.5 5.1h-9c-1.2 0-2.2-1.1-2.2-2.3s1-2.4 2.2-2.4h1.3l.3-1.1c.4-1.3 1.7-2.2 3.2-2.2 1.8 0 3.3 1.3 3.3 2.9v1.3l1.3.2c.8.1 1.4.9 1.4 1.8-.1 1-.9 1.8-1.8 1.8z"}));var ns=(0,u.compose)([(0,l.withSelect)((e=>{const{isSavingPost:t,isCurrentPostPublished:n,isCurrentPostScheduled:o}=e(no);return{isSaving:t(),isPublished:n(),isScheduled:o()}})),(0,l.withDispatch)((e=>{const{editPost:t,savePost:n}=e(no);return{onClick:()=>{t({status:"draft"}),n()}}}))])((function(e){let{isSaving:t,isPublished:n,isScheduled:o,onClick:r}=e;const s=(0,u.useViewportMatch)("small","<"),[a,l]=(0,i.useState)(!1);if(!n&&!o)return null;let c;return n?c=(0,Xt.__)("Are you sure you want to unpublish this post?"):o&&(c=(0,Xt.__)("Are you sure you want to unschedule this post?")),(0,i.createElement)(i.Fragment,null,(0,i.createElement)(To.Button,{className:"editor-post-switch-to-draft",onClick:()=>{l(!0)},disabled:t,variant:"tertiary"},s?(0,Xt.__)("Draft"):(0,Xt.__)("Switch to draft")),(0,i.createElement)(To.__experimentalConfirmDialog,{isOpen:a,onConfirm:()=>{l(!1),r()},onCancel:()=>l(!1)},c))}));function os(e){let{forceIsDirty:t,forceIsSaving:n,showIconLabels:o=!1}=e;const[r,s]=(0,i.useState)(!1),a=(0,u.useViewportMatch)("small"),{isAutosaving:c,isDirty:d,isNew:p,isPending:m,isPublished:h,isSaveable:g,isSaving:f,isScheduled:v,hasPublishAction:_}=(0,l.useSelect)((e=>{var o,r,i;const{isEditedPostNew:s,isCurrentPostPublished:a,isCurrentPostScheduled:l,isEditedPostDirty:c,isSavingPost:u,isEditedPostSaveable:d,getCurrentPost:p,isAutosavingPost:m,getEditedPostAttribute:h}=e(no);return{isAutosaving:m(),isDirty:t||c(),isNew:s(),isPending:"pending"===h("status"),isPublished:a(),isSaving:n||u(),isSaveable:d(),isScheduled:l(),hasPublishAction:null!==(o=null===(r=p())||void 0===r||null===(i=r._links)||void 0===i?void 0:i["wp:action-publish"])&&void 0!==o&&o}}),[t,n]),{savePost:y}=(0,l.useDispatch)(no),b=(0,u.usePrevious)(f);if((0,i.useEffect)((()=>{let e;return b&&!f&&(s(!0),e=setTimeout((()=>{s(!1)}),1e3)),()=>clearTimeout(e)}),[f]),!_&&m)return null;if(h||v)return(0,i.createElement)(ns,null);const E=m?(0,Xt.__)("Save as pending"):(0,Xt.__)("Save draft"),w=(0,Xt.__)("Save"),S=r||!p&&!d,P=f||S,k=f||S||!g;let C;return f?C=c?(0,Xt.__)("Autosaving"):(0,Xt.__)("Saving"):S?C=(0,Xt.__)("Saved"):a?C=E:o&&(C=w),(0,i.createElement)(To.Button,{className:g||f?uo()({"editor-post-save-draft":!P,"editor-post-saved-state":P,"is-saving":f,"is-autosaving":c,"is-saved":S,[(0,To.__unstableGetAnimateClassName)({type:"loading"})]:f}):void 0,onClick:k?void 0:()=>y(),shortcut:k?void 0:ko.displayShortcut.primary("s"),showTooltip:!0,variant:"tertiary",icon:a?void 0:Zi,label:C||E,"aria-disabled":k},P&&(0,i.createElement)(Ji,{icon:S?es:ts}),C)}var rs=(0,u.compose)([(0,l.withSelect)((e=>{const{getCurrentPost:t,getCurrentPostType:n}=e(no);return{hasPublishAction:(0,s.get)(t(),["_links","wp:action-publish"],!1),postType:n()}}))])((function(e){let{hasPublishAction:t,children:n}=e;return t?n:null}));function is(e){let{children:t}=e;return(0,i.createElement)(Qo,{supportKeys:"slug"},t)}class ss extends i.Component{constructor(e){let{postSlug:t,postTitle:n,postID:o}=e;super(...arguments),this.state={editedSlug:(0,E.safeDecodeURIComponent)(t)||(0,E.cleanForSlug)(n)||o},this.setSlug=this.setSlug.bind(this)}setSlug(e){const{postSlug:t,onUpdateSlug:n}=this.props,{value:o}=e.target,r=(0,E.cleanForSlug)(o);r!==t&&n(r)}render(){const{editedSlug:e}=this.state;return(0,i.createElement)(is,null,(0,i.createElement)(To.TextControl,{__nextHasNoMarginBottom:!0,label:(0,Xt.__)("Slug"),autoComplete:"off",spellCheck:"false",value:e,onChange:e=>this.setState({editedSlug:e}),onBlur:this.setSlug,className:"editor-post-slug"}))}}var as=(0,u.compose)([(0,l.withSelect)((e=>{const{getCurrentPost:t,getEditedPostAttribute:n}=e(no),{id:o}=t();return{postSlug:n("slug"),postTitle:n("title"),postID:o}})),(0,l.withDispatch)((e=>{const{editPost:t}=e(no);return{onUpdateSlug(e){t({slug:e})}}}))])(ss);var ls=(0,u.compose)([(0,l.withSelect)((e=>{const t=e(no).getCurrentPost();return{hasStickyAction:(0,s.get)(t,["_links","wp:action-sticky"],!1),postType:e(no).getCurrentPostType()}}))])((function(e){let{hasStickyAction:t,postType:n,children:o}=e;return"post"===n&&t?o:null}));var cs=(0,u.compose)([(0,l.withSelect)((e=>({postSticky:e(no).getEditedPostAttribute("sticky")}))),(0,l.withDispatch)((e=>({onUpdateSticky(t){e(no).editPost({sticky:t})}})))])((function(e){let{onUpdateSticky:t,postSticky:n=!1}=e;return(0,i.createElement)(ls,null,(0,i.createElement)(To.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,Xt.__)("Stick to the top of the blog"),checked:n,onChange:()=>t(!n)}))}));const us=e=>e;var ds=(0,u.compose)([(0,l.withSelect)((e=>({postType:e(no).getCurrentPostType(),taxonomies:e(c.store).getTaxonomies({per_page:-1})})))])((function(e){let{postType:t,taxonomies:n,taxonomyWrapper:o=us}=e;return(null!=n?n:[]).filter((e=>e.types.includes(t))).filter((e=>{var t;return null===(t=e.visibility)||void 0===t?void 0:t.show_ui})).map((e=>{const t=e.hierarchical?Wi:Di;return(0,i.createElement)(i.Fragment,{key:`taxonomy-${e.slug}`},o((0,i.createElement)(t,{slug:e.slug}),e))}))}));var ps=(0,u.compose)([(0,l.withSelect)((e=>({postType:e(no).getCurrentPostType(),taxonomies:e(c.store).getTaxonomies({per_page:-1})})))])((function(e){let{postType:t,taxonomies:n,children:o}=e;return(null==n?void 0:n.some((e=>e.types.includes(t))))?o:null})),ms=n(773);function hs(){const e=(0,l.useSelect)((e=>e(no).getEditedPostContent()),[]),{editPost:t,resetEditorBlocks:n}=(0,l.useDispatch)(no),[o,r]=(0,i.useState)(e),[s,c]=(0,i.useState)(!1),d=(0,u.useInstanceId)(hs),p=(0,i.useRef)();s||o===e||r(e);return(0,i.useEffect)((()=>()=>{if(p.current){const e=(0,a.parse)(p.current);n(e)}}),[]),(0,i.createElement)(i.Fragment,null,(0,i.createElement)(To.VisuallyHidden,{as:"label",htmlFor:`post-content-${d}`},(0,Xt.__)("Type text or HTML")),(0,i.createElement)(ms.Z,{autoComplete:"off",dir:"auto",value:o,onChange:e=>{const n=e.target.value;t({content:n}),r(n),c(!0),p.current=n},onBlur:()=>{if(s){const e=(0,a.parse)(o);n(e),c(!1)}},className:"editor-post-text-editor",id:`post-content-${d}`,placeholder:(0,Xt.__)("Start writing with text or HTML")}))}var gs=window.wp.dom;const fs=/[\r\n]+/g;var vs=(0,i.forwardRef)((function(e,t){const n=(0,i.useRef)(),[o,r]=(0,i.useState)(!1),{editPost:s}=(0,l.useDispatch)(no),{insertDefaultBlock:c,clearSelectedBlock:d,insertBlocks:m}=(0,l.useDispatch)(p.store),{isCleanNewPost:h,title:g,placeholder:f,hasFixedToolbar:v}=(0,l.useSelect)((e=>{const{getEditedPostAttribute:t,isCleanNewPost:n}=e(no),{getSettings:o}=e(p.store),{titlePlaceholder:r,hasFixedToolbar:i}=o();return{isCleanNewPost:n(),title:t("title"),placeholder:r,hasFixedToolbar:i}}),[]);function _(e){m(e,0)}function y(e){s({title:e})}(0,i.useImperativeHandle)(t,(()=>({focus:()=>{var e;null==n||null===(e=n.current)||void 0===e||e.focus()}}))),(0,i.useEffect)((()=>{if(!n.current)return;const{ownerDocument:e}=n.current,{activeElement:t,body:o}=e;!h||t&&o!==t||n.current.focus()}),[h]);const[b,E]=(0,i.useState)({});function w(){r(!1),E({})}const S=uo()("wp-block wp-block-post-title block-editor-block-list__block editor-post-title editor-post-title__input rich-text",{"is-selected":o,"has-fixed-toolbar":v}),P=(0,Lo.decodeEntities)(f)||(0,Xt.__)("Add title"),{ref:k}=(0,lo.__unstableUseRichText)({value:g,onChange:function(e){y(e.replace(fs," "))},placeholder:P,selectionStart:b.start,selectionEnd:b.end,onSelectionChange(e,t){E((n=>{const{start:o,end:r}=n;return o===e&&r===t?n:{start:e,end:t}}))},__unstableDisableFormats:!0,preserveWhiteSpace:!0});return(0,i.createElement)(Qo,{supportKeys:"title"},(0,i.createElement)("h1",{ref:(0,u.useMergeRefs)([k,n]),contentEditable:!0,className:S,"aria-label":P,role:"textbox","aria-multiline":"true",onFocus:function(){r(!0),d()},onBlur:w,onKeyDown:function(e){e.keyCode===ko.ENTER&&(e.preventDefault(),c(void 0,void 0,0))},onKeyPress:w,onPaste:function(e){const t=e.clipboardData;let n="",o="";try{n=t.getData("text/plain"),o=t.getData("text/html")}catch(e){try{o=t.getData("Text")}catch(e){return}}window.console.log("Received HTML:\n\n",o),window.console.log("Received plain text:\n\n",n);const r=(0,a.pasteHandler)({HTML:o,plainText:n});if(e.preventDefault(),r.length)if("string"!=typeof r){const[e]=r;g||"core/heading"!==e.name&&"core/paragraph"!==e.name?_(r):(y((0,gs.__unstableStripHTML)(e.attributes.content)),_(r.slice(1)))}else{const e={...(0,lo.create)({html:g}),...b},t=(0,lo.insert)(e,(0,lo.create)({html:(0,gs.__unstableStripHTML)(r)}));y((0,lo.toHTMLString)({value:t})),E({start:t.start,end:t.end})}}}))}));function _s(){const{isNew:e,isDeleting:t,postId:n}=(0,l.useSelect)((e=>{const t=e(no);return{isNew:t.isEditedPostNew(),isDeleting:t.isDeletingPost(),postId:t.getCurrentPostId()}}),[]),{trashPost:o}=(0,l.useDispatch)(no);return e||!n?null:(0,i.createElement)(To.Button,{className:"editor-post-trash",isDestructive:!0,variant:"secondary",isBusy:t,"aria-disabled":t,onClick:t?void 0:()=>o()},(0,Xt.__)("Move to trash"))}var ys=(0,l.withSelect)((e=>{const{isEditedPostNew:t,getCurrentPostId:n,getCurrentPostType:o}=e(no),{getPostType:r,canUser:i}=e(c.store),s=n(),a=r(o()),l=(null==a?void 0:a.rest_base)||"";return{isNew:t(),postId:s,canUserDelete:!(!s||!l)&&i("delete",l,s)}}))((function(e){let{isNew:t,postId:n,canUserDelete:o,children:r}=e;return!t&&n&&o?r:null}));function bs(e){let{onClose:t}=e;const{isEditable:n,postSlug:o,viewPostLabel:r,postLink:s,permalinkPrefix:a,permalinkSuffix:u}=(0,l.useSelect)((e=>{var t,n;const o=e(no).getCurrentPost(),r=e(no).getCurrentPostType(),i=e(c.store).getPostType(r),s=e(no).getPermalinkParts(),a=null!==(t=null==o||null===(n=o._links)||void 0===n?void 0:n["wp:action-publish"])&&void 0!==t&&t;return{isEditable:e(no).isPermalinkEditable()&&a,postSlug:(0,E.safeDecodeURIComponent)(e(no).getEditedPostSlug()),viewPostLabel:null==i?void 0:i.labels.view_item,postLink:o.link,permalinkPrefix:null==s?void 0:s.prefix,permalinkSuffix:null==s?void 0:s.suffix}}),[]),{editPost:d}=(0,l.useDispatch)(no),[m,h]=(0,i.useState)(!1);return(0,i.createElement)("div",{className:"editor-post-url"},(0,i.createElement)(p.__experimentalInspectorPopoverHeader,{title:(0,Xt.__)("URL"),onClose:t}),n&&(0,i.createElement)(To.TextControl,{__nextHasNoMarginBottom:!0,label:(0,Xt.__)("Permalink"),value:m?"":o,autoComplete:"off",spellCheck:"false",help:(0,i.createElement)(i.Fragment,null,(0,Xt.__)("The last part of the URL.")," ",(0,i.createElement)(To.ExternalLink,{href:(0,Xt.__)("https://wordpress.org/support/article/settings-sidebar/#permalink")},(0,Xt.__)("Learn more."))),onChange:e=>{d({slug:e}),e?m&&h(!1):m||h(!0)},onBlur:e=>{d({slug:(0,E.cleanForSlug)(e.target.value)}),m&&h(!1)}}),n&&(0,i.createElement)("h3",{className:"editor-post-url__link-label"},null!=r?r:(0,Xt.__)("View post")),(0,i.createElement)("p",null,(0,i.createElement)(To.ExternalLink,{className:"editor-post-url__link",href:s,target:"_blank"},n?(0,i.createElement)(i.Fragment,null,(0,i.createElement)("span",{className:"editor-post-url__link-prefix"},a),(0,i.createElement)("span",{className:"editor-post-url__link-slug"},o),(0,i.createElement)("span",{className:"editor-post-url__link-suffix"},u)):s)))}function Es(e){let{children:t}=e;const n=(0,l.useSelect)((e=>{const t=e(no).getCurrentPostType(),n=e(c.store).getPostType(t);if(null==n||!n.viewable)return!1;if(!e(no).getCurrentPost().link)return!1;return!!e(no).getPermalinkParts()}),[]);return n?t:null}function ws(){return Ss()}function Ss(){const e=(0,l.useSelect)((e=>e(no).getPermalink()),[]);return(0,E.filterURLForDisplay)((0,E.safeDecodeURIComponent)(e))}var Ps=(0,u.compose)([(0,l.withSelect)((e=>{const{getCurrentPost:t,getCurrentPostType:n}=e(no);return{hasPublishAction:(0,s.get)(t(),["_links","wp:action-publish"],!1),postType:n()}}))])((function(e){let{hasPublishAction:t,render:n}=e;return n({canEdit:t})}));var ks=(0,i.createElement)(P.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,i.createElement)(P.Path,{d:"M12 3.2c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8 0-4.8-4-8.8-8.8-8.8zm0 16c-4 0-7.2-3.3-7.2-7.2C4.8 8 8 4.8 12 4.8s7.2 3.3 7.2 7.2c0 4-3.2 7.2-7.2 7.2zM11 17h2v-6h-2v6zm0-8h2V7h-2v2z"})),Cs=window.wp.wordcount;function Ts(){const e=(0,l.useSelect)((e=>e(no).getEditedPostAttribute("content")),[]),t=(0,Xt._x)("words","Word count type. Do not translate!");return(0,i.createElement)("span",{className:"word-count"},(0,Cs.count)(e,t))}function xs(){const e=(0,l.useSelect)((e=>e(no).getEditedPostAttribute("content")),[]),t=(0,Xt._x)("words","Word count type. Do not translate!"),n=Math.round((0,Cs.count)(e,t)/189),o=0===n?(0,i.createInterpolateElement)((0,Xt.__)("< 1 minute"),{span:(0,i.createElement)("span",null)}):(0,i.createInterpolateElement)((0,Xt.sprintf)((0,Xt._n)("%d minute","%d minutes",n),n),{span:(0,i.createElement)("span",null)});return(0,i.createElement)("span",{className:"time-to-read"},o)}function Bs(){const e=(0,l.useSelect)((e=>e(no).getEditedPostAttribute("content")),[]);return(0,Cs.count)(e,"characters_including_spaces")}var As=function(e){let{hasOutlineItemsDisabled:t,onRequestClose:n}=e;const{headingCount:o,paragraphCount:r,numberOfBlocks:s}=(0,l.useSelect)((e=>{const{getGlobalBlockCount:t}=e(p.store);return{headingCount:t("core/heading"),paragraphCount:t("core/paragraph"),numberOfBlocks:t()}}),[]);return(0,i.createElement)(i.Fragment,null,(0,i.createElement)("div",{className:"table-of-contents__wrapper",role:"note","aria-label":(0,Xt.__)("Document Statistics"),tabIndex:"0"},(0,i.createElement)("ul",{role:"list",className:"table-of-contents__counts"},(0,i.createElement)("li",{className:"table-of-contents__count"},(0,Xt.__)("Words"),(0,i.createElement)(Ts,null)),(0,i.createElement)("li",{className:"table-of-contents__count"},(0,Xt.__)("Characters"),(0,i.createElement)("span",{className:"table-of-contents__number"},(0,i.createElement)(Bs,null))),(0,i.createElement)("li",{className:"table-of-contents__count"},(0,Xt.__)("Time to read"),(0,i.createElement)(xs,null)),(0,i.createElement)("li",{className:"table-of-contents__count"},(0,Xt.__)("Headings"),(0,i.createElement)("span",{className:"table-of-contents__number"},o)),(0,i.createElement)("li",{className:"table-of-contents__count"},(0,Xt.__)("Paragraphs"),(0,i.createElement)("span",{className:"table-of-contents__number"},r)),(0,i.createElement)("li",{className:"table-of-contents__count"},(0,Xt.__)("Blocks"),(0,i.createElement)("span",{className:"table-of-contents__number"},s)))),o>0&&(0,i.createElement)(i.Fragment,null,(0,i.createElement)("hr",null),(0,i.createElement)("h2",{className:"table-of-contents__title"},(0,Xt.__)("Document Outline")),(0,i.createElement)(yo,{onSelect:n,hasOutlineItemsDisabled:t})))};var Is=(0,i.forwardRef)((function(e,t){let{hasOutlineItemsDisabled:n,repositionDropdown:o,...s}=e;const a=(0,l.useSelect)((e=>!!e(p.store).getBlockCount()),[]);return(0,i.createElement)(To.Dropdown,{popoverProps:{placement:o?"right":"bottom"},className:"table-of-contents",contentClassName:"table-of-contents__popover",renderToggle:e=>{let{isOpen:n,onToggle:o}=e;return(0,i.createElement)(To.Button,r({},s,{ref:t,onClick:a?o:void 0,icon:ks,"aria-expanded":n,"aria-haspopup":"true",label:(0,Xt.__)("Details"),tooltipPosition:"bottom","aria-disabled":!a}))},renderContent:e=>{let{onClose:t}=e;return(0,i.createElement)(As,{onRequestClose:t,hasOutlineItemsDisabled:n})}})}));function Ns(){const e=(0,l.useSelect)((e=>()=>{const{__experimentalGetDirtyEntityRecords:t}=e(c.store);return t().length>0}),[]),t=t=>{if(e())return t.returnValue=(0,Xt.__)("You have unsaved changes. If you proceed, they will be lost."),t.returnValue};return(0,i.useEffect)((()=>(window.addEventListener("beforeunload",t),()=>{window.removeEventListener("beforeunload",t)})),[]),null}var Ds=window.wp.reusableBlocks;var Rs=(0,u.createHigherOrderComponent)((e=>(0,l.withRegistry)((t=>{const{useSubRegistry:n=!0,registry:o,...r}=t;if(!n)return(0,i.createElement)(e,r);const[s,a]=(0,i.useState)(null);return(0,i.useEffect)((()=>{const e=(0,l.createRegistry)({"core/block-editor":p.storeConfig},o);e.registerStore("core/editor",to),a(e)}),[o]),s?(0,i.createElement)(l.RegistryProvider,{value:s},(0,i.createElement)(e,r)):null}))),"withRegistryProvider");const Ls=(e,t)=>`${t}`,Os=e=>`href="${e}" target="_blank" rel="noreferrer noopener"`,Us=e=>{const{title:t,foreign_landing_url:n,creator:o,creator_url:r,license:i,license_version:s,license_url:a}=e,l=((e,t)=>{let n=e.trim();return"pdm"!==e&&(n=e.toUpperCase().replace("SAMPLING","Sampling")),t&&(n+=` ${t}`),["pdm","cc0"].includes(e)||(n=`CC ${n}`),n})(i,s),c=(0,Lo.decodeEntities)(o);let u;return u=c?t?(0,Xt.sprintf)((0,Xt._x)('"%1$s" by %2$s/ %3$s',"caption"),Ls(n,(0,Lo.decodeEntities)(t)),r?Ls(r,c):c,a?Ls(`${a}?ref=openverse`,l):l):(0,Xt.sprintf)((0,Xt._x)("Work by %2$s/ %3$s","caption"),Os(n),r?Ls(r,c):c,a?Ls(`${a}?ref=openverse`,l):l):t?(0,Xt.sprintf)((0,Xt._x)('"%1$s"/ %2$s',"caption"),Ls(n,(0,Lo.decodeEntities)(t)),a?Ls(`${a}?ref=openverse`,l):l):(0,Xt.sprintf)((0,Xt._x)("Work/ %3$s","caption"),Os(n),a?Ls(`${a}?ref=openverse`,l):l),u.replace(/\s{2}/g," ")},Ms=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=await(0,l.resolveSelect)(c.store).getMediaItems({...e,orderBy:null!=e&&e.search?"relevance":"date"});return t.map((e=>{var t,n,o,r;return{...e,alt:e.alt_text,url:e.source_url,previewUrl:null===(t=e.media_details)||void 0===t||null===(n=t.sizes)||void 0===n||null===(o=n.medium)||void 0===o?void 0:o.source_url,caption:null===(r=e.caption)||void 0===r?void 0:r.raw}}))},Fs=[{name:"images",labels:{name:(0,Xt.__)("Images"),search_items:(0,Xt.__)("Search images")},mediaType:"image",async fetch(){return Ms({...arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},media_type:"image"})}},{name:"videos",labels:{name:(0,Xt.__)("Videos"),search_items:(0,Xt.__)("Search videos")},mediaType:"video",async fetch(){return Ms({...arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},media_type:"video"})}},{name:"audio",labels:{name:(0,Xt.__)("Audio"),search_items:(0,Xt.__)("Search audio")},mediaType:"audio",async fetch(){return Ms({...arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},media_type:"audio"})}},{name:"openverse",labels:{name:(0,Xt.__)("Openverse"),search_items:(0,Xt.__)("Search Openverse")},mediaType:"image",async fetch(){const e={...arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},mature:!1,excluded_source:"flickr,inaturalist,wikimedia",license:"pdm,cc0"},t={per_page:"page_size",search:"q"},n=new URL("https://api.openverse.engineering/v1/images/");Object.entries(e).forEach((e=>{let[o,r]=e;const i=t[o]||o;n.searchParams.set(i,r)}));const o=await window.fetch(n,{headers:{"User-Agent":"WordPress/inserter-media-fetch"}});return(await o.json()).results.map((e=>{var t;return{...e,title:null!==(t=e.title)&&void 0!==t&&t.toLowerCase().startsWith("file:")?e.title.slice(5):e.title,sourceId:e.id,id:void 0,caption:Us(e),previewUrl:e.thumbnail}}))},getReportUrl:e=>{let{sourceId:t}=e;return`https://wordpress.org/openverse/image/${t}/report/`},isExternalResource:!0}];var zs=Fs,Hs=window.wp.mediaUtils;const Vs=()=>{};function Ws(e){let{additionalData:t={},allowedTypes:n,filesList:o,maxUploadFileSize:r,onError:i=Vs,onFileChange:s}=e;const{getCurrentPostId:a,getEditorSettings:c}=(0,l.select)(no),u=c().allowedMimeTypes;r=r||c().maxUploadFileSize,(0,Hs.uploadMedia)({allowedTypes:n,filesList:o,onFileChange:s,additionalData:{post:a(),...t},maxUploadFileSize:r,onError:e=>{let{message:t}=e;return i(t)},wpAllowedMimeTypes:u})}const js=[],$s=["__experimentalBlockDirectory","__experimentalDiscussionSettings","__experimentalFeatures","__experimentalGlobalStylesBaseStyles","__experimentalPreferredStyleVariations","__experimentalSetIsInserterOpened","__unstableGalleryWithImageBlocks","alignWide","allowedBlockTypes","blockInspectorTabs","allowedMimeTypes","bodyPlaceholder","canLockBlocks","capabilities","clearBlockSelection","codeEditingEnabled","colors","disableCustomColors","disableCustomFontSizes","disableCustomSpacingSizes","disableCustomGradients","disableLayoutStyles","enableCustomLineHeight","enableCustomSpacing","enableCustomUnits","enableOpenverseMediaCategory","focusMode","fontSizes","gradients","generateAnchors","hasFixedToolbar","hasInlineToolbar","isDistractionFree","imageDefaultSize","imageDimensions","imageEditing","imageSizes","isRTL","keepCaretInsideBlock","locale","maxWidth","onUpdateDefaultBlockStyles","postsPerPage","readOnly","styles","template","templateLock","titlePlaceholder","supportsLayout","widgetTypesToHideFromLegacyWidgetBlock","__unstableHasCustomAppender","__unstableIsPreviewMode","__unstableResolvedAssets","__unstableIsBlockBasedTheme"];var Gs=function(e,t){var n,o;const{reusableBlocks:r,hasUploadPermissions:s,canUseUnfilteredHTML:a,userCanCreatePages:u,pageOnFront:d,postType:p}=(0,l.useSelect)((e=>{var t;const{canUserUseUnfilteredHTML:n,getCurrentPostType:o}=e(no),r="web"===i.Platform.OS,{canUser:s,getEntityRecord:a}=e(c.store),l=s("read","settings")?a("root","site"):void 0;return{canUseUnfilteredHTML:n(),reusableBlocks:r?e(c.store).getEntityRecords("postType","wp_block",{per_page:-1}):js,hasUploadPermissions:null===(t=s("create","media"))||void 0===t||t,userCanCreatePages:s("create","pages"),pageOnFront:null==l?void 0:l.page_on_front,postType:o()}}),[]),m=null!==(n=e.__experimentalAdditionalBlockPatterns)&&void 0!==n?n:e.__experimentalBlockPatterns,h=null!==(o=e.__experimentalAdditionalBlockPatternCategories)&&void 0!==o?o:e.__experimentalBlockPatternCategories,{restBlockPatterns:g,restBlockPatternCategories:f}=(0,l.useSelect)((e=>({restBlockPatterns:e(c.store).getBlockPatterns(),restBlockPatternCategories:e(c.store).getBlockPatternCategories()})),[]),v=(0,i.useMemo)((()=>[...m||[],...g||[]].filter(((e,t,n)=>t===n.findIndex((t=>e.name===t.name)))).filter((e=>{let{postTypes:t}=e;return!t||Array.isArray(t)&&t.includes(p)}))),[m,g,p]),_=(0,i.useMemo)((()=>[...h||[],...f||[]].filter(((e,t,n)=>t===n.findIndex((t=>e.name===t.name))))),[h,f]),{undo:y}=(0,l.useDispatch)(no),{saveEntityRecord:b}=(0,l.useDispatch)(c.store),E=e=>u?b("postType","page",e):Promise.reject({message:(0,Xt.__)("You do not have permission to create Pages.")});return(0,i.useMemo)((()=>({...Object.fromEntries(Object.entries(e).filter((e=>{let[t]=e;return $s.includes(t)}))),mediaUpload:s?Ws:void 0,__experimentalReusableBlocks:r,__experimentalBlockPatterns:v,__experimentalBlockPatternCategories:_,__experimentalFetchLinkSuggestions:(t,n)=>(0,c.__experimentalFetchLinkSuggestions)(t,n,e),inserterMediaCategories:zs,__experimentalFetchRichUrlData:c.__experimentalFetchUrlData,__experimentalCanUserUseUnfilteredHTML:a,__experimentalUndo:y,outlineMode:t,__experimentalCreatePageEntity:E,__experimentalUserCanCreatePages:u,pageOnFront:d,__experimentalPreferPatternsOnRoot:t})),[e,s,r,v,_,a,y,t,u,d])},Ks=window.wp.privateApis;const{lock:Ys,unlock:qs}=(0,Ks.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.","@wordpress/editor"),{ExperimentalBlockEditorProvider:Qs}=qs(p.privateApis),Xs=Rs((e=>{let{__unstableTemplate:t,post:n,settings:o,recovery:r,initialEdits:s,children:a,BlockEditorProviderComponent:u=Qs}=e;const d=(0,i.useMemo)((()=>"wp_template"===n.type?{}:{postId:n.id,postType:n.type}),[n.id,n.type]),{editorSettings:m,selection:h,isReady:g}=(0,l.useSelect)((e=>{const{getEditorSettings:t,getEditorSelection:n,__unstableIsEditorReady:o}=e(no);return{editorSettings:t(),isReady:o(),selection:n()}}),[]),{id:f,type:v}=null!=t?t:n,[_,y,b]=(0,c.useEntityBlockEditor)("postType",v,{id:f}),E=Gs(m,!!t),{updatePostLock:w,setupEditor:S,updateEditorSettings:P,__experimentalTearDownEditor:k}=(0,l.useDispatch)(no),{createWarningNotice:C}=(0,l.useDispatch)(Kt.store);return(0,i.useLayoutEffect)((()=>{if(!r)return w(o.postLock),S(n,s,o.template),o.autosave&&C((0,Xt.__)("There is an autosave of this post that is more recent than the version below."),{id:"autosave-exists",actions:[{label:(0,Xt.__)("View the autosave"),url:o.autosave.editLink}]}),()=>{k()}}),[]),(0,i.useEffect)((()=>{P(o)}),[o]),g?(0,i.createElement)(c.EntityProvider,{kind:"root",type:"site"},(0,i.createElement)(c.EntityProvider,{kind:"postType",type:n.type,id:n.id},(0,i.createElement)(p.BlockContextProvider,{value:d},(0,i.createElement)(u,{value:_,onChange:b,onInput:y,selection:h,settings:E,useSubRegistry:!1},a,(0,i.createElement)(Ds.ReusableBlocksMenuItems,null))))):null}));var Zs=function(e){return(0,i.createElement)(Xs,r({},e,{BlockEditorProviderComponent:p.BlockEditorProvider}),e.children)},Js=window.wp.serverSideRender,ea=n.n(Js);function ta(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];const o=(0,i.forwardRef)(((n,o)=>(S()("wp.editor."+e,{since:"5.3",alternative:"wp.blockEditor."+e,version:"6.2"}),(0,i.createElement)(t,r({ref:o},n)))));return n.forEach((n=>{o[n]=ta(e+"."+n,t[n])})),o}function na(e,t){return function(){return S()("wp.editor."+e,{since:"5.3",alternative:"wp.blockEditor."+e,version:"6.2"}),t(...arguments)}}const oa=ta("RichText",p.RichText,["Content"]);oa.isEmpty=na("RichText.isEmpty",p.RichText.isEmpty);const ra=ta("Autocomplete",p.Autocomplete),ia=ta("AlignmentToolbar",p.AlignmentToolbar),sa=ta("BlockAlignmentToolbar",p.BlockAlignmentToolbar),aa=ta("BlockControls",p.BlockControls,["Slot"]),la=ta("BlockEdit",p.BlockEdit),ca=ta("BlockEditorKeyboardShortcuts",p.BlockEditorKeyboardShortcuts),ua=ta("BlockFormatControls",p.BlockFormatControls,["Slot"]),da=ta("BlockIcon",p.BlockIcon),pa=ta("BlockInspector",p.BlockInspector),ma=ta("BlockList",p.BlockList),ha=ta("BlockMover",p.BlockMover),ga=ta("BlockNavigationDropdown",p.BlockNavigationDropdown),fa=ta("BlockSelectionClearer",p.BlockSelectionClearer),va=ta("BlockSettingsMenu",p.BlockSettingsMenu),_a=ta("BlockTitle",p.BlockTitle),ya=ta("BlockToolbar",p.BlockToolbar),ba=ta("ColorPalette",p.ColorPalette),Ea=ta("ContrastChecker",p.ContrastChecker),wa=ta("CopyHandler",p.CopyHandler),Sa=ta("DefaultBlockAppender",p.DefaultBlockAppender),Pa=ta("FontSizePicker",p.FontSizePicker),ka=ta("Inserter",p.Inserter),Ca=ta("InnerBlocks",p.InnerBlocks,["ButtonBlockAppender","DefaultBlockAppender","Content"]),Ta=ta("InspectorAdvancedControls",p.InspectorAdvancedControls,["Slot"]),xa=ta("InspectorControls",p.InspectorControls,["Slot"]),Ba=ta("PanelColorSettings",p.PanelColorSettings),Aa=ta("PlainText",p.PlainText),Ia=ta("RichTextShortcut",p.RichTextShortcut),Na=ta("RichTextToolbarButton",p.RichTextToolbarButton),Da=ta("__unstableRichTextInputEvent",p.__unstableRichTextInputEvent),Ra=ta("MediaPlaceholder",p.MediaPlaceholder),La=ta("MediaUpload",p.MediaUpload),Oa=ta("MediaUploadCheck",p.MediaUploadCheck),Ua=ta("MultiSelectScrollIntoView",p.MultiSelectScrollIntoView),Ma=ta("NavigableToolbar",p.NavigableToolbar),Fa=ta("ObserveTyping",p.ObserveTyping),za=ta("SkipToSelectedBlock",p.SkipToSelectedBlock),Ha=ta("URLInput",p.URLInput),Va=ta("URLInputButton",p.URLInputButton),Wa=ta("URLPopover",p.URLPopover),ja=ta("Warning",p.Warning),$a=ta("WritingFlow",p.WritingFlow),Ga=na("createCustomColorsHOC",p.createCustomColorsHOC),Ka=na("getColorClassName",p.getColorClassName),Ya=na("getColorObjectByAttributeValues",p.getColorObjectByAttributeValues),qa=na("getColorObjectByColorValue",p.getColorObjectByColorValue),Qa=na("getFontSize",p.getFontSize),Xa=na("getFontSizeClass",p.getFontSizeClass),Za=na("withColorContext",p.withColorContext),Ja=na("withColors",p.withColors),el=na("withFontSizes",p.withFontSizes);function tl(e){return S()("wp.editor.cleanForSlug",{since:"12.7",plugin:"Gutenberg",alternative:"wp.url.cleanForSlug"}),(0,E.cleanForSlug)(e)}const nl={};Ys(nl,{ExperimentalEditorProvider:Xs})}(),(window.wp=window.wp||{}).editor=o}();