Making WordPress.org

Changeset 12024


Ignore:
Timestamp:
08/19/2022 02:27:37 PM (18 months ago)
Author:
ryelle
Message:

Pattern Directory: Sync with git WordPress/pattern-directory@52841f347e20fa2d015a385fa5cfbe1ba6a43729

Location:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/build/index.asset.php

    r11896 r12024  
    1 <?php return array('dependencies' => array('lodash', 'react', 'wp-a11y', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-data-controls', 'wp-dom', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-keycodes', 'wp-primitives', 'wp-url'), 'version' => 'f6963223f3b8efc1c711');
     1<?php return array('dependencies' => array('lodash', 'react', 'wp-a11y', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-data-controls', 'wp-dom', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-keycodes', 'wp-primitives', 'wp-url'), 'version' => '9e21b74b92e3acdcf80a');
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/build/index.js

    r11729 r12024  
    1 !function(){var e={472:function(e,t){var n;!function(){"use strict";var r={}.hasOwnProperty;function a(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var o=typeof n;if("string"===o||"number"===o)e.push(n);else if(Array.isArray(n)){if(n.length){var i=a.apply(null,n);i&&e.push(i)}}else if("object"===o)if(n.toString===Object.prototype.toString)for(var s in n)r.call(n,s)&&n[s]&&e.push(s);else e.push(n.toString())}}return e.join(" ")}e.exports?(a.default=a,e.exports=a):void 0===(n=function(){return a}.apply(t,[]))||(e.exports=n)}()}},t={};function n(r){var a=t[r];if(void 0!==a)return a.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},function(){"use strict";var e={};n.r(e),n.d(e,{addFavorite:function(){return F},fetchCategories:function(){return I},fetchPatternFlagReasons:function(){return L},fetchPatterns:function(){return T},loadCategories:function(){return O},loadFavorites:function(){return D},loadPattern:function(){return k},loadPatternFlagReasons:function(){return R},loadPatterns:function(){return C},removeFavorite:function(){return M},setCurrentQuery:function(){return A},setErrorPatterns:function(){return x}});var t={};n.r(t),n.d(t,{getCategories:function(){return V},getFavorites:function(){return W},getPattern:function(){return K},getPatternFlagReasons:function(){return G},getPatternsByQuery:function(){return U}});var r={};n.r(r),n.d(r,{getCategories:function(){return re},getCategoryById:function(){return oe},getCategoryBySlug:function(){return ae},getCurrentQuery:function(){return ee},getFavorites:function(){return le},getPattern:function(){return Z},getPatternFlagReasons:function(){return ie},getPatternTotalPagesByQuery:function(){return J},getPatternTotalsByQuery:function(){return X},getPatterns:function(){return z},getPatternsByQuery:function(){return Y},getQueryFromUrl:function(){return ue},getUrlFromQuery:function(){return pe},hasLoadedCategories:function(){return ne},isFavorite:function(){return ce},isLoadingCategories:function(){return te},isLoadingPatternFlagReasons:function(){return se},isLoadingPatternsByQuery:function(){return H}});var a=window.wp.element,o=window.wp.i18n,i=window.wp.htmlEntities,s=window.wp.data,l=e=>{let{name:t,url:n,avatar:r}=e;return(0,a.createElement)("a",{href:n,className:"pattern__author-avatar"},(0,a.createElement)("img",{alt:"",src:r}),t)};const c=e=>{let{className:t="",style:n,children:r}=e;return(0,a.createElement)("span",{className:`${t} pattern-skeleton__container`,style:n},r)},u=e=>(0,a.createElement)("span",{className:"pattern-skeleton",style:e});function p(){return p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},p.apply(this,arguments)}var d=window.wp.primitives;function g(e){return(0,a.createElement)(d.SVG,p({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24"},e),(0,a.createElement)(d.Path,{d:"M11.941 21.175l-1.443-1.32c-5.124-4.67-8.508-7.75-8.508-11.53 0-3.08 2.408-5.5 5.473-5.5 1.732 0 3.394.81 4.478 2.09 1.085-1.28 2.747-2.09 4.478-2.09 3.065 0 5.473 2.42 5.473 5.5 0 3.78-3.383 6.86-8.508 11.54l-1.443 1.31z"}))}function m(e){return.6666666666666666*e}const f=()=>{const[e,t]=(0,a.useState)(),n=(0,a.useRef)();return(0,a.useEffect)((()=>{n.current&&t(`${m(n.current.clientWidth)}px`)}),[n]),(0,a.createElement)("div",{ref:n},(0,a.createElement)(c,null,(0,a.createElement)(u,{height:e}),(0,a.createElement)(u,{height:"14px",marginTop:"1rem"}),(0,a.createElement)(c,{style:{flexDirection:"row",marginTop:"0.5rem",alignItems:"center"}},(0,a.createElement)(u,{height:"18px",width:"18px",marginRight:"0.5rem",borderRadius:"32px"}),(0,a.createElement)(u,{height:"12px",width:"100px",marginRight:"0.75rem"}),(0,a.createElement)(g,{width:"16px",height:"16px",fill:"#787c82",className:"pattern-favorite-button__filled"}),(0,a.createElement)(u,{height:"12px",width:"32px",marginLeft:"0.5rem"}))))};var h=e=>{let{length:t=6}=e;return Array(t).fill().map(((e,t)=>(0,a.createElement)(f,{key:t})))},v=window.wp.url;const y=e=>e.split("?")[0],_=(e,t)=>{if(!t||!e)return"";const n=(0,v.getQueryArgs)(e);if(n[t])return n[t];const r=(o=y(e).replace(/\/$/,""),o.replace(/^\//,"")).split("/"),a=r.indexOf(t);var o;return-1===a?"":r[a+1]||""},w=e=>Number(_(e,"page")||1),E=(0,a.createContext)();function b(e){let{children:t}=e;const[n,r]=(0,a.useState)((0,v.getPathAndQueryString)(window.location.href)),o=e=>{window.history.pushState("","",e),r(e)},i=()=>{r(document.location.href)};return(0,a.useEffect)((()=>(window.addEventListener("popstate",i),()=>{window.removeEventListener("popstate",i)})),[]),(0,a.createElement)(E.Provider,{value:{path:n,update:e=>{const t=(e=>(e=>{const t={};return Object.keys(e).forEach((n=>{const r=e[n];null!=r&&r.toString().length>0&&(t[n]=r)})),t})({...(0,v.getQueryArgs)(n),...(0,v.getQueryArgs)(e)}))(e),r=y(e),a=(0,v.addQueryArgs)(r,t);o(a)},replace:o}},t)}function S(){const e=(0,a.useContext)(E);if(void 0===e)throw new Error("useRoute must be used within a Provider");return e}function P(e){let{currentPage:t=1,onNavigation:n,totalPages:r}=e;const{path:i,update:s}=S();if(!r||r<=1)return null;const l=t>1,c=t<r,u=(0,v.getQueryString)(i)?"?"+(0,v.getQueryString)(i):"",p=i.replace(u,"").replace(/page\/\d+\/?/,""),d=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const n=Array.from({length:e},((e,t)=>t+1)),r=[];return e<=5?n:(r.push(...n.slice(0,2)),t>=2&&t<=e-1&&r.push(...n.slice(t-2,t+1)),r.push(...n.slice(-2)),r.filter(((e,t,n)=>n.indexOf(e)===t)).reduce(((e,t,n,r)=>{if(0===n)return e.push(t),e;const a=Math.abs(r[n]-r[n-1]);return 0===a||(a>1&&e.push("…"),e.push(t)),e}),[]))}(r,t),g=`${p}page/%s/${u}`,m=e=>1===e?`${p}${u}`:(0,o.sprintf)(g,e),f=(e,t)=>{e.preventDefault(),s(m(t)),"function"==typeof n&&n()};return(0,a.createElement)("nav",{className:"pagination","aria-label":(0,o.__)("Pagination","wporg-patterns")},(0,a.createElement)("ul",{className:"pagination__list"},(0,a.createElement)("li",{className:"pagination__item pagination__item-previous-page"},l&&(0,a.createElement)("a",{className:"pagination__link",href:m(t-1),onClick:e=>f(e,t-1)},(0,a.createElement)("span",{className:"screen-reader-text"},(0,o.__)("Previous page","wporg-patterns")),(0,a.createElement)("span",{"aria-hidden":!0},(0,o._x)("Previous","previous page link label","wporg-patterns")))),d.map(((e,n)=>"…"===e?(0,a.createElement)("li",{className:"pagination__item",key:`${n}-${e}`},e):(0,a.createElement)("li",{className:"pagination__item",key:e},(0,a.createElement)("a",{className:"pagination__link",href:m(e),"aria-current":e===t?"page":void 0,onClick:t=>f(t,e)},(0,a.createElement)("span",{className:"screen-reader-text"},(0,o.sprintf)(// translators: %s is the page number.
    2 (0,o.__)("Page %s","wporg-patterns"),e)),(0,a.createElement)("span",{"aria-hidden":!0},e))))),(0,a.createElement)("li",{className:"pagination__item pagination__item-next-page"},c&&(0,a.createElement)("a",{className:"pagination__link",href:m(t+1),onClick:e=>f(e,t+1)},(0,a.createElement)("span",{className:"screen-reader-text"},(0,o.__)("Next page","wporg-patterns")),(0,a.createElement)("span",{"aria-hidden":!0},(0,o._x)("Next","next page link label","wporg-patterns"))))))}var N=window.wp.dataControls;function T(e){return{type:"FETCH_BLOCK_PATTERNS",query:e}}function k(e,t){return{type:"LOAD_BLOCK_PATTERN",postId:e,pattern:t}}function C(e,t){let{page:n,patterns:r,total:a,totalPages:o}=t;return{type:"LOAD_BLOCK_PATTERNS",query:e,page:n,patterns:r,total:a,totalPages:o}}function x(e,t){let{page:n,error:r}=t;return{type:"ERROR_BLOCK_PATTERNS",query:e,page:n,error:r}}function A(e){return{type:"SET_CURRENT_QUERY",query:e}}function I(){return{type:"FETCH_CATEGORIES"}}function O(e){return{type:"LOAD_CATEGORIES",categories:e}}function L(){return{type:"FETCH_PATTERN_FLAG_REASONS"}}function R(e){return{type:"LOAD_PATTERN_FLAG_REASONS",reasons:e}}function D(e){return{type:"LOAD_FAVORITES",patternIds:e}}function*F(e){const t=yield(0,N.apiFetch)({path:"/wporg/v1/pattern-favorites",method:"POST",data:{id:e}});if("number"==typeof t)return{type:"ADD_FAVORITE",patternId:e,count:t}}function*M(e){const t=yield(0,N.apiFetch)({path:"/wporg/v1/pattern-favorites",method:"DELETE",data:{id:e}});if("number"==typeof t)return{type:"REMOVE_FAVORITE",patternId:e,count:t}}function $(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=Object.keys(e).sort();let n="";for(let r=0;r<t.length;r++){const a=t[r];let o=e[a];switch(Array.isArray(o)&&(o=e[a].join()),a){case"page":case"per_page":case"_fields":break;default:n+=(n?"&":"")+(0,v.addQueryArgs)("",{[a]:o}).slice(1)}}return n}function B(){return{id:-1,slug:"",name:(0,o.__)("All","wporg-patterns"),link:wporgPatternsUrl.site}}function Q(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"LOAD_BLOCK_PATTERNS":{const n=(t.patterns||[]).reduce(((e,t)=>({...e,[t.id]:t})),{});return{...e,...n}}case"LOAD_BLOCK_PATTERN":return{...e,[t.postId]:t.pattern};case"ADD_FAVORITE":case"REMOVE_FAVORITE":{const n={...e[t.patternId],favorite_count:t.count};return{...e,[t.patternId]:n}}default:return e}}function j(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;const n=(t.patterns||[]).map((e=>{let{id:t}=e;return t})),{page:r,total:a,totalPages:o}=t;switch(t.type){case"LOAD_BLOCK_PATTERNS":{const i={...e[t.query]||{},total:a,totalPages:o};return i[r]=n,{...e,[t.query]:i}}case"ERROR_BLOCK_PATTERNS":{const n=e[t.query]||{};return n[r]=[],{...e,[t.query]:n}}default:return e}}var q=(0,s.combineReducers)({patterns:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return{byId:Q(e.byId,t),queries:j(e.queries,t)}},categories:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"FETCH_CATEGORIES":return null;case"LOAD_CATEGORIES":const e=(t.categories||[]).sort(((e,t)=>e.name.localeCompare(t.name)));return[B(),...e]}return e},currentQuery:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,t=arguments.length>1?arguments[1]:void 0;return"SET_CURRENT_QUERY"===t.type?t.query:e},patternFlagReasons:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"FETCH_PATTERN_FLAG_REASONS":return null;case"LOAD_PATTERN_FLAG_REASONS":return[...t.reasons];default:return e}},favorites:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0;const{patternId:n}=t;switch(t.type){case"LOAD_FAVORITES":return t.patternIds;case"ADD_FAVORITE":return e.includes(n)?e:[...e,n];case"REMOVE_FAVORITE":return e.filter((e=>e!==n))}return e}});function*U(e){const t=$(e);try{yield T(t);const n=yield(0,N.apiFetch)({path:(0,v.addQueryArgs)("/wp/v2/wporg-pattern",{...e,locale:wporgLocale.id}),parse:!1}),{total:r,totalPages:a,results:o}=yield(0,N.__unstableAwaitPromise)(async function(e){try{var t,n;return{total:Number((null===(t=e.headers)||void 0===t?void 0:t.get("X-WP-Total"))||0),totalPages:Number((null===(n=e.headers)||void 0===n?void 0:n.get("X-WP-TotalPages"))||0),results:await e.json()}}catch(e){return{}}}(n));yield C(t,{page:e.page||1,patterns:o,total:r,totalPages:a})}catch(n){const r=yield(0,N.__unstableAwaitPromise)(async function(e){try{return await e.json()}catch(e){return{}}}(n));yield x(t,{page:e.page||1,error:r})}}function*K(e){try{const t=yield(0,N.apiFetch)({path:(0,v.addQueryArgs)(`/wp/v2/wporg-pattern/${e}`)});yield k(e,t)}catch(e){}}function*V(){try{yield{type:"FETCH_CATEGORIES"};const e=yield(0,N.apiFetch)({path:(0,v.addQueryArgs)("/wp/v2/pattern-categories")});yield O(e)}catch(e){}}function*G(){try{yield{type:"FETCH_PATTERN_FLAG_REASONS"};const e=yield(0,N.apiFetch)({path:(0,v.addQueryArgs)("/wp/v2/wporg-pattern-flag-reason")});yield R(e)}catch(e){}}function*W(){try{const e=yield(0,N.apiFetch)({path:"/wporg/v1/pattern-favorites"});yield D(e)}catch(e){}}function H(e,t){var n,r;const a=$(t),o=(null==t?void 0:t.page)||1;return!Array.isArray(null===(n=e.patterns.queries)||void 0===n||null===(r=n[a])||void 0===r?void 0:r[o])}function z(e){return Object.values(e.patterns.byId)}function Y(e,t){var n,r;const a=$(t),o=(null==t?void 0:t.page)||1;return((null===(n=e.patterns.queries)||void 0===n||null===(r=n[a])||void 0===r?void 0:r[o])||[]).map((t=>e.patterns.byId[t]))}function X(e,t){var n,r;const a=$(t);return(null===(n=e.patterns.queries)||void 0===n||null===(r=n[a])||void 0===r?void 0:r.total)||0}function J(e,t){var n,r;const a=$(t);return(null===(n=e.patterns.queries)||void 0===n||null===(r=n[a])||void 0===r?void 0:r.totalPages)||0}function Z(e,t){return e.patterns.byId[t]||null}function ee(e){return e.currentQuery}function te(e){return null===e.categories}function ne(e){return Array.isArray(e.categories)}function re(e){return e.categories}function ae(e,t){if(!ne(e))return;const[n]=e.categories.filter((e=>e.slug===t));return n}function oe(e,t){if(ne(e))return e.categories.find((e=>{let{id:n}=e;return t===n}))}function ie(e){return e.patternFlagReasons}function se(e){return null===e.patternFlagReasons}function le(e){return e.favorites}function ce(e,t){var n;return null===(n=e.favorites)||void 0===n?void 0:n.includes(t)}function ue(e,t){const n=["categories","author","page","search"],r=(0,v.getQueryArgs)(t),a=_(t,"categories");if(a&&-1===n.indexOf(a)){const t=ae(e,a);null!=t&&t.id&&(r["pattern-categories"]=t.id)}const o=_(t,"author");o&&-1===n.indexOf(o)&&(r.author_name=o);const i=w(t);"number"==typeof i&&i>1&&(r.page=i);const s=decodeURI(_(t,"search"));s.length>0&&-1===n.indexOf(s)&&(r.search=s);const l=_(t,"my-patterns");return l&&"page"!==l&&(r.status=l),r}function pe(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:wporgPatternsUrl.site;if(n=n.replace(/\/$/,""),t.author_name&&(n+=`/author/${t.author_name}`,delete t.author_name),t["pattern-categories"]){const r=t["pattern-categories"],a=re(e).find((e=>{let{id:t}=e;return r===t}));null!=a&&a.slug&&(n+=`/categories/${a.slug}`),delete t["pattern-categories"]}return t.page&&(n+=`/page/${t.page}`,delete t.page),Object.keys(t).length?(n+="/?"+(0,v.buildQueryString)(t),n):n+"/"}const de=(0,s.createReduxStore)("wporg/pattern-directory",{reducer:q,selectors:r,actions:e,controls:N.controls,resolvers:t});(0,s.register)(de);var ge=function(e){let{header:t,children:n,onNavigation:r,query:o,showPagination:i=!0}=e;const{isLoading:l,posts:c,totalPages:u}=(0,s.useSelect)((e=>{const{getPatternTotalPagesByQuery:t,getPatternsByQuery:n,isLoadingPatternsByQuery:r}=e(de);return{isLoading:o&&r(o),posts:o?n(o):[],totalPages:o?t(o):0}}));return(0,a.createElement)(a.Fragment,null,c.length?t:null,(0,a.createElement)("div",{className:"pattern-grid"},l?(0,a.createElement)(h,{length:null==o?void 0:o.per_page}):c.map(n)),i&&(0,a.createElement)(P,{totalPages:u,currentPage:null==o?void 0:o.page,onNavigation:r}))},me=window.wp.compose,fe=window.wp.components;function he(e){e.dir=document.dir,e.body.className="pattern-wrapper";for(const t of document.body.classList)t.startsWith("admin-color-")&&e.body.classList.add(t)}var ve=(0,a.forwardRef)((function(e,t){let{contentRef:n,children:r,head:i,headHTML:s,bodyStyle:l="",themeSlug:c="twentytwentyone",...u}=e;const[d,g]=(0,a.useState)();s+=`<link rel="stylesheet" href="https://wp-themes.com/wp-content/themes/${c}/style.css" media="all" />`,s+=`<style>\n    body {\n        display: flex;\n        min-height: 100vh;\n        align-items: center;\n        justify-content: center;\n        background-color: white;\n    }\n    .pattern-wrapper {\n        padding: 0;\n        ${l}\n    }\n    body > div {\n        width: 100%;\n        max-height: 100%;\n        pointer-events: none;\n    }\n    </style>`;const m=(0,a.useCallback)((e=>{function t(){const{contentDocument:t}=e,{readyState:r,body:a}=t;return("interactive"===r||"complete"===r)&&("function"==typeof n?n(a):n&&(n.current=a),function(e,t){e.head.innerHTML="<style>body{margin:0}</style>"+t}(t,s),he(t),function(e){const{defaultView:t}=e,{frameElement:n}=t;function r(e){const r=Object.getPrototypeOf(e).constructor.name,a=window[r],o={};for(const t in e)o[t]=e[t];if(e instanceof t.MouseEvent){const e=n.getBoundingClientRect();o.clientX+=e.left,o.clientY+=e.top}const i=new a(e.type,o);!n.dispatchEvent(i)&&e.preventDefault()}const a=["keydown","keypress","dragover"];for(const t of a)e.addEventListener(t,r)}(t),he(t),g(t),!0)}e&&(t()||e.addEventListener("load",(()=>{t()})))}),[]);return(0,a.createElement)("iframe",p({title:(0,o.__)("Pattern Preview","wporg-patterns"),tabIndex:"-1"},u,{ref:(0,me.useMergeRefs)([t,m])}),d&&(0,a.createPortal)(r,d.body),d&&(0,a.createPortal)(i,d.head))})),ye=function(e){let{html:t}=e;return(0,a.createElement)("div",null,(0,a.createElement)(ve,{className:"pattern-preview__viewport-iframe",style:{width:"100%",height:"50vh",minHeight:"600px",overflowY:"auto"},headHTML:window.__editorStyles.html},(0,a.createElement)("div",{dangerouslySetInnerHTML:{__html:t}})))},_e=window.React,we=n.n(_e);function Ee(e,t){return e.map((function(e,n){return e+t[n]}))}function be(e,t){return e.map((function(e,n){return e-t[n]}))}function Se(e){return Math.hypot.apply(Math,e)}function Pe(e){return Math.sign?Math.sign(e):Number(e>0)-Number(e<0)||+e}function Ne(e,t,n){return 0===t||Math.abs(t)===1/0?function(e,t){return Math.pow(e,5*t)}(e,n):e*t*n/(t+n*e)}function Te(e,t,n,r){return void 0===r&&(r=.15),0===r?function(e,t,n){return Math.max(t,Math.min(e,n))}(e,t,n):e<t?-Ne(t-e,n-t,r)+t:e>n?+Ne(e-n,n-t,r)+n:e}function ke(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ce(){return Ce=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ce.apply(this,arguments)}function xe(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function Ae(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ie(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Oe(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return Ie(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ie(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}function Le(){}function Re(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?Le:1===t.length?t[0]:function(){for(var e,n,r=Oe(t);!(n=r()).done;){var a=n.value;e=a.apply(this,arguments)||e}return e}}function De(e,t){if(void 0===e){if(void 0===t)throw new Error("Must define fallback value if undefined is expected");e=t}return Array.isArray(e)?e:[e,e]}function Fe(e){if("function"==typeof e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return e.apply(void 0,n)}return e}function Me(e,t){void 0===e&&(e={});for(var n={},r=0,a=Object.entries(t);r<a.length;r++){var o=a[r],i=o[0],s=o[1];switch(typeof s){case"function":n[i]=s.call(n,e[i],i,e);break;case"object":n[i]=Me(e[i],s);break;case"boolean":s&&(n[i]=e[i])}}return n}function $e(){return"undefined"!=typeof window&&"ontouchstart"in window}function Be(e){return"pointerId"in e?null:"touchend"===e.type?e.changedTouches:e.targetTouches}function Qe(e){return Array.from(Be(e)).map((function(e){return e.identifier}))}function je(e){return{buttons:"buttons"in e?e.buttons:0,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey}}var qe=function(e){return e};function Ue(e,t){void 0===t&&(t=qe);var n=Be(e),r=n?n[0]:e;return t([r.clientX,r.clientY])}var Ke=Ce({},{threshold:function(e){return void 0===e&&(e=0),De(e)},rubberband:function(e){switch(void 0===e&&(e=0),e){case!0:return De(.15);case!1:return De(0);default:return De(e)}},enabled:function(e){return void 0===e&&(e=!0),e},triggerAllEvents:function(e){return void 0===e&&(e=!1),e},initial:function(e){return void 0===e&&(e=0),"function"==typeof e?e:De(e)},transform:!0},{axis:!0,lockDirection:function(e){return void 0===e&&(e=!1),e},bounds:function(e){if(void 0===e&&(e={}),"function"==typeof e)return function(t){return Ke.bounds(e(t))};var t=e,n=t.left,r=void 0===n?-1/0:n,a=t.right,o=void 0===a?1/0:a,i=t.top,s=void 0===i?-1/0:i,l=t.bottom;return[[r,o],[s,void 0===l?1/0:l]]}}),Ve="undefined"!=typeof window&&window.document&&window.document.createElement,Ge={enabled:function(e){return void 0===e&&(e=!0),e},domTarget:!0,window:function(e){function t(_x){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(e){return void 0===e&&(e=Ve?window:void 0),e})),eventOptions:function(e){var t=void 0===e?{}:e,n=t.passive,r=void 0===n||n,a=t.capture;return{passive:r,capture:void 0!==a&&a}},transform:!0},We=Ce({},Ke,{useTouch:function(e){void 0===e&&(e=!1);var t=$e(),n="undefined"!=typeof window&&"onpointerdown"in window;return!(!e||!t)||!(!t||n)},experimental_preventWindowScrollY:function(e){return void 0===e&&(e=!1),e},threshold:function(e,t,n){var r=n.filterTaps,a=void 0!==r&&r,o=n.lockDirection,i=void 0!==o&&o,s=n.axis,l=De(e,a?3:i||(void 0===s?void 0:s)?1:0);return this.filterTaps=a,l},swipeVelocity:function(e){return void 0===e&&(e=.5),De(e)},swipeDistance:function(e){return void 0===e&&(e=50),De(e)},swipeDuration:function(e){return void 0===e&&(e=250),e},delay:function(e){switch(void 0===e&&(e=0),e){case!0:return 180;case!1:return 0;default:return e}}});function He(e){var t,n=e.domTarget,r=e.eventOptions,a=e.window,o=e.enabled,i=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,["domTarget","eventOptions","window","enabled"]),s=(void 0===(t={domTarget:n,eventOptions:r,window:a,enabled:o})&&(t={}),Me(t,Ge));return s.drag=function(e){return void 0===e&&(e={}),Me(e,We)}(i),s}function ze(e){return Ce({_active:!1,_blocked:!1,_intentional:[!1,!1],_movement:[0,0],_initial:[0,0],_bounds:[[-1/0,1/0],[-1/0,1/0]],_threshold:[0,0],_lastEventType:void 0,_dragStarted:!1,_dragPreventScroll:!1,_dragIsTap:!0,_dragDelayed:!1,event:void 0,intentional:!1,values:[0,0],velocities:[0,0],delta:[0,0],movement:[0,0],offset:[0,0],lastOffset:[0,0],direction:[0,0],initial:[0,0],previous:[0,0],first:!1,last:!1,active:!1,timeStamp:0,startTime:0,elapsedTime:0,cancel:Le,canceled:!1,memo:void 0,args:void 0},e)}function Ye(){return{shared:{hovering:!1,scrolling:!1,wheeling:!1,dragging:!1,moving:!1,pinching:!1,touches:0,buttons:0,down:!1,shiftKey:!1,altKey:!1,metaKey:!1,ctrlKey:!1,locked:!1},drag:ze({_pointerId:void 0,axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0,tap:!1,swipe:[0,0]}),pinch:ze({_pointerIds:[],da:[0,0],vdva:[0,0],origin:void 0,turns:0}),wheel:ze({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0}),move:ze({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0}),scroll:ze({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0})}}var Xe=new Map,Je=function(e){return e},Ze=function(){function e(e,t){var n=this;void 0===t&&(t=[]),this.controller=e,this.args=t,this.debounced=!0,this.setTimeout=function(e,t){var r;void 0===t&&(t=140),clearTimeout(n.controller.timeouts[n.stateKey]);for(var a=arguments.length,o=new Array(a>2?a-2:0),i=2;i<a;i++)o[i-2]=arguments[i];n.controller.timeouts[n.stateKey]=(r=window).setTimeout.apply(r,[e,t].concat(o))},this.clearTimeout=function(){clearTimeout(n.controller.timeouts[n.stateKey])},this.fireGestureHandler=function(e){if(void 0===e&&(e=!1),n.state._blocked)return n.debounced||(n.state._active=!1,n.clean()),null;if(!e&&!n.state.intentional&&!n.config.triggerAllEvents)return null;if(n.state.intentional){var t=n.state.active,r=n.state._active;n.state.active=r,n.state.first=r&&!t,n.state.last=t&&!r,n.controller.state.shared[n.ingKey]=r}var a=n.controller.pointerIds.size||n.controller.touchIds.size,o=n.controller.state.shared.buttons>0||a>0,i=Ce({},n.controller.state.shared,n.state,n.mapStateValues(n.state),{locked:!!document.pointerLockElement,touches:a,down:o}),s=n.handler(i);return n.state.memo=void 0!==s?s:n.state.memo,i},this.controller=e,this.args=t}var t,n,r=e.prototype;return r.updateSharedState=function(e){Object.assign(this.controller.state.shared,e)},r.updateGestureState=function(e){Object.assign(this.state,e)},r.checkIntentionality=function(e,t){return{_intentional:e,_blocked:!1}},r.getMovement=function(e){var t=this.config.rubberband,n=this.state,r=n._bounds,a=n._initial,o=n._active,i=n._intentional,s=n.lastOffset,l=n.movement,c=n._threshold,u=this.getInternalMovement(e,this.state),p=!1===i[0]?et(u[0],c[0]):i[0],d=!1===i[1]?et(u[1],c[1]):i[1],g=this.checkIntentionality([p,d],u);if(g._blocked)return Ce({},g,{_movement:u,delta:[0,0]});var m=g._intentional,f=u,h=[!1!==m[0]?u[0]-m[0]:0,!1!==m[1]?u[1]-m[1]:0],v=Ee(h,s),y=o?t:[0,0];return h=tt(r,Ee(h,a),y),Ce({},g,{intentional:!1!==m[0]||!1!==m[1],_initial:a,_movement:f,movement:h,values:e,offset:tt(r,v,y),delta:be(h,l)})},r.clean=function(){this.clearTimeout()},t=e,(n=[{key:"config",get:function(){return this.controller.config[this.stateKey]}},{key:"enabled",get:function(){return this.controller.config.enabled&&this.config.enabled}},{key:"state",get:function(){return this.controller.state[this.stateKey]}},{key:"handler",get:function(){return this.controller.handlers[this.stateKey]}},{key:"transform",get:function(){return this.config.transform||this.controller.config.transform||Je}}])&&ke(t.prototype,n),e}();function et(e,t){return Math.abs(e)>=t&&Pe(e)*t}function tt(e,t,n){var r=t[0],a=t[1],o=n[0],i=n[1],s=e[0],l=s[0],c=s[1],u=e[1],p=u[0],d=u[1];return[Te(r,l,c,o),Te(a,p,d,i)]}function nt(e,t,n){var r=e.state,a=t.timeStamp,o=t.type,i=r.values;return{_lastEventType:o,event:t,timeStamp:a,elapsedTime:n?0:a-r.startTime,previous:i}}function rt(e,t,n,r){var a=e.state,o=e.config,i=e.stateKey,s=e.args,l=e.transform,c=a.offset,u=n.timeStamp,p=o.initial,d=o.bounds,g=be(l(o.threshold),l([0,0])).map(Math.abs),m=Ce({},Ye()[i],{_active:!0,args:s,values:t,initial:null!=r?r:t,_threshold:g,offset:c,lastOffset:c,startTime:u});return Ce({},m,{_initial:Fe(p,m),_bounds:Fe(d,m)})}var at=function(e){var t=this;this.classes=e,this.pointerIds=new Set,this.touchIds=new Set,this.supportsTouchEvents=$e(),this.supportsGestureEvents=function(){try{return"constructor"in GestureEvent}catch(e){return!1}}(),this.bind=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];for(var a,o={},i=Oe(t.classes);!(a=i()).done;){var s=a.value;new s(t,n).addBindings(o)}var l=function(e){gt(o,e,(function(r){return t.nativeRefs[e](Ce({},t.state.shared,{event:r,args:n}))}))};for(var c in t.nativeRefs)l(c);return t.config.domTarget?ct(t,o):ut(t,o)},this.effect=function(){return t.config.domTarget&&t.bind(),t.clean},this.clean=function(){var e=dt(t.config),n=t.config.eventOptions;e&&ft(e,pt(t.domListeners),n),Object.values(t.timeouts).forEach(clearTimeout),function(e){var t=e.config,n=t.window,r=t.eventOptions,a=e.windowListeners;if(n){for(var o in a)ft(n,a[o],r);e.windowListeners={}}}(t)},this.classes=e,this.state=Ye(),this.timeouts={},this.domListeners=[],this.windowListeners={}};function ot(e,t){"pointerId"in t?e.pointerIds.add(t.pointerId):e.touchIds=new Set(Qe(t))}function it(e,t){"pointerId"in t?e.pointerIds.delete(t.pointerId):Qe(t).forEach((function(t){return e.touchIds.delete(t)}))}function st(e,t,n){var r=e.config,a=e.windowListeners;void 0===n&&(n=r.eventOptions),r.window&&(ft(r.window,a[t],n),delete a[t])}function lt(e,t,n,r){var a=e.config,o=e.windowListeners;void 0===n&&(n=[]),void 0===r&&(r=a.eventOptions),a.window&&(ft(a.window,o[t],r),mt(a.window,o[t]=n,r))}function ct(e,t){var n=e.config,r=e.domListeners,a=dt(n);if(!a)throw new Error("domTarget must be defined");var o=n.eventOptions;ft(a,pt(r),o);for(var i=0,s=Object.entries(t);i<s.length;i++){var l=s[i],c=l[0],u=l[1],p=c.slice(2).toLowerCase();r.push([p,Re.apply(void 0,u)])}mt(a,r,o)}function ut(e,t){for(var n={},r=e.config.eventOptions.capture?"Capture":"",a=0,o=Object.entries(t);a<o.length;a++){var i=o[a],s=i[0],l=i[1],c=Array.isArray(l)?l:[l];n[s+r]=Re.apply(void 0,c)}return n}function pt(e){return void 0===e&&(e=[]),e.splice(0,e.length)}function dt(e){var t=e.domTarget;return t&&"current"in t?t.current:t}function gt(e,t,n){e[t]||(e[t]=[]),e[t].push(n)}function mt(e,t,n){void 0===t&&(t=[]),void 0===n&&(n={});for(var r,a=Oe(t);!(r=a()).done;){var o=r.value,i=o[0],s=o[1];e.addEventListener(i,s,n)}}function ft(e,t,n){void 0===t&&(t=[]),void 0===n&&(n={});for(var r,a=Oe(t);!(r=a()).done;){var o=r.value,i=o[0],s=o[1];e.removeEventListener(i,s,n)}}function ht(){}var vt=function(e){function t(){return e.apply(this,arguments)||this}xe(t,e);var n=t.prototype;return n.getInternalMovement=function(e,t){return be(e,t.initial)},n.checkIntentionality=function(e,t){if(!1===e[0]&&!1===e[1])return{_intentional:e,axis:this.state.axis};var n=t.map(Math.abs),r=n[0],a=n[1],o=this.state.axis||(r>a?"x":r<a?"y":void 0);return this.config.axis||this.config.lockDirection?o?this.config.axis&&o!==this.config.axis?{_intentional:e,_blocked:!0,axis:o}:(e["x"===o?1:0]=!1,{_intentional:e,_blocked:!1,axis:o}):{_intentional:[!1,!1],_blocked:!1,axis:o}:{_intentional:e,_blocked:!1,axis:o}},n.getKinematics=function(e,t){var n=this.getMovement(e);if(!n._blocked){var r=t.timeStamp-this.state.timeStamp;Object.assign(n,function(e,t,n){var r=Se(t),a=0===r?0:1/r,o=0===n?0:1/n,i=o*r,s=t.map((function(e){return o*e})),l=t.map((function(e){return a*e}));return{velocities:s,velocity:i,distance:Se(e),direction:l}}(n.movement,n.delta,r))}return n},n.mapStateValues=function(e){return{xy:e.values,vxvy:e.velocities}},t}(Ze);function yt(e){"persist"in e&&"function"==typeof e.persist&&e.persist()}var _t=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).ingKey="dragging",t.stateKey="drag",t.setPointerCapture=function(e){if(!t.config.useTouch&&!document.pointerLockElement){var n=e.target,r=e.pointerId;n&&"setPointerCapture"in n&&n.setPointerCapture(r),t.updateGestureState({_dragTarget:n,_dragPointerId:r})}},t.releasePointerCapture=function(){if(!t.config.useTouch&&!document.pointerLockElement){var e=t.state,n=e._dragTarget,r=e._dragPointerId;if(r&&n&&"releasePointerCapture"in n&&(!("hasPointerCapture"in n)||n.hasPointerCapture(r)))try{n.releasePointerCapture(r)}catch(e){}}},t.preventScroll=function(e){t.state._dragPreventScroll&&e.cancelable&&e.preventDefault()},t.getEventId=function(e){return t.config.useTouch?e.changedTouches[0].identifier:e.pointerId},t.isValidEvent=function(e){return t.state._pointerId===t.getEventId(e)},t.shouldPreventWindowScrollY=t.config.experimental_preventWindowScrollY&&t.controller.supportsTouchEvents,t.setUpWindowScrollDetection=function(e){yt(e),lt(t.controller,t.stateKey,[["touchmove",t.preventScroll],["touchend",t.clean.bind(Ae(t))],["touchcancel",t.clean.bind(Ae(t))]],{passive:!1}),t.setTimeout(t.startDrag.bind(Ae(t)),250,e)},t.setUpDelayedDragTrigger=function(e){t.state._dragDelayed=!0,yt(e),t.setTimeout(t.startDrag.bind(Ae(t)),t.config.delay,e)},t.setStartState=function(e){var n=Ue(e,t.transform);t.updateSharedState(je(e)),t.updateGestureState(Ce({},rt(Ae(t),n,e),nt(Ae(t),e,!0),{_pointerId:t.getEventId(e)})),t.updateGestureState(t.getMovement(n))},t.onDragStart=function(e){ot(t.controller,e),t.enabled&&!t.state._active&&(t.setStartState(e),t.setPointerCapture(e),t.shouldPreventWindowScrollY?t.setUpWindowScrollDetection(e):t.config.delay>0?t.setUpDelayedDragTrigger(e):t.startDrag(e,!0))},t.onDragChange=function(e){if(!t.state.canceled&&t.state._active&&t.isValidEvent(e)&&(t.state._lastEventType!==e.type||e.timeStamp!==t.state.timeStamp)){var n;if(document.pointerLockElement){var r=e.movementX,a=e.movementY;n=Ee(t.transform([r,a]),t.state.values)}else n=Ue(e,t.transform);var o=t.getKinematics(n,e);if(!t.state._dragStarted){if(t.state._dragDelayed)return void t.startDrag(e);if(!t.shouldPreventWindowScrollY)return;if(t.state._dragPreventScroll||!o.axis)return;if("x"!==o.axis)return void(t.state._active=!1);t.startDrag(e)}var i=je(e);t.updateSharedState(i);var s=nt(Ae(t),e),l=Se(o._movement),c=t.state._dragIsTap;c&&l>=3&&(c=!1),t.updateGestureState(Ce({},s,o,{_dragIsTap:c})),t.fireGestureHandler()}},t.onDragEnd=function(e){if(it(t.controller,e),t.isValidEvent(e)&&(t.clean(),t.state._active)){t.state._active=!1;var n=t.state._dragIsTap,r=t.state.velocities,a=r[0],o=r[1],i=t.state.movement,s=i[0],l=i[1],c=t.state._intentional,u=c[0],p=c[1],d=t.config.swipeVelocity,g=d[0],m=d[1],f=t.config.swipeDistance,h=f[0],v=f[1],y=t.config.swipeDuration,_=Ce({},nt(Ae(t),e),t.getMovement(t.state.values)),w=[0,0];_.elapsedTime<y&&(!1!==u&&Math.abs(a)>g&&Math.abs(s)>h&&(w[0]=Pe(a)),!1!==p&&Math.abs(o)>m&&Math.abs(l)>v&&(w[1]=Pe(o))),t.updateSharedState({buttons:0}),t.updateGestureState(Ce({},_,{tap:n,swipe:w})),t.fireGestureHandler(t.config.filterTaps&&!0===n)}},t.clean=function(){e.prototype.clean.call(Ae(t)),t.state._dragStarted=!1,t.releasePointerCapture(),st(t.controller,t.stateKey)},t.onCancel=function(){t.state.canceled||(t.updateGestureState({canceled:!0,_active:!1}),t.updateSharedState({buttons:0}),setTimeout((function(){return t.fireGestureHandler()}),0))},t.onClick=function(e){t.state._dragIsTap||e.stopPropagation()},t}xe(t,e);var n=t.prototype;return n.startDrag=function(e,t){void 0===t&&(t=!1),this.state._active&&!this.state._dragStarted&&(t||this.setStartState(e),this.updateGestureState({_dragStarted:!0,_dragPreventScroll:!0,cancel:this.onCancel}),this.clearTimeout(),this.fireGestureHandler())},n.addBindings=function(e){this.config.useTouch?(gt(e,"onTouchStart",this.onDragStart),gt(e,"onTouchMove",this.onDragChange),gt(e,"onTouchEnd",this.onDragEnd),gt(e,"onTouchCancel",this.onDragEnd)):(gt(e,"onPointerDown",this.onDragStart),gt(e,"onPointerMove",this.onDragChange),gt(e,"onPointerUp",this.onDragEnd),gt(e,"onPointerCancel",this.onDragEnd)),this.config.filterTaps&&gt(e,this.controller.config.eventOptions.capture?"onClick":"onClickCapture",this.onClick)},t}(vt);function wt(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){if(e.constructor!==t.constructor)return!1;var n,r,a,o;if(Array.isArray(e)){if((n=e.length)!==t.length)return!1;for(r=n;0!=r--;)if(!wt(e[r],t[r]))return!1;return!0}if("function"==typeof Map&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(o=e.entries();!(r=o.next()).done;)if(!t.has(r.value[0]))return!1;for(o=e.entries();!(r=o.next()).done;)if(!wt(r.value[1],t.get(r.value[0])))return!1;return!0}if("function"==typeof Set&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(o=e.entries();!(r=o.next()).done;)if(!t.has(r.value[0]))return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if((n=(a=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!Object.prototype.hasOwnProperty.call(t,a[r]))return!1;if("undefined"!=typeof Element&&e instanceof Element)return!1;for(r=n;0!=r--;)if(!("_owner"===a[r]&&e.$$typeof||wt(e[a[r]],t[a[r]])))return!1;return!0}return e!=e&&t!=t}function Et(e,t){try{return wt(e,t)}catch(e){if((e.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw e}}var bt=window.wp.keycodes,St=function(e){let{label:t,className:n,onDragChange:r,onDragEnd:o,direction:i="left",...s}=e;const l=function(e,t){void 0===t&&(t={}),Xe.set("drag",_t);var n=(0,_e.useRef)();return n.current||(n.current=function(e,t){var n,r,a=[],o=!1;return function(){for(var i=arguments.length,s=new Array(i),l=0;l<i;l++)s[l]=arguments[l];return o&&n===this&&t(s,a)||(r=e.apply(this,s),o=!0,n=this,a=s),r}}(He,Et)),function(e,t,n){void 0===n&&(n={});var r=function(e){var t=new Set;return e.drag&&t.add(Xe.get("drag")),e.wheel&&t.add(Xe.get("wheel")),e.scroll&&t.add(Xe.get("scroll")),e.move&&t.add(Xe.get("move")),e.pinch&&t.add(Xe.get("pinch")),e.hover&&t.add(Xe.get("hover")),t}(e),a=we().useMemo((function(){return new at(r)}),[]);return a.config=t,a.handlers=e,a.nativeRefs=n,we().useEffect(a.effect,[]),a.config.domTarget?ht:a.bind}({drag:e=>{let{delta:t,dragging:n}=e;const a="left"===i?-2:2;n?r(t[0]*a):o()}},n.current(t))}();return(0,a.createElement)("div",{className:`pattern-preview__drag-handle ${n}`},(0,a.createElement)("button",p({className:"pattern-preview__drag-handle-button","aria-label":t},s,{onKeyDown:e=>{const{keyCode:t}=e;"left"===i&&t===bt.LEFT||"right"===i&&t===bt.RIGHT?r(20):("left"===i&&t===bt.RIGHT||"right"===i&&t===bt.LEFT)&&r(-20)},onKeyUp:o},l())))},Pt=function e(t){let{blockContent:n}=t;const r=(0,me.useViewportMatch)("mobile",">="),i=(0,me.useViewportMatch)("large",">="),s=(0,me.useViewportMatch)("wide",">="),l=(0,me.useInstanceId)(e),[c,u]=(0,a.useState)(window.innerWidth<960?window.innerWidth:960),p=(0,a.useCallback)((e=>u((t=>t+e))),[u]),d=()=>{c<280&&u(280)},g=(0,a.useMemo)((()=>r?s?[{label:(0,o.__)("Full (1200px)","wporg-patterns"),value:1200},{label:(0,o.__)("Default (960px)","wporg-patterns"),value:960},{label:(0,o.__)("Medium (480px)","wporg-patterns"),value:480},{label:(0,o.__)("Narrow (320px)","wporg-patterns"),value:320}]:i?[{label:(0,o.__)("Default (960px)","wporg-patterns"),value:960},{label:(0,o.__)("Medium (480px)","wporg-patterns"),value:480},{label:(0,o.__)("Narrow (320px)","wporg-patterns"),value:320}]:[{label:(0,o.__)("Medium (480px)","wporg-patterns"),value:480},{label:(0,o.__)("Narrow (320px)","wporg-patterns"),value:320}]:[]),[r,i,s]);let m=!1;if(!g.some((e=>e.value===c))){const e=Math.max(Math.floor(c),280);m={
     1!function(){var e={472:function(e,t){var n;!function(){"use strict";var r={}.hasOwnProperty;function a(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var o=typeof n;if("string"===o||"number"===o)e.push(n);else if(Array.isArray(n)){if(n.length){var i=a.apply(null,n);i&&e.push(i)}}else if("object"===o)if(n.toString===Object.prototype.toString)for(var s in n)r.call(n,s)&&n[s]&&e.push(s);else e.push(n.toString())}}return e.join(" ")}e.exports?(a.default=a,e.exports=a):void 0===(n=function(){return a}.apply(t,[]))||(e.exports=n)}()}},t={};function n(r){var a=t[r];if(void 0!==a)return a.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},function(){"use strict";var e={};n.r(e),n.d(e,{addFavorite:function(){return F},fetchCategories:function(){return I},fetchPatternFlagReasons:function(){return L},fetchPatterns:function(){return T},loadCategories:function(){return O},loadFavorites:function(){return D},loadPattern:function(){return k},loadPatternFlagReasons:function(){return R},loadPatterns:function(){return C},removeFavorite:function(){return M},setCurrentQuery:function(){return A},setErrorPatterns:function(){return x}});var t={};n.r(t),n.d(t,{getCategories:function(){return V},getFavorites:function(){return z},getPattern:function(){return K},getPatternFlagReasons:function(){return G},getPatternsByQuery:function(){return U}});var r={};n.r(r),n.d(r,{getCategories:function(){return re},getCategoryById:function(){return oe},getCategoryBySlug:function(){return ae},getCurrentQuery:function(){return ee},getFavorites:function(){return le},getPattern:function(){return Z},getPatternFlagReasons:function(){return ie},getPatternTotalPagesByQuery:function(){return J},getPatternTotalsByQuery:function(){return X},getPatterns:function(){return H},getPatternsByQuery:function(){return Y},getQueryFromUrl:function(){return ue},getUrlFromQuery:function(){return pe},hasLoadedCategories:function(){return ne},isFavorite:function(){return ce},isLoadingCategories:function(){return te},isLoadingPatternFlagReasons:function(){return se},isLoadingPatternsByQuery:function(){return W}});var a=window.wp.element,o=window.wp.i18n,i=window.wp.htmlEntities,s=window.wp.data,l=e=>{let{name:t,url:n,avatar:r}=e;return(0,a.createElement)("a",{href:n,className:"pattern__author-avatar"},(0,a.createElement)("img",{alt:"",src:r}),t)};const c=e=>{let{className:t="",style:n,children:r}=e;return(0,a.createElement)("span",{className:`${t} pattern-skeleton__container`,style:n},r)},u=e=>(0,a.createElement)("span",{className:"pattern-skeleton",style:e});function p(){return p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},p.apply(this,arguments)}var d=window.wp.primitives;function g(e){return(0,a.createElement)(d.SVG,p({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24"},e),(0,a.createElement)(d.Path,{d:"M11.941 21.175l-1.443-1.32c-5.124-4.67-8.508-7.75-8.508-11.53 0-3.08 2.408-5.5 5.473-5.5 1.732 0 3.394.81 4.478 2.09 1.085-1.28 2.747-2.09 4.478-2.09 3.065 0 5.473 2.42 5.473 5.5 0 3.78-3.383 6.86-8.508 11.54l-1.443 1.31z"}))}function m(e){return.6666666666666666*e}const f=()=>{const[e,t]=(0,a.useState)(),n=(0,a.useRef)();return(0,a.useEffect)((()=>{n.current&&t(`${m(n.current.clientWidth)}px`)}),[n]),(0,a.createElement)("div",{ref:n},(0,a.createElement)(c,null,(0,a.createElement)(u,{height:e}),(0,a.createElement)(u,{height:"14px",marginTop:"1rem"}),(0,a.createElement)(c,{style:{flexDirection:"row",marginTop:"0.5rem",alignItems:"center"}},(0,a.createElement)(u,{height:"18px",width:"18px",marginRight:"0.5rem",borderRadius:"32px"}),(0,a.createElement)(u,{height:"12px",width:"100px",marginRight:"0.75rem"}),(0,a.createElement)(g,{width:"16px",height:"16px",fill:"#787c82",className:"pattern-favorite-button__filled"}),(0,a.createElement)(u,{height:"12px",width:"32px",marginLeft:"0.5rem"}))))};var h=e=>{let{length:t=6}=e;return Array(t).fill().map(((e,t)=>(0,a.createElement)(f,{key:t})))},v=window.wp.url;const y=e=>e.split("?")[0],_=(e,t)=>{if(!t||!e)return"";const n=(0,v.getQueryArgs)(e);if(n[t])return n[t];const r=(o=y(e).replace(/\/$/,""),o.replace(/^\//,"")).split("/"),a=r.indexOf(t);var o;return-1===a?"":r[a+1]||""},w=e=>Number(_(e,"page")||1),E=(0,a.createContext)();function b(e){let{children:t}=e;const[n,r]=(0,a.useState)((0,v.getPathAndQueryString)(window.location.href)),o=e=>{window.history.pushState("","",e),r(e)},i=()=>{r(document.location.href)};return(0,a.useEffect)((()=>(window.addEventListener("popstate",i),()=>{window.removeEventListener("popstate",i)})),[]),(0,a.createElement)(E.Provider,{value:{path:n,update:e=>{const t=(e=>(e=>{const t={};return Object.keys(e).forEach((n=>{const r=e[n];null!=r&&r.toString().length>0&&(t[n]=r)})),t})({...(0,v.getQueryArgs)(n),...(0,v.getQueryArgs)(e)}))(e),r=y(e),a=(0,v.addQueryArgs)(r,t);o(a)},replace:o}},t)}function S(){const e=(0,a.useContext)(E);if(void 0===e)throw new Error("useRoute must be used within a Provider");return e}function P(e){let{currentPage:t=1,onNavigation:n,totalPages:r}=e;const{path:i,update:s}=S();if(!r||r<=1)return null;const l=t>1,c=t<r,u=(0,v.getQueryString)(i)?"?"+(0,v.getQueryString)(i):"",p=i.replace(u,"").replace(/page\/\d+\/?/,""),d=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const n=Array.from({length:e},((e,t)=>t+1)),r=[];return e<=5?n:(r.push(...n.slice(0,2)),t>=2&&t<=e-1&&r.push(...n.slice(t-2,t+1)),r.push(...n.slice(-2)),r.filter(((e,t,n)=>n.indexOf(e)===t)).reduce(((e,t,n,r)=>{if(0===n)return e.push(t),e;const a=Math.abs(r[n]-r[n-1]);return 0===a||(a>1&&e.push("…"),e.push(t)),e}),[]))}(r,t),g=`${p}page/%s/${u}`,m=e=>1===e?`${p}${u}`:(0,o.sprintf)(g,e),f=(e,t)=>{e.preventDefault(),s(m(t)),"function"==typeof n&&n()};return(0,a.createElement)("nav",{className:"pagination","aria-label":(0,o.__)("Pagination","wporg-patterns")},(0,a.createElement)("ul",{className:"pagination__list"},(0,a.createElement)("li",{className:"pagination__item pagination__item-previous-page"},l&&(0,a.createElement)("a",{className:"pagination__link",href:m(t-1),onClick:e=>f(e,t-1)},(0,a.createElement)("span",{className:"screen-reader-text"},(0,o.__)("Previous page","wporg-patterns")),(0,a.createElement)("span",{"aria-hidden":!0},(0,o._x)("Previous","previous page link label","wporg-patterns")))),d.map(((e,n)=>"…"===e?(0,a.createElement)("li",{className:"pagination__item",key:`${n}-${e}`},e):(0,a.createElement)("li",{className:"pagination__item",key:e},(0,a.createElement)("a",{className:"pagination__link",href:m(e),"aria-current":e===t?"page":void 0,onClick:t=>f(t,e)},(0,a.createElement)("span",{className:"screen-reader-text"},(0,o.sprintf)(// translators: %s is the page number.
     2(0,o.__)("Page %s","wporg-patterns"),e)),(0,a.createElement)("span",{"aria-hidden":!0},e))))),(0,a.createElement)("li",{className:"pagination__item pagination__item-next-page"},c&&(0,a.createElement)("a",{className:"pagination__link",href:m(t+1),onClick:e=>f(e,t+1)},(0,a.createElement)("span",{className:"screen-reader-text"},(0,o.__)("Next page","wporg-patterns")),(0,a.createElement)("span",{"aria-hidden":!0},(0,o._x)("Next","next page link label","wporg-patterns"))))))}var N=window.wp.dataControls;function T(e){return{type:"FETCH_BLOCK_PATTERNS",query:e}}function k(e,t){return{type:"LOAD_BLOCK_PATTERN",postId:e,pattern:t}}function C(e,t){let{page:n,patterns:r,total:a,totalPages:o}=t;return{type:"LOAD_BLOCK_PATTERNS",query:e,page:n,patterns:r,total:a,totalPages:o}}function x(e,t){let{page:n,error:r}=t;return{type:"ERROR_BLOCK_PATTERNS",query:e,page:n,error:r}}function A(e){return{type:"SET_CURRENT_QUERY",query:e}}function I(){return{type:"FETCH_CATEGORIES"}}function O(e){return{type:"LOAD_CATEGORIES",categories:e}}function L(){return{type:"FETCH_PATTERN_FLAG_REASONS"}}function R(e){return{type:"LOAD_PATTERN_FLAG_REASONS",reasons:e}}function D(e){return{type:"LOAD_FAVORITES",patternIds:e}}function*F(e){const t=yield(0,N.apiFetch)({path:"/wporg/v1/pattern-favorites",method:"POST",data:{id:e}});if("number"==typeof t)return{type:"ADD_FAVORITE",patternId:e,count:t}}function*M(e){const t=yield(0,N.apiFetch)({path:"/wporg/v1/pattern-favorites",method:"DELETE",data:{id:e}});if("number"==typeof t)return{type:"REMOVE_FAVORITE",patternId:e,count:t}}function $(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=Object.keys(e).sort();let n="";for(let r=0;r<t.length;r++){const a=t[r];let o=e[a];switch(Array.isArray(o)&&(o=e[a].join()),a){case"page":case"per_page":case"_fields":break;default:n+=(n?"&":"")+(0,v.addQueryArgs)("",{[a]:o}).slice(1)}}return n}function B(){return{id:-1,slug:"",name:(0,o.__)("All","wporg-patterns"),link:wporgPatternsUrl.site}}function Q(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"LOAD_BLOCK_PATTERNS":{const n=(t.patterns||[]).reduce(((e,t)=>({...e,[t.id]:t})),{});return{...e,...n}}case"LOAD_BLOCK_PATTERN":return{...e,[t.postId]:t.pattern};case"ADD_FAVORITE":case"REMOVE_FAVORITE":{const n={...e[t.patternId],favorite_count:t.count};return{...e,[t.patternId]:n}}default:return e}}function j(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;const n=(t.patterns||[]).map((e=>{let{id:t}=e;return t})),{page:r,total:a,totalPages:o}=t;switch(t.type){case"LOAD_BLOCK_PATTERNS":{const i={...e[t.query]||{},total:a,totalPages:o};return i[r]=n,{...e,[t.query]:i}}case"ERROR_BLOCK_PATTERNS":{const n=e[t.query]||{};return n[r]=[],{...e,[t.query]:n}}default:return e}}var q=(0,s.combineReducers)({patterns:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return{byId:Q(e.byId,t),queries:j(e.queries,t)}},categories:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"FETCH_CATEGORIES":return null;case"LOAD_CATEGORIES":const e=(t.categories||[]).sort(((e,t)=>e.name.localeCompare(t.name)));return[B(),...e]}return e},currentQuery:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,t=arguments.length>1?arguments[1]:void 0;return"SET_CURRENT_QUERY"===t.type?t.query:e},patternFlagReasons:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"FETCH_PATTERN_FLAG_REASONS":return null;case"LOAD_PATTERN_FLAG_REASONS":return[...t.reasons];default:return e}},favorites:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0;const{patternId:n}=t;switch(t.type){case"LOAD_FAVORITES":return t.patternIds;case"ADD_FAVORITE":return e.includes(n)?e:[...e,n];case"REMOVE_FAVORITE":return e.filter((e=>e!==n))}return e}});function*U(e){const t=$(e);try{yield T(t);const n=yield(0,N.apiFetch)({path:(0,v.addQueryArgs)("/wp/v2/wporg-pattern",{...e,locale:wporgLocale.id}),parse:!1}),{total:r,totalPages:a,results:o}=yield(0,N.__unstableAwaitPromise)(async function(e){try{var t,n;return{total:Number((null===(t=e.headers)||void 0===t?void 0:t.get("X-WP-Total"))||0),totalPages:Number((null===(n=e.headers)||void 0===n?void 0:n.get("X-WP-TotalPages"))||0),results:await e.json()}}catch(e){return{}}}(n));yield C(t,{page:e.page||1,patterns:o,total:r,totalPages:a})}catch(n){const r=yield(0,N.__unstableAwaitPromise)(async function(e){try{return await e.json()}catch(e){return{}}}(n));yield x(t,{page:e.page||1,error:r})}}function*K(e){try{const t=yield(0,N.apiFetch)({path:(0,v.addQueryArgs)(`/wp/v2/wporg-pattern/${e}`)});yield k(e,t)}catch(e){}}function*V(){try{yield{type:"FETCH_CATEGORIES"};const e=yield(0,N.apiFetch)({path:(0,v.addQueryArgs)("/wp/v2/pattern-categories")});yield O(e)}catch(e){}}function*G(){try{yield{type:"FETCH_PATTERN_FLAG_REASONS"};const e=yield(0,N.apiFetch)({path:(0,v.addQueryArgs)("/wp/v2/wporg-pattern-flag-reason")});yield R(e)}catch(e){}}function*z(){try{const e=yield(0,N.apiFetch)({path:"/wporg/v1/pattern-favorites"});yield D(e)}catch(e){}}function W(e,t){var n,r;const a=$(t),o=(null==t?void 0:t.page)||1;return!Array.isArray(null===(n=e.patterns.queries)||void 0===n||null===(r=n[a])||void 0===r?void 0:r[o])}function H(e){return Object.values(e.patterns.byId)}function Y(e,t){var n,r;const a=$(t),o=(null==t?void 0:t.page)||1;return((null===(n=e.patterns.queries)||void 0===n||null===(r=n[a])||void 0===r?void 0:r[o])||[]).map((t=>e.patterns.byId[t]))}function X(e,t){var n,r;const a=$(t);return(null===(n=e.patterns.queries)||void 0===n||null===(r=n[a])||void 0===r?void 0:r.total)||0}function J(e,t){var n,r;const a=$(t);return(null===(n=e.patterns.queries)||void 0===n||null===(r=n[a])||void 0===r?void 0:r.totalPages)||0}function Z(e,t){return e.patterns.byId[t]||null}function ee(e){return e.currentQuery}function te(e){return null===e.categories}function ne(e){return Array.isArray(e.categories)}function re(e){return e.categories}function ae(e,t){if(!ne(e))return;const[n]=e.categories.filter((e=>e.slug===t));return n}function oe(e,t){if(ne(e))return e.categories.find((e=>{let{id:n}=e;return t===n}))}function ie(e){return e.patternFlagReasons}function se(e){return null===e.patternFlagReasons}function le(e){return e.favorites}function ce(e,t){var n;return null===(n=e.favorites)||void 0===n?void 0:n.includes(t)}function ue(e,t){const n=["categories","author","page","search"],r=(0,v.getQueryArgs)(t),a=_(t,"categories");if(a&&-1===n.indexOf(a)){const t=ae(e,a);null!=t&&t.id&&(r["pattern-categories"]=t.id)}const o=_(t,"author");o&&-1===n.indexOf(o)&&(r.author_name=o);const i=w(t);"number"==typeof i&&i>1&&(r.page=i);const s=decodeURI(_(t,"search"));s.length>0&&-1===n.indexOf(s)&&(r.search=s);const l=_(t,"my-patterns");return l&&"page"!==l&&(r.status=l),r}function pe(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:wporgPatternsUrl.site;if(n=n.replace(/\/$/,""),t.author_name&&(n+=`/author/${t.author_name}`,delete t.author_name),t["pattern-categories"]){const r=t["pattern-categories"],a=re(e).find((e=>{let{id:t}=e;return r===t}));null!=a&&a.slug&&(n+=`/categories/${a.slug}`),delete t["pattern-categories"]}return t.page&&(n+=`/page/${t.page}`,delete t.page),Object.keys(t).length?(n+="/?"+(0,v.buildQueryString)(t),n):n+"/"}const de=(0,s.createReduxStore)("wporg/pattern-directory",{reducer:q,selectors:r,actions:e,controls:N.controls,resolvers:t});(0,s.register)(de);var ge=function(e){let{header:t,children:n,onNavigation:r,query:o,showPagination:i=!0}=e;const{isLoading:l,posts:c,totalPages:u}=(0,s.useSelect)((e=>{const{getPatternTotalPagesByQuery:t,getPatternsByQuery:n,isLoadingPatternsByQuery:r}=e(de);return{isLoading:o&&r(o),posts:o?n(o):[],totalPages:o?t(o):0}}));return(0,a.createElement)(a.Fragment,null,c.length?t:null,(0,a.createElement)("div",{className:"pattern-grid"},l?(0,a.createElement)(h,{length:null==o?void 0:o.per_page}):c.map(n)),i&&(0,a.createElement)(P,{totalPages:u,currentPage:null==o?void 0:o.page,onNavigation:r}))},me=window.wp.compose,fe=window.wp.components;var he=(0,a.forwardRef)((function(e,t){let{contentRef:n,children:r,head:i,headHTML:s,bodyStyle:l="",themeSlug:c="twentytwentyone",...u}=e;const[d,g]=(0,a.useState)();s+=`<link rel="stylesheet" href="https://wp-themes.com/wp-content/themes/${c}/style.css" media="all" />`,s+=`<style>\n    body {\n        display: flex;\n        min-height: 100vh;\n        align-items: center;\n        justify-content: center;\n        background-color: white;\n        /* Override the Twenty Twenty-One sizes with our custom sizes. */\n        --responsive--aligndefault-width: 800px;\n        --responsive--alignwide-width: 1000px;\n    }\n    .pattern-wrapper {\n        padding: 0;\n        ${l}\n    }\n    body > div {\n        width: 100%;\n        max-height: 100%;\n        pointer-events: none;\n    }\n    </style>`;const m=(0,a.useCallback)((e=>{function t(){const{contentDocument:t}=e,{readyState:r,body:a}=t;return("interactive"===r||"complete"===r)&&("function"==typeof n?n(a):n&&(n.current=a),function(e,t){e.head.innerHTML="<style>body{margin:0}</style>"+t}(t,s),function(e){const{defaultView:t}=e,{frameElement:n}=t;function r(e){const r=Object.getPrototypeOf(e).constructor.name,a=window[r],o={};for(const t in e)o[t]=e[t];if(e instanceof t.MouseEvent){const e=n.getBoundingClientRect();o.clientX+=e.left,o.clientY+=e.top}const i=new a(e.type,o);!n.dispatchEvent(i)&&e.preventDefault()}const a=["keydown","keypress","dragover"];for(const t of a)e.addEventListener(t,r)}(t),function(e){e.dir=document.dir,e.body.className="pattern-wrapper";for(const t of document.body.classList)t.startsWith("admin-color-")&&e.body.classList.add(t)}(t),g(t),!0)}e&&(t()||e.addEventListener("load",(()=>{t()})))}),[]);return(0,a.createElement)("iframe",p({title:(0,o.__)("Pattern Preview","wporg-patterns"),tabIndex:"-1"},u,{ref:(0,me.useMergeRefs)([t,m])}),d&&(0,a.createPortal)(r,d.body),d&&(0,a.createPortal)(i,d.head))})),ve=function(e){let{html:t}=e;return(0,a.createElement)("div",null,(0,a.createElement)(he,{className:"pattern-preview__viewport-iframe",style:{width:"100%",height:"50vh",minHeight:"600px",overflowY:"auto"},headHTML:window.__editorStyles.html},(0,a.createElement)("div",{className:"entry-content",dangerouslySetInnerHTML:{__html:t}})))},ye=window.React,_e=n.n(ye);function we(e,t){return e.map((function(e,n){return e+t[n]}))}function Ee(e,t){return e.map((function(e,n){return e-t[n]}))}function be(e){return Math.hypot.apply(Math,e)}function Se(e){return Math.sign?Math.sign(e):Number(e>0)-Number(e<0)||+e}function Pe(e,t,n){return 0===t||Math.abs(t)===1/0?function(e,t){return Math.pow(e,5*t)}(e,n):e*t*n/(t+n*e)}function Ne(e,t,n,r){return void 0===r&&(r=.15),0===r?function(e,t,n){return Math.max(t,Math.min(e,n))}(e,t,n):e<t?-Pe(t-e,n-t,r)+t:e>n?+Pe(e-n,n-t,r)+n:e}function Te(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ke(){return ke=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ke.apply(this,arguments)}function Ce(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function xe(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ae(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ie(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return Ae(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ae(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}function Oe(){}function Le(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?Oe:1===t.length?t[0]:function(){for(var e,n,r=Ie(t);!(n=r()).done;){var a=n.value;e=a.apply(this,arguments)||e}return e}}function Re(e,t){if(void 0===e){if(void 0===t)throw new Error("Must define fallback value if undefined is expected");e=t}return Array.isArray(e)?e:[e,e]}function De(e){if("function"==typeof e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return e.apply(void 0,n)}return e}function Fe(e,t){void 0===e&&(e={});for(var n={},r=0,a=Object.entries(t);r<a.length;r++){var o=a[r],i=o[0],s=o[1];switch(typeof s){case"function":n[i]=s.call(n,e[i],i,e);break;case"object":n[i]=Fe(e[i],s);break;case"boolean":s&&(n[i]=e[i])}}return n}function Me(){return"undefined"!=typeof window&&"ontouchstart"in window}function $e(e){return"pointerId"in e?null:"touchend"===e.type?e.changedTouches:e.targetTouches}function Be(e){return Array.from($e(e)).map((function(e){return e.identifier}))}function Qe(e){return{buttons:"buttons"in e?e.buttons:0,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey}}var je=function(e){return e};function qe(e,t){void 0===t&&(t=je);var n=$e(e),r=n?n[0]:e;return t([r.clientX,r.clientY])}var Ue=ke({},{threshold:function(e){return void 0===e&&(e=0),Re(e)},rubberband:function(e){switch(void 0===e&&(e=0),e){case!0:return Re(.15);case!1:return Re(0);default:return Re(e)}},enabled:function(e){return void 0===e&&(e=!0),e},triggerAllEvents:function(e){return void 0===e&&(e=!1),e},initial:function(e){return void 0===e&&(e=0),"function"==typeof e?e:Re(e)},transform:!0},{axis:!0,lockDirection:function(e){return void 0===e&&(e=!1),e},bounds:function(e){if(void 0===e&&(e={}),"function"==typeof e)return function(t){return Ue.bounds(e(t))};var t=e,n=t.left,r=void 0===n?-1/0:n,a=t.right,o=void 0===a?1/0:a,i=t.top,s=void 0===i?-1/0:i,l=t.bottom;return[[r,o],[s,void 0===l?1/0:l]]}}),Ke="undefined"!=typeof window&&window.document&&window.document.createElement,Ve={enabled:function(e){return void 0===e&&(e=!0),e},domTarget:!0,window:function(e){function t(_x){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(e){return void 0===e&&(e=Ke?window:void 0),e})),eventOptions:function(e){var t=void 0===e?{}:e,n=t.passive,r=void 0===n||n,a=t.capture;return{passive:r,capture:void 0!==a&&a}},transform:!0},Ge=ke({},Ue,{useTouch:function(e){void 0===e&&(e=!1);var t=Me(),n="undefined"!=typeof window&&"onpointerdown"in window;return!(!e||!t)||!(!t||n)},experimental_preventWindowScrollY:function(e){return void 0===e&&(e=!1),e},threshold:function(e,t,n){var r=n.filterTaps,a=void 0!==r&&r,o=n.lockDirection,i=void 0!==o&&o,s=n.axis,l=Re(e,a?3:i||(void 0===s?void 0:s)?1:0);return this.filterTaps=a,l},swipeVelocity:function(e){return void 0===e&&(e=.5),Re(e)},swipeDistance:function(e){return void 0===e&&(e=50),Re(e)},swipeDuration:function(e){return void 0===e&&(e=250),e},delay:function(e){switch(void 0===e&&(e=0),e){case!0:return 180;case!1:return 0;default:return e}}});function ze(e){var t,n=e.domTarget,r=e.eventOptions,a=e.window,o=e.enabled,i=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,["domTarget","eventOptions","window","enabled"]),s=(void 0===(t={domTarget:n,eventOptions:r,window:a,enabled:o})&&(t={}),Fe(t,Ve));return s.drag=function(e){return void 0===e&&(e={}),Fe(e,Ge)}(i),s}function We(e){return ke({_active:!1,_blocked:!1,_intentional:[!1,!1],_movement:[0,0],_initial:[0,0],_bounds:[[-1/0,1/0],[-1/0,1/0]],_threshold:[0,0],_lastEventType:void 0,_dragStarted:!1,_dragPreventScroll:!1,_dragIsTap:!0,_dragDelayed:!1,event:void 0,intentional:!1,values:[0,0],velocities:[0,0],delta:[0,0],movement:[0,0],offset:[0,0],lastOffset:[0,0],direction:[0,0],initial:[0,0],previous:[0,0],first:!1,last:!1,active:!1,timeStamp:0,startTime:0,elapsedTime:0,cancel:Oe,canceled:!1,memo:void 0,args:void 0},e)}function He(){return{shared:{hovering:!1,scrolling:!1,wheeling:!1,dragging:!1,moving:!1,pinching:!1,touches:0,buttons:0,down:!1,shiftKey:!1,altKey:!1,metaKey:!1,ctrlKey:!1,locked:!1},drag:We({_pointerId:void 0,axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0,tap:!1,swipe:[0,0]}),pinch:We({_pointerIds:[],da:[0,0],vdva:[0,0],origin:void 0,turns:0}),wheel:We({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0}),move:We({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0}),scroll:We({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0})}}var Ye=new Map,Xe=function(e){return e},Je=function(){function e(e,t){var n=this;void 0===t&&(t=[]),this.controller=e,this.args=t,this.debounced=!0,this.setTimeout=function(e,t){var r;void 0===t&&(t=140),clearTimeout(n.controller.timeouts[n.stateKey]);for(var a=arguments.length,o=new Array(a>2?a-2:0),i=2;i<a;i++)o[i-2]=arguments[i];n.controller.timeouts[n.stateKey]=(r=window).setTimeout.apply(r,[e,t].concat(o))},this.clearTimeout=function(){clearTimeout(n.controller.timeouts[n.stateKey])},this.fireGestureHandler=function(e){if(void 0===e&&(e=!1),n.state._blocked)return n.debounced||(n.state._active=!1,n.clean()),null;if(!e&&!n.state.intentional&&!n.config.triggerAllEvents)return null;if(n.state.intentional){var t=n.state.active,r=n.state._active;n.state.active=r,n.state.first=r&&!t,n.state.last=t&&!r,n.controller.state.shared[n.ingKey]=r}var a=n.controller.pointerIds.size||n.controller.touchIds.size,o=n.controller.state.shared.buttons>0||a>0,i=ke({},n.controller.state.shared,n.state,n.mapStateValues(n.state),{locked:!!document.pointerLockElement,touches:a,down:o}),s=n.handler(i);return n.state.memo=void 0!==s?s:n.state.memo,i},this.controller=e,this.args=t}var t,n,r=e.prototype;return r.updateSharedState=function(e){Object.assign(this.controller.state.shared,e)},r.updateGestureState=function(e){Object.assign(this.state,e)},r.checkIntentionality=function(e,t){return{_intentional:e,_blocked:!1}},r.getMovement=function(e){var t=this.config.rubberband,n=this.state,r=n._bounds,a=n._initial,o=n._active,i=n._intentional,s=n.lastOffset,l=n.movement,c=n._threshold,u=this.getInternalMovement(e,this.state),p=!1===i[0]?Ze(u[0],c[0]):i[0],d=!1===i[1]?Ze(u[1],c[1]):i[1],g=this.checkIntentionality([p,d],u);if(g._blocked)return ke({},g,{_movement:u,delta:[0,0]});var m=g._intentional,f=u,h=[!1!==m[0]?u[0]-m[0]:0,!1!==m[1]?u[1]-m[1]:0],v=we(h,s),y=o?t:[0,0];return h=et(r,we(h,a),y),ke({},g,{intentional:!1!==m[0]||!1!==m[1],_initial:a,_movement:f,movement:h,values:e,offset:et(r,v,y),delta:Ee(h,l)})},r.clean=function(){this.clearTimeout()},t=e,(n=[{key:"config",get:function(){return this.controller.config[this.stateKey]}},{key:"enabled",get:function(){return this.controller.config.enabled&&this.config.enabled}},{key:"state",get:function(){return this.controller.state[this.stateKey]}},{key:"handler",get:function(){return this.controller.handlers[this.stateKey]}},{key:"transform",get:function(){return this.config.transform||this.controller.config.transform||Xe}}])&&Te(t.prototype,n),e}();function Ze(e,t){return Math.abs(e)>=t&&Se(e)*t}function et(e,t,n){var r=t[0],a=t[1],o=n[0],i=n[1],s=e[0],l=s[0],c=s[1],u=e[1],p=u[0],d=u[1];return[Ne(r,l,c,o),Ne(a,p,d,i)]}function tt(e,t,n){var r=e.state,a=t.timeStamp,o=t.type,i=r.values;return{_lastEventType:o,event:t,timeStamp:a,elapsedTime:n?0:a-r.startTime,previous:i}}function nt(e,t,n,r){var a=e.state,o=e.config,i=e.stateKey,s=e.args,l=e.transform,c=a.offset,u=n.timeStamp,p=o.initial,d=o.bounds,g=Ee(l(o.threshold),l([0,0])).map(Math.abs),m=ke({},He()[i],{_active:!0,args:s,values:t,initial:null!=r?r:t,_threshold:g,offset:c,lastOffset:c,startTime:u});return ke({},m,{_initial:De(p,m),_bounds:De(d,m)})}var rt=function(e){var t=this;this.classes=e,this.pointerIds=new Set,this.touchIds=new Set,this.supportsTouchEvents=Me(),this.supportsGestureEvents=function(){try{return"constructor"in GestureEvent}catch(e){return!1}}(),this.bind=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];for(var a,o={},i=Ie(t.classes);!(a=i()).done;){var s=a.value;new s(t,n).addBindings(o)}var l=function(e){dt(o,e,(function(r){return t.nativeRefs[e](ke({},t.state.shared,{event:r,args:n}))}))};for(var c in t.nativeRefs)l(c);return t.config.domTarget?lt(t,o):ct(t,o)},this.effect=function(){return t.config.domTarget&&t.bind(),t.clean},this.clean=function(){var e=pt(t.config),n=t.config.eventOptions;e&&mt(e,ut(t.domListeners),n),Object.values(t.timeouts).forEach(clearTimeout),function(e){var t=e.config,n=t.window,r=t.eventOptions,a=e.windowListeners;if(n){for(var o in a)mt(n,a[o],r);e.windowListeners={}}}(t)},this.classes=e,this.state=He(),this.timeouts={},this.domListeners=[],this.windowListeners={}};function at(e,t){"pointerId"in t?e.pointerIds.add(t.pointerId):e.touchIds=new Set(Be(t))}function ot(e,t){"pointerId"in t?e.pointerIds.delete(t.pointerId):Be(t).forEach((function(t){return e.touchIds.delete(t)}))}function it(e,t,n){var r=e.config,a=e.windowListeners;void 0===n&&(n=r.eventOptions),r.window&&(mt(r.window,a[t],n),delete a[t])}function st(e,t,n,r){var a=e.config,o=e.windowListeners;void 0===n&&(n=[]),void 0===r&&(r=a.eventOptions),a.window&&(mt(a.window,o[t],r),gt(a.window,o[t]=n,r))}function lt(e,t){var n=e.config,r=e.domListeners,a=pt(n);if(!a)throw new Error("domTarget must be defined");var o=n.eventOptions;mt(a,ut(r),o);for(var i=0,s=Object.entries(t);i<s.length;i++){var l=s[i],c=l[0],u=l[1],p=c.slice(2).toLowerCase();r.push([p,Le.apply(void 0,u)])}gt(a,r,o)}function ct(e,t){for(var n={},r=e.config.eventOptions.capture?"Capture":"",a=0,o=Object.entries(t);a<o.length;a++){var i=o[a],s=i[0],l=i[1],c=Array.isArray(l)?l:[l];n[s+r]=Le.apply(void 0,c)}return n}function ut(e){return void 0===e&&(e=[]),e.splice(0,e.length)}function pt(e){var t=e.domTarget;return t&&"current"in t?t.current:t}function dt(e,t,n){e[t]||(e[t]=[]),e[t].push(n)}function gt(e,t,n){void 0===t&&(t=[]),void 0===n&&(n={});for(var r,a=Ie(t);!(r=a()).done;){var o=r.value,i=o[0],s=o[1];e.addEventListener(i,s,n)}}function mt(e,t,n){void 0===t&&(t=[]),void 0===n&&(n={});for(var r,a=Ie(t);!(r=a()).done;){var o=r.value,i=o[0],s=o[1];e.removeEventListener(i,s,n)}}function ft(){}var ht=function(e){function t(){return e.apply(this,arguments)||this}Ce(t,e);var n=t.prototype;return n.getInternalMovement=function(e,t){return Ee(e,t.initial)},n.checkIntentionality=function(e,t){if(!1===e[0]&&!1===e[1])return{_intentional:e,axis:this.state.axis};var n=t.map(Math.abs),r=n[0],a=n[1],o=this.state.axis||(r>a?"x":r<a?"y":void 0);return this.config.axis||this.config.lockDirection?o?this.config.axis&&o!==this.config.axis?{_intentional:e,_blocked:!0,axis:o}:(e["x"===o?1:0]=!1,{_intentional:e,_blocked:!1,axis:o}):{_intentional:[!1,!1],_blocked:!1,axis:o}:{_intentional:e,_blocked:!1,axis:o}},n.getKinematics=function(e,t){var n=this.getMovement(e);if(!n._blocked){var r=t.timeStamp-this.state.timeStamp;Object.assign(n,function(e,t,n){var r=be(t),a=0===r?0:1/r,o=0===n?0:1/n,i=o*r,s=t.map((function(e){return o*e})),l=t.map((function(e){return a*e}));return{velocities:s,velocity:i,distance:be(e),direction:l}}(n.movement,n.delta,r))}return n},n.mapStateValues=function(e){return{xy:e.values,vxvy:e.velocities}},t}(Je);function vt(e){"persist"in e&&"function"==typeof e.persist&&e.persist()}var yt=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).ingKey="dragging",t.stateKey="drag",t.setPointerCapture=function(e){if(!t.config.useTouch&&!document.pointerLockElement){var n=e.target,r=e.pointerId;n&&"setPointerCapture"in n&&n.setPointerCapture(r),t.updateGestureState({_dragTarget:n,_dragPointerId:r})}},t.releasePointerCapture=function(){if(!t.config.useTouch&&!document.pointerLockElement){var e=t.state,n=e._dragTarget,r=e._dragPointerId;if(r&&n&&"releasePointerCapture"in n&&(!("hasPointerCapture"in n)||n.hasPointerCapture(r)))try{n.releasePointerCapture(r)}catch(e){}}},t.preventScroll=function(e){t.state._dragPreventScroll&&e.cancelable&&e.preventDefault()},t.getEventId=function(e){return t.config.useTouch?e.changedTouches[0].identifier:e.pointerId},t.isValidEvent=function(e){return t.state._pointerId===t.getEventId(e)},t.shouldPreventWindowScrollY=t.config.experimental_preventWindowScrollY&&t.controller.supportsTouchEvents,t.setUpWindowScrollDetection=function(e){vt(e),st(t.controller,t.stateKey,[["touchmove",t.preventScroll],["touchend",t.clean.bind(xe(t))],["touchcancel",t.clean.bind(xe(t))]],{passive:!1}),t.setTimeout(t.startDrag.bind(xe(t)),250,e)},t.setUpDelayedDragTrigger=function(e){t.state._dragDelayed=!0,vt(e),t.setTimeout(t.startDrag.bind(xe(t)),t.config.delay,e)},t.setStartState=function(e){var n=qe(e,t.transform);t.updateSharedState(Qe(e)),t.updateGestureState(ke({},nt(xe(t),n,e),tt(xe(t),e,!0),{_pointerId:t.getEventId(e)})),t.updateGestureState(t.getMovement(n))},t.onDragStart=function(e){at(t.controller,e),t.enabled&&!t.state._active&&(t.setStartState(e),t.setPointerCapture(e),t.shouldPreventWindowScrollY?t.setUpWindowScrollDetection(e):t.config.delay>0?t.setUpDelayedDragTrigger(e):t.startDrag(e,!0))},t.onDragChange=function(e){if(!t.state.canceled&&t.state._active&&t.isValidEvent(e)&&(t.state._lastEventType!==e.type||e.timeStamp!==t.state.timeStamp)){var n;if(document.pointerLockElement){var r=e.movementX,a=e.movementY;n=we(t.transform([r,a]),t.state.values)}else n=qe(e,t.transform);var o=t.getKinematics(n,e);if(!t.state._dragStarted){if(t.state._dragDelayed)return void t.startDrag(e);if(!t.shouldPreventWindowScrollY)return;if(t.state._dragPreventScroll||!o.axis)return;if("x"!==o.axis)return void(t.state._active=!1);t.startDrag(e)}var i=Qe(e);t.updateSharedState(i);var s=tt(xe(t),e),l=be(o._movement),c=t.state._dragIsTap;c&&l>=3&&(c=!1),t.updateGestureState(ke({},s,o,{_dragIsTap:c})),t.fireGestureHandler()}},t.onDragEnd=function(e){if(ot(t.controller,e),t.isValidEvent(e)&&(t.clean(),t.state._active)){t.state._active=!1;var n=t.state._dragIsTap,r=t.state.velocities,a=r[0],o=r[1],i=t.state.movement,s=i[0],l=i[1],c=t.state._intentional,u=c[0],p=c[1],d=t.config.swipeVelocity,g=d[0],m=d[1],f=t.config.swipeDistance,h=f[0],v=f[1],y=t.config.swipeDuration,_=ke({},tt(xe(t),e),t.getMovement(t.state.values)),w=[0,0];_.elapsedTime<y&&(!1!==u&&Math.abs(a)>g&&Math.abs(s)>h&&(w[0]=Se(a)),!1!==p&&Math.abs(o)>m&&Math.abs(l)>v&&(w[1]=Se(o))),t.updateSharedState({buttons:0}),t.updateGestureState(ke({},_,{tap:n,swipe:w})),t.fireGestureHandler(t.config.filterTaps&&!0===n)}},t.clean=function(){e.prototype.clean.call(xe(t)),t.state._dragStarted=!1,t.releasePointerCapture(),it(t.controller,t.stateKey)},t.onCancel=function(){t.state.canceled||(t.updateGestureState({canceled:!0,_active:!1}),t.updateSharedState({buttons:0}),setTimeout((function(){return t.fireGestureHandler()}),0))},t.onClick=function(e){t.state._dragIsTap||e.stopPropagation()},t}Ce(t,e);var n=t.prototype;return n.startDrag=function(e,t){void 0===t&&(t=!1),this.state._active&&!this.state._dragStarted&&(t||this.setStartState(e),this.updateGestureState({_dragStarted:!0,_dragPreventScroll:!0,cancel:this.onCancel}),this.clearTimeout(),this.fireGestureHandler())},n.addBindings=function(e){this.config.useTouch?(dt(e,"onTouchStart",this.onDragStart),dt(e,"onTouchMove",this.onDragChange),dt(e,"onTouchEnd",this.onDragEnd),dt(e,"onTouchCancel",this.onDragEnd)):(dt(e,"onPointerDown",this.onDragStart),dt(e,"onPointerMove",this.onDragChange),dt(e,"onPointerUp",this.onDragEnd),dt(e,"onPointerCancel",this.onDragEnd)),this.config.filterTaps&&dt(e,this.controller.config.eventOptions.capture?"onClick":"onClickCapture",this.onClick)},t}(ht);function _t(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){if(e.constructor!==t.constructor)return!1;var n,r,a,o;if(Array.isArray(e)){if((n=e.length)!==t.length)return!1;for(r=n;0!=r--;)if(!_t(e[r],t[r]))return!1;return!0}if("function"==typeof Map&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(o=e.entries();!(r=o.next()).done;)if(!t.has(r.value[0]))return!1;for(o=e.entries();!(r=o.next()).done;)if(!_t(r.value[1],t.get(r.value[0])))return!1;return!0}if("function"==typeof Set&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(o=e.entries();!(r=o.next()).done;)if(!t.has(r.value[0]))return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if((n=(a=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!Object.prototype.hasOwnProperty.call(t,a[r]))return!1;if("undefined"!=typeof Element&&e instanceof Element)return!1;for(r=n;0!=r--;)if(!("_owner"===a[r]&&e.$$typeof||_t(e[a[r]],t[a[r]])))return!1;return!0}return e!=e&&t!=t}function wt(e,t){try{return _t(e,t)}catch(e){if((e.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw e}}var Et=window.wp.keycodes,bt=function(e){let{label:t,className:n,onDragChange:r,onDragEnd:o,direction:i="left",...s}=e;const l=function(e,t){void 0===t&&(t={}),Ye.set("drag",yt);var n=(0,ye.useRef)();return n.current||(n.current=function(e,t){var n,r,a=[],o=!1;return function(){for(var i=arguments.length,s=new Array(i),l=0;l<i;l++)s[l]=arguments[l];return o&&n===this&&t(s,a)||(r=e.apply(this,s),o=!0,n=this,a=s),r}}(ze,wt)),function(e,t,n){void 0===n&&(n={});var r=function(e){var t=new Set;return e.drag&&t.add(Ye.get("drag")),e.wheel&&t.add(Ye.get("wheel")),e.scroll&&t.add(Ye.get("scroll")),e.move&&t.add(Ye.get("move")),e.pinch&&t.add(Ye.get("pinch")),e.hover&&t.add(Ye.get("hover")),t}(e),a=_e().useMemo((function(){return new rt(r)}),[]);return a.config=t,a.handlers=e,a.nativeRefs=n,_e().useEffect(a.effect,[]),a.config.domTarget?ft:a.bind}({drag:e=>{let{delta:t,dragging:n}=e;const a="left"===i?-2:2;n?r(t[0]*a):o()}},n.current(t))}();return(0,a.createElement)("div",{className:`pattern-preview__drag-handle ${n}`},(0,a.createElement)("button",p({className:"pattern-preview__drag-handle-button","aria-label":t},s,{onKeyDown:e=>{const{keyCode:t}=e;"left"===i&&t===Et.LEFT||"right"===i&&t===Et.RIGHT?r(20):("left"===i&&t===Et.RIGHT||"right"===i&&t===Et.LEFT)&&r(-20)},onKeyUp:o},l())))},St=function e(t){let{blockContent:n}=t;const r=(0,me.useViewportMatch)("mobile",">="),i=(0,me.useViewportMatch)("large",">="),s=(0,me.useViewportMatch)("wide",">="),l=(0,me.useInstanceId)(e),[c,u]=(0,a.useState)(window.innerWidth<960?window.innerWidth:960),p=(0,a.useCallback)((e=>u((t=>t+e))),[u]),d=()=>{c<280&&u(280)},g=(0,a.useMemo)((()=>r?s?[{label:(0,o.__)("Full (1200px)","wporg-patterns"),value:1200},{label:(0,o.__)("Default (960px)","wporg-patterns"),value:960},{label:(0,o.__)("Medium (480px)","wporg-patterns"),value:480},{label:(0,o.__)("Narrow (320px)","wporg-patterns"),value:320}]:i?[{label:(0,o.__)("Default (960px)","wporg-patterns"),value:960},{label:(0,o.__)("Medium (480px)","wporg-patterns"),value:480},{label:(0,o.__)("Narrow (320px)","wporg-patterns"),value:320}]:[{label:(0,o.__)("Medium (480px)","wporg-patterns"),value:480},{label:(0,o.__)("Narrow (320px)","wporg-patterns"),value:320}]:[]),[r,i,s]);let m=!1;if(!g.some((e=>e.value===c))){const e=Math.max(Math.floor(c),280);m={
    33/* translators: %s is the width in pixels, ex 600. */
    4 label:(0,o.sprintf)((0,o.__)("Current (%spx)","wporg-patterns"),e),value:e}}return(0,a.createElement)(a.Fragment,null,(0,a.createElement)("div",{className:"pattern-preview__size-control"},r&&(0,a.createElement)(fe.SelectControl,{hideLabelFromVision:!0,label:(0,o.__)("Preview Width","wporg-patterns"),value:c,options:m?[m,...g]:g,onChange:e=>u(Number(e))})),(0,a.createElement)("div",{className:"pattern-preview__viewport",style:{width:c+40}},(0,a.createElement)(St,{label:(0,o.__)("Drag to resize","wporg-patterns"),className:"is-left",onDragChange:p,onDragEnd:d,direction:"left","aria-describedby":`pattern-preview__resize-help-${l}`}),(0,a.createElement)(ye,{html:n}),(0,a.createElement)(St,{label:(0,o.__)("Drag to resize","wporg-patterns"),className:"is-right",onDragChange:p,onDragEnd:d,direction:"right","aria-describedby":`pattern-preview__resize-help-${l}`}),(0,a.createElement)(fe.VisuallyHidden,{id:`pattern-preview__resize-help-${l}`,className:"pattern-preview__resize-help"},(0,o.__)("Use left and right arrow keys to resize the preview.","wporg-patterns"))))};const Nt=()=>(0,a.createElement)("div",{style:{height:"220px"}},(0,a.createElement)("img",{src:`${wporgPatternsUrl.assets}/images/copy-paste-demo.gif`,alt:(0,o.__)("GIF of copy and pasting.","wporg-patterns")}));var Tt=e=>{let{onFinish:t}=e;return(0,a.createElement)(fe.Animate,{type:"appear",options:{origin:"bottom"}},(e=>{let{className:n}=e;return(0,a.createElement)(fe.Guide,{className:`pattern-actions__guide ${n}`,onFinish:t,finishButtonText:(0,o.__)("Close","wporg-patterns"),pages:[{image:(0,a.createElement)(Nt,null),content:(0,a.createElement)("div",{className:"pattern-actions__guide-content"},(0,a.createElement)("h3",{className:"pattern-actions__guide-title"},(0,o.__)("How to use patterns on your WordPress site.","wporg-patterns")),(0,a.createElement)("p",null,(0,o.__)("Patterns are really just text. And, just like you can copy and paste text, you can copy and paste patterns. It’s really easy!","wporg-patterns")),(0,a.createElement)("ol",null,(0,a.createElement)("li",null,(0,a.createElement)("p",null,(0,o.__)("Open any post or page in the WordPress block editor.","wporg-patterns"))),(0,a.createElement)("li",null,(0,a.createElement)("p",null,(0,o.__)("Place your cursor where you want to add the pattern.","wporg-patterns"))),(0,a.createElement)("li",null,(0,a.createElement)("p",null,(0,a.createInterpolateElement)((0,o.__)("Paste the contents of your clipboard by holding down <kbd>ctrl</kbd> control (Windows) or <kbd>⌘</kbd> command (Mac) and pressing the <kbd>v</kbd> key, or right-clicking and choose “Paste” from the menu.","wporg-patterns"),{kbd:(0,a.createElement)("kbd",{className:"pattern-actions__guide-shortcut"})})))))}]})}))},kt=n(472),Ct=n.n(kt),xt=window.lodash,At=window.wp.a11y,It=e=>{let{isSmall:t=!1,onSuccess:n=xt.noop,content:r}=e;const[i,s]=(0,a.useState)(!1);if(!r){const e=document.getElementById("block-data");r=JSON.parse(decodeURIComponent(e.value))}(0,a.useEffect)((()=>{if(!i)return;(0,At.speak)((0,o.__)("Copied pattern to clipboard.","wporg-patterns"));const e=setTimeout((()=>s(!1)),2e4);return()=>{clearTimeout(e)}}),[i]);let l=(0,o.__)("Copy Pattern","wporg-patterns");t&&(l=i?(0,o.__)("Copied","wporg-patterns"):(0,o.__)("Copy","wporg-patterns"));const c=Ct()({"pattern-copy-button":!0,"is-small-label":t});return(0,a.createElement)(fe.Button,{className:c,isPrimary:!0,onClick:e=>{let{target:t}=e;const a=(e=>{const t=document.createElement("textarea");t.setAttribute("readonly",""),t.setAttribute("aria-hidden","true"),t.style.position="absolute",t.style.left="-9999px",t.value=e,document.body.appendChild(t),t.select();const n=document.execCommand("copy");return document.body.removeChild(t),n})(r);s(a),t.focus(),a&&n()}},l)},Ot=e=>{let{onClick:t}=e;return(0,a.createElement)(fe.Notice,{className:"pattern-actions__notice",status:"success",isDismissible:!1,actions:[{label:(0,o.__)("Learn More","wporg-patterns"),onClick:t,variant:"secondary"}]},(0,a.createElement)("div",null,(0,a.createElement)("strong",null,(0,o.__)("Pattern copied!","wporg-patterns")),(0,o.__)("Now you can paste it into any WordPress post or page.","wporg-patterns")))},Lt=window.wp.coreData;function Rt(e){return(0,a.createElement)(d.SVG,p({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24"},e),(0,a.createElement)(d.Path,{d:"M12 4.915c1.09-1.28 2.76-2.09 4.5-2.09 3.08 0 5.5 2.42 5.5 5.5 0 3.777-3.394 6.855-8.537 11.518l-.013.012-1.45 1.32-1.45-1.31-.04-.036C5.384 15.17 2 12.095 2 8.325c0-3.08 2.42-5.5 5.5-5.5 1.74 0 3.41.81 4.5 2.09zm0 13.56l.1-.1c4.76-4.31 7.9-7.16 7.9-10.05 0-2-1.5-3.5-3.5-3.5-1.54 0-3.04.99-3.56 2.36h-1.87c-.53-1.37-2.03-2.36-3.57-2.36-2 0-3.5 1.5-3.5 3.5 0 2.89 3.14 5.74 7.9 10.05l.1.1z"}))}var Dt=e=>{let{showLabel:t=!0,patternId:n}=e;const{hasPermission:r,isFavorite:i}=(0,s.useSelect)((e=>(e(de).getFavorites(),{hasPermission:!!e(Lt.store).canUser("create","../../wporg/v1/pattern-favorites"),isFavorite:e(de).isFavorite(n)}))),{addFavorite:l,removeFavorite:c}=(0,s.useDispatch)(de),u=(0,a.useCallback)((()=>{i?c(n):l(n)}),[i]);if(!r)return null;const p=Ct()("button button-link pattern-favorite-button",{"is-favorited":i,"has-label":t}),d=Ct()({"screen-reader-text":!t});return(0,a.createElement)("button",{className:p,onClick:u},(0,a.createElement)(g,{className:"pattern-favorite-button__filled"}),(0,a.createElement)(Rt,{className:"pattern-favorite-button__outline"}),(0,a.createElement)("span",{className:d},i?(0,o.__)("Remove from favorites","wporg-patterns"):(0,o.__)("Add to favorites","wporg-patterns")))},Ft=window.wp.apiFetch,Mt=n.n(Ft),$t=(0,a.createElement)(d.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)(d.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"})),Bt=e=>{let{patternId:t,isSmall:n}=e;const{isDraft:r,parent:i}=(0,s.useSelect)((e=>{const n=e(de).getPattern(t);return{isDraft:"draft"===(null==n?void 0:n.status),parent:(null==n?void 0:n.parent)||0}}),[t]),{loadPattern:l}=(0,s.useDispatch)(de),c=()=>{Mt()({path:`/wp/v2/wporg-pattern/${t}/`,method:"PUT",data:{status:"draft"}}).then((e=>{l(t,e)}))},u=()=>{window.confirm((0,o.__)("Are you sure you want to delete this pattern?","wporg-patterns"))&&Mt()({path:`/wp/v2/wporg-pattern/${t}/`,method:"DELETE"}).then((()=>{window.location=`${wporgPatternsUrl.site}/my-patterns/`}))},p=`${wporgPatternsUrl.site}/pattern/${i||t}/edit/`,d=n?(0,a.createElement)(fe.Icon,{icon:$t}):(0,a.createElement)(a.Fragment,null,(0,o.__)("Options","wporg-patterns"),(0,a.createElement)(fe.Icon,{icon:$t})),g=n?"pattern-manage-options__button is-small":"pattern-manage-options__button";return(0,a.createElement)(fe.DropdownMenu,{className:"pattern-manage-options",icon:null,toggleProps:{className:g,children:d,variant:"secondary"},popoverProps:{position:"bottom center",className:"pattern-manage-options__popover"}},(()=>(0,a.createElement)(a.Fragment,null,(0,a.createElement)(fe.MenuItem,{href:p},i?(0,o.__)("Open original in editor","wporg-patterns"):(0,o.__)("Open in editor","wporg-patterns")),!r&&(0,a.createElement)(fe.MenuItem,{onClick:c},(0,o.__)("Revert to draft","wporg-patterns")),(0,a.createElement)(fe.MenuItem,{isDestructive:!0,variant:"link",onClick:u},(0,o.__)("Delete pattern","wporg-patterns")))))},Qt=e=>{let{postId:t,showOptions:n}=e;const[r,o]=(0,a.useState)(!1),[i,s]=(0,a.useState)(!1);return(0,a.createElement)("div",{className:"pattern-actions"},(0,a.createElement)("div",{className:"pattern-actions__container"},(0,a.createElement)(It,{onSuccess:()=>o(!0)}),(0,a.createElement)(Dt,{patternId:t}),n&&(0,a.createElement)(Bt,{patternId:t}),r&&(0,a.createElement)(Ot,{onClick:()=>s(!0)}),i&&(0,a.createElement)(Tt,{onFinish:()=>s(!1)})))};var jt=function(e){let{className:t,html:n}=e;const r=(0,a.useRef)(),[i,s]=(0,a.useState)("1px"),[l,c]=(0,a.useState)(.3125),u=(e=>{let{element:t}=e;const[n,r]=(0,a.useState)(null);(0,a.useEffect)((()=>{if(!t.current)return;const e=(0,xt.debounce)(o,200);return o(),window.addEventListener("scroll",e),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e),window.addEventListener("resize",e)}}),[t]);const o=()=>{if(!t.current)return;const e=window.innerHeight,{top:n}=t.current.getBoundingClientRect();r(n>=0&&n<=e)};return n})({element:r}),[p,d]=(0,a.useState)(!1);(0,a.useEffect)((()=>{u&&d(!0)}),[u]),(0,a.useEffect)((()=>{const e=()=>{try{s(m(r.current.clientWidth)),c(r.current.clientWidth/1200)}catch(e){}};return e(),window.addEventListener("resize",e),()=>{window.addEventListener("resize",e)}}),[]);const g={border:"none",width:"1200px",maxWidth:"none",height:`${m(1200)}px`,transform:`scale(${l})`,transformOrigin:(0,o.isRTL)()?"top right":"top left",pointerEvents:"none"};return(0,a.createElement)("div",{className:t,ref:r,style:{height:i},tabIndex:"-1"},(0,a.createElement)(ve,{className:"pattern-grid__preview-iframe",style:g,bodyStyle:"overflow: hidden;",headHTML:window.__editorStyles.html},(0,a.createElement)("div",{dangerouslySetInnerHTML:{__html:p?n:""}})))},qt=e=>{let{className:t,label:n,patternId:r}=e;const{hasPermission:o,isFavorite:i}=(0,s.useSelect)((e=>(e(de).getFavorites(),{hasPermission:!!e(Lt.store).canUser("create","../../wporg/v1/pattern-favorites"),isFavorite:e(de).isFavorite(r)}))),{addFavorite:l,removeFavorite:c}=(0,s.useDispatch)(de),u=(0,a.useCallback)((()=>{i?c(r):l(r)}),[i]),p=Ct()(t,"pattern-favorite-button-small",{button:o,"button-link":o,"is-favorited":i});return o?(0,a.createElement)("button",{className:p,onClick:u},(0,a.createElement)(g,{className:"pattern-favorite-button__filled"}),(0,a.createElement)("span",null,n)):(0,a.createElement)("span",{className:p},(0,a.createElement)(g,{className:"pattern-favorite-button__filled"}),(0,a.createElement)("span",null,n))},Ut=function(e){let{pattern:t,showAvatar:n,showOptions:r}=e;const s=function(e){switch(e.status){case"pending-review":case"pending":return(0,o.__)("Pending","wporg-patterns");case"draft":return(0,o.__)("Draft","wporg-patterns");case"unlisted":return(0,o.__)("Declined","wporg-patterns")}return""}(t);return(0,a.createElement)("div",{className:"pattern-grid__pattern"},(0,a.createElement)("div",{className:"pattern-grid__pattern-frame"},(0,a.createElement)("a",{href:t.link,rel:"bookmark"},(0,a.createElement)("span",{className:"screen-reader-text"},(0,i.decodeEntities)(t.title.rendered)),(0,a.createElement)(fe.Disabled,null,(0,a.createElement)(jt,{className:"pattern-grid__preview",html:t.content.rendered}))),s?(0,a.createElement)("div",{className:`pattern-grid__status is-${t.status}`},(0,a.createElement)("span",null,s)):null,(0,a.createElement)("span",{className:"pattern-grid__actions"},(0,a.createElement)(Dt,{showLabel:!1,patternId:t.id}),r&&(0,a.createElement)(Bt,{isSmall:!0,patternId:t.id}),(0,a.createElement)(It,{isSmall:!0,content:t.pattern_content}))),(0,a.createElement)("h2",{className:"pattern-grid__title"},(0,a.createElement)("a",{href:t.link},(0,i.decodeEntities)(t.title.rendered))),(0,a.createElement)("p",{className:"pattern-grid__meta"},n&&t.author_meta?(0,a.createElement)("a",{href:t.author_meta.url,className:"pattern-grid__author-avatar"},(0,a.createElement)("img",{alt:"",src:t.author_meta.avatar}),t.author_meta.name):null,t.favorite_count>0?(0,a.createElement)(qt,{className:"pattern-grid__favorite-count",patternId:t.id,label:(0,a.createElement)(a.Fragment,null,(0,a.createElement)("span",{className:"screen-reader-text"},(0,o.sprintf)(
     4label:(0,o.sprintf)((0,o.__)("Current (%spx)","wporg-patterns"),e),value:e}}return(0,a.createElement)(a.Fragment,null,(0,a.createElement)("div",{className:"pattern-preview__size-control"},r&&(0,a.createElement)(fe.SelectControl,{hideLabelFromVision:!0,label:(0,o.__)("Preview Width","wporg-patterns"),value:c,options:m?[m,...g]:g,onChange:e=>u(Number(e))})),(0,a.createElement)("div",{className:"pattern-preview__viewport",style:{width:c+40}},(0,a.createElement)(bt,{label:(0,o.__)("Drag to resize","wporg-patterns"),className:"is-left",onDragChange:p,onDragEnd:d,direction:"left","aria-describedby":`pattern-preview__resize-help-${l}`}),(0,a.createElement)(ve,{html:n}),(0,a.createElement)(bt,{label:(0,o.__)("Drag to resize","wporg-patterns"),className:"is-right",onDragChange:p,onDragEnd:d,direction:"right","aria-describedby":`pattern-preview__resize-help-${l}`}),(0,a.createElement)(fe.VisuallyHidden,{id:`pattern-preview__resize-help-${l}`,className:"pattern-preview__resize-help"},(0,o.__)("Use left and right arrow keys to resize the preview.","wporg-patterns"))))};const Pt=()=>(0,a.createElement)("div",{style:{height:"220px"}},(0,a.createElement)("img",{src:`${wporgPatternsUrl.assets}/images/copy-paste-demo.gif`,alt:(0,o.__)("GIF of copy and pasting.","wporg-patterns")}));var Nt=e=>{let{onFinish:t}=e;return(0,a.createElement)(fe.Animate,{type:"appear",options:{origin:"bottom"}},(e=>{let{className:n}=e;return(0,a.createElement)(fe.Guide,{className:`pattern-actions__guide ${n}`,onFinish:t,finishButtonText:(0,o.__)("Close","wporg-patterns"),pages:[{image:(0,a.createElement)(Pt,null),content:(0,a.createElement)("div",{className:"pattern-actions__guide-content"},(0,a.createElement)("h3",{className:"pattern-actions__guide-title"},(0,o.__)("How to use patterns on your WordPress site.","wporg-patterns")),(0,a.createElement)("p",null,(0,o.__)("Patterns are really just text. And, just like you can copy and paste text, you can copy and paste patterns. It’s really easy!","wporg-patterns")),(0,a.createElement)("ol",null,(0,a.createElement)("li",null,(0,a.createElement)("p",null,(0,o.__)("Open any post or page in the WordPress block editor.","wporg-patterns"))),(0,a.createElement)("li",null,(0,a.createElement)("p",null,(0,o.__)("Place your cursor where you want to add the pattern.","wporg-patterns"))),(0,a.createElement)("li",null,(0,a.createElement)("p",null,(0,a.createInterpolateElement)((0,o.__)("Paste the contents of your clipboard by holding down <kbd>ctrl</kbd> control (Windows) or <kbd>⌘</kbd> command (Mac) and pressing the <kbd>v</kbd> key, or right-clicking and choose “Paste” from the menu.","wporg-patterns"),{kbd:(0,a.createElement)("kbd",{className:"pattern-actions__guide-shortcut"})})))))}]})}))},Tt=n(472),kt=n.n(Tt),Ct=window.lodash,xt=window.wp.a11y,At=e=>{let{isSmall:t=!1,onSuccess:n=Ct.noop,content:r}=e;const[i,s]=(0,a.useState)(!1);if(!r){const e=document.getElementById("block-data");r=JSON.parse(decodeURIComponent(e.value))}(0,a.useEffect)((()=>{if(!i)return;(0,xt.speak)((0,o.__)("Copied pattern to clipboard.","wporg-patterns"));const e=setTimeout((()=>s(!1)),2e4);return()=>{clearTimeout(e)}}),[i]);let l=(0,o.__)("Copy Pattern","wporg-patterns");t&&(l=i?(0,o.__)("Copied","wporg-patterns"):(0,o.__)("Copy","wporg-patterns"));const c=kt()({"pattern-copy-button":!0,"is-small-label":t});return(0,a.createElement)(fe.Button,{className:c,isPrimary:!0,onClick:e=>{let{target:t}=e;const a=(e=>{const t=document.createElement("textarea");t.setAttribute("readonly",""),t.setAttribute("aria-hidden","true"),t.style.position="absolute",t.style.left="-9999px",t.value=e,document.body.appendChild(t),t.select();const n=document.execCommand("copy");return document.body.removeChild(t),n})(r);s(a),t.focus(),a&&n()}},l)},It=e=>{let{onClick:t}=e;return(0,a.createElement)(fe.Notice,{className:"pattern-actions__notice",status:"success",isDismissible:!1,actions:[{label:(0,o.__)("Learn More","wporg-patterns"),onClick:t,variant:"secondary"}]},(0,a.createElement)("div",null,(0,a.createElement)("strong",null,(0,o.__)("Pattern copied!","wporg-patterns")),(0,o.__)("Now you can paste it into any WordPress post or page.","wporg-patterns")))},Ot=window.wp.coreData;function Lt(e){return(0,a.createElement)(d.SVG,p({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24"},e),(0,a.createElement)(d.Path,{d:"M12 4.915c1.09-1.28 2.76-2.09 4.5-2.09 3.08 0 5.5 2.42 5.5 5.5 0 3.777-3.394 6.855-8.537 11.518l-.013.012-1.45 1.32-1.45-1.31-.04-.036C5.384 15.17 2 12.095 2 8.325c0-3.08 2.42-5.5 5.5-5.5 1.74 0 3.41.81 4.5 2.09zm0 13.56l.1-.1c4.76-4.31 7.9-7.16 7.9-10.05 0-2-1.5-3.5-3.5-3.5-1.54 0-3.04.99-3.56 2.36h-1.87c-.53-1.37-2.03-2.36-3.57-2.36-2 0-3.5 1.5-3.5 3.5 0 2.89 3.14 5.74 7.9 10.05l.1.1z"}))}var Rt=e=>{let{showLabel:t=!0,patternId:n}=e;const{hasPermission:r,isFavorite:i}=(0,s.useSelect)((e=>(e(de).getFavorites(),{hasPermission:!!e(Ot.store).canUser("create","../../wporg/v1/pattern-favorites"),isFavorite:e(de).isFavorite(n)}))),{addFavorite:l,removeFavorite:c}=(0,s.useDispatch)(de),u=(0,a.useCallback)((()=>{i?c(n):l(n)}),[i]);if(!r)return null;const p=kt()("button button-link pattern-favorite-button",{"is-favorited":i,"has-label":t}),d=kt()({"screen-reader-text":!t});return(0,a.createElement)("button",{className:p,onClick:u},(0,a.createElement)(g,{className:"pattern-favorite-button__filled"}),(0,a.createElement)(Lt,{className:"pattern-favorite-button__outline"}),(0,a.createElement)("span",{className:d},i?(0,o.__)("Remove from favorites","wporg-patterns"):(0,o.__)("Add to favorites","wporg-patterns")))},Dt=window.wp.apiFetch,Ft=n.n(Dt),Mt=(0,a.createElement)(d.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,a.createElement)(d.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"})),$t=e=>{let{patternId:t,isSmall:n}=e;const{isDraft:r,parent:i}=(0,s.useSelect)((e=>{const n=e(de).getPattern(t);return{isDraft:"draft"===(null==n?void 0:n.status),parent:(null==n?void 0:n.parent)||0}}),[t]),{loadPattern:l}=(0,s.useDispatch)(de),c=()=>{Ft()({path:`/wp/v2/wporg-pattern/${t}/`,method:"PUT",data:{status:"draft"}}).then((e=>{l(t,e)}))},u=()=>{window.confirm((0,o.__)("Are you sure you want to delete this pattern?","wporg-patterns"))&&Ft()({path:`/wp/v2/wporg-pattern/${t}/`,method:"DELETE"}).then((()=>{window.location=`${wporgPatternsUrl.site}/my-patterns/`}))},p=`${wporgPatternsUrl.site}/pattern/${i||t}/edit/`,d=n?(0,a.createElement)(fe.Icon,{icon:Mt}):(0,a.createElement)(a.Fragment,null,(0,o.__)("Options","wporg-patterns"),(0,a.createElement)(fe.Icon,{icon:Mt})),g=n?"pattern-manage-options__button is-small":"pattern-manage-options__button";return(0,a.createElement)(fe.DropdownMenu,{className:"pattern-manage-options",icon:null,toggleProps:{className:g,children:d,variant:"secondary"},popoverProps:{position:"bottom center",className:"pattern-manage-options__popover"}},(()=>(0,a.createElement)(a.Fragment,null,(0,a.createElement)(fe.MenuItem,{href:p},i?(0,o.__)("Open original in editor","wporg-patterns"):(0,o.__)("Open in editor","wporg-patterns")),!r&&(0,a.createElement)(fe.MenuItem,{onClick:c},(0,o.__)("Revert to draft","wporg-patterns")),(0,a.createElement)(fe.MenuItem,{isDestructive:!0,variant:"link",onClick:u},(0,o.__)("Delete pattern","wporg-patterns")))))},Bt=e=>{let{postId:t,showOptions:n}=e;const[r,o]=(0,a.useState)(!1),[i,s]=(0,a.useState)(!1);return(0,a.createElement)("div",{className:"pattern-actions"},(0,a.createElement)("div",{className:"pattern-actions__container"},(0,a.createElement)(At,{onSuccess:()=>o(!0)}),(0,a.createElement)(Rt,{patternId:t}),n&&(0,a.createElement)($t,{patternId:t}),r&&(0,a.createElement)(It,{onClick:()=>s(!0)}),i&&(0,a.createElement)(Nt,{onFinish:()=>s(!1)})))};var Qt=function(e){let{className:t,html:n}=e;const r=(0,a.useRef)(),[i,s]=(0,a.useState)("1px"),[l,c]=(0,a.useState)(.3125),u=(e=>{let{element:t}=e;const[n,r]=(0,a.useState)(null);(0,a.useEffect)((()=>{if(!t.current)return;const e=(0,Ct.debounce)(o,200);return o(),window.addEventListener("scroll",e),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e),window.addEventListener("resize",e)}}),[t]);const o=()=>{if(!t.current)return;const e=window.innerHeight,{top:n}=t.current.getBoundingClientRect();r(n>=0&&n<=e)};return n})({element:r}),[p,d]=(0,a.useState)(!1);(0,a.useEffect)((()=>{u&&d(!0)}),[u]),(0,a.useEffect)((()=>{const e=()=>{try{s(m(r.current.clientWidth)),c(r.current.clientWidth/1200)}catch(e){}};return e(),window.addEventListener("resize",e),()=>{window.addEventListener("resize",e)}}),[]);const g={border:"none",width:"1200px",maxWidth:"none",height:`${m(1200)}px`,transform:`scale(${l})`,transformOrigin:(0,o.isRTL)()?"top right":"top left",pointerEvents:"none"};return(0,a.createElement)("div",{className:t,ref:r,style:{height:i},tabIndex:"-1"},(0,a.createElement)(he,{className:"pattern-grid__preview-iframe",style:g,bodyStyle:"overflow: hidden;",headHTML:window.__editorStyles.html},(0,a.createElement)("div",{className:"entry-content",dangerouslySetInnerHTML:{__html:p?n:""}})))},jt=e=>{let{className:t,label:n,patternId:r}=e;const{hasPermission:o,isFavorite:i}=(0,s.useSelect)((e=>(e(de).getFavorites(),{hasPermission:!!e(Ot.store).canUser("create","../../wporg/v1/pattern-favorites"),isFavorite:e(de).isFavorite(r)}))),{addFavorite:l,removeFavorite:c}=(0,s.useDispatch)(de),u=(0,a.useCallback)((()=>{i?c(r):l(r)}),[i]),p=kt()(t,"pattern-favorite-button-small",{button:o,"button-link":o,"is-favorited":i});return o?(0,a.createElement)("button",{className:p,onClick:u},(0,a.createElement)(g,{className:"pattern-favorite-button__filled"}),(0,a.createElement)("span",null,n)):(0,a.createElement)("span",{className:p},(0,a.createElement)(g,{className:"pattern-favorite-button__filled"}),(0,a.createElement)("span",null,n))},qt=function(e){let{pattern:t,showAvatar:n,showOptions:r}=e;const s=function(e){switch(e.status){case"pending-review":case"pending":return(0,o.__)("Pending","wporg-patterns");case"draft":return(0,o.__)("Draft","wporg-patterns");case"unlisted":return(0,o.__)("Declined","wporg-patterns")}return""}(t);return(0,a.createElement)("div",{className:"pattern-grid__pattern"},(0,a.createElement)("div",{className:"pattern-grid__pattern-frame"},(0,a.createElement)("a",{href:t.link,rel:"bookmark"},(0,a.createElement)("span",{className:"screen-reader-text"},(0,i.decodeEntities)(t.title.rendered)),(0,a.createElement)(fe.Disabled,null,(0,a.createElement)(Qt,{className:"pattern-grid__preview",html:t.content.rendered}))),s?(0,a.createElement)("div",{className:`pattern-grid__status is-${t.status}`},(0,a.createElement)("span",null,s)):null,(0,a.createElement)("span",{className:"pattern-grid__actions"},(0,a.createElement)(Rt,{showLabel:!1,patternId:t.id}),r&&(0,a.createElement)($t,{isSmall:!0,patternId:t.id}),(0,a.createElement)(At,{isSmall:!0,content:t.pattern_content}))),(0,a.createElement)("h2",{className:"pattern-grid__title"},(0,a.createElement)("a",{href:t.link},(0,i.decodeEntities)(t.title.rendered))),(0,a.createElement)("p",{className:"pattern-grid__meta"},n&&t.author_meta?(0,a.createElement)("a",{href:t.author_meta.url,className:"pattern-grid__author-avatar"},(0,a.createElement)("img",{alt:"",src:t.author_meta.avatar}),t.author_meta.name):null,t.favorite_count>0?(0,a.createElement)(jt,{className:"pattern-grid__favorite-count",patternId:t.id,label:(0,a.createElement)(a.Fragment,null,(0,a.createElement)("span",{className:"screen-reader-text"},(0,o.sprintf)(
    55/* translators: %s is the favorite count for a pattern. */
    6 (0,o._n)("Favorited %s times","Favorited %s times",t.favorite_count,"wporg-patterns"),t.favorite_count)),(0,a.createElement)("span",{"aria-hidden":!0},t.favorite_count))}):null))},Kt=function(e){let{icon:t,size:n=24,...r}=e;return(0,a.cloneElement)(t,{width:n,height:n,...r})},Vt=(0,a.createElement)(d.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(d.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"}));const Gt=(e,t)=>{switch(t.status){case"submitting":return{isSubmitting:!0};case"submitted":return{isSubmitted:!0};case"error":return{hasError:!0,message:t.message};default:return{}}};var Wt=e=>{let{postId:t,onClose:n}=e;const[r,i]=(0,a.useReducer)(Gt,{}),[l,c]=(0,a.useState)(""),[u,p]=(0,a.useState)(""),d=(0,a.useRef)(),g=(0,o.__)("Your report has been submitted.","wporg-patterns"),{isLoading:m,mappedReasons:f}=(0,s.useSelect)((e=>{const{getPatternFlagReasons:t,isLoadingPatternFlagReasons:n}=e(de),r=t()||[];return{isLoading:n(),mappedReasons:r.sort(((e,t)=>{switch(!0){case e.slug<t.slug:return-1;case e.slug>t.slug:return 1;default:return 0}})).map((e=>({label:e.name,value:e.id.toString()})))}})),h=()=>{n(r.isSubmitted)};return(0,a.createElement)(fe.Modal,{className:"pattern-report-modal "+(r.isSubmitted?"":"pattern-report-modal__has-fixed-height"),title:(0,o.__)("Report this pattern","wporg-patterns"),onRequestClose:h},(0,a.createElement)("div",{ref:d},m?(0,a.createElement)(fe.Spinner,null):r.isSubmitted?(0,a.createElement)("p",{className:"pattern-report-modal__copy"},g):(0,a.createElement)("form",{onSubmit:e=>{e.preventDefault(),l&&u.length&&!r.isSubmitted&&!r.isSubmitting&&(i({status:"submitting"}),Mt()({path:(0,v.addQueryArgs)("/wp/v2/wporg-pattern-flag"),method:"POST",data:{parent:t,"wporg-pattern-flag-reason":l,excerpt:u}}).then((()=>{i({status:"submitted"}),(0,At.speak)(g),d.current.closest('[role="dialog"]').focus()})).catch((e=>{i({status:"error",message:e.message}),(0,At.speak)((0,o.sprintf)(
     6(0,o._n)("Favorited %s times","Favorited %s times",t.favorite_count,"wporg-patterns"),t.favorite_count)),(0,a.createElement)("span",{"aria-hidden":!0},t.favorite_count))}):null))},Ut=function(e){let{icon:t,size:n=24,...r}=e;return(0,a.cloneElement)(t,{width:n,height:n,...r})},Kt=(0,a.createElement)(d.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(d.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"}));const Vt=(e,t)=>{switch(t.status){case"submitting":return{isSubmitting:!0};case"submitted":return{isSubmitted:!0};case"error":return{hasError:!0,message:t.message};default:return{}}};var Gt=e=>{let{postId:t,onClose:n}=e;const[r,i]=(0,a.useReducer)(Vt,{}),[l,c]=(0,a.useState)(""),[u,p]=(0,a.useState)(""),d=(0,a.useRef)(),g=(0,o.__)("Your report has been submitted.","wporg-patterns"),{isLoading:m,mappedReasons:f}=(0,s.useSelect)((e=>{const{getPatternFlagReasons:t,isLoadingPatternFlagReasons:n}=e(de),r=t()||[];return{isLoading:n(),mappedReasons:r.sort(((e,t)=>{switch(!0){case e.slug<t.slug:return-1;case e.slug>t.slug:return 1;default:return 0}})).map((e=>({label:e.name,value:e.id.toString()})))}})),h=()=>{n(r.isSubmitted)};return(0,a.createElement)(fe.Modal,{className:"pattern-report-modal "+(r.isSubmitted?"":"pattern-report-modal__has-fixed-height"),title:(0,o.__)("Report this pattern","wporg-patterns"),onRequestClose:h},(0,a.createElement)("div",{ref:d},m?(0,a.createElement)(fe.Spinner,null):r.isSubmitted?(0,a.createElement)("p",{className:"pattern-report-modal__copy"},g):(0,a.createElement)("form",{onSubmit:e=>{e.preventDefault(),l&&u.length&&!r.isSubmitted&&!r.isSubmitting&&(i({status:"submitting"}),Ft()({path:(0,v.addQueryArgs)("/wp/v2/wporg-pattern-flag"),method:"POST",data:{parent:t,"wporg-pattern-flag-reason":l,excerpt:u}}).then((()=>{i({status:"submitted"}),(0,xt.speak)(g),d.current.closest('[role="dialog"]').focus()})).catch((e=>{i({status:"error",message:e.message}),(0,xt.speak)((0,o.sprintf)(
    77/* translators: %s: Error message. */
    8 (0,o.__)("Error: %s","wporg-patterns"),e.message))})))}},(0,a.createElement)(fe.RadioControl,{className:"pattern-report-modal__radio",label:(0,o.__)("Please choose a reason:","wporg-patterns"),selected:l,options:f,onChange:c,required:!0}),(0,a.createElement)(fe.TextareaControl,{label:(0,o.__)("Please provide details (required)","wporg-patterns"),value:u,onChange:p,required:!0}),r.hasError&&(0,a.createElement)("div",{className:"notice notice-large notice-alt notice-error"},r.message),(0,a.createElement)("div",{className:"pattern-report-modal__actions"},(0,a.createElement)(fe.Button,{isSecondary:!0,onClick:h},(0,o.__)("Cancel","wporg-patterns")),(0,a.createElement)(fe.Button,{type:"submit",isBusy:r.isSubmitting,isPrimary:!0},r.isSubmitting?(0,o.__)("Submitting …","wporg-patterns"):(0,o.__)("Report","wporg-patterns"))))))},Ht=e=>{let{postId:t,userHasReported:n}=e;const[r,i]=(0,a.useState)(!1),[s,l]=(0,a.useState)(!1),c=n||s,u=!!wporgPatternsData.userId;return c?(0,a.createElement)("p",{className:"pattern-report-button__copy"},(0,a.createElement)(Kt,{icon:Vt}),(0,o.__)("You've reported this pattern","wporg-patterns")):u?(0,a.createElement)(a.Fragment,null,(0,a.createElement)(fe.Button,{className:"pattern-report-button",isLink:!0,onClick:()=>i(!0)},(0,o.__)("Report this pattern","wporg-patterns")),r&&(0,a.createElement)(Wt,{postId:t,onClose:e=>{i(!1),l(e)}})):(0,a.createElement)("p",{className:"pattern-report-button__copy"},(0,a.createElement)("a",{href:(0,v.addQueryArgs)("/wp-login.php",{redirect_to:window.location.pathname})},(0,o.__)("Login to report this pattern","wporg-patterns")))};function zt(e){var t;let{pattern:n}=e;const[r,i]=(0,a.useState)(!1),s=()=>i(!0),l=()=>i(!1);switch(n.status){case"pending-review":case"pending":return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(fe.Notice,{className:"pattern__status-notice",status:"warning",isDismissible:!1,actions:[{label:(0,o.__)("Learn More","wporg-patterns"),onClick:s,variant:"secondary"}]},(0,a.createElement)("p",null,(0,a.createElement)("strong",null,(0,o.__)("Review pending.","wporg-patterns")),(0,o.__)("This pattern is only visible to you. Once approved it will be published to everyone.","wporg-patterns"))),r&&(0,a.createElement)(fe.Modal,{title:(0,o.__)("Review Pending","wporg-patterns"),onRequestClose:l,className:"pattern__status-notice-modal"},(0,a.createElement)("p",null,(0,o.__)("All patterns submitted to WordPress.org are subject to both automated and manual approval. It might take a few days for your pattern to be approved.","wporg-patterns")),(0,a.createElement)("p",null,(0,o.__)("Reviewers look for content that may be problematic (copyright or trademark issues) and whether your pattern works as intended.","wporg-patterns"))));case"draft":return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(fe.Notice,{className:"pattern__status-notice",status:"info",isDismissible:!1,actions:[{label:(0,o.__)("Learn More","wporg-patterns"),onClick:s,variant:"secondary"}]},(0,a.createElement)("p",null,(0,a.createElement)("strong",null,(0,o.__)("Saved as draft.","wporg-patterns")),(0,o.__)("This pattern is only visible to you. When you’re ready, submit it to be published to everyone.","wporg-patterns"))),r&&(0,a.createElement)(fe.Modal,{title:(0,o.__)("Drafts","wporg-patterns"),onRequestClose:l,className:"pattern__status-notice-modal"},(0,a.createElement)("p",null,(0,o.__)("Patterns can be saved as a draft which can be submitted for approval at any time. This allows you to save your design and come back to it later to submit.","wporg-patterns"))));case"unlisted":return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(fe.Notice,{className:"pattern__status-notice",status:"error",isDismissible:!1,actions:[{label:(0,o.__)("Learn More","wporg-patterns"),onClick:s,variant:"secondary"}]},(0,a.createElement)("p",null,(0,a.createElement)("strong",null,(0,o.__)("Pattern declined.","wporg-patterns")),(0,o.__)("WordPress.org has chosen not to include this pattern in the directory.","wporg-patterns"))),r&&(0,a.createElement)(fe.Modal,{title:(0,o.__)("Declined","wporg-patterns"),onRequestClose:l,className:"pattern__status-notice-modal"},(0,a.createElement)("p",null,(0,o.__)("WordPress.org has removed your pattern from the directory for the following reason:","wporg-patterns")),(0,a.createElement)("p",null,(0,a.createElement)("em",{dangerouslySetInnerHTML:{__html:(null===(t=n.unlisted_reason)||void 0===t?void 0:t.description)||(0,o.__)("This pattern doesn't meet the guidelines for the pattern directory.","wporg-patterns")}})),(0,a.createElement)("p",null,(0,o.__)("You can update your pattern to resubmit it for approval at any time.","wporg-patterns"))));case"publish":return(0,a.createElement)(fe.Notice,{className:"pattern__status-notice",status:"success",isDismissible:!1},(0,a.createElement)("p",null,(0,a.createElement)("strong",null,(0,o.__)("Pattern published!","wporg-patterns")),(0,o.__)("Your new design is now available to everyone.","wporg-patterns")))}return null}var Yt=e=>{let{postId:t,userHasReported:n}=e;t=Number(t)||0;const{pattern:r,categories:c}=(0,s.useSelect)((e=>{const n=e(de).getPattern(t),r=e(de).getCategories()||[],a=null==n?void 0:n["pattern-categories"].map((e=>r.find((t=>{let{id:n}=t;return n===e})))).filter(Boolean);return{pattern:n,categories:a||[]}}),[t]);if(!r)return null;const u=window.wporgPatternsData.userId===r.author;return(0,a.createElement)(a.Fragment,null,(0,a.createElement)("header",{className:"entry-header"},u&&(0,a.createElement)(zt,{pattern:r}),(0,a.createElement)("h1",{className:"entry-title"},(0,i.decodeEntities)(r.title.rendered)),(0,a.createElement)("div",{className:"pattern__categories"},c.map((e=>{let{id:t,name:n,link:r}=e;return(0,a.createElement)("a",{href:r,key:t},(0,i.decodeEntities)(n))})))),(0,a.createElement)(Qt,{postId:t,showOptions:u}),(0,a.createElement)("div",{className:"pattern-preview__container"},(0,a.createElement)(Pt,{blockContent:r.content.rendered}),(0,a.createElement)("div",{className:"pattern__meta"},(0,a.createElement)(Ht,{userHasReported:"true"===n,postId:t}))),(0,a.createElement)("div",{className:"pattern__related-patterns"},(0,a.createElement)(ge,{query:{author:r.author,per_page:3,exclude:t},showPagination:!1,header:(0,a.createElement)(a.Fragment,null,(0,a.createElement)("h2",null,(0,o.__)("More from this designer","wporg-patterns")),(0,a.createElement)(l,r.author_meta))},(e=>(0,a.createElement)(Ut,{key:e.id,pattern:e})))))};const Xt=e=>{const t=document.getElementById("breadcrumb-part");t&&(t.innerText=e)};var Jt=()=>{const{path:e}=S(),{authorName:t,categoryName:n}=(0,s.useSelect)((t=>{const n=t(de).getQueryFromUrl(e),r=t(de).getCategoryById(n["pattern-categories"]);return{authorName:wporgPatternsData.currentAuthorName||(null==n?void 0:n.author_name),categoryName:null==r?void 0:r.name}}),[]);return(0,a.useEffect)((()=>{t?
     8(0,o.__)("Error: %s","wporg-patterns"),e.message))})))}},(0,a.createElement)(fe.RadioControl,{className:"pattern-report-modal__radio",label:(0,o.__)("Please choose a reason:","wporg-patterns"),selected:l,options:f,onChange:c,required:!0}),(0,a.createElement)(fe.TextareaControl,{label:(0,o.__)("Please provide details (required)","wporg-patterns"),value:u,onChange:p,required:!0}),r.hasError&&(0,a.createElement)("div",{className:"notice notice-large notice-alt notice-error"},r.message),(0,a.createElement)("div",{className:"pattern-report-modal__actions"},(0,a.createElement)(fe.Button,{isSecondary:!0,onClick:h},(0,o.__)("Cancel","wporg-patterns")),(0,a.createElement)(fe.Button,{type:"submit",isBusy:r.isSubmitting,isPrimary:!0},r.isSubmitting?(0,o.__)("Submitting …","wporg-patterns"):(0,o.__)("Report","wporg-patterns"))))))},zt=e=>{let{postId:t,userHasReported:n}=e;const[r,i]=(0,a.useState)(!1),[s,l]=(0,a.useState)(!1),c=n||s,u=!!wporgPatternsData.userId;return c?(0,a.createElement)("p",{className:"pattern-report-button__copy"},(0,a.createElement)(Ut,{icon:Kt}),(0,o.__)("You've reported this pattern","wporg-patterns")):u?(0,a.createElement)(a.Fragment,null,(0,a.createElement)(fe.Button,{className:"pattern-report-button",isLink:!0,onClick:()=>i(!0)},(0,o.__)("Report this pattern","wporg-patterns")),r&&(0,a.createElement)(Gt,{postId:t,onClose:e=>{i(!1),l(e)}})):(0,a.createElement)("p",{className:"pattern-report-button__copy"},(0,a.createElement)("a",{href:(0,v.addQueryArgs)("/wp-login.php",{redirect_to:window.location.pathname})},(0,o.__)("Login to report this pattern","wporg-patterns")))};function Wt(e){var t;let{pattern:n}=e;const[r,i]=(0,a.useState)(!1),s=()=>i(!0),l=()=>i(!1);switch(n.status){case"pending-review":case"pending":return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(fe.Notice,{className:"pattern__status-notice",status:"warning",isDismissible:!1,actions:[{label:(0,o.__)("Learn More","wporg-patterns"),onClick:s,variant:"secondary"}]},(0,a.createElement)("p",null,(0,a.createElement)("strong",null,(0,o.__)("Review pending.","wporg-patterns")),(0,o.__)("This pattern is only visible to you. Once approved it will be published to everyone.","wporg-patterns"))),r&&(0,a.createElement)(fe.Modal,{title:(0,o.__)("Review Pending","wporg-patterns"),onRequestClose:l,className:"pattern__status-notice-modal"},(0,a.createElement)("p",null,(0,o.__)("All patterns submitted to WordPress.org are subject to both automated and manual approval. It might take a few days for your pattern to be approved.","wporg-patterns")),(0,a.createElement)("p",null,(0,o.__)("Reviewers look for content that may be problematic (copyright or trademark issues) and whether your pattern works as intended.","wporg-patterns"))));case"draft":return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(fe.Notice,{className:"pattern__status-notice",status:"info",isDismissible:!1,actions:[{label:(0,o.__)("Learn More","wporg-patterns"),onClick:s,variant:"secondary"}]},(0,a.createElement)("p",null,(0,a.createElement)("strong",null,(0,o.__)("Saved as draft.","wporg-patterns")),(0,o.__)("This pattern is only visible to you. When you’re ready, submit it to be published to everyone.","wporg-patterns"))),r&&(0,a.createElement)(fe.Modal,{title:(0,o.__)("Drafts","wporg-patterns"),onRequestClose:l,className:"pattern__status-notice-modal"},(0,a.createElement)("p",null,(0,o.__)("Patterns can be saved as a draft which can be submitted for approval at any time. This allows you to save your design and come back to it later to submit.","wporg-patterns"))));case"unlisted":return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(fe.Notice,{className:"pattern__status-notice",status:"error",isDismissible:!1,actions:[{label:(0,o.__)("Learn More","wporg-patterns"),onClick:s,variant:"secondary"}]},(0,a.createElement)("p",null,(0,a.createElement)("strong",null,(0,o.__)("Pattern declined.","wporg-patterns")),(0,o.__)("WordPress.org has chosen not to include this pattern in the directory.","wporg-patterns"))),r&&(0,a.createElement)(fe.Modal,{title:(0,o.__)("Declined","wporg-patterns"),onRequestClose:l,className:"pattern__status-notice-modal"},(0,a.createElement)("p",null,(0,o.__)("WordPress.org has removed your pattern from the directory for the following reason:","wporg-patterns")),(0,a.createElement)("p",null,(0,a.createElement)("em",{dangerouslySetInnerHTML:{__html:(null===(t=n.unlisted_reason)||void 0===t?void 0:t.description)||(0,o.__)("This pattern doesn't meet the guidelines for the pattern directory.","wporg-patterns")}})),(0,a.createElement)("p",null,(0,o.__)("You can update your pattern to resubmit it for approval at any time.","wporg-patterns"))));case"publish":return(0,a.createElement)(fe.Notice,{className:"pattern__status-notice",status:"success",isDismissible:!1},(0,a.createElement)("p",null,(0,a.createElement)("strong",null,(0,o.__)("Pattern published!","wporg-patterns")),(0,o.__)("Your new design is now available to everyone.","wporg-patterns")))}return null}var Ht=e=>{let{postId:t,userHasReported:n}=e;t=Number(t)||0;const{pattern:r,categories:c}=(0,s.useSelect)((e=>{const n=e(de).getPattern(t),r=e(de).getCategories()||[],a=null==n?void 0:n["pattern-categories"].map((e=>r.find((t=>{let{id:n}=t;return n===e})))).filter(Boolean);return{pattern:n,categories:a||[]}}),[t]);if(!r)return null;const u=window.wporgPatternsData.userId===r.author;return(0,a.createElement)(a.Fragment,null,(0,a.createElement)("header",{className:"entry-header"},u&&(0,a.createElement)(Wt,{pattern:r}),(0,a.createElement)("h1",{className:"entry-title"},(0,i.decodeEntities)(r.title.rendered)),(0,a.createElement)("div",{className:"pattern__categories"},c.map((e=>{let{id:t,name:n,link:r}=e;return(0,a.createElement)("a",{href:r,key:t},(0,i.decodeEntities)(n))})))),(0,a.createElement)(Bt,{postId:t,showOptions:u}),(0,a.createElement)("div",{className:"pattern-preview__container"},(0,a.createElement)(St,{blockContent:r.content.rendered}),(0,a.createElement)("div",{className:"pattern__meta"},(0,a.createElement)(zt,{userHasReported:"true"===n,postId:t}))),(0,a.createElement)("div",{className:"pattern__related-patterns"},(0,a.createElement)(ge,{query:{author:r.author,per_page:3,exclude:t},showPagination:!1,header:(0,a.createElement)(a.Fragment,null,(0,a.createElement)("h2",null,(0,o.__)("More from this designer","wporg-patterns")),(0,a.createElement)(l,r.author_meta))},(e=>(0,a.createElement)(qt,{key:e.id,pattern:e})))))};const Yt=e=>{const t=document.getElementById("breadcrumb-part");t&&(t.innerText=e)};var Xt=()=>{const{path:e}=S(),{authorName:t,categoryName:n}=(0,s.useSelect)((t=>{const n=t(de).getQueryFromUrl(e),r=t(de).getCategoryById(n["pattern-categories"]);return{authorName:wporgPatternsData.currentAuthorName||(null==n?void 0:n.author_name),categoryName:null==r?void 0:r.name}}),[]);return(0,a.useEffect)((()=>{t?
    99// translators: %s is the author name.
    10 Xt((0,o.sprintf)((0,o.__)("Author: %s","wporg-patterns"),t)):n&&
     10Yt((0,o.sprintf)((0,o.__)("Author: %s","wporg-patterns"),t)):n&&
    1111// translators: %s is the category name.
    12 Xt((0,o.sprintf)((0,o.__)("Category: %s","wporg-patterns"),n))}),[e]),null},Zt=Object.prototype.hasOwnProperty;function en(e,t,n){for(n of e.keys())if(tn(n,t))return n}function tn(e,t){var n,r,a;if(e===t)return!0;if(e&&t&&(n=e.constructor)===t.constructor){if(n===Date)return e.getTime()===t.getTime();if(n===RegExp)return e.toString()===t.toString();if(n===Array){if((r=e.length)===t.length)for(;r--&&tn(e[r],t[r]););return-1===r}if(n===Set){if(e.size!==t.size)return!1;for(r of e){if((a=r)&&"object"==typeof a&&!(a=en(t,a)))return!1;if(!t.has(a))return!1}return!0}if(n===Map){if(e.size!==t.size)return!1;for(r of e){if((a=r[0])&&"object"==typeof a&&!(a=en(t,a)))return!1;if(!tn(r[1],t.get(a)))return!1}return!0}if(n===ArrayBuffer)e=new Uint8Array(e),t=new Uint8Array(t);else if(n===DataView){if((r=e.byteLength)===t.byteLength)for(;r--&&e.getInt8(r)===t.getInt8(r););return-1===r}if(ArrayBuffer.isView(e)){if((r=e.byteLength)===t.byteLength)for(;r--&&e[r]===t[r];);return-1===r}if(!n||"object"==typeof e){for(n in r=0,e){if(Zt.call(e,n)&&++r&&!Zt.call(t,n))return!1;if(!(n in t)||!tn(e[n],t[n]))return!1}return Object.keys(t).length===r}}return e!=e&&t!=t}function nn(e,t){return _e.useEffect(e,(n=t,r=_e.useRef(n),a=_e.useRef(0),tn(n,r.current)||(r.current=n,a.current+=1),_e.useMemo((function(){return r.current}),[a.current])));var n,r,a}const rn=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===t?"":(0,o.sprintf)((0,o.__)("Page %1$d of %2$d.","wporg-patterns"),e,t)
    13 /* translators: %1$d: current page. %2$d: total number of pages.  */};var an=function(e){const{path:t}=S(),[n,r]=(0,a.useState)(),[i]=(0,a.useState)({title:"",links:[]}),{author:l,category:c,count:u,isLoadingPatterns:p,pageLabel:d,query:g}=(0,s.useSelect)((n=>{const{getCategoryById:r,getPatternTotalsByQuery:a,getPatternTotalPagesByQuery:o,getQueryFromUrl:i,isLoadingPatternsByQuery:s}=n(de),l={...i(t),...e.query},c=s(l);return{author:wporgPatternsData.currentAuthorName||(null==l?void 0:l.author_name),category:r(l["pattern-categories"]),count:a(l),isLoadingPatterns:c,pageLabel:l&&!c?rn(l.page,o(l)):"",query:l}}),[t,e.query]);nn((()=>{if(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return!e.hasOwnProperty("include")||e.include.length>0}(g)&&p)return void r((e=>{let{category:t,author:n}=e;return t&&n?(0,a.createInterpolateElement)((0,o.sprintf)(
     12Yt((0,o.sprintf)((0,o.__)("Category: %s","wporg-patterns"),n))}),[e]),null},Jt=Object.prototype.hasOwnProperty;function Zt(e,t,n){for(n of e.keys())if(en(n,t))return n}function en(e,t){var n,r,a;if(e===t)return!0;if(e&&t&&(n=e.constructor)===t.constructor){if(n===Date)return e.getTime()===t.getTime();if(n===RegExp)return e.toString()===t.toString();if(n===Array){if((r=e.length)===t.length)for(;r--&&en(e[r],t[r]););return-1===r}if(n===Set){if(e.size!==t.size)return!1;for(r of e){if((a=r)&&"object"==typeof a&&!(a=Zt(t,a)))return!1;if(!t.has(a))return!1}return!0}if(n===Map){if(e.size!==t.size)return!1;for(r of e){if((a=r[0])&&"object"==typeof a&&!(a=Zt(t,a)))return!1;if(!en(r[1],t.get(a)))return!1}return!0}if(n===ArrayBuffer)e=new Uint8Array(e),t=new Uint8Array(t);else if(n===DataView){if((r=e.byteLength)===t.byteLength)for(;r--&&e.getInt8(r)===t.getInt8(r););return-1===r}if(ArrayBuffer.isView(e)){if((r=e.byteLength)===t.byteLength)for(;r--&&e[r]===t[r];);return-1===r}if(!n||"object"==typeof e){for(n in r=0,e){if(Jt.call(e,n)&&++r&&!Jt.call(t,n))return!1;if(!(n in t)||!en(e[n],t[n]))return!1}return Object.keys(t).length===r}}return e!=e&&t!=t}function tn(e,t){return ye.useEffect(e,(n=t,r=ye.useRef(n),a=ye.useRef(0),en(n,r.current)||(r.current=n,a.current+=1),ye.useMemo((function(){return r.current}),[a.current])));var n,r,a}const nn=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===t?"":(0,o.sprintf)((0,o.__)("Page %1$d of %2$d.","wporg-patterns"),e,t)
     13/* translators: %1$d: current page. %2$d: total number of pages.  */};var rn=function(e){const{path:t}=S(),[n,r]=(0,a.useState)(),[i]=(0,a.useState)({title:"",links:[]}),{author:l,category:c,count:u,isLoadingPatterns:p,pageLabel:d,query:g}=(0,s.useSelect)((n=>{const{getCategoryById:r,getPatternTotalsByQuery:a,getPatternTotalPagesByQuery:o,getQueryFromUrl:i,isLoadingPatternsByQuery:s}=n(de),l={...i(t),...e.query},c=s(l);return{author:wporgPatternsData.currentAuthorName||(null==l?void 0:l.author_name),category:r(l["pattern-categories"]),count:a(l),isLoadingPatterns:c,pageLabel:l&&!c?nn(l.page,o(l)):"",query:l}}),[t,e.query]);tn((()=>{if(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return!e.hasOwnProperty("include")||e.include.length>0}(g)&&p)return void r((e=>{let{category:t,author:n}=e;return t&&n?(0,a.createInterpolateElement)((0,o.sprintf)(
    1414/* translators: %1$s category name, %2$s author name. */
    1515(0,o.__)("Loading <b>%1$s</b> patterns by %2$s.","wporg-patterns"),t,n),{b:(0,a.createElement)("b",null)}):t?(0,a.createInterpolateElement)((0,o.sprintf)(
     
    2525(0,o._n)("%1$d <b>%2$s</b> pattern.","%1$d <b>%2$s</b> patterns.",t,"wporg-patterns"),t,n,"wporg-patterns"),{b:(0,a.createElement)("b",null)}):r?(0,a.createInterpolateElement)((0,o.sprintf)(
    2626/* translators: %1$d: number of patterns, %2$s author name. */
    27 (0,o._n)("%1$d pattern by <b>%2$s</b>.","%1$d patterns by <b>%2$s</b>.",t,"wporg-patterns"),t,r),{b:(0,a.createElement)("b",null)}):(0,o.__)("Loading patterns","wporg-patterns")})({category:null==c?void 0:c.name,author:l},u)),null!=g&&g.include&&!c&&r(""))}),[g,p]);const m=Ct()({"context-bar__spinner":!0,"context-bar__spinner--is-hidden":!p||e.isEmpty});return(0,a.createElement)("div",{className:n?null:"screen-reader-text"},(0,a.createElement)("header",{className:"context-bar","aria-live":"polite","aria-atomic":"true",tabIndex:"0"},(0,a.createElement)("h2",{className:"context-bar__copy"},(0,a.createElement)("span",{className:m},(0,a.createElement)(fe.Spinner,null)),(0,a.createElement)("span",null,n||(0,o.__)("All patterns.","wporg-patterns")),d&&(0,a.createElement)("span",{className:"screen-reader-text"},d)),i.links&&i.links.length>0&&(0,a.createElement)("div",{className:"context-bar__links"},(0,a.createElement)("h3",{className:"context-bar__title"},i.title),(0,a.createElement)("ul",null,i.links.map((e=>(0,a.createElement)("li",{key:e.href},(0,a.createElement)("a",{href:e.href},e.label))))))))},on=()=>{const{path:e}=S(),t=(0,s.useSelect)((t=>{var n;const r=t(de).getQueryFromUrl(e),a=null===(n=t(de).getCategoryById(r["pattern-categories"]))||void 0===n?void 0:n.name,i=wporgPatternsData.currentAuthorName||(null==r?void 0:r.author_name),s=w(e),l=y(e).replace(/^\/patterns/,"").split("/")[1]||"",c=[];return"categories"===l&&a?c.push(
     27(0,o._n)("%1$d pattern by <b>%2$s</b>.","%1$d patterns by <b>%2$s</b>.",t,"wporg-patterns"),t,r),{b:(0,a.createElement)("b",null)}):(0,o.__)("Loading patterns","wporg-patterns")})({category:null==c?void 0:c.name,author:l},u)),null!=g&&g.include&&!c&&r(""))}),[g,p]);const m=kt()({"context-bar__spinner":!0,"context-bar__spinner--is-hidden":!p||e.isEmpty});return(0,a.createElement)("div",{className:n?null:"screen-reader-text"},(0,a.createElement)("header",{className:"context-bar","aria-live":"polite","aria-atomic":"true",tabIndex:"0"},(0,a.createElement)("h2",{className:"context-bar__copy"},(0,a.createElement)("span",{className:m},(0,a.createElement)(fe.Spinner,null)),(0,a.createElement)("span",null,n||(0,o.__)("All patterns.","wporg-patterns")),d&&(0,a.createElement)("span",{className:"screen-reader-text"},d)),i.links&&i.links.length>0&&(0,a.createElement)("div",{className:"context-bar__links"},(0,a.createElement)("h3",{className:"context-bar__title"},i.title),(0,a.createElement)("ul",null,i.links.map((e=>(0,a.createElement)("li",{key:e.href},(0,a.createElement)("a",{href:e.href},e.label))))))))},an=()=>{const{path:e}=S(),t=(0,s.useSelect)((t=>{var n;const r=t(de).getQueryFromUrl(e),a=null===(n=t(de).getCategoryById(r["pattern-categories"]))||void 0===n?void 0:n.name,i=wporgPatternsData.currentAuthorName||(null==r?void 0:r.author_name),s=w(e),l=y(e).replace(/^\/patterns/,"").split("/")[1]||"",c=[];return"categories"===l&&a?c.push(
    2828/* translators: Taxonomy term name */
    2929(0,o.sprintf)((0,o.__)("Block Patterns: %s","wporg-patterns"),a)):"author"===l&&i?c.push(
     
    3131(0,o.sprintf)((0,o.__)("Block Patterns by %s","wporg-patterns"),i)):c.push((0,o.__)("Block Pattern Directory","wporg-patterns")),s>1&&c.push(
    3232/* translators: Page number */
    33 (0,o.sprintf)((0,o.__)("Page %d","wporg-patterns"),s)),c.push((0,o.__)("WordPress.org","wporg-patterns")+` ${wporgLocale.displayName}`),c.join(" | ")}));return(0,a.useEffect)((()=>{t&&(document.title=t)}),[t]),null},sn=function(){return(0,a.createElement)("div",{className:"pattern-grid__empty-header"},(0,a.createElement)("h2",null,(0,o.__)("No results found","wporg-patterns")),(0,a.createElement)("p",null,(0,a.createInterpolateElement)((0,o.__)("View <a>all block patterns</a> or browse some of our recent patterns.","wporg-patterns"),{a:(0,a.createElement)("a",{href:wporgPatternsUrl.site})})))},ln=e=>{let{options:t}=e;const{path:n,replace:r}=S(),i=(0,me.useViewportMatch)("medium",">=");return t?(0,a.createElement)("div",{className:"pattern-order-select"},(0,a.createElement)(fe.SelectControl,{label:(0,o.__)("Order by","wporg-patterns"),labelPosition:"side",hideLabelFromVision:i,value:(0,v.getQueryArg)(window.location.href,"orderby"),options:t,onChange:e=>{r((0,v.addQueryArgs)(n,{orderby:e}).replace(/\/page\/[\d]+/,""))}})):null},cn=()=>(0,a.createElement)(c,{className:"pattern-menu",style:{flexDirection:"row"}},Array(7).fill().map(((e,t)=>(0,a.createElement)(u,{key:t,height:"1.25rem",width:"5rem",marginRight:"1rem"})))),un=e=>{let{current:t,isLoading:n,label:r=(0,o.__)("Main Menu","wporg-patterns"),onClick:i,options:s}=e;return n?(0,a.createElement)(cn,null):s.length?(0,a.createElement)("nav",null,(0,a.createElement)("h2",{className:"screen-reader-text"},r),(0,a.createElement)("ul",{className:"pattern-menu"},s.map((e=>(0,a.createElement)("li",{key:e.value},(0,a.createElement)("a",{className:Ct()({"pattern-menu__item":!0,"is-active":t===e.slug}),href:e.value,onClick:i,"aria-current":t===e.slug?"page":void 0},e.label)))))):null},pn=e=>{let{onClick:t,options:n,label:r=(0,o.__)("Browse categories","wporg-patterns")}=e;const[i,s]=(0,a.useState)(!1);return(0,a.createElement)(fe.PanelBody,{className:"pattern-menu is-mobile",title:r,initialOpen:i,opened:i,onToggle:()=>s(!i)},(0,a.createElement)("ul",null,n.map((e=>(0,a.createElement)("li",{key:e.value},(0,a.createElement)("a",{href:e.value,onClick:e=>{s(!1),t(e)}},e.label))))))},dn=e=>(0,me.useViewportMatch)("medium","<")?(0,a.createElement)(pn,e):(0,a.createElement)(un,e),gn=e=>{let{primary:t,secondary:n}=e;return(0,a.createElement)("div",{className:"pattern-navigation-layout"},t&&(0,a.createElement)("div",{className:"pattern-navigation-layout__primary"},t),n&&(0,a.createElement)("div",{className:"pattern-navigation-layout__secondary"},n))},mn=e=>{let{basePath:t="",onNavigation:n,...r}=e;const{path:i,update:l}=S(),{categorySlug:c,isLoading:u,options:p}=(0,s.useSelect)((e=>{var n;const{getCategoryById:r,getCategories:a,getQueryFromUrl:o,getUrlFromQuery:s,isLoadingCategories:l}=e(de),c=o(i);delete c.page;const u=(a()||[]).map((e=>({value:s({...c,"pattern-categories":e.id},wporgPatternsUrl.site+t),slug:e.slug,label:e.name})));return{categorySlug:(null===(n=r(c["pattern-categories"]))||void 0===n?void 0:n.slug)||"",isLoading:l(),options:u}}));return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(gn,{primary:(0,a.createElement)(dn,{current:c,options:p||[],onClick:e=>{e.preventDefault(),l(e.target.pathname),"function"==typeof n&&n()},isLoading:u}),secondary:(0,a.createElement)(ln,{options:[{label:(0,o.__)("Newest","wporg-patterns"),value:"date"},{label:(0,o.__)("Popular","wporg-patterns"),value:"favorite_count"}]})}),(0,a.createElement)(an,r))},fn=()=>{const{setCurrentQuery:e}=(0,s.useDispatch)(de),{path:t}=S(),n=(0,s.useSelect)((e=>e(de).getQueryFromUrl(t)),[t]);return nn((()=>{e(n)}),[n]),null},hn=window.wp.dom;function vn(){const e=(0,a.useRef)(),t=(0,a.useCallback)((()=>{if(null==e||!e.current)return;const t=hn.focus.tabbable.find(e.current),n=t[t.length-1]||!1;n&&n.focus(),n.focus()}),[]);return[e,t]}var yn=function(e){let{isLoggedIn:t}=e;const n=(0,v.addQueryArgs)(wporgPatternsUrl.login,{redirect_to:window.location}),r=(0,v.addQueryArgs)(wporgPatternsUrl.register,{redirect_to:window.location});return t?(0,a.createElement)("div",{className:"pattern-grid__empty-header pattern-favorites__empty-header"},(0,a.createElement)("h2",null,(0,o.__)("Collect and view your favorite patterns.","wporg-patterns")),(0,a.createElement)("p",null,(0,o.__)("Tap the heart on any pattern to mark it as a favorite. All your favorite patterns will appear here.","wporg-patterns"))):(0,a.createElement)("div",{className:"pattern-grid__empty-header pattern-favorites__empty-header"},(0,a.createElement)("h2",null,(0,o.__)("Collect and view your favorite patterns.","wporg-patterns")),(0,a.createElement)("p",null,(0,o.__)("Log in to your WordPress.org account and you’ll be able to see all your favorite patterns in one place.","wporg-patterns")),(0,a.createElement)("p",null,(0,a.createElement)("a",{className:"button button-primary button-large",href:n},(0,o.__)("Log in","wporg-patterns"))),(0,a.createElement)("p",null,(0,a.createElement)("a",{className:"button-link link-create-account",href:r},(0,o.__)("Create an account","wporg-patterns"))))};function wn(){const{path:e,update:t}=S();let n=_(e,"my-patterns");"page"===n&&(n="all");const r=[{value:`${wporgPatternsUrl.site}/my-patterns/`,slug:"all",label:(0,o.__)("All","wporg-patterns")},{value:`${wporgPatternsUrl.site}/my-patterns/draft/`,slug:"draft",label:(0,o.__)("Drafts","wporg-patterns")},{value:`${wporgPatternsUrl.site}/my-patterns/pending/`,slug:"pending",label:(0,o.__)("Pending Review","wporg-patterns")}];return(0,a.createElement)(dn,{label:(0,o.__)("Menu","wporg-patterns"),current:n||"all",options:r,onClick:e=>{e.preventDefault(),t(e.target.pathname)},isLoading:!1})}const En=document.getElementById("patterns__container");En&&(0,a.render)((0,a.createElement)((()=>{const{isEmpty:e,isSearch:t,query:n}=(0,s.useSelect)((e=>{const{getCurrentQuery:t,getPatternsByQuery:n,isLoadingPatternsByQuery:r}=e(de),a=t(),o=a&&r(a),i=a?n(a):[];return{isEmpty:!o&&!i.length,isSearch:a&&!!a.search,query:a}})),[r,o]=vn();return(0,a.createElement)(b,null,(0,a.createElement)(on,null),(0,a.createElement)(fn,null),(0,a.createElement)(Jt,null),(0,a.createElement)("div",{ref:r},t?(0,a.createElement)(an,{query:n}):(0,a.createElement)(mn,{onNavigation:o})),e?(0,a.createElement)(a.Fragment,null,(0,a.createElement)(sn,null),(0,a.createElement)(ge,{query:{per_page:6},showPagination:!1},(e=>(0,a.createElement)(Ut,{key:e.id,pattern:e,showAvatar:!0})))):(0,a.createElement)(ge,{query:n,onNavigation:o},(e=>(0,a.createElement)(Ut,{key:e.id,pattern:e,showAvatar:!0}))))}),null),En);const bn=document.getElementById("my-patterns__container");bn&&(0,a.render)((0,a.createElement)((()=>{const e=wporgPatternsData.userId,{isEmpty:t,query:n}=(0,s.useSelect)((t=>{const{getCurrentQuery:n,getPatternsByQuery:r,isLoadingPatternsByQuery:a}=t(de),o={status:"any",...n()||{},author:e};"pending"===o.status&&(o.status="pending,pending-review");const i=e&&a(o),s=e?r(o):[];return{isEmpty:!i&&!s.length,query:o}}));if(!e){const e=(0,v.addQueryArgs)(wporgPatternsUrl.login,{redirect_to:window.location});return(0,a.createElement)("div",{className:"entry-content"},(0,a.createElement)("div",{className:"alignwide",style:{maxWidth:960}},(0,a.createElement)("p",null,(0,o.__)("Please log in to view your patterns.","wporg-patterns")),(0,a.createElement)("p",null,(0,a.createElement)("a",{className:"button button-primary button-large",href:e},(0,o.__)("Log in","wporg-patterns"))),(0,a.createElement)("div",{style:{height:100},"aria-hidden":"true",className:"wp-block-spacer"})))}return(0,a.createElement)(b,null,(0,a.createElement)(fn,null),(0,a.createElement)(gn,{primary:(0,a.createElement)(wn,null),secondary:(0,a.createElement)(ln,{options:[{label:(0,o.__)("Newest","wporg-patterns"),value:"date"},{label:(0,o.__)("Favorites","wporg-patterns"),value:"favorite_count"}]})}),t?(0,a.createElement)("div",{className:"pattern-grid__empty-header"},(0,a.createElement)("h2",null,(0,o.__)("Create and share patterns for every WordPress site.","wporg-patterns")),(0,a.createElement)("p",null,(0,o.__)("Anyone can create and share patterns using the familiar block editor. Design helpful starting points for yourself and any WordPress site.","wporg-patterns")),(0,a.createElement)(fe.Button,{variant:"primary",href:`${wporgPatternsUrl.site}/new-pattern/`},(0,o.__)("Create your first pattern","wporg-patterns"))):(0,a.createElement)(ge,{query:n},(e=>(0,a.createElement)(Ut,{key:e.id,pattern:e,showOptions:!0}))))}),null),bn);const Sn=document.getElementById("pattern-favorites__container");Sn&&(0,a.render)((0,a.createElement)((()=>{const{isEmpty:e,query:t}=(0,s.useSelect)((e=>{const{getCurrentQuery:t,getFavorites:n,getPatternsByQuery:r,isLoadingPatternsByQuery:a}=e(de),o=t()||{},i=n();if(null===i)return{query:!1,isEmpty:!1};const s={...o,include:i},l=!!i.length&&a(s),c=i.length?r(s):[];return{query:s,isEmpty:!l&&!c.length}})),[n,r]=vn(),i={orderby:"favorite_count",per_page:6};t["pattern-categories"]&&(i["pattern-categories"]=t["pattern-categories"]);const l=!!wporgPatternsData.userId;return(0,a.createElement)(b,null,(0,a.createElement)(fn,null),(0,a.createElement)("div",{ref:n},l&&(0,a.createElement)(mn,{basePath:"/favorites/",query:t,onNavigation:r,isEmpty:e})),!l||e?(0,a.createElement)(a.Fragment,null,(0,a.createElement)(yn,{isLoggedIn:l}),(0,a.createElement)(ge,{header:(0,a.createElement)("h2",{className:"pattern-favorites__grid-title"},(0,o.__)("Here’s a few of our favorite patterns","wporg-patterns")),query:i,showPagination:!1},(e=>(0,a.createElement)(Ut,{key:e.id,pattern:e,showAvatar:!0})))):(0,a.createElement)(ge,{query:t,onNavigation:r},(e=>(0,a.createElement)(Ut,{key:e.id,pattern:e,showAvatar:!0}))))}),null),Sn);const Pn=document.querySelectorAll(".pattern__container");for(let e=0;e<Pn.length;e++){const t=Pn[e],n=t.dataset;(0,a.render)((0,a.createElement)(Yt,n),t,(()=>{t.hidden=!1,document.querySelectorAll(".hide-if-pattern-loaded").forEach((e=>e.hidden=!0))}))}}()}();
     33(0,o.sprintf)((0,o.__)("Page %d","wporg-patterns"),s)),c.push((0,o.__)("WordPress.org","wporg-patterns")+` ${wporgLocale.displayName}`),c.join(" | ")}));return(0,a.useEffect)((()=>{t&&(document.title=t)}),[t]),null},on=function(){return(0,a.createElement)("div",{className:"pattern-grid__empty-header"},(0,a.createElement)("h2",null,(0,o.__)("No results found","wporg-patterns")),(0,a.createElement)("p",null,(0,a.createInterpolateElement)((0,o.__)("View <a>all block patterns</a> or browse some of our recent patterns.","wporg-patterns"),{a:(0,a.createElement)("a",{href:wporgPatternsUrl.site})})))},sn=e=>{let{options:t}=e;const{path:n,replace:r}=S(),i=(0,me.useViewportMatch)("medium",">=");return t?(0,a.createElement)("div",{className:"pattern-order-select"},(0,a.createElement)(fe.SelectControl,{label:(0,o.__)("Order by","wporg-patterns"),labelPosition:"side",hideLabelFromVision:i,value:(0,v.getQueryArg)(window.location.href,"orderby"),options:t,onChange:e=>{r((0,v.addQueryArgs)(n,{orderby:e}).replace(/\/page\/[\d]+/,""))}})):null},ln=()=>(0,a.createElement)(c,{className:"pattern-menu",style:{flexDirection:"row"}},Array(7).fill().map(((e,t)=>(0,a.createElement)(u,{key:t,height:"1.25rem",width:"5rem",marginRight:"1rem"})))),cn=e=>{let{current:t,isLoading:n,label:r=(0,o.__)("Main Menu","wporg-patterns"),onClick:i,options:s}=e;return n?(0,a.createElement)(ln,null):s.length?(0,a.createElement)("nav",null,(0,a.createElement)("h2",{className:"screen-reader-text"},r),(0,a.createElement)("ul",{className:"pattern-menu"},s.map((e=>(0,a.createElement)("li",{key:e.value},(0,a.createElement)("a",{className:kt()({"pattern-menu__item":!0,"is-active":t===e.slug}),href:e.value,onClick:i,"aria-current":t===e.slug?"page":void 0},e.label)))))):null},un=e=>{let{onClick:t,options:n,label:r=(0,o.__)("Browse categories","wporg-patterns")}=e;const[i,s]=(0,a.useState)(!1);return(0,a.createElement)(fe.PanelBody,{className:"pattern-menu is-mobile",title:r,initialOpen:i,opened:i,onToggle:()=>s(!i)},(0,a.createElement)("ul",null,n.map((e=>(0,a.createElement)("li",{key:e.value},(0,a.createElement)("a",{href:e.value,onClick:e=>{s(!1),t(e)}},e.label))))))},pn=e=>(0,me.useViewportMatch)("medium","<")?(0,a.createElement)(un,e):(0,a.createElement)(cn,e),dn=e=>{let{primary:t,secondary:n}=e;return(0,a.createElement)("div",{className:"pattern-navigation-layout"},t&&(0,a.createElement)("div",{className:"pattern-navigation-layout__primary"},t),n&&(0,a.createElement)("div",{className:"pattern-navigation-layout__secondary"},n))},gn=e=>{let{basePath:t="",onNavigation:n,...r}=e;const{path:i,update:l}=S(),{categorySlug:c,isLoading:u,options:p}=(0,s.useSelect)((e=>{var n;const{getCategoryById:r,getCategories:a,getQueryFromUrl:o,getUrlFromQuery:s,isLoadingCategories:l}=e(de),c=o(i);delete c.page;const u=(a()||[]).map((e=>({value:s({...c,"pattern-categories":e.id},wporgPatternsUrl.site+t),slug:e.slug,label:e.name})));return{categorySlug:(null===(n=r(c["pattern-categories"]))||void 0===n?void 0:n.slug)||"",isLoading:l(),options:u}}));return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(dn,{primary:(0,a.createElement)(pn,{current:c,options:p||[],onClick:e=>{e.preventDefault(),l(e.target.pathname),"function"==typeof n&&n()},isLoading:u}),secondary:(0,a.createElement)(sn,{options:[{label:(0,o.__)("Newest","wporg-patterns"),value:"date"},{label:(0,o.__)("Popular","wporg-patterns"),value:"favorite_count"}]})}),(0,a.createElement)(rn,r))},mn=()=>{const{setCurrentQuery:e}=(0,s.useDispatch)(de),{path:t}=S(),n=(0,s.useSelect)((e=>e(de).getQueryFromUrl(t)),[t]);return tn((()=>{e(n)}),[n]),null},fn=window.wp.dom;function hn(){const e=(0,a.useRef)(),t=(0,a.useCallback)((()=>{if(null==e||!e.current)return;const t=fn.focus.tabbable.find(e.current),n=t[t.length-1]||!1;n&&n.focus(),n.focus()}),[]);return[e,t]}var vn=function(e){let{isLoggedIn:t}=e;const n=(0,v.addQueryArgs)(wporgPatternsUrl.login,{redirect_to:window.location}),r=(0,v.addQueryArgs)(wporgPatternsUrl.register,{redirect_to:window.location});return t?(0,a.createElement)("div",{className:"pattern-grid__empty-header pattern-favorites__empty-header"},(0,a.createElement)("h2",null,(0,o.__)("Collect and view your favorite patterns.","wporg-patterns")),(0,a.createElement)("p",null,(0,o.__)("Tap the heart on any pattern to mark it as a favorite. All your favorite patterns will appear here.","wporg-patterns"))):(0,a.createElement)("div",{className:"pattern-grid__empty-header pattern-favorites__empty-header"},(0,a.createElement)("h2",null,(0,o.__)("Collect and view your favorite patterns.","wporg-patterns")),(0,a.createElement)("p",null,(0,o.__)("Log in to your WordPress.org account and you’ll be able to see all your favorite patterns in one place.","wporg-patterns")),(0,a.createElement)("p",null,(0,a.createElement)("a",{className:"button button-primary button-large",href:n},(0,o.__)("Log in","wporg-patterns"))),(0,a.createElement)("p",null,(0,a.createElement)("a",{className:"button-link link-create-account",href:r},(0,o.__)("Create an account","wporg-patterns"))))};function yn(){const{path:e,update:t}=S();let n=_(e,"my-patterns");"page"===n&&(n="all");const r=[{value:`${wporgPatternsUrl.site}/my-patterns/`,slug:"all",label:(0,o.__)("All","wporg-patterns")},{value:`${wporgPatternsUrl.site}/my-patterns/draft/`,slug:"draft",label:(0,o.__)("Drafts","wporg-patterns")},{value:`${wporgPatternsUrl.site}/my-patterns/pending/`,slug:"pending",label:(0,o.__)("Pending Review","wporg-patterns")}];return(0,a.createElement)(pn,{label:(0,o.__)("Menu","wporg-patterns"),current:n||"all",options:r,onClick:e=>{e.preventDefault(),t(e.target.pathname)},isLoading:!1})}const wn=document.getElementById("patterns__container");wn&&(0,a.render)((0,a.createElement)((()=>{const{isEmpty:e,isSearch:t,query:n}=(0,s.useSelect)((e=>{const{getCurrentQuery:t,getPatternsByQuery:n,isLoadingPatternsByQuery:r}=e(de),a=t(),o=a&&r(a),i=a?n(a):[];return{isEmpty:!o&&!i.length,isSearch:a&&!!a.search,query:a}})),[r,o]=hn();return(0,a.createElement)(b,null,(0,a.createElement)(an,null),(0,a.createElement)(mn,null),(0,a.createElement)(Xt,null),(0,a.createElement)("div",{ref:r},t?(0,a.createElement)(rn,{query:n}):(0,a.createElement)(gn,{onNavigation:o})),e?(0,a.createElement)(a.Fragment,null,(0,a.createElement)(on,null),(0,a.createElement)(ge,{query:{per_page:6},showPagination:!1},(e=>(0,a.createElement)(qt,{key:e.id,pattern:e,showAvatar:!0})))):(0,a.createElement)(ge,{query:n,onNavigation:o},(e=>(0,a.createElement)(qt,{key:e.id,pattern:e,showAvatar:!0}))))}),null),wn);const En=document.getElementById("my-patterns__container");En&&(0,a.render)((0,a.createElement)((()=>{const e=wporgPatternsData.userId,{isEmpty:t,query:n}=(0,s.useSelect)((t=>{const{getCurrentQuery:n,getPatternsByQuery:r,isLoadingPatternsByQuery:a}=t(de),o={status:"any",...n()||{},author:e};"pending"===o.status&&(o.status="pending,pending-review");const i=e&&a(o),s=e?r(o):[];return{isEmpty:!i&&!s.length,query:o}}));if(!e){const e=(0,v.addQueryArgs)(wporgPatternsUrl.login,{redirect_to:window.location});return(0,a.createElement)("div",{className:"entry-content"},(0,a.createElement)("div",{className:"alignwide",style:{maxWidth:960}},(0,a.createElement)("p",null,(0,o.__)("Please log in to view your patterns.","wporg-patterns")),(0,a.createElement)("p",null,(0,a.createElement)("a",{className:"button button-primary button-large",href:e},(0,o.__)("Log in","wporg-patterns"))),(0,a.createElement)("div",{style:{height:100},"aria-hidden":"true",className:"wp-block-spacer"})))}return(0,a.createElement)(b,null,(0,a.createElement)(mn,null),(0,a.createElement)(dn,{primary:(0,a.createElement)(yn,null),secondary:(0,a.createElement)(sn,{options:[{label:(0,o.__)("Newest","wporg-patterns"),value:"date"},{label:(0,o.__)("Favorites","wporg-patterns"),value:"favorite_count"}]})}),t?(0,a.createElement)("div",{className:"pattern-grid__empty-header"},(0,a.createElement)("h2",null,(0,o.__)("Create and share patterns for every WordPress site.","wporg-patterns")),(0,a.createElement)("p",null,(0,o.__)("Anyone can create and share patterns using the familiar block editor. Design helpful starting points for yourself and any WordPress site.","wporg-patterns")),(0,a.createElement)(fe.Button,{variant:"primary",href:`${wporgPatternsUrl.site}/new-pattern/`},(0,o.__)("Create your first pattern","wporg-patterns"))):(0,a.createElement)(ge,{query:n},(e=>(0,a.createElement)(qt,{key:e.id,pattern:e,showOptions:!0}))))}),null),En);const bn=document.getElementById("pattern-favorites__container");bn&&(0,a.render)((0,a.createElement)((()=>{const{isEmpty:e,query:t}=(0,s.useSelect)((e=>{const{getCurrentQuery:t,getFavorites:n,getPatternsByQuery:r,isLoadingPatternsByQuery:a}=e(de),o=t()||{},i=n();if(null===i)return{query:!1,isEmpty:!1};const s={...o,include:i},l=!!i.length&&a(s),c=i.length?r(s):[];return{query:s,isEmpty:!l&&!c.length}})),[n,r]=hn(),i={orderby:"favorite_count",per_page:6};t["pattern-categories"]&&(i["pattern-categories"]=t["pattern-categories"]);const l=!!wporgPatternsData.userId;return(0,a.createElement)(b,null,(0,a.createElement)(mn,null),(0,a.createElement)("div",{ref:n},l&&(0,a.createElement)(gn,{basePath:"/favorites/",query:t,onNavigation:r,isEmpty:e})),!l||e?(0,a.createElement)(a.Fragment,null,(0,a.createElement)(vn,{isLoggedIn:l}),(0,a.createElement)(ge,{header:(0,a.createElement)("h2",{className:"pattern-favorites__grid-title"},(0,o.__)("Here’s a few of our favorite patterns","wporg-patterns")),query:i,showPagination:!1},(e=>(0,a.createElement)(qt,{key:e.id,pattern:e,showAvatar:!0})))):(0,a.createElement)(ge,{query:t,onNavigation:r},(e=>(0,a.createElement)(qt,{key:e.id,pattern:e,showAvatar:!0}))))}),null),bn);const Sn=document.querySelectorAll(".pattern__container");for(let e=0;e<Sn.length;e++){const t=Sn[e],n=t.dataset;(0,a.render)((0,a.createElement)(Ht,n),t,(()=>{t.hidden=!1,document.querySelectorAll(".hide-if-pattern-loaded").forEach((e=>e.hidden=!0))}))}}()}();
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/functions.php

    r11729 r12024  
    150150    wp_styles()->do_items( $handles );
    151151    wp_styles()->done = $done;
    152 
    153     // Build up the alignment styles to match the layout set in theme.json.
    154     // See https://github.com/WordPress/gutenberg/blob/9d4b83cbbafcd6c6cbd20c86b572f458fc65ff16/lib/block-supports/layout.php#L38
    155     $block_gap = wp_get_global_styles( array( 'spacing', 'blockGap' ) );
    156     $layout = wp_get_global_settings( array( 'layout' ) );
    157     $style = gutenberg_get_layout_style( 'body > div', $layout, true, $block_gap );
    158     echo '<style>' . $style . '</style>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
    159152
    160153    wp_add_inline_script(
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/src/components/iframe/index.js

    r11098 r12024  
    105105        justify-content: center;
    106106        background-color: white;
     107        /* Override the Twenty Twenty-One sizes with our custom sizes. */
     108        --responsive--aligndefault-width: 800px;
     109        --responsive--alignwide-width: 1000px;
    107110    }
    108111    .${ BODY_CLASS_NAME } {
     
    137140
    138141            setHead( contentDocument, headHTML );
    139             setBodyClassName( contentDocument );
    140142            bubbleEvents( contentDocument );
    141143            setBodyClassName( contentDocument );
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/src/components/pattern-preview/canvas.js

    r10930 r12024  
    2020            >
    2121                <div
     22                    className="entry-content"
    2223                    dangerouslySetInnerHTML={ {
    2324                        __html: html,
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/src/components/pattern-thumbnail/canvas.js

    r11667 r12024  
    7070            >
    7171                <div
     72                    className="entry-content"
    7273                    dangerouslySetInnerHTML={ {
    7374                        __html: shouldLoad ? html : '',
Note: See TracChangeset for help on using the changeset viewer.