dvadf
File manager - Edit - /home/centroca/public_html/wp/wp-content/plugins/nextgen-gallery/adminApp/build/index.min.js
Back
/*! For license information please see index.min.js.LICENSE.txt */ (()=>{var e,t,n,r,a={338:(e,t,n)=>{"use strict";var r=n(795);t.H=r.createRoot,r.hydrateRoot},93:function(e,t,n){var r;r=e=>(()=>{"use strict";var t={899:t=>{t.exports=e}},n={};function r(e){var a=n[e];if(void 0!==a)return a.exports;var o=n[e]={exports:{}};return t[e](o,o.exports,r),o.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return(()=>{r.r(a),r.d(a,{Component:()=>f,areCropsEqual:()=>i,centerCrop:()=>s,clamp:()=>l,containCrop:()=>d,convertToPercentCrop:()=>u,convertToPixelCrop:()=>m,default:()=>f,defaultCrop:()=>o,makeAspectCrop:()=>c,nudgeCrop:()=>g});var e=r(899),t=r.n(e);function n(e){var t,r,a="";if("string"==typeof e||"number"==typeof e)a+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(r=n(e[t]))&&(a&&(a+=" "),a+=r);else for(t in e)e[t]&&(a&&(a+=" "),a+=t);return a}const o={x:0,y:0,width:0,height:0,unit:"px"};function l(e,t,n){return Math.min(Math.max(e,t),n)}function i(e,t){return e.width===t.width&&e.height===t.height&&e.x===t.x&&e.y===t.y&&e.unit===t.unit}function c(e,t,n,r){const a=m(e,n,r);return e.width&&(a.height=a.width/t),e.height&&(a.width=a.height*t),a.y+a.height>r&&(a.height=r-a.y,a.width=a.height*t),a.x+a.width>n&&(a.width=n-a.x,a.height=a.width/t),"%"===e.unit?u(a,n,r):a}function s(e,t,n){const r=m(e,t,n);return r.x=(t-r.width)/2,r.y=(n-r.height)/2,"%"===e.unit?u(r,t,n):r}function u(e,t,n){return"%"===e.unit?{...o,...e,unit:"%"}:{unit:"%",x:e.x?e.x/t*100:0,y:e.y?e.y/n*100:0,width:e.width?e.width/t*100:0,height:e.height?e.height/n*100:0}}function m(e,t,n){return e.unit?"px"===e.unit?{...o,...e,unit:"px"}:{unit:"px",x:e.x?e.x*t/100:0,y:e.y?e.y*n/100:0,width:e.width?e.width*t/100:0,height:e.height?e.height*n/100:0}:{...o,...e,unit:"px"}}function d(e,t,n,r,a,o=0,l=0,i=r,c=a){const s={...e};let u=Math.min(o,r),m=Math.min(l,a),d=Math.min(i,r),g=Math.min(c,a);t&&(t>1?(u=l?l*t:u,m=u/t,d=i*t):(m=o?o/t:m,u=m*t,g=c/t)),s.y<0&&(s.height=Math.max(s.height+s.y,m),s.y=0),s.x<0&&(s.width=Math.max(s.width+s.x,u),s.x=0);const p=r-(s.x+s.width);p<0&&(s.x=Math.min(s.x,r-u),s.width+=p);const f=a-(s.y+s.height);if(f<0&&(s.y=Math.min(s.y,a-m),s.height+=f),s.width<u&&("sw"!==n&&"nw"!=n||(s.x-=u-s.width),s.width=u),s.height<m&&("nw"!==n&&"ne"!=n||(s.y-=m-s.height),s.height=m),s.width>d&&("sw"!==n&&"nw"!=n||(s.x-=d-s.width),s.width=d),s.height>g&&("nw"!==n&&"ne"!=n||(s.y-=g-s.height),s.height=g),t){const e=s.width/s.height;if(e<t){const e=Math.max(s.width/t,m);"nw"!==n&&"ne"!=n||(s.y-=e-s.height),s.height=e}else if(e>t){const e=Math.max(s.height*t,u);"sw"!==n&&"nw"!=n||(s.x-=e-s.width),s.width=e}}return s}function g(e,t,n,r){const a={...e};return"ArrowLeft"===t?"nw"===r?(a.x-=n,a.y-=n,a.width+=n,a.height+=n):"w"===r?(a.x-=n,a.width+=n):"sw"===r?(a.x-=n,a.width+=n,a.height+=n):"ne"===r?(a.y+=n,a.width-=n,a.height-=n):"e"===r?a.width-=n:"se"===r&&(a.width-=n,a.height-=n):"ArrowRight"===t&&("nw"===r?(a.x+=n,a.y+=n,a.width-=n,a.height-=n):"w"===r?(a.x+=n,a.width-=n):"sw"===r?(a.x+=n,a.width-=n,a.height-=n):"ne"===r?(a.y-=n,a.width+=n,a.height+=n):"e"===r?a.width+=n:"se"===r&&(a.width+=n,a.height+=n)),"ArrowUp"===t?"nw"===r?(a.x-=n,a.y-=n,a.width+=n,a.height+=n):"n"===r?(a.y-=n,a.height+=n):"ne"===r?(a.y-=n,a.width+=n,a.height+=n):"sw"===r?(a.x+=n,a.width-=n,a.height-=n):"s"===r?a.height-=n:"se"===r&&(a.width-=n,a.height-=n):"ArrowDown"===t&&("nw"===r?(a.x+=n,a.y+=n,a.width-=n,a.height-=n):"n"===r?(a.y+=n,a.height-=n):"ne"===r?(a.y+=n,a.width-=n,a.height-=n):"sw"===r?(a.x-=n,a.width+=n,a.height+=n):"s"===r?a.height+=n:"se"===r&&(a.width+=n,a.height+=n)),a}const p={capture:!0,passive:!1};class f extends e.PureComponent{constructor(){super(...arguments),this.docMoveBound=!1,this.mouseDownOnCrop=!1,this.dragStarted=!1,this.evData={startClientX:0,startClientY:0,startCropX:0,startCropY:0,clientX:0,clientY:0,isResize:!0},this.componentRef=(0,e.createRef)(),this.mediaRef=(0,e.createRef)(),this.initChangeCalled=!1,this.state={cropIsActive:!1,newCropIsBeingDrawn:!1},this.onCropPointerDown=e=>{const{crop:t,disabled:n}=this.props,r=this.getBox();if(!t)return;const a=m(t,r.width,r.height);if(n)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});const o=e.target.dataset.ord,l=Boolean(o);let i=e.clientX,c=e.clientY,s=a.x,u=a.y;if(o){const t=e.clientX-r.x,n=e.clientY-r.y;let l=0,m=0;"ne"===o||"e"==o?(l=t-(a.x+a.width),m=n-a.y,s=a.x,u=a.y+a.height):"se"===o||"s"===o?(l=t-(a.x+a.width),m=n-(a.y+a.height),s=a.x,u=a.y):"sw"===o||"w"==o?(l=t-a.x,m=n-(a.y+a.height),s=a.x+a.width,u=a.y):"nw"!==o&&"n"!=o||(l=t-a.x,m=n-a.y,s=a.x+a.width,u=a.y+a.height),i=s+r.x+l,c=u+r.y+m}this.evData={startClientX:i,startClientY:c,startCropX:s,startCropY:u,clientX:e.clientX,clientY:e.clientY,isResize:l,ord:o},this.mouseDownOnCrop=!0,this.setState({cropIsActive:!0})},this.onComponentPointerDown=e=>{const{crop:t,disabled:n,locked:r,keepSelection:a,onChange:o}=this.props,l=this.getBox();if(n||r||a&&t)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});const i=e.clientX-l.x,c=e.clientY-l.y,s={unit:"px",x:i,y:c,width:0,height:0};this.evData={startClientX:e.clientX,startClientY:e.clientY,startCropX:i,startCropY:c,clientX:e.clientX,clientY:e.clientY,isResize:!0},this.mouseDownOnCrop=!0,o(m(s,l.width,l.height),u(s,l.width,l.height)),this.setState({cropIsActive:!0,newCropIsBeingDrawn:!0})},this.onDocPointerMove=e=>{const{crop:t,disabled:n,onChange:r,onDragStart:a}=this.props,o=this.getBox();if(n||!t||!this.mouseDownOnCrop)return;e.cancelable&&e.preventDefault(),this.dragStarted||(this.dragStarted=!0,a&&a(e));const{evData:l}=this;let c;l.clientX=e.clientX,l.clientY=e.clientY,c=l.isResize?this.resizeCrop():this.dragCrop(),i(t,c)||r(m(c,o.width,o.height),u(c,o.width,o.height))},this.onComponentKeyDown=e=>{const{crop:t,disabled:n,onChange:r,onComplete:a}=this.props,o=this.getBox();if(n)return;const i=e.key;let c=!1;if(!t)return;const s=this.makePixelCrop(),d=(navigator.platform.match("Mac")?e.metaKey:e.ctrlKey)?f.nudgeStepLarge:e.shiftKey?f.nudgeStepMedium:f.nudgeStep;if("ArrowLeft"===i?(s.x-=d,c=!0):"ArrowRight"===i?(s.x+=d,c=!0):"ArrowUp"===i?(s.y-=d,c=!0):"ArrowDown"===i&&(s.y+=d,c=!0),c){e.cancelable&&e.preventDefault(),s.x=l(s.x,0,o.width-s.width),s.y=l(s.y,0,o.height-s.height);const t=m(s,o.width,o.height),n=u(s,o.width,o.height);r(t,n),a&&a(t,n)}},this.onHandlerKeyDown=(e,t)=>{const{aspect:n=0,crop:r,disabled:a,minWidth:o=0,minHeight:l=0,maxWidth:c,maxHeight:s,onChange:p,onComplete:y}=this.props,h=this.getBox();if(a||!r)return;if("ArrowUp"!==e.key&&"ArrowDown"!==e.key&&"ArrowLeft"!==e.key&&"ArrowRight"!==e.key)return;e.stopPropagation(),e.preventDefault();const b=(navigator.platform.match("Mac")?e.metaKey:e.ctrlKey)?f.nudgeStepLarge:e.shiftKey?f.nudgeStepMedium:f.nudgeStep,v=d(g(m(r,h.width,h.height),e.key,b,t),n,t,h.width,h.height,o,l,c,s);if(!i(r,v)){const e=u(v,h.width,h.height);p(v,e),y&&y(v,e)}},this.onDocPointerDone=e=>{const{crop:t,disabled:n,onComplete:r,onDragEnd:a}=this.props,o=this.getBox();this.unbindDocMove(),!n&&t&&this.mouseDownOnCrop&&(this.mouseDownOnCrop=!1,this.dragStarted=!1,a&&a(e),r&&r(m(t,o.width,o.height),u(t,o.width,o.height)),this.setState({cropIsActive:!1,newCropIsBeingDrawn:!1}))},this.onDragFocus=e=>{var t;null===(t=this.componentRef.current)||void 0===t||t.scrollTo(0,0)}}get document(){return document}getBox(){const e=this.mediaRef.current;if(!e)return{x:0,y:0,width:0,height:0};const{x:t,y:n,width:r,height:a}=e.getBoundingClientRect();return{x:t,y:n,width:r,height:a}}componentDidUpdate(e){const{crop:t,onComplete:n}=this.props;if(n&&!e.crop&&t){const{width:e,height:r}=this.getBox();e&&r&&n(m(t,e,r),u(t,e,r))}}componentWillUnmount(){this.resizeObserver&&this.resizeObserver.disconnect()}bindDocMove(){this.docMoveBound||(this.document.addEventListener("pointermove",this.onDocPointerMove,p),this.document.addEventListener("pointerup",this.onDocPointerDone,p),this.document.addEventListener("pointercancel",this.onDocPointerDone,p),this.docMoveBound=!0)}unbindDocMove(){this.docMoveBound&&(this.document.removeEventListener("pointermove",this.onDocPointerMove,p),this.document.removeEventListener("pointerup",this.onDocPointerDone,p),this.document.removeEventListener("pointercancel",this.onDocPointerDone,p),this.docMoveBound=!1)}getCropStyle(){const{crop:e}=this.props;if(e)return{top:`${e.y}${e.unit}`,left:`${e.x}${e.unit}`,width:`${e.width}${e.unit}`,height:`${e.height}${e.unit}`}}dragCrop(){const{evData:e}=this,t=this.getBox(),n=this.makePixelCrop(),r=e.clientX-e.startClientX,a=e.clientY-e.startClientY;return n.x=l(e.startCropX+r,0,t.width-n.width),n.y=l(e.startCropY+a,0,t.height-n.height),n}getPointRegion(e){const{evData:t}=this,n=t.clientX-e.x,r=t.clientY-e.y<t.startCropY;return n<t.startCropX?r?"nw":"sw":r?"ne":"se"}resizeCrop(){const{evData:e}=this,t=this.getBox(),{aspect:n=0,minWidth:r=0,minHeight:a=0,maxWidth:o,maxHeight:l}=this.props,i=this.getPointRegion(t),c=this.makePixelCrop(),s=e.ord?e.ord:i,u=e.clientX-e.startClientX,m=e.clientY-e.startClientY,g={unit:"px",x:0,y:0,width:0,height:0};"ne"===i?(g.x=e.startCropX,g.width=u,n?(g.height=g.width/n,g.y=e.startCropY-g.height):(g.height=Math.abs(m),g.y=e.startCropY-g.height)):"se"===i?(g.x=e.startCropX,g.y=e.startCropY,g.width=u,g.height=n?g.width/n:m):"sw"===i?(g.x=e.startCropX+u,g.y=e.startCropY,g.width=Math.abs(u),g.height=n?g.width/n:m):"nw"===i&&(g.x=e.startCropX+u,g.width=Math.abs(u),n?(g.height=g.width/n,g.y=e.startCropY-g.height):(g.height=Math.abs(m),g.y=e.startCropY+m));const p=d(g,n,i,t.width,t.height,r,a,o,l);return n||f.xyOrds.indexOf(s)>-1?(c.x=p.x,c.y=p.y,c.width=p.width,c.height=p.height):f.xOrds.indexOf(s)>-1?(c.x=p.x,c.width=p.width):f.yOrds.indexOf(s)>-1&&(c.y=p.y,c.height=p.height),c}createCropSelection(){const{ariaLabels:e=f.defaultProps.ariaLabels,disabled:n,locked:r,renderSelectionAddon:a,ruleOfThirds:o,crop:l}=this.props,i=this.getCropStyle();if(l)return t().createElement("div",{style:i,className:"ReactCrop__crop-selection",onPointerDown:this.onCropPointerDown,"aria-label":e.cropArea,tabIndex:0,onKeyDown:this.onComponentKeyDown,role:"group"},!n&&!r&&t().createElement("div",{className:"ReactCrop__drag-elements",onFocus:this.onDragFocus},t().createElement("div",{className:"ReactCrop__drag-bar ord-n","data-ord":"n"}),t().createElement("div",{className:"ReactCrop__drag-bar ord-e","data-ord":"e"}),t().createElement("div",{className:"ReactCrop__drag-bar ord-s","data-ord":"s"}),t().createElement("div",{className:"ReactCrop__drag-bar ord-w","data-ord":"w"}),t().createElement("div",{className:"ReactCrop__drag-handle ord-nw","data-ord":"nw",tabIndex:0,"aria-label":e.nwDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"nw"),role:"button"}),t().createElement("div",{className:"ReactCrop__drag-handle ord-n","data-ord":"n",tabIndex:0,"aria-label":e.nDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"n"),role:"button"}),t().createElement("div",{className:"ReactCrop__drag-handle ord-ne","data-ord":"ne",tabIndex:0,"aria-label":e.neDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"ne"),role:"button"}),t().createElement("div",{className:"ReactCrop__drag-handle ord-e","data-ord":"e",tabIndex:0,"aria-label":e.eDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"e"),role:"button"}),t().createElement("div",{className:"ReactCrop__drag-handle ord-se","data-ord":"se",tabIndex:0,"aria-label":e.seDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"se"),role:"button"}),t().createElement("div",{className:"ReactCrop__drag-handle ord-s","data-ord":"s",tabIndex:0,"aria-label":e.sDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"s"),role:"button"}),t().createElement("div",{className:"ReactCrop__drag-handle ord-sw","data-ord":"sw",tabIndex:0,"aria-label":e.swDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"sw"),role:"button"}),t().createElement("div",{className:"ReactCrop__drag-handle ord-w","data-ord":"w",tabIndex:0,"aria-label":e.wDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"w"),role:"button"})),a&&t().createElement("div",{className:"ReactCrop__selection-addon",onMouseDown:e=>e.stopPropagation()},a(this.state)),o&&t().createElement(t().Fragment,null,t().createElement("div",{className:"ReactCrop__rule-of-thirds-hz"}),t().createElement("div",{className:"ReactCrop__rule-of-thirds-vt"})))}makePixelCrop(){const e={...o,...this.props.crop||{}},t=this.getBox();return m(e,t.width,t.height)}render(){const{aspect:e,children:r,circularCrop:a,className:o,crop:l,disabled:i,locked:c,style:s,ruleOfThirds:u}=this.props,{cropIsActive:m,newCropIsBeingDrawn:d}=this.state,g=l?this.createCropSelection():null,p=function(){for(var e,t,r=0,a="";r<arguments.length;)(e=arguments[r++])&&(t=n(e))&&(a&&(a+=" "),a+=t);return a}("ReactCrop",o,{"ReactCrop--active":m,"ReactCrop--disabled":i,"ReactCrop--locked":c,"ReactCrop--new-crop":d,"ReactCrop--fixed-aspect":l&&e,"ReactCrop--circular-crop":l&&a,"ReactCrop--rule-of-thirds":l&&u,"ReactCrop--invisible-crop":!this.dragStarted&&l&&!l.width&&!l.height});return t().createElement("div",{ref:this.componentRef,className:p,style:s},t().createElement("div",{ref:this.mediaRef,className:"ReactCrop__child-wrapper",onPointerDown:this.onComponentPointerDown},r),g)}}f.xOrds=["e","w"],f.yOrds=["n","s"],f.xyOrds=["nw","ne","se","sw"],f.nudgeStep=1,f.nudgeStepMedium=10,f.nudgeStepLarge=100,f.defaultProps={ariaLabels:{cropArea:"Use the arrow keys to move the crop selection area",nwDragHandle:"Use the arrow keys to move the north west drag handle to change the crop selection area",nDragHandle:"Use the up and down arrow keys to move the north drag handle to change the crop selection area",neDragHandle:"Use the arrow keys to move the north east drag handle to change the crop selection area",eDragHandle:"Use the up and down arrow keys to move the east drag handle to change the crop selection area",seDragHandle:"Use the arrow keys to move the south east drag handle to change the crop selection area",sDragHandle:"Use the up and down arrow keys to move the south drag handle to change the crop selection area",swDragHandle:"Use the arrow keys to move the south west drag handle to change the crop selection area",wDragHandle:"Use the up and down arrow keys to move the west drag handle to change the crop selection area"}}})(),a})(),e.exports=r(n(609))},609:e=>{"use strict";e.exports=window.React},795:e=>{"use strict";e.exports=window.ReactDOM}},o={};function l(e){var t=o[e];if(void 0!==t)return t.exports;var n=o[e]={exports:{}};return a[e].call(n.exports,n,n.exports,l),n.exports}l.m=a,l.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return l.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,l.t=function(n,r){if(1&r&&(n=this(n)),8&r)return n;if("object"==typeof n&&n){if(4&r&&n.__esModule)return n;if(16&r&&"function"==typeof n.then)return n}var a=Object.create(null);l.r(a);var o={};e=e||[null,t({}),t([]),t(t)];for(var i=2&r&&n;"object"==typeof i&&!~e.indexOf(i);i=t(i))Object.getOwnPropertyNames(i).forEach(e=>o[e]=()=>n[e]);return o.default=()=>n,l.d(a,o),a},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.f={},l.e=e=>Promise.all(Object.keys(l.f).reduce((t,n)=>(l.f[n](e,t),t),[])),l.u=e=>e+".index.min.js",l.miniCssF=e=>{},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),n={},r="@envira/imagely-admin-app:",l.l=(e,t,a,o)=>{if(n[e])n[e].push(t);else{var i,c;if(void 0!==a)for(var s=document.getElementsByTagName("script"),u=0;u<s.length;u++){var m=s[u];if(m.getAttribute("src")==e||m.getAttribute("data-webpack")==r+a){i=m;break}}i||(c=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,l.nc&&i.setAttribute("nonce",l.nc),i.setAttribute("data-webpack",r+a),i.src=e),n[e]=[t];var d=(t,r)=>{i.onerror=i.onload=null,clearTimeout(g);var a=n[e];if(delete n[e],i.parentNode&&i.parentNode.removeChild(i),a&&a.forEach(e=>e(r)),t)return t(r)},g=setTimeout(d.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=d.bind(null,i.onerror),i.onload=d.bind(null,i.onload),c&&document.head.appendChild(i)}},l.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{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 r=n.length-1;r>-1&&(!e||!/^http(s?):/.test(e));)e=n[r--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),l.p=e})(),(()=>{var e={792:0};l.f.j=(t,n)=>{var r=l.o(e,t)?e[t]:void 0;if(0!==r)if(r)n.push(r[2]);else{var a=new Promise((n,a)=>r=e[t]=[n,a]);n.push(r[2]=a);var o=l.p+l.u(t),i=new Error;l.l(o,n=>{if(l.o(e,t)&&(0!==(r=e[t])&&(e[t]=void 0),r)){var a=n&&("load"===n.type?"missing":n.type),o=n&&n.target&&n.target.src;i.message="Loading chunk "+t+" failed.\n("+a+": "+o+")",i.name="ChunkLoadError",i.type=a,i.request=o,r[1](i)}},"chunk-"+t,t)}};var t=(t,n)=>{var r,a,[o,i,c]=n,s=0;if(o.some(t=>0!==e[t])){for(r in i)l.o(i,r)&&(l.m[r]=i[r]);c&&c(l)}for(t&&t(n);s<o.length;s++)a=o[s],l.o(e,a)&&e[a]&&e[a][0](),e[a]=0},n=self.webpackChunk_envira_imagely_admin_app=self.webpackChunk_envira_imagely_admin_app||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})(),(()=>{"use strict";var e=l(338);function t(e){return t="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},t(e)}function n(e,n,r){return(n=function(e){var n=function(e){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=t(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==t(n)?n:n+""}(n))in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}var r={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},a=new class{#e=r;#t=!1;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}},o="undefined"==typeof window||"Deno"in globalThis;function i(){}function c(e){return"number"==typeof e&&e>=0&&e!==1/0}function s(e,t){return Math.max(e+(t||0)-Date.now(),0)}function u(e,t){return"function"==typeof e?e(t):e}function m(e,t){return"function"==typeof e?e(t):e}function d(e,t){const{type:n="all",exact:r,fetchStatus:a,predicate:o,queryKey:l,stale:i}=e;if(l)if(r){if(t.queryHash!==p(l,t.options))return!1}else if(!y(t.queryKey,l))return!1;if("all"!==n){const e=t.isActive();if("active"===n&&!e)return!1;if("inactive"===n&&e)return!1}return!("boolean"==typeof i&&t.isStale()!==i||a&&a!==t.state.fetchStatus||o&&!o(t))}function g(e,t){const{exact:n,status:r,predicate:a,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(f(t.options.mutationKey)!==f(o))return!1}else if(!y(t.options.mutationKey,o))return!1}return!(r&&t.state.status!==r||a&&!a(t))}function p(e,t){return(t?.queryKeyHashFn||f)(e)}function f(e){return JSON.stringify(e,(e,t)=>w(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function y(e,t){return e===t||typeof e==typeof t&&!(!e||!t||"object"!=typeof e||"object"!=typeof t)&&Object.keys(t).every(n=>y(e[n],t[n]))}var h=Object.prototype.hasOwnProperty;function b(e,t){if(e===t)return e;const n=_(e)&&_(t);if(!(n||w(e)&&w(t)))return t;const r=(n?e:Object.keys(e)).length,a=n?t:Object.keys(t),o=a.length,l=n?new Array(o):{};let i=0;for(let c=0;c<o;c++){const o=n?c:a[c],s=e[o],u=t[o];if(s===u){l[o]=s,(n?c<r:h.call(e,o))&&i++;continue}if(null===s||null===u||"object"!=typeof s||"object"!=typeof u){l[o]=u;continue}const m=b(s,u);l[o]=m,m===s&&i++}return r===o&&i===r?e:l}function v(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 _(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function w(e){if(!x(e))return!1;const t=e.constructor;if(void 0===t)return!0;const n=t.prototype;return!!x(n)&&!!n.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(e)===Object.prototype}function x(e){return"[object Object]"===Object.prototype.toString.call(e)}function E(e,t,n){return"function"==typeof n.structuralSharing?n.structuralSharing(e,t):!1!==n.structuralSharing?b(e,t):t}function C(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function N(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var k=Symbol();function S(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:e.queryFn&&e.queryFn!==k?e.queryFn:()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`))}function O(e,t){return"function"==typeof e?e(...t):!!e}var P=function(e){setTimeout(e,0)},j=function(){let e=[],t=0,n=e=>{e()},r=e=>{e()},a=P;const o=r=>{t?e.push(r):a(()=>{n(r)})};return{batch:o=>{let l;t++;try{l=o()}finally{t--,t||(()=>{const t=e;e=[],t.length&&a(()=>{r(()=>{t.forEach(e=>{n(e)})})})})()}return l},batchCalls:e=>(...t)=>{o(()=>{e(...t)})},schedule:o,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{a=e}}}(),T=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(){}},I=new class extends T{#n;#r;#a;constructor(){super(),this.#a=e=>{if(!o&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#r||this.setEventListener(this.#a)}onUnsubscribe(){this.hasListeners()||(this.#r?.(),this.#r=void 0)}setEventListener(e){this.#a=e,this.#r?.(),this.#r=e(e=>{"boolean"==typeof e?this.setFocused(e):this.onFocus()})}setFocused(e){this.#n!==e&&(this.#n=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return"boolean"==typeof this.#n?this.#n:"hidden"!==globalThis.document?.visibilityState}},A=new class extends T{#o=!0;#r;#a;constructor(){super(),this.#a=e=>{if(!o&&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.#r||this.setEventListener(this.#a)}onUnsubscribe(){this.hasListeners()||(this.#r?.(),this.#r=void 0)}setEventListener(e){this.#a=e,this.#r?.(),this.#r=e(this.setOnline.bind(this))}setOnline(e){this.#o!==e&&(this.#o=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#o}};function D(){let e,t;const n=new Promise((n,r)=>{e=n,t=r});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.status="pending",n.catch(()=>{}),n.resolve=t=>{r({status:"fulfilled",value:t}),e(t)},n.reject=e=>{r({status:"rejected",reason:e}),t(e)},n}function L(e){return Math.min(1e3*2**e,3e4)}function F(e){return"online"!==(e??"online")||A.isOnline()}var M=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function R(e){let t,n=!1,r=0;const l=D(),i=()=>"pending"!==l.status,c=()=>I.isFocused()&&("always"===e.networkMode||A.isOnline())&&e.canRun(),s=()=>F(e.networkMode)&&e.canRun(),u=e=>{i()||(t?.(),l.resolve(e))},m=e=>{i()||(t?.(),l.reject(e))},d=()=>new Promise(n=>{t=e=>{(i()||c())&&n(e)},e.onPause?.()}).then(()=>{t=void 0,i()||e.onContinue?.()}),g=()=>{if(i())return;let t;const l=0===r?e.initialPromise:void 0;try{t=l??e.fn()}catch(e){t=Promise.reject(e)}Promise.resolve(t).then(u).catch(t=>{if(i())return;const l=e.retry??(o?0:3),s=e.retryDelay??L,u="function"==typeof s?s(r,t):s,p=!0===l||"number"==typeof l&&r<l||"function"==typeof l&&l(r,t);var f;!n&&p?(r++,e.onFail?.(r,t),(f=u,new Promise(e=>{a.setTimeout(e,f)})).then(()=>c()?void 0:d()).then(()=>{n?m(t):g()})):m(t)})};return{promise:l,status:()=>l.status,cancel:t=>{if(!i()){const n=new M(t);m(n),e.onCancel?.(n)}},continue:()=>(t?.(),l),cancelRetry:()=>{n=!0},continueRetry:()=>{n=!1},canStart:s,start:()=>(s()?g():d().then(g),l)}}var G=class{#l;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),c(this.gcTime)&&(this.#l=a.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(o?1/0:3e5))}clearGcTimeout(){this.#l&&(a.clearTimeout(this.#l),this.#l=void 0)}},B=class extends G{#i;#c;#s;#u;#m;#d;#g;constructor(e){super(),this.#g=!1,this.#d=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#u=e.client,this.#s=this.#u.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#i=q(this.options),this.state=e.state??this.#i,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#m?.promise}setOptions(e){if(this.options={...this.#d,...e},this.updateGcTime(this.options.gcTime),this.state&&void 0===this.state.data){const e=q(this.options);void 0!==e.data&&(this.setState(U(e.data,e.dataUpdatedAt)),this.#i=e)}}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#s.remove(this)}setData(e,t){const n=E(this.state.data,e,this.options);return this.#p({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#p({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#m?.promise;return this.#m?.cancel(e),t?t.then(i).catch(i):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#i)}isActive(){return this.observers.some(e=>!1!==m(e.options.enabled,this))}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===k||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>"static"===u(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||!s(this.state.dataUpdatedAt,e))}onFocus(){const e=this.observers.find(e=>e.shouldFetchOnWindowFocus());e?.refetch({cancelRefetch:!1}),this.#m?.continue()}onOnline(){const e=this.observers.find(e=>e.shouldFetchOnReconnect());e?.refetch({cancelRefetch:!1}),this.#m?.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.#m&&(this.#g?this.#m.cancel({revert:!0}):this.#m.cancelRetry()),this.scheduleGc()),this.#s.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#p({type:"invalidate"})}async fetch(e,t){if("idle"!==this.state.fetchStatus&&"rejected"!==this.#m?.status())if(void 0!==this.state.data&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#m)return this.#m.continueRetry(),this.#m.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,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#g=!0,n.signal)})},a=()=>{const e=S(this.options,t),n=(()=>{const e={client:this.#u,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#g=!1,this.options.persister?this.options.persister(e,n,this):e(n)},o=(()=>{const e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#u,state:this.state,fetchFn:a};return r(e),e})();this.options.behavior?.onFetch(o,this),this.#c=this.state,"idle"!==this.state.fetchStatus&&this.state.fetchMeta===o.fetchOptions?.meta||this.#p({type:"fetch",meta:o.fetchOptions?.meta}),this.#m=R({initialPromise:t?.initialPromise,fn:o.fetchFn,onCancel:e=>{e instanceof M&&e.revert&&this.setState({...this.#c,fetchStatus:"idle"}),n.abort()},onFail:(e,t)=>{this.#p({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#p({type:"pause"})},onContinue:()=>{this.#p({type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0});try{const e=await this.#m.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 M){if(e.silent)return this.#m.promise;if(e.revert){if(void 0===this.state.data)throw e;return this.state.data}}throw this.#p({type:"error",error:e}),this.#s.config.onError?.(e,this),this.#s.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#p(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,...z(t.data,this.options),fetchMeta:e.meta??null};case"success":const n={...t,...U(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#c=e.manual?n:void 0,n;case"error":const r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:"idle",status:"error"};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...e.state}}})(this.state),j.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#s.notify({query:this,type:"updated",action:e})})}};function z(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:F(t.networkMode)?"fetching":"paused",...void 0===e&&{error:null,status:"pending"}}}function U(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function q(e){const t="function"==typeof e.initialData?e.initialData():e.initialData,n=void 0!==t,r=n?"function"==typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Q=class extends T{constructor(e={}){super(),this.config=e,this.#f=new Map}#f;build(e,t,n){const r=t.queryKey,a=t.queryHash??p(r,t);let o=this.get(a);return o||(o=new B({client:e,queryKey:r,queryHash:a,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(o)),o}add(e){this.#f.has(e.queryHash)||(this.#f.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#f.get(e.queryHash);t&&(e.destroy(),t===e&&this.#f.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){j.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#f.get(e)}getAll(){return[...this.#f.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(e=>d(t,e))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(t=>d(e,t)):t}notify(e){j.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){j.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){j.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},W=class extends G{#u;#y;#h;#m;constructor(e){super(),this.#u=e.client,this.mutationId=e.mutationId,this.#h=e.mutationCache,this.#y=[],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.#y.includes(e)||(this.#y.push(e),this.clearGcTimeout(),this.#h.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#y=this.#y.filter(t=>t!==e),this.scheduleGc(),this.#h.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#y.length||("pending"===this.state.status?this.scheduleGc():this.#h.remove(this))}continue(){return this.#m?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#p({type:"continue"})},n={client:this.#u,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#m=R({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(new Error("No mutationFn found")),onFail:(e,t)=>{this.#p({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#p({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#h.canRun(this)});const r="pending"===this.state.status,a=!this.#m.canStart();try{if(r)t();else{this.#p({type:"pending",variables:e,isPaused:a}),await(this.#h.config.onMutate?.(e,this,n));const t=await(this.options.onMutate?.(e,n));t!==this.state.context&&this.#p({type:"pending",context:t,variables:e,isPaused:a})}const o=await this.#m.start();return await(this.#h.config.onSuccess?.(o,e,this.state.context,this,n)),await(this.options.onSuccess?.(o,e,this.state.context,n)),await(this.#h.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n)),await(this.options.onSettled?.(o,null,e,this.state.context,n)),this.#p({type:"success",data:o}),o}catch(t){try{throw await(this.#h.config.onError?.(t,e,this.state.context,this,n)),await(this.options.onError?.(t,e,this.state.context,n)),await(this.#h.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)),await(this.options.onSettled?.(void 0,t,e,this.state.context,n)),t}finally{this.#p({type:"error",error:t})}}finally{this.#h.runNext(this)}}#p(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),j.batch(()=>{this.#y.forEach(t=>{t.onMutationUpdate(e)}),this.#h.notify({mutation:this,type:"updated",action:e})})}},H=class extends T{constructor(e={}){super(),this.config=e,this.#b=new Set,this.#v=new Map,this.#_=0}#b;#v;#_;build(e,t,n){const r=new W({client:e,mutationCache:this,mutationId:++this.#_,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#b.add(e);const t=V(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.#b.delete(e)){const t=V(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=V(e);if("string"==typeof t){const n=this.#v.get(t),r=n?.find(e=>"pending"===e.state.status);return!r||r===e}return!0}runNext(e){const t=V(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(){j.batch(()=>{this.#b.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#b.clear(),this.#v.clear()})}getAll(){return Array.from(this.#b)}find(e){const t={exact:!0,...e};return this.getAll().find(e=>g(t,e))}findAll(e={}){return this.getAll().filter(t=>g(e,t))}notify(e){j.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(e=>e.state.isPaused);return j.batch(()=>Promise.all(e.map(e=>e.continue().catch(i))))}};function V(e){return e.options.scope?.id}function K(e){return{onFetch:(t,n)=>{const r=t.options,a=t.fetchOptions?.meta?.fetchMore?.direction,o=t.state.data?.pages||[],l=t.state.data?.pageParams||[];let i={pages:[],pageParams:[]},c=0;const s=async()=>{let n=!1;const s=S(t.options,t.fetchOptions),u=async(e,r,a)=>{if(n)return Promise.reject();if(null==r&&e.pages.length)return Promise.resolve(e);const o=(()=>{const e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:a?"backward":"forward",meta:t.options.meta};var o;return o=e,Object.defineProperty(o,"signal",{enumerable:!0,get:()=>(t.signal.aborted?n=!0:t.signal.addEventListener("abort",()=>{n=!0}),t.signal)}),e})(),l=await s(o),{maxPages:i}=t.options,c=a?N:C;return{pages:c(e.pages,l,i),pageParams:c(e.pageParams,r,i)}};if(a&&o.length){const e="backward"===a,t={pages:o,pageParams:l},n=(e?Y:X)(r,t);i=await u(t,n,e)}else{const t=e??o.length;do{const e=0===c?l[0]??r.initialPageParam:X(r,i);if(c>0&&null==e)break;i=await u(i,e),c++}while(c<t)}return i};t.options.persister?t.fetchFn=()=>t.options.persister?.(s,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=s}}}function X(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Y(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Z(e,t){return!!t&&null!=X(e,t)}function J(e,t){return!(!t||!e.getPreviousPageParam)&&null!=Y(e,t)}var $=l(609),ee=l.n($);const te=window.ReactJSXRuntime;var ne=$.createContext(void 0),re=e=>{const t=$.useContext(ne);if(e)return e;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},ae=({client:e,children:t})=>($.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,te.jsx)(ne.Provider,{value:e,children:t})),oe=new class{#w;#h;#d;#x;#E;#C;#N;#k;constructor(e={}){this.#w=e.queryCache||new Q,this.#h=e.mutationCache||new H,this.#d=e.defaultOptions||{},this.#x=new Map,this.#E=new Map,this.#C=0}mount(){this.#C++,1===this.#C&&(this.#N=I.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#w.onFocus())}),this.#k=A.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#w.onOnline())}))}unmount(){this.#C--,0===this.#C&&(this.#N?.(),this.#N=void 0,this.#k?.(),this.#k=void 0)}isFetching(e){return this.#w.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#h.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#w.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=this.#w.build(this,t),r=n.state.data;return void 0===r?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(u(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#w.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),a=this.#w.get(r.queryHash),o=a?.state.data,l=function(e,t){return"function"==typeof e?e(t):e}(t,o);if(void 0!==l)return this.#w.build(this,r).setData(l,{...n,manual:!0})}setQueriesData(e,t,n){return j.batch(()=>this.#w.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#w.get(t.queryHash)?.state}removeQueries(e){const t=this.#w;j.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){const n=this.#w;return j.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=j.batch(()=>this.#w.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(i).catch(i)}invalidateQueries(e,t={}){return j.batch(()=>(this.#w.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},r=j.batch(()=>this.#w.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(i)),"paused"===e.state.fetchStatus?Promise.resolve():t}));return Promise.all(r).then(i)}fetchQuery(e){const t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);const n=this.#w.build(this,t);return n.isStaleByTime(u(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(i).catch(i)}fetchInfiniteQuery(e){return e.behavior=K(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(i).catch(i)}ensureInfiniteQueryData(e){return e.behavior=K(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return A.isOnline()?this.#h.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#w}getMutationCache(){return this.#h}getDefaultOptions(){return this.#d}setDefaultOptions(e){this.#d=e}setQueryDefaults(e,t){this.#x.set(f(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#x.values()],n={};return t.forEach(t=>{y(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#E.set(f(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#E.values()],n={};return t.forEach(t=>{y(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#d.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=p(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===k&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#d.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#w.clear(),this.#h.clear()}}({defaultOptions:{queries:{staleTime:3e5,gcTime:6e5,retry:3,refetchOnWindowFocus:!1,refetchOnReconnect:!0,refetchOnMount:!0},mutations:{retry:1,onError:function(e){console.error("Mutation error:",e)}}}}),le=function(e){var t=e.children;return ee().createElement(ae,{client:oe},t)},ie=!1,ce={},se=null,ue=function(e){ie=e,e&&se&&(clearTimeout(se),se=null,ce={})},me=function(){if(null!==document.getElementById("add-ngg-gallery-modal"))ce={};else if(ie)ce={};else{var e=new URLSearchParams(window.location.search);void 0!==ce.tab&&e.set("tab",ce.tab),void 0!==ce.subtab&&(null!==ce.subtab?e.set("subtab",ce.subtab):e.has("subtab")&&e.delete("subtab")),void 0!==ce.page&&e.set("page",ce.page),void 0!==ce.id&&(null!==ce.id?e.set("id",ce.id.toString()):e.has("id")&&e.delete("id"));var t="".concat(window.location.pathname,"?").concat(e.toString());window.history.pushState({},"",t),ce={},se=null}},de=function(e){null!==document.getElementById("add-ngg-gallery-modal")||ie||(Object.assign(ce,e),se&&clearTimeout(se),se=window.setTimeout(me,0))};const ge=window.wp.data,pe=window.wp.i18n;function fe(){return fe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},fe.apply(null,arguments)}function ye(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var he,be=["className"],ve=["className"],_e=["className"],we=["className"],xe=["className"],Ee=["className"],Ce=["className"],Ne=["className","width","height"],ke=["className"],Se=["className"],Oe=["className"],Pe=["className"],je=["className"],Te=["className"],Ie=["className"],Ae=["className"],De=["className"],Le=["className"],Fe=["className"],Me=["className"],Re=["className"],Ge=["className"],Be=["className"],ze=["className"],Ue=["className"],qe=["className"],Qe=["className"],We=["className"],He=["className"],Ve=["className"],Ke=["className"],Xe=["className"],Ye=["className"],Ze=["className"],Je=["className"],$e=["className"],et=["className"],tt=["className"],nt=["className"],rt=["className"],at=["className"],ot=["className"],lt=["className"],it=["className"],ct=["className"],st=["className"],ut=["className"],mt=["className"],dt=["className"],gt=["className"],pt=["className"],ft=["className"],yt=["className"],ht=["className"],bt=["className"],vt=["className"],_t=["className"],wt=["className"],xt=["className"],Et=["className"],Ct=["className"],Nt=["className"],kt=["className"],St=["className"],Ot=["className"],Pt=["className"],jt=["className"],Tt=["className"],It=["className"],At=["className"],Dt=["className"],Lt=["className"],Ft=["className"],Mt=["className"],Rt=["className"],Gt=["className"],Bt=["className"],zt=["className"],Ut=["className"],qt=["className"],Qt=["className"],Wt=["className"],Ht=["className"],Vt=["className"],Kt=["className"],Xt=["className"],Yt=["className"],Zt=["className"],Jt=["className"],$t=["className"],en=["className"],tn=function(e){var t=e.className,n=ye(e,be);return ee().createElement("svg",fe({className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},n),ee().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))},nn=function(e){var t=e.className,n=ye(e,ve);return ee().createElement("svg",fe({className:t,width:"20",height:"20",viewBox:"0 0 15 16",xmlns:"http://www.w3.org/2000/svg"},n),ee().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13.3333 0.5H1.66667C0.75 0.5 0 1.25 0 2.16667V13.8333C0 14.75 0.741667 15.5 1.66667 15.5H13.3333C14.25 15.5 15 14.75 15 13.8333V2.16667C15 1.25 14.25 0.5 13.3333 0.5ZM13.3333 13.8333H1.66667V11.3333H4.63333C5.20833 12.325 6.275 13 7.50833 13C8.74167 13 9.8 12.325 10.3833 11.3333H13.3333V13.8333ZM9.175 9.66667H13.3333V2.16667H1.66667V9.66667H5.84167C5.84167 10.5833 6.59167 11.3333 7.50833 11.3333C8.425 11.3333 9.175 10.5833 9.175 9.66667Z",fill:"currentColor"}))},rn=function(e){var t=e.className,n=ye(e,_e);return ee().createElement("svg",fe({xmlns:"http://www.w3.org/2000/svg",className:t,viewBox:"0 0 20 20",fill:"currentColor"},n),ee().createElement("path",{fillRule:"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z",clipRule:"evenodd"}))},an=function(e){var t=e.className,n=ye(e,we);return ee().createElement("svg",fe({xmlns:"http://www.w3.org/2000/svg",className:t,viewBox:"0 0 20 20",fill:"currentColor"},n),ee().createElement("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"}))},on=function(e){var t=e.className,n=ye(e,xe);return ee().createElement("svg",fe({className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},n),ee().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"}))},ln=function(e){var t=e.className,n=ye(e,Ee);return ee().createElement("svg",fe({className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},n),ee().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"}))},cn=function(e){var t=e.className,n=ye(e,Ce);return ee().createElement("svg",fe({className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},n),ee().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"}))},sn=function(e){var t=e.className,n=e.width,r=void 0===n?8:n,a=e.height,o=void 0===a?8:a,l=ye(e,Ne);return ee().createElement("svg",fe({width:r,height:o,viewBox:"0 0 10 10",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t},l),ee().createElement("path",{d:"M7.5 0.500151C7.63132 0.368829 7.78722 0.264659 7.9588 0.193588C8.13038 0.122517 8.31428 0.0859375 8.5 0.0859375C8.68572 0.0859375 8.86962 0.122517 9.0412 0.193588C9.21278 0.264659 9.36868 0.36883 9.5 0.500151C9.63132 0.631473 9.73549 0.787375 9.80656 0.958955C9.87763 1.13054 9.91421 1.31443 9.91421 1.50015C9.91421 1.68587 9.87763 1.86977 9.80656 2.04135C9.73549 2.21293 9.63132 2.36883 9.5 2.50015L2.75 9.25015L0 10.0002L0.75 7.25015L7.5 0.500151Z",fill:"currentColor"}))},un=function(e){var t=e.className,n=ye(e,ke);return ee().createElement("svg",fe({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:t},n),ee().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6.75a.75.75 0 110-1.5.75.75 0 010 1.5zM12 12.75a.75.75 0 110-1.5.75.75 0 010 1.5zM12 18.75a.75.75 0 110-1.5.75.75 0 010 1.5z"}))},mn=function(e){var t=e.className,n=ye(e,Se);return ee().createElement("svg",fe({width:"20",height:"20",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t},n),ee().createElement("path",{d:"M14.7461 17.2533H8.32279L9.70145 18.6005C9.95211 18.8512 10.0774 19.154 10.0774 19.5091C10.0774 19.8642 9.95211 20.1671 9.70145 20.4177C9.45078 20.6684 9.1479 20.7937 8.79279 20.7937C8.43768 20.7937 8.13479 20.6684 7.88413 20.4177L4.34349 16.8773C4.21816 16.752 4.12917 16.6162 4.07653 16.47C4.02389 16.3238 3.99841 16.1671 4.00008 16C4.00175 15.8329 4.02807 15.6762 4.07904 15.53C4.13001 15.3838 4.21857 15.248 4.34474 15.1227L7.88538 11.5823C8.13605 11.3316 8.43392 11.2063 8.779 11.2063C9.12408 11.2063 9.42154 11.3316 9.67137 11.5823C9.9212 11.8329 10.0465 12.1308 10.0474 12.4758C10.0482 12.8209 9.92287 13.1183 9.67137 13.3681L8.29146 14.7467H14.7461V8.29244L13.3361 9.70236C13.0854 9.95301 12.793 10.0733 12.4588 10.0633C12.1245 10.0533 11.8321 9.92252 11.5814 9.67103C11.3308 9.41954 11.2054 9.1221 11.2054 8.77871C11.2054 8.43531 11.3308 8.13745 11.5814 7.88513L15.1221 4.34467C15.2474 4.21934 15.3832 4.13036 15.5294 4.07772C15.6756 4.02508 15.8323 3.99918 15.9994 4.00002C16.1665 4.00086 16.3232 4.02676 16.4694 4.07772C16.6156 4.12869 16.7514 4.21767 16.8767 4.34467L20.4487 7.91646C20.6994 8.16711 20.8247 8.45954 20.8247 8.79375C20.8247 9.12795 20.6994 9.42038 20.4487 9.67103C20.198 9.92168 19.9002 10.047 19.5551 10.047C19.21 10.047 18.9125 9.92168 18.6627 9.67103L17.2527 8.29244V14.7467H23.676L22.2974 13.3995C22.0467 13.1488 21.9214 12.846 21.9214 12.4909C21.9214 12.1358 22.0467 11.8329 22.2974 11.5823C22.548 11.3316 22.8509 11.2063 23.206 11.2063C23.5611 11.2063 23.864 11.3316 24.1147 11.5823L27.6553 15.1227C27.7806 15.248 27.8696 15.3838 27.9223 15.53C27.9749 15.6762 28.0008 15.8329 28 16C27.9991 16.1671 27.9732 16.3238 27.9223 16.47C27.8713 16.6162 27.7823 16.752 27.6553 16.8773L24.0833 20.4491C23.8327 20.6997 23.5402 20.82 23.206 20.81C22.8718 20.8 22.5794 20.6692 22.3287 20.4177C22.078 20.1663 21.9527 19.8688 21.9527 19.5254C21.9527 19.182 22.078 18.8842 22.3287 18.6318L23.7073 17.2533H17.2527V23.6762L18.6 22.2976C18.8507 22.047 19.1536 21.9217 19.5087 21.9217C19.8638 21.9217 20.1667 22.047 20.4174 22.2976C20.668 22.5483 20.7934 22.8512 20.7934 23.2063C20.7934 23.5613 20.668 23.8642 20.4174 24.1149L16.8767 27.6553C16.7514 27.7807 16.6156 27.8696 16.4694 27.9223C16.3232 27.9749 16.1665 28.0008 15.9994 28C15.8323 27.9991 15.6756 27.9732 15.5294 27.9223C15.3832 27.8713 15.2474 27.7823 15.1221 27.6553L11.5501 24.0835C11.2994 23.8329 11.1795 23.5354 11.1904 23.1912C11.2013 22.847 11.3316 22.5491 11.5814 22.2976C11.8313 22.0462 12.1291 21.9208 12.4751 21.9217C12.821 21.9225 13.1184 22.0478 13.3674 22.2976L14.7461 23.7076V17.2533Z",fill:"currentColor"}))},dn=function(e){var t=e.className,n=ye(e,Oe);return ee().createElement("svg",fe({className:t,fill:"#EBAD35",viewBox:"0 0 18 18"},n),ee().createElement("path",{d:"M8.167 4.833h1.666V6.5H8.167V4.833zm0 3.333h1.666v5H8.167v-5zM9 .666A8.336 8.336 0 00.667 9c0 4.6 3.733 8.333 8.333 8.333S17.333 13.6 17.333 9 13.6.667 9 .667zm0 15A6.676 6.676 0 012.333 9 6.676 6.676 0 019 2.333 6.675 6.675 0 0115.667 9 6.675 6.675 0 019 15.666z"}))},gn=function(e){var t=e.className,n=ye(e,Pe);return ee().createElement("svg",fe({className:t,fill:"none",viewBox:"0 0 20 20"},n),ee().createElement("path",{fill:"#D99B3D",d:"M6.25 9.167a2.81 2.81 0 01-2.063-.854 2.81 2.81 0 01-.854-2.063c0-.805.285-1.493.854-2.062a2.81 2.81 0 012.063-.854 2.81 2.81 0 012.062.854c.57.57.855 1.257.855 2.062a2.81 2.81 0 01-.855 2.063 2.81 2.81 0 01-2.062.854zm0-1.667c.347 0 .642-.121.885-.364s.365-.539.365-.886-.122-.642-.365-.885A1.205 1.205 0 006.25 5c-.347 0-.642.122-.886.365A1.205 1.205 0 005 6.25c0 .347.121.643.364.886.244.243.539.364.886.364zm7.5 9.167a2.81 2.81 0 01-2.063-.854 2.81 2.81 0 01-.854-2.063c0-.805.285-1.493.854-2.062a2.81 2.81 0 012.063-.854 2.81 2.81 0 012.062.854c.57.57.855 1.257.855 2.062a2.81 2.81 0 01-.855 2.063 2.81 2.81 0 01-2.062.854zm0-1.667c.347 0 .642-.121.885-.364s.365-.539.365-.886-.122-.642-.365-.885a1.206 1.206 0 00-.885-.365c-.347 0-.642.122-.886.365a1.205 1.205 0 00-.364.885c0 .347.121.643.364.886.244.243.539.364.886.364zM4.5 16.667L3.333 15.5 15.5 3.334 16.667 4.5 4.5 16.667z"}))},pn=function(e){var t=e.className,n=ye(e,je);return ee().createElement("svg",fe({className:t,fill:"#37993B",viewBox:"0 0 21 20"},n),ee().createElement("path",{d:"M10.5 1.667A8.336 8.336 0 002.167 10c0 4.6 3.733 8.333 8.333 8.333S18.833 14.6 18.833 10 15.1 1.667 10.5 1.667zm0 15A6.676 6.676 0 013.833 10 6.676 6.676 0 0110.5 3.333 6.675 6.675 0 0117.167 10a6.675 6.675 0 01-6.667 6.666zm3.825-10.35l-5.492 5.491-2.158-2.15L5.5 10.833l3.333 3.333L15.5 7.5l-1.175-1.184z"}))},fn=function(e){var t=e.className,n=ye(e,Te);return ee().createElement("svg",fe({className:t,fill:"currentColor",fillOpacity:"0.7",viewBox:"0 0 20 20"},n),ee().createElement("path",{fillRule:"evenodd",d:"M16.252 10a6.5 6.5 0 01-.058.816l1.758 1.375c.158.125.2.35.1.534l-1.667 2.883a.413.413 0 01-.358.208.47.47 0 01-.15-.025l-2.075-.833a6.4 6.4 0 01-1.409.817l-.316 2.208c-.025.2-.2.35-.409.35H8.335a.406.406 0 01-.408-.35l-.317-2.208a6.088 6.088 0 01-1.408-.817l-2.075.833a.416.416 0 01-.508-.183l-1.667-2.883a.42.42 0 01.1-.534l1.758-1.375A6.61 6.61 0 013.752 10c0-.275.025-.55.058-.817L2.052 7.808a.41.41 0 01-.1-.533L3.618 4.39a.413.413 0 01.359-.208c.05 0 .1.008.15.025l2.075.833c.433-.325.9-.608 1.408-.816l.317-2.208c.025-.2.2-.35.408-.35h3.333c.209 0 .384.15.409.35l.316 2.208c.509.208.975.483 1.409.817l2.075-.834a.416.416 0 01.508.183l1.667 2.884a.42.42 0 01-.1.533l-1.759 1.375a6.5 6.5 0 01.059.817zm-1.667 0c0-.175-.008-.35-.042-.608l-.116-.942.742-.583.891-.709-.583-1.008-1.059.425-.883.358-.758-.583a4.726 4.726 0 00-1.025-.592l-.884-.358-.133-.942-.158-1.125H9.418l-.166 1.125-.134.942-.883.358a4.881 4.881 0 00-1.042.609l-.75.566-.866-.35-1.059-.425-.583 1.008.9.7.742.584-.117.942c-.025.25-.042.441-.042.608 0 .166.017.358.042.617l.117.941-.742.584-.9.7.583 1.008 1.059-.425.883-.359.758.584c.334.25.667.441 1.025.591l.884.359.133.941.158 1.125h1.167l.167-1.125.133-.941.883-.358a4.886 4.886 0 001.042-.609l.75-.566.867.35 1.058.425.584-1.009-.9-.7-.742-.583.117-.942c.024-.25.041-.433.041-.608zm-4.583-3.333A3.332 3.332 0 1013.335 10a3.332 3.332 0 00-3.333-3.333zM8.335 10c0 .916.75 1.666 1.667 1.666.916 0 1.666-.75 1.666-1.666 0-.917-.75-1.667-1.666-1.667-.917 0-1.667.75-1.667 1.667z",clipRule:"evenodd"}))},yn=function(e){var t=e.className,n=ye(e,Ie);return ee().createElement("svg",fe({className:t,viewBox:"0 0 20 20",fill:"currentColor"},n),ee().createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"}))},hn=function(e){var t=e.className,n=ye(e,Ae);return ee().createElement("svg",fe({className:t,width:"8",height:"12",viewBox:"0 0 8 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n),ee().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.5286 0.195262C3.78894 -0.0650874 4.21106 -0.0650874 4.4714 0.195262L7.80474 3.5286C8.06509 3.78894 8.06509 4.21106 7.80474 4.4714C7.54439 4.73175 7.12228 4.73175 6.86193 4.4714L4 1.60948L1.13807 4.4714C0.877722 4.73175 0.455612 4.73175 0.195262 4.4714C-0.0650874 4.21106 -0.0650874 3.78894 0.195262 3.5286L3.5286 0.195262ZM0.195262 7.5286C0.455612 7.26825 0.877722 7.26825 1.13807 7.5286L4 10.3905L6.86193 7.5286C7.12228 7.26825 7.54439 7.26825 7.80474 7.5286C8.06509 7.78895 8.06509 8.21106 7.80474 8.4714L4.4714 11.8047C4.21106 12.0651 3.78894 12.0651 3.5286 11.8047L0.195262 8.4714C-0.0650874 8.21106 -0.0650874 7.78895 0.195262 7.5286Z",fill:"#B7B7B7"}))},bn=function(e){var t=e.className,n=ye(e,De);return ee().createElement("svg",fe({className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},n),ee().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 15l7-7 7 7"}))},vn=function(e){var t=e.className,n=ye(e,Le);return ee().createElement("svg",fe({className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},n),ee().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"}))},_n=function(e){var t=e.className,n=ye(e,Fe);return ee().createElement("svg",fe({width:"16",height:"18",viewBox:"0 0 18 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t},n),ee().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.6667 0.833374C11.1269 0.833374 11.5 1.20647 11.5 1.66671V2.50004H16.5C16.9603 2.50004 17.3334 2.87314 17.3334 3.33337C17.3334 3.79361 16.9603 4.16671 16.5 4.16671H11.5V5.00004C11.5 5.46028 11.1269 5.83337 10.6667 5.83337C10.2064 5.83337 9.83335 5.46028 9.83335 5.00004V1.66671C9.83335 1.20647 10.2064 0.833374 10.6667 0.833374ZM0.666687 3.33337C0.666687 2.87314 1.03978 2.50004 1.50002 2.50004H7.33335C7.79359 2.50004 8.16669 2.87314 8.16669 3.33337C8.16669 3.79361 7.79359 4.16671 7.33335 4.16671H1.50002C1.03978 4.16671 0.666687 3.79361 0.666687 3.33337ZM5.66669 7.50004C6.12692 7.50004 6.50002 7.87314 6.50002 8.33337V11.6667C6.50002 12.1269 6.12692 12.5 5.66669 12.5C5.20645 12.5 4.83335 12.1269 4.83335 11.6667V10.8334H1.50002C1.03978 10.8334 0.666687 10.4603 0.666687 10C0.666687 9.5398 1.03978 9.16671 1.50002 9.16671H4.83335V8.33337C4.83335 7.87314 5.20645 7.50004 5.66669 7.50004ZM8.16669 10C8.16669 9.5398 8.53978 9.16671 9.00002 9.16671H16.5C16.9603 9.16671 17.3334 9.5398 17.3334 10C17.3334 10.4603 16.9603 10.8334 16.5 10.8334H9.00002C8.53978 10.8334 8.16669 10.4603 8.16669 10ZM12.3334 14.1667C12.7936 14.1667 13.1667 14.5398 13.1667 15V15.8334H16.5C16.9603 15.8334 17.3334 16.2065 17.3334 16.6667C17.3334 17.1269 16.9603 17.5 16.5 17.5H13.1667V18.3334C13.1667 18.7936 12.7936 19.1667 12.3334 19.1667C11.8731 19.1667 11.5 18.7936 11.5 18.3334V15C11.5 14.5398 11.8731 14.1667 12.3334 14.1667ZM0.666687 16.6667C0.666687 16.2065 1.03978 15.8334 1.50002 15.8334H9.00002C9.46026 15.8334 9.83335 16.2065 9.83335 16.6667C9.83335 17.1269 9.46026 17.5 9.00002 17.5H1.50002C1.03978 17.5 0.666687 17.1269 0.666687 16.6667Z",fill:"black",fillOpacity:"0.6"}))},wn=function(e){var t=e.className,n=ye(e,Me);return ee().createElement("svg",fe({width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t},n),ee().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.33334 2.66634C4.75601 2.66634 2.66668 4.75568 2.66668 7.33301C2.66668 9.91034 4.75601 11.9997 7.33334 11.9997C9.91067 11.9997 12 9.91034 12 7.33301C12 4.75568 9.91067 2.66634 7.33334 2.66634ZM1.33334 7.33301C1.33334 4.0193 4.01963 1.33301 7.33334 1.33301C10.6471 1.33301 13.3333 4.0193 13.3333 7.33301C13.3333 8.74968 12.8424 10.0517 12.0213 11.0781L14.4714 13.5283C14.7318 13.7886 14.7318 14.2107 14.4714 14.4711C14.2111 14.7314 13.789 14.7314 13.5286 14.4711L11.0785 12.0209C10.052 12.842 8.75002 13.333 7.33334 13.333C4.01963 13.333 1.33334 10.6467 1.33334 7.33301Z",fill:"black"}))},xn=function(e){var t=e.className,n=ye(e,Re);return ee().createElement("svg",fe({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t},n),ee().createElement("path",{d:"M6 7V19C6 20.1046 6.89543 21 8 21H16C17.1046 21 18 20.1046 18 19V7M6 7H5M6 7H8M18 7H19M18 7H16M10 11V17M14 11V17M8 7V5C8 3.89543 8.89543 3 10 3H14C15.1046 3 16 3.89543 16 5V7M8 7H16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}))},En=function(e){var t=e.className,n=ye(e,Ge);return ee().createElement("svg",fe({width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t},n),ee().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.59306 2.74482C5.49465 2.69241 5.38466 2.66552 5.27316 2.66662L5.26663 2.66668L2.66663 2.66665C2.48981 2.66665 2.32025 2.73689 2.19522 2.86191C2.0702 2.98694 1.99996 3.1565 1.99996 3.33332V12C1.99996 12.1768 2.0702 12.3464 2.19522 12.4714C2.32025 12.5964 2.48982 12.6666 2.66663 12.6666H12.3045C12.453 12.6677 12.5977 12.619 12.7154 12.5284C12.8332 12.4378 12.9173 12.3105 12.9545 12.1667L13.9811 8.16665C14.0066 8.06804 14.0091 7.96491 13.9885 7.86517C13.9679 7.76543 13.9248 7.67173 13.8623 7.59127C13.7999 7.51081 13.7198 7.44573 13.6283 7.40101C13.5368 7.35629 13.4363 7.33314 13.3345 7.33331L13.3333 7.33332H6.169C6.05041 7.3372 5.93496 7.37267 5.83461 7.43612C5.73244 7.50071 5.64976 7.59185 5.5954 7.6998L5.59214 7.70628L4.5921 9.6396C4.42295 9.96663 4.02071 10.0946 3.69368 9.92546C3.36664 9.75631 3.23866 9.35407 3.40781 9.02703L4.40631 7.09661C4.56941 6.7743 4.81676 6.50216 5.12213 6.30911C5.42862 6.11535 5.78201 6.00856 6.14452 6.00016L6.15996 5.99998H12.6666V5.33332C12.6666 5.15651 12.5964 4.98694 12.4714 4.86191C12.3463 4.73689 12.1768 4.66665 12 4.66665H8.04663C7.71552 4.6666 7.38949 4.58434 7.09802 4.42725C6.80777 4.27083 6.56072 4.0451 6.37883 3.77015L5.83646 2.96664C5.77514 2.87352 5.69148 2.79723 5.59306 2.74482ZM14 6.11354C14.0727 6.13916 14.1441 6.16903 14.2138 6.20307C14.4883 6.33721 14.7284 6.53247 14.9157 6.77385C15.103 7.01523 15.2325 7.29632 15.2943 7.59554C15.3561 7.8946 15.3485 8.20384 15.2722 8.49953L14.2455 12.5C14.134 12.9315 13.8817 13.3135 13.5284 13.5853C13.1758 13.8565 12.7428 14.0024 12.298 14H12.3L12.2955 14L12.298 14H2.66663C2.13619 14 1.62748 13.7893 1.25241 13.4142C0.87734 13.0391 0.666626 12.5304 0.666626 12V3.33332C0.666626 2.80288 0.87734 2.29418 1.25241 1.9191C1.62749 1.54403 2.13619 1.33332 2.66663 1.33332H5.26369L5.26009 1.33335L5.26663 1.33332H5.26369C5.59694 1.33065 5.9256 1.4113 6.21979 1.56797C6.5138 1.72454 6.76403 1.95206 6.94778 2.22985L7.4901 3.03329C7.55081 3.12547 7.63341 3.20116 7.73057 3.25352C7.8277 3.30586 7.93629 3.33328 8.04663 3.33332H12C12.5304 3.33332 13.0391 3.54403 13.4142 3.9191C13.7892 4.29418 14 4.80288 14 5.33332V6.11354Z",fill:"black",fillOpacity:"0.6"}))},Cn=function(e){var t=e.className,n=ye(e,Be);return ee().createElement("svg",fe({width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t},n),ee().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.00008 2.33341C5.63189 2.33341 5.33342 2.63189 5.33342 3.00008V12.0001C5.33342 12.3683 5.63189 12.6667 6.00008 12.6667H7.9049L12.3828 8.18883C12.8781 7.69366 13.5498 7.41544 14.2501 7.41544C14.7558 7.41544 15.2466 7.5605 15.6667 7.82757V3.00008C15.6667 2.63189 15.3683 2.33341 15.0001 2.33341H6.00008ZM17.3334 3.00008C17.3334 1.71142 16.2887 0.666748 15.0001 0.666748H6.00008C4.71142 0.666748 3.66675 1.71142 3.66675 3.00008V12.0001C3.66675 13.2887 4.71142 14.3334 6.00008 14.3334H8.2495C8.24989 14.3334 8.25027 14.3334 8.25066 14.3334H15.0001C16.2887 14.3334 17.3334 13.2887 17.3334 12.0001V3.00008ZM15.6667 10.0953L14.9389 9.36738C14.9389 9.36737 14.9389 9.3674 14.9389 9.36738C14.7562 9.18475 14.5084 9.08211 14.2501 9.08211C13.9918 9.08211 13.744 9.1847 13.5613 9.36734C13.5613 9.36735 13.5614 9.36732 13.5613 9.36734L10.2619 12.6667H15.0001C15.3683 12.6667 15.6667 12.3683 15.6667 12.0001V10.0953ZM1.50008 3.66675C1.96032 3.66675 2.33341 4.03984 2.33341 4.50008V15.0001C2.33341 15.1769 2.40365 15.3465 2.52868 15.4715C2.6537 15.5965 2.82327 15.6667 3.00008 15.6667H13.5001C13.9603 15.6667 14.3334 16.0398 14.3334 16.5001C14.3334 16.9603 13.9603 17.3334 13.5001 17.3334H3.00008C2.38124 17.3334 1.78775 17.0876 1.35017 16.65C0.912581 16.2124 0.666748 15.6189 0.666748 15.0001V4.50008C0.666748 4.03984 1.03984 3.66675 1.50008 3.66675ZM9.00008 5.33342C8.63189 5.33342 8.33342 5.63189 8.33342 6.00008C8.33342 6.36827 8.63189 6.66675 9.00008 6.66675C9.36827 6.66675 9.66675 6.36827 9.66675 6.00008C9.66675 5.63189 9.36827 5.33342 9.00008 5.33342ZM6.66675 6.00008C6.66675 4.71142 7.71142 3.66675 9.00008 3.66675C10.2887 3.66675 11.3334 4.71142 11.3334 6.00008C11.3334 7.28875 10.2887 8.33342 9.00008 8.33342C7.71142 8.33342 6.66675 7.28875 6.66675 6.00008Z",fill:"#374151"}))},Nn=function(e){var t=e.className,n=ye(e,ze);return ee().createElement("svg",fe({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t},n),ee().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 3C12.5523 3 13 3.44772 13 4V12.1331L14.9029 10.283C15.2989 9.89802 15.932 9.90694 16.317 10.3029C16.702 10.6989 16.6931 11.332 16.2971 11.717L12.6971 15.217C12.309 15.5943 11.691 15.5943 11.3029 15.217L7.70292 11.717C7.30694 11.332 7.29802 10.6989 7.683 10.3029C8.06799 9.90694 8.70109 9.89802 9.09708 10.283L11 12.1331V4C11 3.44772 11.4477 3 12 3ZM2.83013 5.54557C3.35726 5.03308 4.06634 4.75 4.8 4.75H8.4C8.95228 4.75 9.4 5.19772 9.4 5.75C9.4 6.30228 8.95228 6.75 8.4 6.75H4.8C4.57888 6.75 4.37229 6.83566 4.22429 6.97956C4.07724 7.12252 4 7.31032 4 7.5V16.25C4 16.4397 4.07724 16.6275 4.22429 16.7704C4.37229 16.9143 4.57888 17 4.8 17H19.2C19.4211 17 19.6277 16.9143 19.7757 16.7704C19.9228 16.6275 20 16.4397 20 16.25V7.5C20 7.31032 19.9228 7.12252 19.7757 6.97956C19.6277 6.83566 19.4211 6.75 19.2 6.75H15.6C15.0477 6.75 14.6 6.30228 14.6 5.75C14.6 5.19772 15.0477 4.75 15.6 4.75H19.2C19.9337 4.75 20.6427 5.03308 21.1699 5.54557C21.698 6.05898 22 6.76142 22 7.5V16.25C22 16.9886 21.698 17.691 21.1699 18.2044C20.6427 18.7169 19.9337 19 19.2 19H4.8C4.06634 19 3.35725 18.7169 2.83013 18.2044C2.30205 17.691 2 16.9886 2 16.25V7.5C2 6.76142 2.30205 6.05898 2.83013 5.54557Z",fill:"#374151"}))},kn=function(e){var t=e.className,n=ye(e,Ue);return ee().createElement("svg",fe({className:t,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},n),ee().createElement("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),ee().createElement("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"}))},Sn=function(e){var t=e.className,n=ye(e,qe);return ee().createElement("svg",fe({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:t},n),ee().createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-3a1 1 0 00-.867.5 1 1 0 11-1.731-1A3 3 0 0113 8a3.001 3.001 0 01-2 2.83V11a1 1 0 11-2 0v-1a1 1 0 011-1 1 1 0 100-2zm0 8a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"}))},On=function(e){var t=e.className,n=ye(e,Qe);return ee().createElement("svg",fe({xmlns:"http://www.w3.org/2000/svg",className:t,viewBox:"0 0 20 20",fill:"currentColor"},n),ee().createElement("path",{fillRule:"evenodd",d:"M10 2a1 1 0 00-1 1v1.323l-3.954 1.582A1 1 0 004 6.82v10.36c0 .818.897 1.324 1.606.894l3.394-1.697 3.394 1.697c.709.43 1.606-.076 1.606-.894V6.82a1 1 0 00-.046-.025L10 5.323V3a1 1 0 00-1-1z",clipRule:"evenodd"}))},Pn=function(e){var t=e.className,n=ye(e,We);return ee().createElement("svg",fe({xmlns:"http://www.w3.org/2000/svg",className:t,viewBox:"0 0 20 20",fill:"currentColor"},n),ee().createElement("path",{fillRule:"evenodd",d:"M4 3a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V5a2 2 0 00-2-2H4zm12 12H4l4-8 3 6 2-4 3 6z",clipRule:"evenodd"}))},jn=function(e){var t=e.className,n=ye(e,He);return ee().createElement("svg",fe({xmlns:"http://www.w3.org/2000/svg",className:t,viewBox:"0 0 20 20",fill:"currentColor"},n),ee().createElement("path",{fillRule:"evenodd",d:"M3 4a1 1 0 011-1h12a1 1 0 011 1v2a1 1 0 01-1 1H4a1 1 0 01-1-1V4zM3 10a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H4a1 1 0 01-1-1v-6zM14 9a1 1 0 00-1 1v6a1 1 0 001 1h2a1 1 0 001-1v-6a1 1 0 00-1-1h-2z",clipRule:"evenodd"}))},Tn=function(e){var t=e.className,n=ye(e,Ve);return ee().createElement("svg",fe({xmlns:"http://www.w3.org/2000/svg",className:t,viewBox:"0 0 20 20",fill:"currentColor"},n),ee().createElement("path",{fillRule:"evenodd",d:"M11.3 1.046A1 1 0 0112 2v5h4a1 1 0 01.82 1.573l-7 10A1 1 0 018 18v-5H4a1 1 0 01-.82-1.573l7-10a1 1 0 011.12-.38z",clipRule:"evenodd"}))},In=function(e){var t=e.className,n=ye(e,Ke);return ee().createElement("svg",fe({xmlns:"http://www.w3.org/2000/svg",className:t,viewBox:"0 0 20 20",fill:"currentColor"},n),ee().createElement("path",{d:"M11.4191 1.65413L1.65518 11.4213C1.53002 11.5468 1.45972 11.7168 1.45972 11.894C1.45972 12.0713 1.53002 12.2413 1.65518 12.3667C1.78066 12.4919 1.95066 12.5622 2.12789 12.5622C2.30512 12.5622 2.47512 12.4919 2.6006 12.3667L12.3678 2.60285C12.4303 2.54065 12.4798 2.46673 12.5137 2.38533C12.5475 2.30392 12.5649 2.21664 12.5649 2.12849C12.5649 2.04034 12.5475 1.95306 12.5137 1.87166C12.4798 1.79025 12.4303 1.71632 12.3678 1.65413C12.3056 1.59166 12.2317 1.54209 12.1503 1.50827C12.0689 1.47445 11.9816 1.45703 11.8934 1.45703C11.8053 1.45703 11.718 1.47445 11.6366 1.50827C11.5552 1.54209 11.4813 1.59166 11.4191 1.65413Z",fill:"currentColor",fillOpacity:"1"}),ee().createElement("path",{d:"M15.1449 2.51661C14.9684 2.51675 14.7991 2.5866 14.6739 2.71096L2.71277 14.6721C2.58761 14.7975 2.51733 14.9675 2.51733 15.1448C2.51733 15.322 2.58761 15.492 2.71277 15.6175C2.83825 15.7426 3.00825 15.8129 3.18548 15.8129C3.36271 15.8129 3.53271 15.7426 3.65819 15.6175L15.6193 3.65968C15.6818 3.59749 15.7313 3.52357 15.7652 3.44216C15.799 3.36076 15.8164 3.27347 15.8164 3.18532C15.8164 3.09717 15.799 3.0099 15.7652 2.92849C15.7313 2.84709 15.6818 2.77316 15.6193 2.71096C15.5569 2.64899 15.4829 2.59992 15.4015 2.56657C15.3201 2.53322 15.2329 2.51625 15.1449 2.51661Z",fill:"currentColor",fillOpacity:"1"}),ee().createElement("path",{d:"M17.2989 4.6709C17.122 4.67191 16.9526 4.74297 16.8279 4.86854L4.86679 16.8263C4.80432 16.8885 4.75474 16.9625 4.72092 17.0439C4.68709 17.1253 4.66968 17.2126 4.66968 17.3007C4.66968 17.3889 4.68709 17.4761 4.72092 17.5575C4.75474 17.639 4.80432 17.7129 4.86679 17.7751C4.92898 17.8375 5.0029 17.8871 5.0843 17.9209C5.16571 17.9548 5.25299 17.9722 5.34115 17.9722C5.4293 17.9722 5.51658 17.9548 5.59799 17.9209C5.67939 17.8871 5.75331 17.8375 5.8155 17.7751L17.7733 5.81397C17.8985 5.68849 17.9688 5.51849 17.9688 5.34126C17.9688 5.16403 17.8985 4.99402 17.7733 4.86854C17.7112 4.80597 17.6373 4.7563 17.5559 4.72238C17.4745 4.68847 17.3871 4.67097 17.2989 4.6709Z",fill:"currentColor",fillOpacity:"1"}),ee().createElement("path",{d:"M18.3599 7.92579C18.272 7.92543 18.1848 7.94241 18.1034 7.97577C18.022 8.00912 17.948 8.05818 17.8856 8.12016L8.12167 17.884C8.0592 17.9462 8.00962 18.0202 7.9758 18.1016C7.94198 18.183 7.92456 18.2703 7.92456 18.3584C7.92456 18.4466 7.94198 18.5338 7.9758 18.6152C8.00962 18.6966 8.0592 18.7706 8.12167 18.8328C8.24715 18.9579 8.41715 19.0282 8.59438 19.0282C8.77161 19.0282 8.94161 18.9579 9.06709 18.8328L18.831 9.06559C18.9561 8.94011 19.0264 8.7701 19.0264 8.59287C19.0264 8.41563 18.9561 8.24564 18.831 8.12016C18.7057 7.99579 18.5364 7.92593 18.3599 7.92579Z",fill:"currentColor",fillOpacity:"1"}),ee().createElement("path",{d:"M18.4983 12.0967C18.4104 12.0963 18.3232 12.1133 18.2418 12.1466C18.1604 12.18 18.0864 12.2291 18.024 12.291L12.2921 18.0262C12.167 18.1517 12.0967 18.3217 12.0967 18.4989C12.0967 18.6761 12.167 18.8461 12.2921 18.9716C12.4176 19.0968 12.5876 19.167 12.7648 19.167C12.9421 19.167 13.1121 19.0968 13.2375 18.9716L18.9727 13.2365C19.0978 13.111 19.1681 12.941 19.1681 12.7638C19.1681 12.5865 19.0978 12.4165 18.9727 12.291C18.9103 12.2291 18.8362 12.18 18.7548 12.1466C18.6734 12.1133 18.5863 12.0963 18.4983 12.0967Z",fill:"currentColor",fillOpacity:"1"}),ee().createElement("path",{d:"M7.24871 1.51547L1.51358 7.2506C1.38841 7.37608 1.31812 7.54608 1.31812 7.72331C1.31812 7.90055 1.38841 8.07054 1.51358 8.19602C1.57577 8.25849 1.64969 8.30806 1.73109 8.34188C1.8125 8.37571 1.89978 8.39312 1.98794 8.39312C2.07609 8.39312 2.16337 8.37571 2.24478 8.34188C2.32618 8.30806 2.4001 8.25849 2.4623 8.19602L8.19743 2.46089C8.32259 2.33541 8.39289 2.16541 8.39289 1.98818C8.39289 1.81095 8.32259 1.64095 8.19743 1.51547C8.13523 1.453 8.06131 1.40342 7.97991 1.3696C7.89851 1.33578 7.81122 1.31836 7.72307 1.31836C7.63492 1.31836 7.54763 1.33578 7.46623 1.3696C7.38482 1.40342 7.3109 1.453 7.24871 1.51547Z",fill:"currentColor",fillOpacity:"1"}))},An=function(e){var t=e.className,n=ye(e,Xe);return ee().createElement("svg",fe({xmlns:"http://www.w3.org/2000/svg",className:t,viewBox:"0 0 20 20",fill:"currentColor"},n),ee().createElement("path",{d:"M9 6a3 3 0 11-6 0 3 3 0 016 0zM17 6a3 3 0 11-6 0 3 3 0 016 0zM12.93 17c.046-.327.07-.66.07-1a6.97 6.97 0 00-1.5-4.33A5 5 0 0119 16v1h-6.07zM6 11a5 5 0 015 5v1H1v-1a5 5 0 015-5z"}))},Dn=function(e){var t=e.className,n=ye(e,Ye);return ee().createElement("svg",fe({xmlns:"http://www.w3.org/2000/svg",className:t,viewBox:"0 0 48 48",fill:"currentColor"},n),ee().createElement("path",{d:"M43 21.8V8.2C43 5.2 41.72 4 38.54 4H30.46C27.28 4 26 5.2 26 8.2V21.8C26 24.8 27.28 26 30.46 26H38.54C41.72 26 43 24.8 43 21.8Z",fill:"#9AA1AD"}),ee().createElement("path",{d:"M22 26.2V39.8C22 42.8 20.72 44 17.54 44H9.46C6.28 44 5 42.8 5 39.8V26.2C5 23.2 6.28 22 9.46 22H17.54C20.72 22 22 23.2 22 26.2Z",fill:"#9AA1AD"}),ee().createElement("path",{d:"M43 39.8V34.2C43 31.2 41.72 30 38.54 30H30.46C27.28 30 26 31.2 26 34.2V39.8C26 42.8 27.28 44 30.46 44H38.54C41.72 44 43 42.8 43 39.8Z",fill:"#9AA1AD"}),ee().createElement("path",{d:"M22 13.8V8.2C22 5.2 20.72 4 17.54 4H9.46C6.28 4 5 5.2 5 8.2V13.8C5 16.8 6.28 18 9.46 18H17.54C20.72 18 22 16.8 22 13.8Z",fill:"#9AA1AD"}))},Ln=function(e){var t=e.className,n=ye(e,Ze);return ee().createElement("svg",fe({xmlns:"http://www.w3.org/2000/svg",className:t,viewBox:"0 0 20 20",fill:"currentColor"},n),ee().createElement("path",{fillRule:"evenodd",d:"M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.532 1.532 0 01-2.286.948c-1.372-.836-2.942.734-2.106 2.106.54.886.061 2.042-.947 2.287-1.561.379-1.561 2.6 0 2.978a1.532 1.532 0 01.947 2.287c-.836 1.372.734 2.942 2.106 2.106a1.532 1.532 0 012.287.947c.379 1.561 2.6 1.561 2.978 0a1.533 1.533 0 012.287-.947c1.372.836 2.942-.734 2.106-2.106a1.533 1.533 0 01.947-2.287c1.561-.379 1.561-2.6 0-2.978a1.532 1.532 0 01-.947-2.287c.836-1.372-.734-2.942-2.106-2.106a1.532 1.532 0 01-2.287-.947zM10 13a3 3 0 100-6 3 3 0 000 6z",clipRule:"evenodd"}))},Fn=function(e){var t=e.className,n=ye(e,Je);return ee().createElement("svg",fe({xmlns:"http://www.w3.org/2000/svg",className:t,viewBox:"0 0 20 20",fill:"currentColor"},n),ee().createElement("path",{fillRule:"evenodd",d:"M4 2a1 1 0 011 1v2.101a7.002 7.002 0 0111.601 2.566 1 1 0 11-1.885.666A5.002 5.002 0 005.999 7H9a1 1 0 010 2H4a1 1 0 01-1-1V3a1 1 0 011-1zm.008 9.057a1 1 0 011.276.61A5.002 5.002 0 0014.001 13H11a1 1 0 110-2h5a1 1 0 011 1v5a1 1 0 11-2 0v-2.101a7.002 7.002 0 01-11.601-2.566 1 1 0 01.61-1.276z",clipRule:"evenodd"}))},Mn=function(e){var t=e.className,n=ye(e,$e);return ee().createElement("svg",fe({xmlns:"http://www.w3.org/2000/svg",className:t,viewBox:"0 0 20 20",fill:"currentColor"},n),ee().createElement("path",{fillRule:"evenodd",d:"M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z",clipRule:"evenodd"}))},Rn=function(e){var t=e.className,n=ye(e,et);return ee().createElement("svg",fe({xmlns:"http://www.w3.org/2000/svg",className:t,viewBox:"0 0 20 20",fill:"currentColor"},n),ee().createElement("path",{fillRule:"evenodd",d:"M10 2l.906 2.547L13.453 5l-2.547.906L10 8.453 9.094 5.906 6.547 5l2.547-.906L10 2z",clipRule:"evenodd"}),ee().createElement("path",{d:"M15 3l.453 1.273L16.726 4.5l-1.273.453L15 6.226l-.453-1.273L13.274 4.5l1.273-.453L15 3z"}),ee().createElement("path",{fillRule:"evenodd",d:"M5 11l.679 1.911L7.589 13.5l-1.91.679L5 16.089l-.679-1.91L2.411 13.5l1.91-.679L5 11z",clipRule:"evenodd"}),ee().createElement("path",{d:"M16 15l.453 1.273L17.726 16.5l-1.273.453L16 18.226l-.453-1.273L14.274 16.5l1.273-.453L16 15z"}))},Gn=function(e){var t=e.className,n=ye(e,tt);return ee().createElement("svg",fe({width:"188",height:"188",viewBox:"0 0 188 188",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t},n),ee().createElement("g",{clipPath:"url(#clip0_2670_9370)"},ee().createElement("g",{filter:"url(#filter0_f_2670_9370)"},ee().createElement("circle",{cx:"92",cy:"96",r:"64",fill:"#CEEDCB"})),ee().createElement("rect",{x:"8",y:"50",width:"48",height:"56",rx:"12",fill:"white"}),ee().createElement("rect",{x:"68",y:"74",width:"48",height:"48",rx:"12",fill:"white"}),ee().createElement("rect",{x:"128",y:"50",width:"48",height:"56",rx:"12",fill:"white"}),ee().createElement("rect",{x:"8",y:"118",width:"48",height:"48",rx:"12",fill:"white"}),ee().createElement("rect",{x:"68",y:"134",width:"48",height:"56",rx:"12",fill:"white"}),ee().createElement("rect",{x:"128",y:"118",width:"48",height:"48",rx:"12",fill:"white"}),ee().createElement("path",{d:"M90.1857 22.6128C90.4395 20.4624 93.5606 20.4624 93.8144 22.6128C94.0287 24.429 96.4828 24.8385 97.2753 23.1903C98.2135 21.2388 101.166 22.2523 100.707 24.3686C100.32 26.1559 102.509 27.3401 103.793 26.0385C105.314 24.4974 107.777 26.4145 106.657 28.2673C105.71 29.8322 107.395 31.6627 109.033 30.8488C110.972 29.8851 112.679 32.498 111.018 33.8866C109.615 35.0594 110.614 37.3379 112.427 37.0998C114.574 36.818 115.34 39.8436 113.318 40.6175C111.61 41.2711 111.816 43.7506 113.608 44.1142C115.73 44.5447 115.472 47.6552 113.308 47.7305C111.48 47.7942 110.87 50.206 112.447 51.1319C114.314 52.2281 113.06 55.0864 110.989 54.455C109.24 53.9217 107.879 56.0046 109.07 57.3924C110.48 59.0355 108.366 61.3318 106.612 60.0621C105.131 58.9897 103.168 60.5179 103.844 62.2172C104.644 64.2292 101.899 65.7147 100.652 63.9443C99.5993 62.449 97.2461 63.2568 97.3336 65.0835C97.4372 67.2464 94.3587 67.7601 93.7544 65.6808C93.244 63.9247 90.756 63.9247 90.2457 65.6808C89.6414 67.7601 86.5628 67.2464 86.6665 65.0835C86.754 63.2568 84.4008 62.449 83.3478 63.9443C82.1011 65.7147 79.3562 64.2292 80.1565 62.2172C80.8324 60.5179 78.869 58.9897 77.3876 60.0621C75.6336 61.3318 73.5197 59.0355 74.93 57.3924C76.121 56.0046 74.7602 53.9217 73.0109 54.455C70.9396 55.0864 69.6859 52.2281 71.5532 51.1319C73.1303 50.206 72.5196 47.7942 70.6919 47.7305C68.5279 47.6552 68.2701 44.5447 70.3922 44.1142C72.1845 43.7506 72.39 41.2711 70.682 40.6175C68.6597 39.8436 69.4259 36.818 71.5728 37.0998C73.386 37.3379 74.3854 35.0594 72.9822 33.8866C71.3208 32.498 73.0279 29.8851 74.9669 30.8488C76.6046 31.6627 78.2897 29.8322 77.3433 28.2673C76.2228 26.4145 78.6858 24.4974 80.2069 26.0385C81.4916 27.3401 83.6797 26.1559 83.2927 24.3686C82.8345 22.2523 85.7865 21.2388 86.7248 23.1903C87.5173 24.8385 89.9713 24.429 90.1857 22.6128Z",fill:"#BAE0B5"}),ee().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M105.333 44.0003C105.333 51.3641 99.3638 57.3337 92.0001 57.3337C84.6363 57.3337 78.6667 51.3641 78.6667 44.0003C78.6667 36.6365 84.6363 30.667 92.0001 30.667C99.3638 30.667 105.333 36.6365 105.333 44.0003ZM97.3738 39.9599C97.7643 40.3504 97.7643 40.9836 97.3738 41.3741L90.7071 48.0407C90.3166 48.4313 89.6835 48.4313 89.293 48.0407L86.6263 45.3741C86.2358 44.9835 86.2358 44.3505 86.6263 43.9599C87.0168 43.5694 87.65 43.5694 88.0405 43.9599L90.0001 45.9194L92.9798 42.9397L95.9597 39.9599C96.3502 39.5694 96.9833 39.5694 97.3738 39.9599Z",fill:"#11A800"})),ee().createElement("defs",null,ee().createElement("filter",{id:"filter0_f_2670_9370",x:"-32",y:"-28",width:"248",height:"248",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB"},ee().createElement("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),ee().createElement("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),ee().createElement("feGaussianBlur",{stdDeviation:"30",result:"effect1_foregroundBlur_2670_9370"})),ee().createElement("clipPath",{id:"clip0_2670_9370"},ee().createElement("rect",{width:"188",height:"188",fill:"white"}))))},Bn=function(e){var t=e.className,n=ye(e,nt);return ee().createElement("svg",fe({xmlns:"http://www.w3.org/2000/svg",className:t,viewBox:"0 0 20 20",fill:"currentColor"},n),ee().createElement("path",{d:"M19.6667 11.9167L16.5833 3.58333C16.0833 2.5 15 1.66666 13.75 1.66666C12.1667 1.66666 10.8333 3 10.8333 4.58333V5H9.16667V4.58333C9.16667 3 7.83333 1.66666 6.25 1.66666C5 1.66666 3.91667 2.5 3.5 3.66666L0.416667 12C0.166667 12.5 0 13.0833 0 13.75C0 16.25 2.08333 18.3333 4.58333 18.3333C7 18.3333 8.91667 16.5 9.16667 14.1667H10.8333C11.0833 16.5 13 18.3333 15.4167 18.3333C17.9167 18.3333 20 16.25 20 13.75C20 13.0833 19.8333 12.5 19.6667 11.9167ZM4.58333 16.6667C3 16.6667 1.66667 15.3333 1.66667 13.75C1.66667 12.1667 3 10.8333 4.58333 10.8333C6.16667 10.8333 7.5 12.1667 7.5 13.75C7.5 15.3333 6.16667 16.6667 4.58333 16.6667ZM7.5 7.16666V10.1667C6.66667 9.58333 5.66667 9.16666 4.58333 9.16666C4.08333 9.16666 3.58333 9.25 3.08333 9.41666L4.83333 4.83333L5.08333 4.25C5.16667 4 5.33333 3.75 5.5 3.58333C5.58333 3.5 5.66667 3.41666 5.83333 3.41666C5.83333 3.41666 5.83333 3.41666 5.91667 3.41666C6 3.33333 6.08333 3.33333 6.25 3.33333C6.91667 3.33333 7.5 3.91666 7.5 4.58333V7.16666ZM10.8333 6.66666V12.5H9.16667V6.66666H10.8333ZM12.5 7.16666V4.58333C12.5 3.91666 13.0833 3.33333 13.75 3.33333C13.9167 3.33333 14 3.33333 14.0833 3.41666C14.0833 3.41666 14.0833 3.41666 14.1667 3.41666C14.25 3.41666 14.4167 3.5 14.5 3.58333C14.6667 3.75 14.8333 4 14.9167 4.25L15.1667 4.83333L16.9167 9.41666C16.4167 9.25 15.9167 9.16666 15.4167 9.16666C14.3333 9.16666 13.3333 9.58333 12.5 10.25V7.16666ZM15.4167 16.6667C13.8333 16.6667 12.5 15.3333 12.5 13.75C12.5 12.1667 13.8333 10.8333 15.4167 10.8333C17 10.8333 18.3333 12.1667 18.3333 13.75C18.3333 15.3333 17 16.6667 15.4167 16.6667Z",fill:"currentColor"}))},zn=function(e){var t=e.className,n=ye(e,rt);return ee().createElement("svg",fe({xmlns:"http://www.w3.org/2000/svg",className:t,viewBox:"0 0 20 20",fill:"currentColor"},n),ee().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.9 1.96969C5.04164 1.77893 5.26393 1.66666 5.5 1.66666H14.5C14.7361 1.66666 14.9584 1.77893 15.1 1.96969L17.35 5C17.4474 5.13113 17.5 5.29063 17.5 5.45454V16.0606C17.5 16.6634 17.2629 17.2414 16.841 17.6677C16.419 18.0939 15.8467 18.3333 15.25 18.3333H4.75C4.15326 18.3333 3.58097 18.0939 3.15901 17.6677C2.73705 17.2414 2.5 16.6634 2.5 16.0606V5.45454C2.5 5.29063 2.55263 5.13113 2.65 5L4.9 1.96969ZM5.875 3.18182L4.75 4.69697H15.25L14.125 3.18182H5.875ZM16 6.21212H4V16.0606C4 16.2615 4.07902 16.4542 4.21967 16.5963C4.36032 16.7384 4.55109 16.8182 4.75 16.8182H15.25C15.4489 16.8182 15.6397 16.7384 15.7803 16.5963C15.921 16.4542 16 16.2615 16 16.0606V6.21212ZM7 7.72727C7.41421 7.72727 7.75 8.06645 7.75 8.48485C7.75 9.08761 7.98705 9.66569 8.40901 10.0919C8.83097 10.5181 9.40326 10.7576 10 10.7576C10.5967 10.7576 11.169 10.5181 11.591 10.0919C12.0129 9.66569 12.25 9.08761 12.25 8.48485C12.25 8.06645 12.5858 7.72727 13 7.72727C13.4142 7.72727 13.75 8.06645 13.75 8.48485C13.75 9.48945 13.3549 10.4529 12.6517 11.1633C11.9484 11.8736 10.9946 12.2727 10 12.2727C9.00544 12.2727 8.05161 11.8736 7.34835 11.1633C6.64509 10.4529 6.25 9.48945 6.25 8.48485C6.25 8.06645 6.58579 7.72727 7 7.72727Z",fill:"currentColor"}))},Un=function(e){var t=e.className,n=ye(e,at);return ee().createElement("svg",fe({xmlns:"http://www.w3.org/2000/svg",className:t,viewBox:"0 0 20 20",fill:"currentColor"},n),ee().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.0053 3.18194C9.6239 3.18194 9.24864 3.27799 8.9141 3.46123C8.57957 3.64446 8.29652 3.909 8.09106 4.23044C7.91944 4.49896 7.59818 4.63131 7.2873 4.56159C6.91401 4.47787 6.52564 4.48979 6.15819 4.59625C5.79073 4.70271 5.4561 4.90025 5.18531 5.17057C4.91452 5.44089 4.71635 5.77523 4.60916 6.14259C4.50197 6.50995 4.48924 6.89844 4.57215 7.27203C4.64135 7.58386 4.50761 7.90561 4.2378 8.07643C3.914 8.28142 3.64729 8.56501 3.46247 8.90081C3.27766 9.2366 3.18074 9.61371 3.18074 9.99704C3.18074 10.3804 3.27766 10.7575 3.46247 11.0933C3.64729 11.4291 3.914 11.7127 4.2378 11.9176C4.50761 12.0885 4.64135 12.4102 4.57215 12.722C4.48924 13.0956 4.50197 13.4841 4.60916 13.8515C4.71635 14.2188 4.91452 14.5532 5.18531 14.8235C5.4561 15.0938 5.79073 15.2914 6.15819 15.3978C6.52564 15.5043 6.91401 15.5162 7.2873 15.4325C7.59881 15.3626 7.92066 15.4957 8.09201 15.7651C8.2972 16.0878 8.58047 16.3535 8.91557 16.5375C9.25068 16.7216 9.62679 16.8181 10.0091 16.8181C10.3914 16.8181 10.7675 16.7216 11.1026 16.5375C11.4377 16.3535 11.721 16.0878 11.9262 15.7651C12.0972 15.4961 12.4182 15.3631 12.7293 15.4321C13.1028 15.5151 13.4911 15.5023 13.8584 15.3951C14.2256 15.2879 14.5598 15.0896 14.83 14.8188C15.1003 14.5479 15.2977 14.2131 15.4042 13.8455C15.5106 13.4779 15.5225 13.0894 15.4388 12.716C15.3691 12.405 15.5014 12.0836 15.7698 11.912C16.0912 11.7064 16.3556 11.4233 16.5388 11.0886C16.7219 10.754 16.818 10.3786 16.818 9.99704C16.818 9.6155 16.7219 9.2401 16.5388 8.90544C16.3556 8.57079 16.0912 8.28764 15.7698 8.08211C15.5013 7.91033 15.369 7.58873 15.4389 7.27761C15.523 6.90362 15.5111 6.51445 15.4044 6.14628C15.2977 5.77811 15.0997 5.4429 14.8288 5.17185C14.5578 4.9008 14.2227 4.70271 13.8547 4.59599C13.4866 4.48927 13.0976 4.47741 12.7238 4.56149C12.4128 4.63144 12.0913 4.4991 11.9195 4.23044C11.7141 3.909 11.431 3.64446 11.0965 3.46123C10.762 3.27799 10.3867 3.18194 10.0053 3.18194ZM8.18664 2.13214C8.74419 1.82675 9.36964 1.66667 10.0053 1.66667C10.641 1.66667 11.2664 1.82675 11.824 2.13214C12.2323 2.3558 12.5946 2.65211 12.8938 3.00513C13.3576 2.96475 13.8264 3.01015 14.2764 3.14062C14.8898 3.31848 15.4482 3.64864 15.8998 4.10039C16.3514 4.55215 16.6815 5.11081 16.8593 5.72443C16.9897 6.17457 17.0351 6.64354 16.9947 7.10754C17.3476 7.40684 17.6438 7.76925 17.8674 8.17772C18.1727 8.73548 18.3327 9.36114 18.3327 9.99704C18.3327 10.6329 18.1727 11.2586 17.8674 11.8164C17.6438 12.2249 17.3475 12.5874 16.9945 12.8867C17.0345 13.3498 16.9892 13.8178 16.8591 14.2671C16.6817 14.8797 16.3526 15.4376 15.9022 15.8891C15.4519 16.3406 14.8948 16.671 14.2828 16.8497C13.834 16.9807 13.3663 17.0271 12.9034 16.988C12.604 17.3429 12.241 17.6409 11.8316 17.8658C11.2731 18.1725 10.6462 18.3333 10.0091 18.3333C9.37193 18.3333 8.74507 18.1725 8.18656 17.8658C7.77745 17.641 7.41471 17.3434 7.1155 16.9888C6.65296 17.0287 6.18553 16.9833 5.73682 16.8533C5.1244 16.6759 4.56667 16.3466 4.11536 15.8961C3.66404 15.4455 3.33375 14.8883 3.15511 14.276C3.02423 13.8275 2.97784 13.360 3.01673 12.8973C2.66052 12.5979 2.36137 12.2344 2.13557 11.8241C1.82754 11.2644 1.66602 10.6359 1.66602 9.99704C1.66602 9.35815 1.82754 8.72965 2.13557 8.16998C2.36137 7.75972 2.66052 7.39621 3.01673 7.09679C2.97784 6.63404 3.02423 6.16658 3.15511 5.71802C3.33375 5.10576 3.66405 4.54852 4.11536 4.09799C4.56667 3.64746 5.1244 3.31822 5.73682 3.14079C6.1859 3.01068 6.65373 2.9653 7.11665 3.00536C7.41587 2.65224 7.77823 2.35584 8.18664 2.13214ZM12.8129 7.94604C13.1087 8.24191 13.1087 8.72162 12.8129 9.01749L9.78347 12.048C9.48771 12.3439 9.00817 12.3439 8.7124 12.048L7.19767 10.5328C6.9019 10.2369 6.9019 9.75718 7.19767 9.46131C7.49344 9.16543 7.97298 9.16543 8.26875 9.46131L9.24794 10.4408L11.7419 7.94604C12.0376 7.65016 12.5172 7.65016 12.8129 7.94604Z",fill:"currentColor"}))},qn=function(e){var t=e.className,n=ye(e,ot);return ee().createElement("svg",fe({xmlns:"http://www.w3.org/2000/svg",className:t,viewBox:"0 0 20 20",fill:"currentColor"},n),ee().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.6682 2.33249C17.2419 1.90617 16.6637 1.66667 16.0608 1.66667H10.6262C10.0234 1.6668 9.44517 1.90635 9.01896 2.33265C9.01899 2.33262 9.01894 2.33267 9.01896 2.33265L2.42187 8.92974C1.93857 9.41612 1.66732 10.0739 1.66732 10.7596C1.66732 11.4453 1.93857 12.1031 2.42187 12.5894L2.42356 12.5911L7.40952 17.5771L7.41122 17.5788C7.89759 18.0621 8.5554 18.3333 9.24106 18.3333C9.92672 18.3333 10.5845 18.0621 11.0709 17.5788L11.0726 17.5771L17.6679 10.9818C17.668 10.9817 17.6679 10.9818 17.6679 10.9818C18.0942 10.5556 18.3339 9.97741 18.334 9.3746V3.9399C18.334 3.337 18.0945 2.7588 17.6682 2.33249ZM16.0608 3.18216C16.2617 3.18216 16.4545 3.26199 16.5966 3.4041C16.7387 3.5462 16.8185 3.73894 16.8185 3.9399V9.37428C16.8185 9.37422 16.8185 9.37433 16.8185 9.37428C16.8184 9.57517 16.7386 9.76797 16.5965 9.91L10.0027 16.5038C10.0024 16.504 10.0022 16.5043 10.0019 16.5046C9.79955 16.7052 9.52609 16.8179 9.24106 16.8179C8.95604 16.8179 8.68258 16.7052 8.48022 16.5046C8.47995 16.5043 8.47969 16.504 8.47943 16.5038L3.49687 11.5212C3.49661 11.521 3.49635 11.5207 3.49609 11.5204C3.29542 11.3181 3.1828 11.0446 3.1828 10.7596C3.1828 10.4746 3.29542 10.2011 3.49609 9.99875C3.49635 9.99848 3.49661 9.99822 3.49687 9.99796L10.0906 3.40426C10.2326 3.26218 10.4253 3.18224 10.6262 3.18216C10.6263 3.18216 10.6262 3.18216 10.6262 3.18216H16.0608ZM13.4087 6.97088C13.1994 6.97088 13.0298 6.80125 13.0298 6.592C13.0298 6.38276 13.1994 6.21313 13.4087 6.21313C13.6179 6.21313 13.7875 6.38276 13.7875 6.592C13.7875 6.80125 13.6179 6.97088 13.4087 6.97088ZM14.5453 6.592C14.5453 5.96427 14.0364 5.45539 13.4087 5.45539C12.7809 5.45539 12.272 5.96427 12.272 6.592C12.272 7.21974 12.7809 7.72862 13.4087 7.72862C14.0364 7.72862 14.5453 7.21974 14.5453 6.592Z",fill:"currentColor"}))},Qn=function(e){var t=e.className,n=ye(e,lt);return ee().createElement("svg",fe({xmlns:"http://www.w3.org/2000/svg",className:t,viewBox:"0 0 20 20",fill:"currentColor"},n),ee().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1.56622 4.06558C2.03506 3.59674 2.67094 3.33334 3.33398 3.33334H16.6673C17.3304 3.33334 17.9662 3.59674 18.4351 4.06558C18.9039 4.53442 19.1673 5.1703 19.1673 5.83334V7.50001C19.1673 7.96025 18.7942 8.33334 18.334 8.33334C17.892 8.33334 17.468 8.50894 17.1555 8.8215C16.8429 9.13406 16.6673 9.55798 16.6673 10C16.6673 10.442 16.8429 10.866 17.1555 11.1785C17.468 11.4911 17.892 11.6667 18.334 11.6667C18.7942 11.6667 19.1673 12.0398 19.1673 12.5V14.1667C19.1673 14.8297 18.9039 15.4656 18.4351 15.9344C17.9662 16.4033 17.3304 16.6667 16.6673 16.6667H3.33398C2.67094 16.6667 2.03506 16.4033 1.56622 15.9344C1.09738 15.4656 0.833984 14.8297 0.833984 14.1667V12.5C0.833984 12.0398 1.20708 11.6667 1.66732 11.6667C2.10935 11.6667 2.53327 11.4911 2.84583 11.1785C3.15839 10.866 3.33398 10.442 3.33398 10C3.33398 9.55798 3.15839 9.13406 2.84583 8.8215C2.53327 8.50894 2.10935 8.33334 1.66732 8.33334C1.20708 8.33334 0.833984 7.96025 0.833984 7.50001V5.83334C0.833984 5.1703 1.09738 4.53442 1.56622 4.06558ZM3.33398 5.00001C3.11297 5.00001 2.90101 5.08781 2.74473 5.24409C2.58845 5.40037 2.50065 5.61233 2.50065 5.83334V6.77251C3.07234 6.92014 3.59972 7.21837 4.02434 7.64299C4.64946 8.26811 5.00065 9.11596 5.00065 10C5.00065 10.8841 4.64946 11.7319 4.02434 12.357C3.59972 12.7817 3.07234 13.0799 2.50065 13.2275V14.1667C2.50065 14.3877 2.58845 14.5997 2.74473 14.7559C2.90101 14.9122 3.11297 15 3.33398 15H16.6673C16.8883 15 17.1003 14.9122 17.2566 14.7559C17.4129 14.5997 17.5006 14.3877 17.5006 14.1667V13.2275C16.929 13.0799 16.4016 12.7817 15.977 12.357C15.3518 11.7319 15.0006 10.8841 15.0006 10C15.0006 9.11596 15.3518 8.26811 15.977 7.64299C16.4016 7.21837 16.929 6.92014 17.5006 6.77251V5.83334C17.5006 5.61233 17.4129 5.40037 17.2566 5.24409C17.1003 5.08781 16.8883 5.00001 16.6673 5.00001H3.33398ZM7.50065 8.33334C7.04041 8.33334 6.66732 7.96025 6.66732 7.50001C6.66732 7.03977 7.04041 6.66668 7.50065 6.66668H7.50898C7.96922 6.66668 8.34232 7.03977 8.34232 7.50001C8.34232 7.96025 7.96922 8.33334 7.50898 8.33334H7.50065ZM11.9114 6.91075C12.2368 6.58532 12.7645 6.58532 13.0899 6.91075C13.4153 7.23619 13.4153 7.76383 13.0899 8.08927L8.08991 13.0893C7.76447 13.4147 7.23683 13.4147 6.9114 13.0893C6.58596 12.7638 6.58596 12.2362 6.9114 11.9108L11.9114 6.91075ZM12.509 13.3333H12.5007C12.0404 13.3333 11.6673 12.9602 11.6673 12.5C11.6673 12.0398 12.0404 11.6667 12.5007 11.6667H12.509C12.9692 11.6667 13.3423 12.0398 13.3423 12.5C13.3423 12.9602 12.9692 13.3333 12.509 13.3333Z",fill:"currentColor"}))},Wn=function(e){var t=e.className,n=ye(e,it);return ee().createElement("svg",fe({xmlns:"http://www.w3.org/2000/svg",className:t,viewBox:"0 0 20 20",fill:"currentColor"},n),ee().createElement("path",{d:"M7.72678 2.97686C8.61648 1.0276 11.386 1.02754 12.2756 2.97686L12.5266 3.52764C12.6934 3.89294 13.0969 4.08686 13.4865 3.98955L14.0735 3.84307C16.1523 3.32303 17.8799 5.48866 16.9104 7.39971L16.636 7.93877C16.4542 8.29696 16.5542 8.73386 16.8733 8.97783L17.3537 9.34502C19.0565 10.6461 18.4406 13.347 16.342 13.7806L15.7492 13.9026C15.356 13.984 15.077 14.3341 15.0852 14.7356L15.0969 15.3411C15.1409 17.4832 12.6465 18.6848 10.9992 17.3147L10.5344 16.9271C10.2256 16.6701 9.77684 16.6702 9.46799 16.9271L9.00315 17.3147C7.35587 18.6849 4.86048 17.4832 4.90451 15.3411L4.91721 14.7356C4.9254 14.3342 4.64628 13.9841 4.25315 13.9026L3.66037 13.7806C1.56174 13.3471 0.945029 10.6462 2.64768 9.34502L3.12912 8.97783C3.44804 8.73384 3.54716 8.29691 3.36545 7.93877L3.09201 7.39971C2.12248 5.48878 3.84925 3.32344 5.92795 3.84307L6.51487 3.98955C6.90459 4.08704 7.309 3.8931 7.4758 3.52764L7.72678 2.97686ZM10.759 3.66924C10.4625 3.01937 9.53991 3.01938 9.24338 3.66924L8.99143 4.21904C8.49109 5.31557 7.27983 5.89923 6.11057 5.60674L5.52365 5.46025C4.83078 5.2871 4.25517 6.00884 4.57834 6.6458L4.85178 7.18486C5.39707 8.25961 5.0983 9.5702 4.14084 10.3021L3.66037 10.6692C3.09284 11.1029 3.2979 12.0031 3.99729 12.1478L4.59006 12.2708C5.77027 12.5147 6.6082 13.5659 6.58323 14.7708L6.57151 15.3753C6.55678 16.0892 7.38763 16.4897 7.93674 16.0335L8.40256 15.6458C9.32901 14.8754 10.6734 14.8753 11.5998 15.6458L12.0647 16.0335C12.6138 16.4903 13.4456 16.0894 13.4309 15.3753L13.4182 14.7708C13.3932 13.5658 14.232 12.5146 15.4123 12.2708L16.0051 12.1478C16.7043 12.003 16.9095 11.1028 16.342 10.6692L15.8615 10.3021C14.904 9.57025 14.6044 8.25965 15.1496 7.18486L15.424 6.6458C15.7472 6.00878 15.1707 5.28691 14.4778 5.46025L13.8918 5.60674C12.7226 5.89923 11.5103 5.31558 11.01 4.21904L10.759 3.66924ZM10.0012 6.66631C10.8851 6.66634 11.7326 7.01797 12.3576 7.64287C12.9828 8.26799 13.3342 9.11624 13.3342 10.0003C13.3341 10.8843 12.9827 11.7317 12.3576 12.3567C11.7326 12.9818 10.8852 13.3333 10.0012 13.3333C9.11714 13.3333 8.26889 12.9819 7.64377 12.3567C7.0189 11.7317 6.66825 10.8841 6.66819 10.0003C6.66819 9.11627 7.01869 8.26799 7.64377 7.64287C8.26889 7.01775 9.11714 6.66631 10.0012 6.66631ZM10.0012 8.3333C9.55917 8.3333 9.13504 8.50902 8.82248 8.82158C8.50996 9.13414 8.3342 9.55829 8.3342 10.0003C8.33427 10.4422 8.50998 10.8665 8.82248 11.179C9.13503 11.4914 9.55925 11.6663 10.0012 11.6663C10.4431 11.6663 10.8674 11.4915 11.1799 11.179C11.4924 10.8665 11.6681 10.4422 11.6682 10.0003C11.6682 9.55835 11.4924 9.13412 11.1799 8.82158C10.8674 8.50905 10.4432 8.3333 10.0012 8.3333Z",fill:"currentColor"}))},Hn=function(e){var t=e.className,n=ye(e,ct);return ee().createElement("svg",fe({xmlns:"http://www.w3.org/2000/svg",className:t,viewBox:"0 0 24 24",fill:"currentColor"},n),ee().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 2C13.1046 2 14 2.89543 14 4V11.5858L16.2929 9.29289C16.6834 8.90237 17.3166 8.90237 17.7071 9.29289C18.0976 9.68342 18.0976 10.3166 17.7071 10.7071L12.7071 15.7071C12.3166 16.0976 11.6834 16.0976 11.2929 15.7071L6.29289 10.7071C5.90237 10.3166 5.90237 9.68342 6.29289 9.29289C6.68342 8.90237 7.31658 8.90237 7.70711 9.29289L10 11.5858V4C10 2.89543 10.8954 2 12 2ZM5 16C5.55228 16 6 16.4477 6 17V19C6 19.5523 6.44772 20 7 20H17C17.5523 20 18 19.5523 18 19V17C18 16.4477 18.4477 16 19 16C19.5523 16 20 16.4477 20 17V19C20 20.6569 18.6569 22 17 22H7C5.34315 22 4 20.6569 4 19V17C4 16.4477 4.44772 16 5 16Z"}))},Vn=function(e){var t=e.className,n=ye(e,st);return ee().createElement("svg",fe({xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",className:t,fill:"currentColor"},n),ee().createElement("path",{fill:"currentColor",d:"M17 17h-2.025q-.425 0-.7-.288T14 16t.288-.712T15 15h2v-2q0-.425.288-.712T18 12t.713.288T19 13v2h2q.425 0 .713.288T22 16t-.288.713T21 17h-2v2q0 .425-.288.713T18 20t-.712-.288T17 19zm-7 0H7q-2.075 0-3.537-1.463T2 12t1.463-3.537T7 7h3q.425 0 .713.288T11 8t-.288.713T10 9H7q-1.25 0-2.125.875T4 12t.875 2.125T7 15h3q.425 0 .713.288T11 16t-.288.713T10 17m-1-4q-.425 0-.712-.288T8 12t.288-.712T9 11h6q.425 0 .713.288T16 12t-.288.713T15 13zm13-1h-2q0-1.25-.875-2.125T17 9h-3.025q-.425 0-.7-.288T13 8t.288-.712T14 7h3q2.075 0 3.538 1.463T22 12"}))},Kn=function(e){var t=e.className,n=ye(e,ut);return ee().createElement("svg",fe({className:t,fill:"currentColor",viewBox:"0 0 20 20"},n),ee().createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"}))},Xn=function(e){var t=e.className,n=ye(e,mt);return ee().createElement("svg",fe({className:t,fill:"currentColor",viewBox:"0 0 20 20"},n),ee().createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"}))},Yn=function(e){var t=e.className,n=ye(e,dt);return ee().createElement("svg",fe({className:t,fill:"currentColor",viewBox:"0 0 20 20"},n),ee().createElement("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"}))},Zn=function(e){var t=e.className,n=ye(e,gt);return ee().createElement("svg",fe({className:t,width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n),ee().createElement("path",{d:"M8 1C9.85652 1 11.637 1.7375 12.9497 3.05025C14.2625 4.36301 15 6.14348 15 8C15 9.85652 14.2625 11.637 12.9497 12.9497C11.637 14.2625 9.85652 15 8 15C6.14348 15 4.36301 14.2625 3.05025 12.9497C1.7375 11.637 1 9.85652 1 8C1 6.14348 1.7375 4.36301 3.05025 3.05025C4.36301 1.7375 6.14348 1 8 1ZM8 4C7.87304 3.99989 7.74745 4.02626 7.63126 4.07743C7.51507 4.1286 7.41082 4.20344 7.32519 4.29717C7.23955 4.3909 7.1744 4.50146 7.13391 4.62179C7.09341 4.74211 7.07846 4.86957 7.09 4.996L7.455 9.002C7.46915 9.13668 7.53267 9.26136 7.63331 9.35197C7.73395 9.44259 7.86458 9.49274 8 9.49274C8.13542 9.49274 8.26605 9.44259 8.36669 9.35197C8.46733 9.26136 8.53085 9.13668 8.545 9.002L8.909 4.996C8.92053 4.86965 8.90561 4.74228 8.86517 4.62202C8.82474 4.50176 8.75968 4.39125 8.67415 4.29754C8.58862 4.20382 8.4845 4.12896 8.36843 4.07773C8.25235 4.0265 8.12688 4.00003 8 4ZM8 12C8.21217 12 8.41566 11.9157 8.56569 11.7657C8.71571 11.6157 8.8 11.4122 8.8 11.2C8.8 10.9878 8.71571 10.7843 8.56569 10.6343C8.41566 10.4843 8.21217 10.4 8 10.4C7.78783 10.4 7.58434 10.4843 7.43431 10.6343C7.28429 10.7843 7.2 10.9878 7.2 11.2C7.2 11.4122 7.28429 11.6157 7.43431 11.7657C7.58434 11.9157 7.78783 12 8 12Z",fill:"#DB1F21"}))},Jn=function(e){var t=e.className,n=ye(e,pt);return ee().createElement("svg",fe({className:t,width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n),ee().createElement("path",{d:"M12 8C16.9706 8 21 6.65685 21 5C21 3.34315 16.9706 2 12 2C7.02944 2 3 3.34315 3 5C3 6.65685 7.02944 8 12 8Z",stroke:"#DEA40F",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),ee().createElement("path",{d:"M21 12C21 13.66 17 15 12 15C7 15 3 13.66 3 12",stroke:"#DEA40F",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),ee().createElement("path",{d:"M3 5V19C3 20.66 7 22 12 22C17 22 21 20.66 21 19V5",stroke:"#DEA40F",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}))},$n=function(e){var t=e.className,n=ye(e,ft);return ee().createElement("svg",fe({className:t,fill:"currentColor",viewBox:"0 0 20 20"},n),ee().createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"}))},er=function(e){var t=e.className,n=ye(e,yt);return ee().createElement("svg",fe({className:t,viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},n),ee().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5 4C4.44772 4 4 4.44772 4 5V19C4 19.5523 4.44771 20 5 20H5.58579L14.3789 11.2069C14.9415 10.6445 15.7045 10.3284 16.5 10.3284C17.2955 10.3284 18.0584 10.6444 18.621 11.2068L20 12.5858V5C20 4.44771 19.5523 4 19 4H5ZM22 14.999V5C22 3.34315 20.6569 2 19 2H5C3.34315 2 2 3.34315 2 5V19C2 20.6569 3.34315 22 5 22H5.99902C5.99967 22 6.00033 22 6.00098 22H19C20.6569 22 22 20.6569 22 19V15.001C22 15.0003 22 14.9997 22 14.999ZM20 15.4142L17.207 12.6212C17.207 12.6212 17.207 12.6212 17.207 12.6212C17.0195 12.4338 16.7651 12.3284 16.5 12.3284C16.2349 12.3284 15.9806 12.4337 15.7931 12.6211C15.7931 12.6211 15.7931 12.6211 15.7931 12.6211L8.41421 20H19C19.5523 20 20 19.5523 20 19V15.4142ZM9 8C8.44772 8 8 8.44772 8 9C8 9.55228 8.44772 10 9 10C9.55228 10 10 9.55228 10 9C10 8.44772 9.55228 8 9 8ZM6 9C6 7.34315 7.34315 6 9 6C10.6569 6 12 7.34315 12 9C12 10.6569 10.6569 12 9 12C7.34315 12 6 10.6569 6 9Z"}))},tr=function(e){var t=e.className,n=ye(e,ht);return ee().createElement("svg",fe({xmlns:"http://www.w3.org/2000/svg",className:t,viewBox:"0 0 24 24",fill:"currentColor"},n),ee().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19.8769 3.00024C19.7295 3.00024 19.5835 3.02928 19.4473 3.08571C19.3111 3.14213 19.1873 3.22483 19.083 3.32909L15.064 7.34809C14.7827 7.62929 14.4012 7.78737 14.0034 7.78737C13.6057 7.78737 13.2242 7.6294 12.9429 7.34819L11.9989 6.40414C11.7344 6.13976 11.3758 5.99123 11.0019 5.99123C10.628 5.99123 10.2694 6.13976 10.005 6.40414L9.41466 6.99446L17.0064 14.5853L17.5968 13.9949C17.5967 13.9949 17.5968 13.9949 17.5968 13.9949C17.8611 13.7305 18.0097 13.3719 18.0097 12.998C18.0097 12.6241 17.8611 12.2655 17.5968 12.001L16.6528 11.0571C16.3716 10.7758 16.2135 10.3942 16.2135 9.99648C16.2135 9.59873 16.3715 9.21727 16.6527 8.93598L20.6707 4.91696C20.775 4.8127 20.8578 4.68885 20.9142 4.55263C20.9706 4.41642 20.9997 4.27042 20.9997 4.12298C20.9997 3.97554 20.9706 3.82954 20.9142 3.69333C20.8578 3.55711 20.7751 3.43334 20.6708 3.32909C20.5666 3.22483 20.4428 3.14213 20.3066 3.08571C20.1704 3.02928 20.0244 3.00024 19.8769 3.00024ZM14.9361 15.3435L9.11337 9.52147C8.31287 10.4827 7.43798 11.1765 6.48488 11.6882C5.50406 12.2149 4.4692 12.5328 3.41064 12.7669L4.51148 14.1028L14.2092 16.7479C14.349 16.5378 14.4739 16.334 14.5816 16.1393C14.7635 15.8103 14.8745 15.5452 14.9361 15.3435ZM15.3971 18.5292C15.4153 18.5068 15.4326 18.4836 15.449 18.4596C15.7849 18.0068 16.0869 17.5501 16.3319 17.107C16.4022 16.9798 16.4704 16.8493 16.5346 16.7162C16.6854 16.7662 16.8446 16.7924 17.0064 16.7924C17.4042 16.7924 17.7856 16.6344 18.0669 16.3532L19.011 15.4091C19.6504 14.7696 20.0097 13.9023 20.0097 12.998C20.0097 12.0937 19.6505 11.2264 19.0111 10.5869L18.4206 9.99644L22.085 6.33109C22.085 6.33111 22.0851 6.33106 22.085 6.33109C22.375 6.04113 22.605 5.69683 22.762 5.318C22.9189 4.93913 22.9997 4.53306 22.9997 4.12298C22.9997 3.7129 22.9189 3.30683 22.762 2.92796C22.605 2.54909 22.375 2.20484 22.085 1.91487C21.7951 1.6249 21.4508 1.39488 21.0719 1.23795C20.6931 1.08102 20.287 1.00024 19.8769 1.00024C19.4668 1.00024 19.0608 1.08102 18.6819 1.23795C18.303 1.39488 17.9588 1.6249 17.6688 1.91487L14.0034 5.58027L13.413 4.98987C12.7735 4.35048 11.9062 3.99123 11.0019 3.99123C10.0976 3.99123 9.23035 4.35043 8.59087 4.98982L7.64681 5.93387C7.36561 6.21516 7.20753 6.59673 7.20753 6.99448C7.20753 7.39223 7.3655 7.77369 7.64671 8.05498L7.69182 8.10009C7.01435 8.95034 6.29888 9.51802 5.53871 9.92621C4.5816 10.4402 3.50727 10.727 2.23479 10.9647C1.97809 11.012 1.73806 11.1252 1.53824 11.2932C1.33775 11.4617 1.18466 11.6796 1.09404 11.9254C1.00343 12.1711 0.978422 12.4362 1.02149 12.6946C1.06457 12.9529 1.17423 13.1956 1.33966 13.3986L3.16744 15.6167C3.16959 15.6193 3.17175 15.622 3.17392 15.6246L8.66319 22.2859C8.67719 22.3029 8.69175 22.3194 8.70685 22.3355C9.00421 22.6513 9.39618 22.8619 9.82368 22.9355C10.2512 23.0091 10.691 22.9417 11.0769 22.7435C11.1143 22.7243 11.1504 22.7027 11.1851 22.6789C12.3371 21.8897 13.7491 20.5544 14.8741 19.1924C15.0545 18.9739 15.2298 18.7521 15.3971 18.5292ZM12.8708 18.4559L6.71505 16.7769L10.1591 20.9563C10.9668 20.3843 11.9732 19.463 12.8708 18.4559Z"}))},nr=function(e){var t=e.className,n=ye(e,bt);return ee().createElement("svg",fe({xmlns:"http://www.w3.org/2000/svg",className:t,viewBox:"0 0 24 24",fill:"currentColor"},n),ee().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16.5579 3.02796C16.0749 2.97339 15.5839 2.9892 15.1002 3.07733C14.1003 3.25952 13.1796 3.74211 12.4609 4.46081C11.7422 5.1795 11.2596 6.10016 11.0774 7.10009C10.8953 8.10001 11.0221 9.13172 11.4412 10.0577C11.6128 10.4369 11.5315 10.8828 11.2372 11.1771L4.32721 18.0871C4.11692 18.2974 3.99878 18.5826 3.99878 18.88C3.99878 19.1774 4.11692 19.4626 4.32721 19.6729C4.5375 19.8832 4.82271 20.0013 5.1201 20.0013C5.41749 20.0013 5.7027 19.8832 5.91299 19.6729L12.823 12.7629C13.1173 12.4686 13.5632 12.3873 13.9424 12.5589C14.8684 12.978 15.9001 13.1048 16.9 12.9226C17.8999 12.7404 18.8206 12.2578 19.5393 11.5392C20.258 10.8205 20.7406 9.8998 20.9228 8.89987C21.0109 8.41622 21.0267 7.92514 20.9721 7.44218L18.4001 10.0142C18.0263 10.3806 17.5236 10.5858 17.0001 10.5858C16.4766 10.5858 15.974 10.3806 15.6001 10.0141L15.593 10.0071L13.9859 8.40002C13.6195 8.02616 13.4142 7.52349 13.4142 6.99998C13.4142 6.47647 13.6195 5.97384 13.986 5.59998L13.993 5.59284L16.5579 3.02796ZM14.7417 1.10972C16.1416 0.854655 17.586 1.03228 18.8824 1.61892C19.1815 1.75426 19.3951 2.02777 19.4539 2.35073C19.5127 2.67369 19.4093 3.00496 19.1772 3.23709L15.4143 6.99998L17.0001 8.58577L20.763 4.82287C20.9951 4.59075 21.3264 4.48733 21.6493 4.54618C21.9723 4.60502 22.2458 4.81863 22.3812 5.11771C22.9678 6.41409 23.1454 7.85848 22.8904 9.25838C22.6353 10.6583 21.9597 11.9472 20.9535 12.9534C19.9473 13.9595 18.6584 14.6352 17.2585 14.8902C16.091 15.103 14.8927 15.0147 13.775 14.6393L7.32721 21.0871C6.74185 21.6724 5.94793 22.0013 5.1201 22.0013C4.29227 22.0013 3.49835 21.6724 2.91299 21.0871C2.32763 20.5017 1.99878 19.7078 1.99878 18.88C1.99878 18.0522 2.32763 17.2582 2.91299 16.6729L9.36075 10.2251C8.98534 9.10743 8.89713 7.90903 9.10984 6.74158C9.3649 5.34169 10.0405 4.05277 11.0467 3.0466C12.0529 2.04042 13.3418 1.36478 14.7417 1.10972Z"}))},rr=function(e){var t=e.className,n=ye(e,vt);return ee().createElement("svg",fe({width:"34",height:"43",viewBox:"0 0 34 43",fill:"none",className:t},n),ee().createElement("ellipse",{cx:"16.9999",cy:"41.3026",rx:"11.3158",ry:"1.69737",fill:"black",fillOpacity:"0.15"}),ee().createElement("path",{d:"M5.68408 7.78931H28.3157V33.0788C28.3157 34.7356 26.9725 36.0788 25.3157 36.0788H8.68408C7.02723 36.0788 5.68408 34.7356 5.68408 33.0788V7.78931Z",fill:"#FF7366"}),ee().createElement("path",{d:"M1.15771 8.22485H32.8419M5.40114 8.22485H28.5985L27.4669 33.2937C27.4669 34.0324 27.1689 34.7409 26.6383 35.2633C26.1078 35.7856 25.3883 36.0791 24.638 36.0791H9.36166C8.61138 36.0791 7.89182 35.7856 7.36129 35.2633C6.83076 34.7409 6.53271 34.0324 6.53271 33.2937L5.40114 8.22485Z",stroke:"black",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),ee().createElement("path",{d:"M12.4741 14.6578V29.6577M21.5258 14.6578V29.6577M11.3425 3.06577H22.6572C23.1749 3.06577 23.6315 3.37946 23.8152 3.85263L25.5731 8.22485H8.42651L10.1844 3.85263C10.3681 3.37946 10.8247 3.06577 11.3425 3.06577Z",stroke:"black",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}))},ar=function(e){var t=e.className,n=ye(e,_t);return ee().createElement("svg",fe({width:"41",height:"40",viewBox:"0 0 41 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t},n),ee().createElement("circle",{cx:"20.5",cy:"20",r:"20",fill:"#EBF6EA"}),ee().createElement("g",{clipPath:"url(#clip0_upload_icon)"},ee().createElement("path",{d:"M24 24L20 20L16 24",stroke:"#22c55e",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),ee().createElement("path",{d:"M20 20V29",stroke:"#22c55e",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),ee().createElement("path",{d:"M28.39 26.39C29.3654 25.8583 30.1359 25.0169 30.5799 23.9986C31.0239 22.9804 31.1162 21.8432 30.8422 20.7667C30.5682 19.6901 29.9435 18.7355 29.0667 18.0534C28.1899 17.3714 27.1109 17.0007 26 17H24.74C24.4373 15.8292 23.8732 14.7423 23.09 13.821C22.3068 12.8996 21.3249 12.1678 20.2181 11.6806C19.1114 11.1933 17.9086 10.9633 16.7001 11.0079C15.4917 11.0524 14.3091 11.3703 13.2412 11.9376C12.1733 12.505 11.2479 13.3071 10.5346 14.2836C9.82135 15.26 9.33871 16.3855 9.123 17.5754C8.90729 18.7652 8.96413 19.9885 9.28923 21.1532C9.61434 22.318 10.1993 23.3938 11 24.3",stroke:"#22c55e",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),ee().createElement("path",{d:"M24 24L20 20L16 24",stroke:"#22c55e",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})),ee().createElement("defs",null,ee().createElement("clipPath",{id:"clip0_upload_icon"},ee().createElement("rect",{width:"24",height:"24",fill:"white",transform:"translate(8 8)"}))))},or=function(e){var t=e.className,n=ye(e,wt);return ee().createElement("svg",fe({className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},n),ee().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"}))},lr=function(e){var t=e.className,n=ye(e,xt);return ee().createElement("svg",fe({className:t,fill:"currentColor",viewBox:"0 0 20 20"},n),ee().createElement("path",{fillRule:"evenodd",d:"M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z",clipRule:"evenodd"}))},ir=function(e){var t=e.className,n=ye(e,Et);return ee().createElement("svg",fe({className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},n),ee().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"}))},cr=function(e){var t=e.className,n=ye(e,Ct);return ee().createElement("svg",fe({className:t,fill:"currentColor",viewBox:"0 0 20 20"},n),ee().createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"}))},sr=function(e){var t=e.className,n=ye(e,Nt);return ee().createElement("svg",fe({className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},n),ee().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"}))},ur=function(e){var t=e.className,n=ye(e,kt);return ee().createElement("svg",fe({className:t,viewBox:"0 0 20 20",fill:"currentColor"},n),ee().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.33301 3.33329C2.87277 3.33329 2.49967 3.70639 2.49967 4.16663V12.5C2.49967 12.9602 2.87277 13.3333 3.33301 13.3333H16.6663C17.1266 13.3333 17.4997 12.9602 17.4997 12.5V4.16663C17.4997 3.70639 17.1266 3.33329 16.6663 3.33329H3.33301ZM10.833 15H16.6663C18.0471 15 19.1663 13.8807 19.1663 12.5V4.16663C19.1663 2.78591 18.0471 1.66663 16.6663 1.66663H3.33301C1.9523 1.66663 0.833008 2.78591 0.833008 4.16663V12.5C0.833008 13.8807 1.9523 15 3.33301 15H9.16634V16.6666H6.66634C6.2061 16.6666 5.83301 17.0397 5.83301 17.5C5.83301 17.9602 6.2061 18.3333 6.66634 18.3333H13.333C13.7932 18.3333 14.1663 17.9602 14.1663 17.5C14.1663 17.0397 13.7932 16.6666 13.333 16.6666H10.833V15Z"}))},mr=function(e){var t=e.className,n=ye(e,St);return ee().createElement("svg",fe({className:t,viewBox:"0 0 14 20",fill:"currentColor"},n),ee().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.83301 2.50004C2.37277 2.50004 1.99967 2.87314 1.99967 3.33337V16.6667C1.99967 17.1269 2.37277 17.5 2.83301 17.5H11.1663C11.6266 17.5 11.9997 17.1269 11.9997 16.6667V3.33337C11.9997 2.87314 11.6266 2.50004 11.1663 2.50004H2.83301ZM0.333008 3.33337C0.333008 1.95266 1.4523 0.833374 2.83301 0.833374H11.1663C12.5471 0.833374 13.6663 1.95266 13.6663 3.33337V16.6667C13.6663 18.0474 12.5471 19.1667 11.1663 19.1667H2.83301C1.4523 19.1667 0.333008 18.0474 0.333008 16.6667V3.33337ZM6.16634 15C6.16634 14.5398 6.53944 14.1667 6.99967 14.1667H7.00801C7.46825 14.1667 7.84134 14.5398 7.84134 15C7.84134 15.4603 7.46825 15.8334 7.00801 15.8334H6.99967C6.53944 15.8334 6.16634 15.4603 6.16634 15Z"}))},dr=function(e){var t=e.className,n=ye(e,Ot);return ee().createElement("svg",fe({width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",className:t},n),ee().createElement("path",{d:"M15.8333 10H4.16663",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),ee().createElement("path",{d:"M9.99996 15.8332L4.16663 9.99984L9.99996 4.1665",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}))},gr=function(e){var t=e.className,n=ye(e,Pt);return ee().createElement("svg",fe({className:t,viewBox:"0 0 20 20",fill:"currentColor"},n),ee().createElement("path",{fillRule:"evenodd",d:"M4 2a1 1 0 011 1v2.101a7.002 7.002 0 0111.601 2.566 1 1 0 11-1.885.666A5.002 5.002 0 005.999 7H9a1 1 0 010 2H4a1 1 0 01-1-1V3a1 1 0 011-1zm.008 9.057a1 1 0 011.276.61A5.002 5.002 0 0014.001 13H11a1 1 0 110-2h5a1 1 0 011 1v5a1 1 0 11-2 0v-2.101a7.002 7.002 0 01-11.601-2.566 1 1 0 01.61-1.276z",clipRule:"evenodd"}))},pr=function(e){var t=e.className,n=ye(e,jt);return ee().createElement("svg",fe({className:t,viewBox:"0 0 24 24",fill:"currentColor"},n),ee().createElement("path",{fillRule:"evenodd",d:"M6.75 3a.75.75 0 01.75.75V5h9V3.75a.75.75 0 011.5 0V5h.75A2.25 2.25 0 0121 7.25v11.5A2.25 2.25 0 0118.75 21H5.25A2.25 2.25 0 013 18.75V7.25A2.25 2.25 0 015.25 5H6V3.75A.75.75 0 016.75 3zm0 7.5a.75.75 0 000 1.5h10.5a.75.75 0 000-1.5H6.75z",clipRule:"evenodd"}))},fr=function(e){var t=e.className,n=ye(e,Tt);return ee().createElement("svg",fe({className:t,width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n),ee().createElement("path",{d:"M1.5 3H2.5H10.5",stroke:"#374151",strokeLinecap:"round",strokeLinejoin:"round"}),ee().createElement("path",{d:"M9.5 3V10C9.5 10.2652 9.39464 10.5196 9.20711 10.7071C9.01957 10.8946 8.76522 11 8.5 11H3.5C3.23478 11 2.98043 10.8946 2.79289 10.7071C2.60536 10.5196 2.5 10.2652 2.5 10V3M4 3V2C4 1.73478 4.10536 1.48043 4.29289 1.29289C4.48043 1.10536 4.73478 1 5 1H7C7.26522 1 7.51957 1.10536 7.70711 1.29289C7.89464 1.48043 8 1.73478 8 2V3",stroke:"#374151",strokeLinecap:"round",strokeLinejoin:"round"}))},yr=function(e){var t=e.className,n=ye(e,It);return ee().createElement("svg",fe({className:t,width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},n),ee().createElement("rect",{x:"4",y:"4",width:"7",height:"7",rx:"1",stroke:"#374151",strokeLinecap:"round",strokeLinejoin:"round"}),ee().createElement("path",{d:"M8 4V2C8 1.44772 7.55228 1 7 1H2C1.44772 1 1 1.44772 1 2V7C1 7.55228 1.44772 8 2 8H4",stroke:"#374151",strokeLinecap:"round",strokeLinejoin:"round"}))},hr=function(e){var t=e.className,n=ye(e,At);return ee().createElement("svg",fe({className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},n),ee().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"}))},br=function(e){var t=e.className,n=ye(e,Dt);return ee().createElement("svg",fe({width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t},n),ee().createElement("path",{d:"M15.8327 10H4.16602",stroke:"#374151",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),ee().createElement("path",{d:"M9.99935 15.8332L4.16602 9.99984L9.99935 4.1665",stroke:"#374151",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}))},vr=function(e){var t=e.className,n=ye(e,Lt);return ee().createElement("svg",fe({width:"21",height:"20",viewBox:"0 0 21 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t},n),ee().createElement("path",{d:"M4.6665 10.625H16.3332",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),ee().createElement("path",{d:"M10.5 4.79175L16.3333 10.6251L10.5 16.4584",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}))},_r=function(e){var t=e.className,n=ye(e,Ft);return ee().createElement("svg",fe({xmlns:"http://www.w3.org/2000/svg",width:"64",height:"64",fill:"none",className:t},n),ee().createElement("g",{clipPath:"url(#empty_state_clip)"},ee().createElement("ellipse",{cx:"32",cy:"57",fill:"#000",fillOpacity:".1",rx:"20",ry:"2"}),ee().createElement("path",{fill:"#F1F1F1",d:"M49.492 35.1c-.297 1.419-1.74 2.563-3.182 2.563H17.569c-1.442 0-2.885-1.144-3.182-2.564L9.1 10.564C8.78 9.144 9.718 8 11.16 8h41.558c1.443 0 2.381 1.145 2.06 2.564z"}),ee().createElement("path",{fill:"#D2D2D2",d:"M38.775 13.742c-1.443 0-3.022 1.122-3.526 2.473l-1.443 4.075c-.48 1.374-2.06 2.496-3.525 2.496H9.608c-1.442 0-2.313 1.122-1.946 2.519l5.836 24.967c.366 1.397 1.854 2.542 3.297 2.542h30.383c1.442 0 2.93-1.145 3.297-2.542l5.836-24.967c.389-1.397 1.076-3.64 1.58-5.015l1.442-4.075c.48-1.35-.298-2.473-1.74-2.473z"}),ee().createElement("path",{fill:"#000",fillOpacity:".7",d:"M30.024 34.394c0 1.512-.893 2.748-1.992 2.748-1.077 0-1.97-1.236-1.97-2.748 0-1.534.893-2.77 1.97-2.77 1.099 0 1.991 1.236 1.991 2.77M41.002 34.394c0 1.512-.893 2.748-1.992 2.748s-1.969-1.236-1.969-2.748c0-1.534.87-2.77 1.97-2.77 1.098 0 1.991 1.236 1.991 2.77"}),ee().createElement("path",{fill:"#000",fillOpacity:".7",fillRule:"evenodd",d:"M39.017 41.093a.547.547 0 0 1-.244.733c-2.673 1.336-7.896 1.15-10.189.047a.547.547 0 0 1 .214-1.072c3.172 1.083 6.963 1.083 9.478.05l.008-.003a.547.547 0 0 1 .733.245",clipRule:"evenodd"}),ee().createElement("path",{fill:"#000",fillOpacity:".7",d:"M4.253 35.736a1.043 1.043 0 0 1-1.487-1.464l6.507-6.61 1.447 1.504z"}),ee().createElement("path",{fill:"#000",fillOpacity:".7",fillRule:"evenodd",d:"M22.248 29.01c-3.866 3.686-9.99 3.548-13.69-.313-3.701-3.86-3.562-9.985.298-13.685s10-3.567 13.7.293c3.686 3.866 3.552 10.005-.308 13.706m-1.455-1.526c3.023-2.899 3.122-7.696.237-10.724-2.895-3.008-7.697-3.122-10.72-.222-3.012 2.88-3.126 7.682-.226 10.705 2.884 3.027 7.681 3.126 10.709.242",clipRule:"evenodd"}),ee().createElement("path",{fill:"#fff",fillOpacity:".8",d:"M10.084 27.243c-2.9-3.023-2.786-7.825.227-10.705 3.023-2.9 7.825-2.786 10.72.222 2.884 3.028 2.785 7.825-.238 10.724-3.027 2.885-7.825 2.786-10.71-.241"})),ee().createElement("defs",null,ee().createElement("clipPath",{id:"empty_state_clip"},ee().createElement("path",{fill:"#fff",d:"M0 0h64v64H0z"}))))},wr=function(e){var t=e.className,n=ye(e,Mt);return ee().createElement("svg",fe({width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t},n),ee().createElement("path",{d:"M25.3333 14.6667H6.66667C5.19391 14.6667 4 15.8607 4 17.3334V26.6667C4 28.1395 5.19391 29.3334 6.66667 29.3334H25.3333C26.8061 29.3334 28 28.1395 28 26.6667V17.3334C28 15.8607 26.8061 14.6667 25.3333 14.6667Z",stroke:"#0D0E11",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),ee().createElement("path",{d:"M9.3335 14.6667V9.33341C9.3335 7.5653 10.0359 5.86961 11.2861 4.61937C12.5364 3.36913 14.2321 2.66675 16.0002 2.66675C17.7683 2.66675 19.464 3.36913 20.7142 4.61937C21.9644 5.86961 22.6668 7.5653 22.6668 9.33341V14.6667",stroke:"#0D0E11",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}))},xr=function(e){var t=e.className,n=ye(e,Rt);return ee().createElement("svg",fe({width:"35",height:"63",viewBox:"0 0 35 63",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t},n),ee().createElement("path",{d:"M29.2576 53.2228C23.969 53.4453 20.1738 51.2042 17.4501 46.8813C16.741 45.7589 15.6984 44.8617 15.0777 43.5826C13.4649 40.4019 13.4307 40.2794 13.3431 36.4086C14.7597 36.2771 15.9893 36.66 17.3415 37.0086C21.3198 38.0103 25.7084 36.4546 27.8892 33.1388C28.7635 31.7723 29.6037 30.2833 30.0863 28.6961C31.0072 25.6001 30.4067 23.9192 27.8412 22.0608C26.2501 20.8547 24.5464 19.4818 22.4285 19.9412C19.9088 20.3808 17.7164 21.5213 15.8172 23.24C13.8738 25.0371 12.1997 27.089 10.9514 29.4843C10.5092 30.2679 10.1314 30.5715 9.32378 29.8067C7.20433 27.8899 5.7862 25.6451 5.24628 22.759C5.17801 22.514 5.15396 22.1906 5.00734 21.9014C3.3464 18.0739 4.20913 14.532 5.6405 10.8973C6.98342 7.41939 8.90894 4.37289 11.8089 1.97858C9.88026 0.272487 9.88022 0.272513 7.95703 1.66784C2.57533 5.34938 0.538852 10.6055 0.382867 16.9209C0.279658 20.5808 1.27965 23.9327 3.10351 26.9224C4.52164 29.1672 6.17485 31.5444 8.6822 32.9568C9.38739 33.3541 9.68059 33.9324 9.64025 34.7359C9.40672 36.9798 9.54092 39.1209 10.4005 41.2576C11.8264 44.9527 13.7084 48.3883 16.5912 51.1483C18.8573 53.3544 21.256 55.3253 24.5733 55.8514C25.4111 56.0135 25.5477 56.5035 24.9488 57.1989C24.3941 57.816 23.6043 58.3006 22.9713 58.8735C22.4267 59.2897 21.8379 59.7842 21.5624 60.4553C21.287 61.1264 21.3351 61.7731 22.2412 62.1803C23.6958 62.8964 24.8673 62.8334 26.2459 61.8542C28.2917 60.4246 30.4158 59.0392 32.4616 57.6097C34.8409 55.9549 35.2451 54.3236 33.5477 52.0248C32.8728 51.0249 32.1978 50.025 31.8565 48.8C31.7541 48.4324 31.6075 48.1433 31.3383 47.8883C30.4182 46.9569 28.5958 46.3435 28.0412 46.9605C27.187 47.9253 27.7394 48.9594 28.0908 49.9836C28.4422 51.0078 28.9946 52.0419 29.2576 53.2228ZM25.5231 28.914C25.2376 29.786 24.928 30.3346 24.4618 30.7949C23.9955 31.2552 23.5293 31.7155 23.1073 32.0975C21.2865 33.8603 17.3059 34.5098 15.1461 33.3964C14.0491 32.7785 13.9808 32.5334 14.4432 31.348C15.1267 29.7707 16.2803 28.4583 17.4339 27.1458C19.0538 25.373 21.0212 23.8993 23.4967 23.5381C25.6046 23.2796 26.7155 24.4218 26.4921 26.4648C26.3974 27.5476 25.9552 28.3312 25.5231 28.914Z",fill:"#B5CBA8"}))},Er=function(e){var t=e.className,n=ye(e,Gt);return ee().createElement("svg",fe({width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t},n),ee().createElement("path",{d:"M28.4468 19.8349C28.1951 20.4465 29.8965 22.7846 28.9876 24.0004C27.9727 25.3564 25.5245 25.1503 25.1101 25.6088C24.5757 26.1996 24.8802 28.7067 23.501 29.4862C22.0476 30.1862 19.9453 28.7209 19.3365 28.9465C18.2732 29.362 17.711 31.4941 16.0005 31.4941C14.2901 31.4941 13.7281 29.362 12.6646 28.9465C11.939 28.757 10.0703 30.1791 8.50002 29.4862C7.12064 28.7062 7.42533 26.1996 6.89089 25.6088C6.47658 25.1503 4.02808 25.3559 3.01345 24.0004C2.10402 22.7851 3.8057 20.4467 3.55373 19.8349C3.18484 18.9367 1.00586 18.1401 1.00586 16.5002C1.00586 14.8604 3.1848 14.0637 3.55398 13.1653C3.80593 12.5542 2.1043 10.2156 3.0137 9C4.02858 7.64406 6.47683 7.84987 6.89114 7.39162C7.42557 6.8008 7.12063 4.29375 8.50027 3.51418C9.89039 2.81106 11.9407 4.21831 12.6648 4.05349C13.7278 3.63772 14.2901 1.50562 16.0005 1.50562C17.711 1.50562 18.273 3.63768 19.3365 4.05324C19.9873 4.27614 22.1685 2.82668 23.501 3.51393C24.8801 4.2935 24.5757 6.80056 25.1101 7.39137C25.5244 7.84987 27.9729 7.64382 28.9876 8.99975C29.897 10.2151 28.1953 12.5537 28.4468 13.1651C28.8159 14.0635 30.9949 14.8601 30.9949 16.5C30.9947 18.1401 28.8157 18.9367 28.4468 19.8349Z",fill:"#69BC85"}),ee().createElement("path",{d:"M13.3293 16.3186C11.8489 16.3186 10.8765 15.2736 10.8765 13.9238C10.8765 12.5595 11.8489 11.5 13.3293 11.5C14.8242 11.5 15.7966 12.5595 15.7966 13.9238C15.7966 15.2736 14.8242 16.3186 13.3293 16.3186ZM13.4744 21.3258H12.3859L18.5688 11.6451H19.6718L13.4744 21.3258ZM18.6559 21.5C17.1754 21.5 16.203 20.455 16.203 19.1052C16.203 17.7409 17.1754 16.6669 18.6559 16.6669C20.1363 16.6669 21.1232 17.7409 21.1232 19.1052C21.1232 20.455 20.1363 21.5 18.6559 21.5ZM13.3293 15.1865C13.9969 15.1865 14.4904 14.693 14.4904 13.9238C14.4904 13.1255 13.9969 12.6321 13.3293 12.6321C12.6762 12.6321 12.1827 13.1255 12.1827 13.9238C12.1827 14.693 12.6762 15.1865 13.3293 15.1865ZM18.6559 20.3679C19.3235 20.3679 19.817 19.889 19.817 19.1052C19.817 18.307 19.3235 17.8135 18.6559 17.8135C17.9882 17.8135 17.5093 18.307 17.5093 19.1052C17.5093 19.889 17.9882 20.3679 18.6559 20.3679Z",fill:"white"}))},Cr=function(e){var t=e.className,n=ye(e,Bt);return ee().createElement("svg",fe({xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",fill:"none",className:t},n),ee().createElement("rect",{width:"48",height:"48",fill:"#F0F1F3",rx:"8"}),ee().createElement("g",{clipPath:"url(#whcc_clip)"},ee().createElement("path",{fill:"#374151",d:"M14 30.26q0 1.56 1.1 2.64t2.66 1.1h12.5q1.54 0 2.64-1.1t1.1-2.64v-12.5q0-1.56-1.1-2.66T30.26 14h-12.5q-1.56 0-2.66 1.1a3.62 3.62 0 0 0-1.1 2.66zm2.5 0v-12.5q0-.52.36-.88t.9-.38h12.5q.5 0 .88.38t.36.88v12.5q0 .52-.36.88t-.88.36h-12.5q-.52 0-.9-.36a1.1 1.1 0 0 1-.36-.88M17.76 29q0 .52.36.9t.88.36h10q.52 0 .88-.36t.38-.9v-.58q-.14-.28-.7-1.68t-1-2.24-.8-1.32q-.34-.36-.7-.38t-.72.24-.72.7-.74.98-.72 1.06-.72 1-.68.74-.68.28q-.36 0-1.04-.9-.1-.12-.3-.38-.7-.94-1-1.14-.48-.32-.74.22-.14.32-.58 1.4t-.66 1.6zm0-9.36q0 .78.54 1.32t1.32.54 1.34-.54.54-1.32a1.98 1.98 0 0 0-.54-1.34q-.52-.56-1.34-.54t-1.32.54-.54 1.34"})),ee().createElement("defs",null,ee().createElement("clipPath",{id:"whcc_clip"},ee().createElement("path",{fill:"#fff",d:"M14 14h20v20H14z"}))))},Nr=function(e){var t=e.className,n=ye(e,zt);return ee().createElement("svg",fe({xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",fill:"none",className:t},n),ee().createElement("rect",{width:"48",height:"48",fill:"#F0F1F3",rx:"8"}),ee().createElement("g",{clipPath:"url(#manual_clip)"},ee().createElement("path",{fill:"#374151",d:"M14 30.26v-12.5q0-1.56 1.1-2.66a3.62 3.62 0 0 1 2.66-1.1h12.5q1.54 0 2.64 1.1t1.1 2.66v12.5q0 1.56-1.1 2.64a3.7 3.7 0 0 1-2.64 1.1h-12.5a3.62 3.62 0 0 1-2.66-1.1Q14 31.8 14 30.26m2.5 0q0 .52.36.88t.9.36h12.5q.5 0 .88-.36t.36-.88v-12.5q0-.52-.36-.88a1.27 1.27 0 0 0-.88-.38h-12.5a1.23 1.23 0 0 0-.9.38 1.14 1.14 0 0 0-.36.88zM19 29v-2.5h2.5V29zm0-3.74v-2.5h2.5v2.5zm0-3.76V19h2.5v2.5zm3.76 7.5v-2.5H29V29zm0-3.74v-2.5H29v2.5zm0-3.76V19H29v2.5z"})),ee().createElement("defs",null,ee().createElement("clipPath",{id:"manual_clip"},ee().createElement("path",{fill:"#fff",d:"M14 14h20v20H14z"}))))},kr=function(e){var t=e.className,n=ye(e,Ut);return ee().createElement("svg",fe({xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",fill:"none",className:t},n),ee().createElement("rect",{width:"48",height:"48",fill:"#F0F1F3",rx:"8"}),ee().createElement("g",{fill:"#374151",clipPath:"url(#digital_clip)"},ee().createElement("path",{d:"M31.5 23.583v7.5h-3.333v-7.5zm.833-1.666h-5a.833.833 0 0 0-.833.833v9.167a.833.833 0 0 0 .833.833h5a.834.834 0 0 0 .834-.834V22.75a.833.833 0 0 0-.834-.834"}),ee().createElement("path",{d:"M29.834 16.917H16.917a.833.833 0 0 0-.833.833v9.167a.833.833 0 0 0 .833.833h7.917v-1.667h-7.083v-7.5H29v1.667h1.666v-2.5a.833.833 0 0 0-.833-.834M24.834 29.417v1.666h-9.167a.833.833 0 1 1 0-1.666z"})),ee().createElement("defs",null,ee().createElement("clipPath",{id:"digital_clip"},ee().createElement("path",{fill:"#fff",d:"M14 14h20v20H14z"}))))},Sr=function(e){var t=e.className,n=ye(e,qt);return ee().createElement("svg",fe({xmlns:"http://www.w3.org/2000/svg",className:t,viewBox:"0 0 20 20",fill:"currentColor"},n),ee().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.16667 10C4.16667 6.77834 6.77834 4.16667 10 4.16667C11.7514 4.16667 13.3214 4.94167 14.4042 6.17917L12.9167 7.5H17.5V2.91667L15.5917 4.825C14.1958 3.28 12.2125 2.5 10 2.5C5.85833 2.5 2.5 5.85833 2.5 10H4.16667ZM15.8333 10C15.8333 13.2217 13.2217 15.8333 10 15.8333C8.24858 15.8333 6.67858 15.0583 5.59583 13.8208L7.08333 12.5H2.5V17.0833L4.40833 15.175C5.80417 16.72 7.7875 17.5 10 17.5C14.1417 17.5 17.5 14.1417 17.5 10H15.8333Z",fill:"currentColor"}))},Or=function(e){var t;return("undefined"!=typeof window&&null!==(t=window.imagelyApp)&&void 0!==t&&t.assetsURL?"".concat(window.imagelyApp.assetsURL):"")+e},Pr=function(e){var t=e.className,n=ye(e,Qt);return ee().createElement("img",fe({src:Or("/images/icons/google-photos.svg"),alt:"Google Photos",className:t},n))},jr=function(e){var t=e.className,n=ye(e,Wt);return ee().createElement("img",fe({src:Or("/images/icons/g-icon.svg"),alt:"Google Photos",className:t},n))},Tr=function(e){var t=e.className,n=ye(e,Ht);return ee().createElement("svg",fe({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t},n),ee().createElement("path",{d:"M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zm0-2.163c-3.259 0-3.667.014-4.947.072-4.358.2-6.78 2.618-6.98 6.98-.059 1.281-.073 1.689-.073 4.948 0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98 1.281.058 1.689.072 4.948.072 3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98-1.281-.059-1.69-.073-4.949-.073zm0 5.838c-3.403 0-6.162 2.759-6.162 6.162s2.759 6.163 6.162 6.163 6.162-2.759 6.162-6.163c0-3.403-2.759-6.162-6.162-6.162zm0 10.162c-2.209 0-4-1.79-4-4 0-2.209 1.791-4 4-4s4 1.791 4 4c0 2.21-1.791 4-4 4zm6.406-11.845c-.796 0-1.441.645-1.441 1.44s.645 1.44 1.441 1.44c.795 0 1.439-.645 1.439-1.44s-.644-1.44-1.439-1.44z",fill:"#374151"}))},Ir=function(e){var t=e.className,n=ye(e,Vt);return ee().createElement("svg",fe({width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t},n),ee().createElement("path",{d:"M10.4101 0.643066C11.4332 0.627441 12.4488 0.635566 13.4638 0.627441C13.4976 1.89682 14.0126 3.03932 14.8319 3.88557L14.8307 3.88432C15.7126 4.67869 16.8601 5.19369 18.1251 5.28119L18.1426 5.28244V8.42994C16.9476 8.39994 15.8238 8.12432 14.8107 7.65057L14.8619 7.67182C14.3719 7.43619 13.9576 7.19432 13.5638 6.92432L13.5963 6.94557C13.5888 9.22619 13.6038 11.5068 13.5807 13.7793C13.5163 14.9374 13.1313 15.9937 12.5138 16.8756L12.5263 16.8562C11.4938 18.3349 9.82131 19.3056 7.91944 19.3631H7.91069C7.83382 19.3668 7.74319 19.3687 7.65194 19.3687C6.57069 19.3687 5.56007 19.0674 4.69882 18.5443L4.72382 18.5587C3.15632 17.6156 2.07507 16.0018 1.87507 14.1249L1.87257 14.0993C1.85694 13.7087 1.84944 13.3181 1.86507 12.9356C2.17132 9.94869 4.67382 7.63807 7.71569 7.63807C8.05757 7.63807 8.39257 7.66744 8.71819 7.72307L8.68319 7.71807C8.69881 8.87369 8.65194 10.0299 8.65194 11.1856C8.38757 11.0899 8.08257 11.0343 7.76444 11.0343C6.59694 11.0343 5.60382 11.7806 5.23632 12.8224L5.23069 12.8412C5.14757 13.1081 5.09944 13.4149 5.09944 13.7324C5.09944 13.8612 5.10757 13.9887 5.12257 14.1137L5.12132 14.0987C5.32882 15.3774 6.42507 16.3424 7.74694 16.3424C7.78507 16.3424 7.82257 16.3418 7.86007 16.3399H7.85444C8.76882 16.3124 9.56256 15.8206 10.0113 15.0937L10.0176 15.0824C10.1844 14.8499 10.2988 14.5687 10.3369 14.2631L10.3376 14.2543C10.4157 12.8562 10.3844 11.4662 10.3919 10.0681C10.3994 6.92057 10.3844 3.78057 10.4076 0.641191L10.4101 0.643066Z",fill:"#374151"}))},Ar=function(e){var t=e.className,n=ye(e,Kt);return ee().createElement("svg",fe({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t},n),ee().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 23C18.0751 23 23 18.0751 23 12C23 5.92487 18.0751 1 12 1C5.92487 1 1 5.92487 1 12C1 18.0751 5.92487 23 12 23ZM5.14386 17.8201C3.81099 16.2515 3.00683 14.2197 3.00683 12V11.9978C6.61307 11.9618 9.57567 11.4838 12.2422 10.5779C12.4668 11.0605 12.6847 11.5534 12.8956 12.0564C12.5555 12.1691 12.221 12.2949 11.8918 12.4335C9.24177 13.5489 7.00538 15.4612 5.14386 17.8201ZM6.60614 19.1967C8.10884 20.3248 9.97636 20.9932 12 20.9932C13.2188 20.9932 14.3809 20.7507 15.4409 20.3114C14.9668 18.0368 14.352 15.907 13.6265 13.9217C13.3003 14.0264 12.9807 14.1451 12.6677 14.2768C10.356 15.2499 8.33843 16.9649 6.60614 19.1967ZM15.5924 13.4765C16.2479 15.3019 16.8129 17.2399 17.267 19.2902C19.048 18.0013 20.338 16.0757 20.8032 13.8473C18.9143 13.3589 17.1821 13.2604 15.5924 13.4765ZM14.8575 11.5662C16.754 11.2412 18.7996 11.3067 20.9917 11.8332C20.9578 9.97415 20.3599 8.25291 19.3619 6.8334C17.6358 8.0531 15.9276 9.06168 14.1111 9.85398C14.3687 10.4121 14.6177 10.9829 14.8575 11.5662ZM11.3457 8.76846C8.99734 9.53429 6.39047 9.94463 3.2312 9.9948C3.85725 7.24565 5.74294 4.97565 8.24906 3.82401C9.34941 5.31262 10.3933 6.96064 11.3457 8.76846ZM13.2302 8.05623C14.8876 7.34152 16.4466 6.43089 18.0282 5.32624C16.4333 3.88469 14.3192 3.00683 12 3.00683C11.4014 3.00683 10.8165 3.06531 10.2506 3.17688C11.3103 4.66337 12.3129 6.28992 13.2302 8.05623Z",fill:"#374151"}))},Dr=function(e){return e.className,ye(e,Xt),ee().createElement("svg",{width:"104",height:"104",viewBox:"0 0 104 104",fill:"none",xmlns:"http://www.w3.org/2000/svg",xlinkHref:"http://www.w3.org/1999/xlink"},ee().createElement("rect",{width:"104",height:"104",fill:"url(#pattern0_9002_292)"}),ee().createElement("defs",null,ee().createElement("pattern",{id:"pattern0_9002_292",patternContentUnits:"objectBoundingBox",width:"1",height:"1"},ee().createElement("use",{xlinkHref:"#image0_9002_292",transform:"scale(0.00480769)"})),ee().createElement("image",{id:"image0_9002_292",width:"208",height:"208",preserveAspectRatio:"none",xlinkHref:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAANAAAADQCAYAAAB2pO90AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABR5SURBVHgB7Z1NbB3XeYa/M6REStQPVTlpXaAViWwKFAklFGjRwIWkFkUXDWC5SBPABSJLrRfOIpbbTbuS1FU2gaQs6kWKWuoiQIwWkoAYaBAgkhCjRQu0EuMG6CYg3RYOgsQhZeuPku5M5j2XRxoOz8ydmTND3TnnfYTre3n5Y17e8873e76jpCIrydKsDLYdi9TE4UTFByVRc+nTs0JI/1kVlSyrJLqlIrk+kAdX96n51SrfqEZ9wUry4zl5PDiloui4UDAkEJSoi3EkZ/ep55fLv64AWJxIpk4nsZwSQgIltUjnY1k7W2SRrAKC1VFxci19OCeEkOUkUkdt1ijKP7Hy8P8PUjyEbEAbFGgj/4kNFoiWh5BSNlmiDQJaHXywJBQPIWWkIlo7ZGKiJy7c7eSDc0LxEDKKOSTXzAfaAq27bktCCKlE6srNw5UbWqBBfEYIIdVJa6O4U6j3qHhqRQghdVhNY6H5SAbTx4QQUpdha5tIfEQIIbVBX2iklFoQQkhtEpUcRBJhTggh9UmQ0maHNSFNmY2EENIYCogQByggQhyggAhxgAIixAEKiBAHKCBCHKCACHGAAiLEAQqIEAcoIEIcoIAIccBLAb23+EN598a/CiFd46WA3rzwDXnnyneEkK5Rq4MPEvGMz3zqd+T26m35wY/+Q/bO7hFCusI7C/TNS2/L/y7/Xyqgj+Td63TjSLd4KKBvPXn85te/IYR0iVcuHCwP3Lcs73/4P3TjSGd4ZYHgvuVBQoGQrvDKAsH6wAplgfWBFSKkC7yxQEgY5MUDdDKBNSHSEd4I6Jv/+Hbh57569mtCSBd4ISB0HtjiH8O7N/6NVoh0Qu8FBNftz/7k5Miv+/LJN7TQCGmT3iYRIJyv/u3XtHWpw8vHvygvf+lP5YUjnxVCXOmVgJAQQFoaBVI8duHX534tFdIXUkF9QT8mpAljLyDTkgPR1LU2VXnh8O8OLVMqJkLqMLYCgmjeufqdNLv2LWdrUxVYohcOf1Ze+8pfyKcP/qYQMoqxTSLs3bdHbt++nRZC98pWgQ7uvXuH/19CqtCLGAgpajSJdunCvfb6q9r6sG+O1KFXSQR0GqBgarYsuAChQDSvfeVVioY0pr9p7LQwOrRMb9f6Plibvz79V9raEOJK75tJ31v877SQ+ucjLRISBH/3D+d6JZxIJmS7mklvO0Wl/1xJ0n+PkgeylnwssQyEuONFNzas0ed+//OlX/P9//qufHqhP5k1iGcm2q/v2wbiuRt/SBG1gBe9cLAqcM2KQI2nT+IBO9SsFs/169dlfn5elFLON/ycK1eu6J+Ln0/c8WY/UJkV+vb3/qlXrptKl/ie6JdldXVVDh06JMvLy9IWs7OzsrS0pO8/in+SOnWxkOZMiieYFHS+6GqKo+OGSq3AhGyTSA3vlZbNhP6vUkPHAAJqUzzmZ+IGAUkLcVXoeLWlGynpPOh3GwfSdIBMqd0yo/an1uVX0tsn0xhnX+pK7UmTBDtkm5qWCTUUlOp4YRtRTnQQX4WGNxYIoK6DDu0sVfvbkMVD10NbNSFYkij98yKDBnG0JYq5uTl9qwrEkrdisEDmtyRueCUgLH4kE0zHAh5X7bR+5+q/6HuI0AVYGgimrdRznldeeUVOnz5d+esvXrwoJ06c2PCcaVWKVPr2J2tCmuPdXLisAJB9q8qbX//7JyJqAtwwuGe70tTzVFq7UWNydT948OCm527duqXvI7pwznhlgYBJJsAdq+q+mYEkuL1364e1OrEhHMQ247oYbe6eEdCk2o7qKnHAOwsE8bz8pS/WyrxlB5JUtUJw1XaniQBTrxlXkG3LiwgCQhyE7B9ew7b0IkCa4eXpDH987I/0np4q6AbVTD/dqHHAukNg3VXriwt05MiRDR9DPFk3bmd6EcBroktXHy8FBOtT1Q3Lb5EomyMHVw1XbO369IjDhw9veu7SpUsbPsZrwmvDayTVCfqEOliffNobYIJPtiCLK/Ou6DmZVrukjxw7dmy9cPoUtPQ8TWc/Ba8RQqI1qkaQAjLDST73B5+3dnHjud/7rT/Urh26oXdFn9DxQl+BePLZOIjnwoUL1q83Fwy8dlJOUAJCtu3LJ0/JZz712/I3f3m6dAsEPoev/dVfOiAnT5zUTZ19xlY7On/+vNUKARSC0SUxrbjZsAzvBQRrg9G+B/b/hrY4sCp1hpRggaEYefToUd3NjNih7f60rQCJBFsy4ezZs6Xfh5rWLvUcXboCgrBA6EZoYzsD0sEHDhzYFE/0hSIrNMq6okdvpkdZx63EewHpulBaUP329/5ZfvCjf689SBFiwcJbWVmRa9eu6at4XwVks0IArT5Frpyhyw1+fSaoGGi4rfu8FhLuy4SEhQbBQDhnzpzprWjyvPXWW5teC1zSfL+cDYpoM8GmsWGJvv+f37WKCK6asTa+gddmc+WQ1n7jjTdGfj9FtJGg60B6tJWlYwFXaZ85deqU9eKAeGhUUgEYEamwl48m+L/Aqyde2+DS4Arto+XJc/nyZWujKdzVl156qVJMtFPtk9AJWkCoceyf/YTeY2PIPvYZXDTgptpEBHeuyiwGtP+EXicKVkCosk+tV9pffPHFJ88fP35cQsHEejYRQTyoe8GlK7NGU3puXbgdC0EKCO7HdKZp0qR3cauzXdoHykQE4NLBGuWbT7Ogfy7Sg1HCSywEKaBhALxxxyjEE4r7lmdU1hHWCH8bWCSku/OFVyQTdkfP6UEpe6Pn9S2U7RHezIWrCtr1bV3VT0c9jQ/GjcoCi1BnJkJd8POrZOIgOjSoQnQLCwv6b5ffvIeZc3fjn8tAHomvBGWBhq6bfUuCL4VSVyAgDF4c5cpC3Eg2ICWOPkG4eWaCqukZhGXyPckQlIA4zrYaEA9EhHpYk5gQ4oKwYNWRqfM5NgpGQBj+0bedpM8axD1GSHVrY9lt4z4PcAxGQNyq3BwICUmGrJjo8g7xbqyVDVgf9m65A3cOYjLZSlgYuGuLi4s6HjIWJySCEBCtTzcgC4cbZi6AEAXkvQtH60O6JAAB9XOSTtsYd4u0i9cCwvTQiTC81EKQDcvWaaoUSUl1vBYQTkgIHQT32dYbFEohJFqjdvBaQDhmJHRu3Lix6blspzVxw1sBTbZ4qJWvGGtU1mndDv6+D94KaJvQ+lQh22ndlZB89gS8jbCf1ZtmDgZG1gsnwaF6b06EM6Cbetz2HRkhwSrhhoH0bf2OeC/uJ7fFR7wUELJvW+W+QTCmCn/16tVKwTl2vT5LAaENp2iXqRESwD1267q27qjhabHyWB6Kb3gpoK6bRrH4kNnCcPY+zsy+efOmHlc8akwxvgY3YHbswjKh+6CuoCbS9+RxQgH1gkmZki4wJxqUDWXvC3DTYGGqCAngQpG9WJgTH8yp4aMuJHhP1uSO+IafLpxq9ygSn4STBQvfCAkCQFq7an3IWOGqTOgTwcU7vBPQhB5u0V78g0WCOQBVF5ZpsDQxTv7KPY5ku6wRz+HWdkYOcRA21iUyEJ/wTkBKtdM4iissRt2aGKAIuDLoRkZsYDsJDvQpTsJrwM2c2gAxoRjbpHMhnyhBW9VjCmi8aaPzGhk1TOcsWzQIqLHQkFHzcXOZuTBktyqYG/b/mJO+i3j99dc3CSjSbtya+AQFlAOui9nPbwOLoskW575jXNM8uMiYCw3+ZrgVjUf2sbHXyxioKQiiEVTbMOcEQVzkKSYLVwUfh9F7GAM1e5PKxIOradMJNeQpEeJTzzJx3l0SmmTgysQDX75s9C2pjo8WyEMB1XtJyDIViefcuXM6G0XawcfueP9cuBpvUtnRhnDZQp2V3RW0QB5htjrbsm0UD6lKsAIqaluB20bxkKoEKSB0F9hiG6apSV28i4GS9N+oOMg2C8A0VrYBLBv2BqFajyQFGYLjTnzDQwHFpacBFLluSFW7ArH0dY/QVpB42I7tpQUqAsKxNYe6brGGYNB4GuJo2zr4aIG8i4Hi5HHh52wbxyAcl7gHwkE2r6p4zMluIUIXrgeUvUk264O4p0k3tUmDVxEORGOOP4S1C/VokEHJxa2veCeggdjfJIjHZn2aHGsP8WBUbtF2BwgELUDooWsyP8BXYs/2AgHvBFT0JtmyYU23JMDy2MRjhAOXkKLZTEwLNP7EySPrIEzbiNsmp10ji2dz22BpLl++zKbTEphE6AGwQPlMHLJk+ZYdWJ+6ix1Wx1Yrwq5NdmyXk+h3xr/j7r3sRBgkG98om/UxW5XrYGs8NTtU6bKV46N4gJcCeiwb993bCpsYAlIH23QdiAaWh+IZjY9DFYGnFmjjm5WPWcxQwDp0UYANiQEF1B8wg9nEQWbQRZYmhUz0tmVxLcCGBOIfH+diA2+7sR8l9/W9Ld1c12oUJSFINR4lD8RX/BXQehxk2zBXV0C2JESTAmyoUEA9JFovBrVhgWw/I9R+troM3Te/hilmCXZHah3yAkISgpm3avhsfYC3AjJ7gt5///1Nnztw4IC4QPFUx8SivuKtgMwpADax2EQ1jvT9KHoUT33NvhnowlUgHzP1fWFvFWvxXfGdIAVU95Asm8u2FbtPbdm/hYUFqUNR13jXDDvf/HbfgLcCGiRDF67oRIE62BatbXG3ja0FqY3Oh60Q0IP4YwkB72Mg22KpKyBb42nX03bwO+YF1GQ7eN5SbkX6PRTrA7wVkNnWYLZTZ6nrfuH7850HXR/daNs2Ubf7wXYI1lb07oVifYDXMZDZnZq/6uLqXjcOslmhornaruD3s51RWncDoC3b2LUFQtE0FOsDvBaQ6QC2LZp8c+gobEc5YqFjKk+bmGEleZpsAMQO2Tx1t3HU5X58W0LCbwGt1yBsrk9d98ucUJcHI4Jtk06bAkHaYjRs2quLLdHRpQVaSz72cnBIGV4L6NH6gba2qy6SAHXdOGxfsIkR8YqriPC74GDjtvYd4QKRFyJ+964ycBDOg+SOhIbXAtKNjKkbZ0sCYME2SQIUHfUIEY062bsI/B4Yk2XL7DWd2W0TYlenTiBZczf+UELE+0Kq6QS2JQEwx7ouWNCILWxXcghgfn5eJxdGZfqMgBHvFI3Jwv+rycxuM9w+T1fxT4ium0GtDj7wb+J3Bhx7vzv6pF6wWNx5tw0LtMnmOAik6IAug6nbZOOOlZUVWVxctKaY89/bdNIPrE8+Q4jX2MYA/TwPk7tyP/lIQsV7AYEZtV8m1XbrYcIuCwtX+iLr4YLLqeBFvxOsZpNJRGWgXHon/pmETBC9cHAxgG0XqUtBFAv85s2brc1GgFuIE/JcZswVDdBvWzxw2e7FKxI6QQgILfV4w4tmYcPdqZuRM5hFv7S01Hibt0mR42e4iLFo8GNbB4cZ8LdE0iDUuCdLEC4c2C47ZEc0qxcZMl55wWDhQgiumB42WIKyOAeigVVAYI/7NtLLiPFs1gfCbAuKZyPBCAiUxUKgaUKhDCzo7KI2x5y0XY8pek0QT1v9bxTPZoIS0GRqh2ai/fqx7WqNRY2YZisaLtsE6XPUoPLgpAjbYcpNoHjsBCUgMK32yJSa0e4VXLk8LunjZ0FROt0kONqwdKil3YtXvTxdwZXgdqSuJXf0VRS1GVvM01VqugvKalFtzexGnedu/HOKp4DgBISFYNKvSBzYMmd9EFGZeHBhcLWgaM95kBZIQy6SViHImQgoAD6IhwsDMULRtu9xFREyfEXiQTrctS41LJD+NLXW/g8FcSXYqTxrclcXWM0RJUUiQpzUpGeuCyAYbHdAU2iReFxrPviboLuAyYJqBJdEyLNTzco2tWPkqdtYtM/yOBPUllDwLbKIruJBogCb4SicegQ/F+5esqqnZxpLVNTyggZNCKzNzXNVMFanzJ10EY9JTyNRQPHUJ3gLZDDpbTBqg5zZo4Mugq4sEoQD1xExWlk3AxIGTfb56A1w8cdBzS/oAgoow7TalYpot34MiwMRlSURTDsOMnltdDBAKCiKIkkwqsG16angcNUexvcpnJaggHKgZ24q2q33EZnmTNuEnDxm1ytuGMSIBT6qDoOfj5gL03MgnFF7hAwm01a1zoOU9MPknjxOHng/q3qroYAsQDxo+YnWT3ioYo1s2PrezJGTtqMnRwFxwmWrMhgEooGVeZRam0EqGxZCu4ECKmFKZmR7NOMsJFcgHFidMjcx0bNYH+pRXpgDQUuzNVBAI4B4ptLYaLva+eQ5CKlKnOICrBZiK8RYRjjJ+nlvw6mr6X/jx1o2KHwyg/ZsoIAqYhNSdu9PG2Iq2iM0jGHupEXOe3TFxgwKqCYQErZFmERDFogIA0OwBwf3ZoRw0XxqxDI4AAz3tsmjekxuPByVS+GMJxSQAxDSpJrWm/QmZJu4YuIYiqY/TAppDAJ1BOzpShe1bpuiVEiT0fb04+EzSt/Uhu9DHAOQHYuTgb7pBEAqG9IvKKCWGIb3yHw9TAuV7GIOBZ6RSogDFBAhDlBAhDhAARHiAAVEiAMUECEOUECEOEABEeIABUSIAxQQIQ5QQIQ4QAER4gAFRIgDFBAhDlBAhDhAARHiAAVEiAMUECEOUECEOEABEeIABUSIAxQQIQ5QQIQ4QAER4gAFRIgDFBAhDlBAhDhAARHiAAVEiAMUECEOUECEOEABEeIABLQqhJAmrEJAy0IIqY+S5ShJkkUhhNRGJepWaoGi60IIqY2K5LpaSZZmVTy1lH48K4SQyiTR2r5on5pfTeL4khBCKqNEXYR2FD5YSX48p+JkSQghlUgiNb9PPb+s60B4kFqhC0IIGQm0As3gsTJPrsdCN9OHc0IIKWI5jX0OwX3DB086EXQsFKmjwroQIUUsQyNGPGBDK4925QbxS0IREZJHa8O4bgZl+8r1pMI1oTtHCFi3PBvFA6zNpNoSpX4eEwskdKCBYcyzWTxAjfoBsEYyiM8opY4LIWEwrI1OTpwvEo5hpIAMyNLJYPqYSHwkFdOCDN07di8QH0BSYDktjt6Kk8ENmXh0JZsoKOMXxoHCKDgHwXMAAAAASUVORK5CYII="})))},Lr=function(e){return e.className,ye(e,Yt),ee().createElement("svg",{width:"104",height:"104",viewBox:"0 0 104 104",fill:"none",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"},ee().createElement("path",{d:"M0 0H104V104H0V0Z",fill:"url(#pattern0_5156_186)"}),ee().createElement("defs",null,ee().createElement("pattern",{id:"pattern0_5156_186",patternContentUnits:"objectBoundingBox",width:"1",height:"1"},ee().createElement("use",{xlinkHref:"#image0_5156_186",transform:"scale(0.00480769)"})),ee().createElement("image",{id:"image0_5156_186",width:"208",height:"208",preserveAspectRatio:"none",xlinkHref:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAANAAAADQCAYAAAB2pO90AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABUGSURBVHgB7Z1bbFVXese/fYAAmU5s1IdkWmIbVarSAgFaKU2CEdB2RIVRuLSTKCDVyVSVIPMQCC/2PHDpQ2AeZoA+MEiRCFRjklaZCVQJoYm4FWaaVurExqGtKo18wYW2o5FtMiTh4nPm/Dcsz/bxXmvvfdY+t73+P+no2OccH9/2b3/f+ta31vYkJqOFgWaZmLUh581YWfDyS6XgtRUfbhZCGp8x8QqDXiHX6+XkwoR8eWqet2Aszhd6US8YLdxok3sT271crlMoDHEET7xj+Zzsned9bdD8Og2IODmZvbuQl+1CiKMUI9LBvNzeq4tIoQIh6nj5wvnih21CCBks5LzVYdEoV/rA6J2RpZSHkCn4AQVulD4xJQIx8hBiZFokmiLQ2MT1AaE8hJgoSnR7mRoTTaZw44XrB4TyEBJFG4pr6hM/Aj1I3QaEEBKLYiq3AKnc/Qg0kd8jhJD4FOdGcedhvsfLzx4VQkgSxopjoQU5mZizQQghSbnf2iaSXyWEkMSgLzTned4SIYQkpuAVlqKI0CaEkOQUUNJmhzUh5dKcE0JI2VAgQiygQIRYQIEIsYACEWIBBSLEAgpEiAUUiBALKBAhFlAgQiygQIRYQIEIsYACEWIBBSLEAgpEiAUUiBALKBAhFlAgQiygQIRYQIEIsYACEWIBBSLEAgpEiAUUiBALKBAhFlAgQiygQIRYQIEIsYACEWIBBSLEAgpEiAUUiBALKBAhFlAgQiygQIRYQIEIsYACEWIBBSLEAgpEiAUUiBALZgqpCeNjN2V48Jr0912V/t6rMj4+/uD+ZvG5cf/5IE3NjxRvTdLSOt//uKW1RVra5sviJQtl8dJF/mOk+nhjE9cLQioOhLh84Sdy+eK/FG8/8cVJEyVSx3NrpH3VsxSqSlCgCgJpThz/e3n/1BlfnGrSvvIZ2dz5gn/f0va4kMpAgSoAIs33//YNX5rSVKwWQKTNf/kNPzKRdKFAKfL+yTOT4tQjiERdu3YWhXpeSDpQoBSAON07d/tFgUaAIqUHBbIAqdr+v/lu2RGnra1Nli5dKq2trf49PsdNPRdkbGzMvw0ODvr3fX190tvb63+O+3KASD0/PFosPiwUUh4UqAwwrtm/97t+upaE5uZm2bBhg6xcudK/x+dpoCQ6efKkXLx40f88CRgjde16jcWGMqBACUHUeeWvdiRK11599VVfmFWrVkk1uHDhghw7diyRTJBn3/f2Ssf6PxMSH3YiJKB7x25Z9yd/kXis43le1eQB+F4QaGBgQN58881p6WAY+J22bPqmH1lJfBiBYoCUbcuml62qaxjjvPvuu7EO5koAofbu3RsrImFStudHR5nSxYACRYAzc5yog/EMBvcmIM/58+drJhGIKxLkee/sO5QoAqZwBtBus+IPvx4pD8Y4SJcOHDhgfB0O2mXLlvmD/Vrx0ksvySeffCLbt283vg6/85O/80dy4vg/CNHDCKQB7TevfHO7sZMAkQRjjOD4BpKsXr068gx/8OBBX7xaEvdnPXz0IOeMNDAChQB5MKA2yYOqGs7kpcUBSIXH8bwJRACkUrVE/aydnZ3G1+FEwkgUDiNQCUjb1v3xnxvl2b17t+zZs0eiwGuiJMFr8H61Zt68eZFjuPfOvSPtK9lPF4QRKIBfMDDIg0IBUrY48gC8LmpcFEeySoPvHyUPQFROexlGo8MI9ICoahvkQQUN5eikoGjw8ssvGw/SWkUiVOXws8WF1bmpUKAHrPiDr2vPrjbyKNBqs3HjRuOAvdqFBVUVjBN9gmCe6NJPPxLCFM4Hs++VlAfg66PmgFBYOH78uFQDVYHTyYPiiK5XD38rdGUQRiC/tw2pmw6MeTB3khZRpeO0hDUBafAz6Lq41YQveupM6R2LCo5HIBQL0BiqA2OSNOUB6uDUnd1xcEelerZACtMSCBUp8bubxmVRpX4XcFogpG66ogEOnrjVtqRESRSVXtkAeUydEKgaBtNM/A10c1qQp/s1t1M5Z1M41aoSRrV61pAiQRQdOHDRgJoWkAdVNx26+S2IjGKDLiq6nMo5G4Gixj3VaPjEQN00T4RIkdYcUZQ86EbQRVw1/6XD5YLCjK7dO/eIY6AtRdeagjLy1q1bpVo8/fTT/j0Wv4WBKAXRyhUa0ePFF1+Ut99+W/saFCzOnDljfB98f2z++PHHH0977v//7+f+vJCLS8OdTOGQuoWNfWq53ACFA93YRPWsJV0CjpQL72sqGKjyepz3NqVy2Mjxys/+zbkNHZ1L4RB5dIUDpDC1WqtjShuVCEmANKZSNcD3wxgrrph4na4qpzaRdA3nIpAp+mBNTy2J6gyI26mAyVhMypqqeDYrZCEmUstSkMZd+dm/iks4FYEwaWqKPrUGB7Np3gU/o2l+CMLs2LHDL8FHyWOTqup+Rvxtse+3Szgl0Im/Cy8c4ECKWhNTLRA5dKtFIYWuM0ClbIhSJvB7xh3z6EBRQ7dJimubkjgj0P0cPVygeog+QXCG10UHpE6l/XIodSP1i9pgEekfStlp7Eenm1ytl/3Aq4UzAmGVaRg4mNavXy/1RNS8ixrfQCaIE+cEgPmmqOiUBEQynYguFROcEUj3T01zh9A0QYpkSuWQrkVV2YAqzUdtIpIU/M10fYK6k1UWcaIKh5Si9TefCH0OB1c1Nz1MQlQLTRT4vSrZVWFqRRr6xX85MSfkRATSbYiIA6te5QFRqZwJpGyVnhQ2rRlyJQq5IdCF8NJqPcsD1IbxSUCJOs6+b2mhS+Pq9RpJaeOEQP19n4Y+Xm/FA4C07dChQ35qhPQNH8dBdQlAnkouxitFdxJyZT7IiTFQ84zfCn0cnQe1at0JAmnUpUlwn3QdUC333cbPii2xwnBhHJT5y9zr9joIXsyqFmAAjotkQZiwtpgkIPrU6ndR3zus0IHUuWNDti+XknmBhgdHQh9XfWeqkICrxKkrxqWJuqocxjO4qSvLpbnaFAKqZQ+1QF1OpZThoca45KUN2Y9AvZ9qn1MHdelAHWdVJVIwUuHxpqam0PcaGhry79UlGHGvPk4LHKg6+dCNUCuBdCed/r7/kKzjbApnQs3y1wOQFmKgDQf3ECWs86CWUUh3UhmvwJ4O9Ubmq3DjY+PSiEAEtN6g0IECgRIDIunmXk6dOiW1wOUIlHmBhodGpFGAJChFQxpMgobJgs91czwYh4zV4Kxfj61Q1SLzZWy08NRrd7AqYCS9arepdFyLPbZNP0/x+JIsk3mBdHNAOMPjH6+qYpUY9AdRsiDdQcXP1AYTBwgXlrLhffG7VRtcSDkMCtTg6AQqFMJ/bQikKl2orOF+dHTU35EGH+sEU5U6DKgXLFjg36sKXiXmaEyNnHEaZNXvok4cQP2OUahqJO7VDVMCod+HAjU2SQVqJHSL6DBGQjOpmn/CiUCdFFS0rRYUqMHJskC6kjaIc9XwapB1gTJfhdP1YlXzLFwJIIdu/kU9X2tcWA+U+YnUpuamzKzRx7gHDadq0rTewd8+62RfIP8sPb0nCxGoHjqxo1DSYI6n0aJmS+t8yTqZF6ilbX7oeiDVu1aPIP3CzjtpdGqbwAlEVdGCVUTdnI5Ciazudf15TOEyQEtr+MVw6/FsDlkgDeRJawyjOswx94R73NJe/qArZrS0tkjWcSIChVFPAkEcHIRpR5tqTapiFWwYur99lsh8FU53yY16GISryVDdXtNRqK2ldKXsqC2v0gLdHGG4cLmTzM8Dmba0QodBLRohbSKO2oa4dHtdjFvC0r5Kb9uFSI7OizBcWNLtxDwQrhoQRrXb/9W1T5NGHEiOzmzIgE5tRJxSKXRLCnTRIS200WfJQu4LlxXaVz4T+ni1UhxEBkQcnKmTiKPGMIiUWBtkiiS6vaornarqruG6eOkicQFHBAq/AK7pmqFpkWT/aqC2p1JrguKmX0uWLAl9vNInCd2lKTueWyMuwK19KzRGUJciibsxokrT0AhazrjMtCanUmM9bu3rSATCP1KXxlViHKSiThx5ghEHUarcA900t1OpKKSL4Phbu3KtVGeuztCxPnx/srSXQeMKcTgrx5lnSkOcILpIWqlCgi5929z5grhCQ06kXhsekdde6ZKr/f8pN8c/i/U1pgV0jz32mDz00ENiQz6fly+++MK/j6JSV02oZgQy9ebpon0WaTiBIM+aFetji6PAkuMZM2bIxMTEtOfu3btnJRC+/ssvv4xcY4QDHAvddBUzW9CuE0YlljagqhgGoo9u2iCLNFwKt6f79cTyKB6aHS4JpAoTKw537tzxI0+UPBD0iSeeqJg8QDcXlHYEMkWfzZ3fEJdouCrc/ObfFRtu/fJW6MGO6PTwww9LEhB17t69a3wNIt/cuXP990en87Vrldvu1lSJS3MFLuazwgTiZe4dQJeqIQJFyaDAwRhHHiUl7gE27agkamlCGGk1z5qiT9euneIazgk0c9ZM7RZMt2/fjjxT4/nPP/88Up7Zs2f78uRy1f0T6woJaYyDVEdFGIg+mzufF9dwTiDIoxsLQQ5IpEPJY6q04f0hjm1Vr1x0hYQ0StmQh9FnKs4JBGbNmqWNDIgsYQWFOPLgPYMpWy2IWk1aLhAH/XhhuBp9gJMCgdlzZmufKy1Jx5UHxYJqp2ylVGIMhNRN17IDen50VFzFWYEQJWbODJ8GgyiQSIG0ziSPKhbUWh5QiZ439Ofpy9Yv+EsXXCXzS7qDtLe3y4oVK2RF+wp58sknJ/dVUzt2YpyANAUHCyZH1XjIVDBAOjhnzhypF9KOQBj3YI+GMJC6de16TVzGCYEgzre7v+3LE4a6iJW6kBWaQdFJHXXQ1Zs8wLTZYlLQDGtahoHCgUtdB2FkPoXbv3+/fHD6A608YUAkNHmaLhOC9K/e5EkTRGScRHR07d7pbOEgSGYFwpn49Pun5VuvfEvKBWffsBWXGOtkXR4UDXRzRxjzuFq2LiWzAh35/pHQqHPp0iXZunWrLFq0SL76yFf92/Lly/3HLv7z9PZ89K6hc1qhqm26ydh6Je4YKEoepGwuV91KyaRA3d3dsm7duimPYSfStWvXytqOtdJzokeGhn+9M+mV/iv+Y3h+06ZN0w42bB2lLquI1K0eqm2VAGMekzxYJPfe2XecH/cEydyR0NLS4hcMgvjyFMW5dPmS8WshxukPTocuiMN4CMUGdF+buhXqlai1R4cOHZKNGzcaW34QeSjPVDInkE6e4eHhWF+PytqN/70x7UwcvLivWsIQZ/FcvaP2btBduFhx+OhB7eYsLpM5gUpTt3379sWWR6EkKm2cRBRCVwK2sn3jjTfkqaeeKnsdUT2g9m6I2p0I8rDiFk7mBArOgyD6YGxTDpDorbffCl2CgIVrGBedO3dOenp6/CXh9RKN4iyZQNSJs3eDP+Y59w7lMZDpeaDLly+LDbdu3ZIf9PzA+BpU6T788EN59NFHY68nqiRRF0FGtEHU0TWGKjDWee/cD5m2RZBpgVBds+Xw4cNy5Yr5fXBwnj171p8bgnT1IFIpqjwdp8MC8zyotrnc4xaXTAuUZAXoli1bZOTaiFz99Kps2bxl8nGMn5a3L/fni7COCPM/OBBL93yDRBgjqUZUJVK1L2askyPuxbq2vfrXcumnH7HaFpPM7Ynw2c1fbziyddtWf4wSB4iDEjiAePMfD7+2DaS4c/uOLwbSIPTOBSmdYMXnmDtSt5s3K3u91nIvlQJhDh89wJQtIZmOQIsXL479WiUPMDVkorgw9+G5/tJwU5u/AqJBOpS9EZXUdr9pXuAL74WxDd67nB14/Kjz7x9RnjLIdARC2w7mgOIQ/DqAlC0KLHno7uqWXbt2TT6WpMVHXX4RN2wOr7bnDdscJHhdUtwgCqqMuC9XRmyAiKZQilM+mV7OoNb+RHUglAtSsus3rku5KBnibkCfFkjX9n1vr3a7YxKfzKVwiDpB0BdXSUrTvXpuMkXEwaQo9m6jPOmQOYHQeRAEUeg7+78z5TEc9Js3b54y7tGB13Z0dGhfiwgX5Cu/8RWZM3eOdrl4tcFkaMf6Nf6EKOZ1OCmaLpncmfStE29NaekJVtUgAhbYKSGwjAHdCmFjIJS2sSwCoJz97PJnp5TGg88Hv06BkjZafe7dvVfVlh9IgzkcRBnsWeDKpUZqQSbHQChf/3jxjyf3SAvOzmMvhGA0OXLkSOh7lMqBr4GUqiyO50sjW2n6iO5u3FC5g0y4bXr+OenvvSr9fVclTSAMigEdG9YUP15EaapEZvfGDi5reH3f65MNpUjJMGFaDgsXLfTfR/ce6nkTI2P/7d/jqnn9fZ/6Mg0Pjsjw0LD/2PDQSPF+3P84CIRoam4qfu9H/MvH42fA/eKlvy8trS0UpkY4t7k8QKeBLvLo2LZt22RfHOTExGsQjL0gahRKIJINnNwXDmMejH3iEpQHIMqoYgXSw66urljykOzhZARSxIlEpfIEUSXsJD13jEDZwqmNFUtRa4V0EpnkAZW+XAmpf5zd2lehS+ei5CEEOC8QUBKhtwxjGspD4uL0GKgWcAyULRiBCLGAAhFiAQUixAIKRIgFFIgQCxpOoEeaopdaE1ItGk6ghYt/TxqVNR1/KiRbNNw80LXh/5E1K56Tm+OfSSOByPlPl/5RHm/5bSHZoeEiEA5AHIiNcjaHOM+0P0V5MkrDRSBC6glW4QixgAIRYgEFIsQCCkSIBRSIEAsoECEWUCBCLKBAhFhAgQixgAIRYgEFIsQCCkSIBRSIEAsoECEWUCBCLKBAhFhAgQixgAIRYgEFIsQCCkSIBRSIEAsoECEWUCBCLKBAhFgAgcaEEFIOYxBoUAghyfFkMFcoFPqEEJIYr+D1FiNQ7oIQQhLj5eSCN1oYaPbysweKnzcLISQ2hdztebl53oKxQj5/XAghsfHEOwZ3PHwyWrjR5uULA0IIiUUh5y2Y531t0J8HwgfFKHRICCGRwBU4g4899eCDsdAnxQ/bhBCiY7A49lmG9A2fTHYi+GOhnLdaOC9EiI5BOKLkAVNaefxUbiK/USgRIaX4bqjUTeGFvfJBUeG8MJ0jBDyIPFPlAaHNpH4kKuZ5LCwQ14ED98c80+UBXtQbIBrJRH6P53mdQogb3J8bnTnjoE4cRaRAClTpZGLOBpH8qqJMS+R+esfuBZIFUBQYLE6O9uYLExdlxt2TwUKBiV8BytTjiypUmqUAAAAASUVORK5CYII="})))},Fr=function(e){var t=e.className,n=ye(e,Zt);return ee().createElement("svg",fe({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t},n),ee().createElement("path",{d:"M23.6839 9.95997L20.3085 7.73438L23.6839 5.50878C23.8859 5.37566 24.005 5.14785 23.9998 4.90598C23.9942 4.6641 23.8648 4.44192 23.6567 4.31817L16.5787 0.0994794C16.3457 -0.0397375 16.0542 -0.0322375 15.8287 0.118229L12 2.67054L8.1713 0.118229C7.94583 -0.0322375 7.65427 -0.0392687 7.42131 0.0994794L0.343281 4.31817C0.135159 4.44192 0.00578582 4.6641 0.000160893 4.90598C-0.00499529 5.14785 0.114066 5.37566 0.316094 5.50878L3.69152 7.73438L0.316094 9.95997C0.114066 10.0931 -0.00499529 10.3209 0.000160893 10.5628C0.00578582 10.8046 0.135159 11.0268 0.343281 11.1506L4.26573 13.4887V16.1375C4.25542 16.3705 4.35854 16.6166 4.60697 16.7746C4.60979 16.7764 4.6126 16.7778 4.61541 16.7797C4.61822 16.7811 4.62104 16.783 4.62432 16.7849L11.6381 20.9933C11.7516 21.0612 11.8795 21.0936 12 21.0936C12.1303 21.0936 12.2583 21.0556 12.3619 20.9933L19.393 16.7746C19.6049 16.6475 19.7343 16.4188 19.7343 16.1718V13.4887L23.6567 11.1506C23.8648 11.0268 23.9942 10.8046 23.9998 10.5628C24.005 10.3209 23.8859 10.0931 23.6839 9.95997ZM16.2398 1.5343L21.9739 4.95191L19.0133 6.90376C17.9455 6.26299 14.8842 4.42598 13.3144 3.48428L16.2398 1.5343ZM2.02607 4.95191L7.76021 1.5343L10.6856 3.48428L4.98666 6.90376L2.02607 4.95191ZM5.22665 12.4246L2.02607 10.5168L4.98666 8.56499L10.6856 11.9845L7.76021 13.9344L5.42165 12.5409C5.36399 12.4921 5.29837 12.4527 5.22665 12.4246ZM11.2969 19.1487C9.67643 18.1765 6.68257 16.3803 5.67196 15.7738V14.3267L7.42131 15.3692C7.5324 15.4358 7.65709 15.4686 7.7813 15.4686C7.91724 15.4686 8.05364 15.4292 8.1713 15.3505L11.2969 13.2669V19.1487ZM12 11.1332L6.33523 7.73438L12 4.33552L17.6648 7.73438L12 11.1332ZM18.328 15.7738L12.7031 19.1487V13.2669L15.8287 15.3505C15.9463 15.4292 16.0823 15.4686 16.2187 15.4686C16.3429 15.4686 16.4676 15.4358 16.5787 15.3692L18.328 14.3267V15.7738ZM18.7733 12.4246C18.7016 12.4527 18.636 12.4921 18.5783 12.5409L16.2398 13.9344L13.3144 11.9845L19.0133 8.56499L21.9739 10.5168L18.7733 12.4246Z",fill:"#374151"}))},Mr=function(e){return e.className,ye(e,Jt),ee().createElement("svg",{width:"104",height:"104",viewBox:"0 0 104 104",fill:"none"},ee().createElement("path",{d:"M0 0H104V104H0V0Z",fill:"url(#www)"}),ee().createElement("defs",null,ee().createElement("pattern",{id:"www",patternContentUnits:"objectBoundingBox",width:"1",height:"1"},ee().createElement("use",{xlinkHref:"#aaa",transform:"scale(0.00480769)"})),ee().createElement("image",{id:"aaa",width:"208",height:"208",preserveAspectRatio:"none",xlinkHref:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAANAAAADQCAYAAAB2pO90AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABHmSURBVHgB7Z1NbJzFHcbn3bQKvRBbnFKpxVYuSDSJ00qgIlASEKJRIsUJUCRHikmAQ6KKxOHQ5BLHXOgF7PQQDkj5QCISFYVEClLTCGIrCOgBYjdQcanstBWckO2eQlvvdp/XGfR6s+/ufL1fM89PQlmH3ex4d575P/Of/8xEQpH5xmyPWPrhYC1atbkR1QdEI+pr/nWPIKT6LIioMRc1atNRTUwuiVsXe6P+BZUXRt2eMN/4pk/8b+lwVKsNCwqGBEIkorP1mhjrjdbOdX5eCog4NbF6tFEXhwUhgdKMSBN18d1YWkRqKyBEnajeuNp82CcIIXONWrS1XTSqtf7F/H/+NUDxELKCOKBAG63/Y0UEYuQhpCN3RKIVAlpY+npWUDyEdKIpou82yTnR9xZusfH1uKB4COlGH5Jr8oc4At22brOCEKJE08r1w8otR6Cl+glBCFGnuTaKPyKs90T11fOCEKLDQnMu1F8TS3cNCkKILsulbULUtwhCiDaoC61FUbRREEK0aUSNASQR+gQhRJ8GUtqssCbElJ6aIIQYQwERYgEFRIgFFBAhFlBAhFhAARFiAQVEiAUUECEWUECEWEABEWIBBUSIBRQQIRZQQIRYQAERYgEFRIgFFBAhFlBAhFhAARFiAQVEiAUUECEWUECEWEABEWJB8AI6f+4PghBTghbQ4sK/xbEjx8WN6S8FISYELaD3L/4pFhH+JMSEaGHp64YIlB2PPik+mvpErOm5W9z89itBiC7BRqB/zP0zFg9AFPpo6mNBiC7BCuh3L7+68uexVwUhugQpoOWI88mKv8PPiEqE6BCcgGTmrZ1Y9uzeTxERLYJJItyY/qKZbbssXv/9G7GI0kBCYfvObWJo79Pi4S0PCUI64bWAIJTz596O09Stlk2Fn/b9RBw9/pJ4ePMv48eEtOKtgCCag/sPd4w2Opw6PSGGhn8tCEnidQTCfAbZNtMEAezc0N5nxPbBJ5pRiHaO3EkwcyBEpGU7d7nrc2HZDhx6IRYNRERIGsFVIiASIdt2Y+bO+jfMc06dHme0IcoEWcoDET3yi8fvmB/99e9/YbKAaBHkQipEgrlNEmbaiAnBlvIgMZBkaPgZYUtc4TBZzpo6tA3bNrhQ7JZgBYR5DqIOiCOSRYoanRKV3ffec5/Y8dhTYsO6B8XrJ98QZQFt2bDugdi2om0H949QSI4Iej+QTBaYJg0wqqMIFR0zuVCLznnsyGgsqiI7qhQ22pKc7yEbCSGxgNaeoPcDoVMhalz77IpYP3C/1mth1Q4+130kRxoc1QxIi+cJog7WwLotJMtqCy4SmxG0gMCxkVHxyviY8vMhGFQ46JYGwS6imiHrRIVp+zAHPHr8CBMpmgQvIFUwkmNU71aM2omso5Fq1OkE2nd09CVB1KCAFFC1a6q4jkamUScN2jp1KKAOuO6YSVxFIxdRJw3auu7wYMU2pGXXOtHT0yPOnj0rZmdnRV9fX9fnL2/sM8/UpWXY0tiyZUvctjNnzii1DzBb1x0KqAUUnUI4OqP6oUOH4s45PDwcd048Hh0dVXotBIr301k3wnNVxQ1hj4+Pi6tXr8Zte/bZZ+PHhw8fFqrgs4CQeAjlndDC3cbErmFUR+ccGBho+//n5ubE1q1b4z9V6DY30m0j2tcp4qBdu3btEtPT00KV7TufEK+89jJt3W2Cj0DSrmGEVe2Y6JDvvfdePJKniUc+z1U0sok6ndp3/fp1LVuH7SDS1mUx76oaQUcgWBLYE505CMQA+4NOqoNpNAIuo04aCwsLYmJiQoyNqa+JMVsXqICwF+jYyHFtu2bSMVs5ceKEcieVm/lURnoIWorbBggc/8bFixeVX7N+4/3irXdPB2nrghKQtGtYDFUFgoEdGhwcFK7QjUbdcCXuJMgoQug6bTzw4gvNtPzzQQkpmDkQ7BoqklXFI0d0zBFcigfozo3SUJ3rmIBsnW4b8dmiGj2kbJ33EQhVBPJgEVWyGNHTMI1GebcR1vPcuXPKrwnF1nkbgeKFypHReETUya5hNM9iRO/2vrroJjFsQPtg6XQEi3lmCHuPvIxAuuUt6IxYDDXJrpmCrNfJkyfjkd0GvB5tz1NQOokQ4HO2zisBld2uSS5cuCBGRkacJRHQdnRqVELkhYmtg5AuffCOV7bOCwGZZtcgHAgoL9Dp9u3bJyYnJ0UWINmBpEKeg4FJts6nItXKz4HkEVUm2bW8xAO7hk7W39+vLB45H9OJjohseA+8F94zD0yydShSxdzUh7lR5SOQvKZRhSJGaF27ljYf0513VMHWodri0od/FFWm8gLqWfXjrs+pil1TKf7UnXeUfdBo9j9RZSpv4VTOroadmZmZEXlgY9dUij9108lF2LqbN28qvRfnQCVAZf8+vkxYIpflM+1AZ920aZNyatp0PmYy70Cb0Dad6KWLXBTGZ60iIB/S2l5k4ZC61tk1ic5kW0aTJAu7pvPeZbB1ck1LNcrhJCTUzlUdb9aB4i3OGpkdaZtsOpHJYmhW8zGTdLKLRVjdwQMlPqfOTMR/+oA3pTzw07hdQfVIJnzxcm5gQl52TZUibB0GD7xeVTz4bq59fsUb8QAvS3myjEZF2jVVsrZ1up9BXodKFoGXxaRZRKMss2uuyTJbp/MZIEOKuQ7WenytyvZ+O4OLaORqMbQoXCzC4uARRB3VA0h8jjpJgtmRikwdqrRVK7RlByq7XVPFxtbhNapzvfjAyGbk9yHDpkJQW7qzPGm0iGoHE0yydaqEEnWSBHWsVVxO3/Tj8OWubt8uojjVBpNsXTdCmOukEeyxVi6iUVntmiomtq6VEKNOkmAPVpTRCF++bjQqKrvmGpNsXZJQo06SoE8mjS8FnvpY+4RNjNw4Ny3Lurq8kIW2Jr/Ljem/BX/XarAWDofIw8LZHE/bV8CeG5cg+iA9b1OlHfrppMEJCIKBcCAgV+B8bJyVXRU7h7UcCMfl1vJQ7xIKysJBNDhcUVU8qoug6JBYnXd5UEgWINKgjTr1a6qfgdymHdoVKEEISF5GtWf3fiXLJpME8/PzWuleHM6O/TBZ7rkxBXYNIkcbVZDpeaS8VZMlMrPp+1lwSby3cLpnxKEEB/Oa5Mhrku4ti60zsWvt0vOyFlBVgKHMjbwVkO46j0olgckqPurhIMq8haTb4YHKZwAhorxJ9TPwfW7kpYXTuYwKoIOrVBKYrOIXYetM7ZrKZyDvWlX9DHyfG3kVgbKIOmmU0da5smuquL7Csop4E4GyijppmKziZ5WtM8muuaim6MvhQuWyU/kIhOTAnt37lIWDKIASfdeFn0UdfKi7GJrVXiWTaPTWu2ecFfUWReUj0LEj6lc1Zlk1DTHIq+5VQEfDnApRwyQaIZqhw2JCryoe/N74/VuzjC4wiUbHjrirCC+Kykege++5r2uKGlEHVqvTjdouyTJbl1V2zSWq0QjR5+a3X4kqE8RCKkZrnUtzbckqW5dlds0VEDh+h7xOQS2aygto+85fKT0PtgWdL890sitbVza7lgYSGPKoL5V2bt+5TVSd4JIIoCr36Mgr68ts14DJUV++JBG8WQfCQh1KdnRqsFyczKmLbrZOlapcUxlv/37tZW9KfLxaSEU0wkVbOudkF7Gnx8VW6iRVuaZSntZT9aiTxNuTSZEi1dnzUxVbl6QIu2ZS7cCTSSsGvqi33j2t9aXJkznz3NMjs3VyrqP72ryza7rVDvJ78PnchFXNsHpCeMr6gfvjauC7frRaOcnw6aefxinv3t7eXNaNMIdAkuDWrVtar0OHXrt2bS5tRKTctm2bsnBg0UZ++5t4AMN34DPBbOmGrUOSQacqOMviT5PMVTsQibDWk0Ub0TZYTNq1dILZ0o0vFF+szpcriz919r+ooHstSCcQHVxvl5B2Df+ujl279OE7wR1zFeypPLq32rnI1rmKOmm4iEa6N83Brh049IJ32TVVghUQMLF17W5vUEG3Y5piKnTaNTOCPljRxNbJu4RUbZ3uxbudFkFVFkhlOZBq+2jX7AhaQBKsiutcyAVU5h66cx3YLyQt0sD/Uy1QVW2fTnEqgF279tmVZvR5SBAKaAVDe/XKS+Roj06YHO11ow6yfbLwsxuyQFX1KsZ20QiC1mlfkgMvPh/kXCcNCsgBSVuHeYRu1IF4dNZzdDevJaORrl0jnfmBIM5AR1XFxSY/RCNEGJXNazIaEbcwAinicqHSJOqkoRuNVCjDva5VgQJSBKO3bVWCzlxHF525URoyRW9SmxcqFJAGqNhGJzWp2nYZddIwjUaIOPid8NoqXFNZJiggAzBCY6RWWazMMuqkoRONbCrCCQVkjDxYEeJI66h5RJ00ukUjtAmDABIZnPOYQwFZgo6IjiozauiMyQM9ikZGI2nNICzYtarcKl52mMZ2BKxQWdPEMjlA3MMIpAgWHvPaqVokqEzANg4bbsx8GV/eHAIUkCKy/KWMt8+5QtbGYXu7DTg8/v0Ll0UIUEAapNW+VR2d2rg1PWtEN7B9/vybb1vdgF4VKKAEKM1fv7H7Hn7dLQ1lRXcrAz6fboWk2FuFfVYQz0eT/ts4CqiFU2fGlfe4ZLGdOi90tzJAODhhpxu4kU6CM/p8hwJqYf3Gn4lLH7yjfHJm1WydyVYGnD+OPUDdojMiT/L0Izz23cZRQG2QO1Ux4ma1UzVvbHaeqn4O7bbG+3QbXTsooA5g5JU7VVU3kZXR1pnYNfzO+N11dp6ef7ONgDy3cRSQAkePvxRbmKrZOhu7ht9ZByQM2h3sHycTPF4TooAUqZKty8OutdIu+kh0jg+rGhSQJmW3dXnZtSSoPOh0NBiSCb5GIQrIkLLZujztWhJYtz2793d93sH9I7HQfIMCsqAMtq4IuwYgnB2PPil2PPaU0qVmeM4jP388FpJPC6wUkAOKsnV52zUkBDCfwc3oEI7OtZoSLLTitRvWPRj/Wzo3CpaRoI/2zQLb44KlFWsHnoM9PCbH8ELkr7w2ph1xZEkO0tEmglEBRwTjGpoqXvtIAWUEbsfDLXk6IyzmSJs3b47tXTtwqMnU1JTWSaLLNnNcO+JANO9fvJxrUSjainbi8Maq3CtEC5cRprYO85k0du3alZtdW9N7t1hcXFSqvnbF4kLz/dYsv29VYATKARNbZ4OpXUsD7cbcJUsLhzO3IfSqHRtMAeWIia3TwdSuqYJ2Y8FUblmwwZd7hSigAkA0QpGlq7mF7Iw26zm6YGF0OTLpRVVEG1hLX253oIAKwpWtc23XdLkx80VzIfW5rhEp6+hYFBRQwZjaujJ1SESjHY8+1fE51z6/orTbt2owC1cwutk6F7VrrkE7YM3SwBqPj+IBFFBJUKmtc1G7lhWdbvcbGn5a+AotXAlptXVVmT+gxKc1MYK2I1r6CiNQCZG27trnf47/K5Nd6wRS0q3oXptZNRiBiDMQfRCFkkD8Pt/kzQhEnIEERzKZgMc+iwdQQMQpWNCVIPvmO7RwxCmwcRvWPRAXofqcPJDwehPiFNi4ob3PiMVF/8/FBhQQcc72wSfEmjX5bYMoElo4QixgEoEQCyggQiyggAixgAIixAIKiBALKCBCLKCACLGAAiLEAgqIEAsoIEIsoIAIsYACIsQCCogQCyggQiyggAixgAIixAIKiBALKCBCLKCACLGAAiLEAgqIEAsoIEIsoIAIsYACIsQCCogQCyggQiyggAixgAIixAIKiBALKCBCLKCACLGAAiLEAghoQRBCTFiAgOYEIUSfSMzVGo3GjCCEaBM1oulmBKpNCkKINlFNTEbzjdmeqL56tvlzjyCEKNOofddb6436Fxr1+jlBCFEmEtFZaCfCD/ONb/qiemNWEEKUaNSi/t5o7Vy8DoQHzSh0UhBCugKtQDN4HMm/vD0Xut582CcIIWnMNec+m2Df8MP3lQjxXKgWbRVcFyIkjTloRIoHrCjlia3cUn2XoIgIaSXWhrRukqjdM28nFa4K2jlCwO3Is1I8oG0xaRyJmj6PiQUSOtDA8pznTvGAqNs/gGgkluonoigaFoSEwfLa6A9WTaQJR9JVQBJk6cTSXYNC1Lc0xbRRLNs7Vi8QH0BSYK65ODpdbyxNiVX/vZBMFHTi/2gCuD0FrzebAAAAAElFTkSuQmCC"})))},Rr=function(e){var t=e.className,n=ye(e,$t);return ee().createElement("svg",fe({width:"104",height:"104",viewBox:"0 0 104 104",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t},n),ee().createElement("rect",{width:"104",height:"104",rx:"8",fill:"#F0FDE6"}),ee().createElement("path",{d:"M64.4269 23.8569C64.5463 23.8423 64.8138 23.8423 64.9456 23.8414L71.8625 23.8399L73.9938 23.8404C74.7069 23.8407 75.5669 23.8 76.2538 23.9805C78.6928 24.6216 80.1478 26.6444 80.1588 29.1128L80.1581 61.5291L80.1591 71.0813L80.1597 73.8507C80.1597 74.4822 80.1878 75.1947 80.0991 75.8151C79.7894 77.9819 78.006 79.7697 75.8441 80.0969C75.2944 80.1801 74.6938 80.1597 74.1369 80.1597L72.0703 80.1585L65.011 80.1582L39.6403 80.1585L32.0494 80.1591L29.8818 80.1604C29.2943 80.1604 28.5927 80.1791 28.0251 80.0726C27.1626 79.9088 26.3565 79.5269 25.6833 78.9632C24.6684 78.1079 23.9516 76.8226 23.8635 75.4916C23.816 74.7729 23.84 73.9782 23.8404 73.2538L23.8405 69.4823L23.8398 66.2447C23.8398 65.5176 23.8025 64.4816 23.9408 63.7969C24.1143 62.9326 24.51 62.1285 25.0889 61.4635C25.7911 60.6466 26.7329 60.0713 27.7806 59.8204C28.6398 59.6122 30.5726 59.6829 31.5574 59.6832L38.3462 59.6819L40.5158 59.6832C40.8651 59.6835 41.3867 59.6982 41.7263 59.6729L41.7575 59.6704L41.7561 48.5477C41.7548 46.4515 41.6346 44.8862 43.2857 43.248C43.9866 42.5499 44.8753 42.0707 45.8436 41.8686C46.5232 41.7265 47.3628 41.755 48.0698 41.7555L50.5174 41.7577L59.6819 41.7564L59.6816 32.5576L59.6803 30.025C59.6803 29.3922 59.656 28.6107 59.7697 28.0015C59.9356 27.1415 60.3185 26.338 60.8822 25.6674C61.7891 24.5874 63.0288 23.974 64.4269 23.8569Z",fill:"black"}),ee().createElement("path",{d:"M46.855 44.3258C47.1217 44.2959 47.8575 44.3164 48.1674 44.3167L50.8515 44.318L59.682 44.3191V77.5969L39.2967 77.5972L31.9667 77.5975L29.9967 77.5982C29.4792 77.5982 28.8279 77.6313 28.3353 77.5225C27.2656 77.2728 26.4496 76.2957 26.4134 75.1941C26.39 74.4791 26.4008 73.7735 26.4015 73.0635L26.4023 69.0713L26.4008 66.1144C26.4004 65.0322 26.2609 63.9775 27.0275 63.1107C27.8711 62.1569 28.7858 62.2422 29.9411 62.2419L31.9836 62.2416H39.497L41.7114 62.2447C43.0596 62.25 44.3615 62.4628 44.3221 60.616C44.309 60.0022 44.3169 59.3322 44.3172 58.7144L44.3161 50.3819L44.3164 48.0381C44.3165 47.5293 44.2886 46.9574 44.367 46.4579C44.5721 45.1511 45.5703 44.3983 46.855 44.3258Z",fill:"white"}))},Gr=function(e){var t=e.className,n=ye(e,en);return ee().createElement("svg",fe({className:t,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},n),ee().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1"}))},Br="imagely/admin-app",zr=(null===(he=window.imagelyApp)||void 0===he?void 0:he.proTypeInstalled)||"lite",Ur="/nggpro/v1/video/save-video";const qr=function(){var e=(0,ge.useDispatch)(Br),t=(0,ge.useSelect)(function(e){return e(Br).getNotifications()},[]),n=function(e){switch(e){case"success":return"bg-green-50 border-green-200 text-green-800";case"info":return"bg-blue-50 border-blue-200 text-blue-800";case"warning":return"bg-yellow-50 border-yellow-200 text-yellow-800";case"error":return"bg-red-50 border-red-200 text-red-800";default:return"bg-gray-50 border-gray-200 text-gray-800"}},r=function(e){switch(e){case"success":return"text-green-400";case"info":return"text-blue-400";case"warning":return"text-yellow-400";case"error":return"text-red-400";default:return"text-gray-400"}};return 0===t.length?null:ee().createElement("div",{className:"fixed top-10 right-4 z-50 space-y-3 max-w-sm"},t.map(function(t){return ee().createElement("div",{key:t.id,className:"p-4 rounded-lg border shadow-lg transition-all duration-300 ease-in-out transform hover:scale-105 ".concat(n(t.type))},ee().createElement("div",{className:"flex items-start"},ee().createElement("div",{className:"flex-shrink-0 ".concat(r(t.type))},function(e){switch(e){case"success":return ee().createElement(Kn,{className:"w-5 h-5"});case"info":return ee().createElement(Xn,{className:"w-5 h-5"});case"warning":return ee().createElement(Yn,{className:"w-5 h-5"});case"error":return ee().createElement($n,{className:"w-5 h-5"});default:return null}}(t.type)),ee().createElement("div",{className:"ml-3 flex-1"},ee().createElement("p",{className:"text-sm font-medium"},t.message)),t.dismissible&&ee().createElement("div",{className:"ml-4 flex-shrink-0"},ee().createElement("button",{onClick:function(){return e.dismissNotice(t.id)},className:"inline-flex text-gray-400 hover:text-gray-600 focus:outline-none focus:text-gray-600 transition ease-in-out duration-150"},ee().createElement(on,{className:"w-4 h-4"})))))}))};function Qr(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=Qr(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}const Wr=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Hr="-",Vr=[],Kr=e=>{const t=Zr(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]"))return Yr(e);const n=e.split(Hr),r=""===n[0]&&n.length>1?1:0;return Xr(n,r,t)},getConflictingClassGroupIds:(e,t)=>{if(t){const t=r[e],a=n[e];return t?a?((e,t)=>{const n=new Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n})(a,t):t:a||Vr}return n[e]||Vr}}},Xr=(e,t,n)=>{if(0===e.length-t)return n.classGroupId;const r=e[t],a=n.nextPart.get(r);if(a){const n=Xr(e,t+1,a);if(n)return n}const o=n.validators;if(null===o)return;const l=0===t?e.join(Hr):e.slice(t).join(Hr),i=o.length;for(let e=0;e<i;e++){const t=o[e];if(t.validator(l))return t.classGroupId}},Yr=e=>-1===e.slice(1,-1).indexOf(":")?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?"arbitrary.."+r:void 0})(),Zr=e=>{const{theme:t,classGroups:n}=e;return Jr(n,t)},Jr=(e,t)=>{const n=Wr();for(const r in e){const a=e[r];$r(a,n,r,t)}return n},$r=(e,t,n,r)=>{const a=e.length;for(let o=0;o<a;o++){const a=e[o];ea(a,t,n,r)}},ea=(e,t,n,r)=>{"string"!=typeof e?"function"!=typeof e?ra(e,t,n,r):na(e,t,n,r):ta(e,t,n)},ta=(e,t,n)=>{(""===e?t:aa(t,e)).classGroupId=n},na=(e,t,n,r)=>{oa(e)?$r(e(r),t,n,r):(null===t.validators&&(t.validators=[]),t.validators.push(((e,t)=>({classGroupId:e,validator:t}))(n,e)))},ra=(e,t,n,r)=>{const a=Object.entries(e),o=a.length;for(let e=0;e<o;e++){const[o,l]=a[e];$r(l,aa(t,o),n,r)}},aa=(e,t)=>{let n=e;const r=t.split(Hr),a=r.length;for(let e=0;e<a;e++){const t=r[e];let a=n.nextPart.get(t);a||(a=Wr(),n.nextPart.set(t,a)),n=a}return n},oa=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,la=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const a=(a,o)=>{n[a]=o,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];return void 0!==t?t:void 0!==(t=r[e])?(a(e,t),t):void 0},set(e,t){e in n?n[e]=t:a(e,t)}}},ia=[],ca=(e,t,n,r,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:a}),sa=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=e=>{const t=[];let n,r=0,a=0,o=0;const l=e.length;for(let i=0;i<l;i++){const l=e[i];if(0===r&&0===a){if(":"===l){t.push(e.slice(o,i)),o=i+1;continue}if("/"===l){n=i;continue}}"["===l?r++:"]"===l?r--:"("===l?a++:")"===l&&a--}const i=0===t.length?e:e.slice(o);let c=i,s=!1;return i.endsWith("!")?(c=i.slice(0,-1),s=!0):i.startsWith("!")&&(c=i.slice(1),s=!0),ca(t,s,c,n&&n>o?n-o:void 0)};if(t){const e=t+":",n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):ca(ia,!1,t,void 0,!0)}if(n){const e=r;r=t=>n({className:t,parseClassName:e})}return r},ua=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{const n=[];let r=[];for(let a=0;a<e.length;a++){const o=e[a],l="["===o[0],i=t.has(o);l||i?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(o)):r.push(o)}return r.length>0&&(r.sort(),n.push(...r)),n}},ma=/\s+/,da=e=>{if("string"==typeof e)return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=da(e[r]))&&(n&&(n+=" "),n+=t);return n},ga=[],pa=e=>{const t=t=>t[e]||ga;return t.isThemeGetter=!0,t},fa=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ya=/^\((?:(\w[\w-]*):)?(.+)\)$/i,ha=/^\d+\/\d+$/,ba=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,va=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,_a=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,wa=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,xa=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ea=e=>ha.test(e),Ca=e=>!!e&&!Number.isNaN(Number(e)),Na=e=>!!e&&Number.isInteger(Number(e)),ka=e=>e.endsWith("%")&&Ca(e.slice(0,-1)),Sa=e=>ba.test(e),Oa=()=>!0,Pa=e=>va.test(e)&&!_a.test(e),ja=()=>!1,Ta=e=>wa.test(e),Ia=e=>xa.test(e),Aa=e=>!La(e)&&!za(e),Da=e=>Ka(e,Ja,ja),La=e=>fa.test(e),Fa=e=>Ka(e,$a,Pa),Ma=e=>Ka(e,eo,Ca),Ra=e=>Ka(e,Ya,ja),Ga=e=>Ka(e,Za,Ia),Ba=e=>Ka(e,no,Ta),za=e=>ya.test(e),Ua=e=>Xa(e,$a),qa=e=>Xa(e,to),Qa=e=>Xa(e,Ya),Wa=e=>Xa(e,Ja),Ha=e=>Xa(e,Za),Va=e=>Xa(e,no,!0),Ka=(e,t,n)=>{const r=fa.exec(e);return!!r&&(r[1]?t(r[1]):n(r[2]))},Xa=(e,t,n=!1)=>{const r=ya.exec(e);return!!r&&(r[1]?t(r[1]):n)},Ya=e=>"position"===e||"percentage"===e,Za=e=>"image"===e||"url"===e,Ja=e=>"length"===e||"size"===e||"bg-size"===e,$a=e=>"length"===e,eo=e=>"number"===e,to=e=>"family-name"===e,no=e=>"shadow"===e,ro=((e,...t)=>{let n,r,a,o;const l=e=>{const t=r(e);if(t)return t;const o=((e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a,sortModifiers:o}=t,l=[],i=e.trim().split(ma);let c="";for(let e=i.length-1;e>=0;e-=1){const t=i[e],{isExternal:s,modifiers:u,hasImportantModifier:m,baseClassName:d,maybePostfixModifierPosition:g}=n(t);if(s){c=t+(c.length>0?" "+c:c);continue}let p=!!g,f=r(p?d.substring(0,g):d);if(!f){if(!p){c=t+(c.length>0?" "+c:c);continue}if(f=r(d),!f){c=t+(c.length>0?" "+c:c);continue}p=!1}const y=0===u.length?"":1===u.length?u[0]:o(u).join(":"),h=m?y+"!":y,b=h+f;if(l.indexOf(b)>-1)continue;l.push(b);const v=a(f,p);for(let e=0;e<v.length;++e){const t=v[e];l.push(h+t)}c=t+(c.length>0?" "+c:c)}return c})(e,n);return a(e,o),o};return o=i=>{const c=t.reduce((e,t)=>t(e),e());return n=(e=>({cache:la(e.cacheSize),parseClassName:sa(e),sortModifiers:ua(e),...Kr(e)}))(c),r=n.cache.get,a=n.cache.set,o=l,l(i)},(...e)=>o(((...e)=>{let t,n,r=0,a="";for(;r<e.length;)(t=e[r++])&&(n=da(t))&&(a&&(a+=" "),a+=n);return a})(...e))})((Symbol.toStringTag,()=>{const e=pa("color"),t=pa("font"),n=pa("text"),r=pa("font-weight"),a=pa("tracking"),o=pa("leading"),l=pa("breakpoint"),i=pa("container"),c=pa("spacing"),s=pa("radius"),u=pa("shadow"),m=pa("inset-shadow"),d=pa("text-shadow"),g=pa("drop-shadow"),p=pa("blur"),f=pa("perspective"),y=pa("aspect"),h=pa("ease"),b=pa("animate"),v=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",za,La],_=()=>[za,La,c],w=()=>[Ea,"full","auto",..._()],x=()=>[Na,"none","subgrid",za,La],E=()=>["auto",{span:["full",Na,za,La]},Na,za,La],C=()=>[Na,"auto",za,La],N=()=>["auto","min","max","fr",za,La],k=()=>["auto",..._()],S=()=>[Ea,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",..._()],O=()=>[e,za,La],P=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Qa,Ra,{position:[za,La]}],j=()=>["auto","cover","contain",Wa,Da,{size:[za,La]}],T=()=>[ka,Ua,Fa],I=()=>["","none","full",s,za,La],A=()=>["",Ca,Ua,Fa],D=()=>[Ca,ka,Qa,Ra],L=()=>["","none",p,za,La],F=()=>["none",Ca,za,La],M=()=>["none",Ca,za,La],R=()=>[Ca,za,La],G=()=>[Ea,"full",..._()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Sa],breakpoint:[Sa],color:[Oa],container:[Sa],"drop-shadow":[Sa],ease:["in","out","in-out"],font:[Aa],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Sa],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Sa],shadow:[Sa],spacing:["px",Ca],text:[Sa],"text-shadow":[Sa],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ea,La,za,y]}],container:["container"],columns:[{columns:[Ca,La,za,i]}],"break-after":[{"break-after":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-before":[{"break-before":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:v()}],overflow:[{overflow:["auto","hidden","clip","visible","scroll"]}],"overflow-x":[{"overflow-x":["auto","hidden","clip","visible","scroll"]}],"overflow-y":[{"overflow-y":["auto","hidden","clip","visible","scroll"]}],overscroll:[{overscroll:["auto","contain","none"]}],"overscroll-x":[{"overscroll-x":["auto","contain","none"]}],"overscroll-y":[{"overscroll-y":["auto","contain","none"]}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:w()}],"inset-x":[{"inset-x":w()}],"inset-y":[{"inset-y":w()}],start:[{start:w()}],end:[{end:w()}],top:[{top:w()}],right:[{right:w()}],bottom:[{bottom:w()}],left:[{left:w()}],visibility:["visible","invisible","collapse"],z:[{z:[Na,"auto",za,La]}],basis:[{basis:[Ea,"full","auto",i,..._()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ca,Ea,"auto","initial","none",La]}],grow:[{grow:["",Ca,za,La]}],shrink:[{shrink:["",Ca,za,La]}],order:[{order:[Na,"first","last","none",za,La]}],"grid-cols":[{"grid-cols":x()}],"col-start-end":[{col:E()}],"col-start":[{"col-start":C()}],"col-end":[{"col-end":C()}],"grid-rows":[{"grid-rows":x()}],"row-start-end":[{row:E()}],"row-start":[{"row-start":C()}],"row-end":[{"row-end":C()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":N()}],"auto-rows":[{"auto-rows":N()}],gap:[{gap:_()}],"gap-x":[{"gap-x":_()}],"gap-y":[{"gap-y":_()}],"justify-content":[{justify:["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe","normal"]}],"justify-items":[{"justify-items":["start","end","center","stretch","center-safe","end-safe","normal"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],"align-content":[{content:["normal","start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"align-items":[{items:["start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"align-self":[{self:["auto","start","end","center","stretch","center-safe","end-safe",{baseline:["","last"]}]}],"place-content":[{"place-content":["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"]}],"place-items":[{"place-items":["start","end","center","stretch","center-safe","end-safe","baseline"]}],"place-self":[{"place-self":["auto","start","end","center","stretch","center-safe","end-safe"]}],p:[{p:_()}],px:[{px:_()}],py:[{py:_()}],ps:[{ps:_()}],pe:[{pe:_()}],pt:[{pt:_()}],pr:[{pr:_()}],pb:[{pb:_()}],pl:[{pl:_()}],m:[{m:k()}],mx:[{mx:k()}],my:[{my:k()}],ms:[{ms:k()}],me:[{me:k()}],mt:[{mt:k()}],mr:[{mr:k()}],mb:[{mb:k()}],ml:[{ml:k()}],"space-x":[{"space-x":_()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":_()}],"space-y-reverse":["space-y-reverse"],size:[{size:S()}],w:[{w:[i,"screen",...S()]}],"min-w":[{"min-w":[i,"screen","none",...S()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[l]},...S()]}],h:[{h:["screen","lh",...S()]}],"min-h":[{"min-h":["screen","lh","none",...S()]}],"max-h":[{"max-h":["screen","lh",...S()]}],"font-size":[{text:["base",n,Ua,Fa]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,za,Ma]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ka,La]}],"font-family":[{font:[qa,La,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,za,La]}],"line-clamp":[{"line-clamp":[Ca,"none",za,Ma]}],leading:[{leading:[o,..._()]}],"list-image":[{"list-image":["none",za,La]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",za,La]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:O()}],"text-color":[{text:O()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{decoration:[Ca,"from-font","auto",za,Fa]}],"text-decoration-color":[{decoration:O()}],"underline-offset":[{"underline-offset":[Ca,"auto",za,La]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:_()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",za,La]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",za,La]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:P()}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","space","round"]}]}],"bg-size":[{bg:j()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Na,za,La],radial:["",za,La],conic:[Na,za,La]},Ha,Ga]}],"bg-color":[{bg:O()}],"gradient-from-pos":[{from:T()}],"gradient-via-pos":[{via:T()}],"gradient-to-pos":[{to:T()}],"gradient-from":[{from:O()}],"gradient-via":[{via:O()}],"gradient-to":[{to:O()}],rounded:[{rounded:I()}],"rounded-s":[{"rounded-s":I()}],"rounded-e":[{"rounded-e":I()}],"rounded-t":[{"rounded-t":I()}],"rounded-r":[{"rounded-r":I()}],"rounded-b":[{"rounded-b":I()}],"rounded-l":[{"rounded-l":I()}],"rounded-ss":[{"rounded-ss":I()}],"rounded-se":[{"rounded-se":I()}],"rounded-ee":[{"rounded-ee":I()}],"rounded-es":[{"rounded-es":I()}],"rounded-tl":[{"rounded-tl":I()}],"rounded-tr":[{"rounded-tr":I()}],"rounded-br":[{"rounded-br":I()}],"rounded-bl":[{"rounded-bl":I()}],"border-w":[{border:A()}],"border-w-x":[{"border-x":A()}],"border-w-y":[{"border-y":A()}],"border-w-s":[{"border-s":A()}],"border-w-e":[{"border-e":A()}],"border-w-t":[{"border-t":A()}],"border-w-r":[{"border-r":A()}],"border-w-b":[{"border-b":A()}],"border-w-l":[{"border-l":A()}],"divide-x":[{"divide-x":A()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":A()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:["solid","dashed","dotted","double","hidden","none"]}],"divide-style":[{divide:["solid","dashed","dotted","double","hidden","none"]}],"border-color":[{border:O()}],"border-color-x":[{"border-x":O()}],"border-color-y":[{"border-y":O()}],"border-color-s":[{"border-s":O()}],"border-color-e":[{"border-e":O()}],"border-color-t":[{"border-t":O()}],"border-color-r":[{"border-r":O()}],"border-color-b":[{"border-b":O()}],"border-color-l":[{"border-l":O()}],"divide-color":[{divide:O()}],"outline-style":[{outline:["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[Ca,za,La]}],"outline-w":[{outline:["",Ca,Ua,Fa]}],"outline-color":[{outline:O()}],shadow:[{shadow:["","none",u,Va,Ba]}],"shadow-color":[{shadow:O()}],"inset-shadow":[{"inset-shadow":["none",m,Va,Ba]}],"inset-shadow-color":[{"inset-shadow":O()}],"ring-w":[{ring:A()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:O()}],"ring-offset-w":[{"ring-offset":[Ca,Fa]}],"ring-offset-color":[{"ring-offset":O()}],"inset-ring-w":[{"inset-ring":A()}],"inset-ring-color":[{"inset-ring":O()}],"text-shadow":[{"text-shadow":["none",d,Va,Ba]}],"text-shadow-color":[{"text-shadow":O()}],opacity:[{opacity:[Ca,za,La]}],"mix-blend":[{"mix-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ca]}],"mask-image-linear-from-pos":[{"mask-linear-from":D()}],"mask-image-linear-to-pos":[{"mask-linear-to":D()}],"mask-image-linear-from-color":[{"mask-linear-from":O()}],"mask-image-linear-to-color":[{"mask-linear-to":O()}],"mask-image-t-from-pos":[{"mask-t-from":D()}],"mask-image-t-to-pos":[{"mask-t-to":D()}],"mask-image-t-from-color":[{"mask-t-from":O()}],"mask-image-t-to-color":[{"mask-t-to":O()}],"mask-image-r-from-pos":[{"mask-r-from":D()}],"mask-image-r-to-pos":[{"mask-r-to":D()}],"mask-image-r-from-color":[{"mask-r-from":O()}],"mask-image-r-to-color":[{"mask-r-to":O()}],"mask-image-b-from-pos":[{"mask-b-from":D()}],"mask-image-b-to-pos":[{"mask-b-to":D()}],"mask-image-b-from-color":[{"mask-b-from":O()}],"mask-image-b-to-color":[{"mask-b-to":O()}],"mask-image-l-from-pos":[{"mask-l-from":D()}],"mask-image-l-to-pos":[{"mask-l-to":D()}],"mask-image-l-from-color":[{"mask-l-from":O()}],"mask-image-l-to-color":[{"mask-l-to":O()}],"mask-image-x-from-pos":[{"mask-x-from":D()}],"mask-image-x-to-pos":[{"mask-x-to":D()}],"mask-image-x-from-color":[{"mask-x-from":O()}],"mask-image-x-to-color":[{"mask-x-to":O()}],"mask-image-y-from-pos":[{"mask-y-from":D()}],"mask-image-y-to-pos":[{"mask-y-to":D()}],"mask-image-y-from-color":[{"mask-y-from":O()}],"mask-image-y-to-color":[{"mask-y-to":O()}],"mask-image-radial":[{"mask-radial":[za,La]}],"mask-image-radial-from-pos":[{"mask-radial-from":D()}],"mask-image-radial-to-pos":[{"mask-radial-to":D()}],"mask-image-radial-from-color":[{"mask-radial-from":O()}],"mask-image-radial-to-color":[{"mask-radial-to":O()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"]}],"mask-image-conic-pos":[{"mask-conic":[Ca]}],"mask-image-conic-from-pos":[{"mask-conic-from":D()}],"mask-image-conic-to-pos":[{"mask-conic-to":D()}],"mask-image-conic-from-color":[{"mask-conic-from":O()}],"mask-image-conic-to-color":[{"mask-conic-to":O()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:P()}],"mask-repeat":[{mask:["no-repeat",{repeat:["","x","y","space","round"]}]}],"mask-size":[{mask:j()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",za,La]}],filter:[{filter:["","none",za,La]}],blur:[{blur:L()}],brightness:[{brightness:[Ca,za,La]}],contrast:[{contrast:[Ca,za,La]}],"drop-shadow":[{"drop-shadow":["","none",g,Va,Ba]}],"drop-shadow-color":[{"drop-shadow":O()}],grayscale:[{grayscale:["",Ca,za,La]}],"hue-rotate":[{"hue-rotate":[Ca,za,La]}],invert:[{invert:["",Ca,za,La]}],saturate:[{saturate:[Ca,za,La]}],sepia:[{sepia:["",Ca,za,La]}],"backdrop-filter":[{"backdrop-filter":["","none",za,La]}],"backdrop-blur":[{"backdrop-blur":L()}],"backdrop-brightness":[{"backdrop-brightness":[Ca,za,La]}],"backdrop-contrast":[{"backdrop-contrast":[Ca,za,La]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ca,za,La]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ca,za,La]}],"backdrop-invert":[{"backdrop-invert":["",Ca,za,La]}],"backdrop-opacity":[{"backdrop-opacity":[Ca,za,La]}],"backdrop-saturate":[{"backdrop-saturate":[Ca,za,La]}],"backdrop-sepia":[{"backdrop-sepia":["",Ca,za,La]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":_()}],"border-spacing-x":[{"border-spacing-x":_()}],"border-spacing-y":[{"border-spacing-y":_()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",za,La]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ca,"initial",za,La]}],ease:[{ease:["linear","initial",h,za,La]}],delay:[{delay:[Ca,za,La]}],animate:[{animate:["none",b,za,La]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[f,za,La]}],"perspective-origin":[{"perspective-origin":v()}],rotate:[{rotate:F()}],"rotate-x":[{"rotate-x":F()}],"rotate-y":[{"rotate-y":F()}],"rotate-z":[{"rotate-z":F()}],scale:[{scale:M()}],"scale-x":[{"scale-x":M()}],"scale-y":[{"scale-y":M()}],"scale-z":[{"scale-z":M()}],"scale-3d":["scale-3d"],skew:[{skew:R()}],"skew-x":[{"skew-x":R()}],"skew-y":[{"skew-y":R()}],transform:[{transform:[za,La,"","none","gpu","cpu"]}],"transform-origin":[{origin:v()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:G()}],"translate-x":[{"translate-x":G()}],"translate-y":[{"translate-y":G()}],"translate-z":[{"translate-z":G()}],"translate-none":["translate-none"],accent:[{accent:O()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:O()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",za,La]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":_()}],"scroll-mx":[{"scroll-mx":_()}],"scroll-my":[{"scroll-my":_()}],"scroll-ms":[{"scroll-ms":_()}],"scroll-me":[{"scroll-me":_()}],"scroll-mt":[{"scroll-mt":_()}],"scroll-mr":[{"scroll-mr":_()}],"scroll-mb":[{"scroll-mb":_()}],"scroll-ml":[{"scroll-ml":_()}],"scroll-p":[{"scroll-p":_()}],"scroll-px":[{"scroll-px":_()}],"scroll-py":[{"scroll-py":_()}],"scroll-ps":[{"scroll-ps":_()}],"scroll-pe":[{"scroll-pe":_()}],"scroll-pt":[{"scroll-pt":_()}],"scroll-pr":[{"scroll-pr":_()}],"scroll-pb":[{"scroll-pb":_()}],"scroll-pl":[{"scroll-pl":_()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",za,La]}],fill:[{fill:["none",...O()]}],"stroke-w":[{stroke:[Ca,Ua,Fa,Ma]}],stroke:[{stroke:["none",...O()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}}));function ao(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return ro(function(){for(var e,t,n=0,r="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=Qr(e))&&(r&&(r+=" "),r+=t);return r}(t))}const oo=function(e){var t=e.size,n=void 0===t?"lg":t,r=e.color,a=void 0===r?"green":r,o=e.className,l=void 0===o?"":o,i=e.text,c=e.centerInContainer,s=void 0===c||c,u=ee().createElement("div",{className:"flex flex-col items-center gap-2"},ee().createElement("div",{className:ao("animate-spin rounded-full border-b-2",{sm:"h-4 w-4",md:"h-8 w-8",lg:"h-16 w-16",xl:"h-32 w-32"}[n],{green:"border-green-600",blue:"border-blue-600",gray:"border-gray-600",red:"border-red-600"}[a],l)}),i&&ee().createElement("div",{className:"text-sm text-gray-600 font-medium"},i));return s?ee().createElement("div",{className:ao("flex items-center justify-center",{sm:"h-16",md:"h-32",lg:"h-48",xl:"h-64"}[n])},u):u},lo=function(){return(0,ge.useSelect)(function(e){return{isPageLoading:e(Br).getPageLoading()}},[]).isPageLoading?ee().createElement("div",{className:"fixed inset-0 bg-white bg-opacity-75 flex items-center justify-center z-50"},ee().createElement(oo,{size:"lg",color:"green",text:(0,pe.__)("Loading...","nggallery"),centerInContainer:!1})):null};var io=function(e){var t=e.className;return ee().createElement("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor"},ee().createElement("path",{d:"M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"}))},co=function(e){var t=e.className;return ee().createElement("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor"},ee().createElement("path",{d:"M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zm0-2.163c-3.259 0-3.667.014-4.947.072-4.358.2-6.78 2.618-6.98 6.98-.059 1.281-.073 1.689-.073 4.948 0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98 1.281.058 1.689.072 4.948.072 3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98-1.281-.059-1.69-.073-4.949-.073zm0 5.838c-3.403 0-6.162 2.759-6.162 6.162s2.759 6.163 6.162 6.163 6.162-2.759 6.162-6.163c0-3.403-2.759-6.162-6.162-6.162zm0 10.162c-2.209 0-4-1.79-4-4 0-2.209 1.791-4 4-4s4 1.791 4 4c0 2.21-1.791 4-4 4zm6.406-11.845c-.796 0-1.441.645-1.441 1.44s.645 1.44 1.441 1.44c.795 0 1.439-.645 1.439-1.44s-.644-1.44-1.439-1.44z"}))},so=function(e){var t=e.className;return ee().createElement("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor"},ee().createElement("path",{d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"}))},uo=function(e){var t=e.className;return ee().createElement("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor"},ee().createElement("path",{d:"M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z"}))},mo=function(e){var t=e.className;return ee().createElement("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor"},ee().createElement("path",{d:"M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"}))},go=function(e){var t=e.className;return ee().createElement("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor"},ee().createElement("path",{d:"M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"}))};const po=function(){var e,t,n,r=(null===(e=window.imagelyApp)||void 0===e?void 0:e.version)||"",a=(null===(t=window.imagelyApp)||void 0===t?void 0:t.utmVersion)||"",o="lite"===(null===(n=window.imagelyApp)||void 0===n?void 0:n.proTypeInstalled);return ee().createElement("footer",{className:"mt-8"},ee().createElement("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-2"},ee().createElement("div",{className:"text-center mb-4"},ee().createElement("p",{className:"text-gray-600 flex items-center justify-center gap-2"},(0,pe.__)("Made with","nggallery"),ee().createElement(mo,{className:"w-4 h-4 text-red-500"}),(0,pe.__)("by the Imagely Team","nggallery"))),ee().createElement("div",{className:"flex items-center justify-center gap-4 mb-4 text-sm"},ee().createElement("a",{href:o?"https://wordpress.org/support/plugin/nextgen-gallery/":"https://www.imagely.com/account/support/?utm_source=imagely&utm_medium=wpfooter&utm_campaign=support".concat(a?"&utm_content="+encodeURIComponent(a):""),target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700 hover:underline"},(0,pe.__)("Support","nggallery")),ee().createElement("span",{className:"text-gray-400"},"/"),ee().createElement("a",{href:"https://www.imagely.com/docs?utm_source=imagely&utm_medium=wpfooter&utm_campaign=docs".concat(a?"&utm_content="+encodeURIComponent(a):""),target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700 hover:underline"},(0,pe.__)("Docs","nggallery")),ee().createElement("span",{className:"text-gray-400"},"/"),ee().createElement("a",{href:"admin.php?page=imagely-about-us",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700 hover:underline"},(0,pe.__)("Free Plugins","nggallery"))),ee().createElement("div",{className:"flex items-center justify-center gap-4 mb-4"},ee().createElement("a",{href:"https://www.facebook.com/imagely",target:"_blank",rel:"noopener noreferrer",className:"text-gray-400 hover:text-blue-600 transition-colors","aria-label":"Facebook"},ee().createElement(io,{className:"w-5 h-5"})),ee().createElement("a",{href:"https://www.instagram.com/imagely/",target:"_blank",rel:"noopener noreferrer",className:"text-gray-400 hover:text-pink-600 transition-colors","aria-label":"Instagram"},ee().createElement(co,{className:"w-5 h-5"})),ee().createElement("a",{href:"https://twitter.com/imagely",target:"_blank",rel:"noopener noreferrer",className:"text-gray-400 hover:text-gray-900 transition-colors","aria-label":"X (Twitter)"},ee().createElement(so,{className:"w-5 h-5"})),ee().createElement("a",{href:"https://www.youtube.com/c/Imagely",target:"_blank",rel:"noopener noreferrer",className:"text-gray-400 hover:text-red-600 transition-colors","aria-label":"YouTube"},ee().createElement(uo,{className:"w-5 h-5"}))),ee().createElement("div",{className:"text-center text-sm text-gray-600 mb-4"},ee().createElement("p",{className:"flex items-center justify-center gap-2 flex-wrap"},(0,pe.__)("Please rate Imagely","nggallery"),ee().createElement("span",{className:"flex items-center text-yellow-500"},ee().createElement(go,{className:"w-4 h-4"}),ee().createElement(go,{className:"w-4 h-4"}),ee().createElement(go,{className:"w-4 h-4"}),ee().createElement(go,{className:"w-4 h-4"}),ee().createElement(go,{className:"w-4 h-4"})),ee().createElement("span",null,(0,pe.__)("on","nggallery")," ",ee().createElement("a",{href:"https://wordpress.org/support/plugin/nextgen-gallery/reviews/?filter=5#new-post",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700 hover:underline"},"WordPress.org")," ",(0,pe.__)("to help us spread the word. Thank you from the Imagely team!","nggallery")))),r&&ee().createElement("div",{className:"text-center text-xs text-gray-500"},(0,pe.__)("Version","nggallery")," ",r)))},fo=function(){var e=(0,ge.useDispatch)(),t=(0,ge.useSelect)(function(e){return e(Br).getInboxActiveCount()},[]),n=(0,ge.useSelect)(function(e){return e(Br).getInboxIsOpen()},[]);return(0,$.useEffect)(function(){e(Br).fetchInboxNotifications()},[e]),ee().createElement("button",{type:"button",onClick:function(){n?e(Br).closeInboxPanel():e(Br).openInboxPanel()},className:"relative p-1 sm:p-1.5 rounded-full text-gray-500 hover:text-gray-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500","aria-label":"Notifications"},ee().createElement(nn,{className:"h-5 w-5",width:"20",height:"20",viewBox:"0 0 15 16"}),t>0&&ee().createElement("span",{className:"absolute -top-0.5 -right-0.5 inline-flex items-center justify-center px-1.5 py-0.5 text-xs font-bold leading-none text-white transform translate-x-1/4 -translate-y-1/4 bg-red-500 rounded-full min-w-[18px]"},t>99?"99+":t))},yo=function(){var e,t,n,r="lite"===(null===(e=window.imagelyApp)||void 0===e?void 0:e.proTypeInstalled),a=(null===(t=window.imagelyApp)||void 0===t?void 0:t.utmVersion)||"",o=React.createElement(React.Fragment,null,React.createElement("div",{className:"flex-shrink-0"},React.createElement("img",{className:"h-10 w-auto",src:(null===(n=window.imagelyApp)||void 0===n?void 0:n.assetsURL)+"/images/logo-icon.png",title:"Imagely",alt:"Imagely Logo"})),React.createElement("h1",{className:"ml-3 text-xl font-semibold text-gray-900"},"IMAGELY"));return React.createElement("header",{className:"bg-white shadow-sm h-[64px]"},React.createElement("div",{className:"w-full px-4 sm:px-6 lg:px-8 xl:px-12 2xl:px-16"},React.createElement("div",{className:"flex items-center justify-between h-16"},React.createElement("div",{className:"flex items-center"},r?React.createElement("a",{href:"https://www.imagely.com/lite/?utm_source=imagely&utm_medium=wpheader&utm_campaign=logo".concat(a?"&utm_content="+encodeURIComponent(a):""),target:"_blank",rel:"noopener noreferrer",className:"flex items-center hover:opacity-80 transition-opacity"},o):React.createElement("div",{className:"flex items-center"},o)),React.createElement("div",{className:"flex items-center space-x-4"},React.createElement(fo,null),React.createElement("button",{type:"button",className:"p-1 rounded-full text-gray-500 hover:text-gray-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500",onClick:function(){var e=r?"https://wordpress.org/support/plugin/nextgen-gallery/":"https://www.imagely.com/account/support/?utm_source=imagely&utm_medium=wpheader&utm_campaign=support".concat(a?"&utm_content="+encodeURIComponent(a):"");window.open(e,"_blank")}},React.createElement("span",{className:"sr-only"},(0,pe.__)("View help","nggallery")),React.createElement(tn,{className:"h-6 w-6"}))))))};function ho(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function bo(e,t){if(e){if("string"==typeof e)return ho(e,t);var n={}.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)?ho(e,t):void 0}}function vo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,l,i=[],c=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,a=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw a}}return i}}(e,t)||bo(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var _o="imagely_lite_banner_dismissed";const wo=function(){var e,t,n=vo((0,$.useState)(!1),2),r=n[0],a=n[1],o="lite"===(null===(e=window.imagelyApp)||void 0===e?void 0:e.proTypeInstalled),l=(null===(t=window.imagelyApp)||void 0===t?void 0:t.utmVersion)||"";return(0,$.useEffect)(function(){if(o){var e=localStorage.getItem(_o);if(e){var t=JSON.parse(e).timestamp;if((Date.now()-t)/864e5<30)return void a(!1)}a(!0)}else a(!1)},[o]),r?ee().createElement("div",{className:"bg-green-500 text-white px-4 py-3 relative flex items-center justify-center"},ee().createElement("div",{className:"flex items-center gap-2 text-center pr-8 sm:pr-10"},ee().createElement("svg",{className:"w-5 h-5 flex-shrink-0",fill:"currentColor",viewBox:"0 0 20 20"},ee().createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})),ee().createElement("span",{className:"text-sm sm:text-base break-words"},(0,pe.__)("You're using","nggallery")," ",ee().createElement("strong",{className:"font-bold"},(0,pe.__)("Imagely Lite","nggallery")),(0,pe.__)(".","nggallery")," ",(0,pe.__)("To unlock all features in Imagely, consider","nggallery")," ",ee().createElement("a",{href:"https://www.imagely.com/lite/?utm_source=imagely&utm_medium=litebanner&utm_campaign=upgradetopro".concat(l?"&utm_content="+encodeURIComponent(l):""),target:"_blank",rel:"noopener noreferrer",className:"underline font-semibold hover:opacity-90 transition-opacity"},(0,pe.__)("Upgrading to PRO","nggallery")),".")),ee().createElement("button",{onClick:function(){var e={timestamp:Date.now()};localStorage.setItem(_o,JSON.stringify(e)),a(!1)},className:"absolute right-1 sm:right-2 top-1/2 -translate-y-1/2 p-1.5 sm:p-1 hover:bg-green-600 rounded transition-colors min-w-[32px] min-h-[32px] flex items-center justify-center","aria-label":(0,pe.__)("Dismiss banner","nggallery")},ee().createElement("svg",{className:"w-4 h-4 sm:w-5 sm:h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},ee().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})))):null};var xo=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=(0,$.useRef)(null);return(0,$.useEffect)(function(){if(t){var r=function(t){var r=null==n?void 0:n.current;r&&!r.contains((null==t?void 0:t.target)||null)&&e(t)};return document.addEventListener("mousedown",r),document.addEventListener("touchstart",r),function(){document.removeEventListener("mousedown",r),document.removeEventListener("touchstart",r)}}},[n,e,t]),n};const Eo=function(e){var t=e.isOpen,n=e.onClose,r=e.title,a=void 0===r?"":r,o=e.children,l=e.id,i=e.showHeader,c=void 0===i||i,s=e.contentClassName,u=void 0===s?"":s,m=e.modalClassName,d=void 0===m?"rounded-lg":m,g=xo(function(){return n()},t);return(0,$.useEffect)(function(){var e=function(e){"Escape"===e.key&&t&&n()};return window.addEventListener("keydown",e),function(){window.removeEventListener("keydown",e)}},[t,n]),(0,$.useEffect)(function(){return document.body.style.overflow=t?"hidden":"unset",function(){document.body.style.overflow="unset"}},[t]),t?ee().createElement("div",{className:"fixed inset-0 z-50 overflow-y-auto","aria-labelledby":"modal-title",role:"dialog","aria-modal":"true",id:l},ee().createElement("div",{className:"fixed inset-0 bg-gray-500 bg-opacity-20 transition-opacity duration-300 ease-in-out"}),ee().createElement("div",{className:"flex min-h-screen items-center justify-center p-2 text-center sm:p-0"},ee().createElement("div",{ref:g,className:ao("relative transform overflow-hidden bg-white text-left shadow-xl transition-all duration-300 ease-in-out w-full max-w-lg sm:my-8 sm:w-full sm:max-w-lg",d)},c&&ee().createElement("div",{className:ao("flex justify-between items-center p-3 sm:p-4",a&&"border-b")},ee().createElement("h2",{className:"text-base sm:text-lg font-medium text-gray-900 pr-2",id:"modal-title"},a),ee().createElement("button",{onClick:n,className:"text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-green-500 focus:ring-offset-2 flex-shrink-0","aria-label":"Close modal"},ee().createElement(on,{className:"h-6 w-6"}))),ee().createElement("div",{className:ao("p-3 sm:p-4",u)},o)))):null};function Co(e,t,n,r,a,o,l){try{var i=e[o](l),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,a)}function No(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function l(e){Co(o,r,a,l,i,"next",e)}function i(e){Co(o,r,a,l,i,"throw",e)}l(void 0)})}}function ko(e){return function(e){if(Array.isArray(e))return ho(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||bo(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.")}()}const So=window.wp.apiFetch;var Oo=l.n(So);function Po(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return jo(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(jo(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,jo(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,jo(m,"constructor",s),jo(s,"constructor",c),c.displayName="GeneratorFunction",jo(s,a,"GeneratorFunction"),jo(m),jo(m,a,"Generator"),jo(m,r,function(){return this}),jo(m,"toString",function(){return"[object Generator]"}),(Po=function(){return{w:o,m:d}})()}function jo(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}jo=function(e,t,n,r){function o(t,n){jo(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},jo(e,t,n,r)}function To(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Io(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?To(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):To(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var Ao=function(){var e,t,n=window;return(null===(e=n.wpApiSettings)||void 0===e?void 0:e.nonce)||(null===(t=n.imagelyApp)||void 0===t?void 0:t.nonce)||""},Do=function(){return{"X-WP-Nonce":Ao(),"Content-Type":"application/json"}},Lo=function(){var e=No(Po().m(function e(t){var n,r,a,o,l,i,c,s,u,m,d,g,p,f,y=arguments;return Po().w(function(e){for(;;)switch(e.n){case 0:return r=(n=y.length>1&&void 0!==y[1]?y[1]:{}).method,a=void 0===r?"GET":r,o=n.data,l=n.headers,i=void 0===l?{}:l,e.n=1,Oo()({path:t,method:a,headers:Io(Io({},Do()),i),data:o,parse:!1});case 1:if(c=e.v,s=parseInt(c.headers.get("X-WP-Total")||"0",10),u=parseInt(c.headers.get("X-WP-TotalPages")||"1",10),204!==c.status&&205!==c.status){e.n=2;break}m=null,e.n=7;break;case 2:if(d=c.headers.get("content-type"),!(g=c.headers.get("content-length"))||0!==parseInt(g)){e.n=3;break}m=null,e.n=7;break;case 3:if(d&&d.includes("application/json")){e.n=5;break}return e.n=4,c.text();case 4:p=e.v,m=p||null,e.n=7;break;case 5:return e.n=6,c.text();case 6:if((f=e.v)&&""!==f.trim())try{m=JSON.parse(f)}catch(e){console.warn("Failed to parse response as JSON:",f,e),m=f}else m=null;case 7:return e.a(2,{data:m,headers:{total:s,totalPages:u}})}},e)}));return function(t){return e.apply(this,arguments)}}(),Fo=function(e){return function(){var t=No(Po().m(function t(n,r){return Po().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,Oo()({path:"/imagely/v1/images/".concat(n,"/").concat(e),method:"POST",headers:Do(),data:r});case 1:return t.a(2,t.v)}},t)}));return function(e,n){return t.apply(this,arguments)}}()},Mo=function(e){return function(){var t=No(Po().m(function t(n){return Po().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,Oo()({path:"/imagely/v1/images/".concat(e),method:"POST",headers:Do(),data:n});case 1:return t.a(2,t.v)}},t)}));return function(e){return t.apply(this,arguments)}}()};function Ro(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return Go(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Go(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Go(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,Go(m,"constructor",s),Go(s,"constructor",c),c.displayName="GeneratorFunction",Go(s,a,"GeneratorFunction"),Go(m),Go(m,a,"Generator"),Go(m,r,function(){return this}),Go(m,"toString",function(){return"[object Generator]"}),(Ro=function(){return{w:o,m:d}})()}function Go(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}Go=function(e,t,n,r){function o(t,n){Go(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Go(e,t,n,r)}function Bo(e){return zo.apply(this,arguments)}function zo(){return(zo=No(Ro().m(function e(t){var n,r,a,o;return Ro().w(function(e){for(;;)switch(e.p=e.n){case 0:if(n=t.trim()){e.n=1;break}return e.a(2,!1);case 1:return e.p=1,r=Ao(),e.n=2,Oo()({path:"/nggpro/v1/video/is-hosted-video",method:"POST",headers:{"X-WP-Nonce":r,"Content-Type":"application/json"},data:{video_link:n}});case 2:return a=e.v,e.a(2,!0===a.is_hosted_video);case 3:return e.p=3,o=e.v,console.warn("Failed to check if video is hosted:",o),e.a(2,!1)}},e,null,[[1,3]])}))).apply(this,arguments)}var Uo=function(){var e=vo((0,$.useState)(!1),2),t=e[0],n=e[1];return function(e){(0,$.useEffect)(function(){if(e){var t=function(e){var t=e.target;(t.closest(".media-modal")||t.closest(".media-frame")||t.closest(".media-modal-backdrop")||t.closest(".wp-core-ui"))&&(e.stopPropagation(),e.stopImmediatePropagation())};return document.addEventListener("mousedown",t,!0),document.addEventListener("touchstart",t,!0),function(){document.removeEventListener("mousedown",t,!0),document.removeEventListener("touchstart",t,!0)}}},[e])}(t),{isMediaLibraryOpen:t,openMediaFrame:(0,$.useCallback)(function(e,t){var r=e.title,a=void 0===r?(0,pe.__)("Select Image","nggallery"):r,o=e.buttonText,l=void 0===o?(0,pe.__)("Use this image","nggallery"):o,i=e.libraryType,c=void 0===i?"image":i,s=e.onSelect;t&&(t.stopPropagation(),t.preventDefault()),n(!0);var u=window.wp.media({title:a,button:{text:l},multiple:!1,library:{type:c}});u.on("select",function(){var e,t=u.state().get("selection").first(),n=(e=t?t.toJSON():null)&&(e.url||e.source_url||e.link)||"";n&&(s(n),u.close())}),u.on("open",function(){n(!0)}),u.on("close",function(){setTimeout(function(){n(!1)},100)}),u.open()},[])}};function qo(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Qo=["thumbnailFile"];function Wo(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ho(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return Vo(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Vo(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Vo(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,Vo(m,"constructor",s),Vo(s,"constructor",c),c.displayName="GeneratorFunction",Vo(s,a,"GeneratorFunction"),Vo(m),Vo(m,a,"Generator"),Vo(m,r,function(){return this}),Vo(m,"toString",function(){return"[object Generator]"}),(Ho=function(){return{w:o,m:d}})()}function Vo(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}Vo=function(e,t,n,r){function o(t,n){Vo(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Vo(e,t,n,r)}function Ko(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Xo(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ko(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ko(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Yo(e){var n=function(e){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=t(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==t(n)?n:n+""}const Zo=function(e){var t=e.galleryId,r=e.galleryTitle,a=e.buttonLabel,o=e.onSuccess,l=e.onGalleryCreated,i=vo((0,$.useState)([{id:Date.now().toString(),videoLink:"",thumbnailImageLink:""}]),2),c=i[0],s=i[1],u=vo((0,$.useState)([]),2),m=u[0],d=u[1],g=vo((0,$.useState)(!1),2),p=g[0],f=g[1],y=vo((0,$.useState)({}),2),h=y[0],b=y[1],v=(0,$.useRef)({}),_=(0,$.useRef)(new Set),w=(0,$.useRef)({}),x=Uo().openMediaFrame;(0,$.useEffect)(function(){return function(){_.current.forEach(function(e){URL.revokeObjectURL(e)}),_.current.clear(),Object.values(w.current).forEach(function(e){clearTimeout(e)}),w.current={}}},[]);var E=function(e,t,r){s(function(a){return a.map(function(a){return a.id===e?"thumbnailImageLink"===t&&r&&!r.startsWith("blob:")?(a.thumbnailFile,Xo(Xo({},ye(a,Qo)),{},n({},t,r))):Xo(Xo({},a),{},n({},t,r)):a})}),d([]),"videoLink"===t&&(w.current[e]&&clearTimeout(w.current[e]),w.current[e]=setTimeout(No(Ho().m(function t(){var a,o,l,i,c,s;return Ho().w(function(t){for(;;)switch(t.p=t.n){case 0:if(a=r.trim()){t.n=1;break}return b(function(t){return t[e],ye(t,[e].map(Yo))}),(o=w.current)[e],l=ye(o,[e].map(Yo)),w.current=l,t.a(2);case 1:return t.p=1,t.n=2,Bo(a);case 2:i=t.v,b(function(t){return Xo(Xo({},t),{},n({},e,i))}),t.n=4;break;case 3:t.p=3,t.v,b(function(t){return t[e],ye(t,[e].map(Yo))});case 4:(c=w.current)[e],s=ye(c,[e].map(Yo)),w.current=s;case 5:return t.a(2)}},t,null,[[1,3]])})),500))},C=function(){var e=No(Ho().m(function e(t,n){var r;return Ho().w(function(e){for(;;)switch(e.n){case 0:if(n.type.startsWith("image/")){e.n=1;break}return d([(0,pe.__)("Please select a valid image file.","nggallery")]),e.a(2);case 1:r=URL.createObjectURL(n),_.current.add(r),s(function(e){return e.map(function(e){return e.id===t?Xo(Xo({},e),{},{thumbnailFile:n,thumbnailImageLink:r}):e})}),d([]);case 2:return e.a(2)}},e)}));return function(t,n){return e.apply(this,arguments)}}(),N=function(){var e=function(e){var t,n=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return qo(e,t);var n={}.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)?qo(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,l=!0,i=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return l=e.done,e},e:function(e){i=!0,o=e},f:function(){try{l||null==n.return||n.return()}finally{if(i)throw o}}}}(e);try{for(n.s();!(t=n.n()).done;)if(!t.value.videoLink.trim())return(0,pe.__)("Video Link is required","nggallery")}catch(e){n.e(e)}finally{n.f()}return""}(c);if(e)return d([e]),!1;var t,n=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return Wo(e,t);var n={}.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)?Wo(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,l=!0,i=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return l=e.done,e},e:function(e){i=!0,o=e},f:function(){try{l||null==n.return||n.return()}finally{if(i)throw o}}}}(c);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(h[r.id]&&!r.thumbnailImageLink.trim()&&!r.thumbnailFile)return d([(0,pe.__)("Thumbnail image link is required if specifying a local video URL. Please provide a thumbnail for all local video URLs.","nggallery")]),!1}}catch(e){n.e(e)}finally{n.f()}return d([]),!0},k=function(){var e=No(Ho().m(function e(){var n,a,i,s,u;return Ho().w(function(e){for(;;)switch(e.p=e.n){case 0:if(N()){e.n=1;break}return e.a(2);case 1:if(t||r.trim()){e.n=2;break}return d([(0,pe.__)("Please provide a gallery title.","nggallery")]),e.a(2);case 2:return f(!0),d([]),e.p=3,n=c.filter(function(e){return e.videoLink.trim()||e.thumbnailImageLink.trim()}),a=new FormData,t?a.append("gallery_id",t.toString()):r.trim()&&a.append("gallery_title",r.trim()),n.forEach(function(e,t){a.append("video_links[".concat(t,"][videoLink]"),e.videoLink.trim());var n=e.thumbnailImageLink.startsWith("blob:")?"":e.thumbnailImageLink.trim();a.append("video_links[".concat(t,"][thumbnailImageLink]"),n),e.thumbnailFile&&a.append("video_links[".concat(t,"][thumbnailFileInput]"),e.thumbnailFile)}),e.n=4,Oo()({path:Ur,method:"POST",headers:{"X-WP-Nonce":Ao()},body:a});case 4:if(!(i=e.v).error){e.n=5;break}throw new Error(i.error);case 5:if(!(i.errors&&i.errors.length>0)){e.n=6;break}throw new Error(i.errors.join(", "));case 6:if(i.gallery_id){e.n=7;break}throw new Error((0,pe.__)("No gallery ID returned from the API.","nggallery"));case 7:o&&o(i.gallery_id),null==l||l(i.gallery_id),e.n=9;break;case 8:e.p=8,u=e.v,s=(null==u?void 0:u.errors)||[(0,pe.__)("Failed to create gallery with video links. Please try again.","nggallery")],d(s);case 9:return e.p=9,f(!1),e.f(9);case 10:return e.a(2)}},e,null,[[3,8,9,10]])}));return function(){return e.apply(this,arguments)}}(),S=c.some(function(e){return e.videoLink.trim()});return ee().createElement("div",{className:"flex flex-col h-full","data-testid":"video-links-form"},ee().createElement("div",{className:"flex-1 min-h-0 overflow-hidden flex flex-col"},ee().createElement("div",{className:"space-y-4 mb-4"},c.map(function(e){return ee().createElement("div",{key:e.id,className:"p-3 sm:p-4 border border-gray-300 rounded-lg bg-white","data-testid":"video-link-item-".concat(e.id)},ee().createElement("div",{className:"space-y-3"},ee().createElement("div",null,ee().createElement("div",{className:"flex items-center justify-between mb-1.5"},ee().createElement("label",{htmlFor:"video-link-".concat(e.id),className:"block text-sm font-medium text-gray-700"},(0,pe.__)("Video Link","nggallery")),c.length>1&&ee().createElement("button",{onClick:function(){return function(e){if(c.length>1){if(s(function(t){return t.filter(function(t){return t.id!==e})}),d([]),w.current[e]){clearTimeout(w.current[e]);var t=w.current,n=(t[e],ye(t,[e].map(Yo)));w.current=n}b(function(t){return t[e],ye(t,[e].map(Yo))})}}(e.id)},className:"text-red-500 hover:text-red-600 transition-colors p-1",title:(0,pe.__)("Remove video","nggallery"),"data-testid":"remove-video-link-".concat(e.id)},ee().createElement(xn,{className:"w-4 h-4 sm:w-5 sm:h-5"}))),ee().createElement("input",{type:"text",id:"video-link-".concat(e.id),name:"video-link-".concat(e.id),value:e.videoLink,onChange:function(t){return E(e.id,"videoLink",t.target.value)},placeholder:(0,pe.__)("Enter video URL","nggallery"),className:"bg-white border text-gray-900 text-sm rounded-lg focus:ring-green-500 focus:border-green-500 block w-full p-2.5 hover:border-green-500 border-gray-400 transition-colors","data-testid":"video-link-input-".concat(e.id)})),ee().createElement("div",null,ee().createElement("label",{htmlFor:"thumbnail-image-link-".concat(e.id),className:"block text-sm font-medium text-gray-700 mb-1.5"},(0,pe.__)("Thumbnail Image Link","nggallery")),ee().createElement("input",{type:"text",id:"thumbnail-image-link-".concat(e.id),name:"thumbnail-image-link-".concat(e.id),value:e.thumbnailImageLink.startsWith("blob:")?"":e.thumbnailImageLink,onChange:function(t){return E(e.id,"thumbnailImageLink",t.target.value)},placeholder:(0,pe.__)("Enter thumbnail image URL or select from media library","nggallery"),className:"bg-white border text-gray-900 text-sm rounded-lg focus:ring-green-500 focus:border-green-500 block w-full p-2.5 hover:border-green-500 border-gray-400 transition-colors mb-2",disabled:!!e.thumbnailFile||p,"data-testid":"thumbnail-link-input-".concat(e.id)}),ee().createElement("input",{ref:function(t){v.current[e.id]=t},type:"file",accept:"image/*",onChange:function(t){return function(e,t){var n=t.target.files;n&&n.length>0&&C(e,n[0]),t.target&&(t.target.value="")}(e.id,t)},className:"hidden",disabled:p}),ee().createElement("div",{className:"flex gap-4 items-start"},ee().createElement("div",{className:"flex flex-col gap-2"},ee().createElement("button",{type:"button",onClick:function(){return t=e.id,void((n=v.current[t])&&n.click());var t,n},disabled:p,className:"px-4 py-2.5 bg-gray-100 hover:bg-gray-200 border border-gray-300 rounded-lg transition-colors flex items-center justify-center gap-2 text-gray-700 hover:text-gray-900 disabled:opacity-50 disabled:cursor-not-allowed",title:(0,pe.__)("Upload from computer","nggallery"),"data-testid":"file-upload-".concat(e.id)},ee().createElement(or,{className:"w-5 h-5 flex-shrink-0"}),ee().createElement("span",{className:"text-sm font-medium"},(0,pe.__)("Select File","nggallery"))),ee().createElement("button",{type:"button",onClick:function(t){return function(e,t){x({title:(0,pe.__)("Select Cover Image","nggallery"),buttonText:(0,pe.__)("Use this image","nggallery"),onSelect:function(t){E(e,"thumbnailImageLink",t)}},t)}(e.id,t)},disabled:p,className:"px-4 py-2.5 bg-gray-100 hover:bg-gray-200 border border-gray-300 rounded-lg transition-colors flex items-center justify-center gap-2 text-gray-700 hover:text-gray-900 disabled:opacity-50 disabled:cursor-not-allowed",title:(0,pe.__)("Select from Media Library","nggallery"),"data-testid":"upload-thumbnail-".concat(e.id)},ee().createElement(Cn,{className:"w-5 h-5 flex-shrink-0"}),ee().createElement("span",{className:"text-sm font-medium"},(0,pe.__)("Upload","nggallery"))),e.thumbnailFile&&ee().createElement("div",{className:"text-xs text-gray-600"},(0,pe.__)("File selected:","nggallery")," ",e.thumbnailFile.name)),e.thumbnailImageLink.trim()&&ee().createElement("div",{className:"flex-1 flex justify-end"},ee().createElement("div",{className:"relative w-32 h-24 sm:w-40 sm:h-32"},ee().createElement("img",{src:e.thumbnailImageLink,alt:(0,pe.__)("Thumbnail preview","nggallery"),className:"w-full h-full object-cover border border-gray-300 rounded-lg",onError:function(e){e.target.style.display="none"}})))))))})),ee().createElement("div",{className:"mb-4"},ee().createElement("button",{onClick:function(){s(function(e){return[].concat(ko(e),[{id:Date.now().toString()+Math.random().toString(),videoLink:"",thumbnailImageLink:""}])}),d([])},className:"w-full py-2 px-4 text-sm sm:text-base border border-gray-300 rounded-lg hover:bg-gray-50 transition-colors text-gray-700 font-medium","data-testid":"add-video-link-button"},(0,pe.__)("Add Video","nggallery"))),m.length>0&&ee().createElement("div",{className:"text-red-500 text-xs sm:text-sm p-2 mb-4 bg-red-50 border border-red-200 rounded-lg",role:"alert"},m.map(function(e,t){return ee().createElement("p",{key:t,className:"whitespace-pre-line"},e)})),ee().createElement("div",{className:"mt-auto"},ee().createElement("button",{onClick:k,disabled:p,className:"w-full py-2 sm:py-3 px-3 sm:px-4 text-white rounded-lg transition-colors text-sm sm:text-base ".concat(p||!S?"bg-green-300 cursor-not-allowed":"bg-green-500 hover:bg-green-600"),"data-testid":"video-links-submit"},p?(0,pe.__)("Creating...","nggallery"):(0,pe.__)(a||"Create Gallery","nggallery")))))};function Jo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function $o(){var e=(0,ge.useDispatch)(Br),t=(0,ge.useSelect)(function(e){return e(Br).getNotifications()},[]),r=(0,$.useCallback)(function(t,n,r){e.showNotice(t,n,r)},[e]),a=(0,$.useCallback)(function(t){e.dismissNotice(t)},[e]),o=(0,$.useCallback)(function(){e.clearAllNotices()},[e]),l=(0,$.useCallback)(function(t,n){e.showNotice("success",t,n)},[e]),i=(0,$.useCallback)(function(t,r){e.showNotice("error",t,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Jo(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Jo(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({duration:0},r))},[e]),c={onSuccess:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,pe.__)("Changes saved successfully!","nggallery");e.showNotice("success",t)},onError:function(t,n){var r,a=n||(0,pe.__)("An error occurred. Please try again.","nggallery");null!=t&&t.message?a=t.message:null!=t&&null!==(r=t.data)&&void 0!==r&&r.message?a=t.data.message:"string"==typeof t&&(a=t),e.showNotice("error",a)}};return{notifications:t,showNotification:r,dismissNotification:a,clearNotifications:o,showSuccess:l,showError:i,showWarning:(0,$.useCallback)(function(t,n){e.showNotice("warning",t,n)},[e]),showInfo:(0,$.useCallback)(function(t,n){e.showNotice("info",t,n)},[e]),mutationCallbacks:c}}var el=class extends T{constructor(e,t){super(),this.options=t,this.#u=e,this.#S=null,this.#O=D(),this.bindMethods(),this.setOptions(t)}#u;#P=void 0;#j=void 0;#T=void 0;#I;#A;#O;#S;#D;#L;#F;#M;#R;#G;#B=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#P.addObserver(this),tl(this.#P,this.options)?this.#z():this.updateResult(),this.#U())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return nl(this.#P,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return nl(this.#P,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#q(),this.#Q(),this.#P.removeObserver(this)}setOptions(e){const t=this.options,n=this.#P;if(this.options=this.#u.defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof m(this.options.enabled,this.#P))throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#W(),this.#P.setOptions(this.options),t._defaulted&&!v(this.options,t)&&this.#u.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#P,observer:this});const r=this.hasListeners();r&&rl(this.#P,n,this.options,t)&&this.#z(),this.updateResult(),!r||this.#P===n&&m(this.options.enabled,this.#P)===m(t.enabled,this.#P)&&u(this.options.staleTime,this.#P)===u(t.staleTime,this.#P)||this.#H();const a=this.#V();!r||this.#P===n&&m(this.options.enabled,this.#P)===m(t.enabled,this.#P)&&a===this.#G||this.#K(a)}getOptimisticResult(e){const t=this.#u.getQueryCache().build(this.#u,e),n=this.createResult(t,e);return r=n,!v(this.getCurrentResult(),r)&&(this.#T=n,this.#A=this.options,this.#I=this.#P.state),n;var r}getCurrentResult(){return this.#T}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),"promise"===n&&(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==this.#O.status||this.#O.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(e,n))})}trackProp(e){this.#B.add(e)}getCurrentQuery(){return this.#P}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#u.defaultQueryOptions(e),n=this.#u.getQueryCache().build(this.#u,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#z({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#T))}#z(e){this.#W();let t=this.#P.fetch(this.options,e);return e?.throwOnError||(t=t.catch(i)),t}#H(){this.#q();const e=u(this.options.staleTime,this.#P);if(o||this.#T.isStale||!c(e))return;const t=s(this.#T.dataUpdatedAt,e)+1;this.#M=a.setTimeout(()=>{this.#T.isStale||this.updateResult()},t)}#V(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#P):this.options.refetchInterval)??!1}#K(e){this.#Q(),this.#G=e,!o&&!1!==m(this.options.enabled,this.#P)&&c(this.#G)&&0!==this.#G&&(this.#R=a.setInterval(()=>{(this.options.refetchIntervalInBackground||I.isFocused())&&this.#z()},this.#G))}#U(){this.#H(),this.#K(this.#V())}#q(){this.#M&&(a.clearTimeout(this.#M),this.#M=void 0)}#Q(){this.#R&&(a.clearInterval(this.#R),this.#R=void 0)}createResult(e,t){const n=this.#P,r=this.options,a=this.#T,o=this.#I,l=this.#A,i=e!==n?e.state:this.#j,{state:c}=e;let s,u={...c},d=!1;if(t._optimisticResults){const a=this.hasListeners(),o=!a&&tl(e,t),l=a&&rl(e,n,t,r);(o||l)&&(u={...u,...z(c.data,e.options)}),"isRestoring"===t._optimisticResults&&(u.fetchStatus="idle")}let{error:g,errorUpdatedAt:p,status:f}=u;s=u.data;let y=!1;if(void 0!==t.placeholderData&&void 0===s&&"pending"===f){let e;a?.isPlaceholderData&&t.placeholderData===l?.placeholderData?(e=a.data,y=!0):e="function"==typeof t.placeholderData?t.placeholderData(this.#F?.state.data,this.#F):t.placeholderData,void 0!==e&&(f="success",s=E(a?.data,e,t),d=!0)}if(t.select&&void 0!==s&&!y)if(a&&s===o?.data&&t.select===this.#D)s=this.#L;else try{this.#D=t.select,s=t.select(s),s=E(a?.data,s,t),this.#L=s,this.#S=null}catch(e){this.#S=e}this.#S&&(g=this.#S,s=this.#L,p=Date.now(),f="error");const h="fetching"===u.fetchStatus,b="pending"===f,v="error"===f,_=b&&h,w=void 0!==s,x={status:f,fetchStatus:u.fetchStatus,isPending:b,isSuccess:"success"===f,isError:v,isInitialLoading:_,isLoading:_,data:s,dataUpdatedAt:u.dataUpdatedAt,error:g,errorUpdatedAt:p,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:u.dataUpdateCount>0||u.errorUpdateCount>0,isFetchedAfterMount:u.dataUpdateCount>i.dataUpdateCount||u.errorUpdateCount>i.errorUpdateCount,isFetching:h,isRefetching:h&&!b,isLoadingError:v&&!w,isPaused:"paused"===u.fetchStatus,isPlaceholderData:d,isRefetchError:v&&w,isStale:al(e,t),refetch:this.refetch,promise:this.#O,isEnabled:!1!==m(t.enabled,e)};if(this.options.experimental_prefetchInRender){const t=e=>{"error"===x.status?e.reject(x.error):void 0!==x.data&&e.resolve(x.data)},r=()=>{const e=this.#O=x.promise=D();t(e)},a=this.#O;switch(a.status){case"pending":e.queryHash===n.queryHash&&t(a);break;case"fulfilled":"error"!==x.status&&x.data===a.value||r();break;case"rejected":"error"===x.status&&x.error===a.reason||r()}}return x}updateResult(){const e=this.#T,t=this.createResult(this.#P,this.options);this.#I=this.#P.state,this.#A=this.options,void 0!==this.#I.data&&(this.#F=this.#P),v(t,e)||(this.#T=t,this.#X({listeners:(()=>{if(!e)return!0;const{notifyOnChangeProps:t}=this.options,n="function"==typeof t?t():t;if("all"===n||!n&&!this.#B.size)return!0;const r=new Set(n??this.#B);return this.options.throwOnError&&r.add("error"),Object.keys(this.#T).some(t=>{const n=t;return this.#T[n]!==e[n]&&r.has(n)})})()}))}#W(){const e=this.#u.getQueryCache().build(this.#u,this.options);if(e===this.#P)return;const t=this.#P;this.#P=e,this.#j=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#U()}#X(e){j.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#T)}),this.#u.getQueryCache().notify({query:this.#P,type:"observerResultsUpdated"})})}};function tl(e,t){return function(e,t){return!1!==m(t.enabled,e)&&void 0===e.state.data&&!("error"===e.state.status&&!1===t.retryOnMount)}(e,t)||void 0!==e.state.data&&nl(e,t,t.refetchOnMount)}function nl(e,t,n){if(!1!==m(t.enabled,e)&&"static"!==u(t.staleTime,e)){const r="function"==typeof n?n(e):n;return"always"===r||!1!==r&&al(e,t)}return!1}function rl(e,t,n,r){return(e!==t||!1===m(r.enabled,e))&&(!n.suspense||"error"!==e.state.status)&&al(e,n)}function al(e,t){return!1!==m(t.enabled,e)&&e.isStaleByTime(u(t.staleTime,e))}var ol=$.createContext(function(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}()),ll=$.createContext(!1),il=(ll.Provider,(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()}));function cl(e,t,n){const r=$.useContext(ll),a=$.useContext(ol),l=re(n),c=l.defaultQueryOptions(e);l.getDefaultOptions().queries?._experimental_beforeQuery?.(c),c._optimisticResults=r?"isRestoring":"optimistic",(e=>{if(e.suspense){const t=1e3,n=e=>"static"===e?e:Math.max(e??t,t),r=e.staleTime;e.staleTime="function"==typeof r?(...e)=>n(r(...e)):n(r),"number"==typeof e.gcTime&&(e.gcTime=Math.max(e.gcTime,t))}})(c),((e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))})(c,a),(e=>{$.useEffect(()=>{e.clearReset()},[e])})(a);const s=!l.getQueryCache().get(c.queryHash),[u]=$.useState(()=>new t(l,c)),m=u.getOptimisticResult(c),d=!r&&!1!==e.subscribed;if($.useSyncExternalStore($.useCallback(e=>{const t=d?u.subscribe(j.batchCalls(e)):i;return u.updateResult(),t},[u,d]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),$.useEffect(()=>{u.setOptions(c)},[c,u]),((e,t)=>e?.suspense&&t.isPending)(c,m))throw il(c,u,a);if((({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:a})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(a&&void 0===e.data||O(n,[e.error,r])))({result:m,errorResetBoundary:a,throwOnError:c.throwOnError,query:l.getQueryCache().get(c.queryHash),suspense:c.suspense}))throw m.error;if(l.getDefaultOptions().queries?._experimental_afterQuery?.(c,m),c.experimental_prefetchInRender&&!o&&((e,t)=>e.isLoading&&e.isFetching&&!t)(m,r)){const e=s?il(c,u,a):l.getQueryCache().get(c.queryHash)?.promise;e?.catch(i).finally(()=>{u.updateResult()})}return c.notifyOnChangeProps?m:u.trackResult(m)}function sl(e,t){return cl(e,el,t)}var ul=class extends el{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:K()})}getOptimisticResult(e){return e.behavior=K(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){const{state:n}=e,r=super.createResult(e,t),{isFetching:a,isRefetching:o,isError:l,isRefetchError:i}=r,c=n.fetchMeta?.fetchMore?.direction,s=l&&"forward"===c,u=a&&"forward"===c,m=l&&"backward"===c,d=a&&"backward"===c;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Z(t,n.data),hasPreviousPage:J(t,n.data),isFetchNextPageError:s,isFetchingNextPage:u,isFetchPreviousPageError:m,isFetchingPreviousPage:d,isRefetchError:i&&!s&&!m,isRefetching:o&&!u&&!d}}};function ml(e,t){return cl(e,ul,t)}var dl=class extends T{#u;#T=void 0;#Y;#Z;constructor(e,t){super(),this.#u=e,this.setOptions(t),this.bindMethods(),this.#J()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){const t=this.options;this.options=this.#u.defaultMutationOptions(e),v(this.options,t)||this.#u.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#Y,observer:this}),t?.mutationKey&&this.options.mutationKey&&f(t.mutationKey)!==f(this.options.mutationKey)?this.reset():"pending"===this.#Y?.state.status&&this.#Y.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#Y?.removeObserver(this)}onMutationUpdate(e){this.#J(),this.#X(e)}getCurrentResult(){return this.#T}reset(){this.#Y?.removeObserver(this),this.#Y=void 0,this.#J(),this.#X()}mutate(e,t){return this.#Z=t,this.#Y?.removeObserver(this),this.#Y=this.#u.getMutationCache().build(this.#u,this.options),this.#Y.addObserver(this),this.#Y.execute(e)}#J(){const e=this.#Y?.state??{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0};this.#T={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#X(e){j.batch(()=>{if(this.#Z&&this.hasListeners()){const t=this.#T.variables,n=this.#T.context,r={client:this.#u,meta:this.options.meta,mutationKey:this.options.mutationKey};"success"===e?.type?(this.#Z.onSuccess?.(e.data,t,n,r),this.#Z.onSettled?.(e.data,null,t,n,r)):"error"===e?.type&&(this.#Z.onError?.(e.error,t,n,r),this.#Z.onSettled?.(void 0,e.error,t,n,r))}this.listeners.forEach(e=>{e(this.#T)})})}};function gl(e,t){const n=re(t),[r]=$.useState(()=>new dl(n,e));$.useEffect(()=>{r.setOptions(e)},[r,e]);const a=$.useSyncExternalStore($.useCallback(e=>r.subscribe(j.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),o=$.useCallback((e,t)=>{r.mutate(e,t).catch(i)},[r]);if(a.error&&O(r.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:o,mutateAsync:a.mutate}}var pl=["pid"];function fl(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return yl(e,t);var n={}.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)?yl(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,l=!0,i=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return l=e.done,e},e:function(e){i=!0,o=e},f:function(){try{l||null==n.return||n.return()}finally{if(i)throw o}}}}function yl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function hl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function bl(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?hl(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):hl(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function vl(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return _l(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(_l(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,_l(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,_l(m,"constructor",s),_l(s,"constructor",c),c.displayName="GeneratorFunction",_l(s,a,"GeneratorFunction"),_l(m),_l(m,a,"Generator"),_l(m,r,function(){return this}),_l(m,"toString",function(){return"[object Generator]"}),(vl=function(){return{w:o,m:d}})()}function _l(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}_l=function(e,t,n,r){function o(t,n){_l(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},_l(e,t,n,r)}var wl=function(e){return["gallery",e]},xl=function(e){return["gallery",e,"images"]},El=function(e){if(!e)return!1;var t=e.external_source||{};return!(!t.tiktok_account&&"tiktok"!==t.type)},Cl=function(e){if(!e)return!1;var t=e.external_source||{};return!(!t.dribbble_account&&"dribbble"!==t.type)},Nl=function(e){return El(e)||Cl(e)},kl=function(e){var t,n=ee().useMemo(function(){return wl(null!=e?e:0)},[e]),r=re().getQueryState(n),a="error"===(null==r?void 0:r.status);return sl({queryKey:n,queryFn:(t=No(vl().m(function t(){return vl().w(function(t){for(;;)switch(t.n){case 0:if(e){t.n=1;break}throw new Error("Gallery ID is required");case 1:return t.n=2,Oo()({path:"/imagely/v1/galleries/".concat(e),method:"GET",headers:Do()});case 2:return t.a(2,t.v)}},t)})),function(){return t.apply(this,arguments)}),enabled:!!e&&!a,staleTime:12e4,gcTime:6e5,retry:0,throwOnError:!1})},Sl=function(e){var t,n=new URLSearchParams;return null!=e&&e.get_all?n.append("per_page","-1"):(null!=e&&e.page&&n.append("page",e.page.toString()),null!=e&&e.per_page&&n.append("per_page",e.per_page.toString())),null!=e&&e.search&&n.append("search",e.search),null!=e&&e.sort&&n.append("orderby",e.sort),null!=e&&e.order&&n.append("order",e.order),sl({queryKey:["galleries",e],queryFn:(t=No(vl().m(function t(){var r,a,o,l,i,c,s,u;return vl().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,r="/imagely/v1/galleries".concat(n.toString()?"?".concat(n.toString()):""),t.n=1,Lo(r);case 1:return a=t.v,o=a.data,l=a.headers,i=(null==e?void 0:e.page)||1,c=null!=e&&e.get_all?l.total:(null==e?void 0:e.per_page)||20,s={galleries:o,pagination:{total:l.total,total_pages:l.totalPages,per_page:c,current_page:i}},t.a(2,s);case 2:throw t.p=2,u=t.v,console.error("Failed to fetch galleries:",u),u;case 3:return t.a(2)}},t,null,[[0,2]])})),function(){return t.apply(this,arguments)}),staleTime:3e4,gcTime:6e5,retry:0,throwOnError:!1,refetchOnWindowFocus:!0,refetchOnMount:!1,placeholderData:function(e){return e}})};function Ol(){var e,t,n=re();return gl({mutationFn:(t=No(vl().m(function e(t){var n,r,a,o;return vl().w(function(e){for(;;)switch(e.n){case 0:return n=t.id,r=t.data,a=bl({},r),e.n=1,Oo()({path:"/imagely/v1/galleries/".concat(n),method:"PUT",headers:Do(),data:a});case 1:return o=e.v,e.a(2,o)}},e)})),function(e){return t.apply(this,arguments)}),onMutate:(e=No(vl().m(function e(t){var r,a,o;return vl().w(function(e){for(;;)switch(e.n){case 0:return r=t.id,a=t.data,e.n=1,n.cancelQueries({queryKey:wl(r)});case 1:return(o=n.getQueryData(wl(r)))&&n.setQueryData(wl(r),bl(bl({},o),a)),e.a(2,{previousGallery:o})}},e)})),function(t){return e.apply(this,arguments)}),onError:function(e,t,r){var a=t.id;null!=r&&r.previousGallery&&n.setQueryData(wl(a),r.previousGallery)},onSettled:function(e,t,r){var a=r.id;n.invalidateQueries({queryKey:wl(a)}),n.invalidateQueries({queryKey:["galleries"]})}})}var Pl=function(e,n){var r,a=n||{},o=a.per_page,l=void 0===o?-1:o,i=a.page,c=void 0===i?1:i,s=a.enabled,u=void 0===s||s,m=sl({queryKey:ee().useMemo(function(){return[].concat(ko(xl(e)),[l,c])},[e,l,c]),queryFn:(r=No(vl().m(function n(){var r,a,o,i,s,u;return vl().w(function(n){for(;;)switch(n.n){case 0:return r=new URLSearchParams({gallery_id:e.toString(),per_page:l.toString(),page:c.toString(),orderby:"sortorder",order:"ASC"}),n.n=1,Lo("/imagely/v1/images?".concat(r.toString()));case 1:return a=n.v,o=a.data,i=a.headers,s=Array.isArray(o)?o:o&&"object"===t(o)&&"images"in o&&o.images||[],u=ko(s).sort(function(e,t){return e.sortorder-t.sortorder}).map(function(e){return bl(bl({},e),{},{reloadKey:e.updated_at})}),n.a(2,{images:u,pagination:{total:i.total,total_pages:i.totalPages,per_page:-1===l?i.total:l,current_page:c}})}},n)})),function(){return r.apply(this,arguments)}),enabled:!!e&&u,staleTime:6e4,gcTime:6e5,retry:0,throwOnError:!1});return m},jl=function(){var e,t,n=re();return gl({mutationFn:(t=No(vl().m(function e(t){var n;return vl().w(function(e){for(;;)switch(e.n){case 0:return n=bl(bl({},t),{},{is_ecommerce_enabled:t.is_ecommerce_enabled,is_private:void 0!==t.is_private?t.is_private?1:0:void 0}),e.n=1,Oo()({path:"/imagely/v1/galleries",method:"POST",headers:Do(),data:n});case 1:return e.a(2,e.v)}},e)})),function(e){return t.apply(this,arguments)}),onMutate:(e=No(vl().m(function e(t){var r;return vl().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,n.cancelQueries({queryKey:["galleries"]});case 1:return r=n.getQueriesData({queryKey:["galleries"]}),n.setQueriesData({queryKey:["galleries"]},function(e){if(null!=e&&e.galleries){var n={id:Date.now(),galleryTitle:t.title||t.name||"New Gallery",thumbnail:"",shortcode:'[ngg id="'.concat(Date.now(),'"]'),count:0,eCommerce:"1"===t.is_ecommerce_enabled,is_private:t.is_private||!1,created:(new Date).toLocaleDateString(),modified:(new Date).toLocaleDateString()};return bl(bl({},e),{},{galleries:[n].concat(ko(e.galleries)),pagination:bl(bl({},e.pagination),{},{total:e.pagination.total+1})})}return e}),e.a(2,{previousGalleries:r})}},e)})),function(t){return e.apply(this,arguments)}),onError:function(e,t,r){null!=r&&r.previousGalleries&&r.previousGalleries.forEach(function(e){var t=vo(e,2),r=t[0],a=t[1];n.setQueryData(r,a)})},onSuccess:function(e){n.setQueriesData({queryKey:["galleries"]},function(t){return null!=t&&t.galleries?bl(bl({},t),{},{galleries:t.galleries.map(function(t){return t.id===e.gid||t.galleryTitle===e.title?{id:e.gid,galleryTitle:e.title,thumbnail:e.previewpic_url||"",shortcode:'[ngg id="'.concat(e.gid,'"]'),count:0,eCommerce:"1"===e.is_ecommerce_enabled,is_private:e.is_private,created:e.date_created,modified:e.date_modified}:t})}):t})},onSettled:function(){n.invalidateQueries({queryKey:["galleries"]})}})},Tl=function(){var e,t,n=re();return gl({mutationFn:(t=No(vl().m(function e(t){var n,r,a;return vl().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,Oo()({path:"/imagely/v1/galleries/".concat(t),method:"DELETE",headers:Do()});case 1:e.n=4;break;case 2:if(e.p=2,404!==(null==(a=e.v)?void 0:a.status)&&404!==(null==a||null===(n=a.data)||void 0===n?void 0:n.status)&&404!==(null==a||null===(r=a.response)||void 0===r?void 0:r.status)){e.n=3;break}return console.warn("Gallery ".concat(t," already deleted or doesn't exist")),e.a(2);case 3:throw console.error("Error deleting gallery ".concat(t,":"),a),a;case 4:return e.a(2)}},e,null,[[0,2]])})),function(e){return t.apply(this,arguments)}),onMutate:(e=No(vl().m(function e(t){var r;return vl().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,n.cancelQueries({queryKey:["galleries"]});case 1:return r=n.getQueriesData({queryKey:["galleries"]}),n.setQueriesData({queryKey:["galleries"]},function(e){return null!=e&&e.galleries?bl(bl({},e),{},{galleries:e.galleries.filter(function(e){return e.id!==t}),pagination:bl(bl({},e.pagination),{},{total:Math.max(0,e.pagination.total-1)})}):e}),e.a(2,{previousGalleries:r})}},e)})),function(t){return e.apply(this,arguments)}),onError:function(e,t,r){var a;404!==(null==e?void 0:e.status)&&404!==(null==e||null===(a=e.response)||void 0===a?void 0:a.status)&&null!=r&&r.previousGalleries&&r.previousGalleries.forEach(function(e){var t=vo(e,2),r=t[0],a=t[1];n.setQueryData(r,a)})},onSettled:function(e,t){var r;(!t||404!==(null==t?void 0:t.status)&&404!==(null==t||null===(r=t.response)||void 0===r?void 0:r.status))&&n.invalidateQueries({queryKey:["galleries"]})}})},Il=function(){var e,t=re();return gl({mutationFn:(e=No(vl().m(function e(t){var n;return vl().w(function(e){for(;;)switch(e.n){case 0:return n=t.images,e.n=1,Oo()({path:"/imagely/v1/images/bulk",method:"PUT",headers:Do(),data:{images:n}});case 1:return e.a(2,e.v)}},e)})),function(t){return e.apply(this,arguments)}),onSettled:function(){t.invalidateQueries({queryKey:["gallery"]})}})},Al=function(){var e=No(vl().m(function e(t){var n,r;return vl().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,Oo()({path:"/imagely/v1/images?gallery_id=".concat(t,"&per_page=999999"),method:"GET",headers:Do()});case 1:return n=e.v,e.a(2,Array.isArray(n)?n.map(function(e){return e.pid}):[]);case 2:throw e.p=2,r=e.v,console.error("Error fetching image IDs for gallery ".concat(t,":"),r),new Error("Failed to fetch image IDs for gallery ".concat(t,": ").concat(r instanceof Error?r.message:String(r)));case 3:return e.a(2)}},e,null,[[0,2]])}));return function(t){return e.apply(this,arguments)}}(),Dl=function(){var e=No(vl().m(function e(t){var n,r,a,o,l,i,c;return vl().w(function(e){for(;;)switch(e.p=e.n){case 0:n=[],r=fl(t),e.p=1,r.s();case 2:if((a=r.n()).done){e.n=7;break}return o=a.value,e.p=3,e.n=4,Al(o);case 4:l=e.v,n.push.apply(n,ko(l)),e.n=6;break;case 5:e.p=5,i=e.v,console.error("Error fetching images for gallery ".concat(o,":"),i);case 6:e.n=2;break;case 7:e.n=9;break;case 8:e.p=8,c=e.v,r.e(c);case 9:return e.p=9,r.f(),e.f(9);case 10:return e.a(2,n)}},e,null,[[3,5],[1,8,9,10]])}));return function(t){return e.apply(this,arguments)}}(),Ll=function(){return gl({mutationFn:(e=No(vl().m(function e(t){var n,r,a;return vl().w(function(e){for(;;)switch(e.n){case 0:return n=t.pid,r=t.rotation,a=Fo("rotate"),e.n=1,a(n,{rotation:r});case 1:return e.a(2,e.v)}},e)})),function(t){return e.apply(this,arguments)})});var e},Fl=function(){return gl({mutationFn:(e=No(vl().m(function e(t){var n;return vl().w(function(e){for(;;)switch(e.n){case 0:return n=Fo("recover"),e.n=1,n(t);case 1:return e.a(2,e.v)}},e)})),function(t){return e.apply(this,arguments)})});var e},Ml=function(e,t){return sl({queryKey:["tiktok-preview-errors",e],queryFn:(n=No(vl().m(function t(){return vl().w(function(t){for(;;)switch(t.n){case 0:if(e){t.n=1;break}return t.a(2,{has_errors:!1});case 1:return t.n=2,Oo()({path:"/nggpro/v1/tiktok/galleries/".concat(e,"/preview-errors"),method:"GET",headers:Do()});case 2:return t.a(2,t.v)}},t)})),function(){return n.apply(this,arguments)}),enabled:!!e&&t,staleTime:0,retry:0,throwOnError:!1});var n},Rl=function(e,t){var n,r=re(),a=$o(),o=a.showSuccess,l=a.showError;return gl({mutationFn:(n=No(vl().m(function n(){return vl().w(function(n){for(;;)switch(n.n){case 0:if(e&&t){n.n=1;break}throw new Error("Gallery ID and integration type are required");case 1:return n.n=2,Oo()({path:"/nggpro/v1/".concat(t,"/galleries/").concat(e,"/refresh-cache"),method:"POST",headers:Do()});case 2:return n.a(2,n.v)}},n)})),function(){return n.apply(this,arguments)}),onSuccess:function(){e&&(r.invalidateQueries({queryKey:wl(e)}),r.invalidateQueries({queryKey:["galleries"]}),"tiktok"===t&&(r.invalidateQueries({queryKey:["tiktok-sync-status",e]}),r.invalidateQueries({queryKey:["tiktok-preview-errors",e]}))),o((0,pe.__)("Cache refreshed successfully.","nggallery"))},onError:function(e){var t,n=(null==e?void 0:e.message)||(null==e||null===(t=e.data)||void 0===t?void 0:t.message)||(0,pe.__)("Failed to refresh cache. Please try again.","nggallery");l(n)}})};function Gl(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return Bl(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Bl(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Bl(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,Bl(m,"constructor",s),Bl(s,"constructor",c),c.displayName="GeneratorFunction",Bl(s,a,"GeneratorFunction"),Bl(m),Bl(m,a,"Generator"),Bl(m,r,function(){return this}),Bl(m,"toString",function(){return"[object Generator]"}),(Gl=function(){return{w:o,m:d}})()}function Bl(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}Bl=function(e,t,n,r){function o(t,n){Bl(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Bl(e,t,n,r)}function zl(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return Ul(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Ul(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Ul(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,Ul(m,"constructor",s),Ul(s,"constructor",c),c.displayName="GeneratorFunction",Ul(s,a,"GeneratorFunction"),Ul(m),Ul(m,a,"Generator"),Ul(m,r,function(){return this}),Ul(m,"toString",function(){return"[object Generator]"}),(zl=function(){return{w:o,m:d}})()}function Ul(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}Ul=function(e,t,n,r){function o(t,n){Ul(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Ul(e,t,n,r)}var ql=function(e){return["album",e]},Ql=function(e){var t,n=ee().useMemo(function(){return ql(e)},[e]),r=re().getQueryState(n),a="error"===(null==r?void 0:r.status);return sl({queryKey:n,queryFn:(t=No(zl().m(function t(){var n,r;return zl().w(function(t){for(;;)switch(t.n){case 0:return r=null===(n=window.imagelyApp)||void 0===n?void 0:n.nonce,t.n=1,Oo()({path:"/imagely/v1/albums/".concat(e),method:"GET",headers:{"X-WP-Nonce":r}});case 1:return t.a(2,t.v)}},t)})),function(){return t.apply(this,arguments)}),enabled:!!e&&!a,staleTime:12e4,gcTime:6e5,retry:0,throwOnError:!1,refetchOnWindowFocus:!1})},Wl=function(e){var t,n=new URLSearchParams;return null!=e&&e.get_all?n.append("per_page","-1"):(null!=e&&e.page&&n.append("page",e.page.toString()),null!=e&&e.per_page&&n.append("per_page",e.per_page.toString())),null!=e&&e.search&&n.append("search",e.search),null!=e&&e.sort&&n.append("orderby",e.sort),null!=e&&e.order&&n.append("order",e.order),sl({queryKey:["albums",e],queryFn:(t=No(zl().m(function t(){var r,a,o,l,i,c,s;return zl().w(function(t){for(;;)switch(t.n){case 0:return r="/imagely/v1/albums".concat(n.toString()?"?".concat(n.toString()):""),t.n=1,Lo(r);case 1:return a=t.v,o=a.data,l=a.headers,i=(null==e?void 0:e.page)||1,c=null!=e&&e.get_all?l.total:(null==e?void 0:e.per_page)||20,s={albums:o,pagination:{total:l.total,total_pages:l.totalPages,per_page:c,current_page:i}},t.a(2,s)}},t)})),function(){return t.apply(this,arguments)}),staleTime:3e4,gcTime:6e5,retry:0,throwOnError:!1,refetchOnWindowFocus:!0,refetchOnMount:!1,placeholderData:function(e){return e}})},Hl=function(){var e,t=re();return gl({mutationFn:(e=No(zl().m(function e(t){var n,r,a,o,l;return zl().w(function(e){for(;;)switch(e.n){case 0:return r=t.id,a=t.data,o=null===(n=window.imagelyApp)||void 0===n?void 0:n.nonce,e.n=1,Oo()({path:"/imagely/v1/albums/".concat(r),method:"PUT",headers:{"X-WP-Nonce":o,"Content-Type":"application/json"},data:a});case 1:return l=e.v,e.a(2,l.album)}},e)})),function(t){return e.apply(this,arguments)}),onSuccess:function(e,n){var r=n.id;t.setQueryData(ql(r),e),t.invalidateQueries({queryKey:["albums"]})}})},Vl=(0,$.createContext)({isEmbed:!1}),Kl=function(){return(0,$.useContext)(Vl)},Xl=["isOpen","onClose","onAlbumCreated"];function Yl(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return Zl(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Zl(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Zl(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,Zl(m,"constructor",s),Zl(s,"constructor",c),c.displayName="GeneratorFunction",Zl(s,a,"GeneratorFunction"),Zl(m),Zl(m,a,"Generator"),Zl(m,r,function(){return this}),Zl(m,"toString",function(){return"[object Generator]"}),(Yl=function(){return{w:o,m:d}})()}function Zl(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}Zl=function(e,t,n,r){function o(t,n){Zl(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Zl(e,t,n,r)}function Jl(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return $l(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):($l(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,$l(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,$l(m,"constructor",s),$l(s,"constructor",c),c.displayName="GeneratorFunction",$l(s,a,"GeneratorFunction"),$l(m),$l(m,a,"Generator"),$l(m,r,function(){return this}),$l(m,"toString",function(){return"[object Generator]"}),(Jl=function(){return{w:o,m:d}})()}function $l(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}$l=function(e,t,n,r){function o(t,n){$l(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},$l(e,t,n,r)}const ei=function(e){var t=e.current,n=e.total,r=e.label,a=e.showPercentage,o=void 0===a||a,l=n>0?Math.round(t/n*100):0;return ee().createElement("div",{className:"w-full"},r&&ee().createElement("div",{className:"flex justify-between items-center mb-2"},ee().createElement("span",{className:"text-sm font-medium text-gray-700"},r),o&&ee().createElement("span",{className:"text-sm text-gray-500"},t," / ",n," (",l,"%)")),ee().createElement("div",{className:"w-full bg-gray-200 rounded-full h-2.5 overflow-hidden"},ee().createElement("div",{className:"bg-green-600 h-2.5 rounded-full transition-all duration-300 ease-out",style:{width:"".concat(l,"%")}})))};function ti(e,t){return null==e?t:ni(e)}function ni(e){return"boolean"==typeof e?e:"string"==typeof e?"1"===e||"true"===e:"number"==typeof e&&1===e}function ri(e){return e?"1":"0"}function ai(e){if(!e||"object"!==t(e))return e;if(Array.isArray(e))return e.map(function(e){return ai(e)});for(var n={},r=0,a=Object.entries(e);r<a.length;r++){var o=vo(a[r],2),l=o[0],i=o[1];"boolean"==typeof i?n[l]=ri(i):i&&"object"===t(i)?n[l]=ai(i):n[l]=i}return n}var oi=new Set(["animate_images_delay","animate_images_duration","animate_pagination_delay","animate_pagination_duration","alttext_font_size","aspect_ratio","border_size","caption_height","description_font_size","frame_size","gallery_height","height","image_max_height","image_quality","image_spacing","images_per_page","images_to_display_at_start","images_to_load_on_scroll","image_padding","interval","limit","margins","maximum_gallery_width","maximum_image_width","minimum_relevance","number","number_of_columns","padding","row_height","size","slideshow_speed","spacing","thumbnail_height","thumbnail_width","transition_speed","width"]);function li(e){return oi.has(e)}function ii(e){if(!e||"object"!==t(e))return e;if(Array.isArray(e))return e.map(function(e){return ii(e)});for(var n={},r=0,a=Object.entries(e);r<a.length;r++){var o=vo(a[r],2),l=o[0],i=o[1];"string"!=typeof i||"1"!==i&&"0"!==i||li(l)?i&&"object"===t(i)?n[l]=ii(i):n[l]=i:n[l]=ni(i)}return n}function ci(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function si(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ci(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ci(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function ui(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return mi(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(mi(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,mi(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,mi(m,"constructor",s),mi(s,"constructor",c),c.displayName="GeneratorFunction",mi(s,a,"GeneratorFunction"),mi(m),mi(m,a,"Generator"),mi(m,r,function(){return this}),mi(m,"toString",function(){return"[object Generator]"}),(ui=function(){return{w:o,m:d}})()}function mi(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}mi=function(e,t,n,r){function o(t,n){mi(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},mi(e,t,n,r)}var di={pluginSettings:["settings","plugin"],rolesCapabilities:["settings","roles"]},gi=function(){return sl({queryKey:di.pluginSettings,queryFn:(e=No(ui().m(function e(){var t,n;return ui().w(function(e){for(;;)switch(e.n){case 0:return n=null===(t=window.imagelyApp)||void 0===t?void 0:t.nonce,e.n=1,Oo()({path:"/imagely/v1/settings",method:"GET",headers:{"X-WP-Nonce":n}});case 1:return e.a(2,e.v)}},e)})),function(){return e.apply(this,arguments)}),staleTime:3e5,gcTime:6e5});var e},pi=function(){var e,t,n=re();return gl({mutationFn:(t=No(ui().m(function e(t){var n,r,a;return ui().w(function(e){for(;;)switch(e.n){case 0:return r=null===(n=window.imagelyApp)||void 0===n?void 0:n.nonce,a=ai(t),e.n=1,Oo()({path:"/imagely/v1/settings",method:"PUT",headers:{"X-WP-Nonce":r,"Content-Type":"application/json"},data:a});case 1:return e.a(2)}},e)})),function(e){return t.apply(this,arguments)}),onMutate:(e=No(ui().m(function e(t){var r;return ui().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,n.cancelQueries({queryKey:di.pluginSettings});case 1:return r=n.getQueryData(di.pluginSettings),n.setQueryData(di.pluginSettings,function(e){return e?si(si({},e),t):void 0}),e.a(2,{previousSettings:r})}},e)})),function(t){return e.apply(this,arguments)}),onError:function(e,t,r){null!=r&&r.previousSettings&&n.setQueryData(di.pluginSettings,r.previousSettings)},onSettled:function(){n.invalidateQueries({queryKey:di.pluginSettings})}})};function fi(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return yi(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(yi(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,yi(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,yi(m,"constructor",s),yi(s,"constructor",c),c.displayName="GeneratorFunction",yi(s,a,"GeneratorFunction"),yi(m),yi(m,a,"Generator"),yi(m,r,function(){return this}),yi(m,"toString",function(){return"[object Generator]"}),(fi=function(){return{w:o,m:d}})()}function yi(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}yi=function(e,t,n,r){function o(t,n){yi(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},yi(e,t,n,r)}function hi(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return bi(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(bi(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,bi(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,bi(m,"constructor",s),bi(s,"constructor",c),c.displayName="GeneratorFunction",bi(s,a,"GeneratorFunction"),bi(m),bi(m,a,"Generator"),bi(m,r,function(){return this}),bi(m,"toString",function(){return"[object Generator]"}),(hi=function(){return{w:o,m:d}})()}function bi(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}bi=function(e,t,n,r){function o(t,n){bi(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},bi(e,t,n,r)}function vi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?vi(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):vi(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function wi(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return xi(e,t);var n={}.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)?xi(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,l=!0,i=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return l=e.done,e},e:function(e){i=!0,o=e},f:function(){try{l||null==n.return||n.return()}finally{if(i)throw o}}}}function xi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ei(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return Ci(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Ci(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Ci(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,Ci(m,"constructor",s),Ci(s,"constructor",c),c.displayName="GeneratorFunction",Ci(s,a,"GeneratorFunction"),Ci(m),Ci(m,a,"Generator"),Ci(m,r,function(){return this}),Ci(m,"toString",function(){return"[object Generator]"}),(Ei=function(){return{w:o,m:d}})()}function Ci(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}Ci=function(e,t,n,r){function o(t,n){Ci(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Ci(e,t,n,r)}function Ni(e){var t,n=null!==(t=null==e?void 0:e.ID)&&void 0!==t?t:null==e?void 0:e.id,r=(null==e?void 0:e.date)||(new Date).toISOString();return{id:Number(n),title:String((null==e?void 0:e.title)||""),date:r,settings:null==e?void 0:e.settings,digital_download_settings:null==e?void 0:e.digital_download_settings,post_author:null==e?void 0:e.post_author}}var ki=function(e){return["pricelists",e]},Si=function(e){return["pricelist",e]},Oi=function(e){return sl({queryKey:e?Si(e):["pricelist","none"],enabled:!!e,queryFn:(t=No(Ei().m(function t(){var n,r,a;return Ei().w(function(t){for(;;)switch(t.n){case 0:return r=null===(n=window.imagelyApp)||void 0===n?void 0:n.nonce,t.n=1,Oo()({path:"/imagely/v1/pricelists/".concat(e),method:"GET",headers:{"X-WP-Nonce":r}});case 1:return a=t.v,t.a(2,Ni(a))}},t)})),function(){return t.apply(this,arguments)}),staleTime:0,gcTime:6e5,retry:0,refetchOnMount:!0,refetchOnWindowFocus:!1});var t},Pi=function(e){var t,n=new URLSearchParams;return null!=e&&e.page&&n.append("page",String(e.page)),null!=e&&e.per_page&&n.append("per_page",String(e.per_page)),null!=e&&e.search&&n.append("search",e.search),null!=e&&e.sort&&n.append("sort",e.sort),null!=e&&e.order&&n.append("order",e.order),null!=e&&e.period&&n.append("period",e.period),sl({queryKey:ki(e||{}),enabled:!1!==(null==e?void 0:e.enabled),queryFn:(t=No(Ei().m(function e(){var t,r,a,o,l,i;return Ei().w(function(e){for(;;)switch(e.n){case 0:return r=null===(t=window.imagelyApp)||void 0===t?void 0:t.nonce,a="/imagely/v1/pricelists".concat(n.toString()?"?".concat(n.toString()):""),e.n=1,Oo()({path:a,method:"GET",headers:{"X-WP-Nonce":r}});case 1:return o=e.v,l=((null==o?void 0:o.pricelists)||[]).map(Ni),i=(null==o?void 0:o.pagination)||{total:0,total_pages:1,per_page:10,current_page:1},e.a(2,{pricelists:l,pagination:i})}},e)})),function(){return t.apply(this,arguments)}),staleTime:3e4,gcTime:6e5,retry:0,throwOnError:!1,refetchOnWindowFocus:!0,refetchOnMount:!1,placeholderData:function(e){return e}})};function ji(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ti(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ji(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ji(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Ii(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return Ai(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Ai(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Ai(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,Ai(m,"constructor",s),Ai(s,"constructor",c),c.displayName="GeneratorFunction",Ai(s,a,"GeneratorFunction"),Ai(m),Ai(m,a,"Generator"),Ai(m,r,function(){return this}),Ai(m,"toString",function(){return"[object Generator]"}),(Ii=function(){return{w:o,m:d}})()}function Ai(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}Ai=function(e,t,n,r){function o(t,n){Ai(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Ai(e,t,n,r)}function Di(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return Li(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Li(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Li(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,Li(m,"constructor",s),Li(s,"constructor",c),c.displayName="GeneratorFunction",Li(s,a,"GeneratorFunction"),Li(m),Li(m,a,"Generator"),Li(m,r,function(){return this}),Li(m,"toString",function(){return"[object Generator]"}),(Di=function(){return{w:o,m:d}})()}function Li(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}Li=function(e,t,n,r){function o(t,n){Li(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Li(e,t,n,r)}function Fi(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return Mi(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Mi(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Mi(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,Mi(m,"constructor",s),Mi(s,"constructor",c),c.displayName="GeneratorFunction",Mi(s,a,"GeneratorFunction"),Mi(m),Mi(m,a,"Generator"),Mi(m,r,function(){return this}),Mi(m,"toString",function(){return"[object Generator]"}),(Fi=function(){return{w:o,m:d}})()}function Mi(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}Mi=function(e,t,n,r){function o(t,n){Mi(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Mi(e,t,n,r)}function Ri(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Gi(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ri(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ri(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Bi(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return zi(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(zi(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,zi(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,zi(m,"constructor",s),zi(s,"constructor",c),c.displayName="GeneratorFunction",zi(s,a,"GeneratorFunction"),zi(m),zi(m,a,"Generator"),zi(m,r,function(){return this}),zi(m,"toString",function(){return"[object Generator]"}),(Bi=function(){return{w:o,m:d}})()}function zi(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}zi=function(e,t,n,r){function o(t,n){zi(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},zi(e,t,n,r)}function Ui(e){var t,n,r,a="percent"===(null==e?void 0:e.discount_type)?"percentage":"flat",o=null!==(t=null==e?void 0:e.ID)&&void 0!==t?t:null==e?void 0:e.id,l=(null==e?void 0:e.date)||(null==e?void 0:e.date_start)||"";return{id:Number(o),coupon_for:String((null==e?void 0:e.title)||""),coupon_code:String((null==e?void 0:e.id_code)||""),discount_type:a,discount_value:String(null!==(n=null!==(r=null==e?void 0:e.discount_amount)&&void 0!==r?r:null==e?void 0:e.discount_value)&&void 0!==n?n:""),start_date:(null==e?void 0:e.date_start)||void 0,end_date:(null==e?void 0:e.date_end)||void 0,usage_limit:null!==(null==e?void 0:e.usage_limit)&&void 0!==(null==e?void 0:e.usage_limit)?String(null==e?void 0:e.usage_limit):void 0,date:l,status:null==e?void 0:e.status,times_used:"number"==typeof(null==e?void 0:e.times_used)?null==e?void 0:e.times_used:void 0}}function qi(e){var t;return{id:Number(null==e?void 0:e.id),coupon_for:String((null==e?void 0:e.coupon_for)||""),coupon_code:String((null==e?void 0:e.coupon_code)||""),discount_type:"percentage"===(null==e?void 0:e.discount_type)||"flat"===(null==e?void 0:e.discount_type)?null==e?void 0:e.discount_type:"flat",discount_value:String(null!==(t=null==e?void 0:e.discount_value)&&void 0!==t?t:""),start_date:(null==e?void 0:e.start_date)||void 0,end_date:(null==e?void 0:e.end_date)||void 0,usage_limit:null!==(null==e?void 0:e.usage_limit)&&void 0!==(null==e?void 0:e.usage_limit)?String(null==e?void 0:e.usage_limit):void 0,date:(null==e?void 0:e.date)||(null==e?void 0:e.start_date)||"",status:null==e?void 0:e.status,times_used:"number"==typeof(null==e?void 0:e.times_used)?null==e?void 0:e.times_used:void 0}}var Qi=function(e){return["coupons",e]},Wi=function(e){return["coupon",e]},Hi=function(e){return sl({queryKey:e?Wi(e):["coupon","none"],enabled:!!e,queryFn:(t=No(Bi().m(function t(){var n,r,a;return Bi().w(function(t){for(;;)switch(t.n){case 0:return r=null===(n=window.imagelyApp)||void 0===n?void 0:n.nonce,t.n=1,Oo()({path:"/imagely/v1/coupons/".concat(e),method:"GET",headers:{"X-WP-Nonce":r}});case 1:if(!(a=t.v)||!a.id_code&&!a.ID){t.n=2;break}return t.a(2,Ui(a));case 2:return t.a(2,qi(a))}},t)})),function(){return t.apply(this,arguments)}),staleTime:0,gcTime:6e5,retry:0,refetchOnMount:!0,refetchOnWindowFocus:!1});var t};function Vi(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return Ki(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Ki(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Ki(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,Ki(m,"constructor",s),Ki(s,"constructor",c),c.displayName="GeneratorFunction",Ki(s,a,"GeneratorFunction"),Ki(m),Ki(m,a,"Generator"),Ki(m,r,function(){return this}),Ki(m,"toString",function(){return"[object Generator]"}),(Vi=function(){return{w:o,m:d}})()}function Ki(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}Ki=function(e,t,n,r){function o(t,n){Ki(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Ki(e,t,n,r)}var Xi={currencies:["currencies"],countries:["countries"],currency:function(e){return["currencies",e]}},Yi=function(){return sl({queryKey:Xi.currencies,queryFn:(e=No(Vi().m(function e(){var t,n,r;return Vi().w(function(e){for(;;)switch(e.n){case 0:return n=null===(t=window.imagelyApp)||void 0===t?void 0:t.nonce,e.n=1,Oo()({path:"/imagely/v1/currencies",method:"GET",headers:{"X-WP-Nonce":n}});case 1:if((r=e.v).success){e.n=2;break}throw new Error("Failed to fetch currencies");case 2:return e.a(2,r.data)}},e)})),function(){return e.apply(this,arguments)}),staleTime:18e5,gcTime:36e5});var e},Zi=function(){var e=Yi().data,t=gi().data;return(0,$.useMemo)(function(){var n,r;if(!e||!t)return"$";var a=t.ecommerce_currency,o=String(a),l=e.find(function(e){return("number"==typeof e.id?e.id:Number(e.id))===Number(o)||e.id===o});return l||(l=e.find(function(e){return e.code===o})),null!==(n=l)&&void 0!==n&&n.symbol?Ji(l.symbol):(null===(r=l)||void 0===r?void 0:r.code)||"$"},[e,t])},Ji=function(e){if(!e)return"$";var t=e;if(Object.entries({"€":"€","£":"£","¥":"¥","₹":"₹","₽":"₽","₪":"₪","₩":"₩","฿":"฿","₫":"₫","₮":"₮","₭":"₭"}).forEach(function(e){var n=vo(e,2),r=n[0],a=n[1];t=t.replace(new RegExp(r,"g"),a)}),t.includes("&#"))try{var n=document.createElement("div");n.innerHTML=t;var r=n.textContent||n.innerText||t;r!==t&&(t=r)}catch(e){console.warn("Failed to decode HTML entity:",t)}return t},$i=function(e){var t=e.length;return{left:t<=1?"pl-10":t<=2?"pl-12":t<=3?"pl-14":"pl-16",right:"pr-3"}},ec=function(e){var t=e.length;return t<=1||t<=2?"left-3":"left-4"},tc=function(e){if("number"==typeof e)return e;var t=e;if(e.match(/^&#\d+;$/)){var n=e.match(/&#(\d+);/);if(n){var r=parseInt(n[1],10);if(r>65535)return r}}if(e.includes("&#"))try{var a=document.createElement("div");a.innerHTML=e,t=a.textContent||a.innerText||e}catch(n){t=e.replace(/&#\d+;/g,"").trim()}var o=t.match(/[\d.]+/);return o?parseFloat(o[0]):0};var nc=l(795),rc=l.n(nc),ac=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=vo((0,$.useState)({offsetX:0,offsetY:0}),2),r=n[0],a=n[1];return(0,$.useLayoutEffect)(function(){var n=function(){var t=e();if(t){var n=t.getBoundingClientRect();a({offsetX:n.left,offsetY:n.top})}else a({offsetX:0,offsetY:0})};if(n(),t)return window.addEventListener("resize",n),window.addEventListener("scroll",n,!0),function(){window.removeEventListener("resize",n),window.removeEventListener("scroll",n,!0)}},[t]),r},oc=function(){var e=document.querySelectorAll(".imagely-wrap");return e.length>0?e[e.length-1]:document.body},lc=function(){return ee().createElement("div",{className:"ml-1 w-4 h-4 text-gray-500 hover:text-gray-700"},ee().createElement(Sn,null))},ic=function(e){var t=e.text,n=e.children,r=void 0===n?ee().createElement(lc,null):n,a=e.placement,o=void 0===a?"top":a,l=(0,$.useRef)(null),i=(0,$.useRef)(null),c=vo((0,$.useState)(!1),2),s=c[0],u=c[1],m=vo((0,$.useState)(null),2),d=m[0],g=m[1],p=ac(oc,s);return(0,$.useLayoutEffect)(function(){if(s&&l.current&&i.current){var e=l.current.getBoundingClientRect(),t=i.current.getBoundingClientRect(),n=oc().getBoundingClientRect(),r=0,a=0;switch(o){case"right":r=e.top+e.height/2-t.height/2-p.offsetY,a=e.right+8-p.offsetX;break;case"bottom":r=e.bottom+8-p.offsetY,a=e.left+e.width/2-t.width/2-p.offsetX;break;default:r=e.top-t.height-8-p.offsetY,a=e.left+e.width/2-t.width/2-p.offsetX}var c=n.width-16,u=n.height-16;a<16&&(a=16),a+t.width>c&&(a=c-t.width),r<16&&(r=16),r+t.height>u&&(r=u-t.height),g({top:r,left:a})}},[s,t,o,p]),ee().createElement("div",{className:"relative inline-block",ref:l},ee().createElement("div",{className:"inline-block cursor-help align-middle",onMouseEnter:function(){return u(!0)},onMouseLeave:function(){return u(!1)}},r),s&&rc().createPortal(ee().createElement("div",{ref:i,style:{position:"absolute",top:d?"".concat(d.top,"px"):"0",left:d?"".concat(d.left,"px"):"0",opacity:d?1:0,zIndex:9999},className:"px-3 py-2 text-sm text-white bg-gray-900 rounded-lg shadow-lg min-w-[200px] sm:min-w-[280px] max-w-[calc(100vw-2rem)] sm:max-w-md whitespace-normal break-words pointer-events-none transition-opacity duration-200"},t),oc()))};const cc=function(e){var t=e.htmlFor,n=e.help,r=e.tooltipPlacement,a=void 0===r?"top":r,o=e.children,l=e.className,i=ee().createElement("div",{className:"flex items-center"},ee().createElement("span",null,o),n&&ee().createElement(ic,{text:n,placement:a}));return t?ee().createElement("label",{htmlFor:t,className:ao("block text-sm font-medium text-gray-700 mb-1",l)},i):ee().createElement("div",{className:ao("block text-sm font-medium text-gray-700 mb-2",l)},i)},sc=function(e){var t=e.id,n=e.name,r=e.value,a=e.onChange,o=e.children,l=e.label,i=e.help,c=e.tooltipPlacement;return ee().createElement(ee().Fragment,null,ee().createElement(cc,{htmlFor:t,help:i,tooltipPlacement:c,className:l?void 0:"hidden"},l||""),ee().createElement("select",{id:t,name:n,value:r,onChange:a,className:"bg-white border text-gray-900 text-sm rounded-lg focus:ring-green-500 focus:border-green-500 block w-full max-w-full p-2.5 hover:border-green-500 border-gray-400 transition-colors"},o))},uc=function(e){var t=e.type,n=e.id,r=e.name,a=e.value,o=e.onChange,l=e.label,i=e.help,c=e.min,s=void 0===c?0:c,u=e.max,m=void 0===u?1e4:u,d=e.step,g=void 0===d?1:d,p=e.placeholder,f=void 0===p?"":p,y=e.minString,h=e.maxString,b=e.tooltipPlacement,v=e.prefix,_=null!=a?a:"";return ee().createElement(ee().Fragment,null,ee().createElement(cc,{htmlFor:null!=n?n:r,help:i,tooltipPlacement:b,className:l?void 0:"hidden"},l||""),ee().createElement("div",{className:ao("relative",v&&"has-prefix")},v&&ee().createElement("span",{className:ao("absolute inset-y-0 flex items-center text-gray-500 text-sm pointer-events-none px-2",ec(v))},v),ee().createElement("input",fe({type:t,id:null!=n?n:r,name:r,value:_,onChange:o,className:ao("bg-white border text-gray-900 text-sm rounded-lg focus:ring-green-500 focus:border-green-500 block w-full hover:border-green-500 border-gray-400 transition-colors",v?"".concat($i(v).left," pr-2.5 py-2.5"):"p-2.5")},"number"===t&&{min:s,max:m,step:g},"number"!==t&&{min:y,max:h},{placeholder:f}))))};function mc(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return dc(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(dc(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,dc(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,dc(m,"constructor",s),dc(s,"constructor",c),c.displayName="GeneratorFunction",dc(s,a,"GeneratorFunction"),dc(m),dc(m,a,"Generator"),dc(m,r,function(){return this}),dc(m,"toString",function(){return"[object Generator]"}),(mc=function(){return{w:o,m:d}})()}function dc(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}dc=function(e,t,n,r){function o(t,n){dc(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},dc(e,t,n,r)}function gc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function pc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?gc(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):gc(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function fc(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return yc(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(yc(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,yc(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,yc(m,"constructor",s),yc(s,"constructor",c),c.displayName="GeneratorFunction",yc(s,a,"GeneratorFunction"),yc(m),yc(m,a,"Generator"),yc(m,r,function(){return this}),yc(m,"toString",function(){return"[object Generator]"}),(fc=function(){return{w:o,m:d}})()}function yc(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}yc=function(e,t,n,r){function o(t,n){yc(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},yc(e,t,n,r)}function hc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function bc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?hc(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):hc(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function vc(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return _c(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(_c(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,_c(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,_c(m,"constructor",s),_c(s,"constructor",c),c.displayName="GeneratorFunction",_c(s,a,"GeneratorFunction"),_c(m),_c(m,a,"Generator"),_c(m,r,function(){return this}),_c(m,"toString",function(){return"[object Generator]"}),(vc=function(){return{w:o,m:d}})()}function _c(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}_c=function(e,t,n,r){function o(t,n){_c(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},_c(e,t,n,r)}var wc=function(){var e,t=re();return gl({mutationFn:(e=No(vc().m(function e(t){var n,r,a,o;return vc().w(function(e){for(;;)switch(e.n){case 0:return r=t.imageId,a=t.data,o=null===(n=window.imagelyApp)||void 0===n?void 0:n.nonce,e.n=1,Oo()({path:"/imagely/v1/images/".concat(r),method:"PUT",headers:{"X-WP-Nonce":o,"Content-Type":"application/json"},data:a});case 1:return e.a(2,e.v)}},e)})),function(t){return e.apply(this,arguments)}),onSuccess:function(e){t.setQueryData(["gallery",e.galleryid,"images"],function(t){return t?t.map(function(t){return t.pid===e.pid?e:t}):[e]}),t.invalidateQueries({queryKey:["gallery",e.galleryid]})}})},xc=function(){var e,t=re();return gl({mutationFn:(e=No(vc().m(function e(t){var n,r,a;return vc().w(function(e){for(;;)switch(e.n){case 0:return r=t.imageId,a=null===(n=window.imagelyApp)||void 0===n?void 0:n.nonce,e.n=1,Oo()({path:"/imagely/v1/images/".concat(r),method:"DELETE",headers:{"X-WP-Nonce":a}});case 1:return e.a(2,e.v)}},e)})),function(t){return e.apply(this,arguments)}),onSuccess:function(e,n){var r=n.imageId;t.setQueriesData({queryKey:["gallery"]},function(e){return Array.isArray(e)?e.filter(function(e){return e.pid!==r}):e}),t.invalidateQueries({queryKey:["gallery"]})}})},Ec=["isOpen","entityType","items","getItemId","getItemLabel","onClose","onConfirm","title","singularLabel","pluralLabel","confirmLabel","cancelLabel","maxList"];function Cc(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return Nc(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Nc(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Nc(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,Nc(m,"constructor",s),Nc(s,"constructor",c),c.displayName="GeneratorFunction",Nc(s,a,"GeneratorFunction"),Nc(m),Nc(m,a,"Generator"),Nc(m,r,function(){return this}),Nc(m,"toString",function(){return"[object Generator]"}),(Cc=function(){return{w:o,m:d}})()}function Nc(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}Nc=function(e,t,n,r){function o(t,n){Nc(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Nc(e,t,n,r)}const kc=function(e){var t=e.isOpen,n=e.entityType,r=e.items,a=e.getItemId,o=e.getItemLabel,l=e.onClose,i=void 0===l?function(){}:l,c=e.onConfirm,s=void 0===c?function(){}:c,u=e.title,m=e.singularLabel,d=void 0===m?"item":m,g=e.pluralLabel,p=void 0===g?"items":g,f=e.confirmLabel,y=void 0===f?(0,pe.__)("Delete","nggallery"):f,h=e.cancelLabel,b=void 0===h?(0,pe.__)("Cancel","nggallery"):h,v=e.maxList,_=void 0===v?5:v,w=ye(e,Ec),x=xc(),E=Tl(),C=function(){var e,t=re();return gl({mutationFn:(e=No(zl().m(function e(t){var n,r,a,o;return zl().w(function(e){for(;;)switch(e.p=e.n){case 0:return r=null===(n=window.imagelyApp)||void 0===n?void 0:n.nonce,e.p=1,e.n=2,Oo()({path:"/imagely/v1/albums/".concat(t),method:"DELETE",headers:{"X-WP-Nonce":r}});case 2:e.n=5;break;case 3:if(e.p=3,404!==(null==(o=e.v)?void 0:o.status)&&404!==(null==o||null===(a=o.response)||void 0===a?void 0:a.status)){e.n=4;break}return console.warn("Album ".concat(t," already deleted or doesn't exist")),e.a(2);case 4:throw o;case 5:return e.a(2)}},e,null,[[1,3]])})),function(t){return e.apply(this,arguments)}),onSuccess:function(){t.invalidateQueries({queryKey:["albums"]})}})}(),N=$o(),k=N.showSuccess,S=N.showError,O=x.isPending||E.isPending||C.isPending,P=(0,$.useMemo)(function(){return r.length<=_?ee().createElement("ul",{className:"list-none text-sm text-gray-700 px-4 text-center"},r.map(function(e){return ee().createElement("li",{key:a(e)},o(e))})):null},[r,a,o,_]),j=function(){var e=No(Cc().m(function e(){var t,o;return Cc().w(function(e){for(;;)switch(e.p=e.n){case 0:if(0!==r.length){e.n=1;break}return e.a(2);case 1:if(e.p=1,"images"!==n){e.n=3;break}return e.n=2,Promise.all(r.map(function(e){return x.mutateAsync({imageId:a(e)})}));case 2:e.n=6;break;case 3:if("galleries"!==n){e.n=5;break}return e.n=4,Promise.all(r.map(function(e){return E.mutateAsync(a(e))}));case 4:e.n=6;break;case 5:if("albums"!==n){e.n=6;break}return e.n=6,Promise.all(r.map(function(e){return C.mutateAsync(a(e))}));case 6:t=1===r.length?d:p,k((0,pe.__)("Successfully deleted ".concat(r.length," ").concat(t),"nggallery")),s(),i(),e.n=8;break;case 7:e.p=7,o=e.v,console.error("Error deleting items:",o),S((0,pe.__)("Failed to delete items","nggallery"));case 8:return e.a(2)}},e,null,[[1,7]])}));return function(){return e.apply(this,arguments)}}();return ee().createElement(Eo,fe({isOpen:t,onClose:i},w),ee().createElement("div",{className:"space-y-4"},ee().createElement("div",{className:"flex items-center gap-2 justify-center"},ee().createElement("div",null,ee().createElement(rr,null))),u&&ee().createElement("h2",{className:"text-xl font-bold text-center text-gray-900 mt-2"},u),ee().createElement("p",{className:"text-sm text-gray-500 text-center"},(0,pe.__)("Are you sure you want to delete ".concat(r.length," ").concat(1===r.length?d:p,"?"))),P,ee().createElement("p",{className:"text-sm text-red-500 text-center"},(0,pe.__)("This action cannot be undone.","nggallery")),ee().createElement("div",{className:"flex justify-center space-x-3 !mb-4 ".concat(O?"cursor-wait":"")},ee().createElement("button",{type:"button",onClick:i,disabled:O,className:"px-8 py-2 font-medium text-gray-700 bg-white border border-gray-300 rounded-lg shadow hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"},b),ee().createElement("button",{type:"button",onClick:j,disabled:O,className:"px-8 py-2 font-bold text-white bg-green-500 border border-transparent rounded-lg shadow hover:bg-green-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"},O?ee().createElement("span",{className:"flex items-center"},ee().createElement(kn,{className:"animate-spin -ml-1 mr-2 h-4 w-4 text-white"}),(0,pe.__)("Deleting...","nggallery")):y))))};var Sc=["isOpen","albums","onClose","onConfirm","title"];function Oc(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return Pc(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Pc(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Pc(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,Pc(m,"constructor",s),Pc(s,"constructor",c),c.displayName="GeneratorFunction",Pc(s,a,"GeneratorFunction"),Pc(m),Pc(m,a,"Generator"),Pc(m,r,function(){return this}),Pc(m,"toString",function(){return"[object Generator]"}),(Oc=function(){return{w:o,m:d}})()}function Pc(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}Pc=function(e,t,n,r){function o(t,n){Pc(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Pc(e,t,n,r)}var jc=["isOpen","galleries","onClose","onConfirm","title"];var Tc=["isOpen","images","onClose","onConfirm","title"];function Ic(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return Ac(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Ac(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Ac(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,Ac(m,"constructor",s),Ac(s,"constructor",c),c.displayName="GeneratorFunction",Ac(s,a,"GeneratorFunction"),Ac(m),Ac(m,a,"Generator"),Ac(m,r,function(){return this}),Ac(m,"toString",function(){return"[object Generator]"}),(Ic=function(){return{w:o,m:d}})()}function Ac(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}Ac=function(e,t,n,r){function o(t,n){Ac(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Ac(e,t,n,r)}var Dc=["isOpen","tags","onClose","onConfirm","title"];function Lc(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return Fc(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Fc(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Fc(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,Fc(m,"constructor",s),Fc(s,"constructor",c),c.displayName="GeneratorFunction",Fc(s,a,"GeneratorFunction"),Fc(m),Fc(m,a,"Generator"),Fc(m,r,function(){return this}),Fc(m,"toString",function(){return"[object Generator]"}),(Lc=function(){return{w:o,m:d}})()}function Fc(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}Fc=function(e,t,n,r){function o(t,n){Fc(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Fc(e,t,n,r)}function Mc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Rc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Mc(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Mc(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Gc(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return Bc(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Bc(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Bc(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,Bc(m,"constructor",s),Bc(s,"constructor",c),c.displayName="GeneratorFunction",Bc(s,a,"GeneratorFunction"),Bc(m),Bc(m,a,"Generator"),Bc(m,r,function(){return this}),Bc(m,"toString",function(){return"[object Generator]"}),(Gc=function(){return{w:o,m:d}})()}function Bc(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}Bc=function(e,t,n,r){function o(t,n){Bc(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Bc(e,t,n,r)}function zc(e,t){return e?t?"".concat(e.split("?")[0],"?t=").concat(t):e:""}function Uc(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return qc(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(qc(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,qc(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,qc(m,"constructor",s),qc(s,"constructor",c),c.displayName="GeneratorFunction",qc(s,a,"GeneratorFunction"),qc(m),qc(m,a,"Generator"),qc(m,r,function(){return this}),qc(m,"toString",function(){return"[object Generator]"}),(Uc=function(){return{w:o,m:d}})()}function qc(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}qc=function(e,t,n,r){function o(t,n){qc(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},qc(e,t,n,r)}function Qc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Wc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Qc(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Qc(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Hc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Vc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Hc(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Hc(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Kc(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return Xc(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Xc(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Xc(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,Xc(m,"constructor",s),Xc(s,"constructor",c),c.displayName="GeneratorFunction",Xc(s,a,"GeneratorFunction"),Xc(m),Xc(m,a,"Generator"),Xc(m,r,function(){return this}),Xc(m,"toString",function(){return"[object Generator]"}),(Kc=function(){return{w:o,m:d}})()}function Xc(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}Xc=function(e,t,n,r){function o(t,n){Xc(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Xc(e,t,n,r)}const Yc=function(e){var t=e.id,n=e.name,r=e.value,a=e.onChange,o=e.label,l=e.help,i=e.placeholder,c=void 0===i?"":i,s=e.rows,u=void 0===s?4:s;return ee().createElement(ee().Fragment,null,ee().createElement(cc,{htmlFor:null!=t?t:n,help:l,className:o?void 0:"hidden"},o||""),ee().createElement("textarea",{id:null!=t?t:n,name:n,value:r,onChange:a,rows:u,className:"bg-white border border-input-border text-gray-900 text-sm rounded-lg focus:ring-green-500 focus:border-green-500 block w-full p-2.5 hover:border-gray-400 transition-colors",placeholder:c}))};function Zc(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return Jc(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Jc(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Jc(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,Jc(m,"constructor",s),Jc(s,"constructor",c),c.displayName="GeneratorFunction",Jc(s,a,"GeneratorFunction"),Jc(m),Jc(m,a,"Generator"),Jc(m,r,function(){return this}),Jc(m,"toString",function(){return"[object Generator]"}),(Zc=function(){return{w:o,m:d}})()}function Jc(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}Jc=function(e,t,n,r){function o(t,n){Jc(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Jc(e,t,n,r)}function $c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function es(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?$c(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$c(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}const ts=function(e){var t=e.gallery,r=e.onClose,a=e.onUpdate,o=Ol(),l=$o(),i=l.showSuccess,c=l.showError,s=vo((0,$.useState)({title:"",galdesc:""}),2),u=s[0],m=s[1];(0,$.useEffect)(function(){m({title:t.title||"",galdesc:t.galdesc||""})},[t]);var d=function(e){var t=e.target,r=t.name,a=t.value;m(function(e){return es(es({},e),{},n({},r,a))})},g=function(){var e=No(Zc().m(function e(n){var l;return Zc().w(function(e){for(;;)switch(e.p=e.n){case 0:return n.preventDefault(),e.p=1,e.n=2,o.mutateAsync({id:t.gid,data:{title:u.title,name:u.title,galdesc:u.galdesc}});case 2:a&&a(),r(),i((0,pe.__)("Gallery updated successfully!","nggallery")),e.n=4;break;case 3:e.p=3,l=e.v,console.error("Error updating gallery:",l),console.error("Error details:",{message:l instanceof Error?l.message:"Unknown error",stack:l instanceof Error?l.stack:void 0,errorObject:l}),c((0,pe.__)("Failed to update gallery. Please try again.","nggallery"));case 4:return e.a(2)}},e,null,[[1,3]])}));return function(t){return e.apply(this,arguments)}}();return ee().createElement("form",{onSubmit:g,className:"space-y-4"},ee().createElement(uc,{type:"text",name:"title",value:u.title,onChange:d,label:(0,pe.__)("Gallery Title","nggallery"),placeholder:(0,pe.__)("Enter gallery title","nggallery")}),ee().createElement(Yc,{name:"galdesc",value:u.galdesc,onChange:d,label:(0,pe.__)("Gallery Description","nggallery"),placeholder:(0,pe.__)("Enter gallery description","nggallery"),rows:6}),ee().createElement("div",{className:"flex justify-end space-x-2"},ee().createElement("button",{type:"button",onClick:r,className:"px-4 py-2 bg-gray-100 text-gray-700 rounded-lg hover:bg-gray-200 transition-colors"},(0,pe.__)("Cancel","nggallery")),ee().createElement("button",{type:"submit",className:"px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 transition-colors"},(0,pe.__)("Save Changes","nggallery"))))};function ns(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return rs(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(rs(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,rs(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,rs(m,"constructor",s),rs(s,"constructor",c),c.displayName="GeneratorFunction",rs(s,a,"GeneratorFunction"),rs(m),rs(m,a,"Generator"),rs(m,r,function(){return this}),rs(m,"toString",function(){return"[object Generator]"}),(ns=function(){return{w:o,m:d}})()}function rs(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}rs=function(e,t,n,r){function o(t,n){rs(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},rs(e,t,n,r)}function as(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return os(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(os(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,os(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,os(m,"constructor",s),os(s,"constructor",c),c.displayName="GeneratorFunction",os(s,a,"GeneratorFunction"),os(m),os(m,a,"Generator"),os(m,r,function(){return this}),os(m,"toString",function(){return"[object Generator]"}),(as=function(){return{w:o,m:d}})()}function os(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}os=function(e,t,n,r){function o(t,n){os(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},os(e,t,n,r)}function ls(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function is(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ls(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ls(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}const cs=function(e){var t=e.onSuccess,r=(0,ge.useDispatch)(Br),a=jl(),o=$o(),l=o.showSuccess,i=o.showError,c=vo((0,$.useState)({title:"",galdesc:""}),2),s=c[0],u=c[1],m=function(e){var t=e.target,r=t.name,a=t.value;u(function(e){return is(is({},e),{},n({},r,a))})},d=function(){var e=No(as().m(function e(n){var o,c;return as().w(function(e){for(;;)switch(e.p=e.n){case 0:return n.preventDefault(),e.p=1,e.n=2,a.mutateAsync(is(is({},s),{},{name:s.title}));case 2:o=e.v,u({title:"",galdesc:""}),r.setActiveModal(null),t&&null!=o&&o.gid?(t(o.gid),l((0,pe.__)("Gallery created successfully!","nggallery"))):null!=o&&o.gid?(r.navigateTo("imagely-add-new","images",o.gid),l((0,pe.__)("Gallery created successfully!","nggallery"))):(console.warn("Could not navigate: Gallery ID is missing from response"),console.warn("Response structure:",Object.keys(o||{}))),e.n=4;break;case 3:e.p=3,c=e.v,console.error("Error creating gallery:",c),console.error("Error details:",{message:c instanceof Error?c.message:"Unknown error",stack:c instanceof Error?c.stack:void 0,errorObject:c}),i((0,pe.__)("Failed to create gallery. Please try again.","nggallery"));case 4:return e.a(2)}},e,null,[[1,3]])}));return function(t){return e.apply(this,arguments)}}();return ee().createElement("form",{onSubmit:d,className:"space-y-4"},ee().createElement(uc,{type:"text",name:"title",value:s.title,onChange:m,label:(0,pe.__)("Gallery Title","nggallery"),placeholder:(0,pe.__)("Enter gallery title","nggallery")}),ee().createElement(Yc,{name:"galdesc",value:s.galdesc,onChange:m,label:(0,pe.__)("Gallery Description","nggallery"),placeholder:(0,pe.__)("Enter gallery description","nggallery"),rows:6}),ee().createElement("button",{type:"submit",className:"bg-green-600 hover:bg-green-700 text-white font-medium py-2 px-4 rounded-lg transition-colors"},(0,pe.__)("Create Gallery","nggallery")))};var ss=["isOpen","onClose","onGalleryCreated"];function us(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return ms(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(ms(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,ms(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,ms(m,"constructor",s),ms(s,"constructor",c),c.displayName="GeneratorFunction",ms(s,a,"GeneratorFunction"),ms(m),ms(m,a,"Generator"),ms(m,r,function(){return this}),ms(m,"toString",function(){return"[object Generator]"}),(us=function(){return{w:o,m:d}})()}function ms(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}ms=function(e,t,n,r){function o(t,n){ms(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},ms(e,t,n,r)}function ds(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return gs(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(gs(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,gs(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,gs(m,"constructor",s),gs(s,"constructor",c),c.displayName="GeneratorFunction",gs(s,a,"GeneratorFunction"),gs(m),gs(m,a,"Generator"),gs(m,r,function(){return this}),gs(m,"toString",function(){return"[object Generator]"}),(ds=function(){return{w:o,m:d}})()}function gs(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}gs=function(e,t,n,r){function o(t,n){gs(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},gs(e,t,n,r)}const ps=function(e){var t=e.icon,n=e.label,r=e.isSelected,a=e.onClick,o=e.iconSize,l="small"===(void 0===o?"default":o)?"w-5 h-5":"w-6 h-6";return ee().createElement("button",{onClick:a,className:"flex flex-col gap-[12px] items-center justify-center px-1 py-2 rounded-lg border transition-colors w-[112px] h-[88px] ".concat(r?"bg-[#f0f1f3] border-gray-700":"bg-white border-gray-300"," shadow-[0px_4px_4px_0px_rgba(55,65,81,0.08)] hover:bg-[#f0f1f3] hover:border-gray-700")},ee().createElement(t,{className:"".concat(l," text-gray-700")}),ee().createElement("p",{className:"font-medium text-[14px] leading-[16px] text-center text-gray-700"},n))},fs=function(e){var t=e.id,n=e.name,r=e.checked,a=e.onChange,o=e.label,l=e.help,i=e.disabled,c=ni(r);return ee().createElement("div",{className:"relative inline-flex items-start gap-3 w-full"},ee().createElement("div",{className:"relative"},ee().createElement("input",{type:"checkbox",id:t,name:n,checked:c,onChange:a,disabled:i,className:"sr-only peer"}),ee().createElement("label",{htmlFor:t,className:"w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-green-300 rounded-full inline-block peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-green-600 ".concat(i?"opacity-50 cursor-not-allowed":"cursor-pointer")})),(o||l)&&ee().createElement("div",{className:"flex items-center gap-1"},o&&ee().createElement("label",{htmlFor:t,className:"text-sm font-medium text-gray-900 cursor-pointer"},o),l&&ee().createElement(ic,{text:l})))};function ys(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function hs(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ys(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ys(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function bs(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return vs(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(vs(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,vs(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,vs(m,"constructor",s),vs(s,"constructor",c),c.displayName="GeneratorFunction",vs(s,a,"GeneratorFunction"),vs(m),vs(m,a,"Generator"),vs(m,r,function(){return this}),vs(m,"toString",function(){return"[object Generator]"}),(bs=function(){return{w:o,m:d}})()}function vs(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}vs=function(e,t,n,r){function o(t,n){vs(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},vs(e,t,n,r)}var _s={addonStates:["addons","states"]},ws=function(){return sl({queryKey:_s.addonStates,queryFn:(e=No(bs().m(function e(){var t;return bs().w(function(e){for(;;)switch(e.n){case 0:return t=Ao(),e.n=1,Oo()({path:"/imagely/v1/addons",method:"GET",headers:{"X-WP-Nonce":t}});case 1:return e.a(2,e.v)}},e)})),function(){return e.apply(this,arguments)}),staleTime:3e5,gcTime:6e5});var e};function xs(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Es(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?xs(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xs(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Cs(){var e=(0,ge.useDispatch)(Br),t=(0,ge.useSelect)(function(e){var t=e(Br);return{routeParams:t.getRouteParams(),currentTab:t.getCurrentTab(),currentSubTab:t.getCurrentSubTab(),currentPage:t.getCurrentPage(),currentId:t.getCurrentId()}},[]);return Es(Es({},t),{},{setCurrentTab:e.setCurrentTab,setCurrentSubTab:e.setCurrentSubTab,setCurrentPage:e.setCurrentPage,setCurrentId:e.setCurrentId,navigateTo:e.navigateTo,setActiveModal:e.setActiveModal})}var Ns=function(e){var t=e.width,n=void 0===t?130:t,r=e.height,a=void 0===r?90:r,o=e.backgroundColor,l=void 0===o?"#e0e0e0":o,i=e.textColor,c=void 0===i?"#888888":i,s=e.fontSize,u=void 0===s?14:s,m=e.text,d=void 0===m?"":m,g='\n <svg xmlns="http://www.w3.org/2000/svg" width="'.concat(n,'" height="').concat(a,'">\n <rect width="100%" height="100%" fill="').concat(l,'"/>\n <text x="50%" y="50%" fill="').concat(c,'" dy=".3em" text-anchor="middle" font-family="sans-serif" font-size="').concat(u,'px">\n ').concat(d||"".concat(n,"×").concat(a),"\n </text>\n </svg>\n ").trim(),p=encodeURIComponent(g);return"data:image/svg+xml;charset=UTF-8,".concat(p)};function ks(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ss(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ks(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ks(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var Os={google_photos:{id:"google_photos",name:"Google Photos",subtitle:"Easily import your images from Google Photos into your WordPress gallery.",description:"Import your images from Google Photos account into your WordPress gallery and show off your portfolio website.",icon:ee().createElement(Pr,{className:"w-full h-full"}),showInAddonsPage:!0},dribbble:{id:"dribbble",name:"Dribbble",subtitle:"Easily import your images from Dribbble into your WordPress gallery.",description:"Easily import your images from Dribbble account into your WordPress gallery and show off your portfolio website.",icon:ee().createElement(Lr,{className:"w-full h-full"}),showInAddonsPage:!0,minPlan:"pro"},tiktok:{id:"tiktok",name:"TikTok",subtitle:"Easily import your videos from TikTok into your WordPress gallery.",description:"Import your images from TikTok account into your WordPress gallery and show off your portfolio website.",icon:ee().createElement(Dr,{className:"w-full h-full"}),showInAddonsPage:!0,minPlan:"pro"},google_analytics:{id:"google_analytics",name:"Google Analytics",subtitle:"Easily track gallery and image engagement in Google Analytics 4.",description:"Enable GA4 tracking for your galleries to gain insights into which galleries and images resonate with visitors.",icon:ee().createElement(Rr,{className:"w-full h-full"}),showInAddonsPage:!0,minPlan:"starter"},dropbox:{id:"dropbox",name:"Dropbox",subtitle:"Easily import your images from Dropbox into your WordPress gallery.",description:"Import your images from Dropbox into your WordPress gallery and organize your media library effortlessly.",icon:ee().createElement(Mr,{className:"w-full h-full"}),showInAddonsPage:!0},instagram:{id:"instagram",name:"Instagram",subtitle:"Easily import your images from Instagram into your WordPress gallery.",description:"Import your images from Instagram account into your WordPress gallery and show off your portfolio website.",icon:null,showInAddonsPage:!1}},Ps=function(e){var t;return(null===(t=Os[e])||void 0===t?void 0:t.name)||e},js=function(e,t){var n=Os[e];if(!n)return!1;var r=t["addon_show_".concat(e)];return t&&void 0!==r?ni(r):n.showInAddonsPage},Ts=function(e){var t,n=e.addonName;return ee().createElement("div",{className:"p-6 bg-gray-50 border border-gray-200 rounded-lg text-center"},ee().createElement("p",{className:"text-gray-600 mb-2"},(0,pe.__)("The","nggallery")," ",ee().createElement("strong",null,n)," ",(0,pe.__)("feature is not activated.","nggallery")),ee().createElement("p",{className:"text-sm text-gray-500"},(0,pe.__)("Please enable it from the","nggallery")," ",ee().createElement("a",{href:"".concat((null===(t=window.imagelyApp)||void 0===t?void 0:t.adminUrl)||"/wp-admin/","admin.php?page=imagely-addons"),className:"text-green-600 hover:text-green-700 underline"},(0,pe.__)("Features page","nggallery"))," ",(0,pe.__)("to use this feature.","nggallery")))};const Is=function(e){var t=e.addonId,n=e.children,r=e.fallback,a=e.loadingFallback,o=e.hideWhenDisabled,l=void 0!==o&&o,i=function(e){var t,n=ws(),r=n.data,a=n.isLoading,o=n.isError;return{isEnabled:!(null==r||null===(t=r.enabled_addons)||void 0===t||!t[e]),isLoading:a,isError:o}}(t),c=i.isEnabled;return i.isLoading?a||null:c?n:l?null:r||ee().createElement(Ts,{addonName:Ps(t)})};function As(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return Ds(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Ds(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Ds(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,Ds(m,"constructor",s),Ds(s,"constructor",c),c.displayName="GeneratorFunction",Ds(s,a,"GeneratorFunction"),Ds(m),Ds(m,a,"Generator"),Ds(m,r,function(){return this}),Ds(m,"toString",function(){return"[object Generator]"}),(As=function(){return{w:o,m:d}})()}function Ds(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}Ds=function(e,t,n,r){function o(t,n){Ds(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Ds(e,t,n,r)}var Ls={dribbbleOAuthUrl:function(e){return["dribbble","oauth-url",e]},dribbbleAccounts:["dribbble","accounts"],dribbbleImageSizes:function(e){return["dribbble","image-sizes",e]}},Fs=function(){var e,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return sl({queryKey:Ls.dribbbleAccounts,queryFn:(e=No(As().m(function e(){var t;return As().w(function(e){for(;;)switch(e.n){case 0:return t=Ao(),e.n=1,Oo()({path:"/nggpro/v1/dribbble/accounts",method:"GET",headers:{"X-WP-Nonce":t}});case 1:return e.a(2,e.v)}},e)})),function(){return e.apply(this,arguments)}),enabled:t,staleTime:3e4,gcTime:3e5})},Ms=function(){var e,t=vo((0,$.useState)(!1),2),n=t[0],r=t[1],a=vo((0,$.useState)(void 0),2),o=a[0],l=a[1],i=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return sl({queryKey:Ls.dribbbleOAuthUrl(e),queryFn:(t=No(As().m(function t(){var n,r;return As().w(function(t){for(;;)switch(t.n){case 0:return n=Ao(),r=e?"/nggpro/v1/dribbble/oauth-url?return_to=".concat(encodeURIComponent(e)):"/nggpro/v1/dribbble/oauth-url",t.n=1,Oo()({path:r,method:"GET",headers:{"X-WP-Nonce":n}});case 1:return t.a(2,t.v)}},t)})),function(){return t.apply(this,arguments)}),enabled:n,staleTime:0,gcTime:0})}(o,n);return(0,$.useEffect)(function(){var e;null!==(e=i.data)&&void 0!==e&&e.oauth_url&&(window.location.href=i.data.oauth_url)},[null===(e=i.data)||void 0===e?void 0:e.oauth_url]),{handleConnectClick:(0,$.useCallback)(function(){var e=window.location.href;try{var t=new URL(e),n=(t.pathname+t.search).replace(/^\/wp-admin\//,"").replace(/^\//,"");l(n||void 0)}catch(e){console.error("Failed to parse URL:",e),l(void 0)}r(!0)},[]),isLoading:i.isFetching}},Rs=function(){var e,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return sl({queryKey:Ls.dribbbleImageSizes(t),queryFn:(e=No(As().m(function e(){var n,r;return As().w(function(e){for(;;)switch(e.n){case 0:return n=Ao(),r="/nggpro/v1/dribbble/image-sizes".concat(t?"?core_only=1":""),e.n=1,Oo()({path:r,method:"GET",headers:{"X-WP-Nonce":n}});case 1:return e.a(2,e.v)}},e)})),function(){return e.apply(this,arguments)}),enabled:n,staleTime:3e5,gcTime:6e5})};function Gs(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Bs(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Gs(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Gs(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}const zs=function(e){var t,n,r=e.integrationType,a=e.integrationName,o=e.externalSource,l=void 0===o?{}:o,i=e.defaultSettings,c=void 0===i?{}:i,s=e.onUpdate,u=Cs().navigateTo,m=(0,$.useMemo)(function(){return"custom"===l.settings_mode?"custom":"default"},[l.settings_mode]),d=vo((0,$.useState)(m),2),g=d[0],p=d[1];(0,$.useEffect)(function(){p(m)},[m]);var f="default",y=function(e,t){return void 0!==l[e]?l[e]:"default"===g&&void 0!==c[e]?c[e]:t},h=vo((0,$.useState)(y("".concat(r,"_account"),"")),2),b=h[0],v=h[1],_=vo((0,$.useState)(String(y("".concat(r,"_number"),5))),2),w=_[0],x=_[1],E=vo((0,$.useState)(String(y("".concat(r,"_link"),0))),2),C=E[0],N=E[1],k=vo((0,$.useState)(y("".concat(r,"_image_size"),f)),2),S=k[0],O=k[1],P=vo((0,$.useState)(1===y("".concat(r,"_link_target"),0)),2),j=P[0],T=P[1],I=vo((0,$.useState)(1===y("".concat(r,"_caption"),1)),2),A=I[0],D=I[1],L=vo((0,$.useState)(String(y("".concat(r,"_caption_length"),999))),2),F=L[0],M=L[1],R=vo((0,$.useState)(1===y("".concat(r,"_cache"),1)),2),G=R[0],B=R[1];(0,$.useEffect)(function(){v(y("".concat(r,"_account"),"")),x(String(y("".concat(r,"_number"),5))),N(String(y("".concat(r,"_link"),0))),O(y("".concat(r,"_image_size"),f)),T(1===y("".concat(r,"_link_target"),0)),D(1===y("".concat(r,"_caption"),1)),M(String(y("".concat(r,"_caption_length"),999))),B(1===y("".concat(r,"_cache"),1))},[g,l,c,r]);var z=(null===(t=Fs(!0).data)||void 0===t?void 0:t.accounts)||[],U=z.length>0,q=(null===(n=Rs(!1,!0).data)||void 0===n?void 0:n.sizes)||[],Q=function(e){if(p(e),s){var t=Bs(Bs({},l),{},{settings_mode:e});if("custom"===e){var n="".concat(r,"_account"),a=t[n];if(null==a||""===a){var o=null==c?void 0:c[n];null!=o&&""!==o&&(t[n]=o,v(String(o)))}}if("default"===e){var i=Object.fromEntries(Object.entries(t).filter(function(e){var t=vo(e,1)[0];return"type"===t||"settings_mode"===t}));s(i)}else s(t)}},W=function(e,t){if("custom"===g){var n=Bs(Bs({},l),{},{settings_mode:"custom"}),a={account:"".concat(r,"_account"),numPhotos:"".concat(r,"_number"),overridingLink:"".concat(r,"_link"),imageSize:"".concat(r,"_image_size"),openInNewTab:"".concat(r,"_link_target"),usePhotoTitle:"".concat(r,"_caption"),limitCaptionLength:"".concat(r,"_caption_length"),cacheData:"".concat(r,"_cache")}[e];a&&(n[a]="openInNewTab"===e||"usePhotoTitle"===e||"cacheData"===e?t?1:0:"numPhotos"===e||"limitCaptionLength"===e?parseInt(t)||0:t,s&&s(n))}},H=z.map(function(e){return{value:e.username||"slot-".concat(e.slot),label:e.username||(0,pe.__)("Account","nggallery")+" #".concat(e.slot)}}),V=[{value:"0",label:(0,pe.__)("No link (Use Lightbox If Enabled)","nggallery")},{value:"1",label:(0,pe.__)("Original Page at","nggallery")+" ".concat(a)},{value:"2",label:(0,pe.__)("Direct Full Sized Image On Site","nggallery")}],K=(0,$.useMemo)(function(){var e=[];return Array.isArray(q)&&q.length>0&&q.forEach(function(t){e.push({value:String(t.value),label:String(t.label)})}),e},[q]);return ee().createElement("div",{className:"space-y-6"},U?ee().createElement(ee().Fragment,null,ee().createElement("div",{className:"mb-6"},ee().createElement("h3",{className:"text-lg font-semibold text-gray-900 mb-2"},"".concat(a," ").concat((0,pe.__)("Settings","nggallery"))),ee().createElement("p",{className:"text-sm text-gray-600 mb-3"},(0,pe.__)("The settings below adjust the","nggallery")," ",a," ",(0,pe.__)("options for the gallery.","nggallery")),ee().createElement("p",{className:"text-sm text-gray-600"},(0,pe.__)("Need some help?","nggallery")," ",ee().createElement("a",{href:"https://www.imagely.com/docs/".concat(r.toLowerCase(),"-integration/"),target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline"},(0,pe.__)("Read the Documentation","nggallery"))," ",(0,pe.__)("or","nggallery")," ",ee().createElement("a",{href:"https://www.imagely.com/docs/".concat(r.toLowerCase(),"-integration/#video"),target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline"},(0,pe.__)("Watch a Video","nggallery")))),ee().createElement("hr",{className:"border-gray-200 my-6"}),ee().createElement("div",{className:"mb-6"},ee().createElement("div",{className:"mt-2 flex gap-[10px]"},ee().createElement("label",{className:"flex items-center"},ee().createElement("input",{type:"radio",name:"".concat(r,"-settings-mode"),checked:"default"===g,onChange:function(){return Q("default")},className:"mr-2"}),ee().createElement("span",{className:"text-sm text-gray-700"},(0,pe.__)("Default Settings","nggallery"))),ee().createElement("label",{className:"flex items-center"},ee().createElement("input",{type:"radio",name:"".concat(r,"-settings-mode"),checked:"custom"===g,onChange:function(){return Q("custom")},className:"mr-2"}),ee().createElement("span",{className:"text-sm text-gray-700"},(0,pe.__)("Custom Settings","nggallery")))),"default"===g&&ee().createElement("div",{className:"mt-2"},"Use"," ",ee().createElement("a",{href:"#",onClick:function(e){e.preventDefault(),u("imagely-settings","integrations")},className:"text-sm text-blue-600 hover:text-blue-800 underline"},(0,pe.__)("Default Settings","nggallery"))," ","to quickly apply the standard configuration.")),"custom"===g&&ee().createElement("hr",{className:"border-gray-200 my-6"}),"custom"===g&&ee().createElement("div",{className:"space-y-6"},ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"".concat(r,"-account")},"".concat(a," ").concat((0,pe.__)("Account","nggallery")))),ee().createElement("div",null,ee().createElement(sc,{id:"".concat(r,"-account"),name:"".concat(r,"-account"),value:b,onChange:function(e){v(e.target.value),W("account",e.target.value)}},H.map(function(e){return ee().createElement("option",{key:e.value,value:e.value},e.label)})),ee().createElement("p",{className:"text-sm text-gray-600 mt-1"},(0,pe.__)("Choose from any of the","nggallery")," ",ee().createElement("a",{href:"#",className:"underline font-semibold text-[#11A800]"},(0,pe.__)("Authenticated","nggallery")," ",a," ",(0,pe.__)("accounts","nggallery")),"."))),ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"".concat(r,"-num-photos")},"".concat((0,pe.__)("Number of","nggallery")," ").concat(a," ").concat((0,pe.__)("Photos","nggallery")))),ee().createElement("div",null,ee().createElement(uc,{type:"number",id:"".concat(r,"-num-photos"),name:"".concat(r,"-num-photos"),value:w,onChange:function(e){x(e.target.value),W("numPhotos",e.target.value)},min:1}),ee().createElement("p",{className:"text-sm text-gray-600 mt-1"},(0,pe.__)("Choose images to fetch; non-images (For e.g. Videos) won't be included.","nggallery")))),ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"".concat(r,"-overriding-link")},(0,pe.__)("Overriding Link?","nggallery"))),ee().createElement("div",null,ee().createElement(sc,{id:"".concat(r,"-overriding-link"),name:"".concat(r,"-overriding-link"),value:C,onChange:function(e){N(e.target.value),W("overridingLink",e.target.value)}},V.map(function(e){return ee().createElement("option",{key:e.value,value:e.value},e.label)})))),"0"===C&&ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"".concat(r,"-image-size")},(0,pe.__)("Image Size","nggallery"))),ee().createElement("div",null,ee().createElement(sc,{id:"".concat(r,"-image-size"),name:"".concat(r,"-image-size"),value:S,onChange:function(e){O(e.target.value),W("imageSize",e.target.value)}},K.map(function(e){return ee().createElement("option",{key:e.value,value:e.value},e.label)})))),"0"!==C&&ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"".concat(r,"-open-new-tab"),help:"".concat((0,pe.__)("Open the link to","nggallery")," ").concat(a," ").concat((0,pe.__)("in a new browser tab.","nggallery"))},(0,pe.__)("Open in New Tab?","nggallery"))),ee().createElement("div",{className:"flex items-center"},ee().createElement(fs,{id:"".concat(r,"-open-new-tab"),name:"".concat(r,"-open-new-tab"),checked:j,onChange:function(e){T(e.target.checked),W("openInNewTab",e.target.checked)},label:""}))),ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"".concat(r,"-use-photo-title"),help:"".concat((0,pe.__)("Display the photo caption from","nggallery")," ").concat(a," ").concat((0,pe.__)("on the slide.","nggallery"))},(0,pe.__)("Use Photo Title?","nggallery"))),ee().createElement("div",{className:"flex items-center"},ee().createElement(fs,{id:"".concat(r,"-use-photo-title"),name:"".concat(r,"-use-photo-title"),checked:A,onChange:function(e){D(e.target.checked),W("usePhotoTitle",e.target.checked)},label:""}))),A&&ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"".concat(r,"-limit-caption")},(0,pe.__)("Limit Caption Length","nggallery"))),ee().createElement("div",null,ee().createElement(uc,{type:"text",id:"".concat(r,"-limit-caption"),name:"".concat(r,"-limit-caption"),value:F,onChange:function(e){M(e.target.value),W("limitCaptionLength",e.target.value)},placeholder:(0,pe.__)("For e.g. 999","nggallery")}),ee().createElement("p",{className:"text-sm text-gray-600 mt-1"},(0,pe.__)("Limits the number of words to display for each caption.","nggallery")))),ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"".concat(r,"-cache-data"),help:"".concat((0,pe.__)("Caches the data from","nggallery")," ").concat(a," ").concat((0,pe.__)("to improve performance (recommended).","nggallery"))},"".concat((0,pe.__)("Cache Data from","nggallery")," ").concat(a,"?"))),ee().createElement("div",{className:"flex items-center"},ee().createElement(fs,{id:"".concat(r,"-cache-data"),name:"".concat(r,"-cache-data"),checked:G,onChange:function(e){B(e.target.checked),W("cacheData",e.target.checked)},label:""}))))):ee().createElement("div",null,ee().createElement("h2",{className:"text-lg font-semibold text-gray-900 mb-2"},"".concat(a," ").concat((0,pe.__)("Authorization Setup","nggallery"))),ee().createElement("p",{className:"text-sm text-gray-600 mb-3"},"Before you can create ".concat(a," galleries, you need to authenticate Imagely with your ").concat(a," account.")),ee().createElement("p",{className:"text-sm text-gray-600"},ee().createElement("a",{href:"#",onClick:function(e){e.preventDefault(),u("imagely-settings","integrations")},className:"button button-primary"},(0,pe.__)("Click Here to Authenticate Imagely with ".concat(a),"nggallery")))))};function Us(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return qs(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(qs(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,qs(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,qs(m,"constructor",s),qs(s,"constructor",c),c.displayName="GeneratorFunction",qs(s,a,"GeneratorFunction"),qs(m),qs(m,a,"Generator"),qs(m,r,function(){return this}),qs(m,"toString",function(){return"[object Generator]"}),(Us=function(){return{w:o,m:d}})()}function qs(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}qs=function(e,t,n,r){function o(t,n){qs(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},qs(e,t,n,r)}var Qs="https://us-central1-envira-gallery-instagram.cloudfunctions.net/dropbox-iframe";const Ws=function(e){var t=e.galleryId,n=e.galleryTitle,r=e.onSuccess,a=(0,$.useRef)(null),o=vo((0,$.useState)(!1),2),l=o[0],i=o[1],c=(0,ge.useDispatch)(Br),s=$o(),u=s.showSuccess,m=s.showError,d=ee().useCallback(function(e){a.current=e,i(!!e)},[]);return(0,$.useEffect)(function(){if(l){var e=a.current;if(e&&!e.querySelector("iframe")){var t=document.createElement("iframe");t.src=Qs,t.style.cssText="width:100%;height:36px;border:none",e.appendChild(t)}}},[l]),(0,$.useEffect)(function(){var e=function(){var e=No(Us().m(function e(a){var o,l,i,s,d,g,p;return Us().w(function(e){for(;;)switch(e.p=e.n){case 0:if(a.origin===new URL(Qs).origin){e.n=1;break}return e.a(2);case 1:if("dropbox-chooser-success"!==(null===(o=a.data)||void 0===o?void 0:o.type)){e.n=12;break}if(l=a.data.files,t||n){e.n=2;break}return m((0,pe.__)("Please provide a gallery title before importing images.","nggallery")),e.a(2);case 2:if(0!==(i=l.map(function(e){return e.link}).filter(Boolean)).length){e.n=3;break}return m((0,pe.__)("No valid image links found in selected files.","nggallery")),e.a(2);case 3:return s={image_links:i},t?s.gallery_id=t:n&&(s.gallery_title=n),c.setPageLoading(!0),e.p=4,e.n=5,Oo()({path:"/nggpro/v1/dropbox/save-dropbox-image",method:"POST",headers:Do(),data:s});case 5:if(null==(d=e.v)||!d.error){e.n=6;break}throw new Error(d.error);case 6:if(null==d||!d.gallery_id){e.n=8;break}if(u((0,pe.__)("Images imported from Dropbox successfully!","nggallery")),!r){e.n=7;break}return e.n=7,r(d.gallery_id);case 7:e.n=9;break;case 8:throw new Error((0,pe.__)("No gallery ID returned from the import.","nggallery"));case 9:e.n=11;break;case 10:e.p=10,p=e.v,console.error("Error importing Dropbox images:",p),g=(null==p?void 0:p.message)||(0,pe.__)("Failed to import images from Dropbox. Please try again.","nggallery"),m(g);case 11:return e.p=11,c.setPageLoading(!1),e.f(11);case 12:return e.a(2)}},e,null,[[4,10,11,12]])}));return function(t){return e.apply(this,arguments)}}();return window.addEventListener("message",e),function(){return window.removeEventListener("message",e)}},[c,t,n,r,u,m]),ee().createElement("div",{className:"space-y-2"},ee().createElement("p",{className:"text-sm text-gray-600"},(0,pe.__)("Click the button below to select images from Dropbox","nggallery")),ee().createElement("div",{ref:d,id:"imagely-dropbox-chooser-container","aria-label":(0,pe.__)("Import from Dropbox","nggallery")}))};function Hs(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Vs(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Hs(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Hs(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Ks(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return Xs(e,t);var n={}.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)?Xs(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,l=!0,i=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return l=e.done,e},e:function(e){i=!0,o=e},f:function(){try{l||null==n.return||n.return()}finally{if(i)throw o}}}}function Xs(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ys(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return Zs(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Zs(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Zs(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,Zs(m,"constructor",s),Zs(s,"constructor",c),c.displayName="GeneratorFunction",Zs(s,a,"GeneratorFunction"),Zs(m),Zs(m,a,"Generator"),Zs(m,r,function(){return this}),Zs(m,"toString",function(){return"[object Generator]"}),(Ys=function(){return{w:o,m:d}})()}function Zs(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}Zs=function(e,t,n,r){function o(t,n){Zs(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Zs(e,t,n,r)}var Js={oauthUrl:function(e,t){return["google-photos","oauth-url",e,t]},accounts:["google-photos","accounts"],pickerSession:function(e){return["google-photos","picker","session",e]},pickerMediaItems:function(e){return["google-photos","picker","media-items",e]}},$s=function(){var e,t=(!(arguments.length>0&&void 0!==arguments[0])||arguments[0])&&"pro"===zr;return sl({queryKey:Js.accounts,queryFn:(e=No(Ys().m(function e(){var t;return Ys().w(function(e){for(;;)switch(e.n){case 0:return t=Ao(),e.n=1,Oo()({path:"/nggpro/v1/google-photos/accounts",method:"GET",headers:{"X-WP-Nonce":t}});case 1:return e.a(2,e.v)}},e)})),function(){return e.apply(this,arguments)}),enabled:t,staleTime:3e4,gcTime:3e5})},eu=["refresh_token_expired","not_authenticated","ngg_google_photos_not_authenticated","ngg_google_photos_api_client_init_failed"];function tu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function nu(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?tu(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):tu(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var ru=function(e){return e?{title:e.title||"",description:e.galdesc||"",display_type:e.display_type||"",display_type_settings:e.display_type_settings||{},settings:{gallery_display_type:e.display_type,gallery_override_global_settings:!1},imageSettings:{sortBy:"sortorder",sortOrder:"asc",selectedImages:[],searchQuery:""},isDirty:!1,lastSaved:new Date,dirtyFields:new Set}:{title:"",description:"",display_type:"",display_type_settings:{},settings:{},imageSettings:{sortBy:"sortorder",sortOrder:"asc",selectedImages:[],searchQuery:""},isDirty:!1,lastSaved:null,dirtyFields:new Set}},au=function(e,t){switch(t.type){case"INIT_FROM_GALLERY":case"RESET_TO_SAVED":return ru(t.payload);case"UPDATE_FIELD":var r=t.payload,a=r.path,o=function(e,t,n){for(var r=t.split("."),a=nu({},e),o=a,l=0;l<r.length-1;l++){var i=r[l];o[i]=o[i]?nu({},o[i]):{},o=o[i]}return o[r[r.length-1]]=n,a}(e,a,r.value),l=new Set(e.dirtyFields);return l.add(a),nu(nu({},o),{},{isDirty:!0,dirtyFields:l});case"UPDATE_FIELDS":var i=new Set(e.dirtyFields);return Object.keys(t.payload).forEach(function(e){return i.add(e)}),nu(nu(nu({},e),t.payload),{},{isDirty:!0,dirtyFields:i});case"UPDATE_DISPLAY_TYPE_SETTINGS":var c=t.payload,s=c.displayType,u=c.settings,m=nu(nu({},e.display_type_settings),{},n({},s,nu(nu({},e.display_type_settings[s]),u))),d=new Set(e.dirtyFields);return d.add("display_type_settings.".concat(s)),nu(nu({},e),{},{display_type_settings:m,isDirty:!0,dirtyFields:d});case"UPDATE_GALLERY_SETTINGS":var g=new Set(e.dirtyFields);return Object.keys(t.payload).forEach(function(e){return g.add("settings.".concat(e))}),nu(nu({},e),{},{settings:nu(nu({},e.settings),t.payload),isDirty:!0,dirtyFields:g});case"UPDATE_IMAGE_SETTINGS":return nu(nu({},e),{},{imageSettings:nu(nu({},e.imageSettings),t.payload)});case"MARK_CLEAN":return nu(nu({},e),{},{isDirty:!1,lastSaved:new Date,dirtyFields:new Set});default:return e}},ou=(0,$.createContext)(null),lu=function(e){var t=e.children,n=e.initialGallery,r=void 0===n?null:n,a=vo((0,$.useReducer)(au,null,function(){return ru(r)}),2),o=a[0],l=a[1],i=vo((0,$.useState)(!1),2),c=i[0],s=i[1],u=(0,$.useRef)(new Map);(0,$.useEffect)(function(){r&&r.gid&&!o.lastSaved&&l({type:"INIT_FROM_GALLERY",payload:r})},[r,o.lastSaved]);var m=(0,$.useCallback)(function(e,t){l({type:"UPDATE_FIELD",payload:{path:e,value:t}})},[]),d=(0,$.useCallback)(function(e){l({type:"UPDATE_FIELDS",payload:e})},[]),g=(0,$.useCallback)(function(e,t){l({type:"UPDATE_DISPLAY_TYPE_SETTINGS",payload:{displayType:e,settings:t}})},[]),p=(0,$.useCallback)(function(e){l({type:"UPDATE_GALLERY_SETTINGS",payload:e})},[]),f=(0,$.useCallback)(function(e){l({type:"UPDATE_IMAGE_SETTINGS",payload:e})},[]),y=(0,$.useCallback)(function(e){l({type:"INIT_FROM_GALLERY",payload:e})},[]),h=(0,$.useCallback)(function(){l({type:"MARK_CLEAN"})},[]),b=(0,$.useCallback)(function(e){l({type:"RESET_TO_SAVED",payload:e})},[]),v=(0,$.useCallback)(function(){return Array.from(o.dirtyFields)},[o.dirtyFields]),_=(0,$.useCallback)(function(e){var t=e||o.display_type;return o.display_type_settings[t]||{}},[o.display_type_settings,o.display_type]),w=(0,$.useCallback)(function(){return _()},[_]),x=(0,$.useCallback)(function(e,t){u.current.set(e,t)},[]),E=(0,$.useCallback)(function(e){u.current.delete(e)},[]),C=(0,$.useCallback)(function(){u.current.forEach(function(e){try{e()}catch(e){console.error("Error flushing pending save:",e)}})},[]),N=(0,$.useMemo)(function(){return{state:o,updateField:m,updateFields:d,updateDisplayTypeSettings:g,updateGallerySettings:p,updateImageSettings:f,initFromGallery:y,markClean:h,resetToSaved:b,getDirtyFields:v,getDisplayTypeSettings:_,getCurrentDisplayTypeSettings:w,registerFlushCallback:x,unregisterFlushCallback:E,flushAllPendingSaves:C,isNextDisabled:c,setNextDisabled:s}},[o,m,d,g,p,f,y,h,b,v,_,w,x,E,C,c,s]);return ee().createElement(ou.Provider,{value:N},t)},iu=function(){var e=(0,$.useContext)(ou);if(!e)throw new Error("useGalleryForm must be used within a GalleryFormProvider. This indicates a component structure issue that should be fixed.");return e};function cu(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return su(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(su(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,su(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,su(m,"constructor",s),su(s,"constructor",c),c.displayName="GeneratorFunction",su(s,a,"GeneratorFunction"),su(m),su(m,a,"Generator"),su(m,r,function(){return this}),su(m,"toString",function(){return"[object Generator]"}),(cu=function(){return{w:o,m:d}})()}function su(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}su=function(e,t,n,r){function o(t,n){su(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},su(e,t,n,r)}var uu="ngg_google_photos_pending";function mu(e){if(!e||/\/autoclose(\?|#|$)/.test(e))return e;try{var t=new URL(e);return t.pathname.endsWith("/autoclose")?e:(t.pathname="".concat(t.pathname.replace(/\/$/,""),"/autoclose"),t.toString())}catch(t){return e}}const du=function(e){var t,n,r,a,o,l,i,c,s,u=e.integrationName,m=e.galleryId,d=Cs().navigateTo,g=(0,ge.useDispatch)(Br),p=$o(),f=p.showSuccess,y=p.showError,h=$s(!0).data,b=null!==(t=null==h?void 0:h.accounts)&&void 0!==t?t:[],v=b.length>0,_=vo((0,$.useState)(1),2),w=_[0],x=_[1];(0,$.useEffect)(function(){b.length>0&&x(b[0].slot)},[h]);var E=(0,$.useRef)(null);(0,$.useEffect)(function(){null!==E.current?E.current!==w&&(E.current=w,sessionStorage.removeItem(uu),S(null),j(w)):E.current=w},[w]);var C,N=vo((0,$.useState)(function(){if("undefined"==typeof window||!m)return null;try{var e=sessionStorage.getItem(uu);if(!e)return null;var t=JSON.parse(e),n=t.sessionId;return t.galleryId===m?n:null}catch(e){return null}}),2),k=N[0],S=N[1],O=vo((0,$.useState)(function(){if("undefined"==typeof window||!m)return 1;try{var e=sessionStorage.getItem(uu);if(!e)return 1;var t=JSON.parse(e),n=t.sessionId,r=t.galleryId,a=t.accountSlot;return r===m&&n&&"number"==typeof a&&a>=1&&a<=3?a:1}catch(e){return 1}}),2),P=O[0],j=O[1],T=re(),I=function(){var e,t=re();return gl({mutationFn:(e=No(Ys().m(function e(t){var n,r;return Ys().w(function(e){for(;;)switch(e.n){case 0:return n=Ao(),r=void 0!==t?"/nggpro/v1/google-photos/picker/create-session?account_id=".concat(t):"/nggpro/v1/google-photos/picker/create-session",e.n=1,Oo()({path:r,method:"POST",headers:{"X-WP-Nonce":n,"Content-Type":"application/json"},data:{}});case 1:return e.a(2,e.v)}},e)})),function(t){return e.apply(this,arguments)}),onSuccess:function(e){var n,r=null!==(n=e.sessionId)&&void 0!==n?n:e.session_id;r&&t.invalidateQueries({queryKey:Js.pickerSession(r)})},onError:function(e){var n,r,a=null!==(n=null==e?void 0:e.code)&&void 0!==n?n:"",o=(null!==(r=null==e?void 0:e.message)&&void 0!==r?r:"").toLowerCase();(eu.includes(a)||o.includes("session has expired")||o.includes("reconnect"))&&t.invalidateQueries({queryKey:Js.accounts})}})}(),A=gl({mutationFn:(C=No(Ys().m(function e(t){var n,r,a,o,l,i,c,s,u,m,d,g,p,f,y,h,b,v;return Ys().w(function(e){for(;;)switch(e.n){case 0:if(n=t.galleryId,r=t.mediaItems,a=t.accountId,o=void 0===a?1:a,l=Ao(),0!==(i=r.length)){e.n=1;break}return e.a(2,{success:!1,imported:[],failed:[],summary:{total:0,imported:0,failed:0}});case 1:c={success:!1,imported:[],failed:[],summary:{total:i,imported:0,failed:0}},u=0,m=0;case 2:if(!(m<i)){e.n=5;break}return p=r.slice(m,m+10),e.n=3,Oo()({path:"/nggpro/v1/google-photos/import",method:"POST",headers:{"X-WP-Nonce":l,"Content-Type":"application/json"},data:{gallery_id:n,media_items:p,account_id:o}});case 3:if(f=e.v,null!==(d=f.imported)&&void 0!==d&&d.length&&(y=c.imported).push.apply(y,ko(f.imported)),null!==(g=f.failed)&&void 0!==g&&g.length){h=Ks(f.failed);try{for(h.s();!(b=h.n()).done;)v=b.value,c.failed.push(Vs(Vs({},v),{},{index:"number"==typeof v.index?v.index+u:v.index}))}catch(e){h.e(e)}finally{h.f()}}f.success&&(c.success=!0),!s&&f.first_failure_reason&&(s=f.first_failure_reason),u+=p.length;case 4:m+=10,e.n=2;break;case 5:return c.summary={total:i,imported:c.imported.length,failed:c.failed.length},s&&(c.first_failure_reason=s),e.a(2,c)}},e)})),function(e){return C.apply(this,arguments)})}),D=!!k&&("undefined"==typeof window||null!==sessionStorage.getItem(uu)),L=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2?arguments[2]:void 0;return sl({queryKey:Js.pickerSession(e),queryFn:(t=No(Ys().m(function t(){var n,a,o;return Ys().w(function(t){for(;;)switch(t.n){case 0:return n=Ao(),a=encodeURIComponent(e),o=void 0!==r?"?account_id=".concat(r):"",t.n=1,Oo()({path:"/nggpro/v1/google-photos/picker/session/".concat(a).concat(o),method:"GET",headers:{"X-WP-Nonce":n}});case 1:return t.a(2,t.v)}},t)})),function(){return t.apply(this,arguments)}),enabled:n&&!!e,refetchInterval:function(e){var t,n,r=e.state.data;return!((null==r?void 0:r.media_items_set)||(null==r?void 0:r.mediaItemsSet)||(null==r||null===(t=r.session)||void 0===t?void 0:t.media_items_set)||(null==r||null===(n=r.session)||void 0===n?void 0:n.mediaItemsSet))&&1e3},refetchIntervalInBackground:!0,refetchOnWindowFocus:!0,staleTime:0,gcTime:0})}(k,D,P),F=L.data,M=null!==(n=null!==(r=null!==(a=null!==(o=null==F?void 0:F.media_items_set)&&void 0!==o?o:null==F?void 0:F.mediaItemsSet)&&void 0!==a?a:null==F||null===(l=F.session)||void 0===l?void 0:l.media_items_set)&&void 0!==r?r:null==F||null===(i=F.session)||void 0===i?void 0:i.mediaItemsSet)&&void 0!==n&&n,R=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2?arguments[2]:void 0;return sl({queryKey:Js.pickerMediaItems(e),queryFn:(t=No(Ys().m(function t(){var n,a,o;return Ys().w(function(t){for(;;)switch(t.n){case 0:return n=Ao(),a=encodeURIComponent(e),o=void 0!==r?"?account_id=".concat(r):"",t.n=1,Oo()({path:"/nggpro/v1/google-photos/picker/session/".concat(a,"/media-items").concat(o),method:"GET",headers:{"X-WP-Nonce":n}});case 1:return t.a(2,t.v)}},t)})),function(){return t.apply(this,arguments)}),enabled:n&&!!e,staleTime:0,gcTime:0})}(k,D&&M,P),G=R.data,B=null!==(c=null!==(s=null==G?void 0:G.media_items)&&void 0!==s?s:null==G?void 0:G.mediaItems)&&void 0!==c?c:[],z=(0,$.useRef)(!1),U=(0,$.useRef)(null),q=iu().setNextDisabled;(0,$.useEffect)(function(){return q(I.isPending||A.isPending||!!k),function(){return q(!1)}},[I.isPending,A.isPending,k]),(0,$.useEffect)(function(){if(m&&"undefined"!=typeof window){var e=function(){try{var e=sessionStorage.getItem(uu);if(!e)return;var t=JSON.parse(e);if(t.galleryId!==m||!t.sessionId)return;S(t.sessionId);var n=t.accountSlot;"number"==typeof n&&n>=1&&n<=3&&j(n),T.refetchQueries({queryKey:Js.pickerSession(t.sessionId)})}catch(e){}};return window.addEventListener("focus",e),function(){return window.removeEventListener("focus",e)}}},[m,T]),(0,$.useEffect)(function(){return function(){var e=U.current;if(e&&"boolean"==typeof e.closed&&!e.closed)try{e.close()}catch(e){}U.current=null}},[]),(0,$.useEffect)(function(){if(M){var e=U.current;if(e&&"boolean"==typeof e.closed&&!e.closed)try{e.close()}catch(e){}U.current=null}},[M]),(0,$.useEffect)(function(){m&&k&&M&&0!==B.length&&!z.current&&(z.current=!0,A.mutateAsync({galleryId:m,mediaItems:B,accountId:P}).then(function(e){sessionStorage.removeItem(uu),S(null),j(1),z.current=!1,d("imagely-add-new","images",m),g.setActiveModal(null),T.refetchQueries({queryKey:["galleries"],type:"all"}),T.invalidateQueries({queryKey:["gallery",m]}),T.invalidateQueries({queryKey:["gallery",m,"images"]});var t,n=e.summary,r=n.imported,a=n.failed;0===r?y(null!==(t=e.first_failure_reason)&&void 0!==t?t:(0,pe.__)("No photos could be imported from Google Photos. Please try again.","nggallery")):f(a>0?(0,pe.sprintf)((0,pe.__)("%1$d photo(s) imported from Google Photos. %2$d could not be imported.","nggallery"),r,a):(0,pe.__)("Photos imported from Google Photos.","nggallery"))}).catch(function(e){var t;sessionStorage.removeItem(uu),S(null),j(1),z.current=!1,y(null!==(t=null==e?void 0:e.message)&&void 0!==t?t:(0,pe.__)("Failed to import from Google Photos. Please try again.","nggallery"))}))},[m,k,M,B.length,P]);var Q=function(){var e=No(cu().m(function e(){var t,n,r,a,o,l,i,c;return cu().w(function(e){for(;;)switch(e.p=e.n){case 0:if("pro"===zr){e.n=1;break}return g.setActiveModal("upgrade",{feature:"Google Photos"}),e.a(2);case 1:if(m){e.n=2;break}return e.a(2);case 2:return e.p=2,e.n=3,I.mutateAsync(w);case 3:if(o=e.v,l=null!==(t=null==o?void 0:o.pickerUri)&&void 0!==t?t:null==o?void 0:o.picker_uri){e.n=4;break}return y((0,pe.__)("Could not open Google Photos Picker. Please try again.","nggallery")),e.a(2);case 4:if(i=mu(l),j(w),sessionStorage.setItem(uu,JSON.stringify({sessionId:null!==(n=o.sessionId)&&void 0!==n?n:o.session_id,galleryId:m,accountSlot:w})),S(null!==(r=null!==(a=o.sessionId)&&void 0!==a?a:o.session_id)&&void 0!==r?r:null),c=window.open(i,"_blank")){e.n=5;break}return sessionStorage.removeItem(uu),S(null),y((0,pe.__)("Your browser blocked the Google Photos window. Allow popups for this site and try again.","nggallery")),e.a(2);case 5:try{c.opener=null}catch(e){}c.focus(),U.current=c,e.n=7;break;case 6:e.p=6,e.v,y((0,pe.__)("Failed to open Google Photos Picker. Please try again.","nggallery"));case 7:return e.a(2)}},e,null,[[2,6]])}));return function(){return e.apply(this,arguments)}}();return ee().createElement("div",{className:"space-y-6"},v?ee().createElement(ee().Fragment,null,ee().createElement("h2",{className:"text-lg font-semibold text-gray-900 mb-2"},"".concat(u," ").concat((0,pe.__)("Settings","nggallery"))),ee().createElement("p",{className:"text-sm text-gray-600 mb-3"},(0,pe.__)("You are connected to Google Photos.","nggallery")," ",(0,pe.__)("Add photos from your Google Photos library using the Picker.","nggallery")),k&&!A.isPending&&ee().createElement("p",{className:"text-sm text-blue-600 mb-3",role:"status"},(0,pe.__)("Select photos in the Picker. When you confirm, the Picker tab will close and your photos will import here automatically.","nggallery")),A.isPending&&ee().createElement("div",{className:"flex items-center gap-3 mb-3",role:"status"},ee().createElement(oo,{size:"sm",color:"blue",centerInContainer:!1}),ee().createElement("p",{className:"text-sm text-blue-600"},(0,pe.__)("Importing photos from Google Photos…","nggallery"))),m&&ee().createElement(ee().Fragment,null,b.length>0&&ee().createElement("div",{className:"mb-3 max-w-xs"},ee().createElement("label",{htmlFor:"google-photos-account-select",className:"block text-sm text-gray-700 mb-1"},(0,pe.__)("Google Photos Account","nggallery")),ee().createElement(sc,{id:"google-photos-account-select",name:"google-photos-account-select",value:String(w),onChange:function(e){return x(Number(e.target.value))}},b.map(function(e){return ee().createElement("option",{key:e.slot,value:String(e.slot)},e.user_email||e.user_name||"".concat((0,pe.__)("Account","nggallery")," #").concat(e.slot))}))),ee().createElement("p",{className:"text-sm text-gray-600 mb-3"},ee().createElement("button",{type:"button",onClick:Q,disabled:I.isPending||A.isPending||!!k,className:"button button-primary"},I.isPending?(0,pe.__)("Opening Picker…","nggallery"):(0,pe.__)("Add photos from Google Photos","nggallery")))),ee().createElement("p",{className:"text-sm text-gray-600"},ee().createElement("button",{type:"button",onClick:function(){return d("imagely-settings","integrations")},className:"text-green-600 hover:text-green-700 underline"},(0,pe.sprintf)((0,pe.__)("Manage %s connection in Settings","nggallery"),u)))):ee().createElement("div",null,ee().createElement("h2",{className:"text-lg font-semibold text-gray-900 mb-2"},"".concat(u," ").concat((0,pe.__)("Authorization Setup","nggallery"))),ee().createElement("p",{className:"text-sm text-gray-600 mb-3"},"Before you can create ".concat(u," galleries, you need to authenticate Imagely with your ").concat(u," account.")),ee().createElement("p",{className:"text-sm text-gray-600"},ee().createElement("a",{href:"#",onClick:function(e){e.preventDefault(),d("imagely-settings","integrations")},className:"button button-primary"},(0,pe.__)("Click Here to Authenticate Imagely with ".concat(u),"nggallery")))))};function gu(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return pu(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(pu(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,pu(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,pu(m,"constructor",s),pu(s,"constructor",c),c.displayName="GeneratorFunction",pu(s,a,"GeneratorFunction"),pu(m),pu(m,a,"Generator"),pu(m,r,function(){return this}),pu(m,"toString",function(){return"[object Generator]"}),(gu=function(){return{w:o,m:d}})()}function pu(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}pu=function(e,t,n,r){function o(t,n){pu(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},pu(e,t,n,r)}var fu={tiktokOAuthUrl:function(e){return["tiktok","oauth-url",e]},tiktokAccounts:["tiktok","accounts"]},yu=function(){var e,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return sl({queryKey:fu.tiktokAccounts,queryFn:(e=No(gu().m(function e(){var t;return gu().w(function(e){for(;;)switch(e.n){case 0:return t=Ao(),e.n=1,Oo()({path:"/nggpro/v1/tiktok/accounts",method:"GET",headers:{"X-WP-Nonce":t}});case 1:return e.a(2,e.v)}},e)})),function(){return e.apply(this,arguments)}),enabled:t,staleTime:3e4,gcTime:3e5})},hu=function(){var e,t=vo((0,$.useState)(!1),2),n=t[0],r=t[1],a=vo((0,$.useState)(void 0),2),o=a[0],l=a[1],i=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return sl({queryKey:fu.tiktokOAuthUrl(e),queryFn:(t=No(gu().m(function t(){var n,r;return gu().w(function(t){for(;;)switch(t.n){case 0:return n=Ao(),r=e?"/nggpro/v1/tiktok/oauth-url?return_to=".concat(encodeURIComponent(e)):"/nggpro/v1/tiktok/oauth-url",t.n=1,Oo()({path:r,method:"GET",headers:{"X-WP-Nonce":n}});case 1:return t.a(2,t.v)}},t)})),function(){return t.apply(this,arguments)}),enabled:n,staleTime:0,gcTime:0})}(o,n);return(0,$.useEffect)(function(){var e;null!==(e=i.data)&&void 0!==e&&e.oauth_url&&(window.location.href=i.data.oauth_url)},[null===(e=i.data)||void 0===e?void 0:e.oauth_url]),{handleConnectClick:(0,$.useCallback)(function(){var e=window.location.href;try{var t=new URL(e),n=(t.pathname+t.search).replace(/^\/wp-admin\//,"").replace(/^\//,"");l(n||void 0)}catch(e){console.error("Failed to parse URL:",e),l(void 0)}r(!0)},[]),isLoading:i.isFetching}},bu=function(e){var t=e.integrationName,n=Cs().navigateTo;return ee().createElement("div",null,ee().createElement("h2",{className:"text-lg font-semibold text-gray-900 mb-2"},"".concat(t," ").concat((0,pe.__)("Authorization Setup","nggallery"))),ee().createElement("p",{className:"text-sm text-gray-600 mb-3"},"Before you can create ".concat(t," galleries, you need to authenticate Imagely with your ").concat(t," account.")),ee().createElement("p",{className:"text-sm text-gray-600"},ee().createElement("a",{href:"#",onClick:function(e){e.preventDefault(),n("imagely-settings","integrations")},className:"button button-primary"},(0,pe.__)("Click Here to Authenticate Imagely with ".concat(t),"nggallery"))))},vu={showAccount:!0,showNumber:!0,showLink:!0,showImageSize:!0,showLinkTarget:!0,showCaption:!0,showCaptionLength:!0,showCache:!0,showPlayButton:!0,defaultNumber:10,defaultLink:0,defaultImageSize:"default",defaultLinkTarget:0,defaultCaption:1,defaultCaptionLength:999,defaultCache:1,defaultShowPlayButton:1},_u=[{value:"default",label:(0,pe.__)("Default","nggallery")},{value:"thumbnail",label:(0,pe.__)("Thumbnail","nggallery")},{value:"medium",label:(0,pe.__)("Medium","nggallery")},{value:"large",label:(0,pe.__)("Large","nggallery")},{value:"full",label:(0,pe.__)("Full Size","nggallery")}],wu={account:"_account",numPhotos:"_number",overridingLink:"_link",imageSize:"_image_size",openInNewTab:"_link_target",usePhotoTitle:"_caption",limitCaptionLength:"_caption_length",cacheData:"_cache",showPlayButton:"_show_play_button"},xu=function(e){var t=e.integrationType,n=e.integrationName,r=e.config,a=e.state,o=e.accountOptions,l=e.onUpdateField,i=function(e){return[{value:"0",label:(0,pe.__)("No link (Use Lightbox If Enabled)","nggallery")},{value:"1",label:(0,pe.__)("Original Page at","nggallery")+" ".concat(e)},{value:"2",label:(0,pe.__)("Direct Full Sized Video On Site","nggallery")}]}(n);return ee().createElement("div",{className:"space-y-6"},r.showAccount&&ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"".concat(t,"-account")},"".concat(n," ").concat((0,pe.__)("Account","nggallery")))),ee().createElement("div",null,ee().createElement(sc,{id:"".concat(t,"-account"),name:"".concat(t,"-account"),value:a.account,onChange:function(e){return l("account",e.target.value)}},o.map(function(e){return ee().createElement("option",{key:e.value,value:e.value},e.label)})),ee().createElement("p",{className:"text-sm text-gray-600 mt-1"},(0,pe.__)("Choose from any of the","nggallery")," ",ee().createElement("a",{href:"#",className:"underline font-semibold text-[#11A800]"},(0,pe.__)("Authenticated","nggallery")," ",n," ",(0,pe.__)("accounts","nggallery")),"."))),r.showNumber&&ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"".concat(t,"-num-photos")},"".concat((0,pe.__)("No. of","nggallery")," ").concat(n," ").concat((0,pe.__)("Videos","nggallery")))),ee().createElement("div",null,ee().createElement(uc,{type:"number",id:"".concat(t,"-num-photos"),name:"".concat(t,"-num-photos"),value:a.numPhotos,onChange:function(e){return l("numPhotos",e.target.value)},min:1}),ee().createElement("p",{className:"text-sm text-gray-600 mt-1"},(0,pe.__)("Choose the number of videos to fetch from TikTok.","nggallery")))),r.showLink&&ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"".concat(t,"-overriding-link")},(0,pe.__)("Overriding Link?","nggallery"))),ee().createElement("div",null,ee().createElement(sc,{id:"".concat(t,"-overriding-link"),name:"".concat(t,"-overriding-link"),value:a.overridingLink,onChange:function(e){return l("overridingLink",e.target.value)}},i.map(function(e){return ee().createElement("option",{key:e.value,value:e.value},e.label)})))),r.showImageSize&&"0"===a.overridingLink&&ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"".concat(t,"-image-size")},(0,pe.__)("Image Size","nggallery"))),ee().createElement("div",null,ee().createElement(sc,{id:"".concat(t,"-image-size"),name:"".concat(t,"-image-size"),value:a.imageSize,onChange:function(e){return l("imageSize",e.target.value)}},_u.map(function(e){return ee().createElement("option",{key:e.value,value:e.value},e.label)})))),r.showLinkTarget&&"0"!==a.overridingLink&&ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"".concat(t,"-open-new-tab"),help:"".concat((0,pe.__)("Open the link to","nggallery")," ").concat(n," ").concat((0,pe.__)("in a new browser tab.","nggallery"))},(0,pe.__)("Open in New Tab?","nggallery"))),ee().createElement("div",{className:"flex items-center"},ee().createElement(fs,{id:"".concat(t,"-open-new-tab"),name:"".concat(t,"-open-new-tab"),checked:a.openInNewTab,onChange:function(e){return l("openInNewTab",e.target.checked)},label:""}))),r.showCaption&&ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"".concat(t,"-use-photo-title"),help:"".concat((0,pe.__)("Display the photo caption from","nggallery")," ").concat(n," ").concat((0,pe.__)("on the slide.","nggallery"))},(0,pe.__)("Use Photo Title?","nggallery"))),ee().createElement("div",{className:"flex items-center"},ee().createElement(fs,{id:"".concat(t,"-use-photo-title"),name:"".concat(t,"-use-photo-title"),checked:a.usePhotoTitle,onChange:function(e){return l("usePhotoTitle",e.target.checked)},label:""}))),r.showCaptionLength&&a.usePhotoTitle&&ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"".concat(t,"-limit-caption")},(0,pe.__)("Limit Caption Length","nggallery"))),ee().createElement("div",null,ee().createElement(uc,{type:"text",id:"".concat(t,"-limit-caption"),name:"".concat(t,"-limit-caption"),value:a.limitCaptionLength,onChange:function(e){return l("limitCaptionLength",e.target.value)},placeholder:(0,pe.__)("For e.g. 999","nggallery")}),ee().createElement("p",{className:"text-sm text-gray-600 mt-1"},(0,pe.__)("Limits the number of words to display for each caption.","nggallery")))),r.showCache&&ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"".concat(t,"-cache-data"),help:"".concat((0,pe.__)("Caches the data from","nggallery")," ").concat(n," ").concat((0,pe.__)("to improve performance (recommended).","nggallery"))},"".concat((0,pe.__)("Cache Data from","nggallery")," ").concat(n,"?"))),ee().createElement("div",{className:"flex items-center"},ee().createElement(fs,{id:"".concat(t,"-cache-data"),name:"".concat(t,"-cache-data"),checked:a.cacheData,onChange:function(e){return l("cacheData",e.target.checked)},label:""}))),r.showPlayButton&&ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"".concat(t,"-show-play-button"),help:(0,pe.__)("Shows a play button overlay on TikTok thumbnails in the gallery.","nggallery")},(0,pe.__)("Show Play Button?","nggallery"))),ee().createElement("div",{className:"flex items-center"},ee().createElement(fs,{id:"".concat(t,"-show-play-button"),name:"".concat(t,"-show-play-button"),checked:a.showPlayButton,onChange:function(e){return l("showPlayButton",e.target.checked)},label:""}))))},Eu=function(e){var t=e.integrationType,n=e.integrationName;return ee().createElement("div",{className:"mb-6"},ee().createElement("h3",{className:"text-lg font-semibold text-gray-900 mb-2"},"".concat(n," ").concat((0,pe.__)("Settings","nggallery"))),ee().createElement("p",{className:"text-sm text-gray-600 mb-3"},(0,pe.__)("The settings below adjust the","nggallery")," ",n," ",(0,pe.__)("options for the gallery.","nggallery")),ee().createElement("p",{className:"text-sm text-gray-600"},(0,pe.__)("Need some help?","nggallery")," ",ee().createElement("a",{href:"https://www.imagely.com/docs/".concat(t.toLowerCase(),"-integration/"),target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline"},(0,pe.__)("Read the Documentation","nggallery"))," ",(0,pe.__)("or","nggallery")," ",ee().createElement("a",{href:"https://www.imagely.com/docs/".concat(t.toLowerCase(),"-integration/#video"),target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline"},(0,pe.__)("Watch a Video","nggallery"))))},Cu=function(e){var t=e.integrationType,n=e.settingsMode,r=e.onModeChange,a=Cs().navigateTo;return ee().createElement("div",{className:"mb-6"},ee().createElement("div",{className:"mt-2 flex gap-[10px]"},ee().createElement("label",{className:"flex items-center"},ee().createElement("input",{type:"radio",name:"".concat(t,"-settings-mode"),checked:"default"===n,onChange:function(){return r("default")},className:"mr-2"}),ee().createElement("span",{className:"text-sm text-gray-700"},(0,pe.__)("Default Settings","nggallery"))),ee().createElement("label",{className:"flex items-center"},ee().createElement("input",{type:"radio",name:"".concat(t,"-settings-mode"),checked:"custom"===n,onChange:function(){return r("custom")},className:"mr-2"}),ee().createElement("span",{className:"text-sm text-gray-700"},(0,pe.__)("Custom Settings","nggallery")))),"default"===n&&ee().createElement("div",{className:"mt-2"},"Use"," ",ee().createElement("a",{href:"#",onClick:function(e){e.preventDefault(),a("imagely-settings","integrations")},className:"text-sm text-blue-600 hover:text-blue-800 underline"},(0,pe.__)("Default Settings","nggallery"))," ","to quickly apply the standard configuration."))};function Nu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ku(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Nu(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Nu(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}const Su=function(e){var t,r=e.integrationType,a=e.integrationName,o=e.externalSource,l=void 0===o?{}:o,i=e.defaultSettings,c=void 0===i?{}:i,s=e.onUpdate,u=(null===(t=yu(!0).data)||void 0===t?void 0:t.accounts)||[],m=u.length>0,d=function(e){var t=e.integrationType,r=e.externalSource,a=e.defaultSettings,o=e.onUpdate,l=vu,i=(0,$.useMemo)(function(){return"custom"===r.settings_mode?"custom":"default"},[r.settings_mode]),c=vo((0,$.useState)(i),2),s=c[0],u=c[1];(0,$.useEffect)(function(){u(i)},[i]);var m=(0,$.useCallback)(function(e,t){return void 0!==r[e]?r[e]:"default"===s&&void 0!==a[e]?a[e]:t},[r,a,s]),d=vo((0,$.useState)(function(){return{account:m("".concat(t,"_account"),""),numPhotos:String(m("".concat(t,"_number"),l.defaultNumber)),overridingLink:String(m("".concat(t,"_link"),l.defaultLink)),imageSize:m("".concat(t,"_image_size"),l.defaultImageSize),openInNewTab:1===m("".concat(t,"_link_target"),l.defaultLinkTarget),usePhotoTitle:1===m("".concat(t,"_caption"),l.defaultCaption),limitCaptionLength:String(m("".concat(t,"_caption_length"),l.defaultCaptionLength)),cacheData:1===m("".concat(t,"_cache"),l.defaultCache),showPlayButton:1===m("".concat(t,"_show_play_button"),l.defaultShowPlayButton)}}),2),g=d[0],p=d[1];(0,$.useEffect)(function(){p({account:m("".concat(t,"_account"),""),numPhotos:String(m("".concat(t,"_number"),l.defaultNumber)),overridingLink:String(m("".concat(t,"_link"),l.defaultLink)),imageSize:m("".concat(t,"_image_size"),l.defaultImageSize),openInNewTab:1===m("".concat(t,"_link_target"),l.defaultLinkTarget),usePhotoTitle:1===m("".concat(t,"_caption"),l.defaultCaption),limitCaptionLength:String(m("".concat(t,"_caption_length"),l.defaultCaptionLength)),cacheData:1===m("".concat(t,"_cache"),l.defaultCache),showPlayButton:1===m("".concat(t,"_show_play_button"),l.defaultShowPlayButton)})},[s,r,a,t,m]);var f=(0,$.useCallback)(function(e){if(u(e),o){var n=ku(ku({},r),{},{settings_mode:e});if("custom"===e){var l="".concat(t,"_account");if(!n[l]){var i=null==a?void 0:a[l];i&&(n[l]=i,p(function(e){return ku(ku({},e),{},{account:String(i)})}))}var c="".concat(t,"_show_play_button"),s=n[c];if(null==s||""===s){var m=null==a?void 0:a[c];null!=m&&""!==m&&(n[c]=m,p(function(e){return ku(ku({},e),{},{showPlayButton:1===Number(m)})}))}}if("default"===e){var d=Object.fromEntries(Object.entries(n).filter(function(e){var t=vo(e,1)[0];return"type"===t||"settings_mode"===t}));o(d)}else o(n)}},[r,a,t,o]),y=(0,$.useCallback)(function(e,n){if("custom"===s){var a=ku(ku({},r),{},{settings_mode:"custom"}),l=wu[e];l&&(a["".concat(t).concat(l)]="openInNewTab"===e||"usePhotoTitle"===e||"cacheData"===e||"showPlayButton"===e?n?1:0:"numPhotos"===e||"limitCaptionLength"===e?parseInt(n)||0:n,null==o||o(a))}},[s,r,t,o]),h=(0,$.useCallback)(function(e,t){p(function(r){return ku(ku({},r),{},n({},e,t))}),y(e,t)},[y]);return{config:l,settingsMode:s,state:g,handleModeChange:f,updateField:h}}({integrationType:r,externalSource:l,defaultSettings:c,onUpdate:s}),g=d.config,p=d.settingsMode,f=d.state,y=d.handleModeChange,h=d.updateField,b=(0,$.useMemo)(function(){return u.map(function(e){return{value:e.username||"slot-".concat(e.slot),label:e.username||(0,pe.__)("Account","nggallery")+" #".concat(e.slot)}})},[u]);return m?ee().createElement("div",{className:"space-y-6"},ee().createElement(Eu,{integrationType:r,integrationName:a}),ee().createElement("hr",{className:"border-gray-200 my-6"}),ee().createElement(Cu,{integrationType:r,settingsMode:p,onModeChange:y}),"custom"===p&&ee().createElement(ee().Fragment,null,ee().createElement("hr",{className:"border-gray-200 my-6"}),ee().createElement(xu,{integrationType:r,integrationName:a,config:g,state:f,accountOptions:b,onUpdateField:h}))):ee().createElement("div",{className:"space-y-6"},ee().createElement(bu,{integrationName:a}))},Ou="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function Pu(e){const t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function ju(e){return"nodeType"in e}function Tu(e){var t,n;return e?Pu(e)?e:ju(e)&&null!=(t=null==(n=e.ownerDocument)?void 0:n.defaultView)?t:window:window}function Iu(e){const{Document:t}=Tu(e);return e instanceof t}function Au(e){return!Pu(e)&&e instanceof Tu(e).HTMLElement}function Du(e){return e instanceof Tu(e).SVGElement}function Lu(e){return e?Pu(e)?e.document:ju(e)?Iu(e)?e:Au(e)||Du(e)?e.ownerDocument:document:document:document}const Fu=Ou?$.useLayoutEffect:$.useEffect;function Mu(e){const t=(0,$.useRef)(e);return Fu(()=>{t.current=e}),(0,$.useCallback)(function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)},[])}function Ru(e,t){void 0===t&&(t=[e]);const n=(0,$.useRef)(e);return Fu(()=>{n.current!==e&&(n.current=e)},t),n}function Gu(e,t){const n=(0,$.useRef)();return(0,$.useMemo)(()=>{const t=e(n.current);return n.current=t,t},[...t])}function Bu(e){const t=Mu(e),n=(0,$.useRef)(null),r=(0,$.useCallback)(e=>{e!==n.current&&(null==t||t(e,n.current)),n.current=e},[]);return[n,r]}function zu(e){const t=(0,$.useRef)();return(0,$.useEffect)(()=>{t.current=e},[e]),t.current}let Uu={};function qu(e,t){return(0,$.useMemo)(()=>{if(t)return t;const n=null==Uu[e]?0:Uu[e]+1;return Uu[e]=n,e+"-"+n},[e,t])}function Qu(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return r.reduce((t,n)=>{const r=Object.entries(n);for(const[n,a]of r){const r=t[n];null!=r&&(t[n]=r+e*a)}return t},{...t})}}const Wu=Qu(1),Hu=Qu(-1);function Vu(e){if(!e)return!1;const{KeyboardEvent:t}=Tu(e.target);return t&&e instanceof t}function Ku(e){if(function(e){if(!e)return!1;const{TouchEvent:t}=Tu(e.target);return t&&e instanceof t}(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return function(e){return"clientX"in e&&"clientY"in e}(e)?{x:e.clientX,y:e.clientY}:null}const Xu=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Xu.Translate.toString(e),Xu.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Yu="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Zu(e){return e.matches(Yu)?e:e.querySelector(Yu)}const Ju={display:"none"};function $u(e){let{id:t,value:n}=e;return ee().createElement("div",{id:t,style:Ju},n)}function em(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;return ee().createElement("div",{id:t,style:{position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":r,"aria-atomic":!0},n)}const tm=(0,$.createContext)(null),nm={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},rm={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function am(e){let{announcements:t=rm,container:n,hiddenTextDescribedById:r,screenReaderInstructions:a=nm}=e;const{announce:o,announcement:l}=function(){const[e,t]=(0,$.useState)("");return{announce:(0,$.useCallback)(e=>{null!=e&&t(e)},[]),announcement:e}}(),i=qu("DndLiveRegion"),[c,s]=(0,$.useState)(!1);if((0,$.useEffect)(()=>{s(!0)},[]),function(e){const t=(0,$.useContext)(tm);(0,$.useEffect)(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}((0,$.useMemo)(()=>({onDragStart(e){let{active:n}=e;o(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&o(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;o(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;o(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;o(t.onDragCancel({active:n,over:r}))}}),[o,t])),!c)return null;const u=ee().createElement(ee().Fragment,null,ee().createElement($u,{id:r,value:a.draggable}),ee().createElement(em,{id:i,announcement:l}));return n?(0,nc.createPortal)(u,n):u}var om;function lm(){}function im(e,t){return(0,$.useMemo)(()=>({sensor:e,options:null!=t?t:{}}),[e,t])}function cm(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return(0,$.useMemo)(()=>[...t].filter(e=>null!=e),[...t])}!function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"}(om||(om={}));const sm=Object.freeze({x:0,y:0});function um(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function mm(e,t){const n=Ku(e);return n?(n.x-t.left)/t.width*100+"% "+(n.y-t.top)/t.height*100+"%":"0 0"}function dm(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function gm(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function pm(e){let{left:t,top:n,height:r,width:a}=e;return[{x:t,y:n},{x:t+a,y:n},{x:t,y:n+r},{x:t+a,y:n+r}]}function fm(e,t){if(!e||0===e.length)return null;const[n]=e;return t?n[t]:n}function ym(e,t,n){return void 0===t&&(t=e.left),void 0===n&&(n=e.top),{x:t+.5*e.width,y:n+.5*e.height}}const hm=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const a=ym(t,t.left,t.top),o=[];for(const e of r){const{id:t}=e,r=n.get(t);if(r){const n=um(ym(r),a);o.push({id:t,data:{droppableContainer:e,value:n}})}}return o.sort(dm)};function bm(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),a=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),l=a-r,i=o-n;if(r<a&&n<o){const n=t.width*t.height,r=e.width*e.height,a=l*i;return Number((a/(n+r-a)).toFixed(4))}return 0}const vm=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const a=[];for(const e of r){const{id:r}=e,o=n.get(r);if(o){const n=bm(o,t);n>0&&a.push({id:r,data:{droppableContainer:e,value:n}})}}return a.sort(gm)};function _m(e,t){const{top:n,left:r,bottom:a,right:o}=t;return n<=e.y&&e.y<=a&&r<=e.x&&e.x<=o}const wm=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(!r)return[];const a=[];for(const e of t){const{id:t}=e,o=n.get(t);if(o&&_m(r,o)){const n=pm(o).reduce((e,t)=>e+um(r,t),0),l=Number((n/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:l}})}}return a.sort(dm)};function xm(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:sm}function Em(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return r.reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}const Cm=Em(1);function Nm(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}const km={ignoreTransform:!1};function Sm(e,t){void 0===t&&(t=km);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:t,transformOrigin:r}=Tu(e).getComputedStyle(e);t&&(n=function(e,t,n){const r=Nm(t);if(!r)return e;const{scaleX:a,scaleY:o,x:l,y:i}=r,c=e.left-l-(1-a)*parseFloat(n),s=e.top-i-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),u=a?e.width/a:e.width,m=o?e.height/o:e.height;return{width:u,height:m,top:s,right:c+u,bottom:s+m,left:c}}(n,t,r))}const{top:r,left:a,width:o,height:l,bottom:i,right:c}=n;return{top:r,left:a,width:o,height:l,bottom:i,right:c}}function Om(e){return Sm(e,{ignoreTransform:!0})}function Pm(e,t){const n=[];return e?function r(a){if(null!=t&&n.length>=t)return n;if(!a)return n;if(Iu(a)&&null!=a.scrollingElement&&!n.includes(a.scrollingElement))return n.push(a.scrollingElement),n;if(!Au(a)||Du(a))return n;if(n.includes(a))return n;const o=Tu(e).getComputedStyle(a);return a!==e&&function(e,t){void 0===t&&(t=Tu(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(e=>{const r=t[e];return"string"==typeof r&&n.test(r)})}(a,o)&&n.push(a),function(e,t){return void 0===t&&(t=Tu(e).getComputedStyle(e)),"fixed"===t.position}(a,o)?n:r(a.parentNode)}(e):n}function jm(e){const[t]=Pm(e,1);return null!=t?t:null}function Tm(e){return Ou&&e?Pu(e)?e:ju(e)?Iu(e)||e===Lu(e).scrollingElement?window:Au(e)?e:null:null:null}function Im(e){return Pu(e)?e.scrollX:e.scrollLeft}function Am(e){return Pu(e)?e.scrollY:e.scrollTop}function Dm(e){return{x:Im(e),y:Am(e)}}var Lm;function Fm(e){return!(!Ou||!e)&&e===document.scrollingElement}function Mm(e){const t={x:0,y:0},n=Fm(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}!function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"}(Lm||(Lm={}));const Rm={x:.2,y:.2};function Gm(e,t,n,r,a){let{top:o,left:l,right:i,bottom:c}=n;void 0===r&&(r=10),void 0===a&&(a=Rm);const{isTop:s,isBottom:u,isLeft:m,isRight:d}=Mm(e),g={x:0,y:0},p={x:0,y:0},f=t.height*a.y,y=t.width*a.x;return!s&&o<=t.top+f?(g.y=Lm.Backward,p.y=r*Math.abs((t.top+f-o)/f)):!u&&c>=t.bottom-f&&(g.y=Lm.Forward,p.y=r*Math.abs((t.bottom-f-c)/f)),!d&&i>=t.right-y?(g.x=Lm.Forward,p.x=r*Math.abs((t.right-y-i)/y)):!m&&l<=t.left+y&&(g.x=Lm.Backward,p.x=r*Math.abs((t.left+y-l)/y)),{direction:g,speed:p}}function Bm(e){if(e===document.scrollingElement){const{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}const{top:t,left:n,right:r,bottom:a}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:a,width:e.clientWidth,height:e.clientHeight}}function zm(e){return e.reduce((e,t)=>Wu(e,Dm(t)),sm)}function Um(e,t){if(void 0===t&&(t=Sm),!e)return;const{top:n,left:r,bottom:a,right:o}=t(e);jm(e)&&(a<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const qm=[["x",["left","right"],function(e){return e.reduce((e,t)=>e+Im(t),0)}],["y",["top","bottom"],function(e){return e.reduce((e,t)=>e+Am(t),0)}]];class Qm{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=Pm(t),r=zm(n);this.rect={...e},this.width=e.width,this.height=e.height;for(const[e,t,a]of qm)for(const o of t)Object.defineProperty(this,o,{get:()=>{const t=a(n),l=r[e]-t;return this.rect[o]+l},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Wm{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)})},this.target=e}add(e,t,n){var r;null==(r=this.target)||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}}function Hm(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return"number"==typeof t?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t&&r>t.y}var Vm,Km;function Xm(e){e.preventDefault()}function Ym(e){e.stopPropagation()}!function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"}(Vm||(Vm={})),function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"}(Km||(Km={}));const Zm={start:[Km.Space,Km.Enter],cancel:[Km.Esc],end:[Km.Space,Km.Enter,Km.Tab]},Jm=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Km.Right:return{...n,x:n.x+25};case Km.Left:return{...n,x:n.x-25};case Km.Down:return{...n,y:n.y+25};case Km.Up:return{...n,y:n.y-25}}};class $m{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new Wm(Lu(t)),this.windowListeners=new Wm(Tu(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Vm.Resize,this.handleCancel),this.windowListeners.add(Vm.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Vm.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&Um(n),t(sm)}handleKeyDown(e){if(Vu(e)){const{active:t,context:n,options:r}=this.props,{keyboardCodes:a=Zm,coordinateGetter:o=Jm,scrollBehavior:l="smooth"}=r,{code:i}=e;if(a.end.includes(i))return void this.handleEnd(e);if(a.cancel.includes(i))return void this.handleCancel(e);const{collisionRect:c}=n.current,s=c?{x:c.left,y:c.top}:sm;this.referenceCoordinates||(this.referenceCoordinates=s);const u=o(e,{active:t,context:n.current,currentCoordinates:s});if(u){const t=Hu(u,s),r={x:0,y:0},{scrollableAncestors:a}=n.current;for(const n of a){const a=e.code,{isTop:o,isRight:i,isLeft:c,isBottom:s,maxScroll:m,minScroll:d}=Mm(n),g=Bm(n),p={x:Math.min(a===Km.Right?g.right-g.width/2:g.right,Math.max(a===Km.Right?g.left:g.left+g.width/2,u.x)),y:Math.min(a===Km.Down?g.bottom-g.height/2:g.bottom,Math.max(a===Km.Down?g.top:g.top+g.height/2,u.y))},f=a===Km.Right&&!i||a===Km.Left&&!c,y=a===Km.Down&&!s||a===Km.Up&&!o;if(f&&p.x!==u.x){const e=n.scrollLeft+t.x,o=a===Km.Right&&e<=m.x||a===Km.Left&&e>=d.x;if(o&&!t.y)return void n.scrollTo({left:e,behavior:l});r.x=o?n.scrollLeft-e:a===Km.Right?n.scrollLeft-m.x:n.scrollLeft-d.x,r.x&&n.scrollBy({left:-r.x,behavior:l});break}if(y&&p.y!==u.y){const e=n.scrollTop+t.y,o=a===Km.Down&&e<=m.y||a===Km.Up&&e>=d.y;if(o&&!t.x)return void n.scrollTo({top:e,behavior:l});r.y=o?n.scrollTop-e:a===Km.Down?n.scrollTop-m.y:n.scrollTop-d.y,r.y&&n.scrollBy({top:-r.y,behavior:l});break}}this.handleMove(e,Wu(Hu(u,this.referenceCoordinates),r))}}}handleMove(e,t){const{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function ed(e){return Boolean(e&&"distance"in e)}function td(e){return Boolean(e&&"delay"in e)}$m.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Zm,onActivation:a}=t,{active:o}=n;const{code:l}=e.nativeEvent;if(r.start.includes(l)){const t=o.activatorNode.current;return!(t&&e.target!==t||(e.preventDefault(),null==a||a({event:e.nativeEvent}),0))}return!1}}];class nd{constructor(e,t,n){var r;void 0===n&&(n=function(e){const{EventTarget:t}=Tu(e);return e instanceof t?e:Lu(e)}(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;const{event:a}=e,{target:o}=a;this.props=e,this.events=t,this.document=Lu(o),this.documentListeners=new Wm(this.document),this.listeners=new Wm(n),this.windowListeners=new Wm(Tu(o)),this.initialCoordinates=null!=(r=Ku(a))?r:sm,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Vm.Resize,this.handleCancel),this.windowListeners.add(Vm.DragStart,Xm),this.windowListeners.add(Vm.VisibilityChange,this.handleCancel),this.windowListeners.add(Vm.ContextMenu,Xm),this.documentListeners.add(Vm.Keydown,this.handleKeydown),t){if(null!=n&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(td(t))return this.timeoutId=setTimeout(this.handleStart,t.delay),void this.handlePending(t);if(ed(t))return void this.handlePending(t)}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){const{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(Vm.Click,Ym,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Vm.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:n,initialCoordinates:r,props:a}=this,{onMove:o,options:{activationConstraint:l}}=a;if(!r)return;const i=null!=(t=Ku(e))?t:sm,c=Hu(r,i);if(!n&&l){if(ed(l)){if(null!=l.tolerance&&Hm(c,l.tolerance))return this.handleCancel();if(Hm(c,l.distance))return this.handleStart()}return td(l)&&Hm(c,l.tolerance)?this.handleCancel():void this.handlePending(l,c)}e.cancelable&&e.preventDefault(),o(i)}handleEnd(){const{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){const{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===Km.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const rd={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class ad extends nd{constructor(e){const{event:t}=e,n=Lu(t.target);super(e,rd,n)}}ad.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!(!n.isPrimary||0!==n.button||(null==r||r({event:n}),0))}}];const od={move:{name:"mousemove"},end:{name:"mouseup"}};var ld;!function(e){e[e.RightClick=2]="RightClick"}(ld||(ld={})),class extends nd{constructor(e){super(e,od,Lu(e.event.target))}}.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button!==ld.RightClick&&(null==r||r({event:n}),!0)}}];const id={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};var cd,sd;(class extends nd{constructor(e){super(e,id)}static setup(){return window.addEventListener(id.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(id.move.name,e)};function e(){}}}).activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:a}=n;return!(a.length>1||(null==r||r({event:n}),0))}}],function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"}(cd||(cd={})),function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"}(sd||(sd={}));const ud={x:{[Lm.Backward]:!1,[Lm.Forward]:!1},y:{[Lm.Backward]:!1,[Lm.Forward]:!1}};var md,dd;!function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"}(md||(md={})),function(e){e.Optimized="optimized"}(dd||(dd={}));const gd=new Map;function pd(e,t){return Gu(n=>e?n||("function"==typeof t?t(e):e):null,[t,e])}function fd(e){let{callback:t,disabled:n}=e;const r=Mu(t),a=(0,$.useMemo)(()=>{if(n||"undefined"==typeof window||void 0===window.ResizeObserver)return;const{ResizeObserver:e}=window;return new e(r)},[n]);return(0,$.useEffect)(()=>()=>null==a?void 0:a.disconnect(),[a]),a}function yd(e){return new Qm(Sm(e),e)}function hd(e,t,n){void 0===t&&(t=yd);const[r,a]=(0,$.useState)(null);function o(){a(r=>{if(!e)return null;var a;if(!1===e.isConnected)return null!=(a=null!=r?r:n)?a:null;const o=t(e);return JSON.stringify(r)===JSON.stringify(o)?r:o})}const l=function(e){let{callback:t,disabled:n}=e;const r=Mu(t),a=(0,$.useMemo)(()=>{if(n||"undefined"==typeof window||void 0===window.MutationObserver)return;const{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,$.useEffect)(()=>()=>null==a?void 0:a.disconnect(),[a]),a}({callback(t){if(e)for(const n of t){const{type:t,target:r}=n;if("childList"===t&&r instanceof HTMLElement&&r.contains(e)){o();break}}}}),i=fd({callback:o});return Fu(()=>{o(),e?(null==i||i.observe(e),null==l||l.observe(document.body,{childList:!0,subtree:!0})):(null==i||i.disconnect(),null==l||l.disconnect())},[e]),r}const bd=[];function vd(e,t){void 0===t&&(t=[]);const n=(0,$.useRef)(null);return(0,$.useEffect)(()=>{n.current=null},t),(0,$.useEffect)(()=>{const t=e!==sm;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?Hu(e,n.current):sm}function _d(e){return(0,$.useMemo)(()=>e?function(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}(e):null,[e])}const wd=[];function xd(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Au(t)?t:e}const Ed=[{sensor:ad,options:{}},{sensor:$m,options:{}}],Cd={current:{}},Nd={draggable:{measure:Om},droppable:{measure:Om,strategy:md.WhileDragging,frequency:dd.Optimized},dragOverlay:{measure:Sm}};class kd extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){var t,n;return null!=(t=null==(n=this.get(e))?void 0:n.node.current)?t:void 0}}const Sd={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new kd,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:lm},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Nd,measureDroppableContainers:lm,windowRect:null,measuringScheduled:!1},Od={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:lm,draggableNodes:new Map,over:null,measureDroppableContainers:lm},Pd=(0,$.createContext)(Od),jd=(0,$.createContext)(Sd);function Td(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new kd}}}function Id(e,t){switch(t.type){case om.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case om.DragMove:return null==e.draggable.active?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case om.DragEnd:case om.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case om.RegisterDroppable:{const{element:n}=t,{id:r}=n,a=new kd(e.droppable.containers);return a.set(r,n),{...e,droppable:{...e.droppable,containers:a}}}case om.SetDroppableDisabled:{const{id:n,key:r,disabled:a}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const l=new kd(e.droppable.containers);return l.set(n,{...o,disabled:a}),{...e,droppable:{...e.droppable,containers:l}}}case om.UnregisterDroppable:{const{id:n,key:r}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;const o=new kd(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function Ad(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:a}=(0,$.useContext)(Pd),o=zu(r),l=zu(null==n?void 0:n.id);return(0,$.useEffect)(()=>{if(!t&&!r&&o&&null!=l){if(!Vu(o))return;if(document.activeElement===o.target)return;const e=a.get(l);if(!e)return;const{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(const e of[t.current,n.current]){if(!e)continue;const t=Zu(e);if(t){t.focus();break}}})}},[r,t,a,l,o]),null}function Dd(e,t){let{transform:n,...r}=t;return null!=e&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}const Ld=(0,$.createContext)({...sm,scaleX:1,scaleY:1});var Fd;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"}(Fd||(Fd={}));const Md=(0,$.memo)(function(e){var t,n,r,a;let{id:o,accessibility:l,autoScroll:i=!0,children:c,sensors:s=Ed,collisionDetection:u=vm,measuring:m,modifiers:d,...g}=e;const p=(0,$.useReducer)(Id,void 0,Td),[f,y]=p,[h,b]=function(){const[e]=(0,$.useState)(()=>new Set),t=(0,$.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,$.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>{var t;return null==(t=e[n])?void 0:t.call(e,r)})},[e]),t]}(),[v,_]=(0,$.useState)(Fd.Uninitialized),w=v===Fd.Initialized,{draggable:{active:x,nodes:E,translate:C},droppable:{containers:N}}=f,k=null!=x?E.get(x):null,S=(0,$.useRef)({initial:null,translated:null}),O=(0,$.useMemo)(()=>{var e;return null!=x?{id:x,data:null!=(e=null==k?void 0:k.data)?e:Cd,rect:S}:null},[x,k]),P=(0,$.useRef)(null),[j,T]=(0,$.useState)(null),[I,A]=(0,$.useState)(null),D=Ru(g,Object.values(g)),L=qu("DndDescribedBy",o),F=(0,$.useMemo)(()=>N.getEnabled(),[N]),M=(R=m,(0,$.useMemo)(()=>({draggable:{...Nd.draggable,...null==R?void 0:R.draggable},droppable:{...Nd.droppable,...null==R?void 0:R.droppable},dragOverlay:{...Nd.dragOverlay,...null==R?void 0:R.dragOverlay}}),[null==R?void 0:R.draggable,null==R?void 0:R.droppable,null==R?void 0:R.dragOverlay]));var R;const{droppableRects:G,measureDroppableContainers:B,measuringScheduled:z}=function(e,t){let{dragging:n,dependencies:r,config:a}=t;const[o,l]=(0,$.useState)(null),{frequency:i,measure:c,strategy:s}=a,u=(0,$.useRef)(e),m=function(){switch(s){case md.Always:return!1;case md.BeforeDragging:return n;default:return!n}}(),d=Ru(m),g=(0,$.useCallback)(function(e){void 0===e&&(e=[]),d.current||l(t=>null===t?e:t.concat(e.filter(e=>!t.includes(e))))},[d]),p=(0,$.useRef)(null),f=Gu(t=>{if(m&&!n)return gd;if(!t||t===gd||u.current!==e||null!=o){const t=new Map;for(let n of e){if(!n)continue;if(o&&o.length>0&&!o.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}const e=n.node.current,r=e?new Qm(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,o,n,m,c]);return(0,$.useEffect)(()=>{u.current=e},[e]),(0,$.useEffect)(()=>{m||g()},[n,m]),(0,$.useEffect)(()=>{o&&o.length>0&&l(null)},[JSON.stringify(o)]),(0,$.useEffect)(()=>{m||"number"!=typeof i||null!==p.current||(p.current=setTimeout(()=>{g(),p.current=null},i))},[i,m,g,...r]),{droppableRects:f,measureDroppableContainers:g,measuringScheduled:null!=o}}(F,{dragging:w,dependencies:[C.x,C.y],config:M.droppable}),U=function(e,t){const n=null!=t?e.get(t):void 0,r=n?n.node.current:null;return Gu(e=>{var n;return null==t?null:null!=(n=null!=r?r:e)?n:null},[r,t])}(E,x),q=(0,$.useMemo)(()=>I?Ku(I):null,[I]),Q=function(){const e=!1===(null==j?void 0:j.autoScrollEnabled),t="object"==typeof i?!1===i.enabled:!1===i,n=w&&!e&&!t;return"object"==typeof i?{...i,enabled:n}:{enabled:n}}(),W=function(e,t){return pd(e,t)}(U,M.draggable.measure);!function(e){let{activeNode:t,measure:n,initialRect:r,config:a=!0}=e;const o=(0,$.useRef)(!1),{x:l,y:i}="boolean"==typeof a?{x:a,y:a}:a;Fu(()=>{if(!l&&!i||!t)return void(o.current=!1);if(o.current||!r)return;const e=null==t?void 0:t.node.current;if(!e||!1===e.isConnected)return;const a=xm(n(e),r);if(l||(a.x=0),i||(a.y=0),o.current=!0,Math.abs(a.x)>0||Math.abs(a.y)>0){const t=jm(e);t&&t.scrollBy({top:a.y,left:a.x})}},[t,l,i,r,n])}({activeNode:null!=x?E.get(x):null,config:Q.layoutShiftCompensation,initialRect:W,measure:M.draggable.measure});const H=hd(U,M.draggable.measure,W),V=hd(U?U.parentElement:null),K=(0,$.useRef)({activatorEvent:null,active:null,activeNode:U,collisionRect:null,collisions:null,droppableRects:G,draggableNodes:E,draggingNode:null,draggingNodeRect:null,droppableContainers:N,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),X=N.getNodeFor(null==(t=K.current.over)?void 0:t.id),Y=function(e){let{measure:t}=e;const[n,r]=(0,$.useState)(null),a=fd({callback:(0,$.useCallback)(e=>{for(const{target:n}of e)if(Au(n)){r(e=>{const r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),o=(0,$.useCallback)(e=>{const n=xd(e);null==a||a.disconnect(),n&&(null==a||a.observe(n)),r(n?t(n):null)},[t,a]),[l,i]=Bu(o);return(0,$.useMemo)(()=>({nodeRef:l,rect:n,setRef:i}),[n,l,i])}({measure:M.dragOverlay.measure}),Z=null!=(n=Y.nodeRef.current)?n:U,J=w?null!=(r=Y.rect)?r:H:null,te=Boolean(Y.nodeRef.current&&Y.rect),ne=xm(re=te?null:H,pd(re));var re;const ae=_d(Z?Tu(Z):null),oe=function(e){const t=(0,$.useRef)(e),n=Gu(n=>e?n&&n!==bd&&e&&t.current&&e.parentNode===t.current.parentNode?n:Pm(e):bd,[e]);return(0,$.useEffect)(()=>{t.current=e},[e]),n}(w?null!=X?X:U:null),le=function(e,t){void 0===t&&(t=Sm);const[n]=e,r=_d(n?Tu(n):null),[a,o]=(0,$.useState)(wd);function l(){o(()=>e.length?e.map(e=>Fm(e)?r:new Qm(t(e),e)):wd)}const i=fd({callback:l});return Fu(()=>{null==i||i.disconnect(),l(),e.forEach(e=>null==i?void 0:i.observe(e))},[e]),a}(oe),ie=Dd(d,{transform:{x:C.x-ne.x,y:C.y-ne.y,scaleX:1,scaleY:1},activatorEvent:I,active:O,activeNodeRect:H,containerNodeRect:V,draggingNodeRect:J,over:K.current.over,overlayNodeRect:Y.rect,scrollableAncestors:oe,scrollableAncestorRects:le,windowRect:ae}),ce=q?Wu(q,C):null,se=function(e){const[t,n]=(0,$.useState)(null),r=(0,$.useRef)(e),a=(0,$.useCallback)(e=>{const t=Tm(e.target);t&&n(e=>e?(e.set(t,Dm(t)),new Map(e)):null)},[]);return(0,$.useEffect)(()=>{const t=r.current;if(e!==t){o(t);const l=e.map(e=>{const t=Tm(e);return t?(t.addEventListener("scroll",a,{passive:!0}),[t,Dm(t)]):null}).filter(e=>null!=e);n(l.length?new Map(l):null),r.current=e}return()=>{o(e),o(t)};function o(e){e.forEach(e=>{const t=Tm(e);null==t||t.removeEventListener("scroll",a)})}},[a,e]),(0,$.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>Wu(e,t),sm):zm(e):sm,[e,t])}(oe),ue=vd(se),me=vd(se,[H]),de=Wu(ie,ue),ge=J?Cm(J,ie):null,pe=O&&ge?u({active:O,collisionRect:ge,droppableRects:G,droppableContainers:F,pointerCoordinates:ce}):null,fe=fm(pe,"id"),[ye,he]=(0,$.useState)(null),be=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(te?ie:Wu(ie,me),null!=(a=null==ye?void 0:ye.rect)?a:null,H),ve=(0,$.useRef)(null),_e=(0,$.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(null==P.current)return;const a=E.get(P.current);if(!a)return;const o=e.nativeEvent,l=new n({active:P.current,activeNode:a,event:o,options:r,context:K,onAbort(e){if(!E.get(e))return;const{onDragAbort:t}=D.current,n={id:e};null==t||t(n),h({type:"onDragAbort",event:n})},onPending(e,t,n,r){if(!E.get(e))return;const{onDragPending:a}=D.current,o={id:e,constraint:t,initialCoordinates:n,offset:r};null==a||a(o),h({type:"onDragPending",event:o})},onStart(e){const t=P.current;if(null==t)return;const n=E.get(t);if(!n)return;const{onDragStart:r}=D.current,a={activatorEvent:o,active:{id:t,data:n.data,rect:S}};(0,nc.unstable_batchedUpdates)(()=>{null==r||r(a),_(Fd.Initializing),y({type:om.DragStart,initialCoordinates:e,active:t}),h({type:"onDragStart",event:a}),T(ve.current),A(o)})},onMove(e){y({type:om.DragMove,coordinates:e})},onEnd:i(om.DragEnd),onCancel:i(om.DragCancel)});function i(e){return async function(){const{active:t,collisions:n,over:r,scrollAdjustedTranslate:a}=K.current;let l=null;if(t&&a){const{cancelDrop:i}=D.current;l={activatorEvent:o,active:t,collisions:n,delta:a,over:r},e===om.DragEnd&&"function"==typeof i&&await Promise.resolve(i(l))&&(e=om.DragCancel)}P.current=null,(0,nc.unstable_batchedUpdates)(()=>{y({type:e}),_(Fd.Uninitialized),he(null),T(null),A(null),ve.current=null;const t=e===om.DragEnd?"onDragEnd":"onDragCancel";if(l){const e=D.current[t];null==e||e(l),h({type:t,event:l})}})}}ve.current=l},[E]),we=(0,$.useCallback)((e,t)=>(n,r)=>{const a=n.nativeEvent,o=E.get(r);if(null!==P.current||!o||a.dndKit||a.defaultPrevented)return;const l={active:o};!0===e(n,t.options,l)&&(a.dndKit={capturedBy:t.sensor},P.current=r,_e(n,t))},[E,_e]),xe=function(e,t){return(0,$.useMemo)(()=>e.reduce((e,n)=>{const{sensor:r}=n;return[...e,...r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}))]},[]),[e,t])}(s,we);!function(e){(0,$.useEffect)(()=>{if(!Ou)return;const t=e.map(e=>{let{sensor:t}=e;return null==t.setup?void 0:t.setup()});return()=>{for(const e of t)null==e||e()}},e.map(e=>{let{sensor:t}=e;return t}))}(s),Fu(()=>{H&&v===Fd.Initializing&&_(Fd.Initialized)},[H,v]),(0,$.useEffect)(()=>{const{onDragMove:e}=D.current,{active:t,activatorEvent:n,collisions:r,over:a}=K.current;if(!t||!n)return;const o={active:t,activatorEvent:n,collisions:r,delta:{x:de.x,y:de.y},over:a};(0,nc.unstable_batchedUpdates)(()=>{null==e||e(o),h({type:"onDragMove",event:o})})},[de.x,de.y]),(0,$.useEffect)(()=>{const{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:a}=K.current;if(!e||null==P.current||!t||!a)return;const{onDragOver:o}=D.current,l=r.get(fe),i=l&&l.rect.current?{id:l.id,rect:l.rect.current,data:l.data,disabled:l.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:a.x,y:a.y},over:i};(0,nc.unstable_batchedUpdates)(()=>{he(i),null==o||o(c),h({type:"onDragOver",event:c})})},[fe]),Fu(()=>{K.current={activatorEvent:I,active:O,activeNode:U,collisionRect:ge,collisions:pe,droppableRects:G,draggableNodes:E,draggingNode:Z,draggingNodeRect:J,droppableContainers:N,over:ye,scrollableAncestors:oe,scrollAdjustedTranslate:de},S.current={initial:J,translated:ge}},[O,U,pe,ge,E,Z,J,G,N,ye,oe,de]),function(e){let{acceleration:t,activator:n=cd.Pointer,canScroll:r,draggingRect:a,enabled:o,interval:l=5,order:i=sd.TreeOrder,pointerCoordinates:c,scrollableAncestors:s,scrollableAncestorRects:u,delta:m,threshold:d}=e;const g=function(e){let{delta:t,disabled:n}=e;const r=zu(t);return Gu(e=>{if(n||!r||!e)return ud;const a=Math.sign(t.x-r.x),o=Math.sign(t.y-r.y);return{x:{[Lm.Backward]:e.x[Lm.Backward]||-1===a,[Lm.Forward]:e.x[Lm.Forward]||1===a},y:{[Lm.Backward]:e.y[Lm.Backward]||-1===o,[Lm.Forward]:e.y[Lm.Forward]||1===o}}},[n,t,r])}({delta:m,disabled:!o}),[p,f]=function(){const e=(0,$.useRef)(null);return[(0,$.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,$.useCallback)(()=>{null!==e.current&&(clearInterval(e.current),e.current=null)},[])]}(),y=(0,$.useRef)({x:0,y:0}),h=(0,$.useRef)({x:0,y:0}),b=(0,$.useMemo)(()=>{switch(n){case cd.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case cd.DraggableRect:return a}},[n,a,c]),v=(0,$.useRef)(null),_=(0,$.useCallback)(()=>{const e=v.current;if(!e)return;const t=y.current.x*h.current.x,n=y.current.y*h.current.y;e.scrollBy(t,n)},[]),w=(0,$.useMemo)(()=>i===sd.TreeOrder?[...s].reverse():s,[i,s]);(0,$.useEffect)(()=>{if(o&&s.length&&b){for(const e of w){if(!1===(null==r?void 0:r(e)))continue;const n=s.indexOf(e),a=u[n];if(!a)continue;const{direction:o,speed:i}=Gm(e,a,b,t,d);for(const e of["x","y"])g[e][o[e]]||(i[e]=0,o[e]=0);if(i.x>0||i.y>0)return f(),v.current=e,p(_,l),y.current=i,void(h.current=o)}y.current={x:0,y:0},h.current={x:0,y:0},f()}else f()},[t,_,r,f,o,l,JSON.stringify(b),JSON.stringify(g),p,s,w,u,JSON.stringify(d)])}({...Q,delta:C,draggingRect:ge,pointerCoordinates:ce,scrollableAncestors:oe,scrollableAncestorRects:le});const Ee=(0,$.useMemo)(()=>({active:O,activeNode:U,activeNodeRect:H,activatorEvent:I,collisions:pe,containerNodeRect:V,dragOverlay:Y,draggableNodes:E,droppableContainers:N,droppableRects:G,over:ye,measureDroppableContainers:B,scrollableAncestors:oe,scrollableAncestorRects:le,measuringConfiguration:M,measuringScheduled:z,windowRect:ae}),[O,U,H,I,pe,V,Y,E,N,G,ye,B,oe,le,M,z,ae]),Ce=(0,$.useMemo)(()=>({activatorEvent:I,activators:xe,active:O,activeNodeRect:H,ariaDescribedById:{draggable:L},dispatch:y,draggableNodes:E,over:ye,measureDroppableContainers:B}),[I,xe,O,H,y,L,E,ye,B]);return ee().createElement(tm.Provider,{value:b},ee().createElement(Pd.Provider,{value:Ce},ee().createElement(jd.Provider,{value:Ee},ee().createElement(Ld.Provider,{value:be},c)),ee().createElement(Ad,{disabled:!1===(null==l?void 0:l.restoreFocus)})),ee().createElement(am,{...l,hiddenTextDescribedById:L}))}),Rd=(0,$.createContext)(null),Gd="button";function Bd(){return(0,$.useContext)(jd)}const zd={timeout:25};function Ud(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:a}=e;const o=qu("Droppable"),{active:l,dispatch:i,over:c,measureDroppableContainers:s}=(0,$.useContext)(Pd),u=(0,$.useRef)({disabled:n}),m=(0,$.useRef)(!1),d=(0,$.useRef)(null),g=(0,$.useRef)(null),{disabled:p,updateMeasurementsFor:f,timeout:y}={...zd,...a},h=Ru(null!=f?f:r),b=fd({callback:(0,$.useCallback)(()=>{m.current?(null!=g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{s(Array.isArray(h.current)?h.current:[h.current]),g.current=null},y)):m.current=!0},[y]),disabled:p||!l}),v=(0,$.useCallback)((e,t)=>{b&&(t&&(b.unobserve(t),m.current=!1),e&&b.observe(e))},[b]),[_,w]=Bu(v),x=Ru(t);return(0,$.useEffect)(()=>{b&&_.current&&(b.disconnect(),m.current=!1,b.observe(_.current))},[_,b]),(0,$.useEffect)(()=>(i({type:om.RegisterDroppable,element:{id:r,key:o,disabled:n,node:_,rect:d,data:x}}),()=>i({type:om.UnregisterDroppable,key:o,id:r})),[r]),(0,$.useEffect)(()=>{n!==u.current.disabled&&(i({type:om.SetDroppableDisabled,id:r,key:o,disabled:n}),u.current.disabled=n)},[r,o,n,i]),{active:l,rect:d,isOver:(null==c?void 0:c.id)===r,node:_,over:c,setNodeRef:w}}function qd(e){let{animation:t,children:n}=e;const[r,a]=(0,$.useState)(null),[o,l]=(0,$.useState)(null),i=zu(n);return n||r||!i||a(i),Fu(()=>{if(!o)return;const e=null==r?void 0:r.key,n=null==r?void 0:r.props.id;null!=e&&null!=n?Promise.resolve(t(n,o)).then(()=>{a(null)}):a(null)},[t,r,o]),ee().createElement(ee().Fragment,null,n,r?(0,$.cloneElement)(r,{ref:l}):null)}const Qd={x:0,y:0,scaleX:1,scaleY:1};function Wd(e){let{children:t}=e;return ee().createElement(Pd.Provider,{value:Od},ee().createElement(Ld.Provider,{value:Qd},t))}const Hd={position:"fixed",touchAction:"none"},Vd=e=>Vu(e)?"transform 250ms ease":void 0,Kd=(0,$.forwardRef)((e,t)=>{let{as:n,activatorEvent:r,adjustScale:a,children:o,className:l,rect:i,style:c,transform:s,transition:u=Vd}=e;if(!i)return null;const m=a?s:{...s,scaleX:1,scaleY:1},d={...Hd,width:i.width,height:i.height,top:i.top,left:i.left,transform:Xu.Transform.toString(m),transformOrigin:a&&r?mm(r,i):void 0,transition:"function"==typeof u?u(r):u,...c};return ee().createElement(n,{className:l,style:d,ref:t},o)}),Xd=e=>t=>{let{active:n,dragOverlay:r}=t;const a={},{styles:o,className:l}=e;if(null!=o&&o.active)for(const[e,t]of Object.entries(o.active))void 0!==t&&(a[e]=n.node.style.getPropertyValue(e),n.node.style.setProperty(e,t));if(null!=o&&o.dragOverlay)for(const[e,t]of Object.entries(o.dragOverlay))void 0!==t&&r.node.style.setProperty(e,t);return null!=l&&l.active&&n.node.classList.add(l.active),null!=l&&l.dragOverlay&&r.node.classList.add(l.dragOverlay),function(){for(const[e,t]of Object.entries(a))n.node.style.setProperty(e,t);null!=l&&l.active&&n.node.classList.remove(l.active)}},Yd={duration:250,easing:"ease",keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:Xu.Transform.toString(t)},{transform:Xu.Transform.toString(n)}]},sideEffects:Xd({styles:{active:{opacity:"0"}}})};let Zd=0;function Jd(e){return(0,$.useMemo)(()=>{if(null!=e)return Zd++,Zd},[e])}const $d=ee().memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:a,transition:o,modifiers:l,wrapperElement:i="div",className:c,zIndex:s=999}=e;const{activatorEvent:u,active:m,activeNodeRect:d,containerNodeRect:g,draggableNodes:p,droppableContainers:f,dragOverlay:y,over:h,measuringConfiguration:b,scrollableAncestors:v,scrollableAncestorRects:_,windowRect:w}=Bd(),x=(0,$.useContext)(Ld),E=Jd(null==m?void 0:m.id),C=Dd(l,{activatorEvent:u,active:m,activeNodeRect:d,containerNodeRect:g,draggingNodeRect:y.rect,over:h,overlayNodeRect:y.rect,scrollableAncestors:v,scrollableAncestorRects:_,transform:x,windowRect:w}),N=pd(d),k=function(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:a}=e;return Mu((e,o)=>{if(null===t)return;const l=n.get(e);if(!l)return;const i=l.node.current;if(!i)return;const c=xd(o);if(!c)return;const{transform:s}=Tu(o).getComputedStyle(o),u=Nm(s);if(!u)return;const m="function"==typeof t?t:function(e){const{duration:t,easing:n,sideEffects:r,keyframes:a}={...Yd,...e};return e=>{let{active:o,dragOverlay:l,transform:i,...c}=e;if(!t)return;const s=l.rect.left-o.rect.left,u=l.rect.top-o.rect.top,m={scaleX:1!==i.scaleX?o.rect.width*i.scaleX/l.rect.width:1,scaleY:1!==i.scaleY?o.rect.height*i.scaleY/l.rect.height:1},d={x:i.x-s,y:i.y-u,...m},g=a({...c,active:o,dragOverlay:l,transform:{initial:i,final:d}}),[p]=g,f=g[g.length-1];if(JSON.stringify(p)===JSON.stringify(f))return;const y=null==r?void 0:r({active:o,dragOverlay:l,...c}),h=l.node.animate(g,{duration:t,easing:n,fill:"forwards"});return new Promise(e=>{h.onfinish=()=>{null==y||y(),e()}})}}(t);return Um(i,a.draggable.measure),m({active:{id:e,data:l.data,node:i,rect:a.draggable.measure(i)},draggableNodes:n,dragOverlay:{node:o,rect:a.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:a,transform:u})})}({config:r,draggableNodes:p,droppableContainers:f,measuringConfiguration:b}),S=N?y.setRef:void 0;return ee().createElement(Wd,null,ee().createElement(qd,{animation:k},m&&E?ee().createElement(Kd,{key:E,id:m.id,ref:S,as:i,activatorEvent:u,adjustScale:t,className:c,transition:o,rect:N,style:{zIndex:s,...a},transform:C},n):null))});function eg(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function tg(e,t){return e.reduce((e,n,r)=>{const a=t.get(n);return a&&(e[r]=a),e},Array(e.length))}function ng(e){return null!==e&&e>=0}const rg=e=>{let{rects:t,activeIndex:n,overIndex:r,index:a}=e;const o=eg(t,r,n),l=t[a],i=o[a];return i&&l?{x:i.left-l.left,y:i.top-l.top,scaleX:i.width/l.width,scaleY:i.height/l.height}:null},ag={scaleX:1,scaleY:1},og=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:a,rects:o,overIndex:l}=e;const i=null!=(t=o[n])?t:r;if(!i)return null;if(a===n){const e=o[l];return e?{x:0,y:n<l?e.top+e.height-(i.top+i.height):e.top-i.top,...ag}:null}const c=function(e,t,n){const r=e[t],a=e[t-1],o=e[t+1];return r?n<t?a?r.top-(a.top+a.height):o?o.top-(r.top+r.height):0:o?o.top-(r.top+r.height):a?r.top-(a.top+a.height):0:0}(o,a,n);return a>n&&a<=l?{x:0,y:-i.height-c,...ag}:a<n&&a>=l?{x:0,y:i.height+c,...ag}:{x:0,y:0,...ag}},lg="Sortable",ig=ee().createContext({activeIndex:-1,containerId:lg,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:rg,disabled:{draggable:!1,droppable:!1}});function cg(e){let{children:t,id:n,items:r,strategy:a=rg,disabled:o=!1}=e;const{active:l,dragOverlay:i,droppableRects:c,over:s,measureDroppableContainers:u}=Bd(),m=qu(lg,n),d=Boolean(null!==i.rect),g=(0,$.useMemo)(()=>r.map(e=>"object"==typeof e&&"id"in e?e.id:e),[r]),p=null!=l,f=l?g.indexOf(l.id):-1,y=s?g.indexOf(s.id):-1,h=(0,$.useRef)(g),b=!function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}(g,h.current),v=-1!==y&&-1===f||b,_=function(e){return"boolean"==typeof e?{draggable:e,droppable:e}:e}(o);Fu(()=>{b&&p&&u(g)},[b,g,p,u]),(0,$.useEffect)(()=>{h.current=g},[g]);const w=(0,$.useMemo)(()=>({activeIndex:f,containerId:m,disabled:_,disableTransforms:v,items:g,overIndex:y,useDragOverlay:d,sortedRects:tg(g,c),strategy:a}),[f,m,_.draggable,_.droppable,v,g,y,c,d,a]);return ee().createElement(ig.Provider,{value:w},t)}const sg=e=>{let{id:t,items:n,activeIndex:r,overIndex:a}=e;return eg(n,r,a).indexOf(t)},ug=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:a,items:o,newIndex:l,previousItems:i,previousContainerId:c,transition:s}=e;return!(!s||!r||i!==o&&a===l||!n&&(l===a||t!==c))},mg={duration:200,easing:"ease"},dg="transform",gg=Xu.Transition.toString({property:dg,duration:0,easing:"linear"}),pg={roleDescription:"sortable"};function fg(e){let{animateLayoutChanges:t=ug,attributes:n,disabled:r,data:a,getNewIndex:o=sg,id:l,strategy:i,resizeObserverConfig:c,transition:s=mg}=e;const{items:u,containerId:m,activeIndex:d,disabled:g,disableTransforms:p,sortedRects:f,overIndex:y,useDragOverlay:h,strategy:b}=(0,$.useContext)(ig),v=function(e,t){var n,r;return"boolean"==typeof e?{draggable:e,droppable:!1}:{draggable:null!=(n=null==e?void 0:e.draggable)?n:t.draggable,droppable:null!=(r=null==e?void 0:e.droppable)?r:t.droppable}}(r,g),_=u.indexOf(l),w=(0,$.useMemo)(()=>({sortable:{containerId:m,index:_,items:u},...a}),[m,a,_,u]),x=(0,$.useMemo)(()=>u.slice(u.indexOf(l)),[u,l]),{rect:E,node:C,isOver:N,setNodeRef:k}=Ud({id:l,data:w,disabled:v.droppable,resizeObserverConfig:{updateMeasurementsFor:x,...c}}),{active:S,activatorEvent:O,activeNodeRect:P,attributes:j,setNodeRef:T,listeners:I,isDragging:A,over:D,setActivatorNodeRef:L,transform:F}=function(e){let{id:t,data:n,disabled:r=!1,attributes:a}=e;const o=qu("Draggable"),{activators:l,activatorEvent:i,active:c,activeNodeRect:s,ariaDescribedById:u,draggableNodes:m,over:d}=(0,$.useContext)(Pd),{role:g=Gd,roleDescription:p="draggable",tabIndex:f=0}=null!=a?a:{},y=(null==c?void 0:c.id)===t,h=(0,$.useContext)(y?Ld:Rd),[b,v]=Bu(),[_,w]=Bu(),x=function(e,t){return(0,$.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:a}=n;return e[r]=e=>{a(e,t)},e},{}),[e,t])}(l,t),E=Ru(n);return Fu(()=>(m.set(t,{id:t,key:o,node:b,activatorNode:_,data:E}),()=>{const e=m.get(t);e&&e.key===o&&m.delete(t)}),[m,t]),{active:c,activatorEvent:i,activeNodeRect:s,attributes:(0,$.useMemo)(()=>({role:g,tabIndex:f,"aria-disabled":r,"aria-pressed":!(!y||g!==Gd)||void 0,"aria-roledescription":p,"aria-describedby":u.draggable}),[r,g,f,y,p,u.draggable]),isDragging:y,listeners:r?void 0:x,node:b,over:d,setNodeRef:v,setActivatorNodeRef:w,transform:h}}({id:l,data:w,attributes:{...pg,...n},disabled:v.draggable}),M=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return(0,$.useMemo)(()=>e=>{t.forEach(t=>t(e))},t)}(k,T),R=Boolean(S),G=R&&!p&&ng(d)&&ng(y),B=!h&&A,z=B&&G?F:null,U=G?null!=z?z:(null!=i?i:b)({rects:f,activeNodeRect:P,activeIndex:d,overIndex:y,index:_}):null,q=ng(d)&&ng(y)?o({id:l,items:u,activeIndex:d,overIndex:y}):_,Q=null==S?void 0:S.id,W=(0,$.useRef)({activeId:Q,items:u,newIndex:q,containerId:m}),H=u!==W.current.items,V=t({active:S,containerId:m,isDragging:A,isSorting:R,id:l,index:_,items:u,newIndex:W.current.newIndex,previousItems:W.current.items,previousContainerId:W.current.containerId,transition:s,wasDragging:null!=W.current.activeId}),K=function(e){let{disabled:t,index:n,node:r,rect:a}=e;const[o,l]=(0,$.useState)(null),i=(0,$.useRef)(n);return Fu(()=>{if(!t&&n!==i.current&&r.current){const e=a.current;if(e){const t=Sm(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&l(n)}}n!==i.current&&(i.current=n)},[t,n,r,a]),(0,$.useEffect)(()=>{o&&l(null)},[o]),o}({disabled:!V,index:_,node:C,rect:E});return(0,$.useEffect)(()=>{R&&W.current.newIndex!==q&&(W.current.newIndex=q),m!==W.current.containerId&&(W.current.containerId=m),u!==W.current.items&&(W.current.items=u)},[R,q,m,u]),(0,$.useEffect)(()=>{if(Q===W.current.activeId)return;if(null!=Q&&null==W.current.activeId)return void(W.current.activeId=Q);const e=setTimeout(()=>{W.current.activeId=Q},50);return()=>clearTimeout(e)},[Q]),{active:S,activeIndex:d,attributes:j,data:w,rect:E,index:_,newIndex:q,items:u,isOver:N,isSorting:R,isDragging:A,listeners:I,node:C,overIndex:y,over:D,setNodeRef:M,setActivatorNodeRef:L,setDroppableNodeRef:k,setDraggableNodeRef:T,transform:null!=K?K:U,transition:K||H&&W.current.newIndex===_?gg:B&&!Vu(O)||!s?void 0:R||V?Xu.Transition.toString({...s,property:dg}):void 0}}function yg(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&"object"==typeof t.sortable&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const hg=[Km.Down,Km.Right,Km.Up,Km.Left],bg=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:a,droppableContainers:o,over:l,scrollableAncestors:i}}=t;if(hg.includes(e.code)){if(e.preventDefault(),!n||!r)return;const t=[];o.getEnabled().forEach(n=>{if(!n||null!=n&&n.disabled)return;const o=a.get(n.id);if(o)switch(e.code){case Km.Down:r.top<o.top&&t.push(n);break;case Km.Up:r.top>o.top&&t.push(n);break;case Km.Left:r.left>o.left&&t.push(n);break;case Km.Right:r.left<o.left&&t.push(n)}});const u=(e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const a=pm(t),o=[];for(const e of r){const{id:t}=e,r=n.get(t);if(r){const n=pm(r),l=a.reduce((e,t,r)=>e+um(n[r],t),0),i=Number((l/4).toFixed(4));o.push({id:t,data:{droppableContainer:e,value:i}})}}return o.sort(dm)})({active:n,collisionRect:r,droppableRects:a,droppableContainers:t,pointerCoordinates:null});let m=fm(u,"id");if(m===(null==l?void 0:l.id)&&u.length>1&&(m=u[1].id),null!=m){const e=o.get(n.id),t=o.get(m),l=t?a.get(t.id):null,u=null==t?void 0:t.node.current;if(u&&l&&e&&t){const n=Pm(u).some((e,t)=>i[t]!==e),a=vg(e,t),o=(s=t,!(!yg(c=e)||!yg(s))&&!!vg(c,s)&&c.data.current.sortable.index<s.data.current.sortable.index),m=n||!a?{x:0,y:0}:{x:o?r.width-l.width:0,y:o?r.height-l.height:0},d={x:l.left,y:l.top};return m.x&&m.y?d:Hu(d,m)}}}var c,s};function vg(e,t){return!(!yg(e)||!yg(t))&&e.data.current.sortable.containerId===t.data.current.sortable.containerId}var _g=function(e){var t=e.integrationType,n=e.state,r=e.onUpdateField;return ee().createElement("div",{className:"space-y-6"},ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"".concat(t,"-show-video-controls"),help:(0,pe.__)("Display video player controls (play, pause, volume, etc.) in the lightbox.","nggallery")},(0,pe.__)("Show Video Controls?","nggallery"))),ee().createElement("div",{className:"flex items-center"},ee().createElement(fs,{id:"".concat(t,"-show-video-controls"),name:"".concat(t,"-show-video-controls"),checked:n.showVideoControls,onChange:function(e){return r("showVideoControls",e.target.checked)},label:""}))),ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"".concat(t,"-show-play-pause-controls"),help:(0,pe.__)("Display play and pause buttons on video thumbnails in the gallery.","nggallery")},(0,pe.__)("Show Play/Pause Controls?","nggallery"))),ee().createElement("div",{className:"flex items-center"},ee().createElement(fs,{id:"".concat(t,"-show-play-pause-controls"),name:"".concat(t,"-show-play-pause-controls"),checked:n.showPlayPauseControls,onChange:function(e){return r("showPlayPauseControls",e.target.checked)},label:""}))),ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"".concat(t,"-autoplay-videos"),help:(0,pe.__)("Automatically start playing videos when they are displayed in the lightbox.","nggallery")},(0,pe.__)("Autoplay Videos?","nggallery"))),ee().createElement("div",{className:"flex items-center"},ee().createElement(fs,{id:"".concat(t,"-autoplay-videos"),name:"".concat(t,"-autoplay-videos"),checked:n.autoplayVideos,onChange:function(e){return r("autoplayVideos",e.target.checked)},label:""}))))},wg=function(e){var t=e.integrationName;return ee().createElement("div",{className:"mb-6"},ee().createElement("h3",{className:"text-lg font-semibold text-gray-900 mb-2"},"".concat(t," ").concat((0,pe.__)("Settings","nggallery"))),ee().createElement("p",{className:"text-sm text-gray-600 mb-3"},(0,pe.__)("The settings below adjust the","nggallery")," ",t," ",(0,pe.__)("options for the gallery.","nggallery")))},xg={defaultShowVideoControls:!0,defaultShowPlayPauseControls:!0,defaultAutoplayVideos:!1},Eg={showVideoControls:"show_video_controls",showPlayPauseControls:"show_play_pause_controls",autoplayVideos:"autoplay_videos"};function Cg(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ng(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Cg(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Cg(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var kg=function(e){var t=e.isOpen,n=e.onClose,r=e.onToggle,a=e.trigger,o=e.children,l=e.className,i=void 0===l?"":l,c=e.activeClasses,s=void 0===c?"":c,u=xo(function(){t&&n()},t),m=(0,$.useRef)(null),d=(0,$.useRef)(null),g=vo((0,$.useState)(null),2),p=g[0],f=g[1],y=ac(oc,t);(0,$.useLayoutEffect)(function(){if(t&&m.current&&d.current){var e=m.current.getBoundingClientRect(),n=d.current.getBoundingClientRect(),r=oc().getBoundingClientRect(),a=e.bottom-y.offsetY+5,o=e.right-n.width-y.offsetX;if(a+n.height>r.height-8){var l=e.top-y.offsetY-n.height-5;l>=8&&(a=l)}var i=r.width-8;o<8&&(o=8),o+n.width>i&&(o=i-n.width),o<0&&(o=8),f({top:a,left:o})}},[t,o,y]);var h=ee().cloneElement(a,{onClick:function(){r()},className:t&&s?s:a.props.className});return ee().createElement("div",{className:"relative",ref:m},h,t&&rc().createPortal(ee().createElement("div",{ref:function(e){u.current=e,d.current=e},style:{position:"absolute",top:p?"".concat(p.top,"px"):"0",left:p?"".concat(p.left,"px"):"0",opacity:p?1:0,zIndex:9999},className:ao("bg-white rounded-md shadow-lg border border-gray-200 overflow-hidden",i)},o),oc()))};const Sg=function(e){var t=e.isOpen,n=e.onClose,r=e.image;if(!r)return null;var a=r.meta_data||{},o=function(e){return null==e||""===e?"N/A":"boolean"==typeof e?e?"Yes":"No":String(e)},l=[{tag:"Image ID",value:r.pid},{tag:"Image Width",value:a.width},{tag:"Image Height",value:a.height},{tag:"md5",value:a.md5}],i=[{tag:"Orientation",value:a.Orientation},{tag:"Camera",value:a.camera},{tag:"Aperture",value:a.aperture},{tag:"Focal Length",value:a.focal_length},{tag:"ISO",value:a.iso},{tag:"Shutter Speed",value:a.shutter_speed},{tag:"Flash",value:a.flash},{tag:"Created",value:a.created_timestamp?new Date(1e3*a.created_timestamp).toLocaleString():null}].filter(function(e){return null!==e.value&&void 0!==e.value&&""!==e.value&&!1!==e.value});return ee().createElement(Eo,{isOpen:t,onClose:n,title:(0,pe.__)("Show meta data","nggallery")},ee().createElement("div",{className:"space-y-6"},ee().createElement("div",null,ee().createElement("h3",{className:"text-lg font-semibold text-gray-900 mb-4"},(0,pe.__)("Meta Data","nggallery")),ee().createElement("div",{className:"bg-gray-50 rounded-lg overflow-hidden"},ee().createElement("table",{className:"min-w-full"},ee().createElement("thead",{className:"bg-gray-100"},ee().createElement("tr",null,ee().createElement("th",{className:"px-4 py-3 text-left text-sm font-medium text-gray-700 w-1/3"},(0,pe.__)("Tag","nggallery")),ee().createElement("th",{className:"px-4 py-3 text-left text-sm font-medium text-gray-700"},(0,pe.__)("Value","nggallery")))),ee().createElement("tbody",{className:"divide-y divide-gray-200 bg-white"},l.map(function(e,t){return ee().createElement("tr",{key:t,className:"bg-white"},ee().createElement("td",{className:"px-4 py-3 text-sm text-gray-900 font-medium"},e.tag),ee().createElement("td",{className:"px-4 py-3 text-sm text-gray-700"},o(e.value)))}))))),i.length>0&&ee().createElement("div",null,ee().createElement("h3",{className:"text-lg font-semibold text-gray-900 mb-4"},(0,pe.__)("EXIF Data","nggallery")),ee().createElement("div",{className:"bg-gray-50 rounded-lg overflow-hidden"},ee().createElement("table",{className:"min-w-full"},ee().createElement("thead",{className:"bg-gray-100"},ee().createElement("tr",null,ee().createElement("th",{className:"px-4 py-3 text-left text-sm font-medium text-gray-700 w-1/3"},(0,pe.__)("Tag","nggallery")),ee().createElement("th",{className:"px-4 py-3 text-left text-sm font-medium text-gray-700"},(0,pe.__)("Value","nggallery")))),ee().createElement("tbody",{className:"divide-y divide-gray-200 bg-white"},i.map(function(e,t){return ee().createElement("tr",{key:t,className:"bg-white"},ee().createElement("td",{className:"px-4 py-3 text-sm text-gray-900 font-medium"},e.tag),ee().createElement("td",{className:"px-4 py-3 text-sm text-gray-700"},o(e.value)))}))))),0===i.length&&ee().createElement("div",null,ee().createElement("h3",{className:"text-lg font-semibold text-gray-900 mb-4"},(0,pe.__)("EXIF Data","nggallery")),ee().createElement("div",{className:"bg-gray-50 rounded-lg p-4"},ee().createElement("p",{className:"text-sm text-gray-600 text-center"},(0,pe.__)("No EXIF data available for this image.","nggallery"))))))};var Og=function(){var e=Pg();return null!==e&&e.enabled&&e.license_valid},Pg=function(){var e=window.imagelyApp;return(null==e?void 0:e.enviraCdnConfig)||null},jg=function(e){var t;return!(null===(t=e.meta_data)||void 0===t||!t._envira_cdn_id)},Tg=function(){var e=window.wpApiSettings;if(null!=e&&e.nonce)return e.nonce;var t=window.imagelyApp;return(null==t?void 0:t.nonce)||null},Ig=function(){var e=window.imagelyApp;return(null==e?void 0:e.restURL)||"/wp-json/"};function Ag(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Dg(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ag(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ag(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Lg(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return Fg(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Fg(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Fg(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,Fg(m,"constructor",s),Fg(s,"constructor",c),c.displayName="GeneratorFunction",Fg(s,a,"GeneratorFunction"),Fg(m),Fg(m,a,"Generator"),Fg(m,r,function(){return this}),Fg(m,"toString",function(){return"[object Generator]"}),(Lg=function(){return{w:o,m:d}})()}function Fg(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}Fg=function(e,t,n,r){function o(t,n){Fg(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Fg(e,t,n,r)}var Mg=function(){return ee().createElement("div",{className:"absolute inset-0 bg-white bg-opacity-60 flex items-center justify-center z-20"},ee().createElement(kn,{className:"animate-spin h-8 w-8 -mt-[48px] text-green-500"}))},Rg=(0,$.memo)(function(e){var t,n=e.image,r=e.gallery,a=e.isSelected,o=e.onSelect,l=e.onDelete,i=e.onRecover,c=e.onGenerateThumbnail,s=e.isProcessing,u=e.onToggleVisibility,m=e.isVideoGallery,d=void 0!==m&&m,g=vo((0,$.useState)(!1),2),p=g[0],f=g[1],y=vo((0,$.useState)(!1),2),h=y[0],b=y[1],v=vo((0,$.useState)(!1),2),_=v[0],w=v[1],x=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:768,t=vo((0,$.useState)(!1),2),n=t[0],r=t[1];return(0,$.useEffect)(function(){var t=function(){r(window.innerWidth<e)};return t(),window.addEventListener("resize",t),function(){return window.removeEventListener("resize",t)}},[e]),n}(),E=(0,ge.useDispatch)(Br),C=re(),N=kl((null==r?void 0:r.gid)||null).data,k=function(){var e,t,n=re();return gl({mutationFn:(t=No(vl().m(function e(t){var n,r;return vl().w(function(e){for(;;)switch(e.n){case 0:return n=t.galleryId,r=t.imageId,e.n=1,Oo()({path:"/imagely/v1/galleries/".concat(n),method:"PUT",headers:Do(),data:{previewpic:r}});case 1:return e.a(2,e.v)}},e)})),function(e){return t.apply(this,arguments)}),onMutate:(e=No(vl().m(function e(t){var r,a,o;return vl().w(function(e){for(;;)switch(e.n){case 0:return r=t.galleryId,a=t.imageId,e.n=1,n.cancelQueries({queryKey:wl(r)});case 1:return(o=n.getQueryData(wl(r)))&&n.setQueryData(wl(r),bl(bl({},o),{},{previewpic:a})),e.a(2,{previousGallery:o})}},e)})),function(t){return e.apply(this,arguments)}),onError:function(e,t,r){var a=t.galleryId;null!=r&&r.previousGallery&&n.setQueryData(wl(a),r.previousGallery)},onSettled:function(e,t,r){var a=r.galleryId;n.invalidateQueries({queryKey:wl(a)}),n.invalidateQueries({queryKey:["galleries"]})}})}(),S=$o(),O=S.showSuccess,P=S.showError,j=(0,$.useCallback)(function(){var e=function(e){var t,n=null===(t=e.meta_data)||void 0===t?void 0:t._envira_cdn_id;return n?"https://images.envira-cdn.com/cdn-cgi/imagedelivery/Fcmm2_rOlMVEVM7KyY_2rw/".concat(n,"/w=original"):null}(n);e&&window.open(e,"_blank"),f(!1)},[n]),T=(0,$.useCallback)(No(Lg().m(function e(){var t,a,o,l,i,c,s;return Lg().w(function(e){for(;;)switch(e.p=e.n){case 0:if(null!==(t=n.meta_data)&&void 0!==t&&t._envira_cdn_id){e.n=1;break}return e.a(2);case 1:if(a=Tg(),o=Ig(),a){e.n=2;break}return P((0,pe.__)("Authentication error","nggallery")),f(!1),e.a(2);case 2:return f(!1),e.p=3,e.n=4,fetch("".concat(o,"envira-cdn/v1/ngg-remove-image/").concat(n.pid),{method:"DELETE",headers:{"X-WP-Nonce":a}});case 4:if((l=e.v).ok){e.n=6;break}return e.n=5,l.json().catch(function(e){return console.error("Error parsing error response JSON:",e),{}});case 5:return i=e.v,console.error("CDN removal error:",i),P((0,pe.__)("Failed to remove image from CDN","nggallery")),e.a(2);case 6:return e.n=7,l.json();case 7:if(!(c=e.v).success){e.n=9;break}if(O((0,pe.__)("Image removed from CDN successfully","nggallery")),null==r||!r.gid){e.n=8;break}return e.n=8,C.invalidateQueries({queryKey:["gallery",r.gid,"images"]});case 8:e.n=10;break;case 9:P(c.message||(0,pe.__)("Failed to remove image from CDN","nggallery"));case 10:e.n=12;break;case 11:e.p=11,s=e.v,console.error("CDN removal error:",s),P((0,pe.__)("Error removing image from CDN","nggallery"));case 12:return e.a(2)}},e,null,[[3,11]])})),[n,null==r?void 0:r.gid,C,O,P]),I=fg({id:(null==n?void 0:n.pid)||0,transition:{duration:150,easing:"cubic-bezier(0.25, 1, 0.5, 1)"}}),A=I.attributes,D=I.listeners,L=I.setNodeRef,F=I.transform,M=I.transition,R=I.isDragging;if(!n||null==n||!n.pid||"number"!=typeof n.pid)return null;if(null==n||!n.filename||null==r||!r.path)return null;var G={transform:Xu.Transform.toString(F),transition:M,opacity:R?.5:1,touchAction:"none",willChange:"transform, opacity",pointerEvents:s?"none":void 0},B=function(){var e=No(Lg().m(function e(){return Lg().w(function(e){for(;;)switch(e.n){case 0:if(!i){e.n=1;break}return e.n=1,i(n.pid);case 1:f(!1);case 2:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}(),z=x||h||a,U=function(){var e=No(Lg().m(function e(){var t;return Lg().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,k.mutateAsync({galleryId:r.gid,imageId:n.pid});case 1:O((0,pe.__)("Gallery thumbnail updated successfully","nggallery")),e.n=3;break;case 2:e.p=2,t=e.v,console.error("Error setting gallery thumbnail:",t),P((0,pe.__)("Failed to update gallery thumbnail","nggallery"));case 3:f(!1);case 4:return e.a(2)}},e,null,[[0,2]])}));return function(){return e.apply(this,arguments)}}(),q=(null===(t=N||r)||void 0===t?void 0:t.previewpic)===n.pid;return ee().createElement("div",{className:ao("relative w-full sm:w-full md:w-[130px]",s&&"opacity-50")},ee().createElement("div",{ref:L,style:G,className:ao("relative bg-white rounded-lg will-change-transform",R&&"z-10 shadow-xl ring-2 ring-green-500"),"data-testid":"sortable-image-".concat(n.pid),onMouseEnter:function(){return b(!0)},onMouseLeave:function(){x||(b(!1),f(!1))},onTouchStart:function(){b(!0)}},s&&ee().createElement(Mg,null),!d&&ee().createElement("div",{className:"absolute top-2 left-2 z-20"},ee().createElement("input",{title:(0,pe.__)("Select image","nggallery"),type:"checkbox",checked:a,onChange:function(){return o(n.pid)},onClick:function(e){return e.stopPropagation()},className:ao("rounded border-gray-300 w-5 h-5 md:w-4 md:h-4 text-green-600 focus:ring-green-500 focus:ring-2",s?"cursor-not-allowed":"cursor-pointer"),disabled:s})),ee().createElement("div",{className:ao("absolute top-2 right-2 z-20",s?"cursor-not-allowed":"cursor-pointer")},ee().createElement(kg,{isOpen:p,onClose:function(){f(!1)},onToggle:function(){f(!p)},trigger:ee().createElement("button",{title:(0,pe.__)("Actions","nggallery"),className:ao("bg-transparent p-2 md:p-1 hover:bg-opacity-80 focus:outline-none",s?"cursor-not-allowed":"cursor-pointer"),onClick:function(e){e.stopPropagation(),e.preventDefault(),f(!p)},disabled:s},ee().createElement("svg",{className:"w-6 h-6 md:w-5 md:h-5 text-white hover:text-gray-300",viewBox:"0 0 20 20",fill:"currentColor"},ee().createElement("path",{d:"M10 6a2 2 0 110-4 2 2 0 010 4zM10 12a2 2 0 110-4 2 2 0 010 4zM10 18a2 2 0 110-4 2 2 0 010 4z"})))},ee().createElement("div",{className:"py-1"},ee().createElement("button",{onClick:function(){E.setActiveModal("editImage",{image:n}),f(!1),b(!1)},className:ao("block w-full text-left px-4 py-1.5 text-sm text-gray-700 hover:bg-gray-100",s?"cursor-not-allowed":"cursor-pointer"),disabled:s},(0,pe.__)("Edit Details","nggallery")),!d&&ee().createElement("button",{onClick:function(){E.setActiveModal("imageView",{image:{filename:n.filename,alttext:n.alttext,galleryPath:(null==r?void 0:r.path)||"",pid:n.pid,galleryid:n.galleryid,image_url:n.image_url}}),f(!1),b(!1)},className:ao("block w-full text-left px-4 py-1.5 text-sm text-gray-700 hover:bg-gray-100",s?"cursor-not-allowed":"cursor-pointer"),disabled:s},(0,pe.__)("Edit Image","nggallery")),d&&ee().createElement("button",{onClick:function(){E.setActiveModal("editVideo",{image:n}),f(!1),b(!1)},className:ao("block w-full text-left px-4 py-1.5 text-sm text-gray-700 hover:bg-gray-100",s?"cursor-not-allowed":"cursor-pointer"),disabled:s},(0,pe.__)("Edit Video","nggallery")),ee().createElement("button",{onClick:function(){w(!0),f(!1),b(!1)},className:ao("block w-full text-left px-4 py-1.5 text-sm text-gray-700 hover:bg-gray-100",s?"cursor-not-allowed":"cursor-pointer"),disabled:s},(0,pe.__)("View Meta","nggallery")),ee().createElement("button",{onClick:function(){l(n),f(!1)},className:ao("block w-full text-left px-4 py-1.5 text-sm text-red-600 hover:bg-gray-100",s?"cursor-not-allowed":"cursor-pointer"),disabled:s},d?(0,pe.__)("Delete Video","nggallery"):(0,pe.__)("Delete Image","nggallery")),!d&&ee().createElement("button",{onClick:B,className:ao("block w-full text-left px-4 py-1.5 text-sm text-gray-700 hover:bg-gray-100",s?"cursor-not-allowed":"cursor-pointer"),disabled:s},(0,pe.__)("Recover from Backup","nggallery")),!d&&c&&ee().createElement("button",{onClick:function(){c(n.pid),f(!1)},className:ao("block w-full text-left px-4 py-1.5 text-sm text-gray-700 hover:bg-gray-100",s?"cursor-not-allowed":"cursor-pointer"),disabled:s},(0,pe.__)("Generate Thumbnail","nggallery")),ee().createElement("button",{onClick:U,className:ao("block w-full text-left px-4 py-1.5 text-sm text-gray-700 hover:bg-gray-100",s||q?"cursor-not-allowed":"cursor-pointer"),disabled:s||q},q?(0,pe.__)("Current Preview Thumbnail","nggallery"):(0,pe.__)("Set as Preview Thumbnail","nggallery")),ee().createElement("button",{onClick:function(e){e.stopPropagation(),u(n,!n.exclude),f(!1),b(!1)},className:ao("block w-full text-left px-4 py-1.5 text-sm hover:bg-gray-100",n.exclude?"text-blue-600":"text-gray-700",s?"cursor-not-allowed":"cursor-pointer"),disabled:s},n.exclude?(0,pe.__)("Show Image","nggallery"):(0,pe.__)("Hide Image","nggallery")),Og()&&jg(n)&&ee().createElement(ee().Fragment,null,ee().createElement("button",{onClick:j,className:"block w-full text-left px-4 py-1.5 text-sm text-blue-600 hover:bg-gray-100 cursor-pointer"},(0,pe.__)("View CDN URL","nggallery")),ee().createElement("button",{onClick:T,className:"block w-full text-left px-4 py-1.5 text-sm text-orange-600 hover:bg-gray-100 cursor-pointer"},(0,pe.__)("Remove from CDN","nggallery")))))),ee().createElement("div",{className:"overflow-hidden rounded-lg bg-gray-100 flex items-center justify-center relative cursor-pointer w-full h-[100px] sm:h-[120px] md:w-[130px] md:h-[90px]",onClick:function(e){e.stopPropagation(),E.setActiveModal("galleryImageView",{image:{filename:n.filename,alttext:n.alttext,galleryPath:(null==r?void 0:r.path)||"",pid:n.pid},galleryId:null==r?void 0:r.gid})}},ee().createElement("img",{src:zc(n.thumb_url,n.reloadKey),alt:n.alttext||"",className:ao("w-full h-full object-cover cursor-pointer",n.exclude&&"opacity-50 grayscale"),loading:"lazy",draggable:!1}),n.exclude&&ee().createElement("div",{className:"absolute inset-0 flex items-center justify-center bg-black bg-opacity-30"},ee().createElement("div",{className:"bg-gray-600 text-white text-xs px-2 py-1 rounded font-medium shadow-lg"},(0,pe.__)("Hidden","nggallery"))),z&&ee().createElement("div",{className:"absolute inset-0 bg-black bg-opacity-60 flex items-center justify-center z-10 transition-opacity"})),ee().createElement("div",{className:"mt-2 px-1"},ee().createElement("div",{className:"flex items-center justify-between"},ee().createElement("p",{className:"text-sm text-gray-900 truncate flex-1 mr-2",title:n.alttext||n.filename},n.alttext||n.filename),ee().createElement("button",fe({},s?{}:Dg(Dg({},A),D),{className:ao("flex-shrink-0 text-gray-100 p-1 rounded hover:bg-gray-100",s?"cursor-not-allowed opacity-50":"cursor-move"),disabled:s,title:(0,pe.__)("Drag to reorder","nggallery")}),ee().createElement(mn,{className:"text-gray-500"}))),n.tags&&n.tags.length>0&&ee().createElement("div",{className:"mt-1 flex flex-nowrap gap-1 overflow-hidden"},function(){for(var e=0,t=[],r=0;r<n.tags.length;r++){var a=n.tags[r],o=a.length+2;if(e+o>15)break;t.push(a),e+=o}var l=n.tags.length-t.length;return ee().createElement(ee().Fragment,null,t.map(function(e,t){return ee().createElement("span",{key:t,className:"inline-flex items-center px-1.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-700 flex-shrink-0",title:e},e)}),l>0&&ee().createElement("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-700 flex-shrink-0"},"+",l))}()))),ee().createElement(Sg,{isOpen:_,onClose:function(){return w(!1)},image:n}))});Rg.displayName="SortableImage";const Gg=Rg;function Bg(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zg(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Bg(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Bg(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Ug(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return qg(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(qg(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,qg(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,qg(m,"constructor",s),qg(s,"constructor",c),c.displayName="GeneratorFunction",qg(s,a,"GeneratorFunction"),qg(m),qg(m,a,"Generator"),qg(m,r,function(){return this}),qg(m,"toString",function(){return"[object Generator]"}),(Ug=function(){return{w:o,m:d}})()}function qg(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}qg=function(e,t,n,r){function o(t,n){qg(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},qg(e,t,n,r)}function Qg(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return Wg(e,t);var n={}.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)?Wg(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,l=!0,i=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return l=e.done,e},e:function(e){i=!0,o=e},f:function(){try{l||null==n.return||n.return()}finally{if(i)throw o}}}}function Wg(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Hg=function(e){var t=e.onClick;return ee().createElement("div",{className:"relative w-full"},ee().createElement("div",{className:"relative bg-gray-100 rounded-lg border-2 border-dashed border-gray-300 hover:border-gray-400 cursor-pointer transition-colors w-full h-[90px] sm:h-[100px] md:w-[130px] md:h-[90px]",onClick:t},ee().createElement("div",{className:"absolute inset-0 flex flex-col items-center justify-center"},ee().createElement(ln,{className:"w-6 h-6 sm:w-8 sm:h-8 text-gray-400 mb-1 sm:mb-2"}),ee().createElement("span",{className:"text-xs sm:text-sm text-gray-500 font-medium"},(0,pe.__)("Add Video Links","nggallery")))))};const Vg=function(e){var t=e.integrationType,r=e.integrationName,a=e.externalSource,o=void 0===a?{}:a,l=e.defaultSettings,i=void 0===l?{}:l,c=e.onUpdate,s=function(e){var t=e.externalSource,r=e.defaultSettings,a=e.onUpdate,o=xg,l=(0,$.useCallback)(function(e,n){return void 0!==t[e]?t[e]:void 0!==r[e]?r[e]:n},[t,r]),i=vo((0,$.useState)(function(){return{showVideoControls:l("show_video_controls",o.defaultShowVideoControls),showPlayPauseControls:l("show_play_pause_controls",o.defaultShowPlayPauseControls),autoplayVideos:l("autoplay_videos",o.defaultAutoplayVideos)}}),2),c=i[0],s=i[1];(0,$.useEffect)(function(){s({showVideoControls:l("show_video_controls",o.defaultShowVideoControls),showPlayPauseControls:l("show_play_pause_controls",o.defaultShowPlayPauseControls),autoplayVideos:l("autoplay_videos",o.defaultAutoplayVideos)})},[t,r,l]);var u=(0,$.useCallback)(function(e,n){var r=Ng({},t),o=Eg[e];o&&(r[o]=!!n,null==a||a(r))},[t,a]),m=(0,$.useCallback)(function(e,t){s(function(r){return Ng(Ng({},r),{},n({},e,t))}),u(e,t)},[u]);return{config:o,state:c,updateField:m}}({externalSource:o,defaultSettings:i,onUpdate:c}),u=s.state,m=s.updateField,d=Cs().currentId,g=(0,ge.useDispatch)(Br),p=re(),f=$o(),y=f.showSuccess,h=f.showError,b=kl(null!=d?d:0).data,v=Pl(null!=d?d:0,{per_page:-1,enabled:!!d}),_=v.data,w=v.isLoading,x=(null==_?void 0:_.images)||[],E=(0,$.useMemo)(function(){return x.filter(function(e){var t;return(null===(t=e.meta_data)||void 0===t?void 0:t.video_link)||"video"===(null==o?void 0:o.type)})},[x,null==o?void 0:o.type]),C=vo((0,$.useState)([]),2),N=C[0],k=C[1],S=vo((0,$.useState)(null),2),O=S[0],P=S[1],j=vo((0,$.useState)(new Set),2),T=j[0],I=j[1],A=vo((0,$.useState)(new Set),2),D=A[0],L=A[1],F=Il(),M=wc(),R=cm(im(ad,{activationConstraint:{distance:8,delay:100,tolerance:10}}),im($m,{coordinateGetter:bg}));(0,$.useEffect)(function(){k(E)},[E]);var G=(0,$.useMemo)(function(){return N.map(function(e){return e.pid})},[N]),B=(0,$.useCallback)(function(){var e=No(Ug().m(function e(t){var n,r,a,o,l,i,c,s,u,m,g,f,b,v,_;return Ug().w(function(e){for(;;)switch(e.p=e.n){case 0:if(n=t.active,r=t.over,P(null),!r||n.id===r.id||!d){e.n=7;break}return a=N.findIndex(function(e){return e.pid===n.id}),o=N.findIndex(function(e){return e.pid===r.id}),l=eg(N,a,o),k(l),e.p=1,i=Ao(),e.n=2,Oo()({path:"/imagely/v1/images?gallery_id=".concat(d,"&per_page=-1&orderby=sortorder&order=asc"),method:"GET",headers:{"X-WP-Nonce":i}});case 2:if(c=e.v,Array.isArray(c)&&0!==c.length){e.n=3;break}return e.a(2);case 3:s=new Set(N.map(function(e){return e.pid})),u=[],m=0,g=Qg(c);try{for(g.s();!(f=g.n()).done;)b=f.value,s.has(b.pid)?(u.push(l[m]),m++):u.push(b)}catch(e){g.e(e)}finally{g.f()}return v=u.map(function(e,t){return{id:e.pid,sortorder:t+1}}),e.n=4,F.mutateAsync({images:v});case 4:y((0,pe.__)("Videos reordered successfully","nggallery")),e.n=6;break;case 5:e.p=5,_=e.v,console.error("Error reordering videos:",_),h((0,pe.__)("Failed to reorder videos","nggallery")),p.invalidateQueries({queryKey:["gallery",d,"images"]});case 6:window.navigator.vibrate&&window.navigator.vibrate([50,50,50]);case 7:return e.a(2)}},e,null,[[1,5]])}));return function(t){return e.apply(this,arguments)}}(),[F,d,N,p,h,y]),z=function(e){I(function(t){var n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},U=function(e){var t;g.setActiveModal("deleteImages",{images:[e],onClose:function(){return g.setActiveModal(null)},onConfirm:(t=No(Ug().m(function t(){return Ug().w(function(t){for(;;)switch(t.n){case 0:return k(function(t){return t.filter(function(t){return t.pid!==e.pid})}),t.n=1,p.invalidateQueries({queryKey:["gallery",d,"images"]});case 1:g.setActiveModal(null);case 2:return t.a(2)}},t)})),function(){return t.apply(this,arguments)}),title:(0,pe.__)("Delete Video","nggallery"),singularLabel:(0,pe.__)("video","nggallery"),pluralLabel:(0,pe.__)("videos","nggallery")})},q=function(){var e=No(Ug().m(function e(t,n){var r;return Ug().w(function(e){for(;;)switch(e.p=e.n){case 0:return L(function(e){return new Set(e).add(t.pid)}),e.p=1,e.n=2,M.mutateAsync({imageId:t.pid,data:{exclude:n}});case 2:k(function(e){return e.map(function(e){return e.pid===t.pid?zg(zg({},e),{},{exclude:n}):e})}),y(n?(0,pe.__)("Video hidden successfully","nggallery"):(0,pe.__)("Video shown successfully","nggallery")),e.n=4;break;case 3:e.p=3,r=e.v,console.error("Error toggling video visibility:",r),h((0,pe.__)("Failed to update video visibility","nggallery"));case 4:return e.p=4,L(function(e){var n=new Set(e);return n.delete(t.pid),n}),e.f(4);case 5:return e.a(2)}},e,null,[[1,3,4,5]])}));return function(t,n){return e.apply(this,arguments)}}(),Q=O?N.find(function(e){return e.pid===O}):null;return ee().createElement("div",{className:"space-y-6"},ee().createElement(wg,{integrationName:r}),ee().createElement("hr",{className:"border-gray-200 my-6"}),ee().createElement(_g,{integrationType:t,state:u,onUpdateField:m}),d&&ee().createElement(ee().Fragment,null,ee().createElement("hr",{className:"border-gray-200 my-6"}),ee().createElement("div",{className:"mt-8"},ee().createElement("h3",{className:"text-lg font-semibold text-gray-900 mb-4"},(0,pe.__)("Videos","nggallery")," (",N.length,")"),ee().createElement("div",{className:"relative ".concat(w?"opacity-50":"")},ee().createElement(Md,{sensors:R,collisionDetection:hm,onDragStart:function(e){P(e.active.id),window.navigator.vibrate&&window.navigator.vibrate(50)},onDragEnd:B,measuring:{droppable:{strategy:md.Always}}},ee().createElement(cg,{items:G,strategy:rg},ee().createElement("div",{className:"grid gap-4 sm:gap-6 grid-cols-2 sm:grid-cols-3 md:grid-cols-[repeat(auto-fill,_130px)]"},ee().createElement(Hg,{onClick:function(){"pro"===zr?g.setActiveModal("addVideoLinks",{galleryId:d}):g.setActiveModal("upgrade",{feature:"Video Links"})}}),w?ee().createElement("div",{className:"col-span-full text-center py-8 text-gray-500"},(0,pe.__)("Loading videos...","nggallery")):0===N.length?ee().createElement("div",{className:"col-span-full text-center py-8 text-gray-500"},(0,pe.__)('No videos added yet. Click "Add Video Links" to get started.',"nggallery")):N.map(function(e){return ee().createElement(Gg,{key:"".concat(e.pid,"-").concat(e.reloadKey||""),image:e,gallery:b,isSelected:T.has(e.pid),onSelect:z,onDelete:U,isProcessing:D.has(e.pid),onToggleVisibility:q,isVideoGallery:!0})}))),ee().createElement($d,null,Q&&ee().createElement("div",{className:"transform scale-105 opacity-90 pointer-events-none"},ee().createElement(Gg,{image:Q,gallery:b,isSelected:T.has(Q.pid),onSelect:z,onDelete:U,isProcessing:D.has(Q.pid),onToggleVisibility:q,isVideoGallery:!0}))))))))},Kg=function(e){var t=e.integrationType,n=e.galleryId,r=e.galleryTitle,a=e.onSuccess,o=e.externalSource,l=void 0===o?{}:o,i=e.defaultSettings,c=void 0===i?{}:i,s=e.onUpdate,u=function(e){var t=Ps(e);return t!==e?t:{video:"Video",other:"Other Source"}[e.toLowerCase()]||e.charAt(0).toUpperCase()+e.slice(1)}(t),m=t.toLowerCase(),d=function(){switch(m){case"dropbox":return ee().createElement(Ws,{galleryId:n,galleryTitle:r,onSuccess:a});case"dribbble":return ee().createElement(zs,{integrationType:t,integrationName:u,externalSource:l,defaultSettings:c,onUpdate:s});case"tiktok":return ee().createElement(Su,{integrationType:t,integrationName:u,externalSource:l,defaultSettings:c,onUpdate:s});case"google_photos":return ee().createElement(du,{integrationType:t,integrationName:u,galleryId:n,externalSource:l,defaultSettings:c,onUpdate:s});case"video":return ee().createElement(Vg,{integrationType:t,integrationName:u,externalSource:l,defaultSettings:c,onUpdate:s});default:return ee().createElement("div",{className:"space-y-6"},ee().createElement("p",{className:"text-sm text-gray-600"},(0,pe.__)("Integration settings for","nggallery")," ",u," ",(0,pe.__)("are not yet implemented.","nggallery")))}};return m in Os?ee().createElement(Is,{addonId:m},d()):d()};function Xg(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Yg(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Xg(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Xg(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Zg(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return Jg(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Jg(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Jg(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,Jg(m,"constructor",s),Jg(s,"constructor",c),c.displayName="GeneratorFunction",Jg(s,a,"GeneratorFunction"),Jg(m),Jg(m,a,"Generator"),Jg(m,r,function(){return this}),Jg(m,"toString",function(){return"[object Generator]"}),(Zg=function(){return{w:o,m:d}})()}function Jg(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}Jg=function(e,t,n,r){function o(t,n){Jg(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Jg(e,t,n,r)}var $g={images:"image/jpeg,image/png,image/gif,image/webp",zip:"application/zip,application/x-zip-compressed"},ep=function(e){return $g.images.includes(e.type)||$g.zip.includes(e.type)},tp=function(e){return $g.zip.includes(e.type)};const np=function(e){var n=e.galleryId,r=e.onGalleryCreated,a=vo((0,$.useState)("media"),2),o=a[0],l=a[1],i=vo((0,$.useState)(!1),2),c=i[0],s=i[1],u=vo((0,$.useState)([]),2),m=u[0],d=u[1],g=vo((0,$.useState)([]),2),p=g[0],f=g[1],y=vo((0,$.useState)(""),2),h=y[0],b=y[1],v=vo((0,$.useState)(!1),2),_=v[0],w=v[1],x=vo((0,$.useState)(""),2),E=x[0],C=x[1],N=vo((0,$.useState)(""),2),k=N[0],S=N[1],O=vo((0,$.useState)([]),2),P=O[0],j=O[1],T=vo((0,$.useState)(!1),2),I=T[0],A=T[1],D=vo((0,$.useState)(""),2),L=D[0],F=D[1],M=(0,$.useRef)(null),R=!n,G=(0,ge.useDispatch)(Br),B=Cs(),z=B.navigateTo,U=B.setCurrentId,q=$o(),Q=q.showSuccess,W=q.showError,H=re(),V=jl(),K=Ol(),X=Tl(),Y=ws().data,Z=gi().data;(0,$.useEffect)(function(){"folder"===o&&te()},[o]);var J=function(e){setTimeout(function(){d(function(t){return t.filter(function(t){return t.file!==e||"uploading"===t.status||"error"===t.status})})},1e3)},te=function(){var e=No(Zg().m(function e(){var t,n,r,a,o=arguments;return Zg().w(function(e){for(;;)switch(e.p=e.n){case 0:return t=o.length>0&&void 0!==o[0]?o[0]:"",w(!0),C(""),e.p=1,e.n=2,Oo()({path:"/imagely/v1/folders/browse".concat(t?"?dir=".concat(encodeURIComponent(t)):""),method:"GET"});case 2:n=e.v,f(n.directories||[]),b(t),e.n=4;break;case 3:e.p=3,a=e.v,console.error("Error loading directories:",a),r=(null==a?void 0:a.error)||(0,pe.__)("Failed to load directories. Please try again.","nggallery"),C(r);case 4:return e.p=4,w(!1),e.f(4);case 5:return e.a(2)}},e,null,[[1,3,4,5]])}));return function(){return e.apply(this,arguments)}}(),ne=function(){var e=No(Zg().m(function e(t){var n,a,o;return Zg().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t.preventDefault(),k.trim()){e.n=1;break}return W((0,pe.__)("Please provide a gallery title.","nggallery")),e.a(2);case 1:return e.p=1,G.setPageLoading(!0),e.n=2,V.mutateAsync({title:k.trim(),name:k.trim(),galdesc:""});case 2:if(null==(n=e.v)||!n.gid){e.n=3;break}a=n.gid,G.setActiveModal(null),H.invalidateQueries({queryKey:["galleries"]}),H.invalidateQueries({queryKey:["gallery",a]}),r?r(a):z("imagely-add-new","images",a),Q((0,pe.__)("Gallery created successfully! You can now add images.","nggallery")),e.n=4;break;case 3:throw new Error((0,pe.__)("Failed to create gallery","nggallery"));case 4:e.n=6;break;case 5:e.p=5,o=e.v,console.error("Error creating gallery:",o),W((0,pe.__)("Failed to create gallery. Please try again.","nggallery"));case 6:return e.p=6,G.setPageLoading(!1),e.f(6);case 7:return e.a(2)}},e,null,[[1,5,6,7]])}));return function(t){return e.apply(this,arguments)}}(),ae=function(){var e=No(Zg().m(function e(){var r,a,o,l,i;return Zg().w(function(e){for(;;)switch(e.p=e.n){case 0:if(h){e.n=1;break}return C((0,pe.__)("Please select a folder to import.","nggallery")),e.a(2);case 1:if(n||k.trim()){e.n=2;break}return C((0,pe.__)("Please provide a gallery title.","nggallery")),e.a(2);case 2:return w(!0),C(""),e.p=3,r={folder:h,keep_location:I},n?r.gallery_id=n:k&&(r.gallery_title=k),e.n=4,Oo()({path:"/imagely/v1/folders/import",method:"POST",headers:Do(),data:r}).catch(function(){var e=No(Zg().m(function e(t){var n;return Zg().w(function(e){for(;;)switch(e.n){case 0:if(console.error("Error importing folder:",t),!(t instanceof Response)){e.n=2;break}return e.n=1,t.json();case 1:if(null==(n=e.v)||!n.error){e.n=2;break}throw new Error(n.error);case 2:throw new Error((0,pe.__)("Failed to import folder. Please try again.","nggallery"));case 3:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}());case 4:if(!(a=e.v)||"object"!==t(a)||!("error"in a)){e.n=5;break}throw new Error(a.error);case 5:if(o=null==a?void 0:a.gallery_id){e.n=6;break}throw new Error((0,pe.__)("No gallery ID returned from the import.","nggallery"));case 6:return Q((0,pe.__)("Folder imported successfully!","nggallery")),e.n=7,me(o);case 7:e.n=9;break;case 8:e.p=8,i=e.v,console.error("Error importing folder:",i),l=(null==i?void 0:i.message)||(0,pe.__)("Failed to import folder. Please try again.","nggallery"),C(l),W(l);case 9:return e.p=9,w(!1),e.f(9);case 10:return e.a(2)}},e,null,[[3,8,9,10]])}));return function(){return e.apply(this,arguments)}}(),oe=function(){var e=No(Zg().m(function e(r){var a,o,l,i,c,s,u;return Zg().w(function(e){for(;;)switch(e.n){case 0:if(ep(r)){e.n=1;break}return d(function(e){return e.map(function(e){return e.file===r?Yg(Yg({},e),{},{status:"error",error:(0,pe.__)("Invalid file type. Please upload images (JPEG, PNG, GIF, WebP) or ZIP files.","nggallery")}):e})}),e.a(2);case 1:return(o=new FormData).append("file",r),n?o.append("gallery_id",n.toString()):k&&o.append("gallery_name",k),d(function(e){return e.map(function(e){return e.file===r?Yg(Yg({},e),{},{status:"uploading",progress:1}):e})}),l=window,i=(null===(a=l.imagelyApp)||void 0===a?void 0:a.restURL)||"/wp-json/",c=i.replace(/\/+$/,""),s="".concat(c,"/imagely/v1/images/upload"),u=Ao(),e.n=2,new Promise(function(e){var n=new XMLHttpRequest,a=null;n.open("POST",s,!0),n.withCredentials=!0,u&&n.setRequestHeader("X-WP-Nonce",u),n.upload.onprogress=function(e){if(e.lengthComputable&&0!==e.total){var t=e.loaded/e.total*100,n=Math.round(t);d(function(e){return e.map(function(e){if(e.file!==r||"uploading"!==e.status)return e;var t=Math.min(100,Math.max(1,n)),a=Math.round(t/100*80),o=e.progress||0,l=Math.max(o,a);return Yg(Yg({},e),{},{progress:l})})}),e.lengthComputable&&e.loaded===e.total&&null===a&&(a=window.setInterval(function(){d(function(e){return e.map(function(e){if(e.file!==r||"uploading"!==e.status)return e;var t=e.progress||0;return t>=95?e:Yg(Yg({},e),{},{progress:Math.min(95,t+1)})})})},200))}},n.onerror=function(){null!==a&&clearInterval(a),console.error("Error uploading file:",r.name,n.statusText),d(function(e){return e.map(function(e){return e.file===r?Yg(Yg({},e),{},{status:"error",error:(0,pe.__)("Upload failed","nggallery")}):e})}),e(void 0)},n.onload=function(){var o;null!==a&&clearInterval(a);try{var l=n.status,i=n.responseText||"";if(l<200||l>=300){if(i)try{var c=JSON.parse(i);if(c&&"object"===t(c)&&c.error)throw new Error(c.error)}catch(e){console.error("Error parsing JSON:",e)}throw new Error((0,pe.__)("Upload failed","nggallery"))}if((o=i?JSON.parse(i):{}).error)throw new Error(o.error);d(function(e){return e.map(function(e){return e.file===r?Yg(Yg({},e),{},{status:"completed",progress:100}):e})}),J(r),e(o)}catch(t){console.error("Error uploading file:",r.name,t),d(function(e){return e.map(function(e){return e.file===r?Yg(Yg({},e),{},{status:"error",error:(0,pe.__)("Upload failed","nggallery")}):e})}),e(void 0)}},n.send(o)});case 2:return e.a(2,e.v)}},e)}));return function(t){return e.apply(this,arguments)}}();(0,$.useEffect)(function(){return function(){P.forEach(function(e){e.preview.startsWith("blob:")&&URL.revokeObjectURL(e.preview)})}},[P]);var le=function(e){var t=Array.from(e).map(function(e){return{file:e,preview:tp(e)?Ns({width:130,height:130,text:"ZIP FILE",backgroundColor:"#f0f0f0",textColor:"#666666",fontSize:24}):URL.createObjectURL(e),excluded:!1,id:"".concat(e.name,"-").concat(e.lastModified)}});j(function(e){return[].concat(ko(e),ko(t))})},ie=function(){var e=No(Zg().m(function e(t){var a,o,l,i,c,s,u,m,g,p,f,y,h,b;return Zg().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,n||k.trim()){e.n=1;break}return W((0,pe.__)("Please provide a gallery title.","nggallery")),e.a(2);case 1:if(a=Array.from(t),o=a.map(function(e){return{file:e,progress:0,status:"pending"}}),d(function(e){return[].concat(ko(e),ko(o))}),l=n,i=!1,c=function(){var e=No(Zg().m(function e(t){var n;return Zg().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,oe(t);case 1:return(n=e.v)&&!n.error||(i=!0),e.a(2,n)}},e)}));return function(t){return e.apply(this,arguments)}}(),s=0,n||!(a.length>0)){e.n=3;break}return e.n=2,c(a[0]);case 2:u=e.v,s=1,null!=u&&u.gallery_id&&(l=u.gallery_id,r||U(l),n=l);case 3:if(!l){e.n=4;break}if(!((m=a.length-s)>0)){e.n=4;break}for(g=s,p=function(){var e=No(Zg().m(function e(){var t,n;return Zg().w(function(e){for(;;)switch(e.n){case 0:if(!((t=g)>=a.length)){e.n=1;break}return e.a(3,3);case 1:return g+=1,n=a[t],e.n=2,c(n);case 2:e.n=0;break;case 3:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}(),f=Math.min(3,m),y=[],h=0;h<f;h++)y.push(p());return e.n=4,Promise.all(y);case 4:if(i||!l){e.n=5;break}return Q((0,pe.__)("Images uploaded successfully!","nggallery")),e.n=5,me(l);case 5:j([]),e.n=7;break;case 6:e.p=6,b=e.v,console.error("Error handling file upload:",b),W((0,pe.__)("Failed to upload images. Please try again.","nggallery"));case 7:return e.p=7,e.f(7);case 8:return e.a(2)}},e,null,[[0,6,7,8]])}));return function(t){return e.apply(this,arguments)}}(),ce=function(){var e=No(Zg().m(function e(t){var r,a,o;return Zg().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,w(!0),C(""),r={attachment_ids:t},n?r.gallery_id=n:k&&(r.gallery_name=k),e.n=1,Oo()({path:"/imagely/v1/images/import-media-library",method:"POST",headers:Do(),data:r});case 1:if(!(a=e.v).error){e.n=2;break}throw new Error(a.error);case 2:return e.a(2,a);case 3:throw e.p=3,o=e.v,console.error("Error importing media library images:",o),C((0,pe.__)("Failed to import media library images. Please try again.","nggallery")),o;case 4:return e.p=4,w(!1),e.f(4);case 5:return e.a(2)}},e,null,[[0,3,4,5]])}));return function(t){return e.apply(this,arguments)}}(),se=function(){var e=No(Zg().m(function e(){var t;return Zg().w(function(e){for(;;)switch(e.n){case 0:if(n||k.trim()){e.n=1;break}return W((0,pe.__)("Please provide a gallery title.","nggallery")),e.a(2);case 1:(t=window.wp.media({title:(0,pe.__)("Select Images","nggallery"),button:{text:(0,pe.__)("Add to Gallery","nggallery")},multiple:!0,library:{type:"image"},states:[new window.wp.media.controller.Library({library:window.wp.media.query({type:"image"}),multiple:!0,title:(0,pe.__)("Select Images","nggallery"),priority:20,filterable:"uploaded",editable:!0,allowLocalEdits:!0,displaySettings:!0,displayUserSettings:!0})]})).on("open",function(){setTimeout(function(){var e=document.querySelector(".media-button-primary");e?e.addEventListener("click",function(){G.showNotice("info",(0,pe.__)("Loading images from WP Media, please wait...","nggallery"),{dismissible:!0,duration:15e3}),G.setPageLoading(!0)},{once:!0}):document.querySelectorAll(".media-button").forEach(function(e){e.addEventListener("click",function(){var t;(null!==(t=e.textContent)&&void 0!==t&&t.includes("Add to Gallery")||e.classList.contains("media-button-primary"))&&(G.showNotice("info",(0,pe.__)("Loading images from WP Media, please wait...","nggallery"),{dismissible:!0,duration:15e3}),G.setPageLoading(!0))},{once:!0})})},100)}),t.on("select",No(Zg().m(function e(){var n,r,a,o,l;return Zg().w(function(e){for(;;)switch(e.p=e.n){case 0:return n=t.state().get("selection").toJSON(),r=n.map(function(e){return e.id}),e.p=1,e.n=2,ce(r);case 2:if(!(a=e.v).error){e.n=3;break}throw new Error(a.error);case 3:if(o=null==a?void 0:a.gallery_id){e.n=4;break}throw new Error((0,pe.__)("No gallery ID returned from the import.","nggallery"));case 4:return e.n=5,me(o);case 5:Q((0,pe.__)("Media library images imported successfully!","nggallery")),e.n=7;break;case 6:e.p=6,l=e.v,console.error("Error importing images:",l),W((0,pe.__)("Failed to import media library images. Please try again.","nggallery")),G.clearAllNotices(),G.setPageLoading(!1);case 7:return e.a(2)}},e,null,[[1,6]])}))),t.open();case 2:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}(),ue=function(){return new Promise(function(e){var t=function(){var n=document.querySelectorAll('[data-testid="gallery-image"], .gallery-image, img[src*="gallery"]');if(n.length>0){var r=Array.from(n).filter(function(e){return e.complete&&0!==e.naturalHeight});if(r.length===n.length&&r.length>0)return void e()}setTimeout(t,200)};setTimeout(t,300),setTimeout(function(){e()},3e3)})},me=function(){var e=No(Zg().m(function e(t){return Zg().w(function(e){for(;;)switch(e.n){case 0:H.invalidateQueries({queryKey:["gallery",t,"images"]}),H.invalidateQueries({queryKey:["gallery",t]}),H.invalidateQueries({queryKey:["galleries"]}),R&&(r?r(t):z("imagely-add-new","images",t)),G.setActiveModal(null),setTimeout(No(Zg().m(function e(){return Zg().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,ue();case 1:G.clearAllNotices(),G.setPageLoading(!1);case 2:return e.a(2)}},e)})),100);case 1:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}(),de=function(e){var t={type:e};switch(e){case"dribbble":return Yg(Yg({},t),{},{dribbble_type:"users_self_media_recent",dribbble_number:5,dribbble_link:0,dribbble_image_size:"default",dribbble_link_target:0,dribbble_caption:1,dribbble_caption_length:999,dribbble_random:0,dribbble_cache:1});case"tiktok":return Yg(Yg({},t),{},{tiktok_account:1,tiktok_number:10,tiktok_link:0,tiktok_image_size:"default",tiktok_link_target:0,tiktok_caption:1,tiktok_caption_length:999,tiktok_cache:1});case"google_photos":return Yg(Yg({},t),{},{google_photos_account:1});case"video":return Yg(Yg({},t),{},{show_video_controls:!0,show_play_pause_controls:!0,autoplay_videos:!1});default:return t}},fe=function(){var e=No(Zg().m(function e(t){var n,a,o,l,i,c,s,u;return Zg().w(function(e){for(;;)switch(e.p=e.n){case 0:if(n=null,!["tiktok","dribbble","dropbox","google_photos"].includes(t.toLowerCase())||"pro"===zr){e.n=1;break}return a={tiktok:"TikTok",dribbble:"Dribbble",dropbox:"Dropbox",google_photos:"Google Photos"},G.setActiveModal("upgrade",{feature:a[t.toLowerCase()]}),e.a(2);case 1:if(e.p=1,G.setPageLoading(!0),k.trim()){e.n=2;break}return G.setPageLoading(!1),W((0,pe.__)("Please provide a gallery title.","nggallery")),e.a(2);case 2:return F(t),o=k.trim(),e.n=3,V.mutateAsync({title:o,name:o,galdesc:""});case 3:if(null!=(l=e.v)&&l.gid){e.n=4;break}throw new Error((0,pe.__)("Failed to create gallery","nggallery"));case 4:return i=l.gid,n=i,c=de(t),e.n=5,K.mutateAsync({id:i,data:{external_source:c}});case 5:n=null,H.refetchQueries({queryKey:["galleries"],type:"all"}),H.invalidateQueries({queryKey:["gallery",i]}),G.setActiveModal(null),r?r(i):z("imagely-add-new","images",i),Q((0,pe.__)("Gallery created successfully!","nggallery")),e.n=11;break;case 6:if(e.p=6,s=e.v,console.error("Error creating gallery:",s),!n){e.n=10;break}return e.p=7,e.n=8,X.mutateAsync(n);case 8:e.n=10;break;case 9:e.p=9,u=e.v,console.error("Failed to cleanup partially created gallery:",u);case 10:W((0,pe.__)("Failed to create gallery. Please try again.","nggallery"));case 11:return e.p=11,G.setPageLoading(!1),e.f(11);case 12:return e.a(2)}},e,null,[[7,9],[1,6,11,12]])}));return function(t){return e.apply(this,arguments)}}(),ye=[{id:"media",icon:Cn,label:"Media Library",iconSize:"default",onClick:function(){F("media"),se()},isVisible:function(){return!0}},{id:"folder",icon:Nn,label:"Import Folder",iconSize:"default",onClick:function(){l("folder"),F("folder")},isVisible:function(){var e;return ti(null===(e=window.imagelyApp)||void 0===e?void 0:e.canImportFolderFromServer,!0)&&(!n||k)}},{id:"instagram",icon:Tr,label:"Instagram",iconSize:"default",onClick:function(){return fe("instagram")},isVisible:function(){var e;return null==Y||null===(e=Y.enabled_addons)||void 0===e?void 0:e.instagram}},{id:"tiktok",icon:Ir,label:"TikTok",iconSize:"small",onClick:function(){var e;"pro"!==zr?G.setActiveModal("upgrade",{feature:"TikTok"}):null!=Y&&null!==(e=Y.enabled_addons)&&void 0!==e&&e.tiktok?fe("tiktok"):window.location.href="".concat(window.location.origin,"/wp-admin/admin.php?page=imagely-addons")},isVisible:function(){return!n}},{id:"dribbble",icon:Ar,label:"Dribbble",iconSize:"default",onClick:function(){var e;"pro"!==zr?G.setActiveModal("upgrade",{feature:"Dribbble"}):null!=Y&&null!==(e=Y.enabled_addons)&&void 0!==e&&e.dribbble?fe("dribbble"):window.location.href="".concat(window.location.origin,"/wp-admin/admin.php?page=imagely-addons")},isVisible:function(){return!n}},{id:"google_photos",icon:jr,label:"Google Photos",iconSize:"default",onClick:function(){var e;"pro"!==zr?G.setActiveModal("upgrade",{feature:"Google Photos"}):null!=Y&&null!==(e=Y.enabled_addons)&&void 0!==e&&e.google_photos?n?G.setActiveModal(null):fe("google_photos"):window.location.href="".concat(window.location.origin,"/wp-admin/admin.php?page=imagely-addons")},isVisible:function(){return!n&&(void 0===(null==Z?void 0:Z.addon_show_google_photos)||ni(Z.addon_show_google_photos))}},{id:"video-links",icon:Vn,label:"Video Links",iconSize:"default",onClick:function(){"pro"!==zr?G.setActiveModal("upgrade",{feature:"Video Links"}):F("video-links")},isVisible:function(){return!0}},{id:"dropbox",icon:Fr,label:"Dropbox",iconSize:"default",onClick:function(){var e;"pro"!==zr?G.setActiveModal("upgrade",{feature:"Dropbox"}):null!=Y&&null!==(e=Y.enabled_addons)&&void 0!==e&&e.dropbox?n||k.trim()?F("dropbox"):W((0,pe.__)("Please provide a gallery title.","nggallery")):window.location.href="".concat(window.location.origin,"/wp-admin/admin.php?page=imagely-addons")},isVisible:function(){return!0}}].filter(function(e){return e.isVisible()});return ee().createElement("div",{className:"p-0 max-h-[90vh] flex flex-col overflow-y-auto"},!n&&ee().createElement("form",{onSubmit:ne,className:"mb-6"},ee().createElement(uc,{type:"text",name:"gallery-title",value:k,onChange:function(e){return S(e.target.value)},label:(0,pe.__)("Gallery Title","nggallery"),placeholder:(0,pe.__)("Enter a title for your new gallery","nggallery")}),ee().createElement("button",{type:"submit",style:{display:"none"},"aria-hidden":"true"})),ee().createElement("div",{className:"flex-1 min-h-0"},"dropbox"===L?ee().createElement(Kg,{integrationType:"dropbox",galleryId:n,galleryTitle:k,onSuccess:me}):"video-links"===L?ee().createElement(Zo,{galleryId:n,galleryTitle:k,onSuccess:me}):"google_photos"===L&&n?ee().createElement(Kg,{integrationType:"google_photos",galleryId:n}):"folder"===o?ee().createElement("div",{className:"flex flex-col h-full"},ee().createElement("div",{className:"flex items-center space-x-1 sm:space-x-2 text-xs sm:text-sm mb-2 bg-white overflow-x-auto"},ee().createElement("button",{onClick:function(){return te("")},className:"text-gray-700 underline hover:text-green-600 p-0"},(0,pe.__)("Root","nggallery")),h&&ee().createElement(ee().Fragment,null,ee().createElement("span",null,"/"),h.split("/").filter(Boolean).map(function(e,t,n){return ee().createElement(ee().Fragment,{key:e},ee().createElement("button",{onClick:function(){return te(n.slice(0,t+1).join("/"))},className:"text-gray-700 underline hover:text-green-600"},e),t<n.length-1&&ee().createElement("span",null,"/"))}))),ee().createElement("div",{className:"flex-1 min-h-0 overflow-hidden flex flex-col"},ee().createElement("div",{className:"border rounded-lg divide-y max-h-48 sm:max-h-64 overflow-y-auto"},_?ee().createElement("div",{className:"p-2 text-center text-gray-500 text-xs sm:text-sm"},(0,pe.__)("Loading...","nggallery")):p.length>0?p.map(function(e){return ee().createElement("button",{key:e.relative_path,onClick:function(){te(e.relative_path)},className:"w-full text-left py-2 px-2 sm:py-1.5 hover:bg-gray-50 flex items-center space-x-2 text-xs sm:text-sm"},ee().createElement("span",{className:"text-sm sm:text-base"},ee().createElement(En,null)),ee().createElement("span",{className:"truncate"},e.name))}):ee().createElement("div",{className:"p-2 text-center text-gray-500 text-xs sm:text-sm"},h?(0,pe.__)("No subdirectories found. Click Import to import images from this folder.","nggallery"):(0,pe.__)("No directories found.","nggallery"))),ee().createElement("div",{className:"mt-3 sm:mt-4 p-2 sm:p-3 rounded-lg border"},ee().createElement(fs,{id:"keep-original-location",name:"keep_original_location",checked:I,onChange:function(e){return A(e.target.checked)},label:(0,pe.__)("Keep images in original location","nggallery"),help:(0,pe.__)("Caution: If you keep images in the original folder and later delete the gallery, the images in that folder might be deleted depending on your settings.","nggallery")})),E&&ee().createElement("div",{className:"text-red-500 text-xs sm:text-sm p-2 mt-2"},E),h&&ee().createElement("div",{className:"mt-3 sm:mt-4"},ee().createElement("button",{onClick:ae,disabled:_,className:"w-full py-2 sm:py-3 px-3 sm:px-4 text-white rounded-lg transition-colors text-sm sm:text-base ".concat(_?"bg-green-300":"bg-green-500 hover:bg-green-600")},_?(0,pe.__)("Importing...","nggallery"):(0,pe.__)("Import Selected Folder","nggallery"))))):ee().createElement("div",{className:"relative text-center p-4 sm:p-8 border border-dashed rounded-lg transition-colors h-full overflow-y-auto ".concat(c?"border-blue-500 bg-blue-50":"border-gray-300"),onDragOver:function(e){e.preventDefault(),s(!0)},onDragLeave:function(e){e.preventDefault(),s(!1)},onDrop:function(e){e.preventDefault(),s(!1);var t=e.dataTransfer.files;t.length>0&&le(t)}},ee().createElement("input",{ref:M,type:"file",multiple:!0,accept:"".concat($g.images,",").concat($g.zip),onChange:function(e){var t=e.target.files;t&&t.length>0&&le(t)},className:"hidden"}),m.length>0?ee().createElement("div",{className:"space-y-3 sm:space-y-4"},m.map(function(e,t){return ee().createElement("div",{key:"".concat(e.file.name,"-").concat(t),className:"text-left py-3 px-5 sm:p-4 text-gray-900"},ee().createElement("div",{className:"flex justify-between mb-2"},ee().createElement("span",{className:"text-xs sm:text-sm text-gray-900 truncate pr-2"},e.file.name),ee().createElement("span",{className:"text-xs sm:text-sm text-gray-900 flex-shrink-0"},"completed"===e.status&&"✓","error"===e.status&&"❌","uploading"===e.status&&"".concat(e.progress,"%"))),ee().createElement("div",{className:"w-full bg-gray-100 rounded-full h-1"},ee().createElement("div",{className:"h-1 rounded-full ".concat("completed"===e.status?"bg-green-500":"error"===e.status?"bg-red-500":"bg-blue-500"),style:{width:"".concat(e.progress,"%")}})),e.error&&ee().createElement("p",{className:"text-xs sm:text-sm text-red-500 mt-1"},e.error))})):P.length>0?ee().createElement("div",{className:"space-y-3 sm:space-y-4"},ee().createElement("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-2 sm:gap-4"},ee().createElement("button",{onClick:function(){var e;return null===(e=M.current)||void 0===e?void 0:e.click()},className:"relative aspect-square border-2 border-dashed border-gray-300 rounded-lg hover:border-gray-400 transition-colors flex flex-col items-center justify-center gap-1 sm:gap-2"},ee().createElement("span",{className:"text-xl sm:text-2xl"},"+"),ee().createElement("span",{className:"text-xs sm:text-sm text-gray-600"},(0,pe.__)("Add More","nggallery"))),P.filter(function(e){return!e.excluded}).map(function(e){return ee().createElement("div",{key:e.id,className:"relative aspect-square group"},ee().createElement("div",{className:"absolute inset-0 rounded-lg overflow-hidden"},ee().createElement("img",{src:e.preview,alt:e.file.name,className:"w-full h-full object-cover"}),ee().createElement("div",{className:"absolute inset-0 bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center cursor-pointer",onClick:function(t){var n;t.preventDefault(),t.stopPropagation(),n=e.file,j(function(e){return e.map(function(e){return e.file===n?Yg(Yg({},e),{},{excluded:!0}):e})})},title:(0,pe.__)("Remove","nggallery")},ee().createElement("div",{className:"text-white transform scale-100 group-hover:scale-110 transition-transform"},ee().createElement(xn,null)))))})),ee().createElement("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center mt-4 sm:mt-6 pt-3 sm:pt-4 border-t border-gray-200 gap-3 sm:gap-0"},ee().createElement("div",{className:"text-xs sm:text-sm text-gray-500"},P.filter(function(e){return!e.excluded}).length," ",(0,pe.__)("files selected","nggallery")),ee().createElement("div",{className:"flex gap-2 sm:gap-3 w-full sm:w-auto"},ee().createElement("button",{onClick:function(){j([]),M.current&&(M.current.value="")},className:"px-3 sm:px-4 py-2 text-sm font-medium text-gray-600 hover:text-gray-800 transition-colors"},(0,pe.__)("Clear All","nggallery")),ee().createElement("button",{onClick:function(){var e=P.filter(function(e){return!e.excluded}).map(function(e){return e.file});ie(e)},className:"px-4 sm:px-6 py-2 bg-green-500 text-white rounded-lg hover:bg-green-600 transition-colors text-sm font-medium flex-1 sm:flex-none",disabled:0===P.filter(function(e){return!e.excluded}).length},(0,pe.__)("Upload","nggallery"))))):ee().createElement(ee().Fragment,null,ee().createElement("div",{className:"flex flex-col items-center mb-4 sm:mb-6 p-4 sm:p-4 border border-dashed border-gray-300 rounded-lg bg-[#f8f9fb]"},ee().createElement("div",{className:"flex flex-col items-center"},ee().createElement(ar,{className:"mb-4"}),ee().createElement("p",{className:"text-[14px] sm:text-[14px] text-gray-600 "},(0,pe.__)("Drag & Drop images or","nggallery")," ",ee().createElement("button",{onClick:function(){var e;return null===(e=M.current)||void 0===e?void 0:e.click()},className:"text-green-500 hover:text-green-600 underline hover:underline transition-colors cursor-pointer bg-transparent border-none p-0 text-sm sm:text-base font-bold"},(0,pe.__)("Browse from Computer","nggallery"))))),ee().createElement("div",{className:"flex flex-col gap-3"},ee().createElement("div",{className:"grid grid-cols-3 gap-4 justify-items-center"},ye.map(function(e){return ee().createElement(ps,{key:e.id,icon:e.icon,label:e.label,isSelected:L===e.id,onClick:e.onClick,iconSize:e.iconSize})})))))))};function rp(e){var t="string"==typeof e?parseFloat(e):"number"==typeof e?e:NaN;return Number.isFinite(t)&&t>0?t:null}var ap=l(93),op=l.n(ap);function lp(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return ip(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(ip(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,ip(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,ip(m,"constructor",s),ip(s,"constructor",c),c.displayName="GeneratorFunction",ip(s,a,"GeneratorFunction"),ip(m),ip(m,a,"Generator"),ip(m,r,function(){return this}),ip(m,"toString",function(){return"[object Generator]"}),(lp=function(){return{w:o,m:d}})()}function ip(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}ip=function(e,t,n,r){function o(t,n){ip(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},ip(e,t,n,r)}function cp(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function sp(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?cp(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):cp(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function up(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return mp(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(mp(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,mp(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,mp(m,"constructor",s),mp(s,"constructor",c),c.displayName="GeneratorFunction",mp(s,a,"GeneratorFunction"),mp(m),mp(m,a,"Generator"),mp(m,r,function(){return this}),mp(m,"toString",function(){return"[object Generator]"}),(up=function(){return{w:o,m:d}})()}function mp(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}mp=function(e,t,n,r){function o(t,n){mp(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},mp(e,t,n,r)}function dp(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function gp(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?dp(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):dp(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function pp(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return fp(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(fp(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,fp(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,fp(m,"constructor",s),fp(s,"constructor",c),c.displayName="GeneratorFunction",fp(s,a,"GeneratorFunction"),fp(m),fp(m,a,"Generator"),fp(m,r,function(){return this}),fp(m,"toString",function(){return"[object Generator]"}),(pp=function(){return{w:o,m:d}})()}function fp(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}fp=function(e,t,n,r){function o(t,n){fp(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},fp(e,t,n,r)}function yp(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function hp(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?yp(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):yp(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function bp(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return vp(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(vp(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,vp(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,vp(m,"constructor",s),vp(s,"constructor",c),c.displayName="GeneratorFunction",vp(s,a,"GeneratorFunction"),vp(m),vp(m,a,"Generator"),vp(m,r,function(){return this}),vp(m,"toString",function(){return"[object Generator]"}),(bp=function(){return{w:o,m:d}})()}function vp(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}vp=function(e,t,n,r){function o(t,n){vp(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},vp(e,t,n,r)}function _p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function wp(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?_p(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_p(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function xp(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return Ep(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Ep(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Ep(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,Ep(m,"constructor",s),Ep(s,"constructor",c),c.displayName="GeneratorFunction",Ep(s,a,"GeneratorFunction"),Ep(m),Ep(m,a,"Generator"),Ep(m,r,function(){return this}),Ep(m,"toString",function(){return"[object Generator]"}),(xp=function(){return{w:o,m:d}})()}function Ep(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}Ep=function(e,t,n,r){function o(t,n){Ep(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Ep(e,t,n,r)}var Cp=function(e,t){var n,r,a,o=(null===(n=window.imagelyApp)||void 0===n?void 0:n.utmVersion)||"";e?r=e:r="imagely"===(a=(new URLSearchParams(window.location.search).get("page")||"imagely").replace(/^imagely-?/,""))||""===a?"galleries":a.replace(/[-_\s]/g,"").toLowerCase();var l="".concat("https://www.imagely.com/lite","?utm_source=").concat("ngg","&utm_medium=").concat(r,"&utm_campaign=").concat("upgradetopro");if(o){var i=t?"_".concat(t.replace(/\s+/g,"").toLowerCase()):"";l+="&utm_content=".concat(encodeURIComponent(o+i))}return l};function Np(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return kp(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(kp(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,kp(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,kp(m,"constructor",s),kp(s,"constructor",c),c.displayName="GeneratorFunction",kp(s,a,"GeneratorFunction"),kp(m),kp(m,a,"Generator"),kp(m,r,function(){return this}),kp(m,"toString",function(){return"[object Generator]"}),(Np=function(){return{w:o,m:d}})()}function kp(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}kp=function(e,t,n,r){function o(t,n){kp(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},kp(e,t,n,r)}var Sp=function(){var e=No(Np().m(function e(t){var n,r;return Np().w(function(e){for(;;)switch(e.n){case 0:return n="/imagely/v1/pricelist-items?pricelist_id=".concat(t),e.n=1,Oo()({path:n});case 1:return r=e.v,e.a(2,r)}},e)}));return function(t){return e.apply(this,arguments)}}(),Op=function(){var e=No(Np().m(function e(t){var n,r,a,o,l;return Np().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,r=null===(n=window.imagelyApp)||void 0===n?void 0:n.nonce,e.n=1,Oo()({path:"/imagely/v1/pricelist-items/bulk",method:"POST",headers:{"X-WP-Nonce":r},data:{items:t}});case 1:if(!((a=e.v).created_items&&a.created_items.length>0)){e.n=2;break}return e.a(2,a.created_items);case 2:if(!(a.errors>0)){e.n=3;break}throw new Error("Failed to create items: ".concat((null===(o=a.error_messages)||void 0===o?void 0:o.join(", "))||"Unknown error"));case 3:throw new Error("No items were created");case 4:e.n=6;break;case 5:throw e.p=5,l=e.v,console.error("Error creating multiple pricelist items:",l),l;case 6:return e.a(2)}},e,null,[[0,5]])}));return function(t){return e.apply(this,arguments)}}(),Pp=function(){var e=No(Np().m(function e(t){var n,r,a,o;return Np().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,r=null===(n=window.imagelyApp)||void 0===n?void 0:n.nonce,e.n=1,Oo()({path:"/nggpro/v1/commerce/admin/save_pricelist",method:"POST",headers:{"X-WP-Nonce":r},data:t});case 1:return a=e.v,e.a(2,a);case 2:throw e.p=2,o=e.v,console.error("❌ Error saving pricelist (legacy):",o),console.error("❌ Error details:",{message:o.message,status:o.status,response:o.response,data:t}),o;case 3:return e.a(2)}},e,null,[[0,2]])}));return function(t){return e.apply(this,arguments)}}();function jp(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return Tp(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Tp(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Tp(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,Tp(m,"constructor",s),Tp(s,"constructor",c),c.displayName="GeneratorFunction",Tp(s,a,"GeneratorFunction"),Tp(m),Tp(m,a,"Generator"),Tp(m,r,function(){return this}),Tp(m,"toString",function(){return"[object Generator]"}),(jp=function(){return{w:o,m:d}})()}function Tp(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}Tp=function(e,t,n,r){function o(t,n){Tp(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Tp(e,t,n,r)}var Ip=function(){var e=No(jp().m(function e(t){var n,r,a,o,l,i;return jp().w(function(e){for(;;)switch(e.p=e.n){case 0:return n="/imagely/v1/whcc-catalog",r=t?"".concat(n,"?category=").concat(encodeURIComponent(t)):n,e.p=1,o=null===(a=window.imagelyApp)||void 0===a?void 0:a.nonce,e.n=2,Oo()({path:r,method:"GET",headers:{"X-WP-Nonce":o}});case 2:return l=e.v,e.a(2,l);case 3:throw e.p=3,i=e.v,console.error("Error fetching WHCC catalog:",i),i;case 4:return e.a(2)}},e,null,[[1,3]])}));return function(t){return e.apply(this,arguments)}}();function Ap(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return Dp(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Dp(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Dp(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,Dp(m,"constructor",s),Dp(s,"constructor",c),c.displayName="GeneratorFunction",Dp(s,a,"GeneratorFunction"),Dp(m),Dp(m,a,"Generator"),Dp(m,r,function(){return this}),Dp(m,"toString",function(){return"[object Generator]"}),(Ap=function(){return{w:o,m:d}})()}function Dp(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}Dp=function(e,t,n,r){function o(t,n){Dp(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Dp(e,t,n,r)}function Lp(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Fp(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Lp(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Lp(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var Mp=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"$";if("number"==typeof t)return"".concat(n," ").concat(t.toFixed(2));var r=tc(e);return"".concat(n," ").concat(r.toFixed(2))},Rp=function(e){var t=e.className;return ee().createElement("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},ee().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"}))};var Gp={gallery:function(e){var t=e.isOpen,n=e.onClose,r=e.onGalleryCreated,a=ye(e,ss),o=Kl(),l=(0,$.useCallback)(function(){n&&n(),null!=o&&o.isEmbed&&null!=o&&o.onClose&&o.onClose()},[n,o]);return ee().createElement(Eo,fe({isOpen:t,onClose:l,title:(0,pe.__)("New Gallery","nggallery")},a),ee().createElement(cs,{onSuccess:r}))},album:function(e){var t=e.isOpen,r=e.onClose,a=e.onAlbumCreated,o=ye(e,Xl),l=vo((0,$.useState)(""),2),i=l[0],c=l[1],s=vo((0,$.useState)(!1),2),u=s[0],m=s[1],d=function(){var e,t=re();return gl({mutationFn:(e=No(zl().m(function e(t){var n,r,a;return zl().w(function(e){for(;;)switch(e.n){case 0:return r=null===(n=window.imagelyApp)||void 0===n?void 0:n.nonce,e.n=1,Oo()({path:"/imagely/v1/albums",method:"POST",headers:{"X-WP-Nonce":r,"Content-Type":"application/json"},data:t});case 1:return a=e.v,e.a(2,a)}},e)})),function(t){return e.apply(this,arguments)}),onSuccess:function(){t.invalidateQueries({queryKey:["albums"]})}})}(),g=$o(),p=g.showSuccess,f=g.showError,y=(0,ge.useDispatch)(Br),h=Kl(),b=(0,$.useCallback)(function(){var e=No(Yl().m(function e(t){var o,l,s,u,g,b,v,_;return Yl().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t.preventDefault(),i.trim()){e.n=1;break}return f((0,pe.__)("Album name is required","nggallery")),e.a(2);case 1:return m(!0),e.p=2,u="photocrati-nextgen_basic_compact_album",g={open_gallery_in_lightbox:!1,gallery_display_type:"photocrati-nextgen_basic_thumbnails",galleries_per_page:20,enable_breadcrumbs:1,enable_descriptions:0,display_view:"default",template:"default",override_thumbnail_settings:1,thumbnail_width:240,thumbnail_height:160,thumbnail_crop:1,animate_images_enable:!1,animate_images_style:"wobble",animate_images_duration:1500,animate_images_delay:250,animate_pagination_enable:!1,animate_pagination_style:"flipInX",animate_pagination_duration:1500,animate_pagination_delay:250,is_ecommerce_enabled:0},b={name:i.trim(),description:"",sortorder:[],display_type:u,display_type_settings:n({},u,g)},e.n=3,d.mutateAsync(b);case 3:null!=(v=e.v)&&v.message&&p(v.message),c(""),a&&null!=v&&null!==(o=v.album)&&void 0!==o&&o.id?a(v.album.id):null!=h&&h.isEmbed&&null!=h&&h.onInsertAlbum&&null!=v&&null!==(l=v.album)&&void 0!==l&&l.id?h.onInsertAlbum(v.album.id):null!=v&&null!==(s=v.album)&&void 0!==s&&s.id?(y.navigateTo("imagely-albums","galleries",v.album.id),r()):r(),e.n=5;break;case 4:e.p=4,_=e.v,console.error("❌ Error details:",JSON.stringify(_,null,2)),f((0,pe.__)("Failed to create album","nggallery"));case 5:return e.p=5,m(!1),e.f(5);case 6:return e.a(2)}},e,null,[[2,4,5,6]])}));return function(t){return e.apply(this,arguments)}}(),[i,p,f,r,d,y,h]),v=(0,$.useCallback)(function(){c(""),r(),null!=h&&h.isEmbed&&null!=h&&h.onClose&&h.onClose()},[r,h]);return ee().createElement(Eo,fe({isOpen:t,onClose:v,title:(0,pe.__)("Create New Album","nggallery")},o),ee().createElement("form",{onSubmit:b,className:"space-y-6"},ee().createElement("div",null,ee().createElement("label",{htmlFor:"album-name",className:"block text-sm font-medium text-gray-700 mb-2"},(0,pe.__)("Album Name","nggallery")," ",ee().createElement("span",{className:"text-red-500"},"*")),ee().createElement("input",{id:"album-name",type:"text",value:i,onChange:function(e){return c(e.target.value)},className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-green-500 focus:border-green-500",placeholder:(0,pe.__)("Enter album name","nggallery"),disabled:u,required:!0})),ee().createElement("div",{className:"flex justify-end space-x-3 pt-4 border-t border-gray-200"},ee().createElement("button",{type:"button",onClick:v,disabled:u,className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 disabled:opacity-50"},(0,pe.__)("Cancel","nggallery")),ee().createElement("button",{type:"submit",disabled:u||!i.trim(),className:"px-4 py-2 text-sm font-medium text-white bg-green-500 border border-transparent rounded-md hover:bg-green-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 disabled:opacity-50 disabled:cursor-not-allowed inline-flex items-center"},u?ee().createElement("span",{className:"inline-flex items-center"},ee().createElement("span",{className:"mr-2"},ee().createElement(oo,{size:"sm",color:"gray",className:"!border-white",centerInContainer:!1})),ee().createElement("span",null,(0,pe.__)("Creating...","nggallery"))):(0,pe.__)("Create Album","nggallery")))))},albumSuccess:function(e){var t=e.isOpen,n=e.onClose,r=e.albumId,a=e.albumName,o=(0,ge.useDispatch)(Br),l=(0,$.useMemo)(function(){return r?'[imagely album="'.concat(r,'"]'):""},[r]),i=function(){var e=No(Jl().m(function e(){return Jl().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,navigator.clipboard.writeText(l);case 1:o.showNotice("success",(0,pe.__)("Shortcode copied to clipboard!","nggallery")),e.n=3;break;case 2:e.p=2,e.v,o.showNotice("error",(0,pe.__)("Failed to copy shortcode to clipboard","nggallery"));case 3:return e.a(2)}},e,null,[[0,2]])}));return function(){return e.apply(this,arguments)}}();return ee().createElement(Eo,{isOpen:t,onClose:n,title:""},ee().createElement("div",{className:"text-center"},ee().createElement("div",{className:"flex items-center justify-center mx-auto"},ee().createElement(Gn,{className:"w-48 h-48"})),ee().createElement("h3",{className:"text-2xl font-semibold text-gray-800 mb-3"},a?(0,pe.sprintf)((0,pe.__)("%s updated successfully!","nggallery"),a):(0,pe.__)("Album updated successfully!","nggallery")),ee().createElement("p",{className:"text-gray-600 text-center mb-6 text-base"},(0,pe.__)("Your album is ready to be published. You can add it to any page, post, or widget area using the Imagely Album block or the shortcode below:","nggallery")),l&&ee().createElement("div",{className:"mb-8"},ee().createElement("button",{onClick:i,className:"bg-gray-100 border-2 border-gray-300 rounded-lg px-6 py-3 font-mono text-base text-gray-800 hover:bg-green-50 hover:border-green-500 transition-colors cursor-pointer w-3/5 mx-auto block",title:(0,pe.__)("Click to copy shortcode","nggallery")},l)),ee().createElement("div",{className:"flex justify-center mb-6"},ee().createElement("button",{onClick:function(){n(),o.navigateTo("imagely-albums","general")},className:"inline-flex items-center justify-center bg-green-500 text-white text-center text-base py-3 px-8 rounded-lg font-medium hover:bg-green-600 transition-colors"},(0,pe.__)("View Albums","nggallery")))))},galleryEdit:function(e){var t=e.isOpen,n=e.galleryId,r=e.onClose,a=kl(n),o=a.data,l=a.refetch;if(!o)return null;var i=function(){var e=No(ns().m(function e(){return ns().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,l();case 1:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}();return ee().createElement(Eo,{isOpen:t,onClose:r,title:(0,pe.__)("Edit Gallery Details","nggallery")},ee().createElement(ts,{gallery:o,onClose:r,onUpdate:i}))},gallerySuccess:function(e){var t=e.isOpen,n=e.onClose,r=e.galleryId,a=e.galleryName,o=e.pageId,l=e.pageName,i=(0,ge.useDispatch)(Br),c=vo((0,$.useState)(l),2),s=c[0],u=c[1],m=vo((0,$.useState)(void 0),2),d=m[0],g=m[1],p=vo((0,$.useState)(!1),2),f=(p[0],p[1]),y=(0,$.useMemo)(function(){return r?'[imagely id="'.concat(r,'"]'):""},[r]);(0,$.useEffect)(function(){var e=function(){var e=No(ds().m(function e(){var n,r,a,i,c;return ds().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!o||l||!t){e.n=6;break}return f(!0),e.p=1,e.n=2,Oo()({path:"/wp/v2/pages/".concat(o)});case 2:null!=(r=e.v)&&null!==(n=r.title)&&void 0!==n&&n.rendered&&u(r.title.rendered),null!=r&&r.link&&g(r.link),e.n=4;break;case 3:e.p=3,i=e.v,console.error("Error fetching page:",i);case 4:return e.p=4,f(!1),e.f(4);case 5:e.n=11;break;case 6:if(!(o&&l&&t)){e.n=11;break}return f(!0),e.p=7,e.n=8,Oo()({path:"/wp/v2/pages/".concat(o)});case 8:null!=(a=e.v)&&a.link&&g(a.link),e.n=10;break;case 9:e.p=9,c=e.v,console.error("Error fetching page:",c);case 10:return e.p=10,f(!1),e.f(10);case 11:return e.a(2)}},e,null,[[7,9,10,11],[1,3,4,5]])}));return function(){return e.apply(this,arguments)}}();e()},[o,l,t]),(0,$.useEffect)(function(){t||(u(l),g(void 0))},[t,l]);var h=function(){var e=No(ds().m(function e(){return ds().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,navigator.clipboard.writeText(y);case 1:i.showNotice("success",(0,pe.__)("Shortcode copied to clipboard!","nggallery")),e.n=3;break;case 2:e.p=2,e.v,i.showNotice("error",(0,pe.__)("Failed to copy shortcode to clipboard","nggallery"));case 3:return e.a(2)}},e,null,[[0,2]])}));return function(){return e.apply(this,arguments)}}();return ee().createElement(Eo,{isOpen:t,onClose:n,title:""},ee().createElement("div",{className:"text-center"},ee().createElement("div",{className:"flex items-center justify-center mx-auto"},ee().createElement(Gn,{className:"w-48 h-48"})),ee().createElement("h3",{className:"text-2xl font-semibold text-gray-800 mb-3"},a?(0,pe.sprintf)((0,pe.__)("%s created successfully!","nggallery"),a):(0,pe.__)("Gallery created successfully!","nggallery")),ee().createElement("p",{className:"text-gray-600 text-center mb-6 text-base"},o&&s?ee().createElement(ee().Fragment,null,(0,pe.__)("Your gallery has been linked to the page","nggallery")," ",d?ee().createElement("a",{href:d,target:"_blank",rel:"noopener noreferrer",className:"text-green-600 hover:text-green-700 font-medium underline"},'"',s,'"'):ee().createElement("span",{className:"font-medium"},'"',s,'"'),". ",(0,pe.__)("You can also add it to any other page, post, or widget area using the Imagely Gallery block or the shortcode below:","nggallery")):(0,pe.__)("Your gallery is ready to be published. You can add it to any page, post, or widget area using the Imagely Gallery block or the shortcode below:","nggallery")),y&&ee().createElement("div",{className:"mb-8"},ee().createElement("button",{onClick:h,className:"bg-gray-100 border-2 border-gray-300 rounded-lg px-6 py-3 font-mono text-base text-gray-800 hover:bg-green-50 hover:border-green-500 transition-colors cursor-pointer w-3/5 mx-auto block",title:(0,pe.__)("Click to copy shortcode","nggallery")},y)),ee().createElement("div",{className:"flex justify-center mb-6"},ee().createElement("button",{onClick:function(){n(),i.navigateTo("imagely","galleryList")},className:"inline-flex items-center justify-center bg-green-500 text-white text-center text-base py-3 px-8 rounded-lg font-medium hover:bg-green-700 transition-colors"},(0,pe.__)("View Galleries","nggallery")))))},deleteGalleries:function(e){var t=e.isOpen,n=e.galleries,r=e.onClose,a=void 0===r?function(){}:r,o=e.onConfirm,l=void 0===o?function(){}:o,i=e.title,c=ye(e,jc);return ee().createElement(kc,fe({isOpen:t,entityType:"galleries",items:n,getItemId:function(e){return e.id},getItemLabel:function(e){return e.galleryTitle},onClose:a,onConfirm:l,title:i||(0,pe.__)("Delete Galleries","nggallery"),singularLabel:(0,pe.__)("gallery","nggallery"),pluralLabel:(0,pe.__)("galleries","nggallery")},c))},deleteAlbums:function(e){var t=e.isOpen,n=e.albums,r=e.onClose,a=void 0===r?function(){}:r,o=e.onConfirm,l=void 0===o?function(){}:o,i=e.title,c=ye(e,Sc);return ee().createElement(kc,fe({isOpen:t,entityType:"albums",items:n,getItemId:function(e){return e.id},getItemLabel:function(e){return e.albumTitle},onClose:a,onConfirm:l,title:i||(0,pe.__)("Delete Albums","nggallery"),singularLabel:(0,pe.__)("album","nggallery"),pluralLabel:(0,pe.__)("albums","nggallery")},c))},deleteImages:function(e){var t=e.isOpen,n=e.images,r=e.onClose,a=void 0===r?function(){}:r,o=e.onConfirm,l=void 0===o?function(){}:o,i=e.title,c=ye(e,Tc);return ee().createElement(kc,fe({isOpen:t,entityType:"images",items:n,getItemId:function(e){return e.pid},getItemLabel:function(e){return e.filename},onClose:a,onConfirm:l,title:i||(0,pe.__)("Delete Images","nggallery"),singularLabel:(0,pe.__)("image","nggallery"),pluralLabel:(0,pe.__)("images","nggallery")},c))},deleteTags:function(e){var t=e.isOpen,n=e.tags,r=e.onClose,a=void 0===r?function(){}:r,o=e.onConfirm,l=void 0===o?function(){}:o,i=e.title,c=ye(e,Dc);return ee().createElement(kc,fe({isOpen:t,entityType:"tags",items:n,getItemId:function(e){return e.term_id},getItemLabel:function(e){return e.name},onClose:a,onConfirm:l,title:i||(0,pe.__)("Delete Tags","nggallery"),singularLabel:(0,pe.__)("tag","nggallery"),pluralLabel:(0,pe.__)("tags","nggallery")},c))},deleteCoupons:function(e){var t=e.isOpen,n=e.onClose,r=e.couponIds,a=e.items,o=e.onConfirm,l=void 0===o?function(){}:o,i=e.title,c=function(){var e,t=re();return gl({mutationFn:(e=No(Bi().m(function e(t){var n,r,a,o;return Bi().w(function(e){for(;;)switch(e.p=e.n){case 0:return r=null===(n=window.imagelyApp)||void 0===n?void 0:n.nonce,e.p=1,e.n=2,Oo()({path:"/imagely/v1/coupons/".concat(t),method:"DELETE",headers:{"X-WP-Nonce":r},parse:!1});case 2:e.n=5;break;case 3:if(e.p=3,404!==((null==(o=e.v)?void 0:o.status)||(null==o||null===(a=o.response)||void 0===a?void 0:a.status))){e.n=4;break}return e.a(2);case 4:throw o;case 5:return e.a(2)}},e,null,[[1,3]])})),function(t){return e.apply(this,arguments)}),onSettled:function(){t.invalidateQueries({queryKey:["coupons"]})}})}(),s=$o(),u=s.showSuccess,m=s.showError,d=s.clearNotifications,g=(0,$.useMemo)(function(){return a&&a.length?a:r.map(function(e){return{id:e,title:(0,pe.__)("Coupon","nggallery"),code:String(e)}})},[r,a]),p=(0,$.useMemo)(function(){return g.length>0&&g.length<=5?ee().createElement("ul",{className:"list-none text-sm text-gray-700 px-4 text-center"},g.map(function(e){return ee().createElement("li",{key:e.id},e.title," (",e.code,")")})):null},[g]),f=function(){var e=No(Oc().m(function e(){var t;return Oc().w(function(e){for(;;)switch(e.p=e.n){case 0:if(0!==r.length){e.n=1;break}return e.a(2);case 1:return c.reset&&c.reset(),e.p=2,e.n=3,Promise.all(r.map(function(e){return c.mutateAsync(e)}));case 3:t=1===r.length?(0,pe.__)("coupon","nggallery"):(0,pe.__)("coupons","nggallery"),d(),u((0,pe.__)("Successfully deleted ".concat(r.length," ").concat(t),"nggallery")),l(),n(),e.n=5;break;case 4:e.p=4,e.v,d(),m((0,pe.__)("Failed to delete coupon(s)","nggallery"));case 5:return e.a(2)}},e,null,[[2,4]])}));return function(){return e.apply(this,arguments)}}(),y=ee().createElement(rr,null);return ee().createElement(Eo,{isOpen:t,onClose:n},ee().createElement("div",{className:"space-y-4"},ee().createElement("div",{className:"flex items-center gap-2 justify-center"},ee().createElement("div",null,y)),i&&ee().createElement("h2",{className:"text-xl font-bold text-center text-gray-900 mt-2"},i),ee().createElement("p",{className:"text-sm text-gray-500 text-center"},1===r.length?(0,pe.__)("Are you sure you want to delete this coupon?","nggallery"):(0,pe.__)("Are you sure you want to delete the selected coupons?","nggallery")),p,ee().createElement("p",{className:"text-sm text-red-500 text-center"},(0,pe.__)("This action cannot be undone.","nggallery")),ee().createElement("div",{className:"flex justify-center space-x-3 !mb-4 ".concat(c.isPending?"cursor-wait":"")},ee().createElement("button",{type:"button",onClick:n,disabled:c.isPending,className:"px-8 py-2 font-medium text-white bg-green-500 rounded-lg shadow hover:bg-green-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"},(0,pe.__)("Cancel","nggallery")),ee().createElement("button",{type:"button",onClick:f,disabled:c.isPending,className:"px-8 py-2 font-bold text-white bg-red-600 border border-transparent rounded-lg shadow hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"},c.isPending?ee().createElement("span",{className:"flex items-center"},ee().createElement(kn,{className:"animate-spin -ml-1 mr-2 h-4 w-4 text-white"}),(0,pe.__)("Deleting...","nggallery")):(0,pe.__)("Delete","nggallery")))))},imageUploader:function(e){var t=e.isOpen,n=e.onClose,r=e.galleryId,a=e.onGalleryCreated,o=!r,l=o?(0,pe.__)("Add a New Gallery","nggallery"):(0,pe.__)("Add Images","nggallery");return ee().createElement(Eo,{isOpen:t,onClose:n,title:l,contentClassName:o?" !p-[38px] !rounded-2xl ":"",modalClassName:o?"rounded-2xl":""},ee().createElement(np,{galleryId:r,onGalleryCreated:a}))},imageView:function(e){var t=e.isOpen,n=e.onClose,r=e.image,a=e.returnTo,o=vo((0,$.useState)(!1),2),l=o[0],i=o[1],c=vo((0,$.useState)(void 0),2),s=c[0],u=c[1],m=vo((0,$.useState)(!1),2),d=m[0],g=m[1],p=vo((0,$.useState)(void 0),2),f=p[0],y=p[1],h=vo((0,$.useState)(null),2),b=h[0],v=h[1],_=(0,ge.useDispatch)(Br),w=r.galleryid,x=re(),E=kl(w).data,C=$o(),N=C.showSuccess,k=C.showError,S=Ll(),O=function(){var e,t=re();return gl({mutationFn:(e=No(vl().m(function e(t){var n,r,a;return vl().w(function(e){for(;;)switch(e.n){case 0:return n=t.pid,r=t.cropData,a=Fo("crop-thumbnail"),e.n=1,a(n,r);case 1:return e.a(2,e.v)}},e)})),function(t){return e.apply(this,arguments)}),onSuccess:function(){t.invalidateQueries({queryKey:["images"]}),t.invalidateQueries({queryKey:["gallery"]})}})}(),P=Fl(),j=(0,$.useMemo)(function(){var e,t,n,r=null==E?void 0:E.display_type,a=r?null==E||null===(e=E.display_type_settings)||void 0===e?void 0:e[r]:void 0,o=null!==(t=rp(null==a?void 0:a.thumbnail_width))&&void 0!==t?t:rp(null==a?void 0:a.thumbwidth),l=null!==(n=rp(null==a?void 0:a.thumbnail_height))&&void 0!==n?n:rp(null==a?void 0:a.thumbheight);return o&&l&&0!==l?o/l:1.5},[E]),T=function(){var e=No(lp().m(function e(t){var n,a,o;return lp().w(function(e){for(;;)switch(e.p=e.n){case 0:return i(!0),e.p=1,e.n=2,S.mutateAsync({pid:r.pid,rotation:t});case 2:n=e.v,a=(null==n?void 0:n.updated_at)||Date.now(),u(a),x.setQueriesData({queryKey:["gallery",w,"images"]},function(e){return null!=e&&e.images?sp(sp({},e),{},{images:e.images.map(function(e){return e.pid===r.pid?sp(sp({},e),{},{reloadKey:a}):e})}):e}),E&&E.previewpic===r.pid&&(x.setQueryData(["gallery",E.gid],function(e){return e?sp(sp({},e),{},{previewpic_url:zc(e.previewpic_url,a)}):e}),N((0,pe.__)("Gallery thumbnail updated after image rotation!","nggallery"))),e.n=4;break;case 3:e.p=3,o=e.v,console.error("Error rotating image",o);case 4:return e.p=4,i(!1),e.f(4);case 5:return e.a(2)}},e,null,[[1,3,4,5]])}));return function(t){return e.apply(this,arguments)}}(),I=function(){var e=No(lp().m(function e(){var t,n,a;return lp().w(function(e){for(;;)switch(e.p=e.n){case 0:return i(!0),e.p=1,e.n=2,P.mutateAsync(r.pid);case 2:t=e.v,n=(null==t?void 0:t.updated_at)||Date.now(),u(n),x.setQueriesData({queryKey:["gallery",w,"images"]},function(e){return null!=e&&e.images?sp(sp({},e),{},{images:e.images.map(function(e){return e.pid===r.pid?sp(sp({},e),{},{reloadKey:n}):e})}):e}),E&&E.previewpic===r.pid&&(x.setQueryData(["gallery",E.gid],function(e){return e?sp(sp({},e),{},{previewpic_url:zc(e.previewpic_url,n)}):e}),N((0,pe.__)("Gallery thumbnail updated after image recovery!","nggallery"))),e.n=4;break;case 3:e.p=3,a=e.v,console.error("Error recovering image",a);case 4:return e.p=4,i(!1),e.f(4);case 5:return e.a(2)}},e,null,[[1,3,4,5]])}));return function(){return e.apply(this,arguments)}}(),A=(0,$.useCallback)(No(lp().m(function e(){var t,n,a,o,l,c,s,m,d,p,h,v,_;return lp().w(function(e){for(;;)switch(e.p=e.n){case 0:if(b&&f){e.n=1;break}return e.a(2);case 1:return i(!0),e.p=2,t=r.image_url||"",e.n=3,fetch(t);case 3:return n=e.v,e.n=4,n.blob();case 4:return a=e.v,(o=new Image).src=URL.createObjectURL(a),e.n=5,new Promise(function(e){o.onload=e});case 5:return l=o.naturalWidth/b.width,c=o.naturalHeight/b.height,s=f.x*l,m=f.y*c,d=f.width*l,p=f.height*c,e.n=6,O.mutateAsync({pid:r.pid,cropData:{x:s,y:m,w:d,h:p,rr:1}});case 6:h=e.v,v=(null==h?void 0:h.updated_at)||Date.now(),u(v),x.setQueriesData({queryKey:["gallery",w,"images"]},function(e){return null!=e&&e.images?sp(sp({},e),{},{images:e.images.map(function(e){return e.pid===r.pid?sp(sp({},e),{},{reloadKey:v}):e})}):e}),E&&E.previewpic===r.pid&&(x.setQueryData(["gallery",E.gid],function(e){return e?sp(sp({},e),{},{previewpic_url:zc(e.previewpic_url,v)}):e}),N((0,pe.__)("Gallery thumbnail updated after crop!","nggallery"))),N((0,pe.__)("Image cropped successfully!","nggallery")),g(!1),y(void 0),e.n=8;break;case 7:e.p=7,_=e.v,console.error("Error cropping thumbnail",_),k((0,pe.__)("Failed to crop thumbnail","nggallery"));case 8:return e.p=8,i(!1),e.f(8);case 9:return e.a(2)}},e,null,[[2,7,8,9]])})),[f,b,r,E,x,N,k]),D=(0,$.useCallback)(function(e,t){var n=j,r=120,a=Math.round(r/n);(e<r||t<a)&&(r=e,(a=Math.round(r/n))>t&&(a=t,r=Math.round(a*n)));var o=Math.round(.1*e),l=Math.round(.1*t);return o+r>e&&(o=e-r),l+a>t&&(l=t-a),o<0&&(o=0),l<0&&(l=0),{unit:"px",width:r,height:a,x:o,y:l}},[j]);(0,$.useEffect)(function(){d&&b&&y(D(b.naturalWidth,b.naturalHeight))},[d,b,D]);var L=ee().createElement("svg",{className:"w-5 h-5",viewBox:"0 0 18 18",fill:"none"},ee().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.00016 0.833496C5.4604 0.833496 5.8335 1.20659 5.8335 1.66683V4.16683H13.3335C13.9965 4.16683 14.6324 4.43022 15.1013 4.89906C15.5701 5.3679 15.8335 6.00379 15.8335 6.66683V14.1668H18.3335C18.7937 14.1668 19.1668 14.5399 19.1668 15.0002C19.1668 15.4604 18.7937 15.8335 18.3335 15.8335H15.8335V18.3335C15.8335 18.7937 15.4604 19.1668 15.0002 19.1668C14.5399 19.1668 14.1668 18.7937 14.1668 18.3335V15.8335H6.66683C6.00379 15.8335 5.3679 15.5701 4.89906 15.1013C4.43022 14.6324 4.16683 13.9965 4.16683 13.3335V5.8335H1.66683C1.20659 5.8335 0.833496 5.4604 0.833496 5.00016C0.833496 4.53993 1.20659 4.16683 1.66683 4.16683H4.16683V1.66683C4.16683 1.20659 4.53993 0.833496 5.00016 0.833496ZM5.8335 5.8335V13.3335C5.8335 13.5545 5.92129 13.7665 6.07757 13.9228C6.23385 14.079 6.44582 14.1668 6.66683 14.1668H14.1668V6.66683C14.1668 6.44582 14.079 6.23385 13.9228 6.07757C13.7665 5.92129 13.5545 5.8335 13.3335 5.8335H5.8335Z",fill:"currentColor",fillOpacity:"0.6"})),F=ee().createElement("svg",{className:"w-5 h-5",viewBox:"0 0 18 18",fill:"none"},ee().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.00016 1.66683C5.31826 1.66683 2.3335 4.65159 2.3335 8.3335C2.3335 12.0154 5.31826 15.0002 9.00016 15.0002C12.6821 15.0002 15.6668 12.0154 15.6668 8.3335C15.6668 4.65159 12.6821 1.66683 9.00016 1.66683ZM1.00016 8.3335C1.00016 4.09937 4.76603 0.666504 9.00016 0.666504C13.2343 0.666504 17.0002 4.09937 17.0002 8.3335C17.0002 12.5676 13.2343 16.0005 9.00016 16.0005C4.76603 16.0005 1.00016 12.5676 1.00016 8.3335ZM9.00016 4.16683C9.4604 4.16683 9.8335 4.53993 9.8335 5.00016V8.3335L12.1668 10.6668C12.4933 10.9933 12.4933 11.5068 12.1668 11.8333C11.8404 12.1598 11.3268 12.1598 11.0003 11.8333L8.3335 9.1665V5.00016C8.3335 4.53993 8.70659 4.16683 9.00016 4.16683Z",fill:"currentColor",fillOpacity:"0.6"}));return ee().createElement(Eo,{isOpen:t,onClose:function(){n(),a&&setTimeout(function(){var e;_.setActiveModal(a.type,sp(sp({},a.props),s&&(null===(e=a.props)||void 0===e?void 0:e.image)&&{image:sp(sp({},a.props.image),{},{reloadKey:s})}))},100)},title:r.filename},ee().createElement("div",{className:"space-y-4"},ee().createElement("div",{className:"relative"},ee().createElement("div",{className:"flex justify-center items-center max-h-[50vh] max-w-full mx-auto transition-all duration-300"},d?ee().createElement(op(),{crop:f,onChange:function(e){return y(e)},onComplete:function(e){return y(e)},aspect:j},ee().createElement("img",{src:zc(r.image_url,s),alt:r.alttext,className:"!max-w-full !max-h-[50vh] !shadow-lg !mx-auto ".concat(l?"!opacity-50":""),style:{display:"block",margin:"0 auto"},ref:v})):ee().createElement("img",{src:zc(r.image_url,s),alt:r.alttext,className:"max-w-full max-h-[50vh] shadow-lg mx-auto ".concat(l?"opacity-50":""),style:{display:"block",margin:"0 auto"},ref:v}),l&&ee().createElement("div",{className:"absolute inset-0 flex items-center justify-center"},ee().createElement(kn,{className:"animate-spin h-8 w-8 text-green-500"})))),ee().createElement("div",{className:"flex justify-center space-x-4"},ee().createElement(ic,{text:(0,pe.__)("Rotate 90 degrees clockwise","nggallery")},ee().createElement("button",{onClick:function(){return T("cw")},disabled:l||d,className:"px-4 py-2 bg-gray-400 text-white rounded hover:bg-gray-500 flex items-center space-x-2 ".concat(l||d?"opacity-50 cursor-not-allowed":"")},ee().createElement("svg",{className:"w-5 h-5",viewBox:"0 0 18 18",fill:"none"},ee().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.99984 2.33317C7.6813 2.33317 6.39237 2.72416 5.29604 3.45671C4.19971 4.18925 3.34523 5.23044 2.84064 6.44861C2.33606 7.66679 2.20404 9.00723 2.46127 10.3004C2.71851 11.5936 3.35345 12.7815 4.2858 13.7139C5.21815 14.6462 6.40603 15.2812 7.69924 15.5384C8.99245 15.7956 10.3329 15.6636 11.5511 15.159C12.7692 14.6545 13.8104 13.8 14.543 12.7036C15.2755 11.6073 15.6665 10.3184 15.6665 8.99984C15.6665 8.5396 16.0396 8.1665 16.4998 8.1665C16.9601 8.1665 17.3332 8.5396 17.3332 8.99984C17.3332 10.648 16.8444 12.2592 15.9288 13.6296C15.0131 15 13.7116 16.0681 12.1889 16.6988C10.6662 17.3296 8.9906 17.4946 7.37409 17.173C5.75758 16.8515 4.27272 16.0578 3.10728 14.8924C1.94185 13.727 1.14817 12.2421 0.82663 10.6256C0.505087 9.00908 0.670115 7.33353 1.30084 5.81081C1.93158 4.28809 2.99968 2.9866 4.37009 2.07092C5.7405 1.15525 7.35166 0.666504 8.99984 0.666504C11.3213 0.666504 13.535 1.58751 15.194 3.18241L15.2058 3.19391L15.6665 3.65466V1.49984C15.6665 1.0396 16.0396 0.666504 16.4998 0.666504C16.9601 0.666504 17.3332 1.0396 17.3332 1.49984V5.6665C17.3332 6.12674 16.9601 6.49984 16.4998 6.49984H12.3332C11.8729 6.49984 11.4998 6.12674 11.4998 5.6665C11.4998 5.20627 11.8729 4.83317 12.3332 4.83317H14.488L14.0332 4.3784C12.6763 3.07672 10.8757 2.33317 8.99984 2.33317Z",fill:"currentColor",fillOpacity:"0.6"})))),ee().createElement(ic,{text:(0,pe.__)("Rotate 90 degrees counter-clockwise","nggallery")},ee().createElement("button",{onClick:function(){return T("ccw")},disabled:l||d,className:"px-4 py-2 bg-gray-400 text-white rounded hover:bg-gray-500 flex items-center space-x-2 ".concat(l||d?"opacity-50 cursor-not-allowed":"")},ee().createElement("svg",{className:"w-5 h-5",viewBox:"0 0 18 18",fill:"none"},ee().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.9967 0.666516L8.99984 0.666504C10.648 0.66651 12.2592 1.15525 13.6296 2.07093C15 2.98661 16.0681 4.2881 16.6988 5.81081C17.3296 7.33353 17.4946 9.00909 17.173 10.6256C16.8515 12.2421 16.0578 13.727 14.8924 14.8924C13.727 16.0578 12.2421 16.8515 10.6256 17.1731C9.00908 17.4946 7.33353 17.3296 5.81081 16.6988C4.28809 16.0681 2.9866 15 2.07092 13.6296C1.15525 12.2592 0.666504 10.648 0.666504 8.99984C0.666504 8.53961 1.0396 8.16651 1.49984 8.16651C1.96007 8.16651 2.33317 8.53961 2.33317 8.99984C2.33317 10.3184 2.72416 11.6073 3.45671 12.7036C4.18925 13.8 5.23044 14.6545 6.44861 15.159C7.66679 15.6636 9.00723 15.7956 10.3004 15.5384C11.5936 15.2812 12.7815 14.6462 13.7139 13.7139C14.6462 12.7815 15.2812 11.5937 15.5384 10.3004C15.7956 9.00724 15.6636 7.66679 15.159 6.44862C14.6545 5.23045 13.8 4.18926 12.7036 3.45671C11.6077 2.72446 10.3194 2.33348 9.0014 2.33318C7.12259 2.34065 5.31925 3.07305 3.96731 4.37755L3.51168 4.83318H5.6665C6.12674 4.83318 6.49984 5.20627 6.49984 5.66651C6.49984 6.12675 6.12674 6.49984 5.6665 6.49984H1.49984C1.0396 6.49984 0.666504 6.12675 0.666504 5.66651V1.49984C0.666504 1.03961 1.0396 0.66651 1.49984 0.66651C1.96007 0.66651 2.33317 1.03961 2.33317 1.49984V3.65466L2.79392 3.19392L2.80397 3.18404C4.46605 1.57726 6.68495 0.675212 8.9967 0.666516Z",fill:"currentColor",fillOpacity:"0.6"})))),d?ee().createElement(ic,{text:(0,pe.__)("Apply current crop","nggallery")},ee().createElement("button",{onClick:A,disabled:l,className:"px-4 py-2 bg-green-500 text-white rounded hover:bg-green-600 flex items-center space-x-2 ".concat(l?"opacity-50 cursor-not-allowed":"")},L)):ee().createElement(ic,{text:(0,pe.__)("Select crop area for the thumbnail","nggallery")},ee().createElement("button",{onClick:function(){g(!0)},disabled:l,className:"px-4 py-2 bg-gray-400 text-white rounded hover:bg-gray-500 flex items-center space-x-2 ".concat(l?"opacity-50 cursor-not-allowed":"")},L)),ee().createElement(ic,{text:(0,pe.__)("Restore from backup","nggallery")},ee().createElement("button",{onClick:I,disabled:l||d,className:"px-4 py-2 bg-gray-400 text-white rounded hover:bg-gray-500 flex items-center space-x-2 ".concat(l||d?"opacity-50 cursor-not-allowed":"")},F)))))},galleryImageView:function(e){var t=e.isOpen,n=e.onClose,r=e.image,a=e.galleryId,o=vo((0,$.useState)(0),2),l=o[0],i=o[1],c=Pl(a&&a>0?a:0).data,s=(null==c?void 0:c.images)||[];(0,$.useEffect)(function(){if(s.length>0&&t){var e=s.findIndex(function(e){return e.pid===r.pid});e>=0&&i(e)}},[s.length,r.pid,t]);var u=s[l],m=(0,$.useCallback)(function(){l>0&&i(l-1)},[l]),d=(0,$.useCallback)(function(){l<s.length-1&&i(l+1)},[l,s.length]);if((0,$.useEffect)(function(){var e=function(e){t&&("Escape"===e.key?(e.preventDefault(),n()):"ArrowLeft"===e.key?(e.preventDefault(),m()):"ArrowRight"===e.key&&(e.preventDefault(),d()))};return window.addEventListener("keydown",e),function(){return window.removeEventListener("keydown",e)}},[t,m,d,n]),(0,$.useEffect)(function(){return document.body.style.overflow=t?"hidden":"unset",function(){document.body.style.overflow="unset"}},[t]),!t||!u||!a||a<=0)return null;var g=l>0,p=l<s.length-1;return ee().createElement("div",{className:"fixed inset-0 z-[9999] bg-black bg-opacity-95 flex items-center justify-center",onClick:n},ee().createElement("button",{onClick:n,className:"absolute top-3 sm:top-[39px] right-3 sm:right-4 z-50 text-white hover:text-gray-300 transition-colors",title:(0,pe.__)("Close (ESC)","nggallery")},ee().createElement("svg",{className:"w-6 h-6 sm:w-8 sm:h-8",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},ee().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"}))),ee().createElement("div",{className:"absolute top-3 sm:top-[39px] left-3 sm:left-4 z-50 text-white"},ee().createElement("h2",{className:"text-sm sm:text-lg font-medium text-gray-300"},u.filename," (",l+1," of ",s.length,")")),ee().createElement("div",{className:"relative w-full h-full flex items-center justify-between p-2 sm:p-4 ml-0",onClick:function(e){return e.stopPropagation()}},ee().createElement("div",{className:"flex items-center justify-center w-8 sm:w-16 h-full"},g&&ee().createElement("button",{onClick:m,className:"bg-black bg-opacity-60 hover:bg-opacity-80 text-white rounded-full p-2 sm:p-3 transition-all",title:(0,pe.__)("Previous image (←)","nggallery")},ee().createElement("svg",{className:"w-5 h-5 sm:w-8 sm:h-8",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},ee().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})))),ee().createElement("div",{className:"flex-1 flex items-center justify-center max-w-full max-h-full mx-2 sm:mx-4"},ee().createElement("div",{className:"relative"},ee().createElement("img",{src:zc(u.image_url,u.reloadKey),alt:u.alttext||u.filename,className:"max-w-full max-h-full object-contain ".concat(u.exclude?"opacity-50 grayscale":""),style:{maxHeight:"85vh",maxWidth:"100%"}}),u.exclude&&ee().createElement("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none"},ee().createElement("div",{className:"bg-gray-600 text-white text-sm px-3 py-2 rounded font-medium shadow-lg"},(0,pe.__)("Hidden","nggallery"))))),ee().createElement("div",{className:"flex items-center justify-center w-8 sm:w-16 h-full"},p&&ee().createElement("button",{onClick:d,className:"bg-black bg-opacity-60 hover:bg-opacity-80 text-white rounded-full p-2 sm:p-3 transition-all",title:(0,pe.__)("Next image (→)","nggallery")},ee().createElement("svg",{className:"w-5 h-5 sm:w-8 sm:h-8",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},ee().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"}))))),ee().createElement("div",{className:"absolute bottom-0 left-1/2 transform -translate-x-1/2 bg-black bg-opacity-80 text-white p-2 sm:p-4 rounded-t-lg w-full sm:w-auto max-w-4xl"},ee().createElement("div",{className:"px-2 sm:px-4"},ee().createElement("div",{className:"text-center mb-2 sm:mb-3"},ee().createElement("h2",{className:"text-sm sm:text-lg font-medium text-gray-300"},u.filename," (",l+1," of ",s.length,")")),ee().createElement("div",{className:"text-center mb-2 sm:mb-4"},u.alttext&&ee().createElement("p",{className:"text-sm sm:text-lg font-medium mb-1 sm:mb-2"},u.alttext),u.description&&ee().createElement("p",{className:"text-xs sm:text-sm text-gray-300"},u.description)),s.length>1&&ee().createElement("div",{className:"flex justify-center space-x-1 sm:space-x-2 mb-2"},s.map(function(e,t){return ee().createElement("button",{key:t,onClick:function(){return i(t)},className:"w-2 h-2 sm:w-3 sm:h-3 rounded-full transition-colors ".concat(t===l?"bg-white":"bg-gray-500 hover:bg-gray-300"),title:"".concat((0,pe.__)("Go to image","nggallery")," ").concat(t+1)})})),ee().createElement("div",{className:"text-center text-xs text-gray-400"},(0,pe.__)("Use ← → arrow keys to navigate • ESC to close","nggallery")))))},bulkResize:function(e){var t=e.isOpen,n=e.onClose,r=e.imageIds,a=e.galleryId,o=e.onConfirm,l=void 0===o?function(){}:o,i=vo((0,$.useState)(""),2),c=i[0],s=i[1],u=vo((0,$.useState)(""),2),m=u[0],d=u[1],g=re(),p=function(){var e,t=re();return gl({mutationFn:(e=No(vl().m(function e(t){var n,r,a,o,l;return vl().w(function(e){for(;;)switch(e.n){case 0:return n=t.imageIds,r=t.width,a=t.height,o=Mo("bulk-resize"),l={image_ids:n},r&&(l.width=r),a&&(l.height=a),e.n=1,o(l);case 1:return e.a(2,e.v)}},e)})),function(t){return e.apply(this,arguments)}),onSuccess:function(){t.invalidateQueries({queryKey:["images"]}),t.invalidateQueries({queryKey:["gallery"]})}})}(),f=$o(),y=f.showSuccess,h=f.showError,b=f.showWarning,v=function(){var e=No(Fi().m(function e(){var t,o,i,s,u;return Fi().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,t=c?parseInt(c,10):void 0,o=m?parseInt(m,10):void 0,e.n=1,p.mutateAsync({imageIds:r,width:t,height:o});case 1:i=e.v,s=Date.now(),a&&g.setQueriesData({queryKey:["gallery",a,"images"]},function(e){return null!=e&&e.images?Gi(Gi({},e),{},{images:e.images.map(function(e){return r.includes(e.pid)?Gi(Gi({},e),{},{reloadKey:s}):e})}):e}),i.success_count>0&&y("Successfully resized ".concat(i.success_count," of ").concat(i.processed," images")),i.failure_count>0&&b("Failed to resize ".concat(i.failure_count," images")),l(),n(),e.n=3;break;case 2:e.p=2,u=e.v,console.error("Error bulk resizing images:",u),h("Failed to resize selected images");case 3:return e.a(2)}},e,null,[[0,2]])}));return function(){return e.apply(this,arguments)}}();return ee().createElement(Eo,{isOpen:t,onClose:n,title:(0,pe.__)("Bulk Resize Images","nggallery")},ee().createElement("div",{className:"space-y-4"},ee().createElement("p",{className:"text-gray-600"},(0,pe.__)("Resize","nggallery")," ",r.length," ",(0,pe.__)("selected images. Leave fields empty to use global settings.","nggallery")),ee().createElement("div",{className:"space-y-4"},ee().createElement("div",null,ee().createElement("label",{className:"block text-sm font-medium text-gray-700 mb-1"},(0,pe.__)("Width (pixels)","nggallery")),ee().createElement("input",{type:"number",min:"1",placeholder:(0,pe.__)("Leave empty for global setting","nggallery"),value:c,onChange:function(e){return s(e.target.value)},className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-green-500",disabled:p.isPending})),ee().createElement("div",null,ee().createElement("label",{className:"block text-sm font-medium text-gray-700 mb-1"},(0,pe.__)("Height (pixels)","nggallery")),ee().createElement("input",{type:"number",min:"1",placeholder:(0,pe.__)("Leave empty for global setting","nggallery"),value:m,onChange:function(e){return d(e.target.value)},className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-green-500",disabled:p.isPending}))),ee().createElement("div",{className:"flex justify-end space-x-3 pt-4"},ee().createElement("button",{onClick:n,disabled:p.isPending,className:"px-4 py-2 text-gray-600 border border-gray-300 rounded hover:bg-gray-50 disabled:opacity-50"},(0,pe.__)("Cancel","nggallery")),ee().createElement("button",{onClick:v,disabled:p.isPending,className:"px-4 py-2 bg-green-500 text-white rounded hover:bg-green-600 disabled:opacity-50 flex items-center space-x-2"},p.isPending&&ee().createElement(kn,{className:"animate-spin h-4 w-4 text-white"}),ee().createElement("span",null,p.isPending?(0,pe.__)("Resizing...","nggallery"):(0,pe.__)("Resize Images","nggallery"))))))},bulkGenerateThumbnails:function(e){var t=e.isOpen,n=e.onClose,r=e.imageIds,a=e.galleryId,o=e.onConfirm,l=void 0===o?function(){}:o,i=vo((0,$.useState)("240x160"),2),c=i[0],s=i[1],u=vo((0,$.useState)("240"),2),m=u[0],d=u[1],g=vo((0,$.useState)("160"),2),p=g[0],f=g[1],y=vo((0,$.useState)(!1),2),h=y[0],b=y[1],v=vo((0,$.useState)(!1),2),_=v[0],w=v[1],x=vo((0,$.useState)(!1),2),E=x[0],C=x[1],N=vo((0,$.useState)(function(){var e=localStorage.getItem("ngg_custom_thumbnail_sizes");return e?JSON.parse(e):[]}),2),k=N[0],S=N[1],O=re(),P=pi(),j=gi(),T=j.data,I=j.isLoading,A=$o(),D=A.showSuccess,L=A.showError,F=A.showWarning,M=function(){var e,t=re();return gl({mutationFn:(e=No(vl().m(function e(t){var n,r,a,o,l,i;return vl().w(function(e){for(;;)switch(e.n){case 0:return n=t.pid,r=t.width,a=t.height,o=t.setFixDimension,l=void 0!==o&&o,i=Fo("create-thumbnail"),e.n=1,i(n,{width:r,height:a,fix_dimension:l});case 1:return e.a(2,e.v)}},e)})),function(t){return e.apply(this,arguments)}),onSuccess:function(){t.invalidateQueries({queryKey:["images"]}),t.invalidateQueries({queryKey:["gallery"]})}})}();(0,$.useEffect)(function(){if(T&&t&&!E){var e=T.thumbwidth||240,n=T.thumbheight||160,r=T.thumbfix||!1;d(e.toString()),f(n.toString()),b(r);var a="".concat(e,"x").concat(n);if("240x160"===a||k.includes(a))s(a);else{if(!k.includes(a)&&"240x160"!==a){var o=[].concat(ko(k),[a]);S(o),localStorage.setItem("ngg_custom_thumbnail_sizes",JSON.stringify(o))}s(a)}C(!0)}},[T,t,E,k]),(0,$.useEffect)(function(){t||C(!1)},[t]);var R=function(e,t){var n="".concat(e,"x").concat(t);if("240x160"!==n&&!k.includes(n)){var r=[].concat(ko(k),[n]);S(r),localStorage.setItem("ngg_custom_thumbnail_sizes",JSON.stringify(r))}},G=function(){var e=No(hi().m(function e(){var t,o,i,s,u,d,g,f,y,b,v,_,x,E,C,N;return hi().w(function(e){for(;;)switch(e.p=e.n){case 0:return w(!0),e.p=1,"custom"===c?(t=m?parseInt(m,10):240,o=p?parseInt(p,10):160):(i=c.split("x"),s=vo(i,2),u=s[0],d=s[1],t=parseInt(u,10),o=parseInt(d,10)),"custom"===c&&R(t,o),e.p=2,e.n=3,P.mutateAsync({thumbwidth:t,thumbheight:o,thumbfix:h});case 3:e.n=5;break;case 4:e.p=4,x=e.v,console.error("Error saving thumbnail settings:",x);case 5:g=0,f=0,y=wi(r),e.p=6,y.s();case 7:if((b=y.n()).done){e.n=12;break}return v=b.value,e.p=8,e.n=9,M.mutateAsync({pid:v,width:t,height:o,setFixDimension:h});case 9:g++,e.n=11;break;case 10:e.p=10,E=e.v,console.error("Error generating thumbnail for image ".concat(v,":"),E),f++;case 11:e.n=7;break;case 12:e.n=14;break;case 13:e.p=13,C=e.v,y.e(C);case 14:return e.p=14,y.f(),e.f(14);case 15:_=Date.now(),a&&O.setQueriesData({queryKey:["gallery",a,"images"]},function(e){return null!=e&&e.images?_i(_i({},e),{},{images:e.images.map(function(e){return r.includes(e.pid)?_i(_i({},e),{},{reloadKey:_}):e})}):e}),g>0&&D("Successfully generated thumbnails for ".concat(g," of ").concat(r.length," images")),f>0&&F("Failed to generate thumbnails for ".concat(f," images")),l(),n(),e.n=17;break;case 16:e.p=16,N=e.v,console.error("Error bulk generating thumbnails:",N),L("Failed to generate thumbnails for selected images");case 17:return e.p=17,w(!1),e.f(17);case 18:return e.a(2)}},e,null,[[8,10],[6,13,14,15],[2,4],[1,16,17,18]])}));return function(){return e.apply(this,arguments)}}();return ee().createElement(Eo,{isOpen:t,onClose:n,title:(0,pe.__)("Create new thumbnails","nggallery")},ee().createElement("div",{className:"space-y-4"},ee().createElement("p",{className:"text-gray-600"},(0,pe.__)("Generate custom thumbnails for","nggallery")," ",r.length," ",(0,pe.__)("selected images.","nggallery")),I&&ee().createElement("div",{className:"flex items-center justify-center py-4"},ee().createElement(kn,{className:"animate-spin h-5 w-5 text-gray-500"}),ee().createElement("span",{className:"ml-2 text-gray-500"},(0,pe.__)("Loading current settings...","nggallery"))),!I&&ee().createElement("div",{className:"space-y-4"},ee().createElement("div",null,ee().createElement("label",{className:"block text-sm font-medium text-gray-700 mb-1"},(0,pe.__)("Width x height (in pixel)","nggallery")),ee().createElement("select",{value:c,onChange:function(e){return function(e){if(s(e),"custom"!==e&&e.includes("x")){var t=vo(e.split("x"),2),n=t[0],r=t[1];d(n),f(r)}}(e.target.value)},className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-green-500",disabled:_},ee().createElement("option",{value:"240x160"},"240x160"),k.map(function(e){return ee().createElement("option",{key:e,value:e},e)}),ee().createElement("option",{value:"custom"},(0,pe.__)("Custom","nggallery"))),"custom"===c&&ee().createElement("div",{className:"mt-3"},ee().createElement("div",{className:"flex items-center space-x-2"},ee().createElement("input",{type:"number",min:"1",value:m,onChange:function(e){return d(e.target.value)},className:"w-24 px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-green-500",disabled:_}),ee().createElement("span",{className:"text-gray-500"},"x"),ee().createElement("input",{type:"number",min:"1",value:p,onChange:function(e){return f(e.target.value)},className:"w-24 px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-green-500",disabled:_})),ee().createElement("p",{className:"text-xs text-gray-500 mt-1"},(0,pe.__)("These are maximum values","nggallery")))),ee().createElement("div",null,ee().createElement("div",{className:"flex items-center space-x-2"},ee().createElement("input",{type:"checkbox",id:"setFixDimension",checked:h,onChange:function(e){return b(e.target.checked)},className:"rounded border-gray-300 text-green-600 focus:ring-green-500",disabled:_}),ee().createElement("label",{htmlFor:"setFixDimension",className:"text-sm text-gray-700"},(0,pe.__)("Set fix dimension","nggallery"))),ee().createElement("p",{className:"text-xs text-gray-500 ml-5 mt-1"},(0,pe.__)("Ignore the aspect ratio, no portrait thumbnails","nggallery")))),ee().createElement("div",{className:"flex justify-end space-x-3 pt-4"},ee().createElement("button",{onClick:n,disabled:_||I,className:"px-4 py-2 text-gray-600 border border-gray-300 rounded hover:bg-gray-50 disabled:opacity-50"},(0,pe.__)("Cancel","nggallery")),ee().createElement("button",{onClick:G,disabled:_||I,className:"px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 disabled:opacity-50 flex items-center space-x-2"},_&&ee().createElement(kn,{className:"animate-spin h-4 w-4 text-white"}),ee().createElement("span",null,_?(0,pe.__)("Generating...","nggallery"):(0,pe.__)("OK","nggallery"))))))},bulkOperationConfirmation:function(e){var t,n,r=e.isOpen,a=e.onClose,o=e.galleries,l=e.operationType,i=e.onConfirm,c=e.title,s=e.description,u=e.warningText,m=e.confirmLabel,d=void 0===m?(0,pe.__)("OK","nggallery"):m,g=e.processingLabel,p=void 0===g?(0,pe.__)("Processing...","nggallery"):g,f=vo((0,$.useState)(!1),2),y=f[0],h=f[1],b=vo((0,$.useState)(null),2),v=b[0],_=b[1],w=function(){var e=No(Ii().m(function e(){var t;return Ii().w(function(e){for(;;)switch(e.p=e.n){case 0:return h(!0),_({current:0,total:0}),e.p=1,e.n=2,i(function(e,t){_({current:e,total:t})});case 2:a(),e.n=4;break;case 3:e.p=3,t=e.v,console.error("Operation failed:",t);case 4:return e.p=4,h(!1),_(null),e.f(4);case 5:return e.a(2)}},e,null,[[1,3,4,5]])}));return function(){return e.apply(this,arguments)}}(),x=c||function(){switch(l){case"watermark":return(0,pe.__)("Set Watermark","nggallery");case"metadata":return(0,pe.__)("Import Metadata","nggallery");case"recovery":return(0,pe.__)("Recover from Backup","nggallery");default:return(0,pe.__)("Confirm Operation","nggallery")}}(),E=s||function(){var e=o.length,t=1===e?(0,pe.__)("gallery","nggallery"):(0,pe.__)("galleries","nggallery");switch(l){case"watermark":return(0,pe.__)("Apply watermark to all images in ".concat(e," ").concat(t,"?"),"nggallery");case"metadata":return(0,pe.__)("Import metadata for all images in ".concat(e," ").concat(t,"?"),"nggallery");case"recovery":return(0,pe.__)("Recover all images from backup in ".concat(e," ").concat(t,"?"),"nggallery");default:return(0,pe.__)("Perform operation on ".concat(e," ").concat(t,"?"),"nggallery")}}(),C=u||("recovery"===l?(0,pe.__)("This will overwrite current images with their backup versions.","nggallery"):null);return ee().createElement(Eo,{isOpen:r,onClose:a,title:x},ee().createElement("div",{className:"space-y-4"},ee().createElement("p",{className:"text-sm text-gray-600 text-center"},E),(t=o.slice(0,5),n=o.length-5,ee().createElement("div",{className:"my-4"},ee().createElement("ul",{className:"list-none text-sm text-gray-700 px-4 text-center"},t.map(function(e){return ee().createElement("li",{key:e.id},e.galleryTitle)}),n>0&&ee().createElement("li",{className:"text-gray-500 italic"},(0,pe.__)("and ".concat(n," more..."),"nggallery"))))),C&&ee().createElement("p",{className:"text-sm text-yellow-600 text-center bg-yellow-50 p-3 rounded border border-yellow-200"},"⚠️ ",C),y&&v&&v.total>0&&ee().createElement("div",{className:"mt-4"},ee().createElement(ei,{current:v.current,total:v.total,label:(0,pe.__)("Processing images","nggallery"),showPercentage:!0})),ee().createElement("div",{className:"flex justify-center space-x-3 !mb-4 ".concat(y?"cursor-wait":"")},ee().createElement("button",{type:"button",onClick:a,disabled:y,className:"px-8 py-2 font-medium text-gray-700 bg-white border border-gray-300 rounded-lg shadow hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"},(0,pe.__)("Cancel","nggallery")),ee().createElement("button",{type:"button",onClick:w,disabled:y,className:"px-8 py-2 font-bold text-white bg-green-600 border border-transparent rounded-lg shadow hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"},y?ee().createElement("span",{className:"flex items-center"},ee().createElement(kn,{className:"animate-spin -ml-1 mr-2 h-4 w-4 text-white"}),p):d))))},bulkCreateThumbnailsGalleries:function(e){var t=e.isOpen,n=e.onClose,r=e.galleryIds,a=e.onConfirm,o=void 0===a?function(){}:a,l=vo((0,$.useState)("240x160"),2),i=l[0],c=l[1],s=vo((0,$.useState)("240"),2),u=s[0],m=s[1],d=vo((0,$.useState)("160"),2),g=d[0],p=d[1],f=vo((0,$.useState)(!1),2),y=f[0],h=f[1],b=vo((0,$.useState)(!1),2),v=b[0],_=b[1],w=vo((0,$.useState)(!1),2),x=w[0],E=w[1],C=vo((0,$.useState)(0),2),N=C[0],k=C[1],S=vo((0,$.useState)(0),2),O=S[0],P=S[1],j=vo((0,$.useState)(function(){var e=localStorage.getItem("ngg_custom_thumbnail_sizes");return e?JSON.parse(e):[]}),2),T=j[0],I=j[1],A=pi(),D=function(){var e,t=re(),n=Fo("create-thumbnail");return gl({mutationFn:(e=No(vl().m(function e(t){var r,a,o,l,i,c,s,u,m,d,g;return vl().w(function(e){for(;;)switch(e.p=e.n){case 0:return r=t.galleryIds,a=t.width,o=t.height,l=t.fixDimension,i=t.onProgress,e.n=1,Dl(r);case 1:c=e.v,s=c.length,u=0,m=0,d=0;case 2:if(!(d<c.length)){e.n=8;break}return e.p=3,e.n=4,n(c[d],{width:a,height:o,fix_dimension:l});case 4:u++,e.n=6;break;case 5:e.p=5,g=e.v,console.error("Failed to generate thumbnail for image ".concat(c[d],":"),g),m++;case 6:i&&i(d+1,s);case 7:d++,e.n=2;break;case 8:return e.a(2,{successCount:u,failureCount:m,total:s})}},e,null,[[3,5]])})),function(t){return e.apply(this,arguments)}),onSuccess:function(){t.invalidateQueries({queryKey:["gallery"]})}})}(),L=gi(),F=L.data,M=L.isLoading,R=$o(),G=R.showSuccess,B=R.showError,z=R.showWarning;(0,$.useEffect)(function(){if(F&&t&&!x){var e=F.thumbwidth||240,n=F.thumbheight||160,r=F.thumbfix||!1;m(e.toString()),p(n.toString()),h(r);var a="".concat(e,"x").concat(n);if("240x160"===a||T.includes(a))c(a);else{if(!T.includes(a)&&"240x160"!==a){var o=[].concat(ko(T),[a]);I(o),localStorage.setItem("ngg_custom_thumbnail_sizes",JSON.stringify(o))}c(a)}E(!0)}},[F,t,x,T]),(0,$.useEffect)(function(){t||E(!1)},[t]);var U=function(e,t){var n="".concat(e,"x").concat(t);if("240x160"!==n&&!T.includes(n)){var r=[].concat(ko(T),[n]);I(r),localStorage.setItem("ngg_custom_thumbnail_sizes",JSON.stringify(r))}},q=function(){var e=No(fi().m(function e(){var t,a,l,c,s,m,d,p,f;return fi().w(function(e){for(;;)switch(e.p=e.n){case 0:return _(!0),k(0),P(0),e.p=1,"custom"===i?(t=u?parseInt(u,10):240,a=g?parseInt(g,10):160):(l=i.split("x"),c=vo(l,2),s=c[0],m=c[1],t=parseInt(s,10),a=parseInt(m,10)),"custom"===i&&U(t,a),e.p=2,e.n=3,A.mutateAsync({thumbwidth:t,thumbheight:a,thumbfix:y});case 3:e.n=5;break;case 4:e.p=4,p=e.v,console.error("Error saving thumbnail settings:",p);case 5:return e.n=6,D.mutateAsync({galleryIds:r,width:t,height:a,fixDimension:y,onProgress:function(e,t){k(e),P(t)}});case 6:(d=e.v).failureCount>0?z("".concat((0,pe.__)("Generated thumbnails for","nggallery")," ").concat(d.successCount," ").concat((0,pe.__)("of","nggallery")," ").concat(d.total," ").concat((0,pe.__)("images","nggallery"))):G("".concat((0,pe.__)("Successfully generated thumbnails for","nggallery")," ").concat(d.total," ").concat((0,pe.__)("images","nggallery"))),o(),n(),e.n=8;break;case 7:e.p=7,f=e.v,console.error("Error bulk generating thumbnails:",f),B((0,pe.__)("Failed to generate thumbnails for selected galleries","nggallery"));case 8:return e.p=8,_(!1),e.f(8);case 9:return e.a(2)}},e,null,[[2,4],[1,7,8,9]])}));return function(){return e.apply(this,arguments)}}();return ee().createElement(Eo,{isOpen:t,onClose:n,title:(0,pe.__)("Create new thumbnails","nggallery")},ee().createElement("div",{className:"space-y-4"},ee().createElement("p",{className:"text-gray-600"},(0,pe.__)("Generate custom thumbnails for","nggallery")," ",r.length," ",(0,pe.__)("selected galleries.","nggallery")),M&&ee().createElement("div",{className:"flex items-center justify-center py-4"},ee().createElement(kn,{className:"animate-spin h-5 w-5 text-gray-500"}),ee().createElement("span",{className:"ml-2 text-gray-500"},(0,pe.__)("Loading current settings...","nggallery"))),!M&&ee().createElement("div",{className:"space-y-4"},ee().createElement("div",null,ee().createElement("label",{className:"block text-sm font-medium text-gray-700 mb-1"},(0,pe.__)("Width x height (in pixel)","nggallery")),ee().createElement("select",{value:i,onChange:function(e){return function(e){if(c(e),"custom"!==e&&e.includes("x")){var t=vo(e.split("x"),2),n=t[0],r=t[1];m(n),p(r)}}(e.target.value)},className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-green-500",disabled:v},ee().createElement("option",{value:"240x160"},"240x160"),T.map(function(e){return ee().createElement("option",{key:e,value:e},e)}),ee().createElement("option",{value:"custom"},(0,pe.__)("Custom","nggallery"))),"custom"===i&&ee().createElement("div",{className:"mt-3"},ee().createElement("div",{className:"flex items-center space-x-2"},ee().createElement("input",{type:"number",min:"1",value:u,onChange:function(e){return m(e.target.value)},className:"w-24 px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-green-500",disabled:v}),ee().createElement("span",{className:"text-gray-500"},"x"),ee().createElement("input",{type:"number",min:"1",value:g,onChange:function(e){return p(e.target.value)},className:"w-24 px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-green-500",disabled:v})),ee().createElement("p",{className:"text-xs text-gray-500 mt-1"},(0,pe.__)("These are maximum values","nggallery")))),ee().createElement("div",null,ee().createElement("div",{className:"flex items-center space-x-2"},ee().createElement("input",{type:"checkbox",id:"setFixDimension",checked:y,onChange:function(e){return h(e.target.checked)},className:"rounded border-gray-300 text-green-600 focus:ring-green-500",disabled:v}),ee().createElement("label",{htmlFor:"setFixDimension",className:"text-sm text-gray-700"},(0,pe.__)("Set fix dimension","nggallery"))),ee().createElement("p",{className:"text-xs text-gray-500 ml-5 mt-1"},(0,pe.__)("Ignore the aspect ratio, no portrait thumbnails","nggallery")))),v&&O>0&&ee().createElement("div",{className:"mt-4"},ee().createElement(ei,{current:N,total:O,label:(0,pe.__)("Processing images","nggallery"),showPercentage:!0})),ee().createElement("div",{className:"flex justify-end space-x-3 pt-4"},ee().createElement("button",{onClick:n,disabled:v||M,className:"px-4 py-2 text-gray-600 border border-gray-300 rounded hover:bg-gray-50 disabled:opacity-50"},(0,pe.__)("Cancel","nggallery")),ee().createElement("button",{onClick:q,disabled:v||M,className:"px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 disabled:opacity-50 flex items-center space-x-2"},v&&ee().createElement(kn,{className:"animate-spin h-4 w-4 text-white"}),ee().createElement("span",null,v?(0,pe.__)("Generating...","nggallery"):(0,pe.__)("OK","nggallery"))))))},bulkResizeImagesGalleries:function(e){var t=e.isOpen,n=e.onClose,r=e.galleryIds,a=e.onConfirm,o=void 0===a?function(){}:a,l=vo((0,$.useState)("800"),2),i=l[0],c=l[1],s=vo((0,$.useState)("600"),2),u=s[0],m=s[1],d=vo((0,$.useState)(!1),2),g=d[0],p=d[1],f=vo((0,$.useState)(!1),2),y=f[0],h=f[1],b=vo((0,$.useState)(0),2),v=b[0],_=b[1],w=vo((0,$.useState)(0),2),x=w[0],E=w[1],C=pi(),N=function(){var e,t=re(),n=Fo("resize");return gl({mutationFn:(e=No(vl().m(function e(t){var r,a,o,l,i,c,s,u,m,d;return vl().w(function(e){for(;;)switch(e.p=e.n){case 0:return r=t.galleryIds,a=t.width,o=t.height,l=t.onProgress,e.n=1,Dl(r);case 1:i=e.v,c=i.length,s=0,u=0,m=0;case 2:if(!(m<i.length)){e.n=8;break}return e.p=3,e.n=4,n(i[m],{width:a,height:o});case 4:s++,e.n=6;break;case 5:e.p=5,d=e.v,console.error("Failed to resize image ".concat(i[m],":"),d),u++;case 6:l&&l(m+1,c);case 7:m++,e.n=2;break;case 8:return e.a(2,{successCount:s,failureCount:u,total:c})}},e,null,[[3,5]])})),function(t){return e.apply(this,arguments)}),onSuccess:function(){t.invalidateQueries({queryKey:["gallery"]})}})}(),k=gi(),S=k.data,O=k.isLoading,P=$o(),j=P.showSuccess,T=P.showError,I=P.showWarning;(0,$.useEffect)(function(){if(S&&t&&!y){var e=S.imgWidth||800,n=S.imgHeight||600;c(e.toString()),m(n.toString()),h(!0)}},[S,t,y]),(0,$.useEffect)(function(){t||h(!1)},[t]);var A=function(){var e=No(Di().m(function e(){var t,a,l,c,s;return Di().w(function(e){for(;;)switch(e.p=e.n){case 0:return p(!0),_(0),E(0),e.p=1,t=i?parseInt(i,10):800,a=u?parseInt(u,10):600,e.p=2,e.n=3,C.mutateAsync({imgWidth:t,imgHeight:a});case 3:e.n=5;break;case 4:e.p=4,c=e.v,console.error("Error saving resize settings:",c);case 5:return e.n=6,N.mutateAsync({galleryIds:r,width:t,height:a,onProgress:function(e,t){_(e),E(t)}});case 6:(l=e.v).failureCount>0?I("".concat((0,pe.__)("Resized","nggallery")," ").concat(l.successCount," ").concat((0,pe.__)("of","nggallery")," ").concat(l.total," ").concat((0,pe.__)("images","nggallery"))):j("".concat((0,pe.__)("Successfully resized","nggallery")," ").concat(l.total," ").concat((0,pe.__)("images","nggallery"))),o(),n(),e.n=8;break;case 7:e.p=7,s=e.v,console.error("Error bulk resizing images:",s),T((0,pe.__)("Failed to resize images for selected galleries","nggallery"));case 8:return e.p=8,p(!1),e.f(8);case 9:return e.a(2)}},e,null,[[2,4],[1,7,8,9]])}));return function(){return e.apply(this,arguments)}}();return ee().createElement(Eo,{isOpen:t,onClose:n,title:(0,pe.__)("Resize Images","nggallery")},ee().createElement("div",{className:"space-y-4"},ee().createElement("p",{className:"text-gray-600"},(0,pe.__)("Resize images in","nggallery")," ",r.length," ",(0,pe.__)("selected galleries.","nggallery")),O&&ee().createElement("div",{className:"flex items-center justify-center py-4"},ee().createElement(kn,{className:"animate-spin h-5 w-5 text-gray-500"}),ee().createElement("span",{className:"ml-2 text-gray-500"},(0,pe.__)("Loading current settings...","nggallery"))),!O&&ee().createElement("div",{className:"space-y-4"},ee().createElement("div",null,ee().createElement("label",{className:"block text-sm font-medium text-gray-700 mb-1"},(0,pe.__)("Resize Images to","nggallery")),ee().createElement("div",{className:"flex items-center space-x-2"},ee().createElement("input",{type:"number",min:"1",value:i,onChange:function(e){return c(e.target.value)},className:"w-24 px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-green-500",disabled:g}),ee().createElement("span",{className:"text-gray-500"},"x"),ee().createElement("input",{type:"number",min:"1",value:u,onChange:function(e){return m(e.target.value)},className:"w-24 px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-green-500",disabled:g}),ee().createElement("span",{className:"text-gray-500 ml-2"},"px")),ee().createElement("p",{className:"text-xs text-gray-500 mt-1"},(0,pe.__)("Width x height. Leave height or width empty to keep ratio.","nggallery")))),g&&x>0&&ee().createElement("div",{className:"mt-4"},ee().createElement(ei,{current:v,total:x,label:(0,pe.__)("Processing images","nggallery"),showPercentage:!0})),ee().createElement("div",{className:"flex justify-end space-x-3 pt-4"},ee().createElement("button",{onClick:n,disabled:g||O,className:"px-4 py-2 text-gray-600 border border-gray-300 rounded hover:bg-gray-50 disabled:opacity-50"},(0,pe.__)("Cancel","nggallery")),ee().createElement("button",{onClick:A,disabled:g||O,className:"px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 disabled:opacity-50 flex items-center space-x-2"},g&&ee().createElement(kn,{className:"animate-spin h-4 w-4 text-white"}),ee().createElement("span",null,g?(0,pe.__)("Resizing...","nggallery"):(0,pe.__)("OK","nggallery"))))))},gallerySelect:function(e){var t=e.isOpen,n=e.onClose,r=e.imageIds,a=e.operation,o=void 0===a?"copy":a,l=e.onConfirm,i=e.excludeGalleryId,c=vo((0,$.useState)(null),2),s=c[0],u=c[1],m=Sl({get_all:!0}),d=m.data,g=m.isLoading,p=$o(),f=p.showSuccess,y=p.showError,h=p.showWarning,b=function(){var e,t=re();return gl({mutationFn:(e=No(vl().m(function e(t){var n,r,a;return vl().w(function(e){for(;;)switch(e.n){case 0:return n=t.imageIds,r=t.destinationGalleryId,a=Mo("bulk-copy"),e.n=1,a({image_ids:n,destination_gallery_id:r});case 1:return e.a(2,e.v)}},e)})),function(t){return e.apply(this,arguments)}),onSuccess:function(){t.invalidateQueries({queryKey:["images"]}),t.invalidateQueries({queryKey:["gallery"]})}})}(),v=function(){var e,t=re();return gl({mutationFn:(e=No(vl().m(function e(t){var n,r,a;return vl().w(function(e){for(;;)switch(e.n){case 0:return n=t.imageIds,r=t.destinationGalleryId,a=Mo("bulk-move"),e.n=1,a({image_ids:n,destination_gallery_id:r});case 1:return e.a(2,e.v)}},e)})),function(t){return e.apply(this,arguments)}),onSuccess:function(){t.invalidateQueries({queryKey:["images"]}),t.invalidateQueries({queryKey:["gallery"]})}})}(),_=((null==d?void 0:d.galleries)||[]).filter(function(e){return!i||e.id!==i}),w=function(){var e=No(us().m(function e(){var t,a,i;return us().w(function(e){for(;;)switch(e.p=e.n){case 0:if(s){e.n=1;break}return e.a(2);case 1:return t="copy"===o?b:v,e.p=2,e.n=3,t.mutateAsync({imageIds:r,destinationGalleryId:s});case 3:(a=e.v).success_count>0&&f(a.message),a.failure_count>0&&h("Failed to ".concat(o," ").concat(a.failure_count," images")),l&&l(s),n(),e.n=5;break;case 4:e.p=4,i=e.v,console.error("Error ".concat(o,"ing images:"),i),y("Failed to ".concat(o," images"));case 5:return e.a(2)}},e,null,[[2,4]])}));return function(){return e.apply(this,arguments)}}(),x="copy"===o?(0,pe.__)("Copy","nggallery"):(0,pe.__)("Move","nggallery"),E="copy"===o?(0,pe.__)("copy","nggallery"):(0,pe.__)("move","nggallery");return ee().createElement(Eo,{isOpen:t,onClose:n,title:(0,pe.sprintf)((0,pe.__)("%s Images to Gallery","nggallery"),x)},ee().createElement("p",{className:"text-gray-600 mb-4"},(0,pe.sprintf)((0,pe.__)("Select the gallery where you want to %s the selected images.","nggallery"),E)),ee().createElement("div",{className:"mb-4"},ee().createElement("p",{className:"text-sm text-gray-500"},1===r.length?(0,pe.sprintf)((0,pe.__)("1 image will be %s","nggallery"),"copy"===o?(0,pe.__)("copied","nggallery"):(0,pe.__)("moved","nggallery")):(0,pe.sprintf)((0,pe.__)("%d images will be %s","nggallery"),r.length,"copy"===o?(0,pe.__)("copied","nggallery"):(0,pe.__)("moved","nggallery")))),g?ee().createElement("div",{className:"py-8"},ee().createElement(oo,{size:"md",text:(0,pe.__)("Loading galleries...","nggallery")})):0===_.length?ee().createElement("div",{className:"text-center py-8"},ee().createElement("p",{className:"text-gray-500"},(0,pe.__)("No galleries available","nggallery"))):ee().createElement("div",{className:"space-y-2 max-h-96 overflow-y-auto"},_.map(function(e){return ee().createElement("div",{key:e.id,className:"flex items-center p-3 border rounded-lg cursor-pointer transition-colors ".concat(s===e.id?"border-green-500 bg-green-50":"border-gray-200 hover:border-gray-300 hover:bg-gray-50"),onClick:function(){return u(e.id)}},ee().createElement("input",{type:"radio",name:"gallery",value:e.id,checked:s===e.id,onChange:function(){return u(e.id)},className:"mr-3"}),e.thumbnail?ee().createElement("img",{src:e.thumbnail,alt:e.galleryTitle,className:"w-12 h-12 object-cover rounded mr-3"}):ee().createElement("div",{className:"w-12 h-12 bg-gray-200 rounded mr-3 flex items-center justify-center"},ee().createElement("span",{className:"text-gray-500 text-xs"},(0,pe.__)("No image","nggallery"))),ee().createElement("div",{className:"flex-1"},ee().createElement("h3",{className:"font-medium"},e.galleryTitle),ee().createElement("p",{className:"text-sm text-gray-500"},e.count," ","1"===e.count?(0,pe.__)("image","nggallery"):(0,pe.__)("images","nggallery"))))})),ee().createElement("div",{className:"flex justify-end space-x-2 mt-6"},ee().createElement("button",{onClick:n,className:"px-4 py-2 border border-gray-300 rounded-md text-gray-700 hover:bg-gray-50",disabled:b.isPending||v.isPending},(0,pe.__)("Cancel","nggallery")),ee().createElement("button",{onClick:w,disabled:!s||b.isPending||v.isPending,className:"px-4 py-2 text-white rounded-md hover:bg-opacity-90 disabled:opacity-50 disabled:cursor-not-allowed flex items-center ".concat("move"===o?"bg-orange-600 hover:bg-orange-700":"bg-green-500 hover:bg-green-600")},(b.isPending||v.isPending)&&ee().createElement(kn,{className:"animate-spin -ml-1 mr-2 h-4 w-4 text-white"}),(0,pe.sprintf)((0,pe.__)("%s Images","nggallery"),x))))},tags:function(e){var t=e.isOpen,n=e.onClose,r=e.imageIds,a=e.onConfirm,o=vo((0,$.useState)(""),2),l=o[0],i=o[1],c=vo((0,$.useState)(new Set),2),s=c[0],u=c[1],m=vo((0,$.useState)("append"),2),d=m[0],g=m[1],p=vo((0,$.useState)([]),2),f=p[0],y=p[1],h=vo((0,$.useState)(!1),2),b=h[0],v=h[1],_=function(){var e,t=re(),n=$o(),r=n.showSuccess,a=n.showWarning,o=n.showError;return gl({mutationFn:(e=No(vc().m(function e(t){var n,r,a,o,l;return vc().w(function(e){for(;;)switch(e.n){case 0:return r=t.imageIds,a=t.tags,o=t.append,l=null===(n=window.imagelyApp)||void 0===n?void 0:n.nonce,e.n=1,Oo()({path:"/imagely/v1/images/bulk-add-tags",method:"POST",headers:{"X-WP-Nonce":l,"Content-Type":"application/json"},data:{image_ids:r,tags:a,append:o}});case 1:return e.a(2,e.v)}},e)})),function(t){return e.apply(this,arguments)}),onSuccess:function(e){t.invalidateQueries({queryKey:["gallery"]}),e.success_count>0&&r(e.message),e.failure_count>0&&a("Failed to add tags to ".concat(e.failure_count," images"))},onError:function(e){console.error("Error adding tags:",e),o("Failed to add tags to images")}})}(),w=function(){var e,t=re(),n=$o(),r=n.showSuccess,a=n.showWarning,o=n.showError;return gl({mutationFn:(e=No(vc().m(function e(t){var n,r,a;return vc().w(function(e){for(;;)switch(e.n){case 0:return r=t.imageIds,a=null===(n=window.imagelyApp)||void 0===n?void 0:n.nonce,e.n=1,Oo()({path:"/imagely/v1/images/bulk-remove-tags",method:"POST",headers:{"X-WP-Nonce":a,"Content-Type":"application/json"},data:{image_ids:r}});case 1:return e.a(2,e.v)}},e)})),function(t){return e.apply(this,arguments)}),onSuccess:function(e){t.invalidateQueries({queryKey:["gallery"]}),e.success_count>0&&r(e.message),e.failure_count>0&&a("Failed to remove tags from ".concat(e.failure_count," images"))},onError:function(e){console.error("Error removing tags:",e),o("Failed to remove tags from images")}})}(),x=$o().showWarning;(0,$.useEffect)(function(){t&&E()},[t]);var E=function(){var e=No(xp().m(function e(){var t,n,r,a;return xp().w(function(e){for(;;)switch(e.p=e.n){case 0:return v(!0),e.p=1,n=null===(t=window.imagelyApp)||void 0===t?void 0:t.nonce,e.n=2,Oo()({path:"/imagely/v1/tags",method:"GET",headers:{"X-WP-Nonce":n,"Content-Type":"application/json"}});case 2:r=e.v,y(r),e.n=4;break;case 3:e.p=3,a=e.v,console.error("Error fetching tags:",a);case 4:return e.p=4,v(!1),e.f(4);case 5:return e.a(2)}},e,null,[[1,3,4,5]])}));return function(){return e.apply(this,arguments)}}(),C=function(e){return e.split(",").map(function(e){return e.trim()}).filter(function(e){return e.length>0})},N=function(){var e=No(xp().m(function e(){var t,o,i,c,u;return xp().w(function(e){for(;;)switch(e.p=e.n){case 0:if("remove"!==d){e.n=5;break}return e.p=1,e.n=2,w.mutateAsync({imageIds:r});case 2:a&&a(),n(),e.n=4;break;case 3:e.p=3,c=e.v,console.error("Error removing tags:",c);case 4:return e.a(2);case 5:if(t=C(l),o=Array.from(s),0!==(i=[].concat(ko(t),o)).length){e.n=6;break}return x((0,pe.__)("Please select existing tags or enter new tags","nggallery")),e.a(2);case 6:return e.p=6,e.n=7,_.mutateAsync({imageIds:r,tags:i,append:"append"===d});case 7:a&&a(),n(),e.n=9;break;case 8:e.p=8,u=e.v,console.error("Error adding tags:",u);case 9:return e.a(2)}},e,null,[[6,8],[1,3]])}));return function(){return e.apply(this,arguments)}}();return ee().createElement(Eo,{isOpen:t,onClose:n,title:(0,pe.__)("Add Tags to Images","nggallery")},ee().createElement("div",{className:"mb-4"},ee().createElement("p",{className:"text-sm text-gray-500"},1===r.length?(0,pe.__)("1 image will be tagged","nggallery"):(0,pe.sprintf)((0,pe.__)("%d images will be tagged","nggallery"),r.length))),ee().createElement("div",{className:"mb-6"},ee().createElement("label",{className:"block text-sm font-medium text-gray-700 mb-3"},(0,pe.__)("Tag Mode","nggallery")),ee().createElement("div",{className:"space-y-2"},ee().createElement("label",{className:"flex items-center"},ee().createElement("input",{type:"radio",name:"tagMode",checked:"append"===d,onChange:function(){return g("append")},className:"mr-2"}),ee().createElement("span",null,(0,pe.__)("Add to existing tags","nggallery"))),ee().createElement("label",{className:"flex items-center"},ee().createElement("input",{type:"radio",name:"tagMode",checked:"replace"===d,onChange:function(){return g("replace")},className:"mr-2"}),ee().createElement("span",{className:"text-orange-600"},(0,pe.__)("Replace all existing tags","nggallery"))),ee().createElement("label",{className:"flex items-center"},ee().createElement("input",{type:"radio",name:"tagMode",checked:"remove"===d,onChange:function(){return g("remove")},className:"mr-2"}),ee().createElement("span",{className:"text-red-600"},(0,pe.__)("Remove all tags","nggallery"))))),"remove"!==d&&ee().createElement("div",{className:"mb-6"},ee().createElement("label",{htmlFor:"newTags",className:"block text-sm font-medium text-gray-700 mb-2"},(0,pe.__)("New Tags","nggallery")),ee().createElement("input",{id:"newTags",type:"text",value:l,onChange:function(e){return i(e.target.value)},placeholder:(0,pe.__)("Enter new tags separated by commas (e.g., nature, landscape, photography)","nggallery"),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-green-500"}),ee().createElement("p",{className:"text-xs text-gray-500 mt-1"},(0,pe.__)("Separate multiple tags with commas","nggallery"))),"remove"!==d&&ee().createElement("div",{className:"mb-6"},ee().createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},(0,pe.__)("Existing Tags","nggallery")),b?ee().createElement("div",{className:"py-4"},ee().createElement(oo,{size:"sm",text:(0,pe.__)("Loading tags...","nggallery"),centerInContainer:!1})):0===f.length?ee().createElement("p",{className:"text-gray-500 py-4"},(0,pe.__)("No existing tags found","nggallery")):ee().createElement("div",{className:"max-h-48 overflow-y-auto border border-gray-300 rounded-md p-3"},ee().createElement("div",{className:"space-y-2"},f.map(function(e){return ee().createElement("label",{key:e.term_id,className:"flex items-center cursor-pointer"},ee().createElement("input",{type:"checkbox",checked:s.has(e.name),onChange:function(){return t=e.name,(n=new Set(s)).has(t)?n.delete(t):n.add(t),void u(n);var t,n},className:"mr-2"}),ee().createElement("span",{className:"flex-1"},e.name),ee().createElement("span",{className:"text-xs text-gray-500 ml-2"},"(",e.count,")"))})))),"remove"===d&&ee().createElement("div",{className:"mb-6 p-4 bg-red-50 border border-red-200 rounded-md"},ee().createElement("div",{className:"flex"},ee().createElement(Yn,{className:"w-5 h-5 text-red-400 mr-2 mt-0.5"}),ee().createElement("div",null,ee().createElement("h3",{className:"text-sm font-medium text-red-800"},(0,pe.__)("Warning: This will remove all tags","nggallery")),ee().createElement("p",{className:"text-sm text-red-700 mt-1"},1===r.length?(0,pe.__)("All tags will be permanently removed from the selected image.","nggallery"):(0,pe.sprintf)((0,pe.__)("All tags will be permanently removed from all %d selected images.","nggallery"),r.length))))),ee().createElement("div",{className:"flex justify-end space-x-2"},ee().createElement("button",{onClick:n,className:"px-4 py-2 border border-gray-300 rounded-md text-gray-700 hover:bg-gray-50",disabled:_.isPending||w.isPending},(0,pe.__)("Cancel","nggallery")),ee().createElement("button",{onClick:N,disabled:_.isPending||w.isPending,className:"px-4 py-2 text-white rounded-md hover:bg-opacity-90 disabled:opacity-50 disabled:cursor-not-allowed flex items-center ".concat("remove"===d?"bg-red-600 hover:bg-red-700":"bg-green-500 hover:bg-green-600")},(_.isPending||w.isPending)&&ee().createElement(kn,{className:"animate-spin -ml-1 mr-2 h-4 w-4 text-white"}),"remove"===d?(0,pe.__)("Remove All Tags","nggallery"):(0,pe.__)("Add Tags","nggallery"))))},tagForm:function(e){var t=e.isOpen,r=e.onClose,a=e.tag,o=void 0===a?null:a,l=e.onSuccess,i=(0,ge.useDispatch)(Br),c=vo((0,$.useState)({name:"",slug:"",description:""}),2),s=c[0],u=c[1],m=vo((0,$.useState)(!1),2),d=m[0],g=m[1],p=vo((0,$.useState)({}),2),f=p[0],y=p[1],h=!!o;(0,$.useEffect)(function(){t&&(u(o?{name:o.name||"",slug:o.slug||"",description:o.description||""}:{name:"",slug:"",description:""}),y({}))},[t,o]);var b=function(e,t){var n,r=(null==e?void 0:e.message)||t;null!=e&&e.code&&(r+=" (".concat((0,pe.__)("Error Code","nggallery"),": ").concat(e.code,")")),null!=e&&null!==(n=e.data)&&void 0!==n&&n.details&&(r+=" - ".concat(e.data.details)),i.showNotice("error",r)},v=function(){var e={};return s.name.trim()||(e.name=(0,pe.__)("Tag name is required","nggallery")),y(e),0===Object.keys(e).length},_=function(e){var t=e.target,r=t.name,a=t.value;u(function(e){return wp(wp({},e),{},n({},r,a))}),f[r]&&y(function(e){return wp(wp({},e),{},n({},r,""))})},w=function(){var e=No(bp().m(function e(t){var n,a,c,u,m;return bp().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t.preventDefault(),v()){e.n=1;break}return e.a(2);case 1:if(g(!0),e.p=2,a=null===(n=window.imagelyApp)||void 0===n?void 0:n.nonce,c={name:s.name.trim(),description:s.description.trim()},s.slug.trim()&&(c.slug=s.slug.trim()),!h||!o){e.n=4;break}return e.n=3,Oo()({path:"/imagely/v1/tags/".concat(o.term_id),method:"PUT",headers:{"X-WP-Nonce":a,"Content-Type":"application/json"},data:c});case 3:i.showNotice("success",(0,pe.__)("Tag updated successfully","nggallery")),e.n=6;break;case 4:return e.n=5,Oo()({path:"/imagely/v1/tags",method:"POST",headers:{"X-WP-Nonce":a,"Content-Type":"application/json"},data:c});case 5:i.showNotice("success",(0,pe.__)("Tag created successfully","nggallery"));case 6:l&&l(),r(),e.n=13;break;case 7:if(e.p=7,m=e.v,console.error("Error saving tag:",m),!(m instanceof Response)){e.n=12;break}return e.p=8,e.n=9,m.json();case 9:u=e.v,b(u,(0,pe.__)("Failed to save tag","nggallery")),e.n=11;break;case 10:e.p=10,e.v,i.showNotice("error",(0,pe.__)("Failed to save tag","nggallery"));case 11:e.n=13;break;case 12:b(m,(0,pe.__)("Failed to save tag","nggallery"));case 13:return e.p=13,g(!1),e.f(13);case 14:return e.a(2)}},e,null,[[8,10],[2,7,13,14]])}));return function(t){return e.apply(this,arguments)}}();return ee().createElement(Eo,{isOpen:t,onClose:r,title:h?(0,pe.__)("Edit Tag","nggallery"):(0,pe.__)("Add New Tag","nggallery")},ee().createElement("form",{onSubmit:w,className:"space-y-4"},ee().createElement("div",null,ee().createElement("label",{htmlFor:"tag-name",className:"block text-sm font-medium text-gray-700 mb-1"},(0,pe.__)("Name","nggallery")," ",ee().createElement("span",{className:"text-red-500"},"*")),ee().createElement("input",{type:"text",id:"tag-name",name:"name",value:s.name,onChange:_,className:"w-full px-3 py-2 border rounded-md shadow-sm focus:outline-none focus:ring-2 ".concat(f.name?"border-red-300 focus:ring-red-500 focus:border-red-500":"border-gray-300 focus:ring-green-500 focus:border-green-500"),placeholder:(0,pe.__)("Enter tag name","nggallery"),disabled:d}),f.name&&ee().createElement("p",{className:"mt-1 text-sm text-red-600"},f.name)),ee().createElement("div",null,ee().createElement("label",{htmlFor:"tag-slug",className:"block text-sm font-medium text-gray-700 mb-1"},(0,pe.__)("Slug","nggallery")),ee().createElement("input",{type:"text",id:"tag-slug",name:"slug",value:s.slug,onChange:_,className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-green-500 focus:border-green-500",placeholder:(0,pe.__)("Leave empty to auto-generate from name","nggallery"),disabled:d}),ee().createElement("p",{className:"mt-1 text-sm text-gray-500"},(0,pe.__)("The slug is the URL-friendly version of the name. Leave empty to auto-generate.","nggallery"))),ee().createElement("div",null,ee().createElement("label",{htmlFor:"tag-description",className:"block text-sm font-medium text-gray-700 mb-1"},(0,pe.__)("Description","nggallery")),ee().createElement("textarea",{id:"tag-description",name:"description",value:s.description,onChange:_,rows:3,className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-green-500 focus:border-green-500",placeholder:(0,pe.__)("Optional description for this tag","nggallery"),disabled:d})),ee().createElement("div",{className:"flex justify-end space-x-3 pt-4"},ee().createElement("button",{type:"button",onClick:r,disabled:d,className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 disabled:opacity-50 disabled:cursor-not-allowed"},(0,pe.__)("Cancel","nggallery")),ee().createElement("button",{type:"submit",disabled:d,className:"px-4 py-2 text-sm font-medium text-white bg-green-500 border border-transparent rounded-md shadow-sm hover:bg-green-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 disabled:opacity-50 disabled:cursor-not-allowed"},d?ee().createElement("span",{className:"flex items-center"},ee().createElement(kn,{className:"animate-spin -ml-1 mr-2 h-4 w-4 text-white"}),(0,pe.__)("Saving...","nggallery")):h?(0,pe.__)("Update Tag","nggallery"):(0,pe.__)("Create Tag","nggallery")))))},editImage:function(e){var t=e.isOpen,r=e.onClose,a=e.image,o=(0,ge.useDispatch)(Br),l=kl(a.galleryid).data,i=Pi({enabled:"pro"===zr,per_page:-1}),c=i.data,s=i.isLoading,u=Pl(a.galleryid).data,m=(null==u?void 0:u.images)||[],d=(null==m?void 0:m.find(function(e){return e.pid===a.pid}))||a,g=wc(),p=$o(),f=p.showSuccess,y=p.showError,h=function(e){var t=e.pricelist_id;return 0===t?"0":-1===t?"-1":t&&t>0?t.toString():"0"},b=vo((0,$.useState)(function(){var e={alttext:"",description:"",tags:""};return"pro"===zr?Wc(Wc({},e),{},{pricelist_id:"0"}):e}),2),v=b[0],_=b[1],w=vo((0,$.useState)(!1),2),x=w[0],E=w[1],C=vo((0,$.useState)({}),2),N=C[0],k=C[1];(0,$.useEffect)(function(){if(t&&d){var e,n={alttext:d.alttext||"",description:d.description||"",tags:(null===(e=d.tags)||void 0===e?void 0:e.join(","))||""},r="pro"===zr?Wc(Wc({},n),{},{pricelist_id:h(d)}):n;_(r),k({})}},[t,d]);var S=function(){var e={};return v.alttext.trim()||(e.alttext=(0,pe.__)("Alt text is required for accessibility","nggallery")),k(e),0===Object.keys(e).length},O=function(){var e=No(Uc().m(function e(t){var n,o,l,i,c;return Uc().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t.preventDefault(),S()){e.n=1;break}return e.a(2);case 1:return E(!0),e.p=2,n=ko(new Set(v.tags.split(",").map(function(e){return e.trim()}).filter(function(e){return e.length>0}))).join(","),o={alttext:v.alttext,description:v.description,tags:n},l="pro"===zr&&"pricelist_id"in v?Wc(Wc({},o),{},{pricelist_id:parseInt(v.pricelist_id,10)}):o,e.n=3,g.mutateAsync({imageId:a.pid,data:l});case 3:f((0,pe.__)("Image updated successfully","nggallery")),setTimeout(function(){r()},100),e.n=5;break;case 4:e.p=4,c=e.v,i=c instanceof Error?c.message:(0,pe.__)("Failed to update image","nggallery"),y(i);case 5:return e.p=5,E(!1),e.f(5);case 6:return e.a(2)}},e,null,[[2,4,5,6]])}));return function(t){return e.apply(this,arguments)}}(),P=function(e){var t=e.target,r=t.name,a=t.value;_(function(e){return Wc(Wc({},e),{},n({},r,a))}),N[r]&&k(function(e){return Wc(Wc({},e),{},n({},r,""))})};return ee().createElement(Eo,{isOpen:t,onClose:r,title:(0,pe.__)("Edit Image","nggallery")},ee().createElement("form",{onSubmit:O,className:"space-y-4"},ee().createElement("div",{className:"flex justify-center mb-6"},ee().createElement("div",{className:"relative w-48 h-32 cursor-pointer hover:opacity-80 transition-opacity",onClick:function(e){e.stopPropagation(),e.preventDefault();var t={image:{filename:a.filename,alttext:a.alttext||"",galleryPath:(null==l?void 0:l.path)||"",pid:a.pid,galleryid:a.galleryid,image_url:a.image_url},returnTo:{type:"editImage",props:{image:a}}};o.setActiveModal("imageView",t)},title:(0,pe.__)("Click to edit image","nggallery")},ee().createElement("img",{src:zc(a.thumb_url,a.reloadKey),alt:a.alttext,className:"w-full h-full object-cover rounded-lg shadow-md"}),ee().createElement("div",{className:"absolute inset-0 flex items-center justify-center opacity-0 hover:opacity-100 transition-opacity bg-black bg-opacity-30 rounded-lg"},ee().createElement("svg",{className:"w-8 h-8 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},ee().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"}))))),ee().createElement("div",null,ee().createElement("label",{htmlFor:"alttext",className:"block text-sm font-medium text-gray-700 mb-1"},(0,pe.__)("Alt Text","nggallery")),ee().createElement("input",{type:"text",id:"alttext",name:"alttext",value:v.alttext,onChange:P,className:"w-full px-3 py-2 border rounded-md shadow-sm focus:outline-none focus:ring-2 ".concat(N.alttext?"border-red-300 focus:ring-red-500 focus:border-red-500":"border-gray-300 focus:ring-green-500 focus:border-green-500")}),N.alttext&&ee().createElement("p",{className:"mt-1 text-sm text-red-600"},N.alttext)),ee().createElement("div",null,ee().createElement("label",{htmlFor:"description",className:"block text-sm font-medium text-gray-700 mb-1"},(0,pe.__)("Description","nggallery")),ee().createElement("textarea",{id:"description",name:"description",value:v.description,onChange:P,rows:4,className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-green-500 focus:border-green-500"})),ee().createElement("div",null,ee().createElement("label",{htmlFor:"tags",className:"block text-sm font-medium text-gray-700 mb-1"},(0,pe.__)("Tags (comma-separated)","nggallery")),ee().createElement("input",{type:"text",id:"tags",name:"tags",value:v.tags,onChange:P,className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-green-500 focus:border-green-500"})),"pro"===zr?ee().createElement("div",null,ee().createElement("label",{htmlFor:"pricelist_id",className:"block text-sm font-medium text-gray-700 mb-1"},(0,pe.__)("Pricelist","nggallery")),ee().createElement("select",{id:"pricelist_id",name:"pricelist_id",value:"pricelist_id"in v?v.pricelist_id:"0",onChange:P,disabled:x||s,className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-green-500 focus:border-green-500",style:{width:"100%",minWidth:"100%"}},s?ee().createElement("option",{value:"0"},(0,pe.__)("Loading pricelists...","nggallery")):ee().createElement(ee().Fragment,null,ee().createElement("option",{value:"0"},(0,pe.__)("Use gallery's pricelist","nggallery")),ee().createElement("option",{value:"-1"},(0,pe.__)("None (not for sale)","nggallery")),((null==c?void 0:c.pricelists)||[]).map(function(e){return ee().createElement("option",{key:e.id,value:e.id.toString()},e.title)}))),ee().createElement("p",{className:"text-xs text-gray-500 mt-1"},(0,pe.__)("Choose how to handle pricing for this image.","nggallery"))):ee().createElement("div",{className:"relative"},ee().createElement("div",{className:"opacity-50 pointer-events-none"},ee().createElement("label",{htmlFor:"pricelist_id",className:"block text-sm font-medium text-gray-700 mb-1"},(0,pe.__)("Pricelist","nggallery")),ee().createElement("select",{id:"pricelist_id",name:"pricelist_id",value:"0",onChange:function(){},disabled:!0,className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-green-500 focus:border-green-500",style:{width:"100%",minWidth:"100%"}},ee().createElement("option",{value:"0"},(0,pe.__)("Use gallery's pricelist","nggallery")),ee().createElement("option",{value:"-1"},(0,pe.__)("None (not for sale)","nggallery"))),ee().createElement("p",{className:"text-xs text-gray-500 mt-1"},(0,pe.__)("Choose how to handle pricing for this image.","nggallery"))),ee().createElement("div",{className:"absolute inset-0 cursor-pointer flex items-center",onClick:function(){o.setActiveModal("upgrade",{feature:"eCommerce features",onClose:function(){o.setActiveModal("editImage",{image:a})}})},title:(0,pe.__)("Requires NextGEN Gallery Pro","nggallery")},ee().createElement("span",{className:"sr-only"},(0,pe.__)("Upgrade to Pro for eCommerce features","nggallery")))),ee().createElement("div",{className:"flex justify-end space-x-3 pt-4"},ee().createElement("button",{type:"button",onClick:r,disabled:x,className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500"},(0,pe.__)("Cancel","nggallery")),ee().createElement("button",{type:"submit",disabled:x,className:"px-4 py-2 text-sm font-medium text-white bg-green-600 border border-transparent rounded-md shadow-sm hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 disabled:opacity-50 disabled:cursor-not-allowed flex items-center"},x&&ee().createElement(kn,{className:"animate-spin -ml-1 mr-2 h-4 w-4 text-white"}),x?(0,pe.__)("Saving...","nggallery"):(0,pe.__)("Save Changes","nggallery")))))},editVideo:function(e){var t=e.isOpen,r=e.onClose,a=e.image,o=e.galleryId,l=re(),i=(null==a?void 0:a.galleryid)||o,c=!!a,s=Pl(null!=i?i:0,{enabled:c&&!!i}).data,u=(null==s?void 0:s.images)||[],m=c&&a?(null==u?void 0:u.find(function(e){return e.pid===a.pid}))||a:null,d=xc(),g=$o(),p=g.showSuccess,f=g.showError,y=vo((0,$.useState)({videoLink:"",thumbnailImageLink:""}),2),h=y[0],b=y[1],v=vo((0,$.useState)(null),2),_=v[0],w=v[1],x=vo((0,$.useState)(!1),2),E=x[0],C=x[1],N=vo((0,$.useState)({}),2),k=N[0],S=N[1],O=Uo(),P=O.isMediaLibraryOpen,j=O.openMediaFrame,T=(0,$.useRef)(null),I=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500,n=vo((0,$.useState)(!1),2),r=n[0],a=n[1];return(0,$.useEffect)(function(){var n=e.trim();if(n){var r=setTimeout(No(Ro().m(function e(){var t;return Ro().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,Bo(n);case 1:t=e.v,a(t);case 2:return e.a(2)}},e)})),t);return function(){return clearTimeout(r)}}a(!1)},[e,t]),{isHostedVideo:r}}(h.videoLink).isHostedVideo;(0,$.useEffect)(function(){if(t){if(c&&m){var e,n=(null===(e=m.meta_data)||void 0===e?void 0:e.video_link)||"",r=m.thumb_url||m.image_url||"";b({videoLink:n,thumbnailImageLink:r})}else b({videoLink:"",thumbnailImageLink:""});w(null),S({})}},[t,m,c]),(0,$.useEffect)(function(){return function(){h.thumbnailImageLink.startsWith("blob:")&&URL.revokeObjectURL(h.thumbnailImageLink)}},[h.thumbnailImageLink]);var A=function(){var e={};return h.videoLink.trim()||(e.videoLink=(0,pe.__)("Video link is required","nggallery")),!I||h.thumbnailImageLink.trim()||_||(e.thumbnailImageLink=(0,pe.__)("Thumbnail image link is required if specifying a local video URL","nggallery")),S(e),0===Object.keys(e).length},D=function(){var e=No(Kc().m(function e(t){var n,a,o,s,u;return Kc().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t.preventDefault(),A()){e.n=1;break}return e.a(2);case 1:return C(!0),e.p=2,n=new FormData,i&&n.append("gallery_id",i.toString()),n.append("video_links[0][videoLink]",h.videoLink.trim()),a=h.thumbnailImageLink.startsWith("blob:")?"":h.thumbnailImageLink.trim(),n.append("video_links[0][thumbnailImageLink]",a),_&&n.append("video_links[0][thumbnailFileInput]",_),e.n=3,Oo()({path:Ur,method:"POST",headers:{"X-WP-Nonce":Ao()},body:n});case 3:if(!(o=e.v).error){e.n=4;break}throw new Error(o.error);case 4:if(!(o.errors&&o.errors.length>0)){e.n=5;break}throw new Error(o.errors.join(", "));case 5:if(!c||null==m||!m.pid){e.n=6;break}return e.n=6,d.mutateAsync({imageId:m.pid}).catch(function(e){console.warn("Failed to delete old image ".concat(m.pid,":"),e)});case 6:if(p(c?(0,pe.__)("Video updated successfully","nggallery"):(0,pe.__)("Video added successfully","nggallery")),!i){e.n=7;break}return e.n=7,l.invalidateQueries({queryKey:["gallery",i,"images"]});case 7:setTimeout(function(){r()},100),e.n=9;break;case 8:e.p=8,u=e.v,s=u instanceof Error?u.message:(0,pe.__)("Failed to update video","nggallery"),f(s);case 9:return e.p=9,C(!1),e.f(9);case 10:return e.a(2)}},e,null,[[2,8,9,10]])}));return function(t){return e.apply(this,arguments)}}(),L=function(e){var t=e.target,r=t.name,a=t.value;b(function(e){return Vc(Vc({},e),{},n({},r,a))}),k[r]&&S(function(e){return Vc(Vc({},e),{},n({},r,""))})};return ee().createElement(Eo,{isOpen:t,onClose:r,title:(0,pe.__)("Edit Video","nggallery")},ee().createElement("form",{onSubmit:D,className:"space-y-4"},ee().createElement("div",{className:"p-3 sm:p-4 border border-gray-300 rounded-lg bg-white"},ee().createElement("div",null,ee().createElement("label",{htmlFor:"videoLink",className:"block text-sm font-medium text-gray-700 mb-1.5"},(0,pe.__)("Video Link","nggallery")),ee().createElement("input",{type:"url",id:"videoLink",name:"videoLink",value:h.videoLink,onChange:L,placeholder:(0,pe.__)("Enter video URL","nggallery"),className:"bg-white border text-gray-900 text-sm rounded-lg focus:ring-green-500 focus:border-green-500 block w-full p-2.5 hover:border-green-500 transition-colors ".concat(k.videoLink?"border-red-300 focus:ring-red-500 focus:border-red-500":"border-gray-400")}),k.videoLink&&ee().createElement("p",{className:"mt-1 text-sm text-red-600"},k.videoLink)),ee().createElement("div",{className:"mt-4"},ee().createElement("label",{htmlFor:"thumbnailImageLink",className:"block text-sm font-medium text-gray-700 mb-1.5"},(0,pe.__)("Thumbnail Image Link","nggallery")),ee().createElement("input",{type:"url",id:"thumbnailImageLink",name:"thumbnailImageLink",value:h.thumbnailImageLink.startsWith("blob:")?"":h.thumbnailImageLink,onChange:L,placeholder:(0,pe.__)("Enter thumbnail image URL or select from media library","nggallery"),className:"bg-white border text-gray-900 text-sm rounded-lg focus:ring-green-500 focus:border-green-500 block w-full p-2.5 hover:border-green-500 transition-colors mb-2 ".concat(k.thumbnailImageLink?"border-red-300 focus:ring-red-500 focus:border-red-500":"border-gray-400"," ").concat(_?"opacity-50":""),disabled:!!_}),ee().createElement("input",{ref:T,type:"file",id:"thumbnailFileInput",name:"thumbnailFileInput",accept:"image/*",onChange:function(e){var t=e.target.files;if(t&&t.length>0){var n=t[0];if(!n.type.startsWith("image/"))return void S(function(e){return Vc(Vc({},e),{},{thumbnailImageLink:(0,pe.__)("Please select a valid image file.","nggallery")})});var r=URL.createObjectURL(n);w(n),b(function(e){return Vc(Vc({},e),{},{thumbnailImageLink:r})}),S(function(e){return Vc(Vc({},e),{},{thumbnailImageLink:""})})}e.target&&(e.target.value="")},className:"hidden",disabled:E}),k.thumbnailImageLink&&ee().createElement("p",{className:"mt-1 text-sm text-red-600"},k.thumbnailImageLink),ee().createElement("div",{className:"flex gap-4 items-start mt-2"},ee().createElement("div",{className:"flex flex-col gap-2"},ee().createElement("button",{type:"button",onClick:function(){var e;null===(e=T.current)||void 0===e||e.click()},disabled:E||P,className:"px-4 py-2.5 bg-gray-100 hover:bg-gray-200 border border-gray-300 rounded-lg transition-colors flex items-center justify-center gap-2 text-gray-700 hover:text-gray-900 disabled:opacity-50 disabled:cursor-not-allowed",title:(0,pe.__)("Upload from computer","nggallery")},ee().createElement(or,{className:"w-5 h-5 flex-shrink-0"}),ee().createElement("span",{className:"text-sm font-medium"},(0,pe.__)("Select File","nggallery"))),ee().createElement("button",{type:"button",onClick:function(e){j({title:(0,pe.__)("Select Cover Image","nggallery"),buttonText:(0,pe.__)("Use this image","nggallery"),onSelect:function(e){w(null),b(function(t){return Vc(Vc({},t),{},{thumbnailImageLink:e})}),S(function(e){return Vc(Vc({},e),{},{thumbnailImageLink:""})})}},e)},disabled:E||P,className:"px-4 py-2.5 bg-gray-100 hover:bg-gray-200 border border-gray-300 rounded-lg transition-colors flex items-center justify-center gap-2 text-gray-700 hover:text-gray-900 disabled:opacity-50 disabled:cursor-not-allowed"},ee().createElement(Cn,{className:"w-5 h-5 flex-shrink-0"}),ee().createElement("span",{className:"text-sm font-medium"},(0,pe.__)("Upload","nggallery"))),_&&ee().createElement("div",{className:"text-xs text-gray-600"},(0,pe.__)("File selected:","nggallery")," ",_.name)),h.thumbnailImageLink&&ee().createElement("div",{className:"flex-1 flex justify-end"},ee().createElement("div",{className:"relative w-32 h-24 sm:w-40 sm:h-32"},ee().createElement("img",{src:h.thumbnailImageLink,alt:(0,pe.__)("Video thumbnail","nggallery"),className:"w-full h-full object-cover rounded-lg shadow-md border border-gray-300",onError:function(e){e.target.style.display="none"}})))))),ee().createElement("div",{className:"flex justify-end space-x-3 pt-4"},ee().createElement("button",{type:"button",onClick:r,disabled:E,className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500"},(0,pe.__)("Cancel","nggallery")),ee().createElement("button",{type:"submit",disabled:E,className:"px-4 py-2 text-sm font-medium text-white bg-green-600 border border-transparent rounded-md shadow-sm hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 disabled:opacity-50 disabled:cursor-not-allowed flex items-center"},E&&ee().createElement(kn,{className:"animate-spin -ml-1 mr-2 h-4 w-4 text-white"}),E?(0,pe.__)("Saving...","nggallery"):(0,pe.__)("Save Changes","nggallery")))))},addVideoLinks:function(e){var t=e.isOpen,n=e.onClose,r=e.galleryId,a=re(),o=kl(null!=r?r:0).data,l=function(){var e=No(Gl().m(function e(t){return Gl().w(function(e){for(;;)switch(e.n){case 0:if(!r&&!t){e.n=1;break}return e.n=1,a.invalidateQueries({queryKey:["gallery",r||t,"images"]});case 1:setTimeout(function(){n()},100);case 2:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}();return React.createElement(Eo,{isOpen:t,onClose:n,title:(0,pe.__)("Add Video Links","nggallery"),modalClassName:"rounded-lg max-w-4xl",contentClassName:"p-0"},React.createElement(Zo,{galleryId:r,galleryTitle:(null==o?void 0:o.title)||(0,pe.__)("New Gallery","nggallery"),onSuccess:l,buttonLabel:(0,pe.__)("Save","nggallery")}))},upgrade:function(e){var t=e.isOpen,n=e.onClose,r=e.feature,a=void 0===r?"eCommerce features":r,o=a.replace(/\s+(features?)$/i,"").trim(),l="eCommerce"===o?o:o.split(" ").map(function(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}).join(" "),i=("eCommerce"===o||function(e){e.toLowerCase()}(l),o),c=/layout/i.test(a),s=Cp(void 0,o);return ee().createElement(Eo,{isOpen:t,onClose:n,title:""},ee().createElement("div",{className:"text-center"},ee().createElement("div",{className:"flex items-center justify-center w-10 h-10 mx-auto mb-4"},ee().createElement(wr,{className:"w-12 h-12"})),ee().createElement("h3",{className:"text-xl font-semibold text-gray-800 mb-4"},c?(0,pe.__)("This layout is a Pro Feature","nggallery"):(0,pe.__)("".concat(l," is a Pro Feature"),"nggallery")),ee().createElement("p",{className:"text-gray-600 text-center mb-0"},c?(0,pe.__)("We're sorry, using this layout is not available on your plan.","nggallery"):(0,pe.__)("We're sorry, using ".concat(i," is not available on your plan."),"nggallery")),ee().createElement("p",{className:"text-gray-600 text-center mb-6"},(0,pe.__)("Please upgrade to the Pro plan to unlock this and all our awesome features.","nggallery")),ee().createElement("div",{className:"relative mb-8 flex justify-center items-center"},ee().createElement(xr,{className:"absolute left-[90px] -top-4 w-12 h-12 flex-shrink-0"}),ee().createElement("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center bg-green-500 text-white text-center text-lg py-3 px-6 rounded-lg font-medium hover:bg-green-600 transition-colors"},(0,pe.__)("Upgrade to Pro","nggallery"),ee().createElement(vr,{className:"w-4 h-4 ml-2 flex-shrink-0"}))),ee().createElement("div",{className:"bg-[#F0FDE6] -mx-4 -mb-4 sm:px-16 px-8 py-4 rounded-b-lg"},ee().createElement("div",{className:"flex items-center"},ee().createElement(Er,{className:"w-8 h-8 sm:ml-8 ml-2 mr-2 flex-shrink-0"}),ee().createElement("p",{className:"text-gray-700 text-sm text-left"},(0,pe.__)("Imagely lite users get","nggallery")," ",ee().createElement("strong",{className:"text-green-600"},(0,pe.__)("50% off","nggallery"))," ",(0,pe.__)("the regular price, automatically applied at checkout!","nggallery"))))))},licenseRequired:function(e){var t=e.isOpen,n=e.onClose,r=e.action,a=void 0===r?"create new galleries":r,o=(0,ge.useDispatch)(Br),l=Kl();return ee().createElement(Eo,{id:"license-required-modal",isOpen:t,onClose:n,title:""},ee().createElement("div",{className:"text-center"},ee().createElement("div",{className:"flex items-center justify-center w-16 h-16 mx-auto mb-4 bg-orange-100 rounded-full"},ee().createElement(lr,{className:"w-8 h-8 text-orange-600"})),ee().createElement("h3",{className:"text-xl font-semibold text-gray-800 mb-4"},(0,pe.__)("License Activation Required","nggallery")),ee().createElement("p",{className:"text-gray-600 text-center mb-2"},(0,pe.__)("To ".concat(a,", you need an active license."),"nggallery")),ee().createElement("p",{className:"text-gray-600 text-center mb-6"},(0,pe.__)("Please add or update your license key to continue.","nggallery")),ee().createElement("div",{className:"flex flex-col sm:flex-row gap-3 justify-center mb-6"},ee().createElement("button",{onClick:function(){if(n(),null!=l&&l.isEmbed){var e,t=null!==(e=window.imagelyApp)&&void 0!==e&&e.adminURL?"".concat(window.imagelyApp.adminURL,"admin.php?page=imagely-settings&tab=license"):"/wp-admin/admin.php?page=imagely-settings&tab=license";window.location.href=t}else o.navigateTo("imagely-settings","license",null)},className:"inline-flex items-center justify-center bg-green-500 text-white text-center text-base py-3 px-6 rounded-lg font-medium hover:bg-green-600 transition-colors"},ee().createElement(ir,{className:"w-5 h-5 mr-2"}),(0,pe.__)("Activate License","nggallery")),ee().createElement("button",{onClick:n,className:"inline-flex items-center justify-center bg-gray-100 text-gray-700 text-center text-base py-3 px-6 rounded-lg font-medium hover:bg-gray-200 transition-colors"},(0,pe.__)("Cancel","nggallery"))),ee().createElement("div",{className:"bg-green-50 border-t border-green-100 -mx-4 -mb-4 px-6 py-4 rounded-b-lg"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cr,{className:"w-5 h-5 text-green-500 mr-2 flex-shrink-0 mt-0.5"}),ee().createElement("p",{className:"text-gray-700 text-sm text-left"},(0,pe.__)("Your license key can be found in your account dashboard. If your license has expired, you can renew it to continue using all pro features.","nggallery"))))))},couponForm:function(e){var t=e.isOpen,r=e.onClose,a=e.onSuccess,o=$o(),l=o.showSuccess,i=o.showError,c=re(),s=vo((0,$.useState)(!1),2),u=s[0],m=s[1],d=vo((0,$.useState)({}),2),g=d[0],p=d[1],f=vo((0,$.useState)({couponFor:"",couponCode:"",discountType:"percentage",discountValue:"",startDate:"",endDate:"",usageLimit:""}),2),y=f[0],h=f[1],b=Zi();(0,$.useEffect)(function(){t&&(h({couponFor:"",couponCode:"",discountType:"percentage",discountValue:"",startDate:"",endDate:"",usageLimit:""}),p({}),m(!1))},[t]);var v=function(e){var t=e.target,r=t.name,a=t.value;h(function(e){var t=bc(bc({},e),{},n({},r,a));if("startDate"!==r||a||(t.endDate=""),"startDate"===r&&e.endDate&&a&&e.endDate&&a>e.endDate&&(t.endDate=a),"endDate"===r&&e.startDate&&a&&e.startDate&&a<e.startDate&&(t.startDate=a),"discountValue"===r){var o=String(a).replace(/[^0-9.]/g,"");if("percentage"===e.discountType){var l=parseFloat(o||"0");t.discountValue=String(Math.min(100,isNaN(l)?0:l))}else t.discountValue=o}if("discountType"===r&&"percentage"===a){var i=parseFloat(String(e.discountValue||"0"));isNaN(i)||(t.discountValue=String(Math.min(100,i)))}return t}),g[r]&&p(function(e){return bc(bc({},e),{},n({},r,""))})},_=function(){var e={};return y.couponFor.trim()||(e.couponFor=(0,pe.__)("This field is required","nggallery")),y.couponCode.trim()||(e.couponCode=(0,pe.__)("This field is required","nggallery")),y.discountValue.trim()||(e.discountValue=(0,pe.__)("This field is required","nggallery")),y.startDate&&y.endDate&&y.endDate<y.startDate&&(e.endDate=(0,pe.__)("End date cannot be before start date","nggallery")),p(e),0===Object.keys(e).length},w=function(){var e=No(fc().m(function e(t){var n,o,s,u,d;return fc().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t.preventDefault(),_()){e.n=1;break}return e.a(2);case 1:return m(!0),e.p=2,o=null===(n=window.imagelyApp)||void 0===n?void 0:n.nonce,s={title:y.couponFor.trim(),id_code:y.couponCode.trim(),discount_type:"percentage"===y.discountType?"percent":"flat",discount_amount:parseFloat(String(y.discountValue).trim()),date_start:y.startDate||void 0,date_end:y.endDate||void 0,usage_limit:y.usageLimit?parseInt(String(y.usageLimit),10):void 0},e.n=3,Oo()({path:"/imagely/v1/coupons",method:"POST",headers:{"X-WP-Nonce":o,"Content-Type":"application/json"},data:s});case 3:c.invalidateQueries({queryKey:["coupons"]}),l((0,pe.__)("Coupon created successfully","nggallery")),a&&a(),r(),e.n=5;break;case 4:e.p=4,d=e.v,u=(0,pe.__)("Failed to create coupon","nggallery"),d&&d.message&&(u=d.message),i(u);case 5:return e.p=5,m(!1),e.f(5);case 6:return e.a(2)}},e,null,[[2,4,5,6]])}));return function(t){return e.apply(this,arguments)}}();return ee().createElement(Eo,{isOpen:t,onClose:r,title:(0,pe.__)("Create New Coupon","nggallery")},ee().createElement("form",{onSubmit:w,className:"space-y-4"},ee().createElement("div",null,ee().createElement(uc,{type:"text",id:"couponFor",name:"couponFor",value:y.couponFor,onChange:v,label:(0,pe.__)("Coupon For","nggallery"),help:(0,pe.__)("This is a label for your reference only and is not shown to customers.","nggallery"),tooltipPlacement:"right",placeholder:(0,pe.__)("For e.g. Black Friday","nggallery")}),g.couponFor&&ee().createElement("p",{className:"mt-1 text-sm text-red-600"},g.couponFor)),ee().createElement("div",null,ee().createElement(uc,{type:"text",id:"couponCode",name:"couponCode",value:y.couponCode,onChange:v,label:(0,pe.__)("Coupon Code","nggallery"),help:(0,pe.__)("This field must be unique from every other coupon code","nggallery"),tooltipPlacement:"right",placeholder:(0,pe.__)("Enter unique coupon code","nggallery")}),g.couponCode&&ee().createElement("p",{className:"mt-1 text-sm text-red-600"},g.couponCode)),ee().createElement("div",null,ee().createElement(sc,{id:"discountType",name:"discountType",value:y.discountType,onChange:v,label:(0,pe.__)("Discount Type","nggallery"),tooltipPlacement:"right"},ee().createElement("option",{value:"percentage"},(0,pe.__)("Percentage","nggallery")),ee().createElement("option",{value:"flat"},(0,pe.__)("Flat Amount","nggallery")))),ee().createElement("div",null,ee().createElement(uc,{type:"number",id:"discountValue",name:"discountValue",value:y.discountValue,onChange:v,label:(0,pe.__)("Discount Value","nggallery"),placeholder:(0,pe.__)("Enter Discount Amount","nggallery"),prefix:"percentage"===y.discountType?"%":b}),g.discountValue&&ee().createElement("p",{className:"mt-1 text-sm text-red-600"},g.discountValue)),ee().createElement("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3"},ee().createElement("div",null,ee().createElement(uc,{type:"date",id:"startDate",name:"startDate",value:y.startDate,onChange:v,label:(0,pe.__)("Start Date","nggallery"),placeholder:(0,pe.__)("Select Start Date","nggallery"),maxString:y.endDate||void 0})),ee().createElement("div",null,ee().createElement(uc,{type:"date",id:"endDate",name:"endDate",value:y.endDate,onChange:v,label:(0,pe.__)("End Date","nggallery"),placeholder:(0,pe.__)("Select End Date","nggallery"),minString:y.startDate||void 0}))),ee().createElement("div",null,ee().createElement(uc,{type:"number",id:"usageLimit",name:"usageLimit",value:y.usageLimit,onChange:v,label:(0,pe.__)("Usage Limit","nggallery"),help:(0,pe.__)("How many times this coupon may be used by users before it becomes invalid. An empty or 0 setting allows infinite uses.","nggallery"),tooltipPlacement:"right",placeholder:(0,pe.__)("Enter Usage Limit","nggallery")})),ee().createElement("div",{className:"flex justify-end space-x-3 pt-4"},ee().createElement("button",{type:"button",onClick:r,disabled:u,className:"px-4 py-2 text-sm font-medium text-green-700 bg-white border border-green-500 rounded-md shadow-sm hover:bg-green-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 disabled:opacity-50 disabled:cursor-not-allowed"},(0,pe.__)("Cancel","nggallery")),ee().createElement("button",{type:"submit",disabled:u,className:"px-4 py-2 text-sm font-semibold text-white bg-green-500 border border-transparent rounded-md shadow-sm hover:bg-green-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 disabled:opacity-50 disabled:cursor-not-allowed"},u?ee().createElement("span",{className:"flex items-center"},ee().createElement(kn,{className:"animate-spin -ml-1 mr-2 h-4 w-4 text-white"}),(0,pe.__)("Creating...","nggallery")):(0,pe.__)("Create Code","nggallery")))))},couponDetails:function(e){var t,n,r,a,o,l,i,c,s,u,m,d,g,p,f=e.isOpen,y=e.onClose,h=e.data,b=e.onEdit,v=(0,ge.useDispatch)(Br),_=Hi(null==h?void 0:h.id),w=_.data,x=_.isLoading,E=_.isFetching,C=_.refetch;(0,$.useEffect)(function(){f&&null!=h&&h.id&&C()},[f,null==h?void 0:h.id,C]);var N,k,S=w?{couponFor:null!==(t=null==w?void 0:w.coupon_for)&&void 0!==t?t:"",couponCode:null!==(n=null==w?void 0:w.coupon_code)&&void 0!==n?n:"",discountType:null!==(r=null==w?void 0:w.discount_type)&&void 0!==r?r:"",discountValue:String(null!==(a=null!==(o=null==w?void 0:w.discount_value)&&void 0!==o?o:null==w?void 0:w.discount_amount)&&void 0!==a?a:""),startDate:null!==(l=null!==(i=null==w?void 0:w.start_date)&&void 0!==i?i:null==w?void 0:w.date_start)&&void 0!==l?l:"",endDate:null!==(c=null!==(s=null==w?void 0:w.end_date)&&void 0!==s?s:null==w?void 0:w.date_end)&&void 0!==c?c:"",usageLimit:String(null!==(u=null==w?void 0:w.usage_limit)&&void 0!==u?u:"")}:{couponFor:h.couponFor,couponCode:h.couponCode,discountType:h.discountType,discountValue:null!==(m=h.discountValue)&&void 0!==m?m:"",startDate:null!==(d=h.startDate)&&void 0!==d?d:"",endDate:null!==(g=h.endDate)&&void 0!==g?g:"",usageLimit:null!==(p=h.usageLimit)&&void 0!==p?p:""},O=function(e){return(null==e?"":String(e).trim())||"-"},P=function(e){if(!e)return"-";var t=new Date(e),n=String(t.getDate()).padStart(2,"0"),r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getMonth()],a=t.getFullYear();return"".concat(n," ").concat(r," ").concat(a)},j="percentage"===S.discountType?(0,pe.__)("Percentage","nggallery"):"flat"===S.discountType?(0,pe.__)("Flat","nggallery"):"-",T=Zi(),I=(k=(null!==(N=S.discountValue)&&void 0!==N?N:"").trim())?"percentage"===S.discountType?"".concat(k,"%"):"".concat(T," ").concat(k):"-",A=function(e){var t=(null!==(e=S.usageLimit)&&void 0!==e?e:"").trim();if(!t)return"-";var n=Number(t);return Number.isNaN(n)||0===n?"-":String(n)}();return ee().createElement(Eo,{isOpen:f,onClose:y,title:(0,pe.__)("Coupon Details","nggallery")},ee().createElement("div",{className:"absolute top-4 right-12"},ee().createElement("button",{type:"button",onClick:function(){b?b():v.setActiveModal("couponEdit",{data:{id:null==h?void 0:h.id,couponFor:S.couponFor,couponCode:S.couponCode,discountType:S.discountType,discountValue:S.discountValue,startDate:S.startDate,endDate:S.endDate,usageLimit:S.usageLimit}})},className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs border border-gray-300 rounded-md bg-white text-gray-700 hover:bg-gray-50"},ee().createElement(cn,{className:"w-4 h-4"}),(0,pe.__)("Edit","nggallery"))),x||E?ee().createElement("div",{className:"py-10"},ee().createElement(oo,{size:"md",color:"gray",text:(0,pe.__)("Loading…","nggallery")})):ee().createElement("div",{className:"space-y-6"},ee().createElement("div",{className:"text-center"},ee().createElement("div",{className:"text-[11px] tracking-wide text-gray-500"},(0,pe.__)("Coupon For","nggallery")),ee().createElement("div",{className:"text-lg font-semibold text-gray-900 mt-1"},O(S.couponFor))),ee().createElement("div",{className:""},ee().createElement("div",{className:"bg-gray-100 border border-gray-200 rounded-md px-5 py-3 text-center w-full"},ee().createElement("div",{className:"text-[11px] tracking-wide text-gray-600"},(0,pe.__)("Coupon Code","nggallery")),ee().createElement("div",{className:"mt-1 text-lg font-bold tracking-wider text-gray-900"},O(S.couponCode)))),ee().createElement("div",{className:"grid grid-cols-2 gap-8"},ee().createElement("div",{className:"text-center"},ee().createElement("div",{className:"text-[11px] tracking-wide text-gray-500"},(0,pe.__)("Discount Type","nggallery")),ee().createElement("div",{className:"pt-3 text-base font-medium text-gray-900"},j)),ee().createElement("div",{className:"text-center"},ee().createElement("div",{className:"text-[11px] tracking-wide text-gray-500"},(0,pe.__)("Discount Value","nggallery")),ee().createElement("div",{className:"pt-3 text-base font-semibold text-gray-900"},I))),ee().createElement("div",{className:"border-t border-dashed border-gray-300"}),ee().createElement("div",{className:"grid grid-cols-2 gap-8"},ee().createElement("div",{className:"text-center"},ee().createElement("div",{className:"text-[11px] tracking-wide text-gray-500"},(0,pe.__)("Start Date","nggallery")),ee().createElement("div",{className:"pt-2 text-base font-medium text-gray-900"},P(S.startDate))),ee().createElement("div",{className:"text-center"},ee().createElement("div",{className:"text-[11px] tracking-wide text-gray-500"},(0,pe.__)("End Date","nggallery")),ee().createElement("div",{className:"pt-2 text-base font-medium text-gray-900"},P(S.endDate)))),ee().createElement("div",{className:"text-center"},ee().createElement("div",{className:"text-[11px] tracking-wide text-gray-500"},(0,pe.__)("Usage Limit","nggallery")),ee().createElement("div",{className:"pt-1 text-lg text-gray-900 font-semibold"},A))))},couponEdit:function(e){var t=e.isOpen,r=e.onClose,a=e.data,o=e.onSuccess,l=$o(),i=l.showSuccess,c=l.showError,s=function(){var e,t=re();return gl({mutationFn:(e=No(Bi().m(function e(t){var n,r,a,o,l,i,c,s,u;return Bi().w(function(e){for(;;)switch(e.n){case 0:return r=t.id,a=t.data,o=null===(n=window.imagelyApp)||void 0===n?void 0:n.nonce,l={},"coupon_for"in a&&(l.title=""===a.coupon_for?null:a.coupon_for),"coupon_code"in a&&(l.id_code=""===a.coupon_code?null:a.coupon_code),"discount_type"in a&&(i=a.discount_type,l.discount_type=null==i?null:"percentage"===i?"percent":"flat"===i?"flat":null),"discount_value"in a&&(c=null===a.discount_value||void 0===a.discount_value||""===String(a.discount_value).trim()?null:parseFloat(String(a.discount_value)),l.discount_amount=c),"start_date"in a&&(l.date_start=a.start_date&&""!==String(a.start_date).trim()?a.start_date:null),"end_date"in a&&(l.date_end=a.end_date&&""!==String(a.end_date).trim()?a.end_date:null),"usage_limit"in a&&(s=null===a.usage_limit||void 0===a.usage_limit||""===String(a.usage_limit).trim()?null:parseInt(String(a.usage_limit),10),l.usage_limit=s),e.n=1,Oo()({path:"/imagely/v1/coupons/".concat(r),method:"PUT",headers:{"X-WP-Nonce":o},data:l});case 1:return u=e.v,e.a(2,Ui(u))}},e)})),function(t){return e.apply(this,arguments)}),onSuccess:function(e){t.invalidateQueries({queryKey:["coupons"]}),t.invalidateQueries({queryKey:Wi(e.id)})}})}(),u=Hi(null==a?void 0:a.id).data,m=vo((0,$.useState)(!1),2),d=m[0],g=m[1],p=vo((0,$.useState)({}),2),f=p[0],y=p[1],h=Zi(),b=vo((0,$.useState)({couponFor:"",couponCode:"",discountType:"percentage",discountValue:"",startDate:"",endDate:"",usageLimit:""}),2),v=b[0],_=b[1];(0,$.useEffect)(function(){var e;t&&(_(u?{couponFor:u.coupon_for||"",couponCode:u.coupon_code||"",discountType:u.discount_type||"percentage",discountValue:String((null!==(e=u.discount_value)&&void 0!==e?e:u.discount_amount)||"").replace(/[^0-9.]/g,""),startDate:u.start_date||u.date_start||"",endDate:u.end_date||u.date_end||"",usageLimit:u.usage_limit?String(u.usage_limit).replace(/[^0-9]/g,""):""}:{couponFor:(null==a?void 0:a.couponFor)||"",couponCode:(null==a?void 0:a.couponCode)||"",discountType:(null==a?void 0:a.discountType)||"percentage",discountValue:((null==a?void 0:a.discountValue)||"").replace(/[^0-9.]/g,""),startDate:(null==a?void 0:a.startDate)||"",endDate:(null==a?void 0:a.endDate)||"",usageLimit:((null==a?void 0:a.usageLimit)||"").replace(/[^0-9]/g,"")}),y({}),g(!1))},[t,a,u]);var w=function(e){var t=e.target,r=t.name,a=t.value;_(function(e){var t=pc(pc({},e),{},n({},r,a));if("startDate"!==r||a||(t.endDate=""),"startDate"===r&&e.endDate&&a&&e.endDate&&a>e.endDate&&(t.endDate=a),"endDate"===r&&e.startDate&&a&&e.startDate&&a<e.startDate&&(t.startDate=a),"discountValue"===r){var o=String(a).replace(/[^0-9.]/g,"");if("percentage"===e.discountType){var l=parseFloat(o||"0");t.discountValue=String(Math.min(100,isNaN(l)?0:l))}else t.discountValue=o}if("discountType"===r&&"percentage"===a){var i=parseFloat(String(e.discountValue||"0"));isNaN(i)||(t.discountValue=String(Math.min(100,i)))}return t}),f[r]&&y(function(e){return pc(pc({},e),{},n({},r,""))})},x=function(){var e={};return v.couponFor.trim()||(e.couponFor=(0,pe.__)("This field is required","nggallery")),v.couponCode.trim()||(e.couponCode=(0,pe.__)("This field is required","nggallery")),v.discountValue.trim()||(e.discountValue=(0,pe.__)("This field is required","nggallery")),v.startDate&&v.endDate&&v.endDate<v.startDate&&(e.endDate=(0,pe.__)("End date cannot be before start date","nggallery")),y(e),0===Object.keys(e).length},E=function(){var e=No(mc().m(function e(t){var n,l;return mc().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t.preventDefault(),x()){e.n=1;break}return e.a(2);case 1:return g(!0),e.p=2,n=(null==a?void 0:a.id)||(null==a?void 0:a.couponId),e.n=3,s.mutateAsync({id:n,data:{coupon_for:v.couponFor,coupon_code:v.couponCode,discount_type:v.discountType,discount_value:v.discountValue,start_date:v.startDate||void 0,end_date:v.endDate||void 0,usage_limit:v.usageLimit||void 0}});case 3:i((0,pe.__)("Coupon updated successfully","nggallery")),o&&o(),r(),e.n=5;break;case 4:e.p=4,l=e.v,c((null==l?void 0:l.message)||(0,pe.__)("Failed to update coupon","nggallery"));case 5:return e.p=5,g(!1),e.f(5);case 6:return e.a(2)}},e,null,[[2,4,5,6]])}));return function(t){return e.apply(this,arguments)}}();return ee().createElement(Eo,{isOpen:t,onClose:r,title:(0,pe.__)("Edit Coupon","nggallery")},ee().createElement("form",{onSubmit:E,className:"space-y-4"},ee().createElement("div",null,ee().createElement(uc,{type:"text",id:"couponFor",name:"couponFor",value:v.couponFor,onChange:w,label:(0,pe.__)("Coupon For","nggallery"),help:(0,pe.__)("This is a label for your reference only and is not shown to customers.","nggallery"),tooltipPlacement:"right",placeholder:(0,pe.__)("For e.g. Black Friday","nggallery")}),f.couponFor&&ee().createElement("p",{className:"mt-1 text-sm text-red-600"},f.couponFor)),ee().createElement("div",null,ee().createElement(uc,{type:"text",id:"couponCode",name:"couponCode",value:v.couponCode,onChange:w,label:(0,pe.__)("Coupon Code","nggallery"),help:(0,pe.__)("This field must be unique from every other coupon code","nggallery"),tooltipPlacement:"right",placeholder:(0,pe.__)("Enter unique coupon code","nggallery")}),f.couponCode&&ee().createElement("p",{className:"mt-1 text-sm text-red-600"},f.couponCode)),ee().createElement("div",null,ee().createElement(sc,{id:"discountType",name:"discountType",value:v.discountType,onChange:w,label:(0,pe.__)("Discount Type","nggallery"),tooltipPlacement:"right"},ee().createElement("option",{value:"percentage"},(0,pe.__)("Percentage","nggallery")),ee().createElement("option",{value:"flat"},(0,pe.__)("Flat Amount","nggallery")))),ee().createElement("div",null,ee().createElement(uc,{type:"number",id:"discountValue",name:"discountValue",value:v.discountValue,onChange:w,label:(0,pe.__)("Discount Value","nggallery"),placeholder:(0,pe.__)("Enter Discount Amount","nggallery"),prefix:"percentage"===v.discountType?"%":h}),f.discountValue&&ee().createElement("p",{className:"mt-1 text-sm text-red-600"},f.discountValue)),ee().createElement("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3"},ee().createElement("div",null,ee().createElement(uc,{type:"date",id:"startDate",name:"startDate",value:v.startDate,onChange:w,label:(0,pe.__)("Start Date","nggallery"),placeholder:(0,pe.__)("Select Start Date","nggallery"),maxString:v.endDate||void 0})),ee().createElement("div",null,ee().createElement(uc,{type:"date",id:"endDate",name:"endDate",value:v.endDate,onChange:w,label:(0,pe.__)("End Date","nggallery"),placeholder:(0,pe.__)("Select End Date","nggallery"),minString:v.startDate||void 0}))),ee().createElement("div",null,ee().createElement(uc,{type:"number",id:"usageLimit",name:"usageLimit",value:v.usageLimit,onChange:w,label:(0,pe.__)("Usage Limit","nggallery"),help:(0,pe.__)("How many times this coupon may be used by users before it becomes invalid. An empty or 0 setting allows infinite uses.","nggallery"),tooltipPlacement:"right",placeholder:(0,pe.__)("Enter Usage Limit","nggallery")})),ee().createElement("div",{className:"flex justify-end space-x-3 pt-4"},ee().createElement("button",{type:"button",onClick:r,disabled:d,className:"px-4 py-2 text-sm font-medium text-green-700 bg-white border border-green-500 rounded-md shadow-sm hover:bg-green-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 disabled:opacity-50 disabled:cursor-not-allowed"},(0,pe.__)("Cancel","nggallery")),ee().createElement("button",{type:"submit",disabled:d,className:"px-4 py-2 text-sm font-semibold text-white bg-green-500 border border-transparent rounded-md shadow-sm hover:bg-green-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 disabled:opacity-50 disabled:cursor-not-allowed"},d?ee().createElement("span",{className:"flex items-center"},ee().createElement(kn,{className:"animate-spin -ml-1 mr-2 h-4 w-4 text-white"}),(0,pe.__)("Saving...","nggallery")):(0,pe.__)("SAVE","nggallery")))))},pricelistForm:function(e){var t=e.isOpen,r=e.onClose,a=e.onSuccess,o=$o(),l=o.showSuccess,i=o.showError,c=function(){var e,t=re();return gl({mutationFn:(e=No(Ei().m(function e(t){var n,r,a;return Ei().w(function(e){for(;;)switch(e.n){case 0:return r=null===(n=window.imagelyApp)||void 0===n?void 0:n.nonce,e.n=1,Oo()({path:"/imagely/v1/pricelists",method:"POST",headers:{"X-WP-Nonce":r},data:{title:t.title}});case 1:return a=e.v,e.a(2,Ni(a))}},e)})),function(t){return e.apply(this,arguments)}),onSuccess:function(){t.invalidateQueries({queryKey:["pricelists"]})}})}(),s=vo((0,$.useState)({}),2),u=s[0],m=s[1],d=vo((0,$.useState)({title:""}),2),g=d[0],p=d[1];(0,$.useEffect)(function(){t&&(p({title:""}),m({}))},[t]);var f=function(){var e={};return g.title.trim()||(e.title=(0,pe.__)("Pricelist name is required","nggallery")),m(e),0===Object.keys(e).length},y=function(){var e=No(pp().m(function e(t){var n,o;return pp().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t.preventDefault(),f()){e.n=1;break}return e.a(2);case 1:return e.p=1,e.n=2,c.mutateAsync({title:g.title.trim()});case 2:l((0,pe.__)("Pricelist created successfully","nggallery")),a&&a(),r(),e.n=4;break;case 3:e.p=3,o=e.v,console.error("Failed to create pricelist:",o),n=(0,pe.__)("Failed to create pricelist","nggallery"),o&&o.message&&(n=o.message),i(n);case 4:return e.a(2)}},e,null,[[1,3]])}));return function(t){return e.apply(this,arguments)}}(),h=c.isPending;return ee().createElement(Eo,{isOpen:t,onClose:r,title:(0,pe.__)("Add New Pricelist","nggallery")},ee().createElement("form",{onSubmit:y,className:"space-y-4"},ee().createElement("div",null,ee().createElement(uc,{type:"text",id:"title",name:"title",value:g.title,onChange:function(e){var t=e.target,r=t.name,a=t.value;p(function(e){return hp(hp({},e),{},n({},r,a))}),u[r]&&m(function(e){return hp(hp({},e),{},n({},r,""))})},label:(0,pe.__)("New Pricelist Name","nggallery"),placeholder:(0,pe.__)("For e.g. Wedding Album","nggallery")}),u.title&&ee().createElement("p",{className:"mt-1 text-sm text-red-600"},u.title)),ee().createElement("div",{className:"flex justify-end space-x-3 pt-4"},ee().createElement("button",{type:"button",onClick:r,disabled:h,className:"px-4 py-2 text-sm font-medium text-green-700 bg-white border border-green-500 rounded-md shadow-sm hover:bg-green-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 disabled:opacity-50 disabled:cursor-not-allowed"},(0,pe.__)("Cancel","nggallery")),ee().createElement("button",{type:"submit",disabled:h,className:"px-4 py-2 text-sm font-semibold text-white bg-green-500 border border-transparent rounded-md shadow-sm hover:bg-green-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 disabled:opacity-50 disabled:cursor-not-allowed"},h?ee().createElement("span",{className:"flex items-center"},ee().createElement(kn,{className:"animate-spin -ml-1 mr-2 h-4 w-4 text-white"}),(0,pe.__)("Creating...","nggallery")):(0,pe.__)("Create Pricelist","nggallery")))))},deletePricelists:function(e){var t=e.isOpen,n=e.onClose,r=e.pricelistIds,a=e.items,o=e.onConfirm,l=void 0===o?function(){}:o,i=e.title,c=function(){var e,t=re();return gl({mutationFn:(e=No(Ei().m(function e(t){var n,r,a,o;return Ei().w(function(e){for(;;)switch(e.p=e.n){case 0:return r=null===(n=window.imagelyApp)||void 0===n?void 0:n.nonce,e.p=1,e.n=2,Oo()({path:"/imagely/v1/pricelists/".concat(t),method:"DELETE",headers:{"X-WP-Nonce":r},parse:!1});case 2:e.n=5;break;case 3:if(e.p=3,404!==((null==(o=e.v)?void 0:o.status)||(null==o||null===(a=o.response)||void 0===a?void 0:a.status))){e.n=4;break}return e.a(2);case 4:throw o;case 5:return e.a(2)}},e,null,[[1,3]])})),function(t){return e.apply(this,arguments)}),onSettled:function(){t.invalidateQueries({queryKey:["pricelists"]})}})}(),s=$o(),u=s.showSuccess,m=s.showError,d=s.clearNotifications,g=(0,$.useMemo)(function(){return a&&a.length?a:r.map(function(e){return{id:e,title:(0,pe.__)("Pricelist","nggallery")}})},[r,a]),p=(0,$.useMemo)(function(){return g.length>0&&g.length<=5?ee().createElement("ul",{className:"list-none text-sm text-gray-700 px-4 text-center"},g.map(function(e){return ee().createElement("li",{key:e.id},e.title)})):null},[g]),f=function(){var e=No(Ic().m(function e(){var t;return Ic().w(function(e){for(;;)switch(e.p=e.n){case 0:if(0!==r.length){e.n=1;break}return e.a(2);case 1:return c.reset&&c.reset(),e.p=2,e.n=3,Promise.all(r.map(function(e){return c.mutateAsync(e)}));case 3:t=1===r.length?(0,pe.__)("pricelist","nggallery"):(0,pe.__)("pricelists","nggallery"),d(),u((0,pe.__)("Successfully deleted ".concat(r.length," ").concat(t),"nggallery")),l(),n(),e.n=5;break;case 4:e.p=4,e.v,d(),m((0,pe.__)("Failed to delete pricelist(s)","nggallery"));case 5:return e.a(2)}},e,null,[[2,4]])}));return function(){return e.apply(this,arguments)}}(),y=ee().createElement(rr,null);return ee().createElement(Eo,{isOpen:t,onClose:n},ee().createElement("div",{className:"space-y-4"},ee().createElement("div",{className:"flex items-center gap-2 justify-center"},ee().createElement("div",null,y)),i&&ee().createElement("h2",{className:"text-xl font-bold text-center text-gray-900 mt-2"},i),ee().createElement("p",{className:"text-sm text-gray-500 text-center"},1===r.length?(0,pe.__)("Are you sure you want to delete this pricelist?","nggallery"):(0,pe.__)("Are you sure you want to delete the selected pricelists?","nggallery")),p,ee().createElement("p",{className:"text-sm text-red-500 text-center"},(0,pe.__)("This action cannot be undone.","nggallery")),ee().createElement("div",{className:"flex justify-center space-x-3 !mb-4 ".concat(c.isPending?"cursor-wait":"")},ee().createElement("button",{type:"button",onClick:n,disabled:c.isPending,className:"px-8 py-2 font-medium text-white bg-green-500 rounded-lg shadow hover:bg-green-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"},(0,pe.__)("Cancel","nggallery")),ee().createElement("button",{type:"button",onClick:f,disabled:c.isPending,className:"px-8 py-2 font-bold text-white bg-red-600 border border-transparent rounded-lg shadow hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"},c.isPending?ee().createElement("span",{className:"flex items-center"},ee().createElement(kn,{className:"animate-spin -ml-1 mr-2 h-4 w-4 text-white"}),(0,pe.__)("Deleting...","nggallery")):(0,pe.__)("Delete","nggallery")))))},duplicatePricelist:function(e){var t=e.isOpen,n=e.onClose,r=e.pricelistIds,a=e.items,o=e.onConfirm,l=void 0===o?function(){}:o,i=e.title,c=function(){var e,t=re();return gl({mutationFn:(e=No(Ei().m(function e(t){var n,r,a;return Ei().w(function(e){for(;;)switch(e.n){case 0:return r=null===(n=window.imagelyApp)||void 0===n?void 0:n.nonce,e.n=1,Oo()({path:"/imagely/v1/pricelists/duplicate",method:"POST",headers:{"X-WP-Nonce":r},data:{ids:t}});case 1:return a=e.v,e.a(2,((null==a?void 0:a.pricelists)||[]).map(Ni))}},e)})),function(t){return e.apply(this,arguments)}),onSettled:function(){t.invalidateQueries({queryKey:["pricelists"]})}})}(),s=$o(),u=s.showSuccess,m=s.showError,d=s.clearNotifications,g=(0,$.useMemo)(function(){return a&&a.length?a:r.map(function(e){return{id:e,title:(0,pe.__)("Pricelist","nggallery")}})},[r,a]),p=(0,$.useMemo)(function(){return g.length>0&&g.length<=5?ee().createElement("ul",{className:"list-none text-sm text-gray-700 px-4 text-center"},g.map(function(e){return ee().createElement("li",{key:e.id},e.title)})):null},[g]),f=function(){var e=No(Gc().m(function e(){var t,a,o;return Gc().w(function(e){for(;;)switch(e.p=e.n){case 0:if(0!==r.length){e.n=1;break}return e.a(2);case 1:return c.reset&&c.reset(),e.p=2,e.n=3,c.mutateAsync(r);case 3:t=e.v,a=t.length,o=1===a?(0,pe.__)("pricelist","nggallery"):(0,pe.__)("pricelists","nggallery"),d(),a<r.length?m((0,pe.__)("Only ".concat(a," of ").concat(r.length," pricelists were duplicated"),"nggallery")):u((0,pe.__)("Successfully duplicated ".concat(a," ").concat(o),"nggallery")),l(),n(),e.n=5;break;case 4:e.p=4,e.v,d(),m((0,pe.__)("Failed to duplicate pricelist(s)","nggallery"));case 5:return e.a(2)}},e,null,[[2,4]])}));return function(){return e.apply(this,arguments)}}();return ee().createElement(Eo,{isOpen:t,onClose:n},ee().createElement("div",{className:"space-y-4"},ee().createElement("div",{className:"flex items-center gap-2 justify-center"},ee().createElement(yr,{className:"w-8 h-8"})),i&&ee().createElement("h2",{className:"text-xl font-bold text-center text-gray-900 mt-2"},i),ee().createElement("p",{className:"text-sm text-gray-500 text-center"},1===r.length?(0,pe.__)("Are you sure you want to duplicate this pricelist?","nggallery"):(0,pe.__)("Are you sure you want to duplicate the selected pricelists?","nggallery")),p,ee().createElement("div",{className:"flex justify-center space-x-3 !mb-4 ".concat(c.isPending?"cursor-wait":"")},ee().createElement("button",{type:"button",onClick:n,disabled:c.isPending,className:"px-8 py-2 font-medium text-white bg-green-500 rounded-lg shadow hover:bg-green-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"},(0,pe.__)("Cancel","nggallery")),ee().createElement("button",{type:"button",onClick:f,disabled:c.isPending,className:"px-8 py-2 font-bold text-white bg-blue-600 border border-transparent rounded-lg shadow hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"},c.isPending?ee().createElement("span",{className:"flex items-center"},ee().createElement(kn,{className:"animate-spin -ml-1 mr-2 h-4 w-4 text-white"}),(0,pe.__)("Duplicating...","nggallery")):(0,pe.__)("Duplicate","nggallery")))))},deletePricelistItem:function(e){var t=e.isOpen,n=e.onClose,r=e.itemTitle,a=e.onConfirm,o=e.isBulkDelete,l=void 0!==o&&o,i=e.bulkCount,c=void 0===i?1:i,s=ee().createElement(rr,null);return ee().createElement(Eo,{isOpen:t,onClose:n},ee().createElement("div",{className:"space-y-4"},ee().createElement("div",{className:"flex items-center gap-2 justify-center"},ee().createElement("div",null,s)),ee().createElement("h2",{className:"text-xl font-bold text-center text-gray-900 mt-2"},l?(0,pe.__)("Delete ".concat(c," Products"),"nggallery"):(0,pe.__)("Delete Product","nggallery")),ee().createElement("p",{className:"text-sm text-gray-500 text-center"},l?(0,pe.__)("Are you sure you want to delete these ".concat(c," products?"),"nggallery"):(0,pe.__)("Are you sure you want to delete this product?","nggallery")),ee().createElement("div",{className:"text-sm text-gray-700 px-4 text-center"},ee().createElement("strong",null,r)),ee().createElement("p",{className:"text-sm text-red-500 text-center"},(0,pe.__)("This action cannot be undone.","nggallery")),ee().createElement("div",{className:"flex justify-center space-x-3 !mb-4"},ee().createElement("button",{type:"button",onClick:n,className:"px-8 py-2 font-medium text-white bg-green-500 rounded-lg shadow hover:bg-green-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 transition-colors"},(0,pe.__)("Cancel","nggallery")),ee().createElement("button",{type:"button",onClick:function(){a(),n()},className:"px-8 py-2 font-bold text-white bg-red-600 border border-transparent rounded-lg shadow hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 transition-colors"},l?(0,pe.__)("Delete (".concat(c,")"),"nggallery"):(0,pe.__)("Delete","nggallery")))))},addProduct:function(e){var t=e.isOpen,n=e.onClose,r=e.pricelistId,a=e.existingItems,o=e.onSuccess,l=(0,ge.useDispatch)(Br),i=[{id:"whcc",title:(0,pe.__)("WHCC Prints","nggallery"),description:(0,pe.__)("Automatically fulfill orders via Printlab","nggallery"),icon:ee().createElement(Cr,{className:"w-12 h-12"})},{id:"manual",title:(0,pe.__)("Manual Sizes & Orders","nggallery"),description:(0,pe.__)("Manually fulfill customer orders","nggallery"),icon:ee().createElement(Nr,{className:"w-12 h-12"})},{id:"digital",title:(0,pe.__)("Digital Downloads","nggallery"),description:(0,pe.__)("Include print lab options in your Pricelist","nggallery"),icon:ee().createElement(kr,{className:"w-12 h-12"})}];return ee().createElement(Eo,{isOpen:t,onClose:n,title:(0,pe.__)("Add Product","nggallery")},ee().createElement("p",{className:"text-gray-600 text-sm mb-6"},(0,pe.__)("Select an option from the following to add pricelist","nggallery")),ee().createElement("div",{className:"space-y-4 mb-6"},i.map(function(e){return ee().createElement("div",{key:e.id,className:"flex items-center justify-between p-4 rounded-lg"},ee().createElement("div",{className:"flex items-center space-x-4"},ee().createElement("div",{className:"flex-shrink-0"},ee().createElement("div",{className:"w-12 h-12 flex items-center justify-center"},e.icon)),ee().createElement("div",null,ee().createElement("h4",{className:"text-sm font-medium text-gray-900"},e.title),ee().createElement("p",{className:"text-sm text-gray-500 mt-1"},e.description))),ee().createElement("div",{className:"flex-shrink-0"},ee().createElement("button",{type:"button",onClick:function(){return function(e){n();var t={pricelistId:r,existingItems:a,onBack:function(){l.setActiveModal("addProduct",{pricelistId:r,existingItems:a,onSuccess:o})},onSuccess:function(e){null==o||o(e)}};switch(e.id){case"whcc":l.setActiveModal("whccPrints",t);break;case"manual":l.setActiveModal("manualSizesOrders",t);break;case"digital":l.setActiveModal("digitalDownloads",t)}}(e)},className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500"},(0,pe.__)("Add Now","nggallery"))))})))},whccPrints:function(e){var r,a=e.isOpen,o=e.onClose,l=e.pricelistId,i=e.existingItems,c=void 0===i?{}:i,s=e.onBack,u=e.onSuccess,m=vo((0,$.useState)(""),2),d=m[0],g=m[1],p=vo((0,$.useState)(!0),2),f=p[0],y=p[1],h=vo((0,$.useState)({}),2),b=h[0],v=h[1],_=vo((0,$.useState)(null),2),w=_[0],x=_[1],E=vo((0,$.useState)(!1),2),C=E[0],N=E[1],k=sl({queryKey:["whcc-catalog",r],queryFn:function(){return Ip(r)},staleTime:9e5,refetchOnWindowFocus:!1,retry:3}),S=k.data,O=k.isLoading,P=k.error,j=function(){var e=re();return gl({mutationFn:Op,onSuccess:function(t,n){if(n.length>0){var r=n[0].pricelist_id;e.invalidateQueries({queryKey:["pricelist-items",r]}),e.invalidateQueries({queryKey:["pricelist-items"]})}}})}(),T=$o().showError,I=Zi(),A=(0,$.useMemo)(function(){if(!S||"object"!==t(S))return[];try{return Object.keys(S).filter(function(e){var t=S[e];return!e.toLowerCase().includes("digital")&&!t.label.toLowerCase().includes("digital")}).map(function(e){var t=S[e];return{id:e,label:(null==t?void 0:t.label)||e}})}catch(e){return console.error("Error creating tabs:",e),[]}},[S])||[];(0,$.useEffect)(function(){!(A&&A.length>0)||d&&null!=S&&S[d]||g(A[0].id)},[A,S]),(0,$.useEffect)(function(){a&&c&&v({})},[a,c]);var D=(0,$.useMemo)(function(){return S&&S[d]&&S[d].products||[]},[S,d]);(0,$.useEffect)(function(){if(d&&D.length>0&&!b[d]){var e=function(e){var t;if(!c||null==S||!S[e])return[];var n=null===(t=S[e])||void 0===t?void 0:t.ngg_id;return n?(c[n]||[]).filter(function(e){var t;return"ngg_whcc_pricelist"===e.source&&(null===(t=e.source_data)||void 0===t?void 0:t.product_id)}).map(function(e){return String(e.source_data.product_id)}):[]}(d);if(e.length>0){var t=e.filter(function(e){return D.some(function(t){return t.id===e})});if(t.length>0)return void v(function(e){return Fp(Fp({},e),{},n({},d,t))})}if(["prints","mounted_prints","canvas"].some(function(e){var t;return d.toLowerCase().includes(e)||(null==S||null===(t=S[d])||void 0===t||null===(t=t.label)||void 0===t?void 0:t.toLowerCase().includes(e))}))if(Object.keys(S||{}).every(function(e){var t,n=null==S||null===(t=S[e])||void 0===t?void 0:t.ngg_id;return!n||null==c||!c[n]||0===(c[n]||[]).length})){var r,a=(null===(r=D.filter(function(e){return e.is_default}))||void 0===r?void 0:r.map(function(e){return e.id}))||[];v(function(e){return Fp(Fp({},e),{},n({},d,a.length>0?a:[]))})}else v(function(e){return Fp(Fp({},e),{},n({},d,[]))});else v(function(e){return Fp(Fp({},e),{},n({},d,[]))})}},[d,D,b,c,S]);var L=function(){return Object.entries(b).filter(function(e){var t=vo(e,2);return t[0],t[1].length>0}).map(function(e){var t=vo(e,2);return{tabId:t[0],productIds:t[1]}})},F=function(){return Object.values(b).reduce(function(e,t){return e+t.length},0)},M=function(){return Object.keys(b).some(function(e){return e.toLowerCase().includes("canvas")&&b[e].length>0})},R=function(){var e=No(Ap().m(function e(){return Ap().w(function(e){for(;;)switch(e.n){case 0:if(0!==F()&&S){e.n=1;break}return e.a(2);case 1:if(!M()){e.n=2;break}return N(!0),e.a(2);case 2:return e.n=3,G();case 3:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}(),G=function(){var e=No(Ap().m(function e(){var t,n,r;return Ap().w(function(e){for(;;)switch(e.p=e.n){case 0:if(0!==F()&&S){e.n=1;break}return e.a(2);case 1:if(e.p=1,t=L(),n=t.flatMap(function(e){var t=e.tabId,n=e.productIds,r=null==S?void 0:S[t];return n.map(function(e){var n,a=null===(n=S[t])||void 0===n||null===(n=n.products)||void 0===n?void 0:n.find(function(t){return t.id===e});return a&&r?{pricelist_id:l,title:a.name,cost:a.estimated_raw||0,source:"ngg_whcc_pricelist",category:r.ngg_id,source_data:{product_id:a.id,lab_id:a.lab_id,catalog_id:a.catalog_id,category_id:a.category_id,options:a.options||{},lab_properties:a.lab_properties||{}},sortorder:0,resolution:""}:(console.warn("❌ Missing product or category for ".concat(e," in ").concat(t)),null)})}).filter(function(e){return null!==e}),0!==n.length){e.n=2;break}return T((0,pe.__)("No valid products selected. Please try again.","nggallery")),e.a(2);case 2:u&&u(n),o(),e.n=4;break;case 3:e.p=3,r=e.v,T((0,pe.__)("Failed to add products to pricelist","nggallery")),console.error("Error creating pricelist items:",r);case 4:return e.a(2)}},e,null,[[1,3]])}));return function(){return e.apply(this,arguments)}}(),B=b[d]||[],z=D.length>0&&B.length===D.length,U=B.length>0,q=function(e){x(function(t){return{key:e,direction:(null==t?void 0:t.key)===e&&"asc"===t.direction?"desc":"asc"}})},Q=(0,$.useMemo)(function(){if(!w)return D;var e=ko(D);return e.sort(function(e,t){var n,r;switch(w.key){case"name":n=e.name.toLowerCase(),r=t.name.toLowerCase();break;case"cost":n=e.cost_raw,r=t.cost_raw;break;case"estimatedCost":n=e.estimated_raw,r=t.estimated_raw;break;default:return 0}return"asc"===w.direction?n<r?-1:n>r?1:0:n>r?-1:n<r?1:0}),e},[D,w]);return(0,$.useEffect)(function(){var e=function(){y(window.innerWidth>=1280)};return e(),window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}},[]),(0,$.useEffect)(function(){var e=function(e){"Escape"===e.key&&a&&o()};return document.addEventListener("keydown",e),function(){return document.removeEventListener("keydown",e)}},[a,o]),a?A?O?ee().createElement("div",{className:"fixed inset-0 z-50 overflow-y-auto",role:"dialog","aria-modal":"true"},ee().createElement("div",{className:"fixed inset-0 bg-black bg-opacity-30 transition-opacity duration-300 ease-in-out",onClick:o}),ee().createElement("div",{className:"relative flex min-h-screen items-center justify-center p-4"},ee().createElement("div",{className:"relative transform overflow-hidden rounded-lg bg-white text-left shadow-2xl transition-all duration-300 ease-in-out",style:{width:"1100px",maxWidth:"90vw",marginLeft:f?"160px":"0"}},ee().createElement("div",{className:"p-8"},ee().createElement(oo,{size:"lg",color:"green",text:(0,pe.__)("Loading WHCC Catalog...","nggallery")}))))):P?ee().createElement("div",{className:"fixed inset-0 z-50 overflow-y-auto",role:"dialog","aria-modal":"true"},ee().createElement("div",{className:"fixed inset-0 bg-black bg-opacity-30 transition-opacity duration-300 ease-in-out",onClick:o}),ee().createElement("div",{className:"relative flex min-h-screen items-center justify-center p-4"},ee().createElement("div",{className:"relative transform overflow-hidden rounded-lg bg-white text-left shadow-2xl transition-all duration-300 ease-in-out",style:{width:"1100px",maxWidth:"90vw",marginLeft:f?"160px":"0"}},ee().createElement("div",{className:"p-8 text-center"},ee().createElement("div",{className:"text-red-500 mb-4"},ee().createElement(Rp,{className:"w-12 h-12 mx-auto"})),ee().createElement("h3",{className:"text-lg font-medium text-gray-900 mb-2"},(0,pe.__)("Failed to Load WHCC Catalog","nggallery")),ee().createElement("p",{className:"text-sm text-gray-500 mb-4"},(0,pe.__)("Unable to fetch the WHCC product catalog. Please try again later.","nggallery")),ee().createElement("button",{onClick:o,className:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md text-white bg-red-600 hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500"},(0,pe.__)("Close","nggallery")))))):A&&0!==A.length?ee().createElement(ee().Fragment,null,ee().createElement("div",{className:"fixed inset-0 z-50 overflow-y-auto",role:"dialog","aria-modal":"true"},ee().createElement("div",{className:"fixed inset-0 bg-black bg-opacity-30 transition-opacity duration-300 ease-in-out",onClick:o}),ee().createElement("div",{className:"relative flex min-h-screen items-center justify-center p-4"},ee().createElement("div",{className:"relative transform overflow-hidden rounded-lg bg-white text-left shadow-2xl transition-all duration-300 ease-in-out",style:{width:"1100px",maxWidth:"90vw",marginLeft:f?"160px":"0"}},ee().createElement("div",{className:"relative bg-white px-6 py-4 border-b border-gray-200"},ee().createElement("div",{className:"flex items-center justify-between"},ee().createElement("div",{className:"flex items-center space-x-3"},s&&ee().createElement("button",{onClick:s,className:"p-1 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-blue-500","aria-label":(0,pe.__)("Go back","nggallery")},ee().createElement(br,{className:"w-5 h-5"})),ee().createElement("h3",{className:"text-lg font-medium text-gray-900"},(0,pe.__)("WHCC Prints","nggallery"))),ee().createElement("button",{onClick:o,className:"rounded-md bg-white text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-blue-500","aria-label":(0,pe.__)("Close modal","nggallery")},ee().createElement(Rp,{className:"h-6 w-6"})))),ee().createElement("div",{className:"p-6"},ee().createElement("div",{className:"border-b border-gray-200 mb-6"},ee().createElement("nav",{className:"-mb-px flex overflow-x-auto"},A&&A.map(function(e){return ee().createElement("button",{key:e.id,onClick:function(){return g(e.id)},className:"py-3 px-3 border-b-2 font-medium text-sm text-center whitespace-nowrap flex-shrink-0 min-w-[120px] sm:flex-1 ".concat(d===e.id?"border-green-500 text-green-600 bg-green-50":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300 hover:bg-gray-50")},e.label)}))),ee().createElement("div",{className:"whcc-modal-scroll max-h-80 overflow-auto"},ee().createElement("table",{className:"min-w-full table-fixed"},ee().createElement("thead",{className:"bg-gray-50 sticky top-0"},ee().createElement("tr",null,ee().createElement("th",{className:"w-12 px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"},ee().createElement("input",{type:"checkbox",className:"rounded border-gray-300",checked:z,onChange:function(e){return t=e.target.checked,void v(function(e){return Fp(Fp({},e),{},n({},d,t?D.map(function(e){return e.id}):[]))});var t},ref:function(e){e&&(e.indeterminate=U&&!z)},"aria-label":(0,pe.__)("Select all products","nggallery")})),ee().createElement("th",{className:"w-[65%] px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider cursor-pointer hover:bg-gray-100",onClick:function(){return q("name")}},ee().createElement("div",{className:"flex items-center space-x-1"},ee().createElement("span",null,(0,pe.__)("Product","nggallery")),"name"===(null==w?void 0:w.key)&&ee().createElement("span",null,"asc"===w.direction?"↑":"↓"))),ee().createElement("th",{className:"w-[17.5%] px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider cursor-pointer hover:bg-gray-100",onClick:function(){return q("cost")}},ee().createElement("div",{className:"flex items-center space-x-1"},ee().createElement("span",null,(0,pe.__)("Cost","nggallery")),"cost"===(null==w?void 0:w.key)&&ee().createElement("span",null,"asc"===w.direction?"↑":"↓"))),ee().createElement("th",{className:"w-[17.5%] px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider cursor-pointer hover:bg-gray-100",onClick:function(){return q("estimatedCost")}},ee().createElement("div",{className:"flex items-center space-x-1"},ee().createElement("span",null,(0,pe.__)("Estimated Cost","nggallery")),"estimatedCost"===(null==w?void 0:w.key)&&ee().createElement("span",null,"asc"===w.direction?"↑":"↓"))))),ee().createElement("tbody",{className:"bg-white"},O?ee().createElement("tr",null,ee().createElement("td",{colSpan:4,className:"px-4 py-8"},ee().createElement(oo,{size:"md",color:"green",text:(0,pe.__)("Loading products...","nggallery")}))):0===Q.length?ee().createElement("tr",null,ee().createElement("td",{colSpan:4,className:"px-4 py-8 text-center text-gray-500"},(0,pe.__)("No products available for this category","nggallery"))):Q.map(function(e){return ee().createElement("tr",{key:e.id,className:"border-b hover:bg-gray-50"},ee().createElement("td",{className:"w-12 px-4 py-3"},ee().createElement("input",{type:"checkbox",className:"rounded border-gray-300",checked:B.includes(e.id),onChange:function(){return t=e.id,void v(function(e){var r=e[d]||[],a=r.includes(t)?r.filter(function(e){return e!==t}):[].concat(ko(r),[t]);return Fp(Fp({},e),{},n({},d,a))});var t},"aria-label":"Select ".concat(e.name)})),ee().createElement("td",{className:"w-[65%] px-4 py-3 text-sm text-gray-900"},e.name),ee().createElement("td",{className:"w-[17.5%] px-4 py-3 text-sm text-gray-900"},Mp(e.cost,e.cost_raw,"$")),ee().createElement("td",{className:"w-[17.5%] px-4 py-3 text-sm text-gray-900"},Mp(e.estimatedCost,e.estimated_raw,I)))}))))),ee().createElement("div",{className:"px-6 py-4 flex justify-end space-x-3"},ee().createElement("button",{onClick:o,disabled:j.isPending,className:"px-4 py-2 text-sm font-medium text-green-700 bg-white border border-green-600 rounded-md shadow-sm hover:bg-green-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 disabled:opacity-50 disabled:cursor-not-allowed"},(0,pe.__)("Cancel","nggallery")),ee().createElement("button",{onClick:R,disabled:0===F()||j.isPending,className:"px-4 py-2 text-sm font-semibold text-white bg-green-600 border border-transparent rounded-md shadow-sm hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 disabled:opacity-50 disabled:cursor-not-allowed"},j.isPending?ee().createElement("span",{className:"flex items-center"},ee().createElement(oo,{size:"sm",color:"gray",className:"mr-2 !border-white",centerInContainer:!1}),(0,pe.__)("Adding...","nggallery")):(0,pe.__)("Add Product","nggallery")))))),C&&ee().createElement("div",{className:"fixed inset-0 z-[60] overflow-y-auto"},ee().createElement("div",{className:"flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0"},ee().createElement("div",{className:"fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity","aria-hidden":"true"}),ee().createElement("span",{className:"hidden sm:inline-block sm:align-middle sm:h-screen","aria-hidden":"true"},""),ee().createElement("div",{className:"relative inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full"},ee().createElement("div",{className:"bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4"},ee().createElement("div",{className:"sm:flex sm:items-start"},ee().createElement("div",{className:"mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-yellow-100 sm:mx-0 sm:h-10 sm:w-10"},ee().createElement("svg",{className:"h-6 w-6 text-yellow-600",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true"},ee().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.732-.833-2.502 0L4.732 8.5C3.962 10.333 4.924 12 6.464 12H20.5"}))),ee().createElement("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left"},ee().createElement("h3",{className:"text-lg leading-6 font-medium text-gray-900",id:"modal-title"},(0,pe.__)("Canvas Product Warning","nggallery")),ee().createElement("div",{className:"mt-2"},ee().createElement("p",{className:"text-sm text-gray-500"},(0,pe.__)("You are adding a Canvas to a pricelist. Please be aware that when printing a Canvas, the edges of the photo (between 1 to 3 inches) will wrap around the side of the product.","nggallery")))))),ee().createElement("div",{className:"bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse"},ee().createElement("button",{type:"button",onClick:No(Ap().m(function e(){return Ap().w(function(e){for(;;)switch(e.n){case 0:return N(!1),e.n=1,G();case 1:return e.a(2)}},e)})),className:"w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-green-600 text-base font-medium text-white hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 sm:ml-3 sm:w-auto sm:text-sm"},(0,pe.__)("Continue","nggallery")),ee().createElement("button",{type:"button",onClick:function(){return N(!1)},className:"mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm"},(0,pe.__)("Cancel","nggallery"))))))):ee().createElement("div",{className:"fixed inset-0 z-50 overflow-y-auto",role:"dialog","aria-modal":"true"},ee().createElement("div",{className:"fixed inset-0 bg-black bg-opacity-30 transition-opacity duration-300 ease-in-out",onClick:o}),ee().createElement("div",{className:"relative flex min-h-screen items-center justify-center p-4"},ee().createElement("div",{className:"relative transform overflow-hidden rounded-lg bg-white text-left shadow-2xl transition-all duration-300 ease-in-out p-8"},ee().createElement("div",{className:"text-center"},ee().createElement("h3",{className:"text-lg font-medium text-gray-900 mb-2"},(0,pe.__)("No WHCC Products Available","nggallery")),ee().createElement("p",{className:"text-sm text-gray-500 mb-4"},(0,pe.__)("No WHCC product categories are currently available.","nggallery")),ee().createElement("button",{onClick:o,className:"inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"},(0,pe.__)("Close","nggallery")))))):(console.error("WHCCPrintsModal: tabs is undefined, returning early"),null):null},manualSizesOrders:function(e){var t=e.isOpen,r=e.onClose,a=e.pricelistId,o=e.onBack,l=e.onSuccess,i=vo((0,$.useState)({productName:"",price:"",category:"prints"}),2),c=i[0],s=i[1],u=vo((0,$.useState)(!1),2),m=u[0],d=u[1],g=vo((0,$.useState)({productName:"",price:""}),2),p=g[0],f=g[1],y=$o().showError,h=Zi(),b=function(e){return{prints:"ngg_category_prints",canvas:"ngg_category_canvas",mounted_prints:"ngg_category_mounted_prints",metal_prints:"metal_prints",acrylic_prints:"acrylic_prints",wood_prints:"wood_prints",bamboo_panels:"bamboo_panels"}[e]||e},v=[{value:"prints",label:(0,pe.__)("Prints","nggallery")},{value:"canvas",label:(0,pe.__)("Canvas","nggallery")},{value:"mounted_prints",label:(0,pe.__)("Mounted Prints","nggallery")},{value:"metal_prints",label:(0,pe.__)("Metal Prints","nggallery")},{value:"acrylic_prints",label:(0,pe.__)("Acrylic Prints","nggallery")},{value:"wood_prints",label:(0,pe.__)("Wood Prints","nggallery")},{value:"bamboo_panels",label:(0,pe.__)("Bamboo Panels","nggallery")}],_=function(e,t){switch(e){case"productName":return t.trim()?"":(0,pe.__)("Product name is required","nggallery");case"price":return t?parseFloat(t)<0?(0,pe.__)("Please enter a valid price","nggallery"):"":(0,pe.__)("Price is required","nggallery");default:return""}},w=function(e,t){s(function(r){return gp(gp({},r),{},n({},e,t))}),p[e]&&f(function(t){return gp(gp({},t),{},n({},e,""))})},x=function(){var e=No(up().m(function e(){var t,n;return up().w(function(e){for(;;)switch(e.n){case 0:if(t={productName:_("productName",c.productName),price:_("price",c.price)},f(t),!Object.values(t).some(function(e){return e})){e.n=1;break}return e.a(2);case 1:d(!0);try{n={id:-1e6*Math.random(),pricelist_id:a,title:c.productName,cost:0,price:parseFloat(c.price),source:"ngg_manual_pricelist",category:b(c.category),sortorder:0,source_data:{manual_entry:!0,created_at:(new Date).toISOString(),catalog_id:null,product_id:null}},l&&l([n]),r()}catch(e){y((0,pe.__)("Failed to add product to pricelist","nggallery")),console.error("Error creating manual pricelist item:",e)}finally{d(!1)}case 2:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}();return ee().createElement("div",{className:"relative"},ee().createElement(Eo,{isOpen:t,onClose:function(){}},ee().createElement("div",{className:"absolute top-0 left-0 right-0 z-10 bg-white border-b"},ee().createElement("div",{className:"flex items-center justify-between p-4"},ee().createElement("div",{className:"flex items-center gap-3"},ee().createElement("button",{onClick:function(){null==o||o()},className:"flex items-center text-gray-600 hover:text-gray-800"},ee().createElement(br,{className:"w-4 h-4"})),ee().createElement("h2",{className:"text-lg font-medium text-gray-900"},(0,pe.__)("Manual Sizes & Orders","nggallery"))),ee().createElement("button",{onClick:r,className:"text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-green-500 focus:ring-offset-2","aria-label":"Close modal"},ee().createElement("svg",{className:"h-6 w-6",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},ee().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"}))))),ee().createElement("div",{className:"p-4"},ee().createElement("div",{className:"space-y-6"},ee().createElement("div",null,ee().createElement("label",{className:"block text-sm font-medium text-gray-700 mb-1"},(0,pe.__)("New Product Name","nggallery")),ee().createElement("input",{type:"text",value:c.productName,onChange:function(e){return w("productName",e.target.value)},placeholder:(0,pe.__)('8x10" Canvas or 4x6" Glossy',"nggallery"),className:"w-full px-3 py-2 border rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ".concat(p.productName?"border-red-300 focus:ring-red-500 focus:border-red-500":"border-gray-300")}),p.productName&&ee().createElement("p",{className:"mt-1 text-sm text-red-600"},p.productName)),ee().createElement("div",null,ee().createElement("label",{className:"block text-sm font-medium text-gray-700 mb-1"},(0,pe.__)("Price","nggallery")),ee().createElement("div",{className:"relative"},ee().createElement("span",{className:"absolute ".concat(ec(h)," top-1/2 transform -translate-y-1/2 text-gray-500 text-sm")},h),ee().createElement("input",{type:"number",min:"0",step:"1",value:c.price,onChange:function(e){return w("price",e.target.value)},onBlur:function(){if(c.price){var e=parseFloat(c.price);isNaN(e)||s(function(t){return gp(gp({},t),{},{price:e.toFixed(2)})})}},placeholder:(0,pe.__)("0.00","nggallery"),className:"w-full ".concat($i(h).left," ").concat($i(h).right," py-2 border rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ").concat(p.price?"border-red-300 focus:ring-red-500 focus:border-red-500":"border-gray-300")})),p.price&&ee().createElement("p",{className:"mt-1 text-sm text-red-600"},p.price)),ee().createElement("div",{className:"w-full"},ee().createElement("label",{className:"block text-sm font-medium text-gray-700 mb-1"},(0,pe.__)("Category","nggallery")),ee().createElement("div",{className:"w-full"},ee().createElement("select",{value:c.category,onChange:function(e){return w("category",e.target.value)},className:"w-full block px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",style:{width:"100%",minWidth:"100%",maxWidth:"100%"}},v.map(function(e){return ee().createElement("option",{key:e.value,value:e.value},e.label)})))),ee().createElement("div",{className:"flex items-center justify-end gap-3 mt-8"},ee().createElement("button",{type:"button",onClick:r,className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500"},(0,pe.__)("Cancel","nggallery")),ee().createElement("button",{type:"button",onClick:x,disabled:m,className:"px-4 py-2 text-sm font-medium text-white bg-green-500 border border-transparent rounded-md shadow-sm hover:bg-green-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 disabled:opacity-50 disabled:cursor-not-allowed"},m?(0,pe.__)("Adding...","nggallery"):(0,pe.__)("Add Product","nggallery")))))))},digitalDownloads:function(e){var t=e.isOpen,r=e.onClose,a=e.pricelistId,o=e.onBack,l=e.onSuccess,i=vo((0,$.useState)({productName:"",price:"",maxDimension:""}),2),c=i[0],s=i[1],u=vo((0,$.useState)(!1),2),m=u[0],d=u[1],g=vo((0,$.useState)({productName:"",price:"",maxDimension:""}),2),p=g[0],f=g[1],y=$o().showError,h=Zi(),b=function(e,t){switch(e){case"productName":return t.trim()?"":(0,pe.__)("Product name is required","nggallery");case"price":return t?parseFloat(t)<0?(0,pe.__)("Please enter a valid price","nggallery"):"":(0,pe.__)("Price is required","nggallery");case"maxDimension":return t&&(isNaN(parseInt(t))||parseInt(t)<0)?(0,pe.__)("Please enter a valid maximum dimension","nggallery"):"";default:return""}},v=function(e,t){s(function(r){return Rc(Rc({},r),{},n({},e,t))}),p[e]&&f(function(t){return Rc(Rc({},t),{},n({},e,""))})},_=function(){var e=No(Lc().m(function e(){var t,n,o;return Lc().w(function(e){for(;;)switch(e.n){case 0:if(t={productName:b("productName",c.productName),price:b("price",c.price),maxDimension:b("maxDimension",c.maxDimension)},f(t),!Object.values(t).some(function(e){return e})){e.n=1;break}return e.a(2);case 1:n=c.maxDimension?parseInt(c.maxDimension):0,d(!0);try{o={id:-1e6*Math.random(),pricelist_id:a,title:c.productName,cost:0,price:parseFloat(c.price),source:"ngg_digital_downloads",category:"ngg_category_digital_downloads",resolution:n,sortorder:0,source_data:{resolution_type:"custom",max_dimension:n,digital_download:!0,catalog_id:null,product_id:null}},l&&l([o]),r()}catch(e){y((0,pe.__)("Failed to add digital download product to pricelist","nggallery")),console.error("Error creating digital download pricelist item:",e)}finally{d(!1)}case 2:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}();return ee().createElement("div",{className:"relative"},ee().createElement(Eo,{isOpen:t,onClose:function(){}},ee().createElement("div",{className:"absolute top-0 left-0 right-0 z-10 bg-white border-b"},ee().createElement("div",{className:"flex items-center justify-between p-4"},ee().createElement("div",{className:"flex items-center gap-3"},ee().createElement("button",{onClick:function(){null==o||o()},className:"flex items-center text-gray-600 hover:text-gray-800"},ee().createElement(br,{className:"w-4 h-4"})),ee().createElement("h2",{className:"text-lg font-medium text-gray-900"},(0,pe.__)("Digital Downloads","nggallery"))),ee().createElement("button",{onClick:r,className:"text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-green-500 focus:ring-offset-2","aria-label":"Close modal"},ee().createElement("svg",{className:"h-6 w-6",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},ee().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"}))))),ee().createElement("div",{className:"p-4"},ee().createElement("div",{className:"space-y-6"},ee().createElement("div",null,ee().createElement("label",{className:"block text-sm font-medium text-gray-700 mb-1"},(0,pe.__)("New Product Name","nggallery")),ee().createElement("input",{type:"text",value:c.productName,onChange:function(e){return v("productName",e.target.value)},placeholder:(0,pe.__)("Low, Medium, or High Resolution","nggallery"),className:"w-full px-3 py-2 border rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ".concat(p.productName?"border-red-300 focus:ring-red-500 focus:border-red-500":"border-gray-300")}),p.productName&&ee().createElement("p",{className:"mt-1 text-sm text-red-600"},p.productName)),ee().createElement("div",null,ee().createElement("label",{className:"block text-sm font-medium text-gray-700 mb-1"},(0,pe.__)("Price","nggallery")),ee().createElement("div",{className:"relative"},ee().createElement("span",{className:"absolute ".concat(ec(h)," top-1/2 transform -translate-y-1/2 text-gray-500 text-sm")},h),ee().createElement("input",{type:"number",min:"0",step:"1",value:c.price,onChange:function(e){return v("price",e.target.value)},onBlur:function(){if(c.price){var e=parseFloat(c.price);isNaN(e)||s(function(t){return Rc(Rc({},t),{},{price:e.toFixed(2)})})}},placeholder:(0,pe.__)("0.00","nggallery"),className:"w-full ".concat($i(h).left," ").concat($i(h).right," py-2 border rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ").concat(p.price?"border-red-300 focus:ring-red-500 focus:border-red-500":"border-gray-300")})),p.price&&ee().createElement("p",{className:"mt-1 text-sm text-red-600"},p.price)),ee().createElement("div",null,ee().createElement("label",{className:"block text-sm font-medium text-gray-700 mb-1"},(0,pe.__)("Longest Image Dimension","nggallery")),ee().createElement("div",{className:"relative"},ee().createElement("input",{type:"number",min:"0",value:c.maxDimension,onChange:function(e){return v("maxDimension",e.target.value)},placeholder:(0,pe.__)("Enter 0 for maximum","nggallery"),className:"w-full pl-3 pr-8 py-2 border rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ".concat(p.maxDimension?"border-red-300 focus:ring-red-500 focus:border-red-500":"border-gray-300")}),ee().createElement("span",{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500 text-sm"},"px")),p.maxDimension&&ee().createElement("p",{className:"mt-1 text-sm text-red-600"},p.maxDimension)),ee().createElement("div",{className:"flex items-center justify-end gap-3 mt-8"},ee().createElement("button",{type:"button",onClick:r,className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500"},(0,pe.__)("Cancel","nggallery")),ee().createElement("button",{type:"button",onClick:_,disabled:m,className:"px-4 py-2 text-sm font-medium text-white bg-green-500 border border-transparent rounded-md shadow-sm hover:bg-green-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 disabled:opacity-50 disabled:cursor-not-allowed"},m?(0,pe.__)("Adding...","nggallery"):(0,pe.__)("Add Product","nggallery")))))))},bulkMarkup:function(e){var t=e.isOpen,r=e.onClose,a=e.pricelistId,o=e.currentSettings,l=e.onSuccess,i=vo((0,$.useState)({markupPercent:300,rounding:"zero"}),2),c=i[0],s=i[1],u=Oi(a).data;(0,$.useEffect)(function(){if(t){var e=o||(null==u?void 0:u.settings),n=(null==e?void 0:e.bulk_markup_amount)||300,r=(null==e?void 0:e.bulk_markup_rounding)||"zero";s({markupPercent:Number(n),rounding:r})}},[t,o,u]);var m=function(e,t){s(function(r){return Ti(Ti({},r),{},n({},e,t))})};return ee().createElement(Eo,{isOpen:t,onClose:r,title:(0,pe.__)("Apply Markup to All Products","nggallery")},ee().createElement("form",{onSubmit:function(e){e.preventDefault();var t="string"==typeof c.markupPercent?parseInt(c.markupPercent):c.markupPercent;!a||isNaN(t)||t<0||""===c.markupPercent||(null==l||l({markupPercent:t,rounding:c.rounding}),r())},className:"space-y-4"},ee().createElement("div",null,ee().createElement("label",{htmlFor:"markup-percent",className:"block text-sm font-medium text-gray-700 mb-1"},(0,pe.__)("Markup Percent","nggallery")),ee().createElement("input",{id:"markup-percent",type:"number",min:"0",max:"10000",step:"1",value:c.markupPercent,onChange:function(e){return m("markupPercent",""===e.target.value?"":parseInt(e.target.value)||0)},className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",placeholder:"400",required:!0})),ee().createElement("div",null,ee().createElement("label",{htmlFor:"rounding",className:"block text-sm font-medium text-gray-700 mb-1"},(0,pe.__)("Round prices up to","nggallery")),ee().createElement("select",{id:"rounding",value:c.rounding,onChange:function(e){return m("rounding",e.target.value)},className:"w-full block px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",style:{width:"100%",minWidth:"100%",maxWidth:"100%"}},[{value:"zero",label:".00"},{value:"cent",label:".99"},{value:"none",label:"No Rounding"}].map(function(e){return ee().createElement("option",{key:e.value,value:e.value},e.label)}))),ee().createElement("div",{className:"flex items-center justify-end gap-3 mt-8"},ee().createElement("button",{type:"button",onClick:r,className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500"},(0,pe.__)("Cancel","nggallery")),ee().createElement("button",{type:"submit",disabled:""===c.markupPercent||"number"==typeof c.markupPercent&&c.markupPercent<0,className:"px-4 py-2 text-sm font-medium text-white bg-green-500 border border-transparent rounded-md shadow-sm hover:bg-green-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 disabled:opacity-50 disabled:cursor-not-allowed"},(0,pe.__)("Apply to All","nggallery")))))}};const Bp=function(){var e=(0,ge.useDispatch)(Br),t=(0,ge.useSelect)(function(e){return e(Br).getActiveModal()},[]);if(!t)return null;var n=t.type,r=t.props,a=Gp[n];if(!a)return null;var o=null==r?void 0:r.onClose;return ee().createElement(a,fe({},r,{isOpen:!0,onClose:function(){if(o?o():e.setActiveModal(null),"imageUploader"===n)try{var t,r,a=document.querySelector("#toplevel_page_imagely");if(!a)return;var l=a.querySelector('ul.wp-submenu-wrap li a[href*="create_gallery=1"].current');if(!l)return;l.classList.remove("current"),null===(t=l.parentElement)||void 0===t||t.classList.remove("current");var i=a.querySelector('ul.wp-submenu-wrap li a[href*="page=imagely"]:not([href*="create_gallery"])');null==i||i.classList.add("current"),null==i||null===(r=i.parentElement)||void 0===r||r.classList.add("current")}catch(e){}}}))},zp=function(e){var t,n,r,a,o=e.notification,l=e.onDismiss,i=e.showDismissButton,c=void 0===i||i;return ee().createElement("div",{className:"p-3 sm:p-4 hover:bg-gray-50"},ee().createElement("div",{className:"flex items-start space-x-2 sm:space-x-3"},ee().createElement("div",{className:"flex-shrink-0 mt-1 text-gray-400"},function(e){switch(e){case"info":return ee().createElement(dn,{className:"w-5 h-5"});case"percent":return ee().createElement(gn,{className:"w-5 h-5"});case"check":return ee().createElement(pn,{className:"w-5 h-5"});default:return ee().createElement(fn,{className:"w-5 h-5"})}}(o.icon)),ee().createElement("div",{className:"flex-1 min-w-0"},ee().createElement("h4",{className:"text-xs sm:text-sm font-medium text-gray-900 mb-1"},o.title),ee().createElement("p",{className:"text-xs sm:text-sm text-gray-700 mb-2 sm:mb-3"},(r=o.content,(a=document.createElement("div")).innerHTML=r,a.textContent||a.innerText||"")),ee().createElement("div",{className:"flex flex-col sm:flex-row sm:items-center space-y-2 sm:space-y-0 sm:space-x-3"},ee().createElement("div",{className:"flex flex-wrap gap-2"},(null===(t=o.btns)||void 0===t?void 0:t.main)&&ee().createElement("a",{href:o.btns.main.url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center px-2 sm:px-3 py-1 border border-transparent text-xs font-medium rounded text-white bg-black hover:bg-gray-800 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500"},o.btns.main.text),(null===(n=o.btns)||void 0===n?void 0:n.alt)&&ee().createElement("a",{href:o.btns.alt.url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center px-2 sm:px-3 py-1 border border-gray-300 text-xs font-medium rounded text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500"},o.btns.alt.text)),c&&ee().createElement("button",{onClick:function(){l(o.id)},className:"text-xs text-gray-500 hover:text-gray-700 self-start sm:self-center"},(0,pe.__)("Dismiss","nggallery"))))))},Up=function(){var e=(0,ge.useDispatch)(),t=vo((0,$.useState)(!1),2),n=t[0],r=t[1],a=(0,ge.useSelect)(function(e){var t,n,r=e(Br).getInboxState();return{isOpen:(null==r?void 0:r.isOpen)||!1,activeNotifications:(null==r?void 0:r.active)||[],dismissedNotifications:(null==r?void 0:r.dismissed)||[],activeCounts:(null==r||null===(t=r.counts)||void 0===t?void 0:t.active)||0,dismissedCounts:(null==r||null===(n=r.counts)||void 0===n?void 0:n.dismissed)||0,loading:(null==r?void 0:r.loading)||!1,error:(null==r?void 0:r.error)||null}},[]),o=a.isOpen,l=a.activeNotifications,i=a.dismissedNotifications,c=a.activeCounts,s=a.dismissedCounts,u=a.loading,m=a.error;(0,$.useEffect)(function(){var e,t;e=c,(t=document.querySelector(".ngg-menu-notification-indicator"))&&(e>0?(t.textContent=e.toString(),t.style.display=""):t.style.display="none")},[c]);var d=function(){e(Br).closeInboxPanel()},g=function(t){e(Br).dismissInboxNotification(t)};if(ee().useEffect(function(){var e=function(e){"Escape"===e.key&&o&&d()};if(o)return document.addEventListener("keydown",e),function(){return document.removeEventListener("keydown",e)}},[o]),!o)return null;var p=n?i:l,f=n?s:c;return ee().createElement(ee().Fragment,null,ee().createElement("div",{className:"fixed inset-0 bg-black bg-opacity-30 z-40",onClick:function(e){e.target===e.currentTarget&&d()}}),ee().createElement("div",{className:"fixed top-10 md:top-6 right-0 bottom-0 w-full max-w-xs sm:w-80 md:w-96 lg:w-[28rem] xl:w-[32rem] 2xl:w-[36rem] bg-white shadow-lg border-l border-gray-200 z-50 flex flex-col"},ee().createElement("div",{className:"bg-gray-100 border-b border-gray-200 p-3 sm:p-4 flex items-start sm:items-center justify-between"},ee().createElement("div",{className:"flex-1 min-w-0 pr-2"},n?ee().createElement("h3",{className:"text-sm sm:text-base md:text-lg font-semibold text-gray-900 truncate"},(0,pe.__)("Notifications","nggallery")," (",f,")"):ee().createElement("h3",{className:"text-sm sm:text-base md:text-lg font-semibold text-gray-900 truncate"},(0,pe.__)("New Notifications","nggallery")," (",f,")"),ee().createElement("button",{onClick:function(){r(!n)},className:"text-xs sm:text-sm text-blue-600 hover:text-blue-700 mt-1 block"},n?(0,pe.__)("Active Notifications","nggallery"):(0,pe.__)("Dismissed Notifications","nggallery"))),ee().createElement("button",{onClick:d,className:"p-1 sm:p-2 hover:bg-gray-200 rounded-full flex-shrink-0","aria-label":(0,pe.__)("Close notifications","nggallery")},ee().createElement(on,{className:"w-5 h-5 sm:w-6 sm:h-6"}))),ee().createElement("div",{className:"flex-1 overflow-y-auto"},u?ee().createElement("div",{className:"flex items-center justify-center h-32"},ee().createElement("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900"})):m?ee().createElement("div",{className:"p-3 sm:p-4 text-red-600 text-sm sm:text-base"},(0,pe.__)("Error loading notifications:","nggallery")," ",m):0===p.length?ee().createElement("div",{className:"p-3 sm:p-4 text-gray-500 text-center text-sm sm:text-base"},n?(0,pe.__)("No dismissed notifications","nggallery"):(0,pe.__)("No new notifications","nggallery")):ee().createElement("div",{className:"divide-y divide-gray-200"},p.map(function(e){return ee().createElement(zp,{key:e.id,notification:e,onDismiss:g,showDismissButton:!n})}))),!n&&c>0&&ee().createElement("div",{className:"border-t border-gray-200 p-3 sm:p-4"},ee().createElement("button",{onClick:function(){e(Br).dismissAllInboxNotifications()},className:"text-blue-600 hover:text-blue-700 text-xs sm:text-sm font-medium"},(0,pe.__)("Dismiss all","nggallery")))))};function qp(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return Qp(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Qp(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Qp(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,Qp(m,"constructor",s),Qp(s,"constructor",c),c.displayName="GeneratorFunction",Qp(s,a,"GeneratorFunction"),Qp(m),Qp(m,a,"Generator"),Qp(m,r,function(){return this}),Qp(m,"toString",function(){return"[object Generator]"}),(qp=function(){return{w:o,m:d}})()}function Qp(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}Qp=function(e,t,n,r){function o(t,n){Qp(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Qp(e,t,n,r)}const Wp=function(){var e,t=$o(),n=t.showSuccess,r=t.showError,a=vo((0,$.useState)({}),2),o=a[0],l=a[1],i=vo((0,$.useState)(!0),2),c=i[0],s=i[1],u=vo((0,$.useState)(new Set),2),m=u[0],d=u[1],g=[{name:(0,pe.__)("OptinMonster","nggallery"),description:(0,pe.__)("Instantly grow your email list with powerful exit-intent technology. Convert abandoning visitors into subscribers and customers.","nggallery"),icon:"plugin-om.png",url:"https://optinmonster.com/?utm_source=imagelylite&utm_medium=link&utm_campaign=About%20Imagely",basename:"optinmonster/optin-monster-wp-api.php",downloadUrl:"https://downloads.wordpress.org/plugin/optinmonster.zip"},{name:(0,pe.__)("MonsterInsights","nggallery"),description:(0,pe.__)("The leading WordPress analytics plugin that shows you how people find and use your website, so you can make data driven decisions to grow your business. Properly set up Google Analytics without writing code.","nggallery"),icon:"plugin-mi.png",url:"https://monsterinsights.com/?utm_source=imagelylite&utm_medium=link&utm_campaign=About%20Imagely",basename:"google-analytics-for-wordpress/googleanalytics.php",downloadUrl:"https://downloads.wordpress.org/plugin/google-analytics-for-wordpress.zip"},{name:(0,pe.__)("WP Mail SMTP","nggallery"),description:(0,pe.__)("Improve your WordPress email deliverability and make sure that your website emails reach user's inbox with the #1 SMTP plugin for WordPress. Over 3 million websites use it to fix WordPress email issues.","nggallery"),icon:"plugin-smtp.png",url:"https://wpmailsmtp.com/?utm_source=imagelylite&utm_medium=link&utm_campaign=About%20Imagely",basename:"wp-mail-smtp/wp_mail_smtp.php",downloadUrl:"https://downloads.wordpress.org/plugin/wp-mail-smtp.zip"},{name:(0,pe.__)("AIOSEO","nggallery"),description:(0,pe.__)("The original WordPress SEO plugin and toolkit that improves your website's search rankings. Comes with all the SEO features like Local SEO, WooCommerce SEO, sitemaps, SEO optimizer, schema, and more.","nggallery"),icon:"plugin-aioseo.png",url:"https://aioseo.com/?utm_source=imagelylite&utm_medium=link&utm_campaign=About%20Imagely",basename:"all-in-one-seo-pack/all_in_one_seo_pack.php",downloadUrl:"https://downloads.wordpress.org/plugin/all-in-one-seo-pack.zip"},{name:(0,pe.__)("SeedProd","nggallery"),description:(0,pe.__)("The fastest drag & drop landing page builder for WordPress. Create custom landing pages without writing code, connect them with your CRM, collect subscribers, and grow your audience. Trusted by 1 million sites.","nggallery"),icon:"plugin-seedprod.png",url:"https://www.seedprod.com/?utm_source=imagelylite&utm_medium=link&utm_campaign=About%20Imagely",basename:"coming-soon/coming-soon.php",downloadUrl:"https://downloads.wordpress.org/plugin/coming-soon.zip"},{name:(0,pe.__)("RafflePress","nggallery"),description:(0,pe.__)("Turn your website visitors into brand ambassadors! Easily grow your email list, website traffic, and social media followers with the most powerful giveaways & contests plugin for WordPress.","nggallery"),icon:"plugin-rp.png",url:"https://rafflepress.com/?utm_source=imagelylite&utm_medium=link&utm_campaign=About%20Imagely",basename:"rafflepress/rafflepress.php",downloadUrl:"https://downloads.wordpress.org/plugin/rafflepress.zip"},{name:(0,pe.__)("PushEngage","nggallery"),description:(0,pe.__)("Connect with your visitors after they leave your website with the leading web push notification software. Over 10,000+ businesses worldwide use PushEngage to send 15 billion notifications each month.","nggallery"),icon:"plugin-pushengage.png",url:"https://pushengage.com/?utm_source=imagelylite&utm_medium=link&utm_campaign=About%20Imagely",basename:"pushengage/main.php",downloadUrl:"https://downloads.wordpress.org/plugin/pushengage.zip"},{name:(0,pe.__)("Smash Balloon","nggallery"),description:(0,pe.__)("Easily display social media content from Instagram, Facebook, YouTube, Twitter, and more on your WordPress site without writing any code. Trusted by 1 million websites.","nggallery"),icon:"plugin-sb-instagram.png",url:"https://smashballoon.com/?utm_source=imagelylite&utm_medium=link&utm_campaign=About%20Imagely",basename:"instagram-feed/instagram-feed.php",downloadUrl:"https://downloads.wordpress.org/plugin/instagram-feed.zip"},{name:(0,pe.__)("TrustPulse","nggallery"),description:(0,pe.__)("Boost your sales and conversions by up to 15% with real-time social proof notifications. TrustPulse helps you show live user activity and purchases to help convince other users to purchase.","nggallery"),icon:"plugin-trustpulse.png",url:"https://trustpulse.com/?utm_source=imagelylite&utm_medium=link&utm_campaign=About%20Imagely",basename:"trustpulse-api/trustpulse.php",downloadUrl:"https://downloads.wordpress.org/plugin/trustpulse-api.zip"},{name:(0,pe.__)("SearchWP","nggallery"),description:(0,pe.__)("The most advanced WordPress search plugin. Customize your WordPress search algorithm, reorder search results, track search metrics, and everything you need to leverage search to grow your business.","nggallery"),icon:"plugin-searchwp.png",url:"https://searchwp.com/?utm_source=imagelylite&utm_medium=link&utm_campaign=About%20Imagely",isExternal:!0},{name:(0,pe.__)("AffiliateWP","nggallery"),description:(0,pe.__)("The #1 affiliate management plugin for WordPress. Easily create an affiliate program for your eCommerce store or membership site within minutes and start growing your sales with the power of referral marketing.","nggallery"),icon:"plugin-affwp.png",url:"https://affiliatewp.com/?utm_source=imagelylite&utm_medium=link&utm_campaign=About%20Imagely",isExternal:!0},{name:(0,pe.__)("WP Simple Pay","nggallery"),description:(0,pe.__)("The #1 Stripe payments plugin for WordPress. Start accepting one-time and recurring payments on your WordPress site without setting up a shopping cart. No code required.","nggallery"),icon:"plugin-wp-simple-pay.png",url:"https://wpsimplepay.com/?utm_source=imagelylite&utm_medium=link&utm_campaign=About%20Imagely",basename:"stripe/stripe-checkout.php",downloadUrl:"https://downloads.wordpress.org/plugin/stripe.zip"},{name:(0,pe.__)("Easy Digital Downloads","nggallery"),description:(0,pe.__)("The best WordPress eCommerce plugin for selling digital downloads. Start selling eBooks, software, music, digital art, and more within minutes. Accept payments, manage subscriptions, advanced access control, and more.","nggallery"),icon:"plugin-edd.png",url:"https://easydigitaldownloads.com/?utm_source=imagelylite&utm_medium=link&utm_campaign=About%20Imagely",basename:"easy-digital-downloads/easy-digital-downloads.php",downloadUrl:"https://downloads.wordpress.org/plugin/easy-digital-downloads.zip"},{name:(0,pe.__)("Sugar Calendar","nggallery"),description:(0,pe.__)("A simple & powerful event calendar plugin for WordPress that comes with all the event management features including payments, scheduling, timezones, ticketing, recurring events, and more.","nggallery"),icon:"plugin-sugarcalendar.png",url:"https://sugarcalendar.com/?utm_source=imagelylite&utm_medium=link&utm_campaign=About%20Imagely",basename:"sugar-calendar-lite/sugar-calendar-lite.php",downloadUrl:"https://downloads.wordpress.org/plugin/sugar-calendar-lite.zip"},{name:(0,pe.__)("WP Charitable","nggallery"),description:(0,pe.__)("Top-rated WordPress donation and fundraising plugin. Over 10,000+ non-profit organizations and website owners use Charitable to create fundraising campaigns and raise more money online.","nggallery"),icon:"plugin-charitable.png",url:"https://wpcharitable.com/?utm_source=imagelylite&utm_medium=link&utm_campaign=About%20Imagely",basename:"charitable/charitable.php",downloadUrl:"https://downloads.wordpress.org/plugin/charitable.zip"},{name:(0,pe.__)("WPCode","nggallery"),description:(0,pe.__)("Future proof your WordPress customizations with the most popular code snippet management plugin for WordPress. Trusted by over 1,500,000+ websites for easily adding code to WordPress right from the admin area.","nggallery"),icon:"plugin-wpcode.png",url:"https://wpcode.com/?utm_source=imagelylite&utm_medium=link&utm_campaign=About%20Imagely",basename:"insert-headers-and-footers/ihaf.php",downloadUrl:"https://downloads.wordpress.org/plugin/insert-headers-and-footers.zip"},{name:(0,pe.__)("Duplicator","nggallery"),description:(0,pe.__)("Leading WordPress backup & site migration plugin. Over 1,500,000+ smart website owners use Duplicator to make reliable and secure WordPress backups to protect their websites. It also makes website migration really easy.","nggallery"),icon:"plugin-duplicator.png",url:"https://duplicator.com/?utm_source=imagelylite&utm_medium=link&utm_campaign=About%20Imagely",basename:"duplicator/duplicator.php",downloadUrl:"https://downloads.wordpress.org/plugin/duplicator.zip"},{name:(0,pe.__)("Soliloquy","nggallery"),description:(0,pe.__)("The best WordPress slider plugin. Drag & Drop responsive slider builder that helps you create a beautiful image slideshows with just a few clicks.","nggallery"),icon:"soliloquy.png",url:"https://soliloquywp.com/?utm_source=imagelylite&utm_medium=link&utm_campaign=About%20Imagely",basename:"soliloquy-lite/soliloquy-lite.php",downloadUrl:"https://downloads.wordpress.org/plugin/soliloquy-lite.zip"}];(0,$.useEffect)(function(){p()},[]);var p=function(){var e=No(qp().m(function e(){var t,n;return qp().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,s(!0),e.n=1,Oo()({path:"/imagely/v1/plugins/status"});case 1:t=e.v,l(t),e.n=3;break;case 2:e.p=2,n=e.v,console.error("Error fetching plugin statuses:",n);case 3:return e.p=3,s(!1),e.f(3);case 4:return e.a(2)}},e,null,[[0,2,3,4]])}));return function(){return e.apply(this,arguments)}}(),f=function(){var e=No(qp().m(function e(t){var a,o,l,i;return qp().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t.downloadUrl&&t.basename){e.n=1;break}return e.a(2);case 1:return a=t.basename,d(function(e){return new Set(e).add(a)}),e.p=2,e.n=3,Oo()({path:"/imagely/v1/plugins/install",method:"POST",data:{download_url:t.downloadUrl,basename:t.basename}});case 3:return e.n=4,p();case 4:n((0,pe.__)("Plugin installed successfully!","nggallery")),e.n=6;break;case 5:e.p=5,i=e.v,o=(0,pe.__)("Unknown error","nggallery"),i.message?o=i.message:i.code?o=i.code:"string"==typeof i&&(o=i),r((0,pe.__)("Failed to install plugin: ","nggallery")+o);case 6:return e.p=6,(l=t.basename)&&d(function(e){var t=new Set(e);return t.delete(l),t}),e.f(6);case 7:return e.a(2)}},e,null,[[2,5,6,7]])}));return function(t){return e.apply(this,arguments)}}(),y=function(){var e=No(qp().m(function e(t){var a,o,l;return qp().w(function(e){for(;;)switch(e.p=e.n){case 0:if(a=t.basename){e.n=1;break}return e.a(2);case 1:return d(function(e){return new Set(e).add(a)}),e.p=2,e.n=3,Oo()({path:"/imagely/v1/plugins/activate",method:"POST",data:{basename:a}});case 3:return e.n=4,p();case 4:n((0,pe.__)("Plugin activated successfully!","nggallery")),e.n=6;break;case 5:e.p=5,l=e.v,o=l.message||(0,pe.__)("Unknown error","nggallery"),r((0,pe.__)("Failed to activate plugin: ","nggallery")+o);case 6:return e.p=6,d(function(e){var t=new Set(e);return t.delete(a),t}),e.f(6);case 7:return e.a(2)}},e,null,[[2,5,6,7]])}));return function(t){return e.apply(this,arguments)}}(),h=function(){var e=No(qp().m(function e(t){var a,o,l;return qp().w(function(e){for(;;)switch(e.p=e.n){case 0:if(a=t.basename){e.n=1;break}return e.a(2);case 1:return d(function(e){return new Set(e).add(a)}),e.p=2,e.n=3,Oo()({path:"/imagely/v1/plugins/deactivate",method:"POST",data:{basename:a}});case 3:return e.n=4,p();case 4:n((0,pe.__)("Plugin deactivated successfully!","nggallery")),e.n=6;break;case 5:e.p=5,l=e.v,o=l.message||(0,pe.__)("Unknown error","nggallery"),r((0,pe.__)("Failed to deactivate plugin: ","nggallery")+o);case 6:return e.p=6,a&&d(function(e){var t=new Set(e);return t.delete(a),t}),e.f(6);case 7:return e.a(2)}},e,null,[[2,5,6,7]])}));return function(t){return e.apply(this,arguments)}}(),b=function(e){return!e.basename||e.isExternal?null:o[e.basename]};return ee().createElement("div",{className:"max-w-7xl mx-auto"},ee().createElement("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden mb-6"},ee().createElement("div",{className:"grid md:grid-cols-2 gap-8 p-8"},ee().createElement("div",{className:"space-y-4"},ee().createElement("h1",{className:"text-3xl font-bold text-gray-900"},(0,pe.__)("About NextGEN Gallery","nggallery")),ee().createElement("h3",{className:"text-xl text-gray-700"},(0,pe.__)("Hello and welcome to NextGEN Gallery, the most beginner-friendly WordPress Gallery Plugin. At NextGEN Gallery, we build software that helps you create beautiful galleries in minutes.","nggallery")),ee().createElement("p",{className:"text-gray-600"},(0,pe.__)("Over the years, we found that most WordPress gallery plugins were bloated, buggy, slow, and very hard to use. So, we started with a simple goal: build a WordPress gallery system that's both easy and powerful.","nggallery")),ee().createElement("p",{className:"text-gray-600"},(0,pe.__)("Our goal is to provide the easiest way to create beautiful galleries.","nggallery")),ee().createElement("p",{className:"text-gray-600"},(0,pe.__)("NextGEN Gallery is brought to you by the same team that's behind the largest WordPress resource site, WPBeginner, the most popular lead-generation software, OptinMonster, the best WordPress analytics plugin, MonsterInsights, and more!","nggallery")),ee().createElement("p",{className:"text-gray-600 font-medium"},(0,pe.__)("Yup, we know a thing or two about building awesome products that customers love.","nggallery"))),ee().createElement("div",{className:"flex items-center justify-center"},ee().createElement("img",{src:"".concat(null===(e=window.imagelyApp)||void 0===e?void 0:e.plugin_url,"assets/images/about/team.jpg"),alt:(0,pe.__)("Team","nggallery"),className:"rounded-lg shadow-md w-full max-w-md"})))),ee().createElement("div",{className:"mb-6"},ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6"},g.map(function(e,t){var n;return ee().createElement("div",{key:t,className:"bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden hover:shadow-md transition-shadow"},ee().createElement("div",{className:"p-6"},ee().createElement("div",{className:"flex items-start space-x-4 mb-4"},ee().createElement("img",{src:"".concat(null===(n=window.imagelyApp)||void 0===n?void 0:n.plugin_url,"assets/images/about/").concat(e.icon),alt:e.name,className:"w-16 h-16 rounded-lg flex-shrink-0"}),ee().createElement("div",{className:"flex-1 min-w-0"},ee().createElement("h3",{className:"text-lg font-semibold text-gray-900 mb-2"},e.name),function(e){var t=b(e);return!t||e.isExternal?null:t.active?ee().createElement("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800"},(0,pe.__)("Active","nggallery")):t.installed?ee().createElement("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-yellow-100 text-yellow-800"},(0,pe.__)("Inactive","nggallery")):ee().createElement("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-800"},(0,pe.__)("Not Installed","nggallery"))}(e))),ee().createElement("p",{className:"text-sm text-gray-600 mb-4 line-clamp-4"},e.description),ee().createElement("div",{className:"flex gap-2"},function(e){var t=b(e),n=function(e){return!!e.basename&&m.has(e.basename)}(e);return e.isExternal||!e.basename?ee().createElement("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"inline-block px-4 py-2 bg-green-600 text-white text-sm font-medium rounded-md hover:bg-green-700 transition-colors"},(0,pe.__)("Learn More","nggallery")):c?ee().createElement("button",{disabled:!0,className:"inline-block px-4 py-2 bg-gray-300 text-gray-500 text-sm font-medium rounded-md cursor-not-allowed"},(0,pe.__)("Loading...","nggallery")):null!=t&&t.active?ee().createElement("button",{onClick:function(){return h(e)},disabled:n,className:"inline-block px-4 py-2 text-sm font-medium rounded-md transition-colors ".concat(n?"bg-gray-300 text-gray-500 cursor-not-allowed":"bg-gray-600 text-white hover:bg-gray-700")},n?(0,pe.__)("Processing...","nggallery"):(0,pe.__)("Deactivate","nggallery")):null!=t&&t.installed?ee().createElement("button",{onClick:function(){return y(e)},disabled:n,className:"inline-block px-4 py-2 text-sm font-medium rounded-md transition-colors ".concat(n?"bg-gray-300 text-gray-500 cursor-not-allowed":"bg-green-600 text-white hover:bg-green-700")},n?(0,pe.__)("Processing...","nggallery"):(0,pe.__)("Activate","nggallery")):ee().createElement("button",{onClick:function(){return f(e)},disabled:n,className:"inline-block px-4 py-2 text-sm font-medium rounded-md transition-colors ".concat(n?"bg-gray-300 text-gray-500 cursor-not-allowed":"bg-green-600 text-white hover:bg-green-700")},n?(0,pe.__)("Installing...","nggallery"):(0,pe.__)("Install Plugin","nggallery"))}(e))))}))))};var Hp=function(){return[{id:"images",label:(0,pe.__)("Images","nggallery"),icon:ee().createElement(er,{className:"h-5 w-5"}),description:(0,pe.__)("Add, Edit, Remove","nggallery")},{id:"customize",label:(0,pe.__)("Customize","nggallery"),icon:ee().createElement(tr,{className:"h-5 w-5"}),description:(0,pe.__)("Layout & Settings","nggallery")},{id:"settings",label:(0,pe.__)("Settings","nggallery"),icon:ee().createElement(nr,{className:"h-5 w-5"}),description:(0,pe.__)("Review & Configure","nggallery")}]},Vp=function(){return[{id:"photocrati-nextgen_basic_imagebrowser",name:(0,pe.__)("ImageBrowser","nggallery"),icon:ee().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-full h-full",viewBox:"0 0 120 98",fill:"currentColor"},ee().createElement("rect",{x:"10",y:"12",width:"100",height:"52",fill:"currentColor"}),ee().createElement("circle",{cx:"55",cy:"75",r:"3",fill:"currentColor"}),ee().createElement("circle",{cx:"65",cy:"75",r:"3",fill:"currentColor"}),ee().createElement("rect",{x:"40",y:"83",width:"40",height:"3",rx:"1.5",fill:"currentColor"})),isPro:!1},{id:"photocrati-nextgen_basic_tagcloud",name:(0,pe.__)("TagCloud","nggallery"),icon:ee().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-full h-full",viewBox:"0 0 120 98",fill:"currentColor"},ee().createElement("rect",{x:"17",y:"16",width:"31",height:"6",rx:"2",fill:"currentColor"}),ee().createElement("rect",{x:"85",y:"10",width:"15",height:"6",rx:"2",fill:"currentColor"}),ee().createElement("rect",{x:"54",y:"25",width:"25",height:"6",rx:"2",fill:"currentColor"}),ee().createElement("rect",{x:"87",y:"31",width:"25",height:"6",rx:"2",fill:"currentColor"}),ee().createElement("rect",{x:"64",y:"53",width:"30",height:"6",rx:"2",fill:"currentColor"}),ee().createElement("rect",{x:"8",y:"60",width:"18",height:"6",rx:"2",fill:"currentColor"}),ee().createElement("rect",{x:"37",y:"69",width:"38",height:"6",rx:"2",fill:"currentColor"}),ee().createElement("rect",{x:"91",y:"67",width:"18",height:"6",rx:"2",fill:"currentColor"}),ee().createElement("rect",{x:"16",y:"82",width:"32",height:"6",rx:"2",fill:"currentColor"}),ee().createElement("rect",{x:"14",y:"41",width:"53",height:"6",rx:"2",fill:"currentColor"})),isPro:!1},{id:"photocrati-nextgen_basic_thumbnails",name:(0,pe.__)("Thumbnails","nggallery"),icon:ee().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-full h-full",viewBox:"0 0 120 98"},ee().createElement("rect",{x:"8",y:"12",width:"32",height:"22",fill:"currentColor"}),ee().createElement("rect",{x:"44",y:"12",width:"32",height:"22",fill:"currentColor"}),ee().createElement("rect",{x:"80",y:"12",width:"32",height:"22",fill:"currentColor"}),ee().createElement("rect",{x:"8",y:"38",width:"32",height:"22",fill:"currentColor"}),ee().createElement("rect",{x:"44",y:"38",width:"32",height:"22",fill:"currentColor"}),ee().createElement("rect",{x:"80",y:"38",width:"32",height:"22",fill:"currentColor"}),ee().createElement("rect",{x:"8",y:"64",width:"32",height:"22",fill:"currentColor"}),ee().createElement("rect",{x:"44",y:"64",width:"32",height:"22",fill:"currentColor"}),ee().createElement("rect",{x:"80",y:"64",width:"32",height:"22",fill:"currentColor"})),isPro:!1},{id:"photocrati-nextgen_basic_slideshow",name:(0,pe.__)("Slideshow","nggallery"),icon:ee().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-full h-full",viewBox:"0 0 120 98",fill:"currentColor"},ee().createElement("rect",{x:"8",y:"18",width:"104",height:"62",fill:"currentColor"}),ee().createElement("path",{d:"M55.0034 61V37L71.0034 48.3333L55.0034 61Z",fill:"white",fillOpacity:"0.5"})),isPro:!1},{id:"photocrati-nextgen_pro_film",name:(0,pe.__)("Film","nggallery"),icon:ee().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-full h-full",viewBox:"0 0 120 98",fill:"currentColor"},ee().createElement("rect",{x:"8",y:"12",width:"32",height:"22",fill:"currentColor"}),ee().createElement("rect",{x:"44",y:"12",width:"32",height:"22",fill:"currentColor"}),ee().createElement("rect",{x:"80",y:"12",width:"32",height:"22",fill:"currentColor"}),ee().createElement("rect",{x:"8",y:"38",width:"32",height:"22",fill:"currentColor"}),ee().createElement("rect",{x:"44",y:"38",width:"32",height:"22",fill:"currentColor"}),ee().createElement("rect",{x:"80",y:"38",width:"32",height:"22",fill:"currentColor"}),ee().createElement("rect",{x:"8",y:"64",width:"32",height:"22",fill:"currentColor"}),ee().createElement("rect",{x:"44",y:"64",width:"32",height:"22",fill:"currentColor"}),ee().createElement("rect",{x:"80",y:"64",width:"32",height:"22",fill:"currentColor"}),ee().createElement("rect",{x:"15",y:"14",width:"18",height:"18",fill:"white",fillOpacity:"0.5"}),ee().createElement("rect",{x:"51",y:"40",width:"18",height:"18",fill:"white",fillOpacity:"0.5"}),ee().createElement("rect",{x:"15",y:"66",width:"18",height:"18",fill:"white",fillOpacity:"0.5"}),ee().createElement("rect",{x:"87",y:"66",width:"18",height:"18",fill:"white",fillOpacity:"0.5"}),ee().createElement("rect",{x:"10",y:"42",width:"28",height:"14",fill:"white",fillOpacity:"0.5"}),ee().createElement("rect",{x:"82",y:"42",width:"28",height:"14",fill:"white",fillOpacity:"0.5"}),ee().createElement("rect",{x:"46",y:"68",width:"28",height:"14",fill:"white",fillOpacity:"0.5"}),ee().createElement("rect",{x:"87",y:"14",width:"18",height:"18",fill:"white",fillOpacity:"0.5"}),ee().createElement("rect",{x:"46",y:"16",width:"28",height:"14",fill:"white",fillOpacity:"0.5"})),isPro:!0},{id:"photocrati-nextgen_pro_mosaic",name:(0,pe.__)("Mosaic","nggallery"),icon:ee().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-full h-full",viewBox:"0 0 120 98",fill:"currentColor"},ee().createElement("rect",{x:"8",y:"12",width:"64",height:"16",fill:"currentColor"}),ee().createElement("rect",{x:"74",y:"12",width:"38",height:"16",fill:"currentColor"}),ee().createElement("rect",{x:"8",y:"30",width:"36",height:"16",fill:"currentColor"}),ee().createElement("rect",{x:"46",y:"30",width:"66",height:"16",fill:"currentColor"}),ee().createElement("rect",{x:"8",y:"48",width:"50",height:"16",fill:"currentColor"}),ee().createElement("rect",{x:"8",y:"66",width:"38",height:"20",fill:"currentColor"}),ee().createElement("rect",{x:"48",y:"66",width:"18",height:"20",fill:"currentColor"}),ee().createElement("rect",{x:"60",y:"48",width:"20",height:"16",fill:"currentColor"}),ee().createElement("rect",{x:"82",y:"48",width:"30",height:"16",fill:"currentColor"}),ee().createElement("rect",{x:"68",y:"66",width:"44",height:"20",fill:"currentColor"})),isPro:!0},{id:"photocrati-nextgen_pro_thumbnail_grid",name:(0,pe.__)("Thumbnail Grid","nggallery"),icon:ee().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-full h-full",viewBox:"0 0 120 98",fill:"currentColor"},ee().createElement("rect",{x:"8",y:"12",width:"32",height:"22",fill:"currentColor"}),ee().createElement("rect",{x:"44",y:"12",width:"32",height:"22",fill:"currentColor"}),ee().createElement("rect",{x:"80",y:"12",width:"32",height:"22",fill:"currentColor"}),ee().createElement("rect",{x:"8",y:"38",width:"32",height:"22",fill:"currentColor"}),ee().createElement("rect",{x:"44",y:"38",width:"32",height:"22",fill:"currentColor"}),ee().createElement("rect",{x:"80",y:"38",width:"32",height:"22",fill:"currentColor"}),ee().createElement("rect",{x:"8",y:"64",width:"32",height:"22",fill:"currentColor"}),ee().createElement("rect",{x:"44",y:"64",width:"32",height:"22",fill:"currentColor"}),ee().createElement("rect",{x:"80",y:"64",width:"32",height:"22",fill:"currentColor"})),isPro:!0},{id:"photocrati-nextgen_pro_blog_gallery",name:(0,pe.__)("Blog Style","nggallery"),icon:ee().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-full h-full",viewBox:"0 0 120 98",fill:"currentColor"},ee().createElement("rect",{x:"8",y:"12",width:"104",height:"52",fill:"currentColor"}),ee().createElement("rect",{x:"8",y:"68",width:"104",height:"18",fill:"currentColor"})),isPro:!0},{id:"photocrati-nextgen_pro_imagebrowser",name:(0,pe.__)("Pro ImageBrowser","nggallery"),icon:ee().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-full h-full",viewBox:"0 0 120 98",fill:"currentColor"},ee().createElement("rect",{x:"10",y:"12",width:"100",height:"52",fill:"currentColor"}),ee().createElement("circle",{cx:"55",cy:"75",r:"3",fill:"currentColor"}),ee().createElement("circle",{cx:"65",cy:"75",r:"3",fill:"currentColor"}),ee().createElement("rect",{x:"40",y:"83",width:"40",height:"3",rx:"1.5",fill:"currentColor"})),isPro:!0},{id:"photocrati-nextgen_pro_sidescroll",name:(0,pe.__)("Sidescroll","nggallery"),icon:ee().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-full h-full",viewBox:"0 0 120 98",fill:"currentColor"},ee().createElement("rect",{x:"8",y:"12",width:"104",height:"60",fill:"currentColor"}),ee().createElement("rect",{x:"8",y:"78",width:"104",height:"8",fill:"currentColor"})),isPro:!0},{id:"photocrati-nextgen_pro_tile",name:(0,pe.__)("Tile","nggallery"),icon:ee().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-full h-full",viewBox:"0 0 120 98",fill:"currentColor"},ee().createElement("rect",{x:"8",y:"10",width:"33",height:"13",fill:"currentColor"}),ee().createElement("rect",{x:"44",y:"10",width:"30",height:"8",fill:"currentColor"}),ee().createElement("rect",{x:"8",y:"27",width:"33",height:"13",fill:"currentColor"}),ee().createElement("rect",{x:"8",y:"44",width:"33",height:"44",fill:"currentColor"}),ee().createElement("rect",{x:"44",y:"22",width:"30",height:"26",fill:"currentColor"}),ee().createElement("rect",{x:"77",y:"10",width:"35",height:"38",fill:"currentColor"}),ee().createElement("rect",{x:"44",y:"72",width:"30",height:"16",fill:"currentColor"}),ee().createElement("rect",{x:"77",y:"72",width:"35",height:"16",fill:"currentColor"}),ee().createElement("rect",{x:"44",y:"52",width:"68",height:"16",fill:"currentColor"})),isPro:!0},{id:"photocrati-nextgen_pro_masonry",name:(0,pe.__)("Masonry","nggallery"),icon:ee().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-full h-full",viewBox:"0 0 120 98",fill:"currentColor"},ee().createElement("rect",{x:"8",y:"12",width:"32",height:"31",fill:"currentColor"}),ee().createElement("rect",{x:"44",y:"12",width:"32",height:"15",fill:"currentColor"}),ee().createElement("rect",{x:"8",y:"47",width:"32",height:"24",fill:"currentColor"}),ee().createElement("rect",{x:"80",y:"12",width:"32",height:"34",fill:"currentColor"}),ee().createElement("rect",{x:"44",y:"52",width:"32",height:"26",fill:"currentColor"}),ee().createElement("rect",{x:"44",y:"31",width:"32",height:"17",fill:"currentColor"}),ee().createElement("rect",{x:"80",y:"72",width:"32",height:"14",fill:"currentColor"}),ee().createElement("rect",{x:"80",y:"50",width:"32",height:"18",fill:"currentColor"})),isPro:!0},{id:"imagely-pro-search",name:(0,pe.__)("Search","nggallery"),icon:ee().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-full h-full",viewBox:"0 0 120 98",fill:"currentColor"},ee().createElement("rect",{x:"16",y:"44",width:"60",height:"10",fill:"currentColor"}),ee().createElement("rect",{x:"82",y:"44",width:"22",height:"10",fill:"currentColor"})),isPro:!0},{id:"photocrati-nextgen_pro_horizontal_filmstrip",name:(0,pe.__)("Horizontal Filmstrip","nggallery"),icon:ee().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-full h-full",viewBox:"0 0 120 98",fill:"currentColor"},ee().createElement("rect",{x:"8",y:"12",width:"104",height:"60",fill:"currentColor"}),ee().createElement("rect",{x:"8",y:"78",width:"104",height:"8",fill:"currentColor"})),isPro:!0},{id:"photocrati-nextgen_pro_slideshow",name:(0,pe.__)("Pro Slideshow","nggallery"),icon:ee().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-full h-full",viewBox:"0 0 120 98",fill:"currentColor"},ee().createElement("rect",{x:"8",y:"18",width:"104",height:"62",fill:"currentColor"}),ee().createElement("path",{d:"M55.0034 61V37L71.0034 48.3333L55.0034 61Z",fill:"white",fillOpacity:"0.5"})),isPro:!0}]};const Kp=function(e){var t=e.activeTab,n=e.onTabChange,r=Hp(),a=function(e){return r.findIndex(function(t){return t.id===e})};return React.createElement("div",{className:"px-4 sm:px-6 lg:px-8"},React.createElement("div",{className:"flex flex-col sm:flex-row w-full h-auto sm:h-[70px] relative rounded-lg border border-gray-200 overflow-hidden"},r.map(function(e,o){var l,i=(l=e.id,t===l),c=function(e){var n=a(t);return a(e)<n}(e.id),s=o===r.length-1,u=String(o+1).padStart(2,"0");return React.createElement("div",{key:e.id,className:"relative flex-1",style:{zIndex:r.length-o}},React.createElement("button",{onClick:function(){return n(e.id)},className:"mobile-step-button relative w-full h-full flex items-center px-4 sm:px-6 lg:px-8 py-4 sm:py-5 transition-all duration-300 border-b sm:border-b-0 sm:border-r border-gray-100 last:border-b-0 sm:last:border-r-0 ".concat(i?"text-green-800 bg-green-100":c?"text-gray-700 hover:text-green-700 bg-gray-50":"text-gray-500 hover:text-gray-700 bg-white hover:bg-gray-50"),style:{clipPath:s?"polygon(0 0, 100% 0, 100% 100%, 0 100%, 12px 50%)":0===o?"polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%)":"polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%, 12px 50%)",marginLeft:0===o?"":"-".concat(11*o,"px"),width:s?"calc( 100% + ".concat(11*o*2,"px )"):""}},React.createElement("div",{className:"flex items-center space-x-2 sm:space-x-3 w-full"},React.createElement("div",{className:"w-6 h-6 sm:w-8 sm:h-8 rounded-full flex items-center justify-center text-xs sm:text-sm font-bold transition-all duration-300 flex-shrink-0 ".concat(i?"bg-white text-green-700 border border-green-700":"text-gray-400 border border-gray-200")},c&&!i?React.createElement(an,{className:"w-3 h-3 sm:w-4 sm:h-4"}):u),React.createElement("div",{className:"flex flex-col items-start min-w-0 flex-1"},React.createElement("div",{className:"text-xs sm:text-sm font-semibold truncate w-full text-left"},e.label),React.createElement("div",{className:"text-xs opacity-75 text-left"},e.description)))))})))},Xp=function(e){var t=e.children,n=e.currentTab,r=e.onTabChange,a=e.error,o=e.isLoading,l=void 0!==o&&o,i=e.containerClassName,c=e.contentClassName,s=e.hideHeader,u=void 0!==s&&s,m=e.headerComponent,d=function(){if(m){if("function"==typeof m&&0===m.length)return m();var e=m;return ee().createElement(e,{activeTab:n,onTabChange:r})}return ee().createElement(Kp,{activeTab:n,onTabChange:r})};return l?ee().createElement("div",{className:ao("min-h-screen",i)},!u&&d(),ee().createElement("div",{className:ao("mx-auto max-w-screen-2xl p-6",c)},ee().createElement("div",{className:"flex items-center justify-center py-8"},ee().createElement("div",{className:"text-gray-500"},(0,pe.__)("Loading...","nggallery"))))):ee().createElement("div",{className:ao("min-h-screen",i)},d(),ee().createElement("div",{className:ao("mx-auto max-w-screen-2xl p-6",c)},a&&ee().createElement("div",{className:"mb-6 bg-red-50 border border-red-200 rounded-md p-4"},ee().createElement("div",{className:"flex"},ee().createElement("div",{className:"flex-shrink-0"},ee().createElement(yn,{className:"h-5 w-5 text-red-400"})),ee().createElement("div",{className:"ml-3"},ee().createElement("h3",{className:"text-sm font-medium text-red-800"},(0,pe.__)("Error","nggallery")),ee().createElement("div",{className:"mt-2 text-sm text-red-700"},ee().createElement("p",null,a))))),t))};var Yp=function(){var e;return"lite"!==((null===(e=window.imagelyApp)||void 0===e?void 0:e.proTypeInstalled)||"lite")},Zp=function(){var e,t=null===(e=window.imagelyApp)||void 0===e?void 0:e.licenseData;return!!t&&!0===t.is_valid},Jp=function(){return!Yp()||Zp()},$p=function(){return!Yp()||Zp()};const ef=function(e){var t=e.onNext,n=e.onCancel,r=e.nextButtonText,a=void 0===r?(0,pe.__)("Next step","nggallery"):r,o=e.showNextButton,l=void 0===o||o,i=e.showCancelButton,c=void 0===i||i,s=e.isFirstTab,u=void 0===s||s,m=e.isNextDisabled,d=void 0!==m&&m,g=Kl(),p=(null==g?void 0:g.isEmbed)||!1,f=vo((0,$.useState)(160),2),y=f[0],h=f[1];return(0,$.useEffect)(function(){if(!p){var e=function(){var e=document.body,t=window.innerWidth;t<=782?h(0):t<=960||e.classList.contains("folded")?h(36):h(160)};e(),window.addEventListener("resize",e);var t=new MutationObserver(e);return t.observe(document.body,{attributes:!0,attributeFilter:["class"]}),function(){window.removeEventListener("resize",e),t.disconnect()}}h(0)},[p]),ee().createElement("div",{className:"fixed bottom-0 right-0 bg-white border-t border-gray-200 z-10",style:{left:"".concat(y,"px"),maxWidth:"calc(100vw - ".concat(y,"px)")}},ee().createElement("div",{className:"px-2 sm:px-4 py-3 sm:px-6"},ee().createElement("div",{className:"flex justify-end items-center space-x-1 sm:space-x-3"},c&&ee().createElement("button",{onClick:n,className:"px-2 sm:px-4 py-2 text-xs sm:text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"},u?(0,pe.__)("Cancel","nggallery"):(0,pe.__)("Back","nggallery")),l&&ee().createElement("button",{onClick:t,disabled:d,className:"px-2 sm:px-4 py-2 text-xs sm:text-sm font-medium text-white bg-green-500 border border-green-500 rounded-md hover:bg-green-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-green-500"},a))))},tf=function(e){var t=e.onCreateNewGallery;return ee().createElement("div",{className:"bg-white rounded-lg shadow p-8 text-center"},ee().createElement("div",{className:"space-y-4"},ee().createElement("button",{onClick:t,className:"px-6 py-3 bg-green-500 text-white rounded-lg hover:bg-green-600 transition-colors inline-flex items-center"},ee().createElement("span",{className:"mr-2"},"+"),(0,pe.__)("Create New Gallery","nggallery"))))},nf=function(e){var t=e.title,n=e.children,r=e.className;return ee().createElement("div",{className:ao("bg-white rounded-lg",r)},ee().createElement("div",{className:"w-full py-3 px-4"},ee().createElement("h3",{className:"text-base font-medium text-gray-900"},t)),ee().createElement("div",{className:"px-4 pb-4"},ee().createElement("div",{className:"pt-4"},n)))},rf=window.wp.element;var af=function(e){var t=e.type,n=e.item,r=e.itemId,a=e.includeEcommerce,o=void 0!==a&&a,l=e.cacheKey;return(0,rf.useMemo)(function(){var e,a,i,c;if(!n)return(null===(c=window.imagelyApp)||void 0===c?void 0:c.home_url)||window.location.origin;var s=new URLSearchParams;if(s.append("ngg-preview","1"),s.append("nonce_preview",(null===(e=window.imagelyApp)||void 0===e?void 0:e.nonce_preview)||""),n.display_type&&s.append("display_type",n.display_type),"gallery"===t?(n.gid&&s.append("gallery_ids",String(n.gid)),o&&("1"===n.is_ecommerce_enabled||1===n.is_ecommerce_enabled||!0===n.is_ecommerce_enabled)&&s.append("is_ecommerce_enabled","1")):"album"===t&&(s.append("src","albums"),r&&s.append("ids",String(r)),l&&s.append("_cache",l)),n.display_type&&null!==(a=n.display_type_settings)&&void 0!==a&&a[n.display_type]){var u=n.display_type_settings[n.display_type];Object.entries(u).forEach(function(e){var t=vo(e,2),n=t[0],r=t[1];if(null!=r){var a="boolean"==typeof r?r?"1":"0":String(r);s.append(n,a)}})}var m=(null===(i=window.imagelyApp)||void 0===i?void 0:i.home_url)||window.location.origin;return"".concat(m,"?").concat(s.toString())},[t,null==n?void 0:n.display_type,null==n?void 0:n.display_type_settings,"gallery"===t?null==n?void 0:n.gid:r,o&&"gallery"===t?null==n?void 0:n.is_ecommerce_enabled:void 0,l])};const of=function(e){var t=e.text,n=e.children,r=e.placement,a=void 0===r?"top":r,o={top:"bottom-full left-1/2 -translate-x-1/2 mb-2",right:"left-full top-1/2 -translate-y-1/2 ml-2",bottom:"top-full left-1/2 -translate-x-1/2 mt-2",left:"right-full top-1/2 -translate-y-1/2 mr-2"}[a],l={top:"top-full left-1/2 -translate-x-1/2 -mt-2",right:"left-0 top-1/2 -translate-y-1/2 -ml-2",bottom:"-top-2 left-1/2 -translate-x-1/2",left:"right-0 top-1/2 -translate-y-1/2 -mr-2"}[a],i={top:"border-8 border-transparent border-t-gray-900",right:"border-8 border-transparent border-r-gray-900",bottom:"border-8 border-transparent border-b-gray-900",left:"border-8 border-transparent border-l-gray-900"}[a];return ee().createElement("div",{className:"relative inline-block group"},n,ee().createElement("div",{className:ao("absolute invisible group-hover:visible opacity-0 group-hover:opacity-100 px-3 py-2 text-sm text-white bg-gray-900 rounded-lg shadow-lg w-max max-w-xs z-50 whitespace-nowrap",o)},t,ee().createElement("div",{className:ao("absolute",l)},ee().createElement("div",{className:i}))))},lf=function(e){var t=e.url,n=e.mode,r=e.title,a=e.className,o=void 0===a?"":a,l=e.containerClassName,i=void 0===l?"":l,c=e.onLoad,s=e.loadingMessage,u=vo((0,$.useState)(!0),2),m=u[0],d=u[1],g=function(e){var t="desktop"===e?.5:.8;return{containerStyle:{transform:"scale(".concat(t,")"),transformOrigin:"top left",width:"".concat(100/t,"%"),height:"".concat(100/t,"%"),overflow:"hidden"},iframeStyle:{width:"100%",height:"100%"}}}(n),p=g.containerStyle,f=g.iframeStyle;return ee().createElement("div",{className:ao("w-full h-full",i),style:p},m&&ee().createElement("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-50 bg-opacity-90 z-10"},ee().createElement("div",{className:"text-center"},ee().createElement("div",{className:"inline-block animate-spin rounded-full size-14 border-b-2 border-black mb-2"}),ee().createElement("p",{className:"text-lg font-medium text-black"},null!=s?s:"Loading..."))),ee().createElement("iframe",{src:t,className:ao("w-full h-full",o),title:r||"Scaled iframe content",style:f,onLoad:function(){d(!1),null==c||c()}}))};function cf(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return sf(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(sf(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,sf(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,sf(m,"constructor",s),sf(s,"constructor",c),c.displayName="GeneratorFunction",sf(s,a,"GeneratorFunction"),sf(m),sf(m,a,"Generator"),sf(m,r,function(){return this}),sf(m,"toString",function(){return"[object Generator]"}),(cf=function(){return{w:o,m:d}})()}function sf(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}sf=function(e,t,n,r){function o(t,n){sf(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},sf(e,t,n,r)}const uf=function(e){var t=e.hasErrors,n=e.onReFetch,r=e.isReFetching;if(!t)return null;var a=function(){var e=No(cf().m(function e(){return cf().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,n();case 1:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}();return ee().createElement("div",{className:"mb-4 p-3 rounded bg-amber-50 text-amber-800 text-sm border border-amber-200 flex items-center justify-between gap-4"},ee().createElement("span",null,(0,pe.__)("Some TikTok videos have invalid or missing play URLs.","nggallery")),ee().createElement("button",{onClick:a,disabled:r,className:"flex items-center gap-1.5 shrink-0 px-2 py-1 rounded border border-green-600 bg-green-50 text-green-600 hover:bg-green-100 hover:border-green-700 disabled:opacity-50 disabled:cursor-not-allowed"},r?ee().createElement("span",{className:"inline-block w-4 h-4 animate-spin rounded-full border-2 border-green-600 border-t-transparent"}):ee().createElement(Hn,{className:"w-4 h-4"}),ee().createElement("span",null,(0,pe.__)("Refetch","nggallery"))))};function mf(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return df(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(df(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,df(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,df(m,"constructor",s),df(s,"constructor",c),c.displayName="GeneratorFunction",df(s,a,"GeneratorFunction"),df(m),df(m,a,"Generator"),df(m,r,function(){return this}),df(m,"toString",function(){return"[object Generator]"}),(mf=function(){return{w:o,m:d}})()}function df(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}df=function(e,t,n,r){function o(t,n){df(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},df(e,t,n,r)}const gf=function(e){var t=e.previewMode,n=e.onPreviewModeChange,r=e.url,a=e.title,o=e.height,l=e.showReFetchButton,i=void 0!==l&&l,c=e.onReFetchAndUpdateCache,s=e.isReFetching,u=void 0!==s&&s,m=e.onPreviewLoad,d=e.tiktokErrorNotice,g=e.customLoadingMessage,p=vo((0,$.useState)(0),2),f=p[0],y=p[1],h=(0,$.useRef)(""),b=(0,$.useMemo)(function(){return h.current!==r&&(h.current=r,y(function(e){return e+1})),"preview-".concat(f)},[r,f]),v=function(){var e=No(mf().m(function e(){return mf().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!c){e.n=4;break}return e.p=1,e.n=2,c();case 2:y(function(e){return e+1}),e.n=4;break;case 3:e.p=3,e.v;case 4:return e.a(2)}},e,null,[[1,3]])}));return function(){return e.apply(this,arguments)}}();return ee().createElement(ee().Fragment,null,(null==d?void 0:d.hasErrors)&&c&&ee().createElement(uf,{hasErrors:d.hasErrors,onReFetch:v,isReFetching:u}),ee().createElement("div",{className:"flex justify-between items-center mb-4"},ee().createElement("h2",{className:"text-md font-medium"},a||(0,pe.__)("Preview","nggallery")),ee().createElement("div",{className:"flex items-center space-x-2"},ee().createElement(of,{text:(0,pe.__)("Desktop Preview","nggallery"),placement:"bottom"},ee().createElement("button",{onClick:function(){return n("desktop")},className:"p-2 rounded ".concat("desktop"===t?"bg-gray-100":"hover:bg-gray-50")},ee().createElement(ur,{className:"w-5 h-5"}))),ee().createElement(of,{text:(0,pe.__)("Mobile Preview","nggallery"),placement:"bottom"},ee().createElement("button",{onClick:function(){return n("mobile")},className:"p-2 rounded ".concat("mobile"===t?"bg-gray-100":"hover:bg-gray-50")},ee().createElement(mr,{className:"w-5 h-5"}))),ee().createElement(of,{text:(0,pe.__)("Reload Preview","nggallery"),placement:"bottom"},ee().createElement("button",{onClick:function(){y(function(e){return e+1})},className:"p-0 text-green-600 hover:text-green-700"},ee().createElement(gr,{className:"w-4 h-4"}))),i&&c&&ee().createElement(of,{text:(0,pe.__)("Refetch and update cache","nggallery"),placement:"bottom"},ee().createElement("button",{onClick:v,disabled:u,className:"p-0 text-green-600 hover:text-green-700 disabled:opacity-50 disabled:cursor-not-allowed"},u?ee().createElement("span",{className:"inline-block w-4 h-4 animate-spin rounded-full border-2 border-green-600 border-t-transparent"}):ee().createElement(Hn,{className:"w-4 h-4"}))))),ee().createElement("div",{className:"border rounded-lg overflow-hidden bg-gray-50 mx-auto transition-all duration-300 relative ".concat("mobile"===t?"max-w-sm":"w-full"),style:{height:"number"==typeof o?"".concat(o,"px"):o||"500px"}},ee().createElement(lf,{key:b,url:r,mode:t,title:a||(0,pe.__)("Preview","nggallery"),onLoad:m,loadingMessage:g})))};var pf=["photocrati-nextgen_basic_slideshow","photocrati-nextgen_basic_thumbnails","photocrati-nextgen_basic_imagebrowser","photocrati-nextgen_basic_tagcloud"],ff=[].concat(pf,["photocrati-nextgen_pro_film","photocrati-nextgen_pro_mosaic"]);const yf=function(){var e=Cp();return ee().createElement("div",{className:"flex items-center justify-center h-full p-8"},ee().createElement("div",{className:"text-center max-w-md"},ee().createElement("div",{className:"flex items-center justify-center w-10 h-10 mx-auto mb-4"},ee().createElement(wr,{className:"w-12 h-12"})),ee().createElement("h3",{className:"text-xl font-semibold text-gray-800 mb-4"},(0,pe.__)("This layout is a Pro Feature","nggallery")),ee().createElement("p",{className:"text-gray-600 text-center mb-0"},(0,pe.__)("We're sorry, using this layout is not available on your plan.","nggallery")),ee().createElement("p",{className:"text-gray-600 text-center mb-6"},(0,pe.__)("Please upgrade to the Pro plan to unlock this and all our awesome features.","nggallery")),ee().createElement("div",{className:"relative mb-8 flex justify-center items-center"},ee().createElement(xr,{className:"absolute -left-0 -top-4 w-12 h-12 flex-shrink-0"}),ee().createElement("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center bg-green-500 text-white text-center text-lg py-3 px-6 rounded-lg font-medium hover:bg-green-600 transition-colors"},(0,pe.__)("Upgrade to Pro","nggallery"),ee().createElement(vr,{className:"w-4 h-4 ml-2 flex-shrink-0"}))),ee().createElement("div",{className:"bg-[#F0FDE6] border border-green-100 px-6 py-4 rounded-lg"},ee().createElement("div",{className:"flex items-center justify-center"},ee().createElement(Er,{className:"w-8 h-8 mr-2 flex-shrink-0"}),ee().createElement("p",{className:"text-gray-700 text-sm text-left"},(0,pe.__)("Imagely lite users get","nggallery")," ",ee().createElement("strong",{className:"text-green-600"},(0,pe.__)("50% off","nggallery"))," ",(0,pe.__)("the regular price, automatically applied at checkout!","nggallery"))))))};function hf(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}const bf=function(e){var t,r=e.prefix,a=e.value,o=e.name,l=void 0===o?"template":o,i=e.onChange,c=e.label,s=e.help,u=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?hf(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):hf(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},(null===(t=window.imagelyApp)||void 0===t||null===(t=t.legacyTemplates)||void 0===t?void 0:t[r])||{default:(0,pe.__)("Default","nggallery")});return a&&!u[a]&&(u[a]=a),ee().createElement(sc,{id:"legacy-template-".concat(r),name:l,value:a||"default",onChange:i,label:null!=c?c:(0,pe.__)("Legacy Template","nggallery"),help:null!=s?s:(0,pe.__)('Use a legacy PHP template for custom rendering. Templates are loaded from your theme\'s "nggallery" folder.',"nggallery")},Object.entries(u).map(function(e){var t=vo(e,2),n=t[0],r=t[1];return ee().createElement("option",{key:n,value:n},r)}))};var vf=[{value:"bounce",label:(0,pe.__)("Bounce","nggallery")},{value:"headShake",label:(0,pe.__)("Headshake","nggallery")},{value:"jackInTheBox",label:(0,pe.__)("Jack in the box","nggallery")},{value:"jello",label:(0,pe.__)("Jello","nggallery")},{value:"rollIn",label:(0,pe.__)("Roll in","nggallery")},{value:"rubberBand",label:(0,pe.__)("Rubberband","nggallery")},{value:"shakeX",label:(0,pe.__)("Shake X","nggallery")},{value:"shakeY",label:(0,pe.__)("Shake Y","nggallery")},{value:"swing",label:(0,pe.__)("Swing","nggallery")},{value:"tada",label:(0,pe.__)("Tada","nggallery")},{value:"wobble",label:(0,pe.__)("Wobble","nggallery")},{value:"heartBeat",label:(0,pe.__)("Heartbeat","nggallery")},{value:"backInDown",label:(0,pe.__)("Back in down","nggallery")},{value:"backInLeft",label:(0,pe.__)("Back in left","nggallery")},{value:"backInRight",label:(0,pe.__)("Back in right","nggallery")},{value:"backInUp",label:(0,pe.__)("Back in up","nggallery")},{value:"bounceIn",label:(0,pe.__)("Bounce in","nggallery")},{value:"bounceInDown",label:(0,pe.__)("Bounce in down","nggallery")},{value:"bounceInLeft",label:(0,pe.__)("Bounce in left","nggallery")},{value:"bounceInRight",label:(0,pe.__)("Bounce in right","nggallery")},{value:"bounceInUp",label:(0,pe.__)("Bounce in up","nggallery")},{value:"fadeIn",label:(0,pe.__)("Fade in","nggallery")},{value:"fadeInDown",label:(0,pe.__)("Fade in down","nggallery")},{value:"fadeInDownBig",label:(0,pe.__)("Fade in down big","nggallery")},{value:"fadeInLeft",label:(0,pe.__)("Fade in left","nggallery")},{value:"fadeInLeftBig",label:(0,pe.__)("Fade in left big","nggallery")},{value:"fadeInRight",label:(0,pe.__)("Fade in right","nggallery")},{value:"fadeInRightBig",label:(0,pe.__)("Fade in right big","nggallery")},{value:"fadeInUp",label:(0,pe.__)("Fade in up","nggallery")},{value:"fadeInUpBig",label:(0,pe.__)("Fade in up big","nggallery")},{value:"fadeInTopLeft",label:(0,pe.__)("Fade in top left","nggallery")},{value:"fadeInTopRight",label:(0,pe.__)("Fade in top right","nggallery")},{value:"fadeInBottomLeft",label:(0,pe.__)("Fade in bottom left","nggallery")},{value:"fadeInBottomRight",label:(0,pe.__)("Fade in bottom right","nggallery")},{value:"flip",label:(0,pe.__)("Flip","nggallery")},{value:"flipInX",label:(0,pe.__)("Flip in X","nggallery")},{value:"flipInY",label:(0,pe.__)("Flip in Y","nggallery")},{value:"lightSpeedInRight",label:(0,pe.__)("Lightspeed in right","nggallery")},{value:"lightSpeedInLeft",label:(0,pe.__)("Lightspeed in left","nggallery")},{value:"rotateIn",label:(0,pe.__)("Rotate in","nggallery")},{value:"rotateInDownLeft",label:(0,pe.__)("Rotate in down left","nggallery")},{value:"rotateInDownRight",label:(0,pe.__)("Rotate in down right","nggallery")},{value:"rotateInUpLeft",label:(0,pe.__)("Rotate in up left","nggallery")},{value:"rotateInUpRight",label:(0,pe.__)("Rotate in up right","nggallery")},{value:"zoomIn",label:(0,pe.__)("Zoom in","nggallery")},{value:"zoomInDown",label:(0,pe.__)("Zoom in down","nggallery")},{value:"zoomInLeft",label:(0,pe.__)("Zoom in left","nggallery")},{value:"zoomInRight",label:(0,pe.__)("Zoom in right","nggallery")},{value:"zoomInUp",label:(0,pe.__)("Zoom in up","nggallery")},{value:"slideInDown",label:(0,pe.__)("Slide in down","nggallery")},{value:"slideInLeft",label:(0,pe.__)("Slide in left","nggallery")},{value:"slideInRight",label:(0,pe.__)("Slide in right","nggallery")},{value:"slideInUp",label:(0,pe.__)("Slide in up","nggallery")}],_f=function(e){var t,n,r=e.formState,a=e.handleInputChange,o=e.hidePagination,l=void 0!==o&&o,i=(0,ge.useDispatch)(Br);return"pro"===zr||"plus"===zr?ee().createElement(ee().Fragment,null,ee().createElement(fs,{id:"animate_images_enable",name:"animate_images_enable",checked:r.animate_images_enable,onChange:a,label:(0,pe.__)("Animate Images","nggallery")}),ni(r.animate_images_enable)&&ee().createElement("div",{className:"ml-6 space-y-4"},ee().createElement(sc,{id:"animate_images_style",name:"animate_images_style",value:null!==(t=r.animate_images_style)&&void 0!==t?t:"wobble",onChange:a,label:(0,pe.__)("Animation Type","nggallery")},vf.map(function(e){return ee().createElement("option",{key:e.value,value:e.value},e.label)})),ee().createElement(uc,{type:"number",name:"animate_images_duration",value:r.animate_images_duration,onChange:a,label:(0,pe.__)("Duration (ms)","nggallery")}),ee().createElement(uc,{type:"number",name:"animate_images_delay",value:r.animate_images_delay,onChange:a,label:(0,pe.__)("Delay (ms)","nggallery")})),l?null:ee().createElement(ee().Fragment,null,ee().createElement(fs,{id:"animate_pagination_enable",name:"animate_pagination_enable",checked:r.animate_pagination_enable,onChange:a,label:(0,pe.__)("Animate Pagination","nggallery")}),ni(r.animate_pagination_enable)&&ee().createElement("div",{className:"ml-6 space-y-4"},ee().createElement(sc,{id:"animate_pagination_style",name:"animate_pagination_style",value:null!==(n=r.animate_pagination_style)&&void 0!==n?n:"flipInX",onChange:a,label:(0,pe.__)("Animation Type","nggallery")},vf.map(function(e){return ee().createElement("option",{key:e.value,value:e.value},e.label)})),ee().createElement(uc,{type:"number",name:"animate_pagination_duration",value:r.animate_pagination_duration,onChange:a,label:(0,pe.__)("Duration (ms)","nggallery")}),ee().createElement(uc,{type:"number",name:"animate_pagination_delay",value:r.animate_pagination_delay,onChange:a,label:(0,pe.__)("Delay (ms)","nggallery")})))):ee().createElement("div",{className:"relative"},ee().createElement("div",{className:"opacity-50 pointer-events-none"},ee().createElement(fs,{id:"animate_images_enable",name:"animate_images_enable",checked:!1,onChange:function(){},label:(0,pe.__)("Animate Images","nggallery")})),ee().createElement("div",{className:"absolute inset-0 cursor-pointer",onClick:function(){i.setActiveModal("upgrade",{feature:"animations features"})},title:(0,pe.__)("Requires NextGEN Gallery Pro","nggallery")}))},wf=function(e){var t=e.formState,n=e.handleInputChange;return ee().createElement(ee().Fragment,null,ee().createElement(cc,{htmlFor:"maximum_dimensions",help:(0,pe.__)("Certain themes may allow images to flow over their container if this setting is too large","nggallery")},(0,pe.__)("Maximum dimensions","nggallery")),ee().createElement("div",{className:"flex gap-2 items-center"},ee().createElement("span",null,"w"),ee().createElement(uc,{type:"number",name:"gallery_width",value:t.gallery_width,onChange:n}),ee().createElement("span",null,"/"),ee().createElement(uc,{type:"number",name:"gallery_height",value:t.gallery_height,onChange:n}),ee().createElement("span",null,"h")),ee().createElement(fs,{id:"autoplay",name:"autoplay",checked:t.autoplay,onChange:n,label:(0,pe.__)("Autoplay","nggallery")}),ee().createElement(fs,{id:"pauseonhover",name:"pauseonhover",checked:t.pauseonhover,onChange:n,label:(0,pe.__)("Pause on Hover","nggallery")}),ee().createElement(fs,{id:"arrows",name:"arrows",checked:t.arrows,onChange:n,label:(0,pe.__)("Show Arrows","nggallery")}),ee().createElement(sc,{id:"transition_style",name:"transition_style",value:t.transition_style,onChange:n,label:(0,pe.__)("Transition Style","nggallery")},ee().createElement("option",{value:"fade"},(0,pe.__)("Fade","nggallery")),ee().createElement("option",{value:"slide"},(0,pe.__)("Slide","nggallery"))),ee().createElement(uc,{type:"number",name:"interval",value:t.interval,onChange:n,label:(0,pe.__)("Interval","nggallery")}),ee().createElement(uc,{type:"number",name:"transition_speed",value:t.transition_speed,onChange:n,label:(0,pe.__)("Transition Speed","nggallery")}),ee().createElement(fs,{id:"show_thumbnail_link",name:"show_thumbnail_link",checked:t.show_thumbnail_link,onChange:n,label:(0,pe.__)("Show thumbnail link","nggallery")}),ni(t.show_thumbnail_link)&&ee().createElement("div",{className:"ml-6 space-y-4"},ee().createElement(uc,{type:"text",name:"thumbnail_link_text",value:t.thumbnail_link_text,onChange:n,label:(0,pe.__)("Thumbnail link text","nggallery")})),ee().createElement(bf,{prefix:"gallery",value:t.template,onChange:n}),ee().createElement(_f,{formState:t,handleInputChange:n,hidePagination:!0}))},xf=function(e){var t=e.formState,n=e.handleInputChange;return ee().createElement(fs,{id:"ajax_pagination",name:"ajax_pagination",checked:t.ajax_pagination,onChange:n,label:(0,pe.__)("Enable AJAX pagination","nggallery"),help:(0,pe.__)("Browse images without reloading the page.","nggallery")})},Ef=function(e){var t=e.formState,n=e.handleInputChange;return ee().createElement(sc,{id:"ngg_triggers_display",name:"ngg_triggers_display",value:t.ngg_triggers_display,onChange:n,label:(0,pe.__)("Display Triggers","nggallery")},ee().createElement("option",{value:"never"},(0,pe.__)("Never","nggallery")),ee().createElement("option",{value:"always"},(0,pe.__)("Always","nggallery")),ee().createElement("option",{value:"exclude_mobile"},(0,pe.__)("Exclude Mobile","nggallery")))},Cf=function(e){var t=e.formState,n=e.handleInputChange;return ee().createElement(ee().Fragment,null,ee().createElement(fs,{id:"override_thumbnail_settings",name:"override_thumbnail_settings",checked:t.override_thumbnail_settings,onChange:n,label:(0,pe.__)("Override thumbnail settings","nggallery"),help:(0,pe.__)("This does not affect existing thumbnails; overriding the thumbnail settings will create an additional set of thumbnails. To change the size of existing thumbnails please visit 'Manage Galleries' and choose 'Create new thumbnails' for all images in the gallery.","nggallery")}),ni(t.override_thumbnail_settings)&&ee().createElement("div",{className:"ml-6 space-y-4"},ee().createElement(cc,{htmlFor:"thumbnail_dimensions",help:(0,pe.__)("These are maximum values","nggallery")},(0,pe.__)("Thumbnail dimensions","nggallery")),ee().createElement("div",{className:"flex gap-4"},ee().createElement(uc,{type:"number",name:"thumbnail_width",value:t.thumbnail_width,onChange:n}),ee().createElement(uc,{type:"number",name:"thumbnail_height",value:t.thumbnail_height,onChange:n})),ee().createElement(fs,{id:"thumbnail_crop",name:"thumbnail_crop",checked:t.thumbnail_crop,onChange:n,label:(0,pe.__)("Thumbnail crop","nggallery")})),ee().createElement(uc,{type:"number",name:"images_per_page",value:t.images_per_page,onChange:n,label:(0,pe.__)("Images per page","nggallery")}))},Nf=function(e){var t=e.formState,n=e.handleInputChange,r=(0,ge.useDispatch)(Br);return"pro"===zr?ee().createElement(fs,{id:"ngg_proofing_display",name:"ngg_proofing_display",checked:t.ngg_proofing_display,onChange:n,label:(0,pe.__)("Enable proofing","nggallery"),help:(0,pe.__)("Trigger buttons or hover captions need to be enabled for proofing to work","nggallery")}):ee().createElement("div",{className:"relative"},ee().createElement("div",{className:"opacity-50 pointer-events-none"},ee().createElement(fs,{id:"ngg_proofing_display",name:"ngg_proofing_display",checked:!1,onChange:function(){},label:(0,pe.__)("Enable proofing","nggallery"),help:(0,pe.__)("Trigger buttons or hover captions need to be enabled for proofing to work","nggallery")})),ee().createElement("div",{className:"absolute inset-0 cursor-pointer",onClick:function(){r.setActiveModal("upgrade",{feature:"proofing features"})},title:(0,pe.__)("Requires NextGEN Gallery Pro","nggallery")}))},kf=function(e){var t=e.formState,n=e.handleInputChange;return ee().createElement(ee().Fragment,null,ee().createElement(Cf,{formState:t,handleInputChange:n}),ee().createElement(uc,{type:"number",name:"number_of_columns",value:t.number_of_columns,onChange:n,label:(0,pe.__)("Number of columns to display","nggallery"),help:(0,pe.__)("An empty or zero in this field will use a responsive layout","nggallery")}),ee().createElement(fs,{id:"show_all_in_lightbox",name:"show_all_in_lightbox",checked:t.show_all_in_lightbox,onChange:n,label:(0,pe.__)("Add hidden images","nggallery"),help:(0,pe.__)("If pagination is used this option will show all images in the modal window (Thickbox, Lightbox etc.) This increases page load.","nggallery")}),ee().createElement(fs,{id:"use_imagebrowser_effect",name:"use_imagebrowser_effect",checked:t.use_imagebrowser_effect,onChange:n,label:(0,pe.__)("Use imagebrowser effect","nggallery"),help:(0,pe.__)("When active each image in the gallery will link to an imagebrowser display and lightbox effects will not be applied.","nggallery")}),ee().createElement(fs,{id:"show_slideshow_link",name:"show_slideshow_link",checked:t.show_slideshow_link,onChange:n,label:(0,pe.__)("Show slideshow link","nggallery")}),ni(t.show_slideshow_link)&&ee().createElement("div",{className:"ml-6 space-y-4"},ee().createElement(uc,{type:"text",name:"slideshow_link_text",value:t.slideshow_link_text,onChange:n,label:(0,pe.__)("Slideshow link text","nggallery")})),ee().createElement("input",{type:"hidden",name:"display_view",value:"default"}),ee().createElement(bf,{prefix:"gallery",value:t.template,onChange:n}),ee().createElement(Nf,{formState:t,handleInputChange:n}),ee().createElement(_f,{formState:t,handleInputChange:n}),ee().createElement(Ef,{formState:t,handleInputChange:n}),ee().createElement(xf,{formState:t,handleInputChange:n}))};const Sf=window.wp.components;var Of=function(e){var t=e.color,n=e.onChange,r=e.label,a=void 0===r?(0,pe.__)("Select Color","nggallery"):r,o=e.className,l=void 0===o?"":o,i=e.enableAlpha,c=void 0!==i&&i,s=e.copyFormat,u=void 0===s?"hex":s,m=vo((0,$.useState)(!1),2),d=m[0],g=m[1],p=(0,$.useRef)(null),f=(0,$.useRef)(null),y=vo((0,$.useState)(null),2),h=y[0],b=y[1],v=ac(oc,d),_=(0,$.useCallback)(function(){g(!1)},[]),w=xo(_,d);return(0,$.useLayoutEffect)(function(){if(d&&p.current&&f.current){var e=p.current.getBoundingClientRect(),t=f.current.getBoundingClientRect(),n=oc().getBoundingClientRect(),r=e.bottom-v.offsetY+8,a=e.left+e.width/2-t.width/2-v.offsetX;if(r+t.height>n.height-8){var o=e.top-v.offsetY-t.height-8;o>=8&&(r=o)}var l=n.width-8;a<8&&(a=8),a+t.width>l&&(a=l-t.width),a<0&&(a=8),b({top:r,left:a})}},[d,t,v]),(0,$.useEffect)(function(){var e=function(e){"Escape"===e.key&&d&&g(!1)};return d&&document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}},[d]),ee().createElement("div",{className:ao("space-y-2",l)},ee().createElement("div",{className:"flex items-center space-x-2"},ee().createElement("button",{ref:p,type:"button",onClick:function(){return g(!d)},className:"inline-flex items-center px-3 py-2 border border-input-border shadow-sm text-sm leading-4 font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500"},ee().createElement("span",{className:"w-4 h-4 mr-2 rounded-sm border border-input-border",style:{backgroundColor:t}}),a),ee().createElement("span",{className:"text-sm text-gray-500"},t)),d&&rc().createPortal(ee().createElement("div",{ref:function(e){w.current=e,f.current=e},style:{position:"absolute",top:h?"".concat(h.top,"px"):"-9999px",left:h?"".concat(h.left,"px"):"-9999px",opacity:h?1:0,zIndex:9999},className:"bg-white rounded-lg shadow-xl border border-input-border p-3"},ee().createElement(Sf.ColorPicker,{color:t,onChange:n,enableAlpha:c,copyFormat:u}),ee().createElement("div",{className:"mt-3 flex justify-end"},ee().createElement("button",{type:"button",onClick:function(){n("")},className:"text-sm text-red-500 hover:text-red-700 cursor-pointer bg-transparent border-none"},(0,pe.__)("Clear","nggallery")))),oc()))},Pf=function(e){var t=e.formState,n=e.handleInputChange;return ee().createElement(ee().Fragment,null,ee().createElement(fs,{id:"captions_enabled",name:"captions_enabled",checked:t.captions_enabled,onChange:n,label:(0,pe.__)("Enable caption overlay","nggallery")}),ni(t.captions_enabled)&&ee().createElement("div",{className:"ml-6 space-y-4"},ee().createElement(fs,{id:"captions_display_sharing",name:"captions_display_sharing",checked:t.captions_display_sharing,onChange:n,label:(0,pe.__)("Display share icons","nggallery")}),ee().createElement(fs,{id:"captions_display_title",name:"captions_display_title",checked:t.captions_display_title,onChange:n,label:(0,pe.__)("Display image title","nggallery")}),ee().createElement(fs,{id:"captions_display_description",name:"captions_display_description",checked:t.captions_display_description,onChange:n,label:(0,pe.__)("Display image description","nggallery")}),ee().createElement(sc,{id:"captions_animation",name:"captions_animation",value:t.captions_animation,onChange:n,label:(0,pe.__)("Animation type","nggallery")},ee().createElement("option",{value:"fade"},(0,pe.__)("Fade in","nggallery")),ee().createElement("option",{value:"slideup"},(0,pe.__)("Slide up","nggallery")),ee().createElement("option",{value:"slidedown"},(0,pe.__)("Slide down","nggallery")),ee().createElement("option",{value:"slideleft"},(0,pe.__)("Slide left","nggallery")),ee().createElement("option",{value:"titlebar"},(0,pe.__)("Titlebar","nggallery")),ee().createElement("option",{value:"plain"},(0,pe.__)("Plain","nggallery")))))},jf=function(e){var t=e.formState,n=e.handleInputChange;return ee().createElement(ee().Fragment,null,ee().createElement(Cf,{formState:t,handleInputChange:n}),ee().createElement(uc,{type:"number",name:"number_of_columns",value:t.number_of_columns,onChange:n,label:(0,pe.__)("Number of columns to display","nggallery"),help:(0,pe.__)("An empty or zero in this field will use a responsive layout","nggallery")}),ee().createElement(uc,{type:"number",name:"border_size",value:t.border_size,onChange:n,label:(0,pe.__)("Border size","nggallery")}),ee().createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},(0,pe.__)("Border color","nggallery")),ee().createElement(Of,{color:t.border_color,onChange:function(e){return n({target:{name:"border_color",value:e}})}}),ee().createElement(uc,{type:"number",name:"spacing",value:t.spacing,onChange:n,label:(0,pe.__)("Spacing","nggallery")}),ee().createElement(sc,{id:"display_type_view",name:"display_type_view",value:t.display_type_view,onChange:n,label:(0,pe.__)("Select View","nggallery")},ee().createElement("option",{value:"default"},(0,pe.__)("Default","nggallery")),ee().createElement("option",{value:"pro-thumbnail-border-template.php"},(0,pe.__)("pro-thumbnail-border-template.php","nggallery")),ee().createElement("option",{value:"pro-thumbnail-caption-template.php"},(0,pe.__)("pro-thumbnail-caption-template.php","nggallery")),ee().createElement("option",{value:"pro-thumbnail-caption2-template.php"},(0,pe.__)("pro-thumbnail-caption2-template.php","nggallery"))),ee().createElement(Pf,{formState:t,handleInputChange:n}),ee().createElement(_f,{formState:t,handleInputChange:n}),ee().createElement(Ef,{formState:t,handleInputChange:n}))},Tf=function(e){var t=e.formState,n=e.handleInputChange;return ee().createElement(ee().Fragment,null,ee().createElement("input",{type:"hidden",name:"display_view",value:"default_view"}),ee().createElement(bf,{prefix:"imagebrowser",value:t.template,onChange:n}),ee().createElement(_f,{formState:t,handleInputChange:n}),ee().createElement(xf,{formState:t,handleInputChange:n}))},If=function(e){var t=e.formState,n=e.handleInputChange,r=Vp().map(function(e){return{value:e.id,label:e.name}});return ee().createElement("div",{className:"space-y-4"},ee().createElement("h3",{className:"text-sm font-medium text-gray-900"},(0,pe.__)("Gallery Display Settings","nggallery")),ee().createElement(sc,{id:"gallery_display_type",name:"gallery_display_type",value:t.gallery_display_type||"",onChange:n,label:(0,pe.__)("Display Type","nggallery")},r.map(function(e){return ee().createElement("option",{key:e.value,value:e.value},e.label)})),ee().createElement(fs,{id:"gallery_override_global_settings",name:"gallery_override_global_settings",checked:t.gallery_override_global_settings||!1,onChange:n,label:(0,pe.__)("Override Global Settings","nggallery")}),t.gallery_override_global_settings&&ee().createElement("div",{className:"pl-4 border-l-2 border-gray-200 space-y-4"},ee().createElement("p",{className:"text-sm text-gray-600"},(0,pe.__)("Custom settings for this gallery will override the global display type settings.","nggallery"))))},Af=function(e){var t=e.formState,n=e.handleInputChange;return ee().createElement(ee().Fragment,null,ee().createElement(uc,{type:"number",name:"number",value:t.number,onChange:n,label:(0,pe.__)("Number of tags to display","nggallery"),help:(0,pe.__)("Enter the maximum number of tags to display in the cloud","nggallery")}),ee().createElement(If,{formState:t,handleInputChange:n}),ee().createElement(_f,{formState:t,handleInputChange:n}))},Df=function(e){var t=e.formState,n=e.handleInputChange;return ee().createElement(ee().Fragment,null,ee().createElement(fs,{id:"override_image_settings",name:"override_image_settings",checked:t.override_image_settings,onChange:n,label:(0,pe.__)("Override image settings","nggallery"),help:(0,pe.__)("Overriding the image settings will create an additional set of images","nggallery")}),ni(t.override_image_settings)&&ee().createElement("div",{className:"ml-6 space-y-4"},ee().createElement(sc,{id:"image_quality",name:"image_quality",value:t.image_quality,onChange:n,label:(0,pe.__)("Image quality","nggallery")},Array.from({length:12},function(e,t){return 45+5*t}).map(function(e){return ee().createElement("option",{key:e,value:e.toString()},e,"%")})),ee().createElement(fs,{id:"image_watermark",name:"image_watermark",checked:t.image_watermark,onChange:n,label:(0,pe.__)("Image watermark","nggallery")})),ee().createElement(uc,{type:"number",name:"image_display_size",value:t.image_display_size,onChange:n,label:(0,pe.__)("Image display size","nggallery"),help:(0,pe.__)("Measured in pixels","nggallery")}),ee().createElement(uc,{type:"number",name:"image_max_height",value:t.image_max_height,onChange:n,label:(0,pe.__)("Image maximum height","nggallery"),help:(0,pe.__)("Measured in pixels. Empty or 0 will not impose a limit.","nggallery")}),ee().createElement(uc,{type:"number",name:"image_spacing",value:t.image_spacing,onChange:n,label:(0,pe.__)("Image spacing","nggallery"),help:(0,pe.__)("Measured in pixels","nggallery")}),ee().createElement(uc,{type:"number",name:"border_size",value:t.border_size,onChange:n,label:(0,pe.__)("Border size","nggallery")}),ee().createElement("div",{className:"mb-4"},ee().createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},(0,pe.__)("Border color","nggallery")),ee().createElement(Of,{color:t.border_color,onChange:function(e){n({target:{name:"border_color",value:e}})}})),ee().createElement(sc,{id:"display_type_view",name:"display_type_view",value:t.display_type_view,onChange:n,label:(0,pe.__)("Select View","nggallery")},ee().createElement("option",{value:"default"},(0,pe.__)("Default","nggallery"))),ee().createElement(fs,{id:"display_captions",name:"display_captions",checked:t.display_captions,onChange:n,label:(0,pe.__)("Display captions","nggallery")}),ni(t.display_captions)&&ee().createElement("div",{className:"ml-6 space-y-4"},ee().createElement(sc,{id:"caption_location",name:"caption_location",value:t.caption_location,onChange:n,label:(0,pe.__)("Caption location","nggallery")},ee().createElement("option",{value:"above"},(0,pe.__)("Above","nggallery")),ee().createElement("option",{value:"below"},(0,pe.__)("Below","nggallery")))),ee().createElement(Pf,{formState:t,handleInputChange:n}),ee().createElement(Nf,{formState:t,handleInputChange:n}),ee().createElement(_f,{formState:t,handleInputChange:n,hidePagination:!0}),ee().createElement(Ef,{formState:t,handleInputChange:n}))},Lf=function(e){var t=e.formState,n=e.handleInputChange;return ee().createElement(ee().Fragment,null,ee().createElement("input",{type:"hidden",name:"display_type_view",value:"default"}),ee().createElement(bf,{prefix:"imagebrowser",value:t.template,onChange:n}),ee().createElement(_f,{formState:t,handleInputChange:n}),ee().createElement(xf,{formState:t,handleInputChange:n}))},Ff=function(e){var t=e.formState,n=e.handleInputChange;return ee().createElement(ee().Fragment,null,ee().createElement(uc,{type:"number",name:"height",value:t.height,onChange:n,label:(0,pe.__)("Gallery Height","nggallery")}),ee().createElement(Pf,{formState:t,handleInputChange:n}),ee().createElement(_f,{formState:t,handleInputChange:n,hidePagination:!0}))},Mf=function(e){var t=e.formState,n=e.handleInputChange,r=function(e,t){n({target:{name:t,value:e}})},a=function(e){return function(t){var r=""===t.target.value?"":String(parseInt(t.target.value,10)||0);n({target:{name:e,value:r}})}};return ee().createElement(ee().Fragment,null,ee().createElement(Cf,{formState:t,handleInputChange:n}),ee().createElement(uc,{type:"number",name:"image_spacing",value:t.image_spacing,onChange:n,label:(0,pe.__)("Image spacing","nggallery")}),ee().createElement(uc,{type:"number",name:"border_size",value:t.border_size,onChange:n,label:(0,pe.__)("Border size","nggallery")}),ee().createElement(uc,{type:"number",name:"frame_size",value:t.frame_size,onChange:n,label:(0,pe.__)("Frame size","nggallery")}),ee().createElement("div",{className:"mb-4"},ee().createElement(cc,null,(0,pe.__)("Border color","nggallery")),ee().createElement(Of,{color:t.border_color,onChange:function(e){return r(e,"border_color")}})),ee().createElement("div",{className:"mb-4"},ee().createElement(cc,null,(0,pe.__)("Frame color","nggallery")),ee().createElement(Of,{color:t.frame_color,onChange:function(e){return r(e,"frame_color")}})),ee().createElement(fs,{id:"alttext_display",name:"alttext_display",checked:t.alttext_display,onChange:n,label:(0,pe.__)("Display image title","nggallery")}),ni(t.alttext_display)&&ee().createElement("div",{className:"ml-6 space-y-4"},ee().createElement("div",{className:"mb-4"},ee().createElement(cc,null,(0,pe.__)("Title font color","nggallery")),ee().createElement(Of,{color:t.alttext_font_color,onChange:function(e){return r(e,"alttext_font_color")}}),ee().createElement("p",{className:"mt-1 text-sm text-gray-500"},(0,pe.__)("An empty color setting will use your theme colors","nggallery"))),ee().createElement(uc,{type:"number",name:"alttext_font_size",value:t.alttext_font_size,onChange:a("alttext_font_size"),label:(0,pe.__)("Title font size","nggallery"),help:(0,pe.__)("Measured in pixels. An empty or zero setting will use your theme font size","nggallery"),placeholder:(0,pe.__)("# of pixels","nggallery"),min:0,max:200})),ee().createElement(fs,{id:"description_display",name:"description_display",checked:t.description_display,onChange:n,label:(0,pe.__)("Display image description","nggallery")}),ni(t.description_display)&&ee().createElement("div",{className:"ml-6 space-y-4"},ee().createElement("div",{className:"mb-4"},ee().createElement(cc,{help:(0,pe.__)("An empty color setting will use your theme colors","nggallery")},(0,pe.__)("Description font color","nggallery")),ee().createElement(Of,{color:t.description_font_color,onChange:function(e){return r(e,"description_font_color")}})),ee().createElement(uc,{type:"number",name:"description_font_size",value:t.description_font_size,onChange:a("description_font_size"),label:(0,pe.__)("Description font size","nggallery"),help:(0,pe.__)("Measured in pixels. An empty or zero setting will use your theme font size","nggallery"),placeholder:(0,pe.__)("# of pixels","nggallery"),min:0,max:200})),ee().createElement(Pf,{formState:t,handleInputChange:n}),ee().createElement(Nf,{formState:t,handleInputChange:n}),ee().createElement(Ef,{formState:t,handleInputChange:n}))},Rf=function(e){var t=e.formState,n=e.handleInputChange;return ee().createElement(ee().Fragment,null,ee().createElement(fs,{id:"override_gallery_width",name:"override_gallery_width",checked:t.override_gallery_width,onChange:n,label:(0,pe.__)("Override maximum gallery width","nggallery"),help:(0,pe.__)("Gallery width is set to your theme's content width but this can be overridden to create smaller galleries. If your theme does not provide the $content_width feature the default will fallback to 2000px.","nggallery")}),ni(t.override_gallery_width)&&ee().createElement("div",{className:"ml-6 space-y-4"},ee().createElement(uc,{type:"number",name:"maximum_gallery_width",value:t.maximum_gallery_width,onChange:n,label:(0,pe.__)("Maximum gallery width","nggallery"),help:(0,pe.__)("Measured in pixels","nggallery")})),ee().createElement(Pf,{formState:t,handleInputChange:n}),ee().createElement(_f,{formState:t,handleInputChange:n,hidePagination:!0}))},Gf=function(e){var t=e.formState,n=e.handleInputChange;return ee().createElement(ee().Fragment,null,ee().createElement(sc,{id:"justify_last_row",name:"justify_last_row",value:t.justify_last_row,onChange:n,label:(0,pe.__)("Justify last row","nggallery"),help:(0,pe.__)('When aligning the last row some images may appear cropped. Select "Do not justify" to allow the last row to appear flush but "unfinished". "Hide" will omit any images that can not be justified without cropping.',"nggallery")},ee().createElement("option",{value:"justify"},(0,pe.__)("Justify","nggallery")),ee().createElement("option",{value:"nojustify"},(0,pe.__)("Do not justify","nggallery")),ee().createElement("option",{value:"hide"},(0,pe.__)("Hide","nggallery"))),ee().createElement(fs,{id:"enable_lazy_loading",name:"enable_lazy_loading",checked:t.enable_lazy_loading,onChange:n,label:(0,pe.__)('Enable "lazy" image loading',"nggallery")}),t.enable_lazy_loading&&ee().createElement("div",{className:"ml-6 space-y-4"},ee().createElement(uc,{type:"number",name:"images_to_load_on_scroll",value:t.images_to_load_on_scroll,onChange:n,label:(0,pe.__)("Images to load when scrolling","nggallery")}),ee().createElement(uc,{type:"number",name:"images_to_display_at_start",value:t.images_to_display_at_start,onChange:n,label:(0,pe.__)("Images to display at start","nggallery")})),ee().createElement(uc,{type:"number",name:"margins",value:t.margins,onChange:n,label:(0,pe.__)("Margins","nggallery")}),ee().createElement(uc,{type:"number",name:"row_height",value:t.row_height,onChange:n,label:(0,pe.__)("Row height","nggallery")}),ee().createElement(Pf,{formState:t,handleInputChange:n}),ee().createElement(Nf,{formState:t,handleInputChange:n}),ee().createElement(_f,{formState:t,handleInputChange:n}))},Bf=function(e){var t=e.formState,n=e.handleInputChange;return ee().createElement(ee().Fragment,null,ee().createElement(uc,{type:"number",name:"size",value:t.size,onChange:n,label:(0,pe.__)("Maximum image width","nggallery"),help:(0,pe.__)("Measured in pixels","nggallery")}),ee().createElement(uc,{type:"number",name:"padding",value:t.padding,onChange:n,label:(0,pe.__)("Image padding","nggallery"),help:(0,pe.__)("Measured in pixels","nggallery")}),ee().createElement(fs,{id:"center_gallery",name:"center_gallery",checked:t.center_gallery,onChange:n,label:(0,pe.__)("Center the gallery","nggallery")}),ee().createElement(Pf,{formState:t,handleInputChange:n}),ee().createElement(_f,{formState:t,handleInputChange:n,hidePagination:!0}),ee().createElement(Ef,{formState:t,handleInputChange:n}))},zf=function(e){var t=e.formState,n=e.handleInputChange;return ee().createElement(ee().Fragment,null,ee().createElement(fs,{id:"enable_tag_filter",name:"enable_tag_filter",checked:t.enable_tag_filter,onChange:n,label:(0,pe.__)("Enable filtering results by tag","nggallery")}),ee().createElement(fs,{id:"search_alttext",name:"search_alttext",checked:t.search_alttext,onChange:n,label:(0,pe.__)("Search image alttext","nggallery")}),ee().createElement(fs,{id:"search_description",name:"search_description",checked:t.search_description,onChange:n,label:(0,pe.__)("Search image description","nggallery")}),ee().createElement(fs,{id:"search_tags",name:"search_tags",checked:t.search_tags,onChange:n,label:(0,pe.__)("Search image tags","nggallery")}),ee().createElement(sc,{id:"search_mode",name:"search_mode",value:t.search_mode,onChange:n,label:(0,pe.__)("Database search mode","nggallery"),help:(0,pe.__)("A natural language search treats the requested string as a phrase in text without any operators except for quotation marks. A boolean search uses special rules and operators such as the plus and minus symbols.","nggallery")},ee().createElement("option",{value:"natural"},(0,pe.__)("Natural language","nggallery")),ee().createElement("option",{value:"boolean"},(0,pe.__)("Boolean","nggallery"))),ee().createElement(uc,{type:"number",name:"minimum_relevance",value:t.minimum_relevance,onChange:n,label:(0,pe.__)("Minimum relevance","nggallery"),help:(0,pe.__)("The database server assigns a relevance score to each possible image based on a number of factors with zero being not at all relevant. Users with smaller databases or images whose alttext or description only holds a few words will need a lower number here; possibly as low as 0.05. It is unlikely many users will need to raise this beyond one.","nggallery")}),ee().createElement(uc,{type:"number",name:"limit",value:t.limit,onChange:n,label:(0,pe.__)("Limit search results","nggallery"),help:(0,pe.__)("Limit search results to this amount. A setting of zero means no limitations are applied","nggallery")}),ee().createElement(fs,{id:"order_by_relevance",name:"order_by_relevance",checked:t.order_by_relevance,onChange:n,label:(0,pe.__)("Order by relevance first","nggallery"),help:(0,pe.__)("When enabled search results will be ordered by their relevance first, then by the secondary order setting","nggallery")}),ee().createElement(sc,{id:"order_by",name:"order_by",value:t.order_by,onChange:n,label:(0,pe.__)("Order search results by","nggallery")},ee().createElement("option",{value:"pid"},(0,pe.__)("Image ID","nggallery")),ee().createElement("option",{value:"galleryid"},(0,pe.__)("Gallery ID","nggallery")),ee().createElement("option",{value:"filename"},(0,pe.__)("Image filename","nggallery"))),ee().createElement(sc,{id:"order_direction",name:"order_direction",value:t.order_direction,onChange:n,label:(0,pe.__)("Order direction of search results","nggallery")},ee().createElement("option",{value:"ASC"},(0,pe.__)("Ascending","nggallery")),ee().createElement("option",{value:"DESC"},(0,pe.__)("Descending","nggallery"))),ee().createElement(sc,{id:"gallery_display_type",name:"gallery_display_type",value:t.gallery_display_type,onChange:n,label:(0,pe.__)("Gallery display type","nggallery"),help:(0,pe.__)("The display type used to render search results","nggallery")},ee().createElement("option",{value:"photocrati-nextgen_basic_thumbnails"},(0,pe.__)("Basic Thumbnails","nggallery")),ee().createElement("option",{value:"photocrati-nextgen_basic_slideshow"},(0,pe.__)("Basic Slideshow","nggallery")),ee().createElement("option",{value:"photocrati-nextgen_basic_imagebrowser"},(0,pe.__)("Basic ImageBrowser","nggallery")),ee().createElement("option",{value:"photocrati-nextgen_pro_thumbnail_grid"},(0,pe.__)("Pro Thumbnail Grid","nggallery")),ee().createElement("option",{value:"photocrati-nextgen_pro_blog_gallery"},(0,pe.__)("Pro Blog Gallery","nggallery")),ee().createElement("option",{value:"photocrati-nextgen_pro_imagebrowser"},(0,pe.__)("Pro ImageBrowser","nggallery")),ee().createElement("option",{value:"photocrati-nextgen_pro_slideshow"},(0,pe.__)("Pro Slideshow","nggallery"))))},Uf=function(e){var t=e.formState,n=e.handleInputChange;return ee().createElement(ee().Fragment,null,ee().createElement(fs,{id:"image_crop",name:"image_crop",checked:t.image_crop,onChange:n,label:(0,pe.__)("Crop images","nggallery")}),ee().createElement("div",{className:"ml-6 space-y-4"},t.image_crop&&ee().createElement(fs,{id:"image_pan",name:"image_pan",checked:t.image_pan,onChange:n,label:(0,pe.__)("Pan images","nggallery")}),!t.image_crop&&ee().createElement(ee().Fragment,null,ee().createElement(uc,{type:"number",name:"border_size",value:t.border_size,onChange:n,label:(0,pe.__)("Border size","nggallery"),help:(0,pe.__)('Borders will not be applied if "Crop Images" is enabled',"nggallery")}),ee().createElement(cc,null,(0,pe.__)("Border color","nggallery")),ee().createElement(Of,{color:t.border_color,onChange:function(e){n({target:{name:"border_color",value:e}})}}))),ee().createElement(fs,{id:"show_playback_controls",name:"show_playback_controls",checked:t.show_playback_controls,onChange:n,label:(0,pe.__)("Show play controls","nggallery")}),ee().createElement(fs,{id:"show_captions",name:"show_captions",checked:t.show_captions,onChange:n,label:(0,pe.__)("Show captions","nggallery")}),ni(t.show_captions)&&ee().createElement("div",{className:"ml-4 space-y-4"},ee().createElement(sc,{id:"caption_class",name:"caption_class",value:t.caption_class,onChange:n,label:(0,pe.__)("Caption location","nggallery")},ee().createElement("option",{value:"caption_above_stage"},(0,pe.__)("Top","nggallery")),ee().createElement("option",{value:"caption_below_stage"},(0,pe.__)("Bottom","nggallery")),ee().createElement("option",{value:"caption_overlay_top"},(0,pe.__)("Top (Overlay)","nggallery")),ee().createElement("option",{value:"caption_overlay_bottom"},(0,pe.__)("Bottom (Overlay)","nggallery"))),ee().createElement(uc,{type:"number",name:"caption_height",value:t.caption_height,onChange:n,label:(0,pe.__)("Caption height","nggallery"),help:(0,pe.__)("Measured in pixels","nggallery")})),ee().createElement(sc,{id:"aspect_ratio",name:"aspect_ratio",value:t.aspect_ratio,onChange:n,label:(0,pe.__)("Stage aspect ratio","nggallery")},ee().createElement("option",{value:"first_image"},(0,pe.__)("First Image","nggallery")),ee().createElement("option",{value:"image_average"},(0,pe.__)("Average","nggallery")),ee().createElement("option",{value:"1.5"},(0,pe.__)("3:2 [1.5]","nggallery")),ee().createElement("option",{value:"1.333"},(0,pe.__)("4:3 [1.333]","nggallery")),ee().createElement("option",{value:"1.777"},(0,pe.__)("16:9 [1.777]","nggallery")),ee().createElement("option",{value:"1.6"},(0,pe.__)("16:10 [1.6]","nggallery")),ee().createElement("option",{value:"1.85"},(0,pe.__)("1.85:1 [1.85]","nggallery")),ee().createElement("option",{value:"2.39"},(0,pe.__)("2.39:1 [2.39]","nggallery")),ee().createElement("option",{value:"1.81"},(0,pe.__)("1.81:1 [1.81]","nggallery")),ee().createElement("option",{value:"1"},(0,pe.__)("1:1 (Square) [1]","nggallery"))),ee().createElement(cc,null,(0,pe.__)("Gallery width","nggallery")),ee().createElement("div",{className:"flex items-end gap-2"},ee().createElement(uc,{type:"number",name:"width",value:t.width,onChange:n}),ee().createElement(sc,{id:"width_unit",name:"width_unit",value:t.width_unit,onChange:n},ee().createElement("option",{value:"%"},(0,pe.__)("Percent","nggallery")),ee().createElement("option",{value:"px"},(0,pe.__)("Pixels","nggallery")))),ee().createElement(sc,{id:"transition",name:"transition",value:t.transition,onChange:n,label:(0,pe.__)("Transition effect","nggallery")},ee().createElement("option",{value:"fade"},(0,pe.__)("Crossfade between images","nggallery")),ee().createElement("option",{value:"flash"},(0,pe.__)("Fades into background color between images","nggallery")),ee().createElement("option",{value:"pulse"},(0,pe.__)("Quickly move the image into the background color, then fade into the next image","nggallery")),ee().createElement("option",{value:"slide"},(0,pe.__)("Slide images depending on image position","nggallery")),ee().createElement("option",{value:"fadeslide"},(0,pe.__)("Fade between images and slide slightly at the same time","nggallery"))),ee().createElement(uc,{type:"number",name:"transition_speed",value:t.transition_speed,onChange:n,label:(0,pe.__)("Transition speed","nggallery"),help:(0,pe.__)("Measured in seconds","nggallery")}),ee().createElement(uc,{type:"number",name:"slideshow_speed",value:t.slideshow_speed,onChange:n,label:(0,pe.__)("Slideshow speed","nggallery"),help:(0,pe.__)("Measured in seconds","nggallery")}),ee().createElement(fs,{id:"override_thumbnail_settings",name:"override_thumbnail_settings",checked:t.override_thumbnail_settings,onChange:n,label:(0,pe.__)("Override thumbnail settings","nggallery"),help:(0,pe.__)("This does not affect existing thumbnails; overriding the thumbnail settings will create an additional set of thumbnails. To change the size of existing thumbnails please visit 'Manage Galleries' and choose 'Create new thumbnails' for all images in the gallery.","nggallery")}),t.override_thumbnail_settings&&ee().createElement("div",{className:"ml-6 space-y-4"},ee().createElement(sc,{id:"thumbnail_dimensions",name:"thumbnail_dimensions",value:t.thumbnail_dimensions,onChange:n,label:(0,pe.__)("Thumbnail dimensions","nggallery"),help:(0,pe.__)("These are maximum values","nggallery")},ee().createElement("option",{value:"240x160"},"240x160"),ee().createElement("option",{value:"custom"},(0,pe.__)("Custom","nggallery"))),"custom"===t.thumbnail_dimensions&&ee().createElement("div",{className:"flex gap-4"},ee().createElement(uc,{type:"number",name:"thumbnail_width",value:t.thumbnail_width,onChange:n}),ee().createElement(uc,{type:"number",name:"thumbnail_height",value:t.thumbnail_height,onChange:n}))),ee().createElement(Ef,{formState:t,handleInputChange:n}))},qf=function(e){var t=e.formState,n=e.handleInputChange;return ee().createElement(ee().Fragment,null,ee().createElement(fs,{id:"image_crop",name:"image_crop",checked:t.image_crop,onChange:n,label:(0,pe.__)("Crop images","nggallery")}),ee().createElement("div",{className:"ml-6 space-y-4"},t.image_crop&&ee().createElement(fs,{id:"image_pan",name:"image_pan",checked:t.image_pan,onChange:n,label:(0,pe.__)("Pan images","nggallery")}),!t.image_crop&&ee().createElement(ee().Fragment,null,ee().createElement(uc,{type:"number",name:"border_size",value:t.border_size,onChange:n,label:(0,pe.__)("Border size","nggallery"),help:(0,pe.__)('Borders will not be applied if "Crop Images" is enabled',"nggallery")}),ee().createElement(cc,null,(0,pe.__)("Border color","nggallery")),ee().createElement(Of,{color:t.border_color,onChange:function(e){n({target:{name:"border_color",value:e}})}}))),ee().createElement(fs,{id:"show_playback_controls",name:"show_playback_controls",checked:t.show_playback_controls,onChange:n,label:(0,pe.__)("Show play controls","nggallery")}),ee().createElement(fs,{id:"show_captions",name:"show_captions",checked:t.show_captions,onChange:n,label:(0,pe.__)("Show captions","nggallery")}),ni(t.show_captions)&&ee().createElement("div",{className:"ml-4 space-y-4"},ee().createElement(sc,{id:"caption_class",name:"caption_class",value:t.caption_class,onChange:n,label:(0,pe.__)("Caption location","nggallery")},ee().createElement("option",{value:"caption_above_stage"},(0,pe.__)("Top","nggallery")),ee().createElement("option",{value:"caption_below_stage"},(0,pe.__)("Bottom","nggallery")),ee().createElement("option",{value:"caption_overlay_top"},(0,pe.__)("Top (Overlay)","nggallery")),ee().createElement("option",{value:"caption_overlay_bottom"},(0,pe.__)("Bottom (Overlay)","nggallery"))),ee().createElement(uc,{type:"number",name:"caption_height",value:t.caption_height,onChange:n,label:(0,pe.__)("Caption height","nggallery"),help:(0,pe.__)("Measured in pixels","nggallery")})),ee().createElement(sc,{id:"aspect_ratio",name:"aspect_ratio",value:t.aspect_ratio,onChange:n,label:(0,pe.__)("Stage aspect ratio","nggallery")},ee().createElement("option",{value:"first_image"},(0,pe.__)("First Image","nggallery")),ee().createElement("option",{value:"image_average"},(0,pe.__)("Average","nggallery")),ee().createElement("option",{value:"1.5"},(0,pe.__)("3:2 [1.5]","nggallery")),ee().createElement("option",{value:"1.333"},(0,pe.__)("4:3 [1.333]","nggallery")),ee().createElement("option",{value:"1.777"},(0,pe.__)("16:9 [1.777]","nggallery")),ee().createElement("option",{value:"1.6"},(0,pe.__)("16:10 [1.6]","nggallery")),ee().createElement("option",{value:"1.85"},(0,pe.__)("1.85:1 [1.85]","nggallery")),ee().createElement("option",{value:"2.39"},(0,pe.__)("2.39:1 [2.39]","nggallery")),ee().createElement("option",{value:"1.81"},(0,pe.__)("1.81:1 [1.81]","nggallery")),ee().createElement("option",{value:"1"},(0,pe.__)("1:1 (Square) [1]","nggallery"))),ee().createElement(cc,null,(0,pe.__)("Gallery width","nggallery")),ee().createElement("div",{className:"flex items-end gap-2"},ee().createElement(uc,{type:"number",name:"width",value:t.width,onChange:n}),ee().createElement(sc,{id:"width_unit",name:"width_unit",value:t.width_unit,onChange:n},ee().createElement("option",{value:"%"},(0,pe.__)("Percent","nggallery")),ee().createElement("option",{value:"px"},(0,pe.__)("Pixels","nggallery")))),ee().createElement(sc,{id:"transition",name:"transition",value:t.transition,onChange:n,label:(0,pe.__)("Transition effect","nggallery")},ee().createElement("option",{value:"fade"},(0,pe.__)("Crossfade between images","nggallery")),ee().createElement("option",{value:"flash"},(0,pe.__)("Fades into background color between images","nggallery")),ee().createElement("option",{value:"pulse"},(0,pe.__)("Quickly move the image into the background color, then fade into the next image","nggallery")),ee().createElement("option",{value:"slide"},(0,pe.__)("Slide images depending on image position","nggallery")),ee().createElement("option",{value:"fadeslide"},(0,pe.__)("Fade between images and slide slightly at the same time","nggallery"))),ee().createElement(uc,{type:"number",name:"transition_speed",value:t.transition_speed,onChange:n,label:(0,pe.__)("Transition speed","nggallery"),help:(0,pe.__)("Measured in seconds","nggallery")}),ee().createElement(uc,{type:"number",name:"slideshow_speed",value:t.slideshow_speed,onChange:n,label:(0,pe.__)("Slideshow speed","nggallery"),help:(0,pe.__)("Measured in seconds","nggallery")}),ee().createElement(fs,{id:"override_thumbnail_settings",name:"override_thumbnail_settings",checked:t.override_thumbnail_settings,onChange:n,label:(0,pe.__)("Override thumbnail settings","nggallery"),help:(0,pe.__)("This does not affect existing thumbnails; overriding the thumbnail settings will create an additional set of thumbnails. To change the size of existing thumbnails please visit 'Manage Galleries' and choose 'Create new thumbnails' for all images in the gallery.","nggallery")}),t.override_thumbnail_settings&&ee().createElement("div",{className:"ml-6 space-y-4"},ee().createElement(sc,{id:"thumbnail_dimensions",name:"thumbnail_dimensions",value:t.thumbnail_dimensions,onChange:n,label:(0,pe.__)("Thumbnail dimensions","nggallery"),help:(0,pe.__)("These are maximum values","nggallery")},ee().createElement("option",{value:"240x160"},"240x160"),ee().createElement("option",{value:"custom"},(0,pe.__)("Custom","nggallery"))),"custom"===t.thumbnail_dimensions&&ee().createElement("div",{className:"flex gap-4"},ee().createElement(uc,{type:"number",name:"thumbnail_width",value:t.thumbnail_width,onChange:n}),ee().createElement(uc,{type:"number",name:"thumbnail_height",value:t.thumbnail_height,onChange:n}))),ee().createElement(Ef,{formState:t,handleInputChange:n}))};function Qf(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return Wf(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Wf(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Wf(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,Wf(m,"constructor",s),Wf(s,"constructor",c),c.displayName="GeneratorFunction",Wf(s,a,"GeneratorFunction"),Wf(m),Wf(m,a,"Generator"),Wf(m,r,function(){return this}),Wf(m,"toString",function(){return"[object Generator]"}),(Qf=function(){return{w:o,m:d}})()}function Wf(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}Wf=function(e,t,n,r){function o(t,n){Wf(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Wf(e,t,n,r)}function Hf(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Vf(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Hf(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Hf(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}const Kf=function(e){var t,r,a=e.gallery,o=e.previewMode,l=e.onPreviewModeChange,i=(0,ge.useSelect)(function(e){return e(Br).getCurrentId()},[]),c=kl(i).data,s=Nl(a)||Nl(c||null),u=El(a)||El(c||null),m=Cl(a)||Cl(c||null),d=u||m,g=u?"tiktok":m?"dribbble":null,p=Rl(null!=i?i:null,g),f=Ml(null!=i?i:null,u),y=f.data,h=f.refetch;!function(e){var t=re();ee().useEffect(function(){return function(){e&&t.refetchQueries({queryKey:["galleries"]})}},[e,t])}(d);var b=re(),v=(null===(t=window.imagelyApp)||void 0===t?void 0:t.proTypeInstalled)||"lite",_=(0,$.useMemo)(function(){return function(e){switch(e){case"lite":default:return pf;case"starter":return ff;case"pro":case"plus":return Vp().map(function(e){return e.id})}}(v)},[v]),w=vo((0,$.useState)(null),2),x=w[0],E=w[1],C=af({type:"gallery",item:c,includeEcommerce:!1}),N=(null===(r=c||a)||void 0===r?void 0:r.display_type)||"photocrati-nextgen_basic_thumbnails",k=iu(),S=k.getCurrentDisplayTypeSettings,O=k.getDisplayTypeSettings,P=k.updateDisplayTypeSettings,j=k.updateField,T=k.registerFlushCallback,I=k.unregisterFlushCallback,A=Ol(),D=$o(),L=D.showSuccess,F=D.showError,M=(0,$.useRef)(null),R=(0,$.useRef)(null),G=(0,$.useCallback)(function(){M.current&&(clearTimeout(M.current),M.current=null),R.current&&(R.current(),R.current=null)},[]);(0,$.useEffect)(function(){return T("customizeTab",G),G(),function(){G(),I("customizeTab")}},[N,G,T,I]),(0,$.useEffect)(function(){var e,t,n=c||a;if(N&&n){var r=ii(((null==n?void 0:n.display_type_settings)||{})[N]||{});if("photocrati-nextgen_pro_masonry"===N){var o,l,i,s,u=String(null!==(o=null!==(l=r.size)&&void 0!==l?l:r.maximum_image_width)&&void 0!==o?o:"180"),m=String(null!==(i=null!==(s=r.padding)&&void 0!==s?s:r.image_padding)&&void 0!==i?i:"10");r=Vf(Vf({},r),{},{size:u,padding:m,maximum_image_width:u,image_padding:m})}var d=Vf(Vf({},(t={},["photocrati-nextgen_basic_imagebrowser","photocrati-nextgen_basic_singlepic","photocrati-nextgen_basic_thumbnails","photocrati-nextgen_basic_slideshow","photocrati-nextgen_basic_compact_album","photocrati-nextgen_basic_extended_album","photocrati-nextgen_pro_thumbnail_grid","photocrati-nextgen_pro_blog_gallery","photocrati-nextgen_pro_imagebrowser","photocrati-nextgen_pro_sidescroll","photocrati-nextgen_pro_film","photocrati-nextgen_pro_tile","photocrati-nextgen_pro_mosaic","photocrati-nextgen_pro_masonry","photocrati-nextgen_pro_grid_album","photocrati-nextgen_pro_list_album"].includes(e=N)&&(t.animate_images_duration="1500",t.animate_images_delay="250",t.animate_pagination_duration="1500",t.animate_pagination_delay="250"),"imagely-pro-search"===e&&(t.search_alttext=!0,t.search_description=!0,t.search_tags=!0,t.enable_tag_filter=!0,t.search_mode="natural",t.limit="0",t.order_by="pid",t.order_direction="ASC",t.order_by_relevance=!0,t.minimum_relevance="1",t.gallery_display_type="photocrati-nextgen_basic_thumbnails",t.use_lightbox_effect=!0),["photocrati-nextgen_pro_thumbnail_grid","photocrati-nextgen_pro_blog_gallery","photocrati-nextgen_pro_imagebrowser"].includes(e)&&(t.display_type_view="default"),"photocrati-nextgen_pro_mosaic"===e&&(t.images_to_load_on_scroll="15",t.images_to_display_at_start="15"),"photocrati-nextgen_pro_masonry"===e&&(t.size="180",t.padding="10",t.maximum_image_width="180",t.image_padding="10",t.center_gallery=!1),"photocrati-nextgen_pro_slideshow"===e&&(t.aspect_ratio="1.5",t.width="100",t.width_unit="%"),t)),r);P(N,d)}},[N,null==c?void 0:c.display_type_settings,null==c?void 0:c.gid,null==a?void 0:a.display_type_settings,null==a?void 0:a.gid,P]);var B=function(){var e=No(Qf().m(function e(t){var n;return Qf().w(function(e){for(;;)switch(e.p=e.n){case 0:if(a){e.n=1;break}return e.a(2);case 1:if(E(t),_.includes(t)){e.n=2;break}return e.a(2);case 2:return j("display_type",t),e.p=3,e.n=4,A.mutateAsync({id:a.gid,data:{display_type:t}});case 4:L((0,pe.__)("Layout changed successfully!","nggallery")),e.n=6;break;case 5:e.p=5,n=e.v,F((0,pe.__)("Failed to change layout. Please try again.","nggallery")),console.error("Error changing layout:",n);case 6:return e.a(2)}},e,null,[[3,5]])}));return function(t){return e.apply(this,arguments)}}(),z=(0,$.useCallback)(function(){var e=No(Qf().m(function e(t,n,r){var a;return Qf().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,A.mutateAsync({id:t,data:{display_type:n,display_type_settings:r}});case 1:e.n=3;break;case 2:e.p=2,a=e.v,F((0,pe.__)("Failed to update display settings. Changes have been reverted.","nggallery")),console.error("Error updating display settings:",a);case 3:return e.a(2)}},e,null,[[0,2]])}));return function(t,n,r){return e.apply(this,arguments)}}(),[A,F]),U=(0,$.useRef)(O);(0,$.useEffect)(function(){U.current=O});var q=(0,$.useCallback)(function(e){var t=e.target,r=t.name,o=t.value,l="checkbox"===t.type?e.target.checked:o;if(N){var i="photocrati-nextgen_pro_masonry"===N&&"string"==typeof l?"size"===r?{maximum_image_width:l}:"padding"===r?{image_padding:l}:{}:{};P(N,Vf(n({},r,l),i));var s=c||a;if(s){M.current&&clearTimeout(M.current);var u=N,m=s.gid,d=s.display_type_settings,g=function(){var e=U.current(u),t={};Object.entries(e).forEach(function(e){var n=vo(e,2),r=n[0],a=n[1];t[r]="boolean"==typeof a?ri(a):a});var r=Vf(Vf({},d),{},n({},u,Vf(Vf({},(null==d?void 0:d[u])||{}),t)));z(m,u,r)};R.current=g,M.current=window.setTimeout(function(){g(),R.current=null},1e3)}}},[N,c,a,P,z]),Q=S(),W=x&&!_.includes(x);return ee().createElement("div",{className:"bg-white rounded-lg shadow lg:grid lg:grid-cols-2 lg:items-start"},ee().createElement("div",{className:"px-6 py-6 lg:px-8 lg:py-8 border-b lg:border-b-0 lg:border-r"},ee().createElement("div",{className:"space-y-4"},ee().createElement("h1",{className:"text-lg font-medium"},(0,pe.__)("Customize","nggallery")),ee().createElement(nf,{title:(0,pe.__)("Choose Layout","nggallery"),defaultExpanded:!0,className:"mb-4"},ee().createElement("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-2 sm:gap-4"},Vp().map(function(e){var t=_.includes(e.id),n=(x||N)===e.id;return ee().createElement("div",{key:e.id,className:"flex flex-col items-center text-center"},ee().createElement("div",{className:"relative p-1 border rounded-md cursor-pointer transition-all duration-200 w-full ".concat(n?"border-green-500":t?"border-gray-600 hover:border-green-500":"border-gray-200 hover:border-green-500"),onClick:function(){return B(e.id)}},ee().createElement("div",{className:"flex items-center justify-center ".concat(n?"text-gray-600":"text-gray-200 hover:text-gray-600")},ee().createElement("div",{className:"w-12 h-8 sm:w-16 sm:h-12 flex items-center justify-center"},e.icon))),ee().createElement("h3",{className:"text-xs sm:text-xs font-medium mt-1 sm:mt-2 ".concat(t?"text-gray-300":"text-gray-400")},e.name))}))),Q&&ee().createElement("div",{className:W?"opacity-50 pointer-events-none":""},ee().createElement(nf,{title:(0,pe.__)("Customize Gallery Look","nggallery"),defaultExpanded:!0,className:"mb-4"},ee().createElement("div",{className:"space-y-4"},"photocrati-nextgen_basic_slideshow"===N&&ee().createElement(wf,{formState:Q,handleInputChange:q}),"photocrati-nextgen_basic_thumbnails"===N&&ee().createElement(kf,{formState:Q,handleInputChange:q}),"photocrati-nextgen_pro_thumbnail_grid"===N&&ee().createElement(jf,{formState:Q,handleInputChange:q}),"photocrati-nextgen_basic_imagebrowser"===N&&ee().createElement(Tf,{formState:Q,handleInputChange:q}),"photocrati-nextgen_basic_tagcloud"===N&&ee().createElement(Af,{formState:Q,handleInputChange:q}),"photocrati-nextgen_pro_blog_gallery"===N&&ee().createElement(Df,{formState:Q,handleInputChange:q}),"photocrati-nextgen_pro_imagebrowser"===N&&ee().createElement(Lf,{formState:Q,handleInputChange:q}),"photocrati-nextgen_pro_sidescroll"===N&&ee().createElement(Ff,{formState:Q,handleInputChange:q}),"photocrati-nextgen_pro_film"===N&&ee().createElement(Mf,{formState:Q,handleInputChange:q}),"photocrati-nextgen_pro_tile"===N&&ee().createElement(Rf,{formState:Q,handleInputChange:q}),"photocrati-nextgen_pro_mosaic"===N&&ee().createElement(Gf,{formState:Q,handleInputChange:q}),"photocrati-nextgen_pro_masonry"===N&&ee().createElement(Bf,{formState:Q,handleInputChange:q}),"imagely-pro-search"===N&&ee().createElement(zf,{formState:Q,handleInputChange:q}),"photocrati-nextgen_pro_horizontal_filmstrip"===N&&ee().createElement(Uf,{formState:Q,handleInputChange:q}),"photocrati-nextgen_pro_slideshow"===N&&ee().createElement(qf,{formState:Q,handleInputChange:q})))))),ee().createElement("div",{className:"px-6 py-6 lg:px-8 lg:py-8 lg:sticky lg:top-8 lg:max-h-screen"},W?ee().createElement(yf,null):ee().createElement(gf,{previewMode:o,onPreviewModeChange:l,url:C,title:(0,pe.__)("Gallery Preview","nggallery"),showReFetchButton:!!g,onReFetchAndUpdateCache:g&&i?No(Qf().m(function e(){return Qf().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,p.mutateAsync();case 1:return e.a(2)}},e)})):void 0,isReFetching:p.isPending,onPreviewLoad:s?function(){u&&h(),i&&(b.invalidateQueries({queryKey:xl(i)}),b.invalidateQueries({queryKey:wl(i)}),b.invalidateQueries({queryKey:["galleries"]}))}:void 0,tiktokErrorNotice:u&&null!=y&&y.has_errors?{hasErrors:!!y.has_errors}:void 0,customLoadingMessage:u?(0,pe.__)("Fetching TikTok videos, this may take a moment. Please wait.","nggallery"):void 0})))},Xf=function(e){var t=e.currentPage,n=e.totalPages,r=e.perPage,a=e.total,o=e.onPageChange,l=e.itemLabel,i=void 0===l?"Items":l,c=e.showItemCount,s=void 0===c||c,u=vo((0,$.useState)(""),2),m=u[0],d=u[1],g=vo((0,$.useState)(!1),2),p=g[0],f=g[1];(0,$.useEffect)(function(){d("")},[t]);var y=function(){var e=parseInt(m,10);e>=1&&e<=n&&(o(e),d(""),f(!1))},h=Array.from({length:n},function(e,t){return t+1}).filter(function(e){return 1===e||e===n||Math.abs(e-t)<=1});return ee().createElement("div",{className:"flex justify-between items-center mt-4 px-2 gap-4 flex-wrap"},s&&a>0&&ee().createElement("div",{className:"text-sm text-gray-600"},(t-1)*r+1,"-",Math.min(t*r,a)," of ",a," ",i),n>1&&ee().createElement("div",{className:"flex gap-2 items-center flex-wrap"},ee().createElement("button",{type:"button",className:"p-2 border border-gray-300 bg-white text-gray-700 hover:bg-gray-50 rounded-md disabled:opacity-50 disabled:cursor-not-allowed",onClick:function(){return o(t-1)},disabled:1===t,title:(0,pe.__)("Previous page","nggallery")},ee().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-5 h-5"},ee().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 19.5L8.25 12l7.5-7.5"}))),h.map(function(e,n,r){return n>0&&e-r[n-1]>1?ee().createElement(ee().Fragment,{key:"ellipsis-".concat(e)},ee().createElement("span",{className:"px-2 py-1 text-gray-500"},"..."),ee().createElement("button",{type:"button",className:"min-w-[40px] px-3 py-2 border border-gray-300 bg-white rounded-md text-sm font-medium transition-colors ".concat(t===e?"bg-blue-50 text-blue-600 border-blue-300 cursor-default":"text-gray-700 hover:bg-gray-50 cursor-pointer"),onClick:function(){return t!==e&&o(e)}},e)):ee().createElement("button",{type:"button",key:e,className:"min-w-[40px] px-3 py-2 border border-gray-300 bg-white rounded-md text-sm font-medium transition-colors ".concat(t===e?"bg-blue-50 text-blue-600 border-blue-300 cursor-default":"text-gray-700 hover:bg-gray-50 cursor-pointer"),onClick:function(){return t!==e&&o(e)}},e)}),ee().createElement("button",{type:"button",className:"p-2 border border-gray-300 bg-white text-gray-700 hover:bg-gray-50 rounded-md disabled:opacity-50 disabled:cursor-not-allowed",onClick:function(){return o(t+1)},disabled:t===n,title:(0,pe.__)("Next page","nggallery")},ee().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-5 h-5"},ee().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 4.5l7.5 7.5-7.5 7.5"}))),n>5&&ee().createElement("div",{className:"flex items-center gap-2 ml-2 pl-2 border-l border-gray-300"},p?ee().createElement("div",{className:"flex items-center gap-2"},ee().createElement("input",{type:"number",min:"1",max:n,value:m,onChange:function(e){return d(e.target.value)},onKeyDown:function(e){"Enter"===e.key?y():"Escape"===e.key&&(d(""),f(!1))},placeholder:(0,pe.__)("Page","nggallery"),className:"w-20 px-2 py-1 text-sm border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",autoFocus:!0}),ee().createElement("button",{type:"button",className:"px-3 py-1 text-sm bg-blue-600 text-white hover:bg-blue-700 rounded-md disabled:opacity-50 disabled:cursor-not-allowed",onClick:y,disabled:!m||parseInt(m,10)<1||parseInt(m,10)>n},(0,pe.__)("Go","nggallery")),ee().createElement("button",{type:"button",className:"px-2 py-1 text-sm text-gray-600 hover:text-gray-800",onClick:function(){d(""),f(!1)},title:(0,pe.__)("Cancel","nggallery")},ee().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor",className:"w-4 h-4"},ee().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})))):ee().createElement("button",{type:"button",className:"px-3 py-2 text-sm border border-gray-300 bg-white text-gray-700 hover:bg-gray-50 rounded-md whitespace-nowrap",onClick:function(){return f(!0)},title:(0,pe.__)("Jump to a specific page","nggallery")},(0,pe.__)("Go to page","nggallery")))))};var Yf=function(e){var t=e.page,n=e.isCurrent,r=e.onFire,a=Ud({id:"page-drop-".concat(t),disabled:n,data:{page:t}}),o=a.isOver,l=a.setNodeRef,i=vo((0,$.useState)(!1),2),c=i[0],s=i[1];(0,$.useEffect)(function(){if(o&&!n){s(!0);var e=window.setTimeout(function(){s(!1),r(t)},1200);return function(){return window.clearTimeout(e)}}s(!1)},[o,n,t,r]);var u="bg-white border-gray-300 text-gray-700 hover:bg-gray-50";return n?u="bg-blue-50 border-blue-300 text-blue-600 cursor-default":c&&(u="page-chip-bounce bg-blue-50 border-blue-400 text-blue-700"),ee().createElement("div",{ref:l,className:"".concat("min-w-[44px] h-11 px-3 border rounded-md text-base font-medium flex items-center justify-center select-none transition-colors"," ").concat(u),"aria-current":n?"page":void 0,"aria-disabled":n},t)};const Zf=function(e){var t=e.currentPage,n=e.totalPages,r=e.onPaginate,a=(0,$.useRef)(null);return(0,$.useEffect)(function(){var e=a.current;if(e){var n=e.children[t-1];if(n){var r=n.offsetLeft+n.offsetWidth/2;e.scrollLeft=Math.max(0,r-e.clientWidth/2)}}},[]),ee().createElement("div",{className:"fixed left-1/2 -translate-x-1/2 bottom-8 z-50 max-w-[min(90vw,900px)] w-max bg-white/95 backdrop-blur-sm border border-gray-200 rounded-2xl shadow-2xl px-6 py-4",role:"region","aria-label":(0,pe.__)("Page navigator","nggallery")},ee().createElement("div",{className:"text-sm font-semibold text-gray-700 mb-3 text-center"},(0,pe.__)("Hover a page to navigate","nggallery")),ee().createElement("div",{ref:a,className:"flex gap-2 overflow-x-auto pb-1",style:{scrollbarWidth:"thin"}},Array.from({length:n},function(e,t){return t+1}).map(function(e){return ee().createElement(Yf,{key:e,page:e,isCurrent:e===t,onFire:r})})),ee().createElement("style",null,"\n\t\t\t\t.page-chip-bounce {\n\t\t\t\t\tanimation: page-chip-blink 0.4s ease-in-out infinite;\n\t\t\t\t\twill-change: opacity;\n\t\t\t\t}\n\t\t\t\t@keyframes page-chip-blink {\n\t\t\t\t\t0% { opacity: 1; }\n\t\t\t\t\t50% { opacity: 0.3; }\n\t\t\t\t\t100% { opacity: 1; }\n\t\t\t\t}\n\t\t\t"))};function Jf(e,t){return t<0||t>=e.length?null:t>0?{after_pid:e[t-1]}:e.length>1?{before_pid:e[t+1]}:null}function $f(e){if(null!=e){var n=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],r=0;if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}throw new TypeError(t(e)+" is not iterable")}function ey(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return ty(e,t);var n={}.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)?ty(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,l=!0,i=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return l=e.done,e},e:function(e){i=!0,o=e},f:function(){try{l||null==n.return||n.return()}finally{if(i)throw o}}}}function ty(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ny(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return ry(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(ry(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,ry(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,ry(m,"constructor",s),ry(s,"constructor",c),c.displayName="GeneratorFunction",ry(s,a,"GeneratorFunction"),ry(m),ry(m,a,"Generator"),ry(m,r,function(){return this}),ry(m,"toString",function(){return"[object Generator]"}),(ny=function(){return{w:o,m:d}})()}function ry(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}ry=function(e,t,n,r){function o(t,n){ry(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},ry(e,t,n,r)}function ay(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function oy(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ay(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ay(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var ly=function(e){var t=null==e?void 0:e.page;return"number"==typeof t?t:null},iy=function(e){var t=e.onClick;return ee().createElement("div",{className:"relative w-full"},ee().createElement("div",{className:"relative bg-gray-100 rounded-lg border-2 border-dashed border-gray-300 hover:border-gray-400 cursor-pointer transition-colors w-full h-[90px] sm:h-[100px] md:w-[130px] md:h-[90px]",onClick:t},ee().createElement("div",{className:"absolute inset-0 flex flex-col items-center justify-center"},ee().createElement(ln,{className:"w-6 h-6 sm:w-8 sm:h-8 text-gray-400 mb-1 sm:mb-2"}),ee().createElement("span",{className:"text-xs sm:text-sm text-gray-500 font-medium"},(0,pe.__)("Add Images","nggallery")))))};const cy=function(e){var t,n,r=e.gallery,a=e.error,o=(0,ge.useDispatch)(Br),l=iu(),i=l.state,c=l.updateImageSettings,s=Cs(),u=s.navigateTo,m=s.currentId,d=$o(),g=d.showSuccess,p=d.showError,f=gi().data,y=(null==f?void 0:f.item_details_per_page)||50,h=(null==r?void 0:r.gid)||m,b=re(),v=Il(),_=wc(),w=Ol(),x=Ll(),E=Fl(),C=gl({mutationFn:(n=No(vl().m(function e(t){var n;return vl().w(function(e){for(;;)switch(e.n){case 0:return n=Fo("create-thumbnail"),e.n=1,n(t);case 1:return e.a(2,e.v)}},e)})),function(e){return n.apply(this,arguments)})}),N=function(){var e,t=re();return gl({mutationFn:(e=No(vl().m(function e(t){var n;return vl().w(function(e){for(;;)switch(e.n){case 0:return n=Fo("set-watermark"),e.n=1,n(t);case 1:return e.a(2,e.v)}},e)})),function(t){return e.apply(this,arguments)}),onSuccess:function(){t.invalidateQueries({queryKey:["images"]}),t.invalidateQueries({queryKey:["gallery"]})}})}(),k=function(){var e,t=re();return gl({mutationFn:(e=No(vl().m(function e(t){var n;return vl().w(function(e){for(;;)switch(e.n){case 0:return n=Mo("bulk-import-metadata"),e.n=1,n({image_ids:t});case 1:return e.a(2,e.v)}},e)})),function(t){return e.apply(this,arguments)}),onSuccess:function(){t.invalidateQueries({queryKey:["images"]}),t.invalidateQueries({queryKey:["gallery"]})}})}(),S=function(){var e,t=re();return gl({mutationFn:(e=No(vl().m(function e(t){return vl().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,Oo()({path:"/imagely/v1/galleries/".concat(t,"/scan-folder"),method:"POST",headers:Do()});case 1:return e.a(2,e.v)}},e)})),function(t){return e.apply(this,arguments)}),onSuccess:function(e,n){t.invalidateQueries({queryKey:xl(n)}),t.invalidateQueries({queryKey:wl(n)}),t.invalidateQueries({queryKey:["galleries"]})}})}(),O=vo((0,$.useState)([]),2),P=O[0],j=O[1],T=vo((0,$.useState)(null),2),I=T[0],A=T[1],D=vo((0,$.useState)(null),2),L=D[0],F=D[1],M=vo((0,$.useState)(!1),2),R=M[0],G=M[1],B=vo((0,$.useState)(!1),2),z=B[0],U=B[1],q=vo((0,$.useState)(new Set),2),Q=q[0],W=q[1],H=vo((0,$.useState)(!1),2),V=H[0],K=H[1],X=new Set(i.imageSettings.selectedImages||[]),Y=function(e){try{c({selectedImages:Array.from(e)})}catch(e){console.error("Error updating image settings:",e)}},Z=cm(im(ad,{activationConstraint:{distance:8,delay:100,tolerance:10}}),im($m,{coordinateGetter:bg})),J=kl(null!=h?h:0),te=J.data,ne=J.isLoading,ae=J.error,oe=J.isError,le=vo((0,$.useState)(1),2),ie=le[0],ce=le[1],se=Pl(null!=h?h:0,{per_page:y,page:ie}),ue=se.data,me=se.isLoading,de=se.error,fe=(null==ue?void 0:ue.images)||[],he=(null==ue?void 0:ue.pagination)||{total:0,total_pages:1,per_page:y,current_page:ie};(0,$.useEffect)(function(){ce(1)},[h]);var be=he.total,ve=he.total_pages,_e=(0,$.useRef)(ve);(0,$.useEffect)(function(){_e.current=ve},[h]),(0,$.useEffect)(function(){ve>1&&(_e.current=ve)},[ve]);var we=ve>1?ve:_e.current,xe=(0,$.useCallback)(function(e){ce(e),window.scrollTo({top:0,behavior:"smooth"})},[]),Ee=(0,$.useRef)(!1);(0,$.useEffect)(function(){ae&&h&&!Ee.current&&(Ee.current=!0,p((0,pe.__)("Gallery not found.","nggallery")),u("imagely-galleries","galleries"))},[ae,h,p,u]),(0,$.useEffect)(function(){oe&&h&&!ae&&!Ee.current&&(Ee.current=!0,p((0,pe.__)("Gallery not found.","nggallery")),u("imagely-galleries","galleries"))},[oe,h,ae,p,u]);var Ce=te||r;(0,$.useEffect)(function(){fe.length>0&&j(fe)},[fe]);var Ne=(0,$.useCallback)(function(e){var t=e.active,n=e.over;if(n&&L&&null===ly(n.data.current)){var r=t.id;if(!fe.some(function(e){return e.pid===r})){var a=n.id;r!==a&&j(function(e){var t=e.findIndex(function(e){return e.pid===a});if(-1===t)return e;var n=e.findIndex(function(e){return e.pid===r});if(-1===n){var o=ko(e);return o.splice(t,0,L),o}return n===t?e:eg(e,n,t)})}}},[L,fe]),ke=function(){var e,t=re();return gl({mutationFn:(e=No(vl().m(function e(t){var n,r;return vl().w(function(e){for(;;)switch(e.n){case 0:return n=t.pid,r=ye(t,pl),e.n=1,Oo()({path:"/imagely/v1/images/".concat(n,"/move"),method:"POST",headers:Do(),data:r});case 1:return e.a(2,e.v)}},e)})),function(t){return e.apply(this,arguments)}),onSettled:function(e,n,r){t.invalidateQueries({queryKey:xl(r.gallery_id)})}})}(),Se=(0,$.useCallback)(function(){var e=No(ny().m(function e(t){var n,r,a,o,l,i,c,s,u,m,d,g;return ny().w(function(e){for(;;)switch(e.p=e.n){case 0:if(n=t.active,r=t.over,A(null),F(null),a=function(){fe.length>0&&j(fe)},r&&h){e.n=1;break}return a(),e.a(2);case 1:if(null===ly(r.data.current)){e.n=2;break}return a(),e.a(2);case 2:if(o=n.id,l=!fe.some(function(e){return e.pid===o}),i=P.map(function(e){return e.pid}),!l){e.n=3;break}c=Jf(i,i.indexOf(o)),e.n=6;break;case 3:if(s=r.id,o!==s){e.n=4;break}return a(),e.a(2);case 4:if(u=i.indexOf(o),m=i.indexOf(s),-1!==u&&-1!==m){e.n=5;break}return a(),e.a(2);case 5:d=eg(P,u,m),j(d),c=Jf(d.map(function(e){return e.pid}),m);case 6:if(c){e.n=7;break}return a(),e.a(2);case 7:return e.p=7,e.n=8,ke.mutateAsync(oy({pid:o,gallery_id:h},c));case 8:e.n=10;break;case 9:e.p=9,g=e.v,console.error("Error reordering images:",g),p((0,pe.__)("Failed to reorder images","nggallery")),b.invalidateQueries({queryKey:["gallery",h,"images"]});case 10:window.navigator.vibrate&&window.navigator.vibrate([50,50,50]);case 11:return e.a(2)}},e,null,[[7,9]])}));return function(t){return e.apply(this,arguments)}}(),[h,fe,ke,P,b,p]),Oe=(0,$.useCallback)(function(){A(null),F(null),fe.length>0&&j(fe)},[fe]),Pe=(0,$.useCallback)(function(e){ce(e)},[]),je=(0,$.useMemo)(function(){return P.map(function(e){return e.pid})},[P]),Te=(0,$.useCallback)(function(e){var t=e.droppableContainers.filter(function(e){return null!==ly(e.data.current)}),n=e.droppableContainers.filter(function(e){return null===ly(e.data.current)});if(t.length>0)if(e.pointerCoordinates){var r=wm(oy(oy({},e),{},{droppableContainers:t}));if(r.length>0)return r}else{var a=hm(oy(oy({},e),{},{droppableContainers:t}));if(a.length>0)return a}return hm(oy(oy({},e),{},{droppableContainers:n}))},[]),Ie=function(){var e=No(ny().m(function e(t){var n,a,o,l,i;return ny().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r&&h){e.n=1;break}return p((0,pe.__)("Cannot sort: Gallery not loaded","nggallery")),e.a(2);case 1:return e.p=1,c({sortBy:t,sortOrder:"asc"}),g((0,pe.__)("Sorting images...","nggallery")),n=Ao(),e.n=2,Oo()({path:"/imagely/v1/images?gallery_id=".concat(h,"&per_page=-1&orderby=sortorder&order=asc"),method:"GET",headers:{"X-WP-Nonce":n}});case 2:if(a=e.v,Array.isArray(a)&&0!==a.length){e.n=3;break}return p((0,pe.__)("No images found to sort","nggallery")),e.a(2);case 3:return o=ko(a),"invert"===t?o.reverse():o.sort(function(e,n){switch(t){case"pid":return e.pid-n.pid;case"filename":return(e.filename||"").localeCompare(n.filename||"");case"alttext":return(e.alttext||"").localeCompare(n.alttext||"");case"imagedate":return new Date(n.imagedate||0).getTime()-new Date(e.imagedate||0).getTime();default:return 0}}),l=o.map(function(e,t){return{id:e.pid,sortorder:t+1}}),e.n=4,v.mutateAsync({images:l});case 4:return e.n=5,b.invalidateQueries({queryKey:["galleryImages",h]});case 5:g((0,pe.__)("Images sorted successfully!","nggallery")),e.n=7;break;case 6:e.p=6,i=e.v,p((0,pe.__)("Failed to sort images: ","nggallery")+(i instanceof Error?i.message:String(i)));case 7:return e.a(2)}},e,null,[[1,6]])}));return function(t){return e.apply(this,arguments)}}(),Ae=function(e){var t=new Set(X);t.has(e)?t.delete(e):t.add(e),Y(t)},De=function(e){var t;o.setActiveModal("deleteImages",{images:[e],onClose:function(){return o.setActiveModal(null)},onConfirm:(t=No(ny().m(function t(){return ny().w(function(t){for(;;)switch(t.n){case 0:return j(function(t){return t.filter(function(t){return t.pid!==e.pid})}),t.n=1,o.deleteItem("images",e.pid);case 1:o.setActiveModal(null);case 2:return t.a(2)}},t)})),function(){return t.apply(this,arguments)})})},Le=function(){var e=No(ny().m(function e(t){var n,r,a,o;return ny().w(function(e){for(;;)switch(e.p=e.n){case 0:return W(function(e){return new Set(e).add(t)}),e.p=1,e.n=2,E.mutateAsync(t);case 2:n=e.v,r=(null==n?void 0:n.updated_at)||Date.now(),h&&b.setQueriesData({queryKey:["gallery",h,"images"]},function(e){return null!=e&&e.images?oy(oy({},e),{},{images:e.images.map(function(e){return e.pid===t?oy(oy({},e),{},{reloadKey:r}):e})}):e}),Ce&&Ce.previewpic===t&&(a=zc(Ce.previewpic_url,r),b.setQueryData(["gallery",Ce.gid],function(e){return e?oy(oy({},e),{},{previewpic_url:a}):e}),b.setQueriesData({queryKey:["galleries"]},function(e){return null!=e&&e.galleries?oy(oy({},e),{},{galleries:e.galleries.map(function(e){return e.gid===Ce.gid?oy(oy({},e),{},{previewpic_url:a}):e})}):e})),e.n=4;break;case 3:e.p=3,o=e.v,console.error("Error recovering image",o);case 4:return e.p=4,W(function(e){var n=new Set(e);return n.delete(t),n}),e.f(4);case 5:return e.a(2)}},e,null,[[1,3,4,5]])}));return function(t){return e.apply(this,arguments)}}(),Fe=function(){var e=No(ny().m(function e(t){var n,r,a,o;return ny().w(function(e){for(;;)switch(e.p=e.n){case 0:return W(function(e){return new Set(e).add(t)}),e.p=1,e.n=2,C.mutateAsync(t);case 2:n=e.v,r=(null==n?void 0:n.updated_at)||Date.now(),h&&b.setQueriesData({queryKey:["gallery",h,"images"]},function(e){return null!=e&&e.images?oy(oy({},e),{},{images:e.images.map(function(e){return e.pid===t?oy(oy({},e),{},{reloadKey:r}):e})}):e}),Ce&&Ce.previewpic===t&&(a=zc(Ce.previewpic_url,r),b.setQueryData(["gallery",Ce.gid],function(e){return e?oy(oy({},e),{},{previewpic_url:a}):e}),b.setQueriesData({queryKey:["galleries"]},function(e){return null!=e&&e.galleries?oy(oy({},e),{},{galleries:e.galleries.map(function(e){return e.gid===Ce.gid?oy(oy({},e),{},{previewpic_url:a}):e})}):e})),e.n=4;break;case 3:e.p=3,o=e.v,console.error("Error generating thumbnail",o);case 4:return e.p=4,W(function(e){var n=new Set(e);return n.delete(t),n}),e.f(4);case 5:return e.a(2)}},e,null,[[1,3,4,5]])}));return function(t){return e.apply(this,arguments)}}(),Me=function(){var e=No(ny().m(function e(t,n){var r,a,o,l;return ny().w(function(e){for(;;)switch(e.p=e.n){case 0:return W(function(e){return new Set(e).add(t)}),e.p=1,e.n=2,x.mutateAsync({pid:t,rotation:n});case 2:r=e.v,a=(null==r?void 0:r.updated_at)||Date.now(),h&&b.setQueriesData({queryKey:["gallery",h,"images"]},function(e){return null!=e&&e.images?oy(oy({},e),{},{images:e.images.map(function(e){return e.pid===t?oy(oy({},e),{},{reloadKey:a}):e})}):e}),Ce&&Ce.previewpic===t&&(o=zc(Ce.previewpic_url,a),b.setQueryData(["gallery",Ce.gid],function(e){return e?oy(oy({},e),{},{previewpic_url:o}):e}),b.setQueriesData({queryKey:["galleries"]},function(e){return null!=e&&e.galleries?oy(oy({},e),{},{galleries:e.galleries.map(function(e){return e.gid===Ce.gid?oy(oy({},e),{},{previewpic_url:o}):e})}):e})),e.n=4;break;case 3:e.p=3,l=e.v,console.error("Error rotating image",l);case 4:return e.p=4,W(function(e){var n=new Set(e);return n.delete(t),n}),e.f(4);case 5:return e.a(2)}},e,null,[[1,3,4,5]])}));return function(t,n){return e.apply(this,arguments)}}(),Re=function(){var e=No(ny().m(function e(){var t,n,r,a,o;return ny().w(function(e){for(;;)switch(e.p=e.n){case 0:t=P.filter(function(e){return X.has(e.pid)}),W(function(e){var n=new Set(e);return t.forEach(function(e){return n.add(e.pid)}),n}),n=ey(t),e.p=1,n.s();case 2:if((r=n.n()).done){e.n=4;break}return a=r.value,e.n=3,Le(a.pid);case 3:e.n=2;break;case 4:e.n=6;break;case 5:e.p=5,o=e.v,n.e(o);case 6:return e.p=6,n.f(),e.f(6);case 7:U(!1),Y(new Set);case 8:return e.a(2)}},e,null,[[1,5,6,7]])}));return function(){return e.apply(this,arguments)}}(),Ge=function(){var e=No(ny().m(function e(){var t,n,r,a,o,l,i,c,s,u;return ny().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t=P.filter(function(e){return X.has(e.pid)}),0!==(n=t.filter(function(e){return jg(e)})).length){e.n=1;break}return p((0,pe.__)("No selected images are on CDN","nggallery")),U(!1),e.a(2);case 1:if(r=Tg(),a=Ig(),r){e.n=2;break}return p((0,pe.__)("Authentication error","nggallery")),U(!1),e.a(2);case 2:W(function(e){var t=new Set(e);return n.forEach(function(e){return t.add(e.pid)}),t}),U(!1),o=0,l=0,i=ey(n),e.p=3,s=ny().m(function e(){var t,n,i;return ny().w(function(e){for(;;)switch(e.p=e.n){case 0:return t=c.value,e.p=1,e.n=2,fetch("".concat(a,"envira-cdn/v1/ngg-remove-image/").concat(t.pid),{method:"DELETE",headers:{"X-WP-Nonce":r}});case 2:if(!(n=e.v).ok){e.n=4;break}return e.n=3,n.json();case 3:e.v.success?o++:l++,e.n=5;break;case 4:l++;case 5:e.n=7;break;case 6:e.p=6,i=e.v,console.error("CDN removal error:",i),l++;case 7:return e.p=7,W(function(e){var n=new Set(e);return n.delete(t.pid),n}),e.f(7);case 8:return e.a(2)}},e,null,[[1,6,7,8]])}),i.s();case 4:if((c=i.n()).done){e.n=6;break}return e.d($f(s()),5);case 5:e.n=4;break;case 6:e.n=8;break;case 7:e.p=7,u=e.v,i.e(u);case 8:return e.p=8,i.f(),e.f(8);case 9:if(o>0&&0===l?g((0,pe.__)("Successfully removed ".concat(o," image(s) from CDN"),"nggallery")):o>0&&l>0?g((0,pe.__)("Removed ".concat(o," image(s) from CDN. ").concat(l," failed."),"nggallery")):p((0,pe.__)("Failed to remove images from CDN","nggallery")),!h){e.n=10;break}return e.n=10,b.invalidateQueries({queryKey:["gallery",h,"images"]});case 10:Y(new Set);case 11:return e.a(2)}},e,null,[[3,7,8,9]])}));return function(){return e.apply(this,arguments)}}(),Be=function(){var e=No(ny().m(function e(t){var n,r,a,o,l;return ny().w(function(e){for(;;)switch(e.p=e.n){case 0:n=P.filter(function(e){return X.has(e.pid)}),W(function(e){var t=new Set(e);return n.forEach(function(e){return t.add(e.pid)}),t}),r=ey(n),e.p=1,r.s();case 2:if((a=r.n()).done){e.n=4;break}return o=a.value,e.n=3,Me(o.pid,t);case 3:e.n=2;break;case 4:e.n=6;break;case 5:e.p=5,l=e.v,r.e(l);case 6:return e.p=6,r.f(),e.f(6);case 7:U(!1),Y(new Set);case 8:return e.a(2)}},e,null,[[1,5,6,7]])}));return function(t){return e.apply(this,arguments)}}(),ze=function(){var e=No(ny().m(function e(){var t,n,r,a,o;return ny().w(function(e){for(;;)switch(e.p=e.n){case 0:t=P.filter(function(e){return X.has(e.pid)}),W(function(e){var n=new Set(e);return t.forEach(function(e){return n.add(e.pid)}),n}),n=ey(t),e.p=1,a=ny().m(function e(){var t,n,a;return ny().w(function(e){for(;;)switch(e.p=e.n){case 0:return t=r.value,n=Date.now(),e.p=1,e.n=2,N.mutateAsync(t.pid);case 2:h&&b.setQueriesData({queryKey:["gallery",h,"images"]},function(e){return null!=e&&e.images?oy(oy({},e),{},{images:e.images.map(function(e){return e.pid===t.pid?oy(oy({},e),{},{reloadKey:n}):e})}):e}),e.n=4;break;case 3:e.p=3,a=e.v,console.error("Error setting watermark",a);case 4:return e.a(2)}},e,null,[[1,3]])}),n.s();case 2:if((r=n.n()).done){e.n=4;break}return e.d($f(a()),3);case 3:e.n=2;break;case 4:e.n=6;break;case 5:e.p=5,o=e.v,n.e(o);case 6:return e.p=6,n.f(),e.f(6);case 7:U(!1),Y(new Set),W(function(e){var n=new Set(e);return t.forEach(function(e){return n.delete(e.pid)}),n});case 8:return e.a(2)}},e,null,[[1,5,6,7]])}));return function(){return e.apply(this,arguments)}}(),Ue=function(){var e=No(ny().m(function e(){var t,n;return ny().w(function(e){for(;;)switch(e.n){case 0:t=P.filter(function(e){return X.has(e.pid)}),n=t.map(function(e){return e.pid}),o.setActiveModal("bulkResize",{imageIds:n,galleryId:h,onConfirm:function(){Y(new Set)}});case 1:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}(),qe=function(){var e=No(ny().m(function e(){var t,n,r,a;return ny().w(function(e){for(;;)switch(e.p=e.n){case 0:return t=P.filter(function(e){return X.has(e.pid)}),n=t.map(function(e){return e.pid}),W(function(e){var n=new Set(e);return t.forEach(function(e){return n.add(e.pid)}),n}),e.p=1,e.n=2,k.mutateAsync(n);case 2:(r=e.v).success_count>0&&o.showNotice("success","Successfully imported metadata for ".concat(r.success_count," of ").concat(r.processed," images")),r.failure_count>0&&o.showNotice("warning","Failed to import metadata for ".concat(r.failure_count," images")),e.n=4;break;case 3:e.p=3,a=e.v,console.error("Error bulk importing metadata:",a),o.showNotice("error","Failed to import metadata for selected images");case 4:return e.p=4,W(function(e){var n=new Set(e);return t.forEach(function(e){return n.delete(e.pid)}),n}),U(!1),Y(new Set),e.f(4);case 5:return e.a(2)}},e,null,[[1,3,4,5]])}));return function(){return e.apply(this,arguments)}}(),Qe=function(){var e=No(ny().m(function e(t,n){return ny().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,_.mutateAsync({imageId:t.pid,data:{exclude:n}});case 1:j(function(e){return e.map(function(e){return e.pid===t.pid?oy(oy({},e),{},{exclude:n}):e})}),g((0,pe.__)("Image visibility updated successfully!","nggallery")),e.n=3;break;case 2:e.p=2,e.v,p((0,pe.__)("Failed to update image visibility","nggallery"));case 3:return e.a(2)}},e,null,[[0,2]])}));return function(t,n){return e.apply(this,arguments)}}(),We=function(){var e=No(ny().m(function e(){var t,n;return ny().w(function(e){for(;;)switch(e.p=e.n){case 0:if(h){e.n=1;break}return e.a(2);case 1:return K(!0),e.p=2,e.n=3,S.mutateAsync(h);case 3:(t=e.v).images_added>0?g(t.message):o.showNotice("info",t.message),t.errors&&t.errors.length>0&&t.errors.forEach(function(e){p(e)}),e.n=5;break;case 4:e.p=4,n=e.v,p((null==n?void 0:n.message)||(0,pe.__)("Failed to scan folder for new images.","nggallery"));case 5:return e.p=5,K(!1),e.f(5);case 6:return e.a(2)}},e,null,[[2,4,5,6]])}));return function(){return e.apply(this,arguments)}}(),He=null==Ce?void 0:Ce.external_source,Ve=He&&He.type,Ke=(0,$.useMemo)(function(){return Ve&&null!=f&&f.external_source_default_settings&&f.external_source_default_settings[He.type]||{}},[Ve,null==He?void 0:He.type,f]),Xe=!Ve||!(null!=Ce&&Ce.gid)||"google_photos"===(null==He?void 0:He.type);if(a)return ee().createElement("div",{className:"text-red-600"},(0,pe.__)("Error:","nggallery")," ",a);if(de)return ee().createElement("div",{className:"text-red-600"},(0,pe.__)("Error loading images:","nggallery")," ",de.message);var Ye=null!=L?L:I&&null!==(t=P.find(function(e){return e.pid===I}))&&void 0!==t?t:null,Ze=((null==Ce?void 0:Ce.title)||"").replace(/<\/?[^>]+(>|$)/g,""),Je=((null==Ce?void 0:Ce.galdesc)||"").replace(/<\/?[^>]+(>|$)/g,""),$e=Je.length>100?Je.slice(0,100)+"...":Je,et=Ze.length>50?Ze.slice(0,50)+"...":Ze;return ee().createElement("div",{className:""},ee().createElement("div",{className:"p-6 lg:p-8 space-y-6"},ee().createElement("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 sm:gap-0"},ee().createElement("div",{className:"flex items-center space-x-3 sm:space-x-4 ".concat(ne?"opacity-50":"")},ee().createElement("img",{src:null!=Ce&&Ce.previewpic_url?null==Ce?void 0:Ce.previewpic_url:Ns({text:"NO IMAGE"}),alt:et,className:"w-10 h-10 sm:w-12 sm:h-12 object-cover rounded flex-shrink-0"}),ee().createElement("div",{className:"flex flex-col min-w-0 flex-1"},ee().createElement("div",{className:"flex flex-col sm:flex-row sm:items-center space-y-1 sm:space-y-0 sm:space-x-2"},ee().createElement("h1",{className:"text-lg sm:text-xl font-semibold truncate"},et," (",be,")"),ee().createElement("button",{className:"px-2 py-1 bg-gray-100 rounded hover:bg-gray-200 text-xs sm:text-sm flex items-center self-start sm:self-auto",onClick:function(){return o.setActiveModal("galleryEdit",{galleryId:null==Ce?void 0:Ce.gid})}},ee().createElement(sn,{width:8,height:8,className:"mr-1 sm:w-2.5 sm:h-2.5"}),(0,pe.__)("Edit Details","nggallery"))),$e&&ee().createElement("p",{className:"text-gray-500 text-xs sm:text-sm"},$e)))),ee().createElement("hr",null),Ve&&(null==Ce?void 0:Ce.gid)&&ee().createElement(Kg,{integrationType:He.type,galleryId:Ce.gid,externalSource:He,defaultSettings:Ke,onUpdate:function(){var e=No(ny().m(function e(t){return ny().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,w.mutateAsync({id:Ce.gid,data:{external_source:oy(oy({},He),t)}});case 1:g((0,pe.__)("Integration settings updated successfully!","nggallery")),e.n=3;break;case 2:e.p=2,e.v,p((0,pe.__)("Failed to update integration settings","nggallery"));case 3:return e.a(2)}},e,null,[[0,2]])}));return function(t){return e.apply(this,arguments)}}()}),Ve&&(null==Ce?void 0:Ce.gid)&&"google_photos"===(null==He?void 0:He.type)&&ee().createElement("hr",{className:"mt-6 border-gray-200"}),Xe&&ee().createElement(ee().Fragment,null,ee().createElement("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 sm:gap-0"},ee().createElement("div",{className:"flex items-center space-x-2"},P.length>0&&ee().createElement("input",{type:"checkbox",checked:X.size===P.length,onChange:function(e){return t=e.target.checked,void Y(t?new Set(P.map(function(e){return e.pid})):new Set);var t},className:"rounded border-gray-300"}),ee().createElement("h2",{className:"text-base sm:text-lg font-medium"},(0,pe.__)("All Images","nggallery"))),ee().createElement("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center space-y-2 sm:space-y-0 sm:space-x-4"},X.size>0&&ee().createElement(kg,{isOpen:z,onClose:function(){return U(!1)},onToggle:function(){return U(!z)},trigger:ee().createElement("button",{className:"appearance-none bg-white border rounded px-3 sm:px-4 py-2 pr-6 sm:pr-8 flex items-center justify-center space-x-2 text-sm sm:text-base w-full sm:w-auto"},ee().createElement("span",null,(0,pe.__)("Bulk Actions","nggallery")),ee().createElement("svg",{className:"w-3 h-3 sm:w-4 sm:h-4",viewBox:"0 0 20 20",fill:"currentColor"},ee().createElement("path",{fillRule:"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z",clipRule:"evenodd"})))},ee().createElement("div",{className:"py-1"},ee().createElement("button",{onClick:function(){ze(),U(!1)},className:"block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100"},(0,pe.__)("Set Watermark","nggallery")),ee().createElement("button",{onClick:function(){var e,t;t=P.filter(function(e){return X.has(e.pid)}),o.setActiveModal("deleteImages",{images:t,onClose:function(){return o.setActiveModal(null)},onConfirm:(e=No(ny().m(function e(){return ny().w(function(e){for(;;)switch(e.n){case 0:return j(function(e){return e.filter(function(e){return!X.has(e.pid)})}),Y(new Set),e.n=1,Promise.all(t.map(function(e){return o.deleteItem("images",e.pid)}));case 1:o.setActiveModal(null);case 2:return e.a(2)}},e)})),function(){return e.apply(this,arguments)})}),U(!1)},className:"block w-full text-left px-4 py-2 text-sm text-red-600 hover:bg-gray-100"},(0,pe.__)("Delete Selected","nggallery")),ee().createElement("button",{onClick:function(){Re(),U(!1)},className:"block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100"},(0,pe.__)("Recover Selected","nggallery")),ee().createElement("button",{onClick:function(){var e;e=P.filter(function(e){return X.has(e.pid)}).map(function(e){return e.pid}),o.setActiveModal("bulkGenerateThumbnails",{imageIds:e,galleryId:h,onConfirm:function(){Y(new Set)}}),U(!1)},className:"block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100"},(0,pe.__)("Generate Thumbnails","nggallery")),ee().createElement("button",{onClick:function(){Be("cw"),U(!1)},className:"block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100"},(0,pe.__)("Rotate Clockwise","nggallery")),ee().createElement("button",{onClick:function(){Be("ccw"),U(!1)},className:"block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100"},(0,pe.__)("Rotate Counter-Clockwise","nggallery")),ee().createElement("button",{onClick:function(){Ue(),U(!1)},className:"block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100"},(0,pe.__)("Resize Selected","nggallery")),ee().createElement("button",{onClick:function(){qe(),U(!1)},className:"block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100"},(0,pe.__)("Import Metadata","nggallery")),ee().createElement("button",{onClick:function(){var e;e=P.filter(function(e){return X.has(e.pid)}).map(function(e){return e.pid}),o.setActiveModal("gallerySelect",{imageIds:e,operation:"copy",excludeGalleryId:null==r?void 0:r.gid,onConfirm:function(){Y(new Set)}}),U(!1)},className:"block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100"},(0,pe.__)("Copy to...","nggallery")),ee().createElement("button",{onClick:function(){var e;e=P.filter(function(e){return X.has(e.pid)}).map(function(e){return e.pid}),o.setActiveModal("gallerySelect",{imageIds:e,operation:"move",excludeGalleryId:null==r?void 0:r.gid,onConfirm:function(){j(function(e){return e.filter(function(e){return!X.has(e.pid)})}),Y(new Set)}}),U(!1)},className:"block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100"},(0,pe.__)("Move to...","nggallery")),ee().createElement("button",{onClick:function(){var e;e=P.filter(function(e){return X.has(e.pid)}).map(function(e){return e.pid}),o.setActiveModal("tags",{imageIds:e,onConfirm:function(){Y(new Set)}}),U(!1)},className:"block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100"},(0,pe.__)("Edit Tags","nggallery")),Og()&&P.some(function(e){return X.has(e.pid)&&jg(e)})&&ee().createElement("button",{onClick:function(){Ge(),U(!1)},className:"block w-full text-left px-4 py-2 text-sm text-orange-600 hover:bg-gray-100"},(0,pe.__)("Remove from CDN","nggallery")))),ee().createElement(kg,{isOpen:R,onClose:function(){return G(!1)},onToggle:function(){return G(!R)},trigger:ee().createElement("button",{className:"appearance-none bg-white border rounded px-3 sm:px-4 py-2 pr-6 sm:pr-8 flex items-center justify-center space-x-2 text-sm sm:text-base w-full sm:w-auto"},ee().createElement("span",null,(0,pe.__)("Sort Images","nggallery")),ee().createElement("svg",{className:"w-3 h-3 sm:w-4 sm:h-4",viewBox:"0 0 20 20",fill:"currentColor"},ee().createElement("path",{fillRule:"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z",clipRule:"evenodd"})))},ee().createElement("div",{className:"py-2"},ee().createElement("button",{onClick:function(){Ie("pid"),G(!1)},className:"block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 w-full text-left"},(0,pe.__)("Sort by ID","nggallery")),ee().createElement("button",{onClick:function(){Ie("filename"),G(!1)},className:"block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 w-full text-left"},(0,pe.__)("Sort by Filename","nggallery")),ee().createElement("button",{onClick:function(){Ie("alttext"),G(!1)},className:"block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 w-full text-left"},(0,pe.__)("Sort by Alt Text","nggallery")),ee().createElement("button",{onClick:function(){Ie("imagedate"),G(!1)},className:"block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 w-full text-left"},(0,pe.__)("Sort by Date","nggallery")),ee().createElement("hr",{className:"my-2"}),ee().createElement("button",{onClick:function(){Ie("invert"),G(!1)},className:"block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 w-full text-left"},(0,pe.__)("Invert Order","nggallery")))),h&&ee().createElement("button",{onClick:We,disabled:V,className:"appearance-none bg-white border rounded px-3 sm:px-4 py-2 flex items-center justify-center space-x-2 text-sm sm:text-base w-full sm:w-auto hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",title:(0,pe.__)("Scan the gallery folder for new images added via FTP or file manager","nggallery")},ee().createElement(Nn,{className:"w-4 h-4"}),ee().createElement("span",null,V?(0,pe.__)("Scanning...","nggallery"):(0,pe.__)("Scan Folder","nggallery"))))),ee().createElement("div",{className:"relative"},ee().createElement(Md,{sensors:Z,collisionDetection:Te,onDragStart:function(e){var t=e.active.id;A(t);var n=P.find(function(e){return e.pid===t});n&&F(n),window.navigator.vibrate&&window.navigator.vibrate(50)},onDragOver:Ne,onDragEnd:Se,onDragCancel:Oe,measuring:{droppable:{strategy:md.Always}}},ee().createElement(cg,{items:je,strategy:rg},ee().createElement(ee().Fragment,null,ee().createElement("div",{className:"grid gap-4 sm:gap-6 grid-cols-2 sm:grid-cols-3 md:grid-cols-[repeat(auto-fill,_130px)] transition-opacity ".concat(me?"opacity-50":"")},ee().createElement(iy,{onClick:function(){return o.setActiveModal("imageUploader",{galleryId:null==Ce?void 0:Ce.gid})}}),P.map(function(e){return ee().createElement(Gg,{key:"".concat(e.pid,"-").concat(e.reloadKey||""),image:e,gallery:Ce,isSelected:X.has(e.pid),onSelect:Ae,onDelete:De,onRecover:Le,onGenerateThumbnail:Fe,isProcessing:Q.has(e.pid),onToggleVisibility:Qe})})))),ee().createElement($d,null,Ye&&ee().createElement("div",{className:"transform scale-105 opacity-90 pointer-events-none"},ee().createElement(Gg,{image:Ye,gallery:Ce,isSelected:X.has(Ye.pid),onSelect:Ae,onDelete:De,onRecover:Le,onGenerateThumbnail:Fe,isProcessing:Q.has(Ye.pid),onToggleVisibility:Qe}))),null!==I&&we>1&&ee().createElement(Zf,{currentPage:ie,totalPages:we,onPaginate:Pe})),!me&&ve>1&&ee().createElement("div",{className:null!==I?"invisible":"","aria-hidden":null!==I},ee().createElement(Xf,{currentPage:ie,totalPages:ve,perPage:y,total:be,onPageChange:xe,itemLabel:(0,pe.__)("images","nggallery"),showItemCount:!0}))))))};function sy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function uy(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?sy(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):sy(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function my(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return dy(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(dy(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,dy(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,dy(m,"constructor",s),dy(s,"constructor",c),c.displayName="GeneratorFunction",dy(s,a,"GeneratorFunction"),dy(m),dy(m,a,"Generator"),dy(m,r,function(){return this}),dy(m,"toString",function(){return"[object Generator]"}),(my=function(){return{w:o,m:d}})()}function dy(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}dy=function(e,t,n,r){function o(t,n){dy(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},dy(e,t,n,r)}const gy=function(e){var t,r,a,o=e.gallery,l=e.previewMode,i=e.onPreviewModeChange,c=iu(),s=c.updateField,u=c.registerFlushCallback,m=c.unregisterFlushCallback,d=Ol(),g=$o(),p=g.showSuccess,f=g.showError,y=(0,ge.useDispatch)(Br),h=gi(),b=h.data,v=h.isLoading,_=pi(),w=vo((0,$.useState)({title:(null==o?void 0:o.title)||"",description:(null==o?void 0:o.galdesc)||"",is_ecommerce_enabled:"1"===(null==o?void 0:o.is_ecommerce_enabled),pricelist_id:(null==o||null===(t=o.pricelist_id)||void 0===t?void 0:t.toString())||"0",pageid:(null==o||null===(r=o.pageid)||void 0===r?void 0:r.toString())||""}),2),x=w[0],E=w[1],C=(0,$.useRef)(null),N=(0,$.useRef)(null),k=(0,$.useCallback)(function(){C.current&&(clearTimeout(C.current),C.current=null),N.current&&(N.current(),N.current=null)},[]),S=Pi({enabled:"pro"===zr,per_page:-1}),O=S.data,P=S.isLoading,j=vo((0,$.useState)([]),2),T=j[0],I=j[1],A=vo((0,$.useState)(!0),2),D=A[0],L=A[1],F=vo((0,$.useState)([]),2),M=F[0],R=F[1],G=vo((0,$.useState)({open:!1,title:"",isCreating:!1}),2),B=G[0],z=G[1];(0,$.useEffect)(function(){if(o){var e,t,n,r=(null===(e=o.extras_post_meta)||void 0===e?void 0:e.pricelist_id)||(null===(t=o.pricelist_id)||void 0===t?void 0:t.toString())||"0",a="1"===String(o.is_ecommerce_enabled);if(a&&("0"===r||!r)){var l,i=null==O||null===(l=O.pricelists)||void 0===l?void 0:l[0];i&&(r=i.id.toString())}E({title:o.title||"",description:o.galdesc||"",is_ecommerce_enabled:a,pricelist_id:r,pageid:(null===(n=o.pageid)||void 0===n?void 0:n.toString())||""})}},[null==o?void 0:o.gid,O]),(0,$.useEffect)(function(){return u("settingsTab",k),function(){k(),m("settingsTab")}},[k,u,m]),(0,$.useEffect)(function(){var e=!0,t=function(){var t=No(my().m(function t(){var n,r;return my().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,Oo()({path:"/wp/v2/pages?per_page=-1&status=publish"});case 1:n=t.v,e&&I(n),t.n=3;break;case 2:t.p=2,r=t.v,console.error("Error fetching pages:",r),e&&I([]);case 3:return t.p=3,e&&L(!1),t.f(3);case 4:return t.a(2)}},t,null,[[0,2,3,4]])}));return function(){return t.apply(this,arguments)}}();return t(),function(){e=!1}},[]);var U=(0,$.useCallback)(function(){var e=No(my().m(function e(t,n){var r,a,o,l,i,c,s,u,m,d,g;return my().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,o=null===(r=window.imagelyApp)||void 0===r?void 0:r.nonce,e.n=1,Oo()({path:"/wp/v2/pages/".concat(t,"?context=edit"),method:"GET",headers:{"X-WP-Nonce":o}});case 1:if(l=e.v,i=(null===(a=l.content)||void 0===a?void 0:a.raw)||"",c=new RegExp("\\[imagely[^\\]]*id=[\"']?".concat(n,"[\"']?[^\\]]*\\]"),"i"),s=new RegExp("\\[ngg[^\\]]*id=[\"']?".concat(n,"[\"']?[^\\]]*\\]"),"i"),!c.test(i)&&!s.test(i)){e.n=2;break}return e.a(2);case 2:return u='[imagely id="'.concat(n,'"]'),m=""===i.trim()?u:"".concat(i,"\n\n").concat(u),e.n=3,Oo()({path:"/wp/v2/pages/".concat(t),method:"POST",headers:{"X-WP-Nonce":o,"Content-Type":"application/json"},data:{content:m}});case 3:e.n=5;break;case 4:e.p=4,g=e.v,console.error("Error inserting gallery into page:",g),d=(null==g?void 0:g.message)||(0,pe.__)("Unknown error occurred","nggallery"),f((0,pe.__)("Failed to insert gallery shortcode into page: ","nggallery")+d);case 5:return e.a(2)}},e,null,[[0,4]])}));return function(t,n){return e.apply(this,arguments)}}(),[f]),q=(0,$.useCallback)(function(){var e=No(my().m(function e(t,n,r){var a,l,i;return my().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!o){e.n=9;break}if(e.p=1,a={},"title"!==t){e.n=2;break}a.title=n,e.n=6;break;case 2:if("description"!==t){e.n=3;break}a.galdesc=n,e.n=6;break;case 3:if("is_ecommerce_enabled"!==t){e.n=4;break}a.is_ecommerce_enabled=n?"1":"0",n&&(a.pricelist_id=parseInt(r.pricelist_id,10)),e.n=6;break;case 4:if("pricelist_id"!==t){e.n=5;break}a.pricelist_id=parseInt(n,10),e.n=6;break;case 5:if("pageid"!==t){e.n=6;break}if(a.pageid=n?parseInt(n,10):null,!n||""===n){e.n=6;break}return l=parseInt(n,10),e.n=6,U(l,o.gid);case 6:return e.n=7,d.mutateAsync({id:o.gid,data:a});case 7:p((0,pe.__)("Settings updated successfully!","nggallery")),e.n=9;break;case 8:e.p=8,i=e.v,console.error("Error updating settings:",i),f((0,pe.__)("Failed to update settings. Please try again.","nggallery"));case 9:return e.a(2)}},e,null,[[1,8]])}));return function(t,n,r){return e.apply(this,arguments)}}(),[o,d,p,f]),Q=function(e){var t=e.target,r=t.name,a=t.value,o="checkbox"===t.type?e.target.checked:a;if("pageid"!==r||"__create__"!==a){var l=uy(uy({},x),{},n({},r,o));if("is_ecommerce_enabled"===r&&o&&("0"===x.pricelist_id||!x.pricelist_id)){var i,c=null==O||null===(i=O.pricelists)||void 0===i?void 0:i[0];c&&(l.pricelist_id=c.id.toString())}"is_ecommerce_enabled"===r&&!0===o&&b&&"photocrati-nextgen_pro_lightbox"!==b.thumbEffect&&_.mutateAsync({thumbEffect:"photocrati-nextgen_pro_lightbox"}).catch(function(){return f((0,pe.__)("Failed to auto-set Pro Lightbox for eCommerce. Please set it manually.","nggallery"))}),E(l),s(r,o),"is_ecommerce_enabled"===r&&l.pricelist_id!==x.pricelist_id&&s("pricelist_id",l.pricelist_id),C.current&&clearTimeout(C.current);var u=function(){q(r,o,l)};N.current=u,C.current=window.setTimeout(function(){u(),N.current=null},1e3)}else W()},W=function(){z({open:!0,title:"".concat((null==o?void 0:o.title)||"Gallery"," Page"),isCreating:!1})},H=function(){var e=No(my().m(function e(){var t,n,r,a,o,l,i;return my().w(function(e){for(;;)switch(e.p=e.n){case 0:if(B.title.trim()){e.n=1;break}return e.a(2);case 1:return e.p=1,z(function(e){return uy(uy({},e),{},{isCreating:!0})}),n=null===(t=window.imagelyApp)||void 0===t?void 0:t.nonce,e.n=2,Oo()({path:"/wp/v2/pages",method:"POST",headers:{"X-WP-Nonce":n,"Content-Type":"application/json"},data:{title:B.title,content:"",status:"publish"}});case 2:r=e.v,(a=String((null==r?void 0:r.id)||""))&&(o=uy(uy({},x),{},{pageid:a}),E(o),s("pageid",a),l=null!=r&&r.title&&r.title.rendered?r.title.rendered:B.title,R(function(e){return[{id:Number(a),title:{rendered:l}}].concat(ko(e))}),q("pageid",a,o),p((0,pe.__)("Page created and linked successfully!","nggallery"))),e.n=4;break;case 3:e.p=3,i=e.v,console.error("Error creating page:",i),f((0,pe.__)("Failed to create page. Please try again.","nggallery"));case 4:return e.p=4,z({open:!1,title:"",isCreating:!1}),e.f(4);case 5:return e.a(2)}},e,null,[[1,3,4,5]])}));return function(){return e.apply(this,arguments)}}(),V=(0,$.useMemo)(function(){return[].concat(ko(M),ko(T)).reduce(function(e,t){return e.find(function(e){return e.id===t.id})||e.push(t),e},[]).map(function(e){var t;return{value:String(e.id),label:(null===(t=e.title)||void 0===t?void 0:t.rendered)||"Page #".concat(e.id)}})},[T,M]),K=(0,$.useMemo)(function(){var e=(null==O?void 0:O.pricelists)||[],t=[];return t.push({value:"0",label:(0,pe.__)("None","nggallery")}),Array.isArray(e)&&e.length>0&&e.forEach(function(e){t.push({value:e.id.toString(),label:e.title})}),t},[O]),X="pro"===zr||"plus"===zr,Y="pro"===(null===(a=window.imagelyApp)||void 0===a?void 0:a.proTypeInstalled),Z=[].concat(ko(X?[{value:"photocrati-nextgen_pro_lightbox",label:(0,pe.__)("Pro Lightbox","nggallery")}]:[]),[{value:"simplelightbox",label:(0,pe.__)("Simplelightbox","nggallery")},{value:"fancybox",label:(0,pe.__)("Fancybox","nggallery")},{value:"thickbox",label:(0,pe.__)("Thickbox","nggallery")},{value:"shutter",label:(0,pe.__)("Shutter","nggallery")},{value:"shutter2",label:(0,pe.__)("Shutter Reloaded","nggallery")},{value:"custom_lightbox",label:(0,pe.__)("Custom Lightbox","nggallery")},{value:"none",label:(0,pe.__)("None","nggallery")}]),J=(0,$.useCallback)(function(){var e=No(my().m(function e(t){var n,r;return my().w(function(e){for(;;)switch(e.p=e.n){case 0:return n=t.target.value,e.p=1,e.n=2,_.mutateAsync({thumbEffect:n});case 2:p((0,pe.__)("Lightbox setting updated successfully!","nggallery")),e.n=4;break;case 3:e.p=3,r=e.v,console.error("Error updating lightbox setting:",r),f((0,pe.__)("Failed to update lightbox setting. Please try again.","nggallery"));case 4:return e.a(2)}},e,null,[[1,3]])}));return function(t){return e.apply(this,arguments)}}(),[_,p,f]),te=(0,ge.useSelect)(function(e){return e(Br).getCurrentId()},[]),ne=kl(te).data,re=El(o)||El(ne||null),ae=Cl(o)||Cl(ne||null),oe=re?"tiktok":ae?"dribbble":null,le=Rl(null!=te?te:null,oe),ie=Ml(null!=te?te:null,re),ce=ie.data,se=ie.refetch,ue=af({type:"gallery",item:ne,includeEcommerce:x.is_ecommerce_enabled});return ee().createElement(ee().Fragment,null,ee().createElement("div",{className:"bg-white rounded-lg shadow lg:grid lg:grid-cols-2 lg:items-start"},ee().createElement("div",{className:"px-6 py-6 lg:px-8 lg:py-8 border-b lg:border-b-0 lg:border-r"},ee().createElement("h1",{className:"text-lg font-medium"},(0,pe.__)("Settings","nggallery")),ee().createElement("div",{className:"space-y-4 mt-6"},ee().createElement(uc,{type:"text",name:"title",value:x.title,onChange:Q,label:(0,pe.__)("Gallery Title","nggallery"),placeholder:(0,pe.__)("Enter gallery title","nggallery")}),ee().createElement("div",null,ee().createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},(0,pe.__)("Gallery Description","nggallery")),ee().createElement("textarea",{name:"description",value:x.description,onChange:Q,className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",rows:3,placeholder:(0,pe.__)("Enter gallery description","nggallery")})),ee().createElement(sc,{id:"pageid",name:"pageid",value:x.pageid,onChange:Q,label:(0,pe.__)("Link to page:","nggallery"),help:(0,pe.__)("Select a page to link this gallery to, or create a new page with the gallery content","nggallery")},D?ee().createElement("option",{value:""},(0,pe.__)("Loading pages...","nggallery")):ee().createElement(ee().Fragment,null,ee().createElement("option",{value:""},(0,pe.__)("Not linked","nggallery")),ee().createElement("option",{value:"__create__",className:"text-green-600"},(0,pe.__)("Create new page","nggallery")),V.map(function(e){return ee().createElement("option",{key:e.value,value:e.value},e.label)}))),ee().createElement("div",null,ee().createElement("h3",{className:"text-sm font-medium text-gray-900 mb-4"},(0,pe.__)("eCommerce Settings","nggallery")),Y?ee().createElement("div",{className:"space-y-4"},ee().createElement(fs,{id:"is_ecommerce_enabled",name:"is_ecommerce_enabled",checked:x.is_ecommerce_enabled,onChange:Q,label:(0,pe.__)("Enable eCommerce","nggallery"),help:(0,pe.__)("Enable eCommerce functionality for this gallery","nggallery"),disabled:v}),x.is_ecommerce_enabled&&ee().createElement("div",{className:"pl-4 border-l-2 border-gray-200"},ee().createElement(sc,{id:"pricelist_id",name:"pricelist_id",value:x.pricelist_id,onChange:Q,label:(0,pe.__)("Pricelist","nggallery"),help:(0,pe.__)("Select a pricelist for this gallery","nggallery")},P?ee().createElement("option",{value:"0",disabled:!0},(0,pe.__)("Loading...","nggallery")):K.map(function(e){return ee().createElement("option",{key:e.value,value:e.value},e.label)})))):ee().createElement("div",{className:"relative"},ee().createElement("div",{className:"opacity-50 pointer-events-none"},ee().createElement(fs,{id:"is_ecommerce_enabled",name:"is_ecommerce_enabled",checked:!1,onChange:function(){},label:(0,pe.__)("Enable eCommerce","nggallery"),help:(0,pe.__)("Enable eCommerce functionality for this gallery","nggallery")})),ee().createElement("div",{className:"absolute inset-0 cursor-pointer",onClick:function(){Y||y.setActiveModal("upgrade",{feature:"eCommerce features"})},title:(0,pe.__)("Requires NextGEN Gallery Pro","nggallery")}))),ee().createElement("div",{className:"space-y-4"},ee().createElement(sc,{id:"thumbEffect",name:"thumbEffect",value:(null==b?void 0:b.thumbEffect)||"",onChange:J,label:(0,pe.__)("Lightbox Library","nggallery"),help:(0,pe.__)("What lightbox would you like to use?","nggallery")},Z.map(function(e){return ee().createElement("option",{key:e.value,value:e.value},e.label)})),ee().createElement("div",{className:"bg-info-bg border border-info-border rounded-md p-3"},ee().createElement("div",{className:"flex items-start"},ee().createElement("div",{className:"flex-shrink-0"},ee().createElement(cr,{className:"h-4 w-4 text-gray-400 mt-0.5"})),ee().createElement("div",{className:"ml-2"},ee().createElement("p",{className:"text-xs text-gray-700"},(0,pe.__)("This lightbox setting affects all galleries on your site, not just this one. To configure additional lightbox options, visit the Settings page.","nggallery")))))))),ee().createElement("div",{className:"px-6 py-6 lg:px-8 lg:py-8 lg:sticky lg:top-8 lg:max-h-screen"},ee().createElement(gf,{previewMode:l,onPreviewModeChange:i,url:ue,title:(0,pe.__)("Gallery Preview","nggallery"),showReFetchButton:!!oe,onReFetchAndUpdateCache:oe&&te?No(my().m(function e(){return my().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,le.mutateAsync();case 1:return e.a(2)}},e)})):void 0,isReFetching:le.isPending,onPreviewLoad:re?function(){return se()}:void 0,tiktokErrorNotice:re&&null!=ce&&ce.has_errors?{hasErrors:!!ce.has_errors}:void 0,customLoadingMessage:re?(0,pe.__)("Fetching TikTok videos, this may take a moment. Please wait.","nggallery"):void 0}))),ee().createElement(Eo,{isOpen:B.open,onClose:function(){return z({open:!1,title:"",isCreating:!1})},title:(0,pe.__)("Create New Page","nggallery")},ee().createElement("div",{className:"space-y-4"},ee().createElement(uc,{type:"text",id:"new_page_title",name:"new_page_title",value:B.title,onChange:function(e){return z(function(t){return uy(uy({},t),{},{title:e.target.value})})},label:(0,pe.__)("Page Title","nggallery"),placeholder:(0,pe.__)("Enter page title...","nggallery")}),ee().createElement("div",{className:"bg-info-bg border border-info-border rounded-md p-3"},ee().createElement("div",{className:"flex items-start"},ee().createElement("div",{className:"py-0.5 flex-shrink-0"},ee().createElement(cr,{className:"h-4 w-4 text-gray-500 mt-0.5"})),ee().createElement("div",{className:"py-1 ml-2"},ee().createElement("p",{className:"text-xs text-gray-500"},(0,pe.__)("A new page will be created with the gallery added immediately.","nggallery"))))),ee().createElement("div",{className:"flex gap-2 justify-end"},ee().createElement("button",{type:"button",className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 disabled:opacity-50",onClick:function(){return z({open:!1,title:"",isCreating:!1})},disabled:B.isCreating},(0,pe.__)("Cancel","nggallery")),ee().createElement("button",{type:"button",className:"px-4 py-2 text-sm font-medium text-white bg-green-500 border border-transparent rounded-md hover:bg-green-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 disabled:opacity-50 disabled:cursor-not-allowed inline-flex items-center",onClick:H,disabled:B.isCreating||!B.title.trim()},B.isCreating?(0,pe.__)("Creating...","nggallery"):(0,pe.__)("Create Page","nggallery"))))))},py=function(e){var t=e.currentTab,n=e.selectedGalleryId,r=e.gallery,a=e.error,o=e.previewMode,l=e.onPreviewModeChange,i=e.onCreateNewGallery;if(!n)return ee().createElement(tf,{onCreateNewGallery:i});var c={previewMode:o,onPreviewModeChange:l};switch(t){case"images":return ee().createElement(cy,{gallery:r,error:a});case"customize":return ee().createElement(Kf,fe({gallery:r},c));case"settings":return ee().createElement(gy,fe({gallery:r},c));default:return ee().createElement("div",{className:"bg-white rounded-lg shadow p-8 text-center text-gray-500"},(0,pe.__)("Please select a tab to continue.","nggallery"))}};var fy=function(e){var t=e.currentTab,n=e.setCurrentTab,r=e.error,a=e.selectedGalleryId,o=e.gallery,l=e.previewMode,i=e.handlePreviewModeChange,c=e.handleCreateNewGallery,s=e.handleNext,u=e.handleCancel,m=e.nextButtonText,d=e.navigateTo,g=e.isFirstTab,p=e.pageTitle,f=e.isEmbed,y=iu(),h=y.flushAllPendingSaves,b=y.isNextDisabled;return ee().createElement("div",{className:"px-4 md:px-6 lg:px-8 py-4 md:py-6 pb-24"},!f&&ee().createElement("div",{className:"mb-6 flex items-center gap-3"},ee().createElement("button",{onClick:function(){return d("imagely","galleryList")},className:"flex items-center justify-center w-8 h-8 rounded-md hover:bg-gray-100 transition-colors"},ee().createElement(dr,{className:"w-5 h-5"})),ee().createElement("h1",{className:"text-2xl font-semibold text-gray-900"},p)),ee().createElement("div",{className:"bg-white shadow rounded-md pt-4 md:pt-6 lg:pt-8"},ee().createElement(Xp,{currentTab:t,onTabChange:n,error:r,containerClassName:"",contentClassName:""},ee().createElement(py,{currentTab:t,selectedGalleryId:(null==a?void 0:a.toString())||null,gallery:o||null,error:r,previewMode:l,onPreviewModeChange:i,onCreateNewGallery:c}))),a&&ee().createElement(ef,{onNext:function(){h(),s()},onCancel:u,nextButtonText:m,isFirstTab:g,isNextDisabled:b}))};const yy=function(){var e=vo((0,$.useState)("desktop"),2),t=e[0],n=e[1],r=(0,ge.useDispatch)(Br),a=Kl(),o=function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).onComplete,t=(0,ge.useSelect)(function(e){var t=e(Br);return{currentTab:t.getCurrentTab(),selectedGalleryId:t.getCurrentId()}},[]),n=t.currentTab,r=t.selectedGalleryId,a=(0,ge.useDispatch)(Br),o=kl(r),l=o.data,i=o.error,c=o.isLoading;(0,$.useEffect)(function(){i&&r&&(403===(null==i?void 0:i.status)||"gallery_forbidden"===(null==i?void 0:i.code))&&(a.showNotice("error",(0,pe.__)("You do not have permission to access this gallery","nggallery")),a.navigateTo("imagely","galleryList"))},[i,r,a]);var s=(0,$.useMemo)(function(){return Hp().map(function(e){return e.id})},[]),u=(0,$.useMemo)(function(){return s.indexOf(n)},[s,n]),m=0===u,d=u===s.length-1,g=(0,$.useCallback)(function(e){s.includes(e)&&a.setCurrentTab(e)},[a.setCurrentTab,s]),p=(0,$.useCallback)(function(e,t,n){a.navigateTo(e,t,n)},[a.navigateTo]),f=(0,$.useCallback)(function(){d?e&&e():g(s[u+1])},[d,u,s,g,e]),y=(0,$.useCallback)(function(){m||g(s[u-1])},[m,u,s,g]),h=(0,$.useCallback)(function(e){g(e)},[g]);return(0,$.useEffect)(function(){s.includes(n)||g("images")},[n,g,s]),(0,$.useEffect)(function(){var e=new URLSearchParams(window.location.search).get("id");if(!r&&!e){if(!Jp())return void a.setActiveModal("licenseRequired",{action:"create new galleries"});a.setActiveModal("imageUploader",{})}},[r,a.setActiveModal]),{currentTab:n,currentTabIndex:u,gallery:l,error:(null==i?void 0:i.message)||null,selectedGalleryId:r,isFirstTab:m,isLastTab:d,isLoading:c,setCurrentTab:g,goToNextTab:f,goToPreviousTab:y,goToTab:h,navigateTo:p,tabIds:s}}({onComplete:function(){r.showNotice("success",(0,pe.__)("Gallery created successfully","nggallery"))},enableTabValidation:!1}),l=o.currentTab,i=o.gallery,c=o.error,s=o.selectedGalleryId,u=o.setCurrentTab,m=o.isLoading,d=o.goToNextTab,g=o.goToPreviousTab,p=o.isFirstTab,f=o.isLastTab,y=o.navigateTo,h=(0,ge.useSelect)(function(e){return{currentId:e(Br).getCurrentId()}},[]).currentId;if(m&&s)return ee().createElement(oo,{size:"xl",text:(0,pe.__)("Loading gallery...","nggallery")});var b=h?(0,pe.__)("Edit Gallery","nggallery"):(0,pe.__)("Add New Gallery","nggallery");return ee().createElement(lu,{initialGallery:i},ee().createElement(fy,{currentTab:l,setCurrentTab:u,error:c,selectedGalleryId:s,gallery:null!=i?i:null,previewMode:t,handlePreviewModeChange:function(e){n(e)},handleCreateNewGallery:function(){Jp()?r.setActiveModal("imageUploader",{}):r.setActiveModal("licenseRequired",{action:"create new galleries"})},handleNext:function(){var e=Number(s||(null==i?void 0:i.gid)||(null==i?void 0:i.id));if(f){if(a.isEmbed&&a.onInsertGallery){if(Number.isFinite(e)&&e>0)try{a.onInsertGallery(e)}catch(e){console.error("Failed to insert gallery:",e)}return}var t=s||(null==i?void 0:i.gid)||(null==i?void 0:i.id),n=(null==i?void 0:i.name)||"",o=(null==i?void 0:i.pageid)||null;r.setActiveModal("gallerySuccess",{galleryId:t,galleryName:n,pageId:o})}else d()},handleCancel:function(){if(p)if(a.isEmbed&&a.onClose)try{a.onClose()}catch(e){console.error("Failed to close embed:",e)}else r.navigateTo("imagely","galleryList");else g()},nextButtonText:f?(0,pe.__)("Update","nggallery"):(0,pe.__)("Next step","nggallery"),navigateTo:y,isFirstTab:p,pageTitle:b,isEmbed:a.isEmbed}))},hy=function(e){var t=e.name,n=e.subtitle,r=e.description,a=e.icon,o=e.isEnabled,l=e.isLoading,i=void 0!==l&&l,c=e.onToggle,s=e.upgradeRequired,u=void 0!==s&&s,m=e.onUpgradeClick;return ee().createElement("div",{className:"bg-white rounded-2xl border border-[#E2E8F0] p-6 hover:shadow-md transition-shadow"},ee().createElement("div",{className:"w-[104px] h-[104px] rounded-lg flex items-center justify-center mb-4"},a),ee().createElement("h3",{className:"text-lg font-semibold text-gray-900 mb-2"},t),n&&ee().createElement("p",{className:"text-base font-medium text-gray-900 mb-2"},n),ee().createElement("p",{className:"text-[13px] font-normal text-gray-600 mb-4"},r),ee().createElement("button",{onClick:u?m:c,disabled:!u&&i,className:ao("inline-flex items-center justify-center gap-2 px-4 py-2.5 rounded-md text-sm font-medium transition-colors min-w-[120px]",!u&&i&&"opacity-50 cursor-not-allowed",u?"bg-amber-500 text-white hover:bg-amber-600":o?"bg-white border border-green-500 text-green-500 hover:bg-green-50":"bg-green-500 text-white hover:bg-green-600")},u?ee().createElement("span",null,(0,pe.__)("Upgrade required","nggallery")):i?ee().createElement(ee().Fragment,null,ee().createElement("span",{className:"animate-spin inline-block w-4 h-4 border-2 border-current border-t-transparent rounded-full"}),ee().createElement("span",null,o?(0,pe.__)("Activating...","nggallery"):(0,pe.__)("Deactivating...","nggallery"))):o?ee().createElement(ee().Fragment,null,ee().createElement(an,{className:"w-4 h-4 text-green-500"}),ee().createElement("span",null,(0,pe.__)("Deactivate","nggallery"))):ee().createElement("span",null,(0,pe.__)("Activate","nggallery"))))},by=function(){var e=window.imagelyApp.assetsURL+"/images/HeaderImage.png";return React.createElement("div",{className:"mb-12 bg-[#F9FAFB] rounded-2xl shadow-sm p-4 sm:p-6 lg:p-8 flex flex-col lg:flex-row lg:justify-between lg:items-center relative overflow-hidden"},React.createElement("div",{className:"w-full lg:max-w-[50%] relative z-10 mb-6 lg:mb-0"},React.createElement("h1",{className:"text-2xl sm:text-3xl font-bold mb-2 text-gray-900"},(0,pe.__)("Imagely Features","nggallery")),React.createElement("p",{className:"text-sm sm:text-base text-gray-600"},(0,pe.__)("Install unique features and styles to make every gallery shine.","nggallery"))),React.createElement("div",{className:"w-full lg:absolute lg:inset-y-0 lg:right-0 lg:w-1/2 lg:h-full flex items-center justify-center"},React.createElement("img",{src:e,alt:(0,pe.__)("Features illustration","nggallery"),className:"w-full h-48 sm:h-64 lg:h-full object-contain lg:relative lg:left-20"})))},vy=function(){var e=vo((0,$.useState)(""),2),t=e[0],r=e[1],a=vo((0,$.useState)("asc"),2),o=a[0],l=a[1],i=ws(),c=i.data,s=i.isLoading,u=i.isError,m=i.error,d=gi().data,g=function(){var e,t,r=re();return gl({mutationFn:(t=No(bs().m(function e(t){var n,r,a;return bs().w(function(e){for(;;)switch(e.n){case 0:return n=t.addonId,r=t.enabled,a=Ao(),e.n=1,Oo()({path:"/imagely/v1/addons/".concat(n,"/status"),method:"PUT",headers:{"X-WP-Nonce":a,"Content-Type":"application/json"},data:{enabled:r}});case 1:return e.a(2,e.v)}},e)})),function(e){return t.apply(this,arguments)}),onMutate:(e=No(bs().m(function e(t){var a,o,l;return bs().w(function(e){for(;;)switch(e.n){case 0:return a=t.addonId,o=t.enabled,e.n=1,r.cancelQueries({queryKey:_s.addonStates});case 1:return l=r.getQueryData(_s.addonStates),r.setQueryData(_s.addonStates,function(e){return{enabled_addons:hs(hs({},null==e?void 0:e.enabled_addons),{},n({},a,o))}}),e.a(2,{previousStates:l})}},e)})),function(t){return e.apply(this,arguments)}),onError:function(e,t,n){console.error("Failed to toggle feature:",e),null!=n&&n.previousStates&&r.setQueryData(_s.addonStates,n.previousStates)},onSuccess:function(e){r.setQueryData(_s.addonStates,{enabled_addons:e.enabled_addons})},onSettled:function(){r.invalidateQueries({queryKey:_s.addonStates})}})}(),p=$o(),f=p.showSuccess,y=p.showError,h=(0,ge.useDispatch)(Br),b=(0,$.useMemo)(function(){return function(e,t){return function(e){return Object.values(Os).filter(function(t){var n="addon_show_".concat(t.id),r=e[n];return e&&void 0!==r?ni(r):t.showInAddonsPage})}(t).map(function(t){var n;return Ss(Ss({},t),{},{isEnabled:null!==(n=null==e?void 0:e[t.id])&&void 0!==n&&n})})}(null==c?void 0:c.enabled_addons,d)},[null==c?void 0:c.enabled_addons,d]),v=(0,$.useMemo)(function(){var e=ko(b);if(t){var n=t.toLowerCase();e=e.filter(function(e){return e.name.toLowerCase().includes(n)||e.subtitle.toLowerCase().includes(n)||e.description.toLowerCase().includes(n)})}return e.sort(function(e,t){var n=e.name.localeCompare(t.name);return"asc"===o?n:-n}),e},[b,t,o]),_=["lite","starter","plus","pro"],w=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"pro";return _.indexOf(zr)>=_.indexOf(e)},x=function(e,t){var n;h.setActiveModal("upgrade",{feature:null!==(n={dribbble:"Dribbble",tiktok:"TikTok",dropbox:"Dropbox",google_analytics:"Google Analytics"}[t.toLowerCase()])&&void 0!==n?n:e})},E=1===v.length?(0,pe.__)("1 Feature","nggallery"):"".concat(v.length," ").concat((0,pe.__)("Features","nggallery"));return ee().createElement("div",{className:"bg-white rounded-2xl p-6"},ee().createElement(by,null),u&&ee().createElement("div",{className:"mb-4 p-4 rounded-lg bg-red-50 border border-red-200 text-red-800",role:"alert"},ee().createElement("p",{className:"font-medium"},(0,pe.__)("Error loading features","nggallery")),ee().createElement("p",{className:"text-sm mt-1"},m instanceof Error?m.message:(0,pe.__)("Please refresh the page and try again.","nggallery"))),ee().createElement("div",{className:"mb-8 flex px-7 flex-col sm:flex-row sm:items-center sm:justify-between gap-4"},ee().createElement("div",{className:"text-lg font-semibold text-gray-900"},E),ee().createElement("div",{className:"flex flex-col sm:flex-row gap-4"},ee().createElement("div",{className:"relative"},ee().createElement("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none"},ee().createElement(wn,{className:"w-4 h-4 text-gray-400"})),ee().createElement("input",{type:"text",placeholder:(0,pe.__)("Search Features","nggallery"),value:t,onChange:function(e){return r(e.target.value)},className:"pl-10 pr-4 py-2 border border-gray-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-green-500 focus:border-transparent"})),ee().createElement("div",{className:"relative"},ee().createElement("select",{value:o,onChange:function(e){return l(e.target.value)},className:"appearance-none font-medium [-webkit-appearance:none] [-moz-appearance:none] [background-image:none] pl-4 pr-10 py-2 border border-gray-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-green-500 focus:border-transparent bg-white"},ee().createElement("option",{value:"asc"},(0,pe.__)("Sort Ascending A-Z","nggallery")),ee().createElement("option",{value:"desc"},(0,pe.__)("Sort Descending Z-A","nggallery"))),ee().createElement("div",{className:"absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none"},ee().createElement(rn,{className:"w-4 h-4 text-gray-400"}))))),s&&ee().createElement("div",{className:"flex justify-center items-center py-12"},ee().createElement("div",{className:"flex flex-col items-center gap-2"},ee().createElement("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-green-500"}),ee().createElement("p",{className:"text-sm text-gray-600"},(0,pe.__)("Loading features...","nggallery")))),!s&&!u&&ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-x-12 gap-y-8 px-7 mb-8","data-testid":"addons-grid"},v.map(function(e){var t,n=!w(e.minPlan);return ee().createElement(hy,{key:e.id,addonId:e.id,name:e.name,subtitle:e.subtitle,description:e.description,icon:e.icon,isEnabled:e.isEnabled,isLoading:g.isPending&&(null===(t=g.variables)||void 0===t?void 0:t.addonId)===e.id,onToggle:function(){return t=e.id,n=e.isEnabled,r=e.minPlan,void(n||w(r)?g.mutate({addonId:t,enabled:!n},{onSuccess:function(e){var t=e.enabled?(0,pe.__)("enabled","nggallery"):(0,pe.__)("disabled","nggallery");f(e.message||"Feature ".concat(t," successfully"),{duration:3e3})},onError:function(e){y((null==e?void 0:e.message)||(0,pe.__)("Failed to toggle feature. Please try again.","nggallery"),{duration:5e3})}}):x(t,t));var t,n,r},upgradeRequired:n,onUpgradeClick:n?function(){return x(e.name,e.id)}:void 0})})),!s&&!u&&0===v.length&&ee().createElement("div",{className:"text-center py-12 text-gray-500"},t?(0,pe.__)("No features found matching your search.","nggallery"):(0,pe.__)("No features available.","nggallery")))},_y=function(e){var t=e.value,n=e.onChange,r=e.onSearch,a=e.placeholder,o=e.dropdownItems,l=vo((0,$.useState)(!1),2),i=l[0],c=l[1],s=function(){return c(!i)};return ee().createElement("div",{className:"relative w-full sm:w-64"},o&&ee().createElement(kg,{isOpen:i,onClose:function(){return c(!1)},onToggle:s,trigger:ee().createElement("button",{type:"button",className:"h-full px-3 flex items-center border-r border-input-border",onClick:s},ee().createElement(rn,{className:"h-4 w-4"})),className:"absolute left-0 top-full mt-1 bg-white border border-input-border rounded-md shadow-lg z-50"},o),ee().createElement("span",{className:"pointer-events-none absolute inset-y-0 left-3 flex items-center text-gray-400"},ee().createElement(wn,{className:"w-5 h-5"})),ee().createElement("input",{type:"text",value:t,onChange:function(e){return n(e.target.value)},onKeyDown:function(e){"Enter"===e.key&&r&&r()},placeholder:a||(0,pe.__)("Search","nggallery"),className:"w-full border border-input-border rounded-md pl-10 pr-3 py-2 text-sm text-gray-700 placeholder:text-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500"}))};function wy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function xy(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?wy(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):wy(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}const Ey=function(e){var t=e.title,r=e.searchTerm,a=e.setSearchTerm,o=e.onSearch,l=e.visibleColumns,i=e.setVisibleColumns,c=e.selectedItems,s=e.items,u=e.columns,m=e.searchPlaceholder,d=e.onDelete,g=e.onSetWatermark,p=e.onCreateThumbnails,f=e.onResizeImages,y=e.onImportMetadata,h=e.onRecoverFromBackup,b=vo((0,$.useState)(!1),2),v=b[0],_=b[1],w=vo((0,$.useState)(!1),2),x=w[0],E=w[1];(0,$.useEffect)(function(){0===c.size&&_(!1)},[c.size]);var C,N=function(){_(!1)};return ee().createElement("div",{className:"bg-white rounded-t-lg shadow-sm p-3 sm:p-4"},ee().createElement("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4"},t&&ee().createElement("div",{className:"flex-shrink-0"},ee().createElement("h2",{className:"text-lg font-semibold text-gray-900"},t)),ee().createElement("div",{className:"flex items-center gap-2 sm:gap-3 flex-wrap sm:ml-auto"},c.size>0&&ee().createElement(kg,{isOpen:v,onClose:function(){return _(!1)},onToggle:function(){return _(!v)},trigger:(C=(0,pe.__)("Bulk Edit","nggallery"),ee().createElement("button",{type:"button",className:"border border-gray-300 bg-white text-gray-700 hover:bg-gray-50 px-3 sm:px-4 py-2 h-9 sm:h-10 rounded-md text-xs sm:text-sm font-medium flex items-center gap-1 sm:gap-2"},ee().createElement("span",{className:"hidden sm:inline"},C),ee().createElement("span",{className:"sm:hidden"},C.split(" ")[0]),ee().createElement(rn,{className:"h-3 w-3 sm:h-4 sm:w-4"}))),activeClasses:"border border-gray-300 bg-gray-50 text-gray-700 px-4 py-2 h-10 rounded-md text-sm font-medium flex items-center gap-2"},ee().createElement("div",{className:"py-1"},ee().createElement("button",{className:"block w-full text-left px-4 py-2 text-sm text-red-700 hover:bg-red-100",onClick:function(){N();var e=s.filter(function(e){return c.has(e.id)});d(e)}},(0,pe.__)("Delete Selected","nggallery")),g&&ee().createElement("button",{className:"block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100",onClick:function(){N();var e=s.filter(function(e){return c.has(e.id)});g&&g(e)}},(0,pe.__)("Set Watermark","nggallery")),p&&ee().createElement("button",{className:"block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100",onClick:function(){N();var e=s.filter(function(e){return c.has(e.id)});p&&p(e)}},(0,pe.__)("Create New Thumbnails","nggallery")),f&&ee().createElement("button",{className:"block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100",onClick:function(){N();var e=s.filter(function(e){return c.has(e.id)});f&&f(e)}},(0,pe.__)("Resize Images","nggallery")),y&&ee().createElement("button",{className:"block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100",onClick:function(){N();var e=s.filter(function(e){return c.has(e.id)});y&&y(e)}},(0,pe.__)("Import Metadata","nggallery")),h&&ee().createElement("button",{className:"block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100",onClick:function(){N();var e=s.filter(function(e){return c.has(e.id)});h&&h(e)}},(0,pe.__)("Recover from Backup","nggallery")))),ee().createElement(_y,{value:r,onChange:a,onSearch:o,placeholder:(0,pe.__)(m)}),ee().createElement(kg,{isOpen:x,onClose:function(){return E(!1)},onToggle:function(){return E(!x)},trigger:ee().createElement("button",{type:"button",className:"border border-gray-300 bg-white text-gray-700 hover:bg-gray-50 px-3 sm:px-4 py-2 h-9 sm:h-10 rounded-md text-xs sm:text-sm font-medium flex items-center gap-1 sm:gap-2"},ee().createElement(_n,{width:"16",height:"18",viewBox:"0 0 18 20",className:"sm:w-[18px] sm:h-[20px]"})),activeClasses:"border border-gray-300 bg-gray-50 text-gray-700 px-4 py-2 h-10 rounded-md text-sm font-medium flex items-center gap-2"},ee().createElement("div",{className:"py-1"},u.filter(function(e){return!e.locked}).map(function(e){var t=e.key,r=e.label;return ee().createElement("button",{key:t,className:"flex items-center w-full px-4 py-2 text-sm text-gray-700 hover:bg-gray-100",onClick:function(){var e;e=t,i(function(t){return xy(xy({},t),{},n({},e,!t[e]))})}},ee().createElement("div",{className:"flex items-center justify-center w-5 h-5 mr-2"},l[t]&&ee().createElement(an,{className:"h-5 w-5 text-green-500"})),r)}))))))};function Cy(e,t){var n=vo((0,$.useState)(e),2),r=n[0],a=n[1];return(0,$.useEffect)(function(){var n=setTimeout(function(){a(e)},t);return function(){clearTimeout(n)}},[e,t]),r}function Ny(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}var ky={albums:"admin_albums_visible_columns",galleries:"admin_galleries_visible_columns"};function Sy(e,r){if(!e||"object"!==t(e))return r;for(var a=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ny(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ny(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},r),o=0,l=Object.keys(r);o<l.length;o++){var i=l[o];if(i in e){var c=e[i];"boolean"==typeof c?a[i]=c:"string"!=typeof c&&"number"!=typeof c||(a[i]=ni(c))}}return a}function Oy(e,r){var a=ky[e],o=gi().data,l=pi().mutate,i=re(),c=(0,$.useRef)(!1),s=(0,$.useRef)(!1),u=(0,$.useRef)(null),m=(0,$.useRef)(r);m.current=r;var d=vo((0,$.useState)(r),2),g=d[0],p=d[1];(0,$.useEffect)(function(){if(void 0!==o&&!c.current){c.current=!0,s.current=!0;var e=m.current,n=o[a],r=n&&"object"===t(n)?Sy(n,e):e;p(r)}},[o,a]),(0,$.useEffect)(function(){if(c.current){if(!s.current)return u.current&&clearTimeout(u.current),u.current=setTimeout(function(){u.current=null;var e=m.current,t=i.getQueryData(di.pluginSettings),r=null==t?void 0:t[a];(function(e,t,n){var r=Sy(t,n);return JSON.stringify(r)===JSON.stringify(e)})(g,r,e)||l(n({},a,g))},300),function(){u.current&&clearTimeout(u.current)};s.current=!1}},[g,a,l,i]);var f=(0,$.useCallback)(function(e){p(e)},[]);return[g,f]}var Py=function(){return[{key:"id",label:(0,pe.__)("ID","nggallery"),filterable:!0,visibleByDefault:!0,sortType:"backend",locked:!0},{key:"albumTitle",label:(0,pe.__)("Album Title","nggallery"),filterable:!0,visibleByDefault:!0,sortType:"backend",locked:!0},{key:"thumbnail",label:(0,pe.__)("Thumbnail","nggallery"),filterable:!1,visibleByDefault:!0,sortType:!1,locked:!0},{key:"shortcode",label:(0,pe.__)("Shortcode","nggallery"),filterable:!1,visibleByDefault:!0,sortType:!1,locked:!0},{key:"count",label:(0,pe.__)("Galleries","nggallery"),filterable:!0,visibleByDefault:!0,sortType:!1},{key:"created",label:(0,pe.__)("Created Date","nggallery"),filterable:!0,visibleByDefault:!1,sortType:"backend"},{key:"modified",label:(0,pe.__)("Modified Date","nggallery"),filterable:!0,visibleByDefault:!1,sortType:"backend"},{key:"displayType",label:(0,pe.__)("Display Type","nggallery"),filterable:!0,visibleByDefault:!1,sortType:"backend"}]},jy=Object.fromEntries(Py().map(function(e){return[e.key,e.visibleByDefault]}));const Ty=function(e){var t=e.onNext,n=e.onCancel,r=e.nextButtonText,a=void 0===r?(0,pe.__)("Next step","nggallery"):r,o=e.showNextButton,l=void 0===o||o,i=e.showCancelButton,c=void 0===i||i,s=e.isFirstTab,u=void 0===s||s,m=Kl(),d=(null==m?void 0:m.isEmbed)||!1,g=vo((0,$.useState)(160),2),p=g[0],f=g[1];return(0,$.useEffect)(function(){if(!d){var e=function(){var e=document.body,t=window.innerWidth;t<=782?f(0):t<=960||e.classList.contains("folded")?f(36):f(160)};e(),window.addEventListener("resize",e);var t=new MutationObserver(e);return t.observe(document.body,{attributes:!0,attributeFilter:["class"]}),function(){window.removeEventListener("resize",e),t.disconnect()}}f(0)},[d]),ee().createElement("div",{className:"fixed bottom-0 right-0 bg-white border-t border-gray-200 z-10",style:{left:"".concat(p,"px")}},ee().createElement("div",{className:"px-4 py-3 sm:px-6"},ee().createElement("div",{className:"flex justify-end items-center space-x-3"},c&&ee().createElement("button",{onClick:n,className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"},u?(0,pe.__)("Cancel","nggallery"):(0,pe.__)("Back","nggallery")),l&&ee().createElement("button",{onClick:t,className:"px-4 py-2 text-sm font-medium text-white bg-green-500 border border-green-500 rounded-md hover:bg-green-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 transition-colors"},a))))};var Iy=[{id:"galleries",label:(0,pe.__)("Galleries","nggallery"),description:(0,pe.__)("Select & Organize","nggallery")},{id:"settings",label:(0,pe.__)("Settings","nggallery"),description:(0,pe.__)("Album Display","nggallery")}];const Ay=function(e){var t=e.activeTab,n=e.onTabChange,r=function(e){return Iy.findIndex(function(t){return t.id===e})};return ee().createElement("div",{className:"px-4 sm:px-6 lg:px-8"},ee().createElement("div",{className:"flex flex-col sm:flex-row w-full h-auto sm:h-[70px] relative rounded-lg border border-gray-200 overflow-hidden"},Iy.map(function(e,a){var o,l=(o=e.id,t===o),i=function(e){var n=r(t);return r(e)<n}(e.id),c=a===Iy.length-1,s=String(a+1).padStart(2,"0");return ee().createElement("div",{key:e.id,className:"relative flex-1",style:{zIndex:Iy.length-a}},ee().createElement("button",{onClick:function(){return n(e.id)},className:"mobile-step-button relative w-full h-full flex items-center px-4 sm:px-6 lg:px-8 py-4 sm:py-5 transition-all duration-300 border-b sm:border-b-0 sm:border-r border-gray-100 last:border-b-0 sm:last:border-r-0 ".concat(l?"text-green-800 bg-green-100":i?"text-gray-700 hover:text-green-700 bg-gray-50":"text-gray-500 hover:text-gray-700 bg-white hover:bg-gray-50"),style:{clipPath:c?"polygon(0 0, 100% 0, 100% 100%, 0 100%, 12px 50%)":0===a?"polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%)":"polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%, 12px 50%)",marginLeft:0===a?"":"-".concat(11*a,"px"),width:c?"calc( 100% + ".concat(11*a*2,"px )"):""}},ee().createElement("div",{className:"flex items-center space-x-2 sm:space-x-3 w-full"},ee().createElement("div",{className:"w-6 h-6 sm:w-8 sm:h-8 rounded-full flex items-center justify-center text-xs sm:text-sm font-bold transition-all duration-300 flex-shrink-0 ".concat(l?"bg-white text-green-700 border border-green-700":"text-gray-400 border border-gray-200")},i&&!l?ee().createElement(an,{className:"w-3 h-3 sm:w-4 sm:h-4"}):s),ee().createElement("div",{className:"flex flex-col items-start min-w-0 flex-1"},ee().createElement("div",{className:"text-xs sm:text-sm font-semibold truncate w-full text-left"},e.label),ee().createElement("div",{className:"text-xs opacity-75 text-left"},e.description)))))})))};function Dy(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return Ly(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Ly(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Ly(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,Ly(m,"constructor",s),Ly(s,"constructor",c),c.displayName="GeneratorFunction",Ly(s,a,"GeneratorFunction"),Ly(m),Ly(m,a,"Generator"),Ly(m,r,function(){return this}),Ly(m,"toString",function(){return"[object Generator]"}),(Dy=function(){return{w:o,m:d}})()}function Ly(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}Ly=function(e,t,n,r){function o(t,n){Ly(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Ly(e,t,n,r)}var Fy=function(){return sl({queryKey:["wordpress-pages"],queryFn:(e=No(Dy().m(function e(){var t,n;return Dy().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,Oo()({path:"/wp/v2/pages?per_page=100&status=publish",method:"GET"});case 1:return t=e.v,e.a(2,t);case 2:return e.p=2,n=e.v,console.error("Failed to fetch WordPress pages:",n),e.a(2,[])}},e,null,[[0,2]])})),function(){return e.apply(this,arguments)}),staleTime:3e5,gcTime:6e5});var e};function My(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ry(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?My(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):My(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}const Gy=function(e){var t,n=e.isOpen,r=e.onClose,a=e.onSave,o=e.initialData,l=vo((0,$.useState)(o),2),i=l[0],c=l[1];(0,$.useEffect)(function(){n&&c(o)},[n,o]);var s=Fy(),u=s.data,m=s.isLoading,d=(0,$.useMemo)(function(){return u&&Array.isArray(u)?u.map(function(e){return{value:e.id.toString(),label:e.title.rendered||"Page ".concat(e.id)}}):[]},[u]);return ee().createElement(Eo,{isOpen:n,onClose:r,title:(0,pe.__)("Edit Album","nggallery")},ee().createElement("div",{className:"space-y-4"},ee().createElement(uc,{type:"text",name:"name",value:i.name,onChange:function(e){return c(Ry(Ry({},i),{},{name:e.target.value}))},label:(0,pe.__)("Album Name","nggallery"),placeholder:(0,pe.__)("Enter album name...","nggallery")}),ee().createElement(Yc,{name:"description",value:i.description,onChange:function(e){return c(Ry(Ry({},i),{},{description:e.target.value}))},label:(0,pe.__)("Album Description","nggallery"),placeholder:(0,pe.__)("Enter album description...","nggallery"),rows:3}),ee().createElement(sc,{id:"pageid",name:"pageid",value:(null===(t=i.pageid)||void 0===t?void 0:t.toString())||"",onChange:function(e){return c(Ry(Ry({},i),{},{pageid:e.target.value?parseInt(e.target.value):null}))},label:(0,pe.__)("Page Link to","nggallery")},m?ee().createElement("option",{value:""},(0,pe.__)("Loading pages...","nggallery")):ee().createElement(ee().Fragment,null,ee().createElement("option",{value:""},(0,pe.__)("Not linked","nggallery")),d.map(function(e){return ee().createElement("option",{key:e.value,value:e.value},e.label)}))),ee().createElement("div",{className:"flex justify-end space-x-3 pt-4 border-t border-gray-200"},ee().createElement("button",{onClick:r,className:"px-4 py-2 text-sm font-medium text-gray-700 hover:text-gray-500"},(0,pe.__)("Cancel","nggallery")),ee().createElement("button",{onClick:function(){a(i),r()},className:"px-4 py-2 bg-green-600 text-white text-sm font-medium rounded-md hover:bg-green-700"},(0,pe.__)("Save Changes","nggallery")))))};function By(e){if(null!=e){var n=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],r=0;if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}throw new TypeError(t(e)+" is not iterable")}function zy(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return Uy(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Uy(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Uy(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,Uy(m,"constructor",s),Uy(s,"constructor",c),c.displayName="GeneratorFunction",Uy(s,a,"GeneratorFunction"),Uy(m),Uy(m,a,"Generator"),Uy(m,r,function(){return this}),Uy(m,"toString",function(){return"[object Generator]"}),(zy=function(){return{w:o,m:d}})()}function Uy(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}Uy=function(e,t,n,r){function o(t,n){Uy(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Uy(e,t,n,r)}function qy(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return Qy(e,t);var n={}.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)?Qy(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,l=!0,i=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return l=e.done,e},e:function(e){i=!0,o=e},f:function(){try{l||null==n.return||n.return()}finally{if(i)throw o}}}}function Qy(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}const Wy=function(e){var t=e.isOpen,n=e.onClose,r=e.onSelect,a=e.albumSortorder,o=e.currentImageId,l=vo((0,$.useState)([]),2),i=l[0],c=l[1],s=vo((0,$.useState)(!1),2),u=s[0],m=s[1],d=vo((0,$.useState)(o),2),g=d[0],p=d[1];(0,$.useEffect)(function(){p(o)},[o]),(0,$.useEffect)(function(){t&&a.length>0&&f()},[t,a]);var f=function(){var e=No(zy().m(function e(){var t,n,r,o,l,i;return zy().w(function(e){for(;;)switch(e.n){case 0:return m(!0),n=[],r=new Set,o=null===(t=window.imagelyApp)||void 0===t?void 0:t.nonce,l=function(){var e=No(zy().m(function e(t){var a,i,c,s,u,m=arguments;return zy().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!((a=m.length>1&&void 0!==m[1]?m[1]:0)>10)){e.n=1;break}return e.a(2);case 1:i=qy(t),e.p=2,s=zy().m(function e(){var t,i,s,u,m,d,g,p,f,y;return zy().w(function(e){for(;;)switch(e.p=e.n){case 0:if("string"!=typeof(t=c.value)||!t.startsWith("a")){e.n=7;break}if(i=parseInt(t.substring(1)),!r.has(i)){e.n=1;break}return e.a(2,1);case 1:return r.add(i),e.p=2,e.n=3,Oo()({path:"/imagely/v1/albums/".concat(i),method:"GET",headers:{"X-WP-Nonce":o}});case 3:if(null==(s=e.v)||!s.sortorder||!Array.isArray(s.sortorder)){e.n=4;break}return e.n=4,l(s.sortorder,a+1);case 4:e.n=6;break;case 5:e.p=5,p=e.v,console.error("Failed to fetch nested album ".concat(i,":"),p);case 6:e.n=15;break;case 7:return u=t,e.p=8,e.n=9,Oo()({path:"/imagely/v1/images?gallery_id=".concat(u,"&per_page=-1"),method:"GET",headers:{"X-WP-Nonce":o}});case 9:return m=e.v,d="Gallery ".concat(u),g=null,e.p=10,e.n=11,Oo()({path:"/imagely/v1/galleries/".concat(u),method:"GET",headers:{"X-WP-Nonce":o}});case 11:g=e.v,d=g.title||g.name||d,e.n=13;break;case 12:e.p=12,f=e.v,console.warn("Failed to fetch gallery ".concat(u," info:"),f);case 13:Array.isArray(m)&&m.length>0&&m.forEach(function(e){n.push({pid:e.pid,filename:e.filename||e.alttext||"Untitled",alttext:e.alttext,thumbUrl:e.thumb_url||"",galleryName:d})}),e.n=15;break;case 14:e.p=14,y=e.v,console.error("Failed to fetch images for gallery ".concat(u,":"),y);case 15:return e.a(2)}},e,null,[[10,12],[8,14],[2,5]])}),i.s();case 3:if((c=i.n()).done){e.n=6;break}return e.d(By(s()),4);case 4:if(!e.v){e.n=5;break}return e.a(3,5);case 5:e.n=3;break;case 6:e.n=8;break;case 7:e.p=7,u=e.v,i.e(u);case 8:return e.p=8,i.f(),e.f(8);case 9:return e.a(2)}},e,null,[[2,7,8,9]])}));return function(t){return e.apply(this,arguments)}}(),e.n=1,l(a);case 1:i=Array.from(new Map(n.map(function(e){return[e.pid,e]})).values()),c(i),m(!1);case 2:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}();return ee().createElement(Eo,{isOpen:t,onClose:n,title:(0,pe.__)("Select Preview Image","nggallery")},ee().createElement("div",{className:"space-y-4"},u?ee().createElement("div",{className:"flex items-center justify-center py-12"},ee().createElement("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-green-600"}),ee().createElement("span",{className:"ml-3 text-gray-600"},(0,pe.__)("Loading images...","nggallery"))):0===i.length?ee().createElement("div",{className:"text-center py-12"},ee().createElement("p",{className:"text-gray-500"},(0,pe.__)("No images available in this album.","nggallery"))):ee().createElement(ee().Fragment,null,ee().createElement("div",{className:"text-sm text-gray-600 mb-4"},(0,pe.__)("Click an image to select it as the album preview.","nggallery")),ee().createElement("div",{className:"grid grid-cols-3 sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-6 gap-3 max-h-[500px] overflow-y-auto"},i.map(function(e){return ee().createElement("div",{key:e.pid,onClick:function(){return t=e.pid,void p(t);var t},className:"relative cursor-pointer rounded-lg overflow-hidden border-2 transition-all hover:shadow-lg ".concat(g===e.pid?"border-green-500 ring-2 ring-green-200":"border-gray-200 hover:border-gray-300")},ee().createElement("div",{className:"aspect-square"},ee().createElement("img",{src:e.thumbUrl,alt:e.filename,className:"w-full h-full object-cover",loading:"lazy"})),g===e.pid&&ee().createElement("div",{className:"absolute inset-0 bg-green-500 bg-opacity-20 flex items-center justify-center"},ee().createElement("svg",{className:"w-8 h-8 text-green-600",fill:"currentColor",viewBox:"0 0 20 20"},ee().createElement("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"}))),ee().createElement("div",{className:"absolute bottom-0 left-0 right-0 bg-black bg-opacity-60 text-white text-xs p-1 truncate"},e.filename))}))),ee().createElement("div",{className:"flex justify-end space-x-3 pt-4 border-t border-gray-200"},ee().createElement("button",{onClick:n,className:"px-4 py-2 text-sm font-medium text-gray-700 hover:text-gray-500"},(0,pe.__)("Cancel","nggallery")),ee().createElement("button",{onClick:function(){g&&r(g),n()},disabled:!g,className:"px-4 py-2 bg-green-600 text-white text-sm font-medium rounded-md hover:bg-green-700 disabled:bg-gray-300 disabled:cursor-not-allowed"},(0,pe.__)("Set as Preview","nggallery")))))},Hy=function(e){var t=e.isOpen,n=e.onClose,r=e.excludeGalleryIds,a=void 0===r?[]:r,o=e.excludeAlbumIds,l=void 0===o?[]:o,i=e.onConfirm,c=vo((0,$.useState)("galleries"),2),s=c[0],u=c[1],m=vo((0,$.useState)(new Set),2),d=m[0],g=m[1],p=vo((0,$.useState)(new Set),2),f=p[0],y=p[1],h=vo((0,$.useState)(""),2),b=h[0],v=h[1],_=vo((0,$.useState)(""),2),w=_[0],x=_[1],E=Cy(b,300),C=Cy(w,300),N=function(){var e,t,n,r,a,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:50,l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=ml({queryKey:["galleries","loadMore",o,l],queryFn:(a=No(vl().m(function e(t){var n,r,a,i,c;return vl().w(function(e){for(;;)switch(e.n){case 0:return n=t.pageParam,r=l?"&search=".concat(encodeURIComponent(l)):"",e.n=1,Lo("/imagely/v1/galleries?page=".concat(n,"&per_page=").concat(o).concat(r));case 1:return a=e.v,i=a.data,c=a.headers,e.a(2,{galleries:i,total_pages:c.totalPages,total:c.total})}},e)})),function(e){return a.apply(this,arguments)}),initialPageParam:1,getNextPageParam:function(e,t,n){return n<e.total_pages?n+1:void 0},staleTime:3e4,gcTime:6e5,retry:0,throwOnError:!1,refetchOnWindowFocus:!0,refetchOnMount:!1});return{galleries:null!==(e=null===(t=i.data)||void 0===t||null===(t=t.pages)||void 0===t?void 0:t.flatMap(function(e){return e.galleries}))&&void 0!==e?e:[],total:null!==(n=null===(r=i.data)||void 0===r||null===(r=r.pages)||void 0===r||null===(r=r[0])||void 0===r?void 0:r.total)&&void 0!==n?n:0,isLoading:i.isLoading,isFetchingMore:i.isFetchingNextPage,hasMore:i.hasNextPage,loadMore:i.fetchNextPage}}(20,E),k=N.galleries,S=N.total,O=N.isLoading,P=N.isFetchingMore,j=N.hasMore,T=N.loadMore,I=function(){var e,t,n,r,a,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:50,l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=ml({queryKey:["albums","loadMore",o,l],queryFn:(a=No(zl().m(function e(t){var n,r,a,i,c;return zl().w(function(e){for(;;)switch(e.n){case 0:return n=t.pageParam,r=l?"&search=".concat(encodeURIComponent(l)):"",e.n=1,Lo("/imagely/v1/albums?page=".concat(n,"&per_page=").concat(o).concat(r));case 1:return a=e.v,i=a.data,c=a.headers,e.a(2,{albums:i,total_pages:c.totalPages,total:c.total})}},e)})),function(e){return a.apply(this,arguments)}),initialPageParam:1,getNextPageParam:function(e,t,n){return n<e.total_pages?n+1:void 0},staleTime:3e4,gcTime:6e5,retry:0,throwOnError:!1,refetchOnWindowFocus:!0,refetchOnMount:!1});return{albums:null!==(e=null===(t=i.data)||void 0===t||null===(t=t.pages)||void 0===t?void 0:t.flatMap(function(e){return e.albums}))&&void 0!==e?e:[],total:null!==(n=null===(r=i.data)||void 0===r||null===(r=r.pages)||void 0===r||null===(r=r[0])||void 0===r?void 0:r.total)&&void 0!==n?n:0,isLoading:i.isLoading,isFetchingMore:i.isFetchingNextPage,hasMore:i.hasNextPage,loadMore:i.fetchNextPage}}(20,C),A=I.albums,D=I.total,L=I.isLoading,F=I.isFetchingMore,M=I.hasMore,R=I.loadMore,G=$o(),B=(G.showSuccess,G.showError),z=(0,$.useMemo)(function(){return k.filter(function(e){return!a.includes(e.id)})},[k,a]),U=(0,$.useMemo)(function(){return A.filter(function(e){return!l.includes(e.id)})},[A,l]),q=function(){g(new Set),y(new Set),v(""),x(""),n()};return ee().createElement(Eo,{isOpen:t,onClose:q,title:(0,pe.__)("Add Items to Album","nggallery")},ee().createElement("div",{className:"space-y-4"},ee().createElement("div",{className:"flex border-b border-gray-200"},ee().createElement("button",{onClick:function(){return u("galleries")},className:"flex-1 py-2 px-4 text-sm font-medium transition-colors ".concat("galleries"===s?"border-b-2 border-green-500 text-green-600":"text-gray-500 hover:text-gray-700")},(0,pe.__)("Galleries","nggallery")," ",d.size>0&&"(".concat(d.size,")")),ee().createElement("button",{onClick:function(){return u("albums")},className:"flex-1 py-2 px-4 text-sm font-medium transition-colors ".concat("albums"===s?"border-b-2 border-green-500 text-green-600":"text-gray-500 hover:text-gray-700")},(0,pe.__)("Albums","nggallery")," ",f.size>0&&"(".concat(f.size,")"))),ee().createElement("div",{className:"min-h-[400px]"},"galleries"===s?ee().createElement(ee().Fragment,null,ee().createElement("div",{className:"mb-4"},ee().createElement("input",{type:"text",placeholder:(0,pe.__)("Search galleries...","nggallery"),value:b,onChange:function(e){return v(e.target.value)},className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-green-500"})),z.length>0&&ee().createElement("div",{className:"mb-3 flex items-center justify-between"},ee().createElement("span",{className:"text-sm text-gray-600"},(0,pe.sprintf)((0,pe.__)("%d of %d galleries available","nggallery"),z.length,S)),ee().createElement("button",{onClick:function(){d.size===z.length?g(new Set):g(new Set(z.map(function(e){return e.id})))},className:"text-sm text-green-600 hover:text-green-700 font-medium"},d.size===z.length?(0,pe.__)("Deselect All","nggallery"):(0,pe.__)("Select All","nggallery"))),O&&ee().createElement("div",{className:"flex items-center justify-center py-12"},ee().createElement(oo,null)),!O&&0===z.length&&ee().createElement("div",{className:"text-center py-12"},ee().createElement("p",{className:"text-gray-500"},b?(0,pe.__)("No galleries found matching your search","nggallery"):(0,pe.__)("No galleries available to add","nggallery"))),!O&&z.length>0&&ee().createElement("div",{className:"border border-gray-200 rounded-lg p-4 max-h-96 overflow-y-auto"},ee().createElement("div",{className:"grid grid-cols-2 gap-3"},z.map(function(e){return ee().createElement("label",{key:e.id,className:"flex items-center p-3 border rounded-lg cursor-pointer transition-colors ".concat(d.has(e.id)?"border-green-500 bg-green-50":"border-gray-200 hover:border-gray-300")},ee().createElement("input",{type:"checkbox",checked:d.has(e.id),onChange:function(){return t=e.id,void g(function(e){var n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n});var t},className:"h-4 w-4 text-green-600 focus:ring-green-500 border-gray-300 rounded mr-3"}),ee().createElement("div",{className:"flex-1 min-w-0"},ee().createElement("div",{className:"flex items-center space-x-3"},e.thumbnail?ee().createElement("img",{src:e.thumbnail,alt:e.galleryTitle,className:"w-12 h-12 object-cover rounded"}):ee().createElement("div",{className:"w-12 h-12 bg-gray-100 rounded flex items-center justify-center"},ee().createElement("svg",{className:"h-6 w-6 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},ee().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"}))),ee().createElement("div",{className:"flex-1 min-w-0"},ee().createElement("div",{className:"text-sm font-medium text-gray-900 truncate"},e.galleryTitle),ee().createElement("div",{className:"text-xs text-gray-500"},(0,pe.sprintf)((0,pe.__)("%d images","nggallery"),parseInt(e.count)||0))))))})),j&&ee().createElement("div",{className:"mt-3 text-center"},ee().createElement("button",{onClick:function(){return T()},disabled:P,className:"px-4 py-2 text-sm text-green-600 border border-green-500 rounded-md hover:bg-green-50 disabled:opacity-50"},P?(0,pe.__)("Loading...","nggallery"):(0,pe.__)("Load More","nggallery"))))):ee().createElement(ee().Fragment,null,ee().createElement("div",{className:"mb-4"},ee().createElement("input",{type:"text",placeholder:(0,pe.__)("Search albums...","nggallery"),value:w,onChange:function(e){return x(e.target.value)},className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-green-500"})),U.length>0&&ee().createElement("div",{className:"mb-3 flex items-center justify-between"},ee().createElement("span",{className:"text-sm text-gray-600"},(0,pe.sprintf)((0,pe.__)("%d of %d albums available","nggallery"),U.length,D)),ee().createElement("button",{onClick:function(){f.size===U.length?y(new Set):y(new Set(U.map(function(e){return e.id})))},className:"text-sm text-green-600 hover:text-green-700 font-medium"},f.size===U.length?(0,pe.__)("Deselect All","nggallery"):(0,pe.__)("Select All","nggallery"))),L&&ee().createElement("div",{className:"flex items-center justify-center py-12"},ee().createElement(oo,null)),!L&&0===U.length&&ee().createElement("div",{className:"text-center py-12"},ee().createElement("p",{className:"text-gray-500"},w?(0,pe.__)("No albums found matching your search","nggallery"):(0,pe.__)("No albums available to add","nggallery"))),!L&&U.length>0&&ee().createElement("div",{className:"border border-gray-200 rounded-lg p-4 max-h-96 overflow-y-auto"},ee().createElement("div",{className:"grid grid-cols-2 gap-3"},U.map(function(e){return ee().createElement("label",{key:e.id,className:"flex items-center p-3 border-2 rounded-lg cursor-pointer transition-colors ".concat(f.has(e.id)?"border-purple-600 bg-purple-50":"border-purple-300 hover:border-purple-400")},ee().createElement("input",{type:"checkbox",checked:f.has(e.id),onChange:function(){return t=e.id,void y(function(e){var n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n});var t},className:"h-4 w-4 text-purple-600 focus:ring-purple-500 border-gray-300 rounded mr-3"}),ee().createElement("div",{className:"flex-1 min-w-0"},ee().createElement("div",{className:"flex items-center space-x-3"},e.thumbnail?ee().createElement("img",{src:e.thumbnail,alt:e.albumTitle,className:"w-12 h-12 object-cover rounded"}):ee().createElement("div",{className:"w-12 h-12 bg-gray-100 rounded flex items-center justify-center"},ee().createElement("svg",{className:"h-6 w-6 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},ee().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"}))),ee().createElement("div",{className:"flex-1 min-w-0"},ee().createElement("div",{className:"text-sm font-medium text-gray-900 truncate"},e.albumTitle),ee().createElement("div",{className:"text-xs text-gray-500"},(0,pe.sprintf)((0,pe.__)("%d items","nggallery"),parseInt(e.count)||0))))))})),M&&ee().createElement("div",{className:"mt-3 text-center"},ee().createElement("button",{onClick:function(){return R()},disabled:F,className:"px-4 py-2 text-sm text-green-600 border border-green-500 rounded-md hover:bg-green-50 disabled:opacity-50"},F?(0,pe.__)("Loading...","nggallery"):(0,pe.__)("Load More","nggallery")))))),ee().createElement("div",{className:"flex justify-end space-x-3 pt-4 border-t border-gray-200"},ee().createElement("button",{onClick:q,className:"px-4 py-2 text-sm font-medium text-gray-700 hover:text-gray-500"},(0,pe.__)("Cancel","nggallery")),ee().createElement("button",{onClick:function(){var e=Array.from(d),t=Array.from(f);0!==e.length||0!==t.length?(i&&i(e,t),g(new Set),y(new Set),v(""),x(""),n()):B((0,pe.__)("Please select at least one item","nggallery"))},disabled:0===d.size&&0===f.size,className:"px-4 py-2 bg-green-500 text-white text-sm font-medium rounded-md hover:bg-green-600 disabled:bg-green-300 disabled:cursor-not-allowed"},(0,pe.__)("Add Items","nggallery")," (",d.size+f.size,")"))))},Vy=function(e){var t=e.albumName,n=e.previewImageUrl,r=e.itemCount,a=e.onEditClick,o=e.onImageClick,l=t&&t.length>50?t.slice(0,50)+"...":t||(0,pe.__)("Untitled Album","nggallery");return ee().createElement("div",{className:"flex items-center space-x-3 sm:space-x-4 pb-6 border-b border-gray-200"},ee().createElement("img",{src:n||Ns({text:"NO IMAGE"}),alt:l,onClick:o,className:"w-10 h-10 sm:w-12 sm:h-12 object-cover rounded flex-shrink-0 cursor-pointer hover:opacity-80 transition-opacity",title:(0,pe.__)("Click to select preview image","nggallery")}),ee().createElement("div",{className:"flex flex-col min-w-0 flex-1"},ee().createElement("div",{className:"flex flex-col sm:flex-row sm:items-center space-y-1 sm:space-y-0 sm:space-x-2"},ee().createElement("h1",{className:"text-lg sm:text-xl font-semibold truncate"},l," (",r,")"),ee().createElement("button",{className:"px-2 py-1 bg-gray-100 rounded hover:bg-gray-200 text-xs sm:text-sm flex items-center self-start sm:self-auto",onClick:a},ee().createElement("svg",{width:"8",height:"8",viewBox:"0 0 10 10",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"mr-1 sm:w-2.5 sm:h-2.5"},ee().createElement("path",{d:"M7.5 0.500151C7.63132 0.368829 7.78722 0.264659 7.9588 0.193588C8.13038 0.122517 8.31428 0.0859375 8.5 0.0859375C8.68572 0.0859375 8.86962 0.122517 9.0412 0.193588C9.21278 0.264659 9.36868 0.36883 9.5 0.500151C9.63132 0.631473 9.73549 0.787375 9.80656 0.958955C9.87763 1.13054 9.91421 1.31443 9.91421 1.50015C9.91421 1.68587 9.87763 1.86977 9.80656 2.04135C9.73549 2.21293 9.63132 2.36883 9.5 2.50015L2.75 9.25015L0 10.0002L0.75 7.25015L7.5 0.500151Z",fill:"currentColor"})),(0,pe.__)("Edit Details","nggallery")))))};var Ky=(0,$.memo)(function(e){var t=e.item,n=e.isSelected,r=e.onSelect,a=vo((0,$.useState)(!1),2),o=a[0],l=a[1],i=fg({id:(null==t?void 0:t.id)||0,transition:{duration:150,easing:"cubic-bezier(0.25, 1, 0.5, 1)"}}),c=i.attributes,s=i.listeners,u=i.setNodeRef,m=i.transform,d=i.transition,g=i.isDragging;if(!t||null==t||!t.id)return null;var p={transform:Xu.Transform.toString(m),transition:d,opacity:g?.5:1,touchAction:"none",willChange:"transform, opacity"},f=o||n,y="album"===t.type;return ee().createElement("div",{className:"relative w-[160px]"},ee().createElement("div",{ref:u,style:p,className:"relative bg-white rounded-lg will-change-transform ".concat(g?"z-10 shadow-xl ring-2 ring-blue-500":""," ").concat(n?"ring-2 ring-blue-500":""),"data-testid":"sortable-item-".concat(t.id),onMouseEnter:function(){return l(!0)},onMouseLeave:function(){return l(!1)}},ee().createElement("div",{className:"absolute top-2 left-2 z-20"},ee().createElement("input",{title:(0,pe.__)("Select item","nggallery"),type:"checkbox",checked:n,onChange:function(e){e.stopPropagation(),r(t.id)},onClick:function(e){return e.stopPropagation()},className:"rounded border-gray-300 cursor-pointer"})),y&&ee().createElement("div",{className:"absolute top-2 right-2 bg-purple-500 text-white px-2 py-1 rounded text-xs font-medium z-20"},(0,pe.__)("Album","nggallery")),ee().createElement("div",{className:"overflow-hidden rounded-lg bg-gray-100 flex items-center justify-center relative",style:{width:160,height:110}},t.thumbnail?ee().createElement("img",{src:t.thumbnail,alt:t.title,className:"object-cover rounded-lg",loading:"lazy",width:160,height:110,draggable:!1,style:{width:160,height:110}}):ee().createElement("div",{className:"flex flex-col items-center justify-center text-gray-400"},ee().createElement(ee().Fragment,null,ee().createElement(hr,{className:"w-8 h-8 mb-2"}),ee().createElement("span",{className:"text-xs"},(0,pe.__)("No Preview","nggallery")))),f&&ee().createElement("div",{className:"absolute inset-0 bg-black bg-opacity-30 transition-opacity rounded-lg"})),ee().createElement("div",{className:"p-3"},ee().createElement("div",{className:"flex items-center justify-between"},ee().createElement("div",{className:"flex-1 min-w-0"},ee().createElement("p",{className:"text-sm font-medium text-gray-900 truncate",title:t.title},t.title),ee().createElement("p",{className:"text-xs text-gray-500 mt-1"},t.count," ",y?(0,pe.__)("items","nggallery"):(0,pe.__)("images","nggallery"))),ee().createElement("button",fe({},c,s,{className:"flex-shrink-0 text-gray-400 hover:text-gray-600 p-1 rounded cursor-move ml-2",title:(0,pe.__)("Drag to reorder","nggallery")}),ee().createElement(mn,{className:"text-gray-500"}))))))});Ky.displayName="SortableItem";const Xy=Ky;function Yy(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return Zy(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Zy(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Zy(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,Zy(m,"constructor",s),Zy(s,"constructor",c),c.displayName="GeneratorFunction",Zy(s,a,"GeneratorFunction"),Zy(m),Zy(m,a,"Generator"),Zy(m,r,function(){return this}),Zy(m,"toString",function(){return"[object Generator]"}),(Yy=function(){return{w:o,m:d}})()}function Zy(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}Zy=function(e,t,n,r){function o(t,n){Zy(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Zy(e,t,n,r)}function Jy(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function $y(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Jy(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Jy(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var eh=(0,$.createContext)(void 0),th="photocrati-nextgen_basic_compact_album",nh=function(e){if(!e)return th;if(e.startsWith("photocrati-")||e.startsWith("imagely-"))return e;switch(e){case"basic_compact_album":return"photocrati-nextgen_basic_compact_album";case"basic_extended_album":return"photocrati-nextgen_basic_extended_album";case"pro_grid_album":return"photocrati-nextgen_pro_grid_album";case"pro_list_album":return"photocrati-nextgen_pro_list_album";case"pro_search":return"imagely-pro-search";default:return th}},rh=function(e){return"photocrati-nextgen_basic_compact_album"===e||"photocrati-nextgen_basic_extended_album"===e?{open_gallery_in_lightbox:!1,gallery_display_type:"photocrati-nextgen_basic_thumbnails",galleries_per_page:20,enable_breadcrumbs:!0,enable_descriptions:!1,display_view:"default",template:"default",override_thumbnail_settings:1,thumbnail_width:240,thumbnail_height:160,thumbnail_crop:1,animate_images_enable:!1,animate_images_style:"wobble",animate_images_duration:1500,animate_images_delay:250,animate_pagination_enable:!1,animate_pagination_style:"flipInX",animate_pagination_duration:1500,animate_pagination_delay:250,is_ecommerce_enabled:0}:{}},ah=function(e,n){var r=rh(e),a=n&&"object"===t(n)?n:{};return $y($y({},r),a)},oh=function(e){var t=e.children,r=e.initialAlbum,a=vo((0,$.useState)(r),2),o=a[0],l=a[1],i=vo((0,$.useState)(!1),2),c=i[0],s=i[1],u=Hl(),m=vo((0,$.useState)(function(){var e=nh(null==r?void 0:r.display_type),t=(null==r?void 0:r.display_type_settings)||{},a=$y($y({},t),{},n({},e,ah(e,t[e])));return r?{name:r.name||"",description:r.description||"",display_type:e,display_type_settings:a,sortorder:r.sortorder||[],preview_image_id:r.preview_image_id||null,pageid:r.pageid||null}:{name:"",description:"",display_type:e,display_type_settings:n({},e,rh(e)),sortorder:[],preview_image_id:null,pageid:null}}),2),d=m[0],g=m[1];(0,$.useEffect)(function(){if(r&&r!==o){var e=nh(r.display_type),t=r.display_type_settings||{},a=$y($y({},t),{},n({},e,ah(e,t[e])));if(l(r),c)return;g({name:r.name||"",description:r.description||"",display_type:e,display_type_settings:a,sortorder:r.sortorder||[],preview_image_id:r.preview_image_id||null,pageid:r.pageid||null})}},[r,o,c]);var p=(0,$.useCallback)(function(e,t){g(function(r){return $y($y({},r),{},n({},e,t))}),s(!0)},[]),f=(0,$.useCallback)(function(e,t){g(function(r){return $y($y({},r),{},{display_type_settings:$y($y({},r.display_type_settings),{},n({},e,t))})}),s(!0)},[]),y=(0,$.useCallback)(No(Yy().m(function e(){var t,n;return Yy().w(function(e){for(;;)switch(e.p=e.n){case 0:if(null!=o&&o.id&&c){e.n=1;break}return e.a(2);case 1:return e.p=1,e.n=2,u.mutateAsync({id:o.id,data:d});case 2:t=e.v,l(t),s(!1),e.n=4;break;case 3:throw e.p=3,n=e.v,console.error("Failed to save album:",n),n;case 4:return e.a(2)}},e,null,[[1,3]])})),[null==o?void 0:o.id,d,c,u]),h=(0,$.useCallback)(function(){if(o){var e=nh(o.display_type),t=o.display_type_settings||{},r=$y($y({},t),{},n({},e,ah(e,t[e])));g({name:o.name||"",description:o.description||"",display_type:e,display_type_settings:r,sortorder:o.sortorder||[],preview_image_id:o.preview_image_id||null,pageid:o.pageid||null}),s(!1)}},[o]),b={album:o,formData:d,isLoading:u.isPending,isDirty:c,updateField:p,updateDisplayTypeSetting:f,saveForm:y,resetForm:h};return ee().createElement(eh.Provider,{value:b},t)},lh=function(){var e=(0,$.useContext)(eh);if(void 0===e)throw new Error("useAlbumForm must be used within an AlbumFormProvider");return e};function ih(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ch(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ih(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ih(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function sh(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return uh(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(uh(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,uh(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,uh(m,"constructor",s),uh(s,"constructor",c),c.displayName="GeneratorFunction",uh(s,a,"GeneratorFunction"),uh(m),uh(m,a,"Generator"),uh(m,r,function(){return this}),uh(m,"toString",function(){return"[object Generator]"}),(sh=function(){return{w:o,m:d}})()}function uh(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}uh=function(e,t,n,r){function o(t,n){uh(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},uh(e,t,n,r)}var mh=function(e){var t=null==e?void 0:e.page;return"number"==typeof t?t:null};const dh=function(e){var t,n=e.albumId,r=lh(),a=r.formData,o=r.updateField,l=$o(),i=l.showSuccess,c=l.showError,s=Hl(),u=Ql(n).data,m=gi().data,d=(null==m?void 0:m.item_details_per_page)||50,g=vo((0,$.useState)([]),2),p=g[0],f=g[1],y=vo((0,$.useState)(new Set),2),h=y[0],b=y[1],v=vo((0,$.useState)(null),2),_=v[0],w=v[1],x=vo((0,$.useState)(null),2),E=x[0],C=x[1],N=vo((0,$.useState)(!1),2),k=N[0],S=N[1],O=vo((0,$.useState)(!1),2),P=O[0],j=O[1],T=vo((0,$.useState)(!1),2),I=T[0],A=T[1],D=vo((0,$.useState)(1),2),L=D[0],F=D[1],M=(0,$.useRef)(!1),R=(0,$.useRef)([]),G=(0,$.useMemo)(function(){return(a.sortorder||[]).filter(function(e){return"number"==typeof e})},[a.sortorder]),B=(0,$.useMemo)(function(){return(a.sortorder||[]).filter(function(e){return"string"==typeof e&&e.startsWith("a")}).map(function(e){return parseInt(e.substring(1))})},[a.sortorder]),z=function(e,t){var n,r=(t||{}).enabled,a=void 0===r||r;return sl({queryKey:["galleries","batch",e.sort().join(",")],queryFn:(n=No(vl().m(function t(){var n,r,a,o,l,i,c,s,u,m;return vl().w(function(t){for(;;)switch(t.n){case 0:if(e&&0!==e.length){t.n=1;break}return t.a(2,[]);case 1:if(r=null===(n=window.imagelyApp)||void 0===n?void 0:n.nonce,!(e.length<=100)){t.n=3;break}return t.n=2,Oo()({path:"/imagely/v1/galleries/batch",method:"POST",headers:{"X-WP-Nonce":r,"Content-Type":"application/json"},data:{ids:e}});case 2:return a=t.v,t.a(2,Array.isArray(a)?a:[]);case 3:for(o=[],l=0;l<e.length;l+=100)o.push(e.slice(l,l+100));i=[],c=0,s=o;case 4:if(!(c<s.length)){t.n=7;break}return u=s[c],t.n=5,Oo()({path:"/imagely/v1/galleries/batch",method:"POST",headers:{"X-WP-Nonce":r,"Content-Type":"application/json"},data:{ids:u}});case 5:m=t.v,Array.isArray(m)&&i.push.apply(i,ko(m));case 6:c++,t.n=4;break;case 7:return t.a(2,i)}},t)})),function(){return n.apply(this,arguments)}),enabled:a&&e.length>0,staleTime:12e4,gcTime:6e5,retry:0,throwOnError:!1})}(G,{enabled:G.length>0}),U=z.data,q=void 0===U?[]:U,Q=z.isLoading,W=Wl({get_all:!0}),H=W.data,V=W.isLoading,K=(null==H?void 0:H.albums)||[],X=(0,$.useMemo)(function(){return K.filter(function(e){return B.includes(e.id)})},[K,B]),Y=(0,$.useMemo)(function(){return q.map(function(e){return{id:e.gid,galleryTitle:e.title||e.name||"",count:e.counter||"0",thumbnail:e.previewpic_url||"",shortcode:'[imagely id="'.concat(e.gid,'"]'),eCommerce:"1"===e.is_ecommerce_enabled,is_private:e.is_private,created:e.date_created,modified:e.date_modified,displayType:e.display_type}})},[q]),Z=(0,$.useMemo)(function(){if(Q||V)return!0;if(a.sortorder&&a.sortorder.length>0){var e=Y.length>0||!a.sortorder.some(function(e){return"number"==typeof e}),t=X.length>0||!a.sortorder.some(function(e){return"string"==typeof e&&e.startsWith("a")});if(!e||!t)return 0===p.length}return!1},[Q,V,Y.length,X.length,a.sortorder,p.length]),J=cm(im(ad,{activationConstraint:{distance:8,delay:100,tolerance:10}}),im($m,{coordinateGetter:bg}));(0,$.useEffect)(function(){if(!M.current)if((Y.length>0||X.length>0)&&a.sortorder&&a.sortorder.length>0){var e=a.sortorder.map(function(e){if("string"==typeof e&&e.startsWith("a")){var t=parseInt(e.substring(1)),n=X.find(function(e){return e.id===t});if(n)return{id:e,type:"album",title:n.albumTitle,count:n.count.toString(),thumbnail:n.thumbnail,shortcode:n.shortcode,created:n.created,modified:n.modified,displayType:n.displayType}}else{var r=Y.find(function(t){return t.id===e});if(r)return{id:r.id,type:"gallery",title:r.galleryTitle,count:r.count,thumbnail:r.thumbnail,shortcode:r.shortcode,eCommerce:r.eCommerce,is_private:r.is_private,created:r.created,modified:r.modified,displayType:r.displayType}}return null}).filter(Boolean);f(e)}else a.sortorder&&0===a.sortorder.length&&f([])},[Y.length,X.length,a.sortorder]),(0,$.useEffect)(function(){R.current=p},[p]);var te=(0,$.useCallback)(function(){var e=No(sh().m(function e(t){var r,a,l,u,m,d,g,p;return sh().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r=t.active,a=t.over,w(null),C(null),!a||null===mh(a.data.current)){e.n=1;break}return setTimeout(function(){M.current=!1},100),e.a(2);case 1:if(!a||r.id===a.id){e.n=6;break}return l=R.current,u=l.findIndex(function(e){return e.id===r.id}),m=l.findIndex(function(e){return e.id===a.id}),d=eg(l,u,m),g=d.map(function(e){return e.id}),f(d),o("sortorder",g),e.p=2,e.n=3,s.mutateAsync({id:n,data:{sortorder:g}});case 3:i((0,pe.__)("Album order updated!","nggallery")),e.n=5;break;case 4:e.p=4,p=e.v,c((0,pe.__)("Failed to save album order: "+p,"nggallery"));case 5:window.navigator.vibrate&&window.navigator.vibrate([50,50,50]);case 6:setTimeout(function(){M.current=!1},100);case 7:return e.a(2)}},e,null,[[2,4]])}));return function(t){return e.apply(this,arguments)}}(),[o,n,s,i,c]),ne=(0,$.useCallback)(function(){w(null),C(null),M.current=!1},[]),re=(0,$.useCallback)(function(e){F(e)},[]),ae=(0,$.useCallback)(function(e){var t=e.droppableContainers.filter(function(e){return null!==mh(e.data.current)}),n=e.droppableContainers.filter(function(e){return null===mh(e.data.current)});if(t.length>0)if(e.pointerCoordinates){var r=wm(ch(ch({},e),{},{droppableContainers:t}));if(r.length>0)return r}else{var a=hm(ch(ch({},e),{},{droppableContainers:t}));if(a.length>0)return a}return hm(ch(ch({},e),{},{droppableContainers:n}))},[]),oe=(0,$.useCallback)(function(e){b(function(t){var n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),le=(0,$.useCallback)(function(){var e=No(sh().m(function e(t,r){var l,u,m,d;return sh().w(function(e){for(;;)switch(e.p=e.n){case 0:return l=[].concat(ko(t),ko(r.map(function(e){return"a".concat(e)}))),u=[].concat(ko(a.sortorder),ko(l)),o("sortorder",u),e.p=1,e.n=2,s.mutateAsync({id:n,data:{sortorder:u}});case 2:m=t.length+r.length,i((0,pe.sprintf)((0,pe.__)("%d item(s) added to album!","nggallery"),m)),e.n=4;break;case 3:e.p=3,d=e.v,c((0,pe.__)("Failed to add items to album: "+d,"nggallery"));case 4:return e.a(2)}},e,null,[[1,3]])}));return function(t,n){return e.apply(this,arguments)}}(),[a.sortorder,o,n,s,i,c]),ie=function(){var e=No(sh().m(function e(){var t,r,l,u,m;return sh().w(function(e){for(;;)switch(e.p=e.n){case 0:return r=Array.from(h),l=(null===(t=a.sortorder)||void 0===t?void 0:t.filter(function(e){return!r.includes(e)}))||[],o("sortorder",l),f(function(e){return e.filter(function(e){return!r.includes(e.id)})}),b(new Set),e.p=1,e.n=2,s.mutateAsync({id:n,data:{sortorder:l}});case 2:u=r.length,i(1===u?(0,pe.__)("Item removed from album!","nggallery"):(0,pe.sprintf)((0,pe.__)("%d items removed from album!","nggallery"),u)),e.n=4;break;case 3:e.p=3,m=e.v,c((0,pe.__)("Failed to update album: "+m,"nggallery"));case 4:return e.a(2)}},e,null,[[1,3]])}));return function(){return e.apply(this,arguments)}}(),ce=p.length,se=Math.ceil(ce/d),ue=(L-1)*d,me=ue+d,de=p.slice(ue,me),ge=(0,$.useCallback)(function(e){F(e),b(new Set)},[]);(0,$.useEffect)(function(){L>se&&se>0&&F(1)},[se,L]);var fe=(0,$.useMemo)(function(){return de.map(function(e){return e.id})},[de]),ye=null!=E?E:_&&null!==(t=p.find(function(e){return e.id===_}))&&void 0!==t?t:null,he=(0,$.useMemo)(function(){return p.filter(function(e){return"gallery"===e.type}).map(function(e){return e.id})},[p]),be=(0,$.useMemo)(function(){return p.filter(function(e){return"album"===e.type}).map(function(e){return parseInt(e.id.substring(1))})},[p]),ve=(0,$.useMemo)(function(){return(null==u?void 0:u.previewpic_url)||null},[u]),_e=(0,$.useCallback)(function(){var e=No(sh().m(function e(t,n){var r,a,o,l,i,s,u,m,d,g,p;return sh().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,o=null===(r=window.imagelyApp)||void 0===r?void 0:r.nonce,e.n=1,Oo()({path:"/wp/v2/pages/".concat(t,"?context=edit"),method:"GET",headers:{"X-WP-Nonce":o}});case 1:if(l=e.v,i=(null===(a=l.content)||void 0===a?void 0:a.raw)||"",s=new RegExp("\\[imagely[^\\]]*album=[\"']?".concat(n,"[\"']?[^\\]]*\\]"),"i"),u=new RegExp("\\[ngg[^\\]]*album=[\"']?".concat(n,"[\"']?[^\\]]*\\]"),"i"),!s.test(i)&&!u.test(i)){e.n=2;break}return e.a(2);case 2:return m='[imagely album="'.concat(n,'"]'),d=""===i.trim()?m:"".concat(i,"\n\n").concat(m),e.n=3,Oo()({path:"/wp/v2/pages/".concat(t),method:"POST",data:{content:d},headers:{"X-WP-Nonce":o}});case 3:e.n=5;break;case 4:e.p=4,p=e.v,console.error("Failed to insert album shortcode into page:",p),g=(null==p?void 0:p.message)||(0,pe.__)("Unknown error occurred","nggallery"),c((0,pe.__)("Failed to insert album shortcode into page: ","nggallery")+g);case 5:return e.a(2)}},e,null,[[0,4]])}));return function(t,n){return e.apply(this,arguments)}}(),[c]),we=(0,$.useCallback)(function(){var e=No(sh().m(function e(t){var r,l;return sh().w(function(e){for(;;)switch(e.p=e.n){case 0:return r=a.pageid,e.p=1,e.n=2,s.mutateAsync({id:n,data:{name:t.name,description:t.description,pageid:t.pageid}});case 2:if(o("name",t.name),o("description",t.description),o("pageid",t.pageid),!t.pageid||t.pageid===r){e.n=3;break}return e.n=3,_e(t.pageid,n);case 3:i((0,pe.__)("Album updated successfully!","nggallery")),e.n=5;break;case 4:e.p=4,l=e.v,c((0,pe.__)("Failed to update album: "+l,"nggallery"));case 5:return e.a(2)}},e,null,[[1,4]])}));return function(t){return e.apply(this,arguments)}}(),[n,a.pageid,s,o,_e,i,c]),xe=(0,$.useCallback)(function(){var e=No(sh().m(function e(t){var r;return sh().w(function(e){for(;;)switch(e.p=e.n){case 0:return o("preview_image_id",t),e.p=1,e.n=2,s.mutateAsync({id:n,data:{preview_image_id:t}});case 2:i((0,pe.__)("Preview image updated!","nggallery")),e.n=4;break;case 3:e.p=3,r=e.v,console.error("Failed to update preview image:",r);case 4:return e.a(2)}},e,null,[[1,3]])}));return function(t){return e.apply(this,arguments)}}(),[n,o,s,i]);return ee().createElement("div",{className:"space-y-6 px-6 py-6 lg:px-8 lg:py-8"},ee().createElement(Vy,{albumName:a.name||"",previewImageUrl:ve,itemCount:p.length,onEditClick:function(){return j(!0)},onImageClick:function(){return A(!0)}}),ee().createElement("div",null,ee().createElement("div",{className:"flex items-center justify-between mb-4"},ee().createElement("h4",{className:"text-sm font-medium text-gray-900"},(0,pe.__)("Selected Items","nggallery")," (",ce,")"),ee().createElement("div",{className:"flex items-center space-x-2"},h.size>0&&ee().createElement("button",{onClick:ie,className:"px-3 py-1 bg-red-600 text-white rounded-md hover:bg-red-700 text-sm"},(0,pe.__)("Remove Selected","nggallery")," (",h.size,")"),de.length>1&&ee().createElement("button",{onClick:function(){h.size===de.length?b(new Set):b(new Set(de.map(function(e){return e.id})))},className:"px-3 py-1 bg-blue-100 text-blue-700 rounded-md hover:bg-blue-200 text-sm"},h.size===de.length?(0,pe.__)("Deselect All","nggallery"):(0,pe.__)("Select All","nggallery")))),Z?ee().createElement("div",{className:"p-12 flex justify-center"},ee().createElement(oo,{size:"lg",text:(0,pe.__)("Loading album content...","nggallery")})):ce>0?ee().createElement("div",{className:"space-y-6"},ee().createElement(Md,{sensors:J,collisionDetection:ae,onDragStart:function(e){var t;M.current=!0;var n=e.active.id;w(n);var r=null!==(t=R.current.find(function(e){return e.id===n}))&&void 0!==t?t:null;C(r),window.navigator.vibrate&&window.navigator.vibrate(50)},onDragEnd:te,onDragCancel:ne,measuring:{droppable:{strategy:md.Always}}},ee().createElement(cg,{items:fe,strategy:rg},ee().createElement("div",{className:"grid gap-6 grid-cols-[repeat(auto-fill,_160px)]"},ee().createElement("div",{className:"w-40 h-32 border-2 border-dashed border-green-300 rounded-lg flex flex-col items-center justify-center cursor-pointer hover:border-green-400 hover:bg-green-50 transition-colors group",onClick:function(){return S(!0)}},ee().createElement("div",{className:"w-8 h-8 bg-green-100 rounded-full flex items-center justify-center mb-2 group-hover:bg-green-200 transition-colors"},ee().createElement(ln,{className:"w-5 h-5 text-green-500 group-hover:text-green-600"})),ee().createElement("span",{className:"text-sm text-green-500 group-hover:text-green-600 font-medium"},(0,pe.__)("Add Item","nggallery"))),de.map(function(e){return ee().createElement(Xy,{key:e.id,item:e,isSelected:h.has(e.id),onSelect:oe})}))),ee().createElement($d,null,ye&&ee().createElement("div",{className:"transform scale-105 opacity-90 pointer-events-none"},ee().createElement(Xy,{item:ye,isSelected:h.has(ye.id),onSelect:oe}))),null!==_&&se>1&&ee().createElement(Zf,{currentPage:L,totalPages:se,onPaginate:re})),!Z&&se>1&&ee().createElement("div",{className:null!==_?"invisible":"","aria-hidden":null!==_},ee().createElement(Xf,{currentPage:L,totalPages:se,perPage:d,total:ce,onPageChange:ge,itemLabel:(0,pe.__)("Items","nggallery")}))):ee().createElement("div",null,ee().createElement("div",{className:"mb-4"},ee().createElement("div",{className:"w-32 h-24 border-2 border-dashed border-green-300 rounded-lg flex flex-col items-center justify-center cursor-pointer hover:border-green-400 hover:bg-green-50 transition-colors group inline-flex",onClick:function(){return S(!0)}},ee().createElement("div",{className:"w-8 h-8 bg-green-100 rounded-full flex items-center justify-center mb-1 group-hover:bg-green-200 transition-colors"},ee().createElement(ln,{className:"w-5 h-5 text-green-500 group-hover:text-green-600"})),ee().createElement("span",{className:"text-sm text-green-500 group-hover:text-green-600 font-medium"},(0,pe.__)("Add Item","nggallery")))),ee().createElement("p",{className:"text-gray-500 text-sm"},(0,pe.__)("No content in this album yet. Click the button above to add galleries or albums.","nggallery")))),ee().createElement(Hy,{isOpen:k,onClose:function(){return S(!1)},excludeGalleryIds:he,excludeAlbumIds:[n].concat(ko(be)),onConfirm:le}),ee().createElement(Gy,{isOpen:P,onClose:function(){return j(!1)},onSave:we,initialData:{name:a.name||"",description:a.description||"",pageid:a.pageid||null}}),ee().createElement(Wy,{isOpen:I,onClose:function(){return A(!1)},onSelect:xe,albumSortorder:a.sortorder||[],currentImageId:a.preview_image_id||null}))};function gh(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ph(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?gh(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):gh(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function fh(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return yh(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(yh(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,yh(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,yh(m,"constructor",s),yh(s,"constructor",c),c.displayName="GeneratorFunction",yh(s,a,"GeneratorFunction"),yh(m),yh(m,a,"Generator"),yh(m,r,function(){return this}),yh(m,"toString",function(){return"[object Generator]"}),(fh=function(){return{w:o,m:d}})()}function yh(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}yh=function(e,t,n,r){function o(t,n){yh(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},yh(e,t,n,r)}function hh(){return sl({queryKey:["display-types"],queryFn:(e=No(fh().m(function e(){var t,n;return fh().w(function(e){for(;;)switch(e.n){case 0:return n=null===(t=window.imagelyApp)||void 0===t?void 0:t.nonce,e.n=1,Oo()({path:"/imagely/v1/display-types",method:"GET",headers:{"X-WP-Nonce":n}});case 1:return e.a(2,e.v)}},e)})),function(){return e.apply(this,arguments)}),staleTime:3e5,gcTime:6e5});var e}function bh(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function vh(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?bh(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):bh(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function _h(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return wh(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(wh(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,wh(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,wh(m,"constructor",s),wh(s,"constructor",c),c.displayName="GeneratorFunction",wh(s,a,"GeneratorFunction"),wh(m),wh(m,a,"Generator"),wh(m,r,function(){return this}),wh(m,"toString",function(){return"[object Generator]"}),(_h=function(){return{w:o,m:d}})()}function wh(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}wh=function(e,t,n,r){function o(t,n){wh(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},wh(e,t,n,r)}var xh=[{id:"photocrati-nextgen_basic_compact_album",name:(0,pe.__)("Compact Album","nggallery"),icon:ee().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-full h-full",viewBox:"0 0 120 98"},ee().createElement("rect",{x:"8",y:"12",width:"32",height:"22",fill:"currentColor"}),ee().createElement("rect",{x:"44",y:"12",width:"32",height:"22",fill:"currentColor"}),ee().createElement("rect",{x:"80",y:"12",width:"32",height:"22",fill:"currentColor"}),ee().createElement("rect",{x:"8",y:"38",width:"32",height:"22",fill:"currentColor"}),ee().createElement("rect",{x:"44",y:"38",width:"32",height:"22",fill:"currentColor"}),ee().createElement("rect",{x:"80",y:"38",width:"32",height:"22",fill:"currentColor"}),ee().createElement("rect",{x:"8",y:"64",width:"32",height:"22",fill:"currentColor"}),ee().createElement("rect",{x:"44",y:"64",width:"32",height:"22",fill:"currentColor"}),ee().createElement("rect",{x:"80",y:"64",width:"32",height:"22",fill:"currentColor"}))},{id:"photocrati-nextgen_basic_extended_album",name:(0,pe.__)("Extended Album","nggallery"),icon:ee().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-full h-full",viewBox:"0 0 120 98"},ee().createElement("rect",{x:"8",y:"12",width:"104",height:"20",fill:"currentColor"}),ee().createElement("rect",{x:"8",y:"38",width:"104",height:"20",fill:"currentColor"}),ee().createElement("rect",{x:"8",y:"64",width:"104",height:"20",fill:"currentColor"}))},{id:"photocrati-nextgen_pro_grid_album",name:(0,pe.__)("Grid Album","nggallery"),icon:ee().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-full h-full",viewBox:"0 0 120 98",fill:"currentColor"},ee().createElement("rect",{x:"8",y:"12",width:"32",height:"22"}),ee().createElement("rect",{x:"44",y:"12",width:"32",height:"22"}),ee().createElement("rect",{x:"80",y:"12",width:"32",height:"22"}),ee().createElement("rect",{x:"8",y:"38",width:"32",height:"22"}),ee().createElement("rect",{x:"44",y:"38",width:"32",height:"22"}),ee().createElement("rect",{x:"80",y:"38",width:"32",height:"22"}),ee().createElement("rect",{x:"8",y:"64",width:"32",height:"22"}),ee().createElement("rect",{x:"44",y:"64",width:"32",height:"22"}),ee().createElement("rect",{x:"80",y:"64",width:"32",height:"22"}),ee().createElement("circle",{cx:"14",cy:"18",r:"2",fill:"white"}),ee().createElement("circle",{cx:"50",cy:"18",r:"2",fill:"white"}),ee().createElement("circle",{cx:"86",cy:"18",r:"2",fill:"white"}))},{id:"photocrati-nextgen_pro_list_album",name:(0,pe.__)("List Album","nggallery"),icon:ee().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-full h-full",viewBox:"0 0 120 98",fill:"currentColor"},ee().createElement("rect",{x:"8",y:"16",width:"20",height:"15"}),ee().createElement("rect",{x:"32",y:"16",width:"80",height:"4"}),ee().createElement("rect",{x:"32",y:"23",width:"60",height:"3"}),ee().createElement("rect",{x:"8",y:"41",width:"20",height:"15"}),ee().createElement("rect",{x:"32",y:"41",width:"80",height:"4"}),ee().createElement("rect",{x:"32",y:"48",width:"60",height:"3"}),ee().createElement("rect",{x:"8",y:"66",width:"20",height:"15"}),ee().createElement("rect",{x:"32",y:"66",width:"80",height:"4"}),ee().createElement("rect",{x:"32",y:"73",width:"60",height:"3"}))},{id:"imagely-pro-search",name:(0,pe.__)("Search","nggallery"),icon:ee().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-full h-full",viewBox:"0 0 120 98",fill:"currentColor"},ee().createElement("rect",{x:"8",y:"12",width:"85",height:"6",rx:"3"}),ee().createElement("circle",{cx:"102",cy:"15",r:"6"}),ee().createElement("path",{d:"m104 17 6 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),ee().createElement("rect",{x:"8",y:"28",width:"32",height:"22"}),ee().createElement("rect",{x:"44",y:"28",width:"32",height:"22"}),ee().createElement("rect",{x:"80",y:"28",width:"32",height:"22"}),ee().createElement("rect",{x:"8",y:"54",width:"32",height:"22"}),ee().createElement("rect",{x:"44",y:"54",width:"32",height:"22"}),ee().createElement("rect",{x:"80",y:"54",width:"32",height:"22"}))}];const Eh=function(e){var t,r=e.albumId,a=e.previewMode,o=e.onPreviewModeChange,l=lh(),i=l.formData,c=l.updateField,s=l.saveForm,u=l.isDirty,m=l.album,d=(0,ge.useDispatch)(Br),g=vo((0,$.useState)(null),2),p=g[0],f=g[1],y=(null===(t=window.imagelyApp)||void 0===t?void 0:t.proTypeInstalled)||"lite",h=function(e){var t=["photocrati-nextgen_basic_compact_album","photocrati-nextgen_basic_extended_album"],n=[].concat(t,["photocrati-nextgen_pro_grid_album","photocrati-nextgen_pro_list_album","imagely-pro-search"]);switch(e){case"pro":case"plus":return n;default:return t}}(y);(0,$.useEffect)(function(){i.display_type||c("display_type","photocrati-nextgen_basic_compact_album")},[i.display_type,c]);var b=(0,$.useCallback)(function(e){switch(e){case"photocrati-nextgen_basic_compact_album":return{open_gallery_in_lightbox:!1,gallery_display_type:"photocrati-nextgen_basic_thumbnails",galleries_per_page:20,enable_breadcrumbs:!0,enable_descriptions:!1,display_view:"default",template:"default",override_thumbnail_settings:1,thumbnail_width:240,thumbnail_height:160,thumbnail_crop:1,animate_images_enable:!1,animate_images_style:"wobble",animate_images_duration:1500,animate_images_delay:250,animate_pagination_enable:!1,animate_pagination_style:"flipInX",animate_pagination_duration:1500,animate_pagination_delay:250,is_ecommerce_enabled:0};case"photocrati-nextgen_basic_extended_album":return{open_gallery_in_lightbox:!1,gallery_display_type:"photocrati-nextgen_basic_thumbnails",galleries_per_page:20,enable_breadcrumbs:!0,enable_descriptions:!1,display_view:"default",template:"default",override_thumbnail_settings:1,thumbnail_width:300,thumbnail_height:200,thumbnail_crop:1,animate_images_enable:!1,animate_images_style:"wobble",animate_images_duration:1500,animate_images_delay:250,animate_pagination_enable:!1,animate_pagination_style:"flipInX",animate_pagination_duration:1500,animate_pagination_delay:250,is_ecommerce_enabled:0};case"photocrati-nextgen_pro_grid_album":return{gallery_display_type:"photocrati-nextgen_pro_thumbnail_grid",background_color:"#FFFFFF",border_color:"#CCCCCC",border_size:1,caption_color:"#333333",caption_size:13,display_type_view:"default",enable_breadcrumbs:!0,enable_descriptions:!1,padding:20,spacing:10,open_gallery_in_lightbox:0,override_thumbnail_settings:0,thumbnail_crop:1,thumbnail_height:160,thumbnail_quality:100,thumbnail_watermark:0,thumbnail_width:240,animate_images_enable:!1,animate_images_style:"wobble",animate_images_duration:1500,animate_images_delay:250,animate_pagination_enable:!1,animate_pagination_style:"flipInX",animate_pagination_duration:"1500",animate_pagination_delay:"250",is_ecommerce_enabled:0};case"photocrati-nextgen_pro_list_album":return{gallery_display_type:"photocrati-nextgen_pro_thumbnail_grid",background_color:"#FFFFFF",border_color:"#CCCCCC",border_size:1,caption_color:"#333333",caption_size:18,description_color:"#333333",description_size:13,display_type_view:"default",enable_breadcrumbs:!0,enable_descriptions:!1,padding:20,spacing:10,open_gallery_in_lightbox:0,override_thumbnail_settings:0,thumbnail_crop:1,thumbnail_height:160,thumbnail_quality:100,thumbnail_watermark:0,thumbnail_width:240,animate_images_enable:!1,animate_images_style:"wobble",animate_images_duration:1500,animate_images_delay:250,animate_pagination_enable:!1,animate_pagination_style:"flipInX",animate_pagination_duration:"1500",animate_pagination_delay:"250",is_ecommerce_enabled:0};case"imagely-pro-search":return{search_mode:"natural",enable_tag_filter:!0,search_alttext:!0,search_description:!0,search_tags:!0,limit:0,order_by:"pid",order_direction:"ASC",order_by_relevance:!0,minimum_relevance:1,gallery_display_type:"photocrati-nextgen_basic_thumbnails"};default:return{gallery_display_type:"photocrati-nextgen_basic_thumbnails",enable_breadcrumbs:!0,enable_descriptions:!1,use_lightbox_effect:!0}}},[]),v=hh(),_=(0,$.useMemo)(function(){var e=v.data;return e?Object.values(e).filter(function(e){return Array.isArray(e.entity_types)&&e.entity_types.includes("image")}).filter(function(e){return"photocrati-nextgen_basic_singlepic"!==e.name}).map(function(e){return{value:e.name,label:(e.title||"").replace(/NextGEN\s*/gi,"").trim()}}):[]},[v.data]),w=(0,$.useMemo)(function(){var e=v.data;return e?Object.values(e).filter(function(e){return Array.isArray(e.entity_types)&&e.entity_types.includes("image")}).map(function(e){return{value:e.name,label:(e.title||"").replace(/NextGEN\s*/gi,"").trim()}}):[]},[v.data]),x=(0,$.useCallback)(No(_h().m(function e(){var t;return _h().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!u||!r){e.n=4;break}return e.p=1,e.n=2,s();case 2:e.n=4;break;case 3:e.p=3,t=e.v,console.error("Auto-save failed:",t);case 4:return e.a(2)}},e,null,[[1,3]])})),[u,r,s]);(0,$.useEffect)(function(){if(u){var e=setTimeout(x,1e3);return function(){return clearTimeout(e)}}},[i,x,u]);var E=(0,$.useMemo)(function(){return null!=m&&m.sortorder&&0!==m.sortorder.length?m.sortorder.join("-"):"empty"},[null==m?void 0:m.sortorder]),C=(0,$.useMemo)(function(){var e;if(!m)return m;var t=m.display_type||"photocrati-nextgen_pro_grid_album",r=b(t),a=(null===(e=m.display_type_settings)||void 0===e?void 0:e[t])||{},o=vh(vh({},r),a);return vh(vh({},m),{},{display_type_settings:vh(vh({},m.display_type_settings),{},n({},t,o))})},[m,b]),N=af({type:"album",item:C,itemId:r,cacheKey:E}),k=function(e,t){var r,a=i.display_type,o=vh(vh({},i.display_type_settings),{},n({},a,vh(vh({},(null===(r=i.display_type_settings)||void 0===r?void 0:r[a])||{}),{},n({},e,t))));c("display_type_settings",o)},S=p&&!h.includes(p);return ee().createElement("div",{className:"bg-white rounded-lg shadow lg:grid lg:grid-cols-2 lg:items-start"},ee().createElement("div",{className:"px-4 py-4 border-b lg:border-b-0 lg:border-r"},ee().createElement("div",{className:"space-y-4"},ee().createElement("h1",{className:"text-lg font-medium"},(0,pe.__)("Album Settings","nggallery")),ee().createElement(nf,{title:(0,pe.__)("Choose Layout","nggallery"),defaultExpanded:!0,className:"mb-4"},ee().createElement("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-2 sm:gap-4"},xh.map(function(e){var t=h.includes(e.id),n=(p||i.display_type)===e.id;return ee().createElement("div",{key:e.id,className:"flex flex-col items-center text-center"},ee().createElement("div",{className:"relative p-1 border rounded-md cursor-pointer transition-all duration-200 w-full ".concat(n?"border-green-500":t?"border-gray-600 hover:border-green-500":"border-gray-200 hover:border-green-500"),onClick:function(){return t=e.id,f(t),void(h.includes(t)&&c("display_type",t));var t}},ee().createElement("div",{className:"flex items-center justify-center ".concat(n?"text-gray-600":"text-gray-200 hover:text-gray-600")},ee().createElement("div",{className:"w-12 h-8 sm:w-16 sm:h-12 flex items-center justify-center"},e.icon))),ee().createElement("h3",{className:"text-xs font-medium mt-1 sm:mt-2 ".concat(t?"text-gray-300":"text-gray-400")},e.name))}))),ee().createElement("div",{className:S?"opacity-50 pointer-events-none":""},ee().createElement(nf,{title:(0,pe.__)("Customize Album Look","nggallery"),defaultExpanded:!0,className:"mb-4"},function(){var e,t,n,r,a,o,l,c,s,u,m,g,p=(null===(e=i.display_type_settings)||void 0===e?void 0:e[i.display_type])||{};switch(i.display_type){case"photocrati-nextgen_basic_compact_album":case"photocrati-nextgen_basic_extended_album":default:return t=p,ee().createElement("div",{className:"space-y-4"},"pro"===zr||"plus"===zr?ee().createElement(fs,{id:"open-gallery-in-pro-lightbox",name:"open_gallery_in_lightbox",checked:!!t.open_gallery_in_lightbox,onChange:function(e){return k("open_gallery_in_lightbox",e.target.checked)},label:(0,pe.__)("Open gallery in Pro Lightbox","nggallery"),help:(0,pe.__)("Open child galleries directly in Pro Lightbox instead of navigating.","nggallery")}):null,!t.open_gallery_in_lightbox&&ee().createElement(sc,{id:"gallery-display-type",name:"gallery_display_type",value:t.gallery_display_type||"photocrati-nextgen_basic_thumbnails",onChange:function(e){return k("gallery_display_type",e.target.value)},label:(0,pe.__)("Display galleries as","nggallery"),help:(0,pe.__)("How would you like galleries to be displayed?","nggallery")},_.map(function(e){return ee().createElement("option",{key:e.value,value:e.value},e.label)})),ee().createElement(uc,{type:"number",name:"galleries_per_page",value:String(null!==(n=t.galleries_per_page)&&void 0!==n?n:20),onChange:function(e){return k("galleries_per_page",parseInt(e.target.value))},label:(0,pe.__)("Items per page","nggallery"),help:(0,pe.__)("Maximum number of galleries or sub-albums to appear on a single page","nggallery"),min:0,max:200}),ee().createElement(fs,{id:"enable-breadcrumbs",name:"enable_breadcrumbs",checked:!1!==t.enable_breadcrumbs,onChange:function(e){return k("enable_breadcrumbs",e.target.checked)},label:(0,pe.__)("Enable breadcrumbs","nggallery")}),ee().createElement("input",{type:"hidden",name:"display_view",value:"default"}),ee().createElement(bf,{prefix:"album",value:null!==(r=t.template)&&void 0!==r?r:"default",onChange:function(e){return k("template",e.target.value)}}),ee().createElement(fs,{id:"enable-descriptions",name:"enable_descriptions",checked:!!t.enable_descriptions,onChange:function(e){return k("enable_descriptions",e.target.checked)},label:(0,pe.__)("Display descriptions","nggallery")}),ee().createElement(fs,{id:"override_thumbnail_settings",name:"override_thumbnail_settings",checked:!!t.override_thumbnail_settings,onChange:function(e){return k("override_thumbnail_settings",e.target.checked)},label:(0,pe.__)("Override thumbnail settings","nggallery"),help:(0,pe.__)("This does not affect existing thumbnails; overriding the thumbnail settings will create an additional set of thumbnails. To change the size of existing thumbnails please visit 'Manage Galleries' and choose 'Create new thumbnails' for all images in the gallery.","nggallery")}),t.override_thumbnail_settings?ee().createElement("div",{className:"ml-6 space-y-4"},ee().createElement(cc,{htmlFor:"thumbnail_dimensions",help:(0,pe.__)("These are maximum values","nggallery")},(0,pe.__)("Thumbnail dimensions","nggallery")),ee().createElement("div",{className:"flex gap-4"},ee().createElement(uc,{type:"number",name:"thumbnail_width",value:String(null!==(a=t.thumbnail_width)&&void 0!==a?a:240),onChange:function(e){return k("thumbnail_width",parseInt(e.target.value))}}),ee().createElement(uc,{type:"number",name:"thumbnail_height",value:String(null!==(o=t.thumbnail_height)&&void 0!==o?o:160),onChange:function(e){return k("thumbnail_height",parseInt(e.target.value))}})),ee().createElement(fs,{id:"thumbnail_crop",name:"thumbnail_crop",checked:!!t.thumbnail_crop,onChange:function(e){return k("thumbnail_crop",e.target.checked)},label:(0,pe.__)("Thumbnail crop","nggallery")})):null,ee().createElement(_f,{formState:{animate_images_enable:!!t.animate_images_enable,animate_images_style:null!==(l=t.animate_images_style)&&void 0!==l?l:"wobble",animate_images_duration:String(null!==(c=t.animate_images_duration)&&void 0!==c?c:1500),animate_images_delay:String(null!==(s=t.animate_images_delay)&&void 0!==s?s:250),animate_pagination_enable:!!t.animate_pagination_enable,animate_pagination_style:null!==(u=t.animate_pagination_style)&&void 0!==u?u:"flipInX",animate_pagination_duration:String(null!==(m=t.animate_pagination_duration)&&void 0!==m?m:1500),animate_pagination_delay:String(null!==(g=t.animate_pagination_delay)&&void 0!==g?g:250)},handleInputChange:function(e){var t,n=(e.target||{}).name,r=e.target&&"checked"in e.target?e.target.checked:null===(t=e.target)||void 0===t?void 0:t.value;/duration|delay/.test(n)&&(r=parseInt(r)),k(n,r)}}),"pro"===y?ee().createElement(fs,{id:"enable-ecommerce",name:"is_ecommerce_enabled",checked:!!t.is_ecommerce_enabled,onChange:function(e){return k("is_ecommerce_enabled",e.target.checked)},label:(0,pe.__)("Enable eCommerce","nggallery")}):ee().createElement("div",{className:"relative"},ee().createElement("div",{className:"opacity-50 pointer-events-none"},ee().createElement(fs,{id:"enable-ecommerce",name:"is_ecommerce_enabled",checked:!1,onChange:function(){},label:(0,pe.__)("Enable eCommerce","nggallery")})),ee().createElement("div",{className:"absolute inset-0 cursor-pointer",onClick:function(){return d.setActiveModal("upgrade",{feature:"eCommerce features"})},title:(0,pe.__)("Requires NextGEN Gallery Pro","nggallery")})));case"photocrati-nextgen_pro_grid_album":return function(e){var t,n,r,a,o,l,i,c,s,u,m,g,p,f,h,b;return ee().createElement("div",{className:"space-y-4"},ee().createElement(fs,{id:"open_gallery_in_lightbox_grid",name:"open_gallery_in_lightbox",checked:!!e.open_gallery_in_lightbox,onChange:function(e){return k("open_gallery_in_lightbox",e.target.checked?1:0)},label:(0,pe.__)("Open gallery in Pro Lightbox","nggallery"),help:(0,pe.__)("Open child galleries directly in Pro Lightbox instead of navigating.","nggallery")}),!e.open_gallery_in_lightbox&&ee().createElement(sc,{id:"gallery-display-type-grid",name:"gallery_display_type",value:e.gallery_display_type||(null===(t=_[0])||void 0===t?void 0:t.value)||"",onChange:function(e){return k("gallery_display_type",e.target.value)},label:(0,pe.__)("Display galleries as","nggallery"),help:(0,pe.__)("How would you like galleries to be displayed?","nggallery")},_.map(function(e){return ee().createElement("option",{key:e.value,value:e.value},e.label)})),ee().createElement("div",{className:"grid grid-cols-2 gap-4"},ee().createElement(uc,{type:"number",name:"spacing",value:String(null!==(n=e.spacing)&&void 0!==n?n:10),onChange:function(e){return k("spacing",parseInt(e.target.value))},label:(0,pe.__)("Spacing","nggallery"),min:0,max:50}),ee().createElement(uc,{type:"number",name:"padding",value:String(null!==(r=e.padding)&&void 0!==r?r:20),onChange:function(e){return k("padding",parseInt(e.target.value))},label:(0,pe.__)("Padding","nggallery"),min:0,max:100})),ee().createElement(uc,{type:"number",name:"border_size",value:String(null!==(a=e.border_size)&&void 0!==a?a:1),onChange:function(e){return k("border_size",parseInt(e.target.value))},label:(0,pe.__)("Border size","nggallery")}),ee().createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},(0,pe.__)("Border color","nggallery")),ee().createElement(Of,{color:null!==(o=e.border_color)&&void 0!==o?o:"#CCCCCC",onChange:function(e){return k("border_color",e)}}),ee().createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},(0,pe.__)("Background color","nggallery")),ee().createElement(Of,{color:null!==(l=e.background_color)&&void 0!==l?l:"#FFFFFF",onChange:function(e){return k("background_color",e)}}),ee().createElement(uc,{type:"number",name:"caption_size",value:String(null!==(i=e.caption_size)&&void 0!==i?i:13),onChange:function(e){return k("caption_size",parseInt(e.target.value))},label:(0,pe.__)("Caption size","nggallery")}),ee().createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},(0,pe.__)("Caption color","nggallery")),ee().createElement(Of,{color:null!==(c=e.caption_color)&&void 0!==c?c:"#333333",onChange:function(e){return k("caption_color",e)}}),ee().createElement("input",{type:"hidden",name:"display_type_view",value:"default"}),ee().createElement(fs,{id:"override_thumbnail_settings_grid",name:"override_thumbnail_settings",checked:!!e.override_thumbnail_settings,onChange:function(e){return k("override_thumbnail_settings",e.target.checked?1:0)},label:(0,pe.__)("Override thumbnail settings","nggallery"),help:(0,pe.__)("This does not affect existing thumbnails; overriding the thumbnail settings will create an additional set of thumbnails.","nggallery")}),e.override_thumbnail_settings?ee().createElement("div",{className:"ml-6 space-y-4"},ee().createElement(cc,{htmlFor:"thumbnail_dimensions",help:(0,pe.__)("These are maximum values","nggallery")},(0,pe.__)("Thumbnail dimensions","nggallery")),ee().createElement("div",{className:"flex gap-4"},ee().createElement(uc,{type:"number",name:"thumbnail_width",value:String(null!==(s=e.thumbnail_width)&&void 0!==s?s:240),onChange:function(e){return k("thumbnail_width",parseInt(e.target.value))}}),ee().createElement(uc,{type:"number",name:"thumbnail_height",value:String(null!==(u=e.thumbnail_height)&&void 0!==u?u:160),onChange:function(e){return k("thumbnail_height",parseInt(e.target.value))}})),ee().createElement(fs,{id:"thumbnail_crop_grid",name:"thumbnail_crop",checked:!!e.thumbnail_crop,onChange:function(e){return k("thumbnail_crop",e.target.checked?1:0)},label:(0,pe.__)("Thumbnail crop","nggallery")})):null,ee().createElement(fs,{id:"enable_breadcrumbs_grid",name:"enable_breadcrumbs",checked:!1!==e.enable_breadcrumbs,onChange:function(e){return k("enable_breadcrumbs",e.target.checked)},label:(0,pe.__)("Enable breadcrumbs","nggallery")}),"pro"===y?ee().createElement(fs,{id:"enable-ecommerce-grid",name:"is_ecommerce_enabled",checked:!!e.is_ecommerce_enabled,onChange:function(e){return k("is_ecommerce_enabled",e.target.checked?1:0)},label:(0,pe.__)("Enable eCommerce","nggallery")}):ee().createElement("div",{className:"relative"},ee().createElement("div",{className:"opacity-50 pointer-events-none"},ee().createElement(fs,{id:"enable-ecommerce-grid",name:"is_ecommerce_enabled",checked:!1,onChange:function(){},label:(0,pe.__)("Enable eCommerce","nggallery")})),ee().createElement("div",{className:"absolute inset-0 cursor-pointer",onClick:function(){return d.setActiveModal("upgrade",{feature:"eCommerce features"})},title:(0,pe.__)("Requires NextGEN Gallery Pro","nggallery")})),ee().createElement(_f,{formState:{animate_images_enable:!!e.animate_images_enable,animate_images_style:null!==(m=e.animate_images_style)&&void 0!==m?m:"wobble",animate_images_duration:String(null!==(g=e.animate_images_duration)&&void 0!==g?g:1500),animate_images_delay:String(null!==(p=e.animate_images_delay)&&void 0!==p?p:250),animate_pagination_enable:!!e.animate_pagination_enable,animate_pagination_style:null!==(f=e.animate_pagination_style)&&void 0!==f?f:"flipInX",animate_pagination_duration:String(null!==(h=e.animate_pagination_duration)&&void 0!==h?h:1500),animate_pagination_delay:String(null!==(b=e.animate_pagination_delay)&&void 0!==b?b:250)},handleInputChange:function(e){var t,n=(e.target||{}).name,r=e.target&&"checked"in e.target?e.target.checked:null===(t=e.target)||void 0===t?void 0:t.value;/duration|delay/.test(n)&&(r=parseInt(r)),k(n,r)},hidePagination:!0}))}(p);case"photocrati-nextgen_pro_list_album":return function(e){var t,n,r,a,o,l,i,c,s,u,m,g,p,f,h,b,v,w;return ee().createElement("div",{className:"space-y-4"},ee().createElement(fs,{id:"open_gallery_in_lightbox_list",name:"open_gallery_in_lightbox",checked:!!e.open_gallery_in_lightbox,onChange:function(e){return k("open_gallery_in_lightbox",e.target.checked?1:0)},label:(0,pe.__)("Open gallery in Pro Lightbox","nggallery"),help:(0,pe.__)("Open child galleries directly in Pro Lightbox instead of navigating.","nggallery")}),!e.open_gallery_in_lightbox&&ee().createElement(sc,{id:"gallery-display-type-list",name:"gallery_display_type",value:e.gallery_display_type||(null===(t=_[0])||void 0===t?void 0:t.value)||"",onChange:function(e){return k("gallery_display_type",e.target.value)},label:(0,pe.__)("Display galleries as","nggallery"),help:(0,pe.__)("How would you like galleries to be displayed?","nggallery")},_.map(function(e){return ee().createElement("option",{key:e.value,value:e.value},e.label)})),ee().createElement("div",{className:"grid grid-cols-2 gap-4"},ee().createElement(uc,{type:"number",name:"spacing",value:String(null!==(n=e.spacing)&&void 0!==n?n:10),onChange:function(e){return k("spacing",parseInt(e.target.value))},label:(0,pe.__)("Spacing","nggallery"),min:0,max:50}),ee().createElement(uc,{type:"number",name:"padding",value:String(null!==(r=e.padding)&&void 0!==r?r:20),onChange:function(e){return k("padding",parseInt(e.target.value))},label:(0,pe.__)("Padding","nggallery"),min:0,max:100})),ee().createElement(uc,{type:"number",name:"border_size",value:String(null!==(a=e.border_size)&&void 0!==a?a:1),onChange:function(e){return k("border_size",parseInt(e.target.value))},label:(0,pe.__)("Border size","nggallery")}),ee().createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},(0,pe.__)("Border color","nggallery")),ee().createElement(Of,{color:null!==(o=e.border_color)&&void 0!==o?o:"#CCCCCC",onChange:function(e){return k("border_color",e)}}),ee().createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},(0,pe.__)("Background color","nggallery")),ee().createElement(Of,{color:null!==(l=e.background_color)&&void 0!==l?l:"#FFFFFF",onChange:function(e){return k("background_color",e)}}),ee().createElement("div",{className:"grid grid-cols-2 gap-4"},ee().createElement(uc,{type:"number",name:"caption_size",value:String(null!==(i=e.caption_size)&&void 0!==i?i:18),onChange:function(e){return k("caption_size",parseInt(e.target.value))},label:(0,pe.__)("Caption size","nggallery"),min:10,max:30}),ee().createElement(uc,{type:"number",name:"description_size",value:String(null!==(c=e.description_size)&&void 0!==c?c:13),onChange:function(e){return k("description_size",parseInt(e.target.value))},label:(0,pe.__)("Description size","nggallery"),min:10,max:24})),ee().createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},(0,pe.__)("Caption color","nggallery")),ee().createElement(Of,{color:null!==(s=e.caption_color)&&void 0!==s?s:"#333333",onChange:function(e){return k("caption_color",e)}}),ee().createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},(0,pe.__)("Description color","nggallery")),ee().createElement(Of,{color:null!==(u=e.description_color)&&void 0!==u?u:"#333333",onChange:function(e){return k("description_color",e)}}),ee().createElement("input",{type:"hidden",name:"display_type_view",value:"default"}),ee().createElement(fs,{id:"override_thumbnail_settings_list",name:"override_thumbnail_settings",checked:!!e.override_thumbnail_settings,onChange:function(e){return k("override_thumbnail_settings",e.target.checked?1:0)},label:(0,pe.__)("Override thumbnail settings","nggallery"),help:(0,pe.__)("This does not affect existing thumbnails; overriding the thumbnail settings will create an additional set of thumbnails.","nggallery")}),e.override_thumbnail_settings?ee().createElement("div",{className:"ml-6 space-y-4"},ee().createElement(cc,{htmlFor:"thumbnail_dimensions_list",help:(0,pe.__)("These are maximum values","nggallery")},(0,pe.__)("Thumbnail dimensions","nggallery")),ee().createElement("div",{className:"flex gap-4"},ee().createElement(uc,{type:"number",name:"thumbnail_width",value:String(null!==(m=e.thumbnail_width)&&void 0!==m?m:240),onChange:function(e){return k("thumbnail_width",parseInt(e.target.value))}}),ee().createElement(uc,{type:"number",name:"thumbnail_height",value:String(null!==(g=e.thumbnail_height)&&void 0!==g?g:160),onChange:function(e){return k("thumbnail_height",parseInt(e.target.value))}})),ee().createElement(fs,{id:"thumbnail_crop_list",name:"thumbnail_crop",checked:!!e.thumbnail_crop,onChange:function(e){return k("thumbnail_crop",e.target.checked?1:0)},label:(0,pe.__)("Thumbnail crop","nggallery")})):null,ee().createElement(fs,{id:"enable_breadcrumbs_list",name:"enable_breadcrumbs",checked:!1!==e.enable_breadcrumbs,onChange:function(e){return k("enable_breadcrumbs",e.target.checked)},label:(0,pe.__)("Enable breadcrumbs","nggallery")}),ee().createElement(fs,{id:"enable-descriptions-list",name:"enable_descriptions",checked:!!e.enable_descriptions,onChange:function(e){return k("enable_descriptions",e.target.checked)},label:(0,pe.__)("Enable descriptions","nggallery")}),"pro"===y?ee().createElement(fs,{id:"enable-ecommerce-list",name:"is_ecommerce_enabled",checked:!!e.is_ecommerce_enabled,onChange:function(e){return k("is_ecommerce_enabled",e.target.checked?1:0)},label:(0,pe.__)("Enable eCommerce","nggallery")}):ee().createElement("div",{className:"relative"},ee().createElement("div",{className:"opacity-50 pointer-events-none"},ee().createElement(fs,{id:"enable-ecommerce-list",name:"is_ecommerce_enabled",checked:!1,onChange:function(){},label:(0,pe.__)("Enable eCommerce","nggallery")})),ee().createElement("div",{className:"absolute inset-0 cursor-pointer",onClick:function(){return d.setActiveModal("upgrade",{feature:"eCommerce features"})},title:(0,pe.__)("Requires NextGEN Gallery Pro","nggallery")})),ee().createElement(_f,{formState:{animate_images_enable:!!e.animate_images_enable,animate_images_style:null!==(p=e.animate_images_style)&&void 0!==p?p:"wobble",animate_images_duration:String(null!==(f=e.animate_images_duration)&&void 0!==f?f:1500),animate_images_delay:String(null!==(h=e.animate_images_delay)&&void 0!==h?h:250),animate_pagination_enable:!!e.animate_pagination_enable,animate_pagination_style:null!==(b=e.animate_pagination_style)&&void 0!==b?b:"flipInX",animate_pagination_duration:String(null!==(v=e.animate_pagination_duration)&&void 0!==v?v:1500),animate_pagination_delay:String(null!==(w=e.animate_pagination_delay)&&void 0!==w?w:250)},handleInputChange:function(e){var t,n=(e.target||{}).name,r=e.target&&"checked"in e.target?e.target.checked:null===(t=e.target)||void 0===t?void 0:t.value;/duration|delay/.test(n)&&(r=parseInt(r)),k(n,r)}}))}(p);case"imagely-pro-search":return function(e){var t,n,r;return ee().createElement("div",{className:"space-y-4"},ee().createElement(sc,{id:"search-gallery-display-type",name:"gallery_display_type",value:e.gallery_display_type||(null===(t=w[0])||void 0===t?void 0:t.value)||"",onChange:function(e){return k("gallery_display_type",e.target.value)},label:(0,pe.__)("Display results as","nggallery")},w.map(function(e){return ee().createElement("option",{key:e.value,value:e.value},e.label)})),ee().createElement(sc,{id:"search-mode",name:"search_mode",value:e.search_mode||"natural",onChange:function(e){return k("search_mode",e.target.value)},label:(0,pe.__)("Database search mode","nggallery")},ee().createElement("option",{value:"natural"},(0,pe.__)("Natural language","nggallery")),ee().createElement("option",{value:"boolean"},(0,pe.__)("Boolean","nggallery"))),ee().createElement("div",{className:"grid grid-cols-2 gap-4"},ee().createElement(uc,{type:"number",name:"limit",value:String(null!==(n=e.limit)&&void 0!==n?n:0),onChange:function(e){return k("limit",parseInt(e.target.value))},label:(0,pe.__)("Limit search results","nggallery"),help:(0,pe.__)("Limit search results to this amount. A setting of zero means no limitations are applied","nextgen-gallery-pro"),min:0}),ee().createElement(sc,{id:"order-by",name:"order_by",value:e.order_by||"pid",onChange:function(e){return k("order_by",e.target.value)},label:(0,pe.__)("Order search results by","nggallery")},ee().createElement("option",{value:"pid"},(0,pe.__)("Image ID","nggallery")),ee().createElement("option",{value:"galleryid"},(0,pe.__)("Gallery ID","nggallery")),ee().createElement("option",{value:"filename"},(0,pe.__)("Image filename","nggallery")),ee().createElement("option",{value:"imagedate"},(0,pe.__)("Image date (EXIF or time of upload)","nggallery")))),ee().createElement("div",{className:"grid grid-cols-2 gap-4"},ee().createElement(sc,{id:"order-direction",name:"order_direction",value:e.order_direction||"ASC",onChange:function(e){return k("order_direction",e.target.value)},label:(0,pe.__)("Order direction of search results","nggallery")},ee().createElement("option",{value:"ASC"},(0,pe.__)("Ascending","nggallery")),ee().createElement("option",{value:"DESC"},(0,pe.__)("Descending","nggallery"))),ee().createElement(fs,{id:"order-by-relevance",name:"order_by_relevance",checked:!1!==e.order_by_relevance,onChange:function(e){return k("order_by_relevance",e.target.checked)},label:(0,pe.__)("Order by relevance first","nggallery"),help:(0,pe.__)("When enabled search results will be ordered by their relevance first, then by the secondary order setting","nextgen-gallery-pro")})),ee().createElement(uc,{type:"number",name:"minimum_relevance",value:String(null!==(r=e.minimum_relevance)&&void 0!==r?r:1),onChange:function(e){return k("minimum_relevance",parseFloat(e.target.value))},label:(0,pe.__)("Minimum relevance","nggallery"),help:(0,pe.__)("The database server assigns a relevance score to each possible image based on a number of factors with zero being not at all relevant. Users with smaller databases or images whose alttext or description only holds a few words will need a lower number here; possibly as low as 0.05. It is unlikely many users will need to raise this beyond one.","nextgen-gallery-pro"),min:0,max:10}),ee().createElement(fs,{id:"search-alttext",name:"search_alttext",checked:!1!==e.search_alttext,onChange:function(e){return k("search_alttext",e.target.checked)},label:(0,pe.__)("Search image alttext","nggallery")}),ee().createElement(fs,{id:"search-description",name:"search_description",checked:!1!==e.search_description,onChange:function(e){return k("search_description",e.target.checked)},label:(0,pe.__)("Search image description","nggallery")}),ee().createElement(fs,{id:"search-tags",name:"search_tags",checked:!1!==e.search_tags,onChange:function(e){return k("search_tags",e.target.checked)},label:(0,pe.__)("Search image tags","nggallery")}),ee().createElement(fs,{id:"enable-tag-filter",name:"enable_tag_filter",checked:!1!==e.enable_tag_filter,onChange:function(e){return k("enable_tag_filter",e.target.checked)},label:(0,pe.__)("Enable filtering results by tag","nggallery")}))}(p)}}())))),ee().createElement("div",{className:"px-4 py-4 lg:sticky lg:top-6 lg:max-h-screen"},S?ee().createElement(yf,null):ee().createElement(gf,{previewMode:a,onPreviewModeChange:o,url:N,title:(0,pe.__)("Album Preview","nggallery")})))},Ch=function(e){var t=e.currentTab,n=e.albumId,r=e.album,a=e.previewMode,o=e.onPreviewModeChange;switch(t){case"galleries":default:return ee().createElement(dh,{albumId:n,album:r});case"customize":case"settings":return ee().createElement(Eh,{albumId:n,album:r,previewMode:a,onPreviewModeChange:o})}};var Nh=["galleries","settings"],kh=function(e){var t=e.currentTab,n=e.setCurrentTab,r=e.albumId,a=e.album,o=e.previewMode,l=e.handlePreviewModeChange,i=e.handleNext,c=e.handleCancel,s=e.nextButtonText,u=e.navigateTo,m=e.isFirstTab,d=e.isEmbed;return ee().createElement("div",{className:"px-4 md:px-6 lg:px-8 py-4 md:py-6 pb-24"},!d&&ee().createElement("div",{className:"mb-6 flex items-center gap-3"},ee().createElement("button",{onClick:function(){return u("imagely-albums","general")},className:"flex items-center justify-center w-8 h-8 rounded-md hover:bg-gray-100 transition-colors"},ee().createElement(dr,{className:"w-5 h-5"})),ee().createElement("h1",{className:"text-2xl font-semibold text-gray-900"},(0,pe.__)("Edit Album","nggallery"))),ee().createElement("div",{className:"bg-white shadow rounded-md pt-4 md:pt-6 lg:pt-8"},ee().createElement(Xp,{currentTab:t,onTabChange:n,containerClassName:"",contentClassName:"",headerComponent:function(){return ee().createElement(Ay,{activeTab:t,onTabChange:n})}},ee().createElement(Ch,{currentTab:t,albumId:r,album:a,previewMode:o,onPreviewModeChange:l}))),ee().createElement(Ty,{onNext:i,onCancel:c,nextButtonText:s,isFirstTab:m}))};const Sh=function(e){var t=e.albumId,n=vo((0,$.useState)("desktop"),2),r=n[0],a=n[1],o=(0,ge.useDispatch)(Br),l=Kl();(0,$.useEffect)(function(){t&&o&&o.setCurrentId(t)},[t,o]);var i=Ql(t),c=i.data,s=i.isLoading,u=i.error,m=function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).onComplete,t=(0,ge.useDispatch)(Br),n=(0,ge.useSelect)(function(e){return{currentTab:e(Br).getCurrentTab()}},[]).currentTab,r=Nh,a=r.indexOf(n),o=0===a,l=a===r.length-1,i=(0,$.useCallback)(function(e){r.includes(e)&&t.setCurrentTab(e)},[t.setCurrentTab,r]),c=(0,$.useCallback)(function(e,n,r){t.navigateTo(e,n,r)},[t.navigateTo]),s=(0,$.useCallback)(function(){l?e&&e():i(r[a+1])},[l,a,r,i,e]),u=(0,$.useCallback)(function(){o||i(r[a-1])},[o,a,r,i]),m=(0,$.useCallback)(function(e){i(e)},[i]),d=(0,$.useMemo)(function(){return r.includes(n)?n:"galleries"},[n,r]),g=ee().useRef(n);return ee().useEffect(function(){g.current===d||r.includes(n)||i(d),g.current=n},[d,n,i,r]),{currentTab:d,setCurrentTab:i,goToNextTab:s,goToPreviousTab:u,goToTab:m,isFirstTab:o,isLastTab:l,tabIds:r,currentTabIndex:a,navigateTo:c}}({onComplete:function(){o&&o.showNotice("success",(0,pe.__)("Album updated successfully","nggallery"))},enableTabValidation:!1}),d=m.currentTab,g=m.setCurrentTab,p=m.goToNextTab,f=m.goToPreviousTab,y=m.isFirstTab,h=m.isLastTab,b=m.navigateTo;return s?ee().createElement(oo,{size:"xl",text:(0,pe.__)("Loading album...","nggallery")}):u||!c?ee().createElement("div",{className:"p-6 min-h-screen"},ee().createElement("div",{className:"bg-red-50 border border-red-200 rounded-md p-4"},ee().createElement("div",{className:"flex"},ee().createElement("div",{className:"flex-shrink-0"},ee().createElement(yn,{className:"h-5 w-5 text-red-400"})),ee().createElement("div",{className:"ml-3"},ee().createElement("h3",{className:"text-sm font-medium text-red-800"},(0,pe.__)("Error loading album","nggallery")),ee().createElement("div",{className:"mt-2 text-sm text-red-700"},u instanceof Error?u.message:(0,pe.__)("Album not found","nggallery")))))):ee().createElement(oh,{initialAlbum:c},ee().createElement(kh,{currentTab:d,setCurrentTab:g,albumId:t,album:c,previewMode:r,handlePreviewModeChange:function(e){a(e)},handleNext:function(){if(h){if(l.isEmbed&&l.onInsertAlbum){try{l.onInsertAlbum(t)}catch(e){console.error("Failed to insert album:",e)}return}var e=(null==c?void 0:c.name)||"";o.setActiveModal("albumSuccess",{albumId:t,albumName:e})}else p()},handleCancel:function(){if(y)if(l.isEmbed&&l.onClose)try{l.onClose()}catch(e){console.error("Failed to close embed:",e)}else o.navigateTo("imagely-albums","general");else f()},nextButtonText:h?(0,pe.__)("Update","nggallery"):(0,pe.__)("Next step","nggallery"),navigateTo:b,isFirstTab:y,isEmbed:l.isEmbed}))},Oh=function(){var e=(0,ge.useDispatch)(Br),t=window.imagelyApp.assetsURL+"/images/HeaderImage.png",n=window.imagelyApp.assetsURL+"/images/HeaderArrow.png";return React.createElement("div",{className:"mb-8 bg-white rounded-lg shadow-sm p-4 sm:p-6 lg:p-8 flex flex-col lg:flex-row lg:justify-between lg:items-center relative overflow-hidden"},React.createElement("div",{className:"w-full lg:max-w-[50%] relative z-10 mb-6 lg:mb-0"},React.createElement("h1",{className:"text-2xl sm:text-3xl font-semibold mb-2 text-gray-900"},(0,pe.__)("Welcome to Imagely","nggallery")),React.createElement("p",{className:"text-sm sm:text-base text-gray-600 mb-4 sm:mb-6"},(0,pe.__)("Let's get started by adding galleries to create your album","nggallery")),React.createElement("div",{className:"flex flex-col sm:flex-row sm:items-center gap-4"},React.createElement("button",{className:"bg-green-500 text-white hover:bg-green-600 px-4 sm:px-6 py-2.5 h-auto rounded-md text-sm font-medium w-full sm:w-auto transition-colors",onClick:function(){$p()?e.setActiveModal("album"):e.setActiveModal("licenseRequired",{action:"create new albums"})}},(0,pe.__)("Add a New Album","nggallery")),React.createElement("div",{className:"hidden sm:block w-12 h-12 relative -top-5"},React.createElement("img",{src:n,alt:"Decorative arrow",className:"w-full h-full object-contain"})))),React.createElement("div",{className:"w-full lg:absolute lg:inset-y-0 lg:right-0 lg:w-1/2 lg:h-full flex items-center justify-center"},React.createElement("img",{src:t,alt:"Album illustration",className:"w-full h-48 sm:h-64 lg:h-full object-contain lg:relative lg:left-20"})))},Ph=function(e){var t=e.isLoading,n=e.items,r=e.visibleColumns,a=e.selectedItems,o=e.onSelectAll,l=e.onSelectItem,i=e.columns,c=e.onSort,s=e.sortColumn,u=e.sortDirection,m=e.loadingContent,d=e.notFoundContent,g=e.dropdownContent,p=e.actionsHeaderLabel,f=e.actionCellRenderer,y=e.showSelection,h=!1!==(void 0===y||y),b=h&&n.length>0&&n.every(function(e){return a.has(e.id)}),v=vo((0,$.useState)(null),2),_=v[0],w=v[1],x=vo((0,$.useState)({column:s||null,direction:u||null}),2),E=x[0],C=x[1],N=ee().createElement(oo,{size:"md",text:(0,pe.__)("Loading items...","nggallery")}),k=ee().createElement("div",{className:"p-4 text-center text-gray-500 text-sm"},(0,pe.__)("No items found.","nggallery")),S=i.filter(function(e){return r[e.key]}).length+(f||g?1:0)+(h?1:0);return ee().createElement("div",{className:"bg-white rounded-b-lg shadow-sm"},ee().createElement("div",{className:"overflow-x-auto"},ee().createElement("table",{className:"w-full border-collapse min-w-[800px]"},ee().createElement("thead",null,ee().createElement("tr",{className:"border-b bg-gray-100"},h&&ee().createElement("th",{className:"w-12 px-4 py-3 text-left"},ee().createElement("input",{type:"checkbox",id:"select-all",name:"select-all",className:"rounded border-gray-300",checked:b,onChange:function(e){return o(e.target.checked)}})),i.map(function(e){var t,n,a=e.key,o=e.label,l=e.className;return r[a]&&ee().createElement("th",{key:a,className:ao("px-4 py-3 text-left font-medium text-gray-600 text-sm cursor-pointer whitespace-nowrap",l),onClick:function(){return function(e){var t=i.find(function(t){return t.key===e});if(null!=t&&t.sortType){var n=null;return"backend"===t.sortType&&c?(n=E.column===e?"asc"===E.direction?"desc":"desc"===E.direction?null:"asc":"asc",C({column:n?e:null,direction:n}),c(e,n)):"frontend"===t.sortType&&(n=E.column===e?"asc"===E.direction?"desc":"desc"===E.direction?null:"asc":"asc",C({column:n?e:null,direction:n})),n}}(a)}},ee().createElement("div",{className:"flex items-center"},(0,pe.__)(o),(t=a,null!==(n=i.find(function(e){return e.key===t}))&&void 0!==n&&n.sortType?E.column!==t?ee().createElement(hn,{className:"w-4 h-4 ml-1 text-gray-400"}):"asc"===E.direction?ee().createElement(bn,{className:"w-4 h-4 ml-1 text-gray-900"}):ee().createElement(vn,{className:"w-4 h-4 ml-1 text-gray-900"}):null)))}),(f||g)&&ee().createElement("th",{className:"w-20 px-4 py-3 text-left font-medium text-gray-600 text-sm whitespace-nowrap"},p?(0,pe.__)(p):(0,pe.__)("Actions","nggallery")))),ee().createElement("tbody",null,t?ee().createElement("tr",null,ee().createElement("td",{colSpan:S},m||N)):0===n.length?ee().createElement("tr",null,ee().createElement("td",{colSpan:S},d||k)):function(){if(!E.column||!E.direction||!Array.isArray(n))return n||[];var e=i.find(function(e){return e.key===E.column});return null!=e&&e.sortType&&"frontend"===e.sortType?ko(n).sort(function(e,t){var n=String(e[E.column]||"").toLowerCase(),r=String(t[E.column]||"").toLowerCase();return"asc"===E.direction?n.localeCompare(r):r.localeCompare(n)}):n||[]}().map(function(e){var t=!1!==e.canManage;return ee().createElement("tr",{key:e.id,className:ao("border-b cursor-pointer",t?"hover:bg-gray-50":"opacity-50 hover:bg-gray-50/50")},h&&ee().createElement("td",{className:"w-12 px-4 py-3"},ee().createElement("input",{type:"checkbox",id:"item-".concat(e.id),name:"item-".concat(e.id),className:"rounded border-gray-300",checked:a.has(e.id),onChange:function(){return l(e.id)},disabled:!t})),i.map(function(t){var n=t.key,a=t.render,o=t.className;return r[n]&&ee().createElement("td",{key:n,className:ao("px-4 py-3 whitespace-nowrap",o)},a?a(e):ee().createElement("div",{className:"flex items-center gap-3"},ee().createElement("span",{className:"font-medium text-gray-900 text-sm"},String(e[n]))))}),(f||g)&&ee().createElement("td",{className:"w-20 px-4 py-3"},f?f(e):ee().createElement(kg,{isOpen:_===e.id,onClose:function(){return w(null)},onToggle:function(){return w(_===e.id?null:e.id)},trigger:ee().createElement("button",{id:"quick-edit-".concat(e.id),className:"p-2 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-full",disabled:!t},ee().createElement(un,{className:"w-5 h-5"}))},g?g(e):ee().createElement("div",{className:"py-1"},ee().createElement("button",{className:"block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100"},(0,pe.__)("Quick Edit","nggallery")),ee().createElement("button",{className:"block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100"},(0,pe.__)("Duplicate","nggallery")),ee().createElement("button",{className:"block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100"},(0,pe.__)("Add to Album","nggallery")),ee().createElement("button",{className:"block w-full text-left px-4 py-2 text-sm text-red-600 hover:bg-gray-100"},(0,pe.__)("Delete Item","nggallery"))))))})))))};function jh(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Th(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?jh(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):jh(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Ih(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return Ah(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Ah(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Ah(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,Ah(m,"constructor",s),Ah(s,"constructor",c),c.displayName="GeneratorFunction",Ah(s,a,"GeneratorFunction"),Ah(m),Ah(m,a,"Generator"),Ah(m,r,function(){return this}),Ah(m,"toString",function(){return"[object Generator]"}),(Ih=function(){return{w:o,m:d}})()}function Ah(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}Ah=function(e,t,n,r){function o(t,n){Ah(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Ah(e,t,n,r)}const Dh=function(e){var t=e.isLoading,n=e.albums,r=e.visibleColumns,a=e.selectedAlbums,o=e.onSelectAll,l=e.onSelectAlbum,i=e.onSort,c=e.sortColumn,s=e.sortDirection,u=e.onDelete,m=e.onEdit,d=e.hasActiveSearch,g=void 0!==d&&d,p=(0,ge.useDispatch)(Br),f=function(){var e=No(Ih().m(function e(t){var n;return Ih().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,navigator.clipboard.writeText(t);case 1:p.showNotice("success",(0,pe.__)("Shortcode copied to clipboard!","nggallery")),e.n=3;break;case 2:e.p=2,e.v,(n=document.createElement("textarea")).value=t,document.body.appendChild(n),n.select();try{document.execCommand("copy"),p.showNotice("success",(0,pe.__)("Shortcode copied to clipboard!","nggallery"))}catch(e){p.showNotice("error",(0,pe.__)("Failed to copy shortcode to clipboard","nggallery"))}document.body.removeChild(n);case 3:return e.a(2)}},e,null,[[0,2]])}));return function(t){return e.apply(this,arguments)}}(),y=g?ee().createElement("div",{className:"py-16"},ee().createElement("div",{className:"flex flex-col items-center justify-center text-center text-gray-500"},ee().createElement("p",{className:"text-sm mb-2"},(0,pe.__)("No results found for your search.","nggallery")))):ee().createElement("div",{className:"py-16"},ee().createElement("div",{className:"flex flex-col items-center justify-center text-center text-gray-500"},ee().createElement("div",{className:"mb-4"},ee().createElement(_r,{className:"w-16 h-16 opacity-60"})),ee().createElement("p",{className:"text-sm mb-2"},(0,pe.__)("No Albums so far!","nggallery")),ee().createElement("button",{type:"button",className:"inline-flex items-center gap-1 text-green-500 hover:text-green-600 text-sm font-medium",onClick:function(){$p()?p.setActiveModal("album"):p.setActiveModal("licenseRequired",{action:"create new albums"})}},(0,pe.__)("Add New Album","nggallery"),ee().createElement(ln,{className:"w-4 h-4"}))));return ee().createElement(Ph,{isLoading:t,items:n,visibleColumns:r,selectedItems:a,onSelectAll:o,onSelectItem:l,columns:Py().map(function(e){return Th(Th({},e),{},{render:function(t){return function(e,t){switch(t){case"id":return ee().createElement("span",{className:"text-gray-600 text-sm"},e.id);case"albumTitle":return ee().createElement("button",{onClick:function(){return function(e){m(e)}(e)},className:"font-medium text-gray-900 text-sm hover:underline"},e.albumTitle);case"thumbnail":return e.thumbnail?ee().createElement("img",{src:e.thumbnail,alt:e.albumTitle,className:"w-12 h-12 object-cover rounded-md border border-gray-200"}):ee().createElement("div",{className:"w-12 h-12 bg-gray-200 rounded-md border border-gray-200 flex items-center justify-center"},ee().createElement("svg",{className:"w-6 h-6 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},ee().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})));case"shortcode":return ee().createElement("button",{onClick:function(){return f(e.shortcode)},className:"bg-gray-100 px-3 py-1 rounded text-sm font-mono text-gray-600 hover:bg-gray-200 transition-colors cursor-pointer border-none",title:(0,pe.__)("Click to copy shortcode","nggallery")},e.shortcode);case"count":return ee().createElement("span",{className:"text-gray-600 text-sm"},e.count);case"created":return ee().createElement("span",{className:"text-gray-600 text-sm"},e.created);case"modified":return ee().createElement("span",{className:"text-gray-600 text-sm"},e.modified);case"displayType":return ee().createElement("span",{className:"text-gray-600 text-sm"},e.displayType.replace("photocrati-nextgen_","").replace("_"," "));default:return null}}(t,e.key)}})}),onSort:i,sortColumn:c,sortDirection:s,notFoundContent:y,actionsHeaderLabel:(0,pe.__)("Actions","nggallery"),actionCellRenderer:function(e){return ee().createElement("div",{className:"flex flex-col items-center text-gray-500"},ee().createElement("button",{type:"button",className:"flex flex-col items-center text-red-600 hover:text-red-700",onClick:function(){return function(e){u([e])}(e)}},ee().createElement(fr,{className:"w-4 h-4 mb-1"}),ee().createElement("span",{className:"text-xs"},(0,pe.__)("Delete","nggallery"))))}})};var Lh=function(){var e=vo((0,$.useState)(""),2),t=e[0],n=e[1],r=Cy(t,300),a=vo(Oy("albums",jy),2),o=a[0],l=a[1],i=vo((0,$.useState)(new Set),2),c=i[0],s=i[1],u=vo((0,$.useState)("modified"),2),m=u[0],d=u[1],g=vo((0,$.useState)("desc"),2),p=g[0],f=g[1],y=vo((0,$.useState)(1),2),h=y[0],b=y[1],v=gi().data,_=(null==v?void 0:v.admin_table_per_page)||20,w=ee().useMemo(function(){return{page:h,per_page:_,search:r||void 0,sort:m||void 0,order:p||void 0}},[h,_,r,m,p]),x=Wl(w),E=x.data,C=x.isLoading,N=x.error,k=ee().useMemo(function(){return(null==E?void 0:E.albums)||[]},[null==E?void 0:E.albums]),S=ee().useMemo(function(){return(null==E?void 0:E.pagination)||{total:0,total_pages:1,per_page:_,current_page:1}},[null==E?void 0:E.pagination,_]),O=(0,ge.useDispatch)(Br);(0,$.useEffect)(function(){b(1)},[r]),(0,$.useEffect)(function(){s(new Set)},[h,_,r,m,p]),(0,$.useEffect)(function(){S.total_pages>0&&h>S.total_pages&&b(S.total_pages)},[S.total_pages,h]);var P=ee().useCallback(function(e){b(e),window.scrollTo({top:0,behavior:"smooth"})},[]),j=function(e){O.setActiveModal("deleteAlbums",{albums:e,onClose:function(){return O.setActiveModal(null)},onConfirm:function(){s(new Set)}})};return N?ee().createElement("div",{className:"p-6 min-h-screen"},ee().createElement(Oh,null),ee().createElement("div",{className:"bg-red-50 border border-red-200 rounded-md p-4"},ee().createElement("div",{className:"flex"},ee().createElement("div",{className:"flex-shrink-0"},ee().createElement(yn,{className:"h-5 w-5 text-red-400"})),ee().createElement("div",{className:"ml-3"},ee().createElement("h3",{className:"text-sm font-medium text-red-800"},(0,pe.__)("Error loading albums","nggallery")),ee().createElement("div",{className:"mt-2 text-sm text-red-700"},N instanceof Error?N.message:(0,pe.__)("An unexpected error occurred","nggallery")))))):ee().createElement("div",{className:"p-6 min-h-screen"},ee().createElement(Oh,null),ee().createElement(Ey,{title:(0,pe.__)("Manage Albums","nggallery"),searchTerm:t,setSearchTerm:n,onSearch:function(){},visibleColumns:o,setVisibleColumns:l,selectedItems:c,items:k,columns:ko(Py()),itemType:"album",searchPlaceholder:(0,pe.__)("Search Albums","nggallery"),onDelete:j}),ee().createElement(Dh,{isLoading:C,albums:k,visibleColumns:o,selectedAlbums:c,onSelectAll:function(e){s(e?new Set(k.map(function(e){return e.id})):new Set)},onSelectAlbum:function(e){var t=new Set(c);t.has(e)?t.delete(e):t.add(e),s(t)},onSort:function(e,t){d(t?{albumTitle:"name",created:"created",modified:"modified",id:"id",displayType:"display_type"}[e]||e:null),f(t),b(1)},sortColumn:m,sortDirection:p,onDelete:j,onEdit:function(e){O.setCurrentId(e.id),O.navigateTo("imagely-albums","galleries",e.id)},hasActiveSearch:!!r}),!C&&(S.total>0||r)&&ee().createElement(Xf,{currentPage:h,totalPages:S.total_pages,perPage:S.per_page,total:S.total,onPageChange:P,itemLabel:r?(0,pe.__)("Results","nggallery"):(0,pe.__)("Items","nggallery"),showItemCount:!0}))};const Fh=function(){var e=Kl(),t=(null==e?void 0:e.isEmbed)||!1,n=(0,ge.useSelect)(function(e){return{currentId:e(Br).getCurrentId()}},[]).currentId;return n?ee().createElement(Sh,{albumId:n}):t?null:ee().createElement(Lh,null)};function Mh(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return Rh(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Rh(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Rh(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,Rh(m,"constructor",s),Rh(s,"constructor",c),c.displayName="GeneratorFunction",Rh(s,a,"GeneratorFunction"),Rh(m),Rh(m,a,"Generator"),Rh(m,r,function(){return this}),Rh(m,"toString",function(){return"[object Generator]"}),(Mh=function(){return{w:o,m:d}})()}function Rh(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}Rh=function(e,t,n,r){function o(t,n){Rh(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Rh(e,t,n,r)}function Gh(){var e,t=gi().data,n=sl({queryKey:["printlabRequirements"],queryFn:(e=No(Mh().m(function e(){var t,n;return Mh().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,Oo()({path:"/nggpro/v1/commerce/admin/check_commerce_requirements",method:"GET",headers:{"X-WP-Nonce":null===(t=window.imagelyApp)||void 0===t?void 0:t.nonce}});case 1:return n=e.v,e.a(2,n)}},e)})),function(){return e.apply(this,arguments)}),staleTime:3e5,gcTime:6e5}),r=n.data;return{subTabStatus:(0,$.useMemo)(function(){var e,n=t||{},a=["ecommerce_studio_name","ecommerce_studio_email","ecommerce_studio_street_address","ecommerce_studio_city","ecommerce_home_country","ecommerce_home_state","ecommerce_home_zip","ecommerce_currency"].every(function(e){var t=n[e];return!(null==t||""===String(t).trim())}),o=["ecommerce_email_notification_recipient","ecommerce_email_notification_subject","ecommerce_email_notification_body","ecommerce_email_receipt_subject","ecommerce_email_receipt_body"].every(function(e){var t=n[e];return!(null==t||""===String(t).trim())}),l={cheque:"1"===n.ecommerce_cheque_enable||1===n.ecommerce_cheque_enable||!0===n.ecommerce_cheque_enable,paypal:"1"===n.ecommerce_paypal_enable||1===n.ecommerce_paypal_enable||!0===n.ecommerce_paypal_enable,paypalStd:"1"===n.ecommerce_paypal_std_enable||1===n.ecommerce_paypal_std_enable||!0===n.ecommerce_paypal_std_enable,test:"1"===n.ecommerce_test_gateway_enable||1===n.ecommerce_test_gateway_enable||!0===n.ecommerce_test_gateway_enable,stripe:"1"===n.ecommerce_stripe_enable||1===n.ecommerce_stripe_enable||!0===n.ecommerce_stripe_enable,paypalCheckout:"1"===n.ecommerce_paypal_checkout_enable||1===n.ecommerce_paypal_checkout_enable||!0===n.ecommerce_paypal_checkout_enable,braintree:"1"===n.ecommerce_braintree_enable||1===n.ecommerce_braintree_enable||!0===n.ecommerce_braintree_enable},i=Object.values(l).some(Boolean),c=l.cheque&&!(n.ecommerce_cheque_instructions&&String(n.ecommerce_cheque_instructions).trim())||l.paypal&&(!n.ecommerce_paypal_email||!n.ecommerce_paypal_username||!n.ecommerce_paypal_password||!n.ecommerce_paypal_signature)||l.paypalStd&&!n.ecommerce_paypal_std_email||l.stripe&&(!n.ecommerce_stripe_key_public||!n.ecommerce_stripe_key_private)||l.paypalCheckout&&(!n.ecommerce_paypal_checkout_client_id||!n.ecommerce_paypal_checkout_client_secret)||l.braintree&&(!n.ecommerce_braintree_merchant_id||!n.ecommerce_braintree_public_key||!n.ecommerce_braintree_private_key),s=i&&!c,u=["ecommerce_page_checkout","ecommerce_page_thanks","ecommerce_page_cancel","ecommerce_page_digital_downloads","ecommerce_cart_menu_item","ecommerce_default_pricelist"].every(function(e){var t=n[e];return!(null==t||""===String(t).trim())}),m="warning";return Boolean(null==r||null===(e=r.status)||void 0===e?void 0:e.card_on_file)&&(m="complete"),{"studio-details":a?"complete":"incomplete","email-setup":o?"complete":"incomplete","payment-setup":s?"complete":"incomplete","page-setup":u?"complete":"incomplete","printlab-integration":m}},[t,r]),requirements:(null==r?void 0:r.status)||null}}var Bh=function(){return[{id:"general",label:(0,pe.__)("General Info","nggallery"),icon:ee().createElement(Bn,{className:"h-5 w-5"}),subTabs:[{id:"studio-details",label:(0,pe.__)("Studio Details","nggallery")},{id:"email-setup",label:(0,pe.__)("Email Setup","nggallery")},{id:"payment-setup",label:(0,pe.__)("Payment Setup","nggallery")},{id:"page-setup",label:(0,pe.__)("Page Setup","nggallery")},{id:"printlab-integration",label:(0,pe.__)("PrintLab Integration","nggallery")}]},{id:"orders",label:(0,pe.__)("Orders","nggallery"),icon:ee().createElement(zn,{className:"h-5 w-5"})},{id:"proofing",label:(0,pe.__)("Proofing","nggallery"),icon:ee().createElement(Un,{className:"h-5 w-5"})},{id:"pricelists",label:(0,pe.__)("Pricelists","nggallery"),icon:ee().createElement(qn,{className:"h-5 w-5"})},{id:"coupons",label:(0,pe.__)("Coupons","nggallery"),icon:ee().createElement(Qn,{className:"h-5 w-5"})},{id:"other-options",label:(0,pe.__)("Other Options","nggallery"),icon:ee().createElement(Wn,{className:"h-5 w-5"})}]};const zh=function(e){var t=e.activeTab,n=e.activeSubTab,r=e.onSubTabChange,a=Bh().find(function(e){return e.id===t}),o=Gh().subTabStatus;return null!=a&&a.subTabs&&0!==a.subTabs.length?ee().createElement("div",{className:"mb-6"},ee().createElement("h1",{className:"text-2xl font-semibold text-gray-900 mb-6"},(0,pe.__)("E-commerce Store Setup","nggallery")),ee().createElement("nav",{className:"flex flex-col sm:flex-row space-y-2 sm:space-y-0 sm:space-x-8 border-b border-gray-200 overflow-x-auto"},a.subTabs.map(function(e){var t=n===e.id,a=o[e.id],l="complete"===a?"bg-green-500":"warning"===a?"bg-yellow-400":"bg-red-500";return ee().createElement("button",{key:e.id,onClick:function(){return r(e.id)},className:"flex items-center space-x-2 pb-4 border-b-2 transition-colors p-4 whitespace-nowrap ".concat(t?"border-green-500 text-green-600 bg-gray-100":"border-transparent text-gray-500 hover:text-gray-700 hover:bg-gray-100")},ee().createElement("span",{className:"text-sm font-medium ".concat(t?"text-green-600":"text-gray-600")},e.label),ee().createElement("div",{className:"w-4 h-4 rounded-full flex items-center justify-center ".concat(l)},ee().createElement(an,{className:"w-2.5 h-2.5 text-white"})))}))):null};function Uh(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return qh(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(qh(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,qh(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,qh(m,"constructor",s),qh(s,"constructor",c),c.displayName="GeneratorFunction",qh(s,a,"GeneratorFunction"),qh(m),qh(m,a,"Generator"),qh(m,r,function(){return this}),qh(m,"toString",function(){return"[object Generator]"}),(Uh=function(){return{w:o,m:d}})()}function qh(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}qh=function(e,t,n,r){function o(t,n){qh(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},qh(e,t,n,r)}const Qh=function(){var e,t,n,r=(0,ge.useDispatch)(Br),a=vo((0,$.useState)("all"),2),o=a[0],l=a[1],i=vo((0,$.useState)({customer:!0,timesUsed:!0,date:!0,status:!0}),1)[0],c=vo((0,$.useState)(new Set),2),s=c[0],u=c[1],m=vo((0,$.useState)(""),2),d=m[0],g=m[1],p=Cy(d,300),f=vo((0,$.useState)("date"),2),y=f[0],h=f[1],b=vo((0,$.useState)("desc"),2),v=b[0],_=b[1],w=vo((0,$.useState)(1),2),x=w[0],E=w[1],C=gi().data,N=(null==C?void 0:C.admin_table_per_page)||20,k=vo((0,$.useState)(!1),2),S=k[0],O=k[1],P=vo((0,$.useState)("select"),2),j=P[0],T=P[1],I=(e={page:x,per_page:N,search:p,sort:v&&y?{customer:"coupon_code",timesUsed:"times_used",date:"date",status:"status"}[y]||"date":void 0,order:v||void 0,status:o,period:j},n=new URLSearchParams,null!=e&&e.page&&n.append("page",String(e.page)),null!=e&&e.per_page&&n.append("per_page",String(e.per_page)),null!=e&&e.search&&n.append("search",e.search),null!=e&&e.sort&&n.append("sort",e.sort),null!=e&&e.order&&n.append("order",e.order),null!=e&&e.status&&n.append("status",e.status),null!=e&&e.period&&n.append("period",e.period),sl({queryKey:Qi(e||{}),queryFn:(t=No(Bi().m(function e(){var t,r,a,o,l,i,c;return Bi().w(function(e){for(;;)switch(e.n){case 0:return r=null===(t=window.imagelyApp)||void 0===t?void 0:t.nonce,a="/imagely/v1/coupons".concat(n.toString()?"?".concat(n.toString()):""),e.n=1,Oo()({path:a,method:"GET",headers:{"X-WP-Nonce":r}});case 1:if(o=e.v,!Array.isArray(o)){e.n=2;break}return l=o.map(Ui),e.a(2,{coupons:l,pagination:{total:l.length,total_pages:1,per_page:l.length,current_page:1}});case 2:return i=((null==o?void 0:o.coupons)||[]).map(function(e){return e&&(e.coupon_code||e.coupon_for)?qi(e):Ui(e)}),c=(null==o?void 0:o.pagination)||{total:i.length,total_pages:1,per_page:i.length,current_page:1},e.a(2,{coupons:i,pagination:c})}},e)})),function(){return t.apply(this,arguments)}),staleTime:3e4,gcTime:6e5,retry:0,throwOnError:!1,refetchOnWindowFocus:!0,refetchOnMount:!1,placeholderData:function(e){return e}})),A=I.data,D=I.isLoading;(0,$.useEffect)(function(){E(1)},[p]),(0,$.useEffect)(function(){u(new Set),z("bulk"),R(!1)},[p,o,j,y,v]);var L=function(e){var t=new Date,n=e.start_date?new Date(e.start_date):null,r=e.end_date?new Date(e.end_date):null;return r&&r<t?"Completed":n&&n>t?"Upcoming":"Ongoing"},F=vo((0,$.useState)(!1),2),M=F[0],R=F[1],G=vo((0,$.useState)("bulk"),2),B=G[0],z=G[1],U=function(e){if(!e)return"";var t=new Date(e),n=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),a=String(t.getDate()).padStart(2,"0"),o=t.getHours(),l=String(t.getMinutes()).padStart(2,"0"),i=o>=12?"pm":"am";return 0==(o%=12)&&(o=12),"".concat(n,"-").concat(r,"-").concat(a,", ").concat(o,":").concat(l).concat(i)},q=(0,$.useMemo)(function(){return((null==A?void 0:A.coupons)||[]).filter(function(e){var t=L(e);return!!("all"===o||"current"===o&&"Ongoing"===t||"upcoming"===o&&"Upcoming"===t||"completed"===o&&"Completed"===t)&&!!function(e){var t=e.start_date||e.date;if(!t)return!0;var n=new Date(t),r=new Date,a=r.getMonth(),o=r.getFullYear();if("select"===j)return!0;if("this_month"===j)return n.getMonth()===a&&n.getFullYear()===o;if("last_month"===j){var l=new Date(o,a-1,1);return n.getMonth()===l.getMonth()&&n.getFullYear()===l.getFullYear()}return"this_year"!==j||n.getFullYear()===o}(e)}).map(function(e){return{id:e.id,customer:"".concat(e.coupon_code,"\n").concat(e.coupon_for),timesUsed:"number"==typeof e.times_used?e.times_used:0,date:U(e.date),status:e.status||L(e)}})},[A,o,j]),Q=(0,$.useMemo)(function(){return[{key:"customer",label:(0,pe.__)("Coupon Name","nggallery"),sortType:"backend",render:function(e){var t=vo(String(e.customer).split("\n"),2),n=t[0],a=t[1];return ee().createElement("div",{className:"flex items-start gap-3"},ee().createElement("div",null,ee().createElement("button",{type:"button",className:"text-gray-900 text-sm font-medium hover:underline",onClick:function(){r.setActiveModal("couponDetails",{data:{id:e.id,couponFor:a,couponCode:n,discountType:"percentage",discountValue:"",startDate:"",endDate:"",usageLimit:""}})}},n),ee().createElement("div",{className:"text-gray-500 text-xs"},(0,pe.__)("For","nggallery")," ",ee().createElement("span",{className:"text-gray-700"},a))))}},{key:"timesUsed",label:(0,pe.__)("Times Used","nggallery"),sortType:"backend",render:function(e){return ee().createElement("span",{className:"text-sm text-gray-700"},e.timesUsed)}},{key:"date",label:(0,pe.__)("Date","nggallery"),sortType:"backend",render:function(e){return ee().createElement("span",{className:"text-sm text-gray-700"},e.date)}},{key:"status",label:(0,pe.__)("Status","nggallery"),sortType:"backend",render:function(e){return ee().createElement("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ".concat("Ongoing"===e.status?"bg-blue-100 text-blue-700":"Upcoming"===e.status?"bg-amber-100 text-amber-800":"bg-green-100 text-green-700")},e.status)}}]},[]);return ee().createElement("div",{className:"bg-white rounded-lg shadow-sm"},ee().createElement("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-4"},ee().createElement("div",{className:"flex flex-wrap gap-2"},ee().createElement("button",{className:"px-3 py-1.5 rounded-full text-sm font-medium ".concat("all"===o?"bg-gray-900 text-white":"text-gray-700 hover:text-gray-900"),onClick:function(){l("all"),E(1)}},(0,pe.__)("All","nggallery")),ee().createElement("button",{className:"px-3 py-1.5 rounded-full text-sm font-medium ".concat("current"===o?"bg-gray-900 text-white":"text-gray-700 hover:text-gray-900"),onClick:function(){l("current"),E(1)}},(0,pe.__)("Current","nggallery")),ee().createElement("button",{className:"px-3 py-1.5 rounded-full text-sm font-medium ".concat("upcoming"===o?"bg-gray-900 text-white":"text-gray-700 hover:text-gray-900"),onClick:function(){l("upcoming"),E(1)}},(0,pe.__)("Upcoming","nggallery")),ee().createElement("button",{className:"px-3 py-1.5 rounded-full text-sm font-medium ".concat("completed"===o?"bg-gray-900 text-white":"text-gray-700 hover:text-gray-900"),onClick:function(){l("completed"),E(1)}},(0,pe.__)("Completed","nggallery"))),ee().createElement("button",{type:"button",className:"inline-flex items-center gap-2 rounded-md bg-green-500 text-white px-4 py-2 text-sm font-medium hover:bg-green-600 focus:outline-none focus:ring-2 focus:ring-green-500 w-full sm:w-auto justify-center sm:justify-start",onClick:function(){return r.setActiveModal("couponForm",{onSuccess:function(){}})}},(0,pe.__)("Add New Coupon","nggallery"),ee().createElement("span",{className:"inline-flex items-center justify-center w-5 h-5 rounded-full border border-white"},ee().createElement(ln,{className:"w-4 h-4"})))),ee().createElement("div",{className:"flex flex-col sm:flex-row gap-3 sm:items-center sm:justify-between mb-4"},ee().createElement("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-3"},s.size>0&&ee().createElement(kg,{isOpen:M,onClose:function(){return R(!1)},onToggle:function(){return R(!M)},activeClasses:"relative w-full sm:min-w-[190px] border border-gray-300 bg-gray-50 text-gray-700 px-4 py-2 h-10 rounded-md text-sm font-medium flex items-center justify-between",trigger:ee().createElement("button",{type:"button",className:"relative w-full sm:min-w-[190px] border border-gray-300 bg-white text-gray-700 hover:bg-gray-50 px-4 py-2 h-10 rounded-md text-sm font-medium flex items-center justify-between"},ee().createElement("span",null,(0,pe.__)("Bulk Actions","nggallery")),ee().createElement(rn,{className:"w-4 h-4 text-gray-400"}))},ee().createElement("div",{className:"w-48 py-1"},[{key:"delete",label:(0,pe.__)("Delete Selected","nggallery")}].map(function(e){return ee().createElement("button",{key:e.key,className:"w-full text-left px-4 py-2 text-sm hover:bg-gray-100 ".concat(B===e.key?"text-gray-900":"text-gray-700"),onClick:No(Uh().m(function t(){var n,a;return Uh().w(function(t){for(;;)switch(t.n){case 0:z(e.key),R(!1),"delete"===e.key&&s.size>0&&(n=Array.from(s),a=n.map(function(e){var t=q.find(function(t){return t.id===e}),n=vo(String((null==t?void 0:t.customer)||"").split("\n"),2),r=n[0],a=n[1];return{id:e,title:a||"",code:r||""}}),r.setActiveModal("deleteCoupons",{couponIds:n,items:a,title:(0,pe.__)("Delete Coupons","nggallery"),onConfirm:function(){var e=No(Uh().m(function e(){return Uh().w(function(e){for(;;)switch(e.n){case 0:u(new Set);case 1:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}()}));case 1:return t.a(2)}},t)}))},e.label)}))),ee().createElement(kg,{isOpen:S,onClose:function(){return O(!1)},onToggle:function(){return O(!S)},activeClasses:"relative w-full sm:min-w-[180px] border border-gray-300 bg-gray-50 text-gray-700 px-4 h-10 rounded-md text-sm font-medium flex items-center justify-between",trigger:ee().createElement("button",{type:"button",className:"relative w-full sm:min-w-[180px] border border-gray-300 bg-white text-gray-700 hover:bg-gray-50 px-4 h-10 rounded-md text-sm font-medium flex items-center justify-between"},ee().createElement("span",{className:"flex items-center"},ee().createElement(pr,{className:"w-4 h-4 text-gray-400 mr-2"}),ee().createElement("span",null,"select"===j&&(0,pe.__)("All Dates","nggallery"),"this_month"===j&&(0,pe.__)("This Month","nggallery"),"last_month"===j&&(0,pe.__)("Last Month","nggallery"),"this_year"===j&&(0,pe.__)("This Year","nggallery"))),ee().createElement(rn,{className:"w-4 h-4 text-gray-400"}))},ee().createElement("div",{className:"w-56 py-1"},[{key:"select",label:(0,pe.__)("All Dates","nggallery")},{key:"this_month",label:(0,pe.__)("This Month","nggallery")},{key:"last_month",label:(0,pe.__)("Last Month","nggallery")},{key:"this_year",label:(0,pe.__)("This Year","nggallery")}].map(function(e){return ee().createElement("button",{key:e.key,className:"w-full text-left px-4 py-2 text-sm hover:bg-gray-100 ".concat(j===e.key?"text-gray-900":"text-gray-700"),onClick:function(){T(e.key),O(!1),E(1)}},e.label)})))),ee().createElement("div",{className:"w-full sm:w-auto"},ee().createElement("div",{className:"relative"},ee().createElement("span",{className:"pointer-events-none absolute inset-y-0 left-3 flex items-center text-gray-400"},ee().createElement(wn,{className:"w-5 h-5"})),ee().createElement("input",{type:"text",placeholder:(0,pe.__)("Search Coupons","nggallery"),className:"w-full sm:w-72 border border-gray-300 rounded-md pl-10 pr-3 py-2 text-sm text-gray-700 placeholder:text-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500",value:d,onChange:function(e){return g(e.target.value)}})))),ee().createElement(Ph,{isLoading:D,items:q,visibleColumns:i,selectedItems:s,onSelectAll:function(e){e?u(new Set(q.map(function(e){return e.id}))):(u(new Set),z("bulk"),R(!1))},onSelectItem:function(e){var t=new Set(s);t.has(e)?t.delete(e):t.add(e),u(t),0===t.size&&(z("bulk"),R(!1))},columns:Q,onSort:function(e,t){h(t?e:null),_(t),E(1)},sortColumn:y,sortDirection:v,actionsHeaderLabel:(0,pe.__)("Action","nggallery"),actionCellRenderer:function(e){var t=vo(String(e.customer).split("\n"),2),n=t[0],a=t[1];return ee().createElement("div",{className:"flex flex-col items-center text-gray-500"},ee().createElement("button",{type:"button",className:"flex flex-col items-center text-red-600 hover:text-red-700",onClick:function(){var t;r.setActiveModal("deleteCoupons",{couponIds:[e.id],items:[{id:e.id,title:a,code:n}],title:(0,pe.__)("Delete Coupon","nggallery"),onConfirm:(t=No(Uh().m(function e(){return Uh().w(function(e){for(;;)switch(e.n){case 0:u(new Set);case 1:return e.a(2)}},e)})),function(){return t.apply(this,arguments)})})}},ee().createElement(fr,{className:"w-4 h-4 mb-1"}),ee().createElement("span",{className:"text-xs"},(0,pe.__)("Delete","nggallery"))))},notFoundContent:ee().createElement("div",{className:"py-16"},ee().createElement("div",{className:"flex flex-col items-center justify-center text-center text-gray-500"},ee().createElement("div",{className:"mb-4"},ee().createElement(_r,{className:"w-16 h-16 opacity-60"})),ee().createElement("p",{className:"text-sm mb-2"},(0,pe.__)("No Coupons so far!","nggallery")),ee().createElement("button",{type:"button",className:"inline-flex items-center gap-1 text-green-500 hover:text-green-600 text-sm font-medium",onClick:function(){return r.setActiveModal("couponForm",{onSuccess:function(){}})}},(0,pe.__)("Add New Coupon","nggallery"),ee().createElement(ln,{className:"w-4 h-4"}))))}),(null==A?void 0:A.pagination)&&A.pagination.total_pages>1&&ee().createElement("div",{className:"border-t"},ee().createElement(Xf,{currentPage:x,totalPages:A.pagination.total_pages,perPage:A.pagination.per_page,total:A.pagination.total,onPageChange:E,itemLabel:(0,pe.__)("Coupons","nggallery"),showItemCount:!0})))};var Wh=function(e){var t=e.settings,n=e.tabId,r=e.mutation,a=e.getMutationParams,o=e.debounceDelay,l=void 0===o?1e3:o,i=$o(),c=i.showSuccess,s=i.showError,u=i.showInfo,m=i.clearNotifications,d=Cy(t,l),g=(0,$.useRef)(null),p=(0,$.useRef)(!1);return(0,$.useEffect)(function(){t&&!g.current&&(g.current=structuredClone(t),p.current=!1)},[t,n]),(0,$.useEffect)(function(){if(d&&p.current&&g.current&&JSON.stringify(d)!==JSON.stringify(g.current)&&!r.isPending){u((0,pe.__)("Saving changes...","nggallery"));var e=a(d,n);r.mutate(e,{onSuccess:function(){g.current=structuredClone(d),m(),c((0,pe.__)("Settings saved automatically","nggallery"))},onError:function(){s((0,pe.__)("Failed to save settings automatically","nggallery"))}})}},[d,n,r,a,c,s,u,m]),{markUserInteraction:(0,$.useCallback)(function(){p.current=!0},[]),hasUnsavedChanges:p.current&&g.current&&JSON.stringify(d)!==JSON.stringify(g.current)}};function Hh(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return Vh(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Vh(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Vh(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,Vh(m,"constructor",s),Vh(s,"constructor",c),c.displayName="GeneratorFunction",Vh(s,a,"GeneratorFunction"),Vh(m),Vh(m,a,"Generator"),Vh(m,r,function(){return this}),Vh(m,"toString",function(){return"[object Generator]"}),(Hh=function(){return{w:o,m:d}})()}function Vh(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}Vh=function(e,t,n,r){function o(t,n){Vh(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Vh(e,t,n,r)}function Kh(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Xh(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Kh(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Kh(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}const Yh=function(){var e=gi(),t=e.data,r=e.isLoading,a=pi(),o=re(),l=$o(),i=l.showSuccess,c=l.showError,s=(0,$.useMemo)(function(){var e,n;return t?{ecommerce_enable_email_notification:Boolean(null===(e=t.ecommerce_enable_email_notification)||void 0===e||e),ecommerce_email_notification_recipient:t.ecommerce_email_notification_recipient||"",ecommerce_email_notification_subject:t.ecommerce_email_notification_subject||(0,pe.__)("New Purchase!","nggallery"),ecommerce_email_notification_body:t.ecommerce_email_notification_body||(0,pe.__)("You received a payment of %%total_amount%% from %%customer_name%% (%%email%%). For more details, visit: %%order_details_page%%\n\n%%gateway_admin_note%%\n\nHere is a comma separated list of the image file names. You can copy and\npaste this in your favorite image management software to quickly search for\nand find all selected images.\n\nFiles: %%file_list%%","nggallery"),ecommerce_enable_email_receipt:Boolean(null===(n=t.ecommerce_enable_email_receipt)||void 0===n||n),ecommerce_email_receipt_subject:t.ecommerce_email_receipt_subject||(0,pe.__)("Thank you for your purchase!","nggallery"),ecommerce_email_receipt_body:t.ecommerce_email_receipt_body||(0,pe.__)("Thank you for your order, %%customer_name%%.\n\nYou ordered %%item_count%% items, and have been billed a total of %%total_amount%%.\n\nTo review your order, please go to %%order_details_page%%.\n\nThanks for shopping at %%site_url%%!","nggallery")}:null},[t]),u=vo((0,$.useState)(null),2),m=u[0],d=u[1];(0,$.useEffect)(function(){s&&!m&&d(s)},[s,m]);var g=Wh({settings:m,tabId:"ecommerce-email-setup",mutation:{mutate:function(e,t){a.mutate(e,Xh(Xh({},t),{},{onSuccess:function(){for(var e,n,r=arguments.length,a=new Array(r),l=0;l<r;l++)a[l]=arguments[l];null==t||null===(e=(n=t).onSuccess)||void 0===e||e.call.apply(e,[n].concat(a)),o.invalidateQueries({queryKey:["printlabRequirements"]})}}))},isPending:a.isPending},getMutationParams:function(e){return e||{}},debounceDelay:1e3}),p=g.markUserInteraction;if(r||!m)return ee().createElement(oo,{size:"md",text:(0,pe.__)("Loading settings...","nggallery")});var f=function(e,t){d(function(r){return r?Xh(Xh({},r),{},n({},e,t)):r}),p()},y=(0,pe.__)("Wrap placeholders in %%param%%. Accepted placeholders: customer_name, email, total_amount, item_count, shipping_street_address, shipping_city, shipping_state, shipping_zip, shipping_country, order_id, hash, order_details_page, admin_email, blog_name, blog_description, blog_url, site_url, home_url, and file_list","nggallery"),h=(0,pe.__)("Wrap placeholders in %%param%%. Accepted placeholders: customer_name, email, total_amount, item_count, shipping_street_address, shipping_city, shipping_state, shipping_zip, shipping_country, order_id, hash, order_details_page, admin_email, blog_name, blog_description, blog_url, site_url, and home_url","nggallery"),b=function(){var e=No(Hh().m(function e(t){var n,r;return Hh().w(function(e){for(;;)switch(e.p=e.n){case 0:return n="%%".concat(t,"%%"),e.p=1,e.n=2,navigator.clipboard.writeText(n);case 2:i((0,pe.__)("Placeholder copied to clipboard!","nggallery")),e.n=4;break;case 3:e.p=3,e.v,(r=document.createElement("textarea")).value=n,document.body.appendChild(r),r.select();try{document.execCommand("copy"),i((0,pe.__)("Placeholder copied to clipboard!","nggallery"))}catch(e){c((0,pe.__)("Failed to copy placeholder","nggallery"))}document.body.removeChild(r);case 4:return e.a(2)}},e,null,[[1,3]])}));return function(t){return e.apply(this,arguments)}}();return ee().createElement("div",{className:"bg-white rounded-lg shadow-sm p-6"},ee().createElement("div",{className:"mb-6"},ee().createElement("h2",{className:"text-xl font-semibold text-gray-900 mb-2"},(0,pe.__)("Email Setup","nggallery")),ee().createElement("p",{className:"text-gray-600 text-sm"},(0,pe.__)("Configure email notifications and templates for your eCommerce orders.","nggallery"))),ee().createElement("div",{className:"mb-8"},ee().createElement("h3",{className:"text-lg font-semibold text-gray-900 mb-4"},(0,pe.__)("Order Notification (Admin)","nggallery")),ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6"},ee().createElement("div",{className:"md:col-span-2"},ee().createElement(fs,{id:"ecommerce_enable_email_notification",name:"ecommerce_enable_email_notification",checked:Boolean(m.ecommerce_enable_email_notification),onChange:function(e){return f("ecommerce_enable_email_notification",e.target.checked)},label:(0,pe.__)("Enable order notification e-mail","nggallery"),help:(0,pe.__)("Send an e-mail notification to the admin when an order is placed.","nggallery")})),ee().createElement("div",null,ee().createElement(uc,{type:"text",id:"ecommerce_email_notification_recipient",name:"ecommerce_email_notification_recipient",value:m.ecommerce_email_notification_recipient,onChange:function(e){return f("ecommerce_email_notification_recipient",e.target.value)},label:(0,pe.__)("Order notification e-mail recipient:","nggallery"),placeholder:(0,pe.__)("john@example.com","nggallery")})),ee().createElement("div",null,ee().createElement(uc,{type:"text",id:"ecommerce_email_notification_subject",name:"ecommerce_email_notification_subject",value:m.ecommerce_email_notification_subject,onChange:function(e){return f("ecommerce_email_notification_subject",e.target.value)},label:(0,pe.__)("Order notification e-mail subject:","nggallery"),placeholder:(0,pe.__)("Subject","nggallery")})),ee().createElement("div",{className:"md:col-span-2"},ee().createElement(Yc,{id:"ecommerce_email_notification_body",name:"ecommerce_email_notification_body",value:m.ecommerce_email_notification_body,onChange:function(e){return f("ecommerce_email_notification_body",e.target.value)},label:(0,pe.__)("Order notification e-mail content:","nggallery"),help:y,rows:8}),ee().createElement("div",{className:"mt-2 flex flex-wrap gap-2 items-center"},ee().createElement("span",{className:"text-xs text-gray-500"},(0,pe.__)("Placeholders:","nggallery")),["customer_name","email","total_amount","item_count","shipping_street_address","shipping_city","shipping_state","shipping_zip","shipping_country","order_id","hash","order_details_page","admin_email","blog_name","blog_description","blog_url","site_url","home_url","file_list"].map(function(e){return ee().createElement("button",{key:e,type:"button",onClick:function(){return b(e)},className:"bg-gray-100 px-2.5 py-1 rounded text-xs font-mono text-gray-600 hover:bg-gray-200 transition-colors cursor-pointer border-none",title:(0,pe.__)("Click to copy","nggallery")},"%%".concat(e,"%%"))}))))),ee().createElement("div",null,ee().createElement("h3",{className:"text-lg font-semibold text-gray-900 mb-4"},(0,pe.__)("Customer Receipt","nggallery")),ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6"},ee().createElement("div",{className:"md:col-span-2"},ee().createElement(fs,{id:"ecommerce_enable_email_receipt",name:"ecommerce_enable_email_receipt",checked:Boolean(m.ecommerce_enable_email_receipt),onChange:function(e){return f("ecommerce_enable_email_receipt",e.target.checked)},label:(0,pe.__)("Send e-mail receipt to customer?","nggallery"),help:(0,pe.__)("If enabled a receipt will be sent to the customer after successful checkout","nggallery")})),ee().createElement("div",null,ee().createElement(uc,{type:"text",id:"ecommerce_email_receipt_subject",name:"ecommerce_email_receipt_subject",value:m.ecommerce_email_receipt_subject,onChange:function(e){return f("ecommerce_email_receipt_subject",e.target.value)},label:(0,pe.__)("E-mail subject:","nggallery"),placeholder:(0,pe.__)("Subject","nggallery")})),ee().createElement("div",{className:"md:col-span-2"},ee().createElement(Yc,{id:"ecommerce_email_receipt_body",name:"ecommerce_email_receipt_body",value:m.ecommerce_email_receipt_body,onChange:function(e){return f("ecommerce_email_receipt_body",e.target.value)},label:(0,pe.__)("E-mail content:","nggallery"),help:h,rows:8}),ee().createElement("div",{className:"mt-2 flex flex-wrap gap-2 items-center"},ee().createElement("span",{className:"text-xs text-gray-500"},(0,pe.__)("Placeholders:","nggallery")),["customer_name","email","total_amount","item_count","shipping_street_address","shipping_city","shipping_state","shipping_zip","shipping_country","order_id","hash","order_details_page","admin_email","blog_name","blog_description","blog_url","site_url","home_url"].map(function(e){return ee().createElement("button",{key:e,type:"button",onClick:function(){return b(e)},className:"bg-gray-100 px-2.5 py-1 rounded text-xs font-mono text-gray-600 hover:bg-gray-200 transition-colors cursor-pointer border-none",title:(0,pe.__)("Click to copy","nggallery")},"%%".concat(e,"%%"))}))))))};function Zh(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Jh(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Zh(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Zh(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function $h(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return eb(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(eb(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,eb(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,eb(m,"constructor",s),eb(s,"constructor",c),c.displayName="GeneratorFunction",eb(s,a,"GeneratorFunction"),eb(m),eb(m,a,"Generator"),eb(m,r,function(){return this}),eb(m,"toString",function(){return"[object Generator]"}),($h=function(){return{w:o,m:d}})()}function eb(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}eb=function(e,t,n,r){function o(t,n){eb(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},eb(e,t,n,r)}const tb=function(){var e,t=gi(),r=t.data,a=t.isLoading,o=pi(),l=re(),i=Pi({enabled:"pro"===zr,per_page:-1}),c=i.data,s=i.isLoading,u=function(){var e=vo((0,$.useState)([]),2),t=e[0],n=e[1],r=vo((0,$.useState)(!0),2),a=r[0],o=r[1];return(0,$.useEffect)(function(){var e=!0,t=function(){var t=No($h().m(function t(){var r;return $h().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,Oo()({path:"/wp/v2/pages?per_page=100&status=publish"});case 1:r=t.v,e&&n(r),t.n=3;break;case 2:t.p=2,t.v,e&&n([]);case 3:return t.p=3,e&&o(!1),t.f(3);case 4:return t.a(2)}},t,null,[[0,2,3,4]])}));return function(){return t.apply(this,arguments)}}();return t(),function(){e=!1}},[]),{pages:t,loading:a}}(),m=u.pages,d=u.loading,g=vo((0,$.useState)([]),2),p=g[0],f=g[1],y=$o(),h=y.showSuccess,b=y.showError,v=(0,$.useMemo)(function(){if(!r)return null;var e=r,t=String(e.ecommerce_cart_menu_item||"none");return{ecommerce_page_checkout:String(e.ecommerce_page_checkout||""),ecommerce_page_thanks:String(e.ecommerce_page_thanks||""),ecommerce_page_cancel:String(e.ecommerce_page_cancel||""),ecommerce_page_digital_downloads:String(e.ecommerce_page_digital_downloads||""),ecommerce_cart_menu_item:["none","icon","icon_with_items","icon_and_total","icon_and_total_with_items"].includes(t)?t:"none",ecommerce_default_pricelist:null===e.ecommerce_default_pricelist||void 0===e.ecommerce_default_pricelist?null:String(e.ecommerce_default_pricelist)}},[r]),_=vo((0,$.useState)(null),2),w=_[0],x=_[1],E=vo((0,$.useState)({open:!1,field:null,title:"",isCreating:!1}),2),C=E[0],N=E[1];(0,$.useEffect)(function(){v&&!w&&x(v)},[v,w]);var k=Wh({settings:w,tabId:"ecommerce-page-setup",mutation:{mutate:function(e,t){o.mutate(e,Jh(Jh({},t),{},{onSuccess:function(){for(var e,n,r=arguments.length,a=new Array(r),o=0;o<r;o++)a[o]=arguments[o];null==t||null===(e=(n=t).onSuccess)||void 0===e||e.call.apply(e,[n].concat(a)),l.invalidateQueries({queryKey:["printlabRequirements"]})}}))},isPending:o.isPending},getMutationParams:function(e){return e||{}},debounceDelay:1e3}),S=k.markUserInteraction,O=function(e,t){x(function(r){return r?Jh(Jh({},r),{},n({},e,t)):r}),S()},P={ecommerce_page_checkout:{defaultTitle:(0,pe.__)("Shopping Cart","nggallery"),content:"[ngg_pro_checkout]"},ecommerce_page_thanks:{defaultTitle:(0,pe.__)("Thanks","nggallery"),content:"[ngg_pro_order_details]"},ecommerce_page_cancel:{defaultTitle:(0,pe.__)("Order Cancelled","nggallery"),content:(0,pe.__)("Your order was cancelled","nggallery")},ecommerce_page_digital_downloads:{defaultTitle:(0,pe.__)("Digital Downloads","nggallery"),content:"[ngg_pro_digital_downloads]"},ecommerce_cart_menu_item:void 0,ecommerce_default_pricelist:void 0},j=function(e){var t=P[e];t&&N({open:!0,field:e,title:t.defaultTitle,isCreating:!1})},T=function(){var e=No($h().m(function e(){var t,r,a,o,l,i;return $h().w(function(e){for(;;)switch(e.p=e.n){case 0:if(C.field){e.n=1;break}return e.a(2);case 1:if(t=P[C.field]){e.n=2;break}return e.a(2);case 2:return e.p=2,N(function(e){return Jh(Jh({},e),{},{isCreating:!0})}),a=null===(r=window.imagelyApp)||void 0===r?void 0:r.nonce,e.n=3,Oo()({path:"/wp/v2/pages",method:"POST",headers:{"X-WP-Nonce":a,"Content-Type":"application/json"},data:{title:C.title||t.defaultTitle,content:t.content,status:"publish"}});case 3:o=e.v,(l=String((null==o?void 0:o.id)||""))&&(x(function(e){return e?Jh(Jh({},e),{},n({},C.field,l)):e}),S(),h((0,pe.__)("Page created and selected.","nggallery")),i=null!=o&&o.title&&o.title.rendered?o.title.rendered:C.title||"",f(function(e){return[{id:Number(l),title:{rendered:i}}].concat(ko(e))})),e.n=5;break;case 4:e.p=4,e.v,b((0,pe.__)("Failed to create page","nggallery"));case 5:return e.p=5,N({open:!1,field:null,title:"",isCreating:!1}),e.f(5);case 6:return e.a(2)}},e,null,[[2,4,5,6]])}));return function(){return e.apply(this,arguments)}}();if(a||!w)return ee().createElement(oo,{size:"md",text:(0,pe.__)("Loading settings...","nggallery")});var I=[].concat(ko(p),ko(m)).reduce(function(e,t){return e.find(function(e){return e.id===t.id})||e.push(t),e},[]).map(function(e){var t;return{value:String(e.id),label:(null===(t=e.title)||void 0===t?void 0:t.rendered)||"#".concat(e.id)}}),A=[{value:"none",label:(0,pe.__)("None","nggallery")},{value:"icon",label:(0,pe.__)("Icon Only","nggallery")},{value:"icon_with_items",label:(0,pe.__)("Icon Only (When Cart Has Items)","nggallery")},{value:"icon_and_total",label:(0,pe.__)("Icon & Total","nggallery")},{value:"icon_and_total_with_items",label:(0,pe.__)("Icon & Total (When Cart Has Items)","nggallery")}],D=((null==c?void 0:c.pricelists)||[]).map(function(e){return{value:String(e.id),label:e.title}});return ee().createElement(ee().Fragment,null,ee().createElement("div",{className:"bg-white rounded-lg shadow-sm p-6"},ee().createElement("div",{className:"mb-6"},ee().createElement("h2",{className:"text-xl font-semibold text-gray-900 mb-2"},(0,pe.__)("Page Setup","nggallery")),ee().createElement("p",{className:"text-gray-600 text-sm"},(0,pe.__)("Configure cart, checkout, and other eCommerce page settings.","nggallery"))),ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6"},ee().createElement("div",null,ee().createElement(sc,{id:"ecommerce_page_checkout",name:"ecommerce_page_checkout",value:w.ecommerce_page_checkout,onChange:function(e){var t=e.target.value;"__create__"!==t?O("ecommerce_page_checkout",t):j("ecommerce_page_checkout")},label:(0,pe.__)("Checkout page","nggallery"),help:(0,pe.__)('This page requires the [ngg_pro_checkout] shortcode, which will be automatically added if not already present. Selecting "Create new" will create a new page that will appear in your Primary Menu unless you\'ve customized your menu settings.',"nggallery")},d?ee().createElement("option",{value:""},(0,pe.__)("Loading...","nggallery")):ee().createElement(ee().Fragment,null,ee().createElement("option",{value:""},(0,pe.__)("Select page…","nggallery")),ee().createElement("option",{value:"__create__",className:"text-green-600"},(0,pe.__)("Create new","nggallery")),I.map(function(e){return ee().createElement("option",{key:e.value,value:e.value},e.label)})))),ee().createElement("div",null,ee().createElement(sc,{id:"ecommerce_page_thanks",name:"ecommerce_page_thanks",value:w.ecommerce_page_thanks,onChange:function(e){var t=e.target.value;"__create__"!==t?O("ecommerce_page_thanks",t):j("ecommerce_page_thanks")},label:(0,pe.__)("Thank-you page","nggallery"),help:(0,pe.__)('This page should have the [ngg_pro_order_details] shortcode, which will be automatically added if not already present. Selecting "Create new" will create a new page that will appear in your Primary Menu unless you\'ve customized your menu settings.',"nggallery")},d?ee().createElement("option",{value:""},(0,pe.__)("Loading...","nggallery")):ee().createElement(ee().Fragment,null,ee().createElement("option",{value:""},(0,pe.__)("Select page…","nggallery")),ee().createElement("option",{value:"__create__",className:"text-green-600"},(0,pe.__)("Create new","nggallery")),I.map(function(e){return ee().createElement("option",{key:e.value,value:e.value},e.label)})))),ee().createElement("div",null,ee().createElement(sc,{id:"ecommerce_page_cancel",name:"ecommerce_page_cancel",value:w.ecommerce_page_cancel,onChange:function(e){var t=e.target.value;"__create__"!==t?O("ecommerce_page_cancel",t):j("ecommerce_page_cancel")},label:(0,pe.__)("Cancel page","nggallery"),help:(0,pe.__)('Selecting "Create new" will create a new page that will appear in your Primary Menu unless you\'ve customized your menu settings.',"nggallery")},d?ee().createElement("option",{value:""},(0,pe.__)("Loading...","nggallery")):ee().createElement(ee().Fragment,null,ee().createElement("option",{value:""},(0,pe.__)("Select page…","nggallery")),ee().createElement("option",{value:"__create__",className:"text-green-600"},(0,pe.__)("Create new","nggallery")),I.map(function(e){return ee().createElement("option",{key:e.value,value:e.value},e.label)})))),ee().createElement("div",null,ee().createElement(sc,{id:"ecommerce_page_digital_downloads",name:"ecommerce_page_digital_downloads",value:w.ecommerce_page_digital_downloads,onChange:function(e){var t=e.target.value;"__create__"!==t?O("ecommerce_page_digital_downloads",t):j("ecommerce_page_digital_downloads")},label:(0,pe.__)("Digital downloads page","nggallery"),help:(0,pe.__)('This page requires the [ngg_pro_digital_downloads] shortcode, which will be automatically added if not already present. Selecting "Create new" will create a new page that will appear in your Primary Menu unless you\'ve customized your menu settings.',"nggallery")},d?ee().createElement("option",{value:""},(0,pe.__)("Loading...","nggallery")):ee().createElement(ee().Fragment,null,ee().createElement("option",{value:""},(0,pe.__)("Select page…","nggallery")),ee().createElement("option",{value:"__create__",className:"text-green-600"},(0,pe.__)("Create new","nggallery")),I.map(function(e){return ee().createElement("option",{key:e.value,value:e.value},e.label)})))),ee().createElement("div",null,ee().createElement(sc,{id:"ecommerce_cart_menu_item",name:"ecommerce_cart_menu_item",value:w.ecommerce_cart_menu_item,onChange:function(e){return O("ecommerce_cart_menu_item",e.target.value)},label:(0,pe.__)("Cart menu icon","nggallery"),help:(0,pe.__)("Determines the appearance of the Checkout page selected above when shown as an entry inside a menu. When a setting other than None is selected, the checkout page will be added to the first navigation menu registered by your theme.","nggallery")},A.map(function(e){return ee().createElement("option",{key:e.value,value:e.value},e.label)}))),ee().createElement("div",null,ee().createElement(sc,{id:"ecommerce_default_pricelist",name:"ecommerce_default_pricelist",value:String(null!==(e=w.ecommerce_default_pricelist)&&void 0!==e?e:""),onChange:function(e){return O("ecommerce_default_pricelist",e.target.value)},label:(0,pe.__)("Default pricelist","nggallery"),help:(0,pe.__)("New galleries will be assigned this pricelist","nggallery")},s?ee().createElement("option",{value:""},(0,pe.__)("Loading...","nggallery")):ee().createElement(ee().Fragment,null,ee().createElement("option",{value:""},(0,pe.__)("None","nggallery")),D.map(function(e){return ee().createElement("option",{key:e.value,value:e.value},e.label)})))))),ee().createElement(Eo,{isOpen:C.open,onClose:function(){return N({open:!1,field:null,title:"",isCreating:!1})},title:(0,pe.__)("Create Page","nggallery")},ee().createElement("div",{className:"space-y-4"},ee().createElement(uc,{type:"text",id:"new_page_title",name:"new_page_title",value:C.title,onChange:function(e){return N(function(t){return Jh(Jh({},t),{},{title:e.target.value})})},label:(0,pe.__)("Title","nggallery")}),ee().createElement("div",{className:"flex gap-2 justify-end"},ee().createElement("button",{type:"button",className:"px-4 py-2 text-sm rounded bg-gray-100 hover:bg-gray-200",onClick:function(){return N({open:!1,field:null,title:"",isCreating:!1})},disabled:C.isCreating},(0,pe.__)("Cancel","nggallery")),ee().createElement("button",{type:"button",className:"px-4 py-2 text-sm rounded bg-green-600 text-white hover:bg-green-700 disabled:opacity-60",onClick:T,disabled:C.isCreating||!C.title.trim()},C.isCreating?(0,pe.__)("Creating...","nggallery"):(0,pe.__)("Create","nggallery"))))))};function nb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function rb(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?nb(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):nb(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}const ab=function(){var e,t=(null===(e=window.imagelyApp)||void 0===e?void 0:e.utmVersion)||"",r=gi(),a=r.data,o=r.isLoading,l=pi(),i=re(),c=$o().showError,s=(0,$.useMemo)(function(){var e,t,n,r,o,l,i,c,s,u,m,d,g;if(!a)return null;var p=a;return{ecommerce_cheque_enable:ni(null!==(e=p.ecommerce_cheque_enable)&&void 0!==e&&e),ecommerce_cheque_instructions:p.ecommerce_cheque_instructions||(0,pe.__)("<p>Thanks very much for your purchase! We'll be in touch shortly via email to confirm your order and to provide details on payment.</p>","nggallery"),ecommerce_paypal_enable:ni(null!==(t=p.ecommerce_paypal_enable)&&void 0!==t&&t),ecommerce_paypal_sandbox:ni(null===(n=p.ecommerce_paypal_sandbox)||void 0===n||n),ecommerce_paypal_email:p.ecommerce_paypal_email||"",ecommerce_paypal_username:p.ecommerce_paypal_username||"",ecommerce_paypal_password:p.ecommerce_paypal_password||"",ecommerce_paypal_signature:p.ecommerce_paypal_signature||"",ecommerce_paypal_std_enable:ni(null!==(r=p.ecommerce_paypal_std_enable)&&void 0!==r&&r),ecommerce_paypal_std_sandbox:ni(null===(o=p.ecommerce_paypal_std_sandbox)||void 0===o||o),ecommerce_paypal_std_email:p.ecommerce_paypal_std_email||"",ecommerce_test_gateway_enable:ni(null!==(l=p.ecommerce_test_gateway_enable)&&void 0!==l&&l),ecommerce_stripe_enable:ni(null!==(i=p.ecommerce_stripe_enable)&&void 0!==i&&i),ecommerce_stripe_key_public:p.ecommerce_stripe_key_public||"",ecommerce_stripe_key_private:p.ecommerce_stripe_key_private||"",ecommerce_paypal_checkout_enable:ni(null!==(c=p.ecommerce_paypal_checkout_enable)&&void 0!==c&&c),ecommerce_paypal_checkout_sandbox:ni(null===(s=p.ecommerce_paypal_checkout_sandbox)||void 0===s||s),ecommerce_paypal_checkout_client_id:p.ecommerce_paypal_checkout_client_id||"",ecommerce_paypal_checkout_client_secret:p.ecommerce_paypal_checkout_client_secret||"",ecommerce_braintree_enable:ni(null!==(u=p.ecommerce_braintree_enable)&&void 0!==u&&u),ecommerce_braintree_sandbox:ni(null===(m=p.ecommerce_braintree_sandbox)||void 0===m||m),ecommerce_braintree_merchant_id:p.ecommerce_braintree_merchant_id||"",ecommerce_braintree_public_key:p.ecommerce_braintree_public_key||"",ecommerce_braintree_private_key:p.ecommerce_braintree_private_key||"",ecommerce_braintree_enable_paypal:ni(null!==(d=p.ecommerce_braintree_enable_paypal)&&void 0!==d&&d),ecommerce_braintree_pass_client_data:ni(null!==(g=p.ecommerce_braintree_pass_client_data)&&void 0!==g&&g)}},[a]),u=vo((0,$.useState)(null),2),m=u[0],d=u[1];(0,$.useEffect)(function(){s&&!m&&d(s)},[s,m]);var g,p,f=Wh({settings:m,tabId:"ecommerce-payment-setup",mutation:{mutate:function(e,t){l.mutate(e,rb(rb({},t),{},{onSuccess:function(){for(var e,n,r=arguments.length,a=new Array(r),o=0;o<r;o++)a[o]=arguments[o];null==t||null===(e=(n=t).onSuccess)||void 0===e||e.call.apply(e,[n].concat(a)),i.invalidateQueries({queryKey:["printlabRequirements"]})}}))},isPending:l.isPending},getMutationParams:function(e){return e||{}},debounceDelay:1e3}),y=f.markUserInteraction,h=function(e,t){d(function(r){return r?rb(rb({},r),{},n({},e,t)):r}),y()},b=(0,$.useMemo)(function(){if(!m)return{};var e,t,n,r,a,o,l,i,c,s,u,d,g,p={};return m.ecommerce_cheque_enable&&(null!==(e=m.ecommerce_cheque_instructions)&&void 0!==e&&e.trim()||(p.ecommerce_cheque_instructions=(0,pe.__)("Instructions are required when Checks are enabled.","nggallery"))),m.ecommerce_paypal_enable&&(null!==(t=m.ecommerce_paypal_email)&&void 0!==t&&t.trim()||(p.ecommerce_paypal_email=(0,pe.__)("Email is required.","nggallery")),null!==(n=m.ecommerce_paypal_username)&&void 0!==n&&n.trim()||(p.ecommerce_paypal_username=(0,pe.__)("API Username is required.","nggallery")),null!==(r=m.ecommerce_paypal_password)&&void 0!==r&&r.trim()||(p.ecommerce_paypal_password=(0,pe.__)("API Password is required.","nggallery")),null!==(a=m.ecommerce_paypal_signature)&&void 0!==a&&a.trim()||(p.ecommerce_paypal_signature=(0,pe.__)("API Signature is required.","nggallery"))),m.ecommerce_paypal_std_enable&&(null!==(o=m.ecommerce_paypal_std_email)&&void 0!==o&&o.trim()||(p.ecommerce_paypal_std_email=(0,pe.__)("Email is required.","nggallery"))),m.ecommerce_stripe_enable&&(null!==(l=m.ecommerce_stripe_key_public)&&void 0!==l&&l.trim()||(p.ecommerce_stripe_key_public=(0,pe.__)("Public key is required.","nggallery")),null!==(i=m.ecommerce_stripe_key_private)&&void 0!==i&&i.trim()||(p.ecommerce_stripe_key_private=(0,pe.__)("Private key is required.","nggallery"))),m.ecommerce_paypal_checkout_enable&&(null!==(c=m.ecommerce_paypal_checkout_client_id)&&void 0!==c&&c.trim()||(p.ecommerce_paypal_checkout_client_id=(0,pe.__)("Client ID is required.","nggallery")),null!==(s=m.ecommerce_paypal_checkout_client_secret)&&void 0!==s&&s.trim()||(p.ecommerce_paypal_checkout_client_secret=(0,pe.__)("Client secret is required.","nggallery"))),m.ecommerce_braintree_enable&&(null!==(u=m.ecommerce_braintree_merchant_id)&&void 0!==u&&u.trim()||(p.ecommerce_braintree_merchant_id=(0,pe.__)("Merchant ID is required.","nggallery")),null!==(d=m.ecommerce_braintree_public_key)&&void 0!==d&&d.trim()||(p.ecommerce_braintree_public_key=(0,pe.__)("Public key is required.","nggallery")),null!==(g=m.ecommerce_braintree_private_key)&&void 0!==g&&g.trim()||(p.ecommerce_braintree_private_key=(0,pe.__)("Private key is required.","nggallery"))),p},[m]);return(0,$.useEffect)(function(){m&&Object.keys(b).length>0&&c((0,pe.__)("Some payment gateway fields are missing or invalid. Please review the highlighted fields.","nggallery"))},[Object.keys(b).join("|")]),o||!m?ee().createElement(oo,{size:"md",text:(0,pe.__)("Loading settings...","nggallery")}):ee().createElement("div",{className:"bg-white rounded-lg shadow-sm p-6"},ee().createElement("div",{className:"mb-6"},ee().createElement("h2",{className:"text-xl font-semibold text-gray-900 mb-2"},(0,pe.__)("Setup Payment Gateway","nggallery"))),ee().createElement("div",{className:"mb-8"},ee().createElement("h3",{className:"text-lg font-semibold text-gray-900 mb-4"},(0,pe.__)("Testing Gateway","nggallery")),ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6"},ee().createElement("div",{className:"md:col-span-2"},ee().createElement(fs,{id:"ecommerce_test_gateway_enable",name:"ecommerce_test_gateway_enable",checked:Boolean(m.ecommerce_test_gateway_enable),onChange:function(e){return h("ecommerce_test_gateway_enable",e.target.checked)},label:(0,pe.__)("Enable Testing Gateway","nggallery"),help:(0,pe.__)("Enables a gateway that does not collect payments and sends users directly to their order confirmation","nggallery")})))),ee().createElement("hr",{className:"my-6"}),ee().createElement("div",{className:"mb-8"},ee().createElement("h3",{className:"text-lg font-semibold text-gray-900 mb-4"},(0,pe.__)("Checks","nggallery")),ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6"},ee().createElement("div",{className:"md:col-span-2"},ee().createElement(fs,{id:"ecommerce_cheque_enable",name:"ecommerce_cheque_enable",checked:Boolean(m.ecommerce_cheque_enable),onChange:function(e){return h("ecommerce_cheque_enable",e.target.checked)},label:(0,pe.__)("Enable Checks","nggallery")})),m.ecommerce_cheque_enable&&ee().createElement("div",{className:"md:col-span-2"},ee().createElement(Yc,{id:"ecommerce_cheque_instructions",name:"ecommerce_cheque_instructions",value:(g=m.ecommerce_cheque_instructions,p=document.createElement("textarea"),p.innerHTML=g,p.value),onChange:function(e){return h("ecommerce_cheque_instructions",e.target.value)},label:(0,pe.__)("Instructions","nggallery"),help:(0,pe.__)("Use this to inform users how to pay and where they should send their payment","nggallery"),rows:6}),b.ecommerce_cheque_instructions&&ee().createElement("p",{className:"mt-1 text-xs text-red-600"},b.ecommerce_cheque_instructions)))),ee().createElement("hr",{className:"my-6"}),ee().createElement("div",{className:"mb-8"},ee().createElement("h3",{className:"text-lg font-semibold text-gray-900 mb-4"},(0,pe.__)("PayPal Express Checkout","nggallery")),ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6"},ee().createElement("div",{className:"md:col-span-2"},ee().createElement(fs,{id:"ecommerce_paypal_enable",name:"ecommerce_paypal_enable",checked:Boolean(m.ecommerce_paypal_enable),onChange:function(e){return h("ecommerce_paypal_enable",e.target.checked)},label:(0,pe.__)("Enable PayPal Express Checkout","nggallery"),help:(0,pe.__)("Not all currencies are supported by all payment gateways. Please be sure to confirm your desired currency is supported by PayPal","nggallery")})),m.ecommerce_paypal_enable&&ee().createElement(ee().Fragment,null,ee().createElement("div",null,ee().createElement(fs,{id:"ecommerce_paypal_sandbox",name:"ecommerce_paypal_sandbox",checked:Boolean(m.ecommerce_paypal_sandbox),onChange:function(e){return h("ecommerce_paypal_sandbox",e.target.checked)},label:(0,pe.__)("Use sandbox?","nggallery"),help:(0,pe.__)("If enabled transactions will use testing servers on which no currency is actually moved","nggallery")})),ee().createElement("div",null,ee().createElement(uc,{type:"text",id:"ecommerce_paypal_email",name:"ecommerce_paypal_email",value:m.ecommerce_paypal_email,onChange:function(e){return h("ecommerce_paypal_email",e.target.value)},label:(0,pe.__)("Email","nggallery")}),b.ecommerce_paypal_email&&ee().createElement("p",{className:"mt-1 text-xs text-red-600"},b.ecommerce_paypal_email)),ee().createElement("div",null,ee().createElement(uc,{type:"text",id:"ecommerce_paypal_username",name:"ecommerce_paypal_username",value:m.ecommerce_paypal_username,onChange:function(e){return h("ecommerce_paypal_username",e.target.value)},label:(0,pe.__)("API Username","nggallery")}),b.ecommerce_paypal_username&&ee().createElement("p",{className:"mt-1 text-xs text-red-600"},b.ecommerce_paypal_username)),ee().createElement("div",null,ee().createElement(uc,{type:"password",id:"ecommerce_paypal_password",name:"ecommerce_paypal_password",value:m.ecommerce_paypal_password,onChange:function(e){return h("ecommerce_paypal_password",e.target.value)},label:(0,pe.__)("API Password","nggallery")}),b.ecommerce_paypal_password&&ee().createElement("p",{className:"mt-1 text-xs text-red-600"},b.ecommerce_paypal_password)),ee().createElement("div",null,ee().createElement(uc,{type:"text",id:"ecommerce_paypal_signature",name:"ecommerce_paypal_signature",value:m.ecommerce_paypal_signature,onChange:function(e){return h("ecommerce_paypal_signature",e.target.value)},label:(0,pe.__)("API Signature","nggallery")}),b.ecommerce_paypal_signature&&ee().createElement("p",{className:"mt-1 text-xs text-red-600"},b.ecommerce_paypal_signature))))),ee().createElement("hr",{className:"my-6"}),ee().createElement("div",{className:"mb-8"},ee().createElement("h3",{className:"text-lg font-semibold text-gray-900 mb-4"},(0,pe.__)("PayPal Standard","nggallery")),ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6"},ee().createElement("div",{className:"md:col-span-2"},ee().createElement(fs,{id:"ecommerce_paypal_std_enable",name:"ecommerce_paypal_std_enable",checked:Boolean(m.ecommerce_paypal_std_enable),onChange:function(e){return h("ecommerce_paypal_std_enable",e.target.checked)},label:(0,pe.__)("Enable PayPal Standard","nggallery"),help:(0,pe.__)("Not all currencies are supported by all payment gateways. Please be sure to confirm your desired currency is supported by PayPal","nggallery")})),m.ecommerce_paypal_std_enable&&ee().createElement(ee().Fragment,null,ee().createElement("div",null,ee().createElement(fs,{id:"ecommerce_paypal_std_sandbox",name:"ecommerce_paypal_std_sandbox",checked:Boolean(m.ecommerce_paypal_std_sandbox),onChange:function(e){return h("ecommerce_paypal_std_sandbox",e.target.checked)},label:(0,pe.__)("Use Sandbox?","nggallery")})),ee().createElement("div",null,ee().createElement(uc,{type:"text",id:"ecommerce_paypal_std_email",name:"ecommerce_paypal_std_email",value:m.ecommerce_paypal_std_email,onChange:function(e){return h("ecommerce_paypal_std_email",e.target.value)},label:(0,pe.__)("Email","nggallery"),help:(0,pe.__)("Only PayPal Premier and Business accounts are supported","nggallery")}),b.ecommerce_paypal_std_email&&ee().createElement("p",{className:"mt-1 text-xs text-red-600"},b.ecommerce_paypal_std_email))))),ee().createElement("hr",{className:"my-6"}),ee().createElement("div",{className:"mb-8"},ee().createElement("h3",{className:"text-lg font-semibold text-gray-900 mb-4"},(0,pe.__)("Stripe","nggallery")),ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6"},ee().createElement("div",{className:"md:col-span-2"},ee().createElement(fs,{id:"ecommerce_stripe_enable",name:"ecommerce_stripe_enable",checked:Boolean(m.ecommerce_stripe_enable),onChange:function(e){return h("ecommerce_stripe_enable",e.target.checked)},label:(0,pe.__)("Enable Stripe","nggallery"),help:(0,pe.__)("Not all currencies are supported by all payment gateways. Please be sure to confirm your desired currency is supported by Stripe","nggallery")})),m.ecommerce_stripe_enable&&ee().createElement(ee().Fragment,null,ee().createElement("div",null,ee().createElement(uc,{type:"text",id:"ecommerce_stripe_key_public",name:"ecommerce_stripe_key_public",value:m.ecommerce_stripe_key_public,onChange:function(e){return h("ecommerce_stripe_key_public",e.target.value)},label:(0,pe.__)("Public key","nggallery")}),b.ecommerce_stripe_key_public&&ee().createElement("p",{className:"mt-1 text-xs text-red-600"},b.ecommerce_stripe_key_public)),ee().createElement("div",null,ee().createElement(uc,{type:"password",id:"ecommerce_stripe_key_private",name:"ecommerce_stripe_key_private",value:m.ecommerce_stripe_key_private,onChange:function(e){return h("ecommerce_stripe_key_private",e.target.value)},label:(0,pe.__)("Private key","nggallery")}),b.ecommerce_stripe_key_private&&ee().createElement("p",{className:"mt-1 text-xs text-red-600"},b.ecommerce_stripe_key_private))))),ee().createElement("hr",{className:"my-6"}),ee().createElement("div",{className:"mb-8"},ee().createElement("h3",{className:"text-lg font-semibold text-gray-900 mb-4"},(0,pe.__)("PayPal Checkout","nggallery")),ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6"},ee().createElement("div",{className:"md:col-span-2"},ee().createElement(fs,{id:"ecommerce_paypal_checkout_enable",name:"ecommerce_paypal_checkout_enable",checked:Boolean(m.ecommerce_paypal_checkout_enable),onChange:function(e){return h("ecommerce_paypal_checkout_enable",e.target.checked)},label:(0,pe.__)("Enable PayPal Checkout","nggallery"),help:(0,pe.__)("Not all currencies are supported by all payment gateways. Please be sure to confirm your desired currency is supported by PayPal Checkout","nggallery")})),m.ecommerce_paypal_checkout_enable&&ee().createElement(ee().Fragment,null,ee().createElement("div",null,ee().createElement(fs,{id:"ecommerce_paypal_checkout_sandbox",name:"ecommerce_paypal_checkout_sandbox",checked:Boolean(m.ecommerce_paypal_checkout_sandbox),onChange:function(e){return h("ecommerce_paypal_checkout_sandbox",e.target.checked)},label:(0,pe.__)("Use Sandbox","nggallery")})),ee().createElement("div",null,ee().createElement(uc,{type:"text",id:"ecommerce_paypal_checkout_client_id",name:"ecommerce_paypal_checkout_client_id",value:m.ecommerce_paypal_checkout_client_id,onChange:function(e){return h("ecommerce_paypal_checkout_client_id",e.target.value)},label:(0,pe.__)("Client ID","nggallery")}),b.ecommerce_paypal_checkout_client_id&&ee().createElement("p",{className:"mt-1 text-xs text-red-600"},b.ecommerce_paypal_checkout_client_id)),ee().createElement("div",null,ee().createElement(uc,{type:"password",id:"ecommerce_paypal_checkout_client_secret",name:"ecommerce_paypal_checkout_client_secret",value:m.ecommerce_paypal_checkout_client_secret,onChange:function(e){return h("ecommerce_paypal_checkout_client_secret",e.target.value)},label:(0,pe.__)("Client secret","nggallery")}),b.ecommerce_paypal_checkout_client_secret&&ee().createElement("p",{className:"mt-1 text-xs text-red-600"},b.ecommerce_paypal_checkout_client_secret)),ee().createElement("div",{className:"md:col-span-2 text-sm text-gray-600"},ee().createElement("a",{href:"https://www.imagely.com/docs/how-to-setup-paypal-checkout/?utm_source=imagely&utm_medium=ecommerce&utm_campaign=paypalcheckout".concat(t?"&utm_content="+encodeURIComponent(t):""),target:"_blank",rel:"noreferrer",className:"text-green-700 hover:underline"},(0,pe.__)("See our documentation on setting up PayPal Checkout.","nggallery")))))),ee().createElement("hr",{className:"my-6"}),ee().createElement("div",null,ee().createElement("h3",{className:"text-lg font-semibold text-gray-900 mb-4"},(0,pe.__)("Braintree","nggallery")),ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6"},ee().createElement("div",{className:"md:col-span-2"},ee().createElement(fs,{id:"ecommerce_braintree_enable",name:"ecommerce_braintree_enable",checked:Boolean(m.ecommerce_braintree_enable),onChange:function(e){return h("ecommerce_braintree_enable",e.target.checked)},label:(0,pe.__)("Enable Braintree","nggallery"),help:(0,pe.__)("Not all currencies are supported by all payment gateways. Please be sure to confirm your desired currency is supported by Braintree","nggallery")})),m.ecommerce_braintree_enable&&ee().createElement(ee().Fragment,null,ee().createElement("div",null,ee().createElement(fs,{id:"ecommerce_braintree_sandbox",name:"ecommerce_braintree_sandbox",checked:Boolean(m.ecommerce_braintree_sandbox),onChange:function(e){return h("ecommerce_braintree_sandbox",e.target.checked)},label:(0,pe.__)("Use Sandbox","nggallery")})),ee().createElement("div",null,ee().createElement(uc,{type:"text",id:"ecommerce_braintree_merchant_id",name:"ecommerce_braintree_merchant_id",value:m.ecommerce_braintree_merchant_id,onChange:function(e){return h("ecommerce_braintree_merchant_id",e.target.value)},label:(0,pe.__)("Merchant ID","nggallery")}),b.ecommerce_braintree_merchant_id&&ee().createElement("p",{className:"mt-1 text-xs text-red-600"},b.ecommerce_braintree_merchant_id)),ee().createElement("div",null,ee().createElement(uc,{type:"text",id:"ecommerce_braintree_public_key",name:"ecommerce_braintree_public_key",value:m.ecommerce_braintree_public_key,onChange:function(e){return h("ecommerce_braintree_public_key",e.target.value)},label:(0,pe.__)("Public key","nggallery")}),b.ecommerce_braintree_public_key&&ee().createElement("p",{className:"mt-1 text-xs text-red-600"},b.ecommerce_braintree_public_key)),ee().createElement("div",null,ee().createElement(uc,{type:"password",id:"ecommerce_braintree_private_key",name:"ecommerce_braintree_private_key",value:m.ecommerce_braintree_private_key,onChange:function(e){return h("ecommerce_braintree_private_key",e.target.value)},label:(0,pe.__)("Private key","nggallery")}),b.ecommerce_braintree_private_key&&ee().createElement("p",{className:"mt-1 text-xs text-red-600"},b.ecommerce_braintree_private_key)),ee().createElement("div",null,ee().createElement(fs,{id:"ecommerce_braintree_enable_paypal",name:"ecommerce_braintree_enable_paypal",checked:Boolean(m.ecommerce_braintree_enable_paypal),onChange:function(e){return h("ecommerce_braintree_enable_paypal",e.target.checked)},label:(0,pe.__)("Enable PayPal payments","nggallery"),help:(0,pe.__)("PayPal is not enabled by default and must be configured first in your Braintree account.","nggallery")})),ee().createElement("div",null,ee().createElement(fs,{id:"ecommerce_braintree_pass_client_data",name:"ecommerce_braintree_pass_client_data",checked:Boolean(m.ecommerce_braintree_pass_client_data),onChange:function(e){return h("ecommerce_braintree_pass_client_data",e.target.checked)},label:(0,pe.__)("Send browser data to Braintree","nggallery"),help:(0,pe.__)("Braintree recommends that transactions include customer browser data for their fraud detection tools. Consult the Braintree Data Protection Addendum for more information regarding your own data protection compliance.","nggallery")})),ee().createElement("div",{className:"md:col-span-2 text-sm text-gray-600"},ee().createElement("a",{href:"https://www.imagely.com/docs/how-to-setup-braintree-checkout/?utm_source=imagely&utm_medium=ecommerce&utm_campaign=braintree".concat(t?"&utm_content="+encodeURIComponent(t):""),target:"_blank",rel:"noreferrer",className:"text-green-700 hover:underline"},(0,pe.__)("See our documentation on setting up Braintree.","nggallery")))))))};function ob(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return lb(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(lb(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,lb(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,lb(m,"constructor",s),lb(s,"constructor",c),c.displayName="GeneratorFunction",lb(s,a,"GeneratorFunction"),lb(m),lb(m,a,"Generator"),lb(m,r,function(){return this}),lb(m,"toString",function(){return"[object Generator]"}),(ob=function(){return{w:o,m:d}})()}function lb(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}lb=function(e,t,n,r){function o(t,n){lb(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},lb(e,t,n,r)}var ib=function(){return new Promise(function(e,t){if(window.Stripe)e();else{var n=document.createElement("script");n.src="https://js.stripe.com/v3/",n.async=!0,n.onload=function(){return e()},n.onerror=function(){return t(new Error("Failed to load Stripe.js"))},document.body.appendChild(n)}})};const cb=function(){var e,t=$o(),n=t.showSuccess,r=t.showError,a=re(),o=vo((0,$.useState)(!0),2),l=o[0],i=o[1],c=vo((0,$.useState)(!1),2),s=c[0],u=c[1],m=vo((0,$.useState)(!1),2),d=m[0],g=m[1],p=vo((0,$.useState)(!1),2),f=p[0],y=p[1],h=vo((0,$.useState)((e=window.location.hostname).includes("localhost")||e.includes("host.docker.internal")),1)[0],b=vo((0,$.useState)("https:"===window.location.protocol),1)[0],v=(0,$.useRef)(null),_=(0,$.useRef)(null);(0,$.useEffect)(function(){var e=!0;return No(ob().m(function t(){var n,r,a;return ob().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,Oo()({path:"/nggpro/v1/commerce/admin/check_commerce_requirements",method:"GET",headers:{"X-WP-Nonce":null===(n=window.imagelyApp)||void 0===n?void 0:n.nonce}});case 1:if(a=t.v,e){t.n=2;break}return t.a(2);case 2:u(Boolean(null===(r=a.status)||void 0===r?void 0:r.card_on_file)),t.n=4;break;case 3:t.p=3,t.v;case 4:return t.p=4,e&&i(!1),t.f(4);case 5:return t.a(2)}},t,null,[[0,3,4,5]])}))(),function(){e=!1}},[]);var w=(0,$.useCallback)(No(ob().m(function e(){var t,n,r;return ob().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,ib();case 1:v.current||(t=h?"pk_test_MTNtYD9qsldURz7OzkYOOxKa":"pk_live_yRBibCwDB4gh97T758I4VRYy",v.current=window.Stripe(t)),_.current||(n=v.current.elements(),_.current=n.create("card",{hidePostalCode:!0}),(r=document.getElementById("ngg-stripe-card-element"))&&_.current.mount(r));case 2:return e.a(2)}},e)})),[h]),x=function(){var e=No(ob().m(function e(){var t;return ob().w(function(e){for(;;)switch(e.p=e.n){case 0:return g(!0),e.p=1,e.n=2,w();case 2:e.n=4;break;case 3:e.p=3,t=e.v,console.error("handleConnectClick error",t),r((0,pe.__)("Failed to load Stripe","nggallery"));case 4:return e.a(2)}},e,null,[[1,3]])}));return function(){return e.apply(this,arguments)}}(),E=function(){var e=No(ob().m(function e(){var t;return ob().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,Oo()({path:"/nggpro/v1/commerce/admin/delete_credit_card_info",method:"POST",headers:{"X-WP-Nonce":null===(t=window.imagelyApp)||void 0===t?void 0:t.nonce,"Content-Type":"application/json"}});case 1:u(!1),a.invalidateQueries({queryKey:["printlabRequirements"]}),n((0,pe.__)("Card removed","nggallery")),e.n=3;break;case 2:e.p=2,e.v,r((0,pe.__)("Failed to remove card","nggallery"));case 3:return e.a(2)}},e,null,[[0,2]])}));return function(){return e.apply(this,arguments)}}(),C=function(){var e=No(ob().m(function e(){var t,o,l,i,c,s,m,d,p,f,b,w;return ob().w(function(e){for(;;)switch(e.p=e.n){case 0:if(v.current&&_.current){e.n=1;break}return e.a(2);case 1:return y(!0),e.p=2,o=v.current,e.n=3,o.createPaymentMethod({type:"card",card:_.current});case 3:if(l=e.v,i=l.paymentMethod,!(c=l.error)&&i){e.n=4;break}throw c||new Error("payment_method_error");case 4:return s={testing:h,site_url:window.location.origin,return_url:window.location.origin+"?stripe_intents_rtn=1",payment_method_id:i.id},e.n=5,fetch("https://4osfgn6rvj.execute-api.us-east-1.amazonaws.com/latest/getSetupIntentSecret",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)}).then(function(e){return e.json()});case 5:if(m=e.v,d="",p=i.id,"succeeded"!==m.status){e.n=6;break}d=m.id,e.n=10;break;case 6:if(!m.client_secret){e.n=9;break}return e.n=7,o.confirmCardSetup(m.client_secret,{payment_method:i.id});case 7:if(!(b=e.v).error){e.n=8;break}throw b.error;case 8:d=(null===(f=b.setupIntent)||void 0===f?void 0:f.id)||"",e.n=10;break;case 9:throw new Error("invalid_setup_intent_response");case 10:return console.warn("setupIntentId",d),e.n=11,Oo()({path:"/nggpro/v1/commerce/admin/update_credit_card_info",method:"POST",headers:{"X-WP-Nonce":null===(t=window.imagelyApp)||void 0===t?void 0:t.nonce,"Content-Type":"application/json"},data:{testing:h,payment_method:p}});case 11:u(!0),g(!1),a.invalidateQueries({queryKey:["printlabRequirements"]}),n((0,pe.__)("Card connected successfully","nggallery")),e.n=13;break;case 12:e.p=12,w=e.v,console.error("handleSubmitCard error",w),r((0,pe.__)("Failed to connect card","nggallery"));case 13:return e.p=13,y(!1),e.f(13);case 14:return e.a(2)}},e,null,[[2,12,13,14]])}));return function(){return e.apply(this,arguments)}}();return l?ee().createElement(oo,{size:"md",text:(0,pe.__)("Loading...","nggallery")}):ee().createElement("div",{className:"bg-white rounded-lg shadow-sm p-6"},ee().createElement("div",{className:"mb-6"},ee().createElement("h2",{className:"text-xl font-semibold text-gray-900 mb-2"},(0,pe.__)("PrintLab Integration","nggallery")),ee().createElement("p",{className:"text-gray-600 text-sm"},(0,pe.__)("Configure integration with PrintLab for professional print fulfillment.","nggallery"))),!b&&ee().createElement("div",{className:"mb-4 p-3 rounded bg-yellow-50 text-yellow-800 text-sm"},(0,pe.__)("IMPORTANT: Your site is not using SSL/HTTPS. Please add SSL/HTTPS and return to this tab to add your credit card.","nggallery")),ee().createElement("div",{className:"mt-6"},s?ee().createElement("div",{className:"flex items-center justify-between bg-green-50 border border-green-200 rounded p-4"},ee().createElement("span",{className:"text-green-800 text-sm"},(0,pe.__)("Done! You have a valid credit card on file.","nggallery")),ee().createElement("button",{onClick:E,className:"px-3 py-1.5 text-sm rounded bg-red-600 text-white hover:bg-red-700"},(0,pe.__)("Remove card","nggallery"))):ee().createElement("div",null,d?ee().createElement("div",{className:"mt-4 space-y-4"},ee().createElement("div",{id:"ngg-stripe-card-element",className:"border rounded p-3"}),ee().createElement("div",{id:"card-errors",className:"text-red-600 text-xs"}),ee().createElement("div",{className:"flex gap-2"},ee().createElement("button",{onClick:function(){return g(!1)},className:"px-4 py-2 text-sm rounded bg-gray-100 hover:bg-gray-200",disabled:f},(0,pe.__)("Cancel","nggallery")),ee().createElement("button",{onClick:C,className:"px-4 py-2 text-sm rounded bg-green-500 text-white hover:bg-green-600 disabled:opacity-60",disabled:f},f?(0,pe.__)("Saving...","nggallery"):(0,pe.__)("Save Card","nggallery")))):ee().createElement("button",{onClick:x,className:"px-4 py-2 text-sm rounded bg-green-500 text-white hover:bg-green-600"},(0,pe.__)("Update credit card","nggallery")))),ee().createElement("div",{className:"mt-8"},ee().createElement("h3",{className:"text-sm font-semibold text-gray-900 mb-3"},(0,pe.__)("FAQs","nggallery")),ee().createElement("div",{className:"space-y-3 text-sm text-gray-700"},ee().createElement(nf,{title:(0,pe.__)("Do I need this?","nggallery")},ee().createElement("p",{className:"leading-6"},(0,pe.__)("A credit card is needed only if you want to use automated print fulfillment.","nggallery"))),ee().createElement(nf,{title:(0,pe.__)("Will you charge me?","nggallery")},ee().createElement("p",{className:"leading-6"},(0,pe.__)("You will not be charged now. Your card will only be charged if someone submits a print lab order on your site. At that point, you will be billed for print and shipping costs from the print lab.","nggallery"))),ee().createElement(nf,{title:(0,pe.__)("Is this secure?","nggallery")},ee().createElement("p",{className:"leading-6"},(0,pe.__)("This form sends your card information directly to Stripe and is stored securely at Stripe, not by WordPress or NextGEN Gallery.","nggallery"))))))};function sb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ub(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?sb(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):sb(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}const mb=function(){var e,t,r=gi(),a=r.data,o=r.isLoading,i=pi(),c=re(),s=function(){var e=vo((0,$.useState)(null),2),t=e[0],n=e[1],r=vo((0,$.useState)(null),2),a=r[0],o=r[1],i=vo((0,$.useState)(!0),2),c=i[0],s=i[1];return(0,$.useEffect)(function(){s(!0),o(null);try{return void l.e(957).then(l.t.bind(l,957,19)).then(function(e){var t=(null==e?void 0:e.default)||e;n(t)}).catch(function(e){o((null==e?void 0:e.message)||"Failed to load countries")}).finally(function(){return s(!1)})}catch(e){o((null==e?void 0:e.message)||"Failed to load countries")}s(!1)},[]),{countries:(0,$.useMemo)(function(){return t?t.map(function(e){var t=vo(e,3);return{name:t[0],code:t[1],regions:(t[2]||[]).map(function(e){var t=vo(e,2);return{name:t[0],code:t[1]}})}}):[]},[t]),isLoading:c,error:a}}(),u=s.countries,m=s.isLoading,d=Yi(),g=d.data,p=d.isLoading,f=sl({queryKey:Xi.countries,queryFn:(t=No(Vi().m(function e(){var t,n,r;return Vi().w(function(e){for(;;)switch(e.n){case 0:return n=null===(t=window.imagelyApp)||void 0===t?void 0:t.nonce,e.n=1,Oo()({path:"/imagely/v1/countries",method:"GET",headers:{"X-WP-Nonce":n}});case 1:if((r=e.v).success){e.n=2;break}throw new Error("Failed to fetch countries");case 2:return e.a(2,r.data)}},e)})),function(){return t.apply(this,arguments)}),staleTime:18e5,gcTime:36e5}),y=f.data,h=f.isLoading,b=(0,$.useMemo)(function(){var e,t;return a?{ecommerce_studio_name:a.ecommerce_studio_name||"",ecommerce_studio_email:a.ecommerce_studio_email||"",ecommerce_studio_street_address:a.ecommerce_studio_street_address||"",ecommerce_studio_address_line:a.ecommerce_studio_address_line||"",ecommerce_studio_city:a.ecommerce_studio_city||"",ecommerce_home_country:null!==(e=a.ecommerce_home_country)&&void 0!==e?e:840,ecommerce_home_state:a.ecommerce_home_state||"",ecommerce_home_zip:a.ecommerce_home_zip||"",ecommerce_currency:null!==(t=a.ecommerce_currency)&&void 0!==t?t:840}:null},[a]),v=vo((0,$.useState)(null),2),_=v[0],w=v[1];(0,$.useEffect)(function(){b&&!_&&w(b)},[b,_]);var x=Wh({settings:_,tabId:"ecommerce-studio-details",mutation:{mutate:function(e,t){var n=ub({},e||{});i.mutate(n,ub(ub({},t),{},{onSuccess:function(){for(var e,n,r=arguments.length,a=new Array(r),o=0;o<r;o++)a[o]=arguments[o];null==t||null===(e=(n=t).onSuccess)||void 0===e||e.call.apply(e,[n].concat(a)),c.invalidateQueries({queryKey:["printlabRequirements"]})}}))},isPending:i.isPending},getMutationParams:function(e){return e||{}},debounceDelay:1e3}),E=x.markUserInteraction;if(o||!_||m||p||h)return ee().createElement(oo,{size:"md",text:(0,pe.__)("Loading settings...","nggallery")});var C,N,k,S=function(e,t){w(function(r){if(!r)return r;var a=ub(ub({},r),{},n({},e,t));if("ecommerce_home_country"===e&&y){var o=y.find(function(e){return e.code===t});o&&(a.ecommerce_currency=o.currency_code),a.ecommerce_home_state=""}return a}),E()},O=function(){return"string"==typeof _.ecommerce_home_country?_.ecommerce_home_country:""};return ee().createElement("div",{className:"bg-white rounded-lg shadow-sm p-6"},ee().createElement("div",{className:"mb-6"},ee().createElement("h2",{className:"text-xl font-semibold text-gray-900 mb-2"},(0,pe.__)("Studio Details","nggallery")),ee().createElement("p",{className:"text-gray-600 text-sm"},(0,pe.__)("Configure your studio information and business details.","nggallery"))),ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6"},ee().createElement("div",null,ee().createElement(uc,{type:"text",id:"ecommerce_studio_name",name:"ecommerce_studio_name",value:_.ecommerce_studio_name,onChange:function(e){return S("ecommerce_studio_name",e.target.value)},label:(0,pe.__)("Studio Name","nggallery")})),ee().createElement("div",null,ee().createElement(uc,{type:"text",id:"ecommerce_studio_email",name:"ecommerce_studio_email",value:_.ecommerce_studio_email,onChange:function(e){return S("ecommerce_studio_email",e.target.value)},label:(0,pe.__)("Studio Email","nggallery")})),ee().createElement("div",null,ee().createElement(uc,{type:"text",id:"ecommerce_studio_street_address",name:"ecommerce_studio_street_address",value:_.ecommerce_studio_street_address,onChange:function(e){return S("ecommerce_studio_street_address",e.target.value)},label:(0,pe.__)("Studio Street Address","nggallery")})),ee().createElement("div",null,ee().createElement(uc,{type:"text",id:"ecommerce_studio_address_line",name:"ecommerce_studio_address_line",value:_.ecommerce_studio_address_line,onChange:function(e){return S("ecommerce_studio_address_line",e.target.value)},label:(0,pe.__)("Studio Address Line #2","nggallery")})),ee().createElement("div",null,ee().createElement(uc,{type:"text",id:"ecommerce_studio_city",name:"ecommerce_studio_city",value:_.ecommerce_studio_city,onChange:function(e){return S("ecommerce_studio_city",e.target.value)},label:(0,pe.__)("Studio City","nggallery")})),ee().createElement("div",null,ee().createElement(sc,{id:"ecommerce_home_country",name:"ecommerce_home_country",value:O(),onChange:function(e){S("ecommerce_home_country",e.target.value)},label:(0,pe.__)("Studio Country","nggallery")},ee().createElement("option",{value:""},(0,pe.__)("Select Country","nggallery")),u.map(function(e){return ee().createElement("option",{key:e.code,value:e.code},e.name)}))),ee().createElement("div",null,(C=O(),(k=(null==(N=u.find(function(e){return e.code===C}))?void 0:N.regions)||[]).length>0?ee().createElement(sc,{id:"ecommerce_home_state",name:"ecommerce_home_state",value:_.ecommerce_home_state,onChange:function(e){return S("ecommerce_home_state",e.target.value)},label:(0,pe.__)("Studio State","nggallery")},ee().createElement("option",{value:""},(0,pe.__)("Select Region","nggallery")),k.map(function(e){return ee().createElement("option",{key:e.code,value:e.code},e.name)})):ee().createElement(uc,{type:"text",id:"ecommerce_home_state",name:"ecommerce_home_state",value:_.ecommerce_home_state,onChange:function(e){return S("ecommerce_home_state",e.target.value)},label:(0,pe.__)("Studio State","nggallery")}))),ee().createElement("div",null,ee().createElement(uc,{type:"text",id:"ecommerce_home_zip",name:"ecommerce_home_zip",value:_.ecommerce_home_zip,onChange:function(e){return S("ecommerce_home_zip",e.target.value)},label:(0,pe.__)("Studio Postal Code","nggallery"),help:(0,pe.__)("Required for taxes","nggallery")})),ee().createElement("div",null,ee().createElement(sc,{id:"ecommerce_currency",name:"ecommerce_currency",value:String(null!==(e=_.ecommerce_currency)&&void 0!==e?e:""),onChange:function(e){return S("ecommerce_currency",e.target.value)},label:(0,pe.__)("Currency","nggallery")},ee().createElement("option",{value:""},(0,pe.__)("Select Currency","nggallery")),null==g?void 0:g.map(function(e){return ee().createElement("option",{key:e.id,value:e.id},e.code," - ",e.name)})))))};function db(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return gb(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(gb(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,gb(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,gb(m,"constructor",s),gb(s,"constructor",c),c.displayName="GeneratorFunction",gb(s,a,"GeneratorFunction"),gb(m),gb(m,a,"Generator"),gb(m,r,function(){return this}),gb(m,"toString",function(){return"[object Generator]"}),(db=function(){return{w:o,m:d}})()}function gb(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}gb=function(e,t,n,r){function o(t,n){gb(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},gb(e,t,n,r)}function pb(e){var t=null==e?void 0:e.cart,n=void 0;if(t)if("string"==typeof t)try{n=JSON.parse(t)}catch(e){n=t}else n=t;return{id:Number((null==e?void 0:e.id)||(null==e?void 0:e.ID)),customer_name:String((null==e?void 0:e.customer_name)||""),email:String((null==e?void 0:e.email)||""),phone:(null==e?void 0:e.phone)||void 0,status:(null==e?void 0:e.status)||"unpaid",payment_gateway:String((null==e?void 0:e.payment_gateway)||""),coupon_code:(null==e?void 0:e.coupon_code)||void 0,total_amount:Number((null==e?void 0:e.total_amount)||0),print_cost:null!=e&&e.print_cost?Number(e.print_cost):void 0,hash:String((null==e?void 0:e.hash)||""),date:String((null==e?void 0:e.date)||(null==e?void 0:e.post_date)||""),post_date:String((null==e?void 0:e.post_date)||""),gateway_admin_note:(null==e?void 0:e.gateway_admin_note)||void 0,shipping_street_address:(null==e?void 0:e.shipping_street_address)||void 0,shipping_address_line:(null==e?void 0:e.shipping_address_line)||void 0,shipping_city:(null==e?void 0:e.shipping_city)||void 0,shipping_state:(null==e?void 0:e.shipping_state)||void 0,shipping_zip:(null==e?void 0:e.shipping_zip)||void 0,shipping_country:(null==e?void 0:e.shipping_country)||void 0,shipping_phone:(null==e?void 0:e.shipping_phone)||void 0,aws_order_id:(null==e?void 0:e.aws_order_id)||void 0,has_sent_email_notification:null==e?void 0:e.has_sent_email_notification,has_sent_email_receipt:null==e?void 0:e.has_sent_email_receipt,cart:n}}var fb=function(e){return["orders",e]},yb=function(e){return["order",e]};function hb(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return bb(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(bb(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,bb(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,bb(m,"constructor",s),bb(s,"constructor",c),c.displayName="GeneratorFunction",bb(s,a,"GeneratorFunction"),bb(m),bb(m,a,"Generator"),bb(m,r,function(){return this}),bb(m,"toString",function(){return"[object Generator]"}),(hb=function(){return{w:o,m:d}})()}function bb(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}bb=function(e,t,n,r){function o(t,n){bb(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},bb(e,t,n,r)}function vb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _b(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?vb(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):vb(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var wb=function(e,t){if(!e)return"$";if(null==t||""===t)return"$";var n=String(t).toUpperCase(),r=e.find(function(e){return String(e.id)===n||String(e.code).toUpperCase()===n});return null!=r&&r.symbol?Ji(r.symbol):(null==r?void 0:r.code)||"$"},xb=function(e){var t,n,r=null===(t=window.imagelyApp)||void 0===t?void 0:t.ecommerce_thank_you_url;if(r){var a=new URL(r,window.location.origin);return a.searchParams.set("order",e),a.toString()}var o=(null===(n=window.imagelyApp)||void 0===n?void 0:n.home_url)||window.location.origin,l=o.endsWith("/")?o:"".concat(o,"/");return new URL("thanks/?order=".concat(encodeURIComponent(e)),l).toString()};function Eb(e){var t,n,r,a,o,l=e.orderId,i=e.onBack,c=sl({queryKey:(a=l)?yb(a):["order","none"],enabled:!!a,queryFn:(o=No(db().m(function e(){var t,n,r;return db().w(function(e){for(;;)switch(e.n){case 0:return n=null===(t=window.imagelyApp)||void 0===t?void 0:t.nonce,e.n=1,Oo()({path:"/imagely/v1/orders/".concat(a),method:"GET",headers:{"X-WP-Nonce":n}});case 1:return r=e.v,e.a(2,pb(r))}},e)})),function(){return o.apply(this,arguments)}),staleTime:0,gcTime:6e5,retry:0,refetchOnMount:!0,refetchOnWindowFocus:!1}),s=c.data,u=c.isLoading,m=Yi().data,d=Cs().navigateTo,g=function(e){var t=e.thumbUrl,n=e.fullWidth,r=e.fullHeight,a=e.cropOffset,o=e.width,l=e.height,i=e.alt,c=void 0===i?"thumb":i,s=null;if(a&&Number(n)>0&&Number(r)>0){var u=String(a).split(",").map(function(e){return parseInt(e.trim(),10)});if(u.length>=4&&u.every(function(e){return Number.isFinite(e)})){var m=vo(u,4),d=m[0],g=m[1],p=m[2],f=m[3],y=o/Number(n),h=l/Number(r),b=d*y,v=g*h,_=Math.ceil((p-d)*y),w=Math.ceil((f-g)*h);s={left:b,top:v+=2,width:_=Math.max(0,_-4),height:w=Math.max(0,w-4)}}}return ee().createElement("div",{className:"relative",style:{width:o,height:l}},t?ee().createElement("img",{src:t,alt:c,style:{width:"100%",height:"100%",objectFit:"cover"},className:"rounded"}):ee().createElement("div",{className:"w-full h-full bg-gray-100 rounded"}),s&&ee().createElement("div",{className:"absolute border-2 border-amber-500 rounded pointer-events-none",style:{left:s.left,top:s.top,width:s.width,height:s.height}}))},p=(null==s?void 0:s.cart)||{},f=null!=p&&p.images?Object.values(p.images):[],y=f.some(function(e){return Object.values((null==e?void 0:e.items)||{}).some(function(e){return"ngg_digital_downloads"===(null==e?void 0:e.source)})}),h=function(e){if("number"==typeof e)return e;if("string"==typeof e){var t=parseFloat(e);return isNaN(t)?0:t}return 0},b=wb(m,(null==p?void 0:p.currency)||(null==p||null===(t=p.tax_info)||void 0===t?void 0:t.currency_code)),v=function(e){return"".concat(b," ").concat(e.toFixed(2))},_=f.flatMap(function(e){var t,n,r,a,o,l=(null==e||null===(t=e.thumbnail)||void 0===t?void 0:t.filename)||(null==e?void 0:e.thumbnail_url)||"",i=Number(null==e||null===(n=e.crop_dimensions)||void 0===n?void 0:n.width)||void 0,c=Number(null==e||null===(r=e.crop_dimensions)||void 0===r?void 0:r.height)||void 0,s=Math.max(1,Number(null==e||null===(a=e.dimensions)||void 0===a?void 0:a.width)||120),u=Math.max(1,Number(null==e||null===(o=e.dimensions)||void 0===o?void 0:o.height)||120),m=Math.max(s,u),d=Math.min(1,120/m),g=Math.round(s*d),p=Math.round(u*d),f=Object.values((null==e?void 0:e.items)||{}),y=(null==e?void 0:e.filename)||"",b=(null==e?void 0:e.image_slug)||"",v=(null==e?void 0:e.galleryid)||(null==e?void 0:e.pid)||null;return f.map(function(t){return{key:"".concat((null==e?void 0:e.pid)||(null==e?void 0:e.id)||"img","-").concat((null==t?void 0:t.ID)||(null==t?void 0:t.id)||Math.random()),thumb:l,qty:h(null==t?void 0:t.quantity)||1,desc:(null==t?void 0:t.post_title)||(null==t?void 0:t.title)||(0,pe.__)("Item","nggallery"),unit:h(null==t?void 0:t.price),total:h(null==t?void 0:t.price)*(h(null==t?void 0:t.quantity)||1),cropOffset:(null==t?void 0:t.crop_offset)||void 0,fullW:i,fullH:c,dispW:g,dispH:p,filename:y,imageSlug:b,galleryId:v}})}),w=h(null==p?void 0:p.subtotal),x=h(null==p?void 0:p.undiscounted_subtotal),E=w>0?w:_.reduce(function(e,t){return e+t.total},0),C=x>0?x:E,N=Math.max(0,C-E),k=h(null==p?void 0:p.shipping),S=h(null!==(n=null==p||null===(r=p.tax_info)||void 0===r?void 0:r.amount_to_collect)&&void 0!==n?n:null==p?void 0:p.tax),O=h(null==p?void 0:p.total)||E+k+S,P=(null==s?void 0:s.gateway_admin_note)||"";return ee().createElement("div",{className:"bg-white rounded-lg border p-4"},ee().createElement("div",{className:"flex items-center justify-between mb-4"},ee().createElement("button",{className:"border rounded px-4 py-2 cursor-pointer bg-white hover:bg-gray-50",onClick:i},(0,pe.__)("Back to Orders","nggallery")),ee().createElement("div",{className:"text-sm text-gray-500"},(null==s?void 0:s.date)||"")),u||!s?ee().createElement("div",{className:"py-6 text-center text-gray-500"},(0,pe.__)("Loading...","nggallery")):ee().createElement(ee().Fragment,null,ee().createElement("h3",{className:"text-lg font-semibold text-gray-900 mb-2"},(0,pe.__)("Order","nggallery")," #",s.id),ee().createElement("div",{className:"mb-3"},function(e){switch(e){case"paid":return ee().createElement("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-green-100 text-green-700"},(0,pe.__)("Paid","nggallery"));case"unpaid":return ee().createElement("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-amber-100 text-amber-800"},(0,pe.__)("Unpaid","nggallery"));case"awaiting_payment":return ee().createElement("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-amber-100 text-amber-800"},(0,pe.__)("Awaiting Payment","nggallery"));case"failed":return ee().createElement("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-red-100 text-red-700"},(0,pe.__)("Failed","nggallery"));case"fraud":return ee().createElement("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-red-100 text-red-700"},(0,pe.__)("Fraud","nggallery"));default:return ee().createElement("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-700"},e)}}(s.status)),ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4"},ee().createElement("div",{className:"p-4 border rounded-md"},ee().createElement("h4",{className:"text-sm font-semibold text-gray-900 mb-2"},(0,pe.__)("Customer","nggallery")),ee().createElement("div",{className:"text-sm text-gray-700"},s.customer_name),ee().createElement("div",{className:"text-xs text-gray-500"},s.email),s.phone&&ee().createElement("div",{className:"text-xs text-gray-500"},s.phone)),ee().createElement("div",{className:"p-4 border rounded-md"},ee().createElement("h4",{className:"text-sm font-semibold text-gray-900 mb-2"},(0,pe.__)("Shipping","nggallery")),ee().createElement("div",{className:"text-sm text-gray-700 whitespace-pre-line"},[s.shipping_street_address,s.shipping_address_line,"".concat(s.shipping_city||""," ").concat(s.shipping_state||""," ").concat(s.shipping_zip||""),s.shipping_country].filter(Boolean).join("\n")),s.shipping_phone&&ee().createElement("div",{className:"text-xs text-gray-500"},s.shipping_phone))),ee().createElement("div",{className:"p-4 border rounded-md mt-4"},ee().createElement("h4",{className:"text-sm font-semibold text-gray-900 mb-3"},(0,pe.__)("Purchases","nggallery")),ee().createElement("div",{className:"overflow-x-auto"},ee().createElement("table",{className:"min-w-full text-sm table-fixed"},ee().createElement("colgroup",null,ee().createElement("col",{style:{width:"20%"}}),ee().createElement("col",{style:{width:"20%"}}),ee().createElement("col",{style:{width:"20%"}}),ee().createElement("col",{style:{width:"20%"}}),ee().createElement("col",{style:{width:"20%"}})),ee().createElement("thead",null,ee().createElement("tr",{className:"text-left text-gray-600"},ee().createElement("th",{className:"px-2 py-1"},(0,pe.__)("Image","nggallery")),ee().createElement("th",{className:"px-2 py-1"},(0,pe.__)("Quantity","nggallery")),ee().createElement("th",{className:"px-2 py-1"},(0,pe.__)("Description","nggallery")),ee().createElement("th",{className:"px-2 py-1 text-right"},(0,pe.__)("Price","nggallery")),ee().createElement("th",{className:"px-2 py-1 text-right"},(0,pe.__)("Total","nggallery")))),ee().createElement("tbody",null,0===_.length&&ee().createElement("tr",null,ee().createElement("td",{colSpan:5,className:"px-2 py-4 text-center text-gray-500"},(0,pe.__)("No items","nggallery"))),_.map(function(e){return ee().createElement("tr",{key:e.key,className:"border-t"},ee().createElement("td",{className:"px-2 py-2 align-top"},ee().createElement("div",{className:"flex flex-col gap-1"},ee().createElement(g,{thumbUrl:e.thumb,fullWidth:e.fullW,fullHeight:e.fullH,cropOffset:e.cropOffset,width:e.dispW,height:e.dispH}),e.filename&&ee().createElement("div",{className:"text-xs text-gray-600"},ee().createElement("span",{className:"font-medium"},(0,pe.__)("File Name:","nggallery")," "),e.filename,ee().createElement("br",null),ee().createElement("span",{className:"text-gray-500"},e.imageSlug)),e.galleryId&&ee().createElement("button",{type:"button",onClick:function(){return d("imagely-add-new","images",e.galleryId)},className:"text-xs text-green-600 hover:text-green-700 hover:underline text-left"},(0,pe.__)("Manage gallery","nggallery")))),ee().createElement("td",{className:"px-2 py-2 align-top"},e.qty),ee().createElement("td",{className:"px-2 py-2 align-top text-gray-700"},e.desc),ee().createElement("td",{className:"px-2 py-2 align-top text-right"},v(e.unit)),ee().createElement("td",{className:"px-2 py-2 align-top text-right"},v(e.total)))}))))),ee().createElement("div",{className:"p-4 border rounded-md mt-4"},ee().createElement("h4",{className:"text-sm font-semibold text-gray-900 mb-3"},(0,pe.__)("Order Details","nggallery")),ee().createElement("div",{className:"space-y-1 text-sm text-gray-700"},ee().createElement("div",null,(0,pe.__)("Subtotal","nggallery"),": ",ee().createElement("span",{className:"font-medium"},v(E))),N>0&&ee().createElement("div",null,(0,pe.__)("Discount","nggallery"),":"," ",ee().createElement("span",{className:"font-medium"},v(N))),ee().createElement("div",null,(0,pe.__)("Shipping","nggallery"),": ",ee().createElement("span",{className:"font-medium"},v(k))),S>0&&ee().createElement("div",null,(0,pe.__)("Tax","nggallery"),": ",ee().createElement("span",{className:"font-medium"},v(S))),(null==s?void 0:s.print_cost)&&s.print_cost>0&&ee().createElement("div",null,(0,pe.__)("Print Cost","nggallery"),":"," ",ee().createElement("span",{className:"font-medium"},v(s.print_cost))),ee().createElement("div",null,(0,pe.__)("Total","nggallery"),": ",ee().createElement("span",{className:"font-semibold"},v(O))),P&&ee().createElement("div",null,(0,pe.__)("Printlab Status","nggallery"),":"," ",ee().createElement("span",{className:"font-medium"},P)))),y&&ee().createElement("div",{className:"p-4 border rounded-md mt-4"},ee().createElement("h4",{className:"text-sm font-semibold text-gray-900 mb-3"},(0,pe.__)("Digital Downloads","nggallery")),ee().createElement("div",{className:"text-sm text-gray-700"},(0,pe.__)("Download link for digital products:","nggallery")," ",ee().createElement("a",{href:xb(s.hash),target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700 hover:underline"},(0,pe.__)("here.","nggallery"))))))}const Cb=function(){(0,ge.useDispatch)(Br);var e,t,r,a,o=Yi().data,l=vo((0,$.useState)("all"),2),i=l[0],c=l[1],s=vo((0,$.useState)({id:!0,date:!0,customer:!0,orderStatus:!0,paymentGateway:!0,coupon:!0,total:!0}),1)[0],u=vo((0,$.useState)(new Set),2),m=u[0],d=u[1],g=vo((0,$.useState)(""),2),p=g[0],f=g[1],y=Cy(p,300),h=vo((0,$.useState)("date"),2),b=h[0],v=h[1],_=vo((0,$.useState)("desc"),2),w=_[0],x=_[1],E=vo((0,$.useState)(1),2),C=E[0],N=E[1],k=gi().data,S=(null==k?void 0:k.admin_table_per_page)||20,O=vo((0,$.useState)(!1),2),P=O[0],j=O[1],T=vo((0,$.useState)(!1),2),I=T[0],A=T[1],D=vo((0,$.useState)("all"),2),L=D[0],F=D[1],M=vo((0,$.useState)(!1),2),R=M[0],G=M[1],B=vo((0,$.useState)("bulk"),2),z=B[0],U=B[1],q=vo((0,$.useState)(!1),2),Q=q[0],W=q[1],H=vo((0,$.useState)([]),2),V=H[0],K=H[1],X=vo((0,$.useState)(!1),2),Y=X[0],Z=X[1],J=vo((0,$.useState)(null),2),te=J[0],ne=J[1],ae=Cs(),oe=ae.currentId,le=ae.setCurrentId,ie=b?{date:"date",id:"ID",customer:"customer_name",orderStatus:"status",paymentGateway:"payment_gateway",coupon:"coupon_code",total:"total_amount"}[b]||"date":void 0,ce=vo((0,$.useState)({}),2),se=ce[0],ue=ce[1],me=function(e){var t=e.orderHash,n=e.awsOrderId,r=e.resubmitted,a=e.onDone,o=vo((0,$.useState)(!1),2),l=o[0],i=o[1],c=$o(),s=c.showSuccess,u=c.showError;return!n||r?null:ee().createElement("button",{type:"button",className:"text-xs text-green-500 hover:underline disabled:opacity-50",disabled:l,onClick:No(hb().m(function e(){var n,r,o,l,c,m,d,g;return hb().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,i(!0),l=(null===(n=window.wpApiSettings)||void 0===n?void 0:n.nonce)||(null===(r=window.imagelyApp)||void 0===r?void 0:r.nonce),c=(null===(o=window.photocrati_ajax)||void 0===o?void 0:o.rest_url)||"/wp-json/",e.n=1,window.fetch("".concat(c,"nggpro/v1/commerce/admin/resubmit_lab_order"),{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":l},body:JSON.stringify({order:t}),credentials:"same-origin"});case 1:return m=e.v,e.n=2,m.json();case 2:null!=(d=e.v)&&d.success?(s((0,pe.__)("Order successfully resubmitted to lab","nggallery")),a&&a()):u((0,pe.__)("Failed to resubmit order to lab. Please try again.","nggallery")),e.n=4;break;case 3:e.p=3,g=e.v,console.error("Error resubmitting lab order:",g),u((0,pe.__)("An error occurred while resubmitting the order. Please try again.","nggallery"));case 4:return e.p=4,i(!1),e.f(4);case 5:return e.a(2)}},e,null,[[0,3,4,5]])}))},l?(0,pe.__)("Resubmitting...","nggallery"):(0,pe.__)("Resubmit to lab","nggallery"))},de=(t={page:C,per_page:S,search:y,sort:w?ie:void 0,order:w||void 0,status:i,date_filter:L},a=new URLSearchParams,null!=t&&t.page&&a.append("page",String(t.page)),null!=t&&t.per_page&&a.append("per_page",String(t.per_page)),null!=t&&t.search&&t.search.trim()&&a.append("search",t.search.trim()),null!=t&&t.sort&&a.append("sort",t.sort),null!=t&&t.order&&a.append("order",t.order),null!=t&&t.status&&a.append("status",t.status),null!=t&&t.date_filter&&a.append("date_filter",t.date_filter),sl({queryKey:fb(t||{}),queryFn:(r=No(db().m(function e(){var t,n,r,o,l,i;return db().w(function(e){for(;;)switch(e.n){case 0:return n=null===(t=window.imagelyApp)||void 0===t?void 0:t.nonce,r="/imagely/v1/orders".concat(a.toString()?"?".concat(a.toString()):""),e.n=1,Oo()({path:r,method:"GET",headers:{"X-WP-Nonce":n}});case 1:return o=e.v,l=((null==o?void 0:o.orders)||[]).map(pb),i=(null==o?void 0:o.pagination)||{total:l.length,total_pages:1,per_page:l.length,current:1},e.a(2,{orders:l,pagination:i})}},e)})),function(){return r.apply(this,arguments)}),staleTime:3e4,gcTime:6e5,retry:0,throwOnError:!1,refetchOnWindowFocus:!0,refetchOnMount:!1,placeholderData:function(e){return e}})),fe=de.data,ye=de.isLoading,he=function(){var e,t=re(),n=$o(),r=n.showSuccess,a=n.showError,o=n.showWarning;return gl({mutationFn:(e=No(db().m(function e(t){var n,r,a,o,l;return db().w(function(e){for(;;)switch(e.n){case 0:return r=t.ids,a=t.status,o=null===(n=window.imagelyApp)||void 0===n?void 0:n.nonce,e.n=1,Oo()({path:"/imagely/v1/orders/bulk-update-status",method:"POST",headers:{"X-WP-Nonce":o},data:{ids:r,status:a}});case 1:return l=e.v,e.a(2,l)}},e)})),function(t){return e.apply(this,arguments)}),onSuccess:function(e){var n;if(t.invalidateQueries({queryKey:["orders"]}),(null==e?void 0:e.updated_count)>0){var a=1===e.updated_count?"Order status updated successfully":"".concat(e.updated_count," orders updated successfully");r(a)}if((null==e||null===(n=e.errors)||void 0===n?void 0:n.length)>0){var l="Some orders failed to update: ".concat(e.errors.length," error(s)");o(l,{duration:8e3}),console.error("Order update errors:",e.errors)}},onError:function(e){var t=(null==e?void 0:e.message)||"Bulk update failed. Please try again.";a(t),console.error("Bulk update failed:",e)}})}(),be=$o(),ve=be.showSuccess,_e=be.showError;(0,$.useEffect)(function(){N(1)},[y,i,L,b,w]),(0,$.useEffect)(function(){d(new Set),U("bulk"),G(!1)},[y,i,L,b,w]),(0,$.useEffect)(function(){var e,t=(null==fe||null===(e=fe.pagination)||void 0===e?void 0:e.total_pages)||1;t>0&&C>t&&N(t)},[null==fe||null===(e=fe.pagination)||void 0===e?void 0:e.total_pages]);var we=function(e){if(!e)return"";var t=new Date(e),n=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),a=String(t.getDate()).padStart(2,"0"),o=t.getHours(),l=String(t.getMinutes()).padStart(2,"0"),i=o>=12?"pm":"am";return 0==(o%=12)&&(o=12),"".concat(n,"-").concat(r,"-").concat(a,", ").concat(o,":").concat(l).concat(i)},xe=function(e,t){var n=function(e){var t,n=null==e?void 0:e.cart;return wb(o,(null==n?void 0:n.currency)||(null==n||null===(t=n.tax_info)||void 0===t?void 0:t.currency_code))}(e),r="".concat(n," ").concat(Number(t||0).toFixed(2));if(null!=e&&e.aws_order_id){var a,l=Number(null!==(a=null==e?void 0:e.print_cost)&&void 0!==a?a:0);return"".concat(r," (").concat((0,pe.__)("Print Cost","nggallery"),": ").concat(n," ").concat(l.toFixed(2),")")}return r},Ee=function(e){switch(e){case"paid":return"Paid";case"unpaid":return"Unpaid";case"awaiting_payment":return"Awaiting Payment";case"fraud":return"Fraud";case"failed":return"Failed";default:return e}},Ce=function(e){if(!e)return"";switch(e.toLowerCase()){case"free":return"Free";case"cheque":case"check":return"Check";case"paypal_standard":case"paypal_express_checkout":case"paypal_express":case"paypal_checkout":return"PayPal";case"stripe_checkout":return"Stripe";case"test_gateway":return"Test";default:return""}},Ne=(0,$.useMemo)(function(){return((null==fe?void 0:fe.orders)||[]).map(function(e){return{id:e.id,date:we(e.date),customer:"".concat(e.customer_name,"\n").concat(e.email),customerName:e.customer_name,email:e.email,orderStatus:Ee(e.status),paymentGateway:Ce(e.payment_gateway),coupon:e.coupon_code||"No coupon",total:xe(e,e.total_amount),hash:e.hash,awsOrderId:e.aws_order_id}})},[fe]),ke=(0,$.useMemo)(function(){return[{key:"id",label:(0,pe.__)("ID","nggallery"),sortType:"backend",className:"w-16",render:function(e){return ee().createElement("button",{type:"button",className:"text-gray-700 hover:text-gray-900 text-sm font-medium hover:underline",onClick:function(){le(e.id)}},String(e.id).padStart(2,"0"))}},{key:"date",label:(0,pe.__)("Date","nggallery"),sortType:"backend",className:"w-1/6",render:function(e){return ee().createElement("span",{className:"text-sm text-gray-700"},e.date)}},{key:"customer",label:(0,pe.__)("Customer","nggallery"),sortType:"backend",className:"w-1/6",render:function(e){return ee().createElement("div",{className:"flex items-start gap-3"},ee().createElement("div",null,ee().createElement("a",{href:xb(e.hash),target:"_blank",rel:"noopener noreferrer",className:"text-gray-700 hover:text-gray-900 text-sm font-medium hover:underline"},e.customerName),ee().createElement("div",{className:"text-gray-500 text-xs"},e.email)))}},{key:"orderStatus",label:(0,pe.__)("Order Status","nggallery"),sortType:"backend",className:"w-1/6",render:function(e){return ee().createElement("div",{className:"flex flex-col items-start gap-1"},ee().createElement("span",{className:"inline-flex items-center justify-center px-3 py-1 rounded text-xs font-medium ".concat("Paid"===e.orderStatus?"bg-green-100 text-green-700":"Unpaid"===e.orderStatus||"Awaiting Payment"===e.orderStatus?"bg-amber-100 text-amber-800":"Failed"===e.orderStatus||"Fraud"===e.orderStatus?"bg-red-100 text-red-700":"bg-gray-100 text-gray-700")},e.orderStatus),e.awsOrderId&&"Failed"===e.orderStatus&&ee().createElement(me,{orderHash:e.hash,awsOrderId:e.awsOrderId,resubmitted:!!se[e.hash],onDone:function(){return t=e.hash,void ue(function(e){return _b(_b({},e),{},n({},t,!0))});var t}}))}},{key:"paymentGateway",label:(0,pe.__)("Payment Gateway","nggallery"),sortType:"backend",className:"w-1/6",render:function(e){return ee().createElement("span",{className:"text-sm text-gray-700"},e.paymentGateway)}},{key:"coupon",label:(0,pe.__)("Coupon","nggallery"),sortType:"backend",className:"w-1/6",render:function(e){return ee().createElement("span",{className:"text-sm ".concat("No coupon"===e.coupon?"text-gray-400":"text-gray-700 font-medium")},e.coupon)}},{key:"total",label:(0,pe.__)("Total","nggallery"),sortType:"backend",className:"w-1/6",render:function(e){return ee().createElement("span",{className:"text-sm font-medium text-gray-900"},e.total)}}]},[se]);return ee().createElement(ee().Fragment,null,oe?ee().createElement(Eb,{orderId:oe,onBack:function(){return le(null)}}):ee().createElement(ee().Fragment,null,ee().createElement("div",{className:"bg-white rounded-lg shadow-sm"},ee().createElement("div",{className:"flex flex-col sm:flex-row gap-3 sm:items-center sm:justify-between mb-4"},ee().createElement("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-3"},ee().createElement(kg,{isOpen:I,onClose:function(){return A(!1)},onToggle:function(){return A(!I)},activeClasses:"relative w-full sm:min-w-[180px] border border-gray-300 bg-gray-50 text-gray-700 px-4 h-10 rounded-md text-sm font-medium flex items-center justify-between",trigger:ee().createElement("button",{type:"button",className:"relative w-full sm:min-w-[180px] border border-gray-300 bg-white text-gray-700 hover:bg-gray-50 px-4 h-10 rounded-md text-sm font-medium flex items-center justify-between"},ee().createElement("span",{className:"flex items-center"},ee().createElement(pr,{className:"w-4 h-4 text-gray-400 mr-2"}),ee().createElement("span",null,"all"===L&&(0,pe.__)("All Dates","nggallery"),"this_month"===L&&(0,pe.__)("This Month","nggallery"),"last_month"===L&&(0,pe.__)("Last Month","nggallery"),"this_year"===L&&(0,pe.__)("This Year","nggallery"))),ee().createElement(rn,{className:"w-4 h-4 text-gray-400"}))},ee().createElement("div",{className:"w-56 py-1"},[{key:"all",label:(0,pe.__)("All Dates","nggallery")},{key:"this_month",label:(0,pe.__)("This Month","nggallery")},{key:"last_month",label:(0,pe.__)("Last Month","nggallery")},{key:"this_year",label:(0,pe.__)("This Year","nggallery")}].map(function(e){return ee().createElement("button",{key:e.key,className:"w-full text-left px-4 py-2 text-sm hover:bg-gray-100 ".concat(L===e.key?"text-gray-900":"text-gray-700"),onClick:function(){F(e.key),A(!1),N(1)}},e.label)}))),ee().createElement(kg,{isOpen:P,onClose:function(){return j(!1)},onToggle:function(){return j(!P)},activeClasses:"relative w-full sm:min-w-[180px] border border-gray-300 bg-gray-50 text-gray-700 px-4 h-10 rounded-md text-sm font-medium flex items-center justify-between",trigger:ee().createElement("button",{type:"button",className:"relative w-full sm:min-w-[180px] border border-gray-300 bg-white text-gray-700 hover:bg-gray-50 px-4 h-10 rounded-md text-sm font-medium flex items-center justify-between"},ee().createElement("span",null,"all"===i&&(0,pe.__)("All Order Statuses","nggallery"),"paid"===i&&(0,pe.__)("Paid","nggallery"),"unpaid"===i&&(0,pe.__)("Unpaid","nggallery"),"awaiting_payment"===i&&(0,pe.__)("Awaiting Payment","nggallery"),"fraud"===i&&(0,pe.__)("Fraud","nggallery"),"failed"===i&&(0,pe.__)("Failed","nggallery")),ee().createElement(rn,{className:"w-4 h-4 text-gray-400"}))},ee().createElement("div",{className:"w-56 py-1"},[{key:"all",label:(0,pe.__)("All Order Statuses","nggallery")},{key:"paid",label:(0,pe.__)("Paid","nggallery")},{key:"unpaid",label:(0,pe.__)("Unpaid","nggallery")},{key:"awaiting_payment",label:(0,pe.__)("Awaiting Payment","nggallery")},{key:"fraud",label:(0,pe.__)("Fraud","nggallery")},{key:"failed",label:(0,pe.__)("Failed","nggallery")}].map(function(e){return ee().createElement("button",{key:e.key,className:"w-full text-left px-4 py-2 text-sm hover:bg-gray-100 ".concat(i===e.key?"text-gray-900":"text-gray-700"),onClick:function(){c(e.key),j(!1),N(1)}},e.label)}))),m.size>0&&ee().createElement(kg,{isOpen:R,onClose:function(){return G(!1)},onToggle:function(){return G(!R)},activeClasses:"relative w-full sm:min-w-[190px] border border-gray-300 bg-gray-50 text-gray-700 px-4 py-2 h-10 rounded-md text-sm font-medium flex items-center justify-between",trigger:ee().createElement("button",{type:"button",className:"relative w-full sm:min-w-[190px] border border-gray-300 bg-white text-gray-700 hover:bg-gray-50 px-4 py-2 h-10 rounded-md text-sm font-medium flex items-center justify-between"},ee().createElement("span",null,(0,pe.__)("Bulk Actions","nggallery")),ee().createElement(rn,{className:"w-4 h-4 text-gray-400"}))},ee().createElement("div",{className:"w-56 py-1"},[{key:"mark_as_paid",label:(0,pe.__)("Mark as Paid","nggallery")},{key:"mark_as_unpaid",label:(0,pe.__)("Mark as Unpaid","nggallery")},{key:"mark_as_awaiting_payment",label:(0,pe.__)("Mark as Awaiting Payment","nggallery")}].map(function(e){return ee().createElement("button",{key:e.key,className:"w-full text-left px-4 py-2 text-sm hover:bg-gray-100 ".concat(z===e.key?"text-gray-900":"text-gray-700"),onClick:No(hb().m(function t(){var n,r;return hb().w(function(t){for(;;)switch(t.p=t.n){case 0:if(U(e.key),G(!1),!(m.size>0)){t.n=7;break}if(n=Array.from(m),"mark_as_paid"!==e.key){t.n=1;break}return K(n),W(!0),U("bulk"),t.a(2);case 1:if("mark_as_unpaid"!==e.key&&"mark_as_awaiting_payment"!==e.key){t.n=2;break}return K(n),ne("mark_as_unpaid"===e.key?"unpaid":"awaiting_payment"),Z(!0),U("bulk"),t.a(2);case 2:t.n=7;break;case 4:d(new Set),ve((0,pe.__)("Order status updated successfully","nggallery")),t.n=6;break;case 5:t.p=5,r=t.v,console.error("Failed to update order status:",r),_e((0,pe.__)("Failed to update order status","nggallery"));case 6:return t.p=6,U("bulk"),t.f(6);case 7:"bulk"===e.key&&U("bulk");case 8:return t.a(2)}},t,null,[[3,5,6,7]])}))},e.label)})))),ee().createElement("div",{className:"w-full sm:w-auto"},ee().createElement("div",{className:"relative"},ee().createElement("span",{className:"pointer-events-none absolute inset-y-0 left-3 flex items-center text-gray-400"},ee().createElement(wn,{className:"w-5 h-5"})),ee().createElement("input",{type:"text",placeholder:(0,pe.__)("Search Orders","nggallery"),className:"w-full sm:w-72 border border-gray-300 rounded-md pl-10 pr-3 py-2 text-sm text-gray-700 placeholder:text-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500",value:p,onChange:function(e){return f(e.target.value)}})))),ee().createElement(Ph,{isLoading:ye,items:Ne,visibleColumns:s,selectedItems:m,onSelectAll:function(e){e?d(new Set(Ne.map(function(e){return e.id}))):(d(new Set),U("bulk"),G(!1))},onSelectItem:function(e){var t=new Set(m);t.has(e)?t.delete(e):t.add(e),d(t),0===t.size&&(U("bulk"),G(!1))},columns:ke,onSort:function(e,t){v(t?e:null),x(t),N(1)},sortColumn:b,sortDirection:w,notFoundContent:ee().createElement("div",{className:"py-16"},ee().createElement("div",{className:"flex flex-col items-center justify-center text-center text-gray-500"},ee().createElement("div",{className:"mb-4"},ee().createElement(_r,{className:"w-16 h-16 opacity-60"})),ee().createElement("p",{className:"text-sm mb-2"},(0,pe.__)("Opps! You have no orders","nggallery"))))}),(null==fe?void 0:fe.pagination)&&fe.pagination.total_pages>1&&ee().createElement("div",{className:"border-t"},ee().createElement(Xf,{currentPage:C,totalPages:fe.pagination.total_pages,perPage:fe.pagination.per_page,total:fe.pagination.total,onPageChange:N,itemLabel:(0,pe.__)("Orders","nggallery"),showItemCount:!0}))),ee().createElement(Eo,{isOpen:Q,onClose:function(){W(!1),K([]),U("bulk")},title:(0,pe.__)("Confirm Mark as Paid","nggallery")},ee().createElement("div",{className:"space-y-4"},ee().createElement("p",{className:"text-sm text-gray-700"},(0,pe.__)("A print lab order will be submitted for any orders that include any print lab items and you will be billed for the cost of goods. Once submitted, the print lab order cannot be cancelled. Continue to Mark as Paid?","nggallery")),ee().createElement("div",{className:"flex justify-end gap-3"},ee().createElement("button",{type:"button",onClick:function(){W(!1),K([]),U("bulk")},disabled:he.isPending,className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"},(0,pe.__)("Cancel","nggallery")),ee().createElement("button",{type:"button",onClick:No(hb().m(function e(){var t;return hb().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,he.mutateAsync({ids:V,status:"paid"});case 1:d(new Set),K([]),W(!1),U("bulk"),ve((0,pe.__)("Orders marked as paid successfully","nggallery")),e.n=3;break;case 2:e.p=2,t=e.v,console.error("Failed to update order status:",t),_e((0,pe.__)("Failed to mark orders as paid","nggallery"));case 3:return e.a(2)}},e,null,[[0,2]])})),disabled:he.isPending,className:"px-4 py-2 text-sm font-medium text-white bg-green-600 rounded-md hover:bg-green-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2"},he.isPending&&ee().createElement(kn,{className:"animate-spin h-4 w-4 text-white"}),he.isPending?(0,pe.__)("Please wait...","nggallery"):(0,pe.__)("Mark as Paid","nggallery"))))),ee().createElement(Eo,{isOpen:Y,onClose:function(){Z(!1),K([]),ne(null),U("bulk")},title:(0,pe.__)("Confirm Action","nggallery")},ee().createElement("div",{className:"space-y-4"},ee().createElement("p",{className:"text-sm text-gray-700"},(0,pe.__)("Are you sure you want to proceed?","nggallery")),ee().createElement("div",{className:"flex justify-end gap-3"},ee().createElement("button",{type:"button",onClick:function(){Z(!1),K([]),ne(null),U("bulk")},disabled:he.isPending,className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"},(0,pe.__)("Cancel","nggallery")),ee().createElement("button",{type:"button",onClick:No(hb().m(function e(){var t;return hb().w(function(e){for(;;)switch(e.p=e.n){case 0:if(te){e.n=1;break}return e.a(2);case 1:return e.p=1,e.n=2,he.mutateAsync({ids:V,status:te});case 2:d(new Set),K([]),Z(!1),ne(null),U("bulk"),ve((0,pe.__)("Orders updated successfully","nggallery")),e.n=4;break;case 3:e.p=3,t=e.v,console.error("Failed to update order status:",t),_e((0,pe.__)("Failed to update orders","nggallery"));case 4:return e.a(2)}},e,null,[[1,3]])})),disabled:he.isPending,className:"px-4 py-2 text-sm font-medium text-white bg-green-600 rounded-md hover:bg-green-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2"},he.isPending&&ee().createElement(kn,{className:"animate-spin h-4 w-4 text-white"}),he.isPending?(0,pe.__)("Please wait...","nggallery"):(0,pe.__)("Proceed","nggallery")))))))};function Nb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function kb(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Nb(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Nb(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var Sb=function(e){return"disabled"===e?"disabled":"flat"===e||"flat_rate"===e?"flat_rate":"percent"===e||"percent_rate"===e?"percent_rate":"disabled"};const Ob=function(){var e=gi(),t=e.data,r=e.isLoading,a=pi(),o=Zi(),l=re(),i=$o().showError,c=(0,$.useMemo)(function(){var e,n,r,a,o;if(!t)return null;var l,i=t;return{ecommerce_domestic_shipping:(l=i.ecommerce_domestic_shipping,"flat"===l||"flat_rate"===l?"flat_rate":"percent"===l||"percent_rate"===l?"percent_rate":"flat_rate"),ecommerce_domestic_shipping_rate:String(null!==(e=i.ecommerce_domestic_shipping_rate)&&void 0!==e?e:"5"),ecommerce_intl_shipping:Sb(i.ecommerce_intl_shipping),ecommerce_intl_shipping_rate:String(null!==(n=i.ecommerce_intl_shipping_rate)&&void 0!==n?n:"40"),ecommerce_tax_enable:ni(null!==(r=i.ecommerce_tax_enable)&&void 0!==r&&r),ecommerce_cookies_enable:ni(null===(a=i.ecommerce_cookies_enable)||void 0===a||a),ecommerce_coupons_disabled:ni(null!==(o=i.ecommerce_coupons_disabled)&&void 0!==o&&o),ecommerce_currency:i.ecommerce_currency}},[t]),s=vo((0,$.useState)(null),2),u=s[0],m=s[1];(0,$.useEffect)(function(){c&&!u&&m(c)},[c,u]);var d=Wh({settings:u,tabId:"ecommerce-other-options",mutation:{mutate:function(e,t){a.mutate(e,kb(kb({},t),{},{onSuccess:function(){for(var e,n,r=arguments.length,a=new Array(r),o=0;o<r;o++)a[o]=arguments[o];null==t||null===(e=(n=t).onSuccess)||void 0===e||e.call.apply(e,[n].concat(a)),l.invalidateQueries({queryKey:["printlabRequirements"]})},onError:function(e){var n,r;i((0,pe.__)("Failed to save settings","nggallery")),null==t||null===(n=(r=t).onError)||void 0===n||n.call(r,e)}}))},isPending:a.isPending},getMutationParams:function(e){return e||{}},debounceDelay:1e3}),g=d.markUserInteraction,p=o;if(r||!u)return ee().createElement(oo,{size:"md",text:(0,pe.__)("Loading settings...","nggallery")});var f=function(e,t){m(function(r){return r?kb(kb({},r),{},n({},e,t)):r}),g()},y="disabled"===u.ecommerce_intl_shipping;return ee().createElement("div",{className:"bg-white rounded-lg shadow-sm p-6"},ee().createElement("div",{className:"mb-6"},ee().createElement("h2",{className:"text-xl font-semibold text-gray-900 mb-2"},(0,pe.__)("Other Options","nggallery"))),ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6"},ee().createElement("div",null,ee().createElement(sc,{id:"ecommerce_domestic_shipping",name:"ecommerce_domestic_shipping",value:u.ecommerce_domestic_shipping,onChange:function(e){return f("ecommerce_domestic_shipping",e.target.value)},label:(0,pe.__)("Domestic shipping for manual-fulfilled items","nggallery")},ee().createElement("option",{value:"flat_rate"},(0,pe.__)("Flat Rate","nggallery")),ee().createElement("option",{value:"percent_rate"},(0,pe.__)("Percentage Rate","nggallery")))),ee().createElement("div",null,ee().createElement(uc,{type:"text",id:"ecommerce_domestic_shipping_rate",name:"ecommerce_domestic_shipping_rate",value:u.ecommerce_domestic_shipping_rate,onChange:function(e){return f("ecommerce_domestic_shipping_rate",e.target.value)},label:(0,pe.__)("Domestic shipping rate","nggallery"),prefix:"flat_rate"===u.ecommerce_domestic_shipping?p:"%"})),ee().createElement("div",null,ee().createElement(sc,{id:"ecommerce_intl_shipping",name:"ecommerce_intl_shipping",value:u.ecommerce_intl_shipping,onChange:function(e){return f("ecommerce_intl_shipping",e.target.value)},label:(0,pe.__)("Allow International shipping for manual-fulfilled items","nggallery")},ee().createElement("option",{value:"disabled"},(0,pe.__)("Disabled","nggallery")),ee().createElement("option",{value:"flat_rate"},(0,pe.__)("Flat Rate","nggallery")),ee().createElement("option",{value:"percent_rate"},(0,pe.__)("Percentage Rate","nggallery")))),!y&&ee().createElement("div",null,ee().createElement(uc,{type:"text",id:"ecommerce_intl_shipping_rate",name:"ecommerce_intl_shipping_rate",value:u.ecommerce_intl_shipping_rate,onChange:function(e){return f("ecommerce_intl_shipping_rate",e.target.value)},label:(0,pe.__)("International shipping rate","nggallery"),prefix:"percent_rate"===u.ecommerce_intl_shipping?"%":p})),ee().createElement("div",{className:"md:col-span-2 mt-2 border-t border-gray-200"}),ee().createElement("div",{className:"md:col-span-2"},ee().createElement(fs,{id:"ecommerce_tax_enable",name:"ecommerce_tax_enable",checked:Boolean(u.ecommerce_tax_enable),onChange:function(e){return f("ecommerce_tax_enable",e.target.checked)},label:(0,pe.__)("Enable sales tax","nggallery"),help:(0,pe.__)("A valid NextGen Pro license is required to calculate sales tax.","nggallery")})),ee().createElement("div",{className:"md:col-span-2"},ee().createElement(fs,{id:"ecommerce_cookies_enable",name:"ecommerce_cookies_enable",checked:Boolean(u.ecommerce_cookies_enable),onChange:function(e){return f("ecommerce_cookies_enable",e.target.checked)},label:(0,pe.__)("Use cookies for cart storage","nggallery"),help:(0,pe.__)("Cookies are adequate for most customers but can only hold a limited number (around 30) of products due to browser limitations. When disabled the browser localStorage API will be used which does not have this problem but cart contents will be different on example.com vs www.example.com as well as across HTTP/HTTPS","nggallery")})),ee().createElement("div",{className:"md:col-span-2"},ee().createElement(fs,{id:"ecommerce_coupons_disabled",name:"ecommerce_coupons_disabled",checked:Boolean(u.ecommerce_coupons_disabled),onChange:function(e){return f("ecommerce_coupons_disabled",e.target.checked)},label:(0,pe.__)("Hide coupons on checkout","nggallery")}))))};function Pb(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return jb(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(jb(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,jb(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,jb(m,"constructor",s),jb(s,"constructor",c),c.displayName="GeneratorFunction",jb(s,a,"GeneratorFunction"),jb(m),jb(m,a,"Generator"),jb(m,r,function(){return this}),jb(m,"toString",function(){return"[object Generator]"}),(Pb=function(){return{w:o,m:d}})()}function jb(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}jb=function(e,t,n,r){function o(t,n){jb(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},jb(e,t,n,r)}function Tb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ib(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Tb(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Tb(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var Ab=function(e){var t=fg({id:e.id}),n=t.attributes,r=t.listeners,a=t.setNodeRef,o=t.transform,l=t.transition,i=t.isDragging,c={transform:Xu.Transform.toString(o),transition:l},s=vo((0,$.useState)(e.item.title||""),2),u=s[0],m=s[1],d=vo((0,$.useState)(tc(e.item.price).toFixed(2)),2),g=d[0],p=d[1],f=vo((0,$.useState)(void 0!==e.item.resolution&&null!==e.item.resolution?e.item.resolution.toString():"0"),2),y=f[0],h=f[1];(0,$.useEffect)(function(){p(tc(e.item.price).toFixed(2))},[e.item.price]);var b=function(){u!==e.item.title&&e.onUpdate&&e.onUpdate(e.item.id,{title:u})},v=function(t){var n,r=parseFloat(t);(""===t||!isNaN(r)&&r>=0)&&(p(t),null===(n=e.onInputActivity)||void 0===n||n.call(e))},_=function(){var t=parseFloat(g);!isNaN(t)&&t>=0&&t!==e.item.price&&e.onUpdate?e.onUpdate(e.item.id,{price:t}):t<0&&p(tc(e.item.price).toFixed(2))},w=function(){var t=y?parseInt(y):0;!isNaN(t)&&t!==e.item.resolution&&e.onUpdate&&e.onUpdate(e.item.id,{resolution:t})},x=function(t,n){"Enter"===t.key?(t.preventDefault(),"title"===n?b():"price"===n?_():"resolution"===n&&w()):"Escape"===t.key&&("title"===n?m(e.item.title||""):"price"===n?p(tc(e.item.price).toFixed(2)):"resolution"===n&&h(void 0!==e.item.resolution&&null!==e.item.resolution?e.item.resolution.toString():"0"))};return ee().createElement("tr",{ref:a,style:c,className:ao("border-b group transition-opacity duration-100",e.isDeleting?"opacity-0":"opacity-100",e.isPending?"bg-blue-50 hover:bg-blue-100":i?"bg-blue-50 border-blue-200 opacity-50":e.isSelected?"bg-blue-50 hover:bg-blue-100":"hover:bg-gray-50")},ee().createElement("td",{className:"w-10 px-3 py-3"},ee().createElement("input",{type:"checkbox",checked:e.isSelected||!1,onChange:function(){return e.onSelect&&e.onSelect(e.item.id)},className:"rounded border-gray-300 text-blue-600 focus:outline-none","aria-label":(0,pe.__)("Select ".concat(e.item.title||"product"),"nggallery")})),ee().createElement("td",{className:"w-8 px-2 py-3"},ee().createElement("div",fe({},n,r,{className:"cursor-move opacity-40 group-hover:opacity-70 relative"}),ee().createElement("svg",{className:"w-4 h-4 text-gray-400",fill:"currentColor",viewBox:"0 0 20 20"},ee().createElement("path",{d:"M7 2a2 2 0 1 1 .001 4.001A2 2 0 0 1 7 2zM7 8a2 2 0 1 1 .001 4.001A2 2 0 0 1 7 8zM7 14a2 2 0 1 1 .001 4.001A2 2 0 0 1 7 14zM13 2a2 2 0 1 1 .001 4.001A2 2 0 0 1 13 2zM13 8a2 2 0 1 1 .001 4.001A2 2 0 0 1 13 8zM13 14a2 2 0 1 1 .001 4.001A2 2 0 0 1 13 14z"})),e.isPending&&ee().createElement("div",{className:"absolute -top-1 -right-1 w-2 h-2 bg-blue-500 rounded-full border border-white"}))),ee().createElement("td",{className:"w-1/2 px-4 py-3"},ee().createElement("div",{className:"flex items-center gap-2"},ee().createElement("input",{type:"text",value:u,onChange:function(t){m(t.target.value),t.target.value!==e.item.title&&e.onUpdate&&e.onUpdate(e.item.id,{title:t.target.value})},onBlur:b,onKeyDown:function(e){return x(e,"title")},className:"flex-1 text-sm font-medium border border-gray-300 rounded px-2 py-1 focus:outline-none text-gray-900"}))),"digital-download"===e.activeTab?ee().createElement(ee().Fragment,null,ee().createElement("td",{className:"w-1/4 px-4 py-3"},ee().createElement("div",{className:"relative"},ee().createElement("span",{className:"absolute ".concat(ec(e.siteCurrencySymbol)," top-1/2 transform -translate-y-1/2 text-gray-500 text-sm")},e.siteCurrencySymbol),ee().createElement("input",{type:"number",step:"1",value:g,onChange:function(e){return v(e.target.value)},onFocus:function(){var t;return null===(t=e.onInputActivity)||void 0===t?void 0:t.call(e)},onBlur:_,onKeyDown:function(e){return x(e,"price")},className:"w-full text-sm font-medium text-gray-900 border border-gray-300 rounded ".concat($i(e.siteCurrencySymbol).left," ").concat($i(e.siteCurrencySymbol).right," py-1 focus:outline-none")}))),ee().createElement("td",{className:"w-1/4 px-4 py-3"},ee().createElement("div",{className:"relative"},ee().createElement("input",{type:"number",min:"0",value:y,onChange:function(t){h(t.target.value);var n=t.target.value?parseInt(t.target.value):0;!isNaN(n)&&n!==e.item.resolution&&e.onUpdate&&e.onUpdate(e.item.id,{resolution:n})},onBlur:w,onKeyDown:function(e){return x(e,"resolution")},className:"w-full text-sm font-medium text-gray-900 border border-gray-300 rounded pl-3 pr-8 py-1 focus:outline-none",placeholder:(0,pe.__)("Enter 0 for maximum","nggallery")}),ee().createElement("span",{className:"absolute right-2 top-1/2 transform -translate-y-1/2 text-gray-500 text-sm"},"px")))):ee().createElement(ee().Fragment,null,ee().createElement("td",{className:"w-1/5 px-4 py-3"},"ngg_whcc_pricelist"===e.item.source?ee().createElement("div",{className:"relative"},ee().createElement("span",{className:"absolute ".concat(ec(e.siteCurrencySymbol)," top-1/2 transform -translate-y-1/2 text-gray-500 text-sm")},e.siteCurrencySymbol),ee().createElement("input",{type:"number",step:"1",value:tc(e.item.cost).toFixed(2),readOnly:!0,className:"w-full text-sm font-medium text-gray-700 bg-gray-50 border border-gray-300 rounded ".concat($i(e.siteCurrencySymbol).left," ").concat($i(e.siteCurrencySymbol).right," py-1 cursor-not-allowed")})):ee().createElement("div",{className:"text-sm text-gray-500 font-medium"},"N/A")),ee().createElement("td",{className:"w-1/5 px-4 py-3"},ee().createElement("div",{className:"relative"},ee().createElement("span",{className:"absolute ".concat(ec(e.siteCurrencySymbol)," top-1/2 transform -translate-y-1/2 text-gray-500 text-sm")},e.siteCurrencySymbol),ee().createElement("input",{type:"number",step:"1",value:g,onChange:function(e){return v(e.target.value)},onFocus:function(){var t;return null===(t=e.onInputActivity)||void 0===t?void 0:t.call(e)},onBlur:_,onKeyDown:function(e){return x(e,"price")},className:"w-full text-sm font-medium text-gray-900 border border-gray-300 rounded ".concat($i(e.siteCurrencySymbol).left," ").concat($i(e.siteCurrencySymbol).right," py-1 focus:outline-none")})))),ee().createElement("td",{className:"w-1/10 px-4 py-3"},ee().createElement("button",{onClick:function(){return e.onDelete(e.item.id)},className:"text-red-600 hover:text-red-800","aria-label":(0,pe.__)("Delete product","nggallery")},ee().createElement("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},ee().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})))))};const Db=function(e){var t,r=e.pricelistId,a=Cs(),o=a.setCurrentId,l=a.currentSubTab,i=a.setCurrentSubTab,c=$o(),s=c.showSuccess,u=c.showError,m=c.showInfo,d=(0,ge.useDispatch)(Br),g=Zi(),p=Fy(),f=p.data,y=void 0===f?[]:f,h=p.isLoading,b=y||[],v=Oi(r),_=v.data,w=v.isLoading,x=v.refetch,E=vo((0,$.useState)(""),2),C=E[0],N=E[1],k=vo((0,$.useState)(null),2),S=k[0],O=k[1],P=vo((0,$.useState)(!1),2),j=P[0],T=P[1];(0,$.useEffect)(function(){null!=_&&_.settings&&!j&&O(_.settings)},[null==_?void 0:_.settings,j]);var I=vo((0,$.useState)({showLicensingLink:!1,licensingPageId:"",allowFreeDownloads:!1}),2),A=I[0],D=I[1],L=l||"prints";(0,$.useEffect)(function(){l||i("prints")},[l,i]);var F=function(e){return{prints:"ngg_category_prints",canvas:"ngg_category_canvas","mounted-prints":"ngg_category_mounted_prints","metal-prints":"metal_prints","acrylic-prints":"acrylic_prints","wood-prints":"wood_prints","bamboo-panels":"bamboo_panels","digital-download":"ngg_category_digital_downloads"}[e]||e},M=function(e){return sl({queryKey:["all-pricelist-items",e],queryFn:function(){return Sp(e)},enabled:!!e,select:function(e){var t={};return e.forEach(function(e){t[e.category]||(t[e.category]=[]),t[e.category].push(e)}),Object.keys(t).forEach(function(e){t[e].sort(function(e,t){return(e.sortorder||0)-(t.sortorder||0)})}),t}})}(r),R=M.data,G=void 0===R?{}:R,B=M.isLoading,z=M.refetch,U=vo((0,$.useState)({}),2),q=U[0],Q=U[1],W=vo((0,$.useState)({}),2),H=W[0],V=W[1],K=vo((0,$.useState)(!1),2),X=K[0],Y=K[1],Z=vo((0,$.useState)({}),2),J=Z[0],te=Z[1];(0,$.useEffect)(function(){G&&Object.keys(G).length>0&&V(G)},[G]),(0,$.useEffect)(function(){X&&G&&Object.keys(G).length>0&&JSON.stringify(G)!==JSON.stringify(J)&&(Y(!1),te(G))},[X,G,J]);var ne=vo((0,$.useState)(new Set),2),ae=ne[0],oe=ne[1],le="pricelist_deleted_items_".concat(r),ie=vo((0,$.useState)(!1),2),ce=ie[0],se=ie[1],ue=(0,$.useRef)(null),me=(0,$.useRef)(function(){return{hasChanges:!1,savePayload:null}}),de=(0,$.useRef)(!1),fe=(0,$.useCallback)(function(){_&&T(!0)},[_]),ye=(0,$.useRef)(null),he=(0,$.useCallback)(function(){_&&(ye.current&&clearTimeout(ye.current),ye.current=window.setTimeout(function(){T(!0)},1500))},[_]),be=vo((0,$.useState)(new Set),2),ve=be[0],_e=be[1],we=vo((0,$.useState)(!1),2),xe=we[0],Ee=we[1],Ce=vo((0,$.useState)(null),2),Ne=Ce[0],ke=Ce[1],Se=cm(im(ad,{activationConstraint:{distance:8,delay:100,tolerance:10}}),im($m,{coordinateGetter:bg})),Oe=vo((0,$.useState)(function(){try{var e=sessionStorage.getItem(le);return e?JSON.parse(e):[]}catch(e){return console.error("Failed to load deleted items from sessionStorage:",e),[]}}),2),Pe=Oe[0],je=Oe[1],Te=function(e,t){var r=Object.keys(H).find(function(t){var n;return null===(n=H[t])||void 0===n?void 0:n.some(function(t){return t.id===e})});if(r)V(function(a){return Ib(Ib({},a),{},n({},r,a[r].map(function(n){return n.id===e?Ib(Ib({},n),t):n})))});else{var a=Object.keys(q).find(function(t){var n;return null===(n=q[t])||void 0===n?void 0:n.some(function(t){return t.id===e})});a&&Q(function(r){return Ib(Ib({},r),{},n({},a,r[a].map(function(n){return n.id===e?Ib(Ib({},n),t):n})))})}he()},Ie=F(L),Ae=Ib({},G);Object.keys(H).forEach(function(e){Ae[e]=H[e]});var De=Ae[Ie]||[],Le=q[Ie]||[],Fe=[].concat(ko(De),ko(Le)).sort(function(e,t){return e.sortorder-t.sortorder}),Me=(0,$.useCallback)(function(e){var t=e.active,r=e.over;if(ke(null),r&&t.id!==r.id){var a=Fe.findIndex(function(e){return e.id===t.id}),o=Fe.findIndex(function(e){return e.id===r.id});if(-1!==a&&-1!==o){var l=eg(Fe,a,o).map(function(e,t){return Ib(Ib({},e),{},{sortorder:t+1})}),i=F(L);V(function(e){return Ib(Ib({},e),{},n({},i,l))}),fe(),window.navigator.vibrate&&window.navigator.vibrate([50,50,50])}}},[Fe,L,F,fe]),Re=Ib({},H);Object.keys(q).forEach(function(e){q[e].length>0&&(Re[e]=[].concat(ko(Re[e]||[]),ko(q[e])))});var Ge=function(){var e=re();return gl({mutationFn:Pp,onSuccess:function(t,n){e.invalidateQueries({queryKey:["all-pricelist-items"]}),e.invalidateQueries({queryKey:["pricelist-items"]}),e.invalidateQueries({queryKey:["pricelist",n.id]})}})}(),Be=function(e,t,n){var r=e*(1+t/100);switch(n){case"zero":r=Math.ceil(r);break;case"cent":r=Math.floor(r)+.99}return parseFloat(r.toFixed(2))},ze=function(e,t){if("ngg_manual_pricelist"===t)return e;var n=S||(null==_?void 0:_.settings);if(!n)return e;var r=parseFloat(n.bulk_markup_amount)||300,a=n.bulk_markup_rounding||"zero";return Be(e,r,a)},Ue=(0,$.useCallback)(function(){if(!_)return{hasChanges:!1,savePayload:null};var e={},t=1;Object.values(q).forEach(function(n){n.forEach(function(n){var r="new-".concat(t++);e[r]={title:n.title,cost:n.cost,price:n.price,source:n.source,category:n.category,resolution:void 0!==n.resolution&&null!==n.resolution?n.resolution:0,sortorder:n.sortorder,source_data:n.source_data}})}),Object.entries(G).forEach(function(t){var n=vo(t,2),r=n[0];n[1].forEach(function(t){if(!Pe.includes(t.id)){var n=(H[r]||[]).find(function(e){return e.id===t.id});e[t.id]=n?{title:n.title,cost:n.cost,price:n.price,source:n.source,category:n.category,resolution:void 0!==n.resolution&&null!==n.resolution?n.resolution:0,sortorder:n.sortorder,source_data:n.source_data}:{title:t.title,cost:t.cost,price:t.price,source:t.source,category:t.category,resolution:void 0!==t.resolution&&null!==t.resolution?t.resolution:0,sortorder:t.sortorder,source_data:t.source_data}}})});var n=Object.keys(e).length,a=C.trim()!==(_.title||""),o=JSON.stringify(S)!==JSON.stringify(null==_?void 0:_.settings),l=(null==_?void 0:_.digital_download_settings)||{},i={show_licensing_link:A.showLicensingLink?1:0,licensing_page_id:A.licensingPageId||"",skip_checkout:A.allowFreeDownloads?1:0},c=JSON.stringify(l)!==JSON.stringify(i),s=Pe.length>0,u=n>0||a||o||c||s;return{hasChanges:u,savePayload:u?{id:r,pricelist:{title:C.trim(),settings:S,digital_download_settings:i},pricelist_item:e,deleted_items:Pe}:null}},[_,q,G,Pe,H,C,S,A,r]);function qe(e){_e(function(t){var n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}me.current=Ue,(0,$.useEffect)(function(){return ue.current&&(clearTimeout(ue.current),ue.current=null),j&&_&&!Ge.isPending&&!ce?(se(!0),ue.current=window.setTimeout(No(Pb().m(function e(){var t,n,r,a;return Pb().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t=me.current(),n=t.hasChanges,r=t.savePayload,!n||!r){e.n=4;break}return m((0,pe.__)("Saving changes...","nggallery"),{duration:2e3}),e.p=1,e.n=2,Ge.mutateAsync(r);case 2:de.current=!0,Q({}),je([]),T(!1);try{sessionStorage.removeItem(le)}catch(e){console.error("Failed to clear sessionStorage:",e)}s((0,pe.__)("Pricelist changes saved!","nggallery"),{duration:2e3}),e.n=4;break;case 3:e.p=3,a=e.v,console.error("Auto-save failed:",a),u((0,pe.__)("Failed to save changes","nggallery"));case 4:se(!1);case 5:return e.a(2)}},e,null,[[1,3]])})),1500)):se(!1),function(){ue.current&&(clearTimeout(ue.current),ue.current=null),ye.current&&(clearTimeout(ye.current),ye.current=null)}},[j,_,Ge.isPending]),(0,$.useEffect)(function(){if(_){if(j||(N(_.title||""),O(_.settings||{}),T(!1)),!j&&!de.current&&_.digital_download_settings){var e=_.digital_download_settings;D({showLicensingLink:0!==Number(e.show_licensing_link),licensingPageId:String(e.licensing_page_id||""),allowFreeDownloads:0!==Number(e.skip_checkout)})}de.current=!1}},[_,j]),(0,$.useEffect)(function(){x(),z()},[r,x,z]),(0,$.useEffect)(function(){b.length>0&&A.showLicensingLink&&!A.licensingPageId&&D(function(e){return Ib(Ib({},e),{},{licensingPageId:String(b[0].id)})})},[b,A.showLicensingLink,A.licensingPageId]),(0,$.useEffect)(function(){G&&Object.keys(G).length>0&&V(G)},[G]),(0,$.useEffect)(function(){_e(new Set),Ee(!1)},[L]),(0,$.useEffect)(function(){V({}),Q({}),je([]),oe(new Set),_e(new Set),Ee(!1),T(!1),se(!1),de.current=!1,ue.current&&(clearTimeout(ue.current),ue.current=null),ye.current&&(clearTimeout(ye.current),ye.current=null)},[r]),(0,$.useEffect)(function(){var e=Fe.map(function(e){return e.id}),t=e.filter(function(e){return ve.has(e)});0===t.length?Ee(!1):t.length===e.length&&e.length>0?Ee(!0):Ee(!1)},[ve,Fe]);var Qe,We=[{id:"prints",label:(0,pe.__)("Prints","nggallery")},{id:"canvas",label:(0,pe.__)("Canvas","nggallery")},{id:"mounted-prints",label:(0,pe.__)("Mounted Prints","nggallery")},{id:"metal-prints",label:(0,pe.__)("Metal Prints","nggallery")},{id:"acrylic-prints",label:(0,pe.__)("Acrylic Prints","nggallery")},{id:"wood-prints",label:(0,pe.__)("Wood Prints","nggallery")},{id:"bamboo-panels",label:(0,pe.__)("Bamboo Panels","nggallery")},{id:"digital-download",label:(0,pe.__)("Digital Download","nggallery")}];return w?ee().createElement("div",{className:"flex flex-col items-center justify-center py-8"},ee().createElement("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900 mb-4"}),ee().createElement("p",{className:"text-gray-600 text-sm font-medium"},(0,pe.__)("Loading Pricelist...","nggallery"))):_?ee().createElement("div",{className:"bg-white rounded-lg"},ee().createElement("div",{className:"flex items-center justify-between mb-6"},ee().createElement("button",{type:"button",onClick:function(){o(null),i(null)},className:"flex items-center text-gray-600 hover:text-gray-900"},ee().createElement(br,{className:"w-5 h-5 mr-2"}),(0,pe.__)("Pricelist","nggallery"))),ee().createElement("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-6"},ee().createElement("div",{className:"relative w-full sm:w-auto"},ee().createElement("input",{type:"text",id:"pricelist-name",name:"pricelist-name",value:C,onChange:function(e){N(e.target.value),he()},className:"w-full sm:w-80 px-3 py-2 text-lg font-semibold border border-gray-300 rounded-md focus:outline-none bg-white",placeholder:(0,pe.__)("Pricelist Name","nggallery")})),ee().createElement("div",{className:"flex-shrink-0 flex flex-col sm:flex-row items-stretch sm:items-center gap-3"},ve.size>0&&ee().createElement("button",{type:"button",onClick:function(){if(0!==ve.size){var e=Array.from(ve),t=e.map(function(e){var t;return(null===(t=Fe.find(function(t){return t.id===e}))||void 0===t?void 0:t.title)||(0,pe.__)("Untitled Product","nggallery")}).slice(0,3),n=1===ve.size?t[0]:ve.size<=3?t.join(", "):"".concat(t.slice(0,2).join(", ")," and ").concat(ve.size-2," more");d.setActiveModal("deletePricelistItem",{itemTitle:n,isBulkDelete:!0,bulkCount:ve.size,onConfirm:function(){oe(function(t){return new Set([].concat(ko(t),e))}),setTimeout(function(){var t=e.filter(function(e){return e<0}),n=e.filter(function(e){return e>=0});t.length>0&&Q(function(e){var n=Ib({},e);return Object.keys(n).forEach(function(e){var r=n[e]||[];if(r.length>0){var a=r.filter(function(e){return!t.includes(e.id)});n[e]=a.map(function(e,t){return Ib(Ib({},e),{},{sortorder:t+1})})}}),n}),n.length>0&&(V(function(e){var t=Ib({},e);return Object.keys(Ae).forEach(function(e){var r=Ae[e]||[];if(n.filter(function(e){return r.some(function(t){return t.id===e})}).length>0){var a=r.filter(function(e){return!n.includes(e.id)});t[e]=a.map(function(e,t){return Ib(Ib({},e),{},{sortorder:t+1})})}}),t}),je(function(e){return[].concat(ko(e),ko(n))})),fe(),_e(new Set),Ee(!1),oe(function(t){var n=new Set(t);return e.forEach(function(e){return n.delete(e)}),n})},100)}})}},className:"inline-flex items-center gap-2 rounded-md bg-red-600 text-white px-4 py-2 text-sm font-medium hover:bg-red-700 focus:outline-none"},ee().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4"},ee().createElement("path",{fillRule:"evenodd",d:"M16.5 4.478v.227a48.816 48.816 0 0 1 3.878.512.75.75 0 1 1-.256 1.478l-.209-.035-1.005 13.07a3 3 0 0 1-2.991 2.77H8.084a3 3 0 0 1-2.991-2.77L4.087 6.66l-.209.035a.75.75 0 0 1-.256-1.478A48.567 48.567 0 0 1 7.5 4.705v-.227c0-1.564 1.213-2.9 2.816-2.951a52.662 52.662 0 0 1 3.369 0c1.603.051 2.815 1.387 2.815 2.951Zm-6.136-1.452a51.196 51.196 0 0 1 3.273 0C14.39 3.05 15 3.684 15 4.478v.113a49.488 49.488 0 0 0-6 0v-.113c0-.794.609-1.428 1.364-1.452Zm-.355 5.945a.75.75 0 1 0-1.5.058l.347 9a.75.75 0 1 0 1.499-.058l-.346-9Zm5.48.058a.75.75 0 1 0-1.498-.058l-.347 9a.75.75 0 0 0 1.5.058l.345-9Z",clipRule:"evenodd"})),(0,pe.__)("Delete ".concat(ve.size," item").concat(1===ve.size?"":"s"),"nggallery")),ee().createElement("button",{type:"button",className:"inline-flex items-center gap-2 rounded-md bg-white border border-gray-300 text-gray-700 px-4 py-2 text-sm font-medium hover:bg-gray-50 focus:outline-none shadow-sm",onClick:function(){d.setActiveModal("bulkMarkup",{pricelistId:r,currentSettings:S,onSuccess:function(e){e&&(O(function(t){return Ib(Ib({},t),{},{bulk_markup_amount:e.markupPercent,bulk_markup_rounding:e.rounding})}),fe(),V(function(t){var n=Ib({},t);return Object.keys(n).forEach(function(t){n[t]=n[t].map(function(t){return"ngg_whcc_pricelist"===t.source?Ib(Ib({},t),{},{price:Be(t.cost,e.markupPercent,e.rounding)}):t})}),n}),Object.keys(q).length>0&&Q(function(t){var n=Ib({},t);return Object.keys(n).forEach(function(t){n[t]=n[t].map(function(t){return"ngg_whcc_pricelist"===t.source?Ib(Ib({},t),{},{price:Be(t.cost,e.markupPercent,e.rounding)}):t})}),n}))}})}},(0,pe.__)("Bulk Markup","nggallery")),ee().createElement("button",{type:"button",className:"inline-flex items-center gap-2 rounded-md bg-green-500 text-white px-4 py-2 text-sm font-medium hover:bg-green-600 focus:outline-none",onClick:function(){d.setActiveModal("addProduct",{pricelistId:r,existingItems:H,onSuccess:function(e){if(e&&Array.isArray(e)&&0!==e.length){var t=Ib({},q),n={added:0,skipped:0};e.forEach(function(e){t[e.category]||(t[e.category]=[]);var r="number"==typeof e.cost?e.cost:parseFloat(String(e.cost))||0,a=t[e.category].findIndex(function(t){var n,r;return"ngg_whcc_pricelist"===t.source&&(null===(n=t.source_data)||void 0===n?void 0:n.product_id)===(null===(r=e.source_data)||void 0===r?void 0:r.product_id)}),o=(H[e.category]||[]).find(function(t){var n,r;return"ngg_whcc_pricelist"===t.source&&(null===(n=t.source_data)||void 0===n?void 0:n.product_id)===(null===(r=e.source_data)||void 0===r?void 0:r.product_id)});if(a>=0||o)n.skipped++;else{var l=[].concat(ko(H[e.category]||[]),ko(t[e.category]||[])),i=(l.length>0?Math.max.apply(Math,ko(l.map(function(e){return e.sortorder||0}))):0)+1,c=Ib(Ib({},e),{},{id:-1e6*Math.random(),cost:r,price:"ngg_manual_pricelist"===e.source||"ngg_digital_downloads"===e.source?e.price:ze(r,e.source),sortorder:i});t[e.category].push(c),n.added++}}),Q(t),fe(),n.added>0&&n.skipped>0?s((0,pe.__)("Added ".concat(n.added," new products, skipped ").concat(n.skipped," existing products"),"nggallery")):n.added>0?s((0,pe.__)("Added ".concat(n.added," new products to pricelist"),"nggallery")):n.skipped>0?s((0,pe.__)("All ".concat(n.skipped," products already exist in pricelist"),"nggallery")):s((0,pe.__)("No new products to add","nggallery"))}else u((0,pe.__)("No items were added. Please try again.","nggallery"))}})}},(0,pe.__)("Add New Product","nggallery"),ee().createElement("span",{className:"inline-flex items-center justify-center w-5 h-5 rounded-full border border-white"},ee().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4"},ee().createElement("path",{d:"M12 4.5a.75.75 0 01.75.75V11h5.75a.75.75 0 010 1.5H12.75v5.75a.75.75 0 01-1.5 0V12.5H5.5a.75.75 0 010-1.5h5.75V5.25A.75.75 0 0112 4.5z"})))))),ee().createElement("div",{className:"border-b border-gray-200 mb-6"},ee().createElement("nav",{className:"-mb-px flex overflow-x-auto"},We.map(function(e){return ee().createElement("button",{key:e.id,onClick:function(){return i(e.id)},className:"py-3 px-4 border-b-2 font-medium text-sm text-center whitespace-nowrap flex-shrink-0 ".concat(L===e.id?"border-green-500 text-green-600 bg-green-50":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300 hover:bg-gray-50")},e.label)}))),ee().createElement("div",{className:"min-h-[400px]"},"digital-download"===L&&ee().createElement("div",{className:"mb-6 space-y-4"},ee().createElement("div",{className:"flex flex-col sm:flex-row sm:items-center gap-4"},ee().createElement("div",{className:"flex items-start sm:items-center"},ee().createElement("input",{type:"checkbox",id:"display-license-terms",name:"display-license-terms",checked:A.showLicensingLink,onChange:function(e){D(function(t){return Ib(Ib({},t),{},{showLicensingLink:e.target.checked,licensingPageId:e.target.checked?t.licensingPageId||(b.length>0?String(b[0].id):""):""})}),fe()},className:"rounded border-gray-300 text-blue-600 focus:outline-none w-5 h-5 sm:w-4 sm:h-4 mt-0.5 sm:mt-0 flex-shrink-0"}),ee().createElement("label",{htmlFor:"display-license-terms",className:"ml-2 text-sm text-gray-900 leading-relaxed"},(0,pe.__)("Display link to license terms?","nggallery"))),A.showLicensingLink&&ee().createElement("div",{className:"flex items-center space-x-2 w-full sm:w-auto"},ee().createElement("select",{id:"licensing-page",value:A.licensingPageId,onChange:function(e){D(function(t){return Ib(Ib({},t),{},{licensingPageId:e.target.value})}),fe()},className:"px-3 py-1 text-sm border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 w-full sm:min-w-[300px] sm:max-w-md",disabled:h},b.map(function(e){return ee().createElement("option",{key:e.id,value:e.id},e.title.rendered)})),h&&ee().createElement(oo,{size:"sm",color:"blue",className:"ml-2"}))),ee().createElement("div",{className:"flex items-start sm:items-center"},ee().createElement("input",{type:"checkbox",id:"allow-free-downloads",name:"allow-free-downloads",checked:A.allowFreeDownloads,onChange:function(e){D(function(t){return Ib(Ib({},t),{},{allowFreeDownloads:e.target.checked})}),fe()},className:"rounded border-gray-300 text-blue-600 focus:outline-none w-5 h-5 sm:w-4 sm:h-4 mt-0.5 sm:mt-0 flex-shrink-0"}),ee().createElement("label",{htmlFor:"allow-free-downloads",className:"ml-2 text-sm text-gray-900 leading-relaxed"},(0,pe.__)("Allow free downloads to download directly from the cart sidebar","nggallery")))),ee().createElement("div",{className:"bg-white rounded-b-lg shadow-sm"},ee().createElement("div",{className:"overflow-x-auto"},ee().createElement(Md,{sensors:Se,collisionDetection:hm,onDragStart:function(e){ke(e.active.id),window.navigator.vibrate&&window.navigator.vibrate(50)},onDragEnd:Me,measuring:{droppable:{strategy:md.Always}}},ee().createElement("table",{className:"w-full border-collapse min-w-[600px]"},ee().createElement("thead",null,ee().createElement("tr",{className:"border-b bg-gray-50"},ee().createElement("th",{className:"w-10 px-3 py-3 text-left"},Fe.length>0&&ee().createElement("input",{type:"checkbox",checked:xe,onChange:function(){if(xe)_e(new Set),Ee(!1);else{var e=new Set(Fe.map(function(e){return e.id}));_e(e),Ee(!0)}},className:"rounded border-gray-300 text-blue-600 focus:outline-none","aria-label":(0,pe.__)("Select all items","nggallery")})),ee().createElement("th",{className:"w-8 px-2 py-3 text-left"}),ee().createElement("th",{className:"w-1/2 px-4 py-3 text-left font-medium text-gray-600 text-sm"},(0,pe.__)("Product Name","nggallery")),"digital-download"===L?ee().createElement(ee().Fragment,null,ee().createElement("th",{className:"w-1/5 px-4 py-3 text-left font-medium text-gray-600 text-sm whitespace-nowrap"},(0,pe.__)("Price","nggallery")),ee().createElement("th",{className:"w-1/5 px-4 py-3 text-left font-medium text-gray-600 text-sm whitespace-nowrap"},(0,pe.__)("Longest Image Dimension","nggallery"))):ee().createElement(ee().Fragment,null,ee().createElement("th",{className:"w-1/5 px-4 py-3 text-left font-medium text-gray-600 text-sm whitespace-nowrap"},(0,pe.__)("Cost","nggallery")),ee().createElement("th",{className:"w-1/5 px-4 py-3 text-left font-medium text-gray-600 text-sm whitespace-nowrap"},(0,pe.__)("Price","nggallery"))),ee().createElement("th",{className:"w-1/10 px-4 py-3 text-left font-medium text-gray-600 text-sm"}))),ee().createElement("tbody",null,(B||X)&&ee().createElement("tr",null,ee().createElement("td",{colSpan:7,className:"py-16 text-center"},ee().createElement("div",{className:"flex flex-col items-center justify-center"},ee().createElement("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-gray-900 mb-3"}),ee().createElement("p",{className:"text-gray-600 text-sm font-medium"},X?(0,pe.__)("Refreshing Products...","nggallery"):(0,pe.__)("Loading Products...","nggallery"))))),!B&&!X&&0===Fe.length&&ee().createElement("tr",null,ee().createElement("td",{colSpan:7,className:"py-16"},ee().createElement("div",{className:"flex flex-col items-center justify-center text-center text-gray-500"},ee().createElement("div",{className:"mb-4"},ee().createElement(_r,{className:"w-16 h-16 opacity-60"})),ee().createElement("p",{className:"text-sm mb-2"},(0,pe.__)("No","nggallery")," ",null===(t=We.find(function(e){return e.id===L}))||void 0===t?void 0:t.label," ",(0,pe.__)("so far!","nggallery"))))),!B&&!X&&Fe.length>0&&ee().createElement(cg,{items:Fe.map(function(e){return e.id}),strategy:og},Fe.map(function(e){return ee().createElement(Ab,{key:e.id,id:e.id,item:e,activeTab:L,siteCurrencySymbol:g,isDeleting:ae.has(e.id),isPending:e.id<0,isSelected:ve.has(e.id),onSelect:qe,onUpdate:Te,onInputActivity:he,onDelete:function(e){var t=Fe.find(function(t){return t.id===e});t&&d.setActiveModal("deletePricelistItem",{itemTitle:t.title||(0,pe.__)("Untitled Product","nggallery"),onConfirm:function(){oe(function(t){return new Set(t).add(e)}),setTimeout(function(){if(e<0){var t=Ib({},q);Object.keys(t).forEach(function(n){var r=t[n]||[];if(r.length>0){var a=r.filter(function(t){return t.id!==e});t[n]=a.map(function(e,t){return Ib(Ib({},e),{},{sortorder:t+1})})}}),Q(t)}else V(function(t){var n=Ib({},t),r="",a=[];if(Object.keys(Ae).forEach(function(t){var n=Ae[t]||[];n.some(function(t){return t.id===e})&&(r=t,a=ko(n))}),r){var o=a.filter(function(t){return t.id!==e});n[r]=o.map(function(e,t){return Ib(Ib({},e),{},{sortorder:t+1})})}return n}),je(function(t){return[].concat(ko(t),[e])}),fe();oe(function(t){var n=new Set(t);return n.delete(e),n})},150)}})}})})))),ee().createElement($d,null,Ne&&((Qe=Fe.find(function(e){return e.id===Ne}))?ee().createElement("table",{className:"w-full border-collapse"},ee().createElement("tbody",null,ee().createElement("tr",{className:"border-b bg-blue-50 opacity-90 transform scale-105"},ee().createElement("td",{className:"w-10 px-3 py-3"},ee().createElement("input",{type:"checkbox",checked:!1,disabled:!0,className:"rounded border-gray-300 text-blue-600 opacity-50"})),ee().createElement("td",{className:"w-8 px-2 py-3"},ee().createElement("div",{className:"cursor-move opacity-40 group-hover:opacity-70 relative"},ee().createElement("svg",{className:"w-4 h-4 text-gray-400",fill:"currentColor",viewBox:"0 0 20 20"},ee().createElement("path",{d:"M7 2a2 2 0 1 1 .001 4.001A2 2 0 0 1 7 2zM7 8a2 2 0 1 1 .001 4.001A2 2 0 0 1 7 8zM7 14a2 2 0 1 1 .001 4.001A2 2 0 0 1 7 14zM13 2a2 2 0 1 1 .001 4.001A2 2 0 0 1 13 2zM13 8a2 2 0 1 1 .001 4.001A2 2 0 0 1 13 8zM13 14a2 2 0 1 1 .001 4.001A2 2 0 0 1 13 14z"})))),ee().createElement("td",{className:"w-1/2 px-4 py-3"},ee().createElement("div",{className:"flex items-center gap-2"},ee().createElement("input",{type:"text",value:Qe.title||"",readOnly:!0,className:"flex-1 text-sm font-medium border border-gray-300 rounded px-2 py-1 bg-white text-gray-900"}))),"digital-download"===L?ee().createElement(ee().Fragment,null,ee().createElement("td",{className:"w-1/4 px-4 py-3"},ee().createElement("div",{className:"relative"},ee().createElement("span",{className:"absolute ".concat(ec(g)," top-1/2 transform -translate-y-1/2 text-gray-500 text-sm")},g),ee().createElement("input",{type:"number",step:"1",value:tc(Qe.price).toFixed(2),readOnly:!0,className:"w-full text-sm font-medium text-gray-900 border border-gray-300 rounded ".concat($i(g).left," ").concat($i(g).right," py-1 bg-white")}))),ee().createElement("td",{className:"w-1/4 px-4 py-3"},ee().createElement("div",{className:"relative"},ee().createElement("input",{type:"number",min:"0",value:void 0!==Qe.resolution&&null!==Qe.resolution?Qe.resolution.toString():"0",readOnly:!0,className:"w-full text-sm font-medium text-gray-900 border border-gray-300 rounded pl-3 pr-8 py-1 bg-white"}),ee().createElement("span",{className:"absolute right-2 top-1/2 transform -translate-y-1/2 text-gray-500 text-sm"},"px")))):ee().createElement(ee().Fragment,null,ee().createElement("td",{className:"w-1/5 px-4 py-3"},"ngg_whcc_pricelist"===Qe.source?ee().createElement("div",{className:"relative"},ee().createElement("span",{className:"absolute ".concat(ec(g)," top-1/2 transform -translate-y-1/2 text-gray-500 text-sm")},g),ee().createElement("input",{type:"number",step:"1",value:tc(Qe.cost).toFixed(2),readOnly:!0,className:"w-full text-sm font-medium text-gray-700 bg-gray-50 border border-gray-300 rounded ".concat($i(g).left," ").concat($i(g).right," py-1")})):ee().createElement("div",{className:"text-sm text-gray-500 font-medium"},"N/A")),ee().createElement("td",{className:"w-1/5 px-4 py-3"},ee().createElement("div",{className:"relative"},ee().createElement("span",{className:"absolute ".concat(ec(g)," top-1/2 transform -translate-y-1/2 text-gray-500 text-sm")},g),ee().createElement("input",{type:"number",step:"1",value:tc(Qe.price).toFixed(2),readOnly:!0,className:"w-full text-sm font-medium text-gray-900 border border-gray-300 rounded ".concat($i(g).left," ").concat($i(g).right," py-1 bg-white")})))),ee().createElement("td",{className:"w-1/10 px-4 py-3"},ee().createElement("button",{className:"text-red-600 hover:text-red-800","aria-label":(0,pe.__)("Delete product","nggallery")},ee().createElement("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},ee().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"}))))))):null))))))):ee().createElement("div",{className:"text-center py-8 text-gray-500"},(0,pe.__)("Pricelist not found","nggallery"))};function Lb(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return Fb(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Fb(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Fb(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,Fb(m,"constructor",s),Fb(s,"constructor",c),c.displayName="GeneratorFunction",Fb(s,a,"GeneratorFunction"),Fb(m),Fb(m,a,"Generator"),Fb(m,r,function(){return this}),Fb(m,"toString",function(){return"[object Generator]"}),(Lb=function(){return{w:o,m:d}})()}function Fb(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}Fb=function(e,t,n,r){function o(t,n){Fb(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Fb(e,t,n,r)}const Mb=function(){var e,t=(0,ge.useDispatch)(Br),n=Cs(),r=n.setCurrentId,a=n.currentTab,o=vo((0,$.useState)({customer:!0,date:!0}),1)[0],l=vo((0,$.useState)(new Set),2),i=l[0],c=l[1],s=vo((0,$.useState)(""),2),u=s[0],m=s[1],d=Cy(u,300),g=vo((0,$.useState)("date"),2),p=g[0],f=g[1],y=vo((0,$.useState)("desc"),2),h=y[0],b=y[1],v=vo((0,$.useState)(1),2),_=v[0],w=v[1],x=gi().data,E=(null==x?void 0:x.admin_table_per_page)||20,C=vo((0,$.useState)(!1),2),N=C[0],k=C[1],S=vo((0,$.useState)("bulk"),2),O=S[0],P=S[1],j=vo((0,$.useState)(!1),2),T=j[0],I=j[1],A=vo((0,$.useState)("select"),2),D=A[0],L=A[1],F=Pi({page:_,per_page:E,search:d,sort:h&&p?{customer:"title",date:"date"}[p]||"date":void 0,order:h||void 0,period:D}),M=F.data,R=F.isLoading,G=F.refetch;(0,$.useEffect)(function(){"pricelists"===a&&G()},[a,G]),(0,$.useEffect)(function(){w(1)},[d]),(0,$.useEffect)(function(){var e,t=(null==M||null===(e=M.pagination)||void 0===e?void 0:e.total_pages)||1;t>0&&_>t&&w(t)},[null==M||null===(e=M.pagination)||void 0===e?void 0:e.total_pages]);var B=function(e){if(!e)return"";var t=new Date(e),n=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),a=String(t.getDate()).padStart(2,"0"),o=t.getHours(),l=String(t.getMinutes()).padStart(2,"0"),i=o>=12?"pm":"am";return 0==(o%=12)&&(o=12),"".concat(n,"-").concat(r,"-").concat(a,", ").concat(o,":").concat(l).concat(i)},z=(0,$.useMemo)(function(){return((null==M?void 0:M.pricelists)||[]).map(function(e){return{id:e.id,customer:e.title||(0,pe.__)("No Title","nggallery"),date:B(e.date)}})},[M]);(0,$.useEffect)(function(){c(new Set),P("bulk"),k(!1)},[d,D,p,h]);var U=(0,$.useMemo)(function(){return[{key:"customer",label:(0,pe.__)("Pricelist Name","nggallery"),sortType:"backend",render:function(e){return ee().createElement("div",{className:"flex items-start gap-3"},ee().createElement("div",null,ee().createElement("button",{type:"button",className:"text-gray-900 text-sm font-medium hover:underline",onClick:function(){return r(e.id)}},e.customer)))}},{key:"date",label:(0,pe.__)("Date","nggallery"),sortType:"backend",render:function(e){return ee().createElement("span",{className:"text-sm text-gray-700"},e.date)}}]},[]);return ee().createElement("div",{className:"bg-white rounded-lg shadow-sm"},ee().createElement("div",{className:"flex flex-col sm:flex-row gap-3 sm:items-center mb-4"},ee().createElement("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-3"},i.size>0&&ee().createElement(kg,{isOpen:N,onClose:function(){return k(!1)},onToggle:function(){return k(!N)},activeClasses:"relative w-full sm:min-w-[140px] border border-gray-300 bg-gray-50 text-gray-700 px-4 py-2 h-10 rounded-md text-sm font-medium flex items-center justify-between",trigger:ee().createElement("button",{type:"button",className:"relative w-full sm:min-w-[140px] border border-gray-300 bg-white text-gray-700 hover:bg-gray-50 px-4 py-2 h-10 rounded-md text-sm font-medium flex items-center justify-between"},ee().createElement("span",null,(0,pe.__)("Bulk Actions","nggallery")),ee().createElement(rn,{className:"w-4 h-4 text-gray-400"}))},ee().createElement("div",{className:"w-44 py-1 space-y-0"},[{key:"duplicate",label:(0,pe.__)("Duplicate Selected","nggallery")},{key:"delete",label:(0,pe.__)("Delete Selected","nggallery")}].map(function(e){return ee().createElement("button",{key:e.key,className:"w-full text-left px-3 py-2 text-sm hover:bg-gray-100 block border-0 focus:outline-none focus:bg-gray-100 ".concat(O===e.key?"text-gray-900":"text-gray-700"),onClick:No(Lb().m(function n(){var r,a;return Lb().w(function(n){for(;;)switch(n.n){case 0:if(P(e.key),k(!1),0!==i.size){n.n=1;break}return n.a(2);case 1:r=Array.from(i),a=r.map(function(e){var t=z.find(function(t){return t.id===e});return{id:e,title:(null==t?void 0:t.customer)||""}}),"delete"===e.key?t.setActiveModal("deletePricelists",{pricelistIds:r,items:a,title:(0,pe.__)("Delete Pricelists","nggallery"),onConfirm:function(){var e=No(Lb().m(function e(){return Lb().w(function(e){for(;;)switch(e.n){case 0:c(new Set);case 1:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}()}):"duplicate"===e.key&&t.setActiveModal("duplicatePricelist",{pricelistIds:r,items:a,title:(0,pe.__)("Duplicate Pricelists","nggallery"),onConfirm:function(){var e=No(Lb().m(function e(){return Lb().w(function(e){for(;;)switch(e.n){case 0:c(new Set);case 1:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}()});case 2:return n.a(2)}},n)}))},e.label)}))),ee().createElement(kg,{isOpen:T,onClose:function(){return I(!1)},onToggle:function(){return I(!T)},activeClasses:"relative w-full sm:min-w-[140px] border border-gray-300 bg-gray-50 text-gray-700 px-4 h-10 rounded-md text-sm font-medium flex items-center justify-between",trigger:ee().createElement("button",{type:"button",className:"relative w-full sm:min-w-[140px] border border-gray-300 bg-white text-gray-700 hover:bg-gray-50 px-4 h-10 rounded-md text-sm font-medium flex items-center justify-between"},ee().createElement("span",{className:"flex items-center"},ee().createElement(pr,{className:"w-4 h-4 text-gray-400 mr-2"}),ee().createElement("span",null,"select"===D&&(0,pe.__)("All Dates","nggallery"),"this_month"===D&&(0,pe.__)("This Month","nggallery"),"last_month"===D&&(0,pe.__)("Last Month","nggallery"),"this_year"===D&&(0,pe.__)("This Year","nggallery"))),ee().createElement(rn,{className:"w-4 h-4 text-gray-400"}))},ee().createElement("div",{className:"w-44 py-1 space-y-0"},[{key:"select",label:(0,pe.__)("All Dates","nggallery")},{key:"this_month",label:(0,pe.__)("This Month","nggallery")},{key:"last_month",label:(0,pe.__)("Last Month","nggallery")},{key:"this_year",label:(0,pe.__)("This Year","nggallery")}].map(function(e){return ee().createElement("button",{key:e.key,className:"w-full text-left px-3 py-2 text-sm hover:bg-gray-100 block border-0 focus:outline-none focus:bg-gray-100 ".concat(D===e.key?"text-gray-900":"text-gray-700"),onClick:function(){L(e.key),I(!1),w(1)}},e.label)}))),ee().createElement("div",{className:"relative w-full sm:w-60"},ee().createElement("span",{className:"pointer-events-none absolute inset-y-0 left-3 flex items-center text-gray-400"},ee().createElement(wn,{className:"w-5 h-5"})),ee().createElement("input",{type:"text",placeholder:(0,pe.__)("Search Pricelists","nggallery"),className:"w-full border border-gray-300 rounded-md pl-10 pr-3 py-2 text-sm text-gray-700 placeholder:text-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500",value:u,onChange:function(e){return m(e.target.value)}}))),ee().createElement("div",{className:"flex-1"}),ee().createElement("button",{type:"button",className:"inline-flex items-center gap-2 rounded-md bg-green-500 text-white px-4 py-2 text-sm font-medium hover:bg-green-600 focus:outline-none focus:ring-2 focus:ring-green-500 flex-shrink-0",onClick:function(){return t.setActiveModal("pricelistForm",{onSuccess:function(){}})}},(0,pe.__)("Add New Pricelist","nggallery"),ee().createElement("span",{className:"inline-flex items-center justify-center w-5 h-5 rounded-full border border-white"},ee().createElement(ln,{className:"w-4 h-4"})))),ee().createElement(Ph,{isLoading:R,items:z,visibleColumns:o,selectedItems:i,onSelectAll:function(e){e?c(new Set(z.map(function(e){return e.id}))):(c(new Set),P("bulk"),k(!1))},onSelectItem:function(e){var t=new Set(i);t.has(e)?t.delete(e):t.add(e),c(t),0===t.size&&(P("bulk"),k(!1))},columns:U,onSort:function(e,t){f(t?e:null),b(t),w(1)},sortColumn:p,sortDirection:h,actionsHeaderLabel:(0,pe.__)("Action","nggallery"),actionCellRenderer:function(e){return ee().createElement("div",{className:"flex items-center gap-4 text-gray-500"},ee().createElement("button",{type:"button",className:"flex flex-col items-center text-blue-600 hover:text-blue-700",onClick:function(){t.setActiveModal("duplicatePricelist",{pricelistIds:[e.id],items:[{id:e.id,title:e.customer}],title:(0,pe.__)("Duplicate Pricelist","nggallery")})}},ee().createElement(yr,{className:"w-4 h-4 mb-1"}),ee().createElement("span",{className:"text-xs"},(0,pe.__)("Duplicate","nggallery"))),ee().createElement("button",{type:"button",className:"flex flex-col items-center text-red-600 hover:text-red-700",onClick:function(){var n;t.setActiveModal("deletePricelists",{pricelistIds:[e.id],items:[{id:e.id,title:e.customer}],title:(0,pe.__)("Delete Pricelist","nggallery"),onConfirm:(n=No(Lb().m(function e(){return Lb().w(function(e){for(;;)switch(e.n){case 0:c(new Set);case 1:return e.a(2)}},e)})),function(){return n.apply(this,arguments)})})}},ee().createElement(fr,{className:"w-4 h-4 mb-1"}),ee().createElement("span",{className:"text-xs"},(0,pe.__)("Delete","nggallery"))))},notFoundContent:ee().createElement("div",{className:"py-16"},ee().createElement("div",{className:"flex flex-col items-center justify-center text-center text-gray-500"},ee().createElement("div",{className:"mb-4"},ee().createElement(_r,{className:"w-16 h-16 opacity-60"})),ee().createElement("p",{className:"text-sm mb-2"},(0,pe.__)("No Pricelists so far!","nggallery")),ee().createElement("button",{type:"button",className:"inline-flex items-center gap-1 text-green-500 hover:text-green-600 text-sm font-medium",onClick:function(){return t.setActiveModal("pricelistForm",{onSuccess:function(){}})}},(0,pe.__)("Add New Pricelist","nggallery"),ee().createElement(ln,{className:"w-4 h-4"}))))}),(null==M?void 0:M.pagination)&&M.pagination.total_pages>1&&ee().createElement("div",{className:"border-t"},ee().createElement(Xf,{currentPage:_,totalPages:M.pagination.total_pages,perPage:M.pagination.per_page,total:M.pagination.total,onPageChange:w,itemLabel:(0,pe.__)("Pricelists","nggallery"),showItemCount:!0})))};function Rb(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return Gb(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Gb(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Gb(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,Gb(m,"constructor",s),Gb(s,"constructor",c),c.displayName="GeneratorFunction",Gb(s,a,"GeneratorFunction"),Gb(m),Gb(m,a,"Generator"),Gb(m,r,function(){return this}),Gb(m,"toString",function(){return"[object Generator]"}),(Rb=function(){return{w:o,m:d}})()}function Gb(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}Gb=function(e,t,n,r){function o(t,n){Gb(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Gb(e,t,n,r)}var Bb=function(e){return["proofings",e]},zb=function(){var e=No(Rb().m(function e(t){var n,r;return Rb().w(function(e){for(;;)switch(e.n){case 0:return r=null===(n=window.imagelyApp)||void 0===n?void 0:n.nonce,e.n=1,Oo()({path:"/imagely/v1/proofings/".concat(t),method:"DELETE",headers:{"X-WP-Nonce":r}});case 1:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}();function Ub(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return qb(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(qb(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,qb(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,qb(m,"constructor",s),qb(s,"constructor",c),c.displayName="GeneratorFunction",qb(s,a,"GeneratorFunction"),qb(m),qb(m,a,"Generator"),qb(m,r,function(){return this}),qb(m,"toString",function(){return"[object Generator]"}),(Ub=function(){return{w:o,m:d}})()}function qb(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}qb=function(e,t,n,r){function o(t,n){qb(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},qb(e,t,n,r)}const Qb=function(e){var t=e.isOpen,n=e.onClose,r=void 0===n?function(){}:n,a=e.items,o=e.onConfirm,l=void 0===o?function(){}:o,i=function(){var e=No(Ub().m(function e(){return Ub().w(function(e){for(;;)switch(e.n){case 0:if(a.length){e.n=1;break}return e.a(2);case 1:return e.n=2,Promise.all(a.map(function(e){return zb(e.id)}));case 2:l(),r();case 3:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}();return ee().createElement(Eo,{isOpen:t,onClose:r},ee().createElement("div",{className:"space-y-4"},ee().createElement("div",{className:"flex items-center gap-2 justify-center"},ee().createElement(rr,null)),ee().createElement("h2",{className:"text-xl font-bold text-center text-gray-900 mt-2"},(0,pe.__)("Delete Proofings","nggallery")),ee().createElement("p",{className:"text-sm text-gray-500 text-center"},1===a.length?(0,pe.__)("Are you sure you want to delete this proofing?","nggallery"):(0,pe.__)("Are you sure you want to delete ".concat(a.length," items?"),"nggallery")),1===a.length&&ee().createElement("div",{className:"text-sm text-gray-600 text-center"},ee().createElement("div",null,ee().createElement("strong",null,(0,pe.__)("Title","nggallery"),":")," ",a[0].title||""),ee().createElement("div",null,ee().createElement("strong",null,(0,pe.__)("Email","nggallery"),":")," ",a[0].email||"")),ee().createElement("p",{className:"text-sm text-red-500 text-center"},(0,pe.__)("This action cannot be undone.","nggallery")),ee().createElement("div",{className:"flex justify-center space-x-3 !mb-4"},ee().createElement("button",{type:"button",onClick:r,className:"px-8 py-2 font-medium text-gray-700 bg-white border border-gray-300 rounded-lg shadow hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"},(0,pe.__)("Cancel","nggallery")),ee().createElement("button",{type:"button",onClick:i,className:"px-8 py-2 font-bold text-white bg-green-500 border border-transparent rounded-lg shadow hover:bg-green-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"},(0,pe.__)("Delete","nggallery")))))};function Wb(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return Hb(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Hb(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Hb(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,Hb(m,"constructor",s),Hb(s,"constructor",c),c.displayName="GeneratorFunction",Hb(s,a,"GeneratorFunction"),Hb(m),Hb(m,a,"Generator"),Hb(m,r,function(){return this}),Hb(m,"toString",function(){return"[object Generator]"}),(Wb=function(){return{w:o,m:d}})()}function Hb(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}Hb=function(e,t,n,r){function o(t,n){Hb(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Hb(e,t,n,r)}const Vb=function(){var e,t,n,r,a=vo((0,$.useState)(1),2),o=a[0],l=a[1],i=gi().data,c=(null==i?void 0:i.admin_table_per_page)||20,s=vo((0,$.useState)(""),2),u=s[0],m=s[1],d=vo((0,$.useState)(""),2),g=d[0],p=d[1],f=vo((0,$.useState)(""),2),y=f[0],h=f[1],b=vo((0,$.useState)(new Set),2),v=b[0],_=b[1],w=vo((0,$.useState)(!1),2),x=w[0],E=w[1],C=vo((0,$.useState)(null),2),N=C[0],k=C[1],S=vo((0,$.useState)(""),2),O=S[0],P=S[1],j=(null==N?void 0:N.gallery_id)||(null==N||null===(e=N.proofed_gallery)||void 0===e?void 0:e.gallery_id)||0,T=Pl(j,{enabled:j>0}),I=(t={page:o,per_page:c,search:u,date_from:g,date_to:y},r=new URLSearchParams,null!=t&&t.page&&r.append("page",String(t.page)),null!=t&&t.per_page&&r.append("per_page",String(t.per_page)),null!=t&&t.search&&r.append("search",t.search),null!=t&&t.orderby&&r.append("orderby",t.orderby),null!=t&&t.order&&r.append("order",t.order),null!=t&&t.date_from&&r.append("date_from",t.date_from),null!=t&&t.date_to&&r.append("date_to",t.date_to),sl({queryKey:Bb(t||{}),queryFn:(n=No(Rb().m(function e(){var n,a,o,l,i;return Rb().w(function(e){for(;;)switch(e.n){case 0:return a=null===(n=window.imagelyApp)||void 0===n?void 0:n.nonce,o="/imagely/v1/proofings".concat(r.toString()?"?".concat(r.toString()):""),e.n=1,Oo()({path:o,method:"GET",headers:{"X-WP-Nonce":a}});case 1:return l=e.v,i=Array.isArray(null==l?void 0:l.proofings)?l.proofings.map(function(e){return{id:e.ID,title:e.title,email:e.email,customer_name:e.customer_name,hash:e.hash,referer:e.referer,proofed_gallery:e.proofed_gallery,date_created:e.date_created,date_modified:e.date_modified}}):[],e.a(2,{proofings:i,total:Number(null==l?void 0:l.total)||0,total_pages:Number(null==l?void 0:l.total_pages)||1,page:Number(null==l?void 0:l.page)||(null==t?void 0:t.page)||1,per_page:Number(null==l?void 0:l.per_page)||(null==t?void 0:t.per_page)||20})}},e)})),function(){return n.apply(this,arguments)}),staleTime:3e4,gcTime:6e5,retry:0,throwOnError:!1,refetchOnWindowFocus:!0,refetchOnMount:!1,placeholderData:function(e){return e}})),A=I.data,D=I.isLoading,L=I.refetch;(0,$.useEffect)(function(){L()},[u,g,y,o]),(0,$.useEffect)(function(){var e,t,n,r;if(N){var a=(null==N?void 0:N.proofed_gallery)||{},o=(null==a||null===(e=a.gallery)||void 0===e?void 0:e.title)||(null==a||null===(t=a.gallery)||void 0===t?void 0:t.name)||(null==a?void 0:a.gallery_title)||(null==a?void 0:a.gallery_name)||(null==a?void 0:a.title)||(null==a?void 0:a.name)||"";P(o||"");var l=(null==a||null===(n=a.gallery)||void 0===n?void 0:n.gid)||(null==a||null===(r=a.gallery)||void 0===r?void 0:r.id)||(null==a?void 0:a.gallery_id)||(null==a?void 0:a.gid)||null;if(!o&&l){var i,c=null===(i=window.imagelyApp)||void 0===i?void 0:i.nonce;Oo()({path:"/imagely/v1/galleries/".concat(l),method:"GET",headers:{"X-WP-Nonce":c}}).then(function(e){null!=e&&e.title&&P(e.title)}).catch(function(e){console.error("Error resolving gallery name:",e)})}}else P("")},[N]);var F=((null==A?void 0:A.proofings)||[]).filter(function(e){return!v.has(e.id)}),M=(null==A?void 0:A.total)||0,R=(null==A?void 0:A.total_pages)||1,G=vo((0,$.useState)(new Set),2),B=G[0],z=G[1],U=(0,$.useMemo)(function(){return{title:!0,date_created:!0,customer_name:!0,email:!0}},[]),q=(0,$.useMemo)(function(){return[{key:"title",label:"Title",sortType:"frontend"},{key:"date_created",label:"Date",sortType:"frontend",render:function(e){return e.date_created||e.date_modified||""}},{key:"customer_name",label:"Name",sortType:"frontend"},{key:"email",label:"Email",sortType:"frontend"}]},[]),Q=vo((0,$.useState)(!1),2),W=Q[0],H=Q[1],V=vo((0,$.useState)([]),2),K=V[0],X=V[1],Y=re(),Z=function(){var e=No(Wb().m(function e(){var t;return Wb().w(function(e){for(;;)switch(e.n){case 0:return t=K.map(function(e){return e.id}),_(function(e){return new Set([].concat(ko(Array.from(e)),ko(t)))}),e.n=1,Promise.all(K.map(function(e){return zb(e.id)}));case 1:return H(!1),X([]),z(new Set),e.n=2,Y.invalidateQueries({queryKey:["proofings"]});case 2:return l(1),e.n=3,L();case 3:_(new Set);case 4:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}();return ee().createElement(ee().Fragment,null,!N&&ee().createElement("div",{className:"mb-4 flex flex-col sm:grid sm:grid-cols-2 gap-3"},ee().createElement("input",{type:"text",className:"border rounded px-3 py-2",placeholder:(0,pe.__)("Search by name or email…","nggallery"),value:u,onChange:function(e){m(e.target.value),l(1)}}),ee().createElement("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-2 sm:justify-end"},ee().createElement("input",{type:"date",className:"border rounded px-3 py-2 w-full",value:g,onChange:function(e){var t=e.target.value;p(t),y&&t&&y<t&&h(t),l(1)}}),ee().createElement("input",{type:"date",className:"border rounded px-3 py-2 w-full",value:y,min:g||void 0,onChange:function(e){var t=e.target.value;h(g&&t&&t<g?g:t),l(1)}}),B.size>0&&ee().createElement(kg,{isOpen:x,onClose:function(){return E(!1)},onToggle:function(){return E(!x)},trigger:ee().createElement("button",{type:"button",className:"border border-gray-300 bg-white text-gray-700 hover:bg-gray-50 px-4 sm:px-4 py-2 h-10 rounded-md text-sm font-medium whitespace-nowrap w-full sm:w-auto flex items-center justify-between"},(0,pe.__)("Bulk Actions","nggallery"),ee().createElement(rn,{className:"w-4 h-4 text-gray-400"}))},ee().createElement("div",{className:"py-1"},ee().createElement("button",{className:"block w-full text-left px-4 py-2 text-sm text-red-700 hover:bg-red-100",onClick:function(){var e=F.filter(function(e){return B.has(e.id)});0!==e.length&&(X(e),H(!0))}},(0,pe.__)("Delete Selected","nggallery")))))),N?function(){var e,t;if(!N)return null;var n=Array.isArray(null==N||null===(e=N.proofed_gallery)||void 0===e?void 0:e.image_list)?N.proofed_gallery.image_list:[],r=(null===(t=T.data)||void 0===t?void 0:t.images)||[],a={};r.forEach(function(e){a[Number(e.pid)]=e});var o=n.map(function(e){var t,n=a[Number(e)];return{id:Number(e),thumb:(null==n?void 0:n.thumb_url)||"",title:(null==n?void 0:n.alttext)||(null==n||null===(t=n.meta_data)||void 0===t?void 0:t.title)||"",filename:(null==n?void 0:n.filename)||""}}),l=[{key:"thumb",label:"Image",sortType:"frontend",render:function(e){return e.thumb?ee().createElement("img",{src:e.thumb,alt:e.title||String(e.id),className:"w-12 h-12 object-cover rounded"}):ee().createElement("span",{className:"text-xs text-gray-500"},(0,pe.__)("N/A","nggallery"))}},{key:"title",label:"Title",sortType:"frontend"},{key:"filename",label:"Filename",sortType:"frontend"}];return ee().createElement("div",{className:"bg-white rounded-lg border p-4"},ee().createElement("div",{className:"flex items-center justify-between mb-4"},ee().createElement("button",{className:"border rounded px-4 py-2 cursor-pointer bg-white hover:bg-gray-50",onClick:function(){return k(null)}},(0,pe.__)("Back to List","nggallery")),ee().createElement("div",{className:"text-sm text-gray-500"},N.date_created||N.date_modified)),ee().createElement("h3",{className:"text-lg font-semibold text-gray-900 mb-2"},N.title),ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4"},ee().createElement("div",{className:"space-y-2"},ee().createElement("div",null,ee().createElement("span",{className:"font-medium"},(0,pe.__)("Customer Name","nggallery"),":")," ",N.customer_name||"-"),ee().createElement("div",null,ee().createElement("span",{className:"font-medium"},(0,pe.__)("Email","nggallery"),":")," ",N.email||"-"),ee().createElement("div",null,ee().createElement("span",{className:"font-medium"},(0,pe.__)("Gallery Source URL","nggallery"),":")," ",N.referer?ee().createElement("a",{href:N.referer,target:"_blank",rel:"noreferrer",className:"text-blue-600 hover:underline"},N.referer):"-"),ee().createElement("div",null,ee().createElement("span",{className:"font-medium"},(0,pe.__)("Gallery","nggallery"),":")," ",O||(0,pe.__)("Unknown","nggallery")),ee().createElement("div",null,ee().createElement("span",{className:"font-medium"},(0,pe.__)("Images Selected","nggallery"),":")," ",n.length)),ee().createElement("div",{className:"space-y-2"})),ee().createElement("div",{className:"mt-6"},ee().createElement(Ph,{isLoading:T.isLoading,items:o,visibleColumns:{thumb:!0,title:!0,filename:!0},selectedItems:new Set,onSelectAll:function(){},onSelectItem:function(){},columns:l,onSort:function(){},sortColumn:null,sortDirection:null,actionsHeaderLabel:"",showSelection:!1})))}():ee().createElement(ee().Fragment,null,ee().createElement(Ph,{isLoading:!!D,items:F,visibleColumns:U,selectedItems:B,onSelectAll:function(e){z(e?new Set(F.map(function(e){return e.id})):new Set)},onSelectItem:function(e){var t=new Set(B);t.has(e)?t.delete(e):t.add(e),z(t)},columns:q,onSort:function(){},sortColumn:null,sortDirection:null,actionsHeaderLabel:(0,pe.__)("Actions","nggallery"),actionCellRenderer:function(e){return ee().createElement("button",{className:"text-green-600 hover:text-green-700 cursor-pointer rounded border px-2 py-1 bg-white hover:bg-green-50",onClick:function(){return k(e)}},(0,pe.__)("View Request","nggallery"))}}),R>1&&ee().createElement("div",{className:"border-t"},ee().createElement(Xf,{currentPage:o,totalPages:R,perPage:c,total:M,onPageChange:l,itemLabel:(0,pe.__)("Proofing Requests","nggallery"),showItemCount:!0}))),ee().createElement(Qb,{isOpen:W,onClose:function(){H(!1),X([])},items:K,onConfirm:Z}))},Kb=function(e){var t=e.activeTab,n=e.activeSubTab,r=e.currentId,a=e.onSubTabChange;return"general"===t?ee().createElement("div",null,ee().createElement(zh,{activeTab:t,activeSubTab:n,onSubTabChange:a}),function(){switch(n){case"studio-details":default:return ee().createElement(mb,null);case"email-setup":return ee().createElement(Yh,null);case"payment-setup":return ee().createElement(ab,null);case"page-setup":return ee().createElement(tb,null);case"printlab-integration":return ee().createElement(cb,null)}}()):ee().createElement("div",null,"general"!==t&&!("pricelists"===t&&r)&&ee().createElement("div",{className:"mb-6"},ee().createElement("h1",{className:"text-2xl font-semibold text-gray-900 mb-2"},t.charAt(0).toUpperCase()+t.slice(1))),function(){switch(t){case"orders":return ee().createElement(Cb,null);case"proofing":return ee().createElement(Vb,null);case"pricelists":return r?ee().createElement(Db,{pricelistId:r}):ee().createElement(Mb,null);case"coupons":return ee().createElement(Qh,null);case"other-options":return ee().createElement(Ob,null);default:return ee().createElement("div",null,ee().createElement(zh,{activeTab:"general",activeSubTab:"studio-details",onSubTabChange:a}),ee().createElement(mb,null))}}())},Xb=function(){var e,t,n=Gh(),r=n.subTabStatus,a=n.requirements,o=Cs(),l=o.setCurrentTab,i=o.setCurrentSubTab,c=vo(ee().useState(!1),2),s=c[0],u=c[1],m=(0,$.useMemo)(function(){var e=["studio-details","email-setup","payment-setup","page-setup"],t=["printlab-integration"],n=function(e){return e.filter(function(e){return"complete"===r[e]}).length},o=e.length,l=n(e),i=t.length,c=n(t),s=["ecommerce_pages","studio_address","payment_gateway","pro_lightbox","pricelist_created","pricelist_associated","has_ssl","image_settings","image_resizing","active_license","has_printlab_items","card_on_file"],u=0;if(a){var m=s.length,d=s.reduce(function(e,t){return e+(a[t]?1:0)},0);u=Math.round(d/Math.max(m,1)*100)}else{var g=o+i,p=l+c;u=Math.round(p/Math.max(g,1)*100)}return{ecommerceTotal:o,ecommerceDone:l,printlabTotal:i,printlabDone:c,overallPct:u}},[r,a]),d=function(e,t){return e>=t?"bg-green-500":0===e?"bg-red-500":"bg-yellow-400"};return ee().createElement("div",{className:"space-y-6"},ee().createElement("div",{className:"bg-white rounded-lg shadow-sm p-4"},ee().createElement("div",{className:"flex items-center justify-between mb-3"},ee().createElement("h3",{className:"text-sm font-medium text-gray-900"},(0,pe.__)("Ecommerce Setup","nggallery")),ee().createElement("span",{className:"text-xs text-gray-500"},"".concat(m.ecommerceDone,"/").concat(m.ecommerceTotal," ").concat((0,pe.__)("steps completed","nggallery")))),ee().createElement("div",{className:"flex items-center justify-between"},ee().createElement("div",{className:"w-2 h-2 rounded-full ".concat(d(m.ecommerceDone,m.ecommerceTotal))}),m.ecommerceDone<m.ecommerceTotal&&ee().createElement("button",{className:"text-xs text-green-700 hover:text-green-800 font-medium",onClick:function(){l("general"),i("studio-details")}},(0,pe.__)("Complete Now","nggallery")))),ee().createElement("div",{className:"bg-white rounded-lg shadow-sm p-4"},ee().createElement("div",{className:"flex items-center justify-between mb-3"},ee().createElement("h3",{className:"text-sm font-medium text-gray-900"},(0,pe.__)("Automated Print Fulfillment","nggallery")),ee().createElement("span",{className:"text-xs text-gray-500"},"".concat(m.printlabDone,"/").concat(m.printlabTotal," ").concat((0,pe.__)("steps completed","nggallery")))),ee().createElement("div",{className:"flex items-center justify-between"},ee().createElement("div",{className:"w-2 h-2 rounded-full ".concat(d(m.printlabDone,m.printlabTotal))}),m.printlabDone<m.printlabTotal&&ee().createElement("button",{className:"text-xs text-green-700 hover:text-green-800 font-medium",onClick:function(){l("general"),i("printlab-integration")}},(0,pe.__)("Complete Now","nggallery")))),ee().createElement("div",{className:"bg-white rounded-lg shadow-sm p-4"},ee().createElement("div",{className:"flex items-start space-x-3"},ee().createElement("div",{className:"w-12 h-12"},(t=(e=2*Math.PI*21)*(1-m.overallPct/100),ee().createElement("svg",{width:48,height:48,className:"block"},ee().createElement("circle",{cx:24,cy:24,r:21,stroke:"#E5E7EB",strokeWidth:6,fill:"none"}),ee().createElement("circle",{cx:24,cy:24,r:21,stroke:"#10B981",strokeWidth:6,fill:"none",strokeDasharray:"".concat(e," ").concat(e),strokeDashoffset:t,strokeLinecap:"round",transform:"rotate(-90 ".concat(24," ").concat(24,")")}),ee().createElement("text",{x:"50%",y:"50%",dominantBaseline:"middle",textAnchor:"middle",fontSize:"10",fill:"#065F46"},m.overallPct,"%")))),ee().createElement("div",{className:"flex-1"},ee().createElement("h4",{className:"text-sm font-medium text-gray-900 mb-1"},(0,pe.__)("Complete your Ecommerce Setup","nggallery")),ee().createElement("button",{className:"text-xs text-green-700 hover:text-green-800 font-medium",onClick:function(){return u(!0)}},(0,pe.__)("View Pending","nggallery"))))),ee().createElement(Eo,{isOpen:s,onClose:function(){return u(!1)},title:(0,pe.__)("Pending Tasks","nggallery")},ee().createElement("div",{className:"space-y-4 text-sm"},a?ee().createElement("div",{className:"space-y-2"},Object.entries({ecommerce_pages:(0,pe.__)("Checkout/Thank-you/Cancel/Digital Download pages set","nggallery"),studio_address:(0,pe.__)("Studio details completed","nggallery"),payment_gateway:(0,pe.__)("At least one payment gateway configured","nggallery"),pro_lightbox:(0,pe.__)("Pro Lightbox enabled","nggallery"),pricelist_created:(0,pe.__)("Pricelist created","nggallery"),pricelist_associated:(0,pe.__)("A gallery associated to a pricelist","nggallery"),has_ssl:(0,pe.__)("SSL/HTTPS enabled","nggallery"),image_settings:(0,pe.__)("Image backups enabled","nggallery"),image_resizing:(0,pe.__)("Image resizing on upload enabled","nggallery"),active_license:(0,pe.__)("Active license","nggallery"),has_printlab_items:(0,pe.__)("Pricelist has print lab items","nggallery"),card_on_file:(0,pe.__)("Credit card on file (PrintLab)","nggallery")}).filter(function(e){var t=vo(e,1)[0];return a&&!a[t]}).map(function(e){var t=vo(e,2),n=t[0],r=t[1];return ee().createElement("div",{key:n,className:"flex items-center justify-between"},ee().createElement("span",{className:"text-gray-800"},r),ee().createElement("span",{className:"w-2 h-2 rounded-full ".concat("card_on_file"===n?"bg-yellow-400":"bg-red-500")}))})):[{id:"studio-details",label:(0,pe.__)("Studio Details","nggallery")},{id:"email-setup",label:(0,pe.__)("Email Setup","nggallery")},{id:"payment-setup",label:(0,pe.__)("Payment Setup","nggallery")},{id:"page-setup",label:(0,pe.__)("Page Setup","nggallery")},{id:"printlab-integration",label:(0,pe.__)("PrintLab Integration","nggallery")}].filter(function(e){return"complete"!==r[e.id]}).map(function(e){return ee().createElement("div",{key:e.id,className:"flex items-center justify-between"},ee().createElement("span",{className:"text-gray-800"},e.label),ee().createElement("span",{className:"w-2 h-2 rounded-full ".concat("warning"===r[e.id]?"bg-yellow-400":"bg-red-500")}))}),ee().createElement("div",{className:"pt-2 flex gap-2 justify-end"},ee().createElement("button",{className:"px-3 py-1.5 text-xs rounded bg-gray-100 hover:bg-gray-200",onClick:function(){return u(!1)}},(0,pe.__)("Close","nggallery"))))))},Yb=function(e){var t=e.activeTab,n=e.onTabChange;return ee().createElement("div",{className:"bg-white rounded-lg shadow-sm p-4"},ee().createElement("nav",{className:"space-y-2"},Bh().map(function(e){return ee().createElement("button",{key:e.id,onClick:function(){return n(e.id)},className:"w-full flex items-center space-x-3 p-3 text-left rounded-lg transition-colors ".concat(t===e.id?"bg-green-50 text-green-700 font-medium border border-green-200":"text-gray-600 hover:bg-gray-50 hover:text-gray-900")},ee().createElement("div",{className:"flex-shrink-0 ".concat(t===e.id?"text-green-600":"text-gray-400")},e.icon),ee().createElement("span",{className:"text-sm"},e.label))})))},Zb=function(){var e=Cs(),t=e.currentTab,n=e.currentSubTab,r=e.currentId,a=e.setCurrentTab,o=e.setCurrentSubTab,l=e.setCurrentId;return(0,$.useEffect)(function(){Bh().map(function(e){return e.id}).includes(t)||a("general")},[t,a]),(0,$.useEffect)(function(){"general"!==t||n||o("studio-details")},[t,n,o]),ee().createElement("div",{className:"flex-1 flex flex-col lg:flex-row overflow-hidden border rounded-lg border-gray-50 p-4 bg-white"},ee().createElement("div",{className:"flex-shrink-0 w-full lg:w-64 border rounded-lg border-gray-50 p-4 space-y-4 mb-4 lg:mb-0"},ee().createElement(Yb,{activeTab:t,onTabChange:function(e){"pricelists"!==t&&"orders"!==t||!r||e===t||l(null),a(e);var n=Bh().find(function(t){return t.id===e});null!=n&&n.subTabs&&n.subTabs.length>0?o(n.subTabs[0].id):o(null)}}),ee().createElement(Xb,null)),ee().createElement("div",{className:"flex-1 p-6 overflow-auto border rounded-lg border-gray-50 lg:ml-4"},ee().createElement(Kb,{activeTab:t,activeSubTab:n,currentId:r,onSubTabChange:function(e){o(e)}})))};var Jb=function(){return[{key:"gid",label:(0,pe.__)("ID","nggallery"),filterable:!0,visibleByDefault:!0,sortType:"backend",locked:!0},{key:"title",label:(0,pe.__)("Gallery Title","nggallery"),filterable:!0,visibleByDefault:!0,sortType:"backend",locked:!0},{key:"thumbnail",label:(0,pe.__)("Thumbnail","nggallery"),filterable:!1,visibleByDefault:!0,sortType:!1,locked:!0},{key:"shortcode",label:(0,pe.__)("Shortcode","nggallery"),filterable:!1,visibleByDefault:!0,sortType:!1,locked:!0},{key:"is_private",label:(0,pe.__)("Privacy","nggallery"),filterable:!0,visibleByDefault:!1,sortType:"backend",locked:!0},{key:"is_ecommerce_enabled",label:(0,pe.__)("eCommerce","nggallery"),filterable:!0,visibleByDefault:!1,sortType:"backend"},{key:"no_of_images",label:(0,pe.__)("Images","nggallery"),filterable:!0,visibleByDefault:!1,sortType:!1},{key:"date_created",label:(0,pe.__)("Created Date","nggallery"),filterable:!0,visibleByDefault:!1,sortType:"backend"},{key:"date_modified",label:(0,pe.__)("Modified Date","nggallery"),filterable:!0,visibleByDefault:!1,sortType:"backend"}]},$b=Object.fromEntries(Jb().map(function(e){return[e.key,e.visibleByDefault]}));const ev=function(){var e=(0,ge.useDispatch)(Br),t=window.imagelyApp.assetsURL+"/images/HeaderImage.png",n=window.imagelyApp.assetsURL+"/images/HeaderArrow.png";return React.createElement("div",{className:"mb-8 bg-white rounded-lg shadow-sm p-4 sm:p-6 lg:p-8 flex flex-col lg:flex-row lg:justify-between lg:items-center relative overflow-hidden"},React.createElement("div",{className:"w-full lg:max-w-[50%] relative z-10 mb-6 lg:mb-0"},React.createElement("h1",{className:"text-2xl sm:text-3xl font-semibold mb-2 text-gray-900"},(0,pe.__)("Welcome to Imagely","nggallery")),React.createElement("p",{className:"text-sm sm:text-base text-gray-600 mb-4 sm:mb-6"},(0,pe.__)("Let's get started by adding images to create your gallery","nggallery")),React.createElement("div",{className:"flex flex-col sm:flex-row sm:items-center gap-4"},React.createElement("button",{className:"bg-green-500 text-white hover:bg-green-600 px-4 sm:px-6 py-2.5 h-auto rounded-md text-sm font-medium w-full sm:w-auto transition-colors",onClick:function(){Jp()?e.setActiveModal("imageUploader"):e.setActiveModal("licenseRequired",{action:"create new galleries"})}},(0,pe.__)("Add a New Gallery","nggallery")),React.createElement("div",{className:"hidden sm:block w-12 h-12 relative -top-5"},React.createElement("img",{src:n,alt:"Decorative arrow",className:"w-full h-full object-contain"})))),React.createElement("div",{className:"w-full lg:absolute lg:inset-y-0 lg:right-0 lg:w-1/2 lg:h-full flex items-center justify-center"},React.createElement("img",{src:t,alt:"Gallery illustration",className:"w-full h-48 sm:h-64 lg:h-full object-contain lg:relative lg:left-20"})))};function tv(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function nv(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?tv(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):tv(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function rv(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return av(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(av(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,av(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,av(m,"constructor",s),av(s,"constructor",c),c.displayName="GeneratorFunction",av(s,a,"GeneratorFunction"),av(m),av(m,a,"Generator"),av(m,r,function(){return this}),av(m,"toString",function(){return"[object Generator]"}),(rv=function(){return{w:o,m:d}})()}function av(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}av=function(e,t,n,r){function o(t,n){av(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},av(e,t,n,r)}var ov=function(e){var t=e.src,n=e.alt,r=vo((0,$.useState)(!1),2),a=r[0],o=r[1],l=Ns({width:48,height:48,text:"NO IMAGE",fontSize:8}),i=!t||""===t.trim()||a?l:t;return ee().createElement("img",{src:i,alt:n,className:"w-12 h-12 object-cover rounded-md border border-gray-200",onError:function(){return o(!0)}})};const lv=function(e){var t=e.galleries,n=e.visibleColumns,r=e.selectedGalleries,a=e.onSelectAll,o=e.onSelectGallery,l=e.onSort,i=e.sortColumn,c=e.sortDirection,s=e.onDelete,u=e.isLoading,m=e.hasActiveSearch,d=void 0!==m&&m,g=(0,ge.useDispatch)(Br),p=function(){var e=No(rv().m(function e(t){var n;return rv().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,navigator.clipboard.writeText(t);case 1:g.showNotice("success",(0,pe.__)("Shortcode copied to clipboard!","nggallery")),e.n=3;break;case 2:e.p=2,e.v,(n=document.createElement("textarea")).value=t,document.body.appendChild(n),n.select();try{document.execCommand("copy"),g.showNotice("success",(0,pe.__)("Shortcode copied to clipboard!","nggallery"))}catch(e){g.showNotice("error",(0,pe.__)("Failed to copy shortcode to clipboard","nggallery"))}document.body.removeChild(n);case 3:return e.a(2)}},e,null,[[0,2]])}));return function(t){return e.apply(this,arguments)}}(),f=d?ee().createElement("div",{className:"py-16"},ee().createElement("div",{className:"flex flex-col items-center justify-center text-center text-gray-500"},ee().createElement("p",{className:"text-sm mb-2"},(0,pe.__)("No results found for your search.","nggallery")))):ee().createElement("div",{className:"py-16"},ee().createElement("div",{className:"flex flex-col items-center justify-center text-center text-gray-500"},ee().createElement("div",{className:"mb-4"},ee().createElement(_r,{className:"w-16 h-16 opacity-60"})),ee().createElement("p",{className:"text-sm mb-2"},(0,pe.__)("No Galleries so far!","nggallery")),ee().createElement("button",{type:"button",className:"inline-flex items-center gap-1 text-green-500 hover:text-green-600 text-sm font-medium",onClick:function(){Jp()?g.setActiveModal("imageUploader"):g.setActiveModal("licenseRequired",{action:"create new galleries"})}},(0,pe.__)("Add New Gallery","nggallery"),ee().createElement(ln,{className:"w-4 h-4"}))));return ee().createElement(Ph,{isLoading:u,items:t,visibleColumns:n,selectedItems:r,onSelectAll:a,onSelectItem:o,columns:Jb().map(function(e){return nv(nv({},e),{},{render:function(t){return function(e,t){switch(t){case"gid":return ee().createElement("span",{className:"text-gray-600 text-sm"},e.id);case"title":return ee().createElement("button",{onClick:function(){return function(e){e.canManage?(g.setCurrentId(e.id),g.navigateTo("imagely-add-new","images",e.id)):g.showNotice("warning",(0,pe.__)("You do not have permission to edit this gallery","nggallery"))}(e)},className:"font-medium text-sm ".concat(!1===e.canManage?"text-gray-400 cursor-not-allowed":"text-gray-900 hover:underline"),disabled:!1===e.canManage,title:!1===e.canManage?(0,pe.__)("You do not have permission to edit this gallery","nggallery"):void 0},e.galleryTitle);case"thumbnail":return ee().createElement(ov,{src:e.thumbnail,alt:e.galleryTitle});case"shortcode":return ee().createElement("button",{onClick:function(){return p(e.shortcode)},className:"bg-gray-100 px-3 py-1 rounded text-sm font-mono text-gray-600 hover:bg-gray-200 transition-colors cursor-pointer border-none",title:(0,pe.__)("Click to copy shortcode","nggallery")},e.shortcode);case"no_of_images":return ee().createElement("span",{className:"text-gray-600 text-sm"},e.count);case"is_ecommerce_enabled":return ee().createElement("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ".concat(e.eCommerce?"bg-green-100 text-green-800":"bg-gray-100 text-gray-800")},e.eCommerce?(0,pe.__)("Yes"):(0,pe.__)("No"));case"is_private":return ee().createElement("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ".concat(e.is_private?"bg-yellow-100 text-yellow-800":"bg-blue-100 text-blue-800")},e.is_private?(0,pe.__)("Private","nggallery"):(0,pe.__)("Public","nggallery"));case"date_created":return ee().createElement("span",{className:"text-gray-600 text-sm"},e.created);case"date_modified":return ee().createElement("span",{className:"text-gray-600 text-sm"},e.modified);default:return null}}(t,e.key)}})}),onSort:l,sortColumn:i,sortDirection:c,notFoundContent:f,actionsHeaderLabel:(0,pe.__)("Actions","nggallery"),actionCellRenderer:function(e){return ee().createElement("div",{className:"flex flex-col items-center text-gray-500"},ee().createElement("button",{type:"button",className:"flex flex-col items-center text-red-600 hover:text-red-700",onClick:function(){return function(e){e.canManage?s([e]):g.showNotice("warning",(0,pe.__)("You do not have permission to delete this gallery","nggallery"))}(e)}},ee().createElement(fr,{className:"w-4 h-4 mb-1"}),ee().createElement("span",{className:"text-xs"},(0,pe.__)("Delete","nggallery"))))}})};function iv(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return cv(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(cv(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,cv(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,cv(m,"constructor",s),cv(s,"constructor",c),c.displayName="GeneratorFunction",cv(s,a,"GeneratorFunction"),cv(m),cv(m,a,"Generator"),cv(m,r,function(){return this}),cv(m,"toString",function(){return"[object Generator]"}),(iv=function(){return{w:o,m:d}})()}function cv(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}cv=function(e,t,n,r){function o(t,n){cv(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},cv(e,t,n,r)}const sv=function(){var e=vo((0,$.useState)(""),2),t=e[0],n=e[1],r=Cy(t,300),a=vo(Oy("galleries",$b),2),o=a[0],l=a[1],i=vo((0,$.useState)(new Set),2),c=i[0],s=i[1],u=vo((0,$.useState)("date_modified"),2),m=u[0],d=u[1],g=vo((0,$.useState)("desc"),2),p=g[0],f=g[1],y=vo((0,$.useState)(1),2),h=y[0],b=y[1],v=vo((0,$.useState)(!1),2),_=v[0],w=v[1],x=gi().data,E=(null==x?void 0:x.admin_table_per_page)||20,C=ee().useMemo(function(){return{page:h,per_page:E,search:r||void 0,sort:m||void 0,order:p||void 0}},[h,E,r,m,p]),N=Sl(C),k=N.data,S=N.isLoading,O=N.error,P=ee().useMemo(function(){return(null==k?void 0:k.galleries)||[]},[null==k?void 0:k.galleries]),j=ee().useMemo(function(){return(null==k?void 0:k.pagination)||{total:0,total_pages:1,per_page:E,current_page:1}},[null==k?void 0:k.pagination,E]),T=Tl(),I=function(){var e,t=re(),n=Fo("set-watermark");return gl({mutationFn:(e=No(vl().m(function e(t){var r,a,o,l,i,c,s,u;return vl().w(function(e){for(;;)switch(e.p=e.n){case 0:return r=t.galleryIds,a=t.onProgress,e.n=1,Dl(r);case 1:o=e.v,l=o.length,i=0,c=0,s=0;case 2:if(!(s<o.length)){e.n=8;break}return e.p=3,e.n=4,n(o[s]);case 4:i++,e.n=6;break;case 5:e.p=5,u=e.v,console.error("Failed to set watermark on image ".concat(o[s],":"),u),c++;case 6:a&&a(s+1,l);case 7:s++,e.n=2;break;case 8:return e.a(2,{successCount:i,failureCount:c,total:l})}},e,null,[[3,5]])})),function(t){return e.apply(this,arguments)}),onSuccess:function(){t.invalidateQueries({queryKey:["gallery"]})}})}(),A=function(){var e,t=re(),n=Fo("import-metadata");return gl({mutationFn:(e=No(vl().m(function e(t){var r,a,o,l,i,c,s,u;return vl().w(function(e){for(;;)switch(e.p=e.n){case 0:return r=t.galleryIds,a=t.onProgress,e.n=1,Dl(r);case 1:o=e.v,l=o.length,i=0,c=0,s=0;case 2:if(!(s<o.length)){e.n=8;break}return e.p=3,e.n=4,n(o[s]);case 4:i++,e.n=6;break;case 5:e.p=5,u=e.v,console.error("Failed to import metadata for image ".concat(o[s],":"),u),c++;case 6:a&&a(s+1,l);case 7:s++,e.n=2;break;case 8:return e.a(2,{successCount:i,failureCount:c,total:l})}},e,null,[[3,5]])})),function(t){return e.apply(this,arguments)}),onSuccess:function(){t.invalidateQueries({queryKey:["gallery"]})}})}(),D=function(){var e,t=re(),n=Fo("recover");return gl({mutationFn:(e=No(vl().m(function e(t){var r,a,o,l,i,c,s,u;return vl().w(function(e){for(;;)switch(e.p=e.n){case 0:return r=t.galleryIds,a=t.onProgress,e.n=1,Dl(r);case 1:o=e.v,l=o.length,i=0,c=0,s=0;case 2:if(!(s<o.length)){e.n=8;break}return e.p=3,e.n=4,n(o[s]);case 4:i++,e.n=6;break;case 5:e.p=5,u=e.v,console.error("Failed to recover image ".concat(o[s],":"),u),c++;case 6:a&&a(s+1,l);case 7:s++,e.n=2;break;case 8:return e.a(2,{successCount:i,failureCount:c,total:l})}},e,null,[[3,5]])})),function(t){return e.apply(this,arguments)}),onSuccess:function(){t.invalidateQueries({queryKey:["gallery"]})}})}(),L=(0,ge.useDispatch)(Br),F=$o(),M=F.showSuccess,R=F.showError,G=F.showWarning,B=function(e,t,n){e.failureCount>0?G("".concat(n," ").concat(e.successCount," ").concat((0,pe.__)("of","nggallery")," ").concat(e.total," ").concat((0,pe.__)("images","nggallery"))):M("".concat(t," ").concat(e.total," ").concat((0,pe.__)("images","nggallery")))},z=function(e,t,n,r,a,o){return function(l){var i;L.setActiveModal("bulkOperationConfirmation",{galleries:l,operationType:e,onClose:function(){return L.setActiveModal(null)},onConfirm:(i=No(iv().m(function i(c){var u,m,d;return iv().w(function(i){for(;;)switch(i.p=i.n){case 0:return i.p=0,u={galleryIds:l.map(function(e){return e.id})},o&&c&&(u.onProgress=c),i.n=1,t.mutateAsync(u);case 1:m=i.v,s(new Set),B(m,n,r),i.n=3;break;case 2:i.p=2,d=i.v,console.error("".concat(e," error:"),d),R(a);case 3:return i.a(2)}},i,null,[[0,2]])})),function(e){return i.apply(this,arguments)})})}};(0,$.useEffect)(function(){b(1)},[r]),(0,$.useEffect)(function(){s(new Set)},[h,E,r,m,p]),(0,$.useEffect)(function(){j.total_pages>0&&h>j.total_pages&&b(j.total_pages)},[j.total_pages,h]),(0,$.useEffect)(function(){var e=function(){var e=new URLSearchParams(window.location.search);if("1"===e.get("create_gallery")){Jp()?L.setActiveModal("imageUploader"):L.setActiveModal("licenseRequired",{action:"create new galleries"}),e.delete("create_gallery");var t="".concat(window.location.pathname,"?").concat(e.toString());window.history.replaceState({},"",t)}};e();var t=function(){e()};return window.addEventListener("imagely-navigation",t),function(){window.removeEventListener("imagely-navigation",t)}},[L]);var U=ee().useCallback(function(e){b(e),window.scrollTo({top:0,behavior:"smooth"})},[]),q=function(e){var t;L.setActiveModal("deleteGalleries",{galleries:e,onClose:function(){return L.setActiveModal(null)},onConfirm:(t=No(iv().m(function t(){var n,r,a;return iv().w(function(t){for(;;)switch(t.p=t.n){case 0:if(!_&&!T.isPending){t.n=1;break}return t.a(2);case 1:return w(!0),t.p=2,t.n=3,Promise.allSettled(e.map(function(e){return T.mutateAsync(e.id)}));case 3:n=t.v,r=n.some(function(e){var t,n;return"rejected"===e.status&&!(404===(null===(t=e.reason)||void 0===t?void 0:t.status)||404===(null===(n=e.reason)||void 0===n||null===(n=n.response)||void 0===n?void 0:n.status))}),s(new Set),L.setActiveModal(null),r?L.showNotice("error",(0,pe.__)("Some galleries could not be deleted","nggallery")):L.showNotice("success",(0,pe.__)("Galleries deleted successfully","nggallery")),t.n=5;break;case 4:t.p=4,a=t.v,console.error("Delete error:",a),L.showNotice("error",(0,pe.__)("Failed to delete galleries","nggallery"));case 5:return t.p=5,w(!1),t.f(5);case 6:return t.a(2)}},t,null,[[2,4,5,6]])})),function(){return t.apply(this,arguments)})})},Q=z("watermark",I,(0,pe.__)("Successfully applied watermark to","nggallery"),(0,pe.__)("Watermark applied to","nggallery"),(0,pe.__)("Failed to set watermark on galleries","nggallery"),!0),W=z("metadata",A,(0,pe.__)("Successfully imported metadata for","nggallery"),(0,pe.__)("Metadata imported for","nggallery"),(0,pe.__)("Failed to import metadata for galleries","nggallery"),!0),H=z("recovery",D,(0,pe.__)("Successfully recovered","nggallery")+" "+(0,pe.__)("images from backup","nggallery"),(0,pe.__)("Recovered","nggallery"),(0,pe.__)("Failed to recover images from backup","nggallery"),!0);return O?ee().createElement("div",{className:"p-6 min-h-screen"},ee().createElement(ev,null),ee().createElement("div",{className:"bg-red-50 border border-red-200 rounded-md p-4"},ee().createElement("div",{className:"flex"},ee().createElement("div",{className:"flex-shrink-0"},ee().createElement(yn,{className:"h-5 w-5 text-red-400"})),ee().createElement("div",{className:"ml-3"},ee().createElement("h3",{className:"text-sm font-medium text-red-800"},(0,pe.__)("Error loading galleries","nggallery")),ee().createElement("div",{className:"mt-2 text-sm text-red-700"},O instanceof Error?O.message:(0,pe.__)("An unexpected error occurred","nggallery")))))):ee().createElement("div",{className:"p-6 min-h-screen"},ee().createElement(ev,null),ee().createElement(Ey,{title:(0,pe.__)("Manage Galleries","nggallery"),searchTerm:t,setSearchTerm:n,onSearch:function(){},visibleColumns:o,setVisibleColumns:l,selectedItems:c,items:P,columns:ko(Jb()),itemType:"gallery",searchPlaceholder:(0,pe.__)("Search Galleries","nggallery"),onDelete:q,onSetWatermark:Q,onCreateThumbnails:function(e){L.setActiveModal("bulkCreateThumbnailsGalleries",{galleryIds:e.map(function(e){return e.id}),onClose:function(){return L.setActiveModal(null)},onConfirm:function(){s(new Set)}})},onResizeImages:function(e){L.setActiveModal("bulkResizeImagesGalleries",{galleryIds:e.map(function(e){return e.id}),onClose:function(){return L.setActiveModal(null)},onConfirm:function(){s(new Set)}})},onImportMetadata:W,onRecoverFromBackup:H}),ee().createElement(lv,{isLoading:S,galleries:P,visibleColumns:o,selectedGalleries:c,onSelectAll:function(e){s(e?new Set(P.map(function(e){return e.id})):new Set)},onSelectGallery:function(e){var t=new Set(c);t.has(e)?t.delete(e):t.add(e),s(t)},onSort:function(e,t){d(t?e:null),f(t),b(1)},sortColumn:m,sortDirection:p,onDelete:q,hasActiveSearch:!!r}),!S&&(j.total>0||r)&&ee().createElement(Xf,{currentPage:h,totalPages:j.total_pages,perPage:j.per_page,total:j.total,onPageChange:U,itemLabel:r?(0,pe.__)("Results","nggallery"):(0,pe.__)("Items","nggallery"),showItemCount:!0}))},uv=function(e){var t=e.currentTab,n=e.onTabChange,r=e.children,a=e.sidebarComponent,o=e.title,l=e.containerClassName,i=void 0===l?"":l,c=e.contentClassName,s=void 0===c?"md:col-span-3":c,u=e.sidebarClassName,m=void 0===u?"":u,d=e.isLoading,g=void 0!==d&&d,p=e.error,f=void 0===p?null:p;return ee().createElement("div",{className:i},ee().createElement("div",{className:"max-w-7xl mx-auto"},o&&ee().createElement("div",{className:"mb-6"},ee().createElement("h1",{className:"text-2xl font-bold text-gray-900"},o)),ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-6"},ee().createElement("div",{className:m},ee().createElement(a,{activeTab:t,onTabChange:n})),ee().createElement("div",{className:s},ee().createElement(Xp,{currentTab:t,onTabChange:n,isLoading:g,error:f,containerClassName:"",contentClassName:"",headerComponent:function(){return null}},r)))))};function mv(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return dv(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(dv(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,dv(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,dv(m,"constructor",s),dv(s,"constructor",c),c.displayName="GeneratorFunction",dv(s,a,"GeneratorFunction"),dv(m),dv(m,a,"Generator"),dv(m,r,function(){return this}),dv(m,"toString",function(){return"[object Generator]"}),(mv=function(){return{w:o,m:d}})()}function dv(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}dv=function(e,t,n,r){function o(t,n){dv(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},dv(e,t,n,r)}const gv=function(){var e=vo((0,$.useState)(!0),2),t=e[0],r=e[1],a=vo((0,$.useState)({}),2),o=a[0],l=a[1],i=(0,ge.useDispatch)(Br);(0,$.useEffect)(function(){var e=function(){var e=No(mv().m(function e(){var t,n;return mv().w(function(e){for(;;)switch(e.p=e.n){case 0:return r(!0),e.p=1,e.n=2,Oo()({path:"/imagely/v1/system-info",method:"GET"});case 2:t=e.v,l({php_version:t.php_version||"Unknown",wordpress_version:t.wordpress_version||"Unknown",gd_version:t.gd_version||"Not available",imagick_version:t.imagick_version||"Not available",memory_limit:t.memory_limit||"Unknown",max_upload_size:t.max_upload_size||"Unknown",server_software:t.server_software||"Unknown",plugin_version:t.plugin_version||"Unknown",php_os:t.php_os||"Unknown",php_sapi:t.php_sapi||"Unknown",mysql_version:t.mysql_version||"Unknown",mysql_type:t.mysql_type||"Unknown",curl_version:t.curl_version||"Not available",openssl_version:t.openssl_version||"Not available",exif_enabled:t.exif_enabled||"Unknown",iptc_enabled:t.iptc_enabled||"Unknown",mbstring_enabled:t.mbstring_enabled||"Unknown",zip_enabled:t.zip_enabled||"Unknown",fileinfo_enabled:t.fileinfo_enabled||"Unknown",post_max_size:t.post_max_size||"Unknown",max_execution_time:t.max_execution_time||"Unknown",max_input_vars:t.max_input_vars||"Unknown",upload_max_filesize:t.upload_max_filesize||"Unknown",allow_url_fopen:t.allow_url_fopen||"Unknown",wp_debug:t.wp_debug||"Unknown",wp_debug_log:t.wp_debug_log||"Unknown",wp_memory_limit:t.wp_memory_limit||"Unknown",site_url:t.site_url||"Unknown",home_url:t.home_url||"Unknown",is_multisite:t.is_multisite||"Unknown",active_theme:t.active_theme||"Unknown",ngg_options_version:t.ngg_options_version||"Unknown",image_library_preference:t.image_library_preference||"Unknown",thumbnail_quality:t.thumbnail_quality||"Unknown",backup_images:t.backup_images||"Unknown",galleries_count:t.galleries_count||0,images_count:t.images_count||0,wp_content_dir:t.wp_content_dir||"Unknown",upload_dir:t.upload_dir||"Unknown",ngg_gallery_path:t.ngg_gallery_path||"Unknown",timezone:t.timezone||"Unknown",locale:t.locale||"Unknown",permalink_structure:t.permalink_structure||"Unknown",show_legacy_admin_pages:t.show_legacy_admin_pages||"Unknown",activate_legacy_block:t.activate_legacy_block||"Unknown"}),e.n=4;break;case 3:e.p=3,n=e.v,console.error("❌ Failed to load system info:",n),i.showNotice("error",(0,pe.__)("Failed to load system information. Please refresh the page.","nggallery"));case 4:return e.p=4,r(!1),e.f(4);case 5:return e.a(2)}},e,null,[[1,3,4,5]])}));return function(){return e.apply(this,arguments)}}();e()},[i]);var c=function(){var e=No(mv().m(function e(){var t;return mv().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,navigator.clipboard.writeText(JSON.stringify(o,null,2));case 1:i.showNotice("success",(0,pe.__)("System information copied to clipboard!","nggallery")),e.n=3;break;case 2:e.p=2,e.v,(t=document.createElement("textarea")).value=JSON.stringify(o,null,2),document.body.appendChild(t),t.select();try{document.execCommand("copy"),i.showNotice("success",(0,pe.__)("System information copied to clipboard!","nggallery"))}catch(e){i.showNotice("error",(0,pe.__)("Failed to copy system information to clipboard","nggallery"))}document.body.removeChild(t);case 3:return e.a(2)}},e,null,[[0,2]])}));return function(){return e.apply(this,arguments)}}();return ee().createElement("div",{className:"space-y-4"},ee().createElement(nf,{title:(0,pe.__)("System Information","nggallery"),defaultExpanded:!0},ee().createElement("div",{className:"space-y-4"},ee().createElement("div",{className:"flex justify-between items-center"},ee().createElement("p",{className:"text-sm text-gray-600"},(0,pe.__)("System information for debugging and support","nggallery")),ee().createElement("button",{onClick:c,className:"px-3 py-1 text-sm bg-gray-100 text-gray-700 rounded-md hover:bg-gray-200"},(0,pe.__)("Copy to Clipboard","nggallery"))),t?ee().createElement("div",{className:"text-center py-8"},ee().createElement("div",{className:"inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900"}),ee().createElement("p",{className:"mt-2 text-gray-600"},(0,pe.__)("Loading system information...","nggallery"))):ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6"},Object.entries(n(n(n(n(n(n(n(n({},(0,pe.__)("Plugin Version","nggallery"),o.plugin_version),(0,pe.__)("WordPress Version","nggallery"),o.wordpress_version),(0,pe.__)("PHP Version","nggallery"),o.php_version),(0,pe.__)("GD Version","nggallery"),o.gd_version),(0,pe.__)("ImageMagick Version","nggallery"),o.imagick_version),(0,pe.__)("Memory Limit","nggallery"),o.memory_limit),(0,pe.__)("Max Upload Size","nggallery"),o.max_upload_size),(0,pe.__)("Server Software","nggallery"),o.server_software)).map(function(e){var t=vo(e,2),n=t[0],r=t[1];return ee().createElement("div",{key:n,className:"bg-gray-50 p-3 rounded-md"},ee().createElement("dt",{className:"text-sm font-medium text-gray-700"},n),ee().createElement("dd",{className:"text-sm text-gray-900 mt-1"},r))})))))};function pv(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return fv(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(fv(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,fv(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,fv(m,"constructor",s),fv(s,"constructor",c),c.displayName="GeneratorFunction",fv(s,a,"GeneratorFunction"),fv(m),fv(m,a,"Generator"),fv(m,r,function(){return this}),fv(m,"toString",function(){return"[object Generator]"}),(pv=function(){return{w:o,m:d}})()}function fv(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}fv=function(e,t,n,r){function o(t,n){fv(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},fv(e,t,n,r)}const yv=function(){var e=vo((0,$.useState)([]),2),n=e[0],r=e[1],a=vo((0,$.useState)(""),2),o=a[0],l=a[1],i=vo((0,$.useState)(!0),2),c=i[0],s=i[1],u=vo((0,$.useState)(!1),2),m=u[0],d=u[1],g=vo((0,$.useState)(!1),2),p=g[0],f=g[1],y=vo((0,$.useState)(null),2),h=y[0],b=y[1],v=$o(),_=v.showSuccess,w=v.showError,x=v.showWarning;(0,$.useEffect)(function(){var e=function(){var e=No(pv().m(function e(){var t;return pv().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,Oo()({path:"/imagely/v1/convert-gallery/post-types",method:"GET"});case 1:t=e.v,r(t),t.length>0&&l(t[0].value),e.n=3;break;case 2:e.p=2,e.v,w((0,pe.__)("Failed to load post types. Please refresh the page.","nggallery"));case 3:return e.p=3,s(!1),e.f(3);case 4:return e.a(2)}},e,null,[[0,2,3,4]])}));return function(){return e.apply(this,arguments)}}();e()},[w]);var E=(0,$.useCallback)(function(e){l(e.target.value)},[]),C=(0,$.useCallback)(function(){o?f(!0):x((0,pe.__)("Please select a post type first.","nggallery"))},[o,x]),N=(0,$.useCallback)(No(pv().m(function e(){var n,r,a,l,i,c,s,u,m,g,p,y,h;return pv().w(function(e){for(;;)switch(e.p=e.n){case 0:return f(!1),d(!0),b({total:0,current:0,successful:0,failed:0,failedPosts:[]}),e.p=1,e.n=2,Oo()({path:"/imagely/v1/convert-gallery/bulk-start",method:"POST",data:{selected_posttype:o}});case 2:if((n=e.v).posts&&0!==n.posts.length){e.n=3;break}return x(n.message||(0,pe.__)("No WordPress galleries found in the selected post type.","nggallery")),d(!1),b(null),e.a(2);case 3:r=n.posts,b(function(e){var t,n,a,o;return{total:r.length,current:null!==(t=null==e?void 0:e.current)&&void 0!==t?t:0,successful:null!==(n=null==e?void 0:e.successful)&&void 0!==n?n:0,failed:null!==(a=null==e?void 0:e.failed)&&void 0!==a?a:0,failedPosts:null!==(o=null==e?void 0:e.failedPosts)&&void 0!==o?o:[]}}),a=0,l=0,i=[],c=0;case 4:if(!(c<r.length)){e.n=10;break}return s=r[c],e.p=5,e.n=6,Oo()({path:"/imagely/v1/convert-gallery/bulk-process",method:"POST",data:{post_id:s}});case 6:(u=e.v).success?a++:(l++,u.edit_url&&i.push({id:s,editUrl:u.edit_url})),e.n=8;break;case 7:e.p=7,y=e.v,l++,g="Unknown error occurred",y instanceof Error?g=y.message:"object"===t(y)&&null!==y&&"message"in y&&(g=String(y.message)),console.error("[Gallery Conversion] Failed to process post ".concat(s,":"),y),i.push({id:s,editUrl:"".concat((null===(m=window.imagelyApp)||void 0===m?void 0:m.adminUrl)||"/wp-admin/","post.php?post=").concat(s,"&action=edit"),errorMessage:g});case 8:b({total:r.length,current:c+1,successful:a,failed:l,failedPosts:i});case 9:c++,e.n=4;break;case 10:0===l?_((0,pe.sprintf)((0,pe.__)("Successfully converted galleries in %d posts.","nggallery"),a)):0===a?w((0,pe.__)("Failed to convert any galleries. Please check the posts manually.","nggallery")):x((0,pe.sprintf)((0,pe.__)("Converted %1$d posts successfully, %2$d posts failed.","nggallery"),a,l)),e.n=12;break;case 11:e.p=11,h=e.v,p=h instanceof Error?h.message:(0,pe.__)("Bulk conversion failed. Please try again.","nggallery"),w(p);case 12:return e.p=12,d(!1),e.f(12);case 13:return e.a(2)}},e,null,[[5,7],[1,11,12,13]])})),[o,_,w,x]),k=(0,$.useCallback)(function(){f(!1)},[]),S=(0,$.useCallback)(function(){b(null)},[]),O=h&&h.total>0?Math.round(h.current/h.total*100):0;return ee().createElement("div",{className:"space-y-4"},p&&ee().createElement("div",{className:"fixed inset-0 z-50 overflow-y-auto"},ee().createElement("div",{className:"fixed inset-0 bg-black bg-opacity-50 transition-opacity duration-300 ease-in-out"}),ee().createElement("div",{className:"flex min-h-screen items-center justify-center p-4 text-center sm:p-0"},ee().createElement("div",{className:"relative transform overflow-hidden rounded-lg bg-white text-left shadow-xl transition-all duration-300 ease-in-out sm:my-8 sm:w-full sm:max-w-lg"},ee().createElement("div",{className:"bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4"},ee().createElement("div",{className:"sm:flex sm:items-start"},ee().createElement("div",{className:"mx-auto flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-full bg-green-100 sm:mx-0 sm:h-10 sm:w-10"},ee().createElement("svg",{className:"h-6 w-6 text-green-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},ee().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7h12m0 0l-4-4m4 4l-4 4m0 6H4m0 0l4 4m-4-4l4-4"}))),ee().createElement("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left"},ee().createElement("h3",{className:"text-lg font-medium leading-6 text-gray-900"},(0,pe.__)("Convert WordPress Galleries","nggallery")),ee().createElement("div",{className:"mt-2"},ee().createElement("p",{className:"text-sm text-gray-500"},(0,pe.__)("This will search for all WordPress galleries in the selected post type and convert them to Imagely galleries. The original gallery content will be backed up in post meta.","nggallery")),ee().createElement("p",{className:"text-sm text-gray-500 mt-2"},ee().createElement("strong",null,(0,pe.__)("Note:","nggallery"))," ",(0,pe.__)("This process cannot be automatically undone. Make sure you have a backup of your content before proceeding.","nggallery")))))),ee().createElement("div",{className:"bg-gray-50 px-4 py-3 sm:flex sm:flex-row-reverse sm:px-6"},ee().createElement("button",{type:"button",onClick:N,className:"inline-flex w-full justify-center rounded-md border border-transparent bg-green-600 px-4 py-2 text-base font-medium text-white shadow-sm hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-green-500 focus:ring-offset-2 sm:ml-3 sm:w-auto sm:text-sm"},(0,pe.__)("Start Conversion","nggallery")),ee().createElement("button",{type:"button",onClick:k,className:"mt-3 inline-flex w-full justify-center rounded-md border border-gray-300 bg-white px-4 py-2 text-base font-medium text-gray-700 shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-green-500 focus:ring-offset-2 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm"},(0,pe.__)("Cancel","nggallery")))))),ee().createElement(nf,{title:(0,pe.__)("Bulk Convert WordPress Galleries","nggallery"),defaultExpanded:!0},ee().createElement("div",{className:"space-y-4"},ee().createElement("p",{className:"text-sm text-gray-600"},(0,pe.__)("Automatically convert WordPress galleries (both classic shortcodes and Gutenberg blocks) to Imagely galleries. Select a post type below to scan for WordPress galleries.","nggallery")),c?ee().createElement("div",{className:"flex items-center space-x-2 py-4"},ee().createElement("svg",{className:"animate-spin h-5 w-5 text-green-600",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},ee().createElement("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),ee().createElement("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})),ee().createElement("span",{className:"text-gray-500"},(0,pe.__)("Loading post types...","nggallery"))):ee().createElement("div",{className:"space-y-4"},ee().createElement("div",{className:"max-w-xs"},ee().createElement(sc,{id:"post-type-select",name:"post-type-select",value:o,onChange:E,label:(0,pe.__)("Post Type","nggallery"),help:(0,pe.__)("Select the post type to scan for WordPress galleries.","nggallery")},n.map(function(e){return ee().createElement("option",{key:e.value,value:e.value},e.label)}))),ee().createElement("button",{onClick:C,disabled:m||!o,className:"bg-green-600 text-white hover:bg-green-700 focus:ring-green-500 px-4 py-2 rounded-md font-medium text-sm transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed"},m?(0,pe.__)("Converting...","nggallery"):(0,pe.__)("Convert All Galleries","nggallery"))))),h&&ee().createElement(nf,{title:(0,pe.__)("Conversion Progress","nggallery"),defaultExpanded:!0},ee().createElement("div",{className:"space-y-4"},ee().createElement("div",null,ee().createElement("div",{className:"flex justify-between text-sm text-gray-600 mb-1"},ee().createElement("span",null,h.current," / ",h.total," ",(0,pe.__)("posts processed","nggallery")),ee().createElement("span",null,O,"%")),ee().createElement("div",{className:"w-full bg-gray-200 rounded-full h-2.5"},ee().createElement("div",{className:"bg-green-600 h-2.5 rounded-full transition-all duration-300",style:{width:"".concat(O,"%")}}))),ee().createElement("div",{className:"grid grid-cols-2 gap-4"},ee().createElement("div",{className:"bg-green-50 rounded-lg p-3 border border-green-100"},ee().createElement("div",{className:"text-2xl font-bold text-green-600"},h.successful),ee().createElement("div",{className:"text-sm text-green-700"},(0,pe.__)("Successful","nggallery"))),ee().createElement("div",{className:"bg-red-50 rounded-lg p-3 border border-red-100"},ee().createElement("div",{className:"text-2xl font-bold text-red-600"},h.failed),ee().createElement("div",{className:"text-sm text-red-700"},(0,pe.__)("Failed","nggallery")))),h.failedPosts.length>0&&ee().createElement("div",null,ee().createElement(cc,null,(0,pe.__)("Failed Posts (click to edit manually):","nggallery")),ee().createElement("ul",{className:"space-y-2 mt-2"},h.failedPosts.map(function(e){return ee().createElement("li",{key:e.id,className:"text-sm"},ee().createElement("a",{href:e.editUrl,target:"_blank",rel:"noopener noreferrer",className:"text-green-600 hover:text-green-800 hover:underline"},(0,pe.__)("Post ID:","nggallery")," ",e.id),e.errorMessage&&ee().createElement("span",{className:"text-red-600 ml-2"},"— ",e.errorMessage))}))),!m&&h.current===h.total&&ee().createElement("button",{onClick:S,className:"bg-white text-gray-700 border border-gray-300 hover:bg-gray-50 px-4 py-2 rounded-md font-medium text-sm transition-colors duration-200"},(0,pe.__)("Start New Conversion","nggallery")))),ee().createElement(nf,{title:(0,pe.__)("What Gets Converted?","nggallery"),defaultExpanded:!0},ee().createElement("div",{className:"space-y-3"},ee().createElement("ul",{className:"list-disc list-inside space-y-2 text-sm text-gray-600"},ee().createElement("li",null,(0,pe.__)("WordPress Gallery blocks (core/gallery) in the block editor","nggallery")),ee().createElement("li",null,(0,pe.__)("Classic [gallery] shortcodes in posts and pages","nggallery")),ee().createElement("li",null,(0,pe.__)("Images are imported to NextGEN Gallery with metadata preserved","nggallery")),ee().createElement("li",null,(0,pe.__)("Original gallery content is backed up in post meta for reference","nggallery"))))),ee().createElement(nf,{title:(0,pe.__)("Convert Individual Galleries","nggallery"),defaultExpanded:!0},ee().createElement("p",{className:"text-sm text-gray-600"},(0,pe.__)('You can also convert individual WordPress galleries directly from the block editor. Select a WordPress Gallery block and look for the "Convert to Imagely" option in the block settings panel on the right sidebar.',"nggallery"))))},hv=function(e){var t,n,r,a,o,l=e.settings,i=e.onSettingsChange,c=vo((0,$.useState)(!1),2),s=c[0],u=c[1],m=function(e,t){i&&i(e,t)};return ee().createElement("div",{className:"space-y-4"},ee().createElement(nf,{title:(0,pe.__)("Hidden Settings","nggallery"),defaultExpanded:!1},ee().createElement("div",{className:"space-y-4"},ee().createElement("p",{className:"text-sm text-gray-600"},(0,pe.__)("This is a hidden settings tab. Settings here are not visible in the main menu and can only be accessed via direct URL.","nggallery")),ee().createElement("p",{className:"text-sm text-gray-600"},(0,pe.__)("Access this tab via: ","nggallery"),ee().createElement("code",{className:"bg-gray-100 px-2 py-1 rounded text-xs"},"admin.php?page=imagely-nextgen-gallery#settings&tab=hidden")))),ee().createElement(nf,{title:(0,pe.__)("Legacy Options","nggallery"),defaultExpanded:!0},ee().createElement("div",{className:"space-y-4"},ee().createElement("div",null,ee().createElement(fs,{id:"ngg_show_old_settings",name:"ngg_show_old_settings",checked:ni(null==l?void 0:l.ngg_show_old_settings)||!1,onChange:function(e){return m("ngg_show_old_settings",e.target.checked)},label:(0,pe.__)("Show legacy admin pages","nggallery"),help:(0,pe.__)("Enable access to the old NextGEN Gallery admin interface alongside the new one","nggallery")})),ee().createElement("div",null,ee().createElement(fs,{id:"ngg_installation_type",name:"ngg_installation_type",checked:"existing"===((null==l?void 0:l.ngg_installation_type)||"fresh"),onChange:function(e){return m("ngg_installation_type",e.target.checked?"existing":"fresh")},label:(0,pe.__)("Activate legacy block","nggallery"),help:(0,pe.__)("Show the old NextGEN Gallery Gutenberg block alongside the new one. Useful for existing installations with legacy galleries.","nggallery")})))),ee().createElement(nf,{title:(0,pe.__)("Related Images","nggallery"),defaultExpanded:!0},ee().createElement("div",{className:"space-y-4"},ee().createElement("div",null,ee().createElement(fs,{id:"activateTags",name:"activateTags",checked:ni(null==l?void 0:l.activateTags),onChange:function(e){return m("activateTags",e.target.checked)},label:(0,pe.__)("Show Related Images on Posts?","nggallery"),help:(0,pe.__)("When enabled, related images will be appended to each post by matching the posts tags/categories to image tags","nggallery")})),ni(null==l?void 0:l.activateTags)&&ee().createElement("div",{className:"ml-6 space-y-4"},ee().createElement("div",{className:"w-full max-w-sm"},ee().createElement(sc,{id:"appendType",name:"appendType",value:(null==l?void 0:l.appendType)||"category",onChange:function(e){return m("appendType",e.target.value)},label:(0,pe.__)("How should related images be matched?","nggallery")},ee().createElement("option",{value:"category"},(0,pe.__)("Category","nggallery")),ee().createElement("option",{value:"tags"},(0,pe.__)("Tags","nggallery")))),ee().createElement("div",{className:"w-full max-w-sm"},ee().createElement(uc,{type:"number",id:"maxImages",name:"maxImages",value:(null==l||null===(t=l.maxImages)||void 0===t?void 0:t.toString())||"0",onChange:function(e){return m("maxImages",parseInt(e.target.value)||0)},label:(0,pe.__)("Max number of related images","nggallery"),help:(0,pe.__)("0 = unlimited","nggallery"),min:0})),ee().createElement("div",null,ee().createElement(cc,null,(0,pe.__)("Related images heading","nggallery")),ee().createElement("input",{type:"text",value:(null==l?void 0:l.relatedHeading)||"",onChange:function(e){return m("relatedHeading",e.target.value)},className:"bg-white border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-green-500 focus:border-green-500 block w-full max-w-lg p-2.5 hover:border-gray-400 transition-colors"}))))),ee().createElement(nf,{title:(0,pe.__)("Image Deletion","nggallery"),defaultExpanded:!0},ee().createElement("div",{className:"space-y-4"},ee().createElement("div",null,ee().createElement(fs,{id:"deleteImg",name:"deleteImg",checked:(null==l?void 0:l.deleteImg)||!1,onChange:function(e){return m("deleteImg",e.target.checked)},label:(0,pe.__)("Delete image files","nggallery"),help:(0,pe.__)("Delete files when removing images from galleries","nggallery")})))),ee().createElement(nf,{title:(0,pe.__)("Image Backup","nggallery"),defaultExpanded:!0},ee().createElement("div",{className:"space-y-4"},ee().createElement("div",null,ee().createElement(fs,{id:"imgBackup",name:"imgBackup",checked:(null==l?void 0:l.imgBackup)||!1,onChange:function(e){return m("imgBackup",e.target.checked)},label:(0,pe.__)("Create backup of original images","nggallery"),help:(0,pe.__)("Backup original images before resizing or applying watermarks","nggallery")})))),ee().createElement(nf,{title:(0,pe.__)("Auto Resize Images","nggallery"),defaultExpanded:!0},ee().createElement("div",{className:"space-y-4"},ee().createElement("div",null,ee().createElement(fs,{id:"imgAutoResize",name:"imgAutoResize",checked:(null==l?void 0:l.imgAutoResize)||!1,onChange:function(e){return m("imgAutoResize",e.target.checked)},label:(0,pe.__)("Automatically resize images after upload","nggallery"),help:(0,pe.__)("It is recommended that your images be resized to be web friendly","nggallery")})),(null==l?void 0:l.imgAutoResize)&&ee().createElement("div",{className:"ml-6 grid grid-cols-1 md:grid-cols-3 gap-4"},ee().createElement("div",null,ee().createElement(uc,{type:"number",id:"imgWidth",name:"imgWidth",value:(null==l||null===(n=l.imgWidth)||void 0===n?void 0:n.toString())||"800",onChange:function(e){return m("imgWidth",parseInt(e.target.value)||0)},label:(0,pe.__)("Max width (pixels)","nggallery"),min:1})),ee().createElement("div",null,ee().createElement(uc,{type:"number",id:"imgHeight",name:"imgHeight",value:(null==l||null===(r=l.imgHeight)||void 0===r?void 0:r.toString())||"600",onChange:function(e){return m("imgHeight",parseInt(e.target.value)||0)},label:(0,pe.__)("Max height (pixels)","nggallery"),min:1})),ee().createElement("div",null,ee().createElement(sc,{id:"imgQuality",name:"imgQuality",value:(null==l||null===(a=l.imgQuality)||void 0===a?void 0:a.toString())||"85",onChange:function(e){return m("imgQuality",parseInt(e.target.value))},label:(0,pe.__)("Image quality","nggallery")},Array.from({length:50},function(e,t){return 100-t}).map(function(e){return ee().createElement("option",{key:e,value:e},e,"%")})))))),ee().createElement(nf,{title:(0,pe.__)("Thumbnail Fixed Dimension","nggallery"),defaultExpanded:!0},ee().createElement("div",{className:"space-y-4"},ee().createElement("div",null,ee().createElement(fs,{id:"thumbfix",name:"thumbfix",checked:(null==l?void 0:l.thumbfix)||!1,onChange:function(e){return m("thumbfix",e.target.checked)},label:(0,pe.__)("Set fixed dimension?","nggallery"),help:(0,pe.__)("Ignore the aspect ratio, no portrait thumbnails?","nggallery")})))),ee().createElement(nf,{title:(0,pe.__)("FontAwesome","nggallery"),defaultExpanded:!0},ee().createElement("div",{className:"space-y-4"},ee().createElement("div",null,ee().createElement(fs,{id:"disable_fontawesome",name:"disable_fontawesome",checked:(null==l?void 0:l.disable_fontawesome)||!1,onChange:function(e){return m("disable_fontawesome",e.target.checked)},label:(0,pe.__)("Do not enqueue FontAwesome","nggallery"),help:(0,pe.__)("Warning: your theme or another plugin must provide FontAwesome or your gallery displays may appear incorrectly","nggallery")})))),ee().createElement(nf,{title:(0,pe.__)("Developer Options","nggallery"),defaultExpanded:!0},ee().createElement("div",{className:"space-y-4"},ee().createElement("div",null,ee().createElement(fs,{id:"ngg_debug_mode",name:"ngg_debug_mode",checked:ni(null==l?void 0:l.ngg_debug_mode)||!1,onChange:function(e){return m("ngg_debug_mode",e.target.checked)},label:(0,pe.__)("Enable debug mode","nggallery"),help:(0,pe.__)("Load unminified JavaScript and CSS files for debugging purposes. This will slow down your site.","nggallery")})))),ee().createElement(nf,{title:(0,pe.__)("Admin Table Pagination","nggallery"),defaultExpanded:!0},ee().createElement("div",{className:"space-y-4"},ee().createElement("div",{className:"w-full max-w-sm"},ee().createElement(uc,{type:"number",id:"admin_table_per_page",name:"admin_table_per_page",value:(null==l||null===(o=l.admin_table_per_page)||void 0===o?void 0:o.toString())||"20",onChange:function(e){return m("admin_table_per_page",parseInt(e.target.value)||20)},label:(0,pe.__)("Items per page","nggallery"),help:(0,pe.__)("Number of items to display per page in admin tables (galleries, albums, tags, orders, etc.)","nggallery"),min:1,max:200})))),ee().createElement(nf,{title:(0,pe.__)("Features","nggallery"),defaultExpanded:!0},ee().createElement("div",{className:"space-y-4"},ee().createElement("div",null,ee().createElement(fs,{id:"addon_show_dribbble",name:"addon_show_dribbble",checked:void 0===(null==l?void 0:l.addon_show_dribbble)||ni(l.addon_show_dribbble),onChange:function(e){return m("addon_show_dribbble",e.target.checked)},label:(0,pe.__)("Dribbble feature","nggallery"),help:(0,pe.__)("Control whether the Dribbble feature appears in the Features page","nggallery")})),ee().createElement("div",{onMouseDown:function(e){var t=(e.ctrlKey||e.metaKey)&&e.shiftKey;u(t),t||(e.preventDefault(),e.stopPropagation())}},ee().createElement(fs,{id:"addon_show_tiktok",name:"addon_show_tiktok",checked:void 0===(null==l?void 0:l.addon_show_tiktok)||ni(l.addon_show_tiktok),onChange:function(e){s?(m("addon_show_tiktok",e.target.checked),u(!1)):e.preventDefault()},label:(0,pe.__)("TikTok feature","nggallery"),help:(0,pe.__)("Control whether the TikTok feature appears in the Features page","nggallery")})),ee().createElement("div",null,ee().createElement(fs,{id:"addon_show_google_analytics",name:"addon_show_google_analytics",checked:void 0===(null==l?void 0:l.addon_show_google_analytics)||ni(l.addon_show_google_analytics),onChange:function(e){return m("addon_show_google_analytics",e.target.checked)},label:(0,pe.__)("Google Analytics addon","nggallery"),help:(0,pe.__)("Control whether the Google Analytics addon appears in the Addons page","nggallery")})))))},bv=function(e){var t=e.settings,n=e.onSettingsChange,r=(0,ge.useDispatch)(Br),a="plus"===zr||"pro"===zr,o=function(){r.setActiveModal("upgrade",{feature:"image animations"})},l=function(e,t){a?n&&n(e,t):o()},i=function(e){return function(t){if(!a)return t.preventDefault(),void o();l(e,t.target.checked)}},c=function(e){return function(t){a?l(e,t.target.value):o()}},s=function(e){return function(t){a?l(e,parseInt(t.target.value)||0):o()}};return t?ee().createElement("div",{className:"space-y-4"},ee().createElement(nf,{title:(0,pe.__)("Animation Settings","nggallery"),defaultExpanded:!0},ee().createElement("div",{className:"space-y-6"},ee().createElement("div",{className:"space-y-4"},ee().createElement("h3",{className:"text-base font-medium text-gray-900"},(0,pe.__)("Image Animations","nggallery")),a?ee().createElement(fs,{id:"animate_images_enable",name:"animate_images_enable",checked:t.animate_images_enable||!1,onChange:i("animate_images_enable"),label:(0,pe.__)("Animate images","nggallery"),help:(0,pe.__)("Add animations to images when they first load","nggallery")}):ee().createElement("div",{className:"relative"},ee().createElement("div",{className:"opacity-50 pointer-events-none"},ee().createElement(fs,{id:"animate_images_enable",name:"animate_images_enable",checked:t.animate_images_enable||!1,onChange:function(){},label:(0,pe.__)("Animate images","nggallery"),help:(0,pe.__)("Add animations to images when they first load","nggallery")})),ee().createElement("div",{className:"absolute inset-0 cursor-pointer",onClick:o,title:(0,pe.__)("Requires NextGEN Gallery Plus or Pro","nggallery")})),a&&t.animate_images_enable&&ee().createElement("div",{className:"space-y-4 ml-6"},ee().createElement(sc,{id:"animate_images_style",name:"animate_images_style",value:t.animate_images_style||"flipInX",onChange:c("animate_images_style"),label:(0,pe.__)("Animation style","nggallery")},vf.map(function(e){return ee().createElement("option",{key:e.value,value:e.value},e.label)})),ee().createElement(uc,{type:"number",id:"animate_images_duration",name:"animate_images_duration",value:String(t.animate_images_duration||1500),onChange:s("animate_images_duration"),label:(0,pe.__)("Animation duration (ms)","nggallery"),help:(0,pe.__)("Measured in milliseconds","nggallery"),min:0,max:1e4}),ee().createElement(uc,{type:"number",id:"animate_images_delay",name:"animate_images_delay",value:String(t.animate_images_delay||250),onChange:s("animate_images_delay"),label:(0,pe.__)("Animation delay (ms)","nggallery"),help:(0,pe.__)("Measured in milliseconds","nggallery"),min:0,max:1e4}))),ee().createElement("div",{className:"border-t border-gray-200"}),ee().createElement("div",{className:"space-y-4"},ee().createElement("h3",{className:"text-base font-medium text-gray-900"},(0,pe.__)("Pagination Animations","nggallery")),a?ee().createElement(fs,{id:"animate_pagination_enable",name:"animate_pagination_enable",checked:t.animate_pagination_enable||!1,onChange:i("animate_pagination_enable"),label:(0,pe.__)("Animate paginations","nggallery"),help:(0,pe.__)("Add animations when users navigate through paginated galleries","nggallery")}):ee().createElement("div",{className:"relative"},ee().createElement("div",{className:"opacity-50 pointer-events-none"},ee().createElement(fs,{id:"animate_pagination_enable",name:"animate_pagination_enable",checked:t.animate_pagination_enable||!1,onChange:function(){},label:(0,pe.__)("Animate paginations","nggallery"),help:(0,pe.__)("Add animations when users navigate through paginated galleries","nggallery")})),ee().createElement("div",{className:"absolute inset-0 cursor-pointer",onClick:o,title:(0,pe.__)("Requires NextGEN Gallery Pro","nggallery")})),a&&t.animate_pagination_enable&&ee().createElement("div",{className:"space-y-4 ml-6"},ee().createElement(sc,{id:"animate_pagination_style",name:"animate_pagination_style",value:t.animate_pagination_style||"flipInX",onChange:c("animate_pagination_style"),label:(0,pe.__)("Animation style","nggallery")},vf.map(function(e){return ee().createElement("option",{key:e.value,value:e.value},e.label)})),ee().createElement(uc,{type:"number",id:"animate_pagination_duration",name:"animate_pagination_duration",value:String(t.animate_pagination_duration||1500),onChange:s("animate_pagination_duration"),label:(0,pe.__)("Animation duration (ms)","nggallery"),help:(0,pe.__)("Measured in milliseconds","nggallery"),min:0,max:1e4}),ee().createElement(uc,{type:"number",id:"animate_pagination_delay",name:"animate_pagination_delay",value:String(t.animate_pagination_delay||250),onChange:s("animate_pagination_delay"),label:(0,pe.__)("Animation delay (ms)","nggallery"),help:(0,pe.__)("Measured in milliseconds","nggallery"),min:0,max:1e4})))))):null},vv=function(e){var t=e.settings,n=e.onSettingsChange,r=(0,ge.useDispatch)(Br),a="plus"===zr||"pro"===zr,o=function(){r.setActiveModal("upgrade",{feature:"image protection"})},l=function(e){return function(t){if(!a)return t.preventDefault(),void o();if(n){var r=t.target.checked;"protect_images"!==e||r||n("protect_images_globally",!1),n(e,r)}}};return t?ee().createElement("div",{className:"space-y-4"},ee().createElement(nf,{title:(0,pe.__)("Protection Settings","nggallery"),defaultExpanded:!0},ee().createElement("div",{className:"space-y-4"},ee().createElement("div",{className:"bg-info-bg border border-info-border rounded-md p-4"},ee().createElement("div",{className:"flex items-start"},ee().createElement("div",{className:"flex-shrink-0"},ee().createElement(cr,{className:"h-5 w-5 text-gray-400"})),ee().createElement("div",{className:"ml-3"},ee().createElement("h3",{className:"text-sm font-medium text-gray-800"},(0,pe.__)("Image Protection Settings","nggallery")),ee().createElement("div",{className:"mt-2 text-sm text-gray-700"},ee().createElement("p",null,(0,pe.__)("Image protection disables the ability for visitors to right-click or drag to download your images in both the gallery display and Pro Lightbox views. It gives you complete freedom to display your work without worry.","nggallery")))))),ee().createElement("div",null,a?ee().createElement(fs,{id:"protect_images",name:"protect_images",checked:t.protect_images||!1,onChange:l("protect_images"),label:(0,pe.__)("Protect images","nggallery"),help:(0,pe.__)("Protect images from being downloaded both by right click or drag & drop","nggallery")}):ee().createElement("div",{className:"relative"},ee().createElement("div",{className:"opacity-50 pointer-events-none"},ee().createElement(fs,{id:"protect_images",name:"protect_images",checked:t.protect_images||!1,onChange:function(){},label:(0,pe.__)("Protect images","nggallery"),help:(0,pe.__)("Protect images from being downloaded both by right click or drag & drop","nggallery")})),ee().createElement("div",{className:"absolute inset-0 cursor-pointer",onClick:o,title:(0,pe.__)("Requires NextGEN Gallery Pro","nggallery")}))),a&&t.protect_images&&ee().createElement("div",null,ee().createElement(fs,{id:"protect_images_globally",name:"protect_images_globally",checked:t.protect_images_globally||!1,onChange:l("protect_images_globally"),label:(0,pe.__)("Disable right click menu completely","nggallery"),help:(0,pe.__)("By default the right click menu is only disabled for NextGEN images. Enable this to disable the right click menu on the whole page.","nggallery")}))))):null};function _v(e){if(!0===e||1===e||"1"===e)return!0;if(!1===e||0===e||"0"===e||""===e||null==e)return!1;if("number"==typeof e)return 1===e;if("string"==typeof e){var t=e.trim();return"1"===t||"true"===t}return!1}function wv(){var e=window.imagelyApp;if(!e)return!0;if(Object.prototype.hasOwnProperty.call(e,"canEditGalleryPath"))return ti(e.canEditGalleryPath,!0);var t=Object.prototype.hasOwnProperty.call(e,"is_multisite"),n=Object.prototype.hasOwnProperty.call(e,"is_main_site");if(t&&n){var r=_v(e.is_multisite),a=_v(e.is_main_site);return!r||a}return!0}const xv=function(e){var t,n,r,a=e.settings,o=e.onSettingsChange,l=function(e,t){o&&o(e,t)},i=[{value:"sortorder",label:(0,pe.__)("Custom order","nggallery")},{value:"pid",label:(0,pe.__)("Image ID","nggallery")},{value:"filename",label:(0,pe.__)("Filename","nggallery")},{value:"alttext",label:(0,pe.__)("Alt/Title text","nggallery")},{value:"imagedate",label:(0,pe.__)("Date/Time","nggallery")}],c=vo((0,$.useState)(function(){return wv()}),2),s=c[0],u=c[1];if((0,$.useLayoutEffect)(function(){var e=wv();u(function(t){return t!==e?e:t})},[]),!a)return null;var m="bg-white border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-green-500 focus:border-green-500 block w-full max-w-lg p-2.5 hover:border-gray-400 transition-colors";return ee().createElement("div",{className:"space-y-4"},ee().createElement(nf,{title:(0,pe.__)("General","nggallery"),defaultExpanded:!0},ee().createElement("div",{className:"space-y-4"},ee().createElement("div",null,ee().createElement(cc,{help:s?(0,pe.__)("This is the default path for new galleries.","nggallery"):(0,pe.__)("On multisite subsites this path is read-only for site administrators so uploads stay on the correct site. Network super administrators can change it.","nggallery")},(0,pe.__)("Path to galleries","nggallery")),ee().createElement("input",{type:"text",readOnly:!s,value:s?a.gallerypath||"":null!==(t=a.gallerypath)&&void 0!==t&&t.trim()?a.gallerypath:"—",onChange:s?function(e){return l("gallerypath",e.target.value)}:void 0,className:s?m:"".concat(m," bg-gray-50 cursor-default font-mono break-all"),"aria-readonly":!s||void 0})))),ee().createElement(nf,{title:(0,pe.__)("Gallery Sorting","nggallery"),defaultExpanded:!0},ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4"},ee().createElement("div",null,ee().createElement(sc,{id:"galSort",name:"galSort",value:a.galSort||"sortorder",onChange:function(e){return l("galSort",e.target.value)},label:(0,pe.__)("Sort galleries by","nggallery")},i.map(function(e){return ee().createElement("option",{key:e.value,value:e.value},e.label)}))),ee().createElement("div",null,ee().createElement(sc,{id:"galSortDir",name:"galSortDir",value:a.galSortDir||"ASC",onChange:function(e){return l("galSortDir",e.target.value)},label:(0,pe.__)("Sort direction","nggallery")},ee().createElement("option",{value:"ASC"},(0,pe.__)("Ascending","nggallery")),ee().createElement("option",{value:"DESC"},(0,pe.__)("Descending","nggallery")))))),ee().createElement(nf,{title:(0,pe.__)("Thumbnail Settings","nggallery"),defaultExpanded:!0},ee().createElement("div",{className:"space-y-6"},ee().createElement("div",null,ee().createElement(cc,{help:(0,pe.__)("When generating thumbnails, what image dimensions do you desire?","nggallery"),className:"mb-4"},(0,pe.__)("Default Thumbnail Dimensions","nggallery")),ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4"},ee().createElement("div",null,ee().createElement(uc,{type:"number",id:"thumbwidth",name:"thumbwidth",value:(null===(n=a.thumbwidth)||void 0===n?void 0:n.toString())||"240",onChange:function(e){return l("thumbwidth",parseInt(e.target.value)||0)},label:(0,pe.__)("Width (pixels)","nggallery"),min:1})),ee().createElement("div",null,ee().createElement(uc,{type:"number",id:"thumbheight",name:"thumbheight",value:(null===(r=a.thumbheight)||void 0===r?void 0:r.toString())||"180",onChange:function(e){return l("thumbheight",parseInt(e.target.value)||0)},label:(0,pe.__)("Height (pixels)","nggallery"),min:1})))),ee().createElement("div",null,ee().createElement("h3",{className:"text-lg font-medium text-gray-900 mb-4"},(0,pe.__)("Size List","nggallery")),ee().createElement("p",{className:"text-sm text-gray-600 mb-4"},(0,pe.__)("List of default sizes used for thumbnails and images","nggallery")),ee().createElement("div",{className:"space-y-2"},a.thumbnail_dimensions&&a.thumbnail_dimensions.length>0?a.thumbnail_dimensions.map(function(e,t){return ee().createElement("div",{key:t,className:"flex items-center justify-between bg-gray-50 p-3 rounded-md"},ee().createElement("span",{className:"text-gray-700"},e),ee().createElement("button",{onClick:function(){var e=ko(a.thumbnail_dimensions||[]);e.splice(t,1),l("thumbnail_dimensions",e)},className:"text-red-600 hover:text-red-800"},(0,pe.__)("Remove","nggallery")))}):ee().createElement("p",{className:"text-gray-500 italic"},(0,pe.__)("No default sizes present.","nggallery")))))))};function Ev(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Cv(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ev(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ev(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}const Nv=function(e){var t,r=e.accounts,a=e.settings,o=e.onSettingsChange,l="dribbble",i=(0,$.useMemo)(function(){var e;return(null==a||null===(e=a.external_source_default_settings)||void 0===e?void 0:e[l])||{}},[a,l]),c=function(e,t){return void 0!==i[e]?i[e]:t},s=vo((0,$.useState)(c("".concat(l,"_account"),r.length>0&&r[0].username||"")),2),u=s[0],m=s[1],d=vo((0,$.useState)(String(c("".concat(l,"_number"),5))),2),g=d[0],p=d[1],f=vo((0,$.useState)(String(c("".concat(l,"_link"),0))),2),y=f[0],h=f[1],b=vo((0,$.useState)(c("".concat(l,"_image_size"),"default")),2),v=b[0],_=b[1],w=vo((0,$.useState)(1===c("".concat(l,"_link_target"),0)),2),x=w[0],E=w[1],C=vo((0,$.useState)(1===c("".concat(l,"_caption"),1)),2),N=C[0],k=C[1],S=vo((0,$.useState)(String(c("".concat(l,"_caption_length"),999))),2),O=S[0],P=S[1],j=vo((0,$.useState)(1===c("".concat(l,"_cache"),1)),2),T=j[0],I=j[1],A=(null===(t=Rs(!1,!0).data)||void 0===t?void 0:t.sizes)||[];(0,$.useEffect)(function(){if(i){var e=function(e,t){return void 0!==i[e]?i[e]:t};m(e("".concat(l,"_account"),r.length>0&&r[0].username||"")),p(String(e("".concat(l,"_number"),5))),h(String(e("".concat(l,"_link"),0))),_(e("".concat(l,"_image_size"),"default")),E(1===e("".concat(l,"_link_target"),0)),k(1===e("".concat(l,"_caption"),1)),P(String(e("".concat(l,"_caption_length"),999))),I(1===e("".concat(l,"_cache"),1))}},[i,l,r]);var D=function(e,t){if(o&&a){var r=a.external_source_default_settings||{},i=r[l]||{},c=t;"openInNewTab"===e||"usePhotoTitle"===e||"cacheData"===e?c=t?1:0:"numPhotos"!==e&&"limitCaptionLength"!==e||(c=parseInt(t)||0);var s={account:"".concat(l,"_account"),numPhotos:"".concat(l,"_number"),overridingLink:"".concat(l,"_link"),imageSize:"".concat(l,"_image_size"),openInNewTab:"".concat(l,"_link_target"),usePhotoTitle:"".concat(l,"_caption"),limitCaptionLength:"".concat(l,"_caption_length"),cacheData:"".concat(l,"_cache")}[e];if(s){var u=Cv(Cv({},r),{},n({},l,Cv(Cv({},i),{},n({},s,c))));o("external_source_default_settings",u)}}},L=r.map(function(e){return{value:e.username||"slot-".concat(e.slot),label:e.username||(0,pe.__)("Account","nggallery")+" #".concat(e.slot)}}),F=[{value:"0",label:(0,pe.__)("No link (Use Lightbox If Enabled)","nggallery")},{value:"1",label:(0,pe.__)("Original Page at","nggallery")+" Dribbble"},{value:"2",label:(0,pe.__)("Direct Full Sized Image On Site","nggallery")}],M=(0,$.useMemo)(function(){var e=[];return Array.isArray(A)&&A.length>0&&A.forEach(function(t){e.push({value:String(t.value),label:String(t.label)})}),e},[A]);return a?ee().createElement("div",{className:"space-y-6"},ee().createElement("h3",{className:"text-lg font-semibold text-gray-900 mb-4"},(0,pe.__)("Image Settings","nggallery")),ee().createElement("div",{className:"space-y-6"},ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"dribbble-account"},"Dribbble ",(0,pe.__)("Account","nggallery"))),ee().createElement("div",null,ee().createElement(sc,{id:"dribbble-account",name:"dribbble-account",value:u,onChange:function(e){m(e.target.value),D("account",e.target.value)}},0===L.length?ee().createElement("option",{value:""},(0,pe.__)("No accounts available","nggallery")):L.map(function(e){return ee().createElement("option",{key:e.value,value:e.value},e.label)})),ee().createElement("p",{className:"text-sm text-gray-600 mt-1"},(0,pe.__)("Choose from any of the","nggallery")," ",ee().createElement("a",{href:"#",className:"underline font-semibold text-[#11A800]"},(0,pe.__)("Authenticated","nggallery")," Dribbble ",(0,pe.__)("accounts","nggallery")),"."))),ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"dribbble-num-photos"},(0,pe.__)("Number of","nggallery")," Dribbble ",(0,pe.__)("Photos","nggallery"))),ee().createElement("div",null,ee().createElement(uc,{type:"number",id:"dribbble-num-photos",name:"dribbble-num-photos",value:g,onChange:function(e){p(e.target.value),D("numPhotos",e.target.value)},min:1}),ee().createElement("p",{className:"text-sm text-gray-600 mt-1"},(0,pe.__)("Choose the number of photos to fetch from Dribbble.","nggallery")))),ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"dribbble-overriding-link"},(0,pe.__)("Overriding Link?","nggallery"))),ee().createElement("div",null,ee().createElement(sc,{id:"dribbble-overriding-link",name:"dribbble-overriding-link",value:y,onChange:function(e){h(e.target.value),D("overridingLink",e.target.value)}},F.map(function(e){return ee().createElement("option",{key:e.value,value:e.value},e.label)})))),"0"===y&&ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"dribbble-image-size"},(0,pe.__)("Image Size","nggallery"))),ee().createElement("div",null,ee().createElement(sc,{id:"dribbble-image-size",name:"dribbble-image-size",value:v,onChange:function(e){_(e.target.value),D("imageSize",e.target.value)}},M.map(function(e){return ee().createElement("option",{key:e.value,value:e.value},e.label)})))),"0"!==y&&ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"dribbble-open-new-tab",help:"".concat((0,pe.__)("Open the link to","nggallery")," Dribbble ").concat((0,pe.__)("in a new browser tab.","nggallery"))},(0,pe.__)("Open in New Tab?","nggallery"))),ee().createElement("div",{className:"flex items-center"},ee().createElement(fs,{id:"dribbble-open-new-tab",name:"dribbble-open-new-tab",checked:x,onChange:function(e){E(e.target.checked),D("openInNewTab",e.target.checked)},label:""}))),ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"dribbble-use-photo-title",help:"".concat((0,pe.__)("Display the photo title from","nggallery")," Dribbble ").concat((0,pe.__)("on the slide.","nggallery"))},(0,pe.__)("Use Photo Title?","nggallery"))),ee().createElement("div",{className:"flex items-center"},ee().createElement(fs,{id:"dribbble-use-photo-title",name:"dribbble-use-photo-title",checked:N,onChange:function(e){k(e.target.checked),D("usePhotoTitle",e.target.checked)},label:""}))),N&&ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"dribbble-limit-caption"},(0,pe.__)("Limit Caption Length","nggallery"))),ee().createElement("div",null,ee().createElement(uc,{type:"text",id:"dribbble-limit-caption",name:"dribbble-limit-caption",value:O,onChange:function(e){P(e.target.value),D("limitCaptionLength",e.target.value)},placeholder:(0,pe.__)("For e.g. 999","nggallery")}),ee().createElement("p",{className:"text-sm text-gray-600 mt-1"},(0,pe.__)("Limits the number of words to display for each caption.","nggallery")))),ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"dribbble-cache-data",help:"".concat((0,pe.__)("Caches the data from","nggallery")," Dribbble ").concat((0,pe.__)("to improve performance (recommended).","nggallery"))},(0,pe.__)("Cache Data from","nggallery")," Dribbble?")),ee().createElement("div",{className:"flex items-center"},ee().createElement(fs,{id:"dribbble-cache-data",name:"dribbble-cache-data",checked:T,onChange:function(e){I(e.target.checked),D("cacheData",e.target.checked)},label:""}))))):null};function kv(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return Sv(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Sv(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Sv(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,Sv(m,"constructor",s),Sv(s,"constructor",c),c.displayName="GeneratorFunction",Sv(s,a,"GeneratorFunction"),Sv(m),Sv(m,a,"Generator"),Sv(m,r,function(){return this}),Sv(m,"toString",function(){return"[object Generator]"}),(kv=function(){return{w:o,m:d}})()}function Sv(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}Sv=function(e,t,n,r){function o(t,n){Sv(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Sv(e,t,n,r)}const Ov=function(e){var t=e.accounts,n=function(){var e,t=re();return gl({mutationFn:(e=No(As().m(function e(t){var n;return As().w(function(e){for(;;)switch(e.n){case 0:return n=Ao(),e.n=1,Oo()({path:"/nggpro/v1/dribbble/accounts/".concat(t),method:"DELETE",headers:{"X-WP-Nonce":n,"Content-Type":"application/json"}});case 1:return e.a(2)}},e)})),function(t){return e.apply(this,arguments)}),onSuccess:function(){t.invalidateQueries({queryKey:Ls.dribbbleAccounts})}})}(),r=Ms(),a=r.handleConnectClick,o=r.isLoading,l=t.length,i=vo((0,$.useState)({isOpen:!1}),2),c=i[0],s=i[1],u=function(){var e=No(kv().m(function e(t){var r;return kv().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,n.mutateAsync(t);case 1:s({isOpen:!1}),e.n=3;break;case 2:e.p=2,r=e.v,console.error("Failed to remove Dribbble account:",r);case 3:return e.a(2)}},e,null,[[0,2]])}));return function(t){return e.apply(this,arguments)}}();return ee().createElement("div",{className:"space-y-6"},ee().createElement("div",null,ee().createElement("div",{className:"flex items-center justify-between mb-4"},ee().createElement("h3",{className:"text-sm font-semibold text-gray-900"},(0,pe.__)("Dribbble Authorization Setup","nggallery")),ee().createElement("span",{className:"text-sm font-semibold text-gray-900"},l,"/",3," ",(0,pe.__)("slots used","nggallery"))),ee().createElement("p",{className:"text-sm text-gray-600 mb-4"},(0,pe.__)("Before you can create dribbble galleries, you need to authenticate with your Imagely Dribbble accounts. Imagely supports authorization with up to 3 unique Dribbble accounts.","nggallery")),ee().createElement("p",{className:"text-sm text-gray-600 mb-6"},(0,pe.__)("Need assistance?","nggallery")," ",ee().createElement("a",{href:"https://www.imagely.com/knowledge-base/",target:"_blank",rel:"noopener noreferrer",className:"text-green-600 hover:text-green-700 underline inline-flex items-center space-x-1"},ee().createElement("span",null,(0,pe.__)("Click here","nggallery")),ee().createElement(sr,{className:"w-3 h-3"}))," ",(0,pe.__)("to read further documentation.","nggallery")),ee().createElement("div",{className:"mb-6"},t.length<3?ee().createElement("button",{type:"button",onClick:a,disabled:o,className:"bg-green-500 text-white px-6 py-2 rounded-lg font-medium text-sm hover:bg-green-600 transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center space-x-2"},o&&ee().createElement(kn,{className:"animate-spin h-4 w-4"}),ee().createElement("span",null,(0,pe.__)("Connect to Dribbble","nggallery"))):ee().createElement("button",{type:"button",disabled:!0,className:"bg-gray-200 text-gray-500 px-6 py-2 rounded-lg font-medium text-sm cursor-not-allowed"},(0,pe.__)("All slots used","nggallery")))),t.length>0&&ee().createElement("div",null,ee().createElement("h3",{className:"text-sm font-semibold text-gray-900 mb-4"},(0,pe.__)("Connected Accounts","nggallery")),ee().createElement("div",{className:"space-y-4"},t.map(function(e){return ee().createElement("div",{key:e.slot,className:"flex items-center justify-between border-b border-gray-200 pb-4 last:border-b-0"},ee().createElement("div",{className:"flex items-center space-x-4"},e.avatar_url?ee().createElement("img",{src:e.avatar_url,alt:e.username||"Account ".concat(e.slot),className:"w-12 h-12 rounded-full object-cover"}):ee().createElement("div",{className:"w-12 h-12 rounded-full bg-gray-200 flex items-center justify-center"},ee().createElement("span",{className:"text-gray-500 text-sm font-medium"},e.slot)),ee().createElement("div",null,e.username&&ee().createElement("div",{className:"text-sm text-gray-600"},e.username),ee().createElement("div",{className:"text-sm font-semibold text-gray-900"},e.name||e.username||(0,pe.__)("Account","nggallery")+" #".concat(e.slot)),e.username&&ee().createElement("div",{className:"text-xs text-gray-500"},"@",e.username),ee().createElement("div",{className:"text-xs text-gray-500 mt-0.5"},(0,pe.__)("Slot","nggallery")," ",e.slot," • ",(0,pe.__)("Connected","nggallery")," ",(t=e.time_taken)?new Date(1e3*t).toLocaleDateString():(0,pe.__)("Unknown","nggallery")))),ee().createElement("button",{type:"button",onClick:function(){return s({isOpen:!0,slot:e.slot})},disabled:n.isPending,className:"px-4 py-2 text-sm font-medium text-red-600 bg-red-50 rounded-lg hover:bg-red-100 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"},(0,pe.__)("Remove","nggallery")));var t}))),ee().createElement(Eo,{isOpen:c.isOpen,onClose:function(){return s({isOpen:!1})}},ee().createElement("div",{className:"space-y-4"},ee().createElement("div",{className:"flex items-center gap-2 justify-center"},ee().createElement(rr,null)),ee().createElement("h2",{className:"text-xl font-bold text-center text-gray-900 mt-2"},(0,pe.__)("Remove Dribbble Account","nggallery")),ee().createElement("p",{className:"text-sm text-gray-500 text-center"},(0,pe.__)("Are you sure you want to remove this Dribbble account?","nggallery")),c.slot&&ee().createElement("div",{className:"text-sm text-gray-700 px-4 text-center"},ee().createElement("strong",null,(0,pe.__)("Slot","nggallery")," ",c.slot)),ee().createElement("p",{className:"text-sm text-red-500 text-center"},(0,pe.__)("This action cannot be undone.","nggallery")),ee().createElement("div",{className:"flex justify-center space-x-3 !mb-4"},ee().createElement("button",{type:"button",onClick:function(){return s({isOpen:!1})},disabled:n.isPending,className:"px-8 py-2 font-medium text-white bg-green-500 rounded-lg shadow hover:bg-green-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"},(0,pe.__)("Cancel","nggallery")),ee().createElement("button",{type:"button",onClick:function(){c.slot&&u(c.slot)},disabled:n.isPending,className:"px-8 py-2 font-bold text-white bg-red-600 border border-transparent rounded-lg shadow hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center space-x-2"},n.isPending&&ee().createElement(kn,{className:"animate-spin h-4 w-4"}),ee().createElement("span",null,n.isPending?(0,pe.__)("Removing...","nggallery"):(0,pe.__)("Remove","nggallery")))))))};function Pv(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return jv(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(jv(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,jv(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,jv(m,"constructor",s),jv(s,"constructor",c),c.displayName="GeneratorFunction",jv(s,a,"GeneratorFunction"),jv(m),jv(m,a,"Generator"),jv(m,r,function(){return this}),jv(m,"toString",function(){return"[object Generator]"}),(Pv=function(){return{w:o,m:d}})()}function jv(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}jv=function(e,t,n,r){function o(t,n){jv(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},jv(e,t,n,r)}const Tv=function(e){var t=e.accounts,r=vo((0,$.useState)("settings"),2),a=r[0],o=r[1],l=gi().data,i=pi(),c=$o(),s=c.showSuccess,u=c.showError,m=(0,$.useRef)(null),d=(0,$.useRef)(!0);(0,$.useEffect)(function(){return function(){d.current=!1,m.current&&clearTimeout(m.current)}},[]);var g=(0,$.useCallback)(function(e,t){l&&(m.current&&clearTimeout(m.current),m.current=setTimeout(No(Pv().m(function r(){var a;return Pv().w(function(r){for(;;)switch(r.p=r.n){case 0:return r.p=0,r.n=1,i.mutateAsync(n({},e,t));case 1:d.current&&s((0,pe.__)("Settings updated successfully!","nggallery")),r.n=3;break;case 2:r.p=2,a=r.v,console.error("Error updating Dribbble settings:",a),d.current&&u((0,pe.__)("Failed to update settings. Please try again.","nggallery"));case 3:return r.a(2)}},r,null,[[0,2]])})),333))},[l,i,s,u]);return ee().createElement("div",{className:"bg-white"},ee().createElement("div",{className:"px-4 py-4"},ee().createElement("div",{className:"border-t border-[#e2e8f0]"})),ee().createElement("div",{className:"flex px-4"},ee().createElement("button",{type:"button",onClick:function(){return o("settings")},className:"px-6 py-3 text-sm font-medium transition-colors ".concat("settings"===a?"text-gray-900 border-b-2 border-gray-900":"text-gray-600 hover:text-gray-900")},"Dribbble ",(0,pe.__)("Settings","nggallery")),ee().createElement("button",{type:"button",onClick:function(){return o("configure")},className:"px-6 py-3 text-sm font-medium transition-colors ".concat("configure"===a?"text-gray-900 border-b-2 border-gray-900":"text-gray-600 hover:text-gray-900")},(0,pe.__)("Configure","nggallery"))),ee().createElement("div",{className:"px-4"},ee().createElement("div",{className:"border-b border-[#e2e8f0]"})),ee().createElement("div",{className:"p-6"},"settings"===a?ee().createElement(Ov,{accounts:t}):ee().createElement(Nv,{accounts:t,settings:l,onSettingsChange:g})))},Iv=function(e){var t=e.name,n=e.description,r=e.icon,a=e.isConnected,o=e.isExpanded,l=e.onToggleExpand,i=e.onConnectClick,c=e.showConnectButton,s=void 0===c||c;return ee().createElement("div",null,ee().createElement("div",{className:"flex flex-col md:flex-row md:items-center justify-between p-6 "},ee().createElement("div",{className:"flex md:items-center flex-col md:flex-row space-x-6 flex-1"},ee().createElement("div",{className:"bg-green-50 rounded-lg flex-shrink-0 flex items-center justify-center w-[104px] h-[104px]"},r),ee().createElement("div",{className:"flex-1 min-w-0 py-4 md:py-0 "},ee().createElement("h3",{className:"text-lg font-semibold text-gray-900 mb-1"},t),ee().createElement("p",{className:"text-sm text-gray-600"},n))),ee().createElement("div",{className:"flex md:items-center space-x-2 md:ml-[100px]"},s&&ee().createElement("button",{type:"button",onClick:!a&&i?i:void 0,disabled:a,className:ao("flex md:items-center space-x-2 px-4 py-2 rounded-lg font-medium text-sm transition-colors",a?"bg-white border border-[#13C200] text-[#13C200] cursor-default disabled:cursor-default":"bg-green-500 text-white hover:bg-green-600 cursor-pointer")},a&&ee().createElement(an,{className:"w-4 h-4 text-[#13C200] border-[#13C200]"}),ee().createElement("span",null,a?(0,pe.__)("Connected","nggallery"):(0,pe.__)("Connect","nggallery"))),ee().createElement("button",{type:"button",onClick:l,className:ao("p-2 rounded transition-colors",o?"bg-[#374151]":"bg-[#F1F1F1]"),"aria-label":o?(0,pe.__)("Collapse","nggallery"):(0,pe.__)("Expand","nggallery")},ee().createElement(rn,{className:ao("w-4 h-4 transition-transform duration-200",o?"transform rotate-180 text-white":"text-gray-900")})))))},Av=function(){var e,t=vo((0,$.useState)(!1),2),n=t[0],r=t[1],a=(0,ge.useDispatch)(Br),o=(null===(e=Fs(!0).data)||void 0===e?void 0:e.accounts)||[],l=o.length>0,i=Ms().handleConnectClick;return ee().createElement("div",{className:"bg-white rounded-lg border border-[#e2e8f0] shadow-[4px_8px_16px_0px_rgba(0,0,0,0.08)]"},ee().createElement(Iv,{id:"dribbble",name:"Dribbble",description:(0,pe.__)("Integrate Dribbble galleries, you need to authenticate with your Imagely Dribbble accounts.","nggallery"),icon:ee().createElement(Lr,{className:"w-[104px] h-[104px] text-gray-900"}),isConnected:l,isExpanded:n,onToggleExpand:function(){"pro"===zr?r(!n):a.setActiveModal("upgrade",{feature:"Dribbble"})},onConnectClick:function(){"pro"===zr?i&&i():a.setActiveModal("upgrade",{feature:"Dribbble"})}}),n&&ee().createElement(Tv,{accounts:o}))};function Dv(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return Lv(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Lv(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Lv(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,Lv(m,"constructor",s),Lv(s,"constructor",c),c.displayName="GeneratorFunction",Lv(s,a,"GeneratorFunction"),Lv(m),Lv(m,a,"Generator"),Lv(m,r,function(){return this}),Lv(m,"toString",function(){return"[object Generator]"}),(Dv=function(){return{w:o,m:d}})()}function Lv(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}Lv=function(e,t,n,r){function o(t,n){Lv(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Lv(e,t,n,r)}var Fv=/^G-[A-Za-z0-9_-]+$/,Mv=function(e){return!e||!e.trim()||Fv.test(e.trim())};const Rv=function(){var e,t,r,a,o,l,i,c,s=gi().data,u=sl({queryKey:["settings","gtag-status"],queryFn:(c=No(ui().m(function e(){var t,n;return ui().w(function(e){for(;;)switch(e.n){case 0:return n=null===(t=window.imagelyApp)||void 0===t?void 0:t.nonce,e.n=1,Oo()({path:"/imagely/v1/settings/gtag-status",method:"GET",headers:{"X-WP-Nonce":n}});case 1:return e.a(2,e.v)}},e)})),function(){return c.apply(this,arguments)}),staleTime:15e3,gcTime:3e5,refetchOnWindowFocus:!0}),m=u.data,d=function(){var e,t=re();return gl({mutationFn:(e=No(ui().m(function e(){var t,n;return ui().w(function(e){for(;;)switch(e.n){case 0:return n=null===(t=window.imagelyApp)||void 0===t?void 0:t.nonce,e.n=1,Oo()({path:"/imagely/v1/settings/gtag-status?force=true",method:"GET",headers:{"X-WP-Nonce":n}});case 1:return e.a(2,e.v)}},e)})),function(){return e.apply(this,arguments)}),onSuccess:function(e){t.setQueryData(["settings","gtag-status"],e)}})}(),g=pi(),p=$o(),f=p.showSuccess,y=p.showError,h=(0,ge.useDispatch)(Br),b=(0,$.useRef)(null),v=(0,$.useRef)(!0),_="pro"===zr,w=function(){h.setActiveModal("upgrade",{feature:"eCommerce tracking"})},x=vo((0,$.useState)(null!==(e=null==s?void 0:s.ga4_measurement_id)&&void 0!==e?e:""),2),E=x[0],C=x[1],N=vo((0,$.useState)(null),2),k=N[0],S=N[1];(0,$.useEffect)(function(){void 0!==(null==s?void 0:s.ga4_measurement_id)&&C(s.ga4_measurement_id||"")},[null==s?void 0:s.ga4_measurement_id]),(0,$.useEffect)(function(){return function(){v.current=!1,b.current&&clearTimeout(b.current)}},[]);var O=(0,$.useCallback)(function(e,t){s&&(b.current&&clearTimeout(b.current),b.current=window.setTimeout(No(Dv().m(function r(){return Dv().w(function(r){for(;;)switch(r.p=r.n){case 0:return r.p=0,r.n=1,g.mutateAsync(n({},e,t));case 1:v.current&&f((0,pe.__)("Settings updated successfully!","nggallery")),r.n=3;break;case 2:r.p=2,r.v,v.current&&y((0,pe.__)("Failed to update settings. Please try again.","nggallery"));case 3:return r.a(2)}},r,null,[[0,2]])})),333))},[s,g,f,y]);return ee().createElement("div",{className:"bg-white"},ee().createElement("div",{className:"px-4 py-4"},ee().createElement("div",{className:"border-t border-[#e2e8f0]"})),ee().createElement("div",{className:"p-6"},ee().createElement("div",{className:"space-y-6"},ee().createElement("h3",{className:"text-lg font-semibold text-gray-900 mb-4"},(0,pe.__)("Google Analytics Settings","nggallery")),void 0!==m&&(null!=m&&m.detected?ee().createElement("div",{className:"flex items-center gap-2 rounded-lg bg-green-50 px-4 py-3 border border-green-200 w-full"},ee().createElement(an,{className:"w-4 h-4 text-green-600 flex-shrink-0"}),ee().createElement("span",{className:"text-sm font-medium text-green-800"},(0,pe.__)("gtag.js detected","nggallery")),ee().createElement("button",{type:"button",onClick:function(){return d.mutate()},disabled:d.isPending,className:"ml-auto text-xs text-green-700 underline hover:text-green-900 disabled:opacity-50 disabled:cursor-not-allowed"},d.isPending?(0,pe.__)("Checking…","nggallery"):(0,pe.__)("Refresh Status","nggallery"))):ee().createElement("div",{className:"rounded-lg bg-amber-50 px-4 py-3 border border-amber-200 w-full"},ee().createElement("div",{className:"flex items-center"},ee().createElement("span",{className:"text-sm font-medium text-amber-800"},(0,pe.__)("gtag.js not found","nggallery")),ee().createElement("button",{type:"button",onClick:function(){return d.mutate()},disabled:d.isPending,className:"ml-auto text-xs text-amber-700 underline hover:text-amber-900 disabled:opacity-50 disabled:cursor-not-allowed"},d.isPending?(0,pe.__)("Checking…","nggallery"):(0,pe.__)("Refresh Status","nggallery"))),ee().createElement("p",{className:"mt-1 text-sm text-amber-700"},(0,pe.__)("We recommend installing ","nggallery"),ee().createElement("a",{href:"".concat((null===(t=window.imagelyApp)||void 0===t?void 0:t.adminUrl)||"/wp-admin/","plugin-install.php?s=monsterinsights&tab=search&type=term"),className:"underline font-semibold text-[#11A800] hover:text-[#0d8000]"},(0,pe.__)("MonsterInsights","nggallery")),(0,pe.__)(" for easy GA4 setup.","nggallery")))),ee().createElement("div",{className:"space-y-6"},ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"ga4_measurement_id",help:(0,pe.__)("Find this in GA4 → Admin → Data Streams → Web","nggallery")},(0,pe.__)("GA4 Measurement ID","nggallery"))),ee().createElement("div",null,ee().createElement(uc,{type:"text",id:"ga4_measurement_id",name:"ga4_measurement_id",value:E,onChange:function(e){var t=e.target.value;C(t),t.trim()&&!Mv(t)?S((0,pe.__)('Measurement ID must start with "G-" followed by alphanumeric characters (e.g. G-XXXXXXXXXX)',"nggallery")):(S(null),Mv(t)&&O("ga4_measurement_id",t.trim()))},placeholder:"G-XXXXXXXXXX"}),k&&ee().createElement("p",{className:"text-sm text-red-600 mt-1"},k))),ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"ga4_track_gallery_views"},(0,pe.__)("Track Gallery Views","nggallery"))),ee().createElement("div",{className:"flex items-center"},ee().createElement(fs,{id:"ga4_track_gallery_views",name:"ga4_track_gallery_views",checked:ni(null!==(r=null==s?void 0:s.ga4_track_gallery_views)&&void 0!==r&&r),onChange:function(e){return O("ga4_track_gallery_views",e.target.checked)},label:""}))),ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"ga4_track_image_clicks"},(0,pe.__)("Track Image Clicks","nggallery"))),ee().createElement("div",{className:"flex items-center"},ee().createElement(fs,{id:"ga4_track_image_clicks",name:"ga4_track_image_clicks",checked:ni(null!==(a=null==s?void 0:s.ga4_track_image_clicks)&&void 0!==a&&a),onChange:function(e){return O("ga4_track_image_clicks",e.target.checked)},label:""}))),ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"ga4_track_image_downloads"},(0,pe.__)("Track Image Downloads","nggallery"))),ee().createElement("div",{className:"flex items-center"},_?ee().createElement(fs,{id:"ga4_track_image_downloads",name:"ga4_track_image_downloads",checked:ni(null!==(o=null==s?void 0:s.ga4_track_image_downloads)&&void 0!==o&&o),onChange:function(e){return O("ga4_track_image_downloads",e.target.checked)},label:""}):ee().createElement("div",{className:"relative"},ee().createElement("div",{className:"opacity-50 pointer-events-none"},ee().createElement(fs,{id:"ga4_track_image_downloads",name:"ga4_track_image_downloads",checked:!1,onChange:function(){},label:""})),ee().createElement("div",{className:"absolute inset-0 cursor-pointer",onClick:w,title:(0,pe.__)("Requires NextGEN Gallery Pro","nggallery")})))),ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"ga4_track_add_to_cart"},(0,pe.__)("Track Add to Cart","nggallery"))),ee().createElement("div",{className:"flex items-center"},_?ee().createElement(fs,{id:"ga4_track_add_to_cart",name:"ga4_track_add_to_cart",checked:ni(null!==(l=null==s?void 0:s.ga4_track_add_to_cart)&&void 0!==l&&l),onChange:function(e){return O("ga4_track_add_to_cart",e.target.checked)},label:""}):ee().createElement("div",{className:"relative"},ee().createElement("div",{className:"opacity-50 pointer-events-none"},ee().createElement(fs,{id:"ga4_track_add_to_cart",name:"ga4_track_add_to_cart",checked:!1,onChange:function(){},label:""})),ee().createElement("div",{className:"absolute inset-0 cursor-pointer",onClick:w,title:(0,pe.__)("Requires NextGEN Gallery Pro","nggallery")})))),ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"ga4_track_purchases"},(0,pe.__)("Track Purchases","nggallery"))),ee().createElement("div",{className:"flex items-center"},_?ee().createElement(fs,{id:"ga4_track_purchases",name:"ga4_track_purchases",checked:ni(null!==(i=null==s?void 0:s.ga4_track_purchases)&&void 0!==i&&i),onChange:function(e){return O("ga4_track_purchases",e.target.checked)},label:""}):ee().createElement("div",{className:"relative"},ee().createElement("div",{className:"opacity-50 pointer-events-none"},ee().createElement(fs,{id:"ga4_track_purchases",name:"ga4_track_purchases",checked:!1,onChange:function(){},label:""})),ee().createElement("div",{className:"absolute inset-0 cursor-pointer",onClick:w,title:(0,pe.__)("Requires NextGEN Gallery Pro","nggallery")}))))))))},Gv=function(){var e=vo((0,$.useState)(!1),2),t=e[0],n=e[1],r=(0,ge.useDispatch)(Br);return ee().createElement("div",{className:"bg-white rounded-lg border border-[#e2e8f0] shadow-[4px_8px_16px_0px_rgba(0,0,0,0.08)]"},ee().createElement(Iv,{id:"google_analytics",name:"Google Analytics",description:(0,pe.__)("Track gallery views, image clicks, and ecommerce events with Google Analytics 4. Enter your Measurement ID and enable event tracking.","nggallery"),icon:ee().createElement(Rr,{className:"w-[104px] h-[104px] text-gray-900"}),isConnected:!1,isExpanded:t,onToggleExpand:function(){Yp()?n(!t):r.setActiveModal("upgrade",{feature:"Google Analytics"})},showConnectButton:!1}),t&&ee().createElement(Rv,null))};function Bv(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return zv(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(zv(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,zv(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,zv(m,"constructor",s),zv(s,"constructor",c),c.displayName="GeneratorFunction",zv(s,a,"GeneratorFunction"),zv(m),zv(m,a,"Generator"),zv(m,r,function(){return this}),zv(m,"toString",function(){return"[object Generator]"}),(Bv=function(){return{w:o,m:d}})()}function zv(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}zv=function(e,t,n,r){function o(t,n){zv(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},zv(e,t,n,r)}const Uv=function(){var e,n,r,a=vo((0,$.useState)(!1),2),o=a[0],l=a[1],i=(0,ge.useDispatch)(Br),c=$o(),s=c.showSuccess,u=c.showError,m=$s(!0),d=function(){var e,t=re();return gl({mutationFn:(e=No(Ys().m(function e(t){var n;return Ys().w(function(e){for(;;)switch(e.n){case 0:return n=Ao(),e.n=1,Oo()({path:"/nggpro/v1/google-photos/accounts/".concat(t),method:"DELETE",headers:{"X-WP-Nonce":n}});case 1:return e.a(2,e.v)}},e)})),function(t){return e.apply(this,arguments)}),onSuccess:function(){t.invalidateQueries({queryKey:Js.accounts}),t.removeQueries({queryKey:["galleries"]})}})}(),g=function(){var e,t=re();return gl({mutationFn:(e=No(Ys().m(function e(){var t;return Ys().w(function(e){for(;;)switch(e.n){case 0:return t=Ao(),e.n=1,Oo()({path:"/nggpro/v1/google-photos/accounts/all",method:"DELETE",headers:{"X-WP-Nonce":t}});case 1:return e.a(2,e.v)}},e)})),function(){return e.apply(this,arguments)}),onSuccess:function(){t.invalidateQueries({queryKey:Js.accounts}),t.removeQueries({queryKey:["galleries"]})}})}(),p=(null===(e=m.data)||void 0===e?void 0:e.accounts)||[],f=p.length>0,y=p.length,h=y<3,b=new Set(p.map(function(e){return e.slot})),v=null!==(n=[1,2,3].find(function(e){return!b.has(e)}))&&void 0!==n?n:1,_=vo((0,$.useState)(!1),2),w=_[0],x=_[1],E=vo((0,$.useState)(void 0),2),C=E[0],N=E[1],k=vo((0,$.useState)(1),2),S=k[0],O=k[1],P=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return sl({queryKey:Js.oauthUrl(e,r),queryFn:(t=No(Ys().m(function t(){var n,a,o;return Ys().w(function(t){for(;;)switch(t.n){case 0:return n=Ao(),a=new URLSearchParams,e&&a.set("return_to",e),r>=1&&r<=3&&a.set("account_id",String(r)),o="/nggpro/v1/google-photos/oauth-url?".concat(a.toString()),t.n=1,Oo()({path:o,method:"GET",headers:{"X-WP-Nonce":n}});case 1:return t.a(2,t.v)}},t)})),function(){return t.apply(this,arguments)}),enabled:n,staleTime:0,gcTime:0})}(C,w,S);ee().useEffect(function(){var e;null!==(e=P.data)&&void 0!==e&&e.oauth_url&&(x(!1),window.location.href=P.data.oauth_url)},[null===(r=P.data)||void 0===r?void 0:r.oauth_url]),ee().useEffect(function(){if(P.isError&&w){x(!1);var e=P.error&&"object"===t(P.error)&&"message"in P.error?String(P.error.message):(0,pe.__)("Failed to start Google Photos connection. Please try again.","nggallery");u(e)}},[P.isError,P.error,w,u]);var j=w&&P.isFetching,T=function(){if("pro"===zr){if(h){O(v);try{var e=new URL(window.location.href),t=(e.pathname+e.search).replace(/^\/wp-admin\//,"").replace(/^\//,"");N(t||void 0)}catch(e){N(void 0)}x(!0)}}else i.setActiveModal("upgrade",{feature:"Google Photos"})},I=function(){var e=No(Bv().m(function e(t){return Bv().w(function(e){for(;;)switch(e.p=e.n){case 0:if(window.confirm((0,pe.__)("Remove this account's connection and stored data? Galleries that use this Google Photos account as their source will also be deleted. Your Google Photos library will not be changed. Click Cancel to keep the connection, or OK to remove it.","nggallery"))){e.n=1;break}return e.a(2);case 1:return e.p=1,e.n=2,d.mutateAsync(t);case 2:s((0,pe.__)("Google Photos account disconnected.","nggallery")),e.n=4;break;case 3:e.p=3,e.v,u((0,pe.__)("Failed to disconnect account. Please try again.","nggallery"));case 4:return e.a(2)}},e,null,[[1,3]])}));return function(t){return e.apply(this,arguments)}}(),A=function(){var e=No(Bv().m(function e(){return Bv().w(function(e){for(;;)switch(e.p=e.n){case 0:if(window.confirm((0,pe.__)("You are about to delete all Google Photos authentication and data. All galleries that use Google Photos as their source will also be deleted. This cannot be undone. Are you sure? Click 'Cancel' to stop, 'OK' to delete.","nggallery"))){e.n=1;break}return e.a(2);case 1:return e.p=1,e.n=2,g.mutateAsync();case 2:s((0,pe.__)("All Google Photos data has been removed.","nggallery")),e.n=4;break;case 3:e.p=3,e.v,u((0,pe.__)("Failed to remove all Google Photos data. Please try again.","nggallery"));case 4:return e.a(2)}},e,null,[[1,3]])}));return function(){return e.apply(this,arguments)}}();return ee().createElement("div",{className:"relative bg-white rounded-lg border border-[#e2e8f0] shadow-[4px_8px_16px_0px_rgba(0,0,0,0.08)]","aria-busy":j},j&&ee().createElement("div",{className:"absolute inset-0 z-20 flex items-center justify-center rounded-lg bg-white/95 backdrop-blur-[1px]",role:"status","aria-live":"polite"},ee().createElement("div",{className:"px-6 py-10 flex flex-col items-center max-w-sm text-center"},ee().createElement(oo,{size:"lg",color:"green",centerInContainer:!1,text:(0,pe.__)("Connecting to Google Photos…","nggallery")}),ee().createElement("p",{className:"text-xs text-gray-500 mt-4"},(0,pe.__)("If a new window opens, complete sign-in there. This page will continue automatically.","nggallery")))),ee().createElement(Iv,{id:"google_photos",name:"Google Photos",description:(0,pe.__)("Integrate Google Photos galleries. Authenticate with your Google account to import photos.","nggallery"),icon:ee().createElement(Pr,{className:"w-[104px] h-[104px] text-gray-900"}),isConnected:f,isExpanded:o,onToggleExpand:function(){"pro"===zr?l(!o):i.setActiveModal("upgrade",{feature:"Google Photos"})},onConnectClick:T}),o&&ee().createElement("div",{className:"px-4 py-4 border-t border-[#e2e8f0] space-y-6"},ee().createElement("div",null,ee().createElement("div",{className:"flex items-center justify-between mb-4"},ee().createElement("h3",{className:"text-sm font-semibold text-gray-900"},(0,pe.__)("Google Photos Authorization Setup","nggallery")),ee().createElement("span",{className:"text-sm font-semibold text-gray-900"},y,"/",3," ",(0,pe.__)("slots used","nggallery"))),ee().createElement("p",{className:"text-sm text-gray-600 mb-4"},(0,pe.__)("Before you can create Google Photos galleries, you need to authenticate with your Google account. Imagely supports authorization with up to 3 unique Google accounts.","nggallery")),ee().createElement("p",{className:"text-sm text-gray-600 mb-4"},(0,pe.__)("Need assistance?","nggallery")," ",ee().createElement("a",{href:"https://www.imagely.com/knowledge-base/how-to-setup-google-photos-addon/",target:"_blank",rel:"noopener noreferrer",className:"text-green-600 hover:text-green-700 underline inline-flex items-center space-x-1"},ee().createElement("span",null,(0,pe.__)("Click here","nggallery")),ee().createElement("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":!0},ee().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})))," ",(0,pe.__)("to read further documentation.","nggallery")),ee().createElement("div",{className:"mb-6"},h?ee().createElement("button",{type:"button",onClick:T,disabled:P.isFetching,className:"px-6 py-2 bg-green-500 text-white text-sm font-medium rounded-lg hover:bg-green-600 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"},P.isFetching?(0,pe.__)("Connecting…","nggallery"):(0,pe.__)("Connect to Google Photos","nggallery")):ee().createElement("span",{className:"text-sm text-gray-500"},(0,pe.__)("All slots used","nggallery")))),p.length>0&&ee().createElement("div",null,ee().createElement("h3",{className:"text-sm font-semibold text-gray-900 mb-4"},(0,pe.__)("Connected Accounts","nggallery")),ee().createElement("div",{className:"space-y-4"},p.map(function(e){return ee().createElement("div",{key:e.slot,className:"flex flex-col gap-3 border-b border-gray-200 pb-4 last:border-b-0"},ee().createElement("div",{className:"flex items-center justify-between"},ee().createElement("div",{className:"flex items-center space-x-4"},ee().createElement("div",{className:"w-12 h-12 rounded-full bg-gray-200 flex items-center justify-center flex-shrink-0"},ee().createElement("span",{className:"text-gray-500 text-sm font-medium"},(e.user_email||e.user_name||"?").charAt(0).toUpperCase())),ee().createElement("div",null,ee().createElement("div",{className:"text-sm font-semibold text-gray-900"},e.user_email||e.user_name||(0,pe.__)("Connected account","nggallery")),ee().createElement("div",{className:"text-xs text-gray-500 mt-0.5"},(0,pe.__)("Slot","nggallery")," ",e.slot," • ",(0,pe.__)("Connected","nggallery")," ",e.connected_at?new Date(1e3*e.connected_at).toLocaleDateString():(0,pe.__)("Unknown","nggallery")))),ee().createElement("button",{type:"button",onClick:function(){return I(e.slot)},disabled:d.isPending,className:"px-4 py-2 text-sm font-medium text-red-600 bg-red-50 rounded-lg hover:bg-red-100 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"},d.isPending&&d.variables===e.slot?(0,pe.__)("Disconnecting…","nggallery"):(0,pe.__)("Remove","nggallery"))),ee().createElement("p",{className:"text-xs text-gray-500 italic"},(0,pe.__)("This will remove the connection and stored token data for this account on this site. Your Google Photos and Google account will not be affected.","nggallery")))}))),f&&ee().createElement("div",{className:"mt-6 p-4 border border-[#c3c4c7] border-l-4 border-l-[#d63638] rounded bg-[#fcf0f1]"},ee().createElement("h3",{className:"text-sm font-semibold text-gray-900 mt-0 mb-2"},(0,pe.__)("Delete all Google Photos data","nggallery")),ee().createElement("p",{className:"text-sm text-gray-600 italic mb-2"},(0,pe.__)("Warning: This action cannot be undone. This will remove all connected Google Photos accounts and stored token data, and delete all galleries that use Google Photos as their source.","nggallery")),ee().createElement("button",{type:"button",onClick:A,disabled:g.isPending,className:"text-sm font-medium text-red-600 hover:text-red-700 underline disabled:opacity-50 disabled:cursor-not-allowed"},g.isPending?(0,pe.__)("Removing…","nggallery"):(0,pe.__)("Click here to delete all Google Photos data","nggallery")))))};function qv(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Qv(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?qv(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):qv(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}const Wv=function(e){var t=e.accounts,r=e.settings,a=e.onSettingsChange,o="tiktok",l=(0,$.useMemo)(function(){var e;return(null==r||null===(e=r.external_source_default_settings)||void 0===e?void 0:e[o])||{}},[r,o]),i=function(e,t){return void 0!==l[e]?l[e]:t},c=vo((0,$.useState)(i("".concat(o,"_account"),t.length>0&&t[0].username||"")),2),s=c[0],u=c[1],m=vo((0,$.useState)(String(i("".concat(o,"_number"),10))),2),d=m[0],g=m[1],p=vo((0,$.useState)(String(i("".concat(o,"_link"),0))),2),f=p[0],y=p[1],h=vo((0,$.useState)(i("".concat(o,"_image_size"),"default")),2),b=h[0],v=h[1],_=vo((0,$.useState)(1===i("".concat(o,"_link_target"),0)),2),w=_[0],x=_[1],E=vo((0,$.useState)(1===i("".concat(o,"_caption"),1)),2),C=E[0],N=E[1],k=vo((0,$.useState)(String(i("".concat(o,"_caption_length"),999))),2),S=k[0],O=k[1],P=vo((0,$.useState)(1===i("".concat(o,"_cache"),1)),2),j=P[0],T=P[1],I=vo((0,$.useState)(1===i("".concat(o,"_show_play_button"),1)),2),A=I[0],D=I[1];(0,$.useEffect)(function(){if(l){var e=function(e,t){return void 0!==l[e]?l[e]:t};u(e("".concat(o,"_account"),t.length>0&&t[0].username||"")),g(String(e("".concat(o,"_number"),10))),y(String(e("".concat(o,"_link"),0))),v(e("".concat(o,"_image_size"),"default")),x(1===e("".concat(o,"_link_target"),0)),N(1===e("".concat(o,"_caption"),1)),O(String(e("".concat(o,"_caption_length"),999))),T(1===e("".concat(o,"_cache"),1)),D(1===e("".concat(o,"_show_play_button"),1))}},[l,o,t]);var L=function(e,t){if(a&&r){var l=r.external_source_default_settings||{},i=l[o]||{},c=t;"openInNewTab"===e||"usePhotoTitle"===e||"cacheData"===e||"showPlayButton"===e?c=t?1:0:"numPhotos"!==e&&"limitCaptionLength"!==e||(c=parseInt(t)||0);var s={account:"".concat(o,"_account"),numPhotos:"".concat(o,"_number"),overridingLink:"".concat(o,"_link"),imageSize:"".concat(o,"_image_size"),openInNewTab:"".concat(o,"_link_target"),usePhotoTitle:"".concat(o,"_caption"),limitCaptionLength:"".concat(o,"_caption_length"),cacheData:"".concat(o,"_cache"),showPlayButton:"".concat(o,"_show_play_button")}[e];if(s){var u=Qv(Qv({},l),{},n({},o,Qv(Qv({},i),{},n({},s,c))));a("external_source_default_settings",u)}}},F=t.map(function(e){return{value:e.username||"slot-".concat(e.slot),label:e.username||(0,pe.__)("Account","nggallery")+" #".concat(e.slot)}}),M=[{value:"0",label:(0,pe.__)("No link (Use Lightbox If Enabled)","nggallery")},{value:"1",label:(0,pe.__)("Original Page at","nggallery")+" TikTok"},{value:"2",label:(0,pe.__)("Direct Full Sized Video On Site","nggallery")}],R=[{value:"default",label:(0,pe.__)("Default","nggallery")},{value:"thumbnail",label:(0,pe.__)("Thumbnail","nggallery")},{value:"medium",label:(0,pe.__)("Medium","nggallery")},{value:"large",label:(0,pe.__)("Large","nggallery")},{value:"full",label:(0,pe.__)("Full Size","nggallery")}];return r?ee().createElement("div",{className:"space-y-6"},ee().createElement("h3",{className:"text-lg font-semibold text-gray-900 mb-4"},(0,pe.__)("Image Settings","nggallery")),ee().createElement("div",{className:"space-y-6"},ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"tiktok-account"},"TikTok ",(0,pe.__)("Account","nggallery"))),ee().createElement("div",null,ee().createElement(sc,{id:"tiktok-account",name:"tiktok-account",value:s,onChange:function(e){u(e.target.value),L("account",e.target.value)}},0===F.length?ee().createElement("option",{value:""},(0,pe.__)("No accounts available","nggallery")):F.map(function(e){return ee().createElement("option",{key:e.value,value:e.value},e.label)})),ee().createElement("p",{className:"text-sm text-gray-600 mt-1"},(0,pe.__)("Choose from any of the","nggallery")," ",ee().createElement("a",{href:"#",className:"underline font-semibold text-[#11A800]"},(0,pe.__)("Authenticated","nggallery")," TikTok ",(0,pe.__)("accounts","nggallery")),"."))),ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"tiktok-num-photos"},(0,pe.__)("No. of","nggallery")," TikTok ",(0,pe.__)("Videos","nggallery"))),ee().createElement("div",null,ee().createElement(uc,{type:"number",id:"tiktok-num-photos",name:"tiktok-num-photos",value:d,onChange:function(e){g(e.target.value),L("numPhotos",e.target.value)},min:1}),ee().createElement("p",{className:"text-sm text-gray-600 mt-1"},(0,pe.__)("Choose the number of videos to fetch from TikTok.","nggallery")))),ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"tiktok-overriding-link"},(0,pe.__)("Overriding Link?","nggallery"))),ee().createElement("div",null,ee().createElement(sc,{id:"tiktok-overriding-link",name:"tiktok-overriding-link",value:f,onChange:function(e){y(e.target.value),L("overridingLink",e.target.value)}},M.map(function(e){return ee().createElement("option",{key:e.value,value:e.value},e.label)})))),"0"===f&&ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"tiktok-image-size"},(0,pe.__)("Image Size","nggallery"))),ee().createElement("div",null,ee().createElement(sc,{id:"tiktok-image-size",name:"tiktok-image-size",value:b,onChange:function(e){v(e.target.value),L("imageSize",e.target.value)}},R.map(function(e){return ee().createElement("option",{key:e.value,value:e.value},e.label)})))),"0"!==f&&ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"tiktok-open-new-tab",help:"".concat((0,pe.__)("Open the link to","nggallery")," TikTok ").concat((0,pe.__)("in a new browser tab.","nggallery"))},(0,pe.__)("Open in New Tab?","nggallery"))),ee().createElement("div",{className:"flex items-center"},ee().createElement(fs,{id:"tiktok-open-new-tab",name:"tiktok-open-new-tab",checked:w,onChange:function(e){x(e.target.checked),L("openInNewTab",e.target.checked)},label:""}))),ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"tiktok-use-photo-title",help:"".concat((0,pe.__)("Display the photo caption from","nggallery")," TikTok ").concat((0,pe.__)("on the slide.","nggallery"))},(0,pe.__)("Use Photo Title?","nggallery"))),ee().createElement("div",{className:"flex items-center"},ee().createElement(fs,{id:"tiktok-use-photo-title",name:"tiktok-use-photo-title",checked:C,onChange:function(e){N(e.target.checked),L("usePhotoTitle",e.target.checked)},label:""}))),C&&ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"tiktok-limit-caption"},(0,pe.__)("Limit Caption Length","nggallery"))),ee().createElement("div",null,ee().createElement(uc,{type:"text",id:"tiktok-limit-caption",name:"tiktok-limit-caption",value:S,onChange:function(e){O(e.target.value),L("limitCaptionLength",e.target.value)},placeholder:(0,pe.__)("For e.g. 999","nggallery")}),ee().createElement("p",{className:"text-sm text-gray-600 mt-1"},(0,pe.__)("Limits the number of words to display for each caption.","nggallery")))),ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"tiktok-cache-data",help:"".concat((0,pe.__)("Caches the data from","nggallery")," TikTok ").concat((0,pe.__)("to improve performance (recommended).","nggallery"))},(0,pe.__)("Cache Data from","nggallery")," TikTok?")),ee().createElement("div",{className:"flex items-center"},ee().createElement(fs,{id:"tiktok-cache-data",name:"tiktok-cache-data",checked:j,onChange:function(e){T(e.target.checked),L("cacheData",e.target.checked)},label:""}))),ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_60%] gap-6"},ee().createElement("div",{className:"flex items-start"},ee().createElement(cc,{htmlFor:"tiktok-show-play-button",help:(0,pe.__)("Shows a play button overlay on TikTok thumbnails in the gallery.","nggallery")},(0,pe.__)("Show Play Button?","nggallery"))),ee().createElement("div",{className:"flex items-center"},ee().createElement(fs,{id:"tiktok-show-play-button",name:"tiktok-show-play-button",checked:A,onChange:function(e){D(e.target.checked),L("showPlayButton",e.target.checked)},label:""}))))):null};function Hv(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return Vv(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Vv(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Vv(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,Vv(m,"constructor",s),Vv(s,"constructor",c),c.displayName="GeneratorFunction",Vv(s,a,"GeneratorFunction"),Vv(m),Vv(m,a,"Generator"),Vv(m,r,function(){return this}),Vv(m,"toString",function(){return"[object Generator]"}),(Hv=function(){return{w:o,m:d}})()}function Vv(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}Vv=function(e,t,n,r){function o(t,n){Vv(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Vv(e,t,n,r)}const Kv=function(e){var t=e.accounts,n=function(){var e,t=re();return gl({mutationFn:(e=No(gu().m(function e(t){var n;return gu().w(function(e){for(;;)switch(e.n){case 0:return n=Ao(),e.n=1,Oo()({path:"/nggpro/v1/tiktok/accounts/".concat(t),method:"DELETE",headers:{"X-WP-Nonce":n,"Content-Type":"application/json"}});case 1:return e.a(2)}},e)})),function(t){return e.apply(this,arguments)}),onSuccess:function(){t.invalidateQueries({queryKey:fu.tiktokAccounts})}})}(),r=hu(),a=r.handleConnectClick,o=r.isLoading,l=t.length,i=vo((0,$.useState)({isOpen:!1}),2),c=i[0],s=i[1],u=function(){var e=No(Hv().m(function e(t){var r;return Hv().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,n.mutateAsync(t);case 1:s({isOpen:!1}),e.n=3;break;case 2:e.p=2,r=e.v,console.error("Failed to remove TikTok account:",r);case 3:return e.a(2)}},e,null,[[0,2]])}));return function(t){return e.apply(this,arguments)}}();return ee().createElement("div",{className:"space-y-6"},ee().createElement("div",null,ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_65%] gap-6 mb-4"},ee().createElement("div",null,ee().createElement("h3",{className:"text-sm font-semibold text-gray-900"},"TikTok ",(0,pe.__)("Authorization Setup","nggallery"))),ee().createElement("div",{className:"text-lg font-bold text-gray-900"},l,"/",3," ",(0,pe.__)("slots used","nggallery"))),ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_65%] gap-6 mb-4"},ee().createElement("div",null),ee().createElement("div",null,ee().createElement("p",{className:"text-sm text-gray-600"},(0,pe.__)("Before you can create","nggallery")," tiktok"," ",(0,pe.__)("galleries, you need to authenticate with your Imagely","nggallery")," TikTok"," ",(0,pe.__)("accounts. Imagely supports authorization with up to","nggallery")," ",3," ",(0,pe.__)("unique","nggallery")," TikTok ",(0,pe.__)("accounts.","nggallery")))),ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_65%] gap-6 mb-6"},ee().createElement("div",null),ee().createElement("div",null,ee().createElement("p",{className:"text-sm text-gray-600"},(0,pe.__)("Need assistance?","nggallery")," ",ee().createElement("a",{href:"#",className:"text-green-600 hover:text-green-700 underline inline-flex items-center space-x-1"},ee().createElement("span",null,(0,pe.__)("Click here","nggallery")),ee().createElement(sr,{className:"w-3 h-3"}))," ",(0,pe.__)("to read further documentation.","nggallery")))),ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_65%] gap-6"},ee().createElement("div",null),ee().createElement("div",null,t.length<3?ee().createElement("button",{type:"button",onClick:a,disabled:o,className:"bg-green-500 text-white px-6 py-2 rounded-lg font-medium text-sm hover:bg-green-600 transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center space-x-2"},o&&ee().createElement(kn,{className:"animate-spin h-4 w-4"}),ee().createElement("span",null,(0,pe.__)("Connect to TikTok","nggallery"))):ee().createElement("button",{type:"button",disabled:!0,className:"bg-gray-200 text-gray-500 px-6 py-2 rounded-lg font-medium text-sm cursor-not-allowed"},(0,pe.__)("All slots used","nggallery"))))),t.length>0&&ee().createElement("div",null,ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-[30%_65%] gap-6 mb-4"},ee().createElement("div",null,ee().createElement("h3",{className:"text-sm font-semibold text-gray-900"},(0,pe.__)("Connected Accounts","nggallery"))),ee().createElement("div",null)),ee().createElement("div",{className:"space-y-4"},t.map(function(e){return ee().createElement("div",{key:e.slot,className:"grid grid-cols-1 md:grid-cols-[30%_65%] gap-6 border-b border-gray-200 pb-4 last:border-b-0"},ee().createElement("div",null),ee().createElement("div",{className:"flex items-center justify-between"},ee().createElement("div",{className:"flex items-center space-x-4"},e.avatar_url?ee().createElement("img",{src:e.avatar_url,alt:e.username||"Account ".concat(e.slot),className:"w-12 h-12 rounded-full object-cover"}):ee().createElement("div",{className:"w-12 h-12 rounded-full bg-gray-200 flex items-center justify-center"},ee().createElement("span",{className:"text-gray-500 text-sm font-medium"},e.slot)),ee().createElement("div",null,ee().createElement("div",{className:"text-sm font-medium text-gray-900"},e.username||(0,pe.__)("Account","nggallery")+" #".concat(e.slot)),ee().createElement("div",{className:"text-xs text-gray-500"},(0,pe.__)("Slot","nggallery")," ",e.slot," • ",(0,pe.__)("Connected","nggallery")," ",(t=e.time_taken)?new Date(1e3*t).toLocaleDateString():(0,pe.__)("Unknown","nggallery")))),ee().createElement("button",{type:"button",onClick:function(){return s({isOpen:!0,slot:e.slot})},disabled:n.isPending,className:"px-4 py-2 text-sm font-medium text-red-600 bg-red-50 rounded-lg hover:bg-red-100 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"},(0,pe.__)("Remove","nggallery"))));var t}))),ee().createElement(Eo,{isOpen:c.isOpen,onClose:function(){return s({isOpen:!1})}},ee().createElement("div",{className:"space-y-4"},ee().createElement("div",{className:"flex items-center gap-2 justify-center"},ee().createElement(rr,null)),ee().createElement("h2",{className:"text-xl font-bold text-center text-gray-900 mt-2"},(0,pe.__)("Remove TikTok Account","nggallery")),ee().createElement("p",{className:"text-sm text-gray-500 text-center"},(0,pe.__)("Are you sure you want to remove this TikTok account?","nggallery")),c.slot&&ee().createElement("div",{className:"text-sm text-gray-700 px-4 text-center"},ee().createElement("strong",null,(0,pe.__)("Slot","nggallery")," ",c.slot)),ee().createElement("p",{className:"text-sm text-red-500 text-center"},(0,pe.__)("This action cannot be undone.","nggallery")),ee().createElement("div",{className:"flex justify-center space-x-3 !mb-4"},ee().createElement("button",{type:"button",onClick:function(){return s({isOpen:!1})},disabled:n.isPending,className:"px-8 py-2 font-medium text-white bg-green-500 rounded-lg shadow hover:bg-green-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"},(0,pe.__)("Cancel","nggallery")),ee().createElement("button",{type:"button",onClick:function(){c.slot&&u(c.slot)},disabled:n.isPending,className:"px-8 py-2 font-bold text-white bg-red-600 border border-transparent rounded-lg shadow hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center space-x-2"},n.isPending&&ee().createElement(kn,{className:"animate-spin h-4 w-4"}),ee().createElement("span",null,n.isPending?(0,pe.__)("Removing...","nggallery"):(0,pe.__)("Remove","nggallery")))))))};function Xv(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return Yv(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Yv(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Yv(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,Yv(m,"constructor",s),Yv(s,"constructor",c),c.displayName="GeneratorFunction",Yv(s,a,"GeneratorFunction"),Yv(m),Yv(m,a,"Generator"),Yv(m,r,function(){return this}),Yv(m,"toString",function(){return"[object Generator]"}),(Xv=function(){return{w:o,m:d}})()}function Yv(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}Yv=function(e,t,n,r){function o(t,n){Yv(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Yv(e,t,n,r)}const Zv=function(e){var t=e.accounts,r=vo((0,$.useState)("settings"),2),a=r[0],o=r[1],l=gi().data,i=pi(),c=$o(),s=c.showSuccess,u=c.showError,m=(0,$.useRef)(null),d=(0,$.useRef)(!0);(0,$.useEffect)(function(){return function(){d.current=!1,m.current&&clearTimeout(m.current)}},[]);var g=(0,$.useCallback)(function(e,t){l&&(m.current&&clearTimeout(m.current),m.current=setTimeout(No(Xv().m(function r(){var a;return Xv().w(function(r){for(;;)switch(r.p=r.n){case 0:return r.p=0,r.n=1,i.mutateAsync(n({},e,t));case 1:d.current&&s((0,pe.__)("Settings updated successfully!","nggallery")),r.n=3;break;case 2:r.p=2,a=r.v,console.error("Error updating TikTok settings:",a),d.current&&u((0,pe.__)("Failed to update settings. Please try again.","nggallery"));case 3:return r.a(2)}},r,null,[[0,2]])})),333))},[l,i,s,u]);return ee().createElement("div",{className:"bg-white"},ee().createElement("div",{className:"px-4 py-4"},ee().createElement("div",{className:"border-t border-[#e2e8f0]"})),ee().createElement("div",{className:"flex px-4"},ee().createElement("button",{type:"button",onClick:function(){return o("settings")},className:"px-6 py-3 text-sm font-medium transition-colors ".concat("settings"===a?"text-gray-900 border-b-2 border-gray-900":"text-gray-600 hover:text-gray-900")},"TikTok ",(0,pe.__)("Settings","nggallery")),ee().createElement("button",{type:"button",onClick:function(){return o("configure")},className:"px-6 py-3 text-sm font-medium transition-colors ".concat("configure"===a?"text-gray-900 border-b-2 border-gray-900":"text-gray-600 hover:text-gray-900")},(0,pe.__)("Configure","nggallery"))),ee().createElement("div",{className:"px-4"},ee().createElement("div",{className:"border-b border-[#e2e8f0]"})),ee().createElement("div",{className:"p-6"},"settings"===a?ee().createElement(Kv,{accounts:t}):ee().createElement(Wv,{accounts:t,settings:l,onSettingsChange:g})))},Jv=function(){var e,t=vo((0,$.useState)(!1),2),n=t[0],r=t[1],a=(0,ge.useDispatch)(Br),o=(null===(e=yu(!0).data)||void 0===e?void 0:e.accounts)||[],l=o.length>0,i=hu().handleConnectClick;return ee().createElement("div",{className:"bg-white rounded-lg border border-[#e2e8f0] shadow-[4px_8px_16px_0px_rgba(0,0,0,0.08)]"},ee().createElement(Iv,{id:"tiktok",name:"TikTok",description:(0,pe.__)("Integrate TikTok galleries, you need to authenticate with your Imagely TikTok accounts.","nggallery"),icon:ee().createElement(Dr,{className:"w-[104px] h-[104px] text-gray-900"}),isConnected:l,isExpanded:n,onToggleExpand:function(){"pro"===zr?r(!n):a.setActiveModal("upgrade",{feature:"TikTok"})},onConnectClick:function(){"pro"===zr?i&&i():a.setActiveModal("upgrade",{feature:"TikTok"})}}),n&&ee().createElement(Zv,{accounts:o}))};var $v=["ngg_oauth","ngg_oauth_platform"],e_=["google_photos_nonce","imagely_gp_cancel","key"],t_={tiktok:"TikTok",dribbble:"Dribbble",google_photos:"Google Photos"};const n_=function(){var e=re(),t=ws(),n=t.data,r=t.isLoading,a=gi(),o=a.data,l=a.isLoading,i=$o(),c=i.showSuccess,s=i.showError,u=i.showInfo;(0,$.useEffect)(function(){var t,n=new URLSearchParams(window.location.search),r=n.get("ngg_oauth"),a=n.get("ngg_oauth_platform"),o=a?null!==(t=t_[a])&&void 0!==t?t:a:"";if(r){"success"===r?(c(o?(0,pe.sprintf)((0,pe.__)("%s account has been authenticated successfully.","nggallery"),o):(0,pe.__)("Account has been authenticated successfully.","nggallery")),"google_photos"===a&&e.invalidateQueries({queryKey:Js.accounts})):"already_connected"===r?c((0,pe.__)("Already connected with this account.","nggallery")):"slots_full"===r?s(o?(0,pe.sprintf)((0,pe.__)("All %s account slots are full. Please remove an account first.","nggallery"),o):(0,pe.__)("All account slots are full. Please remove an account first.","nggallery")):"cancelled"===r?u(o?(0,pe.sprintf)((0,pe.__)("%s sign-in was cancelled. You can connect anytime from this page.","nggallery"),o):(0,pe.__)("Sign-in was cancelled. You can try again when you are ready.","nggallery")):"error"===r&&s((0,pe.__)("An error occurred during authentication.","nggallery")),$v.forEach(function(e){return n.delete(e)}),e_.forEach(function(e){return n.delete(e)});var l=n.toString(),i=l?"".concat(window.location.pathname,"?").concat(l):window.location.pathname;window.history.replaceState({},"",i)}},[c,s,u,e]);var m,d=!r&&!l&&(null==n?void 0:n.enabled_addons)&&o&&(n.enabled_addons.dribbble&&js("dribbble",o)||n.enabled_addons.tiktok&&js("tiktok",o)||n.enabled_addons.google_analytics&&js("google_analytics",o)||n.enabled_addons.google_photos&&js("google_photos",o));return r||l||d?ee().createElement("div",{className:"space-y-4 bg-white p-6 rounded-lg border "},o&&js("dribbble",o)&&ee().createElement(Is,{addonId:"dribbble",hideWhenDisabled:!0},ee().createElement(Av,null)),o&&js("tiktok",o)&&ee().createElement(Is,{addonId:"tiktok",hideWhenDisabled:!0},ee().createElement(Jv,null)),o&&js("google_analytics",o)&&ee().createElement(Is,{addonId:"google_analytics",hideWhenDisabled:!0},ee().createElement(Gv,null)),js("google_photos",o)&&ee().createElement(Is,{addonId:"google_photos",hideWhenDisabled:!0},ee().createElement(Uv,null))):ee().createElement("div",{className:"bg-white p-6 rounded-lg border"},ee().createElement("div",{className:"p-6 bg-slate-50 border border-slate-200 rounded-lg text-center"},ee().createElement("p",{className:"text-gray-600 mb-2"},(0,pe.__)("No integration features are currently activated.","nggallery")),ee().createElement("p",{className:"text-sm text-gray-500"},(0,pe.__)("Please activate integration features from the","nggallery")," ",ee().createElement("a",{href:"".concat((null===(m=window.imagelyApp)||void 0===m?void 0:m.adminUrl)||"/wp-admin/","admin.php?page=imagely-addons"),className:"text-green-600 hover:text-green-700 underline"},(0,pe.__)("Features page","nggallery"))," ",(0,pe.__)("to use integration features.","nggallery"))))};function r_(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return a_(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(a_(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,a_(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,a_(m,"constructor",s),a_(s,"constructor",c),c.displayName="GeneratorFunction",a_(s,a,"GeneratorFunction"),a_(m),a_(m,a,"Generator"),a_(m,r,function(){return this}),a_(m,"toString",function(){return"[object Generator]"}),(r_=function(){return{w:o,m:d}})()}function a_(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}a_=function(e,t,n,r){function o(t,n){a_(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},a_(e,t,n,r)}const o_=function(){var e=vo((0,$.useState)(function(){var e,t=null===(e=window.imagelyApp)||void 0===e?void 0:e.licenseData;return t&&(t.license_key||t.is_valid)?t:null}),2),t=e[0],n=e[1],r=vo((0,$.useState)(function(){var e;return(null===(e=window.imagelyApp)||void 0===e||null===(e=e.licenseData)||void 0===e?void 0:e.license_key)||""}),2),a=r[0],o=r[1],l=vo((0,$.useState)(!1),2),i=l[0],c=l[1],s=vo((0,$.useState)(!1),2),u=s[0],m=s[1],d=(0,ge.useDispatch)(Br).showNotice;(0,$.useEffect)(function(){p()},[]),(0,$.useEffect)(function(){t&&!t.is_valid&&m(!0)},[t]);var g,p=function(){var e=No(r_().m(function e(){var t,r,a,l,i;return r_().w(function(e){for(;;)switch(e.p=e.n){case 0:if("lite"!==((null===(t=window.imagelyApp)||void 0===t?void 0:t.proTypeInstalled)||"lite")){e.n=1;break}return n({license_key:"",status:"free",level:"free",last_check:Date.now()/1e3,plugin_level:"free",is_valid:!1,expiration:null,expires_soon:!1}),o(""),e.a(2);case 1:return e.p=1,a=null===(r=window.imagelyApp)||void 0===r?void 0:r.nonce,e.n=2,Oo()({path:"/nggpro/v1/license-actions/current",method:"GET",headers:{"X-WP-Nonce":a}});case 2:(l=e.v)&&"success"===l.status&&l.data&&(i=l.data,o(i.license_key||""),n({license_key:i.license_key||"",status:i.status||"free",level:i.level||"free",last_check:i.last_check||0,plugin_level:i.plugin_level||"free",is_valid:i.is_valid||!1,expiration:i.expiration||null,expires_soon:i.expires_soon||!1})),e.n=4;break;case 3:e.p=3,e.v,d("error",(0,pe.__)("Failed to fetch license status","nggallery"));case 4:return e.a(2)}},e,null,[[1,3]])}));return function(){return e.apply(this,arguments)}}(),f=function(){var e=No(r_().m(function e(){var t,n,r,o,l,i;return r_().w(function(e){for(;;)switch(e.p=e.n){case 0:if("lite"!==((null===(t=window.imagelyApp)||void 0===t?void 0:t.proTypeInstalled)||"lite")){e.n=1;break}return d("error",(0,pe.__)("License activation is only available in NextGEN Gallery Pro, Plus, or Starter. Please upgrade to activate your license.","nggallery")),e.a(2);case 1:if(a.trim()){e.n=2;break}return d("error",(0,pe.__)("Please enter a license key","nggallery")),e.a(2);case 2:return e.p=2,c(!0),r=null===(n=window.imagelyApp)||void 0===n?void 0:n.nonce,e.n=3,Oo()({path:"/nggpro/v1/license-actions/manage-license",method:"POST",headers:{"X-WP-Nonce":r,"Content-Type":"application/json"},data:{license_key:a,action_perform:"verify"}});case 3:"success"===(o=e.v).status?(d("success",o.message),setTimeout(function(){p(),m(!1)},1e3)):h(o),e.n=10;break;case 4:if(e.p=4,!((i=e.v)instanceof Response)){e.n=9;break}return e.p=5,e.n=6,i.json();case 6:l=e.v,h(l),e.n=8;break;case 7:e.p=7,e.v,d("error",(0,pe.__)("Failed to activate license. Please check your connection and try again.","nggallery"));case 8:e.n=10;break;case 9:h(i);case 10:return e.p=10,c(!1),e.f(10);case 11:return e.a(2)}},e,null,[[5,7],[2,4,10,11]])}));return function(){return e.apply(this,arguments)}}(),y=function(){var e=No(r_().m(function e(){var t,r,l,i,s,u;return r_().w(function(e){for(;;)switch(e.p=e.n){case 0:if("lite"!==((null===(t=window.imagelyApp)||void 0===t?void 0:t.proTypeInstalled)||"lite")){e.n=1;break}return d("error",(0,pe.__)("License deactivation is only available in NextGEN Gallery Pro, Plus, or Starter. Please upgrade to manage your license.","nggallery")),e.a(2);case 1:return e.p=1,c(!0),l=null===(r=window.imagelyApp)||void 0===r?void 0:r.nonce,e.n=2,Oo()({path:"/nggpro/v1/license-actions/manage-license",method:"POST",headers:{"X-WP-Nonce":l,"Content-Type":"application/json"},data:{license_key:a,action_perform:"deactivate"}});case 2:"success"===(i=e.v).status?(d("success",i.message),n(null),o(""),m(!0)):h(i),e.n=9;break;case 3:if(e.p=3,!((u=e.v)instanceof Response)){e.n=8;break}return e.p=4,e.n=5,u.json();case 5:s=e.v,h(s),e.n=7;break;case 6:e.p=6,e.v,d("error",(0,pe.__)("Failed to deactivate license. Please check your connection and try again.","nggallery"));case 7:e.n=9;break;case 8:h(u);case 9:return e.p=9,c(!1),e.f(9);case 10:return e.a(2)}},e,null,[[4,6],[1,3,9,10]])}));return function(){return e.apply(this,arguments)}}(),h=function(e){var t=(null==e?void 0:e.message)||(0,pe.__)("An unknown error occurred","nggallery");null!=e&&e.error_code&&(t+=" (".concat((0,pe.__)("Error Code","nggallery"),": ").concat(e.error_code,")")),null!=e&&e.details&&(t+=" - ".concat(e.details)),null!=e&&e.api_error&&(t+=" ".concat((0,pe.__)("API Error","nggallery"),": ").concat(e.api_error)),d("error",t,{duration:0})},b=function(e){return e?"lifetime"===e?(0,pe.__)("Lifetime","nggallery"):"number"==typeof e?new Date(1e3*e).toLocaleDateString():(0,pe.__)("Unknown","nggallery"):(0,pe.__)("Unknown","nggallery")},v=function(e,t){return e?"lifetime"===e?{text:(0,pe.__)("Never expires","nggallery"),className:"text-green-600"}:"number"==typeof e?e<Math.floor(Date.now()/1e3)?{text:(0,pe.__)("Expired","nggallery"),className:"text-red-600"}:t?{text:(0,pe.__)("Expires soon","nggallery"),className:"text-orange-600"}:{text:b(e),className:"text-green-600"}:{text:(0,pe.__)("Unknown","nggallery"),className:"text-gray-600"}:{text:(0,pe.__)("Unknown","nggallery"),className:"text-gray-600"}},_=function(){var e=No(r_().m(function e(t){var n,r,o;return r_().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t.preventDefault(),a.trim()){e.n=1;break}return d("error",(0,pe.__)("Please enter a license key","nggallery")),e.a(2);case 1:return c(!0),e.p=2,e.n=3,Oo()({path:"/imagely/v1/license/activate",method:"POST",data:{license_key:a}});case 3:(n=e.v).success?(d("success",n.message||(0,pe.__)("License activated successfully! The page will reload to apply changes.","nggallery"),{duration:0}),setTimeout(function(){window.location.reload()},2e3)):d("error",n.message||(0,pe.__)("Failed to activate license. Please check your license key and try again.","nggallery"),{duration:0}),e.n=5;break;case 4:e.p=4,o=e.v,console.error("License activation error:",o),r=o.message||(0,pe.__)("An error occurred while activating the license. Please try again.","nggallery"),d("error",r,{duration:0});case 5:return e.p=5,c(!1),e.f(5);case 6:return e.a(2)}},e,null,[[2,4,5,6]])}));return function(t){return e.apply(this,arguments)}}();return"lite"===zr?ee().createElement("div",{className:"space-y-6"},ee().createElement("div",null,ee().createElement("h2",{className:"text-2xl font-semibold text-gray-900 mb-2"},(0,pe.__)("License","nggallery")),ee().createElement("p",{className:"text-gray-600 mb-4"},(0,pe.__)("Your license key provides access to updates and add-ons.","nggallery"))),ee().createElement("div",{className:"bg-white p-6 rounded-lg border border-gray-200 shadow-sm"},ee().createElement("p",{className:"text-gray-900 mb-2"},(0,pe.__)("You're using Imagely Lite - no license needed. Enjoy! 🙂","nggallery")),ee().createElement("p",{className:"text-gray-900 mb-2"},(0,pe.__)("To unlock more features consider","nggallery")," ",ee().createElement("a",{href:Cp("settingslicense"),target:"_blank",rel:"noopener noreferrer",className:"text-green-500 font-bold hover:text-green-600"},(0,pe.__)("Upgrading to PRO","nggallery")),"."),ee().createElement("p",{className:"text-gray-900 mb-4"},(0,pe.__)("As a valued Imagely Lite user you receive","nggallery")," ",ee().createElement("span",{className:"font-bold"},"50%")," ",(0,pe.__)("off, automatically applied at checkout","nggallery")),ee().createElement("form",{onSubmit:_,className:"space-y-4"},ee().createElement("div",null,ee().createElement("label",{htmlFor:"license-key-input",className:"block text-sm font-medium text-gray-700 mb-2"},(0,pe.__)("Already purchased? Simply enter your license key below to enable Imagely PRO!","nggallery")),ee().createElement("input",{id:"license-key-input",type:"text",value:a,onChange:function(e){return o(e.target.value)},placeholder:(0,pe.__)("Enter your license key...","nggallery"),className:"w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",disabled:i,required:!0})),ee().createElement("div",null,ee().createElement("button",{type:"submit",disabled:i||!a.trim(),className:"flex items-center justify-center px-6 py-3 rounded-md text-white font-medium transition-colors ".concat(i||!a.trim()?"bg-green-200 cursor-not-allowed":"bg-green-500 hover:bg-green-600 focus:outline-none focus:ring-2 focus:ring-green-500 focus:ring-offset-2")},i?ee().createElement(ee().Fragment,null,ee().createElement(kn,{className:"w-5 h-5 mr-2 animate-spin"}),(0,pe.__)("Activating and Installing...","nggallery")):(0,pe.__)("Activate License & Install Pro","nggallery")))))):ee().createElement("div",{className:"space-y-6"},ee().createElement("div",null,ee().createElement("h2",{className:"text-2xl font-semibold text-gray-900 mb-2"},(0,pe.__)("License Management","nggallery")),ee().createElement("p",{className:"text-gray-600"},(0,pe.__)("Manage your NextGEN Gallery Pro license key to unlock premium features.","nggallery"))),t&&t.license_key&&ee().createElement("div",{className:"bg-white p-6 rounded-lg border border-gray-200 shadow-sm"},ee().createElement("div",{className:"flex items-center justify-between mb-4"},ee().createElement("h3",{className:"text-lg font-medium text-gray-900"},(0,pe.__)("Current License Status","nggallery")),t.is_valid&&ee().createElement("div",{className:"flex items-center space-x-2"},ee().createElement("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800"},ee().createElement(Kn,{className:"w-4 h-4 mr-1"}),(0,pe.__)("Active","nggallery")))),ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4"},ee().createElement("div",{className:"bg-white p-4 rounded-md border border-gray-200"},ee().createElement("label",{className:"block text-sm font-medium text-gray-700 mb-1"},(0,pe.__)("License Key","nggallery")),ee().createElement("p",{className:"text-sm text-gray-900 font-mono"},t.license_key?"****-****-****-"+t.license_key.slice(-4):(0,pe.__)("Not set","nggallery"))),ee().createElement("div",{className:"bg-white p-4 rounded-md border border-gray-200"},ee().createElement("label",{className:"block text-sm font-medium text-gray-700 mb-1"},(0,pe.__)("Status","nggallery")),ee().createElement("p",{className:"text-sm font-medium ".concat(t.is_valid?"text-green-600":"text-red-600")},function(e){switch(e){case"active":case"valid":return(0,pe.__)("Active","nggallery");case"expired":return(0,pe.__)("Expired","nggallery");case"invalid":return(0,pe.__)("Invalid","nggallery");case"disabled":return(0,pe.__)("Disabled","nggallery");case"revoked":return(0,pe.__)("Revoked","nggallery");default:return(0,pe.__)("Unknown","nggallery")}}(t.status))),ee().createElement("div",{className:"bg-white p-4 rounded-md border border-gray-200"},ee().createElement("label",{className:"block text-sm font-medium text-gray-700 mb-1"},(0,pe.__)("License Level","nggallery")),ee().createElement("p",{className:"text-sm text-gray-900 capitalize"},t.level||(0,pe.__)("Free","nggallery"))),ee().createElement("div",{className:"bg-white p-4 rounded-md border border-gray-200"},ee().createElement("label",{className:"block text-sm font-medium text-gray-700 mb-1"},(0,pe.__)("Expiration","nggallery")),ee().createElement("p",{className:"text-sm font-medium ".concat(v(t.expiration,t.expires_soon).className)},v(t.expiration,t.expires_soon).text)),ee().createElement("div",{className:"bg-white p-4 rounded-md border border-gray-200"},ee().createElement("label",{className:"block text-sm font-medium text-gray-700 mb-1"},(0,pe.__)("Last Check","nggallery")),ee().createElement("p",{className:"text-sm text-gray-900"},(g=t.last_check)?new Date(1e3*g).toLocaleDateString():(0,pe.__)("Never","nggallery")))),t.is_valid&&ee().createElement("div",{className:"mt-6 flex justify-end"},ee().createElement("button",{onClick:function(){m(!u)},className:"inline-flex items-center px-4 py-2 bg-green-500 text-white text-sm font-medium rounded-md hover:bg-green-600 focus:outline-none focus:ring-2 focus:ring-green-500 focus:ring-offset-2 transition-colors"},ee().createElement("svg",{className:"w-4 h-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},ee().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})),u?(0,pe.__)("Hide Edit","nggallery"):(0,pe.__)("Edit License","nggallery")))),(!(null!=t&&t.is_valid)||u)&&ee().createElement("div",{className:"bg-white p-6 border border-gray-200 rounded-lg shadow-sm"},ee().createElement("div",{className:"flex items-center justify-between mb-4"},ee().createElement("h3",{className:"text-lg font-medium text-gray-900"},null!=t&&t.is_valid?(0,pe.__)("Update License Key","nggallery"):(0,pe.__)("Activate License","nggallery")),(null==t?void 0:t.is_valid)&&u&&ee().createElement("button",{onClick:function(){m(!1),o((null==t?void 0:t.license_key)||"")},className:"text-sm text-gray-500 hover:text-gray-700 focus:outline-none"},(0,pe.__)("Cancel","nggallery"))),ee().createElement("div",{className:"space-y-4"},ee().createElement("div",null,ee().createElement("label",{htmlFor:"license-key",className:"block text-sm font-medium text-gray-700 mb-2"},(0,pe.__)("License Key","nggallery")),ee().createElement("input",{type:"text",id:"license-key",value:a,onChange:function(e){return o(e.target.value)},placeholder:(0,pe.__)("Enter your license key","nggallery"),className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 transition-colors",disabled:i}),ee().createElement("p",{className:"mt-1 text-sm text-gray-500"},(0,pe.__)("You can find your license key in your account dashboard.","nggallery"))),ee().createElement("div",{className:"flex space-x-3"},ee().createElement("button",{onClick:f,disabled:i||!a.trim(),className:"px-4 py-2 bg-green-500 text-white rounded-md hover:bg-green-600 focus:outline-none focus:ring-2 focus:ring-green-500 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed transition-colors"},i?ee().createElement("span",{className:"flex items-center"},ee().createElement(kn,{className:"animate-spin -ml-1 mr-2 h-4 w-4 text-white"}),(0,pe.__)("Processing...","nggallery")):(0,pe.__)("Activate License","nggallery")),(null==t?void 0:t.is_valid)&&ee().createElement("button",{onClick:y,disabled:i,className:"px-4 py-2 bg-white text-gray-700 border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 disabled:opacity-50 disabled:cursor-not-allowed transition-colors"},(0,pe.__)("Deactivate License","nggallery"))))))};function l_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function i_(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?l_(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):l_(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}const c_=function(e){var t,r,a,o,l=e.settings,i=e.onSettingsChange,c=function(e,t){i&&i(e,t)};if(!l)return null;var s=[].concat(ko("pro"===zr||"plus"===zr?[{value:"photocrati-nextgen_pro_lightbox",label:(0,pe.__)("Pro Lightbox","nggallery")}]:[]),[{value:"simplelightbox",label:(0,pe.__)("Simplelightbox","nggallery")},{value:"fancybox",label:(0,pe.__)("Fancybox","nggallery")},{value:"thickbox",label:(0,pe.__)("Thickbox","nggallery")},{value:"shutter",label:(0,pe.__)("Shutter","nggallery")},{value:"shutter2",label:(0,pe.__)("Shutter Reloaded","nggallery")},{value:"custom_lightbox",label:(0,pe.__)("Custom Lightbox","nggallery")},{value:"none",label:(0,pe.__)("None","nggallery")}]),u=[{value:"nextgen_images",label:(0,pe.__)("Only apply to Imagely images","nggallery")},{value:"nextgen_and_wp_images",label:(0,pe.__)("Only apply to Imagely and WordPress images","nggallery")},{value:"all_images",label:(0,pe.__)("Try to apply to all images","nggallery")},{value:"all_images_direct",label:(0,pe.__)("Try to apply to all images that link to image files","nggallery")}],m=ii(l.ngg_pro_lightbox||{}),d=function(e,t){i&&i("ngg_pro_lightbox",i_(i_({},m),{},n({},e,t)))};return ee().createElement("div",{className:"space-y-4"},ee().createElement(nf,{title:(0,pe.__)("Lightbox Configuration","nggallery"),defaultExpanded:!0},ee().createElement("div",{className:"space-y-6"},ee().createElement("div",{className:"bg-info-bg border border-info-border rounded-md p-4"},ee().createElement("div",{className:"flex items-start"},ee().createElement("div",{className:"flex-shrink-0"},ee().createElement(cr,{className:"h-5 w-5 text-gray-400"})),ee().createElement("div",{className:"ml-3"},ee().createElement("h3",{className:"text-sm font-medium text-gray-800"},(0,pe.__)("About Lightbox Effects","nggallery")),ee().createElement("div",{className:"mt-2 text-sm text-gray-700"},ee().createElement("p",null,(0,pe.__)("Lightbox effects allow images to be displayed in an overlay when clicked. The context setting determines which images on your site will be affected by the lightbox.","nggallery")))))),ee().createElement("div",null,ee().createElement(sc,{id:"thumbEffect",name:"thumbEffect",value:l.thumbEffect||"",onChange:function(e){return c("thumbEffect",e.target.value)},label:(0,pe.__)("Lightbox Library","nggallery"),help:(0,pe.__)("What lightbox would you like to use?","nggallery")},s.map(function(e){return ee().createElement("option",{key:e.value,value:e.value},e.label)}))),"custom_lightbox"===l.thumbEffect&&ee().createElement("div",{className:"space-y-6 ml-4"},ee().createElement("div",null,ee().createElement(Yc,{id:"thumbEffectCode",name:"thumbEffectCode",value:l.thumbEffectCode||"",onChange:function(e){return c("thumbEffectCode",e.target.value)},label:(0,pe.__)("Custom JavaScript Code","nggallery"),help:(0,pe.__)("Enter any custom JavaScript code for your lightbox","nggallery"),placeholder:"// Your custom JavaScript code here",rows:6})),ee().createElement("div",null,ee().createElement(Yc,{id:"thumbEffectScripts",name:"thumbEffectScripts",value:(l.thumbEffectScripts||[]).join("\n"),onChange:function(e){return c("thumbEffectScripts",e.target.value.split("\n").filter(function(e){return e.trim()}))},label:(0,pe.__)("JavaScript URLs","nggallery"),help:(0,pe.__)("Enter URLs for JavaScript files (one per line)","nggallery"),placeholder:"https://example.com/script1.js\nhttps://example.com/script2.js",rows:4})),ee().createElement("div",null,ee().createElement(Yc,{id:"thumbEffectStyles",name:"thumbEffectStyles",value:(l.thumbEffectStyles||[]).join("\n"),onChange:function(e){return c("thumbEffectStyles",e.target.value.split("\n").filter(function(e){return e.trim()}))},label:(0,pe.__)("Stylesheet URLs","nggallery"),help:(0,pe.__)("Enter URLs for CSS files (one per line)","nggallery"),placeholder:"https://example.com/style1.css\nhttps://example.com/style2.css",rows:4}))),ee().createElement("div",null,ee().createElement(sc,{id:"thumbEffectContext",name:"thumbEffectContext",value:l.thumbEffectContext||"nextgen_images",onChange:function(e){return c("thumbEffectContext",e.target.value)},label:(0,pe.__)("Lightbox Context","nggallery"),help:(0,pe.__)("What must the lightbox be applied to?","nggallery")},u.map(function(e){return ee().createElement("option",{key:e.value,value:e.value},e.label)}))),"photocrati-nextgen_pro_lightbox"===l.thumbEffect&&ee().createElement("div",{className:"space-y-6 ml-4"},ee().createElement(nf,{title:(0,pe.__)("Color options","nggallery"),defaultExpanded:!0},ee().createElement("div",{className:"space-y-4"},ee().createElement(sc,{id:"npl-style",name:"ngg_pro_lightbox.style",value:m.style||"white",onChange:function(e){return d("style",e.target.value)},label:(0,pe.__)("Color theme","nggallery")},ee().createElement("option",{value:"dark"},(0,pe.__)("Default: a dark theme","nggallery")),ee().createElement("option",{value:"black"},(0,pe.__)("All black: Removes borders from the comments panel","nextgen-gallery-pro")),ee().createElement("option",{value:"white"},(0,pe.__)("All white: A white based theme","nggallery"))),ee().createElement("div",null,ee().createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},(0,pe.__)("Background color","nggallery")),ee().createElement(Of,{color:m.background_color||"#ffffff",onChange:function(e){return d("background_color",e)}})),ee().createElement("div",null,ee().createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},(0,pe.__)("Sidebar background color","nggallery")),ee().createElement(Of,{color:m.sidebar_background_color||"",onChange:function(e){return d("sidebar_background_color",e)}})),ee().createElement("div",null,ee().createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},(0,pe.__)("Sidebar button text color","nggallery")),ee().createElement(Of,{color:m.sidebar_button_color||"",onChange:function(e){return d("sidebar_button_color",e)}})),ee().createElement("div",null,ee().createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},(0,pe.__)("Sidebar button background","nggallery")),ee().createElement(Of,{color:m.sidebar_button_background||"",onChange:function(e){return d("sidebar_button_background",e)}})),ee().createElement("div",null,ee().createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},(0,pe.__)("Carousel background color","nggallery")),ee().createElement(Of,{color:m.carousel_background_color||"",onChange:function(e){return d("carousel_background_color",e)}})),ee().createElement("div",null,ee().createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},(0,pe.__)("Carousel text color","nggallery")),ee().createElement(Of,{color:m.carousel_text_color||"#7a7a7a",onChange:function(e){return d("carousel_text_color",e)}})),ee().createElement("div",null,ee().createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},(0,pe.__)("Floating elements color","nggallery")),ee().createElement(Of,{color:m.overlay_icon_color||"",onChange:function(e){return d("overlay_icon_color",e)}})),ee().createElement("div",null,ee().createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},(0,pe.__)("Icon color","nggallery")),ee().createElement(Of,{color:m.icon_color||"#ffffff",onChange:function(e){return d("icon_color",e)}})),ee().createElement(fs,{id:"npl-icon-bg-enabled",name:"ngg_pro_lightbox.icon_background_enabled",checked:!!m.icon_background_enabled,onChange:function(e){return d("icon_background_enabled",e.target.checked)},label:(0,pe.__)("Display background on carousel icons","nggallery")}),ee().createElement(fs,{id:"npl-icon-bg-rounded",name:"ngg_pro_lightbox.icon_background_rounded",checked:!!m.icon_background_rounded,onChange:function(e){return d("icon_background_rounded",e.target.checked)},label:(0,pe.__)("Display rounded background on carousel icons","nextgen-gallery-pro")}),ee().createElement("div",null,ee().createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},(0,pe.__)("Icon background","nggallery")),ee().createElement(Of,{color:m.icon_background||"#444444",onChange:function(e){return d("icon_background",e)}})))),ee().createElement(nf,{title:(0,pe.__)("Lightbox and image sizing","nggallery"),defaultExpanded:!0},ee().createElement("div",{className:"space-y-4"},ee().createElement("div",{className:"grid grid-cols-2 gap-4"},ee().createElement(uc,{name:"ngg_pro_lightbox.padding",value:String(null!==(t=m.padding)&&void 0!==t?t:0),onChange:function(e){return d("padding",e.target.value)},label:(0,pe.__)("Lightbox padding","nggallery"),type:"number"}),ee().createElement(sc,{id:"npl-padding-unit",name:"ngg_pro_lightbox.padding_unit",value:m.padding_unit||"px",onChange:function(e){return d("padding_unit",e.target.value)},label:(0,pe.__)("Padding unit","nggallery")},ee().createElement("option",{value:"px"},"px"),ee().createElement("option",{value:"%"},"%"))),ee().createElement(sc,{id:"npl-image-crop",name:"ngg_pro_lightbox.image_crop",value:m.image_crop||"false",onChange:function(e){return d("image_crop",e.target.value)},label:(0,pe.__)("Crop image display","nggallery")},ee().createElement("option",{value:"true"},(0,pe.__)("Images will be scaled to fill the display, centered and cropped","nextgen-gallery-pro")),ee().createElement("option",{value:"false"},(0,pe.__)("Images will be scaled down until the entire image fits","nextgen-gallery-pro")),ee().createElement("option",{value:"height"},(0,pe.__)("Images will scale to fill the height of the display","nextgen-gallery-pro")),ee().createElement("option",{value:"width"},(0,pe.__)("Images will scale to fill the width of the display","nextgen-gallery-pro")),ee().createElement("option",{value:"landscape"},(0,pe.__)("Landscape images will fill the display, but scale portraits to fit","nextgen-gallery-pro")),ee().createElement("option",{value:"portrait"},(0,pe.__)("Portrait images will fill the display, but scale landscapes to fit","nextgen-gallery-pro"))),ee().createElement(fs,{id:"npl-image-pan",name:"ngg_pro_lightbox.image_pan",checked:!!m.image_pan,onChange:function(e){return d("image_pan",e.target.checked)},label:(0,pe.__)("Pan cropped images","nggallery")}))),ee().createElement(nf,{title:(0,pe.__)("Social","nggallery"),defaultExpanded:!0},ee().createElement("div",{className:"space-y-4"},ee().createElement(fs,{id:"npl-enable-comments",name:"ngg_pro_lightbox.enable_comments",checked:!!m.enable_comments,onChange:function(e){return d("enable_comments",e.target.checked)},label:(0,pe.__)("Enable comments","nggallery")}),ee().createElement(fs,{id:"npl-display-comments",name:"ngg_pro_lightbox.display_comments",checked:!!m.display_comments,onChange:function(e){return d("display_comments",e.target.checked)},label:(0,pe.__)("Display comments initially","nggallery")}),ee().createElement(fs,{id:"npl-enable-sharing",name:"ngg_pro_lightbox.enable_sharing",checked:!!m.enable_sharing,onChange:function(e){return d("enable_sharing",e.target.checked)},label:(0,pe.__)("Enable sharing","nggallery")}),ee().createElement(Yc,{id:"npl-facebook-app-id",name:"ngg_pro_lightbox.facebook_app_id",value:m.facebook_app_id||"",onChange:function(e){return d("facebook_app_id",e.target.value)},label:(0,pe.__)("Facebook App ID","nggallery"),rows:1}),ee().createElement(fs,{id:"npl-enable-twitter-cards",name:"ngg_pro_lightbox.enable_twitter_cards",checked:!!m.enable_twitter_cards,onChange:function(e){return d("enable_twitter_cards",e.target.checked)},label:(0,pe.__)("Enable Twitter Cards","nggallery")}),ee().createElement(Yc,{id:"npl-twitter-username",name:"ngg_pro_lightbox.twitter_username",value:m.twitter_username||"",onChange:function(e){return d("twitter_username",e.target.value)},label:(0,pe.__)("Twitter username","nggallery"),rows:1}))),ee().createElement(nf,{title:(0,pe.__)("Thumbnail carousel","nggallery"),defaultExpanded:!0},ee().createElement("div",{className:"space-y-4"},ee().createElement(sc,{id:"npl-enable-carousel",name:"ngg_pro_lightbox.enable_carousel",value:m.enable_carousel||"always",onChange:function(e){return d("enable_carousel",e.target.value)},label:(0,pe.__)("Display carousel thumbnails","nggallery")},ee().createElement("option",{value:"always"},(0,pe.__)("Always display thumbnails","nggallery")),ee().createElement("option",{value:"never"},(0,pe.__)("Never display thumbnails","nggallery")),ee().createElement("option",{value:"nomobile"},(0,pe.__)("Only on desktop browsers","nggallery"))),ee().createElement(fs,{id:"npl-display-carousel",name:"ngg_pro_lightbox.display_carousel",checked:!!m.display_carousel,onChange:function(e){return d("display_carousel",e.target.checked)},label:(0,pe.__)("Display carousel initially","nggallery")}),ee().createElement(fs,{id:"npl-display-captions",name:"ngg_pro_lightbox.display_captions",checked:!!m.display_captions,onChange:function(e){return d("display_captions",e.target.checked)},label:(0,pe.__)("Display captions initially","nggallery")}))),ee().createElement(nf,{title:(0,pe.__)("ECommerce","nggallery"),defaultExpanded:!0},ee().createElement("div",{className:"space-y-4"},ee().createElement(fs,{id:"npl-display-cart",name:"ngg_pro_lightbox.display_cart",checked:!!m.display_cart,onChange:function(e){return d("display_cart",e.target.checked)},label:(0,pe.__)("Display cart initially","nggallery")}))),ee().createElement(nf,{title:(0,pe.__)("Transition effects","nggallery"),defaultExpanded:!0},ee().createElement("div",{className:"space-y-4"},ee().createElement(sc,{id:"npl-transition-effect",name:"ngg_pro_lightbox.transition_effect",value:m.transition_effect||"slide",onChange:function(e){return d("transition_effect",e.target.value)},label:(0,pe.__)("Transition effect","nggallery")},ee().createElement("option",{value:"fade"},(0,pe.__)("Crossfade betweens images","nggallery")),ee().createElement("option",{value:"flash"},(0,pe.__)("Fades into background color between images","nggallery")),ee().createElement("option",{value:"pulse"},(0,pe.__)("Quickly removes the image into background color, then fades the next image","nextgen-gallery-pro")),ee().createElement("option",{value:"slide"},(0,pe.__)("Slides the images depending on image position","nggallery")),ee().createElement("option",{value:"fadeslide"},(0,pe.__)("Fade between images and slide slightly at the same time","nextgen-gallery-pro"))),ee().createElement(uc,{name:"ngg_pro_lightbox.transition_speed",value:String(null!==(r=m.transition_speed)&&void 0!==r?r:.4),onChange:function(e){return d("transition_speed",parseFloat(e.target.value))},label:(0,pe.__)("Transition speed","nggallery"),min:0,type:"number"}),ee().createElement(uc,{type:"number",name:"ngg_pro_lightbox.slideshow_speed",value:String(null!==(a=m.slideshow_speed)&&void 0!==a?a:5),onChange:function(e){return d("slideshow_speed",parseInt(e.target.value,10)||0)},label:(0,pe.__)("Slideshow speed","nggallery"),help:(0,pe.__)("Measured in seconds","nggallery"),min:0}),ee().createElement(fs,{id:"npl-interaction-pause",name:"ngg_pro_lightbox.interaction_pause",checked:!!m.interaction_pause,onChange:function(e){return d("interaction_pause",e.target.checked)},label:(0,pe.__)("Pause on interaction","nggallery")}))),ee().createElement(nf,{title:(0,pe.__)("Other settings","nggallery"),defaultExpanded:!0},ee().createElement("div",{className:"space-y-4"},ee().createElement(fs,{id:"npl-enable-routing",name:"ngg_pro_lightbox.enable_routing",checked:!!m.enable_routing,onChange:function(e){return d("enable_routing",e.target.checked)},label:(0,pe.__)("Enable browser routing","nggallery")}),ee().createElement(Yc,{id:"npl-router-slug",name:"ngg_pro_lightbox.router_slug",value:m.router_slug||"gallery",onChange:function(e){return d("router_slug",e.target.value)},label:(0,pe.__)("Router slug","nggallery"),rows:1}),ee().createElement(uc,{name:"ngg_pro_lightbox.localize_limit",value:String(null!==(o=m.localize_limit)&&void 0!==o?o:100),onChange:function(e){return d("localize_limit",parseInt(e.target.value,10)||0)},label:(0,pe.__)("Localize limit","nggallery"),min:0,type:"number"})))))))},s_=function(e){var t,n,r=e.settings,a=e.onSettingsChange,o=function(e,t){a&&a(e,t)},l=function(e){return function(t){o(e,t.target.checked)}};return r?ee().createElement("div",{className:"space-y-4"},ee().createElement(nf,{title:(0,pe.__)("Media RSS","nggallery"),defaultExpanded:!0},ee().createElement("div",{className:"space-y-4"},ee().createElement("div",null,ee().createElement(fs,{id:"useMediaRSS",name:"useMediaRSS",checked:r.useMediaRSS||!1,onChange:l("useMediaRSS"),label:(0,pe.__)("Add MediaRSS link?","nggallery"),help:(0,pe.__)("When enabled, adds a MediaRSS link to your header. Third-party web services can use this to publish your galleries","nggallery")})),ee().createElement("div",null,ee().createElement(fs,{id:"galleries_in_feeds",name:"galleries_in_feeds",checked:r.galleries_in_feeds||!1,onChange:l("galleries_in_feeds"),label:(0,pe.__)("Display galleries in feeds","nggallery"),help:(0,pe.__)("NextGEN hides its gallery displays in feeds other than MediaRSS. This enables image galleries in feeds.","nggallery")})))),ee().createElement(nf,{title:(0,pe.__)("Other Settings","nggallery"),defaultExpanded:!0},ee().createElement("div",{className:"space-y-4"},ee().createElement("div",null,ee().createElement(uc,{type:"text",id:"router_param_slug",name:"router_param_slug",value:r.router_param_slug||"",onChange:function(e){return o("router_param_slug",e.target.value)},label:(0,pe.__)("Permalink slug","nggallery")})),ee().createElement("div",null,ee().createElement(uc,{type:"number",id:"maximum_entity_count",name:"maximum_entity_count",value:(null===(t=r.maximum_entity_count)||void 0===t?void 0:t.toString())||"500",onChange:function(e){return o("maximum_entity_count",parseInt(e.target.value)||500)},label:(0,pe.__)("Maximum image count","nggallery"),help:(0,pe.__)("This is the maximum limit of images that NextGEN will restrict itself to querying. Note: This limit will not apply to slideshow widgets or random galleries if/when those galleries specify their own image limits","nggallery"),min:1})),ee().createElement("div",null,ee().createElement(uc,{type:"number",id:"random_widget_cache_ttl",name:"random_widget_cache_ttl",value:(null===(n=r.random_widget_cache_ttl)||void 0===n?void 0:n.toString())||"0",onChange:function(e){return o("random_widget_cache_ttl",parseInt(e.target.value)||0)},label:(0,pe.__)("Random widget cache duration","nggallery"),help:(0,pe.__)('The duration of time (in minutes) that "random" widget galleries should be cached. A setting of zero will disable caching.',"nggallery"),min:0})),ee().createElement("div",null,ee().createElement(fs,{id:"use_alternate_random_method",name:"use_alternate_random_method",checked:r.use_alternate_random_method||!1,onChange:l("use_alternate_random_method"),label:(0,pe.__)("Use alternative method of retrieving random image galleries","nggallery"),help:(0,pe.__)("Some web hosts' database servers disable or disrupt queries using 'ORDER BY RAND()' which can cause galleries to lose their randomness. NextGen provides an alternative (but not completely random) method to determine what images are fed into 'random' galleries.","nggallery")})),ee().createElement("div",null,ee().createElement(fs,{id:"disable_ngg_tags_page",name:"disable_ngg_tags_page",checked:r.disable_ngg_tags_page||!1,onChange:l("disable_ngg_tags_page"),label:(0,pe.__)("Disable the /ngg_tag/ page","nggallery"),help:(0,pe.__)("Normally an SEO feature; some users may wish to disable this to prevent NextGEN from revealing image tags to site visitors","nggallery")})),ee().createElement("div",null,ee().createElement(fs,{id:"dynamic_image_filename_separator_use_dash",name:"dynamic_image_filename_separator_use_dash",checked:r.dynamic_image_filename_separator_use_dash||!1,onChange:l("dynamic_image_filename_separator_use_dash"),label:(0,pe.__)("Use dashes instead of underscores when generating new image files","nggallery"),help:(0,pe.__)("Google does not treat underscores as word separators when it indexes images and so treats 'portrait-of-a-man_800x600' as 'portrait-of-a-man800x600' which is not good for SEO. Until NextGEN 3.19 the default character was an underscore; enabling this option changes it to the SEO friendly dash character. This will cause new dynamic images to be generated, and using the above 'Clear image cache' button is recommended after changing.","nggallery")}))))):null};function u_(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return m_(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(m_(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,m_(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,m_(m,"constructor",s),m_(s,"constructor",c),c.displayName="GeneratorFunction",m_(s,a,"GeneratorFunction"),m_(m),m_(m,a,"Generator"),m_(m,r,function(){return this}),m_(m,"toString",function(){return"[object Generator]"}),(u_=function(){return{w:o,m:d}})()}function m_(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}m_=function(e,t,n,r){function o(t,n){m_(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},m_(e,t,n,r)}const d_=function(){var e=vo((0,$.useState)(!1),2),t=e[0],n=e[1],r=vo((0,$.useState)("all"),2),a=r[0],o=r[1],l=vo((0,$.useState)(!1),2),i=l[0],c=l[1],s=$o(),u=s.showSuccess,m=s.showError,d=function(){var e,t=re();return gl({mutationFn:(e=No(ui().m(function e(t){var n,r;return ui().w(function(e){for(;;)switch(e.n){case 0:return r=null===(n=window.imagelyApp)||void 0===n?void 0:n.nonce,e.n=1,Oo()({path:"/imagely/v1/settings/reset",method:"POST",headers:{"X-WP-Nonce":r,"Content-Type":"application/json"},data:t});case 1:return e.a(2,e.v)}},e)})),function(t){return e.apply(this,arguments)}),onSuccess:function(){t.invalidateQueries({queryKey:["settings"]})}})}(),g=function(){var e,t=re();return gl({mutationFn:(e=No(ui().m(function e(){var t,n;return ui().w(function(e){for(;;)switch(e.n){case 0:return n=null===(t=window.imagelyApp)||void 0===t?void 0:t.nonce,e.n=1,Oo()({path:"/imagely/v1/cache/clear",method:"POST",headers:{"X-WP-Nonce":n,"Content-Type":"application/json"}});case 1:return e.a(2)}},e)})),function(){return e.apply(this,arguments)}),onSuccess:function(){t.invalidateQueries({queryKey:["settings"]})}})}(),p="pro"===zr,f=function(e){switch(e){case"all":return{title:(0,pe.__)("Reset All Settings","nggallery"),description:(0,pe.__)("Reset all NextGEN Gallery settings to their default values. This includes all gallery settings, display options, and ecommerce configurations (if Pro is installed).","nggallery"),warning:(0,pe.__)("Resets all NextGEN and NextGEN Pro settings to default values, including ecommerce.","nggallery"),buttonText:(0,pe.__)("Reset All Settings","nggallery"),confirmText:(0,pe.__)("Reset all settings to default values?\n\nThis will reset ALL settings including galleries, display types, and ecommerce configurations.\n\nChoose [Cancel] to Stop, [Reset Settings] to proceed.","nggallery"),settingsType:"all",iconColor:"text-red-600",bgColor:"bg-[#FBEEEE]"};case"non_ecommerce":return{title:(0,pe.__)("Reset Non-Ecommerce Settings","nggallery"),description:(0,pe.__)("Reset all NextGEN Gallery settings except ecommerce configurations. This preserves your pricelist settings, payment configurations, and ecommerce-related options while resetting all other gallery settings.","nggallery"),warning:(0,pe.__)("Resets all settings except ecommerce to default values.","nggallery"),buttonText:(0,pe.__)("Reset Non-Ecommerce Settings","nggallery"),confirmText:(0,pe.__)("Reset all non ecommerce options to default settings?\n\nThis will preserve your ecommerce configurations.\n\nChoose [Cancel] to Stop, [Reset Settings] to proceed.","nggallery"),settingsType:"non_ecommerce",iconColor:"text-orange-600",bgColor:"bg-[#EFF7EE]"};case"ecommerce":return{title:(0,pe.__)("Reset Only Ecommerce Settings","nggallery"),description:(0,pe.__)("Reset only ecommerce-related settings to their default values. This includes pricelist settings, payment configurations, and other ecommerce options while preserving all other gallery settings.","nggallery"),warning:(0,pe.__)("Resets only ecommerce settings to default values.","nggallery"),buttonText:(0,pe.__)("Reset Ecommerce Settings","nggallery"),confirmText:(0,pe.__)("Reset all ecommerce options to default settings?\n\nThis will preserve all other gallery settings.\n\nChoose [Cancel] to Stop, [Reset Settings] to proceed.","nggallery"),settingsType:"ecommerce",iconColor:"text-blue-600",bgColor:"bg-[#EEF1FD]"}}},y=function(){var e=No(u_().m(function e(){var t,r,o,l;return u_().w(function(e){for(;;)switch(e.p=e.n){case 0:return n(!1),t=f(a),e.p=1,e.n=2,d.mutateAsync({confirm:!0,settings_type:t.settingsType});case 2:(r=e.v).success?(u(r.message||(0,pe.__)("Settings reset successfully!","nggallery")),setTimeout(function(){window.location.reload()},2e3)):m((0,pe.__)("Failed to reset settings. Please try again.","nggallery")),e.n=4;break;case 3:e.p=3,l=e.v,console.error("Failed to reset settings:",l),o=(0,pe.__)("Failed to reset settings. Please try again.","nggallery"),null!=l&&l.message&&(o=l.message),m(o);case 4:return e.a(2)}},e,null,[[1,3]])}));return function(){return e.apply(this,arguments)}}(),h=function(){var e=No(u_().m(function e(){var t;return u_().w(function(e){for(;;)switch(e.p=e.n){case 0:return c(!1),e.p=1,e.n=2,g.mutateAsync();case 2:u((0,pe.__)("Cache cleared successfully!","nggallery")),e.n=4;break;case 3:e.p=3,t=e.v,console.error("Failed to clear cache:",t),m((0,pe.__)("Error clearing cache. Please try again.","nggallery"));case 4:return e.a(2)}},e,null,[[1,3]])}));return function(){return e.apply(this,arguments)}}(),b=f(a),v=function(e){var t=f(e);return ee().createElement("div",{key:e,className:"bg-white rounded-lg shadow-sm p-6"},ee().createElement("div",{className:"flex items-start space-x-4"},ee().createElement("div",{className:"flex-shrink-0"},ee().createElement("div",{className:"w-10 h-10 ".concat(t.bgColor," rounded-lg flex items-center justify-center")},ee().createElement("svg",{className:"w-5 h-5 ".concat(t.iconColor),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},ee().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})))),ee().createElement("div",{className:"flex-1"},ee().createElement("h3",{className:"text-lg font-medium text-gray-900 mb-2"},t.title),ee().createElement("p",{className:"text-gray-600 mb-4"},t.description),ee().createElement("div",{className:"bg-[#EEF0F2] rounded-md p-2 mb-4"},ee().createElement("p",{className:"text-sm text-gray-500"},ee().createElement("strong",null,(0,pe.__)("Warning:","nggallery"))," ",t.warning)),ee().createElement("button",{onClick:function(){return function(e){o(e),n(!0)}(e)},disabled:d.isPending,className:"bg-white text-black border border-black hover:bg-black hover:text-white focus:ring-black px-4 py-2 rounded-md font-medium text-sm transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed"},d.isPending?(0,pe.__)("Resetting...","nggallery"):t.buttonText))))};return ee().createElement("div",{className:"space-y-6"},i&&ee().createElement("div",{className:"fixed inset-0 z-50 overflow-y-auto"},ee().createElement("div",{className:"fixed inset-0 bg-black bg-opacity-50 transition-opacity duration-300 ease-in-out"}),ee().createElement("div",{className:"flex min-h-screen items-center justify-center p-4 text-center sm:p-0"},ee().createElement("div",{className:"relative transform overflow-hidden rounded-lg bg-white text-left shadow-xl transition-all duration-300 ease-in-out sm:my-8 sm:w-full sm:max-w-lg"},ee().createElement("div",{className:"bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4"},ee().createElement("div",{className:"sm:flex sm:items-start"},ee().createElement("div",{className:"mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-yellow-100 sm:mx-0 sm:h-10 sm:w-10"},ee().createElement("svg",{className:"h-6 w-6 text-yellow-600",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},ee().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"}))),ee().createElement("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left"},ee().createElement("h3",{className:"text-lg leading-6 font-medium text-gray-900"},(0,pe.__)("Clear Image Cache","nggallery")),ee().createElement("div",{className:"mt-2"},ee().createElement("p",{className:"text-sm text-gray-500"},(0,pe.__)("Completely clear the NextGEN cache of all image modifications? This action will remove all cached and resized images. They will be regenerated when needed.","nggallery")))))),ee().createElement("div",{className:"bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse"},ee().createElement("button",{type:"button",onClick:h,className:"w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-yellow-600 text-base font-medium text-white hover:bg-yellow-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-yellow-500 sm:ml-3 sm:w-auto sm:text-sm"},(0,pe.__)("Clear Cache","nggallery")),ee().createElement("button",{type:"button",onClick:function(){c(!1)},className:"mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm"},(0,pe.__)("Cancel","nggallery")))))),t&&ee().createElement("div",{className:"fixed inset-0 z-50 overflow-y-auto"},ee().createElement("div",{className:"fixed inset-0 bg-black bg-opacity-50 transition-opacity duration-300 ease-in-out"}),ee().createElement("div",{className:"flex min-h-screen items-center justify-center p-4 text-center sm:p-0"},ee().createElement("div",{className:"relative transform overflow-hidden rounded-lg bg-white text-left shadow-xl transition-all duration-300 ease-in-out sm:my-8 sm:w-full sm:max-w-lg"},ee().createElement("div",{className:"bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4"},ee().createElement("div",{className:"sm:flex sm:items-start"},ee().createElement("div",{className:"mx-auto flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-full ".concat(b.bgColor," sm:mx-0 sm:h-10 sm:w-10")},ee().createElement("svg",{className:"h-6 w-6 ".concat(b.iconColor),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},ee().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"}))),ee().createElement("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left"},ee().createElement("h3",{className:"text-lg font-medium leading-6 text-gray-900"},b.title),ee().createElement("div",{className:"mt-2"},ee().createElement("p",{className:"text-sm text-gray-500 whitespace-pre-line"},b.confirmText))))),ee().createElement("div",{className:"bg-gray-50 px-4 py-3 sm:flex sm:flex-row-reverse sm:px-6"},ee().createElement("button",{type:"button",onClick:y,disabled:d.isPending,className:"inline-flex w-full justify-center rounded-md border border-transparent ".concat("all"===a?"bg-red-600 hover:bg-red-700 focus:ring-red-500":"non_ecommerce"===a?"bg-orange-600 hover:bg-orange-700 focus:ring-orange-500":"bg-blue-600 hover:bg-blue-700 focus:ring-blue-500"," px-4 py-2 text-base font-medium text-white shadow-sm focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 sm:ml-3 sm:w-auto sm:text-sm")},d.isPending?(0,pe.__)("Resetting...","nggallery"):(0,pe.__)("Reset Settings","nggallery")),ee().createElement("button",{type:"button",onClick:function(){n(!1),o("all")},disabled:d.isPending,className:"mt-3 inline-flex w-full justify-center rounded-md border border-gray-300 bg-white px-4 py-2 text-base font-medium text-gray-700 shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 disabled:opacity-50 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm"},(0,pe.__)("Cancel","nggallery")))))),ee().createElement("div",{className:"bg-white rounded-lg shadow-sm p-4"},ee().createElement("div",{className:"flex"},ee().createElement("div",{className:"flex-shrink-0"},ee().createElement(Zn,{className:"h-5 w-5 text-red-400"})),ee().createElement("div",{className:"ml-3"},ee().createElement("h3",{className:"text-sm font-medium text-[#DB1F21]"},(0,pe.__)("Warning: Irreversible Action","nggallery")),ee().createElement("div",{className:"mt-2 text-sm text-gray-600"},ee().createElement("p",null,(0,pe.__)("Resetting settings will permanently restore default values and cannot be undone. Please ensure you have a backup of your current settings if needed.","nggallery")))))),ee().createElement("div",{className:"bg-white rounded-lg shadow-sm p-6"},ee().createElement("div",{className:"flex items-start space-x-4"},ee().createElement("div",{className:"flex-shrink-0"},ee().createElement("div",{className:"w-10 h-10 bg-[#FEF7E7] rounded-lg flex items-center justify-center"},ee().createElement(Jn,{className:"h-5 w-5 text-gray-400"}))),ee().createElement("div",{className:"flex-1"},ee().createElement("h3",{className:"text-lg font-medium text-gray-900 mb-2"},(0,pe.__)("Clear image cache","nggallery")),ee().createElement("p",{className:"text-gray-600 mb-4"},(0,pe.__)("This will remove all cached and resized images. They will be regenerated when needed.","nggallery")),ee().createElement("button",{onClick:function(){c(!0)},disabled:g.isPending,className:"bg-white text-black border border-black hover:bg-black hover:text-white focus:ring-black px-4 py-2 rounded-md font-medium text-sm transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed"},g.isPending?(0,pe.__)("Clearing Cache...","nggallery"):(0,pe.__)("Clear Image Cache","nggallery"))))),v("all"),p&&ee().createElement(ee().Fragment,null,v("non_ecommerce"),v("ecommerce")))};function g_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function p_(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?g_(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):g_(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function f_(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return y_(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(y_(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,y_(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,y_(m,"constructor",s),y_(s,"constructor",c),c.displayName="GeneratorFunction",y_(s,a,"GeneratorFunction"),y_(m),y_(m,a,"Generator"),y_(m,r,function(){return this}),y_(m,"toString",function(){return"[object Generator]"}),(f_=function(){return{w:o,m:d}})()}function y_(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}y_=function(e,t,n,r){function o(t,n){y_(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},y_(e,t,n,r)}const h_=function(){var e,t=sl({queryKey:di.rolesCapabilities,queryFn:(e=No(ui().m(function e(){var t,n;return ui().w(function(e){for(;;)switch(e.n){case 0:return n=null===(t=window.imagelyApp)||void 0===t?void 0:t.nonce,e.n=1,Oo()({path:"/imagely/v1/roles-capabilities",method:"GET",headers:{"X-WP-Nonce":n}});case 1:return e.a(2,e.v)}},e)})),function(){return e.apply(this,arguments)}),staleTime:3e5,gcTime:6e5}),r=t.data,a=t.isLoading,o=function(){var e,t=re();return gl({mutationFn:(e=No(ui().m(function e(t){var n,r;return ui().w(function(e){for(;;)switch(e.n){case 0:return r=null===(n=window.imagelyApp)||void 0===n?void 0:n.nonce,e.n=1,Oo()({path:"/imagely/v1/roles-capabilities",method:"POST",headers:{"X-WP-Nonce":r,"Content-Type":"application/json"},data:t});case 1:return e.n=2,Oo()({path:"/imagely/v1/roles-capabilities",method:"GET",headers:{"X-WP-Nonce":r}});case 2:return e.a(2,e.v)}},e)})),function(t){return e.apply(this,arguments)}),onSuccess:function(e){t.setQueryData(di.rolesCapabilities,e)},onSettled:function(){t.invalidateQueries({queryKey:di.rolesCapabilities})}})}(),l=$o(),i=l.showSuccess,c=l.showError,s=vo((0,$.useState)(null),2),u=s[0],m=s[1],d=(0,$.useRef)(null);(0,$.useEffect)(function(){if(r&&!u){var e,t,n,a,o,l,i,c,s,d,g={general:(null===(e=r.capabilities.general)||void 0===e?void 0:e.current_role)||"administrator",tinymce:(null===(t=r.capabilities.tinymce)||void 0===t?void 0:t.current_role)||"administrator",add_gallery:(null===(n=r.capabilities.add_gallery)||void 0===n?void 0:n.current_role)||"administrator",manage_gallery:(null===(a=r.capabilities.manage_gallery)||void 0===a?void 0:a.current_role)||"administrator",manage_others:(null===(o=r.capabilities.manage_others)||void 0===o?void 0:o.current_role)||"administrator",manage_tags:(null===(l=r.capabilities.manage_tags)||void 0===l?void 0:l.current_role)||"administrator",edit_album:(null===(i=r.capabilities.edit_album)||void 0===i?void 0:i.current_role)||"administrator",change_style:(null===(c=r.capabilities.change_style)||void 0===c?void 0:c.current_role)||"administrator",change_options:(null===(s=r.capabilities.change_options)||void 0===s?void 0:s.current_role)||"administrator",attach_interface:(null===(d=r.capabilities.attach_interface)||void 0===d?void 0:d.current_role)||"administrator"};m(g)}},[r,u]),(0,$.useEffect)(function(){return function(){d.current&&clearTimeout(d.current)}},[]);var g=(0,$.useCallback)(function(){var e=No(f_().m(function e(t){var n;return f_().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,o.mutateAsync(t);case 1:i((0,pe.__)("Roles and capabilities updated successfully!","nggallery")),e.n=3;break;case 2:e.p=2,n=e.v,c((0,pe.__)("Failed to update roles and capabilities. Please try again.","nggallery")),console.error("Error updating roles and capabilities:",n);case 3:return e.a(2)}},e,null,[[0,2]])}));return function(t){return e.apply(this,arguments)}}(),[o,i,c]),p=(0,$.useCallback)(function(e,t){if(u){var r=p_(p_({},u),{},n({},e,t));m(r),d.current&&clearTimeout(d.current),d.current=setTimeout(function(){g(r)},500)}},[u,g]);return a||!u?ee().createElement(oo,{size:"md",text:(0,pe.__)("Loading roles and capabilities...","nggallery")}):r?ee().createElement("div",{className:"space-y-4"},ee().createElement(nf,{title:(0,pe.__)("Capability Settings","nggallery"),defaultExpanded:!0},ee().createElement("div",{className:"space-y-6"},ee().createElement("div",{className:"bg-info-bg border border-info-border rounded-md p-4"},ee().createElement("div",{className:"flex items-start"},ee().createElement("div",{className:"flex-shrink-0"},ee().createElement(cr,{className:"h-5 w-5 text-gray-400"})),ee().createElement("div",{className:"ml-3"},ee().createElement("h3",{className:"text-sm font-medium text-gray-800"},(0,pe.__)("How Roles & Capabilities Work","nggallery")),ee().createElement("div",{className:"mt-2 text-sm text-gray-700"},ee().createElement("p",null,(0,pe.__)("Select the lowest role which should be able to access the following capabilities. NextGEN Gallery supports the standard roles from WordPress.","nggallery")),ee().createElement("p",{className:"mt-2"},(0,pe.__)("When you assign a capability to a role, all higher-level roles will automatically receive that capability as well.","nggallery")))))),r&&Object.entries(r.capabilities).map(function(e){var t=vo(e,2),n=t[0],a=t[1];return ee().createElement("div",{key:n,className:"grid grid-cols-1 md:grid-cols-2 gap-4 items-center"},ee().createElement("div",null,ee().createElement("label",{className:"block text-sm font-medium text-gray-700 mb-1"},a.name),ee().createElement("p",{className:"text-xs italic text-gray-500"},(0,pe.__)("Capability:","nggallery")," ",a.capability)),ee().createElement("div",null,ee().createElement(sc,{id:n,name:n,value:u[n]||"administrator",onChange:function(e){return p(n,e.target.value)},label:""},r&&Object.entries(r.roles).map(function(e){var t=vo(e,2),n=t[0],r=t[1];return ee().createElement("option",{key:n,value:n},r)}))))})))):ee().createElement("div",{className:"space-y-4"},ee().createElement("div",{className:"bg-red-50 border border-red-200 rounded-lg p-8 text-center"},ee().createElement("p",{className:"text-red-600"},(0,pe.__)("Failed to load roles and capabilities data.","nggallery"))))},b_=function(e){var t=e.value,n=e.onChange,r=e.label,a=function(e){return{topLeft:(0,pe.__)("Top Left","nggallery"),topCenter:(0,pe.__)("Top Center","nggallery"),topRight:(0,pe.__)("Top Right","nggallery"),midLeft:(0,pe.__)("Middle Left","nggallery"),midCenter:(0,pe.__)("Middle Center","nggallery"),midRight:(0,pe.__)("Middle Right","nggallery"),botLeft:(0,pe.__)("Bottom Left","nggallery"),botCenter:(0,pe.__)("Bottom Center","nggallery"),botRight:(0,pe.__)("Bottom Right","nggallery")}[e]||e};return ee().createElement("div",{className:"w-full"},ee().createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},r),ee().createElement("div",{className:"flex justify-center"},ee().createElement("div",{className:"inline-grid grid-cols-3 gap-0 border border-gray-300 rounded-lg overflow-hidden bg-white"},[["topLeft","topCenter","topRight"],["midLeft","midCenter","midRight"],["botLeft","botCenter","botRight"]].map(function(e,r){return e.map(function(e,o){return ee().createElement("label",{key:e,className:"\n\t\t\t\t\t\t\t\t\trelative flex items-center justify-center w-14 h-14 cursor-pointer transition-all\n\t\t\t\t\t\t\t\t\t".concat(o<2?"border-r border-gray-300":"","\n\t\t\t\t\t\t\t\t\t").concat(r<2?"border-b border-gray-300":"","\n\t\t\t\t\t\t\t\t\t").concat(t===e?"bg-gray-50":"bg-white hover:bg-gray-50","\n\t\t\t\t\t\t\t\t"),title:a(e)},ee().createElement("input",{type:"radio",name:"wmPos",value:e,checked:t===e,onChange:function(e){return n(e.target.value)},className:"sr-only"}),ee().createElement("div",{className:"\n\t\t\t\t\t\t\t\t\tw-4 h-4 rounded-full transition-all\n\t\t\t\t\t\t\t\t\t".concat(t===e?"bg-green-500":"bg-gray-400","\n\t\t\t\t\t\t\t\t")}))})}))))};function v_(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return __(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(__(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,__(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,__(m,"constructor",s),__(s,"constructor",c),c.displayName="GeneratorFunction",__(s,a,"GeneratorFunction"),__(m),__(m,a,"Generator"),__(m,r,function(){return this}),__(m,"toString",function(){return"[object Generator]"}),(v_=function(){return{w:o,m:d}})()}function __(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}__=function(e,t,n,r){function o(t,n){__(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},__(e,t,n,r)}function w_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function x_(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?w_(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):w_(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}const E_=function(e){e.settings,e.onSettingsChange;var t,r,a,o,l,i,c=gi(),s=c.data,u=c.isLoading,m=pi(),d=gl({mutationFn:(i=No(ui().m(function e(t){var n,r;return ui().w(function(e){for(;;)switch(e.n){case 0:return r=null===(n=window.imagelyApp)||void 0===n?void 0:n.nonce,e.n=1,Oo()({path:"/imagely/v1/settings/watermark-preview",method:"POST",headers:{"X-WP-Nonce":r,"Content-Type":"application/json"},data:{watermark_options:t}});case 1:return e.a(2,e.v)}},e)})),function(e){return i.apply(this,arguments)})}),g=vo((0,$.useState)(""),2),p=g[0],f=g[1],y=vo((0,$.useState)(""),2),h=y[0],b=y[1],v=vo((0,$.useState)(null),2),_=v[0],w=v[1],x=(0,$.useRef)(null),E=$o(),C=E.showSuccess,N=E.showError,k=E.showError,S=Cy(_,1e3);(0,$.useEffect)(function(){if(s&&!_){var e=s.wmColor?s.wmColor.replace("#",""):"ffffff";e.length>6&&(e=e.substring(0,6));var t={watermark_automatically_at_upload:ni(s.watermark_automatically_at_upload),wmPos:s.wmPos||"midCenter",wmXpos:s.wmXpos||15,wmYpos:s.wmYpos||5,wmType:s.wmType||"text",wmPath:s.wmPath||"",wmFont:s.wmFont||"arial.ttf",wmSize:s.wmSize||30,wmText:s.wmText||"",wmColor:"#".concat(e),wmOpaque:s.wmOpaque||33};w(t),("text"===t.wmType&&t.wmText||"image"===t.wmType&&t.wmPath)&&O(t)}},[s,_]),(0,$.useEffect)(function(){return function(){x.current&&clearTimeout(x.current)}},[]),(0,$.useEffect)(function(){if(null!=S&&S.wmType){var e="text"===S.wmType&&S.wmText&&S.wmText.trim().length>0,t="image"===S.wmType&&S.wmPath&&S.wmPath.trim().length>0;e||t?O(S):(f(""),"text"===S.wmType?b((0,pe.__)("Enter watermark text to see preview","nggallery")):"image"===S.wmType?b((0,pe.__)("Enter watermark image path to see preview","nggallery")):b(""))}},[S]);var O=function(){var e=No(v_().m(function e(t){var n,r,a,o,l,i,c,s,u,m,g,p,y;return v_().w(function(e){for(;;)switch(e.p=e.n){case 0:return b(""),e.p=1,(r=(null===(n=t.wmColor)||void 0===n?void 0:n.replace("#",""))||"ffffff").length>6&&(r=r.substring(0,6)),a=x_(x_({},t),{},{wmColor:r}),e.n=2,d.mutateAsync(a);case 2:(o=e.v).success&&o.thumbnail_url?(f(o.thumbnail_url),b("")):(f(""),b((0,pe.__)("Failed to generate preview","nggallery"))),e.n=9;break;case 3:if(e.p=3,p=e.v,console.error("Failed to load watermark preview:",p),f(""),!(p instanceof Response)){e.n=8;break}return e.p=4,e.n=5,p.json();case 5:"no_images_found"===(null==(l=e.v)?void 0:l.code)?(i=(0,pe.__)("No images found in NextGen Gallery. Please add images to a gallery first.","nggallery"),b(i)):"no_usable_images"===(null==l?void 0:l.code)?(c=(0,pe.__)("No usable images found for preview generation.","nggallery"),b(c)):"missing_watermark_options"===(null==l?void 0:l.code)?(s=(0,pe.__)("Watermark options are required.","nggallery"),b(s),k(s)):(u=(0,pe.__)("Failed to load watermark preview: ","nggallery")+((null==l?void 0:l.message)||(0,pe.__)("Unknown error","nggallery")),b(u),k(u)),e.n=7;break;case 6:e.p=6,y=e.v,console.error("Error parsing error response JSON:",y),m=(0,pe.__)("Failed to load watermark preview: Unknown error","nggallery"),b(m),k(m);case 7:e.n=9;break;case 8:g=(0,pe.__)("Failed to load watermark preview: ","nggallery")+((null==p?void 0:p.message)||(0,pe.__)("Unknown error","nggallery")),b(g),k(g);case 9:return e.a(2)}},e,null,[[4,6],[1,3]])}));return function(t){return e.apply(this,arguments)}}(),P=(0,$.useCallback)(function(){var e=No(v_().m(function e(t){var n,r,a,o;return v_().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,(r=(null===(n=t.wmColor)||void 0===n?void 0:n.replace("#",""))||"ffffff").length>6&&(r=r.substring(0,6)),a=x_(x_({},t),{},{wmColor:r}),e.n=1,m.mutateAsync(a);case 1:C((0,pe.__)("Watermark settings updated successfully!","nggallery")),e.n=3;break;case 2:e.p=2,o=e.v,N((0,pe.__)("Failed to update watermark settings. Please try again.","nggallery")),console.error("Error updating watermark settings:",o);case 3:return e.a(2)}},e,null,[[0,2]])}));return function(t){return e.apply(this,arguments)}}(),[m,C,N]),j=(0,$.useCallback)(function(e,t){if(_){var r=x_(x_({},_),{},n({},e,t));w(r),x.current&&clearTimeout(x.current),x.current=setTimeout(function(){P(r)},1e3)}},[_,P]);if(u||!_)return ee().createElement(oo,{size:"md",text:(0,pe.__)("Loading watermark settings...","nggallery")});var T=[{value:"arial.ttf",label:(0,pe.__)("Arial","nggallery")},{value:"times.ttf",label:(0,pe.__)("Times New Roman","nggallery")},{value:"courier.ttf",label:(0,pe.__)("Courier New","nggallery")},{value:"verdana.ttf",label:(0,pe.__)("Verdana","nggallery")},{value:"georgia.ttf",label:(0,pe.__)("Georgia","nggallery")},{value:"YanoneKaffeesatz-Bold.ttf",label:(0,pe.__)("Yanone Kaffeesatz Bold","nggallery")}];return ee().createElement("div",{className:"space-y-4"},ee().createElement(nf,{title:(0,pe.__)("Watermark Settings","nggallery"),defaultExpanded:!0},ee().createElement("div",{className:"space-y-6"},ee().createElement("div",{className:"bg-info-bg border border-info-border rounded-md p-4"},ee().createElement("div",{className:"flex items-start"},ee().createElement("div",{className:"flex-shrink-0"},ee().createElement(cr,{className:"h-5 w-5 text-gray-400"})),ee().createElement("div",{className:"ml-3"},ee().createElement("h3",{className:"text-sm font-medium text-gray-800"},(0,pe.__)("About Watermarks","nggallery")),ee().createElement("div",{className:"mt-2 text-sm text-gray-700"},ee().createElement("p",null,(0,pe.__)("Configure watermark options that will be applied to your images. You can choose between text or image watermarks.","nggallery")))))),ee().createElement("div",null,ee().createElement(fs,{id:"watermark_automatically_at_upload",name:"watermark_automatically_at_upload",checked:_.watermark_automatically_at_upload||!1,onChange:function(e){j("watermark_automatically_at_upload",e.target.checked)},label:(0,pe.__)("Apply watermark automatically during upload","nggallery"),help:(0,pe.__)("When enabled, watermarks will be applied to images automatically when they are uploaded.","nggallery")})),ee().createElement("div",{className:"w-full max-w-sm"},ee().createElement(sc,{id:"wmType",name:"wmType",value:_.wmType||"text",onChange:function(e){return j("wmType",e.target.value)},label:(0,pe.__)("Watermark Type","nggallery")},ee().createElement("option",{value:"text"},(0,pe.__)("Text watermark","nggallery")),ee().createElement("option",{value:"image"},(0,pe.__)("Image watermark","nggallery")))),"text"===_.wmType&&ee().createElement("div",{className:"bg-gray-100 p-4 rounded-md"},ee().createElement("h4",{className:"text-md font-medium text-gray-900 mb-4"},(0,pe.__)("Text Settings","nggallery")),ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4"},ee().createElement("div",null,ee().createElement(cc,null,(0,pe.__)("Watermark Text","nggallery")),ee().createElement("input",{type:"text",value:_.wmText,onChange:function(e){return j("wmText",e.target.value)},className:"bg-white border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-green-500 focus:border-green-500 block w-full p-2.5 hover:border-gray-400 transition-colors",placeholder:(0,pe.__)("Enter watermark text","nggallery")})),ee().createElement("div",null,ee().createElement(sc,{id:"wmFont",name:"wmFont",value:_.wmFont||"arial.ttf",onChange:function(e){return j("wmFont",e.target.value)},label:(0,pe.__)("Font","nggallery")},T.map(function(e){return ee().createElement("option",{key:e.value,value:e.value},e.label)}))),ee().createElement("div",null,ee().createElement(uc,{type:"number",id:"wmSize",name:"wmSize",value:(null===(t=_.wmSize)||void 0===t?void 0:t.toString())||"30",onChange:function(e){return j("wmSize",parseInt(e.target.value)||30)},label:(0,pe.__)("Font Size","nggallery"),min:8,max:72})),ee().createElement("div",null,ee().createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},(0,pe.__)("Color (hex)","nggallery")),ee().createElement("div",{className:"flex items-center space-x-2"},ee().createElement("span",{className:"text-gray-500"},"#"),ee().createElement(Of,{color:_.wmColor||"#ffffff",onChange:function(e){j("wmColor",e)},enableAlpha:!1}))),ee().createElement("div",null,ee().createElement(uc,{type:"number",id:"wmOpaque",name:"wmOpaque",value:(null===(r=_.wmOpaque)||void 0===r?void 0:r.toString())||"33",onChange:function(e){var t=parseInt(e.target.value)||0,n=Math.min(100,Math.max(0,t));j("wmOpaque",n)},label:(0,pe.__)("Opacity (%)","nggallery"),min:0,max:100})))),"image"===_.wmType&&ee().createElement("div",{className:"bg-gray-100 p-4 rounded-md"},ee().createElement("h4",{className:"text-md font-medium text-gray-900 mb-4"},(0,pe.__)("Image Settings","nggallery")),ee().createElement("div",null,ee().createElement(cc,{help:(0,pe.__)("Absolute path to the watermark image","nggallery")},(0,pe.__)("Watermark Image Path","nggallery")),ee().createElement("input",{type:"text",value:_.wmPath,onChange:function(e){return j("wmPath",e.target.value)},className:"bg-white border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-green-500 focus:border-green-500 block w-full p-2.5 hover:border-gray-400 transition-colors",placeholder:(0,pe.__)("Enter path to watermark image","nggallery")}),ee().createElement("div",{className:"mt-3"},ee().createElement("p",{className:"text-sm font-medium text-gray-700 mb-2"},(0,pe.__)("Example path (click to use):","nggallery")),ee().createElement("div",{className:"space-y-1"},ee().createElement("button",{type:"button",onClick:function(){var e;return j("wmPath",(null===(e=window.imagelyApp)||void 0===e?void 0:e.pluginPath)+"assets/images/logo-icon.png")},className:"block text-sm text-blue-600 hover:text-blue-800 underline"},(null===(a=window.imagelyApp)||void 0===a?void 0:a.pluginPath)+"assets/images/logo-icon.png"))))),ee().createElement("div",null,ee().createElement("h3",{className:"text-lg font-medium text-gray-900 mb-4"},(0,pe.__)("Position","nggallery")),ee().createElement("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4"},ee().createElement("div",null,ee().createElement(b_,{value:_.wmPos||"midCenter",onChange:function(e){return j("wmPos",e)},label:(0,pe.__)("Position","nggallery")})),ee().createElement("div",null,ee().createElement(uc,{type:"number",id:"wmXpos",name:"wmXpos",value:(null===(o=_.wmXpos)||void 0===o?void 0:o.toString())||"15",onChange:function(e){return j("wmXpos",parseInt(e.target.value)||15)},label:(0,pe.__)("X Offset (pixels)","nggallery"),min:0})),ee().createElement("div",null,ee().createElement(uc,{type:"number",id:"wmYpos",name:"wmYpos",value:(null===(l=_.wmYpos)||void 0===l?void 0:l.toString())||"5",onChange:function(e){return j("wmYpos",parseInt(e.target.value)||5)},label:(0,pe.__)("Y Offset (pixels)","nggallery"),min:0})))))),ee().createElement(nf,{title:(0,pe.__)("Preview","nggallery"),defaultExpanded:!0},ee().createElement("div",{className:"space-y-4"},ee().createElement("div",{className:"flex justify-end"},ee().createElement("button",{onClick:function(){_&&O(_)},disabled:d.isPending,className:"px-3 py-1 text-sm text-green-600 border border-green-500 hover:bg-green-500 hover:text-white rounded-md disabled:opacity-50"},d.isPending?(0,pe.__)("Loading...","nggallery"):(0,pe.__)("Refresh Preview","nggallery"))),ee().createElement("div",{className:"bg-white border-2 border-gray-300 rounded-md p-4 relative min-h-48 overflow-hidden"},d.isPending&&ee().createElement("div",{className:"absolute inset-0 flex items-center justify-center bg-white bg-opacity-75 z-10"},ee().createElement("div",{className:"flex items-center space-x-2"},ee().createElement("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600"}),ee().createElement("span",{className:"text-sm text-gray-600"},(0,pe.__)("Generating preview...","nggallery")))),h&&!d.isPending&&ee().createElement("div",{className:"absolute inset-0 flex items-center justify-center"},ee().createElement("div",{className:"text-center text-gray-500"},h.includes("No images found")||h.includes("No usable images")?ee().createElement(ee().Fragment,null,ee().createElement("div",{className:"flex flex-col items-center"},ee().createElement("img",{src:Ns({width:100,height:60,text:"No Images",backgroundColor:"#f1f3f4",textColor:"#5f6368",fontSize:11}),alt:(0,pe.__)("No images placeholder","nggallery"),className:"mb-2 rounded border border-gray-200 opacity-75"}),ee().createElement("p",{className:"text-sm font-medium text-blue-600 mb-1"},(0,pe.__)("No images available for preview","nggallery")),ee().createElement("p",{className:"text-xs text-gray-500"},(0,pe.__)("Add your first image to a gallery to see the watermark preview","nggallery")))):ee().createElement(ee().Fragment,null,ee().createElement("svg",{className:"mx-auto h-8 w-8 mb-2 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},ee().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"})),ee().createElement("p",{className:"text-sm"},h)))),p&&!d.isPending&&!h&&ee().createElement("div",{className:"flex flex-col items-center"},ee().createElement("img",{src:p,alt:(0,pe.__)("Watermark preview","nggallery"),className:"max-w-full h-auto rounded-md shadow-sm",onError:function(){b((0,pe.__)("Failed to load preview image","nggallery")),f("")}})),!p&&!d.isPending&&!h&&ee().createElement("div",{className:"absolute inset-0 flex items-center justify-center"},ee().createElement("div",{className:"text-center text-gray-400"},ee().createElement("div",{className:"flex flex-col items-center"},ee().createElement("img",{src:Ns({width:100,height:60,text:"Configure Settings",backgroundColor:"#f1f3f4",textColor:"#5f6368",fontSize:11}),alt:(0,pe.__)("Configure settings placeholder","nggallery"),className:"mb-2 rounded border border-gray-200 opacity-75"}),ee().createElement("p",{className:"text-sm"},(0,pe.__)("Configure watermark settings to see preview","nggallery")))))))))},C_=function(e){var t,n,r=e.tabId,a={settings:e.settings,onSettingsChange:e.onSettingsChange},o=null===(t=window.imagelyApp)||void 0===t?void 0:t.canAccessRolesSettings,l=null===(n=window.imagelyApp)||void 0===n?void 0:n.canAccessLicenseSettings;switch(r){case"license":default:return l?ee().createElement(o_,null):ee().createElement(xv,a);case"image":return ee().createElement(xv,a);case"watermarking":return ee().createElement(E_,a);case"imageanimations":return ee().createElement(bv,a);case"imageprotection":return ee().createElement(vv,a);case"integrations":return ee().createElement(n_,null);case"lightbox":return ee().createElement(c_,a);case"miscellaneous":return ee().createElement(s_,a);case"roles":return o?ee().createElement(h_,null):ee().createElement(xv,a);case"reset":return ee().createElement(d_,null);case"advanced":return ee().createElement(gv,null);case"convertgalleries":return ee().createElement(yv,null);case"hidden":return ee().createElement(hv,a)}};var N_=function(){var e,t,n=[{id:"license",label:(0,pe.__)("License","nggallery"),icon:ee().createElement(On,{className:"h-5 w-5"})},{id:"image",label:(0,pe.__)("Image Options","nggallery"),icon:ee().createElement(Pn,{className:"h-5 w-5"})},{id:"lightbox",label:(0,pe.__)("Lightbox Effects","nggallery"),icon:ee().createElement(jn,{className:"h-5 w-5"})},{id:"imageanimations",label:(0,pe.__)("Image Animations","nggallery"),icon:ee().createElement(Tn,{className:"h-5 w-5"})},{id:"watermarking",label:(0,pe.__)("Watermarking","nggallery"),icon:ee().createElement(In,{className:"h-5 w-5"})},{id:"roles",label:(0,pe.__)("Roles & Capabilities","nggallery"),icon:ee().createElement(An,{className:"h-5 w-5"})},{id:"miscellaneous",label:(0,pe.__)("Miscellaneous","nggallery"),icon:ee().createElement(Ln,{className:"h-5 w-5"})},{id:"reset",label:(0,pe.__)("Reset Options","nggallery"),icon:ee().createElement(Fn,{className:"h-5 w-5"})},{id:"imageprotection",label:(0,pe.__)("Image Protection","nggallery"),icon:ee().createElement(Mn,{className:"h-5 w-5"})},{id:"layoutsettings",label:(0,pe.__)("Layout Settings","nggallery"),icon:ee().createElement(Dn,{className:"h-5 w-5"})},{id:"integrations",label:(0,pe.__)("Integrations","nggallery"),icon:ee().createElement(Gr,{className:"h-5 w-5"})},{id:"advanced",label:(0,pe.__)("Advanced","nggallery"),icon:ee().createElement(Ln,{className:"h-5 w-5"})},{id:"convertgalleries",label:(0,pe.__)("Convert Galleries","nggallery"),icon:ee().createElement(Sr,{className:"h-5 w-5"})},{id:"setupwizard",label:(0,pe.__)("Setup Wizard","nggallery"),icon:ee().createElement(Rn,{className:"h-5 w-5"})},{id:"hidden",label:(0,pe.__)("Hidden Settings","nggallery"),icon:ee().createElement(Ln,{className:"h-5 w-5"})}];return n=n.filter(function(e){return"hidden"!==e.id}),(null===(e=window.imagelyApp)||void 0===e?void 0:e.canAccessRolesSettings)||(n=n.filter(function(e){return"roles"!==e.id})),(null===(t=window.imagelyApp)||void 0===t?void 0:t.canAccessLicenseSettings)||(n=n.filter(function(e){return"license"!==e.id})),n};const k_=function(e){var t=e.activeTab,n=e.onTabChange,r=N_(),a=Cs().navigateTo;return ee().createElement("div",{className:"bg-white rounded-lg shadow-sm p-4"},ee().createElement("nav",{className:"space-y-2"},r.map(function(e){return ee().createElement("button",{key:e.id,onClick:function(){return function(e){if("imagelycdn"===e.id){var t=window.imagelyApp,r=null==t?void 0:t.enviraCdnConfig;if(r&&r.enabled&&r.license_valid){var o=(null==t?void 0:t.adminUrl)||"/wp-admin/";return void(window.location.href="".concat(o,"admin.php?page=eg-cdn-config"))}}if("setupwizard"!==e.id)"layoutsettings"!==e.id?n(e.id):a("imagely-layout-settings","photocrati-nextgen_basic_thumbnails");else{var l=window.imagelyApp,i=(null==l?void 0:l.adminUrl)||"/wp-admin/";window.location.href="".concat(i,"index.php?page=nextgen-gallery-setup-wizard")}}(e)},className:"w-full flex items-center space-x-3 p-3 text-left rounded-lg transition-colors ".concat(t===e.id?"bg-green-50 text-green-700 font-medium border border-green-200":"text-gray-600 hover:bg-gray-50 hover:text-gray-900")},ee().createElement("div",{className:"flex-shrink-0 ".concat(t===e.id?"text-green-600":"text-gray-400")},e.icon),ee().createElement("span",{className:"text-sm"},e.label))})))};function S_(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return O_(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(O_(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,O_(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,O_(m,"constructor",s),O_(s,"constructor",c),c.displayName="GeneratorFunction",O_(s,a,"GeneratorFunction"),O_(m),O_(m,a,"Generator"),O_(m,r,function(){return this}),O_(m,"toString",function(){return"[object Generator]"}),(S_=function(){return{w:o,m:d}})()}function O_(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}O_=function(e,t,n,r){function o(t,n){O_(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},O_(e,t,n,r)}function P_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function j_(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?P_(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):P_(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}const T_=function(){var e=Cs(),t=e.currentTab,r=e.setCurrentTab,a=gi(),o=a.data,l=a.isLoading,i=pi(),c=$o(),s=c.showSuccess,u=c.showError,m=vo((0,$.useState)(null),2),d=m[0],g=m[1],p=N_(),f=(0,$.useRef)(null);(0,$.useEffect)(function(){o&&!d&&g(function(e){return j_(j_({},e),{},{protect_images:ni(e.protect_images),protect_images_globally:ni(e.protect_images_globally),animate_images_enable:ni(e.animate_images_enable),animate_pagination_enable:ni(e.animate_pagination_enable),watermark_automatically_at_upload:ni(e.watermark_automatically_at_upload),useMediaRSS:ni(e.useMediaRSS),galleries_in_feeds:ni(e.galleries_in_feeds),use_alternate_random_method:ni(e.use_alternate_random_method),disable_fontawesome:ni(e.disable_fontawesome),disable_ngg_tags_page:ni(e.disable_ngg_tags_page),dynamic_image_filename_separator_use_dash:ni(e.dynamic_image_filename_separator_use_dash),ngg_debug_mode:ni(e.ngg_debug_mode),thumbEffect:e.thumbEffect||"simplelightbox",thumbEffectContext:e.thumbEffectContext||"nextgen_images",thumbEffectCode:e.thumbEffectCode||"",thumbEffectScripts:e.thumbEffectScripts||[],thumbEffectStyles:e.thumbEffectStyles||[],router_param_slug:e.router_param_slug||"nggallery",maximum_entity_count:e.maximum_entity_count||500,random_widget_cache_ttl:e.random_widget_cache_ttl||0,wmPos:e.wmPos||"midCenter",wmXpos:e.wmXpos||15,wmYpos:e.wmYpos||5,wmType:e.wmType||"text",wmPath:e.wmPath||"",wmFont:e.wmFont||"arial.ttf",wmSize:e.wmSize||30,wmText:e.wmText||"",wmOpaque:e.wmOpaque||33,wmColor:e.wmColor?"#".concat(e.wmColor.replace("#","")):"#ffffff",animate_images_style:e.animate_images_style||"flipInX",animate_images_duration:e.animate_images_duration||1500,animate_images_delay:e.animate_images_delay||250,animate_pagination_style:e.animate_pagination_style||"flipInX",animate_pagination_duration:e.animate_pagination_duration||1500,animate_pagination_delay:e.animate_pagination_delay||250})}(o))},[o,d]),(0,$.useEffect)(function(){if(!p.map(function(e){return e.id}).includes(t)&&"hidden"!==t){var e,n=(null===(e=p[0])||void 0===e?void 0:e.id)||"image";r(n)}},[t,r,p]),(0,$.useEffect)(function(){return function(){f.current&&clearTimeout(f.current)}},[]);var y=(0,$.useCallback)(function(){var e=No(S_().m(function e(t){var n,r,a;return S_().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,r=j_(j_({},t),{},{wmColor:(null===(n=t.wmColor)||void 0===n?void 0:n.replace("#",""))||"ffffff"}),e.n=1,i.mutateAsync(r);case 1:s((0,pe.__)("Settings updated successfully!","nggallery")),e.n=3;break;case 2:e.p=2,a=e.v,u((0,pe.__)("Failed to update settings. Please try again.","nggallery")),console.error("Error updating plugin settings:",a);case 3:return e.a(2)}},e,null,[[0,2]])}));return function(t){return e.apply(this,arguments)}}(),[i,s,u]),h=(0,$.useCallback)(function(e,t){if(d){var r=j_(j_({},d),{},n({},e,t));g(r),f.current&&clearTimeout(f.current),f.current=setTimeout(function(){y(r)},333)}},[d,y]);return l||!d?ee().createElement(oo,{size:"md",text:(0,pe.__)("Loading settings...","nggallery")}):ee().createElement(uv,{currentTab:t,onTabChange:r,sidebarComponent:k_,title:""},ee().createElement(C_,{tabId:t,settings:d,onSettingsChange:h}))};var I_=function(){return[{key:"name",label:(0,pe.__)("Name","nggallery"),filterable:!0,visibleByDefault:!0,sortType:"frontend",locked:!0},{key:"slug",label:(0,pe.__)("Slug","nggallery"),filterable:!0,visibleByDefault:!0,sortType:"frontend",locked:!0},{key:"description",label:(0,pe.__)("Description","nggallery"),filterable:!0,visibleByDefault:!0,sortType:"frontend"},{key:"count",label:(0,pe.__)("Count","nggallery"),filterable:!0,visibleByDefault:!0,sortType:"frontend"}]},A_=Object.fromEntries(I_().map(function(e){return[e.key,e.visibleByDefault]}));const D_=function(e){var t=e.onTagCreated,n=(0,ge.useDispatch)(Br);return React.createElement("div",{className:"flex justify-between items-center mb-6"},React.createElement("h1",{className:"text-3xl font-bold"},(0,pe.__)("Tags","nggallery")),React.createElement("button",{onClick:function(){n.setActiveModal("tagForm",{onSuccess:t})},className:"bg-green-500 text-white hover:bg-green-600 px-4 py-2 h-auto rounded-md text-sm font-medium w-full sm:w-auto transition-colors"},(0,pe.__)("Add New Tag","nggallery")))};function L_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function F_(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?L_(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):L_(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}const M_=function(e){var t=e.tags,n=e.visibleColumns,r=e.selectedTags,a=e.onSelectAll,o=e.onSelectTag,l=e.onSort,i=e.sortColumn,c=e.sortDirection,s=e.onDelete,u=e.onEdit,m=e.isLoading,d=e.hasActiveSearch,g=void 0!==d&&d,p=(0,ge.useDispatch)(Br),f=g?ee().createElement("div",{className:"py-16"},ee().createElement("div",{className:"flex flex-col items-center justify-center text-center text-gray-500"},ee().createElement("p",{className:"text-sm mb-2"},(0,pe.__)("No results found for your search.","nggallery")))):ee().createElement("div",{className:"py-16"},ee().createElement("div",{className:"flex flex-col items-center justify-center text-center text-gray-500"},ee().createElement("div",{className:"mb-4"},ee().createElement(_r,{className:"w-16 h-16 opacity-60"})),ee().createElement("p",{className:"text-sm mb-2"},(0,pe.__)("No Tags so far!","nggallery")),ee().createElement("button",{type:"button",className:"inline-flex items-center gap-1 text-green-500 hover:text-green-600 text-sm font-medium",onClick:function(){p.setActiveModal("tagForm",{tag:null,onSuccess:function(){}})}},(0,pe.__)("Add New Tag","nggallery"),ee().createElement(ln,{className:"w-4 h-4"}))));return ee().createElement(Ph,{isLoading:m,items:t,visibleColumns:n,selectedItems:r,onSelectAll:a,onSelectItem:o,columns:I_().map(function(e){return F_(F_({},e),{},{render:function(t){return function(e,t){switch(t){case"name":return ee().createElement("button",{onClick:function(){return function(e){u(e)}(e)},className:"font-medium text-gray-900 text-sm hover:underline"},e.name);case"slug":return ee().createElement("span",{className:"text-gray-600 text-sm"},e.slug);case"description":return ee().createElement("div",{className:"text-sm text-gray-500 max-w-xs truncate",title:e.description},e.description||(0,pe.__)("No description","nggallery"));case"count":return ee().createElement("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800"},e.count);default:return null}}(t,e.key)}})}),onSort:l,sortColumn:i,sortDirection:c,notFoundContent:f,actionsHeaderLabel:(0,pe.__)("Actions","nggallery"),actionCellRenderer:function(e){return ee().createElement("div",{className:"flex flex-col items-center text-gray-500"},ee().createElement("button",{type:"button",className:"flex flex-col items-center text-red-600 hover:text-red-700",onClick:function(){return function(e){s([e])}(e)}},ee().createElement(fr,{className:"w-4 h-4 mb-1"}),ee().createElement("span",{className:"text-xs"},(0,pe.__)("Delete","nggallery"))))}})};function R_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function G_(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?R_(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):R_(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function B_(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return z_(e,t);var n={}.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)?z_(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,l=!0,i=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return l=e.done,e},e:function(e){i=!0,o=e},f:function(){try{l||null==n.return||n.return()}finally{if(i)throw o}}}}function z_(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function U_(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return q_(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(q_(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,q_(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,q_(m,"constructor",s),q_(s,"constructor",c),c.displayName="GeneratorFunction",q_(s,a,"GeneratorFunction"),q_(m),q_(m,a,"Generator"),q_(m,r,function(){return this}),q_(m,"toString",function(){return"[object Generator]"}),(U_=function(){return{w:o,m:d}})()}function q_(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}q_=function(e,t,n,r){function o(t,n){q_(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},q_(e,t,n,r)}const Q_=function(){var e=vo((0,$.useState)([]),2),t=e[0],n=e[1],r=vo((0,$.useState)(!0),2),a=r[0],o=r[1],l=vo((0,$.useState)(""),2),i=l[0],c=l[1],s=Cy(i,300),u=vo((0,$.useState)(A_),2),m=u[0],d=u[1],g=vo((0,$.useState)(new Set),2),p=g[0],f=g[1],y=vo((0,$.useState)(null),2),h=y[0],b=y[1],v=vo((0,$.useState)(null),2),_=v[0],w=v[1],x=vo((0,$.useState)(1),2),E=x[0],C=x[1],N=gi().data,k=(null==N?void 0:N.admin_table_per_page)||20,S=(0,ge.useDispatch)(Br),O=function(e){return{term_id:e.term_id,name:e.name,slug:e.slug,description:e.description,count:e.count}},P=function(e,t){var n,r=(null==e?void 0:e.message)||t;null!=e&&e.code&&(r+=" (".concat((0,pe.__)("Error Code","nggallery"),": ").concat(e.code,")")),null!=e&&null!==(n=e.data)&&void 0!==n&&n.details&&(r+=" - ".concat(e.data.details)),S.showNotice("error",r)},j=function(){var e=No(U_().m(function e(){var t,r,a,l,i,c;return U_().w(function(e){for(;;)switch(e.p=e.n){case 0:return o(!0),e.p=1,r=null===(t=window.imagelyApp)||void 0===t?void 0:t.nonce,e.n=2,Oo()({path:"/imagely/v1/tags",method:"GET",headers:{"X-WP-Nonce":r,"Content-Type":"application/json"}});case 2:a=e.v,n(a),e.n=9;break;case 3:if(e.p=3,i=e.v,console.error("Error fetching tags:",i),!(i instanceof Response)){e.n=8;break}return e.p=4,e.n=5,i.json();case 5:l=e.v,P(l,(0,pe.__)("Failed to load tags","nggallery")),e.n=7;break;case 6:e.p=6,c=e.v,console.error("Error parsing error response JSON:",c),S.showNotice("error",(0,pe.__)("Failed to load tags","nggallery"));case 7:e.n=9;break;case 8:P(i,(0,pe.__)("Failed to load tags","nggallery"));case 9:return e.p=9,o(!1),e.f(9);case 10:return e.a(2)}},e,null,[[4,6],[1,3,9,10]])}));return function(){return e.apply(this,arguments)}}();(0,$.useEffect)(function(){j()},[]),(0,$.useEffect)(function(){C(1)},[s]),(0,$.useEffect)(function(){f(new Set)},[E]);var T=ee().useCallback(function(e){C(e),window.scrollTo({top:0,behavior:"smooth"})},[]),I=function(e){var t,n=e.map(O);S.setActiveModal("deleteTags",{tags:n,onClose:function(){return S.setActiveModal(null)},onConfirm:(t=No(U_().m(function e(){var t,r,a,o,l,i;return U_().w(function(e){for(;;)switch(e.p=e.n){case 0:e.p=0,t=B_(n),e.p=1,t.s();case 2:if((r=t.n()).done){e.n=4;break}return a=r.value,e.n=3,S.deleteItem("tags",a.term_id);case 3:e.n=2;break;case 4:e.n=6;break;case 5:e.p=5,l=e.v,t.e(l);case 6:return e.p=6,t.f(),e.f(6);case 7:return S.showNotice("success",(0,pe.__)("Tags deleted successfully","nggallery")),e.n=8,j();case 8:f(new Set),e.n=15;break;case 9:if(e.p=9,i=e.v,console.error("Error deleting tags:",i),!(i instanceof Response)){e.n=14;break}return e.p=10,e.n=11,i.json();case 11:o=e.v,P(o,(0,pe.__)("Failed to delete tags","nggallery")),e.n=13;break;case 12:e.p=12,e.v,S.showNotice("error",(0,pe.__)("Failed to delete tags","nggallery"));case 13:e.n=15;break;case 14:P(i,(0,pe.__)("Failed to delete tags","nggallery"));case 15:S.setActiveModal(null);case 16:return e.a(2)}},e,null,[[10,12],[1,5,6,7],[0,9]])})),function(){return t.apply(this,arguments)})})},A=(0,$.useMemo)(function(){var e=t.filter(function(e){return e.name.toLowerCase().includes(s.toLowerCase())||e.description.toLowerCase().includes(s.toLowerCase())||e.slug.toLowerCase().includes(s.toLowerCase())});h&&_&&(e=ko(e).sort(function(e,t){var n,r;switch(h){case"galleryTitle":n=e.name.toLowerCase(),r=t.name.toLowerCase();break;case"slug":n=e.slug.toLowerCase(),r=t.slug.toLowerCase();break;case"count":n=e.count,r=t.count;break;default:return 0}return n<r?"asc"===_?-1:1:n>r?"asc"===_?1:-1:0}));var n=e.length,r=Math.ceil(n/k),a=(E-1)*k,o=a+k;return{paginatedTagsForTable:e.slice(a,o).map(function(e){return G_(G_({},e),{},{id:e.term_id,galleryTitle:e.name})}),pagination:{total:n,total_pages:r,per_page:k,current_page:E}}},[t,s,h,_,E,k]),D=A.paginatedTagsForTable,L=A.pagination;(0,$.useEffect)(function(){L.total_pages>0&&E>L.total_pages&&C(L.total_pages)},[L.total_pages]);var F=D;return ee().createElement("div",{className:"p-6 min-h-screen"},ee().createElement(D_,{onTagCreated:j}),ee().createElement(Ey,{title:(0,pe.__)("Manage Tags","nggallery"),searchTerm:i,setSearchTerm:c,onSearch:function(){},visibleColumns:m,setVisibleColumns:d,selectedItems:p,items:F,columns:ko(I_()),itemType:"tag",searchPlaceholder:(0,pe.__)("Search Tags","nggallery"),onDelete:I}),ee().createElement(M_,{isLoading:a,tags:F,visibleColumns:m,selectedTags:p,onSelectAll:function(e){f(e?new Set(F.map(function(e){return e.id})):new Set)},onSelectTag:function(e){var t=new Set(p);t.has(e)?t.delete(e):t.add(e),f(t)},onSort:function(e,t){b(t?e:null),w(t),C(1)},sortColumn:h,sortDirection:_,onDelete:I,onEdit:function(e){var t=O(e);S.setActiveModal("tagForm",{tag:t,onSuccess:j})},hasActiveSearch:!!s}),!a&&(L.total>0||s)&&ee().createElement(Xf,{currentPage:E,totalPages:L.total_pages,perPage:L.per_page,total:L.total,onPageChange:T,itemLabel:s?(0,pe.__)("Results","nggallery"):(0,pe.__)("Tags","nggallery"),showItemCount:!0}))};var W_=function(){return[{id:"photocrati-nextgen_basic_thumbnails",label:(0,pe.__)("Basic Thumbnails","nggallery"),description:(0,pe.__)("Configure default settings for Basic Thumbnails display type","nggallery")},{id:"photocrati-nextgen_basic_slideshow",label:(0,pe.__)("Basic Slideshow","nggallery"),description:(0,pe.__)("Configure default settings for Basic Slideshow display type","nggallery")},{id:"photocrati-nextgen_basic_imagebrowser",label:(0,pe.__)("Basic ImageBrowser","nggallery"),description:(0,pe.__)("Configure default settings for Basic ImageBrowser display type","nggallery")},{id:"photocrati-nextgen_basic_tagcloud",label:(0,pe.__)("Basic TagCloud","nggallery"),description:(0,pe.__)("Configure default settings for Basic TagCloud display type","nggallery")},{id:"photocrati-nextgen_pro_film",label:(0,pe.__)("Pro Film","nggallery"),description:(0,pe.__)("Configure default settings for Pro Film display type","nggallery")},{id:"photocrati-nextgen_pro_mosaic",label:(0,pe.__)("Pro Mosaic","nggallery"),description:(0,pe.__)("Configure default settings for Pro Mosaic display type","nggallery")},{id:"photocrati-nextgen_pro_thumbnail_grid",label:(0,pe.__)("Pro Thumbnail Grid","nggallery"),description:(0,pe.__)("Configure default settings for Pro Thumbnail Grid display type","nggallery")},{id:"photocrati-nextgen_pro_blog_gallery",label:(0,pe.__)("Pro Blog Style","nggallery"),description:(0,pe.__)("Configure default settings for Pro Blog Style display type","nggallery")},{id:"photocrati-nextgen_pro_imagebrowser",label:(0,pe.__)("Pro ImageBrowser","nggallery"),description:(0,pe.__)("Configure default settings for Pro ImageBrowser display type","nggallery")},{id:"photocrati-nextgen_pro_sidescroll",label:(0,pe.__)("Pro Sidescroll","nggallery"),description:(0,pe.__)("Configure default settings for Pro Sidescroll display type","nggallery")},{id:"photocrati-nextgen_pro_tile",label:(0,pe.__)("Pro Tile","nggallery"),description:(0,pe.__)("Configure default settings for Pro Tile display type","nggallery")},{id:"photocrati-nextgen_pro_masonry",label:(0,pe.__)("Pro Masonry","nggallery"),description:(0,pe.__)("Configure default settings for Pro Masonry display type","nggallery")},{id:"imagely-pro-search",label:(0,pe.__)("Pro Search","nggallery"),description:(0,pe.__)("Configure default settings for Pro Search display type","nggallery")},{id:"photocrati-nextgen_pro_horizontal_filmstrip",label:(0,pe.__)("Pro Horizontal Filmstrip","nggallery"),description:(0,pe.__)("Configure default settings for Pro Horizontal Filmstrip display type","nggallery")},{id:"photocrati-nextgen_pro_slideshow",label:(0,pe.__)("Pro Slideshow","nggallery"),description:(0,pe.__)("Configure default settings for Pro Slideshow display type","nggallery")}]};const H_=function(e){var t=e.tabId,n=e.currentDisplayType,r=e.onInputChange,a=e.onReset,o=e.isResetting,l=W_().find(function(e){return e.id===t}),i="pro"===zr||"plus"===zr,c=i||"starter"===zr;return n?ee().createElement("div",{className:"display-type-settings relative"},ee().createElement(nf,{title:(null==l?void 0:l.label)||"",defaultExpanded:!0},ee().createElement("div",{className:"space-y-4"},function(){var e={formState:n.settings,handleInputChange:r},a=ee().createElement("div",{className:"text-center text-gray-500 py-8"},(0,pe.__)("This layout requires NextGen Gallery Pro.","nggallery"));switch(t){case"photocrati-nextgen_basic_thumbnails":return ee().createElement(kf,e);case"photocrati-nextgen_basic_slideshow":return ee().createElement(wf,e);case"photocrati-nextgen_basic_imagebrowser":return ee().createElement(Tf,e);case"photocrati-nextgen_basic_tagcloud":return ee().createElement(Af,e);case"photocrati-nextgen_pro_thumbnail_grid":return i?ee().createElement(jf,e):a;case"photocrati-nextgen_pro_blog_gallery":return i?ee().createElement(Df,e):a;case"photocrati-nextgen_pro_imagebrowser":return i?ee().createElement(Lf,e):a;case"photocrati-nextgen_pro_sidescroll":return i?ee().createElement(Ff,e):a;case"photocrati-nextgen_pro_film":return c?ee().createElement(Mf,e):a;case"photocrati-nextgen_pro_tile":return i?ee().createElement(Rf,e):a;case"photocrati-nextgen_pro_mosaic":return c?ee().createElement(Gf,e):a;case"photocrati-nextgen_pro_masonry":return i?ee().createElement(Bf,e):a;case"imagely-pro-search":return i?ee().createElement(zf,e):a;case"photocrati-nextgen_pro_horizontal_filmstrip":return i?ee().createElement(Uf,e):a;case"photocrati-nextgen_pro_slideshow":return i?ee().createElement(qf,e):a;default:return ee().createElement("div",{className:"text-center text-gray-500 py-8"},(0,pe.__)("No settings available for this display type.","nggallery"))}}())),ee().createElement("button",{type:"button",onClick:a,disabled:o,className:"text-sm text-gray-500 hover:text-gray-700 disabled:opacity-50 underline absolute top-4 right-11 z-10"},o?(0,pe.__)("Resetting...","nggallery"):(0,pe.__)("Reset to defaults","nggallery"))):null},V_=function(e){var t=e.activeTab,n=e.onTabChange,r=e.availableLayouts,a=void 0===r?[]:r,o=W_().filter(function(e){return 0===a.length||a.includes(e.id)});return ee().createElement("div",{className:"bg-white rounded-lg shadow-sm p-4"},ee().createElement("nav",{className:"space-y-2"},o.map(function(e){var r=t===e.id;return ee().createElement("button",{key:e.id,onClick:function(){return n(e.id)},className:"w-full flex items-center justify-between p-3 text-left rounded-lg transition-colors ".concat(r?"bg-green-50 text-green-700 font-medium border border-green-200":"text-gray-600 hover:bg-gray-50 hover:text-gray-900")},ee().createElement("span",{className:"text-sm"},e.label))})))};function K_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function X_(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?K_(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):K_(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Y_(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return Z_(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Z_(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Z_(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,Z_(m,"constructor",s),Z_(s,"constructor",c),c.displayName="GeneratorFunction",Z_(s,a,"GeneratorFunction"),Z_(m),Z_(m,a,"Generator"),Z_(m,r,function(){return this}),Z_(m,"toString",function(){return"[object Generator]"}),(Y_=function(){return{w:o,m:d}})()}function Z_(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}Z_=function(e,t,n,r){function o(t,n){Z_(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Z_(e,t,n,r)}const J_=function(){var e,t=Cs(),r=t.currentTab,a=t.setCurrentTab,o=hh(),l=o.data,i=void 0===l?{}:l,c=o.isLoading,s=o.error,u=$o(),m=u.showSuccess,d=u.showError,g=function(){var e,t,r=re();return gl({mutationFn:(t=No(fh().m(function e(t){var n,r,a,o,l,i;return fh().w(function(e){for(;;)switch(e.n){case 0:return r=t.name,a=t.settings,o=null===(n=window.imagelyApp)||void 0===n?void 0:n.nonce,l=ai(a),e.n=1,Oo()({path:"/imagely/v1/display-types/".concat(r),method:"PUT",headers:{"X-WP-Nonce":o},data:{settings:l}});case 1:return i=e.v,e.a(2,i.display_type)}},e)})),function(e){return t.apply(this,arguments)}),onMutate:(e=No(fh().m(function e(t){var a,o,l;return fh().w(function(e){for(;;)switch(e.n){case 0:return a=t.name,o=t.settings,e.n=1,r.cancelQueries({queryKey:["display-types"]});case 1:return(l=r.getQueryData(["display-types"]))&&l[a]&&r.setQueryData(["display-types"],ph(ph({},l),{},n({},a,ph(ph({},l[a]),{},{settings:ph(ph({},l[a].settings),o)})))),e.a(2,{previous:l})}},e)})),function(t){return e.apply(this,arguments)}),onError:function(e,t,n){null!=n&&n.previous&&r.setQueryData(["display-types"],n.previous)},onSettled:function(){r.invalidateQueries({queryKey:["display-types"]})}})}(),p=function(){var e,t=re();return gl({mutationFn:(e=No(fh().m(function e(t){var n,r,a;return fh().w(function(e){for(;;)switch(e.n){case 0:return r=null===(n=window.imagelyApp)||void 0===n?void 0:n.nonce,e.n=1,Oo()({path:"/imagely/v1/display-types/".concat(t,"/reset"),method:"POST",headers:{"X-WP-Nonce":r}});case 1:return a=e.v,e.a(2,a.display_type)}},e)})),function(t){return e.apply(this,arguments)}),onSuccess:function(e,r){t.setQueryData(["display-types"],function(t){return t?ph(ph({},t),{},n({},r,e)):t})},onSettled:function(){t.invalidateQueries({queryKey:["display-types"]})}})}(),f=function(){var e=re();return(0,$.useCallback)(function(t,r,a){e.setQueryData(["display-types"],function(e){return e&&e[t]?ph(ph({},e),{},n({},t,ph(ph({},e[t]),{},{settings:ph(ph({},e[t].settings),{},n({},r,a))}))):e})},[e])}(),y=(0,ge.useDispatch)(Br),h=vo((0,$.useState)(!1),2),b=h[0],v=h[1],_=function(e){var t=["photocrati-nextgen_basic_slideshow","photocrati-nextgen_basic_thumbnails","photocrati-nextgen_basic_imagebrowser","photocrati-nextgen_basic_tagcloud"],n=[].concat(t,["photocrati-nextgen_pro_film","photocrati-nextgen_pro_mosaic"]),r=[].concat(ko(n),["photocrati-nextgen_pro_thumbnail_grid","photocrati-nextgen_pro_blog_gallery","photocrati-nextgen_pro_imagebrowser","photocrati-nextgen_pro_sidescroll","photocrati-nextgen_pro_tile","photocrati-nextgen_pro_masonry","imagely-pro-search","photocrati-nextgen_pro_horizontal_filmstrip","photocrati-nextgen_pro_slideshow"]);switch(e){case"pro":case"plus":return r;case"starter":return n;default:return t}}((null===(e=window.imagelyApp)||void 0===e?void 0:e.proTypeInstalled)||"lite"),w=W_().filter(function(e){return _.includes(e.id)}),x=(0,$.useRef)(null),E=i[r];(0,$.useEffect)(function(){if(!w.map(function(e){return e.id}).includes(r)){var e,t=(null===(e=w[0])||void 0===e?void 0:e.id)||"photocrati-nextgen_basic_thumbnails";a(t)}},[r,a,w]),(0,$.useEffect)(function(){return function(){x.current&&clearTimeout(x.current)}},[]),(0,$.useEffect)(function(){x.current&&(clearTimeout(x.current),x.current=null)},[r]);var C=(0,$.useCallback)(function(){var e=No(Y_().m(function e(t,n){var r;return Y_().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,g.mutateAsync({name:t,settings:n});case 1:m((0,pe.__)("Display type settings updated successfully!","nggallery")),e.n=3;break;case 2:e.p=2,r=e.v,d((0,pe.__)("Failed to update display type settings. Please try again.","nggallery")),console.error("Error updating display type settings:",r);case 3:return e.a(2)}},e,null,[[0,2]])}));return function(t,n){return e.apply(this,arguments)}}(),[g,m,d]),N=(0,$.useCallback)(function(e){var t=e.target,a=t.name,o=t.value,l=o;if("type"in e.target){var i=e.target;"checkbox"===i.type?l=i.checked:"number"===i.type&&(l=parseInt(o)||0)}f(r,a,l),x.current&&clearTimeout(x.current);var c=r,s=null==E?void 0:E.settings;x.current=setTimeout(function(){var e=X_(X_({},s),{},n({},a,l));C(c,e)},1e3)},[r,f,null==E?void 0:E.settings,C]),k=(0,$.useCallback)(No(Y_().m(function e(){return Y_().w(function(e){for(;;)switch(e.p=e.n){case 0:if(E){e.n=1;break}return e.a(2);case 1:return v(!0),e.p=2,e.n=3,p.mutateAsync(r);case 3:m((0,pe.__)("Display type reset to defaults","nggallery")),e.n=5;break;case 4:e.p=4,e.v,d((0,pe.__)("Failed to reset display type","nggallery"));case 5:return e.p=5,v(!1),e.f(5);case 6:return e.a(2)}},e,null,[[2,4,5,6]])})),[E,r,p,m,d]);return c?ee().createElement(oo,{size:"md",text:(0,pe.__)("Loading display type settings...","nggallery")}):s?ee().createElement("div",{className:"text-red-500"},"Error loading display types: ",s.message):ee().createElement("div",null,ee().createElement("div",{className:"mb-4"},ee().createElement("button",{onClick:function(){y.navigateTo("imagely-settings","license")},className:"flex items-center space-x-2 text-gray-600 hover:text-gray-900 transition-colors"},ee().createElement(dr,{className:"h-5 w-5"}),ee().createElement("span",{className:"text-sm font-medium"},(0,pe.__)("Back to Settings","nggallery")))),ee().createElement(uv,{currentTab:r,onTabChange:function(e){var t=e;_.includes(t)?a(t):y.setActiveModal("upgrade",{feature:"layout settings"})},sidebarComponent:function(e){return ee().createElement(V_,fe({},e,{availableLayouts:_}))}},ee().createElement(H_,{tabId:r,currentDisplayType:E,onInputChange:N,onReset:k,isResetting:b})))};function $_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ew(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?$_(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$_(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function tw(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return nw(e,t);var n={}.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)?nw(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,l=!0,i=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return l=e.done,e},e:function(e){i=!0,o=e},f:function(){try{l||null==n.return||n.return()}finally{if(i)throw o}}}}function nw(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}const rw=function(){var e,t,n=(0,ge.useSelect)(function(e){return{currentPage:e(Br).getCurrentPage()}},[]).currentPage,r=(0,ge.useDispatch)(Br);(0,$.useEffect)(function(){var e=function(){ue(!0);try{var e=new URLSearchParams(window.location.search),t=e.get("page")||"imagely",n=e.get("tab")||"general",a=e.get("subtab")||null,o=e.get("id")?Number(e.get("id")):null;r.setRouterState(t,n,a,o)}finally{setTimeout(function(){ue(!1)},0)}};return window.addEventListener("popstate",e),function(){window.removeEventListener("popstate",e)}},[r.setRouterState]),(0,$.useEffect)(function(){var e,t,a,o,l=function(e){var t,n,a,o,l=e.target,i=l.getAttribute("href");if(!(null!=i&&i.includes("imagely.com/lite")||l.closest("li.imagely-sidebar-upgrade-pro")||null!=i&&i.includes("imagely.com/cdn")||l.closest("a:has(.imagely_cdn_new_badge)"))){e.preventDefault(),e.stopPropagation(),null===(t=document.querySelector("#toplevel_page_imagely a.current"))||void 0===t||t.classList.remove("current"),null===(n=document.querySelector("#toplevel_page_imagely li.current"))||void 0===n||n.classList.remove("current");var c=new URLSearchParams(null==i?void 0:i.split("?")[1]),s=null!==(a=c.get("page"))&&void 0!==a?a:"imagely";l.classList.add("current"),null===(o=l.parentElement)||void 0===o||o.classList.add("current"),l.blur(),r.setCurrentPage(s),r.setCurrentTab("general"),r.setCurrentId(null),setTimeout(function(){var e=new URLSearchParams(window.location.search);c.forEach(function(t,n){"page"!==n&&"tab"!==n&&"id"!==n&&e.set(n,t)});var t="".concat(window.location.pathname,"?").concat(e.toString());t!==window.location.href&&(window.history.replaceState({},"",t),window.dispatchEvent(new Event("imagely-navigation")))},10)}},i=document.querySelectorAll("#toplevel_page_imagely a"),c=tw(i);try{for(c.s();!(o=c.n()).done;)o.value.addEventListener("click",l)}catch(e){c.e(e)}finally{c.f()}var s=document.querySelector("span.imagely_cdn_new_badge");if(s){var u,m=null===(u=s.closest("li"))||void 0===u?void 0:u.querySelector("a");m&&m.setAttribute("target","_blank")}null===(e=document.querySelector("#toplevel_page_imagely a.current"))||void 0===e||e.classList.remove("current"),null===(t=document.querySelector("#toplevel_page_imagely li.current"))||void 0===t||t.classList.remove("current");var d=document.querySelector('#toplevel_page_imagely ul.wp-submenu-wrap li a[href*="page='.concat(n,'"]'));return null==d||d.classList.add("current"),null==d||null===(a=d.parentElement)||void 0===a||a.classList.add("current"),function(){var e,t=tw(i);try{for(t.s();!(e=t.n()).done;)e.value.removeEventListener("click",l)}catch(e){t.e(e)}finally{t.f()}}},[n,r.setCurrentPage,r.setCurrentTab,r.setCurrentId]);var a="pro"===(null===(e=window.imagelyApp)||void 0===e?void 0:e.proTypeInstalled),o=ew(ew({imagely:{title:(0,pe.__)("Galleries","nggallery"),component:React.createElement(sv,null)},"imagely-add-new":{title:(0,pe.__)("Add New Gallery","nggallery"),component:React.createElement(yy,null)},"imagely-albums":{title:(0,pe.__)("Albums","nggallery"),component:React.createElement(Fh,null)},"imagely-tags":{title:(0,pe.__)("Tags","nggallery"),component:React.createElement(Q_,null)},"imagely-addons":{title:(0,pe.__)("Features","nggallery"),component:React.createElement(vy,null)}},a&&{"imagely-ecommerce":{title:(0,pe.__)("eCommerce","nggallery"),component:React.createElement(Zb,null)}}),{},{"imagely-settings":{title:(0,pe.__)("Settings","nggallery"),component:React.createElement(T_,null)},"imagely-layout-settings":{title:(0,pe.__)("Layout Settings","nggallery"),component:React.createElement(J_,null)},"imagely-about-us":{title:(0,pe.__)("About Us","nggallery"),component:React.createElement(Wp,null)}});(0,$.useEffect)(function(){"imagely-ecommerce"!==n||a||(r.setCurrentPage("imagely"),r.setCurrentTab("general"))},[n,a,r.setCurrentPage,r.setCurrentTab]);var l=(null===(t=o[n])||void 0===t?void 0:t.component)||React.createElement(sv,null);return React.createElement(le,null,React.createElement(wo,null),React.createElement(yo,null),React.createElement("div",{className:"p-4 md:p-6 lg:p-8"},l),React.createElement(po,null),React.createElement(Bp,null),React.createElement(qr,null),React.createElement(Up,null),React.createElement(lo,null))};function aw(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ow(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?aw(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):aw(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function lw(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function o(n,r,a,o){var c=r&&r.prototype instanceof i?r:i,s=Object.create(c.prototype);return iw(s,"_invoke",function(n,r,a){var o,i,c,s=0,u=a||[],m=!1,d={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(t,n){return o=t,i=0,c=e,d.n=n,l}};function g(n,r){for(i=n,c=r,t=0;!m&&s&&!a&&t<u.length;t++){var a,o=u[t],g=d.p,p=o[2];n>3?(a=p===r)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=g&&((a=n<2&&g<o[1])?(i=0,d.v=r,d.n=o[1]):g<p&&(a=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,d.n=p,i=0))}if(a||n>1)return l;throw m=!0,r}return function(a,u,p){if(s>1)throw TypeError("Generator is already running");for(m&&1===u&&g(u,p),i=u,c=p;(t=i<2?e:c)||!m;){o||(i?i<3?(i>1&&(d.n=-1),g(i,c)):d.n=c:d.v=c);try{if(s=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(m=d.n<0)?c:n.call(r,d))!==l)break}catch(t){o=e,i=1,c=t}finally{s=1}}return{value:t,done:m}}}(n,a,o),!0),s}var l={};function i(){}function c(){}function s(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(iw(t={},r,function(){return this}),t),m=s.prototype=i.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,iw(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return c.prototype=s,iw(m,"constructor",s),iw(s,"constructor",c),c.displayName="GeneratorFunction",iw(s,a,"GeneratorFunction"),iw(m),iw(m,a,"Generator"),iw(m,r,function(){return this}),iw(m,"toString",function(){return"[object Generator]"}),(lw=function(){return{w:o,m:d}})()}function iw(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}iw=function(e,t,n,r){function o(t,n){iw(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},iw(e,t,n,r)}var cw={router:{currentTab:new URLSearchParams(window.location.search).get("tab")||"general",currentSubTab:new URLSearchParams(window.location.search).get("subtab")||null,currentPage:new URLSearchParams(window.location.search).get("page")||"imagely",currentId:Number(new URLSearchParams(window.location.search).get("id"))||null},ui:{activeModal:null,notifications:[],inbox:{active:[],dismissed:[],counts:{active:0,dismissed:0},isOpen:!1,loading:!1,error:null},isPageLoading:!1}},sw={DELETE_ITEM:(0,ge.createRegistryControl)(function(){return function(e){var t,n=e.entityType,r=e.id,a=null===(t=window.imagelyApp)||void 0===t?void 0:t.nonce;return Oo()({path:"/imagely/v1/".concat(n,"/").concat(r),method:"DELETE",headers:{"X-WP-Nonce":a,"Content-Type":"application/json"},parse:!1}).then(function(e){var t=e;return 204===t.status?null:t.json()})}}),FETCH_NOTIFICATIONS:(0,ge.createRegistryControl)(function(){return function(){var e,t=null===(e=window.imagelyApp)||void 0===e?void 0:e.nonce;return Oo()({path:"/imagely/v1/notifications",method:"GET",headers:{"X-WP-Nonce":t,"Content-Type":"application/json"}})}}),DISMISS_INBOX_NOTIFICATION:(0,ge.createRegistryControl)(function(){return function(e){var t,n=e.id,r=null===(t=window.imagelyApp)||void 0===t?void 0:t.nonce;return Oo()({path:"/imagely/v1/notifications/dismiss",method:"POST",headers:{"X-WP-Nonce":r,"Content-Type":"application/json"},data:{id:n}})}})},uw={setCurrentTab:function(e){return de({tab:e}),{type:"SET_CURRENT_TAB",tab:e}},setCurrentSubTab:function(e){return de({subtab:e}),{type:"SET_CURRENT_SUB_TAB",subTab:e}},setCurrentPage:function(e){return de({page:e}),{type:"SET_CURRENT_PAGE",page:e}},setCurrentId:function(e){return de({id:e}),{type:"SET_CURRENT_ID",id:e}},setRouterState:function(e,t,n,r){return{type:"SET_ROUTER_STATE",page:e,tab:t,subTab:n,id:r}},navigateTo:function(e,t,n,r){var a=null,o=null;return"number"==typeof n?(o=n,a=null):"string"==typeof n?(a=n,o=r||null):(a=null,o=r||null),de({page:e,tab:t,subtab:a,id:o}),{type:"NAVIGATE_TO",page:e,tab:t,subTab:a,id:o}},setActiveModal:function(e,t){return{type:"SET_ACTIVE_MODAL",modalType:e,modalProps:t}},showNotice:function(e,t,n){var r={id:"notification-".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9)),type:e,message:t,timestamp:Date.now(),dismissible:!1!==(null==n?void 0:n.dismissible),duration:(null==n?void 0:n.duration)||("error"===e?0:700)};return r.duration>0&&setTimeout(function(){var e;(null===(e=window.wp)||void 0===e||null===(e=e.data)||void 0===e?void 0:e.select(Br))&&window.wp.data.dispatch(Br).dismissNotice(r.id)},r.duration),{type:"ADD_NOTIFICATION",notification:r}},dismissNotice:function(e){return{type:"DISMISS_NOTIFICATION",id:e}},clearAllNotices:function(){return{type:"CLEAR_ALL_NOTIFICATIONS"}},setPageLoading:function(e){return{type:"SET_PAGE_LOADING",loading:e}},setInboxLoading:function(e){return{type:"SET_INBOX_LOADING",loading:e}},setInboxError:function(e){return{type:"SET_INBOX_ERROR",error:e}},setInboxNotifications:function(e,t,n){return{type:"SET_INBOX_NOTIFICATIONS",active:e,dismissed:t,counts:n}},setInboxOpen:function(e){return{type:"SET_INBOX_OPEN",isOpen:e}},updateInboxCounts:function(e){return{type:"UPDATE_INBOX_COUNTS",counts:e}},deleteItem:lw().m(function e(t,n){var r;return lw().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,{type:"DELETE_ITEM",entityType:t,id:n};case 1:return e.a(2,!0);case 2:return e.p=2,r=e.v,console.error("Error deleting ".concat(t,":"),r),e.a(2,!1)}},e,null,[[0,2]])}),fetchInboxNotifications:lw().m(function e(){var t,n;return lw().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.n=1,uw.setInboxLoading(!0);case 1:return e.p=1,e.n=2,{type:"FETCH_NOTIFICATIONS"};case 2:return t=e.v,e.n=3,uw.setInboxNotifications(t.active,t.dismissed,t.counts);case 3:return e.n=4,uw.setInboxError(null);case 4:e.n=6;break;case 5:return e.p=5,n=e.v,console.error("Store: Error fetching inbox notifications:",n),e.n=6,uw.setInboxError(n.message);case 6:return e.p=6,e.n=7,uw.setInboxLoading(!1);case 7:return e.f(6);case 8:return e.a(2)}},e,null,[[1,5,6,8]])}),dismissInboxNotification:lw().m(function e(t){var n,r;return lw().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,{type:"DISMISS_INBOX_NOTIFICATION",id:t};case 1:return n=e.v,e.n=2,uw.updateInboxCounts(n.counts);case 2:return e.n=3,uw.fetchInboxNotifications();case 3:e.n=5;break;case 4:return e.p=4,r=e.v,console.error("Store: Error dismissing inbox notification:",r),e.n=5,uw.setInboxError(r.message);case 5:return e.a(2)}},e,null,[[0,4]])}),dismissAllInboxNotifications:lw().m(function e(){var t,n;return lw().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,{type:"DISMISS_INBOX_NOTIFICATION",id:"all"};case 1:return t=e.v,e.n=2,uw.updateInboxCounts(t.counts);case 2:return e.n=3,uw.fetchInboxNotifications();case 3:e.n=5;break;case 4:return e.p=4,n=e.v,console.error("Store: Error dismissing all inbox notifications:",n),e.n=5,uw.setInboxError(n.message);case 5:return e.a(2)}},e,null,[[0,4]])}),openInboxPanel:lw().m(function e(){return lw().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,uw.setInboxOpen(!0);case 1:return e.a(2)}},e)}),closeInboxPanel:lw().m(function e(){return lw().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,uw.setInboxOpen(!1);case 1:return e.a(2)}},e)})},mw={getCurrentTab:function(e){return e.router.currentTab},getCurrentSubTab:function(e){return e.router.currentSubTab},getCurrentPage:function(e){return e.router.currentPage},getCurrentId:function(e){return e.router.currentId},getRouteParams:function(e){return e.router},getActiveModal:function(e){return e.ui.activeModal},getNotifications:function(e){return e.ui.notifications},getPageLoading:function(e){return e.ui.isPageLoading},getUIState:function(e){return e.ui},getInboxState:function(e){return e.ui.inbox||cw.ui.inbox},getInboxActive:function(e){var t;return(null===(t=e.ui.inbox)||void 0===t?void 0:t.active)||[]},getInboxDismissed:function(e){var t;return(null===(t=e.ui.inbox)||void 0===t?void 0:t.dismissed)||[]},getInboxCounts:function(e){var t;return(null===(t=e.ui.inbox)||void 0===t?void 0:t.counts)||{active:0,dismissed:0}},getInboxActiveCount:function(e){var t;return(null===(t=e.ui.inbox)||void 0===t||null===(t=t.counts)||void 0===t?void 0:t.active)||0},getInboxDismissedCount:function(e){var t;return(null===(t=e.ui.inbox)||void 0===t||null===(t=t.counts)||void 0===t?void 0:t.dismissed)||0},getInboxIsOpen:function(e){var t;return(null===(t=e.ui.inbox)||void 0===t?void 0:t.isOpen)||!1},getInboxLoading:function(e){var t;return(null===(t=e.ui.inbox)||void 0===t?void 0:t.loading)||!1},getInboxError:function(e){var t;return(null===(t=e.ui.inbox)||void 0===t?void 0:t.error)||null}},dw=(0,ge.createReduxStore)(Br,{reducer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:cw,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SET_CURRENT_TAB":return ow(ow({},e),{},{router:ow(ow({},e.router),{},{currentTab:t.tab})});case"SET_CURRENT_SUB_TAB":return ow(ow({},e),{},{router:ow(ow({},e.router),{},{currentSubTab:t.subTab})});case"SET_CURRENT_PAGE":return ow(ow({},e),{},{router:ow(ow({},e.router),{},{currentPage:t.page})});case"SET_CURRENT_ID":return ow(ow({},e),{},{router:ow(ow({},e.router),{},{currentId:t.id})});case"SET_ROUTER_STATE":case"NAVIGATE_TO":return ow(ow({},e),{},{router:{currentPage:t.page,currentTab:t.tab,currentSubTab:t.subTab,currentId:t.id}});case"SET_ACTIVE_MODAL":return ow(ow({},e),{},{ui:ow(ow({},e.ui),{},{activeModal:t.modalType?{type:t.modalType,props:t.modalProps||{}}:null})});case"ADD_NOTIFICATION":return ow(ow({},e),{},{ui:ow(ow({},e.ui),{},{notifications:[].concat(ko(e.ui.notifications),[t.notification])})});case"DISMISS_NOTIFICATION":return ow(ow({},e),{},{ui:ow(ow({},e.ui),{},{notifications:e.ui.notifications.filter(function(e){return e.id!==t.id})})});case"CLEAR_ALL_NOTIFICATIONS":return ow(ow({},e),{},{ui:ow(ow({},e.ui),{},{notifications:[]})});case"SET_PAGE_LOADING":return ow(ow({},e),{},{ui:ow(ow({},e.ui),{},{isPageLoading:t.loading})});case"SET_INBOX_LOADING":return ow(ow({},e),{},{ui:ow(ow({},e.ui),{},{inbox:ow(ow({},e.ui.inbox),{},{loading:t.loading})})});case"SET_INBOX_ERROR":return ow(ow({},e),{},{ui:ow(ow({},e.ui),{},{inbox:ow(ow({},e.ui.inbox),{},{error:t.error})})});case"SET_INBOX_NOTIFICATIONS":return ow(ow({},e),{},{ui:ow(ow({},e.ui),{},{inbox:ow(ow({},e.ui.inbox),{},{active:t.active,dismissed:t.dismissed,counts:t.counts})})});case"SET_INBOX_OPEN":return ow(ow({},e),{},{ui:ow(ow({},e.ui),{},{inbox:ow(ow({},e.ui.inbox),{},{isOpen:t.isOpen})})});case"UPDATE_INBOX_COUNTS":return ow(ow({},e),{},{ui:ow(ow({},e.ui),{},{inbox:ow(ow({},e.ui.inbox),{},{counts:t.counts})})});default:return e}},actions:uw,selectors:mw,controls:sw});try{(0,ge.register)(dw)}catch(e){}var gw=document.getElementById("imagely-admin-app");if(!gw)throw console.error("Root element not found"),new Error("Root element not found");(0,e.H)(gw).render(React.createElement(rw,null))})()})();
dvadf
dvadf
| ver. 1.4 |
Github
|
.
| PHP 7.3.33 | Generation time: 0.03 |
proxy
|
phpinfo
|
Settings