x4js 2.0.24 → 2.0.26

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/lib/esm/x4.mjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";(()=>{var Jt=Object.defineProperty;var tn=Object.getOwnPropertyDescriptor;var rr=l=>{throw TypeError(l)};var on=(l,e,t)=>e in l?Jt(l,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):l[e]=t;var s=(l,e)=>Jt(l,"name",{value:e,configurable:!0});var p=(l,e,t,o)=>{for(var r=o>1?void 0:o?tn(e,t):e,n=l.length-1,i;n>=0;n--)(i=l[n])&&(r=(o?i(e,t,r):i(r))||r);return o&&r&&Jt(e,t,r),r};var O=(l,e,t)=>on(l,typeof e!="symbol"?e+"":e,t),nr=(l,e,t)=>e.has(l)||rr("Cannot "+t);var P=(l,e,t)=>(nr(l,e,"read from private field"),t?t.call(l):e.get(l)),te=(l,e,t)=>e.has(l)?rr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(l):e.set(l,t),oe=(l,e,t,o)=>(nr(l,e,"write to private field"),o?o.call(l,t):e.set(l,t),t);var ir=Symbol("i18n"),Re={};function sr(l,e){Re[l]={name:l,base:e,src_translations:{},translations:{}}}s(sr,"createLanguage");function ar(l){return Re[l]!==void 0}s(ar,"isLanguage");function lr(l,...e){if(!ar(l))return;let t=Re[l];e.forEach(o=>{cr(t.src_translations,o)}),t.translations=dr(t.src_translations,t.base,!0)}s(lr,"addTranslation");function cr(l,e){for(let t in e){let o=e[t];typeof o=="string"?l[t]=o:Array.isArray(o)&&(!l[t]||!Array.isArray(l[t]))?l[t]=[...o]:!l[t]||typeof l[t]!="object"?l[t]={...o}:cr(l[t],e[t])}}s(cr,"_patch");function dr(l,e,t){let o={};for(let r in l)typeof l[r]!="string"&&!Array.isArray(l[r])?o[r]=dr(l[r],e,!1):o[r]=l[r];return rn(o,e,t)}s(dr,"_proxyfy");function rn(l,e,t){return new Proxy(l,{get:s((o,r)=>{t?Pt=[r]:Pt.push(r);let n=o[r];return n===void 0&&(e&&(n=nn(e)),n===void 0&&console.error("I18N error: unable to find","_tr."+Pt.join("."))),n},"get")})}s(rn,"_mk_proxy");var Pt;function nn(l){for(;l;){let e=Re[l],t=e.translations,o;for(let r of Pt){if(o=t[r],o===void 0)break;t=o}if(o!==void 0)return t;l=e.base}}s(nn,"_findBaseTrans");var y={};function sn(l){if(ar(l))return y=Re[l].translations,y[ir]=l,y}s(sn,"selectLanguage");function oi(){return y[ir]}s(oi,"getCurrentLanguage");function ri(){return Object.keys(Re)}s(ri,"getAvailableLanguages");var an={global:{ok:"OK",cancel:"Annuler",ignore:"Ignorer",yes:"Oui",no:"Non",abort:"Abandonner",retry:"Réessayer",error:"Erreur",today:"Aujourd'hui",open:"Ouvrir",new:"Nouveau",delete:"Supprimer",close:"Fermer",save:"Enregistrer",search:"Rechercher",search_tip:"Saisissez le texte à rechercher. <b>Enter</b> pour lancer la recherche. <b>Esc</b> pour annuler.",required_field:"information requise",invalid_format:"format invalide",invalid_email:"adresse mail invalide",invalid_number:"valeur numérique invalide",diff_date_seconds:"{0} secondes",diff_date_minutes:"{0} minutes",diff_date_hours:"{0} heures",invalid_date:"Date non reconnue ({0})",empty_list:"Liste vide",date_input_formats:"d/m/y|d.m.y|d m y|d-m-y|dmy",date_format:"D/M/Y",day_short:["dim","lun","mar","mer","jeu","ven","sam"],day_long:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],month_short:["jan","fév","mar","avr","mai","jun","jui","aoû","sep","oct","nov","déc"],month_long:["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"],property:"Propriété",value:"Valeur",err_403:"Vous n'avez pas les droits suffisants pour effectuer cette action",copy:"Copier",cut:"Couper",paste:"Coller",filedrop:"Déposez un fichier",keyboard:{next:"Suivant",numeric:"123",alpha:"Abc"}}},ln={global:{ok:"OK",cancel:"Cancel",ignore:"Ignore",yes:"Yes",no:"No",abort:"Abort",retry:"Retry",error:"Error",today:"Today",open:"Open",new:"New",delete:"Delete",close:"Close",save:"Save",search:"Search",search_tip:"Type in the text to search. <b>Enter</b> to start the search. <b>Esc</b> to cancel.",required_field:"missing information",invalid_format:"invalid format",invalid_email:"invalid email address",invalid_number:"bad numeric value",diff_date_seconds:"{0} seconds",diff_date_minutes:"{0} minutes",diff_date_hours:"{0} hours",invalid_date:"Unrecognized date({0})",empty_list:"Empty list",date_input_formats:"m/d/y|m.d.y|m d y|m-d-y|mdy",date_format:"M/D/Y",day_short:["sun","mon","tue","wed","thu","fri","sat"],day_long:["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],month_short:["jan","feb","mar","apr","may","jun","jui","aug","sep","oct","nov","dec"],month_long:["january","february","march","april","mau","june","jully","august","september","october","november","december"],property:"Property",value:"Value",err_403:"You do not have sufficient rights to do that action",copy:"Copy",cut:"Cut",paste:"Paste",filedrop:"Drop a file",keyboard:{next:"Next",numeric:"123",alpha:"Abc"}}};sr("fr",null);lr("fr",an);sr("en","fr");lr("en",ln);sn("fr");function D(l){return typeof l=="string"}s(D,"isString");function z(l){return typeof l=="number"&&isFinite(l)}s(z,"isNumber");function $(l){return l instanceof Array}s($,"isArray");function pr(l){return l instanceof Function}s(pr,"isFunction");var ro=class ro extends String{constructor(e){super(e)}};s(ro,"UnsafeHtml");var Fe=ro;function xt(l){return new Fe(l)}s(xt,"unsafeHtml");function ai(l,...e){let t=l.reduce((o,r,n)=>o+r+(e[n]||""),"");return xt(t)}s(ai,"unsafe");function G(l,e,t){return l<e?e:l>t?t:l}s(G,"clamp");var Tt=class Tt{left;top;height;width;constructor(e,t,o,r){e!==void 0&&(z(e)?(this.left=e,this.top=t,this.width=o,this.height=r):Object.assign(this,e))}get right(){return this.left+this.width}get bottom(){return this.top+this.height}contains(e){return e instanceof Tt?e.left>=this.left&&e.right<=this.right&&e.top>=this.top&&e.bottom<=this.bottom:e.x>=this.left&&e.x<this.right&&e.y>=this.top&&e.y<this.bottom}touches(e){return!(this.left>e.right||this.right<e.left||this.top>e.bottom||this.bottom<e.top)}normalize(){let e=this.width,t=this.height;return e<0&&(this.left+=e,this.width=-e),t<0&&(this.top+=t,this.height=-t),this}};s(Tt,"Rect");var Be=Tt;function li(l,e,t=0){let o=e.width-2*t,r=e.height-2*t,n=l.width/l.height,i=o,a=o/n;a>r&&(a=r,i=r*n);let c=e.left+(e.width-i)/2,h=e.top+(e.height-a)/2;return{left:c,top:h,width:i,height:a}}s(li,"centerRect");function St(l){switch(l){case"eyedropper":return"EyeDropper"in window}return!1}s(St,"isFeatureAvailable");var no=class no{_timers;setTimeout(e,t,o){this._timers?this.clearTimeout(e):this._timers=new Map;let r=setTimeout(o,t);return this._timers.set(e,r),r}clearTimeout(e){this._timers&&this._timers.has(e)&&(clearTimeout(this._timers.get(e)),this._timers.delete(e))}setInterval(e,t,o){this._timers?this.clearInterval(e):this._timers=new Map;let r=setInterval(o,t);return this._timers.set(e,r),r}clearInterval(e){this._timers&&this._timers.has(e)&&(clearInterval(this._timers.get(e)),this._timers.delete(e))}clearAllTimeouts(){var e;(e=this._timers)==null||e.forEach(t=>{clearTimeout(t)}),this._timers=null}};s(no,"Timer");var Oe=no;function Z(l){return requestAnimationFrame(l)}s(Z,"asap");function ci(l,e=0){return setTimeout(l,e)}s(ci,"oneshot");function le(l,e,t="0"){let o;return D(l)?o=l:o=""+l,e>0?o.padEnd(e,t):o.padStart(-e,t)}s(le,"pad");function eo(l,...e){return l.replace(/{(\d+)}/g,function(t,o){return typeof e[o]<"u"?e[o]:t})}s(eo,"sprintf");function di(l){let e=l;return e=e.replace(/([a-z])([A-Z])/g,"$1 $2"),e=e.toLowerCase(),e=e.replace(/[^- a-z0-9]+/g," "),e.indexOf(" ")<0?e:(e=e.trim(),e.replace(/ /g,"-"))}s(di,"pascalCase");function hi(l){let e=l.toLowerCase();return e=e.replace(/[^a-zA-Z0-9]+(.)/g,(t,o)=>o.toUpperCase()),e}s(hi,"camelCase");var cn="fr-FR";function pi(l){cn=l}s(pi,"_date_set_locale");function ui(l,e){return Q(l)}s(ui,"date_format");function mi(l,e,t){let r=(l.getTime()-e.getTime())/1e3;if(r<60)return eo(y.global.diff_date_seconds,Math.round(r));let n=Math.floor(r/60);if(n<60)return eo(y.global.diff_date_minutes,Math.round(n));let i=Math.floor(n/60);return eo(y.global.diff_date_hours,i,n%60)}s(mi,"date_diff");function fi(l,e){return e?Q(l,"Y-M-D H:I:S"):Q(l,"Y-M-D")}s(fi,"date_to_sql");function gi(l){return new Date(l+" GMT")}s(gi,"date_sql_utc");function be(l){return l.getFullYear()<<16|l.getMonth()<<8|l.getDate()}s(be,"date_hash");function ze(l){return new Date(l.getTime())}s(ze,"date_clone");function hr(l){let e=new Date(l.getFullYear(),0,1),t=(l.valueOf()-e.valueOf())/864e5;return Math.floor((t+e.getDay()+1)/7)}s(hr,"date_calc_weeknum");function xi(l,e=y.global.date_input_formats){var o,r,n,i,a,c;let t=e.split("|");for(let h of t){let m="";for(let x=0;x<h.length;x++){let _=h[x];_=="d"?m+="(?<day>\\d{1,2})":_=="D"?m+="(?<day>\\d{2})":_=="m"?m+="(?<month>\\d{1,2})":_=="M"?m+="(?<month>\\d{2})":_=="y"?m+="(?<year>\\d{1,4})":_=="Y"?h[x+1]=="Y"?(m+="(?<year>\\d{4})",x++):m+="(?<year>\\d{2})":_=="h"?m+="(?<hour>\\d{1,2})":_=="H"?m+="(?<hour>\\d{2})":_=="i"?m+="(?<min>\\d{1,2})":_=="I"?m+="(?<min>\\d{2})":_=="s"?m+="(?<sec>\\d{1,2})":_=="S"?m+="(?<sec>\\d{2})":_==" "?m+="\\s+":m+="\\s*\\"+_+"\\s*"}let g=new RegExp("^"+m+"$","m").exec(l);if(g){let x=new Date,_=parseInt((o=g.groups.day)!=null?o:"1"),N=parseInt((r=g.groups.month)!=null?r:"1"),v=parseInt((n=g.groups.year)!=null?n:x.getFullYear()+""),S=parseInt((i=g.groups.hour)!=null?i:"0"),R=parseInt((a=g.groups.min)!=null?a:"0"),F=parseInt((c=g.groups.sec)!=null?c:"0");v>0&&v<100&&(v+=2e3);let U=new Date(v,N-1,_,S,R,F,0),It=U.getFullYear(),At=U.getMonth()+1,Mt=U.getDate();return It!=v||At!=N||Mt!=_?null:U}}return null}s(xi,"parseIntlDate");function Q(l,e=y.global.date_format){if(!l)return"";let t={year:l.getFullYear(),month:l.getMonth()+1,day:l.getDate(),wday:l.getDay(),hours:l.getHours(),minutes:l.getMinutes(),seconds:l.getSeconds(),milli:l.getMilliseconds()},o="",r=0;for(let n of e){if(n=="{"){if(++r==1)continue}else if(n=="}"&&--r==0)continue;if(r){o+=n;continue}n=="d"?o+=t.day:n=="D"?o+=le(t.day,-2):n=="j"?o+=y.global.day_short[t.wday]:n=="J"?o+=y.global.day_long[t.wday]:n=="w"?o+=hr(l):n=="W"?o+=le(hr(l),-2):n=="m"?o+=t.month:n=="M"?o+=le(t.month,-2):n=="o"?o+=y.global.month_short[t.month-1]:n=="O"?o+=y.global.month_long[t.month-1]:n=="y"||n=="Y"?o+=le(t.year,-4):n=="a"||n=="A"?o+=t.hours<12?"am":"pm":n=="h"?o+=t.hours:n=="H"?o+=le(t.hours,-2):n=="i"?o+=t.minutes:n=="I"?o+=le(t.minutes,-2):n=="s"?o+=t.seconds:n=="S"?o+=le(t.seconds,-2):n=="l"?o+=t.milli:n=="L"?o+=le(t.milli,-3):o+=n}return o}s(Q,"formatIntlDate");function bi(l,e){if(e===void 0&&(e=new Date),!l)return 0;let t=e.getFullYear()-l.getFullYear();return(e.getMonth()<l.getMonth()||e.getMonth()==l.getMonth()&&e.getDate()<l.getDate())&&t--,t}s(bi,"calcAge");function vi(){new Audio("data:audio/wav;base64,//uQRAAAAWMSLwUIYAAsYkXgoQwAEaYLWfkWgAI0wWs/ItAAAGDgYtAgAyN+QWaAAihwMWm4G8QQRDiMcCBcH3Cc+CDv/7xA4Tvh9Rz/y8QADBwMWgQAZG/ILNAARQ4GLTcDeIIIhxGOBAuD7hOfBB3/94gcJ3w+o5/5eIAIAAAVwWgQAVQ2ORaIQwEMAJiDg95G4nQL7mQVWI6GwRcfsZAcsKkJvxgxEjzFUgfHoSQ9Qq7KNwqHwuB13MA4a1q/DmBrHgPcmjiGoh//EwC5nGPEmS4RcfkVKOhJf+WOgoxJclFz3kgn//dBA+ya1GhurNn8zb//9NNutNuhz31f////9vt///z+IdAEAAAK4LQIAKobHItEIYCGAExBwe8jcToF9zIKrEdDYIuP2MgOWFSE34wYiR5iqQPj0JIeoVdlG4VD4XA67mAcNa1fhzA1jwHuTRxDUQ//iYBczjHiTJcIuPyKlHQkv/LHQUYkuSi57yQT//uggfZNajQ3Vmz+Zt//+mm3Wm3Q576v////+32///5/EOgAAADVghQAAAAA//uQZAUAB1WI0PZugAAAAAoQwAAAEk3nRd2qAAAAACiDgAAAAAAABCqEEQRLCgwpBGMlJkIz8jKhGvj4k6jzRnqasNKIeoh5gI7BJaC1A1AoNBjJgbyApVS4IDlZgDU5WUAxEKDNmmALHzZp0Fkz1FMTmGFl1FMEyodIavcCAUHDWrKAIA4aa2oCgILEBupZgHvAhEBcZ6joQBxS76AgccrFlczBvKLC0QI2cBoCFvfTDAo7eoOQInqDPBtvrDEZBNYN5xwNwxQRfw8ZQ5wQVLvO8OYU+mHvFLlDh05Mdg7BT6YrRPpCBznMB2r//xKJjyyOh+cImr2/4doscwD6neZjuZR4AgAABYAAAABy1xcdQtxYBYYZdifkUDgzzXaXn98Z0oi9ILU5mBjFANmRwlVJ3/6jYDAmxaiDG3/6xjQQCCKkRb/6kg/wW+kSJ5//rLobkLSiKmqP/0ikJuDaSaSf/6JiLYLEYnW/+kXg1WRVJL/9EmQ1YZIsv/6Qzwy5qk7/+tEU0nkls3/zIUMPKNX/6yZLf+kFgAfgGyLFAUwY//uQZAUABcd5UiNPVXAAAApAAAAAE0VZQKw9ISAAACgAAAAAVQIygIElVrFkBS+Jhi+EAuu+lKAkYUEIsmEAEoMeDmCETMvfSHTGkF5RWH7kz/ESHWPAq/kcCRhqBtMdokPdM7vil7RG98A2sc7zO6ZvTdM7pmOUAZTnJW+NXxqmd41dqJ6mLTXxrPpnV8avaIf5SvL7pndPvPpndJR9Kuu8fePvuiuhorgWjp7Mf/PRjxcFCPDkW31srioCExivv9lcwKEaHsf/7ow2Fl1T/9RkXgEhYElAoCLFtMArxwivDJJ+bR1HTKJdlEoTELCIqgEwVGSQ+hIm0NbK8WXcTEI0UPoa2NbG4y2K00JEWbZavJXkYaqo9CRHS55FcZTjKEk3NKoCYUnSQ0rWxrZbFKbKIhOKPZe1cJKzZSaQrIyULHDZmV5K4xySsDRKWOruanGtjLJXFEmwaIbDLX0hIPBUQPVFVkQkDoUNfSoDgQGKPekoxeGzA4DUvnn4bxzcZrtJyipKfPNy5w+9lnXwgqsiyHNeSVpemw4bWb9psYeq//uQZBoABQt4yMVxYAIAAAkQoAAAHvYpL5m6AAgAACXDAAAAD59jblTirQe9upFsmZbpMudy7Lz1X1DYsxOOSWpfPqNX2WqktK0DMvuGwlbNj44TleLPQ+Gsfb+GOWOKJoIrWb3cIMeeON6lz2umTqMXV8Mj30yWPpjoSa9ujK8SyeJP5y5mOW1D6hvLepeveEAEDo0mgCRClOEgANv3B9a6fikgUSu/DmAMATrGx7nng5p5iimPNZsfQLYB2sDLIkzRKZOHGAaUyDcpFBSLG9MCQALgAIgQs2YunOszLSAyQYPVC2YdGGeHD2dTdJk1pAHGAWDjnkcLKFymS3RQZTInzySoBwMG0QueC3gMsCEYxUqlrcxK6k1LQQcsmyYeQPdC2YfuGPASCBkcVMQQqpVJshui1tkXQJQV0OXGAZMXSOEEBRirXbVRQW7ugq7IM7rPWSZyDlM3IuNEkxzCOJ0ny2ThNkyRai1b6ev//3dzNGzNb//4uAvHT5sURcZCFcuKLhOFs8mLAAEAt4UWAAIABAAAAAB4qbHo0tIjVkUU//uQZAwABfSFz3ZqQAAAAAngwAAAE1HjMp2qAAAAACZDgAAAD5UkTE1UgZEUExqYynN1qZvqIOREEFmBcJQkwdxiFtw0qEOkGYfRDifBui9MQg4QAHAqWtAWHoCxu1Yf4VfWLPIM2mHDFsbQEVGwyqQoQcwnfHeIkNt9YnkiaS1oizycqJrx4KOQjahZxWbcZgztj2c49nKmkId44S71j0c8eV9yDK6uPRzx5X18eDvjvQ6yKo9ZSS6l//8elePK/Lf//IInrOF/FvDoADYAGBMGb7FtErm5MXMlmPAJQVgWta7Zx2go+8xJ0UiCb8LHHdftWyLJE0QIAIsI+UbXu67dZMjmgDGCGl1H+vpF4NSDckSIkk7Vd+sxEhBQMRU8j/12UIRhzSaUdQ+rQU5kGeFxm+hb1oh6pWWmv3uvmReDl0UnvtapVaIzo1jZbf/pD6ElLqSX+rUmOQNpJFa/r+sa4e/pBlAABoAAAAA3CUgShLdGIxsY7AUABPRrgCABdDuQ5GC7DqPQCgbbJUAoRSUj+NIEig0YfyWUho1VBBBA//uQZB4ABZx5zfMakeAAAAmwAAAAF5F3P0w9GtAAACfAAAAAwLhMDmAYWMgVEG1U0FIGCBgXBXAtfMH10000EEEEEECUBYln03TTTdNBDZopopYvrTTdNa325mImNg3TTPV9q3pmY0xoO6bv3r00y+IDGid/9aaaZTGMuj9mpu9Mpio1dXrr5HERTZSmqU36A3CumzN/9Robv/Xx4v9ijkSRSNLQhAWumap82WRSBUqXStV/YcS+XVLnSS+WLDroqArFkMEsAS+eWmrUzrO0oEmE40RlMZ5+ODIkAyKAGUwZ3mVKmcamcJnMW26MRPgUw6j+LkhyHGVGYjSUUKNpuJUQoOIAyDvEyG8S5yfK6dhZc0Tx1KI/gviKL6qvvFs1+bWtaz58uUNnryq6kt5RzOCkPWlVqVX2a/EEBUdU1KrXLf40GoiiFXK///qpoiDXrOgqDR38JB0bw7SoL+ZB9o1RCkQjQ2CBYZKd/+VJxZRRZlqSkKiws0WFxUyCwsKiMy7hUVFhIaCrNQsKkTIsLivwKKigsj8XYlwt/WKi2N4d//uQRCSAAjURNIHpMZBGYiaQPSYyAAABLAAAAAAAACWAAAAApUF/Mg+0aohSIRobBAsMlO//Kk4soosy1JSFRYWaLC4qZBYWFRGZdwqKiwkNBVmoWFSJkWFxX4FFRQWR+LsS4W/rFRb/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////VEFHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAU291bmRib3kuZGUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMjAwNGh0dHA6Ly93d3cuc291bmRib3kuZGUAAAAAAAAAACU=").play()}s(vi,"beep");var to=-1;function _i(){if(to<0){let l=document.createElement("div");l.style.cssText="overflow:auto;position:absolute;top:0;width:100px;height:100px";let e=document.createElement("div");e.style.width="200px",e.style.height="200px",l.appendChild(e),document.body.appendChild(l),to=l.offsetWidth-l.clientWidth,document.body.removeChild(l)}return to}s(_i,"getScrollbarSize");var Lt=Symbol("class-ns");function u(l){return function(e){e[Lt]=l}}s(u,"class_ns");function oo(l){document.body.style.cursor=l?"wait":"default"}s(oo,"setWaitCursor");function Rt(l){let e=['button:not([tabindex="-1"]):not([disabled])',"[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'];return Array.from(l.querySelectorAll(e.join(","))).filter(o=>o.offsetParent!=null)}s(Rt,"getFocusableElements");var Ft=(c=>(c[c.first=0]="first",c[c.prev=1]="prev",c[c.pgdn=2]="pgdn",c[c.pgup=3]="pgup",c[c.next=4]="next",c[c.last=5]="last",c[c.left=6]="left",c[c.right=7]="right",c))(Ft||{});var dn=s(function(){this.propagationStopped=!0},"stopPropagation"),hn=s(function(){this.defaultPrevented=!0},"preventDefault"),io=class io{_source;_registry;constructor(e=null){this._source=e!=null?e:this}addListener(e,t,o=!1){this._registry||(this._registry=new Map);let r=this._registry.get(e);r||(r=[],this._registry.set(e,r));let n=t;return r.indexOf(n)==-1&&(o?r.unshift(n):r.push(n)),()=>{this.removeListener(e,t)}}removeListener(e,t){if(!this._registry)return;let o=this._registry.get(e);if(!o)return;let r=t,n=o.indexOf(r);n!==-1&&o.splice(n,1)}fire(e,t){var r;let o=(r=this._registry)==null?void 0:r.get(e);if(o&&o.length){let n=t;if(n||(n={}),n.source||(n.source=this._source),n.type||(n.type=e),n.preventDefault||(n.preventDefault=hn),n.stopPropagation||(n.stopPropagation=dn),o.length==1)o[0](n);else{let i=o.slice();for(let a=0,c=i.length;a<c&&(i[a](n),!n.propagationStopped);a++);}}}};s(io,"EventSource");var ce=io;var W,X,so=class so{constructor(){te(this,W);te(this,X)}__startTimer(e,t,o,r){P(this,X)?this.__stopTimer(e):oe(this,X,new Map);let n=(o?setInterval:setTimeout)(r,t);P(this,X).set(e,()=>{(o?clearInterval:clearTimeout)(n),P(this,X).delete(e)})}__stopTimer(e){var o;let t=(o=P(this,X))==null?void 0:o.get(e);t&&t()}setTimeout(e,t,o){this.__startTimer(e,t,!1,o)}clearTimeout(e){this.__stopTimer(e)}setInterval(e,t,o){this.__startTimer(e,t,!0,o)}clearInterval(e){this.__stopTimer(e)}clearTimeouts(){for(let[e,t]of P(this,X))t();P(this,X).clear()}on(e,t){return console.assert(t!=null),P(this,W)||oe(this,W,new ce(this)),P(this,W).addListener(e,t),{off:s(()=>{P(this,W).removeListener(e,t)},"off")}}off(e,t){console.assert(t!=null),P(this,W)&&P(this,W).removeListener(e,t)}fire(e,t){P(this,W)&&P(this,W).fire(e,t)}};W=new WeakMap,X=new WeakMap,s(so,"CoreElement");var re=so;var Bt={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1};function fr(l){return!!Bt[l]}s(fr,"isUnitLess");var de=class de{m_sheet;m_rules=new Map;constructor(){function e(t){for(let o=0;o<document.styleSheets.length;o++){let r=document.styleSheets[o];if(r.title===t)return r}}if(s(e,"getStyleSheet"),this.m_sheet=e("x4-dynamic-css"),!this.m_sheet){let t=document.createElement("style");t.setAttribute("id","x4-dynamic-css"),document.head.appendChild(t),this.m_sheet=t.sheet}}setRule(e,t){if(D(t)){let o=this.m_rules.get(e);o!==void 0?this.m_sheet.deleteRule(o):o=this.m_sheet.cssRules.length,this.m_rules.set(e,this.m_sheet.insertRule(t,o))}else{let o=1;for(let r in t){let n=r+" { ",i=t[r];for(let a in i){let c=i[a];for(let h=0;h<c.length;h++)n+=a+": "+c[h]+"; "}n+="}",this.setRule(e+"--"+o,n),o++}}}static getVar(e){return de.doc_style||(de.doc_style=getComputedStyle(document.documentElement)),e.startsWith("--")||(e="--"+e),de.doc_style.getPropertyValue(e)}};s(de,"Stylesheet"),O(de,"guid",1),O(de,"doc_style");var ur=de,ao=class ao{m_style;constructor(e){this.m_style=e}value(e){return this.m_style[e]}parse(e){return parseInt(this.m_style[e])}get style(){return this.m_style}};s(ao,"ComputedStyle");var mr=ao;var pn={mouseleave:1,mouseenter:1,load:1,unload:1,scroll:1,focus:1,blur:1,rowexit:1,beforeunload:1,stop:1,dragdrop:1,dragenter:1,dragexit:1,draggesture:1,dragover:1,contextmenu:1,created:2,removed:2,sizechange:2},Ot=new WeakMap,lo=null,un=s((l,e)=>{let t=s((r,n)=>{let i=Ot.get(r);i&&i[n]&&r.dispatchEvent(new Event(n,{}))},"sendEvent"),o=s((r,n)=>{n&&t(r,"created");for(let i=r.firstChild;i;i=i.nextSibling)o(i,n);n||t(r,"removed")},"notify");for(let r of l)r.type=="childList"&&(r.addedNodes&&r.addedNodes.forEach(n=>{o(n,!0)}),r.removedNodes&&r.removedNodes.forEach(n=>{o(n,!1)}))},"observeMutation"),co=null;function mn(l){l.forEach(e=>{let t=e.target;t.offsetParent!==null&&t.dispatchEvent(new Event("resized"))})}s(mn,"observeSize");function fn(l){let e=l.target,t=pn[l.type]===2;for(;e;){let o=Ot.get(e);if(o){let r=o[l.type];if(r&&(Array.isArray(r)?r.some(n=>n(l)):r(l),l.stopPropagation||l.defaultPrevented||t))break}if(e=e.parentNode,e==document)break}}s(fn,"dispatchEvent");function zt(l,e,t,o=!1){e=="removed"||e=="created"?lo||(lo=new MutationObserver(un),lo.observe(document.body,{childList:!0,subtree:!0})):e=="resized"&&(co||(co=new ResizeObserver(mn)),co.observe(l));let r=Ot.get(l);if(r||(r={},Ot.set(l,r)),!r[e])r[e]=t,l.addEventListener(e,fn);else{let n=r[e];Array.isArray(n)?n.push(t):r[e]=[n,t]}}s(zt,"addEvent");var gr=Symbol("socket"),ho=null,uo=class uo{getMaxTouchPoints(){return navigator.maxTouchPoints}};s(uo,"Process");var po=uo,bt=class bt extends re{env=new Map;mainview;constructor(){super(),console.assert(ho==null,"Application must be a singleton."),ho=this}setMainView(e){this.mainview=e,document.body.appendChild(e.dom),this._setupKeyboard()}static instance(){return ho}getMainView(){return this.mainview}setEnv(e,t){this.env.set(e,t)}getEnv(e,t){var o;return(o=this.env.get(e))!=null?o:t}static fireGlobal(e,t){bt.instance().fire("global",{msg:e,params:t})}_setupKeyboard(){document.addEventListener("keydown",e=>{(e.key=="Tab"||e.key=="Enter")&&this.focusNext(!e.shiftKey)&&e.preventDefault()})}focusNext(e){let t=document.activeElement,o;for(;t!=document.body;){let n=T(t).queryInterface("tab-handler");if(n)return n.focusNext(e);t.classList.contains("x4box")&&(o=t),t=t.parentElement}if(o){let r=Rt(o);if(r.length){let n=r[0],i=r[r.length-1],a;if(!e&&document.activeElement===n?a=i:e&&document.activeElement===i&&(a=n),a)return a.focus(),!0}else return!0}return!1}setupSocketMessaging(e,t){let o=window.location.protocol==="https:"?"wss://":"ws://",r=e?o+e:`${o}${window.location.hostname}:${window.location.port}/ws`,n=0,i=null;this.on("global",a=>{Object.prototype.hasOwnProperty.call(a,gr)||i&&i.send(JSON.stringify({msg:a.msg,params:a.params}))}),i=new WebSocket(r,"messaging"),i.onopen=()=>{console.log("websocket opened"),n=1},i.onmessage=a=>{if(a.data!="ping"){let c=JSON.parse(a.data);c[gr]=!0,this.fire("global",c)}},i.onclose=a=>{console.log("websocket closed:",a),i=null,n&&(t(),n=0)}}getStorage(e){return localStorage.getItem(e)}getStorageJSON(e){try{return JSON.parse(localStorage.getItem(e))}catch{return}}setStorage(e,t){localStorage.setItem(e,t+"")}setStorageJSON(e,t){localStorage.setItem(e,JSON.stringify(t))}};s(bt,"Application"),O(bt,"process",new po);var Ve=bt;var xr=Symbol("fragment"),br=Symbol("component"),gn=/^-?\d+(\.\d*)?$/;function xn(l){let e=[],t=Object.getPrototypeOf(l);if(t.constructor==d)return["x4-comp"];for(;t&&t.constructor!==d;){let o=t.constructor.name,r=Object.prototype.hasOwnProperty.call(t.constructor,Lt)?t.constructor[Lt]:"";e.push(r+o.toLowerCase()),t=Object.getPrototypeOf(t)}return e}s(xn,"genClassNames");var bn=1e3,q=s(()=>`x4-${bn++}`,"makeUniqueComponentId"),ve,d=class extends re{constructor(t){var o,r;super();O(this,"dom");O(this,"props");O(this,"clsprefix");te(this,ve);if(this.props=t,t.existingDOM)this.dom=t.existingDOM;else{t.ns?this.dom=document.createElementNS(t.ns,(o=t.tag)!=null?o:"div"):this.dom=document.createElement((r=t.tag)!=null?r:"div"),t.attrs&&this.setAttributes(t.attrs),t.cls&&this.addClass(t.cls),t.hidden&&this.show(!1),t.flex===!0?this.addClass("x4flex"):t.flex!==void 0&&this.setStyle({flexGrow:t.flex+""}),t.id!==void 0&&this.setAttribute("id",t.id),t.width!==void 0&&this.setStyleValue("width",t.width),t.height!==void 0&&this.setStyleValue("height",t.height),t.tooltip&&this.setAttribute("tooltip",t.tooltip),t.style&&this.setStyle(t.style),t.content&&this.setContent(t.content),t.dom_events&&this.setDOMEvents(t.dom_events);let n=xn(this);this.dom.classList.add(...n),t.disabled&&this.addDOMEvent("created",()=>{this.enable(!1)})}this.dom[br]=this}onGlobalEvent(t){let o=Ve.instance().on("global",r=>{t(r)});this.addDOMEvent("removed",()=>o.off())}hasClass(t){return this.dom.classList.contains(t)}addClass(t){if(t)if(t.indexOf(" ")>=0){t=t.trim();let o=t.split(" ");this.dom.classList.add(...o)}else this.dom.classList.add(t)}removeClass(t){if(t){if(t=="*"){this.dom.classList.value="";return}if(t.indexOf(" ")>=0){let o=t.split(" ");this.dom.classList.remove(...o)}else this.dom.classList.remove(t)}}removeClassEx(t){Array.from(this.dom.classList).forEach(r=>{r.match(t)&&this.dom.classList.remove(r)})}toggleClass(t){if(!t)return;let o=s(r=>{this.dom.classList.toggle(r)},"toggle");t.indexOf(" ")>=0?t.split(" ").forEach(o):o(t)}setClass(t,o=!0){return o?this.addClass(t):this.removeClass(t),this}setAttributes(t){for(let o in t)this.setAttribute(o,t[o]);return this}setAttribute(t,o){o==null||o===!1?this.dom.removeAttribute(t):this.dom.setAttribute(t,""+o)}getAttribute(t){return this.dom.getAttribute(t)}getData(t){return this.getAttribute("data-"+t)}getIntData(t){let o=parseInt(this.getAttribute("data-"+t));if(Number.isFinite(o))return o}setData(t,o){return this.setAttribute("data-"+t,o)}setInternalData(t,o){return P(this,ve)||oe(this,ve,new Map),P(this,ve).set(t,o),this}getInternalData(t){var o;return(o=P(this,ve))==null?void 0:o.get(t)}addDOMEvent(t,o,r=!1){zt(this.dom,t,o,r)}setDOMEvents(t){for(let o in t)this.addDOMEvent(o,t[o])}mapPropEvents(t,...o){let r=t;o.forEach(n=>{Object.prototype.hasOwnProperty.call(r,n)&&r[n]&&this.on(n,r[n])})}clearContent(){let t=this.dom;for(;t.firstChild;)t.removeChild(t.firstChild)}setContent(t){this.clearContent(),this.appendContent(t)}appendContent(t){let o=s((r,n)=>{if(n instanceof d)r.appendChild(n.dom);else if(n instanceof Fe)r.insertAdjacentHTML("beforeend",n.toString());else if(typeof n=="string"||typeof n=="number"){let i=document.createTextNode(n.toString());r.appendChild(i)}else n&&console.warn("Unknown type to append: ",n)},"set");if(!$(t))o(this.dom,t);else if(t.length<=8)for(let r of t)o(this.dom,r);else{let r=document.createDocumentFragment();for(let n of t)o(r,n);this.dom.appendChild(r)}}prependContent(t){let o=this.dom,r=s(n=>{n instanceof d?o.insertAdjacentElement("afterbegin",n.dom):n instanceof Fe?o.insertAdjacentHTML("afterbegin",n.toString()):typeof n=="string"||typeof n=="number"?o.insertAdjacentText("afterbegin",n.toString()):console.warn("Unknown type to append: ",n)},"set");if(!$(t))r(t);else{let n=document.createDocumentFragment();for(let i of t)r(i);o.insertBefore(o.firstChild,n)}}removeChild(t){this.dom.removeChild(t.dom)}queryAll(t){let o=this.dom.querySelectorAll(t),r=new Array(o.length);return o.forEach((n,i)=>r[i]=mo(n)),r}query(t){let o=this.dom.querySelector(t);return T(o)}setAria(t,o){return this.setAttribute(t,o),this}setStyle(t){let o=this.dom.style;for(let r in t){let n=t[r];!Bt[r]&&(z(n)||gn.test(n))&&(n+="px"),o[r]=n}return this}setStyleValue(t,o){let r=this.dom.style;if(z(o)){let n=o+"";Bt[t]||(n+="px"),r[t]=n}else r[t]=o;return this}getStyleValue(t){return this.dom.style[t]}setWidth(t){this.setStyleValue("width",z(t)?t+"px":t)}setHeight(t){this.setStyleValue("height",z(t)?t+"px":t)}setStyleVariable(t,o){this.dom.style.setProperty(t,o)}getStyleVariable(t){return this.getComputedStyle().getPropertyValue(t)}getComputedStyle(){return getComputedStyle(this.dom)}setCapture(t){this.dom.setPointerCapture(t)}releaseCapture(t){this.dom.releasePointerCapture(t)}getBoundingRect(){let t=this.dom.getBoundingClientRect();return new Be(t.x,t.y,t.width,t.height)}focus(){return this.dom.focus(),this}hasFocus(){return document.activeElement==this.dom}scrollIntoView(t){this.dom.scrollIntoView(t)}isVisible(){return this.dom.offsetParent!==null}show(t=!0){return this.setClass("x4hidden",!t),this}hide(){return this.show(!1),this}enable(t=!0){return this.setAttribute("disabled",t?null:"true"),(this.dom instanceof HTMLInputElement||this.dom instanceof HTMLButtonElement)&&(this.dom.disabled=!t),this.enumChildNodes(!0).forEach(r=>{(r instanceof HTMLInputElement||r instanceof HTMLButtonElement)&&(r.disabled=!t)}),this}disable(){return this.enable(!1),this}isDisabled(){return this.getAttribute("disabled")}nextElement(){let t=this.dom.nextElementSibling;return T(t)}prevElement(){let t=this.dom.previousElementSibling;return T(t)}parentElement(t){return d.parentElement(this.dom,t)}static parentElement(t,o){for(;t.parentElement;){let r=T(t.parentElement);if(!o||r&&r instanceof o)return r;t=t.parentElement}return null}firstChild(){let t=this.dom.firstElementChild;return T(t)}lastChild(){let t=this.dom.lastElementChild;return T(t)}enumChildComponents(t){let o=[];return this.enumChildNodes(t).forEach(n=>{let i=T(n);i&&o.push(i)}),o}enumChildNodes(t){return Array.from(t?this.dom.querySelectorAll("*"):this.dom.children)}visitChildren(t){let o=s(r=>{for(let n=r.firstElementChild;n;n=n.nextElementSibling){let i=T(n);if(i&&t(i)||n.firstElementChild&&n.tagName!="svg"&&n.tagName!="SVG"&&o(n))return!0}},"visit");o(this.dom)}animate(t,o){this.dom.animate(t,o)}static createElement(t,o,...r){let n;return t==this.createFragment||t===xr?r:(t instanceof Function?(o=o!=null?o:{},!o.children&&r&&r.length&&(o.content=r),n=new t(o!=null?o:{})):n=new d({tag:t,content:r,...o}),r&&r.length,n)}static createFragment(){return this.createElement(xr,null)}queryInterface(t){return null}};ve=new WeakMap,s(d,"Component"),d=p([u("x4")],d);function T(l){return l?l[br]:null}s(T,"componentFromDOM");function mo(l){let e=T(l);return e||new d({existingDOM:l})}s(mo,"wrapDOM");var fo=class fo extends d{constructor(){super({})}};s(fo,"Flex");var ne=fo,go=class go extends d{constructor(e,t){super({width:e,cls:t})}};s(go,"Space");var Vt=go;function _e(l){return l.toString(16).padStart(2,"0")}s(_e,"hx");function He(l){return Math.round(l)}s(He,"round");var xo=class xo{rgb=[0,0,0,1];invalid=!1;constructor(...e){D(e[0])?this.setValue(e[0]):this.setRgb(e[0],e[1],e[2],e[3])}setValue(e){if(this.invalid=!1,e.length==4&&/#[0-9a-fA-F]{3}/.test(e)){let t=parseInt(e[1],16),o=parseInt(e[2],16),r=parseInt(e[3],16);return this.setRgb(t<<4|t,o<<4|o,r<<4|r,1)}if(e.length==7&&/#[0-9a-fA-F]{6}/.test(e)){let t=parseInt(e[1],16),o=parseInt(e[2],16),r=parseInt(e[3],16),n=parseInt(e[4],16),i=parseInt(e[5],16),a=parseInt(e[6],16);return this.setRgb(t<<4|o,r<<4|n,i<<4|a,1)}if(e.length==9&&/#[0-9a-fA-F]{8}/.test(e)){let t=parseInt(e[1],16),o=parseInt(e[2],16),r=parseInt(e[3],16),n=parseInt(e[4],16),i=parseInt(e[5],16),a=parseInt(e[6],16),c=parseInt(e[7],16),h=parseInt(e[8],16);return this.setRgb(t<<4|o,r<<4|n,i<<4|a,(c<<4|h)/255)}if(e.startsWith("rgba")){let o=/rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*((\d+)|(\d*\.\d+)|(\.\d+))\s*\)/.exec(e);if(o)return this.setRgb(parseInt(o[1]),parseInt(o[2]),parseInt(o[3]),parseFloat(o[4]))}else if(e.startsWith("rgb")){let o=/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/.exec(e);if(o)return this.setRgb(parseInt(o[1]),parseInt(o[2]),parseInt(o[3]),1)}else if(e.startsWith("var")){let o=/var\s*\(([^)]*)\)/.exec(e);if(o){let r=o[1].trim(),i=getComputedStyle(document.documentElement).getPropertyValue(r);return this.setValue(i)}}return this.invalid=!0,this.setRgb(255,0,0,1)}setHsv(e,t,o,r=1){let n=Math.min(5,Math.floor(e*6)),i=e*6-n,a=o*(1-t),c=o*(1-i*t),h=o*(1-(1-i)*t),m,f,g;switch(n){case 0:m=o,f=h,g=a;break;case 1:m=c,f=o,g=a;break;case 2:m=a,f=o,g=h;break;case 3:m=a,f=c,g=o;break;case 4:m=h,f=a,g=o;break;case 5:m=o,f=a,g=c;break}return this.setRgb(m*255,f*255,g*255,r)}setRgb(e,t,o,r){return this.rgb=[G(e|0,0,255),G(t|0,0,255),G(o|0,0,255),G(r,0,1)],this}toRgbString(e){let t=this.rgb;return e===!1||t[3]==1?`rgb(${He(t[0])},${He(t[1])},${He(t[2])})`:`rgba(${He(t[0])},${He(t[1])},${He(t[2])},${t[3].toFixed(3)})`}toHexString(){let e=this.rgb;return e[3]==1?`#${_e(e[0])}${_e(e[1])}${_e(e[2])}`:`#${_e(e[0])}${_e(e[1])}${_e(e[2])}${_e(e[3]*255|0)}`}toRgb(){let e=this.rgb;return{red:e[0],green:e[1],blue:e[2],alpha:e[3]}}toHsv(){let e=this.toRgb();e.red/=255,e.green/=255,e.blue/=255;let t=Math.max(e.red,e.green,e.blue),o=Math.min(e.red,e.green,e.blue),r=t-o,n=t===0?0:r/t,i=t,a;if(r===0)a=0;else switch(t){case e.red:a=(e.green-e.blue)/r/6+(e.green<e.blue?1:0);break;case e.green:a=(e.blue-e.red)/r/6+1/3;break;case e.blue:a=(e.red-e.green)/r/6+2/3;break}return{hue:a,saturation:n,value:i,alpha:e.alpha}}getAlpha(){return this.rgb[3]}setAlpha(e){return this.rgb[3]=G(e,0,1),this}isInvalid(){return this.invalid}};s(xo,"Color");var H=xo;var wo=class wo{name;id;fields;constructor(e){this.name=e,this.id=void 0,this.fields=[]}};s(wo,"MetaInfos");var bo=wo,Ht=Symbol("metaField");function Nt(l,e=!0){let t=l.constructor,o=Object.prototype.hasOwnProperty.call(t,Ht)?t[Ht]:void 0;if(o===void 0){e||console.assert(o!==void 0),o=new bo(t.name);let r=Object.getPrototypeOf(t);if(r!=vo){let n=r[Ht];o.fields=[...n.fields,...o.fields],console.assert(o.id===void 0,"cannot define mutiple record id"),o.id||(o.id=n.id)}l.constructor[Ht]=o}return o}s(Nt,"_getMetas");var vr;(m=>{function l(){return(f,g)=>{let x=Nt(f);x.fields.push({name:g,type:"any",required:!0}),x.id=g}}m.id=l,s(l,"id");function e(f){return(g,x)=>{Nt(g).fields.push({name:x,...f})}}m.field=e,s(e,"field");function t(f){return e({...f,type:"string"})}m.string=t,s(t,"string");function o(f){return e({...f,type:"int"})}m.int=o,s(o,"int");function r(f){return e({...f,type:"float"})}m.float=r,s(r,"float");function n(f){return e({...f,type:"bool"})}m.bool=n,s(n,"bool");function i(f){return e({...f,type:"date"})}m.date=i,s(i,"date");function a(f){return e({...f,type:"calc"})}m.calc=a,s(a,"calc");function c(f,g){return m.field({...g,type:"array",model:f?new f:null})}m.array=c,s(c,"array");function h(f){return e({...f,type:"any"})}m.any=h,s(h,"any")})(vr||(vr={}));var yo=class yo{getFields(){return Nt(this,!1).fields}validate(e){let t=null;return this.getFields().forEach(r=>{r.required&&!this.getField(r.name,e)&&(t&&(t=[]),t.push(new Error(`field ${r.name} is required.`)))}),t}getFieldIndex(e){return this.getFields().findIndex(o=>o.name==e)}serialize(e){let t={};return this.getFields().forEach(o=>{o.calc===void 0&&(t[o.name]=e[o.name])}),t}unSerialize(e,t){let o=this.getFields(),r=new Ut;return o.forEach(n=>{let i=e[n.name];i!==void 0&&(r[n.name]=this._convertField(n,i))}),t!==void 0?r[o[0].name]=t:console.assert(this.getID(r)!==void 0),r}_convertField(e,t){switch(e.type){case"float":{let o=typeof t=="number"?t:parseFloat(t);if(e.prec!==void 0){let r=Math.pow(10,e.prec);o=Math.round(o*r)/r}return o}case"int":return typeof t=="number"?t:parseInt(t);case"date":return D(t)?new Date(t):t;case"array":{debugger;break}}return t}getID(e){if(!e)return null;let t=Nt(this,!1);return e[t.id]}getRaw(e,t){let o,r=this.getFields();if(typeof e=="string"){if(o=r.findIndex(i=>i.name==e),o<0){console.assert(!1,"unknown field: "+e);return}}else if(e<r.length){if(e<0)return;o=e}else{console.assert(!1,"bad field name: "+e);return}let n=r[o];return n.calc!==void 0?n.calc(t):t[n.name]}getField(e,t){let o=this.getRaw(e,t);return o==null?"":""+o}};s(yo,"DataModel");var vo=yo,ko=class ko{};s(ko,"DataRecord");var Ut=ko,Co=class Co extends re{m_props;constructor(e){super(),this.m_props=e}async load(e){e?this.m_props.url=e:e=this.m_props.url,this.m_props.params&&(e+="?"+this.m_props.params.join("&"));let t=await fetch(e);if(t.ok){let o=await t.json(),r=o;this.m_props.solver&&(r=this.m_props.solver(r)),this.fire("change",{value:r,context:o})}}};s(Co,"DataProxy");var _o=Co,Eo=class Eo extends ce{m_model;m_fields;m_records;m_proxy;m_rec_index;constructor(e){super(),this.m_fields=void 0,this.m_records=[],this.m_rec_index=null,this.m_model=e.model,this.m_fields=e.model.getFields(),e.data?this.setRawData(e.data):e.url&&(this.m_proxy=new _o({url:e.url,solver:e.solver}),this.m_proxy.on("change",t=>{this.setData(t.value)}),e.autoload!=!1&&this.m_proxy.load())}async load(e){return this.m_proxy.load(e)}async reload(){return this.m_proxy.load()}setData(e){let t=new Array(e.length);e.forEach((o,r)=>{t[r]=this.m_model.unSerialize(o)}),this.setRawData(t)}setRawData(e){this.m_records=e,this._rebuildIndex(),this.fire("data_change",{change_type:"change"})}_rebuildIndex(){this.m_rec_index=null,this.m_rec_index=this.createIndex(null),this.m_rec_index=this.sortIndex(this.m_rec_index,null)}update(e){let t=this.m_model.getID(e),o=this.indexOfId(t);return o<0?!1:(this.m_records[this.m_rec_index[o]]=e,this.fire("data_change",{change_type:"update",id:t}),!0)}append(e){e instanceof Ut||(e=this.m_model.unSerialize(e));let t=this.m_model.getID(e);console.assert(t!==void 0),this.m_records.push(e),this._rebuildIndex(),this.fire("data_change",{change_type:"create",id:t})}getMaxId(){let e,t=this.m_model;return this.m_records.forEach(o=>{let r=t.getID(o);(e===void 0||e<r)&&(e=r)}),e}delete(e){let t=this.indexOfId(e);return t<0?!1:(t=this.m_rec_index[t],this.m_records.splice(t,1),this._rebuildIndex(),this.fire("data_change",{change_type:"delete",id:e}),!0)}get count(){return this.m_rec_index?this.m_rec_index.length:this.m_records.length}get fields(){return this.m_fields}indexOfId(e){let t=this.m_model;for(let o=this.count,r=0;o!=0;o>>=1){let n=r+(o>>1),i=this.m_rec_index[n],a=t.getID(this.m_records[i]);if(a==e)return n;a<e&&(r=n+1,o--)}return-1}getById(e){let t=this.indexOfId(e);return t<0?null:(t=this.m_rec_index[t],this.m_records[t])}getByIndex(e){let t=this.m_rec_index[e];return this._getRecord(t)}_getRecord(e){var t;return(t=this.m_records[e])!=null?t:null}moveTo(e){e.setRawData(this.m_records)}createView(e){let t={...e,store:this};return new vt(t)}createIndex(e){if(e&&e.op==="empty-result")return new Uint32Array(0);let t=new Uint32Array(this.m_records.length),o=0;if(!e)this.forEach((r,n)=>{t[o++]=n});else if(typeof e.op=="function"){let r=e.op;this.forEach((n,i)=>{n&&r(n)&&(t[o++]=i)})}else{let r=this.m_model.getFieldIndex(e.field);if(r<0)return console.assert(!1,"unknown field name in filter"),new Uint32Array(0);let n=e.value;D(n)&&!e.caseSensitive&&(n=n.toUpperCase());let i=s(v=>v<n,"_lt"),a=s(v=>v<=n,"_le"),c=s(v=>v==n,"_eq"),h=s(v=>v!=n,"_neq"),m=s(v=>v>=n,"_ge"),f=s(v=>v>n,"_gt"),g=s(v=>(_.lastIndex=-1,_.test(v)),"_re"),x,_;if(n instanceof RegExp)_=n,x=g;else switch(e.op){case"<":{x=i;break}case"<=":{x=a;break}case"=":{x=c;break}case">=":{x=m;break}case">":{x=f;break}case"<>":{x=h;break}}let N=this.m_model;this.forEach((v,S)=>{if(!v)return;let R=N.getRaw(r,v);R==null?R="":(R=""+R,e.caseSensitive||(R=R.toUpperCase())),x(R)&&(t[o++]=S)})}return t.slice(0,o)}sortIndex(e,t){let o=0,r=[];if(t===null?r.push({fidx:0,asc:!0}):r=t.map(i=>{let a=this.m_model.getFieldIndex(i.field);return a==-1&&(console.assert(!1,"unknown field name in sort"),o++),{fidx:a,asc:i.ascending}}),o||r.length==0)return e;let n=this.m_model;if(r.length==1){let i=r[0].fidx;e.sort((a,c)=>{var f,g;let h=(f=n.getRaw(i,this.getByIndex(a)))!=null?f:"",m=(g=n.getRaw(i,this.getByIndex(c)))!=null?g:"";return h>m?1:h<m?-1:0}),r[0].asc||e.reverse()}else e.sort((i,a)=>{var c,h;for(let m=0;m<r.length;m++){let f=r[m].fidx,g=r[m].asc?1:-1,x=(c=n.getRaw(f,this.getByIndex(i)))!=null?c:"",_=(h=n.getRaw(f,this.getByIndex(a)))!=null?h:"";if(x>_)return g;if(x<_)return-g}return 0});return e}forEach(e){this.m_rec_index?this.m_rec_index.some((t,o)=>{if(e(this.m_records[t],o))return o}):this.m_records.some((t,o)=>{if(t&&e(t,o))return o})}export(){return this.m_records}changed(){this.fire("data_change",{change_type:"change"})}getModel(){return this.m_model}};s(Eo,"DataStore");var _r=Eo,Io=class Io extends re{m_index;m_store;m_model;m_sort;m_filter;m_props;constructor(e){super(),this.m_props=e,this.m_store=e.store,this.m_index=null,this.m_filter=null,this.m_sort=null,this.m_model=this.m_store.getModel(),this.filter(e.filter),e.order?D(e.order)?this.sort([{field:e.order,ascending:!0}]):$(e.order)?this.sort(e.order):this.sort([e.order]):this.sort(null),this.m_store.addListener("data_change",t=>this._storeChange(t))}_storeChange(e){this._filter(this.m_filter,e.type!="change"),this._sort(this.m_sort,e.type!="change"),this.fire("view_change",{change_type:"change"})}filter(e){return this.m_index=null,this._filter(e,!0)}_filter(e,t){return this.m_index=this.m_store.createIndex(e),this.m_filter=e,this.m_sort&&this.sort(this.m_sort),t&&this.fire("view_change",{change_type:"filter"}),this.m_index.length}sort(e){this._sort(e,!0)}_sort(e,t){this.m_index=this.m_store.sortIndex(this.m_index,e),this.m_sort=e,t&&this.fire("view_change",{change_type:"sort"})}getStore(){return this.m_store}getCount(){return this.m_index.length}indexOfId(e){let t=this.m_store.indexOfId(e);return this.m_index.findIndex(o=>o===t)}getByIndex(e){if(e>=0&&e<this.m_index.length){let t=this.m_index[e];return this.m_store.getByIndex(t)}return null}getIdByIndex(e){let t=this.getByIndex(e);return this.m_model.getID(t)}getRecId(e){return this.m_model.getID(e)}getById(e){return this.m_store.getById(e)}getModel(){return this.m_model}changed(){this.fire("view_change",{change_type:"change"})}forEach(e){this.m_index.some(t=>{let o=this.m_store.getByIndex(t);if(o&&e(o,t))return t})}};s(Io,"DataView");var vt=Io;var Ao=Symbol("x-drag-cb"),Do=class Do{dragSource;dragGhost;dropTarget;notified;timer;registerDraggableElement(e){e.addDOMEvent("dragstart",t=>{this.dragSource=e,this.dragGhost=e.dom.cloneNode(!0),this.dragGhost.classList.add("dragged"),document.body.appendChild(this.dragGhost),e.addClass("dragging"),t.dataTransfer.setData("text/string","1"),t.dataTransfer.setDragImage(new Image,0,0),t.stopPropagation()}),e.addDOMEvent("drag",t=>{this.dragGhost.style.left=t.pageX+"px",this.dragGhost.style.top=t.pageY+"px"}),e.addDOMEvent("dragend",t=>{e.removeClass("dragging"),this.dragGhost.remove()}),e.setAttribute("draggable","true")}registerDropTarget(e,t,o){let r=s(c=>{if(o&&!o(this.dragSource,c.dataTransfer)){console.log("reject ",e),c.dataTransfer.dropEffect="none";return}console.log("accepted ",e),c.preventDefault(),c.dataTransfer.dropEffect="copy"},"dragEnter"),n=s(c=>{if(o&&!o(this.dragSource,c.dataTransfer)){console.log("reject ",e),c.dataTransfer.dropEffect="none";return}if(c.preventDefault(),this.dropTarget!=e&&(this.dropTarget=e,this._startCheck()),this.dropTarget){let h={pt:{x:c.pageX,y:c.pageY},data:c.dataTransfer};t("drag",this.dragSource,h)}c.dataTransfer.dropEffect="copy"},"dragOver"),i=s(c=>{this.dropTarget=null,c.preventDefault()},"dragLeave"),a=s(c=>{let h={pt:{x:c.pageX,y:c.pageY},data:c.dataTransfer};t("drop",this.dragSource,h),this.dropTarget=null,e.removeClass("drop-over"),c.preventDefault()},"drop");e.addDOMEvent("dragenter",r),e.addDOMEvent("dragover",n),e.addDOMEvent("dragleave",i),e.addDOMEvent("drop",a),e.setInternalData(Ao,t)}_startCheck(){this.timer&&(clearInterval(this.timer),this._check()),this.timer=setInterval(()=>this._check(),300)}_check(){let e=s(o=>{o.removeClass("drop-over"),o.getInternalData(Ao)("leave",this.dragSource)},"leaving"),t=s(o=>{o.addClass("drop-over"),o.getInternalData(Ao)("enter",this.dragSource)},"entering");this.dropTarget?(!this.notified||this.notified!=this.dropTarget)&&(this.notified&&e(this.notified),this.notified=this.dropTarget,t(this.notified)):this.notified&&(e(this.notified),this.notified=null,clearInterval(this.timer))}};s(Do,"DragManager");var Mo=Do,qt=new Mo;var Po=class Po{static create_element(e,t,...o){t=t||{};let r;return D(e)?(r=new d({tag:e}),Object.entries(t).forEach(([n,i])=>{n.startsWith("on")&&n.toLowerCase()in window?r.dom.addEventListener(n.toLowerCase().substring(2),i):r.setAttribute(n,i)})):r=new e(t),o&&o.length&&r.appendContent(o),r}};s(Po,"x4_react");var wr=Po;function vn(l,e=!1){if(l instanceof RegExp)return{keys:null,pattern:l};let t=l.split("/"),o=[],r="";t[0]==""&&t.shift();for(let n of t){let i=n[0];if(i==="*")o.push("wild"),r+="/(.*)";else if(i===":"){let a=n.indexOf("?",1),c=n.indexOf(".",1);o.push(n.substring(1,a>=0?a:c>=0?c:n.length)),r+=a>=0&&c<0?"(?:/([^/]+?))?":"/([^/]+?)",c>=0&&(r+=(a>=0?"?":"")+"\\"+n.substring(c))}else r+="/"+n}return{keys:o,pattern:new RegExp(`^${r}${e?"(?=$|/)":"/?$"}`,"i")}}s(vn,"parseRoute");var To=class To extends ce{m_routes;m_useHash;constructor(e=!0){super(),this.m_routes=[],this.m_useHash=e,window.addEventListener("popstate",t=>{let o=this._getLocation(),r=this._find(o);r.handlers.forEach(n=>{n(r.params,o)}),this.fire("change",{value:this._getLocation()})})}get(e,t){let{keys:o,pattern:r}=vn(e);this.m_routes.push({keys:o,pattern:r,handler:t})}init(){this.navigate(this._getLocation())}_getLocation(){return this.m_useHash?"/"+document.location.hash.substring(1):document.location.pathname}navigate(e,t=!0,o=!1){e.startsWith("/")||(e="/"+e);let r=this._find(e);if(!r||r.handlers.length==0)return console.log("route not found: "+e),this.fire("error",{code:404,message:"route not found"}),!1;if(this.m_useHash){for(;e.at(0)=="/";)e=e.substring(1);e="#"+e}return o?window.history.replaceState({},"",e):window.history.pushState({},"",e),t&&r.handlers[0](r.params,e),this.fire("change",{value:this._getLocation()}),!0}_find(e){let t=[],o={},r=[];for(let n of this.m_routes)if(n.keys)if(n.keys.length>0){if(t=n.pattern.exec(e),t===null)continue;for(let i=0;i<n.keys.length;)o[n.keys[i]]=t[++i];r=[...r,n.handler]}else n.pattern.test(e)&&(r=[...r,n.handler]);else{if(t=n.pattern.exec(e),!t)continue;if(t.groups)for(let i in t.groups)o[i]=t.groups[i];r=[...r,n.handler]}return{params:o,handlers:r}}};s(To,"Router");var yr=To;var So=class So{_state;_subscribers;_currentTracking;constructor(e){this._state=e?{...e}:{},this._subscribers=new Map,this._currentTracking=new Set}getState(e,t=null){this._currentTracking&&this._currentTracking.add(e);let o=e.split("."),r=this._state;for(let n of o){if((r==null?void 0:r[n])===void 0)return t;r=r[n]}return r}setState(e,t,o={}){let r=e.split("."),n=this._state;for(let i=0;i<r.length-1;i++){let a=r[i];(!n[a]||typeof n[a]!="object")&&(n[a]={}),n=n[a]}n[r[r.length-1]]=t}};s(So,"StateManager");var kr=So;var Cr="http://www.w3.org/2000/svg";function _n(l){return l*Math.PI/180}s(_n,"d2r");function Er(l,e,t,o){let r=_n(o);return{x:l+t*Math.cos(r),y:e+t*Math.sin(r)}}s(Er,"p2c");function M(l){return Math.round(l*1e3)/1e3}s(M,"num");function Kt(l,...e){return e=e.map(t=>typeof t=="number"&&isFinite(t)?M(t):t),String.raw(l,...e)}s(Kt,"clean");var Oo=class Oo{_dom;constructor(e){this._dom=document.createElementNS("http://www.w3.org/2000/svg",e)}getDom(){return this._dom}reset(){let e=this._dom.attributes;for(let t=e.length-1;t>=0;t--)this._dom.removeAttribute(e[t].name);return this}stroke(e,t){return this.setAttr("stroke",e),t!==void 0&&this.setAttr("stroke-width",t+"px"),this}strokeWidth(e){return this.setAttr("stroke-width",e+"px"),this}strokeCap(e){return this.setAttr("stroke-linecap",e)}strokeOpacity(e){return this.setAttr("stroke-opacity",e+"")}antiAlias(e){return this.setAttr("shape-rendering",e?"auto":"crispEdges")}fill(e){return this.setAttr("fill",e),this}no_fill(){return this.setAttr("fill","transparent"),this}getAttr(e){return this._dom.getAttribute(e)}getNumAttr(e){return parseInt(this._dom.getAttribute(e))}setAttr(e,t){return this._dom.setAttribute(e,t),this}setStyle(e,t){let o=this._dom.style;if(z(t)){let r=t+"";fr(e)||(r+="px"),o[e]=r}else o[e]=t;return this}addClass(e){if(e){if(e=e.trim(),e.indexOf(" ")>=0){let t=e.split(" ");this._dom.classList.add(...t)}else this._dom.classList.add(e);return this}}removeClass(e){if(e){if(e.indexOf(" ")>=0){let t=e.split(" ");this._dom.classList.remove(...t)}else this._dom.classList.remove(e);return this}}clip(e){return this.setAttr("clip-path",`url(#${e})`),this}transform(e){var o;let t=(o=this.getAttr("transform"))!=null?o:"";return this.setAttr("transform",t+" "+e),this}clear_transform(){return this.setAttr("transform",null),this}rotate(e,t,o){return this.transform(`rotate( ${e} ${t} ${o} )`),this}translate(e,t){return this.transform(`translate( ${e} ${t} )`),this}scale(e){return this.transform(`scale( ${e} )`),this}addDOMEvent(e,t,o=!1){return zt(this._dom,e,t,o),this}};s(Oo,"SvgItem");var he=Oo,zo=class zo extends he{_path;constructor(){super("path"),this._path=""}_update(){return this.setAttr("d",this._path),this}reset(){return this._path="",super.reset(),this}moveTo(e,t){return this._path+=Kt`M${e},${t}`,this._update()}lineTo(e,t){return this._path+=Kt`L${e},${t}`,this._update()}curveTo(e,t,o,r,n,i){return this._path+=Kt`C${e},${t} ${o},${r} ${n},${i}`,this._update()}closePath(){return this._path+="Z",this._update()}arc(e,t,o,r,n,i=!0){let a=Er(e,t,o,r-90),c=Er(e,t,o,n-90),h=n-r<=180?"0":"1";return this._path+=Kt`M${a.x},${a.y}A${o},${o} 0 ${h} ${i?"1":"0"} ${c.x},${c.y}`,this._update()}};s(zo,"SvgPath");var Lo=zo,Vo=class Vo extends he{constructor(e,t,o){super("text"),this.setAttr("x",M(e)+""),this.setAttr("y",M(t)+""),this._dom.innerHTML=o}font(e){return this.setAttr("font-family",e)}fontSize(e){return this.setAttr("font-size",e+"")}fontWeight(e){return this.setAttr("font-weight",e)}textAlign(e){let t;switch(e){case"left":t="start";break;case"center":t="middle";break;case"right":t="end";break;default:return this}return this.setAttr("text-anchor",t)}verticalAlign(e){let t;switch(e){case"top":t="hanging";break;case"center":t="middle";break;case"bottom":t="baseline";break;case"baseline":t="mathematical";break;default:return}return this.setAttr("alignment-baseline",t)}};s(Vo,"SvgText");var Ro=Vo,Ho=class Ho extends he{constructor(e){super("svg"),e.startsWith("data:image/svg+xml,")&&(e=e.substring(19));let o=new DOMParser().parseFromString(decodeURIComponent(e),"image/svg+xml"),r=o.querySelector("parsererror");r&&console.error(`error while parsing svg:
2
- `+r.textContent);let n=o.documentElement;for(let i=0;i<n.attributes.length;i++)this._dom.setAttribute(n.attributes[i].name,n.attributes[i].value);for(let i=0;i<n.childNodes.length;i++){let a=n.childNodes[i];a.nodeType===1&&this._dom.appendChild(a)}}};s(Ho,"SvgIcon");var Fo=Ho,No=class No extends he{constructor(e){super(e)}};s(No,"SvgShape");var _t=No,Ne=class Ne extends he{_id;_stops;constructor(e,t,o,r){super("linearGradient"),this._id="gx-"+Ne.g_id,Ne.g_id++,this.setAttr("id",this._id),this.setAttr("x1",D(e)?e:M(e)+""),this.setAttr("x2",D(o)?o:M(o)+""),this.setAttr("y1",D(t)?t:M(t)+""),this.setAttr("y2",D(r)?r:M(r)+""),this._stops=[]}get id(){return"url(#"+this._id+")"}addStop(e,t){return this._dom.insertAdjacentHTML("beforeend",`<stop offset="${e}%" stop-color="${t}"></stop>`),this}};s(Ne,"SvgGradient"),O(Ne,"g_id",1);var Bo=Ne,jt=class jt extends he{constructor(e="g"){super(e)}append(e){return this._dom.appendChild(e.getDom()),e}appendItems(e){e.forEach(t=>{this._dom.appendChild(t.getDom())})}path(){let e=new Lo;return this.append(e)}text(e,t,o){let r=new Ro(e,t,o);return this.append(r)}ellipse(e,t,o,r){let n=new _t("ellipse");return n.setAttr("cx",M(e)+""),n.setAttr("cy",M(t)+""),n.setAttr("rx",M(o)+""),n.setAttr("ry",M(r)+""),this.append(n)}circle(e,t,o){let r=new _t("ellipse");return r.setAttr("cx",M(e)+""),r.setAttr("cy",M(t)+""),r.setAttr("rx",M(o)+""),r.setAttr("ry",M(o)+""),this.append(r)}icon(e,t,o,r,n){let i=new Fo(e);return i.setAttr("x",M(t)+""),i.setAttr("y",M(o)+""),i.setAttr("width",M(r)+""),i.setAttr("height",M(n)+""),this.append(i)}rect(e,t,o,r){r<0&&(t=t+r,r=-r);let n=new _t("rect");return n.setAttr("x",M(e)+""),n.setAttr("y",M(t)+""),n.setAttr("width",M(o)+""),n.setAttr("height",M(r)+""),this.append(n)}group(e){let t=new jt;return e&&t.setAttr("id",e),this.append(t)}linear_gradient(e,t,o,r){let n=new Bo(e,t,o,r);return this.append(n)}clear(){let e=this._dom;for(;e.firstChild;)e.removeChild(e.firstChild)}};s(jt,"SvgGroup");var wt=jt,we=class we extends wt{constructor(){super()}addClip(e,t,o,r){let n="clip-"+we.g_clip_id++,i=new wt("clipPath");return i.setAttr("id",n),i.rect(e,t,o,r),this.append(i),{id:n,clip:i}}addPattern(e,t,o,r){let n="pat-"+we.g_pat_id++,i=new wt("pattern");return i.setAttr("id",n),i.setAttr("x",M(e)+""),i.setAttr("y",M(t)+""),i.setAttr("width",M(o)+""),i.setAttr("height",M(r)+""),i.setAttr("patternUnits","userSpaceOnUse"),this.append(i),{id:n,pat:i}}};s(we,"SvgBuilder"),O(we,"g_clip_id",1),O(we,"g_pat_id",1);var Gt=we,Uo=class Uo extends d{constructor(e){super({...e,tag:"svg",ns:Cr}),this.setAttribute("xmlns",Cr),e.viewbox&&this.setAttribute("viewBox",e.viewbox),e.svg&&this.dom.appendChild(e.svg.getDom())}setSvg(e){this.clearContent(),this.dom.appendChild(e.getDom())}addItems(...e){e.forEach(t=>this.dom.appendChild(t.getDom()))}};s(Uo,"SvgComponent");var Wt=Uo;var C=class extends d{};s(C,"Box"),C=p([u("x4")],C);var b=class extends C{};s(b,"HBox"),b=p([u("x4")],b);var k=class extends C{constructor(e){super(e)}};s(k,"VBox"),k=p([u("x4")],k);var ie=class extends C{_items;_cur;constructor(e){var t;super(e),this.mapPropEvents(e,"pageChange"),this._items=(t=e.items)==null?void 0:t.map(o=>({...o,page:null})),e.default?this.select(e.default):this._items.length&&this.select(this._items[0].name)}addItem(e){this._items.push({name:e.name,content:e.content,page:null})}removeItem(e){let t=this._items.findIndex(o=>o.name==e);if(t>=0){let o=this._items[t];o!=null&&o.page&&this.removeChild(o.page),this._items.splice(t,1)}}select(e){var r;let t=this.query(":scope > .selected");t&&t.setClass("selected",!1),this._cur=this._items.findIndex(n=>n.name==e);let o=this._items[this._cur];return o&&(o.page||(o.page=this._createPage(o),this.appendContent(o.page)),t=o.page,t&&((r=t.activate)==null||r.call(t),t.setClass("selected",!0)),Z(()=>this.fire("pageChange",{selection:[o.name],empty:!t}))),o==null?void 0:o.page}_createPage(e){let t;return e.content instanceof Function?(t=e.content(),e.content=t):t=e.content,t==null||t.setData("stackname",e.name),t}getPage(e){let t=this._items.find(o=>o.name==e);return t?t.content:null}getPageCount(){return this._items.length}enumPageNames(){return this._items.map(e=>e.name)}getItem(e){return this._items.find(o=>o.name==e)}getCurPage(){let e=this._items[this._cur];return e==null?void 0:e.name}};s(ie,"StackBox"),ie=p([u("x4")],ie);var Ue=class extends ie{selectNextPage(e=!0){let t;e&&this._cur<this._items.length-1?t=this._items[this._cur+1]:!e&&this._cur>0&&(t=this._items[this._cur-1]),t&&this.select(t.name)}isFirstPage(){return this._cur==0}isLastPage(){return this._cur==this._items.length-1}};s(Ue,"AssistBox"),Ue=p([u("x4")],Ue);var qe=class extends C{constructor(e){super(e),e.rows!==void 0&&this.setRows(e.rows),e.columns!==void 0&&this.setCols(e.columns),e.items&&this.setItems(e.items)}setRows(e){$(e)?e=e.join(" "):z(e)&&(e=`repeat( ${e}, 1fr )`),this.setStyleValue("gridTemplateRows",e)}setCols(e){$(e)?e=e.join(" "):z(e)&&(e=`repeat( ${e}, 1fr )`),this.setStyleValue("gridTemplateColumns",e)}setRowCount(e){this.setStyleValue("gridTemplateRows",`repeat(${e})`)}setColCount(e){this.setStyleValue("gridTemplateColumns",`repeat(${e})`)}setTemplate(e){this.setAttribute("grid-template-area",e.map(t=>'"'+t+'"').join(" "))}setItems(e){e.forEach(t=>{t.item.setStyle({gridColumn:t.col+1+"",gridRow:t.row+1+""})}),this.setContent(e.map(t=>t.item))}};s(qe,"GridBox"),qe=p([u("x4")],qe);var Ke=class extends C{constructor(e){super(e),this.addDOMEvent("resized",()=>{this.resizeAllItems()}),e.items&&this.setItems(e.items)}resizeItem(e){let t=this.getComputedStyle(),o=parseInt(t.gridAutoRows),r=parseInt(t.rowGap),n=e.query(".content");if(n||(n=e),n&&o+r){let i=n.getBoundingRect(),a=Math.ceil((i.height+r)/(o+r));e.setStyleValue("gridRowEnd","span "+a)}}resizeAllItems(){this.queryAll(".item").forEach(t=>{this.resizeItem(t)})}setItems(e){let t=e.map(o=>new C({cls:"item",content:o}));this.setContent(t)}};s(Ke,"MasonryBox"),Ke=p([u("x4")],Ke);var Ge=class extends b{constructor(e){super(e),this.mapPropEvents(e,"click"),e.items&&this.setItems(e.items)}setItems(e){let t=e.map(o=>new I({label:o.label,icon:o.icon,click:s(()=>{o.click?o.click(o.name):this.fire("click",{context:o.name})},"click")}));this.setContent(t)}};s(Ge,"Breadcrumbs"),Ge=p([u("x4")],Ge);var Ko=class Ko{cache;waiters;constructor(){this.cache=new Map,this.waiters=new Map}async load(e){return this.cache.has(e)?Promise.resolve(this.cache.get(e)):new Promise((t,o)=>{this.waiters.has(e)?this.waiters.get(e).push(t):(this.waiters.set(e,[t]),this._load(e).then(r=>{this.cache.set(e,r),this.waiters.get(e).forEach(i=>i(r))}))})}async _load(e){let t=await fetch(e);if(t.ok)return t.text()}};s(Ko,"SvgLoader");var qo=Ko,yt=new qo,E=class extends d{constructor(e){super(e),this.setIcon(e.iconId)}setIcon(e){if(this.clearContent(),e){if(e.startsWith("var:"))do{let t=e.substring(4);e=document.documentElement.style.getPropertyValue(t)}while(e.startsWith("var:"));e.startsWith("data:image/svg+xml,<svg")?this.dom.insertAdjacentHTML("beforeend",e.substring(19)):e.endsWith(".svg")?yt.load(e).then(t=>{this.clearContent(),this.dom.insertAdjacentHTML("beforeend",t)}):this.setContent(new d({tag:"img",attrs:{src:e}})),this.removeClass("empty")}else this.addClass("empty")}};s(E,"Icon"),E=p([u("x4")],E);var We,I=class extends d{constructor(t){super({...t,tag:"button",content:null});te(this,We);this.mapPropEvents(t,"click"),t.autorepeat?(this.addDOMEvent("pointerdown",o=>this._on_mouse(o)),this.addDOMEvent("pointerup",o=>this._on_mouse(o))):this.addDOMEvent("click",o=>this._on_click(o)),this.addDOMEvent("keydown",o=>this._on_keydown(o)),this.setContent([new E({id:"icon",iconId:this.props.icon}),oe(this,We,new d({id:"label"}))]),this.setText(t.label),t.tabindex!==!1&&this.setAttribute("tabindex",t.tabindex)}_on_click(t){this.fire("click",{}),t.preventDefault(),t.stopPropagation()}_on_mouse(t){let o=0;if(t.type=="pointerdown"){this.dom.setPointerCapture(t.pointerId);let r=this.props.autorepeat===!0?200:this.props.autorepeat;this.setTimeout("repeat",500,()=>{o++,this.fire("click",{}),this.setInterval("repeat",r,()=>{this.fire("click",{})})})}else this.clearTimeout("repeat"),o||this.fire("click",{})}click(){this.dom.click()}_on_keydown(t){t.key=="Enter"&&(this.click(),t.preventDefault())}setText(t){P(this,We).setContent(t),P(this,We).setClass("empty",!t)}setIcon(t){this.query("#icon").setIcon(t)}};We=new WeakMap,s(I,"Button"),I=p([u("x4")],I);var pe=class extends C{constructor(e){super(e),e.align&&this.addClass("align-"+e.align),this.addClass(e.vertical?"x4vbox":"x4hbox"),e.items&&this.setButtons(e.items),this.mapPropEvents(e,"btnclick")}setButtons(e){this.clearContent();let t=[],o=s((r,n)=>{let i=r.indexOf(n);if(i>=0)return r.splice(i,1),!0},"hasOption");e==null||e.forEach(r=>{if(r==="-"||r===">>")r=new ne;else if(r=="~")r=new Vt("1em");else if(D(r)){let n,i=r,[a,...c]=i.split("."),h="";switch(a){case"ok":n=y.global.ok;break;case"cancel":n=y.global.cancel;break;case"abort":n=y.global.abort;break;case"no":n=y.global.no;break;case"yes":n=y.global.yes;break;case"retry":n=y.global.retry;break}r=new I({cls:h,id:a,label:n,click:s(()=>{this.fire("btnclick",{button:a})},"click")}),o(c,"default")&&r.addClass("default"),o(c,"autofocus")&&r.setAttribute("autofocus",!0),o(c,"disabled")&&r.enable(!1),r.addClass(c.join(" "))}t.push(r)}),super.setContent(t)}getButton(e){return this.query("#"+e)}};s(pe,"BtnGroup"),pe=p([u("x4")],pe);var je,w=class extends d{constructor(t){super({...t,content:null});te(this,je);this.setContent([new E({id:"icon",iconId:this.props.icon}),oe(this,je,new d({tag:"span",id:"text"}))]);let o=this.props.text;this.setText(o),t.labelFor&&this.setAttribute("for",t.labelFor)}setText(t){P(this,je).setContent(t),P(this,je).setClass("empty",!t)}setIcon(t){this.query("#icon").setIcon(t)}};je=new WeakMap,s(w,"Label"),w=p([u("x4")],w);var V=class extends d{constructor(e){super({...e}),this.setContent(e.text),e.align&&this.addClass("al-"+e.align)}setText(e){this.setContent(e),this.setClass("empty",!e)}};s(V,"SimpleText"),V=p([u("x4")],V);var L=class extends d{_type;_ref;_delta;constructor(e,t){super({}),this._type=e,this.addClass(e),this.addDOMEvent("pointerdown",o=>{this.setCapture(o.pointerId),this._ref=t!=null?t:T(this.dom.parentElement),this._delta={x:0,y:0};let r=this._ref.getBoundingRect();this._type.includes("left")?this._delta.x=o.pageX-r.left:this._delta.x=o.pageX-(r.left+r.width),this._type.includes("top")?this._delta.y=o.pageY-r.top:this._delta.y=o.pageY-(r.top+r.height),this.fire("start",{})}),this.addDOMEvent("pointerup",o=>{this.fire("stop",{}),this.releaseCapture(o.pointerId),this._ref=null}),this.addDOMEvent("pointermove",o=>{this._onMouseMove(o)})}_onMouseMove(e){if(!this._ref)return;let t={x:e.pageX-this._delta.x,y:e.pageY-this._delta.y},o=this._ref.getBoundingRect(),r={},n=!0;this._type.includes("top")&&(r.top=t.y,r.height=o.top+o.height-t.y,n=!1),this._type.includes("bottom")&&(r.height=t.y-o.top,n=!1),this._type.includes("left")&&(r.left=t.x,r.width=o.left+o.width-t.x),this._type.includes("right")&&(r.width=t.x-o.left),this._ref.setStyle(r);let i=this._ref.getBoundingRect();this.fire("resize",{size:n?i.width:i.height}),e.preventDefault(),e.stopPropagation()}};s(L,"CSizer"),L=p([u("x4")],L);var j=[],Go=[],se=[],Ye;function Yt(){return document.body}s(Yt,"getRoot");var B=class extends C{_isshown=!1;_ismodal=!1;constructor(e){super(e),this.props.sizable&&this._createSizers(),Z(()=>{(this.props.movable===!0||this.props.sizable&&this.props.movable===void 0)&&(this.queryAll(".caption-element").forEach(o=>new Qt(o,this)),this.hasClass("popup-caption")&&new Qt(this,this))})}displayNear(e,t="top left",o="top left",r={x:0,y:0}){this.setStyle({left:"0px",top:"0px"}),this._do_show();let n=this.getBoundingRect(),i=e.left,a=e.top;o.indexOf("right")>=0?i=e.left+e.width:o.indexOf("center")>=0&&(i=e.left+e.width/2),o.indexOf("bottom")>=0?a=e.bottom:o.indexOf("middle")>=0&&(a=e.top+e.height/2),t.indexOf("right")>=0?i-=n.width:t.indexOf("center")>=0&&(i-=n.width/2),t.indexOf("bottom")>=0?a-=n.height:t.indexOf("middle")>=0&&(a-=n.height/2),r&&(i+=r.x,a+=r.y),i+=document.scrollingElement.scrollLeft,a+=document.scrollingElement.scrollTop,this.displayAt(i,a)}displayCenter(e=!0){this.setClass("center",e),this._do_show()}displayAt(e,t){this.setStyle({left:e+"px",top:t+"px"}),this._do_show();let o=this.getBoundingRect(),r=window.innerWidth-16,n=window.innerHeight-16;o.right>r&&this.setStyleValue("left",r-o.width),o.bottom>n&&this.setStyleValue("top",n-o.height)}isOpen(){return this._isshown}_do_hide(){if(!this._isshown)return;if(this.__hide(),this.__remove(),this._ismodal)if(se[se.length-1]!=this){let t=se.findIndex(o=>o===this);t>=0&&se.splice(t,1)}else se.pop(),this._hideModalMask();let e=Go.indexOf(this);if(console.assert(e>=0),Go.splice(e,1),this.props.autoClose){let t=j.indexOf(this);t>=0&&(j.splice(t,1),j.length==0&&document.removeEventListener("pointerdown",this._dismiss))}this._isshown=!1,this.fire("closed",{})}_do_show(){this._isshown||(this._isshown=!0,this.__append(),this._ismodal&&(se.push(this),this._showModalMask()),this.__show(),this.props.autoClose&&(j.length==0&&document.addEventListener("pointerdown",this._dismiss),j.push(this),this.setData("close",this.props.autoClose===!0?q():this.props.autoClose)),Go.push(this),this.fire("opened",{}))}__show(){super.show(!0)}__hide(){super.show(!1)}__append(){Yt().appendChild(this.dom)}__remove(){Yt().removeChild(this.dom)}show(e=!0){return e?this.displayCenter():this._do_hide(),this}close(){this._do_hide()}_dismiss=s(e=>{j.some(o=>o.dom.contains(e.target))||(e.preventDefault(),e.stopPropagation(),this.dismiss())},"_dismiss");dismiss(e=!1){if(j.length==0)return;let t=this.getData("close"),o=[],r=[],n=-1;e&&(n=j.indexOf(this)),j.forEach((a,c)=>{a.getData("close")==t&&c>n?o.push(a):r.push(a)});let i=o.reverse();j=r,j.length==0&&document.removeEventListener("pointerdown",this._dismiss),i.forEach(a=>a.close())}_createSizers(){this.appendContent([new L("top"),new L("bottom"),new L("left"),new L("right"),new L("top-left"),new L("bottom-left"),new L("top-right"),new L("bottom-right")])}_showModalMask(){Ye||(Ye=new d({cls:"x4modal-mask"})),Yt().insertBefore(Ye.dom,this.dom)}_hideModalMask(){if(Ye){let e=Yt();if(se.length){let t=se[se.length-1];e.insertBefore(Ye.dom,t.dom)}else e.removeChild(Ye.dom)}}};s(B,"Popup"),B=p([u("x4")],B);var Wo=class Wo{ref;delta;self;constructor(e,t){this.self=!!t,e.addDOMEvent("pointerdown",o=>{if(this.self&&o.target!=e.dom)return;e.setCapture(o.pointerId),this.ref=t!=null?t:T(e.dom.parentElement),this.delta={x:0,y:0};let r=this.ref.getBoundingRect();this.delta.x=o.pageX-r.left,this.delta.y=o.pageY-r.top}),e.addDOMEvent("pointerup",o=>{e.releaseCapture(o.pointerId),this.ref=null}),e.addDOMEvent("pointermove",o=>{this._onMouseMove(o)})}_onMouseMove(e){if(!this.ref)return;let t={x:e.pageX-this.delta.x,y:e.pageY-this.delta.y},o=this.ref.getBoundingRect(),r={};this.ref.setStyle({top:t.y+"",left:t.x+""}),e.preventDefault(),e.stopPropagation()}};s(Wo,"CMover");var Qt=Wo;var Ir=400,ye=class extends d{constructor(){super({})}};s(ye,"CMenuSep"),ye=p([u("x4")],ye);var $t=new Oe,ue=class extends d{menu;constructor(e){super({disabled:e.disabled,cls:e.cls}),e.menu&&this.addClass("popup"),this.setContent([new E({id:"icon",iconId:e.icon}),new d({id:"text",content:e.text})]),e.menu?(this.menu=e.menu,this.addDOMEvent("mouseenter",()=>this.openSub(!0)),this.addDOMEvent("click",()=>this.openSub(!1)),this.addDOMEvent("mouseleave",()=>this.closeSub()),this.menu.on("opened",()=>this.addClass("opened")),this.menu.on("closed",()=>this.removeClass("opened"))):(this.addDOMEvent("mouseenter",()=>{$t.setTimeout("open",Ir,()=>{this.dismiss(!0)})}),this.addDOMEvent("click",()=>{this.dismiss(!1),e.click&&e.click(new Event("click"))}))}dismiss(e){let t=this.parentElement(Y);t&&t.dismiss(e)}openSub(e){let t=s(()=>{this.dismiss(!0);let o=this.getBoundingRect();this.menu.displayAt(o.right-4,o.top)},"open");e?$t.setTimeout("open",Ir,t):($t.clearTimeout("open"),t())}closeSub(){$t.clearTimeout("open")}};s(ue,"CMenuItem"),ue=p([u("x4")],ue);var Y=class extends B{constructor(e){var o;super({...e,autoClose:"menu"}),this.addClass("x4vbox");let t=(o=e.items)==null?void 0:o.map(r=>r==="-"?new ye:D(r)?new ue({text:r,click:null,cls:"title"}):r instanceof d?r:new ue(r));this.setContent(t)}};s(Y,"Menu"),Y=p([u("x4")],Y);var Ar='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512" fill="currentColor"><!--!Font Awesome Pro 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2024 Fonticons, Inc.--><path d="M9.4 256l11.3-11.3 192-192L224 41.4 246.6 64 235.3 75.3 54.6 256 235.3 436.7 246.6 448 224 470.6l-11.3-11.3-192-192L9.4 256z"/></svg>';var Mr='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" fill="currentColor"><!--!Font Awesome Pro 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2024 Fonticons, Inc.--><path d="M128 16l0-16L96 0l0 16 0 48L32 64 0 64 0 96l0 64 0 32L0 480l0 32 32 0 384 0 32 0 0-32 0-288 0-32 0-64 0-32-32 0-64 0 0-48 0-16L320 0l0 16 0 48L128 64l0-48zM32 192l384 0 0 288L32 480l0-288zm0-96l384 0 0 64L32 160l0-64zM331.3 283.3L342.6 272 320 249.4l-11.3 11.3L208 361.4l-52.7-52.7L144 297.4 121.4 320l11.3 11.3 64 64L208 406.6l11.3-11.3 112-112z"/></svg>';var Dr='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512" fill="currentColor"><!--!Font Awesome Pro 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2024 Fonticons, Inc.--><path d="M310.6 256l-11.3 11.3-192 192L96 470.6 73.4 448l11.3-11.3L265.4 256 84.7 75.3 73.4 64 96 41.4l11.3 11.3 192 192L310.6 256z"/></svg>';var Qe=class extends k{m_date;constructor(e){super(e),this.mapPropEvents(e,"change"),this.m_date=e.date?ze(e.date):new Date,this._update()}_update(){let e=ze(this.m_date);e.setDate(1);let t=e.getDay();t==0&&(t=7),e.setDate(-t+1+1);let o=ze(e),r=be(this.m_date),n=be(new Date),i=ze(this.m_date);i.setDate(1),i.setMonth(i.getMonth()+1),i.setDate(0);let a=be(i),c=[],h=new b({cls:"month-sel",content:[new w({cls:"month",text:Q(this.m_date,"O"),dom_events:{click:s(()=>this._choose("month"),"click")}}),new w({cls:"year",text:Q(this.m_date,"Y"),dom_events:{click:s(()=>this._choose("year"),"click")}}),new ne,new I({icon:Ar,click:s(()=>this._next(!1),"click")}),new I({icon:Mr,click:s(()=>this.setDate(new Date),"click"),tooltip:y.global.today}),new I({icon:Dr,click:s(()=>this._next(!0),"click")})]});c.push(h);let m=[];m.push(new b({cls:"weeknum cell"}));for(let x=0;x<7;x++)m.push(new w({cls:"cell",text:y.global.day_short[(x+1)%7]}));c.push(new b({cls:"week header",content:m}));let f=this.m_date.getMonth(),g=!0;for(;be(o)<=a;){let x=[new b({cls:"weeknum cell",content:new d({tag:"span",content:Q(o,"w")})})];for(let _=0;_<7;_++){let N="cell day";be(o)==r&&(N+=" selection"),be(o)==n&&(N+=" today"),o.getMonth()!=f&&(N+=" out");let v=s(S=>new b({cls:N,flex:1,content:new d({cls:"text",content:xt(`<span>${Q(S,"d")}</span>`)}),dom_events:{click:s(()=>this.select(S),"click")}}),"mkItem");x.push(v(ze(o))),o.setDate(o.getDate()+1),g=!1}c.push(new b({cls:"week",flex:1,content:x}))}this.setContent(c)}select(e){this.m_date=e,this.fire("change",{value:e}),this._update()}_next(e){this.m_date.setMonth(this.m_date.getMonth()+(e?1:-1)),this._update()}_choose(e){var n,i,a,c;let t=[];if(e=="month")for(let h=0;h<12;h++)t.push({text:y.global.month_long[h],click:s(()=>{this.m_date.setMonth(h),this._update()},"click")});else if(e=="year"){let h=(i=(n=this.props.minDate)==null?void 0:n.getFullYear())!=null?i:1900,m=(c=(a=this.props.maxDate)==null?void 0:a.getFullYear())!=null?c:2037;for(let f=m;f>=h;f--)t.push({text:""+f,click:s(()=>{this.m_date.setFullYear(f),this._update()},"click")})}let o=new Y({items:t}),r=this.getBoundingRect();o.displayAt(r.left,r.top)}getDate(){return this.m_date}setDate(e){this.m_date=e,this._update()}};s(Qe,"Calendar"),Qe=p([u("x4")],Qe);function Pr(l,e,t){let o=l;return o.width=e,o.height=t,o.smoothLine=Cn,o.smoothLineEx=En,o.line=In,o.roundRect=An,o.calcTextSize=Mn,o.setFontSize=Dn,o.circle=Pn,o}s(Pr,"createPainter");function Cn(l,e=null,t=!0){if(l.length<2)return;if(e||(e=this),l.length==2){t!==!1?e.moveTo(l[0].x,l[0].y):e.lineTo(l[0].x,l[0].y),e.lineTo(l[1].x,l[1].y);return}function o(c,h){return{x:c.x+(h.x-c.x)/2,y:c.y+(h.y-c.y)/2}}s(o,"midPointBtw");function r(c,h,m,f,g,x,_){return{x:(1-c)*(1-c)*h+2*(1-c)*c*f+c*c*x,y:(1-c)*(1-c)*m+2*(1-c)*c*g+c*c*_}}s(r,"getQuadraticXY");let n=l[0],i=l[1],a=n;e.moveTo(n.x,n.y);for(let c=1,h=l.length;c<h;c++){let m=o(n,i);for(let f=0;f<8;f++){let{x:g,y:x}=r(f/8,a.x,a.y,n.x,n.y,m.x,m.y);e.lineTo(g,x)}n=l[c],i=l[c+1],a=m}e.lineTo(n.x,n.y)}s(Cn,"smoothLine");function En(l,e=.5,t=10,o=null,r=!0,n=!1){let i=[];for(let v=0,S=l.length;v<S;v++)i.push(l[v].x),i.push(l[v].y);let a,c=1,h=i.length,m=0,f=(h-2)*t+2+(n?2*t:0),g=new Float32Array(f),x=new Float32Array((t+2)*4),_=4;for(a=i.slice(0),n?(a.unshift(i[h-1]),a.unshift(i[h-2]),a.push(i[0],i[1])):(a.unshift(i[1]),a.unshift(i[0]),a.push(i[h-2],i[h-1])),x[0]=1;c<t;c++){let v=c/t,S=v*v,R=S*v,F=R*2,U=S*3;x[_++]=F-U+1,x[_++]=U-F,x[_++]=R-2*S+v,x[_++]=R-S}x[_]=1,N(a,x,h),n&&(a=[],a.push(i[h-4],i[h-3],i[h-2],i[h-1]),a.push(i[0],i[1],i[2],i[3]),N(a,x,4));function N(v,S,R){for(let F=2,U;F<R;F+=2){let It=v[F],At=v[F+1],Mt=v[F+2],Xo=v[F+3],Zr=(Mt-v[F-2])*e,Xr=(Xo-v[F-1])*e,Jr=(v[F+4]-It)*e,en=(v[F+5]-At)*e;for(U=0;U<t;U++){let Dt=U<<2,Jo=S[Dt],er=S[Dt+1],tr=S[Dt+2],or=S[Dt+3];g[m++]=Jo*It+er*Mt+tr*Zr+or*Jr,g[m++]=Jo*At+er*Xo+tr*Xr+or*en}}}s(N,"parse"),h=n?0:i.length-2,g[m++]=i[h],g[m]=i[h+1],o||(o=this);for(let v=0,S=g.length;v<S;v+=2)v==0&&r!==!1?o.moveTo(g[v],g[v+1]):o.lineTo(g[v],g[v+1])}s(En,"smoothLineEx");function In(l,e,t,o,r,n=1){this.save(),this.beginPath(),this.moveTo(l,e),this.lineTo(t,o),this.lineWidth=n,this.strokeStyle=r,this.stroke(),this.restore()}s(In,"line");function An(l,e,t,o,r){this.moveTo(l+r,e),this.lineTo(l+t-r,e),this.quadraticCurveTo(l+t,e,l+t,e+r),this.lineTo(l+t,e+o-r),this.quadraticCurveTo(l+t,e+o,l+t-r,e+o),this.lineTo(l+r,e+o),this.quadraticCurveTo(l,e+o,l,e+o-r),this.lineTo(l,e+r),this.quadraticCurveTo(l,e,l+r,e),this.closePath()}s(An,"roundRect");function Mn(l,e=!1){let t=this.measureText(l),o=t.fontBoundingBoxAscent+t.fontBoundingBoxDescent;return e?{width:Math.round(t.width),height:Math.round(o)}:{width:t.width,height:o}}s(Mn,"calcTextSize");function Dn(l){let e=Math.round(l)+"px";this.font=this.font.replace(/\d+px/,e)}s(Dn,"setFontSize");function Pn(l,e,t){this.moveTo(l+t,e),this.arc(l,e,t,0,Math.PI*2)}s(Pn,"circle");var $e=class extends d{m_iwidth=-1;m_iheight=-1;m_scale=1;m_canvas;constructor(e){super(e),this.mapPropEvents(e,"paint"),this.addDOMEvent("resized",()=>{this._paint()}),this.m_iwidth=-1,this.m_iheight=-1,this.m_canvas=new d({tag:"canvas"}),this.setContent(this.m_canvas)}scale(e){this.m_scale=e,this.m_iwidth=-1,this.redraw()}get canvas(){return this.m_canvas}getContext(){return this.m_canvas.dom.getContext("2d")}$update_rep=0;redraw(e){e!==void 0?++this.$update_rep>=20?(this.clearTimeout("update"),this._paint()):this.setTimeout("update",e,()=>this._paint()):(this.clearTimeout("update"),this._paint())}_paint(){this.$update_rep=0;let e=this.dom;if(!this.isVisible())return;let t=e.clientWidth,o=e.clientHeight,r=this.getContext();if(t!=this.m_iwidth||o!=this.m_iheight){let n=window.devicePixelRatio||1,i=r.webkitBackingStorePixelRatio||r.mozBackingStorePixelRatio||r.msBackingStorePixelRatio||r.oBackingStorePixelRatio||r.backingStorePixelRatio||1,a=this.canvas;if(this.m_scale!=1){let c=1,h=t*c,m=o*c;a.setAttribute("width",""+h),a.setAttribute("height",""+m),a.setStyleValue("width",t),a.setStyleValue("height",o),c*=this.m_scale,r.scale(c,c)}else a.setAttribute("width",""+t),a.setAttribute("height",""+o),a.setStyleValue("width",t),a.setStyleValue("height",o),r.scale(1,1);this.m_iwidth=t,this.m_iheight=o}if(t&&o){let n=Pr(r,t,o);this.props.clear&&n.clearRect(0,0,t/this.m_scale,o/this.m_scale),n.save(),n.translate(-.5,-.5),this.paint(n),n.restore()}}paint(e){try{this.props.paint_cb?this.props.paint_cb(e):this.fire("paint",{ctx:e})}catch(t){console.assert(!1,t)}}};s($e,"Canvas"),$e=p([u("x4")],$e);var A=class extends d{constructor(e){var t;switch(super({tag:"input",...e}),this.mapPropEvents(e,"focus","change"),this.setAttribute("type",(t=e.type)!=null?t:"text"),this.setAttribute("name",e.name),e.autofocus===!0&&this.setAttribute("autofocus",!0),e.type){case"checkbox":case"radio":{let o=this.dom;o.checked=e.checked,o.value=e.value===void 0?"":e.value+"";break}case"range":{this.setAttribute("min",e.min),this.setAttribute("max",e.max),this.setAttribute("step",e.step),this.setAttribute("value",e.value);break}case"number":{let o=this.props;this.setAttribute("required",o.required),this.setAttribute("readonly",o.readonly),this.setAttribute("min",o.min),this.setAttribute("max",o.max),this.setAttribute("step",o.step),this.setNumValue(D(o.value)?parseFloat(o.value):o.value,-2),this.addDOMEvent("wheel",r=>{if(this.hasFocus()){r.preventDefault();let n=this.getNumValue(),i=r.deltaY<0?1:-1;n+=(o.step?o.step:1)*i,this.setNumValue(n,-2),this.dom.dispatchEvent(new Event("input"))}});break}case"date":{this.setAttribute("required",e.required);let o=e.value;o instanceof Date?this.setAttribute("value",Q(o,"Y-M-D")):e.value!==null&&e.value!==void 0&&this.setAttribute("value",o);break}case"file":{let o;Array.isArray(e.accept)?o=e.accept.join(","):o=e.accept,this.setAttribute("accept",o);break}case"time":{this.setAttribute("required",e.required),e.value!==null&&e.value!==void 0&&this.setAttribute("value",e.value);break}default:{this.setAttribute("required",e.required),this.setAttribute("readonly",e.readonly),e.value!==null&&e.value!==void 0&&this.setAttribute("value",e.value),e.pattern!==null&&e.pattern!==void 0&&this.setAttribute("pattern",e.pattern),e.placeholder!==null&&e.placeholder!==void 0&&this.setAttribute("placeholder",e.placeholder),e.spellcheck===!1&&this.setAttribute("spellcheck",!1),e.minlength!==void 0&&this.setAttribute("minlength",e.minlength),e.maxlength!==void 0&&this.setAttribute("maxlength",e.maxlength);break}}this.addDOMEvent("blur",o=>{this.on_focus(o,!0)}),this.addDOMEvent("focus",o=>{this.on_focus(o,!1)}),this.addDOMEvent("input",o=>{this.on_change(o)})}on_focus(e,t){let o={focus_out:t};this.fire("focus",o),o.defaultPrevented&&e.preventDefault()}on_change(e){let t={value:this.getValue()};this.fire("change",t),t.defaultPrevented&&e.preventDefault()}getValue(){return this.dom.value}setValue(e){this.dom.value=e+""}getNumValue(e){let t=parseFloat(this.getValue());return isNaN(t)&&e!==void 0?e:t}setNumValue(e,t=-1){var o;if(t==-2&&this.props.type=="number"){let r=this.props;if(r.step<1){let n=-Math.floor(Math.log10((o=r.step)!=null?o:1));return this.setValue(e.toFixed(n))}else if(r.step>1)return this.setValue(e.toFixed())}else if(t>=0)return this.setValue(e.toFixed(t));this.setValue(e+"")}getCheck(){return this.dom.checked}setCheck(e){let t=this.dom;t.checked=e}setReadOnly(e){let t=this.dom;t.readOnly=e}selectAll(){this.dom.select()}select(e,t=9999){this.dom.setSelectionRange(e,e+t)}getSelection(){let e=this.dom;return{start:e.selectionStart,length:e.selectionEnd-e.selectionStart}}isValid(){return!(this.props.required&&this.getValue()==="")}queryInterface(e){return e=="form-element"?{getRawValue:s(()=>{if(this.props.type=="checkbox")return this.getCheck();if(this.props.type=="radio"){let r=Tn(this.dom).querySelector(`input[name="${this.props.name}"]:checked`);return r?r.value:void 0}return this.getValue()},"getRawValue"),setRawValue:s(o=>{this.props.type=="checkbox"||this.props.type=="radio"?this.setCheck(!!o):this.setValue(o)},"setRawValue"),isValid:s(()=>this.isValid(),"isValid")}:super.queryInterface(e)}};s(A,"Input"),A=p([u("x4")],A);function Tn(l){for(;l!=document.body;){if(T(l).queryInterface("tab-handler"))return l;l=l.parentElement}return document}s(Tn,"getRadioOwner");var Zt='data:image/svg+xml,<svg viewBox="0 0 10 7" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">%0D%0A%09<path d="M4 4.586L1.707 2.293A1 1 0 1 0 .293 3.707l3 3a.997.997 0 0 0 1.414 0l5-5A1 1 0 1 0 8.293.293L4 4.586z" fill="currentColor" fill-rule="evenodd" clip-rule="evenodd">%0D%0A%09</path>%0D%0A</svg>';var Ze=class extends d{_input;constructor(e){super(e);let t=q();this.mapPropEvents(e,"change"),this.setContent([new d({cls:"inner",content:[this._input=new A({type:"checkbox",id:t,name:e.name,checked:e.checked,dom_events:{change:s(()=>this._on_change(),"change")}})]}),new w({tag:"label",text:e.label,labelFor:t,id:void 0})]),yt.load(Zt).then(o=>{this.query(".inner").dom.insertAdjacentHTML("beforeend",o)}),this.addDOMEvent("click",o=>this._on_click(o))}_on_click(e){e.target==this.dom&&(this._input.dom.click(),e.preventDefault(),e.stopPropagation())}_on_change(){this.fire("change",{value:this.getCheck()})}getCheck(){return this._input.getCheck()}setCheck(e){this._input.setCheck(e)}setLabel(e){this.query("label").setText(e)}toggle(){this.setCheck(!this.getCheck())}};s(Ze,"Checkbox"),Ze=p([u("x4")],Ze);var Tr='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="currentColor"><!--!Font Awesome Pro 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2024 Fonticons, Inc.--><path d="M479.4 240L384 240l-16 0 0 32 16 0 95.4 0C471.6 383 383 471.6 272 479.4l0-95.4 0-16-32 0 0 16 0 95.4C129 471.6 40.4 383 32.6 272l95.4 0 16 0 0-32-16 0-95.4 0C40.4 129 129 40.4 240 32.6l0 95.4 0 16 32 0 0-16 0-95.4C383 40.4 471.6 129 479.4 240zM256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512z"/></svg>';var ke=class extends b{constructor(e){super(e);let t,o;this.setContent([t=new d({cls:"swatch"}),o=new A({type:"text",value:"",spellcheck:!1}),St("eyedropper")?new I({icon:Tr,click:s(()=>{new window.EyeDropper().open().then(a=>{n=new H(a.sRGBHex),r(n)})},"click")}):null]),o.addDOMEvent("input",()=>{let i=o.getValue(),a=new H(i);a.isInvalid()||(n=a,r(n))});let r=s(i=>{t.setStyleValue("backgroundColor",i.toRgbString(!1)),o.setValue(i.toRgbString(!1))},"updateColor"),n;e.color instanceof H?n=e.color:n=new H(e.color),r(n)}};s(ke,"ColorInput"),O(ke,"$cls-ns","x4"),ke=p([u("x4")],ke);var Ce=class extends C{mdown=!1;irect;hsv={hue:1,saturation:1,value:1,alpha:1};color;thumb;constructor(e,t){super(e),this.setContent([this.color=new d({cls:"overlay"}),new d({cls:"overlay",style:{backgroundImage:"linear-gradient(90deg, rgb(255, 255, 255), transparent)"}}),new d({cls:"overlay",style:{backgroundImage:"linear-gradient(0deg, rgb(0, 0, 0), transparent)"}}),this.thumb=new d({cls:"thumb"})]),this.setDOMEvents({pointerdown:s(o=>this.mousedown(o),"pointerdown"),pointermove:s(o=>this.mousemove(o),"pointermove"),pointerup:s(o=>this.mouseup(o),"pointerup"),created:s(()=>this.updateThumbMarker(),"created")}),this.updateBaseColor(t)}mousedown(e){this.mdown=!0,this.irect=this.getBoundingRect(),this.setCapture(e.pointerId)}mousemove(e){if(this.mdown){let t=this.irect,r=G(e.clientX-t.left,0,t.width)/t.width,i=G(e.clientY-t.top,0,t.height)/t.height;this.hsv.saturation=r,this.hsv.value=1-i,this.updateThumbMarker(),this.fire("sat_change",{saturation:this.hsv.saturation,value:this.hsv.value})}}mouseup(e){this.mdown&&(this.releaseCapture(e.pointerId),this.mdown=!1)}updateThumbMarker(){let e=this.color.getBoundingRect();this.thumb.setStyle({left:this.hsv.saturation*e.width+"px",bottom:this.hsv.value*e.height+"px"})}updateBaseColor(e){let t=new H(0,0,0);t.setHsv(e.hue,1,1,1),this.color.setStyleValue("backgroundColor",t.toRgbString(!1))}move(e,t){switch(e){case"saturation":{this.hsv.saturation+=t,this.hsv.saturation<0?this.hsv.saturation=0:this.hsv.saturation>1&&(this.hsv.saturation=1),this.fire("sat_change",{saturation:this.hsv.saturation,value:this.hsv.value}),this.updateThumbMarker();break}case"value":{this.hsv.value+=t,this.hsv.value<0?this.hsv.value=0:this.hsv.value>1&&(this.hsv.value=1),this.fire("sat_change",{saturation:this.hsv.saturation,value:this.hsv.value}),this.updateThumbMarker();break}}}};s(Ce,"Saturation"),Ce=p([u("x4")],Ce);var Ee=class extends C{thumb;hsv={hue:1,saturation:1,value:1,alpha:1};mdown=!1;irect;constructor(e,t){super(e),this.setContent([this.thumb=new d({cls:"thumb",left:"50%"})]),this.setDOMEvents({pointerdown:s(o=>this.mousedown(o),"pointerdown"),pointermove:s(o=>this.mousemove(o),"pointermove"),pointerup:s(o=>this.mouseup(o),"pointerup")}),this.updateHue(t)}mousedown(e){this.mdown=!0,this.irect=this.getBoundingRect(),this.setCapture(e.pointerId)}mousemove(e){if(this.mdown){let t=this.irect,r=G(e.clientX-t.left,0,t.width)/t.width;this.hsv.hue=r,this.updateHue(this.hsv),this.fire("hue_change",{hue:this.hsv.hue})}}mouseup(e){this.mdown&&(this.releaseCapture(e.pointerId),this.mdown=!1)}updateHue(e){this.hsv.hue=e.hue,this.thumb.setStyleValue("left",e.hue*100+"%")}move(e){this.hsv.hue+=e,this.hsv.hue<0?this.hsv.hue=0:this.hsv.hue>1&&(this.hsv.hue=1),this.fire("hue_change",{hue:this.hsv.hue}),this.updateHue(this.hsv)}};s(Ee,"HueSlider"),Ee=p([u("x4")],Ee);var Ie=class extends C{thumb;color;hsv={hue:1,saturation:1,value:1,alpha:1};mdown=!1;irect;constructor(e,t){super(e),this.setContent([new d({cls:"overlay checkers"}),this.color=new d({cls:"overlay color"}),this.thumb=new d({cls:"thumb",left:"50%"})]),this.setDOMEvents({pointerdown:s(o=>this._on_mousedown(o),"pointerdown"),pointermove:s(o=>this._on_mousemove(o),"pointermove"),pointerup:s(o=>this._on_mouseup(o),"pointerup")}),this.updateAlpha(),this.updateBaseColor(t)}_on_mousedown(e){this.mdown=!0,this.irect=this.getBoundingRect(),this.setCapture(e.pointerId)}_on_mousemove(e){if(this.mdown){let t=this.irect,r=G(e.clientX-t.left,0,t.width)/t.width;this.hsv.alpha=r,this.updateAlpha(),this.fire("alpha_change",{alpha:this.hsv.alpha})}}_on_mouseup(e){this.mdown&&(this.releaseCapture(e.pointerId),this.mdown=!1)}updateAlpha(){this.thumb.setStyleValue("left",this.hsv.alpha*100+"%")}updateBaseColor(e){let t=new H(0,0,0);t.setHsv(e.hue,e.saturation,e.value,1),this.color.setStyleValue("backgroundImage",`linear-gradient(90deg, transparent, ${t.toRgbString(!1)})`)}setColor(e){this.hsv=e,this.updateBaseColor(e),this.updateAlpha()}move(e){this.hsv.alpha+=e,this.hsv.alpha<0?this.hsv.alpha=0:this.hsv.alpha>1&&(this.hsv.alpha=1),this.fire("alpha_change",{alpha:this.hsv.alpha}),this.updateAlpha()}};s(Ie,"AlphaSlider"),Ie=p([u("x4")],Ie);var Xe=class extends k{_base;_sat;_swatch;_hue;_alpha;constructor(e){super(e),e.color instanceof H?this._base=e.color:this._base=new H(e.color);let t=this._base.toHsv();this.setAttribute("tabindex",0),this.setContent([this._sat=new Ce({},t),new b({cls:"body",content:[new k({cls:"x4flex",content:[this._hue=new Ee({},t),this._alpha=new Ie({},t)]}),new C({cls:"swatch",content:[new d({cls:"overlay checkers"}),this._swatch=new d({cls:"overlay"})]})]})]),this._sat.on("sat_change",r=>{t.saturation=r.saturation,t.value=r.value,o(),this._alpha.updateBaseColor(t)}),this._hue.on("hue_change",r=>{t.hue=r.hue,this._sat.updateBaseColor(t),this._alpha.updateBaseColor(t),o()}),this._alpha.on("alpha_change",r=>{t.alpha=r.alpha,o()});let o=s(()=>{this._base.setHsv(t.hue,t.saturation,t.value,t.alpha),this._swatch.setStyleValue("backgroundColor",this._base.toRgbString()),this._swatch.setAttribute("tooltip",this._base.toRgbString()),this.fire("change",{color:this._base})},"updateColor");St("eyedropper")&&this._swatch.addDOMEvent("click",r=>{new window.EyeDropper().open().then(i=>{t=new H(i.sRGBHex).toHsv(),this._alpha.setColor(t),this._sat.updateBaseColor(t),this._hue.updateHue(t),o()})}),this.addDOMEvent("keydown",r=>this._onkey(r)),o()}_onkey(e){switch(e.key){case"ArrowLeft":{e.ctrlKey?this._hue.move(-.01):this._sat.move("saturation",-.01);break}case"ArrowRight":{e.ctrlKey?this._hue.move(.01):this._sat.move("saturation",.01);break}case"ArrowUp":{e.ctrlKey?this._alpha.move(.01):this._sat.move("value",.01);break}case"ArrowDown":{e.ctrlKey?this._alpha.move(-.01):this._sat.move("value",-.01);break}}}};s(Xe,"ColorPicker"),Xe=p([u("x4")],Xe);var ae=class extends d{constructor(e){super(e)}};s(ae,"Viewport"),ae=p([u("x4")],ae);var J=class extends d{constructor(e){super(e),this.setContent(new ae({}))}getViewport(){return this.firstChild()}};s(J,"ScrollView"),J=p([u("x4")],J);var me=class extends d{_view;_lastsel;_multisel;_items;preventFocus=!1;constructor(e){super({...e}),this.setAttribute("tabindex",0),this.mapPropEvents(e,"dblClick","selectionChange","contextMenu");let t=new J({cls:"body"});this._view=t.getViewport(),this._multisel=new Set,this._items=[],e.footer&&e.footer.setAttribute("id","footer"),e.header&&e.header.setAttribute("id","header"),this.setContent([e.header?e.header:null,t,e.footer]),this.setDOMEvents({click:s(o=>this._on_click(o),"click"),keydown:s(o=>this._on_key(o),"keydown"),dblclick:s(o=>this._on_click(o),"dblclick"),contextmenu:s(o=>this._on_ctx_menu(o),"contextmenu")}),e.items&&this.setItems(e.items)}_on_key(e){if(!this.isDisabled()){switch(e.key){case"ArrowDown":{this.navigate(4);break}case"ArrowUp":{this.navigate(1);break}case"Home":{this.navigate(0);break}case"End":{this.navigate(5);break}default:return}e.preventDefault(),e.stopPropagation()}}navigate(e){this._lastsel||(e==4?e=0:e=5);let t=s((o,r)=>{for(;o&&!o.isVisible();)o=r?o.nextElement():o.prevElement();return o},"next_visible");if(e==0||e==5){let o=e==0?this._view.firstChild():this._view.lastChild();if(o=t(o,e==0),o){let r=o.getInternalData("id");return this._selectItem(r,o,"single"),!0}}else{let o=this._itemWithID(this._lastsel),r=e==4?o.nextElement():o.prevElement();if(r=t(r,e==4),r){let n=r.getInternalData("id");return this._selectItem(n,r,"single"),!0}}return!1}_itemWithID(e){return this._view.enumChildComponents(!1).find(o=>o.getInternalData("id")===e)}_on_click(e){let t=e.target;for(;t&&t!=this.dom;){let o=T(t);if(o.dom.tagName==="INPUT")return;if(o&&o.hasClass("x4item")){let r=o.getInternalData("id"),n={context:r};e.type=="click"?this.fire("click",n):this.fire("dblClick",n),n.defaultPrevented||this._selectItem(r,o,e.ctrlKey?"toggle":"single");return}t=t.parentElement}this.clearSelection(),e.stopImmediatePropagation(),e.preventDefault()}_on_ctx_menu(e){e.preventDefault();let t=e.target;for(;t&&t!=this.dom;){let o=T(t);if(o&&o.hasClass("x4item")){let r=o.getInternalData("id");this._selectItem(r,o,"single"),this.fire("contextMenu",{uievent:e,context:r});return}t=t.parentElement}this.fire("contextMenu",{uievent:e,context:null})}_selectItem(e,t,o){if(this.props.multisel||(o="single"),this._lastsel=e,o=="single"){if(this._multisel.has(e))return;this._clearSelection(),t&&(this._multisel.add(e),t.addClass("selected"))}else t&&(this._multisel.has(e)?(t.removeClass("selected"),this._multisel.delete(e)):(this._multisel.add(e),t.addClass("selected")));t&&t.scrollIntoView({behavior:"smooth",block:"nearest"}),this.fire("selectionChange",{selection:this.getSelection(),empty:this._multisel.size==0})}getItem(e){return this._items.find(t=>t.id===e)}select(e,t=!0){if($(e)||(e=[e]),!e.length){this._multisel.size&&(t?this.clearSelection():this._clearSelection());return}if(e.some(o=>!this._multisel.has(o))){this._clearSelection();let o=this._view.enumChildComponents(!1);e.forEach(r=>{let n=o.find(i=>i.getInternalData("id")===r);n&&(this._multisel.add(r),n.addClass("selected"))}),t&&this.fire("selectionChange",{selection:this.getSelection(),empty:this._multisel.size==0})}}_findItemIndex(e){return this._items.findIndex(t=>t.id==e)}_clearSelection(){let e=this._view.enumChildComponents(!1);this._multisel.size&&Array.from(this._multisel).forEach(o=>{let r=e.find(n=>n.getInternalData("id")===o);r&&r.removeClass("selected")}),this._multisel.clear()}clearSelection(){this._multisel.size&&(this._clearSelection(),this.fire("selectionChange",{selection:[],empty:!0}))}setItems(e,t=!1){let o=this.getSelection();this.clearSelection(),this._view.clearContent(),this._items=e!=null?e:[];let r=!1;if(this._items.length){let n=e.map(i=>this.renderItem(i));this._view.setContent(n),t?this.select(o):r=!0}else r=!0;r&&this.setTimeout("sel",100,()=>{this.fire("selectionChange",{selection:[],empty:!0})})}renderItem(e){var r;let o=((r=this.props.renderer)!=null?r:this.defaultRenderer)(e);return o.addClass("x4item"),o.setInternalData("id",e.id),o}defaultRenderer(e){return new b({cls:e.cls,content:new w({icon:e.iconId,text:e.text})})}filter(e){let t=this._view.enumChildComponents(!1);if(!e)t.forEach(o=>o.show(!0));else{let o;if(e instanceof RegExp){let r=e;o=new Set(this._items.filter(n=>r.test(n.text)).map(n=>n.id))}else{let r=e.toUpperCase();o=new Set(this._items.filter(n=>n.text.toUpperCase().includes(r)).map(n=>n.id))}t.forEach(r=>{r.show(o.has(r.getInternalData("id")))})}}appendItem(e,t=!1,o=!0){o&&this._clearSelection();let r=this.renderItem(e);t?(this._items.unshift(e),this._view.prependContent(r)):(this._items.push(e),this._view.appendContent(r)),o&&this._selectItem(e.id,r,"single")}updateItem(e,t){let o=this._findItemIndex(e);if(o<0)return;let r=!1;this._multisel.has(e)&&(r=!0),this._items[o]=t;let n=this._itemWithID(t.id);if(n!=null&&n.dom){let i=this.renderItem(t);r&&i.addClass("selected"),this._view.dom.replaceChild(i.dom,n.dom)}}getSelection(){return Array.from(this._multisel)}};s(me,"Listbox"),me=p([u("x4")],me);var Sr='data:image/svg+xml,<svg viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">%0D%0A%09<path d="M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z" fill="currentColor" fill-rule="evenodd" clip-rule="evenodd">%0D%0A%09</path>%0D%0A</svg>';var Ae=class extends B{_list;constructor(e,t){super(e),this._list=new me({items:e.items}),this.setContent(this._list),this.addDOMEvent("mousedown",o=>{console.log("trap"),o.stopImmediatePropagation(),o.stopPropagation(),o.preventDefault()},!0),this._list.on("selectionChange",o=>{this.fire("selectionChange",o)})}getList(){return this._list}};s(Ae,"DropdownList"),Ae=p([u("x4")],Ae);var Je=class extends d{_popup;_input;_button;_prevent_close=!1;_edit;constructor(e){super(e);let t=q();this.mapPropEvents(e,"selectionChange");let o=e.readonly!==!1;this.setContent([new b({id:"label",content:new w({tag:"label",text:e.label,labelFor:t,width:e.labelWidth})}),this._edit=new b({id:"edit",content:[this._input=new A({id:t,type:"text",value:"",readonly:o,required:e.required}),this._button=new I({icon:Sr,tabindex:-1})]})]),e.name&&this.setAttribute("name",e.name),e.required&&this.setAttribute("required",!0),this._popup=new Ae({items:e.items});let r=this._popup.getList(),n=s(i=>{let a=r.getItem(i);a&&r.select(i,!1),this._input.setValue(a?a.text:""),this._prevent_close||this._popup.show(!1)},"_select");this._popup.on("selectionChange",i=>{let[a]=i.selection;a!==void 0&&(n(a),this.fire("selectionChange",i))}),e.value&&n(e.value),this._button.addDOMEvent("click",()=>this._on_click()),this._input.addDOMEvent("input",()=>this._on_input()),this._input.addDOMEvent("keydown",i=>this._on_key(i)),this.setDOMEvents({focusout:s(()=>this._on_focusout(),"focusout"),click:s(()=>this._on_click(),"click")})}_on_key(e){switch(e.key){case"Enter":case"Escape":{this._popup.show(!1);break}case"ArrowUp":this._prevent_close=!0,this._popup.isOpen()?this._popup.getList().navigate(1):this.showDropDown(),this._prevent_close=!1;break;case"ArrowDown":this._prevent_close=!0,this._popup.isOpen()?this._popup.getList().navigate(4):this.showDropDown(),this._prevent_close=!1;break;default:return}e.preventDefault(),e.stopPropagation()}_on_input(){this._popup.isOpen()||this.showDropDown(),this._popup.getList().filter(this._input.getValue())}_on_focusout(){this._popup.show(!1)}_on_click(){this.showDropDown()}showDropDown(){if(this.isDisabled())return;let e=this._edit.getBoundingRect();this._popup.setStyleValue("minWidth",e.width+"px"),this._popup.displayNear(e,"top left","bottom left",{x:0,y:6})}setItems(e){this._getList().setItems(e)}getValue(){return this._input.getValue()}setValue(e){this._input.setValue(e)}selectItem(e){this._getList().select(e)}getSelection(){let[e]=this._getList().getSelection();return e}_getList(){return this._popup.getList()}queryInterface(e){return e=="form-element"?{getRawValue:s(()=>this.getSelection(),"getRawValue"),setRawValue:s(o=>{this.selectItem(o)},"setRawValue"),isValid:s(()=>this._input.isValid(),"isValid")}:super.queryInterface(e)}getInput(){return this._input}};s(Je,"Combobox"),Je=p([u("x4")],Je);var K=class extends C{validator;constructor(e){super({tag:"form",...e}),e.flex===!1&&this.addClass("no-flex"),e.autoComplete!==void 0&&this.setAutoComplete(e.autoComplete)}_get_inputs(){return this.queryAll("[name]")}setValues(e){this._get_inputs().forEach(o=>{let r=o.queryInterface("form-element");if(r){let n=o.getAttribute("name");Object.prototype.hasOwnProperty.call(e,n)&&r.setRawValue(e[n])}})}getValues(){let e={};return this._get_inputs().forEach(o=>{let r=o.queryInterface("form-element");if(r){let n=o.getAttribute("name");e[n]=r.getRawValue()}}),e}setAutoComplete(e=!0){this._get_inputs().forEach(o=>{o.setAttribute("autocomplete",e?"on":"off")})}setValidator(e){this.validator||(this.validator=e,this.addDOMEvent("focusout",()=>this.validate()))}validate(){let e=this._get_inputs(),t={},o=!0;for(let r of e){let n=r.queryInterface("form-element");if(n){let i=r.getAttribute("name");t[i]=n.getRawValue(),n.isValid()||(o=!1)}}if(this.validator){let r={...t};if(!this.validator(r,o))return null;for(let n in t)r[n]!=t[n]&&this.query(`input[${n}"]`).queryInterface("form-element").setRawValue(r[n]);t=r}else o||(t=null);return t}};s(K,"Form"),K=p([u("x4")],K);var Lr='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512" fill="currentColor"><!--!Font Awesome Pro 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2024 Fonticons, Inc.--><path d="M192 233.4L59.5 100.9 36.9 123.5 169.4 256 36.9 388.5l22.6 22.6L192 278.6 324.5 411.1l22.6-22.6L214.6 256 347.1 123.5l-22.6-22.6L192 233.4z"/></svg>';var ee=class extends B{form;_title;constructor(e){super({tag:"dialog",modal:!0,...e}),this._ismodal=this.props.modal,this.mapPropEvents(e,"btnclick"),this.appendContent([new b({cls:"caption",content:[this._title=new w({id:"title",cls:"caption-element",icon:e.icon,text:e.title}),e.closable?new I({id:"closebox",icon:Lr,tabindex:-1,click:s(()=>{D(e.closable)?this.fire("btnclick",{button:e.closable}):this.close()},"click")}):null]}),this.form=e.form?e.form:new K({}),new pe({id:"btnbar",reverse:!0,items:e.buttons,btnclick:s(t=>{this.fire("btnclick",t)},"btnclick")})]),this.addDOMEvent("keydown",t=>{if(t.key=="Escape")t.preventDefault(),t.stopPropagation();else if(t.key=="Enter"){let o=this.query("button.default");o&&(t.preventDefault(),t.stopPropagation(),o.click())}})}focusNext(e){let t=Rt(this.dom);if(t.length){let o=t[0],r=t[t.length-1],n=document.activeElement,i;if(!e&&n===o)i=r;else if(e&&n===r)i=o;else{let a=t.indexOf(n);e?i=t[a+1]:i=t[a-1]}return i?(i.focus(),!0):!1}else return!1}setContent(e){this.dom.replaceChild(this.form.dom,e.dom),this.form=e}getForm(){return this.form}getValues(){return this.form.getValues()}getButton(e){return this.getBtnBar().getButton(e)}queryInterface(e){return e=="tab-handler"?{focusNext:s(o=>this.focusNext(o),"focusNext")}:super.queryInterface(e)}setTitle(e){this._title.setText(e)}getBtnBar(){return this.query("#btnbar")}};s(ee,"Dialog"),ee=p([u("x4")],ee);var Rr='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--!Font Awesome Free 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M144 480C64.5 480 0 415.5 0 336c0-62.8 40.2-116.2 96.2-135.9c-.1-2.7-.2-5.4-.2-8.1c0-88.4 71.6-160 160-160c59.3 0 111 32.2 138.7 80.2C409.9 102 428.3 96 448 96c53 0 96 43 96 96c0 12.2-2.3 23.8-6.4 34.6C596 238.4 640 290.1 640 352c0 70.7-57.3 128-128 128l-368 0zm79-217c-9.4 9.4-9.4 24.6 0 33.9s24.6 9.4 33.9 0l39-39L296 392c0 13.3 10.7 24 24 24s24-10.7 24-24l0-134.1 39 39c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-80-80c-9.4-9.4-24.6-9.4-33.9 0l-80 80z"/></svg>';var jo=class jo extends d{constructor(e){var t;super({tag:"input",style:{display:"none"},attrs:{type:"file",multiple:(t=e.multiple)!=null?t:!1,accept:e.accept},dom_events:{change:s(()=>{let o=this.dom.files;e.callback(o)},"change")}})}showDialog(){this.dom.click()}};s(jo,"FileDialog");var kt=jo,et=class extends k{constructor(e){var o,r;super(e),this.mapPropEvents(e,"change");let t=new kt({accept:e.accept,multiple:e.multiple,callback:s(n=>{this.fire("change",{files:n})},"callback")});this.setContent([t,new E({iconId:(o=e.icon)!=null?o:Rr}),new V({text:(r=e.label)!=null?r:y.global.filedrop})]),this.setAttribute("tabIndex",0),this.addDOMEvent("click",()=>t.showDialog()),this.addDOMEvent("keydown",n=>{n.key==" "&&t.showDialog()}),qt.registerDropTarget(this,async(n,i,a)=>{if(n=="enter")this.addClass("hit");else if(n=="leave")this.removeClass("hit");else if(n=="drop"&&a.data.files&&a.data.files.length>0){let c=a.data.files;this.fire("change",{files:c})}})}};s(et,"FileDrop"),et=p([u("x4")],et);var fe=class extends d{_img;constructor(e){var t;if(super(e),this._img=new d({tag:"img",attrs:{loading:e.lazy,alt:e.alt,draggable:(t=e.draggable)!=null?t:!1},style:{width:"100%",height:"100%",objectFit:e.fit,objectPosition:e.position}}),this.setContent(this._img),this.setImage(e.src),e.candrop){this.mapPropEvents(e,"change","clear");let o=new kt({accept:e.accept,multiple:!1,callback:s(n=>{this.fire("change",{files:n})},"callback")});this.appendContent(o),this.addDOMEvent("click",()=>o.showDialog());let r=s((n,i)=>{var a;if((a=i.items)!=null&&a.length){let c=i.items[0].type;if(/image\/.*/.test(c))return!0}return!1},"filterInput");qt.registerDropTarget(this,async(n,i,a)=>{if(n=="enter")this.addClass("hit");else if(n=="leave")this.removeClass("hit");else if(n=="drop"&&a.data.files&&a.data.files.length>0){let c=a.data.files;this.fire("change",{files:c})}},r),this.addDOMEvent("contextmenu",n=>{new Y({items:[{text:y.global.cut,click:s(()=>{this.fire("clear",{})},"click")}]}).displayAt(n.pageX,n.pageY),n.stopPropagation(),n.preventDefault()})}}setImage(e){e?this._img.setAttribute("src",e):this.clear()}setBase64(e,t){this.setImage("data:"+e+";base64,"+t)}clear(){this._img.setAttribute("src","data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==")}};s(fe,"Image"),fe=p([u("x4")],fe);var Ct=200,tt=class extends d{_dataview;_datamodel;_columns;_lock;_dirty;_row_height;_left;_top;_body;_viewport;_fheader;_hheader;_vheader;_ffooter;_footer;_vis_rows;_start;_end;_selection;_num_fmt=new Intl.NumberFormat("fr-FR");_mny_fmt=new Intl.NumberFormat("fr-FR",{style:"currency",currency:"EUR"});_dte_fmt=new Intl.DateTimeFormat("fr-FR",{});_has_fixed;_has_footer;constructor(e){super(e),this._lock=0,this._dirty=0,this._row_height=32,this._left=0,this._top=0,this._vis_rows=new Map,this._selection=new Set,this._has_fixed=!1,this._has_footer=e.footer,this._columns=e.columns.map(t=>t),this.mapPropEvents(e,"click","dblClick","contextMenu","selectionChange"),this.lock(!0),this.setAttribute("tabindex",0),this.addDOMEvent("created",()=>{this._init(),this._dirty=1,this.lock(!1)}),this.addDOMEvent("resized",()=>{this._updateFlexs(),this._computeFullSize(),this._update(!0)}),this.addDOMEvent("keydown",t=>{this._on_key(t)}),e.store&&this.setStore(e.store)}_on_key(e){if(!this.isDisabled()){switch(e.key){case"ArrowDown":{this.navigate(4);break}case"ArrowUp":{this.navigate(1);break}case"Home":{this.navigate(0);break}case"End":{this.navigate(5);break}case"PageDown":{this.navigate(2);break}case"PageUp":{this.navigate(3);break}default:return}e.preventDefault(),e.stopPropagation()}}navigate(e){if(this._selection.size||(e==4||e==2?e=0:e=5),e==0||e==5){let t=e==0?0:this._dataview.getCount()-1;return this._clearSelection(),this._addSelection(t),this._scrollToIndex(t),!0}else if(e==1||e==4){let t=this._selection.values().next().value,o=e==4?t+1:t-1;if(o>=0&&o<this._dataview.getCount())return this._clearSelection(),this._addSelection(o),this._scrollToIndex(o),!0}else if(e==2||e==3){let t=this._vis_rows.size,o=this._selection.values().next().value,r=e==2?t:-t,n=o+r;if(n<0?n=0:n>=this._dataview.getCount()&&(n=this._dataview.getCount()-1),n!=o)return this._clearSelection(),this._addSelection(n),this._dataview.getCount()<Ct&&(r*=this._row_height),this._viewport.dom.scrollBy(0,r),!0}return!1}_scrollToIndex(e,t="nearest"){let o=this.queryAll(`.row[data-row="${e}"]`);if(o.length)o.forEach(r=>{r.scrollIntoView({block:t})});else{let r=e;this._dataview.getCount()<Ct&&(r*=this._row_height),this._viewport.dom.scrollTo(0,r)}}setStore(e){let t=s(o=>{this._viewport&&(o.change_type=="change"&&this._selection.clear(),this._updateFlexs(),this._computeFullSize(),this._update(!0))},"on_change");this._dataview&&this._dataview.off("view_change",t),e?(this._dataview=new vt({store:e}),this._datamodel=e.getModel(),this._dataview.on("view_change",t)):(this._dataview=null,this._datamodel=null)}getView(){return this._dataview}lock(e){e?this._lock++:--this._lock==0&&this._dirty&&this._update(!0)}_getColCount(){return this._columns.length}_getCol(e){return this._columns[e]}_buildColHeader(e){var n;let t=[],o=this._getColCount();for(let i=0;i<o;i++){let a=this._getCol(i);if(!!a.fixed!=e)continue;let c=new L("right");c.on("stop",()=>{this._updateFlexs()}),c.on("resize",m=>{a.width=m.size,a.flex=0,this.queryAll(`[data-col="${i}"]`).forEach(x=>{x.setStyleValue("width",m.size+"px")});let g=r.getBoundingRect();e?this.setStyleVariable("--fixed-width",g.width+"px"):this._body.setStyleValue("width",g.width+"px")});let h=new d({cls:"cell",attrs:{"data-col":i},style:{width:a.width?a.width+"px":void 0},content:[new V({text:a.title,align:(n=a.header_align)!=null?n:"left"}),new d({cls:"sorter"}),c]});h.addDOMEvent("touchend",()=>{let m=h.getInternalData("touchend"),f=Date.now(),g=m?f-m:0;g>30&&g<300?this._sortCol(i):h.setInternalData("touchend",f)}),h.addDOMEvent("dblclick",()=>{this._sortCol(i)}),t.push(h)}if(e&&t.length==0)return null;let r=new C({cls:"col-header",content:t});return r.setClass("fixed",e),r}_buildColFooter(e){let t=[],o=this._getColCount();for(let n=0;n<o;n++){let i=this._getCol(n);if(!!i.fixed!=e)continue;let a=new d({cls:"cell",attrs:{"data-col":n},style:{width:i.width?i.width+"px":void 0},content:[new V({text:i.footer_val})]});a.addDOMEvent("dblclick",()=>{this._sortCol(n)}),t.push(a)}if(e&&t.length==0)return null;let r=new C({cls:"col-footer",content:t});return r.setClass("fixed",e),r}_sortCol(e,t){this.setTimeout("sort",50,()=>{let o=!0,r=this.query(`.col-header .cell[data-col="${e}"]`);if(!r)return;t===void 0?r.hasClass("sorted")?r.hasClass("desc")?o=!0:o=!1:this.queryAll(".sorted").forEach(c=>c.removeClass("sorted asc desc")):o=t,r.setClass("sorted"),r.setClass("desc",!o);let n=this._getCol(e),i=!1;switch(n.type){case"checkbox":case"money":case"number":case"percent":i=!0}oo(!0),this._dataview.sort([{field:n.id,ascending:o,numeric:i}]),this._update(!0),oo(!1)})}sortCol(e,t){let o=this._columns.findIndex(r=>r.id===e);o>=0&&this._sortCol(o,t)}_renderCell(e,t,o){let r=t.id,n=t.type,i=this._datamodel.getRaw(r,e);if(i==null)return null;let a="";if(t.classifier&&o.push(t.classifier(i,e,r)),i instanceof Function)return i(e,r);if(t.formatter)return t.formatter(i);switch(n){case"checkbox":return i?new E({cls:"cell-check"+a,iconId:Zt}):void 0;case"image":return D(i)?new fe({cls:a,src:i,fit:"scale-down"}):void 0;case"number":{if(!z(i))return"NaN";i=this._num_fmt.format(i);break}case"money":{if(!z(i))return"NaN";i=this._mny_fmt.format(i);break}case"percent":return new C({cls:"percent"+a,content:new d({cls:"bar",width:i+"%"})});case"icon":return new E({cls:a,iconId:i+""});case"date":{i=this._dte_fmt.format(i);break}default:{i=i+"";break}}return new d({tag:"span",cls:a,content:i})}_buildRow(e,t,o){let r=[],n=this._getColCount();for(let a=0;a<n;a++){let c=this._getCol(a);if(c.fixed)continue;let h=[],m=this._renderCell(t,c,h),f="start";switch(c.align){default:f="start";break;case"center":f="center";break;case"right":f="end";break}let g=new d({cls:"cell",style:{width:c!=null&&c.width?c.width+"px":void 0,justifyContent:f},content:m});h.length&&g.addClass(h.join(" ")),c.type&&g.addClass(c.type),g.setData("col",a+""),g.setData("row",e+""),r.push(g)}let i=new C({cls:"row",style:{top:o.toFixed(2)+"px"},content:r});return i.setData("row",e+""),this._selection.has(e)&&i.addClass("selected"),i}_buildRowHeader(e,t,o){let r=[],n=this._getColCount();for(let a=0;a<n;a++){let c=this._getCol(a);if(!(c!=null&&c.fixed))continue;let h=this._renderCell(t,c.id,[c.type]),m="start";switch(c.align){default:m="start";break;case"center":m="center";break;case"right":m="end";break}let f=new d({cls:"cell",style:{width:c!=null&&c.width?c.width+"px":void 0,justifyContent:m},content:h});c.type&&f.addClass(c.type),f.setData("col",a+""),f.setData("row",e+""),r.push(f)}let i=new C({cls:"row",style:{top:o+"px"},content:r});return i.setData("row",e+""),this._selection.has(e)&&i.addClass("selected"),i}_updateFlexs(){let e=0,t=0,o=this._getColCount();for(let r=0;r<o;r++){let n=this._getCol(r);!n.fixed&&n.flex?t+=n.flex:e+=n.width}if(t){let i=(this._viewport.dom.clientWidth-e)/t;for(let a=0;a<o;a++){let c=this._getCol(a);!c.fixed&&c.flex&&(c.width=Math.max(c.flex*i,32),this.queryAll(`[data-col="${a}"]`).forEach(m=>{m.setStyleValue("width",c.width+"px")}))}}}_computeFullSize(){let e=0,t=0,o=this._getColCount();for(let i=0;i<o;i++){let a=this._getCol(i),c=0;a.fixed&&(this._has_fixed=!0),a.width&&(c+=a.width),a.fixed?t+=c:e+=c}let r=this._dataview?this._dataview.getCount():0,n=r;if(r<Ct)n*=this._row_height;else{let a=this._body.dom.parentElement.clientHeight/this._row_height;n=r-Math.floor(a)+a*this._row_height}this.setStyleVariable("--fixed-width",t+"px"),this._body.setStyleValue("height",n+"px"),this._body.setStyleValue("width",e+"px"),this._vheader.setStyleValue("height",n+"px")}_init(){this._body=new d({cls:"body"}),this._viewport=new ae({content:this._body}),this._has_footer||this.setStyleVariable("--footer-height","0"),this._viewport.addDOMEvent("scroll",t=>{this._left=this._viewport.dom.scrollLeft,this.setStyleVariable("--left",-this._left+"px"),this._top=this._viewport.dom.scrollTop,this.setStyleVariable("--top",-this._top+"px"),this._update()}),this.addDOMEvent("wheel",t=>{if(t.deltaY&&this._dataview&&this._dataview.getCount()>=Ct&&(this._viewport.dom.scrollBy(0,t.deltaY<0?-1:1),t.stopPropagation(),t.preventDefault()),this._has_fixed&&t.deltaY){let o=t.target;for(;o!=this.dom;){if(o==this._vheader.dom){this._viewport.dom.scrollBy(0,t.deltaY<0?-this._row_height:this._row_height),t.stopPropagation(),t.preventDefault();break}o=o.parentNode}}});let e=s(t=>{let o=d.parentElement(t.target,d);for(;o&&!o.hasClass("row");)o=o.parentElement();if(o)return o.getIntData("row")},"targetRow");this.addDOMEvent("click",t=>{let o=e(t);o!==void 0&&(this._selection.has(o)||(this._clearSelection(),this._addSelection(o)))}),this.addDOMEvent("dblclick",t=>{let o=e(t);if(o!==void 0){this._selection.has(o)||(this._clearSelection(),this._addSelection(o)),this._on_dblclk(t,o);let r=this._dataview.getByIndex(o);this.fire("dblClick",{context:r})}}),this.addDOMEvent("contextmenu",t=>{let o=e(t);if(o!==void 0){this._selection.has(o)||(this._clearSelection(),this._addSelection(o));let r=this._dataview.getByIndex(o);this.fire("contextMenu",{uievent:t,context:r})}t.preventDefault(),t.stopPropagation()}),this.addDOMEvent("mouseover",t=>{if(!this._has_fixed)return;let o=d.parentElement(t.target,d);for(;o&&!o.hasClass("row");)o=o.parentElement();if(o){let r=o.getData("row");this.queryAll(".hover").forEach(n=>n.removeClass("hover")),r&&this.queryAll(`.row[data-row="${r}"]`).forEach(i=>i.addClass("hover"))}}),this.addDOMEvent("mouseleave",t=>{this._has_fixed&&this.queryAll(".hover").forEach(o=>o.removeClass("hover"))}),this._updateFlexs(),this._fheader=this._buildColHeader(!0),this._hheader=this._buildColHeader(!1),this._vheader=new C({cls:"row-header"}),this._has_footer&&(this._ffooter=this._buildColFooter(!0),this._footer=this._buildColFooter(!1)),this.setContent([this._viewport,this._fheader,this._hheader,this._ffooter,this._footer,this._vheader]);{let t=this.getStyleVariable("--row-height");this._row_height=parseInt(t)}this._computeFullSize()}_on_dblclk(e,t){}_update(e=!1){if(!this._lock){let t=this.getBoundingRect(),o=this._dataview?this._dataview.getCount():0,r=o<Ct?this._row_height:1,n=Math.floor(this._top/r),i=n+Math.ceil(t.height/this._row_height),a=this._has_fixed;if(this._start!=n||this._end!=i||e){let c=[],h=[];e&&this._vis_rows.clear();let m=new Map,f=n*r;for(let g=n;g<i&&g<o;g++,f+=this._row_height){let x=this._vis_rows.get(g),_=this._dataview.getByIndex(g);a?(x?(x.h.setStyleValue("top",f+"px"),x.r.setStyleValue("top",f+"px")):x={h:this._buildRowHeader(g,_,f),r:this._buildRow(g,_,f)},h.push(x.h)):x?x.r.setStyleValue("top",f+"px"):x={h:null,r:this._buildRow(g,_,f)},c.push(x.r),m.set(g,x)}a&&h.push(new d({cls:"cell-out",style:{top:f+"px"}})),this._vis_rows=m,this._start=n,this._end=i,this._body.setContent(c),a?(this._vheader.removeClass("@hidden"),this._vheader.setContent(h)):this._vheader.addClass("@hidden")}}}_clearSelection(){for(let e of this._selection.keys())this.queryAll(`.row[data-row="${e}"]`).forEach(o=>{o.removeClass("selected")});this._selection.clear()}_addSelection(e){this._selection.add(e),this.queryAll(`.row[data-row="${e}"]`).forEach(r=>{r.addClass("selected")});let o=this._dataview.getByIndex(e);this.fire("selectionChange",{selection:[o],empty:!1})}getSelection(){return this._selection.size==0?null:[...this._selection.values()].map(t=>this._dataview.getByIndex(t))}getFirstSel(){if(this._selection.size==0)return null;let e=this._selection.values().next().value;return this._dataview.getByIndex(e)}selectItem(e){let t=this._dataview.indexOfId(e);t>=0&&this._addSelection(t)}};s(tt,"Gridview"),tt=p([u("x4")],tt);var ot=class extends b{_els;_vwp;constructor(e){var t;super(e),this._els=(t=e.items)==null?void 0:t.map(o=>{let r=new w({cls:"cell",text:o.title,icon:o.iconId}),n=new L("right");return o.width>0?(r.setStyleValue("width",o.width+"px"),r.setInternalData("width",o.width)):o.width<0?r.setInternalData("flex",-o.width):r.setInternalData("width",0),n.addDOMEvent("dblclick",i=>{r.setInternalData("flex",1),this._calc_sizes()}),n.on("resize",i=>{r.setInternalData("flex",0),r.setInternalData("width",i.size),this._calc_sizes()}),r.appendContent(n),r.setInternalData("data",o),r}),this.addDOMEvent("resized",()=>this._on_resize()),this.addDOMEvent("created",()=>this._calc_sizes()),this._vwp=new b({content:this._els}),this.setContent(this._vwp)}_calc_sizes(){let e=0,t=0;this._els.forEach(a=>{let c=a.getInternalData("flex");if(c)e+=c;else{let h=a.getInternalData("width");if(h==0){let m=a.getBoundingRect();h=Math.ceil(m.width)+2,a.setInternalData("width",h)}t+=h}});let r=this.getBoundingRect().width-t-10,n=Math.ceil(r/e),i=0;this._els.forEach(a=>{var f;let c=0,h=a.getInternalData("flex");h?(c=Math.min(n*h,r),r-=c):c=a.getInternalData("width"),a.setWidth(c);let m=a.getInternalData("data");(f=this.props.target)==null||f.setStyleVariable(`--${m.name}-width`,c+"px"),i+=c}),this._vwp.setWidth(i)}_on_resize(){this._calc_sizes()}};s(ot,"Header"),ot=p([u("x4")],ot);var Fr='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512" fill="currentColor"><!--!Font Awesome Free 6.7.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M576 128c0-35.3-28.7-64-64-64L205.3 64c-17 0-33.3 6.7-45.3 18.7L9.4 233.4c-6 6-9.4 14.1-9.4 22.6s3.4 16.6 9.4 22.6L160 429.3c12 12 28.3 18.7 45.3 18.7L512 448c35.3 0 64-28.7 64-64l0-256zM271 175c9.4-9.4 24.6-9.4 33.9 0l47 47 47-47c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-47 47 47 47c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-47-47-47 47c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l47-47-47-47c-9.4-9.4-9.4-24.6 0-33.9z"/></svg>';var Br='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512" fill="currentColor"><!--!Font Awesome Free 6.7.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M214.6 41.4c-12.5-12.5-32.8-12.5-45.3 0l-160 160c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L160 141.2 160 448c0 17.7 14.3 32 32 32s32-14.3 32-32l0-306.7L329.4 246.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3l-160-160z"/></svg>';var Or='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512" fill="currentColor"><!--!Font Awesome Free 6.7.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M38.8 5.1C28.4-3.1 13.3-1.2 5.1 9.2S-1.2 34.7 9.2 42.9l592 464c10.4 8.2 25.5 6.3 33.7-4.1s6.3-25.5-4.1-33.7L525.6 386.7c39.6-40.6 66.4-86.1 79.9-118.4c3.3-7.9 3.3-16.7 0-24.6c-14.9-35.7-46.2-87.7-93-131.1C465.5 68.8 400.8 32 320 32c-68.2 0-125 26.3-169.3 60.8L38.8 5.1zm151 118.3C226 97.7 269.5 80 320 80c65.2 0 118.8 29.6 159.9 67.7C518.4 183.5 545 226 558.6 256c-12.6 28-36.6 66.8-70.9 100.9l-53.8-42.2c9.1-17.6 14.2-37.5 14.2-58.7c0-70.7-57.3-128-128-128c-32.2 0-61.7 11.9-84.2 31.5l-46.1-36.1zM394.9 284.2l-81.5-63.9c4.2-8.5 6.6-18.2 6.6-28.3c0-5.5-.7-10.9-2-16c.7 0 1.3 0 2 0c44.2 0 80 35.8 80 80c0 9.9-1.8 19.4-5.1 28.2zm9.4 130.3C378.8 425.4 350.7 432 320 432c-65.2 0-118.8-29.6-159.9-67.7C121.6 328.5 95 286 81.4 256c8.3-18.4 21.5-41.5 39.4-64.8L83.1 161.5C60.3 191.2 44 220.8 34.5 243.7c-3.3 7.9-3.3 16.7 0 24.6c14.9 35.7 46.2 87.7 93 131.1C174.5 443.2 239.2 480 320 480c47.8 0 89.9-12.9 126.2-32.5l-41.9-33zM192 256c0 70.7 57.3 128 128 128c13.3 0 26.1-2 38.2-5.8L302 334c-23.5-5.4-43.1-21.2-53.7-42.3l-56.1-44.2c-.2 2.8-.3 5.6-.3 8.5z"/></svg>';var Hn={"fr-FR":{lines:{lower:["1 2 3 4 5 6 7 8 9 0","a z e r t y u i o p {2}","q s d f g h j k l m {3}","{4} w x c v b n , . {4}","{5} {6} ' {7}"],upper:["! @ # $ % ^ & * ( ) _ +","A Z E R T Y U I O P {2}","Q S D F G H J K L M {3}","{4} W X C V B N ? : {4}","{5} {6} ' {7}"],number:["1 2 3 {2}","4 5 6 {8}","7 8 9 {9}","0 . {3} {9}"],date:["1 2 3 {2}","4 5 6 {8}","7 8 9 {9}","0 / {3} {9}"]}},"en-GB":{lines:{lower:["1 2 3 4 5 6 7 8 9 0","a z e r t y u i o p {2}","q s d f g h j k l m {3}","{4} w x c v b n , . {4}","{5} {6} ' {7}"],upper:["! @ # $ % ^ & * ( ) _ +","A Z E R T Y U I O P {2}","Q S D F G H J K L M {3}","{4} W X C V B N ? : {4}","{5} {6} ' {7}"],number:["1 2 3 {2}","4 5 6 {8}","7 8 9 {9}","0 . {3} {9}"],date:["1 2 3 {2}","4 5 6 {8}","7 8 9 {9}","0 / {3} {9}"]}},"en-US":"en-GB"},zr=/text|password|search|tel|url/i,rt=class extends b{mode;locale;keyboard;visible;input;constructor(e){super({...e,id:"v-keyboard"}),this.mode="lower",this.locale="fr-FR",this.visible=!1,document.addEventListener("focusin",t=>this.handleFocus(t.target,!0),!1),document.addEventListener("focusout",t=>this.handleFocus(t.target,!1),!1),this.hide(),this.addDOMEvent("mousedown",t=>{this.handleKey(t),t.preventDefault(),t.stopPropagation()}),this.addDOMEvent("dblclick",t=>{this.handleKey(t),t.preventDefault(),t.stopPropagation()}),this.addDOMEvent("contextmenu",t=>{t.preventDefault(),t.stopPropagation()})}handleKey(e){let t=e.target,o;for(;t!==this.dom;){if(t.hasAttribute("data-key")){o=parseInt(t.getAttribute("data-key"),10);break}t=t.parentNode}if(o)switch(o){case 2:{this.fireKey(0,this._backspace);break}case 3:{this._focusNext();break}case 4:{this.mode=="lower"?this.mode="upper":this.mode="lower",this._redraw();break}case 5:{this._switchMode("number");break}case 6:{this.fireKey(32,this._insertChar);break}case 7:{this.hide();break}case 8:{this._switchMode("lower");break}default:{this.fireKey(o,this._insertChar);break}}}_focusNext(){Ve.instance().focusNext(!0)}_switchMode(e){this.mode=e,this._redraw()}_redraw(){this.setContent([new ne,this.keyboard=new k({id:"kb",cls:this.mode,content:this._createContent()}),new ne])}_scrollIntoView(e){let t=e.parentElement;for(;t!=document.body;){if(t.style.overflowY!==""){let o=e.getBoundingClientRect(),r=t.getBoundingClientRect();o.top<r.top?e.scrollIntoView(!0):o.bottom>r.bottom&&e.scrollIntoView(!1);break}t=t.parentElement}}_updateVis=s(()=>{if(this.visible){if(this.input){let e=this.input.type;if(e=="check"||e=="radio")this.hide(),this.input=null;else{this.show(),this._scrollIntoView(this.input);let t=this.input.getAttribute("data-type");e==="number"||t==="number"?this._switchMode("number"):e==="date"||t==="date"?this._switchMode("date"):this._switchMode("lower")}}}else this.hide(),this.input=null},"_updateVis");showOn(e){this.handleFocus(e.dom,!0)}handleFocus(e,t){if(t&&e.tagName=="INPUT"&&!e.readOnly){this.input=e,this.visible=!0,this.setTimeout("vis",200,this._updateVis);return}this.visible=!1,this.setTimeout("vis",200,this._updateVis)}_insertChar(e,t,o){return t=t.substring(0,e.start)+o.toString()+t.substring(e.end),e.start+=o.length,e.end=e.start,t}_backspace(e,t){return t=t.substring(0,e.start-1)+t.substring(e.start),e.start-=1,e.end=e.start,t}_getCaret(){if(this.input&&zr.test(this.input.type)){let e={start:this.input.selectionStart||0,end:this.input.selectionEnd||0};return e.end<e.start&&(e.end=e.start),e}else{let e=this.input.value.length;return{start:e,end:e}}}_restoreCaretPos(e){zr.test(this.input.type)&&(this.input.selectionStart=e.start,this.input.selectionEnd=e.end)}fireKey(e,t){let o=this._getCaret(),r=this.input.value;r=t.call(this,o,r,String.fromCharCode(e)),this.input.value=r,this._restoreCaretPos(o)}_createContent(){let e=Hn[this.locale].lines[this.mode],t=[];for(let o=0;o<e.length;o++){let r=e[o].split(" "),n=[];for(let i=0;i<r.length;i++){let a="tch c"+i,c=r[i],h,m=null;if(c.length>2&&c[0]=="{"&&c[c.length-1]=="}"){let g=parseInt(c.substring(1,c.length-1),10);switch(g){default:case 0:{c="",a+=" x4hidden";break}case 1:{c="";break}case 2:{c=void 0,m=Fr,a+=" cdel";break}case 3:{c=y.global.keyboard.next,a+=" cret";break}case 4:{c=void 0,m=Br,a+=" cshift";break}case 5:{c=y.global.keyboard.numeric,a+=" cnum";break}case 6:{c=" ",a+=" cspace";break}case 7:{c=void 0,m=Or,a+=" chide";break}case 8:{c=y.global.keyboard.alpha,a+=" calpha";break}case 9:{c="",a+=" cplace";break}}h=g}else h=r[i].charCodeAt(0);let f=new I({cls:a,label:c,attrs:{"data-key":h},icon:m});n.push(f)}t.push(new b({cls:"line",content:n}))}return t}};s(rt,"Keyboard"),rt=p([u("x4")],rt);var nt=class extends d{constructor(e){super({tag:"a",...e}),this.setAttribute("href",e.href),this.mapPropEvents(e,"click"),this.setContent(new w({text:e.text,icon:e.icon})),this.addDOMEvent("click",t=>this._on_click(t))}setText(e){this.setContent(e)}_on_click(e){let t={context:this.props.href};this.fire("click",t),t.preventDefault&&(e.preventDefault(),e.stopPropagation())}};s(nt,"Link"),nt=p([u("x4")],nt);var Vr='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="currentColor"><!--!Font Awesome Free 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zm0-384c13.3 0 24 10.7 24 24l0 112c0 13.3-10.7 24-24 24s-24-10.7-24-24l0-112c0-13.3 10.7-24 24-24zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z"/></svg>';var Yo='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--!Font Awesome Pro 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2024 Fonticons, Inc.--><path class="fa-secondary" opacity=".4" d="M0 128l32 0 224 0 32 0 0 64-32 0L64 192l0 256 448 0 0-128 0-32 64 0 0 32 0 160 0 32-32 0L32 512 0 512l0-32L0 160l0-32z"/><path class="fa-primary" d="M288 352l16-112L468.7 75.3l96 96L400 336 288 352zM587.3 148.7l-96-96L544 0l96 96-52.7 52.7zM96 288l64 0 0 64-64 0 0-64zm160 0l0 64-64 0 0-64 64 0z"/></svg>';var Me=class extends ee{constructor(e){super(e)}static _create(e,t,o){return new Me({modal:!0,title:o!=null?o:y.global.error,movable:!0,form:new K({content:[new b({content:[new E({iconId:Vr}),new w({text:e})]})]}),buttons:t!=null?t:["ok.outline","cancel.outline"]})}static show(e,t,o){let r=this._create(e,t,o);return r.on("btnclick",n=>{Z(()=>{r.close()})}),r.show(),r}static async showAsync(e,t,o){return new Promise((r,n)=>{let i=this._create(e,t,o);i.on("btnclick",a=>{Z(()=>{r(a.button),i.close()})}),i.show()})}};s(Me,"MessageBox"),Me=p([u("x4")],Me);var De=class extends ee{constructor(e){super(e)}getValue(){return this.query("input").getValue()}static _create(e,t,o){return new De({modal:!0,title:o,movable:!0,form:new K({content:[new b({content:[new E({iconId:Yo}),new k({flex:1,content:[new w({text:e}),new A({value:t,type:"text"})]})]})]}),buttons:["ok.outline.default","cancel.outline"]})}static async showAsync(e,t,o){return new Promise((r,n)=>{let i=this._create(e,t,o);i.on("btnclick",a=>{Z(()=>{r(a.button=="ok"?i.getValue():null),i.close()})}),i.show()})}};s(De,"InputBox"),De=p([u("x4")],De);var Pe=class extends ee{constructor(e){super(e)}static _create(e,t,o){return new Pe({modal:!0,title:o,movable:!0,form:new K({content:[new b({content:[new E({iconId:Yo}),new k({flex:1,cls:"right",content:[new w({text:e}),t]})]})]}),buttons:["ok.outline.default","cancel.outline"]})}static async showAsync(e,t,o){return new Promise(r=>{let n=this._create(e,t,o);n.on("btnclick",i=>{Z(()=>{r(i.button),n.close()})}),n.show()})}static show(e,t,o,r){let n=this._create(e,t,o);n.on("btnclick",i=>{Z(async()=>{await r(i.button)!==!1&&n.close()})}),n.show()}};s(Pe,"PromptBox"),Pe=p([u("x4")],Pe);var Hr='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="currentColor"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"/></svg>';var Nr='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="currentColor"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zm0-384c13.3 0 24 10.7 24 24V264c0 13.3-10.7 24-24 24s-24-10.7-24-24V152c0-13.3 10.7-24 24-24zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z"/></svg>';var Ur='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="currentColor"><!--!Font Awesome Pro 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2024 Fonticons, Inc.--><path d="M207.4 20.4c2.4 8.5-2.6 17.3-11.2 19.7C101.5 66.2 32 153 32 256c0 123.7 100.3 224 224 224s224-100.3 224-224c0-103-69.5-189.8-164.3-215.9c-8.5-2.4-13.5-11.2-11.2-19.7s11.2-13.5 19.7-11.2C432.5 39.1 512 138.2 512 256c0 141.4-114.6 256-256 256S0 397.4 0 256C0 138.2 79.5 39.1 187.7 9.2c8.5-2.4 17.3 2.6 19.7 11.2z"/></svg>';var qr='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512" fill="currentColor"><!--!Font Awesome Pro 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2024 Fonticons, Inc.--><path d="M192 233.4L59.5 100.9 36.9 123.5 169.4 256 36.9 388.5l22.6 22.6L192 278.6 324.5 411.1l22.6-22.6L214.6 256 347.1 123.5l-22.6-22.6L192 233.4z"/></svg>';var it=class extends B{constructor(e){super({});let t=e.iconId;t||(e.loading?(t=Ur,this.addClass("")):e.mode=="danger"?t=Nr:t=Hr),this.addClass(e.mode);let o=new E({iconId:t});e.loading&&o.addClass("rotate"),this.setContent(new b({content:[o,new k({cls:"body",content:[e.title?new w({cls:"title",text:e.title}):null,new w({cls:"text",text:e.text})]}),e.closable?new I({cls:"outline",icon:qr,click:s(()=>{this.close()},"click")}):null]}))}close(){this.clearTimeout("close"),super.close()}display(e=0){let t=new Be(0,0,window.innerWidth,window.innerHeight);this.displayNear(t,"bottom right","bottom right",{x:-20,y:-10}),e&&this.setTimeout("close",e*1e3,()=>{this.close()})}};s(it,"Notification"),it=p([u("x4")],it);var st=class extends k{_title;_body;constructor(e){var o;super({...e,content:void 0});let t=(o=e.bodyModel)!=null?o:k;super.setContent([this._title=new w({tag:"legend",text:e.title,icon:e.icon}),this._body=new t({cls:"body",content:e.content})])}setContent(e){this._body.setContent(e)}setTitle(e){this._title.setContent(e)}};s(st,"Panel"),st=p([u("x4")],st);var at=class extends d{_bar;constructor(e){super(e),this.setContent(this._bar=new d({cls:"bar"})),this.setValue(e.value)}setValue(e){let t=e/(this.props.max-this.props.min)*100;this._bar.setStyleValue("width",t+"%")}};s(at,"Progress"),at=p([u("x4")],at);var ge=class extends d{constructor(e){super({tag:"select",...e}),this.mapPropEvents(e,"focus","change"),e.name&&this.setAttribute("name",e.name),this.setItems(e.items),this.addDOMEvent("blur",t=>{this.on_focus(t,!0)}),this.addDOMEvent("focus",t=>{this.on_focus(t,!1)}),this.addDOMEvent("input",t=>{this.on_change(t)}),e.multiple&&this.setAttribute("multiple",!0),e.value&&this.setValue(e.value)}on_focus(e,t){let o={focus_out:t};this.fire("focus",o),o.defaultPrevented&&e.preventDefault()}on_change(e){let t={value:this.getValue()};this.fire("change",t),t.defaultPrevented&&e.preventDefault()}setItems(e){this.setContent(e.map(t=>new d({tag:"option",attrs:{value:t.id},content:t.text})))}getValue(){return this.dom.value}setValue(e){this.dom.value=e+""}};s(ge,"Select"),ge=p([u("x4")],ge);var Kr='data:image/svg+xml,<svg viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">%0D%0A%09<path class="fa-primary" d="M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z" fill="currentColor" fill-rule="evenodd" clip-rule="evenodd">%0D%0A%09</path>%0D%0A</svg>';var lt=class extends k{root;groups;constructor(e){super(e),this.root=new d({cls:"root"}),this.setContent(this.root),e.groups&&this.setItems(e.groups)}setItems(e){this.groups=e.filter(o=>!!o);let t=[];for(let o of this.groups)t.push(this.makeGroupHeader(o)),o.items.forEach(r=>{r&&t.push(this.makePropertyRow(r))});this.root.setContent(t)}makeGroupHeader(e){let t=s(r=>{let n;r.hasClass("collapsed")?(r.removeClass("collapsed"),n=!0):(r.addClass("collapsed"),n=!1);let i=r.nextElement();for(;i&&i.hasClass("row");)i.show(n),i=i.nextElement()},"toggle"),o=new b({cls:"group",content:[e.icon?new E({id:"icon",iconId:e.icon}):null,new k({content:[new V({cls:"title",text:e.title}),e.desc?new V({cls:"desc",text:e.desc}):null]}),e.collapsible?new I({icon:Kr,click:s(r=>t(o),"click")}):null]});return o.setClass("collapsible",e.collapsible),o}makePropertyRow(e){var n;let t=!0,o,r=pr(e.value)?e.value(e.name):e.value;return e.value=r,e.type==="boolean"?o=new A({type:"checkbox",id:e.name,name:e.name,checked:r,dom_events:{change:s(i=>{var a;(a=e.callback)==null||a.call(e,e.name,o.dom.checked)},"change")}}):e.type==="options"?o=new ge({value:r,id:e.name,items:e.options,name:e.name,change:s(i=>{var a;(a=e.callback)==null||a.call(e,e.name,i.value)},"change")}):e.type==="password"?o=new A({type:"password",id:e.name,name:e.name,value:r,focus:s(i=>{var a;i.focus_out&&((a=e.callback)==null||a.call(e,e.name,o.getValue()))},"focus")}):e.type==="number"?o=new A({type:"number",id:e.name,name:e.name,value:r,step:e.step,focus:s(i=>{var a;i.focus_out&&((a=e.callback)==null||a.call(e,e.name,o.getNumValue()))},"focus"),change:s(()=>{var i;e.live&&((i=e.callback)==null||i.call(e,e.name,o.getNumValue()))},"change")}):e.type==="label"?o=new w({id:e.name,text:r}):e.type==="button"?(t=!1,o=new I({id:e.name,label:r,click:s(()=>{var i;(i=e.callback)==null||i.call(e,e.name,"")},"click")})):o=new A({type:"text",id:e.name,name:e.name,value:r,focus:s(i=>{var a;i.focus_out&&((a=e.callback)==null||a.call(e,e.name,o.getValue()))},"focus")}),new b({cls:"row",content:[t?new d({cls:"cell hdr",content:(n=e.title)!=null?n:e.name,tooltip:e.desc}):null,new d({cls:"cell",tag:"label",attrs:{labelFor:e.name},content:o})]})}setPropValue(e,t){let r=this.groups.flatMap(n=>[...n.items]).find(n=>n.name==e);if(r)if(r.type==="boolean"){let n=this.root.query("#"+r.name);n&&n.setCheck(t)}else if(r.type==="options"){let n=this.root.query("#"+r.name);n&&n.setValue(t)}else if(r.type==="number"){let n=this.root.query("#"+r.name);n&&n.setNumValue(t,-2)}else{let n=this.root.query("#"+r.name);n&&n.setValue(t)}}};s(lt,"PropertyGrid"),lt=p([u("x4")],lt);var Gr='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 5 5" aria-hidden="true">%0D%0A%09<circle class="fa-primary" cx="2.5" cy="2.5" r="2.5" ></circle>%0D%0A%09<circle class="fa-secondary" cx="2.5" cy="2.5" r="1.25"></circle>%0D%0A</svg>';var ct=class extends d{_check;_input;_label;constructor(e){super(e),this.mapPropEvents(e,"change");let t=q();this.setContent([this._check=new b({cls:"inner",content:[this._input=new A({type:"radio",id:t,name:e.name,value:e.value,checked:e.checked,dom_events:{change:s(()=>this._on_change(),"change")}})]}),this._label=new w({tag:"label",text:e.label,id:void 0,labelFor:t,icon:e.icon})]),yt.load(Gr).then(o=>{this._check.dom.insertAdjacentHTML("beforeend",o)}),this.addDOMEvent("click",o=>this._on_click(o))}_on_click(e){e.target==this.dom&&(this._input.dom.click(),e.preventDefault(),e.stopPropagation())}_on_change(){this.fire("change",{value:this.getValue()})}setCheck(e){let t=this._input.dom;t.checked=e}setLabel(e){this._label.setText(e)}getValue(){return this._input.getValue()}};s(ct,"Radio"),ct=p([u("x4")],ct);var Wr='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512" fill="currentColor"><!--!Font Awesome Pro 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2024 Fonticons, Inc.--><path d="M288.1 0l86.5 164 182.7 31.6L428 328.5 454.4 512 288.1 430.2 121.7 512l26.4-183.5L18.9 195.6 201.5 164 288.1 0z"/></svg>';var dt=class extends b{m_els;m_input;constructor(e){var t;super(e),e.steps=(t=e.steps)!=null?t:5,this._update()}_update(){var r,n;let e=this.props,t=(r=e.icon)!=null?r:Wr,o=(n=e.value)!=null?n:0;this.m_input=new A({type:"text",hidden:!0,name:e.name,value:""+o}),this.addDOMEvent("click",i=>this._on_click(i)),this.m_els=[];for(let i=0;i<e.steps;i++){let a="item";i+1<=o&&(a+=" checked");let c=new E({cls:a,iconId:t});c.setInternalData("value",i),this.m_els.push(c)}this.m_els.push(this.m_input),this.setContent(this.m_els)}getValue(){var e;return(e=this.props.value)!=null?e:0}setValue(e){this.props.value=e;for(let t=0;t<this.props.steps;t++)this.m_els[t].setClass("checked",this.m_els[t].getInternalData("value")<=e);this.m_input.setValue(""+this.props.value)}setSteps(e){this.props.steps=e,this._update()}setShape(e){this.removeClass(this.props.icon),this.props.icon=e}_on_click(e){let t=T(e.target);t=t.parentElement(E),t&&this.setValue(t.getInternalData("value")),this.fire("change",{value:this.props.value})}};s(dt,"Rating"),dt=p([u("x4")],dt);var ht=class extends d{_mdown=!1;_irect=null;_thumb=null;_bar=null;_range=null;constructor(e){super(e),this.mapPropEvents(e,"change"),e.vertical&&this.addClass("vertical"),this.setContent([new b({cls:"track",content:[this._bar=new d({cls:"bar"}),this._thumb=new d({cls:"thumb"})]}),this._range=new A({type:"range",hidden:!0,value:e.value,min:e.min,max:e.max,step:e.step})]),this.setAttribute("tabindex",0),this.setDOMEvents({pointerdown:s(t=>this._on_mousedown(t),"pointerdown"),pointermove:s(t=>this._on_mousemove(t),"pointermove"),pointerup:s(t=>this._on_mouseup(t),"pointerup"),keydown:s(t=>this._on_key(t),"keydown")}),this._update()}_on_mousedown(e){e.stopPropagation(),e.preventDefault(),this.focus(),this._mdown=!0,this._irect=this.getBoundingRect(),this.setCapture(e.pointerId)}_getMinMax(){let e=parseInt(this._range.getAttribute("min")),t=parseInt(this._range.getAttribute("max"));return[e,t]}_on_mousemove(e){if(this._mdown){let t,o;this.props.vertical?(t=e.offsetY,o=this._irect.height):(t=e.offsetX,o=this._irect.width);let r=t/o;this.props.vertical&&(r=1-r);let[n,i]=this._getMinMax();this._range.setNumValue(n+r*(i-n)),this._update()}}_update(){let e=this._range.getNumValue(),[t,o]=this._getMinMax(),r=o>t?e/Math.abs(o-t)*100:0;this.props.vertical?(r=100-r,this._thumb.setStyleValue("top",r+"%"),this._bar.setStyleValue("height",r+"%")):(this._thumb.setStyleValue("left",r+"%"),this._bar.setStyleValue("width",r+"%")),this.fire("change",{value:e})}_on_mouseup(e){this._mdown&&(this.releaseCapture(e.pointerId),this._mdown=!1)}_on_key(e){var r;console.log(e.key);let t=(r=this.props.step)!=null?r:1,o=0;switch(e.key){case"ArrowRight":case"ArrowUp":o=t;break;case"ArrowLeft":case"ArrowDown":o=-t;break}o&&(e.ctrlKey&&(o*=10),this._range.setNumValue(this._range.getNumValue()+o),this._update())}setMin(e){this._range.setAttribute("min",e+""),this._update()}setMax(e){this._range.setAttribute("max",e+""),this._update()}setValue(e){this._range.setNumValue(e),this._update()}};s(ht,"Slider"),ht=p([u("x4")],ht);var pt=class extends b{constructor(e){super(e);let t=q();this.setContent([new d({cls:"switch",content:[new A({type:"checkbox",id:t,checked:e.checked}),new d({cls:"track"}),new d({cls:"thumb"})]}),new w({tag:"label",text:e.label,labelFor:t})])}};s(pt,"Switch"),pt=p([u("x4")],pt);var Te=class extends I{constructor(e,t){super(e),this.addClass("outline"),t.cls&&this.addClass(t.cls),this.setIcon(t.icon),this.setText(t.title),this.setData("tabname",t.name)}};s(Te,"CTab"),Te=p([u("x4")],Te);var Se=class extends b{_selitem;constructor(e,t){super(e),this.setItems(t),this.mapPropEvents(e,"click")}_on_click(e){let t=e.source.getData("tabname");this.fire("click",{name:t})}select(e){let t=this.query(`[data-tabname="${e}"]`);this._selitem&&this._selitem.setClass("selected",!1),this._selitem=t,this._selitem&&this._selitem.setClass("selected",!0)}setItems(e){this.clearContent(),e.forEach(t=>{this.addItem(t)})}addItem(e){this.appendContent(new Te({click:s(t=>this._on_click(t),"click")},e))}removeItem(e){let t=this.query(`[data-tabname="${e}"]`);t&&this.removeChild(t)}};s(Se,"CTabList"),Se=p([u("x4")],Se);var ut=class extends k{_list;_stack;_current;constructor(e){var o;super(e);let t=(o=e.items)==null?void 0:o.map(r=>({name:r.name,content:r.content}));this.setContent([this._list=new Se({click:s(r=>this._onclick(r),"click")},e.items),this._stack=new ie({cls:"body x4flex",default:e.default,items:t})]),e.default&&this.selectTab(e.default)}selectTab(e){this._list.select(e),this._stack.select(e),this._current=e}_onclick(e){this.selectTab(e.name)}getTab(e){return this._stack.getPage(e)}getCurTab(){return this._current}addTab(e){this._list.addItem(e),this._stack.addItem({name:e.name,content:e.content}),this._stack.getPageCount()==1&&this.selectTab(e.name)}removeTab(e){this._list.removeItem(e),this._stack.removeItem(e)}enumTabs(){return this._stack.enumPageNames()}};s(ut,"Tabs"),ut=p([u("x4")],ut);var $o=class $o extends d{constructor(e){super({...e,tag:"textarea"}),this.setAttribute("name",e.name),this.setAttribute("value",e.value+""),e.resize||this.setAttribute("resize",!1),e.readonly&&this.setAttribute("readonly",!0)}setText(e){this.dom.value=e}getText(){return this.dom.value}queryInterface(e){return e=="form-element"?{getRawValue:s(()=>this.getText(),"getRawValue"),setRawValue:s(o=>{this.setText(o)},"setRawValue"),isValid:s(()=>!0,"isValid")}:super.queryInterface(e)}};s($o,"SimpleTextArea");var Qo=$o,mt=class extends k{_input;constructor(e){super(e),this.setContent([new w({text:e.label}),this._input=new Qo(e)])}setText(e){this._input.setText(e)}getText(){return this._input.getText()}queryInterface(e){return e=="form-element"?{getRawValue:s(()=>this.getText(),"getRawValue"),setRawValue:s(o=>{this.setText(o)},"setRawValue"),isValid:s(()=>!0,"isValid")}:super.queryInterface(e)}};s(mt,"TextArea"),mt=p([u("x4")],mt);var ft=class extends b{input;constructor(e){var r;super(e),e.inputId||(e.inputId=q()),e.required&&this.setAttribute("required",!0);let t=(r=e.inputGadgets)!=null?r:[],o={...e,id:e.inputId,attrs:e.inputAttrs,width:e.inputWidth};this.setContent([e.label?new b({id:"label",width:e.labelWidth,content:[new w({tag:"label",text:e.label,labelFor:e.inputId})]}):null,new b({id:"edit",content:[this.input=new A(o),...t]})])}getValue(){return this.input.getValue()}setValue(e){this.input.setValue(e)}getInput(){return this.input}};s(ft,"TextEdit"),ft=p([u("x4")],ft);var Zo=class Zo extends d{constructor(e){super(e),this.addDOMEvent("resized",()=>this.update())}update(){var h,m,f,g;let e=this.props,t=e.values;if(!t.length){this.clearContent();return}let o=this.getBoundingRect(),r=(h=e.min)!=null?h:0,n=(m=e.max)!=null?m:100,i=o.width/t.length,a=o.height/(n-r),c=new Gt;if(e.background&&c.rect(0,0,o.width,o.height).fill(e.background.toHexString()),r!=0&&c.path().moveTo(0,0-r).lineTo(o.width,0-r).stroke("var(--tickline-axis-color)",1).antiAlias(!1),e.type=="line"){let x=c.path();for(let _=0;_<t.length;_++)_==0?x.moveTo(_*i,(t[_]-r)*a):x.lineTo(_*i,(t[_]-r)*a);x.stroke(e.color?e.color.toHexString():"var(--tickline-color)",1).no_fill()}else for(let x=0;x<t.length;x++)c.rect(x*i,(0-r)*a,i-1,t[x]*a).fill(e.color?e.color.toHexString():"var(--tickline-color)").antiAlias(!1);this.setContent(new Wt({width:"100%",height:"100%",svg:c,attrs:{viewport:`0 ${(f=e.min)!=null?f:0} ${t.length} ${(g=e.max)!=null?g:100}`}}))}};s(Zo,"TickLine");var jr=Zo;var Yr='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--!Font Awesome Pro 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2024 Fonticons, Inc.--><path class="fa-secondary" opacity=".4" d="M0 176c0 37.5 13.9 72.3 37.6 100.9L0 352l108.1-21.6C137.7 344.2 171.8 352 208 352c114.9 0 208-78.8 208-176S322.9 0 208 0S0 78.8 0 176zm134.7-52c0-25.8 20.9-46.7 46.7-46.7l47.4 0c29.1 0 52.6 23.6 52.6 52.6c0 18.8-10.1 36.3-26.4 45.6L228 191l0 6.3 0 20-40 0 0-20 0-17.9 0-11.6 10-5.8L235 140.9c3.9-2.3 6.3-6.4 6.3-10.9c0-7-5.7-12.6-12.6-12.6l-47.4 0c-3.7 0-6.7 3-6.7 6.7l0 5.5-40 0 0-5.5zM188 250.7l40 0 0 40-40 0 0-40z"/><path class="fa-primary" d="M134.7 124c0-25.8 20.9-46.7 46.7-46.7l47.4 0c29.1 0 52.6 23.6 52.6 52.6c0 18.8-10.1 36.3-26.4 45.6L228 191l0 6.3 0 20-40 0 0-20 0-17.9 0-11.6 10-5.8L235 140.9c3.9-2.3 6.3-6.4 6.3-10.9c0-7-5.7-12.6-12.6-12.6l-47.4 0c-3.7 0-6.7 3-6.7 6.7l0 5.5-40 0 0-5.5zM188 250.7l40 0 0 40-40 0 0-40zM432 512c-95.6 0-176.2-54.6-200.5-129C348.9 372.9 448 288.3 448 176c0-5.2-.2-10.4-.6-15.5C555.1 167.1 640 243.2 640 336c0 37.5-13.9 72.3-37.6 100.9L640 512 531.9 490.4C502.3 504.2 468.2 512 432 512z"/></svg>';var Xt=null,Et=null,Qr=new Oe;function gx(){document.addEventListener("mouseenter",l=>{if(l.target===document)return;let e=mo(l.target),t=e.getAttribute("tooltip"),o=e.queryInterface("tip-handler");if(o&&(t=o.getTip()),t){Xt=l.target;let r=e.getBoundingRect();Zn(t,r,{x:l.pageX,y:l.pageY})}},!0),document.addEventListener("mouseleave",l=>{Xt&&l.target==Xt&&(Xt=null,Xn())},!0)}s(gx,"initTooltips");function Zn(l,e,t){Et||(Et=new Le({})),Qr.setTimeout(null,300,()=>{Et.setText(xt(l)),Et.displayAt(t.x+17,t.y+17)})}s(Zn,"showTT");function Xn(){Et.show(!1),Qr.clearTimeout(null)}s(Xn,"closeTT");var Le=class extends B{constructor(e){super(e),this.setContent(new b({content:[new E({iconId:Yr}),new d({id:"text"})]}))}setText(e){this.query("#text").setContent(e)}};s(Le,"Tooltip"),Le=p([u("x4")],Le);var $r='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="currentColor"><!--!Font Awesome Pro 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2024 Fonticons, Inc.--><path d="M267.3 395.3c-6.2 6.2-16.4 6.2-22.6 0l-192-192c-6.2-6.2-6.2-16.4 0-22.6s16.4-6.2 22.6 0L256 361.4 436.7 180.7c6.2-6.2 16.4-6.2 22.6 0s6.2 16.4 0 22.6l-192 192z"/></svg>';var ei=(h=>(h[h.first=0]="first",h[h.prev=1]="prev",h[h.next=2]="next",h[h.last=3]="last",h[h.parent=4]="parent",h[h.child=5]="child",h[h.expand=6]="expand",h[h.collapse=7]="collapse",h[h.toggle=8]="toggle",h))(ei||{}),xe=class extends C{_item;_label;_icon;_childs;constructor(e,t){super({...e}),this._item=t,t?(this._label=new b({cls:"label item",content:[this._icon=new E({iconId:t.children?$r:void 0}),new w({tag:"span",cls:"",text:t.text,icon:t.iconId})]}),t.cls&&this._label.addClass(t.cls),this._label.setInternalData("id",t.id),t.children&&(this._childs=new k({cls:"body"}),t.open===void 0&&(t.open=!1),this.addClass("folder"),this.setClass("open",t.open),this.setItems(t.children),this._icon.addDOMEvent("click",o=>this.toggle(o)))):this._childs=new k({cls:"body"}),this.setContent([this._label,this._childs])}toggle(e){let t=this.hasClass("open");this.open(!t),e&&e.stopPropagation()}open(e=!0){this.setClass("open",e),this._item.open=e}setItems(e){if(e){let t=e.map(o=>new xe({},o));this._childs.setContent(t)}else this._childs.clearContent()}};s(xe,"CTreeViewItem"),xe=p([u("x4")],xe);var gt=class extends d{_view;_selection;_selitem;_items;constructor(e){super(e),this.mapPropEvents(e,"selectionChange","dblClick","click");let t=new J({cls:"body"});this._view=t.getViewport(),this.setContent([t,e.footer]),e.footer&&e.footer.setAttribute("id","footer"),this.setAttribute("tabindex",0),this.setDOMEvents({click:s(o=>this._on_click(o),"click"),dblclick:s(o=>this._on_click(o),"dblclick"),keydown:s(o=>this._onkey(o),"keydown")}),e.items&&this.setItems(e.items)}setItems(e){this.clearSelection(),this._view.clearContent(),this._items=e;let t=new xe({cls:"root"},null);e&&(t.setItems(e),this._view.setContent(t))}_on_click(e){let t=e.target;for(;t&&t!=this.dom;){let o=T(t);if(o&&o.hasClass("item")){let r=o.getInternalData("id"),n={context:r};e.type=="click"?this.fire("click",n):this.fire("dblClick",n),n.defaultPrevented||this._selectItem(r,o);return}t=t.parentElement}this.clearSelection()}_onkey(e){switch(e.key){case"ArrowDown":{this.navigate(2);break}case"ArrowUp":{this.navigate(1);break}case"Home":{this.navigate(0);break}case"End":{this.navigate(3);break}case"ArrowRight":{this.navigate(5);break}case"+":{this.navigate(6);break}case"ArrowLeft":{this.navigate(4);break}case"-":{this.navigate(7);break}case" ":{this.navigate(8);break}default:console.log(e.key);return}e.preventDefault(),e.stopPropagation()}navigate(e){var r;if(!this._items||this._items.length==0)return;if(!this._selitem)if(e==2||e==4)e=0;else if(e==1)e=3;else return;let t=(r=this._selitem)==null?void 0:r.parentElement(),o=t==null?void 0:t.hasClass("folder");if(t&&e==4&&o&&t.hasClass("open")?e=7:e==5&&(o?t.hasClass("open")?e=2:e=6:e=2),e==6||e==7||e==8){if(o)return e==8?(t.toggle(),!0):(t.open(e==6),!0)}else{let n=this._flattenOpenItems(),i=n.findIndex(c=>this._selection==c.id),a;if(e==0)a=n[0].id;else if(e==3)a=n[n.length-1].id;else if(i>=0){if(e==1)i>0&&(a=n[i-1].id);else if(e==2)i<n.length-1&&(a=n[i+1].id);else if(e==4){let c=n[i].level;for(;i>0;)if(i--,n[i].level<c){a=n[i].id;break}}}if(a){let c=this.query(`[data-id="${a}"]`);return this._selectItem(a,c),!0}}return!1}_flattenOpenItems(){let e=[],t=s((o,r)=>{e.push({id:o.id+"",level:r}),o.children&&o.open&&o.children.forEach(n=>t(n,r+1))},"build");return this._items.forEach(o=>t(o,0)),e}_flattenItems(){let e=[],t=s(o=>{e.push(o),o.children&&o.children.forEach(r=>t(r))},"build");return this._items.forEach(o=>t(o)),e}_selectItem(e,t){this._selitem&&(this._selitem.removeClass("selected"),this._selitem=void 0),this._selitem=t,this._selection=e,t&&(t.addClass("selected"),t.scrollIntoView({behavior:"smooth",block:"nearest"}));let o=this._findItem(e);this.fire("selectionChange",{selection:[o],empty:!1})}_findItem(e){return this._flattenItems().find(o=>o.id==e)}clearSelection(){this._selitem&&(this._selitem.removeClass("selected"),this._selitem=void 0),this._selection=void 0,this.fire("selectionChange",{selection:[],empty:!0})}getSelection(){return this._selection}selectItem(e){this._findItem(e)&&this.visitChildren(o=>{if(o.getInternalData("id")==e)return this._selectItem(e,o),!0})}};s(gt,"Treeview"),gt=p([u("x4")],gt);})();
1
+ "use strict";(()=>{var eo=Object.defineProperty;var rn=Object.getOwnPropertyDescriptor;var nr=l=>{throw TypeError(l)};var nn=(l,e,t)=>e in l?eo(l,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):l[e]=t;var s=(l,e)=>eo(l,"name",{value:e,configurable:!0});var p=(l,e,t,o)=>{for(var r=o>1?void 0:o?rn(e,t):e,n=l.length-1,i;n>=0;n--)(i=l[n])&&(r=(o?i(e,t,r):i(r))||r);return o&&r&&eo(e,t,r),r};var z=(l,e,t)=>nn(l,typeof e!="symbol"?e+"":e,t),ir=(l,e,t)=>e.has(l)||nr("Cannot "+t);var D=(l,e,t)=>(ir(l,e,"read from private field"),t?t.call(l):e.get(l)),te=(l,e,t)=>e.has(l)?nr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(l):e.set(l,t),oe=(l,e,t,o)=>(ir(l,e,"write to private field"),o?o.call(l,t):e.set(l,t),t);var sr=Symbol("i18n"),Le={};function ar(l,e){Le[l]={name:l,base:e,src_translations:{},translations:{}}}s(ar,"createLanguage");function lr(l){return Le[l]!==void 0}s(lr,"isLanguage");function cr(l,...e){if(!lr(l))return;let t=Le[l];e.forEach(o=>{dr(t.src_translations,o)}),t.translations=hr(t.src_translations,t.base,!0)}s(cr,"addTranslation");function dr(l,e){for(let t in e){let o=e[t];typeof o=="string"?l[t]=o:Array.isArray(o)&&(!l[t]||!Array.isArray(l[t]))?l[t]=[...o]:!l[t]||typeof l[t]!="object"?l[t]={...o}:dr(l[t],e[t])}}s(dr,"_patch");function hr(l,e,t){let o={};for(let r in l)typeof l[r]!="string"&&!Array.isArray(l[r])?o[r]=hr(l[r],e,!1):o[r]=l[r];return sn(o,e,t)}s(hr,"_proxyfy");function sn(l,e,t){return new Proxy(l,{get:s((o,r)=>{t?Lt=[r]:Lt.push(r);let n=o[r];return n===void 0&&(e&&(n=an(e)),n===void 0&&console.error("I18N error: unable to find","_tr."+Lt.join("."))),n},"get")})}s(sn,"_mk_proxy");var Lt;function an(l){for(;l;){let e=Le[l],t=e.translations,o;for(let r of Lt){if(o=t[r],o===void 0)break;t=o}if(o!==void 0)return t;l=e.base}}s(an,"_findBaseTrans");var y={};function ln(l){if(lr(l))return y=Le[l].translations,y[sr]=l,y}s(ln,"selectLanguage");function ii(){return y[sr]}s(ii,"getCurrentLanguage");function si(){return Object.keys(Le)}s(si,"getAvailableLanguages");var cn={global:{ok:"OK",cancel:"Annuler",ignore:"Ignorer",yes:"Oui",no:"Non",abort:"Abandonner",retry:"Réessayer",error:"Erreur",today:"Aujourd'hui",open:"Ouvrir",new:"Nouveau",delete:"Supprimer",close:"Fermer",save:"Enregistrer",search:"Rechercher",search_tip:"Saisissez le texte à rechercher. <b>Enter</b> pour lancer la recherche. <b>Esc</b> pour annuler.",required_field:"information requise",invalid_format:"format invalide",invalid_email:"adresse mail invalide",invalid_number:"valeur numérique invalide",diff_date_seconds:"{0} secondes",diff_date_minutes:"{0} minutes",diff_date_hours:"{0} heures",invalid_date:"Date non reconnue ({0})",empty_list:"Liste vide",date_input_formats:"d/m/y|d.m.y|d m y|d-m-y|dmy",date_format:"D/M/Y",day_short:["dim","lun","mar","mer","jeu","ven","sam"],day_long:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],month_short:["jan","fév","mar","avr","mai","jun","jui","aoû","sep","oct","nov","déc"],month_long:["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"],property:"Propriété",value:"Valeur",err_403:"Vous n'avez pas les droits suffisants pour effectuer cette action",copy:"Copier",cut:"Couper",paste:"Coller",filedrop:"Déposez un fichier",keyboard:{next:"Suivant",numeric:"123",alpha:"Abc"}}},dn={global:{ok:"OK",cancel:"Cancel",ignore:"Ignore",yes:"Yes",no:"No",abort:"Abort",retry:"Retry",error:"Error",today:"Today",open:"Open",new:"New",delete:"Delete",close:"Close",save:"Save",search:"Search",search_tip:"Type in the text to search. <b>Enter</b> to start the search. <b>Esc</b> to cancel.",required_field:"missing information",invalid_format:"invalid format",invalid_email:"invalid email address",invalid_number:"bad numeric value",diff_date_seconds:"{0} seconds",diff_date_minutes:"{0} minutes",diff_date_hours:"{0} hours",invalid_date:"Unrecognized date({0})",empty_list:"Empty list",date_input_formats:"m/d/y|m.d.y|m d y|m-d-y|mdy",date_format:"M/D/Y",day_short:["sun","mon","tue","wed","thu","fri","sat"],day_long:["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],month_short:["jan","feb","mar","apr","may","jun","jui","aug","sep","oct","nov","dec"],month_long:["january","february","march","april","mau","june","jully","august","september","october","november","december"],property:"Property",value:"Value",err_403:"You do not have sufficient rights to do that action",copy:"Copy",cut:"Cut",paste:"Paste",filedrop:"Drop a file",keyboard:{next:"Next",numeric:"123",alpha:"Abc"}}};ar("fr",null);cr("fr",cn);ar("en","fr");cr("en",dn);ln("fr");function P(l){return typeof l=="string"}s(P,"isString");function O(l){return typeof l=="number"&&isFinite(l)}s(O,"isNumber");function Q(l){return l instanceof Array}s(Q,"isArray");function ur(l){return l instanceof Function}s(ur,"isFunction");var no=class no extends String{constructor(e){super(e)}};s(no,"UnsafeHtml");var Re=no;function _t(l){return new Re(l)}s(_t,"unsafeHtml");function di(l,...e){let t=l.reduce((o,r,n)=>o+r+(e[n]||""),"");return _t(t)}s(di,"unsafe");function G(l,e,t){return l<e?e:l>t?t:l}s(G,"clamp");var Rt=class Rt{left;top;height;width;constructor(e,t,o,r){e!==void 0&&(O(e)?(this.left=e,this.top=t,this.width=o,this.height=r):Object.assign(this,e))}get right(){return this.left+this.width}get bottom(){return this.top+this.height}contains(e){return e instanceof Rt?e.left>=this.left&&e.right<=this.right&&e.top>=this.top&&e.bottom<=this.bottom:e.x>=this.left&&e.x<this.right&&e.y>=this.top&&e.y<this.bottom}touches(e){return!(this.left>e.right||this.right<e.left||this.top>e.bottom||this.bottom<e.top)}normalize(){let e=this.width,t=this.height;return e<0&&(this.left+=e,this.width=-e),t<0&&(this.top+=t,this.height=-t),this}};s(Rt,"Rect");var Fe=Rt;function mr(l,e,t=0){let o=e.width-2*t,r=e.height-2*t,n=l.width/l.height,i=o,a=o/n;a>r&&(a=r,i=r*n);let c=e.left+(e.width-i)/2,d=e.top+(e.height-a)/2;return{left:c,top:d,width:i,height:a}}s(mr,"centerRect");function Ft(l){switch(l){case"eyedropper":return"EyeDropper"in window}return!1}s(Ft,"isFeatureAvailable");var io=class io{_timers;setTimeout(e,t,o){this._timers?this.clearTimeout(e):this._timers=new Map;let r=setTimeout(o,t);return this._timers.set(e,r),r}clearTimeout(e){this._timers&&this._timers.has(e)&&(clearTimeout(this._timers.get(e)),this._timers.delete(e))}setInterval(e,t,o){this._timers?this.clearInterval(e):this._timers=new Map;let r=setInterval(o,t);return this._timers.set(e,r),r}clearInterval(e){this._timers&&this._timers.has(e)&&(clearInterval(this._timers.get(e)),this._timers.delete(e))}clearAllTimeouts(){var e;(e=this._timers)==null||e.forEach(t=>{clearTimeout(t)}),this._timers=null}};s(io,"Timer");var Be=io;function Z(l){return requestAnimationFrame(l)}s(Z,"asap");function hi(l,e=0){return setTimeout(l,e)}s(hi,"oneshot");function ae(l,e,t="0"){let o;return P(l)?o=l:o=""+l,e>0?o.padEnd(e,t):o.padStart(-e,t)}s(ae,"pad");function to(l,...e){return l.replace(/{(\d+)}/g,function(t,o){return typeof e[o]<"u"?e[o]:t})}s(to,"sprintf");function pi(l){let e=l;return e=e.replace(/([a-z])([A-Z])/g,"$1 $2"),e=e.toLowerCase(),e=e.replace(/[^- a-z0-9]+/g," "),e.indexOf(" ")<0?e:(e=e.trim(),e.replace(/ /g,"-"))}s(pi,"pascalCase");function ui(l){let e=l.toLowerCase();return e=e.replace(/[^a-zA-Z0-9]+(.)/g,(t,o)=>o.toUpperCase()),e}s(ui,"camelCase");var hn="fr-FR";function mi(l){hn=l}s(mi,"_date_set_locale");function fi(l,e){return Y(l)}s(fi,"date_format");function gi(l,e,t){let r=(l.getTime()-e.getTime())/1e3;if(r<60)return to(y.global.diff_date_seconds,Math.round(r));let n=Math.floor(r/60);if(n<60)return to(y.global.diff_date_minutes,Math.round(n));let i=Math.floor(n/60);return to(y.global.diff_date_hours,i,n%60)}s(gi,"date_diff");function xi(l,e){return e?Y(l,"Y-M-D H:I:S"):Y(l,"Y-M-D")}s(xi,"date_to_sql");function bi(l){return new Date(l+" GMT")}s(bi,"date_sql_utc");function xe(l){return l.getFullYear()<<16|l.getMonth()<<8|l.getDate()}s(xe,"date_hash");function ze(l){return new Date(l.getTime())}s(ze,"date_clone");function pr(l){let e=new Date(l.getFullYear(),0,1),t=(l.valueOf()-e.valueOf())/864e5;return Math.floor((t+e.getDay()+1)/7)}s(pr,"date_calc_weeknum");function vi(l,e=y.global.date_input_formats){var o,r,n,i,a,c;let t=e.split("|");for(let d of t){let m="";for(let x=0;x<d.length;x++){let v=d[x];v=="d"?m+="(?<day>\\d{1,2})":v=="D"?m+="(?<day>\\d{2})":v=="m"?m+="(?<month>\\d{1,2})":v=="M"?m+="(?<month>\\d{2})":v=="y"?m+="(?<year>\\d{1,4})":v=="Y"?d[x+1]=="Y"?(m+="(?<year>\\d{4})",x++):m+="(?<year>\\d{2})":v=="h"?m+="(?<hour>\\d{1,2})":v=="H"?m+="(?<hour>\\d{2})":v=="i"?m+="(?<min>\\d{1,2})":v=="I"?m+="(?<min>\\d{2})":v=="s"?m+="(?<sec>\\d{1,2})":v=="S"?m+="(?<sec>\\d{2})":v==" "?m+="\\s+":m+="\\s*\\"+v+"\\s*"}let g=new RegExp("^"+m+"$","m").exec(l);if(g){let x=new Date,v=parseInt((o=g.groups.day)!=null?o:"1"),N=parseInt((r=g.groups.month)!=null?r:"1"),_=parseInt((n=g.groups.year)!=null?n:x.getFullYear()+""),S=parseInt((i=g.groups.hour)!=null?i:"0"),R=parseInt((a=g.groups.min)!=null?a:"0"),F=parseInt((c=g.groups.sec)!=null?c:"0");_>0&&_<100&&(_+=2e3);let U=new Date(_,N-1,v,S,R,F,0),Pt=U.getFullYear(),Dt=U.getMonth()+1,Tt=U.getDate();return Pt!=_||Dt!=N||Tt!=v?null:U}}return null}s(vi,"parseIntlDate");function Y(l,e=y.global.date_format){if(!l)return"";let t={year:l.getFullYear(),month:l.getMonth()+1,day:l.getDate(),wday:l.getDay(),hours:l.getHours(),minutes:l.getMinutes(),seconds:l.getSeconds(),milli:l.getMilliseconds()},o="",r=0;for(let n of e){if(n=="{"){if(++r==1)continue}else if(n=="}"&&--r==0)continue;if(r){o+=n;continue}n=="d"?o+=t.day:n=="D"?o+=ae(t.day,-2):n=="j"?o+=y.global.day_short[t.wday]:n=="J"?o+=y.global.day_long[t.wday]:n=="w"?o+=pr(l):n=="W"?o+=ae(pr(l),-2):n=="m"?o+=t.month:n=="M"?o+=ae(t.month,-2):n=="o"?o+=y.global.month_short[t.month-1]:n=="O"?o+=y.global.month_long[t.month-1]:n=="y"||n=="Y"?o+=ae(t.year,-4):n=="a"||n=="A"?o+=t.hours<12?"am":"pm":n=="h"?o+=t.hours:n=="H"?o+=ae(t.hours,-2):n=="i"?o+=t.minutes:n=="I"?o+=ae(t.minutes,-2):n=="s"?o+=t.seconds:n=="S"?o+=ae(t.seconds,-2):n=="l"?o+=t.milli:n=="L"?o+=ae(t.milli,-3):o+=n}return o}s(Y,"formatIntlDate");function _i(l,e){if(e===void 0&&(e=new Date),!l)return 0;let t=e.getFullYear()-l.getFullYear();return(e.getMonth()<l.getMonth()||e.getMonth()==l.getMonth()&&e.getDate()<l.getDate())&&t--,t}s(_i,"calcAge");function wi(){new Audio("data:audio/wav;base64,//uQRAAAAWMSLwUIYAAsYkXgoQwAEaYLWfkWgAI0wWs/ItAAAGDgYtAgAyN+QWaAAihwMWm4G8QQRDiMcCBcH3Cc+CDv/7xA4Tvh9Rz/y8QADBwMWgQAZG/ILNAARQ4GLTcDeIIIhxGOBAuD7hOfBB3/94gcJ3w+o5/5eIAIAAAVwWgQAVQ2ORaIQwEMAJiDg95G4nQL7mQVWI6GwRcfsZAcsKkJvxgxEjzFUgfHoSQ9Qq7KNwqHwuB13MA4a1q/DmBrHgPcmjiGoh//EwC5nGPEmS4RcfkVKOhJf+WOgoxJclFz3kgn//dBA+ya1GhurNn8zb//9NNutNuhz31f////9vt///z+IdAEAAAK4LQIAKobHItEIYCGAExBwe8jcToF9zIKrEdDYIuP2MgOWFSE34wYiR5iqQPj0JIeoVdlG4VD4XA67mAcNa1fhzA1jwHuTRxDUQ//iYBczjHiTJcIuPyKlHQkv/LHQUYkuSi57yQT//uggfZNajQ3Vmz+Zt//+mm3Wm3Q576v////+32///5/EOgAAADVghQAAAAA//uQZAUAB1WI0PZugAAAAAoQwAAAEk3nRd2qAAAAACiDgAAAAAAABCqEEQRLCgwpBGMlJkIz8jKhGvj4k6jzRnqasNKIeoh5gI7BJaC1A1AoNBjJgbyApVS4IDlZgDU5WUAxEKDNmmALHzZp0Fkz1FMTmGFl1FMEyodIavcCAUHDWrKAIA4aa2oCgILEBupZgHvAhEBcZ6joQBxS76AgccrFlczBvKLC0QI2cBoCFvfTDAo7eoOQInqDPBtvrDEZBNYN5xwNwxQRfw8ZQ5wQVLvO8OYU+mHvFLlDh05Mdg7BT6YrRPpCBznMB2r//xKJjyyOh+cImr2/4doscwD6neZjuZR4AgAABYAAAABy1xcdQtxYBYYZdifkUDgzzXaXn98Z0oi9ILU5mBjFANmRwlVJ3/6jYDAmxaiDG3/6xjQQCCKkRb/6kg/wW+kSJ5//rLobkLSiKmqP/0ikJuDaSaSf/6JiLYLEYnW/+kXg1WRVJL/9EmQ1YZIsv/6Qzwy5qk7/+tEU0nkls3/zIUMPKNX/6yZLf+kFgAfgGyLFAUwY//uQZAUABcd5UiNPVXAAAApAAAAAE0VZQKw9ISAAACgAAAAAVQIygIElVrFkBS+Jhi+EAuu+lKAkYUEIsmEAEoMeDmCETMvfSHTGkF5RWH7kz/ESHWPAq/kcCRhqBtMdokPdM7vil7RG98A2sc7zO6ZvTdM7pmOUAZTnJW+NXxqmd41dqJ6mLTXxrPpnV8avaIf5SvL7pndPvPpndJR9Kuu8fePvuiuhorgWjp7Mf/PRjxcFCPDkW31srioCExivv9lcwKEaHsf/7ow2Fl1T/9RkXgEhYElAoCLFtMArxwivDJJ+bR1HTKJdlEoTELCIqgEwVGSQ+hIm0NbK8WXcTEI0UPoa2NbG4y2K00JEWbZavJXkYaqo9CRHS55FcZTjKEk3NKoCYUnSQ0rWxrZbFKbKIhOKPZe1cJKzZSaQrIyULHDZmV5K4xySsDRKWOruanGtjLJXFEmwaIbDLX0hIPBUQPVFVkQkDoUNfSoDgQGKPekoxeGzA4DUvnn4bxzcZrtJyipKfPNy5w+9lnXwgqsiyHNeSVpemw4bWb9psYeq//uQZBoABQt4yMVxYAIAAAkQoAAAHvYpL5m6AAgAACXDAAAAD59jblTirQe9upFsmZbpMudy7Lz1X1DYsxOOSWpfPqNX2WqktK0DMvuGwlbNj44TleLPQ+Gsfb+GOWOKJoIrWb3cIMeeON6lz2umTqMXV8Mj30yWPpjoSa9ujK8SyeJP5y5mOW1D6hvLepeveEAEDo0mgCRClOEgANv3B9a6fikgUSu/DmAMATrGx7nng5p5iimPNZsfQLYB2sDLIkzRKZOHGAaUyDcpFBSLG9MCQALgAIgQs2YunOszLSAyQYPVC2YdGGeHD2dTdJk1pAHGAWDjnkcLKFymS3RQZTInzySoBwMG0QueC3gMsCEYxUqlrcxK6k1LQQcsmyYeQPdC2YfuGPASCBkcVMQQqpVJshui1tkXQJQV0OXGAZMXSOEEBRirXbVRQW7ugq7IM7rPWSZyDlM3IuNEkxzCOJ0ny2ThNkyRai1b6ev//3dzNGzNb//4uAvHT5sURcZCFcuKLhOFs8mLAAEAt4UWAAIABAAAAAB4qbHo0tIjVkUU//uQZAwABfSFz3ZqQAAAAAngwAAAE1HjMp2qAAAAACZDgAAAD5UkTE1UgZEUExqYynN1qZvqIOREEFmBcJQkwdxiFtw0qEOkGYfRDifBui9MQg4QAHAqWtAWHoCxu1Yf4VfWLPIM2mHDFsbQEVGwyqQoQcwnfHeIkNt9YnkiaS1oizycqJrx4KOQjahZxWbcZgztj2c49nKmkId44S71j0c8eV9yDK6uPRzx5X18eDvjvQ6yKo9ZSS6l//8elePK/Lf//IInrOF/FvDoADYAGBMGb7FtErm5MXMlmPAJQVgWta7Zx2go+8xJ0UiCb8LHHdftWyLJE0QIAIsI+UbXu67dZMjmgDGCGl1H+vpF4NSDckSIkk7Vd+sxEhBQMRU8j/12UIRhzSaUdQ+rQU5kGeFxm+hb1oh6pWWmv3uvmReDl0UnvtapVaIzo1jZbf/pD6ElLqSX+rUmOQNpJFa/r+sa4e/pBlAABoAAAAA3CUgShLdGIxsY7AUABPRrgCABdDuQ5GC7DqPQCgbbJUAoRSUj+NIEig0YfyWUho1VBBBA//uQZB4ABZx5zfMakeAAAAmwAAAAF5F3P0w9GtAAACfAAAAAwLhMDmAYWMgVEG1U0FIGCBgXBXAtfMH10000EEEEEECUBYln03TTTdNBDZopopYvrTTdNa325mImNg3TTPV9q3pmY0xoO6bv3r00y+IDGid/9aaaZTGMuj9mpu9Mpio1dXrr5HERTZSmqU36A3CumzN/9Robv/Xx4v9ijkSRSNLQhAWumap82WRSBUqXStV/YcS+XVLnSS+WLDroqArFkMEsAS+eWmrUzrO0oEmE40RlMZ5+ODIkAyKAGUwZ3mVKmcamcJnMW26MRPgUw6j+LkhyHGVGYjSUUKNpuJUQoOIAyDvEyG8S5yfK6dhZc0Tx1KI/gviKL6qvvFs1+bWtaz58uUNnryq6kt5RzOCkPWlVqVX2a/EEBUdU1KrXLf40GoiiFXK///qpoiDXrOgqDR38JB0bw7SoL+ZB9o1RCkQjQ2CBYZKd/+VJxZRRZlqSkKiws0WFxUyCwsKiMy7hUVFhIaCrNQsKkTIsLivwKKigsj8XYlwt/WKi2N4d//uQRCSAAjURNIHpMZBGYiaQPSYyAAABLAAAAAAAACWAAAAApUF/Mg+0aohSIRobBAsMlO//Kk4soosy1JSFRYWaLC4qZBYWFRGZdwqKiwkNBVmoWFSJkWFxX4FFRQWR+LsS4W/rFRb/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////VEFHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAU291bmRib3kuZGUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMjAwNGh0dHA6Ly93d3cuc291bmRib3kuZGUAAAAAAAAAACU=").play()}s(wi,"beep");var oo=-1;function yi(){if(oo<0){let l=document.createElement("div");l.style.cssText="overflow:auto;position:absolute;top:0;width:100px;height:100px";let e=document.createElement("div");e.style.width="200px",e.style.height="200px",l.appendChild(e),document.body.appendChild(l),oo=l.offsetWidth-l.clientWidth,document.body.removeChild(l)}return oo}s(yi,"getScrollbarSize");var Bt=Symbol("class-ns");function u(l){return function(e){e[Bt]=l}}s(u,"class_ns");function ro(l){document.body.style.cursor=l?"wait":"default"}s(ro,"setWaitCursor");function zt(l){let e=['button:not([tabindex="-1"]):not([disabled])',"[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'];return Array.from(l.querySelectorAll(e.join(","))).filter(o=>o.offsetParent!=null)}s(zt,"getFocusableElements");var Ot=(c=>(c[c.first=0]="first",c[c.prev=1]="prev",c[c.pgdn=2]="pgdn",c[c.pgup=3]="pgup",c[c.next=4]="next",c[c.last=5]="last",c[c.left=6]="left",c[c.right=7]="right",c))(Ot||{});var pn=s(function(){this.propagationStopped=!0},"stopPropagation"),un=s(function(){this.defaultPrevented=!0},"preventDefault"),so=class so{_source;_registry;constructor(e=null){this._source=e!=null?e:this}addListener(e,t,o=!1){this._registry||(this._registry=new Map);let r=this._registry.get(e);r||(r=[],this._registry.set(e,r));let n=t;return r.indexOf(n)==-1&&(o?r.unshift(n):r.push(n)),()=>{this.removeListener(e,t)}}removeListener(e,t){if(!this._registry)return;let o=this._registry.get(e);if(!o)return;let r=t,n=o.indexOf(r);n!==-1&&o.splice(n,1)}fire(e,t){var r;let o=(r=this._registry)==null?void 0:r.get(e);if(o&&o.length){let n=t;if(n||(n={}),n.source||(n.source=this._source),n.type||(n.type=e),n.preventDefault||(n.preventDefault=un),n.stopPropagation||(n.stopPropagation=pn),o.length==1)o[0](n);else{let i=o.slice();for(let a=0,c=i.length;a<c&&(i[a](n),!n.propagationStopped);a++);}}}};s(so,"EventSource");var le=so;var j,X,ao=class ao{constructor(){te(this,j);te(this,X)}__startTimer(e,t,o,r){D(this,X)?this.__stopTimer(e):oe(this,X,new Map);let n=(o?setInterval:setTimeout)(r,t);D(this,X).set(e,()=>{(o?clearInterval:clearTimeout)(n),D(this,X).delete(e)})}__stopTimer(e){var o;let t=(o=D(this,X))==null?void 0:o.get(e);t&&t()}setTimeout(e,t,o){this.__startTimer(e,t,!1,o)}clearTimeout(e){this.__stopTimer(e)}setInterval(e,t,o){this.__startTimer(e,t,!0,o)}clearInterval(e){this.__stopTimer(e)}clearTimeouts(){for(let[e,t]of D(this,X))t();D(this,X).clear()}on(e,t){return console.assert(t!=null),D(this,j)||oe(this,j,new le(this)),D(this,j).addListener(e,t),{off:s(()=>{D(this,j).removeListener(e,t)},"off")}}off(e,t){console.assert(t!=null),D(this,j)&&D(this,j).removeListener(e,t)}fire(e,t){D(this,j)&&D(this,j).fire(e,t)}};j=new WeakMap,X=new WeakMap,s(ao,"CoreElement");var re=ao;var Vt={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1};function xr(l){return!!Vt[l]}s(xr,"isUnitLess");var ce=class ce{m_sheet;m_rules=new Map;constructor(){function e(t){for(let o=0;o<document.styleSheets.length;o++){let r=document.styleSheets[o];if(r.title===t)return r}}if(s(e,"getStyleSheet"),this.m_sheet=e("x4-dynamic-css"),!this.m_sheet){let t=document.createElement("style");t.setAttribute("id","x4-dynamic-css"),document.head.appendChild(t),this.m_sheet=t.sheet}}setRule(e,t){if(P(t)){let o=this.m_rules.get(e);o!==void 0?this.m_sheet.deleteRule(o):o=this.m_sheet.cssRules.length,this.m_rules.set(e,this.m_sheet.insertRule(t,o))}else{let o=1;for(let r in t){let n=r+" { ",i=t[r];for(let a in i){let c=i[a];for(let d=0;d<c.length;d++)n+=a+": "+c[d]+"; "}n+="}",this.setRule(e+"--"+o,n),o++}}}static getVar(e){return ce.doc_style||(ce.doc_style=getComputedStyle(document.documentElement)),e.startsWith("--")||(e="--"+e),ce.doc_style.getPropertyValue(e)}};s(ce,"Stylesheet"),z(ce,"guid",1),z(ce,"doc_style");var fr=ce,lo=class lo{m_style;constructor(e){this.m_style=e}value(e){return this.m_style[e]}parse(e){return parseInt(this.m_style[e])}get style(){return this.m_style}};s(lo,"ComputedStyle");var gr=lo;var mn={mouseleave:1,mouseenter:1,load:1,unload:1,scroll:1,focus:1,blur:1,rowexit:1,beforeunload:1,stop:1,dragdrop:1,dragenter:1,dragexit:1,draggesture:1,dragover:1,contextmenu:1,created:2,removed:2,sizechange:2},Ht=new WeakMap,co=null,fn=s((l,e)=>{let t=s((r,n)=>{let i=Ht.get(r);i&&i[n]&&r.dispatchEvent(new Event(n,{}))},"sendEvent"),o=s((r,n)=>{n&&t(r,"created");for(let i=r.firstChild;i;i=i.nextSibling)o(i,n);n||t(r,"removed")},"notify");for(let r of l)r.type=="childList"&&(r.addedNodes&&r.addedNodes.forEach(n=>{o(n,!0)}),r.removedNodes&&r.removedNodes.forEach(n=>{o(n,!1)}))},"observeMutation"),ho=null;function gn(l){l.forEach(e=>{let t=e.target;t.offsetParent!==null&&t.dispatchEvent(new Event("resized"))})}s(gn,"observeSize");function xn(l){let e=l.target,t=mn[l.type]===2;for(;e;){let o=Ht.get(e);if(o){let r=o[l.type];if(r&&(Array.isArray(r)?r.some(n=>n(l)):r(l),l.stopPropagation||l.defaultPrevented||t))break}if(e=e.parentNode,e==document)break}}s(xn,"dispatchEvent");function Nt(l,e,t,o=!1){e=="removed"||e=="created"?co||(co=new MutationObserver(fn),co.observe(document.body,{childList:!0,subtree:!0})):e=="resized"&&(ho||(ho=new ResizeObserver(gn)),ho.observe(l));let r=Ht.get(l);if(r||(r={},Ht.set(l,r)),!r[e])r[e]=t,l.addEventListener(e,xn);else{let n=r[e];Array.isArray(n)?n.push(t):r[e]=[n,t]}}s(Nt,"addEvent");var br=Symbol("socket"),po=null,mo=class mo{getMaxTouchPoints(){return navigator.maxTouchPoints}};s(mo,"Process");var uo=mo,wt=class wt extends re{env=new Map;mainview;constructor(){super(),console.assert(po==null,"Application must be a singleton."),po=this}setMainView(e){this.mainview=e,document.body.appendChild(e.dom),this._setupKeyboard()}static instance(){return po}getMainView(){return this.mainview}setEnv(e,t){this.env.set(e,t)}getEnv(e,t){var o;return(o=this.env.get(e))!=null?o:t}static fireGlobal(e,t){wt.instance().fire("global",{msg:e,params:t})}_setupKeyboard(){document.addEventListener("keydown",e=>{(e.key=="Tab"||e.key=="Enter")&&this.focusNext(!e.shiftKey)&&e.preventDefault()})}focusNext(e){let t=document.activeElement,o;for(;t!=document.body;){let n=T(t).queryInterface("tab-handler");if(n)return n.focusNext(e);t.classList.contains("x4box")&&(o=t),t=t.parentElement}if(o){let r=zt(o);if(r.length){let n=r[0],i=r[r.length-1],a;if(!e&&document.activeElement===n?a=i:e&&document.activeElement===i&&(a=n),a)return a.focus(),!0}else return!0}return!1}setupSocketMessaging(e,t){let o=window.location.protocol==="https:"?"wss://":"ws://",r=e?o+e:`${o}${window.location.hostname}:${window.location.port}/ws`,n=0,i=null;this.on("global",a=>{Object.prototype.hasOwnProperty.call(a,br)||i&&i.send(JSON.stringify({msg:a.msg,params:a.params}))}),i=new WebSocket(r,"messaging"),i.onopen=()=>{console.log("websocket opened"),n=1},i.onmessage=a=>{if(a.data!="ping"){let c=JSON.parse(a.data);c[br]=!0,this.fire("global",c)}},i.onclose=a=>{console.log("websocket closed:",a),i=null,n&&(t(),n=0)}}getStorage(e){return localStorage.getItem(e)}getStorageJSON(e){try{return JSON.parse(localStorage.getItem(e))}catch{return}}setStorage(e,t){localStorage.setItem(e,t+"")}setStorageJSON(e,t){localStorage.setItem(e,JSON.stringify(t))}};s(wt,"Application"),z(wt,"process",new uo);var Oe=wt;var vr=Symbol("fragment"),_r=Symbol("component"),bn=/^-?\d+(\.\d*)?$/;function vn(l){let e=[],t=Object.getPrototypeOf(l);if(t.constructor==h)return["x4-comp"];for(;t&&t.constructor!==h;){let o=t.constructor.name,r=Object.prototype.hasOwnProperty.call(t.constructor,Bt)?t.constructor[Bt]:"";e.push(r+o.toLowerCase()),t=Object.getPrototypeOf(t)}return e}s(vn,"genClassNames");var _n=1e3,q=s(()=>`x4-${_n++}`,"makeUniqueComponentId"),be,h=class extends re{constructor(t){var o,r;super();z(this,"dom");z(this,"props");z(this,"clsprefix");te(this,be);if(this.props=t,t.existingDOM)this.dom=t.existingDOM;else{t.ns?this.dom=document.createElementNS(t.ns,(o=t.tag)!=null?o:"div"):this.dom=document.createElement((r=t.tag)!=null?r:"div"),t.attrs&&this.setAttributes(t.attrs),t.cls&&this.addClass(t.cls),t.hidden&&this.show(!1),t.flex===!0?this.addClass("x4flex"):t.flex!==void 0&&this.setStyle({flexGrow:t.flex+""}),t.id!==void 0&&this.setAttribute("id",t.id),t.width!==void 0&&this.setStyleValue("width",t.width),t.height!==void 0&&this.setStyleValue("height",t.height),t.tooltip&&this.setAttribute("tooltip",t.tooltip),t.style&&this.setStyle(t.style),t.content&&this.setContent(t.content),t.dom_events&&this.setDOMEvents(t.dom_events);let n=vn(this);this.dom.classList.add(...n),t.disabled&&this.addDOMEvent("created",()=>{this.enable(!1)})}this.dom[_r]=this}onGlobalEvent(t){let o=Oe.instance().on("global",r=>{t(r)});this.addDOMEvent("removed",()=>o.off())}hasClass(t){return this.dom.classList.contains(t)}addClass(t){if(t)if(t.indexOf(" ")>=0){t=t.trim();let o=t.split(" ");this.dom.classList.add(...o)}else this.dom.classList.add(t)}removeClass(t){if(t){if(t=="*"){this.dom.classList.value="";return}if(t.indexOf(" ")>=0){let o=t.split(" ");this.dom.classList.remove(...o)}else this.dom.classList.remove(t)}}removeClassEx(t){Array.from(this.dom.classList).forEach(r=>{r.match(t)&&this.dom.classList.remove(r)})}toggleClass(t){if(!t)return;let o=s(r=>{this.dom.classList.toggle(r)},"toggle");t.indexOf(" ")>=0?t.split(" ").forEach(o):o(t)}setClass(t,o=!0){return o?this.addClass(t):this.removeClass(t),this}setAttributes(t){for(let o in t)this.setAttribute(o,t[o]);return this}setAttribute(t,o){o==null||o===!1?this.dom.removeAttribute(t):this.dom.setAttribute(t,""+o)}getAttribute(t){return this.dom.getAttribute(t)}getData(t){return this.getAttribute("data-"+t)}getIntData(t){let o=parseInt(this.getAttribute("data-"+t));if(Number.isFinite(o))return o}setData(t,o){return this.setAttribute("data-"+t,o)}setInternalData(t,o){return D(this,be)||oe(this,be,new Map),D(this,be).set(t,o),this}getInternalData(t){var o;return(o=D(this,be))==null?void 0:o.get(t)}addDOMEvent(t,o,r=!1){Nt(this.dom,t,o,r)}setDOMEvents(t){for(let o in t)this.addDOMEvent(o,t[o])}mapPropEvents(t,...o){let r=t;o.forEach(n=>{Object.prototype.hasOwnProperty.call(r,n)&&r[n]&&this.on(n,r[n])})}clearContent(){let t=this.dom;for(;t.firstChild;)t.removeChild(t.firstChild)}setContent(t){this.clearContent(),this.appendContent(t)}appendContent(t){let o=s((r,n)=>{if(n instanceof h)r.appendChild(n.dom);else if(n instanceof Re)r.insertAdjacentHTML("beforeend",n.toString());else if(typeof n=="string"||typeof n=="number"){let i=document.createTextNode(n.toString());r.appendChild(i)}else n&&console.warn("Unknown type to append: ",n)},"set");if(!Q(t))o(this.dom,t);else if(t.length<=8)for(let r of t)o(this.dom,r);else{let r=document.createDocumentFragment();for(let n of t)o(r,n);this.dom.appendChild(r)}}prependContent(t){let o=this.dom,r=s(n=>{n instanceof h?o.insertAdjacentElement("afterbegin",n.dom):n instanceof Re?o.insertAdjacentHTML("afterbegin",n.toString()):typeof n=="string"||typeof n=="number"?o.insertAdjacentText("afterbegin",n.toString()):console.warn("Unknown type to append: ",n)},"set");if(!Q(t))r(t);else{let n=document.createDocumentFragment();for(let i of t)r(i);o.insertBefore(o.firstChild,n)}}removeChild(t){this.dom.removeChild(t.dom)}queryAll(t){let o=this.dom.querySelectorAll(t),r=new Array(o.length);return o.forEach((n,i)=>r[i]=fo(n)),r}query(t){let o=this.dom.querySelector(t);return T(o)}setAria(t,o){return this.setAttribute(t,o),this}setStyle(t){let o=this.dom.style;for(let r in t){let n=t[r];!Vt[r]&&(O(n)||bn.test(n))&&(n+="px"),o[r]=n}return this}setStyleValue(t,o){let r=this.dom.style;if(O(o)){let n=o+"";Vt[t]||(n+="px"),r[t]=n}else r[t]=o;return this}getStyleValue(t){return this.dom.style[t]}setWidth(t){this.setStyleValue("width",O(t)?t+"px":t)}setHeight(t){this.setStyleValue("height",O(t)?t+"px":t)}setStyleVariable(t,o){this.dom.style.setProperty(t,o)}getStyleVariable(t){return this.getComputedStyle().getPropertyValue(t)}getComputedStyle(){return getComputedStyle(this.dom)}setCapture(t){this.dom.setPointerCapture(t)}releaseCapture(t){this.dom.releasePointerCapture(t)}getBoundingRect(){let t=this.dom.getBoundingClientRect();return new Fe(t.x,t.y,t.width,t.height)}focus(){return this.dom.focus(),this}hasFocus(){return document.activeElement==this.dom}scrollIntoView(t){this.dom.scrollIntoView(t)}isVisible(){return this.dom.offsetParent!==null}show(t=!0){return this.setClass("x4hidden",!t),this}hide(){return this.show(!1),this}enable(t=!0){return this.setAttribute("disabled",t?null:"true"),(this.dom instanceof HTMLInputElement||this.dom instanceof HTMLButtonElement)&&(this.dom.disabled=!t),this.enumChildNodes(!0).forEach(r=>{(r instanceof HTMLInputElement||r instanceof HTMLButtonElement)&&(r.disabled=!t)}),this}disable(){return this.enable(!1),this}isDisabled(){return this.getAttribute("disabled")}nextElement(){let t=this.dom.nextElementSibling;return T(t)}prevElement(){let t=this.dom.previousElementSibling;return T(t)}parentElement(t){return h.parentElement(this.dom,t)}static parentElement(t,o){for(;t.parentElement;){let r=T(t.parentElement);if(!o||r&&r instanceof o)return r;t=t.parentElement}return null}firstChild(){let t=this.dom.firstElementChild;return T(t)}lastChild(){let t=this.dom.lastElementChild;return T(t)}enumChildComponents(t){let o=[];return this.enumChildNodes(t).forEach(n=>{let i=T(n);i&&o.push(i)}),o}enumChildNodes(t){return Array.from(t?this.dom.querySelectorAll("*"):this.dom.children)}visitChildren(t){let o=s(r=>{for(let n=r.firstElementChild;n;n=n.nextElementSibling){let i=T(n);if(i&&t(i)||n.firstElementChild&&n.tagName!="svg"&&n.tagName!="SVG"&&o(n))return!0}},"visit");o(this.dom)}animate(t,o){this.dom.animate(t,o)}static createElement(t,o,...r){let n;return t==this.createFragment||t===vr?r:(t instanceof Function?(o=o!=null?o:{},!o.children&&r&&r.length&&(o.content=r),n=new t(o!=null?o:{})):n=new h({tag:t,content:r,...o}),r&&r.length,n)}static createFragment(){return this.createElement(vr,null)}queryInterface(t){return null}};be=new WeakMap,s(h,"Component"),h=p([u("x4")],h);function T(l){return l?l[_r]:null}s(T,"componentFromDOM");function fo(l){let e=T(l);return e||new h({existingDOM:l})}s(fo,"wrapDOM");var go=class go extends h{constructor(){super({})}};s(go,"Flex");var Ve=go,xo=class xo extends h{constructor(e,t){super({width:e,cls:t})}};s(xo,"Space");var Ut=xo;function ve(l){return l.toString(16).padStart(2,"0")}s(ve,"hx");function He(l){return Math.round(l)}s(He,"round");var bo=class bo{rgb=[0,0,0,1];invalid=!1;constructor(...e){P(e[0])?this.setValue(e[0]):this.setRgb(e[0],e[1],e[2],e[3])}setValue(e){if(this.invalid=!1,e.length==4&&/#[0-9a-fA-F]{3}/.test(e)){let t=parseInt(e[1],16),o=parseInt(e[2],16),r=parseInt(e[3],16);return this.setRgb(t<<4|t,o<<4|o,r<<4|r,1)}if(e.length==7&&/#[0-9a-fA-F]{6}/.test(e)){let t=parseInt(e[1],16),o=parseInt(e[2],16),r=parseInt(e[3],16),n=parseInt(e[4],16),i=parseInt(e[5],16),a=parseInt(e[6],16);return this.setRgb(t<<4|o,r<<4|n,i<<4|a,1)}if(e.length==9&&/#[0-9a-fA-F]{8}/.test(e)){let t=parseInt(e[1],16),o=parseInt(e[2],16),r=parseInt(e[3],16),n=parseInt(e[4],16),i=parseInt(e[5],16),a=parseInt(e[6],16),c=parseInt(e[7],16),d=parseInt(e[8],16);return this.setRgb(t<<4|o,r<<4|n,i<<4|a,(c<<4|d)/255)}if(e.startsWith("rgba")){let o=/rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*((\d+)|(\d*\.\d+)|(\.\d+))\s*\)/.exec(e);if(o)return this.setRgb(parseInt(o[1]),parseInt(o[2]),parseInt(o[3]),parseFloat(o[4]))}else if(e.startsWith("rgb")){let o=/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/.exec(e);if(o)return this.setRgb(parseInt(o[1]),parseInt(o[2]),parseInt(o[3]),1)}else if(e.startsWith("var")){let o=/var\s*\(([^)]*)\)/.exec(e);if(o){let r=o[1].trim(),i=getComputedStyle(document.documentElement).getPropertyValue(r);return this.setValue(i)}}return this.invalid=!0,this.setRgb(255,0,0,1)}setHsv(e,t,o,r=1){let n=Math.min(5,Math.floor(e*6)),i=e*6-n,a=o*(1-t),c=o*(1-i*t),d=o*(1-(1-i)*t),m,f,g;switch(n){case 0:m=o,f=d,g=a;break;case 1:m=c,f=o,g=a;break;case 2:m=a,f=o,g=d;break;case 3:m=a,f=c,g=o;break;case 4:m=d,f=a,g=o;break;case 5:m=o,f=a,g=c;break}return this.setRgb(m*255,f*255,g*255,r)}setRgb(e,t,o,r){return this.rgb=[G(e|0,0,255),G(t|0,0,255),G(o|0,0,255),G(r,0,1)],this}toRgbString(e){let t=this.rgb;return e===!1||t[3]==1?`rgb(${He(t[0])},${He(t[1])},${He(t[2])})`:`rgba(${He(t[0])},${He(t[1])},${He(t[2])},${t[3].toFixed(3)})`}toHexString(){let e=this.rgb;return e[3]==1?`#${ve(e[0])}${ve(e[1])}${ve(e[2])}`:`#${ve(e[0])}${ve(e[1])}${ve(e[2])}${ve(e[3]*255|0)}`}toRgb(){let e=this.rgb;return{red:e[0],green:e[1],blue:e[2],alpha:e[3]}}toHsv(){let e=this.toRgb();e.red/=255,e.green/=255,e.blue/=255;let t=Math.max(e.red,e.green,e.blue),o=Math.min(e.red,e.green,e.blue),r=t-o,n=t===0?0:r/t,i=t,a;if(r===0)a=0;else switch(t){case e.red:a=(e.green-e.blue)/r/6+(e.green<e.blue?1:0);break;case e.green:a=(e.blue-e.red)/r/6+1/3;break;case e.blue:a=(e.red-e.green)/r/6+2/3;break}return{hue:a,saturation:n,value:i,alpha:e.alpha}}getAlpha(){return this.rgb[3]}setAlpha(e){return this.rgb[3]=G(e,0,1),this}isInvalid(){return this.invalid}};s(bo,"Color");var H=bo;var yo=class yo{name;id;fields;constructor(e){this.name=e,this.id=void 0,this.fields=[]}};s(yo,"MetaInfos");var vo=yo,qt=Symbol("metaField");function Kt(l,e=!0){let t=l.constructor,o=Object.prototype.hasOwnProperty.call(t,qt)?t[qt]:void 0;if(o===void 0){e||console.assert(o!==void 0),o=new vo(t.name);let r=Object.getPrototypeOf(t);if(r!=_o){let n=r[qt];o.fields=[...n.fields,...o.fields],console.assert(o.id===void 0,"cannot define mutiple record id"),o.id||(o.id=n.id)}l.constructor[qt]=o}return o}s(Kt,"_getMetas");var wr;(m=>{function l(){return(f,g)=>{let x=Kt(f);x.fields.push({name:g,type:"any",required:!0}),x.id=g}}m.id=l,s(l,"id");function e(f){return(g,x)=>{Kt(g).fields.push({name:x,...f})}}m.field=e,s(e,"field");function t(f){return e({...f,type:"string"})}m.string=t,s(t,"string");function o(f){return e({...f,type:"int"})}m.int=o,s(o,"int");function r(f){return e({...f,type:"float"})}m.float=r,s(r,"float");function n(f){return e({...f,type:"bool"})}m.bool=n,s(n,"bool");function i(f){return e({...f,type:"date"})}m.date=i,s(i,"date");function a(f){return e({...f,type:"calc"})}m.calc=a,s(a,"calc");function c(f,g){return m.field({...g,type:"array",model:f?new f:null})}m.array=c,s(c,"array");function d(f){return e({...f,type:"any"})}m.any=d,s(d,"any")})(wr||(wr={}));var ko=class ko{getFields(){return Kt(this,!1).fields}validate(e){let t=null;return this.getFields().forEach(r=>{r.required&&!this.getField(r.name,e)&&(t&&(t=[]),t.push(new Error(`field ${r.name} is required.`)))}),t}getFieldIndex(e){return this.getFields().findIndex(o=>o.name==e)}serialize(e){let t={};return this.getFields().forEach(o=>{o.calc===void 0&&(t[o.name]=e[o.name])}),t}unSerialize(e,t){let o=this.getFields(),r=new Gt;return o.forEach(n=>{let i=e[n.name];i!==void 0&&(r[n.name]=this._convertField(n,i))}),t!==void 0?r[o[0].name]=t:console.assert(this.getID(r)!==void 0),r}_convertField(e,t){switch(e.type){case"float":{let o=typeof t=="number"?t:parseFloat(t);if(e.prec!==void 0){let r=Math.pow(10,e.prec);o=Math.round(o*r)/r}return o}case"int":return typeof t=="number"?t:parseInt(t);case"date":return P(t)?new Date(t):t;case"array":{debugger;break}}return t}getID(e){if(!e)return null;let t=Kt(this,!1);return e[t.id]}getRaw(e,t){let o,r=this.getFields();if(typeof e=="string"){if(o=r.findIndex(i=>i.name==e),o<0){console.assert(!1,"unknown field: "+e);return}}else if(e<r.length){if(e<0)return;o=e}else{console.assert(!1,"bad field name: "+e);return}let n=r[o];return n.calc!==void 0?n.calc(t):t[n.name]}getField(e,t){let o=this.getRaw(e,t);return o==null?"":""+o}};s(ko,"DataModel");var _o=ko,Co=class Co{};s(Co,"DataRecord");var Gt=Co,Eo=class Eo extends re{m_props;constructor(e){super(),this.m_props=e}async load(e){e?this.m_props.url=e:e=this.m_props.url,this.m_props.params&&(e+="?"+this.m_props.params.join("&"));let t=await fetch(e);if(t.ok){let o=await t.json(),r=o;this.m_props.solver&&(r=this.m_props.solver(r)),this.fire("change",{value:r,context:o})}}};s(Eo,"DataProxy");var wo=Eo,Io=class Io extends le{m_model;m_fields;m_records;m_proxy;m_rec_index;constructor(e){super(),this.m_fields=void 0,this.m_records=[],this.m_rec_index=null,this.m_model=e.model,this.m_fields=e.model.getFields(),e.data?this.setRawData(e.data):e.url&&(this.m_proxy=new wo({url:e.url,solver:e.solver}),this.m_proxy.on("change",t=>{this.setData(t.value)}),e.autoload!=!1&&this.m_proxy.load())}async load(e){return this.m_proxy.load(e)}async reload(){return this.m_proxy.load()}setData(e){let t=new Array(e.length);e.forEach((o,r)=>{t[r]=this.m_model.unSerialize(o)}),this.setRawData(t)}setRawData(e){this.m_records=e,this._rebuildIndex(),this.fire("data_change",{change_type:"change"})}_rebuildIndex(){this.m_rec_index=null,this.m_rec_index=this.createIndex(null),this.m_rec_index=this.sortIndex(this.m_rec_index,null)}update(e){let t=this.m_model.getID(e),o=this.indexOfId(t);return o<0?!1:(this.m_records[this.m_rec_index[o]]=e,this.fire("data_change",{change_type:"update",id:t}),!0)}append(e){e instanceof Gt||(e=this.m_model.unSerialize(e));let t=this.m_model.getID(e);console.assert(t!==void 0),this.m_records.push(e),this._rebuildIndex(),this.fire("data_change",{change_type:"create",id:t})}getMaxId(){let e,t=this.m_model;return this.m_records.forEach(o=>{let r=t.getID(o);(e===void 0||e<r)&&(e=r)}),e}delete(e){let t=this.indexOfId(e);return t<0?!1:(t=this.m_rec_index[t],this.m_records.splice(t,1),this._rebuildIndex(),this.fire("data_change",{change_type:"delete",id:e}),!0)}get count(){return this.m_rec_index?this.m_rec_index.length:this.m_records.length}get fields(){return this.m_fields}indexOfId(e){let t=this.m_model;for(let o=this.count,r=0;o!=0;o>>=1){let n=r+(o>>1),i=this.m_rec_index[n],a=t.getID(this.m_records[i]);if(a==e)return n;a<e&&(r=n+1,o--)}return-1}getById(e){let t=this.indexOfId(e);return t<0?null:(t=this.m_rec_index[t],this.m_records[t])}getByIndex(e){let t=this.m_rec_index[e];return this._getRecord(t)}_getRecord(e){var t;return(t=this.m_records[e])!=null?t:null}moveTo(e){e.setRawData(this.m_records)}createView(e){let t={...e,store:this};return new yt(t)}createIndex(e){if(e&&e.op==="empty-result")return new Uint32Array(0);let t=new Uint32Array(this.m_records.length),o=0;if(!e)this.forEach((r,n)=>{t[o++]=n});else if(typeof e.op=="function"){let r=e.op;this.forEach((n,i)=>{n&&r(n)&&(t[o++]=i)})}else{let r=this.m_model.getFieldIndex(e.field);if(r<0)return console.assert(!1,"unknown field name in filter"),new Uint32Array(0);let n=e.value;P(n)&&!e.caseSensitive&&(n=n.toUpperCase());let i=s(_=>_<n,"_lt"),a=s(_=>_<=n,"_le"),c=s(_=>_==n,"_eq"),d=s(_=>_!=n,"_neq"),m=s(_=>_>=n,"_ge"),f=s(_=>_>n,"_gt"),g=s(_=>(v.lastIndex=-1,v.test(_)),"_re"),x,v;if(n instanceof RegExp)v=n,x=g;else switch(e.op){case"<":{x=i;break}case"<=":{x=a;break}case"=":{x=c;break}case">=":{x=m;break}case">":{x=f;break}case"<>":{x=d;break}}let N=this.m_model;this.forEach((_,S)=>{if(!_)return;let R=N.getRaw(r,_);R==null?R="":(R=""+R,e.caseSensitive||(R=R.toUpperCase())),x(R)&&(t[o++]=S)})}return t.slice(0,o)}sortIndex(e,t){let o=0,r=[];if(t===null?r.push({fidx:0,asc:!0}):r=t.map(i=>{let a=this.m_model.getFieldIndex(i.field);return a==-1&&(console.assert(!1,"unknown field name in sort"),o++),{fidx:a,asc:i.ascending}}),o||r.length==0)return e;let n=this.m_model;if(r.length==1){let i=r[0].fidx;e.sort((a,c)=>{var f,g;let d=(f=n.getRaw(i,this.getByIndex(a)))!=null?f:"",m=(g=n.getRaw(i,this.getByIndex(c)))!=null?g:"";return d>m?1:d<m?-1:0}),r[0].asc||e.reverse()}else e.sort((i,a)=>{var c,d;for(let m=0;m<r.length;m++){let f=r[m].fidx,g=r[m].asc?1:-1,x=(c=n.getRaw(f,this.getByIndex(i)))!=null?c:"",v=(d=n.getRaw(f,this.getByIndex(a)))!=null?d:"";if(x>v)return g;if(x<v)return-g}return 0});return e}forEach(e){this.m_rec_index?this.m_rec_index.some((t,o)=>{if(e(this.m_records[t],o))return o}):this.m_records.some((t,o)=>{if(t&&e(t,o))return o})}export(){return this.m_records}changed(){this.fire("data_change",{change_type:"change"})}getModel(){return this.m_model}};s(Io,"DataStore");var yr=Io,Ao=class Ao extends re{m_index;m_store;m_model;m_sort;m_filter;m_props;constructor(e){super(),this.m_props=e,this.m_store=e.store,this.m_index=null,this.m_filter=null,this.m_sort=null,this.m_model=this.m_store.getModel(),this.filter(e.filter),e.order?P(e.order)?this.sort([{field:e.order,ascending:!0}]):Q(e.order)?this.sort(e.order):this.sort([e.order]):this.sort(null),this.m_store.addListener("data_change",t=>this._storeChange(t))}_storeChange(e){this._filter(this.m_filter,e.type!="change"),this._sort(this.m_sort,e.type!="change"),this.fire("view_change",{change_type:"change"})}filter(e){return this.m_index=null,this._filter(e,!0)}_filter(e,t){return this.m_index=this.m_store.createIndex(e),this.m_filter=e,this.m_sort&&this.sort(this.m_sort),t&&this.fire("view_change",{change_type:"filter"}),this.m_index.length}sort(e){this._sort(e,!0)}_sort(e,t){this.m_index=this.m_store.sortIndex(this.m_index,e),this.m_sort=e,t&&this.fire("view_change",{change_type:"sort"})}getStore(){return this.m_store}getCount(){return this.m_index.length}indexOfId(e){let t=this.m_store.indexOfId(e);return this.m_index.findIndex(o=>o===t)}getByIndex(e){if(e>=0&&e<this.m_index.length){let t=this.m_index[e];return this.m_store.getByIndex(t)}return null}getIdByIndex(e){let t=this.getByIndex(e);return this.m_model.getID(t)}getRecId(e){return this.m_model.getID(e)}getById(e){return this.m_store.getById(e)}getModel(){return this.m_model}changed(){this.fire("view_change",{change_type:"change"})}forEach(e){this.m_index.some(t=>{let o=this.m_store.getByIndex(t);if(o&&e(o,t))return t})}};s(Ao,"DataView");var yt=Ao;var Mo=Symbol("x-drag-cb"),Do=class Do{dragSource;dragGhost;dropTarget;notified;timer;registerDraggableElement(e){e.addDOMEvent("dragstart",t=>{this.dragSource=e,this.dragGhost=e.dom.cloneNode(!0),this.dragGhost.classList.add("dragged"),document.body.appendChild(this.dragGhost),e.addClass("dragging"),t.dataTransfer.setData("text/string","1"),t.dataTransfer.setDragImage(new Image,0,0),t.stopPropagation()}),e.addDOMEvent("drag",t=>{this.dragGhost.style.left=t.pageX+"px",this.dragGhost.style.top=t.pageY+"px"}),e.addDOMEvent("dragend",t=>{e.removeClass("dragging"),this.dragGhost.remove()}),e.setAttribute("draggable","true")}registerDropTarget(e,t,o){let r=s(c=>{if(o&&!o(this.dragSource,c.dataTransfer)){console.log("reject ",e),c.dataTransfer.dropEffect="none";return}console.log("accepted ",e),c.preventDefault(),c.dataTransfer.dropEffect="copy"},"dragEnter"),n=s(c=>{if(o&&!o(this.dragSource,c.dataTransfer)){console.log("reject ",e),c.dataTransfer.dropEffect="none";return}if(c.preventDefault(),this.dropTarget!=e&&(this.dropTarget=e,this._startCheck()),this.dropTarget){let d={pt:{x:c.pageX,y:c.pageY},data:c.dataTransfer};t("drag",this.dragSource,d)}c.dataTransfer.dropEffect="copy"},"dragOver"),i=s(c=>{this.dropTarget=null,c.preventDefault()},"dragLeave"),a=s(c=>{let d={pt:{x:c.pageX,y:c.pageY},data:c.dataTransfer};t("drop",this.dragSource,d),this.dropTarget=null,e.removeClass("drop-over"),c.preventDefault()},"drop");e.addDOMEvent("dragenter",r),e.addDOMEvent("dragover",n),e.addDOMEvent("dragleave",i),e.addDOMEvent("drop",a),e.setInternalData(Mo,t)}_startCheck(){this.timer&&(clearInterval(this.timer),this._check()),this.timer=setInterval(()=>this._check(),300)}_check(){let e=s(o=>{o.removeClass("drop-over"),o.getInternalData(Mo)("leave",this.dragSource)},"leaving"),t=s(o=>{o.addClass("drop-over"),o.getInternalData(Mo)("enter",this.dragSource)},"entering");this.dropTarget?(!this.notified||this.notified!=this.dropTarget)&&(this.notified&&e(this.notified),this.notified=this.dropTarget,t(this.notified)):this.notified&&(e(this.notified),this.notified=null,clearInterval(this.timer))}};s(Do,"DragManager");var Po=Do,jt=new Po;var To=class To{static create_element(e,t,...o){t=t||{};let r;return P(e)?(r=new h({tag:e}),Object.entries(t).forEach(([n,i])=>{n.startsWith("on")&&n.toLowerCase()in window?r.dom.addEventListener(n.toLowerCase().substring(2),i):r.setAttribute(n,i)})):r=new e(t),o&&o.length&&r.appendContent(o),r}};s(To,"x4_react");var kr=To;function wn(l,e=!1){if(l instanceof RegExp)return{keys:null,pattern:l};let t=l.split("/"),o=[],r="";t[0]==""&&t.shift();for(let n of t){let i=n[0];if(i==="*")o.push("wild"),r+="/(.*)";else if(i===":"){let a=n.indexOf("?",1),c=n.indexOf(".",1);o.push(n.substring(1,a>=0?a:c>=0?c:n.length)),r+=a>=0&&c<0?"(?:/([^/]+?))?":"/([^/]+?)",c>=0&&(r+=(a>=0?"?":"")+"\\"+n.substring(c))}else r+="/"+n}return{keys:o,pattern:new RegExp(`^${r}${e?"(?=$|/)":"/?$"}`,"i")}}s(wn,"parseRoute");var So=class So extends le{m_routes;m_useHash;constructor(e=!0){super(),this.m_routes=[],this.m_useHash=e,window.addEventListener("popstate",t=>{let o=this._getLocation(),r=this._find(o);r.handlers.forEach(n=>{n(r.params,o)}),this.fire("change",{value:this._getLocation()})})}get(e,t){let{keys:o,pattern:r}=wn(e);this.m_routes.push({keys:o,pattern:r,handler:t})}init(){this.navigate(this._getLocation())}_getLocation(){return this.m_useHash?"/"+document.location.hash.substring(1):document.location.pathname}navigate(e,t=!0,o=!1){e.startsWith("/")||(e="/"+e);let r=this._find(e);if(!r||r.handlers.length==0)return console.log("route not found: "+e),this.fire("error",{code:404,message:"route not found"}),!1;if(this.m_useHash){for(;e.at(0)=="/";)e=e.substring(1);e="#"+e}return o?window.history.replaceState({},"",e):window.history.pushState({},"",e),t&&r.handlers[0](r.params,e),this.fire("change",{value:this._getLocation()}),!0}_find(e){let t=[],o={},r=[];for(let n of this.m_routes)if(n.keys)if(n.keys.length>0){if(t=n.pattern.exec(e),t===null)continue;for(let i=0;i<n.keys.length;)o[n.keys[i]]=t[++i];r=[...r,n.handler]}else n.pattern.test(e)&&(r=[...r,n.handler]);else{if(t=n.pattern.exec(e),!t)continue;if(t.groups)for(let i in t.groups)o[i]=t.groups[i];r=[...r,n.handler]}return{params:o,handlers:r}}};s(So,"Router");var Cr=So;var Lo=class Lo{_state;_subscribers;_currentTracking;constructor(e){this._state=e?{...e}:{},this._subscribers=new Map,this._currentTracking=new Set}getState(e,t=null){this._currentTracking&&this._currentTracking.add(e);let o=e.split("."),r=this._state;for(let n of o){if((r==null?void 0:r[n])===void 0)return t;r=r[n]}return r}setState(e,t,o={}){let r=e.split("."),n=this._state;for(let i=0;i<r.length-1;i++){let a=r[i];(!n[a]||typeof n[a]!="object")&&(n[a]={}),n=n[a]}n[r[r.length-1]]=t}};s(Lo,"StateManager");var Er=Lo;var Ir="http://www.w3.org/2000/svg";function yn(l){return l*Math.PI/180}s(yn,"d2r");function Ar(l,e,t,o){let r=yn(o);return{x:l+t*Math.cos(r),y:e+t*Math.sin(r)}}s(Ar,"p2c");function M(l){return Math.round(l*1e3)/1e3}s(M,"num");function Wt(l,...e){return e=e.map(t=>typeof t=="number"&&isFinite(t)?M(t):t),String.raw(l,...e)}s(Wt,"clean");var Oo=class Oo{_dom;constructor(e){this._dom=document.createElementNS("http://www.w3.org/2000/svg",e)}getDom(){return this._dom}reset(){let e=this._dom.attributes;for(let t=e.length-1;t>=0;t--)this._dom.removeAttribute(e[t].name);return this}stroke(e,t){return this.setAttr("stroke",e),t!==void 0&&this.setAttr("stroke-width",t+"px"),this}strokeWidth(e){return this.setAttr("stroke-width",e+"px"),this}strokeCap(e){return this.setAttr("stroke-linecap",e)}strokeOpacity(e){return this.setAttr("stroke-opacity",e+"")}antiAlias(e){return this.setAttr("shape-rendering",e?"auto":"crispEdges")}fill(e){return this.setAttr("fill",e),this}no_fill(){return this.setAttr("fill","transparent"),this}getAttr(e){return this._dom.getAttribute(e)||""}getNumAttr(e){let t=this._dom.getAttribute(e);return t==""?0:parseInt(t)}setAttr(e,t){return t==null?this._dom.removeAttribute(e):this._dom.setAttribute(e,t),this}setStyle(e,t){let o=this._dom.style;if(O(t)){let r=t+"";xr(e)||(r+="px"),o[e]=r}else o[e]=t;return this}addClass(e){if(e){if(e=e.trim(),e.indexOf(" ")>=0){let t=e.split(" ");this._dom.classList.add(...t)}else this._dom.classList.add(e);return this}}removeClass(e){if(e){if(e.indexOf(" ")>=0){let t=e.split(" ");this._dom.classList.remove(...t)}else this._dom.classList.remove(e);return this}}clip(e){return this.setAttr("clip-path",`url(#${e})`),this}transform(e){return this.setAttr("transform",e),this}add_transformation(e){let t=this.getAttr("transform");return this.setAttr("transform",t+" "+e),this}clear_transform(){return this.setAttr("transform",null),this}rotate(e,t,o){return this.transform(`rotate( ${e} ${t} ${o} )`),this}add_rotation(e,t,o){return this.add_transformation(`rotate( ${e} ${t} ${o} )`),this}translate(e,t){return this.transform(`translate( ${e} ${t} )`),this}add_translation(e,t){return this.add_transformation(`translate( ${e} ${t} )`),this}scale(e){return this.transform(`scale( ${e} )`),this}add_scale(e){return this.add_transformation(`scale( ${e} )`),this}addDOMEvent(e,t,o=!1){return Nt(this._dom,e,t,o),this}};s(Oo,"SvgItem");var de=Oo,Vo=class Vo extends de{_path;constructor(){super("path"),this._path=""}_update(){return this.setAttr("d",this._path),this}reset(){return this._path="",super.reset(),this}moveTo(e,t){return this._path+=Wt`M${e},${t}`,this._update()}lineTo(e,t){return this._path+=Wt`L${e},${t}`,this._update()}curveTo(e,t,o,r,n,i){return this._path+=Wt`C${e},${t} ${o},${r} ${n},${i}`,this._update()}closePath(){return this._path+="Z",this._update()}arc(e,t,o,r,n,i=!0){let a=Ar(e,t,o,r-90),c=Ar(e,t,o,n-90),d=n-r<=180?"0":"1";return this._path+=Wt`M${a.x},${a.y}A${o},${o} 0 ${d} ${i?"1":"0"} ${c.x},${c.y}`,this._update()}};s(Vo,"SvgPath");var Ro=Vo,Ho=class Ho extends de{constructor(e,t,o){super("text"),this.setAttr("x",M(e)+""),this.setAttr("y",M(t)+""),this._dom.innerHTML=o}font(e){return this.setAttr("font-family",e)}fontSize(e){return this.setAttr("font-size",e+"")}fontWeight(e){return this.setAttr("font-weight",e)}textAlign(e){let t;switch(e){case"left":t="start";break;case"center":t="middle";break;case"right":t="end";break;default:return this}return this.setAttr("text-anchor",t)}verticalAlign(e){let t;switch(e){case"top":t="hanging";break;case"center":t="middle";break;case"bottom":t="baseline";break;case"baseline":t="mathematical";break;default:return}return this.setAttr("alignment-baseline",t)}};s(Ho,"SvgText");var Fo=Ho,No=class No extends de{constructor(e){super("svg"),e.startsWith("data:image/svg+xml,")&&(e=e.substring(19));let o=new DOMParser().parseFromString(decodeURIComponent(e),"image/svg+xml"),r=o.querySelector("parsererror");r&&console.error(`error while parsing svg:
2
+ `+r.textContent);let n=o.documentElement;for(let i=0;i<n.attributes.length;i++)this._dom.setAttribute(n.attributes[i].name,n.attributes[i].value);for(let i=0;i<n.childNodes.length;i++){let a=n.childNodes[i];a.nodeType===1&&this._dom.appendChild(a)}}};s(No,"SvgIcon");var Bo=No,Uo=class Uo extends de{constructor(e){super(e)}};s(Uo,"SvgShape");var kt=Uo,Ne=class Ne extends de{_id;_stops;constructor(e,t,o,r){super("linearGradient"),this._id="gx-"+Ne.g_id,Ne.g_id++,this.setAttr("id",this._id),this.setAttr("x1",P(e)?e:M(e)+""),this.setAttr("x2",P(o)?o:M(o)+""),this.setAttr("y1",P(t)?t:M(t)+""),this.setAttr("y2",P(r)?r:M(r)+""),this._stops=[]}get id(){return"url(#"+this._id+")"}addStop(e,t){return this._dom.insertAdjacentHTML("beforeend",`<stop offset="${e}%" stop-color="${t}"></stop>`),this}};s(Ne,"SvgGradient"),z(Ne,"g_id",1);var zo=Ne,$t=class $t extends de{constructor(e="g"){super(e)}append(e){return this._dom.appendChild(e.getDom()),e}appendItems(e){e.forEach(t=>{this._dom.appendChild(t.getDom())})}path(){let e=new Ro;return this.append(e)}text(e,t,o){let r=new Fo(e,t,o);return this.append(r)}ellipse(e,t,o,r){let n=new kt("ellipse");return n.setAttr("cx",M(e)+""),n.setAttr("cy",M(t)+""),n.setAttr("rx",M(o)+""),n.setAttr("ry",M(r)+""),this.append(n)}circle(e,t,o){let r=new kt("ellipse");return r.setAttr("cx",M(e)+""),r.setAttr("cy",M(t)+""),r.setAttr("rx",M(o)+""),r.setAttr("ry",M(o)+""),this.append(r)}icon(e,t,o,r,n){let i=new Bo(e);return i.setAttr("x",M(t)+""),i.setAttr("y",M(o)+""),i.setAttr("width",M(r)+""),i.setAttr("height",M(n)+""),this.append(i)}rect(e,t,o,r){r<0&&(t=t+r,r=-r);let n=new kt("rect");return n.setAttr("x",M(e)+""),n.setAttr("y",M(t)+""),n.setAttr("width",M(o)+""),n.setAttr("height",M(r)+""),this.append(n)}group(e){let t=new $t;return e&&t.setAttr("id",e),this.append(t)}linear_gradient(e,t,o,r){let n=new zo(e,t,o,r);return this.append(n)}clear(){let e=this._dom;for(;e.firstChild;)e.removeChild(e.firstChild)}};s($t,"SvgGroup");var Ct=$t,_e=class _e extends Ct{constructor(){super()}addClip(e,t,o,r){let n="clip-"+_e.g_clip_id++,i=new Ct("clipPath");return i.setAttr("id",n),i.rect(e,t,o,r),this.append(i),{id:n,clip:i}}addPattern(e,t,o,r){let n="pat-"+_e.g_pat_id++,i=new Ct("pattern");return i.setAttr("id",n),i.setAttr("x",M(e)+""),i.setAttr("y",M(t)+""),i.setAttr("width",M(o)+""),i.setAttr("height",M(r)+""),i.setAttr("patternUnits","userSpaceOnUse"),this.append(i),{id:n,pat:i}}};s(_e,"SvgBuilder"),z(_e,"g_clip_id",1),z(_e,"g_pat_id",1);var Ue=_e,qo=class qo extends h{constructor(e){super({...e,tag:"svg",ns:Ir}),this.setAttribute("xmlns",Ir),e.viewbox&&this.setAttribute("viewBox",e.viewbox),e.svg&&this.dom.appendChild(e.svg.getDom())}setSvg(e){this.clearContent(),this.dom.appendChild(e.getDom())}addItems(...e){e.forEach(t=>this.dom.appendChild(t.getDom()))}};s(qo,"SvgComponent");var qe=qo;var C=class extends h{};s(C,"Box"),C=p([u("x4")],C);var b=class extends C{};s(b,"HBox"),b=p([u("x4")],b);var k=class extends C{constructor(e){super(e)}};s(k,"VBox"),k=p([u("x4")],k);var ne=class extends C{_items;_cur;constructor(e){var t;super(e),this.mapPropEvents(e,"pageChange"),this._items=(t=e.items)==null?void 0:t.map(o=>({...o,page:null})),e.default?this.select(e.default):this._items.length&&this.select(this._items[0].name)}addItem(e){this._items.push({name:e.name,content:e.content,page:null})}removeItem(e){let t=this._items.findIndex(o=>o.name==e);if(t>=0){let o=this._items[t];o!=null&&o.page&&this.removeChild(o.page),this._items.splice(t,1)}}select(e){var r;let t=this.query(":scope > .selected");t&&t.setClass("selected",!1),this._cur=this._items.findIndex(n=>n.name==e);let o=this._items[this._cur];return o&&(o.page||(o.page=this._createPage(o),this.appendContent(o.page)),t=o.page,t&&((r=t.activate)==null||r.call(t),t.setClass("selected",!0)),Z(()=>this.fire("pageChange",{selection:[o.name],empty:!t}))),o==null?void 0:o.page}_createPage(e){let t;return e.content instanceof Function?(t=e.content(),e.content=t):t=e.content,t==null||t.setData("stackname",e.name),t}getPage(e){let t=this._items.find(o=>o.name==e);return t?t.content:null}getPageCount(){return this._items.length}enumPageNames(){return this._items.map(e=>e.name)}getItem(e){return this._items.find(o=>o.name==e)}getCurPage(){let e=this._items[this._cur];return e==null?void 0:e.name}};s(ne,"StackBox"),ne=p([u("x4")],ne);var Ke=class extends ne{selectNextPage(e=!0){let t;e&&this._cur<this._items.length-1?t=this._items[this._cur+1]:!e&&this._cur>0&&(t=this._items[this._cur-1]),t&&this.select(t.name)}isFirstPage(){return this._cur==0}isLastPage(){return this._cur==this._items.length-1}};s(Ke,"AssistBox"),Ke=p([u("x4")],Ke);var Ge=class extends C{constructor(e){super(e),e.rows!==void 0&&this.setRows(e.rows),e.columns!==void 0&&this.setCols(e.columns),e.items&&this.setItems(e.items)}setRows(e){Q(e)?e=e.join(" "):O(e)&&(e=`repeat( ${e}, 1fr )`),this.setStyleValue("gridTemplateRows",e)}setCols(e){Q(e)?e=e.join(" "):O(e)&&(e=`repeat( ${e}, 1fr )`),this.setStyleValue("gridTemplateColumns",e)}setRowCount(e){this.setStyleValue("gridTemplateRows",`repeat(${e})`)}setColCount(e){this.setStyleValue("gridTemplateColumns",`repeat(${e})`)}setTemplate(e){this.setAttribute("grid-template-area",e.map(t=>'"'+t+'"').join(" "))}setItems(e){e.forEach(t=>{t.item.setStyle({gridColumn:t.col+1+"",gridRow:t.row+1+""})}),this.setContent(e.map(t=>t.item))}};s(Ge,"GridBox"),Ge=p([u("x4")],Ge);var je=class extends C{constructor(e){super(e),this.addDOMEvent("resized",()=>{this.resizeAllItems()}),e.items&&this.setItems(e.items)}resizeItem(e){let t=this.getComputedStyle(),o=parseInt(t.gridAutoRows),r=parseInt(t.rowGap),n=e.query(".content");if(n||(n=e),n&&o+r){let i=n.getBoundingRect(),a=Math.ceil((i.height+r)/(o+r));e.setStyleValue("gridRowEnd","span "+a)}}resizeAllItems(){this.queryAll(".item").forEach(t=>{this.resizeItem(t)})}setItems(e){let t=e.map(o=>new C({cls:"item",content:o}));this.setContent(t)}};s(je,"MasonryBox"),je=p([u("x4")],je);var We=class extends b{constructor(e){super(e),this.mapPropEvents(e,"click"),e.items&&this.setItems(e.items)}setItems(e){let t=e.map(o=>new I({label:o.label,icon:o.icon,click:s(()=>{o.click?o.click(o.name):this.fire("click",{context:o.name})},"click")}));this.setContent(t)}};s(We,"Breadcrumbs"),We=p([u("x4")],We);var Go=class Go{cache;waiters;constructor(){this.cache=new Map,this.waiters=new Map}async load(e){return this.cache.has(e)?Promise.resolve(this.cache.get(e)):new Promise((t,o)=>{this.waiters.has(e)?this.waiters.get(e).push(t):(this.waiters.set(e,[t]),this._load(e).then(r=>{this.cache.set(e,r),this.waiters.get(e).forEach(i=>i(r))}))})}async _load(e){let t=await fetch(e);if(t.ok)return t.text()}};s(Go,"SvgLoader");var Ko=Go,Et=new Ko,E=class extends h{constructor(e){super(e),this.setIcon(e.iconId)}setIcon(e){if(this.clearContent(),e){if(e.startsWith("var:"))do{let t=e.substring(4);e=document.documentElement.style.getPropertyValue(t)}while(e.startsWith("var:"));e.startsWith("data:image/svg+xml,<svg")?this.dom.insertAdjacentHTML("beforeend",e.substring(19)):e.endsWith(".svg")?Et.load(e).then(t=>{this.clearContent(),this.dom.insertAdjacentHTML("beforeend",t)}):this.setContent(new h({tag:"img",attrs:{src:e}})),this.removeClass("empty")}else this.addClass("empty")}};s(E,"Icon"),E=p([u("x4")],E);var $e,I=class extends h{constructor(t){super({...t,tag:"button",content:null});te(this,$e);this.mapPropEvents(t,"click"),t.autorepeat?(this.addDOMEvent("pointerdown",o=>this._on_mouse(o)),this.addDOMEvent("pointerup",o=>this._on_mouse(o))):this.addDOMEvent("click",o=>this._on_click(o)),this.addDOMEvent("keydown",o=>this._on_keydown(o)),this.setContent([new E({id:"icon",iconId:this.props.icon}),oe(this,$e,new h({id:"label"}))]),this.setText(t.label),t.tabindex!==!1&&this.setAttribute("tabindex",t.tabindex)}_on_click(t){this.fire("click",{}),t.preventDefault(),t.stopPropagation()}_on_mouse(t){let o=0;if(t.type=="pointerdown"){this.dom.setPointerCapture(t.pointerId);let r=this.props.autorepeat===!0?200:this.props.autorepeat;this.setTimeout("repeat",500,()=>{o++,this.fire("click",{}),this.setInterval("repeat",r,()=>{this.fire("click",{})})})}else this.clearTimeout("repeat"),o||this.fire("click",{})}click(){this.dom.click()}_on_keydown(t){t.key=="Enter"&&(this.click(),t.preventDefault())}setText(t){D(this,$e).setContent(t),D(this,$e).setClass("empty",!t)}setIcon(t){this.query("#icon").setIcon(t)}};$e=new WeakMap,s(I,"Button"),I=p([u("x4")],I);var he=class extends C{constructor(e){super(e),e.align&&this.addClass("align-"+e.align),this.addClass(e.vertical?"x4vbox":"x4hbox"),e.items&&this.setButtons(e.items),this.mapPropEvents(e,"btnclick")}setButtons(e){this.clearContent();let t=[],o=s((r,n)=>{let i=r.indexOf(n);if(i>=0)return r.splice(i,1),!0},"hasOption");e==null||e.forEach(r=>{if(r==="-"||r===">>")r=new Ve;else if(r=="~")r=new Ut("1em");else if(P(r)){let n,i=r,[a,...c]=i.split("."),d="";switch(a){case"ok":n=y.global.ok;break;case"cancel":n=y.global.cancel;break;case"abort":n=y.global.abort;break;case"no":n=y.global.no;break;case"yes":n=y.global.yes;break;case"retry":n=y.global.retry;break}r=new I({cls:d,id:a,label:n,click:s(()=>{this.fire("btnclick",{button:a})},"click")}),o(c,"default")&&r.addClass("default"),o(c,"autofocus")&&r.setAttribute("autofocus",!0),o(c,"disabled")&&r.enable(!1),r.addClass(c.join(" "))}t.push(r)}),super.setContent(t)}getButton(e){return this.query("#"+e)}};s(he,"BtnGroup"),he=p([u("x4")],he);var Ye,w=class extends h{constructor(t){super({...t,content:null});te(this,Ye);this.setContent([new E({id:"icon",iconId:this.props.icon}),oe(this,Ye,new h({tag:"span",id:"text"}))]);let o=this.props.text;this.setText(o),t.labelFor&&this.setAttribute("for",t.labelFor)}setText(t){D(this,Ye).setContent(t),D(this,Ye).setClass("empty",!t)}setIcon(t){this.query("#icon").setIcon(t)}};Ye=new WeakMap,s(w,"Label"),w=p([u("x4")],w);var V=class extends h{constructor(e){super({...e}),this.setContent(e.text),e.align&&this.addClass("al-"+e.align)}setText(e){this.setContent(e),this.setClass("empty",!e)}};s(V,"SimpleText"),V=p([u("x4")],V);var L=class extends h{_type;_ref;_delta;constructor(e,t){super({}),this._type=e,this.addClass(e),this.addDOMEvent("pointerdown",o=>{this.setCapture(o.pointerId),this._ref=t!=null?t:T(this.dom.parentElement),this._delta={x:0,y:0};let r=this._ref.getBoundingRect();this._type.includes("left")?this._delta.x=o.pageX-r.left:this._delta.x=o.pageX-(r.left+r.width),this._type.includes("top")?this._delta.y=o.pageY-r.top:this._delta.y=o.pageY-(r.top+r.height),this.fire("start",{})}),this.addDOMEvent("pointerup",o=>{this.fire("stop",{}),this.releaseCapture(o.pointerId),this._ref=null}),this.addDOMEvent("pointermove",o=>{this._onMouseMove(o)})}_onMouseMove(e){if(!this._ref)return;let t={x:e.pageX-this._delta.x,y:e.pageY-this._delta.y},o=this._ref.getBoundingRect(),r={},n=!0;this._type.includes("top")&&(r.top=t.y,r.height=o.top+o.height-t.y,n=!1),this._type.includes("bottom")&&(r.height=t.y-o.top,n=!1),this._type.includes("left")&&(r.left=t.x,r.width=o.left+o.width-t.x),this._type.includes("right")&&(r.width=t.x-o.left),this._ref.setStyle(r);let i=this._ref.getBoundingRect();this.fire("resize",{size:n?i.width:i.height}),e.preventDefault(),e.stopPropagation()}};s(L,"CSizer"),L=p([u("x4")],L);var W=[],jo=[],ie=[],Qe;function Yt(){return document.body}s(Yt,"getRoot");var B=class extends C{_isshown=!1;_ismodal=!1;constructor(e){super(e),this.props.sizable&&this._createSizers(),Z(()=>{(this.props.movable===!0||this.props.sizable&&this.props.movable===void 0)&&(this.queryAll(".caption-element").forEach(o=>new Qt(o,this)),this.hasClass("popup-caption")&&new Qt(this,this))})}displayNear(e,t="top left",o="top left",r={x:0,y:0}){this.setStyle({left:"0px",top:"0px"}),this._do_show();let n=this.getBoundingRect(),i=e.left,a=e.top;o.indexOf("right")>=0?i=e.left+e.width:o.indexOf("center")>=0&&(i=e.left+e.width/2),o.indexOf("bottom")>=0?a=e.bottom:o.indexOf("middle")>=0&&(a=e.top+e.height/2),t.indexOf("right")>=0?i-=n.width:t.indexOf("center")>=0&&(i-=n.width/2),t.indexOf("bottom")>=0?a-=n.height:t.indexOf("middle")>=0&&(a-=n.height/2),r&&(i+=r.x,a+=r.y),i+=document.scrollingElement.scrollLeft,a+=document.scrollingElement.scrollTop,this.displayAt(i,a)}displayCenter(e=!0){this.setClass("center",e),this._do_show()}displayAt(e,t){this.setStyle({left:e+"px",top:t+"px"}),this._do_show();let o=this.getBoundingRect(),r=window.innerWidth-16,n=window.innerHeight-16;o.right>r&&this.setStyleValue("left",r-o.width),o.bottom>n&&this.setStyleValue("top",n-o.height)}isOpen(){return this._isshown}_do_hide(){if(!this._isshown)return;if(this.__hide(),this.__remove(),this._ismodal)if(ie[ie.length-1]!=this){let t=ie.findIndex(o=>o===this);t>=0&&ie.splice(t,1)}else ie.pop(),this._hideModalMask();let e=jo.indexOf(this);if(console.assert(e>=0),jo.splice(e,1),this.props.autoClose){let t=W.indexOf(this);t>=0&&(W.splice(t,1),W.length==0&&document.removeEventListener("pointerdown",this._dismiss))}this._isshown=!1,this.fire("closed",{})}_do_show(){this._isshown||(this._isshown=!0,this.__append(),this._ismodal&&(ie.push(this),this._showModalMask()),this.__show(),this.props.autoClose&&(W.length==0&&document.addEventListener("pointerdown",this._dismiss),W.push(this),this.setData("close",this.props.autoClose===!0?q():this.props.autoClose)),jo.push(this),this.fire("opened",{}))}__show(){super.show(!0)}__hide(){super.show(!1)}__append(){Yt().appendChild(this.dom)}__remove(){Yt().removeChild(this.dom)}show(e=!0){return e?this.displayCenter():this._do_hide(),this}close(){this._do_hide()}_dismiss=s(e=>{W.some(o=>o.dom.contains(e.target))||(e.preventDefault(),e.stopPropagation(),this.dismiss())},"_dismiss");dismiss(e=!1){if(W.length==0)return;let t=this.getData("close"),o=[],r=[],n=-1;e&&(n=W.indexOf(this)),W.forEach((a,c)=>{a.getData("close")==t&&c>n?o.push(a):r.push(a)});let i=o.reverse();W=r,W.length==0&&document.removeEventListener("pointerdown",this._dismiss),i.forEach(a=>a.close())}_createSizers(){this.appendContent([new L("top"),new L("bottom"),new L("left"),new L("right"),new L("top-left"),new L("bottom-left"),new L("top-right"),new L("bottom-right")])}_showModalMask(){Qe||(Qe=new h({cls:"x4modal-mask"})),Yt().insertBefore(Qe.dom,this.dom)}_hideModalMask(){if(Qe){let e=Yt();if(ie.length){let t=ie[ie.length-1];e.insertBefore(Qe.dom,t.dom)}else e.removeChild(Qe.dom)}}};s(B,"Popup"),B=p([u("x4")],B);var Wo=class Wo{ref;delta;self;constructor(e,t){this.self=!!t,e.addDOMEvent("pointerdown",o=>{if(this.self&&o.target!=e.dom)return;e.setCapture(o.pointerId),this.ref=t!=null?t:T(e.dom.parentElement),this.delta={x:0,y:0};let r=this.ref.getBoundingRect();this.delta.x=o.pageX-r.left,this.delta.y=o.pageY-r.top}),e.addDOMEvent("pointerup",o=>{e.releaseCapture(o.pointerId),this.ref=null}),e.addDOMEvent("pointermove",o=>{this._onMouseMove(o)})}_onMouseMove(e){if(!this.ref)return;let t={x:e.pageX-this.delta.x,y:e.pageY-this.delta.y},o=this.ref.getBoundingRect(),r={};this.ref.setStyle({top:t.y+"",left:t.x+""}),e.preventDefault(),e.stopPropagation()}};s(Wo,"CMover");var Qt=Wo;var Mr=400,we=class extends h{constructor(){super({})}};s(we,"CMenuSep"),we=p([u("x4")],we);var Zt=new Be,pe=class extends h{menu;constructor(e){super({disabled:e.disabled,cls:e.cls}),e.menu&&this.addClass("popup"),this.setContent([new E({id:"icon",iconId:e.icon}),new h({id:"text",content:e.text})]),e.menu?(this.menu=e.menu,this.addDOMEvent("mouseenter",()=>this.openSub(!0)),this.addDOMEvent("click",()=>this.openSub(!1)),this.addDOMEvent("mouseleave",()=>this.closeSub()),this.menu.on("opened",()=>this.addClass("opened")),this.menu.on("closed",()=>this.removeClass("opened"))):(this.addDOMEvent("mouseenter",()=>{Zt.setTimeout("open",Mr,()=>{this.dismiss(!0)})}),this.addDOMEvent("click",()=>{this.dismiss(!1),e.click&&e.click(new Event("click"))}))}dismiss(e){let t=this.parentElement($);t&&t.dismiss(e)}openSub(e){let t=s(()=>{this.dismiss(!0);let o=this.getBoundingRect();this.menu.displayAt(o.right-4,o.top)},"open");e?Zt.setTimeout("open",Mr,t):(Zt.clearTimeout("open"),t())}closeSub(){Zt.clearTimeout("open")}};s(pe,"CMenuItem"),pe=p([u("x4")],pe);var $=class extends B{constructor(e){var o;super({...e,autoClose:"menu"}),this.addClass("x4vbox");let t=(o=e.items)==null?void 0:o.map(r=>r==="-"?new we:P(r)?new pe({text:r,click:null,cls:"title"}):r instanceof h?r:new pe(r));this.setContent(t)}};s($,"Menu"),$=p([u("x4")],$);var Pr='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512" fill="currentColor"><!--!Font Awesome Pro 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2024 Fonticons, Inc.--><path d="M9.4 256l11.3-11.3 192-192L224 41.4 246.6 64 235.3 75.3 54.6 256 235.3 436.7 246.6 448 224 470.6l-11.3-11.3-192-192L9.4 256z"/></svg>';var Dr='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" fill="currentColor"><!--!Font Awesome Pro 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2024 Fonticons, Inc.--><path d="M128 16l0-16L96 0l0 16 0 48L32 64 0 64 0 96l0 64 0 32L0 480l0 32 32 0 384 0 32 0 0-32 0-288 0-32 0-64 0-32-32 0-64 0 0-48 0-16L320 0l0 16 0 48L128 64l0-48zM32 192l384 0 0 288L32 480l0-288zm0-96l384 0 0 64L32 160l0-64zM331.3 283.3L342.6 272 320 249.4l-11.3 11.3L208 361.4l-52.7-52.7L144 297.4 121.4 320l11.3 11.3 64 64L208 406.6l11.3-11.3 112-112z"/></svg>';var Tr='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512" fill="currentColor"><!--!Font Awesome Pro 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2024 Fonticons, Inc.--><path d="M310.6 256l-11.3 11.3-192 192L96 470.6 73.4 448l11.3-11.3L265.4 256 84.7 75.3 73.4 64 96 41.4l11.3 11.3 192 192L310.6 256z"/></svg>';var Ze=class extends k{m_date;constructor(e){super(e),this.mapPropEvents(e,"change"),this.m_date=e.date?ze(e.date):new Date,this._update()}_update(){let e=ze(this.m_date);e.setDate(1);let t=e.getDay();t==0&&(t=7),e.setDate(-t+1+1);let o=ze(e),r=xe(this.m_date),n=xe(new Date),i=ze(this.m_date);i.setDate(1),i.setMonth(i.getMonth()+1),i.setDate(0);let a=xe(i),c=[],d=new b({cls:"month-sel",content:[new w({cls:"month",text:Y(this.m_date,"O"),dom_events:{click:s(()=>this._choose("month"),"click")}}),new w({cls:"year",text:Y(this.m_date,"Y"),dom_events:{click:s(()=>this._choose("year"),"click")}}),new Ve,new I({icon:Pr,click:s(()=>this._next(!1),"click")}),new I({icon:Dr,click:s(()=>this.setDate(new Date),"click"),tooltip:y.global.today}),new I({icon:Tr,click:s(()=>this._next(!0),"click")})]});c.push(d);let m=[];m.push(new b({cls:"weeknum cell"}));for(let x=0;x<7;x++)m.push(new w({cls:"cell",text:y.global.day_short[(x+1)%7]}));c.push(new b({cls:"week header",content:m}));let f=this.m_date.getMonth(),g=!0;for(;xe(o)<=a;){let x=[new b({cls:"weeknum cell",content:new h({tag:"span",content:Y(o,"w")})})];for(let v=0;v<7;v++){let N="cell day";xe(o)==r&&(N+=" selection"),xe(o)==n&&(N+=" today"),o.getMonth()!=f&&(N+=" out");let _=s(S=>new b({cls:N,flex:1,content:new h({cls:"text",content:_t(`<span>${Y(S,"d")}</span>`)}),dom_events:{click:s(()=>this.select(S),"click")}}),"mkItem");x.push(_(ze(o))),o.setDate(o.getDate()+1),g=!1}c.push(new b({cls:"week",flex:1,content:x}))}this.setContent(c)}select(e){this.m_date=e,this.fire("change",{value:e}),this._update()}_next(e){this.m_date.setMonth(this.m_date.getMonth()+(e?1:-1)),this._update()}_choose(e){var n,i,a,c;let t=[];if(e=="month")for(let d=0;d<12;d++)t.push({text:y.global.month_long[d],click:s(()=>{this.m_date.setMonth(d),this._update()},"click")});else if(e=="year"){let d=(i=(n=this.props.minDate)==null?void 0:n.getFullYear())!=null?i:1900,m=(c=(a=this.props.maxDate)==null?void 0:a.getFullYear())!=null?c:2037;for(let f=m;f>=d;f--)t.push({text:""+f,click:s(()=>{this.m_date.setFullYear(f),this._update()},"click")})}let o=new $({items:t}),r=this.getBoundingRect();o.displayAt(r.left,r.top)}getDate(){return this.m_date}setDate(e){this.m_date=e,this._update()}};s(Ze,"Calendar"),Ze=p([u("x4")],Ze);function Sr(l,e,t){let o=l;return o.width=e,o.height=t,o.smoothLine=In,o.smoothLineEx=An,o.line=Mn,o.roundRect=Pn,o.calcTextSize=Dn,o.setFontSize=Tn,o.circle=Sn,o}s(Sr,"createPainter");function In(l,e=null,t=!0){if(l.length<2)return;if(e||(e=this),l.length==2){t!==!1?e.moveTo(l[0].x,l[0].y):e.lineTo(l[0].x,l[0].y),e.lineTo(l[1].x,l[1].y);return}function o(c,d){return{x:c.x+(d.x-c.x)/2,y:c.y+(d.y-c.y)/2}}s(o,"midPointBtw");function r(c,d,m,f,g,x,v){return{x:(1-c)*(1-c)*d+2*(1-c)*c*f+c*c*x,y:(1-c)*(1-c)*m+2*(1-c)*c*g+c*c*v}}s(r,"getQuadraticXY");let n=l[0],i=l[1],a=n;e.moveTo(n.x,n.y);for(let c=1,d=l.length;c<d;c++){let m=o(n,i);for(let f=0;f<8;f++){let{x:g,y:x}=r(f/8,a.x,a.y,n.x,n.y,m.x,m.y);e.lineTo(g,x)}n=l[c],i=l[c+1],a=m}e.lineTo(n.x,n.y)}s(In,"smoothLine");function An(l,e=.5,t=10,o=null,r=!0,n=!1){let i=[];for(let _=0,S=l.length;_<S;_++)i.push(l[_].x),i.push(l[_].y);let a,c=1,d=i.length,m=0,f=(d-2)*t+2+(n?2*t:0),g=new Float32Array(f),x=new Float32Array((t+2)*4),v=4;for(a=i.slice(0),n?(a.unshift(i[d-1]),a.unshift(i[d-2]),a.push(i[0],i[1])):(a.unshift(i[1]),a.unshift(i[0]),a.push(i[d-2],i[d-1])),x[0]=1;c<t;c++){let _=c/t,S=_*_,R=S*_,F=R*2,U=S*3;x[v++]=F-U+1,x[v++]=U-F,x[v++]=R-2*S+_,x[v++]=R-S}x[v]=1,N(a,x,d),n&&(a=[],a.push(i[d-4],i[d-3],i[d-2],i[d-1]),a.push(i[0],i[1],i[2],i[3]),N(a,x,4));function N(_,S,R){for(let F=2,U;F<R;F+=2){let Pt=_[F],Dt=_[F+1],Tt=_[F+2],Jo=_[F+3],Jr=(Tt-_[F-2])*e,en=(Jo-_[F-1])*e,tn=(_[F+4]-Pt)*e,on=(_[F+5]-Dt)*e;for(U=0;U<t;U++){let St=U<<2,er=S[St],tr=S[St+1],or=S[St+2],rr=S[St+3];g[m++]=er*Pt+tr*Tt+or*Jr+rr*tn,g[m++]=er*Dt+tr*Jo+or*en+rr*on}}}s(N,"parse"),d=n?0:i.length-2,g[m++]=i[d],g[m]=i[d+1],o||(o=this);for(let _=0,S=g.length;_<S;_+=2)_==0&&r!==!1?o.moveTo(g[_],g[_+1]):o.lineTo(g[_],g[_+1])}s(An,"smoothLineEx");function Mn(l,e,t,o,r,n=1){this.save(),this.beginPath(),this.moveTo(l,e),this.lineTo(t,o),this.lineWidth=n,this.strokeStyle=r,this.stroke(),this.restore()}s(Mn,"line");function Pn(l,e,t,o,r){this.moveTo(l+r,e),this.lineTo(l+t-r,e),this.quadraticCurveTo(l+t,e,l+t,e+r),this.lineTo(l+t,e+o-r),this.quadraticCurveTo(l+t,e+o,l+t-r,e+o),this.lineTo(l+r,e+o),this.quadraticCurveTo(l,e+o,l,e+o-r),this.lineTo(l,e+r),this.quadraticCurveTo(l,e,l+r,e),this.closePath()}s(Pn,"roundRect");function Dn(l,e=!1){let t=this.measureText(l),o=t.fontBoundingBoxAscent+t.fontBoundingBoxDescent;return e?{width:Math.round(t.width),height:Math.round(o)}:{width:t.width,height:o}}s(Dn,"calcTextSize");function Tn(l){let e=Math.round(l)+"px";this.font=this.font.replace(/\d+px/,e)}s(Tn,"setFontSize");function Sn(l,e,t){this.moveTo(l+t,e),this.arc(l,e,t,0,Math.PI*2)}s(Sn,"circle");var Xe=class extends h{m_iwidth=-1;m_iheight=-1;m_scale=1;m_canvas;constructor(e){super(e),this.mapPropEvents(e,"paint"),this.addDOMEvent("resized",()=>{this._paint()}),this.m_iwidth=-1,this.m_iheight=-1,this.m_canvas=new h({tag:"canvas"}),this.setContent(this.m_canvas)}scale(e){this.m_scale=e,this.m_iwidth=-1,this.redraw()}get canvas(){return this.m_canvas}getContext(){return this.m_canvas.dom.getContext("2d")}$update_rep=0;redraw(e){e!==void 0?++this.$update_rep>=20?(this.clearTimeout("update"),this._paint()):this.setTimeout("update",e,()=>this._paint()):(this.clearTimeout("update"),this._paint())}_paint(){this.$update_rep=0;let e=this.dom;if(!this.isVisible())return;let t=e.clientWidth,o=e.clientHeight,r=this.getContext();if(t!=this.m_iwidth||o!=this.m_iheight){let n=window.devicePixelRatio||1,i=r.webkitBackingStorePixelRatio||r.mozBackingStorePixelRatio||r.msBackingStorePixelRatio||r.oBackingStorePixelRatio||r.backingStorePixelRatio||1,a=this.canvas;if(this.m_scale!=1){let c=1,d=t*c,m=o*c;a.setAttribute("width",""+d),a.setAttribute("height",""+m),a.setStyleValue("width",t),a.setStyleValue("height",o),c*=this.m_scale,r.scale(c,c)}else a.setAttribute("width",""+t),a.setAttribute("height",""+o),a.setStyleValue("width",t),a.setStyleValue("height",o),r.scale(1,1);this.m_iwidth=t,this.m_iheight=o}if(t&&o){let n=Sr(r,t,o);this.props.clear&&n.clearRect(0,0,t/this.m_scale,o/this.m_scale),n.save(),n.translate(-.5,-.5),this.paint(n),n.restore()}}paint(e){try{this.props.paint_cb?this.props.paint_cb(e):this.fire("paint",{ctx:e})}catch(t){console.assert(!1,t)}}};s(Xe,"Canvas"),Xe=p([u("x4")],Xe);var A=class extends h{constructor(e){var t;switch(super({tag:"input",...e}),this.mapPropEvents(e,"focus","change"),this.setAttribute("type",(t=e.type)!=null?t:"text"),this.setAttribute("name",e.name),e.autofocus===!0&&this.setAttribute("autofocus",!0),e.type){case"checkbox":case"radio":{let o=this.dom;o.checked=e.checked,o.value=e.value===void 0?"":e.value+"";break}case"range":{this.setAttribute("min",e.min),this.setAttribute("max",e.max),this.setAttribute("step",e.step),this.setAttribute("value",e.value);break}case"number":{let o=this.props;this.setAttribute("required",o.required),this.setAttribute("readonly",o.readonly),this.setAttribute("min",o.min),this.setAttribute("max",o.max),this.setAttribute("step",o.step),this.setNumValue(P(o.value)?parseFloat(o.value):o.value,-2),this.addDOMEvent("wheel",r=>{if(this.hasFocus()){r.preventDefault();let n=this.getNumValue(),i=r.deltaY<0?1:-1;n+=(o.step?o.step:1)*i,this.setNumValue(n,-2),this.dom.dispatchEvent(new Event("input"))}});break}case"date":{this.setAttribute("required",e.required);let o=e.value;o instanceof Date?this.setAttribute("value",Y(o,"Y-M-D")):e.value!==null&&e.value!==void 0&&this.setAttribute("value",o);break}case"file":{let o;Array.isArray(e.accept)?o=e.accept.join(","):o=e.accept,this.setAttribute("accept",o);break}case"time":{this.setAttribute("required",e.required),e.value!==null&&e.value!==void 0&&this.setAttribute("value",e.value);break}default:{this.setAttribute("required",e.required),this.setAttribute("readonly",e.readonly),e.value!==null&&e.value!==void 0&&this.setAttribute("value",e.value),e.pattern!==null&&e.pattern!==void 0&&this.setAttribute("pattern",e.pattern),e.placeholder!==null&&e.placeholder!==void 0&&this.setAttribute("placeholder",e.placeholder),e.spellcheck===!1&&this.setAttribute("spellcheck",!1),e.minlength!==void 0&&this.setAttribute("minlength",e.minlength),e.maxlength!==void 0&&this.setAttribute("maxlength",e.maxlength);break}}this.addDOMEvent("blur",o=>{this.on_focus(o,!0)}),this.addDOMEvent("focus",o=>{this.on_focus(o,!1)}),this.addDOMEvent("input",o=>{this.on_change(o)})}on_focus(e,t){let o={focus_out:t};this.fire("focus",o),o.defaultPrevented&&e.preventDefault()}on_change(e){let t={value:this.getValue()};this.fire("change",t),t.defaultPrevented&&e.preventDefault()}getValue(){return this.dom.value}setValue(e){this.dom.value=e+""}getNumValue(e){let t=parseFloat(this.getValue());return isNaN(t)&&e!==void 0?e:t}setNumValue(e,t=-1){var o;if(t==-2&&this.props.type=="number"){let r=this.props;if(r.step<1){let n=-Math.floor(Math.log10((o=r.step)!=null?o:1));return this.setValue(e.toFixed(n))}else if(r.step>1)return this.setValue(e.toFixed())}else if(t>=0)return this.setValue(e.toFixed(t));this.setValue(e+"")}getCheck(){return this.dom.checked}setCheck(e){let t=this.dom;t.checked=e}setReadOnly(e){let t=this.dom;t.readOnly=e}selectAll(){this.dom.select()}select(e,t=9999){this.dom.setSelectionRange(e,e+t)}getSelection(){let e=this.dom;return{start:e.selectionStart,length:e.selectionEnd-e.selectionStart}}isValid(){return!(this.props.required&&this.getValue()==="")}queryInterface(e){return e=="form-element"?{getRawValue:s(()=>{if(this.props.type=="checkbox")return this.getCheck();if(this.props.type=="radio"){let r=Ln(this.dom).querySelector(`input[name="${this.props.name}"]:checked`);return r?r.value:void 0}return this.getValue()},"getRawValue"),setRawValue:s(o=>{this.props.type=="checkbox"?this.setCheck(!!o):this.props.type=="radio"?this.props.value==o&&this.setCheck(!0):this.setValue(o)},"setRawValue"),isValid:s(()=>this.isValid(),"isValid")}:super.queryInterface(e)}};s(A,"Input"),A=p([u("x4")],A);function Ln(l){for(;l!=document.body;){if(T(l).queryInterface("tab-handler"))return l;l=l.parentElement}return document}s(Ln,"getRadioOwner");var Xt='data:image/svg+xml,<svg viewBox="0 0 10 7" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">%0D%0A%09<path d="M4 4.586L1.707 2.293A1 1 0 1 0 .293 3.707l3 3a.997.997 0 0 0 1.414 0l5-5A1 1 0 1 0 8.293.293L4 4.586z" fill="currentColor" fill-rule="evenodd" clip-rule="evenodd">%0D%0A%09</path>%0D%0A</svg>';var Je=class extends h{_input;constructor(e){super(e);let t=q();this.mapPropEvents(e,"change"),this.setContent([new h({cls:"inner",content:[this._input=new A({type:"checkbox",id:t,name:e.name,checked:e.checked,dom_events:{change:s(()=>this._on_change(),"change")}})]}),new w({tag:"label",text:e.label,labelFor:t,id:void 0})]),Et.load(Xt).then(o=>{this.query(".inner").dom.insertAdjacentHTML("beforeend",o)}),this.addDOMEvent("click",o=>this._on_click(o))}_on_click(e){e.target==this.dom&&(this._input.dom.click(),e.preventDefault(),e.stopPropagation())}_on_change(){this.fire("change",{value:this.getCheck()})}getCheck(){return this._input.getCheck()}setCheck(e){this._input.setCheck(e)}setLabel(e){this.query("label").setText(e)}toggle(){this.setCheck(!this.getCheck())}};s(Je,"Checkbox"),Je=p([u("x4")],Je);var Lr='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="currentColor"><!--!Font Awesome Pro 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2024 Fonticons, Inc.--><path d="M479.4 240L384 240l-16 0 0 32 16 0 95.4 0C471.6 383 383 471.6 272 479.4l0-95.4 0-16-32 0 0 16 0 95.4C129 471.6 40.4 383 32.6 272l95.4 0 16 0 0-32-16 0-95.4 0C40.4 129 129 40.4 240 32.6l0 95.4 0 16 32 0 0-16 0-95.4C383 40.4 471.6 129 479.4 240zM256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512z"/></svg>';var ye=class extends b{constructor(e){super(e);let t,o;this.setContent([t=new h({cls:"swatch"}),o=new A({type:"text",value:"",spellcheck:!1}),Ft("eyedropper")?new I({icon:Lr,click:s(()=>{new window.EyeDropper().open().then(a=>{n=new H(a.sRGBHex),r(n)})},"click")}):null]),o.addDOMEvent("input",()=>{let i=o.getValue(),a=new H(i);a.isInvalid()||(n=a,r(n))});let r=s(i=>{t.setStyleValue("backgroundColor",i.toRgbString(!1)),o.setValue(i.toRgbString(!1))},"updateColor"),n;e.color instanceof H?n=e.color:n=new H(e.color),r(n)}};s(ye,"ColorInput"),z(ye,"$cls-ns","x4"),ye=p([u("x4")],ye);var ke=class extends C{mdown=!1;irect;hsv={hue:1,saturation:1,value:1,alpha:1};color;thumb;constructor(e,t){super(e),this.setContent([this.color=new h({cls:"overlay"}),new h({cls:"overlay",style:{backgroundImage:"linear-gradient(90deg, rgb(255, 255, 255), transparent)"}}),new h({cls:"overlay",style:{backgroundImage:"linear-gradient(0deg, rgb(0, 0, 0), transparent)"}}),this.thumb=new h({cls:"thumb"})]),this.setDOMEvents({pointerdown:s(o=>this.mousedown(o),"pointerdown"),pointermove:s(o=>this.mousemove(o),"pointermove"),pointerup:s(o=>this.mouseup(o),"pointerup"),created:s(()=>this.updateThumbMarker(),"created")}),this.updateBaseColor(t)}mousedown(e){this.mdown=!0,this.irect=this.getBoundingRect(),this.setCapture(e.pointerId)}mousemove(e){if(this.mdown){let t=this.irect,r=G(e.clientX-t.left,0,t.width)/t.width,i=G(e.clientY-t.top,0,t.height)/t.height;this.hsv.saturation=r,this.hsv.value=1-i,this.updateThumbMarker(),this.fire("sat_change",{saturation:this.hsv.saturation,value:this.hsv.value})}}mouseup(e){this.mdown&&(this.releaseCapture(e.pointerId),this.mdown=!1)}updateThumbMarker(){let e=this.color.getBoundingRect();this.thumb.setStyle({left:this.hsv.saturation*e.width+"px",bottom:this.hsv.value*e.height+"px"})}updateBaseColor(e){let t=new H(0,0,0);t.setHsv(e.hue,1,1,1),this.color.setStyleValue("backgroundColor",t.toRgbString(!1))}move(e,t){switch(e){case"saturation":{this.hsv.saturation+=t,this.hsv.saturation<0?this.hsv.saturation=0:this.hsv.saturation>1&&(this.hsv.saturation=1),this.fire("sat_change",{saturation:this.hsv.saturation,value:this.hsv.value}),this.updateThumbMarker();break}case"value":{this.hsv.value+=t,this.hsv.value<0?this.hsv.value=0:this.hsv.value>1&&(this.hsv.value=1),this.fire("sat_change",{saturation:this.hsv.saturation,value:this.hsv.value}),this.updateThumbMarker();break}}}};s(ke,"Saturation"),ke=p([u("x4")],ke);var Ce=class extends C{thumb;hsv={hue:1,saturation:1,value:1,alpha:1};mdown=!1;irect;constructor(e,t){super(e),this.setContent([this.thumb=new h({cls:"thumb",left:"50%"})]),this.setDOMEvents({pointerdown:s(o=>this.mousedown(o),"pointerdown"),pointermove:s(o=>this.mousemove(o),"pointermove"),pointerup:s(o=>this.mouseup(o),"pointerup")}),this.updateHue(t)}mousedown(e){this.mdown=!0,this.irect=this.getBoundingRect(),this.setCapture(e.pointerId)}mousemove(e){if(this.mdown){let t=this.irect,r=G(e.clientX-t.left,0,t.width)/t.width;this.hsv.hue=r,this.updateHue(this.hsv),this.fire("hue_change",{hue:this.hsv.hue})}}mouseup(e){this.mdown&&(this.releaseCapture(e.pointerId),this.mdown=!1)}updateHue(e){this.hsv.hue=e.hue,this.thumb.setStyleValue("left",e.hue*100+"%")}move(e){this.hsv.hue+=e,this.hsv.hue<0?this.hsv.hue=0:this.hsv.hue>1&&(this.hsv.hue=1),this.fire("hue_change",{hue:this.hsv.hue}),this.updateHue(this.hsv)}};s(Ce,"HueSlider"),Ce=p([u("x4")],Ce);var Ee=class extends C{thumb;color;hsv={hue:1,saturation:1,value:1,alpha:1};mdown=!1;irect;constructor(e,t){super(e),this.setContent([new h({cls:"overlay checkers"}),this.color=new h({cls:"overlay color"}),this.thumb=new h({cls:"thumb",left:"50%"})]),this.setDOMEvents({pointerdown:s(o=>this._on_mousedown(o),"pointerdown"),pointermove:s(o=>this._on_mousemove(o),"pointermove"),pointerup:s(o=>this._on_mouseup(o),"pointerup")}),this.updateAlpha(),this.updateBaseColor(t)}_on_mousedown(e){this.mdown=!0,this.irect=this.getBoundingRect(),this.setCapture(e.pointerId)}_on_mousemove(e){if(this.mdown){let t=this.irect,r=G(e.clientX-t.left,0,t.width)/t.width;this.hsv.alpha=r,this.updateAlpha(),this.fire("alpha_change",{alpha:this.hsv.alpha})}}_on_mouseup(e){this.mdown&&(this.releaseCapture(e.pointerId),this.mdown=!1)}updateAlpha(){this.thumb.setStyleValue("left",this.hsv.alpha*100+"%")}updateBaseColor(e){let t=new H(0,0,0);t.setHsv(e.hue,e.saturation,e.value,1),this.color.setStyleValue("backgroundImage",`linear-gradient(90deg, transparent, ${t.toRgbString(!1)})`)}setColor(e){this.hsv=e,this.updateBaseColor(e),this.updateAlpha()}move(e){this.hsv.alpha+=e,this.hsv.alpha<0?this.hsv.alpha=0:this.hsv.alpha>1&&(this.hsv.alpha=1),this.fire("alpha_change",{alpha:this.hsv.alpha}),this.updateAlpha()}};s(Ee,"AlphaSlider"),Ee=p([u("x4")],Ee);var et=class extends k{_base;_sat;_swatch;_hue;_alpha;constructor(e){super(e),e.color instanceof H?this._base=e.color:this._base=new H(e.color);let t=this._base.toHsv();this.setAttribute("tabindex",0),this.setContent([this._sat=new ke({},t),new b({cls:"body",content:[new k({cls:"x4flex",content:[this._hue=new Ce({},t),this._alpha=new Ee({},t)]}),new C({cls:"swatch",content:[new h({cls:"overlay checkers"}),this._swatch=new h({cls:"overlay"})]})]})]),this._sat.on("sat_change",r=>{t.saturation=r.saturation,t.value=r.value,o(),this._alpha.updateBaseColor(t)}),this._hue.on("hue_change",r=>{t.hue=r.hue,this._sat.updateBaseColor(t),this._alpha.updateBaseColor(t),o()}),this._alpha.on("alpha_change",r=>{t.alpha=r.alpha,o()});let o=s(()=>{this._base.setHsv(t.hue,t.saturation,t.value,t.alpha),this._swatch.setStyleValue("backgroundColor",this._base.toRgbString()),this._swatch.setAttribute("tooltip",this._base.toRgbString()),this.fire("change",{color:this._base})},"updateColor");Ft("eyedropper")&&this._swatch.addDOMEvent("click",r=>{new window.EyeDropper().open().then(i=>{t=new H(i.sRGBHex).toHsv(),this._alpha.setColor(t),this._sat.updateBaseColor(t),this._hue.updateHue(t),o()})}),this.addDOMEvent("keydown",r=>this._onkey(r)),o()}_onkey(e){switch(e.key){case"ArrowLeft":{e.ctrlKey?this._hue.move(-.01):this._sat.move("saturation",-.01);break}case"ArrowRight":{e.ctrlKey?this._hue.move(.01):this._sat.move("saturation",.01);break}case"ArrowUp":{e.ctrlKey?this._alpha.move(.01):this._sat.move("value",.01);break}case"ArrowDown":{e.ctrlKey?this._alpha.move(-.01):this._sat.move("value",-.01);break}}}};s(et,"ColorPicker"),et=p([u("x4")],et);var se=class extends h{constructor(e){super(e)}};s(se,"Viewport"),se=p([u("x4")],se);var J=class extends h{constructor(e){super(e),this.setContent(new se({}))}getViewport(){return this.firstChild()}};s(J,"ScrollView"),J=p([u("x4")],J);var ue=class extends h{_view;_lastsel;_multisel;_items;preventFocus=!1;constructor(e){super({...e}),this.setAttribute("tabindex",0),this.mapPropEvents(e,"dblClick","selectionChange","contextMenu");let t=new J({cls:"body"});this._view=t.getViewport(),this._multisel=new Set,this._items=[],e.footer&&e.footer.setAttribute("id","footer"),e.header&&e.header.setAttribute("id","header"),this.setContent([e.header?e.header:null,t,e.footer]),this.setDOMEvents({click:s(o=>this._on_click(o),"click"),keydown:s(o=>this._on_key(o),"keydown"),dblclick:s(o=>this._on_click(o),"dblclick"),contextmenu:s(o=>this._on_ctx_menu(o),"contextmenu")}),e.items&&this.setItems(e.items)}_on_key(e){if(!this.isDisabled()){switch(e.key){case"ArrowDown":{this.navigate(4);break}case"ArrowUp":{this.navigate(1);break}case"Home":{this.navigate(0);break}case"End":{this.navigate(5);break}default:return}e.preventDefault(),e.stopPropagation()}}navigate(e){this._lastsel||(e==4?e=0:e=5);let t=s((o,r)=>{for(;o&&!o.isVisible();)o=r?o.nextElement():o.prevElement();return o},"next_visible");if(e==0||e==5){let o=e==0?this._view.firstChild():this._view.lastChild();if(o=t(o,e==0),o){let r=o.getInternalData("id");return this._selectItem(r,o,"single"),!0}}else{let o=this._itemWithID(this._lastsel),r=e==4?o.nextElement():o.prevElement();if(r=t(r,e==4),r){let n=r.getInternalData("id");return this._selectItem(n,r,"single"),!0}}return!1}_itemWithID(e){return this._view.enumChildComponents(!1).find(o=>o.getInternalData("id")===e)}_on_click(e){let t=e.target;for(;t&&t!=this.dom;){let o=T(t);if(o.dom.tagName==="INPUT")return;if(o&&o.hasClass("x4item")){let r=o.getInternalData("id"),n={context:r};e.type=="click"?this.fire("click",n):this.fire("dblClick",n),n.defaultPrevented||this._selectItem(r,o,e.ctrlKey?"toggle":"single");return}t=t.parentElement}this.clearSelection(),e.stopImmediatePropagation(),e.preventDefault()}_on_ctx_menu(e){e.preventDefault();let t=e.target;for(;t&&t!=this.dom;){let o=T(t);if(o&&o.hasClass("x4item")){let r=o.getInternalData("id");this._selectItem(r,o,"single"),this.fire("contextMenu",{uievent:e,context:r});return}t=t.parentElement}this.fire("contextMenu",{uievent:e,context:null})}_selectItem(e,t,o){if(this.props.multisel||(o="single"),this._lastsel=e,o=="single"){if(this._multisel.has(e))return;this._clearSelection(),t&&(this._multisel.add(e),t.addClass("selected"))}else t&&(this._multisel.has(e)?(t.removeClass("selected"),this._multisel.delete(e)):(this._multisel.add(e),t.addClass("selected")));t&&t.scrollIntoView({behavior:"smooth",block:"nearest"}),this.fire("selectionChange",{selection:this.getSelection(),empty:this._multisel.size==0})}getItem(e){return this._items.find(t=>t.id===e)}select(e,t=!0){if(Q(e)||(e=[e]),!e.length){this._multisel.size&&(t?this.clearSelection():this._clearSelection());return}if(e.some(o=>!this._multisel.has(o))){this._clearSelection();let o=this._view.enumChildComponents(!1);e.forEach(r=>{let n=o.find(i=>i.getInternalData("id")===r);n&&(this._multisel.add(r),n.addClass("selected"))}),t&&this.fire("selectionChange",{selection:this.getSelection(),empty:this._multisel.size==0})}}_findItemIndex(e){return this._items.findIndex(t=>t.id==e)}_clearSelection(){let e=this._view.enumChildComponents(!1);this._multisel.size&&Array.from(this._multisel).forEach(o=>{let r=e.find(n=>n.getInternalData("id")===o);r&&r.removeClass("selected")}),this._multisel.clear()}clearSelection(){this._multisel.size&&(this._clearSelection(),this.fire("selectionChange",{selection:[],empty:!0}))}setItems(e,t=!1){let o=this.getSelection();this.clearSelection(),this._view.clearContent(),this._items=e!=null?e:[];let r=!1;if(this._items.length){let n=e.map(i=>this.renderItem(i));this._view.setContent(n),t?this.select(o):r=!0}else r=!0;r&&this.setTimeout("sel",100,()=>{this.fire("selectionChange",{selection:[],empty:!0})})}renderItem(e){var r;let o=((r=this.props.renderer)!=null?r:this.defaultRenderer)(e);return o.addClass("x4item"),o.setInternalData("id",e.id),o}defaultRenderer(e){return new b({cls:e.cls,content:new w({icon:e.iconId,text:e.text})})}filter(e){let t=this._view.enumChildComponents(!1);if(!e)t.forEach(o=>o.show(!0));else{let o;if(e instanceof RegExp){let r=e;o=new Set(this._items.filter(n=>r.test(n.text)).map(n=>n.id))}else{let r=e.toUpperCase();o=new Set(this._items.filter(n=>n.text.toUpperCase().includes(r)).map(n=>n.id))}t.forEach(r=>{r.show(o.has(r.getInternalData("id")))})}}appendItem(e,t=!1,o=!0){o&&this._clearSelection();let r=this.renderItem(e);t?(this._items.unshift(e),this._view.prependContent(r)):(this._items.push(e),this._view.appendContent(r)),o&&this._selectItem(e.id,r,"single")}updateItem(e,t){let o=this._findItemIndex(e);if(o<0)return;let r=!1;this._multisel.has(e)&&(r=!0),this._items[o]=t;let n=this._itemWithID(t.id);if(n!=null&&n.dom){let i=this.renderItem(t);r&&i.addClass("selected"),this._view.dom.replaceChild(i.dom,n.dom)}}getSelection(){return Array.from(this._multisel)}};s(ue,"Listbox"),ue=p([u("x4")],ue);var Rr='data:image/svg+xml,<svg viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">%0D%0A%09<path d="M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z" fill="currentColor" fill-rule="evenodd" clip-rule="evenodd">%0D%0A%09</path>%0D%0A</svg>';var Ie=class extends B{_list;constructor(e,t){super(e),this._list=new ue({items:e.items}),this.setContent(this._list),this.addDOMEvent("mousedown",o=>{console.log("trap"),o.stopImmediatePropagation(),o.stopPropagation(),o.preventDefault()},!0),this._list.on("selectionChange",o=>{this.fire("selectionChange",o)})}getList(){return this._list}};s(Ie,"DropdownList"),Ie=p([u("x4")],Ie);var tt=class extends h{_popup;_input;_button;_prevent_close=!1;_edit;constructor(e){super(e);let t=q();this.mapPropEvents(e,"selectionChange");let o=e.readonly!==!1;this.setContent([new b({id:"label",content:new w({tag:"label",text:e.label,labelFor:t,width:e.labelWidth})}),this._edit=new b({id:"edit",content:[this._input=new A({id:t,type:"text",value:"",readonly:o,required:e.required}),this._button=new I({icon:Rr,tabindex:-1})]})]),e.name&&this.setAttribute("name",e.name),e.required&&this.setAttribute("required",!0),this._popup=new Ie({items:e.items});let r=this._popup.getList(),n=s(i=>{let a=r.getItem(i);a&&r.select(i,!1),this._input.setValue(a?a.text:""),this._prevent_close||this._popup.show(!1)},"_select");this._popup.on("selectionChange",i=>{let[a]=i.selection;a!==void 0&&(n(a),this.fire("selectionChange",i))}),e.value&&n(e.value),this._button.addDOMEvent("click",()=>this._on_click()),this._input.addDOMEvent("input",()=>this._on_input()),this._input.addDOMEvent("keydown",i=>this._on_key(i)),this.setDOMEvents({focusout:s(()=>this._on_focusout(),"focusout"),click:s(()=>this._on_click(),"click")})}_on_key(e){switch(e.key){case"Enter":case"Escape":{this._popup.show(!1);break}case"ArrowUp":this._prevent_close=!0,this._popup.isOpen()?this._popup.getList().navigate(1):this.showDropDown(),this._prevent_close=!1;break;case"ArrowDown":this._prevent_close=!0,this._popup.isOpen()?this._popup.getList().navigate(4):this.showDropDown(),this._prevent_close=!1;break;default:return}e.preventDefault(),e.stopPropagation()}_on_input(){this._popup.isOpen()||this.showDropDown(),this._popup.getList().filter(this._input.getValue())}_on_focusout(){this._popup.show(!1)}_on_click(){this.showDropDown()}showDropDown(){if(this.isDisabled())return;let e=this._edit.getBoundingRect();this._popup.setStyleValue("minWidth",e.width+"px"),this._popup.displayNear(e,"top left","bottom left",{x:0,y:6})}setItems(e){this._getList().setItems(e)}getValue(){return this._input.getValue()}setValue(e){this._input.setValue(e)}selectItem(e){this._getList().select(e)}getSelection(){let[e]=this._getList().getSelection();return e}_getList(){return this._popup.getList()}queryInterface(e){return e=="form-element"?{getRawValue:s(()=>this.getSelection(),"getRawValue"),setRawValue:s(o=>{this.selectItem(o)},"setRawValue"),isValid:s(()=>this._input.isValid(),"isValid")}:super.queryInterface(e)}getInput(){return this._input}};s(tt,"Combobox"),tt=p([u("x4")],tt);var K=class extends C{validator;constructor(e){super({tag:"form",...e}),e.flex===!1&&this.addClass("no-flex"),e.autoComplete!==void 0&&this.setAutoComplete(e.autoComplete)}_get_inputs(){return this.queryAll("[name]")}setValues(e){this._get_inputs().forEach(o=>{let r=o.queryInterface("form-element");if(r){let n=o.getAttribute("name");Object.prototype.hasOwnProperty.call(e,n)&&r.setRawValue(e[n])}})}getValues(){let e={};return this._get_inputs().forEach(o=>{let r=o.queryInterface("form-element");if(r){let n=o.getAttribute("name");e[n]=r.getRawValue()}}),e}setAutoComplete(e=!0){this._get_inputs().forEach(o=>{o.setAttribute("autocomplete",e?"on":"off")})}setValidator(e){this.validator||(this.validator=e,this.addDOMEvent("focusout",()=>this.validate()))}validate(){let e=this._get_inputs(),t={},o=!0;for(let r of e){let n=r.queryInterface("form-element");if(n){let i=r.getAttribute("name");t[i]=n.getRawValue(),n.isValid()||(o=!1)}}if(this.validator){let r={...t};if(!this.validator(r,o))return null;for(let n in t)r[n]!=t[n]&&this.query(`input[${n}"]`).queryInterface("form-element").setRawValue(r[n]);t=r}else o||(t=null);return t}};s(K,"Form"),K=p([u("x4")],K);var Fr='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512" fill="currentColor"><!--!Font Awesome Pro 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2024 Fonticons, Inc.--><path d="M192 233.4L59.5 100.9 36.9 123.5 169.4 256 36.9 388.5l22.6 22.6L192 278.6 324.5 411.1l22.6-22.6L214.6 256 347.1 123.5l-22.6-22.6L192 233.4z"/></svg>';var ee=class extends B{form;_title;constructor(e){super({tag:"dialog",modal:!0,...e}),this._ismodal=this.props.modal,this.mapPropEvents(e,"btnclick"),this.appendContent([new b({cls:"caption",content:[this._title=new w({id:"title",cls:"caption-element",icon:e.icon,text:e.title}),e.closable?new I({id:"closebox",icon:Fr,tabindex:-1,click:s(()=>{P(e.closable)?this.fire("btnclick",{button:e.closable}):this.close()},"click")}):null]}),this.form=e.form?e.form:new K({}),new he({id:"btnbar",reverse:!0,items:e.buttons,btnclick:s(t=>{this.fire("btnclick",t)},"btnclick")})]),this.addDOMEvent("keydown",t=>{if(t.key=="Escape")t.preventDefault(),t.stopPropagation();else if(t.key=="Enter"){let o=this.query("button.default");o&&(t.preventDefault(),t.stopPropagation(),o.click())}})}focusNext(e){let t=zt(this.dom);if(t.length){let o=t[0],r=t[t.length-1],n=document.activeElement,i;if(!e&&n===o)i=r;else if(e&&n===r)i=o;else{let a=t.indexOf(n);e?i=t[a+1]:i=t[a-1]}return i?(i.focus(),!0):!1}else return!1}setContent(e){this.dom.replaceChild(this.form.dom,e.dom),this.form=e}getForm(){return this.form}getValues(){return this.form.getValues()}getButton(e){return this.getBtnBar().getButton(e)}queryInterface(e){return e=="tab-handler"?{focusNext:s(o=>this.focusNext(o),"focusNext")}:super.queryInterface(e)}setTitle(e){this._title.setText(e)}getBtnBar(){return this.query("#btnbar")}};s(ee,"Dialog"),ee=p([u("x4")],ee);var Br='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--!Font Awesome Free 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M144 480C64.5 480 0 415.5 0 336c0-62.8 40.2-116.2 96.2-135.9c-.1-2.7-.2-5.4-.2-8.1c0-88.4 71.6-160 160-160c59.3 0 111 32.2 138.7 80.2C409.9 102 428.3 96 448 96c53 0 96 43 96 96c0 12.2-2.3 23.8-6.4 34.6C596 238.4 640 290.1 640 352c0 70.7-57.3 128-128 128l-368 0zm79-217c-9.4 9.4-9.4 24.6 0 33.9s24.6 9.4 33.9 0l39-39L296 392c0 13.3 10.7 24 24 24s24-10.7 24-24l0-134.1 39 39c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-80-80c-9.4-9.4-24.6-9.4-33.9 0l-80 80z"/></svg>';var $o=class $o extends h{constructor(e){var t;super({tag:"input",style:{display:"none"},attrs:{type:"file",multiple:(t=e.multiple)!=null?t:!1,accept:e.accept},dom_events:{change:s(()=>{let o=this.dom.files;e.callback(o)},"change")}})}showDialog(){this.dom.click()}};s($o,"FileDialog");var It=$o,ot=class extends k{constructor(e){var o,r;super(e),this.mapPropEvents(e,"change");let t=new It({accept:e.accept,multiple:e.multiple,callback:s(n=>{this.fire("change",{files:n})},"callback")});this.setContent([t,new E({iconId:(o=e.icon)!=null?o:Br}),new V({text:(r=e.label)!=null?r:y.global.filedrop})]),this.setAttribute("tabIndex",0),this.addDOMEvent("click",()=>t.showDialog()),this.addDOMEvent("keydown",n=>{n.key==" "&&t.showDialog()}),jt.registerDropTarget(this,async(n,i,a)=>{if(n=="enter")this.addClass("hit");else if(n=="leave")this.removeClass("hit");else if(n=="drop"&&a.data.files&&a.data.files.length>0){let c=a.data.files;this.fire("change",{files:c})}})}};s(ot,"FileDrop"),ot=p([u("x4")],ot);var Vn=["#01d266","#7cd901","#ffc701","#ff9e01","#ff2e49"],dp=["var(--gauge-base-color)"],rt=class extends h{pos;stops;uppos;constructor(e){var t;super(e),this.pos=70,this.stops=[],this.setColorStops((t=e.colors)!=null?t:Vn),this.addDOMEvent("resized",()=>this.update(10)),this.update()}setRange(e,t){this.props.min=e,this.props.max=t,this.update()}setPos(e){e!=this.pos&&(this.pos=e,this.uppos&&this.uppos())}setColorStops(e){!e||!e.length||(this.stops=e,this.update())}update(e=1){let t=s(()=>{let o=new Ue,r=this.getBoundingRect(),n=r.width,i=Math.min(n,r.height),a=180/this.stops.length,c=-90,d=mr({left:0,top:0,width:n,height:i/2},r,15),m=d.height;for(let v of this.stops)o.path().arc(d.left+d.width/2,d.top+d.height,m,c,c+a,!0).fill("none").stroke(v,20),c+=a;this.pos<this.props.min&&(this.pos=this.props.min),this.pos>this.props.max&&(this.pos=this.props.max);let f=d.left+d.width/2,g=o.path().moveTo(f,d.top+d.height-4).lineTo(f-m+4,d.top+d.height-2).lineTo(f-m+4,d.top+d.height+2).lineTo(f,d.top+d.height+4).closePath().addClass("needle");o.circle(d.left+d.width/2,d.top+d.height,Math.min(n/20,i/20)).addClass("needle-dot"),this.setContent(new qe({id:"",svg:o,viewbox:`0 0 ${r.width} ${r.height}`}));let x=s(()=>{this.pos<this.props.min&&(this.pos=this.props.min),this.pos>this.props.max&&(this.pos=this.props.max);let v=(this.pos-this.props.min)/(this.props.max-this.props.min);g.clear_transform(),g.rotate(v*180,d.left+d.width/2,d.top+d.height)},"render_needle");x(),this.uppos=x},"render");this.setTimeout("render",e,t)}};s(rt,"Gauge"),rt=p([u("x4")],rt);var me=class extends h{_img;constructor(e){var t;if(super(e),this._img=new h({tag:"img",attrs:{loading:e.lazy,alt:e.alt,draggable:(t=e.draggable)!=null?t:!1},style:{width:"100%",height:"100%",objectFit:e.fit,objectPosition:e.position}}),this.setContent(this._img),this.setImage(e.src),e.candrop){this.mapPropEvents(e,"change","clear");let o=new It({accept:e.accept,multiple:!1,callback:s(n=>{this.fire("change",{files:n})},"callback")});this.appendContent(o),this.addDOMEvent("click",()=>o.showDialog());let r=s((n,i)=>{var a;if((a=i.items)!=null&&a.length){let c=i.items[0].type;if(/image\/.*/.test(c))return!0}return!1},"filterInput");jt.registerDropTarget(this,async(n,i,a)=>{if(n=="enter")this.addClass("hit");else if(n=="leave")this.removeClass("hit");else if(n=="drop"&&a.data.files&&a.data.files.length>0){let c=a.data.files;this.fire("change",{files:c})}},r),this.addDOMEvent("contextmenu",n=>{new $({items:[{text:y.global.cut,click:s(()=>{this.fire("clear",{})},"click")}]}).displayAt(n.pageX,n.pageY),n.stopPropagation(),n.preventDefault()})}}setImage(e){e?this._img.setAttribute("src",e):this.clear()}setBase64(e,t){this.setImage("data:"+e+";base64,"+t)}clear(){this._img.setAttribute("src","data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==")}};s(me,"Image"),me=p([u("x4")],me);var At=200,nt=class extends h{_dataview;_datamodel;_columns;_lock;_dirty;_row_height;_left;_top;_body;_viewport;_fheader;_hheader;_vheader;_ffooter;_footer;_vis_rows;_start;_end;_selection;_num_fmt=new Intl.NumberFormat("fr-FR");_mny_fmt=new Intl.NumberFormat("fr-FR",{style:"currency",currency:"EUR"});_dte_fmt=new Intl.DateTimeFormat("fr-FR",{});_has_fixed;_has_footer;constructor(e){super(e),this._lock=0,this._dirty=0,this._row_height=32,this._left=0,this._top=0,this._vis_rows=new Map,this._selection=new Set,this._has_fixed=!1,this._has_footer=e.footer,this._columns=e.columns.map(t=>t),this.mapPropEvents(e,"click","dblClick","contextMenu","selectionChange"),this.lock(!0),this.setAttribute("tabindex",0),this.addDOMEvent("created",()=>{this._init(),this._dirty=1,this.lock(!1)}),this.addDOMEvent("resized",()=>{this._updateFlexs(),this._computeFullSize(),this._update(!0)}),this.addDOMEvent("keydown",t=>{this._on_key(t)}),e.store&&this.setStore(e.store)}_on_key(e){if(!this.isDisabled()){switch(e.key){case"ArrowDown":{this.navigate(4);break}case"ArrowUp":{this.navigate(1);break}case"Home":{this.navigate(0);break}case"End":{this.navigate(5);break}case"PageDown":{this.navigate(2);break}case"PageUp":{this.navigate(3);break}default:return}e.preventDefault(),e.stopPropagation()}}navigate(e){if(this._selection.size||(e==4||e==2?e=0:e=5),e==0||e==5){let t=e==0?0:this._dataview.getCount()-1;return this._clearSelection(),this._addSelection(t),this._scrollToIndex(t),!0}else if(e==1||e==4){let t=this._selection.values().next().value,o=e==4?t+1:t-1;if(o>=0&&o<this._dataview.getCount())return this._clearSelection(),this._addSelection(o),this._scrollToIndex(o),!0}else if(e==2||e==3){let t=this._vis_rows.size,o=this._selection.values().next().value,r=e==2?t:-t,n=o+r;if(n<0?n=0:n>=this._dataview.getCount()&&(n=this._dataview.getCount()-1),n!=o)return this._clearSelection(),this._addSelection(n),this._dataview.getCount()<At&&(r*=this._row_height),this._viewport.dom.scrollBy(0,r),!0}return!1}_scrollToIndex(e,t="nearest"){let o=this.queryAll(`.row[data-row="${e}"]`);if(o.length)o.forEach(r=>{r.scrollIntoView({block:t})});else{let r=e;this._dataview.getCount()<At&&(r*=this._row_height),this._viewport.dom.scrollTo(0,r)}}setStore(e){let t=s(o=>{this._viewport&&(o.change_type=="change"&&this._selection.clear(),this._updateFlexs(),this._computeFullSize(),this._update(!0))},"on_change");this._dataview&&this._dataview.off("view_change",t),e?(this._dataview=new yt({store:e}),this._datamodel=e.getModel(),this._dataview.on("view_change",t)):(this._dataview=null,this._datamodel=null)}getView(){return this._dataview}lock(e){e?this._lock++:--this._lock==0&&this._dirty&&this._update(!0)}_getColCount(){return this._columns.length}_getCol(e){return this._columns[e]}_buildColHeader(e){var n;let t=[],o=this._getColCount();for(let i=0;i<o;i++){let a=this._getCol(i);if(!!a.fixed!=e)continue;let c=new L("right");c.on("stop",()=>{this._updateFlexs()}),c.on("resize",m=>{a.width=m.size,a.flex=0,this.queryAll(`[data-col="${i}"]`).forEach(x=>{x.setStyleValue("width",m.size+"px")});let g=r.getBoundingRect();e?this.setStyleVariable("--fixed-width",g.width+"px"):this._body.setStyleValue("width",g.width+"px")});let d=new h({cls:"cell",attrs:{"data-col":i},style:{width:a.width?a.width+"px":void 0},content:[new V({text:a.title,align:(n=a.header_align)!=null?n:"left"}),new h({cls:"sorter"}),c]});d.addDOMEvent("touchend",()=>{let m=d.getInternalData("touchend"),f=Date.now(),g=m?f-m:0;g>30&&g<300?this._sortCol(i):d.setInternalData("touchend",f)}),d.addDOMEvent("dblclick",()=>{this._sortCol(i)}),t.push(d)}if(e&&t.length==0)return null;let r=new C({cls:"col-header",content:t});return r.setClass("fixed",e),r}_buildColFooter(e){let t=[],o=this._getColCount();for(let n=0;n<o;n++){let i=this._getCol(n);if(!!i.fixed!=e)continue;let a=new h({cls:"cell",attrs:{"data-col":n},style:{width:i.width?i.width+"px":void 0},content:[new V({text:i.footer_val})]});a.addDOMEvent("dblclick",()=>{this._sortCol(n)}),t.push(a)}if(e&&t.length==0)return null;let r=new C({cls:"col-footer",content:t});return r.setClass("fixed",e),r}_sortCol(e,t){this.setTimeout("sort",50,()=>{let o=!0,r=this.query(`.col-header .cell[data-col="${e}"]`);if(!r)return;t===void 0?r.hasClass("sorted")?r.hasClass("desc")?o=!0:o=!1:this.queryAll(".sorted").forEach(c=>c.removeClass("sorted asc desc")):o=t,r.setClass("sorted"),r.setClass("desc",!o);let n=this._getCol(e),i=!1;switch(n.type){case"checkbox":case"money":case"number":case"percent":i=!0}ro(!0),this._dataview.sort([{field:n.id,ascending:o,numeric:i}]),this._update(!0),ro(!1)})}sortCol(e,t){let o=this._columns.findIndex(r=>r.id===e);o>=0&&this._sortCol(o,t)}_renderCell(e,t,o){let r=t.id,n=t.type,i=this._datamodel.getRaw(r,e);if(i==null)return null;let a="";if(t.classifier&&o.push(t.classifier(i,e,r)),i instanceof Function)return i(e,r);if(t.formatter)return t.formatter(i);switch(n){case"checkbox":return i?new E({cls:"cell-check"+a,iconId:Xt}):void 0;case"image":return P(i)?new me({cls:a,src:i,fit:"scale-down"}):void 0;case"number":{if(!O(i))return"NaN";i=this._num_fmt.format(i);break}case"money":{if(!O(i))return"NaN";i=this._mny_fmt.format(i);break}case"percent":return new C({cls:"percent"+a,content:new h({cls:"bar",width:i+"%"})});case"icon":return new E({cls:a,iconId:i+""});case"date":{i=this._dte_fmt.format(i);break}default:{i=i+"";break}}return new h({tag:"span",cls:a,content:i})}_buildRow(e,t,o){let r=[],n=this._getColCount();for(let a=0;a<n;a++){let c=this._getCol(a);if(c.fixed)continue;let d=[],m=this._renderCell(t,c,d),f="start";switch(c.align){default:f="start";break;case"center":f="center";break;case"right":f="end";break}let g=new h({cls:"cell",style:{width:c!=null&&c.width?c.width+"px":void 0,justifyContent:f},content:m});d.length&&g.addClass(d.join(" ")),c.type&&g.addClass(c.type),g.setData("col",a+""),g.setData("row",e+""),r.push(g)}let i=new C({cls:"row",style:{top:o.toFixed(2)+"px"},content:r});return i.setData("row",e+""),this._selection.has(e)&&i.addClass("selected"),i}_buildRowHeader(e,t,o){let r=[],n=this._getColCount();for(let a=0;a<n;a++){let c=this._getCol(a);if(!(c!=null&&c.fixed))continue;let d=this._renderCell(t,c.id,[c.type]),m="start";switch(c.align){default:m="start";break;case"center":m="center";break;case"right":m="end";break}let f=new h({cls:"cell",style:{width:c!=null&&c.width?c.width+"px":void 0,justifyContent:m},content:d});c.type&&f.addClass(c.type),f.setData("col",a+""),f.setData("row",e+""),r.push(f)}let i=new C({cls:"row",style:{top:o+"px"},content:r});return i.setData("row",e+""),this._selection.has(e)&&i.addClass("selected"),i}_updateFlexs(){let e=0,t=0,o=this._getColCount();for(let r=0;r<o;r++){let n=this._getCol(r);!n.fixed&&n.flex?t+=n.flex:e+=n.width}if(t){let i=(this._viewport.dom.clientWidth-e)/t;for(let a=0;a<o;a++){let c=this._getCol(a);!c.fixed&&c.flex&&(c.width=Math.max(c.flex*i,32),this.queryAll(`[data-col="${a}"]`).forEach(m=>{m.setStyleValue("width",c.width+"px")}))}}}_computeFullSize(){let e=0,t=0,o=this._getColCount();for(let i=0;i<o;i++){let a=this._getCol(i),c=0;a.fixed&&(this._has_fixed=!0),a.width&&(c+=a.width),a.fixed?t+=c:e+=c}let r=this._dataview?this._dataview.getCount():0,n=r;if(r<At)n*=this._row_height;else{let a=this._body.dom.parentElement.clientHeight/this._row_height;n=r-Math.floor(a)+a*this._row_height}this.setStyleVariable("--fixed-width",t+"px"),this._body.setStyleValue("height",n+"px"),this._body.setStyleValue("width",e+"px"),this._vheader.setStyleValue("height",n+"px")}_init(){this._body=new h({cls:"body"}),this._viewport=new se({content:this._body}),this._has_footer||this.setStyleVariable("--footer-height","0"),this._viewport.addDOMEvent("scroll",t=>{this._left=this._viewport.dom.scrollLeft,this.setStyleVariable("--left",-this._left+"px"),this._top=this._viewport.dom.scrollTop,this.setStyleVariable("--top",-this._top+"px"),this._update()}),this.addDOMEvent("wheel",t=>{if(t.deltaY&&this._dataview&&this._dataview.getCount()>=At&&(this._viewport.dom.scrollBy(0,t.deltaY<0?-1:1),t.stopPropagation(),t.preventDefault()),this._has_fixed&&t.deltaY){let o=t.target;for(;o!=this.dom;){if(o==this._vheader.dom){this._viewport.dom.scrollBy(0,t.deltaY<0?-this._row_height:this._row_height),t.stopPropagation(),t.preventDefault();break}o=o.parentNode}}});let e=s(t=>{let o=h.parentElement(t.target,h);for(;o&&!o.hasClass("row");)o=o.parentElement();if(o)return o.getIntData("row")},"targetRow");this.addDOMEvent("click",t=>{let o=e(t);o!==void 0&&(this._selection.has(o)||(this._clearSelection(),this._addSelection(o)))}),this.addDOMEvent("dblclick",t=>{let o=e(t);if(o!==void 0){this._selection.has(o)||(this._clearSelection(),this._addSelection(o)),this._on_dblclk(t,o);let r=this._dataview.getByIndex(o);this.fire("dblClick",{context:r})}}),this.addDOMEvent("contextmenu",t=>{let o=e(t);if(o!==void 0){this._selection.has(o)||(this._clearSelection(),this._addSelection(o));let r=this._dataview.getByIndex(o);this.fire("contextMenu",{uievent:t,context:r})}t.preventDefault(),t.stopPropagation()}),this.addDOMEvent("mouseover",t=>{if(!this._has_fixed)return;let o=h.parentElement(t.target,h);for(;o&&!o.hasClass("row");)o=o.parentElement();if(o){let r=o.getData("row");this.queryAll(".hover").forEach(n=>n.removeClass("hover")),r&&this.queryAll(`.row[data-row="${r}"]`).forEach(i=>i.addClass("hover"))}}),this.addDOMEvent("mouseleave",t=>{this._has_fixed&&this.queryAll(".hover").forEach(o=>o.removeClass("hover"))}),this._updateFlexs(),this._fheader=this._buildColHeader(!0),this._hheader=this._buildColHeader(!1),this._vheader=new C({cls:"row-header"}),this._has_footer&&(this._ffooter=this._buildColFooter(!0),this._footer=this._buildColFooter(!1)),this.setContent([this._viewport,this._fheader,this._hheader,this._ffooter,this._footer,this._vheader]);{let t=this.getStyleVariable("--row-height");this._row_height=parseInt(t)}this._computeFullSize()}_on_dblclk(e,t){}_update(e=!1){if(!this._lock){let t=this.getBoundingRect(),o=this._dataview?this._dataview.getCount():0,r=o<At?this._row_height:1,n=Math.floor(this._top/r),i=n+Math.ceil(t.height/this._row_height),a=this._has_fixed;if(this._start!=n||this._end!=i||e){let c=[],d=[];e&&this._vis_rows.clear();let m=new Map,f=n*r;for(let g=n;g<i&&g<o;g++,f+=this._row_height){let x=this._vis_rows.get(g),v=this._dataview.getByIndex(g);a?(x?(x.h.setStyleValue("top",f+"px"),x.r.setStyleValue("top",f+"px")):x={h:this._buildRowHeader(g,v,f),r:this._buildRow(g,v,f)},d.push(x.h)):x?x.r.setStyleValue("top",f+"px"):x={h:null,r:this._buildRow(g,v,f)},c.push(x.r),m.set(g,x)}a&&d.push(new h({cls:"cell-out",style:{top:f+"px"}})),this._vis_rows=m,this._start=n,this._end=i,this._body.setContent(c),a?(this._vheader.removeClass("@hidden"),this._vheader.setContent(d)):this._vheader.addClass("@hidden")}}}_clearSelection(){for(let e of this._selection.keys())this.queryAll(`.row[data-row="${e}"]`).forEach(o=>{o.removeClass("selected")});this._selection.clear()}_addSelection(e){this._selection.add(e),this.queryAll(`.row[data-row="${e}"]`).forEach(r=>{r.addClass("selected")});let o=this._dataview.getByIndex(e);this.fire("selectionChange",{selection:[o],empty:!1})}getSelection(){return this._selection.size==0?null:[...this._selection.values()].map(t=>this._dataview.getByIndex(t))}getFirstSel(){if(this._selection.size==0)return null;let e=this._selection.values().next().value;return this._dataview.getByIndex(e)}selectItem(e){let t=this._dataview.indexOfId(e);t>=0&&this._addSelection(t)}};s(nt,"Gridview"),nt=p([u("x4")],nt);var it=class extends b{_els;_vwp;constructor(e){var t;super(e),this._els=(t=e.items)==null?void 0:t.map(o=>{let r=new w({cls:"cell",text:o.title,icon:o.iconId}),n=new L("right");return o.width>0?(r.setStyleValue("width",o.width+"px"),r.setInternalData("width",o.width)):o.width<0?r.setInternalData("flex",-o.width):r.setInternalData("width",0),n.addDOMEvent("dblclick",i=>{r.setInternalData("flex",1),this._calc_sizes()}),n.on("resize",i=>{r.setInternalData("flex",0),r.setInternalData("width",i.size),this._calc_sizes()}),r.appendContent(n),r.setInternalData("data",o),r}),this.addDOMEvent("resized",()=>this._on_resize()),this.addDOMEvent("created",()=>this._calc_sizes()),this._vwp=new b({content:this._els}),this.setContent(this._vwp)}_calc_sizes(){let e=0,t=0;this._els.forEach(a=>{let c=a.getInternalData("flex");if(c)e+=c;else{let d=a.getInternalData("width");if(d==0){let m=a.getBoundingRect();d=Math.ceil(m.width)+2,a.setInternalData("width",d)}t+=d}});let r=this.getBoundingRect().width-t-10,n=Math.ceil(r/e),i=0;this._els.forEach(a=>{var f;let c=0,d=a.getInternalData("flex");d?(c=Math.min(n*d,r),r-=c):c=a.getInternalData("width"),a.setWidth(c);let m=a.getInternalData("data");(f=this.props.target)==null||f.setStyleVariable(`--${m.name}-width`,c+"px"),i+=c}),this._vwp.setWidth(i)}_on_resize(){this._calc_sizes()}};s(it,"Header"),it=p([u("x4")],it);var zr='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512" fill="currentColor"><!--!Font Awesome Free 6.7.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M576 128c0-35.3-28.7-64-64-64L205.3 64c-17 0-33.3 6.7-45.3 18.7L9.4 233.4c-6 6-9.4 14.1-9.4 22.6s3.4 16.6 9.4 22.6L160 429.3c12 12 28.3 18.7 45.3 18.7L512 448c35.3 0 64-28.7 64-64l0-256zM271 175c9.4-9.4 24.6-9.4 33.9 0l47 47 47-47c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-47 47 47 47c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-47-47-47 47c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l47-47-47-47c-9.4-9.4-9.4-24.6 0-33.9z"/></svg>';var Or='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512" fill="currentColor"><!--!Font Awesome Free 6.7.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M214.6 41.4c-12.5-12.5-32.8-12.5-45.3 0l-160 160c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L160 141.2 160 448c0 17.7 14.3 32 32 32s32-14.3 32-32l0-306.7L329.4 246.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3l-160-160z"/></svg>';var Vr='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512" fill="currentColor"><!--!Font Awesome Free 6.7.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M38.8 5.1C28.4-3.1 13.3-1.2 5.1 9.2S-1.2 34.7 9.2 42.9l592 464c10.4 8.2 25.5 6.3 33.7-4.1s6.3-25.5-4.1-33.7L525.6 386.7c39.6-40.6 66.4-86.1 79.9-118.4c3.3-7.9 3.3-16.7 0-24.6c-14.9-35.7-46.2-87.7-93-131.1C465.5 68.8 400.8 32 320 32c-68.2 0-125 26.3-169.3 60.8L38.8 5.1zm151 118.3C226 97.7 269.5 80 320 80c65.2 0 118.8 29.6 159.9 67.7C518.4 183.5 545 226 558.6 256c-12.6 28-36.6 66.8-70.9 100.9l-53.8-42.2c9.1-17.6 14.2-37.5 14.2-58.7c0-70.7-57.3-128-128-128c-32.2 0-61.7 11.9-84.2 31.5l-46.1-36.1zM394.9 284.2l-81.5-63.9c4.2-8.5 6.6-18.2 6.6-28.3c0-5.5-.7-10.9-2-16c.7 0 1.3 0 2 0c44.2 0 80 35.8 80 80c0 9.9-1.8 19.4-5.1 28.2zm9.4 130.3C378.8 425.4 350.7 432 320 432c-65.2 0-118.8-29.6-159.9-67.7C121.6 328.5 95 286 81.4 256c8.3-18.4 21.5-41.5 39.4-64.8L83.1 161.5C60.3 191.2 44 220.8 34.5 243.7c-3.3 7.9-3.3 16.7 0 24.6c14.9 35.7 46.2 87.7 93 131.1C174.5 443.2 239.2 480 320 480c47.8 0 89.9-12.9 126.2-32.5l-41.9-33zM192 256c0 70.7 57.3 128 128 128c13.3 0 26.1-2 38.2-5.8L302 334c-23.5-5.4-43.1-21.2-53.7-42.3l-56.1-44.2c-.2 2.8-.3 5.6-.3 8.5z"/></svg>';var qn={"fr-FR":{lines:{lower:["1 2 3 4 5 6 7 8 9 0","a z e r t y u i o p {2}","q s d f g h j k l m {3}","{4} w x c v b n , . {4}","{5} {6} ' {7}"],upper:["! @ # $ % ^ & * ( ) _ +","A Z E R T Y U I O P {2}","Q S D F G H J K L M {3}","{4} W X C V B N ? : {4}","{5} {6} ' {7}"],number:["1 2 3 {2}","4 5 6 {8}","7 8 9 {9}","0 . {3} {9}"],date:["1 2 3 {2}","4 5 6 {8}","7 8 9 {9}","0 / {3} {9}"]}},"en-GB":{lines:{lower:["1 2 3 4 5 6 7 8 9 0","a z e r t y u i o p {2}","q s d f g h j k l m {3}","{4} w x c v b n , . {4}","{5} {6} ' {7}"],upper:["! @ # $ % ^ & * ( ) _ +","A Z E R T Y U I O P {2}","Q S D F G H J K L M {3}","{4} W X C V B N ? : {4}","{5} {6} ' {7}"],number:["1 2 3 {2}","4 5 6 {8}","7 8 9 {9}","0 . {3} {9}"],date:["1 2 3 {2}","4 5 6 {8}","7 8 9 {9}","0 / {3} {9}"]}},"en-US":"en-GB"},Hr=/text|password|search|tel|url/i,st=class extends b{mode;locale;keyboard;visible;input;constructor(e){super({...e,id:"v-keyboard"}),this.mode="lower",this.locale="fr-FR",this.visible=!1,document.addEventListener("focusin",t=>this.handleFocus(t.target,!0),!1),document.addEventListener("focusout",t=>this.handleFocus(t.target,!1),!1),this.hide(),this.addDOMEvent("mousedown",t=>{this.handleKey(t),t.preventDefault(),t.stopPropagation()}),this.addDOMEvent("dblclick",t=>{this.handleKey(t),t.preventDefault(),t.stopPropagation()}),this.addDOMEvent("contextmenu",t=>{t.preventDefault(),t.stopPropagation()})}setZoom(e){this.setStyleVariable("--keyboard-zoom",e+"%")}handleKey(e){let t=e.target,o;for(;t!==this.dom;){if(t.hasAttribute("data-key")){o=parseInt(t.getAttribute("data-key"),10);break}t=t.parentNode}if(o)switch(o){case 2:{this.fireKey(0,this._backspace);break}case 3:{this._focusNext();break}case 4:{this.mode=="lower"?this.mode="upper":this.mode="lower",this._redraw();break}case 5:{this._switchMode("number");break}case 6:{this.fireKey(32,this._insertChar);break}case 7:{this.hide();break}case 8:{this._switchMode("lower");break}default:{this.fireKey(o,this._insertChar);break}}}_focusNext(){Oe.instance().focusNext(!0)}_switchMode(e){this.mode=e,this._redraw()}_redraw(){this.setContent([this.keyboard=new k({id:"kb",cls:this.mode,content:this._createContent()})])}_scrollIntoView(e){let t=e.parentElement;for(;t!=document.body;){if(t.style.overflowY!==""){let o=e.getBoundingClientRect(),r=t.getBoundingClientRect();o.top<r.top?e.scrollIntoView(!0):o.bottom>r.bottom&&e.scrollIntoView(!1);break}t=t.parentElement}}_updateVis=s(()=>{if(this.visible){if(this.input){let e=this.input.type;if(e=="check"||e=="radio")this.hide(),this.input=null;else{this.show(),this._scrollIntoView(this.input);let t=this.input.getAttribute("data-type");e==="number"||t==="number"?this._switchMode("number"):e==="date"||t==="date"?this._switchMode("date"):this._switchMode("lower")}}}else this.hide(),this.input=null},"_updateVis");showOn(e){this.handleFocus(e.dom,!0)}handleFocus(e,t){if(t&&e.tagName=="INPUT"&&!e.readOnly){this.input=e,this.visible=!0,this.setTimeout("vis",200,this._updateVis);return}this.visible=!1,this.setTimeout("vis",200,this._updateVis)}_insertChar(e,t,o){return t=t.substring(0,e.start)+o.toString()+t.substring(e.end),e.start+=o.length,e.end=e.start,t}_backspace(e,t){return t=t.substring(0,e.start-1)+t.substring(e.start),e.start-=1,e.end=e.start,t}_getCaret(){if(this.input&&Hr.test(this.input.type)){let e={start:this.input.selectionStart||0,end:this.input.selectionEnd||0};return e.end<e.start&&(e.end=e.start),e}else{let e=this.input.value.length;return{start:e,end:e}}}_restoreCaretPos(e){Hr.test(this.input.type)&&(this.input.selectionStart=e.start,this.input.selectionEnd=e.end)}fireKey(e,t){let o=this._getCaret(),r=this.input.value;r=t.call(this,o,r,String.fromCharCode(e)),this.input.value=r,this._restoreCaretPos(o)}_createContent(){let e=qn[this.locale].lines[this.mode],t=[];for(let o=0;o<e.length;o++){let r=e[o].split(" "),n=[];for(let i=0;i<r.length;i++){let a="tch c"+i,c=r[i],d,m=null;if(c.length>2&&c[0]=="{"&&c[c.length-1]=="}"){let g=parseInt(c.substring(1,c.length-1),10);switch(g){default:case 0:{c="",a+=" x4hidden";break}case 1:{c="";break}case 2:{c=void 0,m=zr,a+=" cdel";break}case 3:{c=y.global.keyboard.next,a+=" cret";break}case 4:{c=void 0,m=Or,a+=" cshift";break}case 5:{c=y.global.keyboard.numeric,a+=" cnum";break}case 6:{c=" ",a+=" cspace";break}case 7:{c=void 0,m=Vr,a+=" chide";break}case 8:{c=y.global.keyboard.alpha,a+=" calpha";break}case 9:{c="",a+=" cplace";break}}d=g}else d=r[i].charCodeAt(0);let f=new I({cls:a,label:c,attrs:{"data-key":d},icon:m});n.push(f)}t.push(new b({cls:"line",content:n}))}return t}};s(st,"Keyboard"),st=p([u("x4")],st);var at=class extends h{constructor(e){super({tag:"a",...e}),this.setAttribute("href",e.href),this.mapPropEvents(e,"click"),this.setContent(new w({text:e.text,icon:e.icon})),this.addDOMEvent("click",t=>this._on_click(t))}setText(e){this.setContent(e)}_on_click(e){let t={context:this.props.href};this.fire("click",t),t.preventDefault&&(e.preventDefault(),e.stopPropagation())}};s(at,"Link"),at=p([u("x4")],at);var Nr='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="currentColor"><!--!Font Awesome Free 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zm0-384c13.3 0 24 10.7 24 24l0 112c0 13.3-10.7 24-24 24s-24-10.7-24-24l0-112c0-13.3 10.7-24 24-24zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z"/></svg>';var Yo='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--!Font Awesome Pro 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2024 Fonticons, Inc.--><path class="fa-secondary" opacity=".4" d="M0 128l32 0 224 0 32 0 0 64-32 0L64 192l0 256 448 0 0-128 0-32 64 0 0 32 0 160 0 32-32 0L32 512 0 512l0-32L0 160l0-32z"/><path class="fa-primary" d="M288 352l16-112L468.7 75.3l96 96L400 336 288 352zM587.3 148.7l-96-96L544 0l96 96-52.7 52.7zM96 288l64 0 0 64-64 0 0-64zm160 0l0 64-64 0 0-64 64 0z"/></svg>';var Ae=class extends ee{constructor(e){super(e)}static _create(e,t,o){return new Ae({modal:!0,title:o!=null?o:y.global.error,movable:!0,form:new K({content:[new b({content:[new E({iconId:Nr}),new w({text:e})]})]}),buttons:t!=null?t:["ok.outline","cancel.outline"]})}static show(e,t,o){let r=this._create(e,t,o);return r.on("btnclick",n=>{Z(()=>{r.close()})}),r.show(),r}static async showAsync(e,t,o){return new Promise((r,n)=>{let i=this._create(e,t,o);i.on("btnclick",a=>{Z(()=>{r(a.button),i.close()})}),i.show()})}};s(Ae,"MessageBox"),Ae=p([u("x4")],Ae);var Me=class extends ee{constructor(e){super(e)}getValue(){return this.query("input").getValue()}static _create(e,t,o){return new Me({modal:!0,title:o,movable:!0,form:new K({content:[new b({content:[new E({iconId:Yo}),new k({flex:1,content:[new w({text:e}),new A({value:t,type:"text"})]})]})]}),buttons:["ok.outline.default","cancel.outline"]})}static async showAsync(e,t,o){return new Promise((r,n)=>{let i=this._create(e,t,o);i.on("btnclick",a=>{Z(()=>{r(a.button=="ok"?i.getValue():null),i.close()})}),i.show()})}};s(Me,"InputBox"),Me=p([u("x4")],Me);var Pe=class extends ee{constructor(e){super(e)}static _create(e,t,o){return new Pe({modal:!0,title:o,movable:!0,form:new K({content:[new b({content:[new E({iconId:Yo}),new k({flex:1,cls:"right",content:[new w({text:e}),t]})]})]}),buttons:["ok.outline.default","cancel.outline"]})}static async showAsync(e,t,o){return new Promise(r=>{let n=this._create(e,t,o);n.on("btnclick",i=>{Z(()=>{r(i.button),n.close()})}),n.show()})}static show(e,t,o,r){let n=this._create(e,t,o);n.on("btnclick",i=>{Z(async()=>{await r(i.button)!==!1&&n.close()})}),n.show()}};s(Pe,"PromptBox"),Pe=p([u("x4")],Pe);var Ur='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="currentColor"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"/></svg>';var qr='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="currentColor"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zm0-384c13.3 0 24 10.7 24 24V264c0 13.3-10.7 24-24 24s-24-10.7-24-24V152c0-13.3 10.7-24 24-24zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z"/></svg>';var Kr='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="currentColor"><!--!Font Awesome Pro 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2024 Fonticons, Inc.--><path d="M207.4 20.4c2.4 8.5-2.6 17.3-11.2 19.7C101.5 66.2 32 153 32 256c0 123.7 100.3 224 224 224s224-100.3 224-224c0-103-69.5-189.8-164.3-215.9c-8.5-2.4-13.5-11.2-11.2-19.7s11.2-13.5 19.7-11.2C432.5 39.1 512 138.2 512 256c0 141.4-114.6 256-256 256S0 397.4 0 256C0 138.2 79.5 39.1 187.7 9.2c8.5-2.4 17.3 2.6 19.7 11.2z"/></svg>';var Gr='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512" fill="currentColor"><!--!Font Awesome Pro 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2024 Fonticons, Inc.--><path d="M192 233.4L59.5 100.9 36.9 123.5 169.4 256 36.9 388.5l22.6 22.6L192 278.6 324.5 411.1l22.6-22.6L214.6 256 347.1 123.5l-22.6-22.6L192 233.4z"/></svg>';var lt=class extends B{constructor(e){super({});let t=e.iconId;t||(e.loading?(t=Kr,this.addClass("")):e.mode=="danger"?t=qr:t=Ur),this.addClass(e.mode);let o=new E({iconId:t});e.loading&&o.addClass("rotate"),this.setContent(new b({content:[o,new k({cls:"body",content:[e.title?new w({cls:"title",text:e.title}):null,new w({cls:"text",text:e.text})]}),e.closable?new I({cls:"outline",icon:Gr,click:s(()=>{this.close()},"click")}):null]}))}close(){this.clearTimeout("close"),super.close()}display(e=0){let t=new Fe(0,0,window.innerWidth,window.innerHeight);this.displayNear(t,"bottom right","bottom right",{x:-20,y:-10}),e&&this.setTimeout("close",e*1e3,()=>{this.close()})}};s(lt,"Notification"),lt=p([u("x4")],lt);var ct=class extends k{_title;_body;constructor(e){var o;super({...e,content:void 0});let t=(o=e.bodyModel)!=null?o:k;super.setContent([this._title=new w({tag:"legend",text:e.title,icon:e.icon}),this._body=new t({cls:"body",content:e.content})])}setContent(e){this._body.setContent(e)}setTitle(e){this._title.setContent(e)}};s(ct,"Panel"),ct=p([u("x4")],ct);var dt=class extends h{_bar;constructor(e){super(e),this.setContent(this._bar=new h({cls:"bar"})),this.setValue(e.value)}setValue(e){let t=e/(this.props.max-this.props.min)*100;this._bar.setStyleValue("width",t+"%")}};s(dt,"Progress"),dt=p([u("x4")],dt);var fe=class extends h{constructor(e){super({tag:"select",...e}),this.mapPropEvents(e,"focus","change"),e.name&&this.setAttribute("name",e.name),this.setItems(e.items),this.addDOMEvent("blur",t=>{this.on_focus(t,!0)}),this.addDOMEvent("focus",t=>{this.on_focus(t,!1)}),this.addDOMEvent("input",t=>{this.on_change(t)}),e.multiple&&this.setAttribute("multiple",!0),e.value&&this.setValue(e.value)}on_focus(e,t){let o={focus_out:t};this.fire("focus",o),o.defaultPrevented&&e.preventDefault()}on_change(e){let t={value:this.getValue()};this.fire("change",t),t.defaultPrevented&&e.preventDefault()}setItems(e){this.setContent(e.map(t=>new h({tag:"option",attrs:{value:t.id},content:t.text})))}getValue(){return this.dom.value}setValue(e){this.dom.value=e+""}};s(fe,"Select"),fe=p([u("x4")],fe);var jr='data:image/svg+xml,<svg viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">%0D%0A%09<path class="fa-primary" d="M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z" fill="currentColor" fill-rule="evenodd" clip-rule="evenodd">%0D%0A%09</path>%0D%0A</svg>';var ht=class extends k{root;groups;constructor(e){super(e),this.root=new h({cls:"root"}),this.setContent(this.root),e.groups&&this.setItems(e.groups)}setItems(e){this.groups=e.filter(o=>!!o);let t=[];for(let o of this.groups)t.push(this.makeGroupHeader(o)),o.items.forEach(r=>{r&&t.push(this.makePropertyRow(r))});this.root.setContent(t)}makeGroupHeader(e){let t=s(r=>{let n;r.hasClass("collapsed")?(r.removeClass("collapsed"),n=!0):(r.addClass("collapsed"),n=!1);let i=r.nextElement();for(;i&&i.hasClass("row");)i.show(n),i=i.nextElement()},"toggle"),o=new b({cls:"group",content:[e.icon?new E({id:"icon",iconId:e.icon}):null,new k({content:[new V({cls:"title",text:e.title}),e.desc?new V({cls:"desc",text:e.desc}):null]}),e.collapsible?new I({icon:jr,click:s(r=>t(o),"click")}):null]});return o.setClass("collapsible",e.collapsible),o}makePropertyRow(e){var n;let t=!0,o,r=ur(e.value)?e.value(e.name):e.value;return e.value=r,e.type==="boolean"?o=new A({type:"checkbox",id:e.name,name:e.name,checked:r,dom_events:{change:s(i=>{var a;(a=e.callback)==null||a.call(e,e.name,o.dom.checked)},"change")}}):e.type==="options"?o=new fe({value:r,id:e.name,items:e.options,name:e.name,change:s(i=>{var a;(a=e.callback)==null||a.call(e,e.name,i.value)},"change")}):e.type==="password"?o=new A({type:"password",id:e.name,name:e.name,value:r,focus:s(i=>{var a;i.focus_out&&((a=e.callback)==null||a.call(e,e.name,o.getValue()))},"focus")}):e.type==="number"?o=new A({type:"number",id:e.name,name:e.name,value:r,step:e.step,focus:s(i=>{var a;i.focus_out&&((a=e.callback)==null||a.call(e,e.name,o.getNumValue()))},"focus"),change:s(()=>{var i;e.live&&((i=e.callback)==null||i.call(e,e.name,o.getNumValue()))},"change")}):e.type==="label"?o=new w({id:e.name,text:r}):e.type==="button"?(t=!1,o=new I({id:e.name,label:r,click:s(()=>{var i;(i=e.callback)==null||i.call(e,e.name,"")},"click")})):o=new A({type:"text",id:e.name,name:e.name,value:r,focus:s(i=>{var a;i.focus_out&&((a=e.callback)==null||a.call(e,e.name,o.getValue()))},"focus")}),new b({cls:"row",content:[t?new h({cls:"cell hdr",content:(n=e.title)!=null?n:e.name,tooltip:e.desc}):null,new h({cls:"cell",tag:"label",attrs:{labelFor:e.name},content:o})]})}setPropValue(e,t){let r=this.groups.flatMap(n=>[...n.items]).find(n=>n.name==e);if(r)if(r.type==="boolean"){let n=this.root.query("#"+r.name);n&&n.setCheck(t)}else if(r.type==="options"){let n=this.root.query("#"+r.name);n&&n.setValue(t)}else if(r.type==="number"){let n=this.root.query("#"+r.name);n&&n.setNumValue(t,-2)}else{let n=this.root.query("#"+r.name);n&&n.setValue(t)}}};s(ht,"PropertyGrid"),ht=p([u("x4")],ht);var Wr='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 5 5" aria-hidden="true">%0D%0A%09<circle class="fa-primary" cx="2.5" cy="2.5" r="2.5" ></circle>%0D%0A%09<circle class="fa-secondary" cx="2.5" cy="2.5" r="1.25"></circle>%0D%0A</svg>';var pt=class extends h{_check;_input;_label;constructor(e){super(e),this.mapPropEvents(e,"change");let t=q();this.setContent([this._check=new b({cls:"inner",content:[this._input=new A({type:"radio",id:t,name:e.name,value:e.value,checked:e.checked,dom_events:{change:s(()=>this._on_change(),"change")}})]}),this._label=new w({tag:"label",text:e.label,id:void 0,labelFor:t,icon:e.icon})]),Et.load(Wr).then(o=>{this._check.dom.insertAdjacentHTML("beforeend",o)}),this.addDOMEvent("click",o=>this._on_click(o))}_on_click(e){e.target==this.dom&&(this._input.dom.click(),e.preventDefault(),e.stopPropagation())}_on_change(){this.fire("change",{value:this.getValue()})}setCheck(e){let t=this._input.dom;t.checked=e}setLabel(e){this._label.setText(e)}getValue(){return this._input.getValue()}};s(pt,"Radio"),pt=p([u("x4")],pt);var $r='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512" fill="currentColor"><!--!Font Awesome Pro 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2024 Fonticons, Inc.--><path d="M288.1 0l86.5 164 182.7 31.6L428 328.5 454.4 512 288.1 430.2 121.7 512l26.4-183.5L18.9 195.6 201.5 164 288.1 0z"/></svg>';var ut=class extends b{m_els;m_input;constructor(e){var t;super(e),e.steps=(t=e.steps)!=null?t:5,this._update()}_update(){var r,n;let e=this.props,t=(r=e.icon)!=null?r:$r,o=(n=e.value)!=null?n:0;this.m_input=new A({type:"text",hidden:!0,name:e.name,value:""+o}),this.addDOMEvent("click",i=>this._on_click(i)),this.m_els=[];for(let i=0;i<e.steps;i++){let a="item";i+1<=o&&(a+=" checked");let c=new E({cls:a,iconId:t});c.setInternalData("value",i),this.m_els.push(c)}this.m_els.push(this.m_input),this.setContent(this.m_els)}getValue(){var e;return(e=this.props.value)!=null?e:0}setValue(e){this.props.value=e;for(let t=0;t<this.props.steps;t++)this.m_els[t].setClass("checked",this.m_els[t].getInternalData("value")<=e);this.m_input.setValue(""+this.props.value)}setSteps(e){this.props.steps=e,this._update()}setShape(e){this.removeClass(this.props.icon),this.props.icon=e}_on_click(e){let t=T(e.target);t=t.parentElement(E),t&&this.setValue(t.getInternalData("value")),this.fire("change",{value:this.props.value})}};s(ut,"Rating"),ut=p([u("x4")],ut);var mt=class extends h{_mdown=!1;_irect=null;_thumb=null;_bar=null;_range=null;constructor(e){super(e),this.mapPropEvents(e,"change"),e.vertical&&this.addClass("vertical"),this.setContent([new b({cls:"track",content:[this._bar=new h({cls:"bar"}),this._thumb=new h({cls:"thumb"})]}),this._range=new A({type:"range",hidden:!0,value:e.value,min:e.min,max:e.max,step:e.step})]),this.setAttribute("tabindex",0),this.setDOMEvents({pointerdown:s(t=>this._on_mousedown(t),"pointerdown"),pointermove:s(t=>this._on_mousemove(t),"pointermove"),pointerup:s(t=>this._on_mouseup(t),"pointerup"),keydown:s(t=>this._on_key(t),"keydown")}),this._update()}_on_mousedown(e){e.stopPropagation(),e.preventDefault(),this.focus(),this._mdown=!0,this._irect=this.getBoundingRect(),this.setCapture(e.pointerId)}_getMinMax(){let e=parseInt(this._range.getAttribute("min")),t=parseInt(this._range.getAttribute("max"));return[e,t]}_on_mousemove(e){if(this._mdown){let t,o;this.props.vertical?(t=e.offsetY,o=this._irect.height):(t=e.offsetX,o=this._irect.width);let r=t/o;this.props.vertical&&(r=1-r);let[n,i]=this._getMinMax();this._range.setNumValue(n+r*(i-n)),this._update()}}_update(){let e=this._range.getNumValue(),[t,o]=this._getMinMax(),r=o>t?e/Math.abs(o-t)*100:0;this.props.vertical?(r=100-r,this._thumb.setStyleValue("top",r+"%"),this._bar.setStyleValue("height",r+"%")):(this._thumb.setStyleValue("left",r+"%"),this._bar.setStyleValue("width",r+"%")),this.fire("change",{value:e})}_on_mouseup(e){this._mdown&&(this.releaseCapture(e.pointerId),this._mdown=!1)}_on_key(e){var r;console.log(e.key);let t=(r=this.props.step)!=null?r:1,o=0;switch(e.key){case"ArrowRight":case"ArrowUp":o=t;break;case"ArrowLeft":case"ArrowDown":o=-t;break}o&&(e.ctrlKey&&(o*=10),this._range.setNumValue(this._range.getNumValue()+o),this._update())}setMin(e){this._range.setAttribute("min",e+""),this._update()}setMax(e){this._range.setAttribute("max",e+""),this._update()}setValue(e){this._range.setNumValue(e),this._update()}};s(mt,"Slider"),mt=p([u("x4")],mt);var ft=class extends b{constructor(e){super(e);let t=q();this.setContent([new h({cls:"switch",content:[new A({type:"checkbox",id:t,checked:e.checked}),new h({cls:"track"}),new h({cls:"thumb"})]}),new w({tag:"label",text:e.label,labelFor:t})])}};s(ft,"Switch"),ft=p([u("x4")],ft);var De=class extends I{constructor(e,t){super(e),this.addClass("outline"),t.cls&&this.addClass(t.cls),this.setIcon(t.icon),this.setText(t.title),this.setData("tabname",t.name)}};s(De,"CTab"),De=p([u("x4")],De);var Te=class extends b{_selitem;constructor(e,t){super(e),this.setItems(t),this.mapPropEvents(e,"click")}_on_click(e){let t=e.source.getData("tabname");this.fire("click",{name:t})}select(e){let t=this.query(`[data-tabname="${e}"]`);this._selitem&&this._selitem.setClass("selected",!1),this._selitem=t,this._selitem&&this._selitem.setClass("selected",!0)}setItems(e){this.clearContent(),e.forEach(t=>{this.addItem(t)})}addItem(e){this.appendContent(new De({click:s(t=>this._on_click(t),"click")},e))}removeItem(e){let t=this.query(`[data-tabname="${e}"]`);t&&this.removeChild(t)}};s(Te,"CTabList"),Te=p([u("x4")],Te);var gt=class extends k{_list;_stack;_current;constructor(e){var o;super(e);let t=(o=e.items)==null?void 0:o.map(r=>({name:r.name,content:r.content}));this.setContent([this._list=new Te({click:s(r=>this._onclick(r),"click")},e.items),this._stack=new ne({cls:"body x4flex",default:e.default,items:t})]),e.default&&this.selectTab(e.default)}selectTab(e){this._list.select(e),this._stack.select(e),this._current=e}_onclick(e){this.selectTab(e.name)}getTab(e){return this._stack.getPage(e)}getCurTab(){return this._current}addTab(e){this._list.addItem(e),this._stack.addItem({name:e.name,content:e.content}),this._stack.getPageCount()==1&&this.selectTab(e.name)}removeTab(e){this._list.removeItem(e),this._stack.removeItem(e)}enumTabs(){return this._stack.enumPageNames()}};s(gt,"Tabs"),gt=p([u("x4")],gt);var Zo=class Zo extends h{constructor(e){super({...e,tag:"textarea"}),this.setAttribute("name",e.name),this.setAttribute("value",e.value+""),e.resize||this.setAttribute("resize",!1),e.readonly&&this.setAttribute("readonly",!0)}setText(e){this.dom.value=e}getText(){return this.dom.value}queryInterface(e){return e=="form-element"?{getRawValue:s(()=>this.getText(),"getRawValue"),setRawValue:s(o=>{this.setText(o)},"setRawValue"),isValid:s(()=>!0,"isValid")}:super.queryInterface(e)}};s(Zo,"SimpleTextArea");var Qo=Zo,xt=class extends k{_input;constructor(e){super(e),this.setContent([new w({text:e.label}),this._input=new Qo(e)])}setText(e){this._input.setText(e)}getText(){return this._input.getText()}queryInterface(e){return e=="form-element"?{getRawValue:s(()=>this.getText(),"getRawValue"),setRawValue:s(o=>{this.setText(o)},"setRawValue"),isValid:s(()=>!0,"isValid")}:super.queryInterface(e)}};s(xt,"TextArea"),xt=p([u("x4")],xt);var bt=class extends b{input;constructor(e){var r;super(e),e.inputId||(e.inputId=q()),e.required&&this.setAttribute("required",!0);let t=(r=e.inputGadgets)!=null?r:[],o={...e,id:e.inputId,attrs:e.inputAttrs,width:e.inputWidth};this.setContent([e.label?new b({id:"label",width:e.labelWidth,content:[new w({tag:"label",text:e.label,labelFor:e.inputId})]}):null,new b({id:"edit",content:[this.input=new A(o),...t]})])}getValue(){return this.input.getValue()}setValue(e){this.input.setValue(e)}getInput(){return this.input}};s(bt,"TextEdit"),bt=p([u("x4")],bt);var Xo=class Xo extends h{constructor(e){super(e),this.addDOMEvent("resized",()=>this.update())}update(){var d,m,f,g;let e=this.props,t=e.values;if(!t.length){this.clearContent();return}let o=this.getBoundingRect(),r=(d=e.min)!=null?d:0,n=(m=e.max)!=null?m:100,i=o.width/t.length,a=o.height/(n-r),c=new Ue;if(e.background&&c.rect(0,0,o.width,o.height).fill(e.background.toHexString()),r!=0&&c.path().moveTo(0,0-r).lineTo(o.width,0-r).stroke("var(--tickline-axis-color)",1).antiAlias(!1),e.type=="line"){let x=c.path();for(let v=0;v<t.length;v++)v==0?x.moveTo(v*i,(t[v]-r)*a):x.lineTo(v*i,(t[v]-r)*a);x.stroke(e.color?e.color.toHexString():"var(--tickline-color)",1).no_fill()}else for(let x=0;x<t.length;x++)c.rect(x*i,(0-r)*a,i-1,t[x]*a).fill(e.color?e.color.toHexString():"var(--tickline-color)").antiAlias(!1);this.setContent(new qe({width:"100%",height:"100%",svg:c,attrs:{viewport:`0 ${(f=e.min)!=null?f:0} ${t.length} ${(g=e.max)!=null?g:100}`}}))}};s(Xo,"TickLine");var Yr=Xo;var Qr='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--!Font Awesome Pro 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2024 Fonticons, Inc.--><path class="fa-secondary" opacity=".4" d="M0 176c0 37.5 13.9 72.3 37.6 100.9L0 352l108.1-21.6C137.7 344.2 171.8 352 208 352c114.9 0 208-78.8 208-176S322.9 0 208 0S0 78.8 0 176zm134.7-52c0-25.8 20.9-46.7 46.7-46.7l47.4 0c29.1 0 52.6 23.6 52.6 52.6c0 18.8-10.1 36.3-26.4 45.6L228 191l0 6.3 0 20-40 0 0-20 0-17.9 0-11.6 10-5.8L235 140.9c3.9-2.3 6.3-6.4 6.3-10.9c0-7-5.7-12.6-12.6-12.6l-47.4 0c-3.7 0-6.7 3-6.7 6.7l0 5.5-40 0 0-5.5zM188 250.7l40 0 0 40-40 0 0-40z"/><path class="fa-primary" d="M134.7 124c0-25.8 20.9-46.7 46.7-46.7l47.4 0c29.1 0 52.6 23.6 52.6 52.6c0 18.8-10.1 36.3-26.4 45.6L228 191l0 6.3 0 20-40 0 0-20 0-17.9 0-11.6 10-5.8L235 140.9c3.9-2.3 6.3-6.4 6.3-10.9c0-7-5.7-12.6-12.6-12.6l-47.4 0c-3.7 0-6.7 3-6.7 6.7l0 5.5-40 0 0-5.5zM188 250.7l40 0 0 40-40 0 0-40zM432 512c-95.6 0-176.2-54.6-200.5-129C348.9 372.9 448 288.3 448 176c0-5.2-.2-10.4-.6-15.5C555.1 167.1 640 243.2 640 336c0 37.5-13.9 72.3-37.6 100.9L640 512 531.9 490.4C502.3 504.2 468.2 512 432 512z"/></svg>';var Jt=null,Mt=null,Zr=new Be;function Ex(){document.addEventListener("mouseenter",l=>{if(l.target===document)return;let e=fo(l.target),t=e.getAttribute("tooltip"),o=e.queryInterface("tip-handler");if(o&&(t=o.getTip()),t){Jt=l.target;let r=e.getBoundingRect();ei(t,r,{x:l.pageX,y:l.pageY})}},!0),document.addEventListener("mouseleave",l=>{Jt&&l.target==Jt&&(Jt=null,ti())},!0)}s(Ex,"initTooltips");function ei(l,e,t){Mt||(Mt=new Se({})),Zr.setTimeout(null,300,()=>{Mt.setText(_t(l)),Mt.displayAt(t.x+17,t.y+17)})}s(ei,"showTT");function ti(){Mt.show(!1),Zr.clearTimeout(null)}s(ti,"closeTT");var Se=class extends B{constructor(e){super(e),this.setContent(new b({content:[new E({iconId:Qr}),new h({id:"text"})]}))}setText(e){this.query("#text").setContent(e)}};s(Se,"Tooltip"),Se=p([u("x4")],Se);var Xr='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="currentColor"><!--!Font Awesome Pro 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2024 Fonticons, Inc.--><path d="M267.3 395.3c-6.2 6.2-16.4 6.2-22.6 0l-192-192c-6.2-6.2-6.2-16.4 0-22.6s16.4-6.2 22.6 0L256 361.4 436.7 180.7c6.2-6.2 16.4-6.2 22.6 0s6.2 16.4 0 22.6l-192 192z"/></svg>';var ri=(d=>(d[d.first=0]="first",d[d.prev=1]="prev",d[d.next=2]="next",d[d.last=3]="last",d[d.parent=4]="parent",d[d.child=5]="child",d[d.expand=6]="expand",d[d.collapse=7]="collapse",d[d.toggle=8]="toggle",d))(ri||{}),ge=class extends C{_item;_label;_icon;_childs;constructor(e,t){super({...e}),this._item=t,t?(this._label=new b({cls:"label item",content:[this._icon=new E({iconId:t.children?Xr:void 0}),new w({tag:"span",cls:"",text:t.text,icon:t.iconId})]}),t.cls&&this._label.addClass(t.cls),this._label.setInternalData("id",t.id),t.children&&(this._childs=new k({cls:"body"}),t.open===void 0&&(t.open=!1),this.addClass("folder"),this.setClass("open",t.open),this.setItems(t.children),this._icon.addDOMEvent("click",o=>this.toggle(o)))):this._childs=new k({cls:"body"}),this.setContent([this._label,this._childs])}toggle(e){let t=this.hasClass("open");this.open(!t),e&&e.stopPropagation()}open(e=!0){this.setClass("open",e),this._item.open=e}setItems(e){if(e){let t=e.map(o=>new ge({},o));this._childs.setContent(t)}else this._childs.clearContent()}};s(ge,"CTreeViewItem"),ge=p([u("x4")],ge);var vt=class extends h{_view;_selection;_selitem;_items;constructor(e){super(e),this.mapPropEvents(e,"selectionChange","dblClick","click");let t=new J({cls:"body"});this._view=t.getViewport(),this.setContent([t,e.footer]),e.footer&&e.footer.setAttribute("id","footer"),this.setAttribute("tabindex",0),this.setDOMEvents({click:s(o=>this._on_click(o),"click"),dblclick:s(o=>this._on_click(o),"dblclick"),keydown:s(o=>this._onkey(o),"keydown")}),e.items&&this.setItems(e.items)}setItems(e){this.clearSelection(),this._view.clearContent(),this._items=e;let t=new ge({cls:"root"},null);e&&(t.setItems(e),this._view.setContent(t))}_on_click(e){let t=e.target;for(;t&&t!=this.dom;){let o=T(t);if(o&&o.hasClass("item")){let r=o.getInternalData("id"),n={context:r};e.type=="click"?this.fire("click",n):this.fire("dblClick",n),n.defaultPrevented||this._selectItem(r,o);return}t=t.parentElement}this.clearSelection()}_onkey(e){switch(e.key){case"ArrowDown":{this.navigate(2);break}case"ArrowUp":{this.navigate(1);break}case"Home":{this.navigate(0);break}case"End":{this.navigate(3);break}case"ArrowRight":{this.navigate(5);break}case"+":{this.navigate(6);break}case"ArrowLeft":{this.navigate(4);break}case"-":{this.navigate(7);break}case" ":{this.navigate(8);break}default:console.log(e.key);return}e.preventDefault(),e.stopPropagation()}navigate(e){var r;if(!this._items||this._items.length==0)return;if(!this._selitem)if(e==2||e==4)e=0;else if(e==1)e=3;else return;let t=(r=this._selitem)==null?void 0:r.parentElement(),o=t==null?void 0:t.hasClass("folder");if(t&&e==4&&o&&t.hasClass("open")?e=7:e==5&&(o?t.hasClass("open")?e=2:e=6:e=2),e==6||e==7||e==8){if(o)return e==8?(t.toggle(),!0):(t.open(e==6),!0)}else{let n=this._flattenOpenItems(),i=n.findIndex(c=>this._selection==c.id),a;if(e==0)a=n[0].id;else if(e==3)a=n[n.length-1].id;else if(i>=0){if(e==1)i>0&&(a=n[i-1].id);else if(e==2)i<n.length-1&&(a=n[i+1].id);else if(e==4){let c=n[i].level;for(;i>0;)if(i--,n[i].level<c){a=n[i].id;break}}}if(a){let c=this.query(`[data-id="${a}"]`);return this._selectItem(a,c),!0}}return!1}_flattenOpenItems(){let e=[],t=s((o,r)=>{e.push({id:o.id+"",level:r}),o.children&&o.open&&o.children.forEach(n=>t(n,r+1))},"build");return this._items.forEach(o=>t(o,0)),e}_flattenItems(){let e=[],t=s(o=>{e.push(o),o.children&&o.children.forEach(r=>t(r))},"build");return this._items.forEach(o=>t(o)),e}_selectItem(e,t){this._selitem&&(this._selitem.removeClass("selected"),this._selitem=void 0),this._selitem=t,this._selection=e,t&&(t.addClass("selected"),t.scrollIntoView({behavior:"smooth",block:"nearest"}));let o=this._findItem(e);this.fire("selectionChange",{selection:[o],empty:!1})}_findItem(e){return this._flattenItems().find(o=>o.id==e)}clearSelection(){this._selitem&&(this._selitem.removeClass("selected"),this._selitem=void 0),this._selection=void 0,this.fire("selectionChange",{selection:[],empty:!0})}getSelection(){return this._selection}selectItem(e){this._findItem(e)&&this.visitChildren(o=>{if(o.getInternalData("id")==e)return this._selectItem(e,o),!0})}};s(vt,"Treeview"),vt=p([u("x4")],vt);})();