!function(){"use strict";!function(){var e=window.wp.i18n,t=window.wp.element,l=window.wp.data,a=window.wp.blocks,s=window.wp.blockEditor,n="function"==typeof s.useInnerBlocksProps?s.useInnerBlocksProps:s.__experimentalUseInnerBlocksProps,c=React.createElement("svg",{viewBox:"0 0 56 56"},React.createElement("g",null,React.createElement("rect",{x:"37",y:"11",width:"6",height:"4"}),React.createElement("rect",{x:"37",y:"17",width:"6",height:"4"}),React.createElement("rect",{x:"37",y:"23",width:"6",height:"4"}),React.createElement("rect",{x:"37",y:"29",width:"6",height:"4"}),React.createElement("polygon",{points:"40,47 50,33 30,33 \t"})),React.createElement("g",null,React.createElement("path",{d:"M15,21c-5,0-9-4-9-9s4-9,9-9s9,4,9,9S20,21,15,21z M15,6c-3.3,0-6,2.7-6,6s2.7,6,6,6s6-2.7,6-6S18.3,6,15,6z"}),React.createElement("path",{d:"M15,45c-5,0-9-4-9-9s4-9,9-9s9,4,9,9S20,45,15,45z M15,30c-3.3,0-6,2.7-6,6s2.7,6,6,6s6-2.7,6-6S18.3,30,15,30z"}),React.createElement("rect",{x:"13.5",y:"19",width:"3",height:"10"}),React.createElement("rect",{x:"13.5",y:"43",width:"3",height:"10"}))),r=window.wp.components;function o({attributes:t,setAttributes:l}){const{stepLabel:a,startNum:s,stepClass:n,numLayout:c,numShape:o}=t;return React.createElement(r.PanelBody,{title:(0,e.__)("ステップ設定","swell")},React.createElement(r.TextControl,{label:(0,e.__)("「STEP」の文字","swell"),value:a,onChange:e=>{l({stepLabel:e})}}),React.createElement(r.TextControl,{label:(0,e.__)("始まりの番号","swell"),value:s,type:"number",onChange:e=>{l({startNum:parseInt(e)})}}),"big"===n?React.createElement(r.BaseControl,null,React.createElement(r.BaseControl.VisualLabel,null,(0,e.__)("ステップ番号の並び","swell")),React.createElement(r.ButtonGroup,{className:"swl-btns--padSmall"},React.createElement(r.Button,{isPrimary:"vertical"===c,onClick:()=>{l({numLayout:"vertical"})}},(0,e.__)("縦並び","swell")),React.createElement(r.Button,{isPrimary:"horizontal"===c,onClick:()=>{l({numLayout:"horizontal"})}},(0,e.__)("横並び","swell")))):React.createElement(r.BaseControl,null,React.createElement(r.BaseControl.VisualLabel,null,(0,e.__)("ステップ番号の形","swell")),React.createElement(r.ButtonGroup,{className:"swl-btns--padSmall"},React.createElement(r.Button,{isPrimary:"circle"===o,onClick:()=>{l({numShape:"circle"})}},(0,e.__)("円形","swell")),React.createElement(r.Button,{isPrimary:"square"===o,onClick:()=>{l({numShape:"square"})}},(0,e.__)("四角形","swell")))))}const i=["loos/step-item"],u=[["loos/step-item"],["loos/step-item"]],m="swell-block-step";(0,a.registerBlockType)("loos/step",{title:(0,e.__)("ステップ","swell"),description:(0,e.__)("ステップ形式で流れを説明できます。","swell"),icon:c,styles:[{name:"default",label:(0,e.__)("デフォルト","swell"),isDefault:!0},{name:"big",label:(0,e.__)("ビッグ","swell")},{name:"small",label:(0,e.__)("スモール","swell")}],edit:({attributes:a,setAttributes:c,clientId:r})=>{const{stepLabel:p,stepClass:w,numShape:d,numLayout:E,startNum:R}=a,b=a.className||"";(0,t.useEffect)((()=>{-1!==b.indexOf("is-style-big")?c({stepClass:"big"}):-1!==b.indexOf("is-style-small")?c({stepClass:"small"}):c({stepClass:"default"})}),[b]);const h=(0,l.useSelect)((e=>e("core/block-editor").getBlocks(r)),[r]),{updateBlockAttributes:_}=(0,l.useDispatch)("core/block-editor");(0,t.useEffect)((()=>{h.forEach((e=>{_(e.clientId,{stepLabel:p,stepClass:w})}))}),[h,w,p]);const y=(0,s.useBlockProps)({className:`${m} swl-inner-blocks`,style:1<R?{counterReset:"step "+(R-1)}:null,"data-num-style":"big"===w?E:d}),B=n({},{allowedBlocks:i,template:u,templateLock:!1,renderAppender:s.InnerBlocks.ButtonBlockAppender});return React.createElement(React.Fragment,null,React.createElement(s.InspectorControls,null,React.createElement(o,{attributes:a,setAttributes:c})),React.createElement("div",y,React.createElement("div",{className:"swl-parentSelector"},(0,e.__)("親ブロックを選択","swell")),B.children))},save:({attributes:e})=>{const{startNum:t,stepClass:l,numLayout:a,numShape:n}=e,c=s.useBlockProps.save({className:m,style:1<t?{counterReset:"step "+(t-1)}:null,"data-num-style":"big"===l?a:n});return React.createElement("div",c,React.createElement(s.InnerBlocks.Content,null))}})}()}();