proje-react-panel 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/list/CellField.d.ts +3 -2
- package/dist/components/list/cells/BooleanCell.d.ts +6 -0
- package/dist/components/list/cells/DateCell.d.ts +6 -0
- package/dist/components/list/cells/DefaultCell.d.ts +8 -0
- package/dist/components/list/cells/DownloadCell.d.ts +8 -0
- package/dist/components/list/cells/ImageCell.d.ts +8 -0
- package/dist/components/list/cells/UUIDCell.d.ts +6 -0
- package/dist/decorators/list/Cell.d.ts +4 -6
- package/dist/decorators/list/ExtendedCell.d.ts +10 -0
- package/dist/decorators/list/cells/DownloadCell.d.ts +9 -0
- package/dist/decorators/list/cells/ImageCell.d.ts +2 -2
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +1 -1
- package/dist/utils/decerators.d.ts +7 -0
- package/package.json +1 -1
- package/src/components/list/CellField.tsx +26 -42
- package/src/components/list/Datagrid.tsx +16 -9
- package/src/components/list/cells/BooleanCell.tsx +15 -0
- package/src/components/list/cells/DateCell.tsx +21 -0
- package/src/components/list/cells/DefaultCell.tsx +11 -0
- package/src/components/list/cells/DownloadCell.tsx +28 -0
- package/src/components/list/cells/ImageCell.tsx +22 -0
- package/src/components/list/cells/UUIDCell.tsx +11 -0
- package/src/decorators/list/Cell.ts +15 -33
- package/src/decorators/list/ExtendedCell.ts +32 -0
- package/src/decorators/list/cells/DownloadCell.ts +18 -0
- package/src/decorators/list/cells/ImageCell.ts +6 -5
- package/src/index.ts +1 -0
- package/src/styles/list.scss +1 -1
- package/src/utils/decerators.ts +24 -0
package/dist/index.esm.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
import{useParams as t,Link as e,useNavigate as n,useLocation as r}from"react-router";import*as a from"react";import o,{useMemo as i,useState as s,useEffect as c,useRef as l,useCallback as u,Component as p}from"react";import f from"react-select";import{useFormContext as d,Controller as h,get as m,set as y,useForm as v,FormProvider as g}from"react-hook-form";import{persist as E,createJSONStorage as b}from"zustand/middleware";import{createWithEqualityFn as w}from"zustand/traditional";import{shallow as O}from"zustand/vanilla/shallow";function S({error:t}){return o.createElement("div",{className:"error-container"},o.createElement("div",{className:"error-icon"},o.createElement("i",{className:"fa fa-exclamation-circle"})),o.createElement("div",{className:"error-content"},o.createElement("h3",null,"Error Occurred"),o.createElement("p",null,(t=>{if(t instanceof Response)switch(t.status){case 400:return"Bad Request: The request was invalid or malformed.";case 401:return"Unauthorized: Please log in to access this resource.";case 404:return"Not Found: The requested resource could not be found.";case 403:return"Forbidden: You don't have permission to access this resource.";case 500:return"Internal Server Error: Something went wrong on our end.";default:return`Error ${t.status}: ${t.statusText||"Something went wrong."}`}return t?.message||"Something went wrong. Please try again later."})(t))))}var _,M="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},x={};!function(){return _||(_=1,function(t){!function(){var e="object"==typeof globalThis?globalThis:"object"==typeof M?M:"object"==typeof self?self:"object"==typeof this?this:function(){try{return Function("return this;")()}catch(t){}}()||function(){try{return(0,eval)("(function() { return this; })()")}catch(t){}}(),n=r(t);function r(t,e){return function(n,r){Object.defineProperty(t,n,{configurable:!0,writable:!0,value:r}),e&&e(n,r)}}void 0!==e.Reflect&&(n=r(e.Reflect,n)),function(t,e){var n=Object.prototype.hasOwnProperty,r="function"==typeof Symbol,a=r&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",o=r&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",i="function"==typeof Object.create,s={__proto__:[]}instanceof Array,c=!i&&!s,l={create:i?function(){return pt(Object.create(null))}:s?function(){return pt({__proto__:null})}:function(){return pt({})},has:c?function(t,e){return n.call(t,e)}:function(t,e){return e in t},get:c?function(t,e){return n.call(t,e)?t[e]:void 0}:function(t,e){return t[e]}},u=Object.getPrototypeOf(Function),p="function"==typeof Map&&"function"==typeof Map.prototype.entries?Map:ct(),f="function"==typeof Set&&"function"==typeof Set.prototype.entries?Set:lt(),d="function"==typeof WeakMap?WeakMap:ut(),h=r?Symbol.for("@reflect-metadata:registry"):void 0,m=at(),y=ot(m);function v(t,e,n,r){if(D(n)){if(!K(t))throw new TypeError;if(!q(e))throw new TypeError;return N(t,e)}if(!K(t))throw new TypeError;if(!$(e))throw new TypeError;if(!$(r)&&!D(r)&&!F(r))throw new TypeError;return F(r)&&(r=void 0),T(t,e,n=W(n),r)}function g(t,e){function n(n,r){if(!$(n))throw new TypeError;if(!D(r)&&!J(r))throw new TypeError;P(t,e,n,r)}return n}function E(t,e,n,r){if(!$(n))throw new TypeError;return D(r)||(r=W(r)),P(t,e,n,r)}function b(t,e,n){if(!$(e))throw new TypeError;return D(n)||(n=W(n)),k(t,e,n)}function w(t,e,n){if(!$(e))throw new TypeError;return D(n)||(n=W(n)),A(t,e,n)}function O(t,e,n){if(!$(e))throw new TypeError;return D(n)||(n=W(n)),C(t,e,n)}function S(t,e,n){if(!$(e))throw new TypeError;return D(n)||(n=W(n)),L(t,e,n)}function _(t,e){if(!$(t))throw new TypeError;return D(e)||(e=W(e)),I(t,e)}function M(t,e){if(!$(t))throw new TypeError;return D(e)||(e=W(e)),j(t,e)}function x(t,e,n){if(!$(e))throw new TypeError;if(D(n)||(n=W(n)),!$(e))throw new TypeError;D(n)||(n=W(n));var r=st(e,n,!1);return!D(r)&&r.OrdinaryDeleteMetadata(t,e,n)}function N(t,e){for(var n=t.length-1;n>=0;--n){var r=(0,t[n])(e);if(!D(r)&&!F(r)){if(!q(r))throw new TypeError;e=r}}return e}function T(t,e,n,r){for(var a=t.length-1;a>=0;--a){var o=(0,t[a])(e,n,r);if(!D(o)&&!F(o)){if(!$(o))throw new TypeError;r=o}}return r}function k(t,e,n){if(A(t,e,n))return!0;var r=nt(e);return!F(r)&&k(t,r,n)}function A(t,e,n){var r=st(e,n,!1);return!D(r)&&H(r.OrdinaryHasOwnMetadata(t,e,n))}function C(t,e,n){if(A(t,e,n))return L(t,e,n);var r=nt(e);return F(r)?void 0:C(t,r,n)}function L(t,e,n){var r=st(e,n,!1);if(!D(r))return r.OrdinaryGetOwnMetadata(t,e,n)}function P(t,e,n,r){st(n,r,!0).OrdinaryDefineOwnMetadata(t,e,n,r)}function I(t,e){var n=j(t,e),r=nt(t);if(null===r)return n;var a=I(r,e);if(a.length<=0)return n;if(n.length<=0)return a;for(var o=new f,i=[],s=0,c=n;s<c.length;s++){var l=c[s];o.has(l)||(o.add(l),i.push(l))}for(var u=0,p=a;u<p.length;u++){l=p[u];o.has(l)||(o.add(l),i.push(l))}return i}function j(t,e){var n=st(t,e,!1);return n?n.OrdinaryOwnMetadataKeys(t,e):[]}function V(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}function D(t){return void 0===t}function F(t){return null===t}function R(t){return"symbol"==typeof t}function $(t){return"object"==typeof t?null!==t:"function"==typeof t}function z(t,e){switch(V(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}var n="string",r=Q(t,a);if(void 0!==r){var o=r.call(t,n);if($(o))throw new TypeError;return o}return B(t)}function B(t,e){var n,r,a=t.toString;if(G(a)&&!$(r=a.call(t)))return r;if(G(n=t.valueOf)&&!$(r=n.call(t)))return r;throw new TypeError}function H(t){return!!t}function U(t){return""+t}function W(t){var e=z(t);return R(e)?e:U(e)}function K(t){return Array.isArray?Array.isArray(t):t instanceof Object?t instanceof Array:"[object Array]"===Object.prototype.toString.call(t)}function G(t){return"function"==typeof t}function q(t){return"function"==typeof t}function J(t){switch(V(t)){case 3:case 4:return!0;default:return!1}}function Y(t,e){return t===e||t!=t&&e!=e}function Q(t,e){var n=t[e];if(null!=n){if(!G(n))throw new TypeError;return n}}function X(t){var e=Q(t,o);if(!G(e))throw new TypeError;var n=e.call(t);if(!$(n))throw new TypeError;return n}function Z(t){return t.value}function tt(t){var e=t.next();return!e.done&&e}function et(t){var e=t.return;e&&e.call(t)}function nt(t){var e=Object.getPrototypeOf(t);if("function"!=typeof t||t===u)return e;if(e!==u)return e;var n=t.prototype,r=n&&Object.getPrototypeOf(n);if(null==r||r===Object.prototype)return e;var a=r.constructor;return"function"!=typeof a||a===t?e:a}function rt(){var t,n,r,a;D(h)||void 0===e.Reflect||h in e.Reflect||"function"!=typeof e.Reflect.defineMetadata||(t=it(e.Reflect));var o=new d,i={registerProvider:s,getProvider:l,setProvider:m};return i;function s(e){if(!Object.isExtensible(i))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case t===e:break;case D(n):n=e;break;case n===e:break;case D(r):r=e;break;case r===e:break;default:void 0===a&&(a=new f),a.add(e)}}function c(e,o){if(!D(n)){if(n.isProviderFor(e,o))return n;if(!D(r)){if(r.isProviderFor(e,o))return n;if(!D(a))for(var i=X(a);;){var s=tt(i);if(!s)return;var c=Z(s);if(c.isProviderFor(e,o))return et(i),c}}}if(!D(t)&&t.isProviderFor(e,o))return t}function l(t,e){var n,r=o.get(t);return D(r)||(n=r.get(e)),D(n)?(D(n=c(t,e))||(D(r)&&(r=new p,o.set(t,r)),r.set(e,n)),n):n}function u(t){if(D(t))throw new TypeError;return n===t||r===t||!D(a)&&a.has(t)}function m(t,e,n){if(!u(n))throw new Error("Metadata provider not registered.");var r=l(t,e);if(r!==n){if(!D(r))return!1;var a=o.get(t);D(a)&&(a=new p,o.set(t,a)),a.set(e,n)}return!0}}function at(){var t;return!D(h)&&$(e.Reflect)&&Object.isExtensible(e.Reflect)&&(t=e.Reflect[h]),D(t)&&(t=rt()),!D(h)&&$(e.Reflect)&&Object.isExtensible(e.Reflect)&&Object.defineProperty(e.Reflect,h,{enumerable:!1,configurable:!1,writable:!1,value:t}),t}function ot(t){var e=new d,n={isProviderFor:function(t,n){var r=e.get(t);return!D(r)&&r.has(n)},OrdinaryDefineOwnMetadata:i,OrdinaryHasOwnMetadata:a,OrdinaryGetOwnMetadata:o,OrdinaryOwnMetadataKeys:s,OrdinaryDeleteMetadata:c};return m.registerProvider(n),n;function r(r,a,o){var i=e.get(r),s=!1;if(D(i)){if(!o)return;i=new p,e.set(r,i),s=!0}var c=i.get(a);if(D(c)){if(!o)return;if(c=new p,i.set(a,c),!t.setProvider(r,a,n))throw i.delete(a),s&&e.delete(r),new Error("Wrong provider for target.")}return c}function a(t,e,n){var a=r(e,n,!1);return!D(a)&&H(a.has(t))}function o(t,e,n){var a=r(e,n,!1);if(!D(a))return a.get(t)}function i(t,e,n,a){r(n,a,!0).set(t,e)}function s(t,e){var n=[],a=r(t,e,!1);if(D(a))return n;for(var o=X(a.keys()),i=0;;){var s=tt(o);if(!s)return n.length=i,n;var c=Z(s);try{n[i]=c}catch(t){try{et(o)}finally{throw t}}i++}}function c(t,n,a){var o=r(n,a,!1);if(D(o))return!1;if(!o.delete(t))return!1;if(0===o.size){var i=e.get(n);D(i)||(i.delete(a),0===i.size&&e.delete(i))}return!0}}function it(t){var e=t.defineMetadata,n=t.hasOwnMetadata,r=t.getOwnMetadata,a=t.getOwnMetadataKeys,o=t.deleteMetadata,i=new d;return{isProviderFor:function(t,e){var n=i.get(t);return!(D(n)||!n.has(e))||!!a(t,e).length&&(D(n)&&(n=new f,i.set(t,n)),n.add(e),!0)},OrdinaryDefineOwnMetadata:e,OrdinaryHasOwnMetadata:n,OrdinaryGetOwnMetadata:r,OrdinaryOwnMetadataKeys:a,OrdinaryDeleteMetadata:o}}function st(t,e,n){var r=m.getProvider(t,e);if(!D(r))return r;if(n){if(m.setProvider(t,e,y))return y;throw new Error("Illegal state.")}}function ct(){var t={},e=[],n=function(){function t(t,e,n){this._index=0,this._keys=t,this._values=e,this._selector=n}return t.prototype["@@iterator"]=function(){return this},t.prototype[o]=function(){return this},t.prototype.next=function(){var t=this._index;if(t>=0&&t<this._keys.length){var n=this._selector(this._keys[t],this._values[t]);return t+1>=this._keys.length?(this._index=-1,this._keys=e,this._values=e):this._index++,{value:n,done:!1}}return{value:void 0,done:!0}},t.prototype.throw=function(t){throw this._index>=0&&(this._index=-1,this._keys=e,this._values=e),t},t.prototype.return=function(t){return this._index>=0&&(this._index=-1,this._keys=e,this._values=e),{value:t,done:!0}},t}(),r=function(){function e(){this._keys=[],this._values=[],this._cacheKey=t,this._cacheIndex=-2}return Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),e.prototype.has=function(t){return this._find(t,!1)>=0},e.prototype.get=function(t){var e=this._find(t,!1);return e>=0?this._values[e]:void 0},e.prototype.set=function(t,e){var n=this._find(t,!0);return this._values[n]=e,this},e.prototype.delete=function(e){var n=this._find(e,!1);if(n>=0){for(var r=this._keys.length,a=n+1;a<r;a++)this._keys[a-1]=this._keys[a],this._values[a-1]=this._values[a];return this._keys.length--,this._values.length--,Y(e,this._cacheKey)&&(this._cacheKey=t,this._cacheIndex=-2),!0}return!1},e.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=t,this._cacheIndex=-2},e.prototype.keys=function(){return new n(this._keys,this._values,a)},e.prototype.values=function(){return new n(this._keys,this._values,i)},e.prototype.entries=function(){return new n(this._keys,this._values,s)},e.prototype["@@iterator"]=function(){return this.entries()},e.prototype[o]=function(){return this.entries()},e.prototype._find=function(t,e){if(!Y(this._cacheKey,t)){this._cacheIndex=-1;for(var n=0;n<this._keys.length;n++)if(Y(this._keys[n],t)){this._cacheIndex=n;break}}return this._cacheIndex<0&&e&&(this._cacheIndex=this._keys.length,this._keys.push(t),this._values.push(void 0)),this._cacheIndex},e}();return r;function a(t,e){return t}function i(t,e){return e}function s(t,e){return[t,e]}}function lt(){return function(){function t(){this._map=new p}return Object.defineProperty(t.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),t.prototype.has=function(t){return this._map.has(t)},t.prototype.add=function(t){return this._map.set(t,t),this},t.prototype.delete=function(t){return this._map.delete(t)},t.prototype.clear=function(){this._map.clear()},t.prototype.keys=function(){return this._map.keys()},t.prototype.values=function(){return this._map.keys()},t.prototype.entries=function(){return this._map.entries()},t.prototype["@@iterator"]=function(){return this.keys()},t.prototype[o]=function(){return this.keys()},t}()}function ut(){var t=16,e=l.create(),r=a();return function(){function t(){this._key=a()}return t.prototype.has=function(t){var e=o(t,!1);return void 0!==e&&l.has(e,this._key)},t.prototype.get=function(t){var e=o(t,!1);return void 0!==e?l.get(e,this._key):void 0},t.prototype.set=function(t,e){return o(t,!0)[this._key]=e,this},t.prototype.delete=function(t){var e=o(t,!1);return void 0!==e&&delete e[this._key]},t.prototype.clear=function(){this._key=a()},t}();function a(){var t;do{t="@@WeakMap@@"+c()}while(l.has(e,t));return e[t]=!0,t}function o(t,e){if(!n.call(t,r)){if(!e)return;Object.defineProperty(t,r,{value:l.create()})}return t[r]}function i(t,e){for(var n=0;n<e;++n)t[n]=255*Math.random()|0;return t}function s(t){if("function"==typeof Uint8Array){var e=new Uint8Array(t);return"undefined"!=typeof crypto?crypto.getRandomValues(e):"undefined"!=typeof msCrypto?msCrypto.getRandomValues(e):i(e,t),e}return i(new Array(t),t)}function c(){var e=s(t);e[6]=79&e[6]|64,e[8]=191&e[8]|128;for(var n="",r=0;r<t;++r){var a=e[r];4!==r&&6!==r&&8!==r||(n+="-"),a<16&&(n+="0"),n+=a.toString(16).toLowerCase()}return n}}function pt(t){return t.__=void 0,delete t.__,t}t("decorate",v),t("metadata",g),t("defineMetadata",E),t("hasMetadata",b),t("hasOwnMetadata",w),t("getMetadata",O),t("getOwnMetadata",S),t("getMetadataKeys",_),t("getOwnMetadataKeys",M),t("deleteMetadata",x)}(n,e),void 0===e.Reflect&&(e.Reflect=t)}()}(t||(t={}))),x;var t}();const N=Symbol("detailsItem");function T(t){return(e,n)=>{const r=Reflect.getMetadata(N,e)||[];if(Reflect.defineMetadata(N,[...r,n.toString()],e),t){const r=`${N.toString()}:${n.toString()}:options`;Reflect.defineMetadata(r,t,e)}}}function k(t){const e=t.prototype;return(Reflect.getMetadata(N,e)||[]).map((t=>{const n=Reflect.getMetadata(`${N.toString()}:${t}:options`,e)||{};return{...n,name:n.name||t}}))}const A="DetailsMetaData";function C(t){return e=>{t&&Reflect.defineMetadata(A,t,e)}}function L(t){const e=Reflect.getMetadata(A,t);if(!e)throw new Error("Details decerator should be used on class");return{...e}}function P(){return o.createElement("div",{className:"loading-screen"},o.createElement("div",{className:"loading-container"},o.createElement("div",{className:"loading-spinner"}),o.createElement("div",{className:"loading-text"},"Loading...")))}function I({model:e}){const{class:n,items:r}=i((()=>{return{class:L(t=e),items:k(t)};var t}),[e]),a=t(),[l,u]=s(null),[p,f]=s(null),[d,h]=s(!0);return c((()=>{n.getDetailsData(a).then((t=>{u(t)})).catch(f).finally((()=>h(!1)))}),[a,n?.getDetailsData]),p?o.createElement("div",{className:"error-container"},o.createElement(S,{error:p})):d?o.createElement("div",{className:"loading-container"},o.createElement(P,null)):o.createElement("div",{className:"details-page"},r.map((t=>o.createElement("div",{key:t.name,className:"details-item"},o.createElement("div",{className:"item-label"},t.name),o.createElement("div",{className:"item-value"},l[t.name])))))}const j=()=>o.createElement("div",{className:"empty-list"},o.createElement("div",{className:"empty-list-content"},o.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"64",height:"64",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o.createElement("path",{d:"M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"}),o.createElement("polyline",{points:"13 2 13 9 20 9"})),o.createElement("h3",null,"No Data Found"),o.createElement("p",null,"There are no items to display at the moment.")));var V,D;function F(){return F=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},F.apply(null,arguments)}var R,$,z=function(t){return a.createElement("svg",F({xmlns:"http://www.w3.org/2000/svg",width:800,height:800,viewBox:"0 0 24 24"},t),V||(V=a.createElement("path",{fill:"none",d:"M0 0h24v24H0z"})),D||(D=a.createElement("path",{d:"m21 19-5.154-5.154a7 7 0 1 0-2 2L19 21zM5 10c0-2.757 2.243-5 5-5s5 2.243 5 5-2.243 5-5 5-5-2.243-5-5"})))};function B(){return B=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},B.apply(null,arguments)}var H,U,W=function(t){return a.createElement("svg",B({xmlns:"http://www.w3.org/2000/svg",width:800,height:800,viewBox:"0 0 24 24"},t),R||(R=a.createElement("path",{fill:"none",d:"M0 0h24v24H0z"})),$||($=a.createElement("path",{d:"m13 6 5 5-9.507 9.507a1.765 1.765 0 0 1-.012-2.485l-.002-.003c-.69.676-1.8.673-2.485-.013a1.763 1.763 0 0 1-.036-2.455l-.008-.008c-.694.65-1.78.64-2.456-.036zm7.586-.414-2.172-2.172a2 2 0 0 0-2.828 0L14 5l5 5 1.586-1.586c.78-.78.78-2.047 0-2.828M3 18v3h3a3 3 0 0 0-3-3"})))};function K(){return K=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},K.apply(null,arguments)}var G,q=function(t){return a.createElement("svg",K({xmlns:"http://www.w3.org/2000/svg",width:800,height:800,viewBox:"0 0 24 24"},t),H||(H=a.createElement("path",{fill:"none",d:"M0 0h24v24H0z"})),U||(U=a.createElement("path",{d:"M6.187 8h11.625l-.695 11.125A2 2 0 0 1 15.12 21H8.88a2 2 0 0 1-1.997-1.875zM19 5v2H5V5h3V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v1zm-9 0h4V4h-4z"})))};function J(){return J=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},J.apply(null,arguments)}var Y,Q=function(t){return a.createElement("svg",J({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",stroke:"#000"},t),G||(G=a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 6 9 17l-5-5"})))};function X(){return X=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},X.apply(null,arguments)}var Z,tt,et,nt=function(t){return a.createElement("svg",X({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",stroke:"#000"},t),Y||(Y=a.createElement("path",{strokeLinecap:"round",strokeWidth:2,d:"m8 8 8 8m-8 0 8-8"})))};function rt({cellOptions:t,item:e,value:n}){let r=n??"-";switch(t.type){case"boolean":r=n?o.createElement(Q,{className:"icon icon-true"}):o.createElement(nt,{className:"icon icon-false"});break;case"date":if(n){const t=new Date(n);r=`${t.getDate().toString().padStart(2,"0")}/${(t.getMonth()+1).toString().padStart(2,"0")}/${t.getFullYear()} ${t.getHours().toString().padStart(2,"0")}:${t.getMinutes().toString().padStart(2,"0")}`}break;case"image":{const e=t;r=o.createElement("img",{width:100,height:100,src:e.baseUrl+n,style:{objectFit:"contain"}});break}case"uuid":n&&"string"==typeof n&&n.length>=6&&(r=`${n.slice(0,3)}...${n.slice(-3)}`);break;default:r=n?n.toString():t?.placeHolder??"-"}return o.createElement("td",{key:t.name},r)}function at({data:t,listPageMeta:n,onRemoveItem:r}){const a=n.cells,i=t?.[0]?"function"==typeof n.class.cells?n.class.cells?.(t[0]):n.class.cells:null;return o.createElement("div",{className:"datagrid"},t&&0!==t.length?o.createElement("table",{className:"datagrid-table"},o.createElement("thead",null,o.createElement("tr",null,a.map((t=>o.createElement("th",{key:t.name},t.title??t.name))),i?.details&&o.createElement("th",null,"Details"),i?.edit&&o.createElement("th",null,"Edit"),i?.delete&&o.createElement("th",null,"Delete"))),o.createElement("tbody",null,t.map(((t,i)=>{const s=t?"function"==typeof n.class.cells?n.class.cells?.(t):n.class.cells:null;return o.createElement("tr",{key:i},a.map((e=>{const n=t[e.name];return o.createElement(rt,{key:e.name,cellOptions:e,item:t,value:n})})),s?.details&&o.createElement("td",null,o.createElement(e,{to:s.details.path,className:"util-cell-link"},o.createElement(z,{className:"icon icon-search"}),o.createElement("span",{className:"util-cell-label"},s.details.label))),s?.edit&&o.createElement("td",null,o.createElement(e,{to:s.edit.path,className:"util-cell-link"},o.createElement(W,{className:"icon icon-pencil"}),o.createElement("span",{className:"util-cell-label"},s.edit.label))),s?.delete&&o.createElement("td",null,o.createElement("a",{onClick:()=>{s.delete?.onRemoveItem?.(t).then((()=>{r?.(t)}))},className:"util-cell-link util-cell-link-remove"},o.createElement(q,{className:"icon icon-trash"}),o.createElement("span",{className:"util-cell-label"},s.delete.label))))})))):o.createElement(j,null))}function ot({pagination:t,onPageChange:e}){const{total:n,page:r,limit:a}=t,i=Math.floor(n/a);if(i<=1)return null;return o.createElement("div",{className:"pagination"},o.createElement("button",{onClick:()=>e(r-1),className:"pagination-item "+(1===r?"disabled":""),disabled:1===r,"aria-disabled":1===r},"Previous"),(()=>{const t=[];for(let n=1;n<=Math.min(2,i);n++)t.push(o.createElement("button",{key:n,onClick:()=>e(n),className:"pagination-item "+(r===n?"active":""),disabled:r===n},n));r-2>3&&t.push(o.createElement("span",{key:"ellipsis1",className:"pagination-ellipsis"},"..."));for(let n=Math.max(3,r-2);n<=Math.min(i-2,r+2);n++)n>2&&n<i-1&&t.push(o.createElement("button",{key:n,onClick:()=>e(n),className:"pagination-item "+(r===n?"active":""),disabled:r===n},n));r+2<i-2&&t.push(o.createElement("span",{key:"ellipsis2",className:"pagination-ellipsis"},"..."));for(let n=Math.max(i-1,3);n<=i;n++)n>2&&t.push(o.createElement("button",{key:n,onClick:()=>e(n),className:"pagination-item "+(r===n?"active":""),disabled:r===n},n));return t})(),o.createElement("button",{onClick:()=>e(r+1),className:"pagination-item "+(r===i?"disabled":""),disabled:r===i,"aria-disabled":r===i},"Next"))}function it(){return it=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},it.apply(null,arguments)}var st,ct=function(t){return a.createElement("svg",it({xmlns:"http://www.w3.org/2000/svg",width:800,height:800,viewBox:"0 0 24 24"},t),Z||(Z=a.createElement("path",{fill:"none",d:"M0 0h24v24H0z"})),tt||(tt=a.createElement("path",{d:"M21 14v5a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5v2H5v14h14v-5z"})),et||(et=a.createElement("path",{d:"M21 7h-4V3h-2v4h-4v2h4v4h2V9h4"})))};function lt(){return lt=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},lt.apply(null,arguments)}var ut=function(t){return a.createElement("svg",lt({xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},t),st||(st=a.createElement("path",{d:"M22 3H2l8 9.46V19l4 2v-8.54z"})))};function pt({listPageMeta:t,filtered:n,onFilterClick:r,customHeader:a}){const s=i((()=>t.cells.filter((t=>!!t.filter))),[t.cells]),c=t.class.headers;return o.createElement("div",{className:"list-header"},o.createElement("div",{className:"header-title"},c?.title||"List"),a&&o.createElement("div",{className:"header-custom"},a),o.createElement("div",{className:"header-actions"},!!s.length&&o.createElement("button",{onClick:r,className:"filter-button"},o.createElement(ut,{className:"icon icon-filter "+(n?"active":"")}),"Filter"),c?.create&&o.createElement(e,{to:c.create.path,className:"create-button"},o.createElement(ct,{className:"icon icon-create"}),c.create.label)))}function ft({field:t,value:e,onChange:n}){if("static-select"===t.filter?.type){const r=t.filter;return o.createElement(f,{id:t.name,menuPortalTarget:document.body,styles:{control:(t,e)=>({...t,backgroundColor:"#1f2937",borderColor:e.isFocused?"#6366f1":"#374151",boxShadow:e.isFocused?"0 0 0 1px #6366f1":"none","&:hover":{borderColor:"#6366f1"},borderRadius:"6px",padding:"2px",color:"white"}),option:(t,e)=>({...t,backgroundColor:e.isSelected?"#6366f1":e.isFocused?"#374151":"#1f2937",color:"white","&:active":{backgroundColor:"#6366f1"},"&:hover":{backgroundColor:"#374151"},cursor:"pointer"}),input:t=>({...t,color:"white"}),placeholder:t=>({...t,color:"#9ca3af"}),singleValue:t=>({...t,color:"white"}),menuPortal:t=>({...t,zIndex:9999}),menu:t=>({...t,backgroundColor:"#1f2937",border:"1px solid #374151",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)"}),menuList:t=>({...t,padding:"4px"}),dropdownIndicator:t=>({...t,color:"#9ca3af","&:hover":{color:"#6366f1"}}),clearIndicator:t=>({...t,color:"#9ca3af","&:hover":{color:"#6366f1"}})},value:e?{value:e,label:r.options.find((t=>t.value===e))?.label||e}:null,onChange:t=>n(t?.value||""),options:r.options.map((t=>({value:t.value,label:t.label}))),placeholder:`Filter by ${t.title||t.name}`,isClearable:!0})}return o.createElement("input",{type:"number"===t.type?"number":"text",id:t.name,value:e||"",onChange:t=>n(t.target.value),placeholder:`Filter by ${t.title||t.name}`})}function dt({isOpen:t,onClose:e,onApplyFilters:n,listPageMeta:r,activeFilters:a}){const[s,u]=o.useState(a??{}),p=l(null),f=i((()=>r.cells.filter((t=>!!t.filter))),[r.cells]);if(c((()=>{const n=t=>{p.current&&!p.current.contains(t.target)&&e()};return t&&document.addEventListener("mousedown",n),()=>{document.removeEventListener("mousedown",n)}}),[t,e]),!t)return null;return o.createElement("div",{className:"filter-popup-overlay"},o.createElement("div",{ref:p,className:"filter-popup"},o.createElement("div",{className:"filter-popup-header"},o.createElement("h3",null,"Filter"),o.createElement("button",{onClick:e,className:"close-button"},"×")),o.createElement("div",{className:"filter-popup-content"},f.map((t=>o.createElement("div",{key:t.name,className:"filter-field"},o.createElement("label",{htmlFor:t.name},t.title||t.name),o.createElement(ft,{field:t,value:s[t.name||""],onChange:e=>((t,e)=>{u((n=>({...n,[t]:e})))})(t.name||"",e)}))))),o.createElement("div",{className:"filter-popup-footer"},o.createElement("button",{onClick:e,className:"cancel-button"},"Cancel"),o.createElement("button",{onClick:()=>{n(s),e()},className:"apply-button"},"Apply Filters"))))}const ht=Symbol("cell");function mt(t){return(e,n)=>{const r=Reflect.getMetadata(ht,e)||[];if(Reflect.defineMetadata(ht,[...r,n.toString()],e),t){const r=`${ht.toString()}:${n.toString()}:options`;Reflect.defineMetadata(r,t,e)}}}function yt(t){const e=t.prototype;return(Reflect.getMetadata(ht,e)||[]).map((t=>{const n=Reflect.getMetadata(`${ht.toString()}:${t}:options`,e)||{};return{...n,name:n.name||t,type:n.type}}))}const vt="ListMetaData";function gt(t){return e=>{t&&Reflect.defineMetadata(vt,t,e)}}function Et(t){const e=Reflect.getMetadata(vt,t);if(!e)throw new Error("List decerator should be used on class");return{...e}}function bt({model:e,customHeader:r}){const a=i((()=>{return{class:Et(t=e),cells:yt(t)};var t}),[e]),[l,p]=s(!0),[f,d]=s(null),[h,m]=s(null),[y,v]=s({total:0,page:0,limit:0}),[g,E]=s(!1),[b,w]=s(),O=t(),_=n(),M=u((async(t,e)=>{p(!0);try{const n=await a.class.getData({page:t,filters:e??b??{}});d(n.data),v({total:n.total,page:n.page,limit:n.limit})}catch(t){m(t),console.error(t)}finally{p(!1)}}),[b,a.class.getData]);c((()=>{const t=new URLSearchParams(location.search),e={};t.forEach(((t,n)=>{e[n]=t})),w(e)}),[location.search]),c((()=>{b&&M(parseInt(O.page)||1,b)}),[M,O.page,b,a.class.getData]);return l?o.createElement(P,null):h?o.createElement(S,{error:h}):o.createElement("div",{className:"list"},o.createElement(pt,{listPageMeta:a,filtered:!(!b||!Object.keys(b).length),onFilterClick:()=>E(!0),customHeader:r}),o.createElement(at,{listPageMeta:a,data:f,onRemoveItem:async()=>{await M(y.page)}}),o.createElement("div",{className:"list-footer"},o.createElement(ot,{pagination:y,onPageChange:M})),o.createElement(dt,{isOpen:g,activeFilters:b,onClose:()=>E(!1),onApplyFilters:t=>{w(t);const e=new URLSearchParams;Object.entries(t).forEach((([t,n])=>{null!=n&&""!==n&&e.append(t,String(n))}));const n=e.toString(),r=`${location.pathname}${n?`?${n}`:""}`;_(r),M(1,t)},listPageMeta:a}))}function wt(t){return function(t){return(e,n)=>{const r=Reflect.getMetadata(ht,e)||[];if(Reflect.defineMetadata(ht,[...r,n.toString()],e),t){const r=`${ht.toString()}:${n.toString()}:options`;Reflect.defineMetadata(r,t,e)}}}({...t,type:"image"})}function Ot({input:t,maxLength:e=1}){const n=d(),[r,a]=s([]),i=t.name;c((()=>{n.setValue(t.name+"_files",r.length>0)}),[r,n,t.name]);return o.createElement("div",{className:"uploader-container"},o.createElement("button",{type:"button",className:"uploader-button",onClick:()=>document.getElementById(i)?.click()},"Upload Files"),o.createElement("input",{id:i,hidden:!0,name:t.name,onChange:t=>{if(e>1)throw new Error("TODO: Multiple file upload is not implemented yet");const n=t.target.files;if(n){const t=Array.from(n);a((e=>[...e,...t]))}},type:"file",multiple:!0}),r.length>0&&o.createElement("div",{className:"uploader-files"},r.map(((t,e)=>o.createElement("div",{key:`${t.name}-${e}`,className:"uploader-file"},o.createElement("p",null,t.name),o.createElement("p",null,(t.size/1024/1024).toFixed(2)," MB"),o.createElement("p",null,t.type||"Unknown type"),o.createElement("button",{onClick:()=>(t=>{a((e=>e.filter(((e,n)=>n!==t))))})(e),className:"remove-file-button",type:"button"},"Remove"))))))}function St({label:t,fieldName:e,children:n,...r}){return o.createElement("label",{...r,className:"label "+r.className},o.createElement("span",null,t?t+":":e.charAt(0).toUpperCase()+e.slice(1)+":"),n)}function _t({input:t,...e}){const{label:n,name:r}=t,a=d(),{register:i}=a;return o.createElement(St,{className:"checkbox-label",htmlFor:r,label:n,fieldName:r},o.createElement("input",{type:"checkbox",id:r,className:"apple-switch",...e,...i(r)}))}const Mt={control:(t,e)=>({...t,backgroundColor:"#1f2937",borderColor:e.isFocused?"#6366f1":"#374151",boxShadow:e.isFocused?"0 0 0 1px #6366f1":"none","&:hover":{borderColor:"#6366f1"},borderRadius:"6px",padding:"2px",color:"white"}),option:(t,e)=>({...t,backgroundColor:e.isSelected?"#6366f1":e.isFocused?"#374151":"#1f2937",color:"white","&:active":{backgroundColor:"#6366f1"},"&:hover":{backgroundColor:"#374151"},cursor:"pointer"}),input:t=>({...t,color:"white"}),placeholder:t=>({...t,color:"#9ca3af"}),singleValue:t=>({...t,color:"white"}),menuPortal:t=>({...t,zIndex:9999}),menu:t=>({...t,backgroundColor:"#1f2937",border:"1px solid #374151",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)"}),menuList:t=>({...t,padding:"4px"}),dropdownIndicator:t=>({...t,color:"#9ca3af","&:hover":{color:"#6366f1"}}),clearIndicator:t=>({...t,color:"#9ca3af","&:hover":{color:"#6366f1"}})};function xt({input:t,fieldName:e}){const n=t,{control:r}=d(),[a,i]=s(n.defaultOptions||[]),[l,u]=s(0);return c((()=>{n.onSelectPreloader&&n.onSelectPreloader().then((t=>{i(t),u(l+1)}))}),[t]),o.createElement(h,{name:e,control:r,render:({field:t})=>o.createElement(f,{key:l,options:a,styles:Mt,value:a.find((e=>e.value===t.value))||null,onChange:e=>{t.onChange(e?.value)}})})}function Nt({input:t,register:e}){const n=d(),r=n.getValues(t.name);return o.createElement("div",null,r?.map(((r,a)=>o.createElement("div",{key:a},t.nestedFields?.map((r=>o.createElement(Tt,{key:r.name?.toString()??"",baseName:t.name+"["+a+"]",input:r,register:e,error:t.name?{message:n.formState.errors[t.name]?.message}:void 0})))))))}function Tt({input:t,register:e,error:n,baseName:r,onSelectPreloader:a}){const i=(r?r.toString()+".":"")+t.name||"";return o.createElement("div",{className:"form-field"},"checkbox"!==t.type&&o.createElement(St,{htmlFor:i,label:t.label,fieldName:i}),(()=>{switch(t.type){case"textarea":return o.createElement("textarea",{...e(i),placeholder:t.placeholder});case"select":return o.createElement(xt,{input:t,fieldName:i});case"input":return o.createElement("input",{type:t.inputType,...e(i),placeholder:t.placeholder});case"file-upload":return o.createElement(Ot,{input:t});case"checkbox":return o.createElement(_t,{input:t});case"hidden":return o.createElement("input",{type:"hidden",...e(i)});case"nested":return o.createElement(Nt,{input:t,register:e})}})(),n&&o.createElement("span",{className:"error-message"},n.message))}function kt({inputs:t,formClass:e}){const[r,a]=s(null),i=l(null),c=n(),u=d();return o.createElement("div",{className:"form-wrapper"},o.createElement("form",{ref:i,onSubmit:u.handleSubmit((async t=>{try{const n="json"===e.type?t:(()=>{const e=new FormData(i.current);for(const n in t)e.get(n)||e.append(n,t[n]);return e})();await e.onSubmit(n),a(null),e.redirectBackOnSuccess&&c(-1)}catch(t){const e=t?.response?.data?.message||(t instanceof Error?t.message:"An error occurred");a(e),console.error(t)}}),((t,e)=>{console.log("error creating creation",t,e)}))},o.createElement("div",null,r&&o.createElement("div",{className:"error-message",style:{color:"red",marginBottom:"1rem"}},r),t?.map((t=>o.createElement(Tt,{key:t.name||"",input:t,register:u.register,error:t.name?{message:u.formState.errors[t.name]?.message}:void 0}))),o.createElement("button",{type:"submit",className:"submit-button"},"Submit"))))}const At=Symbol("input");function Ct(t){return(e,n)=>{const r=Reflect.getMetadata(At,e)||[];if(Reflect.defineMetadata(At,[...r,n.toString()],e),t){const r=`${At.toString()}:${n.toString()}:options`;Reflect.defineMetadata(r,t,e)}}}function Lt(t){const e=t.prototype;return(Reflect.getMetadata(At,e)||[]).map((t=>{const n=Reflect.getMetadata(`${At.toString()}:${t}:options`,e)||{},r=n?.inputType??(a=t,["password"].some((t=>a.toLowerCase().includes(t)))?"password":"text");var a;return{...n,editable:n.editable??!0,sensitive:n.sensitive,name:n?.name??t,label:n?.label??t,placeholder:n?.placeholder??t,inputType:r,type:n?.type??"input",selectOptions:n?.selectOptions??[]}}))}const Pt="DetailsMetaData";function It(t){return e=>{t&&Reflect.defineMetadata(Pt,t,e)}}function jt(t){const e=Reflect.getMetadata(Pt,t);if(!e)throw new Error("Form decerator should be used on class");return{...e,type:e.type??"json",redirectBackOnSuccess:e.redirectBackOnSuccess??!0}}const Vt=(t,e,n)=>{if(t&&"reportValidity"in t){const r=m(n,e);t.setCustomValidity(r&&r.message||""),t.reportValidity()}},Dt=(t,e)=>{for(const n in e.fields){const r=e.fields[n];r&&r.ref&&"reportValidity"in r.ref?Vt(r.ref,n,t):r&&r.refs&&r.refs.forEach((e=>Vt(e,n,t)))}},Ft=(t,e)=>{e.shouldUseNativeValidation&&Dt(t,e);const n={};for(const r in t){const a=m(e.fields,r),o=Object.assign(t[r]||{},{ref:a&&a.ref});if(Rt(e.names||Object.keys(t),r)){const t=Object.assign({},m(n,r));y(t,"root",o),y(n,r,t)}else y(n,r,o)}return n},Rt=(t,e)=>{const n=$t(e);return t.some((t=>$t(t).match(`^${n}\\.\\d+`)))};function $t(t){return t.replace(/\]|\[/g,"")}var zt;!function(t){t[t.PLAIN_TO_CLASS=0]="PLAIN_TO_CLASS",t[t.CLASS_TO_PLAIN=1]="CLASS_TO_PLAIN",t[t.CLASS_TO_CLASS=2]="CLASS_TO_CLASS"}(zt||(zt={}));var Bt=function(){function t(){this._typeMetadatas=new Map,this._transformMetadatas=new Map,this._exposeMetadatas=new Map,this._excludeMetadatas=new Map,this._ancestorsMap=new Map}return t.prototype.addTypeMetadata=function(t){this._typeMetadatas.has(t.target)||this._typeMetadatas.set(t.target,new Map),this._typeMetadatas.get(t.target).set(t.propertyName,t)},t.prototype.addTransformMetadata=function(t){this._transformMetadatas.has(t.target)||this._transformMetadatas.set(t.target,new Map),this._transformMetadatas.get(t.target).has(t.propertyName)||this._transformMetadatas.get(t.target).set(t.propertyName,[]),this._transformMetadatas.get(t.target).get(t.propertyName).push(t)},t.prototype.addExposeMetadata=function(t){this._exposeMetadatas.has(t.target)||this._exposeMetadatas.set(t.target,new Map),this._exposeMetadatas.get(t.target).set(t.propertyName,t)},t.prototype.addExcludeMetadata=function(t){this._excludeMetadatas.has(t.target)||this._excludeMetadatas.set(t.target,new Map),this._excludeMetadatas.get(t.target).set(t.propertyName,t)},t.prototype.findTransformMetadatas=function(t,e,n){return this.findMetadatas(this._transformMetadatas,t,e).filter((function(t){return!t.options||(!0===t.options.toClassOnly&&!0===t.options.toPlainOnly||(!0===t.options.toClassOnly?n===zt.CLASS_TO_CLASS||n===zt.PLAIN_TO_CLASS:!0!==t.options.toPlainOnly||n===zt.CLASS_TO_PLAIN))}))},t.prototype.findExcludeMetadata=function(t,e){return this.findMetadata(this._excludeMetadatas,t,e)},t.prototype.findExposeMetadata=function(t,e){return this.findMetadata(this._exposeMetadatas,t,e)},t.prototype.findExposeMetadataByCustomName=function(t,e){return this.getExposedMetadatas(t).find((function(t){return t.options&&t.options.name===e}))},t.prototype.findTypeMetadata=function(t,e){return this.findMetadata(this._typeMetadatas,t,e)},t.prototype.getStrategy=function(t){var e=this._excludeMetadatas.get(t),n=e&&e.get(void 0),r=this._exposeMetadatas.get(t),a=r&&r.get(void 0);return n&&a||!n&&!a?"none":n?"excludeAll":"exposeAll"},t.prototype.getExposedMetadatas=function(t){return this.getMetadata(this._exposeMetadatas,t)},t.prototype.getExcludedMetadatas=function(t){return this.getMetadata(this._excludeMetadatas,t)},t.prototype.getExposedProperties=function(t,e){return this.getExposedMetadatas(t).filter((function(t){return!t.options||(!0===t.options.toClassOnly&&!0===t.options.toPlainOnly||(!0===t.options.toClassOnly?e===zt.CLASS_TO_CLASS||e===zt.PLAIN_TO_CLASS:!0!==t.options.toPlainOnly||e===zt.CLASS_TO_PLAIN))})).map((function(t){return t.propertyName}))},t.prototype.getExcludedProperties=function(t,e){return this.getExcludedMetadatas(t).filter((function(t){return!t.options||(!0===t.options.toClassOnly&&!0===t.options.toPlainOnly||(!0===t.options.toClassOnly?e===zt.CLASS_TO_CLASS||e===zt.PLAIN_TO_CLASS:!0!==t.options.toPlainOnly||e===zt.CLASS_TO_PLAIN))})).map((function(t){return t.propertyName}))},t.prototype.clear=function(){this._typeMetadatas.clear(),this._exposeMetadatas.clear(),this._excludeMetadatas.clear(),this._ancestorsMap.clear()},t.prototype.getMetadata=function(t,e){var n,r=t.get(e);r&&(n=Array.from(r.values()).filter((function(t){return void 0!==t.propertyName})));for(var a=[],o=0,i=this.getAncestors(e);o<i.length;o++){var s=i[o],c=t.get(s);if(c){var l=Array.from(c.values()).filter((function(t){return void 0!==t.propertyName}));a.push.apply(a,l)}}return a.concat(n||[])},t.prototype.findMetadata=function(t,e,n){var r=t.get(e);if(r){var a=r.get(n);if(a)return a}for(var o=0,i=this.getAncestors(e);o<i.length;o++){var s=i[o],c=t.get(s);if(c){var l=c.get(n);if(l)return l}}},t.prototype.findMetadatas=function(t,e,n){var r,a=t.get(e);a&&(r=a.get(n));for(var o=[],i=0,s=this.getAncestors(e);i<s.length;i++){var c=s[i],l=t.get(c);l&&l.has(n)&&o.push.apply(o,l.get(n))}return o.slice().reverse().concat((r||[]).slice().reverse())},t.prototype.getAncestors=function(t){if(!t)return[];if(!this._ancestorsMap.has(t)){for(var e=[],n=Object.getPrototypeOf(t.prototype.constructor);void 0!==n.prototype;n=Object.getPrototypeOf(n.prototype.constructor))e.push(n);this._ancestorsMap.set(t,e)}return this._ancestorsMap.get(t)},t}(),Ht=new Bt;var Ut=function(t,e,n){if(n||2===arguments.length)for(var r,a=0,o=e.length;a<o;a++)!r&&a in e||(r||(r=Array.prototype.slice.call(e,0,a)),r[a]=e[a]);return t.concat(r||Array.prototype.slice.call(e))};var Wt=function(){function t(t,e){this.transformationType=t,this.options=e,this.recursionStack=new Set}return t.prototype.transform=function(t,e,n,r,a,o){var i,s=this;if(void 0===o&&(o=0),Array.isArray(e)||e instanceof Set){var c=r&&this.transformationType===zt.PLAIN_TO_CLASS?function(t){var e=new t;return e instanceof Set||"push"in e?e:[]}(r):[];return e.forEach((function(e,r){var a=t?t[r]:void 0;if(s.options.enableCircularCheck&&s.isCircular(e))s.transformationType===zt.CLASS_TO_CLASS&&(c instanceof Set?c.add(e):c.push(e));else{var i=void 0;if("function"!=typeof n&&n&&n.options&&n.options.discriminator&&n.options.discriminator.property&&n.options.discriminator.subTypes){if(s.transformationType===zt.PLAIN_TO_CLASS){i=n.options.discriminator.subTypes.find((function(t){return t.name===e[n.options.discriminator.property]}));var l={newObject:c,object:e,property:void 0},u=n.typeFunction(l);i=void 0===i?u:i.value,n.options.keepDiscriminatorProperty||delete e[n.options.discriminator.property]}s.transformationType===zt.CLASS_TO_CLASS&&(i=e.constructor),s.transformationType===zt.CLASS_TO_PLAIN&&(e[n.options.discriminator.property]=n.options.discriminator.subTypes.find((function(t){return t.value===e.constructor})).name)}else i=n;var p=s.transform(a,e,i,void 0,e instanceof Map,o+1);c instanceof Set?c.add(p):c.push(p)}})),c}if(n!==String||a){if(n!==Number||a){if(n!==Boolean||a){if((n===Date||e instanceof Date)&&!a)return e instanceof Date?new Date(e.valueOf()):null==e?e:new Date(e);if(("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:void 0).Buffer&&(n===Buffer||e instanceof Buffer)&&!a)return null==e?e:Buffer.from(e);if(null===(i=e)||"object"!=typeof i||"function"!=typeof i.then||a){if(a||null===e||"object"!=typeof e||"function"!=typeof e.then){if("object"==typeof e&&null!==e){n||e.constructor===Object||(Array.isArray(e)||e.constructor!==Array)&&(n=e.constructor),!n&&t&&(n=t.constructor),this.options.enableCircularCheck&&this.recursionStack.add(e);var l=this.getKeys(n,e,a),u=t||{};t||this.transformationType!==zt.PLAIN_TO_CLASS&&this.transformationType!==zt.CLASS_TO_CLASS||(u=a?new Map:n?new n:{});for(var p=function(r){if("__proto__"===r||"constructor"===r)return"continue";var i=r,s=r,c=r;if(!f.options.ignoreDecorators&&n)if(f.transformationType===zt.PLAIN_TO_CLASS)(l=Ht.findExposeMetadataByCustomName(n,r))&&(c=l.propertyName,s=l.propertyName);else if(f.transformationType===zt.CLASS_TO_PLAIN||f.transformationType===zt.CLASS_TO_CLASS){var l;(l=Ht.findExposeMetadata(n,r))&&l.options&&l.options.name&&(s=l.options.name)}var p=void 0;p=f.transformationType===zt.PLAIN_TO_CLASS?e[i]:e instanceof Map?e.get(i):e[i]instanceof Function?e[i]():e[i];var d=void 0,h=p instanceof Map;if(n&&a)d=n;else if(n){var m=Ht.findTypeMetadata(n,c);if(m){var y={newObject:u,object:e,property:c},v=m.typeFunction?m.typeFunction(y):m.reflectedType;m.options&&m.options.discriminator&&m.options.discriminator.property&&m.options.discriminator.subTypes?e[i]instanceof Array?d=m:(f.transformationType===zt.PLAIN_TO_CLASS&&(d=void 0===(d=m.options.discriminator.subTypes.find((function(t){if(p&&p instanceof Object&&m.options.discriminator.property in p)return t.name===p[m.options.discriminator.property]})))?v:d.value,m.options.keepDiscriminatorProperty||p&&p instanceof Object&&m.options.discriminator.property in p&&delete p[m.options.discriminator.property]),f.transformationType===zt.CLASS_TO_CLASS&&(d=p.constructor),f.transformationType===zt.CLASS_TO_PLAIN&&p&&(p[m.options.discriminator.property]=m.options.discriminator.subTypes.find((function(t){return t.value===p.constructor})).name)):d=v,h=h||m.reflectedType===Map}else if(f.options.targetMaps)f.options.targetMaps.filter((function(t){return t.target===n&&!!t.properties[c]})).forEach((function(t){return d=t.properties[c]}));else if(f.options.enableImplicitConversion&&f.transformationType===zt.PLAIN_TO_CLASS){var g=Reflect.getMetadata("design:type",n.prototype,c);g&&(d=g)}}var E=Array.isArray(e[i])?f.getReflectedType(n,c):void 0,b=t?t[i]:void 0;if(u.constructor.prototype){var w=Object.getOwnPropertyDescriptor(u.constructor.prototype,s);if((f.transformationType===zt.PLAIN_TO_CLASS||f.transformationType===zt.CLASS_TO_CLASS)&&(w&&!w.set||u[s]instanceof Function))return"continue"}if(f.options.enableCircularCheck&&f.isCircular(p)){if(f.transformationType===zt.CLASS_TO_CLASS){S=p;(void 0!==(S=f.applyCustomTransformations(S,n,r,e,f.transformationType))||f.options.exposeUnsetFields)&&(u instanceof Map?u.set(s,S):u[s]=S)}}else{var O=f.transformationType===zt.PLAIN_TO_CLASS?s:r,S=void 0;f.transformationType===zt.CLASS_TO_PLAIN?(S=e[O],S=f.applyCustomTransformations(S,n,O,e,f.transformationType),S=e[O]===S?p:S,S=f.transform(b,S,d,E,h,o+1)):void 0===p&&f.options.exposeDefaultValues?S=u[s]:(S=f.transform(b,p,d,E,h,o+1),S=f.applyCustomTransformations(S,n,O,e,f.transformationType)),(void 0!==S||f.options.exposeUnsetFields)&&(u instanceof Map?u.set(s,S):u[s]=S)}},f=this,d=0,h=l;d<h.length;d++){p(h[d])}return this.options.enableCircularCheck&&this.recursionStack.delete(e),u}return e}return e}return new Promise((function(t,r){e.then((function(e){return t(s.transform(void 0,e,n,void 0,void 0,o+1))}),r)}))}return null==e?e:Boolean(e)}return null==e?e:Number(e)}return null==e?e:String(e)},t.prototype.applyCustomTransformations=function(t,e,n,r,a){var o=this,i=Ht.findTransformMetadatas(e,n,this.transformationType);return void 0!==this.options.version&&(i=i.filter((function(t){return!t.options||o.checkVersion(t.options.since,t.options.until)}))),(i=this.options.groups&&this.options.groups.length?i.filter((function(t){return!t.options||o.checkGroups(t.options.groups)})):i.filter((function(t){return!t.options||!t.options.groups||!t.options.groups.length}))).forEach((function(e){t=e.transformFn({value:t,key:n,obj:r,type:a,options:o.options})})),t},t.prototype.isCircular=function(t){return this.recursionStack.has(t)},t.prototype.getReflectedType=function(t,e){if(t){var n=Ht.findTypeMetadata(t,e);return n?n.reflectedType:void 0}},t.prototype.getKeys=function(t,e,n){var r=this,a=Ht.getStrategy(t);"none"===a&&(a=this.options.strategy||"exposeAll");var o=[];if(("exposeAll"===a||n)&&(o=e instanceof Map?Array.from(e.keys()):Object.keys(e)),n)return o;if(this.options.ignoreDecorators&&this.options.excludeExtraneousValues&&t){var i=Ht.getExposedProperties(t,this.transformationType),s=Ht.getExcludedProperties(t,this.transformationType);o=Ut(Ut([],i,!0),s,!0)}if(!this.options.ignoreDecorators&&t){i=Ht.getExposedProperties(t,this.transformationType);this.transformationType===zt.PLAIN_TO_CLASS&&(i=i.map((function(e){var n=Ht.findExposeMetadata(t,e);return n&&n.options&&n.options.name?n.options.name:e}))),o=this.options.excludeExtraneousValues?i:o.concat(i);var c=Ht.getExcludedProperties(t,this.transformationType);c.length>0&&(o=o.filter((function(t){return!c.includes(t)}))),void 0!==this.options.version&&(o=o.filter((function(e){var n=Ht.findExposeMetadata(t,e);return!n||!n.options||r.checkVersion(n.options.since,n.options.until)}))),o=this.options.groups&&this.options.groups.length?o.filter((function(e){var n=Ht.findExposeMetadata(t,e);return!n||!n.options||r.checkGroups(n.options.groups)})):o.filter((function(e){var n=Ht.findExposeMetadata(t,e);return!(n&&n.options&&n.options.groups&&n.options.groups.length)}))}return this.options.excludePrefixes&&this.options.excludePrefixes.length&&(o=o.filter((function(t){return r.options.excludePrefixes.every((function(e){return t.substr(0,e.length)!==e}))}))),o=o.filter((function(t,e,n){return n.indexOf(t)===e}))},t.prototype.checkVersion=function(t,e){var n=!0;return n&&t&&(n=this.options.version>=t),n&&e&&(n=this.options.version<e),n},t.prototype.checkGroups=function(t){return!t||this.options.groups.some((function(e){return t.includes(e)}))},t}(),Kt={enableCircularCheck:!1,enableImplicitConversion:!1,excludeExtraneousValues:!1,excludePrefixes:void 0,exposeDefaultValues:!1,exposeUnsetFields:!0,groups:void 0,ignoreDecorators:!1,strategy:void 0,targetMaps:void 0,version:void 0},Gt=function(){return Gt=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var a in e=arguments[n])Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t},Gt.apply(this,arguments)},qt=new(function(){function t(){}return t.prototype.instanceToPlain=function(t,e){return new Wt(zt.CLASS_TO_PLAIN,Gt(Gt({},Kt),e)).transform(void 0,t,void 0,void 0,void 0,void 0)},t.prototype.classToPlainFromExist=function(t,e,n){return new Wt(zt.CLASS_TO_PLAIN,Gt(Gt({},Kt),n)).transform(e,t,void 0,void 0,void 0,void 0)},t.prototype.plainToInstance=function(t,e,n){return new Wt(zt.PLAIN_TO_CLASS,Gt(Gt({},Kt),n)).transform(void 0,e,t,void 0,void 0,void 0)},t.prototype.plainToClassFromExist=function(t,e,n){return new Wt(zt.PLAIN_TO_CLASS,Gt(Gt({},Kt),n)).transform(t,e,void 0,void 0,void 0,void 0)},t.prototype.instanceToInstance=function(t,e){return new Wt(zt.CLASS_TO_CLASS,Gt(Gt({},Kt),e)).transform(void 0,t,void 0,void 0,void 0,void 0)},t.prototype.classToClassFromExist=function(t,e,n){return new Wt(zt.CLASS_TO_CLASS,Gt(Gt({},Kt),n)).transform(e,t,void 0,void 0,void 0,void 0)},t.prototype.serialize=function(t,e){return JSON.stringify(this.instanceToPlain(t,e))},t.prototype.deserialize=function(t,e,n){var r=JSON.parse(e);return this.plainToInstance(t,r,n)},t.prototype.deserializeArray=function(t,e,n){var r=JSON.parse(e);return this.plainToInstance(t,r,n)},t}());var Jt=function(t){this.groups=[],this.each=!1,this.context=void 0,this.type=t.type,this.name=t.name,this.target=t.target,this.propertyName=t.propertyName,this.constraints=null==t?void 0:t.constraints,this.constraintCls=t.constraintCls,this.validationTypeOptions=t.validationTypeOptions,t.validationOptions&&(this.message=t.validationOptions.message,this.groups=t.validationOptions.groups,this.always=t.validationOptions.always,this.each=t.validationOptions.each,this.context=t.validationOptions.context)},Yt=function(){function t(){}return t.prototype.transform=function(t){var e=[];return Object.keys(t.properties).forEach((function(n){t.properties[n].forEach((function(r){var a={message:r.message,groups:r.groups,always:r.always,each:r.each},o={type:r.type,name:r.name,target:t.name,propertyName:n,constraints:r.constraints,validationTypeOptions:r.options,validationOptions:a};e.push(new Jt(o))}))})),e},t}();function Qt(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:void 0}function Xt(t){return null!==t&&"object"==typeof t&&"function"==typeof t.then}var Zt=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},te=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,a,o=n.call(t),i=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(t){a={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(a)throw a.error}}return i},ee=function(t,e,n){if(n||2===arguments.length)for(var r,a=0,o=e.length;a<o;a++)!r&&a in e||(r||(r=Array.prototype.slice.call(e,0,a)),r[a]=e[a]);return t.concat(r||Array.prototype.slice.call(e))},ne=function(){function t(){this.validationMetadatas=new Map,this.constraintMetadatas=new Map}return Object.defineProperty(t.prototype,"hasValidationMetaData",{get:function(){return!!this.validationMetadatas.size},enumerable:!1,configurable:!0}),t.prototype.addValidationSchema=function(t){var e=this;(new Yt).transform(t).forEach((function(t){return e.addValidationMetadata(t)}))},t.prototype.addValidationMetadata=function(t){var e=this.validationMetadatas.get(t.target);e?e.push(t):this.validationMetadatas.set(t.target,[t])},t.prototype.addConstraintMetadata=function(t){var e=this.constraintMetadatas.get(t.target);e?e.push(t):this.constraintMetadatas.set(t.target,[t])},t.prototype.groupByPropertyName=function(t){var e={};return t.forEach((function(t){e[t.propertyName]||(e[t.propertyName]=[]),e[t.propertyName].push(t)})),e},t.prototype.getTargetValidationMetadatas=function(t,e,n,r,a){var o,i,s=function(t){return void 0!==t.always?t.always:(!t.groups||!t.groups.length)&&n},c=function(t){return!(!r||a&&a.length||!t.groups||!t.groups.length)},l=(this.validationMetadatas.get(t)||[]).filter((function(n){return(n.target===t||n.target===e)&&(!!s(n)||!c(n)&&(!(a&&a.length>0)||n.groups&&!!n.groups.find((function(t){return-1!==a.indexOf(t)}))))})),u=[];try{for(var p=Zt(this.validationMetadatas.entries()),f=p.next();!f.done;f=p.next()){var d=te(f.value,2),h=d[0],m=d[1];t.prototype instanceof h&&u.push.apply(u,ee([],te(m),!1))}}catch(t){o={error:t}}finally{try{f&&!f.done&&(i=p.return)&&i.call(p)}finally{if(o)throw o.error}}var y=u.filter((function(e){return"string"!=typeof e.target&&(e.target!==t&&((!(e.target instanceof Function)||t.prototype instanceof e.target)&&(!!s(e)||!c(e)&&(!(a&&a.length>0)||e.groups&&!!e.groups.find((function(t){return-1!==a.indexOf(t)}))))))})).filter((function(t){return!l.find((function(e){return e.propertyName===t.propertyName&&e.type===t.type}))}));return l.concat(y)},t.prototype.getTargetValidatorConstraints=function(t){return this.constraintMetadatas.get(t)||[]},t}();var re=function(){function t(){}return t.prototype.toString=function(t,e,n,r){var a=this;void 0===t&&(t=!1),void 0===e&&(e=!1),void 0===n&&(n=""),void 0===r&&(r=!1);var o=t?"[1m":"",i=t?"[22m":"",s=function(t){return" - property ".concat(o).concat(n).concat(t).concat(i," has failed the following constraints: ").concat(o).concat((r?Object.values:Object.keys)(null!==(e=a.constraints)&&void 0!==e?e:{}).join(", ")).concat(i," \n");var e};if(e){var c=Number.isInteger(+this.property)?"[".concat(this.property,"]"):"".concat(n?".":"").concat(this.property);return this.constraints?s(c):this.children?this.children.map((function(e){return e.toString(t,!0,"".concat(n).concat(c),r)})).join(""):""}return"An instance of ".concat(o).concat(this.target?this.target.constructor.name:"an object").concat(i," has failed the validation:\n")+(this.constraints?s(this.property):"")+(this.children?this.children.map((function(e){return e.toString(t,!0,a.property,r)})).join(""):"")},t}(),ae=function(){function t(){}return t.isValid=function(t){var e=this;return"isValid"!==t&&"getMessage"!==t&&-1!==Object.keys(this).map((function(t){return e[t]})).indexOf(t)},t.CUSTOM_VALIDATION="customValidation",t.NESTED_VALIDATION="nestedValidation",t.PROMISE_VALIDATION="promiseValidation",t.CONDITIONAL_VALIDATION="conditionalValidation",t.WHITELIST="whitelistValidation",t.IS_DEFINED="isDefined",t}();var oe=function(){function t(){}return t.replaceMessageSpecialTokens=function(t,e){var n;return t instanceof Function?n=t(e):"string"==typeof t&&(n=t),n&&Array.isArray(e.constraints)&&e.constraints.forEach((function(t,e){n=n.replace(new RegExp("\\$constraint".concat(e+1),"g"),function(t){return Array.isArray(t)?t.join(", "):("symbol"==typeof t&&(t=t.description),"".concat(t))}(t))})),n&&void 0!==e.value&&null!==e.value&&["string","boolean","number"].includes(typeof e.value)&&(n=n.replace(/\$value/g,e.value)),n&&(n=n.replace(/\$property/g,e.property)),n&&(n=n.replace(/\$target/g,e.targetName)),n},t}(),ie=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,a,o=n.call(t),i=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(t){a={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(a)throw a.error}}return i},se=function(){function t(t,e){this.validator=t,this.validatorOptions=e,this.awaitingPromises=[],this.ignoreAsyncValidations=!1,this.metadataStorage=function(){var t=Qt();return t.classValidatorMetadataStorage||(t.classValidatorMetadataStorage=new ne),t.classValidatorMetadataStorage}()}return t.prototype.execute=function(t,e,n){var r,a,o=this;this.metadataStorage.hasValidationMetaData||!0!==(null===(r=this.validatorOptions)||void 0===r?void 0:r.enableDebugMessages)||console.warn("No validation metadata found. No validation will be performed. There are multiple possible reasons:\n - There may be multiple class-validator versions installed. You will need to flatten your dependencies to fix the issue.\n - This validation runs before any file with validation decorator was parsed by NodeJS.");var i=this.validatorOptions?this.validatorOptions.groups:void 0,s=this.validatorOptions&&this.validatorOptions.strictGroups||!1,c=this.validatorOptions&&this.validatorOptions.always||!1,l=void 0===(null===(a=this.validatorOptions)||void 0===a?void 0:a.forbidUnknownValues)||!1!==this.validatorOptions.forbidUnknownValues,u=this.metadataStorage.getTargetValidationMetadatas(t.constructor,e,c,s,i),p=this.metadataStorage.groupByPropertyName(u);if(this.validatorOptions&&l&&!u.length){var f=new re;return this.validatorOptions&&this.validatorOptions.validationError&&void 0!==this.validatorOptions.validationError.target&&!0!==this.validatorOptions.validationError.target||(f.target=t),f.value=void 0,f.property=void 0,f.children=[],f.constraints={unknownValue:"an unknown value was passed to the validate function"},void n.push(f)}this.validatorOptions&&this.validatorOptions.whitelist&&this.whitelist(t,p,n),Object.keys(p).forEach((function(e){var r=t[e],a=p[e].filter((function(t){return t.type===ae.IS_DEFINED})),i=p[e].filter((function(t){return t.type!==ae.IS_DEFINED&&t.type!==ae.WHITELIST}));r instanceof Promise&&i.find((function(t){return t.type===ae.PROMISE_VALIDATION}))?o.awaitingPromises.push(r.then((function(r){o.performValidations(t,r,e,a,i,n)}))):o.performValidations(t,r,e,a,i,n)}))},t.prototype.whitelist=function(t,e,n){var r=this,a=[];Object.keys(t).forEach((function(t){e[t]&&0!==e[t].length||a.push(t)})),a.length>0&&(this.validatorOptions&&this.validatorOptions.forbidNonWhitelisted?a.forEach((function(e){var a,o=r.generateValidationError(t,t[e],e);o.constraints=((a={})[ae.WHITELIST]="property ".concat(e," should not exist"),a),o.children=void 0,n.push(o)})):a.forEach((function(e){return delete t[e]})))},t.prototype.stripEmptyErrors=function(t){var e=this;return t.filter((function(t){if(t.children&&(t.children=e.stripEmptyErrors(t.children)),0===Object.keys(t.constraints).length){if(0===t.children.length)return!1;delete t.constraints}return!0}))},t.prototype.performValidations=function(t,e,n,r,a,o){var i=a.filter((function(t){return t.type===ae.CUSTOM_VALIDATION})),s=a.filter((function(t){return t.type===ae.NESTED_VALIDATION})),c=a.filter((function(t){return t.type===ae.CONDITIONAL_VALIDATION})),l=this.generateValidationError(t,e,n);o.push(l),this.conditionalValidations(t,e,c)&&(this.customValidations(t,e,r,l),this.mapContexts(t,e,r,l),void 0===e&&this.validatorOptions&&!0===this.validatorOptions.skipUndefinedProperties||null===e&&this.validatorOptions&&!0===this.validatorOptions.skipNullProperties||null==e&&this.validatorOptions&&!0===this.validatorOptions.skipMissingProperties||(this.customValidations(t,e,i,l),this.nestedValidations(e,s,l),this.mapContexts(t,e,a,l),this.mapContexts(t,e,i,l)))},t.prototype.generateValidationError=function(t,e,n){var r=new re;return this.validatorOptions&&this.validatorOptions.validationError&&void 0!==this.validatorOptions.validationError.target&&!0!==this.validatorOptions.validationError.target||(r.target=t),this.validatorOptions&&this.validatorOptions.validationError&&void 0!==this.validatorOptions.validationError.value&&!0!==this.validatorOptions.validationError.value||(r.value=e),r.property=n,r.children=[],r.constraints={},r},t.prototype.conditionalValidations=function(t,e,n){return n.map((function(n){return n.constraints[0](t,e)})).reduce((function(t,e){return t&&e}),!0)},t.prototype.customValidations=function(t,e,n,r){var a=this;n.forEach((function(n){a.metadataStorage.getTargetValidatorConstraints(n.constraintCls).forEach((function(o){if(!(o.async&&a.ignoreAsyncValidations||a.validatorOptions&&a.validatorOptions.stopAtFirstError&&Object.keys(r.constraints||{}).length>0)){var i={targetName:t.constructor?t.constructor.name:void 0,property:n.propertyName,object:t,value:e,constraints:n.constraints};if(n.each&&(Array.isArray(e)||e instanceof Set||e instanceof Map)){var s,c=((s=e)instanceof Map?Array.from(s.values()):Array.isArray(s)?s:Array.from(s)).map((function(t){return o.instance.validate(t,i)}));if(c.some((function(t){return Xt(t)}))){var l=c.map((function(t){return Xt(t)?t:Promise.resolve(t)})),u=Promise.all(l).then((function(i){if(!i.every((function(t){return t}))){var s=ie(a.createValidationError(t,e,n,o),2),c=s[0],l=s[1];r.constraints[c]=l,n.context&&(r.contexts||(r.contexts={}),r.contexts[c]=Object.assign(r.contexts[c]||{},n.context))}}));a.awaitingPromises.push(u)}else{if(!c.every((function(t){return t}))){var p=ie(a.createValidationError(t,e,n,o),2);m=p[0],y=p[1];r.constraints[m]=y}}}else{var f=o.instance.validate(e,i);if(Xt(f)){var d=f.then((function(i){if(!i){var s=ie(a.createValidationError(t,e,n,o),2),c=s[0],l=s[1];r.constraints[c]=l,n.context&&(r.contexts||(r.contexts={}),r.contexts[c]=Object.assign(r.contexts[c]||{},n.context))}}));a.awaitingPromises.push(d)}else if(!f){var h=ie(a.createValidationError(t,e,n,o),2),m=h[0],y=h[1];r.constraints[m]=y}}}}))}))},t.prototype.nestedValidations=function(t,e,n){var r=this;void 0!==t&&e.forEach((function(a){if((a.type===ae.NESTED_VALIDATION||a.type===ae.PROMISE_VALIDATION)&&!(r.validatorOptions&&r.validatorOptions.stopAtFirstError&&Object.keys(n.constraints||{}).length>0))if(Array.isArray(t)||t instanceof Set||t instanceof Map)(t instanceof Set?Array.from(t):t).forEach((function(a,o){r.performValidations(t,a,o.toString(),[],e,n.children)}));else if(t instanceof Object){var o="string"==typeof a.target?a.target:a.target.name;r.execute(t,o,n.children)}else{var i=ie(r.createValidationError(a.target,t,a),2),s=i[0],c=i[1];n.constraints[s]=c}}))},t.prototype.mapContexts=function(t,e,n,r){var a=this;return n.forEach((function(t){if(t.context){var e=void 0;if(t.type===ae.CUSTOM_VALIDATION)e=a.metadataStorage.getTargetValidatorConstraints(t.constraintCls)[0];var n=a.getConstraintType(t,e);r.constraints[n]&&(r.contexts||(r.contexts={}),r.contexts[n]=Object.assign(r.contexts[n]||{},t.context))}}))},t.prototype.createValidationError=function(t,e,n,r){var a=t.constructor?t.constructor.name:void 0,o=this.getConstraintType(n,r),i={targetName:a,property:n.propertyName,object:t,value:e,constraints:n.constraints},s=n.message||"";return n.message||this.validatorOptions&&(!this.validatorOptions||this.validatorOptions.dismissDefaultMessages)||r&&r.instance.defaultMessage instanceof Function&&(s=r.instance.defaultMessage(i)),[o,oe.replaceMessageSpecialTokens(s,i)]},t.prototype.getConstraintType=function(t,e){return e&&e.name?e.name:t.type},t}(),ce=function(t,e,n,r){return new(n||(n=Promise))((function(a,o){function i(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?a(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,s)}c((r=r.apply(t,e||[])).next())}))},le=function(t,e){var n,r,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(i=0)),i;)try{if(n=1,r&&(a=2&s[0]?r.return:s[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,s[1])).done)return a;switch(r=0,a&&(s=[2&s[0],a.value]),s[0]){case 0:case 1:a=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,r=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(a=i.trys,(a=a.length>0&&a[a.length-1])||6!==s[0]&&2!==s[0])){i=0;continue}if(3===s[0]&&(!a||s[1]>a[0]&&s[1]<a[3])){i.label=s[1];break}if(6===s[0]&&i.label<a[1]){i.label=a[1],a=s;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(s);break}a[2]&&i.ops.pop(),i.trys.pop();continue}s=e.call(t,i)}catch(t){s=[6,t],r=0}finally{n=a=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},ue=function(){function t(){}return t.prototype.validate=function(t,e,n){return this.coreValidate(t,e,n)},t.prototype.validateOrReject=function(t,e,n){return ce(this,void 0,void 0,(function(){var r;return le(this,(function(a){switch(a.label){case 0:return[4,this.coreValidate(t,e,n)];case 1:return(r=a.sent()).length?[2,Promise.reject(r)]:[2]}}))}))},t.prototype.validateSync=function(t,e,n){var r="string"==typeof t?e:t,a="string"==typeof t?t:void 0,o=new se(this,"string"==typeof t?n:e);o.ignoreAsyncValidations=!0;var i=[];return o.execute(r,a,i),o.stripEmptyErrors(i)},t.prototype.coreValidate=function(t,e,n){var r="string"==typeof t?e:t,a="string"==typeof t?t:void 0,o=new se(this,"string"==typeof t?n:e),i=[];return o.execute(r,a,i),Promise.all(o.awaitingPromises).then((function(){return o.stripEmptyErrors(i)}))},t}(),pe=new(function(){function t(){this.instances=[]}return t.prototype.get=function(t){var e=this.instances.find((function(e){return e.type===t}));return e||(e={type:t,object:new t},this.instances.push(e)),e.object},t}());function fe(t){return pe.get(t)}function de(t,e,n){return"string"==typeof t?fe(ue).validate(t,e,n):fe(ue).validate(t,e)}function he(t,e,n){return"string"==typeof t?fe(ue).validateSync(t,e,n):fe(ue).validateSync(t,e)}function me(t,e,n,r){return void 0===n&&(n={}),void 0===r&&(r=""),t.reduce((function(t,n){var a=r?r+"."+n.property:n.property;if(n.constraints){var o=Object.keys(n.constraints)[0];t[a]={type:o,message:n.constraints[o]};var i=t[a];e&&i&&Object.assign(i,{types:n.constraints})}return n.children&&n.children.length&&me(n.children,e,t,a),t}),n)}function ye(t,e,n){return void 0===e&&(e={}),void 0===n&&(n={}),function(r,a,o){try{var i=e.validator,s=(c=t,l=r,u=e.transformer,qt.plainToInstance(c,l,u));return Promise.resolve(("sync"===n.mode?he:de)(s,i)).then((function(t){return t.length?{values:{},errors:Ft(me(t,!o.shouldUseNativeValidation&&"all"===o.criteriaMode),o)}:(o.shouldUseNativeValidation&&Dt({},o),{values:n.raw?Object.assign({},r):s,errors:{}})}))}catch(t){return Promise.reject(t)}var c,l,u}}function ve({model:e}){const{class:n,inputs:r,resolver:a}=i((()=>{return{resolver:ye(t=e),class:jt(t),inputs:Lt(t)};var t}),[e]),s=v({resolver:a}),l=t();return c((()=>{n.getDetailsData&&n.getDetailsData(l).then((t=>{s.reset(t)}))}),[l,s.reset,n.getDetailsData]),o.createElement(g,{...s},o.createElement(kt,{inputs:r,formClass:n}))}function ge(t){return function(t){return(e,n)=>{const r=Reflect.getMetadata(At,e)||[];if(Reflect.defineMetadata(At,[...r,n.toString()],e),t){const r=`${At.toString()}:${n.toString()}:options`;Reflect.defineMetadata(r,t,e)}}}({...t,type:"select"})}class Ee extends p{state={hasError:!1,error:null,errorInfo:null};static getDerivedStateFromError(t){return{hasError:!0,error:t,errorInfo:null}}componentDidCatch(t,e){this.setState({error:t,errorInfo:e})}render(){return this.state.hasError?o.createElement("div",{className:"error-boundary"},o.createElement("div",{className:"error-boundary__content"},o.createElement("div",{className:"error-boundary__icon"},o.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor"},o.createElement("circle",{cx:"12",cy:"12",r:"10"}),o.createElement("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),o.createElement("line",{x1:"12",y1:"16",x2:"12",y2:"16"}))),o.createElement("h1",null,"Oops! Something went wrong"),o.createElement("p",{className:"error-boundary__message"},this.state.error?.message||"An unexpected error occurred"),o.createElement("button",{className:"error-boundary__button",onClick:()=>window.location.reload()},"Refresh Page"),"development"===process.env.NODE_ENV&&o.createElement("details",{className:"error-boundary__details"},o.createElement("summary",null,"Error Details"),o.createElement("pre",null,this.state.error?.toString()),o.createElement("pre",null,this.state.errorInfo?.componentStack)))):this.props.children}}function be({children:t}){return o.createElement(Ee,null,t)}function we({image:t,text:e,targetNumber:n,duration:r=2e3}){const[a,i]=s(0);return c((()=>{let t,e;const a=o=>{t||(t=o);const s=o-t,c=Math.min(s/r,1);i(Math.floor(c*n)),c<1&&(e=requestAnimationFrame(a))};return e=requestAnimationFrame(a),()=>{e&&cancelAnimationFrame(e)}}),[n,r]),o.createElement("div",{className:"counter-container"},o.createElement("div",{className:"counter-image"},t),o.createElement("div",{className:"counter-text"},e),o.createElement("div",{className:"counter-value"},a))}function Oe({menu:t,getIcons:a,onLogout:i}){const[c,l]=s(!0),u=r();n();const p=t=>{if("/"===t)return u.pathname===t;const e=t.replace(/^\/+|\/+$/g,""),n=u.pathname.replace(/^\/+|\/+$/g,"");return n===e||n.startsWith(`${e}/`)};return o.createElement("div",{className:"sidebar "+(c?"open":"closed")},o.createElement("button",{className:"toggle-button",onClick:()=>l(!c),"aria-label":c?"Collapse sidebar":"Expand sidebar","aria-expanded":c},c?"<":">"),o.createElement("nav",{className:"nav-links"},t?.().map(((t,n)=>o.createElement(e,{key:n,to:t.path,className:"nav-link "+(p(t.path)?"active":""),"aria-current":p(t.path)?"page":void 0},o.createElement("span",{className:"nav-links-icon"},a?.(t.iconType)),c?o.createElement("span",null,t.name):null)))),i&&o.createElement("div",{className:"sidebar-footer"},o.createElement("button",{className:"logout-button",onClick:()=>{i&&i("logout")},"aria-label":"Logout"},o.createElement("span",{className:"nav-links-icon"},o.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o.createElement("path",{d:"M6 12H2V4H6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),o.createElement("path",{d:"M10 8L14 4M14 4L10 0M14 4H6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}))),c?o.createElement("span",null,"Logout"):null)))}const Se=w()(E((t=>({user:null})),{name:"app-store-1",storage:b((()=>localStorage)),partialize:t=>({user:t.user})}),O);function _e({children:t,menu:e,getIcons:r,logout:a}){const{user:i}=Se((t=>({user:t.user})));return n(),i||a?.("redirect"),o.createElement("div",{className:"layout"},o.createElement(Oe,{onLogout:a,menu:e,getIcons:r}),o.createElement("main",{className:"content"},t))}function Me({onLogin:t}){const{register:e,handleSubmit:r,formState:{errors:a}}=v(),i=n();return o.createElement("div",{className:"login-container"},o.createElement("div",{className:"login-panel"},o.createElement("div",{className:"login-header"},o.createElement("h1",null,"Welcome Back"),o.createElement("p",null,"Please sign in to continue")),o.createElement("form",{onSubmit:r((async e=>{t.login(e.username,e.password).then((t=>{const{user:e,token:n}=t;localStorage.setItem("token",n),Se.setState({user:e}),i("/")}))})),className:"login-form"},o.createElement(Tt,{input:{name:"username",label:"Username",placeholder:"Enter your username",type:"input"},register:e,error:a.username}),o.createElement(Tt,{input:{name:"password",label:"Password",inputType:"password",placeholder:"Enter your password",type:"input"},register:e,error:a.password}),o.createElement("div",{className:"form-actions"},o.createElement("button",{type:"submit",className:"submit-button"},"Sign In")))))}export{mt as Cell,we as Counter,C as Details,T as DetailsItem,I as DetailsPage,It as Form,ve as FormPage,wt as ImageCell,Ct as Input,_e as Layout,gt as List,bt as ListPage,Me as Login,be as Panel,ge as SelectInput,Lt as getInputFields};
|
1
|
+
import{useParams as e,Link as t,useNavigate as n,useLocation as r}from"react-router";import*as a from"react";import o,{useMemo as i,useState as s,useEffect as c,useRef as l,useCallback as u,Component as p}from"react";import f from"react-select";import{useFormContext as d,Controller as m,get as h,set as y,useForm as v,FormProvider as g}from"react-hook-form";import{persist as E,createJSONStorage as b}from"zustand/middleware";import{createWithEqualityFn as w}from"zustand/traditional";import{shallow as O}from"zustand/vanilla/shallow";function S({error:e}){return o.createElement("div",{className:"error-container"},o.createElement("div",{className:"error-icon"},o.createElement("i",{className:"fa fa-exclamation-circle"})),o.createElement("div",{className:"error-content"},o.createElement("h3",null,"Error Occurred"),o.createElement("p",null,(e=>{if(e instanceof Response)switch(e.status){case 400:return"Bad Request: The request was invalid or malformed.";case 401:return"Unauthorized: Please log in to access this resource.";case 404:return"Not Found: The requested resource could not be found.";case 403:return"Forbidden: You don't have permission to access this resource.";case 500:return"Internal Server Error: Something went wrong on our end.";default:return`Error ${e.status}: ${e.statusText||"Something went wrong."}`}return e?.message||"Something went wrong. Please try again later."})(e))))}var _,M="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},x={};!function(){return _||(_=1,function(e){!function(){var t="object"==typeof globalThis?globalThis:"object"==typeof M?M:"object"==typeof self?self:"object"==typeof this?this:function(){try{return Function("return this;")()}catch(e){}}()||function(){try{return(0,eval)("(function() { return this; })()")}catch(e){}}(),n=r(e);function r(e,t){return function(n,r){Object.defineProperty(e,n,{configurable:!0,writable:!0,value:r}),t&&t(n,r)}}void 0!==t.Reflect&&(n=r(t.Reflect,n)),function(e,t){var n=Object.prototype.hasOwnProperty,r="function"==typeof Symbol,a=r&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",o=r&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",i="function"==typeof Object.create,s={__proto__:[]}instanceof Array,c=!i&&!s,l={create:i?function(){return pe(Object.create(null))}:s?function(){return pe({__proto__:null})}:function(){return pe({})},has:c?function(e,t){return n.call(e,t)}:function(e,t){return t in e},get:c?function(e,t){return n.call(e,t)?e[t]:void 0}:function(e,t){return e[t]}},u=Object.getPrototypeOf(Function),p="function"==typeof Map&&"function"==typeof Map.prototype.entries?Map:ce(),f="function"==typeof Set&&"function"==typeof Set.prototype.entries?Set:le(),d="function"==typeof WeakMap?WeakMap:ue(),m=r?Symbol.for("@reflect-metadata:registry"):void 0,h=ae(),y=oe(h);function v(e,t,n,r){if(D(n)){if(!W(e))throw new TypeError;if(!q(t))throw new TypeError;return N(e,t)}if(!W(e))throw new TypeError;if(!$(t))throw new TypeError;if(!$(r)&&!D(r)&&!F(r))throw new TypeError;return F(r)&&(r=void 0),T(e,t,n=K(n),r)}function g(e,t){function n(n,r){if(!$(n))throw new TypeError;if(!D(r)&&!J(r))throw new TypeError;P(e,t,n,r)}return n}function E(e,t,n,r){if(!$(n))throw new TypeError;return D(r)||(r=K(r)),P(e,t,n,r)}function b(e,t,n){if(!$(t))throw new TypeError;return D(n)||(n=K(n)),k(e,t,n)}function w(e,t,n){if(!$(t))throw new TypeError;return D(n)||(n=K(n)),A(e,t,n)}function O(e,t,n){if(!$(t))throw new TypeError;return D(n)||(n=K(n)),C(e,t,n)}function S(e,t,n){if(!$(t))throw new TypeError;return D(n)||(n=K(n)),L(e,t,n)}function _(e,t){if(!$(e))throw new TypeError;return D(t)||(t=K(t)),I(e,t)}function M(e,t){if(!$(e))throw new TypeError;return D(t)||(t=K(t)),j(e,t)}function x(e,t,n){if(!$(t))throw new TypeError;if(D(n)||(n=K(n)),!$(t))throw new TypeError;D(n)||(n=K(n));var r=se(t,n,!1);return!D(r)&&r.OrdinaryDeleteMetadata(e,t,n)}function N(e,t){for(var n=e.length-1;n>=0;--n){var r=(0,e[n])(t);if(!D(r)&&!F(r)){if(!q(r))throw new TypeError;t=r}}return t}function T(e,t,n,r){for(var a=e.length-1;a>=0;--a){var o=(0,e[a])(t,n,r);if(!D(o)&&!F(o)){if(!$(o))throw new TypeError;r=o}}return r}function k(e,t,n){if(A(e,t,n))return!0;var r=ne(t);return!F(r)&&k(e,r,n)}function A(e,t,n){var r=se(t,n,!1);return!D(r)&&H(r.OrdinaryHasOwnMetadata(e,t,n))}function C(e,t,n){if(A(e,t,n))return L(e,t,n);var r=ne(t);return F(r)?void 0:C(e,r,n)}function L(e,t,n){var r=se(t,n,!1);if(!D(r))return r.OrdinaryGetOwnMetadata(e,t,n)}function P(e,t,n,r){se(n,r,!0).OrdinaryDefineOwnMetadata(e,t,n,r)}function I(e,t){var n=j(e,t),r=ne(e);if(null===r)return n;var a=I(r,t);if(a.length<=0)return n;if(n.length<=0)return a;for(var o=new f,i=[],s=0,c=n;s<c.length;s++){var l=c[s];o.has(l)||(o.add(l),i.push(l))}for(var u=0,p=a;u<p.length;u++){l=p[u];o.has(l)||(o.add(l),i.push(l))}return i}function j(e,t){var n=se(e,t,!1);return n?n.OrdinaryOwnMetadataKeys(e,t):[]}function V(e){if(null===e)return 1;switch(typeof e){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===e?1:6;default:return 6}}function D(e){return void 0===e}function F(e){return null===e}function R(e){return"symbol"==typeof e}function $(e){return"object"==typeof e?null!==e:"function"==typeof e}function z(e,t){switch(V(e)){case 0:case 1:case 2:case 3:case 4:case 5:return e}var n="string",r=Q(e,a);if(void 0!==r){var o=r.call(e,n);if($(o))throw new TypeError;return o}return B(e)}function B(e,t){var n,r,a=e.toString;if(G(a)&&!$(r=a.call(e)))return r;if(G(n=e.valueOf)&&!$(r=n.call(e)))return r;throw new TypeError}function H(e){return!!e}function U(e){return""+e}function K(e){var t=z(e);return R(t)?t:U(t)}function W(e){return Array.isArray?Array.isArray(e):e instanceof Object?e instanceof Array:"[object Array]"===Object.prototype.toString.call(e)}function G(e){return"function"==typeof e}function q(e){return"function"==typeof e}function J(e){switch(V(e)){case 3:case 4:return!0;default:return!1}}function Y(e,t){return e===t||e!=e&&t!=t}function Q(e,t){var n=e[t];if(null!=n){if(!G(n))throw new TypeError;return n}}function X(e){var t=Q(e,o);if(!G(t))throw new TypeError;var n=t.call(e);if(!$(n))throw new TypeError;return n}function Z(e){return e.value}function ee(e){var t=e.next();return!t.done&&t}function te(e){var t=e.return;t&&t.call(e)}function ne(e){var t=Object.getPrototypeOf(e);if("function"!=typeof e||e===u)return t;if(t!==u)return t;var n=e.prototype,r=n&&Object.getPrototypeOf(n);if(null==r||r===Object.prototype)return t;var a=r.constructor;return"function"!=typeof a||a===e?t:a}function re(){var e,n,r,a;D(m)||void 0===t.Reflect||m in t.Reflect||"function"!=typeof t.Reflect.defineMetadata||(e=ie(t.Reflect));var o=new d,i={registerProvider:s,getProvider:l,setProvider:h};return i;function s(t){if(!Object.isExtensible(i))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case e===t:break;case D(n):n=t;break;case n===t:break;case D(r):r=t;break;case r===t:break;default:void 0===a&&(a=new f),a.add(t)}}function c(t,o){if(!D(n)){if(n.isProviderFor(t,o))return n;if(!D(r)){if(r.isProviderFor(t,o))return n;if(!D(a))for(var i=X(a);;){var s=ee(i);if(!s)return;var c=Z(s);if(c.isProviderFor(t,o))return te(i),c}}}if(!D(e)&&e.isProviderFor(t,o))return e}function l(e,t){var n,r=o.get(e);return D(r)||(n=r.get(t)),D(n)?(D(n=c(e,t))||(D(r)&&(r=new p,o.set(e,r)),r.set(t,n)),n):n}function u(e){if(D(e))throw new TypeError;return n===e||r===e||!D(a)&&a.has(e)}function h(e,t,n){if(!u(n))throw new Error("Metadata provider not registered.");var r=l(e,t);if(r!==n){if(!D(r))return!1;var a=o.get(e);D(a)&&(a=new p,o.set(e,a)),a.set(t,n)}return!0}}function ae(){var e;return!D(m)&&$(t.Reflect)&&Object.isExtensible(t.Reflect)&&(e=t.Reflect[m]),D(e)&&(e=re()),!D(m)&&$(t.Reflect)&&Object.isExtensible(t.Reflect)&&Object.defineProperty(t.Reflect,m,{enumerable:!1,configurable:!1,writable:!1,value:e}),e}function oe(e){var t=new d,n={isProviderFor:function(e,n){var r=t.get(e);return!D(r)&&r.has(n)},OrdinaryDefineOwnMetadata:i,OrdinaryHasOwnMetadata:a,OrdinaryGetOwnMetadata:o,OrdinaryOwnMetadataKeys:s,OrdinaryDeleteMetadata:c};return h.registerProvider(n),n;function r(r,a,o){var i=t.get(r),s=!1;if(D(i)){if(!o)return;i=new p,t.set(r,i),s=!0}var c=i.get(a);if(D(c)){if(!o)return;if(c=new p,i.set(a,c),!e.setProvider(r,a,n))throw i.delete(a),s&&t.delete(r),new Error("Wrong provider for target.")}return c}function a(e,t,n){var a=r(t,n,!1);return!D(a)&&H(a.has(e))}function o(e,t,n){var a=r(t,n,!1);if(!D(a))return a.get(e)}function i(e,t,n,a){r(n,a,!0).set(e,t)}function s(e,t){var n=[],a=r(e,t,!1);if(D(a))return n;for(var o=X(a.keys()),i=0;;){var s=ee(o);if(!s)return n.length=i,n;var c=Z(s);try{n[i]=c}catch(e){try{te(o)}finally{throw e}}i++}}function c(e,n,a){var o=r(n,a,!1);if(D(o))return!1;if(!o.delete(e))return!1;if(0===o.size){var i=t.get(n);D(i)||(i.delete(a),0===i.size&&t.delete(i))}return!0}}function ie(e){var t=e.defineMetadata,n=e.hasOwnMetadata,r=e.getOwnMetadata,a=e.getOwnMetadataKeys,o=e.deleteMetadata,i=new d;return{isProviderFor:function(e,t){var n=i.get(e);return!(D(n)||!n.has(t))||!!a(e,t).length&&(D(n)&&(n=new f,i.set(e,n)),n.add(t),!0)},OrdinaryDefineOwnMetadata:t,OrdinaryHasOwnMetadata:n,OrdinaryGetOwnMetadata:r,OrdinaryOwnMetadataKeys:a,OrdinaryDeleteMetadata:o}}function se(e,t,n){var r=h.getProvider(e,t);if(!D(r))return r;if(n){if(h.setProvider(e,t,y))return y;throw new Error("Illegal state.")}}function ce(){var e={},t=[],n=function(){function e(e,t,n){this._index=0,this._keys=e,this._values=t,this._selector=n}return e.prototype["@@iterator"]=function(){return this},e.prototype[o]=function(){return this},e.prototype.next=function(){var e=this._index;if(e>=0&&e<this._keys.length){var n=this._selector(this._keys[e],this._values[e]);return e+1>=this._keys.length?(this._index=-1,this._keys=t,this._values=t):this._index++,{value:n,done:!1}}return{value:void 0,done:!0}},e.prototype.throw=function(e){throw this._index>=0&&(this._index=-1,this._keys=t,this._values=t),e},e.prototype.return=function(e){return this._index>=0&&(this._index=-1,this._keys=t,this._values=t),{value:e,done:!0}},e}(),r=function(){function t(){this._keys=[],this._values=[],this._cacheKey=e,this._cacheIndex=-2}return Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),t.prototype.has=function(e){return this._find(e,!1)>=0},t.prototype.get=function(e){var t=this._find(e,!1);return t>=0?this._values[t]:void 0},t.prototype.set=function(e,t){var n=this._find(e,!0);return this._values[n]=t,this},t.prototype.delete=function(t){var n=this._find(t,!1);if(n>=0){for(var r=this._keys.length,a=n+1;a<r;a++)this._keys[a-1]=this._keys[a],this._values[a-1]=this._values[a];return this._keys.length--,this._values.length--,Y(t,this._cacheKey)&&(this._cacheKey=e,this._cacheIndex=-2),!0}return!1},t.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=e,this._cacheIndex=-2},t.prototype.keys=function(){return new n(this._keys,this._values,a)},t.prototype.values=function(){return new n(this._keys,this._values,i)},t.prototype.entries=function(){return new n(this._keys,this._values,s)},t.prototype["@@iterator"]=function(){return this.entries()},t.prototype[o]=function(){return this.entries()},t.prototype._find=function(e,t){if(!Y(this._cacheKey,e)){this._cacheIndex=-1;for(var n=0;n<this._keys.length;n++)if(Y(this._keys[n],e)){this._cacheIndex=n;break}}return this._cacheIndex<0&&t&&(this._cacheIndex=this._keys.length,this._keys.push(e),this._values.push(void 0)),this._cacheIndex},t}();return r;function a(e,t){return e}function i(e,t){return t}function s(e,t){return[e,t]}}function le(){return function(){function e(){this._map=new p}return Object.defineProperty(e.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),e.prototype.has=function(e){return this._map.has(e)},e.prototype.add=function(e){return this._map.set(e,e),this},e.prototype.delete=function(e){return this._map.delete(e)},e.prototype.clear=function(){this._map.clear()},e.prototype.keys=function(){return this._map.keys()},e.prototype.values=function(){return this._map.keys()},e.prototype.entries=function(){return this._map.entries()},e.prototype["@@iterator"]=function(){return this.keys()},e.prototype[o]=function(){return this.keys()},e}()}function ue(){var e=16,t=l.create(),r=a();return function(){function e(){this._key=a()}return e.prototype.has=function(e){var t=o(e,!1);return void 0!==t&&l.has(t,this._key)},e.prototype.get=function(e){var t=o(e,!1);return void 0!==t?l.get(t,this._key):void 0},e.prototype.set=function(e,t){return o(e,!0)[this._key]=t,this},e.prototype.delete=function(e){var t=o(e,!1);return void 0!==t&&delete t[this._key]},e.prototype.clear=function(){this._key=a()},e}();function a(){var e;do{e="@@WeakMap@@"+c()}while(l.has(t,e));return t[e]=!0,e}function o(e,t){if(!n.call(e,r)){if(!t)return;Object.defineProperty(e,r,{value:l.create()})}return e[r]}function i(e,t){for(var n=0;n<t;++n)e[n]=255*Math.random()|0;return e}function s(e){if("function"==typeof Uint8Array){var t=new Uint8Array(e);return"undefined"!=typeof crypto?crypto.getRandomValues(t):"undefined"!=typeof msCrypto?msCrypto.getRandomValues(t):i(t,e),t}return i(new Array(e),e)}function c(){var t=s(e);t[6]=79&t[6]|64,t[8]=191&t[8]|128;for(var n="",r=0;r<e;++r){var a=t[r];4!==r&&6!==r&&8!==r||(n+="-"),a<16&&(n+="0"),n+=a.toString(16).toLowerCase()}return n}}function pe(e){return e.__=void 0,delete e.__,e}e("decorate",v),e("metadata",g),e("defineMetadata",E),e("hasMetadata",b),e("hasOwnMetadata",w),e("getMetadata",O),e("getOwnMetadata",S),e("getMetadataKeys",_),e("getOwnMetadataKeys",M),e("deleteMetadata",x)}(n,t),void 0===t.Reflect&&(t.Reflect=e)}()}(e||(e={}))),x;var e}();const N=Symbol("detailsItem");function T(e){return(t,n)=>{const r=Reflect.getMetadata(N,t)||[];if(Reflect.defineMetadata(N,[...r,n.toString()],t),e){const r=`${N.toString()}:${n.toString()}:options`;Reflect.defineMetadata(r,e,t)}}}function k(e){const t=e.prototype;return(Reflect.getMetadata(N,t)||[]).map((e=>{const n=Reflect.getMetadata(`${N.toString()}:${e}:options`,t)||{};return{...n,name:n.name||e}}))}const A="DetailsMetaData";function C(e){return t=>{e&&Reflect.defineMetadata(A,e,t)}}function L(e){const t=Reflect.getMetadata(A,e);if(!t)throw new Error("Details decerator should be used on class");return{...t}}function P(){return o.createElement("div",{className:"loading-screen"},o.createElement("div",{className:"loading-container"},o.createElement("div",{className:"loading-spinner"}),o.createElement("div",{className:"loading-text"},"Loading...")))}function I({model:t}){const{class:n,items:r}=i((()=>{return{class:L(e=t),items:k(e)};var e}),[t]),a=e(),[l,u]=s(null),[p,f]=s(null),[d,m]=s(!0);return c((()=>{n.getDetailsData(a).then((e=>{u(e)})).catch(f).finally((()=>m(!1)))}),[a,n?.getDetailsData]),p?o.createElement("div",{className:"error-container"},o.createElement(S,{error:p})):d?o.createElement("div",{className:"loading-container"},o.createElement(P,null)):o.createElement("div",{className:"details-page"},r.map((e=>o.createElement("div",{key:e.name,className:"details-item"},o.createElement("div",{className:"item-label"},e.name),o.createElement("div",{className:"item-value"},l[e.name])))))}const j=()=>o.createElement("div",{className:"empty-list"},o.createElement("div",{className:"empty-list-content"},o.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"64",height:"64",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},o.createElement("path",{d:"M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"}),o.createElement("polyline",{points:"13 2 13 9 20 9"})),o.createElement("h3",null,"No Data Found"),o.createElement("p",null,"There are no items to display at the moment.")));var V,D;function F(){return F=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},F.apply(null,arguments)}var R,$,z=function(e){return a.createElement("svg",F({xmlns:"http://www.w3.org/2000/svg",width:800,height:800,viewBox:"0 0 24 24"},e),V||(V=a.createElement("path",{fill:"none",d:"M0 0h24v24H0z"})),D||(D=a.createElement("path",{d:"m21 19-5.154-5.154a7 7 0 1 0-2 2L19 21zM5 10c0-2.757 2.243-5 5-5s5 2.243 5 5-2.243 5-5 5-5-2.243-5-5"})))};function B(){return B=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},B.apply(null,arguments)}var H,U,K=function(e){return a.createElement("svg",B({xmlns:"http://www.w3.org/2000/svg",width:800,height:800,viewBox:"0 0 24 24"},e),R||(R=a.createElement("path",{fill:"none",d:"M0 0h24v24H0z"})),$||($=a.createElement("path",{d:"m13 6 5 5-9.507 9.507a1.765 1.765 0 0 1-.012-2.485l-.002-.003c-.69.676-1.8.673-2.485-.013a1.763 1.763 0 0 1-.036-2.455l-.008-.008c-.694.65-1.78.64-2.456-.036zm7.586-.414-2.172-2.172a2 2 0 0 0-2.828 0L14 5l5 5 1.586-1.586c.78-.78.78-2.047 0-2.828M3 18v3h3a3 3 0 0 0-3-3"})))};function W(){return W=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},W.apply(null,arguments)}var G,q=function(e){return a.createElement("svg",W({xmlns:"http://www.w3.org/2000/svg",width:800,height:800,viewBox:"0 0 24 24"},e),H||(H=a.createElement("path",{fill:"none",d:"M0 0h24v24H0z"})),U||(U=a.createElement("path",{d:"M6.187 8h11.625l-.695 11.125A2 2 0 0 1 15.12 21H8.88a2 2 0 0 1-1.997-1.875zM19 5v2H5V5h3V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v1zm-9 0h4V4h-4z"})))};function J(){return J=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},J.apply(null,arguments)}var Y,Q=function(e){return a.createElement("svg",J({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",stroke:"#000"},e),G||(G=a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 6 9 17l-5-5"})))};function X(){return X=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},X.apply(null,arguments)}var Z,ee,te,ne=function(e){return a.createElement("svg",X({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",stroke:"#000"},e),Y||(Y=a.createElement("path",{strokeLinecap:"round",strokeWidth:2,d:"m8 8 8 8m-8 0 8-8"})))};function re({value:e}){return e?o.createElement(Q,{className:"icon icon-true"}):o.createElement(ne,{className:"icon icon-false"})}function ae({value:e}){if(!e)return o.createElement(o.Fragment,null,"-");const t=new Date(e);return o.createElement(o.Fragment,null,`${t.getDate().toString().padStart(2,"0")}/${(t.getMonth()+1).toString().padStart(2,"0")}/${t.getFullYear()} ${t.getHours().toString().padStart(2,"0")}:${t.getMinutes().toString().padStart(2,"0")}`)}function oe({value:e,configuration:t}){const n=t;return e?o.createElement("img",{width:100,height:100,src:n.baseUrl+e,style:{objectFit:"contain"},alt:""}):o.createElement(o.Fragment,null,"-")}function ie({value:e}){return!e||"string"!=typeof e||e.length<6?o.createElement(o.Fragment,null,"-"):o.createElement(o.Fragment,null,`${e.slice(0,3)}...${e.slice(-3)}`)}function se({value:e,configuration:t}){return o.createElement(o.Fragment,null,e?e.toString():t.placeHolder)}function ce({value:e,configuration:t}){if(!e)return o.createElement(o.Fragment,null,"-");const n=(t.baseUrl||"")+e;return o.createElement("a",{href:n,download:n,className:"download-link",target:"_blank",rel:"noopener noreferrer"},"Download")}function le({configuration:e,item:t,value:n}){let r;switch(e.type){case"boolean":r=o.createElement(re,{value:n});break;case"date":r=o.createElement(ae,{value:n});break;case"image":r=o.createElement(oe,{value:n,configuration:e});break;case"uuid":r=o.createElement(ie,{value:n});break;case"download":r=o.createElement(ce,{value:n,configuration:e});break;default:r=o.createElement(se,{value:n,configuration:e})}return o.createElement("td",{key:e.name},r)}function ue({data:e,listPageMeta:n,onRemoveItem:r}){const a=n.cells,i=e?.[0]?"function"==typeof n.class.cells?n.class.cells?.(e[0]):n.class.cells:null;return o.createElement("div",{className:"datagrid"},e&&0!==e.length?o.createElement("table",{className:"datagrid-table"},o.createElement("thead",null,o.createElement("tr",null,a.map((e=>o.createElement("th",{key:e.name},e.title??e.name))),i?.details&&o.createElement("th",null,"Details"),i?.edit&&o.createElement("th",null,"Edit"),i?.delete&&o.createElement("th",null,"Delete"))),o.createElement("tbody",null,e.map(((e,i)=>{const s=e?"function"==typeof n.class.cells?n.class.cells?.(e):n.class.cells:null;return o.createElement("tr",{key:i},a.map((t=>{const n=e[t.name];return o.createElement(le,{key:t.name,configuration:t,item:e,value:n})})),s?.details&&o.createElement("td",null,o.createElement(t,{to:s.details.path,className:"util-cell-link"},o.createElement(z,{className:"icon icon-search"}),o.createElement("span",{className:"util-cell-label"},s.details.label))),s?.edit&&o.createElement("td",null,o.createElement(t,{to:s.edit.path,className:"util-cell-link"},o.createElement(K,{className:"icon icon-pencil"}),o.createElement("span",{className:"util-cell-label"},s.edit.label))),s?.delete&&o.createElement("td",null,o.createElement("a",{onClick:()=>{s.delete?.onRemoveItem?.(e).then((()=>{r?.(e)})).catch((e=>{console.error(e);const t=e instanceof Error?e.message:"Error deleting item";alert(t)}))},className:"util-cell-link util-cell-link-remove"},o.createElement(q,{className:"icon icon-trash"}),o.createElement("span",{className:"util-cell-label"},s.delete.label))))})))):o.createElement(j,null))}function pe({pagination:e,onPageChange:t}){const{total:n,page:r,limit:a}=e,i=Math.floor(n/a);if(i<=1)return null;return o.createElement("div",{className:"pagination"},o.createElement("button",{onClick:()=>t(r-1),className:"pagination-item "+(1===r?"disabled":""),disabled:1===r,"aria-disabled":1===r},"Previous"),(()=>{const e=[];for(let n=1;n<=Math.min(2,i);n++)e.push(o.createElement("button",{key:n,onClick:()=>t(n),className:"pagination-item "+(r===n?"active":""),disabled:r===n},n));r-2>3&&e.push(o.createElement("span",{key:"ellipsis1",className:"pagination-ellipsis"},"..."));for(let n=Math.max(3,r-2);n<=Math.min(i-2,r+2);n++)n>2&&n<i-1&&e.push(o.createElement("button",{key:n,onClick:()=>t(n),className:"pagination-item "+(r===n?"active":""),disabled:r===n},n));r+2<i-2&&e.push(o.createElement("span",{key:"ellipsis2",className:"pagination-ellipsis"},"..."));for(let n=Math.max(i-1,3);n<=i;n++)n>2&&e.push(o.createElement("button",{key:n,onClick:()=>t(n),className:"pagination-item "+(r===n?"active":""),disabled:r===n},n));return e})(),o.createElement("button",{onClick:()=>t(r+1),className:"pagination-item "+(r===i?"disabled":""),disabled:r===i,"aria-disabled":r===i},"Next"))}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)}var de,me=function(e){return a.createElement("svg",fe({xmlns:"http://www.w3.org/2000/svg",width:800,height:800,viewBox:"0 0 24 24"},e),Z||(Z=a.createElement("path",{fill:"none",d:"M0 0h24v24H0z"})),ee||(ee=a.createElement("path",{d:"M21 14v5a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5v2H5v14h14v-5z"})),te||(te=a.createElement("path",{d:"M21 7h-4V3h-2v4h-4v2h4v4h2V9h4"})))};function he(){return he=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},he.apply(null,arguments)}var ye=function(e){return a.createElement("svg",he({xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e),de||(de=a.createElement("path",{d:"M22 3H2l8 9.46V19l4 2v-8.54z"})))};function ve({listPageMeta:e,filtered:n,onFilterClick:r,customHeader:a}){const s=i((()=>e.cells.filter((e=>!!e.filter))),[e.cells]),c=e.class.headers;return o.createElement("div",{className:"list-header"},o.createElement("div",{className:"header-title"},c?.title||"List"),a&&o.createElement("div",{className:"header-custom"},a),o.createElement("div",{className:"header-actions"},!!s.length&&o.createElement("button",{onClick:r,className:"filter-button"},o.createElement(ye,{className:"icon icon-filter "+(n?"active":"")}),"Filter"),c?.create&&o.createElement(t,{to:c.create.path,className:"create-button"},o.createElement(me,{className:"icon icon-create"}),c.create.label)))}function ge({field:e,value:t,onChange:n}){if("static-select"===e.filter?.type){const r=e.filter;return o.createElement(f,{id:e.name,menuPortalTarget:document.body,styles:{control:(e,t)=>({...e,backgroundColor:"#1f2937",borderColor:t.isFocused?"#6366f1":"#374151",boxShadow:t.isFocused?"0 0 0 1px #6366f1":"none","&:hover":{borderColor:"#6366f1"},borderRadius:"6px",padding:"2px",color:"white"}),option:(e,t)=>({...e,backgroundColor:t.isSelected?"#6366f1":t.isFocused?"#374151":"#1f2937",color:"white","&:active":{backgroundColor:"#6366f1"},"&:hover":{backgroundColor:"#374151"},cursor:"pointer"}),input:e=>({...e,color:"white"}),placeholder:e=>({...e,color:"#9ca3af"}),singleValue:e=>({...e,color:"white"}),menuPortal:e=>({...e,zIndex:9999}),menu:e=>({...e,backgroundColor:"#1f2937",border:"1px solid #374151",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)"}),menuList:e=>({...e,padding:"4px"}),dropdownIndicator:e=>({...e,color:"#9ca3af","&:hover":{color:"#6366f1"}}),clearIndicator:e=>({...e,color:"#9ca3af","&:hover":{color:"#6366f1"}})},value:t?{value:t,label:r.options.find((e=>e.value===t))?.label||t}:null,onChange:e=>n(e?.value||""),options:r.options.map((e=>({value:e.value,label:e.label}))),placeholder:`Filter by ${e.title||e.name}`,isClearable:!0})}return o.createElement("input",{type:"number"===e.type?"number":"text",id:e.name,value:t||"",onChange:e=>n(e.target.value),placeholder:`Filter by ${e.title||e.name}`})}function Ee({isOpen:e,onClose:t,onApplyFilters:n,listPageMeta:r,activeFilters:a}){const[s,u]=o.useState(a??{}),p=l(null),f=i((()=>r.cells.filter((e=>!!e.filter))),[r.cells]);if(c((()=>{const n=e=>{p.current&&!p.current.contains(e.target)&&t()};return e&&document.addEventListener("mousedown",n),()=>{document.removeEventListener("mousedown",n)}}),[e,t]),!e)return null;return o.createElement("div",{className:"filter-popup-overlay"},o.createElement("div",{ref:p,className:"filter-popup"},o.createElement("div",{className:"filter-popup-header"},o.createElement("h3",null,"Filter"),o.createElement("button",{onClick:t,className:"close-button"},"×")),o.createElement("div",{className:"filter-popup-content"},f.map((e=>o.createElement("div",{key:e.name,className:"filter-field"},o.createElement("label",{htmlFor:e.name},e.title||e.name),o.createElement(ge,{field:e,value:s[e.name||""],onChange:t=>((e,t)=>{u((n=>({...n,[e]:t})))})(e.name||"",t)}))))),o.createElement("div",{className:"filter-popup-footer"},o.createElement("button",{onClick:t,className:"cancel-button"},"Cancel"),o.createElement("button",{onClick:()=>{n(s),t()},className:"apply-button"},"Apply Filters"))))}function be(e,t,n){return(r,a)=>{const o=a.toString(),i=Reflect.getMetadata(e,r)||[];if(t){const s=`${e.toString()}:${o}:options`,c=n?n({target:r,propertyKey:a},t):t;Reflect.defineMetadata(e,[...i,o],r),Reflect.defineMetadata(s,c,r)}else Reflect.defineMetadata(e,[...i,o],r)}}const we=Symbol("cell"),Oe=({propertyKey:e},t)=>({...t,name:t.name||e.toString(),type:t.type||"string"});function Se(e){return be(we,e,Oe)}function _e(e){const t=e.prototype;return(Reflect.getMetadata(we,t)||[]).map((e=>Reflect.getMetadata(`${we.toString()}:${e}:options`,t)||{}))}const Me="ListMetaData";function xe(e){return t=>{e&&Reflect.defineMetadata(Me,e,t)}}function Ne(e){const t=Reflect.getMetadata(Me,e);if(!t)throw new Error("List decerator should be used on class");return{...t}}function Te({model:t,customHeader:r}){const a=i((()=>{return{class:Ne(e=t),cells:_e(e)};var e}),[t]),[l,p]=s(!0),[f,d]=s(null),[m,h]=s(null),[y,v]=s({total:0,page:0,limit:0}),[g,E]=s(!1),[b,w]=s(),O=e(),_=n(),M=u((async(e,t)=>{p(!0);try{const n=await a.class.getData({page:e,filters:t??b??{}});d(n.data),v({total:n.total,page:n.page,limit:n.limit})}catch(e){h(e),console.error(e)}finally{p(!1)}}),[b,a.class.getData]);c((()=>{const e=new URLSearchParams(location.search),t={};e.forEach(((e,n)=>{t[n]=e})),w(t)}),[location.search]),c((()=>{b&&M(parseInt(O.page)||1,b)}),[M,O.page,b,a.class.getData]);return l?o.createElement(P,null):m?o.createElement(S,{error:m}):o.createElement("div",{className:"list"},o.createElement(ve,{listPageMeta:a,filtered:!(!b||!Object.keys(b).length),onFilterClick:()=>E(!0),customHeader:r}),o.createElement(ue,{listPageMeta:a,data:f,onRemoveItem:async()=>{await M(y.page)}}),o.createElement("div",{className:"list-footer"},o.createElement(pe,{pagination:y,onPageChange:M})),o.createElement(Ee,{isOpen:g,activeFilters:b,onClose:()=>E(!1),onApplyFilters:e=>{w(e);const t=new URLSearchParams;Object.entries(e).forEach((([e,n])=>{null!=n&&""!==n&&t.append(e,String(n))}));const n=t.toString(),r=`${location.pathname}${n?`?${n}`:""}`;_(r),M(1,e)},listPageMeta:a}))}function ke(e,t){return be(we,e,(({target:e,propertyKey:n},r)=>({...Oe({propertyKey:n},r),...t?t({target:e,propertyKey:n},r):void 0})))}function Ae(e){return ke(e,((e,t)=>({...t,type:"image"})))}function Ce({input:e,maxLength:t=1}){const n=d(),[r,a]=s([]),i=e.name;c((()=>{n.setValue(e.name+"_files",r.length>0)}),[r,n,e.name]);return o.createElement("div",{className:"uploader-container"},o.createElement("button",{type:"button",className:"uploader-button",onClick:()=>document.getElementById(i)?.click()},"Upload Files"),o.createElement("input",{id:i,hidden:!0,name:e.name,onChange:e=>{if(t>1)throw new Error("TODO: Multiple file upload is not implemented yet");const n=e.target.files;if(n){const e=Array.from(n);a((t=>[...t,...e]))}},type:"file",multiple:!0}),r.length>0&&o.createElement("div",{className:"uploader-files"},r.map(((e,t)=>o.createElement("div",{key:`${e.name}-${t}`,className:"uploader-file"},o.createElement("p",null,e.name),o.createElement("p",null,(e.size/1024/1024).toFixed(2)," MB"),o.createElement("p",null,e.type||"Unknown type"),o.createElement("button",{onClick:()=>(e=>{a((t=>t.filter(((t,n)=>n!==e))))})(t),className:"remove-file-button",type:"button"},"Remove"))))))}function Le({label:e,fieldName:t,children:n,...r}){return o.createElement("label",{...r,className:"label "+r.className},o.createElement("span",null,e?e+":":t.charAt(0).toUpperCase()+t.slice(1)+":"),n)}function Pe({input:e,...t}){const{label:n,name:r}=e,a=d(),{register:i}=a;return o.createElement(Le,{className:"checkbox-label",htmlFor:r,label:n,fieldName:r},o.createElement("input",{type:"checkbox",id:r,className:"apple-switch",...t,...i(r,{setValueAs:e=>"on"===e})}))}const Ie={control:(e,t)=>({...e,backgroundColor:"#1f2937",borderColor:t.isFocused?"#6366f1":"#374151",boxShadow:t.isFocused?"0 0 0 1px #6366f1":"none","&:hover":{borderColor:"#6366f1"},borderRadius:"6px",padding:"2px",color:"white"}),option:(e,t)=>({...e,backgroundColor:t.isSelected?"#6366f1":t.isFocused?"#374151":"#1f2937",color:"white","&:active":{backgroundColor:"#6366f1"},"&:hover":{backgroundColor:"#374151"},cursor:"pointer"}),input:e=>({...e,color:"white"}),placeholder:e=>({...e,color:"#9ca3af"}),singleValue:e=>({...e,color:"white"}),menuPortal:e=>({...e,zIndex:9999}),menu:e=>({...e,backgroundColor:"#1f2937",border:"1px solid #374151",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)"}),menuList:e=>({...e,padding:"4px"}),dropdownIndicator:e=>({...e,color:"#9ca3af","&:hover":{color:"#6366f1"}}),clearIndicator:e=>({...e,color:"#9ca3af","&:hover":{color:"#6366f1"}})};function je({input:e,fieldName:t}){const n=e,{control:r}=d(),[a,i]=s(n.defaultOptions||[]),[l,u]=s(0);return c((()=>{n.onSelectPreloader&&n.onSelectPreloader().then((e=>{i(e),u(l+1)}))}),[e]),o.createElement(m,{name:t,control:r,render:({field:e})=>o.createElement(f,{key:l,options:a,styles:Ie,value:a.find((t=>t.value===e.value))||null,onChange:t=>{e.onChange(t?.value)}})})}function Ve({input:e,register:t}){const n=d(),r=n.getValues(e.name);return o.createElement("div",null,r?.map(((r,a)=>o.createElement("div",{key:a},e.nestedFields?.map((r=>o.createElement(De,{key:r.name?.toString()??"",baseName:e.name+"["+a+"]",input:r,register:t,error:e.name?{message:n.formState.errors[e.name]?.message}:void 0})))))))}function De({input:e,register:t,error:n,baseName:r,onSelectPreloader:a}){const i=(r?r.toString()+".":"")+e.name||"";return o.createElement("div",{className:"form-field"},"checkbox"!==e.type&&o.createElement(Le,{htmlFor:i,label:e.label,fieldName:i}),(()=>{switch(e.type){case"textarea":return o.createElement("textarea",{...t(i),placeholder:e.placeholder});case"select":return o.createElement(je,{input:e,fieldName:i});case"input":return o.createElement("input",{type:e.inputType,...t(i),placeholder:e.placeholder});case"file-upload":return o.createElement(Ce,{input:e});case"checkbox":return o.createElement(Pe,{input:e});case"hidden":return o.createElement("input",{type:"hidden",...t(i)});case"nested":return o.createElement(Ve,{input:e,register:t})}})(),n&&o.createElement("span",{className:"error-message"},n.message))}function Fe({inputs:e,formClass:t}){const[r,a]=s(null),i=l(null),c=n(),u=d();return o.createElement("div",{className:"form-wrapper"},o.createElement("form",{ref:i,onSubmit:u.handleSubmit((async e=>{try{const n="json"===t.type?e:(()=>{const t=new FormData(i.current);for(const n in e)t.get(n)||t.append(n,e[n]);return t})();await t.onSubmit(n),a(null),t.redirectBackOnSuccess&&c(-1)}catch(e){const t=e?.response?.data?.message||(e instanceof Error?e.message:"An error occurred");a(t),console.error(e)}}),((e,t)=>{console.log("error creating creation",e,t)}))},o.createElement("div",null,r&&o.createElement("div",{className:"error-message",style:{color:"red",marginBottom:"1rem"}},r),e?.map((e=>o.createElement(De,{key:e.name||"",input:e,register:u.register,error:e.name?{message:u.formState.errors[e.name]?.message}:void 0}))),o.createElement("button",{type:"submit",className:"submit-button"},"Submit"))))}const Re=Symbol("input");function $e(e){return(t,n)=>{const r=Reflect.getMetadata(Re,t)||[];if(Reflect.defineMetadata(Re,[...r,n.toString()],t),e){const r=`${Re.toString()}:${n.toString()}:options`;Reflect.defineMetadata(r,e,t)}}}function ze(e){const t=e.prototype;return(Reflect.getMetadata(Re,t)||[]).map((e=>{const n=Reflect.getMetadata(`${Re.toString()}:${e}:options`,t)||{},r=n?.inputType??(a=e,["password"].some((e=>a.toLowerCase().includes(e)))?"password":"text");var a;return{...n,editable:n.editable??!0,sensitive:n.sensitive,name:n?.name??e,label:n?.label??e,placeholder:n?.placeholder??e,inputType:r,type:n?.type??"input",selectOptions:n?.selectOptions??[]}}))}const Be="DetailsMetaData";function He(e){return t=>{e&&Reflect.defineMetadata(Be,e,t)}}function Ue(e){const t=Reflect.getMetadata(Be,e);if(!t)throw new Error("Form decerator should be used on class");return{...t,type:t.type??"json",redirectBackOnSuccess:t.redirectBackOnSuccess??!0}}const Ke=(e,t,n)=>{if(e&&"reportValidity"in e){const r=h(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},We=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?Ke(r.ref,n,e):r&&r.refs&&r.refs.forEach((t=>Ke(t,n,e)))}},Ge=(e,t)=>{t.shouldUseNativeValidation&&We(e,t);const n={};for(const r in e){const a=h(t.fields,r),o=Object.assign(e[r]||{},{ref:a&&a.ref});if(qe(t.names||Object.keys(e),r)){const e=Object.assign({},h(n,r));y(e,"root",o),y(n,r,e)}else y(n,r,o)}return n},qe=(e,t)=>{const n=Je(t);return e.some((e=>Je(e).match(`^${n}\\.\\d+`)))};function Je(e){return e.replace(/\]|\[/g,"")}var Ye;!function(e){e[e.PLAIN_TO_CLASS=0]="PLAIN_TO_CLASS",e[e.CLASS_TO_PLAIN=1]="CLASS_TO_PLAIN",e[e.CLASS_TO_CLASS=2]="CLASS_TO_CLASS"}(Ye||(Ye={}));var Qe=function(){function e(){this._typeMetadatas=new Map,this._transformMetadatas=new Map,this._exposeMetadatas=new Map,this._excludeMetadatas=new Map,this._ancestorsMap=new Map}return e.prototype.addTypeMetadata=function(e){this._typeMetadatas.has(e.target)||this._typeMetadatas.set(e.target,new Map),this._typeMetadatas.get(e.target).set(e.propertyName,e)},e.prototype.addTransformMetadata=function(e){this._transformMetadatas.has(e.target)||this._transformMetadatas.set(e.target,new Map),this._transformMetadatas.get(e.target).has(e.propertyName)||this._transformMetadatas.get(e.target).set(e.propertyName,[]),this._transformMetadatas.get(e.target).get(e.propertyName).push(e)},e.prototype.addExposeMetadata=function(e){this._exposeMetadatas.has(e.target)||this._exposeMetadatas.set(e.target,new Map),this._exposeMetadatas.get(e.target).set(e.propertyName,e)},e.prototype.addExcludeMetadata=function(e){this._excludeMetadatas.has(e.target)||this._excludeMetadatas.set(e.target,new Map),this._excludeMetadatas.get(e.target).set(e.propertyName,e)},e.prototype.findTransformMetadatas=function(e,t,n){return this.findMetadatas(this._transformMetadatas,e,t).filter((function(e){return!e.options||(!0===e.options.toClassOnly&&!0===e.options.toPlainOnly||(!0===e.options.toClassOnly?n===Ye.CLASS_TO_CLASS||n===Ye.PLAIN_TO_CLASS:!0!==e.options.toPlainOnly||n===Ye.CLASS_TO_PLAIN))}))},e.prototype.findExcludeMetadata=function(e,t){return this.findMetadata(this._excludeMetadatas,e,t)},e.prototype.findExposeMetadata=function(e,t){return this.findMetadata(this._exposeMetadatas,e,t)},e.prototype.findExposeMetadataByCustomName=function(e,t){return this.getExposedMetadatas(e).find((function(e){return e.options&&e.options.name===t}))},e.prototype.findTypeMetadata=function(e,t){return this.findMetadata(this._typeMetadatas,e,t)},e.prototype.getStrategy=function(e){var t=this._excludeMetadatas.get(e),n=t&&t.get(void 0),r=this._exposeMetadatas.get(e),a=r&&r.get(void 0);return n&&a||!n&&!a?"none":n?"excludeAll":"exposeAll"},e.prototype.getExposedMetadatas=function(e){return this.getMetadata(this._exposeMetadatas,e)},e.prototype.getExcludedMetadatas=function(e){return this.getMetadata(this._excludeMetadatas,e)},e.prototype.getExposedProperties=function(e,t){return this.getExposedMetadatas(e).filter((function(e){return!e.options||(!0===e.options.toClassOnly&&!0===e.options.toPlainOnly||(!0===e.options.toClassOnly?t===Ye.CLASS_TO_CLASS||t===Ye.PLAIN_TO_CLASS:!0!==e.options.toPlainOnly||t===Ye.CLASS_TO_PLAIN))})).map((function(e){return e.propertyName}))},e.prototype.getExcludedProperties=function(e,t){return this.getExcludedMetadatas(e).filter((function(e){return!e.options||(!0===e.options.toClassOnly&&!0===e.options.toPlainOnly||(!0===e.options.toClassOnly?t===Ye.CLASS_TO_CLASS||t===Ye.PLAIN_TO_CLASS:!0!==e.options.toPlainOnly||t===Ye.CLASS_TO_PLAIN))})).map((function(e){return e.propertyName}))},e.prototype.clear=function(){this._typeMetadatas.clear(),this._exposeMetadatas.clear(),this._excludeMetadatas.clear(),this._ancestorsMap.clear()},e.prototype.getMetadata=function(e,t){var n,r=e.get(t);r&&(n=Array.from(r.values()).filter((function(e){return void 0!==e.propertyName})));for(var a=[],o=0,i=this.getAncestors(t);o<i.length;o++){var s=i[o],c=e.get(s);if(c){var l=Array.from(c.values()).filter((function(e){return void 0!==e.propertyName}));a.push.apply(a,l)}}return a.concat(n||[])},e.prototype.findMetadata=function(e,t,n){var r=e.get(t);if(r){var a=r.get(n);if(a)return a}for(var o=0,i=this.getAncestors(t);o<i.length;o++){var s=i[o],c=e.get(s);if(c){var l=c.get(n);if(l)return l}}},e.prototype.findMetadatas=function(e,t,n){var r,a=e.get(t);a&&(r=a.get(n));for(var o=[],i=0,s=this.getAncestors(t);i<s.length;i++){var c=s[i],l=e.get(c);l&&l.has(n)&&o.push.apply(o,l.get(n))}return o.slice().reverse().concat((r||[]).slice().reverse())},e.prototype.getAncestors=function(e){if(!e)return[];if(!this._ancestorsMap.has(e)){for(var t=[],n=Object.getPrototypeOf(e.prototype.constructor);void 0!==n.prototype;n=Object.getPrototypeOf(n.prototype.constructor))t.push(n);this._ancestorsMap.set(e,t)}return this._ancestorsMap.get(e)},e}(),Xe=new Qe;var Ze=function(e,t,n){if(n||2===arguments.length)for(var r,a=0,o=t.length;a<o;a++)!r&&a in t||(r||(r=Array.prototype.slice.call(t,0,a)),r[a]=t[a]);return e.concat(r||Array.prototype.slice.call(t))};var et=function(){function e(e,t){this.transformationType=e,this.options=t,this.recursionStack=new Set}return e.prototype.transform=function(e,t,n,r,a,o){var i,s=this;if(void 0===o&&(o=0),Array.isArray(t)||t instanceof Set){var c=r&&this.transformationType===Ye.PLAIN_TO_CLASS?function(e){var t=new e;return t instanceof Set||"push"in t?t:[]}(r):[];return t.forEach((function(t,r){var a=e?e[r]:void 0;if(s.options.enableCircularCheck&&s.isCircular(t))s.transformationType===Ye.CLASS_TO_CLASS&&(c instanceof Set?c.add(t):c.push(t));else{var i=void 0;if("function"!=typeof n&&n&&n.options&&n.options.discriminator&&n.options.discriminator.property&&n.options.discriminator.subTypes){if(s.transformationType===Ye.PLAIN_TO_CLASS){i=n.options.discriminator.subTypes.find((function(e){return e.name===t[n.options.discriminator.property]}));var l={newObject:c,object:t,property:void 0},u=n.typeFunction(l);i=void 0===i?u:i.value,n.options.keepDiscriminatorProperty||delete t[n.options.discriminator.property]}s.transformationType===Ye.CLASS_TO_CLASS&&(i=t.constructor),s.transformationType===Ye.CLASS_TO_PLAIN&&(t[n.options.discriminator.property]=n.options.discriminator.subTypes.find((function(e){return e.value===t.constructor})).name)}else i=n;var p=s.transform(a,t,i,void 0,t instanceof Map,o+1);c instanceof Set?c.add(p):c.push(p)}})),c}if(n!==String||a){if(n!==Number||a){if(n!==Boolean||a){if((n===Date||t instanceof Date)&&!a)return t instanceof Date?new Date(t.valueOf()):null==t?t:new Date(t);if(("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:void 0).Buffer&&(n===Buffer||t instanceof Buffer)&&!a)return null==t?t:Buffer.from(t);if(null===(i=t)||"object"!=typeof i||"function"!=typeof i.then||a){if(a||null===t||"object"!=typeof t||"function"!=typeof t.then){if("object"==typeof t&&null!==t){n||t.constructor===Object||(Array.isArray(t)||t.constructor!==Array)&&(n=t.constructor),!n&&e&&(n=e.constructor),this.options.enableCircularCheck&&this.recursionStack.add(t);var l=this.getKeys(n,t,a),u=e||{};e||this.transformationType!==Ye.PLAIN_TO_CLASS&&this.transformationType!==Ye.CLASS_TO_CLASS||(u=a?new Map:n?new n:{});for(var p=function(r){if("__proto__"===r||"constructor"===r)return"continue";var i=r,s=r,c=r;if(!f.options.ignoreDecorators&&n)if(f.transformationType===Ye.PLAIN_TO_CLASS)(l=Xe.findExposeMetadataByCustomName(n,r))&&(c=l.propertyName,s=l.propertyName);else if(f.transformationType===Ye.CLASS_TO_PLAIN||f.transformationType===Ye.CLASS_TO_CLASS){var l;(l=Xe.findExposeMetadata(n,r))&&l.options&&l.options.name&&(s=l.options.name)}var p=void 0;p=f.transformationType===Ye.PLAIN_TO_CLASS?t[i]:t instanceof Map?t.get(i):t[i]instanceof Function?t[i]():t[i];var d=void 0,m=p instanceof Map;if(n&&a)d=n;else if(n){var h=Xe.findTypeMetadata(n,c);if(h){var y={newObject:u,object:t,property:c},v=h.typeFunction?h.typeFunction(y):h.reflectedType;h.options&&h.options.discriminator&&h.options.discriminator.property&&h.options.discriminator.subTypes?t[i]instanceof Array?d=h:(f.transformationType===Ye.PLAIN_TO_CLASS&&(d=void 0===(d=h.options.discriminator.subTypes.find((function(e){if(p&&p instanceof Object&&h.options.discriminator.property in p)return e.name===p[h.options.discriminator.property]})))?v:d.value,h.options.keepDiscriminatorProperty||p&&p instanceof Object&&h.options.discriminator.property in p&&delete p[h.options.discriminator.property]),f.transformationType===Ye.CLASS_TO_CLASS&&(d=p.constructor),f.transformationType===Ye.CLASS_TO_PLAIN&&p&&(p[h.options.discriminator.property]=h.options.discriminator.subTypes.find((function(e){return e.value===p.constructor})).name)):d=v,m=m||h.reflectedType===Map}else if(f.options.targetMaps)f.options.targetMaps.filter((function(e){return e.target===n&&!!e.properties[c]})).forEach((function(e){return d=e.properties[c]}));else if(f.options.enableImplicitConversion&&f.transformationType===Ye.PLAIN_TO_CLASS){var g=Reflect.getMetadata("design:type",n.prototype,c);g&&(d=g)}}var E=Array.isArray(t[i])?f.getReflectedType(n,c):void 0,b=e?e[i]:void 0;if(u.constructor.prototype){var w=Object.getOwnPropertyDescriptor(u.constructor.prototype,s);if((f.transformationType===Ye.PLAIN_TO_CLASS||f.transformationType===Ye.CLASS_TO_CLASS)&&(w&&!w.set||u[s]instanceof Function))return"continue"}if(f.options.enableCircularCheck&&f.isCircular(p)){if(f.transformationType===Ye.CLASS_TO_CLASS){S=p;(void 0!==(S=f.applyCustomTransformations(S,n,r,t,f.transformationType))||f.options.exposeUnsetFields)&&(u instanceof Map?u.set(s,S):u[s]=S)}}else{var O=f.transformationType===Ye.PLAIN_TO_CLASS?s:r,S=void 0;f.transformationType===Ye.CLASS_TO_PLAIN?(S=t[O],S=f.applyCustomTransformations(S,n,O,t,f.transformationType),S=t[O]===S?p:S,S=f.transform(b,S,d,E,m,o+1)):void 0===p&&f.options.exposeDefaultValues?S=u[s]:(S=f.transform(b,p,d,E,m,o+1),S=f.applyCustomTransformations(S,n,O,t,f.transformationType)),(void 0!==S||f.options.exposeUnsetFields)&&(u instanceof Map?u.set(s,S):u[s]=S)}},f=this,d=0,m=l;d<m.length;d++){p(m[d])}return this.options.enableCircularCheck&&this.recursionStack.delete(t),u}return t}return t}return new Promise((function(e,r){t.then((function(t){return e(s.transform(void 0,t,n,void 0,void 0,o+1))}),r)}))}return null==t?t:Boolean(t)}return null==t?t:Number(t)}return null==t?t:String(t)},e.prototype.applyCustomTransformations=function(e,t,n,r,a){var o=this,i=Xe.findTransformMetadatas(t,n,this.transformationType);return void 0!==this.options.version&&(i=i.filter((function(e){return!e.options||o.checkVersion(e.options.since,e.options.until)}))),(i=this.options.groups&&this.options.groups.length?i.filter((function(e){return!e.options||o.checkGroups(e.options.groups)})):i.filter((function(e){return!e.options||!e.options.groups||!e.options.groups.length}))).forEach((function(t){e=t.transformFn({value:e,key:n,obj:r,type:a,options:o.options})})),e},e.prototype.isCircular=function(e){return this.recursionStack.has(e)},e.prototype.getReflectedType=function(e,t){if(e){var n=Xe.findTypeMetadata(e,t);return n?n.reflectedType:void 0}},e.prototype.getKeys=function(e,t,n){var r=this,a=Xe.getStrategy(e);"none"===a&&(a=this.options.strategy||"exposeAll");var o=[];if(("exposeAll"===a||n)&&(o=t instanceof Map?Array.from(t.keys()):Object.keys(t)),n)return o;if(this.options.ignoreDecorators&&this.options.excludeExtraneousValues&&e){var i=Xe.getExposedProperties(e,this.transformationType),s=Xe.getExcludedProperties(e,this.transformationType);o=Ze(Ze([],i,!0),s,!0)}if(!this.options.ignoreDecorators&&e){i=Xe.getExposedProperties(e,this.transformationType);this.transformationType===Ye.PLAIN_TO_CLASS&&(i=i.map((function(t){var n=Xe.findExposeMetadata(e,t);return n&&n.options&&n.options.name?n.options.name:t}))),o=this.options.excludeExtraneousValues?i:o.concat(i);var c=Xe.getExcludedProperties(e,this.transformationType);c.length>0&&(o=o.filter((function(e){return!c.includes(e)}))),void 0!==this.options.version&&(o=o.filter((function(t){var n=Xe.findExposeMetadata(e,t);return!n||!n.options||r.checkVersion(n.options.since,n.options.until)}))),o=this.options.groups&&this.options.groups.length?o.filter((function(t){var n=Xe.findExposeMetadata(e,t);return!n||!n.options||r.checkGroups(n.options.groups)})):o.filter((function(t){var n=Xe.findExposeMetadata(e,t);return!(n&&n.options&&n.options.groups&&n.options.groups.length)}))}return this.options.excludePrefixes&&this.options.excludePrefixes.length&&(o=o.filter((function(e){return r.options.excludePrefixes.every((function(t){return e.substr(0,t.length)!==t}))}))),o=o.filter((function(e,t,n){return n.indexOf(e)===t}))},e.prototype.checkVersion=function(e,t){var n=!0;return n&&e&&(n=this.options.version>=e),n&&t&&(n=this.options.version<t),n},e.prototype.checkGroups=function(e){return!e||this.options.groups.some((function(t){return e.includes(t)}))},e}(),tt={enableCircularCheck:!1,enableImplicitConversion:!1,excludeExtraneousValues:!1,excludePrefixes:void 0,exposeDefaultValues:!1,exposeUnsetFields:!0,groups:void 0,ignoreDecorators:!1,strategy:void 0,targetMaps:void 0,version:void 0},nt=function(){return nt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},nt.apply(this,arguments)},rt=new(function(){function e(){}return e.prototype.instanceToPlain=function(e,t){return new et(Ye.CLASS_TO_PLAIN,nt(nt({},tt),t)).transform(void 0,e,void 0,void 0,void 0,void 0)},e.prototype.classToPlainFromExist=function(e,t,n){return new et(Ye.CLASS_TO_PLAIN,nt(nt({},tt),n)).transform(t,e,void 0,void 0,void 0,void 0)},e.prototype.plainToInstance=function(e,t,n){return new et(Ye.PLAIN_TO_CLASS,nt(nt({},tt),n)).transform(void 0,t,e,void 0,void 0,void 0)},e.prototype.plainToClassFromExist=function(e,t,n){return new et(Ye.PLAIN_TO_CLASS,nt(nt({},tt),n)).transform(e,t,void 0,void 0,void 0,void 0)},e.prototype.instanceToInstance=function(e,t){return new et(Ye.CLASS_TO_CLASS,nt(nt({},tt),t)).transform(void 0,e,void 0,void 0,void 0,void 0)},e.prototype.classToClassFromExist=function(e,t,n){return new et(Ye.CLASS_TO_CLASS,nt(nt({},tt),n)).transform(t,e,void 0,void 0,void 0,void 0)},e.prototype.serialize=function(e,t){return JSON.stringify(this.instanceToPlain(e,t))},e.prototype.deserialize=function(e,t,n){var r=JSON.parse(t);return this.plainToInstance(e,r,n)},e.prototype.deserializeArray=function(e,t,n){var r=JSON.parse(t);return this.plainToInstance(e,r,n)},e}());var at=function(e){this.groups=[],this.each=!1,this.context=void 0,this.type=e.type,this.name=e.name,this.target=e.target,this.propertyName=e.propertyName,this.constraints=null==e?void 0:e.constraints,this.constraintCls=e.constraintCls,this.validationTypeOptions=e.validationTypeOptions,e.validationOptions&&(this.message=e.validationOptions.message,this.groups=e.validationOptions.groups,this.always=e.validationOptions.always,this.each=e.validationOptions.each,this.context=e.validationOptions.context)},ot=function(){function e(){}return e.prototype.transform=function(e){var t=[];return Object.keys(e.properties).forEach((function(n){e.properties[n].forEach((function(r){var a={message:r.message,groups:r.groups,always:r.always,each:r.each},o={type:r.type,name:r.name,target:e.name,propertyName:n,constraints:r.constraints,validationTypeOptions:r.options,validationOptions:a};t.push(new at(o))}))})),t},e}();function it(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:void 0}function st(e){return null!==e&&"object"==typeof e&&"function"==typeof e.then}var ct=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},lt=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,a,o=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(e){a={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(a)throw a.error}}return i},ut=function(e,t,n){if(n||2===arguments.length)for(var r,a=0,o=t.length;a<o;a++)!r&&a in t||(r||(r=Array.prototype.slice.call(t,0,a)),r[a]=t[a]);return e.concat(r||Array.prototype.slice.call(t))},pt=function(){function e(){this.validationMetadatas=new Map,this.constraintMetadatas=new Map}return Object.defineProperty(e.prototype,"hasValidationMetaData",{get:function(){return!!this.validationMetadatas.size},enumerable:!1,configurable:!0}),e.prototype.addValidationSchema=function(e){var t=this;(new ot).transform(e).forEach((function(e){return t.addValidationMetadata(e)}))},e.prototype.addValidationMetadata=function(e){var t=this.validationMetadatas.get(e.target);t?t.push(e):this.validationMetadatas.set(e.target,[e])},e.prototype.addConstraintMetadata=function(e){var t=this.constraintMetadatas.get(e.target);t?t.push(e):this.constraintMetadatas.set(e.target,[e])},e.prototype.groupByPropertyName=function(e){var t={};return e.forEach((function(e){t[e.propertyName]||(t[e.propertyName]=[]),t[e.propertyName].push(e)})),t},e.prototype.getTargetValidationMetadatas=function(e,t,n,r,a){var o,i,s=function(e){return void 0!==e.always?e.always:(!e.groups||!e.groups.length)&&n},c=function(e){return!(!r||a&&a.length||!e.groups||!e.groups.length)},l=(this.validationMetadatas.get(e)||[]).filter((function(n){return(n.target===e||n.target===t)&&(!!s(n)||!c(n)&&(!(a&&a.length>0)||n.groups&&!!n.groups.find((function(e){return-1!==a.indexOf(e)}))))})),u=[];try{for(var p=ct(this.validationMetadatas.entries()),f=p.next();!f.done;f=p.next()){var d=lt(f.value,2),m=d[0],h=d[1];e.prototype instanceof m&&u.push.apply(u,ut([],lt(h),!1))}}catch(e){o={error:e}}finally{try{f&&!f.done&&(i=p.return)&&i.call(p)}finally{if(o)throw o.error}}var y=u.filter((function(t){return"string"!=typeof t.target&&(t.target!==e&&((!(t.target instanceof Function)||e.prototype instanceof t.target)&&(!!s(t)||!c(t)&&(!(a&&a.length>0)||t.groups&&!!t.groups.find((function(e){return-1!==a.indexOf(e)}))))))})).filter((function(e){return!l.find((function(t){return t.propertyName===e.propertyName&&t.type===e.type}))}));return l.concat(y)},e.prototype.getTargetValidatorConstraints=function(e){return this.constraintMetadatas.get(e)||[]},e}();var ft=function(){function e(){}return e.prototype.toString=function(e,t,n,r){var a=this;void 0===e&&(e=!1),void 0===t&&(t=!1),void 0===n&&(n=""),void 0===r&&(r=!1);var o=e?"[1m":"",i=e?"[22m":"",s=function(e){return" - property ".concat(o).concat(n).concat(e).concat(i," has failed the following constraints: ").concat(o).concat((r?Object.values:Object.keys)(null!==(t=a.constraints)&&void 0!==t?t:{}).join(", ")).concat(i," \n");var t};if(t){var c=Number.isInteger(+this.property)?"[".concat(this.property,"]"):"".concat(n?".":"").concat(this.property);return this.constraints?s(c):this.children?this.children.map((function(t){return t.toString(e,!0,"".concat(n).concat(c),r)})).join(""):""}return"An instance of ".concat(o).concat(this.target?this.target.constructor.name:"an object").concat(i," has failed the validation:\n")+(this.constraints?s(this.property):"")+(this.children?this.children.map((function(t){return t.toString(e,!0,a.property,r)})).join(""):"")},e}(),dt=function(){function e(){}return e.isValid=function(e){var t=this;return"isValid"!==e&&"getMessage"!==e&&-1!==Object.keys(this).map((function(e){return t[e]})).indexOf(e)},e.CUSTOM_VALIDATION="customValidation",e.NESTED_VALIDATION="nestedValidation",e.PROMISE_VALIDATION="promiseValidation",e.CONDITIONAL_VALIDATION="conditionalValidation",e.WHITELIST="whitelistValidation",e.IS_DEFINED="isDefined",e}();var mt=function(){function e(){}return e.replaceMessageSpecialTokens=function(e,t){var n;return e instanceof Function?n=e(t):"string"==typeof e&&(n=e),n&&Array.isArray(t.constraints)&&t.constraints.forEach((function(e,t){n=n.replace(new RegExp("\\$constraint".concat(t+1),"g"),function(e){return Array.isArray(e)?e.join(", "):("symbol"==typeof e&&(e=e.description),"".concat(e))}(e))})),n&&void 0!==t.value&&null!==t.value&&["string","boolean","number"].includes(typeof t.value)&&(n=n.replace(/\$value/g,t.value)),n&&(n=n.replace(/\$property/g,t.property)),n&&(n=n.replace(/\$target/g,t.targetName)),n},e}(),ht=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,a,o=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(e){a={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(a)throw a.error}}return i},yt=function(){function e(e,t){this.validator=e,this.validatorOptions=t,this.awaitingPromises=[],this.ignoreAsyncValidations=!1,this.metadataStorage=function(){var e=it();return e.classValidatorMetadataStorage||(e.classValidatorMetadataStorage=new pt),e.classValidatorMetadataStorage}()}return e.prototype.execute=function(e,t,n){var r,a,o=this;this.metadataStorage.hasValidationMetaData||!0!==(null===(r=this.validatorOptions)||void 0===r?void 0:r.enableDebugMessages)||console.warn("No validation metadata found. No validation will be performed. There are multiple possible reasons:\n - There may be multiple class-validator versions installed. You will need to flatten your dependencies to fix the issue.\n - This validation runs before any file with validation decorator was parsed by NodeJS.");var i=this.validatorOptions?this.validatorOptions.groups:void 0,s=this.validatorOptions&&this.validatorOptions.strictGroups||!1,c=this.validatorOptions&&this.validatorOptions.always||!1,l=void 0===(null===(a=this.validatorOptions)||void 0===a?void 0:a.forbidUnknownValues)||!1!==this.validatorOptions.forbidUnknownValues,u=this.metadataStorage.getTargetValidationMetadatas(e.constructor,t,c,s,i),p=this.metadataStorage.groupByPropertyName(u);if(this.validatorOptions&&l&&!u.length){var f=new ft;return this.validatorOptions&&this.validatorOptions.validationError&&void 0!==this.validatorOptions.validationError.target&&!0!==this.validatorOptions.validationError.target||(f.target=e),f.value=void 0,f.property=void 0,f.children=[],f.constraints={unknownValue:"an unknown value was passed to the validate function"},void n.push(f)}this.validatorOptions&&this.validatorOptions.whitelist&&this.whitelist(e,p,n),Object.keys(p).forEach((function(t){var r=e[t],a=p[t].filter((function(e){return e.type===dt.IS_DEFINED})),i=p[t].filter((function(e){return e.type!==dt.IS_DEFINED&&e.type!==dt.WHITELIST}));r instanceof Promise&&i.find((function(e){return e.type===dt.PROMISE_VALIDATION}))?o.awaitingPromises.push(r.then((function(r){o.performValidations(e,r,t,a,i,n)}))):o.performValidations(e,r,t,a,i,n)}))},e.prototype.whitelist=function(e,t,n){var r=this,a=[];Object.keys(e).forEach((function(e){t[e]&&0!==t[e].length||a.push(e)})),a.length>0&&(this.validatorOptions&&this.validatorOptions.forbidNonWhitelisted?a.forEach((function(t){var a,o=r.generateValidationError(e,e[t],t);o.constraints=((a={})[dt.WHITELIST]="property ".concat(t," should not exist"),a),o.children=void 0,n.push(o)})):a.forEach((function(t){return delete e[t]})))},e.prototype.stripEmptyErrors=function(e){var t=this;return e.filter((function(e){if(e.children&&(e.children=t.stripEmptyErrors(e.children)),0===Object.keys(e.constraints).length){if(0===e.children.length)return!1;delete e.constraints}return!0}))},e.prototype.performValidations=function(e,t,n,r,a,o){var i=a.filter((function(e){return e.type===dt.CUSTOM_VALIDATION})),s=a.filter((function(e){return e.type===dt.NESTED_VALIDATION})),c=a.filter((function(e){return e.type===dt.CONDITIONAL_VALIDATION})),l=this.generateValidationError(e,t,n);o.push(l),this.conditionalValidations(e,t,c)&&(this.customValidations(e,t,r,l),this.mapContexts(e,t,r,l),void 0===t&&this.validatorOptions&&!0===this.validatorOptions.skipUndefinedProperties||null===t&&this.validatorOptions&&!0===this.validatorOptions.skipNullProperties||null==t&&this.validatorOptions&&!0===this.validatorOptions.skipMissingProperties||(this.customValidations(e,t,i,l),this.nestedValidations(t,s,l),this.mapContexts(e,t,a,l),this.mapContexts(e,t,i,l)))},e.prototype.generateValidationError=function(e,t,n){var r=new ft;return this.validatorOptions&&this.validatorOptions.validationError&&void 0!==this.validatorOptions.validationError.target&&!0!==this.validatorOptions.validationError.target||(r.target=e),this.validatorOptions&&this.validatorOptions.validationError&&void 0!==this.validatorOptions.validationError.value&&!0!==this.validatorOptions.validationError.value||(r.value=t),r.property=n,r.children=[],r.constraints={},r},e.prototype.conditionalValidations=function(e,t,n){return n.map((function(n){return n.constraints[0](e,t)})).reduce((function(e,t){return e&&t}),!0)},e.prototype.customValidations=function(e,t,n,r){var a=this;n.forEach((function(n){a.metadataStorage.getTargetValidatorConstraints(n.constraintCls).forEach((function(o){if(!(o.async&&a.ignoreAsyncValidations||a.validatorOptions&&a.validatorOptions.stopAtFirstError&&Object.keys(r.constraints||{}).length>0)){var i={targetName:e.constructor?e.constructor.name:void 0,property:n.propertyName,object:e,value:t,constraints:n.constraints};if(n.each&&(Array.isArray(t)||t instanceof Set||t instanceof Map)){var s,c=((s=t)instanceof Map?Array.from(s.values()):Array.isArray(s)?s:Array.from(s)).map((function(e){return o.instance.validate(e,i)}));if(c.some((function(e){return st(e)}))){var l=c.map((function(e){return st(e)?e:Promise.resolve(e)})),u=Promise.all(l).then((function(i){if(!i.every((function(e){return e}))){var s=ht(a.createValidationError(e,t,n,o),2),c=s[0],l=s[1];r.constraints[c]=l,n.context&&(r.contexts||(r.contexts={}),r.contexts[c]=Object.assign(r.contexts[c]||{},n.context))}}));a.awaitingPromises.push(u)}else{if(!c.every((function(e){return e}))){var p=ht(a.createValidationError(e,t,n,o),2);h=p[0],y=p[1];r.constraints[h]=y}}}else{var f=o.instance.validate(t,i);if(st(f)){var d=f.then((function(i){if(!i){var s=ht(a.createValidationError(e,t,n,o),2),c=s[0],l=s[1];r.constraints[c]=l,n.context&&(r.contexts||(r.contexts={}),r.contexts[c]=Object.assign(r.contexts[c]||{},n.context))}}));a.awaitingPromises.push(d)}else if(!f){var m=ht(a.createValidationError(e,t,n,o),2),h=m[0],y=m[1];r.constraints[h]=y}}}}))}))},e.prototype.nestedValidations=function(e,t,n){var r=this;void 0!==e&&t.forEach((function(a){if((a.type===dt.NESTED_VALIDATION||a.type===dt.PROMISE_VALIDATION)&&!(r.validatorOptions&&r.validatorOptions.stopAtFirstError&&Object.keys(n.constraints||{}).length>0))if(Array.isArray(e)||e instanceof Set||e instanceof Map)(e instanceof Set?Array.from(e):e).forEach((function(a,o){r.performValidations(e,a,o.toString(),[],t,n.children)}));else if(e instanceof Object){var o="string"==typeof a.target?a.target:a.target.name;r.execute(e,o,n.children)}else{var i=ht(r.createValidationError(a.target,e,a),2),s=i[0],c=i[1];n.constraints[s]=c}}))},e.prototype.mapContexts=function(e,t,n,r){var a=this;return n.forEach((function(e){if(e.context){var t=void 0;if(e.type===dt.CUSTOM_VALIDATION)t=a.metadataStorage.getTargetValidatorConstraints(e.constraintCls)[0];var n=a.getConstraintType(e,t);r.constraints[n]&&(r.contexts||(r.contexts={}),r.contexts[n]=Object.assign(r.contexts[n]||{},e.context))}}))},e.prototype.createValidationError=function(e,t,n,r){var a=e.constructor?e.constructor.name:void 0,o=this.getConstraintType(n,r),i={targetName:a,property:n.propertyName,object:e,value:t,constraints:n.constraints},s=n.message||"";return n.message||this.validatorOptions&&(!this.validatorOptions||this.validatorOptions.dismissDefaultMessages)||r&&r.instance.defaultMessage instanceof Function&&(s=r.instance.defaultMessage(i)),[o,mt.replaceMessageSpecialTokens(s,i)]},e.prototype.getConstraintType=function(e,t){return t&&t.name?t.name:e.type},e}(),vt=function(e,t,n,r){return new(n||(n=Promise))((function(a,o){function i(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}c((r=r.apply(e,t||[])).next())}))},gt=function(e,t){var n,r,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(i=0)),i;)try{if(n=1,r&&(a=2&s[0]?r.return:s[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,s[1])).done)return a;switch(r=0,a&&(s=[2&s[0],a.value]),s[0]){case 0:case 1:a=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,r=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(a=i.trys,(a=a.length>0&&a[a.length-1])||6!==s[0]&&2!==s[0])){i=0;continue}if(3===s[0]&&(!a||s[1]>a[0]&&s[1]<a[3])){i.label=s[1];break}if(6===s[0]&&i.label<a[1]){i.label=a[1],a=s;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(s);break}a[2]&&i.ops.pop(),i.trys.pop();continue}s=t.call(e,i)}catch(e){s=[6,e],r=0}finally{n=a=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},Et=function(){function e(){}return e.prototype.validate=function(e,t,n){return this.coreValidate(e,t,n)},e.prototype.validateOrReject=function(e,t,n){return vt(this,void 0,void 0,(function(){var r;return gt(this,(function(a){switch(a.label){case 0:return[4,this.coreValidate(e,t,n)];case 1:return(r=a.sent()).length?[2,Promise.reject(r)]:[2]}}))}))},e.prototype.validateSync=function(e,t,n){var r="string"==typeof e?t:e,a="string"==typeof e?e:void 0,o=new yt(this,"string"==typeof e?n:t);o.ignoreAsyncValidations=!0;var i=[];return o.execute(r,a,i),o.stripEmptyErrors(i)},e.prototype.coreValidate=function(e,t,n){var r="string"==typeof e?t:e,a="string"==typeof e?e:void 0,o=new yt(this,"string"==typeof e?n:t),i=[];return o.execute(r,a,i),Promise.all(o.awaitingPromises).then((function(){return o.stripEmptyErrors(i)}))},e}(),bt=new(function(){function e(){this.instances=[]}return e.prototype.get=function(e){var t=this.instances.find((function(t){return t.type===e}));return t||(t={type:e,object:new e},this.instances.push(t)),t.object},e}());function wt(e){return bt.get(e)}function Ot(e,t,n){return"string"==typeof e?wt(Et).validate(e,t,n):wt(Et).validate(e,t)}function St(e,t,n){return"string"==typeof e?wt(Et).validateSync(e,t,n):wt(Et).validateSync(e,t)}function _t(e,t,n,r){return void 0===n&&(n={}),void 0===r&&(r=""),e.reduce((function(e,n){var a=r?r+"."+n.property:n.property;if(n.constraints){var o=Object.keys(n.constraints)[0];e[a]={type:o,message:n.constraints[o]};var i=e[a];t&&i&&Object.assign(i,{types:n.constraints})}return n.children&&n.children.length&&_t(n.children,t,e,a),e}),n)}function Mt(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),function(r,a,o){try{var i=t.validator,s=(c=e,l=r,u=t.transformer,rt.plainToInstance(c,l,u));return Promise.resolve(("sync"===n.mode?St:Ot)(s,i)).then((function(e){return e.length?{values:{},errors:Ge(_t(e,!o.shouldUseNativeValidation&&"all"===o.criteriaMode),o)}:(o.shouldUseNativeValidation&&We({},o),{values:n.raw?Object.assign({},r):s,errors:{}})}))}catch(e){return Promise.reject(e)}var c,l,u}}function xt({model:t}){const{class:n,inputs:r,resolver:a}=i((()=>{return{resolver:Mt(e=t),class:Ue(e),inputs:ze(e)};var e}),[t]),s=v({resolver:a}),l=e();return c((()=>{n.getDetailsData&&n.getDetailsData(l).then((e=>{s.reset(e)}))}),[l,s.reset,n.getDetailsData]),o.createElement(g,{...s},o.createElement(Fe,{inputs:r,formClass:n}))}function Nt(e){return function(e){return(t,n)=>{const r=Reflect.getMetadata(Re,t)||[];if(Reflect.defineMetadata(Re,[...r,n.toString()],t),e){const r=`${Re.toString()}:${n.toString()}:options`;Reflect.defineMetadata(r,e,t)}}}({...e,type:"select"})}function Tt(e){return ke(e,((e,t)=>({...t,type:"download"})))}class kt extends p{state={hasError:!1,error:null,errorInfo:null};static getDerivedStateFromError(e){return{hasError:!0,error:e,errorInfo:null}}componentDidCatch(e,t){this.setState({error:e,errorInfo:t})}render(){return this.state.hasError?o.createElement("div",{className:"error-boundary"},o.createElement("div",{className:"error-boundary__content"},o.createElement("div",{className:"error-boundary__icon"},o.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor"},o.createElement("circle",{cx:"12",cy:"12",r:"10"}),o.createElement("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),o.createElement("line",{x1:"12",y1:"16",x2:"12",y2:"16"}))),o.createElement("h1",null,"Oops! Something went wrong"),o.createElement("p",{className:"error-boundary__message"},this.state.error?.message||"An unexpected error occurred"),o.createElement("button",{className:"error-boundary__button",onClick:()=>window.location.reload()},"Refresh Page"),"development"===process.env.NODE_ENV&&o.createElement("details",{className:"error-boundary__details"},o.createElement("summary",null,"Error Details"),o.createElement("pre",null,this.state.error?.toString()),o.createElement("pre",null,this.state.errorInfo?.componentStack)))):this.props.children}}function At({children:e}){return o.createElement(kt,null,e)}function Ct({image:e,text:t,targetNumber:n,duration:r=2e3}){const[a,i]=s(0);return c((()=>{let e,t;const a=o=>{e||(e=o);const s=o-e,c=Math.min(s/r,1);i(Math.floor(c*n)),c<1&&(t=requestAnimationFrame(a))};return t=requestAnimationFrame(a),()=>{t&&cancelAnimationFrame(t)}}),[n,r]),o.createElement("div",{className:"counter-container"},o.createElement("div",{className:"counter-image"},e),o.createElement("div",{className:"counter-text"},t),o.createElement("div",{className:"counter-value"},a))}function Lt({menu:e,getIcons:a,onLogout:i}){const[c,l]=s(!0),u=r();n();const p=e=>{if("/"===e)return u.pathname===e;const t=e.replace(/^\/+|\/+$/g,""),n=u.pathname.replace(/^\/+|\/+$/g,"");return n===t||n.startsWith(`${t}/`)};return o.createElement("div",{className:"sidebar "+(c?"open":"closed")},o.createElement("button",{className:"toggle-button",onClick:()=>l(!c),"aria-label":c?"Collapse sidebar":"Expand sidebar","aria-expanded":c},c?"<":">"),o.createElement("nav",{className:"nav-links"},e?.().map(((e,n)=>o.createElement(t,{key:n,to:e.path,className:"nav-link "+(p(e.path)?"active":""),"aria-current":p(e.path)?"page":void 0},o.createElement("span",{className:"nav-links-icon"},a?.(e.iconType)),c?o.createElement("span",null,e.name):null)))),i&&o.createElement("div",{className:"sidebar-footer"},o.createElement("button",{className:"logout-button",onClick:()=>{i&&i("logout")},"aria-label":"Logout"},o.createElement("span",{className:"nav-links-icon"},o.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o.createElement("path",{d:"M6 12H2V4H6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),o.createElement("path",{d:"M10 8L14 4M14 4L10 0M14 4H6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}))),c?o.createElement("span",null,"Logout"):null)))}const Pt=w()(E((e=>({user:null})),{name:"app-store-1",storage:b((()=>localStorage)),partialize:e=>({user:e.user})}),O);function It({children:e,menu:t,getIcons:r,logout:a}){const{user:i}=Pt((e=>({user:e.user})));return n(),i||a?.("redirect"),o.createElement("div",{className:"layout"},o.createElement(Lt,{onLogout:a,menu:t,getIcons:r}),o.createElement("main",{className:"content"},e))}function jt({onLogin:e}){const{register:t,handleSubmit:r,formState:{errors:a}}=v(),i=n();return o.createElement("div",{className:"login-container"},o.createElement("div",{className:"login-panel"},o.createElement("div",{className:"login-header"},o.createElement("h1",null,"Welcome Back"),o.createElement("p",null,"Please sign in to continue")),o.createElement("form",{onSubmit:r((async t=>{e.login(t.username,t.password).then((e=>{const{user:t,token:n}=e;localStorage.setItem("token",n),Pt.setState({user:t}),i("/")}))})),className:"login-form"},o.createElement(De,{input:{name:"username",label:"Username",placeholder:"Enter your username",type:"input"},register:t,error:a.username}),o.createElement(De,{input:{name:"password",label:"Password",inputType:"password",placeholder:"Enter your password",type:"input"},register:t,error:a.password}),o.createElement("div",{className:"form-actions"},o.createElement("button",{type:"submit",className:"submit-button"},"Sign In")))))}export{Se as Cell,Ct as Counter,C as Details,T as DetailsItem,I as DetailsPage,Tt as DownloadCell,He as Form,xt as FormPage,Ae as ImageCell,$e as Input,It as Layout,xe as List,Te as ListPage,jt as Login,At as Panel,Nt as SelectInput,ze as getInputFields};
|
@@ -0,0 +1,7 @@
|
|
1
|
+
export type DecoratorMap<T, K> = ({ target, propertyKey }: {
|
2
|
+
target: Object;
|
3
|
+
propertyKey: string | symbol;
|
4
|
+
}, options: T) => K;
|
5
|
+
export declare function createDecorator<T extends {
|
6
|
+
name?: string;
|
7
|
+
}, K>(key: Symbol, options?: T, map?: DecoratorMap<T, K>): PropertyDecorator;
|
package/package.json
CHANGED
@@ -1,63 +1,47 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { ImageCellOptions } from '../../decorators/list/cells/ImageCell';
|
3
3
|
import { AnyClass } from '../../types/AnyClass';
|
4
|
-
import { ExtendedCellTypes } from '../../decorators/list/Cell';
|
5
|
-
import
|
6
|
-
import
|
4
|
+
import { CellConfiguration, ExtendedCellTypes } from '../../decorators/list/Cell';
|
5
|
+
import { BooleanCell } from './cells/BooleanCell';
|
6
|
+
import { DateCell } from './cells/DateCell';
|
7
|
+
import { ImageCell } from './cells/ImageCell';
|
8
|
+
import { UUIDCell } from './cells/UUIDCell';
|
9
|
+
import { DefaultCell } from './cells/DefaultCell';
|
10
|
+
import { DownloadCell } from './cells/DownloadCell';
|
7
11
|
|
8
12
|
interface CellFieldProps<T extends AnyClass> {
|
9
|
-
|
13
|
+
configuration: CellConfiguration;
|
10
14
|
item: T;
|
11
15
|
value: any;
|
12
16
|
}
|
13
17
|
|
14
|
-
export function CellField<T extends AnyClass>({
|
15
|
-
|
18
|
+
export function CellField<T extends AnyClass>({
|
19
|
+
configuration,
|
20
|
+
item,
|
21
|
+
value,
|
22
|
+
}: CellFieldProps<T>): React.ReactElement {
|
23
|
+
let render;
|
16
24
|
|
17
|
-
switch (
|
18
|
-
case 'boolean':
|
19
|
-
render =
|
25
|
+
switch (configuration.type) {
|
26
|
+
case 'boolean':
|
27
|
+
render = <BooleanCell value={value} />;
|
20
28
|
break;
|
21
|
-
}
|
22
29
|
case 'date':
|
23
|
-
|
24
|
-
const date = new Date(value);
|
25
|
-
render = `${date.getDate().toString().padStart(2, '0')}/${(date.getMonth() + 1)
|
26
|
-
.toString()
|
27
|
-
.padStart(2, '0')}/${date.getFullYear()} ${date
|
28
|
-
.getHours()
|
29
|
-
.toString()
|
30
|
-
.padStart(2, '0')}:${date.getMinutes().toString().padStart(2, '0')}`;
|
31
|
-
}
|
30
|
+
render = <DateCell value={value} />;
|
32
31
|
break;
|
33
|
-
|
34
|
-
|
35
|
-
const imageCellOptions = cellOptions as ImageCellOptions;
|
36
|
-
render = (
|
37
|
-
<img
|
38
|
-
width={100}
|
39
|
-
height={100}
|
40
|
-
src={imageCellOptions.baseUrl + value}
|
41
|
-
style={{ objectFit: 'contain' }}
|
42
|
-
/>
|
43
|
-
);
|
32
|
+
case 'image':
|
33
|
+
render = <ImageCell value={value} configuration={configuration} />;
|
44
34
|
break;
|
45
|
-
}
|
46
35
|
case 'uuid':
|
47
|
-
|
48
|
-
|
49
|
-
|
36
|
+
render = <UUIDCell value={value} />;
|
37
|
+
break;
|
38
|
+
case 'download':
|
39
|
+
render = <DownloadCell value={value} configuration={configuration} />;
|
50
40
|
break;
|
51
41
|
default:
|
52
|
-
render =
|
42
|
+
render = <DefaultCell value={value} configuration={configuration} />;
|
53
43
|
break;
|
54
44
|
}
|
55
45
|
|
56
|
-
|
57
|
-
if (cellOptions.linkTo) {
|
58
|
-
render = <Link to={cellOptions.linkTo(item)}>{formattedValue}</Link>;
|
59
|
-
}
|
60
|
-
*/
|
61
|
-
|
62
|
-
return <td key={cellOptions.name}>{render}</td>;
|
46
|
+
return <td key={configuration.name}>{render}</td>;
|
63
47
|
}
|
@@ -5,9 +5,9 @@ import SearchIcon from '../../assets/icons/svg/search.svg';
|
|
5
5
|
import PencilIcon from '../../assets/icons/svg/pencil.svg';
|
6
6
|
import TrashIcon from '../../assets/icons/svg/trash.svg';
|
7
7
|
import { ListPageMeta } from '../../decorators/list/getListPageMeta';
|
8
|
-
import { ImageCellOptions } from '../../decorators/list/cells/ImageCell';
|
9
8
|
import { AnyClass } from '../../types/AnyClass';
|
10
9
|
import { CellField } from './CellField';
|
10
|
+
import { CellConfiguration } from '../../decorators/list/Cell';
|
11
11
|
|
12
12
|
interface DatagridProps<T extends AnyClass> {
|
13
13
|
data: T[];
|
@@ -52,13 +52,12 @@ export function Datagrid<T extends AnyClass>({
|
|
52
52
|
: null;
|
53
53
|
return (
|
54
54
|
<tr key={index}>
|
55
|
-
{cells.map(
|
56
|
-
|
57
|
-
const value = item[cellOptions.name];
|
55
|
+
{cells.map((configuration: CellConfiguration) => {
|
56
|
+
const value = item[configuration.name];
|
58
57
|
return (
|
59
58
|
<CellField
|
60
|
-
key={
|
61
|
-
|
59
|
+
key={configuration.name}
|
60
|
+
configuration={configuration}
|
62
61
|
item={item}
|
63
62
|
value={value}
|
64
63
|
/>
|
@@ -84,9 +83,17 @@ export function Datagrid<T extends AnyClass>({
|
|
84
83
|
<td>
|
85
84
|
<a
|
86
85
|
onClick={() => {
|
87
|
-
listCells.delete
|
88
|
-
onRemoveItem?.(item)
|
89
|
-
|
86
|
+
listCells.delete
|
87
|
+
?.onRemoveItem?.(item)
|
88
|
+
.then(() => {
|
89
|
+
onRemoveItem?.(item);
|
90
|
+
})
|
91
|
+
.catch((e: unknown) => {
|
92
|
+
console.error(e);
|
93
|
+
const message =
|
94
|
+
e instanceof Error ? e.message : 'Error deleting item';
|
95
|
+
alert(message);
|
96
|
+
});
|
90
97
|
}}
|
91
98
|
className="util-cell-link util-cell-link-remove"
|
92
99
|
>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import CheckIcon from '../../../assets/icons/svg/check.svg';
|
3
|
+
import CrossIcon from '../../../assets/icons/svg/cross.svg';
|
4
|
+
|
5
|
+
interface BooleanCellProps {
|
6
|
+
value: boolean;
|
7
|
+
}
|
8
|
+
|
9
|
+
export function BooleanCell({ value }: BooleanCellProps) {
|
10
|
+
return value ? (
|
11
|
+
<CheckIcon className="icon icon-true" />
|
12
|
+
) : (
|
13
|
+
<CrossIcon className="icon icon-false" />
|
14
|
+
);
|
15
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
|
3
|
+
interface DateCellProps {
|
4
|
+
value: string | number | Date;
|
5
|
+
}
|
6
|
+
|
7
|
+
export function DateCell({ value }: DateCellProps) {
|
8
|
+
if (!value) return <>-</>;
|
9
|
+
|
10
|
+
const date = new Date(value);
|
11
|
+
return (
|
12
|
+
<>
|
13
|
+
{`${date.getDate().toString().padStart(2, '0')}/${(date.getMonth() + 1)
|
14
|
+
.toString()
|
15
|
+
.padStart(2, '0')}/${date.getFullYear()} ${date
|
16
|
+
.getHours()
|
17
|
+
.toString()
|
18
|
+
.padStart(2, '0')}:${date.getMinutes().toString().padStart(2, '0')}`}
|
19
|
+
</>
|
20
|
+
);
|
21
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { CellConfiguration } from '../../../decorators/list/Cell';
|
3
|
+
|
4
|
+
interface DefaultCellProps {
|
5
|
+
value: any;
|
6
|
+
configuration: CellConfiguration;
|
7
|
+
}
|
8
|
+
|
9
|
+
export function DefaultCell({ value, configuration }: DefaultCellProps): React.ReactElement {
|
10
|
+
return <>{value ? value.toString() : configuration.placeHolder}</>;
|
11
|
+
}
|