芝麻web文件管理V1.00
编辑当前文件:/home/royashxg/www/wp-content/plugins/blocksy-companion/static/bundle/options.js
!function(){var e={184:function(e,t){var n; /*! Copyright (c) 2017 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */!function(){"use strict";var o={}.hasOwnProperty;function r(){for(var e=[],t=0;t
2047?3:2;return e.charAt(n+c)!==t&&(c+=e.indexOf('"',n+c)-n-c),r=e.substring(n,n+c),n+=c+2,r},d=function(){var e=u();return o[r++]=e,e},p=function(){var t=e.charAt(n);return n+=2,t},m=function(){var e=p();switch(e){case"i":return i();case"s":return u();default:throw new Error("Unknown key type '"+e+"' at position "+(n-2))}},f=function(){var e,i,c,l,s,u=a(),d=[],p={},f=d,y=r++;o[y]=f;try{for(c=0;c
0)return o=e.substring(1,a),r=e.substr(a+1),"*"===o||t===o?r:o+"::"+r;var i="Expected two
characters in non-public property name '"+e+"' at position "+(n-e.length-2);throw new Error(i)}return e},h=function(){var e,i,c,l,s={},d=r++,p=u();o[d]=s,e=a();try{for(l=0;l
=0&&e.subscribers.splice(e.subscribers.indexOf(t),1)},e}},382:function(e,t,n){var o=n(313);e.exports=function(e){var t=o.useState(e.id),n=function(){return t[1](e.id)};return o.useEffect((function(){return e.subscribe(n),function(){return e.unsubscribe(n)}}),[]),t[0]}},313:function(e){"use strict";e.exports=window.React},61:function(e,t,n){var o=n(698).default;function r(){"use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */e.exports=r=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,a=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},c=i.iterator||"@@iterator",l=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function d(e,t,n,o){var r=t&&t.prototype instanceof f?t:f,a=Object.create(r.prototype),i=new j(o||[]);return a._invoke=function(e,t,n){var o="suspendedStart";return function(r,a){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===r)throw a;return S()}for(n.method=r,n.arg=a;;){var i=n.delegate;if(i){var c=O(i,n);if(c){if(c===m)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===o)throw o="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o="executing";var l=p(e,t,n);if("normal"===l.type){if(o=n.done?"completed":"suspendedYield",l.arg===m)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o="completed",n.method="throw",n.arg=l.arg)}}}(e,n,i),a}function p(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=d;var m={};function f(){}function y(){}function h(){}var v={};u(v,c,(function(){return this}));var b=Object.getPrototypeOf,_=b&&b(b(C([])));_&&_!==n&&a.call(_,c)&&(v=_);var g=h.prototype=f.prototype=Object.create(v);function E(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function w(e,t){function n(r,i,c,l){var s=p(e[r],e,i);if("throw"!==s.type){var u=s.arg,d=u.value;return d&&"object"==o(d)&&a.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,c,l)}),(function(e){n("throw",e,c,l)})):t.resolve(d).then((function(e){u.value=e,c(u)}),(function(e){return n("throw",e,c,l)}))}l(s.arg)}var r;this._invoke=function(e,o){function a(){return new t((function(t,r){n(e,o,t,r)}))}return r=r?r.then(a,a):a()}}function O(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,O(e,t),"throw"===t.method))return m;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return m}var o=p(n,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,m;var r=o.arg;return r?r.done?(t[e.resultName]=r.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,m):r:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,m)}function k(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function j(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(k,this),this.reset(!0)}function C(e){if(e){var t=e[c];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n
=0;--o){var r=this.tryEntries[o],i=r.completion;if("root"===r.tryLoc)return n("end");if(r.tryLoc<=this.prev){var c=a.call(r,"catchLoc"),l=a.call(r,"finallyLoc");if(c&&l){if(this.prev
=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&a.call(o,"finallyLoc")&&this.prev
=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),x(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var o=n.completion;if("throw"===o.type){var r=o.arg;x(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:C(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),m}},t}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports},698:function(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},687:function(e,t,n){var o=n(61)();e.exports=o;try{regeneratorRuntime=o}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=o:Function("r","regeneratorRuntime = r")(o)}}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var a=t[o]={exports:{}};return e[o].call(a.exports,a,a.exports,n),a.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},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=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){"use strict";var e=window.wp.element,t=window.wp.components;function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n
=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o
=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function m(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function f(e){for(var t=1;t
0&&void 0!==arguments[0]?arguments[0]:null,n=(0,e.useContext)(M),o=n.isAdvancedMode,r=n.remoteConditions,a=n.allTaxonomies,i=n.allLanguages,c=n.allUsers,s=r;return{isAdvancedMode:o,allRules:s.reduce((function(e,t){var n=t.rules,o=t.title;return[].concat(l(e),l(n.map((function(e){return f(f({},e),{},{group:o})}))))}),[]).reduce((function(e,n){var o=n.title,r=n.id,a=n.sub_ids,i=void 0===a?[]:a,c=p(n,["title","id","sub_ids"]);return[].concat(l(e),[f({key:t&&i.length>0&&i.find((function(e){return e.id===t.rule}))?t.rule:r,value:o,sub_ids:i},c)])}),[]),rulesToUse:s,allTaxonomies:a,allLanguages:i,allUsers:c}};function h(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function v(e){for(var t=1;t
0&&void 0!==arguments[0]?arguments[0]:"";fetch("".concat(wp.ajax.settings.url,"?action=blocksy_conditions_get_all_posts"),{headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(v(v({post_type:d},e?{search_query:e}:{}),p?{alsoInclude:p}:{})),method:"POST"}).then((function(e){return e.json()})).then((function(e){var t=e.data.posts;u((function(e){return b([].concat(l(e),l(t)))})),_=b([].concat(l(_),l(t)))}))};return(0,e.useEffect)((function(){m()}),[d]),(0,e.createElement)(c.Select,{option:{appendToBody:!0,defaultToFirstItem:!1,searchPlaceholder:(0,i.__)("Type to search by ID or title...","blocksy-companion"),placeholder:"post_ids"===n.rule?(0,i.__)("Select post","blocksy-companion"):"page_ids"===n.rule?(0,i.__)("Select page","blocksy-companion"):"product_ids"===n.rule?(0,i.__)("Select product","blocksy-companion"):(0,i.__)("Custom Post Type ID","blocksy-companion"),choices:l(s.filter((function(e){var t=e.post_type;return"ct_cpt"===d?"post"!==t&&"page"!==t:d===t})).map((function(e){return{key:e.ID,value:e.post_title}}))),search:!0},value:p,onChange:function(e){return o(e)},onInputValueChange:function(e){s.find((function(t){return t.post_title===e}))||m(e)}})};function E(){return E=Object.assign?Object.assign.bind():function(e){for(var t=1;t
(o.payload.end?new Date(o.payload.end).getTime():(new Date).getTime())&&(o.payload.end=e),n(O(O({},o),{},{payload:O(O(O({},o.payload),o.payload.start?{}:{start:_}),{},s({},l,e))}))}})),document.body))},x=window.wp.date;function j(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function C(e){for(var t=1;t
0||v&&v.is_custom_rule&&v.has_text_field||v&&v.is_custom_rule&&v.choices;return(0,e.createElement)("div",{className:d()("ct-condition-group",o,{"ct-cols-3":b,"ct-cols-2":!b})},(0,e.createElement)(c.Select,{key:"first",option:{inputClassName:"ct-condition-type",selectInputStart:function(){return"include"===r.type?(0,e.createElement)("span",{className:"ct-include"},(0,e.createElement)("svg",{width:"8",height:"8",fill:"currentColor",viewBox:"0 0 20 20"},(0,e.createElement)("path",{d:"M20,11h-9v9H9v-9H0V9h9V0h2v9h9V11z"}))):"exclude"===r.type?(0,e.createElement)("span",{className:"ct-exclude"},(0,e.createElement)("svg",{width:"8",height:"8",fill:"currentColor",viewBox:"0 0 20 20"},(0,e.createElement)("path",{d:"M20,9v2H0V9H20z"}))):null},placeholder:(0,i.__)("Select variation","blocksy-companion"),choices:{include:(0,i.__)("Include","blocksy-companion"),exclude:(0,i.__)("Exclude","blocksy-companion")}},value:r.type,onChange:function(e){s(P(P({},r),{},{type:e}))}}),(0,e.createElement)(c.Select,{key:"second",option:{appendToBody:!0,placeholder:(0,i.__)("Select rule","blocksy-companion"),choices:p,search:!0},value:r.rule,onChange:function(e){var t=p.find((function(t){return t.key===e}));t.sub_ids&&t.sub_ids.length>0?s(P(P({},r),{},{rule:t.sub_ids[0].id})):s(P(P({},r),{},{rule:e}))}}),("post_ids"===r.rule||"custom_post_type_ids"===r.rule||"product_ids"===r.rule||"page_ids"===r.rule)&&(0,e.createElement)(g,{condition:r,onChange:function(e){s(P(P({},r),{},{payload:P(P({},r.payload),{},{post_id:e})}))}}),("taxonomy_ids"===r.rule||"post_with_taxonomy_ids"===r.rule||"card_post_with_taxonomy_ids"===r.rule)&&(0,e.createElement)(c.Select,{option:{appendToBody:!0,defaultToFirstItem:!1,placeholder:(0,i.__)("Select taxonomy","blocksy-companion"),choices:m.filter((function(e){return!Object.values((null==e?void 0:e.post_types)||[]).includes("product")})).map((function(e){return P({key:e.id,value:e.name},e.group?{group:e.group}:{})})),search:!0},value:(r.payload||{}).taxonomy_id||"",onChange:function(e){s(P(P({},r),{},{payload:P(P({},r.payload),{},{taxonomy_id:e})}))}}),("product_with_taxonomy_ids"===r.rule||"product_taxonomy_ids"===r.rule||"card_product_with_taxonomy_ids"===r.rule)&&(0,e.createElement)(c.Select,{option:{appendToBody:!0,defaultToFirstItem:!1,placeholder:(0,i.__)("Select taxonomy","blocksy-companion"),choices:m.filter((function(e){return((null==e?void 0:e.post_types)||[]).includes("product")})).map((function(e){return P({key:e.id,value:e.name},e.group?{group:e.group}:{})})),search:!0},value:(r.payload||{}).taxonomy_id||"",onChange:function(e){s(P(P({},r),{},{payload:P(P({},r.payload),{},{taxonomy_id:e})}))}}),"current_language"===r.rule&&(0,e.createElement)(c.Select,{option:{appendToBody:!0,defaultToFirstItem:!1,placeholder:(0,i.__)("Select language","blocksy-companion"),choices:f.map((function(e){return{key:e.id,value:e.name}})),search:!0},value:(r.payload||{}).language||"",onChange:function(e){s(P(P({},r),{},{payload:P(P({},r.payload),{},{language:e})}))}}),"user_post_author_id"===r.rule&&(0,e.createElement)(c.Select,{option:{appendToBody:!0,defaultToFirstItem:!1,placeholder:(0,i.__)("Select user","blocksy-companion"),choices:[{key:"current_user",value:(0,i.__)("Current user","blocksy-companion")}].concat(l(h.map((function(e){return{key:e.id,value:e.name}})))),search:!0},value:(r.payload||{}).user_id||"",onChange:function(e){s(P(P({},r),{},{payload:P(P({},r.payload),{},{user_id:e})}))}}),"author"===r.rule&&(0,e.createElement)(c.Select,{option:{appendToBody:!0,placeholder:(0,i.__)("Select user","blocksy-companion"),choices:[{key:"all_users",value:(0,i.__)("All authors","blocksy-companion")}].concat(l(h.map((function(e){return{key:e.id,value:e.name}})))),search:!0},value:(r.payload||{}).user_id||"all_users",onChange:function(e){s(P(P({},r),{},{payload:P(P({},r.payload),{},{user_id:e})}))}}),v&&v.sub_ids&&v.sub_ids.length>0&&(0,e.createElement)(c.Select,{option:{appendToBody:!0,placeholder:(0,i.__)("Select sub field","blocksy-companion"),choices:v.sub_ids.map((function(e){return{key:e.id,value:e.title}})),search:!0,inputClassName:"ct-dropdown-normal-width"},value:r.rule,onChange:function(e){s(P(P({},r),{},{rule:e}))}}),"start_end_date"===r.rule&&(0,e.createElement)(k,{condition:r,onChange:s}),"schedule_date"===r.rule&&(0,e.createElement)(S,{condition:r,onChange:s}),"request_referer"===r.rule&&(0,e.createElement)("div",{className:"ct-option-input"},(0,e.createElement)("input",{type:"text",placeholder:"website.com",value:r.payload.referer,onChange:function(e){s(P(P({},r),{},{payload:P(P({},r.payload),{},{referer:e.target.value})}))}}),(0,e.createElement)("span",{className:"ct-condition-info","data-tooltip-reveal":"top"},(0,e.createElement)("svg",{width:"16",height:"16",viewBox:"0 0 24 24"},(0,e.createElement)("path",{d:"M12,2C6.477,2,2,6.477,2,12s4.477,10,10,10s10-4.477,10-10S17.523,2,12,2z M12,17L12,17c-0.552,0-1-0.448-1-1v-4 c0-0.552,0.448-1,1-1h0c0.552,0,1,0.448,1,1v4C13,16.552,12.552,17,12,17z M12.5,9h-1C11.224,9,11,8.776,11,8.5v-1 C11,7.224,11.224,7,11.5,7h1C12.776,7,13,7.224,13,7.5v1C13,8.776,12.776,9,12.5,9z"})),(0,e.createElement)("i",{className:"ct-tooltip"},(0,i.__)("Display based on referer domain","blocksy-companion")))),"request_cookie"===r.rule&&(0,e.createElement)("div",{className:"ct-option-input"},(0,e.createElement)("input",{type:"text",placeholder:"cookie_name",value:(r.payload||{}).cookie||"",onChange:function(e){s(P(P({},r),{},{payload:P(P({},r.payload),{},{cookie:e.target.value})}))}}),(0,e.createElement)("span",{className:"ct-condition-info","data-tooltip-reveal":"top"},(0,e.createElement)("svg",{width:"16",height:"16",viewBox:"0 0 24 24"},(0,e.createElement)("path",{d:"M12,2C6.477,2,2,6.477,2,12s4.477,10,10,10s10-4.477,10-10S17.523,2,12,2z M12,17L12,17c-0.552,0-1-0.448-1-1v-4 c0-0.552,0.448-1,1-1h0c0.552,0,1,0.448,1,1v4C13,16.552,12.552,17,12,17z M12.5,9h-1C11.224,9,11,8.776,11,8.5v-1 C11,7.224,11.224,7,11.5,7h1C12.776,7,13,7.224,13,7.5v1C13,8.776,12.776,9,12.5,9z"})),(0,e.createElement)("i",{className:"ct-tooltip"},(0,i.__)("Display if cookie is present","blocksy-companion")))),"request_url"===r.rule&&(0,e.createElement)("div",{className:"ct-option-input"},(0,e.createElement)("input",{type:"text",placeholder:"example=campaignID",value:r.payload.url||"",onChange:function(e){s(P(P({},r),{},{payload:P(P({},r.payload),{},{url:e.target.value})}))}}),(0,e.createElement)("span",{className:"ct-condition-info","data-tooltip-reveal":"top"},(0,e.createElement)("svg",{width:"16",height:"16",viewBox:"0 0 24 24"},(0,e.createElement)("path",{d:"M12,2C6.477,2,2,6.477,2,12s4.477,10,10,10s10-4.477,10-10S17.523,2,12,2z M12,17L12,17c-0.552,0-1-0.448-1-1v-4 c0-0.552,0.448-1,1-1h0c0.552,0,1,0.448,1,1v4C13,16.552,12.552,17,12,17z M12.5,9h-1C11.224,9,11,8.776,11,8.5v-1 C11,7.224,11.224,7,11.5,7h1C12.776,7,13,7.224,13,7.5v1C13,8.776,12.776,9,12.5,9z"})),(0,e.createElement)("i",{className:"ct-tooltip"},(0,i.__)("Display if query string is present in URL","blocksy-companion")))),v&&v.is_custom_rule&&v.has_text_field&&(0,e.createElement)("div",{className:"ct-option-input"},(0,e.createElement)("input",{type:"text",placeholder:"",value:r.payload.value||"",onChange:function(e){s(P(P({},r),{},{payload:P(P({},r.payload),{},{value:e.target.value})}))}})),v&&v.is_custom_rule&&v.choices&&(0,e.createElement)(c.Select,{option:{appendToBody:!0,placeholder:(0,i.__)("Select value","blocksy-companion"),choices:v.choices,search:!0,inputClassName:"ct-dropdown-normal-width"},value:r.payload.value||v.choices[0].key,onChange:function(e){s(P(P({},r),{},{payload:P(P({},r.payload),{},{value:e})}))}}),(0,e.createElement)("button",{type:"button",className:"ct-remove-condition-group",onClick:function(e){e.preventDefault(),a()}},(0,e.createElement)("svg",{width:"7px",height:"7px",fill:"currentColor",viewBox:"0 0 24 24"},(0,e.createElement)("path",{d:"m12 14.7 9.3 9.3 2.7-2.7-9.3-9.3L24 2.7 21.3 0 12 9.3 2.7 0 0 2.7 9.3 12 0 21.3 2.7 24l9.3-9.3z"}))))};function T(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function L(e){for(var t=1;t
0?[L(L({},n),{},{conditions:t})]:[]),l(o.conditions.slice(a+1))))},onChange:function(e){0===e.length?r([].concat(l(o.conditions.slice(0,a)),l(o.conditions.slice(a+1)))):r(o.conditions.map((function(t,n){return L({},n===a?L(L({},t),{},{conditions:e}):t)})))}})),n.relation||(i=(0,e.createElement)(D,{className:s,condition:n,onChange:function(e){r(o.conditions.map((function(t,n){return L({},n===a?e:t)})))},onAdd:function(){"OR"!==o.relation?r([].concat(l(o.conditions),[{type:"include",rule:v[0].rules[0].id,payload:{}}])):r(o.conditions.map((function(e,t){return L({},t===a?{relation:"AND",conditions:[e,{type:"include",rule:v[0].rules[0].id,payload:{}}]}:e)})))},onRemove:function(){r([].concat(l(o.conditions.slice(0,a)),l(o.conditions.slice(a+1))))}})),(0,e.createElement)(e.Fragment,{key:a},b&&a>0&&(0,e.createElement)("div",{className:d()("ct-condition-relation",{"ct-hovered":m===a})},(0,e.createElement)("ul",{onMouseEnter:function(){f(a)},onMouseLeave:function(){f(null)}},"AND"===o.relation&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)("li",{onClick:function(){c&&(f(null),c(a))}},(0,e.createElement)("span",null,"OR")),(0,e.createElement)("li",{className:"active"},(0,e.createElement)("span",null,"AND"))),"OR"===o.relation&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)("li",{className:"active"},(0,e.createElement)("span",null,"OR")),(0,e.createElement)("li",{onClick:function(){f(null),r([].concat(l(o.conditions.slice(0,a-1)),[{relation:"AND",conditions:o.conditions.slice(a-1,a+1).reduce((function(e,t){return[].concat(l(e),l(t.conditions?t.conditions:[t]))}),[])}],l(o.conditions.slice(a+1,o.conditions.length))))}},(0,e.createElement)("span",null,"AND"))))),i)}));return"OR"===o.relation&&1===o.conditions.length||!b?_:(0,e.createElement)("div",{className:d()("ct-relation-group",u),"data-relation":o.relation},_,"AND"===o.relation&&(0,e.createElement)("div",{className:"ct-condition-relation ct-add-and-relation"},(0,e.createElement)("span",{onClick:function(){r([].concat(l(o.conditions),[{type:"include",rule:v[0].rules[0].id,payload:{}}]))}},(0,e.createElement)("svg",{width:"8",height:"8",fill:"currentColor",viewBox:"0 0 20 20"},(0,e.createElement)("path",{d:"M20,11h-9v9H9v-9H0V9h9V0h2v9h9V11z"})))))};function z(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function R(e){for(var t=1;t
1||j.conditions.find((function(e){return e.relation})))&&(0,e.createElement)("span",null,(0,i.__)("Advanced Mode","blocksy-companion"),(0,e.createElement)(c.Switch,{value:C,onChange:function(e){j.conditions.find((function(e){return e.relation}))&&o(R(R({},j),{},{conditions:j.conditions.reduce((function(e,t){return[].concat(l(e),l(t.conditions?t.conditions:[t]))}),[])})),x(e)},option:{behavior:"boolean"}})))))},V=function(t){var n=t.option,o=n.display,r=void 0===o?"inline":o,l=n.filter,s=void 0===l?"all":l,u=n.modalTitle,d=void 0===u?(0,i.__)("Transparent Header Display Conditions","blocksy-companion"):u,p=n.modalDescription,m=void 0===p?(0,i.__)("Add one or more conditions to display the transparent header.","blocksy-companion"):p,f=n.addConditionButtonLabel,y=void 0===f?(0,i.__)("Add Display Condition","blocksy-companion"):f,h=t.value,v=t.onChange,b=a((0,e.useState)(!1),2),_=b[0],g=b[1],E=a((0,e.useState)(null),2),w=E[0],O=E[1];return"inline"===r?(0,e.createElement)(H,{filter:s,value:h,onChange:v,addConditionButtonLabel:y}):(0,e.createElement)(e.Fragment,null,(0,e.createElement)("button",{className:"button-primary",style:{width:"100%"},onClick:function(e){e.preventDefault(),g(!0),O(null)}},Object.keys(h).length>0?(0,i.__)("Edit Conditions","blocksy-companion"):(0,i.__)("Add Conditions","blocksy-companion")),(0,e.createElement)(c.Overlay,{items:_,className:"ct-admin-modal ct-builder-conditions-modal",onDismiss:function(){g(!1),O(null)},render:function(){return(0,e.createElement)("div",{className:"ct-modal-content"},(0,e.createElement)("h2",null,d),(0,e.createElement)("p",null,m),(0,e.createElement)("div",{className:"ct-modal-scroll"},(0,e.createElement)(H,{filter:s,value:w||h,onChange:function(e){O(e)},addConditionButtonLabel:y})),(0,e.createElement)("div",{className:"ct-modal-actions has-divider"},(0,e.createElement)("button",{className:"button-primary",disabled:!w,onClick:function(){v(w),g(!1)}},(0,i.__)("Save Conditions","blocksy-companion"))))}}))};function G(e){return G="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},G(e)}var q="object"===("undefined"==typeof window?"undefined":G(window))&&window.window===window?window:"object"===("undefined"==typeof self?"undefined":G(self))&&self.self===self?self:"object"===(void 0===n.g?"undefined":G(n.g))&&n.g.global===n.g?n.g:void 0;function Y(e,t,n){var o=new XMLHttpRequest;o.open("GET",e),o.responseType="blob",o.onload=function(){X(o.response,t,n)},o.onerror=function(){console.error("could not download file")},o.send()}function J(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return t.status>=200&&t.status<=299}function W(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(n){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var X="object"!==("undefined"==typeof window?"undefined":G(window))||window!==q?function(){}:"download"in HTMLAnchorElement.prototype?function(e,t,n){var o=q.URL||q.webkitURL,r=document.createElement("a");t=t||e.name||"download",r.download=t,r.rel="noopener","string"==typeof e?(r.href=e,r.origin!==location.origin?J(r.href)?Y(e,t,n):W(r,r.target="_blank"):W(r)):(r.href=o.createObjectURL(e),setTimeout((function(){o.revokeObjectURL(r.href)}),4e4),setTimeout((function(){W(r)}),0))}:"msSaveOrOpenBlob"in navigator?function(e,t,n){if(t=t||e.name||"download","string"==typeof e)if(J(e))Y(e,t,n);else{var o=document.createElement("a");o.href=e,o.target="_blank",setTimeout((function(){W(o)}))}else navigator.msSaveOrOpenBlob(function(e,t){return void 0===t?t={autoBom:!1}:"object"!==G(t)&&(console.warn("Deprecated: Expected third argument to be a object"),t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([String.fromCharCode(65279),e],{type:e.type}):e}(e,n),t)}:function(e,t,n,o){if((o=o||open("","_blank"))&&(o.document.title=o.document.body.innerText="downloading..."),"string"==typeof e)return Y(e,t,n);var r="application/octet-stream"===e.type,a=/constructor/i.test(q.HTMLElement)||q.safari,i=/CriOS\/[\d]+/.test(navigator.userAgent);if((i||r&&a)&&"object"===("undefined"==typeof FileReader?"undefined":G(FileReader))){var c=new FileReader;c.onloadend=function(){var e=c.result;e=i?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),o?o.location.href=e:location=e,o=null},c.readAsDataURL(e)}else{var l=q.URL||q.webkitURL,s=l.createObjectURL(e);o?o.location=s:location.href=s,o=null,setTimeout((function(){l.revokeObjectURL(s)}),4e4)}},K=X,$=n(539),Q=n.n($),Z=function(){var t=a((0,e.useState)(null),2),n=t[0],o=t[1],r=a((0,e.useState)(null),2),s=r[0],u=r[1],p=a((0,e.useState)(!1),2),m=p[0],f=p[1],y=a((0,e.useState)(!1),2),h=y[0],v=y[1],b=a((0,e.useState)(!1),2),_=b[0],g=b[1],E=a((0,e.useState)(["options"]),2),w=E[0],O=E[1],k=(0,e.useRef)(),x=(0,e.useRef)();return(0,e.useEffect)((function(){var e=function(e){e.stopPropagation(),e.preventDefault(),e.dataTransfer.dropEffect="copy",f(!0)},t=function(e){e.stopPropagation(),e.preventDefault(),f(!1)},n=function(e){e.stopPropagation(),e.preventDefault(),f(!1);var t=Array.from(e.dataTransfer.files||[]);if(Array.from(e.dataTransfer.items||[]).length>0){var n=e.dataTransfer.items[0].getAsFile();o(n)}else t.length>0&&o(t[0])};return x.current.addEventListener("dragover",e,!1),x.current.addEventListener("dragleave",t,!1),x.current.addEventListener("drop",n,!1),function(){x.current&&(x.current.removeEventListener("dragover",e,!1),x.current.removeEventListener("dragleave",t,!1),x.current.removeEventListener("drop",n,!1))}}),[]),(0,e.createElement)("div",{className:"ct-import-export"},(0,e.createElement)("div",{className:"ct-title","data-type":"simple"},(0,e.createElement)("h3",null,(0,i.__)("Export Options","blocksy-companion")),(0,e.createElement)("div",{className:"ct-option-description"},(0,i.__)("Easily export the theme customizer settings.","blocksy-companion"))),(0,e.createElement)("div",{className:"ct-control","data-design":"block"},(0,e.createElement)("header",null),(0,e.createElement)("section",null,(0,e.createElement)("button",{className:"button-primary",onClick:function(e){e.preventDefault(),v(!0)}},(0,i.__)("Export Customizations","blocksy-companion")))),(0,e.createElement)("div",{className:"ct-title","data-type":"simple"},(0,e.createElement)("h3",null,(0,i.__)("Import Options","blocksy-companion")),(0,e.createElement)("div",{className:"ct-option-description"},(0,i.__)("Easily import the theme customizer settings.","blocksy-companion"))),(0,e.createElement)("div",{className:"ct-control","data-design":"block"},(0,e.createElement)("header",null),(0,e.createElement)("section",null,(0,e.createElement)("div",{className:"ct-file-upload"},(0,e.createElement)("div",{className:"ct-attachment"},(0,e.createElement)("button",{type:"button",className:d()("ct-upload-button",{active:m}),ref:x,onClick:function(){k.current.click()}},n?n.name:(0,i.__)("Click or drop to upload a file...","blocksy-companion"))),(0,e.createElement)("input",{ref:k,type:"file",onChange:function(e){var t=a(e.target.files,1)[0];o(t)}}),(0,e.createElement)("button",{className:d()("button-primary",{"ct-loading":_}),disabled:!n,onClick:function(e){if(e.preventDefault(),n){g(!0);var t=new FileReader;t.readAsText(n,"UTF-8"),t.onload=function(e){try{fetch("".concat(window.ajaxurl,"?action=blocksy_customizer_import&wp_customize=on&nonce=").concat(ct_customizer_localizations.customizer_reset_none),{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(Q()(e.target.result))}).then((function(e){200===e.status&&e.json().then((function(e){e.success,e.data;location.reload()}))}))}catch(e){}}}}},_?(0,e.createElement)("svg",{width:"14",height:"14",viewBox:"0 0 100 100"},(0,e.createElement)("g",{transform:"translate(50,50)"},(0,e.createElement)("g",{transform:"scale(1)"},(0,e.createElement)("circle",{cx:"0",cy:"0",r:"50",fill:"currentColor"}),(0,e.createElement)("circle",{cx:"0",cy:"-26",r:"12",fill:"var(--ui-accent-color)",transform:"rotate(161.634)"},(0,e.createElement)("animateTransform",{attributeName:"transform",type:"rotate",calcMode:"linear",values:"0 0 0;360 0 0",keyTimes:"0;1",dur:"1s",begin:"0s",repeatCount:"indefinite"}))))):(0,i.__)("Import Customizations","blocksy-companion"))))),ct_customizer_localizations.has_child_theme&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"ct-title","data-type":"simple"},(0,e.createElement)("h3",null,(0,i.__)("Copy Options","blocksy-companion")),(0,e.createElement)("div",{className:"ct-option-description"},(0,i.__)("Copy and import your customizations from parent or child theme.","blocksy-companion"))),ct_customizer_localizations.is_parent_theme&&(0,e.createElement)("div",{className:"ct-control","data-design":"block"},(0,e.createElement)("header",null),(0,e.createElement)("section",null,(0,e.createElement)("button",{className:"button-primary",onClick:function(e){e.preventDefault(),u("child")}},(0,i.__)("Copy From Child Theme","blocksy-companion")))),!ct_customizer_localizations.is_parent_theme&&(0,e.createElement)("div",{className:"ct-control","data-design":"block"},(0,e.createElement)("header",null),(0,e.createElement)("section",null,(0,e.createElement)("button",{className:"button-primary",onClick:function(e){e.preventDefault(),u("parent")}},(0,i.__)("Copy From Parent Theme","blocksy-companion"))))),(0,e.createElement)(c.Overlay,{items:s,className:"ct-admin-modal ct-import-export-modal",onDismiss:function(){return u(!1)},render:function(){return(0,e.createElement)("div",{className:"ct-modal-content"},(0,e.createElement)("h2",{className:"ct-modal-title"},!ct_customizer_localizations.is_parent_theme&&(0,i.__)("Copy From Parent Theme","blocksy-companion"),ct_customizer_localizations.is_parent_theme&&(0,i.__)("Copy From Child Theme","blocksy-companion")),(0,e.createElement)("p",null,!ct_customizer_localizations.is_parent_theme&&(0,i.__)("You are about to copy all the settings from your parent theme into the child theme. Are you sure you want to continue?","blocksy-companion"),ct_customizer_localizations.is_parent_theme&&(0,i.__)("You are about to copy all the settings from your child theme into the parent theme. Are you sure you want to continue?","blocksy-companion")),(0,e.createElement)("div",{className:"ct-modal-actions has-divider","data-buttons":"2"},(0,e.createElement)("button",{onClick:function(e){e.preventDefault(),e.stopPropagation(),u(!1)},className:"button"},(0,i.__)("Cancel","blocksy-companion")),(0,e.createElement)("button",{className:"button button-primary",onClick:function(e){e.preventDefault();var t=new FormData;t.append("action","blocksy_customizer_copy_options"),t.append("wp_customize","on"),t.append("strategy",s);try{fetch(window.ajaxurl,{method:"POST",body:t}).then((function(e){200===e.status&&e.json().then((function(e){e.success,e.data;location.reload()}))}))}catch(e){}}},(0,i.__)("Yes, I am sure","blocksy-companion"))))}}),(0,e.createElement)(c.Overlay,{items:h,className:"ct-admin-modal ct-export-modal",onDismiss:function(){return v(!1)},render:function(){return(0,e.createElement)("div",{className:"ct-modal-content"},(0,e.createElement)("h2",{className:"ct-modal-title"},(0,i.__)("Export Settings","blocksy-companion")),(0,e.createElement)("p",null,(0,i.__)("Choose what set of settings you want to export.","blocksy-companion")),(0,e.createElement)("div",{className:"ct-checkboxes-container","data-type":"grid:bordered"},["options","widgets"].map((function(t){return(0,e.createElement)("div",{className:"ct-checkbox-container",onClick:function(){1===w.length&&w[0]===t||O((function(e){return e.includes(t)?e.filter((function(e){return e!==t})):[].concat(l(e),[t])}))}},(0,e.createElement)("span",{className:d()("ct-checkbox",{active:w.includes(t)})},(0,e.createElement)("svg",{width:"10",height:"8",viewBox:"0 0 11.2 9.1"},(0,e.createElement)("polyline",{className:"check",points:"1.2,4.8 4.4,7.9 9.9,1.2 "}))),{options:(0,i.__)("Customizer settings","blocksy-companion"),widgets:(0,i.__)("Widgets settings","blocksy-companion")}[t])}))),(0,e.createElement)("div",{className:"ct-modal-actions has-divider","data-buttons":"2"},(0,e.createElement)("button",{onClick:function(e){e.preventDefault(),e.stopPropagation(),v(!1)},className:"button"},(0,i.__)("Cancel","blocksy-companion")),(0,e.createElement)("button",{className:"button button-primary",onClick:function(e){e.preventDefault();var t=new FormData;t.append("action","blocksy_customizer_export"),t.append("strategy",w.join(":")),t.append("wp_customize","on");try{fetch(window.ajaxurl,{method:"POST",body:t}).then((function(e){200===e.status&&e.json().then((function(e){var t=e.success,n=e.data;if(t){var o=new Blob([n.data],{type:"application/octet-stream;charset=utf-8"});K(o,"".concat(n.site_url.replace("http://","").replace("https://","").replace(".","-").replace("/","-"),"-export.dat")),v(!1)}}))}))}catch(e){}}},(0,i.__)("Export","blocksy-companion"))))}}))},ee=window.ctEvents,te=n.n(ee),ne=window.wp.hooks;function oe(e,t,n,o,r,a,i){try{var c=e[a](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(o,r)}var re=n(687),ae=n.n(re),ie=n(459),ce=n.n(ie),le=n(616),se=n.n(le),ue=n(382),de=n.n(ue),pe=se()(),me=function(t){t.forcedEdit;var n,o,r=t.headerId,u=a((0,e.useState)(!1),2),d=u[0],p=u[1],m=a((0,e.useState)(null),2),f=m[0],y=m[1],h=(0,e.useContext)(c.PlacementsDragDropContext),v=(h.builderValueCollection,h.builderValueDispatch,(0,e.useRef)()),b=de()(pe),_=ce()("".concat(blocksy_admin.ajax_url,"?action=blocksy_header_get_all_conditions"),{method:"POST",formatter:(n=ae().mark((function e(t){var n,o,r;return ae().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.json();case 2:if(n=e.sent,o=n.success,r=n.data,o&&r.conditions){e.next=7;break}throw new Error;case 7:return e.abrupt("return",r.conditions);case 8:case"end":return e.stop()}}),e)})),o=function(){var e=this,t=arguments;return new Promise((function(o,r){var a=n.apply(e,t);function i(e){oe(a,o,r,i,c,"next",e)}function c(e){oe(a,o,r,i,c,"throw",e)}i(void 0)}))},function(e){return o.apply(this,arguments)}),depends:[b]}),g=_.data,E=_.isLoading;_.error;return(0,e.createElement)(e.Fragment,null,(0,e.createElement)("button",{className:"button-primary",style:{width:"100%"},onClick:function(e){e.preventDefault(),e.stopPropagation(),E||p(!0)}},(0,i.__)("Add/Edit Conditions","blocksy-companion")),(0,e.createElement)(c.Overlay,{items:d,initialFocusRef:v,className:"ct-admin-modal ct-builder-conditions-modal",onDismiss:function(){p(!1),y(null)},render:function(){var t;return(0,e.createElement)("div",{className:"ct-modal-content",ref:v},(0,e.createElement)("h2",null,sprintf((0,i.__)("Display Conditions","blocksy-companion"))),(0,e.createElement)("p",null,(0,i.__)("Add one or more conditions in order to display your header.","blocksy-companion")),(0,e.createElement)("div",{className:"ct-modal-scroll"},(0,e.createElement)(c.OptionsPanel,{onChange:function(e,t){y((function(e){return[].concat(l((e||g).filter((function(e){return e.id!==r}))),[{id:r,conditions:t}])}))},options:{conditions:(t={type:"blocksy-display-condition",design:"none",value:[]},s(t,"design","none"),s(t,"label",!1),t)},value:{conditions:((f||g).find((function(e){return e.id===r}))||{conditions:[]}).conditions},hasRevertButton:!1})),(0,e.createElement)("div",{className:"ct-modal-actions has-divider"},(0,e.createElement)("button",{className:"button-primary",disabled:!f,onClick:function(){fetch("".concat(wp.ajax.settings.url,"?action=blocksy_header_update_all_conditions"),{headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST",body:JSON.stringify(f)}).then((function(e){return e.json()})).then((function(){pe(),p(!1)}))}},(0,i.__)("Save Conditions","blocksy-companion"))))}}))};function fe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function ye(e){for(var t=1;t
-1?{conditions_button:{label:(0,i.__)("Edit Conditions","blocksy-companion"),type:"jsx",design:"block",render:function(){return(0,e.createElement)(me,{headerId:o})}},divider:{type:"ct-divider"}}:{}),p)};return(0,e.createElement)(c.PanelMetaWrapper,E({id:l,key:o,option:f},m,{getActualOption:function(t){var n=t.open;return(0,e.createElement)(e.Fragment,null,o===u.id&&(0,e.createElement)(c.Panel,{id:l,getValues:function(){return ye({id:o},u.settings||{})},option:f,onChangeFor:function(e,t){s({type:"BUILDER_GLOBAL_SETTING_ON_CHANGE",payload:{optionId:e,optionValue:t,values:(0,c.getValueFromInput)(p,Array.isArray(u.settings)?{}:u.settings||{})}})},view:"simple"}),(0,e.createElement)("li",{className:d()({active:o===u.id,"ct-global":"type-1"===o}),onClick:function(){o===u.id?n():s({type:"PICK_BUILDER_SECTION",payload:{id:o}})}},(0,e.createElement)("span",{className:"ct-panel-name"},a),o.indexOf("ct-custom")>-1&&o!==u.id&&(0,e.createElement)("span",{className:"ct-remove-instance","data-tooltip-reveal":"top",onClick:function(e){e.preventDefault(),e.stopPropagation(),r(o)}},(0,e.createElement)("svg",{width:"11px",height:"11px",viewBox:"0 0 24 24"},(0,e.createElement)("path",{d:"M9.6,0l0,1.2H1.2v2.4h21.6V1.2h-8.4l0-1.2H9.6z M2.8,6l1.8,15.9C4.8,23.1,5.9,24,7.1,24h9.9c1.2,0,2.2-0.9,2.4-2.1L21.2,6H2.8z"})),(0,e.createElement)("i",{className:"ct-tooltip"},(0,i.__)("Remove header","blocksy-companion")))))}}))}))),(0,e.createElement)(t.Slot,{name:"PlacementsBuilderPanelsManagerAfter"},(function(e){return 0===e.length?null:e})),(0,e.createElement)(c.Overlay,{items:o,className:"ct-admin-modal ct-reset-options",onDismiss:function(){return r(!1)},render:function(){return(0,e.createElement)("div",{className:"ct-modal-content"},(0,e.createElement)("h2",{className:"ct-modal-title"},(0,i.__)("Remove Header","blocksy-companion")),(0,e.createElement)("p",null,(0,i.__)("You are about to remove a custom header, are you sure you want to continue?","blocksy-companion")),(0,e.createElement)("div",{className:"ct-modal-actions has-divider","data-buttons":"2"},(0,e.createElement)("button",{onClick:function(e){e.preventDefault(),e.stopPropagation(),r(!1)},className:"button"},(0,i.__)("Cancel","blocksy-companion")),(0,e.createElement)("button",{className:"button button-primary",onClick:function(e){e.preventDefault(),s({type:"REMOVE_BUILDER_SECTION",payload:{id:o}}),r(!1)}},(0,i.__)("Confirm","blocksy-companion"))))}}))};te().on("blocksy:options:before-option",(function(n){if(n.option&&"ct-header-builder"===n.option.type){var o=n.content;n.content=(0,e.createElement)(e.Fragment,null,o,(0,e.createElement)(t.Fill,{name:"PlacementsBuilderPanelsManager"},(0,e.createElement)(he,null)))}})),te().on("blocksy:options:register",(function(e){e["blocksy-display-condition"]=V,e["blocksy-customizer-options-manager"]=Z}))}()}();