Version Description
- Template library improvement
Download this release
Release Info
Developer | munirkamal |
Plugin | Gutenberg Blocks – ACF Blocks Suite |
Version | 2.6.2 |
Comparing to | |
See all releases |
Code changes from version 2.6.1 to 2.6.2
- acf-blocks.php +1 -1
- extendify-sdk/public/build/extendify-sdk.css +1 -1
- extendify-sdk/public/build/extendify-sdk.js +1 -1
- extendify-sdk/readme.txt +1 -1
- extendify-sdk/src/gutenberg/api/index.js +5 -10
- extendify-sdk/src/gutenberg/base/templates-library/index.js +1 -1
- extendify-sdk/src/gutenberg/buttons.js +84 -0
- extendify-sdk/src/gutenberg/components/library-auth/api-form.js +5 -5
- extendify-sdk/src/gutenberg/components/library-auth/index.js +1 -1
- extendify-sdk/src/gutenberg/components/library-imports-counter/index.js +1 -1
- extendify-sdk/src/gutenberg/components/library-load-more/index.js +1 -1
- extendify-sdk/src/gutenberg/components/library-modal/index.js +1 -1
- extendify-sdk/src/gutenberg/components/library-sidebar/index.js +1 -1
- extendify-sdk/src/gutenberg/components/library-template-preview/index.js +1 -1
- extendify-sdk/src/gutenberg/{global/index.js → config.js} +0 -0
- extendify-sdk/src/gutenberg/listeners/index.js +2 -0
- extendify-sdk/src/gutenberg/listeners/open-library.js +11 -0
- extendify-sdk/src/gutenberg/middleware/hasPluginsActivated/ActivatePluginsModal.js +1 -1
- extendify-sdk/src/gutenberg/middleware/hasPluginsActivated/ActivatingModal.js +1 -1
- extendify-sdk/src/gutenberg/middleware/hasRequiredPlugins/InstallingModal.js +1 -1
- extendify-sdk/src/gutenberg/middleware/hasRequiredPlugins/RequiredPluginsModal.js +1 -1
- extendify-sdk/src/gutenberg/middleware/needsPageReload/ReloadRequiredModal.js +4 -4
- extendify-sdk/src/gutenberg/plugins/header-btn/index.js +0 -39
- extendify-sdk/src/gutenberg/plugins/index.js +0 -2
- extendify-sdk/src/gutenberg/plugins/more-menu-btn/index.js +0 -64
- extendify-sdk/src/gutenberg/plugins/more-menu-btn/style.scss +0 -5
- extendify-sdk/src/gutenberg/store/actions/index.js +7 -0
- extendify-sdk/src/gutenberg/store/reducer/index.js +9 -51
- extendify-sdk/src/gutenberg/store/selectors/index.js +3 -76
- extendify-sdk/src/index.js +3 -24
- extendify-sdk/src/style.scss +0 -8
- readme.txt +4 -1
acf-blocks.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin Name: ACF Blocks Suite
|
5 |
* Plugin URI: https://acfblocks.com/
|
6 |
* Description: Supercharge your Gutenberg editor with high quality beautiful WordPress blocks. Ready-to-use ACF Blocks!
|
7 |
-
* Version: 2.6.
|
8 |
* Author: munirkamal
|
9 |
* Author URI: https://munirkamal.wordpress.com
|
10 |
* License: GPL2
|
4 |
* Plugin Name: ACF Blocks Suite
|
5 |
* Plugin URI: https://acfblocks.com/
|
6 |
* Description: Supercharge your Gutenberg editor with high quality beautiful WordPress blocks. Ready-to-use ACF Blocks!
|
7 |
+
* Version: 2.6.2
|
8 |
* Author: munirkamal
|
9 |
* Author URI: https://munirkamal.wordpress.com
|
10 |
* License: GPL2
|
extendify-sdk/public/build/extendify-sdk.css
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
.etfy-templates-library-modal-root{height:100%}.etfy-templates-library-modal-root .etfy-back-button{cursor:pointer;text-decoration:none;color:#000;display:none;margin-right:16px}@media (max-width: 782px){.etfy-templates-library-modal-root .etfy-back-button{display:block}}.etfy-templates-library-modal-root .components-modal__content{max-width:100%;width:1500px}.etfy-templates-library-modal-root .components-modal__content .etfy-templates-library-modal{display:flex;flex-direction:row;margin-top:32px}.etfy-templates-library-modal-root .components-modal__content .etfy-templates-library-modal>div:not(:first-child){margin-left:48px}@media (max-width: 600px){.etfy-templates-library-modal-root .components-modal__content .etfy-templates-library-modal{flex-direction:column}.etfy-templates-library-modal-root .components-modal__content .etfy-templates-library-modal>div:not(:first-child){margin-left:0}}.etfy-screen-single-template .etfy-back-button{display:block}@media (max-width: 782px){.etfy-screen-menu .etfy-back-button{display:none}}@media (max-width: 782px){.etfy-screen-menu .etfy-templates-library-content-root{display:none}}@media (max-width: 782px){.etfy-screen-templates .etfy-templates-library-sidebar,.etfy-screen-single-template .etfy-templates-library-sidebar{display:none}}.etfy-templates-library-content-root{width:70%;height:100%;display:block;margin-bottom:32px}@media (max-width: 782px){.etfy-templates-library-content-root{width:100%}}.etfy-templates-library-content-root .etfy-templates-description--small{display:none}.etfy-templates-library-content-root .etfy-templates-description--small h3 span{margin:0 8px}@media (max-width: 782px){.etfy-templates-library-content-root .etfy-templates-description--small{display:block}}.etfy-templates-library-content-root .etfy-templates-library-content.etfy-templates-library-grid{display:grid;grid-template-columns:repeat(2, 1fr);grid-column-gap:24px;-moz-column-gap:24px;column-gap:24px;grid-row-gap:40px;row-gap:40px}@media (max-width: 782px){.etfy-templates-library-content-root .etfy-templates-library-content.etfy-templates-library-grid{grid-template-columns:1fr;grid-column-gap:16px;-moz-column-gap:16px;column-gap:16px}}.etfy-templates-library-content-root.etfy-templates-loading{position:relative;padding:calc(48px * 2) 0px;height:50vh;min-height:50vh}.etfy-templates-library-content-root.etfy-templates-loading .etfy-loading{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}.etfy-template-main:focus{box-shadow:0 0 0 1.5px var(--wp-admin-theme-color)}.etfy-template-main .etfy-template{cursor:pointer}.etfy-template-main .etfy-template .etfy-template-header{display:flex;flex-direction:row;justify-content:space-between}.etfy-template-main .etfy-template .etfy-template-media{background-size:cover;min-height:315px}.etfy-template-main .etfy-template.etfy-type-pattern .etfy-template-media{background-repeat:no-repeat;background-position-y:50%;background-size:contain}.etfy-templates-library-sidebar{width:30%;height:75vh;top:90px;overflow-y:auto;overflow-x:hidden;position:sticky;padding:0px 16px 0px 1px}@media (max-width: 782px){.etfy-templates-library-sidebar{height:100%;padding-right:0px}}.etfy-templates-library-sidebar .etfy-templates-library-sidebar__wrapper{position:sticky}@media (max-width: 782px){.etfy-templates-library-sidebar{width:100%}}.etfy-templates-library-sidebar .etfy-templates-library-top__area{position:sticky;top:0px;background-color:#fff}.etfy-templates-library-sidebar .etfy-divider{margin:24px 0}.etfy-templates-library-sidebar .block-editor-inserter__search{padding:0px;padding-top:4px}.etfy-templates-library-sidebar .block-editor-inserter__search svg{height:100%}.etfy-templates-library-sidebar .block-editor-inserter__search .block-editor-inserter__search-icon{right:10px !important}.etfy-templates-library-sidebar-menu .etfy-selected-category{background-color:#f0f0f0}.etfy-templates-library-sidebar-menu .etfy-selected-category .etfy-menu-item:hover{box-shadow:0 0 0 1.5px var(--wp-admin-theme-color) inset}.etfy-template-preview{display:flex;flex-direction:row}.etfy-template-preview>div:not(:first-child){margin:0px 0px 0px 32px}@media (max-width: 600px){.etfy-template-preview{flex-direction:column-reverse}.etfy-template-preview>div:not(:first-child){margin:0px 0px 32px 0px}}.etfy-template-preview .etfy-template-media{width:60%}.etfy-template-preview .etfy-template-media img{width:100%;height:100%}@media (max-width: 600px){.etfy-template-preview .etfy-template-media{width:100%}}.etfy-template-preview .etfy-template-details{width:40%;top:80px;position:sticky;height:100%}@media (max-width: 600px){.etfy-template-preview .etfy-template-details{width:100%;display:flex;flex-direction:row-reverse;justify-content:space-between;align-items:center;position:relative;top:0px}}.etfy-template-preview .etfy-template-details .etfy-template-title{margin:32px 0px}@media (max-width: 600px){.etfy-template-preview .etfy-template-details .etfy-template-title{margin:16px 0px}}.etfy-template-preview .etfy-template-details .etfy-template-category{margin-right:4px}.etfy-template-preview .etfy-template-details .etfy-upgrade-btn{background-color:#e0e0e0;border:1px solid #ddd}.etfy-template-preview hr{margin:16px 0}.etfy-load-more{text-align:center;margin-top:16px}.etfy-not-results-found__root h2{line-height:1.4}.etfy-auth-api-form{margin-bottom:32px}.etfy-auth-api-form .etfy-auth-field{margin-bottom:16px}.etfy-library-auth__header{display:inline-block;margin-bottom:24px}.etfy-library-auth__header .etfy-upgrade__btn{margin-right:8px}.etfy-library-auth__header .etfy-upgrade__btn{background-color:#4ab866;color:#fff;outline:#fff}.etfy-library-auth__header .etfy-upgrade__btn:focus{color:#fff;box-shadow:none !important}.etfy-library-auth__header .etfy-add-key__btn{background-color:#e0e0e0;border:1px solid #ddd}
|
2 |
|
1 |
+
.etfy-templates-library-modal-root{height:100%}.etfy-templates-library-modal-root .etfy-back-button{cursor:pointer;text-decoration:none;color:#000;display:none;margin-right:16px}@media (max-width: 782px){.etfy-templates-library-modal-root .etfy-back-button{display:block}}.etfy-templates-library-modal-root .components-modal__content{max-width:100%;width:1500px}.etfy-templates-library-modal-root .components-modal__content .etfy-templates-library-modal{display:flex;flex-direction:row;margin-top:32px}.etfy-templates-library-modal-root .components-modal__content .etfy-templates-library-modal>div:not(:first-child){margin-left:48px}@media (max-width: 600px){.etfy-templates-library-modal-root .components-modal__content .etfy-templates-library-modal{flex-direction:column}.etfy-templates-library-modal-root .components-modal__content .etfy-templates-library-modal>div:not(:first-child){margin-left:0}}.etfy-screen-single-template .etfy-back-button{display:block}@media (max-width: 782px){.etfy-screen-menu .etfy-back-button{display:none}}@media (max-width: 782px){.etfy-screen-menu .etfy-templates-library-content-root{display:none}}@media (max-width: 782px){.etfy-screen-templates .etfy-templates-library-sidebar,.etfy-screen-single-template .etfy-templates-library-sidebar{display:none}}.etfy-templates-library-content-root{width:70%;height:100%;display:block;margin-bottom:32px}@media (max-width: 782px){.etfy-templates-library-content-root{width:100%}}.etfy-templates-library-content-root .etfy-templates-description--small{display:none}.etfy-templates-library-content-root .etfy-templates-description--small h3 span{margin:0 8px}@media (max-width: 782px){.etfy-templates-library-content-root .etfy-templates-description--small{display:block}}.etfy-templates-library-content-root .etfy-templates-library-content.etfy-templates-library-grid{display:grid;grid-template-columns:repeat(2, 1fr);grid-column-gap:24px;-moz-column-gap:24px;column-gap:24px;grid-row-gap:40px;row-gap:40px}@media (max-width: 782px){.etfy-templates-library-content-root .etfy-templates-library-content.etfy-templates-library-grid{grid-template-columns:1fr;grid-column-gap:16px;-moz-column-gap:16px;column-gap:16px}}.etfy-templates-library-content-root.etfy-templates-loading{position:relative;padding:calc(48px * 2) 0px;height:50vh;min-height:50vh}.etfy-templates-library-content-root.etfy-templates-loading .etfy-loading{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}.etfy-template-main:focus{box-shadow:0 0 0 1.5px var(--wp-admin-theme-color)}.etfy-template-main .etfy-template{cursor:pointer}.etfy-template-main .etfy-template .etfy-template-header{display:flex;flex-direction:row;justify-content:space-between}.etfy-template-main .etfy-template .etfy-template-media{background-size:cover;min-height:315px}.etfy-template-main .etfy-template.etfy-type-pattern .etfy-template-media{background-repeat:no-repeat;background-position-y:50%;background-size:contain}.etfy-templates-library-sidebar{width:30%;height:75vh;top:90px;overflow-y:auto;overflow-x:hidden;position:sticky;padding:0px 16px 0px 1px}@media (max-width: 782px){.etfy-templates-library-sidebar{height:100%;padding-right:0px}}.etfy-templates-library-sidebar .etfy-templates-library-sidebar__wrapper{position:sticky}@media (max-width: 782px){.etfy-templates-library-sidebar{width:100%}}.etfy-templates-library-sidebar .etfy-templates-library-top__area{position:sticky;top:0px;background-color:#fff}.etfy-templates-library-sidebar .etfy-divider{margin:24px 0}.etfy-templates-library-sidebar .block-editor-inserter__search{padding:0px;padding-top:4px}.etfy-templates-library-sidebar .block-editor-inserter__search svg{height:100%}.etfy-templates-library-sidebar .block-editor-inserter__search .block-editor-inserter__search-icon{right:10px !important}.etfy-templates-library-sidebar-menu .etfy-selected-category{background-color:#f0f0f0}.etfy-templates-library-sidebar-menu .etfy-selected-category .etfy-menu-item:hover{box-shadow:0 0 0 1.5px var(--wp-admin-theme-color) inset}.etfy-template-preview{display:flex;flex-direction:row}.etfy-template-preview>div:not(:first-child){margin:0px 0px 0px 32px}@media (max-width: 600px){.etfy-template-preview{flex-direction:column-reverse}.etfy-template-preview>div:not(:first-child){margin:0px 0px 32px 0px}}.etfy-template-preview .etfy-template-media{width:60%}.etfy-template-preview .etfy-template-media img{width:100%;height:100%}@media (max-width: 600px){.etfy-template-preview .etfy-template-media{width:100%}}.etfy-template-preview .etfy-template-details{width:40%;top:80px;position:sticky;height:100%}@media (max-width: 600px){.etfy-template-preview .etfy-template-details{width:100%;display:flex;flex-direction:row-reverse;justify-content:space-between;align-items:center;position:relative;top:0px}}.etfy-template-preview .etfy-template-details .etfy-template-title{margin:32px 0px}@media (max-width: 600px){.etfy-template-preview .etfy-template-details .etfy-template-title{margin:16px 0px}}.etfy-template-preview .etfy-template-details .etfy-template-category{margin-right:4px}.etfy-template-preview .etfy-template-details .etfy-upgrade-btn{background-color:#e0e0e0;border:1px solid #ddd}.etfy-template-preview hr{margin:16px 0}.etfy-load-more{text-align:center;margin-top:16px}.etfy-not-results-found__root h2{line-height:1.4}.etfy-auth-api-form{margin-bottom:32px}.etfy-auth-api-form .etfy-auth-field{margin-bottom:16px}.etfy-library-auth__header{display:inline-block;margin-bottom:24px}.etfy-library-auth__header .etfy-upgrade__btn{margin-right:8px}.etfy-library-auth__header .etfy-upgrade__btn{background-color:#4ab866;color:#fff;outline:#fff}.etfy-library-auth__header .etfy-upgrade__btn:focus{color:#fff;box-shadow:none !important}.etfy-library-auth__header .etfy-add-key__btn{background-color:#e0e0e0;border:1px solid #ddd}
|
2 |
|
extendify-sdk/public/build/extendify-sdk.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
/*! For license information please see extendify-sdk.js.LICENSE.txt */
|
2 |
-
(()=>{var e={669:(e,t,r)=>{e.exports=r(609)},448:(e,t,r)=>{"use strict";var n=r(867),a=r(26),o=r(372),i=r(327),s=r(97),u=r(109),c=r(985),l=r(61);e.exports=function(e){return new Promise((function(t,r){var p=e.data,f=e.headers;n.isFormData(p)&&delete f["Content-Type"];var m=new XMLHttpRequest;if(e.auth){var d=e.auth.username||"",y=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";f.Authorization="Basic "+btoa(d+":"+y)}var h=s(e.baseURL,e.url);if(m.open(e.method.toUpperCase(),i(h,e.params,e.paramsSerializer),!0),m.timeout=e.timeout,m.onreadystatechange=function(){if(m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))){var n="getAllResponseHeaders"in m?u(m.getAllResponseHeaders()):null,o={data:e.responseType&&"text"!==e.responseType?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:n,config:e,request:m};a(t,r,o),m=null}},m.onabort=function(){m&&(r(l("Request aborted",e,"ECONNABORTED",m)),m=null)},m.onerror=function(){r(l("Network Error",e,null,m)),m=null},m.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(l(t,e,"ECONNABORTED",m)),m=null},n.isStandardBrowserEnv()){var v=(e.withCredentials||c(h))&&e.xsrfCookieName?o.read(e.xsrfCookieName):void 0;v&&(f[e.xsrfHeaderName]=v)}if("setRequestHeader"in m&&n.forEach(f,(function(e,t){void 0===p&&"content-type"===t.toLowerCase()?delete f[t]:m.setRequestHeader(t,e)})),n.isUndefined(e.withCredentials)||(m.withCredentials=!!e.withCredentials),e.responseType)try{m.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&m.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&m.upload&&m.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){m&&(m.abort(),r(e),m=null)})),p||(p=null),m.send(p)}))}},609:(e,t,r)=>{"use strict";var n=r(867),a=r(849),o=r(321),i=r(185);function s(e){var t=new o(e),r=a(o.prototype.request,t);return n.extend(r,o.prototype,t),n.extend(r,t),r}var u=s(r(655));u.Axios=o,u.create=function(e){return s(i(u.defaults,e))},u.Cancel=r(263),u.CancelToken=r(972),u.isCancel=r(502),u.all=function(e){return Promise.all(e)},u.spread=r(713),u.isAxiosError=r(268),e.exports=u,e.exports.default=u},263:e=>{"use strict";function t(e){this.message=e}t.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},t.prototype.__CANCEL__=!0,e.exports=t},972:(e,t,r)=>{"use strict";var n=r(263);function a(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;e((function(e){r.reason||(r.reason=new n(e),t(r.reason))}))}a.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},a.source=function(){var e;return{token:new a((function(t){e=t})),cancel:e}},e.exports=a},502:e=>{"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},321:(e,t,r)=>{"use strict";var n=r(867),a=r(327),o=r(782),i=r(572),s=r(185);function u(e){this.defaults=e,this.interceptors={request:new o,response:new o}}u.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=s(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[i,void 0],r=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)r=r.then(t.shift(),t.shift());return r},u.prototype.getUri=function(e){return e=s(this.defaults,e),a(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},n.forEach(["delete","get","head","options"],(function(e){u.prototype[e]=function(t,r){return this.request(s(r||{},{method:e,url:t,data:(r||{}).data}))}})),n.forEach(["post","put","patch"],(function(e){u.prototype[e]=function(t,r,n){return this.request(s(n||{},{method:e,url:t,data:r}))}})),e.exports=u},782:(e,t,r)=>{"use strict";var n=r(867);function a(){this.handlers=[]}a.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},a.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},a.prototype.forEach=function(e){n.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=a},97:(e,t,r)=>{"use strict";var n=r(793),a=r(303);e.exports=function(e,t){return e&&!n(t)?a(e,t):t}},61:(e,t,r)=>{"use strict";var n=r(481);e.exports=function(e,t,r,a,o){var i=new Error(e);return n(i,t,r,a,o)}},572:(e,t,r)=>{"use strict";var n=r(867),a=r(527),o=r(502),i=r(655);function s(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return s(e),e.headers=e.headers||{},e.data=a(e.data,e.headers,e.transformRequest),e.headers=n.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),n.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||i.adapter)(e).then((function(t){return s(e),t.data=a(t.data,t.headers,e.transformResponse),t}),(function(t){return o(t)||(s(e),t&&t.response&&(t.response.data=a(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},481:e=>{"use strict";e.exports=function(e,t,r,n,a){return e.config=t,r&&(e.code=r),e.request=n,e.response=a,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},185:(e,t,r)=>{"use strict";var n=r(867);e.exports=function(e,t){t=t||{};var r={},a=["url","method","data"],o=["headers","auth","proxy","params"],i=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],s=["validateStatus"];function u(e,t){return n.isPlainObject(e)&&n.isPlainObject(t)?n.merge(e,t):n.isPlainObject(t)?n.merge({},t):n.isArray(t)?t.slice():t}function c(a){n.isUndefined(t[a])?n.isUndefined(e[a])||(r[a]=u(void 0,e[a])):r[a]=u(e[a],t[a])}n.forEach(a,(function(e){n.isUndefined(t[e])||(r[e]=u(void 0,t[e]))})),n.forEach(o,c),n.forEach(i,(function(a){n.isUndefined(t[a])?n.isUndefined(e[a])||(r[a]=u(void 0,e[a])):r[a]=u(void 0,t[a])})),n.forEach(s,(function(n){n in t?r[n]=u(e[n],t[n]):n in e&&(r[n]=u(void 0,e[n]))}));var l=a.concat(o).concat(i).concat(s),p=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===l.indexOf(e)}));return n.forEach(p,c),r}},26:(e,t,r)=>{"use strict";var n=r(61);e.exports=function(e,t,r){var a=r.config.validateStatus;r.status&&a&&!a(r.status)?t(n("Request failed with status code "+r.status,r.config,null,r.request,r)):e(r)}},527:(e,t,r)=>{"use strict";var n=r(867);e.exports=function(e,t,r){return n.forEach(r,(function(r){e=r(e,t)})),e}},655:(e,t,r)=>{"use strict";var n=r(867),a=r(16),o={"Content-Type":"application/x-www-form-urlencoded"};function i(e,t){!n.isUndefined(e)&&n.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var s,u={adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(s=r(448)),s),transformRequest:[function(e,t){return a(t,"Accept"),a(t,"Content-Type"),n.isFormData(e)||n.isArrayBuffer(e)||n.isBuffer(e)||n.isStream(e)||n.isFile(e)||n.isBlob(e)?e:n.isArrayBufferView(e)?e.buffer:n.isURLSearchParams(e)?(i(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):n.isObject(e)?(i(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};n.forEach(["delete","get","head"],(function(e){u.headers[e]={}})),n.forEach(["post","put","patch"],(function(e){u.headers[e]=n.merge(o)})),e.exports=u},849:e=>{"use strict";e.exports=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return e.apply(t,r)}}},327:(e,t,r)=>{"use strict";var n=r(867);function a(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,r){if(!t)return e;var o;if(r)o=r(t);else if(n.isURLSearchParams(t))o=t.toString();else{var i=[];n.forEach(t,(function(e,t){null!=e&&(n.isArray(e)?t+="[]":e=[e],n.forEach(e,(function(e){n.isDate(e)?e=e.toISOString():n.isObject(e)&&(e=JSON.stringify(e)),i.push(a(t)+"="+a(e))})))})),o=i.join("&")}if(o){var s=e.indexOf("#");-1!==s&&(e=e.slice(0,s)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}},303:e=>{"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},372:(e,t,r)=>{"use strict";var n=r(867);e.exports=n.isStandardBrowserEnv()?{write:function(e,t,r,a,o,i){var s=[];s.push(e+"="+encodeURIComponent(t)),n.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),n.isString(a)&&s.push("path="+a),n.isString(o)&&s.push("domain="+o),!0===i&&s.push("secure"),document.cookie=s.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},793:e=>{"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},268:e=>{"use strict";e.exports=function(e){return"object"==typeof e&&!0===e.isAxiosError}},985:(e,t,r)=>{"use strict";var n=r(867);e.exports=n.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function a(e){var n=e;return t&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=a(window.location.href),function(t){var r=n.isString(t)?a(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0}},16:(e,t,r)=>{"use strict";var n=r(867);e.exports=function(e,t){n.forEach(e,(function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])}))}},109:(e,t,r)=>{"use strict";var n=r(867),a=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,r,o,i={};return e?(n.forEach(e.split("\n"),(function(e){if(o=e.indexOf(":"),t=n.trim(e.substr(0,o)).toLowerCase(),r=n.trim(e.substr(o+1)),t){if(i[t]&&a.indexOf(t)>=0)return;i[t]="set-cookie"===t?(i[t]?i[t]:[]).concat([r]):i[t]?i[t]+", "+r:r}})),i):i}},713:e=>{"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},867:(e,t,r)=>{"use strict";var n=r(849),a=Object.prototype.toString;function o(e){return"[object Array]"===a.call(e)}function i(e){return void 0===e}function s(e){return null!==e&&"object"==typeof e}function u(e){if("[object Object]"!==a.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function c(e){return"[object Function]"===a.call(e)}function l(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),o(e))for(var r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.call(null,e[a],a,e)}e.exports={isArray:o,isArrayBuffer:function(e){return"[object ArrayBuffer]"===a.call(e)},isBuffer:function(e){return null!==e&&!i(e)&&null!==e.constructor&&!i(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:s,isPlainObject:u,isUndefined:i,isDate:function(e){return"[object Date]"===a.call(e)},isFile:function(e){return"[object File]"===a.call(e)},isBlob:function(e){return"[object Blob]"===a.call(e)},isFunction:c,isStream:function(e){return s(e)&&c(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:l,merge:function e(){var t={};function r(r,n){u(t[n])&&u(r)?t[n]=e(t[n],r):u(r)?t[n]=e({},r):o(r)?t[n]=r.slice():t[n]=r}for(var n=0,a=arguments.length;n<a;n++)l(arguments[n],r);return t},extend:function(e,t,r){return l(t,(function(t,a){e[a]=r&&"function"==typeof t?n(t,r):t})),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}}},184:(e,t)=>{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)&&r.length){var i=a.apply(null,r);i&&e.push(i)}else if("object"===o)for(var s in r)n.call(r,s)&&r[s]&&e.push(s)}}return e.join(" ")}e.exports?(a.default=a,e.exports=a):void 0===(r=function(){return a}.apply(t,[]))||(e.exports=r)}()}},t={};function r(n){var a=t[n];if(void 0!==a)return a.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";const e=wp.data;var t,n;function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var s={previewStatus:!1,templates:{loading:!1,error:!1,records:[],offset:""},templateTypes:["pattern","template"],templateFilters:{categories:[],type:"template",search:""},currentPreviewTemplate:{},currentScreen:"menu",reloadRequirements:{required:!1,insertCurrentTemplate:!1},apiKey:null!==(t=localStorage.getItem("etfy_library__key"))&&void 0!==t?t:"",maxImports:3,currentImports:null!==(n=localStorage.getItem("etfy__library_imports_left"))&&void 0!==n?n:3};const u=lodash;var c={reducer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:s,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SET_LIBRARY_PREVIEW_STATUS":return o(o({},e),{},{previewStatus:t.status});case"SET_TEMPLATES":return o(o({},e),{},{templates:o(o({},e.templates),t.templates)});case"SET_PREVIEW_TEMPLATE":return o(o({},e),{},{currentPreviewTemplate:t.template});case"SET_FILTERS":return o(o({},e),{},{templateFilters:o(o({},e.templateFilters),t.filters)});case"SET_LOADING_STATUS":switch(t.key){case"templates":return o(o({},e),{},{templates:o(o({},e.templates),{},{loading:t.status})})}break;case"SET_SCREEN":return o(o({},e),{},{currentScreen:t.screen});case"SET_RELOAD_REQUIREMENTS":return o(o({},e),{},{reloadRequirements:t.reload});case"SET_KEY":return o(o({},e),{},{apiKey:t.key});case"SET_STATE":return t.state;case"SET_IMPORTS":return o(o({},e),{},{currentImports:t.imports});default:return e}},actions:{setLibraryPreviewStatus:function(e){return{type:"SET_LIBRARY_PREVIEW_STATUS",status:e}},setTemplates:function(e){return{type:"SET_TEMPLATES",templates:e}},setLoadingStatus:function(e,t){return{type:"SET_LOADING_STATUS",key:e,status:t}},setCurrentPreviewTemplate:function(e){return{type:"SET_PREVIEW_TEMPLATE",template:e}},setFilters:function(e){return{type:"SET_FILTERS",filters:e}},setLastAppliedFilters:function(e){return{type:"SET_LAST_APPLIED_FILTERS",filters:e}},setCurrentScreen:function(e){return{type:"SET_SCREEN",screen:e}},setReloadRequirements:function(e){return{type:"SET_RELOAD_REQUIREMENTS",reload:e}},setSpecificState:function(e){return{type:"SET_STATE",state:e}},setApiKey:function(e){return{type:"SET_KEY",key:e}},setImportsCount:function(e){return{type:"SET_IMPORTS",imports:e}}},selectors:{getLibraryPreviewStatus:function(e){return(0,u.get)(e,"previewStatus")},getTemplates:function(e){return(0,u.get)(e,"templates")},getLoadingStatus:function(e,t){switch(t){case"templates":return(0,u.get)(e,"templates.loading");default:return!1}},getTemplateTypes:function(e){return(0,u.get)(e,"templateTypes")},getAppliedFilter:function(e,t){if((0,u.isString)(t)){var r=(0,u.get)(e,"templateFilters");return!!(0,u.has)(r,t)&&(0,u.get)(r,t)}},getAppliedFilters:function(e){return(0,u.get)(e,"templateFilters")},getCurrentPreviewTemplate:function(e){return(0,u.get)(e,"currentPreviewTemplate")},getCurrentScreen:function(e){return(0,u.get)(e,"currentScreen")},getApiKey:function(e){return(0,u.get)(e,"apiKey")},getCurrentImports:function(e){return(0,u.get)(e,"currentImports")},getMaxImports:function(e){return(0,u.get)(e,"maxImports")},getAuthenticationStatus:function(e){return!!(0,u.get)(e,"apiKey")}},resolvers:{},controls:{}};const l=(0,e.registerStore)("extendify-templates/data",c),p=wp.i18n,f=wp.element;var m="extendify-templates-inserter";window.wp.domReady((function(){var t=wp.element.createElement("div",{id:"extendify-templates-inserter"},wp.element.createElement("button",{style:"background:#D9F1EE;color:#1e1e1e;font-weight:bold;font-size:14px;padding:8px;height:28px",type:"button",id:"extendify-templates-inserter-btn",className:"components-button"},wp.element.createElement("svg",{style:"margin-right:0.5rem",width:"20",height:"20",viewBox:"0 0 103 103",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{y:"25.75",width:"70.8125",height:"77.25",fill:"black"}),wp.element.createElement("rect",{x:"45.0625",width:"57.9375",height:"57.9375",fill:"#37C2A2"})),(0,p.__)("Library",m)));document.getElementById("editor")&&window.wp.data.subscribe((function(){setTimeout((function(){if(!document.getElementById("extendify-templates-inserter-btn")){var r=document.querySelector(".edit-post-header-toolbar");r instanceof HTMLElement&&(r.insertAdjacentHTML("beforeend",(0,f.renderToString)(t)),document.getElementById("extendify-templates-inserter-btn").addEventListener("click",(function(){(0,(0,e.dispatch)("extendify-templates/data").setLibraryPreviewStatus)(!0)})))}}),0)}))}));const d=wp.plugins,y=wp.editPost,h=wp.compose,v=function(e){var t=e.icon,r={library:wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 20 20",fill:"none"},wp.element.createElement("g",{clipPath:"url(#clip0)"},wp.element.createElement("mask",{id:"mask0","mask-type":"alpha",maskUnits:"userSpaceOnUse",x:-4,y:0,width:29,height:28},wp.element.createElement("rect",{width:"19.6666",height:"19.6474",transform:"matrix(0.699908 0.714233 -0.724976 0.688774 10.2439 0)",fill:"black"})),wp.element.createElement("g",{mask:"url(#mask0)"},wp.element.createElement("rect",{x:"0.00339341",y:"0.701607",width:"18.6666",height:"18.6474",transform:"matrix(0.715941 0.698161 -0.709154 0.705054 10.4294 -8.1563)",stroke:"black"})),wp.element.createElement("rect",{width:"11.6128",height:"11.5957",transform:"matrix(0.710545 0.703466 -0.714551 0.699772 10.0079 0.414024)",fill:"black"}),wp.element.createElement("rect",{width:"7.53985",height:"3.68769",transform:"matrix(0.708475 -0.705736 0.716585 0.697499 4.20924 8.58513)",fill:"white"})),wp.element.createElement("defs",null,wp.element.createElement("clipPath",{id:"clip0"},wp.element.createElement("rect",{width:20,height:20,fill:"white"}))))};return(0,u.get)(r,t)};(0,d.registerPlugin)("extendify-temps-more-menu-trigger",{render:(0,h.compose)([(0,e.withSelect)((function(e){return{previewStatus:(0,e("extendify-templates/data").getLibraryPreviewStatus)()}})),(0,e.withDispatch)((function(e,t){var r=t.previewStatus,n=e("extendify-templates/data").setLibraryPreviewStatus;return{toggleTemplatesLibraryPreview:function(){n(!r)}}}))])((function(e){var t=e.previewStatus,r=e.toggleTemplatesLibraryPreview;return wp.element.createElement(y.PluginSidebarMoreMenuItem,{isPrimary:t,onClick:r,className:"etfy-lib-menu",icon:wp.element.createElement("span",{className:"components-menu-items__item-icon"},wp.element.createElement(v,{icon:"library"}))},(0,p.__)("Library",m))}))});const g=wp.components;function w(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function E(e){return function(e){if(Array.isArray(e))return b(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return b(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?b(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function S(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(!e){if("undefined"==typeof window)return!1;e=window}var t=e.navigator.platform;return-1!==t.indexOf("Mac")||(0,u.includes)(["iPad","iPhone"],t)}var x="alt",_="ctrl",P="meta",A="shift",T={primary:function(e){return e()?[P]:[_]},primaryShift:function(e){return e()?[A,P]:[_,A]},primaryAlt:function(e){return e()?[x,P]:[_,x]},secondary:function(e){return e()?[A,x,P]:[_,A,x]},access:function(e){return e()?[_,x]:[A,x]},ctrl:function(){return[_]},alt:function(){return[x]},ctrlShift:function(){return[_,A]},shift:function(){return[A]},shiftAlt:function(){return[A,x]}},k=((0,u.mapValues)(T,(function(e){return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:S;return[].concat(E(e(r)),[t.toLowerCase()]).join("+")}})),(0,u.mapValues)(T,(function(e){return function(t){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:S,a=n(),o=(w(r={},x,a?"⌥":"Alt"),w(r,_,a?"⌃":"Ctrl"),w(r,P,"⌘"),w(r,A,a?"⇧":"Shift"),r),i=e(n).reduce((function(e,t){var r=(0,u.get)(o,t,t);return[].concat(E(e),a?[r]:[r,"+"])}),[]),s=(0,u.capitalize)(t);return[].concat(E(i),[s])}})));function O(e){return[x,_,P,A].filter((function(t){return e["".concat(t,"Key")]}))}(0,u.mapValues)(k,(function(e){return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:S;return e(t,r).join("")}})),(0,u.mapValues)(T,(function(e){return function(t){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:S,a=n(),o=(w(r={},A,"Shift"),w(r,P,a?"Command":"Control"),w(r,_,"Control"),w(r,x,a?"Option":"Alt"),w(r,",",(0,p.__)("Comma")),w(r,".",(0,p.__)("Period")),w(r,"`",(0,p.__)("Backtick")),r);return[].concat(E(e(n)),[t]).map((function(e){return(0,u.capitalize)((0,u.get)(o,e,e))})).join(a?" ":" + ")}})),(0,u.mapValues)(T,(function(e){return function(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:S,a=e(n),o=O(t);return!(0,u.xor)(a,o).length&&(r?t.key===r:(0,u.includes)(a,t.key.toLowerCase()))}}));var C=r(184),R=r.n(C);const j=(0,h.compose)([(0,e.withSelect)((function(e,t){var r=t.template;return{shortCode:(0,u.get)(r,"fields.code"),currentType:(0,e("extendify-templates/data").getAppliedFilter)("type")}})),(0,e.withDispatch)((function(e,t){var r=t.template,n=e("extendify-templates/data"),a=n.setCurrentPreviewTemplate,o=n.setCurrentScreen;return{onSelect:function(){a(r),o("single-template")}}}))])((function(e){var t,r,n=e.template,a=e.onSelect,o=e.currentType,i=[(0,u.get)(n,"fields.screenshot[0].url"),(0,u.get)(n,"fields.title"),(0,u.get)(n,"fields.categories")],s=i[0],c=i[1],l=i[2],p=R()((t={"etfy-template":!0},!0,(r="etfy-type-".concat(o))in t?Object.defineProperty(t,r,{value:true,enumerable:!0,configurable:!0,writable:!0}):t[r]=true,t));return wp.element.createElement(g.TabbableContainer,{tabIndex:"0","aria-pressed":"false",onClick:a,onKeyDown:function(e){return(0,u.isEqual)(e.keyCode,13)&&a()},className:"etfy-template-main"},wp.element.createElement(g.Card,{className:p},wp.element.createElement(g.CardMedia,{className:"etfy-template-media",style:{backgroundImage:"url(".concat(s,")")}})),wp.element.createElement("div",{className:"etfy-template-body"},wp.element.createElement("h2",null,c),wp.element.createElement("span",null,l.join(", "))))}));function I(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,a=!1,o=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){a=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(a)throw o}}return r}}(e,t)||function(e,t){if(e){if("string"==typeof e)return N(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?N(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function N(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function L(e){var t=(0,u.get)(e,"categories"),r=(0,u.get)(e,"search"),n=(0,u.get)(e,"type"),a=(0,u.isEmpty)(t)?"TRUE()":t.map((function(e){return'SEARCH("'.concat(e,'", {categories}) = 1')})).join(","),o=(0,u.isEmpty)(r)?"TRUE()":'OR(FIND(LOWER("'.concat(r,'"), LOWER(title)) != 0, FIND(LOWER("').concat(r,'"), LOWER({categories})) != 0)'),i=(0,u.isEmpty)(n)?"TRUE()":'{type}="'.concat(n,'"'),s="IF(AND(".concat(a,", ").concat(o,", ").concat(i,"), TRUE())");return(0,u.isEmpty)(o)&&(0,u.isEmpty)(i)&&(0,u.isEmpty)(a)&&(s=""),s.replace(/\r?\n|\r/g,"")}function q(e,t){return!(!(0,u.isString)(e)||!(0,u.isString)(t))&&(e=(0,u.toLower)(e),-1!==(t=(0,u.toLower)(t)).indexOf(e))}function B(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=window.wp.blocks.createBlock;return e.map((function(e){var r=I(Array.isArray(e)?e:[e.name,e.attributes,e.innerBlocks],3),n=r[0],a=r[1],o=r[2];return t(n,a,B(void 0===o?[]:o))}))}function D(t){if(!t)throw Error("Template not found");return(0,(0,e.dispatch)("core/block-editor").insertBlocks)(B((0,window.wp.blocks.parse)((0,u.get)(t,"fields.code")))).then((function(){window.dispatchEvent(new CustomEvent("extendify-sdk::template-inserted",{detail:{template:t},bubbles:!0}))}))}var F=r(669);function U(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function M(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const K=function(e,t){return X.post("templates",function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?U(Object(r),!0).forEach((function(t){M(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):U(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({filterByFormula:L(e),pageSize:9,categories:(0,u.get)(e,"categories"),search:(0,u.get)(e,"search"),type:(0,u.get)(e,"type")},t))},W=function(e){var t;return X.post("templates/".concat(e.id),{template_id:e.id,pageSize:9,template_name:null===(t=e.fields)||void 0===t?void 0:t.title})},z=function(){return X.get("plugins")},H=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=new FormData;return t.append("plugins",JSON.stringify(e)),X.post("plugins",t,{headers:{"Content-Type":"multipart/form-data"}})},V=function(){return X.get("active-plugins")},$=function(){return X.get("categories")};var X=r.n(F)().create({baseURL:window.extendifySdkData.root,headers:{"X-WP-Nonce":window.extendifySdkData.nonce,"X-Requested-With":"XMLHttpRequest","X-Extendify":!0}});function J(e){return Object.prototype.hasOwnProperty.call(e,"data")?e.data:e}function Y(e,t,r,n,a,o,i){try{var s=e[o](i),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,a)}function G(e){return function(){var t=this,r=arguments;return new Promise((function(n,a){var o=e.apply(t,r);function i(e){Y(o,n,a,i,s,"next",e)}function s(e){Y(o,n,a,i,s,"throw",e)}i(void 0)}))}}function Q(e){return Z.apply(this,arguments)}function Z(){return(Z=G(regeneratorRuntime.mark((function t(r){var n,a,o,i;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if((a=null!==(n=(0,u.get)(r,"fields.required_plugins"))&&void 0!==n?n:[]).length){t.next=3;break}return t.abrupt("return",!1);case 3:return t.t0=Object,t.next=6,z();case 6:return t.t1=t.sent,o=t.t0.keys.call(t.t0,t.t1),i=!!a.length&&a.filter((function(e){return!o.some((function(t){return t.includes(e)}))})),(0,(0,e.dispatch)("extendify-templates/data").setReloadRequirements)({required:+i.length}),t.abrupt("return",i.length);case 12:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function ee(e){return te.apply(this,arguments)}function te(){return(te=G(regeneratorRuntime.mark((function t(r){var n,a,o,i;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if((a=null!==(n=(0,u.get)(r,"fields.required_plugins"))&&void 0!==n?n:[]).length){t.next=3;break}return t.abrupt("return",!1);case 3:return t.t0=Object,t.next=6,V();case 6:if(t.t1=t.sent,o=t.t0.values.call(t.t0,t.t1),!(i=!!a.length&&a.filter((function(e){return!o.some((function(t){return t.includes(e)}))})))){t.next=14;break}return t.next=12,Q(r);case 12:if(!t.sent){t.next=14;break}return t.abrupt("return",!1);case 14:return(0,(0,e.dispatch)("extendify-templates/data").setReloadRequirements)({required:+i.length}),t.abrupt("return",i.length);case 17:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function re(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}X.interceptors.response.use((function(e){return function(e){return Object.prototype.hasOwnProperty.call(e,"soft_error")&&window.dispatchEvent(new CustomEvent("extendify-sdk::softerror-encountered",{detail:e.soft_error,bubbles:!0})),e}(J(e))}),(function(e){return function(e){return console.error(e.response),Promise.reject(J(e.response))}(e)})),X.interceptors.request.use((function(e){return function(e){return e.headers["X-Extendify-Dev-Mode"]=window.location.search.indexOf("DEVMODE")>-1,e}(function(e){return e.params=(0,u.mapValues)(e.params,encodeURIComponent),e}(function(e){var t=window.wp.data.select("extendify-templates/data").getCurrentImports;return e.params&&(e.params.remaining_imports=t()),e}(e)))}),(function(e){return e}));var ne=function(){var e,t,r,n,a=(r=(0,f.useState)(""),n=2,function(e){if(Array.isArray(e))return e}(r)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,a=!1,o=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){a=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(a)throw o}}return r}}(r,n)||function(e,t){if(e){if("string"==typeof e)return re(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?re(e,t):void 0}}(r,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=a[0],i=a[1],s=l.getState();return delete s.templates,(0,f.useEffect)((function(){s.reloadRequirements.insertCurrentTemplate=1;var e=o.length?null:JSON.stringify(s);window.sessionStorage.setItem("extendify-sdk-reload-session",e)}),[o,s]),H(null==s||null===(e=s.currentPreviewTemplate)||void 0===e||null===(t=e.fields)||void 0===t?void 0:t.required_plugins).then((function(){window.dispatchEvent(new CustomEvent("extendfy::install-required-complete"))})).catch((function(e){var t=e.response;i(t.data.message)})),o?wp.element.createElement(React.Fragment,null,wp.element.createElement(g.Modal,{style:{maxWidth:"500px"},title:(0,p.__)("Error installing plugins",m),isDismissible:!1},(0,p.__)("You have encountered an error that we cannot recover from. Please try again.",m),wp.element.createElement("br",null),wp.element.createElement(g.Notice,{isDismissible:!1,status:"error"},o),wp.element.createElement(g.Button,{isPrimary:!0,onClick:function(){(0,f.render)(wp.element.createElement(ie,{previousState:s}),document.querySelector("#extendify-root"))}},(0,p.__)("Go back",m)))):wp.element.createElement(React.Fragment,null,wp.element.createElement(g.Modal,{title:(0,p.__)("Installing plugins",m),isDismissible:!1},wp.element.createElement(g.Button,{style:{width:"100%"},disabled:!0,isPrimary:!0,isBusy:!0,onClick:function(){}},(0,p.__)("Installing...",m))))};function ae(e,t,r,n,a,o,i){try{var s=e[o](i),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,a)}function oe(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var ie=function(t){var r,n,a,o,i,s,u,c,l,d,y=(0,e.dispatch)("extendify-templates/data"),h=y.setSpecificState,v=y.setCurrentPreviewTemplate,w=(0,e.select)("extendify-templates/data").getCurrentPreviewTemplate,b=(l=(0,f.useState)(!0),d=2,function(e){if(Array.isArray(e))return e}(l)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,a=!1,o=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){a=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(a)throw o}}return r}}(l,d)||function(e,t){if(e){if("string"==typeof e)return oe(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?oe(e,t):void 0}}(l,d)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),E=b[0],S=b[1],x=w(),_=function(){t.forceOpen||(S(!1),t.previousState&&(h(t.previousState),v(x)),(0,f.render)(wp.element.createElement(tt,null),document.querySelector("#extendify-root")))},P=function(){var e,t=(e=regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:S(!1),(0,f.render)(wp.element.createElement(ne,null),document.querySelector("#extendify-root"));case 2:case"end":return e.stop()}}),e)})),function(){var t=this,r=arguments;return new Promise((function(n,a){var o=e.apply(t,r);function i(e){ae(o,n,a,i,s,"next",e)}function s(e){ae(o,n,a,i,s,"throw",e)}i(void 0)}))});return function(){return t.apply(this,arguments)}}(),A=null!==(r=null===(n=t.previousState)||void 0===n||null===(a=n.currentPreviewTemplate)||void 0===a||null===(o=a.fields)||void 0===o?void 0:o.type)&&void 0!==r?r:"template";return wp.element.createElement(React.Fragment,null,E&&wp.element.createElement(g.Modal,{title:null!==(i=t.title)&&void 0!==i?i:(0,p.__)("Install required plugins",m),closeButtonLabel:(0,p.__)("No thanks, take me back",m),onRequestClose:_},wp.element.createElement("p",{style:{maxWidth:"400px"}},null!==(s=t.message)&&void 0!==s?s:(0,p.__)((0,p.sprintf)("There is just one more step. This %s requires the following to be automatically installed:",A),m)),(null===(u=t.message)||void 0===u?void 0:u.length)>0||wp.element.createElement("ul",null,wp.element.createElement("li",null,"Editor Plus")),wp.element.createElement(g.ButtonGroup,null,wp.element.createElement(g.Button,{isPrimary:!0,onClick:P},null!==(c=t.buttonLabel)&&void 0!==c?c:(0,p.__)("Install Plugins",m)),t.forceOpen||wp.element.createElement(g.Button,{isTertiary:!0,onClick:_,style:{boxShadow:"none",margin:"0 4px"}},(0,p.__)("No thanks, take me back",m)))))};function se(e,t,r,n,a,o,i){try{var s=e[o](i),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,a)}function ue(e){return function(){var t=this,r=arguments;return new Promise((function(n,a){var o=e.apply(t,r);function i(e){se(o,n,a,i,s,"next",e)}function s(e){se(o,n,a,i,s,"throw",e)}i(void 0)}))}}var ce=function(){var e=ue(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=l.getState(),e.next=3,Q(t);case 3:return e.t0=!e.sent,e.t1=function(){return ue(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)})))()},e.t2=function(){return ue(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){(0,f.render)(wp.element.createElement(ie,{previousState:r}),document.querySelector("#extendify-root")),window.addEventListener("extendfy::install-required-complete",(function(){e()}))})));case 1:case"end":return e.stop()}}),e)})))()},e.abrupt("return",{id:"hasRequiredPlugins",pass:e.t0,allow:e.t1,deny:e.t2});case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();function le(e,t,r,n,a,o,i){try{var s=e[o](i),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,a)}function pe(e){return function(){var t=this,r=arguments;return new Promise((function(n,a){var o=e.apply(t,r);function i(e){le(o,n,a,i,s,"next",e)}function s(e){le(o,n,a,i,s,"throw",e)}i(void 0)}))}}function fe(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var me=function(){var e,t,r,n,a=(r=(0,f.useState)(""),n=2,function(e){if(Array.isArray(e))return e}(r)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,a=!1,o=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){a=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(a)throw o}}return r}}(r,n)||function(e,t){if(e){if("string"==typeof e)return fe(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?fe(e,t):void 0}}(r,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=a[0],i=a[1],s=l.getState();return delete s.templates,(0,f.useEffect)((function(){s.reloadRequirements.insertCurrentTemplate=1;var e=o.length?null:JSON.stringify(s);window.sessionStorage.setItem("extendify-sdk-reload-session",e)}),[o,s]),H(null==s||null===(e=s.currentPreviewTemplate)||void 0===e||null===(t=e.fields)||void 0===t?void 0:t.required_plugins).then(pe(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,new Promise((function(e){return setTimeout(e,1500)}));case 2:window.dispatchEvent(new CustomEvent("extendfy::activate-required-complete"));case 3:case"end":return e.stop()}}),e)})))).catch((function(e){var t=e.response;i(t.data.message)})),o?wp.element.createElement(React.Fragment,null,wp.element.createElement(g.Modal,{style:{maxWidth:"500px"},title:(0,p.__)("Error Activating plugins",m),isDismissible:!1},(0,p.__)("You have encountered an error that we cannot recover from. Please try again.",m),wp.element.createElement("br",null),wp.element.createElement(g.Notice,{isDismissible:!1,status:"error"},o),wp.element.createElement(g.Button,{isPrimary:!0,onClick:function(){(0,f.render)(wp.element.createElement(he,{previousState:s}),document.querySelector("#extendify-root"))}},(0,p.__)("Go back",m)))):wp.element.createElement(React.Fragment,null,wp.element.createElement(g.Modal,{title:(0,p.__)("Activating plugins",m),isDismissible:!1},wp.element.createElement(g.Button,{style:{width:"100%"},disabled:!0,isPrimary:!0,isBusy:!0,onClick:function(){}},(0,p.__)("Activating...",m))))};function de(e,t,r,n,a,o,i){try{var s=e[o](i),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,a)}function ye(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var he=function(t){var r,n,a,o,i,s,u,c=(0,e.dispatch)("extendify-templates/data"),l=c.setSpecificState,d=c.setCurrentPreviewTemplate,y=(0,e.select)("extendify-templates/data").getCurrentPreviewTemplate,h=(s=(0,f.useState)(!0),u=2,function(e){if(Array.isArray(e))return e}(s)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,a=!1,o=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){a=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(a)throw o}}return r}}(s,u)||function(e,t){if(e){if("string"==typeof e)return ye(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ye(e,t):void 0}}(s,u)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),v=h[0],w=h[1],b=y(),E=function(){w(!1),l(t.previousState),d(b),(0,f.render)(wp.element.createElement(tt,null),document.querySelector("#extendify-root"))},S=function(){var e,t=(e=regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:w(!1),(0,f.render)(wp.element.createElement(me,null),document.querySelector("#extendify-root"));case 2:case"end":return e.stop()}}),e)})),function(){var t=this,r=arguments;return new Promise((function(n,a){var o=e.apply(t,r);function i(e){de(o,n,a,i,s,"next",e)}function s(e){de(o,n,a,i,s,"throw",e)}i(void 0)}))});return function(){return t.apply(this,arguments)}}(),x=null!==(r=null===(n=t.previousState)||void 0===n||null===(a=n.currentPreviewTemplate)||void 0===a||null===(o=a.fields)||void 0===o?void 0:o.type)&&void 0!==r?r:"template";return wp.element.createElement(React.Fragment,null,v&&wp.element.createElement(g.Modal,{title:(0,p.__)("Activate required plugins",m),closeButtonLabel:(0,p.__)("No thanks, return to library",m),onRequestClose:E},wp.element.createElement("p",{style:{maxWidth:"400px"}},null!==(i=t.message)&&void 0!==i?i:(0,p.__)((0,p.sprintf)("There is just one more step. This %s requires the following plugins to be activated:",x),m)),wp.element.createElement("ul",null,wp.element.createElement("li",null,"Editor Plus")),wp.element.createElement(g.ButtonGroup,null,wp.element.createElement(g.Button,{isPrimary:!0,onClick:S},(0,p.__)("Activate Plugins",m)),t.showClose&&wp.element.createElement(g.Button,{isTertiary:!0,onClick:E,style:{boxShadow:"none",margin:"0 4px"}},(0,p.__)("No thanks, return to library",m)))))};function ve(e,t,r,n,a,o,i){try{var s=e[o](i),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,a)}function ge(e){return function(){var t=this,r=arguments;return new Promise((function(n,a){var o=e.apply(t,r);function i(e){ve(o,n,a,i,s,"next",e)}function s(e){ve(o,n,a,i,s,"throw",e)}i(void 0)}))}}var we=function(){var e=ge(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=l.getState(),e.next=3,ee(t);case 3:return e.t0=!e.sent,e.t1=function(){return ge(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)})))()},e.t2=function(){return ge(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){(0,f.render)(wp.element.createElement(he,{previousState:r,showClose:!0}),document.querySelector("#extendify-root")),window.addEventListener("extendfy::activate-required-complete",(function(){e()}))})));case 1:case"end":return e.stop()}}),e)})))()},e.abrupt("return",{id:"hasPluginsActivated",pass:e.t0,allow:e.t1,deny:e.t2});case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();function be(e,t,r,n,a,o,i){try{var s=e[o](i),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,a)}function Ee(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Se=function(){var t,r,n=(t=(0,f.useState)(!1),r=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,a=!1,o=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){a=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(a)throw o}}return r}}(t,r)||function(e,t){if(e){if("string"==typeof e)return Ee(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ee(e,t):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),a=n[0],o=n[1],i=(0,(0,e.select)("core/editor").isEditedPostDirty)(),s=function(){var t,r=(t=regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o(!0),t.next=3,(0,e.dispatch)("core/editor").savePost();case 3:o(!1);case 4:case"end":return t.stop()}}),t)})),function(){var e=this,r=arguments;return new Promise((function(n,a){var o=t.apply(e,r);function i(e){be(o,n,a,i,s,"next",e)}function s(e){be(o,n,a,i,s,"throw",e)}i(void 0)}))});return function(){return r.apply(this,arguments)}}(),u=function(){location.reload()};return i?wp.element.createElement(React.Fragment,null,wp.element.createElement(g.Modal,{title:(0,p.__)("Reload required",m),isDismissible:!1},wp.element.createElement("p",{style:{maxWidth:"400px"}},(0,p.__)("Just one more thing! We need to reload the page to continue.",m)),wp.element.createElement(g.ButtonGroup,null,wp.element.createElement(g.Button,{isPrimary:!0,onClick:u,disabled:a},(0,p.__)("Reload page",m)),wp.element.createElement(g.Button,{isSecondary:!0,onClick:s,isBusy:a,style:{margin:"0 4px"}},(0,p.__)("Save changes",m))))):(u(),null)};function xe(e,t,r,n,a,o,i){try{var s=e[o](i),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,a)}function _e(e){return function(){var t=this,r=arguments;return new Promise((function(n,a){var o=e.apply(t,r);function i(e){xe(o,n,a,i,s,"next",e)}function s(e){xe(o,n,a,i,s,"throw",e)}i(void 0)}))}}var Pe=function(){var e=_e(regeneratorRuntime.mark((function e(){var t,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=l.getState(),e.abrupt("return",{id:"needsPageReload",pass:!(null!=r&&null!==(t=r.reloadRequirements)&&void 0!==t&&t.required),allow:function(){return _e(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)})))()},deny:function(){return _e(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(){(0,f.render)(wp.element.createElement(Se,null),document.querySelector("#extendify-root"))})));case 1:case"end":return e.stop()}}),e)})))()}});case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();function Ae(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return Te(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Te(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return i=e.done,e},e:function(e){s=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(s)throw o}}}}function Te(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function ke(e,t,r,n,a,o,i){try{var s=e[o](i),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,a)}function Oe(e){return function(){var t=this,r=arguments;return new Promise((function(n,a){var o=e.apply(t,r);function i(e){ke(o,n,a,i,s,"next",e)}function s(e){ke(o,n,a,i,s,"throw",e)}i(void 0)}))}}function Ce(e){return function(){return new Re(e.apply(this,arguments))}}function Re(e){var t,r;function n(t,r){try{var o=e[t](r),i=o.value,s=i instanceof je;Promise.resolve(s?i.wrapped:i).then((function(e){s?n("return"===t?"return":"next",e):a(o.done?"return":"normal",e)}),(function(e){n("throw",e)}))}catch(e){a("throw",e)}}function a(e,a){switch(e){case"return":t.resolve({value:a,done:!0});break;case"throw":t.reject(a);break;default:t.resolve({value:a,done:!1})}(t=t.next)?n(t.key,t.arg):r=null}this._invoke=function(e,a){return new Promise((function(o,i){var s={key:e,arg:a,resolve:o,reject:i,next:null};r?r=r.next=s:(t=r=s,n(e,a))}))},"function"!=typeof e.return&&(this.return=void 0)}function je(e){this.wrapped=e}function Ie(){return(Ie=Oe(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=Ne(t);case 1:return e.next=4,r.next();case 4:if(!e.sent.done){e.next=7;break}return e.abrupt("break",9);case 7:e.next=1;break;case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ne(e){return Le.apply(this,arguments)}function Le(){return(Le=Ce(regeneratorRuntime.mark((function e(t){var r,n,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=Ae(t),e.prev=1,r.s();case 3:if((n=r.n()).done){e.next=9;break}return a=n.value,e.next=7,a();case 7:e.next=3;break;case 9:e.next=14;break;case 11:e.prev=11,e.t0=e.catch(1),r.e(e.t0);case 14:return e.prev=14,r.f(),e.finish(14);case 17:case"end":return e.stop()}}),e,null,[[1,11,14,17]])})))).apply(this,arguments)}function qe(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}"function"==typeof Symbol&&Symbol.asyncIterator&&(Re.prototype[Symbol.asyncIterator]=function(){return this}),Re.prototype.next=function(e){return this._invoke("next",e)},Re.prototype.throw=function(e){return this._invoke("throw",e)},Re.prototype.return=function(e){return this._invoke("return",e)};const Be=(0,h.compose)([(0,h.withState)({restrictions:[]}),(0,e.withSelect)((function(e){var t=e("extendify-templates/data"),r=t.getCurrentPreviewTemplate,n=t.getAppliedFilter,a=t.getCurrentImports,o=t.getMaxImports,i=t.getAuthenticationStatus,s=e("core/editor").getEditedPostAttribute,c=r(),l=(0,u.get)(c,"fields.code");return{template:r(),currentCategory:n("categories"),shortCode:l,postMeta:s("meta"),currentImports:a(),maxImports:o(),isAuthenticated:i()}})),(0,e.withDispatch)((function(e,t){var r=t.currentCategory,n=t.template,a=t.currentImports,o=t.restrictions,i=e("extendify-templates/data"),s=i.setFilters,c=i.setCurrentScreen,l=i.setCurrentPreviewTemplate,f=i.setLibraryPreviewStatus,m=i.setImportsCount;return{onImport:function(){(function(e){return Ie.apply(this,arguments)})(o).then((function(){f(!1),D(n).then((function(){var t=e("core/notices").createNotice,r=a-1;m(r),localStorage.setItem("etfy__library_imports_left",r),t("info",(0,p.__)("Template Added"),{isDismissible:!0,type:"snackbar"})}))}))},applyCategory:function(e){(0,u.isEqual)(e,(0,u.head)(r))||s({categories:[e]}),l({}),c("templates")}}}))])((function(t){var r,n,a=t.template,o=t.onImport,i=t.applyCategory,s=t.setState,c=t.currentImports,l=t.isAuthenticated,d=[(0,u.get)(a,"fields.screenshot[0].url"),(0,u.get)(a,"fields.title"),(0,u.get)(a,"fields.categories"),(0,u.get)(a,"fields.required_plugins",[])],y=d[0],h=d[1],v=d[2],w=d[3],b=0<c,E=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return{hasRequiredPlugins:ce,hasPluginsActivated:we,needsPageReload:Pe,stack:[],check:function(e){var r=this;return Oe(regeneratorRuntime.mark((function n(){var a,o,i;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:a=Ae(t),n.prev=1,i=regeneratorRuntime.mark((function t(){var n,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=o.value,t.next=3,r["".concat(n)](e);case 3:a=t.sent,setTimeout((function(){r.stack.push(a.pass?a.allow:a.deny)}),0);case 5:case"end":return t.stop()}}),t)})),a.s();case 4:if((o=a.n()).done){n.next=8;break}return n.delegateYield(i(),"t0",6);case 6:n.next=4;break;case 8:n.next=13;break;case 10:n.prev=10,n.t1=n.catch(1),a.e(n.t1);case 13:return n.prev=13,a.f(),n.finish(13);case 16:case"end":return n.stop()}}),n,null,[[1,10,13,16]])})))()},reset:function(){this.stack=[],(0,(0,e.dispatch)("extendify-templates/data").setReloadRequirements)({required:0})}}}(["hasRequiredPlugins","hasPluginsActivated","needsPageReload"]),S=(r=(0,f.useState)(!1),n=2,function(e){if(Array.isArray(e))return e}(r)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,a=!1,o=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){a=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(a)throw o}}return r}}(r,n)||function(e,t){if(e){if("string"==typeof e)return qe(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?qe(e,t):void 0}}(r,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),x=S[0],_=S[1];return(0,f.useEffect)((function(){return E.check(a).then((function(){s({restrictions:E.stack}),_(!0)})),function(){E.reset(),_(!1)}}),[a]),a?wp.element.createElement("div",{className:"etfy-template-preview"},wp.element.createElement("div",{className:"etfy-template-media"},wp.element.createElement("img",{src:y})),wp.element.createElement("div",{className:"etfy-template-details"},x?wp.element.createElement(React.Fragment,null,!b&&!l&&wp.element.createElement(g.Button,{className:"etfy-upgrade-btn",href:"https://extendify.com/?utm_source=sdk&utm_medium=free_beta_2&utm_campaign=sdk_ref",target:"__blank"},(0,p.__)("Sign up for free to add",m)),(l||b)&&wp.element.createElement(g.Button,{isPrimary:!0,onClick:o},(0,p.__)("Add",m))):wp.element.createElement(g.Button,{disabled:!0},(0,p.__)("Loading...",m)),wp.element.createElement("div",null,wp.element.createElement("h2",{className:"etfy-template-title"},h),wp.element.createElement("div",{className:"etfy-template-categories"},(0,u.map)(v,(function(e,t){return wp.element.createElement(g.Button,{isLink:!0,key:t,className:"etfy-template-category",onClick:function(){return i(e)}},(0,p.__)(e,m))}))),w.length?wp.element.createElement(React.Fragment,null,wp.element.createElement("hr",null),wp.element.createElement("div",{className:"etfy-template-required-plugins"},wp.element.createElement("strong",null,"Plugins required: "),wp.element.createElement("ul",{style:{display:"inline"}},(0,u.map)(w,(function(e,t){return wp.element.createElement("li",{style:{display:"inline"},key:t},(0,p.__)("Editor Plus",m))}))))):null))):null}));function De(e){return function(e){if(Array.isArray(e))return Fe(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Fe(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Fe(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Fe(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}const Ue=(0,h.compose)([(0,h.withState)({loading:!1,error:!1}),(0,e.withSelect)((function(e){var t=e("extendify-templates/data");return{getTemplates:t.getTemplates,filters:(0,t.getAppliedFilters)()}})),(0,e.withDispatch)((function(e){return{setTemplates:e("extendify-templates/data").setTemplates}}))])((function(e){var t,r=e.getTemplates,n=e.filters,a=e.loading,o=e.setTemplates,i=e.setState,s=function(){var e=r(),t=(0,u.get)(e,"offset");(0,u.isEmpty)(t)||a||(i({loading:!0,error:!1}),K(n,{offset:t}).then((function(t){var r=(0,u.get)(t,"offset"),n=(0,u.get)(t,"records");o({offset:r,records:[].concat(De((0,u.get)(e,"records")),De(n))}),i({loading:!1,error:!1})})).catch((function(){i({loading:!1,error:!0})})))},c=function(e){var t=e.target;t.scrollHeight-t.scrollTop===t.clientHeight&&s()};return(0,f.useEffect)((function(){var e=document.querySelector(".etfy-templates-library-modal-root");if(e)return e.addEventListener("scroll",c),function(){return e.removeEventListener("scroll",c,{passive:!0})}}),[]),null!==(t=r())&&void 0!==t&&t.offset?wp.element.createElement("div",{className:"etfy-load-more"},wp.element.createElement(g.Button,{isBusy:a,disabled:a,onClick:s,isDefault:!0},a?(0,p.__)("Loading",m):(0,p.__)("Load More",m))):null})),Me=(0,h.compose)([(0,e.withSelect)((function(e){return{currentSearch:(0,e("extendify-templates/data").getAppliedFilter)("search")}})),(0,e.withDispatch)((function(){return{}}))])((function(e){var t=e.currentSearch;return wp.element.createElement("div",{className:"etfy-not-results-found__root"},wp.element.createElement("h2",null,(0,p.__)('Your search "'.concat(t,'" - did not match any designs.'))),wp.element.createElement("p",null,(0,p.__)("Try searching again or select one of the categories from the list on the left.")))})),Ke=(0,h.compose)([(0,e.withSelect)((function(e){var t=e("extendify-templates/data"),r=t.getTemplates,n=t.getCurrentPreviewTemplate,a=t.getLoadingStatus,o=t.getAppliedFilter;return{templates:r(),shouldPreviewTemplate:!(0,u.isEmpty)(n()),loadingStatus:a("templates"),currentCategory:o("categories")}}))])((function(e){var t=e.templates,r=e.shouldPreviewTemplate,n=e.loadingStatus,a=e.currentCategory,o=R()({"etfy-templates-library-content":!0,"etfy-templates-library-grid":!r}),i=R()({"etfy-templates-library-content-root":!0,"etfy-templates-loading":n}),s=(0,u.get)(t,"records");return wp.element.createElement("div",{className:i},!r&&!n&&wp.element.createElement("div",{className:"etfy-templates-description--small"},wp.element.createElement("h3",null,"Templates",wp.element.createElement("span",null,"|"),(0,u.head)(a))),(0,u.isEmpty)(s)&&!n&&wp.element.createElement(Me,null),wp.element.createElement("div",{className:o},n?null:r?wp.element.createElement(Be,null):wp.element.createElement((function(){return(0,u.isEmpty)(s)?null:s.map((function(e,t){return wp.element.createElement(j,{key:t,template:e})}))}),null),n&&wp.element.createElement("div",{className:"etfy-loading"},wp.element.createElement(g.Spinner,null))),!r&&!n&&wp.element.createElement(Ue,null))})),We=wp.blockEditor,ze=function(e){var t=e.className,r=e.onChange,n=e.value,a=e.placeholder,o=e.onKeyDown,i=void 0===o?u.noop:o;return wp.element.createElement("div",{className:R()("block-editor-inserter__search",t)},(0,u.isFunction)(We.__experimentalSearchForm)?wp.element.createElement(We.__experimentalSearchForm,{placeholder:a,onChange:function(e){return r(e)},autoComplete:"off",value:n||""}):wp.element.createElement(g.TextControl,{style:{padding:"8px 8px"},onChange:r,onKeyDown:i,placeholder:a,value:n,autoComplete:"off"}))},He=function(e){return wp.element.createElement("div",{className:"etfy-templates-library-sidebar-menu"},(0,u.has)(e,"title")&&!(0,u.isEmpty)(e.title)&&wp.element.createElement("h2",null,e.title),e.children)},Ve=(0,h.compose)([(0,e.withSelect)((function(){var e=window.wp.data.select("extendify-templates/data"),t=e.getMaxImports,r=e.getCurrentImports;return{maxImports:t(),currentImports:r()}}))])((function(e){var t=e.maxImports,r=e.currentImports;return wp.element.createElement(g.Flex,{className:"etfy-imports-counter",justify:"flex-start"},wp.element.createElement("h4",null,(0,p.__)("Imports Left:",m)),wp.element.createElement("span",null,"".concat(r," / ").concat(t)))})),$e=(0,h.compose)([(0,h.withState)({apiKey:"",loading:!1,error:!1}),(0,e.withDispatch)((function(e){return{setApiKey:e("extendify-templates/data").setApiKey}}))])((function(e){var t=e.apiKey,r=e.setState,n=e.setApiKey,a=e.loading,o=e.error,i=e.onSuccess,s=e.onError;return wp.element.createElement("div",{className:"etfy-auth-api-form"},wp.element.createElement(g.TextControl,{className:R()({"etfy-auth-field":!0,"etfy-auth-error":o}),value:t,onChange:function(e){return r({apiKey:e})},placeholder:(0,p.__)("API Key",m)}),wp.element.createElement(g.Button,{isPrimary:!0,onClick:function(){(0,u.isEmpty)(t)||(r({loading:!0,error:!1}),setTimeout((function(){(0,u.isEqual)("3458290385902375729843",t)?(r({loading:!1,error:!1}),n(t),localStorage.setItem("etfy_library__key",t),i()):(r({loading:!1,error:!0}),s())}),500))},isBusy:a},a?(0,p.__)("Activating",m):(0,p.__)("Activate",m)))})),Xe=(0,h.compose)([g.withNotices,(0,h.withState)({displayApiForm:!1}),(0,e.withSelect)((function(e){return{isAuthenticated:(0,e("extendify-templates/data").getAuthenticationStatus)()}}))])((function(e){var t=e.displayApiForm,r=e.setState,n=e.noticeOperations,a=e.noticeUI,o=e.isAuthenticated;return wp.element.createElement("div",{className:"etfy-library-auth"},wp.element.createElement("div",{className:"etfy-library-auth-notices"},a),o?null:wp.element.createElement(React.Fragment,null,wp.element.createElement(Ve,null),wp.element.createElement("div",{className:"etfy-library-auth__header"},wp.element.createElement(g.Button,{className:"etfy-upgrade__btn",href:"https://extendify.com/?utm_source=sdk&utm_medium=free_beta&utm_campaign=sdk_ref",target:"__blank"},(0,p.__)("Sign up for free",m)),wp.element.createElement(g.Button,{className:"etfy-add-key__btn",onClick:function(){return r({displayApiForm:!t})}},t?(0,p.__)("Close"):(0,p.__)("Log in"))),t&&wp.element.createElement($e,{onError:function(){return n.createErrorNotice((0,p.__)("You have entered an invalid API key",m))},onSuccess:function(){return n.createNotice({content:(0,p.__)("Activation key added successfully!",m),status:"success"})}})))}));function Je(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,a=!1,o=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){a=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(a)throw o}}return r}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ye(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ye(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ye(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}const Ge=(0,h.compose)([(0,h.withState)({searchState:""}),(0,e.withSelect)((function(e){var t=e("extendify-templates/data"),r=t.getTemplateTypes,n=t.getAppliedFilter,a=t.getTemplates;return{types:r(),currentType:n("type"),currentCategories:n("categories"),currentSearch:n("search"),templates:a()}})),(0,e.withDispatch)((function(e){var t=e("extendify-templates/data");return{setFilters:t.setFilters,setCurrentPreviewTemplate:t.setCurrentPreviewTemplate,setCurrentScreen:t.setCurrentScreen}}))])((function(e){var t=e.types,r=e.setFilters,n=e.currentType,a=e.currentSearch,o=e.currentCategories,i=e.setCurrentPreviewTemplate,s=e.searchState,c=e.setState,l=e.setCurrentScreen,d=e.templates,y=Je((0,f.useState)([]),2),h=y[0],v=y[1],w=Je((0,f.useState)(""),2),b=w[0],E=w[1],S=h.filter((function(e){return q(a,e)}));(0,f.useEffect)((function(){$().then((function(e){return v(e)})).catch((function(e){var t=e.message;return E(t)}))}),[]);var x=(0,f.useRef)((0,u.debounce)((function(e){r({search:e,categories:[]}),l("templates"),i({})}),500)).current,_=function(e){var t=0===(0,u.get)(d,"records.length");t&&c({searchState:""}),o.includes(e)||r({categories:e?[e]:[],search:t?"":a}),i({}),l("templates")};(0,f.useEffect)((function(){return c({searchState:a})}),[]);var P=!(0===S.length&&(0,u.get)(d,"records.length")>0&&!(0,u.isEmpty)(a));return wp.element.createElement("div",{className:"etfy-templates-library-sidebar"},wp.element.createElement("div",{className:"etfy-templates-library-sidebar__wrapper"},wp.element.createElement("div",{className:"etfy-templates-library-top__area"},wp.element.createElement(Xe,null),wp.element.createElement(ze,{value:s,placeholder:(0,p.__)("What are you looking for?",m),onChange:function(e){c({searchState:e}),x(e)}}),wp.element.createElement("hr",{className:"etfy-divider"})),wp.element.createElement(He,{title:(0,p.__)("Type",m)},(0,u.map)(t,(function(e,t){return wp.element.createElement(g.MenuItem,{onClick:function(){return function(e){(0,u.isEqual)(n,e)||r({type:e,categories:o.length?[(0,u.head)(o)]:[]}),i({})}(e)},className:R()({"etfy-menu-item":!0,"etfy-selected-category":(0,u.isEqual)((0,u.toLower)(e),n)}),key:t},(0,u.capitalize)(e))}))),P&&wp.element.createElement(He,{title:(0,p.__)("Categories",m)},wp.element.createElement((function(e){return b.length?b:h.length?wp.element.createElement(React.Fragment,null,wp.element.createElement(g.MenuItem,{className:R()({"etfy-selected-category":!o.length,"etfy-menu-item":!0}),onClick:function(){return _()}},(0,p.__)("All",m)),(0,u.map)(e.categories,(function(e,t){var r=(0,u.includes)(o,e),n=!!(0,u.isEmpty)(a)||q(a,e);return 0===(0,u.get)(d,"records.length")&&(n=!0),n&&wp.element.createElement(g.MenuItem,{key:t,className:R()({"etfy-selected-category":r,"etfy-menu-item":!0}),onClick:function(){return _(e)}},(0,u.capitalize)(e))}))):(0,p.__)("Loading categories...",m)}),{categories:h,type:n}))))}));function Qe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ze(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Qe(Object(r),!0).forEach((function(t){et(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Qe(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function et(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const tt=(0,h.compose)([(0,e.withSelect)((function(e){var t=e("extendify-templates/data"),r=t.getLibraryPreviewStatus,n=t.getAppliedFilters,a=t.getCurrentPreviewTemplate,o=t.getCurrentScreen;return{previewStatus:r(),appliedFilters:n(),currentScreen:o(),isPreviewingTemplate:function(){var e=a();return!(0,u.isEmpty)(e)}}})),(0,e.withDispatch)((function(e,t){var r=t.currentScreen,n=e("extendify-templates/data"),a=n.setLibraryPreviewStatus,o=n.setTemplates,i=n.setLoadingStatus,s=n.setCurrentPreviewTemplate,c=n.setCurrentScreen;return{goBack:function(){s({}),(0,u.isEqual)(r,"single-template")&&c("templates"),(0,u.isEqual)(r,"templates")&&c("menu")},closeLibraryModal:function(){a(!1)},setTemplates:o,setLoadingStatus:i}}))])((function(e){var t=e.previewStatus,r=e.closeLibraryModal,n=e.appliedFilters,a=e.setTemplates,o=e.setLoadingStatus,i=e.isPreviewingTemplate,s=e.currentScreen,c=e.goBack,l=(0,f.useRef)(!1),d=(0,f.useRef)(!0);return(0,f.useEffect)((function(){l.current&&t?(o("templates",!0),K(n,{initial:+d.current}).then((function(e){var t=(0,u.get)(e,"offset");a(Ze(Ze({},e),{},{offset:(0,u.isEmpty)(t)?"":t})),o("templates",!1),d.current&&(d.current=!1)})).catch((function(){a({records:[],offset:""}),o("templates",!1)}))):l.current=!0}),[n,t]),t?wp.element.createElement(g.Modal,{shouldCloseOnClickOutside:!1,icon:wp.element.createElement(g.Icon,{icon:"arrow-left-alt2",onClick:c,className:"etfy-back-button"}),title:(0,p.__)(wp.element.createElement(v,{icon:"library"})),className:"etfy-templates-library-modal-root ".concat("etfy-screen-".concat(s)),onRequestClose:r,closeLabel:(0,p.__)("close",m)},wp.element.createElement("div",{className:R()(et({"etfy-templates-library-modal":!0,"etfy-previewing-template":i()},"etfy-screen-".concat(s),!0))},wp.element.createElement(Ge,null),wp.element.createElement(Ke,null))):null}));function rt(e,t,r,n,a,o,i){try{var s=e[o](i),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,a)}function nt(e){return function(){var t=this,r=arguments;return new Promise((function(n,a){var o=e.apply(t,r);function i(e){rt(o,n,a,i,s,"next",e)}function s(e){rt(o,n,a,i,s,"throw",e)}i(void 0)}))}}window.wp.domReady((function(){var t,r=JSON.parse(window.sessionStorage.getItem("extendify-sdk-reload-session"));r&&(t=r,window._wpLoadBlockEditor.then((function(){var r;if(window.sessionStorage.removeItem("extendify-sdk-reload-session"),function(t){var r=(0,e.dispatch)("extendify-templates/data"),n=r.setSpecificState,a=r.setCurrentPreviewTemplate;n(t),a(null==t?void 0:t.currentPreviewTemplate)}(t),null!=t&&null!==(r=t.reloadRequirements)&&void 0!==r&&r.insertCurrentTemplate){var n=(0,e.dispatch)("extendify-templates/data"),a=n.setLibraryPreviewStatus,o=n.setImportsCount,i=(0,e.select)("extendify-templates/data").getCurrentImports;a(!1),setTimeout((function(){(null==t?void 0:t.currentPreviewTemplate)&&D(t.currentPreviewTemplate).then((function(){var t=(0,e.dispatch)("core/notices").createNotice,r=i()-1;o(r),localStorage.setItem("etfy__library_imports_left",r),t("info",(0,p.__)("Template Added"),{isDismissible:!0,type:"snackbar"})}))}),0)}})));var n=document.createElement("div");n.id="extendify-root",document.querySelector("#editor").insertAdjacentElement("afterend",n),(0,f.render)(wp.element.createElement(tt,null),n)}));var at={register:function(){var e=this;window.addEventListener("extendify-sdk::softerror-encountered",(function(t){e[(0,u.camelCase)(t.detail.type)](t.detail)}))},versionOutdated:function(e){(0,f.render)(wp.element.createElement(ie,{title:e.data.title,message:e.data.message,buttonLabel:e.data.buttonLabel,forceOpen:!0}),document.querySelector("#extendify-root")),window.addEventListener("extendfy::install-required-complete",nt(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return window.sessionStorage.removeItem("extendify-sdk-reload-session"),e.next=3,new Promise((function(e){return setTimeout(e,1500)}));case 3:(0,f.render)(wp.element.createElement(Se,null),document.querySelector("#extendify-root"));case 4:case"end":return e.stop()}}),e)}))))}};window.addEventListener("extendify-sdk::template-inserted",(function(e){var t;W(null===(t=e.detail)||void 0===t?void 0:t.template)})),at.register()})()})();
|
1 |
/*! For license information please see extendify-sdk.js.LICENSE.txt */
|
2 |
+
(()=>{var e={669:(e,t,r)=>{e.exports=r(609)},448:(e,t,r)=>{"use strict";var n=r(867),o=r(26),a=r(372),i=r(327),s=r(97),u=r(109),c=r(985),l=r(61);e.exports=function(e){return new Promise((function(t,r){var p=e.data,f=e.headers;n.isFormData(p)&&delete f["Content-Type"];var m=new XMLHttpRequest;if(e.auth){var d=e.auth.username||"",y=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";f.Authorization="Basic "+btoa(d+":"+y)}var h=s(e.baseURL,e.url);if(m.open(e.method.toUpperCase(),i(h,e.params,e.paramsSerializer),!0),m.timeout=e.timeout,m.onreadystatechange=function(){if(m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))){var n="getAllResponseHeaders"in m?u(m.getAllResponseHeaders()):null,a={data:e.responseType&&"text"!==e.responseType?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:n,config:e,request:m};o(t,r,a),m=null}},m.onabort=function(){m&&(r(l("Request aborted",e,"ECONNABORTED",m)),m=null)},m.onerror=function(){r(l("Network Error",e,null,m)),m=null},m.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(l(t,e,"ECONNABORTED",m)),m=null},n.isStandardBrowserEnv()){var v=(e.withCredentials||c(h))&&e.xsrfCookieName?a.read(e.xsrfCookieName):void 0;v&&(f[e.xsrfHeaderName]=v)}if("setRequestHeader"in m&&n.forEach(f,(function(e,t){void 0===p&&"content-type"===t.toLowerCase()?delete f[t]:m.setRequestHeader(t,e)})),n.isUndefined(e.withCredentials)||(m.withCredentials=!!e.withCredentials),e.responseType)try{m.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&m.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&m.upload&&m.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){m&&(m.abort(),r(e),m=null)})),p||(p=null),m.send(p)}))}},609:(e,t,r)=>{"use strict";var n=r(867),o=r(849),a=r(321),i=r(185);function s(e){var t=new a(e),r=o(a.prototype.request,t);return n.extend(r,a.prototype,t),n.extend(r,t),r}var u=s(r(655));u.Axios=a,u.create=function(e){return s(i(u.defaults,e))},u.Cancel=r(263),u.CancelToken=r(972),u.isCancel=r(502),u.all=function(e){return Promise.all(e)},u.spread=r(713),u.isAxiosError=r(268),e.exports=u,e.exports.default=u},263:e=>{"use strict";function t(e){this.message=e}t.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},t.prototype.__CANCEL__=!0,e.exports=t},972:(e,t,r)=>{"use strict";var n=r(263);function o(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;e((function(e){r.reason||(r.reason=new n(e),t(r.reason))}))}o.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},o.source=function(){var e;return{token:new o((function(t){e=t})),cancel:e}},e.exports=o},502:e=>{"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},321:(e,t,r)=>{"use strict";var n=r(867),o=r(327),a=r(782),i=r(572),s=r(185);function u(e){this.defaults=e,this.interceptors={request:new a,response:new a}}u.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=s(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[i,void 0],r=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)r=r.then(t.shift(),t.shift());return r},u.prototype.getUri=function(e){return e=s(this.defaults,e),o(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},n.forEach(["delete","get","head","options"],(function(e){u.prototype[e]=function(t,r){return this.request(s(r||{},{method:e,url:t,data:(r||{}).data}))}})),n.forEach(["post","put","patch"],(function(e){u.prototype[e]=function(t,r,n){return this.request(s(n||{},{method:e,url:t,data:r}))}})),e.exports=u},782:(e,t,r)=>{"use strict";var n=r(867);function o(){this.handlers=[]}o.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},o.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},o.prototype.forEach=function(e){n.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=o},97:(e,t,r)=>{"use strict";var n=r(793),o=r(303);e.exports=function(e,t){return e&&!n(t)?o(e,t):t}},61:(e,t,r)=>{"use strict";var n=r(481);e.exports=function(e,t,r,o,a){var i=new Error(e);return n(i,t,r,o,a)}},572:(e,t,r)=>{"use strict";var n=r(867),o=r(527),a=r(502),i=r(655);function s(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return s(e),e.headers=e.headers||{},e.data=o(e.data,e.headers,e.transformRequest),e.headers=n.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),n.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||i.adapter)(e).then((function(t){return s(e),t.data=o(t.data,t.headers,e.transformResponse),t}),(function(t){return a(t)||(s(e),t&&t.response&&(t.response.data=o(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},481:e=>{"use strict";e.exports=function(e,t,r,n,o){return e.config=t,r&&(e.code=r),e.request=n,e.response=o,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},185:(e,t,r)=>{"use strict";var n=r(867);e.exports=function(e,t){t=t||{};var r={},o=["url","method","data"],a=["headers","auth","proxy","params"],i=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],s=["validateStatus"];function u(e,t){return n.isPlainObject(e)&&n.isPlainObject(t)?n.merge(e,t):n.isPlainObject(t)?n.merge({},t):n.isArray(t)?t.slice():t}function c(o){n.isUndefined(t[o])?n.isUndefined(e[o])||(r[o]=u(void 0,e[o])):r[o]=u(e[o],t[o])}n.forEach(o,(function(e){n.isUndefined(t[e])||(r[e]=u(void 0,t[e]))})),n.forEach(a,c),n.forEach(i,(function(o){n.isUndefined(t[o])?n.isUndefined(e[o])||(r[o]=u(void 0,e[o])):r[o]=u(void 0,t[o])})),n.forEach(s,(function(n){n in t?r[n]=u(e[n],t[n]):n in e&&(r[n]=u(void 0,e[n]))}));var l=o.concat(a).concat(i).concat(s),p=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===l.indexOf(e)}));return n.forEach(p,c),r}},26:(e,t,r)=>{"use strict";var n=r(61);e.exports=function(e,t,r){var o=r.config.validateStatus;r.status&&o&&!o(r.status)?t(n("Request failed with status code "+r.status,r.config,null,r.request,r)):e(r)}},527:(e,t,r)=>{"use strict";var n=r(867);e.exports=function(e,t,r){return n.forEach(r,(function(r){e=r(e,t)})),e}},655:(e,t,r)=>{"use strict";var n=r(867),o=r(16),a={"Content-Type":"application/x-www-form-urlencoded"};function i(e,t){!n.isUndefined(e)&&n.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var s,u={adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(s=r(448)),s),transformRequest:[function(e,t){return o(t,"Accept"),o(t,"Content-Type"),n.isFormData(e)||n.isArrayBuffer(e)||n.isBuffer(e)||n.isStream(e)||n.isFile(e)||n.isBlob(e)?e:n.isArrayBufferView(e)?e.buffer:n.isURLSearchParams(e)?(i(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):n.isObject(e)?(i(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};n.forEach(["delete","get","head"],(function(e){u.headers[e]={}})),n.forEach(["post","put","patch"],(function(e){u.headers[e]=n.merge(a)})),e.exports=u},849:e=>{"use strict";e.exports=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return e.apply(t,r)}}},327:(e,t,r)=>{"use strict";var n=r(867);function o(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,r){if(!t)return e;var a;if(r)a=r(t);else if(n.isURLSearchParams(t))a=t.toString();else{var i=[];n.forEach(t,(function(e,t){null!=e&&(n.isArray(e)?t+="[]":e=[e],n.forEach(e,(function(e){n.isDate(e)?e=e.toISOString():n.isObject(e)&&(e=JSON.stringify(e)),i.push(o(t)+"="+o(e))})))})),a=i.join("&")}if(a){var s=e.indexOf("#");-1!==s&&(e=e.slice(0,s)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}},303:e=>{"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},372:(e,t,r)=>{"use strict";var n=r(867);e.exports=n.isStandardBrowserEnv()?{write:function(e,t,r,o,a,i){var s=[];s.push(e+"="+encodeURIComponent(t)),n.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),n.isString(o)&&s.push("path="+o),n.isString(a)&&s.push("domain="+a),!0===i&&s.push("secure"),document.cookie=s.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},793:e=>{"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},268:e=>{"use strict";e.exports=function(e){return"object"==typeof e&&!0===e.isAxiosError}},985:(e,t,r)=>{"use strict";var n=r(867);e.exports=n.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function o(e){var n=e;return t&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=o(window.location.href),function(t){var r=n.isString(t)?o(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0}},16:(e,t,r)=>{"use strict";var n=r(867);e.exports=function(e,t){n.forEach(e,(function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])}))}},109:(e,t,r)=>{"use strict";var n=r(867),o=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,r,a,i={};return e?(n.forEach(e.split("\n"),(function(e){if(a=e.indexOf(":"),t=n.trim(e.substr(0,a)).toLowerCase(),r=n.trim(e.substr(a+1)),t){if(i[t]&&o.indexOf(t)>=0)return;i[t]="set-cookie"===t?(i[t]?i[t]:[]).concat([r]):i[t]?i[t]+", "+r:r}})),i):i}},713:e=>{"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},867:(e,t,r)=>{"use strict";var n=r(849),o=Object.prototype.toString;function a(e){return"[object Array]"===o.call(e)}function i(e){return void 0===e}function s(e){return null!==e&&"object"==typeof e}function u(e){if("[object Object]"!==o.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function c(e){return"[object Function]"===o.call(e)}function l(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),a(e))for(var r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(null,e[o],o,e)}e.exports={isArray:a,isArrayBuffer:function(e){return"[object ArrayBuffer]"===o.call(e)},isBuffer:function(e){return null!==e&&!i(e)&&null!==e.constructor&&!i(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:s,isPlainObject:u,isUndefined:i,isDate:function(e){return"[object Date]"===o.call(e)},isFile:function(e){return"[object File]"===o.call(e)},isBlob:function(e){return"[object Blob]"===o.call(e)},isFunction:c,isStream:function(e){return s(e)&&c(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:l,merge:function e(){var t={};function r(r,n){u(t[n])&&u(r)?t[n]=e(t[n],r):u(r)?t[n]=e({},r):a(r)?t[n]=r.slice():t[n]=r}for(var n=0,o=arguments.length;n<o;n++)l(arguments[n],r);return t},extend:function(e,t,r){return l(t,(function(t,o){e[o]=r&&"function"==typeof t?n(t,r):t})),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}}},184:(e,t)=>{var r;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var a=typeof r;if("string"===a||"number"===a)e.push(r);else if(Array.isArray(r)&&r.length){var i=o.apply(null,r);i&&e.push(i)}else if("object"===a)for(var s in r)n.call(r,s)&&r[s]&&e.push(s)}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var a=t[n]={exports:{}};return e[n](a,a.exports,r),a.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";const e=wp.data;var t,n;function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var s={previewStatus:!1,entryPoint:"",templates:{loading:!1,error:!1,records:[],offset:""},templateTypes:["pattern","template"],templateFilters:{categories:[],type:"pattern",search:""},currentPreviewTemplate:{},currentScreen:"menu",reloadRequirements:{required:!1,insertCurrentTemplate:!1},apiKey:null!==(t=localStorage.getItem("etfy_library__key"))&&void 0!==t?t:"",maxImports:3,currentImports:null!==(n=localStorage.getItem("etfy__library_imports_left"))&&void 0!==n?n:3};const u=lodash;var c={reducer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:s,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SET_LIBRARY_PREVIEW_STATUS":return a(a({},e),{},{previewStatus:t.status});case"SET_TEMPLATES":return a(a({},e),{},{templates:a(a({},e.templates),t.templates)});case"SET_PREVIEW_TEMPLATE":return a(a({},e),{},{currentPreviewTemplate:t.template});case"SET_FILTERS":return a(a({},e),{},{templateFilters:a(a({},e.templateFilters),t.filters)});case"SET_LOADING_STATUS":switch(t.key){case"templates":return a(a({},e),{},{templates:a(a({},e.templates),{},{loading:t.status})})}break;case"SET_SCREEN":return a(a({},e),{},{currentScreen:t.screen});case"SET_RELOAD_REQUIREMENTS":return a(a({},e),{},{reloadRequirements:t.reload});case"SET_KEY":return a(a({},e),{},{apiKey:t.key});case"SET_STATE":return t.state;case"SET_IMPORTS":return a(a({},e),{},{currentImports:t.imports});case"SET_ENTRY_POINT":return a(a({},e),{},{entryPoint:t.entryPoint});default:return e}},actions:{setLibraryPreviewStatus:function(e){return{type:"SET_LIBRARY_PREVIEW_STATUS",status:e}},setTemplates:function(e){return{type:"SET_TEMPLATES",templates:e}},setLoadingStatus:function(e,t){return{type:"SET_LOADING_STATUS",key:e,status:t}},setCurrentPreviewTemplate:function(e){return{type:"SET_PREVIEW_TEMPLATE",template:e}},setFilters:function(e){return{type:"SET_FILTERS",filters:e}},setLastAppliedFilters:function(e){return{type:"SET_LAST_APPLIED_FILTERS",filters:e}},setCurrentScreen:function(e){return{type:"SET_SCREEN",screen:e}},setReloadRequirements:function(e){return{type:"SET_RELOAD_REQUIREMENTS",reload:e}},setSpecificState:function(e){return{type:"SET_STATE",state:e}},setApiKey:function(e){return{type:"SET_KEY",key:e}},setImportsCount:function(e){return{type:"SET_IMPORTS",imports:e}},setEntryPoint:function(e){return{type:"SET_ENTRY_POINT",entryPoint:e}}},selectors:{getLibraryPreviewStatus:function(e){return(0,u.get)(e,"previewStatus")},getTemplates:function(e){return(0,u.get)(e,"templates")},getLoadingStatus:function(e,t){switch(t){case"templates":return(0,u.get)(e,"templates.loading");default:return!1}},getTemplateTypes:function(e){return(0,u.get)(e,"templateTypes")},getAppliedFilter:function(e,t){if((0,u.isString)(t)){var r=(0,u.get)(e,"templateFilters");return!!(0,u.has)(r,t)&&(0,u.get)(r,t)}},getAppliedFilters:function(e){return(0,u.get)(e,"templateFilters")},getCurrentPreviewTemplate:function(e){return(0,u.get)(e,"currentPreviewTemplate")},getCurrentScreen:function(e){return(0,u.get)(e,"currentScreen")},getApiKey:function(e){return(0,u.get)(e,"apiKey")},getEntryPoint:function(e){return(0,u.get)(e,"entryPoint")},getCurrentImports:function(e){return(0,u.get)(e,"currentImports")},getMaxImports:function(e){return(0,u.get)(e,"maxImports")},getAuthenticationStatus:function(e){return!!(0,u.get)(e,"apiKey")}},resolvers:{},controls:{}};const l=(0,e.registerStore)("extendify-templates/data",c),p=wp.i18n,f=wp.compose,m=wp.components,d=wp.element;var y="extendify-templates-inserter";function h(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function g(e){return function(e){if(Array.isArray(e))return v(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return v(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?v(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function w(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(!e){if("undefined"==typeof window)return!1;e=window}var t=e.navigator.platform;return-1!==t.indexOf("Mac")||(0,u.includes)(["iPad","iPhone"],t)}var b="alt",E="ctrl",S="meta",x="shift",_={primary:function(e){return e()?[S]:[E]},primaryShift:function(e){return e()?[x,S]:[E,x]},primaryAlt:function(e){return e()?[b,S]:[E,b]},secondary:function(e){return e()?[x,b,S]:[E,x,b]},access:function(e){return e()?[E,b]:[x,b]},ctrl:function(){return[E]},alt:function(){return[b]},ctrlShift:function(){return[E,x]},shift:function(){return[x]},shiftAlt:function(){return[x,b]}},P=((0,u.mapValues)(_,(function(e){return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:w;return[].concat(g(e(r)),[t.toLowerCase()]).join("+")}})),(0,u.mapValues)(_,(function(e){return function(t){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:w,o=n(),a=(h(r={},b,o?"⌥":"Alt"),h(r,E,o?"⌃":"Ctrl"),h(r,S,"⌘"),h(r,x,o?"⇧":"Shift"),r),i=e(n).reduce((function(e,t){var r=(0,u.get)(a,t,t);return[].concat(g(e),o?[r]:[r,"+"])}),[]),s=(0,u.capitalize)(t);return[].concat(g(i),[s])}})));function T(e){return[b,E,S,x].filter((function(t){return e["".concat(t,"Key")]}))}(0,u.mapValues)(P,(function(e){return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:w;return e(t,r).join("")}})),(0,u.mapValues)(_,(function(e){return function(t){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:w,o=n(),a=(h(r={},x,"Shift"),h(r,S,o?"Command":"Control"),h(r,E,"Control"),h(r,b,o?"Option":"Alt"),h(r,",",(0,p.__)("Comma")),h(r,".",(0,p.__)("Period")),h(r,"`",(0,p.__)("Backtick")),r);return[].concat(g(e(n)),[t]).map((function(e){return(0,u.capitalize)((0,u.get)(a,e,e))})).join(o?" ":" + ")}})),(0,u.mapValues)(_,(function(e){return function(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:w,o=e(n),a=T(t);return!(0,u.xor)(o,a).length&&(r?t.key===r:(0,u.includes)(o,t.key.toLowerCase()))}}));var A=r(184),k=r.n(A);const O=(0,f.compose)([(0,e.withSelect)((function(e,t){var r=t.template;return{shortCode:(0,u.get)(r,"fields.code"),currentType:(0,e("extendify-templates/data").getAppliedFilter)("type")}})),(0,e.withDispatch)((function(e,t){var r=t.template,n=e("extendify-templates/data"),o=n.setCurrentPreviewTemplate,a=n.setCurrentScreen;return{onSelect:function(){o(r),a("single-template")}}}))])((function(e){var t,r,n=e.template,o=e.onSelect,a=e.currentType,i=[(0,u.get)(n,"fields.screenshot[0].url"),(0,u.get)(n,"fields.title"),(0,u.get)(n,"fields.categories")],s=i[0],c=i[1],l=i[2],p=k()((t={"etfy-template":!0},!0,(r="etfy-type-".concat(a))in t?Object.defineProperty(t,r,{value:true,enumerable:!0,configurable:!0,writable:!0}):t[r]=true,t));return wp.element.createElement(m.TabbableContainer,{tabIndex:"0","aria-pressed":"false",onClick:o,onKeyDown:function(e){return(0,u.isEqual)(e.keyCode,13)&&o()},className:"etfy-template-main"},wp.element.createElement(m.Card,{className:p},wp.element.createElement(m.CardMedia,{className:"etfy-template-media",style:{backgroundImage:"url(".concat(s,")")}})),wp.element.createElement("div",{className:"etfy-template-body"},wp.element.createElement("h2",null,c),wp.element.createElement("span",null,l.join(", "))))}));function C(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{n||null==s.return||s.return()}finally{if(o)throw a}}return r}}(e,t)||function(e,t){if(e){if("string"==typeof e)return R(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?R(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function R(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function j(e){var t=(0,u.get)(e,"categories"),r=(0,u.get)(e,"search"),n=(0,u.get)(e,"type"),o=(0,u.isEmpty)(t)?"TRUE()":t.map((function(e){return'SEARCH("'.concat(e,'", {categories}) = 1')})).join(","),a=(0,u.isEmpty)(r)?"TRUE()":'OR(FIND(LOWER("'.concat(r,'"), LOWER(title)) != 0, FIND(LOWER("').concat(r,'"), LOWER({categories})) != 0)'),i=(0,u.isEmpty)(n)?"TRUE()":'{type}="'.concat(n,'"'),s="IF(AND(".concat(o,", ").concat(a,", ").concat(i,"), TRUE())");return(0,u.isEmpty)(a)&&(0,u.isEmpty)(i)&&(0,u.isEmpty)(o)&&(s=""),s.replace(/\r?\n|\r/g,"")}function I(e,t){return!(!(0,u.isString)(e)||!(0,u.isString)(t))&&(e=(0,u.toLower)(e),-1!==(t=(0,u.toLower)(t)).indexOf(e))}function N(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=window.wp.blocks.createBlock;return e.map((function(e){var r=C(Array.isArray(e)?e:[e.name,e.attributes,e.innerBlocks],3),n=r[0],o=r[1],a=r[2];return t(n,o,N(void 0===a?[]:a))}))}function L(t){if(!t)throw Error("Template not found");return(0,(0,e.dispatch)("core/block-editor").insertBlocks)(N((0,window.wp.blocks.parse)((0,u.get)(t,"fields.code")))).then((function(){window.dispatchEvent(new CustomEvent("extendify-sdk::template-inserted",{detail:{template:t},bubbles:!0}))}))}var q=r(669);function B(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function D(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const F=function(e,t){return z.post("templates",function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?B(Object(r),!0).forEach((function(t){D(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):B(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({filterByFormula:j(e),pageSize:9,categories:(0,u.get)(e,"categories"),search:(0,u.get)(e,"search"),type:(0,u.get)(e,"type")},t))},M=function(e){var t;return z.post("templates/".concat(e.id),{template_id:e.id,pageSize:9,template_name:null===(t=e.fields)||void 0===t?void 0:t.title})},U=function(){return z.get("plugins")},K=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=new FormData;return t.append("plugins",JSON.stringify(e)),z.post("plugins",t,{headers:{"Content-Type":"multipart/form-data"}})},W=function(){return z.get("active-plugins")},$=function(){return z.get("categories")};var z=r.n(q)().create({baseURL:window.extendifySdkData.root,headers:{"X-WP-Nonce":window.extendifySdkData.nonce,"X-Requested-With":"XMLHttpRequest","X-Extendify":!0}});function H(e){return Object.prototype.hasOwnProperty.call(e,"data")?e.data:e}function V(e,t,r,n,o,a,i){try{var s=e[a](i),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,o)}function Y(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){V(a,n,o,i,s,"next",e)}function s(e){V(a,n,o,i,s,"throw",e)}i(void 0)}))}}function X(e){return J.apply(this,arguments)}function J(){return(J=Y(regeneratorRuntime.mark((function t(r){var n,o,a,i;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if((o=null!==(n=(0,u.get)(r,"fields.required_plugins"))&&void 0!==n?n:[]).length){t.next=3;break}return t.abrupt("return",!1);case 3:return t.t0=Object,t.next=6,U();case 6:return t.t1=t.sent,a=t.t0.keys.call(t.t0,t.t1),i=!!o.length&&o.filter((function(e){return!a.some((function(t){return t.includes(e)}))})),(0,(0,e.dispatch)("extendify-templates/data").setReloadRequirements)({required:+i.length}),t.abrupt("return",i.length);case 12:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function G(e){return Q.apply(this,arguments)}function Q(){return(Q=Y(regeneratorRuntime.mark((function t(r){var n,o,a,i;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if((o=null!==(n=(0,u.get)(r,"fields.required_plugins"))&&void 0!==n?n:[]).length){t.next=3;break}return t.abrupt("return",!1);case 3:return t.t0=Object,t.next=6,W();case 6:if(t.t1=t.sent,a=t.t0.values.call(t.t0,t.t1),!(i=!!o.length&&o.filter((function(e){return!a.some((function(t){return t.includes(e)}))})))){t.next=14;break}return t.next=12,X(r);case 12:if(!t.sent){t.next=14;break}return t.abrupt("return",!1);case 14:return(0,(0,e.dispatch)("extendify-templates/data").setReloadRequirements)({required:+i.length}),t.abrupt("return",i.length);case 17:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function Z(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}z.interceptors.response.use((function(e){return function(e){return Object.prototype.hasOwnProperty.call(e,"soft_error")&&window.dispatchEvent(new CustomEvent("extendify-sdk::softerror-encountered",{detail:e.soft_error,bubbles:!0})),e}(H(e))}),(function(e){return function(e){return console.error(e.response),Promise.reject(H(e.response))}(e)})),z.interceptors.request.use((function(e){return function(e){return e.headers["X-Extendify-Dev-Mode"]=window.location.search.indexOf("DEVMODE")>-1,e}(function(e){var t=window.wp.data.select("extendify-templates/data"),r=t.getCurrentImports,n=t.getEntryPoint;return e.data&&(e.data.remaining_imports=r(),e.data.entry_point=n()),e}(e))}),(function(e){return e}));var ee=function(){var e,t,r,n,o=(r=(0,d.useState)(""),n=2,function(e){if(Array.isArray(e))return e}(r)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{n||null==s.return||s.return()}finally{if(o)throw a}}return r}}(r,n)||function(e,t){if(e){if("string"==typeof e)return Z(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Z(e,t):void 0}}(r,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),a=o[0],i=o[1],s=l.getState();return delete s.templates,(0,d.useEffect)((function(){s.reloadRequirements.insertCurrentTemplate=1;var e=a.length?null:JSON.stringify(s);window.sessionStorage.setItem("extendify-sdk-reload-session",e)}),[a,s]),K(null==s||null===(e=s.currentPreviewTemplate)||void 0===e||null===(t=e.fields)||void 0===t?void 0:t.required_plugins).then((function(){window.dispatchEvent(new CustomEvent("extendfy::install-required-complete"))})).catch((function(e){var t=e.response;i(t.data.message)})),a?wp.element.createElement(React.Fragment,null,wp.element.createElement(m.Modal,{style:{maxWidth:"500px"},title:(0,p.__)("Error installing plugins",y),isDismissible:!1},(0,p.__)("You have encountered an error that we cannot recover from. Please try again.",y),wp.element.createElement("br",null),wp.element.createElement(m.Notice,{isDismissible:!1,status:"error"},a),wp.element.createElement(m.Button,{isPrimary:!0,onClick:function(){(0,d.render)(wp.element.createElement(ne,{previousState:s}),document.querySelector("#extendify-root"))}},(0,p.__)("Go back",y)))):wp.element.createElement(React.Fragment,null,wp.element.createElement(m.Modal,{title:(0,p.__)("Installing plugins",y),isDismissible:!1},wp.element.createElement(m.Button,{style:{width:"100%"},disabled:!0,isPrimary:!0,isBusy:!0,onClick:function(){}},(0,p.__)("Installing...",y))))};function te(e,t,r,n,o,a,i){try{var s=e[a](i),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,o)}function re(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var ne=function(t){var r,n,o,a,i,s,u,c,l,f,h=(0,e.dispatch)("extendify-templates/data"),v=h.setSpecificState,g=h.setCurrentPreviewTemplate,w=(0,e.select)("extendify-templates/data").getCurrentPreviewTemplate,b=(l=(0,d.useState)(!0),f=2,function(e){if(Array.isArray(e))return e}(l)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{n||null==s.return||s.return()}finally{if(o)throw a}}return r}}(l,f)||function(e,t){if(e){if("string"==typeof e)return re(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?re(e,t):void 0}}(l,f)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),E=b[0],S=b[1],x=w(),_=function(){t.forceOpen||(S(!1),t.previousState&&(v(t.previousState),g(x)),(0,d.render)(wp.element.createElement(Ze,null),document.querySelector("#extendify-root")))},P=function(){var e,t=(e=regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:S(!1),(0,d.render)(wp.element.createElement(ee,null),document.querySelector("#extendify-root"));case 2:case"end":return e.stop()}}),e)})),function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){te(a,n,o,i,s,"next",e)}function s(e){te(a,n,o,i,s,"throw",e)}i(void 0)}))});return function(){return t.apply(this,arguments)}}(),T=null!==(r=null===(n=t.previousState)||void 0===n||null===(o=n.currentPreviewTemplate)||void 0===o||null===(a=o.fields)||void 0===a?void 0:a.type)&&void 0!==r?r:"template";return wp.element.createElement(React.Fragment,null,E&&wp.element.createElement(m.Modal,{title:null!==(i=t.title)&&void 0!==i?i:(0,p.__)("Install required plugins",y),closeButtonLabel:(0,p.__)("No thanks, take me back",y),onRequestClose:_},wp.element.createElement("p",{style:{maxWidth:"400px"}},null!==(s=t.message)&&void 0!==s?s:(0,p.__)((0,p.sprintf)("There is just one more step. This %s requires the following to be automatically installed:",T),y)),(null===(u=t.message)||void 0===u?void 0:u.length)>0||wp.element.createElement("ul",null,wp.element.createElement("li",null,"Editor Plus")),wp.element.createElement(m.ButtonGroup,null,wp.element.createElement(m.Button,{isPrimary:!0,onClick:P},null!==(c=t.buttonLabel)&&void 0!==c?c:(0,p.__)("Install Plugins",y)),t.forceOpen||wp.element.createElement(m.Button,{isTertiary:!0,onClick:_,style:{boxShadow:"none",margin:"0 4px"}},(0,p.__)("No thanks, take me back",y)))))};function oe(e,t,r,n,o,a,i){try{var s=e[a](i),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,o)}function ae(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){oe(a,n,o,i,s,"next",e)}function s(e){oe(a,n,o,i,s,"throw",e)}i(void 0)}))}}var ie=function(){var e=ae(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=l.getState(),e.next=3,X(t);case 3:return e.t0=!e.sent,e.t1=function(){return ae(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)})))()},e.t2=function(){return ae(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){(0,d.render)(wp.element.createElement(ne,{previousState:r}),document.querySelector("#extendify-root")),window.addEventListener("extendfy::install-required-complete",(function(){e()}))})));case 1:case"end":return e.stop()}}),e)})))()},e.abrupt("return",{id:"hasRequiredPlugins",pass:e.t0,allow:e.t1,deny:e.t2});case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();function se(e,t,r,n,o,a,i){try{var s=e[a](i),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,o)}function ue(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){se(a,n,o,i,s,"next",e)}function s(e){se(a,n,o,i,s,"throw",e)}i(void 0)}))}}function ce(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var le=function(){var e,t,r,n,o=(r=(0,d.useState)(""),n=2,function(e){if(Array.isArray(e))return e}(r)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{n||null==s.return||s.return()}finally{if(o)throw a}}return r}}(r,n)||function(e,t){if(e){if("string"==typeof e)return ce(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ce(e,t):void 0}}(r,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),a=o[0],i=o[1],s=l.getState();return delete s.templates,(0,d.useEffect)((function(){s.reloadRequirements.insertCurrentTemplate=1;var e=a.length?null:JSON.stringify(s);window.sessionStorage.setItem("extendify-sdk-reload-session",e)}),[a,s]),K(null==s||null===(e=s.currentPreviewTemplate)||void 0===e||null===(t=e.fields)||void 0===t?void 0:t.required_plugins).then(ue(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,new Promise((function(e){return setTimeout(e,1500)}));case 2:window.dispatchEvent(new CustomEvent("extendfy::activate-required-complete"));case 3:case"end":return e.stop()}}),e)})))).catch((function(e){var t=e.response;i(t.data.message)})),a?wp.element.createElement(React.Fragment,null,wp.element.createElement(m.Modal,{style:{maxWidth:"500px"},title:(0,p.__)("Error Activating plugins",y),isDismissible:!1},(0,p.__)("You have encountered an error that we cannot recover from. Please try again.",y),wp.element.createElement("br",null),wp.element.createElement(m.Notice,{isDismissible:!1,status:"error"},a),wp.element.createElement(m.Button,{isPrimary:!0,onClick:function(){(0,d.render)(wp.element.createElement(me,{previousState:s}),document.querySelector("#extendify-root"))}},(0,p.__)("Go back",y)))):wp.element.createElement(React.Fragment,null,wp.element.createElement(m.Modal,{title:(0,p.__)("Activating plugins",y),isDismissible:!1},wp.element.createElement(m.Button,{style:{width:"100%"},disabled:!0,isPrimary:!0,isBusy:!0,onClick:function(){}},(0,p.__)("Activating...",y))))};function pe(e,t,r,n,o,a,i){try{var s=e[a](i),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,o)}function fe(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var me=function(t){var r,n,o,a,i,s,u,c=(0,e.dispatch)("extendify-templates/data"),l=c.setSpecificState,f=c.setCurrentPreviewTemplate,h=(0,e.select)("extendify-templates/data").getCurrentPreviewTemplate,v=(s=(0,d.useState)(!0),u=2,function(e){if(Array.isArray(e))return e}(s)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{n||null==s.return||s.return()}finally{if(o)throw a}}return r}}(s,u)||function(e,t){if(e){if("string"==typeof e)return fe(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?fe(e,t):void 0}}(s,u)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),g=v[0],w=v[1],b=h(),E=function(){w(!1),l(t.previousState),f(b),(0,d.render)(wp.element.createElement(Ze,null),document.querySelector("#extendify-root"))},S=function(){var e,t=(e=regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:w(!1),(0,d.render)(wp.element.createElement(le,null),document.querySelector("#extendify-root"));case 2:case"end":return e.stop()}}),e)})),function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){pe(a,n,o,i,s,"next",e)}function s(e){pe(a,n,o,i,s,"throw",e)}i(void 0)}))});return function(){return t.apply(this,arguments)}}(),x=null!==(r=null===(n=t.previousState)||void 0===n||null===(o=n.currentPreviewTemplate)||void 0===o||null===(a=o.fields)||void 0===a?void 0:a.type)&&void 0!==r?r:"template";return wp.element.createElement(React.Fragment,null,g&&wp.element.createElement(m.Modal,{title:(0,p.__)("Activate required plugins",y),closeButtonLabel:(0,p.__)("No thanks, return to library",y),onRequestClose:E},wp.element.createElement("p",{style:{maxWidth:"400px"}},null!==(i=t.message)&&void 0!==i?i:(0,p.__)((0,p.sprintf)("There is just one more step. This %s requires the following plugins to be activated:",x),y)),wp.element.createElement("ul",null,wp.element.createElement("li",null,"Editor Plus")),wp.element.createElement(m.ButtonGroup,null,wp.element.createElement(m.Button,{isPrimary:!0,onClick:S},(0,p.__)("Activate Plugins",y)),t.showClose&&wp.element.createElement(m.Button,{isTertiary:!0,onClick:E,style:{boxShadow:"none",margin:"0 4px"}},(0,p.__)("No thanks, return to library",y)))))};function de(e,t,r,n,o,a,i){try{var s=e[a](i),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,o)}function ye(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){de(a,n,o,i,s,"next",e)}function s(e){de(a,n,o,i,s,"throw",e)}i(void 0)}))}}var he=function(){var e=ye(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=l.getState(),e.next=3,G(t);case 3:return e.t0=!e.sent,e.t1=function(){return ye(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)})))()},e.t2=function(){return ye(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){(0,d.render)(wp.element.createElement(me,{previousState:r,showClose:!0}),document.querySelector("#extendify-root")),window.addEventListener("extendfy::activate-required-complete",(function(){e()}))})));case 1:case"end":return e.stop()}}),e)})))()},e.abrupt("return",{id:"hasPluginsActivated",pass:e.t0,allow:e.t1,deny:e.t2});case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();function ve(e,t,r,n,o,a,i){try{var s=e[a](i),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,o)}function ge(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var we=function(){var t,r,n=(t=(0,d.useState)(!1),r=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{n||null==s.return||s.return()}finally{if(o)throw a}}return r}}(t,r)||function(e,t){if(e){if("string"==typeof e)return ge(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ge(e,t):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=n[0],a=n[1],i=(0,(0,e.select)("core/editor").isEditedPostDirty)(),s=function(){var t,r=(t=regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a(!0),t.next=3,(0,e.dispatch)("core/editor").savePost();case 3:a(!1);case 4:case"end":return t.stop()}}),t)})),function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function i(e){ve(a,n,o,i,s,"next",e)}function s(e){ve(a,n,o,i,s,"throw",e)}i(void 0)}))});return function(){return r.apply(this,arguments)}}(),u=function(){location.reload()};return i?wp.element.createElement(React.Fragment,null,wp.element.createElement(m.Modal,{title:(0,p.__)("Reload required",y),isDismissible:!1},wp.element.createElement("p",{style:{maxWidth:"400px"}},(0,p.__)("Just one more thing! We need to reload the page to continue.",y)),wp.element.createElement(m.ButtonGroup,null,wp.element.createElement(m.Button,{isPrimary:!0,onClick:u,disabled:o},(0,p.__)("Reload page",y)),wp.element.createElement(m.Button,{isSecondary:!0,onClick:s,isBusy:o,style:{margin:"0 4px"}},(0,p.__)("Save changes",y))))):(u(),null)};function be(e,t,r,n,o,a,i){try{var s=e[a](i),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,o)}function Ee(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){be(a,n,o,i,s,"next",e)}function s(e){be(a,n,o,i,s,"throw",e)}i(void 0)}))}}var Se=function(){var e=Ee(regeneratorRuntime.mark((function e(){var t,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=l.getState(),e.abrupt("return",{id:"needsPageReload",pass:!(null!=r&&null!==(t=r.reloadRequirements)&&void 0!==t&&t.required),allow:function(){return Ee(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)})))()},deny:function(){return Ee(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(){(0,d.render)(wp.element.createElement(we,null),document.querySelector("#extendify-root"))})));case 1:case"end":return e.stop()}}),e)})))()}});case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();function xe(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return _e(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_e(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return i=e.done,e},e:function(e){s=!0,a=e},f:function(){try{i||null==r.return||r.return()}finally{if(s)throw a}}}}function _e(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Pe(e,t,r,n,o,a,i){try{var s=e[a](i),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,o)}function Te(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){Pe(a,n,o,i,s,"next",e)}function s(e){Pe(a,n,o,i,s,"throw",e)}i(void 0)}))}}function Ae(e){return function(){return new ke(e.apply(this,arguments))}}function ke(e){var t,r;function n(t,r){try{var a=e[t](r),i=a.value,s=i instanceof Oe;Promise.resolve(s?i.wrapped:i).then((function(e){s?n("return"===t?"return":"next",e):o(a.done?"return":"normal",e)}),(function(e){n("throw",e)}))}catch(e){o("throw",e)}}function o(e,o){switch(e){case"return":t.resolve({value:o,done:!0});break;case"throw":t.reject(o);break;default:t.resolve({value:o,done:!1})}(t=t.next)?n(t.key,t.arg):r=null}this._invoke=function(e,o){return new Promise((function(a,i){var s={key:e,arg:o,resolve:a,reject:i,next:null};r?r=r.next=s:(t=r=s,n(e,o))}))},"function"!=typeof e.return&&(this.return=void 0)}function Oe(e){this.wrapped=e}function Ce(){return(Ce=Te(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=Re(t);case 1:return e.next=4,r.next();case 4:if(!e.sent.done){e.next=7;break}return e.abrupt("break",9);case 7:e.next=1;break;case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Re(e){return je.apply(this,arguments)}function je(){return(je=Ae(regeneratorRuntime.mark((function e(t){var r,n,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=xe(t),e.prev=1,r.s();case 3:if((n=r.n()).done){e.next=9;break}return o=n.value,e.next=7,o();case 7:e.next=3;break;case 9:e.next=14;break;case 11:e.prev=11,e.t0=e.catch(1),r.e(e.t0);case 14:return e.prev=14,r.f(),e.finish(14);case 17:case"end":return e.stop()}}),e,null,[[1,11,14,17]])})))).apply(this,arguments)}function Ie(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}"function"==typeof Symbol&&Symbol.asyncIterator&&(ke.prototype[Symbol.asyncIterator]=function(){return this}),ke.prototype.next=function(e){return this._invoke("next",e)},ke.prototype.throw=function(e){return this._invoke("throw",e)},ke.prototype.return=function(e){return this._invoke("return",e)};const Ne=(0,f.compose)([(0,f.withState)({restrictions:[]}),(0,e.withSelect)((function(e){var t=e("extendify-templates/data"),r=t.getCurrentPreviewTemplate,n=t.getAppliedFilter,o=t.getCurrentImports,a=t.getMaxImports,i=t.getAuthenticationStatus,s=e("core/editor").getEditedPostAttribute,c=r(),l=(0,u.get)(c,"fields.code");return{template:r(),currentCategory:n("categories"),shortCode:l,postMeta:s("meta"),currentImports:o(),maxImports:a(),isAuthenticated:i()}})),(0,e.withDispatch)((function(e,t){var r=t.currentCategory,n=t.template,o=t.currentImports,a=t.restrictions,i=e("extendify-templates/data"),s=i.setFilters,c=i.setCurrentScreen,l=i.setCurrentPreviewTemplate,f=i.setLibraryPreviewStatus,m=i.setImportsCount;return{onImport:function(){(function(e){return Ce.apply(this,arguments)})(a).then((function(){f(!1),L(n).then((function(){var t=e("core/notices").createNotice,r=o-1;m(r),localStorage.setItem("etfy__library_imports_left",r),t("info",(0,p.__)("Template Added"),{isDismissible:!0,type:"snackbar"})}))}))},applyCategory:function(e){(0,u.isEqual)(e,(0,u.head)(r))||s({categories:[e]}),l({}),c("templates")}}}))])((function(t){var r,n,o=t.template,a=t.onImport,i=t.applyCategory,s=t.setState,c=t.currentImports,l=t.isAuthenticated,f=[(0,u.get)(o,"fields.screenshot[0].url"),(0,u.get)(o,"fields.title"),(0,u.get)(o,"fields.categories"),(0,u.get)(o,"fields.required_plugins",[])],h=f[0],v=f[1],g=f[2],w=f[3],b=0<c,E=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return{hasRequiredPlugins:ie,hasPluginsActivated:he,needsPageReload:Se,stack:[],check:function(e){var r=this;return Te(regeneratorRuntime.mark((function n(){var o,a,i;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:o=xe(t),n.prev=1,i=regeneratorRuntime.mark((function t(){var n,o;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=a.value,t.next=3,r["".concat(n)](e);case 3:o=t.sent,setTimeout((function(){r.stack.push(o.pass?o.allow:o.deny)}),0);case 5:case"end":return t.stop()}}),t)})),o.s();case 4:if((a=o.n()).done){n.next=8;break}return n.delegateYield(i(),"t0",6);case 6:n.next=4;break;case 8:n.next=13;break;case 10:n.prev=10,n.t1=n.catch(1),o.e(n.t1);case 13:return n.prev=13,o.f(),n.finish(13);case 16:case"end":return n.stop()}}),n,null,[[1,10,13,16]])})))()},reset:function(){this.stack=[],(0,(0,e.dispatch)("extendify-templates/data").setReloadRequirements)({required:0})}}}(["hasRequiredPlugins","hasPluginsActivated","needsPageReload"]),S=(r=(0,d.useState)(!1),n=2,function(e){if(Array.isArray(e))return e}(r)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{n||null==s.return||s.return()}finally{if(o)throw a}}return r}}(r,n)||function(e,t){if(e){if("string"==typeof e)return Ie(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ie(e,t):void 0}}(r,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),x=S[0],_=S[1];return(0,d.useEffect)((function(){return E.check(o).then((function(){s({restrictions:E.stack}),_(!0)})),function(){E.reset(),_(!1)}}),[o]),o?wp.element.createElement("div",{className:"etfy-template-preview"},wp.element.createElement("div",{className:"etfy-template-media"},wp.element.createElement("img",{src:h})),wp.element.createElement("div",{className:"etfy-template-details"},x?wp.element.createElement(React.Fragment,null,!b&&!l&&wp.element.createElement(m.Button,{className:"etfy-upgrade-btn",href:"https://extendify.com/?utm_source=sdk&utm_medium=free_beta_2&utm_campaign=sdk_ref",target:"__blank"},(0,p.__)("Sign up for free to add",y)),(l||b)&&wp.element.createElement(m.Button,{isPrimary:!0,onClick:a},(0,p.__)("Add",y))):wp.element.createElement(m.Button,{disabled:!0},(0,p.__)("Loading...",y)),wp.element.createElement("div",null,wp.element.createElement("h2",{className:"etfy-template-title"},v),wp.element.createElement("div",{className:"etfy-template-categories"},(0,u.map)(g,(function(e,t){return wp.element.createElement(m.Button,{isLink:!0,key:t,className:"etfy-template-category",onClick:function(){return i(e)}},(0,p.__)(e,y))}))),w.length?wp.element.createElement(React.Fragment,null,wp.element.createElement("hr",null),wp.element.createElement("div",{className:"etfy-template-required-plugins"},wp.element.createElement("strong",null,"Plugins required: "),wp.element.createElement("ul",{style:{display:"inline"}},(0,u.map)(w,(function(e,t){return wp.element.createElement("li",{style:{display:"inline"},key:t},(0,p.__)("Editor Plus",y))}))))):null))):null}));function Le(e){return function(e){if(Array.isArray(e))return qe(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return qe(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?qe(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function qe(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}const Be=(0,f.compose)([(0,f.withState)({loading:!1,error:!1}),(0,e.withSelect)((function(e){var t=e("extendify-templates/data");return{getTemplates:t.getTemplates,filters:(0,t.getAppliedFilters)()}})),(0,e.withDispatch)((function(e){return{setTemplates:e("extendify-templates/data").setTemplates}}))])((function(e){var t,r=e.getTemplates,n=e.filters,o=e.loading,a=e.setTemplates,i=e.setState,s=function(){var e=r(),t=(0,u.get)(e,"offset");(0,u.isEmpty)(t)||o||(i({loading:!0,error:!1}),F(n,{offset:t}).then((function(t){var r=(0,u.get)(t,"offset"),n=(0,u.get)(t,"records");a({offset:r,records:[].concat(Le((0,u.get)(e,"records")),Le(n))}),i({loading:!1,error:!1})})).catch((function(){i({loading:!1,error:!0})})))},c=function(e){var t=e.target;t.scrollHeight-t.scrollTop===t.clientHeight&&s()};return(0,d.useEffect)((function(){var e=document.querySelector(".etfy-templates-library-modal-root");if(e)return e.addEventListener("scroll",c),function(){return e.removeEventListener("scroll",c,{passive:!0})}}),[]),null!==(t=r())&&void 0!==t&&t.offset?wp.element.createElement("div",{className:"etfy-load-more"},wp.element.createElement(m.Button,{isBusy:o,disabled:o,onClick:s,isDefault:!0},o?(0,p.__)("Loading",y):(0,p.__)("Load More",y))):null})),De=(0,f.compose)([(0,e.withSelect)((function(e){return{currentSearch:(0,e("extendify-templates/data").getAppliedFilter)("search")}})),(0,e.withDispatch)((function(){return{}}))])((function(e){var t=e.currentSearch;return wp.element.createElement("div",{className:"etfy-not-results-found__root"},wp.element.createElement("h2",null,(0,p.__)('Your search "'.concat(t,'" - did not match any designs.'))),wp.element.createElement("p",null,(0,p.__)("Try searching again or select one of the categories from the list on the left.")))})),Fe=(0,f.compose)([(0,e.withSelect)((function(e){var t=e("extendify-templates/data"),r=t.getTemplates,n=t.getCurrentPreviewTemplate,o=t.getLoadingStatus,a=t.getAppliedFilter;return{templates:r(),shouldPreviewTemplate:!(0,u.isEmpty)(n()),loadingStatus:o("templates"),currentCategory:a("categories")}}))])((function(e){var t=e.templates,r=e.shouldPreviewTemplate,n=e.loadingStatus,o=e.currentCategory,a=k()({"etfy-templates-library-content":!0,"etfy-templates-library-grid":!r}),i=k()({"etfy-templates-library-content-root":!0,"etfy-templates-loading":n}),s=(0,u.get)(t,"records");return wp.element.createElement("div",{className:i},!r&&!n&&wp.element.createElement("div",{className:"etfy-templates-description--small"},wp.element.createElement("h3",null,"Templates",wp.element.createElement("span",null,"|"),(0,u.head)(o))),(0,u.isEmpty)(s)&&!n&&wp.element.createElement(De,null),wp.element.createElement("div",{className:a},n?null:r?wp.element.createElement(Ne,null):wp.element.createElement((function(){return(0,u.isEmpty)(s)?null:s.map((function(e,t){return wp.element.createElement(O,{key:t,template:e})}))}),null),n&&wp.element.createElement("div",{className:"etfy-loading"},wp.element.createElement(m.Spinner,null))),!r&&!n&&wp.element.createElement(Be,null))})),Me=wp.blockEditor,Ue=function(e){var t=e.className,r=e.onChange,n=e.value,o=e.placeholder,a=e.onKeyDown,i=void 0===a?u.noop:a;return wp.element.createElement("div",{className:k()("block-editor-inserter__search",t)},(0,u.isFunction)(Me.__experimentalSearchForm)?wp.element.createElement(Me.__experimentalSearchForm,{placeholder:o,onChange:function(e){return r(e)},autoComplete:"off",value:n||""}):wp.element.createElement(m.TextControl,{style:{padding:"8px 8px"},onChange:r,onKeyDown:i,placeholder:o,value:n,autoComplete:"off"}))},Ke=function(e){return wp.element.createElement("div",{className:"etfy-templates-library-sidebar-menu"},(0,u.has)(e,"title")&&!(0,u.isEmpty)(e.title)&&wp.element.createElement("h2",null,e.title),e.children)},We=(0,f.compose)([(0,e.withSelect)((function(){var e=window.wp.data.select("extendify-templates/data"),t=e.getMaxImports,r=e.getCurrentImports;return{maxImports:t(),currentImports:r()}}))])((function(e){var t=e.maxImports,r=e.currentImports;return wp.element.createElement(m.Flex,{className:"etfy-imports-counter",justify:"flex-start"},wp.element.createElement("h4",null,(0,p.__)("Imports Left:",y)),wp.element.createElement("span",null,"".concat(r," / ").concat(t)))})),$e=(0,f.compose)([(0,f.withState)({apiKey:"",loading:!1,error:!1}),(0,e.withDispatch)((function(e){return{setApiKey:e("extendify-templates/data").setApiKey}}))])((function(e){var t=e.apiKey,r=e.setState,n=e.setApiKey,o=e.loading,a=e.error,i=e.onSuccess,s=e.onError;return wp.element.createElement("div",{className:"etfy-auth-api-form"},wp.element.createElement(m.TextControl,{className:k()({"etfy-auth-field":!0,"etfy-auth-error":a}),value:t,onChange:function(e){return r({apiKey:e})},placeholder:(0,p.__)("API Key",y)}),wp.element.createElement(m.Button,{isPrimary:!0,onClick:function(){(0,u.isEmpty)(t)||(r({loading:!0,error:!1}),setTimeout((function(){(0,u.isEqual)("3458290385902375729843",t)?(r({loading:!1,error:!1}),n(t),localStorage.setItem("etfy_library__key",t),i()):(r({loading:!1,error:!0}),s())}),500))},isBusy:o},o?(0,p.__)("Activating",y):(0,p.__)("Activate",y)))})),ze=(0,f.compose)([m.withNotices,(0,f.withState)({displayApiForm:!1}),(0,e.withSelect)((function(e){return{isAuthenticated:(0,e("extendify-templates/data").getAuthenticationStatus)()}}))])((function(e){var t=e.displayApiForm,r=e.setState,n=e.noticeOperations,o=e.noticeUI,a=e.isAuthenticated;return wp.element.createElement("div",{className:"etfy-library-auth"},wp.element.createElement("div",{className:"etfy-library-auth-notices"},o),a?null:wp.element.createElement(React.Fragment,null,wp.element.createElement(We,null),wp.element.createElement("div",{className:"etfy-library-auth__header"},wp.element.createElement(m.Button,{className:"etfy-upgrade__btn",href:"https://extendify.com/?utm_source=sdk&utm_medium=free_beta&utm_campaign=sdk_ref",target:"__blank"},(0,p.__)("Sign up for free",y)),wp.element.createElement(m.Button,{className:"etfy-add-key__btn",onClick:function(){return r({displayApiForm:!t})}},t?(0,p.__)("Close"):(0,p.__)("Log in"))),t&&wp.element.createElement($e,{onError:function(){return n.createErrorNotice((0,p.__)("You have entered an invalid API key",y))},onSuccess:function(){return n.createNotice({content:(0,p.__)("Activation key added successfully!",y),status:"success"})}})))}));function He(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{n||null==s.return||s.return()}finally{if(o)throw a}}return r}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ve(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ve(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ve(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}const Ye=(0,f.compose)([(0,f.withState)({searchState:""}),(0,e.withSelect)((function(e){var t=e("extendify-templates/data"),r=t.getTemplateTypes,n=t.getAppliedFilter,o=t.getTemplates;return{types:r(),currentType:n("type"),currentCategories:n("categories"),currentSearch:n("search"),templates:o()}})),(0,e.withDispatch)((function(e){var t=e("extendify-templates/data");return{setFilters:t.setFilters,setCurrentPreviewTemplate:t.setCurrentPreviewTemplate,setCurrentScreen:t.setCurrentScreen}}))])((function(e){var t=e.types,r=e.setFilters,n=e.currentType,o=e.currentSearch,a=e.currentCategories,i=e.setCurrentPreviewTemplate,s=e.searchState,c=e.setState,l=e.setCurrentScreen,f=e.templates,h=He((0,d.useState)([]),2),v=h[0],g=h[1],w=He((0,d.useState)(""),2),b=w[0],E=w[1],S=v.filter((function(e){return I(o,e)}));(0,d.useEffect)((function(){$().then((function(e){return g(e)})).catch((function(e){var t=e.message;return E(t)}))}),[]);var x=(0,d.useRef)((0,u.debounce)((function(e){r({search:e,categories:[]}),l("templates"),i({})}),500)).current,_=function(e){var t=0===(0,u.get)(f,"records.length");t&&c({searchState:""}),a.includes(e)||r({categories:e?[e]:[],search:t?"":o}),i({}),l("templates")};(0,d.useEffect)((function(){return c({searchState:o})}),[]);var P=!(0===S.length&&(0,u.get)(f,"records.length")>0&&!(0,u.isEmpty)(o));return wp.element.createElement("div",{className:"etfy-templates-library-sidebar"},wp.element.createElement("div",{className:"etfy-templates-library-sidebar__wrapper"},wp.element.createElement("div",{className:"etfy-templates-library-top__area"},wp.element.createElement(ze,null),wp.element.createElement(Ue,{value:s,placeholder:(0,p.__)("What are you looking for?",y),onChange:function(e){c({searchState:e}),x(e)}}),wp.element.createElement("hr",{className:"etfy-divider"})),wp.element.createElement(Ke,{title:(0,p.__)("Type",y)},(0,u.map)(t,(function(e,t){return wp.element.createElement(m.MenuItem,{onClick:function(){return function(e){(0,u.isEqual)(n,e)||r({type:e,categories:a.length?[(0,u.head)(a)]:[]}),i({})}(e)},className:k()({"etfy-menu-item":!0,"etfy-selected-category":(0,u.isEqual)((0,u.toLower)(e),n)}),key:t},(0,u.capitalize)(e))}))),P&&wp.element.createElement(Ke,{title:(0,p.__)("Categories",y)},wp.element.createElement((function(e){return b.length?b:v.length?wp.element.createElement(React.Fragment,null,wp.element.createElement(m.MenuItem,{className:k()({"etfy-selected-category":!a.length,"etfy-menu-item":!0}),onClick:function(){return _()}},(0,p.__)("All",y)),(0,u.map)(e.categories,(function(e,t){var r=(0,u.includes)(a,e),n=!!(0,u.isEmpty)(o)||I(o,e);return 0===(0,u.get)(f,"records.length")&&(n=!0),n&&wp.element.createElement(m.MenuItem,{key:t,className:k()({"etfy-selected-category":r,"etfy-menu-item":!0}),onClick:function(){return _(e)}},(0,u.capitalize)(e))}))):(0,p.__)("Loading categories...",y)}),{categories:v,type:n}))))})),Xe=function(e){var t=e.icon,r={library:wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 20 20",fill:"none"},wp.element.createElement("g",{clipPath:"url(#clip0)"},wp.element.createElement("mask",{id:"mask0","mask-type":"alpha",maskUnits:"userSpaceOnUse",x:-4,y:0,width:29,height:28},wp.element.createElement("rect",{width:"19.6666",height:"19.6474",transform:"matrix(0.699908 0.714233 -0.724976 0.688774 10.2439 0)",fill:"black"})),wp.element.createElement("g",{mask:"url(#mask0)"},wp.element.createElement("rect",{x:"0.00339341",y:"0.701607",width:"18.6666",height:"18.6474",transform:"matrix(0.715941 0.698161 -0.709154 0.705054 10.4294 -8.1563)",stroke:"black"})),wp.element.createElement("rect",{width:"11.6128",height:"11.5957",transform:"matrix(0.710545 0.703466 -0.714551 0.699772 10.0079 0.414024)",fill:"black"}),wp.element.createElement("rect",{width:"7.53985",height:"3.68769",transform:"matrix(0.708475 -0.705736 0.716585 0.697499 4.20924 8.58513)",fill:"white"})),wp.element.createElement("defs",null,wp.element.createElement("clipPath",{id:"clip0"},wp.element.createElement("rect",{width:20,height:20,fill:"white"}))))};return(0,u.get)(r,t)};function Je(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ge(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Je(Object(r),!0).forEach((function(t){Qe(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Je(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Qe(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const Ze=(0,f.compose)([(0,e.withSelect)((function(e){var t=e("extendify-templates/data"),r=t.getLibraryPreviewStatus,n=t.getAppliedFilters,o=t.getCurrentPreviewTemplate,a=t.getCurrentScreen;return{previewStatus:r(),appliedFilters:n(),currentScreen:a(),isPreviewingTemplate:function(){var e=o();return!(0,u.isEmpty)(e)}}})),(0,e.withDispatch)((function(e,t){var r=t.currentScreen,n=e("extendify-templates/data"),o=n.setLibraryPreviewStatus,a=n.setTemplates,i=n.setLoadingStatus,s=n.setCurrentPreviewTemplate,c=n.setCurrentScreen;return{goBack:function(){s({}),(0,u.isEqual)(r,"single-template")&&c("templates"),(0,u.isEqual)(r,"templates")&&c("menu")},closeLibraryModal:function(){o(!1)},setTemplates:a,setLoadingStatus:i}}))])((function(e){var t=e.previewStatus,r=e.closeLibraryModal,n=e.appliedFilters,o=e.setTemplates,a=e.setLoadingStatus,i=e.isPreviewingTemplate,s=e.currentScreen,c=e.goBack,l=(0,d.useRef)(!1),f=(0,d.useRef)(!0);return(0,d.useEffect)((function(){l.current&&t?(a("templates",!0),F(n,{initial:+f.current}).then((function(e){var t=(0,u.get)(e,"offset");o(Ge(Ge({},e),{},{offset:(0,u.isEmpty)(t)?"":t})),a("templates",!1),f.current&&(f.current=!1)})).catch((function(){o({records:[],offset:""}),a("templates",!1)}))):l.current=!0}),[n,t]),t?wp.element.createElement(m.Modal,{shouldCloseOnClickOutside:!1,icon:wp.element.createElement(m.Icon,{icon:"arrow-left-alt2",onClick:c,className:"etfy-back-button"}),title:(0,p.__)(wp.element.createElement(Xe,{icon:"library"})),className:"etfy-templates-library-modal-root ".concat("etfy-screen-".concat(s)),onRequestClose:r,closeLabel:(0,p.__)("close",y)},wp.element.createElement("div",{className:k()(Qe({"etfy-templates-library-modal":!0,"etfy-previewing-template":i()},"etfy-screen-".concat(s),!0))},wp.element.createElement(Ye,null),wp.element.createElement(Fe,null))):null}));document.getElementById("editor")&&window.wp.domReady((function(){var t,r=JSON.parse(window.sessionStorage.getItem("extendify-sdk-reload-session"));r&&(t=r,window._wpLoadBlockEditor.then((function(){var r;if(window.sessionStorage.removeItem("extendify-sdk-reload-session"),function(t){var r=(0,e.dispatch)("extendify-templates/data"),n=r.setSpecificState,o=r.setCurrentPreviewTemplate;n(t),o(null==t?void 0:t.currentPreviewTemplate)}(t),null!=t&&null!==(r=t.reloadRequirements)&&void 0!==r&&r.insertCurrentTemplate){var n=(0,e.dispatch)("extendify-templates/data"),o=n.setLibraryPreviewStatus,a=n.setImportsCount,i=(0,e.select)("extendify-templates/data").getCurrentImports;o(!1),setTimeout((function(){(null==t?void 0:t.currentPreviewTemplate)&&L(t.currentPreviewTemplate).then((function(){var t=(0,e.dispatch)("core/notices").createNotice,r=i()-1;a(r),localStorage.setItem("etfy__library_imports_left",r),t("info",(0,p.__)("Template Added"),{isDismissible:!0,type:"snackbar"})}))}),0)}})));var n=document.createElement("div");n.id="extendify-root",document.querySelector("#editor").insertAdjacentElement("afterend",n),(0,d.render)(wp.element.createElement(Ze,null),n)}));function et(e,t,r,n,o,a,i){try{var s=e[a](i),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,o)}function tt(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){et(a,n,o,i,s,"next",e)}function s(e){et(a,n,o,i,s,"throw",e)}i(void 0)}))}}var rt={register:function(){var e=this;window.addEventListener("extendify-sdk::softerror-encountered",(function(t){e[(0,u.camelCase)(t.detail.type)](t.detail)}))},versionOutdated:function(e){(0,d.render)(wp.element.createElement(ne,{title:e.data.title,message:e.data.message,buttonLabel:e.data.buttonLabel,forceOpen:!0}),document.querySelector("#extendify-root")),window.addEventListener("extendfy::install-required-complete",tt(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return window.sessionStorage.removeItem("extendify-sdk-reload-session"),e.next=3,new Promise((function(e){return setTimeout(e,1500)}));case 3:(0,d.render)(wp.element.createElement(we,null),document.querySelector("#extendify-root"));case 4:case"end":return e.stop()}}),e)}))))}},nt=(0,e.dispatch)("extendify-templates/data"),ot=nt.setLibraryPreviewStatus,at=nt.setEntryPoint;window.addEventListener("extendify-sdk::template-inserted",(function(e){var t;M(null===(t=e.detail)||void 0===t?void 0:t.template)})),rt.register(),window.addEventListener("extendify-sdk::open-library",(function(e){var t=e.detail;at(t),ot(!0)}));const it=wp.plugins,st=wp.editPost;var ut=function(e){var t,r,n;window.dispatchEvent(new CustomEvent("extendify-sdk::open-library",{detail:null!==(t=null===(r=e.target.closest("[data-extendify-identifier]"))||void 0===r||null===(n=r.dataset)||void 0===n?void 0:n.extendifyIdentifier)&&void 0!==t?t:"not-set",bubbles:!0}))},ct=wp.element.createElement("div",{id:"extendify-templates-inserter"},wp.element.createElement("button",{style:"background:#D9F1EE;color:#1e1e1e;border:1px solid #949494;font-weight:bold;font-size:14px;padding:8px;margin-right:8px",type:"button","data-extendify-identifier":"main-button",id:"extendify-templates-inserter-btn",className:"components-button"},wp.element.createElement("svg",{style:"margin-right:0.5rem",width:"20",height:"20",viewBox:"0 0 103 103",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{y:"25.75",width:"70.8125",height:"77.25",fill:"#000000"}),wp.element.createElement("rect",{x:"45.0625",width:"57.9375",height:"57.9375",fill:"#37C2A2"})),(0,p.__)("Library",y)));document.getElementById("editor")&&window.wp.data.subscribe((function(){setTimeout((function(){document.getElementById("extendify-templates-inserter-btn")||document.querySelector(".edit-post-header-toolbar")&&(document.querySelector(".edit-post-header-toolbar").insertAdjacentHTML("beforeend",(0,d.renderToString)(ct)),document.getElementById("extendify-templates-inserter-btn").addEventListener("click",ut))}),0)})),document.getElementById("editor")&&window.wp.data.subscribe((function(){setTimeout((function(){if(document.querySelector("[id$=patterns-view]")&&!document.getElementById("extendify-cta-button")){var e=wp.element.createElement("div",null,wp.element.createElement("button",{id:"extendify-cta-button",style:"margin:1rem 1rem 0","data-extendify-identifier":"patterns-cta",className:"components-button is-secondary"},(0,p.__)("Discover more patterns in Extendify Library",y)));document.querySelector("[id$=patterns-view]").insertAdjacentHTML("afterbegin",(0,d.renderToString)(e)),document.getElementById("extendify-cta-button").addEventListener("click",ut)}}),0)})),document.getElementById("editor")&&(0,it.registerPlugin)("extendify-temps-more-menu-trigger",{render:function(){return wp.element.createElement(st.PluginSidebarMoreMenuItem,{"data-extendify-identifier":"sidebar-button",onClick:ut,icon:wp.element.createElement("span",{className:"components-menu-items__item-icon"},wp.element.createElement("svg",{width:"20",height:"20",viewBox:"0 0 103 103",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{y:"25.75",width:"70.8125",height:"77.25",fill:"#000000"}),wp.element.createElement("rect",{x:"45.0625",width:"57.9375",height:"57.9375",fill:"#37C2A2"})))},(0,p.__)("Library",y))}})})()})();
|
extendify-sdk/readme.txt
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
=== Extendify Sdk ===
|
2 |
Requires at least: 5.4
|
3 |
-
Stable tag:
|
4 |
Requires PHP: 5.6
|
5 |
Tested up to: 5.7.0
|
1 |
=== Extendify Sdk ===
|
2 |
Requires at least: 5.4
|
3 |
+
Stable tag: 2.3
|
4 |
Requires PHP: 5.6
|
5 |
Tested up to: 5.7.0
|
extendify-sdk/src/gutenberg/api/index.js
CHANGED
@@ -2,7 +2,6 @@ import axios from 'axios'
|
|
2 |
import Templates from './Templates'
|
3 |
import Plugins from './Plugins'
|
4 |
import Categories from './Categories'
|
5 |
-
import { mapValues } from 'lodash'
|
6 |
|
7 |
const Axios = axios.create({
|
8 |
baseURL: window.extendifySdkData.root,
|
@@ -26,18 +25,14 @@ function handleErrors(error) {
|
|
26 |
}
|
27 |
|
28 |
function addDefaults(request) {
|
29 |
-
const { getCurrentImports } = window.wp.data.select('extendify-templates/data')
|
30 |
-
if (request.
|
31 |
-
request.
|
|
|
32 |
}
|
33 |
return request
|
34 |
}
|
35 |
|
36 |
-
function escapeParams(request) {
|
37 |
-
request.params = mapValues(request.params, encodeURIComponent)
|
38 |
-
return request
|
39 |
-
}
|
40 |
-
|
41 |
function checkDevMode(request) {
|
42 |
request.headers['X-Extendify-Dev-Mode'] = window.location.search.indexOf('DEVMODE') > -1
|
43 |
return request
|
@@ -57,7 +52,7 @@ Axios.interceptors.response.use((response) => checkForSoftError(findResponse(res
|
|
57 |
(error) => handleErrors(error))
|
58 |
|
59 |
// TODO: setup a pipe function instead of this nested pattern
|
60 |
-
Axios.interceptors.request.use((request) => checkDevMode(
|
61 |
(error) => error)
|
62 |
|
63 |
export {
|
2 |
import Templates from './Templates'
|
3 |
import Plugins from './Plugins'
|
4 |
import Categories from './Categories'
|
|
|
5 |
|
6 |
const Axios = axios.create({
|
7 |
baseURL: window.extendifySdkData.root,
|
25 |
}
|
26 |
|
27 |
function addDefaults(request) {
|
28 |
+
const { getCurrentImports, getEntryPoint } = window.wp.data.select('extendify-templates/data')
|
29 |
+
if (request.data) {
|
30 |
+
request.data.remaining_imports = getCurrentImports()
|
31 |
+
request.data.entry_point = getEntryPoint()
|
32 |
}
|
33 |
return request
|
34 |
}
|
35 |
|
|
|
|
|
|
|
|
|
|
|
36 |
function checkDevMode(request) {
|
37 |
request.headers['X-Extendify-Dev-Mode'] = window.location.search.indexOf('DEVMODE') > -1
|
38 |
return request
|
52 |
(error) => handleErrors(error))
|
53 |
|
54 |
// TODO: setup a pipe function instead of this nested pattern
|
55 |
+
Axios.interceptors.request.use((request) => checkDevMode(addDefaults(request)),
|
56 |
(error) => error)
|
57 |
|
58 |
export {
|
extendify-sdk/src/gutenberg/base/templates-library/index.js
CHANGED
@@ -4,7 +4,7 @@ import { dispatch, select } from '@wordpress/data'
|
|
4 |
import { __ } from '@wordpress/i18n'
|
5 |
import { hydrateTemplateLibrary, injectTemplate } from '../../functions'
|
6 |
|
7 |
-
window.wp.domReady(() => {
|
8 |
// Hydrate the state with the user's last state pre-reload
|
9 |
const stateHydration = JSON.parse(window.sessionStorage.getItem('extendify-sdk-reload-session'))
|
10 |
stateHydration && maybeHydrateAndInsertPendingTemplate(stateHydration)
|
4 |
import { __ } from '@wordpress/i18n'
|
5 |
import { hydrateTemplateLibrary, injectTemplate } from '../../functions'
|
6 |
|
7 |
+
document.getElementById('editor') && window.wp.domReady(() => {
|
8 |
// Hydrate the state with the user's last state pre-reload
|
9 |
const stateHydration = JSON.parse(window.sessionStorage.getItem('extendify-sdk-reload-session'))
|
10 |
stateHydration && maybeHydrateAndInsertPendingTemplate(stateHydration)
|
extendify-sdk/src/gutenberg/buttons.js
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { __ } from '@wordpress/i18n'
|
2 |
+
import { renderToString } from '@wordpress/element'
|
3 |
+
import { TEXT_DOMAIN } from './config'
|
4 |
+
import { registerPlugin } from '@wordpress/plugins'
|
5 |
+
import { PluginSidebarMoreMenuItem } from '@wordpress/edit-post'
|
6 |
+
|
7 |
+
const openLibrary = (event) => {
|
8 |
+
window.dispatchEvent(new CustomEvent('extendify-sdk::open-library', {
|
9 |
+
detail: event.target.closest('[data-extendify-identifier]')?.dataset?.extendifyIdentifier ?? 'not-set',
|
10 |
+
bubbles: true,
|
11 |
+
}))
|
12 |
+
}
|
13 |
+
|
14 |
+
const mainButton = <div id="extendify-templates-inserter">
|
15 |
+
<button
|
16 |
+
style="background:#D9F1EE;color:#1e1e1e;border:1px solid #949494;font-weight:bold;font-size:14px;padding:8px;margin-right:8px"
|
17 |
+
type="button"
|
18 |
+
data-extendify-identifier="main-button"
|
19 |
+
id="extendify-templates-inserter-btn"
|
20 |
+
className="components-button">
|
21 |
+
<svg style="margin-right:0.5rem" width="20" height="20" viewBox="0 0 103 103" fill="none" xmlns="http://www.w3.org/2000/svg">
|
22 |
+
<rect y="25.75" width="70.8125" height="77.25" fill="#000000"/>
|
23 |
+
<rect x="45.0625" width="57.9375" height="57.9375" fill="#37C2A2"/>
|
24 |
+
</svg>
|
25 |
+
{__('Library', TEXT_DOMAIN)}
|
26 |
+
</button>
|
27 |
+
</div>
|
28 |
+
|
29 |
+
// Add the button when Gutenberg is available and ready
|
30 |
+
document.getElementById('editor') && window.wp.data.subscribe(() => {
|
31 |
+
setTimeout(() => {
|
32 |
+
if (document.getElementById('extendify-templates-inserter-btn')) {
|
33 |
+
return
|
34 |
+
}
|
35 |
+
if (!document.querySelector('.edit-post-header-toolbar')) {
|
36 |
+
return
|
37 |
+
}
|
38 |
+
document.querySelector('.edit-post-header-toolbar').insertAdjacentHTML('beforeend', renderToString(mainButton))
|
39 |
+
document.getElementById('extendify-templates-inserter-btn')
|
40 |
+
.addEventListener('click', openLibrary)
|
41 |
+
}, 0)
|
42 |
+
})
|
43 |
+
|
44 |
+
// The CTA button inside patterns
|
45 |
+
document.getElementById('editor') && window.wp.data.subscribe(() => {
|
46 |
+
setTimeout(() => {
|
47 |
+
if (!document.querySelector('[id$=patterns-view]')) {
|
48 |
+
return
|
49 |
+
}
|
50 |
+
if (document.getElementById('extendify-cta-button')) {
|
51 |
+
return
|
52 |
+
}
|
53 |
+
const ctaButton = <div>
|
54 |
+
<button
|
55 |
+
id="extendify-cta-button"
|
56 |
+
style="margin:1rem 1rem 0"
|
57 |
+
data-extendify-identifier="patterns-cta"
|
58 |
+
className="components-button is-secondary">
|
59 |
+
{__('Discover more patterns in Extendify Library', TEXT_DOMAIN)}
|
60 |
+
</button>
|
61 |
+
</div>
|
62 |
+
document.querySelector('[id$=patterns-view]').insertAdjacentHTML('afterbegin', renderToString(ctaButton))
|
63 |
+
document.getElementById('extendify-cta-button').addEventListener('click', openLibrary)
|
64 |
+
}, 0)
|
65 |
+
})
|
66 |
+
|
67 |
+
// The right dropdown side menu
|
68 |
+
const SideMenuButton = () => (<PluginSidebarMoreMenuItem
|
69 |
+
data-extendify-identifier="sidebar-button"
|
70 |
+
onClick={openLibrary}
|
71 |
+
icon={
|
72 |
+
<span className="components-menu-items__item-icon">
|
73 |
+
<svg width="20" height="20" viewBox="0 0 103 103" fill="none" xmlns="http://www.w3.org/2000/svg">
|
74 |
+
<rect y="25.75" width="70.8125" height="77.25" fill="#000000"/>
|
75 |
+
<rect x="45.0625" width="57.9375" height="57.9375" fill="#37C2A2"/>
|
76 |
+
</svg>
|
77 |
+
</span>
|
78 |
+
}
|
79 |
+
>
|
80 |
+
{__('Library', TEXT_DOMAIN)}
|
81 |
+
</PluginSidebarMoreMenuItem>)
|
82 |
+
document.getElementById('editor') && registerPlugin('extendify-temps-more-menu-trigger', {
|
83 |
+
render: SideMenuButton,
|
84 |
+
})
|
extendify-sdk/src/gutenberg/components/library-auth/api-form.js
CHANGED
@@ -16,7 +16,7 @@ import { isEmpty, isEqual } from 'lodash'
|
|
16 |
*
|
17 |
*/
|
18 |
|
19 |
-
import { TEXT_DOMAIN } from '../../
|
20 |
import classnames from 'classnames'
|
21 |
|
22 |
function ApiForm({ apiKey, setState, setApiKey, loading, error, onSuccess, onError }) {
|
@@ -27,14 +27,14 @@ function ApiForm({ apiKey, setState, setApiKey, loading, error, onSuccess, onErr
|
|
27 |
if (isEmpty(apiKey)) return
|
28 |
|
29 |
setState({
|
30 |
-
loading: true, error: false,
|
31 |
})
|
32 |
|
33 |
// faking an api request
|
34 |
setTimeout(() => {
|
35 |
if (isEqual(fakeKey, apiKey)) {
|
36 |
setState({
|
37 |
-
loading: false, error: false,
|
38 |
})
|
39 |
|
40 |
setApiKey(apiKey)
|
@@ -44,7 +44,7 @@ function ApiForm({ apiKey, setState, setApiKey, loading, error, onSuccess, onErr
|
|
44 |
onSuccess()
|
45 |
} else {
|
46 |
setState({
|
47 |
-
loading: false, error: true,
|
48 |
})
|
49 |
onError()
|
50 |
}
|
@@ -60,7 +60,7 @@ function ApiForm({ apiKey, setState, setApiKey, loading, error, onSuccess, onErr
|
|
60 |
})}
|
61 |
value={apiKey}
|
62 |
onChange={(newApiKey) => setState({
|
63 |
-
apiKey: newApiKey,
|
64 |
})}
|
65 |
placeholder={__('API Key', TEXT_DOMAIN)}
|
66 |
/>
|
16 |
*
|
17 |
*/
|
18 |
|
19 |
+
import { TEXT_DOMAIN } from '../../config'
|
20 |
import classnames from 'classnames'
|
21 |
|
22 |
function ApiForm({ apiKey, setState, setApiKey, loading, error, onSuccess, onError }) {
|
27 |
if (isEmpty(apiKey)) return
|
28 |
|
29 |
setState({
|
30 |
+
loading: true, error: false,
|
31 |
})
|
32 |
|
33 |
// faking an api request
|
34 |
setTimeout(() => {
|
35 |
if (isEqual(fakeKey, apiKey)) {
|
36 |
setState({
|
37 |
+
loading: false, error: false,
|
38 |
})
|
39 |
|
40 |
setApiKey(apiKey)
|
44 |
onSuccess()
|
45 |
} else {
|
46 |
setState({
|
47 |
+
loading: false, error: true,
|
48 |
})
|
49 |
onError()
|
50 |
}
|
60 |
})}
|
61 |
value={apiKey}
|
62 |
onChange={(newApiKey) => setState({
|
63 |
+
apiKey: newApiKey,
|
64 |
})}
|
65 |
placeholder={__('API Key', TEXT_DOMAIN)}
|
66 |
/>
|
extendify-sdk/src/gutenberg/components/library-auth/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import { Button, withNotices } from '@wordpress/components'
|
2 |
import { __ } from '@wordpress/i18n'
|
3 |
-
import { TEXT_DOMAIN } from '../../
|
4 |
import { withState, compose } from '@wordpress/compose'
|
5 |
import { withSelect } from '@wordpress/data'
|
6 |
import ImportsCounter from '../library-imports-counter'
|
1 |
import { Button, withNotices } from '@wordpress/components'
|
2 |
import { __ } from '@wordpress/i18n'
|
3 |
+
import { TEXT_DOMAIN } from '../../config'
|
4 |
import { withState, compose } from '@wordpress/compose'
|
5 |
import { withSelect } from '@wordpress/data'
|
6 |
import ImportsCounter from '../library-imports-counter'
|
extendify-sdk/src/gutenberg/components/library-imports-counter/index.js
CHANGED
@@ -15,7 +15,7 @@ import { compose } from '@wordpress/compose'
|
|
15 |
*
|
16 |
*/
|
17 |
|
18 |
-
import { TEXT_DOMAIN } from '../../
|
19 |
|
20 |
function LibraryImportsCounter({ maxImports, currentImports }) {
|
21 |
return (
|
15 |
*
|
16 |
*/
|
17 |
|
18 |
+
import { TEXT_DOMAIN } from '../../config'
|
19 |
|
20 |
function LibraryImportsCounter({ maxImports, currentImports }) {
|
21 |
return (
|
extendify-sdk/src/gutenberg/components/library-load-more/index.js
CHANGED
@@ -17,7 +17,7 @@ import { __ } from '@wordpress/i18n'
|
|
17 |
*/
|
18 |
|
19 |
import { Templates as TemplatesApi } from '../../api'
|
20 |
-
import { TEXT_DOMAIN } from '../../
|
21 |
|
22 |
function LoadMoreFilter({ getTemplates, filters, loading, setTemplates, setState }) {
|
23 |
const loadMore = () => {
|
17 |
*/
|
18 |
|
19 |
import { Templates as TemplatesApi } from '../../api'
|
20 |
+
import { TEXT_DOMAIN } from '../../config'
|
21 |
|
22 |
function LoadMoreFilter({ getTemplates, filters, loading, setTemplates, setState }) {
|
23 |
const loadMore = () => {
|
extendify-sdk/src/gutenberg/components/library-modal/index.js
CHANGED
@@ -18,7 +18,7 @@ import {
|
|
18 |
* Custom Imports
|
19 |
*
|
20 |
*/
|
21 |
-
import { TEXT_DOMAIN } from '../../
|
22 |
import TemplatesLibraryContent from '../library-content/index'
|
23 |
import TemplatesLibrarySidebar from '../library-sidebar/index'
|
24 |
import { Templates } from '../../api'
|
18 |
* Custom Imports
|
19 |
*
|
20 |
*/
|
21 |
+
import { TEXT_DOMAIN } from '../../config'
|
22 |
import TemplatesLibraryContent from '../library-content/index'
|
23 |
import TemplatesLibrarySidebar from '../library-sidebar/index'
|
24 |
import { Templates } from '../../api'
|
extendify-sdk/src/gutenberg/components/library-sidebar/index.js
CHANGED
@@ -21,7 +21,7 @@ import {
|
|
21 |
*
|
22 |
*/
|
23 |
|
24 |
-
import { TEXT_DOMAIN } from '../../
|
25 |
import Search from '../library-search/index'
|
26 |
import SidebarSection from '../library-sidebar-section/index'
|
27 |
import { search } from '../../functions/index'
|
21 |
*
|
22 |
*/
|
23 |
|
24 |
+
import { TEXT_DOMAIN } from '../../config'
|
25 |
import Search from '../library-search/index'
|
26 |
import SidebarSection from '../library-sidebar-section/index'
|
27 |
import { search } from '../../functions/index'
|
extendify-sdk/src/gutenberg/components/library-template-preview/index.js
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
|
7 |
import { compose, withState } from '@wordpress/compose'
|
8 |
import { __ } from '@wordpress/i18n'
|
9 |
-
import { TEXT_DOMAIN } from '../../
|
10 |
import { withSelect, withDispatch } from '@wordpress/data'
|
11 |
import { Button } from '@wordpress/components'
|
12 |
import {
|
6 |
|
7 |
import { compose, withState } from '@wordpress/compose'
|
8 |
import { __ } from '@wordpress/i18n'
|
9 |
+
import { TEXT_DOMAIN } from '../../config'
|
10 |
import { withSelect, withDispatch } from '@wordpress/data'
|
11 |
import { Button } from '@wordpress/components'
|
12 |
import {
|
extendify-sdk/src/gutenberg/{global/index.js → config.js}
RENAMED
File without changes
|
extendify-sdk/src/gutenberg/listeners/index.js
CHANGED
@@ -1,5 +1,7 @@
|
|
1 |
import { templateHandler } from './template-inserted'
|
2 |
import { softErrorHandler } from './softerror-encountered'
|
|
|
3 |
|
4 |
templateHandler.register()
|
5 |
softErrorHandler.register()
|
|
1 |
import { templateHandler } from './template-inserted'
|
2 |
import { softErrorHandler } from './softerror-encountered'
|
3 |
+
import { openLibrary } from './open-library'
|
4 |
|
5 |
templateHandler.register()
|
6 |
softErrorHandler.register()
|
7 |
+
openLibrary.register()
|
extendify-sdk/src/gutenberg/listeners/open-library.js
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { dispatch } from '@wordpress/data'
|
2 |
+
|
3 |
+
const { setLibraryPreviewStatus, setEntryPoint } = dispatch('extendify-templates/data')
|
4 |
+
export const openLibrary = {
|
5 |
+
register() {
|
6 |
+
window.addEventListener('extendify-sdk::open-library', ({ detail }) => {
|
7 |
+
setEntryPoint(detail)
|
8 |
+
setLibraryPreviewStatus(true)
|
9 |
+
})
|
10 |
+
},
|
11 |
+
}
|
extendify-sdk/src/gutenberg/middleware/hasPluginsActivated/ActivatePluginsModal.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
import { __, sprintf } from '@wordpress/i18n'
|
2 |
-
import { TEXT_DOMAIN } from '../../
|
3 |
import TemplatesLibraryModal from '../../components/library-modal/index'
|
4 |
import { dispatch, select } from '@wordpress/data'
|
5 |
import {
|
1 |
import { __, sprintf } from '@wordpress/i18n'
|
2 |
+
import { TEXT_DOMAIN } from '../../config'
|
3 |
import TemplatesLibraryModal from '../../components/library-modal/index'
|
4 |
import { dispatch, select } from '@wordpress/data'
|
5 |
import {
|
extendify-sdk/src/gutenberg/middleware/hasPluginsActivated/ActivatingModal.js
CHANGED
@@ -2,7 +2,7 @@ import { __ } from '@wordpress/i18n'
|
|
2 |
import {
|
3 |
Modal, Button, Notice,
|
4 |
} from '@wordpress/components'
|
5 |
-
import { TEXT_DOMAIN } from '../../
|
6 |
import {
|
7 |
useEffect, useState, render,
|
8 |
} from '@wordpress/element'
|
2 |
import {
|
3 |
Modal, Button, Notice,
|
4 |
} from '@wordpress/components'
|
5 |
+
import { TEXT_DOMAIN } from '../../config'
|
6 |
import {
|
7 |
useEffect, useState, render,
|
8 |
} from '@wordpress/element'
|
extendify-sdk/src/gutenberg/middleware/hasRequiredPlugins/InstallingModal.js
CHANGED
@@ -2,7 +2,7 @@ import { __ } from '@wordpress/i18n'
|
|
2 |
import {
|
3 |
Modal, Button, Notice,
|
4 |
} from '@wordpress/components'
|
5 |
-
import { TEXT_DOMAIN } from '../../
|
6 |
import {
|
7 |
useEffect, useState, render,
|
8 |
} from '@wordpress/element'
|
2 |
import {
|
3 |
Modal, Button, Notice,
|
4 |
} from '@wordpress/components'
|
5 |
+
import { TEXT_DOMAIN } from '../../config'
|
6 |
import {
|
7 |
useEffect, useState, render,
|
8 |
} from '@wordpress/element'
|
extendify-sdk/src/gutenberg/middleware/hasRequiredPlugins/RequiredPluginsModal.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
import { __, sprintf } from '@wordpress/i18n'
|
2 |
-
import { TEXT_DOMAIN } from '../../
|
3 |
import TemplatesLibraryModal from '../../components/library-modal/index'
|
4 |
import { dispatch, select } from '@wordpress/data'
|
5 |
import {
|
1 |
import { __, sprintf } from '@wordpress/i18n'
|
2 |
+
import { TEXT_DOMAIN } from '../../config'
|
3 |
import TemplatesLibraryModal from '../../components/library-modal/index'
|
4 |
import { dispatch, select } from '@wordpress/data'
|
5 |
import {
|
extendify-sdk/src/gutenberg/middleware/needsPageReload/ReloadRequiredModal.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import { __ } from '@wordpress/i18n'
|
2 |
-
import { TEXT_DOMAIN } from '../../
|
3 |
import {
|
4 |
-
Modal, Button, ButtonGroup,
|
5 |
} from '@wordpress/components'
|
6 |
import { useState } from '@wordpress/element'
|
7 |
import { dispatch, select } from '@wordpress/data'
|
@@ -26,7 +26,7 @@ export const ReloadRequiredModal = () => {
|
|
26 |
<>
|
27 |
<Modal title={__('Reload required', TEXT_DOMAIN)} isDismissible={false}>
|
28 |
<p style={{
|
29 |
-
maxWidth: '400px',
|
30 |
}}>
|
31 |
{__('Just one more thing! We need to reload the page to continue.', TEXT_DOMAIN)}
|
32 |
</p>
|
@@ -35,7 +35,7 @@ export const ReloadRequiredModal = () => {
|
|
35 |
{__('Reload page', TEXT_DOMAIN)}
|
36 |
</Button>
|
37 |
<Button isSecondary onClick={saveChanges} isBusy={isSaving} style={{
|
38 |
-
margin: '0 4px',
|
39 |
}}>
|
40 |
{__('Save changes', TEXT_DOMAIN)}
|
41 |
</Button>
|
1 |
import { __ } from '@wordpress/i18n'
|
2 |
+
import { TEXT_DOMAIN } from '../../config'
|
3 |
import {
|
4 |
+
Modal, Button, ButtonGroup,
|
5 |
} from '@wordpress/components'
|
6 |
import { useState } from '@wordpress/element'
|
7 |
import { dispatch, select } from '@wordpress/data'
|
26 |
<>
|
27 |
<Modal title={__('Reload required', TEXT_DOMAIN)} isDismissible={false}>
|
28 |
<p style={{
|
29 |
+
maxWidth: '400px',
|
30 |
}}>
|
31 |
{__('Just one more thing! We need to reload the page to continue.', TEXT_DOMAIN)}
|
32 |
</p>
|
35 |
{__('Reload page', TEXT_DOMAIN)}
|
36 |
</Button>
|
37 |
<Button isSecondary onClick={saveChanges} isBusy={isSaving} style={{
|
38 |
+
margin: '0 4px',
|
39 |
}}>
|
40 |
{__('Save changes', TEXT_DOMAIN)}
|
41 |
</Button>
|
extendify-sdk/src/gutenberg/plugins/header-btn/index.js
DELETED
@@ -1,39 +0,0 @@
|
|
1 |
-
import { __ } from '@wordpress/i18n'
|
2 |
-
import { dispatch } from '@wordpress/data'
|
3 |
-
import { renderToString } from '@wordpress/element'
|
4 |
-
import { TEXT_DOMAIN } from '../../global'
|
5 |
-
|
6 |
-
function insertHeaderButton() {
|
7 |
-
const extendifyButton = <div id="extendify-templates-inserter">
|
8 |
-
<button
|
9 |
-
style="background:#D9F1EE;color:#1e1e1e;font-weight:bold;font-size:14px;padding:8px;height:28px"
|
10 |
-
type="button"
|
11 |
-
id="extendify-templates-inserter-btn"
|
12 |
-
className="components-button">
|
13 |
-
<svg style="margin-right:0.5rem" width="20" height="20" viewBox="0 0 103 103" fill="none" xmlns="http://www.w3.org/2000/svg">
|
14 |
-
<rect y="25.75" width="70.8125" height="77.25" fill="black"/>
|
15 |
-
<rect x="45.0625" width="57.9375" height="57.9375" fill="#37C2A2"/>
|
16 |
-
</svg>
|
17 |
-
{__('Library', TEXT_DOMAIN)}
|
18 |
-
</button>
|
19 |
-
</div>
|
20 |
-
|
21 |
-
// Add the button when Gutenberg is available and ready
|
22 |
-
document.getElementById('editor') && window.wp.data.subscribe(function () {
|
23 |
-
setTimeout(function () {
|
24 |
-
if (document.getElementById('extendify-templates-inserter-btn')) {
|
25 |
-
return
|
26 |
-
}
|
27 |
-
const toolbar = document.querySelector('.edit-post-header-toolbar')
|
28 |
-
if (toolbar instanceof HTMLElement) {
|
29 |
-
toolbar.insertAdjacentHTML('beforeend', renderToString(extendifyButton))
|
30 |
-
document.getElementById('extendify-templates-inserter-btn').addEventListener('click', () => {
|
31 |
-
const { setLibraryPreviewStatus } = dispatch('extendify-templates/data')
|
32 |
-
setLibraryPreviewStatus(true)
|
33 |
-
})
|
34 |
-
}
|
35 |
-
}, 0)
|
36 |
-
})
|
37 |
-
}
|
38 |
-
|
39 |
-
window.wp.domReady(insertHeaderButton)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
extendify-sdk/src/gutenberg/plugins/index.js
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
import './header-btn/index';
|
2 |
-
import './more-menu-btn/index';
|
|
|
|
extendify-sdk/src/gutenberg/plugins/more-menu-btn/index.js
DELETED
@@ -1,64 +0,0 @@
|
|
1 |
-
/***
|
2 |
-
* @description Adds Templates Library Trigger in Gutenberg More Menu Dropdown
|
3 |
-
*/
|
4 |
-
|
5 |
-
/**
|
6 |
-
*
|
7 |
-
* Wordpress Dependencies
|
8 |
-
*
|
9 |
-
*/
|
10 |
-
|
11 |
-
import { registerPlugin } from '@wordpress/plugins'
|
12 |
-
import { PluginSidebarMoreMenuItem } from '@wordpress/edit-post'
|
13 |
-
import { __ } from '@wordpress/i18n'
|
14 |
-
import { compose } from '@wordpress/compose'
|
15 |
-
import { withSelect, withDispatch } from '@wordpress/data'
|
16 |
-
|
17 |
-
/**
|
18 |
-
*
|
19 |
-
* Custom Imports
|
20 |
-
*
|
21 |
-
*/
|
22 |
-
import { TEXT_DOMAIN } from '../../global'
|
23 |
-
import Icon from '../../assets/icons'
|
24 |
-
|
25 |
-
registerPlugin('extendify-temps-more-menu-trigger', {
|
26 |
-
render: compose([
|
27 |
-
withSelect((select) => {
|
28 |
-
const { getLibraryPreviewStatus } = select('extendify-templates/data')
|
29 |
-
|
30 |
-
return {
|
31 |
-
previewStatus: getLibraryPreviewStatus(),
|
32 |
-
}
|
33 |
-
}),
|
34 |
-
withDispatch((dispatch, { previewStatus }) => {
|
35 |
-
const { setLibraryPreviewStatus } = dispatch('extendify-templates/data')
|
36 |
-
|
37 |
-
return {
|
38 |
-
|
39 |
-
/**
|
40 |
-
*
|
41 |
-
* Will toggle the templates library preview status
|
42 |
-
*
|
43 |
-
*/
|
44 |
-
|
45 |
-
toggleTemplatesLibraryPreview() {
|
46 |
-
setLibraryPreviewStatus(!previewStatus)
|
47 |
-
},
|
48 |
-
}
|
49 |
-
}),
|
50 |
-
])(({ previewStatus, toggleTemplatesLibraryPreview }) => (
|
51 |
-
<PluginSidebarMoreMenuItem
|
52 |
-
isPrimary={previewStatus}
|
53 |
-
onClick={toggleTemplatesLibraryPreview}
|
54 |
-
className="etfy-lib-menu"
|
55 |
-
icon={
|
56 |
-
<span className="components-menu-items__item-icon">
|
57 |
-
<Icon icon="library" />
|
58 |
-
</span>
|
59 |
-
}
|
60 |
-
>
|
61 |
-
{__('Library', TEXT_DOMAIN)}
|
62 |
-
</PluginSidebarMoreMenuItem>
|
63 |
-
)),
|
64 |
-
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
extendify-sdk/src/gutenberg/plugins/more-menu-btn/style.scss
DELETED
@@ -1,5 +0,0 @@
|
|
1 |
-
.etfy-lib-menu {
|
2 |
-
svg {
|
3 |
-
fill: none; /** overwriting gutenberg svg fill **/
|
4 |
-
}
|
5 |
-
}
|
|
|
|
|
|
|
|
|
|
extendify-sdk/src/gutenberg/store/actions/index.js
CHANGED
@@ -113,6 +113,13 @@ const actions = {
|
|
113 |
imports: newImports,
|
114 |
}
|
115 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
}
|
117 |
|
118 |
export default actions
|
113 |
imports: newImports,
|
114 |
}
|
115 |
},
|
116 |
+
|
117 |
+
setEntryPoint(entryPoint) {
|
118 |
+
return {
|
119 |
+
type: 'SET_ENTRY_POINT',
|
120 |
+
entryPoint: entryPoint,
|
121 |
+
}
|
122 |
+
},
|
123 |
}
|
124 |
|
125 |
export default actions
|
extendify-sdk/src/gutenberg/store/reducer/index.js
CHANGED
@@ -1,74 +1,25 @@
|
|
1 |
-
/**
|
2 |
-
*
|
3 |
-
* Main Templates Library Reducer
|
4 |
-
*
|
5 |
-
*/
|
6 |
-
|
7 |
export const initialState = {
|
8 |
-
|
9 |
-
/**
|
10 |
-
* Weather to preview the library or not
|
11 |
-
*/
|
12 |
-
|
13 |
previewStatus: false,
|
14 |
-
|
15 |
-
/***
|
16 |
-
* Templates Data
|
17 |
-
*/
|
18 |
templates: {
|
19 |
loading: false,
|
20 |
error: false,
|
21 |
records: [],
|
22 |
offset: '',
|
23 |
},
|
24 |
-
|
25 |
-
/**
|
26 |
-
* Available Template Types
|
27 |
-
*/
|
28 |
-
|
29 |
templateTypes: ['pattern', 'template'],
|
30 |
-
|
31 |
-
/**
|
32 |
-
* Currently applied templates library filters
|
33 |
-
*/
|
34 |
-
|
35 |
templateFilters: {
|
36 |
categories: [],
|
37 |
-
type: '
|
38 |
search: '',
|
39 |
},
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Template that is currently being previewed
|
43 |
-
*/
|
44 |
currentPreviewTemplate: {},
|
45 |
-
|
46 |
-
/**
|
47 |
-
* current screen can be
|
48 |
-
* used for navigating in smaller viewport
|
49 |
-
* [ "menu", "templates", "single-template" ]
|
50 |
-
*/
|
51 |
currentScreen: 'menu',
|
52 |
-
|
53 |
reloadRequirements: {
|
54 |
required: false,
|
55 |
insertCurrentTemplate: false,
|
56 |
},
|
57 |
-
|
58 |
-
/**
|
59 |
-
*
|
60 |
-
* Library Api key
|
61 |
-
*
|
62 |
-
*/
|
63 |
-
|
64 |
apiKey: localStorage.getItem('etfy_library__key') ?? '',
|
65 |
-
|
66 |
-
/**
|
67 |
-
*
|
68 |
-
* For Import Counting
|
69 |
-
*
|
70 |
-
*/
|
71 |
-
|
72 |
maxImports: 3,
|
73 |
currentImports: localStorage.getItem('etfy__library_imports_left') ?? 3,
|
74 |
}
|
@@ -161,6 +112,13 @@ export default function (state = initialState, action) {
|
|
161 |
}
|
162 |
}
|
163 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
default:
|
165 |
return state
|
166 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
export const initialState = {
|
|
|
|
|
|
|
|
|
|
|
2 |
previewStatus: false,
|
3 |
+
entryPoint: '',
|
|
|
|
|
|
|
4 |
templates: {
|
5 |
loading: false,
|
6 |
error: false,
|
7 |
records: [],
|
8 |
offset: '',
|
9 |
},
|
|
|
|
|
|
|
|
|
|
|
10 |
templateTypes: ['pattern', 'template'],
|
|
|
|
|
|
|
|
|
|
|
11 |
templateFilters: {
|
12 |
categories: [],
|
13 |
+
type: 'pattern',
|
14 |
search: '',
|
15 |
},
|
|
|
|
|
|
|
|
|
16 |
currentPreviewTemplate: {},
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
currentScreen: 'menu',
|
|
|
18 |
reloadRequirements: {
|
19 |
required: false,
|
20 |
insertCurrentTemplate: false,
|
21 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
apiKey: localStorage.getItem('etfy_library__key') ?? '',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
maxImports: 3,
|
24 |
currentImports: localStorage.getItem('etfy__library_imports_left') ?? 3,
|
25 |
}
|
112 |
}
|
113 |
}
|
114 |
|
115 |
+
case 'SET_ENTRY_POINT': {
|
116 |
+
return {
|
117 |
+
...state,
|
118 |
+
entryPoint: action.entryPoint,
|
119 |
+
}
|
120 |
+
}
|
121 |
+
|
122 |
default:
|
123 |
return state
|
124 |
}
|
extendify-sdk/src/gutenberg/store/selectors/index.js
CHANGED
@@ -2,37 +2,13 @@ import {
|
|
2 |
get, isString, has,
|
3 |
} from 'lodash'
|
4 |
|
5 |
-
/***
|
6 |
-
*
|
7 |
-
* Templates Library Store Selectors
|
8 |
-
*
|
9 |
-
*/
|
10 |
-
|
11 |
const selectors = {
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Get Current Preview Status of Templates Library
|
15 |
-
*/
|
16 |
-
|
17 |
getLibraryPreviewStatus(state) {
|
18 |
return get(state, 'previewStatus')
|
19 |
},
|
20 |
-
|
21 |
-
/**
|
22 |
-
* Fetches Templates From API
|
23 |
-
*/
|
24 |
-
|
25 |
getTemplates(state) {
|
26 |
return get(state, 'templates')
|
27 |
},
|
28 |
-
|
29 |
-
/**
|
30 |
-
*
|
31 |
-
* Will return loading status of the state
|
32 |
-
* matching the given key
|
33 |
-
*
|
34 |
-
*/
|
35 |
-
|
36 |
getLoadingStatus(state, key) {
|
37 |
switch (key) {
|
38 |
case 'templates':
|
@@ -42,20 +18,9 @@ const selectors = {
|
|
42 |
return false
|
43 |
}
|
44 |
},
|
45 |
-
|
46 |
-
/**
|
47 |
-
* @return {string[]} available template types
|
48 |
-
*/
|
49 |
getTemplateTypes(state) {
|
50 |
return get(state, 'templateTypes')
|
51 |
},
|
52 |
-
|
53 |
-
/**
|
54 |
-
* Will return the current applied template
|
55 |
-
* @param {string} key - Filter to return
|
56 |
-
* @return {any} requiredFilter
|
57 |
-
*/
|
58 |
-
|
59 |
getAppliedFilter(state, key) {
|
60 |
if (!isString(key)) {
|
61 |
return
|
@@ -69,65 +34,27 @@ const selectors = {
|
|
69 |
|
70 |
return get(currentFilters, key)
|
71 |
},
|
72 |
-
|
73 |
-
/**
|
74 |
-
* Will provide all currently applied filters
|
75 |
-
*
|
76 |
-
* @return {object} filters
|
77 |
-
*/
|
78 |
-
|
79 |
getAppliedFilters(state) {
|
80 |
return get(state, 'templateFilters')
|
81 |
},
|
82 |
-
|
83 |
-
/**
|
84 |
-
* @return {object} currently previewing template
|
85 |
-
*/
|
86 |
-
|
87 |
getCurrentPreviewTemplate(state) {
|
88 |
return get(state, 'currentPreviewTemplate')
|
89 |
},
|
90 |
-
|
91 |
getCurrentScreen(state) {
|
92 |
return get(state, 'currentScreen')
|
93 |
},
|
94 |
-
|
95 |
-
/**
|
96 |
-
*
|
97 |
-
* @return {string} apiKey
|
98 |
-
*
|
99 |
-
*/
|
100 |
-
|
101 |
getApiKey(state) {
|
102 |
return get(state, 'apiKey')
|
103 |
},
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
* @return {number} currentImports
|
108 |
-
*
|
109 |
-
*/
|
110 |
-
|
111 |
getCurrentImports(state) {
|
112 |
return get(state, 'currentImports')
|
113 |
},
|
114 |
-
|
115 |
-
/**
|
116 |
-
*
|
117 |
-
* @return {number} maxImports
|
118 |
-
*
|
119 |
-
*/
|
120 |
-
|
121 |
getMaxImports(state) {
|
122 |
return get(state, 'maxImports')
|
123 |
},
|
124 |
-
|
125 |
-
/**
|
126 |
-
*
|
127 |
-
* @return {boolean} authenticationStatus
|
128 |
-
*
|
129 |
-
*/
|
130 |
-
|
131 |
getAuthenticationStatus(state) {
|
132 |
return get(state, 'apiKey')
|
133 |
? true
|
2 |
get, isString, has,
|
3 |
} from 'lodash'
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
const selectors = {
|
|
|
|
|
|
|
|
|
|
|
6 |
getLibraryPreviewStatus(state) {
|
7 |
return get(state, 'previewStatus')
|
8 |
},
|
|
|
|
|
|
|
|
|
|
|
9 |
getTemplates(state) {
|
10 |
return get(state, 'templates')
|
11 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
getLoadingStatus(state, key) {
|
13 |
switch (key) {
|
14 |
case 'templates':
|
18 |
return false
|
19 |
}
|
20 |
},
|
|
|
|
|
|
|
|
|
21 |
getTemplateTypes(state) {
|
22 |
return get(state, 'templateTypes')
|
23 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
getAppliedFilter(state, key) {
|
25 |
if (!isString(key)) {
|
26 |
return
|
34 |
|
35 |
return get(currentFilters, key)
|
36 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
getAppliedFilters(state) {
|
38 |
return get(state, 'templateFilters')
|
39 |
},
|
|
|
|
|
|
|
|
|
|
|
40 |
getCurrentPreviewTemplate(state) {
|
41 |
return get(state, 'currentPreviewTemplate')
|
42 |
},
|
|
|
43 |
getCurrentScreen(state) {
|
44 |
return get(state, 'currentScreen')
|
45 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
getApiKey(state) {
|
47 |
return get(state, 'apiKey')
|
48 |
},
|
49 |
+
getEntryPoint(state) {
|
50 |
+
return get(state, 'entryPoint')
|
51 |
+
},
|
|
|
|
|
|
|
|
|
52 |
getCurrentImports(state) {
|
53 |
return get(state, 'currentImports')
|
54 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
getMaxImports(state) {
|
56 |
return get(state, 'maxImports')
|
57 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
getAuthenticationStatus(state) {
|
59 |
return get(state, 'apiKey')
|
60 |
? true
|
extendify-sdk/src/index.js
CHANGED
@@ -1,25 +1,4 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
* Custom Store
|
4 |
-
*
|
5 |
-
*/
|
6 |
-
|
7 |
-
import './gutenberg/store/index';
|
8 |
-
|
9 |
-
/***
|
10 |
-
*
|
11 |
-
* Plugins
|
12 |
-
*
|
13 |
-
*/
|
14 |
-
|
15 |
-
import './gutenberg/plugins/index';
|
16 |
-
|
17 |
-
/***
|
18 |
-
*
|
19 |
-
* Base Features
|
20 |
-
*
|
21 |
-
*/
|
22 |
-
|
23 |
-
import './gutenberg/base/templates-library/index';
|
24 |
-
|
25 |
import './gutenberg/listeners'
|
|
1 |
+
import './gutenberg/store/index'
|
2 |
+
import './gutenberg/base/templates-library/index'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
import './gutenberg/listeners'
|
4 |
+
import './gutenberg/buttons'
|
extendify-sdk/src/style.scss
CHANGED
@@ -36,11 +36,3 @@
|
|
36 |
@import './gutenberg/components/library-not-found/style.scss';
|
37 |
@import './gutenberg/components/library-imports-counter/style.scss';
|
38 |
@import './gutenberg/components/library-auth/style.scss';
|
39 |
-
|
40 |
-
/**
|
41 |
-
*
|
42 |
-
* Plugins
|
43 |
-
*
|
44 |
-
**/
|
45 |
-
|
46 |
-
@import './gutenberg/plugins/more-menu-btn/style.scss';
|
36 |
@import './gutenberg/components/library-not-found/style.scss';
|
37 |
@import './gutenberg/components/library-imports-counter/style.scss';
|
38 |
@import './gutenberg/components/library-auth/style.scss';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: block, gutenberg block, acf block, gutenberg, acf, editor
|
|
4 |
Requires at least: 5.0
|
5 |
Requires PHP: 5.6
|
6 |
Tested up to: 5.7
|
7 |
-
Stable tag: 2.6.
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -165,6 +165,9 @@ Absolutely! You can definitely use the ACF Blocks on yours as well as your clien
|
|
165 |
|
166 |
== Changelog ==
|
167 |
|
|
|
|
|
|
|
168 |
= 2.6.1 =
|
169 |
* Bug Fixes
|
170 |
|
4 |
Requires at least: 5.0
|
5 |
Requires PHP: 5.6
|
6 |
Tested up to: 5.7
|
7 |
+
Stable tag: 2.6.2
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
165 |
|
166 |
== Changelog ==
|
167 |
|
168 |
+
= 2.6.2 =
|
169 |
+
* Template library improvement
|
170 |
+
|
171 |
= 2.6.1 =
|
172 |
* Bug Fixes
|
173 |
|