(()=>{"use strict";const e=window.wp.blocks,t=window.React,o=window.wp.i18n,l=window.wp.components,n=window.wp.blockEditor,a=window.wp.data,r=(0,window.wp.compose.compose)([(0,a.withSelect)(e=>({docs:e("core").getEntityRecords("postType","ppt_viewer",{per_page:10})}))])(e=>{const{props:{attributes:a,setAttributes:r},docs:d}=e,{selected:p,data:c}=a,s=null!=p?p:c?.tringle_text;let i;return d&&(i=d.map(e=>({label:e?.title?.rendered,value:e?.id})),i=[{label:"Select",value:0},...i]),(0,t.createElement)(n.InspectorControls,{style:{marginBottom:"40px"}},(0,t.createElement)(l.Panel,null,(0,t.createElement)(l.PanelBody,null,(0,t.createElement)(l.SelectControl,{label:(0,o.__)("Size","ppv"),value:s,options:i,onChange:e=>r({selected:parseInt(e)})}))))}),{Fragment:d,useState:p,useEffect:c}=wp.element,{withSelect:s}=wp.data,{compose:i}=wp.compose,m=i([s(e=>({docs:e("core").getEntityRecords("postType","ppt_viewer",{per_page:10})}))])(e=>{const{attributes:l,setAttributes:n}=e,{selected:a,data:s}=l,[i,m]=p(),w=null!=a?a:s?.tringle_text;return c(()=>{a||n({selected:parseInt(w)})},[]),c(()=>{0!==w?jQuery.ajax({dataType:"json",url:window.ppvBlocks?.ajaxUrl,data:{action:"pdfp_get_doc_meta",id:w,ppv_nonce:window.ppvBlocks?.ppv_nonce},success:e=>{m(e)}}):m(!1)},[l]),(0,t.createElement)(d,null,(0,t.createElement)(r,{props:e}),(0,t.createElement)("div",{style:{overflow:"hidden"}},i&&(0,t.createElement)("p",{style:{paddingLeft:"10px"}},(0,t.createElement)("a",{className:"s_pdf_download_link",href:i?.url,download:!0},(0,t.createElement)("button",{style:{marginBottom:"10px"},className:"ppv_download_bttn"},(0,o.__)("Download File","ppv")))),i&&(0,t.createElement)("div",null,(0,t.createElement)("iframe",{id:"s_pdf_frame",src:"//docs.google.com/gview?embedded=true&url="+i?.url,style:{float:"left",width:i?.width,height:i?.height,padding:"10px"},frameBorder:"0"})),0===w&&(0,t.createElement)("h3",null,(0,o.__)("Select a document","ppv"))))}),w=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"meta-box/document-embedder","title":"Documenter Embedder","category":"common","icon":"media-document","keywords":["Documenter Embedder","Document"],"attributes":{"selected":{"type":"number","default":0},"data":{"type":"object"}},"example":{"attributes":{"selected":0,"data":{}}},"editorScript":["file:./index.js"],"render":"file:./render.php"}');(0,e.registerBlockType)(w,{edit:m,save:()=>null})})();