Gutenberg Blocks – ACF Blocks Suite - Version 2.6.1

Version Description

  • Bug Fixes
Download this release

Release Info

Developer munirkamal
Plugin Icon 128x128 Gutenberg Blocks – ACF Blocks Suite
Version 2.6.1
Comparing to
See all releases

Code changes from version 2.6.0 to 2.6.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.0
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.1
8
  * Author: munirkamal
9
  * Author URI: https://munirkamal.wordpress.com
10
  * License: GPL2
extendify-sdk/extendify-sdk.php CHANGED
@@ -1,12 +1,4 @@
1
  <?php
2
- /**
3
- * Plugin Name: Extendify SDK
4
- * Description: SDK for viewing and accessing the Extendify template library.
5
- * Version: 1.0.0
6
- * Author: Extendify
7
- * Text Domain: extendify-sdk
8
- */
9
-
10
  if (!defined('ABSPATH')) {
11
  exit;
12
  }
1
  <?php
 
 
 
 
 
 
 
 
2
  if (!defined('ABSPATH')) {
3
  exit;
4
  }
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}#extendify-templates-inserter{display:flex;flex-direction:column;justify-content:center}#extendify-templates-inserter svg{margin-right:8px;fill:none}.etfy-lib-menu svg{fill:none}
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}.etfy-lib-menu svg{fill:none}
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";const d=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)};window.wp.domReady((function(){var t="extendify-templates-inserter-btn",r='<div id="extendify-templates-inserter"><button type="button" id="'+t+'" class="components-button">'+(0,f.renderToString)(wp.element.createElement(d,{icon:"library"}))+(0,p.__)("Library",m)+"</button></div>",n=document.getElementById("editor");n&&window.wp.data.subscribe((function(){setTimeout((function(){if(!document.getElementById(t)){var a=n.querySelector(".edit-post-header-toolbar");a instanceof HTMLElement&&(a.insertAdjacentHTML("beforeend",r),document.querySelector("#"+t).addEventListener("click",(function(){(0,(0,e.dispatch)("extendify-templates/data").setLibraryPreviewStatus)(!0)})))}}),1)}))}));const y=wp.plugins,h=wp.editPost,v=wp.compose;(0,y.registerPlugin)("extendify-temps-more-menu-trigger",{render:(0,v.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(h.PluginSidebarMoreMenuItem,{isPrimary:t,onClick:r,className:"etfy-lib-menu",icon:wp.element.createElement("span",{className:"components-menu-items__item-icon"},wp.element.createElement(d,{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,v.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})},H=function(){return X.get("plugins")},V=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"}})},$=function(){return X.get("active-plugins")},z=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,H();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,$();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]),V(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]),V(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,v.compose)([(0,v.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,v.compose)([(0,v.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,v.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,v.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,He=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"}))},Ve=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)},$e=(0,v.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)))})),ze=(0,v.compose)([(0,v.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,v.compose)([g.withNotices,(0,v.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($e,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(ze,{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,v.compose)([(0,v.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(){z().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(He,{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(Ve,{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(Ve,{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,v.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),y=(0,f.useRef)(!0);return(0,f.useEffect)((function(){l.current&&t?(o("templates",!0),K(n,{initial:+y.current}).then((function(e){var t=(0,u.get)(e,"offset");a(Ze(Ze({},e),{},{offset:(0,u.isEmpty)(t)?"":t})),o("templates",!1),y.current&&(y.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(d,{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),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()})()})();
extendify-sdk/readme.txt CHANGED
@@ -1,5 +1,5 @@
1
  === Extendify Sdk ===
2
  Requires at least: 5.4
3
- Stable tag: 1.7
4
  Requires PHP: 5.6
5
  Tested up to: 5.7.0
1
  === Extendify Sdk ===
2
  Requires at least: 5.4
3
+ Stable tag: 1.8
4
  Requires PHP: 5.6
5
  Tested up to: 5.7.0
extendify-sdk/src/gutenberg/plugins/header-btn/index.js CHANGED
@@ -1,64 +1,38 @@
1
- /**
2
- *
3
- * @description Renders Template Library Trigger in Gutenberg Editor Header
4
- *
5
- */
6
-
7
- /**
8
- *
9
- * Wordpress Dependencies
10
- *
11
- */
12
-
13
  import { __ } from '@wordpress/i18n'
14
  import { dispatch } from '@wordpress/data'
15
  import { renderToString } from '@wordpress/element'
16
-
17
- /**
18
- *
19
- * Custom Dependencies
20
- *
21
- */
22
-
23
  import { TEXT_DOMAIN } from '../../global'
24
- import Icon from '../../assets/icons'
25
 
26
  function insertHeaderButton() {
27
- // just to keep it cleaner - we refer to our link by id for speed of lookup on DOM.
28
- var link_id = 'extendify-templates-inserter-btn'
29
-
30
- // prepare our custom link's html.
31
- var link_html =
32
- '<div id="extendify-templates-inserter"><button type="button" id="' +
33
- link_id +
34
- '" class="components-button">' +
35
- renderToString(<Icon icon="library" />) +
36
- __('Library', TEXT_DOMAIN) +
37
- '</button></div>'
38
-
39
- // check if gutenberg's editor root element is present.
40
- var editorEl = document.getElementById('editor')
41
- if (!editorEl) {
42
- // do nothing if there's no gutenberg root element on page.
43
- return
44
- }
45
-
46
- window.wp.data.subscribe(function () {
47
  setTimeout(function () {
48
- if (!document.getElementById(link_id)) {
49
- var toolbalEl = editorEl.querySelector('.edit-post-header-toolbar')
50
- if (toolbalEl instanceof HTMLElement) {
51
- toolbalEl.insertAdjacentHTML('beforeend', link_html)
52
-
53
- // hooking the template library toggle event
54
- document.querySelector('#' + link_id).addEventListener('click', function () {
55
- const { setLibraryPreviewStatus } = dispatch('extendify-templates/data')
56
-
57
- setLibraryPreviewStatus(true)
58
- })
59
- }
60
  }
61
- }, 1)
62
  })
63
  }
64
 
 
 
 
 
 
 
 
 
 
 
 
 
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
 
extendify-sdk/src/gutenberg/plugins/header-btn/style.scss DELETED
@@ -1,10 +0,0 @@
1
- #extendify-templates-inserter {
2
- display: flex;
3
- flex-direction: column;
4
- justify-content: center;
5
-
6
- svg {
7
- margin-right: $grid-unit-10;
8
- fill: none; /** overwriting gutenberg svg fill **/
9
- }
10
- }
 
 
 
 
 
 
 
 
 
 
extendify-sdk/src/style.scss CHANGED
@@ -43,5 +43,4 @@
43
  *
44
  **/
45
 
46
- @import './gutenberg/plugins/header-btn/style.scss';
47
  @import './gutenberg/plugins/more-menu-btn/style.scss';
43
  *
44
  **/
45
 
 
46
  @import './gutenberg/plugins/more-menu-btn/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.0
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.0 =
169
  * New: Access to the Extendify template and pattern library
170
 
4
  Requires at least: 5.0
5
  Requires PHP: 5.6
6
  Tested up to: 5.7
7
+ Stable tag: 2.6.1
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.1 =
169
+ * Bug Fixes
170
+
171
  = 2.6.0 =
172
  * New: Access to the Extendify template and pattern library
173