|
1
|
|
-(()=>{"use strict";const e={};function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function n(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,l,c=[],i=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;i=!1}else for(;!(i=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);i=!0);}catch(e){u=!0,a=e}finally{try{if(!i&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(u)throw a}}return c}}(e,n)||function(e,n){if(e){if("string"==typeof e)return t(e,n);var r={}.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)?t(e,n):void 0}}(e,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.")}()}e.n=t=>{const n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},e.d=(t,n)=>{if(Array.isArray(n))for(var r=0;r<n.length;){var a=n[r++],o=n[r++];e.o(t,a)?0===o&&r++:0===o?Object.defineProperty(t,a,{enumerable:!0,value:n[r++]}):Object.defineProperty(t,a,{enumerable:!0,get:o})}else for(var a in n)e.o(n,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:n[a]})},e.o=(e,t)=>Object.hasOwn(e,t);const r=window.wp.domReady;var a=e.n(r);const o=window.wp.hooks,l=(window.wp.data,window.wp.editor),c=window.wp.plugins,i=window.wp.i18n,u=window.wp.editPost,s=window.wp.apiFetch;var d=e.n(s);const p=window.React;var b=e.n(p);const m=window.wp.url;function h(){return h=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},h.apply(null,arguments)}var g=function(e){return b().createElement("svg",h({viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},e),b().createElement("circle",{cx:90.5,cy:454.8,fill:"#ffb45a",r:57.2}),b().createElement("circle",{cx:256,cy:454.8,fill:"#ff7b8e",r:57.2}),b().createElement("circle",{cx:421.5,cy:454.8,fill:"#5ac0ff",r:57.2}),b().createElement("path",{d:"M356.5 94.5c-3.1 0-6.1.2-9.1.4C335 40.6 286.4 0 228.3 0c-15.3 0-29.9 2.8-43.4 8 0 15.3.1 32.9.2 40.4 15.6.1 45.8.2 59.1.2v57.8h-58.8v97.7h60.5c-1.7 4.3-4.3 10.7-5.4 13.2-11 26.5-38.3 41.3-66.6 36.2-26.9-4.9-46.9-27.8-48.4-55.9-.4-8.2-.2-16.5-.2-24.7V106h-20.7c-41.8 19.4-70.9 61.7-70.9 110.8 0 67.5 54.7 122.2 122.2 122.2h202c66.9-.7 120.8-55.1 120.8-122.2 0-67.5-54.7-122.3-122.2-122.3z",fill:"#5633d1"}))},y=l.PluginMoreMenuItem||u.PluginMoreMenuItem,f={subscription:null,cacheElements:function(){var e=this;e.cache={},e.cache.gutenberg=document.getElementById("editor");var t=document.getElementById("templately-gutenberg-button-switch-mode"),n=document.createElement("div");n.innerHTML=t?t.innerHTML:"",e.cache.switchMode=n,e.cache.switchGutenbergButton=n.querySelector("#templately-gutenberg-button"),e.cache.templateSaveButton=n.querySelector("#templately-cloud-push"),e.bindEvents(),e.subscribe()},subscribe:function(){var e=this;e.subscription||(e.subscription=wp.data.subscribe(function(){setTimeout(function(){e.buildPanel()},1)}))},unsubscribe:function(){this.subscription&&(this.subscription(),this.subscription=null)},buildPanel:function(){var e=this;if("yes"!==templately.hide_buttons){if(e.cache.gutenberg&&!e.cache.gutenberg.querySelector("#templately-gutenberg-buttons")){var t=e.cache.gutenberg.querySelector(".edit-post-header-toolbar");t&&t.children.length>0&&t.children[0].after(e.cache.switchMode)}}else e.removePanel()},removePanel:function(){var e=this.cache.gutenberg&&this.cache.gutenberg.querySelector("#templately-gutenberg-buttons");e&&e.remove()},bindEvents:function(){var e=this;e.cache.switchGutenbergButton&&e.cache.switchGutenbergButton.addEventListener("click",function(){window.TemplatelyAppManager.open({route:"gutenberg/pages"},"templately-gutenberg","gutenberg")}),e.cache.templateSaveButton&&e.cache.templateSaveButton.addEventListener("click",function(){window.TemplatelyAppManager.open({route:"clouds/save-template"},"templately-gutenberg","gutenberg")})},init:function(){if(this.cacheElements(),"templately_library"===templately.post_type){var e=new Set(["core/post-content","core/template-part"]);try{(0,o.addFilter)("blockEditor.__unstableCanInsertBlockType","removePostContentFromInserter",function(t,n){return e.has(n.name)||t},100)}catch(e){}}}};window.TemplatelyGutenbergApp=f,a()(function(){f.init();var e=new URL(document.location.href);if("1"===e.searchParams.get("templately_open_modal")){var t=e.searchParams.get("path");e.searchParams.delete("templately_open_modal"),e.searchParams.delete("templately_google_login"),e.searchParams.delete("templately_error"),e.searchParams.delete("error_message"),window.history.replaceState({},document.title,e.toString()),window.TemplatelyAppManager.open({route:t||"gutenberg/pages"},"templately-gutenberg","gutenberg")}}),(0,c.registerPlugin)("templately-gutenberg-hide-buttons",{render:function(){var e=n((0,p.useState)(!1),2),t=e[0],r=e[1],a=n((0,p.useState)("yes"===templately.hide_buttons?"yes":"no"),2),o=a[0],l=a[1];return React.createElement(y,{icon:React.createElement(g,{width:"20",height:"20"}),onClick:function(){r(!0);var e="yes"===o?"no":"yes";templately.hide_buttons=e,"yes"===e?(f.unsubscribe(),f.removePanel()):(f.subscribe(),f.buildPanel(),setTimeout(function(){f.buildPanel()},1));var t=(0,m.addQueryArgs)(ajaxurl,{action:"update_gutenberg_hide_buttons",hide_buttons:e,nonce:templately.nonce});d()({url:t,method:"GET"}).then(function(t){l(e)}).catch(function(e){}).finally(function(){r(!1)})},disabled:t},"yes"===o?(0,i.__)("Show Templately Buttons"):(0,i.__)("Hide Templately Buttons"))}})})(); |
|
1
|
+(()=>{"use strict";var e={7676(e,t,r){var n=r(8481),a=r(3850),o=r(9280),c=r.n(o),i=r(9006);const u=window.wp.hooks,s=window.wp.data,l=window.wp.plugins;var p=r(7723);const d=window.wp.editor,h=window.wp.editPost;var f,b=r(1609),v=r(873),g=r(7643),y=r(774),m=r(1455),w=r.n(m),x=r(3832),O=r(8114),_=r(6595),P=r(9780),k=r(1268),S=["path"],j=["categories"];function T(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function A(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?T(Object(r),!0).forEach(function(t){(0,v.A)(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):T(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var E=null===(f=window.templately)||void 0===f?void 0:f.rest_args,M=(window.templatelyDeveloper||{}).log,B=void 0!==M&&M;E&&(w().use(w().createNonceMiddleware(E.nonce)),w().use(w().createRootURLMiddleware(E.endpoint)));var C=function(e){window.__templatelySource__=e},R=function(){return"undefined"!=typeof window&&window.__templatelySource__||null},I=["true","1","yes","on"];function q(e,t){try{var r,n,a=null==e||null===(r=e.headers)||void 0===r||null===(n=r.get)||void 0===n?void 0:n.call(r,t);return!!a&&I.includes(String(a).toLowerCase())}catch(e){return!1}}function D(e){var t,r;q(e,"X-Templately-Verified")&&(null===(t=null)||void 0===t||t()),q(e,"X-Templately-Disconnected")&&(null===(r=null)||void 0===r||r())}function L(_x){return N.apply(this,arguments)}function N(){return(N=(0,n.A)(c().mark(function e(t){var r;return c().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(204!==t.status){e.next=1;break}return e.abrupt("return",null);case 1:return e.prev=1,e.next=2,t.text();case 2:r=e.sent,e.next=4;break;case 3:return e.prev=3,e.catch(1),e.abrupt("return",null);case 4:if(""!==r){e.next=5;break}return e.abrupt("return","");case 5:return e.prev=5,e.abrupt("return",JSON.parse(r));case 6:return e.prev=6,e.catch(5),e.abrupt("return",r);case 7:case"end":return e.stop()}},e,null,[[1,3],[5,6]])}))).apply(this,arguments)}function G(e){return!e||"object"!==(0,y.A)(e)||Array.isArray(e)?e:!0===e.success&&"data"in e?e.data:e}var F=function(e){var t;return"retry_again"===(null==e?void 0:e.code)||"retry_again"===(null==e||null===(t=e.context)||void 0===t?void 0:t.legacy_code)};function U(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return F(e)?e:(0,O.cQ)(e,{status:t})}function H(e,t){var r;return F(e)?e:null!==(r=(0,O.Dk)(e,t))&&void 0!==r?r:(0,O.cQ)(e,{status:t})}var J=function(){var e=(0,n.A)(c().mark(function e(t){var r,n,a,o,i,u,s,l;return c().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.path,n=(0,g.A)(t,S),r){e.next=1;break}throw new Error('secureApiFetch: Request options must include a "path" property.');case 1:return a=A(A({},n),{},{path:r,parse:!1}),(r.startsWith("http")||r.includes("/wp-admin/admin-ajax.php"))&&(a.url=r,delete a.path),e.prev=2,e.next=3,w()(a);case 3:o=e.sent,e.next=7;break;case 4:if(e.prev=4,D(s=e.catch(2)),!s||"function"!=typeof s.text){e.next=6;break}return l=H,e.next=5,L(s);case 5:throw l(e.sent,s.status);case 6:throw U(s);case 7:return D(o),e.next=8,L(o);case 8:if(i=e.sent,u=o.status,!(0,P.lO)(i)){e.next=9;break}throw H(i,u);case 9:if(!(u<200||u>=300)){e.next=10;break}throw H(i,u);case 10:if("string"!=typeof i||""===i){e.next=11;break}throw H(i,u);case 11:return e.abrupt("return",G(i));case 12:case"end":return e.stop()}},e,null,[[2,4]])}));return function(t){return e.apply(this,arguments)}}();function Q(e,t,r){var n=A({path:e,method:"POST",headers:{"Content-Type":"application/json"}},r);if(R()&&(n.headers=A(A({},n.headers),{},{"X-Templately-Source":R()})),!t)return n;if("GET"===n.method){var a=t,o=a.categories,c=(0,g.A)(a,j),i=(0,x.addQueryArgs)(n.path,c);void 0!==o&&(i+="".concat(i.includes("?")?"&":"?","categories=").concat(o)),n.path=i}else n.data=t;return n}function X(e,t,r){return $.apply(this,arguments)}function $(){return($=(0,n.A)(c().mark(function e(t,r,n){var a,o,i,u,s;return c().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:a=0;case 1:return e.prev=2,e.next=3,J(t);case 3:return e.abrupt("return",e.sent);case 4:if(e.prev=4,s=e.catch(2),!F(s)&&null!=s&&s.code&&null!=s&&s.severity){e.next=5;break}throw s;case 5:if(o=(0,_.Sc)(s,a,r,n),i=o.retry,u=o.delay,i){e.next=6;break}throw s;case 6:return a+=1,e.next=7,(0,_.uk)(u);case 7:e.next=1;break;case 8:case"end":return e.stop()}},e,null,[[2,4]])}))).apply(this,arguments)}var V=new Map,W=function(e){try{return"function"==typeof structuredClone?structuredClone(e):void 0===e?e:JSON.parse(JSON.stringify(e))}catch(t){return e}};function z(e,t,r){var n;if("GET"!==t||e.signal)return X(e,t,r);var a=String(null!==(n=e.url)&&void 0!==n?n:e.path),o=V.get(a);if(o)return o.then(W);var c=X(e,t,r);return V.set(a,c),c.catch(function(){}).finally(function(){V.get(a)===c&&V.delete(a)}),c}function K(e,t,r,n){return Y.apply(this,arguments)}function Y(){return(Y=(0,n.A)(c().mark(function e(t,r,n,a){var o,i,u,s,l,p,d;return c().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i=Q(t,r,n),u=String(null!==(o=i.method)&&void 0!==o?o:"POST").toUpperCase(),s=!0===n.retry,!a){e.next=1;break}return e.abrupt("return",z(i,u,s));case 1:return e.prev=1,e.next=2,z(i,u,s);case 2:p=e.sent,l={response:p,error:void 0},e.next=5;break;case 3:if(e.prev=3,d=e.catch(1),!F(d)){e.next=4;break}throw d;case 4:l={response:void 0,error:d};case 5:return B&&console.log("Templately API Return: ",t,l),e.abrupt("return",l);case 6:case"end":return e.stop()}},e,null,[[1,3]])}))).apply(this,arguments)}var Z=function(){var e=(0,n.A)(c().mark(function e(t,r){var n,a,o,i,u=arguments;return c().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=u.length>2&&void 0!==u[2]?u[2]:{},a=u.length>3&&void 0!==u[3]&&u[3],e.prev=1,e.next=2,K(t,r,n,a);case 2:case 6:return e.abrupt("return",e.sent);case 3:if(e.prev=3,o=e.catch(1),F(o)){e.next=4;break}throw o;case 4:return e.next=5,(0,k.uq)();case 5:return e.prev=5,e.next=6,K(t,r,n,a);case 7:if(e.prev=7,i=e.catch(5),!a){e.next=8;break}throw i;case 8:return e.abrupt("return",{response:void 0,error:U(i)});case 9:case"end":return e.stop()}},e,null,[[1,3],[5,7]])}));return function(t,r){return e.apply(this,arguments)}}(),ee=r(9731),te=r(3050),re=d.PluginMoreMenuItem||h.PluginMoreMenuItem,ne={subscription:null,cacheElements:function(){var e=this;e.cache={},e.cache.gutenberg=document.getElementById("editor");var t=document.getElementById("templately-gutenberg-button-switch-mode"),r=document.createElement("div");r.innerHTML=t?t.innerHTML:"",e.cache.switchMode=r,e.cache.switchGutenbergButton=r.querySelector("#templately-gutenberg-button"),e.cache.templateSaveButton=r.querySelector("#templately-cloud-push"),e.bindEvents(),e.subscribe()},subscribe:function(){var e=this;e.subscription||(e.subscription=wp.data.subscribe(function(){setTimeout(function(){e.buildPanel()},1)}))},unsubscribe:function(){this.subscription&&(this.subscription(),this.subscription=null)},buildPanel:function(){var e=this;if("yes"!==templately.hide_buttons){if(e.cache.gutenberg&&!e.cache.gutenberg.querySelector("#templately-gutenberg-buttons")){var t=e.cache.gutenberg.querySelector(".edit-post-header-toolbar");t&&t.children.length>0&&t.children[0].after(e.cache.switchMode)}}else e.removePanel()},removePanel:function(){var e=this.cache.gutenberg&&this.cache.gutenberg.querySelector("#templately-gutenberg-buttons");e&&e.remove()},bindEvents:function(){var e=this;e.cache.switchGutenbergButton&&e.cache.switchGutenbergButton.addEventListener("click",function(){var e,t=!1;try{t=(0,s.select)("core/block-editor").getBlocks().length>0}catch(e){}var r=(0,ee.x6)({pref:null===(e=window.templately)||void 0===e?void 0:e.editor_default_tab,lastTab:(0,ee.kj)(),hasContent:t});C("editor-toolbar"),window.TemplatelyAppManager.open({route:"gutenberg/".concat(r)},"templately-gutenberg","gutenberg")}),e.cache.templateSaveButton&&e.cache.templateSaveButton.addEventListener("click",function(){C("editor-cloud-save"),window.TemplatelyAppManager.open({route:"clouds/save-template"},"templately-gutenberg","gutenberg")})},init:function(){if(this.cacheElements(),"templately_library"===templately.post_type){var e=new Set(["core/post-content","core/template-part"]);try{(0,u.addFilter)("blockEditor.__unstableCanInsertBlockType","removePostContentFromInserter",function(t,r){return e.has(r.name)||t},100)}catch(e){}}}};window.TemplatelyGutenbergApp=ne,(0,i.u)(function(){ne.init();var e=new URL(document.location.href);if("1"===e.searchParams.get("templately_open_modal")){var t=e.searchParams.get("path");e.searchParams.delete("templately_open_modal"),e.searchParams.delete("templately_google_login"),e.searchParams.delete("templately_error"),e.searchParams.delete("error_message"),window.history.replaceState({},document.title,e.toString()),window.TemplatelyAppManager.open({route:t||"gutenberg/pages"},"templately-gutenberg","gutenberg")}}),(0,l.registerPlugin)("templately-gutenberg-hide-buttons",{render:function(){var e=(0,b.useState)(!1),t=(0,a.A)(e,2),r=t[0],o=t[1],i=(0,b.useState)("yes"===templately.hide_buttons?"yes":"no"),u=(0,a.A)(i,2),s=u[0],l=u[1],d=function(){var e=(0,n.A)(c().mark(function e(){var t;return c().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return o(!0),t="yes"===s?"no":"yes",templately.hide_buttons=t,"yes"===t?(ne.unsubscribe(),ne.removePanel()):(ne.subscribe(),ne.buildPanel(),setTimeout(function(){ne.buildPanel()},1)),e.next=1,Z("/templately/v1/gutenberg/visibility",{visibility:"yes"===t?"hidden":"visible"});case 1:e.sent.error||l(t),o(!1);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}();return React.createElement(re,{icon:React.createElement(te.f,{width:"20",height:"20"}),onClick:d,disabled:r},"yes"===s?(0,p.__)("Show Templately Buttons"):(0,p.__)("Hide Templately Buttons"))}})},1609(e){e.exports=window.React},9280(e){e.exports=window.regeneratorRuntime},1455(e){e.exports=window.wp.apiFetch},7723(e){e.exports=window.wp.i18n},3832(e){e.exports=window.wp.url}};const t={};function r(n){const a=t[n];if(void 0!==a)return a.exports;const o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}r.m=e,(()=>{const e=[];r.O=(t,n,a,o)=>{if(n){o=o||0;for(var c=e.length;c>0&&e[c-1][2]>o;c--)e[c]=e[c-1];return void(e[c]=[n,a,o])}let i=1/0;for(c=0;c<e.length;c++){let[n,a,o]=e[c],s=!0;for(var u=0;u<n.length;u++)(!1&o||i>=o)&&Object.keys(r.O).every(e=>r.O[e](n[u]))?n.splice(u--,1):(s=!1,o<i&&(i=o));if(s){e.splice(c--,1);const r=a();void 0!==r&&(t=r)}}return t}})(),r.n=e=>{const t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},(()=>{const e=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__;let t;r.t=function(n,a){if(1&a&&(n=this(n)),8&a)return n;if("object"==typeof n&&n){if(4&a&&n.__esModule)return n;if(16&a&&"function"==typeof n.then)return n}const o=Object.create(null);r.r(o);const c={};t=t||[null,e({}),e([]),e(e)];for(var i=2&a&&n;("object"==typeof i||"function"==typeof i)&&!~t.indexOf(i);i=e(i))Object.getOwnPropertyNames(i).forEach(e=>c[e]=()=>n[e]);return c.default=()=>n,r.d(o,c),o}})(),r.d=(e,t)=>{if(Array.isArray(t))for(var n=0;n<t.length;){var a=t[n++],o=t[n++];r.o(e,a)?0===o&&n++:0===o?Object.defineProperty(e,a,{enumerable:!0,value:t[n++]}):Object.defineProperty(e,a,{enumerable:!0,get:o})}else for(var a in t)r.o(t,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},r.o=(e,t)=>Object.hasOwn(e,t),r.r=e=>{Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.j=846,r.cjs=e=>{const t={exports:{}};return e.call(t.exports,t,t.exports),t.exports},(()=>{let e;globalThis.importScripts&&(e=globalThis.location+"");const t=globalThis.document;if(!e&&t&&("SCRIPT"===t.currentScript?.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){const r=t.getElementsByTagName("script");if(r.length){let t=r.length-1;for(;t>-1&&(!e||!/^http(s?):/.test(e));)e=r[t--].src}}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),r.p=e+"../"})(),(()=>{const e={846:0};r.O.j=t=>0===e[t];const t=(t,n)=>{let[a,o,c]=n;var i,u,s=0;if(a.some(t=>0!==e[t])){for(i in o)r.o(o,i)&&(r.m[i]=o[i]);if(c)var l=c(r)}for(t&&t(n);s<a.length;s++)u=a[s],r.o(e,u)&&e[u]&&e[u][0](),e[u]=0;return r.O(l)},n=globalThis.webpackChunktemplately||=[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})(),r.nc=void 0;let n=r.O(void 0,[113],()=>r(7676));n=r.O(n)})(); |