PluginProbe
Code Snippets / 4.0.0-beta.2
Code Snippets v4.0.0-beta.2
4.0.0-beta.2 3.10.2 3.10.1 3.10.0 3.10.0-beta.2 3.10.0-beta.1 4.0.0-beta.1 3.9.6 trunk 2.10.0 2.10.1 2.12.0 2.12.1 2.13.0 2.13.1 2.13.2 2.13.3 2.14.0 2.14.1 2.14.2 2.14.3 2.14.4 2.14.5 2.14.6 3.0.0 All 65 releases
← All changes | dist/manage.js +1 -1 3.10.2 → 4.0.0-beta.2 View file →
@@ -1,2 +1,2 @@
1 1 /*! For license information please see manage.js.LICENSE.txt */
2 -(()=>{var e={5172(e){e.exports=function(e,t){this.v=e,this.k=t},e.exports.__esModule=!0,e.exports.default=e.exports},6993(e,t,n){var r=n(5546);function s(){var t,n,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.toStringTag||"@@toStringTag";function c(e,s,o,i){var a=s&&s.prototype instanceof u?s:u,c=Object.create(a.prototype);return r(c,"_invoke",function(e,r,s){var o,i,a,c=0,u=s||[],d=!1,p={p:0,n:0,v:t,a:f,f:f.bind(t,4),d:function(e,n){return o=e,i=0,a=t,p.n=n,l}};function f(e,r){for(i=e,a=r,n=0;!d&&c&&!s&&n<u.length;n++){var s,o=u[n],f=p.p,h=o[2];e>3?(s=h===r)&&(a=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=t):o[0]<=f&&((s=e<2&&f<o[1])?(i=0,p.v=r,p.n=o[1]):f<h&&(s=e<3||o[0]>r||r>h)&&(o[4]=e,o[5]=r,p.n=h,i=0))}if(s||e>1)return l;throw d=!0,r}return function(s,u,h){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&f(u,h),i=u,a=h;(n=i<2?t:a)||!d;){o||(i?i<3?(i>1&&(p.n=-1),f(i,a)):p.n=a:p.v=a);try{if(c=2,o){if(i||(s="next"),n=o[s]){if(!(n=n.call(o,a)))throw TypeError("iterator result is not an object");if(!n.done)return n;a=n.value,i<2&&(i=0)}else 1===i&&(n=o.return)&&n.call(o),i<2&&(a=TypeError("The iterator does not provide a '"+s+"' method"),i=1);o=t}else if((n=(d=p.n<0)?a:e.call(r,p))!==l)break}catch(e){o=t,i=1,a=e}finally{c=1}}return{value:n,done:d}}}(e,o,i),!0),c}var l={};function u(){}function d(){}function p(){}n=Object.getPrototypeOf;var f=[][i]?n(n([][i]())):(r(n={},i,function(){return this}),n),h=p.prototype=u.prototype=Object.create(f);function m(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,r(e,a,"GeneratorFunction")),e.prototype=Object.create(h),e}return d.prototype=p,r(h,"constructor",p),r(p,"constructor",d),d.displayName="GeneratorFunction",r(p,a,"GeneratorFunction"),r(h),r(h,a,"Generator"),r(h,i,function(){return this}),r(h,"toString",function(){return"[object Generator]"}),(e.exports=s=function(){return{w:c,m}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=s,e.exports.__esModule=!0,e.exports.default=e.exports},5869(e,t,n){var r=n(887);e.exports=function(e,t,n,s,o){var i=r(e,t,n,s,o);return i.next().then(function(e){return e.done?e.value:i.next()})},e.exports.__esModule=!0,e.exports.default=e.exports},887(e,t,n){var r=n(6993),s=n(1791);e.exports=function(e,t,n,o,i){return new s(r().w(e,t,n,o),i||Promise)},e.exports.__esModule=!0,e.exports.default=e.exports},1791(e,t,n){var r=n(5172),s=n(5546);e.exports=function e(t,n){function o(e,s,i,a){try{var c=t[e](s),l=c.value;return l instanceof r?n.resolve(l.v).then(function(e){o("next",e,i,a)},function(e){o("throw",e,i,a)}):n.resolve(l).then(function(e){c.value=e,i(c)},function(e){return o("throw",e,i,a)})}catch(e){a(e)}}var i;this.next||(s(e.prototype),s(e.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),s(this,"_invoke",function(e,t,r){function s(){return new n(function(t,n){o(e,r,t,n)})}return i=i?i.then(s,s):s()},!0)},e.exports.__esModule=!0,e.exports.default=e.exports},5546(e){function t(n,r,s,o){var i=Object.defineProperty;try{i({},"",{})}catch(n){i=0}e.exports=t=function(e,n,r,s){function o(n,r){t(e,n,function(e){return this._invoke(n,r,e)})}n?i?i(e,n,{value:r,enumerable:!s,configurable:!s,writable:!s}):e[n]=r:(o("next",0),o("throw",1),o("return",2))},e.exports.__esModule=!0,e.exports.default=e.exports,t(n,r,s,o)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4373(e){e.exports=function(e){var t=Object(e),n=[];for(var r in t)n.unshift(r);return function e(){for(;n.length;)if((r=n.pop())in t)return e.value=r,e.done=!1,e;return e.done=!0,e}},e.exports.__esModule=!0,e.exports.default=e.exports},4633(e,t,n){var r=n(5172),s=n(6993),o=n(5869),i=n(887),a=n(1791),c=n(4373),l=n(579);function u(){"use strict";var t=s(),n=t.m(u),d=(Object.getPrototypeOf?Object.getPrototypeOf(n):n.__proto__).constructor;function p(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))}var f={throw:1,return:2,break:3,continue:3};function h(e){var t,n;return function(r){t||(t={stop:function(){return n(r.a,2)},catch:function(){return r.v},abrupt:function(e,t){return n(r.a,f[e],t)},delegateYield:function(e,s,o){return t.resultName=s,n(r.d,l(e),o)},finish:function(e){return n(r.f,e)}},n=function(e,n,s){r.p=t.prev,r.n=t.next;try{return e(n,s)}finally{t.next=r.n}}),t.resultName&&(t[t.resultName]=r.v,t.resultName=void 0),t.sent=r.v,t.next=r.n;try{return e.call(this,t)}finally{r.p=t.prev,r.n=t.next}}}return(e.exports=u=function(){return{wrap:function(e,n,r,s){return t.w(h(e),n,r,s&&s.reverse())},isGeneratorFunction:p,mark:t.m,awrap:function(e,t){return new r(e,t)},AsyncIterator:a,async:function(e,t,n,r,s){return(p(t)?i:o)(h(e),t,n,r,s)},keys:c,values:l}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=u,e.exports.__esModule=!0,e.exports.default=e.exports},579(e,t,n){var r=n(3738).default;e.exports=function(e){if(null!=e){var t=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}throw new TypeError(r(e)+" is not iterable")},e.exports.__esModule=!0,e.exports.default=e.exports},3738(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4756(e,t,n){var r=n(4633)();e.exports=r;try{regeneratorRuntime=r}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},6942(e,t){var n;!function(){"use strict";var r={}.hasOwnProperty;function s(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=i(e,o(n)))}return e}function o(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return s.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var n in e)r.call(e,n)&&e[n]&&(t=i(t,n));return t}function i(e,t){return t?e?e+" "+t:e+t:e}e.exports?(s.default=s,e.exports=s):void 0===(n=function(){return s}.apply(t,[]))||(e.exports=n)}()}},t={};function n(r){var s=t[r];if(void 0!==s)return s.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{"use strict";var 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 r(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}}function s(e,t){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,s,o,i,a=[],c=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(a.push(r.value),a.length!==t);c=!0);}catch(e){l=!0,s=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw s}}return a}}(e,t)||r(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.")}()}n.r(e),n.d(e,{hasBrowserEnv:()=>vt,hasStandardBrowserEnv:()=>yt,hasStandardBrowserWebWorkerEnv:()=>jt,navigator:()=>gt,origin:()=>wt});const o=window.React,i=window.wp.i18n,a=window.wp.element;function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}const l=window.wp.url;var u=function(e){var t;return null!==(t=new URLSearchParams(window.location.search).get(e))&&void 0!==t?t:void 0},d=function(e){if("URLSearchParams"in window){for(var t=new URLSearchParams(window.location.search),n=0,r=Object.entries(e);n<r.length;n++){var o=s(r[n],2),i=o[0],a=o[1];a?t.set(i,String(a)):t.delete(i)}var c=window.location.toString().replace(window.location.search,"?".concat(t.toString()));window.history.replaceState({},document.title,c)}},p=function(e){switch(!0){case null==e:return;case"boolean"==typeof e:return e?"1":"0";case"number"==typeof e:case"string"==typeof e:return String(e);default:throw new Error("Unsupported query arg type: ".concat(c(e)))}},f=function(e,t){for(var n={},r=0,o=Object.entries(t);r<o.length;r++){var i=s(o[r],2),a=i[0],c=i[1],u=p(c);void 0!==u&&(n[a]=u)}return(0,l.addQueryArgs)(e,n)};function h(e,t,n){return(t=function(e){var t=function(e){if("object"!=c(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=c(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==c(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function m(e,t){if(null==e)return{};var n,r,s=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}var b=n(6942),v=n.n(b);const g=window.ReactJSXRuntime;var y=["className","type","children"],j=["className","onDismiss","children"];function w(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function x(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?w(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):w(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var _=function(e){return"error"===e||"warning"===e},O=function(e){var t=e.className,n=e.type,r=e.children,s=m(e,y);return(0,g.jsx)("div",x(x({className:v()("notice","code-snippets-notice",h({},"notice-".concat(n),n),t),role:_(n)?"alert":"status","aria-live":_(n)?"assertive":"polite"},s),{},{children:r}))},S=function(e){var t=e.className,n=e.onDismiss,r=e.children,s=m(e,j);return(0,g.jsxs)(O,x(x({className:v()("is-dismissible",t)},s),{},{children:[r,(0,g.jsx)("button",{type:"button",className:"notice-dismiss",onClick:function(e){e.preventDefault(),n()},children:(0,g.jsx)("span",{className:"screen-reader-text",children:(0,i.__)("Dismiss notice.","code-snippets")})})]}))},P=function(){var e;return!0===(null===(e=window.pagenow)||void 0===e?void 0:e.endsWith("-network"))},N=function(){var e;return!(null===(e=window.CODE_SNIPPETS)||void 0===e||!e.isLicensed)},E=function(){var e;return!(N()||null!==(e=window.CODE_SNIPPETS)&&void 0!==e&&e.hideUpsell)};function C(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function k(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?C(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):C(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var D=function(e){return(0,g.jsx)("svg",k(k({width:"26",height:"26",viewBox:"0 0 26 26",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{},{children:(0,g.jsx)("path",{stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",d:"M19.499 17.334a2.167 2.167 0 1 1-2.167 2.167m2.167-2.167a2.167 2.167 0 0 0-2.167 2.167m2.167-2.167V8.667m-2.167 10.834H8.665m0 0A2.167 2.167 0 0 0 6.5 17.334m2.166 2.167A2.167 2.167 0 1 1 6.5 17.334m0 0V8.667m2.166-2.166A2.167 2.167 0 1 0 6.5 8.667m2.166-2.166A2.167 2.167 0 0 1 6.5 8.667m2.166-2.166h8.667m0 0a2.167 2.167 0 1 1 2.167 2.166m-2.167-2.166a2.167 2.167 0 0 0 2.167 2.166M8.124 8.126l9.75 9.75m-9.75 0 9.75-9.75"})}))};function A(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function T(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?A(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):A(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var R=function(e){return(0,g.jsx)("svg",T(T({width:"26",height:"26",viewBox:"0 0 26 26",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{},{children:(0,g.jsx)("path",{d:"M20.0417 20.0417L22.75 22.75M4.33333 6.5H21.6667M4.33333 13H8.66666M4.33333 19.5H8.66666M11.9167 16.25C11.9167 17.3993 12.3732 18.5015 13.1859 19.3141C13.9985 20.1268 15.1007 20.5833 16.25 20.5833C17.3993 20.5833 18.5015 20.1268 19.3141 19.3141C20.1268 18.5015 20.5833 17.3993 20.5833 16.25C20.5833 15.1007 20.1268 13.9985 19.3141 13.1859C18.5015 12.3732 17.3993 11.9167 16.25 11.9167C15.1007 11.9167 13.9985 12.3732 13.1859 13.1859C12.3732 13.9985 11.9167 15.1007 11.9167 16.25Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}))};function I(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function L(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?I(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):I(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var F=function(e){return(0,g.jsx)("svg",L(L({width:"26",height:"26",viewBox:"0 0 26 26",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{},{children:(0,g.jsx)("path",{d:"M11.9167 19.5045H7.21175C4.42541 19.5002 2.16666 17.326 2.16666 14.6436C2.16666 11.9624 4.42541 9.78812 7.21175 9.78812C7.6375 7.87928 9.15525 6.32145 11.193 5.7007C13.2297 5.08103 15.4787 5.49162 17.0907 6.78403C18.7027 8.0732 19.4328 10.0416 19.0082 11.9505H20.0807C20.8821 11.9519 21.6621 12.2097 22.3067 12.686C22.9513 13.1624 23.4266 13.8324 23.6632 14.5981M21.6667 22.7502L23.8333 20.5835L21.6667 18.4169M18.4167 18.4169L16.25 20.5835L18.4167 22.7502",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}))};function M(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function U(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?M(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):M(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var B=function(e){return(0,g.jsxs)("svg",U(U({width:"26",height:"26",viewBox:"0 0 26 26",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{},{children:[(0,g.jsx)("path",{d:"M11.1854 4.67675C11.6469 2.77442 14.3531 2.77442 14.8146 4.67675C14.8838 4.96253 15.0196 5.22793 15.2108 5.45133C15.402 5.67474 15.6432 5.84984 15.9149 5.96239C16.1865 6.07494 16.4809 6.12176 16.7741 6.09902C17.0673 6.07629 17.3509 5.98466 17.602 5.83158C19.2736 4.81325 21.1878 6.72642 20.1695 8.39908C20.0166 8.65004 19.9252 8.93353 19.9025 9.2265C19.8798 9.51948 19.9266 9.81367 20.039 10.0852C20.1514 10.3567 20.3263 10.5978 20.5495 10.789C20.7726 10.9802 21.0377 11.116 21.3233 11.1854C23.2256 11.6469 23.2256 14.3531 21.3233 14.8146C21.0375 14.8838 20.7721 15.0196 20.5487 15.2108C20.3253 15.402 20.1502 15.6432 20.0376 15.9149C19.9251 16.1865 19.8782 16.4809 19.901 16.7741C19.9237 17.0673 20.0153 17.3509 20.1684 17.602C21.1868 19.2736 19.2736 21.1878 17.6009 20.1695C17.35 20.0166 17.0665 19.9252 16.7735 19.9025C16.4805 19.8798 16.1863 19.9266 15.9148 20.039C15.6433 20.1514 15.4022 20.3263 15.211 20.5495C15.0198 20.7726 14.884 21.0377 14.8146 21.3233C14.3531 23.2256 11.6469 23.2256 11.1854 21.3233C11.1162 21.0375 10.9804 20.7721 10.7892 20.5487C10.598 20.3253 10.3568 20.1502 10.0851 20.0376C9.81347 19.9251 9.51907 19.8782 9.2259 19.901C8.93273 19.9237 8.64907 20.0153 8.398 20.1684C6.72642 21.1868 4.81217 19.2736 5.8305 17.6009C5.98336 17.35 6.07485 17.0665 6.09752 16.7735C6.1202 16.4805 6.07343 16.1863 5.96101 15.9148C5.84859 15.6433 5.6737 15.4022 5.45055 15.211C5.22739 15.0198 4.96228 14.884 4.67675 14.8146C2.77442 14.3531 2.77442 11.6469 4.67675 11.1854C4.96253 11.1162 5.22793 10.9804 5.45133 10.7892C5.67474 10.598 5.84984 10.3568 5.96239 10.0851C6.07494 9.81347 6.12176 9.51907 6.09902 9.2259C6.07629 8.93273 5.98466 8.64907 5.83158 8.398C4.81325 6.72642 6.72642 4.81217 8.39908 5.8305C9.48242 6.48917 10.8864 5.90633 11.1854 4.67675Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,g.jsx)("path",{d:"M9.75 13C9.75 13.862 10.0924 14.6886 10.7019 15.2981C11.3114 15.9076 12.138 16.25 13 16.25C13.862 16.25 14.6886 15.9076 15.2981 15.2981C15.9076 14.6886 16.25 13.862 16.25 13C16.25 12.138 15.9076 11.3114 15.2981 10.7019C14.6886 10.0924 13.862 9.75 13 9.75C12.138 9.75 11.3114 10.0924 10.7019 10.7019C10.0924 11.3114 9.75 12.138 9.75 13Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}))};function V(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function q(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?V(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):V(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var W=function(e){return(0,g.jsx)("svg",q(q({width:"26",height:"26",viewBox:"0 0 26 26",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{},{children:(0,g.jsx)("path",{d:"M7.58333 8.66634L3.25 12.9997L7.58333 17.333M18.4167 8.66634L22.75 12.9997L18.4167 17.333M15.1667 4.33301L10.8333 21.6663",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}))};const H=window.wp.components;var K=function(e){var t,n=e.isOpen,r=e.setIsOpen;return n?(0,g.jsxs)(H.Modal,{"aria-labelledby":"code-snippets-upsell-dialog-title",className:"code-snippets-upsell code-snippets-upsell-dialog",onRequestClose:function(){r(!1)},children:[(0,g.jsx)("img",{src:"".concat(null===(t=window.CODE_SNIPPETS)||void 0===t?void 0:t.urls.plugin,"/assets/icon.svg"),alt:(0,i.__)("Code Snippets logo","code-snippets")}),(0,g.jsx)(z,{})]}):null},z=function(){return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("h1",{id:"code-snippets-upsell-dialog-title",children:(0,a.createInterpolateElement)((0,i.__)("Unlock all cloud sync features and many more, with <span>Code Snippets Pro</span>","code-snippets"),{span:(0,g.jsx)("span",{})})}),(0,g.jsx)("p",{children:(0,a.createInterpolateElement)((0,i.__)("With Code Snippets Pro you can connect your WordPress sites to the code snippets cloud platform and be able to <strong>backup, synchronise, collaborate, and deploy</strong> your snippets from one central location.","code-snippets"),{strong:(0,g.jsx)("strong",{})})}),(0,g.jsx)("a",{href:"https://codesnippets.pro/pricing/",className:"button button-primary button-large",rel:"noreferrer",target:"_blank",children:(0,i.__)("Explore Code Snippets Pro","code-snippets")}),(0,g.jsx)("p",{children:(0,i.__)("Here's what else you get with Pro:","code-snippets")}),(0,g.jsxs)("ul",{children:[(0,g.jsx)("li",{children:(0,i.__)("Create, explain and verify snippets with AI","code-snippets")}),(0,g.jsx)("li",{children:(0,i.__)("Control when snippets run with Conditions","code-snippets")}),(0,g.jsx)("li",{children:(0,i.__)("CSS stylesheet snippets","code-snippets")}),(0,g.jsx)("li",{children:(0,i.__)("Minified JavaScript snippets","code-snippets")}),(0,g.jsx)("li",{children:(0,i.__)("Editor blocks and Elementor widgets","code-snippets")}),(0,g.jsx)("li",{children:(0,i.__)("Cloud sync and backup","code-snippets")}),(0,g.jsx)("li",{children:(0,i.__)("Cloud share and deploy","code-snippets")}),(0,g.jsx)("li",{children:(0,i.__)("Cloud bundles and teams","code-snippets")}),(0,g.jsx)("li",{children:(0,i.__)("WP-CLI commands","code-snippets")}),(0,g.jsx)("li",{children:(0,i.__)("And much more!","code-snippets")})]})]})},G=function(){return(0,g.jsx)("div",{className:"code-snippets-upsell code-snippets-upsell-page",children:(0,g.jsx)(z,{})})};function $(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function J(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Q=["snippets","blueprints","cloud-community","cloud-library"],X=new URLSearchParams(window.location.search),Y=function(e){var t=e.name,n=e.url,r=e.label,s=(0,o.useMemo)(function(){return new URL(n).searchParams.get("page")},[n]),i=!X.get("subpage")&&X.get("page")===s;return(0,g.jsx)("li",{children:(0,g.jsx)("a",J(J({href:n,className:v()("".concat(t,"-link"),{"active-link":i})},!s&&{target:"_blank",rel:"noopener noreferrer"}),{},{children:r}))})},Z=function(){var e,t;return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(Y,{name:"docs",url:"https://codesnippets.pro/docs",label:(0,i.__)("Docs","code-snippets")}),(0,g.jsx)(Y,{name:"cloud",url:"https://codesnippets.cloud/",label:(0,i.__)("Cloud Dashboard","code-snippets")}),(null===(e=window.CODE_SNIPPETS)||void 0===e?void 0:e.urls.welcome)&&(0,g.jsx)(Y,{name:"welcome",url:window.CODE_SNIPPETS.urls.welcome,label:(0,i.__)("What's New","code-snippets")}),(null===(t=window.CODE_SNIPPETS)||void 0===t?void 0:t.urls.import)&&(0,g.jsx)(Y,{name:"import-snippets",url:window.CODE_SNIPPETS.urls.import,label:(0,i._x)("Import","snippets","code-snippets")})]})},ee=function(){return(0,g.jsx)("li",{className:"toolbar-more-item",children:(0,g.jsxs)("details",{className:"toolbar-more-menu",children:[(0,g.jsxs)("summary",{children:[(0,i.__)("More","code-snippets"),(0,g.jsx)("span",{className:"dashicons dashicons-arrow-down-alt2","aria-hidden":"true"})]}),(0,g.jsx)("ul",{children:(0,g.jsx)(Z,{})})]})})},te=function(){var e,t=s((0,o.useState)(!1),2),n=t[0],r=t[1];return(0,g.jsxs)("div",{className:"code-snippets-toolbar-upper",children:[(0,g.jsxs)("div",{className:"logo",children:[(0,g.jsx)("img",{src:"".concat(null===(e=window.CODE_SNIPPETS)||void 0===e?void 0:e.urls.plugin,"/assets/icon.svg"),alt:(0,i.__)("Code Snippets logo","code-snippets"),"aria-hidden":"true"}),(0,g.jsx)("div",{children:(0,i.__)("Code Snippets","code-snippets")})]}),(0,g.jsx)("nav",{"aria-label":(0,i.__)("Main links","code-snippets"),children:(0,g.jsxs)("ul",{children:[(0,g.jsx)(Z,{}),(0,g.jsx)(ee,{}),E()&&(0,g.jsx)("li",{className:"toolbar-upgrade-item",children:(0,g.jsx)("a",{className:"button button-large button-secondary",href:"https://codesnippets.pro/pricing/",target:"_blank",rel:"noopener noreferrer",onClick:function(e){e.preventDefault(),r(!0)},children:(0,i.__)("Upgrade to Pro","code-snippets")})})]})}),(0,g.jsx)(K,{isOpen:n,setIsOpen:r})]})},ne=function(e){var t,n=e.subpage,r=e.label,s=e.Icon,o=e.isPro;return(0,g.jsx)("li",{children:(0,g.jsxs)("a",{href:f(null===(t=window.CODE_SNIPPETS)||void 0===t?void 0:t.urls.manage,{subpage:n}),className:v()("".concat(n,"-link"),{"active-link":n===X.get("subpage")}),children:[(0,g.jsx)(s,{"aria-hidden":"true"}),(0,g.jsx)("span",{className:"toolbar-nav-label",children:r}),o&&!N()&&(0,g.jsx)("span",{className:"pro-chip",children:(0,i.__)("Pro","code-snippets")})]})})},re=function(){var e;return(0,g.jsx)("div",{className:"code-snippets-toolbar-lower",children:(0,g.jsx)("nav",{"aria-label":(0,i.__)("Main features","code-snippets"),children:(0,g.jsxs)("ul",{children:[(0,g.jsx)(ne,{subpage:"snippets",label:(0,i.__)("Snippets","code-snippets"),Icon:W}),N()&&(0,g.jsx)(ne,{subpage:"blueprints",label:(0,i.__)("Blueprints","code-snippets"),Icon:D}),(0,g.jsx)(ne,{subpage:"cloud-community",label:(0,i.__)("Cloud Community","code-snippets"),Icon:R}),(0,g.jsx)(ne,{subpage:"cloud-library",label:(0,i.__)("Cloud Library","code-snippets"),Icon:F,isPro:!0}),!N()&&(0,g.jsx)(ne,{subpage:"blueprints",label:(0,i.__)("Blueprints","code-snippets"),Icon:D,isPro:!0}),(null===(e=window.CODE_SNIPPETS)||void 0===e?void 0:e.urls.settings)&&(0,g.jsx)("li",{className:"toolbar-end-item",children:(0,g.jsxs)("a",{href:window.CODE_SNIPPETS.urls.settings,className:"settings-link",children:[(0,g.jsx)(B,{"aria-hidden":"true"}),(0,g.jsx)("span",{className:"toolbar-nav-label",children:(0,i.__)("Settings","code-snippets")})]})})]})})})},se=function(){return(0,g.jsxs)("div",{className:"code-snippets-toolbar",children:[(0,g.jsx)(te,{}),(0,g.jsx)(re,{})]})};function oe(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||r(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 ie(e,t,n,r,s,o,i){try{var a=e[o](i),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,s)}function ae(e){return function(){var t=this,n=arguments;return new Promise(function(r,s){var o=e.apply(t,n);function i(e){ie(o,r,s,i,a,"next",e)}function a(e){ie(o,r,s,i,a,"throw",e)}i(void 0)})}}var ce=n(4756),le=n.n(ce);function ue(e,t){return function(){return e.apply(t,arguments)}}const{toString:de}=Object.prototype,{getPrototypeOf:pe}=Object,{iterator:fe,toStringTag:he}=Symbol,me=(be=Object.create(null),e=>{const t=de.call(e);return be[t]||(be[t]=t.slice(8,-1).toLowerCase())});var be;const ve=e=>(e=e.toLowerCase(),t=>me(t)===e),ge=e=>t=>typeof t===e,{isArray:ye}=Array,je=ge("undefined");function we(e){return null!==e&&!je(e)&&null!==e.constructor&&!je(e.constructor)&&Oe(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const xe=ve("ArrayBuffer"),_e=ge("string"),Oe=ge("function"),Se=ge("number"),Pe=e=>null!==e&&"object"==typeof e,Ne=e=>{if("object"!==me(e))return!1;const t=pe(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||he in e||fe in e)},Ee=ve("Date"),Ce=ve("File"),ke=ve("Blob"),De=ve("FileList"),Ae=ve("URLSearchParams"),[Te,Re,Ie,Le]=["ReadableStream","Request","Response","Headers"].map(ve);function Fe(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,s;if("object"!=typeof e&&(e=[e]),ye(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(we(e))return;const s=n?Object.getOwnPropertyNames(e):Object.keys(e),o=s.length;let i;for(r=0;r<o;r++)i=s[r],t.call(null,e[i],i,e)}}function Me(e,t){if(we(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r,s=n.length;for(;s-- >0;)if(r=n[s],t===r.toLowerCase())return r;return null}const Ue="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,Be=e=>!je(e)&&e!==Ue,Ve=(qe="undefined"!=typeof Uint8Array&&pe(Uint8Array),e=>qe&&e instanceof qe);var qe;const We=ve("HTMLFormElement"),He=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Ke=ve("RegExp"),ze=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};Fe(n,(n,s)=>{let o;!1!==(o=t(n,s,e))&&(r[s]=o||n)}),Object.defineProperties(e,r)},Ge=ve("AsyncFunction"),$e=(Je="function"==typeof setImmediate,Qe=Oe(Ue.postMessage),Je?setImmediate:Qe?(Xe=`axios@${Math.random()}`,Ye=[],Ue.addEventListener("message",({source:e,data:t})=>{e===Ue&&t===Xe&&Ye.length&&Ye.shift()()},!1),e=>{Ye.push(e),Ue.postMessage(Xe,"*")}):e=>setTimeout(e));var Je,Qe,Xe,Ye;const Ze="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Ue):"undefined"!=typeof process&&process.nextTick||$e,et={isArray:ye,isArrayBuffer:xe,isBuffer:we,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||Oe(e.append)&&("formdata"===(t=me(e))||"object"===t&&Oe(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&xe(e.buffer),t},isString:_e,isNumber:Se,isBoolean:e=>!0===e||!1===e,isObject:Pe,isPlainObject:Ne,isEmptyObject:e=>{if(!Pe(e)||we(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:Te,isRequest:Re,isResponse:Ie,isHeaders:Le,isUndefined:je,isDate:Ee,isFile:Ce,isBlob:ke,isRegExp:Ke,isFunction:Oe,isStream:e=>Pe(e)&&Oe(e.pipe),isURLSearchParams:Ae,isTypedArray:Ve,isFileList:De,forEach:Fe,merge:function e(){const{caseless:t,skipUndefined:n}=Be(this)&&this||{},r={},s=(s,o)=>{if("__proto__"===o||"constructor"===o||"prototype"===o)return;const i=t&&Me(r,o)||o;Ne(r[i])&&Ne(s)?r[i]=e(r[i],s):Ne(s)?r[i]=e({},s):ye(s)?r[i]=s.slice():n&&je(s)||(r[i]=s)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&Fe(arguments[e],s);return r},extend:(e,t,n,{allOwnKeys:r}={})=>(Fe(t,(t,r)=>{n&&Oe(t)?Object.defineProperty(e,r,{value:ue(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,r,{value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let s,o,i;const a={};if(t=t||{},null==e)return t;do{for(s=Object.getOwnPropertyNames(e),o=s.length;o-- >0;)i=s[o],r&&!r(i,e,t)||a[i]||(t[i]=e[i],a[i]=!0);e=!1!==n&&pe(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:me,kindOfTest:ve,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(ye(e))return e;let t=e.length;if(!Se(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[fe]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:We,hasOwnProperty:He,hasOwnProp:He,reduceDescriptors:ze,freezeMethods:e=>{ze(e,(t,n)=>{if(Oe(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];Oe(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach(e=>{n[e]=!0})};return ye(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:Me,global:Ue,isContextDefined:Be,isSpecCompliantForm:function(e){return!!(e&&Oe(e.append)&&"FormData"===e[he]&&e[fe])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(Pe(e)){if(t.indexOf(e)>=0)return;if(we(e))return e;if(!("toJSON"in e)){t[r]=e;const s=ye(e)?[]:{};return Fe(e,(e,t)=>{const o=n(e,r+1);!je(o)&&(s[t]=o)}),t[r]=void 0,s}}return e};return n(e,0)},isAsyncFn:Ge,isThenable:e=>e&&(Pe(e)||Oe(e))&&Oe(e.then)&&Oe(e.catch),setImmediate:$e,asap:Ze,isIterable:e=>null!=e&&Oe(e[fe])};class tt extends Error{static from(e,t,n,r,s,o){const i=new tt(e.message,t||e.code,n,r,s);return i.cause=e,i.name=e.name,o&&Object.assign(i,o),i}constructor(e,t,n,r,s){super(e),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status)}toJSON(){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:et.toJSONObject(this.config),code:this.code,status:this.status}}}tt.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",tt.ERR_BAD_OPTION="ERR_BAD_OPTION",tt.ECONNABORTED="ECONNABORTED",tt.ETIMEDOUT="ETIMEDOUT",tt.ERR_NETWORK="ERR_NETWORK",tt.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",tt.ERR_DEPRECATED="ERR_DEPRECATED",tt.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",tt.ERR_BAD_REQUEST="ERR_BAD_REQUEST",tt.ERR_CANCELED="ERR_CANCELED",tt.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",tt.ERR_INVALID_URL="ERR_INVALID_URL";const nt=tt;function rt(e){return et.isPlainObject(e)||et.isArray(e)}function st(e){return et.endsWith(e,"[]")?e.slice(0,-2):e}function ot(e,t,n){return e?e.concat(t).map(function(e,t){return e=st(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const it=et.toFlatObject(et,{},null,function(e){return/^is[A-Z]/.test(e)}),at=function(e,t,n){if(!et.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=et.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!et.isUndefined(t[e])})).metaTokens,s=n.visitor||l,o=n.dots,i=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&et.isSpecCompliantForm(t);if(!et.isFunction(s))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(et.isDate(e))return e.toISOString();if(et.isBoolean(e))return e.toString();if(!a&&et.isBlob(e))throw new nt("Blob is not supported. Use a Buffer instead.");return et.isArrayBuffer(e)||et.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,n,s){let a=e;if(e&&!s&&"object"==typeof e)if(et.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(et.isArray(e)&&function(e){return et.isArray(e)&&!e.some(rt)}(e)||(et.isFileList(e)||et.endsWith(n,"[]"))&&(a=et.toArray(e)))return n=st(n),a.forEach(function(e,r){!et.isUndefined(e)&&null!==e&&t.append(!0===i?ot([n],r,o):null===i?n:n+"[]",c(e))}),!1;return!!rt(e)||(t.append(ot(s,n,o),c(e)),!1)}const u=[],d=Object.assign(it,{defaultVisitor:l,convertValue:c,isVisitable:rt});if(!et.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!et.isUndefined(n)){if(-1!==u.indexOf(n))throw Error("Circular reference detected in "+r.join("."));u.push(n),et.forEach(n,function(n,o){!0===(!(et.isUndefined(n)||null===n)&&s.call(t,n,et.isString(o)?o.trim():o,r,d))&&e(n,r?r.concat(o):[o])}),u.pop()}}(e),t};function ct(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function lt(e,t){this._pairs=[],e&&at(e,this,t)}const ut=lt.prototype;ut.append=function(e,t){this._pairs.push([e,t])},ut.toString=function(e){const t=e?function(t){return e.call(this,t,ct)}:ct;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};const dt=lt;function pt(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ft(e,t,n){if(!t)return e;const r=n&&n.encode||pt,s=et.isFunction(n)?{serialize:n}:n,o=s&&s.serialize;let i;if(i=o?o(t,s):et.isURLSearchParams(t)?t.toString():new dt(t,s).toString(r),i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}const ht=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){et.forEach(this.handlers,function(t){null!==t&&e(t)})}},mt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},bt={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:dt,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},vt="undefined"!=typeof window&&"undefined"!=typeof document,gt="object"==typeof navigator&&navigator||void 0,yt=vt&&(!gt||["ReactNative","NativeScript","NS"].indexOf(gt.product)<0),jt="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,wt=vt&&window.location.href||"http://localhost",xt={...e,...bt},_t=function(e){function t(e,n,r,s){let o=e[s++];if("__proto__"===o)return!0;const i=Number.isFinite(+o),a=s>=e.length;return o=!o&&et.isArray(r)?r.length:o,a?(et.hasOwnProp(r,o)?r[o]=[r[o],n]:r[o]=n,!i):(r[o]&&et.isObject(r[o])||(r[o]=[]),t(e,n,r[o],s)&&et.isArray(r[o])&&(r[o]=function(e){const t={},n=Object.keys(e);let r;const s=n.length;let o;for(r=0;r<s;r++)o=n[r],t[o]=e[o];return t}(r[o])),!i)}if(et.isFormData(e)&&et.isFunction(e.entries)){const n={};return et.forEachEntry(e,(e,r)=>{t(function(e){return et.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null},Ot={transitional:mt,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,s=et.isObject(e);if(s&&et.isHTMLForm(e)&&(e=new FormData(e)),et.isFormData(e))return r?JSON.stringify(_t(e)):e;if(et.isArrayBuffer(e)||et.isBuffer(e)||et.isStream(e)||et.isFile(e)||et.isBlob(e)||et.isReadableStream(e))return e;if(et.isArrayBufferView(e))return e.buffer;if(et.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return at(e,new xt.classes.URLSearchParams,{visitor:function(e,t,n,r){return xt.isNode&&et.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((o=et.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return at(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return s||r?(t.setContentType("application/json",!1),function(e){if(et.isString(e))try{return(0,JSON.parse)(e),et.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Ot.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(et.isResponse(e)||et.isReadableStream(e))return e;if(e&&et.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(e){if(n){if("SyntaxError"===e.name)throw nt.from(e,nt.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:xt.classes.FormData,Blob:xt.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};et.forEach(["delete","get","head","post","put","patch"],e=>{Ot.headers[e]={}});const St=Ot,Pt=et.toObjectSet(["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"]),Nt=Symbol("internals");function Et(e){return e&&String(e).trim().toLowerCase()}function Ct(e){return!1===e||null==e?e:et.isArray(e)?e.map(Ct):String(e)}function kt(e,t,n,r,s){return et.isFunction(r)?r.call(this,t,n):(s&&(t=n),et.isString(t)?et.isString(r)?-1!==t.indexOf(r):et.isRegExp(r)?r.test(t):void 0:void 0)}class Dt{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function s(e,t,n){const s=Et(t);if(!s)throw new Error("header name must be a non-empty string");const o=et.findKey(r,s);(!o||void 0===r[o]||!0===n||void 0===n&&!1!==r[o])&&(r[o||t]=Ct(e))}const o=(e,t)=>et.forEach(e,(e,n)=>s(e,n,t));if(et.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(et.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))o((e=>{const t={};let n,r,s;return e&&e.split("\n").forEach(function(e){s=e.indexOf(":"),n=e.substring(0,s).trim().toLowerCase(),r=e.substring(s+1).trim(),!n||t[n]&&Pt[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t})(e),t);else if(et.isObject(e)&&et.isIterable(e)){let n,r,s={};for(const t of e){if(!et.isArray(t))throw TypeError("Object iterator must return a key-value pair");s[r=t[0]]=(n=s[r])?et.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}o(s,t)}else null!=e&&s(t,e,n);return this}get(e,t){if(e=Et(e)){const n=et.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(et.isFunction(t))return t.call(this,e,n);if(et.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Et(e)){const n=et.findKey(this,e);return!(!n||void 0===this[n]||t&&!kt(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function s(e){if(e=Et(e)){const s=et.findKey(n,e);!s||t&&!kt(0,n[s],s,t)||(delete n[s],r=!0)}}return et.isArray(e)?e.forEach(s):s(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const s=t[n];e&&!kt(0,this[s],s,e,!0)||(delete this[s],r=!0)}return r}normalize(e){const t=this,n={};return et.forEach(this,(r,s)=>{const o=et.findKey(n,s);if(o)return t[o]=Ct(r),void delete t[s];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(s):String(s).trim();i!==s&&delete t[s],t[i]=Ct(r),n[i]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return et.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&et.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[Nt]=this[Nt]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=Et(e);t[r]||(function(e,t){const n=et.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,s){return this[r].call(this,t,e,n,s)},configurable:!0})})}(n,e),t[r]=!0)}return et.isArray(e)?e.forEach(r):r(e),this}}Dt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),et.reduceDescriptors(Dt.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),et.freezeMethods(Dt);const At=Dt;function Tt(e,t){const n=this||St,r=t||n,s=At.from(r.headers);let o=r.data;return et.forEach(e,function(e){o=e.call(n,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function Rt(e){return!(!e||!e.__CANCEL__)}const It=class extends nt{constructor(e,t,n){super(null==e?"canceled":e,nt.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function Lt(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new nt("Request failed with status code "+n.status,[nt.ERR_BAD_REQUEST,nt.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}const Ft=(e,t,n=3)=>{let r=0;const s=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s,o=0,i=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),l=r[i];s||(s=c),n[o]=a,r[o]=c;let u=i,d=0;for(;u!==o;)d+=n[u++],u%=e;if(o=(o+1)%e,o===i&&(i=(i+1)%e),c-s<t)return;const p=l&&c-l;return p?Math.round(1e3*d/p):void 0}}(50,250);return function(e,t){let n,r,s=0,o=1e3/t;const i=(t,o=Date.now())=>{s=o,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-s;a>=o?i(e,t):(n=e,r||(r=setTimeout(()=>{r=null,i(n)},o-a)))},()=>n&&i(n)]}(n=>{const o=n.loaded,i=n.lengthComputable?n.total:void 0,a=o-r,c=s(a);r=o,e({loaded:o,total:i,progress:i?o/i:void 0,bytes:a,rate:c||void 0,estimated:c&&i&&o<=i?(i-o)/c:void 0,event:n,lengthComputable:null!=i,[t?"download":"upload"]:!0})},n)},Mt=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Ut=e=>(...t)=>et.asap(()=>e(...t)),Bt=xt.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,xt.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(xt.origin),xt.navigator&&/(msie|trident)/i.test(xt.navigator.userAgent)):()=>!0,Vt=xt.hasStandardBrowserEnv?{write(e,t,n,r,s,o,i){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];et.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),et.isString(r)&&a.push(`path=${r}`),et.isString(s)&&a.push(`domain=${s}`),!0===o&&a.push("secure"),et.isString(i)&&a.push(`SameSite=${i}`),document.cookie=a.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function qt(e,t,n){let r=!("string"==typeof(s=t)&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(s));var s;return e&&(r||0==n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const Wt=e=>e instanceof At?{...e}:e;function Ht(e,t){t=t||{};const n={};function r(e,t,n,r){return et.isPlainObject(e)&&et.isPlainObject(t)?et.merge.call({caseless:r},e,t):et.isPlainObject(t)?et.merge({},t):et.isArray(t)?t.slice():t}function s(e,t,n,s){return et.isUndefined(t)?et.isUndefined(e)?void 0:r(void 0,e,0,s):r(e,t,0,s)}function o(e,t){if(!et.isUndefined(t))return r(void 0,t)}function i(e,t){return et.isUndefined(t)?et.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,s,o){return o in t?r(n,s):o in e?r(void 0,n):void 0}const c={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(e,t,n)=>s(Wt(e),Wt(t),0,!0)};return et.forEach(Object.keys({...e,...t}),function(r){if("__proto__"===r||"constructor"===r||"prototype"===r)return;const o=et.hasOwnProp(c,r)?c[r]:s,i=o(e[r],t[r],r);et.isUndefined(i)&&o!==a||(n[r]=i)}),n}const Kt=e=>{const t=Ht({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:a}=t;if(t.headers=i=At.from(i),t.url=ft(qt(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),et.isFormData(n))if(xt.hasStandardBrowserEnv||xt.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(et.isFunction(n.getHeaders)){const e=n.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,n])=>{t.includes(e.toLowerCase())&&i.set(e,n)})}if(xt.hasStandardBrowserEnv&&(r&&et.isFunction(r)&&(r=r(t)),r||!1!==r&&Bt(t.url))){const e=s&&o&&Vt.read(o);e&&i.set(s,e)}return t},zt="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=Kt(e);let s=r.data;const o=At.from(r.headers).normalize();let i,a,c,l,u,{responseType:d,onUploadProgress:p,onDownloadProgress:f}=r;function h(){l&&l(),u&&u(),r.cancelToken&&r.cancelToken.unsubscribe(i),r.signal&&r.signal.removeEventListener("abort",i)}let m=new XMLHttpRequest;function b(){if(!m)return;const r=At.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());Lt(function(e){t(e),h()},function(e){n(e),h()},{data:d&&"text"!==d&&"json"!==d?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=b:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(b)},m.onabort=function(){m&&(n(new nt("Request aborted",nt.ECONNABORTED,e,m)),m=null)},m.onerror=function(t){const r=t&&t.message?t.message:"Network Error",s=new nt(r,nt.ERR_NETWORK,e,m);s.event=t||null,n(s),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const s=r.transitional||mt;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new nt(t,s.clarifyTimeoutError?nt.ETIMEDOUT:nt.ECONNABORTED,e,m)),m=null},void 0===s&&o.setContentType(null),"setRequestHeader"in m&&et.forEach(o.toJSON(),function(e,t){m.setRequestHeader(t,e)}),et.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),d&&"json"!==d&&(m.responseType=r.responseType),f&&([c,u]=Ft(f,!0),m.addEventListener("progress",c)),p&&m.upload&&([a,l]=Ft(p),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",l)),(r.cancelToken||r.signal)&&(i=t=>{m&&(n(!t||t.type?new It(null,e,m):t),m.abort(),m=null)},r.cancelToken&&r.cancelToken.subscribe(i),r.signal&&(r.signal.aborted?i():r.signal.addEventListener("abort",i)));const v=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);v&&-1===xt.protocols.indexOf(v)?n(new nt("Unsupported protocol "+v+":",nt.ERR_BAD_REQUEST,e)):m.send(s||null)})},Gt=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const s=function(e){if(!n){n=!0,i();const t=e instanceof Error?e:this.reason;r.abort(t instanceof nt?t:new It(t instanceof Error?t.message:t))}};let o=t&&setTimeout(()=>{o=null,s(new nt(`timeout of ${t}ms exceeded`,nt.ETIMEDOUT))},t);const i=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(s):e.removeEventListener("abort",s)}),e=null)};e.forEach(e=>e.addEventListener("abort",s));const{signal:a}=r;return a.unsubscribe=()=>et.asap(i),a}},$t=function*(e,t){let n=e.byteLength;if(!t||n<t)return void(yield e);let r,s=0;for(;s<n;)r=s+t,yield e.slice(s,r),s=r},Jt=(e,t,n,r)=>{const s=async function*(e,t){for await(const n of async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}}(e))yield*$t(n,t)}(e,t);let o,i=0,a=e=>{o||(o=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await s.next();if(t)return a(),void e.close();let o=r.byteLength;if(n){let e=i+=o;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw a(e),e}},cancel:e=>(a(e),s.return())},{highWaterMark:2})},{isFunction:Qt}=et,Xt=(({Request:e,Response:t})=>({Request:e,Response:t}))(et.global),{ReadableStream:Yt,TextEncoder:Zt}=et.global,en=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},tn=e=>{e=et.merge.call({skipUndefined:!0},Xt,e);const{fetch:t,Request:n,Response:r}=e,s=t?Qt(t):"function"==typeof fetch,o=Qt(n),i=Qt(r);if(!s)return!1;const a=s&&Qt(Yt),c=s&&("function"==typeof Zt?(l=new Zt,e=>l.encode(e)):async e=>new Uint8Array(await new n(e).arrayBuffer()));var l;const u=o&&a&&en(()=>{let e=!1;const t=new n(xt.origin,{body:new Yt,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),d=i&&a&&en(()=>et.isReadableStream(new r("").body)),p={stream:d&&(e=>e.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!p[e]&&(p[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new nt(`Response type '${e}' is not supported`,nt.ERR_NOT_SUPPORT,n)})});return async e=>{let{url:s,method:i,data:a,signal:l,cancelToken:f,timeout:h,onDownloadProgress:m,onUploadProgress:b,responseType:v,headers:g,withCredentials:y="same-origin",fetchOptions:j}=Kt(e),w=t||fetch;v=v?(v+"").toLowerCase():"text";let x=Gt([l,f&&f.toAbortSignal()],h),_=null;const O=x&&x.unsubscribe&&(()=>{x.unsubscribe()});let S;try{if(b&&u&&"get"!==i&&"head"!==i&&0!==(S=await(async(e,t)=>{const r=et.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(et.isBlob(e))return e.size;if(et.isSpecCompliantForm(e)){const t=new n(xt.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return et.isArrayBufferView(e)||et.isArrayBuffer(e)?e.byteLength:(et.isURLSearchParams(e)&&(e+=""),et.isString(e)?(await c(e)).byteLength:void 0)})(t):r})(g,a))){let e,t=new n(s,{method:"POST",body:a,duplex:"half"});if(et.isFormData(a)&&(e=t.headers.get("content-type"))&&g.setContentType(e),t.body){const[e,n]=Mt(S,Ft(Ut(b)));a=Jt(t.body,65536,e,n)}}et.isString(y)||(y=y?"include":"omit");const t=o&&"credentials"in n.prototype,l={...j,signal:x,method:i.toUpperCase(),headers:g.normalize().toJSON(),body:a,duplex:"half",credentials:t?y:void 0};_=o&&new n(s,l);let f=await(o?w(_,j):w(s,l));const h=d&&("stream"===v||"response"===v);if(d&&(m||h&&O)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=f[t]});const t=et.toFiniteNumber(f.headers.get("content-length")),[n,s]=m&&Mt(t,Ft(Ut(m),!0))||[];f=new r(Jt(f.body,65536,n,()=>{s&&s(),O&&O()}),e)}v=v||"text";let P=await p[et.findKey(p,v)||"text"](f,e);return!h&&O&&O(),await new Promise((t,n)=>{Lt(t,n,{data:P,headers:At.from(f.headers),status:f.status,statusText:f.statusText,config:e,request:_})})}catch(t){if(O&&O(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new nt("Network Error",nt.ERR_NETWORK,e,_,t&&t.response),{cause:t.cause||t});throw nt.from(t,t&&t.code,e,_,t&&t.response)}}},nn=new Map,rn=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,o=[r,s,n];let i,a,c=o.length,l=nn;for(;c--;)i=o[c],a=l.get(i),void 0===a&&l.set(i,a=c?new Map:tn(t)),l=a;return a},sn=(rn(),{http:null,xhr:zt,fetch:{get:rn}});et.forEach(sn,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const on=e=>`- ${e}`,an=e=>et.isFunction(e)||null===e||!1===e,cn=function(e,t){e=et.isArray(e)?e:[e];const{length:n}=e;let r,s;const o={};for(let i=0;i<n;i++){let n;if(r=e[i],s=r,!an(r)&&(s=sn[(n=String(r)).toLowerCase()],void 0===s))throw new nt(`Unknown adapter '${n}'`);if(s&&(et.isFunction(s)||(s=s.get(t))))break;o[n||"#"+i]=s}if(!s){const e=Object.entries(o).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));let t=n?e.length>1?"since :\n"+e.map(on).join("\n"):" "+on(e[0]):"as no adapter specified";throw new nt("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return s};function ln(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new It(null,e)}function un(e){return ln(e),e.headers=At.from(e.headers),e.data=Tt.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),cn(e.adapter||St.adapter,e)(e).then(function(t){return ln(e),t.data=Tt.call(e,e.transformResponse,t),t.headers=At.from(t.headers),t},function(t){return Rt(t)||(ln(e),t&&t.response&&(t.response.data=Tt.call(e,e.transformResponse,t.response),t.response.headers=At.from(t.response.headers))),Promise.reject(t)})}const dn="1.13.5",pn={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{pn[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const fn={};pn.transitional=function(e,t,n){function r(e,t){return"[Axios v"+dn+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,s,o)=>{if(!1===e)throw new nt(r(s," has been removed"+(t?" in "+t:"")),nt.ERR_DEPRECATED);return t&&!fn[s]&&(fn[s]=!0,console.warn(r(s," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,s,o)}},pn.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};const hn={assertOptions:function(e,t,n){if("object"!=typeof e)throw new nt("options must be an object",nt.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const o=r[s],i=t[o];if(i){const t=e[o],n=void 0===t||i(t,o,e);if(!0!==n)throw new nt("option "+o+" must be "+n,nt.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new nt("Unknown option "+o,nt.ERR_BAD_OPTION)}},validators:pn},mn=hn.validators;class bn{constructor(e){this.defaults=e||{},this.interceptors={request:new ht,response:new ht}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?n&&!String(e.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+n):e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Ht(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:s}=t;void 0!==n&&hn.assertOptions(n,{silentJSONParsing:mn.transitional(mn.boolean),forcedJSONParsing:mn.transitional(mn.boolean),clarifyTimeoutError:mn.transitional(mn.boolean),legacyInterceptorReqResOrdering:mn.transitional(mn.boolean)},!1),null!=r&&(et.isFunction(r)?t.paramsSerializer={serialize:r}:hn.assertOptions(r,{encode:mn.function,serialize:mn.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),hn.assertOptions(t,{baseUrl:mn.spelling("baseURL"),withXsrfToken:mn.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&et.merge(s.common,s[t.method]);s&&et.forEach(["delete","get","head","post","put","patch","common"],e=>{delete s[e]}),t.headers=At.concat(o,s);const i=[];let a=!0;this.interceptors.request.forEach(function(e){if("function"==typeof e.runWhen&&!1===e.runWhen(t))return;a=a&&e.synchronous;const n=t.transitional||mt;n&&n.legacyInterceptorReqResOrdering?i.unshift(e.fulfilled,e.rejected):i.push(e.fulfilled,e.rejected)});const c=[];let l;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let u,d=0;if(!a){const e=[un.bind(this),void 0];for(e.unshift(...i),e.push(...c),u=e.length,l=Promise.resolve(t);d<u;)l=l.then(e[d++],e[d++]);return l}u=i.length;let p=t;for(;d<u;){const e=i[d++],t=i[d++];try{p=e(p)}catch(e){t.call(this,e);break}}try{l=un.call(this,p)}catch(e){return Promise.reject(e)}for(d=0,u=c.length;d<u;)l=l.then(c[d++],c[d++]);return l}getUri(e){return ft(qt((e=Ht(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}}et.forEach(["delete","get","head","options"],function(e){bn.prototype[e]=function(t,n){return this.request(Ht(n||{},{method:e,url:t,data:(n||{}).data}))}}),et.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,s){return this.request(Ht(s||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}bn.prototype[e]=t(),bn.prototype[e+"Form"]=t(!0)});const vn=bn;class gn{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const n=this;this.promise.then(e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t;const r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,s){n.reason||(n.reason=new It(e,r,s),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new gn(function(t){e=t}),cancel:e}}}const yn=gn,jn={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(jn).forEach(([e,t])=>{jn[t]=e});const wn=jn,xn=function e(t){const n=new vn(t),r=ue(vn.prototype.request,n);return et.extend(r,vn.prototype,n,{allOwnKeys:!0}),et.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(Ht(t,n))},r}(St);xn.Axios=vn,xn.CanceledError=It,xn.CancelToken=yn,xn.isCancel=Rt,xn.VERSION=dn,xn.toFormData=at,xn.AxiosError=nt,xn.Cancel=xn.CanceledError,xn.all=function(e){return Promise.all(e)},xn.spread=function(e){return function(t){return e.apply(null,t)}},xn.isAxiosError=function(e){return et.isObject(e)&&!0===e.isAxiosError},xn.mergeConfig=Ht,xn.AxiosHeaders=At,xn.formToJSON=e=>_t(et.isHTMLForm(e)?new FormData(e):e),xn.getAdapter=cn,xn.HttpStatusCode=wn,xn.default=xn;const _n=xn,On=window.ReactDOM;var Sn,Pn,Nn,En,Cn,kn,Dn,An,Tn=function(e){var t=(0,o.createContext)(void 0);return[t,function(){var n=(0,o.useContext)(t);if(void 0===n)throw Error("".concat(e," can only be used within a corresponding context provider."));return n}]},Rn=function(e,t){return t.includes(e.charAt(e.length-1))?e.slice(0,-1):e},In=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:150;return e.length>t?"".concat(e.slice(0,t)).concat((0,i._x)("…","truncated text","code-snippets")):e},Ln=function(e){var t,n=(new DOMParser).parseFromString(e,"text/html");return n.body.querySelectorAll("script,style").forEach(function(e){return e.remove()}),n.body.querySelectorAll("p,div,li,br,h1,h2,h3,h4,h5,h6,tr,td,th,ul,ol,blockquote,table,pre,hr,dl,dt,dd,section,article,header,footer,figure,figcaption,address,aside,nav,main,fieldset,form,details,summary,dialog,hgroup,caption").forEach(function(e){return e.after(n.createTextNode(" "))}),(null!==(t=n.body.textContent)&&void 0!==t?t:"").replace(/\s+/g," ").trim()},Fn=function(e){return Rn(null!=e?e:"","/")},Mn={snippets:Fn(null===(Sn=window.CODE_SNIPPETS)||void 0===Sn?void 0:Sn.restAPI.snippets),recentlyActive:Fn(null===(Pn=window.CODE_SNIPPETS)||void 0===Pn?void 0:Pn.restAPI.recentlyActive),preferences:Fn(null===(Nn=window.CODE_SNIPPETS)||void 0===Nn?void 0:Nn.restAPI.preferences),importPlugins:Fn(null===(En=window.CODE_SNIPPETS)||void 0===En?void 0:En.restAPI.importPlugins),importFiles:Fn(null===(Cn=window.CODE_SNIPPETS)||void 0===Cn?void 0:Cn.restAPI.importFiles),cloud:{snippets:Fn(null===(kn=window.CODE_SNIPPETS)||void 0===kn?void 0:kn.restAPI.cloud.snippets)}},Un=["delete","put","patch"],Bn=function(e){var t,n=null===(t=e.method)||void 0===t?void 0:t.toLowerCase();return n&&Un.includes(n)?(e.headers.set("X-HTTP-Method-Override",n.toUpperCase()),e.method="post",e):e},Vn=null===(Dn=window.CODE_SNIPPETS)||void 0===Dn?void 0:Dn.restAPI.nonce,qn=function(e){return Vn&&e.headers.set("X-WP-Nonce",Vn),e},Wn={headers:{"Access-Control":null===(An=window.CODE_SNIPPETS)||void 0===An?void 0:An.restAPI.cloud.token}},Hn=function(){var e=ae(le().mark(function e(t,n,r,s){var o,i,a;return le().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(o=window.CODE_SNIPPETS)||void 0===o||!o.debug){e.next=9;break}return(i=console).debug.apply(i,["".concat(t," ").concat(n)].concat(oe(s?[s]:[]))),e.next=4,r;case 4:return a=e.sent,console.debug("Response",a),e.abrupt("return",a);case 9:return e.next=11,r;case 11:return e.abrupt("return",e.sent);case 12:case"end":return e.stop()}},e)}));return function(t,n,r,s){return e.apply(this,arguments)}}(),Kn=s(Tn("useRestAPI"),2),zn=Kn[0],Gn=Kn[1],$n=function(e){var t=e.children,n=(0,o.useMemo)(function(){var e,t=_n.create(Wn);return t.interceptors.request.use(qn),t.interceptors.request.use(Bn),null===(e=window.wp.hooks)||void 0===e||e.addAction("heartbeat.tick","code-snippets/refresh-rest-nonce",function(e){e.rest_nonce&&(Vn=e.rest_nonce)}),t},[]),r=(0,o.useMemo)(function(){return function(e){return{getResponse:function(t){return Hn("GET",t,e.get(t))},get:function(t){return Hn("GET",t,e.get(t)).then(function(e){return e.data})},post:function(t,n,r){return Hn("POST",t,e.post(t,n,r),n).then(function(e){return e.data})},del:function(t){return Hn("DELETE",t,e.delete(t)).then(function(e){return e.data})},put:function(t,n){return Hn("PUT",t,e.put(t,n),n).then(function(e){return e.data})}}}(n)},[n]),s={api:r,axiosInstance:n};return(0,g.jsx)(zn.Provider,{value:s,children:t})},Jn=function(e){console.error(e)},Qn=function(){var e=Gn().api,t=(0,o.useState)(function(){var e,t;return null!==(e=null===(t=window.CODE_SNIPPETS)||void 0===t?void 0:t.snippetView)&&void 0!==e?e:"table"}),n=s(t,2),r=n[0],i=n[1];return{snippetView:r,setSnippetView:(0,o.useCallback)(function(t){i(t),e.post("".concat(Mn.preferences,"/snippet-view"),{view:t}).catch(Jn)},[e])}},Xn="snippets-screen-meta-slot",Yn=function(e){var t=e.hidden,n=void 0!==t&&t;return(0,o.useEffect)(function(){var e=document.getElementById(Xn),t=document.getElementById("screen-meta"),n=document.getElementById("screen-meta-links");if(e&&t&&n){var r=t.parentElement;return e.append(t,n),function(){null==r||r.prepend(t,n)}}},[]),(0,g.jsx)("div",{id:Xn,className:"snippets-screen-meta-slot",hidden:n})};function Zn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function er(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Zn(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var tr=function(){var e=(0,o.useRef)(null),t=s((0,o.useState)({atStart:!0,atEnd:!0}),2),n=t[0],r=t[1],i=(0,o.useCallback)(function(){var t=e.current;if(t){var n=t.scrollWidth-t.clientWidth>1,s=!n||t.scrollLeft<=1,o=!n||t.scrollLeft+t.clientWidth>=t.scrollWidth-1;r(function(e){return e.atStart===s&&e.atEnd===o?e:{atStart:s,atEnd:o}})}},[]);return(0,o.useEffect)(function(){var t,n=e.current;if(n){i(),n.addEventListener("scroll",i,{passive:!0});var r=new ResizeObserver(i);return r.observe(n),r.observe(null!==(t=n.firstElementChild)&&void 0!==t?t:n),function(){n.removeEventListener("scroll",i),r.disconnect()}}},[i]),er(er({},n),{},{scrollRef:e})};function nr(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}var rr=function(e){var t=e.tabs,n=e.ariaLabel,r=e.className,s=e.currentTab,o=e.getTabCount,a=e.setCurrentTab,c=e.queryParamName,l=tr(),u=l.atStart,p=l.atEnd,f=l.scrollRef;return(0,g.jsx)("div",{className:v()("snippet-type-nav-wrapper",{"has-scroll-start":!u,"has-scroll-end":!p}),children:(0,g.jsx)("nav",{ref:f,className:v()("snippet-type-nav",r),"aria-label":n,children:(0,g.jsx)("ul",{children:t.map(function(e){var t=null==o?void 0:o(e);return(0,g.jsx)("li",{children:(0,g.jsxs)("button",{type:"button",className:v()("snippet-type-link","".concat(e.name,"-subnav-link"),{"active-type":e.name===s.name}),"aria-current":e.name===s.name?"page":void 0,onClick:function(){a(e),c&&d(h({},c,e.name))},children:[(0,g.jsx)("span",{children:e.label}),t&&(0,g.jsx)("span",{className:"subnav-count",children:t}),e.pro&&!N()&&(0,g.jsx)("span",{className:"pro-chip",children:(0,i.__)("Pro","code-snippets")})]})},e.name)})})})})};function sr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function or(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?sr(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var ir,ar,cr,lr,ur=s(Tn("useCloudSnippetDownloads"),2),dr=ur[0],pr=ur[1],fr=function(e){var t=e.children,n=s((0,o.useState)({}),2),r=n[0],i=n[1],a=(0,o.useCallback)(function(e,t){return i(function(n){return or(or({},n),{},h({},e,or(or({isDownloading:!1},n[e]),t)))})},[]);return(0,g.jsx)(dr.Provider,{value:{downloadRecords:r,updateDownloadRecord:a},children:t})};function hr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function mr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?hr(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var br=Math.min(null!==(ir=null!==(ar=null===(cr=window.CODE_SNIPPETS_MANAGE)||void 0===cr?void 0:cr.cloudSearchPerPage)&&void 0!==ar?ar:null===(lr=window.CODE_SNIPPETS_MANAGE)||void 0===lr?void 0:lr.snippetsPerPage)&&void 0!==ir?ir:10,100),vr={SEARCH_QUERY:Mn.cloud.snippets,FEATURED:"".concat(Mn.cloud.snippets,"/featured")},gr="paged",yr="type",jr="status",wr="category",xr=function(){var e,t,n,r,s,o=Number(null!==(e=u(gr))&&void 0!==e?e:1),i=null!==(t=u("s"))&&void 0!==t?t:"",a=null!==(n=u(yr))&&void 0!==n?n:"",c=null!==(r=u(jr))&&void 0!==r?r:0,l=u("by"),d=null!==(s=u(wr))&&void 0!==s?s:"";return{page:isNaN(o)?1:o,type:a,query:i,status:Number(c),method:"codevault"===l?"codevault":"term",category:d}},_r=function(e){return"object"===c(e)&&null!==e&&"id"in e&&"number"==typeof e.id&&"name"in e&&"string"==typeof e.name},Or=function(e){return Array.isArray(e)?e.filter(_r):void 0},Sr=s(Tn("useCloudSearch"),2),Pr=Sr[0],Nr=Sr[1],Er=function(e){var t=e.children,n=function(){var e=Gn().api,t=function(){var e=(0,o.useRef)(0),t=(0,o.useCallback)(function(){return e.current+=1,e.current},[]);return{isCurrentRequest:(0,o.useCallback)(function(t){return t===e.current},[]),nextRequestId:t}}(),n=t.isCurrentRequest,r=t.nextRequestId,i=s((0,o.useState)(!1),2),a=i[0],l=i[1],u=s((0,o.useState)(!1),2),d=u[0],p=u[1],h=s((0,o.useState)(),2),m=h[0],b=h[1],v=s((0,o.useState)({}),2),g=v[0],y=v[1];return{isLoading:d,isSearching:a,searchResults:m,availableFilters:g,makeSearchRequest:(0,o.useCallback)(function(t){var s=r(),o=""===t.query.trim();p(!0),l(!o);var i=o?vr.FEATURED:vr.SEARCH_QUERY;e.getResponse(function(e,t){var n=t.query,r=t.type,s=t.method,o=t.status,i=t.category,a=t.page;return f(e,{query:n,searchByCodevault:"codevault"===s||void 0,per_page:br,type:r||void 0,category:i||void 0,status:o||void 0,page:a})}(i,t)).then(function(e){n(s)&&(b(function(e,t){var n=e.data;return{page:n.page,isFeatured:t===vr.FEATURED,snippets:n.snippets,totalItems:n.total_snippets,totalPages:n.total_pages}}(e,i)),y(function(t){var n,r;return null!==(n="object"===c(r=e.data.available_filters)&&r?mr(mr(mr({},"types"in r&&{types:Or(r.types)}),"statuses"in r&&{statuses:Or(r.statuses)}),"categories"in r&&{categories:Or(r.categories)}):void 0)&&void 0!==n?n:t}))}).catch(function(){n(s)&&b(!1)}).finally(function(){n(s)&&(l(!1),p(!1))})},[e,r,n])}}(),r=n.isLoading,i=n.isSearching,a=n.makeSearchRequest,l=n.availableFilters,u=n.searchResults,p=s((0,o.useState)(xr),2),m=p[0],b=p[1],v=s((0,o.useState)(!1),2),y=v[0],j=v[1],w=(0,o.useCallback)(function(e){return b(function(t){return mr(mr({},t),e)})},[]),x=(0,o.useCallback)(function(e){var t=function(e,t){var n=e.query.trim()!==t.query.trim(),r=e.method!==t.method,s=e.type!==t.type,o=e.status!==t.status,i=e.category!==t.category,a=s||o||i;return n||r?mr(mr({},e),{},{page:1,type:"",status:0,category:""}):a?mr(mr({},e),{},{page:1}):e}(mr(mr({},m),e),m);!function(e){d(h(h(h(h(h(h({},gr,e.page),yr,e.type||void 0),"s",e.query||void 0),jr,e.status||void 0),"by","codevault"===e.method?"codevault":void 0),wr,e.category||void 0))}(t),b(t),a(t)},[a,m]);(0,o.useEffect)(function(){y||(j(!0),a(m))},[a,m,y]);var _=mr({doSearch:x,isLoading:r,isSearching:i,searchParams:m,availableFilters:l,updateSearchParams:w},!1===u?{isErrored:!0,searchResults:void 0}:{isErrored:!1,searchResults:u});return(0,g.jsx)(Pr.Provider,{value:_,children:t})},Cr=["php","html","css","js","cond"],kr={php:["global","admin","front-end","single-use"],html:["content","head-content","body-content","footer-content"],css:["admin-css","site-css"],js:["site-head-js","site-footer-js"],cond:["condition"]};function Dr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ar(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Dr(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Dr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Tr={id:0,name:"",code:"",desc:"",scope:"global",modified:"",active:!1,locked:!1,trashed:!1,network:P(),shared_network:null,priority:10,conditionId:0,code_error:null,code_error_trace:null},Rr=function(e){return"number"==typeof e&&0<e},Ir=function(e){var t,n,r,s=Ar(Ar({},Tr),{},{tags:[]});return"object"!==c(e)||null===e?s:Ar(Ar(Ar(Ar(Ar(Ar(Ar(Ar(Ar(Ar(Ar(Ar(Ar(Ar(Ar(Ar(Ar(Ar(Ar({},s),"id"in e&&Rr(e.id)&&{id:e.id}),"name"in e&&"string"==typeof e.name&&{name:e.name}),"desc"in e&&"string"==typeof e.desc&&{desc:e.desc}),"code"in e&&"string"==typeof e.code&&{code:e.code}),"tags"in e&&{tags:null!==(r=e.tags,t=Array.isArray(r)?r.filter(function(e){return"string"==typeof e}):void 0)&&void 0!==t?t:s.tags}),"scope"in e&&"string"==typeof(n=e.scope)&&Object.values(kr).some(function(e){return e.some(function(e){return e===n})})&&{scope:e.scope}),"modified"in e&&"string"==typeof e.modified&&{modified:e.modified}),"active"in e&&"boolean"==typeof e.active&&{active:e.active}),"locked"in e&&"boolean"==typeof e.locked&&{locked:e.locked}),"trashed"in e&&"boolean"==typeof e.trashed&&{trashed:e.trashed}),"network"in e&&"boolean"==typeof e.network&&{network:e.network}),"shared_network"in e&&"boolean"==typeof e.shared_network&&{shared_network:e.shared_network}),"priority"in e&&"number"==typeof e.priority&&{priority:e.priority}),"conditionId"in e&&Rr(e.conditionId)&&{conditionId:e.conditionId}),"condition_id"in e&&Rr(e.condition_id)&&{conditionId:e.condition_id}),"code_error"in e&&function(e){return Array.isArray(e)&&2===e.length&&"string"==typeof e[0]&&"number"==typeof e[1]}(e.code_error)&&{code_error:e.code_error}),"code_error_trace"in e&&("string"==typeof e.code_error_trace||null===e.code_error_trace)&&{code_error_trace:e.code_error_trace}),"last_active"in e&&{lastActive:Number(e.last_active)})};function Lr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Fr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Lr(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Lr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Mr=new Set(["css","js","cond"]),Ur={php:(0,i.__)("Functions","code-snippets"),html:(0,i.__)("Content","code-snippets"),css:(0,i.__)("Styles","code-snippets"),js:(0,i.__)("Scripts","code-snippets"),cond:(0,i.__)("Conditions","code-snippets")},Br=function(e){return Ir(e)},Vr=function(e){return Br(Fr(Fr({},e),{},{id:0,active:!1,name:(0,i.sprintf)((0,i.__)("%s [CLONE]","code-snippets"),e.name)}))},qr=function(e){var t=e.scope;switch(!0){case t.endsWith("-css"):return"css";case t.endsWith("-js"):return"js";case t.endsWith("content"):return"html";case"condition"===t:return"cond";default:return"php"}},Wr=function(e){var t,n;return null!=e&&e.id?f(null===(t=window.CODE_SNIPPETS)||void 0===t?void 0:t.urls.edit,{id:e.id}):null===(n=window.CODE_SNIPPETS)||void 0===n?void 0:n.urls.addNew},Hr=function(e){var t,n;return!e||!N()&&$r(e)?null===(n=window.CODE_SNIPPETS)||void 0===n?void 0:n.urls.addNew:f(null===(t=window.CODE_SNIPPETS)||void 0===t?void 0:t.urls.addNew,{type:e})},Kr=function(e){return""===e.name.trim()?(0,i.sprintf)(zr(e)?(0,i.__)("Condition #%d","code-snippets"):(0,i.__)("Snippet #%d","code-snippets"),e.id):e.name},zr=function(e){return"condition"===e.scope},Gr=function(e){return Mr.has(qr(e))},$r=function(e){return Mr.has(e)},Jr=function(e,t){var n,r;return"cond"===qr(e)?0<(null!==(n=null===(r=t.get(e.id))||void 0===r?void 0:r.length)&&void 0!==n?n:0):e.active},Qr=function(e){return!P()&&e.network&&!e.shared_network},Xr=function(e){var t;return!(Qr(e)||e.shared_network&&(null===(t=window.CODE_SNIPPETS_MANAGE)||void 0===t||!t.hasNetworkCap))},Yr=function(e){return!e.local_id&&(!Gr(e)||N())},Zr=["id","text","name","primary","secondary","small","large","wrap","className"];function es(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}var ts=function(e){var t=e.id,n=e.text,r=e.name,s=void 0===r?"submit":r,o=e.primary,a=e.secondary,c=e.small,l=e.large,u=e.wrap,d=e.className,p=m(e,Zr),f=(0,g.jsx)("input",function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?es(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):es(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({id:null!=t?t:s,type:"submit",name:s,value:null!=n?n:(0,i.__)("Save Changes","code-snippets"),className:v()("button",{"button-primary":o,"button-secondary":a,"button-small":c,"button-large":l},d)},p));return u?(0,g.jsx)("p",{className:"submit",children:f}):f},ns=["id","children","className","name","primary","secondary","small","large","link","type","onClick"];function rs(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ss(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?rs(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rs(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var os=function(e){var t=e.id,n=e.children,r=e.className,s=e.name,o=e.primary,i=void 0!==o&&o,a=e.secondary,c=void 0!==a&&a,l=e.small,u=void 0!==l&&l,d=e.large,p=void 0!==d&&d,f=e.link,h=void 0!==f&&f,b=e.type,y=void 0===b?"button":b,j=e.onClick,w=m(e,ns);return(0,g.jsx)("button",ss(ss({id:null!=t?t:s,name:s,type:y},w),{},{onClick:function(e){j&&(e.preventDefault(),j(e))},className:v()("button",r,{"button-primary":i,"button-secondary":c,"button-large":p,"button-small":u,"button-link":h}),children:n}))},is=["currentPage"],as=["currentPage","totalPages"],cs=["which","totalPages","currentPage"];function ls(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function us(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ls(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ls(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var ds=function(e){var t=e.icon,n=e.newPage,r=e.disabled,s=e.className,o=e.helperText,i=e.setCurrentPage,a=e.pageSearchParam;return a?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)("a",{className:"".concat(s," button"),href:f(window.location.href,h({},a,1===n?void 0:n)),onClick:function(e){e.preventDefault(),i(n)},children:[(0,g.jsx)("span",{className:"screen-reader-text",children:o}),(0,g.jsx)("span",{"aria-hidden":!0,children:t})]}),"\n"]}):(0,g.jsxs)(os,{className:s,onClick:function(){return i(n)},disabled:r,children:[(0,g.jsx)("span",{className:"screen-reader-text",children:o}),(0,g.jsx)("span",{"aria-hidden":!0,children:t})]})},ps=function(e){var t=e.currentPage,n=m(e,is);return 1===t?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("span",{className:"tablenav-pages-navspan button disabled","aria-hidden":"true",children:"«"}),"\n",(0,g.jsx)("span",{className:"tablenav-pages-navspan button disabled","aria-hidden":"true",children:"‹"}),"\n"]}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(ds,us({icon:(0,g.jsx)(g.Fragment,{children:"«"}),newPage:1,className:"first-page",helperText:(0,i.__)("First page","code-snippets")},n)),"\n",(0,g.jsx)(ds,us({icon:(0,g.jsx)(g.Fragment,{children:"‹"}),newPage:Math.max(1,t-1),className:"prev-page",helperText:(0,i.__)("Previous page","code-snippets")},n)),"\n"]})},fs=function(e){var t=e.currentPage,n=e.totalPages,r=m(e,as);return n===t?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("span",{className:"tablenav-pages-navspan button disabled","aria-hidden":"true",children:"›"}),"\n",(0,g.jsx)("span",{className:"tablenav-pages-navspan button disabled","aria-hidden":"true",children:"»"})]}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(ds,us({icon:(0,g.jsx)(g.Fragment,{children:"›"}),newPage:Math.min(n,t+1),className:"next-page",helperText:(0,i.__)("Next page","code-snippets")},r)),"\n",(0,g.jsx)(ds,us({icon:(0,g.jsx)(g.Fragment,{children:"»"}),newPage:n,className:"last-page",helperText:(0,i.__)("Last page","code-snippets")},r)),"\n"]})},hs=function(e){var t=e.which,n=e.disabled,r=e.inputName,s=e.inputValue,o=e.totalPages,a=e.setInputValue,c=e.confirmInputValue;return(0,g.jsx)("input",{className:"current-page",id:"current-page-selector-".concat(t),"aria-label":(0,i.__)("Current Page","code-snippets"),type:"text",name:r,value:s,size:o.toString().length,disabled:n,"aria-describedby":"table-paging-".concat(t),onBlur:c,onChange:function(e){var t=Number(e.target.value);t&&a(t)}})},ms=function(e){var t=e.which,n=e.totalPages,r=e.currentPage,s=m(e,cs);return"bottom"===t?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("span",{className:"screen-reader-text",children:(0,i.__)("Current Page","code-snippets")}),(0,g.jsx)("span",{className:"paging-input",children:(0,g.jsx)("span",{className:"tablenav-paging-text",children:(0,i.sprintf)((0,i._x)("%1$s of %2$s","paging","code-snippets"),r,n)})})]}):(0,g.jsxs)("span",{className:"paging-input",id:"table-paging-".concat(t),children:[(0,g.jsx)(hs,us({which:t,totalPages:n},s)),(0,g.jsxs)("span",{className:"tablenav-paging-text",children:[" ".concat((0,i.__)("of","code-snippets")," "),(0,g.jsx)("span",{className:"total-pages",children:n})]})]})},bs=function(e){var t=e.which,n=e.disabled,r=e.totalPages,s=e.inputValue,o=e.currentPage,i=e.setCurrentPage,a=e.setInputValue,c=e.pageSearchParam;return(0,g.jsxs)("span",{className:"pagination-links",children:[(0,g.jsx)(ps,{disabled:n,currentPage:o,setCurrentPage:i,pageSearchParam:c}),(0,g.jsx)(ms,{which:t,disabled:n,totalPages:r,currentPage:o,inputName:c,inputValue:s,setInputValue:a,confirmInputValue:function(){return i(s)}}),"\n",(0,g.jsx)(fs,{disabled:n,totalPages:r,currentPage:o,setCurrentPage:i,pageSearchParam:c})]})},vs=function(e){var t=e.which,n=e.disabled,r=e.totalPages,s=e.totalItems,o=e.inputValue,a=e.currentPage,c=e.pageSearchParam,l=e.setCurrentPage,u=e.setInputValue,d="top"===t?(0,i.__)("Pagination, before the table","code-snippets"):(0,i.__)("Pagination, after the table","code-snippets");return(0,g.jsx)("nav",{className:"tablenav-pages-nav","aria-label":d,children:(0,g.jsxs)("form",{className:v()("tablenav-pages",{"one-page":r&&1===r,"no-pages":!r}),onSubmit:function(e){e.preventDefault(),l(o)},children:[(0,g.jsx)("span",{className:"displaying-num",children:(0,i.sprintf)((0,i._n)("%s item","%s items",s,"code-snippets"),s)}),"\n",(0,g.jsx)(bs,{which:t,disabled:n,totalPages:r,inputValue:o,currentPage:a,pageSearchParam:c,setCurrentPage:l,setInputValue:u})]})})},gs=function(e){var t=e.which,n=e.disabled,r=e.totalItems,i=e.totalPages,a=e.currentPage,c=e.setCurrentPage,l=e.pageSearchParam,u=s((0,o.useState)(a),2),p=u[0],f=u[1];return(0,g.jsx)(vs,{which:t,inputValue:p,currentPage:a,totalItems:r,totalPages:i,disabled:n,setInputValue:f,setCurrentPage:function(e){if(e){var t=Math.max(1,Math.min(e,i));f(t),c(t),l&&d(h({},l,1===t?void 0:t))}}})},ys=["which","actions","doAction","selected","setSelected","totalItems","totalPages","extraTableNav","endTableNav","selectAllKeys"],js=["children"];function ws(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function xs(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ws(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ws(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function _s(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}var Os=function(e){var t=e.actions,n=s((0,o.useMemo)(function(){var e,n=[],r=new Map,s=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return _s(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_s(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,s=function(){};return{s,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:s}}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,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){a=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}(t);try{for(s.s();!(e=s.n()).done;){var o,i=e.value;void 0===i.group?n.push(i):r.set(i.group,[].concat(oe(null!==(o=r.get(i.group))&&void 0!==o?o:[]),[i]))}}catch(e){s.e(e)}finally{s.f()}return[n,Array.from(r.entries())]},[t]),2),r=n[0],i=n[1];return(0,g.jsxs)(g.Fragment,{children:[r.map(function(e){return(0,g.jsx)("option",{value:e.key,children:e.label},e.key)}),i.map(function(e){var t=s(e,2),n=t[0],r=t[1];return(0,g.jsx)("optgroup",{label:n,children:r.map(function(e){return(0,g.jsx)("option",{value:e.label,children:e.label},e.label)})},n)})]})},Ss=function(e){var t=e.which,n=e.actions,r=e.selectedAction,s=e.setSelectedAction,o=e.label;return(0,g.jsxs)("select",{name:"action".concat("bottom"===t?"-2":""),id:"bulk-action-selector-".concat(t),value:r,onChange:function(e){var t=e.target.value;t&&"-1"!==t?function(e,t){return t.some(function(t){return t.key===e})}(t,n)&&s(t):s(void 0)},children:[(0,g.jsx)("option",{value:"-1",children:o}),(0,g.jsx)(Os,{actions:n})]})},Ps=function(e){var t=e.which,n=e.actions,r=e.selected,a=e.doAction,c=e.onActionSuccess,l=e.disabled,u=e.selectLabel,d=s((0,o.useState)(),2),p=d[0],f=d[1],h=s((0,o.useState)(!1),2),m=h[0],b=h[1];return(0,g.jsxs)("div",{className:"alignleft actions bulkactions",children:[(0,g.jsx)("label",{htmlFor:"bulk-action-selector-".concat(t),className:"screen-reader-text",children:(0,i.__)("Select bulk action","code-snippets")}),(0,g.jsx)(Ss,{which:t,actions:n,selectedAction:p,setSelectedAction:f,label:null!=u?u:(0,i.__)("Bulk actions","code-snippets")}),(0,g.jsx)(ts,{id:"doaction".concat("bottom"===t?"-2":""),name:"bulk_action",text:(0,i.__)("Apply","code-snippets"),className:"action",disabled:!!l||m||!p,onClick:function(e){e.preventDefault(),p&&(b(!0),a(p,r).then(function(){null==c||c()}).catch(Jn).finally(function(){return b(!1)}))}}),m?(0,g.jsx)(H.Spinner,{}):null]})},Ns=function(e){var t=e.keys,n=e.selected,r=e.setSelected;return(0,g.jsxs)("label",{className:"tablenav-select-all",children:[(0,g.jsx)("input",{type:"checkbox",checked:0<t.length&&t.every(function(e){return n.has(e)}),disabled:0===t.length,"aria-label":(0,i.__)("Select all items","code-snippets"),onChange:function(e){var n=e.target.checked;r(function(e){var r=new Set(e);return t.forEach(function(e){return n?r.add(e):r.delete(e)}),r})}}),(0,i.__)("Select all","code-snippets")]})},Es=function(e){var t=e.which,n=e.actions,r=e.doAction,s=e.selected,o=e.setSelected,i=e.totalItems,a=e.totalPages,c=void 0===a?0:a,l=e.extraTableNav,u=e.endTableNav,d=e.selectAllKeys,p=m(e,ys),f="top"===t,h=0<i&&Boolean(n);return f&&Boolean(null!=l?l:u)||h||0<c?(0,g.jsxs)("div",{className:"tablenav ".concat(t),children:[0<i&&n&&r&&(0,g.jsx)(Ps,{which:t,actions:n,doAction:r,disabled:p.disabled,selected:s,onActionSuccess:function(){return o(new Set)}}),f&&d?(0,g.jsx)(Ns,{keys:d,selected:s,setSelected:o}):null,f?null==l?void 0:l(t):null,0<c||f&&u?(0,g.jsxs)("div",{className:"tablenav-end-group",children:[0<c&&(0,g.jsx)(gs,xs({},xs({totalPages:c,totalItems:i,which:t},p))),f?null==u?void 0:u(t):null]}):null,(0,g.jsx)("br",{className:"clear"})]}):null},Cs=function(e){var t=e.children,n=m(e,js);return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(Es,xs({which:"top"},n)),t,(0,g.jsx)(Es,xs({which:"bottom"},n))]})},ks=function(e){var t=e.isLoading,n=e.errorMessage,r=e.loadingNotice,s=e.noticeLabel;switch(!0){case t:return(0,g.jsx)(O,{"aria-label":s,className:"inline",children:(0,g.jsx)("p",{children:r})});case void 0!==n:return(0,g.jsx)(O,{"aria-label":s,className:"inline",type:"error",children:(0,g.jsx)("p",{children:n})});default:return(0,g.jsx)(O,{"aria-label":s,className:"inline",type:"warning",children:(0,g.jsx)("p",{children:(0,i.__)("An unknown error occurred. Please try again.","code-snippets")})})}};function Ds(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function As(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ds(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ds(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Ts=function(e){return(0,g.jsxs)("svg",As(As({width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{},{children:[(0,g.jsx)("rect",{x:"2",y:"2",width:"5.5",height:"5.5",rx:"1",stroke:"currentColor",strokeWidth:"1.6"}),(0,g.jsx)("rect",{x:"10.5",y:"2",width:"5.5",height:"5.5",rx:"1",stroke:"currentColor",strokeWidth:"1.6"}),(0,g.jsx)("rect",{x:"2",y:"10.5",width:"5.5",height:"5.5",rx:"1",stroke:"currentColor",strokeWidth:"1.6"}),(0,g.jsx)("rect",{x:"10.5",y:"10.5",width:"5.5",height:"5.5",rx:"1",stroke:"currentColor",strokeWidth:"1.6"})]}))};function Rs(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Is(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Rs(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Rs(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Ls=function(e){return(0,g.jsx)("svg",Is(Is({width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{},{children:(0,g.jsx)("path",{d:"M2.5 4.5H15.5M2.5 9H15.5M2.5 13.5H15.5",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})}))},Fs=function(e){var t=e.snippetView,n=e.setSnippetView,r=e.className;return(0,g.jsxs)("div",{className:v()("snippet-view-toggle",r),role:"group","aria-label":(0,i.__)("Snippet view","code-snippets"),children:[(0,g.jsxs)("button",{type:"button",className:v()("snippet-view-toggle-option",{"active-view":"card"===t}),"aria-pressed":"card"===t,title:(0,i.__)("Switch to card view","code-snippets"),onClick:function(){return n("card")},children:[(0,g.jsx)(Ts,{"aria-hidden":"true"}),(0,g.jsx)("span",{className:"screen-reader-text",children:(0,i.__)("Card view","code-snippets")})]}),(0,g.jsxs)("button",{type:"button",className:v()("snippet-view-toggle-option",{"active-view":"table"===t}),"aria-pressed":"table"===t,title:(0,i.__)("Switch to table view","code-snippets"),onClick:function(){return n("table")},children:[(0,g.jsx)(Ls,{"aria-hidden":"true"}),(0,g.jsx)("span",{className:"screen-reader-text",children:(0,i.__)("Table view","code-snippets")})]})]})},Ms={cond:"randomize",cloud:"cloud",bundles:"screenoptions",cloud_search:"search"},Us=function(e){var t=e.name,n=e.small,r=e.inverted,s=e.children;return(0,g.jsx)("span",{className:v()("badge","".concat(t,"-badge"),{"small-badge":n,"inverted-badge":r}),children:Ms[t]?(0,g.jsx)("span",{className:"dashicons dashicons-".concat(Ms[t]),"aria-hidden":"true"}):null!=s?s:t})},Bs=function(e){var t=e.block,n=e.inline,r=e.start,s=e.end,a=e.icon,c=e.className,l=e.children,u=e.label,d=(0,o.useId)();return(0,g.jsxs)("div",{className:v()("tooltip help-tooltip",{"tooltip-block":t,"tooltip-inline":n,"tooltip-start":r,"tooltip-end":s},c),children:[(0,g.jsx)("button",{type:"button",className:"tooltip-trigger","aria-label":null!=u?u:(0,i.__)("More information","code-snippets"),"aria-describedby":d,children:null!=a?a:(0,g.jsx)("span",{className:"dashicons dashicons-editor-help","aria-hidden":"true"})}),(0,g.jsx)("div",{role:"tooltip",className:"tooltip-content",id:d,children:l})]})},Vs=function(e){var t=e.message;return(0,g.jsx)(Bs,{block:!0,end:!0,label:(0,i.__)("Error","code-snippets"),icon:(0,g.jsx)("span",{className:"dashicons dashicons-warning","aria-hidden":"true"}),children:"".concat(Rn(t,".!?"),". ").concat((0,i.__)("Please try again.","code-snippets"))})},qs=function(e){var t,n,r=e.snippet,a=e.onDownloaded,c=Gn().api,l=pr(),u=l.downloadRecords,d=l.updateDownloadRecord,p=s((0,o.useState)(),2),f=p[0],h=p[1],m=s((0,o.useState)(!1),2),b=m[0],v=m[1],y=null!==(t=u[r.id])&&void 0!==t?t:{},j=y.isDownloading,w=void 0!==j&&j,x=y.localId,_=null!==(n=r.local_id)&&void 0!==n?n:x;return _?(0,g.jsx)("a",{className:"button button-primary",href:Wr({id:_}),target:"_blank",rel:"noopener noreferrer",children:(0,i.__)("Edit","code-snippets")}):Gr(r)&&!N()?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(os,{className:"cloud-pro-button",onClick:function(){return v(!0)},children:(0,i.__)("Pro Only","code-snippets")}),(0,g.jsx)(K,{isOpen:b,setIsOpen:v})]}):(0,g.jsxs)(g.Fragment,{children:[w&&(0,g.jsx)(H.Spinner,{}),f&&(0,g.jsx)(Vs,{message:f}),(0,g.jsx)(os,{primary:!0,onClick:function(){d(r.id,{isDownloading:!0}),h(void 0),c.post("".concat(Mn.cloud.snippets,"/").concat(r.id,"/download")).then(function(e){d(r.id,{localId:e.snippet_id}),a()}).catch(function(e){h("string"==typeof e?e:(0,i.__)("An error occurred while trying to download the snippet.","code-snippets"))}).finally(function(){return d(r.id,{isDownloading:!1})})},disabled:w,children:(0,i.__)("Download","code-snippets")})]})},Ws=function(e){return e[e.Private=3]="Private",e[e.Public=4]="Public",e[e.Unverified=5]="Unverified",e[e.AI_Verified=6]="AI_Verified",e[e.Pro_Verified=8]="Pro_Verified",e}({}),Hs=function(e){switch(e){case Ws.Public:return(0,i.__)("Public","code-snippets");case Ws.Private:return(0,i.__)("Private","code-snippets");case Ws.Unverified:return(0,i.__)("Unverified","code-snippets");case Ws.AI_Verified:return(0,i.__)("AI Verified","code-snippets");case Ws.Pro_Verified:return(0,i.__)("Pro Verified","code-snippets");default:return(0,i.__)("Unknown","code-snippets")}},Ks=h(h(h(h(h({},Ws.Public,"public"),Ws.Private,"private"),Ws.Unverified,"failure"),Ws.AI_Verified,"info"),Ws.Pro_Verified,"success"),zs=function(e){var t;return null===(t=Ws[e])||void 0===t?void 0:t.toLowerCase().replace("_","-")},Gs=function(e){var t,n=e.status;return(0,g.jsx)("span",{className:"cloud-snippet-status cloud-snippet-status-".concat(null!==(t=zs(n))&&void 0!==t?t:"unknown"),children:Hs(n)})},$s=function(e){var t,n=e.status;return(0,g.jsx)("span",{className:"badge ".concat(null!==(t=Ks[n])&&void 0!==t?t:"neutral","-badge"),children:Hs(n)})},Js=function(e,t){var n=e.id,r=e.network;return f([Mn.snippets,n,t].filter(Boolean).join("/"),{network:r})},Qs=function(e){return{name:e.name,desc:e.desc,code:e.code,tags:e.tags,scope:e.scope,priority:e.priority,active:e.active,network:e.network,locked:e.locked,trashed:e.trashed,shared_network:e.shared_network,condition_id:e.conditionId}},Xs=s(Tn("useSnippetsAPI"),2),Ys=Xs[0],Zs=Xs[1],eo=function(e){var t=e.children,n=Gn().api,r=(0,o.useMemo)(function(){return t=(e=n).get,r=e.post,s=e.del,o=e.put,{fetchAll:function(e){return t(f(Mn.snippets,{network:e})).then(function(e){return e.map(Br)})},fetch:function(e,n){return t(f("".concat(Mn.snippets,"/").concat(e),{network:n})).then(Br)},create:function(e){return r(Mn.snippets,Qs(e)).then(Br)},update:function(e){return r(e.id?Js(e):Mn.snippets,Qs(e)).then(Br)},delete:function(e){return s(Js(e))},restore:function(e){return r(Js(e,"restore"))},activate:function(e){return r(Js(e,"activate")).then(Br)},deactivate:function(e){return r(Js(e,"deactivate")).then(Br)},export:function(e){return t(Js(e,"export"))},exportCode:function(e){return t(Js(e,"export-code"))},attach:function(e){return o(Js(e,"attach"),{condition_id:e.conditionId})},detach:function(e){return o(Js(e,"detach"))}};var e,t,r,s,o},[n]);return(0,g.jsx)(Ys.Provider,{value:r,children:t})},to=s(Tn("useSnippetsList"),2),no=to[0],ro=to[1],so=function(e){var t=e.children,n=Zs().fetchAll,r=(0,o.useState)(function(){var e;return null===(e=window.CODE_SNIPPETS_MANAGE)||void 0===e||null===(e=e.snippetsList)||void 0===e?void 0:e.map(Ir)}),i=s(r,2),a=i[0],c=i[1],l=(0,o.useCallback)(ae(le().mark(function e(){var t;return le().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,console.info("Fetching snippets list"),e.next=4,n(P());case 4:t=e.sent,c(t),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(0),console.error("Error fetching snippets list",e.t0);case 11:case"end":return e.stop()}},e,null,[[0,8]])})),[n]);(0,o.useEffect)(function(){l().catch(function(){})},[l]);var u={snippetsList:a,refreshSnippetsList:l};return(0,g.jsx)(no.Provider,{value:u,children:t})},oo={php:["php","text/php"],html:["php","text/php"],css:["css","text/css"],js:["js","text/javascript"],cond:["json","application/json"],json:["json","application/json"]},io=function(e,t,n){var r=document.createElement("a");r.download=t,r.href=URL.createObjectURL(new Blob([e],{type:n})),setTimeout(function(){return URL.revokeObjectURL(r.href)},4e4),r.style.display="none",document.body.appendChild(r),setTimeout(function(){r.click(),r.remove()},0)},ao=function(e,t,n){var r=t.id,o=t.name,i=t.scope,a=o.toLowerCase().replace(/[^\w-]+/g,"-").trim(),c=""===a?"snippet-".concat(r):a;if("string"==typeof e){var l=s(oo[null!=n?n:qr({scope:i})],2),u=l[0],d=l[1],p="".concat(c,".code-snippets.").concat(u);io(e,p,d)}else{var f="".concat(c,".code-snippets.json");io(JSON.stringify(e,void 0,2),f,"application/json")}},co=function(e){return null==e},lo={id:function(e){return 0===e},desc:function(e){return""===e},name:function(e){return""===e},code:function(e){return""===e},tags:function(e){return Array.isArray(e)&&0===e.length},scope:function(e){return"global"===e},condition_id:function(e){return 0===e},active:function(e){return!1===e},locked:function(e){return!1===e},trashed:function(e){return!1===e},priority:function(e){return 10===e},modified:function(e){return""===e||co(e)},last_active:function(e){return 0===e||co(e)},network:function(e){return null===e||!1===e},shared_network:function(e){return null===e||!1===e},code_error:function(e){return null===e||!1===e},code_error_trace:function(e){return null===e||!1===e}},uo=function(e){var t=e.id,n=e.name,r=e.desc,o=e.code,i=e.tags,a=e.scope,c=e.active,l=e.locked,u=e.trashed,d=e.network,p=e.shared_network,f=e.modified,h=e.priority,m=e.conditionId,b=e.lastActive,v=e.code_error,g=e.code_error_trace;return Object.fromEntries(Object.entries({id:t,name:n,desc:r,code:o,tags:i,scope:a,active:c,locked:l,trashed:u,network:d,shared_network:p,modified:f,priority:h,condition_id:m,last_active:b,code_error:v,code_error_trace:g}).filter(function(e){var t,n,r,o=s(e,2);return t=o[0],n=o[1],!(null!==(r=lo[t])&&void 0!==r?r:co)(n)}))},po=function(e){if(0!==e.length){var t={generator:"Code Snippets",date_created:(new Date).toISOString().slice(0,16).replace("T"," "),snippets:e.map(uo)};io(JSON.stringify(t,void 0,2),"".concat("snippets",".code-snippets.json"),"application/json")}},fo=function(e){var t=e.open,n=e.title,r=e.onConfirm,s=e.onCancel,o=e.children,a=e.confirmLabel,c=void 0===a?(0,i.__)("OK","code-snippets"):a,l=e.cancelLabel,u=void 0===l?(0,i.__)("Cancel","code-snippets"):l,d=e.confirmButtonClassName;return t?(0,g.jsxs)(H.Modal,{title:n,onRequestClose:s,closeButtonLabel:(0,i.__)("Close dialog","code-snippets"),isDismissible:!0,children:[o,(0,g.jsxs)(H.Flex,{direction:"row",justify:"flex-end",children:[(0,g.jsx)(H.Button,{variant:"tertiary",onClick:s,children:u}),(0,g.jsx)(H.Button,{variant:"primary",onClick:r,className:d,children:c})]})]}):null},ho=function(){return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("p",{style:{marginBlockStart:0},children:(0,a.createInterpolateElement)((0,i.__)("This snippet is currently <strong>active</strong>.","code-snippets"),{strong:(0,g.jsx)("strong",{})})}),(0,g.jsx)("p",{children:(0,i.__)("Moving it to the trash will also deactivate it.","code-snippets")})]})},mo=function(){return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("p",{style:{marginBlockStart:0},children:(0,a.createInterpolateElement)((0,i.__)("The snippet will be <strong>permanently deleted</strong>.","code-snippets"),{strong:(0,g.jsx)("strong",{})})}),(0,g.jsx)("p",{children:(0,i.__)("This action cannot be undone.","code-snippets")})]})},bo=function(e){var t=e.snippet,n=e.isDialogOpen,r=e.setIsDialogOpen,s=e.makeDeleteRequest;return(0,g.jsx)(fo,{open:n,title:(0,i.__)("Are you sure?","code-snippets"),confirmLabel:t.trashed?(0,i.__)("Delete","code-snippets"):(0,i.__)("Trash","code-snippets"),confirmButtonClassName:"is-destructive",onCancel:function(){return r(!1)},onConfirm:function(){r(!1),s()},children:t.trashed?(0,g.jsx)(mo,{}):(0,g.jsx)(ho,{})})},vo=function(e){var t=e.snippet,n=e.setIsWorking,r=e.onSuccess,i=e.onError,a=Zs(),c=s((0,o.useState)(!1),2),l=c[0],u=c[1],d=function(){var e=ae(le().mark(function e(){return le().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return null==n||n(!0),e.prev=1,e.next=4,a.delete(t);case 4:return e.next=6,null==r?void 0:r();case 6:e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),null==i||i(e.t0);case 11:return e.prev=11,null==n||n(!1),e.finish(11);case 14:case"end":return e.stop()}},e,null,[[1,8,11,14]])}));return function(){return e.apply(this,arguments)}}(),p=function(){var e=ae(le().mark(function e(){return le().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.active&&!t.trashed){e.next=4;break}u(!0),e.next=6;break;case 4:return e.next=6,d();case 6:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}();return{requestDelete:p,deleteDialogProps:{snippet:t,isDialogOpen:l,setIsDialogOpen:u,makeDeleteRequest:d}}};function go(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function yo(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?go(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):go(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var jo={css:"text/css",js:"javascript",php:"text/x-php",html:"application/x-httpd-php"},wo=function(){return window.isSecureContext?navigator.clipboard:void 0},xo=function(e){var t,n,r;return{extraKeys:{Tab:!1,"Shift-Tab":!1},readOnly:!0,lineNumbers:!0,theme:null!==(t=null===(n=window.CODE_SNIPPETS_MANAGE)||void 0===n?void 0:n.editorTheme)&&void 0!==t?t:"default",mode:null!==(r=jo[e])&&void 0!==r?r:jo.php,screenReaderLabel:(0,i.__)("Snippet code preview","code-snippets")}},_o=function(e){return e[e.Ready=0]="Ready",e[e.Copied=1]="Copied",e[e.Failed=2]="Failed",e}(_o||{}),Oo=function(e){var t=e.code,n=s((0,o.useState)(_o.Ready),2),r=n[0],a=n[1];return(0,g.jsx)(os,{secondary:!0,onClick:function(){var e=wo();e?e.writeText(t).then(function(){return a(_o.Copied)}).catch(function(){return a(_o.Failed)}):a(_o.Failed)},children:function(){switch(r){case _o.Copied:return(0,i.__)("Copied","code-snippets");case _o.Failed:return(0,i.__)("Copy unavailable","code-snippets");case _o.Ready:return(0,i.__)("Copy code","code-snippets")}}()})},So=function(e){var t=e.onRequestClose,n=e.title,r=e.type,s=e.code,a=e.children,c=(0,o.useRef)(null);return(0,o.useEffect)(function(){if(c.current&&window.wp.codeEditor){var e=window.wp.codeEditor.initialize(c.current,{codemirror:xo(r)});return e.codemirror.getInputField().setAttribute("aria-label",(0,i.__)("Snippet code preview","code-snippets")),function(){e.codemirror.toTextArea()}}},[r]),(0,g.jsxs)(H.Modal,{className:"code-snippets-preview-modal",onRequestClose:t,title:n,headerActions:(0,g.jsx)("div",{className:"code-snippets-preview-modal__badge",children:(0,g.jsx)(Us,{name:r})}),children:[(0,g.jsx)("div",{className:"code-snippets-preview-modal__editor",children:(0,g.jsx)("textarea",{ref:c,readOnly:!0,"aria-label":(0,i.__)("Snippet code preview","code-snippets"),defaultValue:"".concat("php"===r?"<?php\n\n":"").concat(s)})}),a]})},Po=function(e){var t=e.snippet,n=e.setIsOpen,r=e.onDownloaded;return(0,g.jsx)(So,{code:t.code,type:qr(t),title:t.name,onRequestClose:function(){return n(!1)},children:(0,g.jsx)("div",{className:"code-snippets-preview-modal__footer",children:(0,g.jsxs)("div",{className:"code-snippets-preview-modal__buttons",children:[(0,g.jsx)(qs,{snippet:t,onDownloaded:r}),wo()&&(0,g.jsx)(Oo,{code:t.code})]})})})},No=function(e){var t=e.snippet,n=e.isWorking,r=e.setIsWorking,s=e.setIsOpen,o=Zs(),a=ro().refreshSnippetsList;return(0,g.jsx)(os,{secondary:!0,disabled:n,onClick:function(){r(!0),o.create(Vr(t)).then(a).then(function(){return s(!1)}).catch(Jn).finally(function(){return r(!1)})},children:(0,i.__)("Clone","code-snippets")})},Eo=function(e){var t=e.snippet,n=e.isWorking,r=e.setIsWorking,s=Zs();return(0,g.jsx)(os,{secondary:!0,disabled:n,onClick:function(){r(!0),s.export(t).then(function(e){return ao(e,t)}).catch(Jn).finally(function(){return r(!1)})},children:(0,i.__)("Export","code-snippets")})},Co=function(e){var t=e.snippet,n=e.setIsOpen,r=ro().refreshSnippetsList,a=function(){var e=s((0,o.useState)(!1),2),t=e[0],n=e[1],r=(0,o.useRef)(!1);return{isWorking:t,setIsWorking:function(e){r.current=e,n(e)}}}(),c=a.isWorking,l=a.setIsWorking,u=vo({snippet:t,setIsWorking:l,onSuccess:function(){return n(!1),r()},onError:Jn}),d=u.requestDelete,p=u.deleteDialogProps,f=Xr(t);return(0,g.jsx)(So,{code:t.code,type:qr(t),title:Kr(t),onRequestClose:function(){return n(!1)},children:(0,g.jsxs)("div",{className:"code-snippets-preview-modal__footer",children:[(0,g.jsxs)("div",{className:"code-snippets-preview-modal__buttons",children:[(0,g.jsx)("a",{className:"button button-primary",href:Wr(t),children:t.locked||!f?(0,i.__)("View","code-snippets"):(0,i.__)("Edit","code-snippets")}),f&&(0,g.jsx)(No,{snippet:t,isWorking:c,setIsWorking:l,setIsOpen:n}),(0,g.jsx)(Eo,{snippet:t,isWorking:c,setIsWorking:l}),(0,g.jsx)(Oo,{code:t.code}),!t.locked&&f&&(0,g.jsx)(os,{link:!0,className:"code-snippets-preview-modal__trash",disabled:c,onClick:function(){d()},children:(0,i.__)("Trash","code-snippets")})]}),(0,g.jsxs)("div",{className:"code-snippets-preview-modal__priority",children:[(0,g.jsx)("span",{children:(0,i.__)("Priority","code-snippets")}),(0,g.jsx)("span",{className:"code-snippets-preview-modal__priority-value",children:t.priority})]}),(0,g.jsx)(bo,yo({},p))]})})},ko=function(e){var t=e.snippet,n=Nr().doSearch,r=s((0,o.useState)(!1),2),a=r[0],c=r[1];return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("td",{className:"column-name column-primary",children:(0,g.jsx)("strong",{children:(0,g.jsx)("button",{type:"button",className:"cloud-table-name-button",title:(0,i.__)("Preview this snippet","code-snippets"),onClick:function(){return c(!0)},children:t.name})})}),(0,g.jsx)("td",{className:"column-type",children:(0,g.jsx)(Us,{name:qr(t)})}),(0,g.jsx)("td",{className:"column-status",children:(0,g.jsx)($s,{status:t.status})}),(0,g.jsx)("td",{className:"column-desc",children:(0,g.jsx)("div",{className:"cloud-table-description",children:In(Ln(t.description))})}),(0,g.jsxs)("td",{className:"column-actions",children:[(0,g.jsxs)("div",{className:"cloud-snippet-action-buttons",children:[(0,g.jsx)(os,{secondary:!0,onClick:function(){return c(!0)},children:(0,i.__)("Preview","code-snippets")}),(0,g.jsx)(qs,{snippet:t,onDownloaded:n})]}),a&&(0,g.jsx)(Po,{snippet:t,setIsOpen:c,onDownloaded:n})]})]})},Do=function(e){var t=e.availableIds,n=e.selectedIds,r=e.setSelectedIds;return(0,g.jsx)("td",{className:"column-cb check-column",children:(0,g.jsx)("input",{id:"cb-select-all-cloud-snippets",type:"checkbox",checked:t.every(function(e){return n.has(e)}),onChange:function(e){return r(function(n){return new Set(e.target.checked?[].concat(oe(n),oe(t)):oe(n).filter(function(e){return!t.includes(e)}))})},"aria-label":(0,i.__)("Select all snippets","code-snippets")})})},Ao=function(e){var t=e.snippet,n=e.selected,r=e.setSelected;return(0,g.jsx)("th",{scope:"row",className:"check-column",children:Yr(t)&&(0,g.jsx)("input",{id:"cb-select-".concat(t.id),type:"checkbox",name:"checked[]",checked:n.has(t.id),"aria-label":(0,i.sprintf)((0,i.__)("Select %s","code-snippets"),t.name),onChange:function(e){return r(function(n){return new Set(e.target.checked?[].concat(oe(n),[t.id]):oe(n).filter(function(e){return e!==t.id}))})}})})},To=function(e){var t=e.snippets,n=e.selected,r=e.setSelected;return(0,g.jsxs)("table",{className:"wp-list-table widefat fixed striped cloud-snippets-table",children:[(0,g.jsx)("thead",{children:(0,g.jsxs)("tr",{children:[n&&r&&(0,g.jsx)(Do,{selectedIds:n,setSelectedIds:r,availableIds:t.filter(function(e){return Yr(e)}).map(function(e){return e.id})}),(0,g.jsx)("th",{scope:"col",className:"column-name column-primary",children:(0,i.__)("Name","code-snippets")}),(0,g.jsx)("th",{scope:"col",className:"column-type",children:(0,i.__)("Type","code-snippets")}),(0,g.jsx)("th",{scope:"col",className:"column-status",children:(0,i.__)("Status","code-snippets")}),(0,g.jsx)("th",{scope:"col",className:"column-desc",children:(0,i.__)("Description","code-snippets")}),(0,g.jsx)("th",{scope:"col",className:"column-actions",children:(0,g.jsx)("span",{className:"screen-reader-text",children:(0,i.__)("Actions","code-snippets")})})]})}),(0,g.jsx)("tbody",{children:t.map(function(e){return(0,g.jsxs)("tr",{children:[n&&r&&(0,g.jsx)(Ao,{snippet:e,selected:n,setSelected:r}),(0,g.jsx)(ko,{snippet:e})]},e.id)})})]})};const Ro=window.wp.date;function Io(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Lo(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Io(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Io(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Fo=function(e){return(0,g.jsx)("svg",Lo(Lo({width:"19",height:"19",viewBox:"0 0 19 19",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{},{children:(0,g.jsx)("path",{d:"M9.17636 13.7674H5.09053C3.12371 13.7643 1.5293 12.2296 1.5293 10.3362C1.5293 8.44351 3.12371 6.90874 5.09053 6.90874C5.39106 5.56133 6.46242 4.46168 7.90083 4.02351C9.33848 3.58609 10.926 3.87592 12.0639 4.78821C13.2018 5.69821 13.7172 7.08768 13.4174 8.4351H14.1745C15.2298 8.4351 16.1421 9.0568 16.568 9.95686M14.5293 12.2349V16.8232M12.2352 14.529L14.5293 16.8232L16.8234 14.529",stroke:"#FF9800",strokeWidth:"1.41177",strokeLinecap:"round",strokeLinejoin:"round"})}))},Mo=function(e){var t=e.className,n=e.isSelected,r=void 0!==n&&n,s=e.onSelectedChange,o=e.selectionLabel,i=e.footer,a=e.footerStatus,c=e.children;return(0,g.jsxs)("li",{className:v()("code-snippets-card",t,{"is-selectable":void 0!==s,"is-selected":void 0!==s&&r}),children:[void 0!==s?(0,g.jsx)("div",{className:"snippet-card-corner",children:(0,g.jsx)("input",{type:"checkbox",className:"snippet-card-select",checked:r,"aria-label":o,onChange:function(e){return s(e.target.checked)}})}):null,c,void 0!==i||void 0!==a?(0,g.jsxs)("footer",{children:[(0,g.jsx)("div",{className:"snippet-card-footer-status",children:a}),(0,g.jsx)("div",{className:"snippet-card-footer-actions",children:i})]}):null]})},Uo=function(e){var t,n=e.codevaultSlug;return(0,g.jsx)("p",{className:"cloud-snippet-author",children:(0,g.jsx)("a",{href:"".concat(null===(t=window.CODE_SNIPPETS)||void 0===t?void 0:t.urls.cloud,"/codevault/").concat(n),target:"_blank",rel:"noopener noreferrer",children:(0,i.sprintf)((0,i.__)("By %s","code-snippets"),n)})})},Bo=function(e){var t=e.snippet,n=e.author,r=e.setIsPreviewOpen;return(0,g.jsxs)("div",{className:"cloud-snippet card-inner",children:[(0,g.jsxs)("div",{className:"snippet-card-header",children:[(0,g.jsx)(Us,{name:qr(t)}),(0,g.jsx)("h3",{children:(0,g.jsx)("button",{type:"button",className:"cloud-snippet-title-button",title:(0,i.__)("Preview this snippet","code-snippets"),onClick:function(){r(!0)},children:t.name})})]}),0<t.tags.length||t.updated?(0,g.jsxs)("div",{className:"snippet-card-meta",children:[0<t.tags.length?(0,g.jsxs)("span",{className:"cloud-snippet-tags",children:[(0,g.jsx)("span",{className:"snippet-card-tags-label",children:(0,i.__)("Tags:","code-snippets")})," ",t.tags.join(", ")]}):null,t.updated?(0,g.jsx)("time",{className:"snippet-card-modified",dateTime:t.updated,title:t.updated,children:(0,i.sprintf)((0,i.__)("Modified %s","code-snippets"),(0,Ro.humanTimeDiff)(t.updated,void 0))}):null]}):null,t.description?(0,g.jsx)("p",{className:"snippet-description-content",children:In(Ln(t.description))}):null,n]})},Vo=function(e){var t=e.snippet,n=e.author,r=e.isSelected,a=void 0!==r&&r,c=e.onSelectedChange,l=Nr().doSearch,u=s((0,o.useState)(!1),2),d=u[0],p=u[1];return(0,g.jsxs)(Mo,{className:"cloud-search-result",isSelected:a,onSelectedChange:c,selectionLabel:(0,i.sprintf)((0,i.__)("Select %s","code-snippets"),t.name),footerStatus:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(Gs,{status:t.status}),t.update_available?(0,g.jsx)("span",{className:"cloud-snippet-update",title:(0,i.__)("Update available","code-snippets"),children:(0,g.jsx)(Fo,{"aria-label":(0,i.__)("Update available","code-snippets")})}):null]}),footer:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(os,{secondary:!0,onClick:function(){return p(!0)},children:(0,i.__)("Preview","code-snippets")}),(0,g.jsx)(qs,{snippet:t,onDownloaded:l})]}),children:[(0,g.jsx)(Bo,{snippet:t,author:n,setIsPreviewOpen:p}),d&&(0,g.jsx)(Po,{snippet:t,setIsOpen:p,onDownloaded:l})]})},qo=[{paramName:"category",filterName:"categories",label:(0,i.__)("Snippet Category","code-snippets"),allOptionLabel:(0,i.__)("All Categories","code-snippets")},{paramName:"type",filterName:"types",label:(0,i.__)("Snippet Type","code-snippets"),allOptionLabel:(0,i.__)("All Types","code-snippets")},{paramName:"status",filterName:"statuses",label:(0,i.__)("Snippet Status","code-snippets"),allOptionLabel:(0,i.__)("All Statuses","code-snippets")}],Wo=function(){var e=Nr(),t=e.availableFilters,n=e.searchParams,r=e.doSearch,s=qo.filter(function(e){var n=e.filterName;return t[n]&&0<t[n].length});return 0<s.length?(0,g.jsx)("div",{className:"alignleft actions",children:s.map(function(e){var s,i=e.label,a=e.allOptionLabel,c=e.filterName,l=e.paramName;return(0,g.jsxs)(o.Fragment,{children:[(0,g.jsx)("label",{htmlFor:"cloud-search-".concat(c),className:"screen-reader-text",children:i}),(0,g.jsxs)("select",{id:"cloud-search-".concat(c),className:"cloud-search-category-filter",value:n[l],onChange:function(e){return r(h({},l,function(e,t,n){if(""!==n){if("number"==typeof t[e]){var r=Number(n);return isNaN(r)?void 0:r}return n}}(l,n,e.target.value)))},children:[(0,g.jsx)("option",{value:"",children:a}),null===(s=t[c])||void 0===s?void 0:s.map(function(e){return(0,g.jsx)("option",{value:e.id,children:e.name},e.id)})]})]},c)})}):null},Ho=["snippetView"],Ko=["which","doSearch","isSearching","searchResults"];function zo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Go(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?zo(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zo(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var $o=function(){var e=Nr(),t=e.searchParams,n=e.updateSearchParams,r=e.isSearching,a=e.doSearch,c=(0,o.useId)(),l=s((0,o.useState)(t.query),2),u=l[0],d=l[1];return(0,g.jsxs)("form",{className:"cloud-search-form",onSubmit:function(e){e.preventDefault(),a({query:u})},children:[(0,g.jsx)("label",{htmlFor:c,className:"screen-reader-text",children:(0,i.__)("Search method","code-snippets")}),(0,g.jsxs)("select",{id:c,value:t.method,onChange:function(e){return n({method:"codevault"===e.target.value?"codevault":"term"})},children:[(0,g.jsx)("option",{value:"term",children:(0,i.__)("Search by keyword","code-snippets")}),(0,g.jsx)("option",{value:"codevault",children:(0,i.__)("Name of library","code-snippets")})]}),(0,g.jsxs)("div",{className:"cloud-search-query",children:[(0,g.jsx)("input",{id:"cloud-search-query",type:"search",value:u,"aria-label":(0,i.__)("Search query","code-snippets"),onChange:function(e){return d(e.target.value)},placeholder:(0,i.__)("e.g. Remove unused JavaScript…","code-snippets")}),r&&(0,g.jsx)("span",{role:"status","aria-live":"polite",children:(0,g.jsx)("span",{className:"screen-reader-text",children:(0,i.__)("Searching…","code-snippets")})})]}),(0,g.jsx)("button",{type:"submit",className:"button button-primary cloud-search-submit",disabled:r,children:r?(0,g.jsx)(H.Spinner,{}):(0,i.__)("Search Cloud Library","code-snippets")})]})},Jo=function(e){var t=e.snippets,n=e.selected,r=e.setSelected;return(0,g.jsx)("ul",{className:v()("cloud-search-results","code-snippets-cards",{"has-selection":t.some(function(e){return n.has(e.id)})}),children:t.map(function(e){return(0,g.jsx)(Vo,{snippet:e,author:(0,g.jsx)(Uo,{codevaultSlug:e.codevault}),isSelected:n.has(e.id),onSelectedChange:Yr(e)?function(t){r(function(n){var r=new Set(n);return t?r.add(e.id):r.delete(e.id),r})}:void 0},e.id)})})},Qo=[{key:"download",label:(0,i.__)("Download","code-snippets")}],Xo=function(e){var t=e.snippetView,n=m(e,Ho);return"card"===t?(0,g.jsx)(Jo,Go({},n)):(0,g.jsx)(To,Go({},n))},Yo=function(e){var t=e.which,n=e.doSearch,r=e.isSearching,s=e.searchResults,o=m(e,Ko);return(0,g.jsx)(Es,Go({which:t,disabled:r,totalItems:s.totalItems,totalPages:s.totalPages,currentPage:s.page,setCurrentPage:function(e){return n({page:e})}},o))},Zo=function(e){var t=e.snippetView,n=e.setSnippetView,r=Gn().api,i=Nr(),a=i.searchResults,c=i.isSearching,l=i.doSearch,u=s((0,o.useState)(new Set),2),d=u[0],p=u[1];if(!a)return null;var f=function(){var e=ae(le().mark(function e(t,n){return le().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("download"!==t){e.next=4;break}return e.next=3,Promise.all(a.snippets.filter(function(e){return n.has(e.id)&&Yr(e)}).map(function(e){var t=e.id;return r.post("".concat(Mn.cloud.snippets,"/").concat(t,"/download"))}));case 3:l();case 4:case"end":return e.stop()}},e)}));return function(t,n){return e.apply(this,arguments)}}();return(0,g.jsxs)("div",{className:"snippets-list-view",children:[(0,g.jsx)(Yo,{which:"top",isSearching:c,searchResults:a,selected:d,setSelected:p,doSearch:l,actions:Qo,doAction:f,selectAllKeys:"card"===t?a.snippets.filter(function(e){return Yr(e)}).map(function(e){return e.id}):void 0,extraTableNav:function(){return(0,g.jsx)(Wo,{})},endTableNav:function(e){return"top"===e?(0,g.jsx)(Fs,{snippetView:t,setSnippetView:n}):null}}),(0,g.jsx)(Xo,{snippets:a.snippets,snippetView:t,selected:d,setSelected:p}),(0,g.jsx)(Yo,{which:"bottom",isSearching:c,searchResults:a,selected:d,setSelected:p,doSearch:l})]})},ei=function(e){var t=e.snippetView,n=e.setSnippetView,r=Nr(),s=r.searchResults,o=r.searchParams;return s?0<s.page&&0===s.snippets.length?(0,g.jsx)("div",{className:"banner banner-neutral no-results",children:(0,g.jsx)("p",{children:"codevault"===o.method?(0,i.__)("Could not find a codevault with that name. Please try again.","code-snippets"):(0,i.__)("No snippets could be found with that search term. Please try again.","code-snippets")})}):s.snippets.length?(0,g.jsxs)(g.Fragment,{children:[s.isFeatured?(0,g.jsx)("h2",{className:"cloud-featured-heading",children:(0,i.__)("Featured Snippets","code-snippets")}):(0,g.jsx)("h2",{className:"cloud-snippets-heading",children:(0,i.__)("Search Results","code-snippets")}),(0,g.jsx)(Zo,{snippetView:t,setSnippetView:n})]}):null:null},ti=function(){var e=Nr(),t=e.isErrored,n=e.isLoading;return t||n?(0,g.jsx)(ks,{isLoading:n,errorMessage:t?(0,i.__)("An error occurred while fetching search results. Please try again.","code-snippets"):void 0,loadingNotice:(0,i.__)("Loading snippets from cloud…","code-snippets"),noticeLabel:(0,i.__)("Community snippets status","code-snippets")}):null},ni=function(e){var t=e.snippetView,n=e.setSnippetView;return(0,g.jsxs)("div",{className:"cloud-search",children:[(0,g.jsx)($o,{}),(0,g.jsx)(ti,{}),(0,g.jsx)(ei,{snippetView:t,setSnippetView:n})]})},ri=[{name:"snippets",label:(0,i.__)("Snippets","code-snippets")},{name:"bundles",label:(0,i.__)("Bundles","code-snippets"),pro:!0}],si=function(){var e=s((0,o.useState)(function(){return function(e){var t,n=u("tab"),r=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return nr(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?nr(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,s=function(){};return{s,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:s}}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,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){a=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}(e);try{for(r.s();!(t=r.n()).done;){var s=t.value;if(s.name===n)return s}}catch(e){r.e(e)}finally{r.f()}return e[0]}(ri)}),2),t=e[0],n=e[1],r=Qn(),a=r.snippetView,c=r.setSnippetView,l=Nr().searchResults;return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(rr,{className:"community-cloud-nav",ariaLabel:(0,i.__)("Community Cloud types","code-snippets"),tabs:ri,getTabCount:function(e){return"snippets"===e.name?null==l?void 0:l.totalItems:void 0},currentTab:t,setCurrentTab:function(e){d(h({},"tab",e.name)),n(e)}}),(0,g.jsx)(Yn,{hidden:"bundles"===t.name}),(!t.pro||N())&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("div",{className:"snippets-page-header",children:(0,g.jsx)("h1",{children:(0,i.sprintf)((0,i.__)("Community Cloud: %s","code-snippets"),t.label)})}),(0,g.jsx)("hr",{className:"wp-header-end"}),(0,g.jsx)("p",{className:"snippets-page-description",children:(0,i.__)("Search the community cloud and download user-shared snippets directly to your site.","code-snippets")})]}),function(){switch(t.name){case"snippets":return(0,g.jsx)(ni,{snippetView:a,setSnippetView:c});case"bundles":return(0,g.jsx)(G,{})}}()]})},oi=function(){return(0,g.jsx)($n,{children:(0,g.jsx)(fr,{children:(0,g.jsx)(Er,{children:(0,g.jsx)(si,{})})})})};function ii(e,t){return ii=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ii(e,t)}function ai(){ai=function(e,t){return new n(e,void 0,t)};var e=RegExp.prototype,t=new WeakMap;function n(e,r,s){var o=RegExp(e,r);return t.set(o,s||t.get(e)),ii(o,n.prototype)}function r(e,n){var r=t.get(n);return Object.keys(r).reduce(function(t,n){var s=r[n];if("number"==typeof s)t[n]=e[s];else{for(var o=0;void 0===e[s[o]]&&o+1<s.length;)o++;t[n]=e[s[o]]}return t},Object.create(null))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ii(e,t)}(n,RegExp),n.prototype.exec=function(t){var n=e.exec.call(this,t);if(n){n.groups=r(n,this);var s=n.indices;s&&(s.groups=r(s,this))}return n},n.prototype[Symbol.replace]=function(n,s){if("string"==typeof s){var o=t.get(this);return e[Symbol.replace].call(this,n,s.replace(/\$<([^>]+)(>|$)/g,function(e,t,n){if(""===n)return e;var r=o[t];return Array.isArray(r)?"$"+r.join("$"):"number"==typeof r?"$"+r:""}))}if("function"==typeof s){var i=this;return e[Symbol.replace].call(this,n,function(){var e=arguments;return"object"!=c(e[e.length-1])&&(e=[].slice.call(e)).push(r(e,i)),s.apply(this,e)})}return e[Symbol.replace].call(this,n,s)},ai.apply(this,arguments)}var ci=["all","active","inactive","recently_active","locked","unlocked","trashed"],li="all",ui=s(Tn("useSnippetsFilters"),2),di=ui[0],pi=ui[1],fi=function(e){var t=e.children,n=s((0,o.useState)(function(){return u("tag")}),2),r=n[0],i=n[1],a=s((0,o.useState)(function(){return u("s")}),2),c=a[0],l=a[1],p=s((0,o.useState)(function(){var e=u("type");return function(e){return Cr.includes(e)}(e)?e:void 0}),2),f=p[0],h=p[1],m=s((0,o.useState)(function(){var e=u("status");return function(e){return ci.includes(e)}(e)?e:li}),2),b=m[0],v=m[1],y=s((0,o.useMemo)(function(){return r=null!=(n=null==(e=c)?void 0:e.trim().match(ai(/@line:(\d+)/,{line:1})))&&null!==(t=n.groups)&&void 0!==t&&t.line?parseInt(n.groups.line,10):void 0,n&&r?[null==e?void 0:e.replace(n[0],"").trim(),r]:[e,void 0];var e,t,n,r},[c]),2),j=y[0],w=y[1],x={currentTag:r,currentType:f,searchQuery:c,currentStatus:b,searchQueryText:j,searchLineNumber:w,setCurrentType:(0,o.useCallback)(function(e){h(e),d({type:e})},[]),setCurrentStatus:(0,o.useCallback)(function(e){v(e),d({status:li===e?"":e})},[]),setCurrentTag:(0,o.useCallback)(function(e){i(e),d({tag:e})},[]),setSearchQuery:(0,o.useCallback)(function(e){l(e),d({s:e})},[])};return(0,g.jsx)(di.Provider,{value:x,children:t})},hi=function(e,t,n){var r;null!==(r=e.get(t))&&void 0!==r&&r.push(n)||e.set(t,[n])},mi=s(Tn("useFilteredSnippets"),2),bi=mi[0],vi=mi[1],gi=function(e){var t=e.children,n=ro().snippetsList,r=pi(),s=r.currentType,i=r.currentTag,a=r.searchLineNumber,c=r.searchQueryText,l=(0,o.useMemo)(function(){var e,t;return null!==(e=null!=n?n:null===(t=window.CODE_SNIPPETS_MANAGE)||void 0===t||null===(t=t.snippetsList)||void 0===t?void 0:t.map(Ir))&&void 0!==e?e:[]},[n]),u=(0,o.useMemo)(function(){var e=["name","desc","code","tags"],t=null==c?void 0:c.toLowerCase().trim();return l.filter(function(n){return(!s||qr(n)===s)&&!(i&&!n.tags.includes(i))&&(!t||(void 0!==a?null===(r=n.code.split("\n")[a])||void 0===r?void 0:r.includes(t):e.some(function(e){return("tags"===e?n.tags.join(" "):n[e]).toLowerCase().includes(t)})));var r})},[l,i,s,c,a]),d=(0,o.useMemo)(function(){return function(e){return e.reduce(function(e,t){return t.active&&hi(e,t.conditionId,t),e},new Map)}(l)},[l]),p=(0,o.useMemo)(function(){return function(e,t){return e.reduce(function(e,n){return n.trashed?hi(e,"trashed",n):(hi(e,"all",n),hi(e,Jr(n,t)?"active":"inactive",n),hi(e,n.locked?"locked":"unlocked",n),n.lastActive&&hi(e,"recently_active",n)),e},new Map)}(u,d)},[u,d]),f={snippetsByStatus:p,activeByCondition:d};return(0,g.jsx)(bi.Provider,{value:f,children:t})};function yi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ji(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?yi(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yi(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var wi=function(e){var t,n=e.column,r=e.cellProps,s=e.sortColumn,o=e.sortDirection,a=e.setSortColumn,c=e.setSortDirection,l=n.id===(null==s?void 0:s.id),u=l?"asc"===o?"desc":"asc":null!==(t=n.defaultSortDirection)&&void 0!==t?t:"asc",d=l?o:"asc"===u?"desc":"asc",p=l?"asc"===o?"ascending":"descending":void 0;return(0,g.jsx)("th",ji(ji({},r),{},{"aria-sort":p,className:v()(r.className,l?"sorted":"sortable",d),children:(0,g.jsxs)("button",{type:"button",className:"list-table-sort-button",onClick:function(){a(n),c(u)},children:[(0,g.jsx)("span",{className:"sortable-column-title",children:n.title}),(0,g.jsxs)("span",{className:"sorting-indicators",children:[(0,g.jsx)("span",{className:"sorting-indicator asc","aria-hidden":"true"}),(0,g.jsx)("span",{className:"sorting-indicator desc","aria-hidden":"true"})]}),l?null:(0,g.jsx)("span",{className:"screen-reader-text",children:"asc"===u?(0,i.__)("Sort ascending.","code-snippets"):(0,i.__)("Sort descending.","code-snippets")})]})}))},xi=function(e){var t=e.items,n=e.which,r=e.getKey,s=e.columns,o=e.sortColumn,a=e.selected,c=e.setSelected,l=e.setSortColumn,u=e.sortDirection,d=e.setSortDirection;return(0,g.jsxs)("tr",{children:[(0,g.jsx)("td",{className:"column-cb check-column",children:(0,g.jsx)("input",{id:"cb-select-all-".concat(n),type:"checkbox",name:"checked[]",checked:0<t.length&&t.every(function(e){return a.has(r(e))}),"aria-label":(0,i.__)("Select All","code-snippets"),onChange:function(e){c(new Set(e.target.checked?t.map(r):[]))}})}),s.map(function(e){var t={id:"head"===n?e.id.toString():void 0,scope:"col",className:v()("manage-column","column-".concat(e.id),"".concat(e.id,"-column"),{hidden:e.isHidden,"column-primary":e.isPrimary})};return e.sortedValue?(0,g.jsx)(wi,{column:e,cellProps:t,sortColumn:o,sortDirection:u,setSortColumn:l,setSortDirection:d},e.id):(0,g.jsx)("th",ji(ji({},t),{},{children:e.title}),e.id)})]})},_i=function(e){var t=e.item,n=e.selected,r=e.setSelected,s=e.getKey;return(0,g.jsx)("th",{scope:"row",className:"check-column",children:(0,g.jsx)("input",{id:"cb-select-".concat(s(t)),type:"checkbox",name:"checked[]","aria-label":(0,i.__)("Select snippet","code-snippets"),checked:n.has(s(t)),onChange:function(e){r(function(n){var r=new Set(n);return e.target.checked?r.add(s(t)):r.delete(s(t)),r})}})})},Oi=function(e){var t=e.item,n=e.column,r=v()("".concat(n.id,"-column"),"column-".concat(n.id),{hidden:n.isHidden});return n.isHeading?(0,g.jsx)("th",{className:r,children:n.render(t)}):(0,g.jsx)("td",{className:r,children:n.render(t)})},Si=function(e){var t=e.items,n=e.getKey,r=e.columns,s=e.noItems,o=e.selected,i=e.setSelected,a=e.rowClassName;return 0<t.length?t.map(function(e){return(0,g.jsxs)("tr",{className:null==a?void 0:a(e),children:[(0,g.jsx)(_i,{item:e,selected:o,setSelected:i,getKey:n}),r.map(function(t){return(0,g.jsx)(Oi,{item:e,column:t},t.id)})]},n(e))}):(0,g.jsx)("tr",{className:"no-items",children:(0,g.jsx)("td",{className:"colspanchange",colSpan:r.length,children:s})})},Pi=["fixed","striped","children","className"],Ni=["items","getKey","totalPages","pageSearchParam","initialSort"],Ei=["getKey","actions","columns","noItems","doAction","disabled","totalItems","totalPages","currentPage","beforeTable","endTableNav","rowClassName","visibleItems","sortDirection","extraTableNav","selectAllControl","setCurrentPage","pageSearchParam"];function Ci(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ki(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ci(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ci(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Di=function(e,t,n){return new Set(e.map(t).filter(function(e){return n.has(e)}))},Ai=function(e){var t=e.fixed,n=e.striped,r=e.children,s=e.className,o=m(e,Pi);return(0,g.jsxs)("table",{className:v()("wp-list-table widefat",{striped:n,fixed:t},s),children:[(0,g.jsx)("thead",{children:(0,g.jsx)(xi,ki({which:"head"},o))}),(0,g.jsx)("tbody",{children:r}),(0,g.jsx)("tfoot",{children:(0,g.jsx)(xi,ki({which:"foot"},o))})]})},Ti=function(e){var t=e.items,n=e.getKey,r=e.totalPages,i=e.pageSearchParam,a=void 0===i?"paged":i,c=e.initialSort,l=m(e,Ni),d=s((0,o.useState)(function(){return c?l.columns.find(function(e){return e.id===c.columnId&&e.sortedValue}):void 0}),2),p=d[0],f=d[1],h=s((0,o.useState)(function(){return a&&Number(u(a))||1}),2),b=h[0],v=h[1],y=s((0,o.useState)(function(){var e;return null!==(e=null==c?void 0:c.direction)&&void 0!==e?e:"asc"}),2),j=y[0],w=y[1],x=(0,o.useMemo)(function(){return function(e,t){var n=t.currentPage,r=t.totalPages;if(r){var s=Math.ceil(e.length/r),o=(n-1)*s,i=o+s;return e.slice(o,i)}return e}(function(e,t,n){return e.toSorted(function(e,r){var s,o,i=null==t||null===(s=t.sortedValue)||void 0===s?void 0:s.call(t,e),a=null==t||null===(o=t.sortedValue)||void 0===o?void 0:o.call(t,r);return void 0===i||void 0===a?0:i<a?"asc"===n?-1:1:i>a?"asc"===n?1:-1:0})}(t,p,j),{currentPage:b,totalPages:r})},[t,p,j,b,r]);return(0,g.jsx)(Ri,ki({getKey:n,totalItems:t.length,totalPages:r,visibleItems:x,pageSearchParam:a,sortColumn:p,sortDirection:j,currentPage:b,setSortColumn:f,setSortDirection:w,setCurrentPage:v},l))},Ri=function(e){var t=e.getKey,n=e.actions,r=e.columns,i=e.noItems,a=e.doAction,c=e.disabled,l=void 0!==c&&c,u=e.totalItems,d=e.totalPages,p=e.currentPage,f=e.beforeTable,h=e.endTableNav,b=e.rowClassName,v=e.visibleItems,y=e.sortDirection,j=void 0===y?"asc":y,w=e.extraTableNav,x=e.selectAllControl,_=e.setCurrentPage,O=e.pageSearchParam,S=m(e,Ei),P=s((0,o.useState)(function(){return new Set}),2),N=P[0],E=P[1];return(0,g.jsxs)(Cs,{totalItems:u,selected:Di(v,t,N),selectAllKeys:x?v.map(t):void 0,actions:n,doAction:a,extraTableNav:w,endTableNav:h,disabled:l,currentPage:p,totalPages:d,pageSearchParam:O,setSelected:E,setCurrentPage:_,children:[f,(0,g.jsx)(Ai,ki(ki({items:v},S),{},{getKey:t,columns:r,selected:N,setSelected:E,sortDirection:j,children:(0,g.jsx)(Si,{items:v,getKey:t,columns:r,noItems:i,rowClassName:b,selected:N,setSelected:E})}))]})};function Ii(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Li(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ii(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ii(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Fi=function(e){return(0,g.jsxs)("svg",Li(Li({width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{},{children:[(0,g.jsx)("circle",{cx:"9",cy:"3.5",r:"1.6",fill:"currentColor"}),(0,g.jsx)("circle",{cx:"9",cy:"9",r:"1.6",fill:"currentColor"}),(0,g.jsx)("circle",{cx:"9",cy:"14.5",r:"1.6",fill:"currentColor"})]}))},Mi=["button:not(:disabled)","[href]","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)",'[tabindex]:not([tabindex="-1"])'].join(", "),Ui=(0,o.createContext)({closeMenu:function(){}}),Bi=function(e){var t=e.onSelect,n=e.destructive,r=e.disabled,s=e.className,i=e.children,a=(0,o.useContext)(Ui).closeMenu;return(0,g.jsx)("li",{children:(0,g.jsx)("button",{type:"button",className:v()("kebab-menu-item",{"kebab-menu-item-destructive":n},s),disabled:r,onClick:function(){null==t||t(),a()},children:i})})},Vi=function(){return(0,g.jsx)("li",{"aria-hidden":"true",className:"kebab-menu-divider"})},qi=function(e){var t=e.className,n=e.children;return(0,g.jsx)("li",{className:v()("kebab-menu-row",t),children:n})},Wi=function(e){var t=e.label,n=e.className,r=e.children,i=s((0,o.useState)(!1),2),a=i[0],c=i[1],l=(0,o.useRef)(null),u=(0,o.useRef)(null),d=(0,o.useRef)(null),p=(0,o.useId)(),f=(0,o.useCallback)(function(){var e;c(!1),null===(e=u.current)||void 0===e||e.focus()},[]),h={isOpen:a,setIsOpen:c,closeMenu:f,containerRef:l,triggerRef:u,popoverRef:d},m=function(e){var t=e.isOpen,n=e.triggerRef,r=e.popoverRef,i=s((0,o.useState)(!1),2),a=i[0],c=i[1];return(0,o.useLayoutEffect)(function(){if(t&&r.current){var e,s,o=r.current.getBoundingClientRect(),i=null===(e=n.current)||void 0===e?void 0:e.getBoundingClientRect();c(o.bottom>window.innerHeight&&(null!==(s=null==i?void 0:i.top)&&void 0!==s?s:0)>o.height);var a=r.current.querySelector("button:not(:disabled)");(null!=a?a:r.current).focus()}else c(!1)},[t,n,r]),a}(h);return function(e){var t=e.isOpen,n=e.setIsOpen,r=e.closeMenu,s=e.containerRef,i=e.popoverRef;(0,o.useEffect)(function(){if(t){var e=function(e){var t;e.target instanceof Node&&(null===(t=s.current)||void 0===t||!t.contains(e.target))&&n(!1)},o=function(e){var t;e.target instanceof Node&&(null===(t=s.current)||void 0===t||!t.contains(e.target))&&n(!1)},a=function(e){return function(e,t){var n=t.closeMenu,r=t.popoverRef;if("Escape"===e.key)return e.preventDefault(),void n();if(r.current){var s=document.activeElement;if(!(s instanceof HTMLElement&&(s.isContentEditable||s.matches("input, select, textarea")))){var o=Array.from(r.current.querySelectorAll(Mi)),i=s instanceof HTMLElement?o.indexOf(s):-1;0<o.length&&["ArrowDown","ArrowUp","Home","End"].includes(e.key)&&(e.preventDefault(),o[function(){switch(e.key){case"Home":return 0;case"End":return o.length-1;default:return(i+("ArrowDown"===e.key?1:-1)+o.length)%o.length}}()].focus())}}}(e,{closeMenu:r,popoverRef:i})};return document.addEventListener("mousedown",e),document.addEventListener("focusin",o),document.addEventListener("keydown",a),function(){document.removeEventListener("mousedown",e),document.removeEventListener("focusin",o),document.removeEventListener("keydown",a)}}},[t,n,r,s,i])}(h),(0,g.jsxs)("div",{ref:l,className:v()("kebab-menu",n),children:[(0,g.jsx)("button",{ref:u,type:"button",className:"kebab-menu-trigger","aria-label":t,"aria-expanded":a,"aria-controls":p,onClick:function(){return c(function(e){return!e})},children:(0,g.jsx)(Fi,{})}),a?(0,g.jsx)(Ui.Provider,{value:{closeMenu:f},children:(0,g.jsx)("ul",{ref:d,id:p,tabIndex:-1,"aria-label":t,className:v()("kebab-menu-popover",{"kebab-menu-popover-top":m}),children:r})}):null]})};function Hi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ki(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Hi(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Hi(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var zi=function(e){var t=e.snippet,n=s((0,o.useState)(t.priority),2),r=n[0],a=n[1],c=Zs(),l=ro().refreshSnippetsList,u=function(){Number.isNaN(r)||r===t.priority?a(t.priority):c.update(Ki(Ki({},t),{},{priority:r})).then(function(e){e.id===t.id&&a(e.priority)}).then(l).catch(Jn)};return(0,g.jsx)("form",{onSubmit:function(e){e.preventDefault(),u()},children:(0,g.jsx)("input",{id:"snippet-".concat(t.id,"-priority"),type:"number",className:"snippet-priority",value:r,step:"1",onBlur:u,"aria-label":(0,i.__)("Snippet priority","code-snippets"),onChange:function(e){return a(Number(e.target.value))},disabled:t.locked||t.trashed})})};function Gi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function $i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Gi(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Gi(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Ji=function(e){var t=e.snippet,n=s((0,o.useState)(!1),2),r=n[0],a=n[1];return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(os,{link:!0,onClick:function(){return a(!0)},children:(0,i.__)("Preview","code-snippets")}),r&&(0,g.jsx)(Co,{snippet:t,setIsOpen:a})]})},Qi=function(e){return e[e.Ready=0]="Ready",e[e.Working=1]="Working",e[e.Errored=2]="Errored",e}(Qi||{}),Xi=function(e){var t=e.action,n=e.label,r=e.workingLabel,a=e.failedLabel,c=e.className,l=s((0,o.useState)(Qi.Ready),2),u=l[0],d=l[1];return(0,g.jsx)(os,{link:!0,className:v()(c,{"is-busy":u===Qi.Working}),disabled:u===Qi.Working,onClick:function(){switch(u){case Qi.Errored:d(Qi.Ready);break;case Qi.Working:break;case Qi.Ready:d(Qi.Working),t().then(function(){return d(Qi.Ready)}).catch(function(){d(Qi.Errored)})}},children:function(){switch(u){case Qi.Working:return(0,g.jsxs)("span",{className:"snippet-row-action-feedback",children:[(0,g.jsx)(H.Spinner,{})," ",null!=r?r:(0,i.__)("Loading…","code-snippets")]});case Qi.Errored:return(0,g.jsxs)("span",{className:"snippet-row-action-error",children:[(0,g.jsx)("span",{className:"dashicons dashicons-warning"}),null!=a?a:(0,i.__)("Failed","code-snippets")]});default:return n}}()})},Yi=function(e){var t=e.snippet,n=ro().refreshSnippetsList,r=vo({snippet:t,onSuccess:n}),s=r.requestDelete,o=r.deleteDialogProps;return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(Xi,{action:s,className:"delete",label:t.trashed?(0,i.__)("Delete Permanently","code-snippets"):(0,i.__)("Trash","code-snippets"),workingLabel:t.trashed?(0,i.__)("Deleting…","code-snippets"):(0,i.__)("Trashing…","code-snippets"),failedLabel:(0,i.__)("Failed to delete","code-snippets")}),(0,g.jsx)(bo,$i({},o))]})},Zi=function(e){var t=e.snippet,n=Zs(),r=ro().refreshSnippetsList,s=t.trashed?null:(0,g.jsx)(Ji,{snippet:t}),o=t.trashed?null:(0,g.jsx)("a",{href:Wr(t),children:t.locked?(0,i.__)("View","code-snippets"):(0,i.__)("Edit","code-snippets")}),a=t.trashed?null:(0,g.jsx)(Xi,{label:(0,i.__)("Clone","code-snippets"),workingLabel:(0,i.__)("Cloning…","code-snippets"),action:function(){return n.create(Vr(t)).then(r)}}),c=t.trashed?null:(0,g.jsx)(Xi,{label:(0,i.__)("Export","code-snippets"),workingLabel:(0,i.__)("Exporting…","code-snippets"),action:function(){return n.export(t).then(function(e){return ao(e,t)})}}),l=t.trashed?(0,g.jsx)(Xi,{label:(0,i.__)("Restore","code-snippets"),workingLabel:(0,i.__)("Restoring…","code-snippets"),action:function(){return n.restore(t).then(r)}}):null,u=!t.locked||t.trashed?(0,g.jsx)(Yi,{snippet:t}):null;return(0,g.jsx)(g.Fragment,{children:[s,o,a,l,c,u].filter(function(e){return e}).reduce(function(e,t){return null===e?(0,g.jsx)(g.Fragment,{children:t}):(0,g.jsxs)(g.Fragment,{children:[e," | ",t]})},null)})},ea=function(e){var t,n=e.snippet;return P()||!n.network||n.shared_network?!n.shared_network||null!==(t=window.CODE_SNIPPETS_MANAGE)&&void 0!==t&&t.hasNetworkCap?(0,g.jsx)("div",{className:v()("row-actions",{visible:!n.trashed}),children:(0,g.jsx)(Zi,{snippet:n})}):null:(0,g.jsx)("div",{className:"row-actions visible",children:n.active?(0,g.jsx)("span",{className:"network-active",children:(0,i.__)("Network Active","code-snippets")}):(0,g.jsx)("span",{className:"network-only",children:(0,i.__)("Network Only","code-snippets")})})};function ta(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function na(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ta(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ta(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var ra=function(e){var t,n,r=e.snippet;return(0,g.jsxs)("a",{className:"snippet-execution-button",title:(0,i.__)("Run Once","code-snippets"),href:f(window.location.href,{action:"run-once",snippet:r.id,network:r.network?"true":"false",_wpnonce:null!==(t=null===(n=window.CODE_SNIPPETS_MANAGE)||void 0===n?void 0:n.runOnceNonce)&&void 0!==t?t:""}),children:[(0,g.jsx)("span",{className:"screen-reader-text",children:(0,i.__)("Run Once","code-snippets")}),(0,g.jsx)("span",{"aria-hidden":"true",children:" "})]})},sa=function(e){var t=e.snippet,n=Zs(),r=n.activate,s=n.deactivate,o=ro().refreshSnippetsList,a=t.network&&!t.shared_network?t.active?(0,i.__)("Network Deactivate","code-snippets"):(0,i.__)("Network Activate","code-snippets"):t.active?(0,i.__)("Deactivate","code-snippets"):(0,i.__)("Activate","code-snippets");return(0,g.jsx)("input",{id:"snippet-".concat(t.id,"-switch"),type:"checkbox",role:"switch",checked:t.active,"aria-checked":t.active,className:"switch",title:a,"aria-label":a,onChange:function(){(t.active?s(t):r(t)).then(o).catch(Jn)}})},oa=function(e){var t,n,r=e.snippet,s=vi().activeByCondition;if(r.trashed)return"";switch(r.scope){case"single-use":return(0,g.jsx)(ra,{snippet:r});case"condition":return(0,g.jsx)("a",{className:"snippet-condition-count",href:Wr(r),children:null!==(t=null===(n=s.get(r.id))||void 0===n?void 0:n.length)&&void 0!==t?t:0});default:return(0,g.jsx)(sa,{snippet:r})}},ia=function(e){var t=e.snippet;return(0,g.jsx)("div",{className:"extra-icons",children:t.locked&&(0,g.jsx)(Bs,{inline:!0,end:!0,label:(0,i.__)("About snippet lock","code-snippets"),icon:(0,g.jsx)("span",{className:"dashicons dashicons-lock","aria-hidden":"true"}),children:(0,i.__)("This snippet is locked and cannot be modified.","code-snippets")})})},aa=function(e){var t,n=e.snippet;return(0,g.jsxs)(g.Fragment,{children:[!n.trashed&&(P()||!n.network||null!==(t=window.CODE_SNIPPETS_MANAGE)&&void 0!==t&&t.hasNetworkCap)?(0,g.jsx)("a",{href:Wr(n),className:"snippet-name",title:Kr(n),children:Kr(n)}):(0,g.jsx)("span",{className:"snippet-name",title:Kr(n),children:Kr(n)}),n.shared_network&&(0,g.jsx)("span",{className:"badge",children:(0,i.__)("Shared on Network","code-snippets")})]})},ca=function(e){var t=e.snippet;return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(ia,{snippet:t}),(0,g.jsx)(aa,{snippet:t}),(0,g.jsx)(ea,{snippet:t})]})},la=function(e){var t=e.snippet,n=pi().setCurrentType,r=qr(t);return(0,g.jsx)("a",{href:f(window.location.href,{type:r}),onClick:function(e){e.preventDefault(),n(r)},children:(0,g.jsx)(Us,{name:r})})},ua=function(e){var t=e.snippet;return t.tags.map(function(e,n){return(0,g.jsxs)(o.Fragment,{children:[(0,g.jsx)("a",{href:f(window.location.href,{tag:e}),children:e},e),n<t.tags.length-1?", ":""]},e)})},da=function(e){var t=e.snippet;return t.modified?(0,g.jsx)("span",{className:"modified-column-content",title:t.modified,children:(0,g.jsx)("time",{dateTime:t.modified,children:(0,Ro.humanTimeDiff)(t.modified,void 0)})}):(0,g.jsx)(g.Fragment,{children:"—"})},pa=[{id:"activate",title:(0,g.jsx)("span",{className:"screen-reader-text",children:(0,i.__)("Activate","code-snippets")}),render:function(e){return(0,g.jsx)(oa,{snippet:e})}},{id:"name",title:(0,i.__)("Name","code-snippets"),isPrimary:!0,sortedValue:function(e){return Kr(e).toLowerCase()},render:function(e){return(0,g.jsx)(ca,{snippet:e})}},{id:"type",title:(0,i.__)("Type","code-snippets"),sortedValue:function(e){return qr(e)},render:function(e){return(0,g.jsx)(la,{snippet:e})}},{id:"desc",title:(0,i.__)("Description","code-snippets"),render:function(e){return(0,g.jsx)("div",{className:"snippet-description-content",children:(0,g.jsx)(a.RawHTML,{children:e.desc})})}},{id:"tags",title:(0,i.__)("Tags","code-snippets"),render:function(e){return(0,g.jsx)(ua,{snippet:e})}},{id:"date",title:(0,i.__)("Modified","code-snippets"),sortedValue:function(e){return e.modified?new Date(e.modified).toISOString():""},render:function(e){return(0,g.jsx)(da,{snippet:e})}},{id:"priority",title:(0,i.__)("Priority","code-snippets"),sortedValue:function(e){return e.priority},render:function(e){return(0,g.jsx)(zi,{snippet:e})}}];function fa(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ha(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fa(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fa(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var ma=function(e){var t=e.snippet,n=s((0,o.useState)(!1),2),r=n[0],a=n[1];return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(os,{secondary:!0,onClick:function(){return a(!0)},children:(0,i.__)("Preview","code-snippets")}),r&&(0,g.jsx)(Co,{snippet:t,setIsOpen:a})]})},ba=function(e){var t=e.snippet,n=Zs(),r=ro().refreshSnippetsList;return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(Bi,{onSelect:function(){n.create(Vr(t)).then(r).catch(Jn)},children:(0,i.__)("Clone","code-snippets")}),(0,g.jsx)(Bi,{onSelect:function(){n.export(t).then(function(e){return ao(e,t)}).catch(Jn)},children:(0,i.__)("Export","code-snippets")}),(0,g.jsx)(Vi,{})]})},va=function(e){var t=e.snippet,n=e.requestDelete,r=Zs(),s=ro().refreshSnippetsList;return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(Vi,{}),t.trashed?(0,g.jsx)(Bi,{onSelect:function(){r.restore(t).then(s).catch(Jn)},children:(0,i.__)("Restore","code-snippets")}):null,(0,g.jsx)(Bi,{destructive:!0,onSelect:n,children:t.trashed?(0,i.__)("Delete Permanently","code-snippets"):(0,i.__)("Trash","code-snippets")})]})},ga=function(e){var t=e.snippet,n=ro().refreshSnippetsList,r=Xr(t),s=vo({snippet:t,onSuccess:n,onError:Jn}),o=s.requestDelete,a=s.deleteDialogProps;return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(Wi,{label:(0,i.sprintf)((0,i.__)("Actions for %s","code-snippets"),Kr(t)),children:[r&&!t.trashed?(0,g.jsx)(ba,{snippet:t}):null,(0,g.jsxs)(qi,{className:"kebab-menu-priority",children:[(0,g.jsx)("label",{htmlFor:"snippet-".concat(t.id,"-priority"),children:(0,i.__)("Priority","code-snippets")}),(0,g.jsx)(zi,{snippet:t})]}),r&&(t.trashed||!t.locked)&&(0,g.jsx)(va,{snippet:t,requestDelete:function(){o()}})]}),(0,g.jsx)(bo,ha({},a))]})},ya=function(e){var t=e.snippet;return(0,g.jsxs)(g.Fragment,{children:[Qr(t)?t.active?(0,g.jsx)("span",{className:"network-active",children:(0,i.__)("Network Active","code-snippets")}):(0,g.jsx)("span",{className:"network-only",children:(0,i.__)("Network Only","code-snippets")}):null,t.trashed?null:(0,g.jsx)(ma,{snippet:t}),!t.trashed&&Xr(t)?(0,g.jsx)("a",{className:"button button-primary",href:Wr(t),children:t.locked?(0,i.__)("View","code-snippets"):(0,i.__)("Edit","code-snippets")}):null,(0,g.jsx)(ga,{snippet:t})]})},ja=function(e){var t=e.snippet;return t.modified?(0,g.jsx)("time",{className:"snippet-card-modified",dateTime:t.modified,title:t.modified,children:(0,i.sprintf)((0,i.__)("Modified %s","code-snippets"),(0,Ro.humanTimeDiff)(t.modified,void 0))}):null},wa=function(e){var t=e.snippet,n=e.isSelected,r=e.onSelectedChange,s=vi().activeByCondition;return(0,g.jsx)(Mo,{className:v()("snippet","".concat(Jr(t,s)?"active":"inactive","-snippet"),"".concat(qr(t),"-snippet"),"".concat(t.scope,"-snippet")),isSelected:n,onSelectedChange:r,selectionLabel:(0,i.sprintf)((0,i.__)("Select %s","code-snippets"),Kr(t)),footer:(0,g.jsx)(ya,{snippet:t}),children:(0,g.jsxs)("div",{className:"card-inner",children:[(0,g.jsxs)("div",{className:"snippet-card-header",children:[(0,g.jsx)(oa,{snippet:t}),(0,g.jsx)(la,{snippet:t}),(0,g.jsx)("h3",{children:(0,g.jsx)(aa,{snippet:t})}),(0,g.jsx)(ia,{snippet:t})]}),(0<t.tags.length||!!t.modified)&&(0,g.jsxs)("div",{className:v()("snippet-card-meta",{"has-tags":0<t.tags.length}),children:[0<t.tags.length&&(0,g.jsxs)("span",{className:"snippet-card-tags",children:[(0,g.jsx)("span",{className:"snippet-card-tags-label",children:(0,i.__)("Tags:","code-snippets")})," ",(0,g.jsx)(ua,{snippet:t})]}),(0,g.jsx)(ja,{snippet:t})]}),t.desc&&(0,g.jsx)("div",{className:"snippet-description-content",children:(0,g.jsx)(a.RawHTML,{children:t.desc})})]})})},xa="paged",_a=function(e){var t=e.snippets,n=e.noItems,r=e.selected,s=e.setSelected;return 0<t.length?(0,g.jsx)("ul",{className:v()("code-snippets-cards","snippets-card-grid",{"has-selection":t.some(function(e){return r.has(e.id)})}),children:t.map(function(e){return(0,g.jsx)(wa,{snippet:e,isSelected:r.has(e.id),onSelectedChange:function(t){s(function(n){var r=new Set(n);return t?r.add(e.id):r.delete(e.id),r})}},e.id)})}):(0,g.jsx)("p",{className:"no-items",children:n})},Oa=function(e,t){return new Set(oe(e).filter(function(e){return t.some(function(t){return t.id===e})}))},Sa=function(e){var t=e.snippets,n=e.actions,r=e.doAction,i=e.extraTableNav,a=e.endTableNav,c=e.itemsPerPage,l=e.noItems,d=e.beforeGrid,p=s((0,o.useState)(function(){return new Set}),2),f=p[0],h=p[1],m=s((0,o.useState)(function(){return Number(u(xa))||1}),2),b=m[0],v=m[1],y=function(e){var t=e.snippets,n=e.itemsPerPage,r=e.currentPage,s=n?Math.ceil(t.length/n):0,i=s?Math.min(r,s):1,a=(0,o.useMemo)(function(){return n?t.slice((i-1)*n,i*n):t},[t,n,i]);return{totalPages:s,safePage:i,visibleSnippets:a}}({snippets:t,itemsPerPage:c,currentPage:b}),j=y.totalPages,w=y.safePage,x=y.visibleSnippets;return(0,g.jsx)("div",{className:"snippets-card-grid-container",children:(0,g.jsxs)(Cs,{totalItems:t.length,totalPages:0<j?j:void 0,currentPage:w,setCurrentPage:v,pageSearchParam:xa,selected:Oa(f,x),setSelected:h,selectAllKeys:x.map(function(e){return e.id}),actions:n,doAction:r,extraTableNav:i,endTableNav:a,children:[d,(0,g.jsx)(_a,{snippets:x,noItems:l,selected:f,setSelected:h})]})})},Pa=function(){var e=pi(),t=e.searchQuery,n=e.setSearchQuery;return(0,g.jsx)("search",{className:"snippets-search-area",children:(0,g.jsx)("form",{className:"search-box","aria-label":(0,i.__)("Search Snippets","code-snippets"),onSubmit:function(e){e.preventDefault()},children:(0,g.jsx)("input",{type:"search",id:"snippets_search",name:"s",value:null!=t?t:"","aria-label":(0,i.__)("Search Snippets:","code-snippets"),onChange:function(e){return n(e.target.value)},placeholder:(0,i.__)("Search snippets","code-snippets")})})})},Na=function(){var e=pi(),t=e.searchQueryText,n=e.searchLineNumber,r=e.currentTag,s=e.setSearchQuery,o=e.setCurrentTag;return t||r?(0,g.jsxs)("p",{className:"snippets-search-subtitle",children:[(0,i.__)("Search results","code-snippets"),t&&(0,i.sprintf)((0,i.__)(" for “%s”","code-snippets"),t),n&&(0,i.sprintf)((0,i.__)(" on line “%d”","code-snippets"),n),r&&(0,i.sprintf)((0,i.__)(" in tag “%s”","code-snippets"),r)," ",(0,g.jsx)(os,{small:!0,className:"clear-filters",onClick:function(){s(),o()},children:(0,i.__)("Clear Filters","code-snippets")})]}):null},Ea=[["all",(0,i.__)("All","code-snippets")],["active",(0,i.__)("Active","code-snippets")],["inactive",(0,i.__)("Inactive","code-snippets")],["recently_active",(0,i.__)("Recently Active","code-snippets")],["locked",(0,i.__)("Locked","code-snippets")],["unlocked",(0,i.__)("Unlocked","code-snippets")],["trashed",(0,i.__)("Trashed","code-snippets")]],Ca=function(){var e=pi(),t=e.currentStatus,n=e.setCurrentStatus,r=vi().snippetsByStatus,a=Ea.filter(function(e){var t=s(e,1)[0];return r.has(t)&&("unlocked"!==t||r.has("locked"))});return(0,g.jsx)("ul",{className:"subsubsub",children:a.map(function(e){var a,c,l=s(e,2),u=l[0],d=l[1];return(0,g.jsx)(o.Fragment,{children:(0,g.jsx)("li",{className:u,children:(0,g.jsxs)("a",{href:f(window.location.href,{status:li===u?void 0:u}),className:t===u?"current":void 0,"aria-current":t===u?"page":void 0,onClick:function(e){e.preventDefault(),n(u)},children:[d," ",(0,g.jsx)("span",{className:"count",children:(0,i.sprintf)((0,i._x)("(%d)","table view count","code-snippets"),null!==(a=null===(c=r.get(u))||void 0===c?void 0:c.length)&&void 0!==a?a:0)})]})})},u)})})},ka=function(){var e=Gn().api,t=ro().refreshSnippetsList;return"recently_active"===pi().currentStatus?(0,g.jsx)("div",{className:"alignleft actions",children:(0,g.jsx)(ts,{secondary:!0,name:"clear-recent-list",text:(0,i.__)("Clear List","code-snippets"),onClick:function(n){n.preventDefault(),e.del(Mn.recentlyActive).then(t).catch(Jn)}})}):null},Da=function(e){var t=e.visibleSnippets,n=pi(),r=n.currentTag,s=n.setCurrentTag,a=(0,o.useId)(),c=(0,o.useMemo)(function(){return t.reduce(function(e,t){return t.tags.forEach(function(t){return e.add(t)}),e},new Set)},[t]);return 0<c.size?(0,g.jsxs)("div",{className:"alignleft actions",children:[(0,g.jsx)("label",{htmlFor:a,className:"screen-reader-text",children:(0,i.__)("Filter snippets by tag","code-snippets")}),(0,g.jsxs)("select",{id:a,name:"tag",value:r,"aria-label":(0,i.__)("Filter snippets by tag","code-snippets"),onChange:function(e){return s(e.target.value)},children:[(0,g.jsx)("option",{value:"",children:(0,i.__)("All Tags","code-snippets")}),oe(c).map(function(e){return(0,g.jsx)("option",{value:e,children:e},e)})]})]}):null},Aa=function(e){var t=e.which,n=e.visibleSnippets;return(0,g.jsxs)(g.Fragment,{children:["top"===t&&(0,g.jsx)(Da,{visibleSnippets:n}),(0,g.jsx)(ka,{}),"top"===t&&(0,g.jsx)(Pa,{})]})},Ta=function(){return(0,g.jsx)("div",{className:"snippets-table-toolbar",children:(0,g.jsx)(Ca,{})})};function Ra(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return Ia(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ia(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,s=function(){};return{s,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:s}}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,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){a=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}function Ia(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}var La,Fa,Ma,Ua=[{key:"activate",label:(0,i.__)("Activate","code-snippets")},{key:"deactivate",label:(0,i.__)("Deactivate","code-snippets")},{key:"clone",label:(0,i.__)("Clone","code-snippets")},{key:"export",label:(0,i.__)("Export","code-snippets")},{key:"download",label:(0,i.__)("Download","code-snippets")},{key:"trash",label:(0,i.__)("Trash","code-snippets")}],Ba=[{key:"restore",label:(0,i.__)("Restore","code-snippets")},{key:"delete",label:(0,i.__)("Delete Permanently","code-snippets")}],Va=function(e){var t,n;if(0===e.length)return Promise.resolve();var r=document.createElement("form"),s=function(e,t){var n=document.createElement("input");n.type="hidden",n.name=e,n.value=t,r.appendChild(n)};return r.method="post",r.action=window.location.href,r.hidden=!0,s("code_snippets_action","bulk-download"),s("code_snippets_bulk_download_nonce",null!==(t=null===(n=window.CODE_SNIPPETS_MANAGE)||void 0===n?void 0:n.bulkDownloadNonce)&&void 0!==t?t:""),s("snippets",JSON.stringify(e.map(function(e){return{id:e.id,network:e.network}}))),document.body.appendChild(r),r.submit(),window.setTimeout(function(){r.remove()},0),Promise.resolve()},qa=function(e){return e.reduce(function(e,t){return e.then(function(){return new Promise(function(e){Va([t]),window.setTimeout(e,200)})})},Promise.resolve())},Wa=function(){var e=ae(le().mark(function e(t,n,r){var s,o,i;return le().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(0<t.length)){e.next=20;break}s=Ra(t),e.prev=2,s.s();case 4:if((o=s.n()).done){e.next=10;break}return i=o.value,e.next=8,n(i).catch(Jn);case 8:e.next=4;break;case 10:e.next=15;break;case 12:e.prev=12,e.t0=e.catch(2),s.e(e.t0);case 15:return e.prev=15,s.f(),e.finish(15);case 18:return e.next=20,r();case 20:case"end":return e.stop()}},e,null,[[2,12,15,18]])}));return function(t,n,r){return e.apply(this,arguments)}}(),Ha=function(){var e,t=pi(),n=t.currentType,r=t.currentTag,s=t.searchQuery,o=n?(0,i.__)("You don't have snippets of this type yet.","code-snippets"):(0,i.__)("You don't have any snippets yet.","code-snippets");return s||r?(0,g.jsxs)(g.Fragment,{children:[(0,i.__)("No snippets were found matching the current search query.","code-snippets"),(0,i.__)(' Please enter a new query or use the "Clear Filters" button above.',"code-snippets")]}):(0,g.jsxs)(g.Fragment,{children:[o," ",(0,g.jsx)("a",{href:f(null===(e=window.CODE_SNIPPETS)||void 0===e?void 0:e.urls.addNew,{type:n}),children:(0,i.__)("Add a new snippet.","code-snippets")})]})},Ka=function(e){var t,n=e.snippetView,r=e.setSnippetView,s=e.snippets,i=e.actions,a=e.doAction,c=e.extraTableNav,l=e.hiddenColumns,u=e.truncateRowValues,d=vi().activeByCondition,p=(0,o.useMemo)(function(){return function(e){return pa.map(function(t){return na(na({},t),{},{isHidden:e.has(t.id)})})}(l)},[l]),f=null===(t=window.CODE_SNIPPETS_MANAGE)||void 0===t?void 0:t.snippetsPerPage,h=f&&Math.ceil(s.length/f),m=function(e){return"top"===e?(0,g.jsx)(Fs,{snippetView:n,setSnippetView:r}):null};return"card"===n?(0,g.jsx)(Sa,{snippets:s,actions:i,doAction:a,itemsPerPage:f,extraTableNav:c,endTableNav:m,noItems:(0,g.jsx)(Ha,{}),beforeGrid:(0,g.jsx)(Na,{})}):(0,g.jsx)(Ti,{items:s,getKey:function(e){return e.id},initialSort:Ga(),className:v()({"truncate-row-values":u}),columns:p,actions:i,doAction:a,totalPages:h,extraTableNav:c,selectAllControl:!0,endTableNav:m,rowClassName:function(e){return function(e,t){return v()("snippet","snippet ".concat(Jr(e,t)?"active":"inactive","-snippet"),"".concat(qr(e),"-snippet"),"".concat(e.scope,"-snippet"),{"trashed-snippet":e.trashed})}(e,d)},noItems:(0,g.jsx)(Ha,{}),beforeTable:(0,g.jsx)(Na,{})})},za={"priority-asc":{columnId:"priority",direction:"asc"},"name-asc":{columnId:"name",direction:"asc"},"name-desc":{columnId:"name",direction:"desc"},"modified-desc":{columnId:"date",direction:"desc"},"modified-asc":{columnId:"date",direction:"asc"}},Ga=function(){var e,t,n;return null!==(e=za[null!==(t=null===(n=window.CODE_SNIPPETS_MANAGE)||void 0===n?void 0:n.listOrder)&&void 0!==t?t:""])&&void 0!==e?e:void 0},$a=function(e){var t,n,r,i=e.snippetView,a=e.setSnippetView,c=vi().snippetsByStatus,l=pi(),u=l.currentStatus,d=l.setCurrentStatus,p=function(){var e=(0,o.useState)(function(){var e,t;return new Set(null!==(e=null===(t=window.CODE_SNIPPETS_MANAGE)||void 0===t?void 0:t.hiddenColumns)&&void 0!==e?e:[])}),t=s(e,2),n=t[0],r=t[1],i=(0,o.useState)(function(){var e,t;return 0!==Number(null!==(e=null===(t=window.CODE_SNIPPETS_MANAGE)||void 0===t?void 0:t.truncateRowValues)&&void 0!==e?e:1)}),a=s(i,2),c=a[0],l=a[1];return(0,o.useEffect)(function(){var e=document.getElementById("adv-settings");if(e){var t=function(){var t,n;r(new Set(Array.from(e.querySelectorAll(".hide-column-tog:not(:checked)")).map(function(e){return e.value}))),l(null===(t=null===(n=e.querySelector("#snippets-table-truncate-row-values"))||void 0===n?void 0:n.checked)||void 0===t||t)};return t(),e.addEventListener("change",t),function(){e.removeEventListener("change",t)}}},[]),{hiddenColumns:n,truncateRowValues:c}}(),f=p.hiddenColumns,h=p.truncateRowValues,m=(0,o.useMemo)(function(){var e;return null!==(e=c.get(u))&&void 0!==e?e:[]},[c,u]),b=(t=m,n=Zs(),r=ro().refreshSnippetsList,function(){var e=ae(le().mark(function e(s,o){var i,a;return le().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=s,e.next="activate"===e.t0?3:"deactivate"===e.t0?6:"clone"===e.t0?9:"export"===e.t0?12:"download"===e.t0?14:"trash"===e.t0||"delete"===e.t0?16:void 0===e.t0?19:20;break;case 3:return e.next=5,Wa(t.filter(function(e){return o.has(e.id)&&!e.active}),function(e){return n.activate({id:e.id,network:e.network})},r);case 5:case 8:case 11:case 18:case 19:return e.abrupt("break",20);case 6:return e.next=8,Wa(t.filter(function(e){return o.has(e.id)&&e.active}),function(e){return n.deactivate({id:e.id,network:e.network})},r);case 9:return e.next=11,Wa(t.filter(function(e){return o.has(e.id)&&!e.trashed}),function(e){return n.create(Vr(e))},r);case 12:return po(t.filter(function(e){return o.has(e.id)})),e.abrupt("break",20);case 14:return a=t.filter(function(e){return o.has(e.id)}),e.abrupt("return",1<a.length&&(null===(i=window.CODE_SNIPPETS_MANAGE)||void 0===i||!i.supportsZipDownloads)?qa(a):Va(a));case 16:return e.next=18,Wa(t.filter(function(e){return o.has(e.id)}),function(e){return n.delete({id:e.id,network:e.network})},r);case 20:case"end":return e.stop()}},e)}));return function(t,n){return e.apply(this,arguments)}}());return(0,o.useEffect)(function(){li===u||c.has(u)||d(li)},[u,d,c]),(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(Ta,{}),(0,g.jsx)("div",{className:"snippets-list-view",children:(0,g.jsx)(Ka,{snippetView:i,setSnippetView:a,snippets:m,actions:"trashed"===u?Ba:Ua,doAction:b,extraTableNav:function(e){var t;return(0,g.jsx)(Aa,{which:e,visibleSnippets:null!==(t=c.get("all"))&&void 0!==t?t:[]})},hiddenColumns:f,truncateRowValues:h})})]})},Ja=function(e){var t=e.type,n=e.count,r=pi(),s=r.currentType,o=r.setCurrentType,a=null!=t?t:"all",c=t===s,l=t&&$r(t)&&!N();return(0,g.jsx)("li",{children:(0,g.jsxs)("a",{href:f(window.location.href,{type:a}),className:v()("snippet-type-link","".concat(a,"-type-link"),{"active-type":c,"pro-locked-type":l&&!c}),"aria-current":c?"page":void 0,onClick:function(e){e.preventDefault(),o(t)},children:[t&&(0,g.jsx)(Us,{name:t}),(0,g.jsx)("span",{className:v()("".concat(a,"-label"),"snippet-type-name"),children:t?Ur[t]:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("span",{className:"snippet-type-name-full",children:(0,i.__)("All Snippets","code-snippets")}),(0,g.jsx)("span",{className:"snippet-type-name-short",children:(0,i.__)("All","code-snippets")})]})}),n&&!l&&(0,g.jsx)("span",{className:"subnav-count",children:n}),l&&(0,g.jsx)("span",{className:"pro-chip",children:(0,i.__)("Pro","code-snippets")})]})})},Qa=function(){var e;return null!==(e=window.CODE_SNIPPETS_MANAGE)&&void 0!==e&&e.isSafeModeActive?(0,g.jsx)(O,{type:"error",children:(0,g.jsxs)("p",{children:[(0,g.jsx)("strong",{children:(0,i.__)("Warning:","code-snippets")}),"\n",(0,i.__)("Safe mode is active and snippets will not execute!","code-snippets"),"\n",(0,a.createInterpolateElement)((0,i.__)("Remove the <code>CODE_SNIPPETS_SAFE_MODE</code> constant from <code>wp-config.php</code> file to turn off safe mode.","code-snippets"),{code:(0,g.jsx)("code",{})}),"\n",(0,g.jsx)("a",{href:"https://codesnippets.pro/doc/safe-mode",target:"_blank",rel:"noreferrer",children:(0,i.__)("Read more","code-snippets")})]})}):null},Xa=function(){var e=Qn(),t=e.snippetView,n=e.setSnippetView,r=pi().currentType,s=function(){var e,t=ro().snippetsList,n=(0,o.useMemo)(function(){return null==t?void 0:t.filter(function(e){return!e.trashed})},[t]),r=(0,o.useMemo)(function(){return null==n?void 0:n.reduce(function(e,t){var n,r=qr(t);return e.set(r,(null!==(n=e.get(r))&&void 0!==n?n:0)+1)},new Map)},[n]),s=null===(e=window.CODE_SNIPPETS_MANAGE)||void 0===e?void 0:e.typeCounts;return{getCount:(0,o.useCallback)(function(e){var t;return n?e?null!==(t=null==r?void 0:r.get(e))&&void 0!==t?t:0:n.length:null==s?void 0:s[null!=e?e:"all"]},[n,r,s])}}(),a=s.getCount,c=tr(),l=c.atStart,u=c.atEnd,d=c.scrollRef;return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("div",{className:v()("snippet-type-nav-wrapper",{"has-scroll-start":!l,"has-scroll-end":!u}),children:(0,g.jsx)("nav",{ref:d,className:"snippet-type-nav","aria-label":(0,i.__)("Snippet types","code-snippets"),children:(0,g.jsxs)("ul",{children:[(0,g.jsx)(Ja,{count:a()}),Cr.map(function(e){return(0,g.jsx)(Ja,{type:e,count:a(e)},e)})]})})}),(0,g.jsx)(Yn,{}),(0,g.jsxs)("div",{className:"snippets-page-header",children:[(0,g.jsx)("h1",{children:(0,i.sprintf)((0,i.__)("Local Snippets: %s","code-snippets"),r?Ur[r]:(0,i.__)("All Snippets","code-snippets"))}),(0,g.jsx)("a",{href:Hr(r),className:"button button-primary",children:(0,i.__)("Add Snippet","code-snippets")})]}),(0,g.jsx)("hr",{className:"wp-header-end"}),(0,g.jsx)(Qa,{}),r&&!N()&&$r(r)?(0,g.jsx)(G,{}):(0,g.jsx)(gi,{children:(0,g.jsx)($a,{snippetView:t,setSnippetView:n})})]})},Ya=function(){return(0,g.jsx)($n,{children:(0,g.jsx)(eo,{children:(0,g.jsx)(so,{children:(0,g.jsx)(fi,{children:(0,g.jsx)(Xa,{})})})})})},Za=function(){var e=s((0,o.useState)(function(){var e=u("result");return d({result:void 0}),e?function(e){switch(e){case"deleted":return{text:(0,i.__)("Snippet <strong>deleted</strong>.","code-snippets"),type:"success"};case"executed":return{text:(0,i.__)("Snippet <strong>executed</strong>.","code-snippets"),type:"success"};case"run-once-failed":return{text:(0,i.__)("The snippet could not be run. Check that its code is valid and try again.","code-snippets"),type:"error"};case"run-once-safe-mode":return{text:(0,i.__)("Safe mode is active, so the snippet was not run.","code-snippets"),type:"warning"};default:return}}(e):void 0}),2),t=e[0],n=e[1];return t?(0,g.jsx)(S,{className:"code-snippets-notice",onDismiss:function(){n(void 0)},type:t.type,children:(0,g.jsx)("p",{children:(0,a.createInterpolateElement)(t.text,{strong:(0,g.jsx)("strong",{})})})}):null},ec=function(e){switch(e.subpage){case"snippets":return(0,g.jsx)(Ya,{});case"cloud-community":return(0,g.jsx)(oi,{});case"blueprints":case"cloud-library":return(0,g.jsx)(G,{})}};La="manage-snippets-container",Fa=function(){var e=(0,o.useMemo)(function(){var e,t,n;return null!==(t=Q,e=(n=u("subpage"))&&function(e){return t.includes(e)}(n)?n:void 0)&&void 0!==e?e:Q[0]},[]);return(0,o.useEffect)(function(){var t,n,r,s;"snippets"===e&&(r=null==(n=document.getElementById("adv-settings"))?void 0:n.querySelector("fieldset.table-options-prefs"),s=Array.from(null!==(t=null==n?void 0:n.querySelectorAll("fieldset.metabox-prefs"))&&void 0!==t?t:[]).find(function(e){return!e.classList.contains("table-options-prefs")}),n&&r&&s&&n.insertBefore(r,s))},[e]),(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(se,{}),(0,g.jsx)(Za,{}),(0,g.jsx)(ec,{subpage:e})]})},(Ma=document.getElementById(La))?(0,On.createRoot)(Ma).render((0,g.jsx)(Fa,{})):console.error("Could not find element #".concat(La,"."))})()})();
2 +(()=>{var e={5172(e){e.exports=function(e,t){this.v=e,this.k=t},e.exports.__esModule=!0,e.exports.default=e.exports},6993(e,t,n){var r=n(5546);function s(){var t,n,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.toStringTag||"@@toStringTag";function c(e,s,i,o){var a=s&&s.prototype instanceof u?s:u,c=Object.create(a.prototype);return r(c,"_invoke",function(e,r,s){var i,o,a,c=0,u=s||[],d=!1,p={p:0,n:0,v:t,a:f,f:f.bind(t,4),d:function(e,n){return i=e,o=0,a=t,p.n=n,l}};function f(e,r){for(o=e,a=r,n=0;!d&&c&&!s&&n<u.length;n++){var s,i=u[n],f=p.p,h=i[2];e>3?(s=h===r)&&(a=i[(o=i[4])?5:(o=3,3)],i[4]=i[5]=t):i[0]<=f&&((s=e<2&&f<i[1])?(o=0,p.v=r,p.n=i[1]):f<h&&(s=e<3||i[0]>r||r>h)&&(i[4]=e,i[5]=r,p.n=h,o=0))}if(s||e>1)return l;throw d=!0,r}return function(s,u,h){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&f(u,h),o=u,a=h;(n=o<2?t:a)||!d;){i||(o?o<3?(o>1&&(p.n=-1),f(o,a)):p.n=a:p.v=a);try{if(c=2,i){if(o||(s="next"),n=i[s]){if(!(n=n.call(i,a)))throw TypeError("iterator result is not an object");if(!n.done)return n;a=n.value,o<2&&(o=0)}else 1===o&&(n=i.return)&&n.call(i),o<2&&(a=TypeError("The iterator does not provide a '"+s+"' method"),o=1);i=t}else if((n=(d=p.n<0)?a:e.call(r,p))!==l)break}catch(e){i=t,o=1,a=e}finally{c=1}}return{value:n,done:d}}}(e,i,o),!0),c}var l={};function u(){}function d(){}function p(){}n=Object.getPrototypeOf;var f=[][o]?n(n([][o]())):(r(n={},o,function(){return this}),n),h=p.prototype=u.prototype=Object.create(f);function m(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,r(e,a,"GeneratorFunction")),e.prototype=Object.create(h),e}return d.prototype=p,r(h,"constructor",p),r(p,"constructor",d),d.displayName="GeneratorFunction",r(p,a,"GeneratorFunction"),r(h),r(h,a,"Generator"),r(h,o,function(){return this}),r(h,"toString",function(){return"[object Generator]"}),(e.exports=s=function(){return{w:c,m}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=s,e.exports.__esModule=!0,e.exports.default=e.exports},5869(e,t,n){var r=n(887);e.exports=function(e,t,n,s,i){var o=r(e,t,n,s,i);return o.next().then(function(e){return e.done?e.value:o.next()})},e.exports.__esModule=!0,e.exports.default=e.exports},887(e,t,n){var r=n(6993),s=n(1791);e.exports=function(e,t,n,i,o){return new s(r().w(e,t,n,i),o||Promise)},e.exports.__esModule=!0,e.exports.default=e.exports},1791(e,t,n){var r=n(5172),s=n(5546);e.exports=function e(t,n){function i(e,s,o,a){try{var c=t[e](s),l=c.value;return l instanceof r?n.resolve(l.v).then(function(e){i("next",e,o,a)},function(e){i("throw",e,o,a)}):n.resolve(l).then(function(e){c.value=e,o(c)},function(e){return i("throw",e,o,a)})}catch(e){a(e)}}var o;this.next||(s(e.prototype),s(e.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),s(this,"_invoke",function(e,t,r){function s(){return new n(function(t,n){i(e,r,t,n)})}return o=o?o.then(s,s):s()},!0)},e.exports.__esModule=!0,e.exports.default=e.exports},5546(e){function t(n,r,s,i){var o=Object.defineProperty;try{o({},"",{})}catch(n){o=0}e.exports=t=function(e,n,r,s){function i(n,r){t(e,n,function(e){return this._invoke(n,r,e)})}n?o?o(e,n,{value:r,enumerable:!s,configurable:!s,writable:!s}):e[n]=r:(i("next",0),i("throw",1),i("return",2))},e.exports.__esModule=!0,e.exports.default=e.exports,t(n,r,s,i)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4373(e){e.exports=function(e){var t=Object(e),n=[];for(var r in t)n.unshift(r);return function e(){for(;n.length;)if((r=n.pop())in t)return e.value=r,e.done=!1,e;return e.done=!0,e}},e.exports.__esModule=!0,e.exports.default=e.exports},4633(e,t,n){var r=n(5172),s=n(6993),i=n(5869),o=n(887),a=n(1791),c=n(4373),l=n(579);function u(){"use strict";var t=s(),n=t.m(u),d=(Object.getPrototypeOf?Object.getPrototypeOf(n):n.__proto__).constructor;function p(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))}var f={throw:1,return:2,break:3,continue:3};function h(e){var t,n;return function(r){t||(t={stop:function(){return n(r.a,2)},catch:function(){return r.v},abrupt:function(e,t){return n(r.a,f[e],t)},delegateYield:function(e,s,i){return t.resultName=s,n(r.d,l(e),i)},finish:function(e){return n(r.f,e)}},n=function(e,n,s){r.p=t.prev,r.n=t.next;try{return e(n,s)}finally{t.next=r.n}}),t.resultName&&(t[t.resultName]=r.v,t.resultName=void 0),t.sent=r.v,t.next=r.n;try{return e.call(this,t)}finally{r.p=t.prev,r.n=t.next}}}return(e.exports=u=function(){return{wrap:function(e,n,r,s){return t.w(h(e),n,r,s&&s.reverse())},isGeneratorFunction:p,mark:t.m,awrap:function(e,t){return new r(e,t)},AsyncIterator:a,async:function(e,t,n,r,s){return(p(t)?o:i)(h(e),t,n,r,s)},keys:c,values:l}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=u,e.exports.__esModule=!0,e.exports.default=e.exports},579(e,t,n){var r=n(3738).default;e.exports=function(e){if(null!=e){var t=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}throw new TypeError(r(e)+" is not iterable")},e.exports.__esModule=!0,e.exports.default=e.exports},3738(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4756(e,t,n){var r=n(4633)();e.exports=r;try{regeneratorRuntime=r}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},6942(e,t){var n;!function(){"use strict";var r={}.hasOwnProperty;function s(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=o(e,i(n)))}return e}function i(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return s.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var n in e)r.call(e,n)&&e[n]&&(t=o(t,n));return t}function o(e,t){return t?e?e+" "+t:e+t:e}e.exports?(s.default=s,e.exports=s):void 0===(n=function(){return s}.apply(t,[]))||(e.exports=n)}()}},t={};function n(r){var s=t[r];if(void 0!==s)return s.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{"use strict";var 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 r(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}}function s(e,t){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,s,i,o,a=[],c=!0,l=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);c=!0);}catch(e){l=!0,s=e}finally{try{if(!c&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw s}}return a}}(e,t)||r(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.")}()}n.r(e),n.d(e,{hasBrowserEnv:()=>We,hasStandardBrowserEnv:()=>ze,hasStandardBrowserWebWorkerEnv:()=>$e,navigator:()=>He,origin:()=>Ge});const i=window.React;var o=n.n(i);const a=window.wp.i18n,c=window.wp.element;function l(e){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l(e)}const u=window.wp.url;var d=function(e){var t;return null!==(t=new URLSearchParams(window.location.search).get(e))&&void 0!==t?t:void 0},p=function(e,t){var n=d(e);return n&&function(e){return t.includes(e)}(n)?n:void 0},f=function(e){if("URLSearchParams"in window){for(var t=new URLSearchParams(window.location.search),n=0,r=Object.entries(e);n<r.length;n++){var i=s(r[n],2),o=i[0],a=i[1];a?t.set(o,String(a)):t.delete(o)}var c=window.location.toString().replace(window.location.search,"?".concat(t.toString()));window.history.replaceState({},document.title,c)}},h=function(e){switch(!0){case null==e:return;case"boolean"==typeof e:return e?"1":"0";case"number"==typeof e:case"string"==typeof e:return String(e);default:throw new Error("Unsupported query arg type: ".concat(l(e)))}},m=function(e,t){for(var n={},r=0,i=Object.entries(t);r<i.length;r++){var o=s(i[r],2),a=o[0],c=o[1],l=h(c);void 0!==l&&(n[a]=l)}return(0,u.addQueryArgs)(e,n)};function b(e,t,n){return(t=function(e){var t=function(e){if("object"!=l(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=l(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==l(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function g(e,t){if(null==e)return{};var n,r,s=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}var v=n(6942),y=n.n(v);const _=window.ReactJSXRuntime;var j=["className","type","children"],w=["className","onDismiss","children"];function x(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function O(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?x(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):x(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var S=function(e){return"error"===e||"warning"===e},P=function(e){var t=e.className,n=e.type,r=e.children,s=g(e,j);return(0,_.jsx)("div",O(O({className:y()("notice","code-snippets-notice",b({},"notice-".concat(n),n),t),role:S(n)?"alert":"status","aria-live":S(n)?"assertive":"polite"},s),{},{children:r}))},N=function(e){var t=e.className,n=e.onDismiss,r=e.children,s=g(e,w);return(0,_.jsxs)(P,O(O({className:y()("is-dismissible",t)},s),{},{children:[r,(0,_.jsx)("button",{type:"button",className:"notice-dismiss",onClick:function(e){e.preventDefault(),n()},children:(0,_.jsx)("span",{className:"screen-reader-text",children:(0,a.__)("Dismiss notice.","code-snippets")})})]}))},k=function(){var e;return!0===(null===(e=window.pagenow)||void 0===e?void 0:e.endsWith("-network"))},C=function(){var e;return!(null===(e=window.CODE_SNIPPETS)||void 0===e||!e.isLicensed)},E=function(){var e;return!(C()||null!==(e=window.CODE_SNIPPETS)&&void 0!==e&&e.hideUpsell)};function D(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||r(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 T(e,t,n,r,s,i,o){try{var a=e[i](o),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,s)}function A(e){return function(){var t=this,n=arguments;return new Promise(function(r,s){var i=e.apply(t,n);function o(e){T(i,r,s,o,a,"next",e)}function a(e){T(i,r,s,o,a,"throw",e)}o(void 0)})}}var R=n(4756),I=n.n(R);function L(e,t){return function(){return e.apply(t,arguments)}}const{toString:F}=Object.prototype,{getPrototypeOf:M}=Object,{iterator:B,toStringTag:U}=Symbol,q=(V=Object.create(null),e=>{const t=F.call(e);return V[t]||(V[t]=t.slice(8,-1).toLowerCase())});var V;const W=e=>(e=e.toLowerCase(),t=>q(t)===e),H=e=>t=>typeof t===e,{isArray:z}=Array,$=H("undefined");function G(e){return null!==e&&!$(e)&&null!==e.constructor&&!$(e.constructor)&&Q(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const K=W("ArrayBuffer"),J=H("string"),Q=H("function"),Y=H("number"),X=e=>null!==e&&"object"==typeof e,Z=e=>{if("object"!==q(e))return!1;const t=M(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||U in e||B in e)},ee=W("Date"),te=W("File"),ne=W("Blob"),re=W("FileList"),se=W("URLSearchParams"),[ie,oe,ae,ce]=["ReadableStream","Request","Response","Headers"].map(W);function le(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,s;if("object"!=typeof e&&(e=[e]),z(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(G(e))return;const s=n?Object.getOwnPropertyNames(e):Object.keys(e),i=s.length;let o;for(r=0;r<i;r++)o=s[r],t.call(null,e[o],o,e)}}function ue(e,t){if(G(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r,s=n.length;for(;s-- >0;)if(r=n[s],t===r.toLowerCase())return r;return null}const de="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,pe=e=>!$(e)&&e!==de,fe=(he="undefined"!=typeof Uint8Array&&M(Uint8Array),e=>he&&e instanceof he);var he;const me=W("HTMLFormElement"),be=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),ge=W("RegExp"),ve=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};le(n,(n,s)=>{let i;!1!==(i=t(n,s,e))&&(r[s]=i||n)}),Object.defineProperties(e,r)},ye=W("AsyncFunction"),_e=(je="function"==typeof setImmediate,we=Q(de.postMessage),je?setImmediate:we?(xe=`axios@${Math.random()}`,Oe=[],de.addEventListener("message",({source:e,data:t})=>{e===de&&t===xe&&Oe.length&&Oe.shift()()},!1),e=>{Oe.push(e),de.postMessage(xe,"*")}):e=>setTimeout(e));var je,we,xe,Oe;const Se="undefined"!=typeof queueMicrotask?queueMicrotask.bind(de):"undefined"!=typeof process&&process.nextTick||_e,Pe={isArray:z,isArrayBuffer:K,isBuffer:G,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||Q(e.append)&&("formdata"===(t=q(e))||"object"===t&&Q(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&K(e.buffer),t},isString:J,isNumber:Y,isBoolean:e=>!0===e||!1===e,isObject:X,isPlainObject:Z,isEmptyObject:e=>{if(!X(e)||G(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:ie,isRequest:oe,isResponse:ae,isHeaders:ce,isUndefined:$,isDate:ee,isFile:te,isBlob:ne,isRegExp:ge,isFunction:Q,isStream:e=>X(e)&&Q(e.pipe),isURLSearchParams:se,isTypedArray:fe,isFileList:re,forEach:le,merge:function e(){const{caseless:t,skipUndefined:n}=pe(this)&&this||{},r={},s=(s,i)=>{if("__proto__"===i||"constructor"===i||"prototype"===i)return;const o=t&&ue(r,i)||i;Z(r[o])&&Z(s)?r[o]=e(r[o],s):Z(s)?r[o]=e({},s):z(s)?r[o]=s.slice():n&&$(s)||(r[o]=s)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&le(arguments[e],s);return r},extend:(e,t,n,{allOwnKeys:r}={})=>(le(t,(t,r)=>{n&&Q(t)?Object.defineProperty(e,r,{value:L(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,r,{value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let s,i,o;const a={};if(t=t||{},null==e)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)o=s[i],r&&!r(o,e,t)||a[o]||(t[o]=e[o],a[o]=!0);e=!1!==n&&M(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:q,kindOfTest:W,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(z(e))return e;let t=e.length;if(!Y(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[B]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:me,hasOwnProperty:be,hasOwnProp:be,reduceDescriptors:ve,freezeMethods:e=>{ve(e,(t,n)=>{if(Q(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];Q(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach(e=>{n[e]=!0})};return z(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:ue,global:de,isContextDefined:pe,isSpecCompliantForm:function(e){return!!(e&&Q(e.append)&&"FormData"===e[U]&&e[B])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(X(e)){if(t.indexOf(e)>=0)return;if(G(e))return e;if(!("toJSON"in e)){t[r]=e;const s=z(e)?[]:{};return le(e,(e,t)=>{const i=n(e,r+1);!$(i)&&(s[t]=i)}),t[r]=void 0,s}}return e};return n(e,0)},isAsyncFn:ye,isThenable:e=>e&&(X(e)||Q(e))&&Q(e.then)&&Q(e.catch),setImmediate:_e,asap:Se,isIterable:e=>null!=e&&Q(e[B])};class Ne extends Error{static from(e,t,n,r,s,i){const o=new Ne(e.message,t||e.code,n,r,s);return o.cause=e,o.name=e.name,i&&Object.assign(o,i),o}constructor(e,t,n,r,s){super(e),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status)}toJSON(){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:Pe.toJSONObject(this.config),code:this.code,status:this.status}}}Ne.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Ne.ERR_BAD_OPTION="ERR_BAD_OPTION",Ne.ECONNABORTED="ECONNABORTED",Ne.ETIMEDOUT="ETIMEDOUT",Ne.ERR_NETWORK="ERR_NETWORK",Ne.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Ne.ERR_DEPRECATED="ERR_DEPRECATED",Ne.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Ne.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Ne.ERR_CANCELED="ERR_CANCELED",Ne.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Ne.ERR_INVALID_URL="ERR_INVALID_URL";const ke=Ne;function Ce(e){return Pe.isPlainObject(e)||Pe.isArray(e)}function Ee(e){return Pe.endsWith(e,"[]")?e.slice(0,-2):e}function De(e,t,n){return e?e.concat(t).map(function(e,t){return e=Ee(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const Te=Pe.toFlatObject(Pe,{},null,function(e){return/^is[A-Z]/.test(e)}),Ae=function(e,t,n){if(!Pe.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=Pe.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!Pe.isUndefined(t[e])})).metaTokens,s=n.visitor||l,i=n.dots,o=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&Pe.isSpecCompliantForm(t);if(!Pe.isFunction(s))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(Pe.isDate(e))return e.toISOString();if(Pe.isBoolean(e))return e.toString();if(!a&&Pe.isBlob(e))throw new ke("Blob is not supported. Use a Buffer instead.");return Pe.isArrayBuffer(e)||Pe.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,n,s){let a=e;if(e&&!s&&"object"==typeof e)if(Pe.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(Pe.isArray(e)&&function(e){return Pe.isArray(e)&&!e.some(Ce)}(e)||(Pe.isFileList(e)||Pe.endsWith(n,"[]"))&&(a=Pe.toArray(e)))return n=Ee(n),a.forEach(function(e,r){!Pe.isUndefined(e)&&null!==e&&t.append(!0===o?De([n],r,i):null===o?n:n+"[]",c(e))}),!1;return!!Ce(e)||(t.append(De(s,n,i),c(e)),!1)}const u=[],d=Object.assign(Te,{defaultVisitor:l,convertValue:c,isVisitable:Ce});if(!Pe.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!Pe.isUndefined(n)){if(-1!==u.indexOf(n))throw Error("Circular reference detected in "+r.join("."));u.push(n),Pe.forEach(n,function(n,i){!0===(!(Pe.isUndefined(n)||null===n)&&s.call(t,n,Pe.isString(i)?i.trim():i,r,d))&&e(n,r?r.concat(i):[i])}),u.pop()}}(e),t};function Re(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function Ie(e,t){this._pairs=[],e&&Ae(e,this,t)}const Le=Ie.prototype;Le.append=function(e,t){this._pairs.push([e,t])},Le.toString=function(e){const t=e?function(t){return e.call(this,t,Re)}:Re;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};const Fe=Ie;function Me(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Be(e,t,n){if(!t)return e;const r=n&&n.encode||Me,s=Pe.isFunction(n)?{serialize:n}:n,i=s&&s.serialize;let o;if(o=i?i(t,s):Pe.isURLSearchParams(t)?t.toString():new Fe(t,s).toString(r),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}const Ue=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Pe.forEach(this.handlers,function(t){null!==t&&e(t)})}},qe={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Ve={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Fe,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},We="undefined"!=typeof window&&"undefined"!=typeof document,He="object"==typeof navigator&&navigator||void 0,ze=We&&(!He||["ReactNative","NativeScript","NS"].indexOf(He.product)<0),$e="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Ge=We&&window.location.href||"http://localhost",Ke={...e,...Ve},Je=function(e){function t(e,n,r,s){let i=e[s++];if("__proto__"===i)return!0;const o=Number.isFinite(+i),a=s>=e.length;return i=!i&&Pe.isArray(r)?r.length:i,a?(Pe.hasOwnProp(r,i)?r[i]=[r[i],n]:r[i]=n,!o):(r[i]&&Pe.isObject(r[i])||(r[i]=[]),t(e,n,r[i],s)&&Pe.isArray(r[i])&&(r[i]=function(e){const t={},n=Object.keys(e);let r;const s=n.length;let i;for(r=0;r<s;r++)i=n[r],t[i]=e[i];return t}(r[i])),!o)}if(Pe.isFormData(e)&&Pe.isFunction(e.entries)){const n={};return Pe.forEachEntry(e,(e,r)=>{t(function(e){return Pe.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null},Qe={transitional:qe,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,s=Pe.isObject(e);if(s&&Pe.isHTMLForm(e)&&(e=new FormData(e)),Pe.isFormData(e))return r?JSON.stringify(Je(e)):e;if(Pe.isArrayBuffer(e)||Pe.isBuffer(e)||Pe.isStream(e)||Pe.isFile(e)||Pe.isBlob(e)||Pe.isReadableStream(e))return e;if(Pe.isArrayBufferView(e))return e.buffer;if(Pe.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Ae(e,new Ke.classes.URLSearchParams,{visitor:function(e,t,n,r){return Ke.isNode&&Pe.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((i=Pe.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Ae(i?{"files[]":e}:e,t&&new t,this.formSerializer)}}return s||r?(t.setContentType("application/json",!1),function(e){if(Pe.isString(e))try{return(0,JSON.parse)(e),Pe.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Qe.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(Pe.isResponse(e)||Pe.isReadableStream(e))return e;if(e&&Pe.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(e){if(n){if("SyntaxError"===e.name)throw ke.from(e,ke.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ke.classes.FormData,Blob:Ke.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Pe.forEach(["delete","get","head","post","put","patch"],e=>{Qe.headers[e]={}});const Ye=Qe,Xe=Pe.toObjectSet(["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"]),Ze=Symbol("internals");function et(e){return e&&String(e).trim().toLowerCase()}function tt(e){return!1===e||null==e?e:Pe.isArray(e)?e.map(tt):String(e)}function nt(e,t,n,r,s){return Pe.isFunction(r)?r.call(this,t,n):(s&&(t=n),Pe.isString(t)?Pe.isString(r)?-1!==t.indexOf(r):Pe.isRegExp(r)?r.test(t):void 0:void 0)}class rt{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function s(e,t,n){const s=et(t);if(!s)throw new Error("header name must be a non-empty string");const i=Pe.findKey(r,s);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=tt(e))}const i=(e,t)=>Pe.forEach(e,(e,n)=>s(e,n,t));if(Pe.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(Pe.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i((e=>{const t={};let n,r,s;return e&&e.split("\n").forEach(function(e){s=e.indexOf(":"),n=e.substring(0,s).trim().toLowerCase(),r=e.substring(s+1).trim(),!n||t[n]&&Xe[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t})(e),t);else if(Pe.isObject(e)&&Pe.isIterable(e)){let n,r,s={};for(const t of e){if(!Pe.isArray(t))throw TypeError("Object iterator must return a key-value pair");s[r=t[0]]=(n=s[r])?Pe.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}i(s,t)}else null!=e&&s(t,e,n);return this}get(e,t){if(e=et(e)){const n=Pe.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(Pe.isFunction(t))return t.call(this,e,n);if(Pe.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=et(e)){const n=Pe.findKey(this,e);return!(!n||void 0===this[n]||t&&!nt(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function s(e){if(e=et(e)){const s=Pe.findKey(n,e);!s||t&&!nt(0,n[s],s,t)||(delete n[s],r=!0)}}return Pe.isArray(e)?e.forEach(s):s(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const s=t[n];e&&!nt(0,this[s],s,e,!0)||(delete this[s],r=!0)}return r}normalize(e){const t=this,n={};return Pe.forEach(this,(r,s)=>{const i=Pe.findKey(n,s);if(i)return t[i]=tt(r),void delete t[s];const o=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(s):String(s).trim();o!==s&&delete t[s],t[o]=tt(r),n[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Pe.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&Pe.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[Ze]=this[Ze]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=et(e);t[r]||(function(e,t){const n=Pe.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,s){return this[r].call(this,t,e,n,s)},configurable:!0})})}(n,e),t[r]=!0)}return Pe.isArray(e)?e.forEach(r):r(e),this}}rt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Pe.reduceDescriptors(rt.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),Pe.freezeMethods(rt);const st=rt;function it(e,t){const n=this||Ye,r=t||n,s=st.from(r.headers);let i=r.data;return Pe.forEach(e,function(e){i=e.call(n,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function ot(e){return!(!e||!e.__CANCEL__)}const at=class extends ke{constructor(e,t,n){super(null==e?"canceled":e,ke.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function ct(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new ke("Request failed with status code "+n.status,[ke.ERR_BAD_REQUEST,ke.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}const lt=(e,t,n=3)=>{let r=0;const s=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s,i=0,o=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),l=r[o];s||(s=c),n[i]=a,r[i]=c;let u=o,d=0;for(;u!==i;)d+=n[u++],u%=e;if(i=(i+1)%e,i===o&&(o=(o+1)%e),c-s<t)return;const p=l&&c-l;return p?Math.round(1e3*d/p):void 0}}(50,250);return function(e,t){let n,r,s=0,i=1e3/t;const o=(t,i=Date.now())=>{s=i,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-s;a>=i?o(e,t):(n=e,r||(r=setTimeout(()=>{r=null,o(n)},i-a)))},()=>n&&o(n)]}(n=>{const i=n.loaded,o=n.lengthComputable?n.total:void 0,a=i-r,c=s(a);r=i,e({loaded:i,total:o,progress:o?i/o:void 0,bytes:a,rate:c||void 0,estimated:c&&o&&i<=o?(o-i)/c:void 0,event:n,lengthComputable:null!=o,[t?"download":"upload"]:!0})},n)},ut=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},dt=e=>(...t)=>Pe.asap(()=>e(...t)),pt=Ke.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Ke.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Ke.origin),Ke.navigator&&/(msie|trident)/i.test(Ke.navigator.userAgent)):()=>!0,ft=Ke.hasStandardBrowserEnv?{write(e,t,n,r,s,i,o){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];Pe.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),Pe.isString(r)&&a.push(`path=${r}`),Pe.isString(s)&&a.push(`domain=${s}`),!0===i&&a.push("secure"),Pe.isString(o)&&a.push(`SameSite=${o}`),document.cookie=a.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function ht(e,t,n){let r=!("string"==typeof(s=t)&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(s));var s;return e&&(r||0==n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const mt=e=>e instanceof st?{...e}:e;function bt(e,t){t=t||{};const n={};function r(e,t,n,r){return Pe.isPlainObject(e)&&Pe.isPlainObject(t)?Pe.merge.call({caseless:r},e,t):Pe.isPlainObject(t)?Pe.merge({},t):Pe.isArray(t)?t.slice():t}function s(e,t,n,s){return Pe.isUndefined(t)?Pe.isUndefined(e)?void 0:r(void 0,e,0,s):r(e,t,0,s)}function i(e,t){if(!Pe.isUndefined(t))return r(void 0,t)}function o(e,t){return Pe.isUndefined(t)?Pe.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,s,i){return i in t?r(n,s):i in e?r(void 0,n):void 0}const c={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(e,t,n)=>s(mt(e),mt(t),0,!0)};return Pe.forEach(Object.keys({...e,...t}),function(r){if("__proto__"===r||"constructor"===r||"prototype"===r)return;const i=Pe.hasOwnProp(c,r)?c[r]:s,o=i(e[r],t[r],r);Pe.isUndefined(o)&&i!==a||(n[r]=o)}),n}const gt=e=>{const t=bt({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:a}=t;if(t.headers=o=st.from(o),t.url=Be(ht(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),Pe.isFormData(n))if(Ke.hasStandardBrowserEnv||Ke.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(Pe.isFunction(n.getHeaders)){const e=n.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,n])=>{t.includes(e.toLowerCase())&&o.set(e,n)})}if(Ke.hasStandardBrowserEnv&&(r&&Pe.isFunction(r)&&(r=r(t)),r||!1!==r&&pt(t.url))){const e=s&&i&&ft.read(i);e&&o.set(s,e)}return t},vt="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=gt(e);let s=r.data;const i=st.from(r.headers).normalize();let o,a,c,l,u,{responseType:d,onUploadProgress:p,onDownloadProgress:f}=r;function h(){l&&l(),u&&u(),r.cancelToken&&r.cancelToken.unsubscribe(o),r.signal&&r.signal.removeEventListener("abort",o)}let m=new XMLHttpRequest;function b(){if(!m)return;const r=st.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());ct(function(e){t(e),h()},function(e){n(e),h()},{data:d&&"text"!==d&&"json"!==d?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=b:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(b)},m.onabort=function(){m&&(n(new ke("Request aborted",ke.ECONNABORTED,e,m)),m=null)},m.onerror=function(t){const r=t&&t.message?t.message:"Network Error",s=new ke(r,ke.ERR_NETWORK,e,m);s.event=t||null,n(s),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const s=r.transitional||qe;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new ke(t,s.clarifyTimeoutError?ke.ETIMEDOUT:ke.ECONNABORTED,e,m)),m=null},void 0===s&&i.setContentType(null),"setRequestHeader"in m&&Pe.forEach(i.toJSON(),function(e,t){m.setRequestHeader(t,e)}),Pe.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),d&&"json"!==d&&(m.responseType=r.responseType),f&&([c,u]=lt(f,!0),m.addEventListener("progress",c)),p&&m.upload&&([a,l]=lt(p),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",l)),(r.cancelToken||r.signal)&&(o=t=>{m&&(n(!t||t.type?new at(null,e,m):t),m.abort(),m=null)},r.cancelToken&&r.cancelToken.subscribe(o),r.signal&&(r.signal.aborted?o():r.signal.addEventListener("abort",o)));const g=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);g&&-1===Ke.protocols.indexOf(g)?n(new ke("Unsupported protocol "+g+":",ke.ERR_BAD_REQUEST,e)):m.send(s||null)})},yt=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const s=function(e){if(!n){n=!0,o();const t=e instanceof Error?e:this.reason;r.abort(t instanceof ke?t:new at(t instanceof Error?t.message:t))}};let i=t&&setTimeout(()=>{i=null,s(new ke(`timeout of ${t}ms exceeded`,ke.ETIMEDOUT))},t);const o=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(s):e.removeEventListener("abort",s)}),e=null)};e.forEach(e=>e.addEventListener("abort",s));const{signal:a}=r;return a.unsubscribe=()=>Pe.asap(o),a}},_t=function*(e,t){let n=e.byteLength;if(!t||n<t)return void(yield e);let r,s=0;for(;s<n;)r=s+t,yield e.slice(s,r),s=r},jt=(e,t,n,r)=>{const s=async function*(e,t){for await(const n of async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}}(e))yield*_t(n,t)}(e,t);let i,o=0,a=e=>{i||(i=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await s.next();if(t)return a(),void e.close();let i=r.byteLength;if(n){let e=o+=i;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw a(e),e}},cancel:e=>(a(e),s.return())},{highWaterMark:2})},{isFunction:wt}=Pe,xt=(({Request:e,Response:t})=>({Request:e,Response:t}))(Pe.global),{ReadableStream:Ot,TextEncoder:St}=Pe.global,Pt=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Nt=e=>{e=Pe.merge.call({skipUndefined:!0},xt,e);const{fetch:t,Request:n,Response:r}=e,s=t?wt(t):"function"==typeof fetch,i=wt(n),o=wt(r);if(!s)return!1;const a=s&&wt(Ot),c=s&&("function"==typeof St?(l=new St,e=>l.encode(e)):async e=>new Uint8Array(await new n(e).arrayBuffer()));var l;const u=i&&a&&Pt(()=>{let e=!1;const t=new n(Ke.origin,{body:new Ot,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),d=o&&a&&Pt(()=>Pe.isReadableStream(new r("").body)),p={stream:d&&(e=>e.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!p[e]&&(p[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new ke(`Response type '${e}' is not supported`,ke.ERR_NOT_SUPPORT,n)})});return async e=>{let{url:s,method:o,data:a,signal:l,cancelToken:f,timeout:h,onDownloadProgress:m,onUploadProgress:b,responseType:g,headers:v,withCredentials:y="same-origin",fetchOptions:_}=gt(e),j=t||fetch;g=g?(g+"").toLowerCase():"text";let w=yt([l,f&&f.toAbortSignal()],h),x=null;const O=w&&w.unsubscribe&&(()=>{w.unsubscribe()});let S;try{if(b&&u&&"get"!==o&&"head"!==o&&0!==(S=await(async(e,t)=>{const r=Pe.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(Pe.isBlob(e))return e.size;if(Pe.isSpecCompliantForm(e)){const t=new n(Ke.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return Pe.isArrayBufferView(e)||Pe.isArrayBuffer(e)?e.byteLength:(Pe.isURLSearchParams(e)&&(e+=""),Pe.isString(e)?(await c(e)).byteLength:void 0)})(t):r})(v,a))){let e,t=new n(s,{method:"POST",body:a,duplex:"half"});if(Pe.isFormData(a)&&(e=t.headers.get("content-type"))&&v.setContentType(e),t.body){const[e,n]=ut(S,lt(dt(b)));a=jt(t.body,65536,e,n)}}Pe.isString(y)||(y=y?"include":"omit");const t=i&&"credentials"in n.prototype,l={..._,signal:w,method:o.toUpperCase(),headers:v.normalize().toJSON(),body:a,duplex:"half",credentials:t?y:void 0};x=i&&new n(s,l);let f=await(i?j(x,_):j(s,l));const h=d&&("stream"===g||"response"===g);if(d&&(m||h&&O)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=f[t]});const t=Pe.toFiniteNumber(f.headers.get("content-length")),[n,s]=m&&ut(t,lt(dt(m),!0))||[];f=new r(jt(f.body,65536,n,()=>{s&&s(),O&&O()}),e)}g=g||"text";let P=await p[Pe.findKey(p,g)||"text"](f,e);return!h&&O&&O(),await new Promise((t,n)=>{ct(t,n,{data:P,headers:st.from(f.headers),status:f.status,statusText:f.statusText,config:e,request:x})})}catch(t){if(O&&O(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new ke("Network Error",ke.ERR_NETWORK,e,x,t&&t.response),{cause:t.cause||t});throw ke.from(t,t&&t.code,e,x,t&&t.response)}}},kt=new Map,Ct=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,i=[r,s,n];let o,a,c=i.length,l=kt;for(;c--;)o=i[c],a=l.get(o),void 0===a&&l.set(o,a=c?new Map:Nt(t)),l=a;return a},Et=(Ct(),{http:null,xhr:vt,fetch:{get:Ct}});Pe.forEach(Et,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const Dt=e=>`- ${e}`,Tt=e=>Pe.isFunction(e)||null===e||!1===e,At=function(e,t){e=Pe.isArray(e)?e:[e];const{length:n}=e;let r,s;const i={};for(let o=0;o<n;o++){let n;if(r=e[o],s=r,!Tt(r)&&(s=Et[(n=String(r)).toLowerCase()],void 0===s))throw new ke(`Unknown adapter '${n}'`);if(s&&(Pe.isFunction(s)||(s=s.get(t))))break;i[n||"#"+o]=s}if(!s){const e=Object.entries(i).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));let t=n?e.length>1?"since :\n"+e.map(Dt).join("\n"):" "+Dt(e[0]):"as no adapter specified";throw new ke("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return s};function Rt(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new at(null,e)}function It(e){return Rt(e),e.headers=st.from(e.headers),e.data=it.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),At(e.adapter||Ye.adapter,e)(e).then(function(t){return Rt(e),t.data=it.call(e,e.transformResponse,t),t.headers=st.from(t.headers),t},function(t){return ot(t)||(Rt(e),t&&t.response&&(t.response.data=it.call(e,e.transformResponse,t.response),t.response.headers=st.from(t.response.headers))),Promise.reject(t)})}const Lt="1.13.5",Ft={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Ft[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Mt={};Ft.transitional=function(e,t,n){function r(e,t){return"[Axios v"+Lt+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,s,i)=>{if(!1===e)throw new ke(r(s," has been removed"+(t?" in "+t:"")),ke.ERR_DEPRECATED);return t&&!Mt[s]&&(Mt[s]=!0,console.warn(r(s," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,s,i)}},Ft.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};const Bt={assertOptions:function(e,t,n){if("object"!=typeof e)throw new ke("options must be an object",ke.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const i=r[s],o=t[i];if(o){const t=e[i],n=void 0===t||o(t,i,e);if(!0!==n)throw new ke("option "+i+" must be "+n,ke.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new ke("Unknown option "+i,ke.ERR_BAD_OPTION)}},validators:Ft},Ut=Bt.validators;class qt{constructor(e){this.defaults=e||{},this.interceptors={request:new Ue,response:new Ue}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?n&&!String(e.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+n):e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=bt(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:s}=t;void 0!==n&&Bt.assertOptions(n,{silentJSONParsing:Ut.transitional(Ut.boolean),forcedJSONParsing:Ut.transitional(Ut.boolean),clarifyTimeoutError:Ut.transitional(Ut.boolean),legacyInterceptorReqResOrdering:Ut.transitional(Ut.boolean)},!1),null!=r&&(Pe.isFunction(r)?t.paramsSerializer={serialize:r}:Bt.assertOptions(r,{encode:Ut.function,serialize:Ut.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Bt.assertOptions(t,{baseUrl:Ut.spelling("baseURL"),withXsrfToken:Ut.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let i=s&&Pe.merge(s.common,s[t.method]);s&&Pe.forEach(["delete","get","head","post","put","patch","common"],e=>{delete s[e]}),t.headers=st.concat(i,s);const o=[];let a=!0;this.interceptors.request.forEach(function(e){if("function"==typeof e.runWhen&&!1===e.runWhen(t))return;a=a&&e.synchronous;const n=t.transitional||qe;n&&n.legacyInterceptorReqResOrdering?o.unshift(e.fulfilled,e.rejected):o.push(e.fulfilled,e.rejected)});const c=[];let l;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let u,d=0;if(!a){const e=[It.bind(this),void 0];for(e.unshift(...o),e.push(...c),u=e.length,l=Promise.resolve(t);d<u;)l=l.then(e[d++],e[d++]);return l}u=o.length;let p=t;for(;d<u;){const e=o[d++],t=o[d++];try{p=e(p)}catch(e){t.call(this,e);break}}try{l=It.call(this,p)}catch(e){return Promise.reject(e)}for(d=0,u=c.length;d<u;)l=l.then(c[d++],c[d++]);return l}getUri(e){return Be(ht((e=bt(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}}Pe.forEach(["delete","get","head","options"],function(e){qt.prototype[e]=function(t,n){return this.request(bt(n||{},{method:e,url:t,data:(n||{}).data}))}}),Pe.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,s){return this.request(bt(s||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}qt.prototype[e]=t(),qt.prototype[e+"Form"]=t(!0)});const Vt=qt;class Wt{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const n=this;this.promise.then(e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t;const r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,s){n.reason||(n.reason=new at(e,r,s),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new Wt(function(t){e=t}),cancel:e}}}const Ht=Wt,zt={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(zt).forEach(([e,t])=>{zt[t]=e});const $t=zt,Gt=function e(t){const n=new Vt(t),r=L(Vt.prototype.request,n);return Pe.extend(r,Vt.prototype,n,{allOwnKeys:!0}),Pe.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(bt(t,n))},r}(Ye);Gt.Axios=Vt,Gt.CanceledError=at,Gt.CancelToken=Ht,Gt.isCancel=ot,Gt.VERSION=Lt,Gt.toFormData=Ae,Gt.AxiosError=ke,Gt.Cancel=Gt.CanceledError,Gt.all=function(e){return Promise.all(e)},Gt.spread=function(e){return function(t){return e.apply(null,t)}},Gt.isAxiosError=function(e){return Pe.isObject(e)&&!0===e.isAxiosError},Gt.mergeConfig=bt,Gt.AxiosHeaders=st,Gt.formToJSON=e=>Je(Pe.isHTMLForm(e)?new FormData(e):e),Gt.getAdapter=At,Gt.HttpStatusCode=$t,Gt.default=Gt;const Kt=Gt,Jt=window.ReactDOM;var Qt,Yt,Xt,Zt,en,tn,nn,rn,sn,on,an,cn,ln,un,dn=function(e){var t=(0,i.createContext)(void 0);return[t,function(){var n=(0,i.useContext)(t);if(void 0===n)throw Error("".concat(e," can only be used within a corresponding context provider."));return n}]},pn=function(e,t){return t.includes(e.charAt(e.length-1))?e.slice(0,-1):e},fn=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:150;return e.length>t?"".concat(e.slice(0,t)).concat((0,a._x)("…","truncated text","code-snippets")):e},hn=function(e){var t,n=(new DOMParser).parseFromString(e,"text/html");return n.body.querySelectorAll("script,style").forEach(function(e){return e.remove()}),n.body.querySelectorAll("p,div,li,br,h1,h2,h3,h4,h5,h6,tr,td,th,ul,ol,blockquote,table,pre,hr,dl,dt,dd,section,article,header,footer,figure,figcaption,address,aside,nav,main,fieldset,form,details,summary,dialog,hgroup,caption").forEach(function(e){return e.after(n.createTextNode(" "))}),(null!==(t=n.body.textContent)&&void 0!==t?t:"").replace(/\s+/g," ").trim()},mn=function(e){return pn(null!=e?e:"","/")},bn={base:mn(null===(Qt=window.CODE_SNIPPETS)||void 0===Qt?void 0:Qt.restAPI.base),snippets:mn(null===(Yt=window.CODE_SNIPPETS)||void 0===Yt?void 0:Yt.restAPI.snippets),recentlyActive:mn(null===(Xt=window.CODE_SNIPPETS)||void 0===Xt?void 0:Xt.restAPI.recentlyActive),import:{plugins:mn(null===(Zt=window.CODE_SNIPPETS)||void 0===Zt?void 0:Zt.restAPI.importPlugins),files:mn(null===(en=window.CODE_SNIPPETS)||void 0===en?void 0:en.restAPI.importFiles)},preferences:{snippetView:mn(null===(tn=window.CODE_SNIPPETS)||void 0===tn?void 0:tn.restAPI.snippetView),insights:mn(null===(nn=window.CODE_SNIPPETS)||void 0===nn?void 0:nn.restAPI.insightsView),demosSeen:mn(null===(rn=window.CODE_SNIPPETS)||void 0===rn?void 0:rn.restAPI.demosSeen)},cloud:{snippets:mn(null===(sn=window.CODE_SNIPPETS)||void 0===sn?void 0:sn.restAPI.cloud.snippets)}},gn=["delete","put","patch"],vn=function(e){var t,n=null===(t=e.method)||void 0===t?void 0:t.toLowerCase();return n&&gn.includes(n)?(e.headers.set("X-HTTP-Method-Override",n.toUpperCase()),e.method="post",e):e},yn=null!==(on=null===(an=window.CODE_SNIPPETS)||void 0===an?void 0:an.restAPI.nonce)&&void 0!==on?on:null===(cn=window.CODE_SNIPPETS_FEEDBACK)||void 0===cn?void 0:cn.nonce,_n=null===(ln=window.CODE_SNIPPETS_MANAGE)||void 0===ln?void 0:ln.runOnceNonce,jn=function(){var e;return null!==(e=_n)&&void 0!==e?e:""},wn=function(e){return yn&&e.headers.set("X-WP-Nonce",yn),e},xn={headers:{"Access-Control":null===(un=window.CODE_SNIPPETS)||void 0===un?void 0:un.restAPI.cloud.token}},On=function(){var e=A(I().mark(function e(t,n,r,s){var i,o,a;return I().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(i=window.CODE_SNIPPETS)||void 0===i||!i.debug){e.next=9;break}return(o=console).debug.apply(o,["".concat(t," ").concat(n)].concat(D(s?[s]:[]))),e.next=4,r;case 4:return a=e.sent,console.debug("Response",a),e.abrupt("return",a);case 9:return e.next=11,r;case 11:return e.abrupt("return",e.sent);case 12:case"end":return e.stop()}},e)}));return function(t,n,r,s){return e.apply(this,arguments)}}(),Sn=s(dn("useRestAPI"),2),Pn=Sn[0],Nn=Sn[1],kn=function(e){var t=e.children,n=(0,i.useMemo)(function(){var e,t=Kt.create(xn);return t.interceptors.request.use(wn),t.interceptors.request.use(vn),null===(e=window.wp.hooks)||void 0===e||e.addAction("heartbeat.tick","code-snippets/refresh-rest-nonce",function(e){e.rest_nonce&&(yn=e.rest_nonce),e.code_snippets_run_once_nonce&&(_n=e.code_snippets_run_once_nonce)}),t},[]),r=(0,i.useMemo)(function(){return function(e){return{getResponse:function(t){return On("GET",t,e.get(t))},get:function(t){return On("GET",t,e.get(t)).then(function(e){return e.data})},post:function(t,n,r){return On("POST",t,e.post(t,n,r),n).then(function(e){return e.data})},del:function(t){return On("DELETE",t,e.delete(t)).then(function(e){return e.data})},put:function(t,n){return On("PUT",t,e.put(t,n),n).then(function(e){return e.data})}}}(n)},[n]),s={api:r,axiosInstance:n};return(0,_.jsx)(Pn.Provider,{value:s,children:t})},Cn="snippets-screen-meta-slot",En=function(e){var t=e.hidden,n=void 0!==t&&t;return(0,i.useEffect)(function(){var e=document.getElementById(Cn),t=document.getElementById("screen-meta"),n=document.getElementById("screen-meta-links");if(e&&t&&n){var r=t.parentElement;return e.append(t,n),function(){null==r||r.prepend(t,n)}}},[]),(0,_.jsx)("div",{id:Cn,className:"snippets-screen-meta-slot",hidden:n})},Dn=function(e){var t=e.callout;return t?(0,_.jsxs)("aside",{className:"demo-callout","aria-hidden":"true",children:[(0,_.jsx)("span",{className:"demo-callout__step",children:t.step}),(0,_.jsx)("h3",{className:"demo-callout__title",children:t.title}),(0,_.jsx)("p",{className:"demo-callout__body",children:t.body})]},t.title):null},Tn=["id","children","className","name","primary","secondary","small","large","link","type","onClick"];function An(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Rn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?An(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):An(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var In=function(e){var t=e.id,n=e.children,r=e.className,s=e.name,i=e.primary,o=void 0!==i&&i,a=e.secondary,c=void 0!==a&&a,l=e.small,u=void 0!==l&&l,d=e.large,p=void 0!==d&&d,f=e.link,h=void 0!==f&&f,m=e.type,b=void 0===m?"button":m,v=e.onClick,j=g(e,Tn);return(0,_.jsx)("button",Rn(Rn({id:null!=t?t:s,name:s,type:b},j),{},{onClick:function(e){v&&(e.preventDefault(),v(e))},className:y()("button",r,{"button-primary":o,"button-secondary":c,"button-large":p,"button-small":u,"button-link":h}),children:n}))},Ln=function(e){var t=e.title,n=e.description,r=e.hasStarted,s=e.isFinished,i=e.onPlay,o=e.onSkip,c=e.onReplay;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("div",{className:"snippets-page-header demo-page-header",children:[(0,_.jsxs)("h1",{children:[t,(0,_.jsx)("span",{className:"demo-chip",children:(0,a.__)("Demo","code-snippets")})]}),(0,_.jsxs)("div",{className:"demo-controls",children:[!r&&(0,_.jsx)(In,{primary:!0,large:!0,type:"button",className:"demo-play",onClick:i,children:(0,a.__)("Play demo","code-snippets")}),r&&!s&&(0,_.jsx)(In,{secondary:!0,type:"button",onClick:o,children:(0,a.__)("Skip animation","code-snippets")}),s&&(0,_.jsx)(In,{primary:!0,type:"button",onClick:c,children:(0,a.__)("Run demo again","code-snippets")})]})]}),(0,_.jsx)("p",{className:"snippets-page-description",children:n})]})},Fn=function(e){var t=e.target,n=e.padding,r=void 0===n?8:n,o=s((0,i.useState)(),2),a=o[0],c=o[1],l=(0,i.useCallback)(function(){c(t?function(e,t){var n=document.querySelector(e);if(n){var r=n.getBoundingClientRect();return{top:r.top-t,left:r.left-t,width:r.width+2*t,height:r.height+2*t}}}(t,r):void 0)},[r,t]);if((0,i.useEffect)(function(){if(l(),t){var e=new ResizeObserver(l);return e.observe(document.body),window.addEventListener("scroll",l,{passive:!0}),window.addEventListener("resize",l),function(){e.disconnect(),window.removeEventListener("scroll",l),window.removeEventListener("resize",l)}}},[l,t]),!a)return null;var u=a.top,d=a.left,p=a.width,f=a.height,h=[{insetBlockStart:0,insetInlineStart:0,inlineSize:"100%",blockSize:"".concat(Math.max(0,u),"px")},{insetBlockStart:"".concat(u+f,"px"),insetInlineStart:0,inlineSize:"100%",insetBlockEnd:0},{insetBlockStart:"".concat(u,"px"),insetInlineStart:0,inlineSize:"".concat(Math.max(0,d),"px"),blockSize:"".concat(f,"px")},{insetBlockStart:"".concat(u,"px"),insetInlineStart:"".concat(d+p,"px"),insetInlineEnd:0,blockSize:"".concat(f,"px")}],m={insetBlockStart:"".concat(u,"px"),insetInlineStart:"".concat(d,"px"),inlineSize:"".concat(p,"px"),blockSize:"".concat(f,"px")};return(0,_.jsxs)("div",{className:"demo-spotlight","aria-hidden":"true",children:[h.map(function(e,t){return(0,_.jsx)("div",{className:"demo-spotlight__panel",style:e},t)}),(0,_.jsx)("div",{className:"demo-spotlight__ring",style:m})]})},Mn=function(e){console.error(e)},Bn=function(e){var t,n;return null!==(t=null===(n=window.CODE_SNIPPETS)||void 0===n||null===(n=n.demosSeen)||void 0===n?void 0:n.includes(e))&&void 0!==t&&t},Un=function(e){var t=Nn().api,n=(0,i.useRef)(!1);return(0,i.useCallback)(function(){n.current||Bn(e)||(n.current=!0,t.post(bn.preferences.demosSeen,{demo:e}).catch(Mn))},[t,e])},qn={ask:{step:(0,a.__)("Step 1 of 5","code-snippets"),title:(0,a.__)("Ask in plain English","code-snippets"),body:(0,a.__)("No syntax to learn and no boilerplate to copy — describe what you want the site to do, and the agent works out what that means in code.","code-snippets")},plan:{step:(0,a.__)("Step 2 of 5","code-snippets"),title:(0,a.__)("Sent for planning","code-snippets"),body:(0,a.__)("Your request goes to Code Snippets Cloud, which works out what needs building — and whether that is one snippet or several — before writing anything.","code-snippets")},approve:{step:(0,a.__)("Step 3 of 5","code-snippets"),title:(0,a.__)("You approve the plan","code-snippets"),body:(0,a.__)("Nothing is written until you accept. Read what it intends to build, send it back for changes, or let it go ahead.","code-snippets")},build:{step:(0,a.__)("Step 4 of 5","code-snippets"),title:(0,a.__)("Built and added to your site","code-snippets"),body:(0,a.__)("Each part of the plan becomes a real snippet, written to suit your site rather than pulled from a template. They arrive inactive, so nothing runs until you have read the code and switched them on.","code-snippets")},refine:{step:(0,a.__)("Step 5 of 5","code-snippets"),title:(0,a.__)("Refine what it built","code-snippets"),body:(0,a.__)("Not quite right? Say what to change in plain English and it rewrites the snippets in place, keeping the conversation so each refinement builds on the last.","code-snippets")},done:{step:(0,a.__)("Done","code-snippets"),title:(0,a.__)("Ready to review","code-snippets"),body:(0,a.__)("The finished snippets are on your site, waiting for you to check them over and activate them.","code-snippets")}},Vn={"typing-prompt":"ask","prompt-sent":"plan",planning:"plan","plan-ready":"approve","plan-accepted":"approve",building:"build","result-ready":"build","refine-open":"refine","typing-refinement":"refine",applying:"refine",saved:"done"},Wn=function(e){var t=Vn[e];return t?qn[t]:void 0},Hn={cond:"randomize",cloud:"cloud",bundles:"screenoptions",cloud_search:"search"},zn=function(e){var t=e.name,n=e.small,r=e.inverted,s=e.children;return(0,_.jsx)("span",{className:y()("badge","".concat(t,"-badge"),{"small-badge":n,"inverted-badge":r}),children:Hn[t]?(0,_.jsx)("span",{className:"dashicons dashicons-".concat(Hn[t]),"aria-hidden":"true"}):null!=s?s:t})};function $n(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Gn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$n(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$n(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Kn=[(0,a.__)("Replace a plugin with snippets","code-snippets"),(0,a.__)("Speed up my site","code-snippets"),(0,a.__)("Add a feature","code-snippets"),(0,a.__)("Fix a problem","code-snippets"),(0,a.__)("Customize appearance","code-snippets")],Jn=(0,a.__)("Add a dismissible welcome banner to the top of my site.","code-snippets"),Qn=(0,a.__)("Here is what I would build. Two snippets keep the markup and the styling separate, so you can restyle the banner later without touching the PHP.","code-snippets"),Yn={title:(0,a.__)("Dismissible welcome banner","code-snippets"),summary:Qn,parts:[{language:"php",name:(0,a.__)("Welcome banner","code-snippets"),description:(0,a.__)("Prints the banner at the top of every front-end page and remembers when a visitor dismisses it.","code-snippets")},{language:"css",name:(0,a.__)("Welcome banner styles","code-snippets"),description:(0,a.__)("Styles the banner bar, its message, and the dismiss button.","code-snippets")}]},Xn=(0,a.__)("our site","code-snippets"),Zn=function(){var e,t=null===(e=window.CODE_SNIPPETS_MANAGE)||void 0===e||null===(e=e.aiDemo)||void 0===e?void 0:e.siteName.trim();return void 0===t||""===t?Xn:t},er=(0,a.__)("Done — the banner now greets visitors by name and uses a warmer gradient.","code-snippets"),tr=function(e){return'add_action( \'wp_body_open\', function () {\n\tif ( is_admin() || isset( $_COOKIE[\'cs_welcome_banner_dismissed\'] ) ) {\n\t\treturn;\n\t}\n\n\tprintf(\n\t\t\'<div class="cs-welcome-banner" role="status">\n\t\t\t<p class="cs-welcome-banner__message">%s</p>\n\t\t\t<button type="button" class="cs-welcome-banner__dismiss" aria-label="%s">&times;</button>\n\t\t</div>\',\n\t\tesc_html( \''.concat(e.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),"' ),\n\t\tesc_attr__( 'Dismiss this message', 'default' )\n\t);\n} );\n\nadd_action( 'wp_footer', function () {\n\t?>\n\t<script>\n\t\tdocument.querySelector( '.cs-welcome-banner__dismiss' )?.addEventListener( 'click', function () {\n\t\t\tdocument.cookie = 'cs_welcome_banner_dismissed=1; path=/; max-age=2592000';\n\t\t\tthis.closest( '.cs-welcome-banner' ).remove();\n\t\t} );\n\t<\/script>\n\t<?php\n} );")},nr=function(e){return(0,a.sprintf)((0,a.__)("%s Created by the Code Snippets AI Agent demo, and left inactive so you can review it before switching it on.","code-snippets"),e)},rr=function(){return[{key:"banner-php",name:(0,a.__)("Welcome banner","code-snippets"),desc:nr((0,a.__)("Shows a dismissible welcome banner at the top of the site.","code-snippets")),language:"php",code:tr((0,a.__)("Welcome!","code-snippets"))},{key:"banner-css",name:(0,a.__)("Welcome banner styles","code-snippets"),desc:nr((0,a.__)("Styles the welcome banner.","code-snippets")),language:"css",code:".cs-welcome-banner {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tgap: 1rem;\n\tpadding-block: 0.75rem;\n\tpadding-inline: 1.5rem;\n\tbackground: #2271b1;\n\tcolor: #fff;\n\tfont-size: 0.95rem;\n}\n\n.cs-welcome-banner__message {\n\tmargin: 0;\n}\n\n.cs-welcome-banner__dismiss {\n\tbackground: none;\n\tborder: 0;\n\tcolor: inherit;\n\tcursor: pointer;\n\tfont-size: 1.25rem;\n\tline-height: 1;\n\tpadding: 0;\n}"}]},sr=function(e){var t=(0,a.sprintf)((0,a.__)("Welcome to %s","code-snippets"),e);return[Gn(Gn({},rr()[0]),{},{code:tr(t)}),Gn(Gn({},rr()[1]),{},{code:".cs-welcome-banner {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tgap: 1rem;\n\tpadding-block: 0.9rem;\n\tpadding-inline: 1.5rem;\n\tbackground: linear-gradient(90deg, #1d3c78 0%, #2271b1 55%, #3fa8d4 100%);\n\tcolor: #fff;\n\tfont-size: 1rem;\n\tletter-spacing: 0.01em;\n\ttext-align: center;\n}\n\n.cs-welcome-banner__message {\n\tmargin: 0;\n\tfont-weight: 600;\n}\n\n.cs-welcome-banner__dismiss {\n\tbackground: none;\n\tborder: 0;\n\tcolor: inherit;\n\tcursor: pointer;\n\tfont-size: 1.4rem;\n\tline-height: 1;\n\tpadding: 0;\n\topacity: 0.8;\n\ttransition: opacity 0.15s ease;\n}\n\n.cs-welcome-banner__dismiss:hover {\n\topacity: 1;\n}"})]},ir=function(e){return"javascript"===e?"js":e},or=["idle","typing-prompt","prompt-sent","planning","plan-ready","plan-accepted","building","result-ready","refine-open","typing-refinement","applying","saved","finished"],ar=function(e){return or.indexOf(e)},cr=function(e,t){return ar(e)>=ar(t)},lr=function(e){var t=e.accepted,n=(0,a.sprintf)((0,a._n)("Bundle · %d snippet","Bundle · %d snippets",Yn.parts.length,"code-snippets"),Yn.parts.length);return(0,_.jsxs)("div",{className:"ai-agent-plan",children:[(0,_.jsxs)("div",{className:"ai-agent-plan__header",children:[(0,_.jsx)("h2",{className:"ai-agent-plan__title",children:Yn.title}),(0,_.jsx)("span",{className:"ai-agent-plan__badge is-bundle",children:n})]}),(0,_.jsx)("p",{className:"ai-agent-plan__overview",children:Yn.summary}),(0,_.jsx)("h3",{className:"ai-agent-plan__parts-heading",children:(0,a.__)("What will be created","code-snippets")}),(0,_.jsx)("ul",{className:"ai-agent-plan__parts",children:Yn.parts.map(function(e){return(0,_.jsxs)("li",{className:"ai-agent-plan__part",children:[(0,_.jsx)(zn,{name:ir(e.language),small:!0}),(0,_.jsx)("span",{className:"ai-agent-plan__part-name",children:e.name}),(0,_.jsx)("p",{className:"ai-agent-plan__part-desc",children:e.description})]},e.name)})}),(0,_.jsxs)("div",{className:"ai-agent-plan__actions",children:[(0,_.jsx)(In,{primary:!0,type:"button",className:y()("ai-agent-demo-accept",{"demo-click":t}),"aria-hidden":"true",tabIndex:-1,children:(0,a.__)("Accept & create","code-snippets")}),(0,_.jsx)(In,{secondary:!0,type:"button","aria-hidden":"true",tabIndex:-1,children:(0,a.__)("Refine plan","code-snippets")})]})]})},ur=function(e){var t=e.value,n=e.submitLabel,r=e.placeholder,s=e.typing,i=e.pressed,o=void 0!==i&&i,c=e.disabled,l=void 0!==c&&c;return(0,_.jsxs)("div",{className:y()("ai-agent-prompt","ai-agent-demo-prompt",{"is-typing":s}),children:[(0,_.jsxs)("div",{className:"ai-agent-prompt__input ai-agent-demo-prompt__text","aria-live":"polite",children:[""===t?(0,_.jsx)("span",{className:"ai-agent-demo-prompt__placeholder",children:r}):t,s&&(0,_.jsx)("span",{className:"ai-agent-demo-prompt__caret","aria-hidden":"true"})]}),(0,_.jsxs)("div",{className:"ai-agent-prompt__footer",children:[(0,_.jsx)("span",{className:"ai-agent-prompt__hint",children:(0,a.__)("Enter to send · Shift/Ctrl/⌘+Enter for a new line","code-snippets")}),(0,_.jsx)(In,{primary:!0,type:"button",disabled:l,className:y()("ai-agent-demo-send",{"demo-click":o}),"aria-hidden":"true",tabIndex:-1,children:n})]})]})};const dr=window.wp.components;var pr=["php","html","css","js","cond"],fr={php:["global","admin","front-end","single-use"],html:["content","head-content","body-content","footer-content"],css:["admin-css","site-css"],js:["site-head-js","site-footer-js"],cond:["condition"]};function hr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function mr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?hr(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var br={id:0,name:"",code:"",desc:"",scope:"global",modified:"",active:!1,locked:!1,trashed:!1,network:k(),shared_network:null,priority:10,conditionId:0,code_error:null,code_error_trace:null},gr=function(e){return"number"==typeof e&&0<e},vr=function(e){var t;if(!e||"object"!==l(e))return null;var n=e;return{id:Number(null!==(t=n.id)&&void 0!==t?t:0),displayName:"string"==typeof n.display_name?n.display_name:"",avatarUrl:"string"==typeof n.avatar_url?n.avatar_url:""}},yr=function(e){var t,n,r,s=mr(mr({},br),{},{tags:[],conditions:{}});return"object"!==l(e)||null===e?s:mr(mr(mr(mr(mr(mr(mr(mr(mr(mr(mr(mr(mr(mr(mr(mr(mr(mr(mr(mr(mr({},s),"id"in e&&gr(e.id)&&{id:e.id}),"name"in e&&"string"==typeof e.name&&{name:e.name}),"desc"in e&&"string"==typeof e.desc&&{desc:e.desc}),"code"in e&&"string"==typeof e.code&&{code:e.code}),"tags"in e&&{tags:null!==(r=e.tags,t=Array.isArray(r)?r.filter(function(e){return"string"==typeof e}):void 0)&&void 0!==t?t:s.tags}),"scope"in e&&"string"==typeof(n=e.scope)&&Object.values(fr).some(function(e){return e.some(function(e){return e===n})})&&{scope:e.scope}),"modified"in e&&"string"==typeof e.modified&&{modified:e.modified}),"active"in e&&"boolean"==typeof e.active&&{active:e.active}),"locked"in e&&"boolean"==typeof e.locked&&{locked:e.locked}),"trashed"in e&&"boolean"==typeof e.trashed&&{trashed:e.trashed}),"network"in e&&"boolean"==typeof e.network&&{network:e.network}),"shared_network"in e&&"boolean"==typeof e.shared_network&&{shared_network:e.shared_network}),"priority"in e&&"number"==typeof e.priority&&{priority:e.priority}),"conditionId"in e&&gr(e.conditionId)&&{conditionId:e.conditionId}),"condition_id"in e&&gr(e.condition_id)&&{conditionId:e.condition_id}),"code_error"in e&&function(e){return Array.isArray(e)&&2===e.length&&"string"==typeof e[0]&&"number"==typeof e[1]}(e.code_error)&&{code_error:e.code_error}),"code_error_trace"in e&&("string"==typeof e.code_error_trace||null===e.code_error_trace)&&{code_error_trace:e.code_error_trace}),"last_active"in e&&{lastActive:Number(e.last_active)}),"created_by"in e&&{createdBy:vr(e.created_by)}),"updated_by"in e&&{updatedBy:vr(e.updated_by)})};function _r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function jr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_r(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_r(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var wr=new Set(["css","js","cond"]),xr={php:(0,a.__)("Functions","code-snippets"),html:(0,a.__)("Content","code-snippets"),css:(0,a.__)("Styles","code-snippets"),js:(0,a.__)("Scripts","code-snippets"),cond:(0,a.__)("Conditions","code-snippets")},Or=((0,a.__)("Run everywhere","code-snippets"),(0,a.__)("Only run in administration area","code-snippets"),(0,a.__)("Only run on site front-end","code-snippets"),(0,a.__)("Only run once","code-snippets"),(0,a.__)("Where inserted in editor","code-snippets"),(0,a.__)("In site header (<head> section)","code-snippets"),(0,a.__)("In site content (start of <body>)","code-snippets"),(0,a.__)("In site footer (end of <body>)","code-snippets"),(0,a.__)("Site front-end","code-snippets"),(0,a.__)("Administration area","code-snippets"),(0,a.__)("In site header (<head> section)","code-snippets"),(0,a.__)("In site footer (end of <body>)","code-snippets"),function(e){return yr(e)}),Sr=function(e){return Or(jr(jr({},e),{},{id:0,active:!1,name:(0,a.sprintf)((0,a.__)("%s [CLONE]","code-snippets"),e.name)}))},Pr=function(e){var t=e.scope;switch(!0){case t.endsWith("-css"):return"css";case t.endsWith("-js"):return"js";case t.endsWith("content"):return"html";case"condition"===t:return"cond";default:return"php"}},Nr=function(e){var t,n;return null!=e&&e.id?m(null===(t=window.CODE_SNIPPETS)||void 0===t?void 0:t.urls.edit,{id:e.id}):null===(n=window.CODE_SNIPPETS)||void 0===n?void 0:n.urls.addNew},kr=function(e){var t,n;return!e||!C()&&Tr(e)?null===(n=window.CODE_SNIPPETS)||void 0===n?void 0:n.urls.addNew:m(null===(t=window.CODE_SNIPPETS)||void 0===t?void 0:t.urls.addNew,{type:e})},Cr=function(e){return""===e.name.trim()?(0,a.sprintf)(Er(e)?(0,a.__)("Condition #%d","code-snippets"):(0,a.__)("Snippet #%d","code-snippets"),e.id):e.name},Er=function(e){return"condition"===e.scope},Dr=function(e){return wr.has(Pr(e))},Tr=function(e){return wr.has(e)},Ar=function(e,t){var n,r;return"cond"===Pr(e)?0<(null!==(n=null===(r=t.get(e.id))||void 0===r?void 0:r.length)&&void 0!==n?n:0):e.active},Rr=function(e){return!k()&&e.network&&!e.shared_network},Ir=function(e){var t;return!(Rr(e)||e.shared_network&&(null===(t=window.CODE_SNIPPETS_MANAGE)||void 0===t||!t.hasNetworkCap))},Lr=function(e){return!e.local_id&&(!Dr(e)||C())},Fr=function(e,t){var n=e.id,r=e.network;return m([bn.snippets,n,t].filter(Boolean).join("/"),{network:r})},Mr=function(e){return{name:e.name,desc:e.desc,code:e.code,tags:e.tags,scope:e.scope,priority:e.priority,active:e.active,network:e.network,locked:e.locked,trashed:e.trashed,shared_network:e.shared_network,condition_id:e.conditionId}},Br=s(dn("useSnippetsAPI"),2),Ur=Br[0],qr=Br[1],Vr=function(e){var t=e.children,n=Nn().api,r=(0,i.useMemo)(function(){return t=(e=n).get,r=e.post,s=e.del,i=e.put,{fetchAll:function(e){return t(m(bn.snippets,{network:e})).then(function(e){return e.map(Or)})},fetch:function(e,n){return t(m("".concat(bn.snippets,"/").concat(e),{network:n})).then(Or)},create:function(e){return r(bn.snippets,Mr(e)).then(Or)},update:function(e){return r(e.id?Fr(e):bn.snippets,Mr(e)).then(Or)},delete:function(e){return s(Fr(e))},restore:function(e){return r(Fr(e,"restore"))},activate:function(e){return r(Fr(e,"activate")).then(Or)},deactivate:function(e){return r(Fr(e,"deactivate")).then(Or)},export:function(e){return t(Fr(e,"export"))},exportCode:function(e){return t(Fr(e,"export-code"))},attach:function(e){return i(Fr(e,"attach"),{condition_id:e.conditionId})},detach:function(e){return i(Fr(e,"detach"))}};var e,t,r,s,i},[n]);return(0,_.jsx)(Ur.Provider,{value:r,children:t})},Wr=s(dn("useSnippetsList"),2),Hr=Wr[0],zr=Wr[1],$r=function(e){var t=e.children,n=qr().fetchAll,r=(0,i.useState)(function(){var e;return null===(e=window.CODE_SNIPPETS_MANAGE)||void 0===e||null===(e=e.snippetsList)||void 0===e?void 0:e.map(yr)}),o=s(r,2),a=o[0],c=o[1],l=(0,i.useCallback)(A(I().mark(function e(){var t;return I().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,console.info("Fetching snippets list"),e.next=4,n(k());case 4:t=e.sent,c(t),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(0),console.error("Error fetching snippets list",e.t0);case 11:case"end":return e.stop()}},e,null,[[0,8]])})),[n]);(0,i.useEffect)(function(){l().catch(function(){})},[l]);var u={snippetsList:a,refreshSnippetsList:l};return(0,_.jsx)(Hr.Provider,{value:u,children:t})},Gr={php:["php","text/php"],html:["php","text/php"],css:["css","text/css"],js:["js","text/javascript"],cond:["json","application/json"],json:["json","application/json"]},Kr=function(e,t,n){var r=document.createElement("a");r.download=t,r.href=URL.createObjectURL(new Blob([e],{type:n})),setTimeout(function(){return URL.revokeObjectURL(r.href)},4e4),r.style.display="none",document.body.appendChild(r),setTimeout(function(){r.click(),r.remove()},0)},Jr=function(e,t,n){var r=t.id,i=t.name,o=t.scope,a=i.toLowerCase().replace(/[^\w-]+/g,"-").trim(),c=""===a?"snippet-".concat(r):a;if("string"==typeof e){var l=s(Gr[null!=n?n:Pr({scope:o})],2),u=l[0],d=l[1],p="".concat(c,".code-snippets.").concat(u);Kr(e,p,d)}else{var f="".concat(c,".code-snippets.json");Kr(JSON.stringify(e,void 0,2),f,"application/json")}},Qr=function(e){return null==e},Yr={id:function(e){return 0===e},desc:function(e){return""===e},name:function(e){return""===e},code:function(e){return""===e},tags:function(e){return Array.isArray(e)&&0===e.length},scope:function(e){return"global"===e},condition_id:function(e){return 0===e},active:function(e){return!1===e},locked:function(e){return!1===e},trashed:function(e){return!1===e},priority:function(e){return 10===e},modified:function(e){return""===e||Qr(e)},last_active:function(e){return 0===e||Qr(e)},network:function(e){return null===e||!1===e},shared_network:function(e){return null===e||!1===e},code_error:function(e){return null===e||!1===e},code_error_trace:function(e){return null===e||!1===e}},Xr=function(e){var t=e.id,n=e.name,r=e.desc,i=e.code,o=e.tags,a=e.scope,c=e.active,l=e.locked,u=e.trashed,d=e.network,p=e.shared_network,f=e.modified,h=e.priority,m=e.conditionId,b=e.lastActive,g=e.code_error,v=e.code_error_trace;return Object.fromEntries(Object.entries({id:t,name:n,desc:r,code:i,tags:o,scope:a,active:c,locked:l,trashed:u,network:d,shared_network:p,modified:f,priority:h,condition_id:m,last_active:b,code_error:g,code_error_trace:v}).filter(function(e){var t,n,r,i=s(e,2);return t=i[0],n=i[1],!(null!==(r=Yr[t])&&void 0!==r?r:Qr)(n)}))},Zr=function(e){if(0!==e.length){var t={generator:"Code Snippets",date_created:(new Date).toISOString().slice(0,16).replace("T"," "),snippets:e.map(Xr)};Kr(JSON.stringify(t,void 0,2),"".concat("snippets",".code-snippets.json"),"application/json")}},es=function(e){var t=e.block,n=e.inline,r=e.start,s=e.end,o=e.icon,c=e.className,l=e.children,u=e.label,d=(0,i.useId)();return(0,_.jsxs)("div",{className:y()("tooltip help-tooltip",{"tooltip-block":t,"tooltip-inline":n,"tooltip-start":r,"tooltip-end":s},c),children:[(0,_.jsx)("button",{type:"button",className:"tooltip-trigger","aria-label":null!=u?u:(0,a.__)("More information","code-snippets"),"aria-describedby":d,children:null!=o?o:(0,_.jsx)("span",{className:"dashicons dashicons-editor-help","aria-hidden":"true"})}),(0,_.jsx)("div",{role:"tooltip",className:"tooltip-content",id:d,children:l})]})},ts=function(e){var t=e.message;return(0,_.jsx)(es,{block:!0,end:!0,label:(0,a.__)("Error","code-snippets"),icon:(0,_.jsx)("span",{className:"dashicons dashicons-warning","aria-hidden":"true"}),children:"".concat(pn(t,".!?"),". ").concat((0,a.__)("Please try again.","code-snippets"))})},ns=function(e){var t,n=e.isOpen,r=e.setIsOpen;return n?(0,_.jsxs)(dr.Modal,{"aria-labelledby":"code-snippets-upsell-dialog-title",className:"code-snippets-upsell code-snippets-upsell-dialog",onRequestClose:function(){r(!1)},children:[(0,_.jsx)("img",{src:"".concat(null===(t=window.CODE_SNIPPETS)||void 0===t?void 0:t.urls.plugin,"/assets/icon.svg"),alt:(0,a.__)("Code Snippets logo","code-snippets")}),(0,_.jsx)(rs,{})]}):null},rs=function(){return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("h1",{id:"code-snippets-upsell-dialog-title",children:(0,c.createInterpolateElement)((0,a.__)("Unlock all cloud sync features and many more, with <span>Code Snippets Pro</span>","code-snippets"),{span:(0,_.jsx)("span",{})})}),(0,_.jsx)("p",{children:(0,c.createInterpolateElement)((0,a.__)("With Code Snippets Pro you can connect your WordPress sites to the code snippets cloud platform and be able to <strong>backup, synchronise, collaborate, and deploy</strong> your snippets from one central location.","code-snippets"),{strong:(0,_.jsx)("strong",{})})}),(0,_.jsx)("a",{href:"https://codesnippets.pro/pricing/",className:"button button-primary button-large",rel:"noreferrer",target:"_blank",children:(0,a.__)("Explore Code Snippets Pro","code-snippets")}),(0,_.jsx)("p",{children:(0,a.__)("Here's what else you get with Pro:","code-snippets")}),(0,_.jsxs)("ul",{children:[(0,_.jsx)("li",{children:(0,a.__)("Create, explain and verify snippets with AI","code-snippets")}),(0,_.jsx)("li",{children:(0,a.__)("Control when snippets run with Conditions","code-snippets")}),(0,_.jsx)("li",{children:(0,a.__)("CSS stylesheet snippets","code-snippets")}),(0,_.jsx)("li",{children:(0,a.__)("Minified JavaScript snippets","code-snippets")}),(0,_.jsx)("li",{children:(0,a.__)("Editor blocks and Elementor widgets","code-snippets")}),(0,_.jsx)("li",{children:(0,a.__)("Cloud sync and backup","code-snippets")}),(0,_.jsx)("li",{children:(0,a.__)("Cloud share and deploy","code-snippets")}),(0,_.jsx)("li",{children:(0,a.__)("Cloud bundles and teams","code-snippets")}),(0,_.jsx)("li",{children:(0,a.__)("WP-CLI commands","code-snippets")}),(0,_.jsx)("li",{children:(0,a.__)("And much more!","code-snippets")})]})]})},ss=function(){return(0,_.jsx)("div",{className:"code-snippets-upsell code-snippets-upsell-page",children:(0,_.jsx)(rs,{})})};function is(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function os(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?is(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):is(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var as=s(dn("useCloudSnippetDownloads"),2),cs=as[0],ls=as[1],us=function(e){var t=e.children,n=s((0,i.useState)({}),2),r=n[0],o=n[1],a=(0,i.useCallback)(function(e,t){return o(function(n){return os(os({},n),{},b({},e,os(os({isDownloading:!1},n[e]),t)))})},[]);return(0,_.jsx)(cs.Provider,{value:{downloadRecords:r,updateDownloadRecord:a},children:t})},ds=function(e){var t,n,r=e.snippet,o=e.onDownloaded,c=Nn().api,l=ls(),u=l.downloadRecords,d=l.updateDownloadRecord,p=s((0,i.useState)(),2),f=p[0],h=p[1],m=s((0,i.useState)(!1),2),b=m[0],g=m[1],v=null!==(t=u[r.id])&&void 0!==t?t:{},y=v.isDownloading,j=void 0!==y&&y,w=v.localId,x=null!==(n=r.local_id)&&void 0!==n?n:w;return x?(0,_.jsx)("a",{className:"button button-primary",href:Nr({id:x}),target:"_blank",rel:"noopener noreferrer",children:(0,a.__)("Edit","code-snippets")}):Dr(r)&&!C()?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(In,{className:"cloud-pro-button",onClick:function(){return g(!0)},children:(0,a.__)("Pro Only","code-snippets")}),(0,_.jsx)(ns,{isOpen:b,setIsOpen:g})]}):(0,_.jsxs)(_.Fragment,{children:[j&&(0,_.jsx)(dr.Spinner,{}),f&&(0,_.jsx)(ts,{message:f}),(0,_.jsx)(In,{primary:!0,onClick:function(){d(r.id,{isDownloading:!0}),h(void 0),c.post("".concat(bn.cloud.snippets,"/").concat(r.id,"/download")).then(function(e){d(r.id,{localId:e.snippet_id}),null==o||o()}).catch(function(e){h("string"==typeof e?e:(0,a.__)("An error occurred while trying to download the snippet.","code-snippets"))}).finally(function(){return d(r.id,{isDownloading:!1})})},disabled:j,children:(0,a.__)("Download","code-snippets")})]})},ps=function(e){var t=e.open,n=e.title,r=e.onConfirm,s=e.onCancel,i=e.children,o=e.confirmLabel,c=void 0===o?(0,a.__)("OK","code-snippets"):o,l=e.cancelLabel,u=void 0===l?(0,a.__)("Cancel","code-snippets"):l,d=e.confirmButtonClassName;return t?(0,_.jsxs)(dr.Modal,{title:n,onRequestClose:s,closeButtonLabel:(0,a.__)("Close dialog","code-snippets"),isDismissible:!0,children:[i,(0,_.jsxs)(dr.Flex,{direction:"row",justify:"flex-end",children:[(0,_.jsx)(dr.Button,{variant:"tertiary",onClick:s,children:u}),(0,_.jsx)(dr.Button,{variant:"primary",onClick:r,className:d,children:c})]})]}):null},fs=function(){return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("p",{style:{marginBlockStart:0},children:(0,c.createInterpolateElement)((0,a.__)("This snippet is currently <strong>active</strong>.","code-snippets"),{strong:(0,_.jsx)("strong",{})})}),(0,_.jsx)("p",{children:(0,a.__)("Moving it to the trash will also deactivate it.","code-snippets")})]})},hs=function(){return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("p",{style:{marginBlockStart:0},children:(0,c.createInterpolateElement)((0,a.__)("The snippet will be <strong>permanently deleted</strong>.","code-snippets"),{strong:(0,_.jsx)("strong",{})})}),(0,_.jsx)("p",{children:(0,a.__)("This action cannot be undone.","code-snippets")})]})},ms=function(e){var t=e.snippet,n=e.isDialogOpen,r=e.setIsDialogOpen,s=e.makeDeleteRequest;return(0,_.jsx)(ps,{open:n,title:(0,a.__)("Are you sure?","code-snippets"),confirmLabel:t.trashed?(0,a.__)("Delete","code-snippets"):(0,a.__)("Trash","code-snippets"),confirmButtonClassName:"is-destructive",onCancel:function(){return r(!1)},onConfirm:function(){r(!1),s()},children:t.trashed?(0,_.jsx)(hs,{}):(0,_.jsx)(fs,{})})},bs=function(e){var t=e.snippet,n=e.setIsWorking,r=e.onSuccess,o=e.onError,a=qr(),c=s((0,i.useState)(!1),2),l=c[0],u=c[1],d=function(){var e=A(I().mark(function e(){return I().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return null==n||n(!0),e.prev=1,e.next=4,a.delete(t);case 4:return e.next=6,null==r?void 0:r();case 6:e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),null==o||o(e.t0);case 11:return e.prev=11,null==n||n(!1),e.finish(11);case 14:case"end":return e.stop()}},e,null,[[1,8,11,14]])}));return function(){return e.apply(this,arguments)}}(),p=function(){var e=A(I().mark(function e(){return I().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.active&&!t.trashed){e.next=4;break}u(!0),e.next=6;break;case 4:return e.next=6,d();case 6:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}();return{requestDelete:p,deleteDialogProps:{snippet:t,isDialogOpen:l,setIsDialogOpen:u,makeDeleteRequest:d}}};function gs(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function vs(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?gs(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gs(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var ys={css:"text/css",js:"javascript",php:"text/x-php",html:"application/x-httpd-php"},_s=function(){return window.isSecureContext?navigator.clipboard:void 0},js=function(e){var t,n,r;return{extraKeys:{Tab:!1,"Shift-Tab":!1},readOnly:!0,lineNumbers:!0,theme:null!==(t=null===(n=window.CODE_SNIPPETS_MANAGE)||void 0===n?void 0:n.editorTheme)&&void 0!==t?t:"default",mode:null!==(r=ys[e])&&void 0!==r?r:ys.php,screenReaderLabel:(0,a.__)("Snippet code preview","code-snippets")}},ws=function(e){return e[e.Ready=0]="Ready",e[e.Copied=1]="Copied",e[e.Failed=2]="Failed",e}(ws||{}),xs=function(e){var t=e.code,n=s((0,i.useState)(ws.Ready),2),r=n[0],o=n[1];return(0,_.jsx)(In,{secondary:!0,onClick:function(){var e=_s();e?e.writeText(t).then(function(){return o(ws.Copied)}).catch(function(){return o(ws.Failed)}):o(ws.Failed)},children:function(){switch(r){case ws.Copied:return(0,a.__)("Copied","code-snippets");case ws.Failed:return(0,a.__)("Copy unavailable","code-snippets");case ws.Ready:return(0,a.__)("Copy code","code-snippets")}}()})},Os=function(e){var t=e.onRequestClose,n=e.title,r=e.type,s=e.code,o=e.children,c=(0,i.useRef)(null);return(0,i.useEffect)(function(){if(c.current&&window.wp.codeEditor){var e=window.wp.codeEditor.initialize(c.current,{codemirror:js(r)});return e.codemirror.getInputField().setAttribute("aria-label",(0,a.__)("Snippet code preview","code-snippets")),function(){e.codemirror.toTextArea()}}},[r]),(0,_.jsxs)(dr.Modal,{className:"code-snippets-preview-modal",onRequestClose:t,title:n,headerActions:(0,_.jsx)("div",{className:"code-snippets-preview-modal__badge",children:(0,_.jsx)(zn,{name:r})}),children:[(0,_.jsx)("div",{className:"code-snippets-preview-modal__editor",children:(0,_.jsx)("textarea",{ref:c,readOnly:!0,"aria-label":(0,a.__)("Snippet code preview","code-snippets"),defaultValue:"".concat("php"===r?"<?php\n\n":"").concat(s)})}),o]})},Ss=function(e){var t=e.snippet,n=e.setIsOpen,r=e.onDownloaded;return(0,_.jsx)(Os,{code:t.code,type:Pr(t),title:t.name,onRequestClose:function(){return n(!1)},children:(0,_.jsx)("div",{className:"code-snippets-preview-modal__footer",children:(0,_.jsxs)("div",{className:"code-snippets-preview-modal__buttons",children:[(0,_.jsx)(ds,{snippet:t,onDownloaded:r}),_s()&&(0,_.jsx)(xs,{code:t.code})]})})})},Ps=function(e){var t=e.snippet,n=e.isWorking,r=e.setIsWorking,s=e.setIsOpen,i=qr(),o=zr().refreshSnippetsList;return(0,_.jsx)(In,{secondary:!0,disabled:n,onClick:function(){r(!0),i.create(Sr(t)).then(o).then(function(){return s(!1)}).catch(Mn).finally(function(){return r(!1)})},children:(0,a.__)("Clone","code-snippets")})},Ns=function(e){var t=e.snippet,n=e.isWorking,r=e.setIsWorking,s=qr();return(0,_.jsx)(In,{secondary:!0,disabled:n,onClick:function(){r(!0),s.export(t).then(function(e){return Jr(e,t)}).catch(Mn).finally(function(){return r(!1)})},children:(0,a.__)("Export","code-snippets")})},ks=function(e){var t=e.snippet,n=e.setIsOpen,r=e.extraActions,o=zr().refreshSnippetsList,c=function(){var e=s((0,i.useState)(!1),2),t=e[0],n=e[1],r=(0,i.useRef)(!1),o=function(e){r.current=e,n(e)};return{isWorking:t,beginWorking:function(){return!r.current&&(o(!0),!0)},finishWorking:function(){return o(!1)},setIsWorking:o}}(),l=c.isWorking,u=c.setIsWorking,d=bs({snippet:t,setIsWorking:u,onSuccess:function(){return n(!1),o()},onError:Mn}),p=d.requestDelete,f=d.deleteDialogProps,h=Ir(t);return(0,_.jsx)(Os,{code:t.code,type:Pr(t),title:Cr(t),onRequestClose:function(){return n(!1)},children:(0,_.jsxs)("div",{className:"code-snippets-preview-modal__footer",children:[(0,_.jsxs)("div",{className:"code-snippets-preview-modal__buttons",children:[(0,_.jsx)("a",{className:"button button-primary",href:Nr(t),children:t.locked||!h?(0,a.__)("View","code-snippets"):(0,a.__)("Edit","code-snippets")}),h&&(0,_.jsx)(Ps,{snippet:t,isWorking:l,setIsWorking:u,setIsOpen:n}),(0,_.jsx)(Ns,{snippet:t,isWorking:l,setIsWorking:u}),(0,_.jsx)(xs,{code:t.code}),!t.locked&&h&&(0,_.jsx)(In,{link:!0,className:"code-snippets-preview-modal__trash",disabled:l,onClick:function(){p()},children:(0,a.__)("Trash","code-snippets")})]}),(0,_.jsxs)("div",{className:"code-snippets-preview-modal__priority",children:[(0,_.jsx)("span",{children:(0,a.__)("Priority","code-snippets")}),(0,_.jsx)("span",{className:"code-snippets-preview-modal__priority-value",children:t.priority})]}),null==r?void 0:r(l),(0,_.jsx)(ms,vs({},f))]})})},Cs=function(e){var t=e.snippet,n=e.stage,r=e.onPreview;return(0,_.jsxs)("li",{className:"ai-agent-result__row",children:[cr(n,"refine-open")&&(0,_.jsx)("input",{type:"checkbox",checked:!0,disabled:!0,"aria-label":t.name}),(0,_.jsx)(zn,{name:ir(t.language),small:!0}),(0,_.jsx)("span",{className:"ai-agent-result__name",children:t.name}),(0,_.jsx)(In,{link:!0,type:"button",onClick:r,children:(0,a.__)("Preview code","code-snippets")}),"applying"!==n&&(0,_.jsx)(In,{link:!0,type:"button",className:"ai-agent-result__link","aria-hidden":"true",tabIndex:-1,children:(0,a.__)("Edit","code-snippets")})]})},Es=function(e){var t=e.stage,n=e.typedRefinement;return cr(t,"refine-open")?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("div",{className:"ai-agent-result__edit-head",children:[(0,_.jsx)("span",{children:(0,a.__)("Select the snippets to change, then describe the change.","code-snippets")}),(0,_.jsxs)("div",{className:"ai-agent-result__edit-actions",children:[(0,_.jsx)(In,{link:!0,type:"button","aria-hidden":"true",tabIndex:-1,children:(0,a.__)("Deselect all","code-snippets")}),(0,_.jsx)(In,{link:!0,type:"button","aria-hidden":"true",tabIndex:-1,children:(0,a.__)("Cancel","code-snippets")})]})]}),(0,_.jsx)(ur,{value:n,typing:"typing-refinement"===t,pressed:"applying"===t,submitLabel:(0,a.__)("Apply changes","code-snippets"),placeholder:(0,a.__)("Describe the changes to the selected snippet(s)…","code-snippets")})]}):(0,_.jsx)(In,{secondary:!0,type:"button",className:"ai-agent-result__make-changes","aria-hidden":"true",tabIndex:-1,children:(0,a.__)("Make changes","code-snippets")})},Ds=function(e){var t=e.stage,n=e.snippets,r=e.typedRefinement,o=s((0,i.useState)(),2),c=o[0],l=o[1];return(0,_.jsxs)("div",{className:"ai-agent-result",children:[(0,_.jsxs)("div",{className:"ai-agent-plan__header",children:[(0,_.jsx)("h2",{className:"ai-agent-plan__title",children:(0,a.__)("Dismissible welcome banner","code-snippets")}),(0,_.jsx)("span",{className:"ai-agent-plan__badge is-done",children:"applying"===t?(0,a.__)("Updating…","code-snippets"):(0,a.__)("Created","code-snippets")})]}),(0,_.jsx)("p",{className:"ai-agent-result__lead",children:(0,a.__)("In Pro these snippets would now be on your site, inactive. Preview the code, or make changes below.","code-snippets")}),(0,_.jsx)("ul",{className:"ai-agent-result__rows",children:n.map(function(e){return(0,_.jsx)(Cs,{snippet:e,stage:t,onPreview:function(){return l(e)}},e.key)})}),(0,_.jsx)("div",{className:"ai-agent-result__edit",children:(0,_.jsx)(Es,{stage:t,typedRefinement:r})}),c&&(0,_.jsx)(Os,{title:c.name,code:c.code,type:ir(c.language),onRequestClose:function(){return l(void 0)}})]})},Ts=[{label:(0,a.__)("Today","code-snippets"),used:2,limit:25},{label:(0,a.__)("This month","code-snippets"),used:34,limit:300}],As=[(0,a.__)("Hide the admin bar for subscribers","code-snippets"),(0,a.__)("Custom login screen logo","code-snippets")],Rs=function(){return(0,_.jsxs)("div",{className:"ai-agent-quota",children:[(0,_.jsx)("h2",{className:"ai-agent-sidebar__heading",children:(0,a.__)("AI usage","code-snippets")}),Ts.map(function(e){var t=e.label,n=e.used,r=e.limit;return(0,_.jsxs)("div",{className:"ai-agent-quota__row",children:[(0,_.jsxs)("div",{className:"ai-agent-quota__label",children:[(0,_.jsx)("span",{children:t}),(0,_.jsx)("span",{children:(0,a.sprintf)((0,a.__)("%1$d / %2$d","code-snippets"),n,r)})]}),(0,_.jsx)("div",{className:"ai-agent-quota__track is-ok",children:(0,_.jsx)("div",{className:"ai-agent-quota__fill",style:{inlineSize:"".concat(100*n/r,"%")}})})]},t)})]})},Is=function(e){var t=e.stage,n=function(e){return"applying"===e?{label:(0,a.__)("Updating","code-snippets")}:cr(e,"result-ready")?{label:(0,a.__)("Completed","code-snippets"),modifier:"is-done"}:cr(e,"building")?{label:(0,a.__)("Building","code-snippets")}:cr(e,"plan-ready")?{label:(0,a.__)("Plan ready","code-snippets"),modifier:"is-plan"}:{label:(0,a.__)("Planning","code-snippets")}}(t);return(0,_.jsx)("div",{className:"ai-agent-history",children:(0,_.jsxs)("ul",{className:"ai-agent-history__list",children:[cr(t,"prompt-sent")&&(0,_.jsx)("li",{className:"ai-agent-history__item is-active",children:(0,_.jsxs)("span",{className:"ai-agent-history__open",children:[(0,_.jsx)("span",{className:"ai-agent-history__title",children:(0,a.__)("Dismissible welcome banner","code-snippets")}),(0,_.jsx)("span",{className:y()("ai-agent-history__status",n.modifier),children:n.label})]})}),As.map(function(e){return(0,_.jsx)("li",{className:"ai-agent-history__item",children:(0,_.jsxs)("span",{className:"ai-agent-history__open",children:[(0,_.jsx)("span",{className:"ai-agent-history__title",children:e}),(0,_.jsx)("span",{className:"ai-agent-history__status is-done",children:(0,a.__)("Completed","code-snippets")})]})},e)})]})})},Ls=function(e){var t=e.tab,n=e.current,r=e.label,s=e.onSelect;return(0,_.jsx)("button",{type:"button",role:"tab",id:"ai-agent-demo-tab-".concat(t),"aria-selected":t===n,"aria-controls":"ai-agent-demo-panel-".concat(t),className:y()("ai-agent-sidebar__tab",{"is-active":t===n}),onClick:function(){return s(t)},children:r})},Fs=function(e){var t=e.stage,n=s((0,i.useState)("actions"),2),r=n[0],o=n[1];return(0,_.jsxs)("aside",{className:"ai-agent-sidebar","aria-label":(0,a.__)("AI Agent tools","code-snippets"),children:[(0,_.jsxs)("div",{className:"ai-agent-sidebar__tabs",role:"tablist",children:[(0,_.jsx)(Ls,{tab:"actions",current:r,label:(0,a.__)("Prompt Actions","code-snippets"),onSelect:o}),(0,_.jsx)(Ls,{tab:"history",current:r,label:(0,a.__)("Past Conversations","code-snippets"),onSelect:o})]}),(0,_.jsxs)("div",{className:"ai-agent-sidebar__panel",role:"tabpanel",id:"ai-agent-demo-panel-actions","aria-labelledby":"ai-agent-demo-tab-actions",hidden:"actions"!==r,children:[(0,_.jsxs)("div",{className:"ai-agent-examples",children:[(0,_.jsx)("h2",{className:"ai-agent-sidebar__heading",children:(0,a.__)("Prompt examples","code-snippets")}),Kn.map(function(e){return(0,_.jsx)("button",{type:"button",className:"ai-agent-examples__chip",disabled:!0,children:e},e)})]}),(0,_.jsx)(Rs,{})]}),(0,_.jsx)("div",{className:"ai-agent-sidebar__panel",role:"tabpanel",id:"ai-agent-demo-panel-history","aria-labelledby":"ai-agent-demo-tab-history",hidden:"history"!==r,children:(0,_.jsx)(Is,{stage:t})})]})},Ms=function(e){var t=e.speaker,n=e.children;return(0,_.jsxs)("div",{className:"ai-agent-message is-".concat(t),children:[(0,_.jsx)("span",{className:"ai-agent-message__role",children:"user"===t?(0,a.__)("You","code-snippets"):(0,a.__)("AI Agent","code-snippets")}),(0,_.jsx)("div",{className:"ai-agent-message__content",children:n})]})},Bs=function(e){var t=e.label;return(0,_.jsxs)("div",{className:"ai-agent-typing",children:[(0,_.jsxs)("span",{className:"ai-agent-typing__dots","aria-hidden":"true",children:[(0,_.jsx)("i",{}),(0,_.jsx)("i",{}),(0,_.jsx)("i",{})]}),(0,_.jsx)("span",{children:t})]})},Us=function(e){var t=e.label;return(0,_.jsxs)("div",{className:"ai-agent-demo-transit",children:[(0,_.jsx)("span",{className:"ai-agent-demo-transit__endpoint",children:(0,a.__)("Your site","code-snippets")}),(0,_.jsx)("span",{className:"ai-agent-demo-transit__track","aria-hidden":"true",children:(0,_.jsx)("span",{className:"ai-agent-demo-transit__pulse"})}),(0,_.jsx)("span",{className:"ai-agent-demo-transit__endpoint",children:(0,a.__)("Code Snippets Cloud","code-snippets")}),(0,_.jsx)("span",{className:"screen-reader-text",children:t})]})},qs=function(e){var t=e.title,n=e.children,r=e.onReplay;return(0,_.jsxs)("div",{className:"demo-upsell",children:[(0,_.jsx)("h2",{className:"demo-upsell__title",children:t}),n,(0,_.jsxs)("div",{className:"demo-upsell__actions",children:[(0,_.jsx)("a",{className:"button button-primary button-large",href:"https://codesnippets.pro/pricing/",target:"_blank",rel:"noopener noreferrer",children:(0,a.__)("Upgrade to Pro","code-snippets")}),(0,_.jsx)(In,{secondary:!0,type:"button",onClick:r,children:(0,a.__)("Run demo again","code-snippets")})]})]})},Vs=function(e){var t=e.onReplay;return(0,_.jsxs)(qs,{title:(0,a.__)("That was a demo — the real agent writes for you","code-snippets"),onReplay:t,children:[(0,_.jsx)("p",{children:(0,a.__)("The whole walkthrough was scripted and ran inside this plugin. No prompt or snippet left your site, and none were added to it.","code-snippets")}),(0,_.jsx)("p",{children:(0,a.__)("In Code Snippets Pro the AI Agent does all of this for whatever you ask it to build, and the snippets it writes are real — saved to your site inactive, until you have read them and switched them on.","code-snippets")})]})},Ws={"prompt-sent":1200,planning:3600,"plan-ready":3800,"plan-accepted":1200,building:3600,"result-ready":3e3,"refine-open":1500,applying:2800,saved:2600},Hs=function(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches};function zs(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function $s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?zs(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zs(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Gs={"plan-ready":{target:".ai-agent-plan",padding:6},"plan-accepted":{target:".ai-agent-plan",padding:6},"result-ready":{target:".ai-agent-result__rows",padding:8},applying:{target:".ai-agent-result__edit",padding:6}},Ks={"typing-prompt":(0,a.__)("Writing a prompt.","code-snippets"),"prompt-sent":(0,a.__)("Prompt sent.","code-snippets"),planning:(0,a.__)("Planning your snippets.","code-snippets"),"plan-ready":(0,a.__)("The plan is ready.","code-snippets"),"plan-accepted":(0,a.__)("Plan accepted.","code-snippets"),building:(0,a.__)("Building the code.","code-snippets"),"result-ready":(0,a.__)("Snippets created.","code-snippets"),"refine-open":(0,a.__)("Choosing snippets to refine.","code-snippets"),"typing-refinement":(0,a.__)("Writing a refinement.","code-snippets"),applying:(0,a.__)("Applying your changes.","code-snippets"),saved:(0,a.__)("Snippets updated and saved to your site.","code-snippets"),finished:(0,a.__)("Demo complete.","code-snippets")},Js=function(){var e=function(){var e=(0,i.useMemo)(Hs,[]),t=(0,i.useMemo)(Zn,[]),n=(0,i.useMemo)(function(){return function(e){return(0,a.sprintf)((0,a.__)("Make the banner say “Welcome to %s” and give it our brand colours.","code-snippets"),e)}(t)},[t]),r=s((0,i.useState)("idle"),2),o=r[0],c=r[1],l=s((0,i.useState)(""),2),u=l[0],d=l[1],p=s((0,i.useState)(""),2),f=p[0],h=p[1],m=s((0,i.useState)([]),2),b=m[0],g=m[1],v=(0,i.useRef)([]),y=(0,i.useCallback)(function(){v.current.forEach(window.clearTimeout),v.current=[]},[]);(0,i.useEffect)(function(){return function(){v.current.forEach(window.clearTimeout)}},[]);var _=(0,i.useCallback)(function(){y(),d(Jn),h(n),g(sr(t)),c("finished")},[y,n,t]),j=(0,i.useCallback)(function(e){c(e),"result-ready"===e&&g(rr()),"saved"===e&&g(sr(t))},[t]),w=(0,i.useCallback)(function(t,n,r){v.current.push(window.setTimeout(function(){return r(t)},e?250:n))},[e]),x=(0,i.useCallback)(function(t){var r;j(t);var s={"typing-prompt":"prompt-sent","prompt-sent":"planning",planning:"plan-ready","plan-ready":"plan-accepted","plan-accepted":"building",building:"result-ready","result-ready":"refine-open","refine-open":"typing-refinement","typing-refinement":"applying",applying:"saved",saved:"finished"}[t];if(s){var i=function(t){return 1600+(e?0:45*t.length)},o="typing-prompt"===t?i(Jn):"typing-refinement"===t?i(n):null!==(r=Ws[t])&&void 0!==r?r:1600;w(s,o,x)}},[j,e,n,w]),O=(0,i.useCallback)(function(){y(),d(""),h(""),g([]),c("idle")},[y]),S=(0,i.useCallback)(function(){O(),v.current.push(window.setTimeout(function(){return x("typing-prompt")},0))},[x,O]),P=(0,i.useCallback)(function(){O(),v.current.push(window.setTimeout(function(){return x("typing-prompt")},250))},[x,O]);return(0,i.useEffect)(function(){var t="typing-prompt"===o?{text:Jn,set:d}:"typing-refinement"===o?{text:n,set:h}:void 0;if(t){if(!e){var r=0,s=window.setInterval(function(){r+=1,t.set(t.text.slice(0,r)),r>=t.text.length&&window.clearInterval(s)},45);return function(){return window.clearInterval(s)}}t.set(t.text)}},[e,n,o]),{stage:o,typedPrompt:u,typedRefinement:f,snippets:b,hasStarted:"idle"!==o,isFinished:"finished"===o,reducedMotion:e,siteName:t,refinementPrompt:n,play:S,skip:_,replay:P}}(),t=e.stage,n=e.typedPrompt,r=e.typedRefinement,o=e.snippets,c=e.hasStarted,l=e.isFinished,u=e.reducedMotion,d=e.play,p=e.skip,f=e.replay,h=Un("ai-agent"),m=(0,i.useRef)(null);(0,i.useEffect)(function(){var e;l&&(h(),null===(e=m.current)||void 0===e||e.scrollIntoView({behavior:u?"auto":"smooth",block:"end"}))},[l,h,u]);var b=cr(t,"prompt-sent");return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(En,{}),(0,_.jsx)(Ln,{title:(0,a.__)("AI Agent","code-snippets"),description:(0,a.__)("A guided walkthrough of the Pro AI Agent. Press play and watch it plan, build, and refine a snippet on your site.","code-snippets"),hasStarted:c,isFinished:l,onPlay:d,onSkip:p,onReplay:f}),(0,_.jsxs)("section",{className:"ai-agent ai-agent-demo","aria-label":(0,a.__)("AI Agent demo","code-snippets"),children:[(0,_.jsx)("div",{className:"screen-reader-text","aria-live":"polite",children:Ks[t]}),(0,_.jsx)(Dn,{callout:Wn(t)}),(0,_.jsx)(Fn,$s({},Gs[t])),(0,_.jsxs)("div",{className:"ai-agent-layout",children:[(0,_.jsxs)("div",{className:"ai-agent-layout__main",children:[!b&&(0,_.jsxs)("div",{className:"ai-agent-empty",children:[(0,_.jsx)("p",{className:"ai-agent-empty__eyebrow",children:(0,a.__)("Start with these prompts","code-snippets")}),(0,_.jsx)("div",{className:"ai-agent-empty__chips",children:Kn.map(function(e){return(0,_.jsx)("button",{type:"button",className:"ai-agent-empty__chip",disabled:!0,children:e},e)})})]}),(0,_.jsxs)("div",{className:"ai-agent-thread",children:[cr(t,"prompt-sent")&&(0,_.jsx)(Ms,{speaker:"user",children:Jn}),"planning"===t&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(Us,{label:(0,a.__)("Sending your prompt to Code Snippets Cloud.","code-snippets")}),(0,_.jsx)(Bs,{label:(0,a.__)("Planning your snippets…","code-snippets")})]}),cr(t,"plan-ready")&&!cr(t,"building")&&(0,_.jsx)(lr,{accepted:"plan-accepted"===t}),"building"===t&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(Us,{label:(0,a.__)("Building the snippets in Code Snippets Cloud.","code-snippets")}),(0,_.jsx)(Bs,{label:(0,a.__)("Building the code…","code-snippets")})]}),cr(t,"result-ready")&&(0,_.jsx)(Ds,{stage:t,snippets:o,typedRefinement:r}),"applying"===t&&(0,_.jsx)(Bs,{label:(0,a.__)("Applying your changes…","code-snippets")}),cr(t,"saved")&&(0,_.jsx)(Ms,{speaker:"assistant",children:er})]}),(0,_.jsx)(ur,{value:cr(t,"planning")?"":n,typing:"typing-prompt"===t,pressed:"prompt-sent"===t,disabled:b,submitLabel:(0,a.__)("Send","code-snippets"),placeholder:(0,a.__)("Describe what you want to build…","code-snippets")})]}),(0,_.jsx)("div",{className:"ai-agent-layout__sidebar",children:(0,_.jsx)(Fs,{stage:t})})]}),l&&(0,_.jsx)("div",{ref:m,className:"ai-agent-demo__closing",role:"region","aria-label":(0,a.__)("AI Agent demo complete","code-snippets"),children:(0,_.jsx)(Vs,{onReplay:f})})]})]})};function Qs(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ys(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Qs(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Qs(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Xs=function(e){var t=e.field,n=e.id;switch(t.type){case"textarea":return(0,_.jsx)("textarea",{id:n,"aria-label":t.label,className:"widefat",rows:5,readOnly:!0,value:t.value});case"select":return(0,_.jsx)("select",{id:n,"aria-label":t.label,disabled:!0,value:t.value,children:(0,_.jsx)("option",{value:t.value,children:t.value})});default:return(0,_.jsx)("input",{type:"text",id:n,"aria-label":t.label,readOnly:!0,value:t.value})}},Zs=function(e){var t=e.field;return(0,_.jsxs)("div",{className:"blueprint-form-field",children:[(0,_.jsxs)("label",{htmlFor:t.name,children:[t.label," ",t.required&&(0,_.jsx)("span",{className:"required",children:"*"})]}),(0,_.jsx)(Xs,{field:t,id:t.name}),t.description&&(0,_.jsx)("p",{className:"description",children:t.description})]})},ei=function(e){var t=e.repeater;return(0,_.jsxs)("div",{className:"blueprint-form-field blueprint-form-repeater",children:[(0,_.jsx)("label",{htmlFor:"".concat(t.columns[0].name,"-0"),children:t.label}),(0,_.jsxs)("div",{className:"blueprint-form-repeater",children:[t.rows.map(function(e,n){return(0,_.jsxs)("div",{className:"blueprint-form-repeater__row",children:[t.columns.map(function(t,r){var s="".concat(t.name,"-").concat(n);return(0,_.jsxs)("div",{className:"blueprint-form-field blueprint-form-repeater__cell",children:[(0,_.jsx)("label",{htmlFor:s,children:t.label}),(0,_.jsx)(Xs,{field:Ys(Ys({},t),{},{value:e.values[r]}),id:s}),t.description&&(0,_.jsx)("p",{className:"description",children:t.description})]},t.name)}),(0,_.jsx)("div",{className:"blueprint-form-repeater__actions",children:(0,_.jsx)("button",{type:"button",className:"button button-secondary button-small",disabled:!0,children:(0,a.__)("Remove","code-snippets")})})]},e.id)}),(0,_.jsx)("button",{type:"button",className:"button button-secondary blueprint-form-repeater__add",disabled:!0,children:t.addLabel})]})]})},ti=function(e){var t=e.section,n=e.isFading;return(0,_.jsxs)("div",{className:y()("blueprint-form-content",{"is-fading":n}),children:[(0,_.jsx)("h3",{children:t.title}),t.description&&(0,_.jsx)("p",{className:"blueprint-form-section-description",children:t.description}),(0,_.jsxs)("div",{className:"blueprint-form-fields",children:[t.fields.map(function(e){return(0,_.jsx)(Zs,{field:e},e.name)}),t.repeater&&(0,_.jsx)(ei,{repeater:t.repeater})]})]})},ni=(0,a.__)("Create a Shortcode","code-snippets"),ri=(0,a.__)("Create a custom shortcode to display dynamic content using a simple tag.","code-snippets"),si=[{id:"general",title:(0,a.__)("General","code-snippets"),fields:[{name:"functionName",label:(0,a.__)("Function Name","code-snippets"),type:"text",value:"render_staff_profile",required:!0,description:(0,a.__)("The callback function name for your shortcode.","code-snippets")},{name:"shortcodeTag",label:(0,a.__)("Shortcode Tag","code-snippets"),type:"text",value:"staff_profile",required:!0,description:(0,a.__)("The shortcode tag used in content (e.g., [my_shortcode]). Lowercase, no spaces.","code-snippets")},{name:"shortcodeDescription",label:(0,a.__)("Description","code-snippets"),type:"text",value:(0,a.__)("Displays a staff member card with a name and role.","code-snippets"),description:(0,a.__)("Optional description for documentation purposes.","code-snippets")},{name:"textDomain",label:(0,a.__)("Text Domain","code-snippets"),type:"text",value:"code-snippets-blueprints",description:(0,a.__)("Translation text domain. Optional.","code-snippets")},{name:"isEnclosing",label:(0,a.__)("Enclosing Shortcode","code-snippets"),type:"select",value:(0,a.__)("No (self-closing)","code-snippets"),required:!0,description:(0,a.__)("Enclosing shortcodes wrap content: [shortcode]content[/shortcode]","code-snippets")},{name:"supportsNestedShortcodes",label:(0,a.__)("Support Nested Shortcodes","code-snippets"),type:"select",value:(0,a.__)("No","code-snippets"),required:!0,description:(0,a.__)("Process shortcodes within the content using do_shortcode().","code-snippets")}]},{id:"attributes",title:(0,a.__)("Attributes","code-snippets"),description:(0,a.__)("Add shortcode attributes (name and default value). Use $atts in your output code to read them.","code-snippets"),fields:[],repeater:{label:(0,a.__)("Shortcode attributes","code-snippets"),addLabel:(0,a.__)("Add attribute","code-snippets"),columns:[{name:"name",label:(0,a.__)("Attribute name","code-snippets"),type:"text",value:""},{name:"default",label:(0,a.__)("Default value","code-snippets"),type:"text",value:""},{name:"type",label:(0,a.__)("Attribute type","code-snippets"),type:"select",value:""}],rows:[{id:"name",values:["name","Jane Doe",(0,a.__)("Text","code-snippets")]},{id:"role",values:["role","Director",(0,a.__)("Text","code-snippets")]}]}},{id:"output",title:(0,a.__)("Output","code-snippets"),fields:[{name:"useOutputBuffering",label:(0,a.__)("Use Output Buffering","code-snippets"),type:"select",value:(0,a.__)("No (use return statement)","code-snippets"),required:!0,description:(0,a.__)("Enable output buffering to capture echoed content instead of returning.","code-snippets")},{name:"shortcodeCode",label:(0,a.__)("Shortcode Code","code-snippets"),type:"textarea",value:"// Build the card markup from the shortcode attributes.\nreturn sprintf(\n\t'<div class=\"staff-profile\"><h3>%s</h3><p>%s</p></div>',\n\tesc_html( $atts['name'] ),\n\tesc_html( $atts['role'] )\n);",required:!0,description:(0,a.__)("The PHP code that generates the shortcode output. Use $atts for attributes and $content for enclosed content.","code-snippets")}]}],ii=function(e){var t=e.activeSection,n=e.browsable,r=e.generating,s=e.onSelect;return(0,_.jsxs)("nav",{className:"blueprint-form-sidebar","aria-label":(0,a.__)("Blueprint sections","code-snippets"),children:[(0,_.jsx)("ul",{children:si.map(function(e){var r=e.id===t;return(0,_.jsx)("li",{children:(0,_.jsx)("button",{type:"button",className:y()("blueprint-form-sidebar__item",{"is-active":r}),"aria-current":r?"step":void 0,disabled:!n,onClick:function(){return s(e.id)},children:(0,_.jsx)("span",{children:e.title})})},e.id)})}),(0,_.jsx)("div",{className:"blueprint-form-sidebar__generate-wrap",children:(0,_.jsx)("button",{type:"button",className:y()("blueprint-form-sidebar__generate",{"demo-click":r}),"aria-hidden":"true",tabIndex:-1,children:(0,a.__)("Generate Code","code-snippets")})})]})},oi=o().forwardRef(function(e,t){return(0,_.jsxs)("div",{className:"blueprints-demo-generated",ref:t,role:"status",children:[(0,_.jsx)(zn,{name:"php"}),(0,_.jsx)("p",{className:"blueprints-demo-generated__text",children:(0,a.sprintf)((0,a.__)("Snippet “%s” has been generated.","code-snippets"),ni)})]})});oi.displayName="GeneratedNotice";var ai={general:{step:(0,a.__)("Step 1 of 3","code-snippets"),title:(0,a.__)("Name the shortcode","code-snippets"),body:(0,a.__)("Every blueprint starts with the basics — the tag you type into a post, and the function that powers it.","code-snippets")},attributes:{step:(0,a.__)("Step 2 of 3","code-snippets"),title:(0,a.__)("Add the attributes","code-snippets"),body:(0,a.__)('Attributes become the values you pass in, like [staff_profile name="Jane Doe"], each with a fallback default.',"code-snippets")},output:{step:(0,a.__)("Step 3 of 3","code-snippets"),title:(0,a.__)("Decide what it renders","code-snippets"),body:(0,a.__)("This is the PHP that runs whenever the shortcode appears. The blueprint wraps it in everything else it needs.","code-snippets")},generating:{step:(0,a.__)("Generating","code-snippets"),title:(0,a.__)("Building the snippet","code-snippets"),body:(0,a.__)("Pro turns the whole form into a finished, working snippet — no boilerplate to write yourself.","code-snippets")},generated:{step:(0,a.__)("Done","code-snippets"),title:(0,a.__)("Your snippet is ready","code-snippets"),body:(0,a.__)("In Pro the finished PHP appears here, ready to review and save to your site.","code-snippets")}},ci=function(e){return ai[e]},li={general:4500,attributes:4500,output:4800,generating:3600,generated:3e3},ui={general:"attributes",attributes:"output",output:"generating",generating:"generated",generated:"finished"},di=function(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches},pi=["idle","general","attributes","output","generating","generated","finished"];function fi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function hi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fi(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fi(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var mi={generating:{target:".blueprint-form-sidebar__generate",padding:8},generated:{target:".blueprints-demo-generated",padding:6}},bi={general:(0,a.__)("Filling in the general settings.","code-snippets"),attributes:(0,a.__)("Adding the shortcode attributes.","code-snippets"),output:(0,a.__)("Setting the shortcode output.","code-snippets"),generating:(0,a.__)("Generating the code.","code-snippets"),generated:(0,a.__)("The snippet has been generated.","code-snippets"),finished:(0,a.__)("Demo complete.","code-snippets")},gi=function(){return(0,_.jsx)("header",{className:"blueprint-detail__header",children:(0,_.jsx)("div",{className:"blueprint-detail__header-content",children:(0,_.jsxs)("div",{children:[(0,_.jsx)("h2",{children:ni}),(0,_.jsx)("p",{children:ri})]})})})},vi=function(){var e,t,n,r=function(){var e=(0,i.useMemo)(di,[]),t=s((0,i.useState)("idle"),2),n=t[0],r=t[1],o=s((0,i.useState)(si[0].id),2),a=o[0],c=o[1],l=s((0,i.useState)(!1),2),u=l[0],d=l[1],p=(0,i.useRef)([]),f=(0,i.useCallback)(function(){p.current.forEach(window.clearTimeout),p.current=[]},[]);(0,i.useEffect)(function(){return function(){p.current.forEach(window.clearTimeout)}},[]);var h=(0,i.useCallback)(function(t){c(function(n){return n===t||(d(!0),p.current.push(window.setTimeout(function(){c(t),d(!1)},e?0:220))),n})},[e]),m=(0,i.useCallback)(function(t){var n;r(t),si.some(function(e){return e.id===t})&&h(t);var s=ui[t];if(s){var i=e?250:null!==(n=li[t])&&void 0!==n?n:3e3;p.current.push(window.setTimeout(function(){return m(s)},i))}},[h,e]),b=(0,i.useCallback)(function(){f(),m("general")},[m,f]),g=(0,i.useCallback)(function(){f(),r("idle"),d(!1),c(si[0].id),p.current.push(window.setTimeout(function(){return m("general")},250))},[m,f]),v=(0,i.useCallback)(function(){f(),r("finished"),d(!1),c(si[si.length-1].id)},[f]);return{stage:n,activeSection:a,isFading:u,sectionsBrowsable:"finished"===n,hasStarted:"idle"!==n,isFinished:"finished"===n,reducedMotion:e,selectSection:h,play:b,skip:v,replay:g}}(),o=r.stage,c=r.activeSection,l=r.isFading,u=r.sectionsBrowsable,d=r.hasStarted,p=r.isFinished,f=r.reducedMotion,h=r.selectSection,m=r.play,b=r.skip,g=r.replay,v=(0,i.useRef)(null),y=(n=o,pi.indexOf(n)>=pi.indexOf("generated")),j=Un("blueprints");return(0,i.useEffect)(function(){p&&j()},[p,j]),(0,i.useEffect)(function(){var e,t=f?"auto":"smooth";"generated"===o&&(null===(e=v.current)||void 0===e||e.scrollIntoView({behavior:t,block:"center"})),"finished"===o&&window.scrollTo({top:document.body.scrollHeight,behavior:t})},[f,o]),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(En,{}),(0,_.jsx)(Ln,{title:(0,a.__)("Blueprints","code-snippets"),description:(0,a.__)("A guided walkthrough of Pro Blueprints. Press play and watch a shortcode blueprint fill itself in and generate a snippet.","code-snippets"),hasStarted:d,isFinished:p,onPlay:m,onSkip:b,onReplay:g}),(0,_.jsxs)("div",{className:"blueprints-demo",children:[(0,_.jsx)("div",{className:"screen-reader-text","aria-live":"polite",children:bi[o]}),(0,_.jsx)(Dn,{callout:ci(o)}),(0,_.jsx)(Fn,hi({},mi[o])),(0,_.jsxs)("div",{className:"blueprint-detail",children:[(0,_.jsx)(gi,{}),(0,_.jsxs)("div",{className:"blueprint-form-layout",children:[(0,_.jsx)(ii,{activeSection:c,browsable:u,generating:"generating"===o,onSelect:h}),(0,_.jsx)(ti,{section:(e=c,null!==(t=si.find(function(t){return t.id===e}))&&void 0!==t?t:si[0]),isFading:l})]})]}),y&&(0,_.jsx)(oi,{ref:v}),p&&(0,_.jsxs)(qs,{title:(0,a.__)("That was a demo — Blueprints build the code for you","code-snippets"),onReplay:g,children:[(0,_.jsx)("p",{children:(0,a.__)("The whole walkthrough was scripted and ran inside this plugin. No code was generated and nothing was saved.","code-snippets")}),(0,_.jsx)("p",{children:(0,a.__)("Code Snippets Pro ships blueprints for shortcodes, post types, taxonomies, settings pages, and more — fill in the form and it writes the snippet for you.","code-snippets")})]})]})]})};function yi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?yi(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yi(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var ji=function(e){var t,n=e.column,r=e.cellProps,s=e.sortColumn,i=e.sortDirection,o=e.setSortColumn,c=e.setSortDirection,l=n.id===(null==s?void 0:s.id),u=l?"asc"===i?"desc":"asc":null!==(t=n.defaultSortDirection)&&void 0!==t?t:"asc",d=l?i:"asc"===u?"desc":"asc",p=l?"asc"===i?"ascending":"descending":void 0;return(0,_.jsx)("th",_i(_i({},r),{},{"aria-sort":p,className:y()(r.className,l?"sorted":"sortable",d),children:(0,_.jsxs)("button",{type:"button",className:"list-table-sort-button",onClick:function(){o(n),c(u)},children:[(0,_.jsx)("span",{className:"sortable-column-title",children:n.title}),(0,_.jsxs)("span",{className:"sorting-indicators",children:[(0,_.jsx)("span",{className:"sorting-indicator asc","aria-hidden":"true"}),(0,_.jsx)("span",{className:"sorting-indicator desc","aria-hidden":"true"})]}),l?null:(0,_.jsx)("span",{className:"screen-reader-text",children:"asc"===u?(0,a.__)("Sort ascending.","code-snippets"):(0,a.__)("Sort descending.","code-snippets")})]})}))},wi=function(e){var t=e.items,n=e.which,r=e.getKey,s=e.columns,i=e.sortColumn,o=e.selected,c=e.setSelected,l=e.setSortColumn,u=e.sortDirection,d=e.setSortDirection;return(0,_.jsxs)("tr",{children:[(0,_.jsx)("td",{className:"column-cb check-column",children:(0,_.jsx)("input",{id:"cb-select-all-".concat(n),type:"checkbox",name:"checked[]",checked:0<t.length&&t.every(function(e){return o.has(r(e))}),"aria-label":(0,a.__)("Select All","code-snippets"),onChange:function(e){c(new Set(e.target.checked?t.map(r):[]))}})}),s.map(function(e){var t={id:"head"===n?e.id.toString():void 0,scope:"col",className:y()("manage-column","column-".concat(e.id),"".concat(e.id,"-column"),{hidden:e.isHidden,"column-primary":e.isPrimary})};return e.sortedValue?(0,_.jsx)(ji,{column:e,cellProps:t,sortColumn:i,sortDirection:u,setSortColumn:l,setSortDirection:d},e.id):(0,_.jsx)("th",_i(_i({},t),{},{children:e.title}),e.id)})]})},xi=function(e){var t=e.item,n=e.selected,r=e.setSelected,s=e.getKey;return(0,_.jsx)("th",{scope:"row",className:"check-column",children:(0,_.jsx)("input",{id:"cb-select-".concat(s(t)),type:"checkbox",name:"checked[]","aria-label":(0,a.__)("Select snippet","code-snippets"),checked:n.has(s(t)),onChange:function(e){r(function(n){var r=new Set(n);return e.target.checked?r.add(s(t)):r.delete(s(t)),r})}})})},Oi=function(e){var t=e.item,n=e.column,r=y()("".concat(n.id,"-column"),"column-".concat(n.id),{hidden:n.isHidden});return n.isHeading?(0,_.jsx)("th",{className:r,children:n.render(t)}):(0,_.jsx)("td",{className:r,children:n.render(t)})},Si=function(e){var t=e.items,n=e.getKey,r=e.columns,s=e.noItems,i=e.selected,o=e.setSelected,a=e.rowClassName;return 0<t.length?t.map(function(e){return(0,_.jsxs)("tr",{className:null==a?void 0:a(e),children:[(0,_.jsx)(xi,{item:e,selected:i,setSelected:o,getKey:n}),r.map(function(t){return(0,_.jsx)(Oi,{item:e,column:t},t.id)})]},n(e))}):(0,_.jsx)("tr",{className:"no-items",children:(0,_.jsx)("td",{className:"colspanchange",colSpan:r.length,children:s})})},Pi=["id","text","name","primary","secondary","small","large","wrap","className"];function Ni(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}var ki=function(e){var t=e.id,n=e.text,r=e.name,s=void 0===r?"submit":r,i=e.primary,o=e.secondary,c=e.small,l=e.large,u=e.wrap,d=e.className,p=g(e,Pi),f=(0,_.jsx)("input",function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ni(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ni(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({id:null!=t?t:s,type:"submit",name:s,value:null!=n?n:(0,a.__)("Save Changes","code-snippets"),className:y()("button",{"button-primary":i,"button-secondary":o,"button-small":c,"button-large":l},d)},p));return u?(0,_.jsx)("p",{className:"submit",children:f}):f},Ci=["currentPage"],Ei=["currentPage","totalPages"],Di=["which","totalPages","currentPage"];function Ti(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ai(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ti(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ti(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Ri=function(e){var t=e.icon,n=e.newPage,r=e.disabled,s=e.className,i=e.helperText,o=e.setCurrentPage,a=e.pageSearchParam;return a?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("a",{className:"".concat(s," button"),href:m(window.location.href,b({},a,1===n?void 0:n)),onClick:function(e){e.preventDefault(),o(n)},children:[(0,_.jsx)("span",{className:"screen-reader-text",children:i}),(0,_.jsx)("span",{"aria-hidden":!0,children:t})]}),"\n"]}):(0,_.jsxs)(In,{className:s,onClick:function(){return o(n)},disabled:r,children:[(0,_.jsx)("span",{className:"screen-reader-text",children:i}),(0,_.jsx)("span",{"aria-hidden":!0,children:t})]})},Ii=function(e){var t=e.currentPage,n=g(e,Ci);return 1===t?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("span",{className:"tablenav-pages-navspan button disabled","aria-hidden":"true",children:"«"}),"\n",(0,_.jsx)("span",{className:"tablenav-pages-navspan button disabled","aria-hidden":"true",children:"‹"}),"\n"]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(Ri,Ai({icon:(0,_.jsx)(_.Fragment,{children:"«"}),newPage:1,className:"first-page",helperText:(0,a.__)("First page","code-snippets")},n)),"\n",(0,_.jsx)(Ri,Ai({icon:(0,_.jsx)(_.Fragment,{children:"‹"}),newPage:Math.max(1,t-1),className:"prev-page",helperText:(0,a.__)("Previous page","code-snippets")},n)),"\n"]})},Li=function(e){var t=e.currentPage,n=e.totalPages,r=g(e,Ei);return n===t?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("span",{className:"tablenav-pages-navspan button disabled","aria-hidden":"true",children:"›"}),"\n",(0,_.jsx)("span",{className:"tablenav-pages-navspan button disabled","aria-hidden":"true",children:"»"})]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(Ri,Ai({icon:(0,_.jsx)(_.Fragment,{children:"›"}),newPage:Math.min(n,t+1),className:"next-page",helperText:(0,a.__)("Next page","code-snippets")},r)),"\n",(0,_.jsx)(Ri,Ai({icon:(0,_.jsx)(_.Fragment,{children:"»"}),newPage:n,className:"last-page",helperText:(0,a.__)("Last page","code-snippets")},r)),"\n"]})},Fi=function(e){var t=e.which,n=e.disabled,r=e.inputName,s=e.inputValue,i=e.totalPages,o=e.setInputValue,c=e.confirmInputValue;return(0,_.jsx)("input",{className:"current-page",id:"current-page-selector-".concat(t),"aria-label":(0,a.__)("Current Page","code-snippets"),type:"text",name:r,value:s,size:i.toString().length,disabled:n,"aria-describedby":"table-paging-".concat(t),onBlur:c,onChange:function(e){var t=Number(e.target.value);t&&o(t)}})},Mi=function(e){var t=e.which,n=e.totalPages,r=e.currentPage,s=g(e,Di);return"bottom"===t?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("span",{className:"screen-reader-text",children:(0,a.__)("Current Page","code-snippets")}),(0,_.jsx)("span",{className:"paging-input",children:(0,_.jsx)("span",{className:"tablenav-paging-text",children:(0,a.sprintf)((0,a._x)("%1$s of %2$s","paging","code-snippets"),r,n)})})]}):(0,_.jsxs)("span",{className:"paging-input",id:"table-paging-".concat(t),children:[(0,_.jsx)(Fi,Ai({which:t,totalPages:n},s)),(0,_.jsxs)("span",{className:"tablenav-paging-text",children:[" ".concat((0,a.__)("of","code-snippets")," "),(0,_.jsx)("span",{className:"total-pages",children:n})]})]})},Bi=function(e){var t=e.which,n=e.disabled,r=e.totalPages,s=e.inputValue,i=e.currentPage,o=e.setCurrentPage,a=e.setInputValue,c=e.pageSearchParam;return(0,_.jsxs)("span",{className:"pagination-links",children:[(0,_.jsx)(Ii,{disabled:n,currentPage:i,setCurrentPage:o,pageSearchParam:c}),(0,_.jsx)(Mi,{which:t,disabled:n,totalPages:r,currentPage:i,inputName:c,inputValue:s,setInputValue:a,confirmInputValue:function(){return o(s)}}),"\n",(0,_.jsx)(Li,{disabled:n,totalPages:r,currentPage:i,setCurrentPage:o,pageSearchParam:c})]})},Ui=function(e){var t=e.which,n=e.disabled,r=e.totalPages,s=e.totalItems,i=e.inputValue,o=e.currentPage,c=e.pageSearchParam,l=e.setCurrentPage,u=e.setInputValue,d="top"===t?(0,a.__)("Pagination, before the table","code-snippets"):(0,a.__)("Pagination, after the table","code-snippets");return(0,_.jsx)("nav",{className:"tablenav-pages-nav","aria-label":d,children:(0,_.jsxs)("form",{className:y()("tablenav-pages",{"one-page":r&&1===r,"no-pages":!r}),onSubmit:function(e){e.preventDefault(),l(i)},children:[(0,_.jsx)("span",{className:"displaying-num",children:(0,a.sprintf)((0,a._n)("%s item","%s items",s,"code-snippets"),s)}),"\n",(0,_.jsx)(Bi,{which:t,disabled:n,totalPages:r,inputValue:i,currentPage:o,pageSearchParam:c,setCurrentPage:l,setInputValue:u})]})})},qi=function(e){var t=e.which,n=e.disabled,r=e.totalItems,o=e.totalPages,a=e.currentPage,c=e.setCurrentPage,l=e.pageSearchParam,u=s((0,i.useState)(a),2),d=u[0],p=u[1];return(0,_.jsx)(Ui,{which:t,inputValue:d,currentPage:a,totalItems:r,totalPages:o,disabled:n,setInputValue:p,setCurrentPage:function(e){if(e){var t=Math.max(1,Math.min(e,o));p(t),c(t),l&&f(b({},l,1===t?void 0:t))}}})},Vi=["which","actions","doAction","selected","setSelected","totalItems","totalPages","extraTableNav","endTableNav","selectAllKeys"],Wi=["children"];function Hi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Hi(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Hi(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function $i(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}var Gi=function(e){var t=e.actions,n=s((0,i.useMemo)(function(){var e,n=[],r=new Map,s=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return $i(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$i(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,s=function(){};return{s,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:s}}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 i,o=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){a=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(a)throw i}}}}(t);try{for(s.s();!(e=s.n()).done;){var i,o=e.value;void 0===o.group?n.push(o):r.set(o.group,[].concat(D(null!==(i=r.get(o.group))&&void 0!==i?i:[]),[o]))}}catch(e){s.e(e)}finally{s.f()}return[n,Array.from(r.entries())]},[t]),2),r=n[0],o=n[1];return(0,_.jsxs)(_.Fragment,{children:[r.map(function(e){return(0,_.jsx)("option",{value:e.key,children:e.label},e.key)}),o.map(function(e){var t=s(e,2),n=t[0],r=t[1];return(0,_.jsx)("optgroup",{label:n,children:r.map(function(e){return(0,_.jsx)("option",{value:e.label,children:e.label},e.label)})},n)})]})},Ki=function(e){var t=e.which,n=e.actions,r=e.selectedAction,s=e.setSelectedAction,i=e.label;return(0,_.jsxs)("select",{name:"action".concat("bottom"===t?"-2":""),id:"bulk-action-selector-".concat(t),value:r,onChange:function(e){var t=e.target.value;t&&"-1"!==t?function(e,t){return t.some(function(t){return t.key===e})}(t,n)&&s(t):s(void 0)},children:[(0,_.jsx)("option",{value:"-1",children:i}),(0,_.jsx)(Gi,{actions:n})]})},Ji=function(e){var t=e.which,n=e.actions,r=e.selected,o=e.doAction,c=e.onActionSuccess,l=e.disabled,u=e.selectLabel,d=s((0,i.useState)(),2),p=d[0],f=d[1],h=s((0,i.useState)(!1),2),m=h[0],b=h[1];return(0,_.jsxs)("div",{className:"alignleft actions bulkactions",children:[(0,_.jsx)("label",{htmlFor:"bulk-action-selector-".concat(t),className:"screen-reader-text",children:(0,a.__)("Select bulk action","code-snippets")}),(0,_.jsx)(Ki,{which:t,actions:n,selectedAction:p,setSelectedAction:f,label:null!=u?u:(0,a.__)("Bulk actions","code-snippets")}),(0,_.jsx)(ki,{id:"doaction".concat("bottom"===t?"-2":""),name:"bulk_action",text:(0,a.__)("Apply","code-snippets"),className:"action",disabled:!!l||m||!p||0===r.size,onClick:function(e){e.preventDefault(),p&&(b(!0),o(p,r).then(function(){null==c||c()}).catch(Mn).finally(function(){return b(!1)}))}}),m?(0,_.jsx)(dr.Spinner,{}):null]})},Qi=function(e){var t=e.keys,n=e.selected,r=e.setSelected;return(0,_.jsxs)("label",{className:"tablenav-select-all",children:[(0,_.jsx)("input",{type:"checkbox",checked:0<t.length&&t.every(function(e){return n.has(e)}),disabled:0===t.length,"aria-label":(0,a.__)("Select all items","code-snippets"),onChange:function(e){var n=e.target.checked;r(function(e){var r=new Set(e);return t.forEach(function(e){return n?r.add(e):r.delete(e)}),r})}}),(0,a.__)("Select all","code-snippets")]})},Yi=function(e){var t=e.which,n=e.actions,r=e.doAction,s=e.selected,i=e.setSelected,o=e.totalItems,a=e.totalPages,c=void 0===a?0:a,l=e.extraTableNav,u=e.endTableNav,d=e.selectAllKeys,p=g(e,Vi),f="top"===t,h=0<o&&Boolean(n);return f&&Boolean(null!=l?l:u)||h||0<c?(0,_.jsxs)("div",{className:"tablenav ".concat(t),children:[0<o&&n&&r&&(0,_.jsx)(Ji,{which:t,actions:n,doAction:r,disabled:p.disabled,selected:s,onActionSuccess:function(){return i(new Set)}}),f&&d?(0,_.jsx)(Qi,{keys:d,selected:s,setSelected:i}):null,f?null==l?void 0:l(t):null,0<c||f&&u?(0,_.jsxs)("div",{className:"tablenav-end-group",children:[0<c&&(0,_.jsx)(qi,zi({},zi({totalPages:c,totalItems:o,which:t},p))),f?null==u?void 0:u(t):null]}):null,(0,_.jsx)("br",{className:"clear"})]}):null},Xi=function(e){var t=e.children,n=g(e,Wi);return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(Yi,zi({which:"top"},n)),t,(0,_.jsx)(Yi,zi({which:"bottom"},n))]})},Zi=["fixed","striped","children","className"],eo=["items","getKey","totalPages","pageSearchParam","initialSort"],to=["getKey","actions","columns","noItems","doAction","disabled","totalItems","totalPages","currentPage","beforeTable","endTableNav","rowClassName","visibleItems","sortDirection","extraTableNav","selectAllControl","setCurrentPage","pageSearchParam"];function no(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ro(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?no(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):no(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var so=function(e,t,n){return new Set(e.map(t).filter(function(e){return n.has(e)}))},io=function(e){var t=e.fixed,n=e.striped,r=e.children,s=e.className,i=g(e,Zi);return(0,_.jsxs)("table",{className:y()("wp-list-table widefat",{striped:n,fixed:t},s),children:[(0,_.jsx)("thead",{children:(0,_.jsx)(wi,ro({which:"head"},i))}),(0,_.jsx)("tbody",{children:r}),(0,_.jsx)("tfoot",{children:(0,_.jsx)(wi,ro({which:"foot"},i))})]})},oo=function(e){var t=e.items,n=e.getKey,r=e.totalPages,o=e.pageSearchParam,a=void 0===o?"paged":o,c=e.initialSort,l=g(e,eo),u=s((0,i.useState)(function(){return c?l.columns.find(function(e){return e.id===c.columnId&&e.sortedValue}):void 0}),2),p=u[0],f=u[1],h=s((0,i.useState)(function(){return a&&Number(d(a))||1}),2),m=h[0],b=h[1],v=s((0,i.useState)(function(){var e;return null!==(e=null==c?void 0:c.direction)&&void 0!==e?e:"asc"}),2),y=v[0],j=v[1],w=(0,i.useMemo)(function(){return function(e,t){var n=t.currentPage,r=t.totalPages;if(r){var s=Math.ceil(e.length/r),i=(n-1)*s,o=i+s;return e.slice(i,o)}return e}(function(e,t,n){return e.toSorted(function(e,r){var s,i,o=null==t||null===(s=t.sortedValue)||void 0===s?void 0:s.call(t,e),a=null==t||null===(i=t.sortedValue)||void 0===i?void 0:i.call(t,r);return void 0===o||void 0===a?0:o<a?"asc"===n?-1:1:o>a?"asc"===n?1:-1:0})}(t,p,y),{currentPage:m,totalPages:r})},[t,p,y,m,r]);return(0,_.jsx)(ao,ro({getKey:n,totalItems:t.length,totalPages:r,visibleItems:w,pageSearchParam:a,sortColumn:p,sortDirection:y,currentPage:m,setSortColumn:f,setSortDirection:j,setCurrentPage:b},l))},ao=function(e){var t=e.getKey,n=e.actions,r=e.columns,o=e.noItems,a=e.doAction,c=e.disabled,l=void 0!==c&&c,u=e.totalItems,d=e.totalPages,p=e.currentPage,f=e.beforeTable,h=e.endTableNav,m=e.rowClassName,b=e.visibleItems,v=e.sortDirection,y=void 0===v?"asc":v,j=e.extraTableNav,w=e.selectAllControl,x=e.setCurrentPage,O=e.pageSearchParam,S=g(e,to),P=s((0,i.useState)(function(){return new Set}),2),N=P[0],k=P[1];return(0,_.jsxs)(Xi,{totalItems:u,selected:so(b,t,N),selectAllKeys:w?b.map(t):void 0,actions:n,doAction:a,extraTableNav:j,endTableNav:h,disabled:l,currentPage:p,totalPages:d,pageSearchParam:O,setSelected:k,setCurrentPage:x,children:[f,(0,_.jsx)(io,ro(ro({items:b},S),{},{getKey:t,columns:r,selected:N,setSelected:k,sortDirection:y,children:(0,_.jsx)(Si,{items:b,getKey:t,columns:r,noItems:o,rowClassName:m,selected:N,setSelected:k})}))]})};const co=window.wp.date;var lo=function(e){return e[e.Private=3]="Private",e[e.Public=4]="Public",e[e.Unverified=5]="Unverified",e[e.AI_Verified=6]="AI_Verified",e[e.Pro_Verified=8]="Pro_Verified",e}({}),uo=function(e){switch(e){case lo.Public:return(0,a.__)("Public","code-snippets");case lo.Private:return(0,a.__)("Private","code-snippets");case lo.Unverified:return(0,a.__)("Unverified","code-snippets");case lo.AI_Verified:return(0,a.__)("AI Verified","code-snippets");case lo.Pro_Verified:return(0,a.__)("Pro Verified","code-snippets");default:return(0,a.__)("Unknown","code-snippets")}},po=b(b(b(b(b({},lo.Public,"public"),lo.Private,"private"),lo.Unverified,"failure"),lo.AI_Verified,"info"),lo.Pro_Verified,"success"),fo=function(e){var t;return null===(t=lo[e])||void 0===t?void 0:t.toLowerCase().replace("_","-")},ho=function(e){var t,n=e.status;return(0,_.jsx)("span",{className:"cloud-snippet-status cloud-snippet-status-".concat(null!==(t=fo(n))&&void 0!==t?t:"unknown"),children:uo(n)})},mo=function(e){var t,n=e.status;return(0,_.jsx)("span",{className:"badge ".concat(null!==(t=po[n])&&void 0!==t?t:"neutral","-badge"),children:uo(n)})};function bo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function go(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?bo(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bo(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var vo=function(e){return(0,_.jsx)("svg",go(go({width:"19",height:"19",viewBox:"0 0 19 19",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{},{children:(0,_.jsx)("path",{d:"M5.09053 13.7643C3.12371 13.7643 1.5293 12.2296 1.5293 10.3362C1.5293 8.44351 3.12371 6.90874 5.09053 6.90874C5.39106 5.56133 6.46242 4.46168 7.90083 4.02351C9.33848 3.58609 10.926 3.87592 12.0639 4.78821C13.2018 5.69821 13.7172 7.08768 13.4174 8.4351H14.1745C15.6374 8.4351 16.8234 9.62804 16.8234 11.1009C16.8234 12.5745 15.6374 13.7674 14.1737 13.7674H5.09053",stroke:"#6A8083",strokeWidth:"1.41177",strokeLinecap:"round",strokeLinejoin:"round"})}))};function yo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?yo(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yo(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var jo=function(e){return(0,_.jsx)("svg",_o(_o({width:"19",height:"19",viewBox:"0 0 19 19",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{},{children:(0,_.jsx)("path",{d:"M8.41165 13.7674H5.09053C3.12371 13.7643 1.5293 12.2296 1.5293 10.3362C1.5293 8.44351 3.12371 6.90874 5.09053 6.90874C5.39106 5.56133 6.46242 4.46168 7.90083 4.02351C9.33848 3.58609 10.926 3.87592 12.0639 4.78821C13.2018 5.69821 13.7172 7.08768 13.4174 8.4351H14.1745C15.2359 8.4351 16.1512 9.06216 16.5741 9.96986M11.4705 14.529L12.9999 16.0585L16.0587 12.9996",stroke:"#0BAEC3",strokeWidth:"1.41177",strokeLinecap:"round",strokeLinejoin:"round"})}))};function wo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}var xo=4821,Oo=(0,a.__)("My Code Vault","code-snippets"),So=function(e){return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?wo(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):wo(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({id:0,slug:"",name:"",description:"",code:"",tags:[],scope:"global",codevault:Oo,total_votes:0,vote_count:0,wp_tested:"6.8",status:lo.Private,created:"2026-05-04T09:12:00Z",updated:"2026-07-22T14:38:00Z",revision:1,is_owner:!0,local_id:null,update_available:!1},e)},Po=function(){return[So({id:xo,slug:"sender-name-and-address",name:(0,a.__)("Fix outgoing email sender name","code-snippets"),description:(0,a.__)("Sends site email from the site name and a no-reply address on your own domain, instead of “WordPress”.","code-snippets"),code:"add_filter( 'wp_mail_from_name', function () {\n\treturn get_bloginfo( 'name' );\n} );\n\nadd_filter( 'wp_mail_from', function ( $from ) {\n\t$domain = wp_parse_url( home_url(), PHP_URL_HOST );\n\n\treturn $domain ? 'no-reply@' . str_ireplace( 'www.', '', $domain ) : $from;\n} );",tags:["email","admin"],scope:"global",status:lo.Pro_Verified,updated:"2026-08-11T10:04:00Z"}),So({id:4788,slug:"disable-comments-everywhere",name:(0,a.__)("Disable comments everywhere","code-snippets"),description:(0,a.__)("Closes comments on every post type and hides the comment menus from the admin.","code-snippets"),code:"add_filter( 'comments_open', '__return_false', 20, 2 );",tags:["comments","cleanup"],scope:"global",status:lo.Private,updated:"2026-07-02T16:20:00Z"}),So({id:4712,slug:"checkout-field-styles",name:(0,a.__)("Checkout field styles","code-snippets"),description:(0,a.__)("Tidies the spacing and focus states on the checkout form fields.","code-snippets"),code:[".woocommerce-checkout .form-row input:focus {","\toutline: 2px solid #2271b1;","}"].join("\n"),tags:["woocommerce","styles"],scope:"site-css",status:lo.Public,updated:"2026-06-18T08:55:00Z"}),So({id:4655,slug:"lazy-load-embeds",name:(0,a.__)("Lazy load video embeds","code-snippets"),description:(0,a.__)("Defers YouTube and Vimeo iframes until they are scrolled into view.","code-snippets"),code:["add_filter( 'embed_oembed_html', function ( $html ) {","\treturn str_replace( '<iframe', '<iframe loading=\"lazy\"', $html );","} );"].join("\n"),tags:["performance"],scope:"front-end",status:lo.AI_Verified,updated:"2026-05-29T11:47:00Z"})]},No=["idle","library","preview","download","synced","finished"],ko=function(e,t){return xo===e.id&&(n=t,No.indexOf(n)>=No.indexOf("synced"));var n},Co=function(e){var t=e.snippet,n=e.stage,r=ko(t,n),s=r?(0,a.__)("Synced to Cloud","code-snippets"):(0,a.__)("Available in Cloud","code-snippets"),i=function(){return(0,_.jsx)("span",{className:"cloud-sync-indicator",role:"img","aria-label":s,children:r?(0,_.jsx)(jo,{}):(0,_.jsx)(vo,{})})};return(0,_.jsx)(es,{inline:!0,label:s,icon:(0,_.jsx)(i,{}),children:s})},Eo=function(e){var t=e.snippet;return t.tags.map(function(e,n){return(0,_.jsxs)(i.Fragment,{children:[e,n<t.tags.length-1?", ":""]},e)})},Do=function(e){var t=e.snippet,n=e.stage,r=e.onPreview,s=xo===t.id;return(0,_.jsxs)("div",{className:"cloud-snippet-action-buttons",children:[(0,_.jsx)(In,{secondary:!0,className:y()("demo-preview-button",{"demo-click":s&&"preview"===n}),onClick:function(){return r(t)},children:(0,a.__)("Preview","code-snippets")}),ko(t,n)?(0,_.jsx)(In,{secondary:!0,className:"demo-action-button","aria-hidden":"true",tabIndex:-1,children:(0,a.__)("Edit","code-snippets")}):(0,_.jsx)(In,{primary:!0,"aria-hidden":"true",tabIndex:-1,className:y()("cloud-snippet-download demo-action-button",{"demo-click":s&&"download"===n}),children:(0,a.__)("Download","code-snippets")})]})},To=function(e){var t=e.stage,n=e.onPreview;return[{id:"state",title:(0,_.jsx)(vo,{role:"img","aria-label":(0,a.__)("Sync Status","code-snippets")}),render:function(e){return(0,_.jsx)(Co,{snippet:e,stage:t})}},{id:"name",title:(0,a.__)("Snippet Name","code-snippets"),isPrimary:!0,sortedValue:function(e){return Cr(e).toLowerCase()},render:function(e){return(0,_.jsx)("strong",{children:e.name})}},{id:"type",title:(0,a.__)("Type","code-snippets"),sortedValue:function(e){return Pr(e)},render:function(e){return(0,_.jsx)(zn,{name:Pr(e)})}},{id:"status",title:(0,a.__)("Status","code-snippets"),sortedValue:function(e){return e.status},render:function(e){return(0,_.jsx)(mo,{status:e.status})}},{id:"desc",title:(0,a.__)("Description","code-snippets"),render:function(e){return(0,_.jsx)("div",{className:"snippet-description-content",children:fn(hn(e.description))})}},{id:"tags",title:(0,a.__)("Tags","code-snippets"),render:function(e){return(0,_.jsx)(Eo,{snippet:e})}},{id:"date",title:(0,a.__)("Updated","code-snippets"),sortedValue:function(e){return new Date(e.updated).toISOString()},render:function(e){return(0,_.jsx)("span",{className:"modified-column-content",title:e.updated,children:(0,_.jsx)("time",{dateTime:e.updated,children:(0,co.humanTimeDiff)(e.updated,void 0)})})}},{id:"actions",title:(0,_.jsx)("span",{className:"screen-reader-text",children:(0,a.__)("Actions","code-snippets")}),render:function(e){return(0,_.jsx)(Do,{snippet:e,stage:t,onPreview:n})}}]},Ao={library:{step:(0,a.__)("Step 1 of 4","code-snippets"),title:(0,a.__)("Your whole cloud, in one place","code-snippets"),body:(0,a.__)("Every snippet and bundle saved to your Code Snippets Cloud account is listed here, on every site you connect — so work you did once is never more than a click away.","code-snippets")},preview:{step:(0,a.__)("Step 2 of 4","code-snippets"),title:(0,a.__)("Read it before you take it","code-snippets"),body:(0,a.__)("Preview shows the full code without leaving the page, so you can check exactly what a snippet does before it touches your site.","code-snippets")},download:{step:(0,a.__)("Step 3 of 4","code-snippets"),title:(0,a.__)("Download in one click","code-snippets"),body:(0,a.__)("The snippet lands in your snippets table straight away — and inactive, so nothing runs until you have looked it over and switched it on.","code-snippets")},synced:{step:(0,a.__)("Step 4 of 4","code-snippets"),title:(0,a.__)("Kept in sync","code-snippets"),body:(0,a.__)("Once downloaded the row shows as synced, with an edit link instead of a download button. Change it here or in the cloud and the two are kept together.","code-snippets")}},Ro=function(e){return Ao[e]},Io={library:4800,preview:5400,download:4200,synced:4800},Lo={library:"preview",preview:"download",download:"synced",synced:"finished"},Fo=function(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches};function Mo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Bo(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Mo(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Mo(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Uo=".cloud-library-snippets tbody tr.demo-featured-row",qo={library:{target:".cloud-library-snippets",padding:6},preview:{target:"".concat(Uo," .demo-preview-button"),padding:6},download:{target:"".concat(Uo," .demo-action-button"),padding:6},synced:{target:Uo,padding:4}},Vo={library:(0,a.__)("Showing the snippets saved in your cloud.","code-snippets"),preview:(0,a.__)("Previewing the snippet code.","code-snippets"),download:(0,a.__)("Downloading the snippet to your site.","code-snippets"),synced:(0,a.__)("The snippet is now synced with your cloud.","code-snippets"),finished:(0,a.__)("Demo complete.","code-snippets")},Wo=function(){var e=Nn().api,t=(0,i.useState)(function(){var e,t;return null!==(e=null===(t=window.CODE_SNIPPETS)||void 0===t?void 0:t.snippetView)&&void 0!==e?e:"table"}),n=s(t,2),r=n[0],o=n[1];return{snippetView:r,setSnippetView:(0,i.useCallback)(function(t){o(t),e.post(bn.preferences.snippetView,{view:t}).catch(Mn)},[e])}};function Ho(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zo(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ho(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ho(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var $o=function(){var e=(0,i.useRef)(null),t=s((0,i.useState)({atStart:!0,atEnd:!0}),2),n=t[0],r=t[1],o=(0,i.useCallback)(function(){var t=e.current;if(t){var n=t.scrollWidth-t.clientWidth>1,s=!n||t.scrollLeft<=1,i=!n||t.scrollLeft+t.clientWidth>=t.scrollWidth-1;r(function(e){return e.atStart===s&&e.atEnd===i?e:{atStart:s,atEnd:i}})}},[]);return(0,i.useEffect)(function(){var t,n=e.current;if(n){o(),n.addEventListener("scroll",o,{passive:!0});var r=new ResizeObserver(o);return r.observe(n),r.observe(null!==(t=n.firstElementChild)&&void 0!==t?t:n),function(){n.removeEventListener("scroll",o),r.disconnect()}}},[o]),zo(zo({},n),{},{scrollRef:e})};function Go(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}var Ko,Jo,Qo,Yo,Xo=function(e){var t=e.tab,n=e.currentTab,r=e.getTabCount,s=e.setCurrentTab,i=e.queryParamName,o=null==r?void 0:r(t);return(0,_.jsx)("li",{children:(0,_.jsxs)("button",{type:"button",className:y()("snippet-type-link","".concat(t.name,"-subnav-link"),{"active-type":t.name===n.name}),"aria-current":t.name===n.name?"page":void 0,onClick:function(){s(t),i&&f(b({},i,t.name))},children:[(0,_.jsx)("span",{children:t.label}),void 0!==o&&(0,_.jsx)("span",{className:"subnav-count",children:o}),t.pro&&!C()&&(0,_.jsx)("span",{className:"pro-chip",children:(0,a.__)("Pro","code-snippets")})]})})},Zo=function(e){var t=e.tabs,n=e.ariaLabel,r=e.className,s=e.currentTab,i=e.getTabCount,o=e.setCurrentTab,a=e.queryParamName,c=$o(),l=c.atStart,u=c.atEnd,d=c.scrollRef;return(0,_.jsx)("div",{className:y()("snippet-type-nav-wrapper",{"has-scroll-start":!l,"has-scroll-end":!u}),children:(0,_.jsx)("nav",{ref:d,className:y()("snippet-type-nav",r),"aria-label":n,children:(0,_.jsx)("ul",{children:t.map(function(e){return(0,_.jsx)(Xo,{tab:e,currentTab:s,getTabCount:i,setCurrentTab:o,queryParamName:a},e.name)})})})})};function ea(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ta(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ea(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ea(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var na=Math.min(null!==(Ko=null!==(Jo=null===(Qo=window.CODE_SNIPPETS_MANAGE)||void 0===Qo?void 0:Qo.cloudSearchPerPage)&&void 0!==Jo?Jo:null===(Yo=window.CODE_SNIPPETS_MANAGE)||void 0===Yo?void 0:Yo.snippetsPerPage)&&void 0!==Ko?Ko:10,100),ra={SEARCH_QUERY:bn.cloud.snippets,FEATURED:"".concat(bn.cloud.snippets,"/featured")},sa="paged",ia="type",oa="status",aa="category",ca=["term","codevault","ai"],la=function(){var e,t,n,r,s,i,o=Number(null!==(e=d(sa))&&void 0!==e?e:1),a=null!==(t=d("s"))&&void 0!==t?t:"",c=null!==(n=d(ia))&&void 0!==n?n:"",l=null!==(r=d(oa))&&void 0!==r?r:0,u=d("by"),p=null!==(s=d(aa))&&void 0!==s?s:"";return{page:isNaN(o)?1:o,type:c,query:a,status:Number(l),method:(i=u,function(e){return ca.some(function(t){return t===e})}(i)?i:"term"),category:p}},ua=function(e){return"object"===l(e)&&null!==e&&"id"in e&&"number"==typeof e.id&&"name"in e&&"string"==typeof e.name},da=function(e){return Array.isArray(e)?e.filter(ua):void 0},pa=s(dn("useCloudSearch"),2),fa=pa[0],ha=pa[1],ma=function(e){var t=e.children,n=function(){var e=Nn().api,t=function(){var e=(0,i.useRef)(0),t=(0,i.useCallback)(function(){return e.current+=1,e.current},[]);return{isCurrentRequest:(0,i.useCallback)(function(t){return t===e.current},[]),nextRequestId:t}}(),n=t.isCurrentRequest,r=t.nextRequestId,o=s((0,i.useState)(!1),2),a=o[0],c=o[1],u=s((0,i.useState)(!1),2),d=u[0],p=u[1],f=s((0,i.useState)(),2),h=f[0],b=f[1],g=s((0,i.useState)({}),2),v=g[0],y=g[1];return{isLoading:d,isSearching:a,searchResults:h,availableFilters:v,makeSearchRequest:(0,i.useCallback)(function(t){var s=r(),i=""===t.query.trim();p(!0),c(!i);var o=i?ra.FEATURED:ra.SEARCH_QUERY;e.getResponse(function(e,t){var n=t.query,r=t.type,s=t.method,i=t.status,o=t.category,a=t.page;return m(e,{query:n,searchByCodevault:"codevault"===s||void 0,searchMethod:"ai"===s?"ai":void 0,per_page:na,type:r||void 0,category:o||void 0,status:i||void 0,page:a})}(o,t)).then(function(e){n(s)&&(b(function(e,t){var n=e.data;return{page:n.page,isFeatured:t===ra.FEATURED,snippets:n.snippets,totalItems:n.total_snippets,totalPages:n.total_pages}}(e,o)),y(function(t){var n,r;return null!==(n="object"===l(r=e.data.available_filters)&&r?ta(ta(ta({},"types"in r&&{types:da(r.types)}),"statuses"in r&&{statuses:da(r.statuses)}),"categories"in r&&{categories:da(r.categories)}):void 0)&&void 0!==n?n:t}))}).catch(function(){n(s)&&b(!1)}).finally(function(){n(s)&&(c(!1),p(!1))})},[e,r,n])}}(),r=n.isLoading,o=n.isSearching,a=n.makeSearchRequest,c=n.availableFilters,u=n.searchResults,d=s((0,i.useState)(la),2),p=d[0],h=d[1],g=s((0,i.useState)(!1),2),v=g[0],y=g[1],j=(0,i.useCallback)(function(e){return h(function(t){return ta(ta({},t),e)})},[]),w=(0,i.useCallback)(function(e){var t=function(e,t){var n=e.query.trim()!==t.query.trim(),r=e.method!==t.method,s=e.type!==t.type,i=e.status!==t.status,o=e.category!==t.category,a=s||i||o;return n||r?ta(ta({},e),{},{page:1,type:"",status:0,category:""}):a?ta(ta({},e),{},{page:1}):e}(ta(ta({},p),e),p);!function(e){f(b(b(b(b(b(b({},sa,e.page),ia,e.type||void 0),"s",e.query||void 0),oa,e.status||void 0),"by","codevault"===e.method?"codevault":void 0),aa,e.category||void 0))}(t),h(t),a(t)},[a,p]);(0,i.useEffect)(function(){v||(y(!0),a(p))},[a,p,v]);var x=ta({doSearch:w,isLoading:r,isSearching:o,searchParams:p,availableFilters:c,updateSearchParams:j},!1===u?{isErrored:!0,searchResults:void 0}:{isErrored:!1,searchResults:u});return(0,_.jsx)(fa.Provider,{value:x,children:t})},ba=function(e){var t=e.isLoading,n=e.errorMessage,r=e.loadingNotice,s=e.noticeLabel;switch(!0){case t:return(0,_.jsx)(P,{"aria-label":s,className:"inline",children:(0,_.jsx)("p",{children:r})});case void 0!==n:return(0,_.jsx)(P,{"aria-label":s,className:"inline",type:"error",children:(0,_.jsx)("p",{children:n})});default:return(0,_.jsx)(P,{"aria-label":s,className:"inline",type:"warning",children:(0,_.jsx)("p",{children:(0,a.__)("An unknown error occurred. Please try again.","code-snippets")})})}};function ga(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function va(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ga(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ga(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var ya=function(e){return(0,_.jsxs)("svg",va(va({width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{},{children:[(0,_.jsx)("rect",{x:"2",y:"2",width:"5.5",height:"5.5",rx:"1",stroke:"currentColor",strokeWidth:"1.6"}),(0,_.jsx)("rect",{x:"10.5",y:"2",width:"5.5",height:"5.5",rx:"1",stroke:"currentColor",strokeWidth:"1.6"}),(0,_.jsx)("rect",{x:"2",y:"10.5",width:"5.5",height:"5.5",rx:"1",stroke:"currentColor",strokeWidth:"1.6"}),(0,_.jsx)("rect",{x:"10.5",y:"10.5",width:"5.5",height:"5.5",rx:"1",stroke:"currentColor",strokeWidth:"1.6"})]}))};function _a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ja(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_a(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_a(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var wa=function(e){return(0,_.jsx)("svg",ja(ja({width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{},{children:(0,_.jsx)("path",{d:"M2.5 4.5H15.5M2.5 9H15.5M2.5 13.5H15.5",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})}))},xa=function(e){var t=e.snippetView,n=e.setSnippetView,r=e.className;return(0,_.jsxs)("div",{className:y()("snippet-view-toggle",r),role:"group","aria-label":(0,a.__)("Snippet view","code-snippets"),children:[(0,_.jsxs)("button",{type:"button",className:y()("snippet-view-toggle-option",{"active-view":"card"===t}),"aria-pressed":"card"===t,title:(0,a.__)("Switch to card view","code-snippets"),onClick:function(){return n("card")},children:[(0,_.jsx)(ya,{"aria-hidden":"true"}),(0,_.jsx)("span",{className:"screen-reader-text",children:(0,a.__)("Card view","code-snippets")})]}),(0,_.jsxs)("button",{type:"button",className:y()("snippet-view-toggle-option",{"active-view":"table"===t}),"aria-pressed":"table"===t,title:(0,a.__)("Switch to table view","code-snippets"),onClick:function(){return n("table")},children:[(0,_.jsx)(wa,{"aria-hidden":"true"}),(0,_.jsx)("span",{className:"screen-reader-text",children:(0,a.__)("Table view","code-snippets")})]})]})},Oa=function(e){var t=e.className,n=e.isSelected,r=void 0!==n&&n,s=e.onSelectedChange,i=e.selectionLabel,o=e.footer,a=e.footerStatus,c=e.children;return(0,_.jsxs)("li",{className:y()("code-snippets-card",t,{"is-selectable":void 0!==s,"is-selected":void 0!==s&&r}),children:[void 0!==s?(0,_.jsx)("div",{className:"snippet-card-corner",children:(0,_.jsx)("input",{type:"checkbox",className:"snippet-card-select",checked:r,"aria-label":i,onChange:function(e){return s(e.target.checked)}})}):null,c,void 0!==o||void 0!==a?(0,_.jsxs)("footer",{children:[(0,_.jsx)("div",{className:"snippet-card-footer-status",children:a}),(0,_.jsx)("div",{className:"snippet-card-footer-actions",children:o})]}):null]})},Sa=function(e){var t,n=e.codevaultSlug;return(0,_.jsx)("p",{className:"cloud-snippet-author",children:(0,_.jsx)("a",{href:"".concat(null===(t=window.CODE_SNIPPETS)||void 0===t?void 0:t.urls.cloud,"/codevault/").concat(n),target:"_blank",rel:"noopener noreferrer",children:(0,a.sprintf)((0,a.__)("By %s","code-snippets"),n)})})},Pa=function(e){var t=e.snippet,n=e.author,r=e.setIsPreviewOpen;return(0,_.jsxs)("div",{className:"cloud-snippet card-inner",children:[(0,_.jsxs)("div",{className:"snippet-card-header",children:[(0,_.jsx)(zn,{name:Pr(t)}),(0,_.jsx)("h3",{children:(0,_.jsx)("button",{type:"button",className:"cloud-snippet-title-button",title:(0,a.__)("Preview this snippet","code-snippets"),onClick:function(){r(!0)},children:t.name})})]}),0<t.tags.length||t.updated?(0,_.jsxs)("div",{className:"snippet-card-meta",children:[0<t.tags.length?(0,_.jsxs)("span",{className:"cloud-snippet-tags",children:[(0,_.jsx)("span",{className:"snippet-card-tags-label",children:(0,a.__)("Tags:","code-snippets")})," ",t.tags.join(", ")]}):null,t.updated?(0,_.jsx)("time",{className:"snippet-card-modified",dateTime:t.updated,title:t.updated,children:(0,a.sprintf)((0,a.__)("Modified %s","code-snippets"),(0,co.humanTimeDiff)(t.updated,void 0))}):null]}):null,t.description?(0,_.jsx)("p",{className:"snippet-description-content",children:fn(hn(t.description))}):null,n]})},Na=function(e){var t=e.snippet,n=e.author,r=e.isSelected,o=void 0!==r&&r,c=e.onSelectedChange,l=e.onSnippetDownloaded,u=s((0,i.useState)(!1),2),d=u[0],p=u[1];return(0,_.jsxs)(Oa,{className:"cloud-search-result",isSelected:o,onSelectedChange:c,selectionLabel:(0,a.sprintf)((0,a.__)("Select %s","code-snippets"),t.name),footerStatus:(0,_.jsx)(ho,{status:t.status}),footer:(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(In,{secondary:!0,onClick:function(){return p(!0)},children:(0,a.__)("Preview","code-snippets")}),(0,_.jsx)(ds,{snippet:t,onDownloaded:l})]}),children:[(0,_.jsx)(Pa,{snippet:t,author:n,setIsPreviewOpen:p}),d&&(0,_.jsx)(Ss,{snippet:t,setIsOpen:p,onDownloaded:l})]})},ka=function(e){var t=e.snippet,n=ha().doSearch,r=s((0,i.useState)(!1),2),o=r[0],c=r[1];return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("td",{className:"column-name column-primary",children:(0,_.jsx)("strong",{children:(0,_.jsx)("button",{type:"button",className:"cloud-table-name-button",title:(0,a.__)("Preview this snippet","code-snippets"),onClick:function(){return c(!0)},children:t.name})})}),(0,_.jsx)("td",{className:"column-type",children:(0,_.jsx)(zn,{name:Pr(t)})}),(0,_.jsx)("td",{className:"column-status",children:(0,_.jsx)(mo,{status:t.status})}),(0,_.jsx)("td",{className:"column-desc",children:(0,_.jsx)("div",{className:"cloud-table-description",children:fn(hn(t.description))})}),(0,_.jsxs)("td",{className:"column-actions",children:[(0,_.jsxs)("div",{className:"cloud-snippet-action-buttons",children:[(0,_.jsx)(In,{secondary:!0,onClick:function(){return c(!0)},children:(0,a.__)("Preview","code-snippets")}),(0,_.jsx)(ds,{snippet:t,onDownloaded:n})]}),o&&(0,_.jsx)(Ss,{snippet:t,setIsOpen:c,onDownloaded:n})]})]})},Ca=function(e){var t=e.availableIds,n=e.selectedIds,r=e.setSelectedIds;return(0,_.jsx)("td",{className:"column-cb check-column",children:(0,_.jsx)("input",{id:"cb-select-all-cloud-snippets",type:"checkbox",checked:0<t.length&&t.every(function(e){return n.has(e)}),disabled:0===t.length,title:0===t.length?(0,a.__)("Nothing on this page can be downloaded.","code-snippets"):void 0,onChange:function(e){return r(function(n){return new Set(e.target.checked?[].concat(D(n),D(t)):D(n).filter(function(e){return!t.includes(e)}))})},"aria-label":(0,a.__)("Select all downloadable snippets","code-snippets")})})},Ea=function(e){var t=e.snippet,n=e.selected,r=e.setSelected,s=function(e){return e.local_id?(0,a.__)("Already in your library.","code-snippets"):Lr(e)?void 0:(0,a.__)("Requires Code Snippets Pro.","code-snippets")}(t);return(0,_.jsx)("th",{scope:"row",className:"check-column",children:(0,_.jsx)("input",{id:"cb-select-".concat(t.id),type:"checkbox",name:"checked[]",checked:!s&&n.has(t.id),disabled:!!s,title:s,"aria-label":s?(0,a.sprintf)((0,a.__)("%1$s cannot be selected: %2$s","code-snippets"),t.name,s):(0,a.sprintf)((0,a.__)("Select %s","code-snippets"),t.name),onChange:function(e){return r(function(n){return new Set(e.target.checked?[].concat(D(n),[t.id]):D(n).filter(function(e){return e!==t.id}))})}})})},Da=function(e){var t=e.snippets,n=e.selected,r=e.setSelected;return(0,_.jsxs)("table",{className:"wp-list-table widefat fixed striped cloud-snippets-table",children:[(0,_.jsx)("thead",{children:(0,_.jsxs)("tr",{children:[n&&r&&(0,_.jsx)(Ca,{selectedIds:n,setSelectedIds:r,availableIds:t.filter(function(e){return Lr(e)}).map(function(e){return e.id})}),(0,_.jsx)("th",{scope:"col",className:"column-name column-primary",children:(0,a.__)("Name","code-snippets")}),(0,_.jsx)("th",{scope:"col",className:"column-type",children:(0,a.__)("Type","code-snippets")}),(0,_.jsx)("th",{scope:"col",className:"column-status",children:(0,a.__)("Status","code-snippets")}),(0,_.jsx)("th",{scope:"col",className:"column-desc",children:(0,a.__)("Description","code-snippets")}),(0,_.jsx)("th",{scope:"col",className:"column-actions",children:(0,_.jsx)("span",{className:"screen-reader-text",children:(0,a.__)("Actions","code-snippets")})})]})}),(0,_.jsx)("tbody",{children:t.map(function(e){return(0,_.jsxs)("tr",{children:[n&&r&&(0,_.jsx)(Ea,{snippet:e,selected:n,setSelected:r}),(0,_.jsx)(ka,{snippet:e})]},e.id)})})]})},Ta=[{paramName:"category",filterName:"categories",label:(0,a.__)("Snippet Category","code-snippets"),allOptionLabel:(0,a.__)("All Categories","code-snippets")},{paramName:"type",filterName:"types",label:(0,a.__)("Snippet Type","code-snippets"),allOptionLabel:(0,a.__)("All Types","code-snippets")},{paramName:"status",filterName:"statuses",label:(0,a.__)("Snippet Status","code-snippets"),allOptionLabel:(0,a.__)("All Statuses","code-snippets")}],Aa=function(){var e=ha(),t=e.availableFilters,n=e.searchParams,r=e.doSearch,s=Ta.filter(function(e){var n=e.filterName;return t[n]&&0<t[n].length});return 0<s.length?(0,_.jsx)("div",{className:"alignleft actions",children:s.map(function(e){var s,o=e.label,a=e.allOptionLabel,c=e.filterName,l=e.paramName;return(0,_.jsxs)(i.Fragment,{children:[(0,_.jsx)("label",{htmlFor:"cloud-search-".concat(c),className:"screen-reader-text",children:o}),(0,_.jsxs)("select",{id:"cloud-search-".concat(c),className:"cloud-search-category-filter",value:n[l],onChange:function(e){return r(b({},l,function(e,t,n){if(""!==n){if("number"==typeof t[e]){var r=Number(n);return isNaN(r)?void 0:r}return n}}(l,n,e.target.value)))},children:[(0,_.jsx)("option",{value:"",children:a}),null===(s=t[c])||void 0===s?void 0:s.map(function(e){return(0,_.jsx)("option",{value:e.id,children:e.name},e.id)})]})]},c)})}):null},Ra=["snippetView"],Ia=["which","doSearch","isSearching","searchResults"];function La(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Fa(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?La(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):La(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Ma=function(){var e=ha(),t=e.searchParams,n=e.updateSearchParams,r=e.isSearching,o=e.doSearch,c=(0,i.useId)(),l=s((0,i.useState)(t.query),2),u=l[0],d=l[1];return(0,_.jsxs)("form",{className:"cloud-search-form",onSubmit:function(e){e.preventDefault(),o({query:u})},children:[(0,_.jsx)("label",{htmlFor:c,className:"screen-reader-text",children:(0,a.__)("Search method","code-snippets")}),(0,_.jsxs)("select",{id:c,value:t.method,onChange:function(e){return n({method:"codevault"===e.target.value?"codevault":"term"})},children:[(0,_.jsx)("option",{value:"term",children:(0,a.__)("Search by keyword","code-snippets")}),(0,_.jsx)("option",{value:"codevault",children:(0,a.__)("Name of library","code-snippets")})]}),(0,_.jsxs)("div",{className:"cloud-search-query",children:[(0,_.jsx)("input",{id:"cloud-search-query",type:"search",value:u,"aria-label":(0,a.__)("Search query","code-snippets"),onChange:function(e){return d(e.target.value)},placeholder:(0,a.__)("e.g. Remove unused JavaScript…","code-snippets")}),r&&(0,_.jsx)("span",{role:"status","aria-live":"polite",children:(0,_.jsx)("span",{className:"screen-reader-text",children:(0,a.__)("Searching…","code-snippets")})})]}),(0,_.jsx)("button",{type:"submit",className:"button button-primary cloud-search-submit",disabled:r,children:r?(0,_.jsx)(dr.Spinner,{}):(0,a.__)("Search Cloud Library","code-snippets")})]})},Ba=function(e){var t=e.snippets,n=e.selected,r=e.setSelected,s=ha().doSearch;return(0,_.jsx)("ul",{className:y()("cloud-search-results","code-snippets-cards",{"has-selection":t.some(function(e){return n.has(e.id)})}),children:t.map(function(e){return(0,_.jsx)(Na,{snippet:e,author:(0,_.jsx)(Sa,{codevaultSlug:e.codevault}),isSelected:n.has(e.id),onSnippetDownloaded:function(){return s()},onSelectedChange:Lr(e)?function(t){r(function(n){var r=new Set(n);return t?r.add(e.id):r.delete(e.id),r})}:void 0},e.id)})})},Ua=[{key:"download",label:(0,a.__)("Download","code-snippets")}],qa=function(e){var t=e.snippetView,n=g(e,Ra);return"card"===t?(0,_.jsx)(Ba,Fa({},n)):(0,_.jsx)(Da,Fa({},n))},Va=function(e){var t=e.which,n=e.doSearch,r=e.isSearching,s=e.searchResults,i=g(e,Ia);return(0,_.jsx)(Yi,Fa({which:t,disabled:r,totalItems:s.totalItems,totalPages:s.totalPages,currentPage:s.page,setCurrentPage:function(e){return n({page:e})}},i))},Wa=function(e){var t=e.snippetView,n=e.setSnippetView,r=Nn().api,o=ha(),a=o.searchResults,c=o.isSearching,l=o.doSearch,u=function(e){var t=s((0,i.useState)(new Set),2),n=t[0],r=t[1];return(0,i.useEffect)(function(){r(new Set)},[e]),{selected:n,setSelected:r}}(null==a?void 0:a.snippets),d=u.selected,p=u.setSelected;if(!a)return null;var f=function(){var e=A(I().mark(function e(t,n){return I().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("download"!==t){e.next=4;break}return e.next=3,Promise.all(a.snippets.filter(function(e){return n.has(e.id)&&Lr(e)}).map(function(e){var t=e.id;return r.post("".concat(bn.cloud.snippets,"/").concat(t,"/download"))}));case 3:l();case 4:case"end":return e.stop()}},e)}));return function(t,n){return e.apply(this,arguments)}}();return(0,_.jsxs)("div",{className:"snippets-list-view",children:[(0,_.jsx)(Va,{which:"top",isSearching:c,searchResults:a,selected:d,setSelected:p,doSearch:l,actions:Ua,doAction:f,selectAllKeys:"card"===t?a.snippets.filter(function(e){return Lr(e)}).map(function(e){return e.id}):void 0,extraTableNav:function(){return(0,_.jsx)(Aa,{})},endTableNav:function(e){return"top"===e?(0,_.jsx)(xa,{snippetView:t,setSnippetView:n}):null}}),(0,_.jsx)(qa,{snippets:a.snippets,snippetView:t,selected:d,setSelected:p}),(0,_.jsx)(Va,{which:"bottom",isSearching:c,searchResults:a,selected:d,setSelected:p,doSearch:l})]})},Ha=function(e){var t=e.snippetView,n=e.setSnippetView,r=ha(),s=r.searchResults,i=r.searchParams;return s?0<s.page&&0===s.snippets.length?(0,_.jsx)("div",{className:"banner banner-neutral no-results",children:(0,_.jsx)("p",{children:"codevault"===i.method?(0,a.__)("Could not find a codevault with that name. Please try again.","code-snippets"):(0,a.__)("No snippets could be found with that search term. Please try again.","code-snippets")})}):s.snippets.length?(0,_.jsxs)(_.Fragment,{children:[s.isFeatured?(0,_.jsx)("h2",{className:"cloud-featured-heading",children:(0,a.__)("Featured Snippets","code-snippets")}):(0,_.jsx)("h2",{className:"cloud-snippets-heading",children:(0,a.__)("Search Results","code-snippets")}),(0,_.jsx)(Wa,{snippetView:t,setSnippetView:n})]}):null:null},za=function(){var e=ha(),t=e.isErrored,n=e.isLoading;return t||n?(0,_.jsx)(ba,{isLoading:n,errorMessage:t?(0,a.__)("An error occurred while fetching search results. Please try again.","code-snippets"):void 0,loadingNotice:(0,a.__)("Loading snippets from cloud…","code-snippets"),noticeLabel:(0,a.__)("Community snippets status","code-snippets")}):null},$a=function(e){var t=e.snippetView,n=e.setSnippetView;return(0,_.jsxs)("div",{className:"cloud-search",children:[(0,_.jsx)(Ma,{}),(0,_.jsx)(za,{}),(0,_.jsx)(Ha,{snippetView:t,setSnippetView:n})]})},Ga=[{name:"snippets",label:(0,a.__)("Snippets","code-snippets")},{name:"bundles",label:(0,a.__)("Bundles","code-snippets"),pro:!0}],Ka=function(){var e=s((0,i.useState)(function(){return function(e){var t,n=d("tab"),r=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return Go(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Go(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,s=function(){};return{s,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:s}}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 i,o=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){a=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(a)throw i}}}}(e);try{for(r.s();!(t=r.n()).done;){var s=t.value;if(s.name===n)return s}}catch(e){r.e(e)}finally{r.f()}return e[0]}(Ga)}),2),t=e[0],n=e[1],r=Wo(),o=r.snippetView,c=r.setSnippetView,l=ha().searchResults;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(Zo,{className:"community-cloud-nav",ariaLabel:(0,a.__)("Community Cloud types","code-snippets"),tabs:Ga,getTabCount:function(e){return"snippets"===e.name?null==l?void 0:l.totalItems:void 0},currentTab:t,setCurrentTab:function(e){f(b({},"tab",e.name)),n(e)}}),(0,_.jsx)(En,{hidden:"bundles"===t.name}),(!t.pro||C())&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("div",{className:"snippets-page-header",children:(0,_.jsx)("h1",{children:(0,a.sprintf)((0,a.__)("Community Cloud: %s","code-snippets"),t.label)})}),(0,_.jsx)("hr",{className:"wp-header-end"}),(0,_.jsx)("p",{className:"snippets-page-description",children:(0,a.__)("Search the community cloud and download user-shared snippets directly to your site.","code-snippets")})]}),function(){switch(t.name){case"snippets":return(0,_.jsx)($a,{snippetView:o,setSnippetView:c});case"bundles":return(0,_.jsx)(ss,{})}}()]})};function Ja(e,t){return Ja=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ja(e,t)}function Qa(){Qa=function(e,t){return new n(e,void 0,t)};var e=RegExp.prototype,t=new WeakMap;function n(e,r,s){var i=RegExp(e,r);return t.set(i,s||t.get(e)),Ja(i,n.prototype)}function r(e,n){var r=t.get(n);return Object.keys(r).reduce(function(t,n){var s=r[n];if("number"==typeof s)t[n]=e[s];else{for(var i=0;void 0===e[s[i]]&&i+1<s.length;)i++;t[n]=e[s[i]]}return t},Object.create(null))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ja(e,t)}(n,RegExp),n.prototype.exec=function(t){var n=e.exec.call(this,t);if(n){n.groups=r(n,this);var s=n.indices;s&&(s.groups=r(s,this))}return n},n.prototype[Symbol.replace]=function(n,s){if("string"==typeof s){var i=t.get(this);return e[Symbol.replace].call(this,n,s.replace(/\$<([^>]+)(>|$)/g,function(e,t,n){if(""===n)return e;var r=i[t];return Array.isArray(r)?"$"+r.join("$"):"number"==typeof r?"$"+r:""}))}if("function"==typeof s){var o=this;return e[Symbol.replace].call(this,n,function(){var e=arguments;return"object"!=l(e[e.length-1])&&(e=[].slice.call(e)).push(r(e,o)),s.apply(this,e)})}return e[Symbol.replace].call(this,n,s)},Qa.apply(this,arguments)}var Ya=["all","active","inactive","recently_active","locked","unlocked","trashed"],Xa="all",Za=s(dn("useSnippetsFilters"),2),ec=Za[0],tc=Za[1],nc=function(e){var t=e.children,n=s((0,i.useState)(function(){return d("tag")}),2),r=n[0],o=n[1],a=s((0,i.useState)(function(){return d("s")}),2),c=a[0],l=a[1],u=s((0,i.useState)(function(){var e=d("type");return function(e){return pr.includes(e)}(e)?e:void 0}),2),p=u[0],h=u[1],m=s((0,i.useState)(function(){var e=d("status");return function(e){return Ya.includes(e)}(e)?e:Xa}),2),b=m[0],g=m[1],v=s((0,i.useMemo)(function(){return r=null!=(n=null==(e=c)?void 0:e.trim().match(Qa(/@line:(\d+)/,{line:1})))&&null!==(t=n.groups)&&void 0!==t&&t.line?parseInt(n.groups.line,10):void 0,n&&r?[null==e?void 0:e.replace(n[0],"").trim(),r]:[e,void 0];var e,t,n,r},[c]),2),y=v[0],j=v[1],w={currentTag:r,currentType:p,searchQuery:c,currentStatus:b,searchQueryText:y,searchLineNumber:j,setCurrentType:(0,i.useCallback)(function(e){h(e),f({type:e})},[]),setCurrentStatus:(0,i.useCallback)(function(e){g(e),f({status:Xa===e?"":e})},[]),setCurrentTag:(0,i.useCallback)(function(e){o(e),f({tag:e})},[]),setSearchQuery:(0,i.useCallback)(function(e){l(e),f({s:e})},[])};return(0,_.jsx)(ec.Provider,{value:w,children:t})},rc=function(e,t,n){var r;null!==(r=e.get(t))&&void 0!==r&&r.push(n)||e.set(t,[n])},sc=s(dn("useFilteredSnippets"),2),ic=sc[0],oc=sc[1],ac=function(e){var t=e.children,n=zr().snippetsList,r=tc(),s=r.currentType,o=r.currentTag,a=r.searchLineNumber,c=r.searchQueryText,l=(0,i.useMemo)(function(){var e,t;return null!==(e=null!=n?n:null===(t=window.CODE_SNIPPETS_MANAGE)||void 0===t||null===(t=t.snippetsList)||void 0===t?void 0:t.map(yr))&&void 0!==e?e:[]},[n]),u=(0,i.useMemo)(function(){var e=["name","desc","code","tags"],t=null==c?void 0:c.toLowerCase().trim();return l.filter(function(n){if(s&&Pr(n)!==s)return!1;if(o&&!n.tags.includes(o))return!1;if(t){var r;if(void 0!==a)return(null!==(r=n.code.split("\n")[a])&&void 0!==r?r:"").includes(t);var i=e.some(function(e){return("tags"===e?n.tags.join(" "):n[e]).toLowerCase().includes(t)});return String(n.id)===t||i||function(e,t){return[e.updatedBy,e.createdBy].some(function(e){return Boolean(null==e?void 0:e.displayName.toLowerCase().includes(t))})}(n,t)}return!0})},[l,o,s,c,a]),d=(0,i.useMemo)(function(){return function(e){return e.reduce(function(e,t){return t.active&&rc(e,t.conditionId,t),e},new Map)}(l)},[l]),p=(0,i.useMemo)(function(){return function(e,t){return e.reduce(function(e,n){return n.trashed?rc(e,"trashed",n):(rc(e,"all",n),rc(e,Ar(n,t)?"active":"inactive",n),rc(e,n.locked?"locked":"unlocked",n),n.lastActive&&rc(e,"recently_active",n)),e},new Map)}(u,d)},[u,d]),f={snippetsByStatus:p,activeByCondition:d};return(0,_.jsx)(ic.Provider,{value:f,children:t})};function cc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function lc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?cc(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):cc(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var uc=function(e){return(0,_.jsxs)("svg",lc(lc({width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{},{children:[(0,_.jsx)("circle",{cx:"9",cy:"3.5",r:"1.6",fill:"currentColor"}),(0,_.jsx)("circle",{cx:"9",cy:"9",r:"1.6",fill:"currentColor"}),(0,_.jsx)("circle",{cx:"9",cy:"14.5",r:"1.6",fill:"currentColor"})]}))},dc=["button:not(:disabled)","[href]","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)",'[tabindex]:not([tabindex="-1"])'].join(", "),pc=(0,i.createContext)({closeMenu:function(){}}),fc=function(e){var t=e.onSelect,n=e.destructive,r=e.disabled,s=e.className,o=e.children,a=(0,i.useContext)(pc).closeMenu;return(0,_.jsx)("li",{children:(0,_.jsx)("button",{type:"button",className:y()("kebab-menu-item",{"kebab-menu-item-destructive":n},s),disabled:r,onClick:function(){null==t||t(),a()},children:o})})},hc=function(){return(0,_.jsx)("li",{"aria-hidden":"true",className:"kebab-menu-divider"})},mc=function(e){var t=e.className,n=e.children;return(0,_.jsx)("li",{className:y()("kebab-menu-row",t),children:n})},bc=function(e){var t=e.label,n=e.className,r=e.children,o=s((0,i.useState)(!1),2),a=o[0],c=o[1],l=(0,i.useRef)(null),u=(0,i.useRef)(null),d=(0,i.useRef)(null),p=(0,i.useId)(),f=(0,i.useCallback)(function(){var e;c(!1),null===(e=u.current)||void 0===e||e.focus()},[]),h={isOpen:a,setIsOpen:c,closeMenu:f,containerRef:l,triggerRef:u,popoverRef:d},m=function(e){var t=e.isOpen,n=e.triggerRef,r=e.popoverRef,o=s((0,i.useState)(!1),2),a=o[0],c=o[1];return(0,i.useLayoutEffect)(function(){if(t&&r.current){var e,s,i=r.current.getBoundingClientRect(),o=null===(e=n.current)||void 0===e?void 0:e.getBoundingClientRect();c(i.bottom>window.innerHeight&&(null!==(s=null==o?void 0:o.top)&&void 0!==s?s:0)>i.height);var a=r.current.querySelector("button:not(:disabled)");(null!=a?a:r.current).focus()}else c(!1)},[t,n,r]),a}(h);return function(e){var t=e.isOpen,n=e.setIsOpen,r=e.closeMenu,s=e.containerRef,o=e.popoverRef;(0,i.useEffect)(function(){if(t){var e=function(e){var t;e.target instanceof Node&&(null===(t=s.current)||void 0===t||!t.contains(e.target))&&n(!1)},i=function(e){var t;e.target instanceof Node&&(null===(t=s.current)||void 0===t||!t.contains(e.target))&&n(!1)},a=function(e){return function(e,t){var n=t.closeMenu,r=t.popoverRef;if("Escape"===e.key)return e.preventDefault(),void n();if(r.current){var s=document.activeElement;if(!(s instanceof HTMLElement&&(s.isContentEditable||s.matches("input, select, textarea")))){var i=Array.from(r.current.querySelectorAll(dc)),o=s instanceof HTMLElement?i.indexOf(s):-1;0<i.length&&["ArrowDown","ArrowUp","Home","End"].includes(e.key)&&(e.preventDefault(),i[function(){switch(e.key){case"Home":return 0;case"End":return i.length-1;default:return(o+("ArrowDown"===e.key?1:-1)+i.length)%i.length}}()].focus())}}}(e,{closeMenu:r,popoverRef:o})};return document.addEventListener("mousedown",e),document.addEventListener("focusin",i),document.addEventListener("keydown",a),function(){document.removeEventListener("mousedown",e),document.removeEventListener("focusin",i),document.removeEventListener("keydown",a)}}},[t,n,r,s,o])}(h),(0,_.jsxs)("div",{ref:l,className:y()("kebab-menu",n),children:[(0,_.jsx)("button",{ref:u,type:"button",className:"kebab-menu-trigger","aria-label":t,"aria-expanded":a,"aria-controls":p,onClick:function(){return c(function(e){return!e})},children:(0,_.jsx)(uc,{})}),a?(0,_.jsx)(pc.Provider,{value:{closeMenu:f},children:(0,_.jsx)("ul",{ref:d,id:p,tabIndex:-1,"aria-label":t,className:y()("kebab-menu-popover",{"kebab-menu-popover-top":m}),children:r})}):null]})};function gc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function vc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?gc(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gc(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var yc=function(e){var t=e.snippet,n=s((0,i.useState)(t.priority),2),r=n[0],o=n[1],c=qr(),l=zr().refreshSnippetsList,u=function(){Number.isNaN(r)||r===t.priority?o(t.priority):c.update(vc(vc({},t),{},{priority:r})).then(function(e){e.id===t.id&&o(e.priority)}).then(l).catch(Mn)};return(0,_.jsx)("form",{onSubmit:function(e){e.preventDefault(),u()},children:(0,_.jsx)("input",{id:"snippet-".concat(t.id,"-priority"),type:"number",className:"snippet-priority",value:r,step:"1",onBlur:u,"aria-label":(0,a.__)("Snippet priority","code-snippets"),onChange:function(e){return o(Number(e.target.value))},disabled:t.locked||t.trashed})})};function _c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function jc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_c(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_c(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var wc=function(e){var t=e.snippet,n=s((0,i.useState)(!1),2),r=n[0],o=n[1];return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(In,{link:!0,onClick:function(){return o(!0)},children:(0,a.__)("Preview","code-snippets")}),r&&(0,_.jsx)(ks,{snippet:t,setIsOpen:o})]})},xc=function(e){return e[e.Ready=0]="Ready",e[e.Working=1]="Working",e[e.Errored=2]="Errored",e}(xc||{}),Oc=function(e){var t=e.action,n=e.label,r=e.workingLabel,o=e.failedLabel,c=e.className,l=s((0,i.useState)(xc.Ready),2),u=l[0],d=l[1];return(0,_.jsx)(In,{link:!0,className:y()(c,{"is-busy":u===xc.Working}),disabled:u===xc.Working,onClick:function(){switch(u){case xc.Errored:d(xc.Ready);break;case xc.Working:break;case xc.Ready:d(xc.Working),t().then(function(){return d(xc.Ready)}).catch(function(){d(xc.Errored)})}},children:function(){switch(u){case xc.Working:return(0,_.jsxs)("span",{className:"snippet-row-action-feedback",children:[(0,_.jsx)(dr.Spinner,{})," ",null!=r?r:(0,a.__)("Loading…","code-snippets")]});case xc.Errored:return(0,_.jsxs)("span",{className:"snippet-row-action-error",children:[(0,_.jsx)("span",{className:"dashicons dashicons-warning"}),null!=o?o:(0,a.__)("Failed","code-snippets")]});default:return n}}()})},Sc=function(e){var t=e.snippet,n=zr().refreshSnippetsList,r=bs({snippet:t,onSuccess:n}),s=r.requestDelete,i=r.deleteDialogProps;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(Oc,{action:s,className:"delete",label:t.trashed?(0,a.__)("Delete Permanently","code-snippets"):(0,a.__)("Trash","code-snippets"),workingLabel:t.trashed?(0,a.__)("Deleting…","code-snippets"):(0,a.__)("Trashing…","code-snippets"),failedLabel:(0,a.__)("Failed to delete","code-snippets")}),(0,_.jsx)(ms,jc({},i))]})},Pc=function(e){var t=e.snippet,n=qr(),r=zr().refreshSnippetsList,s=t.trashed?null:(0,_.jsx)(wc,{snippet:t}),i=t.trashed?null:(0,_.jsx)("a",{href:Nr(t),children:t.locked?(0,a.__)("View","code-snippets"):(0,a.__)("Edit","code-snippets")}),o=t.trashed?null:(0,_.jsx)(Oc,{label:(0,a.__)("Clone","code-snippets"),workingLabel:(0,a.__)("Cloning…","code-snippets"),action:function(){return n.create(Sr(t)).then(r)}}),c=t.trashed?null:(0,_.jsx)(Oc,{label:(0,a.__)("Export","code-snippets"),workingLabel:(0,a.__)("Exporting…","code-snippets"),action:function(){return n.export(t).then(function(e){return Jr(e,t)})}}),l=t.trashed?(0,_.jsx)(Oc,{label:(0,a.__)("Restore","code-snippets"),workingLabel:(0,a.__)("Restoring…","code-snippets"),action:function(){return n.restore(t).then(r)}}):null,u=!t.locked||t.trashed?(0,_.jsx)(Sc,{snippet:t}):null;return(0,_.jsx)(_.Fragment,{children:[s,i,o,l,c,u].filter(function(e){return e}).reduce(function(e,t){return null===e?(0,_.jsx)(_.Fragment,{children:t}):(0,_.jsxs)(_.Fragment,{children:[e," | ",t]})},null)})},Nc=function(e){var t,n=e.snippet;return k()||!n.network||n.shared_network?!n.shared_network||null!==(t=window.CODE_SNIPPETS_MANAGE)&&void 0!==t&&t.hasNetworkCap?(0,_.jsx)("div",{className:y()("row-actions",{visible:!n.trashed}),children:(0,_.jsx)(Pc,{snippet:n})}):null:(0,_.jsx)("div",{className:"row-actions visible",children:n.active?(0,_.jsx)("span",{className:"network-active",children:(0,a.__)("Network Active","code-snippets")}):(0,_.jsx)("span",{className:"network-only",children:(0,a.__)("Network Only","code-snippets")})})};function kc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Cc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?kc(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kc(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Ec=function(e,t){return m(window.location.href,{action:"run-once",snippet:e.id,network:e.network?"true":"false",_wpnonce:t})},Dc=function(e){var t,n,r=e.snippet;return(0,_.jsxs)("a",{className:"snippet-execution-button",title:(0,a.__)("Run Once","code-snippets"),href:Ec(r,null!==(t=null===(n=window.CODE_SNIPPETS_MANAGE)||void 0===n?void 0:n.runOnceNonce)&&void 0!==t?t:""),onMouseDown:function(e){e.currentTarget.href=Ec(r,jn())},onClick:function(e){e.preventDefault(),window.location.assign(Ec(r,jn()))},children:[(0,_.jsx)("span",{className:"screen-reader-text",children:(0,a.__)("Run Once","code-snippets")}),(0,_.jsx)("span",{"aria-hidden":"true",children:" "})]})},Tc=function(e){var t=e.snippet,n=qr(),r=n.activate,s=n.deactivate,i=zr().refreshSnippetsList,o=t.network&&!t.shared_network?t.active?(0,a.__)("Network Deactivate","code-snippets"):(0,a.__)("Network Activate","code-snippets"):t.active?(0,a.__)("Deactivate","code-snippets"):(0,a.__)("Activate","code-snippets");return(0,_.jsx)("input",{id:"snippet-".concat(t.id,"-switch"),type:"checkbox",role:"switch",checked:t.active,"aria-checked":t.active,className:"switch",title:o,"aria-label":o,onChange:function(){(t.active?s(t):r(t)).then(i).catch(Mn)}})},Ac=function(e){var t,n,r=e.snippet,s=oc().activeByCondition;if(r.trashed)return"";switch(r.scope){case"single-use":return(0,_.jsx)(Dc,{snippet:r});case"condition":return(0,_.jsx)("a",{className:"snippet-condition-count",href:Nr(r),children:null!==(t=null===(n=s.get(r.id))||void 0===n?void 0:n.length)&&void 0!==t?t:0});default:return(0,_.jsx)(Tc,{snippet:r})}},Rc=function(e){var t=e.snippet;return(0,_.jsx)("div",{className:"extra-icons",children:t.locked&&(0,_.jsx)(es,{inline:!0,end:!0,label:(0,a.__)("About snippet lock","code-snippets"),icon:(0,_.jsx)("span",{className:"dashicons dashicons-lock","aria-hidden":"true"}),children:(0,a.__)("This snippet is locked and cannot be modified.","code-snippets")})})},Ic=function(e){var t,n=e.snippet;return(0,_.jsxs)("span",{className:"snippet-name-group",children:[!n.trashed&&(k()||!n.network||null!==(t=window.CODE_SNIPPETS_MANAGE)&&void 0!==t&&t.hasNetworkCap)?(0,_.jsx)("a",{href:Nr(n),className:"snippet-name",title:Cr(n),children:Cr(n)}):(0,_.jsx)("span",{className:"snippet-name",title:Cr(n),children:Cr(n)}),n.shared_network&&(0,_.jsx)("span",{className:"badge",children:(0,a.__)("Shared on Network","code-snippets")})]})},Lc=function(e){var t=e.snippet;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(Rc,{snippet:t}),(0,_.jsx)(Ic,{snippet:t}),(0,_.jsx)(Nc,{snippet:t})]})},Fc=function(e){var t=e.snippet,n=tc().setCurrentType,r=Pr(t);return(0,_.jsx)("a",{href:m(window.location.href,{type:r}),onClick:function(e){e.preventDefault(),n(r)},children:(0,_.jsx)(zn,{name:r})})},Mc=function(e){var t=e.snippet;return t.tags.map(function(e,n){return(0,_.jsxs)(i.Fragment,{children:[(0,_.jsx)("a",{href:m(window.location.href,{tag:e}),children:e},e),n<t.tags.length-1?", ":""]},e)})},Bc=function(e){var t=e.snippet;return t.modified?(0,_.jsx)("span",{className:"modified-column-content",title:t.modified,children:(0,_.jsx)("time",{dateTime:t.modified,children:(0,co.humanTimeDiff)(t.modified,void 0)})}):(0,_.jsx)(_.Fragment,{children:"—"})},Uc=function(e){var t=e.snippet;return(0,_.jsx)(yc,{snippet:t})},qc=function(e){var t=e.snippet,n=t.createdBy,r=t.updatedBy,s=null!=r?r:n;if(!s)return(0,_.jsx)("span",{className:"snippet-author is-unknown",children:"—"});var i=n&&r&&n.id!==r.id?(0,a.sprintf)((0,a.__)("Created by %1$s · Last edited by %2$s","code-snippets"),n.displayName,r.displayName):n?(0,a.sprintf)((0,a.__)("Created by %s","code-snippets"),n.displayName):(0,a.sprintf)((0,a.__)("Last edited by %s","code-snippets"),s.displayName);return(0,_.jsxs)("span",{className:"snippet-author",title:i,children:[s.avatarUrl&&(0,_.jsx)("img",{className:"snippet-author__avatar",src:s.avatarUrl,alt:"",width:20,height:20}),(0,_.jsx)("span",{className:"snippet-author__name",children:s.displayName})]})},Vc=[{id:"activate",title:(0,_.jsx)("span",{className:"screen-reader-text",children:(0,a.__)("Activate","code-snippets")}),render:function(e){return(0,_.jsx)(Ac,{snippet:e})}},{id:"id",title:(0,a.__)("ID","code-snippets"),sortedValue:function(e){return e.id},render:function(e){return e.id}},{id:"name",title:(0,a.__)("Name","code-snippets"),isPrimary:!0,sortedValue:function(e){return Cr(e).toLowerCase()},render:function(e){return(0,_.jsx)(Lc,{snippet:e})}},{id:"type",title:(0,a.__)("Type","code-snippets"),sortedValue:function(e){return Pr(e)},render:function(e){return(0,_.jsx)(Fc,{snippet:e})}},{id:"desc",title:(0,a.__)("Description","code-snippets"),render:function(e){return(0,_.jsx)("div",{className:"snippet-description-content",children:(0,_.jsx)(c.RawHTML,{children:e.desc})})}},{id:"tags",title:(0,a.__)("Tags","code-snippets"),render:function(e){return(0,_.jsx)(Mc,{snippet:e})}},{id:"date",title:(0,a.__)("Modified","code-snippets"),sortedValue:function(e){return e.modified?new Date(e.modified).toISOString():""},render:function(e){return(0,_.jsx)(Bc,{snippet:e})}},{id:"priority",title:(0,a.__)("Priority","code-snippets"),sortedValue:function(e){return e.priority},render:function(e){return(0,_.jsx)(yc,{snippet:e})}},{id:"author",title:(0,a.__)("Author","code-snippets"),sortedValue:function(e){return function(e){var t,n,r;return null!==(t=null===(n=null!==(r=e.updatedBy)&&void 0!==r?r:e.createdBy)||void 0===n?void 0:n.displayName)&&void 0!==t?t:""}(e).toLowerCase()},render:function(e){return(0,_.jsx)(qc,{snippet:e})}}];function Wc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Hc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Wc(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wc(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var zc=function(e){var t=e.snippet,n=s((0,i.useState)(!1),2),r=n[0],o=n[1];return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(In,{secondary:!0,onClick:function(){return o(!0)},children:(0,a.__)("Preview","code-snippets")}),r&&(0,_.jsx)(ks,{snippet:t,setIsOpen:o})]})},$c=function(e){var t=e.snippet,n=qr(),r=zr().refreshSnippetsList;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(fc,{onSelect:function(){n.create(Sr(t)).then(r).catch(Mn)},children:(0,a.__)("Clone","code-snippets")}),(0,_.jsx)(fc,{onSelect:function(){n.export(t).then(function(e){return Jr(e,t)}).catch(Mn)},children:(0,a.__)("Export","code-snippets")}),(0,_.jsx)(hc,{})]})},Gc=function(e){var t=e.snippet,n=e.requestDelete,r=qr(),s=zr().refreshSnippetsList;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(hc,{}),t.trashed?(0,_.jsx)(fc,{onSelect:function(){r.restore(t).then(s).catch(Mn)},children:(0,a.__)("Restore","code-snippets")}):null,(0,_.jsx)(fc,{destructive:!0,onSelect:n,children:t.trashed?(0,a.__)("Delete Permanently","code-snippets"):(0,a.__)("Trash","code-snippets")})]})},Kc=function(e){var t=e.snippet,n=zr().refreshSnippetsList,r=bs({snippet:t,onSuccess:n,onError:Mn}),s=r.requestDelete,i=r.deleteDialogProps;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(bc,{label:(0,a.sprintf)((0,a.__)("Actions for %s","code-snippets"),Cr(t)),children:[t.trashed?null:(0,_.jsx)($c,{snippet:t}),(0,_.jsxs)(mc,{className:"kebab-menu-priority",children:[(0,_.jsx)("label",{htmlFor:"snippet-".concat(t.id,"-priority"),children:(0,a.__)("Priority","code-snippets")}),(0,_.jsx)(Uc,{snippet:t})]}),Ir(t)&&(t.trashed||!t.locked)&&(0,_.jsx)(Gc,{snippet:t,requestDelete:function(){s()}})]}),(0,_.jsx)(ms,Hc({},i))]})},Jc=function(e){var t=e.snippet;return(0,_.jsxs)(_.Fragment,{children:[Rr(t)?t.active?(0,_.jsx)("span",{className:"network-active",children:(0,a.__)("Network Active","code-snippets")}):(0,_.jsx)("span",{className:"network-only",children:(0,a.__)("Network Only","code-snippets")}):null,t.trashed?null:(0,_.jsx)(zc,{snippet:t}),!t.trashed&&Ir(t)?(0,_.jsx)("a",{className:"button button-primary",href:Nr(t),children:t.locked?(0,a.__)("View","code-snippets"):(0,a.__)("Edit","code-snippets")}):null,Ir(t)?(0,_.jsx)(Kc,{snippet:t}):null]})},Qc=function(e){var t=e.snippet;return t.modified?(0,_.jsx)("time",{className:"snippet-card-modified",dateTime:t.modified,title:t.modified,children:(0,a.sprintf)((0,a.__)("Modified %s","code-snippets"),(0,co.humanTimeDiff)(t.modified,void 0))}):null},Yc=function(e){var t=e.snippet;return(0,_.jsxs)("div",{className:"snippet-card-header",children:[(0,_.jsx)(Ac,{snippet:t}),(0,_.jsx)(Fc,{snippet:t}),(0,_.jsx)("h3",{children:(0,_.jsx)(Ic,{snippet:t})}),(0,_.jsx)(Rc,{snippet:t})]})},Xc=function(e){var t=e.snippet,n=e.isSelected,r=e.onSelectedChange,s=oc().activeByCondition;return(0,_.jsx)(Oa,{className:y()("snippet","".concat(Ar(t,s)?"active":"inactive","-snippet"),"".concat(Pr(t),"-snippet"),"".concat(t.scope,"-snippet")),isSelected:n,onSelectedChange:r,selectionLabel:(0,a.sprintf)((0,a.__)("Select %s","code-snippets"),Cr(t)),footer:(0,_.jsx)(Jc,{snippet:t}),children:(0,_.jsxs)("div",{className:"card-inner",children:[(0,_.jsx)(Yc,{snippet:t}),(0<t.tags.length||!!t.modified)&&(0,_.jsxs)("div",{className:y()("snippet-card-meta",{"has-tags":0<t.tags.length}),children:[0<t.tags.length&&(0,_.jsxs)("span",{className:"snippet-card-tags",children:[(0,_.jsx)("span",{className:"snippet-card-tags-label",children:(0,a.__)("Tags:","code-snippets")})," ",(0,_.jsx)(Mc,{snippet:t})]}),(0,_.jsx)(Qc,{snippet:t})]}),t.desc&&(0,_.jsx)("div",{className:"snippet-description-content",children:(0,_.jsx)(c.RawHTML,{children:t.desc})})]})})},Zc="paged",el=function(e){var t=e.snippets,n=e.noItems,r=e.selected,s=e.setSelected;return 0<t.length?(0,_.jsx)("ul",{className:y()("code-snippets-cards","snippets-card-grid",{"has-selection":t.some(function(e){return r.has(e.id)})}),children:t.map(function(e){return(0,_.jsx)(Xc,{snippet:e,isSelected:r.has(e.id),onSelectedChange:function(t){s(function(n){var r=new Set(n);return t?r.add(e.id):r.delete(e.id),r})}},e.id)})}):(0,_.jsx)("p",{className:"no-items",children:n})},tl=function(e,t){return new Set(D(e).filter(function(e){return t.some(function(t){return t.id===e})}))},nl=function(e){var t=e.snippets,n=e.actions,r=e.doAction,o=e.extraTableNav,a=e.endTableNav,c=e.itemsPerPage,l=e.noItems,u=e.beforeGrid,p=s((0,i.useState)(function(){return new Set}),2),f=p[0],h=p[1],m=s((0,i.useState)(function(){return Number(d(Zc))||1}),2),b=m[0],g=m[1],v=function(e){var t=e.snippets,n=e.itemsPerPage,r=e.currentPage,s=n?Math.ceil(t.length/n):0,o=s?Math.min(r,s):1,a=(0,i.useMemo)(function(){return n?t.slice((o-1)*n,o*n):t},[t,n,o]);return{totalPages:s,safePage:o,visibleSnippets:a}}({snippets:t,itemsPerPage:c,currentPage:b}),y=v.totalPages,j=v.safePage,w=v.visibleSnippets;return(0,_.jsx)("div",{className:"snippets-card-grid-container",children:(0,_.jsxs)(Xi,{totalItems:t.length,totalPages:0<y?y:void 0,currentPage:j,setCurrentPage:g,pageSearchParam:Zc,selected:tl(f,w),setSelected:h,selectAllKeys:w.map(function(e){return e.id}),actions:n,doAction:r,extraTableNav:o,endTableNav:a,children:[u,(0,_.jsx)(el,{snippets:w,noItems:l,selected:f,setSelected:h})]})})},rl=function(){var e=tc(),t=e.searchQuery,n=e.setSearchQuery;return(0,_.jsx)("search",{className:"snippets-search-area",children:(0,_.jsx)("form",{className:"search-box","aria-label":(0,a.__)("Search Snippets","code-snippets"),onSubmit:function(e){e.preventDefault()},children:(0,_.jsx)("input",{type:"search",id:"snippets_search",name:"s",value:null!=t?t:"","aria-label":(0,a.__)("Search Snippets:","code-snippets"),onChange:function(e){return n(e.target.value)},placeholder:(0,a.__)("Search snippets","code-snippets")})})})},sl=function(){var e=tc(),t=e.searchQueryText,n=e.searchLineNumber,r=e.currentTag,s=e.setSearchQuery,i=e.setCurrentTag;return t||r?(0,_.jsxs)("p",{className:"snippets-search-subtitle",children:[(0,a.__)("Search results","code-snippets"),t&&(0,a.sprintf)((0,a.__)(" for “%s”","code-snippets"),t),n&&(0,a.sprintf)((0,a.__)(" on line “%d”","code-snippets"),n),r&&(0,a.sprintf)((0,a.__)(" in tag “%s”","code-snippets"),r)," ",(0,_.jsx)(In,{small:!0,className:"clear-filters",onClick:function(){s(),i()},children:(0,a.__)("Clear Filters","code-snippets")})]}):null},il=[["all",(0,a.__)("All","code-snippets")],["active",(0,a.__)("Active","code-snippets")],["inactive",(0,a.__)("Inactive","code-snippets")],["recently_active",(0,a.__)("Recently Active","code-snippets")],["locked",(0,a.__)("Locked","code-snippets")],["unlocked",(0,a.__)("Unlocked","code-snippets")],["trashed",(0,a.__)("Trashed","code-snippets")]],ol=function(){var e=tc(),t=e.currentStatus,n=e.setCurrentStatus,r=oc().snippetsByStatus,o=il.filter(function(e){var t=s(e,1)[0];return r.has(t)&&("unlocked"!==t||r.has("locked"))});return(0,_.jsx)("ul",{className:"subsubsub",children:o.map(function(e){var o,c,l=s(e,2),u=l[0],d=l[1];return(0,_.jsx)(i.Fragment,{children:(0,_.jsx)("li",{className:u,children:(0,_.jsxs)("a",{href:m(window.location.href,{status:Xa===u?void 0:u}),className:t===u?"current":void 0,"aria-current":t===u?"page":void 0,onClick:function(e){e.preventDefault(),n(u)},children:[d," ",(0,_.jsx)("span",{className:"count",children:(0,a.sprintf)((0,a._x)("(%d)","table view count","code-snippets"),null!==(o=null===(c=r.get(u))||void 0===c?void 0:c.length)&&void 0!==o?o:0)})]})})},u)})})},al=function(){var e=Nn().api,t=zr().refreshSnippetsList;return"recently_active"===tc().currentStatus?(0,_.jsx)("div",{className:"alignleft actions",children:(0,_.jsx)(ki,{secondary:!0,name:"clear-recent-list",text:(0,a.__)("Clear List","code-snippets"),onClick:function(n){n.preventDefault(),e.del(bn.recentlyActive).then(t).catch(Mn)}})}):null},cl=function(e){var t=e.visibleSnippets,n=tc(),r=n.currentTag,s=n.setCurrentTag,o=(0,i.useId)(),c=(0,i.useMemo)(function(){return t.reduce(function(e,t){return t.tags.forEach(function(t){return e.add(t)}),e},new Set)},[t]);return 0<c.size?(0,_.jsxs)("div",{className:"alignleft actions",children:[(0,_.jsx)("label",{htmlFor:o,className:"screen-reader-text",children:(0,a.__)("Filter snippets by tag","code-snippets")}),(0,_.jsxs)("select",{id:o,name:"tag",value:r,"aria-label":(0,a.__)("Filter snippets by tag","code-snippets"),onChange:function(e){return s(e.target.value)},children:[(0,_.jsx)("option",{value:"",children:(0,a.__)("All Tags","code-snippets")}),D(c).map(function(e){return(0,_.jsx)("option",{value:e,children:e},e)})]})]}):null},ll=function(e){var t=e.which,n=e.visibleSnippets;return(0,_.jsxs)(_.Fragment,{children:["top"===t&&(0,_.jsx)(cl,{visibleSnippets:n}),(0,_.jsx)(al,{}),"top"===t&&(0,_.jsx)(rl,{})]})},ul=function(){return(0,_.jsx)("div",{className:"snippets-table-toolbar",children:(0,_.jsx)(ol,{})})};function dl(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return pl(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?pl(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,s=function(){};return{s,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:s}}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 i,o=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){a=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(a)throw i}}}}function pl(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}var fl=[{key:"activate",label:(0,a.__)("Activate","code-snippets")},{key:"deactivate",label:(0,a.__)("Deactivate","code-snippets")},{key:"clone",label:(0,a.__)("Clone","code-snippets")},{key:"export",label:(0,a.__)("Export","code-snippets")},{key:"download",label:(0,a.__)("Download","code-snippets")},{key:"trash",label:(0,a.__)("Trash","code-snippets")}],hl=[{key:"restore",label:(0,a.__)("Restore","code-snippets")},{key:"delete",label:(0,a.__)("Delete Permanently","code-snippets")}],ml=function(e){var t,n;if(0===e.length)return Promise.resolve();var r=document.createElement("form"),s=function(e,t){var n=document.createElement("input");n.type="hidden",n.name=e,n.value=t,r.appendChild(n)};return r.method="post",r.action=window.location.href,r.hidden=!0,s("code_snippets_action","bulk-download"),s("code_snippets_bulk_download_nonce",null!==(t=null===(n=window.CODE_SNIPPETS_MANAGE)||void 0===n?void 0:n.bulkDownloadNonce)&&void 0!==t?t:""),s("snippets",JSON.stringify(e.map(function(e){return{id:e.id,network:e.network}}))),document.body.appendChild(r),r.submit(),window.setTimeout(function(){r.remove()},0),Promise.resolve()},bl=function(e){return e.reduce(function(e,t){return e.then(function(){return new Promise(function(e){ml([t]),window.setTimeout(e,200)})})},Promise.resolve())},gl=function(){var e=A(I().mark(function e(t,n,r){var s,i,o;return I().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(0<t.length)){e.next=20;break}s=dl(t),e.prev=2,s.s();case 4:if((i=s.n()).done){e.next=10;break}return o=i.value,e.next=8,n(o).catch(Mn);case 8:e.next=4;break;case 10:e.next=15;break;case 12:e.prev=12,e.t0=e.catch(2),s.e(e.t0);case 15:return e.prev=15,s.f(),e.finish(15);case 18:return e.next=20,r();case 20:case"end":return e.stop()}},e,null,[[2,12,15,18]])}));return function(t,n,r){return e.apply(this,arguments)}}(),vl=function(){var e,t=tc(),n=t.currentType,r=t.currentTag,s=t.searchQuery,i=n?(0,a.__)("You don't have snippets of this type yet.","code-snippets"):(0,a.__)("You don't have any snippets yet.","code-snippets");return s||r?(0,_.jsxs)(_.Fragment,{children:[(0,a.__)("No snippets were found matching the current search query.","code-snippets"),(0,a.__)(' Please enter a new query or use the "Clear Filters" button above.',"code-snippets")]}):(0,_.jsxs)(_.Fragment,{children:[i," ",(0,_.jsx)("a",{href:m(null===(e=window.CODE_SNIPPETS)||void 0===e?void 0:e.urls.addNew,{type:n}),children:(0,a.__)("Add a new snippet.","code-snippets")})]})},yl=function(e){var t,n=e.snippetView,r=e.setSnippetView,s=e.snippets,o=e.actions,a=e.doAction,c=e.extraTableNav,l=e.hiddenColumns,u=e.truncateRowValues,d=oc().activeByCondition,p=(0,i.useMemo)(function(){return function(e){return Vc.map(function(t){return Cc(Cc({},t),{},{isHidden:e.has(t.id)})})}(l)},[l]),f=null===(t=window.CODE_SNIPPETS_MANAGE)||void 0===t?void 0:t.snippetsPerPage,h=f&&Math.ceil(s.length/f),m=function(e){return"top"===e?(0,_.jsx)(xa,{snippetView:n,setSnippetView:r}):null};return"card"===n?(0,_.jsx)(nl,{snippets:s,actions:o,doAction:a,itemsPerPage:f,extraTableNav:c,endTableNav:m,noItems:(0,_.jsx)(vl,{}),beforeGrid:(0,_.jsx)(sl,{})}):(0,_.jsx)(oo,{items:s,getKey:function(e){return e.id},initialSort:jl(),className:y()({"truncate-row-values":u}),columns:p,actions:o,doAction:a,totalPages:h,extraTableNav:c,selectAllControl:!0,endTableNav:m,rowClassName:function(e){return function(e,t){return y()("snippet","snippet ".concat(Ar(e,t)?"active":"inactive","-snippet"),"".concat(Pr(e),"-snippet"),"".concat(e.scope,"-snippet"),{"trashed-snippet":e.trashed})}(e,d)},noItems:(0,_.jsx)(vl,{}),beforeTable:(0,_.jsx)(sl,{})})},_l={"priority-asc":{columnId:"priority",direction:"asc"},"name-asc":{columnId:"name",direction:"asc"},"name-desc":{columnId:"name",direction:"desc"},"modified-desc":{columnId:"date",direction:"desc"},"modified-asc":{columnId:"date",direction:"asc"}},jl=function(){var e,t,n;return null!==(e=_l[null!==(t=null===(n=window.CODE_SNIPPETS_MANAGE)||void 0===n?void 0:n.listOrder)&&void 0!==t?t:""])&&void 0!==e?e:void 0},wl=function(e){var t,n,r,o=e.snippetView,a=e.setSnippetView,c=oc().snippetsByStatus,l=tc(),u=l.currentStatus,d=l.setCurrentStatus,p=function(){var e=(0,i.useState)(function(){var e,t;return new Set(null!==(e=null===(t=window.CODE_SNIPPETS_MANAGE)||void 0===t?void 0:t.hiddenColumns)&&void 0!==e?e:[])}),t=s(e,2),n=t[0],r=t[1],o=(0,i.useState)(function(){var e,t;return 0!==Number(null!==(e=null===(t=window.CODE_SNIPPETS_MANAGE)||void 0===t?void 0:t.truncateRowValues)&&void 0!==e?e:1)}),a=s(o,2),c=a[0],l=a[1];return(0,i.useEffect)(function(){var e=document.getElementById("adv-settings");if(e){var t=function(){var t,n;r(new Set(Array.from(e.querySelectorAll(".hide-column-tog:not(:checked)")).map(function(e){return e.value}))),l(null===(t=null===(n=e.querySelector("#snippets-table-truncate-row-values"))||void 0===n?void 0:n.checked)||void 0===t||t)};return t(),e.addEventListener("change",t),function(){e.removeEventListener("change",t)}}},[]),{hiddenColumns:n,truncateRowValues:c}}(),f=p.hiddenColumns,h=p.truncateRowValues,m=(0,i.useMemo)(function(){var e;return null!==(e=c.get(u))&&void 0!==e?e:[]},[c,u]),b=(t=m,n=qr(),r=zr().refreshSnippetsList,function(){var e=A(I().mark(function e(s,i){var o,a;return I().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=s,e.next="activate"===e.t0?3:"deactivate"===e.t0?6:"clone"===e.t0?9:"export"===e.t0?12:"download"===e.t0?14:"trash"===e.t0||"delete"===e.t0?16:void 0===e.t0?19:20;break;case 3:return e.next=5,gl(t.filter(function(e){return i.has(e.id)&&!e.active}),function(e){return n.activate({id:e.id,network:e.network})},r);case 5:case 8:case 11:case 18:case 19:return e.abrupt("break",20);case 6:return e.next=8,gl(t.filter(function(e){return i.has(e.id)&&e.active}),function(e){return n.deactivate({id:e.id,network:e.network})},r);case 9:return e.next=11,gl(t.filter(function(e){return i.has(e.id)&&!e.trashed}),function(e){return n.create(Sr(e))},r);case 12:return Zr(t.filter(function(e){return i.has(e.id)})),e.abrupt("break",20);case 14:return a=t.filter(function(e){return i.has(e.id)}),e.abrupt("return",1<a.length&&(null===(o=window.CODE_SNIPPETS_MANAGE)||void 0===o||!o.supportsZipDownloads)?bl(a):ml(a));case 16:return e.next=18,gl(t.filter(function(e){return i.has(e.id)}),function(e){return n.delete({id:e.id,network:e.network})},r);case 20:case"end":return e.stop()}},e)}));return function(t,n){return e.apply(this,arguments)}}());return(0,i.useEffect)(function(){Xa===u||c.has(u)||d(Xa)},[u,d,c]),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(ul,{}),(0,_.jsx)("div",{className:"snippets-list-view",children:(0,_.jsx)(yl,{snippetView:o,setSnippetView:a,snippets:m,actions:"trashed"===u?hl:fl,doAction:b,extraTableNav:function(e){var t;return(0,_.jsx)(ll,{which:e,visibleSnippets:null!==(t=c.get("all"))&&void 0!==t?t:[]})},hiddenColumns:f,truncateRowValues:h})})]})},xl=function(e){var t=e.type,n=e.count,r=tc(),s=r.currentType,i=r.setCurrentType,o=null!=t?t:"all",c=t===s,l=t&&Tr(t)&&!C();return(0,_.jsx)("li",{children:(0,_.jsxs)("a",{href:m(window.location.href,{type:o}),className:y()("snippet-type-link","".concat(o,"-type-link"),{"active-type":c,"pro-locked-type":l&&!c}),"aria-current":c?"page":void 0,onClick:function(e){e.preventDefault(),i(t)},children:[t&&(0,_.jsx)(zn,{name:t}),(0,_.jsx)("span",{className:y()("".concat(o,"-label"),"snippet-type-name"),children:t?xr[t]:(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("span",{className:"snippet-type-name-full",children:(0,a.__)("All Snippets","code-snippets")}),(0,_.jsx)("span",{className:"snippet-type-name-short",children:(0,a.__)("All","code-snippets")})]})}),void 0!==n&&!l&&(0,_.jsx)("span",{className:"subnav-count",children:n}),l&&(0,_.jsx)("span",{className:"pro-chip",children:(0,a.__)("Pro","code-snippets")})]})})},Ol=function(){var e;return null!==(e=window.CODE_SNIPPETS_MANAGE)&&void 0!==e&&e.isSafeModeActive?(0,_.jsx)(P,{type:"error",children:(0,_.jsxs)("p",{children:[(0,_.jsx)("strong",{children:(0,a.__)("Warning:","code-snippets")}),"\n",(0,a.__)("Safe mode is active and snippets will not execute!","code-snippets"),"\n",(0,c.createInterpolateElement)((0,a.__)("Remove the <code>CODE_SNIPPETS_SAFE_MODE</code> constant from <code>wp-config.php</code> file to turn off safe mode.","code-snippets"),{code:(0,_.jsx)("code",{})}),"\n",(0,_.jsx)("a",{href:"https://codesnippets.pro/doc/safe-mode",target:"_blank",rel:"noreferrer",children:(0,a.__)("Read more","code-snippets")})]})}):null},Sl=function(){var e=Wo(),t=e.snippetView,n=e.setSnippetView,r=tc().currentType,s=function(){var e,t=zr().snippetsList,n=(0,i.useMemo)(function(){return null==t?void 0:t.filter(function(e){return!e.trashed})},[t]),r=(0,i.useMemo)(function(){return null==n?void 0:n.reduce(function(e,t){var n,r=Pr(t);return e.set(r,(null!==(n=e.get(r))&&void 0!==n?n:0)+1)},new Map)},[n]),s=null===(e=window.CODE_SNIPPETS_MANAGE)||void 0===e?void 0:e.typeCounts;return{getCount:(0,i.useCallback)(function(e){var t;return n?e?null!==(t=null==r?void 0:r.get(e))&&void 0!==t?t:0:n.length:null==s?void 0:s[null!=e?e:"all"]},[n,r,s])}}(),o=s.getCount,c=$o(),l=c.atStart,u=c.atEnd,d=c.scrollRef;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("div",{className:y()("snippet-type-nav-wrapper",{"has-scroll-start":!l,"has-scroll-end":!u}),children:(0,_.jsx)("nav",{ref:d,className:"snippet-type-nav","aria-label":(0,a.__)("Snippet types","code-snippets"),children:(0,_.jsxs)("ul",{children:[(0,_.jsx)(xl,{count:o()}),pr.map(function(e){return(0,_.jsx)(xl,{type:e,count:o(e)},e)})]})})}),(0,_.jsx)(En,{}),(0,_.jsxs)("div",{className:"snippets-page-header",children:[(0,_.jsx)("h1",{children:(0,a.sprintf)((0,a.__)("Local Snippets: %s","code-snippets"),r?xr[r]:(0,a.__)("All Snippets","code-snippets"))}),(0,_.jsx)("a",{href:kr(r),className:"button button-primary",children:(0,a.__)("Add Snippet","code-snippets")})]}),(0,_.jsx)("hr",{className:"wp-header-end"}),(0,_.jsx)(Ol,{}),r&&!C()&&Tr(r)?(0,_.jsx)(ss,{}):(0,_.jsx)(ac,{children:(0,_.jsx)(wl,{snippetView:t,setSnippetView:n})})]})},Pl=["snippets","blueprints","cloud-community","cloud-library","ai-agent"],Nl={snippets:{Component:function(){return(0,_.jsx)(kn,{children:(0,_.jsx)(Vr,{children:(0,_.jsx)($r,{children:(0,_.jsx)(nc,{children:(0,_.jsx)(Sl,{})})})})})}},blueprints:{Component:function(){return(0,_.jsx)(kn,{children:(0,_.jsx)(vi,{})})},demo:"announce"},"cloud-community":{Component:function(){return(0,_.jsx)(kn,{children:(0,_.jsx)(us,{children:(0,_.jsx)(ma,{children:(0,_.jsx)(Ka,{})})})})}},"cloud-library":{Component:function(){var e=function(){var e=(0,i.useMemo)(Fo,[]),t=s((0,i.useState)("idle"),2),n=t[0],r=t[1],o=(0,i.useRef)([]),a=(0,i.useCallback)(function(){o.current.forEach(window.clearTimeout),o.current=[]},[]);(0,i.useEffect)(function(){return function(){o.current.forEach(window.clearTimeout)}},[]);var c=(0,i.useCallback)(function(t){var n;r(t);var s=Lo[t];if(s){var i=e?250:null!==(n=Io[t])&&void 0!==n?n:3e3;o.current.push(window.setTimeout(function(){return c(s)},i))}},[e]),l=(0,i.useCallback)(function(){a(),c("library")},[c,a]),u=(0,i.useCallback)(function(){a(),r("idle"),o.current.push(window.setTimeout(function(){return c("library")},250))},[c,a]),d=(0,i.useCallback)(function(){a(),r("finished")},[a]);return{stage:n,hasStarted:"idle"!==n,isFinished:"finished"===n,reducedMotion:e,play:l,skip:d,replay:u}}(),t=e.stage,n=e.hasStarted,r=e.isFinished,o=e.reducedMotion,c=e.play,l=e.skip,u=e.replay,d=(0,i.useMemo)(Po,[]),p=s((0,i.useState)(),2),f=p[0],h=p[1],m=d.find(function(e){return xo===e.id});(0,i.useEffect)(function(){h("preview"===t?m:void 0)},[m,t]);var b=(0,i.useRef)(null);return(0,i.useEffect)(function(){var e;r&&(null===(e=b.current)||void 0===e||e.scrollIntoView({behavior:o?"auto":"smooth",block:"end"}))},[r,o]),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(En,{}),(0,_.jsx)(Ln,{title:(0,a.__)("Cloud Library","code-snippets"),description:(0,a.__)("A guided walkthrough of the Pro Cloud Library. Press play and watch a snippet move from your cloud onto this site.","code-snippets"),hasStarted:n,isFinished:r,onPlay:c,onSkip:l,onReplay:u}),(0,_.jsxs)("div",{className:"cloud-library-demo",children:[(0,_.jsx)("div",{className:"screen-reader-text","aria-live":"polite",children:Vo[t]}),(0,_.jsx)(Dn,{callout:Ro(t)}),(0,_.jsx)(Fn,Bo({},qo[t])),(0,_.jsx)("div",{className:"cloud-library-snippets snippets-list-view",children:(0,_.jsx)(oo,{fixed:!0,striped:!0,items:d,columns:To({stage:t,onPreview:h}),getKey:function(e){return e.id},rowClassName:function(e){return xo===e.id?"demo-featured-row":""}})}),r&&(0,_.jsx)("div",{ref:b,className:"cloud-library-demo__closing",children:(0,_.jsxs)(qs,{title:(0,a.__)("That was a demo — your cloud travels with you","code-snippets"),onReplay:u,children:[(0,_.jsx)("p",{children:(0,a.__)("The whole walkthrough was scripted and ran inside this plugin. These snippets are examples, and nothing was downloaded or saved.","code-snippets")}),(0,_.jsx)("p",{children:(0,a.__)("With Code Snippets Pro your Cloud Library is available on every site you connect, so a snippet written once can be reused everywhere and kept in sync.","code-snippets")})]})}),f&&(0,_.jsx)(Os,{title:f.name,code:f.code,type:Pr(f),onRequestClose:function(){return h(void 0)}})]})]})},demo:"quiet"},"ai-agent":{Component:function(){return(0,_.jsx)(kn,{children:(0,_.jsx)(Js,{})})},demo:"announce"}};function kl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Cl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?kl(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kl(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var El=function(e){return(0,_.jsx)("svg",Cl(Cl({width:"26",height:"26",viewBox:"0 0 26 26",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{},{children:(0,_.jsx)("path",{stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",d:"M13 3.25l2.167 5.583L20.75 11l-5.583 2.167L13 18.75l-2.167-5.583L5.25 11l5.583-2.167L13 3.25zM20.583 17.333l.65 1.734 1.734.65-1.734.65-.65 1.733-.65-1.733-1.733-.65 1.733-.65.65-1.734z"})}))};function Dl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Tl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Dl(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Dl(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Al=function(e){return(0,_.jsx)("svg",Tl(Tl({width:"26",height:"26",viewBox:"0 0 26 26",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{},{children:(0,_.jsx)("path",{stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",d:"M19.499 17.334a2.167 2.167 0 1 1-2.167 2.167m2.167-2.167a2.167 2.167 0 0 0-2.167 2.167m2.167-2.167V8.667m-2.167 10.834H8.665m0 0A2.167 2.167 0 0 0 6.5 17.334m2.166 2.167A2.167 2.167 0 1 1 6.5 17.334m0 0V8.667m2.166-2.166A2.167 2.167 0 1 0 6.5 8.667m2.166-2.166A2.167 2.167 0 0 1 6.5 8.667m2.166-2.166h8.667m0 0a2.167 2.167 0 1 1 2.167 2.166m-2.167-2.166a2.167 2.167 0 0 0 2.167 2.166M8.124 8.126l9.75 9.75m-9.75 0 9.75-9.75"})}))};function Rl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Il(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Rl(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Rl(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Ll=function(e){return(0,_.jsx)("svg",Il(Il({width:"26",height:"26",viewBox:"0 0 26 26",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{},{children:(0,_.jsx)("path",{d:"M20.0417 20.0417L22.75 22.75M4.33333 6.5H21.6667M4.33333 13H8.66666M4.33333 19.5H8.66666M11.9167 16.25C11.9167 17.3993 12.3732 18.5015 13.1859 19.3141C13.9985 20.1268 15.1007 20.5833 16.25 20.5833C17.3993 20.5833 18.5015 20.1268 19.3141 19.3141C20.1268 18.5015 20.5833 17.3993 20.5833 16.25C20.5833 15.1007 20.1268 13.9985 19.3141 13.1859C18.5015 12.3732 17.3993 11.9167 16.25 11.9167C15.1007 11.9167 13.9985 12.3732 13.1859 13.1859C12.3732 13.9985 11.9167 15.1007 11.9167 16.25Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}))};function Fl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ml(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fl(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fl(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Bl=function(e){return(0,_.jsx)("svg",Ml(Ml({width:"26",height:"26",viewBox:"0 0 26 26",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{},{children:(0,_.jsx)("path",{d:"M11.9167 19.5045H7.21175C4.42541 19.5002 2.16666 17.326 2.16666 14.6436C2.16666 11.9624 4.42541 9.78812 7.21175 9.78812C7.6375 7.87928 9.15525 6.32145 11.193 5.7007C13.2297 5.08103 15.4787 5.49162 17.0907 6.78403C18.7027 8.0732 19.4328 10.0416 19.0082 11.9505H20.0807C20.8821 11.9519 21.6621 12.2097 22.3067 12.686C22.9513 13.1624 23.4266 13.8324 23.6632 14.5981M21.6667 22.7502L23.8333 20.5835L21.6667 18.4169M18.4167 18.4169L16.25 20.5835L18.4167 22.7502",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}))};function Ul(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ql(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ul(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ul(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Vl=function(e){return(0,_.jsxs)("svg",ql(ql({width:"26",height:"26",viewBox:"0 0 26 26",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{},{children:[(0,_.jsx)("path",{d:"M11.1854 4.67675C11.6469 2.77442 14.3531 2.77442 14.8146 4.67675C14.8838 4.96253 15.0196 5.22793 15.2108 5.45133C15.402 5.67474 15.6432 5.84984 15.9149 5.96239C16.1865 6.07494 16.4809 6.12176 16.7741 6.09902C17.0673 6.07629 17.3509 5.98466 17.602 5.83158C19.2736 4.81325 21.1878 6.72642 20.1695 8.39908C20.0166 8.65004 19.9252 8.93353 19.9025 9.2265C19.8798 9.51948 19.9266 9.81367 20.039 10.0852C20.1514 10.3567 20.3263 10.5978 20.5495 10.789C20.7726 10.9802 21.0377 11.116 21.3233 11.1854C23.2256 11.6469 23.2256 14.3531 21.3233 14.8146C21.0375 14.8838 20.7721 15.0196 20.5487 15.2108C20.3253 15.402 20.1502 15.6432 20.0376 15.9149C19.9251 16.1865 19.8782 16.4809 19.901 16.7741C19.9237 17.0673 20.0153 17.3509 20.1684 17.602C21.1868 19.2736 19.2736 21.1878 17.6009 20.1695C17.35 20.0166 17.0665 19.9252 16.7735 19.9025C16.4805 19.8798 16.1863 19.9266 15.9148 20.039C15.6433 20.1514 15.4022 20.3263 15.211 20.5495C15.0198 20.7726 14.884 21.0377 14.8146 21.3233C14.3531 23.2256 11.6469 23.2256 11.1854 21.3233C11.1162 21.0375 10.9804 20.7721 10.7892 20.5487C10.598 20.3253 10.3568 20.1502 10.0851 20.0376C9.81347 19.9251 9.51907 19.8782 9.2259 19.901C8.93273 19.9237 8.64907 20.0153 8.398 20.1684C6.72642 21.1868 4.81217 19.2736 5.8305 17.6009C5.98336 17.35 6.07485 17.0665 6.09752 16.7735C6.1202 16.4805 6.07343 16.1863 5.96101 15.9148C5.84859 15.6433 5.6737 15.4022 5.45055 15.211C5.22739 15.0198 4.96228 14.884 4.67675 14.8146C2.77442 14.3531 2.77442 11.6469 4.67675 11.1854C4.96253 11.1162 5.22793 10.9804 5.45133 10.7892C5.67474 10.598 5.84984 10.3568 5.96239 10.0851C6.07494 9.81347 6.12176 9.51907 6.09902 9.2259C6.07629 8.93273 5.98466 8.64907 5.83158 8.398C4.81325 6.72642 6.72642 4.81217 8.39908 5.8305C9.48242 6.48917 10.8864 5.90633 11.1854 4.67675Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,_.jsx)("path",{d:"M9.75 13C9.75 13.862 10.0924 14.6886 10.7019 15.2981C11.3114 15.9076 12.138 16.25 13 16.25C13.862 16.25 14.6886 15.9076 15.2981 15.2981C15.9076 14.6886 16.25 13.862 16.25 13C16.25 12.138 15.9076 11.3114 15.2981 10.7019C14.6886 10.0924 13.862 9.75 13 9.75C12.138 9.75 11.3114 10.0924 10.7019 10.7019C10.0924 11.3114 9.75 12.138 9.75 13Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}))};function Wl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Hl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Wl(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wl(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var zl,$l,Gl=function(e){return(0,_.jsx)("svg",Hl(Hl({width:"26",height:"26",viewBox:"0 0 26 26",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{},{children:(0,_.jsx)("path",{d:"M7.58333 8.66634L3.25 12.9997L7.58333 17.333M18.4167 8.66634L22.75 12.9997L18.4167 17.333M15.1667 4.33301L10.8333 21.6663",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}))};function Kl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Jl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Kl(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Kl(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Ql,Yl,Xl,Zl=new URLSearchParams(window.location.search),eu=null!==(zl=window.CODE_SNIPPETS)&&void 0!==zl&&zl.urls.manage?new URL(window.CODE_SNIPPETS.urls.manage).searchParams.get("page"):null,tu=Zl.get("page")===eu?null!==($l=p("subpage",Pl))&&void 0!==$l?$l:Pl[0]:null,nu=function(e){var t=e.name,n=e.url,r=e.label,s=(0,i.useMemo)(function(){return new URL(n).searchParams.get("page")},[n]),o=!Zl.get("subpage")&&Zl.get("page")===s;return(0,_.jsx)("li",{children:(0,_.jsx)("a",Jl(Jl({href:n,className:y()("".concat(t,"-link"),{"active-link":o})},!s&&{target:"_blank",rel:"noopener noreferrer"}),{},{children:r}))})},ru=function(){var e,t,n,r,s;return(0,_.jsxs)(_.Fragment,{children:[(null===(e=window.CODE_SNIPPETS)||void 0===e?void 0:e.urls.insights)&&(0,_.jsx)(nu,{name:"insights",url:window.CODE_SNIPPETS.urls.insights,label:(0,a.__)("Insights","code-snippets")}),(null===(t=window.CODE_SNIPPETS)||void 0===t?void 0:t.urls.import)&&(0,_.jsx)(nu,{name:"import-snippets",url:window.CODE_SNIPPETS.urls.import,label:(0,a._x)("Import","snippets","code-snippets")}),(null===(n=window.CODE_SNIPPETS)||void 0===n?void 0:n.urls.welcome)&&(0,_.jsx)(nu,{name:"welcome",url:window.CODE_SNIPPETS.urls.welcome,label:(0,a.__)("What's New","code-snippets")}),(0,_.jsx)(nu,{name:"docs",url:"https://codesnippets.pro/docs",label:(0,a.__)("Docs","code-snippets")}),(0,_.jsx)(nu,{name:"cloud",url:null!==(r=null===(s=window.CODE_SNIPPETS)||void 0===s?void 0:s.urls.cloud)&&void 0!==r?r:"https://codesnippets.cloud",label:(0,a.__)("Cloud Dashboard","code-snippets")})]})},su=function(){return(0,_.jsx)("li",{className:"toolbar-more-item",children:(0,_.jsxs)("details",{className:"toolbar-more-menu",children:[(0,_.jsxs)("summary",{children:[(0,a.__)("More","code-snippets"),(0,_.jsx)("span",{className:"dashicons dashicons-arrow-down-alt2","aria-hidden":"true"})]}),(0,_.jsx)("ul",{children:(0,_.jsx)(ru,{})})]})})},iu=function(){var e,t=s((0,i.useState)(!1),2),n=t[0],r=t[1];return(0,_.jsxs)("div",{className:"code-snippets-toolbar-upper",children:[(0,_.jsxs)("div",{className:"logo",children:[(0,_.jsx)("img",{src:"".concat(null===(e=window.CODE_SNIPPETS)||void 0===e?void 0:e.urls.plugin,"/assets/icon.svg"),alt:(0,a.__)("Code Snippets logo","code-snippets"),"aria-hidden":"true"}),(0,_.jsx)("div",{children:(0,a.__)("Code Snippets","code-snippets")})]}),(0,_.jsx)("nav",{"aria-label":(0,a.__)("Main links","code-snippets"),children:(0,_.jsxs)("ul",{children:[(0,_.jsx)(ru,{}),(0,_.jsx)(su,{}),E()&&(0,_.jsx)("li",{className:"toolbar-upgrade-item",children:(0,_.jsx)("a",{className:"button button-large button-secondary",href:"https://codesnippets.pro/pricing/",target:"_blank",rel:"noopener noreferrer",onClick:function(e){e.preventDefault(),r(!0)},children:(0,a.__)("Upgrade to Pro","code-snippets")})})]})}),(0,_.jsx)(ns,{isOpen:n,setIsOpen:r})]})},ou=function(e){var t,n=e.subpage,r=e.label,s=e.Icon,i=Nl[n],o=i.demo,c=i.isPro,l="announce"===o&&!Bn(n);return(0,_.jsx)("li",{children:(0,_.jsxs)("a",{href:m(null===(t=window.CODE_SNIPPETS)||void 0===t?void 0:t.urls.manage,{subpage:n}),className:y()("".concat(n,"-link"),{"active-link":n===tu}),children:[(0,_.jsx)(s,{"aria-hidden":"true"}),(0,_.jsx)("span",{className:"toolbar-nav-label",children:r}),o&&(l?(0,_.jsx)("span",{className:"new-chip",children:(0,a.__)("New","code-snippets")}):(0,_.jsx)("span",{className:"demo-chip",children:(0,a.__)("Demo","code-snippets")})),c&&!C()&&(0,_.jsx)("span",{className:"pro-chip",children:(0,a.__)("Pro","code-snippets")})]})})},au=function(){var e;return null!==(e=window.CODE_SNIPPETS)&&void 0!==e&&e.urls.settings?(0,_.jsx)("li",{children:(0,_.jsxs)("a",{href:window.CODE_SNIPPETS.urls.settings,className:y()("settings-link",{"active-link":"snippets-settings"===Zl.get("page")}),children:[(0,_.jsx)(Vl,{"aria-hidden":"true"}),(0,_.jsx)("span",{className:"toolbar-nav-label",children:(0,a.__)("Settings","code-snippets")})]})}):null},cu=function(){return(0,_.jsx)("div",{className:"code-snippets-toolbar-lower",children:(0,_.jsx)("nav",{"aria-label":(0,a.__)("Main features","code-snippets"),children:(0,_.jsxs)("ul",{children:[(0,_.jsx)(ou,{subpage:"snippets",label:(0,a.__)("Snippets","code-snippets"),Icon:Gl}),C()&&(0,_.jsx)(ou,{subpage:"blueprints",label:(0,a.__)("Blueprints","code-snippets"),Icon:Al}),(0,_.jsx)(ou,{subpage:"cloud-community",label:(0,a.__)("Cloud Community","code-snippets"),Icon:Ll}),(0,_.jsx)(ou,{subpage:"cloud-library",label:(0,a.__)("Cloud Library","code-snippets"),Icon:Bl}),!C()&&(0,_.jsx)(ou,{subpage:"blueprints",label:(0,a.__)("Blueprints","code-snippets"),Icon:Al}),(0,_.jsx)(ou,{subpage:"ai-agent",label:(0,a.__)("AI Agent","code-snippets"),Icon:El}),(0,_.jsx)(au,{})]})})})},lu=function(){return(0,_.jsxs)("div",{className:"code-snippets-toolbar",children:[(0,_.jsx)(iu,{}),(0,_.jsx)(cu,{})]})},uu=function(){var e=s((0,i.useState)(function(){var e=d("result");return f({result:void 0}),e?function(e){switch(e){case"deleted":return{text:(0,a.__)("Snippet <strong>deleted</strong>.","code-snippets"),type:"success"};case"executed":return{text:(0,a.__)("Snippet <strong>executed</strong>.","code-snippets"),type:"success"};case"run-once-failed":return{text:(0,a.__)("The snippet could not be run. Check that its code is valid and try again.","code-snippets"),type:"error"};case"run-once-safe-mode":return{text:(0,a.__)("Snippet execution is disabled on this site, so the snippet was not run.","code-snippets"),type:"warning"};default:return}}(e):void 0}),2),t=e[0],n=e[1];return t?(0,_.jsx)(N,{className:"code-snippets-notice",onDismiss:function(){n(void 0)},type:t.type,children:(0,_.jsx)("p",{children:(0,c.createInterpolateElement)(t.text,{strong:(0,_.jsx)("strong",{})})})}):null},du=function(e){var t=e.subpage,n=Nl[t].Component;return(0,_.jsx)(n,{})};Ql="manage-snippets-container",Yl=function(){var e=(0,i.useMemo)(function(){var e;return null!==(e=p("subpage",Pl))&&void 0!==e?e:Pl[0]},[]);return(0,i.useEffect)(function(){var t,n,r,s;"snippets"===e&&(r=null==(n=document.getElementById("adv-settings"))?void 0:n.querySelector("fieldset.table-options-prefs"),s=Array.from(null!==(t=null==n?void 0:n.querySelectorAll("fieldset.metabox-prefs"))&&void 0!==t?t:[]).find(function(e){return!e.classList.contains("table-options-prefs")}),n&&r&&s&&n.insertBefore(r,s))},[e]),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(lu,{}),(0,_.jsx)(uu,{}),(0,_.jsx)(du,{subpage:e})]})},(Xl=document.getElementById(Ql))?(0,Jt.createRoot)(Xl).render((0,_.jsx)(Yl,{})):console.error("Could not find element #".concat(Ql,"."))})()})();