var rml_gutenberg;(()=>{"use strict";var e={n:t=>{var l=t&&t.__esModule?()=>t.default:()=>t;return e.d(l,{a:l}),l},d:(t,l)=>{for(var n in l)e.o(l,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:l[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=ReactJSXRuntime,l=React,n=wp;var a=e.n(n);const o=devowlWp_utils;let r;const i=(...e)=>(r||(r=(0,o.createLocalizationFactory)("real-media-library-lite"))).__(...e),{rmlOpts:s}=window,{blockEditor:c,blocks:d,components:u,editor:p,i18n:m}=a(),h="real-media-library/gallery",{registerBlockType:g}=d,{G:b,SVG:v,Path:y,ServerSideRender:x,PanelBody:f,RangeControl:j,ToggleControl:C,SelectControl:w,TreeSelect:k,Notice:S,Spinner:R,Button:P,withNotices:_}=u,{InspectorControls:T,ServerSideRender:B,useBlockProps:M}=p,V=c||{},{useBlockProps:z}=V,{__:H}=m,F=T,E=f,G=j,L=C,O=w,A=P,D=x||B,N=S,I=v,J=y,U=b,W=M||z,X=[{value:"attachment",label:H("Attachment Page")},{value:"media",label:H("Media File")},{value:"none",label:H("None")}];function q({value:e,onChange:n,...a}){const[o,r]=(0,l.useState)(!0),[s,c]=(0,l.useState)([]);(0,l.useEffect)(()=>{let e=!1;return(async()=>{try{const{tree:t}=await window.wp.apiFetch({path:"/realmedialibrary/v1/tree"});if(e)return;const l=[...t];l.unshift({id:-1,name:i("Unorganized")}),l.unshift({id:void 0,name:"-"}),c(l)}catch{e||c([])}finally{e||r(!1)}})(),()=>{e=!0}},[]);const d=k,u=R;return o?(0,t.jsx)(u,{}):(0,t.jsx)(d,{label:i("Folder"),...a,value:e,onChange:n,tree:s})}const K={title:"Real Media Library Gallery",description:"Display folder images in a rich gallery.",icon:(0,t.jsxs)(I,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)(J,{fill:"none",d:"M0 0h24v24H0V0z"}),(0,t.jsxs)(U,{children:[(0,t.jsx)(J,{d:"M20 4v12H8V4h12m0-2H8L6 4v12l2 2h12l2-2V4l-2-2z"}),(0,t.jsx)(J,{d:"M12 12l1 2 3-3 3 4H9z"}),(0,t.jsx)(J,{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:_(function(e){const{attributes:n,setAttributes:a}=e,{fid:o,columns:r=3,imageCrop:s,captions:c,linkTo:d}=n,u=W?W():{};return(0,t.jsxs)(l.Fragment,{children:[(0,t.jsx)(F,{children:(0,t.jsxs)(E,{title:H("Gallery Settings"),children:[(0,t.jsx)(q,{value:o,onChange:e=>a({fid:+e})}),(0,t.jsx)(G,{label:H("Columns"),value:r,onChange:e=>a({columns:e}),min:"1",max:"8"}),(0,t.jsx)(L,{label:H("Crop Images"),checked:!!s,onChange:()=>a({imageCrop:!s})}),(0,t.jsx)(L,{label:H("Caption"),checked:!!c,onChange:()=>a({captions:!c})}),(0,t.jsx)(O,{label:H("Link To"),value:d,onChange:e=>a({linkTo:e}),options:X}),(0,t.jsx)(A,{isPrimary:!0,onClick:()=>a({lastEditReload:(new Date).getTime()}),children:i("Reload content")})]})}),(0,t.jsxs)("div",{...u,children:[(0,t.jsx)(D,{block:h,attributes:n}),!o&&(0,t.jsx)(N,{status:"error",isDismissible:!1,children:(0,t.jsx)("p",{children:i("Please select a folder (media library) in the block settings.")})})]})]})}),save:()=>null};void 0!==s&&s?.others?.isBlockApiVersion3Supported&&(K.apiVersion=3),g(h,K),rml_gutenberg={}})();
//# sourceMappingURL=https://sourcemap.devowl.io/real-media-library/4.23.4/36b6845030a7c960652f86e531ce23fe/rml_gutenberg.lite.js.map
