var rml_gutenberg;(()=>{"use strict";const e=ReactJSXRuntime,t=(React,wp),l="real-media-library/gallery",{registerBlockType:n}=t.blocks,{G:s,SVG:r,Path:o,ServerSideRender:a,PanelBody:i,RangeControl:c,ToggleControl:d,SelectControl:u,TreeSelect:p,Notice:m,Spinner:h,Button:g,withNotices:b}=t.components,{Component:x,Fragment:y}=t.element,{InspectorControls:j,ServerSideRender:v,useBlockProps:C}=t.editor,f=t.blockEditor||{},{useBlockProps:k}=f,{__:S}=t.i18n,w=a||v,B=C||k,R=[{value:"attachment",label:S("Attachment Page")},{value:"media",label:S("Media File")},{value:"none",label:S("None")}];class T extends x{constructor(){super(...arguments),this.state={$busy:!0,tree:[]}}async componentDidMount(){try{const{tree:e}=await window.wp.apiFetch({path:"/realmedialibrary/v1/tree"});e.unshift({id:-1,name:rmlOpts.others.lang.unorganized}),e.unshift({id:void 0,name:"-"}),this.setState({tree:e,$busy:!1})}catch(e){this.setState({tree:[],$busy:!1})}}render(){const{...t}=this.props,{$busy:l,tree:n}=this.state;return l?(0,e.jsx)(h,{}):(0,e.jsx)(p,{label:rmlOpts.others.lang.folder,...t,tree:n})}}const M={title:"Real Media Library Gallery",description:"Display folder images in a rich gallery.",icon:(0,e.jsxs)(r,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[(0,e.jsx)(o,{fill:"none",d:"M0 0h24v24H0V0z"}),(0,e.jsxs)(s,{children:[(0,e.jsx)(o,{d:"M20 4v12H8V4h12m0-2H8L6 4v12l2 2h12l2-2V4l-2-2z"}),(0,e.jsx)(o,{d:"M12 12l1 2 3-3 3 4H9z"}),(0,e.jsx)(o,{d:"M2 6v14l2 2h14v-2H4V6H2z"})]})]}),category:"common",supports:{align:!0},attributes:{fid:{type:"number",default:0},columns:{type:"number",default:3},imageCrop:{type:"boolean",default:!0},captions:{type:"boolean",default:!0},linkTo:{type:"string",default:"none"},lastEditReload:{type:"number",default:0}},edit:b(function(t){const{attributes:n,setAttributes:s}=t,{fid:r,columns:o=3,imageCrop:a,captions:p,linkTo:h}=n,b=B?B():{};return(0,e.jsxs)(y,{children:[(0,e.jsx)(j,{children:(0,e.jsxs)(i,{title:S("Gallery Settings"),children:[(0,e.jsx)(T,{value:r,onChange:e=>s({fid:+e})}),(0,e.jsx)(c,{label:S("Columns"),value:o,onChange:e=>s({columns:e}),min:"1",max:"8"}),(0,e.jsx)(d,{label:S("Crop Images"),checked:!!a,onChange:()=>s({imageCrop:!a})}),(0,e.jsx)(d,{label:S("Caption"),checked:!!p,onChange:()=>s({captions:!p})}),(0,e.jsx)(u,{label:S("Link To"),value:h,onChange:e=>s({linkTo:e}),options:R}),(0,e.jsx)(g,{isPrimary:!0,onClick:()=>s({lastEditReload:(new Date).getTime()}),children:rmlOpts.others.lang.reloadContent})]})}),(0,e.jsxs)("div",{...b,children:[(0,e.jsx)(w,{block:l,attributes:n}),!r&&(0,e.jsx)(m,{status:"error",isDismissible:!1,children:(0,e.jsx)("p",{children:rmlOpts.others.lang.gutenBergBlockSelect})})]})]})}),save:()=>null};"undefined"!=typeof rmlOpts&&rmlOpts?.others?.isBlockApiVersion3Supported&&(M.apiVersion=3),n(l,M),rml_gutenberg={}})();
//# sourceMappingURL=https://sourcemap.devowl.io/real-media-library/4.22.82/25c9b6da48a224783eaa1cb66f5a0bea/rml_gutenberg.lite.js.map
