!function(){var e={630:function(e,t,a){"use strict";var l=window.wp.i18n,n=window.wp.element,c=window.wp.blocks,r=window.wp.blockEditor,s=window.wp.components,o="function"==typeof r.useInnerBlocksProps?r.useInnerBlocksProps:r.__experimentalUseInnerBlocksProps,i=JSON.parse('{"u2":"loos/ab-test"}'),u=React.createElement("svg",{viewBox:"0 0 56 56"},React.createElement("path",{d:"M18.7,32.4h-5.5l-1,3.1H8.9l5.4-15h3.5l5.3,15h-3.4L18.7,32.4z M17.9,29.8L16,23.9l-1.9,5.9H17.9z"}),React.createElement("path",{d:"M53,7H3C2.4,7,2,7.4,2,8v40c0,0.6,0.4,1,1,1h50c0.6,0,1-0.4,1-1V8C54,7.4,53.6,7,53,7z M25.3,46H5V10h25.7L25.3,46z M47.5,33.4c-0.3,0.5-0.6,0.9-1.1,1.2c-0.5,0.4-1,0.6-1.7,0.8s-1.4,0.2-2.1,0.2h-6.8v-15h7.3c1.8,0,3.1,0.6,3.9,1.6 c0.5,0.6,0.7,1.4,0.7,2.3c0,0.9-0.2,1.7-0.7,2.2c-0.3,0.3-0.6,0.6-1.1,0.9c0.8,0.3,1.3,0.7,1.7,1.3c0.4,0.6,0.6,1.3,0.6,2.2 C48.2,31.9,48,32.7,47.5,33.4z"}),React.createElement("path",{d:"M44.1,26c0.4-0.2,0.6-0.7,0.6-1.3c0-0.7-0.3-1.2-0.8-1.4c-0.5-0.2-1.1-0.2-1.8-0.2h-3.3v3.3h3.7 C43.1,26.4,43.7,26.3,44.1,26z"}),React.createElement("path",{d:"M44.1,29.1c-0.4-0.2-0.9-0.2-1.5-0.3h-3.7v4h3.7c0.7,0,1.2-0.1,1.5-0.3c0.7-0.3,1-0.9,1-1.9C45,30,44.7,29.4,44.1,29.1z"})),p=a(184),m=a.n(p),b=(0,n.memo)((e=>{const{tabs:t,state:a,setState:l,className:n}=e;return React.createElement("div",{className:m()("swl-tabControl",n)},t.map((e=>React.createElement(s.Button,{isSecondary:a!==e.key,isPrimary:a===e.key,onClick:()=>{l(e.key)},key:`tabkey_${e.key}`},e.label))))}));const w=["loos/ab-test-a","loos/ab-test-b"],R=[["loos/ab-test-a"],["loos/ab-test-b"]];(0,c.registerBlockType)(i.u2,{title:(0,l.__)("ABテスト","swell"),description:(0,l.__)("2つのブロックをランダムに表示します。","swell"),icon:u,edit:({attributes:e,setAttributes:t})=>{const{rate:a}=e,[c,i]=(0,n.useState)("tab-a"),u=(0,r.useBlockProps)({className:m()("swell-block-abTest",c,"swl-inner-blocks")}),p=o({},{allowedBlocks:w,template:R,templateLock:!0}),d=void 0===a?50:a,f=100-d;return React.createElement(React.Fragment,null,React.createElement("div",u,React.createElement(r.InspectorControls,null,React.createElement(s.PanelBody,{title:(0,l.__)("設定","swell")},React.createElement(s.Flex,{className:"swl-control--abRate"},React.createElement(s.FlexItem,null,React.createElement("span",{className:"__abLabel -A"},"A"),React.createElement("br",null),React.createElement("span",{className:"__abRate"},d,"%")),React.createElement(s.FlexBlock,null,React.createElement(s.RangeControl,{allowReset:!0,label:(0,l.__)("表示比率","swell"),value:d,onChange:e=>{t(50===e?{rate:void 0}:{rate:e})},min:0,max:100})),React.createElement(s.FlexItem,null,React.createElement("span",{className:"__abLabel -B"},"B"),React.createElement("br",null),React.createElement("span",{className:"__abRate"},f,"%"))))),React.createElement(b,{className:"-ab-test",tabs:[{key:"tab-a",label:(0,l.__)("Aブロック","swell")+` (${d}%)`},{key:"tab-b",label:(0,l.__)("Bブロック","swell")+` (${f}%)`}],state:c,setState:i}),p.children))},save:()=>React.createElement(r.InnerBlocks.Content,null)})},184:function(e,t){var a;!function(){"use strict";var l={}.hasOwnProperty;function n(){for(var e=[],t=0;t<arguments.length;t++){var a=arguments[t];if(a){var c=typeof a;if("string"===c||"number"===c)e.push(a);else if(Array.isArray(a)){if(a.length){var r=n.apply(null,a);r&&e.push(r)}}else if("object"===c)if(a.toString===Object.prototype.toString)for(var s in a)l.call(a,s)&&a[s]&&e.push(s);else e.push(a.toString())}}return e.join(" ")}e.exports?(n.default=n,e.exports=n):void 0===(a=function(){return n}.apply(t,[]))||(e.exports=a)}()}},t={};function a(l){var n=t[l];if(void 0!==n)return n.exports;var c=t[l]={exports:{}};return e[l](c,c.exports,a),c.exports}a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,{a:t}),t},a.d=function(e,t){for(var l in t)a.o(t,l)&&!a.o(e,l)&&Object.defineProperty(e,l,{enumerable:!0,get:t[l]})},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a(630)}();