!function(){"use strict";var e={n:function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,{a:r}),r},d:function(t,r){for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t=window.wp.blocks,r=window.wp.shortcode,n=e.n(r),a=JSON.parse('{"u2":"tablepress/table"}');const l=e=>{let t=Object.entries(e.named).map((e=>{let[t,r]=e,n="";return r=r.replace(/“([^”]*)”/g,"$1"),(/\s/.test(r)||""===r)&&(n='"'),r.includes('"')&&(n="'"),`${t}=${n}${r}${n}`})).join(" ");return e.numeric.forEach((e=>{/\s/.test(e)?t+=' "'+e+'"':t+=" "+e})),t},s=function(e){let r=n().next(tp.table.shortcode,e).shortcode.attrs;r={named:{...r.named},numeric:[...r.numeric]};const s=r.named.id;delete r.named.id;let o=l(r);return o=o.replace(/=“([^”]*)”/g,'="$1"'),(0,t.createBlock)(a.u2,{id:s,parameters:o})};var o={from:[{type:"shortcode",tag:tp.table.shortcode,attributes:{id:{type:"string",shortcode:e=>{let{named:{id:t=""}}=e;return t}},parameters:{type:"string",shortcode:e=>(delete(e={named:{...e.named},numeric:[...e.numeric]}).named.id,l(e))}}},{type:"enter",regExp:n().regexp(tp.table.shortcode),transform:e=>{let{content:t}=e;return s(t)}},{type:"block",blocks:["core/shortcode"],transform:e=>{let{text:t}=e;return s(t)},isMatch:e=>{let{text:t}=e;return void 0!==n().next(tp.table.shortcode,t)},isMultiBlock:!1}],to:[{type:"block",blocks:["core/shortcode"],transform:e=>{let{id:r,parameters:n}=e;n=n.trim(),""!==n&&(n+=" ");const a=`[${tp.table.shortcode} id=${r} ${n}/]`;return(0,t.createBlock)("core/shortcode",{text:a})}}]},c=window.wp.element,i=window.wp.i18n,d=window.wp.serverSideRender,p=e.n(d),u=window.wp.blockEditor,m=window.wp.components;const b=Object.entries(tp.tables).map((e=>{let[t,r]=e;return{value:t,label:(0,i.sprintf)((0,i.__)("ID %1$s: “%2$s”","tablepress"),t,r)}})),h=function(){return""!==tp.url&&(0,c.createElement)(m.ExternalLink,{href:tp.url},(0,i.__)("Manage your tables.","tablepress"))};let f=null;const w=Object.keys(tp.tables);w.length&&(f={attributes:{id:w[Math.floor(Math.random()*w.length)],parameters:""}});var _=f;(0,t.registerBlockType)(a.u2,{transforms:o,edit:function(e){let{attributes:t,setAttributes:r}=e;const s=(0,u.useBlockProps)();let o;o=t.id&&tp.tables.hasOwnProperty(t.id)?(0,c.createElement)("div",s,tp.load_block_preview&&(0,c.createElement)(p(),{block:a.u2,attributes:t,className:"render-wrapper"}),(0,c.createElement)("div",{className:"table-overlay"},(0,i.sprintf)((0,i.__)("TablePress table %1$s: “%2$s”","tablepress"),t.id,tp.tables[t.id]))):(0,c.createElement)("div",s,(0,c.createElement)(m.Placeholder,{icon:(0,c.createElement)(m.Icon,{icon:"list-view"}),label:(0,i.__)("TablePress table","tablepress"),instructions:(0,c.createElement)(c.Fragment,null,t.id&&(0,i.sprintf)((0,i.__)("There is a problem: The TablePress table with the ID “%1$s” could not be found.","tablepress"),t.id)+" ",0<b.length?(0,i.__)("Select the TablePress table that you want to embed in the Settings sidebar.","tablepress"):(0,i.__)("There are no TablePress tables on this site yet.","tablepress"))},(0,c.createElement)(h,null)));const d=(0,c.createElement)(c.Fragment,null,(0,c.createElement)(u.InspectorControls,null,(0,c.createElement)(m.PanelBody,{opened:!0},0<b.length?(0,c.createElement)(m.ComboboxControl,{label:(0,i.__)("Table:","tablepress"),help:(0,c.createElement)(c.Fragment,null,(0,i.__)("Select the TablePress table that you want to embed.","tablepress"),""!==tp.url&&" ",(0,c.createElement)(h,null)),value:t.id,options:b,onChange:e=>{var t;null!==(t=e)&&void 0!==t||(e=""),r({id:e.replace(/[^0-9a-zA-Z-_]/g,"")})}}):(0,c.createElement)(c.Fragment,null,(0,i.__)("There are no TablePress tables on this site yet.","tablepress"),""!==tp.url&&" ",(0,c.createElement)(h,null)))),t.id&&tp.tables.hasOwnProperty(t.id)&&(0,c.createElement)(u.InspectorAdvancedControls,null,(0,c.createElement)(m.TextControl,{label:(0,i.__)("Configuration parameters:","tablepress"),help:(0,i.__)("These additional parameters can be used to modify specific table features.","tablepress")+" "+(0,i.__)("See the TablePress Documentation for more information.","tablepress"),value:t.parameters,onChange:e=>{e=(e=n().replace(tp.table.shortcode,e,(e=>{let{attrs:t}=e;return t={named:{...t.named},numeric:[...t.numeric]},delete t.named.id," "+l(t)+" "}))).replace(/=“([^”]*)”/g,'="$1"'),r({parameters:e})},onBlur:e=>{const t=e.target.value.trim();r({parameters:t})}})));return(0,c.createElement)(c.Fragment,null,o,d)},save:function(e){let{attributes:{id:t="",parameters:r=""}}=e;return""===t?"":(r=r.trim(),""!==r&&(r+=" "),(0,c.createElement)(c.RawHTML,null,`[${tp.table.shortcode} id=${t} ${r}/]`))},example:_})}();