PluginProbe
codoc / 0.9.61
codoc v0.9.61
0.9.61 0.9.8.8 0.9.8.9 0.9.9 0.9.9.1 trunk 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.8.1 0.8.2 0.8.3 0.8.4 0.8.6 0.8.7 0.8.8 0.8.9 0.9 0.9.1 0.9.10 All 115 releases
← All changes | dist/blocks.build.js +1 -1 0.5 → 0.9.61 View file →
@@ -1 +1 @@
1 -!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=1)}([function(e,t,n){"use strict";function r(e,t){if("string"!==typeof e)throw new TypeError("argument str must be a string");for(var n={},r=t||{},o=e.split(l),s=r.decode||a,c=0;c<o.length;c++){var u=o[c],p=u.indexOf("=");if(!(p<0)){var f=u.substr(0,p).trim(),h=u.substr(++p,u.length).trim();'"'==h[0]&&(h=h.slice(1,-1)),void 0==n[f]&&(n[f]=i(h,s))}}return n}function o(e,t,n){var r=n||{},o=r.encode||s;if("function"!==typeof o)throw new TypeError("option encode is invalid");if(!c.test(e))throw new TypeError("argument name is invalid");var i=o(t);if(i&&!c.test(i))throw new TypeError("argument val is invalid");var a=e+"="+i;if(null!=r.maxAge){var l=r.maxAge-0;if(isNaN(l))throw new Error("maxAge should be a Number");a+="; Max-Age="+Math.floor(l)}if(r.domain){if(!c.test(r.domain))throw new TypeError("option domain is invalid");a+="; Domain="+r.domain}if(r.path){if(!c.test(r.path))throw new TypeError("option path is invalid");a+="; Path="+r.path}if(r.expires){if("function"!==typeof r.expires.toUTCString)throw new TypeError("option expires is invalid");a+="; Expires="+r.expires.toUTCString()}if(r.httpOnly&&(a+="; HttpOnly"),r.secure&&(a+="; Secure"),r.sameSite){switch("string"===typeof r.sameSite?r.sameSite.toLowerCase():r.sameSite){case!0:a+="; SameSite=Strict";break;case"lax":a+="; SameSite=Lax";break;case"strict":a+="; SameSite=Strict";break;case"none":a+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return a}function i(e,t){try{return t(e)}catch(t){return e}}t.parse=r,t.serialize=o;var a=decodeURIComponent,s=encodeURIComponent,l=/; */,c=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});n(2)},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function i(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(3),s=(n.n(a),n(4)),l=(n.n(s),n(5)),c=n(7),u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),p=wp.keycodes.ENTER,__=wp.i18n.__,f=wp.element.Component,h=wp.blocks.registerBlockType,m=wp.editor,d=m.InspectorControls,b=m.RichText,w=wp.components,v=w.SelectControl,g=w.PanelBody,y=w.ToggleControl,E=w.CheckboxControl,O=w.RangeControl,C=wp.blocks,k=C.getDefaultBlockName,S=C.createBlock,j=wp.compose.withState,_=OPTIONS.codoc_url,x=OPTIONS.codoc_usercode,A=OPTIONS.codoc_plugin_version,T=(new c.a,function(e){function t(e){r(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return n.subscriptionsFetched=[],n.fetchSubscriptions(),n}return i(t,e),u(t,[{key:"fetchSubscriptions",value:function(){var e=this,t=this.props,n=t.setAttributes;if(!t.attributes.fetching){n({fetching:!0});var r=_+"/api/v1/cms/"+x+"/subscriptions?without_token=1";fetch(r).then(function(e){return e.json()}).then(function(t){var r=[];if(t.status&&t.subscriptions)for(var o=0;o<t.subscriptions.length;o++){var i={value:t.subscriptions[o].code,label:t.subscriptions[o].title};r[o]=i}r.length&&(e.subscriptionsFetched=r),n({fetching:!1})})}}},{key:"getShowPriceHelp",value:function(e){return __(e?"\u3059\u308b":"\u3057\u306a\u3044")}},{key:"getShowSupportHelp",value:function(e){return __(e?"\u53d7\u3051\u4ed8\u3051\u308b":"\u53d7\u3051\u4ed8\u3051\u306a\u3044")}},{key:"render",value:function(){var e=this,t=this.props,n=t.setAttributes,r=t.attributes,o=r.showPrice,i=r.price,a=r.limited,s=r.limitedCount,l=r.affiliateMode,c=r.affiliateRate,u=r.showSupport,p=r.subscriptions,f=function(){return n({showPrice:!o})},h=function(){return n({limited:!a})},m=function(){return n({affiliateMode:!l})},b=function(){return n({showSupport:!u})},w=j({checked_obj:Object.assign(new Object,p)})(function(t){var r=t.checked_obj,o=t.setState;return wp.element.createElement("ul",null,e.subscriptionsFetched.map(function(e){return wp.element.createElement("li",null,wp.element.createElement(E,{className:"check_items",label:e.label,checked:r[e.value],onChange:function(t){t?r[e.value]=!0:delete r[e.value],n({subscriptions:r}),o({checked_obj:r})}}))}))}),C=[{value:"0.0500",label:"\u8ca9\u58f2\u4fa1\u683c\u306e5%"},{value:"0.1000",label:"\u8ca9\u58f2\u4fa1\u683c\u306e10%"},{value:"0.1500",label:"\u8ca9\u58f2\u4fa1\u683c\u306e15%"},{value:"0.2000",label:"\u8ca9\u58f2\u4fa1\u683c\u306e20%"},{value:"0.2500",label:"\u8ca9\u58f2\u4fa1\u683c\u306e25%"},{value:"0.3000",label:"\u8ca9\u58f2\u4fa1\u683c\u306e30%"},{value:"0.3500",label:"\u8ca9\u58f2\u4fa1\u683c\u306e35%"},{value:"0.4000",label:"\u8ca9\u58f2\u4fa1\u683c\u306e40%"},{value:"0.4500",label:"\u8ca9\u58f2\u4fa1\u683c\u306e45%"},{value:"0.5000",label:"\u8ca9\u58f2\u4fa1\u683c\u306e50%"}];return wp.element.createElement(d,{key:"CodocControls"},wp.element.createElement(g,null,wp.element.createElement(y,{label:__("\u5358\u4f53\u8ca9\u58f2"),checked:!!o,help:this.getShowPriceHelp,ref:"showPrice",onChange:f}),wp.element.createElement("div",{style:{display:o?"initial":"none"}},wp.element.createElement(O,{label:__("\u4fa1\u683c(\u5186)"),value:i,initialPosition:i,onChange:function(e){n({price:e})},min:"100",max:"50000"}),wp.element.createElement("br",null),wp.element.createElement(y,{label:__("\u6570\u91cf\u9650\u5b9a\u8ca9\u58f2"),checked:!!a,onChange:h}),wp.element.createElement("div",{style:{display:a?"initial":"none"}},wp.element.createElement(O,{label:__("\u9650\u5b9a\u6570"),value:s,onChange:function(e){n({limitedCount:e})},initialPosition:s,min:"1",max:"100"}),wp.element.createElement("br",null)),wp.element.createElement(y,{label:__("\u30a2\u30d5\u30a3\u30ea\u30a8\u30a4\u30c8"),checked:!!l,onChange:m}),wp.element.createElement("div",{style:{display:l?"initial":"none"}},wp.element.createElement(v,{label:__("\u6599\u7387"),description:__("\u8cfc\u5165\u8005\u3092\u5bfe\u8c61\u306b\u6307\u5b9a\u3057\u305f\u6599\u7387\u3067\u30a2\u30d5\u30a3\u30ea\u30a8\u30a4\u30c8\u3092\u30aa\u30d5\u30a1\u30fc\u3067\u304d\u307e\u3059"),options:C,value:c,onChange:function(e){n({affiliateRate:e})}}),wp.element.createElement("br",null))),wp.element.createElement(y,{label:__("\u30b5\u30dd\u30fc\u30c8"),checked:!!u,value:"1",onChange:b,help:this.getShowSupportHelp}),wp.element.createElement("label",null,"\u30b5\u30d6\u30b9\u30af\u30ea\u30d7\u30b7\u30e7\u30f3"),wp.element.createElement(w,null)))}}]),t}(f)),P=function(e){function t(){r(this,t);var e=o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.props.setAttributes({version:A}),e.props.setAttributes({showPrice:null==e.props.attributes.showPrice||e.props.attributes.showPrice}),e.props.setAttributes({price:null==e.props.attributes.price?100:e.props.attributes.price}),e.props.setAttributes({limited:null!=e.props.attributes.limited&&e.props.attributes.limited}),e.props.setAttributes({limitedCount:null==e.props.attributes.limitedCount?10:e.props.attributes.limitedCount}),e.props.setAttributes({affiliateMode:null!=e.props.attributes.affiliateMode&&e.props.attributes.affiliateMode}),e.props.setAttributes({affiliateRate:null==e.props.attributes.affiliateRate?"0.0500":e.props.attributes.affiliateRate}),e.props.setAttributes({showSupport:null!=e.props.attributes.showSupport&&e.props.attributes.showSupport}),e.props.setAttributes({subscriptions:null==e.props.attributes.subscriptions?{}:e.props.attributes.subscriptions}),e.onChangeInput=e.onChangeInput.bind(e),e.onKeyDown=e.onKeyDown.bind(e),e.state={defaultText:__("\u3053\u306e\u7d9a\u304d\u3092\u307f\u308b\u306b\u306f")},e}return i(t,e),u(t,[{key:"onChangeInput",value:function(e){this.setState({defaultText:""});var t=0===e.target.value.length?void 0:e.target.value;this.props.setAttributes({customText:t})}},{key:"onKeyDown",value:function(e){var t=e.keyCode,n=this.props.insertBlocksAfter;t===p&&n([S(k())])}},{key:"render",value:function(){var e=this.props,t=e.attributes.customText,n=e.setAttributes,r=this.state.defaultText,o=t||r,i=o.length+10;return[wp.element.createElement(T,Object.assign({setAttributes:n},this.props)),wp.element.createElement("div",{className:"wp-block-more"},wp.element.createElement("input",{type:"text",value:o,size:i,onChange:this.onChangeInput,onKeyDown:this.onKeyDown}))]}}]),t}(f);h("codoc/codoc-block",{title:__("codoc"),description:__("\u3053\u306e\u30d6\u30ed\u30c3\u30af\u304b\u3089\u4e0b\u306e\u30d6\u30ed\u30c3\u30af\u306f\u8a8d\u8a3c\u3055\u308c\u305fcodoc\u30e6\u30fc\u30b6\u30fc\u306e\u307f\u304c\u95b2\u89a7\u3067\u304d\u308b\u6709\u6599\u30a8\u30ea\u30a2\u3068\u306a\u308a\u307e\u3059\u3002"),icon:l.a,category:"layout",supports:{customClassName:!1,className:!1,html:!1,multiple:!1},keywords:[__("codoc Block"),__("plugin for codoc"),__("codoc-block")],attributes:{showPrice:{type:"boolean",default:null},price:{type:"number",default:null},limited:{type:"boolean",default:null},limitedCount:{type:"number",default:null},affiliateMode:{type:"boolean",default:null},affiliateRate:{type:"string",default:null},showSupport:{type:"boolean",default:null},subscriptions:{type:"object",default:null},customText:{type:"string",default:""},version:{type:"string",default:null}},edit:P,save:function(e){var t=(e.setAttributes,e.attributes.customText);return wp.element.createElement("div",null,wp.element.createElement("span",{"data-id":"codoc-tag",className:"codoc-entries"},t&&!!t.length&&wp.element.createElement(b.Content,{value:t})))}})},function(e,t){},function(e,t){},function(e,t,n){"use strict";var r=n(6);n.n(r);t.a=wp.element.createElement("svg",{id:"\u30ec\u30a4\u30e4\u30fc_1","data-name":"\u30ec\u30a4\u30e4\u30fc 1",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 200 200"},wp.element.createElement("path",{d:"M10.51,169.76c0-8.56,7.41-15.55,16-15.55a14.75,14.75,0,0,1,11.12,4.42l-5.27,5.28a8.56,8.56,0,0,0-5.85-2.28,7.84,7.84,0,0,0-8,8.13,7.93,7.93,0,0,0,8,8.13,8.31,8.31,0,0,0,5.7-2.43l5.28,5.13a15.2,15.2,0,0,1-11,4.71C17.21,185.3,10.51,179,10.51,169.76Z"}),wp.element.createElement("path",{d:"M44.67,169.76c0-8.56,7.41-15.55,16-15.55,9.27,0,16,6.28,16,15.55,0,8.55-7.42,15.54-16,15.54C51.37,185.3,44.67,179,44.67,169.76Zm24,0a7.75,7.75,0,0,0-8-8.13,7.83,7.83,0,0,0-8,8.13,7.92,7.92,0,0,0,8,8.13A7.83,7.83,0,0,0,68.62,169.76Z"}),wp.element.createElement("path",{d:"M84,169.76a15.68,15.68,0,0,1,15.55-15.55,14,14,0,0,1,8.41,2.57V138.49h8v31.27c0,8.55-7.42,15.54-16,15.54C90.66,185.3,84,179,84,169.76Zm24,0a8,8,0,1,0-16,0,7.92,7.92,0,0,0,8,8.13A7.84,7.84,0,0,0,107.92,169.76Z"}),wp.element.createElement("path",{d:"M124.11,169.76c0-8.56,7.42-15.55,16-15.55,9.27,0,16,6.28,16,15.55,0,8.55-7.42,15.54-16,15.54C130.81,185.3,124.11,179,124.11,169.76Zm24,0a8,8,0,1,0-16,0,7.92,7.92,0,0,0,8,8.13A7.84,7.84,0,0,0,148.07,169.76Z"}),wp.element.createElement("path",{d:"M163.41,169.76c0-8.56,7.41-15.55,16-15.55a14.73,14.73,0,0,1,11.12,4.42l-5.27,5.28a8.56,8.56,0,0,0-5.85-2.28,7.84,7.84,0,0,0-8,8.13,7.93,7.93,0,0,0,8,8.13,8.31,8.31,0,0,0,5.7-2.43l5.28,5.13a15.2,15.2,0,0,1-11,4.71C170.11,185.3,163.41,179,163.41,169.76Z"}),wp.element.createElement("path",{class:"cls-1",d:"M154.23,78.71H125v29.7H66.79V53.79a8.14,8.14,0,0,1,8.14-8.14h71.16a8.14,8.14,0,0,1,8.14,8.14Z"}),wp.element.createElement("rect",{class:"cls-2",x:"145.33",y:"45.94",width:"8.9",height:"33.31"}),wp.element.createElement("rect",{x:"78.88",y:"90.24",width:"37.68",height:"8.9"}),wp.element.createElement("rect",{x:"78.88",y:"72.85",width:"37.68",height:"8.9"}),wp.element.createElement("rect",{x:"78.88",y:"55.46",width:"66.46",height:"8.9"}),wp.element.createElement("path",{d:"M164.18,50.39A14.44,14.44,0,0,0,149.74,36H71.28A14.44,14.44,0,0,0,56.84,50.39v68.22h78.1l0,0,29.21-29.7,0,0h0ZM135,104.49V88.91h15.27ZM154.23,79H125v29.7H66.79V54a8.13,8.13,0,0,1,8.14-8.14h71.16A8.13,8.13,0,0,1,154.23,54Z"}),wp.element.createElement("polygon",{class:"cls-2",points:"134.97 88.91 134.97 104.49 150.39 89.06 134.97 88.91"}),wp.element.createElement("path",{d:"M46.77,46.88A20.88,20.88,0,0,1,67.65,26h47.07V16.05H64A27.18,27.18,0,0,0,36.83,43.23V79.52h9.94Z"}))},function(e,t){e.exports=wp.components},function(e,t,n){"use strict";var r=n(8);t.a=r.a},function(e,t,n){"use strict";var r=n(0),o=(n.n(r),n(9)),i=n(10),a=function(){function e(e){var t=this;this.changeListeners=[],this.HAS_DOCUMENT_COOKIE=!1,this.cookies=Object(o.b)(e),new Promise(function(){t.HAS_DOCUMENT_COOKIE=Object(o.a)()}).catch(function(){})}return e.prototype._updateBrowserValues=function(){this.HAS_DOCUMENT_COOKIE&&(this.cookies=r.parse(document.cookie))},e.prototype._emitChange=function(e){for(var t=0;t<this.changeListeners.length;++t)this.changeListeners[t](e)},e.prototype.get=function(e,t){return void 0===t&&(t={}),this._updateBrowserValues(),Object(o.c)(this.cookies[e],t)},e.prototype.getAll=function(e){void 0===e&&(e={}),this._updateBrowserValues();var t={};for(var n in this.cookies)t[n]=Object(o.c)(this.cookies[n],e);return t},e.prototype.set=function(e,t,n){var o;"object"===typeof t&&(t=JSON.stringify(t)),this.cookies=i({},this.cookies,(o={},o[e]=t,o)),this.HAS_DOCUMENT_COOKIE&&(document.cookie=r.serialize(e,t,n)),this._emitChange({name:e,value:t,options:n})},e.prototype.remove=function(e,t){var n=t=i({},t,{expires:new Date(1970,1,1,0,0,1),maxAge:0});this.cookies=i({},this.cookies),delete this.cookies[e],this.HAS_DOCUMENT_COOKIE&&(document.cookie=r.serialize(e,"",n)),this._emitChange({name:e,value:void 0,options:t})},e.prototype.addChangeListener=function(e){this.changeListeners.push(e)},e.prototype.removeChangeListener=function(e){var t=this.changeListeners.indexOf(e);t>=0&&this.changeListeners.splice(t,1)},e}();t.a=a},function(e,t,n){"use strict";function r(){return!o()&&("object"===typeof document&&"string"===typeof document.cookie)}function o(){return"object"===typeof navigator&&"string"===typeof navigator.userAgent&&(navigator.userAgent.indexOf("Node.js")>=0||navigator.userAgent.indexOf("jsdom")>=0)}function i(e){return"string"===typeof e?c.parse(e):"object"===typeof e&&null!==e?e:{}}function a(e,t){return"undefined"===typeof t&&(t=!e||"{"!==e[0]&&"["!==e[0]&&'"'!==e[0]),!t}function s(e,t){void 0===t&&(t={});var n=l(e);if(a(n,t.doNotParse))try{return JSON.parse(n)}catch(e){}return e}function l(e){return e&&"j"===e[0]&&":"===e[1]?e.substr(2):e}t.a=r,t.b=i,t.c=s;var c=n(0);n.n(c)},function(e,t,n){"use strict";function r(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}var o=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,s,l=r(e),c=1;c<arguments.length;c++){n=Object(arguments[c]);for(var u in n)i.call(n,u)&&(l[u]=n[u]);if(o){s=o(n);for(var p=0;p<s.length;p++)a.call(n,s[p])&&(l[s[p]]=n[s[p]])}}return l}}]);
1 +!function(e){function t(n){if(o[n])return o[n].exports;var i=o[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var o={};t.m=e,t.c=o,t.d=function(e,o,n){t.o(e,o)||Object.defineProperty(e,o,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var o=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(o,"a",o),o},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});o(1)},function(e,t,o){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function l(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function r(){try{var e=JSON.parse(window.localStorage.getItem(F)||"null");return e&&"object"===("undefined"===typeof e?"undefined":m(e))?e:{}}catch(e){return{}}}function a(e){try{var t={};K.forEach(function(o){void 0!==e[o]&&null!==e[o]&&(t[o]=e[o])}),window.localStorage.setItem(F,JSON.stringify(t))}catch(e){}}function c(e){var t=/<!--\s*wp:codoc\/codoc-block[\s\S]*?<!--\s*\/wp:codoc\/codoc-block\s*-->/,o=(e||"").split(t);return{bodyFree:o[0]||"",bodyPaywalled:o.slice(1).join("")||""}}function s(e,t,o){var n=[],i=t.length+o.length;return W.title&&e.length>W.title&&n.push(__("Title exceeds the maximum length of","codoc")+" "+W.title+" ("+e.length+")"),W.body_free&&t.length>W.body_free&&n.push(__("Free area exceeds the maximum length of","codoc")+" "+W.body_free+" ("+t.length+")"),W.body_paywalled&&o.length>W.body_paywalled&&n.push(__("Paid area exceeds the maximum length of","codoc")+" "+W.body_paywalled+" ("+o.length+")"),W.body&&i>W.body&&n.push(__("Total body exceeds the maximum length of","codoc")+" "+W.body+" ("+i+")"),n}var u=o(2),p=(o.n(u),o(3)),d=(o.n(p),o(4)),h=function(){function e(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,o,n){return o&&e(t.prototype,o),n&&e(t,n),t}}(),m="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},b=wp.keycodes.ENTER,__=wp.i18n.__,f=wp.element.Component,w=wp.blocks.registerBlockType,y=wp.editor,g=y.InspectorControls,v=y.RichText,C=wp.components,S=C.SelectControl,P=C.PanelBody,k=C.ToggleControl,E=C.CheckboxControl,_=C.RangeControl,x=C.TextControl,T=C.Notice,O=wp.data.withSelect,A=wp.blocks,j=A.getDefaultBlockName,N=A.createBlock,B=wp.compose.withState,I=OPTIONS.codoc_url,R=OPTIONS.codoc_usercode,L=OPTIONS.codoc_plugin_version,M=OPTIONS.codoc_account_is_pro,D=OPTIONS.codoc_currency_code,H=OPTIONS.codoc_currency_decimal_places,W=OPTIONS.codoc_max_lengths||{},F="codoc_block_last_used",K=["showPrice","price","limited","limitedCount","affiliateMode","affiliateRate","showSupport","showPaywalledSupport","showPayWithoutAccountButton","statusLimited","subscriptions"],z=O(function(e){var t=e("core/editor");return{postTitle:t?t.getEditedPostAttribute("title"):"",postContent:t?t.getEditedPostAttribute("content"):""}})(function(e){var t=e.postTitle,o=e.postContent,n=c(o),i=n.bodyFree,l=n.bodyPaywalled,r=s(t||"",i,l);return 0===r.length?null:wp.element.createElement(T,{status:"error",isDismissible:!1},wp.element.createElement("strong",null,__("codoc length limit exceeded:","codoc")),wp.element.createElement("ul",{style:{marginTop:"0.5em",marginBottom:0}},r.map(function(e,t){return wp.element.createElement("li",{key:t},e)})))});!function(){if(wp.data&&wp.data.subscribe){var e="codoc-length-limit",t="";wp.data.subscribe(function(){var o=wp.data.select("core/editor"),n=wp.data.select("core/block-editor")||wp.data.select("core/editor"),i=wp.data.dispatch("core/notices");if(o&&n&&i){if(!(n.getBlocks?n.getBlocks():[]).some(function(e){return e&&"codoc/codoc-block"===e.name}))return void(""!==t&&(i.removeNotice(e),t=""));var l=o.getEditedPostAttribute("title")||"",r=o.getEditedPostAttribute("content")||"",a=c(r),u=a.bodyFree,p=a.bodyPaywalled,d=s(l,u,p),h=d.join("||");h!==t&&(t=h,i.removeNotice(e),d.length>0&&i.createNotice("error",__("codoc length limit exceeded:","codoc")+" "+d.join(" / "),{id:e,isDismissible:!1}))}})}}();var U=function(e){function t(e){n(this,t);var o=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return o.subscriptionsFetched=[],o.subscriptionSearchTerm="",o.state={searchTerm:"",filteredSubscriptions:[]},o.fetchSubscriptions(),o.handleSearchChange=o.handleSearchChange.bind(o),o}return l(t,e),h(t,[{key:"fetchSubscriptions",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",o=this.props,n=o.setAttributes;if(!o.attributes.fetching){n({fetching:!0});var i=I+"/api/v1/cms/"+R+"/subscriptions?without_token=1";t&&(i+="&title="+encodeURIComponent(t)),fetch(i).then(function(e){return e.json()}).then(function(o){var i=[];if(o.status&&o.subscriptions)for(var l=0;l<o.subscriptions.length;l++){var r={value:o.subscriptions[l].code,label:o.subscriptions[l].title,term:o.subscriptions[l].term,price:o.subscriptions[l].price,currency:o.subscriptions[l].currency};i[l]=r}(i.length||t)&&(e.subscriptionsFetched=i,e.setState({filteredSubscriptions:i})),n({fetching:!1})})}}},{key:"handleSearchChange",value:function(e){var t=this;this.setState({searchTerm:e}),clearTimeout(this.searchTimeout),this.searchTimeout=setTimeout(function(){t.fetchSubscriptions(e)},500)}},{key:"getShowPriceHelp",value:function(e){return e?__("Enable","codoc"):__("Disable","codoc")}},{key:"getShowSupportHelp",value:function(e){return e?__("Accept","codoc"):__("Do not accept","codoc")}},{key:"getShowPaywalledSupportHelp",value:function(e){return e?__('The paid part will be hidden upon access, but will be displayed after tapping "Pay to Read". Viewers can freely specify the amount to purchase based on the content. Please note that there may be cases where it is not purchased.',"codoc"):__(" ")}},{key:"getStatusLimitedHelp",value:function(e){return e?__("Unlisted","codoc"):__("Published","codoc")}},{key:"getShowPayWithoutAccountButtonHelp",value:function(e){return e?__("Viewers can purchase without a codoc account.","codoc"):__("Viewers must log in to codoc to purchase.","codoc")}},{key:"render",value:function(){var e=this,t=this.props,o=t.setAttributes,n=t.attributes,i=n.showPrice,l=n.price,r=n.limited,c=n.limitedCount,s=n.affiliateMode,u=n.affiliateRate,p=n.showSupport,d=n.showPaywalledSupport,h=n.showPayWithoutAccountButton,m=n.statusLimited,b=n.subscriptions,f=function(t){o(t),a(Object.assign({},e.props.attributes,t))},w=function(){return f({showPrice:!i})},y=function(){return f({limited:!r})},v=function(){return f({showPaywalledSupport:!d})},C=function(){return f({statusLimited:!m})},T=function(){return f({affiliateMode:!s})},O=function(){return f({showSupport:!p})},A=function(){return f({showPayWithoutAccountButton:!h})},j=B({checked_obj:Object.assign({},b)})(function(t){var o=t.checked_obj,n=t.setState;return wp.element.createElement("div",null,0===e.state.filteredSubscriptions.length?wp.element.createElement("p",{style:{fontStyle:"italic",color:"#666"}},e.state.searchTerm?__("No plans found matching your search.","codoc"):__("No reader plans available.","codoc")):wp.element.createElement("ul",null,e.state.filteredSubscriptions.map(function(e){var t=!!o[e.value],i=Object.keys(o).length;return wp.element.createElement("li",{key:e.value},wp.element.createElement(E,{className:"check_items",label:e.label,checked:t,onChange:function(t){if(!(t&&i>=5)){var l=Object.assign({},o);t?l[e.value]=!0:delete l[e.value],f({subscriptions:l}),n({checked_obj:l})}}}))})))}),N=[{value:"0.0500",label:"5%"},{value:"0.1000",label:"10%"},{value:"0.1500",label:"15%"},{value:"0.2000",label:"20%"},{value:"0.2500",label:"25%"},{value:"0.3000",label:"30%"},{value:"0.3500",label:"35%"},{value:"0.4000",label:"40%"},{value:"0.4500",label:"45%"},{value:"0.5000",label:"50%"}];return wp.element.createElement(g,{key:"CodocControls"},wp.element.createElement(z,null),wp.element.createElement(P,null,wp.element.createElement(k,{label:__("individual sale","codoc"),checked:!!i,help:this.getShowPriceHelp,ref:"showPrice",onChange:w}),wp.element.createElement("div",{style:{display:i?"initial":"none"}},wp.element.createElement(_,{label:__("price","codoc")+" "+(H>0?(l/100).toFixed(H):l)+" "+__(D)+__(d?"\u3010"+__("Displayed as the your suggested price","codoc")+"\u3011":""),value:l,initialPosition:l,onChange:function(e){f({price:e})},min:"100",max:1==M?1e5:5e4}),wp.element.createElement("br",null),wp.element.createElement(k,{label:__("Pay-what-you-want","codoc"),checked:!!d,help:this.getShowPaywalledSupportHelp,onChange:v}),wp.element.createElement("div",{style:{display:d?"none":"initial"}},wp.element.createElement(k,{label:__("Limited quantity sale","codoc"),checked:!!r,onChange:y}),wp.element.createElement("div",{style:{display:r?"initial":"none"}},wp.element.createElement(_,{label:__("Limited quantity","codoc"),value:c,onChange:function(e){f({limitedCount:e})},initialPosition:c,min:"0",max:"100"}),wp.element.createElement("br",null)),wp.element.createElement(k,{label:__("Affiliate","codoc"),checked:!!s,onChange:T}),wp.element.createElement("div",{style:{display:s?"initial":"none"}},wp.element.createElement(S,{label:__("Rate","codoc"),description:__("You can offer affiliate marketing at a specified rate for purchasers.","codoc"),options:N,value:u,onChange:function(e){f({affiliateRate:e})}}),wp.element.createElement("br",null)))),wp.element.createElement("div",{style:{display:d?"none":"initial"}},wp.element.createElement(k,{label:__("Tipping","codoc"),checked:!!p,value:"1",onChange:O,help:this.getShowSupportHelp})),wp.element.createElement("div",{style:{display:"initial"}},wp.element.createElement(k,{label:__("Guest purchase","codoc"),checked:!!h,value:"1",onChange:A,help:this.getShowPayWithoutAccountButtonHelp})),wp.element.createElement("div",{style:{display:"initial"}},wp.element.createElement(k,{label:__("Unlisted","codoc"),checked:!!m,value:"1",onChange:C,help:this.getStatusLimitedHelp})),wp.element.createElement("div",{class:"codoc-subscription-title"},wp.element.createElement("label",null,__("Reader Plans","codoc")),wp.element.createElement("a",{href:I+"/me/subscriptions",target:"_blank",class:"codoc-subscription-add"},__("Add","codoc"))),wp.element.createElement(x,{label:__("Search Plans","codoc"),value:this.state.searchTerm,onChange:this.handleSearchChange,placeholder:__("Enter title to search...","codoc")}),wp.element.createElement(j,null)))}}]),t}(f),V=function(e){function t(){n(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments)),o=OPTIONS.codoc_block_defaults||{},l=r(),a=function(e,t){return o.hasOwnProperty(e)?o[e]:l.hasOwnProperty(e)?l[e]:t};return e.props.setAttributes({version:L}),e.props.setAttributes({showPrice:null==e.props.attributes.showPrice?a("showPrice",!0):e.props.attributes.showPrice}),e.props.setAttributes({price:null==e.props.attributes.price?a("price",500):e.props.attributes.price}),e.props.setAttributes({limited:null==e.props.attributes.limited?a("limited",!1):e.props.attributes.limited}),e.props.setAttributes({limitedCount:null==e.props.attributes.limitedCount?a("limitedCount",10):e.props.attributes.limitedCount}),e.props.setAttributes({affiliateMode:null==e.props.attributes.affiliateMode?a("affiliateMode",!1):e.props.attributes.affiliateMode}),e.props.setAttributes({affiliateRate:null==e.props.attributes.affiliateRate?a("affiliateRate","0.0500"):e.props.attributes.affiliateRate}),e.props.setAttributes({showSupport:null==e.props.attributes.showSupport?a("showSupport",!1):e.props.attributes.showSupport}),e.props.setAttributes({showPaywalledSupport:null==e.props.attributes.showPaywalledSupport?a("showPaywalledSupport",!1):e.props.attributes.showPaywalledSupport}),e.props.setAttributes({statusLimited:null==e.props.attributes.statusLimited?a("statusLimited",!1):e.props.attributes.statusLimited}),e.props.setAttributes({showPayWithoutAccountButton:null==e.props.attributes.showPayWithoutAccountButton?a("showPayWithoutAccountButton",!0):e.props.attributes.showPayWithoutAccountButton}),e.props.setAttributes({subscriptions:null==e.props.attributes.subscriptions?a("subscriptions",{}):e.props.attributes.subscriptions}),e.onChangeInput=e.onChangeInput.bind(e),e.onKeyDown=e.onKeyDown.bind(e),e.state={defaultText:__("To continue reading, ...","codoc")},e}return l(t,e),h(t,[{key:"onChangeInput",value:function(e){this.setState({defaultText:""});var t=0===e.target.value.length?void 0:e.target.value;this.props.setAttributes({customText:t})}},{key:"onKeyDown",value:function(e){var t=e.keyCode,o=this.props.insertBlocksAfter;t===b&&o([N(j())])}},{key:"render",value:function(){var e=this.props,t=e.attributes.customText,o=e.setAttributes,n=this.state.defaultText,i=t||n,l=i.length+10;return[wp.element.createElement(U,Object.assign({setAttributes:o},this.props)),wp.element.createElement("div",{className:"wp-block-more"},wp.element.createElement("input",{type:"text",value:i,size:l,onChange:this.onChangeInput,onKeyDown:this.onKeyDown}))]}}]),t}(f);w("codoc/codoc-block",{title:__("codoc","codoc"),description:__("The area from this block down is a paid area that only authenticated codoc users can view.","codoc"),icon:d.a,category:"layout",supports:{customClassName:!1,className:!1,html:!1,multiple:!1},keywords:[__("codoc Block","codoc"),__("plugin for codoc","codoc"),__("codoc-block","codoc")],attributes:{showPrice:{type:"boolean",default:null},price:{type:"number",default:null},limited:{type:"boolean",default:null},limitedCount:{type:"number",default:null},affiliateMode:{type:"boolean",default:null},affiliateRate:{type:"string",default:null},showSupport:{type:"boolean",default:null},showPaywalledSupport:{type:"boolean",default:null},statusLimited:{type:"boolean",default:null},showPayWithoutAccountButton:{type:"boolean",default:null},subscriptions:{type:"object",default:null},customText:{type:"string",default:""},version:{type:"string",default:null}},edit:V,save:function(e){var t=(e.setAttributes,e.attributes.customText);return wp.element.createElement("div",{"data-id":"codoc-tag",className:"codoc-entries"},t&&!!t.length&&wp.element.createElement(v.Content,{value:t}))}})},function(e,t){},function(e,t){},function(e,t,o){"use strict";var n=o(5);o.n(n);t.a=wp.element.createElement("svg",{version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",width:"100%",viewBox:"0 0 256 256","enable-background":"new 0 0 256 256",xmlSpace:"preserve"},wp.element.createElement("path",{fill:"#ffffff",opacity:"1.000000",stroke:"none",d:"M141.000000,257.000000 C94.000000,257.000000 47.500004,257.000000 1.000006,257.000000 C1.000004,171.666672 1.000004,86.333351 1.000002,1.000018 C86.333321,1.000012 171.666641,1.000012 257.000000,1.000006 C257.000000,86.333313 257.000000,171.666626 257.000000,256.999969 C218.500000,257.000000 180.000000,257.000000 141.000000,257.000000 M146.503082,23.000164 C116.907616,22.080397 90.932098,31.832527 69.273537,51.527222 C43.720821,74.762970 31.318863,103.869339 33.861893,138.920883 C35.131977,156.427002 39.715271,172.783020 49.613323,187.221390 C76.307907,226.160965 114.954926,238.329178 159.853943,234.326080 C182.543427,232.303101 202.167206,222.083160 219.314758,207.096619 C222.639465,204.190887 222.785080,201.958481 219.541718,198.996063 C210.086426,190.359756 200.699310,181.646790 191.392899,172.850220 C185.639374,167.411880 185.677856,167.315521 179.461136,172.079407 C160.475082,186.628571 135.524796,187.942444 115.371788,175.056778 C97.697929,163.756256 89.467148,146.957764 90.253334,126.395493 C91.060989,105.271385 101.350311,89.188896 120.515396,79.896317 C141.850464,69.551582 162.308594,73.002220 181.405899,86.137695 C185.054901,88.647537 187.582901,89.016609 190.896500,85.704330 C199.132141,77.471970 207.729889,69.603195 216.037704,61.441307 C224.548111,53.080330 224.348465,52.176884 214.913849,44.925365 C195.019623,29.634516 172.687103,21.958462 146.503082,23.000164 z"}),wp.element.createElement("path",{fill:"#1B1D1F",opacity:"1.000000",stroke:"none",d:"M147.001526,23.000149 C172.687103,21.958462 195.019623,29.634516 214.913849,44.925365 C224.348465,52.176884 224.548111,53.080330 216.037704,61.441307 C207.729889,69.603195 199.132141,77.471970 190.896500,85.704330 C187.582901,89.016609 185.054901,88.647537 181.405899,86.137695 C162.308594,73.002220 141.850464,69.551582 120.515396,79.896317 C101.350311,89.188896 91.060989,105.271385 90.253334,126.395493 C89.467148,146.957764 97.697929,163.756256 115.371788,175.056778 C135.524796,187.942444 160.475082,186.628571 179.461136,172.079407 C185.677856,167.315521 185.639374,167.411880 191.392899,172.850220 C200.699310,181.646790 210.086426,190.359756 219.541718,198.996063 C222.785080,201.958481 222.639465,204.190887 219.314758,207.096619 C202.167206,222.083160 182.543427,232.303101 159.853943,234.326080 C114.954926,238.329178 76.307907,226.160965 49.613323,187.221390 C39.715271,172.783020 35.131977,156.427002 33.861893,138.920883 C31.318863,103.869339 43.720821,74.762970 69.273537,51.527222 C90.932098,31.832527 116.907616,22.080397 147.001526,23.000149 z"}))},function(e,t){e.exports=wp.components}]);