import{j as e,c as mt,r as J,a as Lt,g as Se,R as Kt,T as Ft,W as Ce,b as Et,S as ne,E as se,d as Ee,C as Te,e as Ae,n as ut,M as Ne,f as Ht,h as Ie,F as Yt,D as Gt,s as ze,p as Vt,v as Re,i as Ct,k as ie,l as ae,m as oe,o as At,q as le,u as Rt,t as ce,w as Ot,U as Oe,x as Be,P as he,y as Pe,z as Fe,A as ue,B as Le,G as De,H as Ue,I as We,J as jt,K as de,L as Nt,N as Dt,O as Me,Q as Bt,V as Ze,X as He,Y as Wt,Z as Mt,_ as Ge,$ as Ve,a0 as qe,a1 as $e,a2 as Ke,a3 as Ye}from"./index-DRp6ufg5.js";import{e as Xe,g as Je}from"./corruption-Di5sy24y.js";import"./parser-I9uzIUNF.js";const fe=R=>e.jsxs("svg",{...R,viewBox:"0 0 134 131",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M120.619 0.704712H13.8714C6.502 0.704712 0.527954 6.64798 0.527954 13.9794V117.225C0.527954 124.557 6.502 130.5 13.8714 130.5H120.619C127.988 130.5 133.962 124.557 133.962 117.225V13.9794C133.962 6.64798 127.988 0.704712 120.619 0.704712Z",fill:"url(#wptb_logo_paint0_linear_7_1042)"}),e.jsx("path",{d:"M106.489 28.0007H28.0248C26.8471 28.0007 25.8923 28.9506 25.8923 30.1223V44.4636C25.8923 45.6354 26.8471 46.5852 28.0248 46.5852H106.489C107.667 46.5852 108.621 45.6354 108.621 44.4636V30.1223C108.621 28.9506 107.667 28.0007 106.489 28.0007Z",fill:"white"}),e.jsx("path",{d:"M59.7869 56.3042H28.0249C26.8471 56.3042 25.8923 57.254 25.8923 58.4257V72.7671C25.8923 73.9388 26.8471 74.8887 28.0249 74.8887H59.7869C60.9647 74.8887 61.9195 73.9388 61.9195 72.7671V58.4257C61.9195 57.254 60.9647 56.3042 59.7869 56.3042Z",fill:"white"}),e.jsx("path",{d:"M106.489 56.3042H74.7267C73.549 56.3042 72.5942 57.254 72.5942 58.4257V72.7671C72.5942 73.9388 73.549 74.8887 74.7267 74.8887H106.489C107.667 74.8887 108.621 73.9388 108.621 72.7671V58.4257C108.621 57.254 107.667 56.3042 106.489 56.3042Z",fill:"white"}),e.jsx("path",{d:"M59.7631 84.6194H28.001C26.8233 84.6194 25.8685 85.5693 25.8685 86.741V101.082C25.8685 102.254 26.8233 103.204 28.001 103.204H59.7631C60.9409 103.204 61.8957 102.254 61.8957 101.082V86.741C61.8957 85.5693 60.9409 84.6194 59.7631 84.6194Z",fill:"white"}),e.jsx("path",{d:"M106.465 84.6194H74.7029C73.5251 84.6194 72.5703 85.5693 72.5703 86.741V101.082C72.5703 102.254 73.5251 103.204 74.7029 103.204H106.465C107.643 103.204 108.598 102.254 108.598 101.082V86.741C108.598 85.5693 107.643 84.6194 106.465 84.6194Z",fill:"white"}),e.jsx("defs",{children:e.jsxs("linearGradient",{id:"wptb_logo_paint0_linear_7_1042",x1:"124.538",y1:"-5.75483",x2:"45.6569",y2:"93.515",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:"#29ABE2"}),e.jsx("stop",{offset:"1",stopColor:"#0071BC"})]})})]}),Qe=wp.i18n,St=R=>Qe.__(R,"wp-table-builder"),It=({setPage:R,page:M})=>e.jsxs("div",{className:"wptb-v2-nav",children:[e.jsx("div",{className:"wptb-v2-logo",children:e.jsx(fe,{})}),e.jsxs("div",{children:[e.jsxs("button",{className:mt("wptb-v2-link-btn",{"wptb-active-nav":M==="tables"}),onClick:()=>R("tables"),children:[e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:e.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"M20 4H4a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1h16a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1M4 2a3 3 0 0 0-3 3v14a3 3 0 0 0 3 3h16a3 3 0 0 0 3-3V5a3 3 0 0 0-3-3zm2 5h2v2H6zm5 0a1 1 0 1 0 0 2h6a1 1 0 1 0 0-2zm-3 4H6v2h2zm2 1a1 1 0 0 1 1-1h6a1 1 0 1 1 0 2h-6a1 1 0 0 1-1-1m-2 3H6v2h2zm2 1a1 1 0 0 1 1-1h6a1 1 0 1 1 0 2h-6a1 1 0 0 1-1-1",clipRule:"evenodd"})}),e.jsx("span",{children:St("Table List")})]}),e.jsxs("button",{className:mt("wptb-v2-link-btn",{"wptb-active-nav":M==="create"}),onClick:()=>R("create"),children:[e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:e.jsx("path",{fill:"currentColor",d:"M18 14h2v3h3v2h-3v3h-2v-3h-3v-2h3zM4 3h14a2 2 0 0 1 2 2v7.08a6 6 0 0 0-4.32.92H12v4h1.08c-.11.68-.11 1.35 0 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2m0 4v4h6V7zm8 0v4h6V7zm-8 6v4h6v-4z"})}),e.jsx("span",{children:St("Add New")})]}),e.jsxs("button",{className:mt("wptb-v2-link-btn",{"wptb-active-nav":M==="import"}),onClick:()=>R("import"),children:[e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:e.jsx("path",{fill:"currentColor",d:"M4 3h14a2 2 0 0 1 2 2v7.08a6 6 0 0 0-4.32.92H12v4h1.08c-.11.68-.11 1.35 0 2H4a2 2 0 0 1-2-2V5c0-1.1.9-2 2-2m0 4v4h6V7zm8 0v4h6V7zm-8 6v4h6v-4zm14.44 2v2h4v2h-4v2l-3-3z"})}),e.jsx("span",{children:St("Import")})]}),e.jsxs("button",{className:mt("wptb-v2-link-btn",{"wptb-active-nav":M==="export"}),onClick:()=>R("export"),children:[e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:e.jsx("path",{fill:"currentColor",d:"M4 3h14a2 2 0 0 1 2 2v7.08a6 6 0 0 0-4.32.92H12v4h1.08c-.11.68-.11 1.35 0 2H4a2 2 0 0 1-2-2V5c0-1.1.9-2 2-2m0 4v4h6V7zm8 0v4h6V7zm-8 6v4h6v-4zm15.44 8v-2h-4v-2h4v-2l3 3z"})}),e.jsx("span",{children:St("Export")})]}),WPTB_CFG.SETTINGS.is_authorized&&e.jsxs("button",{className:mt("wptb-v2-link-btn",{"wptb-active-nav":M==="settings"}),onClick:()=>R("settings"),children:[e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:e.jsx("path",{fill:"currentColor",d:"M12 15.5A3.5 3.5 0 0 1 8.5 12A3.5 3.5 0 0 1 12 8.5a3.5 3.5 0 0 1 3.5 3.5a3.5 3.5 0 0 1-3.5 3.5m7.43-2.53c.04-.32.07-.64.07-.97s-.03-.66-.07-1l2.11-1.63c.19-.15.24-.42.12-.64l-2-3.46c-.12-.22-.39-.31-.61-.22l-2.49 1c-.52-.39-1.06-.73-1.69-.98l-.37-2.65A.506.506 0 0 0 14 2h-4c-.25 0-.46.18-.5.42l-.37 2.65c-.63.25-1.17.59-1.69.98l-2.49-1c-.22-.09-.49 0-.61.22l-2 3.46c-.13.22-.07.49.12.64L4.57 11c-.04.34-.07.67-.07 1s.03.65.07.97l-2.11 1.66c-.19.15-.25.42-.12.64l2 3.46c.12.22.39.3.61.22l2.49-1.01c.52.4 1.06.74 1.69.99l.37 2.65c.04.24.25.42.5.42h4c.25 0 .46-.18.5-.42l.37-2.65c.63-.26 1.17-.59 1.69-.99l2.49 1.01c.22.08.49 0 .61-.22l2-3.46c.12-.22.07-.49-.12-.64z"})}),e.jsx("span",{children:St("Settings")})]})]})]}),tr=({apiData:R,setPage:M})=>{const i=k=>{!R||k<1||k>R.total_pages||k===R.current_page||M(k)};return e.jsx("div",{className:"wptb-v2-pagination",children:e.jsxs("div",{className:"wptb-v2-pagination-group",children:[e.jsx("button",{type:"button",className:mt({"wptb-v2-pagination-disabled":R.current_page===1}),onClick:()=>i(R.current_page-1),children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:e.jsx("path",{fill:"none",stroke:"currentColor",strokeWidth:"2",d:"m15 6l-6 6l6 6"})})}),R.pages.map(k=>k!==0?e.jsx("button",{type:"button",className:mt({"wptb-v2-pagination-active":k===R.current_page}),onClick:()=>i(k),children:k},k):e.jsx("p",{className:"wptb-page-divider",children:"..."})),e.jsx("button",{type:"button",className:mt({"wptb-v2-pagination-disabled":R.current_page===R.total_pages}),onClick:()=>i(R.current_page+1),children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:e.jsx("path",{fill:"none",stroke:"currentColor",strokeWidth:"2",d:"m9 6l6 6l-6 6"})})})]})})},pe=(R,M="asc")=>{const[i,k]=J.useState({by:R,order:M});return J.useMemo(()=>[i,s=>{let o="asc";i.by===s&&(o=i.order==="asc"?"desc":"asc"),k({by:s,order:o})}],[i])},er={loading:!0,posts:[],current_page:1,page_start:"...",page_end:"...",total_count:"...",pages:[],total_pages:1},me=({page:R,search:M,status:i,skipTables:k,sort:s,per_page:o,abortCtrl:h,refetchOnSkipChange:r})=>{const[l,c]=J.useState(er),[x,g]=J.useState(!1),j=(b,a)=>{if(a){let m;["id","title","date","modified"].includes(s.by||"id")?m=s.by:m="id",m!=="id"?s.order==="asc"?b.sort((d,w)=>d[m].localeCompare(w[m])):b.sort((d,w)=>w[m].localeCompare(d[m])):s.order==="asc"?b.sort((d,w)=>d[m]-w[m]):b.sort((d,w)=>w[m]-d[m])}c({...l,posts:b})},u=r?k:"";return J.useEffect(()=>{const a=`/tables?${new URLSearchParams({page:R.toString(),search:M||"",status:i||"",except:k||"",...s?{sort_by:s.by,sort_order:s.order}:{},...o?{per_page:o.toString()}:{}}).toString()}`;c(m=>({...m,current_page:R,loading:!0})),Lt(a,{signal:h==null?void 0:h.signal}).then(m=>{const{posts:d,current_page:w,total_pages:S,total_count:A}=m,T=(w-1)*m.per_page+1,L=T+d.length-1;c({loading:!1,posts:d,current_page:w,page_start:T,page_end:L,pages:Se(S,2),total_pages:S,total_count:A})}).catch(()=>{c({...l,loading:!1}),WPTB.utils.notify("Something went wrong! Please reload the page!","error",0)})},[R,M,i,s.by,s.order,o,u,x]),[l,j,()=>g(!x)]},ge={duplicate:{icon:Ce,title:"Sure to duplicate?",text:R=>`Table: ${R.targetTitle} is set to be duplicated.
Are you sure?`,className:"wptb-modal-warning",url:"duplicate"},trash:{icon:Ft,title:"Sure to trash?",text:R=>`Table: ${R.targetTitle} is set to be trashed.
Are you sure?`,className:"wptb-modal-danger",url:"trash"},restore:{icon:Kt,title:"Sure to restore?",text:R=>`Table: ${R.targetTitle} is set to be trashed.
Are you sure?`,className:"wptb-modal-warning",url:"restore"},delete:{icon:Ft,title:"Sure to delete?",text:R=>`Table: ${R.targetTitle} is set to be deleted. Are you sure?
It will be deleted permanently.`,className:"wptb-modal-danger",url:"delete"},trash_bulk:{icon:Ft,title:"Sure to trash?",text:(R,M)=>`${M} table(s) are set to be trashed.
Are you sure?`,className:"wptb-modal-danger",url:"trash_bulk"},restore_bulk:{icon:Kt,title:"Sure to restore?",text:(R,M)=>`${M} table(s) are set to be restored.
Are you sure?`,className:"wptb-modal-warning",url:"restore_bulk"}},rr=async({action:R,id:M,ids:i})=>{const k=ge[R].url;if(!k)return{action:R,id:M,ids:i,res:{}};try{const[s,o]=await Et("/"+k,{id:M,ids:i});if(!o.ok)throw new Error(s.message||`HTTP error! Status: ${o.status}`);return{action:R,id:M,ids:i,res:s}}catch(s){return{action:R,id:M,ids:i,res:{error:s.message}}}},nr=({apiData:R,setPage:M,isTrash:i,setTables:k,sortBy:s,sortOrder:o,setSort:h,search:r,setSearch:l})=>{const c=J.useRef({}),x=J.useRef({}),[g,j]=J.useState(""),[u,b]=J.useState(0),[a,m]=J.useState(null);J.useEffect(()=>{c.current={},b(0)},[R]);const d=N=>{M("builder",{table:N})},w=()=>{u{c.current[N.id]=!0}),b(R.posts.length)):(c.current={},b(0))},S=N=>{c.current[N]?(delete c.current[N],b(u-1)):(c.current[N]=!0,b(u+1))},A=async()=>{var v;if(!a)return;if(a.targetId){if(x.current[a.targetId])return;x.current[a.targetId]=!0}else for(const O in c.current){if(x.current[O])return;x.current[O]=c.current[O]}const N=Object.keys(c.current).map(Number);c.current={},b(0),m(null);const{action:_,id:p,ids:C,res:W}=await rr({action:a.action,id:a.targetId,ids:N});if(C!=null&&C.length?C.forEach(O=>{delete x.current[O]}):delete x.current[p],W.error){ut(W.error,"error",0),k([...R.posts]);return}if(W.message&&ut(W.message,"success"),_==="trash"||_==="restore"||_==="delete")k([...R.posts.filter(O=>O.id!==p)]);else if(_==="trash_bulk"||_==="restore_bulk")k([...R.posts.filter(O=>!(C!=null&&C.includes(O.id)))]);else{const O=[...R.posts];(v=W.posts)==null||v.forEach(n=>{O.push(n)}),k(O,!0)}},T=a&&ge[a.action];s=s||"id";const L=N=>{window.open(`${WPTB_CFG.HOME_URL}/?post_type=wptb-tables&p=${N}`,"_blank")};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"wptb-v2-table-upper-group",children:[e.jsxs("div",{className:"wptb-v2-bulk-actions",children:[e.jsxs("select",{value:g,onChange:N=>j(N.target.value),children:[e.jsx("option",{value:"",children:"Bulk Actions"}),i?e.jsx("option",{value:"restore_bulk",children:"Restore"}):e.jsx("option",{value:"trash_bulk",children:"Delete"})]}),e.jsx("button",{type:"button",onClick:()=>u>0&&m({action:g}),children:"Apply"}),e.jsxs("p",{children:[e.jsx("b",{children:u})," items selected"]})]}),e.jsx(ne,{placeholder:"Search table...",onChange:l,value:r})]}),e.jsx("div",{className:"wptb-v2-table-list-wrapper",children:e.jsxs("table",{className:mt({"wptb-v2-table-list":!R.loading,"wptb-v2-table-loading":R.loading}),children:[e.jsxs("colgroup",{children:[e.jsx("col",{style:{width:"30px"}}),e.jsx("col",{}),e.jsx("col",{}),e.jsx("col",{}),e.jsx("col",{})]}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:e.jsx("input",{type:"checkbox",checked:u===R.posts.length,onChange:w})}),e.jsxs("th",{children:["Title",e.jsx("button",{type:"button",onClick:()=>h("title"),className:mt("wptb-v2-table-sort-btn",{"wptb-sort-btn-asc":s==="title"&&o==="asc","wptb-sort-btn-desc":s==="title"&&o!=="asc"})})]}),e.jsxs("th",{children:["Shortcode",e.jsx("button",{type:"button",onClick:()=>h("id"),className:mt("wptb-v2-table-sort-btn",{"wptb-sort-btn-asc":s==="id"&&o==="asc","wptb-sort-btn-desc":s==="id"&&o!=="asc"})})]}),e.jsxs("th",{children:["Created",e.jsx("button",{type:"button",onClick:()=>h("date"),className:mt("wptb-v2-table-sort-btn",{"wptb-sort-btn-asc":s==="date"&&o==="asc","wptb-sort-btn-desc":s==="date"&&o!=="asc"})})]}),e.jsxs("th",{children:["Last Modified",e.jsx("button",{type:"button",onClick:()=>h("modified"),className:mt("wptb-v2-table-sort-btn",{"wptb-sort-btn-asc":s==="modified"&&o==="asc","wptb-sort-btn-desc":s==="modified"&&o!=="asc"})})]})]})}),e.jsx("tbody",{children:R.loading?Array(10).fill(0).map((N,_)=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("div",{})}),e.jsx("td",{children:e.jsx("div",{})}),e.jsx("td",{children:e.jsx("div",{})}),e.jsx("td",{children:e.jsx("div",{})}),e.jsx("td",{children:e.jsx("div",{})})]},_)):R.posts.length?R.posts.map(N=>e.jsxs("tr",{children:[e.jsxs("td",{children:[e.jsx("input",{type:"checkbox",checked:!!c.current[N.id],onChange:()=>S(N.id)}),x.current[N.id]&&e.jsx("div",{className:"wptb-v2-table-pending",children:se})]}),e.jsxs("td",{children:[e.jsxs("p",{children:[N.is_template?e.jsx(Ee,{}):"",N.title?e.jsx("span",{dangerouslySetInnerHTML:{__html:N.title}}):e.jsx("span",{className:"wptb-v2-table-title-empty",children:"[ Untitled ]"})]}),i?e.jsxs("div",{className:"wptb-v2-table-actions",children:[e.jsx("button",{className:"wptb-table-action-restore",type:"button",onClick:()=>m({action:"restore",targetId:N.id,targetTitle:N.title}),children:"Restore"}),e.jsx("button",{className:"wptb-table-action-trash",type:"button",onClick:()=>m({action:"delete",targetId:N.id,targetTitle:N.title}),children:"Delete"})]}):e.jsxs("div",{className:"wptb-v2-table-actions",children:[e.jsx("button",{className:"wptb-table-action-edit",type:"button",onClick:()=>d(N.id),children:"Edit"}),e.jsx("button",{className:"wptb-table-action-duplicate",type:"button",onClick:()=>m({action:"duplicate",targetId:N.id,targetTitle:N.title}),children:"Duplicate"}),e.jsx("button",{type:"button",className:"wptb-table-action-preview",onClick:()=>L(N.id),children:"Preview"}),e.jsx("button",{className:"wptb-table-action-trash",type:"button",onClick:()=>m({action:"trash",targetId:N.id,targetTitle:N.title}),children:"Trash"})]})]}),e.jsx("td",{children:e.jsxs("div",{className:"wptb-v2-shortcode-col",children:["[wptb id=",N.id,"]",e.jsx("button",{type:"button",className:"wptb-v2-copy-btn",onClick:()=>{Ae(`[wptb id=${N.id}]`),ut("Copied to clipboard!","success")},children:Te})]})}),e.jsx("td",{children:N.date}),e.jsx("td",{children:N.modified})]},N.id)):e.jsx("tr",{children:e.jsx("td",{colSpan:5,children:e.jsx("p",{children:"No results found"})})})})]})}),T&&e.jsxs(Ne,{onClose:()=>m(null),title:T.title,icon:T.icon,className:T.className,children:[e.jsx("p",{dangerouslySetInnerHTML:{__html:T.text(a,u)}}),e.jsxs("div",{className:"wptb-v2-modal-actions",children:[e.jsx("button",{type:"button",onClick:A,children:"Yes"}),e.jsx("button",{type:"button",onClick:()=>m(null),children:"No"})]})]})]})},Xt="wptb_table_list_per_page",sr=({setPage:R,page_num:M,search:i,status:k,sort_by:s,sort_order:o})=>{const h=J.useRef(),r=J.useRef(),[l,c]=J.useState(i),[x,g]=J.useState(()=>{const d=localStorage.getItem(Xt);if(d){const w=parseInt(d,10);if(w>=15&&w<=100)return w}return 15}),[j,u]=me({page:M?parseInt(M):1,search:i,status:k,sort:{by:s||"id",order:o||"desc"},per_page:x,abortCtrl:h.current});J.useEffect(()=>{const d=l==null?void 0:l.trim();if(i){if(d&&d.length>0&&d.length<2)return}else if(!d||d.length<2)return;r.current&&clearTimeout(r.current),h.current&&h.current.abort(),h.current=new AbortController,r.current=setTimeout(()=>{R("tables",{search:l,status:k,per_page:x}),h.current=void 0,r.current=void 0},500)},[l]);const b=d=>{R("tables",{page_num:1,search:i,status:k,sort_by:d,sort_order:d===(s||"id")&&o==="asc"?"desc":"asc",per_page:x})},a=d=>{g(d),localStorage.setItem(Xt,d.toString()),R("tables",{page_num:1,search:i,status:k,sort_by:s,sort_order:o,per_page:d})},m=k==="trash";return e.jsxs("div",{className:"wptb-v2-page",children:[e.jsx(It,{setPage:R,page:"tables"}),e.jsxs("div",{className:"wptb-v2-page-content",children:[e.jsxs("div",{className:"wptb-v2-page-content-top",children:[e.jsx("h2",{children:"Table List"}),e.jsxs("div",{className:"wptb-v2-table-status-btns",children:[e.jsx("button",{type:"button",className:mt({"wptb-v2-active-section":!m}),onClick:()=>{R("tables",{per_page:x})},children:"ALL"}),e.jsx("button",{type:"button",className:mt({"wptb-v2-active-section":m}),onClick:()=>{R("tables",{status:"trash",per_page:x})},children:"TRASH"})]})]}),e.jsxs("div",{className:"wptb-v2-table-list-area",children:[e.jsxs("div",{className:"wptb-v2-pagination-controls",children:[e.jsxs("p",{className:"wptb-v2-pagination-info",children:["Showing ",e.jsx("b",{children:j.page_start})," to ",e.jsx("b",{children:j.page_end})," of"," ",e.jsx("b",{children:j.total_count})," entries"]}),e.jsxs("div",{className:"wptb-v2-per-page-selector",children:[e.jsx("label",{htmlFor:"per-page-select",children:"Show:"}),e.jsxs("select",{id:"per-page-select",value:x,onChange:d=>a(parseInt(d.target.value,10)),className:"wptb-v2-per-page-select",children:[e.jsx("option",{value:15,children:"15"}),e.jsx("option",{value:25,children:"25"}),e.jsx("option",{value:50,children:"50"}),e.jsx("option",{value:100,children:"100"})]}),e.jsx("span",{children:"per page"})]})]}),e.jsx(nr,{apiData:j,setPage:R,isTrash:m,setTables:u,setSort:b,sortBy:s,sortOrder:o,search:l,setSearch:c}),e.jsx(tr,{apiData:j,setPage:d=>R("tables",{page_num:d,search:i,sort_by:s,sort_order:o,per_page:x})})]})]})]})},ir=({setPage:R})=>{const[M,i]=J.useState(4),[k,s]=J.useState(4),o=()=>{const h=Ie(M,k);R("builder",{table:h})};return e.jsxs("div",{className:"wptb-v2-create-table",children:[e.jsx("table",{children:e.jsx("tbody",{children:M<50&&k<50?Array(M).fill(0).map((h,r)=>e.jsx("tr",{children:Array(k).fill(0).map((l,c)=>e.jsx("td",{},c))},r)):e.jsx("tr",{children:e.jsx("td",{})})})}),e.jsxs("div",{className:"wptb-v2-create-table-form",children:[e.jsx("div",{className:"wptb-v2-create-table-form-input",children:e.jsx(Ht,{label:"Number of rows",min:2,max:20,value:M,onChange:i,allowOutOfRange:!0})}),e.jsx("div",{className:"wptb-v2-create-table-form-input",children:e.jsx(Ht,{label:"Number of columns",min:2,max:20,value:k,onChange:s,allowOutOfRange:!0})}),e.jsx("button",{type:"button",className:"wptb-v2-create-btn",onClick:o,children:"Create New"})]})]})},ar=({content:R})=>{const M=J.useRef(null);return J.useLayoutEffect(()=>{if(!M.current)return;const i=M.current,k=i.querySelector("table"),{width:s,height:o}=i.getBoundingClientRect(),h=k.dataset.wptbTableContainerMaxWidth;k.style.width="auto",k.style.minWidth=h?`${h}px`:"700px",k.style.transform="";const r=20,{width:l,height:c}=k.getBoundingClientRect(),x=s/(l+r),g=o/(c+r);k.style.transform=`scale(${Math.min(x,g)})`},[]),e.jsx("div",{ref:M,className:"wptb-v2-table-template-html",children:e.jsx("div",{dangerouslySetInnerHTML:{__html:R}})})},xt=[],or=({setPage:R,search:M})=>{const[i,k]=J.useState(xt),[s,o]=J.useState(!0),[h,r]=J.useState(),l=J.useRef(null);J.useEffect(()=>{if(xt.length){o(!1),k(xt),l.current=new Yt(xt,{includeScore:!0,threshold:.3,keys:["title"]});return}let g=new AbortController;return Lt("/patterns",{signal:g.signal}).then(j=>{if(o(!1),!xt.length){if(j.error)throw new Error(j.error);k(j.patterns),xt.push(...j.patterns),l.current=new Yt(xt,{includeScore:!0,threshold:.3,keys:["title"]})}}).catch(()=>{}).finally(()=>{g=void 0}),()=>g==null?void 0:g.abort()},[]);const c=J.useCallback(g=>{var j;if(g==="")k(xt);else{const u=(j=l.current)==null?void 0:j.search(g),b=u==null?void 0:u.map(a=>a.item);k(b||[])}},[]);J.useEffect(()=>{const g=M==null?void 0:M.trim();if(!g||g.length<2){k(xt);return}c(g)},[M,c]);const x=async g=>{if(g.is_upsell){ze("patterns");return}if(h){ut("A request is already in progress","error");return}r(g.name);const j=(m,d)=>{const{table:w,props:S,innerBlocks:A,tableProps:T}=Vt(m),L=Re();w.tags=[],Ct.dispatch(ie({id:L,table:{...w,id:L,title:"Clone of: "+d},tableProps:T,props:S,innerBlocks:A})),Ct.dispatch(ae(L)),oe.init(),R("builder",{table:L})};if(g.content){j(g.content,g.title);return}const u=`/patterns?name=${g.name}`,b=await Lt(u);if(b.error||!b.pattern){ut(b.error||"Something went wrong","error"),r(void 0);return}const a=b.pattern;j(a.content,a.title)};return e.jsx("div",{className:"wptb-v2-table-templates",children:s?Array.from({length:9},(g,j)=>e.jsxs("div",{className:"wptb-v2-table-template",children:[e.jsx("div",{className:"wptb-v2-table-template-preview",children:e.jsx("div",{className:"wptb-v2-table-template-preview-loading"})}),e.jsx("div",{className:"wptb-v2-table-template-title",children:e.jsx("div",{className:"wptb-v2-table-template-title-loading"})})]},j)):i.map(g=>e.jsxs("button",{className:mt("wptb-v2-table-template",{"wptb-v2-table-template-upsell":g.is_upsell}),onClick:()=>x(g),children:[g.content?e.jsx(ar,{content:g.content}):e.jsxs("div",{className:"wptb-v2-table-template-preview",children:[e.jsx("img",{src:WPTB_CFG.PLUGIN_URL+"/assets/patterns/images/"+g.name+".png",alt:g.name}),h===g.name&&e.jsx("div",{className:"wptb-v2-table-template-preview-creating",children:e.jsx(Gt,{})})]}),e.jsx("div",{className:"wptb-v2-table-template-title",children:g.title})]},g.name))})},lr=({setPage:R,search:M})=>{const[i,k]=J.useState(M||""),s=J.useRef();return J.useEffect(()=>{const o=i==null?void 0:i.trim();if(M){if(o&&o.length>0&&o.length<2)return}else if(!o||o.length<2)return;s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{R("create",{search:i}),s.current=void 0},500)},[i]),e.jsxs("div",{className:"wptb-v2-page wptb-v2-create-page",children:[e.jsx(It,{setPage:R,page:"create"}),e.jsxs("div",{className:"wptb-v2-page-content",children:[e.jsxs("div",{className:"wptb-v2-page-content-top",children:[e.jsx("h2",{children:St("New Table")}),e.jsx(ne,{value:i,onChange:k,placeholder:"Search templates..."})]}),e.jsxs("div",{className:"wptb-v2-page-content-main",children:[e.jsx(ir,{setPage:R}),e.jsx("div",{className:"wptb-v2-divider",children:"or"}),e.jsx("h2",{children:"Choose from templates"}),e.jsx(or,{setPage:R,search:M})]})]})]})};function Pt(R){throw new Error('Could not dynamically require "'+R+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var be={exports:{}};/*! JSZip v3.10.1 - A JavaScript class for generating and reading zip files (c) 2009-2016 Stuart Knightley Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown. JSZip uses the library pako released under the MIT license : https://github.com/nodeca/pako/blob/main/LICENSE */(function(R,M){(function(i){R.exports=i()})(function(){return function i(k,s,o){function h(c,x){if(!s[c]){if(!k[c]){var g=typeof Pt=="function"&&Pt;if(!x&&g)return g(c,!0);if(r)return r(c,!0);var j=new Error("Cannot find module '"+c+"'");throw j.code="MODULE_NOT_FOUND",j}var u=s[c]={exports:{}};k[c][0].call(u.exports,function(b){var a=k[c][1][b];return h(a||b)},u,u.exports,i,k,s,o)}return s[c].exports}for(var r=typeof Pt=="function"&&Pt,l=0;l>2,u=(3&c)<<4|x>>4,b=1>6:64,a=2>4,x=(15&j)<<4|(u=r.indexOf(l.charAt(a++)))>>2,g=(3&u)<<6|(b=r.indexOf(l.charAt(a++))),w[m++]=c,u!==64&&(w[m++]=x),b!==64&&(w[m++]=g);return w}},{"./support":30,"./utils":32}],2:[function(i,k,s){var o=i("./external"),h=i("./stream/DataWorker"),r=i("./stream/Crc32Probe"),l=i("./stream/DataLengthProbe");function c(x,g,j,u,b){this.compressedSize=x,this.uncompressedSize=g,this.crc32=j,this.compression=u,this.compressedContent=b}c.prototype={getContentWorker:function(){var x=new h(o.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),g=this;return x.on("end",function(){if(this.streamInfo.data_length!==g.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),x},getCompressedWorker:function(){return new h(o.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},c.createWorkerFrom=function(x,g,j){return x.pipe(new r).pipe(new l("uncompressedSize")).pipe(g.compressWorker(j)).pipe(new l("compressedSize")).withStreamInfo("compression",g)},k.exports=c},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(i,k,s){var o=i("./stream/GenericWorker");s.STORE={magic:"\0\0",compressWorker:function(){return new o("STORE compression")},uncompressWorker:function(){return new o("STORE decompression")}},s.DEFLATE=i("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(i,k,s){var o=i("./utils"),h=function(){for(var r,l=[],c=0;c<256;c++){r=c;for(var x=0;x<8;x++)r=1&r?3988292384^r>>>1:r>>>1;l[c]=r}return l}();k.exports=function(r,l){return r!==void 0&&r.length?o.getTypeOf(r)!=="string"?function(c,x,g,j){var u=h,b=j+g;c^=-1;for(var a=j;a>>8^u[255&(c^x[a])];return-1^c}(0|l,r,r.length,0):function(c,x,g,j){var u=h,b=j+g;c^=-1;for(var a=j;a>>8^u[255&(c^x.charCodeAt(a))];return-1^c}(0|l,r,r.length,0):0}},{"./utils":32}],5:[function(i,k,s){s.base64=!1,s.binary=!1,s.dir=!1,s.createFolders=!0,s.date=null,s.compression=null,s.compressionOptions=null,s.comment=null,s.unixPermissions=null,s.dosPermissions=null},{}],6:[function(i,k,s){var o=null;o=typeof Promise<"u"?Promise:i("lie"),k.exports={Promise:o}},{lie:37}],7:[function(i,k,s){var o=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",h=i("pako"),r=i("./utils"),l=i("./stream/GenericWorker"),c=o?"uint8array":"array";function x(g,j){l.call(this,"FlateWorker/"+g),this._pako=null,this._pakoAction=g,this._pakoOptions=j,this.meta={}}s.magic="\b\0",r.inherits(x,l),x.prototype.processChunk=function(g){this.meta=g.meta,this._pako===null&&this._createPako(),this._pako.push(r.transformTo(c,g.data),!1)},x.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},x.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},x.prototype._createPako=function(){this._pako=new h[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var g=this;this._pako.onData=function(j){g.push({data:j,meta:g.meta})}},s.compressWorker=function(g){return new x("Deflate",g)},s.uncompressWorker=function(){return new x("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(i,k,s){function o(u,b){var a,m="";for(a=0;a>>=8;return m}function h(u,b,a,m,d,w){var S,A,T=u.file,L=u.compression,N=w!==c.utf8encode,_=r.transformTo("string",w(T.name)),p=r.transformTo("string",c.utf8encode(T.name)),C=T.comment,W=r.transformTo("string",w(C)),v=r.transformTo("string",c.utf8encode(C)),O=p.length!==T.name.length,n=v.length!==C.length,Z="",it="",U="",st=T.dir,D=T.date,rt={crc32:0,compressedSize:0,uncompressedSize:0};b&&!a||(rt.crc32=u.crc32,rt.compressedSize=u.compressedSize,rt.uncompressedSize=u.uncompressedSize);var z=0;b&&(z|=8),N||!O&&!n||(z|=2048);var I=0,V=0;st&&(I|=16),d==="UNIX"?(V=798,I|=function(q,ct){var ft=q;return q||(ft=ct?16893:33204),(65535&ft)<<16}(T.unixPermissions,st)):(V=20,I|=function(q){return 63&(q||0)}(T.dosPermissions)),S=D.getUTCHours(),S<<=6,S|=D.getUTCMinutes(),S<<=5,S|=D.getUTCSeconds()/2,A=D.getUTCFullYear()-1980,A<<=4,A|=D.getUTCMonth()+1,A<<=5,A|=D.getUTCDate(),O&&(it=o(1,1)+o(x(_),4)+p,Z+="up"+o(it.length,2)+it),n&&(U=o(1,1)+o(x(W),4)+v,Z+="uc"+o(U.length,2)+U);var Y="";return Y+=` \0`,Y+=o(z,2),Y+=L.magic,Y+=o(S,2),Y+=o(A,2),Y+=o(rt.crc32,4),Y+=o(rt.compressedSize,4),Y+=o(rt.uncompressedSize,4),Y+=o(_.length,2),Y+=o(Z.length,2),{fileRecord:g.LOCAL_FILE_HEADER+Y+_+Z,dirRecord:g.CENTRAL_FILE_HEADER+o(V,2)+Y+o(W.length,2)+"\0\0\0\0"+o(I,4)+o(m,4)+_+Z+W}}var r=i("../utils"),l=i("../stream/GenericWorker"),c=i("../utf8"),x=i("../crc32"),g=i("../signature");function j(u,b,a,m){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=b,this.zipPlatform=a,this.encodeFileName=m,this.streamFiles=u,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}r.inherits(j,l),j.prototype.push=function(u){var b=u.meta.percent||0,a=this.entriesCount,m=this._sources.length;this.accumulate?this.contentBuffer.push(u):(this.bytesWritten+=u.data.length,l.prototype.push.call(this,{data:u.data,meta:{currentFile:this.currentFile,percent:a?(b+100*(a-m-1))/a:100}}))},j.prototype.openedSource=function(u){this.currentSourceOffset=this.bytesWritten,this.currentFile=u.file.name;var b=this.streamFiles&&!u.file.dir;if(b){var a=h(u,b,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:a.fileRecord,meta:{percent:0}})}else this.accumulate=!0},j.prototype.closedSource=function(u){this.accumulate=!1;var b=this.streamFiles&&!u.file.dir,a=h(u,b,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(a.dirRecord),b)this.push({data:function(m){return g.DATA_DESCRIPTOR+o(m.crc32,4)+o(m.compressedSize,4)+o(m.uncompressedSize,4)}(u),meta:{percent:100}});else for(this.push({data:a.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},j.prototype.flush=function(){for(var u=this.bytesWritten,b=0;b=this.index;l--)c=(c<<8)+this.byteAt(l);return this.index+=r,c},readString:function(r){return o.transformTo("string",this.readData(r))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var r=this.readInt(4);return new Date(Date.UTC(1980+(r>>25&127),(r>>21&15)-1,r>>16&31,r>>11&31,r>>5&63,(31&r)<<1))}},k.exports=h},{"../utils":32}],19:[function(i,k,s){var o=i("./Uint8ArrayReader");function h(r){o.call(this,r)}i("../utils").inherits(h,o),h.prototype.readData=function(r){this.checkOffset(r);var l=this.data.slice(this.zero+this.index,this.zero+this.index+r);return this.index+=r,l},k.exports=h},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(i,k,s){var o=i("./DataReader");function h(r){o.call(this,r)}i("../utils").inherits(h,o),h.prototype.byteAt=function(r){return this.data.charCodeAt(this.zero+r)},h.prototype.lastIndexOfSignature=function(r){return this.data.lastIndexOf(r)-this.zero},h.prototype.readAndCheckSignature=function(r){return r===this.readData(4)},h.prototype.readData=function(r){this.checkOffset(r);var l=this.data.slice(this.zero+this.index,this.zero+this.index+r);return this.index+=r,l},k.exports=h},{"../utils":32,"./DataReader":18}],21:[function(i,k,s){var o=i("./ArrayReader");function h(r){o.call(this,r)}i("../utils").inherits(h,o),h.prototype.readData=function(r){if(this.checkOffset(r),r===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+r);return this.index+=r,l},k.exports=h},{"../utils":32,"./ArrayReader":17}],22:[function(i,k,s){var o=i("../utils"),h=i("../support"),r=i("./ArrayReader"),l=i("./StringReader"),c=i("./NodeBufferReader"),x=i("./Uint8ArrayReader");k.exports=function(g){var j=o.getTypeOf(g);return o.checkSupport(j),j!=="string"||h.uint8array?j==="nodebuffer"?new c(g):h.uint8array?new x(o.transformTo("uint8array",g)):new r(o.transformTo("array",g)):new l(g)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(i,k,s){s.LOCAL_FILE_HEADER="PK",s.CENTRAL_FILE_HEADER="PK",s.CENTRAL_DIRECTORY_END="PK",s.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",s.ZIP64_CENTRAL_DIRECTORY_END="PK",s.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(i,k,s){var o=i("./GenericWorker"),h=i("../utils");function r(l){o.call(this,"ConvertWorker to "+l),this.destType=l}h.inherits(r,o),r.prototype.processChunk=function(l){this.push({data:h.transformTo(this.destType,l.data),meta:l.meta})},k.exports=r},{"../utils":32,"./GenericWorker":28}],25:[function(i,k,s){var o=i("./GenericWorker"),h=i("../crc32");function r(){o.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}i("../utils").inherits(r,o),r.prototype.processChunk=function(l){this.streamInfo.crc32=h(l.data,this.streamInfo.crc32||0),this.push(l)},k.exports=r},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(i,k,s){var o=i("../utils"),h=i("./GenericWorker");function r(l){h.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}o.inherits(r,h),r.prototype.processChunk=function(l){if(l){var c=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=c+l.data.length}h.prototype.processChunk.call(this,l)},k.exports=r},{"../utils":32,"./GenericWorker":28}],27:[function(i,k,s){var o=i("../utils"),h=i("./GenericWorker");function r(l){h.call(this,"DataWorker");var c=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(x){c.dataIsReady=!0,c.data=x,c.max=x&&x.length||0,c.type=o.getTypeOf(x),c.isPaused||c._tickAndRepeat()},function(x){c.error(x)})}o.inherits(r,h),r.prototype.cleanUp=function(){h.prototype.cleanUp.call(this),this.data=null},r.prototype.resume=function(){return!!h.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,o.delay(this._tickAndRepeat,[],this)),!0)},r.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(o.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},r.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,c=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,c);break;case"uint8array":l=this.data.subarray(this.index,c);break;case"array":case"nodebuffer":l=this.data.slice(this.index,c)}return this.index=c,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},k.exports=r},{"../utils":32,"./GenericWorker":28}],28:[function(i,k,s){function o(h){this.name=h||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}o.prototype={push:function(h){this.emit("data",h)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(h){this.emit("error",h)}return!0},error:function(h){return!this.isFinished&&(this.isPaused?this.generatedError=h:(this.isFinished=!0,this.emit("error",h),this.previous&&this.previous.error(h),this.cleanUp()),!0)},on:function(h,r){return this._listeners[h].push(r),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(h,r){if(this._listeners[h])for(var l=0;l "+h:h}},k.exports=o},{}],29:[function(i,k,s){var o=i("../utils"),h=i("./ConvertWorker"),r=i("./GenericWorker"),l=i("../base64"),c=i("../support"),x=i("../external"),g=null;if(c.nodestream)try{g=i("../nodejs/NodejsStreamOutputAdapter")}catch{}function j(b,a){return new x.Promise(function(m,d){var w=[],S=b._internalType,A=b._outputType,T=b._mimeType;b.on("data",function(L,N){w.push(L),a&&a(N)}).on("error",function(L){w=[],d(L)}).on("end",function(){try{var L=function(N,_,p){switch(N){case"blob":return o.newBlob(o.transformTo("arraybuffer",_),p);case"base64":return l.encode(_);default:return o.transformTo(N,_)}}(A,function(N,_){var p,C=0,W=null,v=0;for(p=0;p<_.length;p++)v+=_[p].length;switch(N){case"string":return _.join("");case"array":return Array.prototype.concat.apply([],_);case"uint8array":for(W=new Uint8Array(v),p=0;p<_.length;p++)W.set(_[p],C),C+=_[p].length;return W;case"nodebuffer":return Buffer.concat(_);default:throw new Error("concat : unsupported type '"+N+"'")}}(S,w),T);m(L)}catch(N){d(N)}w=[]}).resume()})}function u(b,a,m){var d=a;switch(a){case"blob":case"arraybuffer":d="uint8array";break;case"base64":d="string"}try{this._internalType=d,this._outputType=a,this._mimeType=m,o.checkSupport(d),this._worker=b.pipe(new h(d)),b.lock()}catch(w){this._worker=new r("error"),this._worker.error(w)}}u.prototype={accumulate:function(b){return j(this,b)},on:function(b,a){var m=this;return b==="data"?this._worker.on(b,function(d){a.call(m,d.data,d.meta)}):this._worker.on(b,function(){o.delay(a,arguments,m)}),this},resume:function(){return o.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(b){if(o.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new g(this,{objectMode:this._outputType!=="nodebuffer"},b)}},k.exports=u},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(i,k,s){if(s.base64=!0,s.array=!0,s.string=!0,s.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",s.nodebuffer=typeof Buffer<"u",s.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")s.blob=!1;else{var o=new ArrayBuffer(0);try{s.blob=new Blob([o],{type:"application/zip"}).size===0}catch{try{var h=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);h.append(o),s.blob=h.getBlob("application/zip").size===0}catch{s.blob=!1}}}try{s.nodestream=!!i("readable-stream").Readable}catch{s.nodestream=!1}},{"readable-stream":16}],31:[function(i,k,s){for(var o=i("./utils"),h=i("./support"),r=i("./nodejsUtils"),l=i("./stream/GenericWorker"),c=new Array(256),x=0;x<256;x++)c[x]=252<=x?6:248<=x?5:240<=x?4:224<=x?3:192<=x?2:1;c[254]=c[254]=1;function g(){l.call(this,"utf-8 decode"),this.leftOver=null}function j(){l.call(this,"utf-8 encode")}s.utf8encode=function(u){return h.nodebuffer?r.newBufferFrom(u,"utf-8"):function(b){var a,m,d,w,S,A=b.length,T=0;for(w=0;w>>6:(m<65536?a[S++]=224|m>>>12:(a[S++]=240|m>>>18,a[S++]=128|m>>>12&63),a[S++]=128|m>>>6&63),a[S++]=128|63&m);return a}(u)},s.utf8decode=function(u){return h.nodebuffer?o.transformTo("nodebuffer",u).toString("utf-8"):function(b){var a,m,d,w,S=b.length,A=new Array(2*S);for(a=m=0;a>10&1023,A[m++]=56320|1023&d)}return A.length!==m&&(A.subarray?A=A.subarray(0,m):A.length=m),o.applyFromCharCode(A)}(u=o.transformTo(h.uint8array?"uint8array":"array",u))},o.inherits(g,l),g.prototype.processChunk=function(u){var b=o.transformTo(h.uint8array?"uint8array":"array",u.data);if(this.leftOver&&this.leftOver.length){if(h.uint8array){var a=b;(b=new Uint8Array(a.length+this.leftOver.length)).set(this.leftOver,0),b.set(a,this.leftOver.length)}else b=this.leftOver.concat(b);this.leftOver=null}var m=function(w,S){var A;for((S=S||w.length)>w.length&&(S=w.length),A=S-1;0<=A&&(192&w[A])==128;)A--;return A<0||A===0?S:A+c[w[A]]>S?A:S}(b),d=b;m!==b.length&&(h.uint8array?(d=b.subarray(0,m),this.leftOver=b.subarray(m,b.length)):(d=b.slice(0,m),this.leftOver=b.slice(m,b.length))),this.push({data:s.utf8decode(d),meta:u.meta})},g.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=g,o.inherits(j,l),j.prototype.processChunk=function(u){this.push({data:s.utf8encode(u.data),meta:u.meta})},s.Utf8EncodeWorker=j},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(i,k,s){var o=i("./support"),h=i("./base64"),r=i("./nodejsUtils"),l=i("./external");function c(a){return a}function x(a,m){for(var d=0;d>8;this.dir=!!(16&this.externalFileAttributes),u==0&&(this.dosPermissions=63&this.externalFileAttributes),u==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var u=o(this.extraFields[1].value);this.uncompressedSize===h.MAX_VALUE_32BITS&&(this.uncompressedSize=u.readInt(8)),this.compressedSize===h.MAX_VALUE_32BITS&&(this.compressedSize=u.readInt(8)),this.localHeaderOffset===h.MAX_VALUE_32BITS&&(this.localHeaderOffset=u.readInt(8)),this.diskNumberStart===h.MAX_VALUE_32BITS&&(this.diskNumberStart=u.readInt(4))}},readExtraFields:function(u){var b,a,m,d=u.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});u.index+4>>6:(u<65536?j[m++]=224|u>>>12:(j[m++]=240|u>>>18,j[m++]=128|u>>>12&63),j[m++]=128|u>>>6&63),j[m++]=128|63&u);return j},s.buf2binstring=function(g){return x(g,g.length)},s.binstring2buf=function(g){for(var j=new o.Buf8(g.length),u=0,b=j.length;u>10&1023,w[b++]=56320|1023&a)}return x(w,b)},s.utf8border=function(g,j){var u;for((j=j||g.length)>g.length&&(j=g.length),u=j-1;0<=u&&(192&g[u])==128;)u--;return u<0||u===0?j:u+l[g[u]]>j?u:j}},{"./common":41}],43:[function(i,k,s){k.exports=function(o,h,r,l){for(var c=65535&o|0,x=o>>>16&65535|0,g=0;r!==0;){for(r-=g=2e3>>1:h>>>1;r[l]=h}return r}();k.exports=function(h,r,l,c){var x=o,g=c+l;h^=-1;for(var j=c;j>>8^x[255&(h^r[j])];return-1^h}},{}],46:[function(i,k,s){var o,h=i("../utils/common"),r=i("./trees"),l=i("./adler32"),c=i("./crc32"),x=i("./messages"),g=0,j=4,u=0,b=-2,a=-1,m=4,d=2,w=8,S=9,A=286,T=30,L=19,N=2*A+1,_=15,p=3,C=258,W=C+p+1,v=42,O=113,n=1,Z=2,it=3,U=4;function st(t,F){return t.msg=x[F],F}function D(t){return(t<<1)-(4t.avail_out&&(B=t.avail_out),B!==0&&(h.arraySet(t.output,F.pending_buf,F.pending_out,B,t.next_out),t.next_out+=B,F.pending_out+=B,t.total_out+=B,t.avail_out-=B,F.pending-=B,F.pending===0&&(F.pending_out=0))}function I(t,F){r._tr_flush_block(t,0<=t.block_start?t.block_start:-1,t.strstart-t.block_start,F),t.block_start=t.strstart,z(t.strm)}function V(t,F){t.pending_buf[t.pending++]=F}function Y(t,F){t.pending_buf[t.pending++]=F>>>8&255,t.pending_buf[t.pending++]=255&F}function q(t,F){var B,y,f=t.max_chain_length,E=t.strstart,H=t.prev_length,G=t.nice_match,P=t.strstart>t.w_size-W?t.strstart-(t.w_size-W):0,K=t.window,X=t.w_mask,$=t.prev,Q=t.strstart+C,lt=K[E+H-1],at=K[E+H];t.prev_length>=t.good_match&&(f>>=2),G>t.lookahead&&(G=t.lookahead);do if(K[(B=F)+H]===at&&K[B+H-1]===lt&&K[B]===K[E]&&K[++B]===K[E+1]){E+=2,B++;do;while(K[++E]===K[++B]&&K[++E]===K[++B]&&K[++E]===K[++B]&&K[++E]===K[++B]&&K[++E]===K[++B]&&K[++E]===K[++B]&&K[++E]===K[++B]&&K[++E]===K[++B]&&EP&&--f!=0);return H<=t.lookahead?H:t.lookahead}function ct(t){var F,B,y,f,E,H,G,P,K,X,$=t.w_size;do{if(f=t.window_size-t.lookahead-t.strstart,t.strstart>=$+($-W)){for(h.arraySet(t.window,t.window,$,$,0),t.match_start-=$,t.strstart-=$,t.block_start-=$,F=B=t.hash_size;y=t.head[--F],t.head[F]=$<=y?y-$:0,--B;);for(F=B=$;y=t.prev[--F],t.prev[F]=$<=y?y-$:0,--B;);f+=$}if(t.strm.avail_in===0)break;if(H=t.strm,G=t.window,P=t.strstart+t.lookahead,K=f,X=void 0,X=H.avail_in,K=p)for(E=t.strstart-t.insert,t.ins_h=t.window[E],t.ins_h=(t.ins_h<=p&&(t.ins_h=(t.ins_h<=p)if(y=r._tr_tally(t,t.strstart-t.match_start,t.match_length-p),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=p){for(t.match_length--;t.strstart++,t.ins_h=(t.ins_h<=p&&(t.ins_h=(t.ins_h<=p&&t.match_length<=t.prev_length){for(f=t.strstart+t.lookahead-p,y=r._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-p),t.lookahead-=t.prev_length-1,t.prev_length-=2;++t.strstart<=f&&(t.ins_h=(t.ins_h<t.pending_buf_size-5&&(B=t.pending_buf_size-5);;){if(t.lookahead<=1){if(ct(t),t.lookahead===0&&F===g)return n;if(t.lookahead===0)break}t.strstart+=t.lookahead,t.lookahead=0;var y=t.block_start+B;if((t.strstart===0||t.strstart>=y)&&(t.lookahead=t.strstart-y,t.strstart=y,I(t,!1),t.strm.avail_out===0)||t.strstart-t.block_start>=t.w_size-W&&(I(t,!1),t.strm.avail_out===0))return n}return t.insert=0,F===j?(I(t,!0),t.strm.avail_out===0?it:U):(t.strstart>t.block_start&&(I(t,!1),t.strm.avail_out),n)}),new nt(4,4,8,4,ft),new nt(4,5,16,8,ft),new nt(4,6,32,32,ft),new nt(4,4,16,16,tt),new nt(8,16,32,32,tt),new nt(8,16,128,128,tt),new nt(8,32,128,256,tt),new nt(32,128,258,1024,tt),new nt(32,258,258,4096,tt)],s.deflateInit=function(t,F){return dt(t,F,w,15,8,0)},s.deflateInit2=dt,s.deflateReset=ht,s.deflateResetKeep=et,s.deflateSetHeader=function(t,F){return t&&t.state?t.state.wrap!==2?b:(t.state.gzhead=F,u):b},s.deflate=function(t,F){var B,y,f,E;if(!t||!t.state||5>8&255),V(y,y.gzhead.time>>16&255),V(y,y.gzhead.time>>24&255),V(y,y.level===9?2:2<=y.strategy||y.level<2?4:0),V(y,255&y.gzhead.os),y.gzhead.extra&&y.gzhead.extra.length&&(V(y,255&y.gzhead.extra.length),V(y,y.gzhead.extra.length>>8&255)),y.gzhead.hcrc&&(t.adler=c(t.adler,y.pending_buf,y.pending,0)),y.gzindex=0,y.status=69):(V(y,0),V(y,0),V(y,0),V(y,0),V(y,0),V(y,y.level===9?2:2<=y.strategy||y.level<2?4:0),V(y,3),y.status=O);else{var H=w+(y.w_bits-8<<4)<<8;H|=(2<=y.strategy||y.level<2?0:y.level<6?1:y.level===6?2:3)<<6,y.strstart!==0&&(H|=32),H+=31-H%31,y.status=O,Y(y,H),y.strstart!==0&&(Y(y,t.adler>>>16),Y(y,65535&t.adler)),t.adler=1}if(y.status===69)if(y.gzhead.extra){for(f=y.pending;y.gzindex<(65535&y.gzhead.extra.length)&&(y.pending!==y.pending_buf_size||(y.gzhead.hcrc&&y.pending>f&&(t.adler=c(t.adler,y.pending_buf,y.pending-f,f)),z(t),f=y.pending,y.pending!==y.pending_buf_size));)V(y,255&y.gzhead.extra[y.gzindex]),y.gzindex++;y.gzhead.hcrc&&y.pending>f&&(t.adler=c(t.adler,y.pending_buf,y.pending-f,f)),y.gzindex===y.gzhead.extra.length&&(y.gzindex=0,y.status=73)}else y.status=73;if(y.status===73)if(y.gzhead.name){f=y.pending;do{if(y.pending===y.pending_buf_size&&(y.gzhead.hcrc&&y.pending>f&&(t.adler=c(t.adler,y.pending_buf,y.pending-f,f)),z(t),f=y.pending,y.pending===y.pending_buf_size)){E=1;break}E=y.gzindexf&&(t.adler=c(t.adler,y.pending_buf,y.pending-f,f)),E===0&&(y.gzindex=0,y.status=91)}else y.status=91;if(y.status===91)if(y.gzhead.comment){f=y.pending;do{if(y.pending===y.pending_buf_size&&(y.gzhead.hcrc&&y.pending>f&&(t.adler=c(t.adler,y.pending_buf,y.pending-f,f)),z(t),f=y.pending,y.pending===y.pending_buf_size)){E=1;break}E=y.gzindexf&&(t.adler=c(t.adler,y.pending_buf,y.pending-f,f)),E===0&&(y.status=103)}else y.status=103;if(y.status===103&&(y.gzhead.hcrc?(y.pending+2>y.pending_buf_size&&z(t),y.pending+2<=y.pending_buf_size&&(V(y,255&t.adler),V(y,t.adler>>8&255),t.adler=0,y.status=O)):y.status=O),y.pending!==0){if(z(t),t.avail_out===0)return y.last_flush=-1,u}else if(t.avail_in===0&&D(F)<=D(B)&&F!==j)return st(t,-5);if(y.status===666&&t.avail_in!==0)return st(t,-5);if(t.avail_in!==0||y.lookahead!==0||F!==g&&y.status!==666){var G=y.strategy===2?function(P,K){for(var X;;){if(P.lookahead===0&&(ct(P),P.lookahead===0)){if(K===g)return n;break}if(P.match_length=0,X=r._tr_tally(P,0,P.window[P.strstart]),P.lookahead--,P.strstart++,X&&(I(P,!1),P.strm.avail_out===0))return n}return P.insert=0,K===j?(I(P,!0),P.strm.avail_out===0?it:U):P.last_lit&&(I(P,!1),P.strm.avail_out===0)?n:Z}(y,F):y.strategy===3?function(P,K){for(var X,$,Q,lt,at=P.window;;){if(P.lookahead<=C){if(ct(P),P.lookahead<=C&&K===g)return n;if(P.lookahead===0)break}if(P.match_length=0,P.lookahead>=p&&0P.lookahead&&(P.match_length=P.lookahead)}if(P.match_length>=p?(X=r._tr_tally(P,1,P.match_length-p),P.lookahead-=P.match_length,P.strstart+=P.match_length,P.match_length=0):(X=r._tr_tally(P,0,P.window[P.strstart]),P.lookahead--,P.strstart++),X&&(I(P,!1),P.strm.avail_out===0))return n}return P.insert=0,K===j?(I(P,!0),P.strm.avail_out===0?it:U):P.last_lit&&(I(P,!1),P.strm.avail_out===0)?n:Z}(y,F):o[y.level].func(y,F);if(G!==it&&G!==U||(y.status=666),G===n||G===it)return t.avail_out===0&&(y.last_flush=-1),u;if(G===Z&&(F===1?r._tr_align(y):F!==5&&(r._tr_stored_block(y,0,0,!1),F===3&&(rt(y.head),y.lookahead===0&&(y.strstart=0,y.block_start=0,y.insert=0))),z(t),t.avail_out===0))return y.last_flush=-1,u}return F!==j?u:y.wrap<=0?1:(y.wrap===2?(V(y,255&t.adler),V(y,t.adler>>8&255),V(y,t.adler>>16&255),V(y,t.adler>>24&255),V(y,255&t.total_in),V(y,t.total_in>>8&255),V(y,t.total_in>>16&255),V(y,t.total_in>>24&255)):(Y(y,t.adler>>>16),Y(y,65535&t.adler)),z(t),0=B.w_size&&(E===0&&(rt(B.head),B.strstart=0,B.block_start=0,B.insert=0),K=new h.Buf8(B.w_size),h.arraySet(K,F,X-B.w_size,B.w_size,0),F=K,X=B.w_size),H=t.avail_in,G=t.next_in,P=t.input,t.avail_in=X,t.next_in=0,t.input=F,ct(B);B.lookahead>=p;){for(y=B.strstart,f=B.lookahead-(p-1);B.ins_h=(B.ins_h<>>=p=_>>>24,S-=p,(p=_>>>16&255)===0)Z[x++]=65535&_;else{if(!(16&p)){if(!(64&p)){_=A[(65535&_)+(w&(1<>>=p,S-=p),S<15&&(w+=n[l++]<>>=p=_>>>24,S-=p,!(16&(p=_>>>16&255))){if(!(64&p)){_=T[(65535&_)+(w&(1<>>=p,S-=p,(p=x-g)>3,w&=(1<<(S-=C<<3))-1,o.next_in=l,o.next_out=x,o.avail_in=l>>24&255)+(v>>>8&65280)+((65280&v)<<8)+((255&v)<<24)}function w(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new o.Buf16(320),this.work=new o.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function S(v){var O;return v&&v.state?(O=v.state,v.total_in=v.total_out=O.total=0,v.msg="",O.wrap&&(v.adler=1&O.wrap),O.mode=b,O.last=0,O.havedict=0,O.dmax=32768,O.head=null,O.hold=0,O.bits=0,O.lencode=O.lendyn=new o.Buf32(a),O.distcode=O.distdyn=new o.Buf32(m),O.sane=1,O.back=-1,j):u}function A(v){var O;return v&&v.state?((O=v.state).wsize=0,O.whave=0,O.wnext=0,S(v)):u}function T(v,O){var n,Z;return v&&v.state?(Z=v.state,O<0?(n=0,O=-O):(n=1+(O>>4),O<48&&(O&=15)),O&&(O<8||15=U.wsize?(o.arraySet(U.window,O,n-U.wsize,U.wsize,0),U.wnext=0,U.whave=U.wsize):(Z<(it=U.wsize-U.wnext)&&(it=Z),o.arraySet(U.window,O,n-Z,it,U.wnext),(Z-=it)?(o.arraySet(U.window,O,n-Z,Z,0),U.wnext=Z,U.whave=U.wsize):(U.wnext+=it,U.wnext===U.wsize&&(U.wnext=0),U.whave>>8&255,n.check=r(n.check,E,2,0),I=z=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&z)<<8)+(z>>8))%31){v.msg="incorrect header check",n.mode=30;break}if((15&z)!=8){v.msg="unknown compression method",n.mode=30;break}if(I-=4,t=8+(15&(z>>>=4)),n.wbits===0)n.wbits=t;else if(t>n.wbits){v.msg="invalid window size",n.mode=30;break}n.dmax=1<>8&1),512&n.flags&&(E[0]=255&z,E[1]=z>>>8&255,n.check=r(n.check,E,2,0)),I=z=0,n.mode=3;case 3:for(;I<32;){if(D===0)break t;D--,z+=Z[U++]<>>8&255,E[2]=z>>>16&255,E[3]=z>>>24&255,n.check=r(n.check,E,4,0)),I=z=0,n.mode=4;case 4:for(;I<16;){if(D===0)break t;D--,z+=Z[U++]<>8),512&n.flags&&(E[0]=255&z,E[1]=z>>>8&255,n.check=r(n.check,E,2,0)),I=z=0,n.mode=5;case 5:if(1024&n.flags){for(;I<16;){if(D===0)break t;D--,z+=Z[U++]<>>8&255,n.check=r(n.check,E,2,0)),I=z=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&(D<(q=n.length)&&(q=D),q&&(n.head&&(t=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),o.arraySet(n.head.extra,Z,U,q,t)),512&n.flags&&(n.check=r(n.check,Z,q,U)),D-=q,U+=q,n.length-=q),n.length))break t;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(D===0)break t;for(q=0;t=Z[U+q++],n.head&&t&&n.length<65536&&(n.head.name+=String.fromCharCode(t)),t&&q>9&1,n.head.done=!0),v.adler=n.check=0,n.mode=12;break;case 10:for(;I<32;){if(D===0)break t;D--,z+=Z[U++]<>>=7&I,I-=7&I,n.mode=27;break}for(;I<3;){if(D===0)break t;D--,z+=Z[U++]<>>=1)){case 0:n.mode=14;break;case 1:if(C(n),n.mode=20,O!==6)break;z>>>=2,I-=2;break t;case 2:n.mode=17;break;case 3:v.msg="invalid block type",n.mode=30}z>>>=2,I-=2;break;case 14:for(z>>>=7&I,I-=7&I;I<32;){if(D===0)break t;D--,z+=Z[U++]<>>16^65535)){v.msg="invalid stored block lengths",n.mode=30;break}if(n.length=65535&z,I=z=0,n.mode=15,O===6)break t;case 15:n.mode=16;case 16:if(q=n.length){if(D>>=5,I-=5,n.ndist=1+(31&z),z>>>=5,I-=5,n.ncode=4+(15&z),z>>>=4,I-=4,286>>=3,I-=3}for(;n.have<19;)n.lens[H[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,B={bits:n.lenbits},F=c(0,n.lens,0,19,n.lencode,0,n.work,B),n.lenbits=B.bits,F){v.msg="invalid code lengths set",n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have>>16&255,ot=65535&f,!((tt=f>>>24)<=I);){if(D===0)break t;D--,z+=Z[U++]<>>=tt,I-=tt,n.lens[n.have++]=ot;else{if(ot===16){for(y=tt+2;I>>=tt,I-=tt,n.have===0){v.msg="invalid bit length repeat",n.mode=30;break}t=n.lens[n.have-1],q=3+(3&z),z>>>=2,I-=2}else if(ot===17){for(y=tt+3;I>>=tt)),z>>>=3,I-=3}else{for(y=tt+7;I>>=tt)),z>>>=7,I-=7}if(n.have+q>n.nlen+n.ndist){v.msg="invalid bit length repeat",n.mode=30;break}for(;q--;)n.lens[n.have++]=t}}if(n.mode===30)break;if(n.lens[256]===0){v.msg="invalid code -- missing end-of-block",n.mode=30;break}if(n.lenbits=9,B={bits:n.lenbits},F=c(x,n.lens,0,n.nlen,n.lencode,0,n.work,B),n.lenbits=B.bits,F){v.msg="invalid literal/lengths set",n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,B={bits:n.distbits},F=c(g,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,B),n.distbits=B.bits,F){v.msg="invalid distances set",n.mode=30;break}if(n.mode=20,O===6)break t;case 20:n.mode=21;case 21:if(6<=D&&258<=rt){v.next_out=st,v.avail_out=rt,v.next_in=U,v.avail_in=D,n.hold=z,n.bits=I,l(v,Y),st=v.next_out,it=v.output,rt=v.avail_out,U=v.next_in,Z=v.input,D=v.avail_in,z=n.hold,I=n.bits,n.mode===12&&(n.back=-1);break}for(n.back=0;nt=(f=n.lencode[z&(1<>>16&255,ot=65535&f,!((tt=f>>>24)<=I);){if(D===0)break t;D--,z+=Z[U++]<>et)])>>>16&255,ot=65535&f,!(et+(tt=f>>>24)<=I);){if(D===0)break t;D--,z+=Z[U++]<>>=et,I-=et,n.back+=et}if(z>>>=tt,I-=tt,n.back+=tt,n.length=ot,nt===0){n.mode=26;break}if(32&nt){n.back=-1,n.mode=12;break}if(64&nt){v.msg="invalid literal/length code",n.mode=30;break}n.extra=15&nt,n.mode=22;case 22:if(n.extra){for(y=n.extra;I>>=n.extra,I-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;nt=(f=n.distcode[z&(1<>>16&255,ot=65535&f,!((tt=f>>>24)<=I);){if(D===0)break t;D--,z+=Z[U++]<>et)])>>>16&255,ot=65535&f,!(et+(tt=f>>>24)<=I);){if(D===0)break t;D--,z+=Z[U++]<>>=et,I-=et,n.back+=et}if(z>>>=tt,I-=tt,n.back+=tt,64&nt){v.msg="invalid distance code",n.mode=30;break}n.offset=ot,n.extra=15&nt,n.mode=24;case 24:if(n.extra){for(y=n.extra;I>>=n.extra,I-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){v.msg="invalid distance too far back",n.mode=30;break}n.mode=25;case 25:if(rt===0)break t;if(q=Y-rt,n.offset>q){if((q=n.offset-q)>n.whave&&n.sane){v.msg="invalid distance too far back",n.mode=30;break}ct=q>n.wnext?(q-=n.wnext,n.wsize-q):n.wnext-q,q>n.length&&(q=n.length),ft=n.window}else ft=it,ct=st-n.offset,q=n.length;for(rtN?(p=ct[ft+m[O]],I[V+m[O]]):(p=96,0),w=1<>st)+(S-=w)]=_<<24|p<<16|C|0,S!==0;);for(w=1<>=1;if(w!==0?(z&=w-1,z+=w):z=0,O++,--Y[v]==0){if(v===Z)break;v=g[j+m[O]]}if(it>>7)]}function V(f,E){f.pending_buf[f.pending++]=255&E,f.pending_buf[f.pending++]=E>>>8&255}function Y(f,E,H){f.bi_valid>d-H?(f.bi_buf|=E<>d-f.bi_valid,f.bi_valid+=H-d):(f.bi_buf|=E<>>=1,H<<=1,0<--E;);return H>>>1}function ft(f,E,H){var G,P,K=new Array(m+1),X=0;for(G=1;G<=m;G++)K[G]=X=X+H[G-1]<<1;for(P=0;P<=E;P++){var $=f[2*P+1];$!==0&&(f[2*P]=ct(K[$]++,$))}}function tt(f){var E;for(E=0;E>1;1<=H;H--)et(f,K,H);for(P=Q;H=f.heap[1],f.heap[1]=f.heap[f.heap_len--],et(f,K,1),G=f.heap[1],f.heap[--f.heap_max]=H,f.heap[--f.heap_max]=G,K[2*P]=K[2*H]+K[2*G],f.depth[P]=(f.depth[H]>=f.depth[G]?f.depth[H]:f.depth[G])+1,K[2*H+1]=K[2*G+1]=P,f.heap[1]=P++,et(f,K,1),2<=f.heap_len;);f.heap[--f.heap_max]=f.heap[1],function(at,bt){var yt,gt,vt,pt,kt,Ut,wt=bt.dyn_tree,qt=bt.max_code,ye=bt.stat_desc.static_tree,ke=bt.stat_desc.has_stree,je=bt.stat_desc.extra_bits,$t=bt.stat_desc.extra_base,Tt=bt.stat_desc.max_length,zt=0;for(pt=0;pt<=m;pt++)at.bl_count[pt]=0;for(wt[2*at.heap[at.heap_max]+1]=0,yt=at.heap_max+1;yt>=7;P>>=1)if(1<&&$.dyn_ltree[2*Q]!==0)return h;if($.dyn_ltree[18]!==0||$.dyn_ltree[20]!==0||$.dyn_ltree[26]!==0)return r;for(Q=32;Q>>3,(K=f.static_len+3+7>>>3)<=P&&(P=K)):P=K=H+5,H+4<=P&&E!==-1?y(f,E,H,G):f.strategy===4||K===P?(Y(f,2+(G?1:0),3),ht(f,W,v)):(Y(f,4+(G?1:0),3),function($,Q,lt,at){var bt;for(Y($,Q-257,5),Y($,lt-1,5),Y($,at-4,4),bt=0;bt>>8&255,f.pending_buf[f.d_buf+2*f.last_lit+1]=255&E,f.pending_buf[f.l_buf+f.last_lit]=255&H,f.last_lit++,E===0?f.dyn_ltree[2*H]++:(f.matches++,E--,f.dyn_ltree[2*(n[H]+g+1)]++,f.dyn_dtree[2*I(E)]++),f.last_lit===f.lit_bufsize-1},s._tr_align=function(f){Y(f,2,3),q(f,S,W),function(E){E.bi_valid===16?(V(E,E.bi_buf),E.bi_buf=0,E.bi_valid=0):8<=E.bi_valid&&(E.pending_buf[E.pending++]=255&E.bi_buf,E.bi_buf>>=8,E.bi_valid-=8)}(f)}},{"../utils/common":41}],53:[function(i,k,s){k.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(i,k,s){(function(o){(function(h,r){if(!h.setImmediate){var l,c,x,g,j=1,u={},b=!1,a=h.document,m=Object.getPrototypeOf&&Object.getPrototypeOf(h);m=m&&m.setTimeout?m:h,l={}.toString.call(h.process)==="[object process]"?function(A){process.nextTick(function(){w(A)})}:function(){if(h.postMessage&&!h.importScripts){var A=!0,T=h.onmessage;return h.onmessage=function(){A=!1},h.postMessage("","*"),h.onmessage=T,A}}()?(g="setImmediate$"+Math.random()+"$",h.addEventListener?h.addEventListener("message",S,!1):h.attachEvent("onmessage",S),function(A){h.postMessage(g+A,"*")}):h.MessageChannel?((x=new MessageChannel).port1.onmessage=function(A){w(A.data)},function(A){x.port2.postMessage(A)}):a&&"onreadystatechange"in a.createElement("script")?(c=a.documentElement,function(A){var T=a.createElement("script");T.onreadystatechange=function(){w(A),T.onreadystatechange=null,c.removeChild(T),T=null},c.appendChild(T)}):function(A){setTimeout(w,0,A)},m.setImmediate=function(A){typeof A!="function"&&(A=new Function(""+A));for(var T=new Array(arguments.length-1),L=0;L"u"?o===void 0?this:o:self)}).call(this,typeof At<"u"?At:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(be);var cr=be.exports;const hr=le(cr);var ve={exports:{}};/* @license Papa Parse v5.5.3 https://github.com/mholt/PapaParse License: MIT */(function(R,M){((i,k)=>{R.exports=k()})(At,function i(){var k=typeof self<"u"?self:typeof window<"u"?window:k!==void 0?k:{},s,o=!k.document&&!!k.postMessage,h=k.IS_PAPA_WORKER||!1,r={},l=0,c={};function x(_){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(p){var C=T(p);C.chunkSize=parseInt(C.chunkSize),p.step||p.chunk||(C.chunkSize=null),this._handle=new a(C),(this._handle.streamer=this)._config=C}).call(this,_),this.parseChunk=function(p,C){var W=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0=this._config.preview),h)k.postMessage({results:v,workerId:c.WORKER_ID,finished:W});else if(N(this._config.chunk)&&!C){if(this._config.chunk(v,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=v=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(v.data),this._completeResults.errors=this._completeResults.errors.concat(v.errors),this._completeResults.meta=v.meta),this._completed||!W||!N(this._config.complete)||v&&v.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),W||v&&v.meta.paused||this._nextChunk(),v}this._halted=!0},this._sendError=function(p){N(this._config.error)?this._config.error(p):h&&this._config.error&&k.postMessage({workerId:c.WORKER_ID,error:p,finished:!1})}}function g(_){var p;(_=_||{}).chunkSize||(_.chunkSize=c.RemoteChunkSize),x.call(this,_),this._nextChunk=o?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(C){this._input=C,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(p=new XMLHttpRequest,this._config.withCredentials&&(p.withCredentials=this._config.withCredentials),o||(p.onload=L(this._chunkLoaded,this),p.onerror=L(this._chunkError,this)),p.open(this._config.downloadRequestBody?"POST":"GET",this._input,!o),this._config.downloadRequestHeaders){var C,W=this._config.downloadRequestHeaders;for(C in W)p.setRequestHeader(C,W[C])}var v;this._config.chunkSize&&(v=this._start+this._config.chunkSize-1,p.setRequestHeader("Range","bytes="+this._start+"-"+v));try{p.send(this._config.downloadRequestBody)}catch(O){this._chunkError(O.message)}o&&p.status===0&&this._chunkError()}},this._chunkLoaded=function(){p.readyState===4&&(p.status<200||400<=p.status?this._chunkError():(this._start+=this._config.chunkSize||p.responseText.length,this._finished=!this._config.chunkSize||this._start>=(C=>(C=C.getResponseHeader("Content-Range"))!==null?parseInt(C.substring(C.lastIndexOf("/")+1)):-1)(p),this.parseChunk(p.responseText)))},this._chunkError=function(C){C=p.statusText||C,this._sendError(new Error(C))}}function j(_){(_=_||{}).chunkSize||(_.chunkSize=c.LocalChunkSize),x.call(this,_);var p,C,W=typeof FileReader<"u";this.stream=function(v){this._input=v,C=v.slice||v.webkitSlice||v.mozSlice,W?((p=new FileReader).onload=L(this._chunkLoaded,this),p.onerror=L(this._chunkError,this)):p=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(v.target.result)},this._chunkError=function(){this._sendError(p.error)}}function u(_){var p;x.call(this,_=_||{}),this.stream=function(C){return p=C,this._nextChunk()},this._nextChunk=function(){var C,W;if(!this._finished)return C=this._config.chunkSize,p=C?(W=p.substring(0,C),p.substring(C)):(W=p,""),this._finished=!p,this.parseChunk(W)}}function b(_){x.call(this,_=_||{});var p=[],C=!0,W=!1;this.pause=function(){x.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){x.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(v){this._input=v,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){W&&p.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),p.length?this.parseChunk(p.shift()):C=!0},this._streamData=L(function(v){try{p.push(typeof v=="string"?v:v.toString(this._config.encoding)),C&&(C=!1,this._checkIsFinished(),this.parseChunk(p.shift()))}catch(O){this._streamError(O)}},this),this._streamError=L(function(v){this._streamCleanUp(),this._sendError(v)},this),this._streamEnd=L(function(){this._streamCleanUp(),W=!0,this._streamData("")},this),this._streamCleanUp=L(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function a(_){var p,C,W,v,O=Math.pow(2,53),n=-O,Z=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,it=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,U=this,st=0,D=0,rt=!1,z=!1,I=[],V={data:[],errors:[],meta:{}};function Y(tt){return _.skipEmptyLines==="greedy"?tt.join("").trim()==="":tt.length===1&&tt[0].length===0}function q(){if(V&&W&&(ft("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+c.DefaultDelimiter+"'"),W=!1),_.skipEmptyLines&&(V.data=V.data.filter(function(et){return!Y(et)})),ct()){let et=function(ht,dt){N(_.transformHeader)&&(ht=_.transformHeader(ht,dt)),I.push(ht)};if(V)if(Array.isArray(V.data[0])){for(var tt=0;ct()&&tt(E=>(_.dynamicTypingFunction&&_.dynamicTyping[E]===void 0&&(_.dynamicTyping[E]=_.dynamicTypingFunction(E)),(_.dynamicTyping[E]||_.dynamicTyping)===!0))(y)?f==="true"||f==="TRUE"||f!=="false"&&f!=="FALSE"&&((E=>{if(Z.test(E)&&(E=parseFloat(E),n=I.length?"__parsed_extra":I[t]:F,B=_.transform?_.transform(B,F):B);F==="__parsed_extra"?(dt[F]=dt[F]||[],dt[F].push(B)):dt[F]=B}return _.header&&(t>I.length?ft("FieldMismatch","TooManyFields","Too many fields: expected "+I.length+" fields but parsed "+t,D+ht):t_.preview?C.abort():(V.data=V.data[0],v(V,U))))}),this.parse=function(tt,nt,ot){var et=_.quoteChar||'"',et=(_.newline||(_.newline=this.guessLineEndings(tt,et)),W=!1,_.delimiter?N(_.delimiter)&&(_.delimiter=_.delimiter(tt),V.meta.delimiter=_.delimiter):((et=((ht,dt,t,F,B)=>{var y,f,E,H;B=B||[","," ","|",";",c.RECORD_SEP,c.UNIT_SEP];for(var G=0;G=ot.length/2?`\r `:"\r"}}function m(_){return _.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function d(_){var p=(_=_||{}).delimiter,C=_.newline,W=_.comments,v=_.step,O=_.preview,n=_.fastMode,Z=null,it=!1,U=_.quoteChar==null?'"':_.quoteChar,st=U;if(_.escapeChar!==void 0&&(st=_.escapeChar),(typeof p!="string"||-1=O)return X(!0);break}ot.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:nt.length,index:D}),f++}}else if(W&&et.length===0&&z.substring(D,D+ft)===W){if(B===-1)return X();D=B+ct,B=z.indexOf(C,D),F=z.indexOf(p,D)}else if(F!==-1&&(F=O)return X(!0)}return P();function H(Q){nt.push(Q),ht=D}function G(Q){var lt=0;return lt=Q!==-1&&(Q=z.substring(f+1,Q))&&Q.trim()===""?Q.length:lt}function P(Q){return V||(Q===void 0&&(Q=z.substring(D)),et.push(Q),D=Y,H(et),tt&&$()),X()}function K(Q){D=Q,H(et),et=[],B=z.indexOf(C,D)}function X(Q){if(_.header&&!I&&nt.length&&!it){var lt=nt[0],at=Object.create(null),bt=new Set(lt);let yt=!1;for(let gt=0;gtW.charCodeAt(0)!==65279?W:W.slice(1))(_),C=new(p.download?g:u)(p)):_.readable===!0&&N(_.read)&&N(_.on)?C=new b(p):(k.File&&_ instanceof File||_ instanceof Object)&&(C=new j(p)),C.stream(_);(C=(()=>{var W;return!!c.WORKERS_SUPPORTED&&(W=(()=>{var v=k.URL||k.webkitURL||null,O=i.toString();return c.BLOB_URL||(c.BLOB_URL=v.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",O,")();"],{type:"text/javascript"})))})(),(W=new k.Worker(W)).onmessage=w,W.id=l++,r[W.id]=W)})()).userStep=p.step,C.userChunk=p.chunk,C.userComplete=p.complete,C.userError=p.error,p.step=N(p.step),p.chunk=N(p.chunk),p.complete=N(p.complete),p.error=N(p.error),delete p.worker,C.postMessage({input:_,config:p,workerId:C.id})},c.unparse=function(_,p){var C=!1,W=!0,v=",",O=`\r `,n='"',Z=n+n,it=!1,U=null,st=!1,D=((()=>{if(typeof p=="object"){if(typeof p.delimiter!="string"||c.BAD_DELIMITERS.filter(function(I){return p.delimiter.indexOf(I)!==-1}).length||(v=p.delimiter),typeof p.quotes!="boolean"&&typeof p.quotes!="function"&&!Array.isArray(p.quotes)||(C=p.quotes),typeof p.skipEmptyLines!="boolean"&&typeof p.skipEmptyLines!="string"||(it=p.skipEmptyLines),typeof p.newline=="string"&&(O=p.newline),typeof p.quoteChar=="string"&&(n=p.quoteChar),typeof p.header=="boolean"&&(W=p.header),Array.isArray(p.columns)){if(p.columns.length===0)throw new Error("Option columns is empty");U=p.columns}p.escapeChar!==void 0&&(Z=p.escapeChar+n),p.escapeFormulae instanceof RegExp?st=p.escapeFormulae:typeof p.escapeFormulae=="boolean"&&p.escapeFormulae&&(st=/^[=+\-@\t\r].*$/)}})(),new RegExp(m(n),"g"));if(typeof _=="string"&&(_=JSON.parse(_)),Array.isArray(_)){if(!_.length||Array.isArray(_[0]))return rt(null,_,it);if(typeof _[0]=="object")return rt(U||Object.keys(_[0]),_,it)}else if(typeof _=="object")return typeof _.data=="string"&&(_.data=JSON.parse(_.data)),Array.isArray(_.data)&&(_.fields||(_.fields=_.meta&&_.meta.fields||U),_.fields||(_.fields=Array.isArray(_.data[0])?_.fields:typeof _.data[0]=="object"?Object.keys(_.data[0]):[]),Array.isArray(_.data[0])||typeof _.data[0]=="object"||(_.data=[_.data])),rt(_.fields||[],_.data||[],it);throw new Error("Unable to serialize unrecognized input");function rt(I,V,Y){var q="",ct=(typeof I=="string"&&(I=JSON.parse(I)),typeof V=="string"&&(V=JSON.parse(V)),Array.isArray(I)&&0{for(var tt=0;tts.trim(),...M});return i.errors.length>0&&console.warn("CSV parsing warnings:",i.errors),i.data.map(s=>Array.isArray(s)?s.map(o=>String(o||"")):[String(s||"")])}const fr=R=>new Promise(M=>{const i=new FileReader;i.onload=function(k){var s;(s=k.target)!=null&&s.result&&hr.loadAsync(k.target.result).then(function(o){M(o)})},i.readAsArrayBuffer(R)}),Jt=async R=>{const M=[],i=[];for(let k=0;k{for(let i=0;i{const M=Vt(R);if(!M)return;const{props:i,table:k,innerBlocks:s,tableProps:o}=M;return i.table=o,JSON.stringify(ce(i,k.desktop,s,"table"))},xe=R=>{var h;((h=R.at(-1))==null?void 0:h.length)===1&&R.pop();const M=R.reduce((r,l)=>Math.max(r,l.length),0),k={table:{...Xe,colCount:M,rowCount:R.length}},s={},o=[];for(let r=0;rnew Promise((M,i)=>{R.async("text").then(k=>{if(R.name.endsWith(".csv"))M(xe(_e(k)));else if(R.name.endsWith(".xml")){const s=we(k);M(JSON.stringify(s))}else i("Unsupported file: "+R.name),M(null)})}),gr=async({setLoadings:R,zips:M,rawFiles:i,keepTitles:k})=>{R.current({});const s=ut("Preparing tables...","progress",0),o=[];for(let g=0;g({...w,[a]:m})),r++,l++;continue}R.current(w=>({...w,[a]:1})),g.push(new Promise(w=>{Et("/save",{title:k?d:void 0,content:b}).then(([,S])=>{R.current(A=>({...A,[a]:S.ok?2:S.statusText})),S.ok||l++}).catch(S=>{R.current(A=>({...A,[a]:S instanceof Error?S.message:"Something went wrong..."})),l++}).finally(()=>{r++,w(!0)})})),Rt(s,{progress:r/h*100,message:`[${r}/${h}] Importing tables...`})}try{await Promise.all(g)}catch{}c+=5}const x=h-l;x>0?Rt(s,{type:"success",message:`${x} tables imported successfully!`,spawned_at:Date.now(),duration:5e3}):Rt(s,{type:"error",message:"No tables imported.",duration:5e3,spawned_at:Date.now()-1e4}),l>0&&ut(`${l} tables failed to import.`,"error")},Qt=R=>R?R===1?se:R===2?Be:e.jsx(he,{content:R,style:{color:"red"},children:Pe}):"",br=({setPage:R})=>{const[M,i]=J.useState(!1),[k,s]=J.useState(!0),[o,h]=J.useState([]),[r,l]=J.useState([]),[c,x]=J.useState({}),[g,j]=J.useState(!1),u=J.useRef(x);J.useEffect(()=>{u.current=x},[x]);const b=async S=>{if(S.preventDefault(),S.stopPropagation(),i(!1),g){ut("Please wait for the previous import to finish.","error");return}const[A,T]=await Jt(S.dataTransfer.files);h([...o,...A]),l([...r,...T])},a=async S=>{if(g){S.target.value="",ut("Please wait for the previous import to finish.","error");return}const[A,T]=await Jt(Array.from(S.target.files));h([...o,...A]),l([...r,...T]),S.target.value=""},m=(S,A)=>{h(T=>{const L=[...T];return A!==void 0?L[S].files.splice(A,1):L.splice(S,1),L})},d=S=>{l(A=>{if(S===void 0)return[];const T=[...A];return T.splice(S,1),T})},w=async()=>{if(g){ut("Please wait for the previous import to finish.","error");return}j(!0),await gr({setLoadings:u,zips:o,rawFiles:r,keepTitles:k}),j(!1)};return e.jsxs("div",{className:"wptb-v2-page",children:[e.jsx(It,{setPage:R,page:"import"}),e.jsxs("div",{className:"wptb-v2-page-content",children:[e.jsx("div",{className:"wptb-v2-page-content-top",children:e.jsx("h3",{children:"Import Table"})}),e.jsxs("div",{className:mt("wptb-v2-page-content-main wptb-v2-import-page",{"wptb-v2-import-page-has-files":o.length>0||r.length>0}),children:[e.jsxs("div",{className:"wptb-v2-import-page-main-area",children:[e.jsxs("div",{className:"wptb-v2-import-page-file-area",children:[e.jsx("h3",{children:"Pick files"}),e.jsxs("div",{className:mt("wptb-v2-import-page-dropzone",{"wptb-v2-import-page-dropzone-dragover":M}),onDragOver:S=>{i(!0),S.preventDefault(),S.stopPropagation()},onDragLeave:()=>i(!1),onDrop:b,children:[e.jsx("p",{className:"wptb-v2-import-page-dropzone-text",children:"Drag and drop your files here"}),e.jsx("p",{className:"wptb-v2-import-page-dropzone-types",children:"(csv, xml, zip)"}),e.jsx("div",{className:"wptb-v2-divider",children:"or"}),e.jsxs("label",{children:["Browse files",e.jsx("input",{type:"file",accept:".csv, .xml, .zip",onChange:a,multiple:!0})]})]})]}),(o.length>0||r.length>0)&&e.jsxs("div",{className:"wptb-v2-import-page-preview",children:[e.jsxs("h3",{children:["To be imported",e.jsx("button",{type:"button",title:"Clear Files",onClick:()=>{h([]),l([])},children:Ft})]}),r.length>0&&e.jsxs("div",{className:"wptb-v2-import-page-preview-item",children:[e.jsxs("p",{children:["Single tables",!g&&e.jsx("button",{type:"button",onClick:()=>d(),children:Ot})]}),e.jsx("ul",{children:r.map((S,A)=>e.jsxs("li",{children:[S.name,e.jsxs("div",{className:"wptb-v2-import-page-preview-status",children:[Qt(c[A]),!g&&e.jsx("button",{type:"button",onClick:()=>d(A),children:Ot})]})]},`${S.name}_${A}`))})]}),o.map((S,A)=>e.jsxs("div",{className:"wptb-v2-import-page-preview-item",children:[e.jsxs("p",{children:[S.name,!g&&e.jsx("button",{type:"button",onClick:()=>m(A),children:Ot})]}),e.jsx("ul",{children:S.files.map((T,L)=>e.jsxs("li",{children:[T.object.name,e.jsxs("div",{className:"wptb-v2-import-page-preview-status",children:[Qt(c[`${A}_${L}`]),!g&&e.jsx("button",{type:"button",onClick:()=>m(A,L),children:Ot})]})]},`${T.object.name}_${L}`))})]},S.name))]})]}),e.jsxs("div",{className:"wptb-v2-import-page-form",children:[e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:k,onChange:()=>s(!k)}),e.jsx("p",{children:"Preserve table titles"})]}),e.jsxs("button",{type:"button",onClick:w,disabled:g,children:[g?e.jsx(Oe,{}):e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 20 20",children:e.jsx("path",{fill:"currentColor",d:"M9 6c0-1.6.8-3 2-4h-1c-3.9 0-7 .9-7 2c0 1 2.6 1.8 6 2m3.8 4.8c-.9.1-1.9.2-2.8.2c-3.9 0-7-.9-7-2v3c0 1.1 3.1 2 7 2s7-.9 7-2v-2c-.9.7-1.9 1-3 1c-.4 0-.8-.1-1.2-.2M10 15c-3.9 0-7-.9-7-2v3c0 1.1 3.1 2 7 2s7-.9 7-2v-3c0 1.1-3.1 2-7 2m0-5h1c-1-.7-1.7-1.8-1.9-3C5.7 6.9 3 6 3 5v3c0 1.1 3.1 2 7 2m4 0c2.2 0 4-1.8 4-4s-1.8-4-4-4s-4 1.8-4 4s1.8 4 4 4m-1-4V3h2v3h2l-3 3l-3-3z"})}),"Import"]})]})]})]})]})},vr=({onSelect:R,onAllSelect:M,apiData:i,searchTxt:k,setSearch:s,items:o,sorting:h})=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"wptb-v2-export-page-header",children:[e.jsx("h2",{children:"All Tables"}),e.jsxs("div",{className:"wptb-v2-export-page-search",children:[e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 48 48",children:e.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinejoin:"round",strokeWidth:"4",children:[e.jsx("path",{d:"M21 38c9.389 0 17-7.611 17-17S30.389 4 21 4S4 11.611 4 21s7.611 17 17 17Z"}),e.jsx("path",{strokeLinecap:"round",d:"M26.657 14.343A7.98 7.98 0 0 0 21 12a7.98 7.98 0 0 0-5.657 2.343m17.879 18.879l8.485 8.485"})]})}),e.jsx("input",{type:"search",placeholder:"Search...",value:k,onChange:r=>s(r.target.value)})]})]}),e.jsxs("p",{className:"wptb-pagination-info",children:["Showing ",e.jsx("b",{children:i.page_start})," to ",e.jsx("b",{children:i.page_end})," of"," ",e.jsx("b",{children:i.total_count})," entries"]}),e.jsx(ue,{onSelect:R,onAllCheck:M,sorting:h,isLoading:i.loading,items:o,columns:["title","modified","id"],htmlColumns:{title:!0},checkbox:!0})]}),_r=({onUnSelect:R,onAllUnSelect:M,items:i})=>{const k=pe("modified","desc"),[s,o]=J.useState(""),[h,r]=J.useState(i);J.useEffect(()=>{r(i)},[i]),J.useEffect(()=>{if(s==="")return r(i);const c=i.filter(x=>x.title.toLowerCase().includes(s.toLowerCase()));r(c)},[s,i]);const l=k[0];return J.useEffect(()=>r(c=>(l.order==="asc"?c.sort((x,g)=>x[l.by].toString().localeCompare(g[l.by].toString())):c.sort((x,g)=>g[l.by].toString().localeCompare(x[l.by].toString())),[...c])),[l]),e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"wptb-v2-export-page-header",children:[e.jsx("h2",{children:"To Export"}),e.jsxs("div",{className:"wptb-v2-export-page-search",children:[e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 48 48",children:e.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinejoin:"round",strokeWidth:"4",children:[e.jsx("path",{d:"M21 38c9.389 0 17-7.611 17-17S30.389 4 21 4S4 11.611 4 21s7.611 17 17 17Z"}),e.jsx("path",{strokeLinecap:"round",d:"M26.657 14.343A7.98 7.98 0 0 0 21 12a7.98 7.98 0 0 0-5.657 2.343m17.879 18.879l8.485 8.485"})]})}),e.jsx("input",{type:"search",placeholder:"Search...",value:s,onChange:c=>o(c.target.value)})]})]}),e.jsx(ue,{onSelect:R,onAllCheck:M,sorting:k,items:h,columns:["title","modified","id"],htmlColumns:{title:!0},checkbox:!0,checked:!0,noItemsMessage:"No tables selected"})]})},Zt=document.createElement("a"),wr=async(R,M)=>{try{const i=new URLSearchParams({ids:R,type:M.toLowerCase()}),k=await Le(`/export?${i}`);if(!k.ok){const g=await k.json();throw new Error(g.message||"Export failed")}if(k.headers.get("content-type")!=="application/octet-stream"){const g=await k.json();throw new Error(g.message||"Unexpected response format")}const o=k.headers.get("content-disposition"),r=/filename="(.+\..+)"/.exec(o||"");if(r===null)throw new Error("Invalid file name header!");const l=r[1],c=await k.blob(),x=window.URL.createObjectURL(c);Zt.href=x,Zt.download=l,Zt.click(),window.URL.revokeObjectURL(x),ut('File downloaded as "'+l+'"',"success")}catch(i){ut(i.message||"Something went wrong","error")}},xr={xml:e.jsxs(e.Fragment,{children:[e.jsx("b",{children:"XML:"})," an exact copy of your tables will be exported, ideal for backing up and sharing your tables with your other WordPress sites that uses WP Table Builder."]}),csv:e.jsxs(e.Fragment,{children:[e.jsx("b",{children:"CSV:"})," only text content of your tables will be exported, ideal for usage within other apps/plugins."]})},yr=({setPage:R})=>{const M=J.useRef(),[i,k]=J.useState(1),s=pe("modified","desc"),[o,h]=J.useState(""),[r,l]=J.useState([]),[c,x]=J.useState(""),[g,j]=J.useState("xml"),[u,b]=J.useState(!1),[a,m,d]=me({page:i,search:o,sort:s[0],abortCtrl:M.current,skipTables:c});J.useEffect(()=>{l(a.posts)},[a.posts]);const[w,S]=J.useState([]),A=p=>{const C=c+","+p.id;x(C.replace(/^,/,"")),S([...w,p]),l(r.filter(W=>W.id!==p.id)),r.length<=1&&d()},T=p=>{S(w.filter(W=>W.id!==p.id)),l([...r,p]);let C=c.replace(p.id.toString(),"");C=C.replace(/,,/,","),C=C.replace(/(^,)|(,$)/,""),x(C)},L=()=>{if(!r.length)return;const p=[...w];let C=c;r.forEach(W=>{p.push(W),C=C+","+W.id}),C=C.replace(/^,/,""),S(p),x(C),d()},N=()=>{w.length&&(S([]),x(""),l([...r,...w]))},_=()=>{if(!u){if(!c){ut("No tables selected","error");return}b(!0),wr(c,g).then(()=>{b(!1),N()})}};return e.jsxs("div",{className:"wptb-v2-page",children:[e.jsx(It,{setPage:R,page:"export"}),e.jsxs("div",{className:"wptb-v2-page-content",children:[e.jsx("div",{className:"wptb-v2-page-content-top",children:e.jsx("h3",{children:"Export Table"})}),e.jsxs("div",{className:"wptb-v2-export-page",children:[e.jsxs("div",{className:"wptb-v2-export-page-unselected",children:[e.jsx(vr,{onSelect:A,onAllSelect:L,apiData:a,setSearch:h,searchTxt:o,items:r,sorting:s}),e.jsx(Fe,{apiData:a,setPage:k})]}),e.jsxs("div",{className:"wptb-v2-export-page-exchange",children:[e.jsx("button",{type:"button",onClick:L,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:e.jsxs("g",{fill:"none",children:[e.jsx("path",{d:"M24 0v24H0V0zM12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035q-.016-.005-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.017-.018m.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093q.019.005.029-.008l.004-.014l-.034-.614q-.005-.019-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01z"}),e.jsx("path",{fill:"currentColor",d:"m15.06 5.283l5.657 5.657a1.5 1.5 0 0 1 0 2.12l-5.656 5.658a1.5 1.5 0 0 1-2.122-2.122l3.096-3.096H4.5a1.5 1.5 0 0 1 0-3h11.535L12.94 7.404a1.5 1.5 0 0 1 2.122-2.121Z"})]})})}),e.jsx("button",{type:"button",onClick:N,children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:e.jsxs("g",{fill:"none",children:[e.jsx("path",{d:"M24 0v24H0V0zM12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035q-.016-.005-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.017-.018m.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093q.019.005.029-.008l.004-.014l-.034-.614q-.005-.019-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01z"}),e.jsx("path",{fill:"currentColor",d:"M3.283 10.94a1.5 1.5 0 0 0 0 2.12l5.656 5.658a1.5 1.5 0 1 0 2.122-2.122L7.965 13.5H19.5a1.5 1.5 0 0 0 0-3H7.965l3.096-3.096a1.5 1.5 0 1 0-2.122-2.121z"})]})})})]}),e.jsxs("div",{className:"wptb-v2-export-page-selected",children:[e.jsx(_r,{onUnSelect:T,onAllUnSelect:N,items:w}),e.jsxs("div",{className:"wptb-v2-export-page-form",children:[e.jsx("p",{children:"Format:"}),e.jsxs("select",{value:g,onChange:p=>j(p.target.value),children:[e.jsx("option",{value:"xml",children:"XML"}),e.jsx("option",{value:"csv",children:"CSV"})]}),e.jsx(he,{content:xr[g],className:"wptb-v2-export-page-form-info",children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:e.jsx("path",{fill:"currentColor",d:"M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10s-4.477 10-10 10m-1-7v2h2v-2zm2-1.645A3.502 3.502 0 0 0 12 6.5a3.5 3.5 0 0 0-3.433 2.813l1.962.393A1.5 1.5 0 1 1 12 11.5a1 1 0 0 0-1 1V14h2z"})})}),e.jsxs("button",{type:"button",disabled:u,onClick:_,children:[u?e.jsx(Gt,{}):e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 256 256",children:e.jsx("path",{fill:"currentColor",d:"M74.34 85.66a8 8 0 0 1 11.32-11.32L120 108.69V24a8 8 0 0 1 16 0v84.69l34.34-34.35a8 8 0 0 1 11.32 11.32l-48 48a8 8 0 0 1-11.32 0ZM240 136v64a16 16 0 0 1-16 16H32a16 16 0 0 1-16-16v-64a16 16 0 0 1 16-16h52.4a4 4 0 0 1 2.83 1.17L111 145a24 24 0 0 0 34 0l23.8-23.8a4 4 0 0 1 2.8-1.2H224a16 16 0 0 1 16 16m-40 32a12 12 0 1 0-12 12a12 12 0 0 0 12-12"})}),"Export"]})]})]})]})]})]})},kr=R=>typeof R=="number"||parseInt(R).toString()===R,jr=({table:R,setPage:M})=>{const i=De(),[k,s]=J.useState(!1),[o,h]=J.useState(),[r,l]=J.useState(null),c=(b,a)=>{const m=Vt(b),{props:d,table:w,innerBlocks:S,tableProps:A,corruption:T}=m;if(T){h(T),l({table:b,...a});return}Ct.dispatch(ie({id:R,table:{...w,id:R,title:a.name,tags:a.tags,is_template:a.is_template},tableProps:A,props:d,innerBlocks:S})),Ct.dispatch(ae(R)),oe.init(),s(!0)},x=()=>{if(!r)return;const b=Je(r.table);h(void 0),l(null),c(b,{name:r.name,tags:r.tags,is_template:r.is_template}),ut("Table repaired successfully","success",3e3)},g=()=>{if(h(void 0),l(null),history.length>2){history.back();return}M("tables")};J.useEffect(()=>{if(i(Ue({isSaving:!1,activeBlock:void 0,timeTravel:{lastSaved:/[^0-9]/.test(R)?void 0:0,cursor:0,total:0}})),!kr(R)){if(!Ct.getState().tables[R]){history.replaceState(null,"","?page=wptb"),M("tables");return}s(!0);return}s(!1),h(void 0),l(null);const b=new AbortController;return Lt(`/table?id=${R}`,{signal:b.signal}).then(a=>{if(!a.table){ut("Table not found","error",5e3),history.replaceState(null,"","?page=wptb"),M("tables");return}c(a.table,{name:a.name,tags:a.tags,is_template:a.is_template})}).catch(a=>null),()=>b.abort()},[R,M,i]);const j=({id:b,is_new:a})=>{a&&history.replaceState(null,"","?page=wptb-builder&table="+b)},u=()=>{if(history.length>2){history.back();return}M("tables")};return e.jsx(We,{isLoaded:k,onSave:j,onClose:u,corruption:o,onRecover:x,onCancelRecovery:g})},Sr=()=>{const[R,M]=J.useState(!1),[i,k]=J.useState(WPTB_CFG.SETTINGS.general||{}),s=l=>{var c;if((c=i.allowed_roles)!=null&&c.includes(l)){const x=i.allowed_roles.filter(g=>g!==l);k({...i,allowed_roles:x})}else{const x=[...i.allowed_roles||[],l];k({...i,allowed_roles:x})}},o=async()=>{if(!R){M(!0);try{const[l,c]=await Et("/settings",{general:i});if(!c.ok){ut(l.error||l.message||"Something went wrong","error");return}if(l.error){ut(l.error,"error");return}ut(l.message||"Settings saved successfully","success"),WPTB_CFG.SETTINGS.general=l.settings.general}catch(l){console.log(l),ut("Something went wrong","error")}finally{M(!1)}}},h=()=>{k(WPTB_CFG.SETTINGS.general||{})},r=WPTB_CFG.SETTINGS.all_roles||{};return e.jsxs("div",{children:[e.jsxs("div",{className:"wptb-v2-general-settings wptb-v2-settings-area",children:[e.jsxs("div",{className:"wptb-v2-setting-group",children:[e.jsx("h3",{children:"Allowed User Roles"}),e.jsx("div",{className:"wptb-v2-setting-group-items",children:Object.keys(r).map(l=>{var c;return e.jsx(jt,{label:r[l].name,checked:(c=i.allowed_roles)==null?void 0:c.includes(l),onChange:()=>s(l)},l)})})]}),e.jsxs("div",{className:"wptb-v2-setting-group",children:[e.jsx("h3",{children:"Table Settings"}),e.jsxs("div",{className:"wptb-v2-setting-group-items",children:[e.jsx(jt,{label:"Show edit link in frontend",checked:!!i.display_edit_link_frontend,onChange:()=>k({...i,display_edit_link_frontend:!i.display_edit_link_frontend})}),e.jsx(jt,{label:"Give credits to WP Table Builder",checked:!!i.display_credits,onChange:()=>k({...i,display_credits:!i.display_credits})}),e.jsx(jt,{label:"Restrict users access to own tables",checked:!!i.restrict_users_to_their_tables,onChange:()=>k({...i,restrict_users_to_their_tables:!i.restrict_users_to_their_tables})}),e.jsx(jt,{label:"Disable Emoji to Image conversion",checked:!!i.disable_emoji_image_conversion,onChange:()=>k({...i,disable_emoji_image_conversion:!i.disable_emoji_image_conversion})}),e.jsx(jt,{label:"Disable theme styles",checked:!!i.disable_theme_styles,onChange:()=>k({...i,disable_theme_styles:!i.disable_theme_styles})})]})]}),e.jsxs("div",{className:"wptb-v2-setting-group",children:[e.jsx("h3",{children:"Plugin Options"}),e.jsxs("div",{className:"wptb-v2-setting-group-items",children:[e.jsx(de,{rtl:!0,label:"Take over the entire screen in builder",checked:!!i.take_over_entire_screen,onChange:l=>k({...i,take_over_entire_screen:l})}),e.jsx(Nt,{label:"Sidebar Location",value:i.sidebar_position||"left",onChange:l=>k({...i,sidebar_position:l}),options:[{value:"left",label:"Left"},{value:"right",label:"Right"}]}),e.jsx(jt,{label:"Enable Version Sync",checked:!!i.enable_version_sync,onChange:()=>k({...i,enable_version_sync:!i.enable_version_sync})})]})]})]}),e.jsxs("div",{className:"wptb-v2-setting-btns",children:[e.jsx("button",{type:"button",className:"wptb-btn-revert",onClick:h,disabled:R,children:"Revert"}),e.jsxs("button",{type:"button",className:"wptb-btn-save",onClick:o,disabled:R,children:[R&&Dt," Save"]})]})]})},Cr=()=>{var h;const[R,M]=J.useState(((h=WPTB_CFG.SETTINGS)==null?void 0:h.table_style)||""),[i,k]=J.useState(!1),s=async()=>{if(!i){k(!0);try{const[r,l]=await Et("/settings",{global_styles:R});if(!l.ok){ut(r.error||r.message||"Something went wrong","error");return}if(r.error){ut(r.error,"error");return}ut(r.message||"Settings saved successfully","success"),WPTB_CFG.SETTINGS.table_style=r.settings.global_styles}catch(r){console.log(r),ut("Something went wrong","error")}finally{k(!1)}}},o=()=>{M(WPTB_CFG.SETTINGS.table_style||"")};return e.jsxs("div",{children:[e.jsxs("div",{className:"wptb-v2-settings-area wptb-v2-table-settings",children:[e.jsx("p",{children:"These styles will be applied to all tables."}),e.jsx(Me,{label:"Custom CSS",rows:10,value:R,onChange:M})]}),e.jsxs("div",{className:"wptb-v2-setting-btns",children:[e.jsx("button",{type:"button",className:"wptb-btn-revert",onClick:o,disabled:i,children:"Revert"}),e.jsxs("button",{type:"button",className:"wptb-btn-save",onClick:s,disabled:i,children:[i&&Dt," Save"]})]})]})},Er=()=>{const[R,M]=J.useState(!1),[i,k]=J.useState(!1),[s,o]=J.useState(WPTB_CFG.SETTINGS.lazy_load),h=async()=>{if(!R){M(!0);try{const l={lazy_load:s},[c,x]=await Et("/settings",l);if(!x.ok){ut(c.error||c.message||"Something went wrong","error");return}if(c.error){ut(c.error,"error");return}ut(c.message||"Settings saved successfully","success"),WPTB_CFG.SETTINGS.lazy_load=c.settings.lazy_load}catch(l){console.log(l),ut("Something went wrong","error")}finally{M(!1)}}},r=()=>{o(WPTB_CFG.SETTINGS.lazy_load)};return e.jsxs("div",{children:[e.jsxs("div",{className:"wptb-v2-settings-area wptb-v2-lazy-load-settings",children:[e.jsxs("div",{children:[e.jsx(Bt,{title:"Enable Lazy Load",initialOpen:!0,className:"wptb-v2-lazy-load-group",children:e.jsx(de,{label:"Enable Lazy Loading Images",checked:!!s.enabled,onChange:l=>o({...s,enabled:l})})}),e.jsxs("div",{className:"wptb-v2-lazy-load-preview",children:[e.jsx("h4",{children:"Preview"}),e.jsxs("div",{className:"wptb-v2-lazy-load-preview-image",children:[e.jsx("img",{src:WPTB_CFG.PLUGIN_URL+"/assets/images/wptb-logo.png",className:`${s.imageLoadAnimation} to-${s.imageLoadAnimationDirection}`,style:{"--transition-speed":1/Number(s.imageLoadAnimationSpeed)+"s"},"data-visible":i}),(s==null?void 0:s.imageLoadAnimation)==="flash"&&e.jsx("div",{style:{background:s.flashColor}})]}),e.jsxs("div",{className:"wptb-v2-lazy-load-preview-btns",children:[e.jsx("button",{type:"button",className:"wptb-v2-lazy-load-preview-reset",disabled:!i,onClick:()=>k(!1),children:"Reset"}),e.jsx("button",{type:"button",className:"wptb-v2-lazy-load-preview-reload",disabled:i,onClick:()=>k(!0),children:"Load Image"})]}),e.jsxs("div",{className:"wptb-v2-lazy-load-notice",children:[e.jsx("h5",{children:"important:"}),e.jsx("p",{children:"After enable, if you are getting any conflicts with your third party lazy load plugin, please whitelist table image elements with wptb-image-element-target class name from plugin settings."})]})]})]}),e.jsxs("div",{className:"wptb-v2-lazy-load-pro",children:[e.jsx(Ze,{name:"global.lazy_load",props:s,setProps:o}),e.jsxs(He,{name:"global.lazy_load",children:[e.jsxs(Bt,{title:"General Options",initialOpen:!0,className:"wptb-v2-lazy-load-group",children:[e.jsx(Wt,{label:"Visibility Percentage",value:s==null?void 0:s.visibilityPercentage,allowedUnits:{"%":{}}}),e.jsx(Mt,{label:"Background Color",value:s==null?void 0:s.backgroundColor})]}),e.jsxs(Bt,{title:"Icon Options",initialOpen:!0,className:"wptb-v2-lazy-load-group",children:[e.jsx(Ge,{label:"Icon",value:s==null?void 0:s.iconName}),e.jsx(Mt,{label:"Icon Color",value:s==null?void 0:s.iconColor}),e.jsx(Wt,{label:"Icon Size",value:s==null?void 0:s.iconSize}),e.jsx(Nt,{label:"Icon Animation",value:s==null?void 0:s.iconAnimation,options:[{value:"none",label:"None"},{value:"heartbeat",label:"Heartbeat"},{value:"rotate",label:"Rotate"},{value:"flip",label:"Flip"},{value:"jump",label:"Jump"}]})]}),e.jsxs(Bt,{title:"Image Load Options",initialOpen:!0,className:"wptb-v2-lazy-load-group",children:[e.jsx(Nt,{label:"Animation",value:s==null?void 0:s.imageLoadAnimation,options:[{value:"none",label:"None"},{value:"slide-in",label:"Slide In"},{value:"grow-sling",label:"Grow Sling"},{value:"flash",label:"Flash"},{value:"flip",label:"Flip"}]}),(s==null?void 0:s.imageLoadAnimation)==="slide-in"&&e.jsx(Nt,{label:"Direction",value:s==null?void 0:s.imageLoadAnimationDirection,options:[{value:"left",label:"To Left"},{value:"right",label:"To Right"},{value:"top",label:"To Top"},{value:"bottom",label:"To Bottom"}]}),(s==null?void 0:s.imageLoadAnimation)==="flash"&&e.jsx(Mt,{label:"Flash Color",value:s==null?void 0:s.flashColor}),(s==null?void 0:s.imageLoadAnimation)==="flip"&&e.jsxs(e.Fragment,{children:[e.jsx(Nt,{label:"Direction",value:s==null?void 0:s.imageLoadAnimationDirection,options:[{value:"left",label:"To Left"},{value:"right",label:"To Right"}]}),e.jsx(Wt,{label:"Perspective",value:s==null?void 0:s.imageLoadAnimationPerspective})]}),e.jsx(Ht,{label:"Speed",value:Number(s==null?void 0:s.imageLoadAnimationSpeed)||5,max:10})]})]})]})]}),e.jsxs("div",{className:"wptb-v2-setting-btns",children:[e.jsx("button",{type:"button",className:"wptb-btn-revert",onClick:r,disabled:R,children:"Revert"}),e.jsxs("button",{type:"button",className:"wptb-btn-save",onClick:h,disabled:R,children:[R&&Dt," Save"]})]})]})};let _t=null;const Tr=R=>{const M={},i=document.createElement("div");return i.innerHTML=R,i.querySelectorAll("h4").forEach(s=>{var h,r;const o=(h=s.textContent)==null?void 0:h.trim();o&&(M[o]=((r=s.nextElementSibling)==null?void 0:r.outerHTML)||"")}),M},te=(R,M)=>{const i=R.replace(/^v/,"").split(".").map(Number),k=M.replace(/^v/,"").split(".").map(Number),s=Math.max(i.length,k.length);for(;i.lengthk[o])return 1;if(i[o]{const[R,M]=J.useState(_t===null),[i,k]=J.useState(!1),[s,o]=J.useState(_t),[h,r]=J.useState((_t==null?void 0:_t.version)||"");J.useEffect(()=>{if(_t!==null){M(!1),o(_t),r(_t.version);return}fetch("https://api.wordpress.org/plugins/info/1.0/wp-table-builder.json").then(c=>c.json()).then(c=>{if(_t)return;const x={};Object.keys(c.versions).sort(te).reverse().slice(0,6).forEach(j=>{x[j]=c.versions[j]}),_t={version:c.version,versions:x,changelog:Tr(c.sections.changelog),latest:Object.keys(c.versions).sort(te).at(-1)},o(_t),r(_t.version)}).finally(()=>{M(!1)})},[]);const l=async()=>{if(!i){k(!0);try{const[c,x]=await Et("/settings/install-version",{version:h});if(!x.ok){ut(c.error||c.message||"Something went wrong","error");return}if(c.error){ut(c.error,"error");return}ut(c.message||"Settings saved successfully","success"),window.location.reload()}catch{ut("Something went wrong","error")}k(!1)}};return e.jsxs("div",{className:"wptb-v2-settings-area wptb-v2-version-settings",children:[R||!s?e.jsx("div",{className:"wptb-v2-loading",children:e.jsx(Gt,{})}):e.jsxs("div",{className:"wptb-v2-version-settings-content",children:[e.jsxs("div",{className:"wptb-v2-version-settings-control",children:[e.jsx("p",{className:"wptb-v2-version-settings-encourage",children:"If you are having issues with the current version of the plugin, you can rollback to a previous version."}),e.jsxs("div",{className:"wptb-v2-version-settings-info",children:[e.jsx("div",{children:"Current Version"}),e.jsxs("div",{children:[e.jsx("div",{className:mt({"wptb-v2-version-settings-info-success":s.latest===WPTB_CFG.SETTINGS.version,"wptb-v2-version-settings-info-warning":s.latest!==WPTB_CFG.SETTINGS.version})}),e.jsx("span",{children:WPTB_CFG.SETTINGS.version})]}),e.jsx("div",{children:"Latest Version"}),e.jsxs("div",{children:[e.jsx("div",{className:mt({"wptb-v2-version-settings-info-success":s.latest===WPTB_CFG.SETTINGS.version,"wptb-v2-version-settings-info-warning":s.latest!==WPTB_CFG.SETTINGS.version})}),e.jsx("span",{children:s.latest})]}),e.jsx("div",{children:"Install"}),e.jsx("div",{children:e.jsx("select",{value:h,onChange:c=>r(c.target.value),children:Object.keys(s.versions).map(c=>e.jsx("option",{value:c,children:c},c))})})]}),e.jsxs("div",{className:"wptb-v2-version-settings-warning",children:[e.jsx("h5",{children:"warning:"}),e.jsx("p",{children:"Previous versions may be unstable and unsecure, continue with your own risk and take a backup."})]})]}),e.jsxs("div",{className:"wptb-v2-version-settings-log",children:[e.jsx("h4",{children:h}),e.jsx("div",{dangerouslySetInnerHTML:{__html:s.changelog[h]||""}})]})]}),e.jsx("div",{className:"wptb-v2-setting-btns",children:e.jsxs("button",{type:"button",className:"wptb-btn-save",disabled:i,onClick:l,children:[i&&Dt," Install ",h]})})]})},ee={general:Sr,tableStyles:Cr,lazyLoad:Er,version:Ar},Nr=({setPage:R})=>{const[M,i]=J.useState("general");return e.jsxs("div",{className:"wptb-v2-page wptb-v2-settings-page",children:[e.jsx(It,{setPage:R,page:"settings"}),e.jsxs("div",{className:"wptb-v2-page-content",children:[e.jsx("div",{className:"wptb-v2-page-content-top",children:e.jsx("h2",{children:St("WP Table Builder")})}),e.jsxs("div",{className:"wptb-v2-page-content-main",children:[e.jsxs("div",{className:"wptb-v2-settings-tabs",children:[e.jsx("button",{className:M==="general"?"wptb-v2-active":"",onClick:()=>i("general"),children:"General"}),e.jsx("button",{className:M==="tableStyles"?"wptb-v2-active":"",onClick:()=>i("tableStyles"),children:"Table Styles"}),e.jsx("button",{className:M==="lazyLoad"?"wptb-v2-active":"",onClick:()=>i("lazyLoad"),children:"Lazy Load"}),e.jsx("button",{className:M==="version"?"wptb-v2-active":"",onClick:()=>i("version"),children:"Version Control"})]}),e.jsx("div",{children:ee[M]&&J.createElement(ee[M])})]})]})]})},Ir=({setPage:R})=>{const M=()=>{R&&R("create")},i=()=>{window.open("https://wptablebuilder.com/docs/create-first-table-wp-table-builder/","_blank")};return e.jsx("div",{className:"wptb-welcome-page",children:e.jsxs("div",{className:"wptb-welcome-card",children:[e.jsxs("div",{className:"wptb-welcome-card-header",children:[e.jsx(fe,{className:"wptb-welcome-logo"}),e.jsx("h1",{className:"wptb-welcome-title",children:"Getting Started"})]}),e.jsxs("div",{className:"wptb-welcome-card-body",children:[e.jsx("h2",{className:"wptb-welcome-heading",children:"Welcome to WP Table Builder!"}),e.jsx("p",{className:"wptb-welcome-text",children:"We recommend you to watch this short getting started video, and then start dragging and dropping elements to create your first table."}),e.jsx("div",{className:"wptb-welcome-video",children:e.jsx("iframe",{width:"100%",height:"100%",src:"https://www.youtube.com/embed/VPW0-3bNReY",title:"Getting Started with WP Table Builder",frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})}),e.jsxs("div",{className:"wptb-welcome-actions",children:[e.jsx("button",{className:"wptb-welcome-btn wptb-welcome-btn-primary",onClick:M,children:"Create Your First Table"}),e.jsx("button",{className:"wptb-welcome-btn wptb-welcome-btn-secondary",onClick:i,children:"Learn More"})]})]})]})})},zr={tables:sr,builder:jr,create:lr,import:br,export:yr,settings:Nr,welcome:Ir},re=()=>{var i,k;const R=new URLSearchParams(window.location.search),M={};for(const[s,o]of R)M[s]=o;return M.page=((k=(i=M.page)==null?void 0:i.replace("wptb",""))==null?void 0:k.substring(1))||"tables",M};function Rr(){const[R,M]=J.useState({}),i=(k,s)=>{s=s||{};const h={page:k==="tables"?"wptb":`wptb-${k}`};for(const l in s){const c=s[l];c&&(h[l]=c)}const r=new URLSearchParams(h).toString();window.history.pushState(null,"","?"+r),s.page=k,M(s)};return J.useEffect(()=>{const k=()=>{const s=re();M(s)};return M(re()),window.addEventListener("popstate",k),()=>{window.removeEventListener("popstate",k)}},[]),[R,i]}const Or=()=>{const[R,M]=Rr(),i=zr[R.page];if(i)return e.jsx(i,{...R,setPage:M})};document.addEventListener("DOMContentLoaded",()=>{const R=document.querySelector("#wptb-app-root");!R||typeof WPTB>"u"||Ve(R).render(e.jsx(qe.StrictMode,{children:e.jsxs($e,{store:Ct,children:[e.jsx(Or,{}),e.jsx(Ke,{}),e.jsx(Ye,{})]})}))}); /*! elementor-pro - v3.31.0 - 10-08-2025 */ "use strict"; (self["webpackChunkelementor_pro"] = self["webpackChunkelementor_pro"] || []).push([["nested-carousel"],{ /***/ "../modules/nested-carousel/assets/js/frontend/handlers/nested-carousel.js": /*!*********************************************************************************!*\ !*** ../modules/nested-carousel/assets/js/frontend/handlers/nested-carousel.js ***! \*********************************************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js"); Object.defineProperty(exports, "__esModule", ({ value: true })); exports["default"] = void 0; var _runElementHandlers = _interopRequireDefault(__webpack_require__(/*! elementor-pro/frontend/utils/run-element-handlers */ "../assets/dev/js/frontend/utils/run-element-handlers.js")); class NestedCarousel extends elementorModules.frontend.handlers.CarouselBase { getDefaultSettings() { const defaultSettings = super.getDefaultSettings(); defaultSettings.selectors.carousel = '.e-n-carousel'; defaultSettings.selectors.slidesWrapper = '.e-n-carousel > .swiper-wrapper'; return defaultSettings; } getSwiperSettings() { const swiperOptions = super.getSwiperSettings(), elementSettings = this.getElementSettings(), isRtl = elementorFrontend.config.is_rtl, widgetSelector = `.elementor-element-${this.getID()}`; if (elementorFrontend.isEditMode()) { delete swiperOptions.autoplay; swiperOptions.loop = false; swiperOptions.noSwipingSelector = '.swiper-slide > .e-con .elementor-element'; } if ('yes' === elementSettings.arrows) { swiperOptions.navigation = { prevEl: isRtl ? `${widgetSelector} .elementor-swiper-button-next` : `${widgetSelector} .elementor-swiper-button-prev`, nextEl: isRtl ? `${widgetSelector} .elementor-swiper-button-prev` : `${widgetSelector} .elementor-swiper-button-next` }; } this.applySwipeOptions(swiperOptions); return swiperOptions; } async onInit() { this.wrapSlideContent(); super.onInit(...arguments); this.ranElementHandlers = false; } async initSwiper() { const Swiper = elementorFrontend.utils.swiper; this.swiper = await new Swiper(this.elements.$swiperContainer, this.getSwiperSettings()); // Expose the swiper instance in the frontend this.elements.$swiperContainer.data('swiper', this.swiper); } handleElementHandlers() { if (this.ranElementHandlers || !this.swiper) { return; } const duplicatedSlides = Array.from(this.swiper.slides).filter(slide => slide.classList.contains(this.swiper.params.slideDuplicateClass)); (0, _runElementHandlers.default)(duplicatedSlides); this.ranElementHandlers = true; } wrapSlideContent() { if (!elementorFrontend.isEditMode()) { return; } const settings = this.getSettings(), slideContentClass = settings.selectors.slideContent.replace('.', ''), $widget = this.$element; let index = 1; this.findElement(`${settings.selectors.slidesWrapper} > .e-con`).each(function () { const $currentContainer = jQuery(this), hasSwiperSlideWrapper = $currentContainer.closest('div').hasClass(slideContentClass), $currentSlide = $widget.find(`${settings.selectors.slidesWrapper} > .${slideContentClass}:nth-child(${index})`); if (!hasSwiperSlideWrapper) { $currentSlide.append($currentContainer); } index++; }); } togglePauseOnHover(toggleOn) { if (elementorFrontend.isEditMode()) { return; } super.togglePauseOnHover(toggleOn); } getChangeableProperties() { return { arrows_position: 'arrows_position' // Not a Swiper setting. }; } applySwipeOptions(swiperOptions) { if (!this.isTouchDevice()) { swiperOptions.shortSwipes = false; } else { swiperOptions.touchRatio = 1; swiperOptions.longSwipesRatio = 0.3; swiperOptions.followFinger = true; swiperOptions.threshold = 10; } } isTouchDevice() { return elementorFrontend.utils.environment.isTouchDevice; } async linkContainer(event) { const { container, index, targetContainer, action: { type } } = event.detail, view = container.view.$el, id = container.model.get('id'), currentId = this.$element.data('id'); if (id === currentId) { const { $slides } = this.getDefaultElements(); let carouselItemWrapper, contentContainer; switch (type) { case 'move': [carouselItemWrapper, contentContainer] = this.move(view, index, targetContainer, $slides); break; case 'duplicate': [carouselItemWrapper, contentContainer] = this.duplicate(view, index, targetContainer, $slides); break; default: break; } if (undefined !== carouselItemWrapper) { carouselItemWrapper.appendChild(contentContainer); } this.shouldHideNavButtons(view, $slides); this.updateIndexValues($slides); const isSwiperActive = this.swiper && !this.swiper.destroyed, hasMultipleSlides = $slides.length > 1; if (!isSwiperActive && hasMultipleSlides) { await this.initSwiper(); } else if (isSwiperActive && !hasMultipleSlides) { this.swiper.destroy(true); } this.updateListeners(); } } updateListeners() { this.swiper.initialized = false; this.swiper.init(); } move(view, index, targetContainer, slides) { return [slides[index], targetContainer.view.$el[0]]; } duplicate(view, index, targetContainer, slides) { return [slides[index + 1], targetContainer.view.$el[0]]; } updateIndexValues($slides) { $slides.each((index, element) => { const newIndex = index + 1; element.setAttribute('data-slide', newIndex); }); } bindEvents() { super.bindEvents(); elementorFrontend.elements.$window.on('elementor/nested-container/atomic-repeater', this.linkContainer.bind(this)); } shouldHideNavButtons(view, $slides) { const widget = view[0], navButtons = widget.querySelectorAll('.elementor-swiper-button'), shouldHide = 1 === $slides.length, isHidden = navButtons[0]?.classList.contains('hide'); if (shouldHide !== isHidden) { navButtons.forEach(button => { button.classList.toggle('hide', shouldHide); }); } } } exports["default"] = NestedCarousel; /***/ }) }]); //# sourceMappingURL=nested-carousel.4d07ea83632034f2e72e.bundle.js.mapimport { Dialog, DialogHeader, DialogTitle, DialogContent, DialogActions, Button, } from '@elementor/ui'; import { __ } from '@wordpress/i18n'; import * as PropTypes from 'prop-types'; export function KitCustomizationDialog( { open, title, handleClose, handleSaveChanges, children, saveDisabled = false, } ) { return ( { title } { children } ); } KitCustomizationDialog.propTypes = { open: PropTypes.bool.isRequired, handleClose: PropTypes.func.isRequired, handleSaveChanges: PropTypes.func.isRequired, children: PropTypes.node.isRequired, title: PropTypes.string.isRequired, saveDisabled: PropTypes.bool, };