<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[11190] sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns: Pattern Directory: Sync with git WordPress/pattern-directory@cecf2097dc8ec2e2818cded6f77e2e39ca88ad50</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://meta.trac.wordpress.org/changeset/11190">11190</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://meta.trac.wordpress.org/changeset/11190","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>ryelle</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2021-08-20 20:18:24 +0000 (Fri, 20 Aug 2021)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Pattern Directory: Sync with git WordPress/pattern-directory@cecf2097dc8ec2e2818cded6f77e2e39ca88ad50</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgpatternsbuildindexassetphp">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/build/index.asset.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgpatternsbuildindexjs">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/build/index.js</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgpatternssrccomponentspatternthumbnailcanvasjs">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/src/components/pattern-thumbnail/canvas.js</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgpatternssrchooksinviewjs">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/src/hooks/in-view.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgpatternsbuildindexassetphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/build/index.asset.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/build/index.asset.php  2021-08-20 15:35:29 UTC (rev 11189)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/build/index.asset.php    2021-08-20 20:18:24 UTC (rev 11190)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1 +1 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?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-element', 'wp-html-entities', 'wp-i18n', 'wp-keycodes', 'wp-polyfill', 'wp-primitives', 'wp-url'), 'version' => '5f9315459f323f6d0dd2274948061837');
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?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-element', 'wp-html-entities', 'wp-i18n', 'wp-keycodes', 'wp-polyfill', 'wp-primitives', 'wp-url'), 'version' => '3860d701264b9d56f0b878d700db85e1');
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgpatternsbuildindexjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/build/index.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/build/index.js 2021-08-20 15:35:29 UTC (rev 11189)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/build/index.js   2021-08-20 20:18:24 UTC (rev 11190)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,11 +1,11 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-!function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},n.n=function(e){var t=e&&e.__esModule?functio
 n(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=17)}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=window.wp.data},function(e,t){e.exports=window.wp.url},function(e,t){e.exports=window.wp.components},function(e,t){e.exports=window.React},function(e,t){e.exports=window.wp.dataControls},function(e,t,n){var r;!function(){"use strict";var n={}.hasOwnProperty;function a(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var o=typeof r;if("string"===o||"number"===o)e.push(r);else if(Array.isArray(r)){if(r.length){var c=a.apply(null,r);c&&e.push(c)}}else if("object"===o)if(r.toString===Object.prototype.toString)for(var i in r)n.call(r,i)&&r[i]&&e.push(i);else e.push(r.toString())}}return e.join(" ")}e.exports?(a.default
 =a,e.exports=a):void 0===(r=function(){return a}.apply(t,[]))||(e.exports=r)}()},function(e,t){e.exports=window.wp.compose},function(e,t){e.exports=window.wp.primitives},function(e,t){function n(){return e.exports=n=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},e.exports.default=e.exports,e.exports.__esModule=!0,n.apply(this,arguments)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.wp.a11y},function(e,t){e.exports=window.wp.keycodes},function(e,t){e.exports=window.wp.coreData},function(e,t){e.exports=window.wp.htmlEntities},function(e,t){e.exports=window.lodash},function(e,t){e.exports=window.wp.apiFetch},function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,"fetchPatterns",(function(){return N})),n.d(r,"loadPattern",(function(){return T})),n.d(r,"loadPatterns",(func
 tion(){return k})),n.d(r,"setErrorPatterns",(function(){return A})),n.d(r,"setCurrentQuery",(function(){return C})),n.d(r,"fetchCategories",(function(){return I})),n.d(r,"loadCategories",(function(){return L})),n.d(r,"fetchPatternFlagReasons",(function(){return R})),n.d(r,"loadPatternFlagReasons",(function(){return D})),n.d(r,"loadFavorites",(function(){return F})),n.d(r,"addFavorite",(function(){return M})),n.d(r,"removeFavorite",(function(){return Q}));var a={};n.r(a),n.d(a,"getPatternsByQuery",(function(){return $})),n.d(a,"getPattern",(function(){return V})),n.d(a,"getCategories",(function(){return G})),n.d(a,"getPatternFlagReasons",(function(){return H})),n.d(a,"getFavorites",(function(){return z}));var o={};n.r(o),n.d(o,"isLoadingPatternsByQuery",(function(){return W})),n.d(o,"getPatterns",(function(){return Y})),n.d(o,
 "getPatternsByQuery",(function(){return X})),n.d(o,"getPatternTotalsByQuery",(function(){return J})),n.d(o,"getPatternTotalPagesByQuery",(function(){return Z})),n.d(o,"getPattern",(function(){return ee})),n.d(o,"getCurrentQuery",(function(){return te})),n.d(o,"isLoadingCategories",(function(){return ne})),n.d(o,"hasLoadedCategories",(function(){return re})),n.d(o,"getCategories",(function(){return ae})),n.d(o,"getCategoryBySlug",(function(){return oe})),n.d(o,"getCategoryById",(function(){return ce})),n.d(o,"getPatternFlagReasons",(function(){return ie})),n.d(o,"isLoadingPatternFlagReasons",(function(){return se})),n.d(o,"getFavorites",(function(){return le})),n.d(o,"isFavorite",(function(){return ue})),n.d(o,"getQueryFromUrl",(function(){return pe})),n.d(o,"getUrlFromQuery",(function(){return de}));var c=n(0),i=n(1),s=n(2),l
 =({name:e,url:t,avatar:n})=>Object(c.createElement)("a",{href:t,className:"pattern__author-avatar"},Object(c.createElement)("img",{alt:"",src:n}),e);const u=({className:e="",style:t,children:n})=>Object(c.createElement)("span",{className:e+" pattern-skeleton__container",style:t},n),p=e=>Object(c.createElement)("span",{className:"pattern-skeleton",style:e});var d=n(10),b=n.n(d),g=n(9),m=function(e){return Object(c.createElement)(g.SVG,b()({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24"},e),Object(c.createElement)(g.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 f(e){return e*(2/3)}const h=()=>{const[e,t]=Objec
 t(c.useState)(),n=Object(c.useRef)();return Object(c.useEffect)(()=>{n.current&&t(f(n.current.clientWidth)+"px")},[n]),Object(c.createElement)("div",{ref:n},Object(c.createElement)(u,null,Object(c.createElement)(p,{height:e}),Object(c.createElement)(p,{height:"14px",marginTop:"1rem"}),Object(c.createElement)(u,{style:{flexDirection:"row",marginTop:"0.5rem",alignItems:"center"}},Object(c.createElement)(p,{height:"18px",width:"18px",marginRight:"0.5rem",borderRadius:"32px"}),Object(c.createElement)(p,{height:"12px",width:"100px",marginRight:"0.75rem"}),Object(c.createElement)(m,{width:"16px",height:"16px",fill:"#787c82",className:"pattern-favorite-button__filled"}),Object(c.createElement)(p,{height:"12px",width:"32px",marginLeft:"0.5rem"}))))};var v=({length:e=6})=&gt
 ;Array(e).fill().map((e,t)=>Object(c.createElement)(h,{key:t})),O=n(3);const y=e=>e.split("?")[0],j=(e,t)=>{if(!t||!e)return"";const n=Object(O.getQueryArgs)(e);if(n[t])return n[t];const r=(e=>e.replace(/^\//,""))(y(e).replace(/\/$/,"")).split("/"),a=r.indexOf(t);return-1===a?"":r[a+1]||""},_=e=>Number(j(e,"page")||1),w=Object(c.createContext)();function E({children:e}){const[t,n]=Object(c.useState)(Object(O.getPathAndQueryString)(window.location.href)),r=e=>{window.history.pushState("","",e),n(e)},a=()=>{n(document.location.href)};return Object(c.useEffect)(()=>(window.addEventListener("popstate",a),()=>{window.removeEventListener("popstate",a)}),[]),Object(c.createElement)(w.Provider,{value:{path:t,update:e=>{const n=(e=>(e=>{const t={};return Object.keys(e).forEach(n=>{const r=e[n];null!=r&&r.toString().length>0&
 amp;&(t[n]=r)}),t})({...Object(O.getQueryArgs)(t),...Object(O.getQueryArgs)(e)}))(e),a=y(e),o=Object(O.addQueryArgs)(a,n);r(o)},replace:r}},e)}function S(){const e=Object(c.useContext)(w);if(void 0===e)throw new Error("useRoute must be used within a Provider");return e}function P({currentPage:e=1,totalPages:t}){const{path:n,update:r}=S();if(!t||t<=1)return null;const a=e>1,o=e<t,s=Object(O.getQueryString)(n)?"?"+Object(O.getQueryString)(n):"",l=n.replace(s,"").replace(/page\/\d+\/?/,""),u=function(e,t=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},[]))}(t,e),p=`${l}page/%s/${s}`,d=e=>1===e?`${l}${s}`:
 Object(i.sprintf)(p,e),b=(e,t)=>{e.preventDefault(),r(d(t))};return Object(c.createElement)("nav",{className:"pagination","aria-label":Object(i.__)("Pagination","wporg-patterns")},Object(c.createElement)("ul",{className:"pagination__list"},Object(c.createElement)("li",{className:"pagination__item pagination__item-previous-page"},a&&Object(c.createElement)("a",{className:"pagination__link",href:d(e-1),onClick:t=>b(t,e-1)},Object(c.createElement)("span",{className:"screen-reader-text"},Object(i.__)("Previous page","wporg-patterns")),Object(c.createElement)("span",{"aria-hidden":!0},Object(i._x)("Previous","previous page link label","wporg-patterns")))),u.map((t,n)=>"…"===t?Object(c.createElement)("li",{className:"pagination__item",key:`${n}
 -${t}`},t):Object(c.createElement)("li",{className:"pagination__item",key:t},Object(c.createElement)("a",{className:"pagination__link",href:d(t),"aria-current":t===e?"page":void 0,onClick:e=>b(e,t)},Object(c.createElement)("span",{className:"screen-reader-text"},Object(i.sprintf)(// translators: %s is the page number.
-Object(i.__)("Page %s","wporg-patterns"),t)),Object(c.createElement)("span",{"aria-hidden":!0},t)))),Object(c.createElement)("li",{className:"pagination__item pagination__item-next-page"},o&&Object(c.createElement)("a",{className:"pagination__link",href:d(e+1),onClick:t=>b(t,e+1)},Object(c.createElement)("span",{className:"screen-reader-text"},Object(i.__)("Next page","wporg-patterns")),Object(c.createElement)("span",{"aria-hidden":!0},Object(i._x)("Next","next page link label","wporg-patterns"))))))}var x=n(6);function N(e){return{type:"FETCH_BLOCK_PATTERNS",query:e}}function T(e,t){return{type:"LOAD_BLOCK_PATTERN",postId:e,pattern:t}}function k(e,{page:t,patterns:n,total:r,totalPages:a}){return{type:"LOAD_BLOCK_PATTERNS",query:e,page:t,patterns:n,total:r,totalPages:a}}funct
 ion A(e,{page:t,error:n}){return{type:"ERROR_BLOCK_PATTERNS",query:e,page:t,error:n}}function C(e){return{type:"SET_CURRENT_QUERY",query:e}}function I(){return{type:"FETCH_CATEGORIES"}}function L(e){return{type:"LOAD_CATEGORIES",categories:e}}function R(){return{type:"FETCH_PATTERN_FLAG_REASONS"}}function D(e){return{type:"LOAD_PATTERN_FLAG_REASONS",reasons:e}}function F(e){return{type:"LOAD_FAVORITES",patternIds:e}}function*M(e){const t=yield Object(x.apiFetch)({path:"/wporg/v1/pattern-favorites",method:"POST",data:{id:e}});if("number"==typeof t)return{type:"ADD_FAVORITE",patternId:e,count:t}}function*Q(e){const t=yield Object(x.apiFetch)({path:"/wporg/v1/pattern-favorites",method:"DELETE",data:{id:e}});if("number"==typeof t)return{type:"REMOVE_FAVORITE",patternId:e,count:t}}function B(e={}){const t=Object.keys(e).sort();let n="&
 quot;;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?"&":"")+Object(O.addQueryArgs)("",{[a]:o}).slice(1)}}return n}function q(e={},t){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 U(e={},t){const n=(t.patterns||[]).map(({id:e})=>e),{page:r,total:a,totalPages:o}=t;switch(t.type){case"LOAD_BLOCK_PATTERNS":{const c={...e[t.query]||{},total:a,totalPages:o};return c[r]=n,{...e,[t.query]:c}}case"ERROR_BLOCK_PATTERNS":{const n=e[t.query]||{};return n[r]=[],{...e,[t.q
 uery]:n}}default:return e}}var K=Object(s.combineReducers)({patterns:function(e={},t){return{byId:q(e.byId,t),queries:U(e.queries,t)}},categories:function(e,t){switch(t.type){case"FETCH_CATEGORIES":return null;case"LOAD_CATEGORIES":const e=(t.categories||[]).sort((e,t)=>e.name.localeCompare(t.name));return[{id:-1,slug:"",name:Object(i.__)("All","wporg-patterns"),link:wporgPatternsUrl.site},...e]}return e},currentQuery:function(e,t){switch(t.type){case"SET_CURRENT_QUERY":return t.query}return e},patternFlagReasons:function(e,t){switch(t.type){case"FETCH_PATTERN_FLAG_REASONS":return null;case"LOAD_PATTERN_FLAG_REASONS":return[...t.reasons];default:return e}},favorites:function(e=null,t){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*$(e){const t=B(e);try{yield N(t);const n=yield Object(x.apiFetch)({path:Object(O.addQueryArgs)("/wp/v2/wporg-pattern",{...e,locale:JSON.parse(wporgLocale)}),parse:!1}),{total:r,totalPages:a,results:o}=yield Object(x.__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 k(t,{page:e.page||1,patterns:o,total:r,totalPages:a})}catch(n){const r=yield Object(x.__unstableAwaitPromise)(async function(e){try{return await e.json()}catch(e){return{}}}(n));yield A(t,{page:e.page||1,error:r})}}function*V(e){try{const t=yield Object(x.apiFetch)({path:Object(O.addQueryArgs)("/wp/v2/wporg-pattern/"+e)});yield T(e,t)}catch(e){}}function*G(){try{yield{type:"FETCH_CATEGORIES"};const e=yield Object(x.apiFetch)({path:Obj
 ect(O.addQueryArgs)("/wp/v2/pattern-categories")});yield L(e)}catch(e){}}function*H(){try{yield{type:"FETCH_PATTERN_FLAG_REASONS"};const e=yield Object(x.apiFetch)({path:Object(O.addQueryArgs)("/wp/v2/wporg-pattern-flag-reason")});yield D(e)}catch(e){}}function*z(){try{const e=yield Object(x.apiFetch)({path:"/wporg/v1/pattern-favorites"});yield F(e)}catch(e){}}function W(e,t){var n,r;const a=B(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 Y(e){return Object.values(e.patterns.byId)}function X(e,t){var n,r;const a=B(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 J(e,t){var n,r;const a=B(t);return(null===(n=e.patterns.queries)||void 0===n||null===(r=n[a])||void 0===r?void 0:r.total)||0}function Z(e,t){var n,r;const a=B(t);return(
 null===(n=e.patterns.queries)||void 0===n||null===(r=n[a])||void 0===r?void 0:r.totalPages)||0}function ee(e,t){return e.patterns.byId[t]||null}function te(e){return e.currentQuery}function ne(e){return null===e.categories}function re(e){return Array.isArray(e.categories)}function ae(e){return e.categories}function oe(e,t){if(!re(e))return;const[n]=e.categories.filter(e=>e.slug===t);return n}function ce(e,t){if(re(e))return e.categories.find(({id:e})=>t===e)}function ie(e){return e.patternFlagReasons}function se(e){return null===e.patternFlagReasons}function le(e){return e.favorites}function ue(e,t){var n;return null===(n=e.favorites)||void 0===n?void 0:n.includes(t)}function pe(e,t){const n=["categories","author","page","search"],r=Object(O.getQueryArgs)(t),a=j(t,"categories");if(a&&-1===n.indexOf(a)){const t=oe(e,a);null!=t&&t.id&&(r["pattern-categories"]=t.id)}const o=j(t,"author")
 ;o&&-1===n.indexOf(o)&&(r.author_name=o);const c=_(t);"number"==typeof c&&c>1&&(r.page=c);const i=(e=>decodeURI(j(e,"search")))(t);i.length>0&&-1===n.indexOf(i)&&(r.search=i);const s=j(t,"my-patterns");return s&&"page"!==s&&(r.status=s),r}function de(e,t={},n=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=ae(e).find(({id:e})=>r===e);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+="/?"+Object(O.buildQueryString)(t):n+"/"}const be=Object(s.createReduxStore)("wporg/pattern-directory",{reducer:K,selectors:o,actions:r,co
 ntrols:x.controls,resolvers:a});Object(s.register)(be);var ge=function({header:e,children:t,query:n,showPagination:r=!0}){const{isLoading:a,posts:o,totalPages:i}=Object(s.useSelect)(e=>{const{getPatternTotalPagesByQuery:t,getPatternsByQuery:r,isLoadingPatternsByQuery:a}=e(be);return{isLoading:n&&a(n),posts:n?r(n):[],totalPages:n?t(n):0}});return Object(c.createElement)(c.Fragment,null,o.length?e:null,Object(c.createElement)("div",{className:"pattern-grid"},a?Object(c.createElement)(v,{length:null==n?void 0:n.per_page}):o.map(t)),r&&Object(c.createElement)(P,{totalPages:i,currentPage:null==n?void 0:n.page}))},me=n(8),fe=n(4);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=Object(c.forwardRef)((function({contentRef:e,children:t,head:n,headHTML:r,bodyStyle:a="",themeSlug:o="twentytwenty
 one",...s},l){const[u,p]=Object(c.useState)();r+=`<link rel="stylesheet" href="https://wp-themes.com/wp-content/themes/${o}/style.css" media="all" />`,r+=`<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        ${a}\n    }\n    body > div {\n        width: 100%;\n        max-height: 100%;\n        pointer-events: none;\n    }\n    </style>`;const d=Object(c.useCallback)(t=>{function n(){const{contentDocument:n}=t,{readyState:a,body:o}=n;return("interactive"===a||"complete"===a)&&("function"==typeof e?e(o):e&&(e.current=o),function(e,t){e.head.innerHTML="<style>body{margin:0}</style>"+t}(n,r),he(n),function(e){const{defaultView:t}=e,{frameElement:n}=t;function r(e){const r=Object.getProt
 otypeOf(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 c=new a(e.type,o);!n.dispatchEvent(c)&&e.preventDefault()}const a=["keydown","keypress","dragover"];for(const t of a)e.addEventListener(t,r)}(n),he(n),p(n),!0)}t&&(n()||t.addEventListener("load",()=>{n()}))},[]);return Object(c.createElement)("iframe",b()({title:Object(i.__)("Pattern Preview","wporg-patterns"),tabIndex:"-1"},s,{ref:Object(me.useMergeRefs)([l,d])}),u&&Object(c.createPortal)(t,u.body),u&&Object(c.createPortal)(n,u.head))})),Oe=function({html:e}){return Object(c.createElement)("div",null,Object(c.createElement)(ve,{className:"pattern-preview__viewport-iframe",style:{width:"100%",height:"50vh",minHeight:"600px",overflowY:"auto&qu
 ot;},headHTML:window.__editorStyles.html},Object(c.createElement)("div",{dangerouslySetInnerHTML:{__html:e}})))},ye=n(5),je=n.n(ye);function _e(e,t){return e.map((function(e,n){return e+t[n]}))}function we(e,t){return e.map((function(e,n){return e-t[n]}))}function Ee(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 xe(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 Ne(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 Te(){return(Te=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}).apply(this,arguments)}function ke(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 Ce(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 Ce(e,void 0);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)?Ce(e,void 0):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=Ie(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],c=o[0],i=o[1];switch(
 typeof i){case"function":n[c]=i.call(n,e[c],c,e);break;case"object":n[c]=Me(e[c],i);break;case"boolean":i&&(n[c]=e[c])}}return n}function Qe(){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 Ue(e){return{buttons:"buttons"in e?e.buttons:0,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey}}var Ke=function(e){return e};function $e(e,t){void 0===t&&(t=Ke);var n=Be(e),r=n?n[0]:e;return t([r.clientX,r.clientY])}var Ve=Te({},{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},triggerAllE
 vents: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 Ve.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,c=t.top,i=void 0===c?-1/0:c,s=t.bottom;return[[r,o],[i,void 0===s?1/0:s]]}}),Ge="undefined"!=typeof window&&window.document&&window.document.createElement,He={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=Ge?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},ze=Te({},Ve,{useTouch:function(e){void 0===e&&(e=!1);var t=Qe(),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,c=void 0!==o&&o,i=n.axis,s=De(e,a?3:c||(void 0===i?void 0:i)?1:0);return this.filterTaps=a,s},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 We(e){var t,n=e.domTarget,r=e.eventOptions,a=e.window,o=e.enabled,c=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,[&q
 uot;domTarget","eventOptions","window","enabled"]),i=(void 0===(t={domTarget:n,eventOptions:r,window:a,enabled:o})&&(t={}),Me(t,He));return i.drag=function(e){return void 0===e&&(e={}),Me(e,ze)}(c),i}function Ye(e){return Te({_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 Xe(){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:Ye({_pointerId:void 0,axis:void 0,xy:[0,0],
 vxvy:[0,0],velocity:0,distance:0,tap:!1,swipe:[0,0]}),pinch:Ye({_pointerIds:[],da:[0,0],vdva:[0,0],origin:void 0,turns:0}),wheel:Ye({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0}),move:Ye({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0}),scroll:Ye({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0})}}var Je=new Map,Ze=function(e){return e};function et(e,t){return Math.abs(e)>=t&&Se(e)*t}function tt(e,t,n){var r=t[0],a=t[1],o=n[0],c=n[1],i=e[0],s=i[0],l=i[1],u=e[1],p=u[0],d=u[1];return[xe(r,s,l,o),xe(a,p,d,c)]}function nt(e,t,n){var r=e.state,a=t.timeStamp,o=t.type,c=r.values;return{_lastEventType:o,event:t,timeStamp:a,elapsedTime:n?0:a-r.startTime,previous:c}}function rt(e,t,n,r){var a=e.state,o=e.config,c=e.stateKey,i=e.args,s=e.transform,l=a.offset,u=n.timeStamp,p=o.initial,d=o.bounds,b=we(s(o.threshold),s([0,0])).map(Math.abs),g=Te({},Xe()[c],{_active:!0,args:i,values:t,initial:null!=r?r:t,_threshold:b,offset:l,lastOffset:l,startTime:u});return Te({
 },g,{_initial:Fe(p,g),_bounds:Fe(d,g)})}var at=function(e){var t=this;this.classes=e,this.pointerIds=new Set,this.touchIds=new Set,this.supportsTouchEvents=Qe(),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={},c=Ie(t.classes);!(a=c()).done;){var i=a.value;new i(t,n).addBindings(o)}var s=function(e){bt(o,e,(function(r){return t.nativeRefs[e](Te({},t.state.shared,{event:r,args:n}))}))};for(var l in t.nativeRefs)s(l);return t.config.domTarget?lt(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&&mt(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){mt(n,a[o],r)}e.windowListeners={}}}(t)},t
 his.classes=e,this.state=Xe(),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 ct(e,t){"pointerId"in t?e.pointerIds.delete(t.pointerId):qe(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=dt(n);if(!a)throw new Error("domTarget must be defined");var o=n.eventOptions;mt(a,pt(r),o);for(var c=0,i=Object.entries(t);c<i.length;c++){var s=i[c],l=s[0],u=s[1],p=l.slice(2).toLowerCase();r.push([p,Re.apply(void 0,u)])}gt(a,r,o)}function ut(e,t){for(var n={},r=e.config.even
 tOptions.capture?"Capture":"",a=0,o=Object.entries(t);a<o.length;a++){var c=o[a],i=c[0],s=c[1],l=Array.isArray(s)?s:[s];n[i+r]=Re.apply(void 0,l)}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 bt(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,c=o[0],i=o[1];e.addEventListener(c,i,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,c=o[0],i=o[1];e.removeEventListener(c,i,n)}}function ft(){}function ht(e){"persist"in e&&"function"==typeof e.persist&&e.persist()}var vt=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){ht(e),st(t.controlle
 r,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,ht(e),t.setTimeout(t.startDrag.bind(Ae(t)),t.config.delay,e)},t.setStartState=function(e){var n=$e(e,t.transform);t.updateSharedState(Ue(e)),t.updateGestureState(Te({},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.pointe
 rLockElement){var r=e.movementX,a=e.movementY;n=_e(t.transform([r,a]),t.state.values)}else n=$e(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 c=Ue(e);t.updateSharedState(c);var i=nt(Ae(t),e),s=Ee(o._movement),l=t.state._dragIsTap;l&&s>=3&&(l=!1),t.updateGestureState(Te({},i,o,{_dragIsTap:l})),t.fireGestureHandler()}},t.onDragEnd=function(e){if(ct(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],c=t.state.movement,i=c[0],s=c[1],l=t.state._intentional,u=l[0],p=l[1],d=t.config.swipeVelocity,b=d[0],g=d[1],m=t.config.swipeDistance,f=m[0],h=m[1],v=t.config.swipeDuration,O=Te({},nt(Ae(t),e),t.getMovement(t.state.values)),y=[0,0];O.elapsedT
 ime<v&&(!1!==u&&Math.abs(a)>b&&Math.abs(i)>f&&(y[0]=Se(a)),!1!==p&&Math.abs(o)>g&&Math.abs(s)>h&&(y[1]=Se(o))),t.updateSharedState({buttons:0}),t.updateGestureState(Te({},O,{tap:n,swipe:y})),t.fireGestureHandler(t.config.filterTaps&&!0===n)}},t.clean=function(){e.prototype.clean.call(Ae(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}ke(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.fireGestureHandl
 er())},n.addBindings=function(e){this.config.useTouch?(bt(e,"onTouchStart",this.onDragStart),bt(e,"onTouchMove",this.onDragChange),bt(e,"onTouchEnd",this.onDragEnd),bt(e,"onTouchCancel",this.onDragEnd)):(bt(e,"onPointerDown",this.onDragStart),bt(e,"onPointerMove",this.onDragChange),bt(e,"onPointerUp",this.onDragEnd),bt(e,"onPointerCancel",this.onDragEnd)),this.config.filterTaps&&bt(e,this.controller.config.eventOptions.capture?"onClick":"onClickCapture",this.onClick)},t}(function(e){function t(){return e.apply(this,arguments)||this}ke(t,e);var n=t.prototype;return n.getInternalMovement=function(e,t){return we(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.loc
 kDirection?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=Ee(t),a=0===r?0:1/r,o=0===n?0:1/n,c=o*r,i=t.map((function(e){return o*e})),s=t.map((function(e){return a*e}));return{velocities:i,velocity:c,distance:Ee(e),direction:s}}(n.movement,n.delta,r))}return n},n.mapStateValues=function(e){return{xy:e.values,vxvy:e.velocities}},t}(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),c=2;c<a;c++)o[c-2]=arguments[c];n.controller.timeout
 s[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,c=Te({},n.controller.state.shared,n.state,n.mapStateValues(n.state),{locked:!!document.pointerLockElement,touches:a,down:o}),i=n.handler(c);return n.state.memo=void 0!==i?i:n.state.memo,c},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=f
 unction(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,c=n._intentional,i=n.lastOffset,s=n.movement,l=n._threshold,u=this.getInternalMovement(e,this.state),p=!1===c[0]?et(u[0],l[0]):c[0],d=!1===c[1]?et(u[1],l[1]):c[1],b=this.checkIntentionality([p,d],u);if(b._blocked)return Te({},b,{_movement:u,delta:[0,0]});var g=b._intentional,m=u,f=[!1!==g[0]?u[0]-g[0]:0,!1!==g[1]?u[1]-g[1]:0],h=_e(f,i),v=o?t:[0,0];return f=tt(r,_e(f,a),v),Te({},b,{intentional:!1!==g[0]||!1!==g[1],_initial:a,_movement:m,movement:f,values:e,offset:tt(r,h,v),delta:we(f,s)})},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(){retur
 n 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||Ze}}])&&Ne(t.prototype,n),e}()));function Ot(e,t){try{return function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var r,a,o,c;if(Array.isArray(t)){if((r=t.length)!==n.length)return!1;for(a=r;0!=a--;)if(!e(t[a],n[a]))return!1;return!0}if("function"==typeof Map&&t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(c=t.entries();!(a=c.next()).done;)if(!n.has(a.value[0]))return!1;for(c=t.entries();!(a=c.next()).done;)if(!e(a.value[1],n.get(a.value[0])))return!1;return!0}if("function"==typeof Set&&t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(c=t.
 entries();!(a=c.next()).done;)if(!n.has(a.value[0]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(o=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(a=r;0!=a--;)if(!Object.prototype.hasOwnProperty.call(n,o[a]))return!1;if("undefined"!=typeof Element&&t instanceof Element)return!1;for(a=r;0!=a--;)if(!("_owner"===o[a]&&t.$$typeof||e(t[o[a]],n[o[a]])))return!1;return!0}return t!=t&&n!=n}(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 yt=n(12),jt=function({label:e,className:t,onDragChange:n,onDragEnd:r,direction:a="left",...o}){const i=function(e,t){void 0===t&&(t={}),Je.set("drag",v
 t);var o=Object(ye.useRef)();return o.current||(o.current=function(e,t){var n,r,a=[],o=!1;return function(){for(var c=arguments.length,i=new Array(c),s=0;s<c;s++)i[s]=arguments[s];return o&&n===this&&t(i,a)||(r=e.apply(this,i),o=!0,n=this,a=i),r}}(We,Ot)),function(e,t,n){void 0===n&&(n={});var r=function(e){var t=new Set;return e.drag&&t.add(Je.get("drag")),e.wheel&&t.add(Je.get("wheel")),e.scroll&&t.add(Je.get("scroll")),e.move&&t.add(Je.get("move")),e.pinch&&t.add(Je.get("pinch")),e.hover&&t.add(Je.get("hover")),t}(e),a=je.a.useMemo((function(){return new at(r)}),[]);return a.config=t,a.handlers=e,a.nativeRefs=n,je.a.useEffect(a.effect,[]),a.config.domTarget?ft:a.bind}({drag:({delta:e,dragging:t})=>{const o="left"===a?-2:2;t?n(e[0]*o):r()}},o.current(t))}();return Object(c.createElement)("div",{className:"pattern-preview
 __drag-handle "+t},Object(c.createElement)("button",b()({className:"pattern-preview__drag-handle-button","aria-label":e},o,{onKeyDown:e=>{const{keyCode:t}=e;"left"===a&&t===yt.LEFT||"right"===a&&t===yt.RIGHT?n(20):("left"===a&&t===yt.RIGHT||"right"===a&&t===yt.LEFT)&&n(-20)},onKeyUp:r},i())))},_t=function e({blockContent:t}){const n=Object(me.useViewportMatch)("mobile",">="),r=Object(me.useViewportMatch)("large",">="),a=Object(me.useViewportMatch)("wide",">="),o=Object(me.useInstanceId)(e),[s,l]=Object(c.useState)(window.innerWidth<960?window.innerWidth:960),u=Object(c.useCallback)(e=>l(t=>t+e),[l]),p=()=>{s<280&&l(280)},d=Object(c.useMemo)(()=>n?a?[{label:Object(i.__)("Full (1200px)","wporg-patterns"),value:1200},{label:Object(i.__)("Default (960px
 )","wporg-patterns"),value:960},{label:Object(i.__)("Medium (480px)","wporg-patterns"),value:480},{label:Object(i.__)("Narrow (320px)","wporg-patterns"),value:320}]:r?[{label:Object(i.__)("Default (960px)","wporg-patterns"),value:960},{label:Object(i.__)("Medium (480px)","wporg-patterns"),value:480},{label:Object(i.__)("Narrow (320px)","wporg-patterns"),value:320}]:[{label:Object(i.__)("Medium (480px)","wporg-patterns"),value:480},{label:Object(i.__)("Narrow (320px)","wporg-patterns"),value:320}]:[],[n,r,a]);let b=!1;if(!d.some(e=>e.value===s)){const e=Math.max(Math.floor(s),280);b={
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+!function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},n.n=function(e){var t=e&&e.__esModule?function
 (){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=17)}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=window.wp.data},function(e,t){e.exports=window.wp.url},function(e,t){e.exports=window.wp.components},function(e,t){e.exports=window.React},function(e,t){e.exports=window.wp.dataControls},function(e,t,n){var r;!function(){"use strict";var n={}.hasOwnProperty;function a(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var o=typeof r;if("string"===o||"number"===o)e.push(r);else if(Array.isArray(r)){if(r.length){var c=a.apply(null,r);c&&e.push(c)}}else if("object"===o)if(r.toString===Object.prototype.toString)for(var i in r)n.call(r,i)&&r[i]&&e.push(i);else e.push(r.toString())}}return e.join(" ")}e.exports?(a.default=
 a,e.exports=a):void 0===(r=function(){return a}.apply(t,[]))||(e.exports=r)}()},function(e,t){e.exports=window.wp.compose},function(e,t){e.exports=window.wp.primitives},function(e,t){function n(){return e.exports=n=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},e.exports.default=e.exports,e.exports.__esModule=!0,n.apply(this,arguments)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.wp.a11y},function(e,t){e.exports=window.wp.keycodes},function(e,t){e.exports=window.lodash},function(e,t){e.exports=window.wp.coreData},function(e,t){e.exports=window.wp.htmlEntities},function(e,t){e.exports=window.wp.apiFetch},function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,"fetchPatterns",(function(){return N})),n.d(r,"loadPattern",(function(){return T})),n.d(r,"loadPatterns",(funct
 ion(){return k})),n.d(r,"setErrorPatterns",(function(){return C})),n.d(r,"setCurrentQuery",(function(){return A})),n.d(r,"fetchCategories",(function(){return I})),n.d(r,"loadCategories",(function(){return L})),n.d(r,"fetchPatternFlagReasons",(function(){return R})),n.d(r,"loadPatternFlagReasons",(function(){return D})),n.d(r,"loadFavorites",(function(){return F})),n.d(r,"addFavorite",(function(){return M})),n.d(r,"removeFavorite",(function(){return B}));var a={};n.r(a),n.d(a,"getPatternsByQuery",(function(){return $})),n.d(a,"getPattern",(function(){return V})),n.d(a,"getCategories",(function(){return G})),n.d(a,"getPatternFlagReasons",(function(){return H})),n.d(a,"getFavorites",(function(){return z}));var o={};n.r(o),n.d(o,"isLoadingPatternsByQuery",(function(){return W})),n.d(o,"getPatterns",(function(){return Y})),n.d(o,&
 quot;getPatternsByQuery",(function(){return X})),n.d(o,"getPatternTotalsByQuery",(function(){return J})),n.d(o,"getPatternTotalPagesByQuery",(function(){return Z})),n.d(o,"getPattern",(function(){return ee})),n.d(o,"getCurrentQuery",(function(){return te})),n.d(o,"isLoadingCategories",(function(){return ne})),n.d(o,"hasLoadedCategories",(function(){return re})),n.d(o,"getCategories",(function(){return ae})),n.d(o,"getCategoryBySlug",(function(){return oe})),n.d(o,"getCategoryById",(function(){return ce})),n.d(o,"getPatternFlagReasons",(function(){return ie})),n.d(o,"isLoadingPatternFlagReasons",(function(){return se})),n.d(o,"getFavorites",(function(){return le})),n.d(o,"isFavorite",(function(){return ue})),n.d(o,"getQueryFromUrl",(function(){return pe})),n.d(o,"getUrlFromQuery",(function(){return de}));var c=n(0),i=n(1),s=n(2),l=
 ({name:e,url:t,avatar:n})=>Object(c.createElement)("a",{href:t,className:"pattern__author-avatar"},Object(c.createElement)("img",{alt:"",src:n}),e);const u=({className:e="",style:t,children:n})=>Object(c.createElement)("span",{className:e+" pattern-skeleton__container",style:t},n),p=e=>Object(c.createElement)("span",{className:"pattern-skeleton",style:e});var d=n(10),b=n.n(d),g=n(9),f=function(e){return Object(c.createElement)(g.SVG,b()({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24"},e),Object(c.createElement)(g.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 e*(2/3)}const h=()=>{const[e,t]=Object
 (c.useState)(),n=Object(c.useRef)();return Object(c.useEffect)(()=>{n.current&&t(m(n.current.clientWidth)+"px")},[n]),Object(c.createElement)("div",{ref:n},Object(c.createElement)(u,null,Object(c.createElement)(p,{height:e}),Object(c.createElement)(p,{height:"14px",marginTop:"1rem"}),Object(c.createElement)(u,{style:{flexDirection:"row",marginTop:"0.5rem",alignItems:"center"}},Object(c.createElement)(p,{height:"18px",width:"18px",marginRight:"0.5rem",borderRadius:"32px"}),Object(c.createElement)(p,{height:"12px",width:"100px",marginRight:"0.75rem"}),Object(c.createElement)(f,{width:"16px",height:"16px",fill:"#787c82",className:"pattern-favorite-button__filled"}),Object(c.createElement)(p,{height:"12px",width:"32px",marginLeft:"0.5rem"}))))};var v=({length:e=6})=>
 Array(e).fill().map((e,t)=>Object(c.createElement)(h,{key:t})),O=n(3);const y=e=>e.split("?")[0],j=(e,t)=>{if(!t||!e)return"";const n=Object(O.getQueryArgs)(e);if(n[t])return n[t];const r=(e=>e.replace(/^\//,""))(y(e).replace(/\/$/,"")).split("/"),a=r.indexOf(t);return-1===a?"":r[a+1]||""},_=e=>Number(j(e,"page")||1),w=Object(c.createContext)();function E({children:e}){const[t,n]=Object(c.useState)(Object(O.getPathAndQueryString)(window.location.href)),r=e=>{window.history.pushState("","",e),n(e)},a=()=>{n(document.location.href)};return Object(c.useEffect)(()=>(window.addEventListener("popstate",a),()=>{window.removeEventListener("popstate",a)}),[]),Object(c.createElement)(w.Provider,{value:{path:t,update:e=>{const n=(e=>(e=>{const t={};return Object.keys(e).forEach(n=>{const r=e[n];null!=r&&r.toString().length>0&a
 mp;&(t[n]=r)}),t})({...Object(O.getQueryArgs)(t),...Object(O.getQueryArgs)(e)}))(e),a=y(e),o=Object(O.addQueryArgs)(a,n);r(o)},replace:r}},e)}function S(){const e=Object(c.useContext)(w);if(void 0===e)throw new Error("useRoute must be used within a Provider");return e}function P({currentPage:e=1,totalPages:t}){const{path:n,update:r}=S();if(!t||t<=1)return null;const a=e>1,o=e<t,s=Object(O.getQueryString)(n)?"?"+Object(O.getQueryString)(n):"",l=n.replace(s,"").replace(/page\/\d+\/?/,""),u=function(e,t=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},[]))}(t,e),p=`${l}page/%s/${s}`,d=e=>1===e?`${l}${s}`:O
 bject(i.sprintf)(p,e),b=(e,t)=>{e.preventDefault(),r(d(t))};return Object(c.createElement)("nav",{className:"pagination","aria-label":Object(i.__)("Pagination","wporg-patterns")},Object(c.createElement)("ul",{className:"pagination__list"},Object(c.createElement)("li",{className:"pagination__item pagination__item-previous-page"},a&&Object(c.createElement)("a",{className:"pagination__link",href:d(e-1),onClick:t=>b(t,e-1)},Object(c.createElement)("span",{className:"screen-reader-text"},Object(i.__)("Previous page","wporg-patterns")),Object(c.createElement)("span",{"aria-hidden":!0},Object(i._x)("Previous","previous page link label","wporg-patterns")))),u.map((t,n)=>"…"===t?Object(c.createElement)("li",{className:"pagination__item",key:`${n}-
 ${t}`},t):Object(c.createElement)("li",{className:"pagination__item",key:t},Object(c.createElement)("a",{className:"pagination__link",href:d(t),"aria-current":t===e?"page":void 0,onClick:e=>b(e,t)},Object(c.createElement)("span",{className:"screen-reader-text"},Object(i.sprintf)(// translators: %s is the page number.
+Object(i.__)("Page %s","wporg-patterns"),t)),Object(c.createElement)("span",{"aria-hidden":!0},t)))),Object(c.createElement)("li",{className:"pagination__item pagination__item-next-page"},o&&Object(c.createElement)("a",{className:"pagination__link",href:d(e+1),onClick:t=>b(t,e+1)},Object(c.createElement)("span",{className:"screen-reader-text"},Object(i.__)("Next page","wporg-patterns")),Object(c.createElement)("span",{"aria-hidden":!0},Object(i._x)("Next","next page link label","wporg-patterns"))))))}var x=n(6);function N(e){return{type:"FETCH_BLOCK_PATTERNS",query:e}}function T(e,t){return{type:"LOAD_BLOCK_PATTERN",postId:e,pattern:t}}function k(e,{page:t,patterns:n,total:r,totalPages:a}){return{type:"LOAD_BLOCK_PATTERNS",query:e,page:t,patterns:n,total:r,totalPages:a}}funct
 ion C(e,{page:t,error:n}){return{type:"ERROR_BLOCK_PATTERNS",query:e,page:t,error:n}}function A(e){return{type:"SET_CURRENT_QUERY",query:e}}function I(){return{type:"FETCH_CATEGORIES"}}function L(e){return{type:"LOAD_CATEGORIES",categories:e}}function R(){return{type:"FETCH_PATTERN_FLAG_REASONS"}}function D(e){return{type:"LOAD_PATTERN_FLAG_REASONS",reasons:e}}function F(e){return{type:"LOAD_FAVORITES",patternIds:e}}function*M(e){const t=yield Object(x.apiFetch)({path:"/wporg/v1/pattern-favorites",method:"POST",data:{id:e}});if("number"==typeof t)return{type:"ADD_FAVORITE",patternId:e,count:t}}function*B(e){const t=yield Object(x.apiFetch)({path:"/wporg/v1/pattern-favorites",method:"DELETE",data:{id:e}});if("number"==typeof t)return{type:"REMOVE_FAVORITE",patternId:e,count:t}}function Q(e={}){const t=Object.keys(e).sort();let n="&
 quot;;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?"&":"")+Object(O.addQueryArgs)("",{[a]:o}).slice(1)}}return n}function q(e={},t){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 U(e={},t){const n=(t.patterns||[]).map(({id:e})=>e),{page:r,total:a,totalPages:o}=t;switch(t.type){case"LOAD_BLOCK_PATTERNS":{const c={...e[t.query]||{},total:a,totalPages:o};return c[r]=n,{...e,[t.query]:c}}case"ERROR_BLOCK_PATTERNS":{const n=e[t.query]||{};return n[r]=[],{...e,[t.q
 uery]:n}}default:return e}}var K=Object(s.combineReducers)({patterns:function(e={},t){return{byId:q(e.byId,t),queries:U(e.queries,t)}},categories:function(e,t){switch(t.type){case"FETCH_CATEGORIES":return null;case"LOAD_CATEGORIES":const e=(t.categories||[]).sort((e,t)=>e.name.localeCompare(t.name));return[{id:-1,slug:"",name:Object(i.__)("All","wporg-patterns"),link:wporgPatternsUrl.site},...e]}return e},currentQuery:function(e,t){switch(t.type){case"SET_CURRENT_QUERY":return t.query}return e},patternFlagReasons:function(e,t){switch(t.type){case"FETCH_PATTERN_FLAG_REASONS":return null;case"LOAD_PATTERN_FLAG_REASONS":return[...t.reasons];default:return e}},favorites:function(e=null,t){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*$(e){const t=Q(e);try{yield N(t);const n=yield Object(x.apiFetch)({path:Object(O.addQueryArgs)("/wp/v2/wporg-pattern",{...e,locale:JSON.parse(wporgLocale)}),parse:!1}),{total:r,totalPages:a,results:o}=yield Object(x.__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 k(t,{page:e.page||1,patterns:o,total:r,totalPages:a})}catch(n){const r=yield Object(x.__unstableAwaitPromise)(async function(e){try{return await e.json()}catch(e){return{}}}(n));yield C(t,{page:e.page||1,error:r})}}function*V(e){try{const t=yield Object(x.apiFetch)({path:Object(O.addQueryArgs)("/wp/v2/wporg-pattern/"+e)});yield T(e,t)}catch(e){}}function*G(){try{yield{type:"FETCH_CATEGORIES"};const e=yield Object(x.apiFetch)({path:Obj
 ect(O.addQueryArgs)("/wp/v2/pattern-categories")});yield L(e)}catch(e){}}function*H(){try{yield{type:"FETCH_PATTERN_FLAG_REASONS"};const e=yield Object(x.apiFetch)({path:Object(O.addQueryArgs)("/wp/v2/wporg-pattern-flag-reason")});yield D(e)}catch(e){}}function*z(){try{const e=yield Object(x.apiFetch)({path:"/wporg/v1/pattern-favorites"});yield F(e)}catch(e){}}function W(e,t){var n,r;const a=Q(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 Y(e){return Object.values(e.patterns.byId)}function X(e,t){var n,r;const a=Q(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 J(e,t){var n,r;const a=Q(t);return(null===(n=e.patterns.queries)||void 0===n||null===(r=n[a])||void 0===r?void 0:r.total)||0}function Z(e,t){var n,r;const a=Q(t);return(
 null===(n=e.patterns.queries)||void 0===n||null===(r=n[a])||void 0===r?void 0:r.totalPages)||0}function ee(e,t){return e.patterns.byId[t]||null}function te(e){return e.currentQuery}function ne(e){return null===e.categories}function re(e){return Array.isArray(e.categories)}function ae(e){return e.categories}function oe(e,t){if(!re(e))return;const[n]=e.categories.filter(e=>e.slug===t);return n}function ce(e,t){if(re(e))return e.categories.find(({id:e})=>t===e)}function ie(e){return e.patternFlagReasons}function se(e){return null===e.patternFlagReasons}function le(e){return e.favorites}function ue(e,t){var n;return null===(n=e.favorites)||void 0===n?void 0:n.includes(t)}function pe(e,t){const n=["categories","author","page","search"],r=Object(O.getQueryArgs)(t),a=j(t,"categories");if(a&&-1===n.indexOf(a)){const t=oe(e,a);null!=t&&t.id&&(r["pattern-categories"]=t.id)}const o=j(t,"author")
 ;o&&-1===n.indexOf(o)&&(r.author_name=o);const c=_(t);"number"==typeof c&&c>1&&(r.page=c);const i=(e=>decodeURI(j(e,"search")))(t);i.length>0&&-1===n.indexOf(i)&&(r.search=i);const s=j(t,"my-patterns");return s&&"page"!==s&&(r.status=s),r}function de(e,t={},n=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=ae(e).find(({id:e})=>r===e);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+="/?"+Object(O.buildQueryString)(t):n+"/"}const be=Object(s.createReduxStore)("wporg/pattern-directory",{reducer:K,selectors:o,actions:r,co
 ntrols:x.controls,resolvers:a});Object(s.register)(be);var ge=function({header:e,children:t,query:n,showPagination:r=!0}){const{isLoading:a,posts:o,totalPages:i}=Object(s.useSelect)(e=>{const{getPatternTotalPagesByQuery:t,getPatternsByQuery:r,isLoadingPatternsByQuery:a}=e(be);return{isLoading:n&&a(n),posts:n?r(n):[],totalPages:n?t(n):0}});return Object(c.createElement)(c.Fragment,null,o.length?e:null,Object(c.createElement)("div",{className:"pattern-grid"},a?Object(c.createElement)(v,{length:null==n?void 0:n.per_page}):o.map(t)),r&&Object(c.createElement)(P,{totalPages:i,currentPage:null==n?void 0:n.page}))},fe=n(8),me=n(4);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=Object(c.forwardRef)((function({contentRef:e,children:t,head:n,headHTML:r,bodyStyle:a="",themeSlug:o="twentytwenty
 one",...s},l){const[u,p]=Object(c.useState)();r+=`<link rel="stylesheet" href="https://wp-themes.com/wp-content/themes/${o}/style.css" media="all" />`,r+=`<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        ${a}\n    }\n    body > div {\n        width: 100%;\n        max-height: 100%;\n        pointer-events: none;\n    }\n    </style>`;const d=Object(c.useCallback)(t=>{function n(){const{contentDocument:n}=t,{readyState:a,body:o}=n;return("interactive"===a||"complete"===a)&&("function"==typeof e?e(o):e&&(e.current=o),function(e,t){e.head.innerHTML="<style>body{margin:0}</style>"+t}(n,r),he(n),function(e){const{defaultView:t}=e,{frameElement:n}=t;function r(e){const r=Object.getProt
 otypeOf(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 c=new a(e.type,o);!n.dispatchEvent(c)&&e.preventDefault()}const a=["keydown","keypress","dragover"];for(const t of a)e.addEventListener(t,r)}(n),he(n),p(n),!0)}t&&(n()||t.addEventListener("load",()=>{n()}))},[]);return Object(c.createElement)("iframe",b()({title:Object(i.__)("Pattern Preview","wporg-patterns"),tabIndex:"-1"},s,{ref:Object(fe.useMergeRefs)([l,d])}),u&&Object(c.createPortal)(t,u.body),u&&Object(c.createPortal)(n,u.head))})),Oe=function({html:e}){return Object(c.createElement)("div",null,Object(c.createElement)(ve,{className:"pattern-preview__viewport-iframe",style:{width:"100%",height:"50vh",minHeight:"600px",overflowY:"auto&qu
 ot;},headHTML:window.__editorStyles.html},Object(c.createElement)("div",{dangerouslySetInnerHTML:{__html:e}})))},ye=n(5),je=n.n(ye);function _e(e,t){return e.map((function(e,n){return e+t[n]}))}function we(e,t){return e.map((function(e,n){return e-t[n]}))}function Ee(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 xe(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 Ne(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 Te(){return(Te=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}).apply(this,arguments)}function ke(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function Ce(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,void 0);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,void 0):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=Ie(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],c=o[0],i=o[1];switch(
 typeof i){case"function":n[c]=i.call(n,e[c],c,e);break;case"object":n[c]=Me(e[c],i);break;case"boolean":i&&(n[c]=e[c])}}return n}function Be(){return"undefined"!=typeof window&&"ontouchstart"in window}function Qe(e){return"pointerId"in e?null:"touchend"===e.type?e.changedTouches:e.targetTouches}function qe(e){return Array.from(Qe(e)).map((function(e){return e.identifier}))}function Ue(e){return{buttons:"buttons"in e?e.buttons:0,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey}}var Ke=function(e){return e};function $e(e,t){void 0===t&&(t=Ke);var n=Qe(e),r=n?n[0]:e;return t([r.clientX,r.clientY])}var Ve=Te({},{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},triggerAllE
 vents: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 Ve.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,c=t.top,i=void 0===c?-1/0:c,s=t.bottom;return[[r,o],[i,void 0===s?1/0:s]]}}),Ge="undefined"!=typeof window&&window.document&&window.document.createElement,He={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=Ge?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},ze=Te({},Ve,{useTouch:function(e){void 0===e&&(e=!1);var t=Be(),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,c=void 0!==o&&o,i=n.axis,s=De(e,a?3:c||(void 0===i?void 0:i)?1:0);return this.filterTaps=a,s},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 We(e){var t,n=e.domTarget,r=e.eventOptions,a=e.window,o=e.enabled,c=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,[&q
 uot;domTarget","eventOptions","window","enabled"]),i=(void 0===(t={domTarget:n,eventOptions:r,window:a,enabled:o})&&(t={}),Me(t,He));return i.drag=function(e){return void 0===e&&(e={}),Me(e,ze)}(c),i}function Ye(e){return Te({_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 Xe(){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:Ye({_pointerId:void 0,axis:void 0,xy:[0,0],
 vxvy:[0,0],velocity:0,distance:0,tap:!1,swipe:[0,0]}),pinch:Ye({_pointerIds:[],da:[0,0],vdva:[0,0],origin:void 0,turns:0}),wheel:Ye({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0}),move:Ye({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0}),scroll:Ye({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0})}}var Je=new Map,Ze=function(e){return e};function et(e,t){return Math.abs(e)>=t&&Se(e)*t}function tt(e,t,n){var r=t[0],a=t[1],o=n[0],c=n[1],i=e[0],s=i[0],l=i[1],u=e[1],p=u[0],d=u[1];return[xe(r,s,l,o),xe(a,p,d,c)]}function nt(e,t,n){var r=e.state,a=t.timeStamp,o=t.type,c=r.values;return{_lastEventType:o,event:t,timeStamp:a,elapsedTime:n?0:a-r.startTime,previous:c}}function rt(e,t,n,r){var a=e.state,o=e.config,c=e.stateKey,i=e.args,s=e.transform,l=a.offset,u=n.timeStamp,p=o.initial,d=o.bounds,b=we(s(o.threshold),s([0,0])).map(Math.abs),g=Te({},Xe()[c],{_active:!0,args:i,values:t,initial:null!=r?r:t,_threshold:b,offset:l,lastOffset:l,startTime:u});return Te({
 },g,{_initial:Fe(p,g),_bounds:Fe(d,g)})}var at=function(e){var t=this;this.classes=e,this.pointerIds=new Set,this.touchIds=new Set,this.supportsTouchEvents=Be(),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={},c=Ie(t.classes);!(a=c()).done;){var i=a.value;new i(t,n).addBindings(o)}var s=function(e){bt(o,e,(function(r){return t.nativeRefs[e](Te({},t.state.shared,{event:r,args:n}))}))};for(var l in t.nativeRefs)s(l);return t.config.domTarget?lt(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)},t
 his.classes=e,this.state=Xe(),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 ct(e,t){"pointerId"in t?e.pointerIds.delete(t.pointerId):qe(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&&(ft(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&&(ft(a.window,o[t],r),gt(a.window,o[t]=n,r))}function lt(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 c=0,i=Object.entries(t);c<i.length;c++){var s=i[c],l=s[0],u=s[1],p=l.slice(2).toLowerCase();r.push([p,Re.apply(void 0,u)])}gt(a,r,o)}function ut(e,t){for(var n={},r=e.config.even
 tOptions.capture?"Capture":"",a=0,o=Object.entries(t);a<o.length;a++){var c=o[a],i=c[0],s=c[1],l=Array.isArray(s)?s:[s];n[i+r]=Re.apply(void 0,l)}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 bt(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,c=o[0],i=o[1];e.addEventListener(c,i,n)}}function ft(e,t,n){void 0===t&&(t=[]),void 0===n&&(n={});for(var r,a=Ie(t);!(r=a()).done;){var o=r.value,c=o[0],i=o[1];e.removeEventListener(c,i,n)}}function mt(){}function ht(e){"persist"in e&&"function"==typeof e.persist&&e.persist()}var vt=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){ht(e),st(t.controlle
 r,t.stateKey,[["touchmove",t.preventScroll],["touchend",t.clean.bind(Ce(t))],["touchcancel",t.clean.bind(Ce(t))]],{passive:!1}),t.setTimeout(t.startDrag.bind(Ce(t)),250,e)},t.setUpDelayedDragTrigger=function(e){t.state._dragDelayed=!0,ht(e),t.setTimeout(t.startDrag.bind(Ce(t)),t.config.delay,e)},t.setStartState=function(e){var n=$e(e,t.transform);t.updateSharedState(Ue(e)),t.updateGestureState(Te({},rt(Ce(t),n,e),nt(Ce(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.pointe
 rLockElement){var r=e.movementX,a=e.movementY;n=_e(t.transform([r,a]),t.state.values)}else n=$e(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 c=Ue(e);t.updateSharedState(c);var i=nt(Ce(t),e),s=Ee(o._movement),l=t.state._dragIsTap;l&&s>=3&&(l=!1),t.updateGestureState(Te({},i,o,{_dragIsTap:l})),t.fireGestureHandler()}},t.onDragEnd=function(e){if(ct(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],c=t.state.movement,i=c[0],s=c[1],l=t.state._intentional,u=l[0],p=l[1],d=t.config.swipeVelocity,b=d[0],g=d[1],f=t.config.swipeDistance,m=f[0],h=f[1],v=t.config.swipeDuration,O=Te({},nt(Ce(t),e),t.getMovement(t.state.values)),y=[0,0];O.elapsedT
 ime<v&&(!1!==u&&Math.abs(a)>b&&Math.abs(i)>m&&(y[0]=Se(a)),!1!==p&&Math.abs(o)>g&&Math.abs(s)>h&&(y[1]=Se(o))),t.updateSharedState({buttons:0}),t.updateGestureState(Te({},O,{tap:n,swipe:y})),t.fireGestureHandler(t.config.filterTaps&&!0===n)}},t.clean=function(){e.prototype.clean.call(Ce(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}ke(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.fireGestureHandl
 er())},n.addBindings=function(e){this.config.useTouch?(bt(e,"onTouchStart",this.onDragStart),bt(e,"onTouchMove",this.onDragChange),bt(e,"onTouchEnd",this.onDragEnd),bt(e,"onTouchCancel",this.onDragEnd)):(bt(e,"onPointerDown",this.onDragStart),bt(e,"onPointerMove",this.onDragChange),bt(e,"onPointerUp",this.onDragEnd),bt(e,"onPointerCancel",this.onDragEnd)),this.config.filterTaps&&bt(e,this.controller.config.eventOptions.capture?"onClick":"onClickCapture",this.onClick)},t}(function(e){function t(){return e.apply(this,arguments)||this}ke(t,e);var n=t.prototype;return n.getInternalMovement=function(e,t){return we(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.loc
 kDirection?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=Ee(t),a=0===r?0:1/r,o=0===n?0:1/n,c=o*r,i=t.map((function(e){return o*e})),s=t.map((function(e){return a*e}));return{velocities:i,velocity:c,distance:Ee(e),direction:s}}(n.movement,n.delta,r))}return n},n.mapStateValues=function(e){return{xy:e.values,vxvy:e.velocities}},t}(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),c=2;c<a;c++)o[c-2]=arguments[c];n.controller.timeout
 s[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,c=Te({},n.controller.state.shared,n.state,n.mapStateValues(n.state),{locked:!!document.pointerLockElement,touches:a,down:o}),i=n.handler(c);return n.state.memo=void 0!==i?i:n.state.memo,c},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=f
 unction(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,c=n._intentional,i=n.lastOffset,s=n.movement,l=n._threshold,u=this.getInternalMovement(e,this.state),p=!1===c[0]?et(u[0],l[0]):c[0],d=!1===c[1]?et(u[1],l[1]):c[1],b=this.checkIntentionality([p,d],u);if(b._blocked)return Te({},b,{_movement:u,delta:[0,0]});var g=b._intentional,f=u,m=[!1!==g[0]?u[0]-g[0]:0,!1!==g[1]?u[1]-g[1]:0],h=_e(m,i),v=o?t:[0,0];return m=tt(r,_e(m,a),v),Te({},b,{intentional:!1!==g[0]||!1!==g[1],_initial:a,_movement:f,movement:m,values:e,offset:tt(r,h,v),delta:we(m,s)})},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(){retur
 n 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||Ze}}])&&Ne(t.prototype,n),e}()));function Ot(e,t){try{return function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var r,a,o,c;if(Array.isArray(t)){if((r=t.length)!==n.length)return!1;for(a=r;0!=a--;)if(!e(t[a],n[a]))return!1;return!0}if("function"==typeof Map&&t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(c=t.entries();!(a=c.next()).done;)if(!n.has(a.value[0]))return!1;for(c=t.entries();!(a=c.next()).done;)if(!e(a.value[1],n.get(a.value[0])))return!1;return!0}if("function"==typeof Set&&t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(c=t.
 entries();!(a=c.next()).done;)if(!n.has(a.value[0]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(o=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(a=r;0!=a--;)if(!Object.prototype.hasOwnProperty.call(n,o[a]))return!1;if("undefined"!=typeof Element&&t instanceof Element)return!1;for(a=r;0!=a--;)if(!("_owner"===o[a]&&t.$$typeof||e(t[o[a]],n[o[a]])))return!1;return!0}return t!=t&&n!=n}(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 yt=n(12),jt=function({label:e,className:t,onDragChange:n,onDragEnd:r,direction:a="left",...o}){const i=function(e,t){void 0===t&&(t={}),Je.set("drag",v
 t);var o=Object(ye.useRef)();return o.current||(o.current=function(e,t){var n,r,a=[],o=!1;return function(){for(var c=arguments.length,i=new Array(c),s=0;s<c;s++)i[s]=arguments[s];return o&&n===this&&t(i,a)||(r=e.apply(this,i),o=!0,n=this,a=i),r}}(We,Ot)),function(e,t,n){void 0===n&&(n={});var r=function(e){var t=new Set;return e.drag&&t.add(Je.get("drag")),e.wheel&&t.add(Je.get("wheel")),e.scroll&&t.add(Je.get("scroll")),e.move&&t.add(Je.get("move")),e.pinch&&t.add(Je.get("pinch")),e.hover&&t.add(Je.get("hover")),t}(e),a=je.a.useMemo((function(){return new at(r)}),[]);return a.config=t,a.handlers=e,a.nativeRefs=n,je.a.useEffect(a.effect,[]),a.config.domTarget?mt:a.bind}({drag:({delta:e,dragging:t})=>{const o="left"===a?-2:2;t?n(e[0]*o):r()}},o.current(t))}();return Object(c.createElement)("div",{className:"pattern-preview
 __drag-handle "+t},Object(c.createElement)("button",b()({className:"pattern-preview__drag-handle-button","aria-label":e},o,{onKeyDown:e=>{const{keyCode:t}=e;"left"===a&&t===yt.LEFT||"right"===a&&t===yt.RIGHT?n(20):("left"===a&&t===yt.RIGHT||"right"===a&&t===yt.LEFT)&&n(-20)},onKeyUp:r},i())))},_t=function e({blockContent:t}){const n=Object(fe.useViewportMatch)("mobile",">="),r=Object(fe.useViewportMatch)("large",">="),a=Object(fe.useViewportMatch)("wide",">="),o=Object(fe.useInstanceId)(e),[s,l]=Object(c.useState)(window.innerWidth<960?window.innerWidth:960),u=Object(c.useCallback)(e=>l(t=>t+e),[l]),p=()=>{s<280&&l(280)},d=Object(c.useMemo)(()=>n?a?[{label:Object(i.__)("Full (1200px)","wporg-patterns"),value:1200},{label:Object(i.__)("Default (960px
 )","wporg-patterns"),value:960},{label:Object(i.__)("Medium (480px)","wporg-patterns"),value:480},{label:Object(i.__)("Narrow (320px)","wporg-patterns"),value:320}]:r?[{label:Object(i.__)("Default (960px)","wporg-patterns"),value:960},{label:Object(i.__)("Medium (480px)","wporg-patterns"),value:480},{label:Object(i.__)("Narrow (320px)","wporg-patterns"),value:320}]:[{label:Object(i.__)("Medium (480px)","wporg-patterns"),value:480},{label:Object(i.__)("Narrow (320px)","wporg-patterns"),value:320}]:[],[n,r,a]);let b=!1;if(!d.some(e=>e.value===s)){const e=Math.max(Math.floor(s),280);b={
</ins><span class="cx" style="display: block; padding: 0 10px"> /* translators: %s is the width in pixels, ex 600. */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-label:Object(i.sprintf)(Object(i.__)("Current (%spx)","wporg-patterns"),e),value:e}}return Object(c.createElement)(c.Fragment,null,Object(c.createElement)("div",{className:"pattern-preview__size-control"},n&&Object(c.createElement)(fe.SelectControl,{hideLabelFromVision:!0,label:Object(i.__)("Preview Width","wporg-patterns"),value:s,options:b?[b,...d]:d,onChange:e=>l(Number(e))})),Object(c.createElement)("div",{className:"pattern-preview__viewport",style:{width:s+40}},Object(c.createElement)(jt,{label:Object(i.__)("Drag to resize","wporg-patterns"),className:"is-left",onDragChange:u,onDragEnd:p,direction:"left","aria-describedby":"pattern-preview__resize-help-"+o}),Object(c.createElement)(Oe,{html:t}),Object(c.createElement)(jt,{label:Objec
 t(i.__)("Drag to resize","wporg-patterns"),className:"is-right",onDragChange:u,onDragEnd:p,direction:"right","aria-describedby":"pattern-preview__resize-help-"+o}),Object(c.createElement)(fe.VisuallyHidden,{id:"pattern-preview__resize-help-"+o,className:"pattern-preview__resize-help"},Object(i.__)("Use left and right arrow keys to resize the preview.","wporg-patterns"))))},wt=n(7),Et=n.n(wt),St=n(15),Pt=n(11),xt=({isSmall:e=!1,onSuccess:t=St.noop,content:n})=>{const[r,a]=Object(c.useState)(!1);if(!n){const e=document.getElementById("block-data");n=JSON.parse(decodeURIComponent(e.value))}Object(c.useEffect)(()=>{if(!r)return;Object(Pt.speak)(Object(i.__)("Copied pattern to clipboard.","wporg-patterns"));const e=setTimeout(()=>a(!1),2e4);return()=>{clearTimeout(e)}},[r]);let o=Object(i.__)("Copy Pattern","wporg-patterns");e&a
 mp;&(o=r?Object(i.__)("Copied","wporg-patterns"):Object(i.__)("Copy","wporg-patterns"));const s=Et()({"pattern-copy-button":!0,"is-small-label":e});return Object(c.createElement)(fe.Button,{className:s,isPrimary:!0,onClick:({target:e})=>{const r=(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})(n);a(r),e.focus(),r&&t()}},o)},Nt=n(13),Tt=function(e){return Object(c.createElement)(g.SVG,b()({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24"},e),Object(c.createElement)(g.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"}))},kt=({showLabel:e=!0,patternId:t})=>{const{hasPermission:n,isFavorite:r}=Object(s.useSelect)(e=>(e(be).getFavorites(),{hasPermission:!!e(Nt.store).canUser("create","../../wporg/v1/pattern-favorites"),isFavorite:e(be).isFavorite(t)})),{addFavorite:a,removeFavorite:o}=Object(s.useDispatch)(be),l=Object(c.useCallback)(()=>{r?o(t):a(t)},[r]);if(!n)return null;const u=Et()("button button-link pattern-favorite-button",{"is-favorited":r,"has-label":e}),p=Et()({"screen-reader-text":!e});return Object(c.createElement)("button",{className:u,onClick:l},Object(c.cre
 ateElement)(m,{className:"pattern-favorite-button__filled"}),Object(c.createElement)(Tt,{className:"pattern-favorite-button__outline"}),Object(c.createElement)("span",{className:p},r?Object(i.__)("Remove from favorites","wporg-patterns"):Object(i.__)("Add to favorites","wporg-patterns")))},At=({onClick:e})=>Object(c.createElement)(fe.Notice,{className:"pattern-actions__notice",status:"success",isDismissible:!1,actions:[{label:Object(i.__)("Learn More","wporg-patterns"),onClick:e,variant:"secondary"}]},Object(c.createElement)("div",null,Object(c.createElement)("b",null,Object(i.__)("Pattern copied!","wporg-patterns")),Object(i.__)(" Now you can paste it into any WordPress post or page.","wporg-patterns")));const Ct=()=>Object(c.createElement)("div",{style:{height:"220px"}},Object(c
 .createElement)("img",{src:wporgPatternsUrl.assets+"/images/copy-paste-demo.gif",alt:Object(i.__)("GIF of copy and pasting.","wporg-patterns")}));var It=({onFinish:e})=>Object(c.createElement)(fe.Animate,{type:"appear",options:{origin:"bottom"}},({className:t})=>Object(c.createElement)(fe.Guide,{className:"pattern-actions__guide "+t,onFinish:e,finishButtonText:Object(i.__)("Close","wporg-patterns"),pages:[{image:Object(c.createElement)(Ct,null),content:Object(c.createElement)("div",{className:"pattern-actions__guide-content"},Object(c.createElement)("h3",{className:"pattern-actions__guide-title"},Object(i.__)("How to use patterns on your WordPress site.","wporg-patterns")),Object(c.createElement)("p",null,Object(i.__)("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")),Object(c.createElement)("ol",null,Object(c.createElement)("li",null,Object(c.createElement)("p",null,Object(i.__)("Open any post or page in the WordPress block editor.","wporg-patterns"))),Object(c.createElement)("li",null,Object(c.createElement)("p",null,Object(i.__)("Place your cursor where you want to add the pattern.","wporg-patterns"))),Object(c.createElement)("li",null,Object(c.createElement)("p",null,Object(c.createInterpolateElement)(Object(i.__)("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:Object(c.createElement)("kbd",{className:"pattern-action
 s__guide-shortcut"})})))))}]})),Lt=({postId:e})=>{const[t,n]=Object(c.useState)(!1),[r,a]=Object(c.useState)(!1);return Object(c.createElement)("div",{className:"pattern-actions"},Object(c.createElement)("div",{className:"pattern-actions__container"},Object(c.createElement)(xt,{onSuccess:()=>n(!0)}),Object(c.createElement)(kt,{patternId:e}),t&&Object(c.createElement)(At,{onClick:()=>a(!0)}),r&&Object(c.createElement)(It,{onFinish:()=>a(!1)})))},Rt=n(14),Dt=function({className:e,html:t}){const n=Object(c.useRef)(),[r,a]=Object(c.useState)("100%"),[o,s]=Object(c.useState)(.3125);Object(c.useEffect)(()=>{const e=()=>{try{a(f(n.current.clientWidth)),s(n.current.clientWidth/800)}catch(e){}};return e(),window.addEventListener("resize",e),()=>{window.addEventListener("resize",e)}},[]);const l={border:"none",width:"800px",maxWidth:"none",height:f(800)
 +"px",transform:`scale(${o})`,transformOrigin:Object(i.isRTL)()?"top right":"top left",pointerEvents:"none"};return Object(c.createElement)("div",{className:e,ref:n,style:{height:r},tabIndex:"-1"},Object(c.createElement)(ve,{className:"pattern-grid__preview-iframe",style:l,bodyStyle:"overflow: hidden;",headHTML:window.__editorStyles.html},Object(c.createElement)("div",{dangerouslySetInnerHTML:{__html:t}})))},Ft=({className:e,label:t,patternId:n})=>{const{hasPermission:r,isFavorite:a}=Object(s.useSelect)(e=>(e(be).getFavorites(),{hasPermission:!!e(Nt.store).canUser("create","../../wporg/v1/pattern-favorites"),isFavorite:e(be).isFavorite(n)})),{addFavorite:o,removeFavorite:i}=Object(s.useDispatch)(be),l=Object(c.useCallback)(()=>{a?i(n):o(n)},[a]),u=Et()(e,"pattern-favorite-button-small",{button:r,"button-link":r,"is-favorited":a});return
  r?Object(c.createElement)("button",{className:u,onClick:l},Object(c.createElement)(m,{className:"pattern-favorite-button__filled"}),Object(c.createElement)("span",null,t)):Object(c.createElement)("span",{className:u},Object(c.createElement)(m,{className:"pattern-favorite-button__filled"}),Object(c.createElement)("span",null,t))},Mt=function({pattern:e,showAvatar:t}){const n=function(e){switch(e.status){case"pending":return Object(i.__)("Pending","wporg-patterns");case"draft":return Object(i.__)("Draft","wporg-patterns");case"declined":return Object(i.__)("Declined","wporg-patterns")}return""}(e);return Object(c.createElement)("div",{className:"pattern-grid__pattern"},Object(c.createElement)("div",{className:"pattern-grid__pattern-frame"},Object(c.createElement)("a",{href:e.li
 nk,rel:"bookmark"},Object(c.createElement)("span",{className:"screen-reader-text"},Object(Rt.decodeEntities)(e.title.rendered)),Object(c.createElement)(fe.Disabled,null,Object(c.createElement)(Dt,{className:"pattern-grid__preview",html:e.content.rendered}))),n?Object(c.createElement)("div",{className:"pattern-grid__status is-"+e.status},Object(c.createElement)("span",null,n)):null,Object(c.createElement)("span",{className:"pattern-grid__actions"},Object(c.createElement)(kt,{showLabel:!1,patternId:e.id}),Object(c.createElement)(xt,{isSmall:!0,content:e.pattern_content}))),Object(c.createElement)("h2",{className:"pattern-grid__title"},Object(c.createElement)("a",{href:e.link},Object(Rt.decodeEntities)(e.title.rendered))),Object(c.createElement)("p",{className:"pattern-grid__meta"},t&&e.author_meta?Object(c.createElement)("a",{hre
 f:e.author_meta.url,className:"pattern-grid__author-avatar"},Object(c.createElement)("img",{alt:"",src:e.author_meta.avatar}),e.author_meta.name):null,e.favorite_count>0?Object(c.createElement)(Ft,{className:"pattern-grid__favorite-count",patternId:e.id,label:Object(c.createElement)(c.Fragment,null,Object(c.createElement)("span",{className:"screen-reader-text"},Object(i.sprintf)(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+label:Object(i.sprintf)(Object(i.__)("Current (%spx)","wporg-patterns"),e),value:e}}return Object(c.createElement)(c.Fragment,null,Object(c.createElement)("div",{className:"pattern-preview__size-control"},n&&Object(c.createElement)(me.SelectControl,{hideLabelFromVision:!0,label:Object(i.__)("Preview Width","wporg-patterns"),value:s,options:b?[b,...d]:d,onChange:e=>l(Number(e))})),Object(c.createElement)("div",{className:"pattern-preview__viewport",style:{width:s+40}},Object(c.createElement)(jt,{label:Object(i.__)("Drag to resize","wporg-patterns"),className:"is-left",onDragChange:u,onDragEnd:p,direction:"left","aria-describedby":"pattern-preview__resize-help-"+o}),Object(c.createElement)(Oe,{html:t}),Object(c.createElement)(jt,{label:Object
 (i.__)("Drag to resize","wporg-patterns"),className:"is-right",onDragChange:u,onDragEnd:p,direction:"right","aria-describedby":"pattern-preview__resize-help-"+o}),Object(c.createElement)(me.VisuallyHidden,{id:"pattern-preview__resize-help-"+o,className:"pattern-preview__resize-help"},Object(i.__)("Use left and right arrow keys to resize the preview.","wporg-patterns"))))},wt=n(7),Et=n.n(wt),St=n(13),Pt=n(11),xt=({isSmall:e=!1,onSuccess:t=St.noop,content:n})=>{const[r,a]=Object(c.useState)(!1);if(!n){const e=document.getElementById("block-data");n=JSON.parse(decodeURIComponent(e.value))}Object(c.useEffect)(()=>{if(!r)return;Object(Pt.speak)(Object(i.__)("Copied pattern to clipboard.","wporg-patterns"));const e=setTimeout(()=>a(!1),2e4);return()=>{clearTimeout(e)}},[r]);let o=Object(i.__)("Copy Pattern","wporg-patterns");e&am
 p;&(o=r?Object(i.__)("Copied","wporg-patterns"):Object(i.__)("Copy","wporg-patterns"));const s=Et()({"pattern-copy-button":!0,"is-small-label":e});return Object(c.createElement)(me.Button,{className:s,isPrimary:!0,onClick:({target:e})=>{const r=(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})(n);a(r),e.focus(),r&&t()}},o)},Nt=n(14),Tt=function(e){return Object(c.createElement)(g.SVG,b()({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24"},e),Object(c.createElement)(g.Path,{d:"M12 4.915c1.09-1.28 2.76-2.09 4.5-2.09 3.0
 8 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"}))},kt=({showLabel:e=!0,patternId:t})=>{const{hasPermission:n,isFavorite:r}=Object(s.useSelect)(e=>(e(be).getFavorites(),{hasPermission:!!e(Nt.store).canUser("create","../../wporg/v1/pattern-favorites"),isFavorite:e(be).isFavorite(t)})),{addFavorite:a,removeFavorite:o}=Object(s.useDispatch)(be),l=Object(c.useCallback)(()=>{r?o(t):a(t)},[r]);if(!n)return null;const u=Et()("button button-link pattern-favorite-button",{"is-favorited":r,"has-label":e}),p=Et()({"screen-reader-text":!e});return Object(c.createElement)("button",{className:u,onClick:l},Object(c.crea
 teElement)(f,{className:"pattern-favorite-button__filled"}),Object(c.createElement)(Tt,{className:"pattern-favorite-button__outline"}),Object(c.createElement)("span",{className:p},r?Object(i.__)("Remove from favorites","wporg-patterns"):Object(i.__)("Add to favorites","wporg-patterns")))},Ct=({onClick:e})=>Object(c.createElement)(me.Notice,{className:"pattern-actions__notice",status:"success",isDismissible:!1,actions:[{label:Object(i.__)("Learn More","wporg-patterns"),onClick:e,variant:"secondary"}]},Object(c.createElement)("div",null,Object(c.createElement)("b",null,Object(i.__)("Pattern copied!","wporg-patterns")),Object(i.__)(" Now you can paste it into any WordPress post or page.","wporg-patterns")));const At=()=>Object(c.createElement)("div",{style:{height:"220px"}},Object(c.
 createElement)("img",{src:wporgPatternsUrl.assets+"/images/copy-paste-demo.gif",alt:Object(i.__)("GIF of copy and pasting.","wporg-patterns")}));var It=({onFinish:e})=>Object(c.createElement)(me.Animate,{type:"appear",options:{origin:"bottom"}},({className:t})=>Object(c.createElement)(me.Guide,{className:"pattern-actions__guide "+t,onFinish:e,finishButtonText:Object(i.__)("Close","wporg-patterns"),pages:[{image:Object(c.createElement)(At,null),content:Object(c.createElement)("div",{className:"pattern-actions__guide-content"},Object(c.createElement)("h3",{className:"pattern-actions__guide-title"},Object(i.__)("How to use patterns on your WordPress site.","wporg-patterns")),Object(c.createElement)("p",null,Object(i.__)("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")),Object(c.createElement)("ol",null,Object(c.createElement)("li",null,Object(c.createElement)("p",null,Object(i.__)("Open any post or page in the WordPress block editor.","wporg-patterns"))),Object(c.createElement)("li",null,Object(c.createElement)("p",null,Object(i.__)("Place your cursor where you want to add the pattern.","wporg-patterns"))),Object(c.createElement)("li",null,Object(c.createElement)("p",null,Object(c.createInterpolateElement)(Object(i.__)("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:Object(c.createElement)("kbd",{className:"pattern-actions
 __guide-shortcut"})})))))}]})),Lt=({postId:e})=>{const[t,n]=Object(c.useState)(!1),[r,a]=Object(c.useState)(!1);return Object(c.createElement)("div",{className:"pattern-actions"},Object(c.createElement)("div",{className:"pattern-actions__container"},Object(c.createElement)(xt,{onSuccess:()=>n(!0)}),Object(c.createElement)(kt,{patternId:e}),t&&Object(c.createElement)(Ct,{onClick:()=>a(!0)}),r&&Object(c.createElement)(It,{onFinish:()=>a(!1)})))},Rt=n(15),Dt=function({className:e,html:t}){const n=Object(c.useRef)(),[r,a]=Object(c.useState)("1px"),[o,s]=Object(c.useState)(.3125),l=(({element:e})=>{const[t,n]=Object(c.useState)(null);Object(c.useEffect)(()=>{if(!e.current)return;const t=Object(St.debounce)(r,200);return r(),window.addEventListener("scroll",t),window.addEventListener("resize",t),()=>{window.removeEventListener("scroll",t),window.addEventListener("
 resize",t)}},[e]);const r=()=>{if(!e.current)return;const t=window.innerHeight,{top:r}=e.current.getBoundingClientRect();n(r>=0&&r<=t)};return t})({element:n}),[u,p]=Object(c.useState)(!1);Object(c.useEffect)(()=>{l&&p(!0)},[l]),Object(c.useEffect)(()=>{const e=()=>{try{a(m(n.current.clientWidth)),s(n.current.clientWidth/800)}catch(e){}};return e(),window.addEventListener("resize",e),()=>{window.addEventListener("resize",e)}},[]);const d={border:"none",width:"800px",maxWidth:"none",height:m(800)+"px",transform:`scale(${o})`,transformOrigin:Object(i.isRTL)()?"top right":"top left",pointerEvents:"none"};return Object(c.createElement)("div",{className:e,ref:n,style:{height:r},tabIndex:"-1"},Object(c.createElement)(ve,{className:"pattern-grid__preview-iframe",style:d,bodyStyle:"overflow: hidden;",headHTML:window.__edi
 torStyles.html},Object(c.createElement)("div",{dangerouslySetInnerHTML:{__html:u?t:""}})))},Ft=({className:e,label:t,patternId:n})=>{const{hasPermission:r,isFavorite:a}=Object(s.useSelect)(e=>(e(be).getFavorites(),{hasPermission:!!e(Nt.store).canUser("create","../../wporg/v1/pattern-favorites"),isFavorite:e(be).isFavorite(n)})),{addFavorite:o,removeFavorite:i}=Object(s.useDispatch)(be),l=Object(c.useCallback)(()=>{a?i(n):o(n)},[a]),u=Et()(e,"pattern-favorite-button-small",{button:r,"button-link":r,"is-favorited":a});return r?Object(c.createElement)("button",{className:u,onClick:l},Object(c.createElement)(f,{className:"pattern-favorite-button__filled"}),Object(c.createElement)("span",null,t)):Object(c.createElement)("span",{className:u},Object(c.createElement)(f,{className:"pattern-favorite-button__filled"}),Object(c.createElement)("span",null,t))
 },Mt=function({pattern:e,showAvatar:t}){const n=function(e){switch(e.status){case"pending":return Object(i.__)("Pending","wporg-patterns");case"draft":return Object(i.__)("Draft","wporg-patterns");case"declined":return Object(i.__)("Declined","wporg-patterns")}return""}(e);return Object(c.createElement)("div",{className:"pattern-grid__pattern"},Object(c.createElement)("div",{className:"pattern-grid__pattern-frame"},Object(c.createElement)("a",{href:e.link,rel:"bookmark"},Object(c.createElement)("span",{className:"screen-reader-text"},Object(Rt.decodeEntities)(e.title.rendered)),Object(c.createElement)(me.Disabled,null,Object(c.createElement)(Dt,{className:"pattern-grid__preview",html:e.content.rendered}))),n?Object(c.createElement)("div",{className:"pattern-grid__status is-"+e
 .status},Object(c.createElement)("span",null,n)):null,Object(c.createElement)("span",{className:"pattern-grid__actions"},Object(c.createElement)(kt,{showLabel:!1,patternId:e.id}),Object(c.createElement)(xt,{isSmall:!0,content:e.pattern_content}))),Object(c.createElement)("h2",{className:"pattern-grid__title"},Object(c.createElement)("a",{href:e.link},Object(Rt.decodeEntities)(e.title.rendered))),Object(c.createElement)("p",{className:"pattern-grid__meta"},t&&e.author_meta?Object(c.createElement)("a",{href:e.author_meta.url,className:"pattern-grid__author-avatar"},Object(c.createElement)("img",{alt:"",src:e.author_meta.avatar}),e.author_meta.name):null,e.favorite_count>0?Object(c.createElement)(Ft,{className:"pattern-grid__favorite-count",patternId:e.id,label:Object(c.createElement)(c.Fragment,null,Object(c.createElement)("span",{class
 Name:"screen-reader-text"},Object(i.sprintf)(
</ins><span class="cx" style="display: block; padding: 0 10px"> /* translators: %s is the favorite count for a pattern. */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-Object(i._n)("Favorited %s times","Favorited %s times",e.favorite_count,"wporg-patterns"),e.favorite_count)),Object(c.createElement)("span",{"aria-hidden":!0},e.favorite_count))}):null))},Qt=function({icon:e,size:t=24,...n}){return Object(c.cloneElement)(e,{width:t,height:t,...n})},Bt=Object(c.createElement)(g.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(c.createElement)(g.Path,{d:"M18.3 5.6L9.9 16.9l-4.6-3.4-.9 1.2 5.8 4.3 9.3-12.6z"})),qt=n(16),Ut=n.n(qt);const Kt=(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 $t=({postId:e,onClose:t})=>{const[n,r]=Object(c.useReducer)(Kt,{}),[a,o]=Object(c.useState)(""),[l,u]=
 Object(c.useState)(""),p=Object(c.useRef)(),d=Object(i.__)("Your report has been submitted.","wporg-patterns"),{isLoading:b,mappedReasons:g}=Object(s.useSelect)(e=>{const{getPatternFlagReasons:t,isLoadingPatternFlagReasons:n}=e(be),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()}))}}),m=()=>{t(n.isSubmitted)};return Object(c.createElement)(fe.Modal,{className:"pattern-report-modal "+(n.isSubmitted?"":"pattern-report-modal__has-fixed-height"),title:Object(i.__)("Report this pattern","wporg-patterns"),onRequestClose:m},Object(c.createElement)("div",{ref:p},b?Object(c.createElement)(fe.Spinner,null):n.isSubmitted?Object(c.createElement)("p",{className:"pattern-report-modal__copy"},d):Object(c.createElement)("form&q
 uot;,{onSubmit:t=>{t.preventDefault(),a&&l.length&&!n.isSubmitted&&!n.isSubmitting&&(r({status:"submitting"}),Ut()({path:Object(O.addQueryArgs)("/wp/v2/wporg-pattern-flag"),method:"POST",data:{parent:e,"wporg-pattern-flag-reason":a,excerpt:l}}).then(()=>{r({status:"submitted"}),Object(Pt.speak)(d),p.current.closest('[role="dialog"]').focus()}).catch(e=>{r({status:"error",message:e.message}),Object(Pt.speak)(Object(i.sprintf)(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+Object(i._n)("Favorited %s times","Favorited %s times",e.favorite_count,"wporg-patterns"),e.favorite_count)),Object(c.createElement)("span",{"aria-hidden":!0},e.favorite_count))}):null))},Bt=function({icon:e,size:t=24,...n}){return Object(c.cloneElement)(e,{width:t,height:t,...n})},Qt=Object(c.createElement)(g.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(c.createElement)(g.Path,{d:"M18.3 5.6L9.9 16.9l-4.6-3.4-.9 1.2 5.8 4.3 9.3-12.6z"})),qt=n(16),Ut=n.n(qt);const Kt=(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 $t=({postId:e,onClose:t})=>{const[n,r]=Object(c.useReducer)(Kt,{}),[a,o]=Object(c.useState)(""),[l,u]=O
 bject(c.useState)(""),p=Object(c.useRef)(),d=Object(i.__)("Your report has been submitted.","wporg-patterns"),{isLoading:b,mappedReasons:g}=Object(s.useSelect)(e=>{const{getPatternFlagReasons:t,isLoadingPatternFlagReasons:n}=e(be),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()}))}}),f=()=>{t(n.isSubmitted)};return Object(c.createElement)(me.Modal,{className:"pattern-report-modal "+(n.isSubmitted?"":"pattern-report-modal__has-fixed-height"),title:Object(i.__)("Report this pattern","wporg-patterns"),onRequestClose:f},Object(c.createElement)("div",{ref:p},b?Object(c.createElement)(me.Spinner,null):n.isSubmitted?Object(c.createElement)("p",{className:"pattern-report-modal__copy"},d):Object(c.createElement)("form&qu
 ot;,{onSubmit:t=>{t.preventDefault(),a&&l.length&&!n.isSubmitted&&!n.isSubmitting&&(r({status:"submitting"}),Ut()({path:Object(O.addQueryArgs)("/wp/v2/wporg-pattern-flag"),method:"POST",data:{parent:e,"wporg-pattern-flag-reason":a,excerpt:l}}).then(()=>{r({status:"submitted"}),Object(Pt.speak)(d),p.current.closest('[role="dialog"]').focus()}).catch(e=>{r({status:"error",message:e.message}),Object(Pt.speak)(Object(i.sprintf)(
</ins><span class="cx" style="display: block; padding: 0 10px"> /* translators: %s: Error message. */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-Object(i.__)("Error: %s","wporg-patterns"),e.message))}))}},Object(c.createElement)(fe.RadioControl,{className:"pattern-report-modal__radio",label:Object(i.__)("Please choose a reason:","wporg-patterns"),selected:a,options:g,onChange:o,required:!0}),Object(c.createElement)(fe.TextareaControl,{label:Object(i.__)("Please provide details (required)","wporg-patterns"),value:l,onChange:u,required:!0}),n.hasError&&Object(c.createElement)("div",{className:"notice notice-large notice-alt notice-error"},n.message),Object(c.createElement)("div",{className:"pattern-report-modal__actions"},Object(c.createElement)(fe.Button,{isSecondary:!0,onClick:m},Object(i.__)("Cancel","wporg-patterns")),Object(c.createElement)(fe.Button,{type:"submit",isBusy:n.isSubmi
 tting,isPrimary:!0},n.isSubmitting?Object(i.__)("Submitting …","wporg-patterns"):Object(i.__)("Report","wporg-patterns"))))))},Vt=({postId:e,userHasReported:t})=>{const[n,r]=Object(c.useState)(!1),[a,o]=Object(c.useState)(!1),s=t||a,l=!!wporgPatternsData.userId;return s?Object(c.createElement)("p",{className:"pattern-report-button__copy"},Object(c.createElement)(Qt,{icon:Bt}),Object(i.__)("You've reported this pattern","wporg-patterns")):l?Object(c.createElement)(c.Fragment,null,Object(c.createElement)(fe.Button,{className:"pattern-report-button",isLink:!0,onClick:()=>r(!0)},Object(i.__)("Report this pattern","wporg-patterns")),n&&Object(c.createElement)($t,{postId:e,onClose:e=>{r(!1),o(e)}})):Object(c.createElement)("p",{className:"pattern-report-button__copy"},Object(c.createElement)("a",{href:Object(O.addQueryArgs)("/w
 p-login.php",{redirect_to:window.location.pathname})},Object(i.__)("Login to report this pattern","wporg-patterns")))},Gt=({postId:e,userHasReported:t})=>{e=Number(e)||0;const n=Object(s.useSelect)(t=>t(be).getPattern(e),[e]);return n?Object(c.createElement)(c.Fragment,null,Object(c.createElement)(Lt,{postId:e}),Object(c.createElement)("div",{className:"pattern-preview__container"},Object(c.createElement)(_t,{blockContent:n.content.rendered}),Object(c.createElement)("div",{className:"pattern__meta"},Object(c.createElement)(Vt,{userHasReported:"true"===t,postId:e}))),Object(c.createElement)("div",{className:"entry-content"},Object(c.createElement)(ge,{query:{author:n.author,per_page:3,exclude:e},showPagination:!1,header:Object(c.createElement)(c.Fragment,null,Object(c.createElement)("h2",null,Object(i.__)("More from this designer","wporg-patterns")),Objec
 t(c.createElement)(l,n.author_meta))},e=>Object(c.createElement)(Mt,{key:e.id,pattern:e})))):null},Ht=()=>{const{path:e}=S(),t=Object(s.useSelect)(t=>{var n;const r=t(be).getQueryFromUrl(e),a=null===(n=t(be).getCategoryById(r["pattern-categories"]))||void 0===n?void 0:n.name,o=wporgPatternsData.currentAuthorName||(null==r?void 0:r.author_name),c=_(e),s=y(e).replace(/^\/patterns/,"").split("/")[1]||"",l=[];return"categories"===s&&a?l.push(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+Object(i.__)("Error: %s","wporg-patterns"),e.message))}))}},Object(c.createElement)(me.RadioControl,{className:"pattern-report-modal__radio",label:Object(i.__)("Please choose a reason:","wporg-patterns"),selected:a,options:g,onChange:o,required:!0}),Object(c.createElement)(me.TextareaControl,{label:Object(i.__)("Please provide details (required)","wporg-patterns"),value:l,onChange:u,required:!0}),n.hasError&&Object(c.createElement)("div",{className:"notice notice-large notice-alt notice-error"},n.message),Object(c.createElement)("div",{className:"pattern-report-modal__actions"},Object(c.createElement)(me.Button,{isSecondary:!0,onClick:f},Object(i.__)("Cancel","wporg-patterns")),Object(c.createElement)(me.Button,{type:"submit",isBusy:n.isSubmit
 ting,isPrimary:!0},n.isSubmitting?Object(i.__)("Submitting …","wporg-patterns"):Object(i.__)("Report","wporg-patterns"))))))},Vt=({postId:e,userHasReported:t})=>{const[n,r]=Object(c.useState)(!1),[a,o]=Object(c.useState)(!1),s=t||a,l=!!wporgPatternsData.userId;return s?Object(c.createElement)("p",{className:"pattern-report-button__copy"},Object(c.createElement)(Bt,{icon:Qt}),Object(i.__)("You've reported this pattern","wporg-patterns")):l?Object(c.createElement)(c.Fragment,null,Object(c.createElement)(me.Button,{className:"pattern-report-button",isLink:!0,onClick:()=>r(!0)},Object(i.__)("Report this pattern","wporg-patterns")),n&&Object(c.createElement)($t,{postId:e,onClose:e=>{r(!1),o(e)}})):Object(c.createElement)("p",{className:"pattern-report-button__copy"},Object(c.createElement)("a",{href:Object(O.addQueryArgs)("/wp
 -login.php",{redirect_to:window.location.pathname})},Object(i.__)("Login to report this pattern","wporg-patterns")))},Gt=({postId:e,userHasReported:t})=>{e=Number(e)||0;const n=Object(s.useSelect)(t=>t(be).getPattern(e),[e]);return n?Object(c.createElement)(c.Fragment,null,Object(c.createElement)(Lt,{postId:e}),Object(c.createElement)("div",{className:"pattern-preview__container"},Object(c.createElement)(_t,{blockContent:n.content.rendered}),Object(c.createElement)("div",{className:"pattern__meta"},Object(c.createElement)(Vt,{userHasReported:"true"===t,postId:e}))),Object(c.createElement)("div",{className:"entry-content"},Object(c.createElement)(ge,{query:{author:n.author,per_page:3,exclude:e},showPagination:!1,header:Object(c.createElement)(c.Fragment,null,Object(c.createElement)("h2",null,Object(i.__)("More from this designer","wporg-patterns")),Object
 (c.createElement)(l,n.author_meta))},e=>Object(c.createElement)(Mt,{key:e.id,pattern:e})))):null},Ht=()=>{const{path:e}=S(),t=Object(s.useSelect)(t=>{var n;const r=t(be).getQueryFromUrl(e),a=null===(n=t(be).getCategoryById(r["pattern-categories"]))||void 0===n?void 0:n.name,o=wporgPatternsData.currentAuthorName||(null==r?void 0:r.author_name),c=_(e),s=y(e).replace(/^\/patterns/,"").split("/")[1]||"",l=[];return"categories"===s&&a?l.push(
</ins><span class="cx" style="display: block; padding: 0 10px"> /* translators: Taxonomy term name */
</span><span class="cx" style="display: block; padding: 0 10px"> Object(i.sprintf)(Object(i.__)("Block Patterns: %s","wporg-patterns"),a)):"author"===s&&o?l.push(
</span><span class="cx" style="display: block; padding: 0 10px"> /* translators: Author name */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -25,8 +25,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /* translators: %1$d: number of patterns, %2$s category name. */
</span><span class="cx" style="display: block; padding: 0 10px"> Object(i._n)("%1$d <b>%2$s</b> pattern.","%1$d <b>%2$s</b> patterns.",n,"wporg-patterns"),n,e,"wporg-patterns"),{b:Object(c.createElement)("b",null)}):t?Object(c.createInterpolateElement)(Object(i.sprintf)(
</span><span class="cx" style="display: block; padding: 0 10px"> /* translators: %1$d: number of patterns, %2$s author name. */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-Object(i._n)("%1$d pattern by <b>%2$s</b>.","%1$d patterns by <b>%2$s</b>.",n,"wporg-patterns"),n,t),{b:Object(c.createElement)("b",null)}):Object(i.__)("Loading patterns","wporg-patterns"))({category:null==l?void 0:l.name,author:o},u)),null!=d&&d.include&&!l&&r(""))},[d,p]);const b=Et()({"context-bar__spinner":!0,"context-bar__spinner--is-hidden":!p});return n?Object(c.createElement)("header",{className:"context-bar"},Object(c.createElement)("h2",{className:"context-bar__copy"},Object(c.createElement)("span",{className:b},Object(c.createElement)(fe.Spinner,null)),Object(c.createElement)("span",null,n)),a.links&&a.links.length>0&&Object(c.createElement)("div",{clas
 sName:"context-bar__links"},Object(c.createElement)("h3",{className:"context-bar__title"},a.title),Object(c.createElement)("ul",null,a.links.map(e=>Object(c.createElement)("li",{key:e.href},Object(c.createElement)("a",{href:e.href},e.label)))))):null},en=({options:e})=>{const{path:t,replace:n}=S(),r=Object(me.useViewportMatch)("medium",">=");return e?Object(c.createElement)("div",{className:"pattern-order-select"},Object(c.createElement)(fe.SelectControl,{label:Object(i.__)("Order by","wporg-patterns"),labelPosition:"side",hideLabelFromVision:r,value:Object(O.getQueryArg)(window.location.href,"orderby"),options:e,onChange:e=>{n(Object(O.addQueryArgs)(t,{orderby:e}).replace(/\/page\/[\d]+/,""))}})):null},tn=()=>Object(c.createElement)(u,{className:"pattern-menu",style:{flexDirection:"row"}},Array(7).fi
 ll().map((e,t)=>Object(c.createElement)(p,{key:t,height:"1.25rem",width:"5rem",marginRight:"1rem"}))),nn=({current:e,isLoading:t,label:n=Object(i.__)("Main Menu","wporg-patterns"),onClick:r,options:a})=>t?Object(c.createElement)(tn,null):a.length?Object(c.createElement)("nav",null,Object(c.createElement)("h2",{className:"screen-reader-text"},n),Object(c.createElement)("ul",{className:"pattern-menu"},a.map(t=>Object(c.createElement)("li",{key:t.value},Object(c.createElement)("a",{className:Et()({"pattern-menu__item":!0,"is-active":e===t.slug}),href:t.value,onClick:r,"aria-current":e===t.slug?"page":void 0},t.label))))):null,rn=({onClick:e,options:t,label:n=Object(i.__)("Browse categories","wporg-patterns")})=>{const[r,a]=Object(c.useState)(!1);return Object(c.createElement)(fe.PanelBody,{classNa
 me:"pattern-menu is-mobile",title:n,initialOpen:r,opened:r,onToggle:()=>a(!r)},Object(c.createElement)("ul",null,t.map(t=>Object(c.createElement)("li",{key:t.value},Object(c.createElement)("a",{href:t.value,onClick:t=>{a(!1),e(t)}},t.label)))))},an=e=>Object(me.useViewportMatch)("medium","<")?Object(c.createElement)(rn,e):Object(c.createElement)(nn,e),on=({primary:e,secondary:t})=>Object(c.createElement)("div",{className:"pattern-navigation-layout"},e&&Object(c.createElement)("div",{className:"pattern-navigation-layout__primary"},e),t&&Object(c.createElement)("div",{className:"pattern-navigation-layout__secondary"},t)),cn=({basePath:e="",...t})=>{const{path:n,update:r}=S(),{categorySlug:a,isLoading:o,options:l}=Object(s.useSelect)(t=>{var r;const{getCategoryById:a,getCategories:o,getQueryFromUrl:c,getUrlFromQuery:i,
 isLoadingCategories:s}=t(be),l=c(n);delete l.page;const u=(o()||[]).map(t=>({value:i({...l,"pattern-categories":t.id},wporgPatternsUrl.site+e),slug:t.slug,label:t.name}));return{categorySlug:(null===(r=a(l["pattern-categories"]))||void 0===r?void 0:r.slug)||"",isLoading:s(),options:u}});return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(on,{primary:Object(c.createElement)(an,{current:a,options:l||[],onClick:e=>{e.preventDefault(),r(e.target.pathname)},isLoading:o}),secondary:Object(c.createElement)(en,{options:[{label:Object(i.__)("Newest","wporg-patterns"),value:"date"},{label:Object(i.__)("Favorites","wporg-patterns"),value:"favorite_count"}]})}),Object(c.createElement)(Zt,t))},sn=()=>{const{setCurrentQuery:e}=Object(s.useDispatch)(be),{path:t}=S(),n=Object(s.useSelect)(e=>e(be).getQueryFromUrl(t),[t]);return Jt(()=>{e(n)},[n]),null};const ln=e=>{const t=
 document.getElementById("breadcrumb-part");t&&(t.innerText=e)};var un=()=>{const{path:e}=S(),{authorName:t,categoryName:n}=Object(s.useSelect)(t=>{const n=t(be).getQueryFromUrl(e),r=t(be).getCategoryById(n["pattern-categories"]);return{authorName:wporgPatternsData.currentAuthorName||(null==n?void 0:n.author_name),categoryName:null==r?void 0:r.name}},[]);return Object(c.useEffect)(()=>{t?
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+Object(i._n)("%1$d pattern by <b>%2$s</b>.","%1$d patterns by <b>%2$s</b>.",n,"wporg-patterns"),n,t),{b:Object(c.createElement)("b",null)}):Object(i.__)("Loading patterns","wporg-patterns"))({category:null==l?void 0:l.name,author:o},u)),null!=d&&d.include&&!l&&r(""))},[d,p]);const b=Et()({"context-bar__spinner":!0,"context-bar__spinner--is-hidden":!p});return n?Object(c.createElement)("header",{className:"context-bar"},Object(c.createElement)("h2",{className:"context-bar__copy"},Object(c.createElement)("span",{className:b},Object(c.createElement)(me.Spinner,null)),Object(c.createElement)("span",null,n)),a.links&&a.links.length>0&&Object(c.createElement)("div",{class
 Name:"context-bar__links"},Object(c.createElement)("h3",{className:"context-bar__title"},a.title),Object(c.createElement)("ul",null,a.links.map(e=>Object(c.createElement)("li",{key:e.href},Object(c.createElement)("a",{href:e.href},e.label)))))):null},en=({options:e})=>{const{path:t,replace:n}=S(),r=Object(fe.useViewportMatch)("medium",">=");return e?Object(c.createElement)("div",{className:"pattern-order-select"},Object(c.createElement)(me.SelectControl,{label:Object(i.__)("Order by","wporg-patterns"),labelPosition:"side",hideLabelFromVision:r,value:Object(O.getQueryArg)(window.location.href,"orderby"),options:e,onChange:e=>{n(Object(O.addQueryArgs)(t,{orderby:e}).replace(/\/page\/[\d]+/,""))}})):null},tn=()=>Object(c.createElement)(u,{className:"pattern-menu",style:{flexDirection:"row"}},Array(7).fil
 l().map((e,t)=>Object(c.createElement)(p,{key:t,height:"1.25rem",width:"5rem",marginRight:"1rem"}))),nn=({current:e,isLoading:t,label:n=Object(i.__)("Main Menu","wporg-patterns"),onClick:r,options:a})=>t?Object(c.createElement)(tn,null):a.length?Object(c.createElement)("nav",null,Object(c.createElement)("h2",{className:"screen-reader-text"},n),Object(c.createElement)("ul",{className:"pattern-menu"},a.map(t=>Object(c.createElement)("li",{key:t.value},Object(c.createElement)("a",{className:Et()({"pattern-menu__item":!0,"is-active":e===t.slug}),href:t.value,onClick:r,"aria-current":e===t.slug?"page":void 0},t.label))))):null,rn=({onClick:e,options:t,label:n=Object(i.__)("Browse categories","wporg-patterns")})=>{const[r,a]=Object(c.useState)(!1);return Object(c.createElement)(me.PanelBody,{classNam
 e:"pattern-menu is-mobile",title:n,initialOpen:r,opened:r,onToggle:()=>a(!r)},Object(c.createElement)("ul",null,t.map(t=>Object(c.createElement)("li",{key:t.value},Object(c.createElement)("a",{href:t.value,onClick:t=>{a(!1),e(t)}},t.label)))))},an=e=>Object(fe.useViewportMatch)("medium","<")?Object(c.createElement)(rn,e):Object(c.createElement)(nn,e),on=({primary:e,secondary:t})=>Object(c.createElement)("div",{className:"pattern-navigation-layout"},e&&Object(c.createElement)("div",{className:"pattern-navigation-layout__primary"},e),t&&Object(c.createElement)("div",{className:"pattern-navigation-layout__secondary"},t)),cn=({basePath:e="",...t})=>{const{path:n,update:r}=S(),{categorySlug:a,isLoading:o,options:l}=Object(s.useSelect)(t=>{var r;const{getCategoryById:a,getCategories:o,getQueryFromUrl:c,getUrlFromQuery:i,i
 sLoadingCategories:s}=t(be),l=c(n);delete l.page;const u=(o()||[]).map(t=>({value:i({...l,"pattern-categories":t.id},wporgPatternsUrl.site+e),slug:t.slug,label:t.name}));return{categorySlug:(null===(r=a(l["pattern-categories"]))||void 0===r?void 0:r.slug)||"",isLoading:s(),options:u}});return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(on,{primary:Object(c.createElement)(an,{current:a,options:l||[],onClick:e=>{e.preventDefault(),r(e.target.pathname)},isLoading:o}),secondary:Object(c.createElement)(en,{options:[{label:Object(i.__)("Newest","wporg-patterns"),value:"date"},{label:Object(i.__)("Favorites","wporg-patterns"),value:"favorite_count"}]})}),Object(c.createElement)(Zt,t))},sn=()=>{const{setCurrentQuery:e}=Object(s.useDispatch)(be),{path:t}=S(),n=Object(s.useSelect)(e=>e(be).getQueryFromUrl(t),[t]);return Jt(()=>{e(n)},[n]),null};const ln=e=>{const t=d
 ocument.getElementById("breadcrumb-part");t&&(t.innerText=e)};var un=()=>{const{path:e}=S(),{authorName:t,categoryName:n}=Object(s.useSelect)(t=>{const n=t(be).getQueryFromUrl(e),r=t(be).getCategoryById(n["pattern-categories"]);return{authorName:wporgPatternsData.currentAuthorName||(null==n?void 0:n.author_name),categoryName:null==r?void 0:r.name}},[]);return Object(c.useEffect)(()=>{t?
</ins><span class="cx" style="display: block; padding: 0 10px"> // translators: %s is the author name.
</span><span class="cx" style="display: block; padding: 0 10px"> ln(Object(i.sprintf)(Object(i.__)("Author: %s","wporg-patterns"),t)):n&&
</span><span class="cx" style="display: block; padding: 0 10px"> // translators: %s is the category name.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-ln(Object(i.sprintf)(Object(i.__)("Category: %s","wporg-patterns"),n))},[e]),null},pn=function({isLoggedIn:e}){const t=Object(O.addQueryArgs)(wporgPatternsUrl.login,{redirect_to:window.location}),n=Object(O.addQueryArgs)(wporgPatternsUrl.register,{redirect_to:window.location});return e?Object(c.createElement)("div",{className:"pattern-grid__empty-header pattern-favorites__empty-header"},Object(c.createElement)("h2",null,Object(i.__)("Collect and view your favorite patterns.","wporg-patterns")),Object(c.createElement)("p",null,Object(i.__)("Tap the heart on any pattern to make it as a favorite. All your favorite patterns will appear here.","wporg-patterns"))):Object(c.createElement)("div",{className:"pattern-grid__empty-header pattern-favorites__empty-header"},Object(c.c
 reateElement)("h2",null,Object(i.__)("Collect and view your favorite patterns.","wporg-patterns")),Object(c.createElement)("p",null,Object(i.__)("Log in to your WordPress.org account and you’ll be able to see all your favorite patterns in one place.","wporg-patterns")),Object(c.createElement)("p",null,Object(c.createElement)("a",{className:"button button-primary button-large",href:t},Object(i.__)("Log in","wporg-patterns"))),Object(c.createElement)("p",null,Object(c.createElement)("a",{className:"button-link link-create-account",href:n},Object(i.__)("Create an account","wporg-patterns"))))},dn=function(){const{path:e,update:t}=S();let n=j(e,"my-patterns");"page"===n&&(n="all");const r=[{value:wporgPatternsUrl.site+"/my-patterns/",slug:"all",label:Object(i.__)("A
 ll","wporg-patterns")},{value:wporgPatternsUrl.site+"/my-patterns/draft/",slug:"draft",label:Object(i.__)("Drafts","wporg-patterns")},{value:wporgPatternsUrl.site+"/my-patterns/pending/",slug:"pending",label:Object(i.__)("Pending Review","wporg-patterns")}];return Object(c.createElement)(an,{label:Object(i.__)("Menu","wporg-patterns"),current:n||"all",options:r,onClick:e=>{e.preventDefault(),t(e.target.pathname)},isLoading:!1})};const bn=document.getElementById("patterns__container");bn&&Object(c.render)(Object(c.createElement)(()=>{const{isEmpty:e,query:t}=Object(s.useSelect)(e=>{const{getCurrentQuery:t,getPatternsByQuery:n,isLoadingPatternsByQuery:r}=e(be),a=t(),o=a&&r(a),c=a?n(a):[];return{isEmpty:!o&&!c.length,query:a}});return Object(c.createElement)(E,null,Object(c.createElement)(Ht,null),Object(c.createElement)
 (sn,null),Object(c.createElement)(un,null),Object(c.createElement)(cn,null),e?Object(c.createElement)(c.Fragment,null,Object(c.createElement)(zt,null),Object(c.createElement)(ge,{query:{per_page:6},showPagination:!1},e=>Object(c.createElement)(Mt,{key:e.id,pattern:e,showAvatar:!0}))):Object(c.createElement)(ge,{query:t},e=>Object(c.createElement)(Mt,{key:e.id,pattern:e,showAvatar:!0})))},null),bn);const gn=document.getElementById("my-patterns__container");gn&&Object(c.render)(Object(c.createElement)(()=>{const e=wporgPatternsData.userId,{isEmpty:t,query:n}=Object(s.useSelect)(t=>{const{getCurrentQuery:n,getPatternsByQuery:r,isLoadingPatternsByQuery:a}=t(be),o={status:"any",...n()||{},author:e},c=e&&a(o),i=e?r(o):[];return{isEmpty:!c&&!i.length,query:o}});if(!e){const e=Object(O.addQueryArgs)(wporgPatternsUrl.login,{redirect_to:window.location});return Object(c.createElement)("div",{className:"entry-content"}
 ,Object(c.createElement)("p",null,Object(i.__)("Please log in to view your patterns.","wporg-patterns")),Object(c.createElement)("a",{className:"button button-primary",href:e},Object(i.__)("Log in","wporg-patterns")))}return Object(c.createElement)(E,null,Object(c.createElement)(sn,null),Object(c.createElement)(on,{primary:Object(c.createElement)(dn,null),secondary:Object(c.createElement)(en,{options:[{label:Object(i.__)("Newest","wporg-patterns"),value:"date"},{label:Object(i.__)("Favorites","wporg-patterns"),value:"favorite_count"}]})}),t?Object(c.createElement)("div",{className:"pattern-grid__empty-header"},Object(c.createElement)("h2",null,Object(i.__)("Nothing found","wporg-patterns")),Object(c.createElement)("p",null,Object(i.__)("You haven’t created any patterns yet.","wpo
 rg-patterns"))):Object(c.createElement)(ge,{query:n},e=>Object(c.createElement)(Mt,{key:e.id,pattern:e})))},null),gn);const mn=document.getElementById("pattern-favorites__container");mn&&Object(c.render)(Object(c.createElement)(()=>{const{isEmpty:e,query:t}=Object(s.useSelect)(e=>{const{getCurrentQuery:t,getFavorites:n,getPatternsByQuery:r,isLoadingPatternsByQuery:a}=e(be),o=t()||{},c=n();if(null===c)return{query:!1,isEmpty:!1};const i={...o,include:c},s=!!c.length&&a(i),l=c.length?r(i):[];return{query:i,isEmpty:!s&&!l.length}}),n={orderby:"favorite_count",per_page:6};t["pattern-categories"]&&(n["pattern-categories"]=t["pattern-categories"]);const r=!!wporgPatternsData.userId;return Object(c.createElement)(E,null,Object(c.createElement)(sn,null),r&&Object(c.createElement)(cn,{basePath:"/favorites/",query:t}),!r||e?Object(c.createElement)(c.Fragment,null,Object(c.createEl
 ement)(pn,{isLoggedIn:r}),Object(c.createElement)(ge,{header:Object(c.createElement)("h2",{className:"pattern-favorites__grid-title"},Object(i.__)("Here’s a few of our favorite patterns","wporg-patterns")),query:n,showPagination:!1},e=>Object(c.createElement)(Mt,{key:e.id,pattern:e,showAvatar:!0}))):Object(c.createElement)(ge,{query:t},e=>Object(c.createElement)(Mt,{key:e.id,pattern:e,showAvatar:!0})))},null),mn);const fn=document.querySelectorAll(".pattern__container");for(let e=0;e<fn.length;e++){const t=fn[e],n=t.dataset;Object(c.render)(Object(c.createElement)(Gt,n),t,()=>{t.hidden=!1,document.querySelectorAll(".hide-if-pattern-loaded").forEach(e=>e.hidden=!0)})}const hn=document.getElementById("patterns-search__container");hn&&Object(c.render)(Object(c.createElement)(()=>{const{isEmpty:e,query:t}=Object(s.useSelect)(e=>{const{getCurrentQuery:t,getPatternsByQuery:n,isLoadingPatte
 rnsByQuery:r}=e(be),a=t(),o=a&&r(a),c=a?n(a):[];return{isEmpty:!o&&!c.length,query:a}});return Object(c.createElement)(E,null,Object(c.createElement)(sn,null),Object(c.createElement)(Zt,{query:t}),e?Object(c.createElement)(c.Fragment,null,Object(c.createElement)(zt,null),Object(c.createElement)(ge,{query:{per_page:6},showPagination:!1},e=>Object(c.createElement)(Mt,{key:e.id,pattern:e,showAvatar:!0}))):Object(c.createElement)(ge,{query:t},e=>Object(c.createElement)(Mt,{key:e.id,pattern:e,showAvatar:!0})))},hn.dataset),hn)}]);
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ln(Object(i.sprintf)(Object(i.__)("Category: %s","wporg-patterns"),n))},[e]),null},pn=function({isLoggedIn:e}){const t=Object(O.addQueryArgs)(wporgPatternsUrl.login,{redirect_to:window.location}),n=Object(O.addQueryArgs)(wporgPatternsUrl.register,{redirect_to:window.location});return e?Object(c.createElement)("div",{className:"pattern-grid__empty-header pattern-favorites__empty-header"},Object(c.createElement)("h2",null,Object(i.__)("Collect and view your favorite patterns.","wporg-patterns")),Object(c.createElement)("p",null,Object(i.__)("Tap the heart on any pattern to make it as a favorite. All your favorite patterns will appear here.","wporg-patterns"))):Object(c.createElement)("div",{className:"pattern-grid__empty-header pattern-favorites__empty-header"},Object(c.c
 reateElement)("h2",null,Object(i.__)("Collect and view your favorite patterns.","wporg-patterns")),Object(c.createElement)("p",null,Object(i.__)("Log in to your WordPress.org account and you’ll be able to see all your favorite patterns in one place.","wporg-patterns")),Object(c.createElement)("p",null,Object(c.createElement)("a",{className:"button button-primary button-large",href:t},Object(i.__)("Log in","wporg-patterns"))),Object(c.createElement)("p",null,Object(c.createElement)("a",{className:"button-link link-create-account",href:n},Object(i.__)("Create an account","wporg-patterns"))))},dn=function(){const{path:e,update:t}=S();let n=j(e,"my-patterns");"page"===n&&(n="all");const r=[{value:wporgPatternsUrl.site+"/my-patterns/",slug:"all",label:Object(i.__)("A
 ll","wporg-patterns")},{value:wporgPatternsUrl.site+"/my-patterns/draft/",slug:"draft",label:Object(i.__)("Drafts","wporg-patterns")},{value:wporgPatternsUrl.site+"/my-patterns/pending/",slug:"pending",label:Object(i.__)("Pending Review","wporg-patterns")}];return Object(c.createElement)(an,{label:Object(i.__)("Menu","wporg-patterns"),current:n||"all",options:r,onClick:e=>{e.preventDefault(),t(e.target.pathname)},isLoading:!1})};const bn=document.getElementById("patterns__container");bn&&Object(c.render)(Object(c.createElement)(()=>{const{isEmpty:e,query:t}=Object(s.useSelect)(e=>{const{getCurrentQuery:t,getPatternsByQuery:n,isLoadingPatternsByQuery:r}=e(be),a=t(),o=a&&r(a),c=a?n(a):[];return{isEmpty:!o&&!c.length,query:a}});return Object(c.createElement)(E,null,Object(c.createElement)(Ht,null),Object(c.createElement)
 (sn,null),Object(c.createElement)(un,null),Object(c.createElement)(cn,null),e?Object(c.createElement)(c.Fragment,null,Object(c.createElement)(zt,null),Object(c.createElement)(ge,{query:{per_page:6},showPagination:!1},e=>Object(c.createElement)(Mt,{key:e.id,pattern:e,showAvatar:!0}))):Object(c.createElement)(ge,{query:t},e=>Object(c.createElement)(Mt,{key:e.id,pattern:e,showAvatar:!0})))},null),bn);const gn=document.getElementById("my-patterns__container");gn&&Object(c.render)(Object(c.createElement)(()=>{const e=wporgPatternsData.userId,{isEmpty:t,query:n}=Object(s.useSelect)(t=>{const{getCurrentQuery:n,getPatternsByQuery:r,isLoadingPatternsByQuery:a}=t(be),o={status:"any",...n()||{},author:e},c=e&&a(o),i=e?r(o):[];return{isEmpty:!c&&!i.length,query:o}});if(!e){const e=Object(O.addQueryArgs)(wporgPatternsUrl.login,{redirect_to:window.location});return Object(c.createElement)("div",{className:"entry-content"}
 ,Object(c.createElement)("p",null,Object(i.__)("Please log in to view your patterns.","wporg-patterns")),Object(c.createElement)("a",{className:"button button-primary",href:e},Object(i.__)("Log in","wporg-patterns")))}return Object(c.createElement)(E,null,Object(c.createElement)(sn,null),Object(c.createElement)(on,{primary:Object(c.createElement)(dn,null),secondary:Object(c.createElement)(en,{options:[{label:Object(i.__)("Newest","wporg-patterns"),value:"date"},{label:Object(i.__)("Favorites","wporg-patterns"),value:"favorite_count"}]})}),t?Object(c.createElement)("div",{className:"pattern-grid__empty-header"},Object(c.createElement)("h2",null,Object(i.__)("Nothing found","wporg-patterns")),Object(c.createElement)("p",null,Object(i.__)("You haven’t created any patterns yet.","wpo
 rg-patterns"))):Object(c.createElement)(ge,{query:n},e=>Object(c.createElement)(Mt,{key:e.id,pattern:e})))},null),gn);const fn=document.getElementById("pattern-favorites__container");fn&&Object(c.render)(Object(c.createElement)(()=>{const{isEmpty:e,query:t}=Object(s.useSelect)(e=>{const{getCurrentQuery:t,getFavorites:n,getPatternsByQuery:r,isLoadingPatternsByQuery:a}=e(be),o=t()||{},c=n();if(null===c)return{query:!1,isEmpty:!1};const i={...o,include:c},s=!!c.length&&a(i),l=c.length?r(i):[];return{query:i,isEmpty:!s&&!l.length}}),n={orderby:"favorite_count",per_page:6};t["pattern-categories"]&&(n["pattern-categories"]=t["pattern-categories"]);const r=!!wporgPatternsData.userId;return Object(c.createElement)(E,null,Object(c.createElement)(sn,null),r&&Object(c.createElement)(cn,{basePath:"/favorites/",query:t}),!r||e?Object(c.createElement)(c.Fragment,null,Object(c.createEl
 ement)(pn,{isLoggedIn:r}),Object(c.createElement)(ge,{header:Object(c.createElement)("h2",{className:"pattern-favorites__grid-title"},Object(i.__)("Here’s a few of our favorite patterns","wporg-patterns")),query:n,showPagination:!1},e=>Object(c.createElement)(Mt,{key:e.id,pattern:e,showAvatar:!0}))):Object(c.createElement)(ge,{query:t},e=>Object(c.createElement)(Mt,{key:e.id,pattern:e,showAvatar:!0})))},null),fn);const mn=document.querySelectorAll(".pattern__container");for(let e=0;e<mn.length;e++){const t=mn[e],n=t.dataset;Object(c.render)(Object(c.createElement)(Gt,n),t,()=>{t.hidden=!1,document.querySelectorAll(".hide-if-pattern-loaded").forEach(e=>e.hidden=!0)})}const hn=document.getElementById("patterns-search__container");hn&&Object(c.render)(Object(c.createElement)(()=>{const{isEmpty:e,query:t}=Object(s.useSelect)(e=>{const{getCurrentQuery:t,getPatternsByQuery:n,isLoadingPatte
 rnsByQuery:r}=e(be),a=t(),o=a&&r(a),c=a?n(a):[];return{isEmpty:!o&&!c.length,query:a}});return Object(c.createElement)(E,null,Object(c.createElement)(sn,null),Object(c.createElement)(Zt,{query:t}),e?Object(c.createElement)(c.Fragment,null,Object(c.createElement)(zt,null),Object(c.createElement)(ge,{query:{per_page:6},showPagination:!1},e=>Object(c.createElement)(Mt,{key:e.id,pattern:e,showAvatar:!0}))):Object(c.createElement)(ge,{query:t},e=>Object(c.createElement)(Mt,{key:e.id,pattern:e,showAvatar:!0})))},hn.dataset),hn)}]);
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgpatternssrccomponentspatternthumbnailcanvasjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/src/components/pattern-thumbnail/canvas.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/src/components/pattern-thumbnail/canvas.js     2021-08-20 15:35:29 UTC (rev 11189)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/src/components/pattern-thumbnail/canvas.js       2021-08-20 20:18:24 UTC (rev 11190)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -9,15 +9,24 @@
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> import Iframe from '../iframe';
</span><span class="cx" style="display: block; padding: 0 10px"> import getCardFrameHeight from '../../utils/get-card-frame-height';
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+import useInView from '../../hooks/in-view';
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> const VIEWPORT_WIDTH = 800;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> function PatternThumbnail( { className, html } ) {
</span><span class="cx" style="display: block; padding: 0 10px">        const wrapperRef = useRef();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        const [ frameHeight, setFrameHeight ] = useState( '100%' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ const [ frameHeight, setFrameHeight ] = useState( '1px' );
</ins><span class="cx" style="display: block; padding: 0 10px">         const [ frameScale, setFrameScale ] = useState( 0.3125 );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        const isVisible = useInView( { element: wrapperRef } );
+       const [ shouldLoad, setShouldLoad ] = useState( false );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        useEffect( () => {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                if ( isVisible ) {
+                       setShouldLoad( true );
+               }
+       }, [ isVisible ] );
+
+       useEffect( () => {
</ins><span class="cx" style="display: block; padding: 0 10px">                 const handleOnResize = () => {
</span><span class="cx" style="display: block; padding: 0 10px">                        try {
</span><span class="cx" style="display: block; padding: 0 10px">                                setFrameHeight( getCardFrameHeight( wrapperRef.current.clientWidth ) );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -62,7 +71,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        >
</span><span class="cx" style="display: block; padding: 0 10px">                                <div
</span><span class="cx" style="display: block; padding: 0 10px">                                        dangerouslySetInnerHTML={ {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                __html: html,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                         __html: shouldLoad ? html : '',
</ins><span class="cx" style="display: block; padding: 0 10px">                                         } }
</span><span class="cx" style="display: block; padding: 0 10px">                                />
</span><span class="cx" style="display: block; padding: 0 10px">                        </Iframe>
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgpatternssrchooksinviewjs"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/src/hooks/in-view.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/src/hooks/in-view.js                           (rev 0)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/src/hooks/in-view.js     2021-08-20 20:18:24 UTC (rev 11190)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,52 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/**
+ * External dependencies
+ */
+import { debounce } from 'lodash';
+
+/**
+ * WordPress dependencies
+ */
+import { useEffect, useState } from '@wordpress/element';
+
+const useInView = ( { element } ) => {
+       const [ visible, setVisible ] = useState( null );
+
+       useEffect( () => {
+               if ( ! element.current ) {
+                       return;
+               }
+
+               const debouncedIsVisible = debounce( isVisible, 200 );
+
+               // Initialize `isVisible`.
+               isVisible();
+
+               /* eslint-disable @wordpress/no-global-event-listener -- These are global events. */
+               window.addEventListener( 'scroll', debouncedIsVisible );
+               window.addEventListener( 'resize', debouncedIsVisible );
+
+               return () => {
+                       window.removeEventListener( 'scroll', debouncedIsVisible );
+                       window.addEventListener( 'resize', debouncedIsVisible );
+               };
+               /* eslint-enable @wordpress/no-global-event-listener */
+       }, [ element ] );
+
+       const isVisible = () => {
+               if ( ! element.current ) {
+                       return;
+               }
+               const windowHeight = window.innerHeight;
+               const { top } = element.current.getBoundingClientRect();
+
+               if ( top >= 0 && top <= windowHeight ) {
+                       setVisible( true );
+               } else {
+                       setVisible( false );
+               }
+       };
+
+       return visible;
+};
+
+export default useInView;
</ins></span></pre>
</div>
</div>

</body>
</html>