PluginProbe
Tableberg – Simple Gutenberg Table Block / 1.2.0
Tableberg – Simple Gutenberg Table Block v1.2.0
1.2.0 1.1.5 1.1.4 1.1.3 1.1.2 1.1.1 1.1.0 1.0.5 1.0.4 1.0.3 1.0.2 1.0.1 trunk 0.0.2 0.2.1 0.3.2 0.3.3 0.4.1 0.5.0 0.5.1 0.5.2 0.5.3 0.5.4 0.5.5 0.5.6 All 43 releases
← All changes | build/index.js +2 -2 1.1.2 → 1.2.0 View file →
@@ -1,2 +1,2 @@
1 -(()=>{var e,t={34:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},265:(e,t,n)=>{"use strict";var l=n(34);function o(){}function r(){}r.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,r,a){if(a!==l){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:r,resetWarningCache:o};return n.PropTypes=n,n}},395:(e,t)=>{var n;!function(){"use strict";var l={}.hasOwnProperty;function o(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=a(e,r(n)))}return e}function r(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return o.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var n in e)l.call(e,n)&&e[n]&&(t=a(t,n));return t}function a(e,t){return t?e?e+" "+t:e+t:e}e.exports?(o.default=o,e.exports=o):void 0===(n=function(){return o}.apply(t,[]))||(e.exports=n)}()},821:(e,t,n)=>{e.exports=n(265)()},970:(e,t,n)=>{"use strict";const l="left";function o(e){return"object"==typeof e&&null!==e}function r(e){return"left"===e||"center"===e||"right"===e}function a(e){return"center"===e?"center":"right"===e?"flex-end":"flex-start"}function s(e){const t=e.name,n=o(e.attributes)?e.attributes:{};if("icon"===t){const e=n.styles,t=o(e)?e:{};return r(t.align)?t.align:l}return r(n.align)?n.align:l}const i=window.wp.i18n,c=window.wp.components,u=window.React;var d=n.n(u);const h=window.wp.data;var b=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},p="undefined"==typeof window||"Deno"in globalThis;function g(){}function f(e){return"number"==typeof e&&e>=0&&e!==1/0}function m(e,t){return Math.max(e+(t||0)-Date.now(),0)}function v(e,t){return"function"==typeof e?e(t):e}function x(e,t){return"function"==typeof e?e(t):e}function y(e,t){const{type:n="all",exact:l,fetchStatus:o,predicate:r,queryKey:a,stale:s}=e;if(a)if(l){if(t.queryHash!==w(a,t.options))return!1}else if(!k(t.queryKey,a))return!1;if("all"!==n){const e=t.isActive();if("active"===n&&!e)return!1;if("inactive"===n&&e)return!1}return!("boolean"==typeof s&&t.isStale()!==s||o&&o!==t.state.fetchStatus||r&&!r(t))}function C(e,t){const{exact:n,status:l,predicate:o,mutationKey:r}=e;if(r){if(!t.options.mutationKey)return!1;if(n){if(_(t.options.mutationKey)!==_(r))return!1}else if(!k(t.options.mutationKey,r))return!1}return!(l&&t.state.status!==l||o&&!o(t))}function w(e,t){return(t?.queryKeyHashFn||_)(e)}function _(e){return JSON.stringify(e,(e,t)=>R(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function k(e,t){return e===t||typeof e==typeof t&&!(!e||!t||"object"!=typeof e||"object"!=typeof t)&&Object.keys(t).every(n=>k(e[n],t[n]))}function j(e,t){if(e===t)return e;const n=P(e)&&P(t);if(n||R(e)&&R(t)){const l=n?e:Object.keys(e),o=l.length,r=n?t:Object.keys(t),a=r.length,s=n?[]:{},i=new Set(l);let c=0;for(let l=0;l<a;l++){const o=n?l:r[l];(!n&&i.has(o)||n)&&void 0===e[o]&&void 0===t[o]?(s[o]=void 0,c++):(s[o]=j(e[o],t[o]),s[o]===e[o]&&void 0!==e[o]&&c++)}return o===a&&c===o?e:s}return t}function S(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function P(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function R(e){if(!B(e))return!1;const t=e.constructor;if(void 0===t)return!0;const n=t.prototype;return!!B(n)&&!!n.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(e)===Object.prototype}function B(e){return"[object Object]"===Object.prototype.toString.call(e)}function T(e,t,n){return"function"==typeof n.structuralSharing?n.structuralSharing(e,t):!1!==n.structuralSharing?j(e,t):t}function I(e,t,n=0){const l=[...e,t];return n&&l.length>n?l.slice(1):l}function E(e,t,n=0){const l=[t,...e];return n&&l.length>n?l.slice(0,-1):l}var O=Symbol();function M(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:e.queryFn&&e.queryFn!==O?e.queryFn:()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`))}var A=new class extends b{#e;#t;#n;constructor(){super(),this.#n=e=>{if(!p&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{"boolean"==typeof e?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return"boolean"==typeof this.#e?this.#e:"hidden"!==globalThis.document?.visibilityState}},N=e=>setTimeout(e,0),D=function(){let e=[],t=0,n=e=>{e()},l=e=>{e()},o=N;const r=l=>{t?e.push(l):o(()=>{n(l)})};return{batch:r=>{let a;t++;try{a=r()}finally{t--,t||(()=>{const t=e;e=[],t.length&&o(()=>{l(()=>{t.forEach(e=>{n(e)})})})})()}return a},batchCalls:e=>(...t)=>{r(()=>{e(...t)})},schedule:r,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{l=e},setScheduler:e=>{o=e}}}(),L=new class extends b{#l=!0;#t;#n;constructor(){super(),this.#n=e=>{if(!p&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#l!==e&&(this.#l=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#l}};function F(){let e,t;const n=new Promise((n,l)=>{e=n,t=l});function l(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.status="pending",n.catch(()=>{}),n.resolve=t=>{l({status:"fulfilled",value:t}),e(t)},n.reject=e=>{l({status:"rejected",reason:e}),t(e)},n}function V(e){return Math.min(1e3*2**e,3e4)}function H(e){return"online"!==(e??"online")||L.isOnline()}var z=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function Z(e){let t,n=!1,l=0;const o=F(),r=()=>"pending"!==o.status,a=()=>A.isFocused()&&("always"===e.networkMode||L.isOnline())&&e.canRun(),s=()=>H(e.networkMode)&&e.canRun(),i=e=>{r()||(t?.(),o.resolve(e))},c=e=>{r()||(t?.(),o.reject(e))},u=()=>new Promise(n=>{t=e=>{(r()||a())&&n(e)},e.onPause?.()}).then(()=>{t=void 0,r()||e.onContinue?.()}),d=()=>{if(r())return;let t;const o=0===l?e.initialPromise:void 0;try{t=o??e.fn()}catch(e){t=Promise.reject(e)}Promise.resolve(t).then(i).catch(t=>{if(r())return;const o=e.retry??(p?0:3),s=e.retryDelay??V,i="function"==typeof s?s(l,t):s,h=!0===o||"number"==typeof o&&l<o||"function"==typeof o&&o(l,t);var b;!n&&h?(l++,e.onFail?.(l,t),(b=i,new Promise(e=>{setTimeout(e,b)})).then(()=>a()?void 0:u()).then(()=>{n?c(t):d()})):c(t)})};return{promise:o,status:()=>o.status,cancel:t=>{r()||(c(new z(t)),e.abort?.())},continue:()=>(t?.(),o),cancelRetry:()=>{n=!0},continueRetry:()=>{n=!1},canStart:s,start:()=>(s()?d():u().then(d),o)}}var G=class{#o;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),f(this.gcTime)&&(this.#o=setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(p?1/0:3e5))}clearGcTimeout(){this.#o&&(clearTimeout(this.#o),this.#o=void 0)}},q=class extends G{#r;#a;#s;#i;#c;#u;#d;constructor(e){super(),this.#d=!1,this.#u=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#s=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#r=function(e){const t="function"==typeof e.initialData?e.initialData():e.initialData,n=void 0!==t,l=n?"function"==typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?l??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}(this.options),this.state=e.state??this.#r,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#c?.promise}setOptions(e){this.options={...this.#u,...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#s.remove(this)}setData(e,t){const n=T(this.state.data,e,this.options);return this.#h({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#h({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#c?.promise;return this.#c?.cancel(e),t?t.then(g).catch(g):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#r)}isActive(){return this.observers.some(e=>!1!==x(e.options.enabled,this))}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===O||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>"static"===v(e.options.staleTime,this))}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):void 0===this.state.data||this.state.isInvalidated}isStaleByTime(e=0){return void 0===this.state.data||"static"!==e&&(!!this.state.isInvalidated||!m(this.state.dataUpdatedAt,e))}onFocus(){const e=this.observers.find(e=>e.shouldFetchOnWindowFocus());e?.refetch({cancelRefetch:!1}),this.#c?.continue()}onOnline(){const e=this.observers.find(e=>e.shouldFetchOnReconnect());e?.refetch({cancelRefetch:!1}),this.#c?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#s.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#c&&(this.#d?this.#c.cancel({revert:!0}):this.#c.cancelRetry()),this.scheduleGc()),this.#s.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#h({type:"invalidate"})}async fetch(e,t){if("idle"!==this.state.fetchStatus&&"rejected"!==this.#c?.status())if(void 0!==this.state.data&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#c)return this.#c.continueRetry(),this.#c.promise;if(e&&this.setOptions(e),!this.options.queryFn){const e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}const n=new AbortController,l=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#d=!0,n.signal)})},o=()=>{const e=M(this.options,t),n=(()=>{const e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return l(e),e})();return this.#d=!1,this.options.persister?this.options.persister(e,n,this):e(n)},r=(()=>{const e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:o};return l(e),e})();this.options.behavior?.onFetch(r,this),this.#a=this.state,"idle"!==this.state.fetchStatus&&this.state.fetchMeta===r.fetchOptions?.meta||this.#h({type:"fetch",meta:r.fetchOptions?.meta}),this.#c=Z({initialPromise:t?.initialPromise,fn:r.fetchFn,abort:n.abort.bind(n),onFail:(e,t)=>{this.#h({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#h({type:"pause"})},onContinue:()=>{this.#h({type:"continue"})},retry:r.options.retry,retryDelay:r.options.retryDelay,networkMode:r.options.networkMode,canRun:()=>!0});try{const e=await this.#c.start();if(void 0===e)throw new Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#s.config.onSuccess?.(e,this),this.#s.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof z){if(e.silent)return this.#c.promise;if(e.revert)return this.setState({...this.#a,fetchStatus:"idle"}),this.state.data}throw this.#h({type:"error",error:e}),this.#s.config.onError?.(e,this),this.#s.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#h(e){this.state=(t=>{switch(e.type){case"failed":return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...t,fetchStatus:"paused"};case"continue":return{...t,fetchStatus:"fetching"};case"fetch":return{...t,...$(t.data,this.options),fetchMeta:e.meta??null};case"success":const n={...t,data:e.data,dataUpdateCount:t.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#a=e.manual?n:void 0,n;case"error":const l=e.error;return{...t,error:l,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:l,fetchStatus:"idle",status:"error"};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...e.state}}})(this.state),D.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#s.notify({query:this,type:"updated",action:e})})}};function $(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:H(t.networkMode)?"fetching":"paused",...void 0===e&&{error:null,status:"pending"}}}var Q=class extends b{constructor(e,t){super(),this.options=t,this.#i=e,this.#b=null,this.#p=F(),this.options.experimental_prefetchInRender||this.#p.reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(t)}#i;#g=void 0;#f=void 0;#m=void 0;#v;#x;#p;#b;#y;#C;#w;#_;#k;#j;#S=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#g.addObserver(this),U(this.#g,this.options)?this.#P():this.updateResult(),this.#R())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return W(this.#g,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return W(this.#g,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#B(),this.#T(),this.#g.removeObserver(this)}setOptions(e){const t=this.options,n=this.#g;if(this.options=this.#i.defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof x(this.options.enabled,this.#g))throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#I(),this.#g.setOptions(this.options),t._defaulted&&!S(this.options,t)&&this.#i.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#g,observer:this});const l=this.hasListeners();l&&K(this.#g,n,this.options,t)&&this.#P(),this.updateResult(),!l||this.#g===n&&x(this.options.enabled,this.#g)===x(t.enabled,this.#g)&&v(this.options.staleTime,this.#g)===v(t.staleTime,this.#g)||this.#E();const o=this.#O();!l||this.#g===n&&x(this.options.enabled,this.#g)===x(t.enabled,this.#g)&&o===this.#j||this.#M(o)}getOptimisticResult(e){const t=this.#i.getQueryCache().build(this.#i,e),n=this.createResult(t,e);return l=n,!S(this.getCurrentResult(),l)&&(this.#m=n,this.#x=this.options,this.#v=this.#g.state),n;var l}getCurrentResult(){return this.#m}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#S.add(e)}getCurrentQuery(){return this.#g}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#i.defaultQueryOptions(e),n=this.#i.getQueryCache().build(this.#i,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#P({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#m))}#P(e){this.#I();let t=this.#g.fetch(this.options,e);return e?.throwOnError||(t=t.catch(g)),t}#E(){this.#B();const e=v(this.options.staleTime,this.#g);if(p||this.#m.isStale||!f(e))return;const t=m(this.#m.dataUpdatedAt,e)+1;this.#_=setTimeout(()=>{this.#m.isStale||this.updateResult()},t)}#O(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#g):this.options.refetchInterval)??!1}#M(e){this.#T(),this.#j=e,!p&&!1!==x(this.options.enabled,this.#g)&&f(this.#j)&&0!==this.#j&&(this.#k=setInterval(()=>{(this.options.refetchIntervalInBackground||A.isFocused())&&this.#P()},this.#j))}#R(){this.#E(),this.#M(this.#O())}#B(){this.#_&&(clearTimeout(this.#_),this.#_=void 0)}#T(){this.#k&&(clearInterval(this.#k),this.#k=void 0)}createResult(e,t){const n=this.#g,l=this.options,o=this.#m,r=this.#v,a=this.#x,s=e!==n?e.state:this.#f,{state:i}=e;let c,u={...i},d=!1;if(t._optimisticResults){const o=this.hasListeners(),r=!o&&U(e,t),a=o&&K(e,n,t,l);(r||a)&&(u={...u,...$(i.data,e.options)}),"isRestoring"===t._optimisticResults&&(u.fetchStatus="idle")}let{error:h,errorUpdatedAt:b,status:p}=u;c=u.data;let g=!1;if(void 0!==t.placeholderData&&void 0===c&&"pending"===p){let e;o?.isPlaceholderData&&t.placeholderData===a?.placeholderData?(e=o.data,g=!0):e="function"==typeof t.placeholderData?t.placeholderData(this.#w?.state.data,this.#w):t.placeholderData,void 0!==e&&(p="success",c=T(o?.data,e,t),d=!0)}if(t.select&&void 0!==c&&!g)if(o&&c===r?.data&&t.select===this.#y)c=this.#C;else try{this.#y=t.select,c=t.select(c),c=T(o?.data,c,t),this.#C=c,this.#b=null}catch(e){this.#b=e}this.#b&&(h=this.#b,c=this.#C,b=Date.now(),p="error");const f="fetching"===u.fetchStatus,m="pending"===p,v="error"===p,y=m&&f,C=void 0!==c,w={status:p,fetchStatus:u.fetchStatus,isPending:m,isSuccess:"success"===p,isError:v,isInitialLoading:y,isLoading:y,data:c,dataUpdatedAt:u.dataUpdatedAt,error:h,errorUpdatedAt:b,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:u.dataUpdateCount>0||u.errorUpdateCount>0,isFetchedAfterMount:u.dataUpdateCount>s.dataUpdateCount||u.errorUpdateCount>s.errorUpdateCount,isFetching:f,isRefetching:f&&!m,isLoadingError:v&&!C,isPaused:"paused"===u.fetchStatus,isPlaceholderData:d,isRefetchError:v&&C,isStale:Y(e,t),refetch:this.refetch,promise:this.#p,isEnabled:!1!==x(t.enabled,e)};if(this.options.experimental_prefetchInRender){const t=e=>{"error"===w.status?e.reject(w.error):void 0!==w.data&&e.resolve(w.data)},l=()=>{const e=this.#p=w.promise=F();t(e)},o=this.#p;switch(o.status){case"pending":e.queryHash===n.queryHash&&t(o);break;case"fulfilled":"error"!==w.status&&w.data===o.value||l();break;case"rejected":"error"===w.status&&w.error===o.reason||l()}}return w}updateResult(){const e=this.#m,t=this.createResult(this.#g,this.options);this.#v=this.#g.state,this.#x=this.options,void 0!==this.#v.data&&(this.#w=this.#g),S(t,e)||(this.#m=t,this.#A({listeners:(()=>{if(!e)return!0;const{notifyOnChangeProps:t}=this.options,n="function"==typeof t?t():t;if("all"===n||!n&&!this.#S.size)return!0;const l=new Set(n??this.#S);return this.options.throwOnError&&l.add("error"),Object.keys(this.#m).some(t=>{const n=t;return this.#m[n]!==e[n]&&l.has(n)})})()}))}#I(){const e=this.#i.getQueryCache().build(this.#i,this.options);if(e===this.#g)return;const t=this.#g;this.#g=e,this.#f=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#R()}#A(e){D.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#m)}),this.#i.getQueryCache().notify({query:this.#g,type:"observerResultsUpdated"})})}};function U(e,t){return function(e,t){return!1!==x(t.enabled,e)&&void 0===e.state.data&&!("error"===e.state.status&&!1===t.retryOnMount)}(e,t)||void 0!==e.state.data&&W(e,t,t.refetchOnMount)}function W(e,t,n){if(!1!==x(t.enabled,e)&&"static"!==v(t.staleTime,e)){const l="function"==typeof n?n(e):n;return"always"===l||!1!==l&&Y(e,t)}return!1}function K(e,t,n,l){return(e!==t||!1===x(l.enabled,e))&&(!n.suspense||"error"!==e.state.status)&&Y(e,n)}function Y(e,t){return!1!==x(t.enabled,e)&&e.isStaleByTime(v(t.staleTime,e))}const J=window.ReactJSXRuntime;var X=u.createContext(void 0),ee=e=>{const t=u.useContext(X);if(e)return e;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},te=({client:e,children:t})=>(u.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,J.jsx)(X.Provider,{value:e,children:t}));var ne=u.createContext(function(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}()),le=u.createContext(!1),oe=(le.Provider,(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()}));function re(e,t){return function(e,t,n){const l=u.useContext(le),o=u.useContext(ne),r=ee(n),a=r.defaultQueryOptions(e);r.getDefaultOptions().queries?._experimental_beforeQuery?.(a),a._optimisticResults=l?"isRestoring":"optimistic",(e=>{if(e.suspense){const t=e=>"static"===e?e:Math.max(e??1e3,1e3),n=e.staleTime;e.staleTime="function"==typeof n?(...e)=>t(n(...e)):t(n),"number"==typeof e.gcTime&&(e.gcTime=Math.max(e.gcTime,1e3))}})(a),((e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))})(a,o),(e=>{u.useEffect(()=>{e.clearReset()},[e])})(o);const s=!r.getQueryCache().get(a.queryHash),[i]=u.useState(()=>new t(r,a)),c=i.getOptimisticResult(a),d=!l&&!1!==e.subscribed;if(u.useSyncExternalStore(u.useCallback(e=>{const t=d?i.subscribe(D.batchCalls(e)):g;return i.updateResult(),t},[i,d]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),u.useEffect(()=>{i.setOptions(a)},[a,i]),((e,t)=>e?.suspense&&t.isPending)(a,c))throw oe(a,i,o);if((({result:e,errorResetBoundary:t,throwOnError:n,query:l,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&l&&(o&&void 0===e.data||function(e,t){return"function"==typeof e?e(...t):!!e}(n,[e.error,l])))({result:c,errorResetBoundary:o,throwOnError:a.throwOnError,query:r.getQueryCache().get(a.queryHash),suspense:a.suspense}))throw c.error;if(r.getDefaultOptions().queries?._experimental_afterQuery?.(a,c),a.experimental_prefetchInRender&&!p&&((e,t)=>e.isLoading&&e.isFetching&&!t)(c,l)){const e=s?oe(a,i,o):r.getQueryCache().get(a.queryHash)?.promise;e?.catch(g).finally(()=>{i.updateResult()})}return a.notifyOnChangeProps?c:i.trackResult(c)}(e,Q,t)}const ae=window.wp.editor,se=[{key:"post_title",label:(0,i.__)("Title","tableberg")},{key:"post_excerpt",label:(0,i.__)("Excerpt","tableberg")},{key:"post_content",label:(0,i.__)("Content","tableberg")},{key:"post_date",label:(0,i.__)("Publish Date","tableberg")},{key:"post_modified",label:(0,i.__)("Modified Date","tableberg")},{key:"post_author",label:(0,i.__)("Author Name","tableberg")},{key:"permalink",label:(0,i.__)("Permalink","tableberg")},{key:"featured_image",label:(0,i.__)("Featured Image URL","tableberg")}],ie=window.wp.apiFetch;var ce=n.n(ie);const ue=e=>{let t;const n=new Set,l=(e,l)=>{const o="function"==typeof e?e(t):e;if(!Object.is(o,t)){const e=t;t=(null!=l?l:"object"!=typeof o||null===o)?o:Object.assign({},t,o),n.forEach(n=>n(t,e))}},o=()=>t,r={setState:l,getState:o,getInitialState:()=>a,subscribe:e=>(n.add(e),()=>n.delete(e))},a=t=e(l,o,r);return r},de=e=>e,he=e=>{const t=(e=>e?ue(e):ue)(e),n=e=>function(e,t=de){const n=u.useSyncExternalStore(e.subscribe,u.useCallback(()=>t(e.getState()),[e,t]),u.useCallback(()=>t(e.getInitialState()),[e,t]));return u.useDebugValue(n),n}(t,e);return Object.assign(n,t),n},be=e=>e?he(e):he,pe={version:0,isExample:!1,table:{rows:0,cols:0,className:"",headerEnabled:!1,footerEnabled:!1,stickyHeader:!1,stickyFirstCol:!1,caption:"",tableWidth:"auto",tableAlignment:"left",cellSpacing:{horizontal:"0",vertical:"0"},tableBorder:{top:"",right:"",bottom:"",left:""},margin:{top:"",right:"",bottom:"",left:""},padding:{top:"",right:"",bottom:"",left:""},fixedColumnWidths:!0,pagination:{enabled:!1,pageSize:10,showPageNumbers:!0,showPrevNext:!0},search:{enabled:!1,placeholder:"Search...",highlightColor:"",position:"left"},responsive:{tablet:{enabled:!1,maxWidth:700,mode:"scroll",transpose:!1,stackCount:3,repeatFirstCol:!1},mobile:{enabled:!1,maxWidth:375,mode:"scroll",transpose:!1,stackCount:1,repeatFirstCol:!1}}},rows:[],columns:[],cells:{},bindings:{},cellDefaults:{styles:{padding:{top:"var(--wp--preset--spacing--20)",right:"var(--wp--preset--spacing--20)",bottom:"var(--wp--preset--spacing--20)",left:"var(--wp--preset--spacing--20)"},border:{top:"1px solid black",right:"1px solid black",bottom:"1px solid black",left:"1px solid black"},borderRadius:{topLeft:"0px",topRight:"0px",bottomRight:"0px",bottomLeft:"0px"},orientation:"vertical",elementGap:"var(--wp--preset--spacing--20)",wrap:"nowrap",verticalAlign:"middle",backgroundColor:""}}};function ge(e,t){return`${e},${t}`}function fe(e){const[t,n]=e.split(",").map(e=>parseInt(e,10));return[t||0,n||0]}const me=window.wp.blockEditor,ve=window.wp.blocks;function xe(e){return e?(e.width||(e.width="0"),e.style||(e.style="solid"),e.color||(e.color="black"),`${e?.width} ${e?.style} ${e?.color}`):""}function ye(e){const t={},n=["top","right","bottom","left"];for(const l of n){const n=e[l];if(n&&n.trim()){const e=n.trim().split(/\s+/);t[l]={width:e[0]||void 0,style:e[1]||void 0,color:e[2]||void 0}}}return t}const Ce=function({label:e,isShownByDefault:t=!0,value:n,hasValue:l,onChange:o,resetAllFilter:r,onDeselect:a=()=>{}}){const{clientId:s}=(0,me.useBlockEditContext)(),{defaultColors:i}=(0,h.useSelect)(e=>({defaultColors:e(me.store).getSettings()?.__experimentalFeatures?.color?.palette?.default}),[]);return r||(r=a),(0,J.jsx)(c.__experimentalToolsPanelItem,{panelId:s,isShownByDefault:t,resetAllFilter:r,hasValue:l,label:e,onDeselect:a,children:(0,J.jsx)(c.BorderBoxControl,{enableAlpha:!0,size:"__unstable-large",colors:i,label:e,onChange:e=>o(function(e){const t={top:"",right:"",bottom:"",left:""};if(!e)return t;const n=["top","right","bottom","left"];if("top"in e)for(const l of n){const n=l,o=e[n];t[n]=xe(o)}else{const l=e;for(const e of n)t[e]=xe(l)}return t}(e)),value:ye(n)})})},we=function({label:e,isShownByDefault:t=!0,value:n,hasValue:l,onChange:o=()=>{},resetAllFilter:r,onDeselect:a=()=>{}}){const{clientId:s}=(0,me.useBlockEditContext)();return r||(r=a),(0,J.jsx)(c.__experimentalToolsPanelItem,{panelId:s,isShownByDefault:t,resetAllFilter:r,hasValue:l,label:e,onDeselect:a,children:(0,J.jsx)(me.__experimentalBorderRadiusControl,{onChange:e=>{o("string"!=typeof e?e:{topLeft:e,topRight:e,bottomLeft:e,bottomRight:e})},values:n})})},_e=function({value:e,gradientValue:t,label:n,palette:l="theme",onChange:o,onGradientChange:r,onDeselect:a,resetAllFilter:s,allowGradient:c=!1}){const{clientId:d}=(0,me.useBlockEditContext)(),b=(0,me.__experimentalUseMultipleOriginColorsAndGradients)(),p=(0,u.useRef)(e),g=(0,u.useRef)(t),{defaultColors:f,themeColors:m,defaultGradients:v,themeGradients:x}=(0,h.useSelect)(e=>{const t=e(me.store).getSettings()?.__experimentalFeatures?.color;return{defaultColors:t.palette.default,themeColors:t.palette.theme,defaultGradients:t.gradients.default,themeGradients:t.gradients.theme}},[]),y="theme"===l?x:v;s||(s=a);let C={clearable:!0,resetAllFilter:s,colorValue:e,colors:"theme"===l?m:f,label:n,onColorChange:e=>{p.current!==e&&(p.current=e,o(e))},onDeselect:a};return c&&(C={...C,gradientValue:t,gradients:y,onGradientChange:e=>{r&&g.current!==e&&(g.current=e,r(e))}}),(0,J.jsx)(me.__experimentalColorGradientSettingsDropdown,{...b,enableAlpha:!0,panelId:d,title:(0,i.__)("Color Settings","tableberg"),popoverProps:{placement:"left start"},settings:[C]})};var ke=n(395),je=n.n(ke);function Se(e){const t={...e};for(const e in t){const n=e,l=t[n],o=l?.match(/var\(--wp--preset--spacing--(.+)\)/);o&&(t[n]=`var:preset|spacing|${o[1]}`)}return t}const Pe=({label:e,value:t,hasValue:n,onChange:l=()=>{},resetAllFilter:o,onDeselect:r=()=>{}})=>{const{clientId:a}=(0,me.useBlockEditContext)();return o||(o=r),(0,J.jsx)(c.__experimentalToolsPanelItem,{panelId:a,isShownByDefault:!0,resetAllFilter:o,className:"tools-panel-item-spacing",label:e,onDeselect:r,hasValue:n,children:(0,J.jsx)(me.__experimentalSpacingSizesControl,{allowReset:!0,label:e,values:Se(t),sides:["top","right","bottom","left"],onChange:e=>{l(function(e){for(const t in e){const n=t,l=e[n],o=l?.match(/var:preset\|spacing\|(.+)/);o&&(e[n]=`var(--wp--preset--spacing--${o[1]})`)}return e}(e))}})})},Re=window.wp.primitives;var Be=(0,J.jsxs)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[(0,J.jsx)(Re.Path,{d:"m19 7.5h-7.628c-.3089-.87389-1.1423-1.5-2.122-1.5-.97966 0-1.81309.62611-2.12197 1.5h-2.12803v1.5h2.12803c.30888.87389 1.14231 1.5 2.12197 1.5.9797 0 1.8131-.62611 2.122-1.5h7.628z"}),(0,J.jsx)(Re.Path,{d:"m19 15h-2.128c-.3089-.8739-1.1423-1.5-2.122-1.5s-1.8131.6261-2.122 1.5h-7.628v1.5h7.628c.3089.8739 1.1423 1.5 2.122 1.5s1.8131-.6261 2.122-1.5h2.128z"})]});function Te({label:e,value:t,onChange:n,style:l}){const[o,r,a,s,d]=(0,me.useSettings)("spacing.spacingSizes","spacing.spacingSizes.custom","spacing.spacingSizes.theme","spacing.spacingSizes.default","spacing.defaultSpacingSizes"),h=[{slug:"0",size:0},...o||[...r||[],...a||[],...s&&!1!==d?s:[]]],[b,p]=(0,u.useState)(!!t&&!function(e){return"0"===e||/var\(--wp--preset--spacing--.+\)/.test(e)}(t)),[g]=(0,me.useSettings)("spacing.units"),f=(0,c.__experimentalUseCustomUnits)({availableUnits:g||["px","em","rem"]}),m=(0,u.useMemo)(()=>{const e=function(e){if(!e)return;if("0"===e)return"0";const t=e.match(/var\(--wp--preset--spacing--(.+)\)/);return t?t[1]:void 0}(t);if(!e)return 0;const n=h.findIndex(t=>String(t.slug)===e);return-1!==n?n:NaN},[t,h]),[v,x]=(0,u.useMemo)(()=>(0,c.__experimentalParseQuantityAndUnitFromRawValue)(t),[t]),y=x||f[0]?.value||"px",C={...l,border:0,padding:0,margin:0};return(0,J.jsxs)("fieldset",{className:"spacing-sizes-control",style:C,children:[(0,J.jsxs)(c.__experimentalHStack,{className:"spacing-sizes-control__header",style:{marginBottom:"12px"},children:[(0,J.jsx)(c.BaseControl.VisualLabel,{as:"legend",className:"spacing-sizes-control__label",children:e}),(0,J.jsx)(c.Button,{label:b?(0,i.__)("Use size preset"):(0,i.__)("Set custom size"),icon:Be,onClick:()=>p(!b),isPressed:b,size:"small",className:"spacing-sizes-control__custom-toggle",iconSize:24})]}),(0,J.jsx)(c.__experimentalVStack,{spacing:.5,children:(0,J.jsx)(c.__experimentalHStack,{className:"spacing-sizes-control__wrapper",children:b?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(c.__experimentalUnitControl,{hideLabelFromVision:!0,className:"spacing-sizes-control__unit-control",size:"__unstable-large",value:t,onChange:e=>{e&&!isNaN(parseFloat(e))&&n(e)}}),(0,J.jsx)(c.RangeControl,{min:0,max:100,step:1,withInputField:!1,className:"spacing-sizes-control__custom-value-range",label:e,hideLabelFromVision:!0,value:v||0,onChange:e=>{void 0!==e&&n(`${e}${y}`)},__nextHasNoMarginBottom:!0})]}):(0,J.jsx)(c.RangeControl,{className:"spacing-sizes-control__preset-range",label:e,hideLabelFromVision:!0,value:m,min:0,max:h.length-1,marks:h.map((e,t)=>({value:t,label:void 0})),withInputField:!1,onChange:e=>{if(void 0===e)return;const t=h[e]?.slug;n("0"===t?"0":`var(--wp--preset--spacing--${t})`)},__nextHasNoMarginBottom:!0})})})]})}const Ie={px:{max:1e3,step:1},"%":{max:100,step:1},vw:{max:100,step:1},vh:{max:100,step:1},em:{max:50,step:.1},rem:{max:50,step:.1},svw:{max:100,step:1},lvw:{max:100,step:1},dvw:{max:100,step:1},svh:{max:100,step:1},lvh:{max:100,step:1},dvh:{max:100,step:1},vi:{max:100,step:1},svi:{max:100,step:1},lvi:{max:100,step:1},dvi:{max:100,step:1},vb:{max:100,step:1},svb:{max:100,step:1},lvb:{max:100,step:1},dvb:{max:100,step:1},vmin:{max:100,step:1},svmin:{max:100,step:1},lvmin:{max:100,step:1},dvmin:{max:100,step:1},vmax:{max:100,step:1},svmax:{max:100,step:1},lvmax:{max:100,step:1},dvmax:{max:100,step:1}};function Ee({label:e,onChange:t,value:n,rangeConfig:l={},initialPosition:o,disabled:r}){var a,s,i,d,h,b;const p=parseFloat(n||"0"),[g]=(0,me.useSettings)("spacing.units"),f=(0,c.__experimentalUseCustomUnits)({availableUnits:g||["%","px","em","rem","vh","vw"]}),m=(0,u.useMemo)(()=>(0,c.__experimentalParseQuantityAndUnitFromRawValue)(n),[n])[1]||f[0]?.value||"px",v=l[m],x=Ie[m];let y=null!==(a=null!==(s=v?.min)&&void 0!==s?s:x?.min)&&void 0!==a?a:0,C=null!==(i=null!==(d=v?.max)&&void 0!==d?d:x?.max)&&void 0!==i?i:100;const w=null!==(h=null!==(b=v?.step)&&void 0!==b?b:x?.step)&&void 0!==h?h:.1;return y=Math.min(y,p),C=Math.max(C,p),(0,J.jsxs)("fieldset",{className:"block-editor-height-control",children:[(0,J.jsx)(c.BaseControl.VisualLabel,{as:"legend",children:e}),(0,J.jsxs)(c.Flex,{children:[(0,J.jsx)(c.FlexItem,{isBlock:!0,children:(0,J.jsx)(c.__experimentalUnitControl,{value:n,units:f,onChange:t,onUnitChange:e=>{const[l,o]=(0,c.__experimentalParseQuantityAndUnitFromRawValue)(n);["em","rem"].includes(e)&&"px"===o?t((l/16).toFixed(2)+e):["em","rem"].includes(o)&&"px"===e?t(Math.round(16*l)+e):l>100&&["%","vw","svw","lvw","dvw","vh","svh","lvh","dvh","vi","svi","lvi","dvi","vb","svb","lvb","dvb","vmin","svmin","lvmin","dvmin","vmax","svmax","lvmax","dvmax"].includes(e)&&t(100+e)},min:y,size:"__unstable-large",label:e,hideLabelFromVision:!0,disabled:r})}),(0,J.jsx)(c.FlexItem,{isBlock:!0,children:(0,J.jsx)(c.__experimentalSpacer,{marginX:2,marginBottom:0,children:(0,J.jsx)(c.RangeControl,{value:n?p:void 0,min:y,max:C,step:w,withInputField:!1,onChange:e=>{t([e,m].join(""))},__nextHasNoMarginBottom:!0,label:e,hideLabelFromVision:!0,initialPosition:o?parseFloat(o):void 0,disabled:r})})})]})]})}var Oe=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M19 5.5H5V4h14v1.5ZM19 20H5v-1.5h14V20ZM5 9h14v6H5V9Z"})}),Me=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M5 5.5h8V4H5v1.5ZM5 20h8v-1.5H5V20ZM19 9H5v6h14V9Z"})}),Ae=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M19 5.5H5V4h14v1.5ZM19 20H5v-1.5h14V20ZM7 9h10v6H7V9Z"})}),Ne=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M19 5.5h-8V4h8v1.5ZM19 20h-8v-1.5h8V20ZM5 9h14v6H5V9Z"})}),De=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M16 5.5H8V4h8v1.5ZM16 20H8v-1.5h8V20ZM5 9h14v6H5V9Z"})}),Le=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M5 4h14v11H5V4Zm11 16H8v-1.5h8V20Z"})});const Fe=[{icon:Oe,title:"None",value:void 0},{icon:Me,title:"Align left",value:"left"},{icon:Ae,title:"Align center",value:"center"},{icon:Ne,title:"Align right",value:"right"}],Ve=[{icon:Oe,title:"None",value:void 0},{icon:Me,title:"Align left",value:"left"},{icon:Ae,title:"Align center",value:"center"},{icon:Ne,title:"Align right",value:"right"},{icon:De,title:"Wide width",value:"wide"},{icon:Le,title:"Full Width",value:"full"}];function He({title:e,onChange:t,value:n,controls:l,controlset:o,disabled:r}){if(o&&(l={alignment:Fe,all:Ve}[o]),l){const o=l.find(e=>e.value===n)||l[0];return(0,J.jsx)(c.ToolbarGroup,{icon:o?.icon,title:e,isCollapsed:!0,controls:l.map(e=>{const l=!!r||!!e.isDisabled;return{...e,isDisabled:l,onClick:()=>{l||t(e.value)},isActive:n===e.value}})})}}function ze(e,t,n){const l=t.split(".");if(1===l.length)return{...e,[l[0]]:n};const o={...e};let r=o;for(let e=0;e<l.length-1;e++){const t=l[e];r[t]={...r[t]},r=r[t]}return r[l[l.length-1]]=n,o}function Ze(e,t,n,l,o){const r=function(e,t){const n={...t};for(const l in e){const o=e[l],r=t[l];void 0===o||"object"!=typeof o||null===o||Array.isArray(o)||"object"!=typeof r||null===r||Array.isArray(r)?void 0!==o&&(n[l]=o):n[l]={...r,...o}}return n}(e,t);return function(e,t,n,l){if(!t)return e;let o=e;for(const e of Object.keys(t)){const t=n[e];null!=t?o=ze(o,e,t):null!=l&&(o=ze(o,e,l))}return o}(r,n,l,o)}const Ge=(0,J.jsx)("svg",{height:24,width:24,viewBox:"0 0 189 189",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,J.jsx)("path",{d:"M62.9281 98.177H125.761V86.3958H62.9281V98.177ZM149.324 51.052H39.3656C35.1995 51.052 31.204 52.707 28.2581 55.6529C25.3122 58.5987 23.6572 62.5942 23.6572 66.7603V117.812C23.6572 121.979 25.3122 125.974 28.2581 128.92C31.204 131.866 35.1995 133.521 39.3656 133.521H149.324C153.49 133.521 157.485 131.866 160.431 128.92C163.377 125.974 165.032 121.979 165.032 117.812V66.7603C165.032 62.5942 163.377 58.5987 160.431 55.6529C157.485 52.707 153.49 51.052 149.324 51.052ZM39.3656 62.8333H149.324C150.365 62.8333 151.364 63.247 152.101 63.9835C152.837 64.7199 153.251 65.7188 153.251 66.7603V117.812C153.251 118.854 152.837 119.853 152.101 120.589C151.364 121.326 150.365 121.74 149.324 121.74H39.3656C38.324 121.74 37.3252 121.326 36.5887 120.589C35.8522 119.853 35.4385 118.854 35.4385 117.812V66.7603C35.4385 65.7188 35.8522 64.7199 36.5887 63.9835C37.3252 63.247 38.324 62.8333 39.3656 62.8333Z",fill:"#671FEB"})}),qe=(0,J.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 190 189",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,J.jsx)("path",{d:"M149.824 23.5625H39.8656C31.226 23.5625 24.1572 30.6312 24.1572 39.2708V149.229C24.1572 157.869 31.226 164.938 39.8656 164.938H149.824C158.463 164.938 165.532 157.869 165.532 149.229V39.2708C165.532 30.6312 158.463 23.5625 149.824 23.5625ZM39.8656 35.3438H149.824C152.18 35.3438 153.751 36.9146 153.751 39.2708V105.246L130.188 82.4688C127.832 80.1125 123.905 80.1125 122.334 82.4688L94.0593 109.958L71.2822 94.25C68.926 92.6792 66.5697 92.6792 64.9989 94.25L36.7239 114.671V39.2708C35.9385 36.9146 37.5093 35.3438 39.8656 35.3438ZM149.824 153.156H39.8656C37.5093 153.156 35.9385 151.585 35.9385 149.229V130.379L68.1406 106.817L91.7031 121.74C94.0593 123.31 97.201 123.31 98.7718 120.954L126.261 94.25L153.751 120.954V149.229C153.751 151.585 152.18 153.156 149.824 153.156Z",fill:"#671FEB"})}),$e=(J.Fragment,(0,J.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,J.jsx)("rect",{width:"24",height:"24",fill:"white"}),(0,J.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 5C3 3.89543 3.89543 3 5 3H19C20.1046 3 21 3.89543 21 5V19C21 20.1046 20.1046 21 19 21H5C3.89543 21 3 20.1046 3 19V5ZM8 8C8 8.55228 7.55228 9 7 9C6.44772 9 6 8.55228 6 8C6 7.44772 6.44772 7 7 7C7.55228 7 8 7.44772 8 8ZM7 13C7.55228 13 8 12.5523 8 12C8 11.4477 7.55228 11 7 11C6.44772 11 6 11.4477 6 12C6 12.5523 6.44772 13 7 13ZM8 16C8 16.5523 7.55228 17 7 17C6.44772 17 6 16.5523 6 16C6 15.4477 6.44772 15 7 15C7.55228 15 8 15.4477 8 16ZM11 7.5C10.7239 7.5 10.5 7.72386 10.5 8C10.5 8.27614 10.7239 8.5 11 8.5H17C17.2761 8.5 17.5 8.27614 17.5 8C17.5 7.72386 17.2761 7.5 17 7.5H11ZM10.5 12C10.5 11.7239 10.7239 11.5 11 11.5H17C17.2761 11.5 17.5 11.7239 17.5 12C17.5 12.2761 17.2761 12.5 17 12.5H11C10.7239 12.5 10.5 12.2761 10.5 12ZM11 15.5C10.7239 15.5 10.5 15.7239 10.5 16C10.5 16.2761 10.7239 16.5 11 16.5H17C17.2761 16.5 17.5 16.2761 17.5 16C17.5 15.7239 17.2761 15.5 17 15.5H11Z",fill:"#671feb"})]})),Qe=(0,J.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,J.jsx)("rect",{width:"24",height:"24",fill:"white"}),(0,J.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 3C4.34315 3 3 4.34315 3 6V18C3 19.6569 4.34315 21 6 21H18C19.6569 21 21 19.6569 21 18V6C21 4.34315 19.6569 3 18 3H6ZM8 9.61388C11.1954 9.04964 12.9452 9.06689 16 9.61388V12.681C12.8757 12.2134 11.125 12.1847 8 12.681V9.61388ZM7.42857 11.7356H4L4 11.7356L6.28572 13.2692L4.00002 14.8027H9.71429V13.055C9.0129 13.105 8.26382 13.1765 7.42857 13.2694V11.7356ZM14.2857 13.0511V14.8028L20 14.8028L17.7143 13.2693L20 11.7358L20 11.7357H16.5714V13.2694C15.7384 13.1741 14.9903 13.1013 14.2857 13.0511Z",fill:"#671FEB"})]}),Ue=window.wp.hooks;function We(){return(0,Ue.applyFilters)("tableberg.extendedElementDefinitions",[])}function Ke(e){return We().find(t=>t.name===e)}function Ye(e){return(0,J.jsx)("span",{className:"block-editor-block-icon has-colors",children:e})}const Je={name:"cell-blocks",triggerPrefix:"/",className:"block-editor-autocompleters__block",options:[],getOptionLabel:e=>[Ye(e.icon),e.name],getOptionKeywords:e=>[e.name],isOptionDisabled:e=>{var t;return null!==(t=e.disabled)&&void 0!==t&&t},getOptionCompletion:e=>({action:"replace",value:e.value})},Xe=".block-editor-block-toolbar",et=[".tableberg-edit-toolbar",".tableberg-edit-toolbar-mount"].join(", "),tt=[".block-editor-block-popover",".components-popover"].join(", "),nt=".interface-interface-skeleton__sidebar",lt=[".editor-inserter-sidebar",".block-editor-inserter__menu"].join(", "),ot=[".editor-document-tools__inserter-toggle",".edit-post-header-toolbar__inserter-toggle"].join(", "),rt=".block-editor-inserter__popover",at=[".editor-document-tools",".edit-post-header-toolbar"].join(", ");function st({ref:e,onClickOutside:t}){(0,u.useEffect)(()=>{const n=e.current?.ownerDocument;if(n)return n.addEventListener("mousedown",l),()=>n.removeEventListener("mousedown",l);function l(n){if(!e.current)return;const l=n.target;if(!l||e.current.contains(l))return;const o=l instanceof Element?l:l.parentElement;o&&o.closest([Xe,et,tt,nt,lt,ot,rt,at].join(", "))||t()}},[t,e])}function it(e,t,n){return e[ge(t,n)]?.elements||[]}function ct(e,t,n,l){const o=l.toLowerCase().trim();if(!o)return!0;for(let l=0;l<t;l++)if(it(n,e,l).map(e=>ca(e)).join(" ").toLowerCase().includes(o))return!0;return!1}function ut(e,t,n,l,o){const{headerEnabled:r,footerEnabled:a}=l,s=o.toLowerCase().trim();if(!s)return Array.from({length:t},(e,t)=>t);const i=r?0:-1,c=a?t-1:-1,u=[];r&&u.push(0);for(let l=0;l<t;l++)l!==i&&l!==c&&ct(l,n,e,s)&&u.push(l);return a&&u.push(t-1),u}function dt({content:e,searchTerm:t,highlightColor:n}){const l=function(e,t){const n=e.replace(/<[^>]*>/g,""),l=t.trim();if(!l||!n)return[{text:n,highlighted:!1}];const o=l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`(${o})`,"gi"),a=[];let s,i=0;for(;null!==(s=r.exec(n));)s.index>i&&a.push({text:n.slice(i,s.index),highlighted:!1}),a.push({text:s[1],highlighted:!0}),i=r.lastIndex;return i<n.length&&a.push({text:n.slice(i),highlighted:!1}),a.length>0?a:[{text:n,highlighted:!1}]}(e,t);return(0,J.jsx)(J.Fragment,{children:l.map((e,t)=>e.highlighted?(0,J.jsx)("mark",{style:{backgroundColor:n,borderRadius:"2px"},children:e.text},t):e.text)})}var ht=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z"})});function bt({cellCoords:e,elementIndex:t}){const n=Ha(e=>e.removeElementFromCell);return(0,J.jsx)(c.ToolbarButton,{icon:ht,label:(0,i.__)("Delete element","tableberg"),title:(0,i.__)("Delete element","tableberg"),isDestructive:!0,onClick:()=>n(e,t)})}var pt=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"})});const gt="TABLEBERG_ELEMENT_STYLES:",ft=new Set(["align","height","width","aspectRatio","scale","sizeSlug","border","borderRadius"]),mt=new Set(["align"]),vt=new Set(["backgroundColor","textColor","linkColor","fontSize","padding","margin","border","borderRadius"]);let xt="";function yt(e){return JSON.parse(JSON.stringify(e))}function Ct(e){var t;const n={...null!==(t=e.attributes)&&void 0!==t?t:{}};return e.bindings&&Object.keys(e.bindings).length>0&&(n.bindings=e.bindings),(0,ve.serialize)((0,ve.createBlock)(`tableberg/${e.name}`,n))}function wt(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function _t(e){return e.attributes}async function kt(e){if(xt=e,!navigator.clipboard?.writeText)return!1;try{return await navigator.clipboard.writeText(e),!0}catch{return!1}}function jt(e){const t=window.wp?.keyboardShortcuts?.store,n=window.wp?.data?.select;if(t&&n)return n(t).getShortcutRepresentation?.(e)}function St({cellCoords:e,elementIndex:t}){const n=Ha(e=>e.cells),l=Ha(e=>e.insertElementInCell),o=Ha(e=>e.duplicateElementInCell),r=Ha(e=>e.removeElementFromCell),a=Ha(e=>e.updateCellElement),s=n[e]?.elements?.[t]||null,u={copy:jt("core/block-editor/copy"),cut:jt("core/block-editor/cut"),duplicate:jt("core/block-editor/duplicate"),insertBefore:jt("core/block-editor/insert-before"),insertAfter:jt("core/block-editor/insert-after"),remove:jt("core/block-editor/remove")};if(!s)return null;const d=t=>{const n=ua("text");n&&l(e,t,n)};return(0,J.jsx)(c.ToolbarDropdownMenu,{icon:pt,label:(0,i.__)("Element options","tableberg"),toggleProps:{title:(0,i.__)("Element options","tableberg"),showTooltip:!0},popoverProps:{placement:"bottom-start"},children:({onClose:n})=>(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(c.MenuGroup,{children:[(0,J.jsx)(c.MenuItem,{shortcut:u.copy,onClick:()=>{kt(Ct(s)),n()},children:(0,i.__)("Copy","tableberg")}),(0,J.jsx)(c.MenuItem,{onClick:()=>{var e;kt((e=s,`${gt}${JSON.stringify(function(e){const t=_t(e),n={};return wt(t.styles)&&(n.styles=yt(t.styles)),ft.forEach(e=>{void 0!==t[e]&&(n[e]=yt(t[e]))}),{name:e.name,attributes:n}}(e))}`)),n()},children:(0,i.__)("Copy styles","tableberg")}),(0,J.jsx)(c.MenuItem,{onClick:()=>{(async()=>{const n=function(e){if(!e.startsWith(gt))return null;try{const t=JSON.parse(e.slice(25));return wt(t)&&"string"==typeof t.name&&wt(t.attributes)?yt(t):null}catch{return null}}(await async function(){if(!navigator.clipboard?.readText)return xt;try{return await navigator.clipboard.readText()}catch{return xt}}());if(!n)return;const l=function(e,t){const n=t.name===e.name,l=_t(e),o=t.attributes,r={...l};if(wt(o.styles)){const e=wt(l.styles)?l.styles:{},t={...e};Object.entries(o.styles).forEach(([l,o])=>{(n||vt.has(l)&&l in e)&&(t[l]=yt(o))}),Object.keys(t).length>0&&(r.styles=t)}return Object.entries(o).forEach(([e,t])=>{"styles"!==e&&(n?ft:mt).has(e)&&e in l&&(r[e]=yt(t))}),{...e,attributes:r}}(s,n);a(e,t,{attributes:l.attributes})})(),n()},children:(0,i.__)("Paste styles","tableberg")}),(0,J.jsx)(c.MenuItem,{shortcut:u.cut,onClick:()=>{(async()=>{await kt(Ct(s)),r(e,t)})(),n()},children:(0,i.__)("Cut","tableberg")}),(0,J.jsx)(c.MenuItem,{shortcut:u.duplicate,onClick:()=>{o(e,t),n()},children:(0,i.__)("Duplicate","tableberg")})]}),(0,J.jsxs)(c.MenuGroup,{children:[(0,J.jsx)(c.MenuItem,{shortcut:u.insertBefore,onClick:()=>{d(t),n()},children:(0,i.__)("Add before","tableberg")}),(0,J.jsx)(c.MenuItem,{shortcut:u.insertAfter,onClick:()=>{d(t+1),n()},children:(0,i.__)("Add after","tableberg")})]}),(0,J.jsx)(c.MenuGroup,{children:(0,J.jsx)(c.MenuItem,{shortcut:u.remove,onClick:()=>{r(e,t),n()},children:(0,i.__)("Delete","tableberg")})})]})})}function Pt({cellCoords:e,elementIndex:t}){return(0,J.jsx)(me.BlockControls,{group:"other",children:(0,J.jsx)(St,{cellCoords:e,elementIndex:t})})}function Rt(){return(0,u.useCallback)((e,t,n)=>{const l=e.ownerDocument,o=l.defaultView?.parent?.document||l,r=o.querySelector(".block-editor-block-card__title");r&&(r.textContent=t);const a=o.querySelector(".block-editor-block-card__description");a&&(a.textContent=n)},[])}const Bt=e=>!!(e.top||e.right||e.bottom||e.left);function Tt({attributes:e,bindings:t,updateStyles:n}){const l=Ha(e=>e.updateSelectedElementStyles),o=null!=n?n:l,{clientId:r}=(0,me.useBlockEditContext)(),a=!!t?.["styles.textColor"],s=!!t?.["styles.linkColor"],u=!!t?.["styles.backgroundColor"],d=!!t?.["styles.fontSize"];return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(me.InspectorControls,{group:"color",children:[(0,J.jsx)(_e,{label:a?(0,i.__)("Text Color (dynamic)","tableberg"):(0,i.__)("Text Color","tableberg"),value:e.styles.textColor,onChange:e=>o({textColor:e}),onDeselect:()=>o({textColor:Mt.styles.textColor})}),(0,J.jsx)(_e,{label:s?(0,i.__)("Link Color (dynamic)","tableberg"):(0,i.__)("Link Color","tableberg"),value:e.styles.linkColor,onChange:e=>o({linkColor:e}),onDeselect:()=>o({linkColor:Mt.styles.linkColor})}),(0,J.jsx)(_e,{label:u?(0,i.__)("Background Color (dynamic)","tableberg"):(0,i.__)("Background Color","tableberg"),value:e.styles.backgroundColor,onChange:e=>o({backgroundColor:e}),onDeselect:()=>o({backgroundColor:Mt.styles.backgroundColor})})]}),(0,J.jsx)(me.InspectorControls,{children:(0,J.jsx)(c.PanelBody,{title:(0,i.__)("Typography","tableberg"),children:(0,J.jsx)(c.BaseControl,{__nextHasNoMarginBottom:!0,help:d?(0,i.__)("Overridden by dynamic data","tableberg"):"",children:(0,J.jsx)(me.FontSizePicker,{value:e.styles.fontSize||void 0,onChange:e=>o({fontSize:e?String(e):Mt.styles.fontSize})})})})}),(0,J.jsx)(me.InspectorControls,{children:(0,J.jsxs)(c.__experimentalToolsPanel,{label:(0,i.__)("Dimensions","tableberg"),panelId:r,resetAll:()=>o({padding:{...Mt.styles.padding},margin:{...Mt.styles.margin}}),children:[(0,J.jsx)(Pe,{label:(0,i.__)("Padding","tableberg"),value:e.styles.padding,hasValue:()=>Bt(e.styles.padding),onChange:e=>o({padding:e}),onDeselect:()=>o({padding:{...Mt.styles.padding}})}),(0,J.jsx)(Pe,{label:(0,i.__)("Margin","tableberg"),value:e.styles.margin,hasValue:()=>Bt(e.styles.margin),onChange:e=>o({margin:e}),onDeselect:()=>o({margin:{...Mt.styles.margin}})})]})})]})}function It(){if("undefined"!=typeof globalThis){const e=globalThis.TABLEBERG_CFG;if(e)return e}if("undefined"!=typeof window)try{const e=window.parent?.TABLEBERG_CFG;if(e)return e}catch{}return{}}function Et(){return Boolean(It().IS_PRO)}const Ot={top:"",right:"",bottom:"",left:""},Mt={content:"",align:"left",styles:{textColor:"#000000",linkColor:"",backgroundColor:"",fontSize:"1.38rem",padding:{...Ot},margin:{...Ot}}};function At(e){if(!e)return;const{top:t,right:n,bottom:l,left:o}=e;return t||n||l||o?`${t||"0"} ${n||"0"} ${l||"0"} ${o||"0"}`:void 0}function Nt({attributes:e,bindings:t,cellCoords:n,elementIndex:l}){const o=(0,u.useRef)(null),r=Ha(e=>e.sortPreviewMode),s=Ha(e=>e.isElementSelected),c=Ha(e=>e.setSelectedElement),d=Ha(e=>e.clearSelectedElement),h=Ha(e=>e.updateCellElement),b=Rt(),p=s(n,l);st({ref:o,onClickOutside:()=>{p&&d()}});const{values:g,isLoading:f}=Ga(t),m=Ze(e,Mt,t,g,(0,i.__)("(No data)","tableberg")),v=!!t?.content,{content:x,align:y,styles:C}=m,w={display:"flex",justifyContent:a(y),textAlign:y};return(0,J.jsxs)(J.Fragment,{children:[p&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(me.BlockControls,{children:[(0,J.jsx)(He,{title:(0,i.__)("Align text","tableberg"),value:y,onChange:e=>{"left"!==e&&"center"!==e&&"right"!==e||h(n,l,{attributes:{align:e}})},controlset:"alignment"}),(0,J.jsx)(bt,{cellCoords:n,elementIndex:l})]}),(0,J.jsx)(Pt,{cellCoords:n,elementIndex:l}),(0,J.jsx)(Tt,{attributes:m,bindings:t}),(0,J.jsx)(me.InspectorControls,{children:(0,J.jsx)(qa,{elementType:"text",bindings:t})})]}),(0,J.jsx)("div",{ref:o,style:w,onClick:e=>{e.stopPropagation(),r||(c(n,l),o.current&&b(o.current,"Text","A text element within a Tableberg cell"))},children:(0,J.jsx)(Dt,{content:x,cellCoords:n,elementIndex:l,dynamicBindingEnabled:v,isDynamicLoading:f,textColor:C.textColor,linkColor:C.linkColor,backgroundColor:C.backgroundColor,fontSize:C.fontSize,padding:C.padding,margin:C.margin})})]})}function Dt({content:e,cellCoords:t,elementIndex:n,dynamicBindingEnabled:l,isDynamicLoading:o,textColor:r,linkColor:a,backgroundColor:s,fontSize:c,padding:u,margin:d}){const h={...Je,options:[{icon:Ge,name:"Button",value:"button"},{icon:qe,name:"Image",value:"image"},{icon:$e,name:"List",value:"list"},{icon:Qe,name:"Ribbon",value:"ribbon",disabled:!0},...We().map(e=>({icon:e.icon,name:e.autocompleteLabel||e.title,value:e.name}))]},b=Ha(e=>e.sortPreviewMode),p=Ha(e=>e.updateCellElement),g=Ha(e=>e.replaceCellElement),f=Ha(e=>e.searchTerm),m=Ha(e=>e.table.search),v=Et()&&m?.enabled&&m?.highlightColor&&f.trim(),x=At(u),y=At(d),C={margin:null!=y?y:0,padding:x,color:r||void 0,fontSize:c||void 0,backgroundColor:s||void 0,"--tableberg-text-link-color":a||void 0},w={margin:y,padding:x,color:r||void 0,fontSize:c||void 0,backgroundColor:s||void 0,"--tableberg-text-link-color":a||void 0},_="tableberg-text-element"+(l?" tableberg-dynamic-content":"");return o?(0,J.jsx)("p",{className:_,style:C,children:(0,i.__)("Loading...","tableberg")}):v?(0,J.jsx)("p",{className:_,style:C,children:(0,J.jsx)(dt,{content:e,searchTerm:f,highlightColor:m.highlightColor})}):b||l?(0,J.jsx)(me.RichText.Content,{tagName:"p",className:_,value:e,style:C}):(0,J.jsx)(me.RichText,{className:_,placeholder:"Type here",value:e,onChange:e=>p(t,n,{attributes:{content:e}}),autocompleters:[h],style:w,onReplace:e=>{const l=e?.[0];if("string"==typeof l){const e=ua(l);return void(e&&g(t,n,e))}const o=function(e){return e.map(e=>{const t="string"==typeof e?.attributes?.content?e.attributes.content:(0,ve.getBlockContent)(e)||"",n=document.createElement("div");return n.innerHTML=t,(n.textContent||"").trim()}).filter(Boolean).join("\n")}(e);o&&p(t,n,{attributes:{content:o}})}})}const Lt=[{path:"content",label:(0,i.__)("Content","tableberg")},{path:"styles.textColor",label:(0,i.__)("Text Color","tableberg")},{path:"styles.linkColor",label:(0,i.__)("Link Color","tableberg")},{path:"styles.backgroundColor",label:(0,i.__)("Background Color","tableberg")},{path:"styles.fontSize",label:(0,i.__)("Font Size","tableberg")}];var Ft=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M10 17.389H8.444A5.194 5.194 0 1 1 8.444 7H10v1.5H8.444a3.694 3.694 0 0 0 0 7.389H10v1.5ZM14 7h1.556a5.194 5.194 0 0 1 0 10.39H14v-1.5h1.556a3.694 3.694 0 0 0 0-7.39H14V7Zm-4.5 6h5v-1.5h-5V13Z"})}),Vt=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M9 9v6h11V9H9zM4 20h1.5V4H4v16z"})}),Ht=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M12.5 15v5H11v-5H4V9h7V4h1.5v5h7v6h-7Z"})}),zt=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M4 15h11V9H4v6zM18.5 4v16H20V4h-1.5z"})});const Zt=window.wp.url;function Gt({attributes:e,bindings:t,cellCoords:n,elementIndex:l,updateStyles:o,updateAttrs:r}){const{styles:a,link:s,id:d,align:h}=e,b=Ha(e=>e.updateSelectedElementStyles),p=Ha(e=>e.updateSelectedElementAttrs),g=null!=o?o:b,f=null!=r?r:p,[m,v]=(0,u.useState)(!1),x=!!t?.["link.url"],y=!!t?.["styles.textColor"],C=!!t?.["styles.backgroundColor"],w=!!t?.id,_=!!s.url,k="_blank"===s.target,j=(0,u.useMemo)(()=>({url:s.url,opensInNewTab:k}),[s.url,k]),S=()=>{f({link:qt.link}),v(!1)},P=["auto","25%","50%","75%","100%"];return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(me.BlockControls,{group:"block",children:[(0,J.jsx)(me.AlignmentControl,{value:a.textAlign,onChange:e=>{"left"!==e&&"center"!==e&&"right"!==e&&(e=qt.styles.textAlign),g({textAlign:e})}}),(0,J.jsx)(c.ToolbarButton,{icon:Ft,title:x?(0,i.__)("Link URL is dynamically bound","tableberg"):_?(0,i.__)("Unlink","tableberg"):(0,i.__)("Link","tableberg"),onClick:x?void 0:_?S:()=>v(!0),isActive:_||x,disabled:x}),(0,J.jsx)(bt,{cellCoords:n,elementIndex:l}),m&&!x&&(0,J.jsx)(c.Popover,{placement:"bottom",onClose:()=>v(!1),shift:!0,children:(0,J.jsx)(me.__experimentalLinkControl,{value:j,onChange:({url:e="",opensInNewTab:t})=>{f({link:{...s,url:(0,Zt.prependHTTP)(e),target:t?"_blank":"_self"}})},onRemove:S})})]}),(0,J.jsx)(Pt,{cellCoords:n,elementIndex:l}),(0,J.jsxs)(me.InspectorControls,{group:"color",children:[(0,J.jsx)(_e,{label:y?(0,i.__)("Text (dynamic)","tableberg"):(0,i.__)("Text","tableberg"),value:a.textColor,onChange:e=>g({textColor:e}),onDeselect:()=>g({textColor:qt.styles.textColor})}),(0,J.jsx)(_e,{label:(0,i.__)("Hover Text","tableberg"),value:a.textHoverColor,onChange:e=>g({textHoverColor:e}),onDeselect:()=>g({textHoverColor:qt.styles.textHoverColor})}),(0,J.jsx)(_e,{label:C?(0,i.__)("Background (dynamic)","tableberg"):(0,i.__)("Background","tableberg"),value:a.backgroundColor,onChange:e=>g({backgroundColor:e}),onDeselect:()=>g({backgroundColor:qt.styles.backgroundColor})}),(0,J.jsx)(_e,{label:(0,i.__)("Hover Background","tableberg"),value:a.backgroundHoverColor,onChange:e=>g({backgroundHoverColor:e}),onDeselect:()=>g({backgroundHoverColor:qt.styles.backgroundHoverColor})})]}),(0,J.jsxs)(me.InspectorControls,{group:"dimensions",children:[(0,J.jsx)(Pe,{label:(0,i.__)("Padding","tableberg"),value:a.padding,onChange:e=>g({padding:e}),onDeselect:()=>g({padding:qt.styles.padding}),hasValue:()=>!!(a.padding.top||a.padding.right||a.padding.bottom||a.padding.left)}),(0,J.jsx)(we,{label:(0,i.__)("Border Radius","tableberg"),value:a.borderRadius,onChange:e=>g({borderRadius:e}),onDeselect:()=>g({borderRadius:qt.styles.borderRadius}),hasValue:()=>!!(a.borderRadius.topLeft||a.borderRadius.topRight||a.borderRadius.bottomLeft||a.borderRadius.bottomRight)})]}),(0,J.jsx)(me.InspectorControls,{children:(0,J.jsx)(c.PanelBody,{title:(0,i.__)("Typography","tableberg"),children:(0,J.jsx)(c.BaseControl,{__nextHasNoMarginBottom:!0,children:(0,J.jsx)(me.FontSizePicker,{value:a.fontSize,onChange:e=>{g({fontSize:e||qt.styles.fontSize})}})})})}),(0,J.jsx)(me.InspectorControls,{group:"advanced",children:(0,J.jsx)(c.TextControl,{__nextHasNoMarginBottom:!0,autoComplete:"off",label:w?(0,i.__)("HTML ID (dynamic)","tableberg"):(0,i.__)("HTML ID","tableberg"),help:w?(0,i.__)("Overridden by dynamic data","tableberg"):"",value:d,onChange:e=>f({id:e})})}),(0,J.jsx)(me.InspectorControls,{children:(0,J.jsxs)(c.PanelBody,{title:(0,i.__)("Button Settings","tableberg"),children:[(0,J.jsxs)(c.__experimentalToggleGroupControl,{label:(0,i.__)("Button Alignment","tableberg"),value:h,onChange:e=>{"left"!==e&&"center"!==e&&"right"!==e&&(e=qt.align),f({align:e})},isBlock:!0,children:[(0,J.jsx)(c.__experimentalToggleGroupControlOptionIcon,{value:"left",label:(0,i.__)("Left","tableberg"),icon:Vt}),(0,J.jsx)(c.__experimentalToggleGroupControlOptionIcon,{value:"center",label:(0,i.__)("Center","tableberg"),icon:Ht}),(0,J.jsx)(c.__experimentalToggleGroupControlOptionIcon,{value:"right",label:(0,i.__)("Right","tableberg"),icon:zt})]}),(0,J.jsx)(c.__experimentalToggleGroupControl,{label:(0,i.__)("Width","tableberg"),value:a.width,onChange:e=>{e&&"number"!=typeof e||(e=qt.styles.width),P.includes(e)||(e=qt.styles.width),g({width:e})},isBlock:!0,children:P.map(e=>(0,J.jsx)(c.__experimentalToggleGroupControlOption,{value:e,label:(0,i.__)(e,"tableberg")},e))})]})}),(0,J.jsx)(me.InspectorControls,{children:(0,J.jsx)(qa,{elementType:"button",bindings:t})})]})}const qt={content:"",id:"",align:"left",link:{url:"",target:"_self"},styles:{backgroundColor:"#000000",textColor:"#ffffff",backgroundHoverColor:"",textHoverColor:"",textAlign:"center",width:"auto",padding:{top:"var(--wp--preset--spacing--20)",right:"var(--wp--preset--spacing--20)",bottom:"var(--wp--preset--spacing--20)",left:"var(--wp--preset--spacing--20)"},borderRadius:{topLeft:"4px",topRight:"4px",bottomRight:"4px",bottomLeft:"4px"},fontSize:"1.38rem"}};function $t({attributes:e,bindings:t,cellCoords:n,elementIndex:l}){const o=(0,u.useRef)(null),r=Ha(e=>e.sortPreviewMode),s=Ha(e=>e.isElementSelected),c=Ha(e=>e.setSelectedElement),d=Ha(e=>e.clearSelectedElement),h=Rt(),b=s(n,l),{values:p,isLoading:g}=Ga(t);st({ref:o,onClickOutside:()=>{b&&d()}});const f=Ze(e,qt,t,p,(0,i.__)("(No data)","tableberg")),m=!!t&&Object.keys(t).length>0,v=!!t?.content,{content:x,align:y,styles:C}=f,w=function(e){switch(e){case"25%":return"calc(25% - (var(--wp--style--block-gap, 0.5em) * 0.75))";case"50%":return"calc(50% - (var(--wp--style--block-gap, 0.5em) * 0.5))";case"75%":return"calc(75% - (var(--wp--style--block-gap, 0.5em) * 0.25))";case"100%":return"100%";default:return}}(C.width),_={display:"flex",justifyContent:a(y),width:w?"100%":void 0,"--tableberg-button-background-color":C.backgroundColor,"--tableberg-button-text-color":C.textColor,"--tableberg-button-hover-background-color":C.backgroundHoverColor||C.backgroundColor,"--tableberg-button-text-hover-color":C.textHoverColor||C.textColor},k={width:w,maxWidth:w?"none":void 0,minWidth:w?"0":void 0,flexBasis:"100%"===C.width?"100%":void 0},j={display:"inline-block",textAlign:C.textAlign,fontSize:C.fontSize,paddingTop:C.padding.top,paddingRight:C.padding.right,paddingBottom:C.padding.bottom,paddingLeft:C.padding.left,borderTopLeftRadius:C.borderRadius.topLeft,borderTopRightRadius:C.borderRadius.topRight,borderBottomRightRadius:C.borderRadius.bottomRight,borderBottomLeftRadius:C.borderRadius.bottomLeft,width:w?"100%":void 0};return(0,J.jsxs)(J.Fragment,{children:[b&&(0,J.jsx)(Gt,{attributes:f,bindings:t,cellCoords:n,elementIndex:l}),(0,J.jsx)("div",{ref:o,style:_,onClick:e=>{e.stopPropagation(),r||(c(n,l),o.current&&h(o.current,"Button","A button element within a Tableberg cell"))},children:(0,J.jsx)("div",{style:k,children:(0,J.jsx)(Qt,{content:x,cellCoords:n,elementIndex:l,contentIsBound:v,hasDynamicBindings:m,isDynamicLoading:g,buttonStyleCss:j})})})]})}function Qt({content:e,cellCoords:t,elementIndex:n,contentIsBound:l,hasDynamicBindings:o,isDynamicLoading:r,buttonStyleCss:a}){const s=Ha(e=>e.sortPreviewMode),c=Ha(e=>e.updateCellElement),u=Ha(e=>e.searchTerm),d=Ha(e=>e.table.search),h=Et()&&d?.enabled&&d?.highlightColor&&u.trim(),b=je()("wp-block-button__link","wp-element-button"),p=je()(b,{"tableberg-dynamic-content":o});return r?(0,J.jsx)("div",{className:p,style:a,children:(0,i.__)("Loading...","tableberg")}):h?(0,J.jsx)("div",{className:p,style:a,children:(0,J.jsx)(dt,{content:e,searchTerm:u,highlightColor:d.highlightColor})}):s||l?(0,J.jsx)("div",{className:p,style:a,children:e}):(0,J.jsx)(me.RichText,{className:b,tagName:"div",style:a,placeholder:(0,i.__)("Button text","tableberg"),value:e,onChange:e=>c(t,n,{attributes:{content:e}})})}const Ut=[{path:"content",label:(0,i.__)("Button Text","tableberg")},{path:"link.url",label:(0,i.__)("Link URL","tableberg")},{path:"id",label:(0,i.__)("HTML ID","tableberg")},{path:"styles.backgroundColor",label:(0,i.__)("Background Color","tableberg")},{path:"styles.textColor",label:(0,i.__)("Text Color","tableberg")}];var Wt=(0,J.jsx)(Re.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,J.jsx)(Re.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z"})}),Kt=(0,J.jsx)(Re.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,J.jsx)(Re.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M6 5.5h12a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H6a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5ZM4 6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6Zm4 10h2v-1.5H8V16Zm5 0h-2v-1.5h2V16Zm1 0h2v-1.5h-2V16Z"})});const Yt=window.wp.element;var Jt=(0,Yt.forwardRef)(({icon:e,size:t=24,...n},l)=>(0,Yt.cloneElement)(e,{width:t,height:t,...n,ref:l})),Xt=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M6 4a2 2 0 0 0-2 2v3h1.5V6a.5.5 0 0 1 .5-.5h3V4H6Zm3 14.5H6a.5.5 0 0 1-.5-.5v-3H4v3a2 2 0 0 0 2 2h3v-1.5Zm6 1.5v-1.5h3a.5.5 0 0 0 .5-.5v-3H20v3a2 2 0 0 1-2 2h-3Zm3-16a2 2 0 0 1 2 2v3h-1.5V6a.5.5 0 0 0-.5-.5h-3V4h3Z"})}),en=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M17.031 4.703 15.576 4l-1.56 3H14v.03l-2.324 4.47H9.5V13h1.396l-1.502 2.889h-.95a3.694 3.694 0 0 1 0-7.389H10V7H8.444a5.194 5.194 0 1 0 0 10.389h.17L7.5 19.53l1.416.719L15.049 8.5h.507a3.694 3.694 0 0 1 0 7.39H14v1.5h1.556a5.194 5.194 0 0 0 .273-10.383l1.202-2.304Z"})}),tn=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M16 10h4c.6 0 1-.4 1-1V5c0-.6-.4-1-1-1h-4c-.6 0-1 .4-1 1v4c0 .6.4 1 1 1zm-8 4H4c-.6 0-1 .4-1 1v4c0 .6.4 1 1 1h4c.6 0 1-.4 1-1v-4c0-.6-.4-1-1-1zm10-2.6L14.5 15l1.1 1.1 1.7-1.7c-.1 1.1-.3 2.3-.9 2.9-.3.3-.7.5-1.3.5h-4.5v1.5H15c.9 0 1.7-.3 2.3-.9 1-1 1.3-2.7 1.4-4l1.8 1.8 1.1-1.1-3.6-3.7zM6.8 9.7c.1-1.1.3-2.3.9-2.9.4-.4.8-.6 1.3-.6h4.5V4.8H9c-.9 0-1.7.3-2.3.9-1 1-1.3 2.7-1.4 4L3.5 8l-1 1L6 12.6 9.5 9l-1-1-1.7 1.7z"})});const nn=[{label:(0,i.__)("Original","tableberg"),value:""},{label:(0,i.__)("Square - 1:1","tableberg"),value:"1"},{label:(0,i.__)("Standard - 4:3","tableberg"),value:"4/3"},{label:(0,i.__)("Portrait - 3:4","tableberg"),value:"3/4"},{label:(0,i.__)("Classic - 3:2","tableberg"),value:"3/2"},{label:(0,i.__)("Classic Portrait - 2:3","tableberg"),value:"2/3"},{label:(0,i.__)("Wide - 16:9","tableberg"),value:"16/9"},{label:(0,i.__)("Tall - 9:16","tableberg"),value:"9/16"}],ln=[{value:"cover",label:(0,i.__)("Cover","tableberg"),help:(0,i.__)("Fill the space by clipping what doesn't fit.","tableberg")},{value:"contain",label:(0,i.__)("Contain","tableberg"),help:(0,i.__)("Fit the content to the space without clipping.","tableberg")}],on=[{label:(0,i.__)("Thumbnail","tableberg"),value:"thumbnail"},{label:(0,i.__)("Medium","tableberg"),value:"medium"},{label:(0,i.__)("Large","tableberg"),value:"large"},{label:(0,i.__)("Full Size","tableberg"),value:"full"}];function rn({attributes:e,bindings:t,showCaption:n,setShowCaption:l,cellCoords:o,elementIndex:r,updateAttrs:a}){const{media:s,alt:d,aspectRatio:h,height:b,width:p,scale:g,sizeSlug:f,href:m,linkTarget:v,lightbox:x,align:y,border:C,borderRadius:w,caption:_}=e,k=Ha(e=>e.updateSelectedElementAttrs),j=null!=a?a:k,[S,P]=(0,u.useState)(!1),R=!!m,B=!!x?.enabled,T=R||B,I="_blank"===v,E=(0,u.useMemo)(()=>({url:m,opensInNewTab:I}),[m,I]),O=()=>{j({lightbox:{enabled:!B},...B?{}:{href:"",linkTarget:"_self"}}),P(!1)},M=!!s.url||!!s.id,A=(0,u.useMemo)(()=>ln.reduce((e,t)=>(e[t.value]=t.help,e),{}),[]);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(me.BlockControls,{group:"block",children:[(0,J.jsx)(He,{icon:Oe,title:(0,i.__)("Align image","tableberg"),value:y,onChange:e=>{e&&j({align:e})},controlset:"alignment"}),(0,J.jsx)(c.ToolbarButton,{onClick:()=>{l(!n),n&&_&&j({caption:""})},icon:Kt,isPressed:n,label:n?(0,i.__)("Remove caption","tableberg"):(0,i.__)("Add caption","tableberg")}),(0,J.jsx)(c.ToolbarButton,{icon:Ft,title:T?(0,i.__)("Edit link","tableberg"):(0,i.__)("Link","tableberg"),onClick:()=>P(!0),isActive:T}),(0,J.jsx)(bt,{cellCoords:o,elementIndex:r}),S&&(0,J.jsx)(c.Popover,{placement:"bottom",onClose:()=>P(!1),shift:!0,children:B?(0,J.jsxs)("div",{style:{alignItems:"center",border:"1px solid #1e1e1e",borderRadius:"2px",display:"flex",gap:"16px",justifyContent:"space-between",minWidth:"560px",padding:"12px 14px"},children:[(0,J.jsxs)("div",{style:{alignItems:"center",display:"flex",gap:"16px"},children:[(0,J.jsx)(Jt,{icon:Xt}),(0,J.jsxs)("span",{style:{display:"flex",flexDirection:"column"},children:[(0,J.jsx)("span",{children:(0,i.__)("Enlarge on click","tableberg")}),(0,J.jsx)("span",{style:{color:"#757575"},children:(0,i.__)("Scales the image with a lightbox effect","tableberg")})]})]}),(0,J.jsx)(c.Button,{icon:en,label:(0,i.__)("Disable Enlarge on click","tableberg"),onClick:O,showTooltip:!0,variant:"secondary"})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(me.__experimentalLinkControl,{value:E,onChange:({url:e="",opensInNewTab:t})=>{j({href:(0,Zt.prependHTTP)(e),linkTarget:t?"_blank":"_self",lightbox:an.lightbox})},onRemove:()=>{j({href:"",linkTarget:"_self",lightbox:an.lightbox}),P(!1)}}),M&&(0,J.jsx)("div",{style:{borderTop:"1px solid #ddd",padding:"8px 0"},children:(0,J.jsx)(c.Button,{icon:Xt,isPressed:B,onClick:O,style:{alignItems:"flex-start",display:"flex",gap:"16px",height:"auto",justifyContent:"flex-start",padding:"12px 16px",textAlign:"left",width:"100%"},children:(0,J.jsxs)("span",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[(0,J.jsx)("span",{children:(0,i.__)("Enlarge on click","tableberg")}),(0,J.jsx)("span",{style:{color:"#757575",fontSize:"12px"},children:(0,i.__)("Scale the image with a lightbox effect.","tableberg")})]})})})]})})]}),(0,J.jsx)(Pt,{cellCoords:o,elementIndex:r}),M&&(0,J.jsx)(me.BlockControls,{children:(0,J.jsx)(c.ToolbarGroup,{children:(0,J.jsx)(me.MediaUploadCheck,{children:(0,J.jsx)(me.MediaUpload,{onSelect:e=>{e&&e.url?j({media:{id:e.id,url:e.url,alt:e.alt||"",title:e.title||"",sizes:e.sizes||{}},alt:e.alt||""}):j({media:{}})},allowedTypes:["image"],value:s.id,render:({open:e})=>(0,J.jsx)(c.ToolbarButton,{onClick:e,icon:tn,label:(0,i.__)("Replace","tableberg")})})})})}),(0,J.jsx)(me.InspectorControls,{children:(0,J.jsxs)(c.__experimentalToolsPanel,{label:(0,i.__)("Settings","tableberg"),resetAll:()=>{j({alt:"",aspectRatio:"",height:"",scale:"cover",width:"150px",sizeSlug:"large",lightbox:an.lightbox})},children:[(0,J.jsx)(c.__experimentalToolsPanelItem,{isShownByDefault:!0,hasValue:()=>!!d,label:(0,i.__)("Alternative Text","tableberg"),onDeselect:()=>j({alt:""}),children:(0,J.jsx)(c.TextareaControl,{__nextHasNoMarginBottom:!0,value:d,label:(0,i.__)("Alternative Text","tableberg"),onChange:e=>j({alt:e}),help:(0,i.__)("Describe the image for screen readers.","tableberg")})}),(0,J.jsx)(c.__experimentalToolsPanelItem,{isShownByDefault:!0,label:(0,i.__)("Aspect ratio","tableberg"),onDeselect:()=>j({aspectRatio:""}),hasValue:()=>""!==h,children:(0,J.jsx)(c.SelectControl,{value:h||"",__nextHasNoMarginBottom:!0,options:nn,label:(0,i.__)("Aspect ratio","tableberg"),onChange:e=>j({aspectRatio:e})})}),h&&(0,J.jsx)(c.__experimentalToolsPanelItem,{label:(0,i.__)("Scale","tableberg"),isShownByDefault:!0,hasValue:()=>"cover"!==g,onDeselect:()=>j({scale:"cover"}),children:(0,J.jsx)(c.__experimentalToggleGroupControl,{label:(0,i.__)("Scale","tableberg"),isBlock:!0,help:A[g||"cover"],value:g||"cover",onChange:e=>j({scale:e}),__nextHasNoMarginBottom:!0,children:ln.map(e=>(0,J.jsx)(c.__experimentalToggleGroupControlOption,{value:e.value,label:e.label},e.value))})}),(0,J.jsxs)("div",{style:{display:"flex",gap:"10px",gridColumn:"1 / -1"},children:[(0,J.jsx)(c.__experimentalToolsPanelItem,{isShownByDefault:!0,label:(0,i.__)("Width","tableberg"),hasValue:()=>""!==p&&"150px"!==p,onDeselect:()=>j({width:"150px"}),children:(0,J.jsx)(c.__experimentalUnitControl,{label:(0,i.__)("Width","tableberg"),placeholder:(0,i.__)("Auto","tableberg"),labelPosition:"top",units:[{value:"px",label:"px",default:0}],min:0,value:p,onChange:e=>j({width:e||""})})}),(0,J.jsx)(c.__experimentalToolsPanelItem,{isShownByDefault:!0,label:(0,i.__)("Height","tableberg"),hasValue:()=>""!==b,onDeselect:()=>j({height:""}),children:(0,J.jsx)(c.__experimentalUnitControl,{label:(0,i.__)("Height","tableberg"),placeholder:(0,i.__)("Auto","tableberg"),labelPosition:"top",units:[{value:"px",label:"px",default:0}],min:0,value:b,onChange:e=>j({height:e||""})})})]}),M&&s.sizes&&Object.keys(s.sizes).length>0&&(0,J.jsx)(c.__experimentalToolsPanelItem,{isShownByDefault:!0,label:(0,i.__)("Resolution","tableberg"),hasValue:()=>"large"!==f,onDeselect:()=>j({sizeSlug:"large"}),children:(0,J.jsx)(c.SelectControl,{label:(0,i.__)("Resolution","tableberg"),value:f,options:on.filter(e=>s.sizes?.[e.value]),onChange:e=>j({sizeSlug:e}),help:(0,i.__)("Select the size of the source image.","tableberg")})})]})}),(0,J.jsxs)(me.InspectorControls,{group:"border",children:[(0,J.jsx)(Ce,{value:C,label:(0,i.__)("Border","tableberg"),onChange:e=>j({border:e}),onDeselect:()=>j({border:an.border}),hasValue:()=>!!(C.top||C.right||C.bottom||C.left)}),(0,J.jsx)(we,{label:(0,i.__)("Border Radius","tableberg"),value:w,onChange:e=>j({borderRadius:e}),onDeselect:()=>j({borderRadius:an.borderRadius}),hasValue:()=>!!(w.topLeft||w.topRight||w.bottomLeft||w.bottomRight)})]}),(0,J.jsx)(me.InspectorControls,{children:(0,J.jsx)(qa,{elementType:"image",bindings:t})})]})}const an={media:{},height:"",width:"150px",alt:"",align:"left",aspectRatio:"",scale:"cover",sizeSlug:"large",caption:"",href:"",linkTarget:"_self",lightbox:{enabled:!1},border:{top:"",right:"",bottom:"",left:""},borderRadius:{topLeft:"",topRight:"",bottomLeft:"",bottomRight:""}};function sn({attributes:e,bindings:t,cellCoords:n,elementIndex:l}){const o=(0,u.useRef)(null),r=(0,u.useRef)(null),a=Ha(e=>e.sortPreviewMode),s=Ha(e=>e.isElementSelected),d=Ha(e=>e.setSelectedElement),h=Ha(e=>e.clearSelectedElement),b=Ha(e=>e.updateCellElement),p=Rt(),g=s(n,l),[f,m]=(0,u.useState)(!!e.caption);st({ref:o,onClickOutside:()=>{g&&h()}});const{values:v}=Ga(t),x=Ze(e,an,t,v,(0,i.__)("(No data)","tableberg")),{media:y,height:C,width:w,alt:_,aspectRatio:k,scale:j,sizeSlug:S,caption:P,href:R,linkTarget:B,border:T,borderRadius:I}=x,E=!!y.url||!!y.id,O=y.sizes&&y.sizes[S]?y.sizes[S].url:y.url||"",[M,A]=(0,u.useState)(null);(0,u.useEffect)(()=>{r.current?.complete&&r.current.naturalWidth&&A({width:r.current.naturalWidth,height:r.current.naturalHeight})},[O]);const N=()=>{r.current&&A({width:r.current.naturalWidth,height:r.current.naturalHeight})},D={aspectRatio:k||(M?`${M.width}/${M.height}`:void 0),objectFit:j,width:w||"100%",height:C||"auto",borderTopLeftRadius:I.topLeft,borderTopRightRadius:I.topRight,borderBottomLeftRadius:I.bottomLeft,borderBottomRightRadius:I.bottomRight,borderTop:T.top,borderRight:T.right,borderBottom:T.bottom,borderLeft:T.left,display:"block"},L=()=>{const e=(0,J.jsx)("img",{ref:r,src:O,alt:_||y.alt||"",style:D,onLoad:N});return R&&!g?(0,J.jsx)("a",{href:R,target:B,rel:"_blank"===B?"noopener noreferrer":void 0,onClick:e=>e.preventDefault(),children:e}):e};return(0,J.jsxs)(J.Fragment,{children:[g&&(0,J.jsx)(rn,{attributes:x,bindings:t,showCaption:f,setShowCaption:m,cellCoords:n,elementIndex:l}),(0,J.jsx)("figure",{ref:o,className:"tableberg-image-element",style:{margin:0,lineHeight:1},onClick:e=>{e.stopPropagation(),a||(d(n,l),o.current&&p(o.current,"Image","An image element within a Tableberg cell"))},children:E?(0,J.jsxs)(J.Fragment,{children:[g?(0,J.jsx)(c.ResizableBox,{size:{width:w||"auto",height:C||"auto"},showHandle:g,minWidth:50,minHeight:50,maxWidth:720,enable:{top:!1,right:!0,bottom:!0,left:!1},onResize:(e,t,o)=>{let r=1;const a=k||(M?`${M.width}/${M.height}`:"1/1"),s=a.split("/");2===s.length?r=parseInt(s[0])/parseInt(s[1]):"1"===a&&(r=1);let i=o.offsetWidth,c=o.offsetHeight;"bottom"===t?i=c*r:c=i/r,b(n,l,{attributes:{width:`${Math.round(i)}px`,height:`${Math.round(c)}px`}})},children:L()}):L(),f&&(g||P)&&(0,J.jsx)(me.RichText,{tagName:"figcaption",className:"tableberg-image-caption","aria-label":(0,i.__)("Image caption text","tableberg"),placeholder:(0,i.__)("Add caption","tableberg"),value:P,onChange:e=>b(n,l,{attributes:{caption:e}}),style:{marginTop:"0.5em",marginBottom:"1em",textAlign:"center",fontSize:"0.875em",color:"#666"}})]}):(0,J.jsx)(me.MediaUploadCheck,{children:(0,J.jsx)(me.MediaUpload,{onSelect:e=>{e&&e.url?b(n,l,{attributes:{media:{id:e.id,url:e.url,alt:e.alt||"",title:e.title||"",sizes:e.sizes||{}},alt:e.alt||""}}):b(n,l,{attributes:{media:{}}})},allowedTypes:["image"],value:y.id,render:({open:e})=>(0,J.jsx)(c.Placeholder,{className:"tableberg-image-placeholder",icon:Wt,label:(0,i.__)("Image","tableberg"),instructions:(0,i.__)("Upload an image or pick one from your media library.","tableberg"),children:(0,J.jsx)(c.Button,{variant:"secondary",onClick:e,children:(0,i.__)("Media Library","tableberg")})})})})})]})}const cn=[{path:"media.url",label:(0,i.__)("Image URL","tableberg")},{path:"alt",label:(0,i.__)("Alt Text","tableberg")},{path:"href",label:(0,i.__)("Link URL","tableberg")},{path:"caption",label:(0,i.__)("Caption","tableberg")}];var un=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M4 7.2v1.5h16V7.2H4zm8 8.6h8v-1.5h-8v1.5zm-4-4.6l-4 4 4 4 1-1-3-3 3-3-1-1z"})}),dn=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M4 7.2v1.5h16V7.2H4zm8 8.6h8v-1.5h-8v1.5zm-8-3.5l3 3-3 3 1 1 4-4-4-4-1 1z"})});function hn(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);t&&(l=l.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,l)}return n}function pn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?bn(Object(n),!0).forEach(function(t){hn(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}const gn=()=>{};let fn={},mn={},vn=null,xn={mark:gn,measure:gn};try{"undefined"!=typeof window&&(fn=window),"undefined"!=typeof document&&(mn=document),"undefined"!=typeof MutationObserver&&(vn=MutationObserver),"undefined"!=typeof performance&&(xn=performance)}catch(e){}const{userAgent:yn=""}=fn.navigator||{},Cn=fn,wn=mn,kn=vn,jn=xn,Sn=(Cn.document,!!wn.documentElement&&!!wn.head&&"function"==typeof wn.addEventListener&&"function"==typeof wn.createElement),Pn=~yn.indexOf("MSIE")||~yn.indexOf("Trident/");var Rn={classic:{fa:"solid",fas:"solid","fa-solid":"solid",far:"regular","fa-regular":"regular",fal:"light","fa-light":"light",fat:"thin","fa-thin":"thin",fab:"brands","fa-brands":"brands"},duotone:{fa:"solid",fad:"solid","fa-solid":"solid","fa-duotone":"solid",fadr:"regular","fa-regular":"regular",fadl:"light","fa-light":"light",fadt:"thin","fa-thin":"thin"},sharp:{fa:"solid",fass:"solid","fa-solid":"solid",fasr:"regular","fa-regular":"regular",fasl:"light","fa-light":"light",fast:"thin","fa-thin":"thin"},"sharp-duotone":{fa:"solid",fasds:"solid","fa-solid":"solid",fasdr:"regular","fa-regular":"regular",fasdl:"light","fa-light":"light",fasdt:"thin","fa-thin":"thin"}},Bn=["fa-classic","fa-duotone","fa-sharp","fa-sharp-duotone"],Tn="classic",In="duotone",En=[Tn,In,"sharp","sharp-duotone"],On=new Map([["classic",{defaultShortPrefixId:"fas",defaultStyleId:"solid",styleIds:["solid","regular","light","thin","brands"],futureStyleIds:[],defaultFontWeight:900}],["sharp",{defaultShortPrefixId:"fass",defaultStyleId:"solid",styleIds:["solid","regular","light","thin"],futureStyleIds:[],defaultFontWeight:900}],["duotone",{defaultShortPrefixId:"fad",defaultStyleId:"solid",styleIds:["solid","regular","light","thin"],futureStyleIds:[],defaultFontWeight:900}],["sharp-duotone",{defaultShortPrefixId:"fasds",defaultStyleId:"solid",styleIds:["solid","regular","light","thin"],futureStyleIds:[],defaultFontWeight:900}]]),Mn=["fak","fa-kit","fakd","fa-kit-duotone"],An=["fak","fakd"],Nn={GROUP:"duotone-group",SWAP_OPACITY:"swap-opacity",PRIMARY:"primary",SECONDARY:"secondary"},Dn=["fak","fa-kit","fakd","fa-kit-duotone"],Ln={classic:{fab:"fa-brands",fad:"fa-duotone",fal:"fa-light",far:"fa-regular",fas:"fa-solid",fat:"fa-thin"},duotone:{fadr:"fa-regular",fadl:"fa-light",fadt:"fa-thin"},sharp:{fass:"fa-solid",fasr:"fa-regular",fasl:"fa-light",fast:"fa-thin"},"sharp-duotone":{fasds:"fa-solid",fasdr:"fa-regular",fasdl:"fa-light",fasdt:"fa-thin"}},Fn=["fa","fas","far","fal","fat","fad","fadr","fadl","fadt","fab","fass","fasr","fasl","fast","fasds","fasdr","fasdl","fasdt","fa-classic","fa-duotone","fa-sharp","fa-sharp-duotone","fa-solid","fa-regular","fa-light","fa-thin","fa-duotone","fa-brands"],Vn=[1,2,3,4,5,6,7,8,9,10],Hn=Vn.concat([11,12,13,14,15,16,17,18,19,20]),zn=[...Object.keys({classic:["fas","far","fal","fat","fad"],duotone:["fadr","fadl","fadt"],sharp:["fass","fasr","fasl","fast"],"sharp-duotone":["fasds","fasdr","fasdl","fasdt"]}),"solid","regular","light","thin","duotone","brands","2xs","xs","sm","lg","xl","2xl","beat","border","fade","beat-fade","bounce","flip-both","flip-horizontal","flip-vertical","flip","fw","inverse","layers-counter","layers-text","layers","li","pull-left","pull-right","pulse","rotate-180","rotate-270","rotate-90","rotate-by","shake","spin-pulse","spin-reverse","spin","stack-1x","stack-2x","stack","ul",Nn.GROUP,Nn.SWAP_OPACITY,Nn.PRIMARY,Nn.SECONDARY].concat(Vn.map(e=>"".concat(e,"x"))).concat(Hn.map(e=>"w-".concat(e)));const Zn="___FONT_AWESOME___",Gn=16,qn="svg-inline--fa",$n="data-fa-i2svg",Qn="data-fa-pseudo-element",Un="data-prefix",Wn="data-icon",Kn="fontawesome-i2svg",Yn=["HTML","HEAD","STYLE","SCRIPT"],Jn=(()=>{try{return!0}catch(e){return!1}})();function Xn(e){return new Proxy(e,{get:(e,t)=>t in e?e[t]:e[Tn]})}const el=pn({},Rn);el[Tn]=pn(pn(pn(pn({},{"fa-duotone":"duotone"}),Rn[Tn]),{fak:"kit","fa-kit":"kit"}),{fakd:"kit-duotone","fa-kit-duotone":"kit-duotone"});const tl=Xn(el),nl=pn({},{classic:{solid:"fas",regular:"far",light:"fal",thin:"fat",brands:"fab"},duotone:{solid:"fad",regular:"fadr",light:"fadl",thin:"fadt"},sharp:{solid:"fass",regular:"fasr",light:"fasl",thin:"fast"},"sharp-duotone":{solid:"fasds",regular:"fasdr",light:"fasdl",thin:"fasdt"}});nl[Tn]=pn(pn(pn(pn({},{duotone:"fad"}),nl[Tn]),{kit:"fak"}),{"kit-duotone":"fakd"});const ll=Xn(nl),ol=pn({},Ln);ol[Tn]=pn(pn({},ol[Tn]),{fak:"fa-kit"});const rl=Xn(ol),al=pn({},{classic:{"fa-brands":"fab","fa-duotone":"fad","fa-light":"fal","fa-regular":"far","fa-solid":"fas","fa-thin":"fat"},duotone:{"fa-regular":"fadr","fa-light":"fadl","fa-thin":"fadt"},sharp:{"fa-solid":"fass","fa-regular":"fasr","fa-light":"fasl","fa-thin":"fast"},"sharp-duotone":{"fa-solid":"fasds","fa-regular":"fasdr","fa-light":"fasdl","fa-thin":"fasdt"}});al[Tn]=pn(pn({},al[Tn]),{"fa-kit":"fak"}),Xn(al);const sl=/fa(s|r|l|t|d|dr|dl|dt|b|k|kd|ss|sr|sl|st|sds|sdr|sdl|sdt)?[\-\ ]/,il="fa-layers-text",cl=/Font ?Awesome ?([56 ]*)(Solid|Regular|Light|Thin|Duotone|Brands|Free|Pro|Sharp Duotone|Sharp|Kit)?.*/i,ul=(Xn(pn({},{classic:{900:"fas",400:"far",normal:"far",300:"fal",100:"fat"},duotone:{900:"fad",400:"fadr",300:"fadl",100:"fadt"},sharp:{900:"fass",400:"fasr",300:"fasl",100:"fast"},"sharp-duotone":{900:"fasds",400:"fasdr",300:"fasdl",100:"fasdt"}})),["class","data-prefix","data-icon","data-fa-transform","data-fa-mask"]),dl="duotone-group",hl="primary",bl="secondary",pl=["kit",...zn],gl=Cn.FontAwesomeConfig||{};wn&&"function"==typeof wn.querySelector&&[["data-family-prefix","familyPrefix"],["data-css-prefix","cssPrefix"],["data-family-default","familyDefault"],["data-style-default","styleDefault"],["data-replacement-class","replacementClass"],["data-auto-replace-svg","autoReplaceSvg"],["data-auto-add-css","autoAddCss"],["data-auto-a11y","autoA11y"],["data-search-pseudo-elements","searchPseudoElements"],["data-observe-mutations","observeMutations"],["data-mutate-approach","mutateApproach"],["data-keep-original-source","keepOriginalSource"],["data-measure-performance","measurePerformance"],["data-show-missing-icons","showMissingIcons"]].forEach(e=>{let[t,n]=e;const l=function(e){return""===e||"false"!==e&&("true"===e||e)}(function(e){var t=wn.querySelector("script["+e+"]");if(t)return t.getAttribute(e)}(t));null!=l&&(gl[n]=l)});const fl={styleDefault:"solid",familyDefault:Tn,cssPrefix:"fa",replacementClass:qn,autoReplaceSvg:!0,autoAddCss:!0,autoA11y:!0,searchPseudoElements:!1,observeMutations:!0,mutateApproach:"async",keepOriginalSource:!0,measurePerformance:!1,showMissingIcons:!0};gl.familyPrefix&&(gl.cssPrefix=gl.familyPrefix);const ml=pn(pn({},fl),gl);ml.autoReplaceSvg||(ml.observeMutations=!1);const vl={};Object.keys(fl).forEach(e=>{Object.defineProperty(vl,e,{enumerable:!0,set:function(t){ml[e]=t,xl.forEach(e=>e(vl))},get:function(){return ml[e]}})}),Object.defineProperty(vl,"familyPrefix",{enumerable:!0,set:function(e){ml.cssPrefix=e,xl.forEach(e=>e(vl))},get:function(){return ml.cssPrefix}}),Cn.FontAwesomeConfig=vl;const xl=[],yl=Gn,Cl={size:16,x:0,y:0,rotate:0,flipX:!1,flipY:!1};function wl(){let e=12,t="";for(;e-- >0;)t+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[62*Math.random()|0];return t}function _l(e){const t=[];for(let n=(e||[]).length>>>0;n--;)t[n]=e[n];return t}function kl(e){return e.classList?_l(e.classList):(e.getAttribute("class")||"").split(" ").filter(e=>e)}function jl(e){return"".concat(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Sl(e){return Object.keys(e||{}).reduce((t,n)=>t+"".concat(n,": ").concat(e[n].trim(),";"),"")}function Pl(e){return e.size!==Cl.size||e.x!==Cl.x||e.y!==Cl.y||e.rotate!==Cl.rotate||e.flipX||e.flipY}function Rl(){const e="fa",t=qn,n=vl.cssPrefix,l=vl.replacementClass;let o=':root, :host {\n --fa-font-solid: normal 900 1em/1 "Font Awesome 6 Free";\n --fa-font-regular: normal 400 1em/1 "Font Awesome 6 Free";\n --fa-font-light: normal 300 1em/1 "Font Awesome 6 Pro";\n --fa-font-thin: normal 100 1em/1 "Font Awesome 6 Pro";\n --fa-font-duotone: normal 900 1em/1 "Font Awesome 6 Duotone";\n --fa-font-duotone-regular: normal 400 1em/1 "Font Awesome 6 Duotone";\n --fa-font-duotone-light: normal 300 1em/1 "Font Awesome 6 Duotone";\n --fa-font-duotone-thin: normal 100 1em/1 "Font Awesome 6 Duotone";\n --fa-font-brands: normal 400 1em/1 "Font Awesome 6 Brands";\n --fa-font-sharp-solid: normal 900 1em/1 "Font Awesome 6 Sharp";\n --fa-font-sharp-regular: normal 400 1em/1 "Font Awesome 6 Sharp";\n --fa-font-sharp-light: normal 300 1em/1 "Font Awesome 6 Sharp";\n --fa-font-sharp-thin: normal 100 1em/1 "Font Awesome 6 Sharp";\n --fa-font-sharp-duotone-solid: normal 900 1em/1 "Font Awesome 6 Sharp Duotone";\n --fa-font-sharp-duotone-regular: normal 400 1em/1 "Font Awesome 6 Sharp Duotone";\n --fa-font-sharp-duotone-light: normal 300 1em/1 "Font Awesome 6 Sharp Duotone";\n --fa-font-sharp-duotone-thin: normal 100 1em/1 "Font Awesome 6 Sharp Duotone";\n}\n\nsvg:not(:root).svg-inline--fa, svg:not(:host).svg-inline--fa {\n overflow: visible;\n box-sizing: content-box;\n}\n\n.svg-inline--fa {\n display: var(--fa-display, inline-block);\n height: 1em;\n overflow: visible;\n vertical-align: -0.125em;\n}\n.svg-inline--fa.fa-2xs {\n vertical-align: 0.1em;\n}\n.svg-inline--fa.fa-xs {\n vertical-align: 0em;\n}\n.svg-inline--fa.fa-sm {\n vertical-align: -0.0714285705em;\n}\n.svg-inline--fa.fa-lg {\n vertical-align: -0.2em;\n}\n.svg-inline--fa.fa-xl {\n vertical-align: -0.25em;\n}\n.svg-inline--fa.fa-2xl {\n vertical-align: -0.3125em;\n}\n.svg-inline--fa.fa-pull-left {\n margin-right: var(--fa-pull-margin, 0.3em);\n width: auto;\n}\n.svg-inline--fa.fa-pull-right {\n margin-left: var(--fa-pull-margin, 0.3em);\n width: auto;\n}\n.svg-inline--fa.fa-li {\n width: var(--fa-li-width, 2em);\n top: 0.25em;\n}\n.svg-inline--fa.fa-fw {\n width: var(--fa-fw-width, 1.25em);\n}\n\n.fa-layers svg.svg-inline--fa {\n bottom: 0;\n left: 0;\n margin: auto;\n position: absolute;\n right: 0;\n top: 0;\n}\n\n.fa-layers-counter, .fa-layers-text {\n display: inline-block;\n position: absolute;\n text-align: center;\n}\n\n.fa-layers {\n display: inline-block;\n height: 1em;\n position: relative;\n text-align: center;\n vertical-align: -0.125em;\n width: 1em;\n}\n.fa-layers svg.svg-inline--fa {\n transform-origin: center center;\n}\n\n.fa-layers-text {\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n transform-origin: center center;\n}\n\n.fa-layers-counter {\n background-color: var(--fa-counter-background-color, #ff253a);\n border-radius: var(--fa-counter-border-radius, 1em);\n box-sizing: border-box;\n color: var(--fa-inverse, #fff);\n line-height: var(--fa-counter-line-height, 1);\n max-width: var(--fa-counter-max-width, 5em);\n min-width: var(--fa-counter-min-width, 1.5em);\n overflow: hidden;\n padding: var(--fa-counter-padding, 0.25em 0.5em);\n right: var(--fa-right, 0);\n text-overflow: ellipsis;\n top: var(--fa-top, 0);\n transform: scale(var(--fa-counter-scale, 0.25));\n transform-origin: top right;\n}\n\n.fa-layers-bottom-right {\n bottom: var(--fa-bottom, 0);\n right: var(--fa-right, 0);\n top: auto;\n transform: scale(var(--fa-layers-scale, 0.25));\n transform-origin: bottom right;\n}\n\n.fa-layers-bottom-left {\n bottom: var(--fa-bottom, 0);\n left: var(--fa-left, 0);\n right: auto;\n top: auto;\n transform: scale(var(--fa-layers-scale, 0.25));\n transform-origin: bottom left;\n}\n\n.fa-layers-top-right {\n top: var(--fa-top, 0);\n right: var(--fa-right, 0);\n transform: scale(var(--fa-layers-scale, 0.25));\n transform-origin: top right;\n}\n\n.fa-layers-top-left {\n left: var(--fa-left, 0);\n right: auto;\n top: var(--fa-top, 0);\n transform: scale(var(--fa-layers-scale, 0.25));\n transform-origin: top left;\n}\n\n.fa-1x {\n font-size: 1em;\n}\n\n.fa-2x {\n font-size: 2em;\n}\n\n.fa-3x {\n font-size: 3em;\n}\n\n.fa-4x {\n font-size: 4em;\n}\n\n.fa-5x {\n font-size: 5em;\n}\n\n.fa-6x {\n font-size: 6em;\n}\n\n.fa-7x {\n font-size: 7em;\n}\n\n.fa-8x {\n font-size: 8em;\n}\n\n.fa-9x {\n font-size: 9em;\n}\n\n.fa-10x {\n font-size: 10em;\n}\n\n.fa-2xs {\n font-size: 0.625em;\n line-height: 0.1em;\n vertical-align: 0.225em;\n}\n\n.fa-xs {\n font-size: 0.75em;\n line-height: 0.0833333337em;\n vertical-align: 0.125em;\n}\n\n.fa-sm {\n font-size: 0.875em;\n line-height: 0.0714285718em;\n vertical-align: 0.0535714295em;\n}\n\n.fa-lg {\n font-size: 1.25em;\n line-height: 0.05em;\n vertical-align: -0.075em;\n}\n\n.fa-xl {\n font-size: 1.5em;\n line-height: 0.0416666682em;\n vertical-align: -0.125em;\n}\n\n.fa-2xl {\n font-size: 2em;\n line-height: 0.03125em;\n vertical-align: -0.1875em;\n}\n\n.fa-fw {\n text-align: center;\n width: 1.25em;\n}\n\n.fa-ul {\n list-style-type: none;\n margin-left: var(--fa-li-margin, 2.5em);\n padding-left: 0;\n}\n.fa-ul > li {\n position: relative;\n}\n\n.fa-li {\n left: calc(-1 * var(--fa-li-width, 2em));\n position: absolute;\n text-align: center;\n width: var(--fa-li-width, 2em);\n line-height: inherit;\n}\n\n.fa-border {\n border-color: var(--fa-border-color, #eee);\n border-radius: var(--fa-border-radius, 0.1em);\n border-style: var(--fa-border-style, solid);\n border-width: var(--fa-border-width, 0.08em);\n padding: var(--fa-border-padding, 0.2em 0.25em 0.15em);\n}\n\n.fa-pull-left {\n float: left;\n margin-right: var(--fa-pull-margin, 0.3em);\n}\n\n.fa-pull-right {\n float: right;\n margin-left: var(--fa-pull-margin, 0.3em);\n}\n\n.fa-beat {\n animation-name: fa-beat;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, ease-in-out);\n}\n\n.fa-bounce {\n animation-name: fa-bounce;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.28, 0.84, 0.42, 1));\n}\n\n.fa-fade {\n animation-name: fa-fade;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1));\n}\n\n.fa-beat-fade {\n animation-name: fa-beat-fade;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1));\n}\n\n.fa-flip {\n animation-name: fa-flip;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, ease-in-out);\n}\n\n.fa-shake {\n animation-name: fa-shake;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, linear);\n}\n\n.fa-spin {\n animation-name: fa-spin;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 2s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, linear);\n}\n\n.fa-spin-reverse {\n --fa-animation-direction: reverse;\n}\n\n.fa-pulse,\n.fa-spin-pulse {\n animation-name: fa-spin;\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, steps(8));\n}\n\n@media (prefers-reduced-motion: reduce) {\n .fa-beat,\n.fa-bounce,\n.fa-fade,\n.fa-beat-fade,\n.fa-flip,\n.fa-pulse,\n.fa-shake,\n.fa-spin,\n.fa-spin-pulse {\n animation-delay: -1ms;\n animation-duration: 1ms;\n animation-iteration-count: 1;\n transition-delay: 0s;\n transition-duration: 0s;\n }\n}\n@keyframes fa-beat {\n 0%, 90% {\n transform: scale(1);\n }\n 45% {\n transform: scale(var(--fa-beat-scale, 1.25));\n }\n}\n@keyframes fa-bounce {\n 0% {\n transform: scale(1, 1) translateY(0);\n }\n 10% {\n transform: scale(var(--fa-bounce-start-scale-x, 1.1), var(--fa-bounce-start-scale-y, 0.9)) translateY(0);\n }\n 30% {\n transform: scale(var(--fa-bounce-jump-scale-x, 0.9), var(--fa-bounce-jump-scale-y, 1.1)) translateY(var(--fa-bounce-height, -0.5em));\n }\n 50% {\n transform: scale(var(--fa-bounce-land-scale-x, 1.05), var(--fa-bounce-land-scale-y, 0.95)) translateY(0);\n }\n 57% {\n transform: scale(1, 1) translateY(var(--fa-bounce-rebound, -0.125em));\n }\n 64% {\n transform: scale(1, 1) translateY(0);\n }\n 100% {\n transform: scale(1, 1) translateY(0);\n }\n}\n@keyframes fa-fade {\n 50% {\n opacity: var(--fa-fade-opacity, 0.4);\n }\n}\n@keyframes fa-beat-fade {\n 0%, 100% {\n opacity: var(--fa-beat-fade-opacity, 0.4);\n transform: scale(1);\n }\n 50% {\n opacity: 1;\n transform: scale(var(--fa-beat-fade-scale, 1.125));\n }\n}\n@keyframes fa-flip {\n 50% {\n transform: rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), var(--fa-flip-angle, -180deg));\n }\n}\n@keyframes fa-shake {\n 0% {\n transform: rotate(-15deg);\n }\n 4% {\n transform: rotate(15deg);\n }\n 8%, 24% {\n transform: rotate(-18deg);\n }\n 12%, 28% {\n transform: rotate(18deg);\n }\n 16% {\n transform: rotate(-22deg);\n }\n 20% {\n transform: rotate(22deg);\n }\n 32% {\n transform: rotate(-12deg);\n }\n 36% {\n transform: rotate(12deg);\n }\n 40%, 100% {\n transform: rotate(0deg);\n }\n}\n@keyframes fa-spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n.fa-rotate-90 {\n transform: rotate(90deg);\n}\n\n.fa-rotate-180 {\n transform: rotate(180deg);\n}\n\n.fa-rotate-270 {\n transform: rotate(270deg);\n}\n\n.fa-flip-horizontal {\n transform: scale(-1, 1);\n}\n\n.fa-flip-vertical {\n transform: scale(1, -1);\n}\n\n.fa-flip-both,\n.fa-flip-horizontal.fa-flip-vertical {\n transform: scale(-1, -1);\n}\n\n.fa-rotate-by {\n transform: rotate(var(--fa-rotate-angle, 0));\n}\n\n.fa-stack {\n display: inline-block;\n vertical-align: middle;\n height: 2em;\n position: relative;\n width: 2.5em;\n}\n\n.fa-stack-1x,\n.fa-stack-2x {\n bottom: 0;\n left: 0;\n margin: auto;\n position: absolute;\n right: 0;\n top: 0;\n z-index: var(--fa-stack-z-index, auto);\n}\n\n.svg-inline--fa.fa-stack-1x {\n height: 1em;\n width: 1.25em;\n}\n.svg-inline--fa.fa-stack-2x {\n height: 2em;\n width: 2.5em;\n}\n\n.fa-inverse {\n color: var(--fa-inverse, #fff);\n}\n\n.sr-only,\n.fa-sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n}\n\n.sr-only-focusable:not(:focus),\n.fa-sr-only-focusable:not(:focus) {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n}\n\n.svg-inline--fa .fa-primary {\n fill: var(--fa-primary-color, currentColor);\n opacity: var(--fa-primary-opacity, 1);\n}\n\n.svg-inline--fa .fa-secondary {\n fill: var(--fa-secondary-color, currentColor);\n opacity: var(--fa-secondary-opacity, 0.4);\n}\n\n.svg-inline--fa.fa-swap-opacity .fa-primary {\n opacity: var(--fa-secondary-opacity, 0.4);\n}\n\n.svg-inline--fa.fa-swap-opacity .fa-secondary {\n opacity: var(--fa-primary-opacity, 1);\n}\n\n.svg-inline--fa mask .fa-primary,\n.svg-inline--fa mask .fa-secondary {\n fill: black;\n}';if(n!==e||l!==t){const r=new RegExp("\\.".concat(e,"\\-"),"g"),a=new RegExp("\\--".concat(e,"\\-"),"g"),s=new RegExp("\\.".concat(t),"g");o=o.replace(r,".".concat(n,"-")).replace(a,"--".concat(n,"-")).replace(s,".".concat(l))}return o}let Bl=!1;function Tl(){vl.autoAddCss&&!Bl&&(function(e){if(!e||!Sn)return;const t=wn.createElement("style");t.setAttribute("type","text/css"),t.innerHTML=e;const n=wn.head.childNodes;let l=null;for(let e=n.length-1;e>-1;e--){const t=n[e],o=(t.tagName||"").toUpperCase();["STYLE","LINK"].indexOf(o)>-1&&(l=t)}wn.head.insertBefore(t,l)}(Rl()),Bl=!0)}var Il={mixout:()=>({dom:{css:Rl,insertCss:Tl}}),hooks:()=>({beforeDOMElementCreation(){Tl()},beforeI2svg(){Tl()}})};const El=Cn||{};El[Zn]||(El[Zn]={}),El[Zn].styles||(El[Zn].styles={}),El[Zn].hooks||(El[Zn].hooks={}),El[Zn].shims||(El[Zn].shims=[]);var Ol=El[Zn];const Ml=[],Al=function(){wn.removeEventListener("DOMContentLoaded",Al),Nl=1,Ml.map(e=>e())};let Nl=!1;function Dl(e){const{tag:t,attributes:n={},children:l=[]}=e;return"string"==typeof e?jl(e):"<".concat(t," ").concat(function(e){return Object.keys(e||{}).reduce((t,n)=>t+"".concat(n,'="').concat(jl(e[n]),'" '),"").trim()}(n),">").concat(l.map(Dl).join(""),"</").concat(t,">")}function Ll(e,t,n){if(e&&e[t]&&e[t][n])return{prefix:t,iconName:n,icon:e[t][n]}}Sn&&(Nl=(wn.documentElement.doScroll?/^loaded|^c/:/^loaded|^i|^c/).test(wn.readyState),Nl||wn.addEventListener("DOMContentLoaded",Al));var Fl=function(e,t,n,l){var o,r,a,s=Object.keys(e),i=s.length,c=void 0!==l?function(e,t){return function(n,l,o,r){return e.call(t,n,l,o,r)}}(t,l):t;for(void 0===n?(o=1,a=e[s[0]]):(o=0,a=n);o<i;o++)a=c(a,e[r=s[o]],r,e);return a};function Vl(e){const t=function(e){const t=[];let n=0;const l=e.length;for(;n<l;){const o=e.charCodeAt(n++);if(o>=55296&&o<=56319&&n<l){const l=e.charCodeAt(n++);56320==(64512&l)?t.push(((1023&o)<<10)+(1023&l)+65536):(t.push(o),n--)}else t.push(o)}return t}(e);return 1===t.length?t[0].toString(16):null}function Hl(e){return Object.keys(e).reduce((t,n)=>{const l=e[n];return l.icon?t[l.iconName]=l.icon:t[n]=l,t},{})}function zl(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{skipHooks:l=!1}=n,o=Hl(t);"function"!=typeof Ol.hooks.addPack||l?Ol.styles[e]=pn(pn({},Ol.styles[e]||{}),o):Ol.hooks.addPack(e,Hl(t)),"fas"===e&&zl("fa",t)}const{styles:Zl,shims:Gl}=Ol,ql=Object.keys(rl),$l=ql.reduce((e,t)=>(e[t]=Object.keys(rl[t]),e),{});let Ql=null,Ul={},Wl={},Kl={},Yl={},Jl={};const Xl=()=>{const e=e=>Fl(Zl,(t,n,l)=>(t[l]=Fl(n,e,{}),t),{});Ul=e((e,t,n)=>(t[3]&&(e[t[3]]=n),t[2]&&t[2].filter(e=>"number"==typeof e).forEach(t=>{e[t.toString(16)]=n}),e)),Wl=e((e,t,n)=>(e[n]=n,t[2]&&t[2].filter(e=>"string"==typeof e).forEach(t=>{e[t]=n}),e)),Jl=e((e,t,n)=>{const l=t[2];return e[n]=n,l.forEach(t=>{e[t]=n}),e});const t="far"in Zl||vl.autoFetchSvg,n=Fl(Gl,(e,n)=>{const l=n[0];let o=n[1];const r=n[2];return"far"!==o||t||(o="fas"),"string"==typeof l&&(e.names[l]={prefix:o,iconName:r}),"number"==typeof l&&(e.unicodes[l.toString(16)]={prefix:o,iconName:r}),e},{names:{},unicodes:{}});Kl=n.names,Yl=n.unicodes,Ql=ro(vl.styleDefault,{family:vl.familyDefault})};var eo;function to(e,t){return(Ul[e]||{})[t]}function no(e,t){return(Jl[e]||{})[t]}function lo(e){return Kl[e]||{prefix:null,iconName:null}}function oo(){return Ql}function ro(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{family:n=Tn}=t,l=tl[n][e];if(n===In&&!e)return"fad";const o=ll[n][e]||ll[n][l],r=e in Ol.styles?e:null;return o||r||null}function ao(e){return e.sort().filter((e,t,n)=>n.indexOf(e)===t)}function so(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{skipLookups:n=!1}=t;let l=null;const o=Fn.concat(Dn),r=ao(e.filter(e=>o.includes(e))),a=ao(e.filter(e=>!Fn.includes(e))),s=r.filter(e=>(l=e,!Bn.includes(e))),[i=null]=s,c=function(e){let t=Tn;const n=ql.reduce((e,t)=>(e[t]="".concat(vl.cssPrefix,"-").concat(t),e),{});return En.forEach(l=>{(e.includes(n[l])||e.some(e=>$l[l].includes(e)))&&(t=l)}),t}(r),u=pn(pn({},function(e){let t=[],n=null;return e.forEach(e=>{const l=function(e,t){const n=t.split("-"),l=n[0],o=n.slice(1).join("-");return l!==e||""===o||(r=o,~pl.indexOf(r))?null:o;var r}(vl.cssPrefix,e);l?n=l:e&&t.push(e)}),{iconName:n,rest:t}}(a)),{},{prefix:ro(i,{family:c})});return pn(pn(pn({},u),function(e){const{values:t,family:n,canonical:l,givenPrefix:o="",styles:r={},config:a={}}=e,s=n===In,i=t.includes("fa-duotone")||t.includes("fad"),c="duotone"===a.familyDefault,u="fad"===l.prefix||"fa-duotone"===l.prefix;if(!s&&(i||c||u)&&(l.prefix="fad"),(t.includes("fa-brands")||t.includes("fab"))&&(l.prefix="fab"),!l.prefix&&io.includes(n)&&(Object.keys(r).find(e=>co.includes(e))||a.autoFetchSvg)){const e=On.get(n).defaultShortPrefixId;l.prefix=e,l.iconName=no(l.prefix,l.iconName)||l.iconName}return"fa"!==l.prefix&&"fa"!==o||(l.prefix=oo()||"fas"),l}({values:e,family:c,styles:Zl,config:vl,canonical:u,givenPrefix:l})),function(e,t,n){let{prefix:l,iconName:o}=n;if(e||!l||!o)return{prefix:l,iconName:o};const r="fa"===t?lo(o):{},a=no(l,o);return o=r.iconName||a||o,l=r.prefix||l,"far"!==l||Zl.far||!Zl.fas||vl.autoFetchSvg||(l="fas"),{prefix:l,iconName:o}}(n,l,u))}eo=e=>{Ql=ro(e.styleDefault,{family:vl.familyDefault})},xl.push(eo),Xl();const io=En.filter(e=>e!==Tn||e!==In),co=Object.keys(Ln).filter(e=>e!==Tn).map(e=>Object.keys(Ln[e])).flat();let uo=[],ho={};const bo={},po=Object.keys(bo);function go(e,t){for(var n=arguments.length,l=new Array(n>2?n-2:0),o=2;o<n;o++)l[o-2]=arguments[o];return(ho[e]||[]).forEach(e=>{t=e.apply(null,[t,...l])}),t}function fo(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),l=1;l<t;l++)n[l-1]=arguments[l];(ho[e]||[]).forEach(e=>{e.apply(null,n)})}function mo(){const e=arguments[0],t=Array.prototype.slice.call(arguments,1);return bo[e]?bo[e].apply(null,t):void 0}function vo(e){"fa"===e.prefix&&(e.prefix="fas");let{iconName:t}=e;const n=e.prefix||oo();if(t)return t=no(n,t)||t,Ll(xo.definitions,n,t)||Ll(Ol.styles,n,t)}const xo=new class{constructor(){this.definitions={}}add(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];const l=t.reduce(this._pullDefinitions,{});Object.keys(l).forEach(e=>{this.definitions[e]=pn(pn({},this.definitions[e]||{}),l[e]),zl(e,l[e]);const t=rl[Tn][e];t&&zl(t,l[e]),Xl()})}reset(){this.definitions={}}_pullDefinitions(e,t){const n=t.prefix&&t.iconName&&t.icon?{0:t}:t;return Object.keys(n).map(t=>{const{prefix:l,iconName:o,icon:r}=n[t],a=r[2];e[l]||(e[l]={}),a.length>0&&a.forEach(t=>{"string"==typeof t&&(e[l][t]=r)}),e[l][o]=r}),e}},yo={i2svg:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Sn?(fo("beforeI2svg",e),mo("pseudoElements2svg",e),mo("i2svg",e)):Promise.reject(new Error("Operation requires a DOM of some kind."))},watch:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{autoReplaceSvgRoot:t}=e;var n;!1===vl.autoReplaceSvg&&(vl.autoReplaceSvg=!0),vl.observeMutations=!0,n=()=>{_o({autoReplaceSvgRoot:t}),fo("watch",e)},Sn&&(Nl?setTimeout(n,0):Ml.push(n))}},Co={icon:e=>{if(null===e)return null;if("object"==typeof e&&e.prefix&&e.iconName)return{prefix:e.prefix,iconName:no(e.prefix,e.iconName)||e.iconName};if(Array.isArray(e)&&2===e.length){const t=0===e[1].indexOf("fa-")?e[1].slice(3):e[1],n=ro(e[0]);return{prefix:n,iconName:no(n,t)||t}}if("string"==typeof e&&(e.indexOf("".concat(vl.cssPrefix,"-"))>-1||e.match(sl))){const t=so(e.split(" "),{skipLookups:!0});return{prefix:t.prefix||oo(),iconName:no(t.prefix,t.iconName)||t.iconName}}if("string"==typeof e){const t=oo();return{prefix:t,iconName:no(t,e)||e}}}},wo={noAuto:()=>{vl.autoReplaceSvg=!1,vl.observeMutations=!1,fo("noAuto")},config:vl,dom:yo,parse:Co,library:xo,findIconDefinition:vo,toHtml:Dl},_o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{autoReplaceSvgRoot:t=wn}=e;(Object.keys(Ol.styles).length>0||vl.autoFetchSvg)&&Sn&&vl.autoReplaceSvg&&wo.dom.i2svg({node:t})};function ko(e,t){return Object.defineProperty(e,"abstract",{get:t}),Object.defineProperty(e,"html",{get:function(){return e.abstract.map(e=>Dl(e))}}),Object.defineProperty(e,"node",{get:function(){if(!Sn)return;const t=wn.createElement("div");return t.innerHTML=e.html,t.children}}),e}function jo(e){const{icons:{main:t,mask:n},prefix:l,iconName:o,transform:r,symbol:a,title:s,maskId:i,titleId:c,extra:u,watchable:d=!1}=e,{width:h,height:b}=n.found?n:t,p=An.includes(l),g=[vl.replacementClass,o?"".concat(vl.cssPrefix,"-").concat(o):""].filter(e=>-1===u.classes.indexOf(e)).filter(e=>""!==e||!!e).concat(u.classes).join(" ");let f={children:[],attributes:pn(pn({},u.attributes),{},{"data-prefix":l,"data-icon":o,class:g,role:u.attributes.role||"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 ".concat(h," ").concat(b)})};const m=p&&!~u.classes.indexOf("fa-fw")?{width:"".concat(h/b*16*.0625,"em")}:{};d&&(f.attributes[$n]=""),s&&(f.children.push({tag:"title",attributes:{id:f.attributes["aria-labelledby"]||"title-".concat(c||wl())},children:[s]}),delete f.attributes.title);const v=pn(pn({},f),{},{prefix:l,iconName:o,main:t,mask:n,maskId:i,transform:r,symbol:a,styles:pn(pn({},m),u.styles)}),{children:x,attributes:y}=n.found&&t.found?mo("generateAbstractMask",v)||{children:[],attributes:{}}:mo("generateAbstractIcon",v)||{children:[],attributes:{}};return v.children=x,v.attributes=y,a?function(e){let{prefix:t,iconName:n,children:l,attributes:o,symbol:r}=e;const a=!0===r?"".concat(t,"-").concat(vl.cssPrefix,"-").concat(n):r;return[{tag:"svg",attributes:{style:"display: none;"},children:[{tag:"symbol",attributes:pn(pn({},o),{},{id:a}),children:l}]}]}(v):function(e){let{children:t,main:n,mask:l,attributes:o,styles:r,transform:a}=e;if(Pl(a)&&n.found&&!l.found){const{width:e,height:t}=n,l={x:e/t/2,y:.5};o.style=Sl(pn(pn({},r),{},{"transform-origin":"".concat(l.x+a.x/16,"em ").concat(l.y+a.y/16,"em")}))}return[{tag:"svg",attributes:o,children:t}]}(v)}function So(e){const{content:t,width:n,height:l,transform:o,title:r,extra:a,watchable:s=!1}=e,i=pn(pn(pn({},a.attributes),r?{title:r}:{}),{},{class:a.classes.join(" ")});s&&(i[$n]="");const c=pn({},a.styles);Pl(o)&&(c.transform=function(e){let{transform:t,width:n=Gn,height:l=Gn,startCentered:o=!1}=e,r="";return r+=o&&Pn?"translate(".concat(t.x/yl-n/2,"em, ").concat(t.y/yl-l/2,"em) "):o?"translate(calc(-50% + ".concat(t.x/yl,"em), calc(-50% + ").concat(t.y/yl,"em)) "):"translate(".concat(t.x/yl,"em, ").concat(t.y/yl,"em) "),r+="scale(".concat(t.size/yl*(t.flipX?-1:1),", ").concat(t.size/yl*(t.flipY?-1:1),") "),r+="rotate(".concat(t.rotate,"deg) "),r}({transform:o,startCentered:!0,width:n,height:l}),c["-webkit-transform"]=c.transform);const u=Sl(c);u.length>0&&(i.style=u);const d=[];return d.push({tag:"span",attributes:i,children:[t]}),r&&d.push({tag:"span",attributes:{class:"sr-only"},children:[r]}),d}const{styles:Po}=Ol;function Ro(e){const t=e[0],n=e[1],[l]=e.slice(4);let o=null;return o=Array.isArray(l)?{tag:"g",attributes:{class:"".concat(vl.cssPrefix,"-").concat(dl)},children:[{tag:"path",attributes:{class:"".concat(vl.cssPrefix,"-").concat(bl),fill:"currentColor",d:l[0]}},{tag:"path",attributes:{class:"".concat(vl.cssPrefix,"-").concat(hl),fill:"currentColor",d:l[1]}}]}:{tag:"path",attributes:{fill:"currentColor",d:l}},{found:!0,width:t,height:n,icon:o}}const Bo={found:!1,width:512,height:512};function To(e,t){let n=t;return"fa"===t&&null!==vl.styleDefault&&(t=oo()),new Promise((l,o)=>{if("fa"===n){const n=lo(e)||{};e=n.iconName||e,t=n.prefix||t}if(e&&t&&Po[t]&&Po[t][e])return l(Ro(Po[t][e]));!function(e,t){Jn||vl.showMissingIcons||!e||console.error('Icon with name "'.concat(e,'" and prefix "').concat(t,'" is missing.'))}(e,t),l(pn(pn({},Bo),{},{icon:vl.showMissingIcons&&e&&mo("missingIconAbstract")||{}}))})}const Io=()=>{},Eo=vl.measurePerformance&&jn&&jn.mark&&jn.measure?jn:{mark:Io,measure:Io},Oo='FA "6.7.2"';var Mo=e=>(Eo.mark("".concat(Oo," ").concat(e," begins")),()=>(e=>{Eo.mark("".concat(Oo," ").concat(e," ends")),Eo.measure("".concat(Oo," ").concat(e),"".concat(Oo," ").concat(e," begins"),"".concat(Oo," ").concat(e," ends"))})(e));const Ao=()=>{};function No(e){return"string"==typeof(e.getAttribute?e.getAttribute($n):null)}function Do(e){return wn.createElementNS("http://www.w3.org/2000/svg",e)}function Lo(e){return wn.createElement(e)}function Fo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{ceFn:n=("svg"===e.tag?Do:Lo)}=t;if("string"==typeof e)return wn.createTextNode(e);const l=n(e.tag);return Object.keys(e.attributes||[]).forEach(function(t){l.setAttribute(t,e.attributes[t])}),(e.children||[]).forEach(function(e){l.appendChild(Fo(e,{ceFn:n}))}),l}const Vo={replace:function(e){const t=e[0];if(t.parentNode)if(e[1].forEach(e=>{t.parentNode.insertBefore(Fo(e),t)}),null===t.getAttribute($n)&&vl.keepOriginalSource){let e=wn.createComment(function(e){let t=" ".concat(e.outerHTML," ");return t="".concat(t,"Font Awesome fontawesome.com "),t}(t));t.parentNode.replaceChild(e,t)}else t.remove()},nest:function(e){const t=e[0],n=e[1];if(~kl(t).indexOf(vl.replacementClass))return Vo.replace(e);const l=new RegExp("".concat(vl.cssPrefix,"-.*"));if(delete n[0].attributes.id,n[0].attributes.class){const e=n[0].attributes.class.split(" ").reduce((e,t)=>(t===vl.replacementClass||t.match(l)?e.toSvg.push(t):e.toNode.push(t),e),{toNode:[],toSvg:[]});n[0].attributes.class=e.toSvg.join(" "),0===e.toNode.length?t.removeAttribute("class"):t.setAttribute("class",e.toNode.join(" "))}const o=n.map(e=>Dl(e)).join("\n");t.setAttribute($n,""),t.innerHTML=o}};function Ho(e){e()}function zo(e,t){const n="function"==typeof t?t:Ao;if(0===e.length)n();else{let t=Ho;"async"===vl.mutateApproach&&(t=Cn.requestAnimationFrame||Ho),t(()=>{const t=!0===vl.autoReplaceSvg?Vo.replace:Vo[vl.autoReplaceSvg]||Vo.replace,l=Mo("mutate");e.map(t),l(),n()})}}let Zo=!1;function Go(){Zo=!0}function qo(){Zo=!1}let $o=null;function Qo(e){if(!kn)return;if(!vl.observeMutations)return;const{treeCallback:t=Ao,nodeCallback:n=Ao,pseudoElementsCallback:l=Ao,observeMutationsRoot:o=wn}=e;$o=new kn(e=>{if(Zo)return;const o=oo();_l(e).forEach(e=>{if("childList"===e.type&&e.addedNodes.length>0&&!No(e.addedNodes[0])&&(vl.searchPseudoElements&&l(e.target),t(e.target)),"attributes"===e.type&&e.target.parentNode&&vl.searchPseudoElements&&l(e.target.parentNode),"attributes"===e.type&&No(e.target)&&~ul.indexOf(e.attributeName))if("class"===e.attributeName&&function(e){const t=e.getAttribute?e.getAttribute(Un):null,n=e.getAttribute?e.getAttribute(Wn):null;return t&&n}(e.target)){const{prefix:t,iconName:n}=so(kl(e.target));e.target.setAttribute(Un,t||o),n&&e.target.setAttribute(Wn,n)}else(r=e.target)&&r.classList&&r.classList.contains&&r.classList.contains(vl.replacementClass)&&n(e.target);var r})}),Sn&&$o.observe(o,{childList:!0,attributes:!0,characterData:!0,subtree:!0})}function Uo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{styleParser:!0};const{iconName:n,prefix:l,rest:o}=function(e){const t=e.getAttribute("data-prefix"),n=e.getAttribute("data-icon"),l=void 0!==e.innerText?e.innerText.trim():"";let o=so(kl(e));return o.prefix||(o.prefix=oo()),t&&n&&(o.prefix=t,o.iconName=n),o.iconName&&o.prefix||(o.prefix&&l.length>0&&(o.iconName=(r=o.prefix,a=e.innerText,(Wl[r]||{})[a]||to(o.prefix,Vl(e.innerText)))),!o.iconName&&vl.autoFetchSvg&&e.firstChild&&e.firstChild.nodeType===Node.TEXT_NODE&&(o.iconName=e.firstChild.data)),o;var r,a}(e),r=function(e){const t=_l(e.attributes).reduce((e,t)=>("class"!==e.name&&"style"!==e.name&&(e[t.name]=t.value),e),{}),n=e.getAttribute("title"),l=e.getAttribute("data-fa-title-id");return vl.autoA11y&&(n?t["aria-labelledby"]="".concat(vl.replacementClass,"-title-").concat(l||wl()):(t["aria-hidden"]="true",t.focusable="false")),t}(e),a=go("parseNodeAttributes",{},e);let s=t.styleParser?function(e){const t=e.getAttribute("style");let n=[];return t&&(n=t.split(";").reduce((e,t)=>{const n=t.split(":"),l=n[0],o=n.slice(1);return l&&o.length>0&&(e[l]=o.join(":").trim()),e},{})),n}(e):[];return pn({iconName:n,title:e.getAttribute("title"),titleId:e.getAttribute("data-fa-title-id"),prefix:l,transform:Cl,mask:{iconName:null,prefix:null,rest:[]},maskId:null,symbol:!1,extra:{classes:o,styles:s,attributes:r}},a)}const{styles:Wo}=Ol;function Ko(e){const t="nest"===vl.autoReplaceSvg?Uo(e,{styleParser:!1}):Uo(e);return~t.extra.classes.indexOf(il)?mo("generateLayersText",e,t):mo("generateSvgReplacementMutation",e,t)}function Yo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!Sn)return Promise.resolve();const n=wn.documentElement.classList,l=e=>n.add("".concat(Kn,"-").concat(e)),o=e=>n.remove("".concat(Kn,"-").concat(e)),r=vl.autoFetchSvg?[...Mn,...Fn]:Bn.concat(Object.keys(Wo));r.includes("fa")||r.push("fa");const a=[".".concat(il,":not([").concat($n,"])")].concat(r.map(e=>".".concat(e,":not([").concat($n,"])"))).join(", ");if(0===a.length)return Promise.resolve();let s=[];try{s=_l(e.querySelectorAll(a))}catch(e){}if(!(s.length>0))return Promise.resolve();l("pending"),o("complete");const i=Mo("onTree"),c=s.reduce((e,t)=>{try{const n=Ko(t);n&&e.push(n)}catch(e){Jn||"MissingIcon"===e.name&&console.error(e)}return e},[]);return new Promise((e,n)=>{Promise.all(c).then(n=>{zo(n,()=>{l("active"),l("complete"),o("pending"),"function"==typeof t&&t(),i(),e()})}).catch(e=>{i(),n(e)})})}function Jo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;Ko(e).then(e=>{e&&zo([e],t)})}const Xo=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{transform:n=Cl,symbol:l=!1,mask:o=null,maskId:r=null,title:a=null,titleId:s=null,classes:i=[],attributes:c={},styles:u={}}=t;if(!e)return;const{prefix:d,iconName:h,icon:b}=e;return ko(pn({type:"icon"},e),()=>(fo("beforeDOMElementCreation",{iconDefinition:e,params:t}),vl.autoA11y&&(a?c["aria-labelledby"]="".concat(vl.replacementClass,"-title-").concat(s||wl()):(c["aria-hidden"]="true",c.focusable="false")),jo({icons:{main:Ro(b),mask:o?Ro(o.icon):{found:!1,width:null,height:null,icon:{}}},prefix:d,iconName:h,transform:pn(pn({},Cl),n),symbol:l,title:a,maskId:r,titleId:s,extra:{attributes:c,styles:u,classes:i}})))};var er={mixout(){return{icon:(e=Xo,function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const l=(t||{}).icon?t:vo(t||{});let{mask:o}=n;return o&&(o=(o||{}).icon?o:vo(o||{})),e(l,pn(pn({},n),{},{mask:o}))})};var e},hooks:()=>({mutationObserverCallbacks:e=>(e.treeCallback=Yo,e.nodeCallback=Jo,e)}),provides(e){e.i2svg=function(e){const{node:t=wn,callback:n=()=>{}}=e;return Yo(t,n)},e.generateSvgReplacementMutation=function(e,t){const{iconName:n,title:l,titleId:o,prefix:r,transform:a,symbol:s,mask:i,maskId:c,extra:u}=t;return new Promise((t,d)=>{Promise.all([To(n,r),i.iconName?To(i.iconName,i.prefix):Promise.resolve({found:!1,width:512,height:512,icon:{}})]).then(i=>{let[d,h]=i;t([e,jo({icons:{main:d,mask:h},prefix:r,iconName:n,transform:a,symbol:s,maskId:c,title:l,titleId:o,extra:u,watchable:!0})])}).catch(d)})},e.generateAbstractIcon=function(e){let{children:t,attributes:n,main:l,transform:o,styles:r}=e;const a=Sl(r);let s;return a.length>0&&(n.style=a),Pl(o)&&(s=mo("generateAbstractTransformGrouping",{main:l,transform:o,containerWidth:l.width,iconWidth:l.width})),t.push(s||l.icon),{children:t,attributes:n}}}},tr={mixout:()=>({layer(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{classes:n=[]}=t;return ko({type:"layer"},()=>{fo("beforeDOMElementCreation",{assembler:e,params:t});let l=[];return e(e=>{Array.isArray(e)?e.map(e=>{l=l.concat(e.abstract)}):l=l.concat(e.abstract)}),[{tag:"span",attributes:{class:["".concat(vl.cssPrefix,"-layers"),...n].join(" ")},children:l}]})}})},nr={mixout:()=>({counter(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{title:n=null,classes:l=[],attributes:o={},styles:r={}}=t;return ko({type:"counter",content:e},()=>(fo("beforeDOMElementCreation",{content:e,params:t}),function(e){const{content:t,title:n,extra:l}=e,o=pn(pn(pn({},l.attributes),n?{title:n}:{}),{},{class:l.classes.join(" ")}),r=Sl(l.styles);r.length>0&&(o.style=r);const a=[];return a.push({tag:"span",attributes:o,children:[t]}),n&&a.push({tag:"span",attributes:{class:"sr-only"},children:[n]}),a}({content:e.toString(),title:n,extra:{attributes:o,styles:r,classes:["".concat(vl.cssPrefix,"-layers-counter"),...l]}})))}})},lr={mixout:()=>({text(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{transform:n=Cl,title:l=null,classes:o=[],attributes:r={},styles:a={}}=t;return ko({type:"text",content:e},()=>(fo("beforeDOMElementCreation",{content:e,params:t}),So({content:e,transform:pn(pn({},Cl),n),title:l,extra:{attributes:r,styles:a,classes:["".concat(vl.cssPrefix,"-layers-text"),...o]}})))}}),provides(e){e.generateLayersText=function(e,t){const{title:n,transform:l,extra:o}=t;let r=null,a=null;if(Pn){const t=parseInt(getComputedStyle(e).fontSize,10),n=e.getBoundingClientRect();r=n.width/t,a=n.height/t}return vl.autoA11y&&!n&&(o.attributes["aria-hidden"]="true"),Promise.resolve([e,So({content:e.innerHTML,width:r,height:a,transform:l,title:n,extra:o,watchable:!0})])}}};const or=new RegExp('"',"ug"),rr=[1105920,1112319],ar=pn(pn(pn(pn({},{FontAwesome:{normal:"fas",400:"fas"}}),{"Font Awesome 6 Free":{900:"fas",400:"far"},"Font Awesome 6 Pro":{900:"fas",400:"far",normal:"far",300:"fal",100:"fat"},"Font Awesome 6 Brands":{400:"fab",normal:"fab"},"Font Awesome 6 Duotone":{900:"fad",400:"fadr",normal:"fadr",300:"fadl",100:"fadt"},"Font Awesome 6 Sharp":{900:"fass",400:"fasr",normal:"fasr",300:"fasl",100:"fast"},"Font Awesome 6 Sharp Duotone":{900:"fasds",400:"fasdr",normal:"fasdr",300:"fasdl",100:"fasdt"}}),{"Font Awesome 5 Free":{900:"fas",400:"far"},"Font Awesome 5 Pro":{900:"fas",400:"far",normal:"far",300:"fal"},"Font Awesome 5 Brands":{400:"fab",normal:"fab"},"Font Awesome 5 Duotone":{900:"fad"}}),{"Font Awesome Kit":{400:"fak",normal:"fak"},"Font Awesome Kit Duotone":{400:"fakd",normal:"fakd"}}),sr=Object.keys(ar).reduce((e,t)=>(e[t.toLowerCase()]=ar[t],e),{}),ir=Object.keys(sr).reduce((e,t)=>{const n=sr[t];return e[t]=n[900]||[...Object.entries(n)][0][1],e},{});function cr(e,t){const n="".concat("data-fa-pseudo-element-pending").concat(t.replace(":","-"));return new Promise((l,o)=>{if(null!==e.getAttribute(n))return l();const r=_l(e.children).filter(e=>e.getAttribute(Qn)===t)[0],a=Cn.getComputedStyle(e,t),s=a.getPropertyValue("font-family"),i=s.match(cl),c=a.getPropertyValue("font-weight"),u=a.getPropertyValue("content");if(r&&!i)return e.removeChild(r),l();if(i&&"none"!==u&&""!==u){const u=a.getPropertyValue("content");let d=function(e,t){const n=e.replace(/^['"]|['"]$/g,"").toLowerCase(),l=parseInt(t),o=isNaN(l)?"normal":l;return(sr[n]||{})[o]||ir[n]}(s,c);const{value:h,isSecondary:b}=function(e){const t=e.replace(or,""),n=function(e){const t=e.length;let n,l=e.charCodeAt(0);return l>=55296&&l<=56319&&t>1&&(n=e.charCodeAt(1),n>=56320&&n<=57343)?1024*(l-55296)+n-56320+65536:l}(t),l=n>=rr[0]&&n<=rr[1],o=2===t.length&&t[0]===t[1];return{value:Vl(o?t[0]:t),isSecondary:l||o}}(u),p=i[0].startsWith("FontAwesome");let g=to(d,h),f=g;if(p){const e=function(e){const t=Yl[e],n=to("fas",e);return t||(n?{prefix:"fas",iconName:n}:null)||{prefix:null,iconName:null}}(h);e.iconName&&e.prefix&&(g=e.iconName,d=e.prefix)}if(!g||b||r&&r.getAttribute(Un)===d&&r.getAttribute(Wn)===f)l();else{e.setAttribute(n,f),r&&e.removeChild(r);const a={iconName:null,title:null,titleId:null,prefix:null,transform:Cl,symbol:!1,mask:{iconName:null,prefix:null,rest:[]},maskId:null,extra:{classes:[],styles:{},attributes:{}}},{extra:s}=a;s.attributes[Qn]=t,To(g,d).then(o=>{const r=jo(pn(pn({},a),{},{icons:{main:o,mask:{prefix:null,iconName:null,rest:[]}},prefix:d,iconName:f,extra:s,watchable:!0})),i=wn.createElementNS("http://www.w3.org/2000/svg","svg");"::before"===t?e.insertBefore(i,e.firstChild):e.appendChild(i),i.outerHTML=r.map(e=>Dl(e)).join("\n"),e.removeAttribute(n),l()}).catch(o)}}else l()})}function ur(e){return Promise.all([cr(e,"::before"),cr(e,"::after")])}function dr(e){return!(e.parentNode===document.head||~Yn.indexOf(e.tagName.toUpperCase())||e.getAttribute(Qn)||e.parentNode&&"svg"===e.parentNode.tagName)}function hr(e){if(Sn)return new Promise((t,n)=>{const l=_l(e.querySelectorAll("*")).filter(dr).map(ur),o=Mo("searchPseudoElements");Go(),Promise.all(l).then(()=>{o(),qo(),t()}).catch(()=>{o(),qo(),n()})})}var br={hooks:()=>({mutationObserverCallbacks:e=>(e.pseudoElementsCallback=hr,e)}),provides(e){e.pseudoElements2svg=function(e){const{node:t=wn}=e;vl.searchPseudoElements&&hr(t)}}};let pr=!1;var gr={mixout:()=>({dom:{unwatch(){Go(),pr=!0}}}),hooks:()=>({bootstrap(){Qo(go("mutationObserverCallbacks",{}))},noAuto(){$o&&$o.disconnect()},watch(e){const{observeMutationsRoot:t}=e;pr?qo():Qo(go("mutationObserverCallbacks",{observeMutationsRoot:t}))}})};const fr=e=>e.toLowerCase().split(" ").reduce((e,t)=>{const n=t.toLowerCase().split("-"),l=n[0];let o=n.slice(1).join("-");if(l&&"h"===o)return e.flipX=!0,e;if(l&&"v"===o)return e.flipY=!0,e;if(o=parseFloat(o),isNaN(o))return e;switch(l){case"grow":e.size=e.size+o;break;case"shrink":e.size=e.size-o;break;case"left":e.x=e.x-o;break;case"right":e.x=e.x+o;break;case"up":e.y=e.y-o;break;case"down":e.y=e.y+o;break;case"rotate":e.rotate=e.rotate+o}return e},{size:16,x:0,y:0,flipX:!1,flipY:!1,rotate:0});var mr={mixout:()=>({parse:{transform:e=>fr(e)}}),hooks:()=>({parseNodeAttributes(e,t){const n=t.getAttribute("data-fa-transform");return n&&(e.transform=fr(n)),e}}),provides(e){e.generateAbstractTransformGrouping=function(e){let{main:t,transform:n,containerWidth:l,iconWidth:o}=e;const r={transform:"translate(".concat(l/2," 256)")},a="translate(".concat(32*n.x,", ").concat(32*n.y,") "),s="scale(".concat(n.size/16*(n.flipX?-1:1),", ").concat(n.size/16*(n.flipY?-1:1),") "),i="rotate(".concat(n.rotate," 0 0)"),c={outer:r,inner:{transform:"".concat(a," ").concat(s," ").concat(i)},path:{transform:"translate(".concat(o/2*-1," -256)")}};return{tag:"g",attributes:pn({},c.outer),children:[{tag:"g",attributes:pn({},c.inner),children:[{tag:t.icon.tag,children:t.icon.children,attributes:pn(pn({},t.icon.attributes),c.path)}]}]}}}};const vr={x:0,y:0,width:"100%",height:"100%"};function xr(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return e.attributes&&(e.attributes.fill||t)&&(e.attributes.fill="black"),e}var yr={hooks:()=>({parseNodeAttributes(e,t){const n=t.getAttribute("data-fa-mask"),l=n?so(n.split(" ").map(e=>e.trim())):{prefix:null,iconName:null,rest:[]};return l.prefix||(l.prefix=oo()),e.mask=l,e.maskId=t.getAttribute("data-fa-mask-id"),e}}),provides(e){e.generateAbstractMask=function(e){let{children:t,attributes:n,main:l,mask:o,maskId:r,transform:a}=e;const{width:s,icon:i}=l,{width:c,icon:u}=o,d=function(e){let{transform:t,containerWidth:n,iconWidth:l}=e;const o={transform:"translate(".concat(n/2," 256)")},r="translate(".concat(32*t.x,", ").concat(32*t.y,") "),a="scale(".concat(t.size/16*(t.flipX?-1:1),", ").concat(t.size/16*(t.flipY?-1:1),") "),s="rotate(".concat(t.rotate," 0 0)");return{outer:o,inner:{transform:"".concat(r," ").concat(a," ").concat(s)},path:{transform:"translate(".concat(l/2*-1," -256)")}}}({transform:a,containerWidth:c,iconWidth:s}),h={tag:"rect",attributes:pn(pn({},vr),{},{fill:"white"})},b=i.children?{children:i.children.map(xr)}:{},p={tag:"g",attributes:pn({},d.inner),children:[xr(pn({tag:i.tag,attributes:pn(pn({},i.attributes),d.path)},b))]},g={tag:"g",attributes:pn({},d.outer),children:[p]},f="mask-".concat(r||wl()),m="clip-".concat(r||wl()),v={tag:"mask",attributes:pn(pn({},vr),{},{id:f,maskUnits:"userSpaceOnUse",maskContentUnits:"userSpaceOnUse"}),children:[h,g]},x={tag:"defs",children:[{tag:"clipPath",attributes:{id:m},children:(y=u,"g"===y.tag?y.children:[y])},v]};var y;return t.push(x,{tag:"rect",attributes:pn({fill:"currentColor","clip-path":"url(#".concat(m,")"),mask:"url(#".concat(f,")")},vr)}),{children:t,attributes:n}}}},Cr={provides(e){let t=!1;Cn.matchMedia&&(t=Cn.matchMedia("(prefers-reduced-motion: reduce)").matches),e.missingIconAbstract=function(){const e=[],n={fill:"currentColor"},l={attributeType:"XML",repeatCount:"indefinite",dur:"2s"};e.push({tag:"path",attributes:pn(pn({},n),{},{d:"M156.5,447.7l-12.6,29.5c-18.7-9.5-35.9-21.2-51.5-34.9l22.7-22.7C127.6,430.5,141.5,440,156.5,447.7z M40.6,272H8.5 c1.4,21.2,5.4,41.7,11.7,61.1L50,321.2C45.1,305.5,41.8,289,40.6,272z M40.6,240c1.4-18.8,5.2-37,11.1-54.1l-29.5-12.6 C14.7,194.3,10,216.7,8.5,240H40.6z M64.3,156.5c7.8-14.9,17.2-28.8,28.1-41.5L69.7,92.3c-13.7,15.6-25.5,32.8-34.9,51.5 L64.3,156.5z M397,419.6c-13.9,12-29.4,22.3-46.1,30.4l11.9,29.8c20.7-9.9,39.8-22.6,56.9-37.6L397,419.6z M115,92.4 c13.9-12,29.4-22.3,46.1-30.4l-11.9-29.8c-20.7,9.9-39.8,22.6-56.8,37.6L115,92.4z M447.7,355.5c-7.8,14.9-17.2,28.8-28.1,41.5 l22.7,22.7c13.7-15.6,25.5-32.9,34.9-51.5L447.7,355.5z M471.4,272c-1.4,18.8-5.2,37-11.1,54.1l29.5,12.6 c7.5-21.1,12.2-43.5,13.6-66.8H471.4z M321.2,462c-15.7,5-32.2,8.2-49.2,9.4v32.1c21.2-1.4,41.7-5.4,61.1-11.7L321.2,462z M240,471.4c-18.8-1.4-37-5.2-54.1-11.1l-12.6,29.5c21.1,7.5,43.5,12.2,66.8,13.6V471.4z M462,190.8c5,15.7,8.2,32.2,9.4,49.2h32.1 c-1.4-21.2-5.4-41.7-11.7-61.1L462,190.8z M92.4,397c-12-13.9-22.3-29.4-30.4-46.1l-29.8,11.9c9.9,20.7,22.6,39.8,37.6,56.9 L92.4,397z M272,40.6c18.8,1.4,36.9,5.2,54.1,11.1l12.6-29.5C317.7,14.7,295.3,10,272,8.5V40.6z M190.8,50 c15.7-5,32.2-8.2,49.2-9.4V8.5c-21.2,1.4-41.7,5.4-61.1,11.7L190.8,50z M442.3,92.3L419.6,115c12,13.9,22.3,29.4,30.5,46.1 l29.8-11.9C470,128.5,457.3,109.4,442.3,92.3z M397,92.4l22.7-22.7c-15.6-13.7-32.8-25.5-51.5-34.9l-12.6,29.5 C370.4,72.1,384.4,81.5,397,92.4z"})});const o=pn(pn({},l),{},{attributeName:"opacity"}),r={tag:"circle",attributes:pn(pn({},n),{},{cx:"256",cy:"364",r:"28"}),children:[]};return t||r.children.push({tag:"animate",attributes:pn(pn({},l),{},{attributeName:"r",values:"28;14;28;28;14;28;"})},{tag:"animate",attributes:pn(pn({},o),{},{values:"1;0;1;1;0;1;"})}),e.push(r),e.push({tag:"path",attributes:pn(pn({},n),{},{opacity:"1",d:"M263.7,312h-16c-6.6,0-12-5.4-12-12c0-71,77.4-63.9,77.4-107.8c0-20-17.8-40.2-57.4-40.2c-29.1,0-44.3,9.6-59.2,28.7 c-3.9,5-11.1,6-16.2,2.4l-13.1-9.2c-5.6-3.9-6.9-11.8-2.6-17.2c21.2-27.2,46.4-44.7,91.2-44.7c52.3,0,97.4,29.8,97.4,80.2 c0,67.6-77.4,63.5-77.4,107.8C275.7,306.6,270.3,312,263.7,312z"}),children:t?[]:[{tag:"animate",attributes:pn(pn({},o),{},{values:"1;0;0;0;0;1;"})}]}),t||e.push({tag:"path",attributes:pn(pn({},n),{},{opacity:"0",d:"M232.5,134.5l7,168c0.3,6.4,5.6,11.5,12,11.5h9c6.4,0,11.7-5.1,12-11.5l7-168c0.3-6.8-5.2-12.5-12-12.5h-23 C237.7,122,232.2,127.7,232.5,134.5z"}),children:[{tag:"animate",attributes:pn(pn({},o),{},{values:"0;0;1;1;0;0;"})}]}),{tag:"g",attributes:{class:"missing"},children:e}}}};!function(e,t){let{mixoutsTo:n}=t;uo=e,ho={},Object.keys(bo).forEach(e=>{-1===po.indexOf(e)&&delete bo[e]}),uo.forEach(e=>{const t=e.mixout?e.mixout():{};if(Object.keys(t).forEach(e=>{"function"==typeof t[e]&&(n[e]=t[e]),"object"==typeof t[e]&&Object.keys(t[e]).forEach(l=>{n[e]||(n[e]={}),n[e][l]=t[e][l]})}),e.hooks){const t=e.hooks();Object.keys(t).forEach(e=>{ho[e]||(ho[e]=[]),ho[e].push(t[e])})}e.provides&&e.provides(bo)})}([Il,er,tr,nr,lr,br,gr,mr,yr,Cr,{hooks:()=>({parseNodeAttributes(e,t){const n=t.getAttribute("data-fa-symbol"),l=null!==n&&(""===n||n);return e.symbol=l,e}})}],{mixoutsTo:wo});const wr=wo.parse,_r=wo.icon;var kr=n(821),jr=n.n(kr);function Sr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);t&&(l=l.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,l)}return n}function Pr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Sr(Object(n),!0).forEach(function(t){Br(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Sr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Rr(e){return Rr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Rr(e)}function Br(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Tr(e){return function(e){if(Array.isArray(e))return Ir(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Ir(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ir(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ir(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,l=new Array(t);n<t;n++)l[n]=e[n];return l}function Er(e){return t=e,(t-=0)==t?e:(e=e.replace(/[\-_\s]+(.)?/g,function(e,t){return t?t.toUpperCase():""})).substr(0,1).toLowerCase()+e.substr(1);var t}var Or=["style"],Mr=!1;try{Mr=!0}catch(e){}function Ar(e){return e&&"object"===Rr(e)&&e.prefix&&e.iconName&&e.icon?e:wr.icon?wr.icon(e):null===e?null:e&&"object"===Rr(e)&&e.prefix&&e.iconName?e:Array.isArray(e)&&2===e.length?{prefix:e[0],iconName:e[1]}:"string"==typeof e?{prefix:"fas",iconName:e}:void 0}function Nr(e,t){return Array.isArray(t)&&t.length>0||!Array.isArray(t)&&t?Br({},e,t):{}}var Dr={border:!1,className:"",mask:null,maskId:null,fixedWidth:!1,inverse:!1,flip:!1,icon:null,listItem:!1,pull:null,pulse:!1,rotation:null,size:null,spin:!1,spinPulse:!1,spinReverse:!1,beat:!1,fade:!1,beatFade:!1,bounce:!1,shake:!1,symbol:!1,title:"",titleId:null,transform:null,swapOpacity:!1},Lr=d().forwardRef(function(e,t){var n=Pr(Pr({},Dr),e),l=n.icon,o=n.mask,r=n.symbol,a=n.className,s=n.title,i=n.titleId,c=n.maskId,u=Ar(l),d=Nr("classes",[].concat(Tr(function(e){var t,n=e.beat,l=e.fade,o=e.beatFade,r=e.bounce,a=e.shake,s=e.flash,i=e.spin,c=e.spinPulse,u=e.spinReverse,d=e.pulse,h=e.fixedWidth,b=e.inverse,p=e.border,g=e.listItem,f=e.flip,m=e.size,v=e.rotation,x=e.pull,y=(Br(t={"fa-beat":n,"fa-fade":l,"fa-beat-fade":o,"fa-bounce":r,"fa-shake":a,"fa-flash":s,"fa-spin":i,"fa-spin-reverse":u,"fa-spin-pulse":c,"fa-pulse":d,"fa-fw":h,"fa-inverse":b,"fa-border":p,"fa-li":g,"fa-flip":!0===f,"fa-flip-horizontal":"horizontal"===f||"both"===f,"fa-flip-vertical":"vertical"===f||"both"===f},"fa-".concat(m),null!=m),Br(t,"fa-rotate-".concat(v),null!=v&&0!==v),Br(t,"fa-pull-".concat(x),null!=x),Br(t,"fa-swap-opacity",e.swapOpacity),t);return Object.keys(y).map(function(e){return y[e]?e:null}).filter(function(e){return e})}(n)),Tr((a||"").split(" ")))),h=Nr("transform","string"==typeof n.transform?wr.transform(n.transform):n.transform),b=Nr("mask",Ar(o)),p=_r(u,Pr(Pr(Pr(Pr({},d),h),b),{},{symbol:r,title:s,titleId:i,maskId:c}));if(!p)return function(){var e;!Mr&&console&&"function"==typeof console.error&&(e=console).error.apply(e,arguments)}("Could not find icon",u),null;var g=p.abstract,f={ref:t};return Object.keys(n).forEach(function(e){Dr.hasOwnProperty(e)||(f[e]=n[e])}),Fr(g[0],f)});Lr.displayName="FontAwesomeIcon",Lr.propTypes={beat:jr().bool,border:jr().bool,beatFade:jr().bool,bounce:jr().bool,className:jr().string,fade:jr().bool,flash:jr().bool,mask:jr().oneOfType([jr().object,jr().array,jr().string]),maskId:jr().string,fixedWidth:jr().bool,inverse:jr().bool,flip:jr().oneOf([!0,!1,"horizontal","vertical","both"]),icon:jr().oneOfType([jr().object,jr().array,jr().string]),listItem:jr().bool,pull:jr().oneOf(["right","left"]),pulse:jr().bool,rotation:jr().oneOf([0,90,180,270]),shake:jr().bool,size:jr().oneOf(["2xs","xs","sm","lg","xl","2xl","1x","2x","3x","4x","5x","6x","7x","8x","9x","10x"]),spin:jr().bool,spinPulse:jr().bool,spinReverse:jr().bool,symbol:jr().oneOfType([jr().bool,jr().string]),title:jr().string,titleId:jr().string,transform:jr().oneOfType([jr().string,jr().object]),swapOpacity:jr().bool};var Fr=function e(t,n){var l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if("string"==typeof n)return n;var o=(n.children||[]).map(function(n){return e(t,n)}),r=Object.keys(n.attributes||{}).reduce(function(e,t){var l=n.attributes[t];switch(t){case"class":e.attrs.className=l,delete n.attributes.class;break;case"style":e.attrs.style=l.split(";").map(function(e){return e.trim()}).filter(function(e){return e}).reduce(function(e,t){var n,l=t.indexOf(":"),o=Er(t.slice(0,l)),r=t.slice(l+1).trim();return o.startsWith("webkit")?e[(n=o,n.charAt(0).toUpperCase()+n.slice(1))]=r:e[o]=r,e},{});break;default:0===t.indexOf("aria-")||0===t.indexOf("data-")?e.attrs[t.toLowerCase()]=l:e.attrs[Er(t)]=l}return e},{attrs:{}}),a=l.style,s=void 0===a?{}:a,i=function(e,t){if(null==e)return{};var n,l,o=function(e,t){if(null==e)return{};var n,l,o={},r=Object.keys(e);for(l=0;l<r.length;l++)n=r[l],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(l=0;l<r.length;l++)n=r[l],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(l,Or);return r.attrs.style=Pr(Pr({},r.attrs.style),s),t.apply(void 0,[n.tag,Pr(Pr({},r.attrs),i)].concat(Tr(o)))}.bind(null,d().createElement);const Vr={prefix:"fas",iconName:"caret-right",icon:[256,512,[],"f0da","M246.6 278.6c12.5-12.5 12.5-32.8 0-45.3l-128-128c-9.2-9.2-22.9-11.9-34.9-6.9s-19.8 16.6-19.8 29.6l0 256c0 12.9 7.8 24.6 19.8 29.6s25.7 2.2 34.9-6.9l128-128z"]},Hr={prefix:"fas",iconName:"caret-left",icon:[256,512,[],"f0d9","M9.4 278.6c-12.5-12.5-12.5-32.8 0-45.3l128-128c9.2-9.2 22.9-11.9 34.9-6.9s19.8 16.6 19.8 29.6l0 256c0 12.9-7.8 24.6-19.8 29.6s-25.7 2.2-34.9-6.9l-128-128z"]},zr=(0,J.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,J.jsx)("rect",{width:"24",height:"24",fill:"white"}),(0,J.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 6C3 4.34315 4.34315 3 6 3H18C19.6569 3 21 4.34315 21 6V18C21 19.6569 19.6569 21 18 21H6C4.34315 21 3 19.6569 3 18V6ZM10.8867 13.5671C10.6495 13.5035 10.5087 13.2598 10.5723 13.0226L12.3246 6.48302C12.3881 6.24585 12.6319 6.10511 12.8691 6.16866C13.1062 6.23221 13.247 6.47598 13.1834 6.71315L11.4311 13.2527C11.3676 13.4899 11.1238 13.6306 10.8867 13.5671ZM9.2624 12.9295C9.45766 13.1248 9.77424 13.1248 9.96951 12.9295C10.1648 12.7342 10.1648 12.4176 9.96951 12.2224L7.9686 10.2215C7.77333 10.0262 7.77333 9.70963 7.9686 9.51437L9.96951 7.51346C10.1648 7.3182 10.1648 7.00162 9.96951 6.80635C9.77424 6.61109 9.45766 6.61109 9.2624 6.80635L7.26149 8.80726C6.6757 9.39305 6.6757 10.3428 7.26149 10.9286L9.2624 12.9295ZM13.8853 6.8063C14.0805 6.61104 14.3971 6.61104 14.5924 6.8063L16.5933 8.80721C17.1791 9.393 17.1791 10.3427 16.5933 10.9285L14.5924 12.9294C14.3971 13.1247 14.0805 13.1247 13.8853 12.9294C13.69 12.7342 13.69 12.4176 13.8853 12.2223L15.8862 10.2214C16.0814 10.0262 16.0814 9.70958 15.8862 9.51432L13.8853 7.51341C13.69 7.31815 13.69 7.00157 13.8853 6.8063ZM7.478 15.2625H6.838V17.9465H7.478V16.8845H8.492V17.9465H9.138V15.2625H8.492V16.3205H7.478V15.2625ZM9.50056 15.2625V15.8165H10.2886V17.9465H10.9286V15.8165H11.7106V15.2625H9.50056ZM12.9884 15.2625H12.0724V17.9465H12.7124V16.166L13.3464 17.6965H13.7604L14.3624 16.2482V17.9465H15.0064V15.2625H14.1264L13.5574 16.6342L12.9884 15.2625ZM16.3257 17.3865V15.2625H15.6857V17.9465H17.3397V17.3865H16.3257Z",fill:"#671FEB"})]}),Zr=(0,J.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,J.jsx)("rect",{width:"24",height:"24",fill:"white"}),(0,J.jsx)("path",{d:"M8.34675 8C8.15525 8 8 8.15525 8 8.34675C8 8.53826 8.15525 8.69351 8.34675 8.69351H11.1362C11.3277 8.69351 11.483 8.53826 11.483 8.34675C11.483 8.15525 11.3277 8 11.1362 8H8.34675Z",fill:"#671FEB"}),(0,J.jsx)("path",{d:"M8 9.73374C8 9.54224 8.15525 9.38699 8.34675 9.38699H11.1362C11.3277 9.38699 11.483 9.54224 11.483 9.73374C11.483 9.92525 11.3277 10.0805 11.1362 10.0805H8.34675C8.15525 10.0805 8 9.92525 8 9.73374Z",fill:"#671FEB"}),(0,J.jsx)("path",{d:"M8.34675 10.774C8.15525 10.774 8 10.9292 8 11.1207C8 11.3122 8.15525 11.4675 8.34675 11.4675H11.1362C11.3277 11.4675 11.483 11.3122 11.483 11.1207C11.483 10.9292 11.3277 10.774 11.1362 10.774H8.34675Z",fill:"#671FEB"}),(0,J.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.04375 15.4838C7.95182 15.6493 8.00927 15.8584 8.17377 15.9534C8.25764 16.0018 8.35329 16.0113 8.43981 15.9875H11.0432C11.1297 16.0113 11.2254 16.0018 11.3092 15.9534C11.4388 15.8786 11.502 15.7328 11.478 15.5934C11.4692 15.528 11.4422 15.4683 11.4022 15.4196L10.0467 13.0717C9.98154 12.9589 9.86272 12.8965 9.74114 12.898C9.6198 12.8967 9.50133 12.9592 9.43633 13.0717L8.06292 15.4505C8.05594 15.4613 8.04954 15.4724 8.04375 15.4838ZM8.95647 15.2926L9.7415 13.9329L10.5265 15.2926H8.95647Z",fill:"#671FEB"}),(0,J.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.478 8H16.0487V11.4674H12.478V8ZM13.078 8.6H15.4487V10.8674H13.078V8.6Z",fill:"#671FEB"}),(0,J.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 6C3 4.34315 4.34315 3 6 3H18C19.6569 3 21 4.34315 21 6V18C21 19.6569 19.6569 21 18 21H6C4.34315 21 3 19.6569 3 18V6ZM7 8C7 7.44772 7.44772 7 8 7H16C16.5523 7 17 7.44772 17 8V12.258C16.7171 12.1048 16.3932 12.0178 16.0489 12.0178C14.9502 12.0178 14.0584 12.9038 14.049 14.0002C12.9524 14.0096 12.0665 14.9014 12.0665 16.0001C12.0665 16.3644 12.1638 16.7059 12.3339 17H8C7.44772 17 7 16.5523 7 16V8ZM16.0489 13.0178C16.4931 13.0178 16.8696 13.3074 17 13.7081C17.0317 13.8056 17.0489 13.9097 17.0489 14.0178V15.0001H18.0309C18.5832 15.0001 19.0309 15.4479 19.0309 16.0001C19.0309 16.5524 18.5832 17.0001 18.0309 17.0001H17.0489V17.9823C17.0489 18.5346 16.6012 18.9823 16.0489 18.9823C15.4966 18.9823 15.0489 18.5346 15.0489 17.9823V17.0001H14.0665L14.0491 17C13.5048 16.9908 13.0665 16.5466 13.0665 16.0001C13.0665 15.4479 13.5142 15.0001 14.0665 15.0001H15.0489V14.0178C15.0489 13.4655 15.4966 13.0178 16.0489 13.0178Z",fill:"#671FEB"})]}),Gr=(0,J.jsxs)("svg",{width:"256",height:"256",viewBox:"0 0 256 256",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,J.jsx)("rect",{width:"256",height:"256",fill:"white"}),(0,J.jsxs)("g",{clipPath:"url(#clip0_50_2)",children:[(0,J.jsx)("rect",{x:"30",y:"30",width:"196",height:"39.2",rx:"3.92",fill:"#671FEB"}),(0,J.jsx)("rect",{x:"112.32",y:"108.4",width:"113.68",height:"39.2",rx:"3.92",fill:"#671FEB"}),(0,J.jsx)("rect",{x:"112.32",y:"186.8",width:"113.68",height:"39.2",rx:"3.92",fill:"#671FEB"}),(0,J.jsx)("rect",{x:"30",y:"108.4",width:"39.2",height:"117.6",rx:"3.92",fill:"#671FEB"})]}),(0,J.jsx)("defs",{children:(0,J.jsx)("clipPath",{id:"clip0_50_2",children:(0,J.jsx)("rect",{x:"30",y:"30",width:"196",height:"196",rx:"19.6",fill:"white"})})})]}),qr=(0,J.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,J.jsx)("rect",{width:"24",height:"24",fill:"white"}),(0,J.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 5C3 3.89543 3.89543 3 5 3H19C20.1046 3 21 3.89543 21 5V19C21 20.1046 20.1046 21 19 21H5C3.89543 21 3 20.1046 3 19V5ZM12 5.66844L13.9749 9.95014L18.6574 10.5053L15.1955 13.7067L16.1145 18.3316L12 16.0284L7.88549 18.3316L8.80444 13.7067L5.34259 10.5053L10.025 9.95014L12 5.66844ZM12 8.1066V14.9191L9.29297 16.4386L9.89453 13.4035L7.61328 11.2863L10.6992 10.9269L12 8.1066Z",fill:"#671feb"})]}),$r=qr,Qr=(0,J.jsxs)("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,J.jsx)("path",{d:"M8.10256 8C5.83678 8 4 9.83678 4 12.1026V16.6667H42.9744V12.1026C42.9744 9.83678 41.1376 8 38.8718 8H8.10256Z",fill:"#671FEB"}),(0,J.jsx)("path",{d:"M20.9231 17.6923H11.6923V23.8462H20.9231V17.6923Z",fill:"#671FEB"}),(0,J.jsx)("path",{d:"M20.9231 24.8718H11.6923L11.6923 32.0513H20.9231V24.8718Z",fill:"#671FEB"}),(0,J.jsx)("path",{d:"M10.6667 24.8718V32.0513H4V24.8718H10.6667Z",fill:"#671FEB"}),(0,J.jsx)("path",{d:"M4 34.6154V33.077H10.6667V38.7179H8.10256C5.83678 38.7179 4 36.8812 4 34.6154Z",fill:"#671FEB"}),(0,J.jsx)("path",{d:"M20.9231 33.077H11.6923V38.7179H20.9231V33.077Z",fill:"#671FEB"}),(0,J.jsx)("path",{d:"M10.6667 23.8462V17.6923H4V23.8462H10.6667Z",fill:"#671FEB"}),(0,J.jsx)("path",{d:"M32.2051 23.8462H21.9487V17.6923H32.2051V23.8462Z",fill:"#671FEB"}),(0,J.jsx)("path",{d:"M42.9744 23.8462V17.6923H33.2308V23.8462H42.9744Z",fill:"#671FEB"}),(0,J.jsx)("path",{d:"M31.6765 34.5568L30.8068 31.6761H30.7386L29.869 34.5568H31.6765Z",fill:"#671FEB"}),(0,J.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M24 25C22.8954 25 22 25.8954 22 27V40C22 41.1046 22.8954 42 24 42H42C43.1046 42 44 41.1046 44 40V27C44 25.8954 43.1046 25 42 25H24ZM26.2727 38H28.8295L29.3338 36.3295H32.2116L32.7159 38H35.2727L32.392 29.2727H29.1534L26.2727 38ZM38.4826 38V29.2727H36.1133V38H38.4826Z",fill:"#671FEB"})]});var Ur=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"m9.99609 14v-.2251l.00391.0001v6.225h1.5v-14.5h2.5v14.5h1.5v-14.5h3v-1.5h-8.50391c-2.76142 0-5 2.23858-5 5 0 2.7614 2.23858 5 5 5z"})});const Wr=[{name:"core/paragraph",title:"Paragraph",icon:Ur,isPro:!1},{name:"core/list",title:"List",icon:(0,J.jsx)(Re.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,J.jsx)(Re.Path,{d:"M4 4v1.5h16V4H4zm8 8.5h8V11h-8v1.5zM4 20h16v-1.5H4V20zm4-8c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2z"})}),isPro:!1,demoUrl:"https://tableberg.com/docs/how-to-add-a-list-to-a-table-in-wordpress/"},{name:"tableberg/button",title:"Button",icon:(0,J.jsx)(Re.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,J.jsx)(Re.Path,{d:"M8 12.5h8V11H8v1.5Z M19 6.5H5a2 2 0 0 0-2 2V15a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8.5a2 2 0 0 0-2-2ZM5 8h14a.5.5 0 0 1 .5.5V15a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V8.5A.5.5 0 0 1 5 8Z"})}),isPro:!1,demoUrl:"https://tableberg.com/docs/how-to-add-buttons-to-wordpress-tables/"},{name:"tableberg/image",title:"Image",icon:Wt,isPro:!1,demoUrl:"https://tableberg.com/docs/how-to-add-images-to-a-table-in-wordpress/"},{name:"tableberg/styled-list",title:"Styled List",icon:$e,isPro:!0,image:"styled_list_block_1.png",upsellText:"Elevate your lists with customizable icons as bullets for a polished look.",demoUrl:"https://tableberg.com/docs/how-to-add-styled-lists-in-wordpress-tables/"},{name:"tableberg/ribbon",title:"Ribbon",icon:Qe,isPro:!0,image:"ribbon_block_1.png",upsellText:"Overlay a decorative ribbon on your table, ideal for highlighting special offers or important notices.",demoUrl:"https://tableberg.com/docs/how-to-add-ribbons-to-wordpress-tables/"},{name:"tableberg/html",title:"Custom Html",icon:zr,isPro:!0,image:"html_block_1.png",upsellText:"Add your own HTML code to create specialized content and integrate custom elements.",demoUrl:"https://tableberg.com/docs/how-to-add-custom-html-to-wordpress-tables/"},{name:"tableberg/icon",title:"Icon",icon:Zr,isPro:!0,image:"icon_block_1.png",upsellText:"Add scalable icons to your tables to support text and enhance user engagement.",demoUrl:"https://tableberg.com/docs/how-to-add-icons-to-wordpress-tables/"},{name:"tableberg/star-rating",title:"Star Rating",icon:qr,isPro:!0,image:"star_rating_block_1.png",upsellText:"Add customizable star ratings, perfect for reviews and comparison tables.",demoUrl:"https://tableberg.com/docs/how-to-add-star-rating-in-wordpress/"}],Kr=[{name:"empty-cell",title:"Empty Cell",icon:Gr,upsellText:"<strong>Empty Cell</strong> is not available in the free version. Please get the PRO add-on to unlock all exclusive features."},{name:"cell-orientation",title:"Cell Orientation",icon:Gr,upsellText:"<strong>Cell Orientation</strong> is not available in the free version. Please get the PRO add-on to unlock all exclusive features."},{name:"sticky-top-row",title:"Sticky Top Row",icon:Gr,upsellText:"<strong>Sticky Top Row</strong> is not available in the free version. Please get the PRO add-on to unlock all exclusive features."},{name:"sticky-first-col",title:"Sticky First Column",icon:Gr,upsellText:"<strong>Sticky First Column</strong> is not available in the free version. Please get the PRO add-on to unlock all exclusive features."},{name:"cell-bg",title:"Individual Cell Background",icon:Gr,upsellText:"<strong>Individual Cell Background</strong> is not available in the free version. Please get the PRO add-on to unlock all exclusive features."},{name:"row-bg",title:"Individual Row Background",icon:Gr,upsellText:"<strong>Individual Row Background</strong> is not available in the free version. Please get the PRO add-on to unlock all exclusive features."},{name:"col-bg",title:"Individual Column Background",icon:Gr,upsellText:"<strong>Individual Column Background</strong> is not available in the free version. Please get the PRO add-on to unlock all exclusive features."},{name:"col-border",title:"Individual Column Border",icon:Gr,upsellText:"<strong>Individual Column Border</strong> is not available in the free version. Please get the PRO add-on to unlock all exclusive features."},{name:"col-border-radius",title:"Individual Column Border Radius",icon:Gr,upsellText:"<strong>Individual Column Border Radius</strong> is not available in the free version. Please get the PRO add-on to unlock all exclusive features."},{name:"row-border",title:"Individual Row Border",icon:Gr,upsellText:"<strong>Individual Row Border</strong> is not available in the free version. Please get the PRO add-on to unlock all exclusive features."},{name:"row-border-radius",title:"Individual Row Border Radius",icon:Gr,upsellText:"<strong>Individual Row Border Radius</strong> is not available in the free version. Please get the PRO add-on to unlock all exclusive features."},{name:"duplicate-row-col",title:"Duplicate Rows and Columns",icon:Gr,upsellText:"<strong>Duplicate Rows and Columns</strong> is not available in the free version. Please get the PRO add-on to unlock all exclusive features."},{name:"move-row-col",title:"Move Rows and Columns",icon:Gr,upsellText:"<strong>Move Rows and Columns</strong> is not available in the free version. Please get the PRO add-on to unlock all exclusive features."},{name:"row-only-border",title:"Row Only Border",icon:Gr,upsellText:"<strong>Row Only Border</strong> is not available in the free version. Please get the PRO add-on to unlock all exclusive features."},{name:"col-only-border",title:"Column Only Border",icon:Gr,upsellText:"<strong>Column Only Border</strong> is not available in the free version. Please get the PRO add-on to unlock all exclusive features."},{name:"search",title:"Search",icon:Gr,upsellText:"<strong>Search</strong> is not available in the free version. Please get the PRO add-on to unlock all exclusive features."},{name:"sorting",title:"Sorting",icon:Gr,upsellText:"<strong>Sorting</strong> is not available in the free version. Please get the PRO add-on to unlock all exclusive features."},{name:"product-table",title:"Product Table",icon:Gr,upsellText:"<strong>Product Table</strong> is not available in the free version. Please get the PRO add-on to unlock all exclusive features."},{name:"ai-table",title:"AI Table",icon:Qr,isPro:!0,upsellText:"Generate tables instantly using AI from any content. Simply provide text, URLs, or prompts and let AI create structured tables for you."}],Yr=[{name:"pattern-feature-comparison",title:"Pattern: Products Feature Comparison",upsellText:"",image:"/includes/Patterns/images/pattern-feature-comparison.png"},{name:"pattern-employee-information-table",title:"Pattern: Employee Information Table",upsellText:"",image:"/includes/Patterns/images/pattern-employee-information-table.png"},{name:"pattern-problems-solutions-table",title:"Pattern: Problems &amp; Solutions Table",upsellText:"",image:"/includes/Patterns/images/pattern-problems-solutions-table.png"},{name:"pattern-pros-and-cons-colorful",title:"Pattern: Pros and Cons (Colorful)",upsellText:"",image:"/includes/Patterns/images/pattern-pros-and-cons-colorful.png"},{name:"pattern-pros-and-cons-table-simple",title:"Pattern: Pros and Cons Table (Simple)",upsellText:"",image:"/includes/Patterns/images/pattern-pros-and-cons-table-simple.png"},{name:"pattern-pros-cons-table-with-featured-product",title:"Pattern: Pros &amp; Cons Table with Featured Product",upsellText:"",image:"/includes/Patterns/images/pattern-pros-cons-table-with-featured-product.png"},{name:"pattern-top-products-comparison-table",title:"Pattern: Top Products Comparison Table",upsellText:"",image:"/includes/Patterns/images/pattern-top-products-comparison-table.png"},{name:"pattern-product-comparison-table-versus",title:"Pattern: Product Comparison Table (Versus)",upsellText:"",image:"/includes/Patterns/images/pattern-product-comparison-table-versus.png"},{name:"pattern-pricing-table-with-features-comparison",title:"Pattern: Pricing Table with Features Comparison",upsellText:"",image:"/includes/Patterns/images/pattern-pricing-table-with-features-comparison.png"},{name:"pattern-pricing-table-with-a-highlighted-plan",title:"Pattern: Pricing Table with a highlighted plan",upsellText:"",image:"/includes/Patterns/images/pattern-pricing-table-with-a-highlighted-plan.png"},{name:"pattern-colorful-pricing-table",title:"Pattern: Colorful Pricing Table",upsellText:"",image:"/includes/Patterns/images/pattern-colorful-pricing-table.png"},{name:"pattern-pricing-table-packages",title:"Pattern: Pricing Table (Packages)",upsellText:"",image:"/includes/Patterns/images/pattern-pricing-table-packages.png"},{name:"pattern-single-plan-pricing-table",title:"Pattern: Single Plan Pricing Table",upsellText:"",image:"/includes/Patterns/images/pattern-single-plan-pricing-table.png"},{name:"pattern-pricing-table-with-highlighted-columns",title:"Pattern: Pricing Table With Highlighted Columns",upsellText:"",image:"/includes/Patterns/images/pattern-pricing-table-with-highlighted-columns.png"},{name:"pattern-pricing-table-highlighting-discounts",title:"Pattern: Pricing Table Highlighting Discounts",upsellText:"",image:"/includes/Patterns/images/pattern-pricing-table-highlighting-discounts.png"},{name:"pattern-product-box-with-features-description-and-image",title:"Pattern: Product Box with features, description, and image",upsellText:"",image:"/includes/Patterns/images/pattern-product-box-with-features-description-and-image.png"},{name:"pattern-single-product-box-with-features",title:"Pattern: Single Product Box with features",upsellText:"",image:"/includes/Patterns/images/pattern-single-product-box-with-features.png"},{name:"pattern-minimal-product-box",title:"Pattern: Minimal Product Box",upsellText:"",image:"/includes/Patterns/images/pattern-minimal-product-box.png"},{name:"pattern-products-comparison-side-by-side",title:"Pattern: Products Comparison Side by Side",upsellText:"",image:"/includes/Patterns/images/pattern-products-comparison-side-by-side.png"},{name:"pattern-product-lists-comparison-table",title:"Pattern: Product Lists Comparison Table",upsellText:"",image:"/includes/Patterns/images/pattern-product-lists-comparison-table.png"},{name:"pattern-product-comparison-boxes",title:"Pattern: Product Comparison Boxes",upsellText:"",image:"/includes/Patterns/images/pattern-product-comparison-boxes.png"},{name:"pattern-features-comparison-table",title:"Pattern: Features Comparison Table",upsellText:"",image:"/includes/Patterns/images/pattern-features-comparison-table.png"},{name:"pattern-brand-size-color-guide",title:"Pattern: Brand Size &amp; Color Guide",upsellText:"",image:"/includes/Patterns/images/pattern-brand-size-color-guide.png"},{name:"pattern-horizontal-pricing-table",title:"Pattern: Horizontal Pricing Table",upsellText:"",image:"/includes/Patterns/images/pattern-horizontal-pricing-table.png"},{name:"pattern-group-points-table",title:"Pattern: Group Points Table",upsellText:"",image:"/includes/Patterns/images/pattern-group-points-table.png"}];function Jr(){return It().plugin_url||""}function Xr({onClose:e,info:t,prev:n,next:l,link:o="https://tableberg.com/pricing/"}){return(0,J.jsxs)("div",{className:"tableberg-upsell-modal",children:[(0,J.jsx)("div",{className:"tableberg-upsell-modal-backdrop",onClick:e}),(0,J.jsxs)("div",{className:"tableberg-upsell-modal-container",children:[!!n&&(0,J.jsx)("button",{className:"tableberg-upsell-modal-prev",onClick:n,children:(0,J.jsx)(Lr,{icon:Hr})}),(0,J.jsxs)("div",{className:"tableberg-upsell-modal-area",children:[(0,J.jsxs)("h2",{children:[t.icon||Gr," ",t.title]}),(0,J.jsxs)("div",{className:"tableberg-upsell-modal-content",children:[t.image&&(0,J.jsx)("img",{src:t.image.startsWith("http")?t.image:Jr()+"includes/Admin/images/upsell/"+t.image,alt:t.title+" "+(0,i.__)("Demo","tableberg")}),t.upsellText&&(0,J.jsx)(Yt.RawHTML,{className:"tableberg-upsell-modal-text",children:t.upsellText}),(0,J.jsxs)("p",{children:[(0,i.__)("Limited Time: Use code","tableberg")," ",(0,J.jsx)("b",{children:"TB20"})," ",(0,i.__)("to get a 20% discount.","tableberg")]})]}),(0,J.jsxs)("div",{className:"tableberg-upsell-modal-footer",children:[(0,J.jsx)("button",{onClick:e,children:(0,i.__)("Cancel","tableberg")}),(0,J.jsx)("a",{href:o,target:"_blank",children:(0,i.__)("Buy PRO","tableberg")})]})]},t.name),!!l&&(0,J.jsx)("button",{className:"tableberg-upsell-modal-next",onClick:l,children:(0,J.jsx)(Lr,{icon:Vr})})]})]})}function ea({onClose:e,selected:t,link:n="https://tableberg.com/pricing/"}){const[l,o]=(0,u.useState)(0),r=Kr[l];return(0,u.useEffect)(()=>{if(t){t=t.replace("-dummy","");const e=Kr.findIndex(e=>e.name===t);e>-1&&o(e)}},[t]),(0,J.jsx)(Xr,{onClose:e,info:r,prev:()=>o(e=>e>0?e-1:Kr.length-1),next:()=>o((l+1)%Kr.length),link:n})}function ta({onClose:e,selected:t}){const n=function(){const e=Jr(),t=Yr.map(t=>({...t,image:t.image?`${e}${t.image.substring(1)}`:t.image}));return[...Wr.filter(e=>e.isPro),...t]}(),[l,o]=(0,u.useState)(0),r=n[l];return(0,u.useEffect)(()=>{if(t){t=t.replace("-dummy","");const e=n.findIndex(e=>e.name===t);e>-1&&o(e)}},[t]),(0,J.jsx)(Xr,{onClose:e,info:r,prev:()=>o(e=>e>0?e-1:n.length-1),next:()=>o((l+1)%n.length)})}const na=window.ReactDOM;function la(e){return(0,J.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...e,children:(0,J.jsxs)("g",{fill:"none",fillRule:"evenodd",children:[(0,J.jsx)("path",{d:"M24 0v24H0V0zM12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035c-.01-.004-.019-.001-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427c-.002-.01-.009-.017-.017-.018m.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093c.012.004.023 0 .029-.008l.004-.014l-.034-.614c-.003-.012-.01-.02-.02-.022m-.715.002a.023.023 0 0 0-.027.006l-.006.014l-.034.614c0 .012.007.02.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01z"}),(0,J.jsx)("path",{fill:"currentColor",d:"M6 8a6 6 0 1 1 12 0h1a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V10a2 2 0 0 1 2-2zm6-4a4 4 0 0 1 4 4H8a4 4 0 0 1 4-4m2 10a2 2 0 0 1-1 1.732V17a1 1 0 1 1-2 0v-1.268A2 2 0 0 1 12 12a2 2 0 0 1 2 2"})]})})}function oa({children:e,inToolsPanel:t,info:n,selected:l,isEnhanced:o,style:r}){const[a,s]=(0,u.useState)(!1);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)("div",{className:je()({"tableberg-locked-root":!0,"tableberg-locked-root-toolbar":t}),style:r,children:[(0,J.jsx)("div",{className:"tableberg-locked-children",children:e}),(0,J.jsx)("button",{className:"tableberg-lock-overlay",onClick:()=>s(!0),"aria-label":"Unlock with Tableberg Pro",children:(0,J.jsx)("span",{className:"tableberg-lock-container",children:(0,J.jsx)(la,{height:"25px",width:"25px"})})})]}),a&&(0,na.createPortal)(n?(0,J.jsx)(Xr,{onClose:()=>s(!1),info:n}):o?(0,J.jsx)(ea,{onClose:()=>s(!1),selected:l}):(0,J.jsx)(ta,{onClose:()=>s(!1),selected:l}),document.body)]})}function ra({attributes:e,bindings:t,cellCoords:n,elementIndex:l,allowListTypeSwitch:o=!0,updateAttrs:r,ProListIconSettings:a=null}){const s=Et(),u=Ha(e=>e.updateCellElement),d=null!=r?r:e=>u(n,l,{attributes:e}),h=(t,n)=>{d({styles:{...e.styles,[t]:n}})};return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(me.InspectorControls,{children:[(0,J.jsxs)(c.PanelBody,{title:(0,i.__)("List Settings","tableberg"),initialOpen:!0,children:[o&&s&&(0,J.jsx)(c.SelectControl,{label:(0,i.__)("List Type","tableberg"),value:e.listType,options:[{label:(0,i.__)("Basic","tableberg"),value:"basic"},{label:(0,i.__)("Styled","tableberg"),value:"styled"}],onChange:e=>{d({listType:e})}}),o&&!s&&(0,J.jsx)(oa,{selected:"tableberg/styled-list",children:(0,J.jsx)(c.SelectControl,{label:(0,i.__)("List Type","tableberg"),value:e.listType,options:[{label:(0,i.__)("Basic","tableberg"),value:"basic"},{label:(0,i.__)("Styled","tableberg"),value:"styled"}],onChange:()=>null})}),"basic"===e.listType&&(0,J.jsx)(c.SelectControl,{label:(0,i.__)("List Style","tableberg"),value:e.listStyle,options:[{label:(0,i.__)("Disc","tableberg"),value:"disc"},{label:(0,i.__)("Circle","tableberg"),value:"circle"},{label:(0,i.__)("Square","tableberg"),value:"square"},{label:(0,i.__)("Numbered","tableberg"),value:"decimal"},{label:(0,i.__)("None","tableberg"),value:"none"}],onChange:e=>{d({listStyle:e})}}),(0,J.jsx)(Te,{label:(0,i.__)("Item Spacing","tableberg"),value:e.styles.itemSpacing,onChange:e=>h("itemSpacing",e)})]}),"styled"===e.listType&&a,(0,J.jsx)(c.PanelBody,{title:"Font Size",initialOpen:!0,children:(0,J.jsx)(c.BaseControl,{__nextHasNoMarginBottom:!0,children:(0,J.jsx)(me.FontSizePicker,{value:e.styles.fontSize||void 0,onChange:e=>{e&&h("fontSize",String(e))}})})}),(0,J.jsx)(qa,{elementType:"list",bindings:t})]}),(0,J.jsxs)(me.InspectorControls,{group:"color",children:[(0,J.jsx)(_e,{label:(0,i.__)("Icon Color","tableberg"),value:e.styles.iconColor,onChange:e=>h("iconColor",e),onDeselect:()=>h("iconColor",aa.styles.iconColor)}),(0,J.jsx)(_e,{label:(0,i.__)("Text Color","tableberg"),value:e.styles.textColor,onChange:e=>h("textColor",e),onDeselect:()=>h("textColor",aa.styles.textColor)}),(0,J.jsx)(_e,{label:(0,i.__)("Link Color","tableberg"),value:e.styles.linkColor,onChange:e=>h("linkColor",e),onDeselect:()=>h("linkColor",aa.styles.linkColor)}),(0,J.jsx)(_e,{label:(0,i.__)("Background Color","tableberg"),value:e.styles.backgroundColor,onChange:e=>h("backgroundColor",e),onDeselect:()=>h("backgroundColor",aa.styles.backgroundColor)})]})]})}const aa={align:"left",items:[{content:"",indentLevel:0}],listType:"basic",listStyle:"disc",styles:{itemSpacing:"0",iconColor:"#000000",iconSize:"15px",iconSpacing:"var(--wp--preset--spacing--20)",iconTopSpacing:"0px",fontSize:"1.38rem",textColor:"#000000",linkColor:"",backgroundColor:""}};function sa({attributes:e,bindings:t,cellCoords:n,elementIndex:l,forcedListType:o,allowListTypeSwitch:r=!0,ProListItemIcon:s=null,ProListIconSettings:d=null}){const h=(0,u.useRef)(null),b=(0,u.useRef)([]),[p,g]=(0,u.useState)(0),f=Ha(e=>e.sortPreviewMode),m=Ha(e=>e.isElementSelected),v=Ha(e=>e.setSelectedElement),x=Ha(e=>e.clearSelectedElement),y=Rt(),C=Et(),w=m(n,l),{values:_,isLoading:k}=Ga(t);st({ref:h,onClickOutside:()=>{w&&x()}});const j=Ze(e,aa,t,_,(0,i.__)("(No data)","tableberg")),S=Ha(e=>e.updateCellElement),P=o?{...j,listType:o}:C||"styled"!==j.listType?j:{...j,listType:"basic"},R=b.current,B=(0,u.useCallback)((e,t)=>{S(n,l,{attributes:{items:e}}),void 0!==t&&setTimeout(()=>{const e=R[t];e&&e.focus()},0)},[n,l,S,R]),T=(0,u.useCallback)((e,t)=>{var n;const l=void 0!==t&&null!==(n=P.items[t]?.indentLevel)&&void 0!==n?n:0,o=null!=e?e:P.items.length,r=[...P.items.slice(0,o),{content:"",indentLevel:l},...P.items.slice(o)];B(r,o)},[P.items,B]),I=(0,u.useCallback)(e=>{if(P.items.length<=1)B([{content:"",indentLevel:0}],0);else{const t=P.items.filter((t,n)=>n!==e);B(t,e>0?e-1:0)}},[P.items,B]),E=(0,u.useCallback)(e=>{var t,n;return 0!==e&&(null!==(t=P.items[e]?.indentLevel)&&void 0!==t?t:0)<=(null!==(n=P.items[e-1]?.indentLevel)&&void 0!==n?n:0)},[P.items]),O=(0,u.useCallback)(e=>{var t;return(null!==(t=P.items[e]?.indentLevel)&&void 0!==t?t:0)>0},[P.items]),M=(0,u.useCallback)(e=>{var t;if(!E(e))return;const o=[...P.items],r=null!==(t=o[e]?.indentLevel)&&void 0!==t?t:0;o[e]={...o[e],indentLevel:r+1},S(n,l,{attributes:{items:o}}),setTimeout(()=>{R[e]?.focus()},0)},[P.items,n,l,S,E,R]),A=(0,u.useCallback)(e=>{var t;if(!O(e))return;const o=[...P.items],r=null!==(t=o[e]?.indentLevel)&&void 0!==t?t:0;o[e]={...o[e],indentLevel:r-1},S(n,l,{attributes:{items:o}}),setTimeout(()=>{R[e]?.focus()},0)},[P.items,n,l,S,O,R]),N=(0,u.useCallback)((e,t)=>{const o=[...P.items];o[e]={...o[e],content:t},S(n,l,{attributes:{items:o}})},[P.items,n,l,S]),D=(0,u.useCallback)((e,t)=>{"Enter"===t.key&&(t.preventDefault(),T(e+1,e)),"Tab"===t.key&&(t.preventDefault(),t.stopPropagation(),t.shiftKey?A(e):M(e)),"Backspace"===t.key&&""===P.items[e].content&&(t.preventDefault(),O(e)?A(e):I(e))},[T,M,A,I,O,P.items]),L={listStyleType:"none",margin:0},F=P.styles.iconSize||"15px",V=`calc(max(0px, (1.5 * ${P.styles.fontSize||"1.38rem"} - ${F}) / 2) + ${P.styles.iconTopSpacing||"0px"})`,H={color:P.styles.iconColor||void 0,width:F,height:F,minWidth:F,flex:"0 0 auto",display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:0,marginTop:V},z={color:P.styles.iconColor||void 0,minWidth:"20px",flex:"0 0 auto",lineHeight:1.5},Z={fontSize:P.styles.fontSize||void 0,color:P.styles.textColor||void 0,"--tableberg-list-link-color":P.styles.linkColor||void 0,backgroundColor:P.styles.backgroundColor||void 0,padding:P.styles.backgroundColor?"2px 8px":void 0,borderRadius:P.styles.backgroundColor?"4px":void 0},G=(e,t,n)=>{const l={...Z,...n};return f?(0,J.jsx)(me.RichText.Content,{tagName:"span",style:l,value:e}):(0,J.jsx)(me.RichText,{ref:e=>{R[t]=e},tagName:"span",style:l,placeholder:(0,i.__)("List item","tableberg"),value:e,onChange:e=>N(t,e),onFocus:()=>g(t),onKeyDownCapture:e=>D(t,e)})},q="decimal"===P.listStyle?"ol":"ul",$=e=>e.map(e=>(0,J.jsxs)("li",{children:[G(e.item.content,e.index),e.children.length>0&&(0,J.jsx)(q,{style:{margin:0},children:$(e.children)})]},e.index)),Q=e=>e.map(e=>(0,J.jsxs)("li",{children:[(0,J.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:P.styles.iconSpacing,fontSize:P.styles.fontSize||void 0,lineHeight:1.5,padding:"2px 0",margin:P.styles.itemSpacing?`0 0 ${P.styles.itemSpacing} 0`:"0 0 2px 0"},children:["decimal"!==P.listStyle&&s&&(0,J.jsx)("span",{style:H,children:s}),"decimal"===P.listStyle&&(0,J.jsxs)("span",{style:z,children:[e.index+1,"."]}),G(e.item.content,e.index,{flex:1})]}),e.children.length>0&&(0,J.jsx)(q,{style:{...L,marginTop:"4px"},children:Q(e.children)})]},e.index)),U=function(e){const t=[],n=[];return e.forEach((e,l)=>{const o={item:e,index:l,children:[]},r=e.indentLevel;for(;n.length>0&&n[n.length-1].level>=r;)n.pop();0===n.length?t.push(o):n[n.length-1].node.children.push(o),n.push({node:o,level:r})}),t}(P.items),W={display:"flex",justifyContent:a(P.align)};return(0,J.jsxs)(J.Fragment,{children:[w&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(me.BlockControls,{children:[(0,J.jsx)(He,{title:(0,i.__)("Align list","tableberg"),value:P.align,onChange:e=>{"left"!==e&&"center"!==e&&"right"!==e||S(n,l,{attributes:{align:e}})},controlset:"alignment"}),(0,J.jsx)(c.ToolbarButton,{icon:un,label:(0,i.__)("Outdent","tableberg"),onClick:()=>A(p),disabled:!O(p)}),(0,J.jsx)(c.ToolbarButton,{icon:dn,label:(0,i.__)("Indent","tableberg"),onClick:()=>M(p),disabled:!E(p)}),(0,J.jsx)(bt,{cellCoords:n,elementIndex:l})]}),(0,J.jsx)(Pt,{cellCoords:n,elementIndex:l}),(0,J.jsx)(ra,{attributes:P,bindings:t,cellCoords:n,elementIndex:l,allowListTypeSwitch:r,ProListIconSettings:d})]}),(0,J.jsx)("div",{ref:h,className:"tableberg-list",style:W,onClick:e=>{e.stopPropagation(),f||(v(n,l),h.current&&y(h.current,"List","A list element within a Tableberg cell"))},children:k?(0,J.jsx)("p",{style:{margin:0},children:(0,i.__)("Loading...","tableberg")}):"basic"===P.listType?(0,J.jsx)(q,{style:{margin:0,paddingLeft:"20px"},children:$(U)}):(0,J.jsx)(q,{style:{...L,paddingLeft:0},children:Q(U)})})]})}const ia=[{path:"styles.iconColor",label:(0,i.__)("Icon Color","tableberg")},{path:"styles.textColor",label:(0,i.__)("Text Color","tableberg")},{path:"styles.linkColor",label:(0,i.__)("Link Color","tableberg")},{path:"styles.backgroundColor",label:(0,i.__)("Background Color","tableberg")},{path:"styles.fontSize",label:(0,i.__)("Font Size","tableberg")}];function ca(e){switch(e.name){case"text":case"button":return e.attributes.content||"";default:return""}}function ua(e){switch(e){case"text":return{name:"text",attributes:{...Mt}};case"button":return{name:"button",attributes:{...qt}};case"image":return{name:"image",attributes:{...an}};case"list":return{name:"list",attributes:{...aa}};default:return function(e){var t;return null!==(t=Ke(e)?.create())&&void 0!==t?t:null}(e)}}function da(e,t,n){return e[ge(t,n)]?.elements||[]}function ha(e){return Object.values(e).some(e=>{const t=e.span?.rowSpan||1,n=e.span?.colSpan||1;return t>1||n>1})}function ba(e,t,n,l,o,r){const{headerEnabled:a,footerEnabled:s}=n,i=a?0:-1,c=s?t-1:-1,u=[];for(let n=0;n<t;n++){if(n===i||n===c)continue;const t=da(e,n,l);let r,a="";switch(t.length>0&&(a=ca(t[0])),o){case"number":{const e=a.replace(/[^0-9.-]/g,""),t=parseFloat(e);r=isNaN(t)?0:t;break}case"date":{const e=new Date(a);r=isNaN(e.getTime())?new Date(0):e;break}default:r=a.toLowerCase()}u.push({index:n,value:r})}u.sort(({value:e},{value:t})=>{let n;return n="number"==typeof e&&"number"==typeof t?e-t:e instanceof Date&&t instanceof Date?e.getTime()-t.getTime():String(e).localeCompare(String(t)),"asc"===r?n:-n});const d=[];a&&d.push(0);for(const{index:e}of u)d.push(e);return s&&d.push(t-1),d}function pa(e){return Object.values(e).some(e=>(e.span?.rowSpan||1)>1)}function ga(e,t,n,l){let o=e;return n&&o--,l&&o--,o<=0||t<=0?1:Math.ceil(o/t)}function fa(e){return JSON.parse(JSON.stringify(e))}function ma(e){return e?.span||{rowSpan:1,colSpan:1}}function va(e){const t=new Map;return Object.entries(e).forEach(([e,n])=>{t.set(e,ma(n))}),t}function xa(e,t){const n=[];return Object.entries(e).forEach(([e,l])=>{if(null==l)return;const o=Number(e);n[o>=t?o+1:o]=l}),n}function ya(e,t){const n=[];return Object.entries(e).forEach(([e,l])=>{if(null==l)return;const o=Number(e);o!==t&&(n[o>t?o-1:o]=l)}),n}function Ca(e,t){const n=[];return Object.entries(e).forEach(([e,l])=>{if(null==l)return;const o=Number(e);n[t(o)]=l}),n}function wa(e,t){return t<=0?0:t>=e.rows-1?e.rows-1:t}function _a(e,t){return t<=0?0:t>=e.cols-1?e.cols-1:t}function ka(e){return Object.values(e).some(e=>{const t=ma(e);return t.rowSpan>1||t.colSpan>1})}function ja(e,t,n,l,o,r){const a=function(e,t){return t<=0?0:t>=e.rows?e.rows:t}(e,o),s=new Set,i={};Object.entries(l).forEach(([e,t])=>{const[n,l]=fe(e),o=ma(t),r=fa(t);if(n<a&&n+o.rowSpan>a){r.span={rowSpan:o.rowSpan+1,colSpan:o.colSpan};for(let e=l;e<l+o.colSpan;e++)s.add(e);i[ge(n,l)]=r}else n>=a?i[ge(n+1,l)]=r:i[ge(n,l)]=r});for(let t=0;t<e.cols;t++)if(!s.has(t)){const e=ge(a,t);i[e]=r?{elements:[fa(r)]}:{}}return{table:{...e,rows:e.rows+1},rows:xa(t,a),columns:n.slice(),cells:i}}function Sa(e,t,n,l,o,r){const a=function(e,t){return t<=0?0:t>=e.cols?e.cols:t}(e,o),s=new Set,i={};Object.entries(l).forEach(([e,t])=>{const[n,l]=fe(e),o=ma(t),r=fa(t);if(l<a&&l+o.colSpan>a){r.span={rowSpan:o.rowSpan,colSpan:o.colSpan+1};for(let e=n;e<n+o.rowSpan;e++)s.add(e);i[ge(n,l)]=r}else l>=a?i[ge(n,l+1)]=r:i[ge(n,l)]=r});for(let t=0;t<e.rows;t++)if(!s.has(t)){const e=ge(t,a);i[e]=r?{elements:[fa(r)]}:{}}return{table:{...e,cols:e.cols+1},rows:t.slice(),columns:xa(n,a),cells:i}}function Pa(e,t,n){const l={...n};return!t||void 0===t.span&&void 0===t.elements&&void 0===t.styles&&void 0===t.ribbon?(delete l[e],l):(l[e]=t,l)}function Ra(e){return fe(e)[0]}function Ba(e){return fe(e)[1]}function Ta(e,t){if(0===t.length)return[];const n=new Set(t);return Object.keys(e).filter(e=>n.has(fe(e)[0]))}function Ia(e,t){const n=function(e){const t=new Set;return Object.values(e).forEach(e=>{(e.elements||[]).forEach(e=>{Object.values(e.bindings||{}).forEach(e=>{e&&t.add(e)})})}),t}(t),l={};return Object.entries(e).forEach(([e,t])=>{n.has(e)&&(l[e]=t)}),l}const Ea=(e,t,n)=>n.headerEnabled&&0===e?"header":n.footerEnabled&&e===t-1?"footer":(n.headerEnabled?e-1:e)%2==0?"odd":"even",Oa=({table:e,cells:t,cellDefaults:n})=>{const l=function(e){const t=new Map;return Object.entries(e).forEach(([e,n])=>{n.styles&&t.set(e,n.styles)}),t}(t),o={};return["header","even","odd","footer"].forEach(r=>{const a=[];for(let t=0;t<e.rows;t++)Ea(t,e.rows,e)===r&&a.push(t);const s=((e,t,n)=>{if(0===e.length)return;let l,o=!1;for(const r of e){const e=t.get(r),a=e?.backgroundColor?.trim();a&&(o=!0);const s=a||n;if(void 0!==l){if(l!==s)return}else l=s}return l&&o?l:void 0})(Ta(t,a),l,n.styles.backgroundColor);s&&(o[r]=s)}),o},Ma=(e,t,n,l,o)=>{if(0===t.length)return e;let r={...e};return t.forEach(e=>{const[t]=fe(e),a=Ea(t,n,l),s=o[a];if(!s)return;const i=r[e]||{};r=Pa(e,{...i,styles:{...i.styles||{},backgroundColor:s}},r)}),r};function Aa(e){return be((t,n)=>{const l=e||pe,o={...l,selectedCells:[],nativeSelectedCells:[],selectedElement:null,selectedRibbonCell:null,tableEditPreview:null,sortPreviewMode:!1,previewSortColumn:null,previewSortOrder:"asc",currentPage:0,searchTerm:"",showCaption:!!l.table.caption,showRowColumnControls:!0,showDuplicateMoveControls:!0};return{...o,setTable:e=>t({table:e}),setCells:e=>t(t=>({cells:e,bindings:Ia(t.bindings,e)})),setCellDefaults:e=>t({cellDefaults:e}),setBindings:e=>t({bindings:e}),updateTable:e=>t(t=>({table:{...t.table,...e}})),updateCellGlobalStyles:e=>t(t=>{const n=Object.keys(e);return{cells:Object.fromEntries(Object.entries(t.cells).map(([e,t])=>{if(!t.styles)return[e,t];const l={...t.styles};return n.forEach(e=>{delete l[e]}),[e,{...t,styles:Object.keys(l).length>0?l:void 0}]})),cellDefaults:{styles:{...t.cellDefaults.styles,...e}}}}),updateCellStyles:(e,n)=>{t(t=>{const l=t.cells[e]||{};return{cells:Pa(e,{...l,styles:{...l.styles||{},...n}},t.cells)}})},getCellStyle:e=>n().cells[e]?.styles,getCellSpan:e=>n().cells[e]?.span||{rowSpan:1,colSpan:1},getCellRibbon:e=>n().cells[e]?.ribbon,setCellRibbon:(e,n)=>{t(t=>{const l=t.cells[e]||{};return{cells:Pa(e,{...l,ribbon:n},t.cells)}})},addElementToCell:(e,n)=>{t(t=>{const l=[...t.cells[e]?.elements||[],n];let o=0;return o=l.length-1,{cells:Pa(e,{...t.cells[e]||{},elements:l},t.cells),selectedElement:{cell:e,elementIndex:o},selectedRibbonCell:null}})},insertElementInCell:(e,n,l)=>{t(t=>{const o=t.cells[e],r=[...t.cells[e]?.elements||[]];if(!o&&0!==n)return t;if(0===r.length&&0===n)return{cells:Pa(e,{...o||{},elements:[l]},t.cells),selectedElement:{cell:e,elementIndex:0},selectedRibbonCell:null};if(0===r.length&&0!==n)return t;const a=Math.max(0,Math.min(n,r.length));return r.splice(a,0,l),{cells:Pa(e,{...o||{},elements:r},t.cells),selectedElement:{cell:e,elementIndex:a},selectedRibbonCell:null}})},reorderElementsInCell:(e,n)=>{t(t=>{const l=t.cells[e];if(!l)return t;const o=[...l.elements||[]];if(o.length!==n.length)return t;const r=new Set;for(const e of n){if(e<0||e>=o.length||r.has(e))return t;r.add(e)}const a=n.map(e=>o[e]);if(!a.some((e,t)=>e!==o[t]))return t;const s=Pa(e,{...l,elements:a},t.cells);let i=t.selectedElement;if(i&&i.cell===e){const t=n.findIndex(e=>e===i?.elementIndex);i=-1===t?null:{cell:e,elementIndex:t}}return{cells:s,selectedElement:i}})},duplicateElementInCell:(e,n)=>{t(t=>{const l=t.cells[e];if(!l)return t;const o=[...l.elements||[]],r=o[n];if(!r)return t;const a=n+1;return o.splice(a,0,yt(r)),{cells:Pa(e,{...l,elements:o},t.cells),selectedElement:{cell:e,elementIndex:a},selectedRibbonCell:null}})},removeElementFromCell:(e,n)=>{t(t=>{const l=t.cells[e];if(!l)return t;const o=[...l.elements||[]];if(n<0||n>=o.length)return t;o.splice(n,1);const r=Pa(e,{...l,elements:o},t.cells);let a=t.selectedElement;return a&&a.cell===e&&(a.elementIndex===n?a=null:a.elementIndex>n&&(a={cell:a.cell,elementIndex:a.elementIndex-1})),{cells:r,bindings:Ia(t.bindings,r),selectedElement:a}})},updateCellElement:(e,n,l)=>{t(t=>{const o=t.cells[e];if(!o)return t;const r=[...o.elements||[]];return n>=r.length?t:(r[n]={...r[n],attributes:{...r[n].attributes,...l.attributes}},{cells:Pa(e,{...o,elements:r},t.cells)})})},updateSelectedElementStyles:e=>{const{selectedElement:l}=n();l&&t(t=>{const n=t.cells[l.cell];if(!n)return t;const o=[...n.elements||[]],r=l.elementIndex;if(r>=o.length)return t;const a=o[r],s=a.attributes.styles||{};return o[r]={...a,attributes:{...a.attributes,styles:{...s,...e}}},{cells:Pa(l.cell,{...n,elements:o},t.cells)}})},updateSelectedElementAttrs:e=>{const{selectedElement:l}=n();l&&t(t=>{const n=t.cells[l.cell];if(!n)return t;const o=[...n.elements||[]],r=l.elementIndex;if(r>=o.length)return t;const a=o[r];return o[r]={...a,attributes:{...a.attributes,...e}},{cells:Pa(l.cell,{...n,elements:o},t.cells)}})},updateSelectedElementBindings:e=>{const{selectedElement:l}=n();l&&t(t=>{const n=t.cells[l.cell];if(!n)return t;const o=[...n.elements||[]],r=l.elementIndex;if(r>=o.length)return t;const a={...o[r],bindings:e};void 0===e&&delete a.bindings,o[r]=a;const s=Pa(l.cell,{...n,elements:o},t.cells);return{cells:s,bindings:Ia(t.bindings,s)}})},createBindingDefinition:e=>{const n=`${Math.random().toString(36).slice(2,10)}`;return t(t=>({bindings:{...t.bindings,[n]:e}})),n},updateBindingDefinition:(e,n)=>{t(t=>({bindings:{...t.bindings,[e]:n}}))},removeBindingDefinition:e=>{t(t=>{const n={...t.bindings};return delete n[e],{bindings:n}})},replaceCellElement:(e,n,l)=>{t(t=>{const o=t.cells[e];if(!o)return t;const r=[...o.elements||[]];if(n>=r.length)return t;r[n]=l;const a=Pa(e,{...o,elements:r},t.cells);return{cells:a,bindings:Ia(t.bindings,a)}})},setSelectedCells:e=>t(t=>t.selectedCells.length===e.length&&t.selectedCells.every((t,n)=>t===e[n])?t:{selectedCells:e}),setNativeSelectedCells:e=>t(t=>t.nativeSelectedCells.length===e.length&&t.nativeSelectedCells.every((t,n)=>t===e[n])?t:{nativeSelectedCells:e}),setSelectedElement:(e,n)=>{t(t=>t.selectedElement?.cell===e&&t.selectedElement.elementIndex===n?t:{selectedElement:{cell:e,elementIndex:n}})},clearSelectedElement:()=>{t(e=>null===e.selectedElement?e:{selectedElement:null})},isElementSelected:(e,t)=>{const{selectedElement:l}=n();return null!==l&&l.cell===e&&l.elementIndex===t},setSelectedRibbon:e=>{t(t=>t.selectedRibbonCell===e&&null===t.selectedElement?t:{selectedRibbonCell:e,selectedElement:null})},clearSelectedRibbon:()=>{t(e=>null===e.selectedRibbonCell?e:{selectedRibbonCell:null})},isRibbonSelected:e=>{const{selectedRibbonCell:t}=n();return null!==t&&t===e},setTableEditPreview:e=>{t(t=>{const n=t.tableEditPreview;return n?.operation===e?.operation&&n?.target===e?.target&&n?.index===e?.index||null===n&&null===e?t:{tableEditPreview:e}})},clearTableEditPreview:()=>{t(e=>null===e.tableEditPreview?e:{tableEditPreview:null})},addSelectedCells:e=>t(t=>{const n=[...t.selectedCells];for(const t of e){const e=n.indexOf(t);-1===e?n.push(t):n.splice(e,1)}return{selectedCells:n}}),setColumnSortable:(e,n)=>{t(t=>{const l=t.columns.slice();if(void 0===n){if(l[e]){const{sortable:t,...n}=l[e];l[e]=0===Object.keys(n).length?null:n}}else l[e]={...l[e],sortable:n};return{columns:l}})},setColumnWidth:(e,n)=>{t(t=>{const l=t.columns.slice(),o=n?.trim();if(o)l[e]={...l[e],width:o};else if(l[e]){const{width:t,...n}=l[e];0===Object.keys(n).length?delete l[e]:l[e]=n}return{columns:l}})},insertRow:e=>{t(t=>{var n;const l=Math.max(0,Math.min(e,t.table.rows)),o=Oa({table:t.table,cells:t.cells,cellDefaults:t.cellDefaults}),r=null!==(n=ua("text"))&&void 0!==n?n:void 0,a=ja(t.table,t.rows,t.columns,t.cells,l,r),s=((e,t,n,l)=>{const o=new Set,r=t+1;l[Ea(e,r,n)]&&o.add(e);for(let a=e;a<t;a++){const e=a+1,s=Ea(a,t,n),i=Ea(e,r,n);s!==i&&l[i]&&o.add(e)}return Array.from(o)})(l,t.table.rows,t.table,o),i=Ma(a.cells,Ta(a.cells,s),a.table.rows,t.table,o),c=t.selectedCells.length>0?Ba(t.selectedCells[0]):0,u=Math.max(0,Math.min(c,a.table.cols-1));return{table:a.table,rows:a.rows,columns:a.columns,cells:i,selectedCells:[ge(l,u)],selectedElement:null,selectedRibbonCell:null}})},deleteRow:e=>{t(t=>{if(t.table.rows<=1)return t;const n=Math.max(0,Math.min(e,t.table.rows-1)),l=function(e,t,n,l,o){const r=wa(e,o),a=va(l),s={};return Object.entries(l).forEach(([e,t])=>{const[n,l]=fe(e),o=a.get(e)||{rowSpan:1,colSpan:1},i=fa(t);if(n!==r){if(!(n>r))return n<r&&n+o.rowSpan>r?(i.span={rowSpan:o.rowSpan-1,colSpan:o.colSpan},void(s[ge(n,l)]=i)):void(s[ge(n,l)]=i);s[ge(n-1,l)]=i}else o.rowSpan>1&&(i.span={rowSpan:o.rowSpan-1,colSpan:o.colSpan},s[ge(n,l)]=i)}),{table:{...e,rows:e.rows-1},rows:ya(t,r),columns:n.slice(),cells:s}}(t.table,t.rows,t.columns,t.cells,n),o=t.selectedCells.length>0?Ba(t.selectedCells[0]):0,r=Math.max(0,Math.min(o,l.table.cols-1)),a=Math.max(0,Math.min(n,l.table.rows-1));return{table:l.table,rows:l.rows,columns:l.columns,cells:l.cells,bindings:Ia(t.bindings,l.cells),selectedCells:[ge(a,r)],selectedElement:null,selectedRibbonCell:null}})},insertColumn:e=>{t(t=>{var n;const l=Math.max(0,Math.min(e,t.table.cols)),o=Oa({table:t.table,cells:t.cells,cellDefaults:t.cellDefaults}),r=null!==(n=ua("text"))&&void 0!==n?n:void 0,a=Sa(t.table,t.rows,t.columns,t.cells,l,r),s=Object.keys(a.cells).filter(e=>Ba(e)===l),i=Ma(a.cells,s,a.table.rows,t.table,o),c=t.selectedCells.length>0?Ra(t.selectedCells[0]):0,u=Math.max(0,Math.min(c,a.table.rows-1));return{table:a.table,rows:a.rows,columns:a.columns,cells:i,selectedCells:[ge(u,l)],selectedElement:null,selectedRibbonCell:null}})},deleteColumn:e=>{t(t=>{if(t.table.cols<=1)return t;const n=Math.max(0,Math.min(e,t.table.cols-1)),l=function(e,t,n,l,o){const r=_a(e,o),a=va(l),s={};return Object.entries(l).forEach(([e,t])=>{const[n,l]=fe(e),o=a.get(e)||{rowSpan:1,colSpan:1},i=fa(t);if(l!==r){if(!(l>r))return l<r&&l+o.colSpan>r?(i.span={rowSpan:o.rowSpan,colSpan:o.colSpan-1},void(s[ge(n,l)]=i)):void(s[ge(n,l)]=i);s[ge(n,l-1)]=i}else o.colSpan>1&&(i.span={rowSpan:o.rowSpan,colSpan:o.colSpan-1},s[ge(n,l)]=i)}),{table:{...e,cols:e.cols-1},rows:t.slice(),columns:ya(n,r),cells:s}}(t.table,t.rows,t.columns,t.cells,n),o=t.selectedCells.length>0?Ra(t.selectedCells[0]):0,r=Math.max(0,Math.min(o,l.table.rows-1)),a=Math.max(0,Math.min(n,l.table.cols-1));return{table:l.table,rows:l.rows,columns:l.columns,cells:l.cells,bindings:Ia(t.bindings,l.cells),selectedCells:[ge(r,a)],selectedElement:null,selectedRibbonCell:null}})},duplicateRow:e=>{t(t=>{if(ka(t.cells))return t;const n=Math.max(0,Math.min(e,t.table.rows-1)),l=function(e,t,n,l,o){const r=wa(e,o),a=ja(e,t,n,l,r+1),s=r+1,i={...a.cells};for(let e=0;e<a.table.cols;e++){const t=l[ge(r,e)],n=ge(s,e);i[n]=t?fa(t):{...i[n],elements:[]}}const c=a.rows.slice();return t[r]&&(c[s]=fa(t[r])),{...a,rows:c,cells:i}}(t.table,t.rows,t.columns,t.cells,n),o=t.selectedCells.length>0?Ba(t.selectedCells[0]):0,r=Math.max(0,Math.min(o,l.table.cols-1));return{table:l.table,rows:l.rows,columns:l.columns,cells:l.cells,selectedCells:[ge(n+1,r)],selectedElement:null,selectedRibbonCell:null}})},duplicateColumn:e=>{t(t=>{if(ka(t.cells))return t;const n=Math.max(0,Math.min(e,t.table.cols-1)),l=function(e,t,n,l,o){const r=_a(e,o),a=Sa(e,t,n,l,r+1),s=r+1,i={...a.cells};for(let e=0;e<a.table.rows;e++){const t=l[ge(e,r)],n=ge(e,s);i[n]=t?fa(t):{...i[n],elements:[]}}const c=a.columns.slice();return n[r]&&(c[s]=fa(n[r])),{...a,columns:c,cells:i}}(t.table,t.rows,t.columns,t.cells,n),o=t.selectedCells.length>0?Ra(t.selectedCells[0]):0,r=Math.max(0,Math.min(o,l.table.rows-1));return{table:l.table,rows:l.rows,columns:l.columns,cells:l.cells,selectedCells:[ge(r,n+1)],selectedElement:null,selectedRibbonCell:null}})},moveRow:(e,n)=>{t(t=>{if(ka(t.cells))return t;if(e<0||e>=t.table.rows||n<0||n>=t.table.rows)return t;const l=function(e,t,n,l,o,r){const a=wa(e,o),s=wa(e,r);if(a===s)return{table:e,rows:t,columns:n,cells:l};const i=e=>e===a?s:a<s&&e>a&&e<=s?e-1:a>s&&e>=s&&e<a?e+1:e,c={};return Object.entries(l).forEach(([e,t])=>{const[n,l]=fe(e);c[ge(i(n),l)]=fa(t)}),{table:{...e},rows:Ca(t,i),columns:n.slice(),cells:c}}(t.table,t.rows,t.columns,t.cells,e,n),o=t.selectedCells.length>0?Ba(t.selectedCells[0]):0,r=Math.max(0,Math.min(o,l.table.cols-1));return{table:l.table,rows:l.rows,columns:l.columns,cells:l.cells,selectedCells:[ge(n,r)],selectedElement:null,selectedRibbonCell:null}})},moveColumn:(e,n)=>{t(t=>{if(ka(t.cells))return t;if(e<0||e>=t.table.cols||n<0||n>=t.table.cols)return t;const l=function(e,t,n,l,o,r){const a=_a(e,o),s=_a(e,r);if(a===s)return{table:e,rows:t,columns:n,cells:l};const i=e=>e===a?s:a<s&&e>a&&e<=s?e-1:a>s&&e>=s&&e<a?e+1:e,c={};return Object.entries(l).forEach(([e,t])=>{const[n,l]=fe(e);c[ge(n,i(l))]=fa(t)}),{table:{...e},rows:t.slice(),columns:Ca(n,i),cells:c}}(t.table,t.rows,t.columns,t.cells,e,n),o=t.selectedCells.length>0?Ra(t.selectedCells[0]):0,r=Math.max(0,Math.min(o,l.table.rows-1));return{table:l.table,rows:l.rows,columns:l.columns,cells:l.cells,selectedCells:[ge(r,n)],selectedElement:null,selectedRibbonCell:null}})},getColumnConfig:e=>n().columns[e]||void 0,setRowHeight:(e,n)=>{t(t=>{const l=t.rows.slice(),o=n?.trim();if(o)l[e]={...l[e],height:o};else if(l[e]){const{height:t,...n}=l[e];0===Object.keys(n).length?delete l[e]:l[e]=n}return{rows:l}})},getRowConfig:e=>n().rows[e]||void 0,isColumnSortableAllowed:e=>function(e,t){return!ha(t)&&!function(e,t){return Object.entries(t).some(([t,n])=>{const[,l]=t.split(",").map(Number);return l===e&&(n.elements?.length||0)>1})}(e,t)}(e,n().cells),enterSortPreviewMode:()=>{t({sortPreviewMode:!0,previewSortColumn:null,previewSortOrder:"asc",selectedCells:[]})},exitSortPreviewMode:()=>{t({sortPreviewMode:!1,previewSortColumn:null,previewSortOrder:"asc"})},setPreviewSort:(e,n)=>{t(t=>({previewSortColumn:e,previewSortOrder:n||t.previewSortOrder}))},togglePreviewSort:e=>{t(t=>t.previewSortColumn===e?"asc"===t.previewSortOrder?{previewSortOrder:"desc"}:{previewSortColumn:null,previewSortOrder:"asc"}:{previewSortColumn:e,previewSortOrder:"asc"})},getSortedRowIndices:()=>{const{sortPreviewMode:e,previewSortColumn:t,previewSortOrder:l,table:o,columns:r,cells:a}=n();if(!e||null===t)return Array.from({length:o.rows},(e,t)=>t);const s=r[t]?.sortable||"text";return ba(a,o.rows,o,t,s,l)},setCurrentPage:e=>{t({currentPage:e})},setPaginationConfig:e=>{t(t=>{const n={...t.table.pagination,...e},l=ga(t.table.rows,n.pageSize,t.table.headerEnabled,t.table.footerEnabled),o=Math.max(0,l-1),r=Math.min(t.currentPage,o);return{table:{...t.table,pagination:n},currentPage:r}})},isPaginationAllowed:()=>!pa(n().cells),setSearchTerm:e=>{t(t=>({searchTerm:e,currentPage:0}))},setShowCaption:e=>{t(t=>t.showCaption===e?t:{showCaption:e})},toggleRowColumnControls:()=>{t(e=>({showRowColumnControls:!e.showRowColumnControls}))},toggleDuplicateMoveControls:()=>{t(e=>({showDuplicateMoveControls:!e.showDuplicateMoveControls}))},getFilteredRowIndices:()=>{const{searchTerm:e,table:t,cells:l}=n();return t.search?.enabled&&e.trim()?ut(l,t.rows,t.cols,t,e):Array.from({length:t.rows},(e,t)=>t)},setTableAttrs:e=>t({...e}),getTableAttrs:()=>{const{version:e,isExample:t,table:l,rows:o,columns:r,cells:a,bindings:s,cellDefaults:i}=n();return{version:e,isExample:t,table:l,rows:o,columns:r,cells:a,bindings:s,cellDefaults:i}},setAttrVersion:e=>t(t=>t.version===e?t:{version:e}),reset:()=>t(o)}})}const Na=(0,u.createContext)(null),Da={},La=[],Fa={};function Va({children:e,attributes:t,setAttributes:n,contentSyncDisabled:l=!1}){const o=(0,u.useRef)(null),r=e=>{if(Array.isArray(e))return e;if(!e||"object"!=typeof e)return[];const t=[];for(const[n,l]of Object.entries(e)){const e=Number(n);Number.isInteger(e)&&e>=0&&(t[e]=l)}return t},a=e=>{if(!e)return pe.table;for(const t of Object.keys(pe.table))if(!(t in e))return{...pe.table,...e};return e};var s,i,c,d;return o.current||(o.current=Aa((s=t,l?{...s,table:a(s.table),cells:null!==(i=s.cells)&&void 0!==i?i:Da,rows:null!==(c=s.rows)&&void 0!==c?c:La,columns:r(s.columns),bindings:null!==(d=s.bindings)&&void 0!==d?d:Fa}:s))),(0,u.useEffect)(()=>{o.current&&o.current.setState(((e,t)=>{var n;if(!l)return e;const{cells:o,rows:s,...i}=e;return{...i,table:(c=a(e.table),u=t.table,!u||c.rows===u.rows&&c.cols===u.cols?c:{...c,rows:u.rows,cols:u.cols}),columns:r(e.columns),bindings:null!==(n=e.bindings)&&void 0!==n?n:Fa};var c,u})(t,o.current.getState()))},[t]),(0,u.useEffect)(()=>{if(o.current)return o.current.subscribe(e=>{n(l?{version:e.version,isExample:e.isExample,table:e.table,columns:e.columns,bindings:e.bindings,cellDefaults:e.cellDefaults}:{version:e.version,isExample:e.isExample,table:e.table,rows:e.rows,columns:e.columns,cells:e.cells,bindings:e.bindings,cellDefaults:e.cellDefaults})})},[n,l]),(0,J.jsx)(Na.Provider,{value:o.current,children:e})}function Ha(e){const t=(0,u.useContext)(Na);if(!t)throw new Error("useTableStore must be used within TableStoreProvider");return t(e)}function za(e,t){var n;if(e)return null!==(n=e.postId)&&void 0!==n?n:t}async function Za(e,t){const n=new URLSearchParams({key:e});return t&&n.append("postId",t.toString()),await ce()({path:`/tableberg/v1/dynamic-data/preview?${n.toString()}`})}function Ga(e){const t=ee(),n=Ha(e=>e.bindings),l=(0,h.useSelect)(e=>{var t;const n=e(ae.store);return null!==(t=n.getCurrentPostId?.())&&void 0!==t?t:void 0},[]),o=Object.entries(e||{}).reduce((e,[t,l])=>{const o=n[l];return o&&(e[t]=o),e},{}),r=re({queryKey:["dynamicDataBindings",l,o],queryFn:async()=>{if(!e)return{};const t={};return await Promise.all(Object.entries(o).map(async([e,n])=>{try{const a=za(n,l),s=await Za(n.key,a);var o,r;s.success&&(t[e]=null!==(o=null!==(r=s.value)&&void 0!==r?r:n.fallback)&&void 0!==o?o:null)}catch{}})),t},enabled:Object.keys(o).length>0&&!!l,staleTime:1/0}),a=(0,u.useCallback)(async()=>{e&&await t.invalidateQueries({queryKey:["dynamicDataBindings",l,o]})},[e,l,t,o]);return{values:r.data||{},isLoading:r.isLoading,isCached:Object.keys(r.data||{}).length>0&&!r.isFetching,refreshAll:a}}function qa({elementType:e,bindings:t={},postId:n}){const[l,o]=(0,u.useState)(!1),r=Ha(e=>e.bindings),a=Ha(e=>e.updateSelectedElementBindings),s=Ha(e=>e.createBindingDefinition),d=Ha(e=>e.updateBindingDefinition),b=Ha(e=>e.removeBindingDefinition),p=(0,h.useSelect)(e=>{var t;if(n)return n;const l=e(ae.store);return null!==(t=l.getCurrentPostId?.())&&void 0!==t?t:void 0},[n]),g=function(e){switch(e){case"text":return Lt;case"button":return Ut;case"image":return cn;case"list":return ia;default:return Ke(e)?.bindableAttributes||[]}}(e);if(0===g.length)return;const f=g.filter(e=>e.path in t&&!!r[t[e.path]]),m=g.filter(e=>!(e.path in t));return(0,J.jsxs)(c.PanelBody,{title:(0,i.__)("Dynamic Data","tableberg"),initialOpen:f.length>0,children:[f.map(e=>{const n=t[e.path],l=r[n];return n&&l?(0,J.jsx)(Ka,{attribute:e,binding:l,bindableAttributes:g,boundPaths:f.map(e=>e.path),onBindingChange:(l,o)=>{((e,n,l,o)=>{d(l,o);const r={...t};e!==n&&delete r[e],r[n]=l,a(r)})(e.path,l,n,o)},onRemove:()=>((e,n)=>{const l={...t};delete l[e],a(Object.keys(l).length>0?l:void 0),b(n)})(e.path,n),postId:p},e.path):null}),l&&(0,J.jsx)(Wa,{unboundAttributes:m,onApply:(e,n)=>{((e,n)=>{const l=s(n),o={...t,[e]:l};a(o)})(e,n),o(!1)},onCancel:()=>o(!1),postId:p}),!l&&m.length>0&&(0,J.jsx)("div",{className:"tableberg-dynamic-data__add",children:(0,J.jsx)(c.Button,{variant:"secondary",onClick:()=>o(!0),children:(0,i.__)("Add Binding","tableberg")})})]})}function $a({selectedPath:e,setSelectedPath:t,pathOptions:n,keyValue:l,setKeyValue:o,customPostId:r,setCustomPostId:a,fallback:s,setFallback:u,submitLabel:d,cancelLabel:h,onCancel:b,showRefresh:p,onRefresh:g,refreshLabel:f,isLoadingKeys:m,hasSuggestions:v,suggestions:x,isSuggestionsOpen:y,setIsSuggestionsOpen:C,fieldInputRef:w,previewValue:_,isDestructiveRemove:k,onRemove:j}){return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(c.SelectControl,{label:(0,i.__)("Attribute","tableberg"),value:e,onChange:t,options:n}),(0,J.jsx)(c.TextControl,{label:(0,i.__)("Post ID (optional)","tableberg"),value:r,onChange:a,placeholder:(0,i.__)("Current post","tableberg"),type:"number",help:(0,i.__)("Leave empty to use the current post","tableberg")}),(0,J.jsxs)("div",{ref:w,className:"tableberg-dynamic-data-row__field-autocomplete",children:[(0,J.jsx)(c.TextControl,{label:(0,i.__)("Field","tableberg"),value:l,onChange:e=>{o(e),C(!0)},onFocus:()=>C(!0),placeholder:(0,i.__)("Search or type field key...","tableberg"),autoComplete:"off"}),y&&!m&&v&&(0,J.jsxs)("div",{className:"tableberg-dynamic-data-row__suggestions",children:[x.postFields.length>0&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("div",{className:"tableberg-dynamic-data-row__suggestions-group",children:(0,i.__)("Post Fields","tableberg")}),x.postFields.map(e=>{var t;return(0,J.jsxs)("button",{type:"button",className:"tableberg-dynamic-data-row__suggestion"+(l===e.key?" is-selected":""),onClick:()=>{o(e.key),C(!1)},children:[(0,J.jsx)("span",{className:"tableberg-dynamic-data-row__suggestion-label",children:null!==(t=e.label)&&void 0!==t?t:e.key}),(0,J.jsx)("span",{className:"tableberg-dynamic-data-row__suggestion-key",children:e.key})]},e.key)})]}),x.metaKeys.length>0&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("div",{className:"tableberg-dynamic-data-row__suggestions-group",children:(0,i.__)("Custom Fields","tableberg")}),x.metaKeys.map(e=>{var t;return(0,J.jsxs)("button",{type:"button",className:"tableberg-dynamic-data-row__suggestion"+(l===e.key?" is-selected":""),onClick:()=>{o(e.key),C(!1)},children:[(0,J.jsx)("span",{className:"tableberg-dynamic-data-row__suggestion-label",children:null!==(t=e.label)&&void 0!==t?t:e.key}),e.label&&(0,J.jsx)("span",{className:"tableberg-dynamic-data-row__suggestion-key",children:e.key})]},e.key)})]})]}),y&&m&&(0,J.jsx)(c.Spinner,{})]}),(0,J.jsx)(c.TextControl,{label:(0,i.__)("Fallback Value","tableberg"),value:s,onChange:u,placeholder:(0,i.__)("Value if field is empty","tableberg")}),null!=_&&(0,J.jsxs)("div",{className:"tableberg-dynamic-data-row__preview",children:[(0,J.jsx)("strong",{children:(0,i.__)("Preview:","tableberg")})," ",(0,J.jsx)("span",{children:String(_)})]}),(0,J.jsxs)("div",{className:"tableberg-dynamic-data-row__actions",children:[p?(0,J.jsx)(c.Button,{variant:"secondary",type:"button",icon:"update",onClick:g,children:f||(0,i.__)("Refresh","tableberg")}):(0,J.jsx)(c.Button,{variant:"primary",type:"submit",disabled:!e||!l,children:d}),j&&(0,J.jsx)(c.Button,{variant:"link",type:"button",isDestructive:k,onClick:j,children:(0,i.__)("Remove","tableberg")}),b&&(0,J.jsx)(c.Button,{variant:"link",type:"button",onClick:b,children:h||(0,i.__)("Cancel","tableberg")})]})]})}function Qa({keyValue:e,postId:t}){const[n,l]=(0,u.useState)(!1),o=(0,u.useRef)(null),{data:r=[],isLoading:a}=re({queryKey:["metaKeys",t],queryFn:()=>async function(e){const t=new URLSearchParams;e&&t.append("postId",e.toString());const n=t.toString(),l="/tableberg/v1/dynamic-data/meta-keys"+(n?`?${n}`:"");try{return(await ce()({path:l})).keys}catch{return[]}}(t),staleTime:1/0});(0,u.useEffect)(()=>{const e=e=>{o.current&&!o.current.contains(e.target)&&l(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const s=(0,u.useMemo)(()=>{const t=e.toLowerCase();return{postFields:se.filter(e=>e.key.toLowerCase().includes(t)||e.label&&e.label.toLowerCase().includes(t)),metaKeys:r.filter(e=>e.key.toLowerCase().includes(t)||e.label&&e.label.toLowerCase().includes(t))}},[e,r]);return{fieldInputRef:o,isSuggestionsOpen:n,setIsSuggestionsOpen:l,suggestions:s,hasSuggestions:s.postFields.length>0||s.metaKeys.length>0,isLoadingKeys:a}}function Ua(e,t,n){const l={key:e};if(t){const e=parseInt(t,10);!isNaN(e)&&e>0&&(l.postId=e)}return n&&(l.fallback=n),l}function Wa({unboundAttributes:e,onApply:t,onCancel:n,postId:l}){const[o,r]=(0,u.useState)(""),[a,s]=(0,u.useState)(""),[c,d]=(0,u.useState)(""),[h,b]=(0,u.useState)(""),p=c?parseInt(c,10)||void 0:l,{fieldInputRef:g,isSuggestionsOpen:f,setIsSuggestionsOpen:m,suggestions:v,hasSuggestions:x,isLoadingKeys:y}=Qa({keyValue:a,postId:p});return(0,J.jsx)("div",{className:"tableberg-dynamic-data-row",children:(0,J.jsx)("form",{className:"tableberg-dynamic-data-row__config",onSubmit:e=>{e.preventDefault(),o&&a&&t(o,Ua(a,c,h))},children:(0,J.jsx)($a,{selectedPath:o,setSelectedPath:r,pathOptions:[{value:"",label:(0,i.__)("Select attribute...","tableberg")},...e.map(e=>({value:e.path,label:e.label}))],keyValue:a,setKeyValue:s,customPostId:c,setCustomPostId:d,fallback:h,setFallback:b,submitLabel:(0,i.__)("Apply Binding","tableberg"),cancelLabel:(0,i.__)("Cancel","tableberg"),onCancel:n,isLoadingKeys:y,hasSuggestions:x,suggestions:v,isSuggestionsOpen:f,setIsSuggestionsOpen:m,fieldInputRef:g})})})}function Ka({attribute:e,binding:t,bindableAttributes:n,boundPaths:l,onBindingChange:o,onRemove:r,postId:a}){var s,c,d,h;const[b,p]=(0,u.useState)(!1),[g,f]=(0,u.useState)(e.path),[m,v]=(0,u.useState)(t.key),[x,y]=(0,u.useState)(null!==(s=t.postId?.toString())&&void 0!==s?s:""),[C,w]=(0,u.useState)(null!==(c=t.fallback)&&void 0!==c?c:""),_=x?parseInt(x,10)||void 0:a,{fieldInputRef:k,isSuggestionsOpen:j,setIsSuggestionsOpen:S,suggestions:P,hasSuggestions:R,isLoadingKeys:B}=Qa({keyValue:m,postId:_}),T=g!==e.path||m!==t.key||x!==(null!==(d=t.postId?.toString())&&void 0!==d?d:"")||C!==(null!==(h=t.fallback)&&void 0!==h?h:""),{data:I,refresh:E}=function(e,t){var n;const l=ee(),o=za(e,t),r=re({queryKey:["dynamicData",e?.key,o],queryFn:()=>e?Za(e.key,o):null,enabled:!!e&&!!o,staleTime:1/0}),a=(0,u.useCallback)(async()=>{e&&await l.invalidateQueries({queryKey:["dynamicData",e.key,o]})},[e,o,l]);return{data:null!==(n=r.data?.value)&&void 0!==n?n:null,isLoading:r.isLoading,isCached:null!==r.data?.value&&!r.isFetching,refresh:a}}(t,a),O=x?`${t.key} (post #${x})`:t.key;return(0,J.jsxs)("div",{className:"tableberg-dynamic-data-row",children:[(0,J.jsxs)("button",{type:"button",className:"tableberg-dynamic-data-row__header",onClick:()=>p(!b),children:[(0,J.jsx)("span",{className:"tableberg-dynamic-data-row__label",children:e.label}),(0,J.jsx)("span",{className:"tableberg-dynamic-data-row__summary",children:O})]}),b&&(0,J.jsx)("form",{className:"tableberg-dynamic-data-row__config",onSubmit:e=>{e.preventDefault(),m&&o(g,Ua(m,x,C))},children:(0,J.jsx)($a,{selectedPath:g,setSelectedPath:f,pathOptions:n.filter(t=>t.path===e.path||!l.includes(t.path)).map(e=>({value:e.path,label:e.label})),keyValue:m,setKeyValue:v,customPostId:x,setCustomPostId:y,fallback:C,setFallback:w,submitLabel:(0,i.__)("Update","tableberg"),showRefresh:!T,onRefresh:()=>{E()},refreshLabel:(0,i.__)("Refresh","tableberg"),isLoadingKeys:B,hasSuggestions:R,suggestions:P,isSuggestionsOpen:j,setIsSuggestionsOpen:S,fieldInputRef:k,previewValue:I,isDestructiveRemove:!0,onRemove:r})})]})}function Ya(){const e=(0,me.useBlockProps)();return(0,J.jsx)("div",{...e,style:{padding:"8px",border:"1px dashed #949494",borderRadius:"2px",color:"#757575",fontSize:"13px"},children:"Pro element — update Tableberg Pro for native editing."})}const Ja="0,0";function Xa(e){const{bindings:t,...n}=e.current.attributes;return{[Ja]:{elements:[{name:e.current.elementName,attributes:n,...t?{bindings:t}:{}}]}}}function es(e){const t={bindings:{type:"object"},mergeOrigin:{type:"object"}};for(const[n,l]of Object.entries(e)){const e=Array.isArray(l)?"array":"number"==typeof l?"number":"boolean"==typeof l?"boolean":"object"==typeof l?"object":"string";t[n]={type:e}}return t}function ts(e,t){const n=e.replace(/^tableberg\//,"");return function(e){const{attributes:l,setAttributes:o,isSelected:r,clientId:a}=e,s=(0,u.useRef)({attributes:l,setAttributes:o,isSelected:r,clientId:a,elementName:n});s.current={attributes:l,setAttributes:o,isSelected:r,clientId:a,elementName:n};const i=(0,u.useMemo)(()=>function(e){const t=()=>(0,h.dispatch)(me.store);return be(()=>({sortPreviewMode:!1,searchTerm:"",table:{search:void 0},cells:Xa(e),isElementSelected:()=>e.current.isSelected,setSelectedElement:()=>{},clearSelectedElement:()=>{},updateCellElement:(t,n,l)=>{var o;const r={...null!==(o=l.attributes)&&void 0!==o?o:{}};void 0!==l.bindings&&(r.bindings=l.bindings),e.current.setAttributes(r)},updateSelectedElementAttrs:t=>{e.current.setAttributes(t)},updateSelectedElementStyles:t=>{var n;e.current.setAttributes({styles:{...null!==(n=e.current.attributes.styles)&&void 0!==n?n:{},...t}})},updateSelectedElementBindings:t=>{e.current.setAttributes({bindings:t})},removeElementFromCell:()=>{t().removeBlocks([e.current.clientId])},duplicateElementInCell:()=>{(0,h.select)(me.store).getBlockRootClientId(e.current.clientId),t().duplicateBlocks([e.current.clientId])},insertElementInCell:(n,l,o)=>{var r;const a=(0,h.select)(me.store),s=a.getBlockRootClientId(e.current.clientId);if(!s)return;const i=a.getBlockIndex(e.current.clientId),c={...null!==(r=o.attributes)&&void 0!==r?r:{}};o.bindings&&(c.bindings=o.bindings),t().insertBlocks((0,ve.createBlock)(`tableberg/${o.name}`,c),i+1,s)},reorderElementsInCell:()=>{}}))}(s),[]);(0,u.useEffect)(()=>{i.setState({cells:Xa(s)})},[l,i]);const c=(0,me.useBlockProps)(),{bindings:d,...b}=l,p=Object.fromEntries(Object.entries(e).filter(([e])=>e.startsWith("Pro")));return(0,J.jsx)(Na.Provider,{value:i,children:(0,J.jsx)("div",{...c,children:(0,J.jsx)(t,{...p,attributes:b,bindings:d,cellCoords:"0,0",elementIndex:0})})})}}window.TablebergProHost||(window.TablebergProHost={DynamicDataPanel:qa,ElementDeleteButton:bt,ElementOptionsButton:St,elementAlignmentToJustifyContent:a,registerFauxElementBlock:function(e,t){(0,ve.registerBlockType)(e.name,{apiVersion:3,title:e.title||e.name,category:e.category||"design",icon:t,parent:["tableberg/cell"],attributes:{},supports:{html:!1,customClassName:!1,reusable:!1},edit:Ya,save:()=>null})},useBlockCardUpdateShim:Rt,useClickOutside:st,useDynamicDataBindings:Ga,useTableStore:Ha,ListElement:sa,listAttrDefaults:aa,isNativeEditorEnabled:function(){return!0},registerNativeElementBlock:function(e){(0,ve.registerBlockType)(e.blockName,{apiVersion:3,title:e.title,category:"design",icon:e.icon,parent:["tableberg/cell"],attributes:es(e.attrDefaults),supports:{html:!1,customClassName:!1,reusable:!1},edit:ts(e.blockName,e.component),save:()=>null})}});const ns=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"tableberg/row","title":"Row","category":"design","description":"A row of cells within a Tableberg table.","parent":["tableberg/table"],"supports":{"html":false,"customClassName":false,"reusable":false},"attributes":{"height":{"type":"string"}},"providesContext":{"tableberg/rowBackgroundColor":"backgroundColor"},"textdomain":"tableberg"}'),ls={top:"",right:"",bottom:"",left:""};var os=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M21 5c0-1.1-.9-2-2-2H5c-1 0-1.9.8-2 1.8V19.2c.1.9.9 1.7 1.8 1.8H19c1.1 0 2-.9 2-2V5ZM4.5 14V5c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v9h-15Zm4 5.5H5c-.3 0-.5-.2-.5-.5v-3.5h4v4Zm5.5 0h-4v-4h4v4Zm5.5-.5c0 .3-.2.5-.5.5h-3.5v-4h4V19ZM11.2 10h-3V8.5h3v-3h1.5v3h3V10h-3v3h-1.5v-3Z"})}),rs=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M19 3H4.8c-.9.1-1.7.9-1.8 1.8V19.2c.1 1 1 1.8 2 1.8h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2Zm-9 1.5h4v4h-4v-4ZM4.5 5c0-.3.2-.5.5-.5h3.5v4h-4V5Zm15 14c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-9h15v9Zm0-10.5h-4v-4H19c.3 0 .5.2.5.5v3.5Zm-8.3 10h1.5v-3h3V14h-3v-3h-1.5v3h-3v1.5h3v3Z"})}),as=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M19 3H4.8c-.9.1-1.7.9-1.8 1.8V19.2c.1 1 1 1.8 2 1.8h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2Zm.5 16c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-9h15v9Zm0-10.5h-15V5c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v3.5Zm-9.6 9.4 2.1-2.1 2.1 2.1 1.1-1.1-2.1-2.1 2.1-2.1-1.1-1.1-2.1 2.1-2.1-2.1-1.1 1.1 2.1 2.1-2.1 2.1 1.1 1.1Z"})}),ss=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1 .8 1.9 1.8 2H19.2c.9-.1 1.7-.9 1.8-1.8V5c0-1.1-.9-2-2-2Zm-5 16.5H5c-.3 0-.5-.2-.5-.5V5c0-.3.2-.5.5-.5h9v15Zm5.5-.5c0 .3-.2.5-.5.5h-3.5v-4h4V19Zm0-5h-4v-4h4v4Zm0-5.5h-4v-4H19c.3 0 .5.2.5.5v3.5Zm-11 7.3H10v-3h3v-1.5h-3v-3H8.5v3h-3v1.5h3v3Z"})}),is=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14.2c.1.9.9 1.7 1.8 1.8H19.2c1-.1 1.8-1 1.8-2V5c0-1.1-.9-2-2-2ZM8.5 19.5H5c-.3 0-.5-.2-.5-.5v-3.5h4v4Zm0-5.5h-4v-4h4v4Zm0-5.5h-4V5c0-.3.2-.5.5-.5h3.5v4Zm11 10.5c0 .3-.2.5-.5.5h-9v-15h9c.3 0 .5.2.5.5v14Zm-4-10.8H14v3h-3v1.5h3v3h1.5v-3h3v-1.5h-3v-3Z"})}),cs=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14.2c.1.9.9 1.7 1.8 1.8H19.2c1-.1 1.8-1 1.8-2V5c0-1.1-.9-2-2-2ZM8.5 19.5H5c-.3 0-.5-.2-.5-.5V5c0-.3.2-.5.5-.5h3.5v15Zm11-.5c0 .3-.2.5-.5.5h-9v-15h9c.3 0 .5.2.5.5v14ZM16.9 8.8l-2.1 2.1-2.1-2.1-1.1 1.1 2.1 2.1-2.1 2.1 1.1 1.1 2.1-2.1 2.1 2.1 1.1-1.1-2.1-2.1L18 9.9l-1.1-1.1Z"})}),us=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2Zm.5 2v6.2h-6.8V4.4h6.2c.3 0 .5.2.5.5ZM5 4.5h6.2v6.8H4.4V5.1c0-.3.2-.5.5-.5ZM4.5 19v-6.2h6.8v6.8H5.1c-.3 0-.5-.2-.5-.5Zm14.5.5h-6.2v-6.8h6.8v6.2c0 .3-.2.5-.5.5Z"})});const ds=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"tableberg/cell","title":"Cell","category":"design","description":"A cell within a Tableberg table row.","parent":["tableberg/row"],"usesContext":["tableberg/tableConfig","tableberg/cellDefaults","tableberg/rowBackgroundColor"],"supports":{"html":false,"customClassName":false,"reusable":false},"attributes":{"span":{"type":"object"},"styles":{"type":"object"},"className":{"type":"string"}},"textdomain":"tableberg"}');function hs(e){const t=e.map(()=>[]),n=new Map;let l=0;return e.forEach((e,o)=>{let r=0;for(const a of e){for(;void 0!==t[o][r];)r++;n.set(a.id,{row:o,col:r});for(let e=0;e<a.rowSpan;e++)for(let n=0;n<a.colSpan;n++)t[o+e]&&(t[o+e][r+n]=a.id);r+=a.colSpan,r>l&&(l=r)}for(;void 0!==t[o][r];)r++,r>l&&(l=r)}),{matrix:t,anchors:n,cols:l}}function bs(e,t){for(const n of e)for(const e of n)if(e.id===t)return e;return null}function ps(e,t){var n;const{anchors:l}=hs(e);return null!==(n=l.get(t)?.col)&&void 0!==n?n:null}function gs(){return(0,ve.createBlock)("tableberg/cell",{},[(0,ve.createBlock)("tableberg/text")])}function fs(e,t){var n;const l=e.select(me.store),o=(null!==(n=l.getBlock(t)?.innerBlocks)&&void 0!==n?n:[]).filter(e=>"tableberg/row"===e.name);return{rows:o.map(e=>e.innerBlocks.filter(e=>"tableberg/cell"===e.name).map(e=>{var t,n;return{id:e.clientId,rowSpan:null!==(t=e.attributes?.span?.rowSpan)&&void 0!==t?t:1,colSpan:null!==(n=e.attributes?.span?.colSpan)&&void 0!==n?n:1}})),rowBlocks:o}}function ms(e,t){return{span:{rowSpan:e,colSpan:t}}}function vs(e,t,n,l,o){const r=t.flat().find(e=>e.id===n);r&&e.dispatch(me.store).updateBlockAttributes(n,ms(Math.max(1,r.rowSpan+l),Math.max(1,r.colSpan+o)))}function xs(e,t,n){const{rows:l}=fs(e,t),o=function(e,t){const{anchors:n,cols:l}=hs(e),o=[];let r=0;for(const l of e)for(const e of l){const l=n.get(e.id);l.row<t&&l.row+e.rowSpan>t&&(o.push(e.id),r+=e.colSpan)}return{growSpans:o,newCellCount:Math.max(0,l-r)}}(l,n),r=e.dispatch(me.store);e.batch(()=>{for(const t of o.growSpans)vs(e,l,t,1,0);const a=Array.from({length:Math.max(1,o.newCellCount)},gs);r.insertBlocks((0,ve.createBlock)("tableberg/row",{},a),n,t,!1)})}function ys(e,t,n){const{rows:l,rowBlocks:o}=fs(e,t),r=function(e,t){const{matrix:n,anchors:l,cols:o}=hs(e),r=[],a=new Set;return e.forEach((e,s)=>{if(t<o){const e=n[s][t];if(void 0!==e){const n=l.get(e);if(n.col<t)return void(n.row===s?(r.push({type:"grow",rowIndex:s,id:e}),a.add(e)):r.push({type:"skip",rowIndex:s}))}}let i=0;for(const n of e)l.get(n.id).col<t&&i++;r.push({type:"insert",rowIndex:s,insertIndex:i})}),r}(l,n),a=e.dispatch(me.store);e.batch(()=>{for(const t of r)"grow"===t.type?vs(e,l,t.id,0,1):"insert"===t.type&&a.insertBlocks(gs(),t.insertIndex,o[t.rowIndex].clientId,!1)})}const Cs="150px",ws="50px";function _s({clientId:e}){const{updateBlockAttributes:t}=(0,h.useDispatch)(me.store),n=(0,h.useSelect)(t=>{var n,l,o;const r=t(me.store),a=r.getBlockRootClientId(e),s=a?r.getBlockRootClientId(a):null;if(!a||!s)return null;const i=null!==(n=r.getBlockAttributes(s))&&void 0!==n?n:{};return{rowClientId:a,tableClientId:s,columns:Array.isArray(i.columns)?i.columns:[],column:ps((null!==(l=r.getBlock(s)?.innerBlocks)&&void 0!==l?l:[]).filter(e=>"tableberg/row"===e.name).map(e=>e.innerBlocks.filter(e=>"tableberg/cell"===e.name).map(e=>{var t,n;return{id:e.clientId,rowSpan:null!==(t=e.attributes?.span?.rowSpan)&&void 0!==t?t:1,colSpan:null!==(n=e.attributes?.span?.colSpan)&&void 0!==n?n:1}})),e),rowHeight:r.getBlockAttributes(a)?.height,fixedColumnWidths:null===(o=i.table?.fixedColumnWidths)||void 0===o||o}},[e]);if(!n)return null;const{rowClientId:l,tableClientId:o,columns:r,column:a,rowHeight:s,fixedColumnWidths:u}=n,d=null===a?void 0:r[a]?.width,b=d?"fixed":"auto",p=s?"fixed":"auto",g=e=>{var n;if(null===a)return;const l=r.slice(),{width:s,...i}=null!==(n=l[a])&&void 0!==n?n:{};l[a]=e?{...i,width:e}:i,t(o,{columns:l})},f=e=>{t(l,{height:null!=e?e:null})};return(0,J.jsx)(me.InspectorControls,{children:(0,J.jsxs)(c.PanelBody,{title:(0,i.__)("Column & Row Dimensions","tableberg"),children:[null!==a&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(c.__experimentalToggleGroupControl,{label:(0,i.__)("Width Mode","tableberg"),value:b,isBlock:!0,onChange:e=>{u||g("fixed"===(e||b)?d||Cs:void 0)},children:[(0,J.jsx)(c.__experimentalToggleGroupControlOption,{value:"auto",label:(0,i.__)("Auto","tableberg"),disabled:u}),(0,J.jsx)(c.__experimentalToggleGroupControlOption,{value:"fixed",label:(0,i.__)("Fixed","tableberg"),disabled:u})]}),"fixed"===b&&(0,J.jsx)(Ee,{label:(0,i.__)("Column Width","tableberg"),value:d||Cs,disabled:u,onChange:e=>g(e||Cs)}),u&&(0,J.jsx)("p",{style:{marginBottom:0,color:"#757575"},children:(0,i.__)("Turn off 'Equal width columns' in the table settings to set a width for this column.","tableberg")}),(0,J.jsx)("div",{style:{marginTop:"16px"}})]}),(0,J.jsxs)(c.__experimentalToggleGroupControl,{label:(0,i.__)("Height Mode","tableberg"),value:p,isBlock:!0,onChange:e=>f("fixed"===(e||p)?s||ws:void 0),children:[(0,J.jsx)(c.__experimentalToggleGroupControlOption,{value:"auto",label:(0,i.__)("Auto","tableberg")}),(0,J.jsx)(c.__experimentalToggleGroupControlOption,{value:"fixed",label:(0,i.__)("Fixed","tableberg")})]}),"fixed"===p&&(0,J.jsx)(Ee,{label:(0,i.__)("Row Height","tableberg"),value:s||ws,onChange:e=>f(e||ws)})]})})}function ks({clientId:e,cellDefaultsBackgroundColor:t,ProColumnBackgroundContent:n}){const{updateBlockAttributes:l}=(0,h.useDispatch)(me.store),o=(0,h.useRegistry)(),r=(0,h.useSelect)(n=>{var l;const o=n(me.store),r=o.getBlockRootClientId(e),a=r?o.getBlockRootClientId(r):null;if(!r||!a)return null;const s=(null!==(l=o.getBlock(a)?.innerBlocks)&&void 0!==l?l:[]).filter(e=>"tableberg/row"===e.name).map(e=>e.innerBlocks.filter(e=>"tableberg/cell"===e.name).map(e=>{var t,n;return{id:e.clientId,rowSpan:null!==(t=e.attributes?.span?.rowSpan)&&void 0!==t?t:1,colSpan:null!==(n=e.attributes?.span?.colSpan)&&void 0!==n?n:1}})),i=ps(s,e);let c=[];if(null!==i){const e=hs(s),t=new Set;for(let n=0;n<s.length;n++){const l=e.matrix[n]?.[i];l&&!t.has(l)&&(t.add(l),c.push(l))}}const u=e=>{var n;const l=o.getBlockAttributes(e),r=null!==(n=l?.backgroundColor)&&void 0!==n?n:l?.styles?.backgroundColor;return r&&""!==r.trim()?r:t};let d;if(c.length>0){const[e,...t]=c.map(u);d=t.every(t=>t===e)?e:void 0}return{columnCellIds:c,columnColor:d}},[e,t]);if(!r)return null;const a=e=>{const t=o.select(me.store);o.batch(()=>{r.columnCellIds.forEach(n=>{var o;const r=null!==(o=t.getBlockAttributes(n)?.styles)&&void 0!==o?o:{},{backgroundColor:a,...s}=r;l(n,{backgroundColor:e||null,styles:s})})})},s={columnBackgroundColorControl:{label:(0,i.__)("Column Background Color","tableberg"),value:r.columnColor,onChange:e=>a(e),onDeselect:()=>a("")}};return(0,J.jsx)(me.InspectorControls,{group:"color",children:n?n(s):(0,J.jsx)(oa,{isEnhanced:!0,selected:"col-bg",children:(0,J.jsx)(_e,{...s.columnBackgroundColorControl})})})}const js={top:"",right:"",bottom:"",left:""},Ss=e=>!!(e.top||e.right||e.bottom||e.left);function Ps({clientId:e,cellDefaultsBorder:t,ProColumnBorderContent:n}){var l;const{updateBlockAttributes:o}=(0,h.useDispatch)(me.store),r=(0,h.useRegistry)(),a=(0,h.useSelect)(n=>{var l;const o=n(me.store),r=o.getBlockRootClientId(e),a=r?o.getBlockRootClientId(r):null;if(!r||!a)return null;const s=(null!==(l=o.getBlock(a)?.innerBlocks)&&void 0!==l?l:[]).filter(e=>"tableberg/row"===e.name).map(e=>e.innerBlocks.filter(e=>"tableberg/cell"===e.name).map(e=>{var t,n;return{id:e.clientId,rowSpan:null!==(t=e.attributes?.span?.rowSpan)&&void 0!==t?t:1,colSpan:null!==(n=e.attributes?.span?.colSpan)&&void 0!==n?n:1}})),i=ps(s,e);let c=[];if(null!==i){const e=hs(s),t=new Set;for(let n=0;n<s.length;n++){const l=e.matrix[n]?.[i];l&&!t.has(l)&&(t.add(l),c.push(l))}}const u=e=>{var n;const l=o.getBlockAttributes(e),r=null!==(n=l?.border)&&void 0!==n?n:l?.styles?.border;return r&&Ss(r)?r:t};let d;if(c.length>0){const e=c.map(u),t=e[0],n=e[e.length-1];d=e.every(e=>e.left===t.left&&e.right===t.right)?{top:t.top,right:t.right,bottom:n.bottom,left:t.left}:void 0}return{columnCellIds:c,columnBorder:d}},[e,t.top,t.right,t.bottom,t.left]);if(!a)return null;const s=e=>{const t=r.select(me.store),n=a.columnCellIds.length;r.batch(()=>{a.columnCellIds.forEach((l,r)=>{var a;const s=null!==(a=t.getBlockAttributes(l)?.styles)&&void 0!==a?a:{},{border:i,...c}=s,u=r===n-1;o(l,{border:{top:0===r?e.top:"",right:e.right,bottom:u?e.bottom:"",left:e.left},styles:c})})})},c=null!==(l=a.columnBorder)&&void 0!==l?l:js,u={columnBorderControlProps:{label:(0,i.__)("Column Border","tableberg"),value:c,hasValue:()=>Ss(c),onChange:e=>s(e),onDeselect:()=>s(js)}};return(0,J.jsx)(me.InspectorControls,{group:"border",children:n?n(u):(0,J.jsx)(oa,{isEnhanced:!0,selected:"col-border",children:(0,J.jsx)(Ce,{...u.columnBorderControlProps})})})}const Rs={top:"",right:"",bottom:"",left:""},Bs=["tableberg/text","tableberg/button","tableberg/image","tableberg/list","tableberg/styled-list","tableberg/icon","tableberg/star-rating","tableberg/custom-html"];function Ts({clientId:e,hasSpan:t,proToolbarControls:n=[]}){const l=(0,h.useRegistry)(),o=Et(),[r,a]=(0,u.useState)(!1),s=Ha(e=>e.nativeSelectedCells),d=Ha(e=>e.setNativeSelectedCells),b=(0,h.useSelect)(e=>{const t=e(me.store);return t.getMultiSelectedBlockClientIds().filter(e=>"tableberg/cell"===t.getBlockName(e))},[]),p=s.length>1?s:b,g=t=>()=>{const n=function(e,t){const n=e.select(me.store),l=n.getBlockRootClientId(t);if(!l)return null;const o=n.getBlockRootClientId(l);if(!o)return null;const r=n.getBlockIndex(l),{rows:a}=fs(e,o);return{rowClientId:l,tableClientId:o,rowIndex:r,column:ps(a,t),rows:a}}(l,e);n&&null!==n.column&&t(n)},f=[{icon:os,title:(0,i.__)("Insert row above","tableberg"),onClick:g(e=>xs(l,e.tableClientId,e.rowIndex))},{icon:rs,title:(0,i.__)("Insert row below","tableberg"),onClick:g(e=>xs(l,e.tableClientId,e.rowIndex+1))},{icon:as,title:(0,i.__)("Delete row","tableberg"),onClick:g(e=>function(e,t,n){const{rows:l,rowBlocks:o}=fs(e,t);if(o.length<=1)return;const r=function(e,t){const{matrix:n,anchors:l}=hs(e),o=[],r=[];for(const n of e)for(const e of n){const n=l.get(e.id);n.row<t&&n.row+e.rowSpan>t&&o.push(e.id)}const a=e[t+1];if(a)for(const n of e[t]){const e=l.get(n.id);if(n.rowSpan<=1)continue;let t=0;for(const n of a)l.get(n.id).col<e.col&&t++;r.push({id:n.id,insertIndex:t,rowSpan:n.rowSpan-1,colSpan:n.colSpan})}return{shrinkSpans:o,reanchor:r}}(l,n),a=e.dispatch(me.store),s=o[n].clientId,i=o[n+1]?.clientId;e.batch(()=>{for(const t of r.shrinkSpans)vs(e,l,t,-1,0);for(const e of r.reanchor){if(!i)break;a.moveBlocksToPosition([e.id],s,i,e.insertIndex),a.updateBlockAttributes(e.id,ms(e.rowSpan,e.colSpan))}a.removeBlocks([s],!1)})}(l,e.tableClientId,e.rowIndex))},{icon:ss,title:(0,i.__)("Insert column before","tableberg"),onClick:g(e=>ys(l,e.tableClientId,e.column))},{icon:is,title:(0,i.__)("Insert column after","tableberg"),onClick:g(t=>{var n;const o=t.rows.flat().find(t=>t.id===e);ys(l,t.tableClientId,t.column+(null!==(n=o?.colSpan)&&void 0!==n?n:1))})},{icon:cs,title:(0,i.__)("Delete column","tableberg"),onClick:g(e=>function(e,t,n){const{rows:l}=fs(e,t),o=function(e,t){const{matrix:n,anchors:l}=hs(e),o=[],r=new Set;return e.forEach((a,s)=>{const i=n[s][t];void 0!==i&&l.get(i).row===s?r.has(i)?o.push({type:"skip",rowIndex:s}):(r.add(i),bs(e,i).colSpan>1?o.push({type:"shrink",rowIndex:s,id:i}):o.push({type:"remove",rowIndex:s,id:i})):o.push({type:"skip",rowIndex:s})}),o}(l,n),r=e.dispatch(me.store),a=o.filter(e=>"remove"===e.type).map(e=>e.id),s=o.filter(e=>"shrink"===e.type).map(e=>e.id);Math.max(0,...l.map(e=>e.reduce((e,t)=>e+t.colSpan,0)))<=1||e.batch(()=>{for(const t of s)vs(e,l,t,0,-1);a.length>0&&r.removeBlocks(a,!1)})}(l,e.tableClientId,e.column))},...n.map(e=>({icon:e.icon,title:e.title,onClick:g(t=>e.onClick({registry:l,tableClientId:t.tableClientId,rowIndex:t.rowIndex,column:t.column}))})),...0!==n.length||o?[]:[{icon:rs,title:(0,i.__)("Duplicate row (Pro)","tableberg"),onClick:()=>a(!0)},{icon:is,title:(0,i.__)("Duplicate column (Pro)","tableberg"),onClick:()=>a(!0)}],...p.length>1?[{icon:us,title:(0,i.__)("Merge cells","tableberg"),onClick:g(e=>{(function(e,t,n){const{rows:l}=fs(e,t),o=function(e,t){if(t.length<2)return null;const{anchors:n}=hs(e);let l=1/0,o=1/0,r=-1,a=-1,s=0;for(const i of t){const t=n.get(i),c=bs(e,i);if(!t||!c)return null;l=Math.min(l,t.row),o=Math.min(o,t.col),r=Math.max(r,t.row+c.rowSpan-1),a=Math.max(a,t.col+c.colSpan-1),s+=c.rowSpan*c.colSpan}if(s!==(r-l+1)*(a-o+1))return null;let i=null;for(const e of t){const t=n.get(e);if(t.row===l&&t.col===o){i=e;break}}return i?{anchorId:i,rowSpan:r-l+1,colSpan:a-o+1,absorbedIds:t.filter(e=>e!==i)}:null}(l,n);if(!o)return!1;const r=e.select(me.store),a=e.dispatch(me.store),{anchors:s}=hs(l),i=s.get(o.anchorId);return e.batch(()=>{for(const e of o.absorbedIds){const t=r.getBlockOrder(e);if(t.length>0){const n=s.get(e);if(i&&n){const e={dr:n.row-i.row,dc:n.col-i.col};for(const n of t)a.updateBlockAttributes(n,{mergeOrigin:e})}const l=r.getBlockOrder(o.anchorId).length;a.moveBlocksToPosition(t,e,o.anchorId,l)}}a.updateBlockAttributes(o.anchorId,ms(o.rowSpan,o.colSpan)),a.removeBlocks(o.absorbedIds,!1)}),!0})(l,e.tableClientId,p)&&d([])})}]:[],...t?[{icon:us,title:(0,i.__)("Split cell","tableberg"),onClick:g(t=>function(e,t,n){const{rows:l,rowBlocks:o}=fs(e,t),r=function(e,t){const{anchors:n}=hs(e),l=n.get(t),o=bs(e,t);if(!l||!o||1===o.rowSpan&&1===o.colSpan)return null;const r=[];for(let a=0;a<o.rowSpan;a++){const s=l.row+a,i=e[s];if(!i)continue;const c=0===a?o.colSpan-1:o.colSpan;if(0===c)continue;let u=0;for(const e of i)(n.get(e.id).col<l.col||0===a&&e.id===t)&&u++;r.push({rowIndex:s,insertIndex:u,count:c})}return{inserts:r}}(l,n);if(!r)return;const a=e.select(me.store),s=e.dispatch(me.store),{anchors:i}=hs(l),c=i.get(n),u=(l.flat().find(e=>e.id===n),new Map);e.batch(()=>{s.updateBlockAttributes(n,{span:{rowSpan:1,colSpan:1}});for(const e of r.inserts){const t=c?e.rowIndex-c.row:0,n=Array.from({length:e.count},(e,n)=>{const l=gs(),o=0===t?n+1:n;return u.set(`${t},${o}`,l),l});s.insertBlocks(n,e.insertIndex,o[e.rowIndex].clientId,!1)}const e=a.getBlockOrder(n);for(const t of e){const e=a.getBlockAttributes(t)?.mergeOrigin;if(!e)continue;const l=u.get(`${e.dr},${e.dc}`);if(s.updateBlockAttributes(t,{mergeOrigin:null}),!l)continue;const o=a.getBlockOrder(l.clientId).length;s.moveBlocksToPosition([t],n,l.clientId,o)}})}(l,t.tableClientId,e))}]:[]];return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(me.BlockControls,{group:"block",children:(0,J.jsx)(c.ToolbarDropdownMenu,{icon:us,label:(0,i.__)("Edit table","tableberg"),controls:f})}),r&&(0,J.jsx)(ea,{onClose:()=>a(!1),selected:"duplicate-row-col"})]})}function Is({attributes:e,setAttributes:t,CellBackgroundControl:n=null,CellRibbonPanel:l=null,CellBorderControl:o=null,CellEmptyControl:r=null}){var a,s;const u=null!==(a=e.styles)&&void 0!==a?a:{},d=(e.ribbon,Et()),h=[{label:(0,i.__)("Default","tableberg"),value:""},{label:(0,i.__)("Top","tableberg"),value:"top"},{label:(0,i.__)("Middle","tableberg"),value:"middle"},{label:(0,i.__)("Bottom","tableberg"),value:"bottom"}];return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(me.InspectorControls,{group:"color",children:[n&&n,!n&&!d&&(0,J.jsx)(oa,{isEnhanced:!0,selected:"cell-bg",children:(0,J.jsx)(_e,{label:(0,i.__)("Background Color","tableberg"),value:"",onChange:()=>null,onDeselect:()=>null})})]}),(0,J.jsxs)(me.InspectorControls,{group:"border",children:[o&&o,!o&&!d&&(0,J.jsx)(oa,{isEnhanced:!0,selected:"cell-border",children:(0,J.jsx)(Ce,{label:(0,i.__)("Border","tableberg"),value:Rs,hasValue:()=>!1,onChange:()=>null,onDeselect:()=>null})})]}),(0,J.jsxs)(me.InspectorControls,{children:[(0,J.jsxs)(c.PanelBody,{title:(0,i.__)("Cell Settings","tableberg"),children:[d?(0,J.jsx)(c.SelectControl,{label:(0,i.__)("Vertical Alignment","tableberg"),value:null!==(s=u.verticalAlign)&&void 0!==s?s:"",options:h,onChange:e=>{return n={verticalAlign:e||void 0},t({styles:{...u,...n}});var n}}):(0,J.jsx)(oa,{isEnhanced:!0,selected:"cell-bg",children:(0,J.jsx)(c.SelectControl,{label:(0,i.__)("Vertical Alignment","tableberg"),value:"",options:h,onChange:()=>null})}),r,!r&&!d&&(0,J.jsx)(oa,{isEnhanced:!0,selected:"cell-empty",children:(0,J.jsx)(c.ToggleControl,{checked:!1,label:(0,i.__)("Empty Cell","tableberg"),onChange:()=>null})})]}),l,!l&&!d&&(0,J.jsx)(c.PanelBody,{title:(0,i.__)("Ribbon","tableberg"),children:(0,J.jsx)(oa,{isEnhanced:!0,selected:"ribbon",children:(0,J.jsx)(c.ToggleControl,{checked:!1,label:(0,i.__)("Enable Ribbon","tableberg"),onChange:()=>null})})})]})]})}const Es=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"tableberg/text","title":"Text","category":"design","description":"A text element within a Tableberg cell.","parent":["tableberg/cell"],"supports":{"html":false,"customClassName":false,"reusable":false,"__experimentalSlashInserter":true},"attributes":{"content":{"type":"string"},"align":{"type":"string"},"styles":{"type":"object"},"bindings":{"type":"object"},"mergeOrigin":{"type":"object"}},"textdomain":"tableberg"}');function Os(e){return{display:"flex",justifyContent:a(e),textAlign:e}}function Ms({align:e,onChange:t}){return(0,J.jsx)(me.BlockControls,{children:(0,J.jsx)(He,{title:(0,i.__)("Align element","tableberg"),value:e,onChange:e=>{"left"!==e&&"center"!==e&&"right"!==e||t(e)},controlset:"alignment"})})}const As=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"tableberg/button","title":"Button","category":"design","description":"A button element within a Tableberg cell.","parent":["tableberg/cell"],"supports":{"html":false,"customClassName":false,"reusable":false},"attributes":{"content":{"type":"string"},"align":{"type":"string"},"styles":{"type":"object"},"bindings":{"type":"object"},"mergeOrigin":{"type":"object"},"link":{"type":"object"},"id":{"type":"string"}},"textdomain":"tableberg"}');const Ns=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"tableberg/image","title":"Image","category":"design","description":"An image element within a Tableberg cell.","parent":["tableberg/cell"],"supports":{"html":false,"customClassName":false,"reusable":false},"attributes":{"media":{"type":"object"},"alt":{"type":"string"},"align":{"type":"string"},"width":{"type":"string"},"height":{"type":"string"},"aspectRatio":{"type":"string"},"scale":{"type":"string"},"sizeSlug":{"type":"string"},"caption":{"type":"string"},"href":{"type":"string"},"linkTarget":{"type":"string"},"lightbox":{"type":"object"},"border":{"type":"object"},"borderRadius":{"type":"object"},"bindings":{"type":"object"},"mergeOrigin":{"type":"object"}},"textdomain":"tableberg"}');const Ds=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"tableberg/list","title":"List","category":"design","description":"A list element within a Tableberg cell.","parent":["tableberg/cell"],"supports":{"html":false,"customClassName":false,"reusable":false},"attributes":{"items":{"type":"array"},"listType":{"type":"string"},"listStyle":{"type":"string"},"align":{"type":"string"},"styles":{"type":"object"},"bindings":{"type":"object"},"mergeOrigin":{"type":"object"}},"textdomain":"tableberg"}');var Ls=class extends b{constructor(e={}){super(),this.config=e,this.#N=new Map}#N;build(e,t,n){const l=t.queryKey,o=t.queryHash??w(l,t);let r=this.get(o);return r||(r=new q({client:e,queryKey:l,queryHash:o,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(l)}),this.add(r)),r}add(e){this.#N.has(e.queryHash)||(this.#N.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#N.get(e.queryHash);t&&(e.destroy(),t===e&&this.#N.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){D.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#N.get(e)}getAll(){return[...this.#N.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(e=>y(t,e))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(t=>y(e,t)):t}notify(e){D.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){D.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){D.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Fs=class extends G{#D;#L;#c;constructor(e){super(),this.mutationId=e.mutationId,this.#L=e.mutationCache,this.#D=[],this.state=e.state||{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0},this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#D.includes(e)||(this.#D.push(e),this.clearGcTimeout(),this.#L.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#D=this.#D.filter(t=>t!==e),this.scheduleGc(),this.#L.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#D.length||("pending"===this.state.status?this.scheduleGc():this.#L.remove(this))}continue(){return this.#c?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#h({type:"continue"})};this.#c=Z({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(e,t)=>{this.#h({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#h({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#L.canRun(this)});const n="pending"===this.state.status,l=!this.#c.canStart();try{if(n)t();else{this.#h({type:"pending",variables:e,isPaused:l}),await(this.#L.config.onMutate?.(e,this));const t=await(this.options.onMutate?.(e));t!==this.state.context&&this.#h({type:"pending",context:t,variables:e,isPaused:l})}const o=await this.#c.start();return await(this.#L.config.onSuccess?.(o,e,this.state.context,this)),await(this.options.onSuccess?.(o,e,this.state.context)),await(this.#L.config.onSettled?.(o,null,this.state.variables,this.state.context,this)),await(this.options.onSettled?.(o,null,e,this.state.context)),this.#h({type:"success",data:o}),o}catch(t){try{throw await(this.#L.config.onError?.(t,e,this.state.context,this)),await(this.options.onError?.(t,e,this.state.context)),await(this.#L.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this)),await(this.options.onSettled?.(void 0,t,e,this.state.context)),t}finally{this.#h({type:"error",error:t})}}finally{this.#L.runNext(this)}}#h(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),D.batch(()=>{this.#D.forEach(t=>{t.onMutationUpdate(e)}),this.#L.notify({mutation:this,type:"updated",action:e})})}},Vs=class extends b{constructor(e={}){super(),this.config=e,this.#F=new Set,this.#V=new Map,this.#H=0}#F;#V;#H;build(e,t,n){const l=new Fs({mutationCache:this,mutationId:++this.#H,options:e.defaultMutationOptions(t),state:n});return this.add(l),l}add(e){this.#F.add(e);const t=Hs(e);if("string"==typeof t){const n=this.#V.get(t);n?n.push(e):this.#V.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#F.delete(e)){const t=Hs(e);if("string"==typeof t){const n=this.#V.get(t);if(n)if(n.length>1){const t=n.indexOf(e);-1!==t&&n.splice(t,1)}else n[0]===e&&this.#V.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=Hs(e);if("string"==typeof t){const n=this.#V.get(t),l=n?.find(e=>"pending"===e.state.status);return!l||l===e}return!0}runNext(e){const t=Hs(e);if("string"==typeof t){const n=this.#V.get(t)?.find(t=>t!==e&&t.state.isPaused);return n?.continue()??Promise.resolve()}return Promise.resolve()}clear(){D.batch(()=>{this.#F.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#F.clear(),this.#V.clear()})}getAll(){return Array.from(this.#F)}find(e){const t={exact:!0,...e};return this.getAll().find(e=>C(t,e))}findAll(e={}){return this.getAll().filter(t=>C(e,t))}notify(e){D.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(e=>e.state.isPaused);return D.batch(()=>Promise.all(e.map(e=>e.continue().catch(g))))}};function Hs(e){return e.options.scope?.id}function zs(e){return{onFetch:(t,n)=>{const l=t.options,o=t.fetchOptions?.meta?.fetchMore?.direction,r=t.state.data?.pages||[],a=t.state.data?.pageParams||[];let s={pages:[],pageParams:[]},i=0;const c=async()=>{let n=!1;const c=M(t.options,t.fetchOptions),u=async(e,l,o)=>{if(n)return Promise.reject();if(null==l&&e.pages.length)return Promise.resolve(e);const r=(()=>{const e={client:t.client,queryKey:t.queryKey,pageParam:l,direction:o?"backward":"forward",meta:t.options.meta};var r;return r=e,Object.defineProperty(r,"signal",{enumerable:!0,get:()=>(t.signal.aborted?n=!0:t.signal.addEventListener("abort",()=>{n=!0}),t.signal)}),e})(),a=await c(r),{maxPages:s}=t.options,i=o?E:I;return{pages:i(e.pages,a,s),pageParams:i(e.pageParams,l,s)}};if(o&&r.length){const e="backward"===o,t={pages:r,pageParams:a},n=(e?Gs:Zs)(l,t);s=await u(t,n,e)}else{const t=e??r.length;do{const e=0===i?a[0]??l.initialPageParam:Zs(l,s);if(i>0&&null==e)break;s=await u(s,e),i++}while(i<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=c}}}function Zs(e,{pages:t,pageParams:n}){const l=t.length-1;return t.length>0?e.getNextPageParam(t[l],t,n[l],n):void 0}function Gs(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}const qs=JSON.parse('{"UU":"tableberg/table","DD":"Tableberg","L1":"design","xY":{"html":false,"customClassName":false},"uK":{"version":{"type":"number","default":0},"isExample":{"type":"boolean","default":false},"table":{"type":"object","default":{"rows":0,"cols":0,"className":"","headerEnabled":false,"footerEnabled":false,"stickyHeader":false,"stickyFirstCol":false,"caption":"","tableWidth":"auto","tableAlignment":"left","cellSpacing":{"horizontal":"0","vertical":"0"},"tableBorder":{"top":"","right":"","bottom":"","left":""},"margin":{"top":"","right":"","bottom":"","left":""},"padding":{"top":"","right":"","bottom":"","left":""},"fixedColumnWidths":true,"pagination":{"enabled":false,"pageSize":10,"showPageNumbers":true,"showPrevNext":true},"search":{"enabled":false,"placeholder":"Search...","highlightColor":"","position":"left"},"responsive":{"tablet":{"enabled":false,"maxWidth":700,"mode":"scroll","transpose":false,"stackCount":3,"repeatFirstCol":false},"mobile":{"enabled":false,"maxWidth":375,"mode":"scroll","transpose":false,"stackCount":1,"repeatFirstCol":false}}}},"rows":{"type":"array","default":[]},"columns":{"type":"array","default":[]},"cells":{"type":"object","default":{}},"bindings":{"type":"object","default":{}},"cellDefaults":{"type":"object","default":{"styles":{"padding":{"top":"var(--wp--preset--spacing--20)","right":"var(--wp--preset--spacing--20)","bottom":"var(--wp--preset--spacing--20)","left":"var(--wp--preset--spacing--20)"},"border":{"top":"1px solid black","right":"1px solid black","bottom":"1px solid black","left":"1px solid black"},"borderRadius":{"topLeft":"0px","topRight":"0px","bottomRight":"0px","bottomLeft":"0px"},"orientation":"vertical","elementGap":"var(--wp--preset--spacing--20)","wrap":"nowrap","verticalAlign":"middle","backgroundColor":""}}}}}'),$s=n.p+"images/example.01df8ea3.png",Qs=["text","button","image","list","styled-list","icon","star-rating","custom-html"];function Us(e){var t;return(null!==(t=e.version)&&void 0!==t?t:0)<=3}function Ws(e){const t={...e};return delete t.cells,delete t.rows,t.version=4,t}function Ks(e){const t={};e.span&&(t.span=e.span),e.styles&&(t.styles=e.styles),e.ribbon&&(t.ribbon=e.ribbon),e.className&&(t.className=e.className);const n=[];for(const t of null!==(l=e.elements)&&void 0!==l?l:[]){var l,o;if(!t||!Qs.includes(t.name))continue;const e={...null!==(o=t.attributes)&&void 0!==o?o:{}};t.bindings&&Object.keys(t.bindings).length>0&&(e.bindings=t.bindings),n.push((0,ve.createBlock)(`tableberg/${t.name}`,e))}return(0,ve.createBlock)("tableberg/cell",t,n)}function Ys(e){var t,n,l,o;const r=null!==(t=e.table?.rows)&&void 0!==t?t:0,a=null!==(n=e.table?.cols)&&void 0!==n?n:0,s=null!==(l=e.cells)&&void 0!==l?l:{},i=null!==(o=e.rows)&&void 0!==o?o:[],c=function(e,t,n){const l=new Set;for(const[o,r]of Object.entries(e)){const e=r?.span;if(!e)continue;const[a,s]=o.split(",").map(Number),i=Math.max(1,e.rowSpan||1),c=Math.max(1,e.colSpan||1);for(let e=0;e<i;e++)for(let o=0;o<c;o++){if(0===e&&0===o)continue;const r=a+e,i=s+o;r>=t||i>=n||l.add(`${r},${i}`)}}return l}(s,r,a),u=[];for(let e=0;e<r;e++){const t=[];for(let n=0;n<a;n++){var d;if(c.has(`${e},${n}`))continue;const l=null!==(d=s[`${e},${n}`])&&void 0!==d?d:{};t.push(Ks(l))}const n={},l=i[e]?.height;l&&(n.height=l),u.push((0,ve.createBlock)("tableberg/row",n,t))}return u}function Js(e){const t=Number.parseInt(e||"",10);return Number.isNaN(t)||t<1?1:t}const Xs={from:[{type:"block",blocks:["core/table"],transform:e=>{const t=function(e){var t;const n=e.head||[],l=e.body||[],o=e.foot||[],r=[...n,...l,...o],a={},s=new Set;r.forEach((e,t)=>{let n=0;(e.cells||[]).forEach(e=>{for(;s.has(ge(t,n));)n+=1;const l=Js(e.rowspan),o=Js(e.colspan),r=ge(t,n);var i;a[r]={elements:[{name:"text",attributes:{...Mt,content:e.content||"",align:(i=e.align,"left"===i||"center"===i||"right"===i?i:Mt.align)}}],...l>1||o>1?{span:{rowSpan:l,colSpan:o}}:{}};for(let e=0;e<l;e++)for(let l=0;l<o;l++)0===e&&0===l||s.add(ge(t+e,n+l));n+=o})});const i=Object.entries(a).reduce((e,[t,n])=>{const[,l]=t.split(",").map(e=>Number.parseInt(e,10)),o=n.span?.colSpan||1;return Math.max(e,l+o)},0);return{...pe,version:3,table:{...pe.table,rows:r.length,cols:i,headerEnabled:n.length>0,footerEnabled:o.length>0,caption:e.caption||"",fixedColumnWidths:null===(t=e.hasFixedLayout)||void 0===t||t},cells:a}}(e);return(0,ve.createBlock)("tableberg/table",Ws(t),Ys(t))}}]};var ei=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"m16.5 13.5-3.7 3.7V4h-1.5v13.2l-3.8-3.7-1 1 5.5 5.6 5.5-5.6z"})}),ti=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"m14.5 6.5-1 1 3.7 3.7H4v1.6h13.2l-3.7 3.7 1 1 5.6-5.5z"})}),ni=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M12 3.9 6.5 9.5l1 1 3.8-3.7V20h1.5V6.8l3.7 3.7 1-1z"})}),li=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{fillRule:"evenodd",d:"M10.289 4.836A1 1 0 0111.275 4h1.306a1 1 0 01.987.836l.244 1.466c.787.26 1.503.679 2.108 1.218l1.393-.522a1 1 0 011.216.437l.653 1.13a1 1 0 01-.23 1.273l-1.148.944a6.025 6.025 0 010 2.435l1.149.946a1 1 0 01.23 1.272l-.653 1.13a1 1 0 01-1.216.437l-1.394-.522c-.605.54-1.32.958-2.108 1.218l-.244 1.466a1 1 0 01-.987.836h-1.306a1 1 0 01-.986-.836l-.244-1.466a5.995 5.995 0 01-2.108-1.218l-1.394.522a1 1 0 01-1.217-.436l-.653-1.131a1 1 0 01.23-1.272l1.149-.946a6.026 6.026 0 010-2.435l-1.148-.944a1 1 0 01-.23-1.272l.653-1.131a1 1 0 011.217-.437l1.393.522a5.994 5.994 0 012.108-1.218l.244-1.466zM14.929 12a3 3 0 11-6 0 3 3 0 016 0z",clipRule:"evenodd"})}),oi=(0,J.jsx)(Re.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,J.jsx)(Re.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M20 12a8 8 0 1 1-16 0 8 8 0 0 1 16 0Zm-1.5 0a6.5 6.5 0 0 1-6.5 6.5v-13a6.5 6.5 0 0 1 6.5 6.5Z"})});function ri(e,t){return e[t]?.span||{rowSpan:1,colSpan:1}}function ai(e,t){if(e.length<2)return!1;const n=new Set;for(const l of e){const[e,o]=fe(l),r=ri(t,l);for(let t=0;t<r.rowSpan;t++)for(let l=0;l<r.colSpan;l++)n.add(`${e+t},${o+l}`)}let l=1/0,o=-1/0,r=1/0,a=-1/0;for(const e of n){const[t,n]=e.split(",").map(Number);l=Math.min(l,t),o=Math.max(o,t),r=Math.min(r,n),a=Math.max(a,n)}for(let e=l;e<=o;e++)for(let t=r;t<=a;t++)if(!n.has(`${e},${t}`))return!1;return!0}function si({styleKey:e,defaultValue:t,hasValue:n,label:l,labelSelected:o}){var r;const a=Ha(e=>e.selectedCells),s=Ha(e=>e.cellDefaults.styles),i=Ha(e=>e.getCellStyle),c=Ha(e=>e.updateCellStyles),u=Ha(e=>e.updateCellGlobalStyles),d=a.length>0&&i(a[0])||{};return{value:a.length>0&&d[e]?null!==(r=d[e])&&void 0!==r?r:t:s[e],hasValue:()=>{if(a.length>0){const t=d[e];return!!t&&n(t)}{const t=s[e];return n(t)}},onChange:t=>{a.length>0?a.forEach(n=>{c(n,{[e]:t})}):u({[e]:t})},onDeselect:()=>{a.length>0?a.forEach(n=>{c(n,{[e]:t})}):u({[e]:t})},label:a.length>0&&o?o:l}}function ii(e){const t={},n={},l=[],o=new Set;let r=0,a=0;for(const u of e){if("tableberg/row"!==u.name)continue;const e=u.attributes?.height,d=u.attributes?.backgroundColor;l[a]=e||d?{...e?{height:e}:{},...d?{backgroundColor:d}:{}}:null;let h=0;for(const e of u.innerBlocks){var s,i,c;if("tableberg/cell"!==e.name)continue;for(;o.has(`${a},${h}`);)h++;const l=null!==(s=e.attributes)&&void 0!==s?s:{},u={};l.span&&(u.span=l.span),l.styles&&(u.styles=l.styles),l.ribbon&&(u.ribbon=l.ribbon),l.className&&(u.className=l.className),l.backgroundColor&&(u.backgroundColor=l.backgroundColor),u.elements=ci(e.innerBlocks),t[`${a},${h}`]=u,n[`${a},${h}`]=e.clientId;const d=Math.max(1,null!==(i=l.span?.rowSpan)&&void 0!==i?i:1),b=Math.max(1,null!==(c=l.span?.colSpan)&&void 0!==c?c:1);for(let e=0;e<d;e++)for(let t=0;t<b;t++)0===e&&0===t||o.add(`${a+e},${h+t}`);h+=b,h>r&&(r=h)}for(;o.has(`${a},${h}`);)h++,h>r&&(r=h);a++}return{cells:t,rows:l,rowsCount:a,colsCount:r,cellClientIds:n}}function ci(e){const t=[];for(const l of e){var n;if(!l.name.startsWith("tableberg/"))continue;const e=l.name.slice(10),{bindings:o,...r}=null!==(n=l.attributes)&&void 0!==n?n:{},a={name:e,attributes:r};o&&Object.keys(o).length>0&&(a.bindings=o),t.push(a)}return t}const ui=(e,t)=>{if(0===t.length)return[];const n=new Set(t);return Object.keys(e).filter(e=>n.has(fe(e)[0]))},di=(e,t,n)=>{var l;const o=t[e],r=null!==(l=o?.backgroundColor)&&void 0!==l?l:o?.styles?.backgroundColor;return r&&""!==r.trim()?r:n},hi=(e,t,n)=>{if(0===e.length)return;let l;for(const o of e){const e=di(o,t,n);if(void 0!==l){if(l!==e)return}else l=e}return l||void 0};const bi=(e,t)=>`cell-${e}-${t}`,pi=(e,t,n)=>`element-${e}-${t}-${n}`,gi=(0,u.createContext)(null);function fi({children:e}){const t=(0,u.useRef)(null);return t.current||(t.current=be((e,t)=>({props:{},setCellBlockProps:(t,n,l)=>e(e=>({props:{...e.props,[bi(t,n)]:l}})),removeCellBlockProps:(t,n)=>e(e=>{const l={...e.props};return delete l[bi(t,n)],{props:l}}),getCellBlockProps:(e,n)=>t().props[bi(e,n)],setElementBlockProps:(t,n,l,o)=>e(e=>({props:{...e.props,[pi(t,n,l)]:o}})),removeElementBlockProps:(t,n,l)=>e(e=>{const o={...e.props};return delete o[pi(t,n,l)],{props:o}}),getElementBlockProps:(e,n,l)=>t().props[pi(e,n,l)],clearAllProps:()=>e({props:{}})}))),(0,J.jsx)(gi.Provider,{value:t.current,children:e})}function mi(e){const t=(0,u.useContext)(gi);if(!t)throw new Error("useFauxBlockPropsStore must be used within FauxBlockPropsProvider");return t(e)}var vi=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M20.5 16h-.7V8c0-1.1-.9-2-2-2H6.2c-1.1 0-2 .9-2 2v8h-.7c-.8 0-1.5.7-1.5 1.5h20c0-.8-.7-1.5-1.5-1.5zM5.7 8c0-.3.2-.5.5-.5h11.6c.3 0 .5.2.5.5v7.6H5.7V8z"})}),xi=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M17 4H7c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 14c0 .3-.2.5-.5.5H7c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h10c.3 0 .5.2.5.5v12zm-7.5-.5h4V16h-4v1.5z"})}),yi=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M15 4H9c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h6c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 14c0 .3-.2.5-.5.5H9c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h6c.3 0 .5.2.5.5v12zm-4.5-.5h2V16h-2v1.5z"})});const Ci=[{value:"desktop",deviceType:"Desktop",label:(0,i.__)("Desktop","tableberg"),icon:vi},{value:"tablet",deviceType:"Tablet",label:(0,i.__)("Tablet","tableberg"),icon:xi},{value:"mobile",deviceType:"Mobile",label:(0,i.__)("Mobile","tableberg"),icon:yi}],wi=pe.table.responsive,_i=[{value:"scroll",label:(0,i.__)("Scroll","tableberg")},{value:"stack",label:(0,i.__)("Stack","tableberg")}];function ki(e,t){const n=function(e){return{...wi[e]}}(t),l=e?.[t];return{...n,...l||{},transpose:"boolean"==typeof l?.transpose?l.transpose:"row"===l?.direction,repeatFirstCol:"boolean"==typeof l?.repeatFirstCol?l.repeatFirstCol:!!l?.headerAsCol}}function ji(){const e=Et(),t=Ha(e=>e.table),n=Ha(e=>e.updateTable),l=(0,h.useSelect)(e=>{const t=e("core/editor"),n=e("core/edit-site"),l=e("core/edit-post");return function(e){const t=(e||"desktop").toLowerCase();return"tablet"===t?"tablet":"mobile"===t?"mobile":"desktop"}(t?.getDeviceType?.()||n?.__experimentalGetPreviewDeviceType?.()||l?.__experimentalGetPreviewDeviceType?.())},[]),o=(0,h.useDispatch)("core/editor"),r=(0,h.useDispatch)("core/edit-site"),a=(0,h.useDispatch)("core/edit-post"),s=t.responsive,u=(e,t)=>{const l={tablet:ki(s,"tablet"),mobile:ki(s,"mobile")};n({responsive:{...l,[e]:{...l[e],...t}}})},d="desktop"===l?"tablet":l,b=ki(s,d),p=!b.enabled;return(0,J.jsx)(me.InspectorControls,{children:(0,J.jsx)(c.PanelBody,{title:(0,i.__)("Responsive","tableberg"),children:(0,J.jsxs)(c.BaseControl,{__nextHasNoMarginBottom:!0,children:[(0,J.jsx)(c.ButtonGroup,{className:"tableberg-responsiveness-device-switcher-container",children:Ci.map(({value:e,deviceType:t,label:n,icon:s})=>(0,J.jsx)(c.Button,{isPressed:l===e,icon:s,className:"tableberg-responsiveness-device-switcher",onClick:()=>{var e;e=t,o?.setDeviceType?o.setDeviceType(e):r?.__experimentalSetPreviewDeviceType?r.__experimentalSetPreviewDeviceType(e):a?.__experimentalSetPreviewDeviceType&&a.__experimentalSetPreviewDeviceType(e)},children:n},e))}),"desktop"===l?(0,J.jsx)("p",{style:{margin:0,color:"#757575"},children:(0,i.__)("Switch to Tablet or Mobile preview to configure responsive behavior.","tableberg")}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(c.ToggleControl,{label:(0,i.__)("Enable Responsive Rule","tableberg"),checked:b.enabled,onChange:e=>{u(d,{enabled:e})}}),(0,J.jsx)(c.__experimentalNumberControl,{label:(0,i.__)("Max Width","tableberg"),value:b.maxWidth,min:1,suffix:"px",spinControls:"none",onChange:e=>{const t=parseInt(e||"",10);isNaN(t)||t<1||u(d,{maxWidth:t})},disabled:p,help:(0,i.__)("The columns will be stacked when browser window width is less than this width","tableberg")}),(0,J.jsx)(c.SelectControl,{label:(0,i.__)("Responsive Mode","tableberg"),value:b.mode,options:_i,onChange:e=>{u(d,{mode:e})},disabled:p,help:"scroll"===b.mode?(0,i.__)("Makes the table horizontally scrollable","tableberg"):"stack"===b.mode?(0,i.__)("Breaks the table by columns and stacks the columns","tableberg"):void 0}),"stack"===b.mode&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(c.ToggleControl,{label:(0,i.__)("Transform Rows to Columns","tableberg"),checked:b.transpose,onChange:e=>{u(d,{transpose:e})},disabled:p}),e?(0,J.jsx)(c.ToggleControl,{label:(0,i.__)("Show First Column in Every Stack Row","tableberg"),checked:b.repeatFirstCol,onChange:e=>{u(d,{repeatFirstCol:e})},disabled:p}):(0,J.jsx)(oa,{isEnhanced:!0,selected:"sticky-first-col",children:(0,J.jsx)(c.ToggleControl,{label:(0,i.__)("Show First Column in Every Stack Row","tableberg"),checked:!1,onChange:()=>null,disabled:p})}),(0,J.jsx)(c.__experimentalNumberControl,{label:(0,i.__)("Items Per Stack Row","tableberg"),value:b.stackCount,min:1,spinControls:"none",help:(0,i.__)("Maximum number of cells allowed in each stacked sub-row.","tableberg"),onChange:e=>{const t=parseInt(e||"",10);isNaN(t)||t<1||u(d,{stackCount:t})},disabled:p})]})]})]})})})}function Si({label:e,value:t,onChange:n}){return(0,J.jsx)(me.InspectorControls,{group:"advanced",children:(0,J.jsx)(c.TextControl,{__next40pxDefaultSize:!0,autoComplete:"off",label:e||(0,i.__)("Additional CSS class(es)","tableberg"),value:t||"",onChange:e=>{const t=e.trim();n(""!==t?t:void 0)},help:(0,i.__)("Separate multiple classes with spaces.","tableberg")})})}const Pi=pe.cellDefaults.styles,Ri=[{value:"left",icon:Me,title:(0,i.__)("Align left","tableberg")},{value:"center",icon:Ae,title:(0,i.__)("Align center","tableberg")},{value:"right",icon:Ne,title:(0,i.__)("Align right","tableberg")}],Bi="350px",Ti=(e=[])=>{e.forEach(e=>{e()})},Ii=["auto","wide","full"],Ei=[{value:"vertical",icon:ei,label:(0,i.__)("Vertical","tableberg")},{value:"horizontal",icon:ti,label:(0,i.__)("Horizontal","tableberg")}],Oi=[{value:"left",icon:Vt,label:(0,i.__)("Left","tableberg")},{value:"center",icon:Ht,label:(0,i.__)("Center","tableberg")},{value:"right",icon:zt,label:(0,i.__)("Right","tableberg")}],Mi=[{value:"top",icon:ni,label:(0,i.__)("Top","tableberg")},{value:"middle",icon:Ae,label:(0,i.__)("Middle","tableberg")},{value:"bottom",icon:ei,label:(0,i.__)("Bottom","tableberg")}],Ai=pe.table;function Ni(e){return{top:e.vertical,right:e.horizontal,bottom:e.vertical,left:e.horizontal}}function Di(e,t,n){const l=Ni(t);let o=t.horizontal;e.right!==l.right?o=e.right:e.left!==l.left&&(o=e.left);let r=t.vertical;return e.top!==l.top?r=e.top:e.bottom!==l.bottom&&(r=e.bottom),{horizontal:o||n.horizontal,vertical:r||n.vertical}}function Li({label:e,onSelect:t,onReset:n}){return(0,J.jsx)("div",{className:"tableberg-element-font-option",children:(0,J.jsx)(c.Dropdown,{className:"block-editor-tools-panel-color-gradient-settings__dropdown",popoverProps:{placement:"bottom-start"},renderToggle:({isOpen:t,onToggle:n})=>(0,J.jsx)(c.Button,{__next40pxDefaultSize:!0,onClick:n,"aria-expanded":t,className:"block-editor-panel-color-gradient-settings__dropdown tableberg-element-font-option-toggle"+(t?" is-open":""),children:(0,J.jsx)("span",{className:"tableberg-element-font-option-label",children:e})}),renderContent:({onClose:e})=>(0,J.jsxs)("div",{className:"tableberg-element-font-option-popover",children:[(0,J.jsx)(me.ColorPalette,{value:void 0,clearable:!1,onChange:n=>{n&&(t(n),e())}}),(0,J.jsx)(c.Button,{__next40pxDefaultSize:!0,className:"components-circular-option-picker__clear",variant:"tertiary",onClick:()=>{n(),e()},children:(0,i.__)("Reset","tableberg")})]})})})}function Fi({label:e,onSelect:t,onReset:n}){return(0,J.jsx)("div",{className:"tableberg-element-font-option",children:(0,J.jsx)(c.Dropdown,{className:"block-editor-tools-panel-color-gradient-settings__dropdown",popoverProps:{placement:"bottom-start"},renderToggle:({isOpen:t,onToggle:n})=>(0,J.jsx)(c.Button,{__next40pxDefaultSize:!0,onClick:n,"aria-expanded":t,className:"block-editor-panel-color-gradient-settings__dropdown tableberg-element-font-option-toggle"+(t?" is-open":""),children:(0,J.jsx)("span",{className:"tableberg-element-font-option-label",children:e})}),renderContent:({onClose:e})=>(0,J.jsxs)("div",{className:"tableberg-element-font-option-popover tableberg-element-font-option-popover--font-size",onKeyDown:t=>{"Enter"===t.key&&e()},children:[(0,J.jsx)(me.FontSizePicker,{value:void 0,withReset:!1,onChange:e=>{e&&t(String(e))}}),(0,J.jsx)(c.Button,{__next40pxDefaultSize:!0,className:"components-circular-option-picker__clear",variant:"tertiary",onClick:()=>{n(),e()},children:(0,i.__)("Reset to default","tableberg")})]})})})}function Vi({ProColumnSortingContent:e}){const t=Ha(e=>e.cells),n=Ha(e=>e.columns),l=Ha(e=>e.table),o=Ha(e=>e.sortPreviewMode),r=Ha(e=>e.getColumnConfig),a=Ha(e=>e.setColumnSortable),s=Ha(e=>e.isColumnSortableAllowed),u=Ha(e=>e.enterSortPreviewMode),{headerEnabled:d}=l;if(!d)return(0,J.jsx)(me.InspectorControls,{children:(0,J.jsx)(c.PanelBody,{title:(0,i.__)("Column Sorting","tableberg"),children:(0,J.jsx)("p",{style:{color:"#757575"},children:(0,i.__)("To enable column sorting, make the top row a header in the Header & Footer Settings panel.","tableberg")})})});if(ha(t))return(0,J.jsx)(me.InspectorControls,{children:(0,J.jsx)(c.PanelBody,{title:(0,i.__)("Column Sorting","tableberg"),children:(0,J.jsx)("p",{style:{color:"#757575"},children:(0,i.__)("Column sorting is not available for tables with merged cells.","tableberg")})})});const h=Array.from({length:l.cols},(e,t)=>t),b=function(e){return e.some(e=>!!e?.sortable)}(n);return e?(0,J.jsx)(me.InspectorControls,{children:(0,J.jsx)(c.PanelBody,{title:(0,i.__)("Column Sorting","tableberg"),initialOpen:b,children:e({columnNumbers:h,getColumnConfig:r,isColumnSortableAllowed:s,setColumnSortable:a,hasSortableCols:b,sortPreviewMode:o,enterSortPreviewMode:u})})}):(0,J.jsx)(me.InspectorControls,{children:(0,J.jsx)(oa,{isEnhanced:!0,selected:"sorting",children:(0,J.jsx)(c.PanelBody,{title:(0,i.__)("Column Sorting","tableberg"),children:h.map(e=>(0,J.jsx)(c.ToggleControl,{checked:!1,label:(0,i.sprintf)((0,i.__)("Column %d","tableberg"),e+1),onChange:()=>null},e))})})})}function Hi({ProPaginationContent:e}){const t=Ha(e=>e.cells),n=Ha(e=>e.table.pagination),l=Ha(e=>e.setPaginationConfig);return e?pa(t)?(0,J.jsx)(me.InspectorControls,{children:(0,J.jsx)(c.PanelBody,{title:(0,i.__)("Pagination","tableberg"),children:(0,J.jsx)("p",{style:{color:"#757575"},children:(0,i.__)("Pagination is not available for tables with row-spanning cells (cells that span multiple rows).","tableberg")})})}):(0,J.jsx)(me.InspectorControls,{children:(0,J.jsx)(c.PanelBody,{title:(0,i.__)("Pagination","tableberg"),children:e({paginationConfig:n,updatePaginationConfig:l})})}):(0,J.jsx)(me.InspectorControls,{children:(0,J.jsx)(oa,{isEnhanced:!0,selected:"pagination",children:(0,J.jsx)(c.PanelBody,{title:(0,i.__)("Pagination","tableberg"),children:(0,J.jsx)(c.ToggleControl,{checked:!1,label:(0,i.__)("Enable Pagination","tableberg"),onChange:()=>null})})})})}function zi(){var e;const t=Ha(e=>e.table),n=Ha(e=>e.updateTable);return t.cols<1&&t.rows<1?null:(0,J.jsx)(me.InspectorControls,{children:(0,J.jsxs)(c.PanelBody,{title:(0,i.__)("Column & Row Dimensions","tableberg"),children:[(0,J.jsx)(c.ToggleControl,{checked:null===(e=t.fixedColumnWidths)||void 0===e||e,label:(0,i.__)("Equal width columns","tableberg"),onChange:e=>{n({fixedColumnWidths:e})}}),(0,J.jsx)("p",{style:{marginBottom:0,color:"#757575"},children:(0,i.__)("Select a cell to set the width of its column and the height of its row.","tableberg")})]})})}const Zi=function({ProStickyHeaderControl:e,ProStickyFirstColControl:t,ProCellOrientationControl:n,ProColumnSortingContent:l,ProSearchControl:o,ProPaginationContent:r}={}){const a=Et(),{clientId:s}=(0,me.useBlockEditContext)(),d=Ha(e=>e.table),b=Ha(e=>e.cells),p=Ha(e=>e.updateTable),g=Ha(e=>e.setCells),f=Ha(e=>e.selectedCells),m=Ha(e=>e),v=Ha(e=>e.sortPreviewMode),x=(Ha(e=>e.selectedRibbonCell),Ha(e=>e.showCaption)),y=Ha(e=>e.setShowCaption),C=(Ha(e=>e.showRowColumnControls),Ha(e=>e.showDuplicateMoveControls),Ha(e=>e.toggleRowColumnControls),Ha(e=>e.toggleDuplicateMoveControls),d.caption||""),[w,_]=(0,u.useState)("settings"),[k,j]=(0,u.useState)(!1),S=d.tableAlignment||"left",P=(d.tableWidth||"auto").trim(),R=(B=P,Ii.includes(B)?P:"fixed");var B;const T="fixed"===R,I=T&&P||Bi,E=function(){const e=Ai.cellSpacing;return{horizontal:e.horizontal,vertical:e.vertical}}(),O=d.cellSpacing||E,M=O.horizontal||E.horizontal,A=O.vertical||E.vertical,N=Ai.tableBorder,D=d.tableBorder||N,L={label:(0,i.__)("Table Border","tableberg"),value:D,hasValue:()=>!!(D.top||D.right||D.bottom||D.left),onChange:e=>{p({tableBorder:e})},onDeselect:()=>{p({tableBorder:{...N}})}},F=Ai.margin,V=d.margin||F,H={label:(0,i.__)("Block Margin","tableberg"),value:V,hasValue:()=>!!(V.top||V.right||V.bottom||V.left),onChange:e=>{p({margin:e})},onDeselect:()=>{p({margin:{...F}})}},z=Ai.padding,Z=d.padding||z,G={label:(0,i.__)("Block Padding","tableberg"),value:Z,hasValue:()=>!!(Z.top||Z.right||Z.bottom||Z.left),onChange:e=>{p({padding:e})},onDeselect:()=>{p({padding:{...z}})}},q=si({styleKey:"border",defaultValue:Pi.border,label:(0,i.__)("Cell Border","tableberg"),labelSelected:(0,i.__)("Common Cell Border","tableberg"),hasValue:e=>!!(e.top||e.right||e.bottom||e.left)}),$=si({styleKey:"borderRadius",defaultValue:Pi.borderRadius,label:(0,i.__)("Table Border Radius","tableberg"),labelSelected:(0,i.__)("Cell Border Radius","tableberg"),hasValue:e=>!!(e.topLeft||e.topRight||e.bottomRight||e.bottomLeft)}),Q=si({styleKey:"padding",defaultValue:Pi.padding,hasValue:e=>!!(e.top||e.right||e.bottom||e.left),label:(0,i.__)("Common Cell Padding","tableberg"),labelSelected:(0,i.__)("Cell Padding","tableberg")}),U=si({styleKey:"backgroundColor",defaultValue:Pi.backgroundColor,hasValue:e=>!!e,label:(0,i.__)("Common Cell Background Color","tableberg"),labelSelected:(0,i.__)("Cell Background Color","tableberg")}),W=si({styleKey:"elementGap",defaultValue:Pi.elementGap,hasValue:e=>e!==Pi.elementGap,label:(0,i.__)("Common Element Spacing","tableberg"),labelSelected:(0,i.__)("Element Spacing","tableberg")}),K=new Set(f),Y=(e=>Object.entries(e).map(([e,t])=>[e,t.elements||[]]))(b),X=((f.length>0?Y.filter(([e])=>K.has(e)):Y).flatMap(([,e])=>e),(0,h.useRegistry)()),ee=(e=>{const t=X.select(me.store),n=null!==(e=t.getBlock(s)?.innerBlocks)&&void 0!==e?e:[];let l;for(const e of n)for(const t of null!==(o=e.innerBlocks)&&void 0!==o?o:[]){var o;for(const e of null!==(r=t.innerBlocks)&&void 0!==r?r:[]){var r;const t=e.attributes?.align;if(t)if(void 0===l)l=t;else if(l!==t)return}}return l})(),te={label:(0,i.__)("Common Elements Alignment","tableberg"),value:ee,onChange:e=>{(e=>{var t;const n=X.select(me.store),l=X.dispatch(me.store),o=null!==(t=n.getBlock(s)?.innerBlocks)&&void 0!==t?t:[];X.batch(()=>{for(const r of o)for(const o of null!==(t=r.innerBlocks)&&void 0!==t?t:[]){var t;for(const t of null!==(n=o.innerBlocks)&&void 0!==n?n:[]){var n;e(t,l)}}})})((t,n)=>{n.updateBlockAttributes(t.clientId,{align:e})})}},ne=e=>{var t;const n=X.select(me.store),l=X.dispatch(me.store),o=null!==(t=n.getBlock(s)?.innerBlocks)&&void 0!==t?t:[];X.batch(()=>{for(const a of o)for(const o of null!==(t=a.innerBlocks)&&void 0!==t?t:[]){var t;for(const t of null!==(n=o.innerBlocks)&&void 0!==n?n:[]){var n,r;"tableberg/text"!==t.name&&"tableberg/list"!==t.name||l.updateBlockAttributes(t.clientId,{styles:{...null!==(r=t.attributes?.styles)&&void 0!==r?r:{},...void 0!==e.textColor?{textColor:e.textColor}:{},...void 0!==e.linkColor?{linkColor:e.linkColor}:{},...void 0!==e.fontSize?{fontSize:e.fontSize}:{}}})}}})},le=si({styleKey:"verticalAlign",defaultValue:Pi.verticalAlign,hasValue:e=>e!==Pi.verticalAlign,label:(0,i.__)("Common Elements Vertical Alignment","tableberg"),labelSelected:(0,i.__)("Elements Vertical Alignment","tableberg")}),{headerBackgroundColorControl:oe,evenRowBackgroundColorControl:re,oddRowBackgroundColorControl:ae,footerBackgroundColorControl:se}=function(){const e=Ha(e=>e.table),t=Ha(e=>e.cellDefaults.styles),n=Ha(e=>e.currentPage),l=Ha(e=>e.searchTerm),{clientId:o}=(0,me.useBlockEditContext)(),r=(0,h.useRegistry)(),a=(0,h.useSelect)(e=>{var t;const n=e(me.store);return ii(null!==(t=n.getBlock(o)?.innerBlocks)&&void 0!==t?t:[])},[o]),s=a.cells,c={...e,rows:a.rowsCount,cols:a.colsCount},u=(e,t)=>{if(0===e.length)return;const n=r.select(me.store),l=r.dispatch(me.store),o=new Set;r.batch(()=>{e.forEach(e=>{var r;if(o.has(e))return;o.add(e);const s=a.cellClientIds[e];if(!s)return;const i=null!==(r=n.getBlockAttributes(s)?.styles)&&void 0!==r?r:{},{backgroundColor:c,...u}=i;l.updateBlockAttributes(s,{backgroundColor:t||null,styles:u})})})},d=(({tableRows:e,tableCols:t,cells:n,tableConfig:l,searchTerm:o,currentPage:r})=>{const a=Et(),s=e;let i=a&&l.search?.enabled&&o.trim()?ut(n,e,t,l,o):Array.from({length:s},(e,t)=>t);const c=l.pagination;if(!a||!c?.enabled)return i;const u=l.headerEnabled?0:-1,d=l.footerEnabled?s-1:-1,h=i.filter(e=>e!==u&&e!==d),b=Math.max(1,c.pageSize),p=Math.max(0,Math.ceil(h.length/b)-1),g=Math.min(r,p)*b,f=Math.min(g+b,h.length),m=[];l.headerEnabled&&i.includes(0)&&m.push(0);for(let e=g;e<f;e++){const t=h[e];void 0!==t&&m.push(t)}return l.footerEnabled&&i.includes(s-1)&&m.push(s-1),i=m,i})({tableRows:c.rows,tableCols:c.cols,cells:s,tableConfig:c,searchTerm:l,currentPage:n}),b=((e,t,n)=>{const l=t.headerEnabled?0:-1,o=t.footerEnabled?n-1:-1;return e.filter(e=>e!==l&&e!==o)})(d,c,c.rows),p=e=>!!a.rows[e]?.backgroundColor,g=c.headerEnabled&&!p(0)?ui(s,[0]):[],f=c.footerEnabled&&c.rows>0&&!p(c.rows-1)?ui(s,[c.rows-1]):[],m=b.filter((e,t)=>t%2==1&&!p(e)),v=b.filter((e,t)=>t%2==0&&!p(e)),x=ui(s,m),y=ui(s,v),C=hi(g,s,t.backgroundColor),w=hi(x,s,t.backgroundColor),_=hi(y,s,t.backgroundColor),k=hi(f,s,t.backgroundColor),j=(e,t,n)=>({label:e,value:t,onChange:e=>{u(n,e)},onDeselect:()=>{u(n,"")}});return{headerBackgroundColorControl:c.headerEnabled?j((0,i.__)("Header Background Color","tableberg"),C,g):null,evenRowBackgroundColorControl:j((0,i.__)("Even Row Background Color","tableberg"),w,x),oddRowBackgroundColorControl:j((0,i.__)("Odd Row Background Color","tableberg"),_,y),footerBackgroundColorControl:c.footerEnabled?j((0,i.__)("Footer Background Color","tableberg"),k,f):null}}();return v?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(me.BlockControls,{children:[(0,J.jsx)(He,{title:(0,i.__)("Align table","tableberg"),value:S,controls:Ri,disabled:!T,onChange:e=>{T&&e&&p({tableAlignment:e})}}),(0,J.jsxs)(c.ToolbarGroup,{children:[(0,J.jsx)(c.ToolbarButton,{onClick:()=>{const e=!x;y(e),e||""===C.trim()||p({caption:""})},icon:Kt,isPressed:x,label:x?(0,i.__)("Remove caption","tableberg"):(0,i.__)("Add caption","tableberg")}),(0,J.jsx)(c.ToolbarButton,{onClick:()=>{!function(e,t){if(e.length<2)return;if(!ai(e,t.cells))return void console.warn("Cells are not mergeable");const n=[...e].sort((e,t)=>{const[n,l]=fe(e),[o,r]=fe(t);return n===o?l-r:n-o})[0],[l,o]=fe(n);let r=l,a=l,s=o,i=o;for(const n of e){const[e,l]=fe(n),o=ri(t.cells,n);r=Math.min(r,e),a=Math.max(a,e+o.rowSpan-1),s=Math.min(s,l),i=Math.max(i,l+o.colSpan-1)}const c=a-r+1,u=i-s+1,d=new Set(e),h={...t.cells};Object.keys(h).forEach(e=>{d.has(e)&&e!==n&&delete h[e]}),h[n]={...h[n]||{},span:{rowSpan:c,colSpan:u}},t.setCells(h),t.setSelectedCells([n])}(f,m)},title:"Merge Cells",icon:us,disabled:!ai(f,m.cells)})]})]}),(0,J.jsx)(me.InspectorControls,{children:(0,J.jsx)(c.TabPanel,{className:"tableberg-sidebar-tabs",initialTabName:"settings",onSelect:e=>{"settings"!==e&&"styles"!==e&&"datatable"!==e||_(e)},tabs:[{name:"settings",title:(0,i.__)("Settings","tableberg"),icon:li},{name:"styles",title:(0,i.__)("Styles","tableberg"),icon:oi},{name:"datatable",title:(0,i.__)("Datatable","tableberg"),icon:us}],children:()=>null})}),0===f.length?(0,J.jsx)(Si,{label:(0,i.__)("Additional CSS class(es)","tableberg"),value:d.className,onChange:e=>{p({className:e||""})}}):(0,J.jsx)(Si,{label:(0,i.__)("Additional CSS class(es)","tableberg"),value:f.every(e=>(b[e]?.className||"")===(b[f[0]]?.className||""))?b[f[0]]?.className:"",onChange:e=>{const t=e||"";g(Object.fromEntries(Object.entries(b).map(([e,n])=>f.includes(e)?[e,{...n,className:t}]:[e,n])))}}),"settings"===w&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(me.InspectorControls,{children:(0,J.jsxs)(c.PanelBody,{title:(0,i.__)("Table Width","tableberg"),children:[(0,J.jsxs)(c.__experimentalToggleGroupControl,{label:(0,i.__)("Width Mode","tableberg"),value:R,onChange:e=>{"string"==typeof e&&e&&("fixed"!==e?"auto"!==e&&"wide"!==e&&"full"!==e||p({tableAlignment:S,tableWidth:e}):p({tableAlignment:S,tableWidth:"fixed"===R?P:Bi}))},isBlock:!0,children:[(0,J.jsx)(c.__experimentalToggleGroupControlOption,{value:"auto",label:(0,i.__)("Auto","tableberg")}),(0,J.jsx)(c.__experimentalToggleGroupControlOption,{value:"fixed",label:(0,i.__)("Fixed","tableberg")}),(0,J.jsx)(c.__experimentalToggleGroupControlOption,{value:"wide",label:(0,i.__)("Wide","tableberg")}),(0,J.jsx)(c.__experimentalToggleGroupControlOption,{value:"full",label:(0,i.__)("Full","tableberg")})]}),T&&(0,J.jsx)(Ee,{label:(0,i.__)("Table Width","tableberg"),value:I,onChange:e=>{p({tableWidth:e?e.trim():Bi})}})]})}),(0,J.jsx)(me.InspectorControls,{children:(0,J.jsxs)(c.PanelBody,{title:(0,i.__)("Cell Elements","tableberg"),children:[null!=n?n:(0,J.jsx)(oa,{isEnhanced:!0,selected:"cell-orientation",children:(0,J.jsx)(c.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,label:(0,i.__)("Common Elements Orientation","tableberg"),value:"vertical",isBlock:!0,onChange:()=>null,children:Ei.map(({value:e,icon:t,label:n})=>(0,J.jsx)(c.__experimentalToggleGroupControlOptionIcon,{value:e,icon:t,label:n},e))})}),(0,J.jsx)(Te,{label:W.label,value:W.value,onChange:e=>{W.onChange(e)}}),(0,J.jsx)(c.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,label:te.label,value:te.value,isBlock:!0,onChange:e=>{"left"!==e&&"center"!==e&&"right"!==e||te.onChange(e)},children:Oi.map(({value:e,icon:t,label:n})=>(0,J.jsx)(c.__experimentalToggleGroupControlOptionIcon,{value:e,icon:t,label:n},e))}),(0,J.jsx)(c.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,label:le.label,value:le.value,isBlock:!0,onChange:e=>{"top"!==e&&"middle"!==e&&"bottom"!==e||le.onChange(e)},children:Mi.map(({value:e,icon:t,label:n})=>(0,J.jsx)(c.__experimentalToggleGroupControlOptionIcon,{value:e,icon:t,label:n},e))})]})}),(0,J.jsx)(me.InspectorControls,{children:(0,J.jsx)(c.PanelBody,{title:(0,i.__)("Element Font Options","tableberg"),children:(0,J.jsxs)("div",{className:"tableberg-element-font-options",children:[(0,J.jsx)(Li,{label:(0,i.__)("Set all elements' text color","tableberg"),onSelect:e=>{ne({textColor:e})},onReset:()=>{ne({textColor:"#000000"})}}),(0,J.jsx)(Li,{label:(0,i.__)("Set all elements' link color","tableberg"),onSelect:e=>{ne({linkColor:e})},onReset:()=>{ne({linkColor:""})}}),(0,J.jsx)(Fi,{label:(0,i.__)("Set all elements' font size","tableberg"),onSelect:e=>{ne({fontSize:e})},onReset:()=>{ne({fontSize:"1.38rem"})}})]})})}),(0,J.jsx)(me.InspectorControls,{children:(0,J.jsxs)(c.PanelBody,{title:(0,i.__)("Header & Footer Settings","tableberg"),children:[(0,J.jsx)(c.ToggleControl,{checked:d.headerEnabled,label:(0,i.__)("Make Top Row Header","tableberg"),onChange:e=>{p({headerEnabled:e})}}),(0,J.jsx)(c.ToggleControl,{checked:d.footerEnabled,label:(0,i.__)("Make Bottom Row Footer","tableberg"),onChange:e=>{p({footerEnabled:e})}}),null!=e?e:(0,J.jsx)(oa,{isEnhanced:!0,selected:"sticky-top-row",children:(0,J.jsx)(c.ToggleControl,{checked:!1,label:(0,i.__)("Sticky Header","tableberg"),help:(0,i.__)("Available in Tableberg Pro.","tableberg"),onChange:()=>null})}),null!=t?t:(0,J.jsx)(oa,{isEnhanced:!0,selected:"sticky-first-col",children:(0,J.jsx)(c.ToggleControl,{checked:!1,label:(0,i.__)("Sticky First Column","tableberg"),help:(0,i.__)("Available in Tableberg Pro.","tableberg"),onChange:()=>null})})]})}),(0,J.jsx)(zi,{}),(0,J.jsx)(ji,{})]}),"styles"===w&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(me.InspectorControls,{children:(0,J.jsxs)(c.__experimentalToolsPanel,{label:(0,i.__)("Colors","tableberg"),resetAll:Ti,panelId:s,className:"tableberg-colors-tools-panel",style:{gap:"0"},children:[f.length>0&&!a?(0,J.jsx)(oa,{isEnhanced:!0,selected:"cell-bg",children:(0,J.jsx)(_e,{...U})}):(0,J.jsx)(_e,{...U}),oe&&(0,J.jsx)(_e,{...oe}),(0,J.jsx)(_e,{...re}),(0,J.jsx)(_e,{...ae}),se&&(0,J.jsx)(_e,{...se})]})}),(0,J.jsx)(me.InspectorControls,{children:(0,J.jsxs)(c.__experimentalToolsPanel,{label:(0,i.__)("Dimensions","tableberg"),resetAll:Ti,panelId:s,children:[(0,J.jsx)(Ce,{...L}),(0,J.jsx)(Ce,{...q}),(0,J.jsx)(we,{...$}),(0,J.jsx)(Pe,{...Q}),(0,J.jsx)(Pe,{label:(0,i.__)("Cell Spacing","tableberg"),value:Ni({horizontal:M,vertical:A}),hasValue:()=>M!==E.horizontal||A!==E.vertical,onChange:e=>{p({cellSpacing:Di(e,{horizontal:M,vertical:A},E)})},onDeselect:()=>{p({cellSpacing:{...E}})}}),(0,J.jsx)(Pe,{...H}),(0,J.jsx)(Pe,{...G})]})})]}),"datatable"===w&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Vi,{ProColumnSortingContent:l}),(0,J.jsx)(Hi,{ProPaginationContent:r}),null!=o?o:(0,J.jsx)(me.InspectorControls,{children:(0,J.jsx)(oa,{isEnhanced:!0,selected:"search",children:(0,J.jsx)(c.__experimentalToolsPanel,{label:(0,i.__)("Search","tableberg"),resetAll:()=>null,children:(0,J.jsx)(c.__experimentalToolsPanelItem,{label:(0,i.__)("Enable Search","tableberg"),hasValue:()=>!1,onDeselect:()=>null,isShownByDefault:!0,children:(0,J.jsx)(c.ToggleControl,{checked:!1,label:(0,i.__)("Enable Search","tableberg"),onChange:()=>null})})})})})]}),k&&(0,J.jsx)(ea,{onClose:()=>j(!1),selected:"duplicate-row-col"})]})};function Gi({isSelected:e}){const t=Ha(e=>e.table.caption||""),n=Ha(e=>e.updateTable),l=Ha(e=>e.showCaption),o=Ha(e=>e.setShowCaption);return(0,u.useEffect)(()=>{""===t.trim()||l||o(!0)},[t,l,o]),(0,u.useEffect)(()=>{!e&&""===t.trim()&&l&&o(!1)},[e,t,o,l]),l||""!==t.trim()?(0,J.jsx)(me.RichText,{tagName:"figcaption",className:"tableberg-table-caption wp-element-caption","aria-label":(0,i.__)("Table caption text","tableberg"),placeholder:(0,i.__)("Add caption","tableberg"),value:t,onChange:e=>{n({caption:e})}}):null}function qi(){const e=Et(),t=Ha(e=>e.searchTerm),n=Ha(e=>e.setSearchTerm),l=Ha(e=>e.table),o=Ha(e=>e.cells),r=l.search;if(!e||!r?.enabled)return null;const a=r.placeholder,s=r.position||"left",c=t.trim()?function(e,t,n,l,o){let r=ut(e,t,n,l,o).length;return l.headerEnabled&&r--,l.footerEnabled&&r--,Math.max(0,r)}(o,l.rows,l.cols,l,t):null;return(0,J.jsxs)("div",{className:"tableberg-search",style:{justifyContent:"right"===s?"flex-end":"flex-start"},children:[(0,J.jsxs)("div",{className:"tableberg-search__input-wrapper",children:[(0,J.jsxs)("svg",{className:"tableberg-search__icon",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,J.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,J.jsx)("path",{d:"M21 21l-4.35-4.35"})]}),(0,J.jsx)("input",{type:"text",className:"tableberg-search__input",placeholder:a,value:t,onChange:e=>n(e.target.value)}),t&&(0,J.jsx)("button",{type:"button",className:"tableberg-search__clear",onClick:()=>{n("")},"aria-label":(0,i.__)("Clear search","tableberg"),children:(0,J.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:(0,J.jsx)("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})})})]}),null!==c&&(0,J.jsx)("span",{className:"tableberg-search__results",children:0===c?(0,i.__)("No results found","tableberg"):/* translators: %d is the number of matching rows */ /* translators: %d is the number of matching rows */
2 -(0,i.sprintf)((0,i._n)("%d result","%d results",c,"tableberg"),c)})]})}function $i({filteredRowCount:e}){const t=Et(),n=Ha(e=>e.currentPage),l=Ha(e=>e.setCurrentPage),o=Ha(e=>e.table),r=o.pagination,{enabled:a,pageSize:s,showPageNumbers:c,showPrevNext:u}=r;if(!t||!a)return null;const d=ga(null!=e?e:o.rows,s,o.headerEnabled,o.footerEnabled);if(d<=1)return null;const h=n>0,b=n<d-1,p="tableberg-pagination__button";return(0,J.jsxs)("div",{className:"tableberg-pagination",children:[u&&(0,J.jsx)("button",{type:"button",disabled:!h,onClick:()=>l(n-1),className:`${p} ${p}--arrow`,"aria-label":(0,i.__)("Previous Page","tableberg"),children:(0,J.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:(0,J.jsx)("path",{d:"M14.6 7L10 12l4.6 5-1.4 1.4L6.8 12l6.4-6.4z"})})}),c&&(()=>{const e=[];if(d<=5)for(let t=0;t<d;t++)e.push(t);else{e.push(0),n>2&&e.push("ellipsis");const t=Math.max(1,n-1),l=Math.min(d-2,n+1);for(let n=t;n<=l;n++)e.includes(n)||e.push(n);n<d-3&&e.push("ellipsis"),e.includes(d-1)||e.push(d-1)}return e})().map((e,t)=>{if("ellipsis"===e)return(0,J.jsx)("span",{className:"tableberg-pagination__ellipsis",children:"..."},`ellipsis-${t}`);const o=n===e;return(0,J.jsx)("button",{type:"button",onClick:()=>l(e),className:`${p}${o?` ${p}--active`:""}`,children:e+1},e)}),u&&(0,J.jsx)("button",{type:"button",disabled:!b,onClick:()=>l(n+1),className:`${p} ${p}--arrow`,"aria-label":(0,i.__)("Next Page","tableberg"),children:(0,J.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:(0,J.jsx)("path",{d:"M9.4 7l4.6 5-4.6 5 1.4 1.4 6-6.4-6-6.4z"})})})]})}var Qi=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z"})});const Ui=window.wp.keycodes;function Wi({item:e,onSelect:t}){const[n,l]=(0,u.useState)(!1),o=()=>{e.disabled||(e.isLocked?l(!0):t(e))};return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("div",{className:"tableberg-cell-inserter__list-item",children:(0,J.jsxs)(c.Button,{className:"tableberg-cell-inserter__item",onClick:o,onKeyDown:t=>{t.keyCode!==Ui.ENTER||e.disabled||(t.preventDefault(),o())},disabled:e.disabled,label:e.title,children:[(0,J.jsx)("span",{className:"tableberg-cell-inserter__item-icon",children:e.icon}),(0,J.jsx)("span",{className:"tableberg-cell-inserter__item-title",children:e.title})]})}),n&&(0,na.createPortal)((0,J.jsx)(ta,{selected:e.upsellSelected,onClose:()=>l(!1)}),document.body)]})}function Ki({items:e,onSelect:t}){return(0,J.jsx)("div",{className:"tableberg-cell-inserter__list",children:e.map(e=>(0,J.jsx)(Wi,{item:e,onSelect:t},e.name))})}const Yi=[{name:"text",title:"Text",icon:(0,J.jsx)("svg",{height:24,width:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,J.jsx)("path",{d:"M5 5V7H10V19H12V7H17V5H5Z",fill:"#671FEB"})})},{name:"button",title:"Button",icon:Ge},{name:"image",title:"Image",icon:qe},{name:"list",title:"List",icon:$e}];function Ji(){const e=Et()?[]:[{name:"styled-list",title:"Styled List",icon:$e,isLocked:!0,upsellSelected:"tableberg/styled-list"},{name:"icon",title:"Icon",icon:Zr,isLocked:!0,upsellSelected:"tableberg/icon"},{name:"star-rating",title:"Star Rating",icon:$r,isLocked:!0,upsellSelected:"tableberg/star-rating"},{name:"custom-html",title:"Custom HTML",icon:zr,isLocked:!0,upsellSelected:"tableberg/html"}];return[...Yi,...e,...We().map(e=>({name:e.name,title:e.title,icon:e.icon}))]}function Xi({items:e,onSelect:t,onClose:n}){const[l,o]=(0,u.useState)(""),{setIsInserterOpened:r}=(0,h.useDispatch)(ae.store),a=(0,u.useMemo)(()=>{const t=l.toLowerCase().trim();return t?e.filter(e=>e.title.toLowerCase().includes(t)).slice(0,6):e.slice(0,6)},[e,l]);return(0,J.jsxs)("div",{className:"tableberg-cell-inserter__content",children:[(0,J.jsx)(c.SearchControl,{className:"tableberg-cell-inserter__search",value:l,onChange:o,label:(0,i.__)("Search","tableberg"),placeholder:(0,i.__)("Search","tableberg")}),(0,J.jsx)(Ki,{items:a,onSelect:t}),(0,J.jsx)(c.Button,{className:"tableberg-cell-inserter__browse-all",onClick:()=>{n(),r(!0)},children:(0,i.__)("Browse all","tableberg")})]})}function ec({items:e,onSelect:t,onOpenChange:n}){const[l,o]=(0,u.useState)(!1);return(0,u.useEffect)(()=>{n?.(l)},[l,n]),(0,J.jsx)(c.Dropdown,{className:"tableberg-cell-inserter",contentClassName:"tableberg-cell-inserter__popover",popoverProps:{placement:"bottom-end"},onToggle:o,renderToggle:({isOpen:e,onToggle:t})=>(0,J.jsx)(c.Button,{className:"tableberg-cell-inserter__toggle",icon:Qi,label:(0,i.__)("Add element","tableberg"),onClick:e=>{e.stopPropagation(),t()},"aria-expanded":e}),renderContent:({onClose:n})=>(0,J.jsx)(Xi,{items:e,onSelect:e=>{t(e),n()},onClose:n})})}function tc(e,t){return(0,Ue.applyFilters)("tableberg.renderCellRibbon",null,e,t)}Ji();const nc=pe.cellDefaults.styles,lc={top:"flex-start",middle:"center",bottom:"flex-end"};function oc(e,t){const n=function(e){const t=e.closest(".tableberg-editor-shell[id^='block-']");return t?.id.replace(/^block-/,"")||null}(e);n&&t(n)}function rc(e,t,n){const l=je()(t,e?.className);return{...e||{},...l?{className:l}:{},style:{...e?.style||{},...n}}}function ac({span:e,cellCoords:t}){var n,l;const[o,r]=fe(t),a=Ha(e=>e.getCellStyle)(t),s={position:"relative"},c=Ha(e=>e.cellDefaults.styles.padding);!function(){let e;e=c,a?.padding&&(e=a?.padding),s.paddingTop=e?.top,s.paddingRight=e?.right,s.paddingBottom=e?.bottom,s.paddingLeft=e?.left}();const d=Ha(e=>e.cellDefaults.styles.border);!function(){let e;e=d,a?.border&&(e=a?.border),s.borderTop=e?.top,s.borderRight=e?.right,s.borderBottom=e?.bottom,s.borderLeft=e?.left}(),function(){const e=a?.borderRadius;s.borderTopLeftRadius=e?.topLeft,s.borderTopRightRadius=e?.topRight,s.borderBottomRightRadius=e?.bottomRight,s.borderBottomLeftRadius=e?.bottomLeft}();const b=Ha(e=>e.cellDefaults.styles.backgroundColor);s.backgroundColor=b,a?.backgroundColor&&(s.backgroundColor=a?.backgroundColor);const p=Ha(e=>e.cellDefaults.styles.orientation),g=a?.orientation||p||nc.orientation,f=Ha(e=>e.cellDefaults.styles.wrap),m=a?.wrap||f||nc.wrap,v=Ha(e=>e.cellDefaults.styles.elementGap),x=null!==(n=null!==(l=a?.elementGap)&&void 0!==l?l:v)&&void 0!==n?n:nc.elementGap,y=Ha(e=>e.cellDefaults.styles.verticalAlign),C=a?.verticalAlign||y||nc.verticalAlign;s.verticalAlign=C;const w=Ha(e=>e.selectedCells.includes(t));w&&(s.boxShadow="inset 0 0 0 2px var(--wp-admin-theme-color)");const _=function(e){const[t,n]=fe(e);return mi(e=>e.getCellBlockProps(t,n))}(t),k=(0,me.useBlockProps)(),j=0===o,S=o===Ha(e=>e.table.rows)-1,P=Ha(e=>e.table.headerEnabled),R=Ha(e=>e.table.footerEnabled),B=Ha(e=>{var t;return null!==(t=e.table.stickyHeader)&&void 0!==t&&t}),T=j&&P;B&&T&&(s.position="sticky",s.top="0",s.zIndex=2,s.backgroundColor||(s.backgroundColor="#fff"));const I=Ha(e=>e.sortPreviewMode),E=Ha(e=>e.tableEditPreview),O=Ha(e=>e.previewSortColumn),M=Ha(e=>e.previewSortOrder),A=Ha(e=>e.togglePreviewSort),N=Ha(e=>e.columns),D=Ha(e=>e.rows),L=Ha(e=>e.table),F=Ha(e=>{var t;return null===(t=e.table.fixedColumnWidths)||void 0===t||t}),V=Et(),H=V&&T&&!!N[r]?.sortable,z=O===r,Z=e.colSpan>1?void 0:F&&L.cols>0?100/L.cols+"%":N[r]?.width;Z&&(s.width=Z,s.minWidth=Z);const G=e.rowSpan>1?void 0:D[o]?.height;G&&(s.height=G,s.minHeight=G);let q="td";T&&(q="th"),S&&R&&(q="th");const $=Ha(e=>e.cells),Q=Ha(e=>e.addElementToCell),U=Ha(e=>e.getCellRibbon)(t),W=Ha(e=>e.setSelectedCells),K=Ha(e=>e.addSelectedCells),Y=Ha(e=>e.clearSelectedElement),{selectBlock:X}=(0,h.useDispatch)(me.store),ee=Rt(),te=$[t]?.elements||[],ne=$[t]?.className||"",[le,oe]=(0,u.useState)(!1),[re,ae]=(0,u.useState)(!1),se=!I&&(le||w||re),ie=I&&T&&H?{cursor:"pointer"}:{},ce=E&&"row"===E.target?E.index:null,ue=E&&"column"===E.target?E.index:null,de="delete"===E?.operation,he="duplicate"===E?.operation,be="insert"===E?.operation||"duplicate"===E?.operation,pe=o,ge=o+e.rowSpan-1,ve=r,xe=r+e.colSpan-1,ye=null!==ce&&ce>=0&&ce<L.rows&&ce>=pe&&ce<=ge,Ce=null!==ue&&ue>=0&&ue<L.cols&&ue>=ve&&ue<=xe,we=he&&null!==ce?Math.max(0,Math.min(ce-1,L.rows-1)):null,_e=he&&null!==ue?Math.max(0,Math.min(ue-1,L.cols-1)):null,ke=Ji(),Se=null!==we&&we>=pe&&we<=ge,Pe=null!==_e&&_e>=ve&&_e<=xe,Re=be&&null!==ce&&ce>=0&&ce<L.rows&&pe===ce,Be=be&&null!==ue&&ue>=0&&ue<L.cols&&ve===ue,Te=be&&ce===L.rows&&ge===L.rows-1,Ie=be&&ue===L.cols&&xe===L.cols-1,Ee=rc(w?k:_,je()(ne,{"is-selected":w,"tableberg-sortable-header":T&&H,"tableberg-cell-preview-delete-row":de&&ye,"tableberg-cell-preview-delete-column":de&&Ce,"tableberg-cell-preview-duplicate-source-row":he&&Se,"tableberg-cell-preview-duplicate-source-column":he&&Pe,"tableberg-cell-preview-insert-row-boundary":Re,"tableberg-cell-preview-insert-column-boundary":Be,"tableberg-cell-preview-insert-row-end":Te,"tableberg-cell-preview-insert-column-end":Ie}),{...s,...ie});return(0,J.jsxs)(q,{...Ee,rowSpan:e.rowSpan,colSpan:e.colSpan,"data-sortable":V&&T?N[r]?.sortable:void 0,onMouseEnter:()=>oe(!0),onMouseLeave:()=>oe(!1),onClick:e=>{if(I)return void(T&&H&&A(r));const{ctrlKey:n,metaKey:l,shiftKey:o}=e;if(n||l||o)return oc(e.currentTarget,X),Y(),K([t]),void ee(e.currentTarget,"Multiple Cells","Tableberg Cells: Individual cells of a tableberg table");oc(e.currentTarget,X),Y(),W([t]),ee(e.currentTarget,"Cell","Tableberg Cell: Individual cell of a tableberg table")},children:[(0,J.jsx)(sc,{cellElements:te,cellCoords:t,orientation:g,elementGap:x,wrap:m,verticalAlign:C}),T&&H?I?(0,J.jsx)("span",{className:je()("tableberg-sort-indicator",{"tableberg-sort-indicator--active":z}),style:{userSelect:"none"},title:z?(0,i.__)("Click to change sort order","tableberg"):(0,i.__)("Click to sort by this column","tableberg"),children:z?"asc"===M?"▲":"▼":"▲▼"}):(0,J.jsx)("span",{className:"tableberg-sort-indicator",style:{color:"#a0a0a0",userSelect:"none"},title:(0,i.__)("Sorting enabled. Use Preview Sorting to test.","tableberg"),children:"▲▼"}):null,U&&tc(U,t),se&&(0,J.jsx)(ec,{items:ke,onSelect:e=>{const n=ua(e.name);n&&Q(t,n)},onOpenChange:ae})]})}function sc({cellElements:e,cellCoords:t,orientation:n,elementGap:o,wrap:r,verticalAlign:i}){const c=Ha(e=>e.isElementSelected),u=(0,me.useBlockProps)(),d="horizontal"===n,h=function(e){if(0===e.length)return l;const t=s(e[0]);for(let n=1;n<e.length;n++)if(s(e[n])!==t)return;return t}(e),b={display:"flex",flexDirection:d?"row":"column",justifyContent:d?a(h||"left"):lc[i],alignItems:d?lc[i]:"stretch",gap:o,flexWrap:r};return(0,J.jsx)("div",{className:je()("tableberg-cell-elements",{"tableberg-cell-elements-horizontal":d}),style:b,children:e.map((e,n)=>{const l=c(t,n);let o;switch(e.name){case"text":o=(0,J.jsx)(Nt,{attributes:e.attributes,bindings:e.bindings,cellCoords:t,elementIndex:n},n);break;case"button":o=(0,J.jsx)($t,{attributes:e.attributes,bindings:e.bindings,cellCoords:t,elementIndex:n},n);break;case"image":o=(0,J.jsx)(sn,{attributes:e.attributes,bindings:e.bindings,cellCoords:t,elementIndex:n},n);break;case"list":o=(0,J.jsx)(sa,{attributes:e.attributes,bindings:e.bindings,cellCoords:t,elementIndex:n},n);break;default:o=function(e,t,n){var l;return null!==(l=Ke(e.name)?.render({element:e,cellCoords:t,elementIndex:n}))&&void 0!==l?l:null}(e,t,n)}return(0,J.jsx)(ic,{cellCoords:t,element:e,elementIndex:n,isHorizontal:d,isSelected:l,selectedBlockProps:u,children:o},n)})})}function ic({children:e,cellCoords:t,element:n,elementIndex:l,isHorizontal:o,isSelected:r,selectedBlockProps:i}){const c=Ha(e=>e.sortPreviewMode),u=Ha(e=>e.setSelectedElement),d=Ha(e=>e.addSelectedCells),b=Ha(e=>e.clearSelectedElement),p=Rt(),{selectBlock:g}=(0,h.useDispatch)(me.store),f=function(e,t){const[n,l]=fe(e);return mi(e=>e.getElementBlockProps(n,l,t))}(t,l),m=rc(r?i:f,je()("tableberg-cell-element",{"is-selected":r}),{display:"flex",justifyContent:a(s(n)),width:o?void 0:"100%"});return(0,J.jsx)("div",{...m,onClickCapture:e=>{if(e.ctrlKey||e.metaKey||e.shiftKey)return e.preventDefault(),e.stopPropagation(),oc(e.currentTarget,g),b(),void d([t]);c||(oc(e.currentTarget,g),u(t,l),p(e.currentTarget,n.name,`A ${n.name} element within a Tableberg cell`))},onClick:e=>{e.stopPropagation()},children:e})}function cc(){const e=Ha(e=>e.sortPreviewMode),t=Ha(e=>e.exitSortPreviewMode);return e?(0,J.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",backgroundColor:"#f0f0f1",borderBottom:"1px solid #c3c4c7",fontSize:"13px"},children:[(0,J.jsx)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:(0,J.jsx)("span",{style:{fontWeight:500,color:"#1e1e1e"},children:(0,i.__)("Sort Preview Mode","tableberg")})}),(0,J.jsx)(c.Button,{variant:"secondary",onClick:t,children:(0,i.__)("Exit Sorting Preview","tableberg")})]}):null}const uc=pe.table,dc=/^0(?:\.0+)?(?:[a-z%]+)?$/i;function hc(e){const t=e.trim();if(!t)return!1;const[n="",l=""]=t.split(/\s+/,3);return"none"!==n&&"hidden"!==n&&!dc.test(n)&&"none"!==l&&"hidden"!==l}const bc=()=>{const e=Et(),t=Ha(e=>e.table),n=Ha(e=>e.cells),l=Ha(e=>e.columns),o=Ha(e=>e.getCellSpan),r=Ha(e=>e.cellDefaults.styles.borderRadius),a=Ha(e=>e.sortPreviewMode),s=Ha(e=>e.previewSortColumn),i=Ha(e=>e.previewSortOrder),c=Ha(e=>e.currentPage),d=Ha(e=>e.setCurrentPage),b=Ha(e=>e.table.pagination),p=Ha(e=>e.searchTerm),g=Ha(e=>e.table.search),f=(0,h.useSelect)(e=>{const t=e("core/editor"),n=e("core/edit-site"),l=e("core/edit-post");return function(e){const t=(e||"desktop").toLowerCase();return"tablet"===t?"tablet":"mobile"===t?"mobile":"desktop"}(t?.getDeviceType?.()||n?.__experimentalGetPreviewDeviceType?.()||l?.__experimentalGetPreviewDeviceType?.())},[]),{rows:m,cols:v}=t,x=e&&b.enabled,y=e&&(g?.enabled||!1),C=t.tableAlignment||"left",w=(t.tableWidth||"auto").trim(),_="auto"!==w&&"wide"!==w&&"full"!==w,k=_?w:"100%",j=_?`justify-table-${C}`:"",S=uc.cellSpacing,P=t.cellSpacing||S,R=uc.tableBorder,B=t.tableBorder||R,T=hc(B.top),I=hc(B.right),E=hc(B.bottom),O=hc(B.left),M=P.horizontal||S.horizontal,A=P.vertical||S.vertical,N="0"===M,D="0"===A,L=!N||!D,F=["wp-block-tableberg",T?"tableberg-has-table-border-top":"",I?"tableberg-has-table-border-right":"",E?"tableberg-has-table-border-bottom":"",O?"tableberg-has-table-border-left":"",L?"tableberg-has-cell-spacing":"",L&&N?"tableberg-cell-spacing-horizontal-zero":"",L&&D?"tableberg-cell-spacing-vertical-zero":""].filter(Boolean).join(" "),V="desktop"===f?null:function(e,t){const n={...t,...e||{}};return n.transpose="boolean"==typeof e?.transpose?e.transpose:"row"===e?.direction,n.repeatFirstCol="boolean"==typeof e?.repeatFirstCol?e.repeatFirstCol:!!e?.headerAsCol,n}(t.responsive?.[f],uc.responsive[f]),H=!!V?.enabled&&!!V?.mode,z=H&&"scroll"===V?.mode?"tableberg-scroll-x":"",Z=H?Math.max(1,V?.stackCount||1):1,G=je()("tableberg-table-wrapper",j,z),q=(0,u.useMemo)(()=>y&&p.trim()?ut(n,m,v,t,p):Array.from({length:m},(e,t)=>t),[y,p,n,m,v,t]),$=(0,u.useMemo)(()=>{if(!e||!a||null===s)return q;const o=l[s]?.sortable||"text";if(y&&p.trim()){const{headerEnabled:e,footerEnabled:l}=t,r=e?0:-1,a=l?m-1:-1,c=q.filter(e=>e!==r&&e!==a).map(e=>{const t=n[`${e},${s}`]?.elements||[],l=t.length>0?ca(t[0]):"";let r;switch(o){case"number":{const e=l.replace(/[^0-9.-]/g,""),t=parseFloat(e);r=isNaN(t)?0:t;break}case"date":{const e=new Date(l);r=isNaN(e.getTime())?new Date(0):e;break}default:r=l.toLowerCase()}return{index:e,value:r}});c.sort(({value:e},{value:t})=>{let n;return n="number"==typeof e&&"number"==typeof t?e-t:e instanceof Date&&t instanceof Date?e.getTime()-t.getTime():String(e).localeCompare(String(t)),"asc"===i?n:-n});const u=[];e&&q.includes(0)&&u.push(0);for(const{index:e}of c)u.push(e);return l&&q.includes(m-1)&&u.push(m-1),u}return ba(n,m,t,s,o,i)},[a,s,i,q,n,l,t,m,y,p,e]),Q=(0,u.useMemo)(()=>{let e=$;if(x){const{headerEnabled:n,footerEnabled:l}=t,o=n?0:-1,r=l?m-1:-1,a=e.filter(e=>e!==o&&e!==r),{pageSize:s}=b,i=c*s,u=Math.min(i+s,a.length),h=Math.max(0,Math.ceil(a.length/s)-1);c>h&&h>=0&&d(h);const p=[];n&&e.includes(0)&&p.push(0);for(let e=i;e<u;e++)p.push(a[e]);l&&e.includes(m-1)&&p.push(m-1),e=p}return e},[$,x,c,b.pageSize,t,m,d]),U=e=>{if(a||x)return new Set;const t=new Set;for(const[l,o]of Object.entries(n)){const n=o.span;if(!n)continue;const[r,a]=l.split(",").map(Number);if(r<=e&&r+n.rowSpan>e)for(let l=0;l<n.colSpan;l++)r!==e&&t.add(a+l)}return t},W=[],K=[];for(const e of Q){const t=[],n=[],l=U(e);for(let r=0;r<v;r++){if(l.has(r))continue;const s=`${e},${r}`,i=o(s);if(!a&&!x)for(let e=1;e<i.colSpan;e++)l.add(r+e);n.push({coords:ge(e,r),span:i,key:s}),t.push((0,J.jsx)(ac,{span:i,cellCoords:s},s))}K.push(n),W.push((0,J.jsx)("tr",{children:t},e))}let Y=W;if(H&&"stack"===V?.mode){const e=function(e,t,n,l){if(0===e.length)return[];const o=e.reduce((e,t)=>Math.max(e,t.length),0);if(0===o)return[];const r=e.map(e=>{const t=e.map(e=>e);for(;t.length<o;)t.push(null);return t}),a=n?Array.from({length:o},(e,t)=>r.map(e=>e[t]||null)):r,s=a[0]?.length||0;if(0===s)return[];const i=l?Math.max(2,t):Math.max(1,t),c=[];if(!l){const e=Math.ceil(s/i);for(let t=0;t<e;t++){const e=t*i,n=Math.min(e+i,s);for(let t=0;t<a.length;t++){const l=a[t].slice(e,n).filter(e=>null!==e);l.length>0&&c.push(l)}}return c}const u=Math.max(1,i-1),d=s<=1?1:Math.ceil((s-1)/u);for(let e=0;e<d;e++){const t=1+e*u,n=Math.min(t+u,s);for(let l=0;l<a.length;l++){const o=a[l][0],r=a[l].slice(t,n).filter(e=>null!==e),s=[];o&&(0===e?s.push(o):s.push({...o,key:`${o.key}-repeat-${e}`,span:{rowSpan:1,colSpan:1}})),s.push(...r),s.length>0&&c.push(s)}}return c}(K,Z,V.transpose,V.repeatFirstCol);Y=e.map((e,t)=>(0,J.jsx)("tr",{children:e.map((e,n)=>(0,J.jsx)(ac,{span:{rowSpan:1,colSpan:1},cellCoords:e.coords},`${e.key}-${t}-${n}`))},`responsive-preview-row-${t}`))}const X=r?.topLeft||r?.topRight||r?.bottomRight||r?.bottomLeft?{borderTopLeftRadius:r?.topLeft,borderTopRightRadius:r?.topRight,borderBottomRightRadius:r?.bottomRight,borderBottomLeftRadius:r?.bottomLeft,overflow:"hidden"}:void 0;return(0,J.jsxs)("div",{className:G,style:X,children:[(0,J.jsx)(qi,{}),(0,J.jsx)(cc,{}),(0,J.jsx)("table",{className:F,"data-tableberg-editor-preview":H?f:void 0,style:{borderCollapse:L?"separate":"collapse",borderSpacing:L?`${M} ${A}`:void 0,width:k,..._?{maxWidth:k}:{},borderTop:B.top||void 0,borderRight:B.right||void 0,borderBottom:B.bottom||void 0,borderLeft:B.left||void 0},children:(0,J.jsx)("tbody",{children:Y})}),(0,J.jsx)($i,{filteredRowCount:$.length})]})},pc=new class{#z;#L;#u;#Z;#G;#q;#$;#Q;constructor(e={}){this.#z=e.queryCache||new Ls,this.#L=e.mutationCache||new Vs,this.#u=e.defaultOptions||{},this.#Z=new Map,this.#G=new Map,this.#q=0}mount(){this.#q++,1===this.#q&&(this.#$=A.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#z.onFocus())}),this.#Q=L.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#z.onOnline())}))}unmount(){this.#q--,0===this.#q&&(this.#$?.(),this.#$=void 0,this.#Q?.(),this.#Q=void 0)}isFetching(e){return this.#z.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#L.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#z.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=this.#z.build(this,t),l=n.state.data;return void 0===l?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(v(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(l))}getQueriesData(e){return this.#z.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){const l=this.defaultQueryOptions({queryKey:e}),o=this.#z.get(l.queryHash),r=o?.state.data,a=function(e,t){return"function"==typeof e?e(t):e}(t,r);if(void 0!==a)return this.#z.build(this,l).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return D.batch(()=>this.#z.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#z.get(t.queryHash)?.state}removeQueries(e){const t=this.#z;D.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){const n=this.#z;return D.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},l=D.batch(()=>this.#z.findAll(e).map(e=>e.cancel(n)));return Promise.all(l).then(g).catch(g)}invalidateQueries(e,t={}){return D.batch(()=>(this.#z.findAll(e).forEach(e=>{e.invalidate()}),"none"===e?.refetchType?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},l=D.batch(()=>this.#z.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(g)),"paused"===e.state.fetchStatus?Promise.resolve():t}));return Promise.all(l).then(g)}fetchQuery(e){const t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);const n=this.#z.build(this,t);return n.isStaleByTime(v(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(g).catch(g)}fetchInfiniteQuery(e){return e.behavior=zs(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(g).catch(g)}ensureInfiniteQueryData(e){return e.behavior=zs(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return L.isOnline()?this.#L.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#z}getMutationCache(){return this.#L}getDefaultOptions(){return this.#u}setDefaultOptions(e){this.#u=e}setQueryDefaults(e,t){this.#Z.set(_(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#Z.values()],n={};return t.forEach(t=>{k(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#G.set(_(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#G.values()],n={};return t.forEach(t=>{k(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#u.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=w(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===O&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#u.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#z.clear(),this.#L.clear()}}({defaultOptions:{queries:{gcTime:864e5,staleTime:1/0,refetchOnWindowFocus:!1}}});function gc({onCreate:e}){const[t,n]=(0,u.useState)("4"),[l,o]=(0,u.useState)("4");return(0,J.jsx)(c.Placeholder,{icon:Gr,label:(0,i.__)("Tableberg Table (native)","tableberg"),instructions:(0,i.__)("Choose the table size to get started.","tableberg"),children:(0,J.jsxs)("div",{style:{display:"flex",gap:"8px",alignItems:"flex-end"},children:[(0,J.jsx)(c.TextControl,{label:(0,i.__)("Rows","tableberg"),type:"number",min:1,value:t,onChange:n}),(0,J.jsx)(c.TextControl,{label:(0,i.__)("Columns","tableberg"),type:"number",min:1,value:l,onChange:o}),(0,J.jsx)(c.Button,{variant:"primary",onClick:()=>{const n=Math.max(1,parseInt(t,10)||0),o=Math.max(1,parseInt(l,10)||0);e(n,o)},children:(0,i.__)("Create Table","tableberg")})]})})}function fc(e){var t,n;const{attributes:l,setAttributes:o,clientId:r}=e,{replaceInnerBlocks:a}=(0,h.useDispatch)(me.store),s=Object.fromEntries(Object.entries(e).filter(([e])=>e.startsWith("Pro"))),i=(0,h.useSelect)(e=>e(me.store).getBlockCount(r)>0,[r]),c=Us(l)&&(null!==(t=l.table?.rows)&&void 0!==t?t:0)>0;(0,u.useEffect)(()=>{if(!c)return;const e=Ys(l);o(Ws(l)),a(r,e,!1)},[c]);const d=l.table,b=(d?.tableWidth||"auto").trim(),p=function(){const e=(0,u.useContext)(Na);if(!e)throw new Error("useTableStoreApi must be used within TableStoreProvider");return e}(),g=Ha(e=>e.sortPreviewMode),f=Ha(e=>e.searchTerm),m=Ha(e=>e.setSearchTerm),v=!!l.table?.search?.enabled;(0,u.useEffect)(()=>{!v&&f&&m("")},[v]);const x=(0,h.useSelect)(e=>(e("core/editor")?.getDeviceType?.()||e("core/edit-site")?.__experimentalGetPreviewDeviceType?.()||e("core/edit-post")?.__experimentalGetPreviewDeviceType?.()||"Desktop").toLowerCase(),[]),y="desktop"!==x&&!!d?.responsive?.[x]?.enabled,C=!c&&(g||!!f.trim()||y),[w,_]=(0,u.useState)(!1);(0,u.useEffect)(()=>{var e;if(!C)return void _(!1);const t=(0,h.select)(me.store),n=ii(null!==(e=t.getBlock(r)?.innerBlocks)&&void 0!==e?e:[]);p.setState({cells:n.cells,rows:n.rows,table:{...p.getState().table,rows:n.rowsCount,cols:n.colsCount}}),_(!0)},[C,r,p]);const k=(0,me.useBlockProps)({className:`wp-block-tableberg tableberg-native-editor${"wide"===b?" alignwide":"full"===b?" alignfull":""}${d?.stickyHeader?" tableberg-native-sticky-header":""}`}),j=(0,me.useInnerBlocksProps)({},{allowedBlocks:["tableberg/row"],renderAppender:!1}),S=Ha(e=>e.currentPage),P=d?.pagination,R=Et()&&!!P?.enabled,B=(0,h.useSelect)(e=>{var t;if(!R)return{rowCount:0,hasRowSpans:!1};const n=e(me.store),l=null!==(t=n.getBlock(r)?.innerBlocks)&&void 0!==t?t:[];let o=!1;for(const e of l){for(const t of null!==(a=e.innerBlocks)&&void 0!==a?a:[]){var a,s;if((null!==(s=t.attributes?.span?.rowSpan)&&void 0!==s?s:1)>1){o=!0;break}}if(o)break}return{rowCount:l.length,hasRowSpans:o}},[r,R]),T=R&&!B.hasRowSpans;let I="",E=0;if(T){var O;const e=!!d?.headerEnabled,t=!!d?.footerEnabled;E=B.rowCount-(e?1:0)-(t?1:0);const n=new Set(function(e,t,n,l,o){const r=[];l&&r.push(0);const a=l?1:0,s=(o?e-2:e-1)-a+1;if(s>0&&t>0){const e=n*t,l=Math.min(e+t-1,s-1);for(let t=e;t<=l;t++)r.push(a+t)}return o&&r.push(e-1),r}(B.rowCount,Math.max(1,null!==(O=P?.pageSize)&&void 0!==O?O:10),S,e,t)),l=[];for(let e=0;e<B.rowCount;e++)n.has(e)||l.push(e);I=l.map(e=>`#block-${r} table > tbody > tr:nth-child(${e+1}) { display: none; }`).join("\n")}if(!i&&!c)return(0,J.jsx)("figure",{...k,children:(0,J.jsx)(gc,{onCreate:(e,t)=>{const n=function(e,t){const n={};for(let l=0;l<e;l++)for(let e=0;e<t;e++)n[`${l},${e}`]={elements:[{name:"text",attributes:{}}]};return{version:3,table:{...pe.table,rows:e,cols:t,headerEnabled:!1,footerEnabled:!1},cells:n}}(e,t),l=Ys(n);o(Ws(n)),a(r,l,!1)}})});const M=d?.cellSpacing?.horizontal?.trim()||"0",A=d?.cellSpacing?.vertical?.trim()||"0",N="0"!==M&&""!==M||"0"!==A&&""!==A,D={borderCollapse:N?"separate":"collapse",borderSpacing:N?`${M} ${A}`:void 0,width:"100%",borderTop:d?.tableBorder?.top||void 0,borderRight:d?.tableBorder?.right||void 0,borderBottom:d?.tableBorder?.bottom||void 0,borderLeft:d?.tableBorder?.left||void 0},L=null!==(n=d?.cols)&&void 0!==n?n:0,F=L>0?d?.fixedColumnWidths?Array.from({length:L},()=>100/L+"%"):Array.from({length:L},(e,t)=>l.columns?.[t]?.width):null,V={},H=d?.margin,z=d?.padding;H?.top&&(V.marginTop=H.top),H?.right&&(V.marginRight=H.right),H?.bottom&&(V.marginBottom=H.bottom),H?.left&&(V.marginLeft=H.left),z?.top&&(V.paddingTop=z.top),z?.right&&(V.paddingRight=z.right),z?.bottom&&(V.paddingBottom=z.bottom),z?.left&&(V.paddingLeft=z.left);const Z=l.cellDefaults?.styles?.borderRadius,G=Z?.topLeft||Z?.topRight||Z?.bottomRight||Z?.bottomLeft?{borderTopLeftRadius:Z?.topLeft,borderTopRightRadius:Z?.topRight,borderBottomRightRadius:Z?.bottomRight,borderBottomLeftRadius:Z?.bottomLeft,overflow:"hidden"}:void 0;return C&&w?(0,J.jsxs)("figure",{...k,style:{...k.style||{},...V},children:[(0,J.jsx)(bc,{}),(0,J.jsx)(Gi,{isSelected:e.isSelected}),(0,J.jsx)(Zi,{...s})]}):(0,J.jsxs)("figure",{...k,style:{...k.style||{},...V},children:[(0,J.jsx)(qi,{}),T&&I&&(0,J.jsx)("style",{children:I}),(0,J.jsx)("div",{style:G,children:(0,J.jsx)("div",{className:"tableberg-native-table-scroll",children:(0,J.jsxs)("table",{className:"tableberg-table",style:D,children:[F&&(0,J.jsx)("colgroup",{children:F.map((e,t)=>(0,J.jsx)("col",{style:e?{width:e}:void 0},t))}),(0,J.jsx)("tbody",{...j})]})})}),T&&(0,J.jsx)($i,{filteredRowCount:E}),(0,J.jsx)(Gi,{isSelected:e.isSelected}),(0,J.jsx)(Zi,{...s})]})}const mc={attributes:qs.uK,supports:qs.xY,isEligible:e=>Us(e),save(){const e=me.useBlockProps.save(),t=me.useInnerBlocksProps.save(e);return(0,J.jsx)("table",{...t})},migrate:e=>[Ws(e),Ys(e)]};(0,ve.registerBlockType)(ns.name,{...ns,icon:Gr,edit:function({clientId:e,attributes:t,setAttributes:n,isSelected:l,ProRowBackgroundContent:o,ProRowBorderControl:r}){var a,s,u;const d=(0,h.useRegistry)(),{updateBlockAttributes:b}=(0,h.useDispatch)(me.store),p=null!==(a=t.border)&&void 0!==a?a:ls,g=(0,me.useBlockProps)({style:{height:t.height||void 0,backgroundColor:t.backgroundColor||void 0,borderTop:p.top||void 0,borderRight:p.right||void 0,borderBottom:p.bottom||void 0,borderLeft:p.left||void 0}}),f=(0,me.useInnerBlocksProps)(g,{allowedBlocks:["tableberg/cell"],renderAppender:!1}),m={rowBackgroundColorControl:{label:(0,i.__)("Row Background Color","tableberg"),value:null!==(s=t.backgroundColor)&&void 0!==s?s:"",onChange:t=>{n({backgroundColor:t||void 0}),t&&(()=>{var t;const n=d.select(me.store),l=(null!==(t=n.getBlock(e)?.innerBlocks)&&void 0!==t?t:[]).filter(e=>"tableberg/cell"===e.name).map(e=>e.clientId);d.batch(()=>{l.forEach(e=>{var t;const l=null!==(t=n.getBlockAttributes(e)?.styles)&&void 0!==t?t:{},{backgroundColor:o,...r}=l;b(e,{backgroundColor:null,styles:r})})})})()},onDeselect:()=>n({backgroundColor:void 0})}},v={label:(0,i.__)("Row Border","tableberg"),value:p,hasValue:()=>!!(p.top||p.right||p.bottom||p.left),onChange:e=>n({border:e}),onDeselect:()=>n({border:void 0})};return(0,J.jsxs)(J.Fragment,{children:[l&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(me.InspectorControls,{children:(0,J.jsx)(c.PanelBody,{title:(0,i.__)("Row Settings","tableberg"),children:(0,J.jsx)(c.__experimentalUnitControl,{label:(0,i.__)("Row Height","tableberg"),value:null!==(u=t.height)&&void 0!==u?u:"",onChange:e=>n({height:e||void 0})})})}),(0,J.jsx)(me.InspectorControls,{group:"color",children:o?o(m):(0,J.jsx)(oa,{isEnhanced:!0,selected:"row-bg",children:(0,J.jsx)(_e,{...m.rowBackgroundColorControl})})}),(0,J.jsx)(me.InspectorControls,{group:"border",children:null!=r?r:(0,J.jsx)(oa,{isEnhanced:!0,selected:"row-border",children:(0,J.jsx)(Ce,{...v})})})]}),(0,J.jsx)("tr",{...f})]})},save:()=>(0,J.jsx)(me.InnerBlocks.Content,{})}),(0,ve.registerBlockType)(ds.name,{...ds,icon:Gr,edit:function(e){var t,n,l,o,r,a,s,i,c,u,d,b,p,g;const{attributes:f,clientId:m,context:v,isSelected:x}=e,y=v?.["tableberg/tableConfig"],C=Ha(e=>e.nativeSelectedCells),w=Ha(e=>e.setNativeSelectedCells),{selectBlock:_}=(0,h.useDispatch)(me.store),k=C.includes(m),j=v?.["tableberg/cellDefaults"],S=v?.["tableberg/rowBackgroundColor"],P="body"===function(e,t){return(0,h.useSelect)(n=>{if(!t?.headerEnabled&&!t?.footerEnabled)return"body";const l=n(me.store),o=l.getBlockRootClientId(e);if(!o)return"body";const r=l.getBlockRootClientId(o),a=l.getBlockIndex(o),s=l.getBlockCount(r);return t.headerEnabled&&0===a?"header":t.footerEnabled&&a===s-1?"footer":"body"},[e,t?.headerEnabled,t?.footerEnabled])}(m,y)?"td":"th",R=j?.styles,B=f.styles,T={paddingTop:null!==(t=B?.padding?.top)&&void 0!==t?t:R?.padding?.top,paddingRight:null!==(n=B?.padding?.right)&&void 0!==n?n:R?.padding?.right,paddingBottom:null!==(l=B?.padding?.bottom)&&void 0!==l?l:R?.padding?.bottom,paddingLeft:null!==(o=B?.padding?.left)&&void 0!==o?o:R?.padding?.left,backgroundColor:S?void 0:null!==(r=R?.backgroundColor)&&void 0!==r?r:void 0,verticalAlign:null!==(a=B?.verticalAlign)&&void 0!==a?a:R?.verticalAlign,borderTop:R?.border?.top||void 0,borderRight:R?.border?.right||void 0,borderBottom:R?.border?.bottom||void 0,borderLeft:R?.border?.left||void 0,borderTopLeftRadius:B?.borderRadius?.topLeft,borderTopRightRadius:B?.borderRadius?.topRight,borderBottomRightRadius:B?.borderRadius?.bottomRight,borderBottomLeftRadius:B?.borderRadius?.bottomLeft},I=null!==(s=B?.orientation)&&void 0!==s?s:R?.orientation,E=null!==(i=B?.elementGap)&&void 0!==i?i:R?.elementGap,O=null!==(c=B?.wrap)&&void 0!==c?c:R?.wrap,M={display:"flex",flexDirection:"horizontal"===I?"row":"column",gap:E||void 0};"horizontal"===I&&(M.alignItems="center",M.flexWrap="nowrap"===O?"nowrap":"wrap"),k&&(T.boxShadow="inset 0 0 0 2px var(--wp-admin-theme-color, #3858e9)"),Object.assign(T,null!==(u=e.cellStyles)&&void 0!==u?u:{});const A=(0,me.useBlockProps)({style:T}),N=(0,me.useInnerBlocksProps)({className:"tableberg-cell-content",style:M},{allowedBlocks:Bs,template:[["tableberg/text",{}]],defaultBlock:{name:"tableberg/text"},directInsert:!0}),D=!!y?.stickyFirstCol;(0,h.useSelect)(e=>!!D&&0===e(me.store).getBlockIndex(m),[m,D])&&(T.position="sticky",T.left=0,T.zIndex=1,T.backgroundColor||(T.backgroundColor="#fff"));const L=(null!==(d=f.span?.rowSpan)&&void 0!==d?d:1)>1||(null!==(b=f.span?.colSpan)&&void 0!==b?b:1)>1;return(0,J.jsxs)(J.Fragment,{children:[x&&(0,J.jsx)(Ts,{clientId:m,hasSpan:L,proToolbarControls:e.cellProToolbarControls}),x&&(0,J.jsx)(Is,{attributes:f,setAttributes:e.setAttributes,CellBackgroundControl:e.CellBackgroundControl,CellRibbonPanel:e.CellRibbonPanel,CellBorderControl:e.CellBorderControl,CellEmptyControl:e.CellEmptyControl}),x&&(0,J.jsx)(_s,{clientId:m}),x&&(0,J.jsx)(ks,{clientId:m,cellDefaultsBackgroundColor:null!==(p=R?.backgroundColor)&&void 0!==p?p:"",ProColumnBackgroundContent:e.ProColumnBackgroundContent}),x&&(0,J.jsx)(Ps,{clientId:m,cellDefaultsBorder:null!==(g=R?.border)&&void 0!==g?g:Rs,ProColumnBorderContent:e.ProColumnBorderContent}),(0,J.jsxs)(P,{...A,rowSpan:f.span?.rowSpan,colSpan:f.span?.colSpan,onMouseDownCapture:e=>{if(e.metaKey||e.ctrlKey||e.shiftKey){e.preventDefault(),e.stopPropagation(),e.nativeEvent.stopImmediatePropagation?.();const t=k?C.filter(e=>e!==m):[...C,m];return w(t),void _(m)}C.length>0&&w([])},style:A.style,children:[(0,J.jsx)("div",{...N}),e.CellRibbonOverlay,e.CellEmptyBadge]})]})},save:()=>(0,J.jsx)(me.InnerBlocks.Content,{})}),(0,ve.registerBlockType)(Es.name,{...Es,icon:Ur,edit:function({attributes:e,setAttributes:t,isSelected:n,onReplace:l,onRemove:o,insertBlocksAfter:r,clientId:a}){const s=Ze(e,Mt,void 0,{},(0,i.__)("(No data)","tableberg")),{content:c,align:u,styles:d}=s,h=(0,me.useBlockProps)({style:Os(u)}),b=At(d.padding),p=At(d.margin),g={margin:null!=p?p:0,padding:b,color:d.textColor||void 0,fontSize:d.fontSize||void 0,backgroundColor:d.backgroundColor||void 0,"--tableberg-text-link-color":d.linkColor||void 0};return(0,J.jsxs)("div",{...h,onPasteCapture:e=>{var t;const n=null!==(t=e.clipboardData?.getData("text/plain"))&&void 0!==t?t:"";if(!n.includes("\x3c!-- wp:tableberg/"))return;const o=(0,ve.parse)(n);0===o.length||o.some(e=>!e.name)||(e.preventDefault(),e.stopPropagation(),!c&&l?l(o):r&&r(o))},children:[n&&(0,J.jsx)(Ms,{align:u,onChange:e=>t({align:e})}),n&&(0,J.jsx)(Tt,{attributes:s,bindings:e.bindings,updateStyles:n=>{var l;return t({styles:{...null!==(l=e.styles)&&void 0!==l?l:s.styles,...n}})}}),(0,J.jsx)(me.RichText,{tagName:"p",className:"tableberg-text-element",identifier:"content",allowedFormats:["core/bold","core/italic","core/link","core/strikethrough","core/underline"],placeholder:(0,i.__)("Type here","tableberg"),value:c,onChange:e=>t({content:e}),onSplit:(t,n)=>{let l;return l=n||t?(0,ve.createBlock)("tableberg/text",{...e,content:t}):(0,ve.createBlock)("tableberg/text",{...e,content:""}),n&&(l.clientId=a),l},onReplace:l,onRemove:o,style:g})]})},save:()=>null}),(0,ve.registerBlockType)(As.name,{...As,icon:Ge,edit:function({attributes:e,setAttributes:t,isSelected:n}){const l=Ze(e,qt,void 0,{},(0,i.__)("(No data)","tableberg")),{content:o,align:r,styles:a}=l,s=(0,me.useBlockProps)({style:Os(r)}),c={backgroundColor:a.backgroundColor||void 0,color:a.textColor||void 0,fontSize:a.fontSize||void 0,textAlign:a.textAlign,width:"auto"===a.width?void 0:a.width,paddingTop:a.padding?.top,paddingRight:a.padding?.right,paddingBottom:a.padding?.bottom,paddingLeft:a.padding?.left,borderTopLeftRadius:a.borderRadius?.topLeft,borderTopRightRadius:a.borderRadius?.topRight,borderBottomRightRadius:a.borderRadius?.bottomRight,borderBottomLeftRadius:a.borderRadius?.bottomLeft,border:"none",cursor:"text"};return(0,J.jsxs)("div",{...s,children:[n&&(0,J.jsx)(Ms,{align:r,onChange:e=>t({align:e})}),n&&(0,J.jsx)(Gt,{attributes:l,bindings:e.bindings,cellCoords:"0,0",elementIndex:0,updateStyles:n=>{var o;return t({styles:{...null!==(o=e.styles)&&void 0!==o?o:l.styles,...n}})},updateAttrs:e=>t(e)}),(0,J.jsx)(me.RichText,{tagName:"div",className:"tableberg-button-element",placeholder:(0,i.__)("Button text","tableberg"),value:o,onChange:e=>t({content:e}),style:c})]})},save:()=>null}),(0,ve.registerBlockType)(Ns.name,{...Ns,icon:qe,edit:function({attributes:e,setAttributes:t,isSelected:n}){const l=Ze(e,an,void 0,{},(0,i.__)("(No data)","tableberg")),{media:o,alt:r,align:a,width:s,height:c,aspectRatio:d,scale:h}=l,{border:b,borderRadius:p}=l,[g,f]=(0,u.useState)(!!l.caption),m=(0,me.useBlockProps)({style:Os(a)}),v=n&&o?.url&&(0,J.jsx)(rn,{attributes:l,bindings:e.bindings,showCaption:g,setShowCaption:f,cellCoords:"0,0",elementIndex:0,updateAttrs:e=>t(e)});return o?.url?(0,J.jsxs)("div",{...m,children:[n&&(0,J.jsx)(Ms,{align:a,onChange:e=>t({align:e})}),v,(0,J.jsx)("img",{src:o.url,alt:r,style:{width:s||void 0,height:c||void 0,aspectRatio:d||void 0,objectFit:h,borderTop:b?.top||void 0,borderRight:b?.right||void 0,borderBottom:b?.bottom||void 0,borderLeft:b?.left||void 0,borderTopLeftRadius:p?.topLeft||void 0,borderTopRightRadius:p?.topRight||void 0,borderBottomRightRadius:p?.bottomRight||void 0,borderBottomLeftRadius:p?.bottomLeft||void 0}})]}):(0,J.jsx)("div",{...m,children:(0,J.jsx)(me.MediaPlaceholder,{icon:"format-image",labels:{title:(0,i.__)("Image","tableberg")},accept:"image/*",allowedTypes:["image"],onSelect:e=>{var n;return t({media:{id:e.id,url:e.url},alt:null!==(n=e.alt)&&void 0!==n?n:""})}})})},save:()=>null}),(0,ve.registerBlockType)(Ds.name,{...Ds,icon:$e,edit:ts(Ds.name,sa),save:()=>null}),(0,ve.registerBlockType)(qs.UU,{title:qs.DD,icon:Gr,category:qs.L1,attributes:qs.uK,providesContext:{"tableberg/tableConfig":"table","tableberg/cellDefaults":"cellDefaults"},transforms:Xs,edit:function(e){return e.attributes.isExample?(0,J.jsx)("img",{src:$s,style:{maxWidth:"100%"},alt:"Tableberg table"}):(0,J.jsx)(Va,{clientId:e.clientId,attributes:e.attributes,setAttributes:e.setAttributes,contentSyncDisabled:!0,children:(0,J.jsx)(fi,{children:(0,J.jsx)(te,{client:pc,children:(0,J.jsx)(fc,{...e})})})})},save:function(){return(0,J.jsx)(me.InnerBlocks.Content,{})},deprecated:[mc]})}},n={};function l(e){var o=n[e];if(void 0!==o)return o.exports;var r=n[e]={exports:{}};return t[e](r,r.exports,l),r.exports}l.m=t,e=[],l.O=(t,n,o,r)=>{if(!n){var a=1/0;for(u=0;u<e.length;u++){for(var[n,o,r]=e[u],s=!0,i=0;i<n.length;i++)(!1&r||a>=r)&&Object.keys(l.O).every(e=>l.O[e](n[i]))?n.splice(i--,1):(s=!1,r<a&&(a=r));if(s){e.splice(u--,1);var c=o();void 0!==c&&(t=c)}}return t}r=r||0;for(var u=e.length;u>0&&e[u-1][2]>r;u--)e[u]=e[u-1];e[u]=[n,o,r]},l.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return l.d(t,{a:t}),t},l.d=(e,t)=>{for(var n in t)l.o(t,n)&&!l.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},l.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),l.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e;l.g.importScripts&&(e=l.g.location+"");var t=l.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");if(n.length)for(var o=n.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=n[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),l.p=e})(),(()=>{var e={57:0,350:0};l.O.j=t=>0===e[t];var t=(t,n)=>{var o,r,[a,s,i]=n,c=0;if(a.some(t=>0!==e[t])){for(o in s)l.o(s,o)&&(l.m[o]=s[o]);if(i)var u=i(l)}for(t&&t(n);c<a.length;c++)r=a[c],l.o(e,r)&&e[r]&&e[r][0](),e[r]=0;return l.O(u)},n=globalThis.webpackChunktableberg=globalThis.webpackChunktableberg||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var o=l.O(void 0,[350],()=>l(970));o=l.O(o)})();
1 +(()=>{var e,t={34:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},265:(e,t,n)=>{"use strict";var l=n(34);function o(){}function r(){}r.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,r,a){if(a!==l){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:r,resetWarningCache:o};return n.PropTypes=n,n}},395:(e,t)=>{var n;!function(){"use strict";var l={}.hasOwnProperty;function o(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=a(e,r(n)))}return e}function r(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return o.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var n in e)l.call(e,n)&&e[n]&&(t=a(t,n));return t}function a(e,t){return t?e?e+" "+t:e+t:e}e.exports?(o.default=o,e.exports=o):void 0===(n=function(){return o}.apply(t,[]))||(e.exports=n)}()},672:(e,t,n)=>{"use strict";const l="left";function o(e){return"object"==typeof e&&null!==e}function r(e){return"left"===e||"center"===e||"right"===e}function a(e){return"center"===e?"center":"right"===e?"flex-end":"flex-start"}function s(e){const t=e.name,n=o(e.attributes)?e.attributes:{};if("icon"===t){const e=n.styles,t=o(e)?e:{};return r(t.align)?t.align:l}return r(n.align)?n.align:l}const i=window.wp.i18n,c=window.wp.components,u=window.React;var d=n.n(u);const h=window.wp.data;var b=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},g="undefined"==typeof window||"Deno"in globalThis;function p(){}function f(e){return"number"==typeof e&&e>=0&&e!==1/0}function m(e,t){return Math.max(e+(t||0)-Date.now(),0)}function v(e,t){return"function"==typeof e?e(t):e}function x(e,t){return"function"==typeof e?e(t):e}function y(e,t){const{type:n="all",exact:l,fetchStatus:o,predicate:r,queryKey:a,stale:s}=e;if(a)if(l){if(t.queryHash!==w(a,t.options))return!1}else if(!k(t.queryKey,a))return!1;if("all"!==n){const e=t.isActive();if("active"===n&&!e)return!1;if("inactive"===n&&e)return!1}return!("boolean"==typeof s&&t.isStale()!==s||o&&o!==t.state.fetchStatus||r&&!r(t))}function C(e,t){const{exact:n,status:l,predicate:o,mutationKey:r}=e;if(r){if(!t.options.mutationKey)return!1;if(n){if(_(t.options.mutationKey)!==_(r))return!1}else if(!k(t.options.mutationKey,r))return!1}return!(l&&t.state.status!==l||o&&!o(t))}function w(e,t){return(t?.queryKeyHashFn||_)(e)}function _(e){return JSON.stringify(e,(e,t)=>P(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function k(e,t){return e===t||typeof e==typeof t&&!(!e||!t||"object"!=typeof e||"object"!=typeof t)&&Object.keys(t).every(n=>k(e[n],t[n]))}function S(e,t){if(e===t)return e;const n=B(e)&&B(t);if(n||P(e)&&P(t)){const l=n?e:Object.keys(e),o=l.length,r=n?t:Object.keys(t),a=r.length,s=n?[]:{},i=new Set(l);let c=0;for(let l=0;l<a;l++){const o=n?l:r[l];(!n&&i.has(o)||n)&&void 0===e[o]&&void 0===t[o]?(s[o]=void 0,c++):(s[o]=S(e[o],t[o]),s[o]===e[o]&&void 0!==e[o]&&c++)}return o===a&&c===o?e:s}return t}function j(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function B(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function P(e){if(!R(e))return!1;const t=e.constructor;if(void 0===t)return!0;const n=t.prototype;return!!R(n)&&!!n.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(e)===Object.prototype}function R(e){return"[object Object]"===Object.prototype.toString.call(e)}function I(e,t,n){return"function"==typeof n.structuralSharing?n.structuralSharing(e,t):!1!==n.structuralSharing?S(e,t):t}function T(e,t,n=0){const l=[...e,t];return n&&l.length>n?l.slice(1):l}function E(e,t,n=0){const l=[t,...e];return n&&l.length>n?l.slice(0,-1):l}var O=Symbol();function M(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:e.queryFn&&e.queryFn!==O?e.queryFn:()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`))}var A=new class extends b{#e;#t;#n;constructor(){super(),this.#n=e=>{if(!g&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{"boolean"==typeof e?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return"boolean"==typeof this.#e?this.#e:"hidden"!==globalThis.document?.visibilityState}},D=e=>setTimeout(e,0),L=function(){let e=[],t=0,n=e=>{e()},l=e=>{e()},o=D;const r=l=>{t?e.push(l):o(()=>{n(l)})};return{batch:r=>{let a;t++;try{a=r()}finally{t--,t||(()=>{const t=e;e=[],t.length&&o(()=>{l(()=>{t.forEach(e=>{n(e)})})})})()}return a},batchCalls:e=>(...t)=>{r(()=>{e(...t)})},schedule:r,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{l=e},setScheduler:e=>{o=e}}}(),F=new class extends b{#l=!0;#t;#n;constructor(){super(),this.#n=e=>{if(!g&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#l!==e&&(this.#l=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#l}};function N(){let e,t;const n=new Promise((n,l)=>{e=n,t=l});function l(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.status="pending",n.catch(()=>{}),n.resolve=t=>{l({status:"fulfilled",value:t}),e(t)},n.reject=e=>{l({status:"rejected",reason:e}),t(e)},n}function V(e){return Math.min(1e3*2**e,3e4)}function H(e){return"online"!==(e??"online")||F.isOnline()}var z=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function G(e){let t,n=!1,l=0;const o=N(),r=()=>"pending"!==o.status,a=()=>A.isFocused()&&("always"===e.networkMode||F.isOnline())&&e.canRun(),s=()=>H(e.networkMode)&&e.canRun(),i=e=>{r()||(t?.(),o.resolve(e))},c=e=>{r()||(t?.(),o.reject(e))},u=()=>new Promise(n=>{t=e=>{(r()||a())&&n(e)},e.onPause?.()}).then(()=>{t=void 0,r()||e.onContinue?.()}),d=()=>{if(r())return;let t;const o=0===l?e.initialPromise:void 0;try{t=o??e.fn()}catch(e){t=Promise.reject(e)}Promise.resolve(t).then(i).catch(t=>{if(r())return;const o=e.retry??(g?0:3),s=e.retryDelay??V,i="function"==typeof s?s(l,t):s,h=!0===o||"number"==typeof o&&l<o||"function"==typeof o&&o(l,t);var b;!n&&h?(l++,e.onFail?.(l,t),(b=i,new Promise(e=>{setTimeout(e,b)})).then(()=>a()?void 0:u()).then(()=>{n?c(t):d()})):c(t)})};return{promise:o,status:()=>o.status,cancel:t=>{r()||(c(new z(t)),e.abort?.())},continue:()=>(t?.(),o),cancelRetry:()=>{n=!0},continueRetry:()=>{n=!1},canStart:s,start:()=>(s()?d():u().then(d),o)}}var Z=class{#o;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),f(this.gcTime)&&(this.#o=setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(g?1/0:3e5))}clearGcTimeout(){this.#o&&(clearTimeout(this.#o),this.#o=void 0)}},q=class extends Z{#r;#a;#s;#i;#c;#u;#d;constructor(e){super(),this.#d=!1,this.#u=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#s=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#r=function(e){const t="function"==typeof e.initialData?e.initialData():e.initialData,n=void 0!==t,l=n?"function"==typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?l??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}(this.options),this.state=e.state??this.#r,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#c?.promise}setOptions(e){this.options={...this.#u,...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#s.remove(this)}setData(e,t){const n=I(this.state.data,e,this.options);return this.#h({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#h({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#c?.promise;return this.#c?.cancel(e),t?t.then(p).catch(p):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#r)}isActive(){return this.observers.some(e=>!1!==x(e.options.enabled,this))}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===O||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>"static"===v(e.options.staleTime,this))}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):void 0===this.state.data||this.state.isInvalidated}isStaleByTime(e=0){return void 0===this.state.data||"static"!==e&&(!!this.state.isInvalidated||!m(this.state.dataUpdatedAt,e))}onFocus(){const e=this.observers.find(e=>e.shouldFetchOnWindowFocus());e?.refetch({cancelRefetch:!1}),this.#c?.continue()}onOnline(){const e=this.observers.find(e=>e.shouldFetchOnReconnect());e?.refetch({cancelRefetch:!1}),this.#c?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#s.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#c&&(this.#d?this.#c.cancel({revert:!0}):this.#c.cancelRetry()),this.scheduleGc()),this.#s.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#h({type:"invalidate"})}async fetch(e,t){if("idle"!==this.state.fetchStatus&&"rejected"!==this.#c?.status())if(void 0!==this.state.data&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#c)return this.#c.continueRetry(),this.#c.promise;if(e&&this.setOptions(e),!this.options.queryFn){const e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}const n=new AbortController,l=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#d=!0,n.signal)})},o=()=>{const e=M(this.options,t),n=(()=>{const e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return l(e),e})();return this.#d=!1,this.options.persister?this.options.persister(e,n,this):e(n)},r=(()=>{const e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:o};return l(e),e})();this.options.behavior?.onFetch(r,this),this.#a=this.state,"idle"!==this.state.fetchStatus&&this.state.fetchMeta===r.fetchOptions?.meta||this.#h({type:"fetch",meta:r.fetchOptions?.meta}),this.#c=G({initialPromise:t?.initialPromise,fn:r.fetchFn,abort:n.abort.bind(n),onFail:(e,t)=>{this.#h({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#h({type:"pause"})},onContinue:()=>{this.#h({type:"continue"})},retry:r.options.retry,retryDelay:r.options.retryDelay,networkMode:r.options.networkMode,canRun:()=>!0});try{const e=await this.#c.start();if(void 0===e)throw new Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#s.config.onSuccess?.(e,this),this.#s.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof z){if(e.silent)return this.#c.promise;if(e.revert)return this.setState({...this.#a,fetchStatus:"idle"}),this.state.data}throw this.#h({type:"error",error:e}),this.#s.config.onError?.(e,this),this.#s.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#h(e){this.state=(t=>{switch(e.type){case"failed":return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...t,fetchStatus:"paused"};case"continue":return{...t,fetchStatus:"fetching"};case"fetch":return{...t,...$(t.data,this.options),fetchMeta:e.meta??null};case"success":const n={...t,data:e.data,dataUpdateCount:t.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#a=e.manual?n:void 0,n;case"error":const l=e.error;return{...t,error:l,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:l,fetchStatus:"idle",status:"error"};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...e.state}}})(this.state),L.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#s.notify({query:this,type:"updated",action:e})})}};function $(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:H(t.networkMode)?"fetching":"paused",...void 0===e&&{error:null,status:"pending"}}}var W=class extends b{constructor(e,t){super(),this.options=t,this.#i=e,this.#b=null,this.#g=N(),this.options.experimental_prefetchInRender||this.#g.reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(t)}#i;#p=void 0;#f=void 0;#m=void 0;#v;#x;#g;#b;#y;#C;#w;#_;#k;#S;#j=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#p.addObserver(this),Q(this.#p,this.options)?this.#B():this.updateResult(),this.#P())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return U(this.#p,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return U(this.#p,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#R(),this.#I(),this.#p.removeObserver(this)}setOptions(e){const t=this.options,n=this.#p;if(this.options=this.#i.defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof x(this.options.enabled,this.#p))throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#T(),this.#p.setOptions(this.options),t._defaulted&&!j(this.options,t)&&this.#i.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#p,observer:this});const l=this.hasListeners();l&&K(this.#p,n,this.options,t)&&this.#B(),this.updateResult(),!l||this.#p===n&&x(this.options.enabled,this.#p)===x(t.enabled,this.#p)&&v(this.options.staleTime,this.#p)===v(t.staleTime,this.#p)||this.#E();const o=this.#O();!l||this.#p===n&&x(this.options.enabled,this.#p)===x(t.enabled,this.#p)&&o===this.#S||this.#M(o)}getOptimisticResult(e){const t=this.#i.getQueryCache().build(this.#i,e),n=this.createResult(t,e);return l=n,!j(this.getCurrentResult(),l)&&(this.#m=n,this.#x=this.options,this.#v=this.#p.state),n;var l}getCurrentResult(){return this.#m}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#j.add(e)}getCurrentQuery(){return this.#p}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#i.defaultQueryOptions(e),n=this.#i.getQueryCache().build(this.#i,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#B({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#m))}#B(e){this.#T();let t=this.#p.fetch(this.options,e);return e?.throwOnError||(t=t.catch(p)),t}#E(){this.#R();const e=v(this.options.staleTime,this.#p);if(g||this.#m.isStale||!f(e))return;const t=m(this.#m.dataUpdatedAt,e)+1;this.#_=setTimeout(()=>{this.#m.isStale||this.updateResult()},t)}#O(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#p):this.options.refetchInterval)??!1}#M(e){this.#I(),this.#S=e,!g&&!1!==x(this.options.enabled,this.#p)&&f(this.#S)&&0!==this.#S&&(this.#k=setInterval(()=>{(this.options.refetchIntervalInBackground||A.isFocused())&&this.#B()},this.#S))}#P(){this.#E(),this.#M(this.#O())}#R(){this.#_&&(clearTimeout(this.#_),this.#_=void 0)}#I(){this.#k&&(clearInterval(this.#k),this.#k=void 0)}createResult(e,t){const n=this.#p,l=this.options,o=this.#m,r=this.#v,a=this.#x,s=e!==n?e.state:this.#f,{state:i}=e;let c,u={...i},d=!1;if(t._optimisticResults){const o=this.hasListeners(),r=!o&&Q(e,t),a=o&&K(e,n,t,l);(r||a)&&(u={...u,...$(i.data,e.options)}),"isRestoring"===t._optimisticResults&&(u.fetchStatus="idle")}let{error:h,errorUpdatedAt:b,status:g}=u;c=u.data;let p=!1;if(void 0!==t.placeholderData&&void 0===c&&"pending"===g){let e;o?.isPlaceholderData&&t.placeholderData===a?.placeholderData?(e=o.data,p=!0):e="function"==typeof t.placeholderData?t.placeholderData(this.#w?.state.data,this.#w):t.placeholderData,void 0!==e&&(g="success",c=I(o?.data,e,t),d=!0)}if(t.select&&void 0!==c&&!p)if(o&&c===r?.data&&t.select===this.#y)c=this.#C;else try{this.#y=t.select,c=t.select(c),c=I(o?.data,c,t),this.#C=c,this.#b=null}catch(e){this.#b=e}this.#b&&(h=this.#b,c=this.#C,b=Date.now(),g="error");const f="fetching"===u.fetchStatus,m="pending"===g,v="error"===g,y=m&&f,C=void 0!==c,w={status:g,fetchStatus:u.fetchStatus,isPending:m,isSuccess:"success"===g,isError:v,isInitialLoading:y,isLoading:y,data:c,dataUpdatedAt:u.dataUpdatedAt,error:h,errorUpdatedAt:b,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:u.dataUpdateCount>0||u.errorUpdateCount>0,isFetchedAfterMount:u.dataUpdateCount>s.dataUpdateCount||u.errorUpdateCount>s.errorUpdateCount,isFetching:f,isRefetching:f&&!m,isLoadingError:v&&!C,isPaused:"paused"===u.fetchStatus,isPlaceholderData:d,isRefetchError:v&&C,isStale:Y(e,t),refetch:this.refetch,promise:this.#g,isEnabled:!1!==x(t.enabled,e)};if(this.options.experimental_prefetchInRender){const t=e=>{"error"===w.status?e.reject(w.error):void 0!==w.data&&e.resolve(w.data)},l=()=>{const e=this.#g=w.promise=N();t(e)},o=this.#g;switch(o.status){case"pending":e.queryHash===n.queryHash&&t(o);break;case"fulfilled":"error"!==w.status&&w.data===o.value||l();break;case"rejected":"error"===w.status&&w.error===o.reason||l()}}return w}updateResult(){const e=this.#m,t=this.createResult(this.#p,this.options);this.#v=this.#p.state,this.#x=this.options,void 0!==this.#v.data&&(this.#w=this.#p),j(t,e)||(this.#m=t,this.#A({listeners:(()=>{if(!e)return!0;const{notifyOnChangeProps:t}=this.options,n="function"==typeof t?t():t;if("all"===n||!n&&!this.#j.size)return!0;const l=new Set(n??this.#j);return this.options.throwOnError&&l.add("error"),Object.keys(this.#m).some(t=>{const n=t;return this.#m[n]!==e[n]&&l.has(n)})})()}))}#T(){const e=this.#i.getQueryCache().build(this.#i,this.options);if(e===this.#p)return;const t=this.#p;this.#p=e,this.#f=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#P()}#A(e){L.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#m)}),this.#i.getQueryCache().notify({query:this.#p,type:"observerResultsUpdated"})})}};function Q(e,t){return function(e,t){return!1!==x(t.enabled,e)&&void 0===e.state.data&&!("error"===e.state.status&&!1===t.retryOnMount)}(e,t)||void 0!==e.state.data&&U(e,t,t.refetchOnMount)}function U(e,t,n){if(!1!==x(t.enabled,e)&&"static"!==v(t.staleTime,e)){const l="function"==typeof n?n(e):n;return"always"===l||!1!==l&&Y(e,t)}return!1}function K(e,t,n,l){return(e!==t||!1===x(l.enabled,e))&&(!n.suspense||"error"!==e.state.status)&&Y(e,n)}function Y(e,t){return!1!==x(t.enabled,e)&&e.isStaleByTime(v(t.staleTime,e))}const J=window.ReactJSXRuntime;var X=u.createContext(void 0),ee=e=>{const t=u.useContext(X);if(e)return e;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},te=({client:e,children:t})=>(u.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,J.jsx)(X.Provider,{value:e,children:t}));var ne=u.createContext(function(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}()),le=u.createContext(!1),oe=(le.Provider,(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()}));function re(e,t){return function(e,t,n){const l=u.useContext(le),o=u.useContext(ne),r=ee(n),a=r.defaultQueryOptions(e);r.getDefaultOptions().queries?._experimental_beforeQuery?.(a),a._optimisticResults=l?"isRestoring":"optimistic",(e=>{if(e.suspense){const t=e=>"static"===e?e:Math.max(e??1e3,1e3),n=e.staleTime;e.staleTime="function"==typeof n?(...e)=>t(n(...e)):t(n),"number"==typeof e.gcTime&&(e.gcTime=Math.max(e.gcTime,1e3))}})(a),((e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))})(a,o),(e=>{u.useEffect(()=>{e.clearReset()},[e])})(o);const s=!r.getQueryCache().get(a.queryHash),[i]=u.useState(()=>new t(r,a)),c=i.getOptimisticResult(a),d=!l&&!1!==e.subscribed;if(u.useSyncExternalStore(u.useCallback(e=>{const t=d?i.subscribe(L.batchCalls(e)):p;return i.updateResult(),t},[i,d]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),u.useEffect(()=>{i.setOptions(a)},[a,i]),((e,t)=>e?.suspense&&t.isPending)(a,c))throw oe(a,i,o);if((({result:e,errorResetBoundary:t,throwOnError:n,query:l,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&l&&(o&&void 0===e.data||function(e,t){return"function"==typeof e?e(...t):!!e}(n,[e.error,l])))({result:c,errorResetBoundary:o,throwOnError:a.throwOnError,query:r.getQueryCache().get(a.queryHash),suspense:a.suspense}))throw c.error;if(r.getDefaultOptions().queries?._experimental_afterQuery?.(a,c),a.experimental_prefetchInRender&&!g&&((e,t)=>e.isLoading&&e.isFetching&&!t)(c,l)){const e=s?oe(a,i,o):r.getQueryCache().get(a.queryHash)?.promise;e?.catch(p).finally(()=>{i.updateResult()})}return a.notifyOnChangeProps?c:i.trackResult(c)}(e,W,t)}const ae=window.wp.editor,se=[{key:"post_title",label:(0,i.__)("Title","tableberg")},{key:"post_excerpt",label:(0,i.__)("Excerpt","tableberg")},{key:"post_content",label:(0,i.__)("Content","tableberg")},{key:"post_date",label:(0,i.__)("Publish Date","tableberg")},{key:"post_modified",label:(0,i.__)("Modified Date","tableberg")},{key:"post_author",label:(0,i.__)("Author Name","tableberg")},{key:"permalink",label:(0,i.__)("Permalink","tableberg")},{key:"featured_image",label:(0,i.__)("Featured Image URL","tableberg")}],ie=window.wp.apiFetch;var ce=n.n(ie);const ue=e=>{let t;const n=new Set,l=(e,l)=>{const o="function"==typeof e?e(t):e;if(!Object.is(o,t)){const e=t;t=(null!=l?l:"object"!=typeof o||null===o)?o:Object.assign({},t,o),n.forEach(n=>n(t,e))}},o=()=>t,r={setState:l,getState:o,getInitialState:()=>a,subscribe:e=>(n.add(e),()=>n.delete(e))},a=t=e(l,o,r);return r},de=e=>e,he=e=>{const t=(e=>e?ue(e):ue)(e),n=e=>function(e,t=de){const n=u.useSyncExternalStore(e.subscribe,u.useCallback(()=>t(e.getState()),[e,t]),u.useCallback(()=>t(e.getInitialState()),[e,t]));return u.useDebugValue(n),n}(t,e);return Object.assign(n,t),n},be=e=>e?he(e):he,ge={version:0,isExample:!1,table:{rows:0,cols:0,className:"",headerEnabled:!1,footerEnabled:!1,stickyHeader:!1,stickyFirstCol:!1,innerBorderType:"",caption:"",tableWidth:"auto",tableAlignment:"left",cellSpacing:{horizontal:"0",vertical:"0"},tableBorder:{top:"",right:"",bottom:"",left:""},typography:{fontFamily:"",fontSize:"",fontStyle:"",fontWeight:"",lineHeight:"",letterSpacing:"",textDecoration:"",textTransform:""},margin:{top:"",right:"",bottom:"",left:""},padding:{top:"",right:"",bottom:"",left:""},fixedColumnWidths:!0,pagination:{enabled:!1,pageSize:10,showPageNumbers:!0,showPrevNext:!0},search:{enabled:!1,placeholder:"Search...",highlightColor:"",position:"left"},responsive:{tablet:{enabled:!1,maxWidth:700,mode:"scroll",transpose:!1,stackCount:3,repeatFirstCol:!1},mobile:{enabled:!1,maxWidth:375,mode:"scroll",transpose:!1,stackCount:1,repeatFirstCol:!1}}},rows:[],columns:[],cells:{},bindings:{},cellDefaults:{styles:{padding:{top:"var(--wp--preset--spacing--20)",right:"var(--wp--preset--spacing--20)",bottom:"var(--wp--preset--spacing--20)",left:"var(--wp--preset--spacing--20)"},border:{top:"1px solid currentColor",right:"1px solid currentColor",bottom:"1px solid currentColor",left:"1px solid currentColor"},borderRadius:{topLeft:"0px",topRight:"0px",bottomRight:"0px",bottomLeft:"0px"},orientation:"vertical",elementGap:"var(--wp--preset--spacing--20)",wrap:"nowrap",verticalAlign:"middle",backgroundColor:"",headerBackgroundColor:"",footerBackgroundColor:"",evenRowBackgroundColor:"",oddRowBackgroundColor:""}}};function pe(e,t){return`${e},${t}`}function fe(e){const[t,n]=e.split(",").map(e=>parseInt(e,10));return[t||0,n||0]}const me=window.wp.blockEditor,ve=window.wp.blocks;function xe(){const e=(0,h.useSelect)(e=>{const t=e(me.store).getSettings();return t?.__experimentalFeatures?.color?.palette},[]);return(0,u.useMemo)(()=>{const t=e?.custom;return[[(0,i.__)("Theme","tableberg"),e?.theme],[(0,i.__)("Default","tableberg"),e?.default],[(0,i.__)("Custom","tableberg"),t]].filter(([,e])=>!!e?.length).map(([e,t])=>({name:e,colors:t}))},[e])}function ye(e){return e?(e.width||(e.width="0"),e.style||(e.style="solid"),e.color||(e.color="black"),`${e?.width} ${e?.style} ${e?.color}`):""}function Ce(e){const t={},n=["top","right","bottom","left"];for(const l of n){const n=e[l];if(n&&n.trim()){const e=n.trim().split(/\s+/);t[l]={width:e[0]||void 0,style:e[1]||void 0,color:e[2]||void 0}}}return t}const we=function({label:e,isShownByDefault:t=!0,value:n,hasValue:l,onChange:o,resetAllFilter:r,onDeselect:a=()=>{}}){const{clientId:s}=(0,me.useBlockEditContext)(),i=xe();return r||(r=a),(0,J.jsx)(c.__experimentalToolsPanelItem,{panelId:s,isShownByDefault:t,resetAllFilter:r,hasValue:l,label:e,onDeselect:a,children:(0,J.jsx)(c.BorderBoxControl,{enableAlpha:!0,size:"__unstable-large",colors:i,label:e,onChange:e=>o(function(e){const t={top:"",right:"",bottom:"",left:""};if(!e)return t;const n=["top","right","bottom","left"];if("top"in e)for(const l of n){const n=l,o=e[n];t[n]=ye(o)}else{const l=e;for(const e of n)t[e]=ye(l)}return t}(e)),value:Ce(n)})})},_e=function({label:e,isShownByDefault:t=!0,value:n,hasValue:l,onChange:o=()=>{},resetAllFilter:r,onDeselect:a=()=>{}}){const{clientId:s}=(0,me.useBlockEditContext)();return r||(r=a),(0,J.jsx)(c.__experimentalToolsPanelItem,{panelId:s,isShownByDefault:t,resetAllFilter:r,hasValue:l,label:e,onDeselect:a,children:(0,J.jsxs)("div",{className:"tableberg-border-radius-control",children:[(0,J.jsx)(c.BaseControl.VisualLabel,{as:"legend",children:e}),(0,J.jsx)(me.__experimentalBorderRadiusControl,{onChange:e=>{o("string"!=typeof e?e:{topLeft:e,topRight:e,bottomLeft:e,bottomRight:e})},values:n})]})})},ke=function({value:e,gradientValue:t,label:n,palette:l="theme",onChange:o,onGradientChange:r,onDeselect:a,resetAllFilter:s,allowGradient:c=!1}){const{clientId:d}=(0,me.useBlockEditContext)(),b=(0,me.__experimentalUseMultipleOriginColorsAndGradients)(),g=(0,u.useRef)(e),p=(0,u.useRef)(t),{defaultColors:f,themeColors:m,defaultGradients:v,themeGradients:x}=(0,h.useSelect)(e=>{const t=e(me.store).getSettings()?.__experimentalFeatures?.color;return{defaultColors:t.palette.default,themeColors:t.palette.theme,defaultGradients:t.gradients.default,themeGradients:t.gradients.theme}},[]),y="theme"===l?x:v;s||(s=a);let C={clearable:!0,resetAllFilter:s,colorValue:e,colors:xe(),label:n,onColorChange:e=>{g.current!==e&&(g.current=e,o(e))},onDeselect:a};return c&&(C={...C,gradientValue:t,gradients:y,onGradientChange:e=>{r&&p.current!==e&&(p.current=e,r(e))}}),(0,J.jsx)(me.__experimentalColorGradientSettingsDropdown,{...b,enableAlpha:!0,panelId:d,title:(0,i.__)("Color Settings","tableberg"),popoverProps:{placement:"left start"},settings:[C]})};var Se=n(395),je=n.n(Se);function Be(e){const t={...e};for(const e in t){const n=e,l=t[n],o=l?.match(/var\(--wp--preset--spacing--(.+)\)/);o&&(t[n]=`var:preset|spacing|${o[1]}`)}return t}const Pe=({label:e,value:t,hasValue:n,onChange:l=()=>{},resetAllFilter:o,onDeselect:r=()=>{}})=>{const{clientId:a}=(0,me.useBlockEditContext)();return o||(o=r),(0,J.jsx)(c.__experimentalToolsPanelItem,{panelId:a,isShownByDefault:!0,resetAllFilter:o,className:"tools-panel-item-spacing",label:e,onDeselect:r,hasValue:n,children:(0,J.jsx)(me.__experimentalSpacingSizesControl,{allowReset:!0,label:e,values:Be(t),sides:["top","right","bottom","left"],onChange:e=>{l(function(e){for(const t in e){const n=t,l=e[n],o=l?.match(/var:preset\|spacing\|(.+)/);o&&(e[n]=`var(--wp--preset--spacing--${o[1]})`)}return e}(e))}})})},Re=window.wp.primitives;var Ie=(0,J.jsxs)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[(0,J.jsx)(Re.Path,{d:"m19 7.5h-7.628c-.3089-.87389-1.1423-1.5-2.122-1.5-.97966 0-1.81309.62611-2.12197 1.5h-2.12803v1.5h2.12803c.30888.87389 1.14231 1.5 2.12197 1.5.9797 0 1.8131-.62611 2.122-1.5h7.628z"}),(0,J.jsx)(Re.Path,{d:"m19 15h-2.128c-.3089-.8739-1.1423-1.5-2.122-1.5s-1.8131.6261-2.122 1.5h-7.628v1.5h7.628c.3089.8739 1.1423 1.5 2.122 1.5s1.8131-.6261 2.122-1.5h2.128z"})]});function Te({label:e,value:t,onChange:n,style:l}){const[o,r,a,s,d]=(0,me.useSettings)("spacing.spacingSizes","spacing.spacingSizes.custom","spacing.spacingSizes.theme","spacing.spacingSizes.default","spacing.defaultSpacingSizes"),h=[{slug:"0",size:0},...o||[...r||[],...a||[],...s&&!1!==d?s:[]]],[b,g]=(0,u.useState)(!!t&&!function(e){return"0"===e||/var\(--wp--preset--spacing--.+\)/.test(e)}(t)),[p]=(0,me.useSettings)("spacing.units"),f=(0,c.__experimentalUseCustomUnits)({availableUnits:p||["px","em","rem"]}),m=(0,u.useMemo)(()=>{const e=function(e){if(!e)return;if("0"===e)return"0";const t=e.match(/var\(--wp--preset--spacing--(.+)\)/);return t?t[1]:void 0}(t);if(!e)return 0;const n=h.findIndex(t=>String(t.slug)===e);return-1!==n?n:NaN},[t,h]),[v,x]=(0,u.useMemo)(()=>(0,c.__experimentalParseQuantityAndUnitFromRawValue)(t),[t]),y=x||f[0]?.value||"px",C={...l,border:0,padding:0,margin:0};return(0,J.jsxs)("fieldset",{className:"spacing-sizes-control",style:C,children:[(0,J.jsxs)(c.__experimentalHStack,{className:"spacing-sizes-control__header",style:{marginBottom:"12px"},children:[(0,J.jsx)(c.BaseControl.VisualLabel,{as:"legend",className:"spacing-sizes-control__label",children:e}),(0,J.jsx)(c.Button,{label:b?(0,i.__)("Use size preset"):(0,i.__)("Set custom size"),icon:Ie,onClick:()=>g(!b),isPressed:b,size:"small",className:"spacing-sizes-control__custom-toggle",iconSize:24})]}),(0,J.jsx)(c.__experimentalVStack,{spacing:.5,children:(0,J.jsx)(c.__experimentalHStack,{className:"spacing-sizes-control__wrapper",children:b?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(c.__experimentalUnitControl,{hideLabelFromVision:!0,className:"spacing-sizes-control__unit-control",size:"__unstable-large",value:t,onChange:e=>{e&&!isNaN(parseFloat(e))&&n(e)}}),(0,J.jsx)(c.RangeControl,{min:0,max:100,step:1,withInputField:!1,className:"spacing-sizes-control__custom-value-range",label:e,hideLabelFromVision:!0,value:v||0,onChange:e=>{void 0!==e&&n(`${e}${y}`)},__nextHasNoMarginBottom:!0})]}):(0,J.jsx)(c.RangeControl,{className:"spacing-sizes-control__preset-range",label:e,hideLabelFromVision:!0,value:m,min:0,max:h.length-1,marks:h.map((e,t)=>({value:t,label:void 0})),withInputField:!1,onChange:e=>{if(void 0===e)return;const t=h[e]?.slug;n("0"===t?"0":`var(--wp--preset--spacing--${t})`)},__nextHasNoMarginBottom:!0})})})]})}const Ee={px:{max:1e3,step:1},"%":{max:100,step:1},vw:{max:100,step:1},vh:{max:100,step:1},em:{max:50,step:.1},rem:{max:50,step:.1},svw:{max:100,step:1},lvw:{max:100,step:1},dvw:{max:100,step:1},svh:{max:100,step:1},lvh:{max:100,step:1},dvh:{max:100,step:1},vi:{max:100,step:1},svi:{max:100,step:1},lvi:{max:100,step:1},dvi:{max:100,step:1},vb:{max:100,step:1},svb:{max:100,step:1},lvb:{max:100,step:1},dvb:{max:100,step:1},vmin:{max:100,step:1},svmin:{max:100,step:1},lvmin:{max:100,step:1},dvmin:{max:100,step:1},vmax:{max:100,step:1},svmax:{max:100,step:1},lvmax:{max:100,step:1},dvmax:{max:100,step:1}};function Oe({label:e,onChange:t,value:n,rangeConfig:l={},initialPosition:o,disabled:r}){var a,s,i,d,h,b;const g=parseFloat(n||"0"),[p]=(0,me.useSettings)("spacing.units"),f=(0,c.__experimentalUseCustomUnits)({availableUnits:p||["%","px","em","rem","vh","vw"]}),m=(0,u.useMemo)(()=>(0,c.__experimentalParseQuantityAndUnitFromRawValue)(n),[n])[1]||f[0]?.value||"px",v=l[m],x=Ee[m];let y=null!==(a=null!==(s=v?.min)&&void 0!==s?s:x?.min)&&void 0!==a?a:0,C=null!==(i=null!==(d=v?.max)&&void 0!==d?d:x?.max)&&void 0!==i?i:100;const w=null!==(h=null!==(b=v?.step)&&void 0!==b?b:x?.step)&&void 0!==h?h:.1;return y=Math.min(y,g),C=Math.max(C,g),(0,J.jsxs)("fieldset",{className:"block-editor-height-control",children:[(0,J.jsx)(c.BaseControl.VisualLabel,{as:"legend",children:e}),(0,J.jsxs)(c.Flex,{children:[(0,J.jsx)(c.FlexItem,{isBlock:!0,children:(0,J.jsx)(c.__experimentalUnitControl,{value:n,units:f,onChange:t,onUnitChange:e=>{const[l,o]=(0,c.__experimentalParseQuantityAndUnitFromRawValue)(n);["em","rem"].includes(e)&&"px"===o?t((l/16).toFixed(2)+e):["em","rem"].includes(o)&&"px"===e?t(Math.round(16*l)+e):l>100&&["%","vw","svw","lvw","dvw","vh","svh","lvh","dvh","vi","svi","lvi","dvi","vb","svb","lvb","dvb","vmin","svmin","lvmin","dvmin","vmax","svmax","lvmax","dvmax"].includes(e)&&t(100+e)},min:y,size:"__unstable-large",label:e,hideLabelFromVision:!0,disabled:r})}),(0,J.jsx)(c.FlexItem,{isBlock:!0,children:(0,J.jsx)(c.__experimentalSpacer,{marginX:2,marginBottom:0,children:(0,J.jsx)(c.RangeControl,{value:n?g:void 0,min:y,max:C,step:w,withInputField:!1,onChange:e=>{t([e,m].join(""))},__nextHasNoMarginBottom:!0,label:e,hideLabelFromVision:!0,initialPosition:o?parseFloat(o):void 0,disabled:r})})})]})]})}const Me={fontFamily:"",fontSize:"",fontStyle:"",fontWeight:"",lineHeight:"",letterSpacing:"",textDecoration:"",textTransform:""};function Ae(e){return{...Me,...e||{}}}function De(e){const{fontFamily:t,fontSize:n,fontStyle:l,fontWeight:o,lineHeight:r,letterSpacing:a,textDecoration:s,textTransform:i}=Ae(e);return{fontFamily:t||void 0,fontSize:n||void 0,fontStyle:l||void 0,fontWeight:o||void 0,lineHeight:r||void 0,letterSpacing:a||void 0,textDecoration:s||void 0,textTransform:i||void 0}}function Le({label:e,hasValue:t,onDeselect:n,resetAllFilter:l,isShownByDefault:o=!1,isSingleColumn:r=!1,panelId:a,children:s}){const{clientId:i}=(0,me.useBlockEditContext)();return(0,J.jsx)(c.__experimentalToolsPanelItem,{panelId:null!=a?a:i,className:r?"single-column":void 0,label:e,hasValue:t,onDeselect:n,resetAllFilter:null!=l?l:n,isShownByDefault:o,children:s})}function Fe(){const[e]=(0,me.useSettings)("typography.fontFamilies");return["default","theme","custom"].flatMap(t=>{var n;return null!==(n=e?.[t])&&void 0!==n?n:[]})}function Ne({label:e=(0,i.__)("Font","tableberg"),value:t,onChange:n,onDeselect:l,resetAllFilter:o,isShownByDefault:r=!0,isSingleColumn:a,panelId:s}){const c=Fe();return c.length?(0,J.jsx)(Le,{label:e,hasValue:()=>!!t,onDeselect:null!=l?l:()=>n(""),resetAllFilter:o,isShownByDefault:r,isSingleColumn:a,panelId:s,children:(0,J.jsx)(me.__experimentalFontFamilyControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,fontFamilies:c,value:t,onChange:e=>n(e||"")})}):null}const Ve=/^var\(--wp--preset--font-size--([^)]+)\)$/;function He(e,t){const n=e.match(Ve);if(!n)return e||void 0;const l=t.find(e=>e.slug===n[1]);return l?String(l.size):void 0}function ze({label:e=(0,i.__)("Size","tableberg"),value:t,onChange:n,onDeselect:l,resetAllFilter:o,isShownByDefault:r=!0,isSingleColumn:a,panelId:s}){const[u,d]=(0,me.useSettings)("typography.fontSizes","typography.customFontSize"),h=Array.isArray(u)?u:[];return(0,J.jsx)(Le,{label:e,hasValue:()=>!!t,onDeselect:null!=l?l:()=>n(""),resetAllFilter:o,isShownByDefault:r,isSingleColumn:a,panelId:s,children:(0,J.jsx)(c.FontSizePicker,{__next40pxDefaultSize:!0,withReset:!1,fontSizes:h,disableCustomFontSizes:!1===d,value:He(t,h),onChange:(e,t)=>n(function(e,t){return void 0===e||""===e?"":t?.slug?`var(--wp--preset--font-size--${t.slug})`:String(e)}(e,t))})})}const Ge={fontStyle:"",fontWeight:""};function Ze({label:e=(0,i.__)("Appearance","tableberg"),value:t,onChange:n,fontFamily:l,onDeselect:o,resetAllFilter:r,isShownByDefault:a=!1,isSingleColumn:s=!0,panelId:c}){var u;const d=Fe(),h=null!==(u=d.find(e=>e.fontFamily===l)?.fontFace)&&void 0!==u?u:[];return(0,J.jsx)(Le,{label:e,hasValue:()=>!!t.fontStyle||!!t.fontWeight,onDeselect:null!=o?o:()=>n({...Ge}),resetAllFilter:r,isShownByDefault:a,isSingleColumn:s,panelId:c,children:(0,J.jsx)(me.__experimentalFontAppearanceControl,{__next40pxDefaultSize:!0,fontFamilyFaces:h,value:{fontStyle:t.fontStyle||void 0,fontWeight:t.fontWeight||void 0},onChange:e=>n({fontStyle:e?.fontStyle||"",fontWeight:e?.fontWeight||""})})})}function qe({label:e=(0,i.__)("Line height","tableberg"),value:t,onChange:n,onDeselect:l,resetAllFilter:o,isShownByDefault:r=!1,isSingleColumn:a=!0,panelId:s}){return(0,J.jsx)(Le,{label:e,hasValue:()=>!!t,onDeselect:null!=l?l:()=>n(""),resetAllFilter:o,isShownByDefault:r,isSingleColumn:a,panelId:s,children:(0,J.jsx)(me.LineHeightControl,{__next40pxDefaultSize:!0,__unstableInputWidth:"auto",value:t||void 0,onChange:e=>n(e||"")})})}function $e({label:e=(0,i.__)("Letter spacing","tableberg"),value:t,onChange:n,onDeselect:l,resetAllFilter:o,isShownByDefault:r=!1,isSingleColumn:a=!0,panelId:s}){return(0,J.jsx)(Le,{label:e,hasValue:()=>!!t,onDeselect:null!=l?l:()=>n(""),resetAllFilter:o,isShownByDefault:r,isSingleColumn:a,panelId:s,children:(0,J.jsx)(me.__experimentalLetterSpacingControl,{__next40pxDefaultSize:!0,__unstableInputWidth:"auto",value:t||void 0,onChange:e=>n(e||"")})})}function We({label:e=(0,i.__)("Decoration","tableberg"),value:t,onChange:n,onDeselect:l,resetAllFilter:o,isShownByDefault:r=!1,isSingleColumn:a=!0,panelId:s}){return(0,J.jsx)(Le,{label:e,hasValue:()=>!!t,onDeselect:null!=l?l:()=>n(""),resetAllFilter:o,isShownByDefault:r,isSingleColumn:a,panelId:s,children:(0,J.jsx)(me.__experimentalTextDecorationControl,{value:t||void 0,onChange:e=>n(e||"")})})}function Qe({label:e=(0,i.__)("Letter case","tableberg"),value:t,onChange:n,onDeselect:l,resetAllFilter:o,isShownByDefault:r=!1,isSingleColumn:a=!0,panelId:s}){return(0,J.jsx)(Le,{label:e,hasValue:()=>!!t,onDeselect:null!=l?l:()=>n(""),resetAllFilter:o,isShownByDefault:r,isSingleColumn:a,panelId:s,children:(0,J.jsx)(me.__experimentalTextTransformControl,{value:t||void 0,onChange:e=>n(e||"")})})}function Ue({value:e,onChange:t,panelId:n}){const l=Ae(e);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Ne,{panelId:n,value:l.fontFamily,onChange:e=>t({fontFamily:e})}),(0,J.jsx)(ze,{panelId:n,value:l.fontSize,onChange:e=>t({fontSize:e})}),(0,J.jsx)(Ze,{panelId:n,fontFamily:l.fontFamily,value:{fontStyle:l.fontStyle,fontWeight:l.fontWeight},onChange:e=>t(e)}),(0,J.jsx)(qe,{panelId:n,value:l.lineHeight,onChange:e=>t({lineHeight:e})}),(0,J.jsx)(Qe,{panelId:n,value:l.textTransform,onChange:e=>t({textTransform:e})}),(0,J.jsx)($e,{panelId:n,value:l.letterSpacing,onChange:e=>t({letterSpacing:e})}),(0,J.jsx)(We,{panelId:n,value:l.textDecoration,onChange:e=>t({textDecoration:e})})]})}var Ke=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M19 5.5H5V4h14v1.5ZM19 20H5v-1.5h14V20ZM5 9h14v6H5V9Z"})}),Ye=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M5 5.5h8V4H5v1.5ZM5 20h8v-1.5H5V20ZM19 9H5v6h14V9Z"})}),Je=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M19 5.5H5V4h14v1.5ZM19 20H5v-1.5h14V20ZM7 9h10v6H7V9Z"})}),Xe=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M19 5.5h-8V4h8v1.5ZM19 20h-8v-1.5h8V20ZM5 9h14v6H5V9Z"})}),et=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M16 5.5H8V4h8v1.5ZM16 20H8v-1.5h8V20ZM5 9h14v6H5V9Z"})}),tt=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M5 4h14v11H5V4Zm11 16H8v-1.5h8V20Z"})});const nt=[{icon:Ke,title:"None",value:void 0},{icon:Ye,title:"Align left",value:"left"},{icon:Je,title:"Align center",value:"center"},{icon:Xe,title:"Align right",value:"right"}],lt=[{icon:Ke,title:"None",value:void 0},{icon:Ye,title:"Align left",value:"left"},{icon:Je,title:"Align center",value:"center"},{icon:Xe,title:"Align right",value:"right"},{icon:et,title:"Wide width",value:"wide"},{icon:tt,title:"Full Width",value:"full"}];function ot({title:e,onChange:t,value:n,controls:l,controlset:o,disabled:r}){if(o&&(l={alignment:nt,all:lt}[o]),l){const o=l.find(e=>e.value===n)||l[0];return(0,J.jsx)(c.ToolbarGroup,{icon:o?.icon,title:e,isCollapsed:!0,controls:l.map(e=>{const l=!!r||!!e.isDisabled;return{...e,isDisabled:l,onClick:()=>{l||t(e.value)},isActive:n===e.value}})})}}function rt(e,t,n){const l=t.split(".");if(1===l.length)return{...e,[l[0]]:n};const o={...e};let r=o;for(let e=0;e<l.length-1;e++){const t=l[e];r[t]={...r[t]},r=r[t]}return r[l[l.length-1]]=n,o}function at(e,t,n,l,o){const r=function(e,t){const n={...t};for(const l in e){const o=e[l],r=t[l];void 0===o||"object"!=typeof o||null===o||Array.isArray(o)||"object"!=typeof r||null===r||Array.isArray(r)?void 0!==o&&(n[l]=o):n[l]={...r,...o}}return n}(e,t);return function(e,t,n,l){if(!t)return e;let o=e;for(const e of Object.keys(t)){const t=n[e];null!=t?o=rt(o,e,t):null!=l&&(o=rt(o,e,l))}return o}(r,n,l,o)}const st=(0,J.jsx)("svg",{height:24,width:24,viewBox:"0 0 189 189",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,J.jsx)("path",{d:"M62.9281 98.177H125.761V86.3958H62.9281V98.177ZM149.324 51.052H39.3656C35.1995 51.052 31.204 52.707 28.2581 55.6529C25.3122 58.5987 23.6572 62.5942 23.6572 66.7603V117.812C23.6572 121.979 25.3122 125.974 28.2581 128.92C31.204 131.866 35.1995 133.521 39.3656 133.521H149.324C153.49 133.521 157.485 131.866 160.431 128.92C163.377 125.974 165.032 121.979 165.032 117.812V66.7603C165.032 62.5942 163.377 58.5987 160.431 55.6529C157.485 52.707 153.49 51.052 149.324 51.052ZM39.3656 62.8333H149.324C150.365 62.8333 151.364 63.247 152.101 63.9835C152.837 64.7199 153.251 65.7188 153.251 66.7603V117.812C153.251 118.854 152.837 119.853 152.101 120.589C151.364 121.326 150.365 121.74 149.324 121.74H39.3656C38.324 121.74 37.3252 121.326 36.5887 120.589C35.8522 119.853 35.4385 118.854 35.4385 117.812V66.7603C35.4385 65.7188 35.8522 64.7199 36.5887 63.9835C37.3252 63.247 38.324 62.8333 39.3656 62.8333Z",fill:"#671FEB"})}),it=(0,J.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 190 189",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,J.jsx)("path",{d:"M149.824 23.5625H39.8656C31.226 23.5625 24.1572 30.6312 24.1572 39.2708V149.229C24.1572 157.869 31.226 164.938 39.8656 164.938H149.824C158.463 164.938 165.532 157.869 165.532 149.229V39.2708C165.532 30.6312 158.463 23.5625 149.824 23.5625ZM39.8656 35.3438H149.824C152.18 35.3438 153.751 36.9146 153.751 39.2708V105.246L130.188 82.4688C127.832 80.1125 123.905 80.1125 122.334 82.4688L94.0593 109.958L71.2822 94.25C68.926 92.6792 66.5697 92.6792 64.9989 94.25L36.7239 114.671V39.2708C35.9385 36.9146 37.5093 35.3438 39.8656 35.3438ZM149.824 153.156H39.8656C37.5093 153.156 35.9385 151.585 35.9385 149.229V130.379L68.1406 106.817L91.7031 121.74C94.0593 123.31 97.201 123.31 98.7718 120.954L126.261 94.25L153.751 120.954V149.229C153.751 151.585 152.18 153.156 149.824 153.156Z",fill:"#671FEB"})}),ct=(J.Fragment,(0,J.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,J.jsx)("rect",{width:"24",height:"24",fill:"white"}),(0,J.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 5C3 3.89543 3.89543 3 5 3H19C20.1046 3 21 3.89543 21 5V19C21 20.1046 20.1046 21 19 21H5C3.89543 21 3 20.1046 3 19V5ZM8 8C8 8.55228 7.55228 9 7 9C6.44772 9 6 8.55228 6 8C6 7.44772 6.44772 7 7 7C7.55228 7 8 7.44772 8 8ZM7 13C7.55228 13 8 12.5523 8 12C8 11.4477 7.55228 11 7 11C6.44772 11 6 11.4477 6 12C6 12.5523 6.44772 13 7 13ZM8 16C8 16.5523 7.55228 17 7 17C6.44772 17 6 16.5523 6 16C6 15.4477 6.44772 15 7 15C7.55228 15 8 15.4477 8 16ZM11 7.5C10.7239 7.5 10.5 7.72386 10.5 8C10.5 8.27614 10.7239 8.5 11 8.5H17C17.2761 8.5 17.5 8.27614 17.5 8C17.5 7.72386 17.2761 7.5 17 7.5H11ZM10.5 12C10.5 11.7239 10.7239 11.5 11 11.5H17C17.2761 11.5 17.5 11.7239 17.5 12C17.5 12.2761 17.2761 12.5 17 12.5H11C10.7239 12.5 10.5 12.2761 10.5 12ZM11 15.5C10.7239 15.5 10.5 15.7239 10.5 16C10.5 16.2761 10.7239 16.5 11 16.5H17C17.2761 16.5 17.5 16.2761 17.5 16C17.5 15.7239 17.2761 15.5 17 15.5H11Z",fill:"#671feb"})]})),ut=(0,J.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,J.jsx)("rect",{width:"24",height:"24",fill:"white"}),(0,J.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6 3C4.34315 3 3 4.34315 3 6V18C3 19.6569 4.34315 21 6 21H18C19.6569 21 21 19.6569 21 18V6C21 4.34315 19.6569 3 18 3H6ZM8 9.61388C11.1954 9.04964 12.9452 9.06689 16 9.61388V12.681C12.8757 12.2134 11.125 12.1847 8 12.681V9.61388ZM7.42857 11.7356H4L4 11.7356L6.28572 13.2692L4.00002 14.8027H9.71429V13.055C9.0129 13.105 8.26382 13.1765 7.42857 13.2694V11.7356ZM14.2857 13.0511V14.8028L20 14.8028L17.7143 13.2693L20 11.7358L20 11.7357H16.5714V13.2694C15.7384 13.1741 14.9903 13.1013 14.2857 13.0511Z",fill:"#671FEB"})]}),dt=window.wp.hooks;function ht(){return(0,dt.applyFilters)("tableberg.extendedElementDefinitions",[])}function bt(e){return ht().find(t=>t.name===e)}function gt(e){return(0,J.jsx)("span",{className:"block-editor-block-icon has-colors",children:e})}const pt={name:"cell-blocks",triggerPrefix:"/",className:"block-editor-autocompleters__block",options:[],getOptionLabel:e=>[gt(e.icon),e.name],getOptionKeywords:e=>[e.name],isOptionDisabled:e=>{var t;return null!==(t=e.disabled)&&void 0!==t&&t},getOptionCompletion:e=>({action:"replace",value:e.value})},ft=".block-editor-block-toolbar",mt=[".tableberg-edit-toolbar",".tableberg-edit-toolbar-mount"].join(", "),vt=[".block-editor-block-popover",".components-popover"].join(", "),xt=".interface-interface-skeleton__sidebar",yt=[".editor-inserter-sidebar",".block-editor-inserter__menu"].join(", "),Ct=[".editor-document-tools__inserter-toggle",".edit-post-header-toolbar__inserter-toggle"].join(", "),wt=".block-editor-inserter__popover",_t=[".editor-document-tools",".edit-post-header-toolbar"].join(", ");function kt({ref:e,onClickOutside:t}){(0,u.useEffect)(()=>{const n=e.current?.ownerDocument;if(n)return n.addEventListener("mousedown",l),()=>n.removeEventListener("mousedown",l);function l(n){if(!e.current)return;const l=n.target;if(!l||e.current.contains(l))return;const o=l instanceof Element?l:l.parentElement;o&&o.closest([ft,mt,vt,xt,yt,Ct,wt,_t].join(", "))||t()}},[t,e])}function St(e,t,n){return e[pe(t,n)]?.elements||[]}function jt(e,t,n,l){const o=l.toLowerCase().trim();if(!o)return!0;for(let l=0;l<t;l++)if(St(n,e,l).map(e=>Oa(e)).join(" ").toLowerCase().includes(o))return!0;return!1}function Bt(e,t,n,l,o){const{headerEnabled:r,footerEnabled:a}=l,s=o.toLowerCase().trim();if(!s)return Array.from({length:t},(e,t)=>t);const i=r?0:-1,c=a?t-1:-1,u=[];r&&u.push(0);for(let l=0;l<t;l++)l!==i&&l!==c&&jt(l,n,e,s)&&u.push(l);return a&&u.push(t-1),u}function Pt({content:e,searchTerm:t,highlightColor:n}){const l=function(e,t){const n=e.replace(/<[^>]*>/g,""),l=t.trim();if(!l||!n)return[{text:n,highlighted:!1}];const o=l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`(${o})`,"gi"),a=[];let s,i=0;for(;null!==(s=r.exec(n));)s.index>i&&a.push({text:n.slice(i,s.index),highlighted:!1}),a.push({text:s[1],highlighted:!0}),i=r.lastIndex;return i<n.length&&a.push({text:n.slice(i),highlighted:!1}),a.length>0?a:[{text:n,highlighted:!1}]}(e,t);return(0,J.jsx)(J.Fragment,{children:l.map((e,t)=>e.highlighted?(0,J.jsx)("mark",{style:{backgroundColor:n,borderRadius:"2px"},children:e.text},t):e.text)})}var Rt=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z"})});function It({cellCoords:e,elementIndex:t}){const n=ds(e=>e.removeElementFromCell);return(0,J.jsx)(c.ToolbarButton,{icon:Rt,label:(0,i.__)("Delete element","tableberg"),title:(0,i.__)("Delete element","tableberg"),isDestructive:!0,onClick:()=>n(e,t)})}var Tt=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"})});const Et="TABLEBERG_ELEMENT_STYLES:",Ot=new Set(["align","height","width","aspectRatio","scale","sizeSlug","border","borderRadius"]),Mt=new Set(["align"]),At=new Set(["backgroundColor","textColor","linkColor","fontSize","padding","margin","border","borderRadius"]);let Dt="";function Lt(e){return JSON.parse(JSON.stringify(e))}function Ft(e){var t;const n={...null!==(t=e.attributes)&&void 0!==t?t:{}};return e.bindings&&Object.keys(e.bindings).length>0&&(n.bindings=e.bindings),(0,ve.serialize)((0,ve.createBlock)(`tableberg/${e.name}`,n))}function Nt(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function Vt(e){return e.attributes}function Ht(e){const t=Vt(e),n={};return Nt(t.styles)&&(n.styles=Lt(t.styles)),Ot.forEach(e=>{void 0!==t[e]&&(n[e]=Lt(t[e]))}),{name:e.name,attributes:n}}let zt=null;function Gt(e){return`${Et}${JSON.stringify(Ht(e))}`}function Zt(e){if(!e.startsWith(Et))return null;try{const t=JSON.parse(e.slice(25));return Nt(t)&&"string"==typeof t.name&&Nt(t.attributes)?Lt(t):null}catch{return null}}function qt(e,t){const n=t.name===e.name,l=Vt(e),o=t.attributes,r={...l};if(Nt(o.styles)){const e=Nt(l.styles)?l.styles:{},t={...e};Object.entries(o.styles).forEach(([l,o])=>{(n||At.has(l)&&l in e)&&(t[l]=Lt(o))}),Object.keys(t).length>0&&(r.styles=t)}return Object.entries(o).forEach(([e,t])=>{"styles"!==e&&(n?Ot:Mt).has(e)&&e in l&&(r[e]=Lt(t))}),{...e,attributes:r}}async function $t(e){if(Dt=e,!navigator.clipboard?.writeText)return!1;try{return await navigator.clipboard.writeText(e),!0}catch{return!1}}async function Wt(){if(!navigator.clipboard?.readText)return Dt;try{return await navigator.clipboard.readText()}catch{return Dt}}function Qt(e){const t=window.wp?.keyboardShortcuts?.store,n=window.wp?.data?.select;if(t&&n)return n(t).getShortcutRepresentation?.(e)}function Ut({cellCoords:e,elementIndex:t}){const n=ds(e=>e.cells),l=ds(e=>e.insertElementInCell),o=ds(e=>e.duplicateElementInCell),r=ds(e=>e.removeElementFromCell),a=ds(e=>e.updateCellElement),s=n[e]?.elements?.[t]||null,u={copy:Qt("core/block-editor/copy"),cut:Qt("core/block-editor/cut"),duplicate:Qt("core/block-editor/duplicate"),insertBefore:Qt("core/block-editor/insert-before"),insertAfter:Qt("core/block-editor/insert-after"),remove:Qt("core/block-editor/remove")};if(!s)return null;const d=t=>{const n=Ma("text");n&&l(e,t,n)};return(0,J.jsx)(c.ToolbarDropdownMenu,{icon:Tt,label:(0,i.__)("Element options","tableberg"),toggleProps:{title:(0,i.__)("Element options","tableberg"),showTooltip:!0},popoverProps:{placement:"bottom-start"},children:({onClose:n})=>(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(c.MenuGroup,{children:[(0,J.jsx)(c.MenuItem,{shortcut:u.copy,onClick:()=>{$t(Ft(s)),n()},children:(0,i.__)("Copy","tableberg")}),(0,J.jsx)(c.MenuItem,{onClick:()=>{$t(Gt(s)),n()},children:(0,i.__)("Copy styles","tableberg")}),(0,J.jsx)(c.MenuItem,{onClick:()=>{(async()=>{const n=Zt(await Wt());if(!n)return;const l=qt(s,n);a(e,t,{attributes:l.attributes})})(),n()},children:(0,i.__)("Paste styles","tableberg")}),(0,J.jsx)(c.MenuItem,{shortcut:u.cut,onClick:()=>{(async()=>{await $t(Ft(s)),r(e,t)})(),n()},children:(0,i.__)("Cut","tableberg")}),(0,J.jsx)(c.MenuItem,{shortcut:u.duplicate,onClick:()=>{o(e,t),n()},children:(0,i.__)("Duplicate","tableberg")})]}),(0,J.jsxs)(c.MenuGroup,{children:[(0,J.jsx)(c.MenuItem,{shortcut:u.insertBefore,onClick:()=>{d(t),n()},children:(0,i.__)("Add before","tableberg")}),(0,J.jsx)(c.MenuItem,{shortcut:u.insertAfter,onClick:()=>{d(t+1),n()},children:(0,i.__)("Add after","tableberg")})]}),(0,J.jsx)(c.MenuGroup,{children:(0,J.jsx)(c.MenuItem,{shortcut:u.remove,onClick:()=>{r(e,t),n()},children:(0,i.__)("Delete","tableberg")})})]})})}function Kt({cellCoords:e,elementIndex:t}){return(0,J.jsx)(me.BlockControls,{group:"other",children:(0,J.jsx)(Ut,{cellCoords:e,elementIndex:t})})}function Yt(){return(0,u.useCallback)((e,t,n)=>{const l=e.ownerDocument,o=l.defaultView?.parent?.document||l,r=o.querySelector(".block-editor-block-card__title");r&&(r.textContent=t);const a=o.querySelector(".block-editor-block-card__description");a&&(a.textContent=n)},[])}const Jt=e=>!!(e.top||e.right||e.bottom||e.left);function Xt({attributes:e,bindings:t,updateStyles:n}){const l=ds(e=>e.updateSelectedElementStyles),o=null!=n?n:l,{clientId:r}=(0,me.useBlockEditContext)(),a=!!t?.["styles.textColor"],s=!!t?.["styles.linkColor"],u=!!t?.["styles.backgroundColor"],d=!!t?.["styles.fontSize"];return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(me.InspectorControls,{group:"color",children:[(0,J.jsx)(ke,{label:a?(0,i.__)("Text Color (dynamic)","tableberg"):(0,i.__)("Text Color","tableberg"),value:e.styles.textColor,onChange:e=>o({textColor:e}),onDeselect:()=>o({textColor:ln.styles.textColor})}),(0,J.jsx)(ke,{label:s?(0,i.__)("Link Color (dynamic)","tableberg"):(0,i.__)("Link Color","tableberg"),value:e.styles.linkColor,onChange:e=>o({linkColor:e}),onDeselect:()=>o({linkColor:ln.styles.linkColor})}),(0,J.jsx)(ke,{label:u?(0,i.__)("Background Color (dynamic)","tableberg"):(0,i.__)("Background Color","tableberg"),value:e.styles.backgroundColor,onChange:e=>o({backgroundColor:e}),onDeselect:()=>o({backgroundColor:ln.styles.backgroundColor})})]}),(0,J.jsx)(me.InspectorControls,{children:(0,J.jsx)(c.PanelBody,{title:(0,i.__)("Typography","tableberg"),children:(0,J.jsx)(c.BaseControl,{__nextHasNoMarginBottom:!0,help:d?(0,i.__)("Overridden by dynamic data","tableberg"):"",children:(0,J.jsx)(me.FontSizePicker,{value:e.styles.fontSize||void 0,onChange:e=>o({fontSize:e?String(e):ln.styles.fontSize})})})})}),(0,J.jsx)(me.InspectorControls,{children:(0,J.jsxs)(c.__experimentalToolsPanel,{label:(0,i.__)("Dimensions","tableberg"),panelId:r,resetAll:()=>o({padding:{...ln.styles.padding},margin:{...ln.styles.margin}}),children:[(0,J.jsx)(Pe,{label:(0,i.__)("Padding","tableberg"),value:e.styles.padding,hasValue:()=>Jt(e.styles.padding),onChange:e=>o({padding:e}),onDeselect:()=>o({padding:{...ln.styles.padding}})}),(0,J.jsx)(Pe,{label:(0,i.__)("Margin","tableberg"),value:e.styles.margin,hasValue:()=>Jt(e.styles.margin),onChange:e=>o({margin:e}),onDeselect:()=>o({margin:{...ln.styles.margin}})})]})})]})}function en(){if("undefined"!=typeof globalThis){const e=globalThis.TABLEBERG_CFG;if(e)return e}if("undefined"!=typeof window)try{const e=window.parent?.TABLEBERG_CFG;if(e)return e}catch{}return{}}function tn(){return Boolean(en().IS_PRO)}const nn={top:"",right:"",bottom:"",left:""},ln={content:"",align:"left",styles:{textColor:"",linkColor:"",backgroundColor:"",fontSize:"",padding:{...nn},margin:{...nn}}};function on(e){if(!e)return;const{top:t,right:n,bottom:l,left:o}=e;return t||n||l||o?`${t||"0"} ${n||"0"} ${l||"0"} ${o||"0"}`:void 0}function rn({attributes:e,bindings:t,cellCoords:n,elementIndex:l}){const o=(0,u.useRef)(null),r=ds(e=>e.sortPreviewMode),s=ds(e=>e.isElementSelected),c=ds(e=>e.setSelectedElement),d=ds(e=>e.clearSelectedElement),h=ds(e=>e.updateCellElement),b=Yt(),g=s(n,l);kt({ref:o,onClickOutside:()=>{g&&d()}});const{values:p,isLoading:f}=gs(t),m=at(e,ln,t,p,(0,i.__)("(No data)","tableberg")),v=!!t?.content,{content:x,align:y,styles:C}=m,w={display:"flex",justifyContent:a(y),textAlign:y};return(0,J.jsxs)(J.Fragment,{children:[g&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(me.BlockControls,{children:[(0,J.jsx)(ot,{title:(0,i.__)("Align text","tableberg"),value:y,onChange:e=>{"left"!==e&&"center"!==e&&"right"!==e||h(n,l,{attributes:{align:e}})},controlset:"alignment"}),(0,J.jsx)(It,{cellCoords:n,elementIndex:l})]}),(0,J.jsx)(Kt,{cellCoords:n,elementIndex:l}),(0,J.jsx)(Xt,{attributes:m,bindings:t}),(0,J.jsx)(me.InspectorControls,{children:(0,J.jsx)(ps,{elementType:"text",bindings:t})})]}),(0,J.jsx)("div",{ref:o,style:w,onClick:e=>{e.stopPropagation(),r||(c(n,l),o.current&&b(o.current,"Text","A text element within a Tableberg cell"))},children:(0,J.jsx)(an,{content:x,cellCoords:n,elementIndex:l,dynamicBindingEnabled:v,isDynamicLoading:f,textColor:C.textColor,linkColor:C.linkColor,backgroundColor:C.backgroundColor,fontSize:C.fontSize,padding:C.padding,margin:C.margin})})]})}function an({content:e,cellCoords:t,elementIndex:n,dynamicBindingEnabled:l,isDynamicLoading:o,textColor:r,linkColor:a,backgroundColor:s,fontSize:c,padding:u,margin:d}){const h={...pt,options:[{icon:st,name:"Button",value:"button"},{icon:it,name:"Image",value:"image"},{icon:ct,name:"List",value:"list"},{icon:ut,name:"Ribbon",value:"ribbon",disabled:!0},...ht().map(e=>({icon:e.icon,name:e.autocompleteLabel||e.title,value:e.name}))]},b=ds(e=>e.sortPreviewMode),g=ds(e=>e.updateCellElement),p=ds(e=>e.replaceCellElement),f=ds(e=>e.searchTerm),m=ds(e=>e.table.search),v=tn()&&m?.enabled&&m?.highlightColor&&f.trim(),x=on(u),y=on(d),C={margin:null!=y?y:0,padding:x,color:r||void 0,fontSize:c||void 0,backgroundColor:s||void 0,"--tableberg-text-link-color":a||void 0},w={margin:y,padding:x,color:r||void 0,fontSize:c||void 0,backgroundColor:s||void 0,"--tableberg-text-link-color":a||void 0},_=`tableberg-text-element${a?" tableberg-has-link-color":""}${l?" tableberg-dynamic-content":""}`;return o?(0,J.jsx)("p",{className:_,style:C,children:(0,i.__)("Loading...","tableberg")}):v?(0,J.jsx)("p",{className:_,style:C,children:(0,J.jsx)(Pt,{content:e,searchTerm:f,highlightColor:m.highlightColor})}):b||l?(0,J.jsx)(me.RichText.Content,{tagName:"p",className:_,value:e,style:C}):(0,J.jsx)(me.RichText,{className:_,placeholder:"Type here",value:e,onChange:e=>g(t,n,{attributes:{content:e}}),autocompleters:[h],style:w,onReplace:e=>{const l=e?.[0];if("string"==typeof l){const e=Ma(l);return void(e&&p(t,n,e))}const o=function(e){return e.map(e=>{const t="string"==typeof e?.attributes?.content?e.attributes.content:(0,ve.getBlockContent)(e)||"",n=document.createElement("div");return n.innerHTML=t,(n.textContent||"").trim()}).filter(Boolean).join("\n")}(e);o&&g(t,n,{attributes:{content:o}})}})}const sn=[{path:"content",label:(0,i.__)("Content","tableberg")},{path:"styles.textColor",label:(0,i.__)("Text Color","tableberg")},{path:"styles.linkColor",label:(0,i.__)("Link Color","tableberg")},{path:"styles.backgroundColor",label:(0,i.__)("Background Color","tableberg")},{path:"styles.fontSize",label:(0,i.__)("Font Size","tableberg")}];var cn=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M10 17.389H8.444A5.194 5.194 0 1 1 8.444 7H10v1.5H8.444a3.694 3.694 0 0 0 0 7.389H10v1.5ZM14 7h1.556a5.194 5.194 0 0 1 0 10.39H14v-1.5h1.556a3.694 3.694 0 0 0 0-7.39H14V7Zm-4.5 6h5v-1.5h-5V13Z"})}),un=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M9 9v6h11V9H9zM4 20h1.5V4H4v16z"})}),dn=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M12.5 15v5H11v-5H4V9h7V4h1.5v5h7v6h-7Z"})}),hn=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M4 15h11V9H4v6zM18.5 4v16H20V4h-1.5z"})});const bn=window.wp.url;function gn({attributes:e,bindings:t,cellCoords:n,elementIndex:l,updateStyles:o,updateAttrs:r}){var a;const{styles:s,link:d,id:h,align:b}=e,g=ds(e=>e.updateSelectedElementStyles),p=ds(e=>e.updateSelectedElementAttrs),f=null!=o?o:g,m=null!=r?r:p,[v,x]=(0,u.useState)(!1),y=!!t?.["link.url"],C=!!t?.["styles.textColor"],w=!!t?.["styles.backgroundColor"],_=!!t?.id,k=!!d.url,S="_blank"===d.target,j=(0,u.useMemo)(()=>({url:d.url,opensInNewTab:S}),[d.url,S]),B=()=>{m({link:pn.link}),x(!1)},P=["auto","25%","50%","75%","100%"];return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(me.BlockControls,{group:"block",children:[(0,J.jsx)(me.AlignmentControl,{value:s.textAlign,onChange:e=>{"left"!==e&&"center"!==e&&"right"!==e&&(e=pn.styles.textAlign),f({textAlign:e})}}),(0,J.jsx)(c.ToolbarButton,{icon:cn,title:y?(0,i.__)("Link URL is dynamically bound","tableberg"):k?(0,i.__)("Unlink","tableberg"):(0,i.__)("Link","tableberg"),onClick:y?void 0:k?B:()=>x(!0),isActive:k||y,disabled:y}),(0,J.jsx)(It,{cellCoords:n,elementIndex:l}),v&&!y&&(0,J.jsx)(c.Popover,{placement:"bottom",onClose:()=>x(!1),shift:!0,children:(0,J.jsx)(me.__experimentalLinkControl,{value:j,onChange:({url:e="",opensInNewTab:t})=>{m({link:{...d,url:(0,bn.prependHTTP)(e),target:t?"_blank":"_self"}})},onRemove:B})})]}),(0,J.jsx)(Kt,{cellCoords:n,elementIndex:l}),(0,J.jsxs)(me.InspectorControls,{group:"color",children:[(0,J.jsx)(ke,{label:C?(0,i.__)("Text (dynamic)","tableberg"):(0,i.__)("Text","tableberg"),value:s.textColor,onChange:e=>f({textColor:e}),onDeselect:()=>f({textColor:pn.styles.textColor})}),(0,J.jsx)(ke,{label:(0,i.__)("Hover Text","tableberg"),value:s.textHoverColor,onChange:e=>f({textHoverColor:e}),onDeselect:()=>f({textHoverColor:pn.styles.textHoverColor})}),(0,J.jsx)(ke,{label:w?(0,i.__)("Background (dynamic)","tableberg"):(0,i.__)("Background","tableberg"),value:s.backgroundColor,onChange:e=>f({backgroundColor:e}),onDeselect:()=>f({backgroundColor:pn.styles.backgroundColor})}),(0,J.jsx)(ke,{label:(0,i.__)("Hover Background","tableberg"),value:s.backgroundHoverColor,onChange:e=>f({backgroundHoverColor:e}),onDeselect:()=>f({backgroundHoverColor:pn.styles.backgroundHoverColor})})]}),(0,J.jsxs)(me.InspectorControls,{group:"dimensions",children:[(0,J.jsx)(Pe,{label:(0,i.__)("Padding","tableberg"),value:s.padding,onChange:e=>f({padding:e}),onDeselect:()=>f({padding:pn.styles.padding}),hasValue:()=>!!(s.padding.top||s.padding.right||s.padding.bottom||s.padding.left)}),(0,J.jsx)(_e,{label:(0,i.__)("Border Radius","tableberg"),value:s.borderRadius,onChange:e=>f({borderRadius:e}),onDeselect:()=>f({borderRadius:pn.styles.borderRadius}),hasValue:()=>!!(s.borderRadius.topLeft||s.borderRadius.topRight||s.borderRadius.bottomLeft||s.borderRadius.bottomRight)})]}),(0,J.jsx)(me.InspectorControls,{children:(0,J.jsx)(c.PanelBody,{title:(0,i.__)("Typography","tableberg"),children:(0,J.jsx)(c.BaseControl,{__nextHasNoMarginBottom:!0,children:(0,J.jsx)(me.FontSizePicker,{value:s.fontSize,onChange:e=>{f({fontSize:e||pn.styles.fontSize})}})})})}),(0,J.jsx)(me.InspectorControls,{group:"advanced",children:(0,J.jsx)(c.TextControl,{__nextHasNoMarginBottom:!0,autoComplete:"off",label:_?(0,i.__)("HTML ID (dynamic)","tableberg"):(0,i.__)("HTML ID","tableberg"),help:_?(0,i.__)("Overridden by dynamic data","tableberg"):"",value:h,onChange:e=>m({id:e})})}),(0,J.jsx)(me.InspectorControls,{children:(0,J.jsxs)(c.PanelBody,{title:(0,i.__)("Button Settings","tableberg"),children:[(0,J.jsxs)(c.__experimentalToggleGroupControl,{label:(0,i.__)("Style","tableberg"),value:null!==(a=s.variant)&&void 0!==a?a:"fill",onChange:e=>{f({variant:"outline"===e?"outline":"fill"})},isBlock:!0,children:[(0,J.jsx)(c.__experimentalToggleGroupControlOption,{value:"fill",label:(0,i.__)("Fill","tableberg")}),(0,J.jsx)(c.__experimentalToggleGroupControlOption,{value:"outline",label:(0,i.__)("Outline","tableberg")})]}),(0,J.jsxs)(c.__experimentalToggleGroupControl,{label:(0,i.__)("Button Alignment","tableberg"),value:b,onChange:e=>{"left"!==e&&"center"!==e&&"right"!==e&&(e=pn.align),m({align:e})},isBlock:!0,children:[(0,J.jsx)(c.__experimentalToggleGroupControlOptionIcon,{value:"left",label:(0,i.__)("Left","tableberg"),icon:un}),(0,J.jsx)(c.__experimentalToggleGroupControlOptionIcon,{value:"center",label:(0,i.__)("Center","tableberg"),icon:dn}),(0,J.jsx)(c.__experimentalToggleGroupControlOptionIcon,{value:"right",label:(0,i.__)("Right","tableberg"),icon:hn})]}),(0,J.jsx)(c.__experimentalToggleGroupControl,{label:(0,i.__)("Width","tableberg"),value:s.width,onChange:e=>{e&&"number"!=typeof e||(e=pn.styles.width),P.includes(e)||(e=pn.styles.width),f({width:e})},isBlock:!0,children:P.map(e=>(0,J.jsx)(c.__experimentalToggleGroupControlOption,{value:e,label:(0,i.__)(e,"tableberg")},e))})]})}),(0,J.jsx)(me.InspectorControls,{children:(0,J.jsx)(ps,{elementType:"button",bindings:t})})]})}const pn={content:"",id:"",align:"left",link:{url:"",target:"_self"},styles:{variant:"fill",backgroundColor:"#000000",textColor:"#ffffff",backgroundHoverColor:"",textHoverColor:"",textAlign:"center",width:"auto",padding:{top:"var(--wp--preset--spacing--20)",right:"var(--wp--preset--spacing--20)",bottom:"var(--wp--preset--spacing--20)",left:"var(--wp--preset--spacing--20)"},borderRadius:{topLeft:"4px",topRight:"4px",bottomRight:"4px",bottomLeft:"4px"},fontSize:""}};function fn(e){const t="outline"===e.variant;return{vars:{"--tableberg-button-background-color":t?"transparent":e.backgroundColor,"--tableberg-button-text-color":t?e.backgroundColor:e.textColor,"--tableberg-button-hover-background-color":e.backgroundHoverColor||e.backgroundColor,"--tableberg-button-text-hover-color":e.textHoverColor||e.textColor},border:t?`2px solid ${e.backgroundColor}`:void 0}}function mn({attributes:e,bindings:t,cellCoords:n,elementIndex:l}){const o=(0,u.useRef)(null),r=ds(e=>e.sortPreviewMode),s=ds(e=>e.isElementSelected),c=ds(e=>e.setSelectedElement),d=ds(e=>e.clearSelectedElement),h=Yt(),b=s(n,l),{values:g,isLoading:p}=gs(t);kt({ref:o,onClickOutside:()=>{b&&d()}});const f=at(e,pn,t,g,(0,i.__)("(No data)","tableberg")),m=!!t&&Object.keys(t).length>0,v=!!t?.content,{content:x,align:y,styles:C}=f,w=function(e){switch(e){case"25%":return"calc(25% - (var(--wp--style--block-gap, 0.5em) * 0.75))";case"50%":return"calc(50% - (var(--wp--style--block-gap, 0.5em) * 0.5))";case"75%":return"calc(75% - (var(--wp--style--block-gap, 0.5em) * 0.25))";case"100%":return"100%";default:return}}(C.width),_=fn(C),k={display:"flex",justifyContent:a(y),width:w?"100%":void 0,..._.vars},S={width:w,maxWidth:w?"none":void 0,minWidth:w?"0":void 0,flexBasis:"100%"===C.width?"100%":void 0},j={display:"inline-block",border:_.border,textAlign:C.textAlign,fontSize:C.fontSize,paddingTop:C.padding.top,paddingRight:C.padding.right,paddingBottom:C.padding.bottom,paddingLeft:C.padding.left,borderTopLeftRadius:C.borderRadius.topLeft,borderTopRightRadius:C.borderRadius.topRight,borderBottomRightRadius:C.borderRadius.bottomRight,borderBottomLeftRadius:C.borderRadius.bottomLeft,width:w?"100%":void 0};return(0,J.jsxs)(J.Fragment,{children:[b&&(0,J.jsx)(gn,{attributes:f,bindings:t,cellCoords:n,elementIndex:l}),(0,J.jsx)("div",{ref:o,style:k,onClick:e=>{e.stopPropagation(),r||(c(n,l),o.current&&h(o.current,"Button","A button element within a Tableberg cell"))},children:(0,J.jsx)("div",{style:S,children:(0,J.jsx)(vn,{content:x,cellCoords:n,elementIndex:l,contentIsBound:v,hasDynamicBindings:m,isDynamicLoading:p,buttonStyleCss:j})})})]})}function vn({content:e,cellCoords:t,elementIndex:n,contentIsBound:l,hasDynamicBindings:o,isDynamicLoading:r,buttonStyleCss:a}){const s=ds(e=>e.sortPreviewMode),c=ds(e=>e.updateCellElement),u=ds(e=>e.searchTerm),d=ds(e=>e.table.search),h=tn()&&d?.enabled&&d?.highlightColor&&u.trim(),b=je()("wp-block-button__link","wp-element-button"),g=je()(b,{"tableberg-dynamic-content":o});return r?(0,J.jsx)("div",{className:g,style:a,children:(0,i.__)("Loading...","tableberg")}):h?(0,J.jsx)("div",{className:g,style:a,children:(0,J.jsx)(Pt,{content:e,searchTerm:u,highlightColor:d.highlightColor})}):s||l?(0,J.jsx)("div",{className:g,style:a,children:e}):(0,J.jsx)(me.RichText,{className:b,tagName:"div",style:a,placeholder:(0,i.__)("Button text","tableberg"),value:e,onChange:e=>c(t,n,{attributes:{content:e}})})}const xn=[{path:"content",label:(0,i.__)("Button Text","tableberg")},{path:"link.url",label:(0,i.__)("Link URL","tableberg")},{path:"id",label:(0,i.__)("HTML ID","tableberg")},{path:"styles.backgroundColor",label:(0,i.__)("Background Color","tableberg")},{path:"styles.textColor",label:(0,i.__)("Text Color","tableberg")}];var yn=(0,J.jsx)(Re.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,J.jsx)(Re.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z"})}),Cn=(0,J.jsx)(Re.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,J.jsx)(Re.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M6 5.5h12a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H6a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5ZM4 6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6Zm4 10h2v-1.5H8V16Zm5 0h-2v-1.5h2V16Zm1 0h2v-1.5h-2V16Z"})});const wn=window.wp.element;var kn=(0,wn.forwardRef)(({icon:e,size:t=24,...n},l)=>(0,wn.cloneElement)(e,{width:t,height:t,...n,ref:l})),Sn=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M6 4a2 2 0 0 0-2 2v3h1.5V6a.5.5 0 0 1 .5-.5h3V4H6Zm3 14.5H6a.5.5 0 0 1-.5-.5v-3H4v3a2 2 0 0 0 2 2h3v-1.5Zm6 1.5v-1.5h3a.5.5 0 0 0 .5-.5v-3H20v3a2 2 0 0 1-2 2h-3Zm3-16a2 2 0 0 1 2 2v3h-1.5V6a.5.5 0 0 0-.5-.5h-3V4h3Z"})}),jn=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M17.031 4.703 15.576 4l-1.56 3H14v.03l-2.324 4.47H9.5V13h1.396l-1.502 2.889h-.95a3.694 3.694 0 0 1 0-7.389H10V7H8.444a5.194 5.194 0 1 0 0 10.389h.17L7.5 19.53l1.416.719L15.049 8.5h.507a3.694 3.694 0 0 1 0 7.39H14v1.5h1.556a5.194 5.194 0 0 0 .273-10.383l1.202-2.304Z"})}),Bn=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M16 10h4c.6 0 1-.4 1-1V5c0-.6-.4-1-1-1h-4c-.6 0-1 .4-1 1v4c0 .6.4 1 1 1zm-8 4H4c-.6 0-1 .4-1 1v4c0 .6.4 1 1 1h4c.6 0 1-.4 1-1v-4c0-.6-.4-1-1-1zm10-2.6L14.5 15l1.1 1.1 1.7-1.7c-.1 1.1-.3 2.3-.9 2.9-.3.3-.7.5-1.3.5h-4.5v1.5H15c.9 0 1.7-.3 2.3-.9 1-1 1.3-2.7 1.4-4l1.8 1.8 1.1-1.1-3.6-3.7zM6.8 9.7c.1-1.1.3-2.3.9-2.9.4-.4.8-.6 1.3-.6h4.5V4.8H9c-.9 0-1.7.3-2.3.9-1 1-1.3 2.7-1.4 4L3.5 8l-1 1L6 12.6 9.5 9l-1-1-1.7 1.7z"})});const Pn=[{label:(0,i.__)("Original","tableberg"),value:""},{label:(0,i.__)("Square - 1:1","tableberg"),value:"1"},{label:(0,i.__)("Standard - 4:3","tableberg"),value:"4/3"},{label:(0,i.__)("Portrait - 3:4","tableberg"),value:"3/4"},{label:(0,i.__)("Classic - 3:2","tableberg"),value:"3/2"},{label:(0,i.__)("Classic Portrait - 2:3","tableberg"),value:"2/3"},{label:(0,i.__)("Wide - 16:9","tableberg"),value:"16/9"},{label:(0,i.__)("Tall - 9:16","tableberg"),value:"9/16"}],Rn=[{value:"cover",label:(0,i.__)("Cover","tableberg"),help:(0,i.__)("Fill the space by clipping what doesn't fit.","tableberg")},{value:"contain",label:(0,i.__)("Contain","tableberg"),help:(0,i.__)("Fit the content to the space without clipping.","tableberg")}],In=[{label:(0,i.__)("Thumbnail","tableberg"),value:"thumbnail"},{label:(0,i.__)("Medium","tableberg"),value:"medium"},{label:(0,i.__)("Large","tableberg"),value:"large"},{label:(0,i.__)("Full Size","tableberg"),value:"full"}];function Tn({attributes:e,bindings:t,showCaption:n,setShowCaption:l,cellCoords:o,elementIndex:r,updateAttrs:a}){const{media:s,alt:d,aspectRatio:h,height:b,width:g,scale:p,sizeSlug:f,href:m,linkTarget:v,lightbox:x,align:y,border:C,borderRadius:w,caption:_}=e,k=ds(e=>e.updateSelectedElementAttrs),S=null!=a?a:k,[j,B]=(0,u.useState)(!1),P=!!m,R=!!x?.enabled,I=P||R,T="_blank"===v,E=(0,u.useMemo)(()=>({url:m,opensInNewTab:T}),[m,T]),O=()=>{S({lightbox:{enabled:!R},...R?{}:{href:"",linkTarget:"_self"}}),B(!1)},M=!!s.url||!!s.id,A=(0,u.useMemo)(()=>Rn.reduce((e,t)=>(e[t.value]=t.help,e),{}),[]);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(me.BlockControls,{group:"block",children:[(0,J.jsx)(ot,{icon:Ke,title:(0,i.__)("Align image","tableberg"),value:y,onChange:e=>{e&&S({align:e})},controlset:"alignment"}),(0,J.jsx)(c.ToolbarButton,{onClick:()=>{l(!n),n&&_&&S({caption:""})},icon:Cn,isPressed:n,label:n?(0,i.__)("Remove caption","tableberg"):(0,i.__)("Add caption","tableberg")}),(0,J.jsx)(c.ToolbarButton,{icon:cn,title:I?(0,i.__)("Edit link","tableberg"):(0,i.__)("Link","tableberg"),onClick:()=>B(!0),isActive:I}),(0,J.jsx)(It,{cellCoords:o,elementIndex:r}),j&&(0,J.jsx)(c.Popover,{placement:"bottom",onClose:()=>B(!1),shift:!0,children:R?(0,J.jsxs)("div",{style:{alignItems:"center",border:"1px solid #1e1e1e",borderRadius:"2px",display:"flex",gap:"16px",justifyContent:"space-between",minWidth:"560px",padding:"12px 14px"},children:[(0,J.jsxs)("div",{style:{alignItems:"center",display:"flex",gap:"16px"},children:[(0,J.jsx)(kn,{icon:Sn}),(0,J.jsxs)("span",{style:{display:"flex",flexDirection:"column"},children:[(0,J.jsx)("span",{children:(0,i.__)("Enlarge on click","tableberg")}),(0,J.jsx)("span",{style:{color:"#757575"},children:(0,i.__)("Scales the image with a lightbox effect","tableberg")})]})]}),(0,J.jsx)(c.Button,{icon:jn,label:(0,i.__)("Disable Enlarge on click","tableberg"),onClick:O,showTooltip:!0,variant:"secondary"})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(me.__experimentalLinkControl,{value:E,onChange:({url:e="",opensInNewTab:t})=>{S({href:(0,bn.prependHTTP)(e),linkTarget:t?"_blank":"_self",lightbox:En.lightbox})},onRemove:()=>{S({href:"",linkTarget:"_self",lightbox:En.lightbox}),B(!1)}}),M&&(0,J.jsx)("div",{style:{borderTop:"1px solid #ddd",padding:"8px 0"},children:(0,J.jsx)(c.Button,{icon:Sn,isPressed:R,onClick:O,style:{alignItems:"flex-start",display:"flex",gap:"16px",height:"auto",justifyContent:"flex-start",padding:"12px 16px",textAlign:"left",width:"100%"},children:(0,J.jsxs)("span",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[(0,J.jsx)("span",{children:(0,i.__)("Enlarge on click","tableberg")}),(0,J.jsx)("span",{style:{color:"#757575",fontSize:"12px"},children:(0,i.__)("Scale the image with a lightbox effect.","tableberg")})]})})})]})})]}),(0,J.jsx)(Kt,{cellCoords:o,elementIndex:r}),M&&(0,J.jsx)(me.BlockControls,{children:(0,J.jsx)(c.ToolbarGroup,{children:(0,J.jsx)(me.MediaUploadCheck,{children:(0,J.jsx)(me.MediaUpload,{onSelect:e=>{e&&e.url?S({media:{id:e.id,url:e.url,alt:e.alt||"",title:e.title||"",sizes:e.sizes||{}},alt:e.alt||""}):S({media:{}})},allowedTypes:["image"],value:s.id,render:({open:e})=>(0,J.jsx)(c.ToolbarButton,{onClick:e,icon:Bn,label:(0,i.__)("Replace","tableberg")})})})})}),(0,J.jsx)(me.InspectorControls,{children:(0,J.jsxs)(c.__experimentalToolsPanel,{label:(0,i.__)("Settings","tableberg"),resetAll:()=>{S({alt:"",aspectRatio:"",height:"",scale:"cover",width:"150px",sizeSlug:"large",lightbox:En.lightbox})},children:[(0,J.jsx)(c.__experimentalToolsPanelItem,{isShownByDefault:!0,hasValue:()=>!!d,label:(0,i.__)("Alternative Text","tableberg"),onDeselect:()=>S({alt:""}),children:(0,J.jsx)(c.TextareaControl,{__nextHasNoMarginBottom:!0,value:d,label:(0,i.__)("Alternative Text","tableberg"),onChange:e=>S({alt:e}),help:(0,i.__)("Describe the image for screen readers.","tableberg")})}),(0,J.jsx)(c.__experimentalToolsPanelItem,{isShownByDefault:!0,label:(0,i.__)("Aspect ratio","tableberg"),onDeselect:()=>S({aspectRatio:""}),hasValue:()=>""!==h,children:(0,J.jsx)(c.SelectControl,{value:h||"",__nextHasNoMarginBottom:!0,options:Pn,label:(0,i.__)("Aspect ratio","tableberg"),onChange:e=>S({aspectRatio:e})})}),h&&(0,J.jsx)(c.__experimentalToolsPanelItem,{label:(0,i.__)("Scale","tableberg"),isShownByDefault:!0,hasValue:()=>"cover"!==p,onDeselect:()=>S({scale:"cover"}),children:(0,J.jsx)(c.__experimentalToggleGroupControl,{label:(0,i.__)("Scale","tableberg"),isBlock:!0,help:A[p||"cover"],value:p||"cover",onChange:e=>S({scale:e}),__nextHasNoMarginBottom:!0,children:Rn.map(e=>(0,J.jsx)(c.__experimentalToggleGroupControlOption,{value:e.value,label:e.label},e.value))})}),(0,J.jsxs)("div",{style:{display:"flex",gap:"10px",gridColumn:"1 / -1"},children:[(0,J.jsx)(c.__experimentalToolsPanelItem,{isShownByDefault:!0,label:(0,i.__)("Width","tableberg"),hasValue:()=>""!==g&&"150px"!==g,onDeselect:()=>S({width:"150px"}),children:(0,J.jsx)(c.__experimentalUnitControl,{label:(0,i.__)("Width","tableberg"),placeholder:(0,i.__)("Auto","tableberg"),labelPosition:"top",units:[{value:"px",label:"px",default:0}],min:0,value:g,onChange:e=>S({width:e||""})})}),(0,J.jsx)(c.__experimentalToolsPanelItem,{isShownByDefault:!0,label:(0,i.__)("Height","tableberg"),hasValue:()=>""!==b,onDeselect:()=>S({height:""}),children:(0,J.jsx)(c.__experimentalUnitControl,{label:(0,i.__)("Height","tableberg"),placeholder:(0,i.__)("Auto","tableberg"),labelPosition:"top",units:[{value:"px",label:"px",default:0}],min:0,value:b,onChange:e=>S({height:e||""})})})]}),M&&s.sizes&&Object.keys(s.sizes).length>0&&(0,J.jsx)(c.__experimentalToolsPanelItem,{isShownByDefault:!0,label:(0,i.__)("Resolution","tableberg"),hasValue:()=>"large"!==f,onDeselect:()=>S({sizeSlug:"large"}),children:(0,J.jsx)(c.SelectControl,{label:(0,i.__)("Resolution","tableberg"),value:f,options:In.filter(e=>s.sizes?.[e.value]),onChange:e=>S({sizeSlug:e}),help:(0,i.__)("Select the size of the source image.","tableberg")})})]})}),(0,J.jsxs)(me.InspectorControls,{group:"border",children:[(0,J.jsx)(we,{value:C,label:(0,i.__)("Border","tableberg"),onChange:e=>S({border:e}),onDeselect:()=>S({border:En.border}),hasValue:()=>!!(C.top||C.right||C.bottom||C.left)}),(0,J.jsx)(_e,{label:(0,i.__)("Border Radius","tableberg"),value:w,onChange:e=>S({borderRadius:e}),onDeselect:()=>S({borderRadius:En.borderRadius}),hasValue:()=>!!(w.topLeft||w.topRight||w.bottomLeft||w.bottomRight)})]}),(0,J.jsx)(me.InspectorControls,{children:(0,J.jsx)(ps,{elementType:"image",bindings:t})})]})}const En={media:{},height:"",width:"150px",alt:"",align:"left",aspectRatio:"",scale:"cover",sizeSlug:"large",caption:"",href:"",linkTarget:"_self",lightbox:{enabled:!1},border:{top:"",right:"",bottom:"",left:""},borderRadius:{topLeft:"",topRight:"",bottomLeft:"",bottomRight:""}};function On({attributes:e,bindings:t,cellCoords:n,elementIndex:l}){const o=(0,u.useRef)(null),r=(0,u.useRef)(null),a=ds(e=>e.sortPreviewMode),s=ds(e=>e.isElementSelected),d=ds(e=>e.setSelectedElement),h=ds(e=>e.clearSelectedElement),b=ds(e=>e.updateCellElement),g=Yt(),p=s(n,l),[f,m]=(0,u.useState)(!!e.caption);kt({ref:o,onClickOutside:()=>{p&&h()}});const{values:v}=gs(t),x=at(e,En,t,v,(0,i.__)("(No data)","tableberg")),{media:y,height:C,width:w,alt:_,aspectRatio:k,scale:S,sizeSlug:j,caption:B,href:P,linkTarget:R,border:I,borderRadius:T}=x,E=!!y.url||!!y.id,O=y.sizes&&y.sizes[j]?y.sizes[j].url:y.url||"",[M,A]=(0,u.useState)(null);(0,u.useEffect)(()=>{r.current?.complete&&r.current.naturalWidth&&A({width:r.current.naturalWidth,height:r.current.naturalHeight})},[O]);const D=()=>{r.current&&A({width:r.current.naturalWidth,height:r.current.naturalHeight})},L={aspectRatio:k||(M?`${M.width}/${M.height}`:void 0),objectFit:S,width:w||"100%",height:C||"auto",borderTopLeftRadius:T.topLeft,borderTopRightRadius:T.topRight,borderBottomLeftRadius:T.bottomLeft,borderBottomRightRadius:T.bottomRight,borderTop:I.top,borderRight:I.right,borderBottom:I.bottom,borderLeft:I.left,display:"block"},F=()=>{const e=(0,J.jsx)("img",{ref:r,src:O,alt:_||y.alt||"",style:L,onLoad:D});return P&&!p?(0,J.jsx)("a",{href:P,target:R,rel:"_blank"===R?"noopener noreferrer":void 0,onClick:e=>e.preventDefault(),children:e}):e};return(0,J.jsxs)(J.Fragment,{children:[p&&(0,J.jsx)(Tn,{attributes:x,bindings:t,showCaption:f,setShowCaption:m,cellCoords:n,elementIndex:l}),(0,J.jsx)("figure",{ref:o,className:"tableberg-image-element",style:{margin:0,lineHeight:1},onClick:e=>{e.stopPropagation(),a||(d(n,l),o.current&&g(o.current,"Image","An image element within a Tableberg cell"))},children:E?(0,J.jsxs)(J.Fragment,{children:[p?(0,J.jsx)(c.ResizableBox,{size:{width:w||"auto",height:C||"auto"},showHandle:p,minWidth:50,minHeight:50,maxWidth:720,enable:{top:!1,right:!0,bottom:!0,left:!1},onResize:(e,t,o)=>{let r=1;const a=k||(M?`${M.width}/${M.height}`:"1/1"),s=a.split("/");2===s.length?r=parseInt(s[0])/parseInt(s[1]):"1"===a&&(r=1);let i=o.offsetWidth,c=o.offsetHeight;"bottom"===t?i=c*r:c=i/r,b(n,l,{attributes:{width:`${Math.round(i)}px`,height:`${Math.round(c)}px`}})},children:F()}):F(),f&&(p||B)&&(0,J.jsx)(me.RichText,{tagName:"figcaption",className:"tableberg-image-caption","aria-label":(0,i.__)("Image caption text","tableberg"),placeholder:(0,i.__)("Add caption","tableberg"),value:B,onChange:e=>b(n,l,{attributes:{caption:e}}),style:{marginTop:"0.5em",marginBottom:"1em",textAlign:"center",fontSize:"0.875em",color:"#666"}})]}):(0,J.jsx)(me.MediaUploadCheck,{children:(0,J.jsx)(me.MediaUpload,{onSelect:e=>{e&&e.url?b(n,l,{attributes:{media:{id:e.id,url:e.url,alt:e.alt||"",title:e.title||"",sizes:e.sizes||{}},alt:e.alt||""}}):b(n,l,{attributes:{media:{}}})},allowedTypes:["image"],value:y.id,render:({open:e})=>(0,J.jsx)(c.Placeholder,{className:"tableberg-image-placeholder",icon:yn,label:(0,i.__)("Image","tableberg"),instructions:(0,i.__)("Upload an image or pick one from your media library.","tableberg"),children:(0,J.jsx)(c.Button,{variant:"secondary",onClick:e,children:(0,i.__)("Media Library","tableberg")})})})})})]})}const Mn=[{path:"media.url",label:(0,i.__)("Image URL","tableberg")},{path:"alt",label:(0,i.__)("Alt Text","tableberg")},{path:"href",label:(0,i.__)("Link URL","tableberg")},{path:"caption",label:(0,i.__)("Caption","tableberg")}];var An=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M4 7.2v1.5h16V7.2H4zm8 8.6h8v-1.5h-8v1.5zm-4-4.6l-4 4 4 4 1-1-3-3 3-3-1-1z"})}),Dn=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M4 7.2v1.5h16V7.2H4zm8 8.6h8v-1.5h-8v1.5zm-8-3.5l3 3-3 3 1 1 4-4-4-4-1 1z"})});function Ln(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Fn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);t&&(l=l.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,l)}return n}function Nn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fn(Object(n),!0).forEach(function(t){Ln(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}const Vn=()=>{};let Hn={},zn={},Gn=null,Zn={mark:Vn,measure:Vn};try{"undefined"!=typeof window&&(Hn=window),"undefined"!=typeof document&&(zn=document),"undefined"!=typeof MutationObserver&&(Gn=MutationObserver),"undefined"!=typeof performance&&(Zn=performance)}catch(e){}const{userAgent:qn=""}=Hn.navigator||{},$n=Hn,Wn=zn,Qn=Gn,Un=Zn,Kn=($n.document,!!Wn.documentElement&&!!Wn.head&&"function"==typeof Wn.addEventListener&&"function"==typeof Wn.createElement),Yn=~qn.indexOf("MSIE")||~qn.indexOf("Trident/");var Jn={classic:{fa:"solid",fas:"solid","fa-solid":"solid",far:"regular","fa-regular":"regular",fal:"light","fa-light":"light",fat:"thin","fa-thin":"thin",fab:"brands","fa-brands":"brands"},duotone:{fa:"solid",fad:"solid","fa-solid":"solid","fa-duotone":"solid",fadr:"regular","fa-regular":"regular",fadl:"light","fa-light":"light",fadt:"thin","fa-thin":"thin"},sharp:{fa:"solid",fass:"solid","fa-solid":"solid",fasr:"regular","fa-regular":"regular",fasl:"light","fa-light":"light",fast:"thin","fa-thin":"thin"},"sharp-duotone":{fa:"solid",fasds:"solid","fa-solid":"solid",fasdr:"regular","fa-regular":"regular",fasdl:"light","fa-light":"light",fasdt:"thin","fa-thin":"thin"}},Xn=["fa-classic","fa-duotone","fa-sharp","fa-sharp-duotone"],el="classic",tl="duotone",nl=[el,tl,"sharp","sharp-duotone"],ll=new Map([["classic",{defaultShortPrefixId:"fas",defaultStyleId:"solid",styleIds:["solid","regular","light","thin","brands"],futureStyleIds:[],defaultFontWeight:900}],["sharp",{defaultShortPrefixId:"fass",defaultStyleId:"solid",styleIds:["solid","regular","light","thin"],futureStyleIds:[],defaultFontWeight:900}],["duotone",{defaultShortPrefixId:"fad",defaultStyleId:"solid",styleIds:["solid","regular","light","thin"],futureStyleIds:[],defaultFontWeight:900}],["sharp-duotone",{defaultShortPrefixId:"fasds",defaultStyleId:"solid",styleIds:["solid","regular","light","thin"],futureStyleIds:[],defaultFontWeight:900}]]),ol=["fak","fa-kit","fakd","fa-kit-duotone"],rl=["fak","fakd"],al={GROUP:"duotone-group",SWAP_OPACITY:"swap-opacity",PRIMARY:"primary",SECONDARY:"secondary"},sl=["fak","fa-kit","fakd","fa-kit-duotone"],il={classic:{fab:"fa-brands",fad:"fa-duotone",fal:"fa-light",far:"fa-regular",fas:"fa-solid",fat:"fa-thin"},duotone:{fadr:"fa-regular",fadl:"fa-light",fadt:"fa-thin"},sharp:{fass:"fa-solid",fasr:"fa-regular",fasl:"fa-light",fast:"fa-thin"},"sharp-duotone":{fasds:"fa-solid",fasdr:"fa-regular",fasdl:"fa-light",fasdt:"fa-thin"}},cl=["fa","fas","far","fal","fat","fad","fadr","fadl","fadt","fab","fass","fasr","fasl","fast","fasds","fasdr","fasdl","fasdt","fa-classic","fa-duotone","fa-sharp","fa-sharp-duotone","fa-solid","fa-regular","fa-light","fa-thin","fa-duotone","fa-brands"],ul=[1,2,3,4,5,6,7,8,9,10],dl=ul.concat([11,12,13,14,15,16,17,18,19,20]),hl=[...Object.keys({classic:["fas","far","fal","fat","fad"],duotone:["fadr","fadl","fadt"],sharp:["fass","fasr","fasl","fast"],"sharp-duotone":["fasds","fasdr","fasdl","fasdt"]}),"solid","regular","light","thin","duotone","brands","2xs","xs","sm","lg","xl","2xl","beat","border","fade","beat-fade","bounce","flip-both","flip-horizontal","flip-vertical","flip","fw","inverse","layers-counter","layers-text","layers","li","pull-left","pull-right","pulse","rotate-180","rotate-270","rotate-90","rotate-by","shake","spin-pulse","spin-reverse","spin","stack-1x","stack-2x","stack","ul",al.GROUP,al.SWAP_OPACITY,al.PRIMARY,al.SECONDARY].concat(ul.map(e=>"".concat(e,"x"))).concat(dl.map(e=>"w-".concat(e)));const bl="___FONT_AWESOME___",gl=16,pl="svg-inline--fa",fl="data-fa-i2svg",ml="data-fa-pseudo-element",vl="data-prefix",xl="data-icon",yl="fontawesome-i2svg",Cl=["HTML","HEAD","STYLE","SCRIPT"],wl=(()=>{try{return!0}catch(e){return!1}})();function _l(e){return new Proxy(e,{get:(e,t)=>t in e?e[t]:e[el]})}const kl=Nn({},Jn);kl[el]=Nn(Nn(Nn(Nn({},{"fa-duotone":"duotone"}),Jn[el]),{fak:"kit","fa-kit":"kit"}),{fakd:"kit-duotone","fa-kit-duotone":"kit-duotone"});const Sl=_l(kl),jl=Nn({},{classic:{solid:"fas",regular:"far",light:"fal",thin:"fat",brands:"fab"},duotone:{solid:"fad",regular:"fadr",light:"fadl",thin:"fadt"},sharp:{solid:"fass",regular:"fasr",light:"fasl",thin:"fast"},"sharp-duotone":{solid:"fasds",regular:"fasdr",light:"fasdl",thin:"fasdt"}});jl[el]=Nn(Nn(Nn(Nn({},{duotone:"fad"}),jl[el]),{kit:"fak"}),{"kit-duotone":"fakd"});const Bl=_l(jl),Pl=Nn({},il);Pl[el]=Nn(Nn({},Pl[el]),{fak:"fa-kit"});const Rl=_l(Pl),Il=Nn({},{classic:{"fa-brands":"fab","fa-duotone":"fad","fa-light":"fal","fa-regular":"far","fa-solid":"fas","fa-thin":"fat"},duotone:{"fa-regular":"fadr","fa-light":"fadl","fa-thin":"fadt"},sharp:{"fa-solid":"fass","fa-regular":"fasr","fa-light":"fasl","fa-thin":"fast"},"sharp-duotone":{"fa-solid":"fasds","fa-regular":"fasdr","fa-light":"fasdl","fa-thin":"fasdt"}});Il[el]=Nn(Nn({},Il[el]),{"fa-kit":"fak"}),_l(Il);const Tl=/fa(s|r|l|t|d|dr|dl|dt|b|k|kd|ss|sr|sl|st|sds|sdr|sdl|sdt)?[\-\ ]/,El="fa-layers-text",Ol=/Font ?Awesome ?([56 ]*)(Solid|Regular|Light|Thin|Duotone|Brands|Free|Pro|Sharp Duotone|Sharp|Kit)?.*/i,Ml=(_l(Nn({},{classic:{900:"fas",400:"far",normal:"far",300:"fal",100:"fat"},duotone:{900:"fad",400:"fadr",300:"fadl",100:"fadt"},sharp:{900:"fass",400:"fasr",300:"fasl",100:"fast"},"sharp-duotone":{900:"fasds",400:"fasdr",300:"fasdl",100:"fasdt"}})),["class","data-prefix","data-icon","data-fa-transform","data-fa-mask"]),Al="duotone-group",Dl="primary",Ll="secondary",Fl=["kit",...hl],Nl=$n.FontAwesomeConfig||{};Wn&&"function"==typeof Wn.querySelector&&[["data-family-prefix","familyPrefix"],["data-css-prefix","cssPrefix"],["data-family-default","familyDefault"],["data-style-default","styleDefault"],["data-replacement-class","replacementClass"],["data-auto-replace-svg","autoReplaceSvg"],["data-auto-add-css","autoAddCss"],["data-auto-a11y","autoA11y"],["data-search-pseudo-elements","searchPseudoElements"],["data-observe-mutations","observeMutations"],["data-mutate-approach","mutateApproach"],["data-keep-original-source","keepOriginalSource"],["data-measure-performance","measurePerformance"],["data-show-missing-icons","showMissingIcons"]].forEach(e=>{let[t,n]=e;const l=function(e){return""===e||"false"!==e&&("true"===e||e)}(function(e){var t=Wn.querySelector("script["+e+"]");if(t)return t.getAttribute(e)}(t));null!=l&&(Nl[n]=l)});const Vl={styleDefault:"solid",familyDefault:el,cssPrefix:"fa",replacementClass:pl,autoReplaceSvg:!0,autoAddCss:!0,autoA11y:!0,searchPseudoElements:!1,observeMutations:!0,mutateApproach:"async",keepOriginalSource:!0,measurePerformance:!1,showMissingIcons:!0};Nl.familyPrefix&&(Nl.cssPrefix=Nl.familyPrefix);const Hl=Nn(Nn({},Vl),Nl);Hl.autoReplaceSvg||(Hl.observeMutations=!1);const zl={};Object.keys(Vl).forEach(e=>{Object.defineProperty(zl,e,{enumerable:!0,set:function(t){Hl[e]=t,Gl.forEach(e=>e(zl))},get:function(){return Hl[e]}})}),Object.defineProperty(zl,"familyPrefix",{enumerable:!0,set:function(e){Hl.cssPrefix=e,Gl.forEach(e=>e(zl))},get:function(){return Hl.cssPrefix}}),$n.FontAwesomeConfig=zl;const Gl=[],Zl=gl,ql={size:16,x:0,y:0,rotate:0,flipX:!1,flipY:!1};function $l(){let e=12,t="";for(;e-- >0;)t+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[62*Math.random()|0];return t}function Wl(e){const t=[];for(let n=(e||[]).length>>>0;n--;)t[n]=e[n];return t}function Ql(e){return e.classList?Wl(e.classList):(e.getAttribute("class")||"").split(" ").filter(e=>e)}function Ul(e){return"".concat(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Kl(e){return Object.keys(e||{}).reduce((t,n)=>t+"".concat(n,": ").concat(e[n].trim(),";"),"")}function Yl(e){return e.size!==ql.size||e.x!==ql.x||e.y!==ql.y||e.rotate!==ql.rotate||e.flipX||e.flipY}function Jl(){const e="fa",t=pl,n=zl.cssPrefix,l=zl.replacementClass;let o=':root, :host {\n --fa-font-solid: normal 900 1em/1 "Font Awesome 6 Free";\n --fa-font-regular: normal 400 1em/1 "Font Awesome 6 Free";\n --fa-font-light: normal 300 1em/1 "Font Awesome 6 Pro";\n --fa-font-thin: normal 100 1em/1 "Font Awesome 6 Pro";\n --fa-font-duotone: normal 900 1em/1 "Font Awesome 6 Duotone";\n --fa-font-duotone-regular: normal 400 1em/1 "Font Awesome 6 Duotone";\n --fa-font-duotone-light: normal 300 1em/1 "Font Awesome 6 Duotone";\n --fa-font-duotone-thin: normal 100 1em/1 "Font Awesome 6 Duotone";\n --fa-font-brands: normal 400 1em/1 "Font Awesome 6 Brands";\n --fa-font-sharp-solid: normal 900 1em/1 "Font Awesome 6 Sharp";\n --fa-font-sharp-regular: normal 400 1em/1 "Font Awesome 6 Sharp";\n --fa-font-sharp-light: normal 300 1em/1 "Font Awesome 6 Sharp";\n --fa-font-sharp-thin: normal 100 1em/1 "Font Awesome 6 Sharp";\n --fa-font-sharp-duotone-solid: normal 900 1em/1 "Font Awesome 6 Sharp Duotone";\n --fa-font-sharp-duotone-regular: normal 400 1em/1 "Font Awesome 6 Sharp Duotone";\n --fa-font-sharp-duotone-light: normal 300 1em/1 "Font Awesome 6 Sharp Duotone";\n --fa-font-sharp-duotone-thin: normal 100 1em/1 "Font Awesome 6 Sharp Duotone";\n}\n\nsvg:not(:root).svg-inline--fa, svg:not(:host).svg-inline--fa {\n overflow: visible;\n box-sizing: content-box;\n}\n\n.svg-inline--fa {\n display: var(--fa-display, inline-block);\n height: 1em;\n overflow: visible;\n vertical-align: -0.125em;\n}\n.svg-inline--fa.fa-2xs {\n vertical-align: 0.1em;\n}\n.svg-inline--fa.fa-xs {\n vertical-align: 0em;\n}\n.svg-inline--fa.fa-sm {\n vertical-align: -0.0714285705em;\n}\n.svg-inline--fa.fa-lg {\n vertical-align: -0.2em;\n}\n.svg-inline--fa.fa-xl {\n vertical-align: -0.25em;\n}\n.svg-inline--fa.fa-2xl {\n vertical-align: -0.3125em;\n}\n.svg-inline--fa.fa-pull-left {\n margin-right: var(--fa-pull-margin, 0.3em);\n width: auto;\n}\n.svg-inline--fa.fa-pull-right {\n margin-left: var(--fa-pull-margin, 0.3em);\n width: auto;\n}\n.svg-inline--fa.fa-li {\n width: var(--fa-li-width, 2em);\n top: 0.25em;\n}\n.svg-inline--fa.fa-fw {\n width: var(--fa-fw-width, 1.25em);\n}\n\n.fa-layers svg.svg-inline--fa {\n bottom: 0;\n left: 0;\n margin: auto;\n position: absolute;\n right: 0;\n top: 0;\n}\n\n.fa-layers-counter, .fa-layers-text {\n display: inline-block;\n position: absolute;\n text-align: center;\n}\n\n.fa-layers {\n display: inline-block;\n height: 1em;\n position: relative;\n text-align: center;\n vertical-align: -0.125em;\n width: 1em;\n}\n.fa-layers svg.svg-inline--fa {\n transform-origin: center center;\n}\n\n.fa-layers-text {\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n transform-origin: center center;\n}\n\n.fa-layers-counter {\n background-color: var(--fa-counter-background-color, #ff253a);\n border-radius: var(--fa-counter-border-radius, 1em);\n box-sizing: border-box;\n color: var(--fa-inverse, #fff);\n line-height: var(--fa-counter-line-height, 1);\n max-width: var(--fa-counter-max-width, 5em);\n min-width: var(--fa-counter-min-width, 1.5em);\n overflow: hidden;\n padding: var(--fa-counter-padding, 0.25em 0.5em);\n right: var(--fa-right, 0);\n text-overflow: ellipsis;\n top: var(--fa-top, 0);\n transform: scale(var(--fa-counter-scale, 0.25));\n transform-origin: top right;\n}\n\n.fa-layers-bottom-right {\n bottom: var(--fa-bottom, 0);\n right: var(--fa-right, 0);\n top: auto;\n transform: scale(var(--fa-layers-scale, 0.25));\n transform-origin: bottom right;\n}\n\n.fa-layers-bottom-left {\n bottom: var(--fa-bottom, 0);\n left: var(--fa-left, 0);\n right: auto;\n top: auto;\n transform: scale(var(--fa-layers-scale, 0.25));\n transform-origin: bottom left;\n}\n\n.fa-layers-top-right {\n top: var(--fa-top, 0);\n right: var(--fa-right, 0);\n transform: scale(var(--fa-layers-scale, 0.25));\n transform-origin: top right;\n}\n\n.fa-layers-top-left {\n left: var(--fa-left, 0);\n right: auto;\n top: var(--fa-top, 0);\n transform: scale(var(--fa-layers-scale, 0.25));\n transform-origin: top left;\n}\n\n.fa-1x {\n font-size: 1em;\n}\n\n.fa-2x {\n font-size: 2em;\n}\n\n.fa-3x {\n font-size: 3em;\n}\n\n.fa-4x {\n font-size: 4em;\n}\n\n.fa-5x {\n font-size: 5em;\n}\n\n.fa-6x {\n font-size: 6em;\n}\n\n.fa-7x {\n font-size: 7em;\n}\n\n.fa-8x {\n font-size: 8em;\n}\n\n.fa-9x {\n font-size: 9em;\n}\n\n.fa-10x {\n font-size: 10em;\n}\n\n.fa-2xs {\n font-size: 0.625em;\n line-height: 0.1em;\n vertical-align: 0.225em;\n}\n\n.fa-xs {\n font-size: 0.75em;\n line-height: 0.0833333337em;\n vertical-align: 0.125em;\n}\n\n.fa-sm {\n font-size: 0.875em;\n line-height: 0.0714285718em;\n vertical-align: 0.0535714295em;\n}\n\n.fa-lg {\n font-size: 1.25em;\n line-height: 0.05em;\n vertical-align: -0.075em;\n}\n\n.fa-xl {\n font-size: 1.5em;\n line-height: 0.0416666682em;\n vertical-align: -0.125em;\n}\n\n.fa-2xl {\n font-size: 2em;\n line-height: 0.03125em;\n vertical-align: -0.1875em;\n}\n\n.fa-fw {\n text-align: center;\n width: 1.25em;\n}\n\n.fa-ul {\n list-style-type: none;\n margin-left: var(--fa-li-margin, 2.5em);\n padding-left: 0;\n}\n.fa-ul > li {\n position: relative;\n}\n\n.fa-li {\n left: calc(-1 * var(--fa-li-width, 2em));\n position: absolute;\n text-align: center;\n width: var(--fa-li-width, 2em);\n line-height: inherit;\n}\n\n.fa-border {\n border-color: var(--fa-border-color, #eee);\n border-radius: var(--fa-border-radius, 0.1em);\n border-style: var(--fa-border-style, solid);\n border-width: var(--fa-border-width, 0.08em);\n padding: var(--fa-border-padding, 0.2em 0.25em 0.15em);\n}\n\n.fa-pull-left {\n float: left;\n margin-right: var(--fa-pull-margin, 0.3em);\n}\n\n.fa-pull-right {\n float: right;\n margin-left: var(--fa-pull-margin, 0.3em);\n}\n\n.fa-beat {\n animation-name: fa-beat;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, ease-in-out);\n}\n\n.fa-bounce {\n animation-name: fa-bounce;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.28, 0.84, 0.42, 1));\n}\n\n.fa-fade {\n animation-name: fa-fade;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1));\n}\n\n.fa-beat-fade {\n animation-name: fa-beat-fade;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1));\n}\n\n.fa-flip {\n animation-name: fa-flip;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, ease-in-out);\n}\n\n.fa-shake {\n animation-name: fa-shake;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, linear);\n}\n\n.fa-spin {\n animation-name: fa-spin;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 2s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, linear);\n}\n\n.fa-spin-reverse {\n --fa-animation-direction: reverse;\n}\n\n.fa-pulse,\n.fa-spin-pulse {\n animation-name: fa-spin;\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, steps(8));\n}\n\n@media (prefers-reduced-motion: reduce) {\n .fa-beat,\n.fa-bounce,\n.fa-fade,\n.fa-beat-fade,\n.fa-flip,\n.fa-pulse,\n.fa-shake,\n.fa-spin,\n.fa-spin-pulse {\n animation-delay: -1ms;\n animation-duration: 1ms;\n animation-iteration-count: 1;\n transition-delay: 0s;\n transition-duration: 0s;\n }\n}\n@keyframes fa-beat {\n 0%, 90% {\n transform: scale(1);\n }\n 45% {\n transform: scale(var(--fa-beat-scale, 1.25));\n }\n}\n@keyframes fa-bounce {\n 0% {\n transform: scale(1, 1) translateY(0);\n }\n 10% {\n transform: scale(var(--fa-bounce-start-scale-x, 1.1), var(--fa-bounce-start-scale-y, 0.9)) translateY(0);\n }\n 30% {\n transform: scale(var(--fa-bounce-jump-scale-x, 0.9), var(--fa-bounce-jump-scale-y, 1.1)) translateY(var(--fa-bounce-height, -0.5em));\n }\n 50% {\n transform: scale(var(--fa-bounce-land-scale-x, 1.05), var(--fa-bounce-land-scale-y, 0.95)) translateY(0);\n }\n 57% {\n transform: scale(1, 1) translateY(var(--fa-bounce-rebound, -0.125em));\n }\n 64% {\n transform: scale(1, 1) translateY(0);\n }\n 100% {\n transform: scale(1, 1) translateY(0);\n }\n}\n@keyframes fa-fade {\n 50% {\n opacity: var(--fa-fade-opacity, 0.4);\n }\n}\n@keyframes fa-beat-fade {\n 0%, 100% {\n opacity: var(--fa-beat-fade-opacity, 0.4);\n transform: scale(1);\n }\n 50% {\n opacity: 1;\n transform: scale(var(--fa-beat-fade-scale, 1.125));\n }\n}\n@keyframes fa-flip {\n 50% {\n transform: rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), var(--fa-flip-angle, -180deg));\n }\n}\n@keyframes fa-shake {\n 0% {\n transform: rotate(-15deg);\n }\n 4% {\n transform: rotate(15deg);\n }\n 8%, 24% {\n transform: rotate(-18deg);\n }\n 12%, 28% {\n transform: rotate(18deg);\n }\n 16% {\n transform: rotate(-22deg);\n }\n 20% {\n transform: rotate(22deg);\n }\n 32% {\n transform: rotate(-12deg);\n }\n 36% {\n transform: rotate(12deg);\n }\n 40%, 100% {\n transform: rotate(0deg);\n }\n}\n@keyframes fa-spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n.fa-rotate-90 {\n transform: rotate(90deg);\n}\n\n.fa-rotate-180 {\n transform: rotate(180deg);\n}\n\n.fa-rotate-270 {\n transform: rotate(270deg);\n}\n\n.fa-flip-horizontal {\n transform: scale(-1, 1);\n}\n\n.fa-flip-vertical {\n transform: scale(1, -1);\n}\n\n.fa-flip-both,\n.fa-flip-horizontal.fa-flip-vertical {\n transform: scale(-1, -1);\n}\n\n.fa-rotate-by {\n transform: rotate(var(--fa-rotate-angle, 0));\n}\n\n.fa-stack {\n display: inline-block;\n vertical-align: middle;\n height: 2em;\n position: relative;\n width: 2.5em;\n}\n\n.fa-stack-1x,\n.fa-stack-2x {\n bottom: 0;\n left: 0;\n margin: auto;\n position: absolute;\n right: 0;\n top: 0;\n z-index: var(--fa-stack-z-index, auto);\n}\n\n.svg-inline--fa.fa-stack-1x {\n height: 1em;\n width: 1.25em;\n}\n.svg-inline--fa.fa-stack-2x {\n height: 2em;\n width: 2.5em;\n}\n\n.fa-inverse {\n color: var(--fa-inverse, #fff);\n}\n\n.sr-only,\n.fa-sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n}\n\n.sr-only-focusable:not(:focus),\n.fa-sr-only-focusable:not(:focus) {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n}\n\n.svg-inline--fa .fa-primary {\n fill: var(--fa-primary-color, currentColor);\n opacity: var(--fa-primary-opacity, 1);\n}\n\n.svg-inline--fa .fa-secondary {\n fill: var(--fa-secondary-color, currentColor);\n opacity: var(--fa-secondary-opacity, 0.4);\n}\n\n.svg-inline--fa.fa-swap-opacity .fa-primary {\n opacity: var(--fa-secondary-opacity, 0.4);\n}\n\n.svg-inline--fa.fa-swap-opacity .fa-secondary {\n opacity: var(--fa-primary-opacity, 1);\n}\n\n.svg-inline--fa mask .fa-primary,\n.svg-inline--fa mask .fa-secondary {\n fill: black;\n}';if(n!==e||l!==t){const r=new RegExp("\\.".concat(e,"\\-"),"g"),a=new RegExp("\\--".concat(e,"\\-"),"g"),s=new RegExp("\\.".concat(t),"g");o=o.replace(r,".".concat(n,"-")).replace(a,"--".concat(n,"-")).replace(s,".".concat(l))}return o}let Xl=!1;function eo(){zl.autoAddCss&&!Xl&&(function(e){if(!e||!Kn)return;const t=Wn.createElement("style");t.setAttribute("type","text/css"),t.innerHTML=e;const n=Wn.head.childNodes;let l=null;for(let e=n.length-1;e>-1;e--){const t=n[e],o=(t.tagName||"").toUpperCase();["STYLE","LINK"].indexOf(o)>-1&&(l=t)}Wn.head.insertBefore(t,l)}(Jl()),Xl=!0)}var to={mixout:()=>({dom:{css:Jl,insertCss:eo}}),hooks:()=>({beforeDOMElementCreation(){eo()},beforeI2svg(){eo()}})};const no=$n||{};no[bl]||(no[bl]={}),no[bl].styles||(no[bl].styles={}),no[bl].hooks||(no[bl].hooks={}),no[bl].shims||(no[bl].shims=[]);var lo=no[bl];const oo=[],ro=function(){Wn.removeEventListener("DOMContentLoaded",ro),ao=1,oo.map(e=>e())};let ao=!1;function so(e){const{tag:t,attributes:n={},children:l=[]}=e;return"string"==typeof e?Ul(e):"<".concat(t," ").concat(function(e){return Object.keys(e||{}).reduce((t,n)=>t+"".concat(n,'="').concat(Ul(e[n]),'" '),"").trim()}(n),">").concat(l.map(so).join(""),"</").concat(t,">")}function io(e,t,n){if(e&&e[t]&&e[t][n])return{prefix:t,iconName:n,icon:e[t][n]}}Kn&&(ao=(Wn.documentElement.doScroll?/^loaded|^c/:/^loaded|^i|^c/).test(Wn.readyState),ao||Wn.addEventListener("DOMContentLoaded",ro));var co=function(e,t,n,l){var o,r,a,s=Object.keys(e),i=s.length,c=void 0!==l?function(e,t){return function(n,l,o,r){return e.call(t,n,l,o,r)}}(t,l):t;for(void 0===n?(o=1,a=e[s[0]]):(o=0,a=n);o<i;o++)a=c(a,e[r=s[o]],r,e);return a};function uo(e){const t=function(e){const t=[];let n=0;const l=e.length;for(;n<l;){const o=e.charCodeAt(n++);if(o>=55296&&o<=56319&&n<l){const l=e.charCodeAt(n++);56320==(64512&l)?t.push(((1023&o)<<10)+(1023&l)+65536):(t.push(o),n--)}else t.push(o)}return t}(e);return 1===t.length?t[0].toString(16):null}function ho(e){return Object.keys(e).reduce((t,n)=>{const l=e[n];return l.icon?t[l.iconName]=l.icon:t[n]=l,t},{})}function bo(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{skipHooks:l=!1}=n,o=ho(t);"function"!=typeof lo.hooks.addPack||l?lo.styles[e]=Nn(Nn({},lo.styles[e]||{}),o):lo.hooks.addPack(e,ho(t)),"fas"===e&&bo("fa",t)}const{styles:go,shims:po}=lo,fo=Object.keys(Rl),mo=fo.reduce((e,t)=>(e[t]=Object.keys(Rl[t]),e),{});let vo=null,xo={},yo={},Co={},wo={},_o={};const ko=()=>{const e=e=>co(go,(t,n,l)=>(t[l]=co(n,e,{}),t),{});xo=e((e,t,n)=>(t[3]&&(e[t[3]]=n),t[2]&&t[2].filter(e=>"number"==typeof e).forEach(t=>{e[t.toString(16)]=n}),e)),yo=e((e,t,n)=>(e[n]=n,t[2]&&t[2].filter(e=>"string"==typeof e).forEach(t=>{e[t]=n}),e)),_o=e((e,t,n)=>{const l=t[2];return e[n]=n,l.forEach(t=>{e[t]=n}),e});const t="far"in go||zl.autoFetchSvg,n=co(po,(e,n)=>{const l=n[0];let o=n[1];const r=n[2];return"far"!==o||t||(o="fas"),"string"==typeof l&&(e.names[l]={prefix:o,iconName:r}),"number"==typeof l&&(e.unicodes[l.toString(16)]={prefix:o,iconName:r}),e},{names:{},unicodes:{}});Co=n.names,wo=n.unicodes,vo=Io(zl.styleDefault,{family:zl.familyDefault})};var So;function jo(e,t){return(xo[e]||{})[t]}function Bo(e,t){return(_o[e]||{})[t]}function Po(e){return Co[e]||{prefix:null,iconName:null}}function Ro(){return vo}function Io(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{family:n=el}=t,l=Sl[n][e];if(n===tl&&!e)return"fad";const o=Bl[n][e]||Bl[n][l],r=e in lo.styles?e:null;return o||r||null}function To(e){return e.sort().filter((e,t,n)=>n.indexOf(e)===t)}function Eo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{skipLookups:n=!1}=t;let l=null;const o=cl.concat(sl),r=To(e.filter(e=>o.includes(e))),a=To(e.filter(e=>!cl.includes(e))),s=r.filter(e=>(l=e,!Xn.includes(e))),[i=null]=s,c=function(e){let t=el;const n=fo.reduce((e,t)=>(e[t]="".concat(zl.cssPrefix,"-").concat(t),e),{});return nl.forEach(l=>{(e.includes(n[l])||e.some(e=>mo[l].includes(e)))&&(t=l)}),t}(r),u=Nn(Nn({},function(e){let t=[],n=null;return e.forEach(e=>{const l=function(e,t){const n=t.split("-"),l=n[0],o=n.slice(1).join("-");return l!==e||""===o||(r=o,~Fl.indexOf(r))?null:o;var r}(zl.cssPrefix,e);l?n=l:e&&t.push(e)}),{iconName:n,rest:t}}(a)),{},{prefix:Io(i,{family:c})});return Nn(Nn(Nn({},u),function(e){const{values:t,family:n,canonical:l,givenPrefix:o="",styles:r={},config:a={}}=e,s=n===tl,i=t.includes("fa-duotone")||t.includes("fad"),c="duotone"===a.familyDefault,u="fad"===l.prefix||"fa-duotone"===l.prefix;if(!s&&(i||c||u)&&(l.prefix="fad"),(t.includes("fa-brands")||t.includes("fab"))&&(l.prefix="fab"),!l.prefix&&Oo.includes(n)&&(Object.keys(r).find(e=>Mo.includes(e))||a.autoFetchSvg)){const e=ll.get(n).defaultShortPrefixId;l.prefix=e,l.iconName=Bo(l.prefix,l.iconName)||l.iconName}return"fa"!==l.prefix&&"fa"!==o||(l.prefix=Ro()||"fas"),l}({values:e,family:c,styles:go,config:zl,canonical:u,givenPrefix:l})),function(e,t,n){let{prefix:l,iconName:o}=n;if(e||!l||!o)return{prefix:l,iconName:o};const r="fa"===t?Po(o):{},a=Bo(l,o);return o=r.iconName||a||o,l=r.prefix||l,"far"!==l||go.far||!go.fas||zl.autoFetchSvg||(l="fas"),{prefix:l,iconName:o}}(n,l,u))}So=e=>{vo=Io(e.styleDefault,{family:zl.familyDefault})},Gl.push(So),ko();const Oo=nl.filter(e=>e!==el||e!==tl),Mo=Object.keys(il).filter(e=>e!==el).map(e=>Object.keys(il[e])).flat();let Ao=[],Do={};const Lo={},Fo=Object.keys(Lo);function No(e,t){for(var n=arguments.length,l=new Array(n>2?n-2:0),o=2;o<n;o++)l[o-2]=arguments[o];return(Do[e]||[]).forEach(e=>{t=e.apply(null,[t,...l])}),t}function Vo(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),l=1;l<t;l++)n[l-1]=arguments[l];(Do[e]||[]).forEach(e=>{e.apply(null,n)})}function Ho(){const e=arguments[0],t=Array.prototype.slice.call(arguments,1);return Lo[e]?Lo[e].apply(null,t):void 0}function zo(e){"fa"===e.prefix&&(e.prefix="fas");let{iconName:t}=e;const n=e.prefix||Ro();if(t)return t=Bo(n,t)||t,io(Go.definitions,n,t)||io(lo.styles,n,t)}const Go=new class{constructor(){this.definitions={}}add(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];const l=t.reduce(this._pullDefinitions,{});Object.keys(l).forEach(e=>{this.definitions[e]=Nn(Nn({},this.definitions[e]||{}),l[e]),bo(e,l[e]);const t=Rl[el][e];t&&bo(t,l[e]),ko()})}reset(){this.definitions={}}_pullDefinitions(e,t){const n=t.prefix&&t.iconName&&t.icon?{0:t}:t;return Object.keys(n).map(t=>{const{prefix:l,iconName:o,icon:r}=n[t],a=r[2];e[l]||(e[l]={}),a.length>0&&a.forEach(t=>{"string"==typeof t&&(e[l][t]=r)}),e[l][o]=r}),e}},Zo={i2svg:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Kn?(Vo("beforeI2svg",e),Ho("pseudoElements2svg",e),Ho("i2svg",e)):Promise.reject(new Error("Operation requires a DOM of some kind."))},watch:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{autoReplaceSvgRoot:t}=e;var n;!1===zl.autoReplaceSvg&&(zl.autoReplaceSvg=!0),zl.observeMutations=!0,n=()=>{Wo({autoReplaceSvgRoot:t}),Vo("watch",e)},Kn&&(ao?setTimeout(n,0):oo.push(n))}},qo={icon:e=>{if(null===e)return null;if("object"==typeof e&&e.prefix&&e.iconName)return{prefix:e.prefix,iconName:Bo(e.prefix,e.iconName)||e.iconName};if(Array.isArray(e)&&2===e.length){const t=0===e[1].indexOf("fa-")?e[1].slice(3):e[1],n=Io(e[0]);return{prefix:n,iconName:Bo(n,t)||t}}if("string"==typeof e&&(e.indexOf("".concat(zl.cssPrefix,"-"))>-1||e.match(Tl))){const t=Eo(e.split(" "),{skipLookups:!0});return{prefix:t.prefix||Ro(),iconName:Bo(t.prefix,t.iconName)||t.iconName}}if("string"==typeof e){const t=Ro();return{prefix:t,iconName:Bo(t,e)||e}}}},$o={noAuto:()=>{zl.autoReplaceSvg=!1,zl.observeMutations=!1,Vo("noAuto")},config:zl,dom:Zo,parse:qo,library:Go,findIconDefinition:zo,toHtml:so},Wo=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{autoReplaceSvgRoot:t=Wn}=e;(Object.keys(lo.styles).length>0||zl.autoFetchSvg)&&Kn&&zl.autoReplaceSvg&&$o.dom.i2svg({node:t})};function Qo(e,t){return Object.defineProperty(e,"abstract",{get:t}),Object.defineProperty(e,"html",{get:function(){return e.abstract.map(e=>so(e))}}),Object.defineProperty(e,"node",{get:function(){if(!Kn)return;const t=Wn.createElement("div");return t.innerHTML=e.html,t.children}}),e}function Uo(e){const{icons:{main:t,mask:n},prefix:l,iconName:o,transform:r,symbol:a,title:s,maskId:i,titleId:c,extra:u,watchable:d=!1}=e,{width:h,height:b}=n.found?n:t,g=rl.includes(l),p=[zl.replacementClass,o?"".concat(zl.cssPrefix,"-").concat(o):""].filter(e=>-1===u.classes.indexOf(e)).filter(e=>""!==e||!!e).concat(u.classes).join(" ");let f={children:[],attributes:Nn(Nn({},u.attributes),{},{"data-prefix":l,"data-icon":o,class:p,role:u.attributes.role||"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 ".concat(h," ").concat(b)})};const m=g&&!~u.classes.indexOf("fa-fw")?{width:"".concat(h/b*16*.0625,"em")}:{};d&&(f.attributes[fl]=""),s&&(f.children.push({tag:"title",attributes:{id:f.attributes["aria-labelledby"]||"title-".concat(c||$l())},children:[s]}),delete f.attributes.title);const v=Nn(Nn({},f),{},{prefix:l,iconName:o,main:t,mask:n,maskId:i,transform:r,symbol:a,styles:Nn(Nn({},m),u.styles)}),{children:x,attributes:y}=n.found&&t.found?Ho("generateAbstractMask",v)||{children:[],attributes:{}}:Ho("generateAbstractIcon",v)||{children:[],attributes:{}};return v.children=x,v.attributes=y,a?function(e){let{prefix:t,iconName:n,children:l,attributes:o,symbol:r}=e;const a=!0===r?"".concat(t,"-").concat(zl.cssPrefix,"-").concat(n):r;return[{tag:"svg",attributes:{style:"display: none;"},children:[{tag:"symbol",attributes:Nn(Nn({},o),{},{id:a}),children:l}]}]}(v):function(e){let{children:t,main:n,mask:l,attributes:o,styles:r,transform:a}=e;if(Yl(a)&&n.found&&!l.found){const{width:e,height:t}=n,l={x:e/t/2,y:.5};o.style=Kl(Nn(Nn({},r),{},{"transform-origin":"".concat(l.x+a.x/16,"em ").concat(l.y+a.y/16,"em")}))}return[{tag:"svg",attributes:o,children:t}]}(v)}function Ko(e){const{content:t,width:n,height:l,transform:o,title:r,extra:a,watchable:s=!1}=e,i=Nn(Nn(Nn({},a.attributes),r?{title:r}:{}),{},{class:a.classes.join(" ")});s&&(i[fl]="");const c=Nn({},a.styles);Yl(o)&&(c.transform=function(e){let{transform:t,width:n=gl,height:l=gl,startCentered:o=!1}=e,r="";return r+=o&&Yn?"translate(".concat(t.x/Zl-n/2,"em, ").concat(t.y/Zl-l/2,"em) "):o?"translate(calc(-50% + ".concat(t.x/Zl,"em), calc(-50% + ").concat(t.y/Zl,"em)) "):"translate(".concat(t.x/Zl,"em, ").concat(t.y/Zl,"em) "),r+="scale(".concat(t.size/Zl*(t.flipX?-1:1),", ").concat(t.size/Zl*(t.flipY?-1:1),") "),r+="rotate(".concat(t.rotate,"deg) "),r}({transform:o,startCentered:!0,width:n,height:l}),c["-webkit-transform"]=c.transform);const u=Kl(c);u.length>0&&(i.style=u);const d=[];return d.push({tag:"span",attributes:i,children:[t]}),r&&d.push({tag:"span",attributes:{class:"sr-only"},children:[r]}),d}const{styles:Yo}=lo;function Jo(e){const t=e[0],n=e[1],[l]=e.slice(4);let o=null;return o=Array.isArray(l)?{tag:"g",attributes:{class:"".concat(zl.cssPrefix,"-").concat(Al)},children:[{tag:"path",attributes:{class:"".concat(zl.cssPrefix,"-").concat(Ll),fill:"currentColor",d:l[0]}},{tag:"path",attributes:{class:"".concat(zl.cssPrefix,"-").concat(Dl),fill:"currentColor",d:l[1]}}]}:{tag:"path",attributes:{fill:"currentColor",d:l}},{found:!0,width:t,height:n,icon:o}}const Xo={found:!1,width:512,height:512};function er(e,t){let n=t;return"fa"===t&&null!==zl.styleDefault&&(t=Ro()),new Promise((l,o)=>{if("fa"===n){const n=Po(e)||{};e=n.iconName||e,t=n.prefix||t}if(e&&t&&Yo[t]&&Yo[t][e])return l(Jo(Yo[t][e]));!function(e,t){wl||zl.showMissingIcons||!e||console.error('Icon with name "'.concat(e,'" and prefix "').concat(t,'" is missing.'))}(e,t),l(Nn(Nn({},Xo),{},{icon:zl.showMissingIcons&&e&&Ho("missingIconAbstract")||{}}))})}const tr=()=>{},nr=zl.measurePerformance&&Un&&Un.mark&&Un.measure?Un:{mark:tr,measure:tr},lr='FA "6.7.2"';var or=e=>(nr.mark("".concat(lr," ").concat(e," begins")),()=>(e=>{nr.mark("".concat(lr," ").concat(e," ends")),nr.measure("".concat(lr," ").concat(e),"".concat(lr," ").concat(e," begins"),"".concat(lr," ").concat(e," ends"))})(e));const rr=()=>{};function ar(e){return"string"==typeof(e.getAttribute?e.getAttribute(fl):null)}function sr(e){return Wn.createElementNS("http://www.w3.org/2000/svg",e)}function ir(e){return Wn.createElement(e)}function cr(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{ceFn:n=("svg"===e.tag?sr:ir)}=t;if("string"==typeof e)return Wn.createTextNode(e);const l=n(e.tag);return Object.keys(e.attributes||[]).forEach(function(t){l.setAttribute(t,e.attributes[t])}),(e.children||[]).forEach(function(e){l.appendChild(cr(e,{ceFn:n}))}),l}const ur={replace:function(e){const t=e[0];if(t.parentNode)if(e[1].forEach(e=>{t.parentNode.insertBefore(cr(e),t)}),null===t.getAttribute(fl)&&zl.keepOriginalSource){let e=Wn.createComment(function(e){let t=" ".concat(e.outerHTML," ");return t="".concat(t,"Font Awesome fontawesome.com "),t}(t));t.parentNode.replaceChild(e,t)}else t.remove()},nest:function(e){const t=e[0],n=e[1];if(~Ql(t).indexOf(zl.replacementClass))return ur.replace(e);const l=new RegExp("".concat(zl.cssPrefix,"-.*"));if(delete n[0].attributes.id,n[0].attributes.class){const e=n[0].attributes.class.split(" ").reduce((e,t)=>(t===zl.replacementClass||t.match(l)?e.toSvg.push(t):e.toNode.push(t),e),{toNode:[],toSvg:[]});n[0].attributes.class=e.toSvg.join(" "),0===e.toNode.length?t.removeAttribute("class"):t.setAttribute("class",e.toNode.join(" "))}const o=n.map(e=>so(e)).join("\n");t.setAttribute(fl,""),t.innerHTML=o}};function dr(e){e()}function hr(e,t){const n="function"==typeof t?t:rr;if(0===e.length)n();else{let t=dr;"async"===zl.mutateApproach&&(t=$n.requestAnimationFrame||dr),t(()=>{const t=!0===zl.autoReplaceSvg?ur.replace:ur[zl.autoReplaceSvg]||ur.replace,l=or("mutate");e.map(t),l(),n()})}}let br=!1;function gr(){br=!0}function pr(){br=!1}let fr=null;function mr(e){if(!Qn)return;if(!zl.observeMutations)return;const{treeCallback:t=rr,nodeCallback:n=rr,pseudoElementsCallback:l=rr,observeMutationsRoot:o=Wn}=e;fr=new Qn(e=>{if(br)return;const o=Ro();Wl(e).forEach(e=>{if("childList"===e.type&&e.addedNodes.length>0&&!ar(e.addedNodes[0])&&(zl.searchPseudoElements&&l(e.target),t(e.target)),"attributes"===e.type&&e.target.parentNode&&zl.searchPseudoElements&&l(e.target.parentNode),"attributes"===e.type&&ar(e.target)&&~Ml.indexOf(e.attributeName))if("class"===e.attributeName&&function(e){const t=e.getAttribute?e.getAttribute(vl):null,n=e.getAttribute?e.getAttribute(xl):null;return t&&n}(e.target)){const{prefix:t,iconName:n}=Eo(Ql(e.target));e.target.setAttribute(vl,t||o),n&&e.target.setAttribute(xl,n)}else(r=e.target)&&r.classList&&r.classList.contains&&r.classList.contains(zl.replacementClass)&&n(e.target);var r})}),Kn&&fr.observe(o,{childList:!0,attributes:!0,characterData:!0,subtree:!0})}function vr(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{styleParser:!0};const{iconName:n,prefix:l,rest:o}=function(e){const t=e.getAttribute("data-prefix"),n=e.getAttribute("data-icon"),l=void 0!==e.innerText?e.innerText.trim():"";let o=Eo(Ql(e));return o.prefix||(o.prefix=Ro()),t&&n&&(o.prefix=t,o.iconName=n),o.iconName&&o.prefix||(o.prefix&&l.length>0&&(o.iconName=(r=o.prefix,a=e.innerText,(yo[r]||{})[a]||jo(o.prefix,uo(e.innerText)))),!o.iconName&&zl.autoFetchSvg&&e.firstChild&&e.firstChild.nodeType===Node.TEXT_NODE&&(o.iconName=e.firstChild.data)),o;var r,a}(e),r=function(e){const t=Wl(e.attributes).reduce((e,t)=>("class"!==e.name&&"style"!==e.name&&(e[t.name]=t.value),e),{}),n=e.getAttribute("title"),l=e.getAttribute("data-fa-title-id");return zl.autoA11y&&(n?t["aria-labelledby"]="".concat(zl.replacementClass,"-title-").concat(l||$l()):(t["aria-hidden"]="true",t.focusable="false")),t}(e),a=No("parseNodeAttributes",{},e);let s=t.styleParser?function(e){const t=e.getAttribute("style");let n=[];return t&&(n=t.split(";").reduce((e,t)=>{const n=t.split(":"),l=n[0],o=n.slice(1);return l&&o.length>0&&(e[l]=o.join(":").trim()),e},{})),n}(e):[];return Nn({iconName:n,title:e.getAttribute("title"),titleId:e.getAttribute("data-fa-title-id"),prefix:l,transform:ql,mask:{iconName:null,prefix:null,rest:[]},maskId:null,symbol:!1,extra:{classes:o,styles:s,attributes:r}},a)}const{styles:xr}=lo;function yr(e){const t="nest"===zl.autoReplaceSvg?vr(e,{styleParser:!1}):vr(e);return~t.extra.classes.indexOf(El)?Ho("generateLayersText",e,t):Ho("generateSvgReplacementMutation",e,t)}function Cr(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!Kn)return Promise.resolve();const n=Wn.documentElement.classList,l=e=>n.add("".concat(yl,"-").concat(e)),o=e=>n.remove("".concat(yl,"-").concat(e)),r=zl.autoFetchSvg?[...ol,...cl]:Xn.concat(Object.keys(xr));r.includes("fa")||r.push("fa");const a=[".".concat(El,":not([").concat(fl,"])")].concat(r.map(e=>".".concat(e,":not([").concat(fl,"])"))).join(", ");if(0===a.length)return Promise.resolve();let s=[];try{s=Wl(e.querySelectorAll(a))}catch(e){}if(!(s.length>0))return Promise.resolve();l("pending"),o("complete");const i=or("onTree"),c=s.reduce((e,t)=>{try{const n=yr(t);n&&e.push(n)}catch(e){wl||"MissingIcon"===e.name&&console.error(e)}return e},[]);return new Promise((e,n)=>{Promise.all(c).then(n=>{hr(n,()=>{l("active"),l("complete"),o("pending"),"function"==typeof t&&t(),i(),e()})}).catch(e=>{i(),n(e)})})}function wr(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;yr(e).then(e=>{e&&hr([e],t)})}const _r=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{transform:n=ql,symbol:l=!1,mask:o=null,maskId:r=null,title:a=null,titleId:s=null,classes:i=[],attributes:c={},styles:u={}}=t;if(!e)return;const{prefix:d,iconName:h,icon:b}=e;return Qo(Nn({type:"icon"},e),()=>(Vo("beforeDOMElementCreation",{iconDefinition:e,params:t}),zl.autoA11y&&(a?c["aria-labelledby"]="".concat(zl.replacementClass,"-title-").concat(s||$l()):(c["aria-hidden"]="true",c.focusable="false")),Uo({icons:{main:Jo(b),mask:o?Jo(o.icon):{found:!1,width:null,height:null,icon:{}}},prefix:d,iconName:h,transform:Nn(Nn({},ql),n),symbol:l,title:a,maskId:r,titleId:s,extra:{attributes:c,styles:u,classes:i}})))};var kr={mixout(){return{icon:(e=_r,function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const l=(t||{}).icon?t:zo(t||{});let{mask:o}=n;return o&&(o=(o||{}).icon?o:zo(o||{})),e(l,Nn(Nn({},n),{},{mask:o}))})};var e},hooks:()=>({mutationObserverCallbacks:e=>(e.treeCallback=Cr,e.nodeCallback=wr,e)}),provides(e){e.i2svg=function(e){const{node:t=Wn,callback:n=()=>{}}=e;return Cr(t,n)},e.generateSvgReplacementMutation=function(e,t){const{iconName:n,title:l,titleId:o,prefix:r,transform:a,symbol:s,mask:i,maskId:c,extra:u}=t;return new Promise((t,d)=>{Promise.all([er(n,r),i.iconName?er(i.iconName,i.prefix):Promise.resolve({found:!1,width:512,height:512,icon:{}})]).then(i=>{let[d,h]=i;t([e,Uo({icons:{main:d,mask:h},prefix:r,iconName:n,transform:a,symbol:s,maskId:c,title:l,titleId:o,extra:u,watchable:!0})])}).catch(d)})},e.generateAbstractIcon=function(e){let{children:t,attributes:n,main:l,transform:o,styles:r}=e;const a=Kl(r);let s;return a.length>0&&(n.style=a),Yl(o)&&(s=Ho("generateAbstractTransformGrouping",{main:l,transform:o,containerWidth:l.width,iconWidth:l.width})),t.push(s||l.icon),{children:t,attributes:n}}}},Sr={mixout:()=>({layer(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{classes:n=[]}=t;return Qo({type:"layer"},()=>{Vo("beforeDOMElementCreation",{assembler:e,params:t});let l=[];return e(e=>{Array.isArray(e)?e.map(e=>{l=l.concat(e.abstract)}):l=l.concat(e.abstract)}),[{tag:"span",attributes:{class:["".concat(zl.cssPrefix,"-layers"),...n].join(" ")},children:l}]})}})},jr={mixout:()=>({counter(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{title:n=null,classes:l=[],attributes:o={},styles:r={}}=t;return Qo({type:"counter",content:e},()=>(Vo("beforeDOMElementCreation",{content:e,params:t}),function(e){const{content:t,title:n,extra:l}=e,o=Nn(Nn(Nn({},l.attributes),n?{title:n}:{}),{},{class:l.classes.join(" ")}),r=Kl(l.styles);r.length>0&&(o.style=r);const a=[];return a.push({tag:"span",attributes:o,children:[t]}),n&&a.push({tag:"span",attributes:{class:"sr-only"},children:[n]}),a}({content:e.toString(),title:n,extra:{attributes:o,styles:r,classes:["".concat(zl.cssPrefix,"-layers-counter"),...l]}})))}})},Br={mixout:()=>({text(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{transform:n=ql,title:l=null,classes:o=[],attributes:r={},styles:a={}}=t;return Qo({type:"text",content:e},()=>(Vo("beforeDOMElementCreation",{content:e,params:t}),Ko({content:e,transform:Nn(Nn({},ql),n),title:l,extra:{attributes:r,styles:a,classes:["".concat(zl.cssPrefix,"-layers-text"),...o]}})))}}),provides(e){e.generateLayersText=function(e,t){const{title:n,transform:l,extra:o}=t;let r=null,a=null;if(Yn){const t=parseInt(getComputedStyle(e).fontSize,10),n=e.getBoundingClientRect();r=n.width/t,a=n.height/t}return zl.autoA11y&&!n&&(o.attributes["aria-hidden"]="true"),Promise.resolve([e,Ko({content:e.innerHTML,width:r,height:a,transform:l,title:n,extra:o,watchable:!0})])}}};const Pr=new RegExp('"',"ug"),Rr=[1105920,1112319],Ir=Nn(Nn(Nn(Nn({},{FontAwesome:{normal:"fas",400:"fas"}}),{"Font Awesome 6 Free":{900:"fas",400:"far"},"Font Awesome 6 Pro":{900:"fas",400:"far",normal:"far",300:"fal",100:"fat"},"Font Awesome 6 Brands":{400:"fab",normal:"fab"},"Font Awesome 6 Duotone":{900:"fad",400:"fadr",normal:"fadr",300:"fadl",100:"fadt"},"Font Awesome 6 Sharp":{900:"fass",400:"fasr",normal:"fasr",300:"fasl",100:"fast"},"Font Awesome 6 Sharp Duotone":{900:"fasds",400:"fasdr",normal:"fasdr",300:"fasdl",100:"fasdt"}}),{"Font Awesome 5 Free":{900:"fas",400:"far"},"Font Awesome 5 Pro":{900:"fas",400:"far",normal:"far",300:"fal"},"Font Awesome 5 Brands":{400:"fab",normal:"fab"},"Font Awesome 5 Duotone":{900:"fad"}}),{"Font Awesome Kit":{400:"fak",normal:"fak"},"Font Awesome Kit Duotone":{400:"fakd",normal:"fakd"}}),Tr=Object.keys(Ir).reduce((e,t)=>(e[t.toLowerCase()]=Ir[t],e),{}),Er=Object.keys(Tr).reduce((e,t)=>{const n=Tr[t];return e[t]=n[900]||[...Object.entries(n)][0][1],e},{});function Or(e,t){const n="".concat("data-fa-pseudo-element-pending").concat(t.replace(":","-"));return new Promise((l,o)=>{if(null!==e.getAttribute(n))return l();const r=Wl(e.children).filter(e=>e.getAttribute(ml)===t)[0],a=$n.getComputedStyle(e,t),s=a.getPropertyValue("font-family"),i=s.match(Ol),c=a.getPropertyValue("font-weight"),u=a.getPropertyValue("content");if(r&&!i)return e.removeChild(r),l();if(i&&"none"!==u&&""!==u){const u=a.getPropertyValue("content");let d=function(e,t){const n=e.replace(/^['"]|['"]$/g,"").toLowerCase(),l=parseInt(t),o=isNaN(l)?"normal":l;return(Tr[n]||{})[o]||Er[n]}(s,c);const{value:h,isSecondary:b}=function(e){const t=e.replace(Pr,""),n=function(e){const t=e.length;let n,l=e.charCodeAt(0);return l>=55296&&l<=56319&&t>1&&(n=e.charCodeAt(1),n>=56320&&n<=57343)?1024*(l-55296)+n-56320+65536:l}(t),l=n>=Rr[0]&&n<=Rr[1],o=2===t.length&&t[0]===t[1];return{value:uo(o?t[0]:t),isSecondary:l||o}}(u),g=i[0].startsWith("FontAwesome");let p=jo(d,h),f=p;if(g){const e=function(e){const t=wo[e],n=jo("fas",e);return t||(n?{prefix:"fas",iconName:n}:null)||{prefix:null,iconName:null}}(h);e.iconName&&e.prefix&&(p=e.iconName,d=e.prefix)}if(!p||b||r&&r.getAttribute(vl)===d&&r.getAttribute(xl)===f)l();else{e.setAttribute(n,f),r&&e.removeChild(r);const a={iconName:null,title:null,titleId:null,prefix:null,transform:ql,symbol:!1,mask:{iconName:null,prefix:null,rest:[]},maskId:null,extra:{classes:[],styles:{},attributes:{}}},{extra:s}=a;s.attributes[ml]=t,er(p,d).then(o=>{const r=Uo(Nn(Nn({},a),{},{icons:{main:o,mask:{prefix:null,iconName:null,rest:[]}},prefix:d,iconName:f,extra:s,watchable:!0})),i=Wn.createElementNS("http://www.w3.org/2000/svg","svg");"::before"===t?e.insertBefore(i,e.firstChild):e.appendChild(i),i.outerHTML=r.map(e=>so(e)).join("\n"),e.removeAttribute(n),l()}).catch(o)}}else l()})}function Mr(e){return Promise.all([Or(e,"::before"),Or(e,"::after")])}function Ar(e){return!(e.parentNode===document.head||~Cl.indexOf(e.tagName.toUpperCase())||e.getAttribute(ml)||e.parentNode&&"svg"===e.parentNode.tagName)}function Dr(e){if(Kn)return new Promise((t,n)=>{const l=Wl(e.querySelectorAll("*")).filter(Ar).map(Mr),o=or("searchPseudoElements");gr(),Promise.all(l).then(()=>{o(),pr(),t()}).catch(()=>{o(),pr(),n()})})}var Lr={hooks:()=>({mutationObserverCallbacks:e=>(e.pseudoElementsCallback=Dr,e)}),provides(e){e.pseudoElements2svg=function(e){const{node:t=Wn}=e;zl.searchPseudoElements&&Dr(t)}}};let Fr=!1;var Nr={mixout:()=>({dom:{unwatch(){gr(),Fr=!0}}}),hooks:()=>({bootstrap(){mr(No("mutationObserverCallbacks",{}))},noAuto(){fr&&fr.disconnect()},watch(e){const{observeMutationsRoot:t}=e;Fr?pr():mr(No("mutationObserverCallbacks",{observeMutationsRoot:t}))}})};const Vr=e=>e.toLowerCase().split(" ").reduce((e,t)=>{const n=t.toLowerCase().split("-"),l=n[0];let o=n.slice(1).join("-");if(l&&"h"===o)return e.flipX=!0,e;if(l&&"v"===o)return e.flipY=!0,e;if(o=parseFloat(o),isNaN(o))return e;switch(l){case"grow":e.size=e.size+o;break;case"shrink":e.size=e.size-o;break;case"left":e.x=e.x-o;break;case"right":e.x=e.x+o;break;case"up":e.y=e.y-o;break;case"down":e.y=e.y+o;break;case"rotate":e.rotate=e.rotate+o}return e},{size:16,x:0,y:0,flipX:!1,flipY:!1,rotate:0});var Hr={mixout:()=>({parse:{transform:e=>Vr(e)}}),hooks:()=>({parseNodeAttributes(e,t){const n=t.getAttribute("data-fa-transform");return n&&(e.transform=Vr(n)),e}}),provides(e){e.generateAbstractTransformGrouping=function(e){let{main:t,transform:n,containerWidth:l,iconWidth:o}=e;const r={transform:"translate(".concat(l/2," 256)")},a="translate(".concat(32*n.x,", ").concat(32*n.y,") "),s="scale(".concat(n.size/16*(n.flipX?-1:1),", ").concat(n.size/16*(n.flipY?-1:1),") "),i="rotate(".concat(n.rotate," 0 0)"),c={outer:r,inner:{transform:"".concat(a," ").concat(s," ").concat(i)},path:{transform:"translate(".concat(o/2*-1," -256)")}};return{tag:"g",attributes:Nn({},c.outer),children:[{tag:"g",attributes:Nn({},c.inner),children:[{tag:t.icon.tag,children:t.icon.children,attributes:Nn(Nn({},t.icon.attributes),c.path)}]}]}}}};const zr={x:0,y:0,width:"100%",height:"100%"};function Gr(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return e.attributes&&(e.attributes.fill||t)&&(e.attributes.fill="black"),e}var Zr={hooks:()=>({parseNodeAttributes(e,t){const n=t.getAttribute("data-fa-mask"),l=n?Eo(n.split(" ").map(e=>e.trim())):{prefix:null,iconName:null,rest:[]};return l.prefix||(l.prefix=Ro()),e.mask=l,e.maskId=t.getAttribute("data-fa-mask-id"),e}}),provides(e){e.generateAbstractMask=function(e){let{children:t,attributes:n,main:l,mask:o,maskId:r,transform:a}=e;const{width:s,icon:i}=l,{width:c,icon:u}=o,d=function(e){let{transform:t,containerWidth:n,iconWidth:l}=e;const o={transform:"translate(".concat(n/2," 256)")},r="translate(".concat(32*t.x,", ").concat(32*t.y,") "),a="scale(".concat(t.size/16*(t.flipX?-1:1),", ").concat(t.size/16*(t.flipY?-1:1),") "),s="rotate(".concat(t.rotate," 0 0)");return{outer:o,inner:{transform:"".concat(r," ").concat(a," ").concat(s)},path:{transform:"translate(".concat(l/2*-1," -256)")}}}({transform:a,containerWidth:c,iconWidth:s}),h={tag:"rect",attributes:Nn(Nn({},zr),{},{fill:"white"})},b=i.children?{children:i.children.map(Gr)}:{},g={tag:"g",attributes:Nn({},d.inner),children:[Gr(Nn({tag:i.tag,attributes:Nn(Nn({},i.attributes),d.path)},b))]},p={tag:"g",attributes:Nn({},d.outer),children:[g]},f="mask-".concat(r||$l()),m="clip-".concat(r||$l()),v={tag:"mask",attributes:Nn(Nn({},zr),{},{id:f,maskUnits:"userSpaceOnUse",maskContentUnits:"userSpaceOnUse"}),children:[h,p]},x={tag:"defs",children:[{tag:"clipPath",attributes:{id:m},children:(y=u,"g"===y.tag?y.children:[y])},v]};var y;return t.push(x,{tag:"rect",attributes:Nn({fill:"currentColor","clip-path":"url(#".concat(m,")"),mask:"url(#".concat(f,")")},zr)}),{children:t,attributes:n}}}},qr={provides(e){let t=!1;$n.matchMedia&&(t=$n.matchMedia("(prefers-reduced-motion: reduce)").matches),e.missingIconAbstract=function(){const e=[],n={fill:"currentColor"},l={attributeType:"XML",repeatCount:"indefinite",dur:"2s"};e.push({tag:"path",attributes:Nn(Nn({},n),{},{d:"M156.5,447.7l-12.6,29.5c-18.7-9.5-35.9-21.2-51.5-34.9l22.7-22.7C127.6,430.5,141.5,440,156.5,447.7z M40.6,272H8.5 c1.4,21.2,5.4,41.7,11.7,61.1L50,321.2C45.1,305.5,41.8,289,40.6,272z M40.6,240c1.4-18.8,5.2-37,11.1-54.1l-29.5-12.6 C14.7,194.3,10,216.7,8.5,240H40.6z M64.3,156.5c7.8-14.9,17.2-28.8,28.1-41.5L69.7,92.3c-13.7,15.6-25.5,32.8-34.9,51.5 L64.3,156.5z M397,419.6c-13.9,12-29.4,22.3-46.1,30.4l11.9,29.8c20.7-9.9,39.8-22.6,56.9-37.6L397,419.6z M115,92.4 c13.9-12,29.4-22.3,46.1-30.4l-11.9-29.8c-20.7,9.9-39.8,22.6-56.8,37.6L115,92.4z M447.7,355.5c-7.8,14.9-17.2,28.8-28.1,41.5 l22.7,22.7c13.7-15.6,25.5-32.9,34.9-51.5L447.7,355.5z M471.4,272c-1.4,18.8-5.2,37-11.1,54.1l29.5,12.6 c7.5-21.1,12.2-43.5,13.6-66.8H471.4z M321.2,462c-15.7,5-32.2,8.2-49.2,9.4v32.1c21.2-1.4,41.7-5.4,61.1-11.7L321.2,462z M240,471.4c-18.8-1.4-37-5.2-54.1-11.1l-12.6,29.5c21.1,7.5,43.5,12.2,66.8,13.6V471.4z M462,190.8c5,15.7,8.2,32.2,9.4,49.2h32.1 c-1.4-21.2-5.4-41.7-11.7-61.1L462,190.8z M92.4,397c-12-13.9-22.3-29.4-30.4-46.1l-29.8,11.9c9.9,20.7,22.6,39.8,37.6,56.9 L92.4,397z M272,40.6c18.8,1.4,36.9,5.2,54.1,11.1l12.6-29.5C317.7,14.7,295.3,10,272,8.5V40.6z M190.8,50 c15.7-5,32.2-8.2,49.2-9.4V8.5c-21.2,1.4-41.7,5.4-61.1,11.7L190.8,50z M442.3,92.3L419.6,115c12,13.9,22.3,29.4,30.5,46.1 l29.8-11.9C470,128.5,457.3,109.4,442.3,92.3z M397,92.4l22.7-22.7c-15.6-13.7-32.8-25.5-51.5-34.9l-12.6,29.5 C370.4,72.1,384.4,81.5,397,92.4z"})});const o=Nn(Nn({},l),{},{attributeName:"opacity"}),r={tag:"circle",attributes:Nn(Nn({},n),{},{cx:"256",cy:"364",r:"28"}),children:[]};return t||r.children.push({tag:"animate",attributes:Nn(Nn({},l),{},{attributeName:"r",values:"28;14;28;28;14;28;"})},{tag:"animate",attributes:Nn(Nn({},o),{},{values:"1;0;1;1;0;1;"})}),e.push(r),e.push({tag:"path",attributes:Nn(Nn({},n),{},{opacity:"1",d:"M263.7,312h-16c-6.6,0-12-5.4-12-12c0-71,77.4-63.9,77.4-107.8c0-20-17.8-40.2-57.4-40.2c-29.1,0-44.3,9.6-59.2,28.7 c-3.9,5-11.1,6-16.2,2.4l-13.1-9.2c-5.6-3.9-6.9-11.8-2.6-17.2c21.2-27.2,46.4-44.7,91.2-44.7c52.3,0,97.4,29.8,97.4,80.2 c0,67.6-77.4,63.5-77.4,107.8C275.7,306.6,270.3,312,263.7,312z"}),children:t?[]:[{tag:"animate",attributes:Nn(Nn({},o),{},{values:"1;0;0;0;0;1;"})}]}),t||e.push({tag:"path",attributes:Nn(Nn({},n),{},{opacity:"0",d:"M232.5,134.5l7,168c0.3,6.4,5.6,11.5,12,11.5h9c6.4,0,11.7-5.1,12-11.5l7-168c0.3-6.8-5.2-12.5-12-12.5h-23 C237.7,122,232.2,127.7,232.5,134.5z"}),children:[{tag:"animate",attributes:Nn(Nn({},o),{},{values:"0;0;1;1;0;0;"})}]}),{tag:"g",attributes:{class:"missing"},children:e}}}};!function(e,t){let{mixoutsTo:n}=t;Ao=e,Do={},Object.keys(Lo).forEach(e=>{-1===Fo.indexOf(e)&&delete Lo[e]}),Ao.forEach(e=>{const t=e.mixout?e.mixout():{};if(Object.keys(t).forEach(e=>{"function"==typeof t[e]&&(n[e]=t[e]),"object"==typeof t[e]&&Object.keys(t[e]).forEach(l=>{n[e]||(n[e]={}),n[e][l]=t[e][l]})}),e.hooks){const t=e.hooks();Object.keys(t).forEach(e=>{Do[e]||(Do[e]=[]),Do[e].push(t[e])})}e.provides&&e.provides(Lo)})}([to,kr,Sr,jr,Br,Lr,Nr,Hr,Zr,qr,{hooks:()=>({parseNodeAttributes(e,t){const n=t.getAttribute("data-fa-symbol"),l=null!==n&&(""===n||n);return e.symbol=l,e}})}],{mixoutsTo:$o});const $r=$o.parse,Wr=$o.icon;var Qr=n(821),Ur=n.n(Qr);function Kr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);t&&(l=l.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,l)}return n}function Yr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Kr(Object(n),!0).forEach(function(t){Xr(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Kr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Jr(e){return Jr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Jr(e)}function Xr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ea(e){return function(e){if(Array.isArray(e))return ta(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return ta(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ta(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ta(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,l=new Array(t);n<t;n++)l[n]=e[n];return l}function na(e){return t=e,(t-=0)==t?e:(e=e.replace(/[\-_\s]+(.)?/g,function(e,t){return t?t.toUpperCase():""})).substr(0,1).toLowerCase()+e.substr(1);var t}var la=["style"],oa=!1;try{oa=!0}catch(e){}function ra(e){return e&&"object"===Jr(e)&&e.prefix&&e.iconName&&e.icon?e:$r.icon?$r.icon(e):null===e?null:e&&"object"===Jr(e)&&e.prefix&&e.iconName?e:Array.isArray(e)&&2===e.length?{prefix:e[0],iconName:e[1]}:"string"==typeof e?{prefix:"fas",iconName:e}:void 0}function aa(e,t){return Array.isArray(t)&&t.length>0||!Array.isArray(t)&&t?Xr({},e,t):{}}var sa={border:!1,className:"",mask:null,maskId:null,fixedWidth:!1,inverse:!1,flip:!1,icon:null,listItem:!1,pull:null,pulse:!1,rotation:null,size:null,spin:!1,spinPulse:!1,spinReverse:!1,beat:!1,fade:!1,beatFade:!1,bounce:!1,shake:!1,symbol:!1,title:"",titleId:null,transform:null,swapOpacity:!1},ia=d().forwardRef(function(e,t){var n=Yr(Yr({},sa),e),l=n.icon,o=n.mask,r=n.symbol,a=n.className,s=n.title,i=n.titleId,c=n.maskId,u=ra(l),d=aa("classes",[].concat(ea(function(e){var t,n=e.beat,l=e.fade,o=e.beatFade,r=e.bounce,a=e.shake,s=e.flash,i=e.spin,c=e.spinPulse,u=e.spinReverse,d=e.pulse,h=e.fixedWidth,b=e.inverse,g=e.border,p=e.listItem,f=e.flip,m=e.size,v=e.rotation,x=e.pull,y=(Xr(t={"fa-beat":n,"fa-fade":l,"fa-beat-fade":o,"fa-bounce":r,"fa-shake":a,"fa-flash":s,"fa-spin":i,"fa-spin-reverse":u,"fa-spin-pulse":c,"fa-pulse":d,"fa-fw":h,"fa-inverse":b,"fa-border":g,"fa-li":p,"fa-flip":!0===f,"fa-flip-horizontal":"horizontal"===f||"both"===f,"fa-flip-vertical":"vertical"===f||"both"===f},"fa-".concat(m),null!=m),Xr(t,"fa-rotate-".concat(v),null!=v&&0!==v),Xr(t,"fa-pull-".concat(x),null!=x),Xr(t,"fa-swap-opacity",e.swapOpacity),t);return Object.keys(y).map(function(e){return y[e]?e:null}).filter(function(e){return e})}(n)),ea((a||"").split(" ")))),h=aa("transform","string"==typeof n.transform?$r.transform(n.transform):n.transform),b=aa("mask",ra(o)),g=Wr(u,Yr(Yr(Yr(Yr({},d),h),b),{},{symbol:r,title:s,titleId:i,maskId:c}));if(!g)return function(){var e;!oa&&console&&"function"==typeof console.error&&(e=console).error.apply(e,arguments)}("Could not find icon",u),null;var p=g.abstract,f={ref:t};return Object.keys(n).forEach(function(e){sa.hasOwnProperty(e)||(f[e]=n[e])}),ca(p[0],f)});ia.displayName="FontAwesomeIcon",ia.propTypes={beat:Ur().bool,border:Ur().bool,beatFade:Ur().bool,bounce:Ur().bool,className:Ur().string,fade:Ur().bool,flash:Ur().bool,mask:Ur().oneOfType([Ur().object,Ur().array,Ur().string]),maskId:Ur().string,fixedWidth:Ur().bool,inverse:Ur().bool,flip:Ur().oneOf([!0,!1,"horizontal","vertical","both"]),icon:Ur().oneOfType([Ur().object,Ur().array,Ur().string]),listItem:Ur().bool,pull:Ur().oneOf(["right","left"]),pulse:Ur().bool,rotation:Ur().oneOf([0,90,180,270]),shake:Ur().bool,size:Ur().oneOf(["2xs","xs","sm","lg","xl","2xl","1x","2x","3x","4x","5x","6x","7x","8x","9x","10x"]),spin:Ur().bool,spinPulse:Ur().bool,spinReverse:Ur().bool,symbol:Ur().oneOfType([Ur().bool,Ur().string]),title:Ur().string,titleId:Ur().string,transform:Ur().oneOfType([Ur().string,Ur().object]),swapOpacity:Ur().bool};var ca=function e(t,n){var l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if("string"==typeof n)return n;var o=(n.children||[]).map(function(n){return e(t,n)}),r=Object.keys(n.attributes||{}).reduce(function(e,t){var l=n.attributes[t];switch(t){case"class":e.attrs.className=l,delete n.attributes.class;break;case"style":e.attrs.style=l.split(";").map(function(e){return e.trim()}).filter(function(e){return e}).reduce(function(e,t){var n,l=t.indexOf(":"),o=na(t.slice(0,l)),r=t.slice(l+1).trim();return o.startsWith("webkit")?e[(n=o,n.charAt(0).toUpperCase()+n.slice(1))]=r:e[o]=r,e},{});break;default:0===t.indexOf("aria-")||0===t.indexOf("data-")?e.attrs[t.toLowerCase()]=l:e.attrs[na(t)]=l}return e},{attrs:{}}),a=l.style,s=void 0===a?{}:a,i=function(e,t){if(null==e)return{};var n,l,o=function(e,t){if(null==e)return{};var n,l,o={},r=Object.keys(e);for(l=0;l<r.length;l++)n=r[l],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(l=0;l<r.length;l++)n=r[l],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(l,la);return r.attrs.style=Yr(Yr({},r.attrs.style),s),t.apply(void 0,[n.tag,Yr(Yr({},r.attrs),i)].concat(ea(o)))}.bind(null,d().createElement);const ua={prefix:"fas",iconName:"caret-right",icon:[256,512,[],"f0da","M246.6 278.6c12.5-12.5 12.5-32.8 0-45.3l-128-128c-9.2-9.2-22.9-11.9-34.9-6.9s-19.8 16.6-19.8 29.6l0 256c0 12.9 7.8 24.6 19.8 29.6s25.7 2.2 34.9-6.9l128-128z"]},da={prefix:"fas",iconName:"caret-left",icon:[256,512,[],"f0d9","M9.4 278.6c-12.5-12.5-12.5-32.8 0-45.3l128-128c9.2-9.2 22.9-11.9 34.9-6.9s19.8 16.6 19.8 29.6l0 256c0 12.9-7.8 24.6-19.8 29.6s-25.7 2.2-34.9-6.9l-128-128z"]},ha=(0,J.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,J.jsx)("rect",{width:"24",height:"24",fill:"white"}),(0,J.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 6C3 4.34315 4.34315 3 6 3H18C19.6569 3 21 4.34315 21 6V18C21 19.6569 19.6569 21 18 21H6C4.34315 21 3 19.6569 3 18V6ZM10.8867 13.5671C10.6495 13.5035 10.5087 13.2598 10.5723 13.0226L12.3246 6.48302C12.3881 6.24585 12.6319 6.10511 12.8691 6.16866C13.1062 6.23221 13.247 6.47598 13.1834 6.71315L11.4311 13.2527C11.3676 13.4899 11.1238 13.6306 10.8867 13.5671ZM9.2624 12.9295C9.45766 13.1248 9.77424 13.1248 9.96951 12.9295C10.1648 12.7342 10.1648 12.4176 9.96951 12.2224L7.9686 10.2215C7.77333 10.0262 7.77333 9.70963 7.9686 9.51437L9.96951 7.51346C10.1648 7.3182 10.1648 7.00162 9.96951 6.80635C9.77424 6.61109 9.45766 6.61109 9.2624 6.80635L7.26149 8.80726C6.6757 9.39305 6.6757 10.3428 7.26149 10.9286L9.2624 12.9295ZM13.8853 6.8063C14.0805 6.61104 14.3971 6.61104 14.5924 6.8063L16.5933 8.80721C17.1791 9.393 17.1791 10.3427 16.5933 10.9285L14.5924 12.9294C14.3971 13.1247 14.0805 13.1247 13.8853 12.9294C13.69 12.7342 13.69 12.4176 13.8853 12.2223L15.8862 10.2214C16.0814 10.0262 16.0814 9.70958 15.8862 9.51432L13.8853 7.51341C13.69 7.31815 13.69 7.00157 13.8853 6.8063ZM7.478 15.2625H6.838V17.9465H7.478V16.8845H8.492V17.9465H9.138V15.2625H8.492V16.3205H7.478V15.2625ZM9.50056 15.2625V15.8165H10.2886V17.9465H10.9286V15.8165H11.7106V15.2625H9.50056ZM12.9884 15.2625H12.0724V17.9465H12.7124V16.166L13.3464 17.6965H13.7604L14.3624 16.2482V17.9465H15.0064V15.2625H14.1264L13.5574 16.6342L12.9884 15.2625ZM16.3257 17.3865V15.2625H15.6857V17.9465H17.3397V17.3865H16.3257Z",fill:"#671FEB"})]}),ba=(0,J.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,J.jsx)("rect",{width:"24",height:"24",fill:"white"}),(0,J.jsx)("path",{d:"M8.34675 8C8.15525 8 8 8.15525 8 8.34675C8 8.53826 8.15525 8.69351 8.34675 8.69351H11.1362C11.3277 8.69351 11.483 8.53826 11.483 8.34675C11.483 8.15525 11.3277 8 11.1362 8H8.34675Z",fill:"#671FEB"}),(0,J.jsx)("path",{d:"M8 9.73374C8 9.54224 8.15525 9.38699 8.34675 9.38699H11.1362C11.3277 9.38699 11.483 9.54224 11.483 9.73374C11.483 9.92525 11.3277 10.0805 11.1362 10.0805H8.34675C8.15525 10.0805 8 9.92525 8 9.73374Z",fill:"#671FEB"}),(0,J.jsx)("path",{d:"M8.34675 10.774C8.15525 10.774 8 10.9292 8 11.1207C8 11.3122 8.15525 11.4675 8.34675 11.4675H11.1362C11.3277 11.4675 11.483 11.3122 11.483 11.1207C11.483 10.9292 11.3277 10.774 11.1362 10.774H8.34675Z",fill:"#671FEB"}),(0,J.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.04375 15.4838C7.95182 15.6493 8.00927 15.8584 8.17377 15.9534C8.25764 16.0018 8.35329 16.0113 8.43981 15.9875H11.0432C11.1297 16.0113 11.2254 16.0018 11.3092 15.9534C11.4388 15.8786 11.502 15.7328 11.478 15.5934C11.4692 15.528 11.4422 15.4683 11.4022 15.4196L10.0467 13.0717C9.98154 12.9589 9.86272 12.8965 9.74114 12.898C9.6198 12.8967 9.50133 12.9592 9.43633 13.0717L8.06292 15.4505C8.05594 15.4613 8.04954 15.4724 8.04375 15.4838ZM8.95647 15.2926L9.7415 13.9329L10.5265 15.2926H8.95647Z",fill:"#671FEB"}),(0,J.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.478 8H16.0487V11.4674H12.478V8ZM13.078 8.6H15.4487V10.8674H13.078V8.6Z",fill:"#671FEB"}),(0,J.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 6C3 4.34315 4.34315 3 6 3H18C19.6569 3 21 4.34315 21 6V18C21 19.6569 19.6569 21 18 21H6C4.34315 21 3 19.6569 3 18V6ZM7 8C7 7.44772 7.44772 7 8 7H16C16.5523 7 17 7.44772 17 8V12.258C16.7171 12.1048 16.3932 12.0178 16.0489 12.0178C14.9502 12.0178 14.0584 12.9038 14.049 14.0002C12.9524 14.0096 12.0665 14.9014 12.0665 16.0001C12.0665 16.3644 12.1638 16.7059 12.3339 17H8C7.44772 17 7 16.5523 7 16V8ZM16.0489 13.0178C16.4931 13.0178 16.8696 13.3074 17 13.7081C17.0317 13.8056 17.0489 13.9097 17.0489 14.0178V15.0001H18.0309C18.5832 15.0001 19.0309 15.4479 19.0309 16.0001C19.0309 16.5524 18.5832 17.0001 18.0309 17.0001H17.0489V17.9823C17.0489 18.5346 16.6012 18.9823 16.0489 18.9823C15.4966 18.9823 15.0489 18.5346 15.0489 17.9823V17.0001H14.0665L14.0491 17C13.5048 16.9908 13.0665 16.5466 13.0665 16.0001C13.0665 15.4479 13.5142 15.0001 14.0665 15.0001H15.0489V14.0178C15.0489 13.4655 15.4966 13.0178 16.0489 13.0178Z",fill:"#671FEB"})]}),ga=(0,J.jsxs)("svg",{width:"256",height:"256",viewBox:"0 0 256 256",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,J.jsx)("rect",{width:"256",height:"256",fill:"white"}),(0,J.jsxs)("g",{clipPath:"url(#clip0_50_2)",children:[(0,J.jsx)("rect",{x:"30",y:"30",width:"196",height:"39.2",rx:"3.92",fill:"#671FEB"}),(0,J.jsx)("rect",{x:"112.32",y:"108.4",width:"113.68",height:"39.2",rx:"3.92",fill:"#671FEB"}),(0,J.jsx)("rect",{x:"112.32",y:"186.8",width:"113.68",height:"39.2",rx:"3.92",fill:"#671FEB"}),(0,J.jsx)("rect",{x:"30",y:"108.4",width:"39.2",height:"117.6",rx:"3.92",fill:"#671FEB"})]}),(0,J.jsx)("defs",{children:(0,J.jsx)("clipPath",{id:"clip0_50_2",children:(0,J.jsx)("rect",{x:"30",y:"30",width:"196",height:"196",rx:"19.6",fill:"white"})})})]}),pa=(0,J.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,J.jsx)("rect",{width:"24",height:"24",fill:"white"}),(0,J.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 5C3 3.89543 3.89543 3 5 3H19C20.1046 3 21 3.89543 21 5V19C21 20.1046 20.1046 21 19 21H5C3.89543 21 3 20.1046 3 19V5ZM12 5.66844L13.9749 9.95014L18.6574 10.5053L15.1955 13.7067L16.1145 18.3316L12 16.0284L7.88549 18.3316L8.80444 13.7067L5.34259 10.5053L10.025 9.95014L12 5.66844ZM12 8.1066V14.9191L9.29297 16.4386L9.89453 13.4035L7.61328 11.2863L10.6992 10.9269L12 8.1066Z",fill:"#671feb"})]}),fa=pa,ma=(0,J.jsxs)("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,J.jsx)("path",{d:"M8.10256 8C5.83678 8 4 9.83678 4 12.1026V16.6667H42.9744V12.1026C42.9744 9.83678 41.1376 8 38.8718 8H8.10256Z",fill:"#671FEB"}),(0,J.jsx)("path",{d:"M20.9231 17.6923H11.6923V23.8462H20.9231V17.6923Z",fill:"#671FEB"}),(0,J.jsx)("path",{d:"M20.9231 24.8718H11.6923L11.6923 32.0513H20.9231V24.8718Z",fill:"#671FEB"}),(0,J.jsx)("path",{d:"M10.6667 24.8718V32.0513H4V24.8718H10.6667Z",fill:"#671FEB"}),(0,J.jsx)("path",{d:"M4 34.6154V33.077H10.6667V38.7179H8.10256C5.83678 38.7179 4 36.8812 4 34.6154Z",fill:"#671FEB"}),(0,J.jsx)("path",{d:"M20.9231 33.077H11.6923V38.7179H20.9231V33.077Z",fill:"#671FEB"}),(0,J.jsx)("path",{d:"M10.6667 23.8462V17.6923H4V23.8462H10.6667Z",fill:"#671FEB"}),(0,J.jsx)("path",{d:"M32.2051 23.8462H21.9487V17.6923H32.2051V23.8462Z",fill:"#671FEB"}),(0,J.jsx)("path",{d:"M42.9744 23.8462V17.6923H33.2308V23.8462H42.9744Z",fill:"#671FEB"}),(0,J.jsx)("path",{d:"M31.6765 34.5568L30.8068 31.6761H30.7386L29.869 34.5568H31.6765Z",fill:"#671FEB"}),(0,J.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M24 25C22.8954 25 22 25.8954 22 27V40C22 41.1046 22.8954 42 24 42H42C43.1046 42 44 41.1046 44 40V27C44 25.8954 43.1046 25 42 25H24ZM26.2727 38H28.8295L29.3338 36.3295H32.2116L32.7159 38H35.2727L32.392 29.2727H29.1534L26.2727 38ZM38.4826 38V29.2727H36.1133V38H38.4826Z",fill:"#671FEB"})]});var va=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"m9.99609 14v-.2251l.00391.0001v6.225h1.5v-14.5h2.5v14.5h1.5v-14.5h3v-1.5h-8.50391c-2.76142 0-5 2.23858-5 5 0 2.7614 2.23858 5 5 5z"})});const xa=[{name:"core/paragraph",title:"Paragraph",icon:va,isPro:!1},{name:"core/list",title:"List",icon:(0,J.jsx)(Re.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,J.jsx)(Re.Path,{d:"M4 4v1.5h16V4H4zm8 8.5h8V11h-8v1.5zM4 20h16v-1.5H4V20zm4-8c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2z"})}),isPro:!1,demoUrl:"https://tableberg.com/docs/how-to-add-a-list-to-a-table-in-wordpress/"},{name:"tableberg/button",title:"Button",icon:(0,J.jsx)(Re.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,J.jsx)(Re.Path,{d:"M8 12.5h8V11H8v1.5Z M19 6.5H5a2 2 0 0 0-2 2V15a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8.5a2 2 0 0 0-2-2ZM5 8h14a.5.5 0 0 1 .5.5V15a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V8.5A.5.5 0 0 1 5 8Z"})}),isPro:!1,demoUrl:"https://tableberg.com/docs/how-to-add-buttons-to-wordpress-tables/"},{name:"tableberg/image",title:"Image",icon:yn,isPro:!1,demoUrl:"https://tableberg.com/docs/how-to-add-images-to-a-table-in-wordpress/"},{name:"tableberg/styled-list",title:"Styled List",icon:ct,isPro:!0,image:"styled_list_block_1.png",upsellText:"Elevate your lists with customizable icons as bullets for a polished look.",demoUrl:"https://tableberg.com/docs/how-to-add-styled-lists-in-wordpress-tables/"},{name:"tableberg/ribbon",title:"Ribbon",icon:ut,isPro:!0,image:"ribbon_block_1.png",upsellText:"Overlay a decorative ribbon on your table, ideal for highlighting special offers or important notices.",demoUrl:"https://tableberg.com/docs/how-to-add-ribbons-to-wordpress-tables/"},{name:"tableberg/html",title:"Custom Html",icon:ha,isPro:!0,image:"html_block_1.png",upsellText:"Add your own HTML code to create specialized content and integrate custom elements.",demoUrl:"https://tableberg.com/docs/how-to-add-custom-html-to-wordpress-tables/"},{name:"tableberg/icon",title:"Icon",icon:ba,isPro:!0,image:"icon_block_1.png",upsellText:"Add scalable icons to your tables to support text and enhance user engagement.",demoUrl:"https://tableberg.com/docs/how-to-add-icons-to-wordpress-tables/"},{name:"tableberg/star-rating",title:"Star Rating",icon:pa,isPro:!0,image:"star_rating_block_1.png",upsellText:"Add customizable star ratings, perfect for reviews and comparison tables.",demoUrl:"https://tableberg.com/docs/how-to-add-star-rating-in-wordpress/"}],ya=[{name:"empty-cell",title:"Empty Cell",icon:ga,upsellText:"<strong>Empty Cell</strong> is not available in the free version. Please get the PRO add-on to unlock all exclusive features."},{name:"cell-orientation",title:"Cell Orientation",icon:ga,upsellText:"<strong>Cell Orientation</strong> is not available in the free version. Please get the PRO add-on to unlock all exclusive features."},{name:"sticky-top-row",title:"Sticky Top Row",icon:ga,upsellText:"<strong>Sticky Top Row</strong> is not available in the free version. Please get the PRO add-on to unlock all exclusive features."},{name:"sticky-first-col",title:"Sticky First Column",icon:ga,upsellText:"<strong>Sticky First Column</strong> is not available in the free version. Please get the PRO add-on to unlock all exclusive features."},{name:"cell-bg",title:"Individual Cell Background",icon:ga,upsellText:"<strong>Individual Cell Background</strong> is not available in the free version. Please get the PRO add-on to unlock all exclusive features."},{name:"row-bg",title:"Individual Row Background",icon:ga,upsellText:"<strong>Individual Row Background</strong> is not available in the free version. Please get the PRO add-on to unlock all exclusive features."},{name:"row-text",title:"Row Text Color",icon:ga,upsellText:"<strong>Row Text Color</strong> is not available in the free version. Please get the PRO add-on to unlock all exclusive features."},{name:"col-bg",title:"Individual Column Background",icon:ga,upsellText:"<strong>Individual Column Background</strong> is not available in the free version. Please get the PRO add-on to unlock all exclusive features."},{name:"col-border",title:"Individual Column Border",icon:ga,upsellText:"<strong>Individual Column Border</strong> is not available in the free version. Please get the PRO add-on to unlock all exclusive features."},{name:"col-border-radius",title:"Individual Column Border Radius",icon:ga,upsellText:"<strong>Individual Column Border Radius</strong> is not available in the free version. Please get the PRO add-on to unlock all exclusive features."},{name:"row-border",title:"Individual Row Border",icon:ga,upsellText:"<strong>Individual Row Border</strong> is not available in the free version. Please get the PRO add-on to unlock all exclusive features."},{name:"row-border-radius",title:"Individual Row Border Radius",icon:ga,upsellText:"<strong>Individual Row Border Radius</strong> is not available in the free version. Please get the PRO add-on to unlock all exclusive features."},{name:"duplicate-row-col",title:"Duplicate Rows and Columns",icon:ga,upsellText:"<strong>Duplicate Rows and Columns</strong> is not available in the free version. Please get the PRO add-on to unlock all exclusive features."},{name:"move-row-col",title:"Move Rows and Columns",icon:ga,upsellText:"<strong>Move Rows and Columns</strong> is not available in the free version. Please get the PRO add-on to unlock all exclusive features."},{name:"row-only-border",title:"Row Only Border",icon:ga,upsellText:"<strong>Row Only Border</strong> is not available in the free version. Please get the PRO add-on to unlock all exclusive features."},{name:"col-only-border",title:"Column Only Border",icon:ga,upsellText:"<strong>Column Only Border</strong> is not available in the free version. Please get the PRO add-on to unlock all exclusive features."},{name:"search",title:"Search",icon:ga,upsellText:"<strong>Search</strong> is not available in the free version. Please get the PRO add-on to unlock all exclusive features."},{name:"sorting",title:"Sorting",icon:ga,upsellText:"<strong>Sorting</strong> is not available in the free version. Please get the PRO add-on to unlock all exclusive features."},{name:"product-table",title:"Product Table",icon:ga,upsellText:"<strong>Product Table</strong> is not available in the free version. Please get the PRO add-on to unlock all exclusive features."},{name:"ai-table",title:"AI Table",icon:ma,isPro:!0,upsellText:"Generate tables instantly using AI from any content. Simply provide text, URLs, or prompts and let AI create structured tables for you."}],Ca=[{name:"pattern-feature-comparison",title:"Pattern: Products Feature Comparison",upsellText:"",image:"/includes/Patterns/images/pattern-feature-comparison.png"},{name:"pattern-employee-information-table",title:"Pattern: Employee Information Table",upsellText:"",image:"/includes/Patterns/images/pattern-employee-information-table.png"},{name:"pattern-problems-solutions-table",title:"Pattern: Problems &amp; Solutions Table",upsellText:"",image:"/includes/Patterns/images/pattern-problems-solutions-table.png"},{name:"pattern-pros-and-cons-colorful",title:"Pattern: Pros and Cons (Colorful)",upsellText:"",image:"/includes/Patterns/images/pattern-pros-and-cons-colorful.png"},{name:"pattern-pros-and-cons-table-simple",title:"Pattern: Pros and Cons Table (Simple)",upsellText:"",image:"/includes/Patterns/images/pattern-pros-and-cons-table-simple.png"},{name:"pattern-pros-cons-table-with-featured-product",title:"Pattern: Pros &amp; Cons Table with Featured Product",upsellText:"",image:"/includes/Patterns/images/pattern-pros-cons-table-with-featured-product.png"},{name:"pattern-top-products-comparison-table",title:"Pattern: Top Products Comparison Table",upsellText:"",image:"/includes/Patterns/images/pattern-top-products-comparison-table.png"},{name:"pattern-product-comparison-table-versus",title:"Pattern: Product Comparison Table (Versus)",upsellText:"",image:"/includes/Patterns/images/pattern-product-comparison-table-versus.png"},{name:"pattern-pricing-table-with-features-comparison",title:"Pattern: Pricing Table with Features Comparison",upsellText:"",image:"/includes/Patterns/images/pattern-pricing-table-with-features-comparison.png"},{name:"pattern-pricing-table-with-a-highlighted-plan",title:"Pattern: Pricing Table with a highlighted plan",upsellText:"",image:"/includes/Patterns/images/pattern-pricing-table-with-a-highlighted-plan.png"},{name:"pattern-colorful-pricing-table",title:"Pattern: Colorful Pricing Table",upsellText:"",image:"/includes/Patterns/images/pattern-colorful-pricing-table.png"},{name:"pattern-pricing-table-packages",title:"Pattern: Pricing Table (Packages)",upsellText:"",image:"/includes/Patterns/images/pattern-pricing-table-packages.png"},{name:"pattern-single-plan-pricing-table",title:"Pattern: Single Plan Pricing Table",upsellText:"",image:"/includes/Patterns/images/pattern-single-plan-pricing-table.png"},{name:"pattern-pricing-table-with-highlighted-columns",title:"Pattern: Pricing Table With Highlighted Columns",upsellText:"",image:"/includes/Patterns/images/pattern-pricing-table-with-highlighted-columns.png"},{name:"pattern-pricing-table-highlighting-discounts",title:"Pattern: Pricing Table Highlighting Discounts",upsellText:"",image:"/includes/Patterns/images/pattern-pricing-table-highlighting-discounts.png"},{name:"pattern-product-box-with-features-description-and-image",title:"Pattern: Product Box with features, description, and image",upsellText:"",image:"/includes/Patterns/images/pattern-product-box-with-features-description-and-image.png"},{name:"pattern-single-product-box-with-features",title:"Pattern: Single Product Box with features",upsellText:"",image:"/includes/Patterns/images/pattern-single-product-box-with-features.png"},{name:"pattern-minimal-product-box",title:"Pattern: Minimal Product Box",upsellText:"",image:"/includes/Patterns/images/pattern-minimal-product-box.png"},{name:"pattern-products-comparison-side-by-side",title:"Pattern: Products Comparison Side by Side",upsellText:"",image:"/includes/Patterns/images/pattern-products-comparison-side-by-side.png"},{name:"pattern-product-lists-comparison-table",title:"Pattern: Product Lists Comparison Table",upsellText:"",image:"/includes/Patterns/images/pattern-product-lists-comparison-table.png"},{name:"pattern-product-comparison-boxes",title:"Pattern: Product Comparison Boxes",upsellText:"",image:"/includes/Patterns/images/pattern-product-comparison-boxes.png"},{name:"pattern-features-comparison-table",title:"Pattern: Features Comparison Table",upsellText:"",image:"/includes/Patterns/images/pattern-features-comparison-table.png"},{name:"pattern-brand-size-color-guide",title:"Pattern: Brand Size &amp; Color Guide",upsellText:"",image:"/includes/Patterns/images/pattern-brand-size-color-guide.png"},{name:"pattern-horizontal-pricing-table",title:"Pattern: Horizontal Pricing Table",upsellText:"",image:"/includes/Patterns/images/pattern-horizontal-pricing-table.png"},{name:"pattern-group-points-table",title:"Pattern: Group Points Table",upsellText:"",image:"/includes/Patterns/images/pattern-group-points-table.png"}];function wa(){return en().plugin_url||""}function _a({onClose:e,info:t,prev:n,next:l,link:o="https://tableberg.com/pricing/"}){return(0,J.jsxs)("div",{className:"tableberg-upsell-modal",children:[(0,J.jsx)("div",{className:"tableberg-upsell-modal-backdrop",onClick:e}),(0,J.jsxs)("div",{className:"tableberg-upsell-modal-container",children:[!!n&&(0,J.jsx)("button",{className:"tableberg-upsell-modal-prev",onClick:n,children:(0,J.jsx)(ia,{icon:da})}),(0,J.jsxs)("div",{className:"tableberg-upsell-modal-area",children:[(0,J.jsxs)("h2",{children:[t.icon||ga," ",t.title]}),(0,J.jsxs)("div",{className:"tableberg-upsell-modal-content",children:[t.image&&(0,J.jsx)("img",{src:t.image.startsWith("http")?t.image:wa()+"includes/Admin/images/upsell/"+t.image,alt:t.title+" "+(0,i.__)("Demo","tableberg")}),t.upsellText&&(0,J.jsx)(wn.RawHTML,{className:"tableberg-upsell-modal-text",children:t.upsellText}),(0,J.jsxs)("p",{children:[(0,i.__)("Limited Time: Use code","tableberg")," ",(0,J.jsx)("b",{children:"TB20"})," ",(0,i.__)("to get a 20% discount.","tableberg")]})]}),(0,J.jsxs)("div",{className:"tableberg-upsell-modal-footer",children:[(0,J.jsx)("button",{onClick:e,children:(0,i.__)("Cancel","tableberg")}),(0,J.jsx)("a",{href:o,target:"_blank",children:(0,i.__)("Buy PRO","tableberg")})]})]},t.name),!!l&&(0,J.jsx)("button",{className:"tableberg-upsell-modal-next",onClick:l,children:(0,J.jsx)(ia,{icon:ua})})]})]})}function ka({onClose:e,selected:t,link:n="https://tableberg.com/pricing/"}){const[l,o]=(0,u.useState)(0),r=ya[l];return(0,u.useEffect)(()=>{if(t){t=t.replace("-dummy","");const e=ya.findIndex(e=>e.name===t);e>-1&&o(e)}},[t]),(0,J.jsx)(_a,{onClose:e,info:r,prev:()=>o(e=>e>0?e-1:ya.length-1),next:()=>o((l+1)%ya.length),link:n})}function Sa({onClose:e,selected:t}){const n=function(){const e=wa(),t=Ca.map(t=>({...t,image:t.image?`${e}${t.image.substring(1)}`:t.image}));return[...xa.filter(e=>e.isPro),...t]}(),[l,o]=(0,u.useState)(0),r=n[l];return(0,u.useEffect)(()=>{if(t){t=t.replace("-dummy","");const e=n.findIndex(e=>e.name===t);e>-1&&o(e)}},[t]),(0,J.jsx)(_a,{onClose:e,info:r,prev:()=>o(e=>e>0?e-1:n.length-1),next:()=>o((l+1)%n.length)})}const ja=window.ReactDOM;function Ba(e){return(0,J.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...e,children:(0,J.jsxs)("g",{fill:"none",fillRule:"evenodd",children:[(0,J.jsx)("path",{d:"M24 0v24H0V0zM12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035c-.01-.004-.019-.001-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427c-.002-.01-.009-.017-.017-.018m.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093c.012.004.023 0 .029-.008l.004-.014l-.034-.614c-.003-.012-.01-.02-.02-.022m-.715.002a.023.023 0 0 0-.027.006l-.006.014l-.034.614c0 .012.007.02.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01z"}),(0,J.jsx)("path",{fill:"currentColor",d:"M6 8a6 6 0 1 1 12 0h1a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V10a2 2 0 0 1 2-2zm6-4a4 4 0 0 1 4 4H8a4 4 0 0 1 4-4m2 10a2 2 0 0 1-1 1.732V17a1 1 0 1 1-2 0v-1.268A2 2 0 0 1 12 12a2 2 0 0 1 2 2"})]})})}function Pa({children:e,inToolsPanel:t,info:n,selected:l,isEnhanced:o,style:r}){const[a,s]=(0,u.useState)(!1);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)("div",{className:je()({"tableberg-locked-root":!0,"tableberg-locked-root-toolbar":t}),style:r,children:[(0,J.jsx)("div",{className:"tableberg-locked-children",children:e}),(0,J.jsx)("button",{className:"tableberg-lock-overlay",onClick:()=>s(!0),"aria-label":"Unlock with Tableberg Pro",children:(0,J.jsx)("span",{className:"tableberg-lock-container",children:(0,J.jsx)(Ba,{height:"25px",width:"25px"})})})]}),a&&(0,ja.createPortal)(n?(0,J.jsx)(_a,{onClose:()=>s(!1),info:n}):o?(0,J.jsx)(ka,{onClose:()=>s(!1),selected:l}):(0,J.jsx)(Sa,{onClose:()=>s(!1),selected:l}),document.body)]})}function Ra({attributes:e,bindings:t,cellCoords:n,elementIndex:l,allowListTypeSwitch:o=!0,updateAttrs:r,ProListIconSettings:a=null}){const s=tn(),u=ds(e=>e.updateCellElement),d=null!=r?r:e=>u(n,l,{attributes:e}),h=(t,n)=>{d({styles:{...e.styles,[t]:n}})};return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(me.InspectorControls,{children:[(0,J.jsxs)(c.PanelBody,{title:(0,i.__)("List Settings","tableberg"),initialOpen:!0,children:[o&&s&&(0,J.jsx)(c.SelectControl,{label:(0,i.__)("List Type","tableberg"),value:e.listType,options:[{label:(0,i.__)("Basic","tableberg"),value:"basic"},{label:(0,i.__)("Styled","tableberg"),value:"styled"}],onChange:e=>{d({listType:e})}}),o&&!s&&(0,J.jsx)(Pa,{selected:"tableberg/styled-list",children:(0,J.jsx)(c.SelectControl,{label:(0,i.__)("List Type","tableberg"),value:e.listType,options:[{label:(0,i.__)("Basic","tableberg"),value:"basic"},{label:(0,i.__)("Styled","tableberg"),value:"styled"}],onChange:()=>null})}),"basic"===e.listType&&(0,J.jsx)(c.SelectControl,{label:(0,i.__)("List Style","tableberg"),value:e.listStyle,options:[{label:(0,i.__)("Disc","tableberg"),value:"disc"},{label:(0,i.__)("Circle","tableberg"),value:"circle"},{label:(0,i.__)("Square","tableberg"),value:"square"},{label:(0,i.__)("Numbered","tableberg"),value:"decimal"},{label:(0,i.__)("None","tableberg"),value:"none"}],onChange:e=>{d({listStyle:e})}}),(0,J.jsx)(Te,{label:(0,i.__)("Item Spacing","tableberg"),value:e.styles.itemSpacing,onChange:e=>h("itemSpacing",e)})]}),"styled"===e.listType&&a,(0,J.jsx)(c.PanelBody,{title:"Font Size",initialOpen:!0,children:(0,J.jsx)(c.BaseControl,{__nextHasNoMarginBottom:!0,children:(0,J.jsx)(me.FontSizePicker,{value:e.styles.fontSize||void 0,onChange:e=>{e&&h("fontSize",String(e))}})})}),(0,J.jsx)(ps,{elementType:"list",bindings:t})]}),(0,J.jsxs)(me.InspectorControls,{group:"color",children:[(0,J.jsx)(ke,{label:(0,i.__)("Icon Color","tableberg"),value:e.styles.iconColor,onChange:e=>h("iconColor",e),onDeselect:()=>h("iconColor",Ia.styles.iconColor)}),(0,J.jsx)(ke,{label:(0,i.__)("Text Color","tableberg"),value:e.styles.textColor,onChange:e=>h("textColor",e),onDeselect:()=>h("textColor",Ia.styles.textColor)}),(0,J.jsx)(ke,{label:(0,i.__)("Link Color","tableberg"),value:e.styles.linkColor,onChange:e=>h("linkColor",e),onDeselect:()=>h("linkColor",Ia.styles.linkColor)}),(0,J.jsx)(ke,{label:(0,i.__)("Background Color","tableberg"),value:e.styles.backgroundColor,onChange:e=>h("backgroundColor",e),onDeselect:()=>h("backgroundColor",Ia.styles.backgroundColor)})]})]})}const Ia={align:"left",items:[{content:"",indentLevel:0}],listType:"basic",listStyle:"disc",styles:{itemSpacing:"0",iconColor:"",iconSize:"15px",iconSpacing:"var(--wp--preset--spacing--20)",iconTopSpacing:"0px",fontSize:"",textColor:"",linkColor:"",backgroundColor:""}};function Ta({attributes:e,bindings:t,cellCoords:n,elementIndex:l,forcedListType:o,allowListTypeSwitch:r=!0,ProListItemIcon:s=null,ProListIconSettings:d=null}){const h=(0,u.useRef)(null),b=(0,u.useRef)([]),[g,p]=(0,u.useState)(0),f=ds(e=>e.sortPreviewMode),m=ds(e=>e.isElementSelected),v=ds(e=>e.setSelectedElement),x=ds(e=>e.clearSelectedElement),y=Yt(),C=tn(),w=m(n,l),{values:_,isLoading:k}=gs(t);kt({ref:h,onClickOutside:()=>{w&&x()}});const S=at(e,Ia,t,_,(0,i.__)("(No data)","tableberg")),j=ds(e=>e.updateCellElement),B=o?{...S,listType:o}:C||"styled"!==S.listType?S:{...S,listType:"basic"},P=b.current,R=(0,u.useCallback)((e,t)=>{j(n,l,{attributes:{items:e}}),void 0!==t&&setTimeout(()=>{const e=P[t];e&&e.focus()},0)},[n,l,j,P]),I=(0,u.useCallback)((e,t)=>{var n;const l=void 0!==t&&null!==(n=B.items[t]?.indentLevel)&&void 0!==n?n:0,o=null!=e?e:B.items.length,r=[...B.items.slice(0,o),{content:"",indentLevel:l},...B.items.slice(o)];R(r,o)},[B.items,R]),T=(0,u.useCallback)(e=>{if(B.items.length<=1)R([{content:"",indentLevel:0}],0);else{const t=B.items.filter((t,n)=>n!==e);R(t,e>0?e-1:0)}},[B.items,R]),E=(0,u.useCallback)(e=>{var t,n;return 0!==e&&(null!==(t=B.items[e]?.indentLevel)&&void 0!==t?t:0)<=(null!==(n=B.items[e-1]?.indentLevel)&&void 0!==n?n:0)},[B.items]),O=(0,u.useCallback)(e=>{var t;return(null!==(t=B.items[e]?.indentLevel)&&void 0!==t?t:0)>0},[B.items]),M=(0,u.useCallback)(e=>{var t;if(!E(e))return;const o=[...B.items],r=null!==(t=o[e]?.indentLevel)&&void 0!==t?t:0;o[e]={...o[e],indentLevel:r+1},j(n,l,{attributes:{items:o}}),setTimeout(()=>{P[e]?.focus()},0)},[B.items,n,l,j,E,P]),A=(0,u.useCallback)(e=>{var t;if(!O(e))return;const o=[...B.items],r=null!==(t=o[e]?.indentLevel)&&void 0!==t?t:0;o[e]={...o[e],indentLevel:r-1},j(n,l,{attributes:{items:o}}),setTimeout(()=>{P[e]?.focus()},0)},[B.items,n,l,j,O,P]),D=(0,u.useCallback)((e,t)=>{const o=[...B.items];o[e]={...o[e],content:t},j(n,l,{attributes:{items:o}})},[B.items,n,l,j]),L=(0,u.useCallback)((e,t)=>{"Enter"===t.key&&(t.preventDefault(),I(e+1,e)),"Tab"===t.key&&(t.preventDefault(),t.stopPropagation(),t.shiftKey?A(e):M(e)),"Backspace"===t.key&&""===B.items[e].content&&(t.preventDefault(),O(e)?A(e):T(e))},[I,M,A,T,O,B.items]),F={listStyleType:"none",margin:0},N=B.styles.iconSize||"15px",V=`calc(max(0px, (1.5 * ${B.styles.fontSize||"1em"} - ${N}) / 2) + ${B.styles.iconTopSpacing||"0px"})`,H={color:B.styles.iconColor||void 0,width:N,height:N,minWidth:N,flex:"0 0 auto",display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:0,marginTop:V},z={color:B.styles.iconColor||void 0,minWidth:"20px",flex:"0 0 auto",lineHeight:1.5},G={fontSize:B.styles.fontSize||void 0,color:B.styles.textColor||void 0,"--tableberg-list-link-color":B.styles.linkColor||void 0,backgroundColor:B.styles.backgroundColor||void 0,padding:B.styles.backgroundColor?"2px 8px":void 0,borderRadius:B.styles.backgroundColor?"4px":void 0},Z=(e,t,n)=>{const l={...G,...n};return f?(0,J.jsx)(me.RichText.Content,{tagName:"span",style:l,value:e}):(0,J.jsx)(me.RichText,{ref:e=>{P[t]=e},tagName:"span",style:l,placeholder:(0,i.__)("List item","tableberg"),value:e,onChange:e=>D(t,e),onFocus:()=>p(t),onKeyDownCapture:e=>L(t,e)})},q="decimal"===B.listStyle?"ol":"ul",$=e=>e.map(e=>(0,J.jsxs)("li",{children:[Z(e.item.content,e.index),e.children.length>0&&(0,J.jsx)(q,{style:{margin:0},children:$(e.children)})]},e.index)),W=e=>e.map(e=>(0,J.jsxs)("li",{children:[(0,J.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:B.styles.iconSpacing,fontSize:B.styles.fontSize||void 0,lineHeight:1.5,padding:"2px 0",margin:B.styles.itemSpacing?`0 0 ${B.styles.itemSpacing} 0`:"0 0 2px 0"},children:["decimal"!==B.listStyle&&s&&(0,J.jsx)("span",{style:H,children:s}),"decimal"===B.listStyle&&(0,J.jsxs)("span",{style:z,children:[e.index+1,"."]}),Z(e.item.content,e.index,{flex:1})]}),e.children.length>0&&(0,J.jsx)(q,{style:{...F,marginTop:"4px"},children:W(e.children)})]},e.index)),Q=function(e){const t=[],n=[];return e.forEach((e,l)=>{const o={item:e,index:l,children:[]},r=e.indentLevel;for(;n.length>0&&n[n.length-1].level>=r;)n.pop();0===n.length?t.push(o):n[n.length-1].node.children.push(o),n.push({node:o,level:r})}),t}(B.items),U={display:"flex",justifyContent:a(B.align)};return(0,J.jsxs)(J.Fragment,{children:[w&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(me.BlockControls,{children:[(0,J.jsx)(ot,{title:(0,i.__)("Align list","tableberg"),value:B.align,onChange:e=>{"left"!==e&&"center"!==e&&"right"!==e||j(n,l,{attributes:{align:e}})},controlset:"alignment"}),(0,J.jsx)(c.ToolbarButton,{icon:An,label:(0,i.__)("Outdent","tableberg"),onClick:()=>A(g),disabled:!O(g)}),(0,J.jsx)(c.ToolbarButton,{icon:Dn,label:(0,i.__)("Indent","tableberg"),onClick:()=>M(g),disabled:!E(g)}),(0,J.jsx)(It,{cellCoords:n,elementIndex:l})]}),(0,J.jsx)(Kt,{cellCoords:n,elementIndex:l}),(0,J.jsx)(Ra,{attributes:B,bindings:t,cellCoords:n,elementIndex:l,allowListTypeSwitch:r,ProListIconSettings:d})]}),(0,J.jsx)("div",{ref:h,className:"tableberg-list"+(B.styles.linkColor?" tableberg-has-link-color":""),style:U,onClick:e=>{e.stopPropagation(),f||(v(n,l),h.current&&y(h.current,"List","A list element within a Tableberg cell"))},children:k?(0,J.jsx)("p",{style:{margin:0},children:(0,i.__)("Loading...","tableberg")}):"basic"===B.listType?(0,J.jsx)(q,{style:{margin:0,paddingLeft:"20px"},children:$(Q)}):(0,J.jsx)(q,{style:{...F,paddingLeft:0},children:W(Q)})})]})}const Ea=[{path:"styles.iconColor",label:(0,i.__)("Icon Color","tableberg")},{path:"styles.textColor",label:(0,i.__)("Text Color","tableberg")},{path:"styles.linkColor",label:(0,i.__)("Link Color","tableberg")},{path:"styles.backgroundColor",label:(0,i.__)("Background Color","tableberg")},{path:"styles.fontSize",label:(0,i.__)("Font Size","tableberg")}];function Oa(e){switch(e.name){case"text":case"button":return e.attributes.content||"";default:return""}}function Ma(e){switch(e){case"text":return{name:"text",attributes:{...ln}};case"button":return{name:"button",attributes:{...pn}};case"image":return{name:"image",attributes:{...En}};case"list":return{name:"list",attributes:{...Ia}};default:return function(e){var t;return null!==(t=bt(e)?.create())&&void 0!==t?t:null}(e)}}function Aa(e,t,n){return e[pe(t,n)]?.elements||[]}function Da(e){return Object.values(e).some(e=>{const t=e.span?.rowSpan||1,n=e.span?.colSpan||1;return t>1||n>1})}function La(e,t,n,l,o,r){const{headerEnabled:a,footerEnabled:s}=n,i=a?0:-1,c=s?t-1:-1,u=[];for(let n=0;n<t;n++){if(n===i||n===c)continue;const t=Aa(e,n,l);let r,a="";switch(t.length>0&&(a=Oa(t[0])),o){case"number":{const e=a.replace(/[^0-9.-]/g,""),t=parseFloat(e);r=isNaN(t)?0:t;break}case"date":{const e=new Date(a);r=isNaN(e.getTime())?new Date(0):e;break}default:r=a.toLowerCase()}u.push({index:n,value:r})}u.sort(({value:e},{value:t})=>{let n;return n="number"==typeof e&&"number"==typeof t?e-t:e instanceof Date&&t instanceof Date?e.getTime()-t.getTime():String(e).localeCompare(String(t)),"asc"===r?n:-n});const d=[];a&&d.push(0);for(const{index:e}of u)d.push(e);return s&&d.push(t-1),d}function Fa(e){return Object.values(e).some(e=>(e.span?.rowSpan||1)>1)}function Na(e,t,n,l){let o=e;return n&&o--,l&&o--,o<=0||t<=0?1:Math.ceil(o/t)}function Va(e){return JSON.parse(JSON.stringify(e))}function Ha(e){return e?.span||{rowSpan:1,colSpan:1}}function za(e){const t=new Map;return Object.entries(e).forEach(([e,n])=>{t.set(e,Ha(n))}),t}function Ga(e,t){const n=[];return Object.entries(e).forEach(([e,l])=>{if(null==l)return;const o=Number(e);n[o>=t?o+1:o]=l}),n}function Za(e,t){const n=[];return Object.entries(e).forEach(([e,l])=>{if(null==l)return;const o=Number(e);o!==t&&(n[o>t?o-1:o]=l)}),n}function qa(e,t){const n=[];return Object.entries(e).forEach(([e,l])=>{if(null==l)return;const o=Number(e);n[t(o)]=l}),n}function $a(e,t){return t<=0?0:t>=e.rows-1?e.rows-1:t}function Wa(e,t){return t<=0?0:t>=e.cols-1?e.cols-1:t}function Qa(e){return Object.values(e).some(e=>{const t=Ha(e);return t.rowSpan>1||t.colSpan>1})}function Ua(e,t,n,l,o,r){const a=function(e,t){return t<=0?0:t>=e.rows?e.rows:t}(e,o),s=new Set,i={};Object.entries(l).forEach(([e,t])=>{const[n,l]=fe(e),o=Ha(t),r=Va(t);if(n<a&&n+o.rowSpan>a){r.span={rowSpan:o.rowSpan+1,colSpan:o.colSpan};for(let e=l;e<l+o.colSpan;e++)s.add(e);i[pe(n,l)]=r}else n>=a?i[pe(n+1,l)]=r:i[pe(n,l)]=r});for(let t=0;t<e.cols;t++)if(!s.has(t)){const e=pe(a,t);i[e]=r?{elements:[Va(r)]}:{}}return{table:{...e,rows:e.rows+1},rows:Ga(t,a),columns:n.slice(),cells:i}}function Ka(e,t,n,l,o,r){const a=function(e,t){return t<=0?0:t>=e.cols?e.cols:t}(e,o),s=new Set,i={};Object.entries(l).forEach(([e,t])=>{const[n,l]=fe(e),o=Ha(t),r=Va(t);if(l<a&&l+o.colSpan>a){r.span={rowSpan:o.rowSpan,colSpan:o.colSpan+1};for(let e=n;e<n+o.rowSpan;e++)s.add(e);i[pe(n,l)]=r}else l>=a?i[pe(n,l+1)]=r:i[pe(n,l)]=r});for(let t=0;t<e.rows;t++)if(!s.has(t)){const e=pe(t,a);i[e]=r?{elements:[Va(r)]}:{}}return{table:{...e,cols:e.cols+1},rows:t.slice(),columns:Ga(n,a),cells:i}}function Ya(e,t,n){const l={...n};return!t||void 0===t.span&&void 0===t.elements&&void 0===t.styles&&void 0===t.ribbon?(delete l[e],l):(l[e]=t,l)}function Ja(e){return fe(e)[0]}function Xa(e){return fe(e)[1]}function es(e,t){if(0===t.length)return[];const n=new Set(t);return Object.keys(e).filter(e=>n.has(fe(e)[0]))}function ts(e,t){const n=function(e){const t=new Set;return Object.values(e).forEach(e=>{(e.elements||[]).forEach(e=>{Object.values(e.bindings||{}).forEach(e=>{e&&t.add(e)})})}),t}(t),l={};return Object.entries(e).forEach(([e,t])=>{n.has(e)&&(l[e]=t)}),l}const ns=(e,t,n)=>n.headerEnabled&&0===e?"header":n.footerEnabled&&e===t-1?"footer":(n.headerEnabled?e-1:e)%2==0?"odd":"even",ls=({table:e,cells:t,cellDefaults:n})=>{const l=function(e){const t=new Map;return Object.entries(e).forEach(([e,n])=>{n.styles&&t.set(e,n.styles)}),t}(t),o={};return["header","even","odd","footer"].forEach(r=>{const a=[];for(let t=0;t<e.rows;t++)ns(t,e.rows,e)===r&&a.push(t);const s=((e,t,n)=>{if(0===e.length)return;let l,o=!1;for(const r of e){const e=t.get(r),a=e?.backgroundColor?.trim();a&&(o=!0);const s=a||n;if(void 0!==l){if(l!==s)return}else l=s}return l&&o?l:void 0})(es(t,a),l,n.styles.backgroundColor);s&&(o[r]=s)}),o},os=(e,t,n,l,o)=>{if(0===t.length)return e;let r={...e};return t.forEach(e=>{const[t]=fe(e),a=ns(t,n,l),s=o[a];if(!s)return;const i=r[e]||{};r=Ya(e,{...i,styles:{...i.styles||{},backgroundColor:s}},r)}),r};function rs(e){return be((t,n)=>{const l=e||ge,o={...l,selectedCells:[],nativeSelectedCells:[],selectedElement:null,selectedRibbonCell:null,tableEditPreview:null,sortPreviewMode:!1,previewSortColumn:null,previewSortOrder:"asc",currentPage:0,searchTerm:"",showCaption:!!l.table.caption,showRowColumnControls:!0,showDuplicateMoveControls:!0};return{...o,setTable:e=>t({table:e}),setCells:e=>t(t=>({cells:e,bindings:ts(t.bindings,e)})),setCellDefaults:e=>t({cellDefaults:e}),setBindings:e=>t({bindings:e}),updateTable:e=>t(t=>({table:{...t.table,...e}})),updateCellGlobalStyles:e=>t(t=>{const n=Object.keys(e);return{cells:Object.fromEntries(Object.entries(t.cells).map(([e,t])=>{if(!t.styles)return[e,t];const l={...t.styles};return n.forEach(e=>{delete l[e]}),[e,{...t,styles:Object.keys(l).length>0?l:void 0}]})),cellDefaults:{styles:{...t.cellDefaults.styles,...e}}}}),updateCellStyles:(e,n)=>{t(t=>{const l=t.cells[e]||{};return{cells:Ya(e,{...l,styles:{...l.styles||{},...n}},t.cells)}})},getCellStyle:e=>n().cells[e]?.styles,getCellSpan:e=>n().cells[e]?.span||{rowSpan:1,colSpan:1},getCellRibbon:e=>n().cells[e]?.ribbon,setCellRibbon:(e,n)=>{t(t=>{const l=t.cells[e]||{};return{cells:Ya(e,{...l,ribbon:n},t.cells)}})},addElementToCell:(e,n)=>{t(t=>{const l=[...t.cells[e]?.elements||[],n];let o=0;return o=l.length-1,{cells:Ya(e,{...t.cells[e]||{},elements:l},t.cells),selectedElement:{cell:e,elementIndex:o},selectedRibbonCell:null}})},insertElementInCell:(e,n,l)=>{t(t=>{const o=t.cells[e],r=[...t.cells[e]?.elements||[]];if(!o&&0!==n)return t;if(0===r.length&&0===n)return{cells:Ya(e,{...o||{},elements:[l]},t.cells),selectedElement:{cell:e,elementIndex:0},selectedRibbonCell:null};if(0===r.length&&0!==n)return t;const a=Math.max(0,Math.min(n,r.length));return r.splice(a,0,l),{cells:Ya(e,{...o||{},elements:r},t.cells),selectedElement:{cell:e,elementIndex:a},selectedRibbonCell:null}})},reorderElementsInCell:(e,n)=>{t(t=>{const l=t.cells[e];if(!l)return t;const o=[...l.elements||[]];if(o.length!==n.length)return t;const r=new Set;for(const e of n){if(e<0||e>=o.length||r.has(e))return t;r.add(e)}const a=n.map(e=>o[e]);if(!a.some((e,t)=>e!==o[t]))return t;const s=Ya(e,{...l,elements:a},t.cells);let i=t.selectedElement;if(i&&i.cell===e){const t=n.findIndex(e=>e===i?.elementIndex);i=-1===t?null:{cell:e,elementIndex:t}}return{cells:s,selectedElement:i}})},duplicateElementInCell:(e,n)=>{t(t=>{const l=t.cells[e];if(!l)return t;const o=[...l.elements||[]],r=o[n];if(!r)return t;const a=n+1;return o.splice(a,0,Lt(r)),{cells:Ya(e,{...l,elements:o},t.cells),selectedElement:{cell:e,elementIndex:a},selectedRibbonCell:null}})},removeElementFromCell:(e,n)=>{t(t=>{const l=t.cells[e];if(!l)return t;const o=[...l.elements||[]];if(n<0||n>=o.length)return t;o.splice(n,1);const r=Ya(e,{...l,elements:o},t.cells);let a=t.selectedElement;return a&&a.cell===e&&(a.elementIndex===n?a=null:a.elementIndex>n&&(a={cell:a.cell,elementIndex:a.elementIndex-1})),{cells:r,bindings:ts(t.bindings,r),selectedElement:a}})},updateCellElement:(e,n,l)=>{t(t=>{const o=t.cells[e];if(!o)return t;const r=[...o.elements||[]];return n>=r.length?t:(r[n]={...r[n],attributes:{...r[n].attributes,...l.attributes}},{cells:Ya(e,{...o,elements:r},t.cells)})})},updateSelectedElementStyles:e=>{const{selectedElement:l}=n();l&&t(t=>{const n=t.cells[l.cell];if(!n)return t;const o=[...n.elements||[]],r=l.elementIndex;if(r>=o.length)return t;const a=o[r],s=a.attributes.styles||{};return o[r]={...a,attributes:{...a.attributes,styles:{...s,...e}}},{cells:Ya(l.cell,{...n,elements:o},t.cells)}})},updateSelectedElementAttrs:e=>{const{selectedElement:l}=n();l&&t(t=>{const n=t.cells[l.cell];if(!n)return t;const o=[...n.elements||[]],r=l.elementIndex;if(r>=o.length)return t;const a=o[r];return o[r]={...a,attributes:{...a.attributes,...e}},{cells:Ya(l.cell,{...n,elements:o},t.cells)}})},updateSelectedElementBindings:e=>{const{selectedElement:l}=n();l&&t(t=>{const n=t.cells[l.cell];if(!n)return t;const o=[...n.elements||[]],r=l.elementIndex;if(r>=o.length)return t;const a={...o[r],bindings:e};void 0===e&&delete a.bindings,o[r]=a;const s=Ya(l.cell,{...n,elements:o},t.cells);return{cells:s,bindings:ts(t.bindings,s)}})},createBindingDefinition:e=>{const n=`${Math.random().toString(36).slice(2,10)}`;return t(t=>({bindings:{...t.bindings,[n]:e}})),n},updateBindingDefinition:(e,n)=>{t(t=>({bindings:{...t.bindings,[e]:n}}))},removeBindingDefinition:e=>{t(t=>{const n={...t.bindings};return delete n[e],{bindings:n}})},replaceCellElement:(e,n,l)=>{t(t=>{const o=t.cells[e];if(!o)return t;const r=[...o.elements||[]];if(n>=r.length)return t;r[n]=l;const a=Ya(e,{...o,elements:r},t.cells);return{cells:a,bindings:ts(t.bindings,a)}})},setSelectedCells:e=>t(t=>t.selectedCells.length===e.length&&t.selectedCells.every((t,n)=>t===e[n])?t:{selectedCells:e}),setNativeSelectedCells:e=>t(t=>t.nativeSelectedCells.length===e.length&&t.nativeSelectedCells.every((t,n)=>t===e[n])?t:{nativeSelectedCells:e}),setSelectedElement:(e,n)=>{t(t=>t.selectedElement?.cell===e&&t.selectedElement.elementIndex===n?t:{selectedElement:{cell:e,elementIndex:n}})},clearSelectedElement:()=>{t(e=>null===e.selectedElement?e:{selectedElement:null})},isElementSelected:(e,t)=>{const{selectedElement:l}=n();return null!==l&&l.cell===e&&l.elementIndex===t},setSelectedRibbon:e=>{t(t=>t.selectedRibbonCell===e&&null===t.selectedElement?t:{selectedRibbonCell:e,selectedElement:null})},clearSelectedRibbon:()=>{t(e=>null===e.selectedRibbonCell?e:{selectedRibbonCell:null})},isRibbonSelected:e=>{const{selectedRibbonCell:t}=n();return null!==t&&t===e},setTableEditPreview:e=>{t(t=>{const n=t.tableEditPreview;return n?.operation===e?.operation&&n?.target===e?.target&&n?.index===e?.index||null===n&&null===e?t:{tableEditPreview:e}})},clearTableEditPreview:()=>{t(e=>null===e.tableEditPreview?e:{tableEditPreview:null})},addSelectedCells:e=>t(t=>{const n=[...t.selectedCells];for(const t of e){const e=n.indexOf(t);-1===e?n.push(t):n.splice(e,1)}return{selectedCells:n}}),setColumnSortable:(e,n)=>{t(t=>{const l=t.columns.slice();if(void 0===n){if(l[e]){const{sortable:t,...n}=l[e];l[e]=0===Object.keys(n).length?null:n}}else l[e]={...l[e],sortable:n};return{columns:l}})},setColumnWidth:(e,n)=>{t(t=>{const l=t.columns.slice(),o=n?.trim();if(o)l[e]={...l[e],width:o};else if(l[e]){const{width:t,...n}=l[e];0===Object.keys(n).length?delete l[e]:l[e]=n}return{columns:l}})},insertRow:e=>{t(t=>{var n;const l=Math.max(0,Math.min(e,t.table.rows)),o=ls({table:t.table,cells:t.cells,cellDefaults:t.cellDefaults}),r=null!==(n=Ma("text"))&&void 0!==n?n:void 0,a=Ua(t.table,t.rows,t.columns,t.cells,l,r),s=((e,t,n,l)=>{const o=new Set,r=t+1;l[ns(e,r,n)]&&o.add(e);for(let a=e;a<t;a++){const e=a+1,s=ns(a,t,n),i=ns(e,r,n);s!==i&&l[i]&&o.add(e)}return Array.from(o)})(l,t.table.rows,t.table,o),i=os(a.cells,es(a.cells,s),a.table.rows,t.table,o),c=t.selectedCells.length>0?Xa(t.selectedCells[0]):0,u=Math.max(0,Math.min(c,a.table.cols-1));return{table:a.table,rows:a.rows,columns:a.columns,cells:i,selectedCells:[pe(l,u)],selectedElement:null,selectedRibbonCell:null}})},deleteRow:e=>{t(t=>{if(t.table.rows<=1)return t;const n=Math.max(0,Math.min(e,t.table.rows-1)),l=function(e,t,n,l,o){const r=$a(e,o),a=za(l),s={};return Object.entries(l).forEach(([e,t])=>{const[n,l]=fe(e),o=a.get(e)||{rowSpan:1,colSpan:1},i=Va(t);if(n!==r){if(!(n>r))return n<r&&n+o.rowSpan>r?(i.span={rowSpan:o.rowSpan-1,colSpan:o.colSpan},void(s[pe(n,l)]=i)):void(s[pe(n,l)]=i);s[pe(n-1,l)]=i}else o.rowSpan>1&&(i.span={rowSpan:o.rowSpan-1,colSpan:o.colSpan},s[pe(n,l)]=i)}),{table:{...e,rows:e.rows-1},rows:Za(t,r),columns:n.slice(),cells:s}}(t.table,t.rows,t.columns,t.cells,n),o=t.selectedCells.length>0?Xa(t.selectedCells[0]):0,r=Math.max(0,Math.min(o,l.table.cols-1)),a=Math.max(0,Math.min(n,l.table.rows-1));return{table:l.table,rows:l.rows,columns:l.columns,cells:l.cells,bindings:ts(t.bindings,l.cells),selectedCells:[pe(a,r)],selectedElement:null,selectedRibbonCell:null}})},insertColumn:e=>{t(t=>{var n;const l=Math.max(0,Math.min(e,t.table.cols)),o=ls({table:t.table,cells:t.cells,cellDefaults:t.cellDefaults}),r=null!==(n=Ma("text"))&&void 0!==n?n:void 0,a=Ka(t.table,t.rows,t.columns,t.cells,l,r),s=Object.keys(a.cells).filter(e=>Xa(e)===l),i=os(a.cells,s,a.table.rows,t.table,o),c=t.selectedCells.length>0?Ja(t.selectedCells[0]):0,u=Math.max(0,Math.min(c,a.table.rows-1));return{table:a.table,rows:a.rows,columns:a.columns,cells:i,selectedCells:[pe(u,l)],selectedElement:null,selectedRibbonCell:null}})},deleteColumn:e=>{t(t=>{if(t.table.cols<=1)return t;const n=Math.max(0,Math.min(e,t.table.cols-1)),l=function(e,t,n,l,o){const r=Wa(e,o),a=za(l),s={};return Object.entries(l).forEach(([e,t])=>{const[n,l]=fe(e),o=a.get(e)||{rowSpan:1,colSpan:1},i=Va(t);if(l!==r){if(!(l>r))return l<r&&l+o.colSpan>r?(i.span={rowSpan:o.rowSpan,colSpan:o.colSpan-1},void(s[pe(n,l)]=i)):void(s[pe(n,l)]=i);s[pe(n,l-1)]=i}else o.colSpan>1&&(i.span={rowSpan:o.rowSpan,colSpan:o.colSpan-1},s[pe(n,l)]=i)}),{table:{...e,cols:e.cols-1},rows:t.slice(),columns:Za(n,r),cells:s}}(t.table,t.rows,t.columns,t.cells,n),o=t.selectedCells.length>0?Ja(t.selectedCells[0]):0,r=Math.max(0,Math.min(o,l.table.rows-1)),a=Math.max(0,Math.min(n,l.table.cols-1));return{table:l.table,rows:l.rows,columns:l.columns,cells:l.cells,bindings:ts(t.bindings,l.cells),selectedCells:[pe(r,a)],selectedElement:null,selectedRibbonCell:null}})},duplicateRow:e=>{t(t=>{if(Qa(t.cells))return t;const n=Math.max(0,Math.min(e,t.table.rows-1)),l=function(e,t,n,l,o){const r=$a(e,o),a=Ua(e,t,n,l,r+1),s=r+1,i={...a.cells};for(let e=0;e<a.table.cols;e++){const t=l[pe(r,e)],n=pe(s,e);i[n]=t?Va(t):{...i[n],elements:[]}}const c=a.rows.slice();return t[r]&&(c[s]=Va(t[r])),{...a,rows:c,cells:i}}(t.table,t.rows,t.columns,t.cells,n),o=t.selectedCells.length>0?Xa(t.selectedCells[0]):0,r=Math.max(0,Math.min(o,l.table.cols-1));return{table:l.table,rows:l.rows,columns:l.columns,cells:l.cells,selectedCells:[pe(n+1,r)],selectedElement:null,selectedRibbonCell:null}})},duplicateColumn:e=>{t(t=>{if(Qa(t.cells))return t;const n=Math.max(0,Math.min(e,t.table.cols-1)),l=function(e,t,n,l,o){const r=Wa(e,o),a=Ka(e,t,n,l,r+1),s=r+1,i={...a.cells};for(let e=0;e<a.table.rows;e++){const t=l[pe(e,r)],n=pe(e,s);i[n]=t?Va(t):{...i[n],elements:[]}}const c=a.columns.slice();return n[r]&&(c[s]=Va(n[r])),{...a,columns:c,cells:i}}(t.table,t.rows,t.columns,t.cells,n),o=t.selectedCells.length>0?Ja(t.selectedCells[0]):0,r=Math.max(0,Math.min(o,l.table.rows-1));return{table:l.table,rows:l.rows,columns:l.columns,cells:l.cells,selectedCells:[pe(r,n+1)],selectedElement:null,selectedRibbonCell:null}})},moveRow:(e,n)=>{t(t=>{if(Qa(t.cells))return t;if(e<0||e>=t.table.rows||n<0||n>=t.table.rows)return t;const l=function(e,t,n,l,o,r){const a=$a(e,o),s=$a(e,r);if(a===s)return{table:e,rows:t,columns:n,cells:l};const i=e=>e===a?s:a<s&&e>a&&e<=s?e-1:a>s&&e>=s&&e<a?e+1:e,c={};return Object.entries(l).forEach(([e,t])=>{const[n,l]=fe(e);c[pe(i(n),l)]=Va(t)}),{table:{...e},rows:qa(t,i),columns:n.slice(),cells:c}}(t.table,t.rows,t.columns,t.cells,e,n),o=t.selectedCells.length>0?Xa(t.selectedCells[0]):0,r=Math.max(0,Math.min(o,l.table.cols-1));return{table:l.table,rows:l.rows,columns:l.columns,cells:l.cells,selectedCells:[pe(n,r)],selectedElement:null,selectedRibbonCell:null}})},moveColumn:(e,n)=>{t(t=>{if(Qa(t.cells))return t;if(e<0||e>=t.table.cols||n<0||n>=t.table.cols)return t;const l=function(e,t,n,l,o,r){const a=Wa(e,o),s=Wa(e,r);if(a===s)return{table:e,rows:t,columns:n,cells:l};const i=e=>e===a?s:a<s&&e>a&&e<=s?e-1:a>s&&e>=s&&e<a?e+1:e,c={};return Object.entries(l).forEach(([e,t])=>{const[n,l]=fe(e);c[pe(n,i(l))]=Va(t)}),{table:{...e},rows:t.slice(),columns:qa(n,i),cells:c}}(t.table,t.rows,t.columns,t.cells,e,n),o=t.selectedCells.length>0?Ja(t.selectedCells[0]):0,r=Math.max(0,Math.min(o,l.table.rows-1));return{table:l.table,rows:l.rows,columns:l.columns,cells:l.cells,selectedCells:[pe(r,n)],selectedElement:null,selectedRibbonCell:null}})},getColumnConfig:e=>n().columns[e]||void 0,setRowHeight:(e,n)=>{t(t=>{const l=t.rows.slice(),o=n?.trim();if(o)l[e]={...l[e],height:o};else if(l[e]){const{height:t,...n}=l[e];0===Object.keys(n).length?delete l[e]:l[e]=n}return{rows:l}})},getRowConfig:e=>n().rows[e]||void 0,isColumnSortableAllowed:e=>function(e,t){return!Da(t)&&!function(e,t){return Object.entries(t).some(([t,n])=>{const[,l]=t.split(",").map(Number);return l===e&&(n.elements?.length||0)>1})}(e,t)}(e,n().cells),enterSortPreviewMode:()=>{t({sortPreviewMode:!0,previewSortColumn:null,previewSortOrder:"asc",selectedCells:[]})},exitSortPreviewMode:()=>{t({sortPreviewMode:!1,previewSortColumn:null,previewSortOrder:"asc"})},setPreviewSort:(e,n)=>{t(t=>({previewSortColumn:e,previewSortOrder:n||t.previewSortOrder}))},togglePreviewSort:e=>{t(t=>t.previewSortColumn===e?"asc"===t.previewSortOrder?{previewSortOrder:"desc"}:{previewSortColumn:null,previewSortOrder:"asc"}:{previewSortColumn:e,previewSortOrder:"asc"})},getSortedRowIndices:()=>{const{sortPreviewMode:e,previewSortColumn:t,previewSortOrder:l,table:o,columns:r,cells:a}=n();if(!e||null===t)return Array.from({length:o.rows},(e,t)=>t);const s=r[t]?.sortable||"text";return La(a,o.rows,o,t,s,l)},setCurrentPage:e=>{t({currentPage:e})},setPaginationConfig:e=>{t(t=>{const n={...t.table.pagination,...e},l=Na(t.table.rows,n.pageSize,t.table.headerEnabled,t.table.footerEnabled),o=Math.max(0,l-1),r=Math.min(t.currentPage,o);return{table:{...t.table,pagination:n},currentPage:r}})},isPaginationAllowed:()=>!Fa(n().cells),setSearchTerm:e=>{t(t=>({searchTerm:e,currentPage:0}))},setShowCaption:e=>{t(t=>t.showCaption===e?t:{showCaption:e})},toggleRowColumnControls:()=>{t(e=>({showRowColumnControls:!e.showRowColumnControls}))},toggleDuplicateMoveControls:()=>{t(e=>({showDuplicateMoveControls:!e.showDuplicateMoveControls}))},getFilteredRowIndices:()=>{const{searchTerm:e,table:t,cells:l}=n();return t.search?.enabled&&e.trim()?Bt(l,t.rows,t.cols,t,e):Array.from({length:t.rows},(e,t)=>t)},setTableAttrs:e=>t({...e}),getTableAttrs:()=>{const{version:e,isExample:t,table:l,rows:o,columns:r,cells:a,bindings:s,cellDefaults:i}=n();return{version:e,isExample:t,table:l,rows:o,columns:r,cells:a,bindings:s,cellDefaults:i}},setAttrVersion:e=>t(t=>t.version===e?t:{version:e}),reset:()=>t(o)}})}const as=(0,u.createContext)(null),ss={},is=[],cs={};function us({children:e,attributes:t,setAttributes:n,contentSyncDisabled:l=!1}){const o=(0,u.useRef)(null),r=e=>{if(Array.isArray(e))return e;if(!e||"object"!=typeof e)return[];const t=[];for(const[n,l]of Object.entries(e)){const e=Number(n);Number.isInteger(e)&&e>=0&&(t[e]=l)}return t},a=e=>{if(!e)return ge.table;for(const t of Object.keys(ge.table))if(!(t in e))return{...ge.table,...e};return e};var s,i,c,d;return o.current||(o.current=rs((s=t,l?{...s,table:a(s.table),cells:null!==(i=s.cells)&&void 0!==i?i:ss,rows:null!==(c=s.rows)&&void 0!==c?c:is,columns:r(s.columns),bindings:null!==(d=s.bindings)&&void 0!==d?d:cs}:s))),(0,u.useEffect)(()=>{o.current&&o.current.setState(((e,t)=>{var n;if(!l)return e;const{cells:o,rows:s,...i}=e;return{...i,table:(c=a(e.table),u=t.table,!u||c.rows===u.rows&&c.cols===u.cols?c:{...c,rows:u.rows,cols:u.cols}),columns:r(e.columns),bindings:null!==(n=e.bindings)&&void 0!==n?n:cs};var c,u})(t,o.current.getState()))},[t]),(0,u.useEffect)(()=>{if(o.current)return o.current.subscribe(e=>{n(l?{version:e.version,isExample:e.isExample,table:e.table,columns:e.columns,bindings:e.bindings,cellDefaults:e.cellDefaults}:{version:e.version,isExample:e.isExample,table:e.table,rows:e.rows,columns:e.columns,cells:e.cells,bindings:e.bindings,cellDefaults:e.cellDefaults})})},[n,l]),(0,J.jsx)(as.Provider,{value:o.current,children:e})}function ds(e){const t=(0,u.useContext)(as);if(!t)throw new Error("useTableStore must be used within TableStoreProvider");return t(e)}function hs(e,t){var n;if(e)return null!==(n=e.postId)&&void 0!==n?n:t}async function bs(e,t){const n=new URLSearchParams({key:e});return t&&n.append("postId",t.toString()),await ce()({path:`/tableberg/v1/dynamic-data/preview?${n.toString()}`})}function gs(e){const t=ee(),n=ds(e=>e.bindings),l=(0,h.useSelect)(e=>{var t;const n=e(ae.store);return null!==(t=n.getCurrentPostId?.())&&void 0!==t?t:void 0},[]),o=Object.entries(e||{}).reduce((e,[t,l])=>{const o=n[l];return o&&(e[t]=o),e},{}),r=re({queryKey:["dynamicDataBindings",l,o],queryFn:async()=>{if(!e)return{};const t={};return await Promise.all(Object.entries(o).map(async([e,n])=>{try{const a=hs(n,l),s=await bs(n.key,a);var o,r;s.success&&(t[e]=null!==(o=null!==(r=s.value)&&void 0!==r?r:n.fallback)&&void 0!==o?o:null)}catch{}})),t},enabled:Object.keys(o).length>0&&!!l,staleTime:1/0}),a=(0,u.useCallback)(async()=>{e&&await t.invalidateQueries({queryKey:["dynamicDataBindings",l,o]})},[e,l,t,o]);return{values:r.data||{},isLoading:r.isLoading,isCached:Object.keys(r.data||{}).length>0&&!r.isFetching,refreshAll:a}}function ps({elementType:e,bindings:t={},postId:n}){const[l,o]=(0,u.useState)(!1),r=ds(e=>e.bindings),a=ds(e=>e.updateSelectedElementBindings),s=ds(e=>e.createBindingDefinition),d=ds(e=>e.updateBindingDefinition),b=ds(e=>e.removeBindingDefinition),g=(0,h.useSelect)(e=>{var t;if(n)return n;const l=e(ae.store);return null!==(t=l.getCurrentPostId?.())&&void 0!==t?t:void 0},[n]),p=function(e){switch(e){case"text":return sn;case"button":return xn;case"image":return Mn;case"list":return Ea;default:return bt(e)?.bindableAttributes||[]}}(e);if(0===p.length)return;const f=p.filter(e=>e.path in t&&!!r[t[e.path]]),m=p.filter(e=>!(e.path in t));return(0,J.jsxs)(c.PanelBody,{title:(0,i.__)("Dynamic Data","tableberg"),initialOpen:f.length>0,children:[f.map(e=>{const n=t[e.path],l=r[n];return n&&l?(0,J.jsx)(ys,{attribute:e,binding:l,bindableAttributes:p,boundPaths:f.map(e=>e.path),onBindingChange:(l,o)=>{((e,n,l,o)=>{d(l,o);const r={...t};e!==n&&delete r[e],r[n]=l,a(r)})(e.path,l,n,o)},onRemove:()=>((e,n)=>{const l={...t};delete l[e],a(Object.keys(l).length>0?l:void 0),b(n)})(e.path,n),postId:g},e.path):null}),l&&(0,J.jsx)(xs,{unboundAttributes:m,onApply:(e,n)=>{((e,n)=>{const l=s(n),o={...t,[e]:l};a(o)})(e,n),o(!1)},onCancel:()=>o(!1),postId:g}),!l&&m.length>0&&(0,J.jsx)("div",{className:"tableberg-dynamic-data__add",children:(0,J.jsx)(c.Button,{variant:"secondary",onClick:()=>o(!0),children:(0,i.__)("Add Binding","tableberg")})})]})}function fs({selectedPath:e,setSelectedPath:t,pathOptions:n,keyValue:l,setKeyValue:o,customPostId:r,setCustomPostId:a,fallback:s,setFallback:u,submitLabel:d,cancelLabel:h,onCancel:b,showRefresh:g,onRefresh:p,refreshLabel:f,isLoadingKeys:m,hasSuggestions:v,suggestions:x,isSuggestionsOpen:y,setIsSuggestionsOpen:C,fieldInputRef:w,previewValue:_,isDestructiveRemove:k,onRemove:S}){return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(c.SelectControl,{label:(0,i.__)("Attribute","tableberg"),value:e,onChange:t,options:n}),(0,J.jsx)(c.TextControl,{label:(0,i.__)("Post ID (optional)","tableberg"),value:r,onChange:a,placeholder:(0,i.__)("Current post","tableberg"),type:"number",help:(0,i.__)("Leave empty to use the current post","tableberg")}),(0,J.jsxs)("div",{ref:w,className:"tableberg-dynamic-data-row__field-autocomplete",children:[(0,J.jsx)(c.TextControl,{label:(0,i.__)("Field","tableberg"),value:l,onChange:e=>{o(e),C(!0)},onFocus:()=>C(!0),placeholder:(0,i.__)("Search or type field key...","tableberg"),autoComplete:"off"}),y&&!m&&v&&(0,J.jsxs)("div",{className:"tableberg-dynamic-data-row__suggestions",children:[x.postFields.length>0&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("div",{className:"tableberg-dynamic-data-row__suggestions-group",children:(0,i.__)("Post Fields","tableberg")}),x.postFields.map(e=>{var t;return(0,J.jsxs)("button",{type:"button",className:"tableberg-dynamic-data-row__suggestion"+(l===e.key?" is-selected":""),onClick:()=>{o(e.key),C(!1)},children:[(0,J.jsx)("span",{className:"tableberg-dynamic-data-row__suggestion-label",children:null!==(t=e.label)&&void 0!==t?t:e.key}),(0,J.jsx)("span",{className:"tableberg-dynamic-data-row__suggestion-key",children:e.key})]},e.key)})]}),x.metaKeys.length>0&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("div",{className:"tableberg-dynamic-data-row__suggestions-group",children:(0,i.__)("Custom Fields","tableberg")}),x.metaKeys.map(e=>{var t;return(0,J.jsxs)("button",{type:"button",className:"tableberg-dynamic-data-row__suggestion"+(l===e.key?" is-selected":""),onClick:()=>{o(e.key),C(!1)},children:[(0,J.jsx)("span",{className:"tableberg-dynamic-data-row__suggestion-label",children:null!==(t=e.label)&&void 0!==t?t:e.key}),e.label&&(0,J.jsx)("span",{className:"tableberg-dynamic-data-row__suggestion-key",children:e.key})]},e.key)})]})]}),y&&m&&(0,J.jsx)(c.Spinner,{})]}),(0,J.jsx)(c.TextControl,{label:(0,i.__)("Fallback Value","tableberg"),value:s,onChange:u,placeholder:(0,i.__)("Value if field is empty","tableberg")}),null!=_&&(0,J.jsxs)("div",{className:"tableberg-dynamic-data-row__preview",children:[(0,J.jsx)("strong",{children:(0,i.__)("Preview:","tableberg")})," ",(0,J.jsx)("span",{children:String(_)})]}),(0,J.jsxs)("div",{className:"tableberg-dynamic-data-row__actions",children:[g?(0,J.jsx)(c.Button,{variant:"secondary",type:"button",icon:"update",onClick:p,children:f||(0,i.__)("Refresh","tableberg")}):(0,J.jsx)(c.Button,{variant:"primary",type:"submit",disabled:!e||!l,children:d}),S&&(0,J.jsx)(c.Button,{variant:"link",type:"button",isDestructive:k,onClick:S,children:(0,i.__)("Remove","tableberg")}),b&&(0,J.jsx)(c.Button,{variant:"link",type:"button",onClick:b,children:h||(0,i.__)("Cancel","tableberg")})]})]})}function ms({keyValue:e,postId:t}){const[n,l]=(0,u.useState)(!1),o=(0,u.useRef)(null),{data:r=[],isLoading:a}=re({queryKey:["metaKeys",t],queryFn:()=>async function(e){const t=new URLSearchParams;e&&t.append("postId",e.toString());const n=t.toString(),l="/tableberg/v1/dynamic-data/meta-keys"+(n?`?${n}`:"");try{return(await ce()({path:l})).keys}catch{return[]}}(t),staleTime:1/0});(0,u.useEffect)(()=>{const e=e=>{o.current&&!o.current.contains(e.target)&&l(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const s=(0,u.useMemo)(()=>{const t=e.toLowerCase();return{postFields:se.filter(e=>e.key.toLowerCase().includes(t)||e.label&&e.label.toLowerCase().includes(t)),metaKeys:r.filter(e=>e.key.toLowerCase().includes(t)||e.label&&e.label.toLowerCase().includes(t))}},[e,r]);return{fieldInputRef:o,isSuggestionsOpen:n,setIsSuggestionsOpen:l,suggestions:s,hasSuggestions:s.postFields.length>0||s.metaKeys.length>0,isLoadingKeys:a}}function vs(e,t,n){const l={key:e};if(t){const e=parseInt(t,10);!isNaN(e)&&e>0&&(l.postId=e)}return n&&(l.fallback=n),l}function xs({unboundAttributes:e,onApply:t,onCancel:n,postId:l}){const[o,r]=(0,u.useState)(""),[a,s]=(0,u.useState)(""),[c,d]=(0,u.useState)(""),[h,b]=(0,u.useState)(""),g=c?parseInt(c,10)||void 0:l,{fieldInputRef:p,isSuggestionsOpen:f,setIsSuggestionsOpen:m,suggestions:v,hasSuggestions:x,isLoadingKeys:y}=ms({keyValue:a,postId:g});return(0,J.jsx)("div",{className:"tableberg-dynamic-data-row",children:(0,J.jsx)("form",{className:"tableberg-dynamic-data-row__config",onSubmit:e=>{e.preventDefault(),o&&a&&t(o,vs(a,c,h))},children:(0,J.jsx)(fs,{selectedPath:o,setSelectedPath:r,pathOptions:[{value:"",label:(0,i.__)("Select attribute...","tableberg")},...e.map(e=>({value:e.path,label:e.label}))],keyValue:a,setKeyValue:s,customPostId:c,setCustomPostId:d,fallback:h,setFallback:b,submitLabel:(0,i.__)("Apply Binding","tableberg"),cancelLabel:(0,i.__)("Cancel","tableberg"),onCancel:n,isLoadingKeys:y,hasSuggestions:x,suggestions:v,isSuggestionsOpen:f,setIsSuggestionsOpen:m,fieldInputRef:p})})})}function ys({attribute:e,binding:t,bindableAttributes:n,boundPaths:l,onBindingChange:o,onRemove:r,postId:a}){var s,c,d,h;const[b,g]=(0,u.useState)(!1),[p,f]=(0,u.useState)(e.path),[m,v]=(0,u.useState)(t.key),[x,y]=(0,u.useState)(null!==(s=t.postId?.toString())&&void 0!==s?s:""),[C,w]=(0,u.useState)(null!==(c=t.fallback)&&void 0!==c?c:""),_=x?parseInt(x,10)||void 0:a,{fieldInputRef:k,isSuggestionsOpen:S,setIsSuggestionsOpen:j,suggestions:B,hasSuggestions:P,isLoadingKeys:R}=ms({keyValue:m,postId:_}),I=p!==e.path||m!==t.key||x!==(null!==(d=t.postId?.toString())&&void 0!==d?d:"")||C!==(null!==(h=t.fallback)&&void 0!==h?h:""),{data:T,refresh:E}=function(e,t){var n;const l=ee(),o=hs(e,t),r=re({queryKey:["dynamicData",e?.key,o],queryFn:()=>e?bs(e.key,o):null,enabled:!!e&&!!o,staleTime:1/0}),a=(0,u.useCallback)(async()=>{e&&await l.invalidateQueries({queryKey:["dynamicData",e.key,o]})},[e,o,l]);return{data:null!==(n=r.data?.value)&&void 0!==n?n:null,isLoading:r.isLoading,isCached:null!==r.data?.value&&!r.isFetching,refresh:a}}(t,a),O=x?`${t.key} (post #${x})`:t.key;return(0,J.jsxs)("div",{className:"tableberg-dynamic-data-row",children:[(0,J.jsxs)("button",{type:"button",className:"tableberg-dynamic-data-row__header",onClick:()=>g(!b),children:[(0,J.jsx)("span",{className:"tableberg-dynamic-data-row__label",children:e.label}),(0,J.jsx)("span",{className:"tableberg-dynamic-data-row__summary",children:O})]}),b&&(0,J.jsx)("form",{className:"tableberg-dynamic-data-row__config",onSubmit:e=>{e.preventDefault(),m&&o(p,vs(m,x,C))},children:(0,J.jsx)(fs,{selectedPath:p,setSelectedPath:f,pathOptions:n.filter(t=>t.path===e.path||!l.includes(t.path)).map(e=>({value:e.path,label:e.label})),keyValue:m,setKeyValue:v,customPostId:x,setCustomPostId:y,fallback:C,setFallback:w,submitLabel:(0,i.__)("Update","tableberg"),showRefresh:!I,onRefresh:()=>{E()},refreshLabel:(0,i.__)("Refresh","tableberg"),isLoadingKeys:R,hasSuggestions:P,suggestions:B,isSuggestionsOpen:S,setIsSuggestionsOpen:j,fieldInputRef:k,previewValue:T,isDestructiveRemove:!0,onRemove:r})})]})}var Cs=(0,J.jsx)(Re.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,J.jsx)(Re.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M20 12a8 8 0 1 1-16 0 8 8 0 0 1 16 0Zm-1.5 0a6.5 6.5 0 0 1-6.5 6.5v-13a6.5 6.5 0 0 1 6.5 6.5Z"})});function ws(e){return{display:"flex",justifyContent:a(e),textAlign:e}}function _s({align:e,onChange:t}){return(0,J.jsx)(me.BlockControls,{children:(0,J.jsx)(ot,{title:(0,i.__)("Align element","tableberg"),value:e,onChange:e=>{"left"!==e&&"center"!==e&&"right"!==e||t(e)},controlset:"alignment"})})}function ks({elementName:e,attributes:t,setAttributes:n}){const l={name:e,attributes:t};return(0,J.jsx)(me.BlockControls,{group:"other",children:(0,J.jsx)(c.ToolbarDropdownMenu,{icon:Cs,label:(0,i.__)("Element styles","tableberg"),toggleProps:{title:(0,i.__)("Element styles","tableberg"),showTooltip:!0},popoverProps:{placement:"bottom-start"},children:({onClose:e})=>(0,J.jsxs)(c.MenuGroup,{children:[(0,J.jsx)(c.MenuItem,{onClick:()=>{!function(e){zt=Ht(e)}(l),$t(Gt(l)),e()},children:(0,i.__)("Copy styles","tableberg")}),(0,J.jsx)(c.MenuItem,{onClick:()=>{(async()=>{const e=await async function(){return zt?Lt(zt):Zt(await Wt())}();e&&n(qt(l,e).attributes)})(),e()},children:(0,i.__)("Paste styles","tableberg")})]})})})}const Ss="0,0";function js(e){const{bindings:t,...n}=e.current.attributes;return{[Ss]:{elements:[{name:e.current.elementName,attributes:n,...t?{bindings:t}:{}}]}}}function Bs(e,t){const n=e.replace(/^tableberg\//,"");return function(e){const{attributes:l,setAttributes:o,isSelected:r,clientId:a}=e,i=(0,u.useRef)({attributes:l,setAttributes:o,isSelected:r,clientId:a,elementName:n});i.current={attributes:l,setAttributes:o,isSelected:r,clientId:a,elementName:n};const c=(0,u.useMemo)(()=>function(e){const t=()=>(0,h.dispatch)(me.store);return be(()=>({sortPreviewMode:!1,searchTerm:"",table:{search:void 0},cells:js(e),isElementSelected:()=>e.current.isSelected,setSelectedElement:()=>{},clearSelectedElement:()=>{},updateCellElement:(t,n,l)=>{var o;const r={...null!==(o=l.attributes)&&void 0!==o?o:{}};void 0!==l.bindings&&(r.bindings=l.bindings),e.current.setAttributes(r)},updateSelectedElementAttrs:t=>{e.current.setAttributes(t)},updateSelectedElementStyles:t=>{var n;e.current.setAttributes({styles:{...null!==(n=e.current.attributes.styles)&&void 0!==n?n:{},...t}})},updateSelectedElementBindings:t=>{e.current.setAttributes({bindings:t})},removeElementFromCell:()=>{t().removeBlocks([e.current.clientId])},duplicateElementInCell:()=>{(0,h.select)(me.store).getBlockRootClientId(e.current.clientId),t().duplicateBlocks([e.current.clientId])},insertElementInCell:(n,l,o)=>{var r;const a=(0,h.select)(me.store),s=a.getBlockRootClientId(e.current.clientId);if(!s)return;const i=a.getBlockIndex(e.current.clientId),c={...null!==(r=o.attributes)&&void 0!==r?r:{}};o.bindings&&(c.bindings=o.bindings),t().insertBlocks((0,ve.createBlock)(`tableberg/${o.name}`,c),i+1,s)},reorderElementsInCell:()=>{}}))}(i),[]);(0,u.useEffect)(()=>{c.setState({cells:js(i)})},[l,c]);const{bindings:d,...b}=l,g=(0,me.useBlockProps)({style:ws(s({name:n,attributes:b}))}),p=Object.fromEntries(Object.entries(e).filter(([e])=>e.startsWith("Pro")));return(0,J.jsx)(as.Provider,{value:c,children:(0,J.jsx)("div",{...g,children:(0,J.jsx)(t,{...p,attributes:b,bindings:d,cellCoords:"0,0",elementIndex:0})})})}}window.TablebergProHost||(window.TablebergProHost={DynamicDataPanel:ps,ElementDeleteButton:It,ElementOptionsButton:Ut,elementAlignmentToJustifyContent:a,useBlockCardUpdateShim:Yt,useClickOutside:kt,useDynamicDataBindings:gs,useTableStore:ds,ListElement:Ta,listAttrDefaults:Ia,registerNativeElementBlock:function(e){(0,ve.registerBlockType)(e.metadata.name,{...e.metadata,icon:e.icon,edit:Bs(e.metadata.name,e.component),save:()=>null})}});const Ps=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"tableberg/row","title":"Row","category":"design","description":"A row of cells within a Tableberg table.","parent":["tableberg/table"],"supports":{"html":false,"customClassName":false,"reusable":false,"lock":false},"attributes":{"height":{"type":"string"},"backgroundColor":{"type":"string"},"textColor":{"type":"string"},"border":{"type":"object"}},"providesContext":{"tableberg/rowBackgroundColor":"backgroundColor"},"textdomain":"tableberg"}');var Rs=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M21 5c0-1.1-.9-2-2-2H5c-1 0-1.9.8-2 1.8V19.2c.1.9.9 1.7 1.8 1.8H19c1.1 0 2-.9 2-2V5ZM4.5 14V5c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v9h-15Zm4 5.5H5c-.3 0-.5-.2-.5-.5v-3.5h4v4Zm5.5 0h-4v-4h4v4Zm5.5-.5c0 .3-.2.5-.5.5h-3.5v-4h4V19ZM11.2 10h-3V8.5h3v-3h1.5v3h3V10h-3v3h-1.5v-3Z"})}),Is=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M19 3H4.8c-.9.1-1.7.9-1.8 1.8V19.2c.1 1 1 1.8 2 1.8h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2Zm-9 1.5h4v4h-4v-4ZM4.5 5c0-.3.2-.5.5-.5h3.5v4h-4V5Zm15 14c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-9h15v9Zm0-10.5h-4v-4H19c.3 0 .5.2.5.5v3.5Zm-8.3 10h1.5v-3h3V14h-3v-3h-1.5v3h-3v1.5h3v3Z"})}),Ts=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M19 3H4.8c-.9.1-1.7.9-1.8 1.8V19.2c.1 1 1 1.8 2 1.8h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2Zm.5 16c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-9h15v9Zm0-10.5h-15V5c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v3.5Zm-9.6 9.4 2.1-2.1 2.1 2.1 1.1-1.1-2.1-2.1 2.1-2.1-1.1-1.1-2.1 2.1-2.1-2.1-1.1 1.1 2.1 2.1-2.1 2.1 1.1 1.1Z"})}),Es=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2Zm.5 2v6.2h-6.8V4.4h6.2c.3 0 .5.2.5.5ZM5 4.5h6.2v6.8H4.4V5.1c0-.3.2-.5.5-.5ZM4.5 19v-6.2h6.8v6.8H5.1c-.3 0-.5-.2-.5-.5Zm14.5.5h-6.2v-6.8h6.8v6.2c0 .3-.2.5-.5.5Z"})});function Os(e){const t=e.map(()=>[]),n=new Map;let l=0;return e.forEach((e,o)=>{let r=0;for(const a of e){for(;void 0!==t[o][r];)r++;n.set(a.id,{row:o,col:r});for(let e=0;e<a.rowSpan;e++)for(let n=0;n<a.colSpan;n++)t[o+e]&&(t[o+e][r+n]=a.id);r+=a.colSpan,r>l&&(l=r)}for(;void 0!==t[o][r];)r++,r>l&&(l=r)}),{matrix:t,anchors:n,cols:l}}function Ms(e,t){for(const n of e)for(const e of n)if(e.id===t)return e;return null}function As(e,t){var n;const{anchors:l}=Os(e);return null!==(n=l.get(t)?.col)&&void 0!==n?n:null}function Ds(){return(0,ve.createBlock)("tableberg/cell",{},[(0,ve.createBlock)("tableberg/text")])}function Ls(e,t){var n;const l=e.select(me.store),o=(null!==(n=l.getBlock(t)?.innerBlocks)&&void 0!==n?n:[]).filter(e=>"tableberg/row"===e.name);return{rows:o.map(e=>e.innerBlocks.filter(e=>"tableberg/cell"===e.name).map(e=>{var t,n;return{id:e.clientId,rowSpan:null!==(t=e.attributes?.span?.rowSpan)&&void 0!==t?t:1,colSpan:null!==(n=e.attributes?.span?.colSpan)&&void 0!==n?n:1}})),rowBlocks:o}}function Fs(e,t){return{span:{rowSpan:e,colSpan:t}}}function Ns(e,t,n,l,o){const r=t.flat().find(e=>e.id===n);r&&e.dispatch(me.store).updateBlockAttributes(n,Fs(Math.max(1,r.rowSpan+l),Math.max(1,r.colSpan+o)))}function Vs(e,t,n){const{rows:l}=Ls(e,t),o=function(e,t){const{anchors:n,cols:l}=Os(e),o=[];let r=0;for(const l of e)for(const e of l){const l=n.get(e.id);l.row<t&&l.row+e.rowSpan>t&&(o.push(e.id),r+=e.colSpan)}return{growSpans:o,newCellCount:Math.max(0,l-r)}}(l,n),r=e.dispatch(me.store);e.batch(()=>{for(const t of o.growSpans)Ns(e,l,t,1,0);const a=Array.from({length:Math.max(1,o.newCellCount)},Ds);r.insertBlocks((0,ve.createBlock)("tableberg/row",{},a),n,t,!1)})}function Hs(e,t,n){const{rows:l,rowBlocks:o}=Ls(e,t);if(o.length<=1)return;const r=function(e,t){const{matrix:n,anchors:l}=Os(e),o=[],r=[];for(const n of e)for(const e of n){const n=l.get(e.id);n.row<t&&n.row+e.rowSpan>t&&o.push(e.id)}const a=e[t+1];if(a)for(const n of e[t]){const e=l.get(n.id);if(n.rowSpan<=1)continue;let t=0;for(const n of a)l.get(n.id).col<e.col&&t++;r.push({id:n.id,insertIndex:t,rowSpan:n.rowSpan-1,colSpan:n.colSpan})}return{shrinkSpans:o,reanchor:r}}(l,n),a=e.dispatch(me.store),s=o[n].clientId,i=o[n+1]?.clientId;e.batch(()=>{for(const t of r.shrinkSpans)Ns(e,l,t,-1,0);for(const e of r.reanchor){if(!i)break;a.moveBlocksToPosition([e.id],s,i,e.insertIndex),a.updateBlockAttributes(e.id,Fs(e.rowSpan,e.colSpan))}a.removeBlocks([s],!1)})}function zs(e,t,n){const{rows:l,rowBlocks:o}=Ls(e,t),r=function(e,t){const{matrix:n,anchors:l,cols:o}=Os(e),r=[],a=new Set;return e.forEach((e,s)=>{if(t<o){const e=n[s][t];if(void 0!==e){const n=l.get(e);if(n.col<t)return void(n.row===s?(r.push({type:"grow",rowIndex:s,id:e}),a.add(e)):r.push({type:"skip",rowIndex:s}))}}let i=0;for(const n of e)l.get(n.id).col<t&&i++;r.push({type:"insert",rowIndex:s,insertIndex:i})}),r}(l,n),a=e.dispatch(me.store);e.batch(()=>{for(const t of r)"grow"===t.type?Ns(e,l,t.id,0,1):"insert"===t.type&&a.insertBlocks(Ds(),t.insertIndex,o[t.rowIndex].clientId,!1)})}function Gs(e){return tn()?e:{...e,lock:{type:"object",default:{move:!0}}}}const Zs={top:"",right:"",bottom:"",left:""},qs={topLeft:"",topRight:"",bottomRight:"",bottomLeft:""};function $s({clientId:e,proToolbarControls:t=[]}){const n=(0,h.useRegistry)(),l=tn(),[o,r]=(0,u.useState)(null),a=(0,h.useSelect)(t=>{var n;const l=t(me.store),o=l.getBlockRootClientId(e);if(!o)return null;const r=(null!==(n=l.getBlock(o)?.innerBlocks)&&void 0!==n?n:[]).filter(e=>"tableberg/row"===e.name);return{tableClientId:o,rowIndex:l.getBlockIndex(e),rowCount:r.length,hasMergedCells:r.some(e=>{var t;return(null!==(t=e.innerBlocks)&&void 0!==t?t:[]).some(e=>{var t,n;return(null!==(t=e.attributes?.span?.rowSpan)&&void 0!==t?t:1)>1||(null!==(n=e.attributes?.span?.colSpan)&&void 0!==n?n:1)>1})})}},[e]);if(!a)return null;const{tableClientId:s,rowIndex:d}=a,b=[{icon:Rs,title:(0,i.__)("Insert row above","tableberg"),onClick:()=>Vs(n,s,d)},{icon:Is,title:(0,i.__)("Insert row below","tableberg"),onClick:()=>Vs(n,s,d+1)},{icon:Ts,title:(0,i.__)("Delete row","tableberg"),onClick:()=>Hs(n,s,d)},...t.filter(e=>!e.isAvailable||e.isAvailable(a)).map(e=>({icon:e.icon,title:e.title,onClick:()=>e.onClick({registry:n,tableClientId:s,rowIndex:d})})),...0!==t.length||l?[]:[{icon:Is,title:(0,i.__)("Duplicate row (Pro)","tableberg"),onClick:()=>r("duplicate-row-col")}]];return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(me.BlockControls,{group:"block",children:(0,J.jsx)(c.ToolbarDropdownMenu,{icon:Es,label:(0,i.__)("Edit row","tableberg"),controls:b})}),o&&(0,J.jsx)(ka,{onClose:()=>r(null),selected:o})]})}var Ws=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1 .8 1.9 1.8 2H19.2c.9-.1 1.7-.9 1.8-1.8V5c0-1.1-.9-2-2-2Zm-5 16.5H5c-.3 0-.5-.2-.5-.5V5c0-.3.2-.5.5-.5h9v15Zm5.5-.5c0 .3-.2.5-.5.5h-3.5v-4h4V19Zm0-5h-4v-4h4v4Zm0-5.5h-4v-4H19c.3 0 .5.2.5.5v3.5Zm-11 7.3H10v-3h3v-1.5h-3v-3H8.5v3h-3v1.5h3v3Z"})}),Qs=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14.2c.1.9.9 1.7 1.8 1.8H19.2c1-.1 1.8-1 1.8-2V5c0-1.1-.9-2-2-2ZM8.5 19.5H5c-.3 0-.5-.2-.5-.5v-3.5h4v4Zm0-5.5h-4v-4h4v4Zm0-5.5h-4V5c0-.3.2-.5.5-.5h3.5v4Zm11 10.5c0 .3-.2.5-.5.5h-9v-15h9c.3 0 .5.2.5.5v14Zm-4-10.8H14v3h-3v1.5h3v3h1.5v-3h3v-1.5h-3v-3Z"})}),Us=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14.2c.1.9.9 1.7 1.8 1.8H19.2c1-.1 1.8-1 1.8-2V5c0-1.1-.9-2-2-2ZM8.5 19.5H5c-.3 0-.5-.2-.5-.5V5c0-.3.2-.5.5-.5h3.5v15Zm11-.5c0 .3-.2.5-.5.5h-9v-15h9c.3 0 .5.2.5.5v14ZM16.9 8.8l-2.1 2.1-2.1-2.1-1.1 1.1 2.1 2.1-2.1 2.1 1.1 1.1 2.1-2.1 2.1 2.1 1.1-1.1-2.1-2.1L18 9.9l-1.1-1.1Z"})}),Ks=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"m14.5 6.5-1 1 3.7 3.7H4v1.6h13.2l-3.7 3.7 1 1 5.6-5.5z"})});const Ys=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"tableberg/cell","title":"Cell","category":"design","description":"A cell within a Tableberg table row.","parent":["tableberg/row"],"usesContext":["tableberg/tableConfig","tableberg/cellDefaults","tableberg/rowBackgroundColor"],"supports":{"html":false,"customClassName":false,"reusable":false,"lock":false},"attributes":{"span":{"type":"object"},"styles":{"type":"object"},"className":{"type":"string"},"backgroundColor":{"type":"string"},"border":{"type":"object"},"ribbon":{"type":"object"},"emptyCell":{"type":"boolean"}},"textdomain":"tableberg"}'),Js="150px",Xs="50px";function ei({clientId:e}){const{updateBlockAttributes:t}=(0,h.useDispatch)(me.store),n=(0,h.useSelect)(t=>{var n,l,o;const r=t(me.store),a=r.getBlockRootClientId(e),s=a?r.getBlockRootClientId(a):null;if(!a||!s)return null;const i=null!==(n=r.getBlockAttributes(s))&&void 0!==n?n:{};return{rowClientId:a,tableClientId:s,columns:Array.isArray(i.columns)?i.columns:[],column:As((null!==(l=r.getBlock(s)?.innerBlocks)&&void 0!==l?l:[]).filter(e=>"tableberg/row"===e.name).map(e=>e.innerBlocks.filter(e=>"tableberg/cell"===e.name).map(e=>{var t,n;return{id:e.clientId,rowSpan:null!==(t=e.attributes?.span?.rowSpan)&&void 0!==t?t:1,colSpan:null!==(n=e.attributes?.span?.colSpan)&&void 0!==n?n:1}})),e),rowHeight:r.getBlockAttributes(a)?.height,fixedColumnWidths:null===(o=i.table?.fixedColumnWidths)||void 0===o||o}},[e]);if(!n)return null;const{rowClientId:l,tableClientId:o,columns:r,column:a,rowHeight:s,fixedColumnWidths:u}=n,d=null===a?void 0:r[a]?.width,b=d?"fixed":"auto",g=s?"fixed":"auto",p=e=>{var n;if(null===a)return;const l=r.slice(),{width:s,...i}=null!==(n=l[a])&&void 0!==n?n:{};l[a]=e?{...i,width:e}:i,t(o,{columns:l})},f=e=>{t(l,{height:null!=e?e:null})};return(0,J.jsx)(me.InspectorControls,{children:(0,J.jsxs)(c.PanelBody,{title:(0,i.__)("Column & Row Dimensions","tableberg"),children:[null!==a&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(c.__experimentalToggleGroupControl,{label:(0,i.__)("Width Mode","tableberg"),value:b,isBlock:!0,onChange:e=>{u||p("fixed"===(e||b)?d||Js:void 0)},children:[(0,J.jsx)(c.__experimentalToggleGroupControlOption,{value:"auto",label:(0,i.__)("Auto","tableberg"),disabled:u}),(0,J.jsx)(c.__experimentalToggleGroupControlOption,{value:"fixed",label:(0,i.__)("Fixed","tableberg"),disabled:u})]}),"fixed"===b&&(0,J.jsx)(Oe,{label:(0,i.__)("Column Width","tableberg"),value:d||Js,disabled:u,onChange:e=>p(e||Js)}),u&&(0,J.jsx)("p",{style:{marginBottom:0,color:"#757575"},children:(0,i.__)("Turn off 'Equal width columns' in the table settings to set a width for this column.","tableberg")}),(0,J.jsx)("div",{style:{marginTop:"16px"}})]}),(0,J.jsxs)(c.__experimentalToggleGroupControl,{label:(0,i.__)("Height Mode","tableberg"),value:g,isBlock:!0,onChange:e=>f("fixed"===(e||g)?s||Xs:void 0),children:[(0,J.jsx)(c.__experimentalToggleGroupControlOption,{value:"auto",label:(0,i.__)("Auto","tableberg")}),(0,J.jsx)(c.__experimentalToggleGroupControlOption,{value:"fixed",label:(0,i.__)("Fixed","tableberg")})]}),"fixed"===g&&(0,J.jsx)(Oe,{label:(0,i.__)("Row Height","tableberg"),value:s||Xs,onChange:e=>f(e||Xs)})]})})}function ti({clientId:e,cellDefaultsBackgroundColor:t,ProColumnBackgroundContent:n}){const{updateBlockAttributes:l}=(0,h.useDispatch)(me.store),o=(0,h.useRegistry)(),r=(0,h.useSelect)(n=>{var l;const o=n(me.store),r=o.getBlockRootClientId(e),a=r?o.getBlockRootClientId(r):null;if(!r||!a)return null;const s=(null!==(l=o.getBlock(a)?.innerBlocks)&&void 0!==l?l:[]).filter(e=>"tableberg/row"===e.name).map(e=>e.innerBlocks.filter(e=>"tableberg/cell"===e.name).map(e=>{var t,n;return{id:e.clientId,rowSpan:null!==(t=e.attributes?.span?.rowSpan)&&void 0!==t?t:1,colSpan:null!==(n=e.attributes?.span?.colSpan)&&void 0!==n?n:1}})),i=As(s,e);let c=[];if(null!==i){const e=Os(s),t=new Set;for(let n=0;n<s.length;n++){const l=e.matrix[n]?.[i];l&&!t.has(l)&&(t.add(l),c.push(l))}}const u=e=>{var n;const l=o.getBlockAttributes(e),r=null!==(n=l?.backgroundColor)&&void 0!==n?n:l?.styles?.backgroundColor;return r&&""!==r.trim()?r:t};let d;if(c.length>0){const[e,...t]=c.map(u);d=t.every(t=>t===e)?e:void 0}return{columnCellIds:c,columnColor:d}},[e,t]);if(!r)return null;const a=e=>{const t=o.select(me.store);o.batch(()=>{r.columnCellIds.forEach(n=>{var o;const r=null!==(o=t.getBlockAttributes(n)?.styles)&&void 0!==o?o:{},{backgroundColor:a,...s}=r;l(n,{backgroundColor:e||null,styles:s})})})},s={columnBackgroundColorControl:{label:(0,i.__)("Column Background Color","tableberg"),value:r.columnColor,onChange:e=>a(e),onDeselect:()=>a("")}};return(0,J.jsx)(me.InspectorControls,{group:"color",children:n?n(s):(0,J.jsx)(Pa,{isEnhanced:!0,selected:"col-bg",children:(0,J.jsx)(ke,{...s.columnBackgroundColorControl})})})}const ni={top:"",right:"",bottom:"",left:""},li={topLeft:"",topRight:"",bottomRight:"",bottomLeft:""},oi=e=>!!(e.top||e.right||e.bottom||e.left);function ri({clientId:e,cellDefaultsBorder:t,ProColumnBorderContent:n}){var l,o;const{updateBlockAttributes:r}=(0,h.useDispatch)(me.store),a=(0,h.useRegistry)(),s=(0,h.useSelect)(n=>{var l;const o=n(me.store),r=o.getBlockRootClientId(e),a=r?o.getBlockRootClientId(r):null;if(!r||!a)return null;const s=(null!==(l=o.getBlock(a)?.innerBlocks)&&void 0!==l?l:[]).filter(e=>"tableberg/row"===e.name).map(e=>e.innerBlocks.filter(e=>"tableberg/cell"===e.name).map(e=>{var t,n;return{id:e.clientId,rowSpan:null!==(t=e.attributes?.span?.rowSpan)&&void 0!==t?t:1,colSpan:null!==(n=e.attributes?.span?.colSpan)&&void 0!==n?n:1}})),i=As(s,e);let c=[];if(null!==i){const e=Os(s),t=new Set;for(let n=0;n<s.length;n++){const l=e.matrix[n]?.[i];l&&!t.has(l)&&(t.add(l),c.push(l))}}const u=e=>{var n;const l=o.getBlockAttributes(e),r=null!==(n=l?.border)&&void 0!==n?n:l?.styles?.border;return r&&oi(r)?r:t};let d,h;if(c.length>0){const e=c.map(u),t=e[0],n=e[e.length-1];d=e.every(e=>e.left===t.left&&e.right===t.right)?{top:t.top,right:t.right,bottom:n.bottom,left:t.left}:void 0}if(c.length>0){var b,g,p,f;const e=c.map(e=>{var t;return null!==(t=o.getBlockAttributes(e)?.styles?.borderRadius)&&void 0!==t?t:li}),t=e[0],n=e[e.length-1];h={topLeft:null!==(b=t.topLeft)&&void 0!==b?b:"",topRight:null!==(g=t.topRight)&&void 0!==g?g:"",bottomRight:null!==(p=n.bottomRight)&&void 0!==p?p:"",bottomLeft:null!==(f=n.bottomLeft)&&void 0!==f?f:""}}return{columnCellIds:c,columnBorder:d,columnRadius:h}},[e,t.top,t.right,t.bottom,t.left]);if(!s)return null;const c=e=>{const t=a.select(me.store),n=s.columnCellIds.length;a.batch(()=>{s.columnCellIds.forEach((l,o)=>{var a;const s=null!==(a=t.getBlockAttributes(l)?.styles)&&void 0!==a?a:{},{border:i,...c}=s,u=o===n-1;r(l,{border:{top:0===o?e.top:"",right:e.right,bottom:u?e.bottom:"",left:e.left},styles:c})})})},u=e=>{const t=a.select(me.store),n=s.columnCellIds.length;a.batch(()=>{s.columnCellIds.forEach((l,o)=>{var a;const s=null!==(a=t.getBlockAttributes(l)?.styles)&&void 0!==a?a:{},i=0===o,c=o===n-1;r(l,{styles:{...s,borderRadius:{topLeft:i?e.topLeft:"",topRight:i?e.topRight:"",bottomRight:c?e.bottomRight:"",bottomLeft:c?e.bottomLeft:""}}})})})},d=null!==(l=s.columnBorder)&&void 0!==l?l:ni,b=null!==(o=s.columnRadius)&&void 0!==o?o:li,g={columnBorderControlProps:{label:(0,i.__)("Column Border","tableberg"),value:d,hasValue:()=>oi(d),onChange:e=>c(e),onDeselect:()=>c(ni)},columnRadiusControlProps:{label:(0,i.__)("Column Border Radius","tableberg"),value:b,hasValue:()=>{return!!((e=b).topLeft||e.topRight||e.bottomRight||e.bottomLeft);var e},onChange:e=>u(e),onDeselect:()=>u(li)}};return(0,J.jsx)(me.InspectorControls,{group:"border",children:n?n(g):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Pa,{isEnhanced:!0,selected:"col-border",children:(0,J.jsx)(we,{...g.columnBorderControlProps})}),(0,J.jsx)(Pa,{isEnhanced:!0,selected:"col-border-radius",children:(0,J.jsx)(_e,{...g.columnRadiusControlProps})})]})})}const ai={top:"",right:"",bottom:"",left:""},si=["tableberg/text","tableberg/button","tableberg/image","tableberg/list","tableberg/styled-list","tableberg/icon","tableberg/star-rating","tableberg/custom-html"];function ii({clientId:e,hasSpan:t,proToolbarControls:n=[]}){const l=(0,h.useRegistry)(),o=tn(),[r,a]=(0,u.useState)(!1),[s,d]=(0,u.useState)(!1),b=ds(e=>e.nativeSelectedCells),g=ds(e=>e.setNativeSelectedCells),p=(0,h.useSelect)(e=>{const t=e(me.store);return t.getMultiSelectedBlockClientIds().filter(e=>"tableberg/cell"===t.getBlockName(e))},[]),f=b.length>1?b:p,m=(0,h.useSelect)(t=>{var n,l;const o=t(me.store),r=o.getBlockRootClientId(e),a=r?o.getBlockRootClientId(r):null;if(!r||!a)return null;const s=(null!==(n=o.getBlock(a)?.innerBlocks)&&void 0!==n?n:[]).filter(e=>"tableberg/row"===e.name).map(e=>e.innerBlocks.filter(e=>"tableberg/cell"===e.name).map(e=>{var t,n;return{id:e.clientId,rowSpan:null!==(t=e.attributes?.span?.rowSpan)&&void 0!==t?t:1,colSpan:null!==(n=e.attributes?.span?.colSpan)&&void 0!==n?n:1}})),i=As(s,e);return null===i?null:{rowIndex:o.getBlockIndex(r),column:i,rowCount:s.length,columnCount:null!==(l=s[0]?.length)&&void 0!==l?l:0,hasMergedCells:s.flat().some(e=>e.rowSpan>1||e.colSpan>1)}},[e]),v=t=>()=>{const n=function(e,t){const n=e.select(me.store),l=n.getBlockRootClientId(t);if(!l)return null;const o=n.getBlockRootClientId(l);if(!o)return null;const r=n.getBlockIndex(l),{rows:a}=Ls(e,o);return{rowClientId:l,tableClientId:o,rowIndex:r,column:As(a,t),rows:a}}(l,e);n&&null!==n.column&&t(n)},x=[{icon:Rs,title:(0,i.__)("Insert row above","tableberg"),onClick:v(e=>Vs(l,e.tableClientId,e.rowIndex))},{icon:Is,title:(0,i.__)("Insert row below","tableberg"),onClick:v(e=>Vs(l,e.tableClientId,e.rowIndex+1))},{icon:Ts,title:(0,i.__)("Delete row","tableberg"),onClick:v(e=>Hs(l,e.tableClientId,e.rowIndex))},{icon:Ws,title:(0,i.__)("Insert column before","tableberg"),onClick:v(e=>zs(l,e.tableClientId,e.column))},{icon:Qs,title:(0,i.__)("Insert column after","tableberg"),onClick:v(t=>{var n;const o=t.rows.flat().find(t=>t.id===e);zs(l,t.tableClientId,t.column+(null!==(n=o?.colSpan)&&void 0!==n?n:1))})},{icon:Us,title:(0,i.__)("Delete column","tableberg"),onClick:v(e=>function(e,t,n){const{rows:l}=Ls(e,t),o=function(e,t){const{matrix:n,anchors:l}=Os(e),o=[],r=new Set;return e.forEach((a,s)=>{const i=n[s][t];void 0!==i&&l.get(i).row===s?r.has(i)?o.push({type:"skip",rowIndex:s}):(r.add(i),Ms(e,i).colSpan>1?o.push({type:"shrink",rowIndex:s,id:i}):o.push({type:"remove",rowIndex:s,id:i})):o.push({type:"skip",rowIndex:s})}),o}(l,n),r=e.dispatch(me.store),a=o.filter(e=>"remove"===e.type).map(e=>e.id),s=o.filter(e=>"shrink"===e.type).map(e=>e.id);Math.max(0,...l.map(e=>e.reduce((e,t)=>e+t.colSpan,0)))<=1||e.batch(()=>{for(const t of s)Ns(e,l,t,0,-1);a.length>0&&r.removeBlocks(a,!1)})}(l,e.tableClientId,e.column))},...n.filter(e=>e.isAvailable&&m?e.isAvailable(m):!e.isAvailable).map(e=>({icon:e.icon,title:e.title,onClick:v(t=>e.onClick({registry:l,tableClientId:t.tableClientId,rowIndex:t.rowIndex,column:t.column}))})),...0!==n.length||o?[]:[{icon:Is,title:(0,i.__)("Duplicate row (Pro)","tableberg"),onClick:()=>a(!0)},{icon:Qs,title:(0,i.__)("Duplicate column (Pro)","tableberg"),onClick:()=>a(!0)},{icon:Ks,title:(0,i.__)("Move column (Pro)","tableberg"),onClick:()=>d(!0)}],...f.length>1?[{icon:Es,title:(0,i.__)("Merge cells","tableberg"),onClick:v(e=>{(function(e,t,n){const{rows:l}=Ls(e,t),o=function(e,t){if(t.length<2)return null;const{anchors:n}=Os(e);let l=1/0,o=1/0,r=-1,a=-1,s=0;for(const i of t){const t=n.get(i),c=Ms(e,i);if(!t||!c)return null;l=Math.min(l,t.row),o=Math.min(o,t.col),r=Math.max(r,t.row+c.rowSpan-1),a=Math.max(a,t.col+c.colSpan-1),s+=c.rowSpan*c.colSpan}if(s!==(r-l+1)*(a-o+1))return null;let i=null;for(const e of t){const t=n.get(e);if(t.row===l&&t.col===o){i=e;break}}return i?{anchorId:i,rowSpan:r-l+1,colSpan:a-o+1,absorbedIds:t.filter(e=>e!==i)}:null}(l,n);if(!o)return!1;const r=e.select(me.store),a=e.dispatch(me.store),{anchors:s}=Os(l),i=s.get(o.anchorId);return e.batch(()=>{for(const e of o.absorbedIds){const t=r.getBlockOrder(e);if(t.length>0){const n=s.get(e);if(i&&n){const e={dr:n.row-i.row,dc:n.col-i.col};for(const n of t)a.updateBlockAttributes(n,{mergeOrigin:e})}const l=r.getBlockOrder(o.anchorId).length;a.moveBlocksToPosition(t,e,o.anchorId,l)}}a.updateBlockAttributes(o.anchorId,Fs(o.rowSpan,o.colSpan)),a.removeBlocks(o.absorbedIds,!1)}),!0})(l,e.tableClientId,f)&&g([])})}]:[],...t?[{icon:Es,title:(0,i.__)("Split cell","tableberg"),onClick:v(t=>function(e,t,n){const{rows:l,rowBlocks:o}=Ls(e,t),r=function(e,t){const{anchors:n}=Os(e),l=n.get(t),o=Ms(e,t);if(!l||!o||1===o.rowSpan&&1===o.colSpan)return null;const r=[];for(let a=0;a<o.rowSpan;a++){const s=l.row+a,i=e[s];if(!i)continue;const c=0===a?o.colSpan-1:o.colSpan;if(0===c)continue;let u=0;for(const e of i)(n.get(e.id).col<l.col||0===a&&e.id===t)&&u++;r.push({rowIndex:s,insertIndex:u,count:c})}return{inserts:r}}(l,n);if(!r)return;const a=e.select(me.store),s=e.dispatch(me.store),{anchors:i}=Os(l),c=i.get(n),u=(l.flat().find(e=>e.id===n),new Map);e.batch(()=>{s.updateBlockAttributes(n,{span:{rowSpan:1,colSpan:1}});for(const e of r.inserts){const t=c?e.rowIndex-c.row:0,n=Array.from({length:e.count},(e,n)=>{const l=Ds(),o=0===t?n+1:n;return u.set(`${t},${o}`,l),l});s.insertBlocks(n,e.insertIndex,o[e.rowIndex].clientId,!1)}const e=a.getBlockOrder(n);for(const t of e){const e=a.getBlockAttributes(t)?.mergeOrigin;if(!e)continue;const l=u.get(`${e.dr},${e.dc}`);if(s.updateBlockAttributes(t,{mergeOrigin:null}),!l)continue;const o=a.getBlockOrder(l.clientId).length;s.moveBlocksToPosition([t],n,l.clientId,o)}})}(l,t.tableClientId,e))}]:[]];return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(me.BlockControls,{group:"block",children:(0,J.jsx)(c.ToolbarDropdownMenu,{icon:Es,label:(0,i.__)("Edit table","tableberg"),controls:x})}),r&&(0,J.jsx)(ka,{onClose:()=>a(!1),selected:"duplicate-row-col"}),s&&(0,J.jsx)(ka,{onClose:()=>d(!1),selected:"move-row-col"})]})}function ci({attributes:e,setAttributes:t,defaultElementGap:n,CellBackgroundControl:l=null,CellRibbonPanel:o=null,CellRibbonColorControls:r=null,CellBorderControl:a=null,CellEmptyControl:s=null}){var u,d,h,b;const g=null!==(u=e.styles)&&void 0!==u?u:{},p=e=>t({styles:{...g,...e}}),f=(e.ribbon,tn()),m=[{label:(0,i.__)("Default","tableberg"),value:""},{label:(0,i.__)("Top","tableberg"),value:"top"},{label:(0,i.__)("Middle","tableberg"),value:"middle"},{label:(0,i.__)("Bottom","tableberg"),value:"bottom"}];return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(me.InspectorControls,{group:"color",children:[l&&l,!l&&!f&&(0,J.jsx)(Pa,{isEnhanced:!0,selected:"cell-bg",children:(0,J.jsx)(ke,{label:(0,i.__)("Background Color","tableberg"),value:"",onChange:()=>null,onDeselect:()=>null})}),r]}),(0,J.jsxs)(me.InspectorControls,{group:"border",children:[a&&a,!a&&!f&&(0,J.jsx)(Pa,{isEnhanced:!0,selected:"cell-border",children:(0,J.jsx)(we,{label:(0,i.__)("Border","tableberg"),value:ai,hasValue:()=>!1,onChange:()=>null,onDeselect:()=>null})})]}),(0,J.jsxs)(me.InspectorControls,{children:[(0,J.jsxs)(c.PanelBody,{title:(0,i.__)("Cell Settings","tableberg"),children:[(0,J.jsx)(Te,{label:(0,i.__)("Block Spacing","tableberg"),value:null!==(d=null!==(h=g.elementGap)&&void 0!==h?h:n)&&void 0!==d?d:"var(--wp--preset--spacing--20)",onChange:e=>p({elementGap:e}),style:{marginBottom:"24px"}}),f?(0,J.jsx)(c.SelectControl,{label:(0,i.__)("Vertical Alignment","tableberg"),value:null!==(b=g.verticalAlign)&&void 0!==b?b:"",options:m,onChange:e=>p({verticalAlign:e||void 0})}):(0,J.jsx)(Pa,{isEnhanced:!0,selected:"cell-bg",children:(0,J.jsx)(c.SelectControl,{label:(0,i.__)("Vertical Alignment","tableberg"),value:"",options:m,onChange:()=>null})}),s,!s&&!f&&(0,J.jsx)(Pa,{isEnhanced:!0,selected:"cell-empty",children:(0,J.jsx)(c.ToggleControl,{checked:!1,label:(0,i.__)("Empty Cell","tableberg"),onChange:()=>null})})]}),o,!o&&!f&&(0,J.jsx)(c.PanelBody,{title:(0,i.__)("Ribbon","tableberg"),children:(0,J.jsx)(Pa,{isEnhanced:!0,selected:"ribbon",children:(0,J.jsx)(c.ToggleControl,{checked:!1,label:(0,i.__)("Enable Ribbon","tableberg"),onChange:()=>null})})})]})]})}const ui=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"tableberg/text","title":"Text","category":"design","description":"A text element within a Tableberg cell.","parent":["tableberg/cell"],"supports":{"html":false,"customClassName":false,"reusable":false,"__experimentalSlashInserter":true},"attributes":{"content":{"type":"string"},"align":{"type":"string"},"styles":{"type":"object"},"bindings":{"type":"object"},"mergeOrigin":{"type":"object"}},"textdomain":"tableberg"}');const di=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"tableberg/button","title":"Button","category":"design","description":"A button element within a Tableberg cell.","parent":["tableberg/cell"],"supports":{"html":false,"customClassName":false,"reusable":false},"attributes":{"content":{"type":"string"},"align":{"type":"string"},"styles":{"type":"object"},"bindings":{"type":"object"},"mergeOrigin":{"type":"object"},"link":{"type":"object"},"id":{"type":"string"}},"textdomain":"tableberg"}');const hi=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"tableberg/image","title":"Image","category":"design","description":"An image element within a Tableberg cell.","parent":["tableberg/cell"],"supports":{"html":false,"customClassName":false,"reusable":false},"attributes":{"media":{"type":"object"},"alt":{"type":"string"},"align":{"type":"string"},"width":{"type":"string"},"height":{"type":"string"},"aspectRatio":{"type":"string"},"scale":{"type":"string"},"sizeSlug":{"type":"string"},"caption":{"type":"string"},"href":{"type":"string"},"linkTarget":{"type":"string"},"lightbox":{"type":"object"},"border":{"type":"object"},"borderRadius":{"type":"object"},"bindings":{"type":"object"},"mergeOrigin":{"type":"object"}},"textdomain":"tableberg"}');const bi=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"tableberg/list","title":"List","category":"design","description":"A list element within a Tableberg cell.","parent":["tableberg/cell"],"supports":{"html":false,"customClassName":false,"reusable":false},"attributes":{"items":{"type":"array"},"listType":{"type":"string"},"listStyle":{"type":"string"},"align":{"type":"string"},"styles":{"type":"object"},"bindings":{"type":"object"},"mergeOrigin":{"type":"object"},"icon":{"type":"object","default":{"iconName":"check","svg":{"viewBox":"0 0 24 24","path":"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}}}},"textdomain":"tableberg"}');var gi=class extends b{constructor(e={}){super(),this.config=e,this.#D=new Map}#D;build(e,t,n){const l=t.queryKey,o=t.queryHash??w(l,t);let r=this.get(o);return r||(r=new q({client:e,queryKey:l,queryHash:o,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(l)}),this.add(r)),r}add(e){this.#D.has(e.queryHash)||(this.#D.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#D.get(e.queryHash);t&&(e.destroy(),t===e&&this.#D.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){L.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#D.get(e)}getAll(){return[...this.#D.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(e=>y(t,e))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(t=>y(e,t)):t}notify(e){L.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){L.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){L.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},pi=class extends Z{#L;#F;#c;constructor(e){super(),this.mutationId=e.mutationId,this.#F=e.mutationCache,this.#L=[],this.state=e.state||{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0},this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#L.includes(e)||(this.#L.push(e),this.clearGcTimeout(),this.#F.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#L=this.#L.filter(t=>t!==e),this.scheduleGc(),this.#F.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#L.length||("pending"===this.state.status?this.scheduleGc():this.#F.remove(this))}continue(){return this.#c?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#h({type:"continue"})};this.#c=G({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(e,t)=>{this.#h({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#h({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#F.canRun(this)});const n="pending"===this.state.status,l=!this.#c.canStart();try{if(n)t();else{this.#h({type:"pending",variables:e,isPaused:l}),await(this.#F.config.onMutate?.(e,this));const t=await(this.options.onMutate?.(e));t!==this.state.context&&this.#h({type:"pending",context:t,variables:e,isPaused:l})}const o=await this.#c.start();return await(this.#F.config.onSuccess?.(o,e,this.state.context,this)),await(this.options.onSuccess?.(o,e,this.state.context)),await(this.#F.config.onSettled?.(o,null,this.state.variables,this.state.context,this)),await(this.options.onSettled?.(o,null,e,this.state.context)),this.#h({type:"success",data:o}),o}catch(t){try{throw await(this.#F.config.onError?.(t,e,this.state.context,this)),await(this.options.onError?.(t,e,this.state.context)),await(this.#F.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this)),await(this.options.onSettled?.(void 0,t,e,this.state.context)),t}finally{this.#h({type:"error",error:t})}}finally{this.#F.runNext(this)}}#h(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),L.batch(()=>{this.#L.forEach(t=>{t.onMutationUpdate(e)}),this.#F.notify({mutation:this,type:"updated",action:e})})}},fi=class extends b{constructor(e={}){super(),this.config=e,this.#N=new Set,this.#V=new Map,this.#H=0}#N;#V;#H;build(e,t,n){const l=new pi({mutationCache:this,mutationId:++this.#H,options:e.defaultMutationOptions(t),state:n});return this.add(l),l}add(e){this.#N.add(e);const t=mi(e);if("string"==typeof t){const n=this.#V.get(t);n?n.push(e):this.#V.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#N.delete(e)){const t=mi(e);if("string"==typeof t){const n=this.#V.get(t);if(n)if(n.length>1){const t=n.indexOf(e);-1!==t&&n.splice(t,1)}else n[0]===e&&this.#V.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=mi(e);if("string"==typeof t){const n=this.#V.get(t),l=n?.find(e=>"pending"===e.state.status);return!l||l===e}return!0}runNext(e){const t=mi(e);if("string"==typeof t){const n=this.#V.get(t)?.find(t=>t!==e&&t.state.isPaused);return n?.continue()??Promise.resolve()}return Promise.resolve()}clear(){L.batch(()=>{this.#N.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#N.clear(),this.#V.clear()})}getAll(){return Array.from(this.#N)}find(e){const t={exact:!0,...e};return this.getAll().find(e=>C(t,e))}findAll(e={}){return this.getAll().filter(t=>C(e,t))}notify(e){L.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(e=>e.state.isPaused);return L.batch(()=>Promise.all(e.map(e=>e.continue().catch(p))))}};function mi(e){return e.options.scope?.id}function vi(e){return{onFetch:(t,n)=>{const l=t.options,o=t.fetchOptions?.meta?.fetchMore?.direction,r=t.state.data?.pages||[],a=t.state.data?.pageParams||[];let s={pages:[],pageParams:[]},i=0;const c=async()=>{let n=!1;const c=M(t.options,t.fetchOptions),u=async(e,l,o)=>{if(n)return Promise.reject();if(null==l&&e.pages.length)return Promise.resolve(e);const r=(()=>{const e={client:t.client,queryKey:t.queryKey,pageParam:l,direction:o?"backward":"forward",meta:t.options.meta};var r;return r=e,Object.defineProperty(r,"signal",{enumerable:!0,get:()=>(t.signal.aborted?n=!0:t.signal.addEventListener("abort",()=>{n=!0}),t.signal)}),e})(),a=await c(r),{maxPages:s}=t.options,i=o?E:T;return{pages:i(e.pages,a,s),pageParams:i(e.pageParams,l,s)}};if(o&&r.length){const e="backward"===o,t={pages:r,pageParams:a},n=(e?yi:xi)(l,t);s=await u(t,n,e)}else{const t=e??r.length;do{const e=0===i?a[0]??l.initialPageParam:xi(l,s);if(i>0&&null==e)break;s=await u(s,e),i++}while(i<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=c}}}function xi(e,{pages:t,pageParams:n}){const l=t.length-1;return t.length>0?e.getNextPageParam(t[l],t,n[l],n):void 0}function yi(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}const Ci=JSON.parse('{"UU":"tableberg/table","DD":"Tableberg","L1":"design","xY":{"html":false,"customClassName":false},"uK":{"version":{"type":"number","default":0},"isExample":{"type":"boolean","default":false},"table":{"type":"object","default":{"rows":0,"cols":0,"className":"","headerEnabled":false,"footerEnabled":false,"stickyHeader":false,"stickyFirstCol":false,"innerBorderType":"","caption":"","tableWidth":"auto","tableAlignment":"left","cellSpacing":{"horizontal":"0","vertical":"0"},"tableBorder":{"top":"","right":"","bottom":"","left":""},"typography":{"fontFamily":"","fontSize":"","fontStyle":"","fontWeight":"","lineHeight":"","letterSpacing":"","textDecoration":"","textTransform":""},"margin":{"top":"","right":"","bottom":"","left":""},"padding":{"top":"","right":"","bottom":"","left":""},"fixedColumnWidths":true,"pagination":{"enabled":false,"pageSize":10,"showPageNumbers":true,"showPrevNext":true},"search":{"enabled":false,"placeholder":"Search...","highlightColor":"","position":"left"},"responsive":{"tablet":{"enabled":false,"maxWidth":700,"mode":"scroll","transpose":false,"stackCount":3,"repeatFirstCol":false},"mobile":{"enabled":false,"maxWidth":375,"mode":"scroll","transpose":false,"stackCount":1,"repeatFirstCol":false}}}},"rows":{"type":"array","default":[]},"columns":{"type":"array","default":[]},"cells":{"type":"object","default":{}},"bindings":{"type":"object","default":{}},"cellDefaults":{"type":"object","default":{"styles":{"padding":{"top":"var(--wp--preset--spacing--20)","right":"var(--wp--preset--spacing--20)","bottom":"var(--wp--preset--spacing--20)","left":"var(--wp--preset--spacing--20)"},"border":{"top":"1px solid currentColor","right":"1px solid currentColor","bottom":"1px solid currentColor","left":"1px solid currentColor"},"borderRadius":{"topLeft":"0px","topRight":"0px","bottomRight":"0px","bottomLeft":"0px"},"orientation":"vertical","elementGap":"var(--wp--preset--spacing--20)","wrap":"nowrap","verticalAlign":"middle","backgroundColor":"","headerBackgroundColor":"","footerBackgroundColor":"","evenRowBackgroundColor":"","oddRowBackgroundColor":""}}}}}'),wi=n.p+"images/example.01df8ea3.png",_i=["text","button","image","list","styled-list","icon","star-rating","custom-html"];function ki(e){var t;return(null!==(t=e.version)&&void 0!==t?t:0)<=3}function Si(e){const t={...e};return delete t.cells,delete t.rows,t.version=4,t}function ji(e){const{elements:t=[],...n}=e,l=[];for(const e of t){var o;if(!e||!_i.includes(e.name))continue;const t={...null!==(o=e.attributes)&&void 0!==o?o:{}};e.bindings&&Object.keys(e.bindings).length>0&&(t.bindings=e.bindings),l.push((0,ve.createBlock)(`tableberg/${e.name}`,t))}return(0,ve.createBlock)("tableberg/cell",n,l)}function Bi(e){var t,n,l,o;const r=null!==(t=e.table?.rows)&&void 0!==t?t:0,a=null!==(n=e.table?.cols)&&void 0!==n?n:0,s=null!==(l=e.cells)&&void 0!==l?l:{},i=null!==(o=e.rows)&&void 0!==o?o:[],c=function(e,t,n){const l=new Set;for(const[o,r]of Object.entries(e)){const e=r?.span;if(!e)continue;const[a,s]=o.split(",").map(Number),i=Math.max(1,e.rowSpan||1),c=Math.max(1,e.colSpan||1);for(let e=0;e<i;e++)for(let o=0;o<c;o++){if(0===e&&0===o)continue;const r=a+e,i=s+o;r>=t||i>=n||l.add(`${r},${i}`)}}return l}(s,r,a),u=[];for(let e=0;e<r;e++){var d;const t=[];for(let n=0;n<a;n++){var h;if(c.has(`${e},${n}`))continue;const l=null!==(h=s[`${e},${n}`])&&void 0!==h?h:{};t.push(ji(l))}const n={...null!==(d=i[e])&&void 0!==d?d:{}};u.push((0,ve.createBlock)("tableberg/row",n,t))}return u}function Pi(e){const t=Number.parseInt(e||"",10);return Number.isNaN(t)||t<1?1:t}const Ri={from:[{type:"block",blocks:["core/table"],transform:e=>{const t=function(e){var t;const n=e.head||[],l=e.body||[],o=e.foot||[],r=[...n,...l,...o],a={},s=new Set;r.forEach((e,t)=>{let n=0;(e.cells||[]).forEach(e=>{for(;s.has(pe(t,n));)n+=1;const l=Pi(e.rowspan),o=Pi(e.colspan),r=pe(t,n);var i;a[r]={elements:[{name:"text",attributes:{...ln,content:e.content||"",align:(i=e.align,"left"===i||"center"===i||"right"===i?i:ln.align)}}],...l>1||o>1?{span:{rowSpan:l,colSpan:o}}:{}};for(let e=0;e<l;e++)for(let l=0;l<o;l++)0===e&&0===l||s.add(pe(t+e,n+l));n+=o})});const i=Object.entries(a).reduce((e,[t,n])=>{const[,l]=t.split(",").map(e=>Number.parseInt(e,10)),o=n.span?.colSpan||1;return Math.max(e,l+o)},0);return{...ge,version:3,table:{...ge.table,rows:r.length,cols:i,headerEnabled:n.length>0,footerEnabled:o.length>0,caption:e.caption||"",fixedColumnWidths:null===(t=e.hasFixedLayout)||void 0===t||t},cells:a}}(e);return(0,ve.createBlock)("tableberg/table",Si(t),Bi(t))}}]};var Ii=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"m16.5 13.5-3.7 3.7V4h-1.5v13.2l-3.8-3.7-1 1 5.5 5.6 5.5-5.6z"})}),Ti=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M12 3.9 6.5 9.5l1 1 3.8-3.7V20h1.5V6.8l3.7 3.7 1-1z"})}),Ei=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{fillRule:"evenodd",d:"M10.289 4.836A1 1 0 0111.275 4h1.306a1 1 0 01.987.836l.244 1.466c.787.26 1.503.679 2.108 1.218l1.393-.522a1 1 0 011.216.437l.653 1.13a1 1 0 01-.23 1.273l-1.148.944a6.025 6.025 0 010 2.435l1.149.946a1 1 0 01.23 1.272l-.653 1.13a1 1 0 01-1.216.437l-1.394-.522c-.605.54-1.32.958-2.108 1.218l-.244 1.466a1 1 0 01-.987.836h-1.306a1 1 0 01-.986-.836l-.244-1.466a5.995 5.995 0 01-2.108-1.218l-1.394.522a1 1 0 01-1.217-.436l-.653-1.131a1 1 0 01.23-1.272l1.149-.946a6.026 6.026 0 010-2.435l-1.148-.944a1 1 0 01-.23-1.272l.653-1.131a1 1 0 011.217-.437l1.393.522a5.994 5.994 0 012.108-1.218l.244-1.466zM14.929 12a3 3 0 11-6 0 3 3 0 016 0z",clipRule:"evenodd"})});function Oi(e,t){return e[t]?.span||{rowSpan:1,colSpan:1}}function Mi(e,t){if(e.length<2)return!1;const n=new Set;for(const l of e){const[e,o]=fe(l),r=Oi(t,l);for(let t=0;t<r.rowSpan;t++)for(let l=0;l<r.colSpan;l++)n.add(`${e+t},${o+l}`)}let l=1/0,o=-1/0,r=1/0,a=-1/0;for(const e of n){const[t,n]=e.split(",").map(Number);l=Math.min(l,t),o=Math.max(o,t),r=Math.min(r,n),a=Math.max(a,n)}for(let e=l;e<=o;e++)for(let t=r;t<=a;t++)if(!n.has(`${e},${t}`))return!1;return!0}function Ai({styleKey:e,defaultValue:t,hasValue:n,label:l,labelSelected:o}){var r;const a=ds(e=>e.selectedCells),s=ds(e=>e.cellDefaults.styles),i=ds(e=>e.getCellStyle),c=ds(e=>e.updateCellStyles),u=ds(e=>e.updateCellGlobalStyles),d=a.length>0&&i(a[0])||{};return{value:a.length>0&&d[e]?null!==(r=d[e])&&void 0!==r?r:t:s[e],hasValue:()=>{if(a.length>0){const t=d[e];return!!t&&n(t)}{const t=s[e];return n(t)}},onChange:t=>{a.length>0?a.forEach(n=>{c(n,{[e]:t})}):u({[e]:t})},onDeselect:()=>{a.length>0?a.forEach(n=>{c(n,{[e]:t})}):u({[e]:t})},label:a.length>0&&o?o:l}}var Di=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M20.5 16h-.7V8c0-1.1-.9-2-2-2H6.2c-1.1 0-2 .9-2 2v8h-.7c-.8 0-1.5.7-1.5 1.5h20c0-.8-.7-1.5-1.5-1.5zM5.7 8c0-.3.2-.5.5-.5h11.6c.3 0 .5.2.5.5v7.6H5.7V8z"})}),Li=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M17 4H7c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 14c0 .3-.2.5-.5.5H7c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h10c.3 0 .5.2.5.5v12zm-7.5-.5h4V16h-4v1.5z"})}),Fi=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M15 4H9c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h6c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 14c0 .3-.2.5-.5.5H9c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h6c.3 0 .5.2.5.5v12zm-4.5-.5h2V16h-2v1.5z"})});const Ni=[{value:"desktop",deviceType:"Desktop",label:(0,i.__)("Desktop","tableberg"),icon:Di},{value:"tablet",deviceType:"Tablet",label:(0,i.__)("Tablet","tableberg"),icon:Li},{value:"mobile",deviceType:"Mobile",label:(0,i.__)("Mobile","tableberg"),icon:Fi}],Vi=ge.table.responsive,Hi=[{value:"scroll",label:(0,i.__)("Scroll","tableberg")},{value:"stack",label:(0,i.__)("Stack","tableberg")}];function zi(e,t){const n=function(e){return{...Vi[e]}}(t),l=e?.[t];return{...n,...l||{},transpose:"boolean"==typeof l?.transpose?l.transpose:"row"===l?.direction,repeatFirstCol:"boolean"==typeof l?.repeatFirstCol?l.repeatFirstCol:!!l?.headerAsCol}}function Gi(){const e=ds(e=>e.table),t=ds(e=>e.updateTable),n=(0,h.useSelect)(e=>{const t=e("core/editor"),n=e("core/edit-site"),l=e("core/edit-post");return function(e){const t=(e||"desktop").toLowerCase();return"tablet"===t?"tablet":"mobile"===t?"mobile":"desktop"}(t?.getDeviceType?.()||n?.__experimentalGetPreviewDeviceType?.()||l?.__experimentalGetPreviewDeviceType?.())},[]),l=(0,h.useDispatch)("core/editor"),o=(0,h.useDispatch)("core/edit-site"),r=(0,h.useDispatch)("core/edit-post"),a=e.responsive,s=(e,n)=>{const l={tablet:zi(a,"tablet"),mobile:zi(a,"mobile")};t({responsive:{...l,[e]:{...l[e],...n}}})},u="desktop"===n?"tablet":n,d=zi(a,u),b=!d.enabled;return(0,J.jsx)(me.InspectorControls,{children:(0,J.jsx)(c.PanelBody,{title:(0,i.__)("Responsive","tableberg"),children:(0,J.jsxs)(c.BaseControl,{__nextHasNoMarginBottom:!0,children:[(0,J.jsx)(c.ButtonGroup,{className:"tableberg-responsiveness-device-switcher-container",children:Ni.map(({value:e,deviceType:t,label:a,icon:s})=>(0,J.jsx)(c.Button,{isPressed:n===e,icon:s,className:"tableberg-responsiveness-device-switcher",onClick:()=>{var e;e=t,l?.setDeviceType?l.setDeviceType(e):o?.__experimentalSetPreviewDeviceType?o.__experimentalSetPreviewDeviceType(e):r?.__experimentalSetPreviewDeviceType&&r.__experimentalSetPreviewDeviceType(e)},children:a},e))}),"desktop"===n?(0,J.jsx)("p",{style:{margin:0,color:"#757575"},children:(0,i.__)("Switch to Tablet or Mobile preview to configure responsive behavior.","tableberg")}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(c.ToggleControl,{label:(0,i.__)("Enable Responsive Rule","tableberg"),checked:d.enabled,onChange:e=>{s(u,{enabled:e})}}),(0,J.jsx)(c.__experimentalNumberControl,{label:(0,i.__)("Max Width","tableberg"),value:d.maxWidth,min:1,suffix:"px",spinControls:"none",onChange:e=>{const t=parseInt(e||"",10);isNaN(t)||t<1||s(u,{maxWidth:t})},disabled:b,help:(0,i.__)("The columns will be stacked when browser window width is less than this width","tableberg")}),(0,J.jsx)(c.SelectControl,{label:(0,i.__)("Responsive Mode","tableberg"),value:d.mode,options:Hi,onChange:e=>{s(u,{mode:e})},disabled:b,help:"scroll"===d.mode?(0,i.__)("Makes the table horizontally scrollable","tableberg"):"stack"===d.mode?(0,i.__)("Breaks the table by columns and stacks the columns","tableberg"):void 0}),"stack"===d.mode&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(c.ToggleControl,{label:(0,i.__)("Transform Rows to Columns","tableberg"),checked:d.transpose,onChange:e=>{s(u,{transpose:e})},disabled:b}),(0,J.jsx)(c.ToggleControl,{label:(0,i.__)("Show First Column in Every Stack Row","tableberg"),checked:d.repeatFirstCol,onChange:e=>{s(u,{repeatFirstCol:e})},disabled:b}),(0,J.jsx)(c.__experimentalNumberControl,{label:(0,i.__)("Items Per Stack Row","tableberg"),value:d.stackCount,min:1,spinControls:"none",help:(0,i.__)("Maximum number of cells allowed in each stacked sub-row.","tableberg"),onChange:e=>{const t=parseInt(e||"",10);isNaN(t)||t<1||s(u,{stackCount:t})},disabled:b})]})]})]})})})}function Zi({label:e,value:t,onChange:n}){return(0,J.jsx)(me.InspectorControls,{group:"advanced",children:(0,J.jsx)(c.TextControl,{__next40pxDefaultSize:!0,autoComplete:"off",label:e||(0,i.__)("Additional CSS class(es)","tableberg"),value:t||"",onChange:e=>{const t=e.trim();n(""!==t?t:void 0)},help:(0,i.__)("Separate multiple classes with spaces.","tableberg")})})}const qi=ge.cellDefaults.styles,$i=[{value:"left",icon:Ye,title:(0,i.__)("Align left","tableberg")},{value:"center",icon:Je,title:(0,i.__)("Align center","tableberg")},{value:"right",icon:Xe,title:(0,i.__)("Align right","tableberg")}],Wi="350px",Qi=(e=[])=>{e.forEach(e=>{e()})},Ui=["auto","wide","full"],Ki=[{value:"vertical",icon:Ii,label:(0,i.__)("Vertical","tableberg")},{value:"horizontal",icon:Ks,label:(0,i.__)("Horizontal","tableberg")}],Yi=[{value:"left",icon:un,label:(0,i.__)("Left","tableberg")},{value:"center",icon:dn,label:(0,i.__)("Center","tableberg")},{value:"right",icon:hn,label:(0,i.__)("Right","tableberg")}],Ji=[{value:"top",icon:Ti,label:(0,i.__)("Top","tableberg")},{value:"middle",icon:Je,label:(0,i.__)("Middle","tableberg")},{value:"bottom",icon:Ii,label:(0,i.__)("Bottom","tableberg")}],Xi=ge.table;function ec(e){return{top:e.vertical,right:e.horizontal,bottom:e.vertical,left:e.horizontal}}function tc(e,t,n){const l=ec(t);let o=t.horizontal;e.right!==l.right?o=e.right:e.left!==l.left&&(o=e.left);let r=t.vertical;return e.top!==l.top?r=e.top:e.bottom!==l.bottom&&(r=e.bottom),{horizontal:o||n.horizontal,vertical:r||n.vertical}}function nc({ProColumnSortingContent:e}){const t=ds(e=>e.cells),n=ds(e=>e.columns),l=ds(e=>e.table),o=ds(e=>e.sortPreviewMode),r=ds(e=>e.getColumnConfig),a=ds(e=>e.setColumnSortable),s=ds(e=>e.isColumnSortableAllowed),u=ds(e=>e.enterSortPreviewMode),{headerEnabled:d}=l;if(!d)return(0,J.jsx)(me.InspectorControls,{children:(0,J.jsx)(c.PanelBody,{title:(0,i.__)("Column Sorting","tableberg"),children:(0,J.jsx)("p",{style:{color:"#757575"},children:(0,i.__)("To enable column sorting, make the top row a header in the Header & Footer Settings panel.","tableberg")})})});if(Da(t))return(0,J.jsx)(me.InspectorControls,{children:(0,J.jsx)(c.PanelBody,{title:(0,i.__)("Column Sorting","tableberg"),children:(0,J.jsx)("p",{style:{color:"#757575"},children:(0,i.__)("Column sorting is not available for tables with merged cells.","tableberg")})})});const h=Array.from({length:l.cols},(e,t)=>t),b=function(e){return e.some(e=>!!e?.sortable)}(n);return e?(0,J.jsx)(me.InspectorControls,{children:(0,J.jsx)(c.PanelBody,{title:(0,i.__)("Column Sorting","tableberg"),initialOpen:b,children:e({columnNumbers:h,getColumnConfig:r,isColumnSortableAllowed:s,setColumnSortable:a,hasSortableCols:b,sortPreviewMode:o,enterSortPreviewMode:u})})}):(0,J.jsx)(me.InspectorControls,{children:(0,J.jsx)(Pa,{isEnhanced:!0,selected:"sorting",children:(0,J.jsx)(c.PanelBody,{title:(0,i.__)("Column Sorting","tableberg"),children:h.map(e=>(0,J.jsx)(c.ToggleControl,{checked:!1,label:(0,i.sprintf)((0,i.__)("Column %d","tableberg"),e+1),onChange:()=>null},e))})})})}function lc({ProPaginationContent:e}){const t=ds(e=>e.cells),n=ds(e=>e.table.pagination),l=ds(e=>e.setPaginationConfig);return e?Fa(t)?(0,J.jsx)(me.InspectorControls,{children:(0,J.jsx)(c.PanelBody,{title:(0,i.__)("Pagination","tableberg"),children:(0,J.jsx)("p",{style:{color:"#757575"},children:(0,i.__)("Pagination is not available for tables with row-spanning cells (cells that span multiple rows).","tableberg")})})}):(0,J.jsx)(me.InspectorControls,{children:(0,J.jsx)(c.PanelBody,{title:(0,i.__)("Pagination","tableberg"),children:e({paginationConfig:n,updatePaginationConfig:l})})}):(0,J.jsx)(me.InspectorControls,{children:(0,J.jsx)(Pa,{isEnhanced:!0,selected:"pagination",children:(0,J.jsx)(c.PanelBody,{title:(0,i.__)("Pagination","tableberg"),children:(0,J.jsx)(c.ToggleControl,{checked:!1,label:(0,i.__)("Enable Pagination","tableberg"),onChange:()=>null})})})})}function oc(){var e;const t=ds(e=>e.table),n=ds(e=>e.updateTable);return t.cols<1&&t.rows<1?null:(0,J.jsx)(me.InspectorControls,{children:(0,J.jsxs)(c.PanelBody,{title:(0,i.__)("Column & Row Dimensions","tableberg"),children:[(0,J.jsx)(c.ToggleControl,{checked:null===(e=t.fixedColumnWidths)||void 0===e||e,label:(0,i.__)("Equal width columns","tableberg"),onChange:e=>{n({fixedColumnWidths:e})}}),(0,J.jsx)("p",{style:{marginBottom:0,color:"#757575"},children:(0,i.__)("Select a cell to set the width of its column and the height of its row.","tableberg")})]})})}const rc=function({ProStickyHeaderControl:e,ProStickyFirstColControl:t,ProCellOrientationControl:n,ProBorderModeControls:l,ProColumnSortingContent:o,ProSearchControl:r,ProPaginationContent:a}={}){const s=tn(),{clientId:d}=(0,me.useBlockEditContext)(),b=ds(e=>e.table),g=ds(e=>e.cells),p=ds(e=>e.updateTable),f=ds(e=>e.setCells),m=ds(e=>e.selectedCells),v=ds(e=>e),x=ds(e=>e.sortPreviewMode),y=(ds(e=>e.selectedRibbonCell),ds(e=>e.showCaption)),C=ds(e=>e.setShowCaption),w=(ds(e=>e.showRowColumnControls),ds(e=>e.showDuplicateMoveControls),ds(e=>e.toggleRowColumnControls),ds(e=>e.toggleDuplicateMoveControls),b.caption||""),[_,k]=(0,u.useState)("settings"),[S,j]=(0,u.useState)(!1),B=b.tableAlignment||"left",P=(b.tableWidth||"auto").trim(),R=(I=P,Ui.includes(I)?P:"fixed");var I;const T="fixed"===R,E=T&&P||Wi,O=function(){const e=Xi.cellSpacing;return{horizontal:e.horizontal,vertical:e.vertical}}(),M=Ae(b.typography),A=b.cellSpacing||O,D=A.horizontal||O.horizontal,L=A.vertical||O.vertical,F=Xi.tableBorder,N=b.tableBorder||F,V={label:(0,i.__)("Table Border","tableberg"),value:N,hasValue:()=>!!(N.top||N.right||N.bottom||N.left),onChange:e=>{p({tableBorder:e})},onDeselect:()=>{p({tableBorder:{...F}})}},H=Xi.margin,z=b.margin||H,G={label:(0,i.__)("Block Margin","tableberg"),value:z,hasValue:()=>!!(z.top||z.right||z.bottom||z.left),onChange:e=>{p({margin:e})},onDeselect:()=>{p({margin:{...H}})}},Z=Xi.padding,q=b.padding||Z,$={label:(0,i.__)("Block Padding","tableberg"),value:q,hasValue:()=>!!(q.top||q.right||q.bottom||q.left),onChange:e=>{p({padding:e})},onDeselect:()=>{p({padding:{...Z}})}},W=Ai({styleKey:"border",defaultValue:qi.border,label:(0,i.__)("Cell Border","tableberg"),labelSelected:(0,i.__)("Common Cell Border","tableberg"),hasValue:e=>!!(e.top||e.right||e.bottom||e.left)}),Q=Ai({styleKey:"borderRadius",defaultValue:qi.borderRadius,label:(0,i.__)("Table Border Radius","tableberg"),labelSelected:(0,i.__)("Cell Border Radius","tableberg"),hasValue:e=>!!(e.topLeft||e.topRight||e.bottomRight||e.bottomLeft)}),U=Ai({styleKey:"padding",defaultValue:qi.padding,hasValue:e=>!!(e.top||e.right||e.bottom||e.left),label:(0,i.__)("Common Cell Padding","tableberg"),labelSelected:(0,i.__)("Cell Padding","tableberg")}),K=Ai({styleKey:"backgroundColor",defaultValue:qi.backgroundColor,hasValue:e=>!!e,label:(0,i.__)("Common Cell Background Color","tableberg"),labelSelected:(0,i.__)("Cell Background Color","tableberg")}),Y=Ai({styleKey:"elementGap",defaultValue:qi.elementGap,hasValue:e=>e!==qi.elementGap,label:(0,i.__)("Common Element Spacing","tableberg"),labelSelected:(0,i.__)("Element Spacing","tableberg")}),X=new Set(m),ee=(e=>Object.entries(e).map(([e,t])=>[e,t.elements||[]]))(g),te=((m.length>0?ee.filter(([e])=>X.has(e)):ee).flatMap(([,e])=>e),(0,h.useRegistry)()),ne=(e=>{const t=te.select(me.store),n=null!==(e=t.getBlock(d)?.innerBlocks)&&void 0!==e?e:[];let l;for(const e of n)for(const t of null!==(o=e.innerBlocks)&&void 0!==o?o:[]){var o;for(const e of null!==(r=t.innerBlocks)&&void 0!==r?r:[]){var r;const t=e.attributes?.align;if(t)if(void 0===l)l=t;else if(l!==t)return}}return l})(),le=(0,h.useSelect)(e=>{var t;const n=e(me.store),l=null!==(t=n.getBlock(d)?.innerBlocks)&&void 0!==t?t:[],o={textColor:new Set,linkColor:new Set};for(const e of l)for(const t of null!==(r=e.innerBlocks)&&void 0!==r?r:[]){var r;for(const e of null!==(a=t.innerBlocks)&&void 0!==a?a:[]){var a,s,i,c;if("tableberg/text"!==e.name&&"tableberg/list"!==e.name)continue;const t=null!==(s=e.attributes?.styles)&&void 0!==s?s:{};o.textColor.add(null!==(i=t.textColor)&&void 0!==i?i:""),o.linkColor.add(null!==(c=t.linkColor)&&void 0!==c?c:"")}}const u=e=>1===e.size&&Array.from(e)[0]||void 0;return{textColor:u(o.textColor),linkColor:u(o.linkColor)}},[d]),oe={label:(0,i.__)("Common Elements Alignment","tableberg"),value:ne,onChange:e=>{(e=>{var t;const n=te.select(me.store),l=te.dispatch(me.store),o=null!==(t=n.getBlock(d)?.innerBlocks)&&void 0!==t?t:[];te.batch(()=>{for(const r of o)for(const o of null!==(t=r.innerBlocks)&&void 0!==t?t:[]){var t;for(const t of null!==(n=o.innerBlocks)&&void 0!==n?n:[]){var n;e(t,l)}}})})((t,n)=>{n.updateBlockAttributes(t.clientId,{align:e})})}},re=e=>{var t;const n=te.select(me.store),l=te.dispatch(me.store),o=null!==(t=n.getBlock(d)?.innerBlocks)&&void 0!==t?t:[];te.batch(()=>{for(const a of o)for(const o of null!==(t=a.innerBlocks)&&void 0!==t?t:[]){var t;for(const t of null!==(n=o.innerBlocks)&&void 0!==n?n:[]){var n,r;"tableberg/text"!==t.name&&"tableberg/list"!==t.name||l.updateBlockAttributes(t.clientId,{styles:{...null!==(r=t.attributes?.styles)&&void 0!==r?r:{},...void 0!==e.textColor?{textColor:e.textColor}:{},...void 0!==e.linkColor?{linkColor:e.linkColor}:{},...void 0!==e.fontSize?{fontSize:e.fontSize}:{}}})}}})},ae=Ai({styleKey:"verticalAlign",defaultValue:qi.verticalAlign,hasValue:e=>e!==qi.verticalAlign,label:(0,i.__)("Common Elements Vertical Alignment","tableberg"),labelSelected:(0,i.__)("Elements Vertical Alignment","tableberg")}),{headerBackgroundColorControl:se,evenRowBackgroundColorControl:ie,oddRowBackgroundColorControl:ce,footerBackgroundColorControl:ue}=function(){const e=ds(e=>e.table),t=ds(e=>e.cellDefaults.styles),n=ds(e=>e.updateCellGlobalStyles),l=(e,l)=>({label:e,value:t[l],onChange:e=>{n({[l]:e})},onDeselect:()=>{n({[l]:""})}});return{headerBackgroundColorControl:e.headerEnabled?l((0,i.__)("Header Background Color","tableberg"),"headerBackgroundColor"):null,evenRowBackgroundColorControl:l((0,i.__)("Even Row Background Color","tableberg"),"evenRowBackgroundColor"),oddRowBackgroundColorControl:l((0,i.__)("Odd Row Background Color","tableberg"),"oddRowBackgroundColor"),footerBackgroundColorControl:e.footerEnabled?l((0,i.__)("Footer Background Color","tableberg"),"footerBackgroundColor"):null}}();return x?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(me.BlockControls,{children:[(0,J.jsx)(ot,{title:(0,i.__)("Align table","tableberg"),value:"wide"===R||"full"===R?R:T?B:void 0,controls:[{icon:Ke,title:(0,i.__)("None","tableberg"),value:void 0},...$i.map(e=>({...e,isDisabled:!T})),{icon:et,title:(0,i.__)("Wide width","tableberg"),value:"wide"},{icon:tt,title:(0,i.__)("Full width","tableberg"),value:"full"}],onChange:e=>{"wide"!==e&&"full"!==e?e?T&&p({tableAlignment:e}):p({tableWidth:"auto"}):p({tableWidth:e})}}),(0,J.jsxs)(c.ToolbarGroup,{children:[(0,J.jsx)(c.ToolbarButton,{onClick:()=>{const e=!y;C(e),e||""===w.trim()||p({caption:""})},icon:Cn,isPressed:y,label:y?(0,i.__)("Remove caption","tableberg"):(0,i.__)("Add caption","tableberg")}),(0,J.jsx)(c.ToolbarButton,{onClick:()=>{!function(e,t){if(e.length<2)return;if(!Mi(e,t.cells))return void console.warn("Cells are not mergeable");const n=[...e].sort((e,t)=>{const[n,l]=fe(e),[o,r]=fe(t);return n===o?l-r:n-o})[0],[l,o]=fe(n);let r=l,a=l,s=o,i=o;for(const n of e){const[e,l]=fe(n),o=Oi(t.cells,n);r=Math.min(r,e),a=Math.max(a,e+o.rowSpan-1),s=Math.min(s,l),i=Math.max(i,l+o.colSpan-1)}const c=a-r+1,u=i-s+1,d=new Set(e),h={...t.cells};Object.keys(h).forEach(e=>{d.has(e)&&e!==n&&delete h[e]}),h[n]={...h[n]||{},span:{rowSpan:c,colSpan:u}},t.setCells(h),t.setSelectedCells([n])}(m,v)},title:"Merge Cells",icon:Es,disabled:!Mi(m,v.cells)})]})]}),(0,J.jsx)(me.InspectorControls,{children:(0,J.jsx)(c.TabPanel,{className:"tableberg-sidebar-tabs",initialTabName:"settings",onSelect:e=>{"settings"!==e&&"styles"!==e&&"datatable"!==e||k(e)},tabs:[{name:"settings",title:(0,i.__)("Settings","tableberg"),icon:Ei},{name:"styles",title:(0,i.__)("Styles","tableberg"),icon:Cs},{name:"datatable",title:(0,i.__)("Datatable","tableberg"),icon:Es}],children:()=>null})}),0===m.length?(0,J.jsx)(Zi,{label:(0,i.__)("Additional CSS class(es)","tableberg"),value:b.className,onChange:e=>{p({className:e||""})}}):(0,J.jsx)(Zi,{label:(0,i.__)("Additional CSS class(es)","tableberg"),value:m.every(e=>(g[e]?.className||"")===(g[m[0]]?.className||""))?g[m[0]]?.className:"",onChange:e=>{const t=e||"";f(Object.fromEntries(Object.entries(g).map(([e,n])=>m.includes(e)?[e,{...n,className:t}]:[e,n])))}}),"settings"===_&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(me.InspectorControls,{children:(0,J.jsxs)(c.PanelBody,{title:(0,i.__)("Table Width","tableberg"),children:[(0,J.jsxs)(c.__experimentalToggleGroupControl,{label:(0,i.__)("Width Mode","tableberg"),value:R,onChange:e=>{"string"==typeof e&&e&&("fixed"!==e?"auto"!==e&&"wide"!==e&&"full"!==e||p({tableAlignment:B,tableWidth:e}):p({tableAlignment:B,tableWidth:"fixed"===R?P:Wi}))},isBlock:!0,children:[(0,J.jsx)(c.__experimentalToggleGroupControlOption,{value:"auto",label:(0,i.__)("Auto","tableberg")}),(0,J.jsx)(c.__experimentalToggleGroupControlOption,{value:"fixed",label:(0,i.__)("Fixed","tableberg")}),(0,J.jsx)(c.__experimentalToggleGroupControlOption,{value:"wide",label:(0,i.__)("Wide","tableberg")}),(0,J.jsx)(c.__experimentalToggleGroupControlOption,{value:"full",label:(0,i.__)("Full","tableberg")})]}),T&&(0,J.jsx)(Oe,{label:(0,i.__)("Table Width","tableberg"),value:E,onChange:e=>{p({tableWidth:e?e.trim():Wi})}})]})}),(0,J.jsx)(me.InspectorControls,{children:(0,J.jsxs)(c.PanelBody,{title:(0,i.__)("Cell Elements","tableberg"),children:[null!=n?n:(0,J.jsx)(Pa,{isEnhanced:!0,selected:"cell-orientation",children:(0,J.jsx)(c.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,label:(0,i.__)("Common Elements Orientation","tableberg"),value:"vertical",isBlock:!0,onChange:()=>null,children:Ki.map(({value:e,icon:t,label:n})=>(0,J.jsx)(c.__experimentalToggleGroupControlOptionIcon,{value:e,icon:t,label:n},e))})}),(0,J.jsx)(Te,{label:Y.label,value:Y.value,onChange:e=>{Y.onChange(e)}}),(0,J.jsx)(c.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,label:oe.label,value:oe.value,isBlock:!0,onChange:e=>{"left"!==e&&"center"!==e&&"right"!==e||oe.onChange(e)},children:Yi.map(({value:e,icon:t,label:n})=>(0,J.jsx)(c.__experimentalToggleGroupControlOptionIcon,{value:e,icon:t,label:n},e))}),(0,J.jsx)(c.__experimentalToggleGroupControl,{__nextHasNoMarginBottom:!0,label:ae.label,value:ae.value,isBlock:!0,onChange:e=>{"top"!==e&&"middle"!==e&&"bottom"!==e||ae.onChange(e)},children:Ji.map(({value:e,icon:t,label:n})=>(0,J.jsx)(c.__experimentalToggleGroupControlOptionIcon,{value:e,icon:t,label:n},e))})]})}),(0,J.jsx)(me.InspectorControls,{children:(0,J.jsxs)(c.PanelBody,{title:(0,i.__)("Header & Footer Settings","tableberg"),children:[(0,J.jsx)(c.ToggleControl,{checked:b.headerEnabled,label:(0,i.__)("Make Top Row Header","tableberg"),onChange:e=>{p({headerEnabled:e})}}),(0,J.jsx)(c.ToggleControl,{checked:b.footerEnabled,label:(0,i.__)("Make Bottom Row Footer","tableberg"),onChange:e=>{p({footerEnabled:e})}}),null!=e?e:(0,J.jsx)(Pa,{isEnhanced:!0,selected:"sticky-top-row",children:(0,J.jsx)(c.ToggleControl,{checked:!1,label:(0,i.__)("Sticky Header","tableberg"),help:(0,i.__)("Available in Tableberg Pro.","tableberg"),onChange:()=>null})}),null!=t?t:(0,J.jsx)(Pa,{isEnhanced:!0,selected:"sticky-first-col",children:(0,J.jsx)(c.ToggleControl,{checked:!1,label:(0,i.__)("Sticky First Column","tableberg"),help:(0,i.__)("Available in Tableberg Pro.","tableberg"),onChange:()=>null})})]})}),(0,J.jsx)(oc,{}),(0,J.jsx)(Gi,{})]}),"styles"===_&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(me.InspectorControls,{children:(0,J.jsxs)(c.__experimentalToolsPanel,{label:(0,i.__)("Colors","tableberg"),resetAll:Qi,panelId:d,className:"tableberg-colors-tools-panel",style:{gap:"0"},children:[m.length>0&&!s?(0,J.jsx)(Pa,{isEnhanced:!0,selected:"cell-bg",children:(0,J.jsx)(ke,{...K})}):(0,J.jsx)(ke,{...K}),se&&(0,J.jsx)(ke,{...se}),(0,J.jsx)(ke,{...ie}),(0,J.jsx)(ke,{...ce}),ue&&(0,J.jsx)(ke,{...ue}),(0,J.jsx)(ke,{label:(0,i.__)("All Elements' Text Color","tableberg"),value:le.textColor,onChange:e=>{re({textColor:e||""})},onDeselect:()=>{re({textColor:ln.styles.textColor})}}),(0,J.jsx)(ke,{label:(0,i.__)("All Elements' Link Color","tableberg"),value:le.linkColor,onChange:e=>{re({linkColor:e||""})},onDeselect:()=>{re({linkColor:""})}})]})}),(0,J.jsx)(me.InspectorControls,{children:(0,J.jsx)(c.__experimentalToolsPanel,{label:(0,i.__)("Typography","tableberg"),panelId:d,resetAll:()=>{p({typography:{...Me}}),re({fontSize:""})},children:(0,J.jsx)(Ue,{panelId:d,value:M,onChange:e=>{p({typography:{...M,...e}}),void 0!==e.fontSize&&re({fontSize:""})}})})}),(0,J.jsx)(me.InspectorControls,{children:(0,J.jsxs)(c.__experimentalToolsPanel,{label:(0,i.__)("Dimensions","tableberg"),resetAll:Qi,panelId:d,children:[(0,J.jsx)("div",{className:"tableberg-border-mode-controls",children:null!=l?l:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Pa,{isEnhanced:!0,selected:"row-only-border",children:(0,J.jsx)(c.ToggleControl,{checked:!1,label:(0,i.__)("Row Only Border","tableberg"),onChange:()=>null})}),(0,J.jsx)(Pa,{isEnhanced:!0,selected:"column-only-border",children:(0,J.jsx)(c.ToggleControl,{checked:!1,label:(0,i.__)("Column Only Border","tableberg"),onChange:()=>null})})]})}),(0,J.jsx)(we,{...V}),(0,J.jsx)(we,{...W}),(0,J.jsx)(_e,{...Q}),(0,J.jsx)(Pe,{...U}),(0,J.jsx)(Pe,{label:(0,i.__)("Cell Spacing","tableberg"),value:ec({horizontal:D,vertical:L}),hasValue:()=>D!==O.horizontal||L!==O.vertical,onChange:e=>{p({cellSpacing:tc(e,{horizontal:D,vertical:L},O)})},onDeselect:()=>{p({cellSpacing:{...O}})}}),(0,J.jsx)(Pe,{...G}),(0,J.jsx)(Pe,{...$})]})})]}),"datatable"===_&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(nc,{ProColumnSortingContent:o}),(0,J.jsx)(lc,{ProPaginationContent:a}),null!=r?r:(0,J.jsx)(me.InspectorControls,{children:(0,J.jsx)(Pa,{isEnhanced:!0,selected:"search",children:(0,J.jsx)(c.__experimentalToolsPanel,{label:(0,i.__)("Search","tableberg"),resetAll:()=>null,children:(0,J.jsx)(c.__experimentalToolsPanelItem,{label:(0,i.__)("Enable Search","tableberg"),hasValue:()=>!1,onDeselect:()=>null,isShownByDefault:!0,children:(0,J.jsx)(c.ToggleControl,{checked:!1,label:(0,i.__)("Enable Search","tableberg"),onChange:()=>null})})})})})]}),S&&(0,J.jsx)(ka,{onClose:()=>j(!1),selected:"duplicate-row-col"})]})};function ac({isSelected:e}){const t=ds(e=>e.table.caption||""),n=ds(e=>e.updateTable),l=ds(e=>e.showCaption),o=ds(e=>e.setShowCaption);return(0,u.useEffect)(()=>{""===t.trim()||l||o(!0)},[t,l,o]),(0,u.useEffect)(()=>{!e&&""===t.trim()&&l&&o(!1)},[e,t,o,l]),l||""!==t.trim()?(0,J.jsx)(me.RichText,{tagName:"figcaption",className:"tableberg-table-caption wp-element-caption","aria-label":(0,i.__)("Table caption text","tableberg"),placeholder:(0,i.__)("Add caption","tableberg"),value:t,onChange:e=>{n({caption:e})}}):null}function sc(){const e=tn(),t=ds(e=>e.searchTerm),n=ds(e=>e.setSearchTerm),l=ds(e=>e.table),o=ds(e=>e.cells),r=l.search;if(!e||!r?.enabled)return null;const a=r.placeholder,s=r.position||"left",c=t.trim()?function(e,t,n,l,o){let r=Bt(e,t,n,l,o).length;return l.headerEnabled&&r--,l.footerEnabled&&r--,Math.max(0,r)}(o,l.rows,l.cols,l,t):null;return(0,J.jsxs)("div",{className:"tableberg-search",style:{justifyContent:"right"===s?"flex-end":"flex-start"},children:[(0,J.jsxs)("div",{className:"tableberg-search__input-wrapper",children:[(0,J.jsxs)("svg",{className:"tableberg-search__icon",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,J.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,J.jsx)("path",{d:"M21 21l-4.35-4.35"})]}),(0,J.jsx)("input",{type:"text",className:"tableberg-search__input",placeholder:a,value:t,onChange:e=>n(e.target.value)}),t&&(0,J.jsx)("button",{type:"button",className:"tableberg-search__clear",onClick:()=>{n("")},"aria-label":(0,i.__)("Clear search","tableberg"),children:(0,J.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:(0,J.jsx)("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})})})]}),null!==c&&(0,J.jsx)("span",{className:"tableberg-search__results",children:0===c?(0,i.__)("No results found","tableberg"):/* translators: %d is the number of matching rows */ /* translators: %d is the number of matching rows */
2 +(0,i.sprintf)((0,i._n)("%d result","%d results",c,"tableberg"),c)})]})}function ic({filteredRowCount:e}){const t=tn(),n=ds(e=>e.currentPage),l=ds(e=>e.setCurrentPage),o=ds(e=>e.table),r=o.pagination,{enabled:a,pageSize:s,showPageNumbers:c,showPrevNext:u}=r;if(!t||!a)return null;const d=Na(null!=e?e:o.rows,s,o.headerEnabled,o.footerEnabled);if(d<=1)return null;const h=n>0,b=n<d-1,g="tableberg-pagination__button";return(0,J.jsxs)("div",{className:"tableberg-pagination",children:[u&&(0,J.jsx)("button",{type:"button",disabled:!h,onClick:()=>l(n-1),className:`${g} ${g}--arrow`,"aria-label":(0,i.__)("Previous Page","tableberg"),children:(0,J.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:(0,J.jsx)("path",{d:"M14.6 7L10 12l4.6 5-1.4 1.4L6.8 12l6.4-6.4z"})})}),c&&(()=>{const e=[];if(d<=5)for(let t=0;t<d;t++)e.push(t);else{e.push(0),n>2&&e.push("ellipsis");const t=Math.max(1,n-1),l=Math.min(d-2,n+1);for(let n=t;n<=l;n++)e.includes(n)||e.push(n);n<d-3&&e.push("ellipsis"),e.includes(d-1)||e.push(d-1)}return e})().map((e,t)=>{if("ellipsis"===e)return(0,J.jsx)("span",{className:"tableberg-pagination__ellipsis",children:"..."},`ellipsis-${t}`);const o=n===e;return(0,J.jsx)("button",{type:"button",onClick:()=>l(e),className:`${g}${o?` ${g}--active`:""}`,children:e+1},e)}),u&&(0,J.jsx)("button",{type:"button",disabled:!b,onClick:()=>l(n+1),className:`${g} ${g}--arrow`,"aria-label":(0,i.__)("Next Page","tableberg"),children:(0,J.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:(0,J.jsx)("path",{d:"M9.4 7l4.6 5-4.6 5 1.4 1.4 6-6.4-6-6.4z"})})})]})}var cc=(0,J.jsx)(Re.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(Re.Path,{d:"M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z"})});const uc=window.wp.keycodes;function dc({item:e,onSelect:t}){const[n,l]=(0,u.useState)(!1),o=()=>{e.disabled||(e.isLocked?l(!0):t(e))};return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)("div",{className:"tableberg-cell-inserter__list-item",children:(0,J.jsxs)(c.Button,{className:"tableberg-cell-inserter__item",onClick:o,onKeyDown:t=>{t.keyCode!==uc.ENTER||e.disabled||(t.preventDefault(),o())},disabled:e.disabled,label:e.title,children:[(0,J.jsx)("span",{className:"tableberg-cell-inserter__item-icon",children:e.icon}),(0,J.jsx)("span",{className:"tableberg-cell-inserter__item-title",children:e.title})]})}),n&&(0,ja.createPortal)((0,J.jsx)(Sa,{selected:e.upsellSelected,onClose:()=>l(!1)}),document.body)]})}function hc({items:e,onSelect:t}){return(0,J.jsx)("div",{className:"tableberg-cell-inserter__list",children:e.map(e=>(0,J.jsx)(dc,{item:e,onSelect:t},e.name))})}const bc=[{name:"text",title:"Text",icon:(0,J.jsx)("svg",{height:24,width:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,J.jsx)("path",{d:"M5 5V7H10V19H12V7H17V5H5Z",fill:"#671FEB"})})},{name:"button",title:"Button",icon:st},{name:"image",title:"Image",icon:it},{name:"list",title:"List",icon:ct}];function gc(){const e=tn()?[]:[{name:"styled-list",title:"Styled List",icon:ct,isLocked:!0,upsellSelected:"tableberg/styled-list"},{name:"icon",title:"Icon",icon:ba,isLocked:!0,upsellSelected:"tableberg/icon"},{name:"star-rating",title:"Star Rating",icon:fa,isLocked:!0,upsellSelected:"tableberg/star-rating"},{name:"custom-html",title:"Custom HTML",icon:ha,isLocked:!0,upsellSelected:"tableberg/html"}];return[...bc,...e,...ht().map(e=>({name:e.name,title:e.title,icon:e.icon}))]}function pc({items:e,onSelect:t,onClose:n}){const[l,o]=(0,u.useState)(""),{setIsInserterOpened:r}=(0,h.useDispatch)(ae.store),a=(0,u.useMemo)(()=>{const t=l.toLowerCase().trim();return t?e.filter(e=>e.title.toLowerCase().includes(t)).slice(0,6):e.slice(0,6)},[e,l]);return(0,J.jsxs)("div",{className:"tableberg-cell-inserter__content",children:[(0,J.jsx)(c.SearchControl,{className:"tableberg-cell-inserter__search",value:l,onChange:o,label:(0,i.__)("Search","tableberg"),placeholder:(0,i.__)("Search","tableberg")}),(0,J.jsx)(hc,{items:a,onSelect:t}),(0,J.jsx)(c.Button,{className:"tableberg-cell-inserter__browse-all",onClick:()=>{n(),r(!0)},children:(0,i.__)("Browse all","tableberg")})]})}function fc({items:e,onSelect:t,onOpenChange:n}){const[l,o]=(0,u.useState)(!1);return(0,u.useEffect)(()=>{n?.(l)},[l,n]),(0,J.jsx)(c.Dropdown,{className:"tableberg-cell-inserter",contentClassName:"tableberg-cell-inserter__popover",popoverProps:{placement:"bottom-end"},onToggle:o,renderToggle:({isOpen:e,onToggle:t})=>(0,J.jsx)(c.Button,{className:"tableberg-cell-inserter__toggle",icon:cc,label:(0,i.__)("Add element","tableberg"),onClick:e=>{e.stopPropagation(),t()},"aria-expanded":e}),renderContent:({onClose:n})=>(0,J.jsx)(pc,{items:e,onSelect:e=>{t(e),n()},onClose:n})})}function mc(e,t){return(0,dt.applyFilters)("tableberg.renderCellRibbon",null,e,t)}gc();const vc=ge.cellDefaults.styles,xc={top:"flex-start",middle:"center",bottom:"flex-end"};function yc(e,t){const n=function(e){const t=e.closest(".tableberg-editor-shell[id^='block-']");return t?.id.replace(/^block-/,"")||null}(e);n&&t(n)}function Cc(e,t,n){const l=je()(t,e?.className);return{...e||{},...l?{className:l}:{},style:{...e?.style||{},...n}}}function wc({span:e,cellCoords:t}){var n,l;const[o,r]=fe(t),a=ds(e=>e.getCellStyle)(t),s=tn(),c=ds(e=>s&&e.table.innerBorderType||""),d=ds(e=>e.table.rows),b=ds(e=>e.table.cols),g={position:"relative"},p=ds(e=>e.cellDefaults.styles.padding);!function(){let e;e=p,a?.padding&&(e=a?.padding),g.paddingTop=e?.top,g.paddingRight=e?.right,g.paddingBottom=e?.bottom,g.paddingLeft=e?.left}();const f=ds(e=>e.cellDefaults.styles.border);!function(){let e;e=f,a?.border&&(e=a?.border),g.borderTop=e?.top,g.borderRight=e?.right,g.borderBottom=e?.bottom,g.borderLeft=e?.left}(),"row"===c?(g.borderLeft=void 0,g.borderRight=void 0,0===o&&(g.borderTop=void 0),o+e.rowSpan>=d&&(g.borderBottom=void 0)):"col"===c&&(g.borderTop=void 0,g.borderBottom=void 0,0===r&&(g.borderLeft=void 0),r+e.colSpan>=b&&(g.borderRight=void 0)),function(){const e=a?.borderRadius;g.borderTopLeftRadius=e?.topLeft,g.borderTopRightRadius=e?.topRight,g.borderBottomRightRadius=e?.bottomRight,g.borderBottomLeftRadius=e?.bottomLeft}();const m=ds(e=>e.cellDefaults.styles),v=ds(e=>e.table.headerEnabled),x=ds(e=>e.table.footerEnabled);let y="";y=v&&0===o?m.headerBackgroundColor:x&&o===d-1?m.footerBackgroundColor:(v?o-1:o)%2==0?m.oddRowBackgroundColor:m.evenRowBackgroundColor,g.backgroundColor=y||m.backgroundColor,a?.backgroundColor&&(g.backgroundColor=a?.backgroundColor);const C=ds(e=>e.cellDefaults.styles.orientation),w=a?.orientation||(s?C:void 0)||vc.orientation,_=ds(e=>e.cellDefaults.styles.wrap),k=a?.wrap||(s?_:void 0)||vc.wrap,S=ds(e=>e.cellDefaults.styles.elementGap),j=null!==(n=null!==(l=a?.elementGap)&&void 0!==l?l:S)&&void 0!==n?n:vc.elementGap,B=ds(e=>e.cellDefaults.styles.verticalAlign),P=a?.verticalAlign||B||vc.verticalAlign;g.verticalAlign=P;const R=ds(e=>e.selectedCells.includes(t));R&&(g.boxShadow="inset 0 0 0 2px var(--wp-admin-theme-color)");const I=(0,me.useBlockProps)(),T=0===o,E=o===ds(e=>e.table.rows)-1,O=ds(e=>{var t;return null!==(t=e.table.stickyHeader)&&void 0!==t&&t}),M=T&&v;s&&O&&M&&(g.position="sticky",g.top="0",g.zIndex=2,g.backgroundColor||(g.backgroundColor="#fff"));const A=ds(e=>e.sortPreviewMode),D=ds(e=>e.tableEditPreview),L=ds(e=>e.previewSortColumn),F=ds(e=>e.previewSortOrder),N=ds(e=>e.togglePreviewSort),V=ds(e=>e.columns),H=ds(e=>e.rows),z=ds(e=>e.table),G=ds(e=>{var t;return null===(t=e.table.fixedColumnWidths)||void 0===t||t}),Z=s&&M&&!!V[r]?.sortable,q=L===r,$=e.colSpan>1?void 0:G&&z.cols>0?100/z.cols+"%":V[r]?.width;$&&(g.width=$,g.minWidth=$);const W=e.rowSpan>1?void 0:H[o]?.height;W&&(g.height=W,g.minHeight=W);let Q="td";M&&(Q="th"),E&&x&&(Q="th");const U=ds(e=>e.cells),K=ds(e=>e.addElementToCell),Y=ds(e=>e.getCellRibbon)(t),X=ds(e=>e.setSelectedCells),ee=ds(e=>e.addSelectedCells),te=ds(e=>e.clearSelectedElement),{selectBlock:ne}=(0,h.useDispatch)(me.store),le=Yt(),oe=U[t]?.elements||[],re=U[t]?.className||"",[ae,se]=(0,u.useState)(!1),[ie,ce]=(0,u.useState)(!1),ue=!A&&(ae||R||ie),de=A&&M&&Z?{cursor:"pointer"}:{},he=D&&"row"===D.target?D.index:null,be=D&&"column"===D.target?D.index:null,ge="delete"===D?.operation,pe="duplicate"===D?.operation,ve="insert"===D?.operation||"duplicate"===D?.operation,xe=o,ye=o+e.rowSpan-1,Ce=r,we=r+e.colSpan-1,_e=null!==he&&he>=0&&he<z.rows&&he>=xe&&he<=ye,ke=null!==be&&be>=0&&be<z.cols&&be>=Ce&&be<=we,Se=pe&&null!==he?Math.max(0,Math.min(he-1,z.rows-1)):null,Be=pe&&null!==be?Math.max(0,Math.min(be-1,z.cols-1)):null,Pe=gc(),Re=null!==Se&&Se>=xe&&Se<=ye,Ie=null!==Be&&Be>=Ce&&Be<=we,Te=ve&&null!==he&&he>=0&&he<z.rows&&xe===he,Ee=ve&&null!==be&&be>=0&&be<z.cols&&Ce===be,Oe=ve&&he===z.rows&&ye===z.rows-1,Me=ve&&be===z.cols&&we===z.cols-1,Ae=Cc(R?I:void 0,je()(re,{"is-selected":R,"tableberg-sortable-header":M&&Z,"tableberg-cell-preview-delete-row":ge&&_e,"tableberg-cell-preview-delete-column":ge&&ke,"tableberg-cell-preview-duplicate-source-row":pe&&Re,"tableberg-cell-preview-duplicate-source-column":pe&&Ie,"tableberg-cell-preview-insert-row-boundary":Te,"tableberg-cell-preview-insert-column-boundary":Ee,"tableberg-cell-preview-insert-row-end":Oe,"tableberg-cell-preview-insert-column-end":Me}),{...g,...de});return(0,J.jsxs)(Q,{...Ae,rowSpan:e.rowSpan,colSpan:e.colSpan,"data-sortable":s&&M?V[r]?.sortable:void 0,onMouseEnter:()=>se(!0),onMouseLeave:()=>se(!1),onClick:e=>{if(A)return void(M&&Z&&N(r));const{ctrlKey:n,metaKey:l,shiftKey:o}=e;if(n||l||o)return yc(e.currentTarget,ne),te(),ee([t]),void le(e.currentTarget,"Multiple Cells","Tableberg Cells: Individual cells of a tableberg table");yc(e.currentTarget,ne),te(),X([t]),le(e.currentTarget,"Cell","Tableberg Cell: Individual cell of a tableberg table")},children:[(0,J.jsx)(_c,{cellElements:oe,cellCoords:t,orientation:w,elementGap:j,wrap:k,verticalAlign:P}),M&&Z?A?(0,J.jsx)("span",{className:je()("tableberg-sort-indicator",{"tableberg-sort-indicator--active":q}),style:{userSelect:"none"},title:q?(0,i.__)("Click to change sort order","tableberg"):(0,i.__)("Click to sort by this column","tableberg"),children:q?"asc"===F?"▲":"▼":"▲▼"}):(0,J.jsx)("span",{className:"tableberg-sort-indicator",style:{color:"#a0a0a0",userSelect:"none"},title:(0,i.__)("Sorting enabled. Use Preview Sorting to test.","tableberg"),children:"▲▼"}):null,Y&&mc(Y,t),ue&&(0,J.jsx)(fc,{items:Pe,onSelect:e=>{const n=Ma(e.name);n&&K(t,n)},onOpenChange:ce})]})}function _c({cellElements:e,cellCoords:t,orientation:n,elementGap:o,wrap:r,verticalAlign:i}){const c=ds(e=>e.isElementSelected),u=(0,me.useBlockProps)(),d="horizontal"===n,h=function(e){if(0===e.length)return l;const t=s(e[0]);for(let n=1;n<e.length;n++)if(s(e[n])!==t)return;return t}(e),b={display:"flex",flexDirection:d?"row":"column",justifyContent:d?a(h||"left"):xc[i],alignItems:d?xc[i]:"stretch",gap:o,flexWrap:r};return(0,J.jsx)("div",{className:je()("tableberg-cell-elements",{"tableberg-cell-elements-horizontal":d}),style:b,children:e.map((e,n)=>{const l=c(t,n);let o;switch(e.name){case"text":o=(0,J.jsx)(rn,{attributes:e.attributes,bindings:e.bindings,cellCoords:t,elementIndex:n},n);break;case"button":o=(0,J.jsx)(mn,{attributes:e.attributes,bindings:e.bindings,cellCoords:t,elementIndex:n},n);break;case"image":o=(0,J.jsx)(On,{attributes:e.attributes,bindings:e.bindings,cellCoords:t,elementIndex:n},n);break;case"list":o=(0,J.jsx)(Ta,{attributes:e.attributes,bindings:e.bindings,cellCoords:t,elementIndex:n},n);break;default:o=function(e,t,n){var l;return null!==(l=bt(e.name)?.render({element:e,cellCoords:t,elementIndex:n}))&&void 0!==l?l:null}(e,t,n)}return(0,J.jsx)(kc,{cellCoords:t,element:e,elementIndex:n,isHorizontal:d,isSelected:l,selectedBlockProps:u,children:o},n)})})}function kc({children:e,cellCoords:t,element:n,elementIndex:l,isHorizontal:o,isSelected:r,selectedBlockProps:i}){const c=ds(e=>e.sortPreviewMode),u=ds(e=>e.setSelectedElement),d=ds(e=>e.addSelectedCells),b=ds(e=>e.clearSelectedElement),g=Yt(),{selectBlock:p}=(0,h.useDispatch)(me.store),f=Cc(r?i:void 0,je()("tableberg-cell-element",{"is-selected":r}),{display:"flex",justifyContent:a(s(n)),width:o?void 0:"100%"});return(0,J.jsx)("div",{...f,onClickCapture:e=>{if(e.ctrlKey||e.metaKey||e.shiftKey)return e.preventDefault(),e.stopPropagation(),yc(e.currentTarget,p),b(),void d([t]);c||(yc(e.currentTarget,p),u(t,l),g(e.currentTarget,n.name,`A ${n.name} element within a Tableberg cell`))},onClick:e=>{e.stopPropagation()},children:e})}function Sc(){const e=ds(e=>e.sortPreviewMode),t=ds(e=>e.exitSortPreviewMode);return e?(0,J.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",backgroundColor:"#f0f0f1",borderBottom:"1px solid #c3c4c7",fontSize:"13px"},children:[(0,J.jsx)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:(0,J.jsx)("span",{style:{fontWeight:500,color:"#1e1e1e"},children:(0,i.__)("Sort Preview Mode","tableberg")})}),(0,J.jsx)(c.Button,{variant:"secondary",onClick:t,children:(0,i.__)("Exit Sorting Preview","tableberg")})]}):null}const jc=ge.table,Bc=/^0(?:\.0+)?(?:[a-z%]+)?$/i;function Pc(e){const t=e?.trim()||"";return!!t&&!Bc.test(t)}function Rc(e){const t=e.trim();if(!t)return!1;const[n="",l=""]=t.split(/\s+/,3);return"none"!==n&&"hidden"!==n&&!Bc.test(n)&&"none"!==l&&"hidden"!==l}const Ic=()=>{const e=tn(),t=ds(e=>e.table),n=ds(e=>e.cells),l=ds(e=>e.columns),o=ds(e=>e.getCellSpan),r=ds(e=>e.cellDefaults.styles.borderRadius),a=ds(e=>e.sortPreviewMode),s=ds(e=>e.previewSortColumn),i=ds(e=>e.previewSortOrder),c=ds(e=>e.currentPage),d=ds(e=>e.setCurrentPage),b=ds(e=>e.table.pagination),g=ds(e=>e.searchTerm),p=ds(e=>e.table.search),f=(0,h.useSelect)(e=>{const t=e("core/editor"),n=e("core/edit-site"),l=e("core/edit-post");return function(e){const t=(e||"desktop").toLowerCase();return"tablet"===t?"tablet":"mobile"===t?"mobile":"desktop"}(t?.getDeviceType?.()||n?.__experimentalGetPreviewDeviceType?.()||l?.__experimentalGetPreviewDeviceType?.())},[]),{rows:m,cols:v}=t,x=e&&b.enabled,y=e&&(p?.enabled||!1),C=t.tableAlignment||"left",w=(t.tableWidth||"auto").trim(),_="auto"!==w&&"wide"!==w&&"full"!==w,k=_?w:"100%",S=_?`justify-table-${C}`:"",j=jc.cellSpacing,B=t.cellSpacing||j,P=jc.tableBorder,R=t.tableBorder||P,I=Rc(R.top),T=Rc(R.right),E=Rc(R.bottom),O=Rc(R.left),M=B.horizontal||j.horizontal,A=B.vertical||j.vertical,D="0"===M,L="0"===A,F=!D||!L,N=["wp-block-tableberg",I?"tableberg-has-table-border-top":"",T?"tableberg-has-table-border-right":"",E?"tableberg-has-table-border-bottom":"",O?"tableberg-has-table-border-left":"",F?"tableberg-has-cell-spacing":"",F&&D?"tableberg-cell-spacing-horizontal-zero":"",F&&L?"tableberg-cell-spacing-vertical-zero":""].filter(Boolean).join(" "),V="desktop"===f?null:function(e,t){const n={...t,...e||{}};return n.transpose="boolean"==typeof e?.transpose?e.transpose:"row"===e?.direction,n.repeatFirstCol="boolean"==typeof e?.repeatFirstCol?e.repeatFirstCol:!!e?.headerAsCol,n}(t.responsive?.[f],jc.responsive[f]),H=!!V?.enabled&&!!V?.mode,z=H&&"scroll"===V?.mode?"tableberg-scroll-x":"",G=H?Math.max(1,V?.stackCount||1):1,Z=H&&"stack"===V?.mode&&parseFloat(M)>parseFloat(A)?M:A,q=je()("tableberg-table-wrapper",S,z),$=(0,u.useMemo)(()=>y&&g.trim()?Bt(n,m,v,t,g):Array.from({length:m},(e,t)=>t),[y,g,n,m,v,t]),W=(0,u.useMemo)(()=>{if(!e||!a||null===s)return $;const o=l[s]?.sortable||"text";if(y&&g.trim()){const{headerEnabled:e,footerEnabled:l}=t,r=e?0:-1,a=l?m-1:-1,c=$.filter(e=>e!==r&&e!==a).map(e=>{const t=n[`${e},${s}`]?.elements||[],l=t.length>0?Oa(t[0]):"";let r;switch(o){case"number":{const e=l.replace(/[^0-9.-]/g,""),t=parseFloat(e);r=isNaN(t)?0:t;break}case"date":{const e=new Date(l);r=isNaN(e.getTime())?new Date(0):e;break}default:r=l.toLowerCase()}return{index:e,value:r}});c.sort(({value:e},{value:t})=>{let n;return n="number"==typeof e&&"number"==typeof t?e-t:e instanceof Date&&t instanceof Date?e.getTime()-t.getTime():String(e).localeCompare(String(t)),"asc"===i?n:-n});const u=[];e&&$.includes(0)&&u.push(0);for(const{index:e}of c)u.push(e);return l&&$.includes(m-1)&&u.push(m-1),u}return La(n,m,t,s,o,i)},[a,s,i,$,n,l,t,m,y,g,e]),Q=(0,u.useMemo)(()=>{let e=W;if(x){const{headerEnabled:n,footerEnabled:l}=t,o=n?0:-1,r=l?m-1:-1,a=e.filter(e=>e!==o&&e!==r),{pageSize:s}=b,i=c*s,u=Math.min(i+s,a.length),h=Math.max(0,Math.ceil(a.length/s)-1);c>h&&h>=0&&d(h);const g=[];n&&e.includes(0)&&g.push(0);for(let e=i;e<u;e++)g.push(a[e]);l&&e.includes(m-1)&&g.push(m-1),e=g}return e},[W,x,c,b.pageSize,t,m,d]),U=e=>{if(a||x)return new Set;const t=new Set;for(const[l,o]of Object.entries(n)){const n=o.span;if(!n)continue;const[r,a]=l.split(",").map(Number);if(r<=e&&r+n.rowSpan>e)for(let l=0;l<n.colSpan;l++)r!==e&&t.add(a+l)}return t},K=[],Y=[];for(const e of Q){const t=[],n=[],l=U(e);for(let r=0;r<v;r++){if(l.has(r))continue;const s=`${e},${r}`,i=o(s);if(!a&&!x)for(let e=1;e<i.colSpan;e++)l.add(r+e);n.push({coords:pe(e,r),span:i,key:s}),t.push((0,J.jsx)(wc,{span:i,cellCoords:s},s))}Y.push(n),K.push((0,J.jsx)("tr",{children:t},e))}let X=K;if(H&&"stack"===V?.mode){const e=function(e,t,n,l){if(0===e.length)return[];const o=e.reduce((e,t)=>Math.max(e,t.length),0);if(0===o)return[];const r=e.map(e=>{const t=e.map(e=>e);for(;t.length<o;)t.push(null);return t}),a=n?Array.from({length:o},(e,t)=>r.map(e=>e[t]||null)):r,s=a[0]?.length||0;if(0===s)return[];const i=l?Math.max(2,t):Math.max(1,t),c=[];if(!l){const e=Math.ceil(s/i);for(let t=0;t<e;t++){const e=t*i,n=Math.min(e+i,s);for(let t=0;t<a.length;t++){const l=a[t].slice(e,n).filter(e=>null!==e);l.length>0&&c.push(l)}}return c}const u=Math.max(1,i-1),d=s<=1?1:Math.ceil((s-1)/u);for(let e=0;e<d;e++){const t=1+e*u,n=Math.min(t+u,s);for(let l=0;l<a.length;l++){const o=a[l][0],r=a[l].slice(t,n).filter(e=>null!==e),s=[];o&&(0===e?s.push(o):s.push({...o,key:`${o.key}-repeat-${e}`,span:{rowSpan:1,colSpan:1}})),s.push(...r),s.length>0&&c.push(s)}}return c}(Y,G,V.transpose,V.repeatFirstCol);X=e.map((e,t)=>(0,J.jsx)("tr",{children:e.map((e,n)=>(0,J.jsx)(wc,{span:{rowSpan:1,colSpan:1},cellCoords:e.coords},`${e.key}-${t}-${n}`))},`responsive-preview-row-${t}`))}const ee=!!(Pc(r?.topLeft)||Pc(r?.topRight)||Pc(r?.bottomRight)||Pc(r?.bottomLeft)),te=ee?{borderTopLeftRadius:r?.topLeft,borderTopRightRadius:r?.topRight,borderBottomRightRadius:r?.bottomRight,borderBottomLeftRadius:r?.bottomLeft,borderTop:R.top||void 0,borderRight:R.right||void 0,borderBottom:R.bottom||void 0,borderLeft:R.left||void 0,boxSizing:"border-box",overflow:"hidden"}:void 0;return(0,J.jsxs)("div",{className:q,style:te,children:[(0,J.jsx)(sc,{}),(0,J.jsx)(Sc,{}),(0,J.jsx)("table",{className:N,"data-tableberg-editor-preview":H?f:void 0,style:{...De(t.typography),borderCollapse:F?"separate":"collapse",borderSpacing:F?`${M} ${Z}`:void 0,width:k,..._?{maxWidth:k}:{},borderTop:ee?void 0:R.top||void 0,borderRight:ee?void 0:R.right||void 0,borderBottom:ee?void 0:R.bottom||void 0,borderLeft:ee?void 0:R.left||void 0},children:(0,J.jsx)("tbody",{children:X})}),(0,J.jsx)(ic,{filteredRowCount:W.length})]})};function Tc(e){const t=[];for(const l of e){var n;if(!l.name.startsWith("tableberg/"))continue;const e=l.name.slice(10),{bindings:o,...r}=null!==(n=l.attributes)&&void 0!==n?n:{},a={name:e,attributes:r};o&&Object.keys(o).length>0&&(a.bindings=o),t.push(a)}return t}const Ec=new class{#z;#F;#u;#G;#Z;#q;#$;#W;constructor(e={}){this.#z=e.queryCache||new gi,this.#F=e.mutationCache||new fi,this.#u=e.defaultOptions||{},this.#G=new Map,this.#Z=new Map,this.#q=0}mount(){this.#q++,1===this.#q&&(this.#$=A.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#z.onFocus())}),this.#W=F.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#z.onOnline())}))}unmount(){this.#q--,0===this.#q&&(this.#$?.(),this.#$=void 0,this.#W?.(),this.#W=void 0)}isFetching(e){return this.#z.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#F.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#z.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=this.#z.build(this,t),l=n.state.data;return void 0===l?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(v(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(l))}getQueriesData(e){return this.#z.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){const l=this.defaultQueryOptions({queryKey:e}),o=this.#z.get(l.queryHash),r=o?.state.data,a=function(e,t){return"function"==typeof e?e(t):e}(t,r);if(void 0!==a)return this.#z.build(this,l).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return L.batch(()=>this.#z.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#z.get(t.queryHash)?.state}removeQueries(e){const t=this.#z;L.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){const n=this.#z;return L.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},l=L.batch(()=>this.#z.findAll(e).map(e=>e.cancel(n)));return Promise.all(l).then(p).catch(p)}invalidateQueries(e,t={}){return L.batch(()=>(this.#z.findAll(e).forEach(e=>{e.invalidate()}),"none"===e?.refetchType?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},l=L.batch(()=>this.#z.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(p)),"paused"===e.state.fetchStatus?Promise.resolve():t}));return Promise.all(l).then(p)}fetchQuery(e){const t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);const n=this.#z.build(this,t);return n.isStaleByTime(v(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(p).catch(p)}fetchInfiniteQuery(e){return e.behavior=vi(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(p).catch(p)}ensureInfiniteQueryData(e){return e.behavior=vi(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return F.isOnline()?this.#F.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#z}getMutationCache(){return this.#F}getDefaultOptions(){return this.#u}setDefaultOptions(e){this.#u=e}setQueryDefaults(e,t){this.#G.set(_(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#G.values()],n={};return t.forEach(t=>{k(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#Z.set(_(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#Z.values()],n={};return t.forEach(t=>{k(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#u.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=w(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===O&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#u.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#z.clear(),this.#F.clear()}}({defaultOptions:{queries:{gcTime:864e5,staleTime:1/0,refetchOnWindowFocus:!1}}}),Oc=/^0(?:\.0+)?(?:[a-z%]+)?$/i;function Mc(e){const t=e?.trim()||"";return!!t&&!Oc.test(t)}function Ac({onCreate:e}){const[t,n]=(0,u.useState)("4"),[l,o]=(0,u.useState)("4");return(0,J.jsx)(c.Placeholder,{icon:ga,label:(0,i.__)("Tableberg Table (native)","tableberg"),instructions:(0,i.__)("Choose the table size to get started.","tableberg"),children:(0,J.jsxs)("div",{style:{display:"flex",gap:"8px",alignItems:"flex-end"},children:[(0,J.jsx)(c.TextControl,{label:(0,i.__)("Rows","tableberg"),type:"number",min:1,value:t,onChange:n}),(0,J.jsx)(c.TextControl,{label:(0,i.__)("Columns","tableberg"),type:"number",min:1,value:l,onChange:o}),(0,J.jsx)(c.Button,{variant:"primary",onClick:()=>{const n=Math.max(1,parseInt(t,10)||0),o=Math.max(1,parseInt(l,10)||0);e(n,o)},children:(0,i.__)("Create Table","tableberg")})]})})}function Dc(e){var t,n;const{attributes:l,setAttributes:o,clientId:r}=e,{replaceInnerBlocks:a}=(0,h.useDispatch)(me.store),s=Object.fromEntries(Object.entries(e).filter(([e])=>e.startsWith("Pro"))),i=Boolean(e.ProStickyHeaderControl),c=(0,h.useSelect)(e=>e(me.store).getBlockCount(r)>0,[r]),d=ki(l)&&(null!==(t=l.table?.rows)&&void 0!==t?t:0)>0;(0,u.useEffect)(()=>{if(!d)return;const e=Bi(l);o(Si(l)),a(r,e,!1)},[d]);const b=l.table,g=(b?.tableWidth||"auto").trim(),p=i&&b?.innerBorderType||"",f=(0,h.useSelect)(e=>{var t;if("row"!==p&&"col"!==p)return"";const n=e(me.store),l=(null!==(t=n.getBlock(r)?.innerBlocks)&&void 0!==t?t:[]).filter(e=>"tableberg/row"===e.name).map(e=>e.innerBlocks.filter(e=>"tableberg/cell"===e.name).map(e=>{var t,n;return{id:e.clientId,rowSpan:null!==(t=e.attributes?.span?.rowSpan)&&void 0!==t?t:1,colSpan:null!==(n=e.attributes?.span?.colSpan)&&void 0!==n?n:1}})),o=Os(l),a={top:[],right:[],bottom:[],left:[]};return l.forEach(e=>{e.forEach(e=>{const t=o.anchors.get(e.id);if(!t)return;const n=`#block-${e.id}`;"row"===p?(a.left.push(n),a.right.push(n),0===t.row&&a.top.push(n),t.row+e.rowSpan>=l.length&&a.bottom.push(n)):(a.top.push(n),a.bottom.push(n),0===t.col&&a.left.push(n),t.col+e.colSpan>=o.cols&&a.right.push(n))})}),Object.keys(a).filter(e=>a[e].length>0).map(e=>`${a[e].join(",")} { border-${e}: none !important; }`).join("\n")},[r,p]),m=function(){const e=(0,u.useContext)(as);if(!e)throw new Error("useTableStoreApi must be used within TableStoreProvider");return e}(),v=(0,h.useSelect)(e=>{var t;const n=e(me.store),l=(null!==(t=n.getBlock(r)?.innerBlocks)&&void 0!==t?t:[]).filter(e=>"tableberg/row"===e.name).map(e=>e.innerBlocks.filter(e=>"tableberg/cell"===e.name).map(e=>{var t,n;return{id:e.clientId,rowSpan:null!==(t=e.attributes?.span?.rowSpan)&&void 0!==t?t:1,colSpan:null!==(n=e.attributes?.span?.colSpan)&&void 0!==n?n:1}}));return`${l.length},${l.length?Os(l).cols:0}`},[r]);(0,u.useEffect)(()=>{const[e,t]=v.split(",").map(Number),n=m.getState().table;e>0&&(n.rows!==e||n.cols!==t)&&m.setState({table:{...n,rows:e,cols:t}})},[v,m]);const x=ds(e=>e.sortPreviewMode),y=ds(e=>e.searchTerm),C=ds(e=>e.setSearchTerm),w=i&&!!l.table?.search?.enabled;(0,u.useEffect)(()=>{!w&&y&&C("")},[w]);const _=(0,h.useSelect)(e=>(e("core/editor")?.getDeviceType?.()||e("core/edit-site")?.__experimentalGetPreviewDeviceType?.()||e("core/edit-post")?.__experimentalGetPreviewDeviceType?.()||"Desktop").toLowerCase(),[]),k="desktop"!==_&&!!b?.responsive?.[_]?.enabled,S=!d&&(x||!!y.trim()||k),[j,B]=(0,u.useState)(!1);(0,u.useEffect)(()=>{var e;if(!S)return void B(!1);const t=(0,h.select)(me.store),n=function(e){const t={},n={},l=[],o=new Set;let r=0,a=0;for(const d of e){var s;if("tableberg/row"!==d.name)continue;const e=null!==(s=d.attributes)&&void 0!==s?s:{};l[a]=Object.keys(e).length>0?{...e}:null;let h=0;for(const e of d.innerBlocks){var i,c,u;if("tableberg/cell"!==e.name)continue;for(;o.has(`${a},${h}`);)h++;const l=null!==(i=e.attributes)&&void 0!==i?i:{},s={...l};s.elements=Tc(e.innerBlocks),t[`${a},${h}`]=s,n[`${a},${h}`]=e.clientId;const d=Math.max(1,null!==(c=l.span?.rowSpan)&&void 0!==c?c:1),b=Math.max(1,null!==(u=l.span?.colSpan)&&void 0!==u?u:1);for(let e=0;e<d;e++)for(let t=0;t<b;t++)0===e&&0===t||o.add(`${a+e},${h+t}`);h+=b,h>r&&(r=h)}for(;o.has(`${a},${h}`);)h++,h>r&&(r=h);a++}return{cells:t,rows:l,rowsCount:a,colsCount:r,cellClientIds:n}}(null!==(e=t.getBlock(r)?.innerBlocks)&&void 0!==e?e:[]);m.setState({cells:n.cells,rows:n.rows,table:{...m.getState().table,rows:n.rowsCount,cols:n.colsCount}}),B(!0)},[S,r,m]);const P=(0,me.useBlockProps)({className:`wp-block-tableberg tableberg-native-editor${"wide"===g?" alignwide":"full"===g?" alignfull":""}${i&&b?.stickyHeader?" tableberg-native-sticky-header":""}`}),R=(0,me.useInnerBlocksProps)({},{allowedBlocks:["tableberg/row"],renderAppender:!1}),I=ds(e=>e.currentPage),T=b?.pagination,E=i&&!!T?.enabled,O=(0,h.useSelect)(e=>{var t;if(!E)return{rowCount:0,hasRowSpans:!1};const n=e(me.store),l=null!==(t=n.getBlock(r)?.innerBlocks)&&void 0!==t?t:[];let o=!1;for(const e of l){for(const t of null!==(a=e.innerBlocks)&&void 0!==a?a:[]){var a,s;if((null!==(s=t.attributes?.span?.rowSpan)&&void 0!==s?s:1)>1){o=!0;break}}if(o)break}return{rowCount:l.length,hasRowSpans:o}},[r,E]),M=E&&!O.hasRowSpans;let A="",D=0;if(M){var L;const e=!!b?.headerEnabled,t=!!b?.footerEnabled;D=O.rowCount-(e?1:0)-(t?1:0);const n=new Set(function(e,t,n,l,o){const r=[];l&&r.push(0);const a=l?1:0,s=(o?e-2:e-1)-a+1;if(s>0&&t>0){const e=n*t,l=Math.min(e+t-1,s-1);for(let t=e;t<=l;t++)r.push(a+t)}return o&&r.push(e-1),r}(O.rowCount,Math.max(1,null!==(L=T?.pageSize)&&void 0!==L?L:10),I,e,t)),l=[];for(let e=0;e<O.rowCount;e++)n.has(e)||l.push(e);A=l.map(e=>`#block-${r} table > tbody > tr:nth-child(${e+1}) { display: none; }`).join("\n")}if(!c&&!d)return(0,J.jsx)("figure",{...P,children:(0,J.jsx)(Ac,{onCreate:(e,t)=>{const n=function(e,t){const n={};for(let l=0;l<e;l++)for(let e=0;e<t;e++)n[`${l},${e}`]={elements:[{name:"text",attributes:{}}]};return{version:3,table:{...ge.table,rows:e,cols:t,headerEnabled:!1,footerEnabled:!1},cells:n}}(e,t),l=Bi(n);o(Si(n)),a(r,l,!1)}})});const F=b?.cellSpacing?.horizontal?.trim()||"0",N=b?.cellSpacing?.vertical?.trim()||"0",V="0"!==F&&""!==F||"0"!==N&&""!==N,H=l.cellDefaults?.styles?.borderRadius,z=!!(Mc(H?.topLeft)||Mc(H?.topRight)||Mc(H?.bottomRight)||Mc(H?.bottomLeft)),G={top:b?.tableBorder?.top,right:b?.tableBorder?.right,bottom:b?.tableBorder?.bottom,left:b?.tableBorder?.left},Z={...De(b?.typography),borderCollapse:V?"separate":"collapse",borderSpacing:V?`${F} ${N}`:void 0,width:"100%",borderTop:z?void 0:b?.tableBorder?.top||void 0,borderRight:z?void 0:b?.tableBorder?.right||void 0,borderBottom:z?void 0:b?.tableBorder?.bottom||void 0,borderLeft:z?void 0:b?.tableBorder?.left||void 0},q=null!==(n=b?.cols)&&void 0!==n?n:0,$=q>0?b?.fixedColumnWidths?Array.from({length:q},()=>100/q+"%"):Array.from({length:q},(e,t)=>l.columns?.[t]?.width):null,W={},Q=b?.margin,U=b?.padding;Q?.top&&(W.marginTop=Q.top),Q?.right&&(W.marginRight=Q.right),Q?.bottom&&(W.marginBottom=Q.bottom),Q?.left&&(W.marginLeft=Q.left),U?.top&&(W.paddingTop=U.top),U?.right&&(W.paddingRight=U.right),U?.bottom&&(W.paddingBottom=U.bottom),U?.left&&(W.paddingLeft=U.left);const K=z?{borderTopLeftRadius:H?.topLeft,borderTopRightRadius:H?.topRight,borderBottomRightRadius:H?.bottomRight,borderBottomLeftRadius:H?.bottomLeft,borderTop:G.top||void 0,borderRight:G.right||void 0,borderBottom:G.bottom||void 0,borderLeft:G.left||void 0,boxSizing:"border-box",overflow:"hidden"}:void 0;return S&&j?(0,J.jsxs)("figure",{...P,style:{...P.style||{},...W},children:[(0,J.jsx)(Ic,{}),(0,J.jsx)(ac,{isSelected:e.isSelected}),(0,J.jsx)(rc,{...s})]}):(0,J.jsxs)("figure",{...P,style:{...P.style||{},...W},children:[(0,J.jsx)(sc,{}),M&&A&&(0,J.jsx)("style",{children:A}),f&&(0,J.jsx)("style",{children:f}),(0,J.jsx)("div",{style:K,children:(0,J.jsx)("div",{className:"tableberg-native-table-scroll",children:(0,J.jsxs)("table",{className:"tableberg-table",style:Z,children:[$&&(0,J.jsx)("colgroup",{children:$.map((e,t)=>(0,J.jsx)("col",{style:e?{width:e}:void 0},t))}),(0,J.jsx)("tbody",{...R})]})})}),M&&(0,J.jsx)(ic,{filteredRowCount:D}),(0,J.jsx)(ac,{isSelected:e.isSelected}),(0,J.jsx)(rc,{...s})]})}const Lc={attributes:Ci.uK,supports:Ci.xY,isEligible:e=>ki(e),save(){const e=me.useBlockProps.save(),t=me.useInnerBlocksProps.save(e);return(0,J.jsx)("table",{...t})},migrate:e=>[Si(e),Bi(e)]};(0,ve.registerBlockType)(Ps.name,{...Ps,attributes:Gs(Ps.attributes),icon:ga,edit:function({clientId:e,attributes:t,setAttributes:n,isSelected:l,ProRowBackgroundContent:o,ProRowBorderContent:r,rowProToolbarControls:a}){var s,u,d,b;const g=(0,h.useRegistry)(),{updateBlockAttributes:p}=(0,h.useDispatch)(me.store),f=Boolean(o||r),m=f&&null!==(s=t.border)&&void 0!==s?s:Zs,v=(0,me.useBlockProps)({style:{height:t.height||void 0,backgroundColor:f&&t.backgroundColor||void 0,color:f&&t.textColor||void 0,borderTop:m.top||void 0,borderRight:m.right||void 0,borderBottom:m.bottom||void 0,borderLeft:m.left||void 0}}),x=(0,me.useInnerBlocksProps)(v,{allowedBlocks:["tableberg/cell"],renderAppender:!1}),y={rowBackgroundColorControl:{label:(0,i.__)("Row Background Color","tableberg"),value:null!==(u=t.backgroundColor)&&void 0!==u?u:"",onChange:t=>{n({backgroundColor:t||void 0}),t&&(()=>{var t;const n=g.select(me.store),l=(null!==(t=n.getBlock(e)?.innerBlocks)&&void 0!==t?t:[]).filter(e=>"tableberg/cell"===e.name).map(e=>e.clientId);g.batch(()=>{l.forEach(e=>{var t;const l=null!==(t=n.getBlockAttributes(e)?.styles)&&void 0!==t?t:{},{backgroundColor:o,...r}=l;p(e,{backgroundColor:null,styles:r})})})})()},onDeselect:()=>n({backgroundColor:void 0})},rowTextColorControl:{label:(0,i.__)("Row Text Color","tableberg"),value:null!==(d=t.textColor)&&void 0!==d?d:"",onChange:e=>n({textColor:e||void 0}),onDeselect:()=>n({textColor:void 0})}},C=()=>{var t;return(null!==(t=g.select(me.store).getBlock(e)?.innerBlocks)&&void 0!==t?t:[]).filter(e=>"tableberg/cell"===e.name).map(e=>e.clientId)},w=e=>{const t=g.select(me.store),n=C(),l=n.length;g.batch(()=>{n.forEach((n,o)=>{var r;const a=null!==(r=t.getBlockAttributes(n)?.styles)&&void 0!==r?r:{},s=0===o,i=o===l-1;p(n,{styles:{...a,borderRadius:{topLeft:s?e.topLeft:"",topRight:i?e.topRight:"",bottomRight:i?e.bottomRight:"",bottomLeft:s?e.bottomLeft:""}}})})})},_=f?(()=>{var e,t,n,l;const o=g.select(me.store),r=C();if(0===r.length)return qs;const a=e=>{var t;return null!==(t=o.getBlockAttributes(e)?.styles?.borderRadius)&&void 0!==t?t:qs},s=a(r[0]),i=a(r[r.length-1]);return{topLeft:null!==(e=s.topLeft)&&void 0!==e?e:"",topRight:null!==(t=i.topRight)&&void 0!==t?t:"",bottomRight:null!==(n=i.bottomRight)&&void 0!==n?n:"",bottomLeft:null!==(l=s.bottomLeft)&&void 0!==l?l:""}})():qs,k={rowBorderControlProps:{label:(0,i.__)("Row Border","tableberg"),value:m,hasValue:()=>!!(m.top||m.right||m.bottom||m.left),onChange:e=>n({border:e}),onDeselect:()=>n({border:void 0})},rowRadiusControlProps:{label:(0,i.__)("Row Border Radius","tableberg"),value:_,hasValue:()=>!!(_.topLeft||_.topRight||_.bottomRight||_.bottomLeft),onChange:e=>w(e),onDeselect:()=>w(qs)}};return(0,J.jsxs)(J.Fragment,{children:[l&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)($s,{clientId:e,proToolbarControls:a}),(0,J.jsx)(me.InspectorControls,{children:(0,J.jsx)(c.PanelBody,{title:(0,i.__)("Row Settings","tableberg"),children:(0,J.jsx)(c.__experimentalUnitControl,{label:(0,i.__)("Row Height","tableberg"),value:null!==(b=t.height)&&void 0!==b?b:"",onChange:e=>n({height:e||void 0})})})}),(0,J.jsx)(me.InspectorControls,{group:"color",children:o?o(y):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Pa,{isEnhanced:!0,selected:"row-bg",children:(0,J.jsx)(ke,{label:(0,i.__)("Row Background Color","tableberg"),value:"",onChange:()=>null,onDeselect:()=>null})}),(0,J.jsx)(Pa,{isEnhanced:!0,selected:"row-text",children:(0,J.jsx)(ke,{label:(0,i.__)("Row Text Color","tableberg"),value:"",onChange:()=>null,onDeselect:()=>null})})]})}),(0,J.jsx)(me.InspectorControls,{group:"border",children:r?r(k):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Pa,{isEnhanced:!0,selected:"row-border",children:(0,J.jsx)(we,{label:(0,i.__)("Row Border","tableberg"),value:Zs,hasValue:()=>!1,onChange:()=>null,onDeselect:()=>null})}),(0,J.jsx)(Pa,{isEnhanced:!0,selected:"row-border-radius",children:(0,J.jsx)(_e,{label:(0,i.__)("Row Border Radius","tableberg"),value:qs,hasValue:()=>!1,onChange:()=>null,onDeselect:()=>null})})]})})]}),(0,J.jsx)("tr",{...x})]})},save:()=>(0,J.jsx)(me.InnerBlocks.Content,{})}),(0,ve.registerBlockType)(Ys.name,{...Ys,attributes:Gs(Ys.attributes),icon:ga,edit:function(e){var t,n,l,o,r,a,s,i,c,u,d,b,g;const{attributes:p,clientId:f,context:m,isSelected:v}=e,x=void 0!==e.cellStyles,y=m?.["tableberg/tableConfig"],C=ds(e=>e.nativeSelectedCells),w=ds(e=>e.setNativeSelectedCells),{selectBlock:_}=(0,h.useDispatch)(me.store),k=C.includes(f),S=m?.["tableberg/cellDefaults"],j=x?m?.["tableberg/rowBackgroundColor"]:void 0,B="body"===function(e,t){return(0,h.useSelect)(n=>{if(!t?.headerEnabled&&!t?.footerEnabled)return"body";const l=n(me.store),o=l.getBlockRootClientId(e);if(!o)return"body";const r=l.getBlockRootClientId(o),a=l.getBlockIndex(o),s=l.getBlockCount(r);return t.headerEnabled&&0===a?"header":t.footerEnabled&&a===s-1?"footer":"body"},[e,t?.headerEnabled,t?.footerEnabled])}(f,y)?"td":"th",P=function(e,t){return(0,h.useSelect)(n=>{const l=n(me.store),o=l.getBlockRootClientId(e);if(!o)return"oddRowBackgroundColor";const r=l.getBlockRootClientId(o),a=l.getBlockIndex(o),s=l.getBlockCount(r);return t?.headerEnabled&&0===a?"headerBackgroundColor":t?.footerEnabled&&a===s-1?"footerBackgroundColor":(t?.headerEnabled?a-1:a)%2==0?"oddRowBackgroundColor":"evenRowBackgroundColor"},[e,t?.headerEnabled,t?.footerEnabled])}(f,y),R=S?.styles,I=p.styles,T={paddingTop:null!==(t=I?.padding?.top)&&void 0!==t?t:R?.padding?.top,paddingRight:null!==(n=I?.padding?.right)&&void 0!==n?n:R?.padding?.right,paddingBottom:null!==(l=I?.padding?.bottom)&&void 0!==l?l:R?.padding?.bottom,paddingLeft:null!==(o=I?.padding?.left)&&void 0!==o?o:R?.padding?.left,backgroundColor:j?void 0:R?.[P]||R?.backgroundColor||void 0,verticalAlign:null!==(r=tn()?I?.verticalAlign:void 0)&&void 0!==r?r:R?.verticalAlign,borderTop:R?.border?.top||void 0,borderRight:R?.border?.right||void 0,borderBottom:R?.border?.bottom||void 0,borderLeft:R?.border?.left||void 0,borderTopLeftRadius:I?.borderRadius?.topLeft,borderTopRightRadius:I?.borderRadius?.topRight,borderBottomRightRadius:I?.borderRadius?.bottomRight,borderBottomLeftRadius:I?.borderRadius?.bottomLeft},E=null!==(a=I?.orientation)&&void 0!==a?a:x?R?.orientation:void 0,O=null!==(s=I?.elementGap)&&void 0!==s?s:R?.elementGap,M=null!==(i=I?.wrap)&&void 0!==i?i:x?R?.wrap:void 0,A={display:"flex",flexDirection:"horizontal"===E?"row":"column",gap:O||void 0};"horizontal"===E&&(A.alignItems="center",A.flexWrap="nowrap"===M?"nowrap":"wrap"),k&&(T.boxShadow="inset 0 0 0 2px var(--wp-admin-theme-color, #3858e9)"),Object.assign(T,null!==(c=e.cellStyles)&&void 0!==c?c:{});const D=(0,me.useBlockProps)({style:T}),L=(0,me.useInnerBlocksProps)({className:"tableberg-cell-content",style:A},{allowedBlocks:si,template:[["tableberg/text",{}]]}),F=x&&!!y?.stickyFirstCol;(0,h.useSelect)(e=>!!F&&0===e(me.store).getBlockIndex(f),[f,F])&&(T.position="sticky",T.left=0,T.zIndex=1,T.backgroundColor||(T.backgroundColor="#fff"));const N=(null!==(u=p.span?.rowSpan)&&void 0!==u?u:1)>1||(null!==(d=p.span?.colSpan)&&void 0!==d?d:1)>1;return(0,J.jsxs)(J.Fragment,{children:[v&&(0,J.jsx)(ii,{clientId:f,hasSpan:N,proToolbarControls:e.cellProToolbarControls}),v&&(0,J.jsx)(ci,{attributes:p,setAttributes:e.setAttributes,defaultElementGap:R?.elementGap,CellBackgroundControl:e.CellBackgroundControl,CellRibbonPanel:e.CellRibbonPanel,CellRibbonColorControls:e.CellRibbonColorControls,CellBorderControl:e.CellBorderControl,CellEmptyControl:e.CellEmptyControl}),v&&(0,J.jsx)(ei,{clientId:f}),v&&(0,J.jsx)(ti,{clientId:f,cellDefaultsBackgroundColor:null!==(b=R?.backgroundColor)&&void 0!==b?b:"",ProColumnBackgroundContent:e.ProColumnBackgroundContent}),v&&(0,J.jsx)(ri,{clientId:f,cellDefaultsBorder:null!==(g=R?.border)&&void 0!==g?g:ai,ProColumnBorderContent:e.ProColumnBorderContent}),(0,J.jsxs)(B,{...D,rowSpan:p.span?.rowSpan,colSpan:p.span?.colSpan,onMouseDownCapture:e=>{if(e.metaKey||e.ctrlKey||e.shiftKey){e.preventDefault(),e.stopPropagation(),e.nativeEvent.stopImmediatePropagation?.();const t=k?C.filter(e=>e!==f):[...C,f];return w(t),void _(f)}C.length>0&&w([])},style:D.style,children:[(0,J.jsx)("div",{...L}),e.CellRibbonOverlay,e.CellEmptyBadge]})]})},save:()=>(0,J.jsx)(me.InnerBlocks.Content,{})}),(0,ve.registerBlockType)(ui.name,{...ui,icon:va,edit:function({attributes:e,setAttributes:t,isSelected:n,onReplace:l,onRemove:o,insertBlocksAfter:r,clientId:a}){const s=at(e,ln,void 0,{},(0,i.__)("(No data)","tableberg")),{content:u,align:d,styles:h}=s,b={name:"text",attributes:s},g=(0,me.useBlockProps)({style:ws(d)}),p=on(h.padding),f=on(h.margin),m={margin:null!=f?f:0,padding:p,color:h.textColor||void 0,fontSize:h.fontSize||void 0,backgroundColor:h.backgroundColor||void 0,"--tableberg-text-link-color":h.linkColor||void 0};return(0,J.jsxs)("div",{...g,onPasteCapture:e=>{var t;const n=null!==(t=e.clipboardData?.getData("text/plain"))&&void 0!==t?t:"";if(!n.includes("\x3c!-- wp:tableberg/"))return;const o=(0,ve.parse)(n);0===o.length||o.some(e=>!e.name)||(e.preventDefault(),e.stopPropagation(),!u&&l?l(o):r&&r(o))},children:[n&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(_s,{align:d,onChange:e=>t({align:e})}),(0,J.jsx)(me.BlockSettingsMenuControls,{children:({onClose:e})=>(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(c.MenuItem,{onClick:()=>{$t(Gt(b)),e()},children:(0,i.__)("Copy styles","tableberg")}),(0,J.jsx)(c.MenuItem,{onClick:()=>{(async()=>{const e=Zt(await Wt());if(!e)return;const n=qt(b,e).attributes;t({align:n.align,styles:n.styles})})(),e()},children:(0,i.__)("Paste styles","tableberg")})]})})]}),n&&(0,J.jsx)(Xt,{attributes:s,bindings:e.bindings,updateStyles:n=>{var l;return t({styles:{...null!==(l=e.styles)&&void 0!==l?l:s.styles,...n}})}}),(0,J.jsx)(me.RichText,{tagName:"p",className:"tableberg-text-element"+(h.linkColor?" tableberg-has-link-color":""),identifier:"content",allowedFormats:["core/bold","core/italic","core/link","core/strikethrough","core/underline"],placeholder:(0,i.__)("Type here","tableberg"),value:u,onChange:e=>t({content:e}),onSplit:(t,n)=>{let l;return l=n||t?(0,ve.createBlock)("tableberg/text",{...e,content:t}):(0,ve.createBlock)("tableberg/text",{...e,content:""}),n&&(l.clientId=a),l},onReplace:l,onRemove:o,style:m})]})},save:()=>null}),(0,ve.registerBlockType)(di.name,{...di,icon:st,edit:function({attributes:e,setAttributes:t,isSelected:n}){var l;const o=at(e,pn,void 0,{},(0,i.__)("(No data)","tableberg")),{content:r,align:a,styles:s}=o,c=(0,me.useBlockProps)({style:ws(a)}),u=fn(s),d={backgroundColor:u.vars["--tableberg-button-background-color"]||void 0,color:u.vars["--tableberg-button-text-color"]||void 0,fontSize:s.fontSize||void 0,textAlign:s.textAlign,width:"auto"===s.width?void 0:s.width,paddingTop:s.padding?.top,paddingRight:s.padding?.right,paddingBottom:s.padding?.bottom,paddingLeft:s.padding?.left,borderTopLeftRadius:s.borderRadius?.topLeft,borderTopRightRadius:s.borderRadius?.topRight,borderBottomRightRadius:s.borderRadius?.bottomRight,borderBottomLeftRadius:s.borderRadius?.bottomLeft,border:null!==(l=u.border)&&void 0!==l?l:"none",cursor:"text"};return(0,J.jsxs)("div",{...c,children:[n&&(0,J.jsx)(_s,{align:a,onChange:e=>t({align:e})}),n&&(0,J.jsx)(ks,{elementName:"button",attributes:o,setAttributes:t}),n&&(0,J.jsx)(gn,{attributes:o,bindings:e.bindings,cellCoords:"0,0",elementIndex:0,updateStyles:n=>{var l;return t({styles:{...null!==(l=e.styles)&&void 0!==l?l:o.styles,...n}})},updateAttrs:e=>t(e)}),(0,J.jsx)(me.RichText,{tagName:"div",className:"tableberg-button-element",placeholder:(0,i.__)("Button text","tableberg"),value:r,onChange:e=>t({content:e}),style:d})]})},save:()=>null}),(0,ve.registerBlockType)(hi.name,{...hi,icon:it,edit:function({attributes:e,setAttributes:t,isSelected:n}){const l=at(e,En,void 0,{},(0,i.__)("(No data)","tableberg")),{media:o,alt:r,align:a,width:s,height:c,aspectRatio:d,scale:h}=l,{border:b,borderRadius:g}=l,[p,f]=(0,u.useState)(!!l.caption),m=(0,me.useBlockProps)({style:ws(a)}),v=n&&o?.url&&(0,J.jsx)(Tn,{attributes:l,bindings:e.bindings,showCaption:p,setShowCaption:f,cellCoords:"0,0",elementIndex:0,updateAttrs:e=>t(e)});return o?.url?(0,J.jsxs)("div",{...m,children:[n&&(0,J.jsx)(_s,{align:a,onChange:e=>t({align:e})}),v,(0,J.jsx)("img",{src:o.url,alt:r,style:{width:s||En.width,maxWidth:"100%",height:c||void 0,aspectRatio:d||void 0,objectFit:h,borderTop:b?.top||void 0,borderRight:b?.right||void 0,borderBottom:b?.bottom||void 0,borderLeft:b?.left||void 0,borderTopLeftRadius:g?.topLeft||void 0,borderTopRightRadius:g?.topRight||void 0,borderBottomRightRadius:g?.bottomRight||void 0,borderBottomLeftRadius:g?.bottomLeft||void 0}})]}):(0,J.jsx)("div",{...m,children:(0,J.jsx)(me.MediaPlaceholder,{icon:"format-image",labels:{title:(0,i.__)("Image","tableberg")},accept:"image/*",allowedTypes:["image"],onSelect:e=>{var n;return t({media:{id:e.id,url:e.url},alt:null!==(n=e.alt)&&void 0!==n?n:""})}})})},save:()=>null}),(0,ve.registerBlockType)(bi.name,{...bi,icon:ct,edit:Bs(bi.name,Ta),save:()=>null}),(0,ve.registerBlockType)(Ci.UU,{title:Ci.DD,icon:ga,category:Ci.L1,attributes:Ci.uK,providesContext:{"tableberg/tableConfig":"table","tableberg/cellDefaults":"cellDefaults"},transforms:Ri,edit:function(e){return e.attributes.isExample?(0,J.jsx)("img",{src:wi,style:{maxWidth:"100%"},alt:"Tableberg table"}):(0,J.jsx)(us,{clientId:e.clientId,attributes:e.attributes,setAttributes:e.setAttributes,contentSyncDisabled:!0,children:(0,J.jsx)(te,{client:Ec,children:(0,J.jsx)(Dc,{...e})})})},save:function(){return(0,J.jsx)(me.InnerBlocks.Content,{})},deprecated:[Lc]})},821:(e,t,n)=>{e.exports=n(265)()}},n={};function l(e){var o=n[e];if(void 0!==o)return o.exports;var r=n[e]={exports:{}};return t[e](r,r.exports,l),r.exports}l.m=t,e=[],l.O=(t,n,o,r)=>{if(!n){var a=1/0;for(u=0;u<e.length;u++){for(var[n,o,r]=e[u],s=!0,i=0;i<n.length;i++)(!1&r||a>=r)&&Object.keys(l.O).every(e=>l.O[e](n[i]))?n.splice(i--,1):(s=!1,r<a&&(a=r));if(s){e.splice(u--,1);var c=o();void 0!==c&&(t=c)}}return t}r=r||0;for(var u=e.length;u>0&&e[u-1][2]>r;u--)e[u]=e[u-1];e[u]=[n,o,r]},l.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return l.d(t,{a:t}),t},l.d=(e,t)=>{for(var n in t)l.o(t,n)&&!l.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},l.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),l.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e;l.g.importScripts&&(e=l.g.location+"");var t=l.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");if(n.length)for(var o=n.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=n[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),l.p=e})(),(()=>{var e={57:0,350:0};l.O.j=t=>0===e[t];var t=(t,n)=>{var o,r,[a,s,i]=n,c=0;if(a.some(t=>0!==e[t])){for(o in s)l.o(s,o)&&(l.m[o]=s[o]);if(i)var u=i(l)}for(t&&t(n);c<a.length;c++)r=a[c],l.o(e,r)&&e[r]&&e[r][0](),e[r]=0;return l.O(u)},n=globalThis.webpackChunktableberg=globalThis.webpackChunktableberg||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var o=l.O(void 0,[350],()=>l(672));o=l.O(o)})();