@budibase/server 3.2.31 → 3.2.32

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.
@@ -295,7 +295,7 @@ $1`)},u.parseAttributes=function(f){return Object.keys(f).map(function(m){return
295
295
  Vestibulum ac diam sit amet quam vehicula elementum sed sit amet dui. Curabitur non nulla sit amet nisl tempus convallis quis ac lectus. Nulla quis lorem ut libero malesuada feugiat. Proin eget tortor risus. Cras ultricies ligula sed magna dictum porta. Donec sollicitudin molestie malesuada. Pellentesque in ipsum id orci porta dapibus. Vestibulum ac diam sit amet quam vehicula elementum sed sit amet dui. Curabitur non nulla sit amet nisl tempus convallis quis ac lectus. Nulla quis lorem ut libero malesuada feugiat. Proin eget tortor risus.
296
296
 
297
297
  Curabitur aliquet quam id dui posuere blandit. Vestibulum ac diam sit amet quam vehicula elementum sed sit amet dui. Pellentesque in ipsum id orci porta dapibus. Curabitur non nulla sit amet nisl tempus convallis quis ac lectus. Nulla quis lorem ut libero malesuada feugiat. Proin eget tortor risus. Cras ultricies ligula sed magna dictum porta. Donec sollicitudin molestie malesuada. Pellentesque in ipsum id orci porta dapibus. Vestibulum ac diam sit amet quam vehicula elementum sed sit amet dui. Curabitur non nulla sit amet nisl tempus convallis quis ac lectus. Nulla quis lorem ut libero malesuada feugiat. Proin eget tortor risus. Curabitur aliquet quam id dui posuere blandit. Vestibulum ac diam sit amet quam vehicula elementum sed sit amet dui.`;var lorem_1=lorem,string$1=createCommonjsModule(function(p,u){var f=p.exports;f.append=function(m,v){return typeof m=="string"&&typeof v=="string"?m+v:m},f.camelcase=function(m){return typeof m!="string"?"":utils$2.changecase(m,function(v){return v.toUpperCase()})},f.capitalize=function(m){return typeof m!="string"?"":m.charAt(0).toUpperCase()+m.slice(1)},f.capitalizeAll=function(m){return typeof m!="string"?"":handlebarsUtils.isString(m)?m.replace(/\w\S*/g,function(v){return f.capitalize(v)}):void 0},f.center=function(m,v){if(typeof m!="string")return"";for(var y="",w=0;w<v;)y+="&nbsp;",w++;return y+m+y},f.chop=function(m){return typeof m!="string"?"":utils$2.chop(m)},f.dashcase=function(m){return typeof m!="string"?"":utils$2.changecase(m,function(v){return"-"+v})},f.dotcase=function(m){return typeof m!="string"?"":utils$2.changecase(m,function(v){return"."+v})},f.downcase=function(){return f.lowercase.apply(this,arguments)},f.ellipsis=function(m,v){if(handlebarsUtils.isString(m))return m.length<=v?m:f.truncate(m,v)+"…"},f.hyphenate=function(m){return typeof m!="string"?"":m.split(" ").join("-")},f.isString=function(m){return typeof m=="string"},f.lowercase=function(m){return handlebarsUtils.isObject(m)&&m.fn?m.fn(this).toLowerCase():typeof m!="string"?"":m.toLowerCase()},f.occurrences=function(m,v){if(typeof m!="string")return"";for(var y=v.length,w=0,k=0;(w=m.indexOf(v,w))>-1;)k++,w+=y;return k},f.pascalcase=function(m){return typeof m!="string"?"":(m=utils$2.changecase(m,function(v){return v.toUpperCase()})).charAt(0).toUpperCase()+m.slice(1)},f.pathcase=function(m){return typeof m!="string"?"":utils$2.changecase(m,function(v){return"/"+v})},f.plusify=function(m,v){return typeof m!="string"?"":(handlebarsUtils.isString(v)||(v=" "),m.split(v).join("+"))},f.prepend=function(m,v){return typeof m=="string"&&typeof v=="string"?v+m:m},f.raw=function(m){var v=m.fn();if(handlebarsUtils.options(this,m).escape!==!1)for(var y=0;(y=v.indexOf("{{",y))!==-1;)v[y-1]!=="\\"&&(v=v.slice(0,y)+"\\"+v.slice(y)),y+=3;return v},f.remove=function(m,v){return typeof m!="string"?"":handlebarsUtils.isString(v)?m.split(v).join(""):m},f.removeFirst=function(m,v){return typeof m!="string"?"":handlebarsUtils.isString(v)?m.replace(v,""):m},f.replace=function(m,v,y){return typeof m!="string"?"":handlebarsUtils.isString(v)?(handlebarsUtils.isString(y)||(y=""),m.split(v).join(y)):m},f.replaceFirst=function(m,v,y){return typeof m!="string"?"":handlebarsUtils.isString(v)?(handlebarsUtils.isString(y)||(y=""),m.replace(v,y)):m},f.reverse=array$1.reverse,f.sentence=function(m){return typeof m!="string"?"":m.replace(/((?:\S[^\.\?\!]*)[\.\?\!]*)/g,function(v){return v.charAt(0).toUpperCase()+v.substr(1).toLowerCase()})},f.snakecase=function(m){return typeof m!="string"?"":utils$2.changecase(m,function(v){return"_"+v})},f.split=function(m,v){return typeof m!="string"?"":(handlebarsUtils.isString(v)||(v=","),m.split(v))},f.startsWith=function(m,v,y){return y=[].slice.call(arguments).pop(),handlebarsUtils.isString(v)&&v.indexOf(m)===0?y.fn(this):typeof y.inverse=="function"?y.inverse(this):""},f.titleize=function(m){if(typeof m!="string")return"";for(var v=m.replace(/[- _]+/g," ").split(" "),y=v.length,w=[],k=0;y--;){var S=v[k++];w.push(u.capitalize(S))}return w.join(" ")},f.trim=function(m){return typeof m=="string"?m.trim():""},f.trimLeft=function(m){if(handlebarsUtils.isString(m))return m.replace(/^\s+/,"")},f.trimRight=function(m){if(handlebarsUtils.isString(m))return m.replace(/\s+$/,"")},f.truncate=function(m,v,y){if(handlebarsUtils.isString(m))return typeof y!="string"&&(y=""),m.length>v?m.slice(0,v-y.length)+y:m},f.truncateWords=function(m,v,y){if(handlebarsUtils.isString(m)&&!isNaN(v)){typeof y!="string"&&(y="…");var w=Number(v),k=m.split(/[ \t]/);return w>=k.length?m:(k=k.slice(0,w)).join(" ").trim()+y}},f.upcase=function(){return f.uppercase.apply(this,arguments)},f.uppercase=function(m){return handlebarsUtils.isObject(m)&&m.fn?m.fn(this).toUpperCase():typeof m!="string"?"":m.toUpperCase()},f.lorem=function(m){return(isNaN(m)||m<1||!m)&&(m=11),lorem_1.substring(0,m)}}),maxInt=2147483647,base=36,tMin=1,tMax=26,skew=38,damp=700,initialBias=72,initialN=128,delimiter="-",regexNonASCII=/[^\x20-\x7E]/,regexSeparators=/[\x2E\u3002\uFF0E\uFF61]/g,errors={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},baseMinusTMin=base-tMin,floor=Math.floor,stringFromCharCode=String.fromCharCode;function error(p){throw new RangeError(errors[p])}function map$1(p,u){for(var f=p.length,m=[];f--;)m[f]=u(p[f]);return m}function mapDomain(p,u){var f=p.split("@"),m="";return f.length>1&&(m=f[0]+"@",p=f[1]),m+map$1((p=p.replace(regexSeparators,".")).split("."),u).join(".")}function ucs2decode(p){for(var u,f,m=[],v=0,y=p.length;v<y;)(u=p.charCodeAt(v++))>=55296&&u<=56319&&v<y?(64512&(f=p.charCodeAt(v++)))==56320?m.push(((1023&u)<<10)+(1023&f)+65536):(m.push(u),v--):m.push(u);return m}function digitToBasic(p,u){return p+22+75*(p<26)-((u!=0)<<5)}function adapt(p,u,f){var m=0;for(p=f?floor(p/damp):p>>1,p+=floor(p/u);p>baseMinusTMin*tMax>>1;m+=base)p=floor(p/baseMinusTMin);return floor(m+(baseMinusTMin+1)*p/(p+skew))}function encode$3(p){var u,f,m,v,y,w,k,S,M,E,T,H,V,q,Z,J=[];for(H=(p=ucs2decode(p)).length,u=initialN,f=0,y=initialBias,w=0;w<H;++w)(T=p[w])<128&&J.push(stringFromCharCode(T));for(m=v=J.length,v&&J.push(delimiter);m<H;){for(k=maxInt,w=0;w<H;++w)(T=p[w])>=u&&T<k&&(k=T);for(k-u>floor((maxInt-f)/(V=m+1))&&error("overflow"),f+=(k-u)*V,u=k,w=0;w<H;++w)if((T=p[w])<u&&++f>maxInt&&error("overflow"),T==u){for(S=f,M=base;!(S<(E=M<=y?tMin:M>=y+tMax?tMax:M-y));M+=base)Z=S-E,q=base-E,J.push(stringFromCharCode(digitToBasic(E+Z%q,0))),S=floor(Z/q);J.push(stringFromCharCode(digitToBasic(S,0))),y=adapt(f,V,m==v),f=0,++m}++f,++u}return J.join("")}function toASCII(p){return mapDomain(p,function(u){return regexNonASCII.test(u)?"xn--"+encode$3(u):u})}function hasOwnProperty(p,u){return Object.prototype.hasOwnProperty.call(p,u)}var isArray=Array.isArray||function(p){return Object.prototype.toString.call(p)==="[object Array]"};function stringifyPrimitive(p){switch(typeof p){case"string":return p;case"boolean":return p?"true":"false";case"number":return isFinite(p)?p:"";default:return""}}function stringify$6(p,u,f,m){return u=u||"&",f=f||"=",p===null&&(p=void 0),typeof p=="object"?map$2(objectKeys(p),function(v){var y=encodeURIComponent(stringifyPrimitive(v))+f;return isArray(p[v])?map$2(p[v],function(w){return y+encodeURIComponent(stringifyPrimitive(w))}).join(u):y+encodeURIComponent(stringifyPrimitive(p[v]))}).join(u):m?encodeURIComponent(stringifyPrimitive(m))+f+encodeURIComponent(stringifyPrimitive(p)):""}function map$2(p,u){if(p.map)return p.map(u);for(var f=[],m=0;m<p.length;m++)f.push(u(p[m],m));return f}var objectKeys=Object.keys||function(p){var u=[];for(var f in p)Object.prototype.hasOwnProperty.call(p,f)&&u.push(f);return u};function parse$1$1(p,u,f,m){u=u||"&",f=f||"=";var v={};if(typeof p!="string"||p.length===0)return v;var y=/\+/g;p=p.split(u);var w=1e3;m&&typeof m.maxKeys=="number"&&(w=m.maxKeys);var k=p.length;w>0&&k>w&&(k=w);for(var S=0;S<k;++S){var M,E,T,H,V=p[S].replace(y,"%20"),q=V.indexOf(f);q>=0?(M=V.substr(0,q),E=V.substr(q+1)):(M=V,E=""),T=decodeURIComponent(M),H=decodeURIComponent(E),hasOwnProperty(v,T)?isArray(v[T])?v[T].push(H):v[T]=[v[T],H]:v[T]=H}return v}var querystring$1={encode:stringify$6,stringify:stringify$6,decode:parse$1$1,parse:parse$1$1};const URL$1=global$1.URL,URLSearchParams$1=global$1.URLSearchParams;var url$1={parse:urlParse,resolve:urlResolve,resolveObject:urlResolveObject,fileURLToPath:urlFileURLToPath,format:urlFormat,Url,URL:URL$1,URLSearchParams:URLSearchParams$1};function Url(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var protocolPattern=/^([a-z0-9.+-]+:)/i,portPattern=/:[0-9]*$/,simplePathPattern=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,delims=["<",">",'"',"`"," ","\r",`
298
- `," "],unwise=["{","}","|","\\","^","`"].concat(delims),autoEscape=["'"].concat(unwise),nonHostChars=["%","/","?",";","#"].concat(autoEscape),hostEndingChars=["/","?","#"],hostnameMaxLen=255,hostnamePartPattern=/^[+a-z0-9A-Z_-]{0,63}$/,hostnamePartStart=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,unsafeProtocol={javascript:!0,"javascript:":!0},hostlessProtocol={javascript:!0,"javascript:":!0},slashedProtocol={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function urlParse(p,u,f){if(p&&isObject$4(p)&&p instanceof Url)return p;var m=new Url;return m.parse(p,u,f),m}function parse$7(p,u,f,m){if(!isString(u))throw new TypeError("Parameter 'url' must be a string, not "+typeof u);var v=u.indexOf("?"),y=v!==-1&&v<u.indexOf("#")?"?":"#",w=u.split(y);w[0]=w[0].replace(/\\/g,"/");var k=u=w.join(y);if(k=k.trim(),!m&&u.split("#").length===1){var S=simplePathPattern.exec(k);if(S)return p.path=k,p.href=k,p.pathname=S[1],S[2]?(p.search=S[2],p.query=f?parse$1$1(p.search.substr(1)):p.search.substr(1)):f&&(p.search="",p.query={}),p}var M,E,T,H,V=protocolPattern.exec(k);if(V){var q=(V=V[0]).toLowerCase();p.protocol=q,k=k.substr(V.length)}if(m||V||k.match(/^\/\/[^@\/]+@[^@\/]+/)){var Z=k.substr(0,2)==="//";!Z||V&&hostlessProtocol[V]||(k=k.substr(2),p.slashes=!0)}if(!hostlessProtocol[V]&&(Z||V&&!slashedProtocol[V])){var J,ae,ie=-1;for(M=0;M<hostEndingChars.length;M++)(E=k.indexOf(hostEndingChars[M]))!==-1&&(ie===-1||E<ie)&&(ie=E);for((ae=ie===-1?k.lastIndexOf("@"):k.lastIndexOf("@",ie))!==-1&&(J=k.slice(0,ae),k=k.slice(ae+1),p.auth=decodeURIComponent(J)),ie=-1,M=0;M<nonHostChars.length;M++)(E=k.indexOf(nonHostChars[M]))!==-1&&(ie===-1||E<ie)&&(ie=E);ie===-1&&(ie=k.length),p.host=k.slice(0,ie),k=k.slice(ie),parseHost(p),p.hostname=p.hostname||"";var he=p.hostname[0]==="["&&p.hostname[p.hostname.length-1]==="]";if(!he){var fe=p.hostname.split(/\./);for(M=0,T=fe.length;M<T;M++){var me=fe[M];if(me&&!me.match(hostnamePartPattern)){for(var be="",Ce=0,ze=me.length;Ce<ze;Ce++)me.charCodeAt(Ce)>127?be+="x":be+=me[Ce];if(!be.match(hostnamePartPattern)){var Se=fe.slice(0,M),Ie=fe.slice(M+1),xe=me.match(hostnamePartStart);xe&&(Se.push(xe[1]),Ie.unshift(xe[2])),Ie.length&&(k="/"+Ie.join(".")+k),p.hostname=Se.join(".");break}}}}p.hostname.length>hostnameMaxLen?p.hostname="":p.hostname=p.hostname.toLowerCase(),he||(p.hostname=toASCII(p.hostname)),H=p.port?":"+p.port:"";var Ne=p.hostname||"";p.host=Ne+H,p.href+=p.host,he&&(p.hostname=p.hostname.substr(1,p.hostname.length-2),k[0]!=="/"&&(k="/"+k))}if(!unsafeProtocol[q])for(M=0,T=autoEscape.length;M<T;M++){var $e=autoEscape[M];if(k.indexOf($e)!==-1){var Ze=encodeURIComponent($e);Ze===$e&&(Ze=escape($e)),k=k.split($e).join(Ze)}}var ve=k.indexOf("#");ve!==-1&&(p.hash=k.substr(ve),k=k.slice(0,ve));var Re=k.indexOf("?");if(Re!==-1?(p.search=k.substr(Re),p.query=k.substr(Re+1),f&&(p.query=parse$1$1(p.query)),k=k.slice(0,Re)):f&&(p.search="",p.query={}),k&&(p.pathname=k),slashedProtocol[q]&&p.hostname&&!p.pathname&&(p.pathname="/"),p.pathname||p.search){H=p.pathname||"";var Qe=p.search||"";p.path=H+Qe}return p.href=format$2(p),p}function urlFileURLToPath(p){if(typeof p=="string")p=new Url().parse(p);else if(!(p instanceof Url))throw new TypeError('The "path" argument must be of type string or an instance of URL. Received type '+typeof p+String(p));if(p.protocol!=="file:")throw new TypeError("The URL must be of scheme file");return getPathFromURLPosix(p)}function getPathFromURLPosix(p){const u=p.pathname;for(let f=0;f<u.length;f++)if(u[f]==="%"){const m=32|u.codePointAt(f+2);if(u[f+1]==="2"&&m===102)throw new TypeError("must not include encoded / characters")}return decodeURIComponent(u)}function urlFormat(p){return isString(p)&&(p=parse$7({},p)),format$2(p)}function format$2(p){var u=p.auth||"";u&&(u=(u=encodeURIComponent(u)).replace(/%3A/i,":"),u+="@");var f=p.protocol||"",m=p.pathname||"",v=p.hash||"",y=!1,w="";p.host?y=u+p.host:p.hostname&&(y=u+(p.hostname.indexOf(":")===-1?p.hostname:"["+this.hostname+"]"),p.port&&(y+=":"+p.port)),p.query&&isObject$4(p.query)&&Object.keys(p.query).length&&(w=stringify$6(p.query));var k=p.search||w&&"?"+w||"";return f&&f.substr(-1)!==":"&&(f+=":"),p.slashes||(!f||slashedProtocol[f])&&y!==!1?(y="//"+(y||""),m&&m.charAt(0)!=="/"&&(m="/"+m)):y||(y=""),v&&v.charAt(0)!=="#"&&(v="#"+v),k&&k.charAt(0)!=="?"&&(k="?"+k),m=m.replace(/[?#]/g,function(S){return encodeURIComponent(S)}),f+y+m+(k=k.replace("#","%23"))+v}function urlResolve(p,u){return urlParse(p,!1,!0).resolve(u)}function urlResolveObject(p,u){return p?urlParse(p,!1,!0).resolveObject(u):u}function parseHost(p){var u=p.host,f=portPattern.exec(u);f&&((f=f[0])!==":"&&(p.port=f.substr(1)),u=u.substr(0,u.length-f.length)),u&&(p.hostname=u)}Url.prototype.parse=function(p,u,f){return parse$7(this,p,u,f)},Url.prototype.format=function(){return format$2(this)},Url.prototype.resolve=function(p){return this.resolveObject(urlParse(p,!1,!0)).format()},Url.prototype.resolveObject=function(p){if(isString(p)){var u=new Url;u.parse(p,!1,!0),p=u}for(var f,m=new Url,v=Object.keys(this),y=0;y<v.length;y++){var w=v[y];m[w]=this[w]}if(m.hash=p.hash,p.href==="")return m.href=m.format(),m;if(p.slashes&&!p.protocol){for(var k=Object.keys(p),S=0;S<k.length;S++){var M=k[S];M!=="protocol"&&(m[M]=p[M])}return slashedProtocol[m.protocol]&&m.hostname&&!m.pathname&&(m.path=m.pathname="/"),m.href=m.format(),m}if(p.protocol&&p.protocol!==m.protocol){if(!slashedProtocol[p.protocol]){for(var E=Object.keys(p),T=0;T<E.length;T++){var H=E[T];m[H]=p[H]}return m.href=m.format(),m}if(m.protocol=p.protocol,p.host||hostlessProtocol[p.protocol])m.pathname=p.pathname;else{for(f=(p.pathname||"").split("/");f.length&&!(p.host=f.shift()););p.host||(p.host=""),p.hostname||(p.hostname=""),f[0]!==""&&f.unshift(""),f.length<2&&f.unshift(""),m.pathname=f.join("/")}if(m.search=p.search,m.query=p.query,m.host=p.host||"",m.auth=p.auth,m.hostname=p.hostname||p.host,m.port=p.port,m.pathname||m.search){var V=m.pathname||"",q=m.search||"";m.path=V+q}return m.slashes=m.slashes||p.slashes,m.href=m.format(),m}var Z,J=m.pathname&&m.pathname.charAt(0)==="/",ae=p.host||p.pathname&&p.pathname.charAt(0)==="/",ie=ae||J||m.host&&p.pathname,he=ie,fe=m.pathname&&m.pathname.split("/")||[],me=m.protocol&&!slashedProtocol[m.protocol];if(f=p.pathname&&p.pathname.split("/")||[],me&&(m.hostname="",m.port=null,m.host&&(fe[0]===""?fe[0]=m.host:fe.unshift(m.host)),m.host="",p.protocol&&(p.hostname=null,p.port=null,p.host&&(f[0]===""?f[0]=p.host:f.unshift(p.host)),p.host=null),ie=ie&&(f[0]===""||fe[0]==="")),ae)m.host=p.host||p.host===""?p.host:m.host,m.hostname=p.hostname||p.hostname===""?p.hostname:m.hostname,m.search=p.search,m.query=p.query,fe=f;else if(f.length)fe||(fe=[]),fe.pop(),fe=fe.concat(f),m.search=p.search,m.query=p.query;else if(!isNullOrUndefined$1(p.search))return me&&(m.hostname=m.host=fe.shift(),(Z=!!(m.host&&m.host.indexOf("@")>0)&&m.host.split("@"))&&(m.auth=Z.shift(),m.host=m.hostname=Z.shift())),m.search=p.search,m.query=p.query,isNull(m.pathname)&&isNull(m.search)||(m.path=(m.pathname?m.pathname:"")+(m.search?m.search:"")),m.href=m.format(),m;if(!fe.length)return m.pathname=null,m.search?m.path="/"+m.search:m.path=null,m.href=m.format(),m;for(var be=fe.slice(-1)[0],Ce=(m.host||p.host||fe.length>1)&&(be==="."||be==="..")||be==="",ze=0,Se=fe.length;Se>=0;Se--)(be=fe[Se])==="."?fe.splice(Se,1):be===".."?(fe.splice(Se,1),ze++):ze&&(fe.splice(Se,1),ze--);if(!ie&&!he)for(;ze--;ze)fe.unshift("..");!ie||fe[0]===""||fe[0]&&fe[0].charAt(0)==="/"||fe.unshift(""),Ce&&fe.join("/").substr(-1)!=="/"&&fe.push("");var Ie=fe[0]===""||fe[0]&&fe[0].charAt(0)==="/";return me&&(m.hostname=m.host=Ie?"":fe.length?fe.shift():"",(Z=!!(m.host&&m.host.indexOf("@")>0)&&m.host.split("@"))&&(m.auth=Z.shift(),m.host=m.hostname=Z.shift())),(ie=ie||m.host&&fe.length)&&!Ie&&fe.unshift(""),fe.length?m.pathname=fe.join("/"):(m.pathname=null,m.path=null),isNull(m.pathname)&&isNull(m.search)||(m.path=(m.pathname?m.pathname:"")+(m.search?m.search:"")),m.auth=p.auth||m.auth,m.slashes=m.slashes||p.slashes,m.href=m.format(),m},Url.prototype.parseHost=function(){return parseHost(this)};var url_1=createCommonjsModule(function(p){var u=p.exports;u.encodeURI=function(f){if(handlebarsUtils.isString(f))return encodeURIComponent(f)},u.escape=function(f){if(handlebarsUtils.isString(f))return querystring$1.escape(f)},u.decodeURI=function(f){if(handlebarsUtils.isString(f))return decodeURIComponent(f)},u.urlResolve=function(f,m){return url$1.resolve(f,m)},u.urlParse=function(f){return url$1.parse(f)},u.stripQuerystring=function(f){if(handlebarsUtils.isString(f))return f.split("?")[0]},u.stripProtocol=function(f){if(handlebarsUtils.isString(f)){var m=url$1.parse(f);return m.protocol="",m.format()}}}),_default=rng;let getRandomValues;const rnds8=new Uint8Array(16);function rng(){if(!getRandomValues&&(getRandomValues=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!getRandomValues))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return getRandomValues(rnds8)}var rng_1=Object.defineProperty({default:_default},"__esModule",{value:!0}),regex$1=createCommonjsModule(function(p,u){Object.defineProperty(u,"__esModule",{value:!0}),u.default=void 0,u.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i}),validate_1=createCommonjsModule(function(p,u){Object.defineProperty(u,"__esModule",{value:!0}),u.default=void 0;var f,m=(f=regex$1)&&f.__esModule?f:{default:f},v=function(y){return typeof y=="string"&&m.default.test(y)};u.default=v}),stringify_1$1=createCommonjsModule(function(p,u){Object.defineProperty(u,"__esModule",{value:!0}),u.default=void 0,u.unsafeStringify=y;var f,m=(f=validate_1)&&f.__esModule?f:{default:f};const v=[];for(let k=0;k<256;++k)v.push((k+256).toString(16).slice(1));function y(k,S=0){return v[k[S+0]]+v[k[S+1]]+v[k[S+2]]+v[k[S+3]]+"-"+v[k[S+4]]+v[k[S+5]]+"-"+v[k[S+6]]+v[k[S+7]]+"-"+v[k[S+8]]+v[k[S+9]]+"-"+v[k[S+10]]+v[k[S+11]]+v[k[S+12]]+v[k[S+13]]+v[k[S+14]]+v[k[S+15]]}var w=function(k,S=0){const M=y(k,S);if(!(0,m.default)(M))throw TypeError("Stringified UUID is invalid");return M};u.default=w}),v1_1=createCommonjsModule(function(p,u){Object.defineProperty(u,"__esModule",{value:!0}),u.default=void 0;var f,m=(f=rng_1)&&f.__esModule?f:{default:f};let v,y,w=0,k=0;var S=function(M,E,T){let H=E&&T||0;const V=E||new Array(16);let q=(M=M||{}).node||v,Z=M.clockseq!==void 0?M.clockseq:y;if(q==null||Z==null){const me=M.random||(M.rng||m.default)();q==null&&(q=v=[1|me[0],me[1],me[2],me[3],me[4],me[5]]),Z==null&&(Z=y=16383&(me[6]<<8|me[7]))}let J=M.msecs!==void 0?M.msecs:Date.now(),ae=M.nsecs!==void 0?M.nsecs:k+1;const ie=J-w+(ae-k)/1e4;if(ie<0&&M.clockseq===void 0&&(Z=Z+1&16383),(ie<0||J>w)&&M.nsecs===void 0&&(ae=0),ae>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");w=J,k=ae,y=Z,J+=122192928e5;const he=(1e4*(268435455&J)+ae)%4294967296;V[H++]=he>>>24&255,V[H++]=he>>>16&255,V[H++]=he>>>8&255,V[H++]=255&he;const fe=J/4294967296*1e4&268435455;V[H++]=fe>>>8&255,V[H++]=255&fe,V[H++]=fe>>>24&15|16,V[H++]=fe>>>16&255,V[H++]=Z>>>8|128,V[H++]=255&Z;for(let me=0;me<6;++me)V[H+me]=q[me];return E||(0,stringify_1$1.unsafeStringify)(V)};u.default=S}),parse_1$4=createCommonjsModule(function(p,u){Object.defineProperty(u,"__esModule",{value:!0}),u.default=void 0;var f,m=(f=validate_1)&&f.__esModule?f:{default:f},v=function(y){if(!(0,m.default)(y))throw TypeError("Invalid UUID");let w;const k=new Uint8Array(16);return k[0]=(w=parseInt(y.slice(0,8),16))>>>24,k[1]=w>>>16&255,k[2]=w>>>8&255,k[3]=255&w,k[4]=(w=parseInt(y.slice(9,13),16))>>>8,k[5]=255&w,k[6]=(w=parseInt(y.slice(14,18),16))>>>8,k[7]=255&w,k[8]=(w=parseInt(y.slice(19,23),16))>>>8,k[9]=255&w,k[10]=(w=parseInt(y.slice(24,36),16))/1099511627776&255,k[11]=w/4294967296&255,k[12]=w>>>24&255,k[13]=w>>>16&255,k[14]=w>>>8&255,k[15]=255&w,k};u.default=v}),v35_1=createCommonjsModule(function(p,u){Object.defineProperty(u,"__esModule",{value:!0}),u.URL=u.DNS=void 0,u.default=function(w,k,S){function M(E,T,H,V){var q;if(typeof E=="string"&&(E=function(J){J=unescape(encodeURIComponent(J));const ae=[];for(let ie=0;ie<J.length;++ie)ae.push(J.charCodeAt(ie));return ae}(E)),typeof T=="string"&&(T=(0,m.default)(T)),((q=T)===null||q===void 0?void 0:q.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let Z=new Uint8Array(16+E.length);if(Z.set(T),Z.set(E,T.length),Z=S(Z),Z[6]=15&Z[6]|k,Z[8]=63&Z[8]|128,H){V=V||0;for(let J=0;J<16;++J)H[V+J]=Z[J];return H}return(0,stringify_1$1.unsafeStringify)(Z)}try{M.name=w}catch{}return M.DNS=v,M.URL=y,M};var f,m=(f=parse_1$4)&&f.__esModule?f:{default:f};const v="6ba7b810-9dad-11d1-80b4-00c04fd430c8";u.DNS=v;const y="6ba7b811-9dad-11d1-80b4-00c04fd430c8";u.URL=y}),md5_1=createCommonjsModule(function(p,u){function f(E){return 14+(E+64>>>9<<4)+1}function m(E,T){const H=(65535&E)+(65535&T);return(E>>16)+(T>>16)+(H>>16)<<16|65535&H}function v(E,T,H,V,q,Z){return m((J=m(m(T,E),m(V,Z)))<<(ae=q)|J>>>32-ae,H);var J,ae}function y(E,T,H,V,q,Z,J){return v(T&H|~T&V,E,T,q,Z,J)}function w(E,T,H,V,q,Z,J){return v(T&V|H&~V,E,T,q,Z,J)}function k(E,T,H,V,q,Z,J){return v(T^H^V,E,T,q,Z,J)}function S(E,T,H,V,q,Z,J){return v(H^(T|~V),E,T,q,Z,J)}Object.defineProperty(u,"__esModule",{value:!0}),u.default=void 0;var M=function(E){if(typeof E=="string"){const T=unescape(encodeURIComponent(E));E=new Uint8Array(T.length);for(let H=0;H<T.length;++H)E[H]=T.charCodeAt(H)}return function(T){const H=[],V=32*T.length,q="0123456789abcdef";for(let Z=0;Z<V;Z+=8){const J=T[Z>>5]>>>Z%32&255,ae=parseInt(q.charAt(J>>>4&15)+q.charAt(15&J),16);H.push(ae)}return H}(function(T,H){T[H>>5]|=128<<H%32,T[f(H)-1]=H;let V=1732584193,q=-271733879,Z=-1732584194,J=271733878;for(let ae=0;ae<T.length;ae+=16){const ie=V,he=q,fe=Z,me=J;V=y(V,q,Z,J,T[ae],7,-680876936),J=y(J,V,q,Z,T[ae+1],12,-389564586),Z=y(Z,J,V,q,T[ae+2],17,606105819),q=y(q,Z,J,V,T[ae+3],22,-1044525330),V=y(V,q,Z,J,T[ae+4],7,-176418897),J=y(J,V,q,Z,T[ae+5],12,1200080426),Z=y(Z,J,V,q,T[ae+6],17,-1473231341),q=y(q,Z,J,V,T[ae+7],22,-45705983),V=y(V,q,Z,J,T[ae+8],7,1770035416),J=y(J,V,q,Z,T[ae+9],12,-1958414417),Z=y(Z,J,V,q,T[ae+10],17,-42063),q=y(q,Z,J,V,T[ae+11],22,-1990404162),V=y(V,q,Z,J,T[ae+12],7,1804603682),J=y(J,V,q,Z,T[ae+13],12,-40341101),Z=y(Z,J,V,q,T[ae+14],17,-1502002290),q=y(q,Z,J,V,T[ae+15],22,1236535329),V=w(V,q,Z,J,T[ae+1],5,-165796510),J=w(J,V,q,Z,T[ae+6],9,-1069501632),Z=w(Z,J,V,q,T[ae+11],14,643717713),q=w(q,Z,J,V,T[ae],20,-373897302),V=w(V,q,Z,J,T[ae+5],5,-701558691),J=w(J,V,q,Z,T[ae+10],9,38016083),Z=w(Z,J,V,q,T[ae+15],14,-660478335),q=w(q,Z,J,V,T[ae+4],20,-405537848),V=w(V,q,Z,J,T[ae+9],5,568446438),J=w(J,V,q,Z,T[ae+14],9,-1019803690),Z=w(Z,J,V,q,T[ae+3],14,-187363961),q=w(q,Z,J,V,T[ae+8],20,1163531501),V=w(V,q,Z,J,T[ae+13],5,-1444681467),J=w(J,V,q,Z,T[ae+2],9,-51403784),Z=w(Z,J,V,q,T[ae+7],14,1735328473),q=w(q,Z,J,V,T[ae+12],20,-1926607734),V=k(V,q,Z,J,T[ae+5],4,-378558),J=k(J,V,q,Z,T[ae+8],11,-2022574463),Z=k(Z,J,V,q,T[ae+11],16,1839030562),q=k(q,Z,J,V,T[ae+14],23,-35309556),V=k(V,q,Z,J,T[ae+1],4,-1530992060),J=k(J,V,q,Z,T[ae+4],11,1272893353),Z=k(Z,J,V,q,T[ae+7],16,-155497632),q=k(q,Z,J,V,T[ae+10],23,-1094730640),V=k(V,q,Z,J,T[ae+13],4,681279174),J=k(J,V,q,Z,T[ae],11,-358537222),Z=k(Z,J,V,q,T[ae+3],16,-722521979),q=k(q,Z,J,V,T[ae+6],23,76029189),V=k(V,q,Z,J,T[ae+9],4,-640364487),J=k(J,V,q,Z,T[ae+12],11,-421815835),Z=k(Z,J,V,q,T[ae+15],16,530742520),q=k(q,Z,J,V,T[ae+2],23,-995338651),V=S(V,q,Z,J,T[ae],6,-198630844),J=S(J,V,q,Z,T[ae+7],10,1126891415),Z=S(Z,J,V,q,T[ae+14],15,-1416354905),q=S(q,Z,J,V,T[ae+5],21,-57434055),V=S(V,q,Z,J,T[ae+12],6,1700485571),J=S(J,V,q,Z,T[ae+3],10,-1894986606),Z=S(Z,J,V,q,T[ae+10],15,-1051523),q=S(q,Z,J,V,T[ae+1],21,-2054922799),V=S(V,q,Z,J,T[ae+8],6,1873313359),J=S(J,V,q,Z,T[ae+15],10,-30611744),Z=S(Z,J,V,q,T[ae+6],15,-1560198380),q=S(q,Z,J,V,T[ae+13],21,1309151649),V=S(V,q,Z,J,T[ae+4],6,-145523070),J=S(J,V,q,Z,T[ae+11],10,-1120210379),Z=S(Z,J,V,q,T[ae+2],15,718787259),q=S(q,Z,J,V,T[ae+9],21,-343485551),V=m(V,ie),q=m(q,he),Z=m(Z,fe),J=m(J,me)}return[V,q,Z,J]}(function(T){if(T.length===0)return[];const H=8*T.length,V=new Uint32Array(f(H));for(let q=0;q<H;q+=8)V[q>>5]|=(255&T[q/8])<<q%32;return V}(E),8*E.length))};u.default=M}),v3_1=createCommonjsModule(function(p,u){Object.defineProperty(u,"__esModule",{value:!0}),u.default=void 0;var f=v(v35_1),m=v(md5_1);function v(w){return w&&w.__esModule?w:{default:w}}var y=(0,f.default)("v3",48,m.default);u.default=y}),native=createCommonjsModule(function(p,u){Object.defineProperty(u,"__esModule",{value:!0}),u.default=void 0;var f={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};u.default=f}),v4_1=createCommonjsModule(function(p,u){Object.defineProperty(u,"__esModule",{value:!0}),u.default=void 0;var f=v(native),m=v(rng_1);function v(w){return w&&w.__esModule?w:{default:w}}var y=function(w,k,S){if(f.default.randomUUID&&!k&&!w)return f.default.randomUUID();const M=(w=w||{}).random||(w.rng||m.default)();if(M[6]=15&M[6]|64,M[8]=63&M[8]|128,k){S=S||0;for(let E=0;E<16;++E)k[S+E]=M[E];return k}return(0,stringify_1$1.unsafeStringify)(M)};u.default=y}),sha1_1=createCommonjsModule(function(p,u){function f(y,w,k,S){switch(y){case 0:return w&k^~w&S;case 1:case 3:return w^k^S;case 2:return w&k^w&S^k&S}}function m(y,w){return y<<w|y>>>32-w}Object.defineProperty(u,"__esModule",{value:!0}),u.default=void 0;var v=function(y){const w=[1518500249,1859775393,2400959708,3395469782],k=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof y=="string"){const T=unescape(encodeURIComponent(y));y=[];for(let H=0;H<T.length;++H)y.push(T.charCodeAt(H))}else Array.isArray(y)||(y=Array.prototype.slice.call(y));y.push(128);const S=y.length/4+2,M=Math.ceil(S/16),E=new Array(M);for(let T=0;T<M;++T){const H=new Uint32Array(16);for(let V=0;V<16;++V)H[V]=y[64*T+4*V]<<24|y[64*T+4*V+1]<<16|y[64*T+4*V+2]<<8|y[64*T+4*V+3];E[T]=H}E[M-1][14]=8*(y.length-1)/Math.pow(2,32),E[M-1][14]=Math.floor(E[M-1][14]),E[M-1][15]=8*(y.length-1)&4294967295;for(let T=0;T<M;++T){const H=new Uint32Array(80);for(let ie=0;ie<16;++ie)H[ie]=E[T][ie];for(let ie=16;ie<80;++ie)H[ie]=m(H[ie-3]^H[ie-8]^H[ie-14]^H[ie-16],1);let V=k[0],q=k[1],Z=k[2],J=k[3],ae=k[4];for(let ie=0;ie<80;++ie){const he=Math.floor(ie/20),fe=m(V,5)+f(he,q,Z,J)+ae+w[he]+H[ie]>>>0;ae=J,J=Z,Z=m(q,30)>>>0,q=V,V=fe}k[0]=k[0]+V>>>0,k[1]=k[1]+q>>>0,k[2]=k[2]+Z>>>0,k[3]=k[3]+J>>>0,k[4]=k[4]+ae>>>0}return[k[0]>>24&255,k[0]>>16&255,k[0]>>8&255,255&k[0],k[1]>>24&255,k[1]>>16&255,k[1]>>8&255,255&k[1],k[2]>>24&255,k[2]>>16&255,k[2]>>8&255,255&k[2],k[3]>>24&255,k[3]>>16&255,k[3]>>8&255,255&k[3],k[4]>>24&255,k[4]>>16&255,k[4]>>8&255,255&k[4]]};u.default=v}),v5_1=createCommonjsModule(function(p,u){Object.defineProperty(u,"__esModule",{value:!0}),u.default=void 0;var f=v(v35_1),m=v(sha1_1);function v(w){return w&&w.__esModule?w:{default:w}}var y=(0,f.default)("v5",80,m.default);u.default=y}),nil=createCommonjsModule(function(p,u){Object.defineProperty(u,"__esModule",{value:!0}),u.default=void 0,u.default="00000000-0000-0000-0000-000000000000"}),version_1=createCommonjsModule(function(p,u){Object.defineProperty(u,"__esModule",{value:!0}),u.default=void 0;var f,m=(f=validate_1)&&f.__esModule?f:{default:f},v=function(y){if(!(0,m.default)(y))throw TypeError("Invalid UUID");return parseInt(y.slice(14,15),16)};u.default=v}),commonjsBrowser=createCommonjsModule(function(p,u){Object.defineProperty(u,"__esModule",{value:!0}),Object.defineProperty(u,"NIL",{enumerable:!0,get:function(){return w.default}}),Object.defineProperty(u,"parse",{enumerable:!0,get:function(){return E.default}}),Object.defineProperty(u,"stringify",{enumerable:!0,get:function(){return M.default}}),Object.defineProperty(u,"v1",{enumerable:!0,get:function(){return f.default}}),Object.defineProperty(u,"v3",{enumerable:!0,get:function(){return m.default}}),Object.defineProperty(u,"v4",{enumerable:!0,get:function(){return v.default}}),Object.defineProperty(u,"v5",{enumerable:!0,get:function(){return y.default}}),Object.defineProperty(u,"validate",{enumerable:!0,get:function(){return S.default}}),Object.defineProperty(u,"version",{enumerable:!0,get:function(){return k.default}});var f=T(v1_1),m=T(v3_1),v=T(v4_1),y=T(v5_1),w=T(nil),k=T(version_1),S=T(validate_1),M=T(stringify_1$1),E=T(parse_1$4);function T(H){return H&&H.__esModule?H:{default:H}}}),uuid$1=commonjsBrowser,uuid_1=createCommonjsModule(function(p){p.exports.uuid=function(){return uuid$1.v4()}}),lib$7={array:array$1,code,collection,comparison:comparison$1,html:html_1,i18n,inflection,match,math:math$1,misc,number:number$1,object:object$1,path:path_1,regex:regex$2,string:string$1,url:url_1,uuid:uuid_1},handlebarsHelpers=createCommonjsModule(function(p){p.exports=function(u,f){typeof u=="string"?u=[u]:Array.isArray(u)||(f=u,u=null);var m=(f=f||{}).handlebars||f.hbs||handlebars;if(p.exports.handlebars=m,u)u.forEach(function(v){m.registerHelper(lib$7[v])});else for(const v in lib$7){const y=lib$7[v];m.registerHelper(y)}return m.helpers};for(const u in lib$7){const f=lib$7[u];p.exports[u]=function(m){var v=(m=m||{}).handlebars||m.hbs||handlebars;return p.exports.handlebars=v,v.registerHelper(f),f}}p.exports.utils=utils$2}),dayjs_min=createCommonjsModule(function(p,u){p.exports=function(){var f=1e3,m=6e4,v=36e5,y="millisecond",w="second",k="minute",S="hour",M="day",E="week",T="month",H="quarter",V="year",q="date",Z="Invalid Date",J=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,ae=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,ie={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(Ze){var ve=["th","st","nd","rd"],Re=Ze%100;return"["+Ze+(ve[(Re-20)%10]||ve[Re]||ve[0])+"]"}},he=function(Ze,ve,Re){var Qe=String(Ze);return!Qe||Qe.length>=ve?Ze:""+Array(ve+1-Qe.length).join(Re)+Ze},fe={s:he,z:function(Ze){var ve=-Ze.utcOffset(),Re=Math.abs(ve),Qe=Math.floor(Re/60),Fe=Re%60;return(ve<=0?"+":"-")+he(Qe,2,"0")+":"+he(Fe,2,"0")},m:function Ze(ve,Re){if(ve.date()<Re.date())return-Ze(Re,ve);var Qe=12*(Re.year()-ve.year())+(Re.month()-ve.month()),Fe=ve.clone().add(Qe,T),Je=Re-Fe<0,ft=ve.clone().add(Qe+(Je?-1:1),T);return+(-(Qe+(Re-Fe)/(Je?Fe-ft:ft-Fe))||0)},a:function(Ze){return Ze<0?Math.ceil(Ze)||0:Math.floor(Ze)},p:function(Ze){return{M:T,y:V,w:E,d:M,D:q,h:S,m:k,s:w,ms:y,Q:H}[Ze]||String(Ze||"").toLowerCase().replace(/s$/,"")},u:function(Ze){return Ze===void 0}},me="en",be={};be[me]=ie;var Ce="$isDayjsObject",ze=function(Ze){return Ze instanceof Ne||!(!Ze||!Ze[Ce])},Se=function Ze(ve,Re,Qe){var Fe;if(!ve)return me;if(typeof ve=="string"){var Je=ve.toLowerCase();be[Je]&&(Fe=Je),Re&&(be[Je]=Re,Fe=Je);var ft=ve.split("-");if(!Fe&&ft.length>1)return Ze(ft[0])}else{var Et=ve.name;be[Et]=ve,Fe=Et}return!Qe&&Fe&&(me=Fe),Fe||!Qe&&me},Ie=function(Ze,ve){if(ze(Ze))return Ze.clone();var Re=typeof ve=="object"?ve:{};return Re.date=Ze,Re.args=arguments,new Ne(Re)},xe=fe;xe.l=Se,xe.i=ze,xe.w=function(Ze,ve){return Ie(Ze,{locale:ve.$L,utc:ve.$u,x:ve.$x,$offset:ve.$offset})};var Ne=function(){function Ze(Re){this.$L=Se(Re.locale,null,!0),this.parse(Re),this.$x=this.$x||Re.x||{},this[Ce]=!0}var ve=Ze.prototype;return ve.parse=function(Re){this.$d=function(Qe){var Fe=Qe.date,Je=Qe.utc;if(Fe===null)return new Date(NaN);if(xe.u(Fe))return new Date;if(Fe instanceof Date)return new Date(Fe);if(typeof Fe=="string"&&!/Z$/i.test(Fe)){var ft=Fe.match(J);if(ft){var Et=ft[2]-1||0,qe=(ft[7]||"0").substring(0,3);return Je?new Date(Date.UTC(ft[1],Et,ft[3]||1,ft[4]||0,ft[5]||0,ft[6]||0,qe)):new Date(ft[1],Et,ft[3]||1,ft[4]||0,ft[5]||0,ft[6]||0,qe)}}return new Date(Fe)}(Re),this.init()},ve.init=function(){var Re=this.$d;this.$y=Re.getFullYear(),this.$M=Re.getMonth(),this.$D=Re.getDate(),this.$W=Re.getDay(),this.$H=Re.getHours(),this.$m=Re.getMinutes(),this.$s=Re.getSeconds(),this.$ms=Re.getMilliseconds()},ve.$utils=function(){return xe},ve.isValid=function(){return this.$d.toString()!==Z},ve.isSame=function(Re,Qe){var Fe=Ie(Re);return this.startOf(Qe)<=Fe&&Fe<=this.endOf(Qe)},ve.isAfter=function(Re,Qe){return Ie(Re)<this.startOf(Qe)},ve.isBefore=function(Re,Qe){return this.endOf(Qe)<Ie(Re)},ve.$g=function(Re,Qe,Fe){return xe.u(Re)?this[Qe]:this.set(Fe,Re)},ve.unix=function(){return Math.floor(this.valueOf()/1e3)},ve.valueOf=function(){return this.$d.getTime()},ve.startOf=function(Re,Qe){var Fe=this,Je=!!xe.u(Qe)||Qe,ft=xe.p(Re),Et=function(Ut,en){var Nt=xe.w(Fe.$u?Date.UTC(Fe.$y,en,Ut):new Date(Fe.$y,en,Ut),Fe);return Je?Nt:Nt.endOf(M)},qe=function(Ut,en){return xe.w(Fe.toDate()[Ut].apply(Fe.toDate("s"),(Je?[0,0,0,0]:[23,59,59,999]).slice(en)),Fe)},Ge=this.$W,dt=this.$M,xt=this.$D,ot="set"+(this.$u?"UTC":"");switch(ft){case V:return Je?Et(1,0):Et(31,11);case T:return Je?Et(1,dt):Et(0,dt+1);case E:var jt=this.$locale().weekStart||0,Xe=(Ge<jt?Ge+7:Ge)-jt;return Et(Je?xt-Xe:xt+(6-Xe),dt);case M:case q:return qe(ot+"Hours",0);case S:return qe(ot+"Minutes",1);case k:return qe(ot+"Seconds",2);case w:return qe(ot+"Milliseconds",3);default:return this.clone()}},ve.endOf=function(Re){return this.startOf(Re,!1)},ve.$set=function(Re,Qe){var Fe,Je=xe.p(Re),ft="set"+(this.$u?"UTC":""),Et=(Fe={},Fe[M]=ft+"Date",Fe[q]=ft+"Date",Fe[T]=ft+"Month",Fe[V]=ft+"FullYear",Fe[S]=ft+"Hours",Fe[k]=ft+"Minutes",Fe[w]=ft+"Seconds",Fe[y]=ft+"Milliseconds",Fe)[Je],qe=Je===M?this.$D+(Qe-this.$W):Qe;if(Je===T||Je===V){var Ge=this.clone().set(q,1);Ge.$d[Et](qe),Ge.init(),this.$d=Ge.set(q,Math.min(this.$D,Ge.daysInMonth())).$d}else Et&&this.$d[Et](qe);return this.init(),this},ve.set=function(Re,Qe){return this.clone().$set(Re,Qe)},ve.get=function(Re){return this[xe.p(Re)]()},ve.add=function(Re,Qe){var Fe,Je=this;Re=Number(Re);var ft=xe.p(Qe),Et=function(dt){var xt=Ie(Je);return xe.w(xt.date(xt.date()+Math.round(dt*Re)),Je)};if(ft===T)return this.set(T,this.$M+Re);if(ft===V)return this.set(V,this.$y+Re);if(ft===M)return Et(1);if(ft===E)return Et(7);var qe=(Fe={},Fe[k]=m,Fe[S]=v,Fe[w]=f,Fe)[ft]||1,Ge=this.$d.getTime()+Re*qe;return xe.w(Ge,this)},ve.subtract=function(Re,Qe){return this.add(-1*Re,Qe)},ve.format=function(Re){var Qe=this,Fe=this.$locale();if(!this.isValid())return Fe.invalidDate||Z;var Je=Re||"YYYY-MM-DDTHH:mm:ssZ",ft=xe.z(this),Et=this.$H,qe=this.$m,Ge=this.$M,dt=Fe.weekdays,xt=Fe.months,ot=Fe.meridiem,jt=function(en,Nt,kt,yt){return en&&(en[Nt]||en(Qe,Je))||kt[Nt].slice(0,yt)},Xe=function(en){return xe.s(Et%12||12,en,"0")},Ut=ot||function(en,Nt,kt){var yt=en<12?"AM":"PM";return kt?yt.toLowerCase():yt};return Je.replace(ae,function(en,Nt){return Nt||function(kt){switch(kt){case"YY":return String(Qe.$y).slice(-2);case"YYYY":return xe.s(Qe.$y,4,"0");case"M":return Ge+1;case"MM":return xe.s(Ge+1,2,"0");case"MMM":return jt(Fe.monthsShort,Ge,xt,3);case"MMMM":return jt(xt,Ge);case"D":return Qe.$D;case"DD":return xe.s(Qe.$D,2,"0");case"d":return String(Qe.$W);case"dd":return jt(Fe.weekdaysMin,Qe.$W,dt,2);case"ddd":return jt(Fe.weekdaysShort,Qe.$W,dt,3);case"dddd":return dt[Qe.$W];case"H":return String(Et);case"HH":return xe.s(Et,2,"0");case"h":return Xe(1);case"hh":return Xe(2);case"a":return Ut(Et,qe,!0);case"A":return Ut(Et,qe,!1);case"m":return String(qe);case"mm":return xe.s(qe,2,"0");case"s":return String(Qe.$s);case"ss":return xe.s(Qe.$s,2,"0");case"SSS":return xe.s(Qe.$ms,3,"0");case"Z":return ft}return null}(en)||ft.replace(":","")})},ve.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},ve.diff=function(Re,Qe,Fe){var Je,ft=this,Et=xe.p(Qe),qe=Ie(Re),Ge=(qe.utcOffset()-this.utcOffset())*m,dt=this-qe,xt=function(){return xe.m(ft,qe)};switch(Et){case V:Je=xt()/12;break;case T:Je=xt();break;case H:Je=xt()/3;break;case E:Je=(dt-Ge)/6048e5;break;case M:Je=(dt-Ge)/864e5;break;case S:Je=dt/v;break;case k:Je=dt/m;break;case w:Je=dt/f;break;default:Je=dt}return Fe?Je:xe.a(Je)},ve.daysInMonth=function(){return this.endOf(T).$D},ve.$locale=function(){return be[this.$L]},ve.locale=function(Re,Qe){if(!Re)return this.$L;var Fe=this.clone(),Je=Se(Re,Qe,!0);return Je&&(Fe.$L=Je),Fe},ve.clone=function(){return xe.w(this.$d,this)},ve.toDate=function(){return new Date(this.valueOf())},ve.toJSON=function(){return this.isValid()?this.toISOString():null},ve.toISOString=function(){return this.$d.toISOString()},ve.toString=function(){return this.$d.toUTCString()},Ze}(),$e=Ne.prototype;return Ie.prototype=$e,[["$ms",y],["$s",w],["$m",k],["$H",S],["$W",M],["$M",T],["$y",V],["$D",q]].forEach(function(Ze){$e[Ze[1]]=function(ve){return this.$g(ve,Ze[0],Ze[1])}}),Ie.extend=function(Ze,ve){return Ze.$i||(Ze(ve,Ne,Ie),Ze.$i=!0),Ie},Ie.locale=Se,Ie.isDayjs=ze,Ie.unix=function(Ze){return Ie(1e3*Ze)},Ie.en=be[me],Ie.Ls=be,Ie.p={},Ie}()}),duration$1$1=createCommonjsModule(function(p,u){var f,m,v,y,w,k,S,M,E,T,H,V,q,Z,J,ae,ie,he,fe,me;p.exports=(S=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,T=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,H={years:M=31536e6,months:E=2628e6,days:k=864e5,hours:w=36e5,minutes:y=6e4,seconds:v=1e3,milliseconds:1,weeks:6048e5},V=function(be){return be instanceof fe},q=function(be,Ce,ze){return new fe(be,ze,Ce.$l)},Z=function(be){return m.p(be)+"s"},J=function(be){return be<0},ae=function(be){return J(be)?Math.ceil(be):Math.floor(be)},ie=function(be){return Math.abs(be)},he=function(be,Ce){return be?J(be)?{negative:!0,format:""+ie(be)+Ce}:{negative:!1,format:""+be+Ce}:{negative:!1,format:""}},fe=function(){function be(ze,Se,Ie){var xe=this;if(this.$d={},this.$l=Ie,ze===void 0&&(this.$ms=0,this.parseFromMilliseconds()),Se)return q(ze*H[Z(Se)],this);if(typeof ze=="number")return this.$ms=ze,this.parseFromMilliseconds(),this;if(typeof ze=="object")return Object.keys(ze).forEach(function(Ze){xe.$d[Z(Ze)]=ze[Ze]}),this.calMilliseconds(),this;if(typeof ze=="string"){var Ne=ze.match(T);if(Ne){var $e=Ne.slice(2).map(function(Ze){return Ze!=null?Number(Ze):0});return this.$d.years=$e[0],this.$d.months=$e[1],this.$d.weeks=$e[2],this.$d.days=$e[3],this.$d.hours=$e[4],this.$d.minutes=$e[5],this.$d.seconds=$e[6],this.calMilliseconds(),this}}return this}var Ce=be.prototype;return Ce.calMilliseconds=function(){var ze=this;this.$ms=Object.keys(this.$d).reduce(function(Se,Ie){return Se+(ze.$d[Ie]||0)*H[Ie]},0)},Ce.parseFromMilliseconds=function(){var ze=this.$ms;this.$d.years=ae(ze/M),ze%=M,this.$d.months=ae(ze/E),ze%=E,this.$d.days=ae(ze/k),ze%=k,this.$d.hours=ae(ze/w),ze%=w,this.$d.minutes=ae(ze/y),ze%=y,this.$d.seconds=ae(ze/v),ze%=v,this.$d.milliseconds=ze},Ce.toISOString=function(){var ze=he(this.$d.years,"Y"),Se=he(this.$d.months,"M"),Ie=+this.$d.days||0;this.$d.weeks&&(Ie+=7*this.$d.weeks);var xe=he(Ie,"D"),Ne=he(this.$d.hours,"H"),$e=he(this.$d.minutes,"M"),Ze=this.$d.seconds||0;this.$d.milliseconds&&(Ze+=this.$d.milliseconds/1e3,Ze=Math.round(1e3*Ze)/1e3);var ve=he(Ze,"S"),Re=ze.negative||Se.negative||xe.negative||Ne.negative||$e.negative||ve.negative,Qe=Ne.format||$e.format||ve.format?"T":"",Fe=(Re?"-":"")+"P"+ze.format+Se.format+xe.format+Qe+Ne.format+$e.format+ve.format;return Fe==="P"||Fe==="-P"?"P0D":Fe},Ce.toJSON=function(){return this.toISOString()},Ce.format=function(ze){var Se=ze||"YYYY-MM-DDTHH:mm:ss",Ie={Y:this.$d.years,YY:m.s(this.$d.years,2,"0"),YYYY:m.s(this.$d.years,4,"0"),M:this.$d.months,MM:m.s(this.$d.months,2,"0"),D:this.$d.days,DD:m.s(this.$d.days,2,"0"),H:this.$d.hours,HH:m.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:m.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:m.s(this.$d.seconds,2,"0"),SSS:m.s(this.$d.milliseconds,3,"0")};return Se.replace(S,function(xe,Ne){return Ne||String(Ie[xe])})},Ce.as=function(ze){return this.$ms/H[Z(ze)]},Ce.get=function(ze){var Se=this.$ms,Ie=Z(ze);return Ie==="milliseconds"?Se%=1e3:Se=Ie==="weeks"?ae(Se/H[Ie]):this.$d[Ie],Se||0},Ce.add=function(ze,Se,Ie){var xe;return xe=Se?ze*H[Z(Se)]:V(ze)?ze.$ms:q(ze,this).$ms,q(this.$ms+xe*(Ie?-1:1),this)},Ce.subtract=function(ze,Se){return this.add(ze,Se,!0)},Ce.locale=function(ze){var Se=this.clone();return Se.$l=ze,Se},Ce.clone=function(){return q(this.$ms,this)},Ce.humanize=function(ze){return f().add(this.$ms,"ms").locale(this.$l).fromNow(!ze)},Ce.valueOf=function(){return this.asMilliseconds()},Ce.milliseconds=function(){return this.get("milliseconds")},Ce.asMilliseconds=function(){return this.as("milliseconds")},Ce.seconds=function(){return this.get("seconds")},Ce.asSeconds=function(){return this.as("seconds")},Ce.minutes=function(){return this.get("minutes")},Ce.asMinutes=function(){return this.as("minutes")},Ce.hours=function(){return this.get("hours")},Ce.asHours=function(){return this.as("hours")},Ce.days=function(){return this.get("days")},Ce.asDays=function(){return this.as("days")},Ce.weeks=function(){return this.get("weeks")},Ce.asWeeks=function(){return this.as("weeks")},Ce.months=function(){return this.get("months")},Ce.asMonths=function(){return this.as("months")},Ce.years=function(){return this.get("years")},Ce.asYears=function(){return this.as("years")},be}(),me=function(be,Ce,ze){return be.add(Ce.years()*ze,"y").add(Ce.months()*ze,"M").add(Ce.days()*ze,"d").add(Ce.hours()*ze,"h").add(Ce.minutes()*ze,"m").add(Ce.seconds()*ze,"s").add(Ce.milliseconds()*ze,"ms")},function(be,Ce,ze){f=ze,m=ze().$utils(),ze.duration=function(xe,Ne){var $e=ze.locale();return q(xe,{$l:$e},Ne)},ze.isDuration=V;var Se=Ce.prototype.add,Ie=Ce.prototype.subtract;Ce.prototype.add=function(xe,Ne){return V(xe)?me(this,xe,1):Se.bind(this)(xe,Ne)},Ce.prototype.subtract=function(xe,Ne){return V(xe)?me(this,xe,-1):Ie.bind(this)(xe,Ne)}})}),advancedFormat=createCommonjsModule(function(p,u){p.exports=function(f,m){var v=m.prototype,y=v.format;v.format=function(w){var k=this,S=this.$locale();if(!this.isValid())return y.bind(this)(w);var M=this.$utils(),E=(w||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,function(T){switch(T){case"Q":return Math.ceil((k.$M+1)/3);case"Do":return S.ordinal(k.$D);case"gggg":return k.weekYear();case"GGGG":return k.isoWeekYear();case"wo":return S.ordinal(k.week(),"W");case"w":case"ww":return M.s(k.week(),T==="w"?1:2,"0");case"W":case"WW":return M.s(k.isoWeek(),T==="W"?1:2,"0");case"k":case"kk":return M.s(String(k.$H===0?24:k.$H),T==="k"?1:2,"0");case"X":return Math.floor(k.$d.getTime()/1e3);case"x":return k.$d.getTime();case"z":return"["+k.offsetName()+"]";case"zzz":return"["+k.offsetName("long")+"]";default:return T}});return y.bind(this)(E)}}}),isoWeek=createCommonjsModule(function(p,u){var f;p.exports=(f="day",function(m,v,y){var w=function(M){return M.add(4-M.isoWeekday(),f)},k=v.prototype;k.isoWeekYear=function(){return w(this).year()},k.isoWeek=function(M){if(!this.$utils().u(M))return this.add(7*(M-this.isoWeek()),f);var E,T,H,V=w(this),q=(E=this.isoWeekYear(),H=4-(T=(this.$u?y.utc:y)().year(E).startOf("year")).isoWeekday(),T.isoWeekday()>4&&(H+=7),T.add(H,f));return V.diff(q,"week")+1},k.isoWeekday=function(M){return this.$utils().u(M)?this.day()||7:this.day(this.day()%7?M:M-7)};var S=k.startOf;k.startOf=function(M,E){var T=this.$utils(),H=!!T.u(E)||E;return T.p(M)==="isoweek"?H?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):S.bind(this)(M,E)}})}),weekYear=createCommonjsModule(function(p,u){p.exports=function(f,m){m.prototype.weekYear=function(){var v=this.month(),y=this.week(),w=this.year();return y===1&&v===11?w+1:v===0&&y>=52?w-1:w}}}),weekOfYear=createCommonjsModule(function(p,u){var f,m;p.exports=(f="week",m="year",function(v,y,w){var k=y.prototype;k.week=function(S){if(S===void 0&&(S=null),S!==null)return this.add(7*(S-this.week()),"day");var M=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var E=w(this).startOf(m).add(1,m).date(M),T=w(this).endOf(f);if(E.isBefore(T))return 1}var H=w(this).startOf(m).date(M).startOf(f).subtract(1,"millisecond"),V=this.diff(H,f,!0);return V<0?w(this).startOf("week").week():Math.ceil(V)},k.weeks=function(S){return S===void 0&&(S=null),this.week(S)}})}),relativeTime=createCommonjsModule(function(p,u){p.exports=function(f,m,v){f=f||{};var y=m.prototype,w={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function k(M,E,T,H){return y.fromToBase(M,E,T,H)}v.en.relativeTime=w,y.fromToBase=function(M,E,T,H,V){for(var q,Z,J,ae=T.$locale().relativeTime||w,ie=f.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],he=ie.length,fe=0;fe<he;fe+=1){var me=ie[fe];me.d&&(q=H?v(M).diff(T,me.d,!0):T.diff(M,me.d,!0));var be=(f.rounding||Math.round)(Math.abs(q));if(J=q>0,be<=me.r||!me.r){be<=1&&fe>0&&(me=ie[fe-1]);var Ce=ae[me.l];V&&(be=V(""+be)),Z=typeof Ce=="string"?Ce.replace("%d",be):Ce(be,E,me.l,J);break}}if(E)return Z;var ze=J?ae.future:ae.past;return typeof ze=="function"?ze(Z):ze.replace("%s",Z)},y.to=function(M,E){return k(M,E,this,!0)},y.from=function(M,E){return k(M,E,this)};var S=function(M){return M.$u?v.utc():v()};y.toNow=function(M){return this.to(S(this),M)},y.fromNow=function(M){return this.from(S(this),M)}}}),utc$2=createCommonjsModule(function(p,u){var f,m,v;p.exports=(f="minute",m=/[+-]\d\d(?::?\d\d)?/g,v=/([+-]|\d\d)/g,function(y,w,k){var S=w.prototype;k.utc=function(Z){return new w({date:Z,utc:!0,args:arguments})},S.utc=function(Z){var J=k(this.toDate(),{locale:this.$L,utc:!0});return Z?J.add(this.utcOffset(),f):J},S.local=function(){return k(this.toDate(),{locale:this.$L,utc:!1})};var M=S.parse;S.parse=function(Z){Z.utc&&(this.$u=!0),this.$utils().u(Z.$offset)||(this.$offset=Z.$offset),M.call(this,Z)};var E=S.init;S.init=function(){if(this.$u){var Z=this.$d;this.$y=Z.getUTCFullYear(),this.$M=Z.getUTCMonth(),this.$D=Z.getUTCDate(),this.$W=Z.getUTCDay(),this.$H=Z.getUTCHours(),this.$m=Z.getUTCMinutes(),this.$s=Z.getUTCSeconds(),this.$ms=Z.getUTCMilliseconds()}else E.call(this)};var T=S.utcOffset;S.utcOffset=function(Z,J){var ae=this.$utils().u;if(ae(Z))return this.$u?0:ae(this.$offset)?T.call(this):this.$offset;if(typeof Z=="string"&&(Z=function(me){me===void 0&&(me="");var be=me.match(m);if(!be)return null;var Ce=(""+be[0]).match(v)||["-",0,0],ze=Ce[0],Se=60*+Ce[1]+ +Ce[2];return Se===0?0:ze==="+"?Se:-Se}(Z),Z===null))return this;var ie=Math.abs(Z)<=16?60*Z:Z,he=this;if(J)return he.$offset=ie,he.$u=Z===0,he;if(Z!==0){var fe=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(he=this.local().add(ie+fe,f)).$offset=ie,he.$x.$localOffset=fe}else he=this.utc();return he};var H=S.format;S.format=function(Z){var J=Z||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return H.call(this,J)},S.valueOf=function(){var Z=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*Z},S.isUTC=function(){return!!this.$u},S.toISOString=function(){return this.toDate().toISOString()},S.toString=function(){return this.toDate().toUTCString()};var V=S.toDate;S.toDate=function(Z){return Z==="s"&&this.$offset?k(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():V.call(this)};var q=S.diff;S.diff=function(Z,J,ae){if(Z&&this.$u===Z.$u)return q.call(this,Z,J,ae);var ie=this.local(),he=k(Z).local();return q.call(ie,he,J,ae)}})}),timezone=createCommonjsModule(function(p,u){var f,m;p.exports=(f={year:0,month:1,day:2,hour:3,minute:4,second:5},m={},function(v,y,w){var k,S=function(H,V,q){q===void 0&&(q={});var Z=new Date(H),J=function(ae,ie){ie===void 0&&(ie={});var he=ie.timeZoneName||"short",fe=ae+"|"+he,me=m[fe];return me||(me=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:ae,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:he}),m[fe]=me),me}(V,q);return J.formatToParts(Z)},M=function(H,V){for(var q=S(H,V),Z=[],J=0;J<q.length;J+=1){var ae=q[J],ie=ae.type,he=ae.value,fe=f[ie];fe>=0&&(Z[fe]=parseInt(he,10))}var me=Z[3],be=me===24?0:me,Ce=Z[0]+"-"+Z[1]+"-"+Z[2]+" "+be+":"+Z[4]+":"+Z[5]+":000",ze=+H;return(w.utc(Ce).valueOf()-(ze-=ze%1e3))/6e4},E=y.prototype;E.tz=function(H,V){H===void 0&&(H=k);var q,Z=this.utcOffset(),J=this.toDate(),ae=J.toLocaleString("en-US",{timeZone:H}),ie=Math.round((J-new Date(ae))/1e3/60),he=15*-Math.round(J.getTimezoneOffset()/15)-ie;if(Number(he)){if(q=w(ae,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(he,!0),V){var fe=q.utcOffset();q=q.add(Z-fe,"minute")}}else q=this.utcOffset(0,V);return q.$x.$timezone=H,q},E.offsetName=function(H){var V=this.$x.$timezone||w.tz.guess(),q=S(this.valueOf(),V,{timeZoneName:H}).find(function(Z){return Z.type.toLowerCase()==="timezonename"});return q&&q.value};var T=E.startOf;E.startOf=function(H,V){if(!this.$x||!this.$x.$timezone)return T.call(this,H,V);var q=w(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return T.call(q,H,V).tz(this.$x.$timezone,!0)},w.tz=function(H,V,q){var Z=q&&V,J=q||V||k,ae=M(+w(),J);if(typeof H!="string")return w(H).tz(J);var ie=function(be,Ce,ze){var Se=be-60*Ce*1e3,Ie=M(Se,ze);if(Ce===Ie)return[Se,Ce];var xe=M(Se-=60*(Ie-Ce)*1e3,ze);return Ie===xe?[Se,Ie]:[be-60*Math.min(Ie,xe)*1e3,Math.max(Ie,xe)]}(w.utc(H,Z).valueOf(),ae,J),he=ie[0],fe=ie[1],me=w(he).utcOffset(fe);return me.$x.$timezone=J,me},w.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},w.tz.setDefault=function(H){k=H}})});function isOptions(p){return typeof p=="object"&&typeof p.hash=="object"}function isApp(p){return typeof p=="object"&&typeof p.options=="object"&&typeof p.app=="object"}function getContext(p,u,f){if(isOptions(p))return getContext({},u,p);if(isOptions(u))return getContext(p,f,u);const m=isApp(p)?p.context:{};isOptions(f=f||{})||(u=Object.assign({},u,f)),isOptions(f)&&f.hash.root===!0&&(u=Object.assign({},f.data.root,u));let v=Object.assign({},m,u,f.hash);return isApp(p)||(v=Object.assign({},p,v)),isApp(p)&&p.view&&p.view.data&&(v=Object.assign({},v,p.view.data)),v}function initialConfig(p,u,f){return isOptions(u)&&(f=u,u=null),isOptions(p)&&(f=p,u=null,p=null),{str:p,pattern:u,options:f}}function setLocale(p,u,f){const m=initialConfig(p,u,f),v=getContext(this,{lang:"en",date:new Date(m.str)},{});dayjs_min.locale(v.lang||v.language)}dayjs_min.extend(duration$1$1),dayjs_min.extend(advancedFormat),dayjs_min.extend(isoWeek),dayjs_min.extend(weekYear),dayjs_min.extend(weekOfYear),dayjs_min.extend(relativeTime),dayjs_min.extend(utc$2),dayjs_min.extend(timezone);const date$1=(p,u,f)=>{const m=initialConfig(p,u,f);if(m.str==null&&m.pattern==null)return dayjs_min.locale("en"),dayjs_min().format("MMMM DD, YYYY");setLocale(m.str,m.pattern,m.options);let v=dayjs_min(new Date(m.str));return v=typeof m.options=="string"?m.options.toLowerCase()==="utc"?v.utc():v.tz(m.options):v.tz(dayjs_min.tz.guess()),m.pattern===""?v.toISOString():v.format(m.pattern)},duration$3=(p,u,f)=>{const m=initialConfig(p,u);setLocale(m.str,m.pattern);const v=dayjs_min.duration(m.str,m.pattern);return f&&!isOptions(f)?v.format(f):v.humanize()},HelperFunctionBuiltin=["#if","#unless","#each","#with","lookup","log","blockHelperMissing","each","helperMissing","if","unless","log","lookup","with"],EXTERNAL_FUNCTION_COLLECTIONS=["math","array","number","url","string","comparison","object","regex","uuid"],HelperFunctionNames={OBJECT:"object",ALL:"all",LITERAL:"literal",JS:"js"},LITERAL_MARKER="%LITERAL%",ADDED_HELPERS={date:date$1,duration:duration$3};function registerAll$1(p){for(let[f,m]of Object.entries(ADDED_HELPERS))p.registerHelper(f,m);let u=[];for(let f of EXTERNAL_FUNCTION_COLLECTIONS){let m=handlebarsHelpers[f]();for(let v of Object.entries(m)){const y=v[0];HelperFunctionBuiltin.indexOf(y)===-1&&u.indexOf(y)===-1&&u.push(y)}handlebarsHelpers[f]({handlebars:p})}externalHelperNames=u.concat(Object.keys(ADDED_HELPERS))}let externalHelperNames=[];const ALPHA_NUMERIC_REGEX=/^[A-Za-z0-9]+$/g,FIND_HBS_REGEX=/{{([^{].*?)}}/g,FIND_ANY_HBS_REGEX=/{?{{([^{].*?)}}}?/g,FIND_TRIPLE_HBS_REGEX=/{{{([^{].*?)}}}/g,isJest=()=>typeof jest<"u",isBackendService=()=>!isJest()&&typeof window>"u",isJSAllowed=()=>browser&&!browser.env.NO_JS,findDoubleHbsInstances=p=>{let u=p;const f=new RegExp(FIND_HBS_REGEX),m=new RegExp(FIND_TRIPLE_HBS_REGEX),v=u.match(m);return v&&v.forEach(w=>{u=u.replace(w,"")}),u.match(f)||[]},isAlphaNumeric=p=>p.match(ALPHA_NUMERIC_REGEX),swapStrings=(p,u,f,m)=>p.slice(0,u)+m+p.slice(u+f),atob$1=p=>Buffer$1.from(p,"base64").toString("utf-8"),prefixStrings=(p,u,f)=>{const m=u.map(y=>y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),v=new RegExp(`\\b(${m.join("|")})\\b`,"g");return p.replace(v,`${f}$1`)},externalCollections={math:math$1,array:array$1,number:number$1,url:url_1,string:string$1,comparison:comparison$1,object:object$1,regex:regex$2,uuid:uuid_1},helpersToRemoveForJs=["sortBy"],addedHelpers={date:date$1,duration:duration$3};let helpers$3;function getJsHelperList(){if(helpers$3)return helpers$3;helpers$3={};for(let p of Object.values(externalCollections))for(let[u,f]of Object.entries(p))helpers$3[u]=(...m)=>f(...m,{});helpers$3=Object.assign(Object.assign({},helpers$3),addedHelpers);for(const p of helpersToRemoveForJs)delete helpers$3[p];return Object.freeze(helpers$3),helpers$3}const iifeWrapper=p=>`(function(){
298
+ `," "],unwise=["{","}","|","\\","^","`"].concat(delims),autoEscape=["'"].concat(unwise),nonHostChars=["%","/","?",";","#"].concat(autoEscape),hostEndingChars=["/","?","#"],hostnameMaxLen=255,hostnamePartPattern=/^[+a-z0-9A-Z_-]{0,63}$/,hostnamePartStart=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,unsafeProtocol={javascript:!0,"javascript:":!0},hostlessProtocol={javascript:!0,"javascript:":!0},slashedProtocol={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function urlParse(p,u,f){if(p&&isObject$4(p)&&p instanceof Url)return p;var m=new Url;return m.parse(p,u,f),m}function parse$7(p,u,f,m){if(!isString(u))throw new TypeError("Parameter 'url' must be a string, not "+typeof u);var v=u.indexOf("?"),y=v!==-1&&v<u.indexOf("#")?"?":"#",w=u.split(y);w[0]=w[0].replace(/\\/g,"/");var k=u=w.join(y);if(k=k.trim(),!m&&u.split("#").length===1){var S=simplePathPattern.exec(k);if(S)return p.path=k,p.href=k,p.pathname=S[1],S[2]?(p.search=S[2],p.query=f?parse$1$1(p.search.substr(1)):p.search.substr(1)):f&&(p.search="",p.query={}),p}var M,E,T,H,V=protocolPattern.exec(k);if(V){var q=(V=V[0]).toLowerCase();p.protocol=q,k=k.substr(V.length)}if(m||V||k.match(/^\/\/[^@\/]+@[^@\/]+/)){var Z=k.substr(0,2)==="//";!Z||V&&hostlessProtocol[V]||(k=k.substr(2),p.slashes=!0)}if(!hostlessProtocol[V]&&(Z||V&&!slashedProtocol[V])){var J,ae,ie=-1;for(M=0;M<hostEndingChars.length;M++)(E=k.indexOf(hostEndingChars[M]))!==-1&&(ie===-1||E<ie)&&(ie=E);for((ae=ie===-1?k.lastIndexOf("@"):k.lastIndexOf("@",ie))!==-1&&(J=k.slice(0,ae),k=k.slice(ae+1),p.auth=decodeURIComponent(J)),ie=-1,M=0;M<nonHostChars.length;M++)(E=k.indexOf(nonHostChars[M]))!==-1&&(ie===-1||E<ie)&&(ie=E);ie===-1&&(ie=k.length),p.host=k.slice(0,ie),k=k.slice(ie),parseHost(p),p.hostname=p.hostname||"";var he=p.hostname[0]==="["&&p.hostname[p.hostname.length-1]==="]";if(!he){var fe=p.hostname.split(/\./);for(M=0,T=fe.length;M<T;M++){var me=fe[M];if(me&&!me.match(hostnamePartPattern)){for(var be="",Ce=0,ze=me.length;Ce<ze;Ce++)me.charCodeAt(Ce)>127?be+="x":be+=me[Ce];if(!be.match(hostnamePartPattern)){var Se=fe.slice(0,M),Ie=fe.slice(M+1),xe=me.match(hostnamePartStart);xe&&(Se.push(xe[1]),Ie.unshift(xe[2])),Ie.length&&(k="/"+Ie.join(".")+k),p.hostname=Se.join(".");break}}}}p.hostname.length>hostnameMaxLen?p.hostname="":p.hostname=p.hostname.toLowerCase(),he||(p.hostname=toASCII(p.hostname)),H=p.port?":"+p.port:"";var Ne=p.hostname||"";p.host=Ne+H,p.href+=p.host,he&&(p.hostname=p.hostname.substr(1,p.hostname.length-2),k[0]!=="/"&&(k="/"+k))}if(!unsafeProtocol[q])for(M=0,T=autoEscape.length;M<T;M++){var $e=autoEscape[M];if(k.indexOf($e)!==-1){var Ze=encodeURIComponent($e);Ze===$e&&(Ze=escape($e)),k=k.split($e).join(Ze)}}var ve=k.indexOf("#");ve!==-1&&(p.hash=k.substr(ve),k=k.slice(0,ve));var Re=k.indexOf("?");if(Re!==-1?(p.search=k.substr(Re),p.query=k.substr(Re+1),f&&(p.query=parse$1$1(p.query)),k=k.slice(0,Re)):f&&(p.search="",p.query={}),k&&(p.pathname=k),slashedProtocol[q]&&p.hostname&&!p.pathname&&(p.pathname="/"),p.pathname||p.search){H=p.pathname||"";var Qe=p.search||"";p.path=H+Qe}return p.href=format$2(p),p}function urlFileURLToPath(p){if(typeof p=="string")p=new Url().parse(p);else if(!(p instanceof Url))throw new TypeError('The "path" argument must be of type string or an instance of URL. Received type '+typeof p+String(p));if(p.protocol!=="file:")throw new TypeError("The URL must be of scheme file");return getPathFromURLPosix(p)}function getPathFromURLPosix(p){const u=p.pathname;for(let f=0;f<u.length;f++)if(u[f]==="%"){const m=32|u.codePointAt(f+2);if(u[f+1]==="2"&&m===102)throw new TypeError("must not include encoded / characters")}return decodeURIComponent(u)}function urlFormat(p){return isString(p)&&(p=parse$7({},p)),format$2(p)}function format$2(p){var u=p.auth||"";u&&(u=(u=encodeURIComponent(u)).replace(/%3A/i,":"),u+="@");var f=p.protocol||"",m=p.pathname||"",v=p.hash||"",y=!1,w="";p.host?y=u+p.host:p.hostname&&(y=u+(p.hostname.indexOf(":")===-1?p.hostname:"["+this.hostname+"]"),p.port&&(y+=":"+p.port)),p.query&&isObject$4(p.query)&&Object.keys(p.query).length&&(w=stringify$6(p.query));var k=p.search||w&&"?"+w||"";return f&&f.substr(-1)!==":"&&(f+=":"),p.slashes||(!f||slashedProtocol[f])&&y!==!1?(y="//"+(y||""),m&&m.charAt(0)!=="/"&&(m="/"+m)):y||(y=""),v&&v.charAt(0)!=="#"&&(v="#"+v),k&&k.charAt(0)!=="?"&&(k="?"+k),m=m.replace(/[?#]/g,function(S){return encodeURIComponent(S)}),f+y+m+(k=k.replace("#","%23"))+v}function urlResolve(p,u){return urlParse(p,!1,!0).resolve(u)}function urlResolveObject(p,u){return p?urlParse(p,!1,!0).resolveObject(u):u}function parseHost(p){var u=p.host,f=portPattern.exec(u);f&&((f=f[0])!==":"&&(p.port=f.substr(1)),u=u.substr(0,u.length-f.length)),u&&(p.hostname=u)}Url.prototype.parse=function(p,u,f){return parse$7(this,p,u,f)},Url.prototype.format=function(){return format$2(this)},Url.prototype.resolve=function(p){return this.resolveObject(urlParse(p,!1,!0)).format()},Url.prototype.resolveObject=function(p){if(isString(p)){var u=new Url;u.parse(p,!1,!0),p=u}for(var f,m=new Url,v=Object.keys(this),y=0;y<v.length;y++){var w=v[y];m[w]=this[w]}if(m.hash=p.hash,p.href==="")return m.href=m.format(),m;if(p.slashes&&!p.protocol){for(var k=Object.keys(p),S=0;S<k.length;S++){var M=k[S];M!=="protocol"&&(m[M]=p[M])}return slashedProtocol[m.protocol]&&m.hostname&&!m.pathname&&(m.path=m.pathname="/"),m.href=m.format(),m}if(p.protocol&&p.protocol!==m.protocol){if(!slashedProtocol[p.protocol]){for(var E=Object.keys(p),T=0;T<E.length;T++){var H=E[T];m[H]=p[H]}return m.href=m.format(),m}if(m.protocol=p.protocol,p.host||hostlessProtocol[p.protocol])m.pathname=p.pathname;else{for(f=(p.pathname||"").split("/");f.length&&!(p.host=f.shift()););p.host||(p.host=""),p.hostname||(p.hostname=""),f[0]!==""&&f.unshift(""),f.length<2&&f.unshift(""),m.pathname=f.join("/")}if(m.search=p.search,m.query=p.query,m.host=p.host||"",m.auth=p.auth,m.hostname=p.hostname||p.host,m.port=p.port,m.pathname||m.search){var V=m.pathname||"",q=m.search||"";m.path=V+q}return m.slashes=m.slashes||p.slashes,m.href=m.format(),m}var Z,J=m.pathname&&m.pathname.charAt(0)==="/",ae=p.host||p.pathname&&p.pathname.charAt(0)==="/",ie=ae||J||m.host&&p.pathname,he=ie,fe=m.pathname&&m.pathname.split("/")||[],me=m.protocol&&!slashedProtocol[m.protocol];if(f=p.pathname&&p.pathname.split("/")||[],me&&(m.hostname="",m.port=null,m.host&&(fe[0]===""?fe[0]=m.host:fe.unshift(m.host)),m.host="",p.protocol&&(p.hostname=null,p.port=null,p.host&&(f[0]===""?f[0]=p.host:f.unshift(p.host)),p.host=null),ie=ie&&(f[0]===""||fe[0]==="")),ae)m.host=p.host||p.host===""?p.host:m.host,m.hostname=p.hostname||p.hostname===""?p.hostname:m.hostname,m.search=p.search,m.query=p.query,fe=f;else if(f.length)fe||(fe=[]),fe.pop(),fe=fe.concat(f),m.search=p.search,m.query=p.query;else if(!isNullOrUndefined$1(p.search))return me&&(m.hostname=m.host=fe.shift(),(Z=!!(m.host&&m.host.indexOf("@")>0)&&m.host.split("@"))&&(m.auth=Z.shift(),m.host=m.hostname=Z.shift())),m.search=p.search,m.query=p.query,isNull(m.pathname)&&isNull(m.search)||(m.path=(m.pathname?m.pathname:"")+(m.search?m.search:"")),m.href=m.format(),m;if(!fe.length)return m.pathname=null,m.search?m.path="/"+m.search:m.path=null,m.href=m.format(),m;for(var be=fe.slice(-1)[0],Ce=(m.host||p.host||fe.length>1)&&(be==="."||be==="..")||be==="",ze=0,Se=fe.length;Se>=0;Se--)(be=fe[Se])==="."?fe.splice(Se,1):be===".."?(fe.splice(Se,1),ze++):ze&&(fe.splice(Se,1),ze--);if(!ie&&!he)for(;ze--;ze)fe.unshift("..");!ie||fe[0]===""||fe[0]&&fe[0].charAt(0)==="/"||fe.unshift(""),Ce&&fe.join("/").substr(-1)!=="/"&&fe.push("");var Ie=fe[0]===""||fe[0]&&fe[0].charAt(0)==="/";return me&&(m.hostname=m.host=Ie?"":fe.length?fe.shift():"",(Z=!!(m.host&&m.host.indexOf("@")>0)&&m.host.split("@"))&&(m.auth=Z.shift(),m.host=m.hostname=Z.shift())),(ie=ie||m.host&&fe.length)&&!Ie&&fe.unshift(""),fe.length?m.pathname=fe.join("/"):(m.pathname=null,m.path=null),isNull(m.pathname)&&isNull(m.search)||(m.path=(m.pathname?m.pathname:"")+(m.search?m.search:"")),m.auth=p.auth||m.auth,m.slashes=m.slashes||p.slashes,m.href=m.format(),m},Url.prototype.parseHost=function(){return parseHost(this)};var url_1=createCommonjsModule(function(p){var u=p.exports;u.encodeURI=function(f){if(handlebarsUtils.isString(f))return encodeURIComponent(f)},u.escape=function(f){if(handlebarsUtils.isString(f))return querystring$1.escape(f)},u.decodeURI=function(f){if(handlebarsUtils.isString(f))return decodeURIComponent(f)},u.urlResolve=function(f,m){return url$1.resolve(f,m)},u.urlParse=function(f){return url$1.parse(f)},u.stripQuerystring=function(f){if(handlebarsUtils.isString(f))return f.split("?")[0]},u.stripProtocol=function(f){if(handlebarsUtils.isString(f)){var m=url$1.parse(f);return m.protocol="",m.format()}}}),_default=rng;let getRandomValues;const rnds8=new Uint8Array(16);function rng(){if(!getRandomValues&&(getRandomValues=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!getRandomValues))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return getRandomValues(rnds8)}var rng_1=Object.defineProperty({default:_default},"__esModule",{value:!0}),regex$1=createCommonjsModule(function(p,u){Object.defineProperty(u,"__esModule",{value:!0}),u.default=void 0,u.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i}),validate_1=createCommonjsModule(function(p,u){Object.defineProperty(u,"__esModule",{value:!0}),u.default=void 0;var f,m=(f=regex$1)&&f.__esModule?f:{default:f},v=function(y){return typeof y=="string"&&m.default.test(y)};u.default=v}),stringify_1$1=createCommonjsModule(function(p,u){Object.defineProperty(u,"__esModule",{value:!0}),u.default=void 0,u.unsafeStringify=y;var f,m=(f=validate_1)&&f.__esModule?f:{default:f};const v=[];for(let k=0;k<256;++k)v.push((k+256).toString(16).slice(1));function y(k,S=0){return v[k[S+0]]+v[k[S+1]]+v[k[S+2]]+v[k[S+3]]+"-"+v[k[S+4]]+v[k[S+5]]+"-"+v[k[S+6]]+v[k[S+7]]+"-"+v[k[S+8]]+v[k[S+9]]+"-"+v[k[S+10]]+v[k[S+11]]+v[k[S+12]]+v[k[S+13]]+v[k[S+14]]+v[k[S+15]]}var w=function(k,S=0){const M=y(k,S);if(!(0,m.default)(M))throw TypeError("Stringified UUID is invalid");return M};u.default=w}),v1_1=createCommonjsModule(function(p,u){Object.defineProperty(u,"__esModule",{value:!0}),u.default=void 0;var f,m=(f=rng_1)&&f.__esModule?f:{default:f};let v,y,w=0,k=0;var S=function(M,E,T){let H=E&&T||0;const V=E||new Array(16);let q=(M=M||{}).node||v,Z=M.clockseq!==void 0?M.clockseq:y;if(q==null||Z==null){const me=M.random||(M.rng||m.default)();q==null&&(q=v=[1|me[0],me[1],me[2],me[3],me[4],me[5]]),Z==null&&(Z=y=16383&(me[6]<<8|me[7]))}let J=M.msecs!==void 0?M.msecs:Date.now(),ae=M.nsecs!==void 0?M.nsecs:k+1;const ie=J-w+(ae-k)/1e4;if(ie<0&&M.clockseq===void 0&&(Z=Z+1&16383),(ie<0||J>w)&&M.nsecs===void 0&&(ae=0),ae>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");w=J,k=ae,y=Z,J+=122192928e5;const he=(1e4*(268435455&J)+ae)%4294967296;V[H++]=he>>>24&255,V[H++]=he>>>16&255,V[H++]=he>>>8&255,V[H++]=255&he;const fe=J/4294967296*1e4&268435455;V[H++]=fe>>>8&255,V[H++]=255&fe,V[H++]=fe>>>24&15|16,V[H++]=fe>>>16&255,V[H++]=Z>>>8|128,V[H++]=255&Z;for(let me=0;me<6;++me)V[H+me]=q[me];return E||(0,stringify_1$1.unsafeStringify)(V)};u.default=S}),parse_1$4=createCommonjsModule(function(p,u){Object.defineProperty(u,"__esModule",{value:!0}),u.default=void 0;var f,m=(f=validate_1)&&f.__esModule?f:{default:f},v=function(y){if(!(0,m.default)(y))throw TypeError("Invalid UUID");let w;const k=new Uint8Array(16);return k[0]=(w=parseInt(y.slice(0,8),16))>>>24,k[1]=w>>>16&255,k[2]=w>>>8&255,k[3]=255&w,k[4]=(w=parseInt(y.slice(9,13),16))>>>8,k[5]=255&w,k[6]=(w=parseInt(y.slice(14,18),16))>>>8,k[7]=255&w,k[8]=(w=parseInt(y.slice(19,23),16))>>>8,k[9]=255&w,k[10]=(w=parseInt(y.slice(24,36),16))/1099511627776&255,k[11]=w/4294967296&255,k[12]=w>>>24&255,k[13]=w>>>16&255,k[14]=w>>>8&255,k[15]=255&w,k};u.default=v}),v35_1=createCommonjsModule(function(p,u){Object.defineProperty(u,"__esModule",{value:!0}),u.URL=u.DNS=void 0,u.default=function(w,k,S){function M(E,T,H,V){var q;if(typeof E=="string"&&(E=function(J){J=unescape(encodeURIComponent(J));const ae=[];for(let ie=0;ie<J.length;++ie)ae.push(J.charCodeAt(ie));return ae}(E)),typeof T=="string"&&(T=(0,m.default)(T)),((q=T)===null||q===void 0?void 0:q.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let Z=new Uint8Array(16+E.length);if(Z.set(T),Z.set(E,T.length),Z=S(Z),Z[6]=15&Z[6]|k,Z[8]=63&Z[8]|128,H){V=V||0;for(let J=0;J<16;++J)H[V+J]=Z[J];return H}return(0,stringify_1$1.unsafeStringify)(Z)}try{M.name=w}catch{}return M.DNS=v,M.URL=y,M};var f,m=(f=parse_1$4)&&f.__esModule?f:{default:f};const v="6ba7b810-9dad-11d1-80b4-00c04fd430c8";u.DNS=v;const y="6ba7b811-9dad-11d1-80b4-00c04fd430c8";u.URL=y}),md5_1=createCommonjsModule(function(p,u){function f(E){return 14+(E+64>>>9<<4)+1}function m(E,T){const H=(65535&E)+(65535&T);return(E>>16)+(T>>16)+(H>>16)<<16|65535&H}function v(E,T,H,V,q,Z){return m((J=m(m(T,E),m(V,Z)))<<(ae=q)|J>>>32-ae,H);var J,ae}function y(E,T,H,V,q,Z,J){return v(T&H|~T&V,E,T,q,Z,J)}function w(E,T,H,V,q,Z,J){return v(T&V|H&~V,E,T,q,Z,J)}function k(E,T,H,V,q,Z,J){return v(T^H^V,E,T,q,Z,J)}function S(E,T,H,V,q,Z,J){return v(H^(T|~V),E,T,q,Z,J)}Object.defineProperty(u,"__esModule",{value:!0}),u.default=void 0;var M=function(E){if(typeof E=="string"){const T=unescape(encodeURIComponent(E));E=new Uint8Array(T.length);for(let H=0;H<T.length;++H)E[H]=T.charCodeAt(H)}return function(T){const H=[],V=32*T.length,q="0123456789abcdef";for(let Z=0;Z<V;Z+=8){const J=T[Z>>5]>>>Z%32&255,ae=parseInt(q.charAt(J>>>4&15)+q.charAt(15&J),16);H.push(ae)}return H}(function(T,H){T[H>>5]|=128<<H%32,T[f(H)-1]=H;let V=1732584193,q=-271733879,Z=-1732584194,J=271733878;for(let ae=0;ae<T.length;ae+=16){const ie=V,he=q,fe=Z,me=J;V=y(V,q,Z,J,T[ae],7,-680876936),J=y(J,V,q,Z,T[ae+1],12,-389564586),Z=y(Z,J,V,q,T[ae+2],17,606105819),q=y(q,Z,J,V,T[ae+3],22,-1044525330),V=y(V,q,Z,J,T[ae+4],7,-176418897),J=y(J,V,q,Z,T[ae+5],12,1200080426),Z=y(Z,J,V,q,T[ae+6],17,-1473231341),q=y(q,Z,J,V,T[ae+7],22,-45705983),V=y(V,q,Z,J,T[ae+8],7,1770035416),J=y(J,V,q,Z,T[ae+9],12,-1958414417),Z=y(Z,J,V,q,T[ae+10],17,-42063),q=y(q,Z,J,V,T[ae+11],22,-1990404162),V=y(V,q,Z,J,T[ae+12],7,1804603682),J=y(J,V,q,Z,T[ae+13],12,-40341101),Z=y(Z,J,V,q,T[ae+14],17,-1502002290),q=y(q,Z,J,V,T[ae+15],22,1236535329),V=w(V,q,Z,J,T[ae+1],5,-165796510),J=w(J,V,q,Z,T[ae+6],9,-1069501632),Z=w(Z,J,V,q,T[ae+11],14,643717713),q=w(q,Z,J,V,T[ae],20,-373897302),V=w(V,q,Z,J,T[ae+5],5,-701558691),J=w(J,V,q,Z,T[ae+10],9,38016083),Z=w(Z,J,V,q,T[ae+15],14,-660478335),q=w(q,Z,J,V,T[ae+4],20,-405537848),V=w(V,q,Z,J,T[ae+9],5,568446438),J=w(J,V,q,Z,T[ae+14],9,-1019803690),Z=w(Z,J,V,q,T[ae+3],14,-187363961),q=w(q,Z,J,V,T[ae+8],20,1163531501),V=w(V,q,Z,J,T[ae+13],5,-1444681467),J=w(J,V,q,Z,T[ae+2],9,-51403784),Z=w(Z,J,V,q,T[ae+7],14,1735328473),q=w(q,Z,J,V,T[ae+12],20,-1926607734),V=k(V,q,Z,J,T[ae+5],4,-378558),J=k(J,V,q,Z,T[ae+8],11,-2022574463),Z=k(Z,J,V,q,T[ae+11],16,1839030562),q=k(q,Z,J,V,T[ae+14],23,-35309556),V=k(V,q,Z,J,T[ae+1],4,-1530992060),J=k(J,V,q,Z,T[ae+4],11,1272893353),Z=k(Z,J,V,q,T[ae+7],16,-155497632),q=k(q,Z,J,V,T[ae+10],23,-1094730640),V=k(V,q,Z,J,T[ae+13],4,681279174),J=k(J,V,q,Z,T[ae],11,-358537222),Z=k(Z,J,V,q,T[ae+3],16,-722521979),q=k(q,Z,J,V,T[ae+6],23,76029189),V=k(V,q,Z,J,T[ae+9],4,-640364487),J=k(J,V,q,Z,T[ae+12],11,-421815835),Z=k(Z,J,V,q,T[ae+15],16,530742520),q=k(q,Z,J,V,T[ae+2],23,-995338651),V=S(V,q,Z,J,T[ae],6,-198630844),J=S(J,V,q,Z,T[ae+7],10,1126891415),Z=S(Z,J,V,q,T[ae+14],15,-1416354905),q=S(q,Z,J,V,T[ae+5],21,-57434055),V=S(V,q,Z,J,T[ae+12],6,1700485571),J=S(J,V,q,Z,T[ae+3],10,-1894986606),Z=S(Z,J,V,q,T[ae+10],15,-1051523),q=S(q,Z,J,V,T[ae+1],21,-2054922799),V=S(V,q,Z,J,T[ae+8],6,1873313359),J=S(J,V,q,Z,T[ae+15],10,-30611744),Z=S(Z,J,V,q,T[ae+6],15,-1560198380),q=S(q,Z,J,V,T[ae+13],21,1309151649),V=S(V,q,Z,J,T[ae+4],6,-145523070),J=S(J,V,q,Z,T[ae+11],10,-1120210379),Z=S(Z,J,V,q,T[ae+2],15,718787259),q=S(q,Z,J,V,T[ae+9],21,-343485551),V=m(V,ie),q=m(q,he),Z=m(Z,fe),J=m(J,me)}return[V,q,Z,J]}(function(T){if(T.length===0)return[];const H=8*T.length,V=new Uint32Array(f(H));for(let q=0;q<H;q+=8)V[q>>5]|=(255&T[q/8])<<q%32;return V}(E),8*E.length))};u.default=M}),v3_1=createCommonjsModule(function(p,u){Object.defineProperty(u,"__esModule",{value:!0}),u.default=void 0;var f=v(v35_1),m=v(md5_1);function v(w){return w&&w.__esModule?w:{default:w}}var y=(0,f.default)("v3",48,m.default);u.default=y}),native=createCommonjsModule(function(p,u){Object.defineProperty(u,"__esModule",{value:!0}),u.default=void 0;var f={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};u.default=f}),v4_1=createCommonjsModule(function(p,u){Object.defineProperty(u,"__esModule",{value:!0}),u.default=void 0;var f=v(native),m=v(rng_1);function v(w){return w&&w.__esModule?w:{default:w}}var y=function(w,k,S){if(f.default.randomUUID&&!k&&!w)return f.default.randomUUID();const M=(w=w||{}).random||(w.rng||m.default)();if(M[6]=15&M[6]|64,M[8]=63&M[8]|128,k){S=S||0;for(let E=0;E<16;++E)k[S+E]=M[E];return k}return(0,stringify_1$1.unsafeStringify)(M)};u.default=y}),sha1_1=createCommonjsModule(function(p,u){function f(y,w,k,S){switch(y){case 0:return w&k^~w&S;case 1:case 3:return w^k^S;case 2:return w&k^w&S^k&S}}function m(y,w){return y<<w|y>>>32-w}Object.defineProperty(u,"__esModule",{value:!0}),u.default=void 0;var v=function(y){const w=[1518500249,1859775393,2400959708,3395469782],k=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof y=="string"){const T=unescape(encodeURIComponent(y));y=[];for(let H=0;H<T.length;++H)y.push(T.charCodeAt(H))}else Array.isArray(y)||(y=Array.prototype.slice.call(y));y.push(128);const S=y.length/4+2,M=Math.ceil(S/16),E=new Array(M);for(let T=0;T<M;++T){const H=new Uint32Array(16);for(let V=0;V<16;++V)H[V]=y[64*T+4*V]<<24|y[64*T+4*V+1]<<16|y[64*T+4*V+2]<<8|y[64*T+4*V+3];E[T]=H}E[M-1][14]=8*(y.length-1)/Math.pow(2,32),E[M-1][14]=Math.floor(E[M-1][14]),E[M-1][15]=8*(y.length-1)&4294967295;for(let T=0;T<M;++T){const H=new Uint32Array(80);for(let ie=0;ie<16;++ie)H[ie]=E[T][ie];for(let ie=16;ie<80;++ie)H[ie]=m(H[ie-3]^H[ie-8]^H[ie-14]^H[ie-16],1);let V=k[0],q=k[1],Z=k[2],J=k[3],ae=k[4];for(let ie=0;ie<80;++ie){const he=Math.floor(ie/20),fe=m(V,5)+f(he,q,Z,J)+ae+w[he]+H[ie]>>>0;ae=J,J=Z,Z=m(q,30)>>>0,q=V,V=fe}k[0]=k[0]+V>>>0,k[1]=k[1]+q>>>0,k[2]=k[2]+Z>>>0,k[3]=k[3]+J>>>0,k[4]=k[4]+ae>>>0}return[k[0]>>24&255,k[0]>>16&255,k[0]>>8&255,255&k[0],k[1]>>24&255,k[1]>>16&255,k[1]>>8&255,255&k[1],k[2]>>24&255,k[2]>>16&255,k[2]>>8&255,255&k[2],k[3]>>24&255,k[3]>>16&255,k[3]>>8&255,255&k[3],k[4]>>24&255,k[4]>>16&255,k[4]>>8&255,255&k[4]]};u.default=v}),v5_1=createCommonjsModule(function(p,u){Object.defineProperty(u,"__esModule",{value:!0}),u.default=void 0;var f=v(v35_1),m=v(sha1_1);function v(w){return w&&w.__esModule?w:{default:w}}var y=(0,f.default)("v5",80,m.default);u.default=y}),nil=createCommonjsModule(function(p,u){Object.defineProperty(u,"__esModule",{value:!0}),u.default=void 0,u.default="00000000-0000-0000-0000-000000000000"}),version_1=createCommonjsModule(function(p,u){Object.defineProperty(u,"__esModule",{value:!0}),u.default=void 0;var f,m=(f=validate_1)&&f.__esModule?f:{default:f},v=function(y){if(!(0,m.default)(y))throw TypeError("Invalid UUID");return parseInt(y.slice(14,15),16)};u.default=v}),commonjsBrowser=createCommonjsModule(function(p,u){Object.defineProperty(u,"__esModule",{value:!0}),Object.defineProperty(u,"NIL",{enumerable:!0,get:function(){return w.default}}),Object.defineProperty(u,"parse",{enumerable:!0,get:function(){return E.default}}),Object.defineProperty(u,"stringify",{enumerable:!0,get:function(){return M.default}}),Object.defineProperty(u,"v1",{enumerable:!0,get:function(){return f.default}}),Object.defineProperty(u,"v3",{enumerable:!0,get:function(){return m.default}}),Object.defineProperty(u,"v4",{enumerable:!0,get:function(){return v.default}}),Object.defineProperty(u,"v5",{enumerable:!0,get:function(){return y.default}}),Object.defineProperty(u,"validate",{enumerable:!0,get:function(){return S.default}}),Object.defineProperty(u,"version",{enumerable:!0,get:function(){return k.default}});var f=T(v1_1),m=T(v3_1),v=T(v4_1),y=T(v5_1),w=T(nil),k=T(version_1),S=T(validate_1),M=T(stringify_1$1),E=T(parse_1$4);function T(H){return H&&H.__esModule?H:{default:H}}}),uuid_1=createCommonjsModule(function(p){p.exports.uuid=function(){return commonjsBrowser.v4()}}),lib$7={array:array$1,code,collection,comparison:comparison$1,html:html_1,i18n,inflection,match,math:math$1,misc,number:number$1,object:object$1,path:path_1,regex:regex$2,string:string$1,url:url_1,uuid:uuid_1},handlebarsHelpers=createCommonjsModule(function(p){p.exports=function(u,f){typeof u=="string"?u=[u]:Array.isArray(u)||(f=u,u=null);var m=(f=f||{}).handlebars||f.hbs||handlebars;if(p.exports.handlebars=m,u)u.forEach(function(v){m.registerHelper(lib$7[v])});else for(const v in lib$7){const y=lib$7[v];m.registerHelper(y)}return m.helpers};for(const u in lib$7){const f=lib$7[u];p.exports[u]=function(m){var v=(m=m||{}).handlebars||m.hbs||handlebars;return p.exports.handlebars=v,v.registerHelper(f),f}}p.exports.utils=utils$2}),dayjs_min=createCommonjsModule(function(p,u){p.exports=function(){var f=1e3,m=6e4,v=36e5,y="millisecond",w="second",k="minute",S="hour",M="day",E="week",T="month",H="quarter",V="year",q="date",Z="Invalid Date",J=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,ae=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,ie={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(Ze){var ve=["th","st","nd","rd"],Re=Ze%100;return"["+Ze+(ve[(Re-20)%10]||ve[Re]||ve[0])+"]"}},he=function(Ze,ve,Re){var Qe=String(Ze);return!Qe||Qe.length>=ve?Ze:""+Array(ve+1-Qe.length).join(Re)+Ze},fe={s:he,z:function(Ze){var ve=-Ze.utcOffset(),Re=Math.abs(ve),Qe=Math.floor(Re/60),Fe=Re%60;return(ve<=0?"+":"-")+he(Qe,2,"0")+":"+he(Fe,2,"0")},m:function Ze(ve,Re){if(ve.date()<Re.date())return-Ze(Re,ve);var Qe=12*(Re.year()-ve.year())+(Re.month()-ve.month()),Fe=ve.clone().add(Qe,T),Je=Re-Fe<0,ft=ve.clone().add(Qe+(Je?-1:1),T);return+(-(Qe+(Re-Fe)/(Je?Fe-ft:ft-Fe))||0)},a:function(Ze){return Ze<0?Math.ceil(Ze)||0:Math.floor(Ze)},p:function(Ze){return{M:T,y:V,w:E,d:M,D:q,h:S,m:k,s:w,ms:y,Q:H}[Ze]||String(Ze||"").toLowerCase().replace(/s$/,"")},u:function(Ze){return Ze===void 0}},me="en",be={};be[me]=ie;var Ce="$isDayjsObject",ze=function(Ze){return Ze instanceof Ne||!(!Ze||!Ze[Ce])},Se=function Ze(ve,Re,Qe){var Fe;if(!ve)return me;if(typeof ve=="string"){var Je=ve.toLowerCase();be[Je]&&(Fe=Je),Re&&(be[Je]=Re,Fe=Je);var ft=ve.split("-");if(!Fe&&ft.length>1)return Ze(ft[0])}else{var Et=ve.name;be[Et]=ve,Fe=Et}return!Qe&&Fe&&(me=Fe),Fe||!Qe&&me},Ie=function(Ze,ve){if(ze(Ze))return Ze.clone();var Re=typeof ve=="object"?ve:{};return Re.date=Ze,Re.args=arguments,new Ne(Re)},xe=fe;xe.l=Se,xe.i=ze,xe.w=function(Ze,ve){return Ie(Ze,{locale:ve.$L,utc:ve.$u,x:ve.$x,$offset:ve.$offset})};var Ne=function(){function Ze(Re){this.$L=Se(Re.locale,null,!0),this.parse(Re),this.$x=this.$x||Re.x||{},this[Ce]=!0}var ve=Ze.prototype;return ve.parse=function(Re){this.$d=function(Qe){var Fe=Qe.date,Je=Qe.utc;if(Fe===null)return new Date(NaN);if(xe.u(Fe))return new Date;if(Fe instanceof Date)return new Date(Fe);if(typeof Fe=="string"&&!/Z$/i.test(Fe)){var ft=Fe.match(J);if(ft){var Et=ft[2]-1||0,qe=(ft[7]||"0").substring(0,3);return Je?new Date(Date.UTC(ft[1],Et,ft[3]||1,ft[4]||0,ft[5]||0,ft[6]||0,qe)):new Date(ft[1],Et,ft[3]||1,ft[4]||0,ft[5]||0,ft[6]||0,qe)}}return new Date(Fe)}(Re),this.init()},ve.init=function(){var Re=this.$d;this.$y=Re.getFullYear(),this.$M=Re.getMonth(),this.$D=Re.getDate(),this.$W=Re.getDay(),this.$H=Re.getHours(),this.$m=Re.getMinutes(),this.$s=Re.getSeconds(),this.$ms=Re.getMilliseconds()},ve.$utils=function(){return xe},ve.isValid=function(){return this.$d.toString()!==Z},ve.isSame=function(Re,Qe){var Fe=Ie(Re);return this.startOf(Qe)<=Fe&&Fe<=this.endOf(Qe)},ve.isAfter=function(Re,Qe){return Ie(Re)<this.startOf(Qe)},ve.isBefore=function(Re,Qe){return this.endOf(Qe)<Ie(Re)},ve.$g=function(Re,Qe,Fe){return xe.u(Re)?this[Qe]:this.set(Fe,Re)},ve.unix=function(){return Math.floor(this.valueOf()/1e3)},ve.valueOf=function(){return this.$d.getTime()},ve.startOf=function(Re,Qe){var Fe=this,Je=!!xe.u(Qe)||Qe,ft=xe.p(Re),Et=function(Ut,en){var Nt=xe.w(Fe.$u?Date.UTC(Fe.$y,en,Ut):new Date(Fe.$y,en,Ut),Fe);return Je?Nt:Nt.endOf(M)},qe=function(Ut,en){return xe.w(Fe.toDate()[Ut].apply(Fe.toDate("s"),(Je?[0,0,0,0]:[23,59,59,999]).slice(en)),Fe)},Ge=this.$W,dt=this.$M,xt=this.$D,ot="set"+(this.$u?"UTC":"");switch(ft){case V:return Je?Et(1,0):Et(31,11);case T:return Je?Et(1,dt):Et(0,dt+1);case E:var jt=this.$locale().weekStart||0,Xe=(Ge<jt?Ge+7:Ge)-jt;return Et(Je?xt-Xe:xt+(6-Xe),dt);case M:case q:return qe(ot+"Hours",0);case S:return qe(ot+"Minutes",1);case k:return qe(ot+"Seconds",2);case w:return qe(ot+"Milliseconds",3);default:return this.clone()}},ve.endOf=function(Re){return this.startOf(Re,!1)},ve.$set=function(Re,Qe){var Fe,Je=xe.p(Re),ft="set"+(this.$u?"UTC":""),Et=(Fe={},Fe[M]=ft+"Date",Fe[q]=ft+"Date",Fe[T]=ft+"Month",Fe[V]=ft+"FullYear",Fe[S]=ft+"Hours",Fe[k]=ft+"Minutes",Fe[w]=ft+"Seconds",Fe[y]=ft+"Milliseconds",Fe)[Je],qe=Je===M?this.$D+(Qe-this.$W):Qe;if(Je===T||Je===V){var Ge=this.clone().set(q,1);Ge.$d[Et](qe),Ge.init(),this.$d=Ge.set(q,Math.min(this.$D,Ge.daysInMonth())).$d}else Et&&this.$d[Et](qe);return this.init(),this},ve.set=function(Re,Qe){return this.clone().$set(Re,Qe)},ve.get=function(Re){return this[xe.p(Re)]()},ve.add=function(Re,Qe){var Fe,Je=this;Re=Number(Re);var ft=xe.p(Qe),Et=function(dt){var xt=Ie(Je);return xe.w(xt.date(xt.date()+Math.round(dt*Re)),Je)};if(ft===T)return this.set(T,this.$M+Re);if(ft===V)return this.set(V,this.$y+Re);if(ft===M)return Et(1);if(ft===E)return Et(7);var qe=(Fe={},Fe[k]=m,Fe[S]=v,Fe[w]=f,Fe)[ft]||1,Ge=this.$d.getTime()+Re*qe;return xe.w(Ge,this)},ve.subtract=function(Re,Qe){return this.add(-1*Re,Qe)},ve.format=function(Re){var Qe=this,Fe=this.$locale();if(!this.isValid())return Fe.invalidDate||Z;var Je=Re||"YYYY-MM-DDTHH:mm:ssZ",ft=xe.z(this),Et=this.$H,qe=this.$m,Ge=this.$M,dt=Fe.weekdays,xt=Fe.months,ot=Fe.meridiem,jt=function(en,Nt,kt,yt){return en&&(en[Nt]||en(Qe,Je))||kt[Nt].slice(0,yt)},Xe=function(en){return xe.s(Et%12||12,en,"0")},Ut=ot||function(en,Nt,kt){var yt=en<12?"AM":"PM";return kt?yt.toLowerCase():yt};return Je.replace(ae,function(en,Nt){return Nt||function(kt){switch(kt){case"YY":return String(Qe.$y).slice(-2);case"YYYY":return xe.s(Qe.$y,4,"0");case"M":return Ge+1;case"MM":return xe.s(Ge+1,2,"0");case"MMM":return jt(Fe.monthsShort,Ge,xt,3);case"MMMM":return jt(xt,Ge);case"D":return Qe.$D;case"DD":return xe.s(Qe.$D,2,"0");case"d":return String(Qe.$W);case"dd":return jt(Fe.weekdaysMin,Qe.$W,dt,2);case"ddd":return jt(Fe.weekdaysShort,Qe.$W,dt,3);case"dddd":return dt[Qe.$W];case"H":return String(Et);case"HH":return xe.s(Et,2,"0");case"h":return Xe(1);case"hh":return Xe(2);case"a":return Ut(Et,qe,!0);case"A":return Ut(Et,qe,!1);case"m":return String(qe);case"mm":return xe.s(qe,2,"0");case"s":return String(Qe.$s);case"ss":return xe.s(Qe.$s,2,"0");case"SSS":return xe.s(Qe.$ms,3,"0");case"Z":return ft}return null}(en)||ft.replace(":","")})},ve.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},ve.diff=function(Re,Qe,Fe){var Je,ft=this,Et=xe.p(Qe),qe=Ie(Re),Ge=(qe.utcOffset()-this.utcOffset())*m,dt=this-qe,xt=function(){return xe.m(ft,qe)};switch(Et){case V:Je=xt()/12;break;case T:Je=xt();break;case H:Je=xt()/3;break;case E:Je=(dt-Ge)/6048e5;break;case M:Je=(dt-Ge)/864e5;break;case S:Je=dt/v;break;case k:Je=dt/m;break;case w:Je=dt/f;break;default:Je=dt}return Fe?Je:xe.a(Je)},ve.daysInMonth=function(){return this.endOf(T).$D},ve.$locale=function(){return be[this.$L]},ve.locale=function(Re,Qe){if(!Re)return this.$L;var Fe=this.clone(),Je=Se(Re,Qe,!0);return Je&&(Fe.$L=Je),Fe},ve.clone=function(){return xe.w(this.$d,this)},ve.toDate=function(){return new Date(this.valueOf())},ve.toJSON=function(){return this.isValid()?this.toISOString():null},ve.toISOString=function(){return this.$d.toISOString()},ve.toString=function(){return this.$d.toUTCString()},Ze}(),$e=Ne.prototype;return Ie.prototype=$e,[["$ms",y],["$s",w],["$m",k],["$H",S],["$W",M],["$M",T],["$y",V],["$D",q]].forEach(function(Ze){$e[Ze[1]]=function(ve){return this.$g(ve,Ze[0],Ze[1])}}),Ie.extend=function(Ze,ve){return Ze.$i||(Ze(ve,Ne,Ie),Ze.$i=!0),Ie},Ie.locale=Se,Ie.isDayjs=ze,Ie.unix=function(Ze){return Ie(1e3*Ze)},Ie.en=be[me],Ie.Ls=be,Ie.p={},Ie}()}),duration$1$1=createCommonjsModule(function(p,u){var f,m,v,y,w,k,S,M,E,T,H,V,q,Z,J,ae,ie,he,fe,me;p.exports=(S=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,T=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,H={years:M=31536e6,months:E=2628e6,days:k=864e5,hours:w=36e5,minutes:y=6e4,seconds:v=1e3,milliseconds:1,weeks:6048e5},V=function(be){return be instanceof fe},q=function(be,Ce,ze){return new fe(be,ze,Ce.$l)},Z=function(be){return m.p(be)+"s"},J=function(be){return be<0},ae=function(be){return J(be)?Math.ceil(be):Math.floor(be)},ie=function(be){return Math.abs(be)},he=function(be,Ce){return be?J(be)?{negative:!0,format:""+ie(be)+Ce}:{negative:!1,format:""+be+Ce}:{negative:!1,format:""}},fe=function(){function be(ze,Se,Ie){var xe=this;if(this.$d={},this.$l=Ie,ze===void 0&&(this.$ms=0,this.parseFromMilliseconds()),Se)return q(ze*H[Z(Se)],this);if(typeof ze=="number")return this.$ms=ze,this.parseFromMilliseconds(),this;if(typeof ze=="object")return Object.keys(ze).forEach(function(Ze){xe.$d[Z(Ze)]=ze[Ze]}),this.calMilliseconds(),this;if(typeof ze=="string"){var Ne=ze.match(T);if(Ne){var $e=Ne.slice(2).map(function(Ze){return Ze!=null?Number(Ze):0});return this.$d.years=$e[0],this.$d.months=$e[1],this.$d.weeks=$e[2],this.$d.days=$e[3],this.$d.hours=$e[4],this.$d.minutes=$e[5],this.$d.seconds=$e[6],this.calMilliseconds(),this}}return this}var Ce=be.prototype;return Ce.calMilliseconds=function(){var ze=this;this.$ms=Object.keys(this.$d).reduce(function(Se,Ie){return Se+(ze.$d[Ie]||0)*H[Ie]},0)},Ce.parseFromMilliseconds=function(){var ze=this.$ms;this.$d.years=ae(ze/M),ze%=M,this.$d.months=ae(ze/E),ze%=E,this.$d.days=ae(ze/k),ze%=k,this.$d.hours=ae(ze/w),ze%=w,this.$d.minutes=ae(ze/y),ze%=y,this.$d.seconds=ae(ze/v),ze%=v,this.$d.milliseconds=ze},Ce.toISOString=function(){var ze=he(this.$d.years,"Y"),Se=he(this.$d.months,"M"),Ie=+this.$d.days||0;this.$d.weeks&&(Ie+=7*this.$d.weeks);var xe=he(Ie,"D"),Ne=he(this.$d.hours,"H"),$e=he(this.$d.minutes,"M"),Ze=this.$d.seconds||0;this.$d.milliseconds&&(Ze+=this.$d.milliseconds/1e3,Ze=Math.round(1e3*Ze)/1e3);var ve=he(Ze,"S"),Re=ze.negative||Se.negative||xe.negative||Ne.negative||$e.negative||ve.negative,Qe=Ne.format||$e.format||ve.format?"T":"",Fe=(Re?"-":"")+"P"+ze.format+Se.format+xe.format+Qe+Ne.format+$e.format+ve.format;return Fe==="P"||Fe==="-P"?"P0D":Fe},Ce.toJSON=function(){return this.toISOString()},Ce.format=function(ze){var Se=ze||"YYYY-MM-DDTHH:mm:ss",Ie={Y:this.$d.years,YY:m.s(this.$d.years,2,"0"),YYYY:m.s(this.$d.years,4,"0"),M:this.$d.months,MM:m.s(this.$d.months,2,"0"),D:this.$d.days,DD:m.s(this.$d.days,2,"0"),H:this.$d.hours,HH:m.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:m.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:m.s(this.$d.seconds,2,"0"),SSS:m.s(this.$d.milliseconds,3,"0")};return Se.replace(S,function(xe,Ne){return Ne||String(Ie[xe])})},Ce.as=function(ze){return this.$ms/H[Z(ze)]},Ce.get=function(ze){var Se=this.$ms,Ie=Z(ze);return Ie==="milliseconds"?Se%=1e3:Se=Ie==="weeks"?ae(Se/H[Ie]):this.$d[Ie],Se||0},Ce.add=function(ze,Se,Ie){var xe;return xe=Se?ze*H[Z(Se)]:V(ze)?ze.$ms:q(ze,this).$ms,q(this.$ms+xe*(Ie?-1:1),this)},Ce.subtract=function(ze,Se){return this.add(ze,Se,!0)},Ce.locale=function(ze){var Se=this.clone();return Se.$l=ze,Se},Ce.clone=function(){return q(this.$ms,this)},Ce.humanize=function(ze){return f().add(this.$ms,"ms").locale(this.$l).fromNow(!ze)},Ce.valueOf=function(){return this.asMilliseconds()},Ce.milliseconds=function(){return this.get("milliseconds")},Ce.asMilliseconds=function(){return this.as("milliseconds")},Ce.seconds=function(){return this.get("seconds")},Ce.asSeconds=function(){return this.as("seconds")},Ce.minutes=function(){return this.get("minutes")},Ce.asMinutes=function(){return this.as("minutes")},Ce.hours=function(){return this.get("hours")},Ce.asHours=function(){return this.as("hours")},Ce.days=function(){return this.get("days")},Ce.asDays=function(){return this.as("days")},Ce.weeks=function(){return this.get("weeks")},Ce.asWeeks=function(){return this.as("weeks")},Ce.months=function(){return this.get("months")},Ce.asMonths=function(){return this.as("months")},Ce.years=function(){return this.get("years")},Ce.asYears=function(){return this.as("years")},be}(),me=function(be,Ce,ze){return be.add(Ce.years()*ze,"y").add(Ce.months()*ze,"M").add(Ce.days()*ze,"d").add(Ce.hours()*ze,"h").add(Ce.minutes()*ze,"m").add(Ce.seconds()*ze,"s").add(Ce.milliseconds()*ze,"ms")},function(be,Ce,ze){f=ze,m=ze().$utils(),ze.duration=function(xe,Ne){var $e=ze.locale();return q(xe,{$l:$e},Ne)},ze.isDuration=V;var Se=Ce.prototype.add,Ie=Ce.prototype.subtract;Ce.prototype.add=function(xe,Ne){return V(xe)?me(this,xe,1):Se.bind(this)(xe,Ne)},Ce.prototype.subtract=function(xe,Ne){return V(xe)?me(this,xe,-1):Ie.bind(this)(xe,Ne)}})}),advancedFormat=createCommonjsModule(function(p,u){p.exports=function(f,m){var v=m.prototype,y=v.format;v.format=function(w){var k=this,S=this.$locale();if(!this.isValid())return y.bind(this)(w);var M=this.$utils(),E=(w||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,function(T){switch(T){case"Q":return Math.ceil((k.$M+1)/3);case"Do":return S.ordinal(k.$D);case"gggg":return k.weekYear();case"GGGG":return k.isoWeekYear();case"wo":return S.ordinal(k.week(),"W");case"w":case"ww":return M.s(k.week(),T==="w"?1:2,"0");case"W":case"WW":return M.s(k.isoWeek(),T==="W"?1:2,"0");case"k":case"kk":return M.s(String(k.$H===0?24:k.$H),T==="k"?1:2,"0");case"X":return Math.floor(k.$d.getTime()/1e3);case"x":return k.$d.getTime();case"z":return"["+k.offsetName()+"]";case"zzz":return"["+k.offsetName("long")+"]";default:return T}});return y.bind(this)(E)}}}),isoWeek=createCommonjsModule(function(p,u){var f;p.exports=(f="day",function(m,v,y){var w=function(M){return M.add(4-M.isoWeekday(),f)},k=v.prototype;k.isoWeekYear=function(){return w(this).year()},k.isoWeek=function(M){if(!this.$utils().u(M))return this.add(7*(M-this.isoWeek()),f);var E,T,H,V=w(this),q=(E=this.isoWeekYear(),H=4-(T=(this.$u?y.utc:y)().year(E).startOf("year")).isoWeekday(),T.isoWeekday()>4&&(H+=7),T.add(H,f));return V.diff(q,"week")+1},k.isoWeekday=function(M){return this.$utils().u(M)?this.day()||7:this.day(this.day()%7?M:M-7)};var S=k.startOf;k.startOf=function(M,E){var T=this.$utils(),H=!!T.u(E)||E;return T.p(M)==="isoweek"?H?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):S.bind(this)(M,E)}})}),weekYear=createCommonjsModule(function(p,u){p.exports=function(f,m){m.prototype.weekYear=function(){var v=this.month(),y=this.week(),w=this.year();return y===1&&v===11?w+1:v===0&&y>=52?w-1:w}}}),weekOfYear=createCommonjsModule(function(p,u){var f,m;p.exports=(f="week",m="year",function(v,y,w){var k=y.prototype;k.week=function(S){if(S===void 0&&(S=null),S!==null)return this.add(7*(S-this.week()),"day");var M=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var E=w(this).startOf(m).add(1,m).date(M),T=w(this).endOf(f);if(E.isBefore(T))return 1}var H=w(this).startOf(m).date(M).startOf(f).subtract(1,"millisecond"),V=this.diff(H,f,!0);return V<0?w(this).startOf("week").week():Math.ceil(V)},k.weeks=function(S){return S===void 0&&(S=null),this.week(S)}})}),relativeTime=createCommonjsModule(function(p,u){p.exports=function(f,m,v){f=f||{};var y=m.prototype,w={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function k(M,E,T,H){return y.fromToBase(M,E,T,H)}v.en.relativeTime=w,y.fromToBase=function(M,E,T,H,V){for(var q,Z,J,ae=T.$locale().relativeTime||w,ie=f.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],he=ie.length,fe=0;fe<he;fe+=1){var me=ie[fe];me.d&&(q=H?v(M).diff(T,me.d,!0):T.diff(M,me.d,!0));var be=(f.rounding||Math.round)(Math.abs(q));if(J=q>0,be<=me.r||!me.r){be<=1&&fe>0&&(me=ie[fe-1]);var Ce=ae[me.l];V&&(be=V(""+be)),Z=typeof Ce=="string"?Ce.replace("%d",be):Ce(be,E,me.l,J);break}}if(E)return Z;var ze=J?ae.future:ae.past;return typeof ze=="function"?ze(Z):ze.replace("%s",Z)},y.to=function(M,E){return k(M,E,this,!0)},y.from=function(M,E){return k(M,E,this)};var S=function(M){return M.$u?v.utc():v()};y.toNow=function(M){return this.to(S(this),M)},y.fromNow=function(M){return this.from(S(this),M)}}}),utc$2=createCommonjsModule(function(p,u){var f,m,v;p.exports=(f="minute",m=/[+-]\d\d(?::?\d\d)?/g,v=/([+-]|\d\d)/g,function(y,w,k){var S=w.prototype;k.utc=function(Z){return new w({date:Z,utc:!0,args:arguments})},S.utc=function(Z){var J=k(this.toDate(),{locale:this.$L,utc:!0});return Z?J.add(this.utcOffset(),f):J},S.local=function(){return k(this.toDate(),{locale:this.$L,utc:!1})};var M=S.parse;S.parse=function(Z){Z.utc&&(this.$u=!0),this.$utils().u(Z.$offset)||(this.$offset=Z.$offset),M.call(this,Z)};var E=S.init;S.init=function(){if(this.$u){var Z=this.$d;this.$y=Z.getUTCFullYear(),this.$M=Z.getUTCMonth(),this.$D=Z.getUTCDate(),this.$W=Z.getUTCDay(),this.$H=Z.getUTCHours(),this.$m=Z.getUTCMinutes(),this.$s=Z.getUTCSeconds(),this.$ms=Z.getUTCMilliseconds()}else E.call(this)};var T=S.utcOffset;S.utcOffset=function(Z,J){var ae=this.$utils().u;if(ae(Z))return this.$u?0:ae(this.$offset)?T.call(this):this.$offset;if(typeof Z=="string"&&(Z=function(me){me===void 0&&(me="");var be=me.match(m);if(!be)return null;var Ce=(""+be[0]).match(v)||["-",0,0],ze=Ce[0],Se=60*+Ce[1]+ +Ce[2];return Se===0?0:ze==="+"?Se:-Se}(Z),Z===null))return this;var ie=Math.abs(Z)<=16?60*Z:Z,he=this;if(J)return he.$offset=ie,he.$u=Z===0,he;if(Z!==0){var fe=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(he=this.local().add(ie+fe,f)).$offset=ie,he.$x.$localOffset=fe}else he=this.utc();return he};var H=S.format;S.format=function(Z){var J=Z||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return H.call(this,J)},S.valueOf=function(){var Z=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*Z},S.isUTC=function(){return!!this.$u},S.toISOString=function(){return this.toDate().toISOString()},S.toString=function(){return this.toDate().toUTCString()};var V=S.toDate;S.toDate=function(Z){return Z==="s"&&this.$offset?k(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():V.call(this)};var q=S.diff;S.diff=function(Z,J,ae){if(Z&&this.$u===Z.$u)return q.call(this,Z,J,ae);var ie=this.local(),he=k(Z).local();return q.call(ie,he,J,ae)}})}),timezone=createCommonjsModule(function(p,u){var f,m;p.exports=(f={year:0,month:1,day:2,hour:3,minute:4,second:5},m={},function(v,y,w){var k,S=function(H,V,q){q===void 0&&(q={});var Z=new Date(H),J=function(ae,ie){ie===void 0&&(ie={});var he=ie.timeZoneName||"short",fe=ae+"|"+he,me=m[fe];return me||(me=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:ae,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:he}),m[fe]=me),me}(V,q);return J.formatToParts(Z)},M=function(H,V){for(var q=S(H,V),Z=[],J=0;J<q.length;J+=1){var ae=q[J],ie=ae.type,he=ae.value,fe=f[ie];fe>=0&&(Z[fe]=parseInt(he,10))}var me=Z[3],be=me===24?0:me,Ce=Z[0]+"-"+Z[1]+"-"+Z[2]+" "+be+":"+Z[4]+":"+Z[5]+":000",ze=+H;return(w.utc(Ce).valueOf()-(ze-=ze%1e3))/6e4},E=y.prototype;E.tz=function(H,V){H===void 0&&(H=k);var q,Z=this.utcOffset(),J=this.toDate(),ae=J.toLocaleString("en-US",{timeZone:H}),ie=Math.round((J-new Date(ae))/1e3/60),he=15*-Math.round(J.getTimezoneOffset()/15)-ie;if(Number(he)){if(q=w(ae,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(he,!0),V){var fe=q.utcOffset();q=q.add(Z-fe,"minute")}}else q=this.utcOffset(0,V);return q.$x.$timezone=H,q},E.offsetName=function(H){var V=this.$x.$timezone||w.tz.guess(),q=S(this.valueOf(),V,{timeZoneName:H}).find(function(Z){return Z.type.toLowerCase()==="timezonename"});return q&&q.value};var T=E.startOf;E.startOf=function(H,V){if(!this.$x||!this.$x.$timezone)return T.call(this,H,V);var q=w(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return T.call(q,H,V).tz(this.$x.$timezone,!0)},w.tz=function(H,V,q){var Z=q&&V,J=q||V||k,ae=M(+w(),J);if(typeof H!="string")return w(H).tz(J);var ie=function(be,Ce,ze){var Se=be-60*Ce*1e3,Ie=M(Se,ze);if(Ce===Ie)return[Se,Ce];var xe=M(Se-=60*(Ie-Ce)*1e3,ze);return Ie===xe?[Se,Ie]:[be-60*Math.min(Ie,xe)*1e3,Math.max(Ie,xe)]}(w.utc(H,Z).valueOf(),ae,J),he=ie[0],fe=ie[1],me=w(he).utcOffset(fe);return me.$x.$timezone=J,me},w.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},w.tz.setDefault=function(H){k=H}})});function isOptions(p){return typeof p=="object"&&typeof p.hash=="object"}function isApp(p){return typeof p=="object"&&typeof p.options=="object"&&typeof p.app=="object"}function getContext(p,u,f){if(isOptions(p))return getContext({},u,p);if(isOptions(u))return getContext(p,f,u);const m=isApp(p)?p.context:{};isOptions(f=f||{})||(u=Object.assign({},u,f)),isOptions(f)&&f.hash.root===!0&&(u=Object.assign({},f.data.root,u));let v=Object.assign({},m,u,f.hash);return isApp(p)||(v=Object.assign({},p,v)),isApp(p)&&p.view&&p.view.data&&(v=Object.assign({},v,p.view.data)),v}function initialConfig(p,u,f){return isOptions(u)&&(f=u,u=null),isOptions(p)&&(f=p,u=null,p=null),{str:p,pattern:u,options:f}}function setLocale(p,u,f){const m=initialConfig(p,u,f),v=getContext(this,{lang:"en",date:new Date(m.str)},{});dayjs_min.locale(v.lang||v.language)}dayjs_min.extend(duration$1$1),dayjs_min.extend(advancedFormat),dayjs_min.extend(isoWeek),dayjs_min.extend(weekYear),dayjs_min.extend(weekOfYear),dayjs_min.extend(relativeTime),dayjs_min.extend(utc$2),dayjs_min.extend(timezone);const date$1=(p,u,f)=>{const m=initialConfig(p,u,f);if(m.str==null&&m.pattern==null)return dayjs_min.locale("en"),dayjs_min().format("MMMM DD, YYYY");setLocale(m.str,m.pattern,m.options);let v=dayjs_min(new Date(m.str));return v=typeof m.options=="string"?m.options.toLowerCase()==="utc"?v.utc():v.tz(m.options):v.tz(dayjs_min.tz.guess()),m.pattern===""?v.toISOString():v.format(m.pattern)},duration$3=(p,u,f)=>{const m=initialConfig(p,u);setLocale(m.str,m.pattern);const v=dayjs_min.duration(m.str,m.pattern);return f&&!isOptions(f)?v.format(f):v.humanize()},HelperFunctionBuiltin=["#if","#unless","#each","#with","lookup","log","blockHelperMissing","each","helperMissing","if","unless","log","lookup","with"],EXTERNAL_FUNCTION_COLLECTIONS=["math","array","number","url","string","comparison","object","regex","uuid"],HelperFunctionNames={OBJECT:"object",ALL:"all",LITERAL:"literal",JS:"js"},LITERAL_MARKER="%LITERAL%",ADDED_HELPERS={date:date$1,duration:duration$3};function registerAll$1(p){for(let[f,m]of Object.entries(ADDED_HELPERS))p.registerHelper(f,m);let u=[];for(let f of EXTERNAL_FUNCTION_COLLECTIONS){let m=handlebarsHelpers[f]();for(let v of Object.entries(m)){const y=v[0];HelperFunctionBuiltin.indexOf(y)===-1&&u.indexOf(y)===-1&&u.push(y)}handlebarsHelpers[f]({handlebars:p})}externalHelperNames=u.concat(Object.keys(ADDED_HELPERS))}let externalHelperNames=[];const ALPHA_NUMERIC_REGEX=/^[A-Za-z0-9]+$/g,FIND_HBS_REGEX=/{{([^{].*?)}}/g,FIND_ANY_HBS_REGEX=/{?{{([^{].*?)}}}?/g,FIND_TRIPLE_HBS_REGEX=/{{{([^{].*?)}}}/g,isJest=()=>typeof jest<"u",isBackendService=()=>!isJest()&&typeof window>"u",isJSAllowed=()=>browser&&!browser.env.NO_JS,findDoubleHbsInstances=p=>{let u=p;const f=new RegExp(FIND_HBS_REGEX),m=new RegExp(FIND_TRIPLE_HBS_REGEX),v=u.match(m);return v&&v.forEach(w=>{u=u.replace(w,"")}),u.match(f)||[]},isAlphaNumeric=p=>p.match(ALPHA_NUMERIC_REGEX),swapStrings=(p,u,f,m)=>p.slice(0,u)+m+p.slice(u+f),atob$1=p=>Buffer$1.from(p,"base64").toString("utf-8"),prefixStrings=(p,u,f)=>{const m=u.map(y=>y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),v=new RegExp(`\\b(${m.join("|")})\\b`,"g");return p.replace(v,`${f}$1`)},externalCollections={math:math$1,array:array$1,number:number$1,url:url_1,string:string$1,comparison:comparison$1,object:object$1,regex:regex$2,uuid:uuid_1},helpersToRemoveForJs=["sortBy"],addedHelpers={date:date$1,duration:duration$3};let helpers$3;function getJsHelperList(){if(helpers$3)return helpers$3;helpers$3={};for(let p of Object.values(externalCollections))for(let[u,f]of Object.entries(p))helpers$3[u]=(...m)=>f(...m,{});helpers$3=Object.assign(Object.assign({},helpers$3),addedHelpers);for(const p of helpersToRemoveForJs)delete helpers$3[p];return Object.freeze(helpers$3),helpers$3}const iifeWrapper=p=>`(function(){
299
299
  ${p}
300
300
  })();`;class JsTimeoutError extends Error{constructor(){super(JsTimeoutError.message),this.code=JsTimeoutError.code}}JsTimeoutError.message="Timed out while executing JS",JsTimeoutError.code="JS_TIMEOUT_ERROR";class UserScriptError extends Error{constructor(u){super(`error while running user-supplied JavaScript: ${u.toString()}`),this.userScriptError=u,this.code=UserScriptError.code}}UserScriptError.code="USER_SCRIPT_ERROR";/**
301
301
  * @license
@@ -392,7 +392,7 @@ function print() { __p += __j.call(arguments, '') }
392
392
  `),w&&w.c(),v=empty$1()},m(k,S){insert(k,u,S),insert(k,f,S),insert(k,m,S),w&&w.m(k,S),insert(k,v,S),y=!0},p(k,S){(!y||S&16)&&set_data(f,k[4]),k[2]?w?(w.p(k,S),S&4&&transition_in(w,1)):(w=create_if_block_1$N(k),w.c(),transition_in(w,1),w.m(v.parentNode,v)):w&&(group_outros(),transition_out(w,1,1,()=>{w=null}),check_outros())},i(k){y||(transition_in(w),y=!0)},o(k){transition_out(w),y=!1},d(k){k&&(detach(u),detach(f),detach(m),detach(v)),w&&w.d(k)}}}function create_default_slot_2$o(p){let u,f;return u=new ModalContent({props:{title:"Delete rows",confirmText:"Continue",cancelText:"Cancel",onConfirm:p[12],size:"M",$$slots:{default:[create_default_slot_3$j]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&268435484&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_if_block$1z(p){let u,f;return u=new ProgressBar({props:{size:"L",value:p[3],duration:duration$2,width:"100%"}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&8&&(y.value=m[3]),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot_1$A(p){let u,f,m,v,y,w=p[2]&&create_if_block$1z(p);return{c(){u=text$1("Are you sure you want to delete "),f=text$1(p[4]),m=text$1(` cells?
393
393
  `),w&&w.c(),v=empty$1()},m(k,S){insert(k,u,S),insert(k,f,S),insert(k,m,S),w&&w.m(k,S),insert(k,v,S),y=!0},p(k,S){(!y||S&16)&&set_data(f,k[4]),k[2]?w?(w.p(k,S),S&4&&transition_in(w,1)):(w=create_if_block$1z(k),w.c(),transition_in(w,1),w.m(v.parentNode,v)):w&&(group_outros(),transition_out(w,1,1,()=>{w=null}),check_outros())},i(k){y||(transition_in(w),y=!0)},o(k){transition_out(w),y=!1},d(k){k&&(detach(u),detach(f),detach(m),detach(v)),w&&w.d(k)}}}function create_default_slot$1k(p){let u,f;return u=new ModalContent({props:{title:"Delete cells",confirmText:"Continue",cancelText:"Cancel",onConfirm:p[13],size:"M",$$slots:{default:[create_default_slot_1$A]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&268435484&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_fragment$2E(p){let u,f,m,v,y={$$slots:{default:[create_default_slot_2$o]},$$scope:{ctx:p}};u=new Modal({props:y}),p[16](u);let w={$$slots:{default:[create_default_slot$1k]},$$scope:{ctx:p}};return m=new Modal({props:w}),p[17](m),{c(){create_component(u.$$.fragment),f=space(),create_component(m.$$.fragment)},m(k,S){mount_component(u,k,S),insert(k,f,S),mount_component(m,k,S),v=!0},p(k,[S]){const M={};S&268435484&&(M.$$scope={dirty:S,ctx:k}),u.$set(M);const E={};S&268435484&&(E.$$scope={dirty:S,ctx:k}),m.$set(E)},i(k){v||(transition_in(u.$$.fragment,k),transition_in(m.$$.fragment,k),v=!0)},o(k){transition_out(u.$$.fragment,k),transition_out(m.$$.fragment,k),v=!1},d(k){k&&detach(f),p[16](null),destroy_component(u,k),p[17](null),destroy_component(m,k)}}}const duration$2=260;function instance$2B(p,u,f){let m,v,y,w,k,S,M,E;const{selectedRows:T,rows:H,subscribe:V,notifications:q,menu:Z,selectedCellCount:J,selectedRowCount:ae,selectedCells:ie,rowLookupMap:he,config:fe}=getContext$1("grid");component_subscribe(p,T,ve=>f(15,E=ve)),component_subscribe(p,q,ve=>f(20,y=ve)),component_subscribe(p,J,ve=>f(21,w=ve)),component_subscribe(p,ae,ve=>f(23,S=ve)),component_subscribe(p,ie,ve=>f(19,v=ve)),component_subscribe(p,he,ve=>f(14,M=ve)),component_subscribe(p,fe,ve=>f(22,k=ve));let me,be,Ce=!1,ze=0,Se=0;const Ie=()=>{f(3,ze=0),Z.actions.close(),S&&k.canDeleteRows?S===1?xe():(f(4,Se=S),me==null||me.show()):w&&k.canEditRows&&(f(4,Se=w),be==null||be.show())},xe=async()=>{f(2,Ce=!0);const ve=m.length;await H.actions.deleteRows(m),f(3,ze=100),await sleep(duration$2),y.success(`Deleted ${ve} row${ve===1?"":"s"}`),f(2,Ce=!1)},Ne=async()=>{f(2,Ce=!0);let ve={};for(let Re of v)for(let Qe of Re){const{rowId:Fe,field:Je}=parseCellID(Qe);ve[Fe]||(ve[Fe]={}),ve[Fe][Je]=null}await H.actions.bulkUpdate(ve,Re=>{f(3,ze=Re*100)}),await sleep(duration$2),f(2,Ce=!1)};onMount(()=>V("request-bulk-delete",Ie));function $e(ve){binding_callbacks[ve?"unshift":"push"](()=>{me=ve,f(0,me)})}function Ze(ve){binding_callbacks[ve?"unshift":"push"](()=>{be=ve,f(1,be)})}return p.$$.update=()=>{p.$$.dirty&49152&&(m=Object.keys(E).map(ve=>M[ve]).filter(ve=>ve!=null))},[me,be,Ce,ze,Se,T,q,J,ae,ie,he,fe,xe,Ne,M,E,$e,Ze]}class BulkDeleteHandler extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2B,create_fragment$2E,safe_not_equal,{})}}function create_if_block$1y(p){let u,f;return u=new ProgressBar({props:{size:"L",value:p[1],duration:duration$1,width:"100%"}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&2&&(y.value=m[1]),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot_1$z(p){let u,f,m,v,y,w=p[2]&&create_if_block$1y(p);return{c(){u=text$1("Are you sure you want to duplicate "),f=text$1(p[3]),m=text$1(` rows?
394
394
  `),w&&w.c(),v=empty$1()},m(k,S){insert(k,u,S),insert(k,f,S),insert(k,m,S),w&&w.m(k,S),insert(k,v,S),y=!0},p(k,S){(!y||S&8)&&set_data(f,k[3]),k[2]?w?(w.p(k,S),S&4&&transition_in(w,1)):(w=create_if_block$1y(k),w.c(),transition_in(w,1),w.m(v.parentNode,v)):w&&(group_outros(),transition_out(w,1,1,()=>{w=null}),check_outros())},i(k){y||(transition_in(w),y=!0)},o(k){transition_out(w),y=!1},d(k){k&&(detach(u),detach(f),detach(m),detach(v)),w&&w.d(k)}}}function create_default_slot$1j(p){let u,f;return u=new ModalContent({props:{title:"Duplicate rows",confirmText:"Continue",cancelText:"Cancel",onConfirm:p[8],size:"M",$$slots:{default:[create_default_slot_1$z]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&262158&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_fragment$2D(p){let u,f,m={$$slots:{default:[create_default_slot$1j]},$$scope:{ctx:p}};return u=new Modal({props:m}),p[9](u),{c(){create_component(u.$$.fragment)},m(v,y){mount_component(u,v,y),f=!0},p(v,[y]){const w={};y&262158&&(w.$$scope={dirty:y,ctx:v}),u.$set(w)},i(v){f||(transition_in(u.$$.fragment,v),f=!0)},o(v){transition_out(u.$$.fragment,v),f=!1},d(v){p[9](null),destroy_component(u,v)}}}const duration$1=260;function instance$2A(p,u,f){let m,v,y,w;const{selectedRows:k,rows:S,subscribe:M,selectedRowCount:E,visibleColumns:T,selectedCells:H,rowLookupMap:V}=getContext$1("grid");component_subscribe(p,k,me=>f(13,w=me)),component_subscribe(p,E,me=>f(10,m=me)),component_subscribe(p,T,me=>f(11,v=me)),component_subscribe(p,V,me=>f(12,y=me));let q,Z=0,J=!1,ae=0;const ie=async()=>{f(1,Z=0),f(2,J=!0);const me=Object.keys(w).map(Ce=>y[Ce]),be=await S.actions.bulkDuplicate(me,Ce=>{f(1,Z=Ce*100)});if(await sleep(duration$1),be.length){const Ce=be[0],ze=be[be.length-1],Se=v[0],Ie=v[v.length-1],xe=getCellID(Ce._id,Se.name),Ne=getCellID(ze._id,Ie.name);H.actions.selectRange(xe,Ne)}f(2,J=!1)},he=()=>{f(3,ae=m),q==null||q.show()};onMount(()=>M("request-bulk-duplicate",he));function fe(me){binding_callbacks[me?"unshift":"push"](()=>{q=me,f(0,q)})}return[q,Z,J,ae,k,E,T,V,ie,fe]}class BulkDuplicationHandler extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2A,create_fragment$2D,safe_not_equal,{})}}function create_if_block$1x(p){let u,f;return u=new ProgressBar({props:{size:"L",value:p[1],duration,width:"100%"}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&2&&(y.value=m[1]),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot_1$y(p){let u,f,m,v=p[2]&&create_if_block$1x(p);return{c(){u=text$1(`Are you sure you want to paste? This will update multiple values.
395
- `),v&&v.c(),f=empty$1()},m(y,w){insert(y,u,w),v&&v.m(y,w),insert(y,f,w),m=!0},p(y,w){y[2]?v?(v.p(y,w),w&4&&transition_in(v,1)):(v=create_if_block$1x(y),v.c(),transition_in(v,1),v.m(f.parentNode,f)):v&&(group_outros(),transition_out(v,1,1,()=>{v=null}),check_outros())},i(y){m||(transition_in(v),m=!0)},o(y){transition_out(v),m=!1},d(y){y&&(detach(u),detach(f)),v&&v.d(y)}}}function create_default_slot$1i(p){let u,f;return u=new ModalContent({props:{title:"Confirm paste",confirmText:"Continue",cancelText:"Cancel",onConfirm:p[7],size:"M",$$slots:{default:[create_default_slot_1$y]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&131078&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_fragment$2C(p){let u,f,m={$$slots:{default:[create_default_slot$1i]},$$scope:{ctx:p}};return u=new Modal({props:m}),p[8](u),{c(){create_component(u.$$.fragment)},m(v,y){mount_component(u,v,y),f=!0},p(v,[y]){const w={};y&131078&&(w.$$scope={dirty:y,ctx:v}),u.$set(w)},i(v){f||(transition_in(u.$$.fragment,v),f=!0)},o(v){transition_out(u.$$.fragment,v),f=!1},d(v){p[8](null),destroy_component(u,v)}}}const duration=260;function instance$2z(p,u,f){let m,v,y,w;const{clipboard:k,subscribe:S,copyAllowed:M,pasteAllowed:E,selectedCellCount:T,focusedCellAPI:H}=getContext$1("grid");component_subscribe(p,k,fe=>f(9,m=fe)),component_subscribe(p,M,fe=>f(12,w=fe)),component_subscribe(p,E,fe=>f(11,y=fe)),component_subscribe(p,T,fe=>f(10,v=fe));let V,q=0,Z=!1;const J=()=>{w&&k.actions.copy()},ae=async()=>{var be;if((be=get_store_value(H))!=null&&be.isActive()||(f(1,q=0),!y))return;const fe=v>1;m.multiCellCopy||fe?V==null||V.show():k.actions.paste()},ie=async()=>{f(2,Z=!0),await k.actions.paste(fe=>{f(1,q=fe*100)}),await sleep(duration),f(2,Z=!1)};onMount(()=>S("copy",J)),onMount(()=>S("paste",ae));function he(fe){binding_callbacks[fe?"unshift":"push"](()=>{V=fe,f(0,V)})}return[V,q,Z,k,M,E,T,ie,he]}class ClipboardHandler extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2z,create_fragment$2C,safe_not_equal,{})}}const GridScrollWrapper_svelte_svelte_type_style_lang="";function create_fragment$2B(p){let u,f,m,v,y;const w=p[23].default,k=create_slot(w,p,p[22],null);return{c(){u=element("div"),f=element("div"),k&&k.c(),attr(f,"style",p[2]),attr(f,"class","inner svelte-i68dpr"),attr(u,"class","outer svelte-i68dpr")},m(S,M){insert(S,u,M),append$2(u,f),k&&k.m(f,null),p[24](f),m=!0,v||(y=[listen(u,"wheel",function(){is_function(p[1]?p[14]:null)&&(p[1]?p[14]:null).apply(this,arguments)}),listen(u,"touchstart",function(){is_function(p[1]?p[15]:null)&&(p[1]?p[15]:null).apply(this,arguments)}),listen(u,"touchmove",function(){is_function(p[1]?p[16]:null)&&(p[1]?p[16]:null).apply(this,arguments)}),listen(u,"click",self$1(p[5].actions.blur))],v=!0)},p(S,M){p=S,k&&k.p&&(!m||M[0]&4194304)&&update_slot_base(k,w,p,p[22],m?get_slot_changes(w,p[22],M,null):get_all_dirty_from_scope(p[22]),null),(!m||M[0]&4)&&attr(f,"style",p[2])},i(S){m||(transition_in(k,S),m=!0)},o(S){transition_out(k,S),m=!1},d(S){S&&detach(u),k&&k.d(S),p[24](null),v=!1,run_all(y)}}}function instance$2y(p,u,f){let m,v,y,w,k,S,M,E,T,H,V,{$$slots:q={},$$scope:Z}=u;const{rowHeight:J,scroll:ae,ui:ie,renderedRows:he,maxScrollTop:fe,maxScrollLeft:me,bounds:be,hoveredRowId:Ce,menu:ze,focusedCellAPI:Se,scrollTop:Ie,scrollLeft:xe}=getContext$1("grid");component_subscribe(p,J,dt=>f(19,v=dt)),component_subscribe(p,ae,dt=>f(31,M=dt)),component_subscribe(p,he,dt=>f(27,y=dt)),component_subscribe(p,fe,dt=>f(30,S=dt)),component_subscribe(p,me,dt=>f(29,k=dt)),component_subscribe(p,be,dt=>f(28,w=dt)),component_subscribe(p,ze,dt=>f(32,E=dt)),component_subscribe(p,Se,dt=>f(33,T=dt)),component_subscribe(p,Ie,dt=>f(20,H=dt)),component_subscribe(p,xe,dt=>f(21,V=dt));let{scrollVertically:Ne=!1}=u,{scrollHorizontally:$e=!1}=u,{attachHandlers:Ze=!1}=u,{ref:ve}=u,Re,Qe;const Fe=(dt,xt,ot)=>{const jt=$e?-1*dt:0,Xe=Ne?-1*(xt%ot):0;return`transform: translate(${jt}px, ${Xe}px);`},Je=dt=>{dt.preventDefault(),qe(dt.deltaX,dt.deltaY,dt.clientY),T==null||T.blur(),E.visible&&ze.actions.close()},ft=dt=>{var xt;(xt=dt.touches)!=null&&xt[0]&&(Re=dt.touches[0].clientX,Qe=dt.touches[0].clientY)},Et=dt=>{var jt;if(!((jt=dt.touches)!=null&&jt[0]))return;dt.preventDefault();const xt=Re-dt.touches[0].clientX,ot=Qe-dt.touches[0].clientY;qe(xt,ot),Re=dt.touches[0].clientX,Qe=dt.touches[0].clientY,E.visible&&ze.actions.close()},qe=domDebounce((dt,xt,ot)=>{const{top:jt,left:Xe}=M;let Ut=jt+xt;Ut=Math.max(0,Math.min(Ut,S));let en=Xe+dt;if(en=Math.max(0,Math.min(en,k)),ae.set({left:$e?en:Xe,top:Ne?Ut:jt}),ot!=null){const Nt=ot-w.top+Ut%v,kt=y[Math.floor(Nt/v)];Ce.set(kt==null?void 0:kt._id)}});function Ge(dt){binding_callbacks[dt?"unshift":"push"](()=>{ve=dt,f(0,ve)})}return p.$$set=dt=>{"scrollVertically"in dt&&f(17,Ne=dt.scrollVertically),"scrollHorizontally"in dt&&f(18,$e=dt.scrollHorizontally),"attachHandlers"in dt&&f(1,Ze=dt.attachHandlers),"ref"in dt&&f(0,ve=dt.ref),"$$scope"in dt&&f(22,Z=dt.$$scope)},p.$$.update=()=>{p.$$.dirty[0]&3670016&&f(2,m=Fe(V,H,v))},[ve,Ze,m,J,ae,ie,he,fe,me,be,ze,Se,Ie,xe,Je,ft,Et,Ne,$e,v,H,V,Z,q,Ge]}class GridScrollWrapper extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2y,create_fragment$2B,safe_not_equal,{scrollVertically:17,scrollHorizontally:18,attachHandlers:1,ref:0},null,[-1,-1])}}const GridCell_svelte_svelte_type_style_lang="";function create_if_block_1$M(p){let u,f;return{c(){u=element("div"),f=text$1(p[4]),attr(u,"class","label svelte-1n504m6")},m(m,v){insert(m,u,v),append$2(u,f)},p(m,v){v&16&&set_data(f,m[4])},d(m){m&&detach(u)}}}function create_if_block$1w(p){let u,f=p[3].label+"",m;return{c(){u=element("div"),m=text$1(f),attr(u,"class","label svelte-1n504m6")},m(v,y){insert(v,u,y),append$2(u,m)},p(v,y){y&8&&f!==(f=v[3].label+"")&&set_data(m,f)},d(v){v&&detach(u)}}}function create_fragment$2A(p){let u,f,m,v,y,w,k=p[4]&&create_if_block_1$M(p);const S=p[15].default,M=create_slot(S,p,p[14],null);let E=p[3]&&!p[0]&&create_if_block$1w(p);return{c(){u=element("div"),k&&k.c(),f=space(),M&&M.c(),m=space(),E&&E.c(),attr(u,"class","cell svelte-1n504m6"),attr(u,"style",p[11]),toggle_class(u,"selected",p[1]),toggle_class(u,"highlighted",p[2]),toggle_class(u,"focused",p[0]),toggle_class(u,"error",p[4]),toggle_class(u,"center",p[8]),toggle_class(u,"readonly",p[9]),toggle_class(u,"hidden",p[10]),toggle_class(u,"default-height",p[7]),toggle_class(u,"selected-other",p[3]!=null),toggle_class(u,"alt",p[5]%2===1),toggle_class(u,"top",p[6])},m(T,H){insert(T,u,H),k&&k.m(u,null),append$2(u,f),M&&M.m(u,null),append$2(u,m),E&&E.m(u,null),v=!0,y||(w=[listen(u,"focus",p[16]),listen(u,"mousedown",p[17]),listen(u,"mouseup",p[18]),listen(u,"click",p[19]),listen(u,"contextmenu",p[20]),listen(u,"touchstart",p[21],{passive:!0}),listen(u,"touchend",p[22]),listen(u,"touchcancel",p[23]),listen(u,"mouseenter",p[24])],y=!0)},p(T,[H]){T[4]?k?k.p(T,H):(k=create_if_block_1$M(T),k.c(),k.m(u,f)):k&&(k.d(1),k=null),M&&M.p&&(!v||H&16384)&&update_slot_base(M,S,T,T[14],v?get_slot_changes(S,T[14],H,null):get_all_dirty_from_scope(T[14]),null),T[3]&&!T[0]?E?E.p(T,H):(E=create_if_block$1w(T),E.c(),E.m(u,null)):E&&(E.d(1),E=null),(!v||H&2048)&&attr(u,"style",T[11]),(!v||H&2)&&toggle_class(u,"selected",T[1]),(!v||H&4)&&toggle_class(u,"highlighted",T[2]),(!v||H&1)&&toggle_class(u,"focused",T[0]),(!v||H&16)&&toggle_class(u,"error",T[4]),(!v||H&256)&&toggle_class(u,"center",T[8]),(!v||H&512)&&toggle_class(u,"readonly",T[9]),(!v||H&1024)&&toggle_class(u,"hidden",T[10]),(!v||H&128)&&toggle_class(u,"default-height",T[7]),(!v||H&8)&&toggle_class(u,"selected-other",T[3]!=null),(!v||H&32)&&toggle_class(u,"alt",T[5]%2===1),(!v||H&64)&&toggle_class(u,"top",T[6])},i(T){v||(transition_in(M,T),v=!0)},o(T){transition_out(M,T),v=!1},d(T){T&&detach(u),k&&k.d(),M&&M.d(T),E&&E.d(),y=!1,run_all(w)}}}function instance$2x(p,u,f){let m,{$$slots:v={},$$scope:y}=u,{focused:w=!1}=u,{selected:k=!1}=u,{highlighted:S=!1}=u,{width:M=""}=u,{selectedUser:E=null}=u,{error:T=null}=u,{rowIdx:H}=u,{topRow:V=!1}=u,{defaultHeight:q=!1}=u,{center:Z=!1}=u,{readonly:J=!1}=u,{hidden:ae=!1}=u,{metadata:ie=null}=u;const he=($e,Ze,ve)=>{let Re;return $e==="auto"||$e==="100%"?Re=`width: ${$e};`:Re=`flex: 0 0 ${$e}px;`,Ze&&(Re+=`--user-color :${Ze.color};`),ve!=null&&ve.backgroundColor&&(Re+=`--cell-background: ${ve.backgroundColor};`),ve!=null&&ve.textColor&&(Re+=`--cell-font-color: ${ve.textColor};`),Re};function fe($e){bubble.call(this,p,$e)}function me($e){bubble.call(this,p,$e)}function be($e){bubble.call(this,p,$e)}function Ce($e){bubble.call(this,p,$e)}function ze($e){bubble.call(this,p,$e)}function Se($e){bubble.call(this,p,$e)}function Ie($e){bubble.call(this,p,$e)}function xe($e){bubble.call(this,p,$e)}function Ne($e){bubble.call(this,p,$e)}return p.$$set=$e=>{"focused"in $e&&f(0,w=$e.focused),"selected"in $e&&f(1,k=$e.selected),"highlighted"in $e&&f(2,S=$e.highlighted),"width"in $e&&f(12,M=$e.width),"selectedUser"in $e&&f(3,E=$e.selectedUser),"error"in $e&&f(4,T=$e.error),"rowIdx"in $e&&f(5,H=$e.rowIdx),"topRow"in $e&&f(6,V=$e.topRow),"defaultHeight"in $e&&f(7,q=$e.defaultHeight),"center"in $e&&f(8,Z=$e.center),"readonly"in $e&&f(9,J=$e.readonly),"hidden"in $e&&f(10,ae=$e.hidden),"metadata"in $e&&f(13,ie=$e.metadata),"$$scope"in $e&&f(14,y=$e.$$scope)},p.$$.update=()=>{p.$$.dirty&12296&&f(11,m=he(M,E,ie))},[w,k,S,E,T,H,V,q,Z,J,ae,m,M,ie,y,v,fe,me,be,Ce,ze,Se,Ie,xe,Ne]}class GridCell extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2x,create_fragment$2A,safe_not_equal,{focused:0,selected:1,highlighted:2,width:12,selectedUser:3,error:4,rowIdx:5,topRow:6,defaultHeight:7,center:8,readonly:9,hidden:10,metadata:13})}}const GridPopover_svelte_svelte_type_style_lang="";function create_default_slot$1h(p){let u,f,m,v;const y=p[13].default,w=create_slot(y,p,p[15],null);return{c(){u=element("div"),w&&w.c(),attr(u,"class","grid-popover-contents svelte-5gc6hw"),attr(u,"style",p[7])},m(k,S){insert(k,u,S),w&&w.m(u,null),f=!0,m||(v=[action_destroyer(clickOutside.call(null,u,p[14])),listen(u,"wheel",wheel_handler)],m=!0)},p(k,S){w&&w.p&&(!f||S&32768)&&update_slot_base(w,y,k,k[15],f?get_slot_changes(y,k[15],S,null):get_all_dirty_from_scope(k[15]),null),(!f||S&128)&&attr(u,"style",k[7])},i(k){f||(transition_in(w,k),f=!0)},o(k){transition_out(w,k),f=!1},d(k){k&&detach(u),w&&w.d(k),m=!1,run_all(v)}}}function create_fragment$2z(p){let u,f;return u=new Popover({props:{open:p[2],anchor:p[0],align:p[1],resizable:p[3],wrap:p[4],offset:p[5],clickOutsideOverride:p[6],portalTarget:"#"+p[8]+" .grid-popover-container",$$slots:{default:[create_default_slot$1h]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,[v]){const y={};v&4&&(y.open=m[2]),v&1&&(y.anchor=m[0]),v&2&&(y.align=m[1]),v&8&&(y.resizable=m[3]),v&16&&(y.wrap=m[4]),v&32&&(y.offset=m[5]),v&64&&(y.clickOutsideOverride=m[6]),v&32896&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}const wheel_handler=p=>p.stopPropagation();function instance$2w(p,u,f){let m,{$$slots:v={},$$scope:y}=u,{anchor:w}=u,{minWidth:k=PopoverMinWidth}=u,{maxWidth:S=PopoverMaxWidth}=u,{maxHeight:M=PopoverMaxHeight}=u,{align:E="left"}=u,{open:T=!0}=u,{resizable:H=!1}=u,{wrap:V=!0}=u,{offset:q=0}=u,{clickOutsideOverride:Z}=u;const{gridID:J}=getContext$1("grid"),ae=createEventDispatcher(),ie=(fe,me,be)=>{let Ce="";return fe!=null&&(Ce+=`min-width: ${fe}px;`),me!=null&&(Ce+=`max-width: ${me}px;`),be!=null&&(Ce+=`max-height: ${be}px;`),Ce},he=()=>ae("close");return p.$$set=fe=>{"anchor"in fe&&f(0,w=fe.anchor),"minWidth"in fe&&f(10,k=fe.minWidth),"maxWidth"in fe&&f(11,S=fe.maxWidth),"maxHeight"in fe&&f(12,M=fe.maxHeight),"align"in fe&&f(1,E=fe.align),"open"in fe&&f(2,T=fe.open),"resizable"in fe&&f(3,H=fe.resizable),"wrap"in fe&&f(4,V=fe.wrap),"offset"in fe&&f(5,q=fe.offset),"clickOutsideOverride"in fe&&f(6,Z=fe.clickOutsideOverride),"$$scope"in fe&&f(15,y=fe.$$scope)},p.$$.update=()=>{p.$$.dirty&7168&&f(7,m=ie(k,S,M))},[w,E,T,H,V,q,Z,m,J,ae,k,S,M,v,he,y]}class GridPopover extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2w,create_fragment$2z,safe_not_equal,{anchor:0,minWidth:10,maxWidth:11,maxHeight:12,align:1,open:2,resizable:3,wrap:4,offset:5,clickOutsideOverride:6})}}const OptionsCell_svelte_svelte_type_style_lang="";function get_each_context$v(p,u,f){const m=p.slice();m[23]=u[f],m[26]=f;const v=m[8][m[23]]||m[11](m[23]);return m[24]=v,m}function get_each_context_1$5(p,u,f){const m=p.slice();m[27]=u[f];const v=m[8][m[27]]||m[11](m[27]);return m[24]=v,m}function create_else_block$t(p){let u,f=(p[27]||"")+"",m,v;return{c(){u=element("div"),m=text$1(f),v=space(),attr(u,"class","text svelte-14lr9ae")},m(y,w){insert(y,u,w),append$2(u,m),append$2(u,v)},p(y,w){w&64&&f!==(f=(y[27]||"")+"")&&set_data(m,f)},d(y){y&&detach(u)}}}function create_if_block_3$k(p){let u,f,m=p[27]+"",v,y;return{c(){u=element("div"),f=element("span"),v=text$1(m),y=space(),attr(f,"class","svelte-14lr9ae"),attr(u,"class","badge text svelte-14lr9ae"),set_style(u,"--color",p[24])},m(w,k){insert(w,u,k),append$2(u,f),append$2(f,v),append$2(u,y)},p(w,k){k&64&&m!==(m=w[27]+"")&&set_data(v,m),k&320&&set_style(u,"--color",w[24])},d(w){w&&detach(u)}}}function create_each_block_1$5(p){let u;function f(y,w){return y[24]?create_if_block_3$k:create_else_block$t}let m=f(p),v=m(p);return{c(){v.c(),u=empty$1()},m(y,w){v.m(y,w),insert(y,u,w)},p(y,w){m===(m=f(y))&&v?v.p(y,w):(v.d(1),v=m(y),v&&(v.c(),v.m(u.parentNode,u)))},d(y){y&&detach(u),v.d(y)}}}function create_if_block_2$t(p){let u,f,m,v,y;return f=new Icon$1({props:{name:"ChevronDown"}}),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"class","arrow svelte-14lr9ae")},m(w,k){insert(w,u,k),mount_component(f,u,null),m=!0,v||(y=listen(u,"click",p[9]),v=!0)},p:noop$2,i(w){m||(transition_in(f.$$.fragment,w),m=!0)},o(w){transition_out(f.$$.fragment,w),m=!1},d(w){w&&detach(u),destroy_component(f),v=!1,y()}}}function create_if_block$1v(p){let u,f;return u=new GridPopover({props:{anchor:p[4],$$slots:{default:[create_default_slot$1g]},$$scope:{ctx:p}}}),u.$on("close",p[10]),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&16&&(y.anchor=m[4]),v&1073742184&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_if_block_1$L(p){let u,f;return u=new Icon$1({props:{name:"Checkmark",color:"var(--accent-color)"}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_each_block$v(p){let u,f,m,v=p[23]+"",y,w,k=p[6].includes(p[23]),S,M,E,T,H=k&&create_if_block_1$L();function V(){return p[20](p[23])}function q(){return p[21](p[26])}return{c(){u=element("div"),f=element("div"),m=element("span"),y=text$1(v),w=space(),H&&H.c(),S=space(),attr(m,"class","svelte-14lr9ae"),attr(f,"class","badge text svelte-14lr9ae"),set_style(f,"--color",p[24]),attr(u,"class","option svelte-14lr9ae"),toggle_class(u,"focused",p[3]===p[26])},m(Z,J){insert(Z,u,J),append$2(u,f),append$2(f,m),append$2(m,y),append$2(u,w),H&&H.m(u,null),append$2(u,S),M=!0,E||(T=[listen(u,"click",V),listen(u,"mouseenter",q)],E=!0)},p(Z,J){p=Z,(!M||J&32)&&v!==(v=p[23]+"")&&set_data(y,v),(!M||J&288)&&set_style(f,"--color",p[24]),J&96&&(k=p[6].includes(p[23])),k?H?J&96&&transition_in(H,1):(H=create_if_block_1$L(),H.c(),transition_in(H,1),H.m(u,S)):H&&(group_outros(),transition_out(H,1,1,()=>{H=null}),check_outros()),(!M||J&8)&&toggle_class(u,"focused",p[3]===p[26])},i(Z){M||(transition_in(H),M=!0)},o(Z){transition_out(H),M=!1},d(Z){Z&&detach(u),H&&H.d(),E=!1,run_all(T)}}}function create_default_slot$1g(p){let u,f,m=ensure_array_like(p[5]),v=[];for(let w=0;w<m.length;w+=1)v[w]=create_each_block$v(get_each_context$v(p,m,w));const y=w=>transition_out(v[w],1,1,()=>{v[w]=null});return{c(){u=element("div");for(let w=0;w<v.length;w+=1)v[w].c();attr(u,"class","options svelte-14lr9ae")},m(w,k){insert(w,u,k);for(let S=0;S<v.length;S+=1)v[S]&&v[S].m(u,null);f=!0},p(w,k){if(k&6504){m=ensure_array_like(w[5]);let S;for(S=0;S<m.length;S+=1){const M=get_each_context$v(w,m,S);v[S]?(v[S].p(M,k),transition_in(v[S],1)):(v[S]=create_each_block$v(M),v[S].c(),transition_in(v[S],1),v[S].m(u,null))}for(group_outros(),S=m.length;S<v.length;S+=1)y(S);check_outros()}},i(w){if(!f){for(let k=0;k<m.length;k+=1)transition_in(v[k]);f=!0}},o(w){v=v.filter(Boolean);for(let k=0;k<v.length;k+=1)transition_out(v[k]);f=!1},d(w){w&&detach(u),destroy_each(v,w)}}}function create_fragment$2y(p){let u,f,m,v,y,w,k,S,M=ensure_array_like(p[6]),E=[];for(let V=0;V<M.length;V+=1)E[V]=create_each_block_1$5(get_each_context_1$5(p,M,V));let T=p[7]&&create_if_block_2$t(p),H=p[2]&&create_if_block$1v(p);return{c(){u=element("div"),f=element("div");for(let V=0;V<E.length;V+=1)E[V].c();m=space(),T&&T.c(),v=space(),H&&H.c(),y=empty$1(),attr(f,"class","values svelte-14lr9ae"),toggle_class(f,"wrap",p[1]>1),attr(u,"class","container svelte-14lr9ae"),toggle_class(u,"multi",p[0]),toggle_class(u,"editable",p[7]),toggle_class(u,"open",p[9])},m(V,q){insert(V,u,q),append$2(u,f);for(let Z=0;Z<E.length;Z+=1)E[Z]&&E[Z].m(f,null);append$2(u,m),T&&T.m(u,null),p[19](u),insert(V,v,q),H&&H.m(V,q),insert(V,y,q),w=!0,k||(S=[listen(f,"click",function(){is_function(p[7]?p[9]:null)&&(p[7]?p[9]:null).apply(this,arguments)}),listen(u,"click",self$1(function(){is_function(p[7]?p[9]:null)&&(p[7]?p[9]:null).apply(this,arguments)}))],k=!0)},p(V,[q]){if(p=V,q&2368){M=ensure_array_like(p[6]);let Z;for(Z=0;Z<M.length;Z+=1){const J=get_each_context_1$5(p,M,Z);E[Z]?E[Z].p(J,q):(E[Z]=create_each_block_1$5(J),E[Z].c(),E[Z].m(f,null))}for(;Z<E.length;Z+=1)E[Z].d(1);E.length=M.length}(!w||q&2)&&toggle_class(f,"wrap",p[1]>1),p[7]?T?(T.p(p,q),q&128&&transition_in(T,1)):(T=create_if_block_2$t(p),T.c(),transition_in(T,1),T.m(u,null)):T&&(group_outros(),transition_out(T,1,1,()=>{T=null}),check_outros()),(!w||q&1)&&toggle_class(u,"multi",p[0]),(!w||q&128)&&toggle_class(u,"editable",p[7]),p[2]?H?(H.p(p,q),q&4&&transition_in(H,1)):(H=create_if_block$1v(p),H.c(),transition_in(H,1),H.m(y.parentNode,y)):H&&(group_outros(),transition_out(H,1,1,()=>{H=null}),check_outros())},i(V){w||(transition_in(T),transition_in(H),w=!0)},o(V){transition_out(T),transition_out(H),w=!1},d(V){V&&(detach(u),detach(v),detach(y)),destroy_each(E,V),T&&T.d(),p[19](null),H&&H.d(V),k=!1,run_all(S)}}}const InvalidColor="hsla(0, 0%, 70%, 0.3)";function instance$2v(p,u,f){let m,v,y,w,{value:k}=u,{schema:S}=u,{onChange:M}=u,{focused:E=!1}=u,{multi:T=!1}=u,{readonly:H=!1}=u,{api:V}=u,{contentLines:q=1}=u,Z=!1,J=null,ae;const ie=()=>{f(2,Z=!0),f(3,J=0)},he=()=>{f(2,Z=!1)},fe=Ie=>{let xe=Ie?m.indexOf(Ie):null;return xe==null||xe===-1?InvalidColor:OptionColours[xe%OptionColours.length]},me=Ie=>{if(!T)M(Ie===k?null:Ie),he();else{const xe=w.filter(Ne=>m.includes(Ne));xe.includes(Ie)?M(xe.filter(Ne=>Ne!==Ie)):M([...xe,Ie])}},be=Ie=>Z?(Ie.preventDefault(),Ie.key==="ArrowDown"?f(3,J=Math.min(J+1,m.length-1)):Ie.key==="ArrowUp"?f(3,J=Math.max(J-1,0)):Ie.key==="Enter"&&me(m[J]),!0):!1;onMount(()=>{f(13,V={focus:ie,blur:he,isActive:()=>Z,onKeyDown:be})});function Ce(Ie){binding_callbacks[Ie?"unshift":"push"](()=>{ae=Ie,f(4,ae)})}const ze=Ie=>me(Ie),Se=Ie=>f(3,J=Ie);return p.$$set=Ie=>{"value"in Ie&&f(14,k=Ie.value),"schema"in Ie&&f(15,S=Ie.schema),"onChange"in Ie&&f(16,M=Ie.onChange),"focused"in Ie&&f(17,E=Ie.focused),"multi"in Ie&&f(0,T=Ie.multi),"readonly"in Ie&&f(18,H=Ie.readonly),"api"in Ie&&f(13,V=Ie.api),"contentLines"in Ie&&f(1,q=Ie.contentLines)},p.$$.update=()=>{var Ie;p.$$.dirty&32768&&f(5,m=((Ie=S==null?void 0:S.constraints)==null?void 0:Ie.inclusion)||[]),p.$$.dirty&32768&&f(8,v=(S==null?void 0:S.optionColors)||{}),p.$$.dirty&393216&&f(7,y=E&&!H),p.$$.dirty&16384&&f(6,w=Array.isArray(k)?k:[k].filter(xe=>xe!=null)),p.$$.dirty&131076&&!E&&Z&&he()},[T,q,Z,J,ae,m,w,y,v,ie,he,fe,me,V,k,S,M,E,H,Ce,ze,Se]}class OptionsCell extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2v,create_fragment$2y,safe_not_equal,{value:14,schema:15,onChange:16,focused:17,multi:0,readonly:18,api:13,contentLines:1})}}const DateCell_svelte_svelte_type_style_lang="";function create_if_block_1$K(p){let u,f;return u=new Icon$1({props:{name:"Calendar"}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_if_block$1u(p){let u,f;return u=new GridPopover({props:{anchor:p[6],maxHeight:null,$$slots:{default:[create_default_slot$1f]},$$scope:{ctx:p}}}),u.$on("close",p[10]),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&64&&(y.anchor=m[6]),v&2097213&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot$1f(p){let u,f;return u=new DatePickerPopoverContents({props:{value:p[5],useKeyboardShortcuts:!1,enableTime:p[4],timeOnly:p[3],ignoreTimezones:p[2]}}),u.$on("change",p[17]),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&32&&(y.value=m[5]),v&16&&(y.enableTime=m[4]),v&8&&(y.timeOnly=m[3]),v&4&&(y.ignoreTimezones=m[2]),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_fragment$2x(p){let u,f,m,v,y,w,k,S,M,E=p[8]&&create_if_block_1$K(),T=p[1]&&create_if_block$1u(p);return{c(){u=element("div"),f=element("div"),m=text$1(p[7]),v=space(),E&&E.c(),y=space(),T&&T.c(),w=empty$1(),attr(f,"class","value svelte-17mmumr"),attr(u,"class","container svelte-17mmumr"),toggle_class(u,"editable",p[8])},m(H,V){insert(H,u,V),append$2(u,f),append$2(f,m),append$2(u,v),E&&E.m(u,null),p[16](u),insert(H,y,V),T&&T.m(H,V),insert(H,w,V),k=!0,S||(M=listen(u,"click",function(){is_function(p[8]?p[9]:null)&&(p[8]?p[9]:null).apply(this,arguments)}),S=!0)},p(H,[V]){p=H,(!k||V&128)&&set_data(m,p[7]),p[8]?E?V&256&&transition_in(E,1):(E=create_if_block_1$K(),E.c(),transition_in(E,1),E.m(u,null)):E&&(group_outros(),transition_out(E,1,1,()=>{E=null}),check_outros()),(!k||V&256)&&toggle_class(u,"editable",p[8]),p[1]?T?(T.p(p,V),V&2&&transition_in(T,1)):(T=create_if_block$1u(p),T.c(),transition_in(T,1),T.m(w.parentNode,w)):T&&(group_outros(),transition_out(T,1,1,()=>{T=null}),check_outros())},i(H){k||(transition_in(E),transition_in(T),k=!0)},o(H){transition_out(E),transition_out(T),k=!1},d(H){H&&(detach(u),detach(y),detach(w)),E&&E.d(),p[16](null),T&&T.d(H),S=!1,M()}}}function instance$2u(p,u,f){let m,v,y,w,k,S,{value:M}=u,{schema:E}=u,{onChange:T}=u,{focused:H=!1}=u,{readonly:V=!1}=u,{api:q}=u,Z,J;const ae=(ze,Se,Ie)=>getDateDisplayValue(ze,{enableTime:Ie,timeOnly:Se}),ie=()=>{f(1,Z=!0)},he=()=>{f(1,Z=!1),T(M)},fe=ze=>Z?(ze.preventDefault(),ze.key==="ArrowUp"?me(-1,"week"):ze.key==="ArrowDown"?me(1,"week"):ze.key==="ArrowLeft"?me(-1,"day"):ze.key==="ArrowRight"?me(1,"day"):ze.key==="Enter"&&he(),!0):!1,me=(ze,Se)=>{let Ie;M?Ie=dayjs(M).add(ze,Se):Ie=dayjs(),f(0,M=stringifyDate(Ie,{enableTime:v,timeOnly:m,ignoreTimezones:y}))};onMount(()=>{f(11,q={onKeyDown:fe,focus:ie,blur:he,isActive:()=>Z})});function be(ze){binding_callbacks[ze?"unshift":"push"](()=>{J=ze,f(6,J)})}const Ce=ze=>f(0,M=ze.detail);return p.$$set=ze=>{"value"in ze&&f(0,M=ze.value),"schema"in ze&&f(12,E=ze.schema),"onChange"in ze&&f(13,T=ze.onChange),"focused"in ze&&f(14,H=ze.focused),"readonly"in ze&&f(15,V=ze.readonly),"api"in ze&&f(11,q=ze.api)},p.$$.update=()=>{p.$$.dirty&4096&&f(3,m=E==null?void 0:E.timeOnly),p.$$.dirty&4096&&f(4,v=!(E!=null&&E.dateOnly)),p.$$.dirty&4096&&f(2,y=E==null?void 0:E.ignoreTimezones),p.$$.dirty&49152&&f(8,w=H&&!V),p.$$.dirty&29&&f(5,k=parseDate(M,{timeOnly:m,enableTime:v,ignoreTimezones:y})),p.$$.dirty&56&&f(7,S=ae(k,m,v)),p.$$.dirty&16386&&!H&&Z&&he()},[M,Z,y,m,v,k,J,S,w,ie,he,q,E,T,H,V,be,Ce]}class DateCell extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2u,create_fragment$2x,safe_not_equal,{value:0,schema:12,onChange:13,focused:14,readonly:15,api:11})}}function create_fragment$2w(p){let u,f,m;const v=[p[1],{multi:!0}];function y(k){p[2](k)}let w={};for(let k=0;k<v.length;k+=1)w=assign(w,v[k]);return p[0]!==void 0&&(w.api=p[0]),u=new OptionsCell({props:w}),binding_callbacks.push(()=>bind(u,"api",y)),{c(){create_component(u.$$.fragment)},m(k,S){mount_component(u,k,S),m=!0},p(k,[S]){const M=S&2?get_spread_update(v,[get_spread_object(k[1]),v[1]]):{};!f&&S&1&&(f=!0,M.api=k[0],add_flush_callback(()=>f=!1)),u.$set(M)},i(k){m||(transition_in(u.$$.fragment,k),m=!0)},o(k){transition_out(u.$$.fragment,k),m=!1},d(k){destroy_component(u,k)}}}function instance$2t(p,u,f){let{api:m}=u;function v(y){m=y,f(0,m)}return p.$$set=y=>{f(1,u=assign(assign({},u),exclude_internal_props(y))),"api"in y&&f(0,m=y.api)},u=exclude_internal_props(u),[m,u,v]}class MultiSelectCell extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2t,create_fragment$2w,safe_not_equal,{api:0})}}const TextCell_svelte_svelte_type_style_lang="";function create_else_block$s(p){let u,f,m;return{c(){u=element("div"),f=element("div"),m=text$1(p[4]),attr(f,"class","value svelte-6ynh9c"),attr(u,"class","text-cell svelte-6ynh9c"),toggle_class(u,"number",p[1]==="number")},m(v,y){insert(v,u,y),append$2(u,f),append$2(f,m)},p(v,y){y&16&&set_data(m,v[4]),y&2&&toggle_class(u,"number",v[1]==="number")},d(v){v&&detach(u)}}}function create_if_block$1t(p){let u,f,m,v;return{c(){u=element("input"),attr(u,"type",p[1]),u.value=f=p[0]??"",attr(u,"spellcheck","false"),attr(u,"class","svelte-6ynh9c")},m(y,w){insert(y,u,w),p[12](u),m||(v=[listen(u,"focus",p[13]),listen(u,"blur",p[14]),listen(u,"change",p[6])],m=!0)},p(y,w){w&2&&attr(u,"type",y[1]),w&1&&f!==(f=y[0]??"")&&u.value!==f&&(u.value=f)},d(y){y&&detach(u),p[12](null),m=!1,run_all(v)}}}function create_fragment$2v(p){let u;function f(y,w){return y[5]?create_if_block$1t:create_else_block$s}let m=f(p),v=m(p);return{c(){v.c(),u=empty$1()},m(y,w){v.m(y,w),insert(y,u,w)},p(y,[w]){m===(m=f(y))&&v?v.p(y,w):(v.d(1),v=m(y),v&&(v.c(),v.m(u.parentNode,u)))},i:noop$2,o:noop$2,d(y){y&&detach(u),v.d(y)}}}function instance$2s(p,u,f){let m,v,{value:y}=u,{focused:w=!1}=u,{onChange:k}=u,{type:S="text"}=u,{readonly:M=!1}=u,{api:E}=u,{format:T=null}=u,H,V=!1;const q=he=>{k(he.target.value)},Z=he=>{if(!V)return!1;if(he.key==="Enter"){H==null||H.blur();const fe=new KeyboardEvent("keydown",{key:"ArrowDown"});document.dispatchEvent(fe)}return!0};onMount(()=>{f(7,E={focus:()=>H==null?void 0:H.focus(),blur:()=>H==null?void 0:H.blur(),isActive:()=>V,onKeyDown:Z})});function J(he){binding_callbacks[he?"unshift":"push"](()=>{H=he,f(2,H)})}const ae=()=>f(3,V=!0),ie=()=>f(3,V=!1);return p.$$set=he=>{"value"in he&&f(0,y=he.value),"focused"in he&&f(8,w=he.focused),"onChange"in he&&f(9,k=he.onChange),"type"in he&&f(1,S=he.type),"readonly"in he&&f(10,M=he.readonly),"api"in he&&f(7,E=he.api),"format"in he&&f(11,T=he.format)},p.$$.update=()=>{p.$$.dirty&1280&&f(5,m=w&&!M),p.$$.dirty&2049&&f(4,v=(T==null?void 0:T(y))??y??"")},[y,S,H,V,v,m,q,E,w,k,M,T,J,ae,ie]}class TextCell extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2s,create_fragment$2v,safe_not_equal,{value:0,focused:8,onChange:9,type:1,readonly:10,api:7,format:11})}}function create_fragment$2u(p){let u,f,m;const v=[p[3],{onChange:p[1]},{type:"number"},{format:p[2]}];function y(k){p[5](k)}let w={};for(let k=0;k<v.length;k+=1)w=assign(w,v[k]);return p[0]!==void 0&&(w.api=p[0]),u=new TextCell({props:w}),binding_callbacks.push(()=>bind(u,"api",y)),{c(){create_component(u.$$.fragment)},m(k,S){mount_component(u,k,S),m=!0},p(k,[S]){const M=S&14?get_spread_update(v,[S&8&&get_spread_object(k[3]),S&2&&{onChange:k[1]},v[2],S&4&&{format:k[2]}]):{};!f&&S&1&&(f=!0,M.api=k[0],add_flush_callback(()=>f=!1)),u.$set(M)},i(k){m||(transition_in(u.$$.fragment,k),m=!0)},o(k){transition_out(u.$$.fragment,k),m=!1},d(k){destroy_component(u,k)}}}const NumberFormatter=Intl.NumberFormat();function instance$2r(p,u,f){let{api:m}=u,{onChange:v}=u;const y=S=>{const M=parseFloat(S),E=isNaN(M)?null:M;v(E)},w=S=>{const M=typeof S;if(M!=="string"&&M!=="number"||M==="string"&&!S.trim().length)return"";const E=NumberFormatter.format(S);return E==="NaN"?S:E};function k(S){m=S,f(0,m)}return p.$$set=S=>{f(3,u=assign(assign({},u),exclude_internal_props(S))),"api"in S&&f(0,m=S.api),"onChange"in S&&f(4,v=S.onChange)},u=exclude_internal_props(u),[m,y,w,u,v,k]}class NumberCell extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2r,create_fragment$2u,safe_not_equal,{api:0,onChange:4})}}const RelationshipCell_svelte_svelte_type_style_lang="";function get_each_context$u(p,u,f){const m=p.slice();return m[44]=u[f],m[46]=f,m}function get_each_context_1$4(p,u,f){const m=p.slice();return m[47]=u[f],m}function create_if_block_6$7(p){let u,f,m=p[18](p[47][p[0]]||p[47].primaryDisplay)+"",v,y,w,k,S,M=p[12]&&create_if_block_7$6(p);return{c(){u=element("div"),f=element("span"),v=text$1(m),y=space(),M&&M.c(),attr(f,"class","svelte-jeqj3p"),attr(u,"class","badge svelte-jeqj3p"),toggle_class(u,"extra-info",!!p[11][p[47]._id])},m(E,T){insert(E,u,T),append$2(u,f),append$2(f,v),append$2(u,y),M&&M.m(u,null),w=!0,k||(S=listen(u,"focus",focus_handler),k=!0)},p(E,T){(!w||T[0]&65)&&m!==(m=E[18](E[47][E[0]]||E[47].primaryDisplay)+"")&&set_data(v,m),E[12]?M?(M.p(E,T),T[0]&4096&&transition_in(M,1)):(M=create_if_block_7$6(E),M.c(),transition_in(M,1),M.m(u,null)):M&&(group_outros(),transition_out(M,1,1,()=>{M=null}),check_outros()),(!w||T[0]&2112)&&toggle_class(u,"extra-info",!!E[11][E[47]._id])},i(E){w||(transition_in(M),w=!0)},o(E){transition_out(M),w=!1},d(E){E&&detach(u),M&&M.d(),k=!1,S()}}}function create_if_block_7$6(p){let u,f;function m(){return p[26](p[47])}return u=new Icon$1({props:{name:"Close",size:"XS",hoverable:!0}}),u.$on("click",m),{c(){create_component(u.$$.fragment)},m(v,y){mount_component(u,v,y),f=!0},p(v,y){p=v},i(v){f||(transition_in(u.$$.fragment,v),f=!0)},o(v){transition_out(u.$$.fragment,v),f=!1},d(v){destroy_component(u,v)}}}function create_each_block_1$4(p){let u,f,m=(p[47][p[0]]||p[47].primaryDisplay)&&create_if_block_6$7(p);return{c(){m&&m.c(),u=empty$1()},m(v,y){m&&m.m(v,y),insert(v,u,y),f=!0},p(v,y){v[47][v[0]]||v[47].primaryDisplay?m?(m.p(v,y),y[0]&65&&transition_in(m,1)):(m=create_if_block_6$7(v),m.c(),transition_in(m,1),m.m(u.parentNode,u)):m&&(group_outros(),transition_out(m,1,1,()=>{m=null}),check_outros())},i(v){f||(transition_in(m),f=!0)},o(v){transition_out(m),f=!1},d(v){v&&detach(u),m&&m.d(v)}}}function create_if_block_5$b(p){let u,f,m,v,y;return f=new Icon$1({props:{name:"Add",size:"S"}}),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"class","add svelte-jeqj3p")},m(w,k){insert(w,u,k),mount_component(f,u,null),m=!0,v||(y=listen(u,"click",p[15]),v=!0)},p:noop$2,i(w){m||(transition_in(f.$$.fragment,w),m=!0)},o(w){transition_out(f.$$.fragment,w),m=!1},d(w){w&&detach(u),destroy_component(f),v=!1,y()}}}function create_if_block_4$d(p){var v;let u,f=(((v=p[6])==null?void 0:v.length)||0)+"",m;return{c(){u=element("div"),m=text$1(f),attr(u,"class","count svelte-jeqj3p")},m(y,w){insert(y,u,w),append$2(u,m)},p(y,w){var k;w[0]&64&&f!==(f=(((k=y[6])==null?void 0:k.length)||0)+"")&&set_data(m,f)},d(y){y&&detach(u)}}}function create_if_block$1s(p){let u,f;return u=new GridPopover({props:{open:p[4],anchor:p[10],$$slots:{default:[create_default_slot$1e]},$$scope:{ctx:p}}}),u.$on("close",p[16]),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&16&&(y.open=m[4]),v[0]&1024&&(y.anchor=m[10]),v[0]&929|v[1]&524288&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_if_block_2$s(p){let u,f,m=ensure_array_like(p[7]),v=[];for(let w=0;w<m.length;w+=1)v[w]=create_each_block$u(get_each_context$u(p,m,w));const y=w=>transition_out(v[w],1,1,()=>{v[w]=null});return{c(){u=element("div");for(let w=0;w<v.length;w+=1)v[w].c();attr(u,"class","results svelte-jeqj3p")},m(w,k){insert(w,u,k);for(let S=0;S<v.length;S+=1)v[S]&&v[S].m(u,null);f=!0},p(w,k){if(k[0]&409984){m=ensure_array_like(w[7]);let S;for(S=0;S<m.length;S+=1){const M=get_each_context$u(w,m,S);v[S]?(v[S].p(M,k),transition_in(v[S],1)):(v[S]=create_each_block$u(M),v[S].c(),transition_in(v[S],1),v[S].m(u,null))}for(group_outros(),S=m.length;S<v.length;S+=1)y(S);check_outros()}},i(w){if(!f){for(let k=0;k<m.length;k+=1)transition_in(v[k]);f=!0}},o(w){v=v.filter(Boolean);for(let k=0;k<v.length;k+=1)transition_out(v[k]);f=!1},d(w){w&&detach(u),destroy_each(v,w)}}}function create_if_block_1$J(p){let u,f,m;return f=new ProgressCircle({props:{size:"S"}}),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"class","searching svelte-jeqj3p")},m(v,y){insert(v,u,y),mount_component(f,u,null),m=!0},p:noop$2,i(v){m||(transition_in(f.$$.fragment,v),m=!0)},o(v){transition_out(f.$$.fragment,v),m=!1},d(v){v&&detach(u),destroy_component(f)}}}function create_if_block_3$j(p){let u,f;return u=new Icon$1({props:{size:"S",name:"Checkmark",color:"var(--accent-color)"}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_each_block$u(p){let u,f,m,v=p[18](p[44].primaryDisplay)+"",y,w,k=p[14](p[44]),S,M,E,T,H=k&&create_if_block_3$j();function V(){return p[30](p[44])}function q(){return p[31](p[46])}return{c(){u=element("div"),f=element("div"),m=element("span"),y=text$1(v),w=space(),H&&H.c(),S=space(),attr(m,"class","svelte-jeqj3p"),attr(f,"class","badge svelte-jeqj3p"),attr(u,"class","result svelte-jeqj3p"),toggle_class(u,"candidate",p[46]===p[8])},m(Z,J){insert(Z,u,J),append$2(u,f),append$2(f,m),append$2(m,y),append$2(u,w),H&&H.m(u,null),append$2(u,S),M=!0,E||(T=[listen(u,"click",V),listen(u,"mouseenter",q)],E=!0)},p(Z,J){p=Z,(!M||J[0]&128)&&v!==(v=p[18](p[44].primaryDisplay)+"")&&set_data(y,v),J[0]&128&&(k=p[14](p[44])),k?H?J[0]&128&&transition_in(H,1):(H=create_if_block_3$j(),H.c(),transition_in(H,1),H.m(u,S)):H&&(group_outros(),transition_out(H,1,1,()=>{H=null}),check_outros()),(!M||J[0]&256)&&toggle_class(u,"candidate",p[46]===p[8])},i(Z){M||(transition_in(H),M=!0)},o(Z){transition_out(H),M=!1},d(Z){Z&&detach(u),H&&H.d(),E=!1,run_all(T)}}}function create_default_slot$1e(p){let u,f,m,v,y,w,k,S,M,E;function T(J){p[29](J)}let H={autofocus:!0,quiet:!0,type:"text",placeholder:p[0]?`Search by ${p[0]}`:null};p[5]!==void 0&&(H.value=p[5]),m=new Input$5({props:H}),binding_callbacks.push(()=>bind(m,"value",T));const V=[create_if_block_1$J,create_if_block_2$s],q=[];function Z(J,ae){var ie;return J[9]?0:(ie=J[7])!=null&&ie.length?1:-1}return~(w=Z(p))&&(k=q[w]=V[w](p)),{c(){u=element("div"),f=element("div"),create_component(m.$$.fragment),y=space(),k&&k.c(),attr(f,"class","search svelte-jeqj3p"),attr(u,"class","dropdown svelte-jeqj3p")},m(J,ae){insert(J,u,ae),append$2(u,f),mount_component(m,f,null),append$2(u,y),~w&&q[w].m(u,null),S=!0,M||(E=listen(u,"wheel",stop_propagation(p[25])),M=!0)},p(J,ae){const ie={};ae[0]&1&&(ie.placeholder=J[0]?`Search by ${J[0]}`:null),!v&&ae[0]&32&&(v=!0,ie.value=J[5],add_flush_callback(()=>v=!1)),m.$set(ie);let he=w;w=Z(J),w===he?~w&&q[w].p(J,ae):(k&&(group_outros(),transition_out(q[he],1,1,()=>{q[he]=null}),check_outros()),~w?(k=q[w],k?k.p(J,ae):(k=q[w]=V[w](J),k.c()),transition_in(k,1),k.m(u,null)):k=null)},i(J){S||(transition_in(m.$$.fragment,J),transition_in(k),S=!0)},o(J){transition_out(m.$$.fragment,J),transition_out(k),S=!1},d(J){J&&detach(u),destroy_component(m),~w&&q[w].d(),M=!1,E()}}}function create_fragment$2t(p){var ae;let u,f,m,v,y,w,k,S,M,E,T=ensure_array_like(p[6]||[]),H=[];for(let ie=0;ie<T.length;ie+=1)H[ie]=create_each_block_1$4(get_each_context_1$4(p,T,ie));const V=ie=>transition_out(H[ie],1,1,()=>{H[ie]=null});let q=p[12]&&create_if_block_5$b(p),Z=!p[3]&&((ae=p[6])==null?void 0:ae.length)&&create_if_block_4$d(p),J=p[4]&&create_if_block$1s(p);return{c(){u=element("div"),f=element("div"),m=element("div");for(let ie=0;ie<H.length;ie+=1)H[ie].c();v=space(),q&&q.c(),y=space(),Z&&Z.c(),w=space(),J&&J.c(),k=empty$1(),attr(m,"class","values svelte-jeqj3p"),toggle_class(m,"wrap",p[12]||p[2]>1),toggle_class(m,"disabled",!p[1]),attr(f,"class","container svelte-jeqj3p"),attr(u,"class","wrapper svelte-jeqj3p"),set_style(u,"--color",p[13]),toggle_class(u,"editable",p[12]),toggle_class(u,"focused",p[1])},m(ie,he){insert(ie,u,he),append$2(u,f),append$2(f,m);for(let fe=0;fe<H.length;fe+=1)H[fe]&&H[fe].m(m,null);append$2(m,v),q&&q.m(m,null),append$2(f,y),Z&&Z.m(f,null),p[28](u),insert(ie,w,he),J&&J.m(ie,he),insert(ie,k,he),S=!0,M||(E=listen(m,"wheel",p[27]),M=!0)},p(ie,he){var fe;if(he[0]&399425){T=ensure_array_like(ie[6]||[]);let me;for(me=0;me<T.length;me+=1){const be=get_each_context_1$4(ie,T,me);H[me]?(H[me].p(be,he),transition_in(H[me],1)):(H[me]=create_each_block_1$4(be),H[me].c(),transition_in(H[me],1),H[me].m(m,v))}for(group_outros(),me=T.length;me<H.length;me+=1)V(me);check_outros()}ie[12]?q?(q.p(ie,he),he[0]&4096&&transition_in(q,1)):(q=create_if_block_5$b(ie),q.c(),transition_in(q,1),q.m(m,null)):q&&(group_outros(),transition_out(q,1,1,()=>{q=null}),check_outros()),(!S||he[0]&4100)&&toggle_class(m,"wrap",ie[12]||ie[2]>1),(!S||he[0]&2)&&toggle_class(m,"disabled",!ie[1]),!ie[3]&&((fe=ie[6])!=null&&fe.length)?Z?Z.p(ie,he):(Z=create_if_block_4$d(ie),Z.c(),Z.m(f,null)):Z&&(Z.d(1),Z=null),(!S||he[0]&4096)&&toggle_class(u,"editable",ie[12]),(!S||he[0]&2)&&toggle_class(u,"focused",ie[1]),ie[4]?J?(J.p(ie,he),he[0]&16&&transition_in(J,1)):(J=create_if_block$1s(ie),J.c(),transition_in(J,1),J.m(k.parentNode,k)):J&&(group_outros(),transition_out(J,1,1,()=>{J=null}),check_outros())},i(ie){if(!S){for(let he=0;he<T.length;he+=1)transition_in(H[he]);transition_in(q),transition_in(J),S=!0}},o(ie){H=H.filter(Boolean);for(let he=0;he<H.length;he+=1)transition_out(H[he]);transition_out(q),transition_out(J),S=!1},d(ie){ie&&(detach(u),detach(w),detach(k)),destroy_each(H,ie),q&&q.d(),Z&&Z.d(),p[28](null),J&&J.d(ie),M=!1,E()}}}const focus_handler=()=>{};function instance$2q(p,u,f){let m,v,y,w,k;const{API:S,cache:M}=getContext$1("grid");let{value:E=[]}=u,{api:T}=u,{readonly:H}=u,{focused:V}=u,{schema:q}=u,{onChange:Z}=u,{contentLines:J=1}=u,{searchFunction:ae=S.searchTable}=u,{primaryDisplay:ie}=u,{hideCounter:he=!1}=u;const fe=OptionColours[0];let me=!1,be,Ce,ze,Se,Ie,xe=!1,Ne;const $e=Nt=>Array.isArray(Nt)&&Nt.every(kt=>kt==null?void 0:kt._id)?Nt:[],Ze=(Nt,kt)=>{let yt={};if(!kt||!(Nt!=null&&Nt.length))return yt;for(let cn=0;cn<Nt.length;cn++)yt[Nt[cn]._id]=!0;return yt},ve=Nt=>Nt!=null&&Nt._id?(w==null?void 0:w[Nt._id])===!0:!1,Re=async(Nt,kt=!1)=>{var Mn;if(!kt&&!Nt&&!ze)return;if(!(q!=null&&q.tableId)||!me){ze=null,f(8,Se=null),f(7,be=[]);return}Ie=Math.random(),f(9,xe=!0);const yt=Ie,cn=await ae(q.tableId,{paginate:!1,limit:20,query:{string:{[`1:${ie}`]:Nt||""}}});f(9,xe=!1),yt===Ie&&(f(7,be=Fe((Mn=cn.rows)==null?void 0:Mn.map(fn=>({...fn,primaryDisplay:fn[ie]})))),f(8,Se=be!=null&&be.length?0:null),ze=Nt)},Qe=debounce(Re,250),Fe=Nt=>Nt!=null&&Nt.length?Nt.slice().sort((kt,yt)=>kt.primaryDisplay<yt.primaryDisplay?-1:1):[],Je=async()=>{f(4,me=!0),ie||(f(9,xe=!0),f(0,ie=await M.actions.getPrimaryDisplayForTableId(q.tableId))),await Re(null,!0)},ft=()=>{f(4,me=!1),f(7,be=[]),f(5,Ce=null),ze=null,f(8,Se=null)},Et=Nt=>me?(Nt.key==="ArrowDown"?(Nt.preventDefault(),Se==null?f(8,Se=0):f(8,Se=Math.min(be.length-1,Se+1))):Nt.key==="ArrowUp"?(Nt.preventDefault(),Se===0?f(8,Se=null):Se!=null&&f(8,Se=Math.max(0,Se-1))):Nt.key==="Enter"&&Se!=null&&be[Se]!=null&&qe(be[Se]),!0):!1,qe=async Nt=>{if(m!=null&&m.some(kt=>kt._id===Nt._id))if(v)await Z([]);else{const kt=m.filter(yt=>yt._id!==Nt._id);kt.length?f(8,Se=Math.min(Se,kt.length-1)):f(8,Se=null),await Z(kt)}else v?await Z([Nt]):await Z(Fe([...m||[],Nt])),f(8,Se=null);ft()},Ge=Nt=>Nt==null?"":Nt instanceof Object?JSON.stringify(Nt):Nt;onMount(()=>{f(19,T={focus:Je,blur:ft,isActive:()=>me,onKeyDown:Et})});function dt(Nt){bubble.call(this,p,Nt)}const xt=Nt=>qe(Nt),ot=Nt=>V?Nt.stopPropagation():null;function jt(Nt){binding_callbacks[Nt?"unshift":"push"](()=>{Ne=Nt,f(10,Ne)})}function Xe(Nt){Ce=Nt,f(5,Ce)}const Ut=Nt=>qe(Nt),en=Nt=>f(8,Se=Nt);return p.$$set=Nt=>{"value"in Nt&&f(20,E=Nt.value),"api"in Nt&&f(19,T=Nt.api),"readonly"in Nt&&f(21,H=Nt.readonly),"focused"in Nt&&f(1,V=Nt.focused),"schema"in Nt&&f(22,q=Nt.schema),"onChange"in Nt&&f(23,Z=Nt.onChange),"contentLines"in Nt&&f(2,J=Nt.contentLines),"searchFunction"in Nt&&f(24,ae=Nt.searchFunction),"primaryDisplay"in Nt&&f(0,ie=Nt.primaryDisplay),"hideCounter"in Nt&&f(3,he=Nt.hideCounter)},p.$$.update=()=>{p.$$.dirty[0]&1048576&&f(6,m=$e(E)),p.$$.dirty[0]&4194304&&(v=(q==null?void 0:q.relationshipType)==="one-to-many"),p.$$.dirty[0]&2097154&&f(12,y=V&&!H),p.$$.dirty[0]&80&&(w=Ze(m,me)),p.$$.dirty[0]&32&&Qe(Ce),p.$$.dirty[0]&18&&!V&&me&&ft(),p.$$.dirty[0]&4194368&&f(11,k=m==null?void 0:m.reduce((Nt,kt)=>{const yt={};for(const[cn]of Object.entries((q==null?void 0:q.columns)||{}).filter(([Mn,fn])=>fn.visible!==!1&&kt[Mn]!==null&&kt[Mn]!==void 0))yt[cn]=kt[cn];return Object.keys(yt).length&&(Nt[kt._id]=yt),Nt},{}))},[ie,V,J,he,me,Ce,m,be,Se,xe,Ne,k,y,fe,ve,Je,ft,qe,Ge,T,E,H,q,Z,ae,dt,xt,ot,jt,Xe,Ut,en]}class RelationshipCell extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2q,create_fragment$2t,safe_not_equal,{value:20,api:19,readonly:21,focused:1,schema:22,onChange:23,contentLines:2,searchFunction:24,primaryDisplay:0,hideCounter:3},null,[-1,-1])}}const LongFormCell_svelte_svelte_type_style_lang="";function create_if_block$1r(p){let u,f;return u=new GridPopover({props:{anchor:p[3],$$slots:{default:[create_default_slot$1d]},$$scope:{ctx:p}}}),u.$on("close",p[7]),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&8&&(y.anchor=m[3]),v&65539&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot$1d(p){let u,f,m,v;return{c(){u=element("textarea"),u.value=f=p[0]||"",attr(u,"spellcheck","false"),attr(u,"class","svelte-w9nhoo")},m(y,w){insert(y,u,w),p[14](u),m||(v=[listen(u,"change",p[5]),listen(u,"wheel",stop_propagation(p[12])),action_destroyer(clickOutside.call(null,u,p[7]))],m=!0)},p(y,w){w&1&&f!==(f=y[0]||"")&&(u.value=f)},d(y){y&&detach(u),p[14](null),m=!1,run_all(v)}}}function create_fragment$2s(p){let u,f,m=(p[0]||"")+"",v,y,w,k,S,M,E=p[2]&&create_if_block$1r(p);return{c(){u=element("div"),f=element("div"),v=text$1(m),y=space(),E&&E.c(),w=empty$1(),attr(f,"class","value svelte-w9nhoo"),attr(u,"class","long-form-cell svelte-w9nhoo"),toggle_class(u,"editable",p[4])},m(T,H){insert(T,u,H),append$2(u,f),append$2(f,v),p[13](u),insert(T,y,H),E&&E.m(T,H),insert(T,w,H),k=!0,S||(M=listen(u,"click",function(){is_function(p[4]?p[6]:null)&&(p[4]?p[6]:null).apply(this,arguments)}),S=!0)},p(T,[H]){p=T,(!k||H&1)&&m!==(m=(p[0]||"")+"")&&set_data(v,m),(!k||H&16)&&toggle_class(u,"editable",p[4]),p[2]?E?(E.p(p,H),H&4&&transition_in(E,1)):(E=create_if_block$1r(p),E.c(),transition_in(E,1),E.m(w.parentNode,w)):E&&(group_outros(),transition_out(E,1,1,()=>{E=null}),check_outros())},i(T){k||(transition_in(E),k=!0)},o(T){transition_out(E),k=!1},d(T){T&&(detach(u),detach(y),detach(w)),p[13](null),E&&E.d(T),S=!1,M()}}}function instance$2p(p,u,f){let m,{value:v}=u,{focused:y=!1}=u,{onChange:w}=u,{readonly:k=!1}=u,{api:S}=u,M,E=!1,T;const H=he=>{w(he.target.value)},V=()=>E,q=async()=>{f(2,E=!0),await tick(),M.focus(),(v==null?void 0:v.length)>100&&M.setSelectionRange(0,0)},Z=()=>{M==null||M.blur(),f(2,E=!1)};onMount(()=>{f(8,S={focus:()=>q(),blur:()=>Z(),isActive:()=>E,onKeyDown:V})});function J(he){bubble.call(this,p,he)}function ae(he){binding_callbacks[he?"unshift":"push"](()=>{T=he,f(3,T)})}function ie(he){binding_callbacks[he?"unshift":"push"](()=>{M=he,f(1,M)})}return p.$$set=he=>{"value"in he&&f(0,v=he.value),"focused"in he&&f(9,y=he.focused),"onChange"in he&&f(10,w=he.onChange),"readonly"in he&&f(11,k=he.readonly),"api"in he&&f(8,S=he.api)},p.$$.update=()=>{p.$$.dirty&2560&&f(4,m=y&&!k),p.$$.dirty&512&&(y||f(2,E=!1))},[v,M,E,T,m,H,q,Z,S,y,w,k,J,ae,ie]}class LongFormCell extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2p,create_fragment$2s,safe_not_equal,{value:0,focused:9,onChange:10,readonly:11,api:8})}}const BooleanCell_svelte_svelte_type_style_lang="";function create_fragment$2r(p){let u,f,m;return f=new Checkbox_1({props:{value:p[0]}}),f.$on("change",p[2]),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"class","boolean-cell svelte-1l7j6r7"),toggle_class(u,"editable",p[1])},m(v,y){insert(v,u,y),mount_component(f,u,null),m=!0},p(v,[y]){const w={};y&1&&(w.value=v[0]),f.$set(w),(!m||y&2)&&toggle_class(u,"editable",v[1])},i(v){m||(transition_in(f.$$.fragment,v),m=!0)},o(v){transition_out(f.$$.fragment,v),m=!1},d(v){v&&detach(u),destroy_component(f)}}}function instance$2o(p,u,f){let m,{value:v}=u,{focused:y=!1}=u,{onChange:w}=u,{readonly:k=!1}=u,{api:S}=u;const M=T=>{w(T.detail)},E=T=>T.key==="Enter"?(w(!v),!0):!1;return onMount(()=>{f(3,S={onKeyDown:E})}),p.$$set=T=>{"value"in T&&f(0,v=T.value),"focused"in T&&f(4,y=T.focused),"onChange"in T&&f(5,w=T.onChange),"readonly"in T&&f(6,k=T.readonly),"api"in T&&f(3,S=T.api)},p.$$.update=()=>{p.$$.dirty&80&&f(1,m=y&&!k)},[v,m,M,S,y,w,k]}class BooleanCell extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2o,create_fragment$2r,safe_not_equal,{value:0,focused:4,onChange:5,readonly:6,api:3})}}function create_else_block$r(p){let u,f;const m=[p[1],{readonly:!0}];let v={};for(let y=0;y<m.length;y+=1)v=assign(v,m[y]);return u=new TextCell({props:v}),{c(){create_component(u.$$.fragment)},m(y,w){mount_component(u,y,w),f=!0},p(y,w){const k=w&2?get_spread_update(m,[get_spread_object(y[1]),m[1]]):{};u.$set(k)},i(y){f||(transition_in(u.$$.fragment,y),f=!0)},o(y){transition_out(u.$$.fragment,y),f=!1},d(y){destroy_component(u,y)}}}function create_if_block_2$r(p){let u,f;const m=[p[1],{readonly:!0}];let v={};for(let y=0;y<m.length;y+=1)v=assign(v,m[y]);return u=new DateCell({props:v}),{c(){create_component(u.$$.fragment)},m(y,w){mount_component(u,y,w),f=!0},p(y,w){const k=w&2?get_spread_update(m,[get_spread_object(y[1]),m[1]]):{};u.$set(k)},i(y){f||(transition_in(u.$$.fragment,y),f=!0)},o(y){transition_out(u.$$.fragment,y),f=!1},d(y){destroy_component(u,y)}}}function create_if_block_1$I(p){let u,f;const m=[p[1],{readonly:!0}];let v={};for(let y=0;y<m.length;y+=1)v=assign(v,m[y]);return u=new BooleanCell({props:v}),{c(){create_component(u.$$.fragment)},m(y,w){mount_component(u,y,w),f=!0},p(y,w){const k=w&2?get_spread_update(m,[get_spread_object(y[1]),m[1]]):{};u.$set(k)},i(y){f||(transition_in(u.$$.fragment,y),f=!0)},o(y){transition_out(u.$$.fragment,y),f=!1},d(y){destroy_component(u,y)}}}function create_if_block$1q(p){let u,f;const m=[p[1],{readonly:!0}];let v={};for(let y=0;y<m.length;y+=1)v=assign(v,m[y]);return u=new NumberCell({props:v}),{c(){create_component(u.$$.fragment)},m(y,w){mount_component(u,y,w),f=!0},p(y,w){const k=w&2?get_spread_update(m,[get_spread_object(y[1]),m[1]]):{};u.$set(k)},i(y){f||(transition_in(u.$$.fragment,y),f=!0)},o(y){transition_out(u.$$.fragment,y),f=!1},d(y){destroy_component(u,y)}}}function create_fragment$2q(p){let u,f,m,v;const y=[create_if_block$1q,create_if_block_1$I,create_if_block_2$r,create_else_block$r],w=[];function k(S,M){return S[0]===FieldType.NUMBER?0:S[0]===FieldType.BOOLEAN?1:S[0]===FieldType.DATETIME?2:3}return u=k(p),f=w[u]=y[u](p),{c(){f.c(),m=empty$1()},m(S,M){w[u].m(S,M),insert(S,m,M),v=!0},p(S,[M]){let E=u;u=k(S),u===E?w[u].p(S,M):(group_outros(),transition_out(w[E],1,1,()=>{w[E]=null}),check_outros(),f=w[u],f?f.p(S,M):(f=w[u]=y[u](S),f.c()),transition_in(f,1),f.m(m.parentNode,m))},i(S){v||(transition_in(f),v=!0)},o(S){transition_out(f),v=!1},d(S){S&&detach(m),w[u].d(S)}}}function instance$2n(p,u,f){let m,{schema:v}=u;return p.$$set=y=>{f(1,u=assign(assign({},u),exclude_internal_props(y))),"schema"in y&&f(2,v=y.schema)},p.$$.update=()=>{p.$$.dirty&4&&f(0,m=v.responseType)},u=exclude_internal_props(u),[m,u,v]}class FormulaCell extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2n,create_fragment$2q,safe_not_equal,{schema:2})}}const AICell_svelte_svelte_type_style_lang="";function create_if_block$1p(p){let u,f;return u=new GridPopover({props:{anchor:p[3],$$slots:{default:[create_default_slot$1c]},$$scope:{ctx:p}}}),u.$on("close",p[5]),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&8&&(y.anchor=m[3]),v&4099&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot$1c(p){let u,f,m,v;return{c(){u=element("textarea"),u.disabled=!0,u.value=f=p[0]||"",attr(u,"spellcheck","false"),attr(u,"class","svelte-13x28l0")},m(y,w){insert(y,u,w),p[10](u),m||(v=[listen(u,"wheel",stop_propagation(p[8])),action_destroyer(clickOutside.call(null,u,p[5]))],m=!0)},p(y,w){w&1&&f!==(f=y[0]||"")&&(u.value=f)},d(y){y&&detach(u),p[10](null),m=!1,run_all(v)}}}function create_fragment$2p(p){let u,f,m=(p[0]||"")+"",v,y,w,k,S,M,E=p[2]&&create_if_block$1p(p);return{c(){u=element("div"),f=element("div"),v=text$1(m),y=space(),E&&E.c(),w=empty$1(),attr(f,"class","value svelte-13x28l0"),attr(u,"class","long-form-cell svelte-13x28l0")},m(T,H){insert(T,u,H),append$2(u,f),append$2(f,v),p[9](u),insert(T,y,H),E&&E.m(T,H),insert(T,w,H),k=!0,S||(M=listen(u,"click",p[4]),S=!0)},p(T,[H]){(!k||H&1)&&m!==(m=(T[0]||"")+"")&&set_data(v,m),T[2]?E?(E.p(T,H),H&4&&transition_in(E,1)):(E=create_if_block$1p(T),E.c(),transition_in(E,1),E.m(w.parentNode,w)):E&&(group_outros(),transition_out(E,1,1,()=>{E=null}),check_outros())},i(T){k||(transition_in(E),k=!0)},o(T){transition_out(E),k=!1},d(T){T&&(detach(u),detach(y),detach(w)),p[9](null),E&&E.d(T),S=!1,M()}}}function instance$2m(p,u,f){let{value:m}=u,{focused:v=!1}=u,{api:y}=u,w,k=!1,S;const M=()=>k,E=async()=>{f(2,k=!0)},T=()=>{w==null||w.blur(),f(2,k=!1)};onMount(()=>{f(6,y={focus:()=>E(),blur:()=>T(),isActive:()=>k,onKeyDown:M})});function H(Z){bubble.call(this,p,Z)}function V(Z){binding_callbacks[Z?"unshift":"push"](()=>{S=Z,f(3,S)})}function q(Z){binding_callbacks[Z?"unshift":"push"](()=>{w=Z,f(1,w)})}return p.$$set=Z=>{"value"in Z&&f(0,m=Z.value),"focused"in Z&&f(7,v=Z.focused),"api"in Z&&f(6,y=Z.api)},p.$$.update=()=>{p.$$.dirty&128&&(v||f(2,k=!1))},[m,w,k,S,E,T,y,v,H,V,q]}class AICell extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2m,create_fragment$2p,safe_not_equal,{value:0,focused:7,api:6})}}function create_fragment$2o(p){let u,f,m;const v=[p[3],{value:p[1]},{onChange:p[2]}];function y(k){p[6](k)}let w={};for(let k=0;k<v.length;k+=1)w=assign(w,v[k]);return p[0]!==void 0&&(w.api=p[0]),u=new LongFormCell({props:w}),binding_callbacks.push(()=>bind(u,"api",y)),{c(){create_component(u.$$.fragment)},m(k,S){mount_component(u,k,S),m=!0},p(k,[S]){const M=S&14?get_spread_update(v,[S&8&&get_spread_object(k[3]),S&2&&{value:k[1]},S&4&&{onChange:k[2]}]):{};!f&&S&1&&(f=!0,M.api=k[0],add_flush_callback(()=>f=!1)),u.$set(M)},i(k){m||(transition_in(u.$$.fragment,k),m=!0)},o(k){transition_out(u.$$.fragment,k),m=!1},d(k){destroy_component(u,k)}}}function instance$2l(p,u,f){let m,{onChange:v}=u,{value:y}=u,{api:w}=u;const k=E=>{if(!E)return E;try{return JSON.stringify(E,null,2)}catch{return null}},S=E=>{const T=E==null?void 0:E.trim();if(!T){v(null);return}try{const H=JSON.parse(T);v(H)}catch{}};function M(E){w=E,f(0,w)}return p.$$set=E=>{f(3,u=assign(assign({},u),exclude_internal_props(E))),"onChange"in E&&f(4,v=E.onChange),"value"in E&&f(5,y=E.value),"api"in E&&f(0,w=E.api)},p.$$.update=()=>{p.$$.dirty&32&&f(1,m=k(y))},u=exclude_internal_props(u),[w,m,S,u,v,y,M]}class JSONCell extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2l,create_fragment$2o,safe_not_equal,{onChange:4,value:5,api:0})}}const AttachmentCell_svelte_svelte_type_style_lang="";function get_each_context$t(p,u,f){const m=p.slice();return m[24]=u[f],m}function create_else_block$q(p){let u,f=p[24].extension+"",m,v,y;return{c(){u=element("div"),m=text$1(f),v=space(),attr(u,"class","file svelte-1iu2dac"),attr(u,"title",y=p[24].name)},m(w,k){insert(w,u,k),append$2(u,m),append$2(u,v)},p(w,k){k&1&&f!==(f=w[24].extension+"")&&set_data(m,f),k&1&&y!==(y=w[24].name)&&attr(u,"title",y)},d(w){w&&detach(u)}}}function create_if_block_1$H(p){let u,f,m;return{c(){var v;u=element("img"),src_url_equal(u.src,f=p[24].url)||attr(u,"src",f),attr(u,"alt",m=p[24].extension),attr(u,"class","svelte-1iu2dac"),toggle_class(u,"light",!((v=p[7])!=null&&v.darkMode)&&p[2].type===FieldType.SIGNATURE_SINGLE)},m(v,y){insert(v,u,y)},p(v,y){var w;y&1&&!src_url_equal(u.src,f=v[24].url)&&attr(u,"src",f),y&1&&m!==(m=v[24].extension)&&attr(u,"alt",m),y&132&&toggle_class(u,"light",!((w=v[7])!=null&&w.darkMode)&&v[2].type===FieldType.SIGNATURE_SINGLE)},d(v){v&&detach(u)}}}function create_each_block$t(p){let u,f;function m(w,k){return k&1&&(u=null),u==null&&(u=!!w[12](w[24].extension)),u?create_if_block_1$H:create_else_block$q}let v=m(p,-1),y=v(p);return{c(){y.c(),f=empty$1()},m(w,k){y.m(w,k),insert(w,f,k)},p(w,k){v===(v=m(w,k))&&y?y.p(w,k):(y.d(1),y=v(w),y&&(y.c(),y.m(f.parentNode,f)))},d(w){w&&detach(f),y.d(w)}}}function create_if_block$1o(p){let u,f;return u=new GridPopover({props:{open:p[4],anchor:p[5],maxHeight:null,$$slots:{default:[create_default_slot$1b]},$$scope:{ctx:p}}}),u.$on("close",p[11]),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&16&&(y.open=m[4]),v&32&&(y.anchor=m[5]),v&134217871&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot$1b(p){var v,y;let u,f,m;return f=new Dropzone({props:{value:p[0],compact:!0,maximum:p[3]||((y=(v=p[2].constraints)==null?void 0:v.length)==null?void 0:y.maximum),processFiles:p[14],handleFileTooLarge:p[7].isCloud?p[13]:null}}),f.$on("change",p[19]),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"class","dropzone svelte-1iu2dac")},m(w,k){insert(w,u,k),mount_component(f,u,null),m=!0},p(w,k){var M,E;const S={};k&1&&(S.value=w[0]),k&12&&(S.maximum=w[3]||((E=(M=w[2].constraints)==null?void 0:M.length)==null?void 0:E.maximum)),k&128&&(S.handleFileTooLarge=w[7].isCloud?w[13]:null),f.$set(S)},i(w){m||(transition_in(f.$$.fragment,w),m=!0)},o(w){transition_out(f.$$.fragment,w),m=!1},d(w){w&&detach(u),destroy_component(f)}}}function create_fragment$2n(p){let u,f,m,v,y,w,k=ensure_array_like(p[0]||[]),S=[];for(let E=0;E<k.length;E+=1)S[E]=create_each_block$t(get_each_context$t(p,k,E));let M=p[4]&&create_if_block$1o(p);return{c(){u=element("div");for(let E=0;E<S.length;E+=1)S[E].c();f=space(),M&&M.c(),m=empty$1(),attr(u,"class","attachment-cell svelte-1iu2dac"),toggle_class(u,"editable",p[6])},m(E,T){insert(E,u,T);for(let H=0;H<S.length;H+=1)S[H]&&S[H].m(u,null);p[18](u),insert(E,f,T),M&&M.m(E,T),insert(E,m,T),v=!0,y||(w=listen(u,"click",function(){is_function(p[6]?p[10]:null)&&(p[6]?p[10]:null).apply(this,arguments)}),y=!0)},p(E,[T]){if(p=E,T&4229){k=ensure_array_like(p[0]||[]);let H;for(H=0;H<k.length;H+=1){const V=get_each_context$t(p,k,H);S[H]?S[H].p(V,T):(S[H]=create_each_block$t(V),S[H].c(),S[H].m(u,null))}for(;H<S.length;H+=1)S[H].d(1);S.length=k.length}(!v||T&64)&&toggle_class(u,"editable",p[6]),p[4]?M?(M.p(p,T),T&16&&transition_in(M,1)):(M=create_if_block$1o(p),M.c(),transition_in(M,1),M.m(m.parentNode,m)):M&&(group_outros(),transition_out(M,1,1,()=>{M=null}),check_outros())},i(E){v||(transition_in(M),v=!0)},o(E){transition_out(M),v=!1},d(E){E&&(detach(u),detach(f),detach(m)),destroy_each(S,E),p[18](null),M&&M.d(E),y=!1,w()}}}function instance$2k(p,u,f){let m,v,y,{value:w}=u,{focused:k=!1}=u,{onChange:S}=u,{readonly:M=!1}=u,{api:E}=u,{schema:T}=u,{maximum:H}=u;const{API:V,notifications:q,props:Z}=getContext$1("grid");component_subscribe(p,q,xe=>f(20,v=xe)),component_subscribe(p,Z,xe=>f(7,y=xe));const J=["png","tiff","gif","raw","jpg","jpeg"];let ae=!1,ie;const he=()=>ae,fe=()=>{f(4,ae=!0)},me=()=>{f(4,ae=!1)},be=xe=>J.includes(xe==null?void 0:xe.toLowerCase()),Ce=xe=>{v.error(`Files cannot exceed ${xe/1e6}MB. Please try again with smaller files.`)},ze=async xe=>{let Ne=new FormData;for(let $e=0;$e<xe.length;$e++)Ne.append("file",xe[$e]);try{return await V.uploadBuilderAttachment(Ne)}catch($e){return v.error($e.message||"Failed to upload attachment"),[]}};onMount(()=>{f(15,E={focus:()=>fe(),blur:()=>me(),isActive:()=>ae,onKeyDown:he})});function Se(xe){binding_callbacks[xe?"unshift":"push"](()=>{ie=xe,f(5,ie)})}const Ie=xe=>S(xe.detail);return p.$$set=xe=>{"value"in xe&&f(0,w=xe.value),"focused"in xe&&f(16,k=xe.focused),"onChange"in xe&&f(1,S=xe.onChange),"readonly"in xe&&f(17,M=xe.readonly),"api"in xe&&f(15,E=xe.api),"schema"in xe&&f(2,T=xe.schema),"maximum"in xe&&f(3,H=xe.maximum)},p.$$.update=()=>{p.$$.dirty&196608&&f(6,m=k&&!M),p.$$.dirty&65536&&(k||me())},[w,S,T,H,ae,ie,m,y,q,Z,fe,me,be,Ce,ze,E,k,M,Se,Ie]}class AttachmentCell extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2k,create_fragment$2n,safe_not_equal,{value:0,focused:16,onChange:1,readonly:17,api:15,schema:2,maximum:3})}}function create_fragment$2m(p){let u,f,m;const v=[p[3],{maximum:1},{value:p[2]},{onChange:p[1]}];function y(k){p[6](k)}let w={};for(let k=0;k<v.length;k+=1)w=assign(w,v[k]);return p[0]!==void 0&&(w.api=p[0]),u=new AttachmentCell({props:w}),binding_callbacks.push(()=>bind(u,"api",y)),{c(){create_component(u.$$.fragment)},m(k,S){mount_component(u,k,S),m=!0},p(k,[S]){const M=S&14?get_spread_update(v,[S&8&&get_spread_object(k[3]),v[1],S&4&&{value:k[2]},S&2&&{onChange:k[1]}]):{};!f&&S&1&&(f=!0,M.api=k[0],add_flush_callback(()=>f=!1)),u.$set(M)},i(k){m||(transition_in(u.$$.fragment,k),m=!0)},o(k){transition_out(u.$$.fragment,k),m=!1},d(k){destroy_component(u,k)}}}function instance$2j(p,u,f){let m,v;const y=["value","onChange","api"];let w=compute_rest_props(u,y),{value:k}=u,{onChange:S}=u,{api:M}=u;function E(T){M=T,f(0,M)}return p.$$set=T=>{u=assign(assign({},u),exclude_internal_props(T)),f(3,w=compute_rest_props(u,y)),"value"in T&&f(4,k=T.value),"onChange"in T&&f(5,S=T.onChange),"api"in T&&f(0,M=T.api)},p.$$.update=()=>{p.$$.dirty&32&&f(1,v=T=>{T=T[0]||null,S(T)}),p.$$.dirty&16&&f(2,m=(!Array.isArray(k)&&k?[k]:k)||[])},[M,v,m,w,k,S,E]}class AttachmentSingleCell extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2j,create_fragment$2m,safe_not_equal,{value:4,onChange:5,api:0})}}function create_fragment$2l(p){let u,f,m;const v=[p[4],{schema:p[0]},{searchFunction:p[3]},{primaryDisplay:"email"},{hideCounter:p[2]}];function y(k){p[5](k)}let w={};for(let k=0;k<v.length;k+=1)w=assign(w,v[k]);return p[1]!==void 0&&(w.api=p[1]),u=new RelationshipCell({props:w}),binding_callbacks.push(()=>bind(u,"api",y)),{c(){create_component(u.$$.fragment)},m(k,S){mount_component(u,k,S),m=!0},p(k,[S]){const M=S&29?get_spread_update(v,[S&16&&get_spread_object(k[4]),S&1&&{schema:k[0]},S&8&&{searchFunction:k[3]},v[3],S&4&&{hideCounter:k[2]}]):{};!f&&S&2&&(f=!0,M.api=k[1],add_flush_callback(()=>f=!1)),u.$set(M)},i(k){m||(transition_in(u.$$.fragment,k),m=!0)},o(k){transition_out(u.$$.fragment,k),m=!1},d(k){destroy_component(u,k)}}}function instance$2i(p,u,f){const m=["api","hideCounter","schema"];let v=compute_rest_props(u,m),{api:y}=u,{hideCounter:w=!1}=u,{schema:k}=u;const{API:S}=getContext$1("grid"),{type:M,subtype:E}=k;async function T(V){if(E!==BBReferenceFieldSubType.USER&&E!==BBReferenceFieldSubType.USERS)throw`Search for '${E}' not implemented`;const q=Object.values(V.query.string)[0],Z=await S.searchUsers({query:{string:{email:q}}});return{...Z,data:void 0,rows:Z.data}}function H(V){y=V,f(1,y)}return p.$$set=V=>{f(9,u=assign(assign({},u),exclude_internal_props(V))),f(4,v=compute_rest_props(u,m)),"api"in V&&f(1,y=V.api),"hideCounter"in V&&f(2,w=V.hideCounter),"schema"in V&&f(0,k=V.schema)},p.$$.update=()=>{f(0,k={...u.schema,tableId:"external",relationshipType:M===FieldType.BB_REFERENCE_SINGLE||isDeprecatedSingleUserColumn(k)?RelationshipType.ONE_TO_MANY:RelationshipType.MANY_TO_MANY})},u=exclude_internal_props(u),[k,y,w,T,v,H]}class BBReferenceCell extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2i,create_fragment$2l,safe_not_equal,{api:1,hideCounter:2,schema:0})}}const SignatureCell_svelte_svelte_type_style_lang="";function create_if_block_2$q(p){let u,f;return{c(){var m;u=element("img"),src_url_equal(u.src,f=(m=p[1])==null?void 0:m.url)||attr(u,"src",f),attr(u,"class","svelte-34a6jk")},m(m,v){insert(m,u,v)},p(m,v){var y;v&2&&!src_url_equal(u.src,f=(y=m[1])==null?void 0:y.url)&&attr(u,"src",f)},d(m){m&&detach(u)}}}function create_if_block$1n(p){let u,f;return u=new GridPopover({props:{open:p[2],anchor:p[4],maxHeight:null,$$slots:{default:[create_default_slot$1a]},$$scope:{ctx:p}}}),u.$on("close",p[10]),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&4&&(y.open=m[2]),v&16&&(y.anchor=m[4]),v&8388682&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_else_block$p(p){let u,f,m;return f=new ActionButton({props:{fullWidth:!0,$$slots:{default:[create_default_slot_1$x]},$$scope:{ctx:p}}}),f.$on("click",p[19]),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"class","add-signature")},m(v,y){insert(v,u,y),mount_component(f,u,null),m=!0},p(v,y){const w={};y&8388608&&(w.$$scope={dirty:y,ctx:v}),f.$set(w)},i(v){m||(transition_in(f.$$.fragment,v),m=!0)},o(v){transition_out(f.$$.fragment,v),m=!1},d(v){v&&detach(u),destroy_component(f)}}}function create_if_block_1$G(p){let u,f,m;return f=new Signature({props:{darkMode:p[6].darkMode,editable:!1,value:p[1]}}),f.$on("change",p[12]),f.$on("clear",p[11]),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"class","signature-wrap svelte-34a6jk")},m(v,y){insert(v,u,y),mount_component(f,u,null),m=!0},p(v,y){const w={};y&64&&(w.darkMode=v[6].darkMode),y&2&&(w.value=v[1]),f.$set(w)},i(v){m||(transition_in(f.$$.fragment,v),m=!0)},o(v){transition_out(f.$$.fragment,v),m=!1},d(v){v&&detach(u),destroy_component(f)}}}function create_default_slot_1$x(p){let u;return{c(){u=text$1("Add signature")},m(f,m){insert(f,u,m)},d(f){f&&detach(u)}}}function create_default_slot$1a(p){let u,f,m,v;const y=[create_if_block_1$G,create_else_block$p],w=[];function k(S,M){var E;return(E=S[1])!=null&&E.key?0:1}return f=k(p),m=w[f]=y[f](p),{c(){u=element("div"),m.c(),attr(u,"class","signature svelte-34a6jk"),toggle_class(u,"empty",!p[1])},m(S,M){insert(S,u,M),w[f].m(u,null),v=!0},p(S,M){let E=f;f=k(S),f===E?w[f].p(S,M):(group_outros(),transition_out(w[E],1,1,()=>{w[E]=null}),check_outros(),m=w[f],m?m.p(S,M):(m=w[f]=y[f](S),m.c()),transition_in(m,1),m.m(u,null)),(!v||M&2)&&toggle_class(u,"empty",!S[1])},i(S){v||(transition_in(m),v=!0)},o(S){transition_out(m),v=!1},d(S){S&&detach(u),w[f].d()}}}function create_fragment$2k(p){var H,V;let u,f,m,v,y,w,k,S,M=((H=p[1])==null?void 0:H.url)&&create_if_block_2$q(p),E={onConfirm:p[12],title:(V=p[0])==null?void 0:V.name,value:p[1],darkMode:p[6].darkMode};m=new SignatureModal({props:E}),p[18](m);let T=p[2]&&create_if_block$1n(p);return{c(){var q;u=element("div"),M&&M.c(),f=space(),create_component(m.$$.fragment),v=space(),T&&T.c(),y=empty$1(),attr(u,"class","signature-cell svelte-34a6jk"),toggle_class(u,"light",!((q=p[6])!=null&&q.darkMode)),toggle_class(u,"editable",p[5])},m(q,Z){insert(q,u,Z),M&&M.m(u,null),p[17](u),insert(q,f,Z),mount_component(m,q,Z),insert(q,v,Z),T&&T.m(q,Z),insert(q,y,Z),w=!0,k||(S=listen(u,"click",function(){is_function(p[5]?p[9]:null)&&(p[5]?p[9]:null).apply(this,arguments)}),k=!0)},p(q,[Z]){var ae,ie,he;p=q,(ae=p[1])!=null&&ae.url?M?M.p(p,Z):(M=create_if_block_2$q(p),M.c(),M.m(u,null)):M&&(M.d(1),M=null),(!w||Z&64)&&toggle_class(u,"light",!((ie=p[6])!=null&&ie.darkMode)),(!w||Z&32)&&toggle_class(u,"editable",p[5]);const J={};Z&1&&(J.title=(he=p[0])==null?void 0:he.name),Z&2&&(J.value=p[1]),Z&64&&(J.darkMode=p[6].darkMode),m.$set(J),p[2]?T?(T.p(p,Z),Z&4&&transition_in(T,1)):(T=create_if_block$1n(p),T.c(),transition_in(T,1),T.m(y.parentNode,y)):T&&(group_outros(),transition_out(T,1,1,()=>{T=null}),check_outros())},i(q){w||(transition_in(m.$$.fragment,q),transition_in(T),w=!0)},o(q){transition_out(m.$$.fragment,q),transition_out(T),w=!1},d(q){q&&(detach(u),detach(f),detach(v),detach(y)),M&&M.d(),p[17](null),p[18](null),destroy_component(m,q),T&&T.d(q),k=!1,S()}}}function instance$2h(p,u,f){let m,v,y,{schema:w}=u,{value:k}=u,{focused:S=!1}=u,{onChange:M}=u,{readonly:E=!1}=u,{api:T}=u;const{API:H,notifications:V,props:q}=getContext$1("grid");component_subscribe(p,V,Ie=>f(20,v=Ie)),component_subscribe(p,q,Ie=>f(6,y=Ie));let Z=!1,J,ae;const ie=()=>!1,he=()=>{f(2,Z=!0)},fe=()=>{f(2,Z=!1)},me=async()=>{M(null)},be=async Ie=>{const xe=Ie.toFile();let Ne=new FormData;Ne.append("file",xe);try{const $e=await H.uploadBuilderAttachment(Ne),[Ze]=$e;M(Ze)}catch($e){return v.error($e.message||"Failed to save signature"),[]}};onMount(()=>{f(13,T={focus:()=>he(),blur:()=>fe(),isActive:()=>Z,onKeyDown:ie})});function Ce(Ie){binding_callbacks[Ie?"unshift":"push"](()=>{ae=Ie,f(4,ae)})}function ze(Ie){binding_callbacks[Ie?"unshift":"push"](()=>{J=Ie,f(3,J)})}const Se=()=>{J.show()};return p.$$set=Ie=>{"schema"in Ie&&f(0,w=Ie.schema),"value"in Ie&&f(1,k=Ie.value),"focused"in Ie&&f(14,S=Ie.focused),"onChange"in Ie&&f(15,M=Ie.onChange),"readonly"in Ie&&f(16,E=Ie.readonly),"api"in Ie&&f(13,T=Ie.api)},p.$$.update=()=>{p.$$.dirty&81920&&f(5,m=S&&!E),p.$$.dirty&16384&&(S||fe())},[w,k,Z,J,ae,m,y,V,q,he,fe,me,be,T,S,M,E,Ce,ze,Se]}class SignatureCell extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2h,create_fragment$2k,safe_not_equal,{schema:0,value:1,focused:14,onChange:15,readonly:16,api:13})}}function create_fragment$2j(p){let u,f,m;const v=[p[3],{value:p[2]},{onChange:p[1]},{hideCounter:!0}];function y(k){p[6](k)}let w={};for(let k=0;k<v.length;k+=1)w=assign(w,v[k]);return p[0]!==void 0&&(w.api=p[0]),u=new BBReferenceCell({props:w}),binding_callbacks.push(()=>bind(u,"api",y)),{c(){create_component(u.$$.fragment)},m(k,S){mount_component(u,k,S),m=!0},p(k,[S]){const M=S&14?get_spread_update(v,[S&8&&get_spread_object(k[3]),S&4&&{value:k[2]},S&2&&{onChange:k[1]},v[3]]):{};!f&&S&1&&(f=!0,M.api=k[0],add_flush_callback(()=>f=!1)),u.$set(M)},i(k){m||(transition_in(u.$$.fragment,k),m=!0)},o(k){transition_out(u.$$.fragment,k),m=!1},d(k){destroy_component(u,k)}}}function instance$2g(p,u,f){let m,v;const y=["value","onChange","api"];let w=compute_rest_props(u,y),{value:k}=u,{onChange:S}=u,{api:M}=u;function E(T){M=T,f(0,M)}return p.$$set=T=>{u=assign(assign({},u),exclude_internal_props(T)),f(3,w=compute_rest_props(u,y)),"value"in T&&f(4,k=T.value),"onChange"in T&&f(5,S=T.onChange),"api"in T&&f(0,M=T.api)},p.$$.update=()=>{p.$$.dirty&32&&f(1,v=T=>{T=T[0]||null,S(T)}),p.$$.dirty&16&&f(2,m=(!Array.isArray(k)&&k?[k]:k)||[])},[M,v,m,w,k,S,E]}class BBReferenceSingleCell extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2g,create_fragment$2j,safe_not_equal,{value:4,onChange:5,api:0})}}const RoleCell_svelte_svelte_type_style_lang="";function create_fragment$2i(p){var M,E,T,H,V;let u,f,m,v,y,w=(((E=(M=p[0])==null?void 0:M.uiMetadata)==null?void 0:E.displayName)||((T=p[0])==null?void 0:T.name)||"Unknown role")+"",k,S;return m=new StatusLight({props:{square:!0,size:"L",color:((V=(H=p[0])==null?void 0:H.uiMetadata)==null?void 0:V.color)||"var(--spectrum-global-color-static-magenta-400)"}}),{c(){u=element("div"),f=element("div"),create_component(m.$$.fragment),v=space(),y=element("div"),k=text$1(w),attr(f,"class","light svelte-7aaju2"),attr(y,"class","value svelte-7aaju2"),attr(u,"class","role-cell svelte-7aaju2")},m(q,Z){insert(q,u,Z),append$2(u,f),mount_component(m,f,null),append$2(u,v),append$2(u,y),append$2(y,k),S=!0},p(q,[Z]){var ae,ie,he,fe,me;const J={};Z&1&&(J.color=((ie=(ae=q[0])==null?void 0:ae.uiMetadata)==null?void 0:ie.color)||"var(--spectrum-global-color-static-magenta-400)"),m.$set(J),(!S||Z&1)&&w!==(w=(((fe=(he=q[0])==null?void 0:he.uiMetadata)==null?void 0:fe.displayName)||((me=q[0])==null?void 0:me.name)||"Unknown role")+"")&&set_data(k,w)},i(q){S||(transition_in(m.$$.fragment,q),S=!0)},o(q){transition_out(m.$$.fragment,q),S=!1},d(q){q&&detach(u),destroy_component(m)}}}function instance$2f(p,u,f){let m,{value:v}=u,{schema:y}=u;return p.$$set=w=>{"value"in w&&f(1,v=w.value),"schema"in w&&f(2,y=w.schema)},p.$$.update=()=>{var w;p.$$.dirty&6&&f(0,m=(w=y.roles)==null?void 0:w.find(k=>k._id===v))},[m,v,y]}class RoleCell extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2f,create_fragment$2i,safe_not_equal,{value:1,schema:2})}}const TypeComponentMap={[FieldType.STRING]:TextCell,[FieldType.OPTIONS]:OptionsCell,[FieldType.DATETIME]:DateCell,[FieldType.BARCODEQR]:TextCell,[FieldType.SIGNATURE_SINGLE]:SignatureCell,[FieldType.LONGFORM]:LongFormCell,[FieldType.ARRAY]:MultiSelectCell,[FieldType.NUMBER]:NumberCell,[FieldType.BOOLEAN]:BooleanCell,[FieldType.ATTACHMENTS]:AttachmentCell,[FieldType.ATTACHMENT_SINGLE]:AttachmentSingleCell,[FieldType.LINK]:RelationshipCell,[FieldType.FORMULA]:FormulaCell,[FieldType.AI]:AICell,[FieldType.JSON]:JSONCell,[FieldType.BB_REFERENCE]:BBReferenceCell,[FieldType.BB_REFERENCE_SINGLE]:BBReferenceSingleCell,role:RoleCell},getCellRenderer=p=>{var u,f;return p.calculationType?NumberCell:TypeComponentMap[(u=p==null?void 0:p.schema)==null?void 0:u.cellRenderType]||TypeComponentMap[(f=p==null?void 0:p.schema)==null?void 0:f.type]||TextCell};function create_default_slot$19(p){let u,f,m,v;function y(E){p[30](E)}var w=getCellRenderer(p[6]);function k(E,T){let H={value:E[7][E[6].name],schema:E[6].schema,onChange:E[22].setValue,focused:E[4],readonly:E[13],contentLines:E[9]};return E[12]!==void 0&&(H.api=E[12]),{props:H}}w&&(u=construct_svelte_component(w,k(p)),binding_callbacks.push(()=>bind(u,"api",y)));const S=p[29].default,M=create_slot(S,p,p[32],null);return{c(){u&&create_component(u.$$.fragment),m=space(),M&&M.c()},m(E,T){u&&mount_component(u,E,T),insert(E,m,T),M&&M.m(E,T),v=!0},p(E,T){if(T[0]&64&&w!==(w=getCellRenderer(E[6]))){if(u){group_outros();const H=u;transition_out(H.$$.fragment,1,0,()=>{destroy_component(H,1)}),check_outros()}w?(u=construct_svelte_component(w,k(E)),binding_callbacks.push(()=>bind(u,"api",y)),create_component(u.$$.fragment),transition_in(u.$$.fragment,1),mount_component(u,m.parentNode,m)):u=null}else if(w){const H={};T[0]&192&&(H.value=E[7][E[6].name]),T[0]&64&&(H.schema=E[6].schema),T[0]&16&&(H.focused=E[4]),T[0]&8192&&(H.readonly=E[13]),T[0]&512&&(H.contentLines=E[9]),!f&&T[0]&4096&&(f=!0,H.api=E[12],add_flush_callback(()=>f=!1)),u.$set(H)}M&&M.p&&(!v||T[1]&2)&&update_slot_base(M,S,E,E[32],v?get_slot_changes(S,E[32],T,null):get_all_dirty_from_scope(E[32]),null)},i(E){v||(u&&transition_in(u.$$.fragment,E),transition_in(M,E),v=!0)},o(E){u&&transition_out(u.$$.fragment,E),transition_out(M,E),v=!1},d(E){E&&detach(m),u&&destroy_component(u,E),M&&M.d(E)}}}function create_fragment$2h(p){var m,v;let u,f;return u=new GridCell({props:{highlighted:p[0],rowIdx:p[2],topRow:p[3],focused:p[4],selectedUser:p[5],readonly:p[13],hidden:p[10],selected:p[1]||p[11],error:p[17],width:p[6].width,metadata:{...(m=p[7].__metadata)==null?void 0:m.row,...(v=p[7].__metadata)==null?void 0:v.cell[p[6].name]},$$slots:{default:[create_default_slot$19]},$$scope:{ctx:p}}}),u.$on("contextmenu",p[31]),u.$on("mousedown",p[23]),u.$on("mouseenter",function(){is_function(p[15])&&p[15].apply(this,arguments)}),u.$on("mouseup",function(){is_function(p[14])&&p[14].apply(this,arguments)}),u.$on("click",p[24]),{c(){create_component(u.$$.fragment)},m(y,w){mount_component(u,y,w),f=!0},p(y,w){var S,M;p=y;const k={};w[0]&1&&(k.highlighted=p[0]),w[0]&4&&(k.rowIdx=p[2]),w[0]&8&&(k.topRow=p[3]),w[0]&16&&(k.focused=p[4]),w[0]&32&&(k.selectedUser=p[5]),w[0]&8192&&(k.readonly=p[13]),w[0]&1024&&(k.hidden=p[10]),w[0]&2050&&(k.selected=p[1]||p[11]),w[0]&131072&&(k.error=p[17]),w[0]&64&&(k.width=p[6].width),w[0]&192&&(k.metadata={...(S=p[7].__metadata)==null?void 0:S.row,...(M=p[7].__metadata)==null?void 0:M.cell[p[6].name]}),w[0]&13008|w[1]&2&&(k.$$scope={dirty:w,ctx:p}),u.$set(k)},i(y){f||(transition_in(u.$$.fragment,y),f=!0)},o(y){transition_out(u.$$.fragment,y),f=!1},d(y){destroy_component(u,y)}}}function instance$2e(p,u,f){let m,v,y,w,k,S,M,E,T=noop$2,H=()=>(T(),T=subscribe(m,yt=>f(17,E=yt)),m);p.$$.on_destroy.push(()=>T());let{$$slots:V={},$$scope:q}=u;const{rows:Z,columns:J,focusedCellId:ae,focusedCellAPI:ie,menu:he,config:fe,validation:me,selectedCells:be,selectedCellCount:Ce}=getContext$1("grid");component_subscribe(p,ae,yt=>f(34,S=yt)),component_subscribe(p,fe,yt=>f(28,M=yt)),component_subscribe(p,Ce,yt=>f(33,k=yt));let{highlighted:ze}=u,{rowFocused:Se}=u,{rowSelected:Ie}=u,{rowIdx:xe}=u,{topRow:Ne=!1}=u,{focused:$e}=u,{selectedUser:Ze}=u,{column:ve}=u,{row:Re}=u,{cellId:Qe}=u,{updateValue:Fe=Z.actions.updateValue}=u,{contentLines:Je=1}=u,{hidden:ft=!1}=u,{isSelectingCells:Et=!1}=u,{cellSelected:qe=!1}=u;const Ge=writable(null);let dt;const xt=(yt,cn)=>yt?derived(me,Mn=>Mn[cn]):Ge,ot={focus:()=>{var yt;return(yt=dt==null?void 0:dt.focus)==null?void 0:yt.call(dt)},blur:()=>{var yt;return(yt=dt==null?void 0:dt.blur)==null?void 0:yt.call(dt)},isActive:()=>{var yt;return((yt=dt==null?void 0:dt.isActive)==null?void 0:yt.call(dt))??!1},onKeyDown:(...yt)=>{var cn;return(cn=dt==null?void 0:dt.onKeyDown)==null?void 0:cn.call(dt,...yt)},isReadonly:()=>v,getType:()=>ve.schema.type,getValue:()=>Re[ve.name],setValue:(yt,cn={apply:!0})=>{me.actions.setError(Qe,null),Fe({rowId:Re._id,column:ve.name,value:yt,apply:cn==null?void 0:cn.apply})}},jt=yt=>{yt.button!==0||yt.shiftKey||be.actions.startSelecting(Qe)},Xe=yt=>{if(yt.buttons!==1){be.actions.stopSelecting();return}be.actions.updateTarget(Qe)},Ut=()=>{be.actions.stopSelecting()},en=yt=>{yt.shiftKey&&S?be.actions.selectRange(S,Qe):yt.shiftKey&&k?be.actions.updateTarget(Qe):ae.set(Qe)};function Nt(yt){dt=yt,f(12,dt)}const kt=yt=>he.actions.open(Qe,yt);return p.$$set=yt=>{"highlighted"in yt&&f(0,ze=yt.highlighted),"rowFocused"in yt&&f(25,Se=yt.rowFocused),"rowSelected"in yt&&f(1,Ie=yt.rowSelected),"rowIdx"in yt&&f(2,xe=yt.rowIdx),"topRow"in yt&&f(3,Ne=yt.topRow),"focused"in yt&&f(4,$e=yt.focused),"selectedUser"in yt&&f(5,Ze=yt.selectedUser),"column"in yt&&f(6,ve=yt.column),"row"in yt&&f(7,Re=yt.row),"cellId"in yt&&f(8,Qe=yt.cellId),"updateValue"in yt&&f(26,Fe=yt.updateValue),"contentLines"in yt&&f(9,Je=yt.contentLines),"hidden"in yt&&f(10,ft=yt.hidden),"isSelectingCells"in yt&&f(27,Et=yt.isSelectingCells),"cellSelected"in yt&&f(11,qe=yt.cellSelected),"$$scope"in yt&&f(32,q=yt.$$scope)},p.$$.update=()=>{p.$$.dirty[0]&33554688&&H(f(16,m=xt(Se,Qe))),p.$$.dirty[0]&268435648&&f(13,v=J.actions.isReadonly(ve)||!M.canEditRows&&!Re._isNewRow),p.$$.dirty[0]&16&&$e&&ie.set(ot),p.$$.dirty[0]&134217728&&f(15,y=Et?Xe:null),p.$$.dirty[0]&134217728&&f(14,w=Et?Ut:null)},[ze,Ie,xe,Ne,$e,Ze,ve,Re,Qe,Je,ft,qe,dt,v,w,y,m,E,ae,he,fe,Ce,ot,jt,en,Se,Fe,Et,M,V,Nt,kt,q]}class DataCell extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2e,create_fragment$2h,safe_not_equal,{highlighted:0,rowFocused:25,rowSelected:1,rowIdx:2,topRow:3,focused:4,selectedUser:5,column:6,row:7,cellId:8,updateValue:26,contentLines:9,hidden:10,isSelectingCells:27,cellSelected:11},null,[-1,-1])}}const GridRow_svelte_svelte_type_style_lang="";function get_each_context$s(p,u,f){const m=p.slice();m[38]=u[f];const v=getCellID(m[0]._id,m[38].name);return m[39]=v,m}function create_each_block$s(p){let u,f;return u=new DataCell({props:{cellId:p[39],column:p[38],row:p[0],rowFocused:p[5],rowSelected:p[7],cellSelected:p[10][p[39]],highlighted:p[6]||p[5]||p[4]===p[38].name,rowIdx:p[0].__idx,topRow:p[1],focused:p[11]===p[39],selectedUser:p[12][p[39]],width:p[38].width,contentLines:p[13],hidden:!p[14][p[38].name],isSelectingCells:p[2]}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&513&&(y.cellId=m[39]),v[0]&512&&(y.column=m[38]),v[0]&1&&(y.row=m[0]),v[0]&32&&(y.rowFocused=m[5]),v[0]&128&&(y.rowSelected=m[7]),v[0]&1537&&(y.cellSelected=m[10][m[39]]),v[0]&624&&(y.highlighted=m[6]||m[5]||m[4]===m[38].name),v[0]&1&&(y.rowIdx=m[0].__idx),v[0]&2&&(y.topRow=m[1]),v[0]&2561&&(y.focused=m[11]===m[39]),v[0]&4609&&(y.selectedUser=m[12][m[39]]),v[0]&512&&(y.width=m[38].width),v[0]&8192&&(y.contentLines=m[13]),v[0]&16896&&(y.hidden=!m[14][m[38].name]),v[0]&4&&(y.isSelectingCells=m[2]),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_fragment$2g(p){let u,f,m,v,y=ensure_array_like(p[9]),w=[];for(let S=0;S<y.length;S+=1)w[S]=create_each_block$s(get_each_context$s(p,y,S));const k=S=>transition_out(w[S],1,1,()=>{w[S]=null});return{c(){u=element("div");for(let S=0;S<w.length;S+=1)w[S].c();attr(u,"class","row svelte-1507qm8")},m(S,M){insert(S,u,M);for(let E=0;E<w.length;E+=1)w[E]&&w[E].m(u,null);f=!0,m||(v=[listen(u,"focus",p[34]),listen(u,"mouseenter",function(){is_function(p[8]?null:p[35])&&(p[8]?null:p[35]).apply(this,arguments)}),listen(u,"mouseleave",function(){is_function(p[8]?null:p[36])&&(p[8]?null:p[36]).apply(this,arguments)}),listen(u,"click",p[37])],m=!0)},p(S,M){if(p=S,M[0]&32503){y=ensure_array_like(p[9]);let E;for(E=0;E<y.length;E+=1){const T=get_each_context$s(p,y,E);w[E]?(w[E].p(T,M),transition_in(w[E],1)):(w[E]=create_each_block$s(T),w[E].c(),transition_in(w[E],1),w[E].m(u,null))}for(group_outros(),E=y.length;E<w.length;E+=1)k(E);check_outros()}},i(S){if(!f){for(let M=0;M<y.length;M+=1)transition_in(w[M]);f=!0}},o(S){w=w.filter(Boolean);for(let M=0;M<w.length;M+=1)transition_out(w[M]);f=!1},d(S){S&&detach(u),destroy_each(w,S),m=!1,run_all(v)}}}function instance$2d(p,u,f){let m,v,y,w,k,S,M,E,T,H,V,q,Z,J,ae,ie,he,{row:fe}=u,{top:me=!1}=u;const{focusedCellId:be,reorder:Ce,selectedRows:ze,scrollableColumns:Se,hoveredRowId:Ie,focusedRow:xe,contentLines:Ne,isDragging:$e,dispatch:Ze,rows:ve,columnRenderMap:Re,userCellMap:Qe,isSelectingCells:Fe,selectedCellMap:Je,selectedCellCount:ft}=getContext$1("grid");component_subscribe(p,be,xt=>f(11,J=xt)),component_subscribe(p,Ce,xt=>f(30,k=xt)),component_subscribe(p,ze,xt=>f(33,H=xt)),component_subscribe(p,Se,xt=>f(9,q=xt)),component_subscribe(p,Ie,xt=>f(3,T=xt)),component_subscribe(p,xe,xt=>f(31,S=xt)),component_subscribe(p,Ne,xt=>f(13,ie=xt)),component_subscribe(p,$e,xt=>f(8,V=xt)),component_subscribe(p,Re,xt=>f(14,he=xt)),component_subscribe(p,Qe,xt=>f(12,ae=xt)),component_subscribe(p,Fe,xt=>f(2,M=xt)),component_subscribe(p,Je,xt=>f(10,Z=xt)),component_subscribe(p,ft,xt=>f(32,E=xt));function Et(xt){bubble.call(this,p,xt)}const qe=()=>set_store_value(Ie,T=fe._id,T),Ge=()=>set_store_value(Ie,T=null,T),dt=()=>Ze("rowclick",ve.actions.cleanRow(fe));return p.$$set=xt=>{"row"in xt&&f(0,fe=xt.row),"top"in xt&&f(1,me=xt.top)},p.$$.update=()=>{p.$$.dirty[0]&1|p.$$.dirty[1]&4&&f(7,m=!!H[fe._id]),p.$$.dirty[0]&13|p.$$.dirty[1]&2&&f(6,v=T===fe._id&&(!E||!M)),p.$$.dirty[0]&1|p.$$.dirty[1]&1&&f(5,y=(S==null?void 0:S._id)===fe._id),p.$$.dirty[0]&1073741824&&f(4,w=k.sourceColumn)},[fe,me,M,T,w,y,v,m,V,q,Z,J,ae,ie,he,be,Ce,ze,Se,Ie,xe,Ne,$e,Ze,ve,Re,Qe,Fe,Je,ft,k,S,E,H,Et,qe,Ge,dt]}class GridRow extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2d,create_fragment$2g,safe_not_equal,{row:0,top:1},null,[-1,-1])}}const ButtonColumn_svelte_svelte_type_style_lang="";function get_each_context$r(p,u,f){var k;const m=p.slice();m[46]=u[f];const v=!!m[7][m[46]._id];m[47]=v;const y=m[5]===m[46]._id;m[48]=y;const w=((k=m[8])==null?void 0:k._id)===m[46]._id;return m[49]=w,m}function get_each_context_1$3(p,u,f){const m=p.slice();return m[52]=u[f],m}function create_else_block$o(p){let u,f,m=ensure_array_like(p[4]),v=[];for(let w=0;w<m.length;w+=1)v[w]=create_each_block_1$3(get_each_context_1$3(p,m,w));const y=w=>transition_out(v[w],1,1,()=>{v[w]=null});return{c(){for(let w=0;w<v.length;w+=1)v[w].c();u=empty$1()},m(w,k){for(let S=0;S<v.length;S+=1)v[S]&&v[S].m(w,k);insert(w,u,k),f=!0},p(w,k){if(k[0]&134217808){m=ensure_array_like(w[4]);let S;for(S=0;S<m.length;S+=1){const M=get_each_context_1$3(w,m,S);v[S]?(v[S].p(M,k),transition_in(v[S],1)):(v[S]=create_each_block_1$3(M),v[S].c(),transition_in(v[S],1),v[S].m(u.parentNode,u))}for(group_outros(),S=m.length;S<v.length;S+=1)y(S);check_outros()}},i(w){if(!f){for(let k=0;k<m.length;k+=1)transition_in(v[k]);f=!0}},o(w){v=v.filter(Boolean);for(let k=0;k<v.length;k+=1)transition_out(v[k]);f=!1},d(w){w&&detach(u),destroy_each(v,w)}}}function create_if_block_1$F(p){let u,f;function m(){return p[35](p[46])}return u=new CollapsedButtonGroup({props:{buttons:p[28](p[4],p[46]),text:p[1].buttonsCollapsedText||"Action",align:"right",offset:5,size:"S",animate:!1}}),u.$on("mouseenter",m),{c(){create_component(u.$$.fragment)},m(v,y){mount_component(u,v,y),f=!0},p(v,y){p=v;const w={};y[0]&80&&(w.buttons=p[28](p[4],p[46])),y[0]&2&&(w.text=p[1].buttonsCollapsedText||"Action"),u.$set(w)},i(v){f||(transition_in(u.$$.fragment,v),f=!0)},o(v){transition_out(u.$$.fragment,v),f=!1},d(v){destroy_component(u,v)}}}function create_if_block_2$p(p){let u,f;return{c(){u=element("i"),attr(u,"class",f=p[52].icon+" S svelte-q7a9cl")},m(m,v){insert(m,u,v)},p(m,v){v[0]&16&&f!==(f=m[52].icon+" S svelte-q7a9cl")&&attr(u,"class",f)},d(m){m&&detach(u)}}}function create_default_slot_2$n(p){let u,f=(p[52].text||"Button")+"",m,v=p[52].icon&&create_if_block_2$p(p);return{c(){v&&v.c(),u=space(),m=text$1(f)},m(y,w){v&&v.m(y,w),insert(y,u,w),insert(y,m,w)},p(y,w){y[52].icon?v?v.p(y,w):(v=create_if_block_2$p(y),v.c(),v.m(u.parentNode,u)):v&&(v.d(1),v=null),w[0]&16&&f!==(f=(y[52].text||"Button")+"")&&set_data(m,f)},d(y){y&&(detach(u),detach(m)),v&&v.d(y)}}}function create_each_block_1$3(p){let u,f;function m(){return p[36](p[52],p[46])}return u=new Button$1({props:{newStyles:!0,size:"S",cta:p[52].type==="cta",primary:p[52].type==="primary",secondary:p[52].type==="secondary",warning:p[52].type==="warning",overBackground:p[52].type==="overBackground",$$slots:{default:[create_default_slot_2$n]},$$scope:{ctx:p}}}),u.$on("click",m),{c(){create_component(u.$$.fragment)},m(v,y){mount_component(u,v,y),f=!0},p(v,y){p=v;const w={};y[0]&16&&(w.cta=p[52].type==="cta"),y[0]&16&&(w.primary=p[52].type==="primary"),y[0]&16&&(w.secondary=p[52].type==="secondary"),y[0]&16&&(w.warning=p[52].type==="warning"),y[0]&16&&(w.overBackground=p[52].type==="overBackground"),y[0]&16|y[1]&16777216&&(w.$$scope={dirty:y,ctx:p}),u.$set(w)},i(v){f||(transition_in(u.$$.fragment,v),f=!0)},o(v){transition_out(u.$$.fragment,v),f=!1},d(v){destroy_component(u,v)}}}function create_default_slot_1$w(p){let u,f,m,v;const y=[create_if_block_1$F,create_else_block$o],w=[];function k(S,M){return S[1].buttonsCollapsed?0:1}return f=k(p),m=w[f]=y[f](p),{c(){u=element("div"),m.c(),attr(u,"class","buttons svelte-q7a9cl"),toggle_class(u,"offset",p[10]&&p[11])},m(S,M){insert(S,u,M),w[f].m(u,null),v=!0},p(S,M){let E=f;f=k(S),f===E?w[f].p(S,M):(group_outros(),transition_out(w[E],1,1,()=>{w[E]=null}),check_outros(),m=w[f],m?m.p(S,M):(m=w[f]=y[f](S),m.c()),transition_in(m,1),m.m(u,null)),(!v||M[0]&3072)&&toggle_class(u,"offset",S[10]&&S[11])},i(S){v||(transition_in(m),v=!0)},o(S){transition_out(m),v=!1},d(S){S&&detach(u),w[f].d()}}}function create_each_block$r(p){var k;let u,f,m,v,y;f=new GridCell({props:{width:"auto",rowIdx:p[46].__idx,selected:p[47],highlighted:p[48]||p[49],metadata:(k=p[46].__metadata)==null?void 0:k.row,$$slots:{default:[create_default_slot_1$w]},$$scope:{ctx:p}}});function w(){return p[37](p[46])}return{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"class","row svelte-q7a9cl")},m(S,M){insert(S,u,M),mount_component(f,u,null),m=!0,v||(y=[listen(u,"mouseenter",function(){is_function(p[9]?null:w)&&(p[9]?null:w).apply(this,arguments)}),listen(u,"mouseleave",function(){is_function(p[9]?null:p[38])&&(p[9]?null:p[38]).apply(this,arguments)})],v=!0)},p(S,M){var T;p=S;const E={};M[0]&64&&(E.rowIdx=p[46].__idx),M[0]&192&&(E.selected=p[47]),M[0]&352&&(E.highlighted=p[48]||p[49]),M[0]&64&&(E.metadata=(T=p[46].__metadata)==null?void 0:T.row),M[0]&3186|M[1]&16777216&&(E.$$scope={dirty:M,ctx:p}),f.$set(E)},i(S){m||(transition_in(f.$$.fragment,S),m=!0)},o(S){transition_out(f.$$.fragment,S),m=!1},d(S){S&&detach(u),destroy_component(f),v=!1,run_all(y)}}}function create_if_block$1m(p){let u,f,m,v,y;return f=new GridCell({props:{width:"100%",highlighted:p[5]===BlankRowID}}),f.$on("click",p[39]),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"class","row blank svelte-q7a9cl")},m(w,k){insert(w,u,k),mount_component(f,u,null),m=!0,v||(y=[listen(u,"mouseenter",function(){is_function(p[9]?null:p[40])&&(p[9]?null:p[40]).apply(this,arguments)}),listen(u,"mouseleave",function(){is_function(p[9]?null:p[41])&&(p[9]?null:p[41]).apply(this,arguments)})],v=!0)},p(w,k){p=w;const S={};k[0]&32&&(S.highlighted=p[5]===BlankRowID),f.$set(S)},i(w){m||(transition_in(f.$$.fragment,w),m=!0)},o(w){transition_out(f.$$.fragment,w),m=!1},d(w){w&&detach(u),destroy_component(f),v=!1,run_all(y)}}}function create_default_slot$18(p){let u,f,m,v=ensure_array_like(p[6]),y=[];for(let S=0;S<v.length;S+=1)y[S]=create_each_block$r(get_each_context$r(p,v,S));const w=S=>transition_out(y[S],1,1,()=>{y[S]=null});let k=p[12].canAddRows&&create_if_block$1m(p);return{c(){for(let S=0;S<y.length;S+=1)y[S].c();u=space(),k&&k.c(),f=empty$1()},m(S,M){for(let E=0;E<y.length;E+=1)y[E]&&y[E].m(S,M);insert(S,u,M),k&&k.m(S,M),insert(S,f,M),m=!0},p(S,M){if(M[0]&402657266){v=ensure_array_like(S[6]);let E;for(E=0;E<v.length;E+=1){const T=get_each_context$r(S,v,E);y[E]?(y[E].p(T,M),transition_in(y[E],1)):(y[E]=create_each_block$r(T),y[E].c(),transition_in(y[E],1),y[E].m(u.parentNode,u))}for(group_outros(),E=v.length;E<y.length;E+=1)w(E);check_outros()}S[12].canAddRows?k?(k.p(S,M),M[0]&4096&&transition_in(k,1)):(k=create_if_block$1m(S),k.c(),transition_in(k,1),k.m(f.parentNode,f)):k&&(group_outros(),transition_out(k,1,1,()=>{k=null}),check_outros())},i(S){if(!m){for(let M=0;M<v.length;M+=1)transition_in(y[M]);transition_in(k),m=!0}},o(S){y=y.filter(Boolean);for(let M=0;M<y.length;M+=1)transition_out(y[M]);transition_out(k),m=!1},d(S){S&&(detach(u),detach(f)),destroy_each(y,S),k&&k.d(S)}}}function create_fragment$2f(p){let u,f,m,v,y,w,k;function S(E){p[42](E)}let M={scrollVertically:!0,attachHandlers:!0,$$slots:{default:[create_default_slot$18]},$$scope:{ctx:p}};return p[2]!==void 0&&(M.ref=p[2]),m=new GridScrollWrapper({props:M}),binding_callbacks.push(()=>bind(m,"ref",S)),{c(){u=element("div"),f=element("div"),create_component(m.$$.fragment),attr(f,"class","content svelte-q7a9cl"),attr(u,"class","button-column svelte-q7a9cl"),set_style(u,"left",p[3]+"px"),toggle_class(u,"hidden",p[0]===0)},m(E,T){insert(E,u,T),append$2(u,f),mount_component(m,f,null),y=!0,w||(k=listen(f,"mouseleave",p[43]),w=!0)},p(E,T){const H={};T[0]&8178|T[1]&16777216&&(H.$$scope={dirty:T,ctx:E}),!v&&T[0]&4&&(v=!0,H.ref=E[2],add_flush_callback(()=>v=!1)),m.$set(H),(!y||T[0]&8)&&set_style(u,"left",E[3]+"px"),(!y||T[0]&1)&&toggle_class(u,"hidden",E[0]===0)},i(E){y||(transition_in(m.$$.fragment,E),y=!0)},o(E){transition_out(m.$$.fragment,E),y=!1},d(E){E&&detach(u),destroy_component(m),w=!1,k()}}}function instance$2c(p,u,f){let m,v,y,w,k,S,M,E,T,H,V,q,Z,J,ae,ie,he,fe;const{renderedRows:me,hoveredRowId:be,props:Ce,width:ze,rows:Se,focusedRow:Ie,selectedRows:xe,scrollableColumns:Ne,scrollLeft:$e,isDragging:Ze,buttonColumnWidth:ve,showVScrollbar:Re,showHScrollbar:Qe,dispatch:Fe,config:Je}=getContext$1("grid");component_subscribe(p,me,yt=>f(6,q=yt)),component_subscribe(p,be,yt=>f(5,V=yt)),component_subscribe(p,Ce,yt=>f(1,H=yt)),component_subscribe(p,ze,yt=>f(32,M=yt)),component_subscribe(p,Ie,yt=>f(8,J=yt)),component_subscribe(p,xe,yt=>f(7,Z=yt)),component_subscribe(p,Ne,yt=>f(34,T=yt)),component_subscribe(p,$e,yt=>f(33,E=yt)),component_subscribe(p,Ze,yt=>f(9,ae=yt)),component_subscribe(p,ve,yt=>f(0,S=yt)),component_subscribe(p,Re,yt=>f(10,ie=yt)),component_subscribe(p,Qe,yt=>f(11,he=yt)),component_subscribe(p,Je,yt=>f(12,fe=yt));let ft;const Et=({buttons:yt,buttonsCollapsed:cn})=>{let Mn=yt||[];return cn?Mn:Mn.slice(0,3)},qe=async(yt,cn)=>{var Mn;await((Mn=yt.onClick)==null?void 0:Mn.call(yt,Se.actions.cleanRow(cn))),await Se.actions.refreshRow(cn._id)},Ge=(yt,cn)=>yt.map(Mn=>({...Mn,onClick:()=>qe(Mn,cn)}));onMount(()=>{new ResizeObserver(cn=>{var fn,Sn;const Mn=((Sn=(fn=cn==null?void 0:cn[0])==null?void 0:fn.contentRect)==null?void 0:Sn.width)??0;ve.set(Mn-1)}).observe(ft)});const dt=yt=>set_store_value(be,V=yt._id,V),xt=(yt,cn)=>qe(yt,cn),ot=yt=>set_store_value(be,V=yt._id,V),jt=()=>set_store_value(be,V=null,V),Xe=()=>Fe("add-row-inline"),Ut=()=>set_store_value(be,V=BlankRowID,V),en=()=>set_store_value(be,V=null,V);function Nt(yt){ft=yt,f(2,ft)}const kt=()=>set_store_value(be,V=null,V);return p.$$.update=()=>{p.$$.dirty[0]&2&&f(4,m=Et(H)),p.$$.dirty[1]&8&&f(31,v=T.reduce((yt,cn)=>yt+=cn.width,0)),p.$$.dirty[1]&5&&f(30,y=v-E-1),p.$$.dirty[0]&1|p.$$.dirty[1]&2&&f(29,w=M-S-1),p.$$.dirty[0]&1610612736&&f(3,k=Math.min(y,w))},[S,H,ft,k,m,V,q,Z,J,ae,ie,he,fe,me,be,Ce,ze,Ie,xe,Ne,$e,Ze,ve,Re,Qe,Fe,Je,qe,Ge,w,y,v,M,E,T,dt,xt,ot,jt,Xe,Ut,en,Nt,kt]}class ButtonColumn extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2c,create_fragment$2f,safe_not_equal,{},null,[-1,-1])}}const GridBody_svelte_svelte_type_style_lang="";function get_each_context$q(p,u,f){const m=p.slice();return m[21]=u[f],m[23]=f,m}function create_each_block$q(p){let u,f;return u=new GridRow({props:{row:p[21],top:p[23]===0}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&4&&(y.row=m[21]),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_if_block_1$E(p){let u,f,m,v,y;return f=new GridCell({props:{width:p[1],highlighted:p[5]===BlankRowID}}),f.$on("click",p[15]),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"class","row blank svelte-17lftvb")},m(w,k){insert(w,u,k),mount_component(f,u,null),m=!0,v||(y=[listen(u,"mouseenter",function(){is_function(p[4]?null:p[16])&&(p[4]?null:p[16]).apply(this,arguments)}),listen(u,"mouseleave",function(){is_function(p[4]?null:p[17])&&(p[4]?null:p[17]).apply(this,arguments)})],v=!0)},p(w,k){p=w;const S={};k&2&&(S.width=p[1]),k&32&&(S.highlighted=p[5]===BlankRowID),f.$set(S)},i(w){m||(transition_in(f.$$.fragment,w),m=!0)},o(w){transition_out(f.$$.fragment,w),m=!1},d(w){w&&detach(u),destroy_component(f),v=!1,run_all(y)}}}function create_default_slot$17(p){let u,f,m,v=ensure_array_like(p[2]),y=[];for(let S=0;S<v.length;S+=1)y[S]=create_each_block$q(get_each_context$q(p,v,S));const w=S=>transition_out(y[S],1,1,()=>{y[S]=null});let k=p[3].canAddRows&&create_if_block_1$E(p);return{c(){for(let S=0;S<y.length;S+=1)y[S].c();u=space(),k&&k.c(),f=empty$1()},m(S,M){for(let E=0;E<y.length;E+=1)y[E]&&y[E].m(S,M);insert(S,u,M),k&&k.m(S,M),insert(S,f,M),m=!0},p(S,M){if(M&4){v=ensure_array_like(S[2]);let E;for(E=0;E<v.length;E+=1){const T=get_each_context$q(S,v,E);y[E]?(y[E].p(T,M),transition_in(y[E],1)):(y[E]=create_each_block$q(T),y[E].c(),transition_in(y[E],1),y[E].m(u.parentNode,u))}for(group_outros(),E=v.length;E<y.length;E+=1)w(E);check_outros()}S[3].canAddRows?k?(k.p(S,M),M&8&&transition_in(k,1)):(k=create_if_block_1$E(S),k.c(),transition_in(k,1),k.m(f.parentNode,f)):k&&(group_outros(),transition_out(k,1,1,()=>{k=null}),check_outros())},i(S){if(!m){for(let M=0;M<v.length;M+=1)transition_in(y[M]);transition_in(k),m=!0}},o(S){y=y.filter(Boolean);for(let M=0;M<y.length;M+=1)transition_out(y[M]);transition_out(k),m=!1},d(S){S&&(detach(u),detach(f)),destroy_each(y,S),k&&k.d(S)}}}function create_if_block$1l(p){let u,f;return u=new ButtonColumn({}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_fragment$2e(p){var w;let u,f,m,v;f=new GridScrollWrapper({props:{scrollHorizontally:!0,scrollVertically:!0,attachHandlers:!0,$$slots:{default:[create_default_slot$17]},$$scope:{ctx:p}}});let y=((w=p[6].buttons)==null?void 0:w.length)&&create_if_block$1l();return{c(){u=element("div"),create_component(f.$$.fragment),m=space(),y&&y.c(),attr(u,"class","grid-body svelte-17lftvb")},m(k,S){insert(k,u,S),mount_component(f,u,null),append$2(u,m),y&&y.m(u,null),p[18](u),v=!0},p(k,[S]){var E;const M={};S&16777278&&(M.$$scope={dirty:S,ctx:k}),f.$set(M),(E=k[6].buttons)!=null&&E.length?y?S&64&&transition_in(y,1):(y=create_if_block$1l(),y.c(),transition_in(y,1),y.m(u,null)):y&&(group_outros(),transition_out(y,1,1,()=>{y=null}),check_outros())},i(k){v||(transition_in(f.$$.fragment,k),transition_in(y),v=!0)},o(k){transition_out(f.$$.fragment,k),transition_out(y),v=!1},d(k){k&&detach(u),destroy_component(f),y&&y.d(),p[18](null)}}}function instance$2b(p,u,f){let m,v,y,w,k,S,M;const{bounds:E,renderedRows:T,scrollableColumns:H,hoveredRowId:V,dispatch:q,isDragging:Z,config:J,props:ae}=getContext$1("grid");component_subscribe(p,T,ze=>f(2,y=ze)),component_subscribe(p,H,ze=>f(14,v=ze)),component_subscribe(p,V,ze=>f(5,S=ze)),component_subscribe(p,Z,ze=>f(4,k=ze)),component_subscribe(p,J,ze=>f(3,w=ze)),component_subscribe(p,ae,ze=>f(6,M=ze));let ie;const he=()=>{E.set(ie.getBoundingClientRect())};onMount(()=>{const ze=new ResizeObserver(he);return ze.observe(ie),window.addEventListener("wheel",he,!0),()=>{ze.disconnect(),window.removeEventListener("wheel",he,!0)}});const fe=()=>q("add-row-inline"),me=()=>set_store_value(V,S=BlankRowID,S),be=()=>set_store_value(V,S=null,S);function Ce(ze){binding_callbacks[ze?"unshift":"push"](()=>{ie=ze,f(0,ie)})}return p.$$.update=()=>{p.$$.dirty&16384&&f(1,m=v.reduce((ze,Se)=>ze+=Se.width,0))},[ie,m,y,w,k,S,M,T,H,V,q,Z,J,ae,v,fe,me,be,Ce]}class GridBody extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2b,create_fragment$2e,safe_not_equal,{})}}const ResizeOverlay_svelte_svelte_type_style_lang="";function get_each_context$p(p,u,f){const m=p.slice();return m[12]=u[f],m}function create_if_block$1k(p){let u,f=ensure_array_like(p[1]),m=[];for(let v=0;v<f.length;v+=1)m[v]=create_each_block$p(get_each_context$p(p,f,v));return{c(){for(let v=0;v<m.length;v+=1)m[v].c();u=empty$1()},m(v,y){for(let w=0;w<m.length;w+=1)m[w]&&m[w].m(v,y);insert(v,u,y)},p(v,y){if(y&286){f=ensure_array_like(v[1]);let w;for(w=0;w<f.length;w+=1){const k=get_each_context$p(v,f,w);m[w]?m[w].p(k,y):(m[w]=create_each_block$p(k),m[w].c(),m[w].m(u.parentNode,u))}for(;w<m.length;w+=1)m[w].d(1);m.length=f.length}},d(v){v&&detach(u),destroy_each(m,v)}}}function create_each_block$p(p){let u,f,m,v,y,w;function k(...E){return p[9](p[12],...E)}function S(...E){return p[10](p[12],...E)}function M(){return p[11](p[12])}return{c(){u=element("div"),f=element("div"),m=space(),attr(f,"class","resize-indicator svelte-be62xg"),attr(u,"class","resize-slider svelte-be62xg"),attr(u,"style",v=p[8](p[12],p[3])),toggle_class(u,"visible",p[2].column===p[12].name)},m(E,T){insert(E,u,T),append$2(u,f),append$2(u,m),y||(w=[listen(u,"mousedown",k),listen(u,"touchstart",S),listen(u,"dblclick",M)],y=!0)},p(E,T){p=E,T&10&&v!==(v=p[8](p[12],p[3]))&&attr(u,"style",v),T&6&&toggle_class(u,"visible",p[2].column===p[12].name)},d(E){E&&detach(u),y=!1,run_all(w)}}}function create_fragment$2d(p){let u,f=!p[0]&&create_if_block$1k(p);return{c(){f&&f.c(),u=empty$1()},m(m,v){f&&f.m(m,v),insert(m,u,v)},p(m,[v]){m[0]?f&&(f.d(1),f=null):f?f.p(m,v):(f=create_if_block$1k(m),f.c(),f.m(u.parentNode,u))},i:noop$2,o:noop$2,d(m){m&&detach(u),f&&f.d(m)}}}function instance$2a(p,u,f){let m,v,y,w;const{resize:k,visibleColumns:S,isReordering:M,scrollLeft:E}=getContext$1("grid");return component_subscribe(p,k,Z=>f(2,y=Z)),component_subscribe(p,S,Z=>f(1,v=Z)),component_subscribe(p,M,Z=>f(0,m=Z)),component_subscribe(p,E,Z=>f(3,w=Z)),[m,v,y,w,k,S,M,E,(Z,J)=>{let ae=Z.__left+Z.width;return Z.primaryDisplay||(ae-=J),`left:${ae}px;`},(Z,J)=>k.actions.startResizing(Z,J),(Z,J)=>k.actions.startResizing(Z,J),Z=>k.actions.resetSize(Z)]}class ResizeOverlay extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2a,create_fragment$2d,safe_not_equal,{})}}const ReorderOverlay_svelte_svelte_type_style_lang="";function create_if_block$1j(p){let u,f,m;return f=new GridScrollWrapper({props:{scrollVertically:!0,$$slots:{default:[create_default_slot$16]},$$scope:{ctx:p}}}),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"class","reorder-wrapper svelte-1e4eaad")},m(v,y){insert(v,u,y),mount_component(f,u,null),m=!0},p(v,y){const w={};y&2097154&&(w.$$scope={dirty:y,ctx:v}),f.$set(w)},i(v){m||(transition_in(f.$$.fragment,v),m=!0)},o(v){transition_out(f.$$.fragment,v),m=!1},d(v){v&&detach(u),destroy_component(f)}}}function create_default_slot$16(p){let u;return{c(){u=element("div"),attr(u,"class","reorder-overlay svelte-1e4eaad"),attr(u,"style",p[1])},m(f,m){insert(f,u,m)},p(f,m){m&2&&attr(u,"style",f[1])},d(f){f&&detach(u)}}}function create_fragment$2c(p){let u,f,m=p[0]&&create_if_block$1j(p);return{c(){m&&m.c(),u=empty$1()},m(v,y){m&&m.m(v,y),insert(v,u,y),f=!0},p(v,[y]){v[0]?m?(m.p(v,y),y&1&&transition_in(m,1)):(m=create_if_block$1j(v),m.c(),transition_in(m,1),m.m(u.parentNode,u)):m&&(group_outros(),transition_out(m,1,1,()=>{m=null}),check_outros())},i(v){f||(transition_in(m),f=!0)},o(v){transition_out(m),f=!1},d(v){v&&detach(u),m&&m.d(v)}}}function instance$29(p,u,f){let m,v,y,w,k,S,M,E,T,H,V,q,Z;const{isReordering:J,reorder:ae,columnLookupMap:ie,rowHeight:he,renderedRows:fe,scrollLeft:me,stickyWidth:be}=getContext$1("grid");component_subscribe(p,J,ze=>f(14,E=ze)),component_subscribe(p,ae,ze=>f(18,q=ze)),component_subscribe(p,ie,ze=>f(19,Z=ze)),component_subscribe(p,he,ze=>f(16,H=ze)),component_subscribe(p,fe,ze=>f(15,T=ze)),component_subscribe(p,me,ze=>f(17,V=ze)),component_subscribe(p,be,ze=>f(13,M=ze));const Ce=(ze,Se,Ie)=>{if(!ze)return 0;let xe=ze.__left-Ie;return Se&&(xe+=ze.width),xe};return p.$$.update=()=>{p.$$.dirty&786432&&f(12,m=Z[q.targetColumn]),p.$$.dirty&262144&&f(11,v=q.insertAfter),p.$$.dirty&137216&&f(9,y=Ce(m,v,V)),p.$$.dirty&98304&&f(10,w=H*T.length+DefaultRowHeight),p.$$.dirty&1536&&f(1,k=`left:${y}px; height:${w}px;`),p.$$.dirty&25088&&f(0,S=E&&y>=M)},[S,k,J,ae,ie,he,fe,me,be,y,w,v,m,M,E,T,H,V,q,Z]}class ReorderOverlay extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$29,create_fragment$2c,safe_not_equal,{})}}const PopoverOverlay_svelte_svelte_type_style_lang="";function create_fragment$2b(p){let u;return{c(){u=element("div"),attr(u,"class","grid-popover-container svelte-ws1j1t")},m(f,m){insert(f,u,m)},p:noop$2,i:noop$2,o:noop$2,d(f){f&&detach(u)}}}class PopoverOverlay extends SvelteComponent{constructor(u){super(),init$1(this,u,null,create_fragment$2b,safe_not_equal,{})}}const NewColumnButton_svelte_svelte_type_style_lang="";function create_if_block$1i(p){let u,f;return u=new GridPopover({props:{anchor:p[2],align:p[1].length?"right":"left",maxHeight:null,resizable:!0,minWidth:360,$$slots:{default:[create_default_slot$15]},$$scope:{ctx:p}}}),u.$on("close",p[8]),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&4&&(y.anchor=m[2]),v&2&&(y.align=m[1].length?"right":"left"),v&32768&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot$15(p){let u,f;const m=p[13].default,v=create_slot(m,p,p[15],null);return{c(){u=element("div"),v&&v.c(),attr(u,"class","content svelte-13f8h1i")},m(y,w){insert(y,u,w),v&&v.m(u,null),f=!0},p(y,w){v&&v.p&&(!f||w&32768)&&update_slot_base(v,m,y,y[15],f?get_slot_changes(m,y[15],w,null):get_all_dirty_from_scope(y[15]),null)},i(y){f||(transition_in(v,y),f=!0)},o(y){transition_out(v,y),f=!1},d(y){y&&detach(u),v&&v.d(y)}}}function create_fragment$2a(p){let u,f,m,v,y,w,k;f=new Icon$1({props:{name:"Add"}});let S=p[0]&&create_if_block$1i(p);return{c(){u=element("div"),create_component(f.$$.fragment),m=space(),S&&S.c(),v=empty$1(),attr(u,"id","add-column-button"),attr(u,"class","add svelte-13f8h1i"),set_style(u,"left",p[3]+"px")},m(M,E){insert(M,u,E),mount_component(f,u,null),p[14](u),insert(M,m,E),S&&S.m(M,E),insert(M,v,E),y=!0,w||(k=listen(u,"click",p[7]),w=!0)},p(M,[E]){(!y||E&8)&&set_style(u,"left",M[3]+"px"),M[0]?S?(S.p(M,E),E&1&&transition_in(S,1)):(S=create_if_block$1i(M),S.c(),transition_in(S,1),S.m(v.parentNode,v)):S&&(group_outros(),transition_out(S,1,1,()=>{S=null}),check_outros())},i(M){y||(transition_in(f.$$.fragment,M),transition_in(S),y=!0)},o(M){transition_out(f.$$.fragment,M),transition_out(S),y=!1},d(M){M&&(detach(u),detach(m),detach(v)),destroy_component(f),p[14](null),S&&S.d(M),w=!1,k()}}}function instance$28(p,u,f){let m,v,y,w,k,S,{$$slots:M={},$$scope:E}=u;const{scrollableColumns:T,scrollLeft:H,width:V,subscribe:q,ui:Z,keyboardBlocked:J}=getContext$1("grid");component_subscribe(p,T,be=>f(1,S=be)),component_subscribe(p,H,be=>f(12,k=be)),component_subscribe(p,V,be=>f(11,w=be));let ae,ie=!1;const he=()=>{Z.actions.blur(),f(0,ie=!0)},fe=()=>{f(0,ie=!1)};onMount(()=>q("close-edit-column",fe));function me(be){binding_callbacks[be?"unshift":"push"](()=>{ae=be,f(2,ae)})}return p.$$set=be=>{"$$scope"in be&&f(15,E=be.$$scope)},p.$$.update=()=>{p.$$.dirty&2&&f(10,m=S.reduce((be,Ce)=>be+=Ce.width,0)),p.$$.dirty&5120&&f(9,v=m-1-k),p.$$.dirty&2560&&f(3,y=Math.min(w-40,v)),p.$$.dirty&1&&J.set(ie)},[ie,S,ae,y,T,H,V,he,fe,v,m,w,k,M,me,E]}class NewColumnButton extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$28,create_fragment$2a,safe_not_equal,{})}}function create_default_slot$14(p){let u,f=p[0].schema.name+"",m,v,y,w,k,S,M;y=new InlineAlert({props:{type:"error",header:"Are you sure?",message:"This will leave bindings which utilised the user relationship column in a state where they will need to be updated to use the new column instead."}});function E(H){p[5](H)}let T={label:"New column name",error:p[2]};return p[1]!==void 0&&(T.value=p[1]),k=new Input$5({props:T}),binding_callbacks.push(()=>bind(k,"value",E)),{c(){u=text$1('This operation will kick off a migration of the column "'),m=text$1(f),v=text$1(`"
395
+ `),v&&v.c(),f=empty$1()},m(y,w){insert(y,u,w),v&&v.m(y,w),insert(y,f,w),m=!0},p(y,w){y[2]?v?(v.p(y,w),w&4&&transition_in(v,1)):(v=create_if_block$1x(y),v.c(),transition_in(v,1),v.m(f.parentNode,f)):v&&(group_outros(),transition_out(v,1,1,()=>{v=null}),check_outros())},i(y){m||(transition_in(v),m=!0)},o(y){transition_out(v),m=!1},d(y){y&&(detach(u),detach(f)),v&&v.d(y)}}}function create_default_slot$1i(p){let u,f;return u=new ModalContent({props:{title:"Confirm paste",confirmText:"Continue",cancelText:"Cancel",onConfirm:p[7],size:"M",$$slots:{default:[create_default_slot_1$y]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&131078&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_fragment$2C(p){let u,f,m={$$slots:{default:[create_default_slot$1i]},$$scope:{ctx:p}};return u=new Modal({props:m}),p[8](u),{c(){create_component(u.$$.fragment)},m(v,y){mount_component(u,v,y),f=!0},p(v,[y]){const w={};y&131078&&(w.$$scope={dirty:y,ctx:v}),u.$set(w)},i(v){f||(transition_in(u.$$.fragment,v),f=!0)},o(v){transition_out(u.$$.fragment,v),f=!1},d(v){p[8](null),destroy_component(u,v)}}}const duration=260;function instance$2z(p,u,f){let m,v,y,w;const{clipboard:k,subscribe:S,copyAllowed:M,pasteAllowed:E,selectedCellCount:T,focusedCellAPI:H}=getContext$1("grid");component_subscribe(p,k,fe=>f(9,m=fe)),component_subscribe(p,M,fe=>f(12,w=fe)),component_subscribe(p,E,fe=>f(11,y=fe)),component_subscribe(p,T,fe=>f(10,v=fe));let V,q=0,Z=!1;const J=()=>{w&&k.actions.copy()},ae=async()=>{var be;if((be=get_store_value(H))!=null&&be.isActive()||(f(1,q=0),!y))return;const fe=v>1;m.multiCellCopy||fe?V==null||V.show():k.actions.paste()},ie=async()=>{f(2,Z=!0),await k.actions.paste(fe=>{f(1,q=fe*100)}),await sleep(duration),f(2,Z=!1)};onMount(()=>S("copy",J)),onMount(()=>S("paste",ae));function he(fe){binding_callbacks[fe?"unshift":"push"](()=>{V=fe,f(0,V)})}return[V,q,Z,k,M,E,T,ie,he]}class ClipboardHandler extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2z,create_fragment$2C,safe_not_equal,{})}}const GridScrollWrapper_svelte_svelte_type_style_lang="";function create_fragment$2B(p){let u,f,m,v,y;const w=p[23].default,k=create_slot(w,p,p[22],null);return{c(){u=element("div"),f=element("div"),k&&k.c(),attr(f,"style",p[2]),attr(f,"class","inner svelte-i68dpr"),attr(u,"class","outer svelte-i68dpr")},m(S,M){insert(S,u,M),append$2(u,f),k&&k.m(f,null),p[24](f),m=!0,v||(y=[listen(u,"wheel",function(){is_function(p[1]?p[14]:null)&&(p[1]?p[14]:null).apply(this,arguments)}),listen(u,"touchstart",function(){is_function(p[1]?p[15]:null)&&(p[1]?p[15]:null).apply(this,arguments)}),listen(u,"touchmove",function(){is_function(p[1]?p[16]:null)&&(p[1]?p[16]:null).apply(this,arguments)}),listen(u,"click",self$1(p[5].actions.blur))],v=!0)},p(S,M){p=S,k&&k.p&&(!m||M[0]&4194304)&&update_slot_base(k,w,p,p[22],m?get_slot_changes(w,p[22],M,null):get_all_dirty_from_scope(p[22]),null),(!m||M[0]&4)&&attr(f,"style",p[2])},i(S){m||(transition_in(k,S),m=!0)},o(S){transition_out(k,S),m=!1},d(S){S&&detach(u),k&&k.d(S),p[24](null),v=!1,run_all(y)}}}function instance$2y(p,u,f){let m,v,y,w,k,S,M,E,T,H,V,{$$slots:q={},$$scope:Z}=u;const{rowHeight:J,scroll:ae,ui:ie,renderedRows:he,maxScrollTop:fe,maxScrollLeft:me,bounds:be,hoveredRowId:Ce,menu:ze,focusedCellAPI:Se,scrollTop:Ie,scrollLeft:xe}=getContext$1("grid");component_subscribe(p,J,dt=>f(19,v=dt)),component_subscribe(p,ae,dt=>f(31,M=dt)),component_subscribe(p,he,dt=>f(27,y=dt)),component_subscribe(p,fe,dt=>f(30,S=dt)),component_subscribe(p,me,dt=>f(29,k=dt)),component_subscribe(p,be,dt=>f(28,w=dt)),component_subscribe(p,ze,dt=>f(32,E=dt)),component_subscribe(p,Se,dt=>f(33,T=dt)),component_subscribe(p,Ie,dt=>f(20,H=dt)),component_subscribe(p,xe,dt=>f(21,V=dt));let{scrollVertically:Ne=!1}=u,{scrollHorizontally:$e=!1}=u,{attachHandlers:Ze=!1}=u,{ref:ve}=u,Re,Qe;const Fe=(dt,xt,ot)=>{const jt=$e?-1*dt:0,Xe=Ne?-1*(xt%ot):0;return`transform: translate(${jt}px, ${Xe}px);`},Je=dt=>{dt.preventDefault(),qe(dt.deltaX,dt.deltaY,dt.clientY),T==null||T.blur(),E.visible&&ze.actions.close()},ft=dt=>{var xt;(xt=dt.touches)!=null&&xt[0]&&(Re=dt.touches[0].clientX,Qe=dt.touches[0].clientY)},Et=dt=>{var jt;if(!((jt=dt.touches)!=null&&jt[0]))return;dt.preventDefault();const xt=Re-dt.touches[0].clientX,ot=Qe-dt.touches[0].clientY;qe(xt,ot),Re=dt.touches[0].clientX,Qe=dt.touches[0].clientY,E.visible&&ze.actions.close()},qe=domDebounce((dt,xt,ot)=>{const{top:jt,left:Xe}=M;let Ut=jt+xt;Ut=Math.max(0,Math.min(Ut,S));let en=Xe+dt;if(en=Math.max(0,Math.min(en,k)),ae.set({left:$e?en:Xe,top:Ne?Ut:jt}),ot!=null){const Nt=ot-w.top+Ut%v,kt=y[Math.floor(Nt/v)];Ce.set(kt==null?void 0:kt._id)}});function Ge(dt){binding_callbacks[dt?"unshift":"push"](()=>{ve=dt,f(0,ve)})}return p.$$set=dt=>{"scrollVertically"in dt&&f(17,Ne=dt.scrollVertically),"scrollHorizontally"in dt&&f(18,$e=dt.scrollHorizontally),"attachHandlers"in dt&&f(1,Ze=dt.attachHandlers),"ref"in dt&&f(0,ve=dt.ref),"$$scope"in dt&&f(22,Z=dt.$$scope)},p.$$.update=()=>{p.$$.dirty[0]&3670016&&f(2,m=Fe(V,H,v))},[ve,Ze,m,J,ae,ie,he,fe,me,be,ze,Se,Ie,xe,Je,ft,Et,Ne,$e,v,H,V,Z,q,Ge]}class GridScrollWrapper extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2y,create_fragment$2B,safe_not_equal,{scrollVertically:17,scrollHorizontally:18,attachHandlers:1,ref:0},null,[-1,-1])}}const GridCell_svelte_svelte_type_style_lang="";function create_if_block_1$M(p){let u,f;return{c(){u=element("div"),f=text$1(p[4]),attr(u,"class","label svelte-1n504m6")},m(m,v){insert(m,u,v),append$2(u,f)},p(m,v){v&16&&set_data(f,m[4])},d(m){m&&detach(u)}}}function create_if_block$1w(p){let u,f=p[3].label+"",m;return{c(){u=element("div"),m=text$1(f),attr(u,"class","label svelte-1n504m6")},m(v,y){insert(v,u,y),append$2(u,m)},p(v,y){y&8&&f!==(f=v[3].label+"")&&set_data(m,f)},d(v){v&&detach(u)}}}function create_fragment$2A(p){let u,f,m,v,y,w,k=p[4]&&create_if_block_1$M(p);const S=p[15].default,M=create_slot(S,p,p[14],null);let E=p[3]&&!p[0]&&create_if_block$1w(p);return{c(){u=element("div"),k&&k.c(),f=space(),M&&M.c(),m=space(),E&&E.c(),attr(u,"class","cell svelte-1n504m6"),attr(u,"style",p[11]),toggle_class(u,"selected",p[1]),toggle_class(u,"highlighted",p[2]),toggle_class(u,"focused",p[0]),toggle_class(u,"error",p[4]),toggle_class(u,"center",p[8]),toggle_class(u,"readonly",p[9]),toggle_class(u,"hidden",p[10]),toggle_class(u,"default-height",p[7]),toggle_class(u,"selected-other",p[3]!=null),toggle_class(u,"alt",p[5]%2===1),toggle_class(u,"top",p[6])},m(T,H){insert(T,u,H),k&&k.m(u,null),append$2(u,f),M&&M.m(u,null),append$2(u,m),E&&E.m(u,null),v=!0,y||(w=[listen(u,"focus",p[16]),listen(u,"mousedown",p[17]),listen(u,"mouseup",p[18]),listen(u,"click",p[19]),listen(u,"contextmenu",p[20]),listen(u,"touchstart",p[21],{passive:!0}),listen(u,"touchend",p[22]),listen(u,"touchcancel",p[23]),listen(u,"mouseenter",p[24])],y=!0)},p(T,[H]){T[4]?k?k.p(T,H):(k=create_if_block_1$M(T),k.c(),k.m(u,f)):k&&(k.d(1),k=null),M&&M.p&&(!v||H&16384)&&update_slot_base(M,S,T,T[14],v?get_slot_changes(S,T[14],H,null):get_all_dirty_from_scope(T[14]),null),T[3]&&!T[0]?E?E.p(T,H):(E=create_if_block$1w(T),E.c(),E.m(u,null)):E&&(E.d(1),E=null),(!v||H&2048)&&attr(u,"style",T[11]),(!v||H&2)&&toggle_class(u,"selected",T[1]),(!v||H&4)&&toggle_class(u,"highlighted",T[2]),(!v||H&1)&&toggle_class(u,"focused",T[0]),(!v||H&16)&&toggle_class(u,"error",T[4]),(!v||H&256)&&toggle_class(u,"center",T[8]),(!v||H&512)&&toggle_class(u,"readonly",T[9]),(!v||H&1024)&&toggle_class(u,"hidden",T[10]),(!v||H&128)&&toggle_class(u,"default-height",T[7]),(!v||H&8)&&toggle_class(u,"selected-other",T[3]!=null),(!v||H&32)&&toggle_class(u,"alt",T[5]%2===1),(!v||H&64)&&toggle_class(u,"top",T[6])},i(T){v||(transition_in(M,T),v=!0)},o(T){transition_out(M,T),v=!1},d(T){T&&detach(u),k&&k.d(),M&&M.d(T),E&&E.d(),y=!1,run_all(w)}}}function instance$2x(p,u,f){let m,{$$slots:v={},$$scope:y}=u,{focused:w=!1}=u,{selected:k=!1}=u,{highlighted:S=!1}=u,{width:M=""}=u,{selectedUser:E=null}=u,{error:T=null}=u,{rowIdx:H}=u,{topRow:V=!1}=u,{defaultHeight:q=!1}=u,{center:Z=!1}=u,{readonly:J=!1}=u,{hidden:ae=!1}=u,{metadata:ie=null}=u;const he=($e,Ze,ve)=>{let Re;return $e==="auto"||$e==="100%"?Re=`width: ${$e};`:Re=`flex: 0 0 ${$e}px;`,Ze&&(Re+=`--user-color :${Ze.color};`),ve!=null&&ve.backgroundColor&&(Re+=`--cell-background: ${ve.backgroundColor};`),ve!=null&&ve.textColor&&(Re+=`--cell-font-color: ${ve.textColor};`),Re};function fe($e){bubble.call(this,p,$e)}function me($e){bubble.call(this,p,$e)}function be($e){bubble.call(this,p,$e)}function Ce($e){bubble.call(this,p,$e)}function ze($e){bubble.call(this,p,$e)}function Se($e){bubble.call(this,p,$e)}function Ie($e){bubble.call(this,p,$e)}function xe($e){bubble.call(this,p,$e)}function Ne($e){bubble.call(this,p,$e)}return p.$$set=$e=>{"focused"in $e&&f(0,w=$e.focused),"selected"in $e&&f(1,k=$e.selected),"highlighted"in $e&&f(2,S=$e.highlighted),"width"in $e&&f(12,M=$e.width),"selectedUser"in $e&&f(3,E=$e.selectedUser),"error"in $e&&f(4,T=$e.error),"rowIdx"in $e&&f(5,H=$e.rowIdx),"topRow"in $e&&f(6,V=$e.topRow),"defaultHeight"in $e&&f(7,q=$e.defaultHeight),"center"in $e&&f(8,Z=$e.center),"readonly"in $e&&f(9,J=$e.readonly),"hidden"in $e&&f(10,ae=$e.hidden),"metadata"in $e&&f(13,ie=$e.metadata),"$$scope"in $e&&f(14,y=$e.$$scope)},p.$$.update=()=>{p.$$.dirty&12296&&f(11,m=he(M,E,ie))},[w,k,S,E,T,H,V,q,Z,J,ae,m,M,ie,y,v,fe,me,be,Ce,ze,Se,Ie,xe,Ne]}class GridCell extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2x,create_fragment$2A,safe_not_equal,{focused:0,selected:1,highlighted:2,width:12,selectedUser:3,error:4,rowIdx:5,topRow:6,defaultHeight:7,center:8,readonly:9,hidden:10,metadata:13})}}const GridPopover_svelte_svelte_type_style_lang="";function create_default_slot$1h(p){let u,f,m,v;const y=p[13].default,w=create_slot(y,p,p[15],null);return{c(){u=element("div"),w&&w.c(),attr(u,"class","grid-popover-contents svelte-5gc6hw"),attr(u,"style",p[7])},m(k,S){insert(k,u,S),w&&w.m(u,null),f=!0,m||(v=[action_destroyer(clickOutside.call(null,u,p[14])),listen(u,"wheel",wheel_handler)],m=!0)},p(k,S){w&&w.p&&(!f||S&32768)&&update_slot_base(w,y,k,k[15],f?get_slot_changes(y,k[15],S,null):get_all_dirty_from_scope(k[15]),null),(!f||S&128)&&attr(u,"style",k[7])},i(k){f||(transition_in(w,k),f=!0)},o(k){transition_out(w,k),f=!1},d(k){k&&detach(u),w&&w.d(k),m=!1,run_all(v)}}}function create_fragment$2z(p){let u,f;return u=new Popover({props:{open:p[2],anchor:p[0],align:p[1],resizable:p[3],wrap:p[4],offset:p[5],clickOutsideOverride:p[6],portalTarget:"#"+p[8]+" .grid-popover-container",$$slots:{default:[create_default_slot$1h]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,[v]){const y={};v&4&&(y.open=m[2]),v&1&&(y.anchor=m[0]),v&2&&(y.align=m[1]),v&8&&(y.resizable=m[3]),v&16&&(y.wrap=m[4]),v&32&&(y.offset=m[5]),v&64&&(y.clickOutsideOverride=m[6]),v&32896&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}const wheel_handler=p=>p.stopPropagation();function instance$2w(p,u,f){let m,{$$slots:v={},$$scope:y}=u,{anchor:w}=u,{minWidth:k=PopoverMinWidth}=u,{maxWidth:S=PopoverMaxWidth}=u,{maxHeight:M=PopoverMaxHeight}=u,{align:E="left"}=u,{open:T=!0}=u,{resizable:H=!1}=u,{wrap:V=!0}=u,{offset:q=0}=u,{clickOutsideOverride:Z}=u;const{gridID:J}=getContext$1("grid"),ae=createEventDispatcher(),ie=(fe,me,be)=>{let Ce="";return fe!=null&&(Ce+=`min-width: ${fe}px;`),me!=null&&(Ce+=`max-width: ${me}px;`),be!=null&&(Ce+=`max-height: ${be}px;`),Ce},he=()=>ae("close");return p.$$set=fe=>{"anchor"in fe&&f(0,w=fe.anchor),"minWidth"in fe&&f(10,k=fe.minWidth),"maxWidth"in fe&&f(11,S=fe.maxWidth),"maxHeight"in fe&&f(12,M=fe.maxHeight),"align"in fe&&f(1,E=fe.align),"open"in fe&&f(2,T=fe.open),"resizable"in fe&&f(3,H=fe.resizable),"wrap"in fe&&f(4,V=fe.wrap),"offset"in fe&&f(5,q=fe.offset),"clickOutsideOverride"in fe&&f(6,Z=fe.clickOutsideOverride),"$$scope"in fe&&f(15,y=fe.$$scope)},p.$$.update=()=>{p.$$.dirty&7168&&f(7,m=ie(k,S,M))},[w,E,T,H,V,q,Z,m,J,ae,k,S,M,v,he,y]}class GridPopover extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2w,create_fragment$2z,safe_not_equal,{anchor:0,minWidth:10,maxWidth:11,maxHeight:12,align:1,open:2,resizable:3,wrap:4,offset:5,clickOutsideOverride:6})}}const OptionsCell_svelte_svelte_type_style_lang="";function get_each_context$v(p,u,f){const m=p.slice();m[23]=u[f],m[26]=f;const v=m[8][m[23]]||m[11](m[23]);return m[24]=v,m}function get_each_context_1$5(p,u,f){const m=p.slice();m[27]=u[f];const v=m[8][m[27]]||m[11](m[27]);return m[24]=v,m}function create_else_block$t(p){let u,f=(p[27]||"")+"",m,v;return{c(){u=element("div"),m=text$1(f),v=space(),attr(u,"class","text svelte-14lr9ae")},m(y,w){insert(y,u,w),append$2(u,m),append$2(u,v)},p(y,w){w&64&&f!==(f=(y[27]||"")+"")&&set_data(m,f)},d(y){y&&detach(u)}}}function create_if_block_3$k(p){let u,f,m=p[27]+"",v,y;return{c(){u=element("div"),f=element("span"),v=text$1(m),y=space(),attr(f,"class","svelte-14lr9ae"),attr(u,"class","badge text svelte-14lr9ae"),set_style(u,"--color",p[24])},m(w,k){insert(w,u,k),append$2(u,f),append$2(f,v),append$2(u,y)},p(w,k){k&64&&m!==(m=w[27]+"")&&set_data(v,m),k&320&&set_style(u,"--color",w[24])},d(w){w&&detach(u)}}}function create_each_block_1$5(p){let u;function f(y,w){return y[24]?create_if_block_3$k:create_else_block$t}let m=f(p),v=m(p);return{c(){v.c(),u=empty$1()},m(y,w){v.m(y,w),insert(y,u,w)},p(y,w){m===(m=f(y))&&v?v.p(y,w):(v.d(1),v=m(y),v&&(v.c(),v.m(u.parentNode,u)))},d(y){y&&detach(u),v.d(y)}}}function create_if_block_2$t(p){let u,f,m,v,y;return f=new Icon$1({props:{name:"ChevronDown"}}),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"class","arrow svelte-14lr9ae")},m(w,k){insert(w,u,k),mount_component(f,u,null),m=!0,v||(y=listen(u,"click",p[9]),v=!0)},p:noop$2,i(w){m||(transition_in(f.$$.fragment,w),m=!0)},o(w){transition_out(f.$$.fragment,w),m=!1},d(w){w&&detach(u),destroy_component(f),v=!1,y()}}}function create_if_block$1v(p){let u,f;return u=new GridPopover({props:{anchor:p[4],$$slots:{default:[create_default_slot$1g]},$$scope:{ctx:p}}}),u.$on("close",p[10]),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&16&&(y.anchor=m[4]),v&1073742184&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_if_block_1$L(p){let u,f;return u=new Icon$1({props:{name:"Checkmark",color:"var(--accent-color)"}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_each_block$v(p){let u,f,m,v=p[23]+"",y,w,k=p[6].includes(p[23]),S,M,E,T,H=k&&create_if_block_1$L();function V(){return p[20](p[23])}function q(){return p[21](p[26])}return{c(){u=element("div"),f=element("div"),m=element("span"),y=text$1(v),w=space(),H&&H.c(),S=space(),attr(m,"class","svelte-14lr9ae"),attr(f,"class","badge text svelte-14lr9ae"),set_style(f,"--color",p[24]),attr(u,"class","option svelte-14lr9ae"),toggle_class(u,"focused",p[3]===p[26])},m(Z,J){insert(Z,u,J),append$2(u,f),append$2(f,m),append$2(m,y),append$2(u,w),H&&H.m(u,null),append$2(u,S),M=!0,E||(T=[listen(u,"click",V),listen(u,"mouseenter",q)],E=!0)},p(Z,J){p=Z,(!M||J&32)&&v!==(v=p[23]+"")&&set_data(y,v),(!M||J&288)&&set_style(f,"--color",p[24]),J&96&&(k=p[6].includes(p[23])),k?H?J&96&&transition_in(H,1):(H=create_if_block_1$L(),H.c(),transition_in(H,1),H.m(u,S)):H&&(group_outros(),transition_out(H,1,1,()=>{H=null}),check_outros()),(!M||J&8)&&toggle_class(u,"focused",p[3]===p[26])},i(Z){M||(transition_in(H),M=!0)},o(Z){transition_out(H),M=!1},d(Z){Z&&detach(u),H&&H.d(),E=!1,run_all(T)}}}function create_default_slot$1g(p){let u,f,m=ensure_array_like(p[5]),v=[];for(let w=0;w<m.length;w+=1)v[w]=create_each_block$v(get_each_context$v(p,m,w));const y=w=>transition_out(v[w],1,1,()=>{v[w]=null});return{c(){u=element("div");for(let w=0;w<v.length;w+=1)v[w].c();attr(u,"class","options svelte-14lr9ae")},m(w,k){insert(w,u,k);for(let S=0;S<v.length;S+=1)v[S]&&v[S].m(u,null);f=!0},p(w,k){if(k&6504){m=ensure_array_like(w[5]);let S;for(S=0;S<m.length;S+=1){const M=get_each_context$v(w,m,S);v[S]?(v[S].p(M,k),transition_in(v[S],1)):(v[S]=create_each_block$v(M),v[S].c(),transition_in(v[S],1),v[S].m(u,null))}for(group_outros(),S=m.length;S<v.length;S+=1)y(S);check_outros()}},i(w){if(!f){for(let k=0;k<m.length;k+=1)transition_in(v[k]);f=!0}},o(w){v=v.filter(Boolean);for(let k=0;k<v.length;k+=1)transition_out(v[k]);f=!1},d(w){w&&detach(u),destroy_each(v,w)}}}function create_fragment$2y(p){let u,f,m,v,y,w,k,S,M=ensure_array_like(p[6]),E=[];for(let V=0;V<M.length;V+=1)E[V]=create_each_block_1$5(get_each_context_1$5(p,M,V));let T=p[7]&&create_if_block_2$t(p),H=p[2]&&create_if_block$1v(p);return{c(){u=element("div"),f=element("div");for(let V=0;V<E.length;V+=1)E[V].c();m=space(),T&&T.c(),v=space(),H&&H.c(),y=empty$1(),attr(f,"class","values svelte-14lr9ae"),toggle_class(f,"wrap",p[1]>1),attr(u,"class","container svelte-14lr9ae"),toggle_class(u,"multi",p[0]),toggle_class(u,"editable",p[7]),toggle_class(u,"open",p[9])},m(V,q){insert(V,u,q),append$2(u,f);for(let Z=0;Z<E.length;Z+=1)E[Z]&&E[Z].m(f,null);append$2(u,m),T&&T.m(u,null),p[19](u),insert(V,v,q),H&&H.m(V,q),insert(V,y,q),w=!0,k||(S=[listen(f,"click",function(){is_function(p[7]?p[9]:null)&&(p[7]?p[9]:null).apply(this,arguments)}),listen(u,"click",self$1(function(){is_function(p[7]?p[9]:null)&&(p[7]?p[9]:null).apply(this,arguments)}))],k=!0)},p(V,[q]){if(p=V,q&2368){M=ensure_array_like(p[6]);let Z;for(Z=0;Z<M.length;Z+=1){const J=get_each_context_1$5(p,M,Z);E[Z]?E[Z].p(J,q):(E[Z]=create_each_block_1$5(J),E[Z].c(),E[Z].m(f,null))}for(;Z<E.length;Z+=1)E[Z].d(1);E.length=M.length}(!w||q&2)&&toggle_class(f,"wrap",p[1]>1),p[7]?T?(T.p(p,q),q&128&&transition_in(T,1)):(T=create_if_block_2$t(p),T.c(),transition_in(T,1),T.m(u,null)):T&&(group_outros(),transition_out(T,1,1,()=>{T=null}),check_outros()),(!w||q&1)&&toggle_class(u,"multi",p[0]),(!w||q&128)&&toggle_class(u,"editable",p[7]),p[2]?H?(H.p(p,q),q&4&&transition_in(H,1)):(H=create_if_block$1v(p),H.c(),transition_in(H,1),H.m(y.parentNode,y)):H&&(group_outros(),transition_out(H,1,1,()=>{H=null}),check_outros())},i(V){w||(transition_in(T),transition_in(H),w=!0)},o(V){transition_out(T),transition_out(H),w=!1},d(V){V&&(detach(u),detach(v),detach(y)),destroy_each(E,V),T&&T.d(),p[19](null),H&&H.d(V),k=!1,run_all(S)}}}const InvalidColor="hsla(0, 0%, 70%, 0.3)";function instance$2v(p,u,f){let m,v,y,w,{value:k}=u,{schema:S}=u,{onChange:M}=u,{focused:E=!1}=u,{multi:T=!1}=u,{readonly:H=!1}=u,{api:V}=u,{contentLines:q=1}=u,Z=!1,J=null,ae;const ie=()=>{f(2,Z=!0),f(3,J=0)},he=()=>{f(2,Z=!1)},fe=Ie=>{let xe=Ie?m.indexOf(Ie):null;return xe==null||xe===-1?InvalidColor:OptionColours[xe%OptionColours.length]},me=Ie=>{if(!T)M(Ie===k?null:Ie),he();else{const xe=w.filter(Ne=>m.includes(Ne));xe.includes(Ie)?M(xe.filter(Ne=>Ne!==Ie)):M([...xe,Ie])}},be=Ie=>Z?(Ie.preventDefault(),Ie.key==="ArrowDown"?f(3,J=Math.min(J+1,m.length-1)):Ie.key==="ArrowUp"?f(3,J=Math.max(J-1,0)):Ie.key==="Enter"&&me(m[J]),!0):!1;onMount(()=>{f(13,V={focus:ie,blur:he,isActive:()=>Z,onKeyDown:be})});function Ce(Ie){binding_callbacks[Ie?"unshift":"push"](()=>{ae=Ie,f(4,ae)})}const ze=Ie=>me(Ie),Se=Ie=>f(3,J=Ie);return p.$$set=Ie=>{"value"in Ie&&f(14,k=Ie.value),"schema"in Ie&&f(15,S=Ie.schema),"onChange"in Ie&&f(16,M=Ie.onChange),"focused"in Ie&&f(17,E=Ie.focused),"multi"in Ie&&f(0,T=Ie.multi),"readonly"in Ie&&f(18,H=Ie.readonly),"api"in Ie&&f(13,V=Ie.api),"contentLines"in Ie&&f(1,q=Ie.contentLines)},p.$$.update=()=>{var Ie;p.$$.dirty&32768&&f(5,m=((Ie=S==null?void 0:S.constraints)==null?void 0:Ie.inclusion)||[]),p.$$.dirty&32768&&f(8,v=(S==null?void 0:S.optionColors)||{}),p.$$.dirty&393216&&f(7,y=E&&!H),p.$$.dirty&16384&&f(6,w=Array.isArray(k)?k:[k].filter(xe=>xe!=null)),p.$$.dirty&131076&&!E&&Z&&he()},[T,q,Z,J,ae,m,w,y,v,ie,he,fe,me,V,k,S,M,E,H,Ce,ze,Se]}class OptionsCell extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2v,create_fragment$2y,safe_not_equal,{value:14,schema:15,onChange:16,focused:17,multi:0,readonly:18,api:13,contentLines:1})}}const DateCell_svelte_svelte_type_style_lang="";function create_if_block_1$K(p){let u,f;return u=new Icon$1({props:{name:"Calendar"}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_if_block$1u(p){let u,f;return u=new GridPopover({props:{anchor:p[6],maxHeight:null,$$slots:{default:[create_default_slot$1f]},$$scope:{ctx:p}}}),u.$on("close",p[10]),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&64&&(y.anchor=m[6]),v&2097213&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot$1f(p){let u,f;return u=new DatePickerPopoverContents({props:{value:p[5],useKeyboardShortcuts:!1,enableTime:p[4],timeOnly:p[3],ignoreTimezones:p[2]}}),u.$on("change",p[17]),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&32&&(y.value=m[5]),v&16&&(y.enableTime=m[4]),v&8&&(y.timeOnly=m[3]),v&4&&(y.ignoreTimezones=m[2]),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_fragment$2x(p){let u,f,m,v,y,w,k,S,M,E=p[8]&&create_if_block_1$K(),T=p[1]&&create_if_block$1u(p);return{c(){u=element("div"),f=element("div"),m=text$1(p[7]),v=space(),E&&E.c(),y=space(),T&&T.c(),w=empty$1(),attr(f,"class","value svelte-17mmumr"),attr(u,"class","container svelte-17mmumr"),toggle_class(u,"editable",p[8])},m(H,V){insert(H,u,V),append$2(u,f),append$2(f,m),append$2(u,v),E&&E.m(u,null),p[16](u),insert(H,y,V),T&&T.m(H,V),insert(H,w,V),k=!0,S||(M=listen(u,"click",function(){is_function(p[8]?p[9]:null)&&(p[8]?p[9]:null).apply(this,arguments)}),S=!0)},p(H,[V]){p=H,(!k||V&128)&&set_data(m,p[7]),p[8]?E?V&256&&transition_in(E,1):(E=create_if_block_1$K(),E.c(),transition_in(E,1),E.m(u,null)):E&&(group_outros(),transition_out(E,1,1,()=>{E=null}),check_outros()),(!k||V&256)&&toggle_class(u,"editable",p[8]),p[1]?T?(T.p(p,V),V&2&&transition_in(T,1)):(T=create_if_block$1u(p),T.c(),transition_in(T,1),T.m(w.parentNode,w)):T&&(group_outros(),transition_out(T,1,1,()=>{T=null}),check_outros())},i(H){k||(transition_in(E),transition_in(T),k=!0)},o(H){transition_out(E),transition_out(T),k=!1},d(H){H&&(detach(u),detach(y),detach(w)),E&&E.d(),p[16](null),T&&T.d(H),S=!1,M()}}}function instance$2u(p,u,f){let m,v,y,w,k,S,{value:M}=u,{schema:E}=u,{onChange:T}=u,{focused:H=!1}=u,{readonly:V=!1}=u,{api:q}=u,Z,J;const ae=(ze,Se,Ie)=>getDateDisplayValue(ze,{enableTime:Ie,timeOnly:Se}),ie=()=>{f(1,Z=!0)},he=()=>{f(1,Z=!1),T(M)},fe=ze=>Z?(ze.preventDefault(),ze.key==="ArrowUp"?me(-1,"week"):ze.key==="ArrowDown"?me(1,"week"):ze.key==="ArrowLeft"?me(-1,"day"):ze.key==="ArrowRight"?me(1,"day"):ze.key==="Enter"&&he(),!0):!1,me=(ze,Se)=>{let Ie;M?Ie=dayjs(M).add(ze,Se):Ie=dayjs(),f(0,M=stringifyDate(Ie,{enableTime:v,timeOnly:m,ignoreTimezones:y}))};onMount(()=>{f(11,q={onKeyDown:fe,focus:ie,blur:he,isActive:()=>Z})});function be(ze){binding_callbacks[ze?"unshift":"push"](()=>{J=ze,f(6,J)})}const Ce=ze=>f(0,M=ze.detail);return p.$$set=ze=>{"value"in ze&&f(0,M=ze.value),"schema"in ze&&f(12,E=ze.schema),"onChange"in ze&&f(13,T=ze.onChange),"focused"in ze&&f(14,H=ze.focused),"readonly"in ze&&f(15,V=ze.readonly),"api"in ze&&f(11,q=ze.api)},p.$$.update=()=>{p.$$.dirty&4096&&f(3,m=E==null?void 0:E.timeOnly),p.$$.dirty&4096&&f(4,v=!(E!=null&&E.dateOnly)),p.$$.dirty&4096&&f(2,y=E==null?void 0:E.ignoreTimezones),p.$$.dirty&49152&&f(8,w=H&&!V),p.$$.dirty&29&&f(5,k=parseDate(M,{timeOnly:m,enableTime:v,ignoreTimezones:y})),p.$$.dirty&56&&f(7,S=ae(k,m,v)),p.$$.dirty&16386&&!H&&Z&&he()},[M,Z,y,m,v,k,J,S,w,ie,he,q,E,T,H,V,be,Ce]}class DateCell extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2u,create_fragment$2x,safe_not_equal,{value:0,schema:12,onChange:13,focused:14,readonly:15,api:11})}}function create_fragment$2w(p){let u,f,m;const v=[p[1],{multi:!0}];function y(k){p[2](k)}let w={};for(let k=0;k<v.length;k+=1)w=assign(w,v[k]);return p[0]!==void 0&&(w.api=p[0]),u=new OptionsCell({props:w}),binding_callbacks.push(()=>bind(u,"api",y)),{c(){create_component(u.$$.fragment)},m(k,S){mount_component(u,k,S),m=!0},p(k,[S]){const M=S&2?get_spread_update(v,[get_spread_object(k[1]),v[1]]):{};!f&&S&1&&(f=!0,M.api=k[0],add_flush_callback(()=>f=!1)),u.$set(M)},i(k){m||(transition_in(u.$$.fragment,k),m=!0)},o(k){transition_out(u.$$.fragment,k),m=!1},d(k){destroy_component(u,k)}}}function instance$2t(p,u,f){let{api:m}=u;function v(y){m=y,f(0,m)}return p.$$set=y=>{f(1,u=assign(assign({},u),exclude_internal_props(y))),"api"in y&&f(0,m=y.api)},u=exclude_internal_props(u),[m,u,v]}class MultiSelectCell extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2t,create_fragment$2w,safe_not_equal,{api:0})}}const TextCell_svelte_svelte_type_style_lang="";function create_else_block$s(p){let u,f,m;return{c(){u=element("div"),f=element("div"),m=text$1(p[4]),attr(f,"class","value svelte-6ynh9c"),attr(u,"class","text-cell svelte-6ynh9c"),toggle_class(u,"number",p[1]==="number")},m(v,y){insert(v,u,y),append$2(u,f),append$2(f,m)},p(v,y){y&16&&set_data(m,v[4]),y&2&&toggle_class(u,"number",v[1]==="number")},d(v){v&&detach(u)}}}function create_if_block$1t(p){let u,f,m,v;return{c(){u=element("input"),attr(u,"type",p[1]),u.value=f=p[0]??"",attr(u,"spellcheck","false"),attr(u,"class","svelte-6ynh9c")},m(y,w){insert(y,u,w),p[12](u),m||(v=[listen(u,"focus",p[13]),listen(u,"blur",p[14]),listen(u,"change",p[6])],m=!0)},p(y,w){w&2&&attr(u,"type",y[1]),w&1&&f!==(f=y[0]??"")&&u.value!==f&&(u.value=f)},d(y){y&&detach(u),p[12](null),m=!1,run_all(v)}}}function create_fragment$2v(p){let u;function f(y,w){return y[5]?create_if_block$1t:create_else_block$s}let m=f(p),v=m(p);return{c(){v.c(),u=empty$1()},m(y,w){v.m(y,w),insert(y,u,w)},p(y,[w]){m===(m=f(y))&&v?v.p(y,w):(v.d(1),v=m(y),v&&(v.c(),v.m(u.parentNode,u)))},i:noop$2,o:noop$2,d(y){y&&detach(u),v.d(y)}}}function instance$2s(p,u,f){let m,v,{value:y}=u,{focused:w=!1}=u,{onChange:k}=u,{type:S="text"}=u,{readonly:M=!1}=u,{api:E}=u,{format:T=null}=u,H,V=!1;const q=he=>{k(he.target.value)},Z=he=>{if(!V)return!1;if(he.key==="Enter"){H==null||H.blur();const fe=new KeyboardEvent("keydown",{key:"ArrowDown"});document.dispatchEvent(fe)}return!0};onMount(()=>{f(7,E={focus:()=>H==null?void 0:H.focus(),blur:()=>H==null?void 0:H.blur(),isActive:()=>V,onKeyDown:Z})});function J(he){binding_callbacks[he?"unshift":"push"](()=>{H=he,f(2,H)})}const ae=()=>f(3,V=!0),ie=()=>f(3,V=!1);return p.$$set=he=>{"value"in he&&f(0,y=he.value),"focused"in he&&f(8,w=he.focused),"onChange"in he&&f(9,k=he.onChange),"type"in he&&f(1,S=he.type),"readonly"in he&&f(10,M=he.readonly),"api"in he&&f(7,E=he.api),"format"in he&&f(11,T=he.format)},p.$$.update=()=>{p.$$.dirty&1280&&f(5,m=w&&!M),p.$$.dirty&2049&&f(4,v=(T==null?void 0:T(y))??y??"")},[y,S,H,V,v,m,q,E,w,k,M,T,J,ae,ie]}class TextCell extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2s,create_fragment$2v,safe_not_equal,{value:0,focused:8,onChange:9,type:1,readonly:10,api:7,format:11})}}function create_fragment$2u(p){let u,f,m;const v=[p[3],{onChange:p[1]},{type:"number"},{format:p[2]}];function y(k){p[5](k)}let w={};for(let k=0;k<v.length;k+=1)w=assign(w,v[k]);return p[0]!==void 0&&(w.api=p[0]),u=new TextCell({props:w}),binding_callbacks.push(()=>bind(u,"api",y)),{c(){create_component(u.$$.fragment)},m(k,S){mount_component(u,k,S),m=!0},p(k,[S]){const M=S&14?get_spread_update(v,[S&8&&get_spread_object(k[3]),S&2&&{onChange:k[1]},v[2],S&4&&{format:k[2]}]):{};!f&&S&1&&(f=!0,M.api=k[0],add_flush_callback(()=>f=!1)),u.$set(M)},i(k){m||(transition_in(u.$$.fragment,k),m=!0)},o(k){transition_out(u.$$.fragment,k),m=!1},d(k){destroy_component(u,k)}}}const NumberFormatter=Intl.NumberFormat();function instance$2r(p,u,f){let{api:m}=u,{onChange:v}=u;const y=S=>{const M=parseFloat(S),E=isNaN(M)?null:M;v(E)},w=S=>{const M=typeof S;if(M!=="string"&&M!=="number"||M==="string"&&!S.trim().length)return"";const E=NumberFormatter.format(S);return E==="NaN"?S:E};function k(S){m=S,f(0,m)}return p.$$set=S=>{f(3,u=assign(assign({},u),exclude_internal_props(S))),"api"in S&&f(0,m=S.api),"onChange"in S&&f(4,v=S.onChange)},u=exclude_internal_props(u),[m,y,w,u,v,k]}class NumberCell extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2r,create_fragment$2u,safe_not_equal,{api:0,onChange:4})}}const RelationshipCell_svelte_svelte_type_style_lang="";function get_each_context$u(p,u,f){const m=p.slice();return m[44]=u[f],m[46]=f,m}function get_each_context_1$4(p,u,f){const m=p.slice();return m[47]=u[f],m}function create_if_block_6$7(p){let u,f,m=p[18](p[47][p[0]]||p[47].primaryDisplay)+"",v,y,w,k,S,M=p[12]&&create_if_block_7$6(p);return{c(){u=element("div"),f=element("span"),v=text$1(m),y=space(),M&&M.c(),attr(f,"class","svelte-jeqj3p"),attr(u,"class","badge svelte-jeqj3p"),toggle_class(u,"extra-info",!!p[11][p[47]._id])},m(E,T){insert(E,u,T),append$2(u,f),append$2(f,v),append$2(u,y),M&&M.m(u,null),w=!0,k||(S=listen(u,"focus",focus_handler),k=!0)},p(E,T){(!w||T[0]&65)&&m!==(m=E[18](E[47][E[0]]||E[47].primaryDisplay)+"")&&set_data(v,m),E[12]?M?(M.p(E,T),T[0]&4096&&transition_in(M,1)):(M=create_if_block_7$6(E),M.c(),transition_in(M,1),M.m(u,null)):M&&(group_outros(),transition_out(M,1,1,()=>{M=null}),check_outros()),(!w||T[0]&2112)&&toggle_class(u,"extra-info",!!E[11][E[47]._id])},i(E){w||(transition_in(M),w=!0)},o(E){transition_out(M),w=!1},d(E){E&&detach(u),M&&M.d(),k=!1,S()}}}function create_if_block_7$6(p){let u,f;function m(){return p[26](p[47])}return u=new Icon$1({props:{name:"Close",size:"XS",hoverable:!0}}),u.$on("click",m),{c(){create_component(u.$$.fragment)},m(v,y){mount_component(u,v,y),f=!0},p(v,y){p=v},i(v){f||(transition_in(u.$$.fragment,v),f=!0)},o(v){transition_out(u.$$.fragment,v),f=!1},d(v){destroy_component(u,v)}}}function create_each_block_1$4(p){let u,f,m=(p[47][p[0]]||p[47].primaryDisplay)&&create_if_block_6$7(p);return{c(){m&&m.c(),u=empty$1()},m(v,y){m&&m.m(v,y),insert(v,u,y),f=!0},p(v,y){v[47][v[0]]||v[47].primaryDisplay?m?(m.p(v,y),y[0]&65&&transition_in(m,1)):(m=create_if_block_6$7(v),m.c(),transition_in(m,1),m.m(u.parentNode,u)):m&&(group_outros(),transition_out(m,1,1,()=>{m=null}),check_outros())},i(v){f||(transition_in(m),f=!0)},o(v){transition_out(m),f=!1},d(v){v&&detach(u),m&&m.d(v)}}}function create_if_block_5$b(p){let u,f,m,v,y;return f=new Icon$1({props:{name:"Add",size:"S"}}),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"class","add svelte-jeqj3p")},m(w,k){insert(w,u,k),mount_component(f,u,null),m=!0,v||(y=listen(u,"click",p[15]),v=!0)},p:noop$2,i(w){m||(transition_in(f.$$.fragment,w),m=!0)},o(w){transition_out(f.$$.fragment,w),m=!1},d(w){w&&detach(u),destroy_component(f),v=!1,y()}}}function create_if_block_4$d(p){var v;let u,f=(((v=p[6])==null?void 0:v.length)||0)+"",m;return{c(){u=element("div"),m=text$1(f),attr(u,"class","count svelte-jeqj3p")},m(y,w){insert(y,u,w),append$2(u,m)},p(y,w){var k;w[0]&64&&f!==(f=(((k=y[6])==null?void 0:k.length)||0)+"")&&set_data(m,f)},d(y){y&&detach(u)}}}function create_if_block$1s(p){let u,f;return u=new GridPopover({props:{open:p[4],anchor:p[10],$$slots:{default:[create_default_slot$1e]},$$scope:{ctx:p}}}),u.$on("close",p[16]),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&16&&(y.open=m[4]),v[0]&1024&&(y.anchor=m[10]),v[0]&929|v[1]&524288&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_if_block_2$s(p){let u,f,m=ensure_array_like(p[7]),v=[];for(let w=0;w<m.length;w+=1)v[w]=create_each_block$u(get_each_context$u(p,m,w));const y=w=>transition_out(v[w],1,1,()=>{v[w]=null});return{c(){u=element("div");for(let w=0;w<v.length;w+=1)v[w].c();attr(u,"class","results svelte-jeqj3p")},m(w,k){insert(w,u,k);for(let S=0;S<v.length;S+=1)v[S]&&v[S].m(u,null);f=!0},p(w,k){if(k[0]&409984){m=ensure_array_like(w[7]);let S;for(S=0;S<m.length;S+=1){const M=get_each_context$u(w,m,S);v[S]?(v[S].p(M,k),transition_in(v[S],1)):(v[S]=create_each_block$u(M),v[S].c(),transition_in(v[S],1),v[S].m(u,null))}for(group_outros(),S=m.length;S<v.length;S+=1)y(S);check_outros()}},i(w){if(!f){for(let k=0;k<m.length;k+=1)transition_in(v[k]);f=!0}},o(w){v=v.filter(Boolean);for(let k=0;k<v.length;k+=1)transition_out(v[k]);f=!1},d(w){w&&detach(u),destroy_each(v,w)}}}function create_if_block_1$J(p){let u,f,m;return f=new ProgressCircle({props:{size:"S"}}),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"class","searching svelte-jeqj3p")},m(v,y){insert(v,u,y),mount_component(f,u,null),m=!0},p:noop$2,i(v){m||(transition_in(f.$$.fragment,v),m=!0)},o(v){transition_out(f.$$.fragment,v),m=!1},d(v){v&&detach(u),destroy_component(f)}}}function create_if_block_3$j(p){let u,f;return u=new Icon$1({props:{size:"S",name:"Checkmark",color:"var(--accent-color)"}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_each_block$u(p){let u,f,m,v=p[18](p[44].primaryDisplay)+"",y,w,k=p[14](p[44]),S,M,E,T,H=k&&create_if_block_3$j();function V(){return p[30](p[44])}function q(){return p[31](p[46])}return{c(){u=element("div"),f=element("div"),m=element("span"),y=text$1(v),w=space(),H&&H.c(),S=space(),attr(m,"class","svelte-jeqj3p"),attr(f,"class","badge svelte-jeqj3p"),attr(u,"class","result svelte-jeqj3p"),toggle_class(u,"candidate",p[46]===p[8])},m(Z,J){insert(Z,u,J),append$2(u,f),append$2(f,m),append$2(m,y),append$2(u,w),H&&H.m(u,null),append$2(u,S),M=!0,E||(T=[listen(u,"click",V),listen(u,"mouseenter",q)],E=!0)},p(Z,J){p=Z,(!M||J[0]&128)&&v!==(v=p[18](p[44].primaryDisplay)+"")&&set_data(y,v),J[0]&128&&(k=p[14](p[44])),k?H?J[0]&128&&transition_in(H,1):(H=create_if_block_3$j(),H.c(),transition_in(H,1),H.m(u,S)):H&&(group_outros(),transition_out(H,1,1,()=>{H=null}),check_outros()),(!M||J[0]&256)&&toggle_class(u,"candidate",p[46]===p[8])},i(Z){M||(transition_in(H),M=!0)},o(Z){transition_out(H),M=!1},d(Z){Z&&detach(u),H&&H.d(),E=!1,run_all(T)}}}function create_default_slot$1e(p){let u,f,m,v,y,w,k,S,M,E;function T(J){p[29](J)}let H={autofocus:!0,quiet:!0,type:"text",placeholder:p[0]?`Search by ${p[0]}`:null};p[5]!==void 0&&(H.value=p[5]),m=new Input$5({props:H}),binding_callbacks.push(()=>bind(m,"value",T));const V=[create_if_block_1$J,create_if_block_2$s],q=[];function Z(J,ae){var ie;return J[9]?0:(ie=J[7])!=null&&ie.length?1:-1}return~(w=Z(p))&&(k=q[w]=V[w](p)),{c(){u=element("div"),f=element("div"),create_component(m.$$.fragment),y=space(),k&&k.c(),attr(f,"class","search svelte-jeqj3p"),attr(u,"class","dropdown svelte-jeqj3p")},m(J,ae){insert(J,u,ae),append$2(u,f),mount_component(m,f,null),append$2(u,y),~w&&q[w].m(u,null),S=!0,M||(E=listen(u,"wheel",stop_propagation(p[25])),M=!0)},p(J,ae){const ie={};ae[0]&1&&(ie.placeholder=J[0]?`Search by ${J[0]}`:null),!v&&ae[0]&32&&(v=!0,ie.value=J[5],add_flush_callback(()=>v=!1)),m.$set(ie);let he=w;w=Z(J),w===he?~w&&q[w].p(J,ae):(k&&(group_outros(),transition_out(q[he],1,1,()=>{q[he]=null}),check_outros()),~w?(k=q[w],k?k.p(J,ae):(k=q[w]=V[w](J),k.c()),transition_in(k,1),k.m(u,null)):k=null)},i(J){S||(transition_in(m.$$.fragment,J),transition_in(k),S=!0)},o(J){transition_out(m.$$.fragment,J),transition_out(k),S=!1},d(J){J&&detach(u),destroy_component(m),~w&&q[w].d(),M=!1,E()}}}function create_fragment$2t(p){var ae;let u,f,m,v,y,w,k,S,M,E,T=ensure_array_like(p[6]||[]),H=[];for(let ie=0;ie<T.length;ie+=1)H[ie]=create_each_block_1$4(get_each_context_1$4(p,T,ie));const V=ie=>transition_out(H[ie],1,1,()=>{H[ie]=null});let q=p[12]&&create_if_block_5$b(p),Z=!p[3]&&((ae=p[6])==null?void 0:ae.length)&&create_if_block_4$d(p),J=p[4]&&create_if_block$1s(p);return{c(){u=element("div"),f=element("div"),m=element("div");for(let ie=0;ie<H.length;ie+=1)H[ie].c();v=space(),q&&q.c(),y=space(),Z&&Z.c(),w=space(),J&&J.c(),k=empty$1(),attr(m,"class","values svelte-jeqj3p"),toggle_class(m,"wrap",p[12]||p[2]>1),toggle_class(m,"disabled",!p[1]),attr(f,"class","container svelte-jeqj3p"),attr(u,"class","wrapper svelte-jeqj3p"),set_style(u,"--color",p[13]),toggle_class(u,"editable",p[12]),toggle_class(u,"focused",p[1])},m(ie,he){insert(ie,u,he),append$2(u,f),append$2(f,m);for(let fe=0;fe<H.length;fe+=1)H[fe]&&H[fe].m(m,null);append$2(m,v),q&&q.m(m,null),append$2(f,y),Z&&Z.m(f,null),p[28](u),insert(ie,w,he),J&&J.m(ie,he),insert(ie,k,he),S=!0,M||(E=listen(m,"wheel",p[27]),M=!0)},p(ie,he){var fe;if(he[0]&399425){T=ensure_array_like(ie[6]||[]);let me;for(me=0;me<T.length;me+=1){const be=get_each_context_1$4(ie,T,me);H[me]?(H[me].p(be,he),transition_in(H[me],1)):(H[me]=create_each_block_1$4(be),H[me].c(),transition_in(H[me],1),H[me].m(m,v))}for(group_outros(),me=T.length;me<H.length;me+=1)V(me);check_outros()}ie[12]?q?(q.p(ie,he),he[0]&4096&&transition_in(q,1)):(q=create_if_block_5$b(ie),q.c(),transition_in(q,1),q.m(m,null)):q&&(group_outros(),transition_out(q,1,1,()=>{q=null}),check_outros()),(!S||he[0]&4100)&&toggle_class(m,"wrap",ie[12]||ie[2]>1),(!S||he[0]&2)&&toggle_class(m,"disabled",!ie[1]),!ie[3]&&((fe=ie[6])!=null&&fe.length)?Z?Z.p(ie,he):(Z=create_if_block_4$d(ie),Z.c(),Z.m(f,null)):Z&&(Z.d(1),Z=null),(!S||he[0]&4096)&&toggle_class(u,"editable",ie[12]),(!S||he[0]&2)&&toggle_class(u,"focused",ie[1]),ie[4]?J?(J.p(ie,he),he[0]&16&&transition_in(J,1)):(J=create_if_block$1s(ie),J.c(),transition_in(J,1),J.m(k.parentNode,k)):J&&(group_outros(),transition_out(J,1,1,()=>{J=null}),check_outros())},i(ie){if(!S){for(let he=0;he<T.length;he+=1)transition_in(H[he]);transition_in(q),transition_in(J),S=!0}},o(ie){H=H.filter(Boolean);for(let he=0;he<H.length;he+=1)transition_out(H[he]);transition_out(q),transition_out(J),S=!1},d(ie){ie&&(detach(u),detach(w),detach(k)),destroy_each(H,ie),q&&q.d(),Z&&Z.d(),p[28](null),J&&J.d(ie),M=!1,E()}}}const focus_handler=()=>{};function instance$2q(p,u,f){let m,v,y,w,k;const{API:S,cache:M}=getContext$1("grid");let{value:E=[]}=u,{api:T}=u,{readonly:H}=u,{focused:V}=u,{schema:q}=u,{onChange:Z}=u,{contentLines:J=1}=u,{searchFunction:ae=S.searchTable}=u,{primaryDisplay:ie}=u,{hideCounter:he=!1}=u;const fe=OptionColours[0];let me=!1,be,Ce,ze,Se,Ie,xe=!1,Ne;const $e=Nt=>Array.isArray(Nt)&&Nt.every(kt=>kt==null?void 0:kt._id)?Nt:[],Ze=(Nt,kt)=>{let yt={};if(!kt||!(Nt!=null&&Nt.length))return yt;for(let cn=0;cn<Nt.length;cn++)yt[Nt[cn]._id]=!0;return yt},ve=Nt=>Nt!=null&&Nt._id?(w==null?void 0:w[Nt._id])===!0:!1,Re=async(Nt,kt=!1)=>{var Mn;if(!kt&&!Nt&&!ze)return;if(!(q!=null&&q.tableId)||!me){ze=null,f(8,Se=null),f(7,be=[]);return}Ie=Math.random(),f(9,xe=!0);const yt=Ie,cn=await ae(q.tableId,{paginate:!1,limit:20,query:{string:{[`1:${ie}`]:Nt||""}}});f(9,xe=!1),yt===Ie&&(f(7,be=Fe((Mn=cn.rows)==null?void 0:Mn.map(fn=>({...fn,primaryDisplay:fn[ie]})))),f(8,Se=be!=null&&be.length?0:null),ze=Nt)},Qe=debounce(Re,250),Fe=Nt=>Nt!=null&&Nt.length?Nt.slice().sort((kt,yt)=>kt.primaryDisplay<yt.primaryDisplay?-1:1):[],Je=async()=>{f(4,me=!0),ie||(f(9,xe=!0),f(0,ie=await M.actions.getPrimaryDisplayForTableId(q.tableId))),await Re(null,!0)},ft=()=>{f(4,me=!1),f(7,be=[]),f(5,Ce=null),ze=null,f(8,Se=null)},Et=Nt=>me?(Nt.key==="ArrowDown"?(Nt.preventDefault(),Se==null?f(8,Se=0):f(8,Se=Math.min(be.length-1,Se+1))):Nt.key==="ArrowUp"?(Nt.preventDefault(),Se===0?f(8,Se=null):Se!=null&&f(8,Se=Math.max(0,Se-1))):Nt.key==="Enter"&&Se!=null&&be[Se]!=null&&qe(be[Se]),!0):!1,qe=async Nt=>{if(m!=null&&m.some(kt=>kt._id===Nt._id))if(v)await Z([]);else{const kt=m.filter(yt=>yt._id!==Nt._id);kt.length?f(8,Se=Math.min(Se,kt.length-1)):f(8,Se=null),await Z(kt)}else v?await Z([Nt]):await Z(Fe([...m||[],Nt])),f(8,Se=null);ft()},Ge=Nt=>Nt==null?"":Nt instanceof Object?JSON.stringify(Nt):Nt;onMount(()=>{f(19,T={focus:Je,blur:ft,isActive:()=>me,onKeyDown:Et})});function dt(Nt){bubble.call(this,p,Nt)}const xt=Nt=>qe(Nt),ot=Nt=>V?Nt.stopPropagation():null;function jt(Nt){binding_callbacks[Nt?"unshift":"push"](()=>{Ne=Nt,f(10,Ne)})}function Xe(Nt){Ce=Nt,f(5,Ce)}const Ut=Nt=>qe(Nt),en=Nt=>f(8,Se=Nt);return p.$$set=Nt=>{"value"in Nt&&f(20,E=Nt.value),"api"in Nt&&f(19,T=Nt.api),"readonly"in Nt&&f(21,H=Nt.readonly),"focused"in Nt&&f(1,V=Nt.focused),"schema"in Nt&&f(22,q=Nt.schema),"onChange"in Nt&&f(23,Z=Nt.onChange),"contentLines"in Nt&&f(2,J=Nt.contentLines),"searchFunction"in Nt&&f(24,ae=Nt.searchFunction),"primaryDisplay"in Nt&&f(0,ie=Nt.primaryDisplay),"hideCounter"in Nt&&f(3,he=Nt.hideCounter)},p.$$.update=()=>{p.$$.dirty[0]&1048576&&f(6,m=$e(E)),p.$$.dirty[0]&4194304&&(v=(q==null?void 0:q.relationshipType)==="one-to-many"),p.$$.dirty[0]&2097154&&f(12,y=V&&!H),p.$$.dirty[0]&80&&(w=Ze(m,me)),p.$$.dirty[0]&32&&Qe(Ce),p.$$.dirty[0]&18&&!V&&me&&ft(),p.$$.dirty[0]&4194368&&f(11,k=m==null?void 0:m.reduce((Nt,kt)=>{const yt={};for(const[cn]of Object.entries((q==null?void 0:q.columns)||{}).filter(([Mn,fn])=>fn.visible!==!1&&kt[Mn]!==null&&kt[Mn]!==void 0))yt[cn]=kt[cn];return Object.keys(yt).length&&(Nt[kt._id]=yt),Nt},{}))},[ie,V,J,he,me,Ce,m,be,Se,xe,Ne,k,y,fe,ve,Je,ft,qe,Ge,T,E,H,q,Z,ae,dt,xt,ot,jt,Xe,Ut,en]}class RelationshipCell extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2q,create_fragment$2t,safe_not_equal,{value:20,api:19,readonly:21,focused:1,schema:22,onChange:23,contentLines:2,searchFunction:24,primaryDisplay:0,hideCounter:3},null,[-1,-1])}}const LongFormCell_svelte_svelte_type_style_lang="";function create_if_block$1r(p){let u,f;return u=new GridPopover({props:{anchor:p[3],$$slots:{default:[create_default_slot$1d]},$$scope:{ctx:p}}}),u.$on("close",p[7]),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&8&&(y.anchor=m[3]),v&65539&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot$1d(p){let u,f,m,v;return{c(){u=element("textarea"),u.value=f=p[0]||"",attr(u,"spellcheck","false"),attr(u,"class","svelte-w9nhoo")},m(y,w){insert(y,u,w),p[14](u),m||(v=[listen(u,"change",p[5]),listen(u,"wheel",stop_propagation(p[12])),action_destroyer(clickOutside.call(null,u,p[7]))],m=!0)},p(y,w){w&1&&f!==(f=y[0]||"")&&(u.value=f)},d(y){y&&detach(u),p[14](null),m=!1,run_all(v)}}}function create_fragment$2s(p){let u,f,m=(p[0]||"")+"",v,y,w,k,S,M,E=p[2]&&create_if_block$1r(p);return{c(){u=element("div"),f=element("div"),v=text$1(m),y=space(),E&&E.c(),w=empty$1(),attr(f,"class","value svelte-w9nhoo"),attr(u,"class","long-form-cell svelte-w9nhoo"),toggle_class(u,"editable",p[4])},m(T,H){insert(T,u,H),append$2(u,f),append$2(f,v),p[13](u),insert(T,y,H),E&&E.m(T,H),insert(T,w,H),k=!0,S||(M=listen(u,"click",function(){is_function(p[4]?p[6]:null)&&(p[4]?p[6]:null).apply(this,arguments)}),S=!0)},p(T,[H]){p=T,(!k||H&1)&&m!==(m=(p[0]||"")+"")&&set_data(v,m),(!k||H&16)&&toggle_class(u,"editable",p[4]),p[2]?E?(E.p(p,H),H&4&&transition_in(E,1)):(E=create_if_block$1r(p),E.c(),transition_in(E,1),E.m(w.parentNode,w)):E&&(group_outros(),transition_out(E,1,1,()=>{E=null}),check_outros())},i(T){k||(transition_in(E),k=!0)},o(T){transition_out(E),k=!1},d(T){T&&(detach(u),detach(y),detach(w)),p[13](null),E&&E.d(T),S=!1,M()}}}function instance$2p(p,u,f){let m,{value:v}=u,{focused:y=!1}=u,{onChange:w}=u,{readonly:k=!1}=u,{api:S}=u,M,E=!1,T;const H=he=>{w(he.target.value)},V=()=>E,q=async()=>{f(2,E=!0),await tick(),M.focus(),(v==null?void 0:v.length)>100&&M.setSelectionRange(0,0)},Z=()=>{M==null||M.blur(),f(2,E=!1)};onMount(()=>{f(8,S={focus:()=>q(),blur:()=>Z(),isActive:()=>E,onKeyDown:V})});function J(he){bubble.call(this,p,he)}function ae(he){binding_callbacks[he?"unshift":"push"](()=>{T=he,f(3,T)})}function ie(he){binding_callbacks[he?"unshift":"push"](()=>{M=he,f(1,M)})}return p.$$set=he=>{"value"in he&&f(0,v=he.value),"focused"in he&&f(9,y=he.focused),"onChange"in he&&f(10,w=he.onChange),"readonly"in he&&f(11,k=he.readonly),"api"in he&&f(8,S=he.api)},p.$$.update=()=>{p.$$.dirty&2560&&f(4,m=y&&!k),p.$$.dirty&512&&(y||f(2,E=!1))},[v,M,E,T,m,H,q,Z,S,y,w,k,J,ae,ie]}class LongFormCell extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2p,create_fragment$2s,safe_not_equal,{value:0,focused:9,onChange:10,readonly:11,api:8})}}const BooleanCell_svelte_svelte_type_style_lang="";function create_fragment$2r(p){let u,f,m;return f=new Checkbox_1({props:{value:p[0]}}),f.$on("change",p[2]),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"class","boolean-cell svelte-1l7j6r7"),toggle_class(u,"editable",p[1])},m(v,y){insert(v,u,y),mount_component(f,u,null),m=!0},p(v,[y]){const w={};y&1&&(w.value=v[0]),f.$set(w),(!m||y&2)&&toggle_class(u,"editable",v[1])},i(v){m||(transition_in(f.$$.fragment,v),m=!0)},o(v){transition_out(f.$$.fragment,v),m=!1},d(v){v&&detach(u),destroy_component(f)}}}function instance$2o(p,u,f){let m,{value:v}=u,{focused:y=!1}=u,{onChange:w}=u,{readonly:k=!1}=u,{api:S}=u;const M=T=>{w(T.detail)},E=T=>T.key==="Enter"?(w(!v),!0):!1;return onMount(()=>{f(3,S={onKeyDown:E})}),p.$$set=T=>{"value"in T&&f(0,v=T.value),"focused"in T&&f(4,y=T.focused),"onChange"in T&&f(5,w=T.onChange),"readonly"in T&&f(6,k=T.readonly),"api"in T&&f(3,S=T.api)},p.$$.update=()=>{p.$$.dirty&80&&f(1,m=y&&!k)},[v,m,M,S,y,w,k]}class BooleanCell extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2o,create_fragment$2r,safe_not_equal,{value:0,focused:4,onChange:5,readonly:6,api:3})}}function create_else_block$r(p){let u,f;const m=[p[1],{readonly:!0}];let v={};for(let y=0;y<m.length;y+=1)v=assign(v,m[y]);return u=new TextCell({props:v}),{c(){create_component(u.$$.fragment)},m(y,w){mount_component(u,y,w),f=!0},p(y,w){const k=w&2?get_spread_update(m,[get_spread_object(y[1]),m[1]]):{};u.$set(k)},i(y){f||(transition_in(u.$$.fragment,y),f=!0)},o(y){transition_out(u.$$.fragment,y),f=!1},d(y){destroy_component(u,y)}}}function create_if_block_2$r(p){let u,f;const m=[p[1],{readonly:!0}];let v={};for(let y=0;y<m.length;y+=1)v=assign(v,m[y]);return u=new DateCell({props:v}),{c(){create_component(u.$$.fragment)},m(y,w){mount_component(u,y,w),f=!0},p(y,w){const k=w&2?get_spread_update(m,[get_spread_object(y[1]),m[1]]):{};u.$set(k)},i(y){f||(transition_in(u.$$.fragment,y),f=!0)},o(y){transition_out(u.$$.fragment,y),f=!1},d(y){destroy_component(u,y)}}}function create_if_block_1$I(p){let u,f;const m=[p[1],{readonly:!0}];let v={};for(let y=0;y<m.length;y+=1)v=assign(v,m[y]);return u=new BooleanCell({props:v}),{c(){create_component(u.$$.fragment)},m(y,w){mount_component(u,y,w),f=!0},p(y,w){const k=w&2?get_spread_update(m,[get_spread_object(y[1]),m[1]]):{};u.$set(k)},i(y){f||(transition_in(u.$$.fragment,y),f=!0)},o(y){transition_out(u.$$.fragment,y),f=!1},d(y){destroy_component(u,y)}}}function create_if_block$1q(p){let u,f;const m=[p[1],{readonly:!0}];let v={};for(let y=0;y<m.length;y+=1)v=assign(v,m[y]);return u=new NumberCell({props:v}),{c(){create_component(u.$$.fragment)},m(y,w){mount_component(u,y,w),f=!0},p(y,w){const k=w&2?get_spread_update(m,[get_spread_object(y[1]),m[1]]):{};u.$set(k)},i(y){f||(transition_in(u.$$.fragment,y),f=!0)},o(y){transition_out(u.$$.fragment,y),f=!1},d(y){destroy_component(u,y)}}}function create_fragment$2q(p){let u,f,m,v;const y=[create_if_block$1q,create_if_block_1$I,create_if_block_2$r,create_else_block$r],w=[];function k(S,M){return S[0]===FieldType.NUMBER?0:S[0]===FieldType.BOOLEAN?1:S[0]===FieldType.DATETIME?2:3}return u=k(p),f=w[u]=y[u](p),{c(){f.c(),m=empty$1()},m(S,M){w[u].m(S,M),insert(S,m,M),v=!0},p(S,[M]){let E=u;u=k(S),u===E?w[u].p(S,M):(group_outros(),transition_out(w[E],1,1,()=>{w[E]=null}),check_outros(),f=w[u],f?f.p(S,M):(f=w[u]=y[u](S),f.c()),transition_in(f,1),f.m(m.parentNode,m))},i(S){v||(transition_in(f),v=!0)},o(S){transition_out(f),v=!1},d(S){S&&detach(m),w[u].d(S)}}}function instance$2n(p,u,f){let m,{schema:v}=u;return p.$$set=y=>{f(1,u=assign(assign({},u),exclude_internal_props(y))),"schema"in y&&f(2,v=y.schema)},p.$$.update=()=>{p.$$.dirty&4&&f(0,m=v.responseType)},u=exclude_internal_props(u),[m,u,v]}class FormulaCell extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2n,create_fragment$2q,safe_not_equal,{schema:2})}}const AICell_svelte_svelte_type_style_lang="";function create_if_block$1p(p){let u,f;return u=new GridPopover({props:{anchor:p[3],$$slots:{default:[create_default_slot$1c]},$$scope:{ctx:p}}}),u.$on("close",p[5]),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&8&&(y.anchor=m[3]),v&4099&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot$1c(p){let u,f,m,v;return{c(){u=element("textarea"),u.disabled=!0,u.value=f=p[0]||"",attr(u,"spellcheck","false"),attr(u,"class","svelte-13x28l0")},m(y,w){insert(y,u,w),p[10](u),m||(v=[listen(u,"wheel",stop_propagation(p[8])),action_destroyer(clickOutside.call(null,u,p[5]))],m=!0)},p(y,w){w&1&&f!==(f=y[0]||"")&&(u.value=f)},d(y){y&&detach(u),p[10](null),m=!1,run_all(v)}}}function create_fragment$2p(p){let u,f,m=(p[0]||"")+"",v,y,w,k,S,M,E=p[2]&&create_if_block$1p(p);return{c(){u=element("div"),f=element("div"),v=text$1(m),y=space(),E&&E.c(),w=empty$1(),attr(f,"class","value svelte-13x28l0"),attr(u,"class","long-form-cell svelte-13x28l0")},m(T,H){insert(T,u,H),append$2(u,f),append$2(f,v),p[9](u),insert(T,y,H),E&&E.m(T,H),insert(T,w,H),k=!0,S||(M=listen(u,"click",p[4]),S=!0)},p(T,[H]){(!k||H&1)&&m!==(m=(T[0]||"")+"")&&set_data(v,m),T[2]?E?(E.p(T,H),H&4&&transition_in(E,1)):(E=create_if_block$1p(T),E.c(),transition_in(E,1),E.m(w.parentNode,w)):E&&(group_outros(),transition_out(E,1,1,()=>{E=null}),check_outros())},i(T){k||(transition_in(E),k=!0)},o(T){transition_out(E),k=!1},d(T){T&&(detach(u),detach(y),detach(w)),p[9](null),E&&E.d(T),S=!1,M()}}}function instance$2m(p,u,f){let{value:m}=u,{focused:v=!1}=u,{api:y}=u,w,k=!1,S;const M=()=>k,E=async()=>{f(2,k=!0)},T=()=>{w==null||w.blur(),f(2,k=!1)};onMount(()=>{f(6,y={focus:()=>E(),blur:()=>T(),isActive:()=>k,onKeyDown:M})});function H(Z){bubble.call(this,p,Z)}function V(Z){binding_callbacks[Z?"unshift":"push"](()=>{S=Z,f(3,S)})}function q(Z){binding_callbacks[Z?"unshift":"push"](()=>{w=Z,f(1,w)})}return p.$$set=Z=>{"value"in Z&&f(0,m=Z.value),"focused"in Z&&f(7,v=Z.focused),"api"in Z&&f(6,y=Z.api)},p.$$.update=()=>{p.$$.dirty&128&&(v||f(2,k=!1))},[m,w,k,S,E,T,y,v,H,V,q]}class AICell extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2m,create_fragment$2p,safe_not_equal,{value:0,focused:7,api:6})}}function create_fragment$2o(p){let u,f,m;const v=[p[3],{value:p[1]},{onChange:p[2]}];function y(k){p[6](k)}let w={};for(let k=0;k<v.length;k+=1)w=assign(w,v[k]);return p[0]!==void 0&&(w.api=p[0]),u=new LongFormCell({props:w}),binding_callbacks.push(()=>bind(u,"api",y)),{c(){create_component(u.$$.fragment)},m(k,S){mount_component(u,k,S),m=!0},p(k,[S]){const M=S&14?get_spread_update(v,[S&8&&get_spread_object(k[3]),S&2&&{value:k[1]},S&4&&{onChange:k[2]}]):{};!f&&S&1&&(f=!0,M.api=k[0],add_flush_callback(()=>f=!1)),u.$set(M)},i(k){m||(transition_in(u.$$.fragment,k),m=!0)},o(k){transition_out(u.$$.fragment,k),m=!1},d(k){destroy_component(u,k)}}}function instance$2l(p,u,f){let m,{onChange:v}=u,{value:y}=u,{api:w}=u;const k=E=>{if(!E)return E;try{return JSON.stringify(E,null,2)}catch{return null}},S=E=>{const T=E==null?void 0:E.trim();if(!T){v(null);return}try{const H=JSON.parse(T);v(H)}catch{}};function M(E){w=E,f(0,w)}return p.$$set=E=>{f(3,u=assign(assign({},u),exclude_internal_props(E))),"onChange"in E&&f(4,v=E.onChange),"value"in E&&f(5,y=E.value),"api"in E&&f(0,w=E.api)},p.$$.update=()=>{p.$$.dirty&32&&f(1,m=k(y))},u=exclude_internal_props(u),[w,m,S,u,v,y,M]}class JSONCell extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2l,create_fragment$2o,safe_not_equal,{onChange:4,value:5,api:0})}}const AttachmentCell_svelte_svelte_type_style_lang="";function get_each_context$t(p,u,f){const m=p.slice();return m[24]=u[f],m}function create_else_block$q(p){let u,f=p[24].extension+"",m,v,y;return{c(){u=element("div"),m=text$1(f),v=space(),attr(u,"class","file svelte-1iu2dac"),attr(u,"title",y=p[24].name)},m(w,k){insert(w,u,k),append$2(u,m),append$2(u,v)},p(w,k){k&1&&f!==(f=w[24].extension+"")&&set_data(m,f),k&1&&y!==(y=w[24].name)&&attr(u,"title",y)},d(w){w&&detach(u)}}}function create_if_block_1$H(p){let u,f,m;return{c(){var v;u=element("img"),src_url_equal(u.src,f=p[24].url)||attr(u,"src",f),attr(u,"alt",m=p[24].extension),attr(u,"class","svelte-1iu2dac"),toggle_class(u,"light",!((v=p[7])!=null&&v.darkMode)&&p[2].type===FieldType.SIGNATURE_SINGLE)},m(v,y){insert(v,u,y)},p(v,y){var w;y&1&&!src_url_equal(u.src,f=v[24].url)&&attr(u,"src",f),y&1&&m!==(m=v[24].extension)&&attr(u,"alt",m),y&132&&toggle_class(u,"light",!((w=v[7])!=null&&w.darkMode)&&v[2].type===FieldType.SIGNATURE_SINGLE)},d(v){v&&detach(u)}}}function create_each_block$t(p){let u,f;function m(w,k){return k&1&&(u=null),u==null&&(u=!!w[12](w[24].extension)),u?create_if_block_1$H:create_else_block$q}let v=m(p,-1),y=v(p);return{c(){y.c(),f=empty$1()},m(w,k){y.m(w,k),insert(w,f,k)},p(w,k){v===(v=m(w,k))&&y?y.p(w,k):(y.d(1),y=v(w),y&&(y.c(),y.m(f.parentNode,f)))},d(w){w&&detach(f),y.d(w)}}}function create_if_block$1o(p){let u,f;return u=new GridPopover({props:{open:p[4],anchor:p[5],maxHeight:null,$$slots:{default:[create_default_slot$1b]},$$scope:{ctx:p}}}),u.$on("close",p[11]),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&16&&(y.open=m[4]),v&32&&(y.anchor=m[5]),v&134217871&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot$1b(p){var v,y;let u,f,m;return f=new Dropzone({props:{value:p[0],compact:!0,maximum:p[3]||((y=(v=p[2].constraints)==null?void 0:v.length)==null?void 0:y.maximum),processFiles:p[14],handleFileTooLarge:p[7].isCloud?p[13]:null}}),f.$on("change",p[19]),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"class","dropzone svelte-1iu2dac")},m(w,k){insert(w,u,k),mount_component(f,u,null),m=!0},p(w,k){var M,E;const S={};k&1&&(S.value=w[0]),k&12&&(S.maximum=w[3]||((E=(M=w[2].constraints)==null?void 0:M.length)==null?void 0:E.maximum)),k&128&&(S.handleFileTooLarge=w[7].isCloud?w[13]:null),f.$set(S)},i(w){m||(transition_in(f.$$.fragment,w),m=!0)},o(w){transition_out(f.$$.fragment,w),m=!1},d(w){w&&detach(u),destroy_component(f)}}}function create_fragment$2n(p){let u,f,m,v,y,w,k=ensure_array_like(p[0]||[]),S=[];for(let E=0;E<k.length;E+=1)S[E]=create_each_block$t(get_each_context$t(p,k,E));let M=p[4]&&create_if_block$1o(p);return{c(){u=element("div");for(let E=0;E<S.length;E+=1)S[E].c();f=space(),M&&M.c(),m=empty$1(),attr(u,"class","attachment-cell svelte-1iu2dac"),toggle_class(u,"editable",p[6])},m(E,T){insert(E,u,T);for(let H=0;H<S.length;H+=1)S[H]&&S[H].m(u,null);p[18](u),insert(E,f,T),M&&M.m(E,T),insert(E,m,T),v=!0,y||(w=listen(u,"click",function(){is_function(p[6]?p[10]:null)&&(p[6]?p[10]:null).apply(this,arguments)}),y=!0)},p(E,[T]){if(p=E,T&4229){k=ensure_array_like(p[0]||[]);let H;for(H=0;H<k.length;H+=1){const V=get_each_context$t(p,k,H);S[H]?S[H].p(V,T):(S[H]=create_each_block$t(V),S[H].c(),S[H].m(u,null))}for(;H<S.length;H+=1)S[H].d(1);S.length=k.length}(!v||T&64)&&toggle_class(u,"editable",p[6]),p[4]?M?(M.p(p,T),T&16&&transition_in(M,1)):(M=create_if_block$1o(p),M.c(),transition_in(M,1),M.m(m.parentNode,m)):M&&(group_outros(),transition_out(M,1,1,()=>{M=null}),check_outros())},i(E){v||(transition_in(M),v=!0)},o(E){transition_out(M),v=!1},d(E){E&&(detach(u),detach(f),detach(m)),destroy_each(S,E),p[18](null),M&&M.d(E),y=!1,w()}}}function instance$2k(p,u,f){let m,v,y,{value:w}=u,{focused:k=!1}=u,{onChange:S}=u,{readonly:M=!1}=u,{api:E}=u,{schema:T}=u,{maximum:H}=u;const{API:V,notifications:q,props:Z}=getContext$1("grid");component_subscribe(p,q,xe=>f(20,v=xe)),component_subscribe(p,Z,xe=>f(7,y=xe));const J=["png","tiff","gif","raw","jpg","jpeg"];let ae=!1,ie;const he=()=>ae,fe=()=>{f(4,ae=!0)},me=()=>{f(4,ae=!1)},be=xe=>J.includes(xe==null?void 0:xe.toLowerCase()),Ce=xe=>{v.error(`Files cannot exceed ${xe/1e6}MB. Please try again with smaller files.`)},ze=async xe=>{let Ne=new FormData;for(let $e=0;$e<xe.length;$e++)Ne.append("file",xe[$e]);try{return await V.uploadBuilderAttachment(Ne)}catch($e){return v.error($e.message||"Failed to upload attachment"),[]}};onMount(()=>{f(15,E={focus:()=>fe(),blur:()=>me(),isActive:()=>ae,onKeyDown:he})});function Se(xe){binding_callbacks[xe?"unshift":"push"](()=>{ie=xe,f(5,ie)})}const Ie=xe=>S(xe.detail);return p.$$set=xe=>{"value"in xe&&f(0,w=xe.value),"focused"in xe&&f(16,k=xe.focused),"onChange"in xe&&f(1,S=xe.onChange),"readonly"in xe&&f(17,M=xe.readonly),"api"in xe&&f(15,E=xe.api),"schema"in xe&&f(2,T=xe.schema),"maximum"in xe&&f(3,H=xe.maximum)},p.$$.update=()=>{p.$$.dirty&196608&&f(6,m=k&&!M),p.$$.dirty&65536&&(k||me())},[w,S,T,H,ae,ie,m,y,q,Z,fe,me,be,Ce,ze,E,k,M,Se,Ie]}class AttachmentCell extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2k,create_fragment$2n,safe_not_equal,{value:0,focused:16,onChange:1,readonly:17,api:15,schema:2,maximum:3})}}function create_fragment$2m(p){let u,f,m;const v=[p[3],{maximum:1},{value:p[2]},{onChange:p[1]}];function y(k){p[6](k)}let w={};for(let k=0;k<v.length;k+=1)w=assign(w,v[k]);return p[0]!==void 0&&(w.api=p[0]),u=new AttachmentCell({props:w}),binding_callbacks.push(()=>bind(u,"api",y)),{c(){create_component(u.$$.fragment)},m(k,S){mount_component(u,k,S),m=!0},p(k,[S]){const M=S&14?get_spread_update(v,[S&8&&get_spread_object(k[3]),v[1],S&4&&{value:k[2]},S&2&&{onChange:k[1]}]):{};!f&&S&1&&(f=!0,M.api=k[0],add_flush_callback(()=>f=!1)),u.$set(M)},i(k){m||(transition_in(u.$$.fragment,k),m=!0)},o(k){transition_out(u.$$.fragment,k),m=!1},d(k){destroy_component(u,k)}}}function instance$2j(p,u,f){let m,v;const y=["value","onChange","api"];let w=compute_rest_props(u,y),{value:k}=u,{onChange:S}=u,{api:M}=u;function E(T){M=T,f(0,M)}return p.$$set=T=>{u=assign(assign({},u),exclude_internal_props(T)),f(3,w=compute_rest_props(u,y)),"value"in T&&f(4,k=T.value),"onChange"in T&&f(5,S=T.onChange),"api"in T&&f(0,M=T.api)},p.$$.update=()=>{p.$$.dirty&32&&f(1,v=T=>{T=T[0]||null,S(T)}),p.$$.dirty&16&&f(2,m=(!Array.isArray(k)&&k?[k]:k)||[])},[M,v,m,w,k,S,E]}class AttachmentSingleCell extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2j,create_fragment$2m,safe_not_equal,{value:4,onChange:5,api:0})}}function create_fragment$2l(p){let u,f,m;const v=[p[4],{schema:p[0]},{searchFunction:p[3]},{primaryDisplay:"email"},{hideCounter:p[2]}];function y(k){p[5](k)}let w={};for(let k=0;k<v.length;k+=1)w=assign(w,v[k]);return p[1]!==void 0&&(w.api=p[1]),u=new RelationshipCell({props:w}),binding_callbacks.push(()=>bind(u,"api",y)),{c(){create_component(u.$$.fragment)},m(k,S){mount_component(u,k,S),m=!0},p(k,[S]){const M=S&29?get_spread_update(v,[S&16&&get_spread_object(k[4]),S&1&&{schema:k[0]},S&8&&{searchFunction:k[3]},v[3],S&4&&{hideCounter:k[2]}]):{};!f&&S&2&&(f=!0,M.api=k[1],add_flush_callback(()=>f=!1)),u.$set(M)},i(k){m||(transition_in(u.$$.fragment,k),m=!0)},o(k){transition_out(u.$$.fragment,k),m=!1},d(k){destroy_component(u,k)}}}function instance$2i(p,u,f){const m=["api","hideCounter","schema"];let v=compute_rest_props(u,m),{api:y}=u,{hideCounter:w=!1}=u,{schema:k}=u;const{API:S}=getContext$1("grid"),{type:M,subtype:E}=k;async function T(V,q){if(E!==BBReferenceFieldSubType.USER&&E!==BBReferenceFieldSubType.USERS)throw`Search for '${E}' not implemented`;const Z=Object.values(q.query.string)[0],J=await S.searchUsers({query:{string:{email:Z}}});return{...J,data:void 0,rows:J.data}}function H(V){y=V,f(1,y)}return p.$$set=V=>{f(9,u=assign(assign({},u),exclude_internal_props(V))),f(4,v=compute_rest_props(u,m)),"api"in V&&f(1,y=V.api),"hideCounter"in V&&f(2,w=V.hideCounter),"schema"in V&&f(0,k=V.schema)},p.$$.update=()=>{f(0,k={...u.schema,tableId:"external",relationshipType:M===FieldType.BB_REFERENCE_SINGLE||isDeprecatedSingleUserColumn(k)?RelationshipType.ONE_TO_MANY:RelationshipType.MANY_TO_MANY})},u=exclude_internal_props(u),[k,y,w,T,v,H]}class BBReferenceCell extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2i,create_fragment$2l,safe_not_equal,{api:1,hideCounter:2,schema:0})}}const SignatureCell_svelte_svelte_type_style_lang="";function create_if_block_2$q(p){let u,f;return{c(){var m;u=element("img"),src_url_equal(u.src,f=(m=p[1])==null?void 0:m.url)||attr(u,"src",f),attr(u,"class","svelte-34a6jk")},m(m,v){insert(m,u,v)},p(m,v){var y;v&2&&!src_url_equal(u.src,f=(y=m[1])==null?void 0:y.url)&&attr(u,"src",f)},d(m){m&&detach(u)}}}function create_if_block$1n(p){let u,f;return u=new GridPopover({props:{open:p[2],anchor:p[4],maxHeight:null,$$slots:{default:[create_default_slot$1a]},$$scope:{ctx:p}}}),u.$on("close",p[10]),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&4&&(y.open=m[2]),v&16&&(y.anchor=m[4]),v&8388682&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_else_block$p(p){let u,f,m;return f=new ActionButton({props:{fullWidth:!0,$$slots:{default:[create_default_slot_1$x]},$$scope:{ctx:p}}}),f.$on("click",p[19]),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"class","add-signature")},m(v,y){insert(v,u,y),mount_component(f,u,null),m=!0},p(v,y){const w={};y&8388608&&(w.$$scope={dirty:y,ctx:v}),f.$set(w)},i(v){m||(transition_in(f.$$.fragment,v),m=!0)},o(v){transition_out(f.$$.fragment,v),m=!1},d(v){v&&detach(u),destroy_component(f)}}}function create_if_block_1$G(p){let u,f,m;return f=new Signature({props:{darkMode:p[6].darkMode,editable:!1,value:p[1]}}),f.$on("change",p[12]),f.$on("clear",p[11]),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"class","signature-wrap svelte-34a6jk")},m(v,y){insert(v,u,y),mount_component(f,u,null),m=!0},p(v,y){const w={};y&64&&(w.darkMode=v[6].darkMode),y&2&&(w.value=v[1]),f.$set(w)},i(v){m||(transition_in(f.$$.fragment,v),m=!0)},o(v){transition_out(f.$$.fragment,v),m=!1},d(v){v&&detach(u),destroy_component(f)}}}function create_default_slot_1$x(p){let u;return{c(){u=text$1("Add signature")},m(f,m){insert(f,u,m)},d(f){f&&detach(u)}}}function create_default_slot$1a(p){let u,f,m,v;const y=[create_if_block_1$G,create_else_block$p],w=[];function k(S,M){var E;return(E=S[1])!=null&&E.key?0:1}return f=k(p),m=w[f]=y[f](p),{c(){u=element("div"),m.c(),attr(u,"class","signature svelte-34a6jk"),toggle_class(u,"empty",!p[1])},m(S,M){insert(S,u,M),w[f].m(u,null),v=!0},p(S,M){let E=f;f=k(S),f===E?w[f].p(S,M):(group_outros(),transition_out(w[E],1,1,()=>{w[E]=null}),check_outros(),m=w[f],m?m.p(S,M):(m=w[f]=y[f](S),m.c()),transition_in(m,1),m.m(u,null)),(!v||M&2)&&toggle_class(u,"empty",!S[1])},i(S){v||(transition_in(m),v=!0)},o(S){transition_out(m),v=!1},d(S){S&&detach(u),w[f].d()}}}function create_fragment$2k(p){var H,V;let u,f,m,v,y,w,k,S,M=((H=p[1])==null?void 0:H.url)&&create_if_block_2$q(p),E={onConfirm:p[12],title:(V=p[0])==null?void 0:V.name,value:p[1],darkMode:p[6].darkMode};m=new SignatureModal({props:E}),p[18](m);let T=p[2]&&create_if_block$1n(p);return{c(){var q;u=element("div"),M&&M.c(),f=space(),create_component(m.$$.fragment),v=space(),T&&T.c(),y=empty$1(),attr(u,"class","signature-cell svelte-34a6jk"),toggle_class(u,"light",!((q=p[6])!=null&&q.darkMode)),toggle_class(u,"editable",p[5])},m(q,Z){insert(q,u,Z),M&&M.m(u,null),p[17](u),insert(q,f,Z),mount_component(m,q,Z),insert(q,v,Z),T&&T.m(q,Z),insert(q,y,Z),w=!0,k||(S=listen(u,"click",function(){is_function(p[5]?p[9]:null)&&(p[5]?p[9]:null).apply(this,arguments)}),k=!0)},p(q,[Z]){var ae,ie,he;p=q,(ae=p[1])!=null&&ae.url?M?M.p(p,Z):(M=create_if_block_2$q(p),M.c(),M.m(u,null)):M&&(M.d(1),M=null),(!w||Z&64)&&toggle_class(u,"light",!((ie=p[6])!=null&&ie.darkMode)),(!w||Z&32)&&toggle_class(u,"editable",p[5]);const J={};Z&1&&(J.title=(he=p[0])==null?void 0:he.name),Z&2&&(J.value=p[1]),Z&64&&(J.darkMode=p[6].darkMode),m.$set(J),p[2]?T?(T.p(p,Z),Z&4&&transition_in(T,1)):(T=create_if_block$1n(p),T.c(),transition_in(T,1),T.m(y.parentNode,y)):T&&(group_outros(),transition_out(T,1,1,()=>{T=null}),check_outros())},i(q){w||(transition_in(m.$$.fragment,q),transition_in(T),w=!0)},o(q){transition_out(m.$$.fragment,q),transition_out(T),w=!1},d(q){q&&(detach(u),detach(f),detach(v),detach(y)),M&&M.d(),p[17](null),p[18](null),destroy_component(m,q),T&&T.d(q),k=!1,S()}}}function instance$2h(p,u,f){let m,v,y,{schema:w}=u,{value:k}=u,{focused:S=!1}=u,{onChange:M}=u,{readonly:E=!1}=u,{api:T}=u;const{API:H,notifications:V,props:q}=getContext$1("grid");component_subscribe(p,V,Ie=>f(20,v=Ie)),component_subscribe(p,q,Ie=>f(6,y=Ie));let Z=!1,J,ae;const ie=()=>!1,he=()=>{f(2,Z=!0)},fe=()=>{f(2,Z=!1)},me=async()=>{M(null)},be=async Ie=>{const xe=Ie.toFile();let Ne=new FormData;Ne.append("file",xe);try{const $e=await H.uploadBuilderAttachment(Ne),[Ze]=$e;M(Ze)}catch($e){return v.error($e.message||"Failed to save signature"),[]}};onMount(()=>{f(13,T={focus:()=>he(),blur:()=>fe(),isActive:()=>Z,onKeyDown:ie})});function Ce(Ie){binding_callbacks[Ie?"unshift":"push"](()=>{ae=Ie,f(4,ae)})}function ze(Ie){binding_callbacks[Ie?"unshift":"push"](()=>{J=Ie,f(3,J)})}const Se=()=>{J.show()};return p.$$set=Ie=>{"schema"in Ie&&f(0,w=Ie.schema),"value"in Ie&&f(1,k=Ie.value),"focused"in Ie&&f(14,S=Ie.focused),"onChange"in Ie&&f(15,M=Ie.onChange),"readonly"in Ie&&f(16,E=Ie.readonly),"api"in Ie&&f(13,T=Ie.api)},p.$$.update=()=>{p.$$.dirty&81920&&f(5,m=S&&!E),p.$$.dirty&16384&&(S||fe())},[w,k,Z,J,ae,m,y,V,q,he,fe,me,be,T,S,M,E,Ce,ze,Se]}class SignatureCell extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2h,create_fragment$2k,safe_not_equal,{schema:0,value:1,focused:14,onChange:15,readonly:16,api:13})}}function create_fragment$2j(p){let u,f,m;const v=[p[3],{value:p[2]},{onChange:p[1]},{hideCounter:!0}];function y(k){p[6](k)}let w={};for(let k=0;k<v.length;k+=1)w=assign(w,v[k]);return p[0]!==void 0&&(w.api=p[0]),u=new BBReferenceCell({props:w}),binding_callbacks.push(()=>bind(u,"api",y)),{c(){create_component(u.$$.fragment)},m(k,S){mount_component(u,k,S),m=!0},p(k,[S]){const M=S&14?get_spread_update(v,[S&8&&get_spread_object(k[3]),S&4&&{value:k[2]},S&2&&{onChange:k[1]},v[3]]):{};!f&&S&1&&(f=!0,M.api=k[0],add_flush_callback(()=>f=!1)),u.$set(M)},i(k){m||(transition_in(u.$$.fragment,k),m=!0)},o(k){transition_out(u.$$.fragment,k),m=!1},d(k){destroy_component(u,k)}}}function instance$2g(p,u,f){let m,v;const y=["value","onChange","api"];let w=compute_rest_props(u,y),{value:k}=u,{onChange:S}=u,{api:M}=u;function E(T){M=T,f(0,M)}return p.$$set=T=>{u=assign(assign({},u),exclude_internal_props(T)),f(3,w=compute_rest_props(u,y)),"value"in T&&f(4,k=T.value),"onChange"in T&&f(5,S=T.onChange),"api"in T&&f(0,M=T.api)},p.$$.update=()=>{p.$$.dirty&32&&f(1,v=T=>{T=T[0]||null,S(T)}),p.$$.dirty&16&&f(2,m=(!Array.isArray(k)&&k?[k]:k)||[])},[M,v,m,w,k,S,E]}class BBReferenceSingleCell extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2g,create_fragment$2j,safe_not_equal,{value:4,onChange:5,api:0})}}const RoleCell_svelte_svelte_type_style_lang="";function create_fragment$2i(p){var M,E,T,H,V;let u,f,m,v,y,w=(((E=(M=p[0])==null?void 0:M.uiMetadata)==null?void 0:E.displayName)||((T=p[0])==null?void 0:T.name)||"Unknown role")+"",k,S;return m=new StatusLight({props:{square:!0,size:"L",color:((V=(H=p[0])==null?void 0:H.uiMetadata)==null?void 0:V.color)||"var(--spectrum-global-color-static-magenta-400)"}}),{c(){u=element("div"),f=element("div"),create_component(m.$$.fragment),v=space(),y=element("div"),k=text$1(w),attr(f,"class","light svelte-7aaju2"),attr(y,"class","value svelte-7aaju2"),attr(u,"class","role-cell svelte-7aaju2")},m(q,Z){insert(q,u,Z),append$2(u,f),mount_component(m,f,null),append$2(u,v),append$2(u,y),append$2(y,k),S=!0},p(q,[Z]){var ae,ie,he,fe,me;const J={};Z&1&&(J.color=((ie=(ae=q[0])==null?void 0:ae.uiMetadata)==null?void 0:ie.color)||"var(--spectrum-global-color-static-magenta-400)"),m.$set(J),(!S||Z&1)&&w!==(w=(((fe=(he=q[0])==null?void 0:he.uiMetadata)==null?void 0:fe.displayName)||((me=q[0])==null?void 0:me.name)||"Unknown role")+"")&&set_data(k,w)},i(q){S||(transition_in(m.$$.fragment,q),S=!0)},o(q){transition_out(m.$$.fragment,q),S=!1},d(q){q&&detach(u),destroy_component(m)}}}function instance$2f(p,u,f){let m,{value:v}=u,{schema:y}=u;return p.$$set=w=>{"value"in w&&f(1,v=w.value),"schema"in w&&f(2,y=w.schema)},p.$$.update=()=>{var w;p.$$.dirty&6&&f(0,m=(w=y.roles)==null?void 0:w.find(k=>k._id===v))},[m,v,y]}class RoleCell extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2f,create_fragment$2i,safe_not_equal,{value:1,schema:2})}}const TypeComponentMap={[FieldType.STRING]:TextCell,[FieldType.OPTIONS]:OptionsCell,[FieldType.DATETIME]:DateCell,[FieldType.BARCODEQR]:TextCell,[FieldType.SIGNATURE_SINGLE]:SignatureCell,[FieldType.LONGFORM]:LongFormCell,[FieldType.ARRAY]:MultiSelectCell,[FieldType.NUMBER]:NumberCell,[FieldType.BOOLEAN]:BooleanCell,[FieldType.ATTACHMENTS]:AttachmentCell,[FieldType.ATTACHMENT_SINGLE]:AttachmentSingleCell,[FieldType.LINK]:RelationshipCell,[FieldType.FORMULA]:FormulaCell,[FieldType.AI]:AICell,[FieldType.JSON]:JSONCell,[FieldType.BB_REFERENCE]:BBReferenceCell,[FieldType.BB_REFERENCE_SINGLE]:BBReferenceSingleCell,role:RoleCell},getCellRenderer=p=>{var u,f;return p.calculationType?NumberCell:TypeComponentMap[(u=p==null?void 0:p.schema)==null?void 0:u.cellRenderType]||TypeComponentMap[(f=p==null?void 0:p.schema)==null?void 0:f.type]||TextCell};function create_default_slot$19(p){let u,f,m,v;function y(E){p[30](E)}var w=getCellRenderer(p[6]);function k(E,T){let H={value:E[7][E[6].name],schema:E[6].schema,onChange:E[22].setValue,focused:E[4],readonly:E[13],contentLines:E[9]};return E[12]!==void 0&&(H.api=E[12]),{props:H}}w&&(u=construct_svelte_component(w,k(p)),binding_callbacks.push(()=>bind(u,"api",y)));const S=p[29].default,M=create_slot(S,p,p[32],null);return{c(){u&&create_component(u.$$.fragment),m=space(),M&&M.c()},m(E,T){u&&mount_component(u,E,T),insert(E,m,T),M&&M.m(E,T),v=!0},p(E,T){if(T[0]&64&&w!==(w=getCellRenderer(E[6]))){if(u){group_outros();const H=u;transition_out(H.$$.fragment,1,0,()=>{destroy_component(H,1)}),check_outros()}w?(u=construct_svelte_component(w,k(E)),binding_callbacks.push(()=>bind(u,"api",y)),create_component(u.$$.fragment),transition_in(u.$$.fragment,1),mount_component(u,m.parentNode,m)):u=null}else if(w){const H={};T[0]&192&&(H.value=E[7][E[6].name]),T[0]&64&&(H.schema=E[6].schema),T[0]&16&&(H.focused=E[4]),T[0]&8192&&(H.readonly=E[13]),T[0]&512&&(H.contentLines=E[9]),!f&&T[0]&4096&&(f=!0,H.api=E[12],add_flush_callback(()=>f=!1)),u.$set(H)}M&&M.p&&(!v||T[1]&2)&&update_slot_base(M,S,E,E[32],v?get_slot_changes(S,E[32],T,null):get_all_dirty_from_scope(E[32]),null)},i(E){v||(u&&transition_in(u.$$.fragment,E),transition_in(M,E),v=!0)},o(E){u&&transition_out(u.$$.fragment,E),transition_out(M,E),v=!1},d(E){E&&detach(m),u&&destroy_component(u,E),M&&M.d(E)}}}function create_fragment$2h(p){var m,v;let u,f;return u=new GridCell({props:{highlighted:p[0],rowIdx:p[2],topRow:p[3],focused:p[4],selectedUser:p[5],readonly:p[13],hidden:p[10],selected:p[1]||p[11],error:p[17],width:p[6].width,metadata:{...(m=p[7].__metadata)==null?void 0:m.row,...(v=p[7].__metadata)==null?void 0:v.cell[p[6].name]},$$slots:{default:[create_default_slot$19]},$$scope:{ctx:p}}}),u.$on("contextmenu",p[31]),u.$on("mousedown",p[23]),u.$on("mouseenter",function(){is_function(p[15])&&p[15].apply(this,arguments)}),u.$on("mouseup",function(){is_function(p[14])&&p[14].apply(this,arguments)}),u.$on("click",p[24]),{c(){create_component(u.$$.fragment)},m(y,w){mount_component(u,y,w),f=!0},p(y,w){var S,M;p=y;const k={};w[0]&1&&(k.highlighted=p[0]),w[0]&4&&(k.rowIdx=p[2]),w[0]&8&&(k.topRow=p[3]),w[0]&16&&(k.focused=p[4]),w[0]&32&&(k.selectedUser=p[5]),w[0]&8192&&(k.readonly=p[13]),w[0]&1024&&(k.hidden=p[10]),w[0]&2050&&(k.selected=p[1]||p[11]),w[0]&131072&&(k.error=p[17]),w[0]&64&&(k.width=p[6].width),w[0]&192&&(k.metadata={...(S=p[7].__metadata)==null?void 0:S.row,...(M=p[7].__metadata)==null?void 0:M.cell[p[6].name]}),w[0]&13008|w[1]&2&&(k.$$scope={dirty:w,ctx:p}),u.$set(k)},i(y){f||(transition_in(u.$$.fragment,y),f=!0)},o(y){transition_out(u.$$.fragment,y),f=!1},d(y){destroy_component(u,y)}}}function instance$2e(p,u,f){let m,v,y,w,k,S,M,E,T=noop$2,H=()=>(T(),T=subscribe(m,yt=>f(17,E=yt)),m);p.$$.on_destroy.push(()=>T());let{$$slots:V={},$$scope:q}=u;const{rows:Z,columns:J,focusedCellId:ae,focusedCellAPI:ie,menu:he,config:fe,validation:me,selectedCells:be,selectedCellCount:Ce}=getContext$1("grid");component_subscribe(p,ae,yt=>f(34,S=yt)),component_subscribe(p,fe,yt=>f(28,M=yt)),component_subscribe(p,Ce,yt=>f(33,k=yt));let{highlighted:ze}=u,{rowFocused:Se}=u,{rowSelected:Ie}=u,{rowIdx:xe}=u,{topRow:Ne=!1}=u,{focused:$e}=u,{selectedUser:Ze}=u,{column:ve}=u,{row:Re}=u,{cellId:Qe}=u,{updateValue:Fe=Z.actions.updateValue}=u,{contentLines:Je=1}=u,{hidden:ft=!1}=u,{isSelectingCells:Et=!1}=u,{cellSelected:qe=!1}=u;const Ge=writable(null);let dt;const xt=(yt,cn)=>yt?derived(me,Mn=>Mn[cn]):Ge,ot={focus:()=>{var yt;return(yt=dt==null?void 0:dt.focus)==null?void 0:yt.call(dt)},blur:()=>{var yt;return(yt=dt==null?void 0:dt.blur)==null?void 0:yt.call(dt)},isActive:()=>{var yt;return((yt=dt==null?void 0:dt.isActive)==null?void 0:yt.call(dt))??!1},onKeyDown:(...yt)=>{var cn;return(cn=dt==null?void 0:dt.onKeyDown)==null?void 0:cn.call(dt,...yt)},isReadonly:()=>v,getType:()=>ve.schema.type,getValue:()=>Re[ve.name],setValue:(yt,cn={apply:!0})=>{me.actions.setError(Qe,null),Fe({rowId:Re._id,column:ve.name,value:yt,apply:cn==null?void 0:cn.apply})}},jt=yt=>{yt.button!==0||yt.shiftKey||be.actions.startSelecting(Qe)},Xe=yt=>{if(yt.buttons!==1){be.actions.stopSelecting();return}be.actions.updateTarget(Qe)},Ut=()=>{be.actions.stopSelecting()},en=yt=>{yt.shiftKey&&S?be.actions.selectRange(S,Qe):yt.shiftKey&&k?be.actions.updateTarget(Qe):ae.set(Qe)};function Nt(yt){dt=yt,f(12,dt)}const kt=yt=>he.actions.open(Qe,yt);return p.$$set=yt=>{"highlighted"in yt&&f(0,ze=yt.highlighted),"rowFocused"in yt&&f(25,Se=yt.rowFocused),"rowSelected"in yt&&f(1,Ie=yt.rowSelected),"rowIdx"in yt&&f(2,xe=yt.rowIdx),"topRow"in yt&&f(3,Ne=yt.topRow),"focused"in yt&&f(4,$e=yt.focused),"selectedUser"in yt&&f(5,Ze=yt.selectedUser),"column"in yt&&f(6,ve=yt.column),"row"in yt&&f(7,Re=yt.row),"cellId"in yt&&f(8,Qe=yt.cellId),"updateValue"in yt&&f(26,Fe=yt.updateValue),"contentLines"in yt&&f(9,Je=yt.contentLines),"hidden"in yt&&f(10,ft=yt.hidden),"isSelectingCells"in yt&&f(27,Et=yt.isSelectingCells),"cellSelected"in yt&&f(11,qe=yt.cellSelected),"$$scope"in yt&&f(32,q=yt.$$scope)},p.$$.update=()=>{p.$$.dirty[0]&33554688&&H(f(16,m=xt(Se,Qe))),p.$$.dirty[0]&268435648&&f(13,v=J.actions.isReadonly(ve)||!M.canEditRows&&!Re._isNewRow),p.$$.dirty[0]&16&&$e&&ie.set(ot),p.$$.dirty[0]&134217728&&f(15,y=Et?Xe:null),p.$$.dirty[0]&134217728&&f(14,w=Et?Ut:null)},[ze,Ie,xe,Ne,$e,Ze,ve,Re,Qe,Je,ft,qe,dt,v,w,y,m,E,ae,he,fe,Ce,ot,jt,en,Se,Fe,Et,M,V,Nt,kt,q]}class DataCell extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2e,create_fragment$2h,safe_not_equal,{highlighted:0,rowFocused:25,rowSelected:1,rowIdx:2,topRow:3,focused:4,selectedUser:5,column:6,row:7,cellId:8,updateValue:26,contentLines:9,hidden:10,isSelectingCells:27,cellSelected:11},null,[-1,-1])}}const GridRow_svelte_svelte_type_style_lang="";function get_each_context$s(p,u,f){const m=p.slice();m[38]=u[f];const v=getCellID(m[0]._id,m[38].name);return m[39]=v,m}function create_each_block$s(p){let u,f;return u=new DataCell({props:{cellId:p[39],column:p[38],row:p[0],rowFocused:p[5],rowSelected:p[7],cellSelected:p[10][p[39]],highlighted:p[6]||p[5]||p[4]===p[38].name,rowIdx:p[0].__idx,topRow:p[1],focused:p[11]===p[39],selectedUser:p[12][p[39]],width:p[38].width,contentLines:p[13],hidden:!p[14][p[38].name],isSelectingCells:p[2]}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&513&&(y.cellId=m[39]),v[0]&512&&(y.column=m[38]),v[0]&1&&(y.row=m[0]),v[0]&32&&(y.rowFocused=m[5]),v[0]&128&&(y.rowSelected=m[7]),v[0]&1537&&(y.cellSelected=m[10][m[39]]),v[0]&624&&(y.highlighted=m[6]||m[5]||m[4]===m[38].name),v[0]&1&&(y.rowIdx=m[0].__idx),v[0]&2&&(y.topRow=m[1]),v[0]&2561&&(y.focused=m[11]===m[39]),v[0]&4609&&(y.selectedUser=m[12][m[39]]),v[0]&512&&(y.width=m[38].width),v[0]&8192&&(y.contentLines=m[13]),v[0]&16896&&(y.hidden=!m[14][m[38].name]),v[0]&4&&(y.isSelectingCells=m[2]),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_fragment$2g(p){let u,f,m,v,y=ensure_array_like(p[9]),w=[];for(let S=0;S<y.length;S+=1)w[S]=create_each_block$s(get_each_context$s(p,y,S));const k=S=>transition_out(w[S],1,1,()=>{w[S]=null});return{c(){u=element("div");for(let S=0;S<w.length;S+=1)w[S].c();attr(u,"class","row svelte-1507qm8")},m(S,M){insert(S,u,M);for(let E=0;E<w.length;E+=1)w[E]&&w[E].m(u,null);f=!0,m||(v=[listen(u,"focus",p[34]),listen(u,"mouseenter",function(){is_function(p[8]?null:p[35])&&(p[8]?null:p[35]).apply(this,arguments)}),listen(u,"mouseleave",function(){is_function(p[8]?null:p[36])&&(p[8]?null:p[36]).apply(this,arguments)}),listen(u,"click",p[37])],m=!0)},p(S,M){if(p=S,M[0]&32503){y=ensure_array_like(p[9]);let E;for(E=0;E<y.length;E+=1){const T=get_each_context$s(p,y,E);w[E]?(w[E].p(T,M),transition_in(w[E],1)):(w[E]=create_each_block$s(T),w[E].c(),transition_in(w[E],1),w[E].m(u,null))}for(group_outros(),E=y.length;E<w.length;E+=1)k(E);check_outros()}},i(S){if(!f){for(let M=0;M<y.length;M+=1)transition_in(w[M]);f=!0}},o(S){w=w.filter(Boolean);for(let M=0;M<w.length;M+=1)transition_out(w[M]);f=!1},d(S){S&&detach(u),destroy_each(w,S),m=!1,run_all(v)}}}function instance$2d(p,u,f){let m,v,y,w,k,S,M,E,T,H,V,q,Z,J,ae,ie,he,{row:fe}=u,{top:me=!1}=u;const{focusedCellId:be,reorder:Ce,selectedRows:ze,scrollableColumns:Se,hoveredRowId:Ie,focusedRow:xe,contentLines:Ne,isDragging:$e,dispatch:Ze,rows:ve,columnRenderMap:Re,userCellMap:Qe,isSelectingCells:Fe,selectedCellMap:Je,selectedCellCount:ft}=getContext$1("grid");component_subscribe(p,be,xt=>f(11,J=xt)),component_subscribe(p,Ce,xt=>f(30,k=xt)),component_subscribe(p,ze,xt=>f(33,H=xt)),component_subscribe(p,Se,xt=>f(9,q=xt)),component_subscribe(p,Ie,xt=>f(3,T=xt)),component_subscribe(p,xe,xt=>f(31,S=xt)),component_subscribe(p,Ne,xt=>f(13,ie=xt)),component_subscribe(p,$e,xt=>f(8,V=xt)),component_subscribe(p,Re,xt=>f(14,he=xt)),component_subscribe(p,Qe,xt=>f(12,ae=xt)),component_subscribe(p,Fe,xt=>f(2,M=xt)),component_subscribe(p,Je,xt=>f(10,Z=xt)),component_subscribe(p,ft,xt=>f(32,E=xt));function Et(xt){bubble.call(this,p,xt)}const qe=()=>set_store_value(Ie,T=fe._id,T),Ge=()=>set_store_value(Ie,T=null,T),dt=()=>Ze("rowclick",ve.actions.cleanRow(fe));return p.$$set=xt=>{"row"in xt&&f(0,fe=xt.row),"top"in xt&&f(1,me=xt.top)},p.$$.update=()=>{p.$$.dirty[0]&1|p.$$.dirty[1]&4&&f(7,m=!!H[fe._id]),p.$$.dirty[0]&13|p.$$.dirty[1]&2&&f(6,v=T===fe._id&&(!E||!M)),p.$$.dirty[0]&1|p.$$.dirty[1]&1&&f(5,y=(S==null?void 0:S._id)===fe._id),p.$$.dirty[0]&1073741824&&f(4,w=k.sourceColumn)},[fe,me,M,T,w,y,v,m,V,q,Z,J,ae,ie,he,be,Ce,ze,Se,Ie,xe,Ne,$e,Ze,ve,Re,Qe,Fe,Je,ft,k,S,E,H,Et,qe,Ge,dt]}class GridRow extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2d,create_fragment$2g,safe_not_equal,{row:0,top:1},null,[-1,-1])}}const ButtonColumn_svelte_svelte_type_style_lang="";function get_each_context$r(p,u,f){var k;const m=p.slice();m[46]=u[f];const v=!!m[7][m[46]._id];m[47]=v;const y=m[5]===m[46]._id;m[48]=y;const w=((k=m[8])==null?void 0:k._id)===m[46]._id;return m[49]=w,m}function get_each_context_1$3(p,u,f){const m=p.slice();return m[52]=u[f],m}function create_else_block$o(p){let u,f,m=ensure_array_like(p[4]),v=[];for(let w=0;w<m.length;w+=1)v[w]=create_each_block_1$3(get_each_context_1$3(p,m,w));const y=w=>transition_out(v[w],1,1,()=>{v[w]=null});return{c(){for(let w=0;w<v.length;w+=1)v[w].c();u=empty$1()},m(w,k){for(let S=0;S<v.length;S+=1)v[S]&&v[S].m(w,k);insert(w,u,k),f=!0},p(w,k){if(k[0]&134217808){m=ensure_array_like(w[4]);let S;for(S=0;S<m.length;S+=1){const M=get_each_context_1$3(w,m,S);v[S]?(v[S].p(M,k),transition_in(v[S],1)):(v[S]=create_each_block_1$3(M),v[S].c(),transition_in(v[S],1),v[S].m(u.parentNode,u))}for(group_outros(),S=m.length;S<v.length;S+=1)y(S);check_outros()}},i(w){if(!f){for(let k=0;k<m.length;k+=1)transition_in(v[k]);f=!0}},o(w){v=v.filter(Boolean);for(let k=0;k<v.length;k+=1)transition_out(v[k]);f=!1},d(w){w&&detach(u),destroy_each(v,w)}}}function create_if_block_1$F(p){let u,f;function m(){return p[35](p[46])}return u=new CollapsedButtonGroup({props:{buttons:p[28](p[4],p[46]),text:p[1].buttonsCollapsedText||"Action",align:"right",offset:5,size:"S",animate:!1}}),u.$on("mouseenter",m),{c(){create_component(u.$$.fragment)},m(v,y){mount_component(u,v,y),f=!0},p(v,y){p=v;const w={};y[0]&80&&(w.buttons=p[28](p[4],p[46])),y[0]&2&&(w.text=p[1].buttonsCollapsedText||"Action"),u.$set(w)},i(v){f||(transition_in(u.$$.fragment,v),f=!0)},o(v){transition_out(u.$$.fragment,v),f=!1},d(v){destroy_component(u,v)}}}function create_if_block_2$p(p){let u,f;return{c(){u=element("i"),attr(u,"class",f=p[52].icon+" S svelte-q7a9cl")},m(m,v){insert(m,u,v)},p(m,v){v[0]&16&&f!==(f=m[52].icon+" S svelte-q7a9cl")&&attr(u,"class",f)},d(m){m&&detach(u)}}}function create_default_slot_2$n(p){let u,f=(p[52].text||"Button")+"",m,v=p[52].icon&&create_if_block_2$p(p);return{c(){v&&v.c(),u=space(),m=text$1(f)},m(y,w){v&&v.m(y,w),insert(y,u,w),insert(y,m,w)},p(y,w){y[52].icon?v?v.p(y,w):(v=create_if_block_2$p(y),v.c(),v.m(u.parentNode,u)):v&&(v.d(1),v=null),w[0]&16&&f!==(f=(y[52].text||"Button")+"")&&set_data(m,f)},d(y){y&&(detach(u),detach(m)),v&&v.d(y)}}}function create_each_block_1$3(p){let u,f;function m(){return p[36](p[52],p[46])}return u=new Button$1({props:{newStyles:!0,size:"S",cta:p[52].type==="cta",primary:p[52].type==="primary",secondary:p[52].type==="secondary",warning:p[52].type==="warning",overBackground:p[52].type==="overBackground",$$slots:{default:[create_default_slot_2$n]},$$scope:{ctx:p}}}),u.$on("click",m),{c(){create_component(u.$$.fragment)},m(v,y){mount_component(u,v,y),f=!0},p(v,y){p=v;const w={};y[0]&16&&(w.cta=p[52].type==="cta"),y[0]&16&&(w.primary=p[52].type==="primary"),y[0]&16&&(w.secondary=p[52].type==="secondary"),y[0]&16&&(w.warning=p[52].type==="warning"),y[0]&16&&(w.overBackground=p[52].type==="overBackground"),y[0]&16|y[1]&16777216&&(w.$$scope={dirty:y,ctx:p}),u.$set(w)},i(v){f||(transition_in(u.$$.fragment,v),f=!0)},o(v){transition_out(u.$$.fragment,v),f=!1},d(v){destroy_component(u,v)}}}function create_default_slot_1$w(p){let u,f,m,v;const y=[create_if_block_1$F,create_else_block$o],w=[];function k(S,M){return S[1].buttonsCollapsed?0:1}return f=k(p),m=w[f]=y[f](p),{c(){u=element("div"),m.c(),attr(u,"class","buttons svelte-q7a9cl"),toggle_class(u,"offset",p[10]&&p[11])},m(S,M){insert(S,u,M),w[f].m(u,null),v=!0},p(S,M){let E=f;f=k(S),f===E?w[f].p(S,M):(group_outros(),transition_out(w[E],1,1,()=>{w[E]=null}),check_outros(),m=w[f],m?m.p(S,M):(m=w[f]=y[f](S),m.c()),transition_in(m,1),m.m(u,null)),(!v||M[0]&3072)&&toggle_class(u,"offset",S[10]&&S[11])},i(S){v||(transition_in(m),v=!0)},o(S){transition_out(m),v=!1},d(S){S&&detach(u),w[f].d()}}}function create_each_block$r(p){var k;let u,f,m,v,y;f=new GridCell({props:{width:"auto",rowIdx:p[46].__idx,selected:p[47],highlighted:p[48]||p[49],metadata:(k=p[46].__metadata)==null?void 0:k.row,$$slots:{default:[create_default_slot_1$w]},$$scope:{ctx:p}}});function w(){return p[37](p[46])}return{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"class","row svelte-q7a9cl")},m(S,M){insert(S,u,M),mount_component(f,u,null),m=!0,v||(y=[listen(u,"mouseenter",function(){is_function(p[9]?null:w)&&(p[9]?null:w).apply(this,arguments)}),listen(u,"mouseleave",function(){is_function(p[9]?null:p[38])&&(p[9]?null:p[38]).apply(this,arguments)})],v=!0)},p(S,M){var T;p=S;const E={};M[0]&64&&(E.rowIdx=p[46].__idx),M[0]&192&&(E.selected=p[47]),M[0]&352&&(E.highlighted=p[48]||p[49]),M[0]&64&&(E.metadata=(T=p[46].__metadata)==null?void 0:T.row),M[0]&3186|M[1]&16777216&&(E.$$scope={dirty:M,ctx:p}),f.$set(E)},i(S){m||(transition_in(f.$$.fragment,S),m=!0)},o(S){transition_out(f.$$.fragment,S),m=!1},d(S){S&&detach(u),destroy_component(f),v=!1,run_all(y)}}}function create_if_block$1m(p){let u,f,m,v,y;return f=new GridCell({props:{width:"100%",highlighted:p[5]===BlankRowID}}),f.$on("click",p[39]),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"class","row blank svelte-q7a9cl")},m(w,k){insert(w,u,k),mount_component(f,u,null),m=!0,v||(y=[listen(u,"mouseenter",function(){is_function(p[9]?null:p[40])&&(p[9]?null:p[40]).apply(this,arguments)}),listen(u,"mouseleave",function(){is_function(p[9]?null:p[41])&&(p[9]?null:p[41]).apply(this,arguments)})],v=!0)},p(w,k){p=w;const S={};k[0]&32&&(S.highlighted=p[5]===BlankRowID),f.$set(S)},i(w){m||(transition_in(f.$$.fragment,w),m=!0)},o(w){transition_out(f.$$.fragment,w),m=!1},d(w){w&&detach(u),destroy_component(f),v=!1,run_all(y)}}}function create_default_slot$18(p){let u,f,m,v=ensure_array_like(p[6]),y=[];for(let S=0;S<v.length;S+=1)y[S]=create_each_block$r(get_each_context$r(p,v,S));const w=S=>transition_out(y[S],1,1,()=>{y[S]=null});let k=p[12].canAddRows&&create_if_block$1m(p);return{c(){for(let S=0;S<y.length;S+=1)y[S].c();u=space(),k&&k.c(),f=empty$1()},m(S,M){for(let E=0;E<y.length;E+=1)y[E]&&y[E].m(S,M);insert(S,u,M),k&&k.m(S,M),insert(S,f,M),m=!0},p(S,M){if(M[0]&402657266){v=ensure_array_like(S[6]);let E;for(E=0;E<v.length;E+=1){const T=get_each_context$r(S,v,E);y[E]?(y[E].p(T,M),transition_in(y[E],1)):(y[E]=create_each_block$r(T),y[E].c(),transition_in(y[E],1),y[E].m(u.parentNode,u))}for(group_outros(),E=v.length;E<y.length;E+=1)w(E);check_outros()}S[12].canAddRows?k?(k.p(S,M),M[0]&4096&&transition_in(k,1)):(k=create_if_block$1m(S),k.c(),transition_in(k,1),k.m(f.parentNode,f)):k&&(group_outros(),transition_out(k,1,1,()=>{k=null}),check_outros())},i(S){if(!m){for(let M=0;M<v.length;M+=1)transition_in(y[M]);transition_in(k),m=!0}},o(S){y=y.filter(Boolean);for(let M=0;M<y.length;M+=1)transition_out(y[M]);transition_out(k),m=!1},d(S){S&&(detach(u),detach(f)),destroy_each(y,S),k&&k.d(S)}}}function create_fragment$2f(p){let u,f,m,v,y,w,k;function S(E){p[42](E)}let M={scrollVertically:!0,attachHandlers:!0,$$slots:{default:[create_default_slot$18]},$$scope:{ctx:p}};return p[2]!==void 0&&(M.ref=p[2]),m=new GridScrollWrapper({props:M}),binding_callbacks.push(()=>bind(m,"ref",S)),{c(){u=element("div"),f=element("div"),create_component(m.$$.fragment),attr(f,"class","content svelte-q7a9cl"),attr(u,"class","button-column svelte-q7a9cl"),set_style(u,"left",p[3]+"px"),toggle_class(u,"hidden",p[0]===0)},m(E,T){insert(E,u,T),append$2(u,f),mount_component(m,f,null),y=!0,w||(k=listen(f,"mouseleave",p[43]),w=!0)},p(E,T){const H={};T[0]&8178|T[1]&16777216&&(H.$$scope={dirty:T,ctx:E}),!v&&T[0]&4&&(v=!0,H.ref=E[2],add_flush_callback(()=>v=!1)),m.$set(H),(!y||T[0]&8)&&set_style(u,"left",E[3]+"px"),(!y||T[0]&1)&&toggle_class(u,"hidden",E[0]===0)},i(E){y||(transition_in(m.$$.fragment,E),y=!0)},o(E){transition_out(m.$$.fragment,E),y=!1},d(E){E&&detach(u),destroy_component(m),w=!1,k()}}}function instance$2c(p,u,f){let m,v,y,w,k,S,M,E,T,H,V,q,Z,J,ae,ie,he,fe;const{renderedRows:me,hoveredRowId:be,props:Ce,width:ze,rows:Se,focusedRow:Ie,selectedRows:xe,scrollableColumns:Ne,scrollLeft:$e,isDragging:Ze,buttonColumnWidth:ve,showVScrollbar:Re,showHScrollbar:Qe,dispatch:Fe,config:Je}=getContext$1("grid");component_subscribe(p,me,yt=>f(6,q=yt)),component_subscribe(p,be,yt=>f(5,V=yt)),component_subscribe(p,Ce,yt=>f(1,H=yt)),component_subscribe(p,ze,yt=>f(32,M=yt)),component_subscribe(p,Ie,yt=>f(8,J=yt)),component_subscribe(p,xe,yt=>f(7,Z=yt)),component_subscribe(p,Ne,yt=>f(34,T=yt)),component_subscribe(p,$e,yt=>f(33,E=yt)),component_subscribe(p,Ze,yt=>f(9,ae=yt)),component_subscribe(p,ve,yt=>f(0,S=yt)),component_subscribe(p,Re,yt=>f(10,ie=yt)),component_subscribe(p,Qe,yt=>f(11,he=yt)),component_subscribe(p,Je,yt=>f(12,fe=yt));let ft;const Et=({buttons:yt,buttonsCollapsed:cn})=>{let Mn=yt||[];return cn?Mn:Mn.slice(0,3)},qe=async(yt,cn)=>{var Mn;await((Mn=yt.onClick)==null?void 0:Mn.call(yt,Se.actions.cleanRow(cn))),await Se.actions.refreshRow(cn._id)},Ge=(yt,cn)=>yt.map(Mn=>({...Mn,onClick:()=>qe(Mn,cn)}));onMount(()=>{new ResizeObserver(cn=>{var fn,Sn;const Mn=((Sn=(fn=cn==null?void 0:cn[0])==null?void 0:fn.contentRect)==null?void 0:Sn.width)??0;ve.set(Mn-1)}).observe(ft)});const dt=yt=>set_store_value(be,V=yt._id,V),xt=(yt,cn)=>qe(yt,cn),ot=yt=>set_store_value(be,V=yt._id,V),jt=()=>set_store_value(be,V=null,V),Xe=()=>Fe("add-row-inline"),Ut=()=>set_store_value(be,V=BlankRowID,V),en=()=>set_store_value(be,V=null,V);function Nt(yt){ft=yt,f(2,ft)}const kt=()=>set_store_value(be,V=null,V);return p.$$.update=()=>{p.$$.dirty[0]&2&&f(4,m=Et(H)),p.$$.dirty[1]&8&&f(31,v=T.reduce((yt,cn)=>yt+=cn.width,0)),p.$$.dirty[1]&5&&f(30,y=v-E-1),p.$$.dirty[0]&1|p.$$.dirty[1]&2&&f(29,w=M-S-1),p.$$.dirty[0]&1610612736&&f(3,k=Math.min(y,w))},[S,H,ft,k,m,V,q,Z,J,ae,ie,he,fe,me,be,Ce,ze,Ie,xe,Ne,$e,Ze,ve,Re,Qe,Fe,Je,qe,Ge,w,y,v,M,E,T,dt,xt,ot,jt,Xe,Ut,en,Nt,kt]}class ButtonColumn extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2c,create_fragment$2f,safe_not_equal,{},null,[-1,-1])}}const GridBody_svelte_svelte_type_style_lang="";function get_each_context$q(p,u,f){const m=p.slice();return m[21]=u[f],m[23]=f,m}function create_each_block$q(p){let u,f;return u=new GridRow({props:{row:p[21],top:p[23]===0}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&4&&(y.row=m[21]),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_if_block_1$E(p){let u,f,m,v,y;return f=new GridCell({props:{width:p[1],highlighted:p[5]===BlankRowID}}),f.$on("click",p[15]),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"class","row blank svelte-17lftvb")},m(w,k){insert(w,u,k),mount_component(f,u,null),m=!0,v||(y=[listen(u,"mouseenter",function(){is_function(p[4]?null:p[16])&&(p[4]?null:p[16]).apply(this,arguments)}),listen(u,"mouseleave",function(){is_function(p[4]?null:p[17])&&(p[4]?null:p[17]).apply(this,arguments)})],v=!0)},p(w,k){p=w;const S={};k&2&&(S.width=p[1]),k&32&&(S.highlighted=p[5]===BlankRowID),f.$set(S)},i(w){m||(transition_in(f.$$.fragment,w),m=!0)},o(w){transition_out(f.$$.fragment,w),m=!1},d(w){w&&detach(u),destroy_component(f),v=!1,run_all(y)}}}function create_default_slot$17(p){let u,f,m,v=ensure_array_like(p[2]),y=[];for(let S=0;S<v.length;S+=1)y[S]=create_each_block$q(get_each_context$q(p,v,S));const w=S=>transition_out(y[S],1,1,()=>{y[S]=null});let k=p[3].canAddRows&&create_if_block_1$E(p);return{c(){for(let S=0;S<y.length;S+=1)y[S].c();u=space(),k&&k.c(),f=empty$1()},m(S,M){for(let E=0;E<y.length;E+=1)y[E]&&y[E].m(S,M);insert(S,u,M),k&&k.m(S,M),insert(S,f,M),m=!0},p(S,M){if(M&4){v=ensure_array_like(S[2]);let E;for(E=0;E<v.length;E+=1){const T=get_each_context$q(S,v,E);y[E]?(y[E].p(T,M),transition_in(y[E],1)):(y[E]=create_each_block$q(T),y[E].c(),transition_in(y[E],1),y[E].m(u.parentNode,u))}for(group_outros(),E=v.length;E<y.length;E+=1)w(E);check_outros()}S[3].canAddRows?k?(k.p(S,M),M&8&&transition_in(k,1)):(k=create_if_block_1$E(S),k.c(),transition_in(k,1),k.m(f.parentNode,f)):k&&(group_outros(),transition_out(k,1,1,()=>{k=null}),check_outros())},i(S){if(!m){for(let M=0;M<v.length;M+=1)transition_in(y[M]);transition_in(k),m=!0}},o(S){y=y.filter(Boolean);for(let M=0;M<y.length;M+=1)transition_out(y[M]);transition_out(k),m=!1},d(S){S&&(detach(u),detach(f)),destroy_each(y,S),k&&k.d(S)}}}function create_if_block$1l(p){let u,f;return u=new ButtonColumn({}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_fragment$2e(p){var w;let u,f,m,v;f=new GridScrollWrapper({props:{scrollHorizontally:!0,scrollVertically:!0,attachHandlers:!0,$$slots:{default:[create_default_slot$17]},$$scope:{ctx:p}}});let y=((w=p[6].buttons)==null?void 0:w.length)&&create_if_block$1l();return{c(){u=element("div"),create_component(f.$$.fragment),m=space(),y&&y.c(),attr(u,"class","grid-body svelte-17lftvb")},m(k,S){insert(k,u,S),mount_component(f,u,null),append$2(u,m),y&&y.m(u,null),p[18](u),v=!0},p(k,[S]){var E;const M={};S&16777278&&(M.$$scope={dirty:S,ctx:k}),f.$set(M),(E=k[6].buttons)!=null&&E.length?y?S&64&&transition_in(y,1):(y=create_if_block$1l(),y.c(),transition_in(y,1),y.m(u,null)):y&&(group_outros(),transition_out(y,1,1,()=>{y=null}),check_outros())},i(k){v||(transition_in(f.$$.fragment,k),transition_in(y),v=!0)},o(k){transition_out(f.$$.fragment,k),transition_out(y),v=!1},d(k){k&&detach(u),destroy_component(f),y&&y.d(),p[18](null)}}}function instance$2b(p,u,f){let m,v,y,w,k,S,M;const{bounds:E,renderedRows:T,scrollableColumns:H,hoveredRowId:V,dispatch:q,isDragging:Z,config:J,props:ae}=getContext$1("grid");component_subscribe(p,T,ze=>f(2,y=ze)),component_subscribe(p,H,ze=>f(14,v=ze)),component_subscribe(p,V,ze=>f(5,S=ze)),component_subscribe(p,Z,ze=>f(4,k=ze)),component_subscribe(p,J,ze=>f(3,w=ze)),component_subscribe(p,ae,ze=>f(6,M=ze));let ie;const he=()=>{E.set(ie.getBoundingClientRect())};onMount(()=>{const ze=new ResizeObserver(he);return ze.observe(ie),window.addEventListener("wheel",he,!0),()=>{ze.disconnect(),window.removeEventListener("wheel",he,!0)}});const fe=()=>q("add-row-inline"),me=()=>set_store_value(V,S=BlankRowID,S),be=()=>set_store_value(V,S=null,S);function Ce(ze){binding_callbacks[ze?"unshift":"push"](()=>{ie=ze,f(0,ie)})}return p.$$.update=()=>{p.$$.dirty&16384&&f(1,m=v.reduce((ze,Se)=>ze+=Se.width,0))},[ie,m,y,w,k,S,M,T,H,V,q,Z,J,ae,v,fe,me,be,Ce]}class GridBody extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2b,create_fragment$2e,safe_not_equal,{})}}const ResizeOverlay_svelte_svelte_type_style_lang="";function get_each_context$p(p,u,f){const m=p.slice();return m[12]=u[f],m}function create_if_block$1k(p){let u,f=ensure_array_like(p[1]),m=[];for(let v=0;v<f.length;v+=1)m[v]=create_each_block$p(get_each_context$p(p,f,v));return{c(){for(let v=0;v<m.length;v+=1)m[v].c();u=empty$1()},m(v,y){for(let w=0;w<m.length;w+=1)m[w]&&m[w].m(v,y);insert(v,u,y)},p(v,y){if(y&286){f=ensure_array_like(v[1]);let w;for(w=0;w<f.length;w+=1){const k=get_each_context$p(v,f,w);m[w]?m[w].p(k,y):(m[w]=create_each_block$p(k),m[w].c(),m[w].m(u.parentNode,u))}for(;w<m.length;w+=1)m[w].d(1);m.length=f.length}},d(v){v&&detach(u),destroy_each(m,v)}}}function create_each_block$p(p){let u,f,m,v,y,w;function k(...E){return p[9](p[12],...E)}function S(...E){return p[10](p[12],...E)}function M(){return p[11](p[12])}return{c(){u=element("div"),f=element("div"),m=space(),attr(f,"class","resize-indicator svelte-be62xg"),attr(u,"class","resize-slider svelte-be62xg"),attr(u,"style",v=p[8](p[12],p[3])),toggle_class(u,"visible",p[2].column===p[12].name)},m(E,T){insert(E,u,T),append$2(u,f),append$2(u,m),y||(w=[listen(u,"mousedown",k),listen(u,"touchstart",S),listen(u,"dblclick",M)],y=!0)},p(E,T){p=E,T&10&&v!==(v=p[8](p[12],p[3]))&&attr(u,"style",v),T&6&&toggle_class(u,"visible",p[2].column===p[12].name)},d(E){E&&detach(u),y=!1,run_all(w)}}}function create_fragment$2d(p){let u,f=!p[0]&&create_if_block$1k(p);return{c(){f&&f.c(),u=empty$1()},m(m,v){f&&f.m(m,v),insert(m,u,v)},p(m,[v]){m[0]?f&&(f.d(1),f=null):f?f.p(m,v):(f=create_if_block$1k(m),f.c(),f.m(u.parentNode,u))},i:noop$2,o:noop$2,d(m){m&&detach(u),f&&f.d(m)}}}function instance$2a(p,u,f){let m,v,y,w;const{resize:k,visibleColumns:S,isReordering:M,scrollLeft:E}=getContext$1("grid");return component_subscribe(p,k,Z=>f(2,y=Z)),component_subscribe(p,S,Z=>f(1,v=Z)),component_subscribe(p,M,Z=>f(0,m=Z)),component_subscribe(p,E,Z=>f(3,w=Z)),[m,v,y,w,k,S,M,E,(Z,J)=>{let ae=Z.__left+Z.width;return Z.primaryDisplay||(ae-=J),`left:${ae}px;`},(Z,J)=>k.actions.startResizing(Z,J),(Z,J)=>k.actions.startResizing(Z,J),Z=>k.actions.resetSize(Z)]}class ResizeOverlay extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2a,create_fragment$2d,safe_not_equal,{})}}const ReorderOverlay_svelte_svelte_type_style_lang="";function create_if_block$1j(p){let u,f,m;return f=new GridScrollWrapper({props:{scrollVertically:!0,$$slots:{default:[create_default_slot$16]},$$scope:{ctx:p}}}),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"class","reorder-wrapper svelte-1e4eaad")},m(v,y){insert(v,u,y),mount_component(f,u,null),m=!0},p(v,y){const w={};y&2097154&&(w.$$scope={dirty:y,ctx:v}),f.$set(w)},i(v){m||(transition_in(f.$$.fragment,v),m=!0)},o(v){transition_out(f.$$.fragment,v),m=!1},d(v){v&&detach(u),destroy_component(f)}}}function create_default_slot$16(p){let u;return{c(){u=element("div"),attr(u,"class","reorder-overlay svelte-1e4eaad"),attr(u,"style",p[1])},m(f,m){insert(f,u,m)},p(f,m){m&2&&attr(u,"style",f[1])},d(f){f&&detach(u)}}}function create_fragment$2c(p){let u,f,m=p[0]&&create_if_block$1j(p);return{c(){m&&m.c(),u=empty$1()},m(v,y){m&&m.m(v,y),insert(v,u,y),f=!0},p(v,[y]){v[0]?m?(m.p(v,y),y&1&&transition_in(m,1)):(m=create_if_block$1j(v),m.c(),transition_in(m,1),m.m(u.parentNode,u)):m&&(group_outros(),transition_out(m,1,1,()=>{m=null}),check_outros())},i(v){f||(transition_in(m),f=!0)},o(v){transition_out(m),f=!1},d(v){v&&detach(u),m&&m.d(v)}}}function instance$29(p,u,f){let m,v,y,w,k,S,M,E,T,H,V,q,Z;const{isReordering:J,reorder:ae,columnLookupMap:ie,rowHeight:he,renderedRows:fe,scrollLeft:me,stickyWidth:be}=getContext$1("grid");component_subscribe(p,J,ze=>f(14,E=ze)),component_subscribe(p,ae,ze=>f(18,q=ze)),component_subscribe(p,ie,ze=>f(19,Z=ze)),component_subscribe(p,he,ze=>f(16,H=ze)),component_subscribe(p,fe,ze=>f(15,T=ze)),component_subscribe(p,me,ze=>f(17,V=ze)),component_subscribe(p,be,ze=>f(13,M=ze));const Ce=(ze,Se,Ie)=>{if(!ze)return 0;let xe=ze.__left-Ie;return Se&&(xe+=ze.width),xe};return p.$$.update=()=>{p.$$.dirty&786432&&f(12,m=Z[q.targetColumn]),p.$$.dirty&262144&&f(11,v=q.insertAfter),p.$$.dirty&137216&&f(9,y=Ce(m,v,V)),p.$$.dirty&98304&&f(10,w=H*T.length+DefaultRowHeight),p.$$.dirty&1536&&f(1,k=`left:${y}px; height:${w}px;`),p.$$.dirty&25088&&f(0,S=E&&y>=M)},[S,k,J,ae,ie,he,fe,me,be,y,w,v,m,M,E,T,H,V,q,Z]}class ReorderOverlay extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$29,create_fragment$2c,safe_not_equal,{})}}const PopoverOverlay_svelte_svelte_type_style_lang="";function create_fragment$2b(p){let u;return{c(){u=element("div"),attr(u,"class","grid-popover-container svelte-ws1j1t")},m(f,m){insert(f,u,m)},p:noop$2,i:noop$2,o:noop$2,d(f){f&&detach(u)}}}class PopoverOverlay extends SvelteComponent{constructor(u){super(),init$1(this,u,null,create_fragment$2b,safe_not_equal,{})}}const NewColumnButton_svelte_svelte_type_style_lang="";function create_if_block$1i(p){let u,f;return u=new GridPopover({props:{anchor:p[2],align:p[1].length?"right":"left",maxHeight:null,resizable:!0,minWidth:360,$$slots:{default:[create_default_slot$15]},$$scope:{ctx:p}}}),u.$on("close",p[8]),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&4&&(y.anchor=m[2]),v&2&&(y.align=m[1].length?"right":"left"),v&32768&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot$15(p){let u,f;const m=p[13].default,v=create_slot(m,p,p[15],null);return{c(){u=element("div"),v&&v.c(),attr(u,"class","content svelte-13f8h1i")},m(y,w){insert(y,u,w),v&&v.m(u,null),f=!0},p(y,w){v&&v.p&&(!f||w&32768)&&update_slot_base(v,m,y,y[15],f?get_slot_changes(m,y[15],w,null):get_all_dirty_from_scope(y[15]),null)},i(y){f||(transition_in(v,y),f=!0)},o(y){transition_out(v,y),f=!1},d(y){y&&detach(u),v&&v.d(y)}}}function create_fragment$2a(p){let u,f,m,v,y,w,k;f=new Icon$1({props:{name:"Add"}});let S=p[0]&&create_if_block$1i(p);return{c(){u=element("div"),create_component(f.$$.fragment),m=space(),S&&S.c(),v=empty$1(),attr(u,"id","add-column-button"),attr(u,"class","add svelte-13f8h1i"),set_style(u,"left",p[3]+"px")},m(M,E){insert(M,u,E),mount_component(f,u,null),p[14](u),insert(M,m,E),S&&S.m(M,E),insert(M,v,E),y=!0,w||(k=listen(u,"click",p[7]),w=!0)},p(M,[E]){(!y||E&8)&&set_style(u,"left",M[3]+"px"),M[0]?S?(S.p(M,E),E&1&&transition_in(S,1)):(S=create_if_block$1i(M),S.c(),transition_in(S,1),S.m(v.parentNode,v)):S&&(group_outros(),transition_out(S,1,1,()=>{S=null}),check_outros())},i(M){y||(transition_in(f.$$.fragment,M),transition_in(S),y=!0)},o(M){transition_out(f.$$.fragment,M),transition_out(S),y=!1},d(M){M&&(detach(u),detach(m),detach(v)),destroy_component(f),p[14](null),S&&S.d(M),w=!1,k()}}}function instance$28(p,u,f){let m,v,y,w,k,S,{$$slots:M={},$$scope:E}=u;const{scrollableColumns:T,scrollLeft:H,width:V,subscribe:q,ui:Z,keyboardBlocked:J}=getContext$1("grid");component_subscribe(p,T,be=>f(1,S=be)),component_subscribe(p,H,be=>f(12,k=be)),component_subscribe(p,V,be=>f(11,w=be));let ae,ie=!1;const he=()=>{Z.actions.blur(),f(0,ie=!0)},fe=()=>{f(0,ie=!1)};onMount(()=>q("close-edit-column",fe));function me(be){binding_callbacks[be?"unshift":"push"](()=>{ae=be,f(2,ae)})}return p.$$set=be=>{"$$scope"in be&&f(15,E=be.$$scope)},p.$$.update=()=>{p.$$.dirty&2&&f(10,m=S.reduce((be,Ce)=>be+=Ce.width,0)),p.$$.dirty&5120&&f(9,v=m-1-k),p.$$.dirty&2560&&f(3,y=Math.min(w-40,v)),p.$$.dirty&1&&J.set(ie)},[ie,S,ae,y,T,H,V,he,fe,v,m,w,k,M,me,E]}class NewColumnButton extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$28,create_fragment$2a,safe_not_equal,{})}}function create_default_slot$14(p){let u,f=p[0].schema.name+"",m,v,y,w,k,S,M;y=new InlineAlert({props:{type:"error",header:"Are you sure?",message:"This will leave bindings which utilised the user relationship column in a state where they will need to be updated to use the new column instead."}});function E(H){p[5](H)}let T={label:"New column name",error:p[2]};return p[1]!==void 0&&(T.value=p[1]),k=new Input$5({props:T}),binding_callbacks.push(()=>bind(k,"value",E)),{c(){u=text$1('This operation will kick off a migration of the column "'),m=text$1(f),v=text$1(`"
396
396
  to a new column, with the name provided - this operation may take a moment to
397
397
  complete.
398
398