UNPKG

@servicestack/react

Version:

ServiceStack's React Component Library - A comprehensive collection of React components for building modern web applications.

1 lines 206 kB
(function(Q,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("@servicestack/client"),require("react"),require("react/jsx-runtime")):typeof define=="function"&&define.amd?define(["exports","@servicestack/client","react","react/jsx-runtime"],c):(Q=typeof globalThis<"u"?globalThis:Q||self,c(Q.ServiceStackReact={},Q.Servicestack,Q.React,Q.jsxRuntime))})(this,(function(Q,c,r,t){"use strict";const Wr="png,jpg,jpeg,jfif,gif,svg,webp".split(","),Zr={img:"png,jpg,jpeg,gif,svg,webp,png,jpg,jpeg,gif,bmp,tif,tiff,webp,ai,psd,ps".split(","),vid:"avi,m4v,mov,mp4,mpg,mpeg,wmv,webm".split(","),aud:"mp3,mpa,ogg,wav,wma,mid,webm".split(","),ppt:"key,odp,pps,ppt,pptx".split(","),xls:"xls,xlsm,xlsx,ods,csv,tsv".split(","),doc:"doc,docx,pdf,rtf,tex,txt,md,rst,xls,xlsm,xlsx,ods,key,odp,pps,ppt,pptx".split(","),zip:"zip,tar,gz,7z,rar,gzip,deflate,br,iso,dmg,z,lz,lz4,lzh,s7z,apl,arg,jar,war".split(","),exe:"exe,bat,sh,cmd,com,app,msi,run,vb,vbs,js,ws,wsh".split(","),att:"bin,oct,dat".split(",")},_r=Object.keys(Zr),ft=(e,s)=>`<svg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' role='img' preserveAspectRatio='xMidYMid meet' viewBox='${e}'>${s}</svg>`,fs={img:ft("4 4 16 16","<path fill='currentColor' d='M20 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2zm-2 0H6v6.38l2.19-2.19l5.23 5.23l1-1a1.59 1.59 0 0 1 2.11.11L18 16V6zm-5 3.5a1.5 1.5 0 1 1 3 0a1.5 1.5 0 0 1-3 0z'/>"),vid:ft("0 0 24 24","<path fill='currentColor' d='m14 2l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8m4 18V9h-5V4H6v16h12m-2-2l-2.5-1.7V18H8v-5h5.5v1.7L16 13v5Z'/>"),aud:ft("0 0 24 24","<path fill='currentColor' d='M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zM6 20V4h7v5h5v11H6zm10-9h-4v3.88a2.247 2.247 0 0 0-3.5 1.87c0 1.24 1.01 2.25 2.25 2.25S13 17.99 13 16.75V13h3v-2z'/>"),ppt:ft("0 0 48 48","<g fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='4'><path d='M4 8h40'/><path d='M8 8h32v26H8V8Z' clip-rule='evenodd'/><path d='m22 16l5 5l-5 5m-6 16l8-8l8 8'/></g>"),xls:ft("0 0 256 256","<path fill='currentColor' d='M200 26H72a14 14 0 0 0-14 14v26H40a14 14 0 0 0-14 14v96a14 14 0 0 0 14 14h18v26a14 14 0 0 0 14 14h128a14 14 0 0 0 14-14V40a14 14 0 0 0-14-14Zm-42 76h44v52h-44Zm44-62v50h-44V80a14 14 0 0 0-14-14h-2V38h58a2 2 0 0 1 2 2ZM70 40a2 2 0 0 1 2-2h58v28H70ZM38 176V80a2 2 0 0 1 2-2h104a2 2 0 0 1 2 2v96a2 2 0 0 1-2 2H40a2 2 0 0 1-2-2Zm32 40v-26h60v28H72a2 2 0 0 1-2-2Zm130 2h-58v-28h2a14 14 0 0 0 14-14v-10h44v50a2 2 0 0 1-2 2ZM69.2 148.4L84.5 128l-15.3-20.4a6 6 0 1 1 9.6-7.2L92 118l13.2-17.6a6 6 0 0 1 9.6 7.2L99.5 128l15.3 20.4a6 6 0 0 1-9.6 7.2L92 138l-13.2 17.6a6 6 0 1 1-9.6-7.2Z'/>"),doc:ft("0 0 32 32","<path fill='currentColor' d='M26 30H11a2.002 2.002 0 0 1-2-2v-6h2v6h15V6h-9V4h9a2.002 2.002 0 0 1 2 2v22a2.002 2.002 0 0 1-2 2Z'/><path fill='currentColor' d='M17 10h7v2h-7zm-1 5h8v2h-8zm-1 5h9v2h-9zm-6-1a5.005 5.005 0 0 1-5-5V3h2v11a3 3 0 0 0 6 0V5a1 1 0 0 0-2 0v10H8V5a3 3 0 0 1 6 0v9a5.005 5.005 0 0 1-5 5z'/>"),zip:ft("0 0 16 16","<g fill='currentColor'><path d='M6.5 7.5a1 1 0 0 1 1-1h1a1 1 0 0 1 1 1v.938l.4 1.599a1 1 0 0 1-.416 1.074l-.93.62a1 1 0 0 1-1.109 0l-.93-.62a1 1 0 0 1-.415-1.074l.4-1.599V7.5zm2 0h-1v.938a1 1 0 0 1-.03.243l-.4 1.598l.93.62l.93-.62l-.4-1.598a1 1 0 0 1-.03-.243V7.5z'/><path d='M2 2a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2zm5.5-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H9v1H8v1h1v1H8v1h1v1H7.5V5h-1V4h1V3h-1V2h1V1z'/></g>"),exe:ft("0 0 16 16","<path fill='currentColor' fill-rule='evenodd' d='M14 4.5V14a2 2 0 0 1-2 2h-1v-1h1a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5ZM2.575 15.202H.785v-1.073H2.47v-.606H.785v-1.025h1.79v-.648H0v3.999h2.575v-.647ZM6.31 11.85h-.893l-.823 1.439h-.036l-.832-1.439h-.931l1.227 1.983l-1.239 2.016h.861l.853-1.415h.035l.85 1.415h.908l-1.254-1.992L6.31 11.85Zm1.025 3.352h1.79v.647H6.548V11.85h2.576v.648h-1.79v1.025h1.684v.606H7.334v1.073Z'/>"),att:ft("0 0 24 24","<path fill='currentColor' d='M14 0a5 5 0 0 1 5 5v12a7 7 0 1 1-14 0V9h2v8a5 5 0 0 0 10 0V5a3 3 0 1 0-6 0v12a1 1 0 1 0 2 0V6h2v11a3 3 0 1 1-6 0V5a5 5 0 0 1 5-5Z'/>")},ma=/[\r\n%#()<>?[\\\]^`{|}]/g,Jr=1024,ya=["Bytes","KB","MB","GB","TB"],va=(()=>{const e="application/",s=e+"vnd.openxmlformats-officedocument.",n="image/",a="text/",l="audio/",o="video/",d={jpg:n+"jpeg",tif:n+"tiff",svg:n+"svg+xml",ico:n+"x-icon",ts:a+"typescript",py:a+"x-python",sh:a+"x-sh",mp3:l+"mpeg3",mpg:o+"mpeg",ogv:o+"ogg",xlsx:s+"spreadsheetml.sheet",xltx:s+"spreadsheetml.template",docx:s+"wordprocessingml.document",dotx:s+"wordprocessingml.template",pptx:s+"presentationml.presentation",potx:s+"presentationml.template",ppsx:s+"presentationml.slideshow",mdb:e+"vnd.ms-access"};function i(h,x){h.split(",").forEach(T=>d[T]=x)}function u(h,x){h.split(",").forEach(T=>d[T]=x(T))}return u("jpeg,gif,png,tiff,bmp,webp",h=>n+h),u("jsx,csv,css",h=>a+h),u("aac,ac3,aiff,m4a,m4b,m4p,mid,midi,wav",h=>l+h),u("3gpp,avi,dv,divx,ogg,mp4,webm",h=>o+h),u("rtf,pdf",h=>e+h),i("htm,html,shtm",a+"html"),i("js,mjs,cjs",a+"javascript"),i("yml,yaml",e+"yaml"),i("bat,cmd",e+"bat"),i("xml,csproj,fsproj,vbproj",a+"xml"),i("txt,ps1",a+"plain"),i("qt,mov",o+"quicktime"),i("doc,dot",e+"msword"),i("xls,xlt,xla",e+"excel"),i("ppt,oit,pps,ppa",e+"vnd.ms-powerpoint"),i("cer,crt,der",e+"x-x509-ca-cert"),i("gz,tgz,zip,rar,lzh,z",e+"x-compressed"),i("aaf,aca,asd,bin,cab,chm,class,cur,db,dat,deploy,dll,dsp,exe,fla,ics,inf,mix,msi,mso,obj,ocx,prm,prx,psd,psp,qxd,sea,snp,so,sqlite,toc,ttf,u32,xmp,xsn,xtp",e+"octet-stream"),d})();let Gs=[];function Xr(e){return e=e.replace(/"/g,"'"),e=e.replace(/>\s+</g,"><"),e=e.replace(/\s{2,}/g," "),e.replace(ma,encodeURIComponent)}function Ks(e){return"data:image/svg+xml;utf8,"+Xr(e)}function Yr(e){let s=URL.createObjectURL(e);return Gs.push(s),s}function Rr(){Gs.forEach(e=>{try{URL.revokeObjectURL(e)}catch(s){console.error("URL.revokeObjectURL",s)}}),Gs=[]}function Ws(e){if(!e)return null;let s=c.leftPart(e,"?");return c.lastRightPart(s,"/")}function Yt(e){let s=Ws(e);return s==null||s.indexOf(".")===-1?null:c.lastRightPart(s,".").toLowerCase()}function Zs(e){let s=Yt(e.name);return s&&Wr.indexOf(s)>=0?Yr(e):Nt(e.name)}function _s(e){if(!e)return!1;if(e.startsWith("blob:")||e.startsWith("data:"))return!0;let s=Yt(e);return s&&Wr.indexOf(s)>=0||!1}function jl(e){return e}function Nt(e){if(!e)return null;let s=Yt(e);return s==null||_s(e)?e:Rt(s)||Ks(fs.doc)}function Rt(e){let s=en(e);return s&&Ks(s)||null}function en(e){if(fs[e])return fs[e];for(let s=0;s<_r.length;s++){let n=_r[s];if(Zr[n].indexOf(e)>=0)return fs[n]}return null}function Js(e,s=2){if(e===0)return"0 Bytes";const n=s<0?0:s,a=Math.floor(Math.log(e)/Math.log(Jr));return parseFloat((e/Math.pow(Jr,a)).toFixed(n))+" "+ya[a]}function ba(e){return e.files&&Array.from(e.files).map(s=>({fileName:s.name,contentLength:s.size,filePath:Zs(s)}))}function hs(e,s){e.onerror=null,e.src=Xs(e.src,s)||""}function Xs(e,s){return Rt(c.lastRightPart(e,".").toLowerCase())||(s?Rt(s)||s:null)||Rt("doc")}function Ys(e){if(!e)throw new Error("fileNameOrExt required");const s=c.lastRightPart(e,".").toLowerCase();return va[s]||"application/"+s}function tn(){return{extSvg:en,extSrc:Rt,getExt:Yt,encodeSvg:Xr,canPreview:_s,getFileName:Ws,getMimeType:Ys,formatBytes:Js,filePathUri:Nt,svgToDataUri:Ks,fileImageUri:Zs,objectUrl:Yr,flush:Rr,inputFiles:ba,iconOnError:hs,iconFallbackSrc:Xs}}class sn{view;includeTypes;constructor(s){Object.assign(this,s)}getTypeName(){return"MetadataApp"}getMethod(){return"GET"}createResponse(){return{}}}const Mt=r.createContext(void 0),St=r.createContext(void 0),gs=r.createContext(void 0);r.createContext(void 0);function ot(){return r.useContext(Mt)}const Vt="/metadata/app.json",wa={Boolean:"checkbox",DateTime:"date",DateOnly:"date",DateTimeOffset:"date",TimeSpan:"time",TimeOnly:"time",Byte:"number",Short:"number",Int64:"number",Int32:"number",UInt16:"number",UInt32:"number",UInt64:"number",Single:"number",Double:"number",Decimal:"number",String:"text",Guid:"text",Uri:"text"},xa={number:"Int32",checkbox:"Boolean",date:"DateTime","datetime-local":"DateTime",time:"TimeSpan"},Rs={Byte:"byte",Int16:"short",Int32:"int",Int64:"long",UInt16:"ushort",Unt32:"uint",UInt64:"ulong",Single:"float",Double:"double",Decimal:"decimal"};[...Object.keys(Rs),...Object.values(Rs)];const Ca={String:"string",Boolean:"bool",...Rs};function ps(e){return Ca[e]||e}function rn(e,s){return e?(s||(s=[]),e==="Nullable`1"?ps(s[0])+"?":e.endsWith("[]")?`List<${ps(e.substring(0,e.length-2))}>`:s.length===0?ps(e):c.leftPart(ps(e),"`")+"<"+s.join(",")+">"):""}function ka(e){return e&&rn(e.name,e.genericArgs)}class Lt{Query;QueryInto;Create;Update;Patch;Delete;get AnyQuery(){return this.Query||this.QueryInto}get AnyUpdate(){return this.Patch||this.Update}get dataModel(){return this.AnyQuery?.dataModel}toArray(){return[this.Query,this.QueryInto,this.Create,this.Update,this.Patch,this.Delete].filter(n=>!!n).map(n=>n)}get empty(){return!this.Query&&!this.QueryInto&&!this.Create&&!this.Update&&!this.Patch&&!this.Delete}add(s){Ze.isQueryInto(s)&&!this.QueryInto?this.QueryInto=s:Ze.isQuery(s)&&!this.Query?this.Query=s:Ze.isCreate(s)&&!this.Create?this.Create=s:Ze.isUpdate(s)&&!this.Update?this.Update=s:Ze.isPatch(s)&&!this.Patch?this.Patch=s:Ze.isDelete(s)&&!this.Delete&&(this.Delete=s)}static from(s){const n=new Lt;return s.forEach(a=>{n.add(a)}),n}static forType(s,n){let a=new Lt;if(j.config.apisResolver&&s){const l=j.config.apisResolver(s,n);l&&(a.Query=l.Query,a.QueryInto=l.QueryInto,a.Create=l.Create,a.Update=l.Update,a.Patch=l.Patch,a.Delete=l.Delete)}return s&&(n??=j.metadata?.api,n?.operations.forEach(l=>{l.dataModel?.name==s&&a.add(l)})),a}}const Ze={Create:"ICreateDb`1",Update:"IUpdateDb`1",Patch:"IPatchDb`1",Delete:"IDeleteDb`1",AnyRead:["QueryDb`1","QueryDb`2"],AnyWrite:["ICreateDb`1","IUpdateDb`1","IPatchDb`1","IDeleteDb`1"],isAnyQuery:e=>c.map(e.request.inherits,s=>Ze.AnyRead.indexOf(s.name)>=0),isQuery:e=>c.map(e.request.inherits,s=>s.name==="QueryDb`1"),isQueryInto:e=>c.map(e.request.inherits,s=>s.name==="QueryDb`2"),isCrud:e=>e.request.implements?.some(s=>Ze.AnyWrite.indexOf(s.name)>=0),isCreate:e=>vs(e,Ze.Create),isUpdate:e=>vs(e,Ze.Update),isPatch:e=>vs(e,Ze.Patch),isDelete:e=>vs(e,Ze.Delete),model:e=>e?c.map(e.inherits,s=>Ze.AnyRead.indexOf(s.name)>=0)?e.inherits?.genericArgs[0]:e.implements?.find(s=>Ze.AnyWrite.indexOf(s.name)>=0)?.genericArgs[0]:null};function Na(e){return e.input?.type||ms(er(e))}function nn(e){return e.endsWith("?")?c.chop(e,1):e}function ms(e){return wa[nn(e)]}function Ma(e){return e&&xa[e]||"String"}function er(e){return e.type==="Nullable`1"?e.genericArgs[0]:e.type}function tr(e){return e&&ms(e)=="number"||!1}function an(e){return e&&e.toLowerCase()=="string"||!1}function Sa(e){return e=="List`1"||e.startsWith("List<")||e.endsWith("[]")}function ln(e){if(!e?.type)return!1;const s=er(e);return e.isValueType&&s.indexOf("`")==-1||e.isEnum?!1:ms(e.type)==null}function on(e){if(!e?.type)return!1;const s=er(e);if(e.isValueType&&s.indexOf("`")==-1||e.isEnum)return!0;const n=e.input?.type;return n&&(n=="hidden"||n=="file"||n=="tag"||n=="combobox"||j.components?.[n])?!0:ms(e.type)!=null}function Ht(e,s){let n=typeof e=="string"?ys(e):e;n||(console.warn(`Metadata not found for: ${e}`),n={request:{name:e}});let a=(function(){return function(o){Object.assign(this,o)}})(),l=(function(){function o(d){Object.assign(this,d)}return o.prototype.createResponse=function(){return n.returnsVoid?void 0:new a},o.prototype.getTypeName=function(){return n.request.name},o.prototype.getMethod=function(){return n.method||"POST"},o})();return new l(s)}function La(e,s,n={}){let a=(function(){return function(o){Object.assign(this,o)}})(),l=(function(){function o(d){Object.assign(this,d)}return o.prototype.createResponse=function(){return typeof n.createResponse=="function"?n.createResponse():new a},o.prototype.getTypeName=function(){return e},o.prototype.getMethod=function(){return n.method||"POST"},o})();return new l(s)}function es(e,s){return e?(Object.keys(e).forEach(n=>{let a=e[n];typeof a=="string"?a.startsWith("/Date")&&(e[n]=Ns(c.toDate(a))):a!=null&&typeof a=="object"&&(Array.isArray(a)?e[n]=Array.from(a):e[n]=Object.assign({},a))}),e):{}}function Aa(e,s){let n={};return Array.from(e.elements).forEach(a=>{let l=a;if(!l.id||l.value==null||l.value==="")return;const o=l.id.toLowerCase(),d=s&&s.find(x=>x.name.toLowerCase()==o);let i=d?.type,u=d?.genericArgs?.[0],h=l.type==="checkbox"?l.checked:l.value;tr(i)?h=Number(h):i==="List`1"&&typeof h=="string"&&(h=h.split(",").map(x=>tr(u)?Number(x):x)),n[l.id]=h}),n}function sr(e){return e?.api?.operations&&e.api.operations.length>0}function Ta(e){if(!rr()&&e?.assert&&!j.metadata)throw new Error("useMetadata() not configured, see: https://docs.servicestack.net/vue/use-metadata");return j.metadata}function ts(e){return e&&sr(e)?(e.date=c.toDateTime(new Date),j.metadata=e,j.config.storage?.setItem(Vt,JSON.stringify(e)),!0):!1}function $a(){j.metadata=null,j.config.storage?.removeItem(Vt)}function rr(){if(j.metadata!=null)return!0;let e=globalThis.Server;if(sr(e))ts(e);else{const s=j.config.storage?.getItem(Vt);if(s)try{ts(JSON.parse(s))}catch{console.error(`Could not JSON.parse ${Vt} from storage`)}}return j.metadata!=null}async function dn(e,s){let n=s?await s():await fetch(e);if(n.ok){let a=await n.text();ts(JSON.parse(a))}else console.error(`Could not download ${s?"AppMetadata":e}: ${n.statusText}`);sr(j.metadata)||console.warn("AppMetadata is not available")}async function Ia(e){const{olderThan:s,resolvePath:n,resolve:a,client:l}=e||{};let o=rr()&&s!==0;if(o&&s){let d=c.toDate(j.metadata?.date);(!d||new Date().getTime()-d.getTime()>s)&&(o=!1)}if(!o){if((n||a)&&(await dn(n||Vt,a),j.metadata!=null))return;if(l!=null){const d=await l.api(new sn);d.succeeded&&ts(d.response)}if(j.metadata!=null)return;await dn(Vt)}return j.metadata}function it(e,s){if(j.config.typeResolver){let d=j.config.typeResolver(e,s);if(d)return d}let n=j.metadata?.api;if(!n||!e)return null;let a=n.types.find(d=>d.name.toLowerCase()===e.toLowerCase()&&(!s||d.namespace==s));if(a)return a;let l=ys(e);if(l)return l.request;let o=n.operations.find(d=>d.response&&d.response.name.toLowerCase()===e.toLowerCase()&&(!s||d.response.namespace==s));return o?o.response:null}function ys(e){if(j.config.apiResolver){const a=j.config.apiResolver(e);if(a)return a}let s=j.metadata?.api;return s?s.operations.find(a=>a.request.name.toLowerCase()===e.toLowerCase()):null}function Da({dataModel:e}){const s=j.metadata?.api;if(!s)return[];let n=s.operations;if(e){const a=typeof e=="string"?it(e):e;n=n.filter(l=>cn(l.dataModel,a))}return n}function nr(e){return e?it(e.name,e.namespace):null}function cn(e,s){return e&&s&&e.name===s.name&&(!e.namespace||!s.namespace||e.namespace===s.namespace)}function Pa(e,s){let n=it(e);return n&&n.properties&&n.properties.find(l=>l.name.toLowerCase()===s.toLowerCase())}function un(e){return fn(it(e))}function fn(e){if(e&&e.isEnum&&e.enumNames!=null){let s={};for(let n=0;n<e.enumNames.length;n++){const a=(e.enumDescriptions?e.enumDescriptions[n]:null)||e.enumNames[n],l=(e.enumValues!=null?e.enumValues[n]:null)||e.enumNames[n];s[l]=a}return s}return null}function hn(e){if(!e)return null;let s={},n=e.input&&e.input.allowableEntries;if(n){for(let l=0;l<n.length;l++){let o=n[l];s[o.key]=o.value}return s}let a=e.allowableValues||(e.input?e.input.allowableValues:null);if(a){for(let l=0;l<a.length;l++){let o=a[l];s[o]=o}return s}if(e.isEnum){const l=e.genericArgs&&e.genericArgs.length==1?e.genericArgs[0]:e.type,o=it(l);if(o)return fn(o)}return null}function ar(e){if(!e)return;const s=[];return Object.keys(e).forEach(n=>s.push({key:n,value:e[n]})),s}function Ea(e,s){const a=((l,o)=>Object.assign({id:l,name:l,type:o},s))(e.name,s?.type||Na(e)||"text");return e.isEnum&&(a.type="select",a.allowableEntries=ar(hn(e))),a}function Fa(e){let s=[];if(e){const n=nt(e),a=ys(e.name),l=nr(a?.dataModel);n.forEach(o=>{if(!on(o))return;const d=Ea(o,o.input);if(d.id=c.toCamelCase(d.id),d.type=="file"&&o.uploadTo&&!d.accept){const i=j.metadata?.plugins.filesUpload?.locations.find(u=>u.name==o.uploadTo);i&&!d.accept&&i.allowExtensions&&(d.accept=i.allowExtensions.map(u=>u.startsWith(".")?u:`.${u}`).join(","))}if(l){const i=l.properties?.find(u=>u.name==o.name);o.ref||(o.ref=i?.ref)}if(d.options)try{const i={input:d,$typeFields:n.map(h=>h.name),$dataModelFields:l?nt(l).map(h=>h.name):[],...j.config.scopeWhitelist},u=As(d.options,i);Object.keys(u).forEach(h=>{d[h]=u[h]})}catch{console.error(`failed to evaluate '${d.options}'`)}s.push(d)})}return s}function lr(e,s){if(!s.type)return console.error("enumDescriptions missing {type:'EnumType'} options"),[`${e}`];const n=it(s.type);if(!n?.enumValues)return console.error(`Could not find metadata for ${s.type}`),[`${e}`];const a=[];for(let l=0;l<n.enumValues.length;l++){const o=parseInt(n.enumValues[l]);o>0&&(o&e)===o&&a.push(n.enumDescriptions?.[l]||n.enumNames?.[l]||`${e}`)}return a}function gn(e){return s=>typeof s=="number"?lr(s,{type:e}):s}function nt(e){if(!e)return[];let s=[],n={};function a(l){l.forEach(o=>{n[o.name]||(n[o.name]=1,s.push(o))})}for(;e;)e.properties&&a(e.properties),e=e.inherits?nr(e.inherits):null;return s.map(l=>l.type.endsWith("[]")?{...l,type:"List`1",genericArgs:[l.type.substring(0,l.type.length-2)]}:l)}function vs(e,s){return e.request.implements?.some(n=>n.name===s)||!1}function At(e){return e?pn(e,nt(e)):null}function pn(e,s){let n=s.find(o=>o.name.toLowerCase()==="id");if(n&&n.isPrimaryKey)return n;let l=s.find(o=>o.isPrimaryKey)||n;if(!l){let o=Ze.model(e);if(o)return c.map(it(o),d=>At(d));console.error(`Primary Key not found in ${e.name}`)}return l||null}function Oa(e,s){return c.map(At(e),n=>c.mapGet(s,n.name))}function mn(e,s,n){return e&&e.valueType==="none"?"":n.key==="%In"||n.key==="%Between"?`(${n.value})`:ja(s,n.value)}function ja(e,s){return e?(e=nn(e),tr(e)||e==="Boolean"?s:Sa(e)?`[${s}]`:`'${s}'`):s}function mt(e,s){return{name:e,value:s}}const Va=[mt("=","%"),mt("!=","%!"),mt(">=",">%"),mt(">","%>"),mt("<=","%<"),mt("<","<%"),mt("In","%In"),mt("Between","%Between"),{name:"Starts With",value:"%StartsWith",types:"string"},{name:"Contains",value:"%Contains",types:"string"},{name:"Ends With",value:"%EndsWith",types:"string"},{name:"Exists",value:"%IsNotNull",valueType:"none"},{name:"Not Exists",value:"%IsNull",valueType:"none"}];function st(e){if(!e&&typeof r.useContext=="function")try{e=r.useContext(St)}catch{}return rr(),{loadMetadata:n=>Ia({...n,client:e}),getMetadata:Ta,setMetadata:ts,clearMetadata:$a,metadataApp:j.metadata?.app||null,metadataApi:j.metadata?.api||null,filterDefinitions:j.metadata?.plugins?.autoQuery?.viewerConventions||Va,typeOf:it,typeOfRef:nr,typeEquals:cn,apiOf:ys,findApis:Da,typeName:ka,typeName2:rn,property:Pa,enumOptions:un,propertyOptions:hn,createFormLayout:Fa,typeProperties:nt,supportsProp:on,Crud:Ze,Apis:Lt,getPrimaryKey:At,getPrimaryKeyByProps:pn,getId:Oa,createDto:Ht,makeDto:La,toFormValues:es,formValues:Aa,isComplexProp:ln,asKvps:ar,expandEnumFlags:lr,enumFlagsConverter:gn}}class Re{static Lookup={};static async getOrFetchValue(s,n,a,l,o,d,i){const u=Re.getValue(a,i,o);return u??(await Re.fetchLookupIds(s,n,a,l,o,d,[i]),Re.getValue(a,i,o))}static getValue(s,n,a){const l=Re.Lookup[s];if(l){const o=l[n];if(o)return a=a.toLowerCase(),o[a]}}static setValue(s,n,a,l){const o=Re.Lookup[s]??(Re.Lookup[s]={}),d=o[n]??(o[n]={});a=a.toLowerCase(),d[a]=l}static setRefValue(s,n){const a=c.mapGet(n,s.refId);if(a==null||s.refLabel==null)return null;const l=c.mapGet(n,s.refLabel);return Re.setValue(s.model,a,s.refLabel,l),l}static async fetchLookupIds(s,n,a,l,o,d,i){const u=n.operations.find(h=>Ze.isAnyQuery(h)&&h.dataModel?.name==a);if(u){const h=Re.Lookup[a]??(Re.Lookup[a]={}),x=[];Object.keys(h).forEach(O=>{const L=h[O];c.mapGet(L,o)&&x.push(O)});const T=i.filter(O=>!x.includes(O));if(T.length==0)return;const m=d?null:`${l},${o}`,w={[l+"In"]:T.join(",")};m&&(w.fields=m);const I=Ht(u,w),C=await s.api(I,{jsconfig:"edv,eccn"});if(C.succeeded)(c.mapGet(C.response,"results")||[]).forEach(L=>{if(!c.mapGet(L,l)){console.error(`result[${l}] == null`,L);return}const F=`${c.mapGet(L,l)}`,y=c.mapGet(L,o);o=o.toLowerCase();const M=h[F]??(h[F]={});M[o]=`${y}`});else{console.error(`Failed to call ${u.request.name}`);return}}}}let or=()=>new Date().getTime(),Ha=["/","T",":","-"],dt={assumeUtc:!0,date:{method:"Intl.DateTimeFormat",options:"{dateStyle:'medium'}"},maxFieldLength:150,maxNestedFields:2,maxNestedFieldLength:30},za=new Intl.RelativeTimeFormat(dt.locale,{}),yn=1440*60*1e3*365,ir={year:yn,month:yn/12,day:1440*60*1e3,hour:3600*1e3,minute:60*1e3,second:1e3},Tt={currency:bn,bytes:wn,link:xn,linkTel:Cn,linkMailTo:kn,icon:Nn,iconRounded:Mn,attachment:Sn,hidden:Ln,time:An,relativeTime:cr,relativeTimeFromMs:xs,enumFlags:$n,formatDate:zt,formatNumber:dr};"iconOnError"in globalThis||(globalThis.iconOnError=hs);class Ba{static currency={method:"currency"};static bytes={method:"bytes"};static link={method:"link"};static linkTel={method:"linkTel"};static linkMailTo={method:"linkMailTo"};static icon={method:"icon"};static iconRounded={method:"iconRounded"};static attachment={method:"attachment"};static time={method:"time"};static relativeTime={method:"relativeTime"};static relativeTimeFromMs={method:"relativeTimeFromMs"};static date={method:"formatDate"};static number={method:"formatNumber"};static hidden={method:"hidden"};static enumFlags={method:"enumFlags"}}function qa(e){dt=Object.assign({},dt,e)}function Ua(e){Object.keys(e||{}).forEach(s=>{typeof e[s]=="function"&&(Tt[s]=e[s])})}function vn(){return Tt}function ss(e,s){return s?ct("span",e,s):e}function bn(e,s){const n=c.omit(s,["currency"]);return ss(new Intl.NumberFormat(void 0,{style:"currency",currency:s?.currency||"USD"}).format(e),n)}function wn(e,s){return ss(Js(e),s)}function xn(e,s){return ct("a",e,Ss({...s,href:e}))}function Cn(e,s){return ct("a",e,Ss({...s,href:`tel:${e}`}))}function kn(e,s){s||(s={});let{subject:n,body:a}=s,l=c.omit(s,["subject","body"]),o={};return n&&(o.subject=n),a&&(o.body=a),ct("a",e,Ss({...l,href:`mailto:${c.appendQueryString(e,o)}`}))}function Nn(e,s){return ct("img",void 0,Object.assign({class:"w-6 h-6",title:e,src:Ut(e),onerror:"iconOnError(this)"},s))}function Mn(e,s){return ct("img",void 0,Object.assign({class:"w-8 h-8 rounded-full",title:e,src:Ut(e),onerror:"iconOnError(this)"},s))}function Sn(e,s){let n=Ws(e),l=Yt(n)==null||_s(e)?Ut(e):Xs(e);const o=Ut(l);let d=s&&(s["icon-class"]||s.iconClass),i=ct("img",void 0,Object.assign({class:"w-6 h-6",src:o,onerror:"iconOnError(this,'att')"},d?{class:d}:null)),u=`<span class="pl-1">${n}</span>`;return ct("a",i+u,Object.assign({class:"flex",href:Ut(e),title:e},s?c.omit(s,["icon-class","iconClass"]):null))}function Ln(e){return""}function An(e,s){let n=typeof e=="string"?new Date(c.fromXsdDuration(e)*1e3):c.isDate(e)?c.toDate(e):null;return ss(n?c.timeFmt12(n):e,s)}function zt(e,s){if(e==null)return"";let n=typeof e=="number"?new Date(e):typeof e=="string"?c.toDate(e):e;if(!c.isDate(n))return console.warn(`${n} is not a Date value`),e==null?"":`${e}`;let a=dt.date?Cs(dt.date):null;return ss(typeof a=="function"?a(n):c.dateFmt(n),s)}function dr(e,s){if(typeof e!="number")return e;let n=dt.number?Cs(dt.number):null,a=typeof n=="function"?n(e):`${e}`;return a===""&&(console.warn(`formatNumber(${e}) => ${a}`,n),a=`${e}`),ss(a,s)}function bs(e){const s=Math.floor(e/1e3),n=Math.floor(s/60),a=Math.floor(n/60),l=Math.floor(a/24);return l>0?`${l}d ${bs(e-l*24*60*6e4)}`:a>0?`${a}h ${bs(e-a*60*6e4)}`:n>0?`${n}m ${bs(e-n*6e4)}`:s>0?`${s}s`:`${e}ms`}function Qa(e){return e>=1e9?(e/1e9).toFixed(1)+"b":e>=1e6?(e/1e6).toFixed(1)+"m":e>=1e3?(e/1e3).toFixed(1)+"k":e.toLocaleString()}function Tn(e,s,n){let a=c.apiValue(e),l=s?Cs(s):null;if(typeof l=="function"){let d=n;if(s?.options)try{d=As(s.options,n)}catch(i){console.error(`Could not evaluate '${s.options}'`,i,", with scope:",n)}return l(e,d)}let o=a!=null?c.isDate(a)?zt(a,n):typeof a=="number"?dr(a,n):a:null;return o??""}function ws(e,s,n){return $t(e)?Tn(e,s,n):_a(e,s,n)}function Ga(e){if(e==null)return NaN;if(typeof e=="number")return e;if(c.isDate(e))return e.getTime()-or();if(typeof e=="string"){let s=Number(e);if(!isNaN(s))return s;if(e[0]==="P"||e.startsWith("-P"))return c.fromXsdDuration(e)*1e3*-1;if(c.indexOfAny(e,Ha)>=0)return c.toDate(e).getTime()-or()}return NaN}function xs(e,s){for(let n in ir)if(Math.abs(e)>ir[n]||n==="second")return(s||za).format(Math.round(e/ir[n]),n)}function cr(e,s){let n=Ga(e);return isNaN(n)?"":xs(n,s)}function Ka(e,s){return xs(e.getTime()-(s?s.getTime():or()))}function $n(e,s){return lr(e,s).join(", ")}function Cs(e){if(!e)return null;let{method:s,options:n}=e,a=`${s}(${n})`,l=Tt[a]||Tt[s];if(typeof l=="function")return l;let o=e.locale||dt.locale;if(s.startsWith("Intl.")){let d=o?`'${o}'`:"undefined",i=`return new ${s}(${d},${n||"undefined"})`;try{let u=Function(i)();return l=s==="Intl.DateTimeFormat"?h=>u.format(c.toDate(h)):s==="Intl.NumberFormat"?h=>u.format(Number(h)):s==="Intl.RelativeTimeFormat"?h=>cr(h,u):h=>u.format(h),Tt[a]=l}catch(u){console.error(`Invalid format: ${i}`,u)}}else{let d=globalThis[s];if(typeof d=="function"){let i=n!=null?Function("return "+n)():void 0;return l=u=>d(u,i,o),Tt[a]=l}console.error(`No '${s}' function exists`,Object.keys(Tt))}return null}function In(e,s){return e?e.length>s?e.substring(0,s)+"...":e:""}function Dn(e){return e.substring(0,6)==="/Date("?zt(c.toDate(e)):e}function Wa(e){return ur(Bt(e)).replace(/"/g,"")}function Pn(e){if(e==null||e==="")return"";if(typeof e=="string")try{return JSON.parse(e)}catch{console.warn("couldn't parse as JSON",e)}return e}function ur(e,s=4){return e=Pn(e),typeof e!="object"?typeof e=="string"?e:`${e}`:JSON.stringify(e,void 0,s)}function Za(e){return e=Pn(e),typeof e!="object"?typeof e=="string"?e:`${e}`:(e=Object.assign({},e),e=Bt(e),ur(e))}function Bt(e){if(e==null)return null;if(typeof e=="string")return Dn(e);if($t(e))return e;if(e instanceof Date)return zt(e);if(Array.isArray(e))return e.map(Bt);if(typeof e=="object"){let s={};return Object.keys(e).forEach(n=>{n!="__type"&&(s[n]=Bt(e[n]))}),s}return e}function _a(e,s,n){let a=e;if(Array.isArray(e)){if($t(e[0]))return a.join(",");e[0]!=null&&(a=e[0])}if(a==null)return"";if(a instanceof Date)return zt(a,n);let l=Object.keys(a),o=[];for(let d=0;d<Math.min(dt.maxNestedFields,l.length);d++){let i=l[d],u=`${Bt(a[i])}`;o.push(`<b class="font-medium">${i}</b>: ${c.enc(In(Dn(u),dt.maxNestedFieldLength))}`)}return l.length>2&&o.push("..."),ct("span","{ "+o.join(", ")+" }",Object.assign({title:c.enc(Wa(e))},n))}function Ja(){return{Formats:Ba,setDefaultFormats:qa,getFormatters:vn,setFormatters:Ua,formatValue:ws,formatter:Cs,dateInputFormat:Ns,currency:bn,bytes:wn,link:xn,linkTel:Cn,linkMailTo:kn,icon:Nn,iconRounded:Mn,attachment:Sn,hidden:Ln,time:An,relativeTime:cr,relativeTimeFromDate:Ka,relativeTimeFromMs:xs,enumFlags:$n,formatDate:zt,formatNumber:dr,humanifyMs:bs,humanifyNumber:Qa,indentJson:ur,prettyJson:Za,scrub:Bt,truncate:In,apiValueFmt:Tn,iconOnError:hs}}class Xa{callbacks={};register(s,n){this.callbacks[s]=n}has(s){return!!this.callbacks[s]}invoke(s,n){const a=this.callbacks[s];typeof a=="function"&&a(s,n)}}class En{store=new Map;get length(){return this.store.size}getItem(s){return this.store.get(s)??null}setItem(s,n){this.store.set(s,n)}removeItem(s){this.store.delete(s)}clear(){this.store.clear()}key(s){return Array.from(this.store.keys())[s]??null}}class Fn{get length(){return localStorage.length}getItem(s){return localStorage.getItem(s)}setItem(s,n){localStorage.setItem(s,n)}removeItem(s){localStorage.removeItem(s)}clear(){localStorage.clear()}key(s){return localStorage.key(s)}}let On=null,jn=null,ks=new Set;class j{static config={redirectSignIn:"/signin",redirectSignOut:"/auth/logout",navigate:s=>location.href=s,assetsPathResolver:s=>s,fallbackPathResolver:s=>s,storage:typeof localStorage<"u"?new Fn:new En,tableIcon:{svg:"<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><g fill='none' stroke='currentColor' stroke-width='1.5'><path d='M5 12v6s0 3 7 3s7-3 7-3v-6'/><path d='M5 6v6s0 3 7 3s7-3 7-3V6'/><path d='M12 3c7 0 7 3 7 3s0 3-7 3s-7-3-7-3s0-3 7-3Z'/></g></svg>"},scopeWhitelist:{enumFlagsConverter:gn,...vn()}};static autoQueryGridDefaults={deny:[],hide:[],toolbarButtonClass:void 0,tableStyle:"stripedRows",take:25,maxFieldLength:150};static events=c.createBus();static get user(){return On}static set user(s){On=s,ks.forEach(n=>n())}static get metadata(){return jn}static set metadata(s){jn=s,ks.forEach(n=>n())}static subscribe(s){return ks.add(s),()=>ks.delete(s)}static components={};static component(s){const n=j.components[s];if(n)return n;const a=c.toKebabCase(s),l=Object.keys(j.components).find(o=>c.toKebabCase(o)===a);return l&&j.components[l]||null}static interceptors=new Xa}function Vn(e){j.config=Object.assign(j.config,e)}function Hn(e){j.autoQueryGridDefaults=Object.assign(j.autoQueryGridDefaults,e)}function yt(e){return e&&j.config.assetsPathResolver?j.config.assetsPathResolver(e):e}function fr(e){return e&&j.config.fallbackPathResolver?j.config.fallbackPathResolver(e):e}function Ya(e,s){j.interceptors.register(e,s)}function zn(e,s){j.components[e]=s}function Bn(e){Object.assign(j.components,e)}function qn(e){j.config.linkComponent=e}function qt(){const e=j.events;return{config:j.config,setConfig:Vn,events:e,autoQueryGridDefaults:j.autoQueryGridDefaults,setAutoQueryGridDefaults:Hn,assetsPathResolver:yt,fallbackPathResolver:fr,registerInterceptor:Ya,registerComponent:zn,registerComponents:Bn,setLinkComponent:qn}}function Ns(e){if(e==null||typeof e=="object")return"";const s=c.toDate(e);return s==null||s.toString()=="Invalid Date"?"":s.toISOString().substring(0,10)??""}function Un(e){if(e==null||typeof e=="object")return"";const s=c.toDate(e);return s==null||s.toString()=="Invalid Date"?"":s.toISOString().substring(0,19)??""}function Qn(e){return e==null?"":c.toTime(e)}function hr(e,s){return j.config.inputValue?j.config.inputValue(e,s):e==="date"?Ns(s):e==="datetime-local"?Un(s):e==="time"?Qn(s):e==="number"||e==="range"?s==null?"":Number(s):s??""}function Ra(e,s){typeof e=="function"?e(s):e.current=s}function Gn(e){return e}function rs(e,s,n){n?(s(e.entering.cls+" "+e.entering.from),setTimeout(()=>s(e.entering.cls+" "+e.entering.to),0)):(s(e.leaving.cls+" "+e.leaving.from),setTimeout(()=>s(e.leaving.cls+" "+e.leaving.to),0))}function Ms(e){if(typeof document>"u")return;let s=e?.after||document.activeElement,n=s&&s.form;if(n){let a=':not([disabled]):not([tabindex="-1"])',l=n.querySelectorAll(`a:not([disabled]), button${a}, input[type=text]${a}, [tabindex]${a}`),o=Array.prototype.filter.call(l,i=>i.offsetWidth>0||i.offsetHeight>0||i===s),d=o.indexOf(s);d>-1&&(o[d+1]||o[0]).focus()}}function vt(e){if(!e)return null;if(typeof e=="string")return e;const s=typeof e=="function"?new e:typeof e=="object"?e:null;if(!s)throw new Error(`Invalid DTO Type '${typeof e}'`);if(typeof s.getTypeName!="function")throw new Error(`${JSON.stringify(s)} is not a Request DTO`);const n=s.getTypeName();if(!n)throw new Error("DTO Required");return n}function ct(e,s,n){n||(n={});let a=n.cls||n.className||n.class;return a&&(n=c.omit(n,["cls","class","className"]),n.class=a),s==null?`<${e}`+gr(n)+"/>":`<${e}`+gr(n)+`>${s||""}</${e}>`}function gr(e){return Object.keys(e).reduce((s,n)=>`${s} ${n}="${c.enc(e[n])}"`,"")}function Ss(e){return Object.assign({target:"_blank",rel:"noopener",class:"text-blue-600"},e)}function Ut(e){return yt(e)}let el=["string","number","boolean","null","undefined"];function $t(e){return el.indexOf(typeof e)>=0||e instanceof Date}function ns(e){return!$t(e)}function Ls(e){return typeof e=="string"?JSON.parse(e):null}function pr(e,s){if(typeof history<"u"){const n=s?c.appendQueryString(c.lastLeftPart(location.href,"?"),e):c.setQueryString(location.href,e);history.pushState({},"",n)}}function As(e,s){if(["function","Function","eval","=>",";"].some(l=>e.includes(l)))throw new Error(`Unsafe script: '${e}'`);const a=Object.assign(Object.keys(globalThis).reduce((l,o)=>(l[o]=void 0,l),{}),s);return new Function("with(this) { return ("+e+") }").call(a)}function mr(e){typeof navigator<"u"&&navigator.clipboard.writeText(e)}function yr(e){const s=j.config.storage.getItem(e);return s?JSON.parse(s):null}function Ts(e,s){return c.appendQueryString(`swr.${c.nameOf(e)}`,s?Object.assign({},e,s):e)}function tl(e){if(e.request){const s=Ts(e.request,e.args);j.config.storage.removeItem(s)}}async function Kn(e,s,n,a,l){const o=Ts(s,a);n(new c.ApiResult({response:yr(o)}));const d=await e.api(s,a,l);if(d.succeeded&&d.response){d.response._date=new Date().valueOf();const i=JSON.stringify(d.response);j.config.storage.setItem(o,i),n(d)}return d}function Wn(e,s){let n=null;return(...a)=>{n&&clearTimeout(n),n=setTimeout(()=>{e(...a)},s||100)}}function It(e){return typeof e=="string"?e.split(","):e||[]}function Dt(e,s){const n=It(s);return e.reduce((a,l)=>(a[l]=!n.includes(l),a),{})}function sl(e){return new Promise(s=>setTimeout(s,e))}function Zn(e){const s=[],n=[];for(const a of e){const l=a.toLowerCase();n.includes(l)||(s.push(a),n.push(l))}return s}function rl(){return{dateInputFormat:Ns,dateTimeInputFormat:Un,timeInputFormat:Qn,textInputValue:hr,setRef:Ra,unRefs:Gn,transition:rs,focusNextElement:Ms,getTypeName:vt,htmlTag:ct,htmlAttrs:gr,linkAttrs:Ss,toAppUrl:Ut,isPrimitive:$t,isComplexType:ns,pushState:pr,scopedExpr:As,copyText:mr,fromCache:yr,swrCacheKey:Ts,swrClear:tl,swrApi:Kn,asStrings:It,asOptions:Dt,createDebounce:Wn,delay:sl,uniqueIgnoreCase:Zn}}function Qt(e){const[s,n]=r.useState(!1),[a,l]=r.useState(),[o,d]=r.useState(),i=r.useContext(St),u=e??i,h=()=>l(void 0);function x({message:y,errorCode:M,fieldName:p,errors:N}){M||(M="Exception"),N||(N=[]);const G=p?new c.ResponseStatus({errorCode:M,message:y,errors:[new c.ResponseError({fieldName:p,errorCode:M,message:y})]}):new c.ResponseStatus({errorCode:M,message:y,errors:N});return l(G),G}function T({fieldName:y,message:M,errorCode:p}){p||(p="Exception"),l(N=>{if(N){let G=new c.ResponseStatus(N);return G.errors=[...(G.errors||[]).filter(P=>P.fieldName?.toLowerCase()!==y?.toLowerCase()),new c.ResponseError({fieldName:y,message:M,errorCode:p})],G}else return new c.ResponseStatus({errorCode:p,message:M,errors:[new c.ResponseError({fieldName:y,errorCode:p,message:M})]})})}async function m(y,M,p){n(!0);let N=await u.api(y,M,p);return n(!1),d(N.response),l(N.error),N}async function w(y,M,p){n(!0);let N=await u.apiVoid(y,M,p);return n(!1),d(N.response),l(N.error),N}async function I(y,M,p,N){n(!0);let G=await u.apiForm(y,M,p,N);return n(!1),d(G.response),l(G.error),G}async function C(y,M,p,N){n(!0);let G=await u.apiFormVoid(y,M,p,N);return n(!1),d(G.response),l(G.error),G}async function O(y,M,p,N){return Kn(u,y,M,p,N)}function L(y,M){const[p,N]=r.useState(new c.ApiResult),G=r.useRef(Wn(async P=>{const b=await u.api(P);N(b)},M?.delayMs));return r.useEffect(()=>{const P=y(),b=yr(Ts(P));b&&N(new c.ApiResult({response:b})),M?.delayMs===0?u.api(P).then(J=>N(J)):G.current(P)},[y,M?.args,M?.method,M?.delayMs]),r.useEffect(()=>{u.api(y(),M?.args,M?.method).then(P=>N(P))},[]),p}return{setError:x,addFieldError:T,clearErrors:h,loading:s,error:a,api:m,apiVoid:w,apiForm:I,apiFormVoid:C,swr:O,swrEffect:L,unRefs:Gn}}function _n(e){return e&&e.SessionId?c.sanitize(e):e}function Jn(e){e?(j.user=_n(e),j.events.publish("signIn",e)):vr()}function vr(){j.user=null,j.events.publish("signOut",null)}function nl(){return j.user}const br=e=>e?.roles||[],wr=e=>e?.permissions||[];function xr(e){return br(j.user).indexOf(e)>=0}function Xn(e){return wr(j.user).indexOf(e)>=0}function $s(){return xr("Admin")}function Gt(e){if(!e)return!1;if(!e.requiresAuth)return!0;const s=j.user;if(!s)return!1;if($s())return!0;let[n,a]=[br(s),wr(s)],[l,o,d,i]=[e.requiredRoles||[],e.requiredPermissions||[],e.requiresAnyRole||[],e.requiresAnyPermission||[]];return!(!l.every(u=>n.indexOf(u)>=0)||d.length>0&&!d.some(u=>n.indexOf(u)>=0)||!o.every(u=>a.indexOf(u)>=0)||i.length>0&&!i.every(u=>a.indexOf(u)>=0))}function Yn(e){if(!e||!e.requiresAuth)return null;const s=j.user;if(!s)return`<b>${e.request.name}</b> requires Authentication`;if($s())return null;let[n,a]=[br(s),wr(s)],[l,o,d,i]=[e.requiredRoles||[],e.requiredPermissions||[],e.requiresAnyRole||[],e.requiresAnyPermission||[]],u=l.filter(x=>n.indexOf(x)<0);if(u.length>0)return`Requires ${u.map(x=>"<b>"+x+"</b>").join(", ")} Role`+(u.length>1?"s":"");let h=o.filter(x=>a.indexOf(x)<0);return h.length>0?`Requires ${h.map(x=>"<b>"+x+"</b>").join(", ")} Permission`+(h.length>1?"s":""):d.length>0&&!d.some(x=>n.indexOf(x)>=0)?`Requires any ${d.filter(x=>n.indexOf(x)<0).map(x=>"<b>"+x+"</b>").join(", ")} Role`+(u.length>1?"s":""):i.length>0&&!i.every(x=>a.indexOf(x)>=0)?`Requires any ${i.filter(x=>a.indexOf(x)<0).map(x=>"<b>"+x+"</b>").join(", ")} Permission`+(h.length>1?"s":""):null}function Is(){const[,e]=r.useState(0);r.useEffect(()=>{const a=j.subscribe(()=>e(l=>l+1));return()=>{a()}},[]);const s=r.useMemo(()=>j.user||null,[j.user]),n=r.useMemo(()=>j.user!=null,[j.user]);return{signIn:Jn,signOut:vr,user:s,toAuth:_n,isAuthenticated:n,hasRole:xr,hasPermission:Xn,isAdmin:$s,canAccess:Gt,invalidAccessMessage:Yn}}function al(){return{signIn:Jn,signOut:vr,getAuth:nl,hasRole:xr,hasPermission:Xn,isAdmin:$s,canAccess:Gt,invalidAccessMessage:Yn}}function et(e,s){return Array.isArray(e)?e.indexOf(s)>=0:e==s||e.includes(s)}const Ds={blue:"text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-200",purple:"text-purple-600 dark:text-purple-400 hover:text-purple-800 dark:hover:text-purple-200",red:"text-red-700 dark:text-red-400 hover:text-red-900 dark:hover:text-red-200",green:"text-green-600 dark:text-green-400 hover:text-green-800 dark:hover:text-green-200",sky:"text-sky-600 dark:text-sky-400 hover:text-sky-800 dark:hover:text-sky-200",cyan:"text-cyan-600 dark:text-cyan-400 hover:text-cyan-800 dark:hover:text-cyan-200",indigo:"text-indigo-600 dark:text-indigo-400 hover:text-indigo-800 dark:hover:text-indigo-200"},at={base:"block w-full sm:text-sm rounded-md dark:text-white dark:bg-gray-900 disabled:bg-slate-50 dark:disabled:bg-slate-900 disabled:text-slate-500 disabled:border-slate-200 dark:disabled:border-slate-700 disabled:shadow-none",invalid:"pr-10 border-red-300 text-red-900 placeholder-red-300 focus:outline-none focus:ring-red-500 focus:border-red-500",valid:"shadow-sm focus:ring-indigo-500 focus:border-indigo-500 border-gray-300 dark:border-gray-600"},as={panelClass:"shadow sm:rounded-md",formClass:"space-y-6 bg-white dark:bg-black py-6 px-4 sm:p-6",headingClass:"text-lg font-medium leading-6 text-gray-900 dark:text-gray-100",subHeadingClass:"mt-1 text-sm text-gray-500 dark:text-gray-400"},ls={panelClass:"pointer-events-auto w-screen xl:max-w-3xl md:max-w-xl max-w-lg",formClass:"flex h-full flex-col divide-y divide-gray-200 dark:divide-gray-700 shadow-xl bg-white dark:bg-black",titlebarClass:"bg-gray-50 dark:bg-gray-900 px-4 py-6 sm:px-6",headingClass:"text-lg font-medium text-gray-900 dark:text-gray-100",subHeadingClass:"mt-1 text-sm text-gray-500 dark:text-gray-400",closeButtonClass:"rounded-md bg-gray-50 dark:bg-gray-900 text-gray-400 dark:text-gray-500 hover:text-gray-500 dark:hover:text-gray-400 focus:outline-none focus:ring-2 focus:ring-indigo-500 dark:ring-offset-black"},Cr={modalClass:"relative transform overflow-hidden rounded-lg bg-white dark:bg-black text-left shadow-xl transition-all sm:my-8",sizeClass:"sm:max-w-prose lg:max-w-screen-md xl:max-w-screen-lg 2xl:max-w-screen-xl sm:w-full"},Be={panelClass(e="slideOver"){return e=="card"?as.panelClass:ls.panelClass},formClass(e="slideOver"){return e=="card"?as.formClass:ls.formClass},headingClass(e="slideOver"){return e=="card"?as.headingClass:ls.headingClass},subHeadingClass(e="slideOver"){return e=="card"?as.subHeadingClass:ls.subHeadingClass},buttonsClass:"px-4 py-3 bg-gray-50 dark:bg-gray-900 sm:px-6 flex flex-wrap justify-between",legendClass:"text-base font-medium text-gray-900 dark:text-gray-100 text-center mb-4"},pe={getGridClass(e="stripedRows"){return pe.gridClass},getGrid2Class(e="stripedRows"){return et(e,"fullWidth")?"overflow-x-auto":pe.grid2Class},getGrid3Class(e="stripedRows"){return et(e,"fullWidth")?"inline-block min-w-full py-2 align-middle":pe.grid3Class},getGrid4Class(e="stripedRows"){return et(e,"whiteBackground")?"":et(e,"fullWidth")?"overflow-hidden shadow-sm ring-1 ring-black/5":pe.grid4Class},getTableClass(e="stripedRows"){return et(e,"fullWidth")||et(e,"verticalLines")?"min-w-full divide-y divide-gray-300":pe.tableClass},getTheadClass(e="stripedRows"){return et(e,"whiteBackground")?"":pe.theadClass},getTheadRowClass(e="stripedRows"){return pe.theadRowClass+(et(e,"verticalLines")?" divide-x divide-gray-200 dark:divide-gray-700":"")},getTheadCellClass(e="stripedRows"){return pe.theadCellClass+(et(e,"uppercaseHeadings")?" uppercase":"")},getTbodyClass(e="stripedRows"){return(et(e,"whiteBackground")||et(e,"verticalLines")?"divide-y divide-gray-200 dark:divide-gray-800":pe.tableClass)+(et(e,"verticalLines")?" bg-white":"")},getTableRowClass(e="stripedRows",s,n,a){return(a?"cursor-pointer ":"")+(n?"bg-indigo-100 dark:bg-blue-800":(a?"hover:bg-yellow-50 dark:hover:bg-blue-900 ":"")+(et(e,"stripedRows")?s%2==0?"bg-white dark:bg-black":"bg-gray-50 dark:bg-gray-800":"bg-white dark:bg-black"))+(et(e,"verticalLines")?" divide-x divide-gray-200 dark:divide-gray-700":"")},gridClass:"flex flex-col",grid2Class:"",grid3Class:"inline-block min-w-full py-2 align-middle",grid4Class:"overflow-hidden shadow ring-1 ring-black/5 md:rounded-lg",tableClass:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",theadClass:"bg-gray-50 dark:bg-gray-900",tableCellClass:"px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400",theadRowClass:"select-none",theadCellClass:"px-6 py-4 text-left text-sm font-medium tracking-wider whitespace-nowrap",toolbarButtonClass:"inline-flex items-center px-2.5 py-1.5 border border-gray-300 dark:border-gray-700 shadow-sm text-sm font-medium rounded text-gray-700 dark:text-gray-300 bg-white dark:bg-black hover:bg-gray-50 dark:hover:bg-gray-900 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 dark:ring-offset-black"},ll={colspans:"col-span-3 sm:col-span-3"};function bt(e,s,n){const a=e.filter(l=>l).join(" ");return n??=j.config.filterInputClass==null?void 0:l=>j.config.filterInputClass(l,s),n?n(a):a}const ol=Object.freeze(Object.defineProperty({__proto__:null,a:Ds,card:as,dummy:ll,filterClass:bt,form:Be,grid:pe,input:at,modal:Cr,slideOver:ls},Symbol.toStringTag,{value:"Module"}));function kr({type:e="warn",hideIcon:s,className:n,children:a,...l}){const o=e==="info"?"bg-blue-50 dark:bg-blue-200":e==="error"?"bg-red-50 dark:bg-red-200":e==="success"?"bg-green-50 dark:bg-green-200":"bg-yellow-50 dark:bg-yellow-200",d=e==="info"?"border-blue-400":e==="error"?"border-red-400":e==="success"?"border-green-400":"border-yellow-400",i=e==="info"?"text-blue-700":e==="error"?"text-red-700":e==="success"?"text-green-700":"text-yellow-700";return t.jsx("div",{className:`${o} ${d} border-l-4 p-4 ${n||""}`,children:t.jsxs("div",{className:"flex items-center",children:[!s&&t.jsxs("div",{className:"flex-shrink-0 mr-3",children:[e==="warn"&&t.jsx("svg",{className:"h-5 w-5 text-yellow-400",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:t.jsx("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),e==="error"&&t.jsx("svg",{className:"h-5 w-5 text-red-400",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:t.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.28 7.22a.75.75 0 00-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 101.06 1.06L10 11.06l1.72 1.72a.75.75 0 101.06-1.06L11.06 10l1.72-1.72a.75.75 0 00-1.06-1.06L10 8.94 8.28 7.22z",clipRule:"evenodd"})}),e==="info"&&t.jsx("svg",{className:"h-5 w-5 text-blue-400",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:t.jsx("path",{fillRule:"evenodd",d:"M19 10.5a8.5 8.5 0 11-17 0 8.5 8.5 0 0117 0zM8.25 9.75A.75.75 0 019 9h.253a1.75 1.75 0 011.709 2.13l-.46 2.066a.25.25 0 00.245.304H11a.75.75 0 010 1.5h-.253a1.75 1.75 0 01-1.709-2.13l.46-2.066a.25.25 0 00-.245-.304H9a.75.75 0 01-.75-.75zM10 7a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})}),e==="success"&&t.jsx("svg",{className:"h-5 w-5 text-green-400",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:t.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})})]}),t.jsx("div",{children:t.jsx("div",{className:`${i} text-sm`,...l,children:a})})]})})}function il({message:e,className:s,children:n}){const[a,l]=r.useState(!1);return a?null:t.jsx("div",{className:`rounded-md bg-green-50 dark:bg-green-200 p-4 ${s||""}`,role:"alert",children:t.jsxs("div",{className:"flex",children:[t.jsx("div",{className:"flex-shrink-0",children:t.jsx("svg",{className:"h-5 w-5 text-green-400 dark:text-green-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 13l4 4L19 7"})})}),t.jsx("div",{className:"ml-3",children:t.jsx("h3",{className:"text-sm font-medium text-green-800",children:e?t.jsx("span",{children:e}):n})}),t.jsx("div",{className:"ml-auto pl-3",children:t.jsx("div",{className:"-mx-1.5 -my-1.5",children:t.jsxs("button",{type:"button",className:"inline-flex rounded-md bg-green-50 dark:bg-green-200 p-1.5 text-green-500 dark:text-green-600 hover:bg-green-100 dark:hover:bg-green-800 dark:hover:text-white focus:outline-none focus:ring-2 focus:ring-green-600 dark:focus:ring-green-300 focus:ring-offset-2 focus:ring-offset-green-50 dark:ring-offset-green-900",onClick:()=>l(!0),children:[t.jsx("span",{className:"sr-only",children:"Dismiss"}),t.jsx("svg",{className:"h-5 w-5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:t.jsx("path",{d:"M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z"})})]})})})]})})}function os({status:e,except:s,className:n}){const a=ot(),l=r.useMemo(()=>{const o=e||a?.error;return o?c.errorResponseExcept.call({responseStatus:o},s??[]):null},[e,a?.error,s]);return l?t.jsx("div",{className:`bg-red-50 dark:bg-red-900 border-l-4 border-red-400 p-4 ${n||""}`,children:t.jsxs("div",{className:"flex",children:[t.jsx("div",{className:"flex-shrink-0",children:t.jsx("svg",{className:"h-5 w-5 text-red-400",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:t.jsx("path",{fill:"currentColor",d:"M12 2c5.53 0 10 4.47 10 10s-4.47 10-10 10S2 17.53 2 12S6.47 2 12 2m3.59 5L12 10.59L8.41 7L7 8.41L10.59 12L7 15.59L8.41 17L12 13.41L15.59 17L17 15.59L13.41 12L17 8.41L15.59 7Z"})})}),t.jsx("div",{className:"ml-3",children:t.jsx("p",{className:"text-sm text-red-700 dark:text-red-200",children:l})})]})}):null}function dl({id:e,description:s,className:n}){return s?t.jsx("div",{className:`mt-2 text-sm text-gray-500 ${n||""}`,id:`${e}-description`,"aria-describedby":`${e}-description`,children:t.jsx("div",{children:s})}):null}function Kt({image:e,svg:s,src:n,alt:a,type:l,className:o}){let d=e;if(l){const{typeOf:h}=st(),x=h(l);x||console.warn(`Type ${l} does not exist`),x?.icon?d=x?.icon:console.warn(`Type ${l} does not have a [Svg] icon`)}let i=s||d?.svg||"";if(i.startsWith("<svg ")){let x=c.leftPart(i,">").indexOf("class="),T=`${d?.cls||""} ${o||""}`;if(x==-1)i=`<svg class="${T}" ${i.substring(4)}`;else{const m=x+6+1;i=`${i.substring(0,m)+T} ${i.substring(m)}`}return t.jsx("span",{dangerouslySetInnerHTML:{__html:i}})}else return t.jsx("img",{className:`${d?.cls||""} ${o||""}`,src:yt(n||d?.uri),alt:a,onError:h=>hs(h.target)})}function Nr({imageClass:e="w-6 h-6",className:s,children:n}){return t.jsx("div",{className:`text-2xl font-semibold text-gray-900 dark:text-gray-300 ${s||""}`,children:t.jsxs("div",{className:"flex",children:[t.jsxs("svg",{className:`self-center inline mr-2 text-gray-200 animate-spin dark:text-gray-600 fill-gray-600 dark:fill-gray-300 ${e}`,role:"status",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),t.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"curre