@vizzly/services 0.15.0-dev-7bc589a7f3bd2fcefcfc87158e10f21fb3e5a79c → 0.15.0-dev-a54509b7edba5b0c1577b0610eef3b1c4baad5e7

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.
@@ -26,10 +26,10 @@ function print() { __p += __j.call(arguments, '') }
26
26
  `:`;
27
27
  `)+s0+`return __p
28
28
  }`;var t1=J3(function(){return s1(D,N0+"return "+s0).apply(o,F)});if(t1.source=s0,as(t1))throw t1;return t1}function V5(r){return m1(r).toLowerCase()}function H5(r){return m1(r).toUpperCase()}function Y5(r,i,p){if(r=m1(r),r&&(p||i===o))return Wp(r);if(!r||!(i=C0(i)))return r;var h=ht(r),B=ht(i),D=hp(h,B),F=mp(h,B)+1;return a1(h,D,F).join("")}function K5(r,i,p){if(r=m1(r),r&&(p||i===o))return r.slice(0,Lp(r)+1);if(!r||!(i=C0(i)))return r;var h=ht(r),B=mp(h,ht(i))+1;return a1(h,0,B).join("")}function Q5(r,i,p){if(r=m1(r),r&&(p||i===o))return r.replace(Xr,"");if(!r||!(i=C0(i)))return r;var h=ht(r),B=hp(h,ht(i));return a1(h,B).join("")}function Z5(r,i){var p=w,h=E;if(U1(i)){var B="separator"in i?i.separator:B;p="length"in i?Q0(i.length):p,h="omission"in i?C0(i.omission):h}r=m1(r);var D=r.length;if(So(r)){var F=ht(r);D=F.length}if(p>=D)return r;var G=p-$2(h);if(G<1)return h;var K=F?a1(F,0,G).join(""):r.slice(0,G);if(B===o)return K+h;if(F&&(G+=K.length-G),Ms(B)){if(r.slice(G).search(B)){var i0,p0=K;for(B.global||(B=Ai(B.source,m1(Eb.exec(B))+"g")),B.lastIndex=0;i0=B.exec(p0);)var s0=i0.index;K=K.slice(0,s0===o?G:s0)}}else if(r.indexOf(C0(B),G)!=G){var q0=K.lastIndexOf(B);q0>-1&&(K=K.slice(0,q0))}return K+h}function J5(r){return r=m1(r),r&&lz.test(r)?r.replace(xr,oc):r}var eW=qn(function(r,i,p){return r+(p?" ":"")+i.toUpperCase()}),ss=e3("toUpperCase");function Z3(r,i,p){return r=m1(r),i=p?o:i,i===o?Jz(r)?li(r):Hz(r):r.match(i)||[]}var J3=I(function(r,i){try{return He(r,o,i)}catch(p){return as(p)?p:new U0(p)}}),tW=J2(function(r,i){return bt(i,function(p){p=v2(p),t2(r,p,bs(r[p],r))}),r});function oW(r){var i=r==null?0:r.length,p=E0();return r=i?S1(r,function(h){if(typeof h[1]!="function")throw new pt(O);return[p(h[0]),h[1]]}):[],I(function(h){for(var B=-1;++B<i;){var D=r[B];if(He(D[0],this,h))return He(D[1],this,h)}})}function rW(r){return Ec(at(r,N))}function Os(r){return function(){return r}}function nW(r,i){return r==null||r!==r?i:r}var iW=o3(),bW=o3(!0);function ct(r){return r}function ls(r){return Ni(typeof r=="function"?r:at(r,N))}function pW(r){return Jp(at(r,N))}function aW(r,i){return Si(r,at(i,N))}var MW=I(function(r,i){return function(p){return Po(p,r,i)}}),zW=I(function(r,i){return function(p){return Po(r,p,i)}});function As(r,i,p){var h=Le(i),B=sn(i,h);p==null&&!(U1(i)&&(B.length||!h.length))&&(p=i,i=r,r=this,B=sn(i,Le(i)));var D=!(U1(p)&&"chain"in p)||!!p.chain,F=to(r);return bt(B,function(G){var K=i[G];r[G]=K,F&&(r.prototype[G]=function(){var i0=this.__chain__;if(D||i0){var p0=r(this.__wrapped__),s0=p0.__actions__=ce(this.__actions__);return s0.push({func:K,args:arguments,thisArg:r}),p0.__chain__=i0,p0}return K.apply(r,u2([this.value()],arguments))})}),r}function cW(){return ae._===this&&(ae._=bc),this}function ds(){}function sW(r){return r=Q0(r),I(function(i){return sr(i,r)})}var OW=Vc(S1),lW=Vc(up),AW=Vc(Ur);function el(r){return es(r)?Hr(v2(r)):Gc(r)}function dW(r){return function(i){return r==null?o:K2(r,i)}}var uW=n3(),fW=n3(!0);function us(){return[]}function fs(){return!1}function qW(){return{}}function WW(){return""}function hW(){return!0}function mW(r,i){if(r=Q0(r),r<1||r>L0)return[];var p=$0,h=ge(r,$0);i=E0(i),r-=$0;for(var B=ci(h,i);++p<r;)i(p);return B}function gW(r){return V0(r)?S1(r,v2):Lt(r)?[r]:ce(W3(m1(r)))}function yW(r){var i=++_p;return m1(r)+i}var RW=na(function(r,i){return r+i},0),LW=Hc("ceil"),vW=na(function(r,i){return r/i},1),_W=Hc("floor");function NW(r){return r&&r.length?cn(r,ct,vi):o}function TW(r,i){return r&&r.length?cn(r,E0(i,2),vi):o}function BW(r){return Vr(r,ct)}function SW(r,i){return Vr(r,E0(i,2))}function wW(r){return r&&r.length?cn(r,ct,Bi):o}function xW(r,i){return r&&r.length?cn(r,E0(i,2),Bi):o}var XW=na(function(r,i){return r*i},1),CW=Hc("round"),EW=na(function(r,i){return r-i},0);function DW(r){return r&&r.length?Yr(r,ct):0}function IW(r,i){return r&&r.length?Yr(r,E0(i,2)):0}return x.after=p4,x.ary=B3,x.assign=H4,x.assignIn=U3,x.assignInWith=ua,x.assignWith=Y4,x.at=K4,x.before=S3,x.bind=bs,x.bindAll=tW,x.bindKey=w3,x.castArray=q4,x.chain=_3,x.chunk=_f,x.compact=Nf,x.concat=Tf,x.cond=oW,x.conforms=rW,x.constant=Os,x.countBy=Dq,x.create=Q4,x.curry=x3,x.curryRight=X3,x.debounce=C3,x.defaults=Z4,x.defaultsDeep=J4,x.defer=a4,x.delay=M4,x.difference=Bf,x.differenceBy=Sf,x.differenceWith=wf,x.drop=xf,x.dropRight=Xf,x.dropRightWhile=Cf,x.dropWhile=Ef,x.fill=Df,x.filter=Pq,x.flatMap=jq,x.flatMapDeep=$q,x.flatMapDepth=Uq,x.flatten=y3,x.flattenDeep=If,x.flattenDepth=Pf,x.flip=z4,x.flow=iW,x.flowRight=bW,x.fromPairs=Ff,x.functions=b5,x.functionsIn=p5,x.groupBy=Gq,x.initial=jf,x.intersection=$f,x.intersectionBy=Uf,x.intersectionWith=Gf,x.invert=M5,x.invertBy=z5,x.invokeMap=Hq,x.iteratee=ls,x.keyBy=Yq,x.keys=Le,x.keysIn=zt,x.map=ca,x.mapKeys=s5,x.mapValues=O5,x.matches=pW,x.matchesProperty=aW,x.memoize=Oa,x.merge=l5,x.mergeWith=G3,x.method=MW,x.methodOf=zW,x.mixin=As,x.negate=la,x.nthArg=sW,x.omit=A5,x.omitBy=d5,x.once=c4,x.orderBy=Kq,x.over=OW,x.overArgs=s4,x.overEvery=lW,x.overSome=AW,x.partial=ps,x.partialRight=E3,x.partition=Qq,x.pick=u5,x.pickBy=V3,x.property=el,x.propertyOf=dW,x.pull=Kf,x.pullAll=L3,x.pullAllBy=Qf,x.pullAllWith=Zf,x.pullAt=Jf,x.range=uW,x.rangeRight=fW,x.rearg=O4,x.reject=e4,x.remove=eq,x.rest=l4,x.reverse=ns,x.sampleSize=o4,x.set=q5,x.setWith=W5,x.shuffle=r4,x.slice=tq,x.sortBy=b4,x.sortedUniq=aq,x.sortedUniqBy=Mq,x.split=j5,x.spread=A4,x.tail=zq,x.take=cq,x.takeRight=sq,x.takeRightWhile=Oq,x.takeWhile=lq,x.tap=Nq,x.throttle=d4,x.thru=za,x.toArray=k3,x.toPairs=H3,x.toPairsIn=Y3,x.toPath=gW,x.toPlainObject=$3,x.transform=h5,x.unary=u4,x.union=Aq,x.unionBy=dq,x.unionWith=uq,x.uniq=fq,x.uniqBy=qq,x.uniqWith=Wq,x.unset=m5,x.unzip=is,x.unzipWith=v3,x.update=g5,x.updateWith=y5,x.values=mn,x.valuesIn=R5,x.without=hq,x.words=Z3,x.wrap=f4,x.xor=mq,x.xorBy=gq,x.xorWith=yq,x.zip=Rq,x.zipObject=Lq,x.zipObjectDeep=vq,x.zipWith=_q,x.entries=H3,x.entriesIn=Y3,x.extend=U3,x.extendWith=ua,As(x,x),x.add=RW,x.attempt=J3,x.camelCase=N5,x.capitalize=K3,x.ceil=LW,x.clamp=L5,x.clone=W4,x.cloneDeep=m4,x.cloneDeepWith=g4,x.cloneWith=h4,x.conformsTo=y4,x.deburr=Q3,x.defaultTo=nW,x.divide=vW,x.endsWith=T5,x.eq=n2,x.escape=B5,x.escapeRegExp=S5,x.every=Iq,x.find=Fq,x.findIndex=m3,x.findKey=e5,x.findLast=kq,x.findLastIndex=g3,x.findLastKey=t5,x.floor=_W,x.forEach=N3,x.forEachRight=T3,x.forIn=o5,x.forInRight=r5,x.forOwn=n5,x.forOwnRight=i5,x.get=zs,x.gt=R4,x.gte=L4,x.has=a5,x.hasIn=cs,x.head=R3,x.identity=ct,x.includes=Vq,x.indexOf=kf,x.inRange=v5,x.invoke=c5,x.isArguments=Ar,x.isArray=V0,x.isArrayBuffer=v4,x.isArrayLike=Mt,x.isArrayLikeObject=re,x.isBoolean=_4,x.isBuffer=ko,x.isDate=N4,x.isElement=T4,x.isEmpty=B4,x.isEqual=S4,x.isEqualWith=w4,x.isError=as,x.isFinite=x4,x.isFunction=to,x.isInteger=D3,x.isLength=Aa,x.isMap=I3,x.isMatch=X4,x.isMatchWith=C4,x.isNaN=E4,x.isNative=D4,x.isNil=P4,x.isNull=I4,x.isNumber=P3,x.isObject=U1,x.isObjectLike=J1,x.isPlainObject=Ii,x.isRegExp=Ms,x.isSafeInteger=F4,x.isSet=F3,x.isString=da,x.isSymbol=Lt,x.isTypedArray=hn,x.isUndefined=k4,x.isWeakMap=j4,x.isWeakSet=$4,x.join=Vf,x.kebabCase=w5,x.last=Pt,x.lastIndexOf=Hf,x.lowerCase=x5,x.lowerFirst=X5,x.lt=U4,x.lte=G4,x.max=NW,x.maxBy=TW,x.mean=BW,x.meanBy=SW,x.min=wW,x.minBy=xW,x.stubArray=us,x.stubFalse=fs,x.stubObject=qW,x.stubString=WW,x.stubTrue=hW,x.multiply=XW,x.nth=Yf,x.noConflict=cW,x.noop=ds,x.now=sa,x.pad=C5,x.padEnd=E5,x.padStart=D5,x.parseInt=I5,x.random=_5,x.reduce=Zq,x.reduceRight=Jq,x.repeat=P5,x.replace=F5,x.result=f5,x.round=CW,x.runInContext=Y,x.sample=t4,x.size=n4,x.snakeCase=k5,x.some=i4,x.sortedIndex=oq,x.sortedIndexBy=rq,x.sortedIndexOf=nq,x.sortedLastIndex=iq,x.sortedLastIndexBy=bq,x.sortedLastIndexOf=pq,x.startCase=$5,x.startsWith=U5,x.subtract=EW,x.sum=DW,x.sumBy=IW,x.template=G5,x.times=mW,x.toFinite=oo,x.toInteger=Q0,x.toLength=j3,x.toLower=V5,x.toNumber=Ft,x.toSafeInteger=V4,x.toString=m1,x.toUpper=H5,x.trim=Y5,x.trimEnd=K5,x.trimStart=Q5,x.truncate=Z5,x.unescape=J5,x.uniqueId=yW,x.upperCase=eW,x.upperFirst=ss,x.each=N3,x.eachRight=T3,x.first=R3,As(x,function(){var r={};return Dt(x,function(i,p){f1.call(x.prototype,p)||(r[p]=i)}),r}(),{chain:!1}),x.VERSION=n,bt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(r){x[r].placeholder=x}),bt(["drop","take"],function(r,i){r1.prototype[r]=function(p){p=p===o?1:oe(Q0(p),0);var h=this.__filtered__&&!i?new r1(this):this.clone();return h.__filtered__?h.__takeCount__=ge(p,h.__takeCount__):h.__views__.push({size:ge(p,$0),type:r+(h.__dir__<0?"Right":"")}),h},r1.prototype[r+"Right"]=function(p){return this.reverse()[r](p).reverse()}}),bt(["filter","map","takeWhile"],function(r,i){var p=i+1,h=p==a0||p==Z;r1.prototype[r]=function(B){var D=this.clone();return D.__iteratees__.push({iteratee:E0(B,3),type:p}),D.__filtered__=D.__filtered__||h,D}}),bt(["head","last"],function(r,i){var p="take"+(i?"Right":"");r1.prototype[r]=function(){return this[p](1).value()[0]}}),bt(["initial","tail"],function(r,i){var p="drop"+(i?"":"Right");r1.prototype[r]=function(){return this.__filtered__?new r1(this):this[p](1)}}),r1.prototype.compact=function(){return this.filter(ct)},r1.prototype.find=function(r){return this.filter(r).head()},r1.prototype.findLast=function(r){return this.reverse().find(r)},r1.prototype.invokeMap=I(function(r,i){return typeof r=="function"?new r1(this):this.map(function(p){return Po(p,r,i)})}),r1.prototype.reject=function(r){return this.filter(la(E0(r)))},r1.prototype.slice=function(r,i){r=Q0(r);var p=this;return p.__filtered__&&(r>0||i<0)?new r1(p):(r<0?p=p.takeRight(-r):r&&(p=p.drop(r)),i!==o&&(i=Q0(i),p=i<0?p.dropRight(-i):p.take(i-r)),p)},r1.prototype.takeRightWhile=function(r){return this.reverse().takeWhile(r).reverse()},r1.prototype.toArray=function(){return this.take($0)},Dt(r1.prototype,function(r,i){var p=/^(?:filter|find|map|reject)|While$/.test(i),h=/^(?:head|last)$/.test(i),B=x[h?"take"+(i=="last"?"Right":""):i],D=h||/^find/.test(i);B&&(x.prototype[i]=function(){var F=this.__wrapped__,G=h?[1]:arguments,K=F instanceof r1,i0=G[0],p0=K||V0(F),s0=function(i1){var M1=B.apply(x,u2([i1],G));return h&&q0?M1[0]:M1};p0&&p&&typeof i0=="function"&&i0.length!=1&&(K=p0=!1);var q0=this.__chain__,N0=!!this.__actions__.length,D0=D&&!q0,t1=K&&!N0;if(!D&&p0){F=t1?F:new r1(this);var I0=r.apply(F,G);return I0.__actions__.push({func:za,args:[s0],thisArg:o}),new Ae(I0,q0)}return D0&&t1?r.apply(this,G):(I0=this.thru(s0),D0?h?I0.value()[0]:I0.value():I0)})}),bt(["pop","push","shift","sort","splice","unshift"],function(r){var i=Jr[r],p=/^(?:push|sort|unshift)$/.test(r)?"tap":"thru",h=/^(?:pop|shift)$/.test(r);x.prototype[r]=function(){var B=arguments;if(h&&!this.__chain__){var D=this.value();return i.apply(V0(D)?D:[],B)}return this[p](function(F){return i.apply(V0(F)?F:[],B)})}}),Dt(r1.prototype,function(r,i){var p=x[i];if(p){var h=p.name+"";f1.call(Xo,h)||(Xo[h]=[]),Xo[h].push({name:i,func:p})}}),Xo[ra(o,q).name]=[{name:"wrapper",func:o}],r1.prototype.clone=Dp,r1.prototype.reverse=uc,r1.prototype.value=fc,x.prototype.at=Tq,x.prototype.chain=Bq,x.prototype.commit=Sq,x.prototype.next=wq,x.prototype.plant=Xq,x.prototype.reverse=Cq,x.prototype.toJSON=x.prototype.valueOf=x.prototype.value=Eq,x.prototype.first=x.prototype.head,br&&(x.prototype[br]=xq),x},f2=Qr();j2?((j2.exports=f2)._=f2,ii._=f2):ae._=f2}).call(O0)})(Ga,Ga.exports);var P0=Ga.exports;Object.defineProperty(sb,"__esModule",{value:!0});sb.Repository=void 0;const HW=P0,YW=Xn;class KW{constructor(e){this.itemKey=e,this.storedItems=[],this.permissions=[]}getRepo(){return{storedItems:this.storedItems,permissions:this.permissions}}initRepo(e,o){this.storedItems=e,this.permissions=o}addItem(e,o){this.isPopulated()&&(this.storedItems=[...this.storedItems,e],this.permissions=[...this.permissions,...o])}updateItem(e){this.storedItems=this.storedItems.map(o=>o[this.itemKey]==e[this.itemKey]?e:o)}isPopulated(){return(this.storedItems.length>0||this.permissions.length>0)&&this.permissionsAreFresh()}permissionsAreFresh(){return(0,HW.every)(this.permissions,e=>YW.Permission.validateJwtExpiry(e.token))}clear(){this.storedItems=[],this.permissions=[]}}sb.Repository=KW;var fa=O0&&O0.__awaiter||function(t,e,o,n){function b(a){return a instanceof o?a:new o(function(O){O(a)})}return new(o||(o=Promise))(function(a,O){function A(v){try{y(n.next(v))}catch(N){O(N)}}function c(v){try{y(n.throw(v))}catch(N){O(N)}}function y(v){v.done?a(v.value):b(v.value).then(A,c)}y((n=n.apply(t,e||[])).next())})};Object.defineProperty(xn,"__esModule",{value:!0});xn.DashboardRepository=void 0;const QW=pb,ol=ab,ZW=Mb,JW=zb,eh=cb,rl=Xn,th=sb;class jo{constructor(e){this.vizzly=e,this.repo=new th.Repository("id")}static EmptyDashboardDefinition(){return{componentLibrary:[],customFields:{},globalFilters:[],display:[{components:[{colSpan:6,isEmpty:!0},{colSpan:6,isEmpty:!0}],height:350},{components:[{colSpan:6,isEmpty:!0},{colSpan:6,isEmpty:!0}],height:350},{components:[{colSpan:6,isEmpty:!0},{colSpan:6,isEmpty:!0}],height:350}]}}createDashboard(e){return fa(this,void 0,void 0,function*(){let o;if(this.vizzly.implementationStrategy.shouldPersistViaQueryEngine()){const n=this.vizzly.getVizzlyQueryEngineAPI();o=yield n.execute(n.buildCreateDashboardRequest(e))}else{const n=this.vizzly.getVizzlyAPI();o=yield n.execute(n.buildCreateDashboardRequest(e))}if(o.status===200){const n=o.body.permissions.map(rl.Permission.formatDashboardPermission),b=jo.embellishDashboardFromAPI(o.body.dashboard,n);return this.repo.addItem(b,n),{dashboard:b,permissions:n}}throw o.status===422?new QW.DashboardQuotaReached(`Dashboard quota reached; ${JSON.stringify(o.body)}`):o.status!=200?new ol.FailedToCreateDashboard(`Failed to create the dashboard from POST /api/v2/dashboard. Got ${o.status}`):new ol.FailedToCreateDashboard(`Unknown failure. Got status ${o.status}`)})}updateDashboard(e){return fa(this,void 0,void 0,function*(){let o;if(this.vizzly.implementationStrategy.shouldPersistViaQueryEngine()){const n=this.vizzly.getVizzlyQueryEngineAPI();o=yield n.execute(n.buildUpdateDashboardRequest(e))}else{const n=this.vizzly.getVizzlyAPI();o=yield n.execute(n.buildUpdateDashboardRequest(e))}if(o.status===200){const n=jo.embellishDashboardFromAPI(o.body.dashboard,[e.dashboardPermission]);return this.repo.updateItem(n),n}else throw new eh.FailedToUpdateDashboard(`Failed to update dashboard, got status ${o.status}`)})}fetchDashboards(e){return fa(this,void 0,void 0,function*(){return yield this.fetchDashboardAccessTokens(e)})}static embellishDashboardFromAPI(e,o){return Object.assign(Object.assign({},e),{permission:jo.takeHighestPermission(e.id,o)})}static takeHighestPermission(e,o){const n=jo.takePermissionsOfScope(e,o,"read");return jo.takePermissionsOfScope(e,o,"read_write")[0]||n[0]}static takePermissionsOfScope(e,o,n){return o.filter(b=>b.dashboardId===e&&b.scope===n)}fetchDashboardAccessTokens(e){return fa(this,void 0,void 0,function*(){let o;if(!this.repo.isPopulated()){if(this.vizzly.implementationStrategy.shouldPersistViaQueryEngine()){const n=this.vizzly.getVizzlyQueryEngineAPI();o=yield n.execute(n.buildFetchDashboardAccessTokensRequest(e))}else{const n=this.vizzly.getVizzlyAPI();o=yield n.execute(n.buildFetchDashboardAccessTokensRequest(e))}if(o.status===200){const n=o.body.permissions.map(rl.Permission.formatDashboardPermission),b=o.body.dashboards.map(a=>{if(typeof a.definition=="string")throw new ZW.FailedToDecryptDashboardBeforeClient;return jo.embellishDashboardFromAPI(a,n)});this.repo.initRepo(b,n)}else throw new JW.FailedToFetchDashboardAccessTokens("Failed to fetch dashboard access tokens.")}return{dashboards:this.repo.getRepo().storedItems,permissions:this.repo.getRepo().permissions}})}clearRepo(){this.repo.clear()}}xn.DashboardRepository=jo;var Ob={},MM={};Object.defineProperty(MM,"__esModule",{value:!0});MM.FailedToFetchGlobalLibraryAccessTokens=void 0;class oh extends Error{constructor(e){super(e),this.name="FailedToFetchGlobalLibraryAccessTokens"}}MM.FailedToFetchGlobalLibraryAccessTokens=oh;var zM={};Object.defineProperty(zM,"__esModule",{value:!0});zM.FailedToUpdateGlobalLibrary=void 0;class rh extends Error{constructor(e){super(e),this.name="FailedToUpdateGlobalLibrary"}}zM.FailedToUpdateGlobalLibrary=rh;var Pi=O0&&O0.__awaiter||function(t,e,o,n){function b(a){return a instanceof o?a:new o(function(O){O(a)})}return new(o||(o=Promise))(function(a,O){function A(v){try{y(n.next(v))}catch(N){O(N)}}function c(v){try{y(n.throw(v))}catch(N){O(N)}}function y(v){v.done?a(v.value):b(v.value).then(A,c)}y((n=n.apply(t,e||[])).next())})};Object.defineProperty(Ob,"__esModule",{value:!0});Ob.GlobalLibraryRepository=void 0;const nh=P0,nl=Xn,ih=MM,bh=sb,ph=zM;class Gi{constructor(e){this.vizzly=e,this.repo=new bh.Repository("id")}createGlobalLibrary(e){return Pi(this,void 0,void 0,function*(){const o=this.vizzly.getVizzlyAPI();let n;this.vizzly.implementationStrategy.shouldPersistViaQueryEngine()?n=yield this.vizzly.getVizzlyQueryEngineAPI().createGlobalLibrary(e):n=yield o.createGlobalLibrary(e);const b=Gi.upcast(n.global_library),a=n.permissions.map(nl.Permission.formatGlobalLibraryPermission);return this.repo.addItem(b,a),{global_library:b,permissions:a}})}fetchGlobalLibraries(e){return Pi(this,void 0,void 0,function*(){return yield this.fetchGlobalLibraryAccessTokens(e)})}fetchGlobalLibraryAccessTokens(e){return Pi(this,void 0,void 0,function*(){const o=this.vizzly.getVizzlyAPI();let n;if(!this.repo.isPopulated())if(this.vizzly.implementationStrategy.shouldPersistViaQueryEngine()?n=yield this.vizzly.getVizzlyQueryEngineAPI().fetchGlobalLibraryAccessTokens(e):n=yield o.fetchGlobalLibraryAccessTokens(e),n.status===200){const b=n.body.permissions.map(nl.Permission.formatGlobalLibraryPermission);this.repo.initRepo(n.body.global_libraries,b)}else throw new ih.FailedToFetchGlobalLibraryAccessTokens("Failed to load access tokens for the global library.");return{global_libraries:this.repo.getRepo().storedItems,permissions:this.repo.getRepo().permissions}})}updateGlobalLibrary(e){return Pi(this,void 0,void 0,function*(){let o;const n=this.vizzly.getVizzlyAPI();if(this.vizzly.implementationStrategy.shouldPersistViaQueryEngine()?o=yield this.vizzly.getVizzlyQueryEngineAPI().updateGlobalLibrary(e):o=yield n.updateGlobalLibrary(e),o.status!=200)throw new ph.FailedToUpdateGlobalLibrary(`Failed to update the global library ${o.status}`);const b=Gi.upcast(o.body.global_library);return this.repo.updateItem(b),b})}getChildGlobalLibrariesByParentGlobalLibraryId(e){return Pi(this,void 0,void 0,function*(){const{global_libraries:o}=yield this.fetchGlobalLibraries();return Gi.mapParentToChildGlobalLibraries(o)[e]||[]})}static splitParentAndChildGlobalLibraries(e){let o=[],n=[];return e.forEach(b=>{b.parent_global_library_id===null?n=[...n,b]:o=[...o,b]}),{childGlobalLibraries:o,parentGlobalLibraries:n}}static mapParentToChildGlobalLibraries(e){let o={};return(0,nh.cloneDeep)(e).forEach(n=>{n.parent_global_library_id!==null&&(o[n.parent_global_library_id]||(o[n.parent_global_library_id]=[]),o[n.parent_global_library_id]=[...o[n.parent_global_library_id],n])}),o}static upcast(e){return Object.assign(Object.assign({},e),{library:Object.assign({views:[],customFields:{}},e.library||{})})}}Ob.GlobalLibraryRepository=Gi;var cM={},Lr={};Object.defineProperty(Lr,"__esModule",{value:!0});Lr.VizzlyApiClientLogger=void 0;class b2{static setBackend(e){this.backend=e}static debug(...e){b2.backend&&b2.backend.debug(...e)}static info(...e){b2.backend&&b2.backend.info(...e)}static warning(...e){b2.backend&&b2.backend.warning(...e)}static error(...e){b2.backend&&b2.backend.error(...e)}}Lr.VizzlyApiClientLogger=b2;b2.UserAgentProduct="Vizzly-Api-Client";var qa=O0&&O0.__awaiter||function(t,e,o,n){function b(a){return a instanceof o?a:new o(function(O){O(a)})}return new(o||(o=Promise))(function(a,O){function A(v){try{y(n.next(v))}catch(N){O(N)}}function c(v){try{y(n.throw(v))}catch(N){O(N)}}function y(v){v.done?a(v.value):b(v.value).then(A,c)}y((n=n.apply(t,e||[])).next())})};Object.defineProperty(cM,"__esModule",{value:!0});cM.DashboardManager=void 0;const no=P0,il=Ob,ah=Lr;class fr{constructor(e){this.vizzly=e}create(e){return qa(this,void 0,void 0,function*(){return yield this.vizzly.getDashboardRepository().createDashboard(e)})}update(e){return qa(this,void 0,void 0,function*(){var o;const n=this.vizzly.getDashboardRepository(),b=this.vizzly.getGlobalLibraryRepository(),[{global_libraries:a,permissions:O},{dashboards:A,permissions:c}]=yield Promise.all([b.fetchGlobalLibraries(e),n.fetchDashboards(e)]),y=A.find(q=>q.id===e.dashboardId);if(!y)throw new Error("Cannot find dashboard to update.");const{parentGlobalLibraries:v,childGlobalLibraries:N}=il.GlobalLibraryRepository.splitParentAndChildGlobalLibraries(a),s=c.find(q=>q.scope==="read_write"&&q.dashboardId===e.dashboardId);if(!s)throw new Error("Failed to find update token for dashboard.");const u=yield n.updateDashboard(Object.assign(Object.assign({},e),{dashboardPermission:s}));let d=[];!((o=e.definition)===null||o===void 0)&&o.componentLibrary&&(d=(0,no.cloneDeep)(e.definition.componentLibrary||[]).filter(q=>y.parent_dashboard_id===null?!0:!q.attributes.protectedByOrganisation));const M=(y.parent_dashboard_id===null?v:N).map(q=>qa(this,void 0,void 0,function*(){var l;const f=O.find(g=>g.globalLibraryId===q.id&&g.scope==="read_write");f||ah.VizzlyApiClientLogger.error("No write permission found."),f&&(yield b.updateGlobalLibrary({globalLibrarySessionToken:f.token,library:{views:d,customFields:((l=e.definition)===null||l===void 0?void 0:l.customFields)||{}}}))}));return yield Promise.all(M),u})}getDashboards(e){return qa(this,void 0,void 0,function*(){const o=this.vizzly.getDashboardRepository(),n=this.vizzly.getGlobalLibraryRepository(),[{dashboards:b},{global_libraries:a}]=yield Promise.all([o.fetchDashboards(e),n.fetchGlobalLibraries(e)]);return fr.mergeDashboardsAndGlobalLibraries(b,a)})}static mergeDashboardsAndGlobalLibraries(e,o){return(0,no.cloneDeep)(e).map(n=>{let b=(0,no.cloneDeep)(n.definition.componentLibrary),a=n.parent_dashboard_id===null?[]:e.find(y=>y.id===n.parent_dashboard_id).definition.componentLibrary,{parentGlobalLibraries:O,childGlobalLibraries:A}=il.GlobalLibraryRepository.splitParentAndChildGlobalLibraries(o);A=n.parent_dashboard_id===null?[]:A;let c=(0,no.uniqBy)([...fr.markViewsAsProtected(O.flatMap(y=>y.library.views||[])),...A.flatMap(y=>y.library.views||[]),...fr.markViewsAsProtected(a),...n.parent_dashboard_id===null?fr.markViewsAsProtected(b):b||[]],y=>y.attributes.viewId);return n.definition.componentLibrary=c,n.definition.customFields=fr.mergeCustomFields(n,e,O,A),n})}static mergeCustomFields(e,o,n,b){var a;const O=e.parent_dashboard_id===null?{}:((a=o.find(c=>c.id===e.parent_dashboard_id))===null||a===void 0?void 0:a.definition.customFields)||{};return((...c)=>c.reduce((y,v)=>(Object.keys(y||{}).forEach(N=>{v[N]||(v[N]=[]),v[N]=(0,no.uniqBy)([...v[N],...y?.[N]||[]],s=>s.id)}),v),{}))((0,no.cloneDeep)(e.definition.customFields)||{},(0,no.cloneDeep)(O)||{},...(0,no.cloneDeep)(b).map(c=>c.library.customFields||{}),...(0,no.cloneDeep)(n).map(c=>c.library.customFields||{}))}static markViewsAsProtected(e){return(e||[]).map(o=>Object.assign(Object.assign({},o),{attributes:Object.assign(Object.assign({},o.attributes),{protectedByOrganisation:!0})}))}}cM.DashboardManager=fr;var sM={},qs=O0&&O0.__awaiter||function(t,e,o,n){function b(a){return a instanceof o?a:new o(function(O){O(a)})}return new(o||(o=Promise))(function(a,O){function A(v){try{y(n.next(v))}catch(N){O(N)}}function c(v){try{y(n.throw(v))}catch(N){O(N)}}function y(v){v.done?a(v.value):b(v.value).then(A,c)}y((n=n.apply(t,e||[])).next())})};Object.defineProperty(sM,"__esModule",{value:!0});sM.GlobalLibraryManager=void 0;class Mh{constructor(e){this.vizzly=e}create(e){return qs(this,void 0,void 0,function*(){return yield this.vizzly.getGlobalLibraryRepository().createGlobalLibrary(e)})}update(e){return qs(this,void 0,void 0,function*(){const o=this.vizzly.getGlobalLibraryRepository(),{global_libraries:n,permissions:b}=yield o.fetchGlobalLibraries(e);if(!n.find(c=>c.id===e.globalLibraryId))throw new Error("Global library not found");const O=b.find(c=>c.globalLibraryId===e.globalLibraryId&&c.scope==="read_write");if(!O)throw new Error("No write permission for this library");return yield o.updateGlobalLibrary({globalLibrarySessionToken:O.token,library:e.library})})}getGlobalLibraries(e){return qs(this,void 0,void 0,function*(){return yield this.vizzly.getGlobalLibraryRepository().fetchGlobalLibraries(e)})}}sM.GlobalLibraryManager=Mh;Object.defineProperty(aM,"__esModule",{value:!0});aM.Vizzly=void 0;const zh=bb,ch=xn,sh=Ob,Oh=cM,lh=sM;let Ah=class{constructor(e,o){this.APIs=e,this.implementationStrategy=o,this.dashboardManager=new Oh.DashboardManager(this),this.dashboardRepository=new ch.DashboardRepository(this),this.globalLibraryRepository=new sh.GlobalLibraryRepository(this),this.globalLibraryManager=new lh.GlobalLibraryManager(this)}getAPIs(){if(this.implementationStrategy.shouldPersistViaQueryEngine()&&!this.APIs.vizzlyQueryEngineApi)throw new zh.MissingRequiredVizzlyQueryEngineApi("Strategy is to persist via a query engine. However no query engine API was provided.");return this.APIs}getVizzlyAppApi(){return this.getAPIs().vizzlyAppApi}getVizzlyQueryEngineAPI(){return this.getAPIs().vizzlyQueryEngineApi}getVizzlyAPI(){return this.getAPIs().vizzlyApi}getDashboardRepository(){return this.dashboardRepository}getGlobalLibraryRepository(){return this.globalLibraryRepository}getDashboardManager(){return this.dashboardManager}getGlobalLibraryManager(){return this.globalLibraryManager}};aM.Vizzly=Ah;var OM={},Cn={},Fs={exports:{}};(function(t,e){var o=typeof globalThis<"u"&&globalThis||typeof ot<"u"&&ot||typeof O0<"u"&&O0,n=function(){function a(){this.fetch=!1,this.DOMException=o.DOMException}return a.prototype=o,new a}();(function(a){(function(O){var A=typeof a<"u"&&a||typeof ot<"u"&&ot||typeof A<"u"&&A,c={searchParams:"URLSearchParams"in A,iterable:"Symbol"in A&&"iterator"in Symbol,blob:"FileReader"in A&&"Blob"in A&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in A,arrayBuffer:"ArrayBuffer"in A};function y(V){return V&&DataView.prototype.isPrototypeOf(V)}if(c.arrayBuffer)var v=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],N=ArrayBuffer.isView||function(V){return V&&v.indexOf(Object.prototype.toString.call(V))>-1};function s(V){if(typeof V!="string"&&(V=String(V)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(V)||V==="")throw new TypeError('Invalid character in header field name: "'+V+'"');return V.toLowerCase()}function u(V){return typeof V!="string"&&(V=String(V)),V}function d(V){var Z={next:function(){var u0=V.shift();return{done:u0===void 0,value:u0}}};return c.iterable&&(Z[Symbol.iterator]=function(){return Z}),Z}function z(V){this.map={},V instanceof z?V.forEach(function(Z,u0){this.append(u0,Z)},this):Array.isArray(V)?V.forEach(function(Z){this.append(Z[0],Z[1])},this):V&&Object.getOwnPropertyNames(V).forEach(function(Z){this.append(Z,V[Z])},this)}z.prototype.append=function(V,Z){V=s(V),Z=u(Z);var u0=this.map[V];this.map[V]=u0?u0+", "+Z:Z},z.prototype.delete=function(V){delete this.map[s(V)]},z.prototype.get=function(V){return V=s(V),this.has(V)?this.map[V]:null},z.prototype.has=function(V){return this.map.hasOwnProperty(s(V))},z.prototype.set=function(V,Z){this.map[s(V)]=u(Z)},z.prototype.forEach=function(V,Z){for(var u0 in this.map)this.map.hasOwnProperty(u0)&&V.call(Z,this.map[u0],u0,this)},z.prototype.keys=function(){var V=[];return this.forEach(function(Z,u0){V.push(u0)}),d(V)},z.prototype.values=function(){var V=[];return this.forEach(function(Z){V.push(Z)}),d(V)},z.prototype.entries=function(){var V=[];return this.forEach(function(Z,u0){V.push([u0,Z])}),d(V)},c.iterable&&(z.prototype[Symbol.iterator]=z.prototype.entries);function M(V){if(V.bodyUsed)return Promise.reject(new TypeError("Already read"));V.bodyUsed=!0}function q(V){return new Promise(function(Z,u0){V.onload=function(){Z(V.result)},V.onerror=function(){u0(V.error)}})}function l(V){var Z=new FileReader,u0=q(Z);return Z.readAsArrayBuffer(V),u0}function f(V){var Z=new FileReader,u0=q(Z);return Z.readAsText(V),u0}function g(V){for(var Z=new Uint8Array(V),u0=new Array(Z.length),L0=0;L0<Z.length;L0++)u0[L0]=String.fromCharCode(Z[L0]);return u0.join("")}function L(V){if(V.slice)return V.slice(0);var Z=new Uint8Array(V.byteLength);return Z.set(new Uint8Array(V)),Z.buffer}function T(){return this.bodyUsed=!1,this._initBody=function(V){this.bodyUsed=this.bodyUsed,this._bodyInit=V,V?typeof V=="string"?this._bodyText=V:c.blob&&Blob.prototype.isPrototypeOf(V)?this._bodyBlob=V:c.formData&&FormData.prototype.isPrototypeOf(V)?this._bodyFormData=V:c.searchParams&&URLSearchParams.prototype.isPrototypeOf(V)?this._bodyText=V.toString():c.arrayBuffer&&c.blob&&y(V)?(this._bodyArrayBuffer=L(V.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):c.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(V)||N(V))?this._bodyArrayBuffer=L(V):this._bodyText=V=Object.prototype.toString.call(V):this._bodyText="",this.headers.get("content-type")||(typeof V=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):c.searchParams&&URLSearchParams.prototype.isPrototypeOf(V)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},c.blob&&(this.blob=function(){var V=M(this);if(V)return V;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var V=M(this);return V||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else return this.blob().then(l)}),this.text=function(){var V=M(this);if(V)return V;if(this._bodyBlob)return f(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(g(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},c.formData&&(this.formData=function(){return this.text().then(w)}),this.json=function(){return this.text().then(JSON.parse)},this}var X=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function C(V){var Z=V.toUpperCase();return X.indexOf(Z)>-1?Z:V}function m(V,Z){if(!(this instanceof m))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');Z=Z||{};var u0=Z.body;if(V instanceof m){if(V.bodyUsed)throw new TypeError("Already read");this.url=V.url,this.credentials=V.credentials,Z.headers||(this.headers=new z(V.headers)),this.method=V.method,this.mode=V.mode,this.signal=V.signal,!u0&&V._bodyInit!=null&&(u0=V._bodyInit,V.bodyUsed=!0)}else this.url=String(V);if(this.credentials=Z.credentials||this.credentials||"same-origin",(Z.headers||!this.headers)&&(this.headers=new z(Z.headers)),this.method=C(Z.method||this.method||"GET"),this.mode=Z.mode||this.mode||null,this.signal=Z.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&u0)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(u0),(this.method==="GET"||this.method==="HEAD")&&(Z.cache==="no-store"||Z.cache==="no-cache")){var L0=/([?&])_=[^&]*/;if(L0.test(this.url))this.url=this.url.replace(L0,"$1_="+new Date().getTime());else{var X0=/\?/;this.url+=(X0.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}m.prototype.clone=function(){return new m(this,{body:this._bodyInit})};function w(V){var Z=new FormData;return V.trim().split("&").forEach(function(u0){if(u0){var L0=u0.split("="),X0=L0.shift().replace(/\+/g," "),B0=L0.join("=").replace(/\+/g," ");Z.append(decodeURIComponent(X0),decodeURIComponent(B0))}}),Z}function E(V){var Z=new z,u0=V.replace(/\r?\n[\t ]+/g," ");return u0.split("\r").map(function(L0){return L0.indexOf(`
29
- `)===0?L0.substr(1,L0.length):L0}).forEach(function(L0){var X0=L0.split(":"),B0=X0.shift().trim();if(B0){var $0=X0.join(":").trim();Z.append(B0,$0)}}),Z}T.call(m.prototype);function U(V,Z){if(!(this instanceof U))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');Z||(Z={}),this.type="default",this.status=Z.status===void 0?200:Z.status,this.ok=this.status>=200&&this.status<300,this.statusText=Z.statusText===void 0?"":""+Z.statusText,this.headers=new z(Z.headers),this.url=Z.url||"",this._initBody(V)}T.call(U.prototype),U.prototype.clone=function(){return new U(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new z(this.headers),url:this.url})},U.error=function(){var V=new U(null,{status:0,statusText:""});return V.type="error",V};var z0=[301,302,303,307,308];U.redirect=function(V,Z){if(z0.indexOf(Z)===-1)throw new RangeError("Invalid status code");return new U(null,{status:Z,headers:{location:V}})},O.DOMException=A.DOMException;try{new O.DOMException}catch{O.DOMException=function(Z,u0){this.message=Z,this.name=u0;var L0=Error(Z);this.stack=L0.stack},O.DOMException.prototype=Object.create(Error.prototype),O.DOMException.prototype.constructor=O.DOMException}function a0(V,Z){return new Promise(function(u0,L0){var X0=new m(V,Z);if(X0.signal&&X0.signal.aborted)return L0(new O.DOMException("Aborted","AbortError"));var B0=new XMLHttpRequest;function $0(){B0.abort()}B0.onload=function(){var d1={status:B0.status,statusText:B0.statusText,headers:E(B0.getAllResponseHeaders()||"")};d1.url="responseURL"in B0?B0.responseURL:d1.headers.get("X-Request-URL");var k1="response"in B0?B0.response:B0.responseText;setTimeout(function(){u0(new U(k1,d1))},0)},B0.onerror=function(){setTimeout(function(){L0(new TypeError("Network request failed"))},0)},B0.ontimeout=function(){setTimeout(function(){L0(new TypeError("Network request failed"))},0)},B0.onabort=function(){setTimeout(function(){L0(new O.DOMException("Aborted","AbortError"))},0)};function h1(d1){try{return d1===""&&A.location.href?A.location.href:d1}catch{return d1}}B0.open(X0.method,h1(X0.url),!0),X0.credentials==="include"?B0.withCredentials=!0:X0.credentials==="omit"&&(B0.withCredentials=!1),"responseType"in B0&&(c.blob?B0.responseType="blob":c.arrayBuffer&&X0.headers.get("Content-Type")&&X0.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(B0.responseType="arraybuffer")),Z&&typeof Z.headers=="object"&&!(Z.headers instanceof z)?Object.getOwnPropertyNames(Z.headers).forEach(function(d1){B0.setRequestHeader(d1,u(Z.headers[d1]))}):X0.headers.forEach(function(d1,k1){B0.setRequestHeader(k1,d1)}),X0.signal&&(X0.signal.addEventListener("abort",$0),B0.onreadystatechange=function(){B0.readyState===4&&X0.signal.removeEventListener("abort",$0)}),B0.send(typeof X0._bodyInit>"u"?null:X0._bodyInit)})}return a0.polyfill=!0,A.fetch||(A.fetch=a0,A.Headers=z,A.Request=m,A.Response=U),O.Headers=z,O.Request=m,O.Response=U,O.fetch=a0,O})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var b=o.fetch?o:n;e=b.fetch,e.default=b.fetch,e.fetch=b.fetch,e.Headers=b.Headers,e.Request=b.Request,e.Response=b.Response,t.exports=e})(Fs,Fs.exports);var bA=Fs.exports;const dh=pM(bA);var lM={},uh=O0&&O0.__awaiter||function(t,e,o,n){function b(a){return a instanceof o?a:new o(function(O){O(a)})}return new(o||(o=Promise))(function(a,O){function A(v){try{y(n.next(v))}catch(N){O(N)}}function c(v){try{y(n.throw(v))}catch(N){O(N)}}function y(v){v.done?a(v.value):b(v.value).then(A,c)}y((n=n.apply(t,e||[])).next())})};Object.defineProperty(lM,"__esModule",{value:!0});lM.Monitor=void 0;const fh=Lr;class qh{static timeRequest(e,o,n){return function(...b){return uh(this,void 0,void 0,function*(){const a=performance.now(),O=yield n(...b),c=performance.now()-a;return fh.VizzlyApiClientLogger.debug(`[@vizzly/api-client timing] ${e.toUpperCase()} ${o} - ${c.toFixed(2)}ms`),O})}}}lM.Monitor=qh;var En={};Object.defineProperty(En,"__esModule",{value:!0});En.Path=void 0;class qr{static removeAnyWrappingForwardSlash(e){return e.startsWith("/")?qr.removeAnyWrappingForwardSlash(e.slice(1)):e.endsWith("/")?qr.removeAnyWrappingForwardSlash(e.slice(0,-1)):e}static baseIsValid(e){return e.startsWith("https://")||e.startsWith("http://")||e.startsWith(".")}static buildPath(e,o){const n=qr.removeAnyWrappingForwardSlash(e),b=qr.removeAnyWrappingForwardSlash(o),a=qr.baseIsValid(e)?"":"/";return n==""&&b==""?"/":b==""?`${a}${n}`:n!=""&&b!=""?`${a}${n}/${b}`:`${a}${b}`}static addQueryParam(e,o,n){const[b,a]=e.split("#"),[O,A]=b.split("?");var c=new URLSearchParams(A);c.set(o,n);var y=O+"?"+c.toString()+(a?`#${a}`:"");return y}static hasHashtag(e){return e.includes("#")}static setVizzlyHashtagValue(e,o){return`${e}#vizzly_${o}`}static getVizzlyHashtagValue(e){return e.split("#vizzly_")[1]||null}}En.Path=qr;const Wh="@vizzly/api-client",hh="0.0.57",mh="NONE",gh="src/index.ts",yh="dist/index.js",Rh="dist/index.d.ts",Lh="commonjs",vh=["dist"],_h={"@types/jest":"^29.5.12","@types/lodash":"^4.17.0","@types/uuid":"^9.0.8","@vizzly/auth":"^0.2.16",jest:"^29.6.0",lodash:"^4.17.21",nock:"^13.5.4",prettier:"^3.2.5","ts-jest":"^29.1.1","ts-loader":"^9.5.1",typescript:"^5.3.2",uuid:"^9.0.1"},Nh={test:". ./secrets.env && jest","test:ci":"jest",build:"rm -rf ./dist && tsc",dev:"tsc -w",format:"prettier --write ./src/** ./__tests__/**",prepublish:"yarn build"},Th={"@vizzly/semantic-layer-public":">=0.0.231","@vizzly/sqlbuilder-public":">=0.1.41","cross-fetch":"^4.0.0"},Bh={name:Wh,version:hh,private:!1,license:mh,source:gh,main:yh,types:Rh,type:Lh,files:vh,devDependencies:_h,scripts:Nh,dependencies:Th};var Sh=O0&&O0.__awaiter||function(t,e,o,n){function b(a){return a instanceof o?a:new o(function(O){O(a)})}return new(o||(o=Promise))(function(a,O){function A(v){try{y(n.next(v))}catch(N){O(N)}}function c(v){try{y(n.throw(v))}catch(N){O(N)}}function y(v){v.done?a(v.value):b(v.value).then(A,c)}y((n=n.apply(t,e||[])).next())})},wh=O0&&O0.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Cn,"__esModule",{value:!0});Cn.Api=void 0;const xh=wh(bA),Xh=lM,Ws=Lr,Ch=En;class Eh{constructor(e,o,n=()=>({})){this.host=o,this.extraHeaders=n,this.auth=e}execute(e){return Sh(this,void 0,void 0,function*(){var o,n;const b=this.auth.buildAuthHeaders(e.acceptedAuthParams),a=Object.assign(Object.assign({},e.headers||{}),this.extraHeaders()||{}),O=Ch.Path.buildPath(this.host,e.path),c=yield Xh.Monitor.timeRequest(e.method,O,xh.default)(O,{method:e.method,headers:Object.assign(Object.assign({"Content-Type":"application/json",Accept:"application/json","Vizzly-User-Agent":`${Ws.VizzlyApiClientLogger.UserAgentProduct}${this.originApp()} (Using client ${(o=Bh)===null||o===void 0?void 0:o.version})`},b),a),redirect:"follow",referrerPolicy:"no-referrer",body:e.body?JSON.stringify(e.body):null,signal:e.abortSignal});let y=!((n=c.headers.get("content-type"))===null||n===void 0)&&n.includes("json")?yield c.json():c.text();const v=c.headers.get("vizzly-query-engine-request-id")||"-",N=c.headers.get("x-request-id")||"-";return c.status===500&&Ws.VizzlyApiClientLogger.debug(`[TRACING] QE; ${v} - API; ${N}`),Ws.VizzlyApiClientLogger.debug(`[TRACING] QE; ${v} - API; ${N}`),{body:y,status:c.status,headers:c.headers}})}originApp(){if(!(typeof window<"u"&&window.document)){const o=process.env.NODE_ENV==="test"?"tests":"",n=process.env.VIZZLY_ORIGIN_APP||o||"";return n==""?"":` (${n})`}return""}getAuth(){return this.auth}}Cn.Api=Eh;var AM={},dM={};Object.defineProperty(dM,"__esModule",{value:!0});dM.FailedToFetchDashboards=void 0;class Dh extends Error{constructor(e){super(e),this.name="FailedToFetchDashboards"}}dM.FailedToFetchDashboards=Dh;var lb={};Object.defineProperty(lb,"__esModule",{value:!0});lb.MissingAuthParameter=void 0;class Ih extends Error{constructor(e){super(`Missing required auth parameter ${e}`)}}lb.MissingAuthParameter=Ih;var Ab={};Object.defineProperty(Ab,"__esModule",{value:!0});Ab.ValidationError=void 0;let Ph=class extends Error{constructor(e){super(e),this.name="ValidationError"}};Ab.ValidationError=Ph;var db={};Object.defineProperty(db,"__esModule",{value:!0});db.SQLPreviewError=void 0;const Fh=Ab;class kh extends Fh.ValidationError{constructor(e){super(e),this.name="SQLPreviewError"}}db.SQLPreviewError=kh;var ub={};Object.defineProperty(ub,"__esModule",{value:!0});ub.FailedToSetupProject=void 0;class jh extends Error{constructor(e){super(e),this.name="FailedToSetupProject"}}ub.FailedToSetupProject=jh;var fb={};Object.defineProperty(fb,"__esModule",{value:!0});fb.FailedToResolveDataSets=void 0;let $h=class extends Error{constructor(e){super(e),this.name="FailedToResolveDataSets"}};fb.FailedToResolveDataSets=$h;var uM={};Object.defineProperty(uM,"__esModule",{value:!0});uM.FailedToCreateGlobalLibrary=void 0;class Uh extends Error{constructor(e){super(e),this.name="FailedToCreateGlobalLibrary"}}uM.FailedToCreateGlobalLibrary=Uh;var qb={};Object.defineProperty(qb,"__esModule",{value:!0});qb.FailedToFetchVizzlyConfig=void 0;class Gh extends Error{constructor(e){super(e),this.name="FailedToFetchVizzlyConfig"}}qb.FailedToFetchVizzlyConfig=Gh;var Wb={};Object.defineProperty(Wb,"__esModule",{value:!0});Wb.ConnectionDoesNotExistOnProject=void 0;class Vh extends Error{constructor(e){super(e),this.name="ConnectionDoesNotExistOnProject"}}Wb.ConnectionDoesNotExistOnProject=Vh;var hb={};Object.defineProperty(hb,"__esModule",{value:!0});hb.FailedToFetchConnection=void 0;class Hh extends Error{constructor(e){super(e),this.name="FailedToFetchConnection"}}hb.FailedToFetchConnection=Hh;var mb={};Object.defineProperty(mb,"__esModule",{value:!0});mb.FailedToFetchProject=void 0;class Yh extends Error{constructor(e){super(e),this.name="FailedToFetchProject"}}mb.FailedToFetchProject=Yh;var fM={};Object.defineProperty(fM,"__esModule",{value:!0});fM.FailedToFetchProjects=void 0;class Kh extends Error{constructor(e){super(e),this.name="FailedToFetchProjects"}}fM.FailedToFetchProjects=Kh;var qM={};Object.defineProperty(qM,"__esModule",{value:!0});qM.FailedToFetchTeamMembers=void 0;class Qh extends Error{constructor(e){super(e),this.name="FailedToFetchTeamMembers"}}qM.FailedToFetchTeamMembers=Qh;var WM={};Object.defineProperty(WM,"__esModule",{value:!0});WM.FailedToCreateQueryEngineUser=void 0;class Zh extends Error{constructor(e){super(e),this.name="FailedToCreateQueryEngineUser"}}WM.FailedToCreateQueryEngineUser=Zh;var hM={};Object.defineProperty(hM,"__esModule",{value:!0});hM.FailedToFetchQueryEngineUser=void 0;class Jh extends Error{constructor(e){super(e),this.name="FailedToFetchQueryEngineUser"}}hM.FailedToFetchQueryEngineUser=Jh;var gb={};Object.defineProperty(gb,"__esModule",{value:!0});gb.ProjectEncryptedSecretAlreadySaved=void 0;class em extends Error{constructor(e){super(`Project encrypted encryption secret already exists for ${e}`),this.name="ProjectEncryptedSecretAlreadySaved"}}gb.ProjectEncryptedSecretAlreadySaved=em;var yb={};Object.defineProperty(yb,"__esModule",{value:!0});yb.FailedToSaveProjectEncryptedEncryptionSecret=void 0;class tm extends Error{constructor(e){super(`Failed to save project encrypted encryption secret for ${e}`),this.name="FailedToSaveProjectEncryptedEncryptionSecret"}}yb.FailedToSaveProjectEncryptedEncryptionSecret=tm;var mM={};Object.defineProperty(mM,"__esModule",{value:!0});mM.PermissionDenied=void 0;class om extends Error{constructor(e){super(e)}}mM.PermissionDenied=om;(function(t){var e=O0&&O0.__createBinding||(Object.create?function(n,b,a,O){O===void 0&&(O=a);var A=Object.getOwnPropertyDescriptor(b,a);(!A||("get"in A?!b.__esModule:A.writable||A.configurable))&&(A={enumerable:!0,get:function(){return b[a]}}),Object.defineProperty(n,O,A)}:function(n,b,a,O){O===void 0&&(O=a),n[O]=b[a]}),o=O0&&O0.__exportStar||function(n,b){for(var a in n)a!=="default"&&!Object.prototype.hasOwnProperty.call(b,a)&&e(b,n,a)};Object.defineProperty(t,"__esModule",{value:!0}),o(pb,t),o(ab,t),o(zb,t),o(dM,t),o(lb,t),o(bb,t),o(Ab,t),o(db,t),o(ub,t),o(fb,t),o(uM,t),o(Mb,t),o(cb,t),o(qb,t),o(Wb,t),o(hb,t),o(mb,t),o(fM,t),o(qM,t),o(WM,t),o(hM,t),o(gb,t),o(yb,t),o(mM,t)})(AM);var gM={};Object.defineProperty(gM,"__esModule",{value:!0});gM.FailedToUpdateQueryEngineUser=void 0;class rm extends Error{constructor(e){super(e),this.name="FailedToUpdateQueryEngineUser"}}gM.FailedToUpdateQueryEngineUser=rm;var R1=O0&&O0.__awaiter||function(t,e,o,n){function b(a){return a instanceof o?a:new o(function(O){O(a)})}return new(o||(o=Promise))(function(a,O){function A(v){try{y(n.next(v))}catch(N){O(N)}}function c(v){try{y(n.throw(v))}catch(N){O(N)}}function y(v){v.done?a(v.value):b(v.value).then(A,c)}y((n=n.apply(t,e||[])).next())})};Object.defineProperty(OM,"__esModule",{value:!0});OM.VizzlyApi=void 0;const nm=Cn,gn=AM,im=qb,bm=Wb,pm=hb,am=mb,Mm=gM,zm=yb,cm=gb,bl=xn;class sm extends nm.Api{constructor(e,o="https://api.vizzly.co"){super(e,o)}buildFetchDashboardAccessTokensRequest(e){return{path:"/api/v2/auth/dashboards/access",method:"post",body:{dashboardAccessToken:this.auth.getDashboardAccessToken(),projectAdminOverrideToken:this.auth.getProjectAdminOverrideToken()},abortSignal:e?.abortSignal}}fetchGlobalLibraries(e){return R1(this,void 0,void 0,function*(){return yield this.execute(this.buildFetchGlobalLibrariesRequest(e))})}buildFetchGlobalLibrariesRequest(e){return{path:"/api/v2/multi-get-global-library",method:"post",body:{globalLibraryAccessTokens:e.globalLibraryAccessTokens},abortSignal:e.abortSignal}}fetchGlobalLibraryAccessTokens(e){return R1(this,void 0,void 0,function*(){return yield this.execute(this.buildFetchGlobalLibraryAccessTokensRequest(e))})}buildFetchGlobalLibraryAccessTokensRequest(e){return{path:"/api/v2/auth/global-library/access",method:"post",body:{dashboardAccessToken:this.auth.getDashboardAccessToken(),projectAdminOverrideToken:this.auth.getProjectAdminOverrideToken()},abortSignal:e?.abortSignal}}buildCreateDashboardRequest(e){return{path:"/api/v2/dashboard",method:"post",body:{dashboardAccessToken:this.auth.getDashboardAccessToken(),definition:e.definition||bl.DashboardRepository.EmptyDashboardDefinition(),meta:e.metadata||e.meta||{},parentDashboardId:e.parentDashboardId,permissions:e.permissions,usage_metadata:e.usage_metadata},abortSignal:e.abortSignal}}buildFetchDashboardsRequest(e){return{path:"/api/v2/multi-get-dashboard",method:"post",body:{dashboardAccessTokens:e.dashboardSessionAccessTokens},abortSignal:e.abortSignal}}createParentDashboard(e){return R1(this,void 0,void 0,function*(){return yield this.execute(this.buildCreateParentDashboardRequest(e))})}buildCreateParentDashboardRequest(e){return{path:"/api/v2/parent-dashboard",method:"post",body:{projectId:e.projectId,definition:e.definition||bl.DashboardRepository.EmptyDashboardDefinition(),name:e.name},abortSignal:e.abortSignal}}createParentGlobalLibrary(e){return R1(this,void 0,void 0,function*(){return yield this.execute(this.buildCreateParentGlobalLibraryRequest(e))})}buildCreateParentGlobalLibraryRequest(e){return{path:"/api/v2/parent-global-library",method:"post",body:{projectId:e.projectId,library:e.library},abortSignal:e.abortSignal}}createGlobalLibrary(e){return R1(this,void 0,void 0,function*(){const o=yield this.execute(this.buildCreateGlobalLibraryRequest(e));if(o.status===200)return o.body;throw o.status===403?new gn.PermissionDenied("Permission denied when creating a global library via the Vizzly API."):new gn.FailedToCreateGlobalLibrary(`Failed to create global library, got status ${o.status}`)})}buildCreateGlobalLibraryRequest(e){return{path:"/api/v2/global-library",method:"post",body:{dashboardAccessToken:this.auth.getDashboardAccessToken(),parentGlobalLibraryId:e.parentGlobalLibraryId,library:e.library,permissions:e.permissions},abortSignal:e.abortSignal}}getProjects(e){return R1(this,void 0,void 0,function*(){const o=yield this.execute(this.buildGetProjectsRequest(e));if(o.status===200)return{projects:o.body.projects};throw new gn.FailedToFetchProjects(`Failed to fetch projects. Got status ${o.status}`)})}buildGetProjectsRequest(e){return{path:`/api/v2/projects${e?.withParentDashboards?"?with_parent_dashboards=true":""}`,method:"get",abortSignal:e?.abortSignal}}createProjectApiKey(e){return R1(this,void 0,void 0,function*(){return yield this.execute(this.buildCreateProjectApiKeyRequest(e))})}buildCreateProjectApiKeyRequest(e){return{path:`/api/v3/project/${e.projectId}/api-key`,method:"post",body:{},abortSignal:e.abortSignal}}createQueryEngineUser(e){return R1(this,void 0,void 0,function*(){const o=yield this.execute(this.buildCreateQueryEngineUserRequest(e));if(o.status===200)return o.body.query_engine_user;throw new gn.FailedToCreateQueryEngineUser(`Failed to create query engine user. Got status ${o.status}`)})}buildCreateQueryEngineUserRequest(e){return{path:`/api/v3/project/${e.projectId}/query-engine-user`,method:"post",body:{email:e.email,password:e.password},abortSignal:e.abortSignal}}buildCreateSelfHostedDynamicQueryEngineProjectRequest(e){return{path:"/api/v2/project/self-hosted-dynamic-query-engine",method:"post",body:{},abortSignal:e?.abortSignal}}buildCreateSelfHostedInBrowserProjectRequest(e){return{path:"/api/v2/project/self-hosted-in-browser",method:"post",body:{},abortSignal:e?.abortSignal}}buildCreateSelfHostedProjectRequest(e){return{path:"/api/v2/project/self-hosted-query-engine",method:"post",body:{},abortSignal:e?.abortSignal}}createManagedQueryEngineProject(e){return R1(this,void 0,void 0,function*(){return yield this.execute(this.buildCreateManagedQueryEngineProjectRequest(e))})}buildCreateManagedQueryEngineProjectRequest(e){return{path:"/api/v2/project/managed-query-engine",method:"post",body:{parent_dashboard_definition:{}},abortSignal:e?.abortSignal}}createVizzlyConfigVersion(e){return R1(this,void 0,void 0,function*(){return yield this.execute(this.buildCreateVizzlyConfigVersionRequest(e))})}buildCreateVizzlyConfigVersionRequest(e){return{path:`/api/v3/project/${e.projectId}/config`,method:"post",body:{projectId:e.projectId,encryptedConfig:e.encryptedConfig},abortSignal:e.abortSignal}}duplicateDashboards(e){return R1(this,void 0,void 0,function*(){return yield this.execute(this.buildDuplicateDashboardsRequest(e))})}buildDuplicateDashboardsRequest(e){return{path:"/api/v2/duplicate-dashboards",method:"post",body:{dashboardIds:e.dashboardIds},abortSignal:e.abortSignal,acceptedAuthParams:["projectApiKey"]}}duplicateParentDashboard(e){return R1(this,void 0,void 0,function*(){return yield this.execute(this.buildDuplicateParentDashboardRequest(e))})}buildDuplicateParentDashboardRequest(e){return{path:"/api/v2/duplicate-parent-dashboard",method:"post",body:{dashboardId:e.dashboardId},abortSignal:e.abortSignal}}getConnection(e){return R1(this,void 0,void 0,function*(){const o=yield this.execute(this.buildGetConnectionRequest(e));if(o.status===200)return{encryptedCredentials:o.body.encrypted_credentials};throw o.status==404?new bm.ConnectionDoesNotExistOnProject("An active connection does not exist on the project"):new pm.FailedToFetchConnection(`Failed to fetch connection for the project. Got status ${o.status}`)})}buildGetConnectionRequest(e){return{path:`/api/v2/project/${e.projectId}/connection`,method:"get",abortSignal:e.abortSignal,acceptedAuthParams:["projectApiKey","projectAccessToken"]}}getManagedQueryEngineKeyPair(e){return R1(this,void 0,void 0,function*(){return yield this.execute(this.buildGetManagedQueryEngineKeyPairRequest(e))})}buildGetManagedQueryEngineKeyPairRequest(e){return{path:`/api/v2/project/managed-query-engine/${e.managedProjectId}/key-pairs/${e.keyPairId}`,method:"get",abortSignal:e.abortSignal}}getProject(e){return R1(this,void 0,void 0,function*(){const o=yield this.execute(this.buildGetProjectRequest(e));if(o.status===200)return o.body;throw new am.FailedToFetchProject(`Failed to fetch project. Got status ${o.status}`)})}buildGetProjectRequest(e){const o=e.withParentDashboards?"?with_parent_dashboards=true":"";return{path:`/api/v3/project/${e.projectId}${o}`,method:"get",abortSignal:e.abortSignal,acceptedAuthParams:["projectApiKey","projectAccessToken","appSessionToken"]}}getProjectAccessToken(e){return R1(this,void 0,void 0,function*(){return yield this.execute(this.buildGetProjectAccessTokenRequest(e))})}buildGetProjectAccessTokenRequest(e){let o="";return e.resourceFilters&&(o=`filter=${e.resourceFilters.join(",")}`),{path:`/api/v2/auth/project/${e.projectId}/access_token?${o}`,method:"get",abortSignal:e.abortSignal,acceptedAuthParams:["projectApiKey","appSessionToken"]}}getQueryEngineUser(e){return R1(this,void 0,void 0,function*(){const o=yield this.execute(this.buildGetQueryEngineUserRequest(e));if(o.status===200)return o.body.query_engine_user;throw new gn.FailedToFetchQueryEngineUser(`Failed to fetch query engine user. Got status ${o.status}`)})}buildGetQueryEngineUserRequest(e){return{path:`/api/v3/project/${e.projectId}/query-engine-user?email=${encodeURIComponent(e.email)}`,method:"get",abortSignal:e.abortSignal,acceptedAuthParams:["projectApiKey","projectAccessToken"]}}getTeamMembers(e){return R1(this,void 0,void 0,function*(){const o=yield this.execute(this.buildGetTeamMembersRequest(e));if(o.status===200)return o.body;throw new gn.FailedToFetchTeamMembers(`Failed to fetch team members. Got status ${o.status}`)})}buildGetTeamMembersRequest(e){return{path:`/api/v3/project/${e.projectId}/organisation-team-members`,method:"get",abortSignal:e.abortSignal,acceptedAuthParams:["projectApiKey","projectAccessToken"]}}getVizzlyConfig(e){return R1(this,void 0,void 0,function*(){const o=yield this.execute(this.buildGetVizzlyConfigRequest(e));if(o.status===200)return{encryptedConfig:o.body.encrypted_config};throw new im.FailedToFetchVizzlyConfig(`Failed to fetch the config containing data sets from the Vizzly API. Got status ${o.status}`)})}buildGetVizzlyConfigRequest(e){return{path:`/api/v3/project/${e.projectId}/config`,method:"get",abortSignal:e.abortSignal,acceptedAuthParams:["projectApiKey","projectAccessToken"]}}saveConnection(e){return R1(this,void 0,void 0,function*(){return yield this.execute(this.buildSaveConnectionRequest(e))})}buildSaveConnectionRequest(e){return{path:"/api/v3/project/connection",method:"post",body:{projectId:e.projectId,encryptedConfig:e.encryptedConfig,encryptedConnection:e.encryptedConnection},abortSignal:e.abortSignal,acceptedAuthParams:["projectApiKey","projectAccessToken"]}}saveEncryptedProjectEncryptionSecret(e){return R1(this,void 0,void 0,function*(){const o=yield this.execute(this.buildSaveEncryptedProjectEncryptionSecretRequest(e));if(o.status===200)return!0;throw o.status==400&&!e.allowRotation?new cm.ProjectEncryptedSecretAlreadySaved(e.projectId):new zm.FailedToSaveProjectEncryptedEncryptionSecret(e.projectId)})}buildSaveEncryptedProjectEncryptionSecretRequest(e){return{path:`/api/v3/project/${e.projectId}/encrypted-encryption-secret`,method:"post",body:{projectId:e.projectId,encryptedEncryptionSecret:e.encryptedProjectEncryptionSecret,allowRotation:e.allowRotation},abortSignal:e.abortSignal,acceptedAuthParams:["projectApiKey","projectAccessToken"]}}getScheduledReports(e){return R1(this,void 0,void 0,function*(){return yield this.execute(this.buildGetScheduledReports(e))})}buildGetScheduledReports(e){return{path:"/api/scheduled-report/collect",method:"post",body:{dashboardAccessToken:e.dashboardAccessToken},abortSignal:e.abortSignal}}saveScheduledReport(e){return R1(this,void 0,void 0,function*(){return yield this.execute(this.buildSaveScheduledReportRequest(e))})}buildSaveScheduledReportRequest(e){return{path:"/api/scheduled-report",method:"post",body:{cronSchedule:e.cronSchedule,dashboardAccessToken:e.dashboardAccessToken,scheduledReportId:e.scheduledReportId},abortSignal:e.abortSignal}}updateDashboard(e){return R1(this,void 0,void 0,function*(){return yield this.execute(this.buildUpdateDashboardRequest(e))})}buildUpdateDashboardRequest(e){return{path:"/api/v2/dashboard",method:"put",body:{dashboardSessionToken:e.dashboardPermission.token,definition:e.definition,meta:e.metadata||e.meta||{},deleted:e.deleted,name:e.name,usage_metadata:e.usage_metadata},abortSignal:e.abortSignal}}updateParentGlobalLibrary(e){return R1(this,void 0,void 0,function*(){return yield this.execute(this.buildUpdateParentGlobalLibraryRequest(e))})}buildUpdateParentGlobalLibraryRequest(e){return{path:"/api/v2/parent-global-library",method:"put",body:{globalLibraryId:e.globalLibraryId,deleted:e.deleted,name:e.name},abortSignal:e.abortSignal}}updateGlobalLibrary(e){return R1(this,void 0,void 0,function*(){return yield this.execute(this.buildUpdateGlobalLibraryRequest(e))})}buildUpdateGlobalLibraryRequest(e){return{path:"/api/v2/global-library",method:"put",body:{globalLibrarySessionToken:e.globalLibrarySessionToken,deleted:e.deleted,library:e.library,usage_metadata:e.usage_metadata},abortSignal:e.abortSignal}}updateProjectApiKey(e){return R1(this,void 0,void 0,function*(){return yield this.execute(this.buildUpdateProjectApiKeyRequest(e))})}buildUpdateProjectApiKeyRequest(e){return{path:`/api/v3/project/${e.projectId}/api-key/${e.projectApiKeyId}`,method:"put",body:{disabled:e.disabled},abortSignal:e.abortSignal}}updateQueryEngineUser(e){return R1(this,void 0,void 0,function*(){const o=yield this.execute(this.buildUpdateQueryEngineUserRequest(e));if(o.status===200)return!0;throw new Mm.FailedToUpdateQueryEngineUser(`Failed to update query engine user. Got status ${o.status}`)})}buildUpdateQueryEngineUserRequest(e){return{path:`/api/v3/project/${e.projectId}/query-engine-user`,method:"put",body:{query_engine_user_id:e.queryEngineUserId,password:e.password},abortSignal:e.abortSignal,acceptedAuthParams:["projectApiKey","projectAccessToken"]}}getDashboardFieldUsageMetadata(e){return R1(this,void 0,void 0,function*(){return yield this.execute(this.buildGetDashboardFieldUsageMetadata(e))})}buildGetDashboardFieldUsageMetadata(e){return{path:`/api/v2/field-usage/dashboard/${e.dashboardId}`,method:"get",abortSignal:e.abortSignal}}}OM.VizzlyApi=sm;var yM={},x1=O0&&O0.__awaiter||function(t,e,o,n){function b(a){return a instanceof o?a:new o(function(O){O(a)})}return new(o||(o=Promise))(function(a,O){function A(v){try{y(n.next(v))}catch(N){O(N)}}function c(v){try{y(n.throw(v))}catch(N){O(N)}}function y(v){v.done?a(v.value):b(v.value).then(A,c)}y((n=n.apply(t,e||[])).next())})};Object.defineProperty(yM,"__esModule",{value:!0});yM.VizzlyAppApi=void 0;const Om=Cn;class lm extends Om.Api{constructor(e,o="https://app.vizzly.co"){super(e,o)}createCliAuthToken(){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildCreateCliAuthTokenRequest())})}buildCreateCliAuthTokenRequest(){return{path:"/api/create-cli-auth-token",method:"post",body:{}}}createInstantDashboard(e){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildCreateInstantDashboardRequest(e))})}buildCreateInstantDashboardRequest(e){return{path:"/api/v2/instant-dashboard",method:"post",body:{parent_dashboard_definition:e.definition}}}createProjectAdminOverrideAccessToken(e){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildCreateProjectAdminOverrideAccessTokenRequest(e))})}buildCreateProjectAdminOverrideAccessTokenRequest(e){return{path:`/api/v2/project/${e.projectId}/admin-override`,method:"post",body:{}}}startEmailChange(e){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildStartEmailChangeRequest(e))})}buildStartEmailChangeRequest(e){return{path:"/api/self/start-email-change",method:"post",body:{email:e.email}}}completeEmailChange(e){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildCompleteEmailChangeRequest(e))})}buildCompleteEmailChangeRequest(e){return{path:"/api/self/complete-email-change",method:"post",body:{token:e.token}}}getManagedQueryEngineAccessTokens(e){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildGetManagedQueryEngineAccessTokensRequest(e))})}buildGetManagedQueryEngineAccessTokensRequest(e){return{path:`/api/v2/managed-query-engine/${e.managedQueryEngineId}/identity`,method:"get"}}getParentDashboardMeta(e){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildGetParentDashboardMetaRequest(e))})}buildGetParentDashboardMetaRequest(e){return{path:`/api/v2/parent-dashboard/${e.dashboardId}/stats`,method:"get"}}updateParentDashboard(e){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildUpdateParentDashboardRequest(e))})}buildUpdateParentDashboardRequest(e){return{path:`/api/v2/parent-dashboard/${e.dashboardId}/stats`,method:"put",body:{name:e.name,definition:e.definition,meta:e.meta,deleted:e.deleted,webhookId:e.webhookId}}}getProjectMeta(e){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildGetProjectMetaRequest(e))})}buildGetProjectMetaRequest(e){return{path:`/api/v2/project/${e.projectId}/meta`,method:"get"}}getSelf(){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildGetSelfRequest())})}buildGetSelfRequest(){return{path:"/api/self",method:"get"}}getTeam(){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildGetTeamRequest())})}buildGetTeamRequest(){return{path:"/api/team",method:"get"}}getWebhooks(){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildGetWebhooksRequest())})}buildGetWebhooksRequest(){return{path:"/api/organisation/webhooks",method:"get"}}inviteTeamMember(e){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildInviteTeamMemberRequest(e))})}buildInviteTeamMemberRequest(e){return{path:"/api/invite",method:"post",body:{email:e.email,first_name:e.firstName,last_name:e.lastName,department:e.department}}}inAppAcceptTeamMemberInvite(e){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildInAppAcceptTeamMemberInviteRequest(e))})}buildInAppAcceptTeamMemberInviteRequest(e){return{path:"/api/invite/in-app-accept",method:"post",body:{team_member_id:e.teamMemberId}}}acceptTeamMemberInvite(e){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildAcceptTeamMemberInviteRequest(e))})}buildAcceptTeamMemberInviteRequest(e){return{path:"/api/invite/accept",method:"post",body:{token:e.inviteToken}}}resendTeamMemberInvite(e){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildResendTeamMemberInviteRequest(e))})}buildResendTeamMemberInviteRequest(e){return{path:"/api/invite/resend",method:"post",body:{team_member_id:e.teamMemberId}}}removeTeamMember(e){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildRemoveTeamMemberRequest(e))})}buildRemoveTeamMemberRequest(e){return{path:"/api/invite/remove",method:"post",body:{team_member_id:e.teamMemberId}}}startSignIn(e){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildStartSignInRequest(e))})}buildStartSignInRequest(e){return{path:"/api/start-sign-in",method:"post",body:{email:e.email}}}completeSignIn(e){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildCompleteSignInRequest(e))})}buildCompleteSignInRequest(e){return{path:"/api/complete-sign-in",method:"post",body:{token:e.token}}}searchUserDashboards(e){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildSearchUserDashboardsRequest(e))})}buildSearchUserDashboardsRequest(e){return{path:`/api/v2/project/${e.projectId}/search-user-dashboards?user_reference=${e.userReference}`,method:"get"}}signUp(e){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildSignUpRequest(e))})}buildSignUpRequest(e){return{path:"/api/complete-sign-in",method:"post",body:{email:e.email,organisation_title:e.organisationTitle,first_name:e.firstName,last_name:e.lastName,department:e.department}}}switchOrganisation(e){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildSwitchOrganisationRequest(e))})}buildSwitchOrganisationRequest(e){return{path:"/api/team/switch",method:"post",body:{organisation_id:e.organisationId}}}toggleKeyPairDisabled(e){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildToggleKeyPairDisabledRequest(e))})}buildToggleKeyPairDisabledRequest(e){return{path:"/api/organisation/key-pairs/toggle-disabled",method:"post",body:{key_pair_id:e.keyPairId,disabled:e.disabled}}}updateProject(e){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildUpdateProjectRequest(e))})}buildUpdateProjectRequest(e){return{path:"/api/v2/project",method:"put",body:{project_id:e.projectId,deleted:e.deleted,name:e.name}}}uploadPublicKey(e){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildUploadPublicKeyRequest(e))})}buildUploadPublicKeyRequest(e){return{path:"/api/v2/project/key-pair",method:"post",body:{public_key:e.publicKey,project_id:e.projectId}}}}yM.VizzlyAppApi=lm;var RM={},L1=O0&&O0.__awaiter||function(t,e,o,n){function b(a){return a instanceof o?a:new o(function(O){O(a)})}return new(o||(o=Promise))(function(a,O){function A(v){try{y(n.next(v))}catch(N){O(N)}}function c(v){try{y(n.throw(v))}catch(N){O(N)}}function y(v){v.done?a(v.value):b(v.value).then(A,c)}y((n=n.apply(t,e||[])).next())})};Object.defineProperty(RM,"__esModule",{value:!0});RM.VizzlyQueryEngineApi=void 0;const Am=Cn,dm=db,um=fb,fm=ub,pl=AM,qm=xn,hs=En;class Wm extends Am.Api{constructor(e,o,n){super(e,o,n)}buildCreateDashboardRequest(e){return{path:"/api/v1/dashboard",method:"post",abortSignal:e.abortSignal,body:{dashboardAccessToken:this.auth.getDashboardAccessToken(),definition:e.definition||qm.DashboardRepository.EmptyDashboardDefinition(),meta:e.metadata||e.meta||{},parentDashboardId:e.parentDashboardId,permissions:e.permissions,usage_metadata:e.usage_metadata}}}buildFetchDashboardAccessTokensRequest(e){return{path:"/api/v1/dashboard/access",method:"post",abortSignal:e?.abortSignal,body:{dashboardAccessToken:this.auth.getDashboardAccessToken(),projectAdminOverrideToken:this.auth.getProjectAdminOverrideToken()}}}fetchGlobalLibraryAccessTokens(e){return L1(this,void 0,void 0,function*(){return yield this.execute(this.buildFetchGlobalLibraryAccessTokensRequest(e))})}buildFetchGlobalLibraryAccessTokensRequest(e){return{path:"/api/v1/global-library/access",method:"post",abortSignal:e?.abortSignal,body:{dashboardAccessToken:this.auth.getDashboardAccessToken(),projectAdminOverrideToken:this.auth.getProjectAdminOverrideToken()}}}buildFetchDashboardsRequest(e){return{path:"/api/v1/get-dashboards",method:"post",abortSignal:e.abortSignal,body:{dashboardAccessTokens:e.dashboardSessionAccessTokens}}}createConfigFromUpload(e){return L1(this,void 0,void 0,function*(){return yield this.execute(this.buildCreateConfigFromUploadRequest(e))})}buildCreateConfigFromUploadRequest(e){return{path:"/api/v1/create-config-from-upload",method:"post",abortSignal:e.abortSignal,body:{queryEngineAccessToken:this.auth.getQueryEngineAccessToken(),table:e.table,fieldPublicNames:e.fieldPublicNames}}}createResults(e){return L1(this,arguments,void 0,function*(o,n="v2"){return yield this.execute(this.buildCreateResultsRequest(o,n))})}buildCreateResultsRequest(e,o){return{path:`/api/${o}/create-results`,method:"post",abortSignal:e.abortSignal,body:{queries:e.queries,dynamicConfig:e.dynamicConfig,identityConfigIntegritySignature:this.auth.hasDataAccessToken()?this.auth.getDataAccessToken():void 0,secureFilters:e.secureFilters,virtualFields:{}},acceptedAuthParams:["queryEngineApiKey","dashboardAccessToken"]}}collectSchema(e){return L1(this,void 0,void 0,function*(){return yield this.execute(this.buildCollectSchemaRequest(e))})}buildCollectSchemaRequest(e){return{path:"/api/v1/schema",method:"post",abortSignal:e.abortSignal,body:{allowedConfigOrigins:e.allowedConfigOrigins,dynamicConfig:e.dynamicConfig},acceptedAuthParams:["queryEngineApiKey"]}}createSqlPreview(e){return L1(this,void 0,void 0,function*(){var o;const n=yield this.execute(this.buildCreateSqlPreviewRequest(e));if(n.status===200)return n;throw new dm.SQLPreviewError(((o=n?.body)===null||o===void 0?void 0:o.message)||"Unknown SQL error")})}buildCreateSqlPreviewRequest(e){return{path:"/api/v1/create-sql-preview",method:"post",abortSignal:e.abortSignal,body:{sql:e.sql,parameters:e.parameters,limit:e.limit}}}createQueryEngineUser(e){return L1(this,void 0,void 0,function*(){return yield this.execute(this.buildCreateQueryEngineUserRequest(e))})}buildCreateQueryEngineUserRequest(e){return{path:"/api/v1/query-engine-user",method:"post",abortSignal:e.abortSignal,body:{email:e.email,password:e.password}}}fetchDataSets(e){return L1(this,void 0,void 0,function*(){const o=this.buildFetchDataSetsRequest(e),n=yield this.execute(o);if(n.status===200)return n;throw new um.FailedToResolveDataSets(`Failed to resolve data sets from ${o.path}. Received status ${n.status}`)})}buildFetchDataSetsRequest(e){return{path:"/api/v1/resolve-data-sets",method:"post",abortSignal:e?.abortSignal,body:{integritySignature:this.auth.getDataAccessToken()}}}fetchSelfHostedQueryEngineConfig(e){return L1(this,void 0,void 0,function*(){return this.execute(this.buildFetchSelfHostedQueryEngineConfigRequest(e))})}buildFetchSelfHostedQueryEngineConfigRequest(e){return{path:"/api/v1/support",method:"post",abortSignal:e?.abortSignal,body:{}}}fetchProject(e){return L1(this,void 0,void 0,function*(){return this.execute(this.buildFetchProjectRequest(e))})}buildFetchProjectRequest(e){return{path:"/api/v1/project",method:"get",abortSignal:e?.abortSignal,body:{}}}getStarted(e){return L1(this,void 0,void 0,function*(){const o=yield this.execute(this.buildGetStartedRequest(e));if(o.status!=200)throw new fm.FailedToSetupProject(typeof o.body=="object"&&o.body.reason&&"reason"in o.body?o.body.reason:"Failed to create the first user.");return o})}buildGetStartedRequest(e){return{path:"/api/v2/get-started",method:"post",abortSignal:e.abortSignal,body:{email:e.email,password:e.password}}}getTeamMembers(e){return L1(this,void 0,void 0,function*(){return this.execute(this.buildGetTeamMembersRequest(e))})}buildGetTeamMembersRequest(e){return{path:"/api/v1/team-members",method:"get",abortSignal:e?.abortSignal}}isVizzly(e){return L1(this,void 0,void 0,function*(){return this.execute(this.buildIsVizzlyRequest(e))})}buildIsVizzlyRequest(e){return{path:"/api/is-vizzly",method:"get",abortSignal:e?.abortSignal}}saveConfig(e){return L1(this,void 0,void 0,function*(){return yield this.execute(this.buildSaveConfigRequest(e))})}buildSaveConfigRequest(e){return{path:"/api/v1/save-config",method:"post",abortSignal:e.abortSignal,body:{config:e.config}}}saveConnection(e){return L1(this,void 0,void 0,function*(){return yield this.execute(this.buildSaveConnectionRequest(e))})}buildSaveConnectionRequest(e){return{path:"/api/v1/save-connection",method:"post",abortSignal:e.abortSignal,body:{connection:e.connection,client:e.client}}}signInWithQueryEngineAccessToken(e){return L1(this,void 0,void 0,function*(){return this.execute(this.buildSignInWithQueryEngineAccessTokenRequest(e))})}buildSignInWithQueryEngineAccessTokenRequest(e){return{path:"/api/v1/sign-in",method:"post",abortSignal:e?.abortSignal,body:{}}}signInWithEmailAndPassword(e){return L1(this,void 0,void 0,function*(){return yield this.execute(this.buildSignInWithEmailAndPasswordRequest(e))})}buildSignInWithEmailAndPasswordRequest(e){return{path:"/api/v1/sign-in",method:"post",abortSignal:e.abortSignal,body:{email:e.email,password:e.password}}}status(e){return L1(this,void 0,void 0,function*(){return this.execute(this.buildStatusRequest(e))})}buildStatusRequest(e){return{path:"/api/status",method:"post",abortSignal:e?.abortSignal,body:{}}}createGlobalLibrary(e){return L1(this,void 0,void 0,function*(){const o=yield this.execute(this.buildCreateGlobalLibraryRequest(e));if(o.status===200)return o.body;throw o.status===403?new pl.PermissionDenied("Permission denied when creating a global library via the Vizzly Query Engine."):new pl.FailedToCreateGlobalLibrary(`Failed to create a global library. Got status ${o.status}`)})}buildCreateGlobalLibraryRequest(e){return{path:"/api/v1/global-library",method:"post",abortSignal:e.abortSignal,body:{dashboardAccessToken:this.auth.getDashboardAccessToken(),parentGlobalLibraryId:e.parentGlobalLibraryId,library:e.library,permissions:e.permissions}}}fetchGlobalLibraries(e){return L1(this,void 0,void 0,function*(){return yield this.execute(this.buildFetchGlobalLibrariesRequest(e))})}buildFetchGlobalLibrariesRequest(e){return{path:"/api/v1/get-global-libraries",method:"post",abortSignal:e.abortSignal,body:{globalLibraryAccessTokens:e.globalLibraryAccessTokens}}}updateGlobalLibrary(e){return L1(this,void 0,void 0,function*(){return yield this.execute(this.buildUpdateGlobalLibraryRequest(e))})}buildUpdateGlobalLibraryRequest(e){return{path:"/api/v1/global-library",method:"put",abortSignal:e.abortSignal,body:{globalLibrarySessionToken:e.globalLibrarySessionToken,deleted:e.deleted,library:e.library,usage_metadata:e.usage_metadata}}}updateDashboard(e){return L1(this,void 0,void 0,function*(){return yield this.execute(this.buildUpdateDashboardRequest(e))})}buildUpdateDashboardRequest(e){return{path:"/api/v1/dashboard",method:"put",abortSignal:e.abortSignal,body:{dashboardSessionToken:e.dashboardPermission.token,definition:e.definition,meta:e.metadata||e.meta||{},deleted:e.deleted,name:e.name,usage_metadata:e.usage_metadata}}}updateQueryEngineUser(e){return L1(this,void 0,void 0,function*(){return yield this.execute(this.buildUpdateQueryEngineUserRequest(e))})}buildUpdateQueryEngineUserRequest(e){return{path:"/api/v1/query-engine-user",method:"put",abortSignal:e.abortSignal,body:{queryEngineUserId:e.queryEngineUserId,password:e.password}}}uploadDataToVizzlyCloud(e){return L1(this,void 0,void 0,function*(){return yield this.execute(this.buildUploadDataToVizzlyCloudRequest(e))})}buildUploadDataToVizzlyCloudRequest(e){return{path:"/api/v1/ingest",method:"post",abortSignal:e.abortSignal,body:{queryEngineAccessToken:this.auth.getQueryEngineAccessToken(),ingest:e.ingest}}}createCompanyInfrastructure(e){return L1(this,void 0,void 0,function*(){return yield this.execute(this.buildCreateCompanyInfrastructureRequest(e))})}getCreateCompanyInfrastructureStatus(e){return L1(this,void 0,void 0,function*(){return yield this.execute(this.buildCreateCompanyInfrastructureRequest(e,{statusOnly:!0}))})}buildCreateCompanyInfrastructureRequest(e,o){const n=o?.statusOnly?"/status":"";return{path:hs.Path.buildPath("/api/v1/data-optimiser/company",n),method:"post",abortSignal:e.abortSignal,body:{company:{id:e.companyId}},acceptedAuthParams:["queryEngineApiKey"]}}ingestDatasource(e){return L1(this,void 0,void 0,function*(){return yield this.execute(this.buildIngestDatasourceRequest(e,{statusOnly:!1}))})}getIngestDatasourceStatus(e){return L1(this,void 0,void 0,function*(){return yield this.execute(this.buildIngestDatasourceRequest(e,{statusOnly:!0}))})}buildIngestDatasourceRequest(e,o){const n=o?.statusOnly?"/status":"";return{path:hs.Path.buildPath("/api/v1/data-optimiser/ingest",n),method:"post",abortSignal:e.abortSignal,body:{dataSourceId:e.dataSourceId,ingestFields:e.ingestFields,internalCompanyConnection:e.internalCompanyConnection,externalSnowflakeConnection:e.externalSnowflakeConnection},acceptedAuthParams:["queryEngineApiKey"]}}getCreateSnapshotStatus(e){return L1(this,void 0,void 0,function*(){return yield this.execute(this.buildCreateSnapshotRequest(e,{statusOnly:!0}))})}createSnapshot(e){return L1(this,void 0,void 0,function*(){return yield this.execute(this.buildCreateSnapshotRequest(e,{statusOnly:!1}))})}buildCreateSnapshotRequest(e,o){const n=o?.statusOnly?"/status":"";return{path:hs.Path.buildPath("/api/v1/data-optimiser/snapshot",n),method:"post",abortSignal:e.abortSignal,body:{ingestDataSourceId:e.ingestDataSourceId,snapshotDataSourceId:e.snapshotDataSourceId,ingestFields:e.ingestFields,cascadingInstructions:e.cascadingInstructions,primaryDateFieldId:e.primaryDateFieldId,internalCompanyConnection:e.internalCompanyConnection},acceptedAuthParams:["queryEngineApiKey"]}}}RM.VizzlyQueryEngineApi=Wm;var LM={};Object.defineProperty(LM,"__esModule",{value:!0});LM.Authentication=void 0;const hm=P0,yn=lb;class mm{constructor(e){this.authParams=e}updateAuthParams(e){this.authParams=Object.assign(Object.assign({},this.authParams),e)}clearAuthParams(){this.authParams={}}getQueryEngineApiKey(){if(!this.authParams.queryEngineApiKey)throw new yn.MissingAuthParameter("queryEngineApiKey");return this.authParams.queryEngineApiKey}getQueryEngineAccessToken(){if(!this.authParams.queryEngineAccessToken)throw new yn.MissingAuthParameter("queryEngineAccessToken");return this.authParams.queryEngineAccessToken}getProjectAdminOverrideToken(){return this.authParams.projectAdminOverrideToken}getDashboardAccessToken(){if(!this.authParams.dashboardAccessToken)throw new yn.MissingAuthParameter("dashboardAccessToken");return this.authParams.dashboardAccessToken}getAppSessionToken(){return this.authParams.appSessionToken}hasDataAccessToken(){return!!this.authParams.dataAccessToken}getDataAccessToken(){if(!this.hasDataAccessToken())throw new yn.MissingAuthParameter("dataAccessToken");return this.authParams.dataAccessToken}getProjectApiKey(){if(!this.authParams.projectApiKey)throw new yn.MissingAuthParameter("projectApiKey");return this.authParams.projectApiKey}getProjectAccessToken(){if(!this.authParams.projectAccessToken)throw new yn.MissingAuthParameter("projectAccessToken");return this.authParams.projectAccessToken}buildAuthHeaders(e){let o=e?(0,hm.pick)(this.authParams,e):this.authParams;return o.dashboardAccessToken?{auth:`Bearer ${o.dashboardAccessToken}`}:o.queryEngineApiKey?{"Config-Api-Key":o.queryEngineApiKey}:o.projectAccessToken?{auth:`Bearer ${o.projectAccessToken}`}:o.projectApiKey?{auth:`Api-Key ${o.projectApiKey}`}:o.appSessionToken?{auth:`Bearer ${o.appSessionToken}`}:{}}}LM.Authentication=mm;var Yo={};Object.defineProperty(Yo,"__esModule",{value:!0});Yo.PersistDirectToVizzlyApi=Yo.PersistViaQueryEngine=Yo.ImplementationStrategy=void 0;class MO{}Yo.ImplementationStrategy=MO;class gm extends MO{shouldPersistViaQueryEngine(){return!0}}Yo.PersistViaQueryEngine=gm;class ym extends MO{shouldPersistViaQueryEngine(){return!1}}Yo.PersistDirectToVizzlyApi=ym;var pA={},aA={};Object.defineProperty(aA,"__esModule",{value:!0});var MA={};Object.defineProperty(MA,"__esModule",{value:!0});var zA={};Object.defineProperty(zA,"__esModule",{value:!0});var cA={};Object.defineProperty(cA,"__esModule",{value:!0});(function(t){var e=O0&&O0.__createBinding||(Object.create?function(n,b,a,O){O===void 0&&(O=a);var A=Object.getOwnPropertyDescriptor(b,a);(!A||("get"in A?!b.__esModule:A.writable||A.configurable))&&(A={enumerable:!0,get:function(){return b[a]}}),Object.defineProperty(n,O,A)}:function(n,b,a,O){O===void 0&&(O=a),n[O]=b[a]}),o=O0&&O0.__exportStar||function(n,b){for(var a in n)a!=="default"&&!Object.prototype.hasOwnProperty.call(b,a)&&e(b,n,a)};Object.defineProperty(t,"__esModule",{value:!0}),o(aA,t),o(MA,t),o(zA,t),o(cA,t)})(pA);(function(t){var e=O0&&O0.__createBinding||(Object.create?function(a,O,A,c){c===void 0&&(c=A);var y=Object.getOwnPropertyDescriptor(O,A);(!y||("get"in y?!O.__esModule:y.writable||y.configurable))&&(y={enumerable:!0,get:function(){return O[A]}}),Object.defineProperty(a,c,y)}:function(a,O,A,c){c===void 0&&(c=A),a[c]=O[A]}),o=O0&&O0.__setModuleDefault||(Object.create?function(a,O){Object.defineProperty(a,"default",{enumerable:!0,value:O})}:function(a,O){a.default=O}),n=O0&&O0.__exportStar||function(a,O){for(var A in a)A!=="default"&&!Object.prototype.hasOwnProperty.call(O,A)&&e(O,a,A)},b=O0&&O0.__importStar||function(a){if(a&&a.__esModule)return a;var O={};if(a!=null)for(var A in a)A!=="default"&&Object.prototype.hasOwnProperty.call(a,A)&&e(O,a,A);return o(O,a),O};Object.defineProperty(t,"__esModule",{value:!0}),t.Errors=void 0,n(aM,t),n(OM,t),n(yM,t),n(RM,t),n(LM,t),n(Yo,t),n(Lr,t),n(En,t),n(pA,t),t.Errors=b(AM)})(_2);const Rm=(t,e,o)=>{const n=new _2.Authentication({dashboardAccessToken:t?.dashboardAccess.signature,dataAccessToken:t?.dataAccess?.signature,projectAdminOverrideToken:t?.dashboardAdminOverride?.signature,queryEngineAccessToken:t?.queryEngineAccessConfig?.signature});let b=()=>({});e.strategy==="queryEngine"&&typeof e.endpoint!="string"&&(b=e.endpoint.customHeaders||b);const a=e.strategy==="queryEngine"?new _2.VizzlyQueryEngineApi(n,typeof e.endpoint=="string"?e.endpoint:e.endpoint.endpoint,b):void 0,O=new _2.VizzlyApi(n,o.host),A=new _2.VizzlyAppApi(n,"https://app.vizzly.co");return new _2.Vizzly({vizzlyApi:O,vizzlyAppApi:A,vizzlyQueryEngineApi:a},e.strategy==="queryEngine"?new _2.PersistViaQueryEngine:new _2.PersistDirectToVizzlyApi)},sA=(t,e)=>P0.mergeWith({},t,e,(o,n)=>P0.isArray(n)?n:P0.isObject(o)&&P0.isObject(n)?sA(o,n):n),Lm=(t,e)=>sA(e,t);var Ut={},OA={},Rb={},vM={},W1={},$t={};Object.defineProperty($t,"__esModule",{value:!0});$t.ALL_FRONTEND_FEATURES=$t.supportedAggregatesConstants=$t.timeDimensionsConstants=$t.supportedOperatorsConstants=void 0;$t.supportedOperatorsConstants={">":{publicName:"Greater than",validDataTypes:["number","date_time"]},"<":{publicName:"Less than",validDataTypes:["number","date_time"]},"<=":{publicName:"Less than or equal to",validDataTypes:["number","date_time"]},">=":{publicName:"Greater than or equal to",validDataTypes:["number","date_time"]},"!=":{publicName:"Not equal to",validDataTypes:["number","date_time","boolean","string"]},is_one_of:{publicName:"Is one of",validDataTypes:["number","date_time","boolean","string"]},"=":{publicName:"Equal to",validDataTypes:["number","date_time","boolean","string"]},is_not_one_of:{publicName:"Is not one of",validDataTypes:["number","date_time","boolean","string"]},starts_with:{publicName:"Starts with",validDataTypes:["string"]},ends_with:{publicName:"Ends with",validDataTypes:["string"]},contains_substring:{publicName:"Contains text",validDataTypes:["string"]},does_not_contain_substring:{publicName:"Does not contain text",validDataTypes:["string"]},array_contains:{publicName:"Contains",validDataTypes:["string[]"]},array_does_not_contain:{publicName:"Does not contain",validDataTypes:["string[]"]},array_contains_any_of:{publicName:"Contains any of",validDataTypes:["string[]"]},array_contains_all_of:{publicName:"Contains all of",validDataTypes:["string[]"]}};$t.timeDimensionsConstants={month:{publicName:"Monthly",dateFormat:"MMMM YYYY",dataTypeOutput:"date_time"},year:{publicName:"Yearly",dateFormat:"YYYY",dataTypeOutput:"date_time"},quarter:{publicName:"Per quarter",dateFormat:"quarter",dataTypeOutput:"date_time"},week:{publicName:"Weekly",dateFormat:"week",dataTypeOutput:"date_time"},day:{publicName:"Daily",dateFormat:"DD-MM-YYYY",dataTypeOutput:"date_time"},hourOfDayOnly:{publicName:"Hour of day",dateFormat:"hour_of_day",dataTypeOutput:"date_time"},weekOfYearOnly:{publicName:"Week of year",dateFormat:"week_of_year",dataTypeOutput:"number"},dayOfWeekOnly:{publicName:"Day of week",dateFormat:"day_of_week_iso",dataTypeOutput:"number"},monthOfYearOnly:{publicName:"Month of year",dateFormat:"month_of_year",dataTypeOutput:"number"},dayOfMonthOnly:{publicName:"Day of month",dateFormat:"day_of_month",dataTypeOutput:"number"},second:{publicName:"Per second",dateFormat:"hh:mm:ss",dataTypeOutput:"date_time"},hour:{publicName:"Hourly",dateFormat:"hh:mm",dataTypeOutput:"date_time"},minute:{publicName:"Per minute",dateFormat:"hh:mm",dataTypeOutput:"date_time"}};$t.supportedAggregatesConstants={mean:{publicName:"Mean",validDataTypes:["number"]},sum:{publicName:"Sum",validDataTypes:["number"]},min:{publicName:"Min",validDataTypes:["number"]},max:{publicName:"Max",validDataTypes:["number"]},count:{publicName:"Count",validDataTypes:["string","number","boolean","date_time","string[]"]},countDistinct:{publicName:"Unique",validDataTypes:["string","number","boolean","date_time"]},median:{publicName:"Median",validDataTypes:["number"]},percentile25:{publicName:"25th percentile",validDataTypes:["number"]},percentile75:{publicName:"75th percentile",validDataTypes:["number"]},percentile90:{publicName:"90th percentile",validDataTypes:["number"]},percentile95:{publicName:"95th percentile",validDataTypes:["number"]},percentile99:{publicName:"99th percentile",validDataTypes:["number"]}};$t.ALL_FRONTEND_FEATURES=["formatter:monthOfYearOnly"];Object.defineProperty(W1,"__esModule",{value:!0});W1.validOperatorsForField=W1.ALL_SUPPORTED_CONSTANTS=W1.isSupportedTimeTruncFunction=W1.isSupportedAggregate=W1.isSupportedAggregateFunction=W1.supportedAggregates=W1.supportedTimeTruncFunctions=W1.supportedOperators=W1.supportedAggregatesFunction=W1.supportedTransformationFunctions=void 0;const _M=P0,zo=$t,vm={round_to_0_dp:{publicName:"Round to 0dp",validDataTypes:["number"]},round_to_2_dp:{publicName:"Round to 2dp",validDataTypes:["number"]}},_m=t=>{const e=(0,_M.cloneDeep)(vm);if(!t)return e;let o={};return t.forEach(n=>{if(!e[n])throw`Transformation function ${n} is not managed by Vizzly`;o[n]=e[n]}),o};W1.supportedTransformationFunctions=_m;const Nm=(t,e,o)=>{const n=t.supportedAggregates,b=Object.keys(n).filter(O=>n[O].validDataTypes.includes(e));let a=o&&o.length>0?o.filter(O=>b.includes(O)):b;return o&&o.length>0&&a.length===0&&(a=b),a};W1.supportedAggregatesFunction=Nm;const Tm=t=>{const e=(0,_M.cloneDeep)(zo.supportedOperatorsConstants);if(!t)return e;let o={};return t.forEach(n=>{if(!zo.supportedOperatorsConstants[n])throw`Operator ${n} not managed by Vizzly`;o[n]=zo.supportedOperatorsConstants[n]}),o};W1.supportedOperators=Tm;const Bm=t=>{const e=(0,_M.cloneDeep)(zo.timeDimensionsConstants);if(!t)return e;let o={};return t.forEach(n=>{if(!e[n])throw`Time trunc function ${n} not managed by Vizzly`;o[n]=e[n]}),o};W1.supportedTimeTruncFunctions=Bm;const Sm=t=>{const e=(0,_M.cloneDeep)(zo.supportedAggregatesConstants);if(!t)return e;let o={};return t.forEach(n=>{if(!e[n])throw`Aggregate ${n} not managed by Vizzly`;o[n]=e[n]}),o};W1.supportedAggregates=Sm;const wm=(t,e)=>[...Object.keys(t),"none"].includes(e);W1.isSupportedAggregateFunction=wm;const xm=(t,e)=>typeof t!="string"?!1:e.hasOwnProperty(t);W1.isSupportedAggregate=xm;const Xm=(t,e)=>[...Object.keys(t),"none"].includes(e);W1.isSupportedTimeTruncFunction=Xm;W1.ALL_SUPPORTED_CONSTANTS=[{namespace:"config.supported_operator",constants:zo.supportedOperatorsConstants},{namespace:"config.supported_aggregate",constants:zo.supportedAggregatesConstants},{namespace:"config.supported_time",constants:zo.timeDimensionsConstants}];const Cm=(t,e)=>{let o=[...Object.keys(e.supportedOperators)];return o=o.filter(n=>zo.supportedOperatorsConstants[n].validDataTypes.includes(t.dataType)),o};W1.validOperatorsForField=Cm;Object.defineProperty(vM,"__esModule",{value:!0});vM.queryEngineConfig=void 0;const Wa=W1,Em=()=>({origin:"query-engine",supportedFeatures:["simpleMaths","aggregateMaths","subquery","configManagerUi","switchField","roundedNumbers","sqlDefinedDataSet","encryptedDashboards","sqlViews","dateMaths"],supportedTimeTruncFunctions:(0,Wa.supportedTimeTruncFunctions)(["month","year","quarter","week","day","hour","minute","second","dayOfMonthOnly","dayOfWeekOnly","weekOfYearOnly","monthOfYearOnly"]),supportedAggregates:(0,Wa.supportedAggregates)(["sum","mean","median","min","max","count","countDistinct","percentile25","percentile75","percentile90","percentile95","percentile99"]),supportedOperators:(0,Wa.supportedOperators)([">","<","=","!=",">=","<=","is_one_of","is_not_one_of","starts_with","ends_with","contains_substring","does_not_contain_substring","array_contains","array_does_not_contain"]),supportedTransformationFunctions:(0,Wa.supportedTransformationFunctions)(["round_to_0_dp","round_to_2_dp"])});vM.queryEngineConfig=Em;var NM={};Object.defineProperty(NM,"__esModule",{value:!0});NM.queryEngineConfig=void 0;const ha=W1,Dm=()=>({origin:"query-engine",supportedFeatures:["simpleMaths","aggregateMaths","subquery","configManagerUi","switchField","roundedNumbers","sqlDefinedDataSet","encryptedDashboards","sqlViews","dateMaths"],supportedTimeTruncFunctions:(0,ha.supportedTimeTruncFunctions)(["month","year","quarter","week","day","hour","minute","second"]),supportedAggregates:(0,ha.supportedAggregates)(["sum","mean","min","max","count","countDistinct"]),supportedOperators:(0,ha.supportedOperators)([">","<","=","!=",">=","<=","is_one_of","is_not_one_of","starts_with","ends_with","contains_substring","does_not_contain_substring","array_contains","array_does_not_contain"]),supportedTransformationFunctions:(0,ha.supportedTransformationFunctions)(["round_to_0_dp","round_to_2_dp"])});NM.queryEngineConfig=Dm;var TM={};Object.defineProperty(TM,"__esModule",{value:!0});TM.queryEngineConfig=void 0;const ma=W1,Im=()=>({origin:"query-engine",supportedFeatures:["simpleMaths","aggregateMaths","subquery","configManagerUi","sqlDefinedDataSet","roundedNumbers","switchField","encryptedDashboards","sqlViews","dateMaths"],supportedTimeTruncFunctions:(0,ma.supportedTimeTruncFunctions)(["month","year","quarter","week","day","hour","minute","second","dayOfMonthOnly","weekOfYearOnly","monthOfYearOnly"]),supportedAggregates:(0,ma.supportedAggregates)(["sum","mean","min","max","count","countDistinct"]),supportedOperators:(0,ma.supportedOperators)([">","<","=","!=",">=","<=","is_one_of","is_not_one_of","starts_with","ends_with","contains_substring","does_not_contain_substring","array_contains","array_does_not_contain"]),supportedTransformationFunctions:(0,ma.supportedTransformationFunctions)(["round_to_0_dp","round_to_2_dp"])});TM.queryEngineConfig=Im;var BM={};Object.defineProperty(BM,"__esModule",{value:!0});BM.queryEngineConfig=void 0;const ga=W1,Pm=()=>{var t;return typeof process>"u"?!1:((t=process.env.VIZZLY_MICROSOFT_FLAVOR)===null||t===void 0?void 0:t.toUpperCase())==="KUSTO"},Fm=()=>({origin:"query-engine",supportedFeatures:["simpleMaths","aggregateMaths","subquery","configManagerUi","switchField","roundedNumbers","sqlDefinedDataSet","encryptedDashboards","sqlViews","dateMaths"],supportedTimeTruncFunctions:(0,ga.supportedTimeTruncFunctions)(["month","year","quarter","week","day","hour","minute",...Pm()?[]:["second"]]),supportedAggregates:(0,ga.supportedAggregates)(["sum","mean","min","max","count","countDistinct"]),supportedOperators:(0,ga.supportedOperators)([">","<","=","!=",">=","<=","is_one_of","is_not_one_of","starts_with","ends_with","contains_substring","does_not_contain_substring","array_contains","array_does_not_contain"]),supportedTransformationFunctions:(0,ga.supportedTransformationFunctions)(["round_to_0_dp","round_to_2_dp"])});BM.queryEngineConfig=Fm;var SM={};Object.defineProperty(SM,"__esModule",{value:!0});SM.queryEngineConfig=void 0;const ya=W1,km=()=>({origin:"query-engine",supportedFeatures:["simpleMaths","subquery","configManagerUi","switchField","sqlDefinedDataSet","roundedNumbers","aggregateMaths","encryptedDashboards","sqlViews","dateMaths"],supportedTimeTruncFunctions:(0,ya.supportedTimeTruncFunctions)(["month","year","day","hour","minute","second"]),supportedAggregates:(0,ya.supportedAggregates)(["sum","mean","min","max","count","countDistinct"]),supportedOperators:(0,ya.supportedOperators)([">","<","=","!=",">=","<=","is_one_of","is_not_one_of","starts_with","ends_with","contains_substring","does_not_contain_substring"]),supportedTransformationFunctions:(0,ya.supportedTransformationFunctions)(["round_to_0_dp","round_to_2_dp"])});SM.queryEngineConfig=km;var wM={};Object.defineProperty(wM,"__esModule",{value:!0});wM.queryEngineConfig=void 0;const Ra=W1,jm=()=>({origin:"query-engine",supportedFeatures:["simpleMaths","aggregateMaths","subquery","configManagerUi","sqlDefinedDataSet","roundedNumbers","switchField","encryptedDashboards","sqlViews","dateMaths"],supportedTimeTruncFunctions:(0,Ra.supportedTimeTruncFunctions)(["month","year","quarter","week","day","hour","minute","second","dayOfMonthOnly","dayOfWeekOnly","weekOfYearOnly","hourOfDayOnly","monthOfYearOnly"]),supportedAggregates:(0,Ra.supportedAggregates)(["sum","mean","median","min","max","count","countDistinct","percentile25","percentile75","percentile90","percentile95","percentile99"]),supportedOperators:(0,Ra.supportedOperators)([">","<","=","!=",">=","<=","is_one_of","is_not_one_of","starts_with","ends_with","contains_substring","does_not_contain_substring","array_contains","array_does_not_contain","array_contains_any_of","array_contains_all_of"]),supportedTransformationFunctions:(0,Ra.supportedTransformationFunctions)(["round_to_0_dp","round_to_2_dp"])});wM.queryEngineConfig=jm;var xM={};Object.defineProperty(xM,"__esModule",{value:!0});xM.queryEngineConfig=void 0;const La=W1,$m=()=>({origin:"query-engine",supportedFeatures:["simpleMaths","subquery","configManagerUi","sqlDefinedDataSet","roundedNumbers","aggregateMaths","encryptedDashboards","sqlViews","dateMaths"],supportedTimeTruncFunctions:(0,La.supportedTimeTruncFunctions)(["month","year","day","hour","minute","second"]),supportedAggregates:(0,La.supportedAggregates)(["sum","mean","min","max","count","countDistinct"]),supportedOperators:(0,La.supportedOperators)([">","<","=","!=",">=","<=","is_one_of","is_not_one_of","starts_with","ends_with","contains_substring","does_not_contain_substring"]),supportedTransformationFunctions:(0,La.supportedTransformationFunctions)(["round_to_0_dp","round_to_2_dp"])});xM.queryEngineConfig=$m;var XM={};Object.defineProperty(XM,"__esModule",{value:!0});XM.localQueryEngineConfig=void 0;const va=W1;XM.localQueryEngineConfig={origin:"in-browser",supportedFeatures:["simpleMaths","aggregateMaths","subquery","encryptedDashboards","switchField","roundedNumbers","encryptedDashboards","dateMaths"],supportedTimeTruncFunctions:(0,va.supportedTimeTruncFunctions)(["month","year","quarter","week","day","hour","minute","second"]),supportedAggregates:(0,va.supportedAggregates)(["sum","mean","min","max","count","countDistinct","median"]),supportedOperators:(0,va.supportedOperators)([">","<","=","!=",">=","<=","is_one_of","is_not_one_of","starts_with","ends_with","contains_substring","does_not_contain_substring","array_contains","array_does_not_contain"]),supportedTransformationFunctions:(0,va.supportedTransformationFunctions)(["round_to_0_dp","round_to_2_dp"])};var Um=O0&&O0.__createBinding||(Object.create?function(t,e,o,n){n===void 0&&(n=o);var b=Object.getOwnPropertyDescriptor(e,o);(!b||("get"in b?!e.__esModule:b.writable||b.configurable))&&(b={enumerable:!0,get:function(){return e[o]}}),Object.defineProperty(t,n,b)}:function(t,e,o,n){n===void 0&&(n=o),t[n]=e[o]}),Gm=O0&&O0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vr=O0&&O0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var o in t)o!=="default"&&Object.prototype.hasOwnProperty.call(t,o)&&Um(e,t,o);return Gm(e,t),e};Object.defineProperty(Rb,"__esModule",{value:!0});Rb.getQueryEngineConfig=void 0;const Vm=vr(vM),Hm=vr(NM),Ym=vr(TM),Km=vr(BM),Qm=vr(SM),Zm=vr(wM),Jm=vr(xM),e6=XM,t6=t=>{switch(t){case"js":return e6.localQueryEngineConfig;case"postgres":return Vm.queryEngineConfig();case"redshift":return Hm.queryEngineConfig();case"bigquery":return Ym.queryEngineConfig();case"mariadb":return Qm.queryEngineConfig();case"snowflake":return Zm.queryEngineConfig();case"mysql":return Jm.queryEngineConfig();case"microsoftSQLServer":return Km.queryEngineConfig();case"SQLite":throw"SQLite not support via the query engine"}};Rb.getQueryEngineConfig=t6;var CM={};Object.defineProperty(CM,"__esModule",{value:!0});CM.merge=void 0;const ms=P0,o6=(...t)=>t.reduce((e,o)=>{const n=b=>{let a=e[b],O=o[b];if(typeof a=="object"&&typeof O=="object"){const A=(0,ms.intersection)(Object.keys(a),Object.keys(O));return(0,ms.pick)(o[b],A)}throw"Cannot intersect non-object type in mapIntersection function."};return{origin:"query-engine",supportedAggregates:n("supportedAggregates"),supportedFeatures:(0,ms.intersection)(e.supportedFeatures,o.supportedFeatures),supportedOperators:n("supportedOperators"),supportedTimeTruncFunctions:n("supportedTimeTruncFunctions"),supportedTransformationFunctions:n("supportedTransformationFunctions")}},t[0]);CM.merge=o6;var EM={};Object.defineProperty(EM,"__esModule",{value:!0});EM.removeUnsupportedFeatures=void 0;const r6=P0,n6=(t,e)=>{const o=(0,r6.cloneDeep)(t);return e.includes("formatter:monthOfYearOnly")||delete o.supportedTimeTruncFunctions.monthOfYearOnly,o};EM.removeUnsupportedFeatures=n6;(function(t){var e=O0&&O0.__createBinding||(Object.create?function(a,O,A,c){c===void 0&&(c=A);var y=Object.getOwnPropertyDescriptor(O,A);(!y||("get"in y?!O.__esModule:y.writable||y.configurable))&&(y={enumerable:!0,get:function(){return O[A]}}),Object.defineProperty(a,c,y)}:function(a,O,A,c){c===void 0&&(c=A),a[c]=O[A]}),o=O0&&O0.__setModuleDefault||(Object.create?function(a,O){Object.defineProperty(a,"default",{enumerable:!0,value:O})}:function(a,O){a.default=O}),n=O0&&O0.__exportStar||function(a,O){for(var A in a)A!=="default"&&!Object.prototype.hasOwnProperty.call(O,A)&&e(O,a,A)},b=O0&&O0.__importStar||function(a){if(a&&a.__esModule)return a;var O={};if(a!=null)for(var A in a)A!=="default"&&Object.prototype.hasOwnProperty.call(a,A)&&e(O,a,A);return o(O,a),O};Object.defineProperty(t,"__esModule",{value:!0}),t.Support=t.Constants=void 0,n(Rb,t),n(CM,t),t.Constants=b($t),t.Support=b(W1),n(EM,t)})(OA);var lA={},AA={},dA={exports:{}};(function(t,e){(function(o,n){t.exports=n()})(ot,()=>(()=>{var o={514:(a,O,A)=>{const{clone:c}=A(8870),y=A(8160),v={annotations:Symbol("annotations")};O.error=function(N){if(!this._original||typeof this._original!="object")return this.details[0].message;const s=N?"":"\x1B[31m",u=N?"":"\x1B[41m",d=N?"":"\x1B[0m",z=c(this._original);for(let q=this.details.length-1;q>=0;--q){const l=q+1,f=this.details[q],g=f.path;let L=z;for(let T=0;;++T){const X=g[T];if(y.isSchema(L)&&(L=L.clone()),!(T+1<g.length&&typeof L[X]!="string")){const C=L[v.annotations]||{errors:{},missing:{}};L[v.annotations]=C;const m=X||f.context.key;L[X]!==void 0?(C.errors[m]=C.errors[m]||[],C.errors[m].push(l)):C.missing[m]=l;break}L=L[X]}}let M=v.safeStringify(z,2).replace(/_\$key\$_([, \d]+)_\$end\$_"/g,(q,l)=>`" ${s}[${l}]${d}`).replace(/"_\$miss\$_([^|]+)\|(\d+)_\$end\$_": "__missing__"/g,(q,l,f)=>`${u}"${l}"${d}${s} [${f}]: -- missing --${d}`).replace(/\s*"_\$idx\$_([, \d]+)_\$end\$_",?\n(.*)/g,(q,l,f)=>`
29
+ `)===0?L0.substr(1,L0.length):L0}).forEach(function(L0){var X0=L0.split(":"),B0=X0.shift().trim();if(B0){var $0=X0.join(":").trim();Z.append(B0,$0)}}),Z}T.call(m.prototype);function U(V,Z){if(!(this instanceof U))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');Z||(Z={}),this.type="default",this.status=Z.status===void 0?200:Z.status,this.ok=this.status>=200&&this.status<300,this.statusText=Z.statusText===void 0?"":""+Z.statusText,this.headers=new z(Z.headers),this.url=Z.url||"",this._initBody(V)}T.call(U.prototype),U.prototype.clone=function(){return new U(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new z(this.headers),url:this.url})},U.error=function(){var V=new U(null,{status:0,statusText:""});return V.type="error",V};var z0=[301,302,303,307,308];U.redirect=function(V,Z){if(z0.indexOf(Z)===-1)throw new RangeError("Invalid status code");return new U(null,{status:Z,headers:{location:V}})},O.DOMException=A.DOMException;try{new O.DOMException}catch{O.DOMException=function(Z,u0){this.message=Z,this.name=u0;var L0=Error(Z);this.stack=L0.stack},O.DOMException.prototype=Object.create(Error.prototype),O.DOMException.prototype.constructor=O.DOMException}function a0(V,Z){return new Promise(function(u0,L0){var X0=new m(V,Z);if(X0.signal&&X0.signal.aborted)return L0(new O.DOMException("Aborted","AbortError"));var B0=new XMLHttpRequest;function $0(){B0.abort()}B0.onload=function(){var d1={status:B0.status,statusText:B0.statusText,headers:E(B0.getAllResponseHeaders()||"")};d1.url="responseURL"in B0?B0.responseURL:d1.headers.get("X-Request-URL");var k1="response"in B0?B0.response:B0.responseText;setTimeout(function(){u0(new U(k1,d1))},0)},B0.onerror=function(){setTimeout(function(){L0(new TypeError("Network request failed"))},0)},B0.ontimeout=function(){setTimeout(function(){L0(new TypeError("Network request failed"))},0)},B0.onabort=function(){setTimeout(function(){L0(new O.DOMException("Aborted","AbortError"))},0)};function h1(d1){try{return d1===""&&A.location.href?A.location.href:d1}catch{return d1}}B0.open(X0.method,h1(X0.url),!0),X0.credentials==="include"?B0.withCredentials=!0:X0.credentials==="omit"&&(B0.withCredentials=!1),"responseType"in B0&&(c.blob?B0.responseType="blob":c.arrayBuffer&&X0.headers.get("Content-Type")&&X0.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(B0.responseType="arraybuffer")),Z&&typeof Z.headers=="object"&&!(Z.headers instanceof z)?Object.getOwnPropertyNames(Z.headers).forEach(function(d1){B0.setRequestHeader(d1,u(Z.headers[d1]))}):X0.headers.forEach(function(d1,k1){B0.setRequestHeader(k1,d1)}),X0.signal&&(X0.signal.addEventListener("abort",$0),B0.onreadystatechange=function(){B0.readyState===4&&X0.signal.removeEventListener("abort",$0)}),B0.send(typeof X0._bodyInit>"u"?null:X0._bodyInit)})}return a0.polyfill=!0,A.fetch||(A.fetch=a0,A.Headers=z,A.Request=m,A.Response=U),O.Headers=z,O.Request=m,O.Response=U,O.fetch=a0,O})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var b=o.fetch?o:n;e=b.fetch,e.default=b.fetch,e.fetch=b.fetch,e.Headers=b.Headers,e.Request=b.Request,e.Response=b.Response,t.exports=e})(Fs,Fs.exports);var bA=Fs.exports;const dh=pM(bA);var lM={},uh=O0&&O0.__awaiter||function(t,e,o,n){function b(a){return a instanceof o?a:new o(function(O){O(a)})}return new(o||(o=Promise))(function(a,O){function A(v){try{y(n.next(v))}catch(N){O(N)}}function c(v){try{y(n.throw(v))}catch(N){O(N)}}function y(v){v.done?a(v.value):b(v.value).then(A,c)}y((n=n.apply(t,e||[])).next())})};Object.defineProperty(lM,"__esModule",{value:!0});lM.Monitor=void 0;const fh=Lr;class qh{static timeRequest(e,o,n){return function(...b){return uh(this,void 0,void 0,function*(){const a=performance.now(),O=yield n(...b),c=performance.now()-a;return fh.VizzlyApiClientLogger.debug(`[@vizzly/api-client timing] ${e.toUpperCase()} ${o} - ${c.toFixed(2)}ms`),O})}}}lM.Monitor=qh;var En={};Object.defineProperty(En,"__esModule",{value:!0});En.Path=void 0;class qr{static removeAnyWrappingForwardSlash(e){return e.startsWith("/")?qr.removeAnyWrappingForwardSlash(e.slice(1)):e.endsWith("/")?qr.removeAnyWrappingForwardSlash(e.slice(0,-1)):e}static baseIsValid(e){return e.startsWith("https://")||e.startsWith("http://")||e.startsWith(".")}static buildPath(e,o){const n=qr.removeAnyWrappingForwardSlash(e),b=qr.removeAnyWrappingForwardSlash(o),a=qr.baseIsValid(e)?"":"/";return n==""&&b==""?"/":b==""?`${a}${n}`:n!=""&&b!=""?`${a}${n}/${b}`:`${a}${b}`}static addQueryParam(e,o,n){const[b,a]=e.split("#"),[O,A]=b.split("?");var c=new URLSearchParams(A);c.set(o,n);var y=O+"?"+c.toString()+(a?`#${a}`:"");return y}static hasHashtag(e){return e.includes("#")}static setVizzlyHashtagValue(e,o){return`${e}#vizzly_${o}`}static getVizzlyHashtagValue(e){return e.split("#vizzly_")[1]||null}}En.Path=qr;const Wh="@vizzly/api-client",hh="0.0.57",mh="NONE",gh="src/index.ts",yh="dist/index.js",Rh="dist/index.d.ts",Lh="commonjs",vh=["dist"],_h={"@types/jest":"^29.5.12","@types/lodash":"^4.17.0","@types/uuid":"^9.0.8","@vizzly/auth":"^0.2.16",jest:"^29.6.0",lodash:"^4.17.21",nock:"^13.5.4",prettier:"^3.2.5","ts-jest":"^29.1.1","ts-loader":"^9.5.1",typescript:"^5.3.2",uuid:"^9.0.1"},Nh={test:". ./secrets.env && jest","test:ci":"jest",build:"rm -rf ./dist && tsc",dev:"tsc -w",format:"prettier --write ./src/** ./__tests__/**",prepublish:"yarn build"},Th={"@vizzly/semantic-layer-public":">=0.0.231","@vizzly/sqlbuilder-public":">=0.1.41","cross-fetch":"^4.0.0"},Bh={name:Wh,version:hh,private:!1,license:mh,source:gh,main:yh,types:Rh,type:Lh,files:vh,devDependencies:_h,scripts:Nh,dependencies:Th};var Sh=O0&&O0.__awaiter||function(t,e,o,n){function b(a){return a instanceof o?a:new o(function(O){O(a)})}return new(o||(o=Promise))(function(a,O){function A(v){try{y(n.next(v))}catch(N){O(N)}}function c(v){try{y(n.throw(v))}catch(N){O(N)}}function y(v){v.done?a(v.value):b(v.value).then(A,c)}y((n=n.apply(t,e||[])).next())})},wh=O0&&O0.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Cn,"__esModule",{value:!0});Cn.Api=void 0;const xh=wh(bA),Xh=lM,Ws=Lr,Ch=En;class Eh{constructor(e,o,n=()=>({})){this.host=o,this.extraHeaders=n,this.auth=e}execute(e){return Sh(this,void 0,void 0,function*(){var o,n;const b=this.auth.buildAuthHeaders(e.acceptedAuthParams),a=Object.assign(Object.assign({},e.headers||{}),this.extraHeaders()||{}),O=Ch.Path.buildPath(this.host,e.path),c=yield Xh.Monitor.timeRequest(e.method,O,xh.default)(O,{method:e.method,headers:Object.assign(Object.assign({"Content-Type":"application/json",Accept:"application/json","Vizzly-User-Agent":`${Ws.VizzlyApiClientLogger.UserAgentProduct}${this.originApp()} (Using client ${(o=Bh)===null||o===void 0?void 0:o.version})`},b),a),redirect:"follow",referrerPolicy:"no-referrer",body:e.body?JSON.stringify(e.body):null,signal:e.abortSignal});let y=!((n=c.headers.get("content-type"))===null||n===void 0)&&n.includes("json")?yield c.json():c.text();const v=c.headers.get("vizzly-query-engine-request-id")||"-",N=c.headers.get("x-request-id")||"-";return c.status===500&&Ws.VizzlyApiClientLogger.debug(`[TRACING] QE; ${v} - API; ${N}`),Ws.VizzlyApiClientLogger.debug(`[TRACING] QE; ${v} - API; ${N}`),{body:y,status:c.status,headers:c.headers}})}originApp(){if(!(typeof window<"u"&&window.document)){const o=process.env.NODE_ENV==="test"?"tests":"",n=process.env.VIZZLY_ORIGIN_APP||o||"";return n==""?"":` (${n})`}return""}getAuth(){return this.auth}}Cn.Api=Eh;var AM={},dM={};Object.defineProperty(dM,"__esModule",{value:!0});dM.FailedToFetchDashboards=void 0;class Dh extends Error{constructor(e){super(e),this.name="FailedToFetchDashboards"}}dM.FailedToFetchDashboards=Dh;var lb={};Object.defineProperty(lb,"__esModule",{value:!0});lb.MissingAuthParameter=void 0;class Ih extends Error{constructor(e){super(`Missing required auth parameter ${e}`)}}lb.MissingAuthParameter=Ih;var Ab={};Object.defineProperty(Ab,"__esModule",{value:!0});Ab.ValidationError=void 0;let Ph=class extends Error{constructor(e){super(e),this.name="ValidationError"}};Ab.ValidationError=Ph;var db={};Object.defineProperty(db,"__esModule",{value:!0});db.SQLPreviewError=void 0;const Fh=Ab;class kh extends Fh.ValidationError{constructor(e){super(e),this.name="SQLPreviewError"}}db.SQLPreviewError=kh;var ub={};Object.defineProperty(ub,"__esModule",{value:!0});ub.FailedToSetupProject=void 0;class jh extends Error{constructor(e){super(e),this.name="FailedToSetupProject"}}ub.FailedToSetupProject=jh;var fb={};Object.defineProperty(fb,"__esModule",{value:!0});fb.FailedToResolveDataSets=void 0;let $h=class extends Error{constructor(e){super(e),this.name="FailedToResolveDataSets"}};fb.FailedToResolveDataSets=$h;var uM={};Object.defineProperty(uM,"__esModule",{value:!0});uM.FailedToCreateGlobalLibrary=void 0;class Uh extends Error{constructor(e){super(e),this.name="FailedToCreateGlobalLibrary"}}uM.FailedToCreateGlobalLibrary=Uh;var qb={};Object.defineProperty(qb,"__esModule",{value:!0});qb.FailedToFetchVizzlyConfig=void 0;class Gh extends Error{constructor(e){super(e),this.name="FailedToFetchVizzlyConfig"}}qb.FailedToFetchVizzlyConfig=Gh;var Wb={};Object.defineProperty(Wb,"__esModule",{value:!0});Wb.ConnectionDoesNotExistOnProject=void 0;class Vh extends Error{constructor(e){super(e),this.name="ConnectionDoesNotExistOnProject"}}Wb.ConnectionDoesNotExistOnProject=Vh;var hb={};Object.defineProperty(hb,"__esModule",{value:!0});hb.FailedToFetchConnection=void 0;class Hh extends Error{constructor(e){super(e),this.name="FailedToFetchConnection"}}hb.FailedToFetchConnection=Hh;var mb={};Object.defineProperty(mb,"__esModule",{value:!0});mb.FailedToFetchProject=void 0;class Yh extends Error{constructor(e){super(e),this.name="FailedToFetchProject"}}mb.FailedToFetchProject=Yh;var fM={};Object.defineProperty(fM,"__esModule",{value:!0});fM.FailedToFetchProjects=void 0;class Kh extends Error{constructor(e){super(e),this.name="FailedToFetchProjects"}}fM.FailedToFetchProjects=Kh;var qM={};Object.defineProperty(qM,"__esModule",{value:!0});qM.FailedToFetchTeamMembers=void 0;class Qh extends Error{constructor(e){super(e),this.name="FailedToFetchTeamMembers"}}qM.FailedToFetchTeamMembers=Qh;var WM={};Object.defineProperty(WM,"__esModule",{value:!0});WM.FailedToCreateQueryEngineUser=void 0;class Zh extends Error{constructor(e){super(e),this.name="FailedToCreateQueryEngineUser"}}WM.FailedToCreateQueryEngineUser=Zh;var hM={};Object.defineProperty(hM,"__esModule",{value:!0});hM.FailedToFetchQueryEngineUser=void 0;class Jh extends Error{constructor(e){super(e),this.name="FailedToFetchQueryEngineUser"}}hM.FailedToFetchQueryEngineUser=Jh;var gb={};Object.defineProperty(gb,"__esModule",{value:!0});gb.ProjectEncryptedSecretAlreadySaved=void 0;class em extends Error{constructor(e){super(`Project encrypted encryption secret already exists for ${e}`),this.name="ProjectEncryptedSecretAlreadySaved"}}gb.ProjectEncryptedSecretAlreadySaved=em;var yb={};Object.defineProperty(yb,"__esModule",{value:!0});yb.FailedToSaveProjectEncryptedEncryptionSecret=void 0;class tm extends Error{constructor(e){super(`Failed to save project encrypted encryption secret for ${e}`),this.name="FailedToSaveProjectEncryptedEncryptionSecret"}}yb.FailedToSaveProjectEncryptedEncryptionSecret=tm;var mM={};Object.defineProperty(mM,"__esModule",{value:!0});mM.PermissionDenied=void 0;class om extends Error{constructor(e){super(e)}}mM.PermissionDenied=om;(function(t){var e=O0&&O0.__createBinding||(Object.create?function(n,b,a,O){O===void 0&&(O=a);var A=Object.getOwnPropertyDescriptor(b,a);(!A||("get"in A?!b.__esModule:A.writable||A.configurable))&&(A={enumerable:!0,get:function(){return b[a]}}),Object.defineProperty(n,O,A)}:function(n,b,a,O){O===void 0&&(O=a),n[O]=b[a]}),o=O0&&O0.__exportStar||function(n,b){for(var a in n)a!=="default"&&!Object.prototype.hasOwnProperty.call(b,a)&&e(b,n,a)};Object.defineProperty(t,"__esModule",{value:!0}),o(pb,t),o(ab,t),o(zb,t),o(dM,t),o(lb,t),o(bb,t),o(Ab,t),o(db,t),o(ub,t),o(fb,t),o(uM,t),o(Mb,t),o(cb,t),o(qb,t),o(Wb,t),o(hb,t),o(mb,t),o(fM,t),o(qM,t),o(WM,t),o(hM,t),o(gb,t),o(yb,t),o(mM,t)})(AM);var gM={};Object.defineProperty(gM,"__esModule",{value:!0});gM.FailedToUpdateQueryEngineUser=void 0;class rm extends Error{constructor(e){super(e),this.name="FailedToUpdateQueryEngineUser"}}gM.FailedToUpdateQueryEngineUser=rm;var L1=O0&&O0.__awaiter||function(t,e,o,n){function b(a){return a instanceof o?a:new o(function(O){O(a)})}return new(o||(o=Promise))(function(a,O){function A(v){try{y(n.next(v))}catch(N){O(N)}}function c(v){try{y(n.throw(v))}catch(N){O(N)}}function y(v){v.done?a(v.value):b(v.value).then(A,c)}y((n=n.apply(t,e||[])).next())})};Object.defineProperty(OM,"__esModule",{value:!0});OM.VizzlyApi=void 0;const nm=Cn,gn=AM,im=qb,bm=Wb,pm=hb,am=mb,Mm=gM,zm=yb,cm=gb,bl=xn;class sm extends nm.Api{constructor(e,o="https://api.vizzly.co"){super(e,o)}buildFetchDashboardAccessTokensRequest(e){return{path:"/api/v2/auth/dashboards/access",method:"post",body:{dashboardAccessToken:this.auth.getDashboardAccessToken(),projectAdminOverrideToken:this.auth.getProjectAdminOverrideToken()},abortSignal:e?.abortSignal}}fetchGlobalLibraries(e){return L1(this,void 0,void 0,function*(){return yield this.execute(this.buildFetchGlobalLibrariesRequest(e))})}buildFetchGlobalLibrariesRequest(e){return{path:"/api/v2/multi-get-global-library",method:"post",body:{globalLibraryAccessTokens:e.globalLibraryAccessTokens},abortSignal:e.abortSignal}}fetchGlobalLibraryAccessTokens(e){return L1(this,void 0,void 0,function*(){return yield this.execute(this.buildFetchGlobalLibraryAccessTokensRequest(e))})}buildFetchGlobalLibraryAccessTokensRequest(e){return{path:"/api/v2/auth/global-library/access",method:"post",body:{dashboardAccessToken:this.auth.getDashboardAccessToken(),projectAdminOverrideToken:this.auth.getProjectAdminOverrideToken()},abortSignal:e?.abortSignal}}buildCreateDashboardRequest(e){return{path:"/api/v2/dashboard",method:"post",body:{dashboardAccessToken:this.auth.getDashboardAccessToken(),definition:e.definition||bl.DashboardRepository.EmptyDashboardDefinition(),meta:e.metadata||e.meta||{},parentDashboardId:e.parentDashboardId,permissions:e.permissions,usage_metadata:e.usage_metadata},abortSignal:e.abortSignal}}buildFetchDashboardsRequest(e){return{path:"/api/v2/multi-get-dashboard",method:"post",body:{dashboardAccessTokens:e.dashboardSessionAccessTokens},abortSignal:e.abortSignal}}createParentDashboard(e){return L1(this,void 0,void 0,function*(){return yield this.execute(this.buildCreateParentDashboardRequest(e))})}buildCreateParentDashboardRequest(e){return{path:"/api/v2/parent-dashboard",method:"post",body:{projectId:e.projectId,definition:e.definition||bl.DashboardRepository.EmptyDashboardDefinition(),name:e.name},abortSignal:e.abortSignal}}createParentGlobalLibrary(e){return L1(this,void 0,void 0,function*(){return yield this.execute(this.buildCreateParentGlobalLibraryRequest(e))})}buildCreateParentGlobalLibraryRequest(e){return{path:"/api/v2/parent-global-library",method:"post",body:{projectId:e.projectId,library:e.library},abortSignal:e.abortSignal}}createGlobalLibrary(e){return L1(this,void 0,void 0,function*(){const o=yield this.execute(this.buildCreateGlobalLibraryRequest(e));if(o.status===200)return o.body;throw o.status===403?new gn.PermissionDenied("Permission denied when creating a global library via the Vizzly API."):new gn.FailedToCreateGlobalLibrary(`Failed to create global library, got status ${o.status}`)})}buildCreateGlobalLibraryRequest(e){return{path:"/api/v2/global-library",method:"post",body:{dashboardAccessToken:this.auth.getDashboardAccessToken(),parentGlobalLibraryId:e.parentGlobalLibraryId,library:e.library,permissions:e.permissions},abortSignal:e.abortSignal}}getProjects(e){return L1(this,void 0,void 0,function*(){const o=yield this.execute(this.buildGetProjectsRequest(e));if(o.status===200)return{projects:o.body.projects};throw new gn.FailedToFetchProjects(`Failed to fetch projects. Got status ${o.status}`)})}buildGetProjectsRequest(e){return{path:`/api/v2/projects${e?.withParentDashboards?"?with_parent_dashboards=true":""}`,method:"get",abortSignal:e?.abortSignal}}createProjectApiKey(e){return L1(this,void 0,void 0,function*(){return yield this.execute(this.buildCreateProjectApiKeyRequest(e))})}buildCreateProjectApiKeyRequest(e){return{path:`/api/v3/project/${e.projectId}/api-key`,method:"post",body:{},abortSignal:e.abortSignal}}createQueryEngineUser(e){return L1(this,void 0,void 0,function*(){const o=yield this.execute(this.buildCreateQueryEngineUserRequest(e));if(o.status===200)return o.body.query_engine_user;throw new gn.FailedToCreateQueryEngineUser(`Failed to create query engine user. Got status ${o.status}`)})}buildCreateQueryEngineUserRequest(e){return{path:`/api/v3/project/${e.projectId}/query-engine-user`,method:"post",body:{email:e.email,password:e.password},abortSignal:e.abortSignal}}buildCreateSelfHostedDynamicQueryEngineProjectRequest(e){return{path:"/api/v2/project/self-hosted-dynamic-query-engine",method:"post",body:{},abortSignal:e?.abortSignal}}buildCreateSelfHostedInBrowserProjectRequest(e){return{path:"/api/v2/project/self-hosted-in-browser",method:"post",body:{},abortSignal:e?.abortSignal}}buildCreateSelfHostedProjectRequest(e){return{path:"/api/v2/project/self-hosted-query-engine",method:"post",body:{},abortSignal:e?.abortSignal}}createManagedQueryEngineProject(e){return L1(this,void 0,void 0,function*(){return yield this.execute(this.buildCreateManagedQueryEngineProjectRequest(e))})}buildCreateManagedQueryEngineProjectRequest(e){return{path:"/api/v2/project/managed-query-engine",method:"post",body:{parent_dashboard_definition:{}},abortSignal:e?.abortSignal}}createVizzlyConfigVersion(e){return L1(this,void 0,void 0,function*(){return yield this.execute(this.buildCreateVizzlyConfigVersionRequest(e))})}buildCreateVizzlyConfigVersionRequest(e){return{path:`/api/v3/project/${e.projectId}/config`,method:"post",body:{projectId:e.projectId,encryptedConfig:e.encryptedConfig},abortSignal:e.abortSignal}}duplicateDashboards(e){return L1(this,void 0,void 0,function*(){return yield this.execute(this.buildDuplicateDashboardsRequest(e))})}buildDuplicateDashboardsRequest(e){return{path:"/api/v2/duplicate-dashboards",method:"post",body:{dashboardIds:e.dashboardIds},abortSignal:e.abortSignal,acceptedAuthParams:["projectApiKey"]}}duplicateParentDashboard(e){return L1(this,void 0,void 0,function*(){return yield this.execute(this.buildDuplicateParentDashboardRequest(e))})}buildDuplicateParentDashboardRequest(e){return{path:"/api/v2/duplicate-parent-dashboard",method:"post",body:{dashboardId:e.dashboardId},abortSignal:e.abortSignal}}getConnection(e){return L1(this,void 0,void 0,function*(){const o=yield this.execute(this.buildGetConnectionRequest(e));if(o.status===200)return{encryptedCredentials:o.body.encrypted_credentials};throw o.status==404?new bm.ConnectionDoesNotExistOnProject("An active connection does not exist on the project"):new pm.FailedToFetchConnection(`Failed to fetch connection for the project. Got status ${o.status}`)})}buildGetConnectionRequest(e){return{path:`/api/v2/project/${e.projectId}/connection`,method:"get",abortSignal:e.abortSignal,acceptedAuthParams:["projectApiKey","projectAccessToken"]}}getManagedQueryEngineKeyPair(e){return L1(this,void 0,void 0,function*(){return yield this.execute(this.buildGetManagedQueryEngineKeyPairRequest(e))})}buildGetManagedQueryEngineKeyPairRequest(e){return{path:`/api/v2/project/managed-query-engine/${e.managedProjectId}/key-pairs/${e.keyPairId}`,method:"get",abortSignal:e.abortSignal}}getProject(e){return L1(this,void 0,void 0,function*(){const o=yield this.execute(this.buildGetProjectRequest(e));if(o.status===200)return o.body;throw new am.FailedToFetchProject(`Failed to fetch project. Got status ${o.status}`)})}buildGetProjectRequest(e){const o=e.withParentDashboards?"?with_parent_dashboards=true":"";return{path:`/api/v3/project/${e.projectId}${o}`,method:"get",abortSignal:e.abortSignal,acceptedAuthParams:["projectApiKey","projectAccessToken","appSessionToken"]}}getProjectAccessToken(e){return L1(this,void 0,void 0,function*(){return yield this.execute(this.buildGetProjectAccessTokenRequest(e))})}buildGetProjectAccessTokenRequest(e){let o="";return e.resourceFilters&&(o=`filter=${e.resourceFilters.join(",")}`),{path:`/api/v2/auth/project/${e.projectId}/access_token?${o}`,method:"get",abortSignal:e.abortSignal,acceptedAuthParams:["projectApiKey","appSessionToken"]}}getQueryEngineUser(e){return L1(this,void 0,void 0,function*(){const o=yield this.execute(this.buildGetQueryEngineUserRequest(e));if(o.status===200)return o.body.query_engine_user;throw new gn.FailedToFetchQueryEngineUser(`Failed to fetch query engine user. Got status ${o.status}`)})}buildGetQueryEngineUserRequest(e){return{path:`/api/v3/project/${e.projectId}/query-engine-user?email=${encodeURIComponent(e.email)}`,method:"get",abortSignal:e.abortSignal,acceptedAuthParams:["projectApiKey","projectAccessToken"]}}getTeamMembers(e){return L1(this,void 0,void 0,function*(){const o=yield this.execute(this.buildGetTeamMembersRequest(e));if(o.status===200)return o.body;throw new gn.FailedToFetchTeamMembers(`Failed to fetch team members. Got status ${o.status}`)})}buildGetTeamMembersRequest(e){return{path:`/api/v3/project/${e.projectId}/organisation-team-members`,method:"get",abortSignal:e.abortSignal,acceptedAuthParams:["projectApiKey","projectAccessToken"]}}getVizzlyConfig(e){return L1(this,void 0,void 0,function*(){const o=yield this.execute(this.buildGetVizzlyConfigRequest(e));if(o.status===200)return{encryptedConfig:o.body.encrypted_config};throw new im.FailedToFetchVizzlyConfig(`Failed to fetch the config containing data sets from the Vizzly API. Got status ${o.status}`)})}buildGetVizzlyConfigRequest(e){return{path:`/api/v3/project/${e.projectId}/config`,method:"get",abortSignal:e.abortSignal,acceptedAuthParams:["projectApiKey","projectAccessToken"]}}saveConnection(e){return L1(this,void 0,void 0,function*(){return yield this.execute(this.buildSaveConnectionRequest(e))})}buildSaveConnectionRequest(e){return{path:"/api/v3/project/connection",method:"post",body:{projectId:e.projectId,encryptedConfig:e.encryptedConfig,encryptedConnection:e.encryptedConnection},abortSignal:e.abortSignal,acceptedAuthParams:["projectApiKey","projectAccessToken"]}}saveEncryptedProjectEncryptionSecret(e){return L1(this,void 0,void 0,function*(){const o=yield this.execute(this.buildSaveEncryptedProjectEncryptionSecretRequest(e));if(o.status===200)return!0;throw o.status==400&&!e.allowRotation?new cm.ProjectEncryptedSecretAlreadySaved(e.projectId):new zm.FailedToSaveProjectEncryptedEncryptionSecret(e.projectId)})}buildSaveEncryptedProjectEncryptionSecretRequest(e){return{path:`/api/v3/project/${e.projectId}/encrypted-encryption-secret`,method:"post",body:{projectId:e.projectId,encryptedEncryptionSecret:e.encryptedProjectEncryptionSecret,allowRotation:e.allowRotation},abortSignal:e.abortSignal,acceptedAuthParams:["projectApiKey","projectAccessToken"]}}getScheduledReports(e){return L1(this,void 0,void 0,function*(){return yield this.execute(this.buildGetScheduledReports(e))})}buildGetScheduledReports(e){return{path:"/api/scheduled-report/collect",method:"post",body:{dashboardAccessToken:e.dashboardAccessToken},abortSignal:e.abortSignal}}saveScheduledReport(e){return L1(this,void 0,void 0,function*(){return yield this.execute(this.buildSaveScheduledReportRequest(e))})}buildSaveScheduledReportRequest(e){return{path:"/api/scheduled-report",method:"post",body:{cronSchedule:e.cronSchedule,dashboardAccessToken:e.dashboardAccessToken,scheduledReportId:e.scheduledReportId},abortSignal:e.abortSignal}}updateDashboard(e){return L1(this,void 0,void 0,function*(){return yield this.execute(this.buildUpdateDashboardRequest(e))})}buildUpdateDashboardRequest(e){return{path:"/api/v2/dashboard",method:"put",body:{dashboardSessionToken:e.dashboardPermission.token,definition:e.definition,meta:e.metadata||e.meta||{},deleted:e.deleted,name:e.name,usage_metadata:e.usage_metadata},abortSignal:e.abortSignal}}updateParentGlobalLibrary(e){return L1(this,void 0,void 0,function*(){return yield this.execute(this.buildUpdateParentGlobalLibraryRequest(e))})}buildUpdateParentGlobalLibraryRequest(e){return{path:"/api/v2/parent-global-library",method:"put",body:{globalLibraryId:e.globalLibraryId,deleted:e.deleted,name:e.name},abortSignal:e.abortSignal}}updateGlobalLibrary(e){return L1(this,void 0,void 0,function*(){return yield this.execute(this.buildUpdateGlobalLibraryRequest(e))})}buildUpdateGlobalLibraryRequest(e){return{path:"/api/v2/global-library",method:"put",body:{globalLibrarySessionToken:e.globalLibrarySessionToken,deleted:e.deleted,library:e.library,usage_metadata:e.usage_metadata},abortSignal:e.abortSignal}}updateProjectApiKey(e){return L1(this,void 0,void 0,function*(){return yield this.execute(this.buildUpdateProjectApiKeyRequest(e))})}buildUpdateProjectApiKeyRequest(e){return{path:`/api/v3/project/${e.projectId}/api-key/${e.projectApiKeyId}`,method:"put",body:{disabled:e.disabled},abortSignal:e.abortSignal}}updateQueryEngineUser(e){return L1(this,void 0,void 0,function*(){const o=yield this.execute(this.buildUpdateQueryEngineUserRequest(e));if(o.status===200)return!0;throw new Mm.FailedToUpdateQueryEngineUser(`Failed to update query engine user. Got status ${o.status}`)})}buildUpdateQueryEngineUserRequest(e){return{path:`/api/v3/project/${e.projectId}/query-engine-user`,method:"put",body:{query_engine_user_id:e.queryEngineUserId,password:e.password},abortSignal:e.abortSignal,acceptedAuthParams:["projectApiKey","projectAccessToken"]}}getDashboardFieldUsageMetadata(e){return L1(this,void 0,void 0,function*(){return yield this.execute(this.buildGetDashboardFieldUsageMetadata(e))})}buildGetDashboardFieldUsageMetadata(e){return{path:`/api/v2/field-usage/dashboard/${e.dashboardId}`,method:"get",abortSignal:e.abortSignal}}}OM.VizzlyApi=sm;var yM={},x1=O0&&O0.__awaiter||function(t,e,o,n){function b(a){return a instanceof o?a:new o(function(O){O(a)})}return new(o||(o=Promise))(function(a,O){function A(v){try{y(n.next(v))}catch(N){O(N)}}function c(v){try{y(n.throw(v))}catch(N){O(N)}}function y(v){v.done?a(v.value):b(v.value).then(A,c)}y((n=n.apply(t,e||[])).next())})};Object.defineProperty(yM,"__esModule",{value:!0});yM.VizzlyAppApi=void 0;const Om=Cn;class lm extends Om.Api{constructor(e,o="https://app.vizzly.co"){super(e,o)}createCliAuthToken(){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildCreateCliAuthTokenRequest())})}buildCreateCliAuthTokenRequest(){return{path:"/api/create-cli-auth-token",method:"post",body:{}}}createInstantDashboard(e){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildCreateInstantDashboardRequest(e))})}buildCreateInstantDashboardRequest(e){return{path:"/api/v2/instant-dashboard",method:"post",body:{parent_dashboard_definition:e.definition}}}createProjectAdminOverrideAccessToken(e){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildCreateProjectAdminOverrideAccessTokenRequest(e))})}buildCreateProjectAdminOverrideAccessTokenRequest(e){return{path:`/api/v2/project/${e.projectId}/admin-override`,method:"post",body:{}}}startEmailChange(e){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildStartEmailChangeRequest(e))})}buildStartEmailChangeRequest(e){return{path:"/api/self/start-email-change",method:"post",body:{email:e.email}}}completeEmailChange(e){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildCompleteEmailChangeRequest(e))})}buildCompleteEmailChangeRequest(e){return{path:"/api/self/complete-email-change",method:"post",body:{token:e.token}}}getManagedQueryEngineAccessTokens(e){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildGetManagedQueryEngineAccessTokensRequest(e))})}buildGetManagedQueryEngineAccessTokensRequest(e){return{path:`/api/v2/managed-query-engine/${e.managedQueryEngineId}/identity`,method:"get"}}getParentDashboardMeta(e){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildGetParentDashboardMetaRequest(e))})}buildGetParentDashboardMetaRequest(e){return{path:`/api/v2/parent-dashboard/${e.dashboardId}/stats`,method:"get"}}updateParentDashboard(e){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildUpdateParentDashboardRequest(e))})}buildUpdateParentDashboardRequest(e){return{path:`/api/v2/parent-dashboard/${e.dashboardId}/stats`,method:"put",body:{name:e.name,definition:e.definition,meta:e.meta,deleted:e.deleted,webhookId:e.webhookId}}}getProjectMeta(e){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildGetProjectMetaRequest(e))})}buildGetProjectMetaRequest(e){return{path:`/api/v2/project/${e.projectId}/meta`,method:"get"}}getSelf(){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildGetSelfRequest())})}buildGetSelfRequest(){return{path:"/api/self",method:"get"}}getTeam(){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildGetTeamRequest())})}buildGetTeamRequest(){return{path:"/api/team",method:"get"}}getWebhooks(){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildGetWebhooksRequest())})}buildGetWebhooksRequest(){return{path:"/api/organisation/webhooks",method:"get"}}inviteTeamMember(e){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildInviteTeamMemberRequest(e))})}buildInviteTeamMemberRequest(e){return{path:"/api/invite",method:"post",body:{email:e.email,first_name:e.firstName,last_name:e.lastName,department:e.department}}}inAppAcceptTeamMemberInvite(e){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildInAppAcceptTeamMemberInviteRequest(e))})}buildInAppAcceptTeamMemberInviteRequest(e){return{path:"/api/invite/in-app-accept",method:"post",body:{team_member_id:e.teamMemberId}}}acceptTeamMemberInvite(e){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildAcceptTeamMemberInviteRequest(e))})}buildAcceptTeamMemberInviteRequest(e){return{path:"/api/invite/accept",method:"post",body:{token:e.inviteToken}}}resendTeamMemberInvite(e){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildResendTeamMemberInviteRequest(e))})}buildResendTeamMemberInviteRequest(e){return{path:"/api/invite/resend",method:"post",body:{team_member_id:e.teamMemberId}}}removeTeamMember(e){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildRemoveTeamMemberRequest(e))})}buildRemoveTeamMemberRequest(e){return{path:"/api/invite/remove",method:"post",body:{team_member_id:e.teamMemberId}}}startSignIn(e){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildStartSignInRequest(e))})}buildStartSignInRequest(e){return{path:"/api/start-sign-in",method:"post",body:{email:e.email}}}completeSignIn(e){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildCompleteSignInRequest(e))})}buildCompleteSignInRequest(e){return{path:"/api/complete-sign-in",method:"post",body:{token:e.token}}}searchUserDashboards(e){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildSearchUserDashboardsRequest(e))})}buildSearchUserDashboardsRequest(e){return{path:`/api/v2/project/${e.projectId}/search-user-dashboards?user_reference=${e.userReference}`,method:"get"}}signUp(e){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildSignUpRequest(e))})}buildSignUpRequest(e){return{path:"/api/complete-sign-in",method:"post",body:{email:e.email,organisation_title:e.organisationTitle,first_name:e.firstName,last_name:e.lastName,department:e.department}}}switchOrganisation(e){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildSwitchOrganisationRequest(e))})}buildSwitchOrganisationRequest(e){return{path:"/api/team/switch",method:"post",body:{organisation_id:e.organisationId}}}toggleKeyPairDisabled(e){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildToggleKeyPairDisabledRequest(e))})}buildToggleKeyPairDisabledRequest(e){return{path:"/api/organisation/key-pairs/toggle-disabled",method:"post",body:{key_pair_id:e.keyPairId,disabled:e.disabled}}}updateProject(e){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildUpdateProjectRequest(e))})}buildUpdateProjectRequest(e){return{path:"/api/v2/project",method:"put",body:{project_id:e.projectId,deleted:e.deleted,name:e.name}}}uploadPublicKey(e){return x1(this,void 0,void 0,function*(){return yield this.execute(this.buildUploadPublicKeyRequest(e))})}buildUploadPublicKeyRequest(e){return{path:"/api/v2/project/key-pair",method:"post",body:{public_key:e.publicKey,project_id:e.projectId}}}}yM.VizzlyAppApi=lm;var RM={},v1=O0&&O0.__awaiter||function(t,e,o,n){function b(a){return a instanceof o?a:new o(function(O){O(a)})}return new(o||(o=Promise))(function(a,O){function A(v){try{y(n.next(v))}catch(N){O(N)}}function c(v){try{y(n.throw(v))}catch(N){O(N)}}function y(v){v.done?a(v.value):b(v.value).then(A,c)}y((n=n.apply(t,e||[])).next())})};Object.defineProperty(RM,"__esModule",{value:!0});RM.VizzlyQueryEngineApi=void 0;const Am=Cn,dm=db,um=fb,fm=ub,pl=AM,qm=xn,hs=En;class Wm extends Am.Api{constructor(e,o,n){super(e,o,n)}buildCreateDashboardRequest(e){return{path:"/api/v1/dashboard",method:"post",abortSignal:e.abortSignal,body:{dashboardAccessToken:this.auth.getDashboardAccessToken(),definition:e.definition||qm.DashboardRepository.EmptyDashboardDefinition(),meta:e.metadata||e.meta||{},parentDashboardId:e.parentDashboardId,permissions:e.permissions,usage_metadata:e.usage_metadata}}}buildFetchDashboardAccessTokensRequest(e){return{path:"/api/v1/dashboard/access",method:"post",abortSignal:e?.abortSignal,body:{dashboardAccessToken:this.auth.getDashboardAccessToken(),projectAdminOverrideToken:this.auth.getProjectAdminOverrideToken()}}}fetchGlobalLibraryAccessTokens(e){return v1(this,void 0,void 0,function*(){return yield this.execute(this.buildFetchGlobalLibraryAccessTokensRequest(e))})}buildFetchGlobalLibraryAccessTokensRequest(e){return{path:"/api/v1/global-library/access",method:"post",abortSignal:e?.abortSignal,body:{dashboardAccessToken:this.auth.getDashboardAccessToken(),projectAdminOverrideToken:this.auth.getProjectAdminOverrideToken()}}}buildFetchDashboardsRequest(e){return{path:"/api/v1/get-dashboards",method:"post",abortSignal:e.abortSignal,body:{dashboardAccessTokens:e.dashboardSessionAccessTokens}}}createConfigFromUpload(e){return v1(this,void 0,void 0,function*(){return yield this.execute(this.buildCreateConfigFromUploadRequest(e))})}buildCreateConfigFromUploadRequest(e){return{path:"/api/v1/create-config-from-upload",method:"post",abortSignal:e.abortSignal,body:{queryEngineAccessToken:this.auth.getQueryEngineAccessToken(),table:e.table,fieldPublicNames:e.fieldPublicNames}}}createResults(e){return v1(this,arguments,void 0,function*(o,n="v2"){return yield this.execute(this.buildCreateResultsRequest(o,n))})}buildCreateResultsRequest(e,o){return{path:`/api/${o}/create-results`,method:"post",abortSignal:e.abortSignal,body:{queries:e.queries,dynamicConfig:e.dynamicConfig,identityConfigIntegritySignature:this.auth.hasDataAccessToken()?this.auth.getDataAccessToken():void 0,secureFilters:e.secureFilters,virtualFields:{}},acceptedAuthParams:["queryEngineApiKey","dashboardAccessToken"]}}collectSchema(e){return v1(this,void 0,void 0,function*(){return yield this.execute(this.buildCollectSchemaRequest(e))})}buildCollectSchemaRequest(e){return{path:"/api/v1/schema",method:"post",abortSignal:e.abortSignal,body:{allowedConfigOrigins:e.allowedConfigOrigins,dynamicConfig:e.dynamicConfig},acceptedAuthParams:["queryEngineApiKey"]}}createSqlPreview(e){return v1(this,void 0,void 0,function*(){var o;const n=yield this.execute(this.buildCreateSqlPreviewRequest(e));if(n.status===200)return n;throw new dm.SQLPreviewError(((o=n?.body)===null||o===void 0?void 0:o.message)||"Unknown SQL error")})}buildCreateSqlPreviewRequest(e){return{path:"/api/v1/create-sql-preview",method:"post",abortSignal:e.abortSignal,body:{sql:e.sql,parameters:e.parameters,limit:e.limit}}}createQueryEngineUser(e){return v1(this,void 0,void 0,function*(){return yield this.execute(this.buildCreateQueryEngineUserRequest(e))})}buildCreateQueryEngineUserRequest(e){return{path:"/api/v1/query-engine-user",method:"post",abortSignal:e.abortSignal,body:{email:e.email,password:e.password}}}fetchDataSets(e){return v1(this,void 0,void 0,function*(){const o=this.buildFetchDataSetsRequest(e),n=yield this.execute(o);if(n.status===200)return n;throw new um.FailedToResolveDataSets(`Failed to resolve data sets from ${o.path}. Received status ${n.status}`)})}buildFetchDataSetsRequest(e){return{path:"/api/v1/resolve-data-sets",method:"post",abortSignal:e?.abortSignal,body:{integritySignature:this.auth.getDataAccessToken()}}}fetchSelfHostedQueryEngineConfig(e){return v1(this,void 0,void 0,function*(){return this.execute(this.buildFetchSelfHostedQueryEngineConfigRequest(e))})}buildFetchSelfHostedQueryEngineConfigRequest(e){return{path:"/api/v1/support",method:"post",abortSignal:e?.abortSignal,body:{}}}fetchProject(e){return v1(this,void 0,void 0,function*(){return this.execute(this.buildFetchProjectRequest(e))})}buildFetchProjectRequest(e){return{path:"/api/v1/project",method:"get",abortSignal:e?.abortSignal,body:{}}}getStarted(e){return v1(this,void 0,void 0,function*(){const o=yield this.execute(this.buildGetStartedRequest(e));if(o.status!=200)throw new fm.FailedToSetupProject(typeof o.body=="object"&&o.body.reason&&"reason"in o.body?o.body.reason:"Failed to create the first user.");return o})}buildGetStartedRequest(e){return{path:"/api/v2/get-started",method:"post",abortSignal:e.abortSignal,body:{email:e.email,password:e.password}}}getTeamMembers(e){return v1(this,void 0,void 0,function*(){return this.execute(this.buildGetTeamMembersRequest(e))})}buildGetTeamMembersRequest(e){return{path:"/api/v1/team-members",method:"get",abortSignal:e?.abortSignal}}isVizzly(e){return v1(this,void 0,void 0,function*(){return this.execute(this.buildIsVizzlyRequest(e))})}buildIsVizzlyRequest(e){return{path:"/api/is-vizzly",method:"get",abortSignal:e?.abortSignal}}saveConfig(e){return v1(this,void 0,void 0,function*(){return yield this.execute(this.buildSaveConfigRequest(e))})}buildSaveConfigRequest(e){return{path:"/api/v1/save-config",method:"post",abortSignal:e.abortSignal,body:{config:e.config}}}saveConnection(e){return v1(this,void 0,void 0,function*(){return yield this.execute(this.buildSaveConnectionRequest(e))})}buildSaveConnectionRequest(e){return{path:"/api/v1/save-connection",method:"post",abortSignal:e.abortSignal,body:{connection:e.connection,client:e.client}}}signInWithQueryEngineAccessToken(e){return v1(this,void 0,void 0,function*(){return this.execute(this.buildSignInWithQueryEngineAccessTokenRequest(e))})}buildSignInWithQueryEngineAccessTokenRequest(e){return{path:"/api/v1/sign-in",method:"post",abortSignal:e?.abortSignal,body:{}}}signInWithEmailAndPassword(e){return v1(this,void 0,void 0,function*(){return yield this.execute(this.buildSignInWithEmailAndPasswordRequest(e))})}buildSignInWithEmailAndPasswordRequest(e){return{path:"/api/v1/sign-in",method:"post",abortSignal:e.abortSignal,body:{email:e.email,password:e.password}}}status(e){return v1(this,void 0,void 0,function*(){return this.execute(this.buildStatusRequest(e))})}buildStatusRequest(e){return{path:"/api/status",method:"post",abortSignal:e?.abortSignal,body:{}}}createGlobalLibrary(e){return v1(this,void 0,void 0,function*(){const o=yield this.execute(this.buildCreateGlobalLibraryRequest(e));if(o.status===200)return o.body;throw o.status===403?new pl.PermissionDenied("Permission denied when creating a global library via the Vizzly Query Engine."):new pl.FailedToCreateGlobalLibrary(`Failed to create a global library. Got status ${o.status}`)})}buildCreateGlobalLibraryRequest(e){return{path:"/api/v1/global-library",method:"post",abortSignal:e.abortSignal,body:{dashboardAccessToken:this.auth.getDashboardAccessToken(),parentGlobalLibraryId:e.parentGlobalLibraryId,library:e.library,permissions:e.permissions}}}fetchGlobalLibraries(e){return v1(this,void 0,void 0,function*(){return yield this.execute(this.buildFetchGlobalLibrariesRequest(e))})}buildFetchGlobalLibrariesRequest(e){return{path:"/api/v1/get-global-libraries",method:"post",abortSignal:e.abortSignal,body:{globalLibraryAccessTokens:e.globalLibraryAccessTokens}}}updateGlobalLibrary(e){return v1(this,void 0,void 0,function*(){return yield this.execute(this.buildUpdateGlobalLibraryRequest(e))})}buildUpdateGlobalLibraryRequest(e){return{path:"/api/v1/global-library",method:"put",abortSignal:e.abortSignal,body:{globalLibrarySessionToken:e.globalLibrarySessionToken,deleted:e.deleted,library:e.library,usage_metadata:e.usage_metadata}}}updateDashboard(e){return v1(this,void 0,void 0,function*(){return yield this.execute(this.buildUpdateDashboardRequest(e))})}buildUpdateDashboardRequest(e){return{path:"/api/v1/dashboard",method:"put",abortSignal:e.abortSignal,body:{dashboardSessionToken:e.dashboardPermission.token,definition:e.definition,meta:e.metadata||e.meta||{},deleted:e.deleted,name:e.name,usage_metadata:e.usage_metadata}}}updateQueryEngineUser(e){return v1(this,void 0,void 0,function*(){return yield this.execute(this.buildUpdateQueryEngineUserRequest(e))})}buildUpdateQueryEngineUserRequest(e){return{path:"/api/v1/query-engine-user",method:"put",abortSignal:e.abortSignal,body:{queryEngineUserId:e.queryEngineUserId,password:e.password}}}uploadDataToVizzlyCloud(e){return v1(this,void 0,void 0,function*(){return yield this.execute(this.buildUploadDataToVizzlyCloudRequest(e))})}buildUploadDataToVizzlyCloudRequest(e){return{path:"/api/v1/ingest",method:"post",abortSignal:e.abortSignal,body:{queryEngineAccessToken:this.auth.getQueryEngineAccessToken(),ingest:e.ingest}}}createCompanyInfrastructure(e){return v1(this,void 0,void 0,function*(){return yield this.execute(this.buildCreateCompanyInfrastructureRequest(e))})}getCreateCompanyInfrastructureStatus(e){return v1(this,void 0,void 0,function*(){return yield this.execute(this.buildCreateCompanyInfrastructureRequest(e,{statusOnly:!0}))})}buildCreateCompanyInfrastructureRequest(e,o){const n=o?.statusOnly?"/status":"";return{path:hs.Path.buildPath("/api/v1/data-optimiser/company",n),method:"post",abortSignal:e.abortSignal,body:{company:{id:e.companyId}},acceptedAuthParams:["queryEngineApiKey"]}}ingestDatasource(e){return v1(this,void 0,void 0,function*(){return yield this.execute(this.buildIngestDatasourceRequest(e,{statusOnly:!1}))})}getIngestDatasourceStatus(e){return v1(this,void 0,void 0,function*(){return yield this.execute(this.buildIngestDatasourceRequest(e,{statusOnly:!0}))})}buildIngestDatasourceRequest(e,o){const n=o?.statusOnly?"/status":"";return{path:hs.Path.buildPath("/api/v1/data-optimiser/ingest",n),method:"post",abortSignal:e.abortSignal,body:{dataSourceId:e.dataSourceId,ingestFields:e.ingestFields,internalCompanyConnection:e.internalCompanyConnection,externalSnowflakeConnection:e.externalSnowflakeConnection},acceptedAuthParams:["queryEngineApiKey"]}}getCreateSnapshotStatus(e){return v1(this,void 0,void 0,function*(){return yield this.execute(this.buildCreateSnapshotRequest(e,{statusOnly:!0}))})}createSnapshot(e){return v1(this,void 0,void 0,function*(){return yield this.execute(this.buildCreateSnapshotRequest(e,{statusOnly:!1}))})}buildCreateSnapshotRequest(e,o){const n=o?.statusOnly?"/status":"";return{path:hs.Path.buildPath("/api/v1/data-optimiser/snapshot",n),method:"post",abortSignal:e.abortSignal,body:{ingestDataSourceId:e.ingestDataSourceId,snapshotDataSourceId:e.snapshotDataSourceId,ingestFields:e.ingestFields,cascadingInstructions:e.cascadingInstructions,primaryDateFieldId:e.primaryDateFieldId,internalCompanyConnection:e.internalCompanyConnection},acceptedAuthParams:["queryEngineApiKey"]}}}RM.VizzlyQueryEngineApi=Wm;var LM={};Object.defineProperty(LM,"__esModule",{value:!0});LM.Authentication=void 0;const hm=P0,yn=lb;class mm{constructor(e){this.authParams=e}updateAuthParams(e){this.authParams=Object.assign(Object.assign({},this.authParams),e)}clearAuthParams(){this.authParams={}}getQueryEngineApiKey(){if(!this.authParams.queryEngineApiKey)throw new yn.MissingAuthParameter("queryEngineApiKey");return this.authParams.queryEngineApiKey}getQueryEngineAccessToken(){if(!this.authParams.queryEngineAccessToken)throw new yn.MissingAuthParameter("queryEngineAccessToken");return this.authParams.queryEngineAccessToken}getProjectAdminOverrideToken(){return this.authParams.projectAdminOverrideToken}getDashboardAccessToken(){if(!this.authParams.dashboardAccessToken)throw new yn.MissingAuthParameter("dashboardAccessToken");return this.authParams.dashboardAccessToken}getAppSessionToken(){return this.authParams.appSessionToken}hasDataAccessToken(){return!!this.authParams.dataAccessToken}getDataAccessToken(){if(!this.hasDataAccessToken())throw new yn.MissingAuthParameter("dataAccessToken");return this.authParams.dataAccessToken}getProjectApiKey(){if(!this.authParams.projectApiKey)throw new yn.MissingAuthParameter("projectApiKey");return this.authParams.projectApiKey}getProjectAccessToken(){if(!this.authParams.projectAccessToken)throw new yn.MissingAuthParameter("projectAccessToken");return this.authParams.projectAccessToken}buildAuthHeaders(e){let o=e?(0,hm.pick)(this.authParams,e):this.authParams;return o.dashboardAccessToken?{auth:`Bearer ${o.dashboardAccessToken}`}:o.queryEngineApiKey?{"Config-Api-Key":o.queryEngineApiKey}:o.projectAccessToken?{auth:`Bearer ${o.projectAccessToken}`}:o.projectApiKey?{auth:`Api-Key ${o.projectApiKey}`}:o.appSessionToken?{auth:`Bearer ${o.appSessionToken}`}:{}}}LM.Authentication=mm;var Yo={};Object.defineProperty(Yo,"__esModule",{value:!0});Yo.PersistDirectToVizzlyApi=Yo.PersistViaQueryEngine=Yo.ImplementationStrategy=void 0;class MO{}Yo.ImplementationStrategy=MO;class gm extends MO{shouldPersistViaQueryEngine(){return!0}}Yo.PersistViaQueryEngine=gm;class ym extends MO{shouldPersistViaQueryEngine(){return!1}}Yo.PersistDirectToVizzlyApi=ym;var pA={},aA={};Object.defineProperty(aA,"__esModule",{value:!0});var MA={};Object.defineProperty(MA,"__esModule",{value:!0});var zA={};Object.defineProperty(zA,"__esModule",{value:!0});var cA={};Object.defineProperty(cA,"__esModule",{value:!0});(function(t){var e=O0&&O0.__createBinding||(Object.create?function(n,b,a,O){O===void 0&&(O=a);var A=Object.getOwnPropertyDescriptor(b,a);(!A||("get"in A?!b.__esModule:A.writable||A.configurable))&&(A={enumerable:!0,get:function(){return b[a]}}),Object.defineProperty(n,O,A)}:function(n,b,a,O){O===void 0&&(O=a),n[O]=b[a]}),o=O0&&O0.__exportStar||function(n,b){for(var a in n)a!=="default"&&!Object.prototype.hasOwnProperty.call(b,a)&&e(b,n,a)};Object.defineProperty(t,"__esModule",{value:!0}),o(aA,t),o(MA,t),o(zA,t),o(cA,t)})(pA);(function(t){var e=O0&&O0.__createBinding||(Object.create?function(a,O,A,c){c===void 0&&(c=A);var y=Object.getOwnPropertyDescriptor(O,A);(!y||("get"in y?!O.__esModule:y.writable||y.configurable))&&(y={enumerable:!0,get:function(){return O[A]}}),Object.defineProperty(a,c,y)}:function(a,O,A,c){c===void 0&&(c=A),a[c]=O[A]}),o=O0&&O0.__setModuleDefault||(Object.create?function(a,O){Object.defineProperty(a,"default",{enumerable:!0,value:O})}:function(a,O){a.default=O}),n=O0&&O0.__exportStar||function(a,O){for(var A in a)A!=="default"&&!Object.prototype.hasOwnProperty.call(O,A)&&e(O,a,A)},b=O0&&O0.__importStar||function(a){if(a&&a.__esModule)return a;var O={};if(a!=null)for(var A in a)A!=="default"&&Object.prototype.hasOwnProperty.call(a,A)&&e(O,a,A);return o(O,a),O};Object.defineProperty(t,"__esModule",{value:!0}),t.Errors=void 0,n(aM,t),n(OM,t),n(yM,t),n(RM,t),n(LM,t),n(Yo,t),n(Lr,t),n(En,t),n(pA,t),t.Errors=b(AM)})(_2);const Rm=(t,e,o)=>{const n=new _2.Authentication({dashboardAccessToken:t?.dashboardAccess.signature,dataAccessToken:t?.dataAccess?.signature,projectAdminOverrideToken:t?.dashboardAdminOverride?.signature,queryEngineAccessToken:t?.queryEngineAccessConfig?.signature});let b=()=>({});e.strategy==="queryEngine"&&typeof e.endpoint!="string"&&(b=e.endpoint.customHeaders||b);const a=e.strategy==="queryEngine"?new _2.VizzlyQueryEngineApi(n,typeof e.endpoint=="string"?e.endpoint:e.endpoint.endpoint,b):void 0,O=new _2.VizzlyApi(n,o.host),A=new _2.VizzlyAppApi(n,"https://app.vizzly.co");return new _2.Vizzly({vizzlyApi:O,vizzlyAppApi:A,vizzlyQueryEngineApi:a},e.strategy==="queryEngine"?new _2.PersistViaQueryEngine:new _2.PersistDirectToVizzlyApi)},sA=(t,e)=>P0.mergeWith({},t,e,(o,n)=>P0.isArray(n)?n:P0.isObject(o)&&P0.isObject(n)?sA(o,n):n),Lm=(t,e)=>sA(e,t);var Ut={},OA={},Rb={},vM={},W1={},$t={};Object.defineProperty($t,"__esModule",{value:!0});$t.ALL_FRONTEND_FEATURES=$t.supportedAggregatesConstants=$t.timeDimensionsConstants=$t.supportedOperatorsConstants=void 0;$t.supportedOperatorsConstants={">":{publicName:"Greater than",validDataTypes:["number","date_time"]},"<":{publicName:"Less than",validDataTypes:["number","date_time"]},"<=":{publicName:"Less than or equal to",validDataTypes:["number","date_time"]},">=":{publicName:"Greater than or equal to",validDataTypes:["number","date_time"]},"!=":{publicName:"Not equal to",validDataTypes:["number","date_time","boolean","string"]},is_one_of:{publicName:"Is one of",validDataTypes:["number","date_time","boolean","string"]},"=":{publicName:"Equal to",validDataTypes:["number","date_time","boolean","string"]},is_not_one_of:{publicName:"Is not one of",validDataTypes:["number","date_time","boolean","string"]},starts_with:{publicName:"Starts with",validDataTypes:["string"]},ends_with:{publicName:"Ends with",validDataTypes:["string"]},contains_substring:{publicName:"Contains text",validDataTypes:["string"]},does_not_contain_substring:{publicName:"Does not contain text",validDataTypes:["string"]},array_contains:{publicName:"Contains",validDataTypes:["string[]"]},array_does_not_contain:{publicName:"Does not contain",validDataTypes:["string[]"]},array_contains_any_of:{publicName:"Contains any of",validDataTypes:["string[]"]},array_contains_all_of:{publicName:"Contains all of",validDataTypes:["string[]"]}};$t.timeDimensionsConstants={month:{publicName:"Monthly",dateFormat:"MMMM YYYY",dataTypeOutput:"date_time"},year:{publicName:"Yearly",dateFormat:"YYYY",dataTypeOutput:"date_time"},quarter:{publicName:"Per quarter",dateFormat:"quarter",dataTypeOutput:"date_time"},week:{publicName:"Weekly",dateFormat:"week",dataTypeOutput:"date_time"},day:{publicName:"Daily",dateFormat:"DD-MM-YYYY",dataTypeOutput:"date_time"},hourOfDayOnly:{publicName:"Hour of day",dateFormat:"hour_of_day",dataTypeOutput:"date_time"},weekOfYearOnly:{publicName:"Week of year",dateFormat:"week_of_year",dataTypeOutput:"number"},dayOfWeekOnly:{publicName:"Day of week",dateFormat:"day_of_week_iso",dataTypeOutput:"number"},monthOfYearOnly:{publicName:"Month of year",dateFormat:"month_of_year",dataTypeOutput:"number"},dayOfMonthOnly:{publicName:"Day of month",dateFormat:"day_of_month",dataTypeOutput:"number"},second:{publicName:"Per second",dateFormat:"hh:mm:ss",dataTypeOutput:"date_time"},hour:{publicName:"Hourly",dateFormat:"hh:mm",dataTypeOutput:"date_time"},minute:{publicName:"Per minute",dateFormat:"hh:mm",dataTypeOutput:"date_time"}};$t.supportedAggregatesConstants={mean:{publicName:"Mean",validDataTypes:["number"]},sum:{publicName:"Sum",validDataTypes:["number"]},min:{publicName:"Min",validDataTypes:["number"]},max:{publicName:"Max",validDataTypes:["number"]},count:{publicName:"Count",validDataTypes:["string","number","boolean","date_time","string[]"]},countDistinct:{publicName:"Unique",validDataTypes:["string","number","boolean","date_time"]},median:{publicName:"Median",validDataTypes:["number"]},percentile25:{publicName:"25th percentile",validDataTypes:["number"]},percentile75:{publicName:"75th percentile",validDataTypes:["number"]},percentile90:{publicName:"90th percentile",validDataTypes:["number"]},percentile95:{publicName:"95th percentile",validDataTypes:["number"]},percentile99:{publicName:"99th percentile",validDataTypes:["number"]}};$t.ALL_FRONTEND_FEATURES=["formatter:monthOfYearOnly"];Object.defineProperty(W1,"__esModule",{value:!0});W1.validOperatorsForField=W1.ALL_SUPPORTED_CONSTANTS=W1.isSupportedTimeTruncFunction=W1.isSupportedAggregate=W1.isSupportedAggregateFunction=W1.supportedAggregates=W1.supportedTimeTruncFunctions=W1.supportedOperators=W1.supportedAggregatesFunction=W1.supportedTransformationFunctions=void 0;const _M=P0,zo=$t,vm={round_to_0_dp:{publicName:"Round to 0dp",validDataTypes:["number"]},round_to_2_dp:{publicName:"Round to 2dp",validDataTypes:["number"]}},_m=t=>{const e=(0,_M.cloneDeep)(vm);if(!t)return e;let o={};return t.forEach(n=>{if(!e[n])throw`Transformation function ${n} is not managed by Vizzly`;o[n]=e[n]}),o};W1.supportedTransformationFunctions=_m;const Nm=(t,e,o)=>{const n=t.supportedAggregates,b=Object.keys(n).filter(O=>n[O].validDataTypes.includes(e));let a=o&&o.length>0?o.filter(O=>b.includes(O)):b;return o&&o.length>0&&a.length===0&&(a=b),a};W1.supportedAggregatesFunction=Nm;const Tm=t=>{const e=(0,_M.cloneDeep)(zo.supportedOperatorsConstants);if(!t)return e;let o={};return t.forEach(n=>{if(!zo.supportedOperatorsConstants[n])throw`Operator ${n} not managed by Vizzly`;o[n]=zo.supportedOperatorsConstants[n]}),o};W1.supportedOperators=Tm;const Bm=t=>{const e=(0,_M.cloneDeep)(zo.timeDimensionsConstants);if(!t)return e;let o={};return t.forEach(n=>{if(!e[n])throw`Time trunc function ${n} not managed by Vizzly`;o[n]=e[n]}),o};W1.supportedTimeTruncFunctions=Bm;const Sm=t=>{const e=(0,_M.cloneDeep)(zo.supportedAggregatesConstants);if(!t)return e;let o={};return t.forEach(n=>{if(!e[n])throw`Aggregate ${n} not managed by Vizzly`;o[n]=e[n]}),o};W1.supportedAggregates=Sm;const wm=(t,e)=>[...Object.keys(t),"none"].includes(e);W1.isSupportedAggregateFunction=wm;const xm=(t,e)=>typeof t!="string"?!1:e.hasOwnProperty(t);W1.isSupportedAggregate=xm;const Xm=(t,e)=>[...Object.keys(t),"none"].includes(e);W1.isSupportedTimeTruncFunction=Xm;W1.ALL_SUPPORTED_CONSTANTS=[{namespace:"config.supported_operator",constants:zo.supportedOperatorsConstants},{namespace:"config.supported_aggregate",constants:zo.supportedAggregatesConstants},{namespace:"config.supported_time",constants:zo.timeDimensionsConstants}];const Cm=(t,e)=>{let o=[...Object.keys(e.supportedOperators)];return o=o.filter(n=>zo.supportedOperatorsConstants[n].validDataTypes.includes(t.dataType)),o};W1.validOperatorsForField=Cm;Object.defineProperty(vM,"__esModule",{value:!0});vM.queryEngineConfig=void 0;const Wa=W1,Em=()=>({origin:"query-engine",supportedFeatures:["simpleMaths","aggregateMaths","subquery","configManagerUi","switchField","roundedNumbers","sqlDefinedDataSet","encryptedDashboards","sqlViews","dateMaths"],supportedTimeTruncFunctions:(0,Wa.supportedTimeTruncFunctions)(["month","year","quarter","week","day","hour","minute","second","dayOfMonthOnly","dayOfWeekOnly","weekOfYearOnly","monthOfYearOnly"]),supportedAggregates:(0,Wa.supportedAggregates)(["sum","mean","median","min","max","count","countDistinct","percentile25","percentile75","percentile90","percentile95","percentile99"]),supportedOperators:(0,Wa.supportedOperators)([">","<","=","!=",">=","<=","is_one_of","is_not_one_of","starts_with","ends_with","contains_substring","does_not_contain_substring","array_contains","array_does_not_contain"]),supportedTransformationFunctions:(0,Wa.supportedTransformationFunctions)(["round_to_0_dp","round_to_2_dp"])});vM.queryEngineConfig=Em;var NM={};Object.defineProperty(NM,"__esModule",{value:!0});NM.queryEngineConfig=void 0;const ha=W1,Dm=()=>({origin:"query-engine",supportedFeatures:["simpleMaths","aggregateMaths","subquery","configManagerUi","switchField","roundedNumbers","sqlDefinedDataSet","encryptedDashboards","sqlViews","dateMaths"],supportedTimeTruncFunctions:(0,ha.supportedTimeTruncFunctions)(["month","year","quarter","week","day","hour","minute","second"]),supportedAggregates:(0,ha.supportedAggregates)(["sum","mean","min","max","count","countDistinct"]),supportedOperators:(0,ha.supportedOperators)([">","<","=","!=",">=","<=","is_one_of","is_not_one_of","starts_with","ends_with","contains_substring","does_not_contain_substring","array_contains","array_does_not_contain"]),supportedTransformationFunctions:(0,ha.supportedTransformationFunctions)(["round_to_0_dp","round_to_2_dp"])});NM.queryEngineConfig=Dm;var TM={};Object.defineProperty(TM,"__esModule",{value:!0});TM.queryEngineConfig=void 0;const ma=W1,Im=()=>({origin:"query-engine",supportedFeatures:["simpleMaths","aggregateMaths","subquery","configManagerUi","sqlDefinedDataSet","roundedNumbers","switchField","encryptedDashboards","sqlViews","dateMaths"],supportedTimeTruncFunctions:(0,ma.supportedTimeTruncFunctions)(["month","year","quarter","week","day","hour","minute","second","dayOfMonthOnly","weekOfYearOnly","monthOfYearOnly"]),supportedAggregates:(0,ma.supportedAggregates)(["sum","mean","min","max","count","countDistinct"]),supportedOperators:(0,ma.supportedOperators)([">","<","=","!=",">=","<=","is_one_of","is_not_one_of","starts_with","ends_with","contains_substring","does_not_contain_substring","array_contains","array_does_not_contain"]),supportedTransformationFunctions:(0,ma.supportedTransformationFunctions)(["round_to_0_dp","round_to_2_dp"])});TM.queryEngineConfig=Im;var BM={};Object.defineProperty(BM,"__esModule",{value:!0});BM.queryEngineConfig=void 0;const ga=W1,Pm=()=>{var t;return typeof process>"u"?!1:((t=process.env.VIZZLY_MICROSOFT_FLAVOR)===null||t===void 0?void 0:t.toUpperCase())==="KUSTO"},Fm=()=>({origin:"query-engine",supportedFeatures:["simpleMaths","aggregateMaths","subquery","configManagerUi","switchField","roundedNumbers","sqlDefinedDataSet","encryptedDashboards","sqlViews","dateMaths"],supportedTimeTruncFunctions:(0,ga.supportedTimeTruncFunctions)(["month","year","quarter","week","day","hour","minute",...Pm()?[]:["second"]]),supportedAggregates:(0,ga.supportedAggregates)(["sum","mean","min","max","count","countDistinct"]),supportedOperators:(0,ga.supportedOperators)([">","<","=","!=",">=","<=","is_one_of","is_not_one_of","starts_with","ends_with","contains_substring","does_not_contain_substring","array_contains","array_does_not_contain"]),supportedTransformationFunctions:(0,ga.supportedTransformationFunctions)(["round_to_0_dp","round_to_2_dp"])});BM.queryEngineConfig=Fm;var SM={};Object.defineProperty(SM,"__esModule",{value:!0});SM.queryEngineConfig=void 0;const ya=W1,km=()=>({origin:"query-engine",supportedFeatures:["simpleMaths","subquery","configManagerUi","switchField","sqlDefinedDataSet","roundedNumbers","aggregateMaths","encryptedDashboards","sqlViews","dateMaths"],supportedTimeTruncFunctions:(0,ya.supportedTimeTruncFunctions)(["month","year","day","hour","minute","second"]),supportedAggregates:(0,ya.supportedAggregates)(["sum","mean","min","max","count","countDistinct"]),supportedOperators:(0,ya.supportedOperators)([">","<","=","!=",">=","<=","is_one_of","is_not_one_of","starts_with","ends_with","contains_substring","does_not_contain_substring"]),supportedTransformationFunctions:(0,ya.supportedTransformationFunctions)(["round_to_0_dp","round_to_2_dp"])});SM.queryEngineConfig=km;var wM={};Object.defineProperty(wM,"__esModule",{value:!0});wM.queryEngineConfig=void 0;const Ra=W1,jm=()=>({origin:"query-engine",supportedFeatures:["simpleMaths","aggregateMaths","subquery","configManagerUi","sqlDefinedDataSet","roundedNumbers","switchField","encryptedDashboards","sqlViews","dateMaths"],supportedTimeTruncFunctions:(0,Ra.supportedTimeTruncFunctions)(["month","year","quarter","week","day","hour","minute","second","dayOfMonthOnly","dayOfWeekOnly","weekOfYearOnly","hourOfDayOnly","monthOfYearOnly"]),supportedAggregates:(0,Ra.supportedAggregates)(["sum","mean","median","min","max","count","countDistinct","percentile25","percentile75","percentile90","percentile95","percentile99"]),supportedOperators:(0,Ra.supportedOperators)([">","<","=","!=",">=","<=","is_one_of","is_not_one_of","starts_with","ends_with","contains_substring","does_not_contain_substring","array_contains","array_does_not_contain","array_contains_any_of","array_contains_all_of"]),supportedTransformationFunctions:(0,Ra.supportedTransformationFunctions)(["round_to_0_dp","round_to_2_dp"])});wM.queryEngineConfig=jm;var xM={};Object.defineProperty(xM,"__esModule",{value:!0});xM.queryEngineConfig=void 0;const La=W1,$m=()=>({origin:"query-engine",supportedFeatures:["simpleMaths","subquery","configManagerUi","sqlDefinedDataSet","roundedNumbers","aggregateMaths","encryptedDashboards","sqlViews","dateMaths"],supportedTimeTruncFunctions:(0,La.supportedTimeTruncFunctions)(["month","year","day","hour","minute","second"]),supportedAggregates:(0,La.supportedAggregates)(["sum","mean","min","max","count","countDistinct"]),supportedOperators:(0,La.supportedOperators)([">","<","=","!=",">=","<=","is_one_of","is_not_one_of","starts_with","ends_with","contains_substring","does_not_contain_substring"]),supportedTransformationFunctions:(0,La.supportedTransformationFunctions)(["round_to_0_dp","round_to_2_dp"])});xM.queryEngineConfig=$m;var XM={};Object.defineProperty(XM,"__esModule",{value:!0});XM.localQueryEngineConfig=void 0;const va=W1;XM.localQueryEngineConfig={origin:"in-browser",supportedFeatures:["simpleMaths","aggregateMaths","subquery","encryptedDashboards","switchField","roundedNumbers","encryptedDashboards","dateMaths"],supportedTimeTruncFunctions:(0,va.supportedTimeTruncFunctions)(["month","year","quarter","week","day","hour","minute","second"]),supportedAggregates:(0,va.supportedAggregates)(["sum","mean","min","max","count","countDistinct","median"]),supportedOperators:(0,va.supportedOperators)([">","<","=","!=",">=","<=","is_one_of","is_not_one_of","starts_with","ends_with","contains_substring","does_not_contain_substring","array_contains","array_does_not_contain"]),supportedTransformationFunctions:(0,va.supportedTransformationFunctions)(["round_to_0_dp","round_to_2_dp"])};var Um=O0&&O0.__createBinding||(Object.create?function(t,e,o,n){n===void 0&&(n=o);var b=Object.getOwnPropertyDescriptor(e,o);(!b||("get"in b?!e.__esModule:b.writable||b.configurable))&&(b={enumerable:!0,get:function(){return e[o]}}),Object.defineProperty(t,n,b)}:function(t,e,o,n){n===void 0&&(n=o),t[n]=e[o]}),Gm=O0&&O0.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vr=O0&&O0.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var o in t)o!=="default"&&Object.prototype.hasOwnProperty.call(t,o)&&Um(e,t,o);return Gm(e,t),e};Object.defineProperty(Rb,"__esModule",{value:!0});Rb.getQueryEngineConfig=void 0;const Vm=vr(vM),Hm=vr(NM),Ym=vr(TM),Km=vr(BM),Qm=vr(SM),Zm=vr(wM),Jm=vr(xM),e6=XM,t6=t=>{switch(t){case"js":return e6.localQueryEngineConfig;case"postgres":return Vm.queryEngineConfig();case"redshift":return Hm.queryEngineConfig();case"bigquery":return Ym.queryEngineConfig();case"mariadb":return Qm.queryEngineConfig();case"snowflake":return Zm.queryEngineConfig();case"mysql":return Jm.queryEngineConfig();case"microsoftSQLServer":return Km.queryEngineConfig();case"SQLite":throw"SQLite not support via the query engine"}};Rb.getQueryEngineConfig=t6;var CM={};Object.defineProperty(CM,"__esModule",{value:!0});CM.merge=void 0;const ms=P0,o6=(...t)=>t.reduce((e,o)=>{const n=b=>{let a=e[b],O=o[b];if(typeof a=="object"&&typeof O=="object"){const A=(0,ms.intersection)(Object.keys(a),Object.keys(O));return(0,ms.pick)(o[b],A)}throw"Cannot intersect non-object type in mapIntersection function."};return{origin:"query-engine",supportedAggregates:n("supportedAggregates"),supportedFeatures:(0,ms.intersection)(e.supportedFeatures,o.supportedFeatures),supportedOperators:n("supportedOperators"),supportedTimeTruncFunctions:n("supportedTimeTruncFunctions"),supportedTransformationFunctions:n("supportedTransformationFunctions")}},t[0]);CM.merge=o6;var EM={};Object.defineProperty(EM,"__esModule",{value:!0});EM.removeUnsupportedFeatures=void 0;const r6=P0,n6=(t,e)=>{const o=(0,r6.cloneDeep)(t);return e.includes("formatter:monthOfYearOnly")||delete o.supportedTimeTruncFunctions.monthOfYearOnly,o};EM.removeUnsupportedFeatures=n6;(function(t){var e=O0&&O0.__createBinding||(Object.create?function(a,O,A,c){c===void 0&&(c=A);var y=Object.getOwnPropertyDescriptor(O,A);(!y||("get"in y?!O.__esModule:y.writable||y.configurable))&&(y={enumerable:!0,get:function(){return O[A]}}),Object.defineProperty(a,c,y)}:function(a,O,A,c){c===void 0&&(c=A),a[c]=O[A]}),o=O0&&O0.__setModuleDefault||(Object.create?function(a,O){Object.defineProperty(a,"default",{enumerable:!0,value:O})}:function(a,O){a.default=O}),n=O0&&O0.__exportStar||function(a,O){for(var A in a)A!=="default"&&!Object.prototype.hasOwnProperty.call(O,A)&&e(O,a,A)},b=O0&&O0.__importStar||function(a){if(a&&a.__esModule)return a;var O={};if(a!=null)for(var A in a)A!=="default"&&Object.prototype.hasOwnProperty.call(a,A)&&e(O,a,A);return o(O,a),O};Object.defineProperty(t,"__esModule",{value:!0}),t.Support=t.Constants=void 0,n(Rb,t),n(CM,t),t.Constants=b($t),t.Support=b(W1),n(EM,t)})(OA);var lA={},AA={},dA={exports:{}};(function(t,e){(function(o,n){t.exports=n()})(ot,()=>(()=>{var o={514:(a,O,A)=>{const{clone:c}=A(8870),y=A(8160),v={annotations:Symbol("annotations")};O.error=function(N){if(!this._original||typeof this._original!="object")return this.details[0].message;const s=N?"":"\x1B[31m",u=N?"":"\x1B[41m",d=N?"":"\x1B[0m",z=c(this._original);for(let q=this.details.length-1;q>=0;--q){const l=q+1,f=this.details[q],g=f.path;let L=z;for(let T=0;;++T){const X=g[T];if(y.isSchema(L)&&(L=L.clone()),!(T+1<g.length&&typeof L[X]!="string")){const C=L[v.annotations]||{errors:{},missing:{}};L[v.annotations]=C;const m=X||f.context.key;L[X]!==void 0?(C.errors[m]=C.errors[m]||[],C.errors[m].push(l)):C.missing[m]=l;break}L=L[X]}}let M=v.safeStringify(z,2).replace(/_\$key\$_([, \d]+)_\$end\$_"/g,(q,l)=>`" ${s}[${l}]${d}`).replace(/"_\$miss\$_([^|]+)\|(\d+)_\$end\$_": "__missing__"/g,(q,l,f)=>`${u}"${l}"${d}${s} [${f}]: -- missing --${d}`).replace(/\s*"_\$idx\$_([, \d]+)_\$end\$_",?\n(.*)/g,(q,l,f)=>`
30
30
  ${f} ${s}[${l}]${d}`).replace(/"\[(NaN|Symbol.*|-?Infinity|function.*|\(.*)]"/g,(q,l)=>l);M=`${M}
31
31
  ${s}`;for(let q=0;q<this.details.length;++q)M=`${M}
32
- [${q+1}] ${this.details[q].message}`;return M+=d,M},v.safeStringify=function(N,s){return JSON.stringify(N,v.serializer(),s)},v.serializer=function(){const N=[],s=[],u=(d,z)=>s[0]===z?"[Circular ~]":"[Circular ~."+N.slice(0,s.indexOf(z)).join(".")+"]";return function(d,z){if(s.length>0){const M=s.indexOf(this);~M?(s.length=M+1,N.length=M+1,N[M]=d):(s.push(this),N.push(d)),~s.indexOf(z)&&(z=u.call(this,d,z))}else s.push(z);if(z){const M=z[v.annotations];if(M){if(Array.isArray(z)){const q=[];for(let l=0;l<z.length;++l)M.errors[l]&&q.push(`_$idx$_${M.errors[l].sort().join(", ")}_$end$_`),q.push(z[l]);z=q}else{for(const q in M.errors)z[`${q}_$key$_${M.errors[q].sort().join(", ")}_$end$_`]=z[q],z[q]=void 0;for(const q in M.missing)z[`_$miss$_${q}|${M.missing[q]}_$end$_`]="__missing__"}return z}}return z===1/0||z===-1/0||Number.isNaN(z)||typeof z=="function"||typeof z=="symbol"?"["+z.toString()+"]":z}}},7629:(a,O,A)=>{const{assert:c,clone:y,deepEqual:v,merge:N}=A(8870),s=A(8652),u=A(8160),d=A(3292),z=A(6354),M=A(8901),q=A(1123),l=A(6914),f=A(2294),g=A(6133),L=A(2305),T=A(8863),X=A(2036),C={Base:class{constructor(m){this.type=m,this.$_root=null,this._definition={},this._reset()}_reset(){this._ids=new f.Ids,this._preferences=null,this._refs=new g.Manager,this._cache=null,this._valids=null,this._invalids=null,this._flags={},this._rules=[],this._singleRules=new Map,this.$_terms={},this.$_temp={ruleset:null,whens:{}}}describe(){return c(typeof q.describe=="function","Manifest functionality disabled"),q.describe(this)}allow(...m){return u.verifyFlat(m,"allow"),this._values(m,"_valids")}alter(m){c(m&&typeof m=="object"&&!Array.isArray(m),"Invalid targets argument"),c(!this._inRuleset(),"Cannot set alterations inside a ruleset");const w=this.clone();w.$_terms.alterations=w.$_terms.alterations||[];for(const E in m){const U=m[E];c(typeof U=="function","Alteration adjuster for",E,"must be a function"),w.$_terms.alterations.push({target:E,adjuster:U})}return w.$_temp.ruleset=!1,w}artifact(m){return c(m!==void 0,"Artifact cannot be undefined"),c(!this._cache,"Cannot set an artifact with a rule cache"),this.$_setFlag("artifact",m)}cast(m){return c(m===!1||typeof m=="string","Invalid to value"),c(m===!1||this._definition.cast[m],"Type",this.type,"does not support casting to",m),this.$_setFlag("cast",m===!1?void 0:m)}default(m,w){return this._default("default",m,w)}description(m){return c(m&&typeof m=="string","Description must be a non-empty string"),this.$_setFlag("description",m)}empty(m){const w=this.clone();return m!==void 0&&(m=w.$_compile(m,{override:!1})),w.$_setFlag("empty",m,{clone:!1})}error(m){return c(m,"Missing error"),c(m instanceof Error||typeof m=="function","Must provide a valid Error object or a function"),this.$_setFlag("error",m)}example(m,w={}){return c(m!==void 0,"Missing example"),u.assertOptions(w,["override"]),this._inner("examples",m,{single:!0,override:w.override})}external(m,w){return typeof m=="object"&&(c(!w,"Cannot combine options with description"),w=m.description,m=m.method),c(typeof m=="function","Method must be a function"),c(w===void 0||w&&typeof w=="string","Description must be a non-empty string"),this._inner("externals",{method:m,description:w},{single:!0})}failover(m,w){return this._default("failover",m,w)}forbidden(){return this.presence("forbidden")}id(m){return m?(c(typeof m=="string","id must be a non-empty string"),c(/^[^\.]+$/.test(m),"id cannot contain period character"),this.$_setFlag("id",m)):this.$_setFlag("id",void 0)}invalid(...m){return this._values(m,"_invalids")}label(m){return c(m&&typeof m=="string","Label name must be a non-empty string"),this.$_setFlag("label",m)}meta(m){return c(m!==void 0,"Meta cannot be undefined"),this._inner("metas",m,{single:!0})}note(...m){c(m.length,"Missing notes");for(const w of m)c(w&&typeof w=="string","Notes must be non-empty strings");return this._inner("notes",m)}only(m=!0){return c(typeof m=="boolean","Invalid mode:",m),this.$_setFlag("only",m)}optional(){return this.presence("optional")}prefs(m){c(m,"Missing preferences"),c(m.context===void 0,"Cannot override context"),c(m.externals===void 0,"Cannot override externals"),c(m.warnings===void 0,"Cannot override warnings"),c(m.debug===void 0,"Cannot override debug"),u.checkPreferences(m);const w=this.clone();return w._preferences=u.preferences(w._preferences,m),w}presence(m){return c(["optional","required","forbidden"].includes(m),"Unknown presence mode",m),this.$_setFlag("presence",m)}raw(m=!0){return this.$_setFlag("result",m?"raw":void 0)}result(m){return c(["raw","strip"].includes(m),"Unknown result mode",m),this.$_setFlag("result",m)}required(){return this.presence("required")}strict(m){const w=this.clone(),E=m!==void 0&&!m;return w._preferences=u.preferences(w._preferences,{convert:E}),w}strip(m=!0){return this.$_setFlag("result",m?"strip":void 0)}tag(...m){c(m.length,"Missing tags");for(const w of m)c(w&&typeof w=="string","Tags must be non-empty strings");return this._inner("tags",m)}unit(m){return c(m&&typeof m=="string","Unit name must be a non-empty string"),this.$_setFlag("unit",m)}valid(...m){u.verifyFlat(m,"valid");const w=this.allow(...m);return w.$_setFlag("only",!!w._valids,{clone:!1}),w}when(m,w){const E=this.clone();E.$_terms.whens||(E.$_terms.whens=[]);const U=d.when(E,m,w);if(!["any","link"].includes(E.type)){const z0=U.is?[U]:U.switch;for(const a0 of z0)c(!a0.then||a0.then.type==="any"||a0.then.type===E.type,"Cannot combine",E.type,"with",a0.then&&a0.then.type),c(!a0.otherwise||a0.otherwise.type==="any"||a0.otherwise.type===E.type,"Cannot combine",E.type,"with",a0.otherwise&&a0.otherwise.type)}return E.$_terms.whens.push(U),E.$_mutateRebuild()}cache(m){c(!this._inRuleset(),"Cannot set caching inside a ruleset"),c(!this._cache,"Cannot override schema cache"),c(this._flags.artifact===void 0,"Cannot cache a rule with an artifact");const w=this.clone();return w._cache=m||s.provider.provision(),w.$_temp.ruleset=!1,w}clone(){const m=Object.create(Object.getPrototypeOf(this));return this._assign(m)}concat(m){c(u.isSchema(m),"Invalid schema object"),c(this.type==="any"||m.type==="any"||m.type===this.type,"Cannot merge type",this.type,"with another type:",m.type),c(!this._inRuleset(),"Cannot concatenate onto a schema with open ruleset"),c(!m._inRuleset(),"Cannot concatenate a schema with open ruleset");let w=this.clone();if(this.type==="any"&&m.type!=="any"){const E=m.clone();for(const U of Object.keys(w))U!=="type"&&(E[U]=w[U]);w=E}w._ids.concat(m._ids),w._refs.register(m,g.toSibling),w._preferences=w._preferences?u.preferences(w._preferences,m._preferences):m._preferences,w._valids=X.merge(w._valids,m._valids,m._invalids),w._invalids=X.merge(w._invalids,m._invalids,m._valids);for(const E of m._singleRules.keys())w._singleRules.has(E)&&(w._rules=w._rules.filter(U=>U.keep||U.name!==E),w._singleRules.delete(E));for(const E of m._rules)m._definition.rules[E.method].multi||w._singleRules.set(E.name,E),w._rules.push(E);if(w._flags.empty&&m._flags.empty){w._flags.empty=w._flags.empty.concat(m._flags.empty);const E=Object.assign({},m._flags);delete E.empty,N(w._flags,E)}else if(m._flags.empty){w._flags.empty=m._flags.empty;const E=Object.assign({},m._flags);delete E.empty,N(w._flags,E)}else N(w._flags,m._flags);for(const E in m.$_terms){const U=m.$_terms[E];U?w.$_terms[E]?w.$_terms[E]=w.$_terms[E].concat(U):w.$_terms[E]=U.slice():w.$_terms[E]||(w.$_terms[E]=U)}return this.$_root._tracer&&this.$_root._tracer._combine(w,[this,m]),w.$_mutateRebuild()}extend(m){return c(!m.base,"Cannot extend type with another base"),M.type(this,m)}extract(m){return m=Array.isArray(m)?m:m.split("."),this._ids.reach(m)}fork(m,w){c(!this._inRuleset(),"Cannot fork inside a ruleset");let E=this;for(let U of[].concat(m))U=Array.isArray(U)?U:U.split("."),E=E._ids.fork(U,w,E);return E.$_temp.ruleset=!1,E}rule(m){const w=this._definition;u.assertOptions(m,Object.keys(w.modifiers)),c(this.$_temp.ruleset!==!1,"Cannot apply rules to empty ruleset or the last rule added does not support rule properties");const E=this.$_temp.ruleset===null?this._rules.length-1:this.$_temp.ruleset;c(E>=0&&E<this._rules.length,"Cannot apply rules to empty ruleset");const U=this.clone();for(let z0=E;z0<U._rules.length;++z0){const a0=U._rules[z0],V=y(a0);for(const Z in m)w.modifiers[Z](V,m[Z]),c(V.name===a0.name,"Cannot change rule name");U._rules[z0]=V,U._singleRules.get(V.name)===a0&&U._singleRules.set(V.name,V)}return U.$_temp.ruleset=!1,U.$_mutateRebuild()}get ruleset(){c(!this._inRuleset(),"Cannot start a new ruleset without closing the previous one");const m=this.clone();return m.$_temp.ruleset=m._rules.length,m}get $(){return this.ruleset}tailor(m){m=[].concat(m),c(!this._inRuleset(),"Cannot tailor inside a ruleset");let w=this;if(this.$_terms.alterations)for(const{target:E,adjuster:U}of this.$_terms.alterations)m.includes(E)&&(w=U(w),c(u.isSchema(w),"Alteration adjuster for",E,"failed to return a schema object"));return w=w.$_modify({each:E=>E.tailor(m),ref:!1}),w.$_temp.ruleset=!1,w.$_mutateRebuild()}tracer(){return L.location?L.location(this):this}validate(m,w){return T.entry(m,this,w)}validateAsync(m,w){return T.entryAsync(m,this,w)}$_addRule(m){typeof m=="string"&&(m={name:m}),c(m&&typeof m=="object","Invalid options"),c(m.name&&typeof m.name=="string","Invalid rule name");for(const a0 in m)c(a0[0]!=="_","Cannot set private rule properties");const w=Object.assign({},m);w._resolve=[],w.method=w.method||w.name;const E=this._definition.rules[w.method],U=w.args;c(E,"Unknown rule",w.method);const z0=this.clone();if(U){c(Object.keys(U).length===1||Object.keys(U).length===this._definition.rules[w.name].args.length,"Invalid rule definition for",this.type,w.name);for(const a0 in U){let V=U[a0];if(E.argsByName){const Z=E.argsByName.get(a0);if(Z.ref&&u.isResolvable(V))w._resolve.push(a0),z0.$_mutateRegister(V);else if(Z.normalize&&(V=Z.normalize(V),U[a0]=V),Z.assert){const u0=u.validateArg(V,a0,Z);c(!u0,u0,"or reference")}}V!==void 0?U[a0]=V:delete U[a0]}}return E.multi||(z0._ruleRemove(w.name,{clone:!1}),z0._singleRules.set(w.name,w)),z0.$_temp.ruleset===!1&&(z0.$_temp.ruleset=null),E.priority?z0._rules.unshift(w):z0._rules.push(w),z0}$_compile(m,w){return d.schema(this.$_root,m,w)}$_createError(m,w,E,U,z0,a0={}){const V=a0.flags!==!1?this._flags:{},Z=a0.messages?l.merge(this._definition.messages,a0.messages):this._definition.messages;return new z.Report(m,w,E,V,Z,U,z0)}$_getFlag(m){return this._flags[m]}$_getRule(m){return this._singleRules.get(m)}$_mapLabels(m){return m=Array.isArray(m)?m:m.split("."),this._ids.labels(m)}$_match(m,w,E,U){(E=Object.assign({},E)).abortEarly=!0,E._externals=!1,w.snapshot();const z0=!T.validate(m,this,w,E,U).errors;return w.restore(),z0}$_modify(m){return u.assertOptions(m,["each","once","ref","schema"]),f.schema(this,m)||this}$_mutateRebuild(){return c(!this._inRuleset(),"Cannot add this rule inside a ruleset"),this._refs.reset(),this._ids.reset(),this.$_modify({each:(m,{source:w,name:E,path:U,key:z0})=>{const a0=this._definition[w][E]&&this._definition[w][E].register;a0!==!1&&this.$_mutateRegister(m,{family:a0,key:z0})}}),this._definition.rebuild&&this._definition.rebuild(this),this.$_temp.ruleset=!1,this}$_mutateRegister(m,{family:w,key:E}={}){this._refs.register(m,w),this._ids.register(m,{key:E})}$_property(m){return this._definition.properties[m]}$_reach(m){return this._ids.reach(m)}$_rootReferences(){return this._refs.roots()}$_setFlag(m,w,E={}){c(m[0]==="_"||!this._inRuleset(),"Cannot set flag inside a ruleset");const U=this._definition.flags[m]||{};if(v(w,U.default)&&(w=void 0),v(w,this._flags[m]))return this;const z0=E.clone!==!1?this.clone():this;return w!==void 0?(z0._flags[m]=w,z0.$_mutateRegister(w)):delete z0._flags[m],m[0]!=="_"&&(z0.$_temp.ruleset=!1),z0}$_parent(m,...w){return this[m][u.symbols.parent].call(this,...w)}$_validate(m,w,E){return T.validate(m,this,w,E)}_assign(m){m.type=this.type,m.$_root=this.$_root,m.$_temp=Object.assign({},this.$_temp),m.$_temp.whens={},m._ids=this._ids.clone(),m._preferences=this._preferences,m._valids=this._valids&&this._valids.clone(),m._invalids=this._invalids&&this._invalids.clone(),m._rules=this._rules.slice(),m._singleRules=y(this._singleRules,{shallow:!0}),m._refs=this._refs.clone(),m._flags=Object.assign({},this._flags),m._cache=null,m.$_terms={};for(const w in this.$_terms)m.$_terms[w]=this.$_terms[w]?this.$_terms[w].slice():null;m.$_super={};for(const w in this.$_super)m.$_super[w]=this._super[w].bind(m);return m}_bare(){const m=this.clone();m._reset();const w=m._definition.terms;for(const E in w){const U=w[E];m.$_terms[E]=U.init}return m.$_mutateRebuild()}_default(m,w,E={}){return u.assertOptions(E,"literal"),c(w!==void 0,"Missing",m,"value"),c(typeof w=="function"||!E.literal,"Only function value supports literal option"),typeof w=="function"&&E.literal&&(w={[u.symbols.literal]:!0,literal:w}),this.$_setFlag(m,w)}_generate(m,w,E){if(!this.$_terms.whens)return{schema:this};const U=[],z0=[];for(let Z=0;Z<this.$_terms.whens.length;++Z){const u0=this.$_terms.whens[Z];if(u0.concat){U.push(u0.concat),z0.push(`${Z}.concat`);continue}const L0=u0.ref?u0.ref.resolve(m,w,E):m,X0=u0.is?[u0]:u0.switch,B0=z0.length;for(let $0=0;$0<X0.length;++$0){const{is:h1,then:d1,otherwise:k1}=X0[$0],be=`${Z}${u0.switch?"."+$0:""}`;if(h1.$_match(L0,w.nest(h1,`${be}.is`),E)){if(d1){const pe=w.localize([...w.path,`${be}.then`],w.ancestors,w.schemas),{schema:J0,id:T1}=d1._generate(m,pe,E);U.push(J0),z0.push(`${be}.then${T1?`(${T1})`:""}`);break}}else if(k1){const pe=w.localize([...w.path,`${be}.otherwise`],w.ancestors,w.schemas),{schema:J0,id:T1}=k1._generate(m,pe,E);U.push(J0),z0.push(`${be}.otherwise${T1?`(${T1})`:""}`);break}}if(u0.break&&z0.length>B0)break}const a0=z0.join(", ");if(w.mainstay.tracer.debug(w,"rule","when",a0),!a0)return{schema:this};if(!w.mainstay.tracer.active&&this.$_temp.whens[a0])return{schema:this.$_temp.whens[a0],id:a0};let V=this;this._definition.generate&&(V=this._definition.generate(this,m,w,E));for(const Z of U)V=V.concat(Z);return this.$_root._tracer&&this.$_root._tracer._combine(V,[this,...U]),this.$_temp.whens[a0]=V,{schema:V,id:a0}}_inner(m,w,E={}){c(!this._inRuleset(),`Cannot set ${m} inside a ruleset`);const U=this.clone();return U.$_terms[m]&&!E.override||(U.$_terms[m]=[]),E.single?U.$_terms[m].push(w):U.$_terms[m].push(...w),U.$_temp.ruleset=!1,U}_inRuleset(){return this.$_temp.ruleset!==null&&this.$_temp.ruleset!==!1}_ruleRemove(m,w={}){if(!this._singleRules.has(m))return this;const E=w.clone!==!1?this.clone():this;E._singleRules.delete(m);const U=[];for(let z0=0;z0<E._rules.length;++z0){const a0=E._rules[z0];a0.name!==m||a0.keep?U.push(a0):E._inRuleset()&&z0<E.$_temp.ruleset&&--E.$_temp.ruleset}return E._rules=U,E}_values(m,w){u.verifyFlat(m,w.slice(1,-1));const E=this.clone(),U=m[0]===u.symbols.override;if(U&&(m=m.slice(1)),!E[w]&&m.length?E[w]=new X:U&&(E[w]=m.length?new X:null,E.$_mutateRebuild()),!E[w])return E;U&&E[w].override();for(const z0 of m){c(z0!==void 0,"Cannot call allow/valid/invalid with undefined"),c(z0!==u.symbols.override,"Override must be the first value");const a0=w==="_invalids"?"_valids":"_invalids";E[a0]&&(E[a0].remove(z0),E[a0].length||(c(w==="_valids"||!E._flags.only,"Setting invalid value",z0,"leaves schema rejecting all values due to previous valid rule"),E[a0]=null)),E[w].add(z0,E._refs)}return E}}};C.Base.prototype[u.symbols.any]={version:u.version,compile:d.compile,root:"$_root"},C.Base.prototype.isImmutable=!0,C.Base.prototype.deny=C.Base.prototype.invalid,C.Base.prototype.disallow=C.Base.prototype.invalid,C.Base.prototype.equal=C.Base.prototype.valid,C.Base.prototype.exist=C.Base.prototype.required,C.Base.prototype.not=C.Base.prototype.invalid,C.Base.prototype.options=C.Base.prototype.prefs,C.Base.prototype.preferences=C.Base.prototype.prefs,a.exports=new C.Base},8652:(a,O,A)=>{const{assert:c,clone:y}=A(8870),v=A(8160),N={max:1e3,supported:new Set(["undefined","boolean","number","string"])};O.provider={provision:s=>new N.Cache(s)},N.Cache=class{constructor(s={}){v.assertOptions(s,["max"]),c(s.max===void 0||s.max&&s.max>0&&isFinite(s.max),"Invalid max cache size"),this._max=s.max||N.max,this._map=new Map,this._list=new N.List}get length(){return this._map.size}set(s,u){if(s!==null&&!N.supported.has(typeof s))return;let d=this._map.get(s);if(d)return d.value=u,void this._list.first(d);d=this._list.unshift({key:s,value:u}),this._map.set(s,d),this._compact()}get(s){const u=this._map.get(s);if(u)return this._list.first(u),y(u.value)}_compact(){if(this._map.size>this._max){const s=this._list.pop();this._map.delete(s.key)}}},N.List=class{constructor(){this.tail=null,this.head=null}unshift(s){return s.next=null,s.prev=this.head,this.head&&(this.head.next=s),this.head=s,this.tail||(this.tail=s),s}first(s){s!==this.head&&(this._remove(s),this.unshift(s))}pop(){return this._remove(this.tail)}_remove(s){const{next:u,prev:d}=s;return u.prev=d,d&&(d.next=u),s===this.tail&&(this.tail=u),s.prev=null,s.next=null,s}}},8160:(a,O,A)=>{const{assert:c,AssertError:y}=A(8870),v=A(5934);let N,s;const u={isoDate:/^(?:[-+]\d{2})?(?:\d{4}(?!\d{2}\b))(?:(-?)(?:(?:0[1-9]|1[0-2])(?:\1(?:[12]\d|0[1-9]|3[01]))?|W(?:[0-4]\d|5[0-2])(?:-?[1-7])?|(?:00[1-9]|0[1-9]\d|[12]\d{2}|3(?:[0-5]\d|6[1-6])))(?![T]$|[T][\d]+Z$)(?:[T\s](?:(?:(?:[01]\d|2[0-3])(?:(:?)[0-5]\d)?|24\:?00)(?:[.,]\d+(?!:))?)(?:\2[0-5]\d(?:[.,]\d+)?)?(?:[Z]|(?:[+-])(?:[01]\d|2[0-3])(?::?[0-5]\d)?)?)?)?$/};O.version=v.version,O.defaults={abortEarly:!0,allowUnknown:!1,artifacts:!1,cache:!0,context:null,convert:!0,dateFormat:"iso",errors:{escapeHtml:!1,label:"path",language:null,render:!0,stack:!1,wrap:{label:'"',array:"[]"}},externals:!0,messages:{},nonEnumerables:!1,noDefaults:!1,presence:"optional",skipFunctions:!1,stripUnknown:!1,warnings:!1},O.symbols={any:Symbol.for("@hapi/joi/schema"),arraySingle:Symbol("arraySingle"),deepDefault:Symbol("deepDefault"),errors:Symbol("errors"),literal:Symbol("literal"),override:Symbol("override"),parent:Symbol("parent"),prefs:Symbol("prefs"),ref:Symbol("ref"),template:Symbol("template"),values:Symbol("values")},O.assertOptions=function(d,z,M="Options"){c(d&&typeof d=="object"&&!Array.isArray(d),"Options must be of type object");const q=Object.keys(d).filter(l=>!z.includes(l));c(q.length===0,`${M} contain unknown keys: ${q}`)},O.checkPreferences=function(d){s=s||A(3378);const z=s.preferences.validate(d);if(z.error)throw new y([z.error.details[0].message])},O.compare=function(d,z,M){switch(M){case"=":return d===z;case">":return d>z;case"<":return d<z;case">=":return d>=z;case"<=":return d<=z}},O.default=function(d,z){return d===void 0?z:d},O.isIsoDate=function(d){return u.isoDate.test(d)},O.isNumber=function(d){return typeof d=="number"&&!isNaN(d)},O.isResolvable=function(d){return!!d&&(d[O.symbols.ref]||d[O.symbols.template])},O.isSchema=function(d,z={}){const M=d&&d[O.symbols.any];return!!M&&(c(z.legacy||M.version===O.version,"Cannot mix different versions of joi schemas"),!0)},O.isValues=function(d){return d[O.symbols.values]},O.limit=function(d){return Number.isSafeInteger(d)&&d>=0},O.preferences=function(d,z){N=N||A(6914),d=d||{},z=z||{};const M=Object.assign({},d,z);return z.errors&&d.errors&&(M.errors=Object.assign({},d.errors,z.errors),M.errors.wrap=Object.assign({},d.errors.wrap,z.errors.wrap)),z.messages&&(M.messages=N.compile(z.messages,d.messages)),delete M[O.symbols.prefs],M},O.tryWithPath=function(d,z,M={}){try{return d()}catch(q){throw q.path!==void 0?q.path=z+"."+q.path:q.path=z,M.append&&(q.message=`${q.message} (${q.path})`),q}},O.validateArg=function(d,z,{assert:M,message:q}){if(O.isSchema(M)){const l=M.validate(d);return l.error?l.error.message:void 0}if(!M(d))return z?`${z} ${q}`:q},O.verifyFlat=function(d,z){for(const M of d)c(!Array.isArray(M),"Method no longer accepts array arguments:",z)}},3292:(a,O,A)=>{const{assert:c}=A(8870),y=A(8160),v=A(6133),N={};O.schema=function(s,u,d={}){y.assertOptions(d,["appendPath","override"]);try{return N.schema(s,u,d)}catch(z){throw d.appendPath&&z.path!==void 0&&(z.message=`${z.message} (${z.path})`),z}},N.schema=function(s,u,d){c(u!==void 0,"Invalid undefined schema"),Array.isArray(u)&&(c(u.length,"Invalid empty array schema"),u.length===1&&(u=u[0]));const z=(M,...q)=>d.override!==!1?M.valid(s.override,...q):M.valid(...q);if(N.simple(u))return z(s,u);if(typeof u=="function")return s.custom(u);if(c(typeof u=="object","Invalid schema content:",typeof u),y.isResolvable(u))return z(s,u);if(y.isSchema(u))return u;if(Array.isArray(u)){for(const M of u)if(!N.simple(M))return s.alternatives().try(...u);return z(s,...u)}return u instanceof RegExp?s.string().regex(u):u instanceof Date?z(s.date(),u):(c(Object.getPrototypeOf(u)===Object.getPrototypeOf({}),"Schema can only contain plain objects"),s.object().keys(u))},O.ref=function(s,u){return v.isRef(s)?s:v.create(s,u)},O.compile=function(s,u,d={}){y.assertOptions(d,["legacy"]);const z=u&&u[y.symbols.any];if(z)return c(d.legacy||z.version===y.version,"Cannot mix different versions of joi schemas:",z.version,y.version),u;if(typeof u!="object"||!d.legacy)return O.schema(s,u,{appendPath:!0});const M=N.walk(u);return M?M.compile(M.root,u):O.schema(s,u,{appendPath:!0})},N.walk=function(s){if(typeof s!="object")return null;if(Array.isArray(s)){for(const d of s){const z=N.walk(d);if(z)return z}return null}const u=s[y.symbols.any];if(u)return{root:s[u.root],compile:u.compile};c(Object.getPrototypeOf(s)===Object.getPrototypeOf({}),"Schema can only contain plain objects");for(const d in s){const z=N.walk(s[d]);if(z)return z}return null},N.simple=function(s){return s===null||["boolean","string","number"].includes(typeof s)},O.when=function(s,u,d){if(d===void 0&&(c(u&&typeof u=="object","Missing options"),d=u,u=v.create(".")),Array.isArray(d)&&(d={switch:d}),y.assertOptions(d,["is","not","then","otherwise","switch","break"]),y.isSchema(u))return c(d.is===void 0,'"is" can not be used with a schema condition'),c(d.not===void 0,'"not" can not be used with a schema condition'),c(d.switch===void 0,'"switch" can not be used with a schema condition'),N.condition(s,{is:u,then:d.then,otherwise:d.otherwise,break:d.break});if(c(v.isRef(u)||typeof u=="string","Invalid condition:",u),c(d.not===void 0||d.is===void 0,'Cannot combine "is" with "not"'),d.switch===void 0){let M=d;d.not!==void 0&&(M={is:d.not,then:d.otherwise,otherwise:d.then,break:d.break});let q=M.is!==void 0?s.$_compile(M.is):s.$_root.invalid(null,!1,0,"").required();return c(M.then!==void 0||M.otherwise!==void 0,'options must have at least one of "then", "otherwise", or "switch"'),c(M.break===void 0||M.then===void 0||M.otherwise===void 0,"Cannot specify then, otherwise, and break all together"),d.is===void 0||v.isRef(d.is)||y.isSchema(d.is)||(q=q.required()),N.condition(s,{ref:O.ref(u),is:q,then:M.then,otherwise:M.otherwise,break:M.break})}c(Array.isArray(d.switch),'"switch" must be an array'),c(d.is===void 0,'Cannot combine "switch" with "is"'),c(d.not===void 0,'Cannot combine "switch" with "not"'),c(d.then===void 0,'Cannot combine "switch" with "then"');const z={ref:O.ref(u),switch:[],break:d.break};for(let M=0;M<d.switch.length;++M){const q=d.switch[M],l=M===d.switch.length-1;y.assertOptions(q,l?["is","then","otherwise"]:["is","then"]),c(q.is!==void 0,'Switch statement missing "is"'),c(q.then!==void 0,'Switch statement missing "then"');const f={is:s.$_compile(q.is),then:s.$_compile(q.then)};if(v.isRef(q.is)||y.isSchema(q.is)||(f.is=f.is.required()),l){c(d.otherwise===void 0||q.otherwise===void 0,'Cannot specify "otherwise" inside and outside a "switch"');const g=d.otherwise!==void 0?d.otherwise:q.otherwise;g!==void 0&&(c(z.break===void 0,"Cannot specify both otherwise and break"),f.otherwise=s.$_compile(g))}z.switch.push(f)}return z},N.condition=function(s,u){for(const d of["then","otherwise"])u[d]===void 0?delete u[d]:u[d]=s.$_compile(u[d]);return u}},6354:(a,O,A)=>{const c=A(514),y=A(8160),v=A(3328);O.Report=class{constructor(N,s,u,d,z,M,q){if(this.code=N,this.flags=d,this.messages=z,this.path=M.path,this.prefs=q,this.state=M,this.value=s,this.message=null,this.template=null,this.local=u||{},this.local.label=O.label(this.flags,this.state,this.prefs,this.messages),this.value===void 0||this.local.hasOwnProperty("value")||(this.local.value=this.value),this.path.length){const l=this.path[this.path.length-1];typeof l!="object"&&(this.local.key=l)}}_setTemplate(N){if(this.template=N,!this.flags.label&&this.path.length===0){const s=this._template(this.template,"root");s&&(this.local.label=s)}}toString(){if(this.message)return this.message;const N=this.code;if(!this.prefs.errors.render)return this.code;const s=this._template(this.template)||this._template(this.prefs.messages)||this._template(this.messages);return s===void 0?`Error code "${N}" is not defined, your custom type is missing the correct messages definition`:(this.message=s.render(this.value,this.state,this.prefs,this.local,{errors:this.prefs.errors,messages:[this.prefs.messages,this.messages]}),this.prefs.errors.label||(this.message=this.message.replace(/^"" /,"").trim()),this.message)}_template(N,s){return O.template(this.value,N,s||this.code,this.state,this.prefs)}},O.path=function(N){let s="";for(const u of N)typeof u!="object"&&(typeof u=="string"?(s&&(s+="."),s+=u):s+=`[${u}]`);return s},O.template=function(N,s,u,d,z){if(!s)return;if(v.isTemplate(s))return u!=="root"?s:null;let M=z.errors.language;if(y.isResolvable(M)&&(M=M.resolve(N,d,z)),M&&s[M]){if(s[M][u]!==void 0)return s[M][u];if(s[M]["*"]!==void 0)return s[M]["*"]}return s[u]?s[u]:s["*"]},O.label=function(N,s,u,d){if(N.label)return N.label;if(!u.errors.label)return"";let z=s.path;return u.errors.label==="key"&&s.path.length>1&&(z=s.path.slice(-1)),O.path(z)||O.template(null,u.messages,"root",s,u)||d&&O.template(null,d,"root",s,u)||"value"},O.process=function(N,s,u){if(!N)return null;const{override:d,message:z,details:M}=O.details(N);if(d)return d;if(u.errors.stack)return new O.ValidationError(z,M,s);const q=Error.stackTraceLimit;Error.stackTraceLimit=0;const l=new O.ValidationError(z,M,s);return Error.stackTraceLimit=q,l},O.details=function(N,s={}){let u=[];const d=[];for(const z of N){if(z instanceof Error){if(s.override!==!1)return{override:z};const q=z.toString();u.push(q),d.push({message:q,type:"override",context:{error:z}});continue}const M=z.toString();u.push(M),d.push({message:M,path:z.path.filter(q=>typeof q!="object"),type:z.code,context:z.local})}return u.length>1&&(u=[...new Set(u)]),{message:u.join(". "),details:d}},O.ValidationError=class extends Error{constructor(N,s,u){super(N),this._original=u,this.details=s}static isError(N){return N instanceof O.ValidationError}},O.ValidationError.prototype.isJoi=!0,O.ValidationError.prototype.name="ValidationError",O.ValidationError.prototype.annotate=c.error},8901:(a,O,A)=>{const{assert:c,clone:y}=A(8870),v=A(8160),N=A(6914),s={};O.type=function(u,d){const z=Object.getPrototypeOf(u),M=y(z),q=u._assign(Object.create(M)),l=Object.assign({},d);delete l.base,M._definition=l;const f=z._definition||{};l.messages=N.merge(f.messages,l.messages),l.properties=Object.assign({},f.properties,l.properties),q.type=l.type,l.flags=Object.assign({},f.flags,l.flags);const g=Object.assign({},f.terms);if(l.terms)for(const C in l.terms){const m=l.terms[C];c(q.$_terms[C]===void 0,"Invalid term override for",l.type,C),q.$_terms[C]=m.init,g[C]=m}l.terms=g,l.args||(l.args=f.args),l.prepare=s.prepare(l.prepare,f.prepare),l.coerce&&(typeof l.coerce=="function"&&(l.coerce={method:l.coerce}),l.coerce.from&&!Array.isArray(l.coerce.from)&&(l.coerce={method:l.coerce.method,from:[].concat(l.coerce.from)})),l.coerce=s.coerce(l.coerce,f.coerce),l.validate=s.validate(l.validate,f.validate);const L=Object.assign({},f.rules);if(l.rules)for(const C in l.rules){const m=l.rules[C];c(typeof m=="object","Invalid rule definition for",l.type,C);let w=m.method;if(w===void 0&&(w=function(){return this.$_addRule(C)}),w&&(c(!M[C],"Rule conflict in",l.type,C),M[C]=w),c(!L[C],"Rule conflict in",l.type,C),L[C]=m,m.alias){const E=[].concat(m.alias);for(const U of E)M[U]=m.method}m.args&&(m.argsByName=new Map,m.args=m.args.map(E=>(typeof E=="string"&&(E={name:E}),c(!m.argsByName.has(E.name),"Duplicated argument name",E.name),v.isSchema(E.assert)&&(E.assert=E.assert.strict().label(E.name)),m.argsByName.set(E.name,E),E)))}l.rules=L;const T=Object.assign({},f.modifiers);if(l.modifiers)for(const C in l.modifiers){c(!M[C],"Rule conflict in",l.type,C);const m=l.modifiers[C];c(typeof m=="function","Invalid modifier definition for",l.type,C);const w=function(E){return this.rule({[C]:E})};M[C]=w,T[C]=m}if(l.modifiers=T,l.overrides){M._super=z,q.$_super={};for(const C in l.overrides)c(z[C],"Cannot override missing",C),l.overrides[C][v.symbols.parent]=z[C],q.$_super[C]=z[C].bind(q);Object.assign(M,l.overrides)}l.cast=Object.assign({},f.cast,l.cast);const X=Object.assign({},f.manifest,l.manifest);return X.build=s.build(l.manifest&&l.manifest.build,f.manifest&&f.manifest.build),l.manifest=X,l.rebuild=s.rebuild(l.rebuild,f.rebuild),q},s.build=function(u,d){return u&&d?function(z,M){return d(u(z,M),M)}:u||d},s.coerce=function(u,d){return u&&d?{from:u.from&&d.from?[...new Set([...u.from,...d.from])]:null,method(z,M){let q;if((!d.from||d.from.includes(typeof z))&&(q=d.method(z,M),q)){if(q.errors||q.value===void 0)return q;z=q.value}if(!u.from||u.from.includes(typeof z)){const l=u.method(z,M);if(l)return l}return q}}:u||d},s.prepare=function(u,d){return u&&d?function(z,M){const q=u(z,M);if(q){if(q.errors||q.value===void 0)return q;z=q.value}return d(z,M)||q}:u||d},s.rebuild=function(u,d){return u&&d?function(z){d(z),u(z)}:u||d},s.validate=function(u,d){return u&&d?function(z,M){const q=d(z,M);if(q){if(q.errors&&(!Array.isArray(q.errors)||q.errors.length))return q;z=q.value}return u(z,M)||q}:u||d}},5107:(a,O,A)=>{const{assert:c,clone:y}=A(8870),v=A(8652),N=A(8160),s=A(3292),u=A(6354),d=A(8901),z=A(1123),M=A(6133),q=A(3328),l=A(2305);let f;const g={types:{alternatives:A(4946),any:A(8068),array:A(546),boolean:A(4937),date:A(7500),function:A(390),link:A(8785),number:A(3832),object:A(8966),string:A(7417),symbol:A(8826)},aliases:{alt:"alternatives",bool:"boolean",func:"function"},root:function(){const L={_types:new Set(Object.keys(g.types))};for(const T of L._types)L[T]=function(...X){return c(!X.length||["alternatives","link","object"].includes(T),"The",T,"type does not allow arguments"),g.generate(this,g.types[T],X)};for(const T of["allow","custom","disallow","equal","exist","forbidden","invalid","not","only","optional","options","prefs","preferences","required","strip","valid","when"])L[T]=function(...X){return this.any()[T](...X)};Object.assign(L,g.methods);for(const T in g.aliases){const X=g.aliases[T];L[T]=L[X]}return L.x=L.expression,l.setup&&l.setup(L),L}};g.methods={ValidationError:u.ValidationError,version:N.version,cache:v.provider,assert(L,T,...X){g.assert(L,T,!0,X)},attempt:(L,T,...X)=>g.assert(L,T,!1,X),build(L){return c(typeof z.build=="function","Manifest functionality disabled"),z.build(this,L)},checkPreferences(L){N.checkPreferences(L)},compile(L,T){return s.compile(this,L,T)},defaults(L){c(typeof L=="function","modifier must be a function");const T=Object.assign({},this);for(const X of T._types){const C=L(T[X]());c(N.isSchema(C),"modifier must return a valid schema object"),T[X]=function(...m){return g.generate(this,C,m)}}return T},expression:(...L)=>new q(...L),extend(...L){N.verifyFlat(L,"extend"),f=f||A(3378),c(L.length,"You need to provide at least one extension"),this.assert(L,f.extensions);const T=Object.assign({},this);T._types=new Set(T._types);for(let X of L){typeof X=="function"&&(X=X(T)),this.assert(X,f.extension);const C=g.expandExtension(X,T);for(const m of C){c(T[m.type]===void 0||T._types.has(m.type),"Cannot override name",m.type);const w=m.base||this.any(),E=d.type(w,m);T._types.add(m.type),T[m.type]=function(...U){return g.generate(this,E,U)}}}return T},isError:u.ValidationError.isError,isExpression:q.isTemplate,isRef:M.isRef,isSchema:N.isSchema,in:(...L)=>M.in(...L),override:N.symbols.override,ref:(...L)=>M.create(...L),types(){const L={};for(const T of this._types)L[T]=this[T]();for(const T in g.aliases)L[T]=this[T]();return L}},g.assert=function(L,T,X,C){const m=C[0]instanceof Error||typeof C[0]=="string"?C[0]:null,w=m!==null?C[1]:C[0],E=T.validate(L,N.preferences({errors:{stack:!0}},w||{}));let U=E.error;if(!U)return E.value;if(m instanceof Error)throw m;const z0=X&&typeof U.annotate=="function"?U.annotate():U.message;throw U instanceof u.ValidationError==0&&(U=y(U)),U.message=m?`${m} ${z0}`:z0,U},g.generate=function(L,T,X){return c(L,"Must be invoked on a Joi instance."),T.$_root=L,T._definition.args&&X.length?T._definition.args(T,...X):T},g.expandExtension=function(L,T){if(typeof L.type=="string")return[L];const X=[];for(const C of T._types)if(L.type.test(C)){const m=Object.assign({},L);m.type=C,m.base=T[C](),X.push(m)}return X},a.exports=g.root()},1123:(a,O,A)=>{const{assert:c,clone:y}=A(8870),v=A(8160),N=A(6914),s=A(6133),u=A(3328);let d;const z={};O.describe=function(M){const q=M._definition,l={type:M.type,flags:{},rules:[]};for(const f in M._flags)f[0]!=="_"&&(l.flags[f]=z.describe(M._flags[f]));Object.keys(l.flags).length||delete l.flags,M._preferences&&(l.preferences=y(M._preferences,{shallow:["messages"]}),delete l.preferences[v.symbols.prefs],l.preferences.messages&&(l.preferences.messages=N.decompile(l.preferences.messages))),M._valids&&(l.allow=M._valids.describe()),M._invalids&&(l.invalid=M._invalids.describe());for(const f of M._rules){if(q.rules[f.name].manifest===!1)continue;const g={name:f.name};for(const L in q.modifiers)f[L]!==void 0&&(g[L]=z.describe(f[L]));if(f.args){g.args={};for(const L in f.args){const T=f.args[L];(L!=="options"||Object.keys(T).length)&&(g.args[L]=z.describe(T,{assign:L}))}Object.keys(g.args).length||delete g.args}l.rules.push(g)}l.rules.length||delete l.rules;for(const f in M.$_terms){if(f[0]==="_")continue;c(!l[f],"Cannot describe schema due to internal name conflict with",f);const g=M.$_terms[f];if(!g)continue;if(g instanceof Map){g.size&&(l[f]=[...g.entries()]);continue}if(v.isValues(g)){l[f]=g.describe();continue}c(q.terms[f],"Term",f,"missing configuration");const L=q.terms[f].manifest,T=typeof L=="object";if(!g.length&&!T)continue;const X=[];for(const C of g)X.push(z.describe(C));if(T){const{from:C,to:m}=L.mapped;l[f]={};for(const w of X)l[f][w[m]]=w[C]}else L!=="single"?l[f]=X:(c(X.length===1,"Term",f,"contains more than one item"),l[f]=X[0])}return z.validate(M.$_root,l),l},z.describe=function(M,q={}){if(Array.isArray(M))return M.map(z.describe);if(M===v.symbols.deepDefault)return{special:"deep"};if(typeof M!="object"||M===null)return M;if(q.assign==="options")return y(M);if(M instanceof Date)return M.toISOString();if(M instanceof Error)return M;if(M instanceof RegExp)return q.assign==="regex"?M.toString():{regex:M.toString()};if(M[v.symbols.literal])return{function:M.literal};if(typeof M.describe=="function")return q.assign==="ref"?M.describe().ref:M.describe();const l={};for(const f in M){const g=M[f];g!==void 0&&(l[f]=z.describe(g,{assign:f}))}return l},O.build=function(M,q){return new z.Builder(M).parse(q)},z.Builder=class{constructor(M){this.joi=M}parse(M){z.validate(this.joi,M);let q=this.joi[M.type]()._bare();const l=q._definition;if(M.flags)for(const g in M.flags){const L=l.flags[g]&&l.flags[g].setter||g;c(typeof q[L]=="function","Invalid flag",g,"for type",M.type),q=q[L](this.build(M.flags[g]))}if(M.preferences&&(q=q.preferences(this.build(M.preferences))),M.allow&&(q=q.allow(...this.build(M.allow))),M.invalid&&(q=q.invalid(...this.build(M.invalid))),M.rules)for(const g of M.rules){c(typeof q[g.name]=="function","Invalid rule",g.name,"for type",M.type);const L=[];if(g.args){const X={};for(const w in g.args)X[w]=this.build(g.args[w],{assign:w});const C=Object.keys(X),m=l.rules[g.name].args;if(m){c(C.length<=m.length,"Invalid number of arguments for",M.type,g.name,"(expected up to",m.length,", found",C.length,")");for(const{name:w}of m)L.push(X[w])}else c(C.length===1,"Invalid number of arguments for",M.type,g.name,"(expected up to 1, found",C.length,")"),L.push(X[C[0]])}q=q[g.name](...L);const T={};for(const X in l.modifiers)g[X]!==void 0&&(T[X]=this.build(g[X]));Object.keys(T).length&&(q=q.rule(T))}const f={};for(const g in M){if(["allow","flags","invalid","whens","preferences","rules","type"].includes(g))continue;c(l.terms[g],"Term",g,"missing configuration");const L=l.terms[g].manifest;if(L!=="schema")if(L!=="values")if(L!=="single")if(typeof L!="object")f[g]=this.build(M[g]);else{f[g]={};for(const T in M[g]){const X=M[g][T];f[g][T]=this.parse(X)}}else f[g]=this.build(M[g]);else f[g]=M[g].map(T=>this.build(T));else f[g]=M[g].map(T=>this.parse(T))}return M.whens&&(f.whens=M.whens.map(g=>this.build(g))),q=l.manifest.build(q,f),q.$_temp.ruleset=!1,q}build(M,q={}){if(M===null)return null;if(Array.isArray(M))return M.map(f=>this.build(f));if(M instanceof Error)return M;if(q.assign==="options")return y(M);if(q.assign==="regex")return z.regex(M);if(q.assign==="ref")return s.build(M);if(typeof M!="object")return M;if(Object.keys(M).length===1){if(M.buffer)return c(!1,"Buffers are not supported"),!1;if(M.function)return{[v.symbols.literal]:!0,literal:M.function};if(M.override)return v.symbols.override;if(M.ref)return s.build(M.ref);if(M.regex)return z.regex(M.regex);if(M.special)return c(["deep"].includes(M.special),"Unknown special value",M.special),v.symbols.deepDefault;if(M.value)return y(M.value)}if(M.type)return this.parse(M);if(M.template)return u.build(M);const l={};for(const f in M)l[f]=this.build(M[f],{assign:f});return l}},z.regex=function(M){const q=M.lastIndexOf("/"),l=M.slice(1,q),f=M.slice(q+1);return new RegExp(l,f)},z.validate=function(M,q){d=d||A(3378),M.assert(q,d.description)}},6914:(a,O,A)=>{const{assert:c,clone:y}=A(8870),v=A(3328);O.compile=function(N,s){if(typeof N=="string")return c(!s,"Cannot set single message string"),new v(N);if(v.isTemplate(N))return c(!s,"Cannot set single message template"),N;c(typeof N=="object"&&!Array.isArray(N),"Invalid message options"),s=s?y(s):{};for(let u in N){const d=N[u];if(u==="root"||v.isTemplate(d)){s[u]=d;continue}if(typeof d=="string"){s[u]=new v(d);continue}c(typeof d=="object"&&!Array.isArray(d),"Invalid message for",u);const z=u;for(u in s[z]=s[z]||{},d){const M=d[u];u==="root"||v.isTemplate(M)?s[z][u]=M:(c(typeof M=="string","Invalid message for",u,"in",z),s[z][u]=new v(M))}}return s},O.decompile=function(N){const s={};for(let u in N){const d=N[u];if(u==="root"){s.root=d;continue}if(v.isTemplate(d)){s[u]=d.describe({compact:!0});continue}const z=u;for(u in s[z]={},d){const M=d[u];u!=="root"?s[z][u]=M.describe({compact:!0}):s[z].root=M}}return s},O.merge=function(N,s){if(!N)return O.compile(s);if(!s)return N;if(typeof s=="string")return new v(s);if(v.isTemplate(s))return s;const u=y(N);for(let d in s){const z=s[d];if(d==="root"||v.isTemplate(z)){u[d]=z;continue}if(typeof z=="string"){u[d]=new v(z);continue}c(typeof z=="object"&&!Array.isArray(z),"Invalid message for",d);const M=d;for(d in u[M]=u[M]||{},z){const q=z[d];d==="root"||v.isTemplate(q)?u[M][d]=q:(c(typeof q=="string","Invalid message for",d,"in",M),u[M][d]=new v(q))}}return u}},2294:(a,O,A)=>{const{assert:c}=A(8870),y=A(8160),v=A(6133),N={};O.Ids=N.Ids=class{constructor(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}clone(){const s=new N.Ids;return s._byId=new Map(this._byId),s._byKey=new Map(this._byKey),s._schemaChain=this._schemaChain,s}concat(s){s._schemaChain&&(this._schemaChain=!0);for(const[u,d]of s._byId.entries())c(!this._byKey.has(u),"Schema id conflicts with existing key:",u),this._byId.set(u,d);for(const[u,d]of s._byKey.entries())c(!this._byId.has(u),"Schema key conflicts with existing id:",u),this._byKey.set(u,d)}fork(s,u,d){const z=this._collect(s);z.push({schema:d});const M=z.shift();let q={id:M.id,schema:u(M.schema)};c(y.isSchema(q.schema),"adjuster function failed to return a joi schema type");for(const l of z)q={id:l.id,schema:N.fork(l.schema,q.id,q.schema)};return q.schema}labels(s,u=[]){const d=s[0],z=this._get(d);if(!z)return[...u,...s].join(".");const M=s.slice(1);return u=[...u,z.schema._flags.label||d],M.length?z.schema._ids.labels(M,u):u.join(".")}reach(s,u=[]){const d=s[0],z=this._get(d);c(z,"Schema does not contain path",[...u,...s].join("."));const M=s.slice(1);return M.length?z.schema._ids.reach(M,[...u,d]):z.schema}register(s,{key:u}={}){if(!s||!y.isSchema(s))return;(s.$_property("schemaChain")||s._ids._schemaChain)&&(this._schemaChain=!0);const d=s._flags.id;if(d){const z=this._byId.get(d);c(!z||z.schema===s,"Cannot add different schemas with the same id:",d),c(!this._byKey.has(d),"Schema id conflicts with existing key:",d),this._byId.set(d,{schema:s,id:d})}u&&(c(!this._byKey.has(u),"Schema already contains key:",u),c(!this._byId.has(u),"Schema key conflicts with existing id:",u),this._byKey.set(u,{schema:s,id:u}))}reset(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}_collect(s,u=[],d=[]){const z=s[0],M=this._get(z);c(M,"Schema does not contain path",[...u,...s].join(".")),d=[M,...d];const q=s.slice(1);return q.length?M.schema._ids._collect(q,[...u,z],d):d}_get(s){return this._byId.get(s)||this._byKey.get(s)}},N.fork=function(s,u,d){const z=O.schema(s,{each:(M,{key:q})=>{if(u===(M._flags.id||q))return d},ref:!1});return z?z.$_mutateRebuild():s},O.schema=function(s,u){let d;for(const z in s._flags){if(z[0]==="_")continue;const M=N.scan(s._flags[z],{source:"flags",name:z},u);M!==void 0&&(d=d||s.clone(),d._flags[z]=M)}for(let z=0;z<s._rules.length;++z){const M=s._rules[z],q=N.scan(M.args,{source:"rules",name:M.name},u);if(q!==void 0){d=d||s.clone();const l=Object.assign({},M);l.args=q,d._rules[z]=l,d._singleRules.get(M.name)===M&&d._singleRules.set(M.name,l)}}for(const z in s.$_terms){if(z[0]==="_")continue;const M=N.scan(s.$_terms[z],{source:"terms",name:z},u);M!==void 0&&(d=d||s.clone(),d.$_terms[z]=M)}return d},N.scan=function(s,u,d,z,M){const q=z||[];if(s===null||typeof s!="object")return;let l;if(Array.isArray(s)){for(let f=0;f<s.length;++f){const g=u.source==="terms"&&u.name==="keys"&&s[f].key,L=N.scan(s[f],u,d,[f,...q],g);L!==void 0&&(l=l||s.slice(),l[f]=L)}return l}if(d.schema!==!1&&y.isSchema(s)||d.ref!==!1&&v.isRef(s)){const f=d.each(s,{...u,path:q,key:M});return f===s?void 0:f}for(const f in s){if(f[0]==="_")continue;const g=N.scan(s[f],u,d,[f,...q],M);g!==void 0&&(l=l||Object.assign({},s),l[f]=g)}return l}},6133:(a,O,A)=>{const{assert:c,clone:y,reach:v}=A(8870),N=A(8160);let s;const u={symbol:Symbol("ref"),defaults:{adjust:null,in:!1,iterables:null,map:null,separator:".",type:"value"}};O.create=function(d,z={}){c(typeof d=="string","Invalid reference key:",d),N.assertOptions(z,["adjust","ancestor","in","iterables","map","prefix","render","separator"]),c(!z.prefix||typeof z.prefix=="object","options.prefix must be of type object");const M=Object.assign({},u.defaults,z);delete M.prefix;const q=M.separator,l=u.context(d,q,z.prefix);if(M.type=l.type,d=l.key,M.type==="value")if(l.root&&(c(!q||d[0]!==q,"Cannot specify relative path with root prefix"),M.ancestor="root",d||(d=null)),q&&q===d)d=null,M.ancestor=0;else if(M.ancestor!==void 0)c(!q||!d||d[0]!==q,"Cannot combine prefix with ancestor option");else{const[f,g]=u.ancestor(d,q);g&&(d=d.slice(g))===""&&(d=null),M.ancestor=f}return M.path=q?d===null?[]:d.split(q):[d],new u.Ref(M)},O.in=function(d,z={}){return O.create(d,{...z,in:!0})},O.isRef=function(d){return!!d&&!!d[N.symbols.ref]},u.Ref=class{constructor(d){c(typeof d=="object","Invalid reference construction"),N.assertOptions(d,["adjust","ancestor","in","iterables","map","path","render","separator","type","depth","key","root","display"]),c([!1,void 0].includes(d.separator)||typeof d.separator=="string"&&d.separator.length===1,"Invalid separator"),c(!d.adjust||typeof d.adjust=="function","options.adjust must be a function"),c(!d.map||Array.isArray(d.map),"options.map must be an array"),c(!d.map||!d.adjust,"Cannot set both map and adjust options"),Object.assign(this,u.defaults,d),c(this.type==="value"||this.ancestor===void 0,"Non-value references cannot reference ancestors"),Array.isArray(this.map)&&(this.map=new Map(this.map)),this.depth=this.path.length,this.key=this.path.length?this.path.join(this.separator):null,this.root=this.path[0],this.updateDisplay()}resolve(d,z,M,q,l={}){return c(!this.in||l.in,"Invalid in() reference usage"),this.type==="global"?this._resolve(M.context,z,l):this.type==="local"?this._resolve(q,z,l):this.ancestor?this.ancestor==="root"?this._resolve(z.ancestors[z.ancestors.length-1],z,l):(c(this.ancestor<=z.ancestors.length,"Invalid reference exceeds the schema root:",this.display),this._resolve(z.ancestors[this.ancestor-1],z,l)):this._resolve(d,z,l)}_resolve(d,z,M){let q;if(this.type==="value"&&z.mainstay.shadow&&M.shadow!==!1&&(q=z.mainstay.shadow.get(this.absolute(z))),q===void 0&&(q=v(d,this.path,{iterables:this.iterables,functions:!0})),this.adjust&&(q=this.adjust(q)),this.map){const l=this.map.get(q);l!==void 0&&(q=l)}return z.mainstay&&z.mainstay.tracer.resolve(z,this,q),q}toString(){return this.display}absolute(d){return[...d.path.slice(0,-this.ancestor),...this.path]}clone(){return new u.Ref(this)}describe(){const d={path:this.path};this.type!=="value"&&(d.type=this.type),this.separator!=="."&&(d.separator=this.separator),this.type==="value"&&this.ancestor!==1&&(d.ancestor=this.ancestor),this.map&&(d.map=[...this.map]);for(const z of["adjust","iterables","render"])this[z]!==null&&this[z]!==void 0&&(d[z]=this[z]);return this.in!==!1&&(d.in=!0),{ref:d}}updateDisplay(){const d=this.key!==null?this.key:"";if(this.type!=="value")return void(this.display=`ref:${this.type}:${d}`);if(!this.separator)return void(this.display=`ref:${d}`);if(!this.ancestor)return void(this.display=`ref:${this.separator}${d}`);if(this.ancestor==="root")return void(this.display=`ref:root:${d}`);if(this.ancestor===1)return void(this.display=`ref:${d||".."}`);const z=new Array(this.ancestor+1).fill(this.separator).join("");this.display=`ref:${z}${d||""}`}},u.Ref.prototype[N.symbols.ref]=!0,O.build=function(d){return(d=Object.assign({},u.defaults,d)).type==="value"&&d.ancestor===void 0&&(d.ancestor=1),new u.Ref(d)},u.context=function(d,z,M={}){if(d=d.trim(),M){const q=M.global===void 0?"$":M.global;if(q!==z&&d.startsWith(q))return{key:d.slice(q.length),type:"global"};const l=M.local===void 0?"#":M.local;if(l!==z&&d.startsWith(l))return{key:d.slice(l.length),type:"local"};const f=M.root===void 0?"/":M.root;if(f!==z&&d.startsWith(f))return{key:d.slice(f.length),type:"value",root:!0}}return{key:d,type:"value"}},u.ancestor=function(d,z){if(!z)return[1,0];if(d[0]!==z)return[1,0];if(d[1]!==z)return[0,1];let M=2;for(;d[M]===z;)++M;return[M-1,M]},O.toSibling=0,O.toParent=1,O.Manager=class{constructor(){this.refs=[]}register(d,z){if(d)if(z=z===void 0?O.toParent:z,Array.isArray(d))for(const M of d)this.register(M,z);else if(N.isSchema(d))for(const M of d._refs.refs)M.ancestor-z>=0&&this.refs.push({ancestor:M.ancestor-z,root:M.root});else O.isRef(d)&&d.type==="value"&&d.ancestor-z>=0&&this.refs.push({ancestor:d.ancestor-z,root:d.root}),s=s||A(3328),s.isTemplate(d)&&this.register(d.refs(),z)}get length(){return this.refs.length}clone(){const d=new O.Manager;return d.refs=y(this.refs),d}reset(){this.refs=[]}roots(){return this.refs.filter(d=>!d.ancestor).map(d=>d.root)}}},3378:(a,O,A)=>{const c=A(5107),y={};y.wrap=c.string().min(1).max(2).allow(!1),O.preferences=c.object({allowUnknown:c.boolean(),abortEarly:c.boolean(),artifacts:c.boolean(),cache:c.boolean(),context:c.object(),convert:c.boolean(),dateFormat:c.valid("date","iso","string","time","utc"),debug:c.boolean(),errors:{escapeHtml:c.boolean(),label:c.valid("path","key",!1),language:[c.string(),c.object().ref()],render:c.boolean(),stack:c.boolean(),wrap:{label:y.wrap,array:y.wrap,string:y.wrap}},externals:c.boolean(),messages:c.object(),noDefaults:c.boolean(),nonEnumerables:c.boolean(),presence:c.valid("required","optional","forbidden"),skipFunctions:c.boolean(),stripUnknown:c.object({arrays:c.boolean(),objects:c.boolean()}).or("arrays","objects").allow(!0,!1),warnings:c.boolean()}).strict(),y.nameRx=/^[a-zA-Z0-9]\w*$/,y.rule=c.object({alias:c.array().items(c.string().pattern(y.nameRx)).single(),args:c.array().items(c.string(),c.object({name:c.string().pattern(y.nameRx).required(),ref:c.boolean(),assert:c.alternatives([c.function(),c.object().schema()]).conditional("ref",{is:!0,then:c.required()}),normalize:c.function(),message:c.string().when("assert",{is:c.function(),then:c.required()})})),convert:c.boolean(),manifest:c.boolean(),method:c.function().allow(!1),multi:c.boolean(),validate:c.function()}),O.extension=c.object({type:c.alternatives([c.string(),c.object().regex()]).required(),args:c.function(),cast:c.object().pattern(y.nameRx,c.object({from:c.function().maxArity(1).required(),to:c.function().minArity(1).maxArity(2).required()})),base:c.object().schema().when("type",{is:c.object().regex(),then:c.forbidden()}),coerce:[c.function().maxArity(3),c.object({method:c.function().maxArity(3).required(),from:c.array().items(c.string()).single()})],flags:c.object().pattern(y.nameRx,c.object({setter:c.string(),default:c.any()})),manifest:{build:c.function().arity(2)},messages:[c.object(),c.string()],modifiers:c.object().pattern(y.nameRx,c.function().minArity(1).maxArity(2)),overrides:c.object().pattern(y.nameRx,c.function()),prepare:c.function().maxArity(3),rebuild:c.function().arity(1),rules:c.object().pattern(y.nameRx,y.rule),terms:c.object().pattern(y.nameRx,c.object({init:c.array().allow(null).required(),manifest:c.object().pattern(/.+/,[c.valid("schema","single"),c.object({mapped:c.object({from:c.string().required(),to:c.string().required()}).required()})])})),validate:c.function().maxArity(3)}).strict(),O.extensions=c.array().items(c.object(),c.function().arity(1)).strict(),y.desc={buffer:c.object({buffer:c.string()}),func:c.object({function:c.function().required(),options:{literal:!0}}),override:c.object({override:!0}),ref:c.object({ref:c.object({type:c.valid("value","global","local"),path:c.array().required(),separator:c.string().length(1).allow(!1),ancestor:c.number().min(0).integer().allow("root"),map:c.array().items(c.array().length(2)).min(1),adjust:c.function(),iterables:c.boolean(),in:c.boolean(),render:c.boolean()}).required()}),regex:c.object({regex:c.string().min(3)}),special:c.object({special:c.valid("deep").required()}),template:c.object({template:c.string().required(),options:c.object()}),value:c.object({value:c.alternatives([c.object(),c.array()]).required()})},y.desc.entity=c.alternatives([c.array().items(c.link("...")),c.boolean(),c.function(),c.number(),c.string(),y.desc.buffer,y.desc.func,y.desc.ref,y.desc.regex,y.desc.special,y.desc.template,y.desc.value,c.link("/")]),y.desc.values=c.array().items(null,c.boolean(),c.function(),c.number().allow(1/0,-1/0),c.string().allow(""),c.symbol(),y.desc.buffer,y.desc.func,y.desc.override,y.desc.ref,y.desc.regex,y.desc.template,y.desc.value),y.desc.messages=c.object().pattern(/.+/,[c.string(),y.desc.template,c.object().pattern(/.+/,[c.string(),y.desc.template])]),O.description=c.object({type:c.string().required(),flags:c.object({cast:c.string(),default:c.any(),description:c.string(),empty:c.link("/"),failover:y.desc.entity,id:c.string(),label:c.string(),only:!0,presence:["optional","required","forbidden"],result:["raw","strip"],strip:c.boolean(),unit:c.string()}).unknown(),preferences:{allowUnknown:c.boolean(),abortEarly:c.boolean(),artifacts:c.boolean(),cache:c.boolean(),convert:c.boolean(),dateFormat:["date","iso","string","time","utc"],errors:{escapeHtml:c.boolean(),label:["path","key"],language:[c.string(),y.desc.ref],wrap:{label:y.wrap,array:y.wrap}},externals:c.boolean(),messages:y.desc.messages,noDefaults:c.boolean(),nonEnumerables:c.boolean(),presence:["required","optional","forbidden"],skipFunctions:c.boolean(),stripUnknown:c.object({arrays:c.boolean(),objects:c.boolean()}).or("arrays","objects").allow(!0,!1),warnings:c.boolean()},allow:y.desc.values,invalid:y.desc.values,rules:c.array().min(1).items({name:c.string().required(),args:c.object().min(1),keep:c.boolean(),message:[c.string(),y.desc.messages],warn:c.boolean()}),keys:c.object().pattern(/.*/,c.link("/")),link:y.desc.ref}).pattern(/^[a-z]\w*$/,c.any())},493:(a,O,A)=>{const{clone:c,reach:y}=A(8870),v=A(8160),N={value:Symbol("value")};a.exports=N.State=class{constructor(s,u,d){this.path=s,this.ancestors=u,this.mainstay=d.mainstay,this.schemas=d.schemas,this.debug=null}localize(s,u=null,d=null){const z=new N.State(s,u,this);return d&&z.schemas&&(z.schemas=[N.schemas(d),...z.schemas]),z}nest(s,u){const d=new N.State(this.path,this.ancestors,this);return d.schemas=d.schemas&&[N.schemas(s),...d.schemas],d.debug=u,d}shadow(s,u){this.mainstay.shadow=this.mainstay.shadow||new N.Shadow,this.mainstay.shadow.set(this.path,s,u)}snapshot(){this.mainstay.shadow&&(this._snapshot=c(this.mainstay.shadow.node(this.path))),this.mainstay.snapshot()}restore(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0),this.mainstay.restore()}commit(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0),this.mainstay.commit()}},N.schemas=function(s){return v.isSchema(s)?{schema:s}:s},N.Shadow=class{constructor(){this._values=null}set(s,u,d){if(!s.length||d==="strip"&&typeof s[s.length-1]=="number")return;this._values=this._values||new Map;let z=this._values;for(let M=0;M<s.length;++M){const q=s[M];let l=z.get(q);l||(l=new Map,z.set(q,l)),z=l}z[N.value]=u}get(s){const u=this.node(s);if(u)return u[N.value]}node(s){if(this._values)return y(this._values,s,{iterables:!0})}override(s,u){if(!this._values)return;const d=s.slice(0,-1),z=s[s.length-1],M=y(this._values,d,{iterables:!0});u?M.set(z,u):M&&M.delete(z)}}},3328:(a,O,A)=>{const{assert:c,clone:y,escapeHtml:v}=A(8870),N=A(4964),s=A(8160),u=A(6354),d=A(6133),z={symbol:Symbol("template"),opens:new Array(1e3).join("\0"),closes:new Array(1e3).join(""),dateFormat:{date:Date.prototype.toDateString,iso:Date.prototype.toISOString,string:Date.prototype.toString,time:Date.prototype.toTimeString,utc:Date.prototype.toUTCString}};a.exports=z.Template=class{constructor(M,q){if(c(typeof M=="string","Template source must be a string"),c(!M.includes("\0")&&!M.includes(""),"Template source cannot contain reserved control characters"),this.source=M,this.rendered=M,this._template=null,q){const{functions:l,...f}=q;this._settings=Object.keys(f).length?y(f):void 0,this._functions=l,this._functions&&(c(Object.keys(this._functions).every(g=>typeof g=="string"),"Functions keys must be strings"),c(Object.values(this._functions).every(g=>typeof g=="function"),"Functions values must be functions"))}else this._settings=void 0,this._functions=void 0;this._parse()}_parse(){if(!this.source.includes("{"))return;const M=z.encode(this.source),q=z.split(M);let l=!1;const f=[],g=q.shift();g&&f.push(g);for(const L of q){const T=L[0]!=="{",X=T?"}":"}}",C=L.indexOf(X);if(C===-1||L[1]==="{"){f.push(`{${z.decode(L)}`);continue}let m=L.slice(T?0:1,C);const w=m[0]===":";w&&(m=m.slice(1));const E=this._ref(z.decode(m),{raw:T,wrapped:w});f.push(E),typeof E!="string"&&(l=!0);const U=L.slice(C+X.length);U&&f.push(z.decode(U))}l?this._template=f:this.rendered=f.join("")}static date(M,q){return z.dateFormat[q.dateFormat].call(M)}describe(M={}){if(!this._settings&&M.compact)return this.source;const q={template:this.source};return this._settings&&(q.options=this._settings),this._functions&&(q.functions=this._functions),q}static build(M){return new z.Template(M.template,M.options||M.functions?{...M.options,functions:M.functions}:void 0)}isDynamic(){return!!this._template}static isTemplate(M){return!!M&&!!M[s.symbols.template]}refs(){if(!this._template)return;const M=[];for(const q of this._template)typeof q!="string"&&M.push(...q.refs);return M}resolve(M,q,l,f){return this._template&&this._template.length===1?this._part(this._template[0],M,q,l,f,{}):this.render(M,q,l,f)}_part(M,...q){return M.ref?M.ref.resolve(...q):M.formula.evaluate(q)}render(M,q,l,f,g={}){if(!this.isDynamic())return this.rendered;const L=[];for(const T of this._template)if(typeof T=="string")L.push(T);else{const X=this._part(T,M,q,l,f,g),C=z.stringify(X,M,q,l,f,g);if(C!==void 0){const m=T.raw||(g.errors&&g.errors.escapeHtml)===!1?C:v(C);L.push(z.wrap(m,T.wrapped&&l.errors.wrap.label))}}return L.join("")}_ref(M,{raw:q,wrapped:l}){const f=[],g=T=>{const X=d.create(T,this._settings);return f.push(X),C=>{const m=X.resolve(...C);return m!==void 0?m:null}};try{const T=this._functions?{...z.functions,...this._functions}:z.functions;var L=new N.Parser(M,{reference:g,functions:T,constants:z.constants})}catch(T){throw T.message=`Invalid template variable "${M}" fails due to: ${T.message}`,T}if(L.single){if(L.single.type==="reference"){const T=f[0];return{ref:T,raw:q,refs:f,wrapped:l||T.type==="local"&&T.key==="label"}}return z.stringify(L.single.value)}return{formula:L,raw:q,refs:f}}toString(){return this.source}},z.Template.prototype[s.symbols.template]=!0,z.Template.prototype.isImmutable=!0,z.encode=function(M){return M.replace(/\\(\{+)/g,(q,l)=>z.opens.slice(0,l.length)).replace(/\\(\}+)/g,(q,l)=>z.closes.slice(0,l.length))},z.decode=function(M){return M.replace(/\u0000/g,"{").replace(/\u0001/g,"}")},z.split=function(M){const q=[];let l="";for(let f=0;f<M.length;++f){const g=M[f];if(g==="{"){let L="";for(;f+1<M.length&&M[f+1]==="{";)L+="{",++f;q.push(l),l=L}else l+=g}return q.push(l),q},z.wrap=function(M,q){return q?q.length===1?`${q}${M}${q}`:`${q[0]}${M}${q[1]}`:M},z.stringify=function(M,q,l,f,g,L={}){const T=typeof M,X=f&&f.errors&&f.errors.wrap||{};let C=!1;if(d.isRef(M)&&M.render&&(C=M.in,M=M.resolve(q,l,f,g,{in:M.in,...L})),M===null)return"null";if(T==="string")return z.wrap(M,L.arrayItems&&X.string);if(T==="number"||T==="function"||T==="symbol")return M.toString();if(T!=="object")return JSON.stringify(M);if(M instanceof Date)return z.Template.date(M,f);if(M instanceof Map){const w=[];for(const[E,U]of M.entries())w.push(`${E.toString()} -> ${U.toString()}`);M=w}if(!Array.isArray(M))return M.toString();const m=[];for(const w of M)m.push(z.stringify(w,q,l,f,g,{arrayItems:!0,...L}));return z.wrap(m.join(", "),!C&&X.array)},z.constants={true:!0,false:!1,null:null,second:1e3,minute:6e4,hour:36e5,day:864e5},z.functions={if:(M,q,l)=>M?q:l,length:M=>typeof M=="string"?M.length:M&&typeof M=="object"?Array.isArray(M)?M.length:Object.keys(M).length:null,msg(M){const[q,l,f,g,L]=this,T=L.messages;if(!T)return"";const X=u.template(q,T[0],M,l,f)||u.template(q,T[1],M,l,f);return X?X.render(q,l,f,g,L):""},number:M=>typeof M=="number"?M:typeof M=="string"?parseFloat(M):typeof M=="boolean"?M?1:0:M instanceof Date?M.getTime():null}},2305:(a,O,A)=>{const{deepEqual:c}=A(8870),y=A(7593),v=A(6354),N={codes:{error:1,pass:2,full:3},labels:{0:"never used",1:"always error",2:"always pass"}};O.setup=function(s){const u=function(){return s._tracer=s._tracer||new N.Tracer,s._tracer};s.trace=u,s[Symbol.for("@hapi/lab/coverage/initialize")]=u,s.untrace=()=>{s._tracer=null}},O.location=function(s){return s.$_setFlag("_tracerLocation",y.location(2))},N.Tracer=class{constructor(){this.name="Joi",this._schemas=new Map}_register(s){const u=this._schemas.get(s);if(u)return u.store;const d=new N.Store(s),{filename:z,line:M}=s._flags._tracerLocation||y.location(5);return this._schemas.set(s,{filename:z,line:M,store:d}),d}_combine(s,u){for(const{store:d}of this._schemas.values())d._combine(s,u)}report(s){const u=[];for(const{filename:d,line:z,store:M}of this._schemas.values()){if(s&&s!==d)continue;const q=[],l=[];for(const[f,g]of M._sources.entries()){if(N.sub(g.paths,l))continue;if(!g.entry){q.push({status:"never reached",paths:[...g.paths]}),l.push(...g.paths);continue}for(const T of["valid","invalid"]){const X=f[`_${T}s`];if(!X)continue;const C=new Set(X._values),m=new Set(X._refs);for(const{value:w,ref:E}of g[T])C.delete(w),m.delete(E);(C.size||m.size)&&q.push({status:[...C,...[...m].map(w=>w.display)],rule:`${T}s`})}const L=f._rules.map(T=>T.name);for(const T of["default","failover"])f._flags[T]!==void 0&&L.push(T);for(const T of L){const X=N.labels[g.rule[T]||0];if(X){const C={rule:T,status:X};g.paths.size&&(C.paths=[...g.paths]),q.push(C)}}}q.length&&u.push({filename:d,line:z,missing:q,severity:"error",message:`Schema missing tests for ${q.map(N.message).join(", ")}`})}return u.length?u:null}},N.Store=class{constructor(s){this.active=!0,this._sources=new Map,this._combos=new Map,this._scan(s)}debug(s,u,d,z){s.mainstay.debug&&s.mainstay.debug.push({type:u,name:d,result:z,path:s.path})}entry(s,u){N.debug(u,{type:"entry"}),this._record(s,d=>{d.entry=!0})}filter(s,u,d,z){N.debug(u,{type:d,...z}),this._record(s,M=>{M[d].add(z)})}log(s,u,d,z,M){N.debug(u,{type:d,name:z,result:M==="full"?"pass":M}),this._record(s,q=>{q[d][z]=q[d][z]||0,q[d][z]|=N.codes[M]})}resolve(s,u,d){if(!s.mainstay.debug)return;const z={type:"resolve",ref:u.display,to:d,path:s.path};s.mainstay.debug.push(z)}value(s,u,d,z,M){if(!s.mainstay.debug||c(d,z))return;const q={type:"value",by:u,from:d,to:z,path:s.path};M&&(q.name=M),s.mainstay.debug.push(q)}_record(s,u){const d=this._sources.get(s);if(d)return void u(d);const z=this._combos.get(s);for(const M of z)this._record(M,u)}_scan(s,u){const d=u||[];let z=this._sources.get(s);z||(z={paths:new Set,entry:!1,rule:{},valid:new Set,invalid:new Set},this._sources.set(s,z)),d.length&&z.paths.add(d),s.$_modify({each:(M,q)=>{const l=N.id(M,q);this._scan(M,d.concat(l))},ref:!1})}_combine(s,u){this._combos.set(s,u)}},N.message=function(s){return`${s.paths?v.path(s.paths[0])+(s.rule?":":""):""}${s.rule||""} (${s.status})`},N.id=function(s,{source:u,name:d,path:z,key:M}){return s._flags.id?s._flags.id:M||(d=`@${d}`,u==="terms"?[d,z[Math.min(z.length-1,1)]]:d)},N.sub=function(s,u){for(const d of s)for(const z of u)if(c(d.slice(0,z.length),z))return!0;return!1},N.debug=function(s,u){s.mainstay.debug&&(u.path=s.debug?[...s.path,s.debug]:s.path,s.mainstay.debug.push(u))}},4946:(a,O,A)=>{const{assert:c,merge:y}=A(8870),v=A(8068),N=A(8160),s=A(3292),u=A(6354),d=A(6133),z={};a.exports=v.extend({type:"alternatives",flags:{match:{default:"any"}},terms:{matches:{init:[],register:d.toSibling}},args:(M,...q)=>q.length===1&&Array.isArray(q[0])?M.try(...q[0]):M.try(...q),validate(M,q){const{schema:l,error:f,state:g,prefs:L}=q;if(l._flags.match){const X=[],C=[];for(let w=0;w<l.$_terms.matches.length;++w){const E=l.$_terms.matches[w],U=g.nest(E.schema,`match.${w}`);U.snapshot();const z0=E.schema.$_validate(M,U,L);z0.errors?(C.push(z0.errors),U.restore()):(X.push(z0.value),U.commit())}if(X.length===0)return{errors:f("alternatives.any",{details:C.map(w=>u.details(w,{override:!1}))})};if(l._flags.match==="one")return X.length===1?{value:X[0]}:{errors:f("alternatives.one")};if(X.length!==l.$_terms.matches.length)return{errors:f("alternatives.all",{details:C.map(w=>u.details(w,{override:!1}))})};const m=w=>w.$_terms.matches.some(E=>E.schema.type==="object"||E.schema.type==="alternatives"&&m(E.schema));return m(l)?{value:X.reduce((w,E)=>y(w,E,{mergeArrays:!1}))}:{value:X[X.length-1]}}const T=[];for(let X=0;X<l.$_terms.matches.length;++X){const C=l.$_terms.matches[X];if(C.schema){const E=g.nest(C.schema,`match.${X}`);E.snapshot();const U=C.schema.$_validate(M,E,L);if(!U.errors)return E.commit(),U;E.restore(),T.push({schema:C.schema,reports:U.errors});continue}const m=C.ref?C.ref.resolve(M,g,L):M,w=C.is?[C]:C.switch;for(let E=0;E<w.length;++E){const U=w[E],{is:z0,then:a0,otherwise:V}=U,Z=`match.${X}${C.switch?"."+E:""}`;if(z0.$_match(m,g.nest(z0,`${Z}.is`),L)){if(a0)return a0.$_validate(M,g.nest(a0,`${Z}.then`),L)}else if(V)return V.$_validate(M,g.nest(V,`${Z}.otherwise`),L)}}return z.errors(T,q)},rules:{conditional:{method(M,q){c(!this._flags._endedSwitch,"Unreachable condition"),c(!this._flags.match,"Cannot combine match mode",this._flags.match,"with conditional rule"),c(q.break===void 0,"Cannot use break option with alternatives conditional");const l=this.clone(),f=s.when(l,M,q),g=f.is?[f]:f.switch;for(const L of g)if(L.then&&L.otherwise){l.$_setFlag("_endedSwitch",!0,{clone:!1});break}return l.$_terms.matches.push(f),l.$_mutateRebuild()}},match:{method(M){if(c(["any","one","all"].includes(M),"Invalid alternatives match mode",M),M!=="any")for(const q of this.$_terms.matches)c(q.schema,"Cannot combine match mode",M,"with conditional rules");return this.$_setFlag("match",M)}},try:{method(...M){c(M.length,"Missing alternative schemas"),N.verifyFlat(M,"try"),c(!this._flags._endedSwitch,"Unreachable condition");const q=this.clone();for(const l of M)q.$_terms.matches.push({schema:q.$_compile(l)});return q.$_mutateRebuild()}}},overrides:{label(M){return this.$_parent("label",M).$_modify({each:(q,l)=>l.path[0]!=="is"?q.label(M):void 0,ref:!1})}},rebuild(M){M.$_modify({each:q=>{N.isSchema(q)&&q.type==="array"&&M.$_setFlag("_arrayItems",!0,{clone:!1})}})},manifest:{build(M,q){if(q.matches)for(const l of q.matches){const{schema:f,ref:g,is:L,not:T,then:X,otherwise:C}=l;M=f?M.try(f):g?M.conditional(g,{is:L,then:X,not:T,otherwise:C,switch:l.switch}):M.conditional(L,{then:X,otherwise:C})}return M}},messages:{"alternatives.all":"{{#label}} does not match all of the required types","alternatives.any":"{{#label}} does not match any of the allowed types","alternatives.match":"{{#label}} does not match any of the allowed types","alternatives.one":"{{#label}} matches more than one allowed type","alternatives.types":"{{#label}} must be one of {{#types}}"}}),z.errors=function(M,{error:q,state:l}){if(!M.length)return{errors:q("alternatives.any")};if(M.length===1)return{errors:M[0].reports};const f=new Set,g=[];for(const{reports:L,schema:T}of M){if(L.length>1)return z.unmatched(M,q);const X=L[0];if(X instanceof u.Report==0)return z.unmatched(M,q);if(X.state.path.length!==l.path.length){g.push({type:T.type,report:X});continue}if(X.code==="any.only"){for(const w of X.local.valids)f.add(w);continue}const[C,m]=X.code.split(".");m==="base"?f.add(C):g.push({type:T.type,report:X})}return g.length?g.length===1?{errors:g[0].report}:z.unmatched(M,q):{errors:q("alternatives.types",{types:[...f]})}},z.unmatched=function(M,q){const l=[];for(const f of M)l.push(...f.reports);return{errors:q("alternatives.match",u.details(l,{override:!1}))}}},8068:(a,O,A)=>{const{assert:c}=A(8870),y=A(7629),v=A(8160),N=A(6914);a.exports=y.extend({type:"any",flags:{only:{default:!1}},terms:{alterations:{init:null},examples:{init:null},externals:{init:null},metas:{init:[]},notes:{init:[]},shared:{init:null},tags:{init:[]},whens:{init:null}},rules:{custom:{method(s,u){return c(typeof s=="function","Method must be a function"),c(u===void 0||u&&typeof u=="string","Description must be a non-empty string"),this.$_addRule({name:"custom",args:{method:s,description:u}})},validate(s,u,{method:d}){try{return d(s,u)}catch(z){return u.error("any.custom",{error:z})}},args:["method","description"],multi:!0},messages:{method(s){return this.prefs({messages:s})}},shared:{method(s){c(v.isSchema(s)&&s._flags.id,"Schema must be a schema with an id");const u=this.clone();return u.$_terms.shared=u.$_terms.shared||[],u.$_terms.shared.push(s),u.$_mutateRegister(s),u}},warning:{method(s,u){return c(s&&typeof s=="string","Invalid warning code"),this.$_addRule({name:"warning",args:{code:s,local:u},warn:!0})},validate:(s,u,{code:d,local:z})=>u.error(d,z),args:["code","local"],multi:!0}},modifiers:{keep(s,u=!0){s.keep=u},message(s,u){s.message=N.compile(u)},warn(s,u=!0){s.warn=u}},manifest:{build(s,u){for(const d in u){const z=u[d];if(["examples","externals","metas","notes","tags"].includes(d))for(const M of z)s=s[d.slice(0,-1)](M);else if(d!=="alterations")if(d!=="whens"){if(d==="shared")for(const M of z)s=s.shared(M)}else for(const M of z){const{ref:q,is:l,not:f,then:g,otherwise:L,concat:T}=M;s=T?s.concat(T):q?s.when(q,{is:l,not:f,then:g,otherwise:L,switch:M.switch,break:M.break}):s.when(l,{then:g,otherwise:L,break:M.break})}else{const M={};for(const{target:q,adjuster:l}of z)M[q]=l;s=s.alter(M)}}return s}},messages:{"any.custom":"{{#label}} failed custom validation because {{#error.message}}","any.default":"{{#label}} threw an error when running default method","any.failover":"{{#label}} threw an error when running failover method","any.invalid":"{{#label}} contains an invalid value","any.only":'{{#label}} must be {if(#valids.length == 1, "", "one of ")}{{#valids}}',"any.ref":"{{#label}} {{#arg}} references {{:#ref}} which {{#reason}}","any.required":"{{#label}} is required","any.unknown":"{{#label}} is not allowed"}})},546:(a,O,A)=>{const{assert:c,deepEqual:y,reach:v}=A(8870),N=A(8068),s=A(8160),u=A(3292),d={};a.exports=N.extend({type:"array",flags:{single:{default:!1},sparse:{default:!1}},terms:{items:{init:[],manifest:"schema"},ordered:{init:[],manifest:"schema"},_exclusions:{init:[]},_inclusions:{init:[]},_requireds:{init:[]}},coerce:{from:"object",method(z,{schema:M,state:q,prefs:l}){if(!Array.isArray(z))return;const f=M.$_getRule("sort");return f?d.sort(M,z,f.args.options,q,l):void 0}},validate(z,{schema:M,error:q}){if(!Array.isArray(z)){if(M._flags.single){const l=[z];return l[s.symbols.arraySingle]=!0,{value:l}}return{errors:q("array.base")}}if(M.$_getRule("items")||M.$_terms.externals)return{value:z.slice()}},rules:{has:{method(z){z=this.$_compile(z,{appendPath:!0});const M=this.$_addRule({name:"has",args:{schema:z}});return M.$_mutateRegister(z),M},validate(z,{state:M,prefs:q,error:l},{schema:f}){const g=[z,...M.ancestors];for(let T=0;T<z.length;++T){const X=M.localize([...M.path,T],g,f);if(f.$_match(z[T],X,q))return z}const L=f._flags.label;return L?l("array.hasKnown",{patternLabel:L}):l("array.hasUnknown",null)},multi:!0},items:{method(...z){s.verifyFlat(z,"items");const M=this.$_addRule("items");for(let q=0;q<z.length;++q){const l=s.tryWithPath(()=>this.$_compile(z[q]),q,{append:!0});M.$_terms.items.push(l)}return M.$_mutateRebuild()},validate(z,{schema:M,error:q,state:l,prefs:f,errorsArray:g}){const L=M.$_terms._requireds.slice(),T=M.$_terms.ordered.slice(),X=[...M.$_terms._inclusions,...L],C=!z[s.symbols.arraySingle];delete z[s.symbols.arraySingle];const m=g();let w=z.length;for(let E=0;E<w;++E){const U=z[E];let z0=!1,a0=!1;const V=C?E:new Number(E),Z=[...l.path,V];if(!M._flags.sparse&&U===void 0){if(m.push(q("array.sparse",{key:V,path:Z,pos:E,value:void 0},l.localize(Z))),f.abortEarly)return m;T.shift();continue}const u0=[z,...l.ancestors];for(const $0 of M.$_terms._exclusions)if($0.$_match(U,l.localize(Z,u0,$0),f,{presence:"ignore"})){if(m.push(q("array.excludes",{pos:E,value:U},l.localize(Z))),f.abortEarly)return m;z0=!0,T.shift();break}if(z0)continue;if(M.$_terms.ordered.length){if(T.length){const $0=T.shift(),h1=$0.$_validate(U,l.localize(Z,u0,$0),f);if(h1.errors){if(m.push(...h1.errors),f.abortEarly)return m}else if($0._flags.result==="strip")d.fastSplice(z,E),--E,--w;else{if(!M._flags.sparse&&h1.value===void 0){if(m.push(q("array.sparse",{key:V,path:Z,pos:E,value:void 0},l.localize(Z))),f.abortEarly)return m;continue}z[E]=h1.value}continue}if(!M.$_terms.items.length){if(m.push(q("array.orderedLength",{pos:E,limit:M.$_terms.ordered.length})),f.abortEarly)return m;break}}const L0=[];let X0=L.length;for(let $0=0;$0<X0;++$0){const h1=l.localize(Z,u0,L[$0]);h1.snapshot();const d1=L[$0].$_validate(U,h1,f);if(L0[$0]=d1,!d1.errors){if(h1.commit(),z[E]=d1.value,a0=!0,d.fastSplice(L,$0),--$0,--X0,!M._flags.sparse&&d1.value===void 0&&(m.push(q("array.sparse",{key:V,path:Z,pos:E,value:void 0},l.localize(Z))),f.abortEarly))return m;break}h1.restore()}if(a0)continue;const B0=f.stripUnknown&&!!f.stripUnknown.arrays||!1;X0=X.length;for(const $0 of X){let h1;const d1=L.indexOf($0);if(d1!==-1)h1=L0[d1];else{const k1=l.localize(Z,u0,$0);if(k1.snapshot(),h1=$0.$_validate(U,k1,f),!h1.errors){k1.commit(),$0._flags.result==="strip"?(d.fastSplice(z,E),--E,--w):M._flags.sparse||h1.value!==void 0?z[E]=h1.value:(m.push(q("array.sparse",{key:V,path:Z,pos:E,value:void 0},l.localize(Z))),z0=!0),a0=!0;break}k1.restore()}if(X0===1){if(B0){d.fastSplice(z,E),--E,--w,a0=!0;break}if(m.push(...h1.errors),f.abortEarly)return m;z0=!0;break}}if(!z0&&(M.$_terms._inclusions.length||M.$_terms._requireds.length)&&!a0){if(B0){d.fastSplice(z,E),--E,--w;continue}if(m.push(q("array.includes",{pos:E,value:U},l.localize(Z))),f.abortEarly)return m}}return L.length&&d.fillMissedErrors(M,m,L,z,l,f),T.length&&(d.fillOrderedErrors(M,m,T,z,l,f),m.length||d.fillDefault(T,z,l,f)),m.length?m:z},priority:!0,manifest:!1},length:{method(z){return this.$_addRule({name:"length",args:{limit:z},operator:"="})},validate:(z,M,{limit:q},{name:l,operator:f,args:g})=>s.compare(z.length,q,f)?z:M.error("array."+l,{limit:g.limit,value:z}),args:[{name:"limit",ref:!0,assert:s.limit,message:"must be a positive integer"}]},max:{method(z){return this.$_addRule({name:"max",method:"length",args:{limit:z},operator:"<="})}},min:{method(z){return this.$_addRule({name:"min",method:"length",args:{limit:z},operator:">="})}},ordered:{method(...z){s.verifyFlat(z,"ordered");const M=this.$_addRule("items");for(let q=0;q<z.length;++q){const l=s.tryWithPath(()=>this.$_compile(z[q]),q,{append:!0});d.validateSingle(l,M),M.$_mutateRegister(l),M.$_terms.ordered.push(l)}return M.$_mutateRebuild()}},single:{method(z){const M=z===void 0||!!z;return c(!M||!this._flags._arrayItems,"Cannot specify single rule when array has array items"),this.$_setFlag("single",M)}},sort:{method(z={}){s.assertOptions(z,["by","order"]);const M={order:z.order||"ascending"};return z.by&&(M.by=u.ref(z.by,{ancestor:0}),c(!M.by.ancestor,"Cannot sort by ancestor")),this.$_addRule({name:"sort",args:{options:M}})},validate(z,{error:M,state:q,prefs:l,schema:f},{options:g}){const{value:L,errors:T}=d.sort(f,z,g,q,l);if(T)return T;for(let X=0;X<z.length;++X)if(z[X]!==L[X])return M("array.sort",{order:g.order,by:g.by?g.by.key:"value"});return z},convert:!0},sparse:{method(z){const M=z===void 0||!!z;return this._flags.sparse===M?this:(M?this.clone():this.$_addRule("items")).$_setFlag("sparse",M,{clone:!1})}},unique:{method(z,M={}){c(!z||typeof z=="function"||typeof z=="string","comparator must be a function or a string"),s.assertOptions(M,["ignoreUndefined","separator"]);const q={name:"unique",args:{options:M,comparator:z}};if(z)if(typeof z=="string"){const l=s.default(M.separator,".");q.path=l?z.split(l):[z]}else q.comparator=z;return this.$_addRule(q)},validate(z,{state:M,error:q,schema:l},{comparator:f,options:g},{comparator:L,path:T}){const X={string:Object.create(null),number:Object.create(null),undefined:Object.create(null),boolean:Object.create(null),object:new Map,function:new Map,custom:new Map},C=L||y,m=g.ignoreUndefined;for(let w=0;w<z.length;++w){const E=T?v(z[w],T):z[w],U=L?X.custom:X[typeof E];if(c(U,"Failed to find unique map container for type",typeof E),U instanceof Map){const z0=U.entries();let a0;for(;!(a0=z0.next()).done;)if(C(a0.value[0],E)){const V=M.localize([...M.path,w],[z,...M.ancestors]),Z={pos:w,value:z[w],dupePos:a0.value[1],dupeValue:z[a0.value[1]]};return T&&(Z.path=f),q("array.unique",Z,V)}U.set(E,w)}else{if((!m||E!==void 0)&&U[E]!==void 0){const z0={pos:w,value:z[w],dupePos:U[E],dupeValue:z[U[E]]};return T&&(z0.path=f),q("array.unique",z0,M.localize([...M.path,w],[z,...M.ancestors]))}U[E]=w}}return z},args:["comparator","options"],multi:!0}},cast:{set:{from:Array.isArray,to:(z,M)=>new Set(z)}},rebuild(z){z.$_terms._inclusions=[],z.$_terms._exclusions=[],z.$_terms._requireds=[];for(const M of z.$_terms.items)d.validateSingle(M,z),M._flags.presence==="required"?z.$_terms._requireds.push(M):M._flags.presence==="forbidden"?z.$_terms._exclusions.push(M):z.$_terms._inclusions.push(M);for(const M of z.$_terms.ordered)d.validateSingle(M,z)},manifest:{build:(z,M)=>(M.items&&(z=z.items(...M.items)),M.ordered&&(z=z.ordered(...M.ordered)),z)},messages:{"array.base":"{{#label}} must be an array","array.excludes":"{{#label}} contains an excluded value","array.hasKnown":"{{#label}} does not contain at least one required match for type {:#patternLabel}","array.hasUnknown":"{{#label}} does not contain at least one required match","array.includes":"{{#label}} does not match any of the allowed types","array.includesRequiredBoth":"{{#label}} does not contain {{#knownMisses}} and {{#unknownMisses}} other required value(s)","array.includesRequiredKnowns":"{{#label}} does not contain {{#knownMisses}}","array.includesRequiredUnknowns":"{{#label}} does not contain {{#unknownMisses}} required value(s)","array.length":"{{#label}} must contain {{#limit}} items","array.max":"{{#label}} must contain less than or equal to {{#limit}} items","array.min":"{{#label}} must contain at least {{#limit}} items","array.orderedLength":"{{#label}} must contain at most {{#limit}} items","array.sort":"{{#label}} must be sorted in {#order} order by {{#by}}","array.sort.mismatching":"{{#label}} cannot be sorted due to mismatching types","array.sort.unsupported":"{{#label}} cannot be sorted due to unsupported type {#type}","array.sparse":"{{#label}} must not be a sparse array item","array.unique":"{{#label}} contains a duplicate value"}}),d.fillMissedErrors=function(z,M,q,l,f,g){const L=[];let T=0;for(const X of q){const C=X._flags.label;C?L.push(C):++T}L.length?T?M.push(z.$_createError("array.includesRequiredBoth",l,{knownMisses:L,unknownMisses:T},f,g)):M.push(z.$_createError("array.includesRequiredKnowns",l,{knownMisses:L},f,g)):M.push(z.$_createError("array.includesRequiredUnknowns",l,{unknownMisses:T},f,g))},d.fillOrderedErrors=function(z,M,q,l,f,g){const L=[];for(const T of q)T._flags.presence==="required"&&L.push(T);L.length&&d.fillMissedErrors(z,M,L,l,f,g)},d.fillDefault=function(z,M,q,l){const f=[];let g=!0;for(let L=z.length-1;L>=0;--L){const T=z[L],X=[M,...q.ancestors],C=T.$_validate(void 0,q.localize(q.path,X,T),l).value;if(g){if(C===void 0)continue;g=!1}f.unshift(C)}f.length&&M.push(...f)},d.fastSplice=function(z,M){let q=M;for(;q<z.length;)z[q++]=z[q];--z.length},d.validateSingle=function(z,M){(z.type==="array"||z._flags._arrayItems)&&(c(!M._flags.single,"Cannot specify array item with single rule enabled"),M.$_setFlag("_arrayItems",!0,{clone:!1}))},d.sort=function(z,M,q,l,f){const g=q.order==="ascending"?1:-1,L=-1*g,T=g,X=(C,m)=>{let w=d.compare(C,m,L,T);if(w!==null||(q.by&&(C=q.by.resolve(C,l,f),m=q.by.resolve(m,l,f)),w=d.compare(C,m,L,T),w!==null))return w;const E=typeof C;if(E!==typeof m)throw z.$_createError("array.sort.mismatching",M,null,l,f);if(E!=="number"&&E!=="string")throw z.$_createError("array.sort.unsupported",M,{type:E},l,f);return E==="number"?(C-m)*g:C<m?L:T};try{return{value:M.slice().sort(X)}}catch(C){return{errors:C}}},d.compare=function(z,M,q,l){return z===M?0:z===void 0?1:M===void 0?-1:z===null?l:M===null?q:null}},4937:(a,O,A)=>{const{assert:c}=A(8870),y=A(8068),v=A(8160),N=A(2036),s={isBool:function(u){return typeof u=="boolean"}};a.exports=y.extend({type:"boolean",flags:{sensitive:{default:!1}},terms:{falsy:{init:null,manifest:"values"},truthy:{init:null,manifest:"values"}},coerce(u,{schema:d}){if(typeof u!="boolean"){if(typeof u=="string"){const z=d._flags.sensitive?u:u.toLowerCase();u=z==="true"||z!=="false"&&u}return typeof u!="boolean"&&(u=d.$_terms.truthy&&d.$_terms.truthy.has(u,null,null,!d._flags.sensitive)||(!d.$_terms.falsy||!d.$_terms.falsy.has(u,null,null,!d._flags.sensitive))&&u),{value:u}}},validate(u,{error:d}){if(typeof u!="boolean")return{value:u,errors:d("boolean.base")}},rules:{truthy:{method(...u){v.verifyFlat(u,"truthy");const d=this.clone();d.$_terms.truthy=d.$_terms.truthy||new N;for(let z=0;z<u.length;++z){const M=u[z];c(M!==void 0,"Cannot call truthy with undefined"),d.$_terms.truthy.add(M)}return d}},falsy:{method(...u){v.verifyFlat(u,"falsy");const d=this.clone();d.$_terms.falsy=d.$_terms.falsy||new N;for(let z=0;z<u.length;++z){const M=u[z];c(M!==void 0,"Cannot call falsy with undefined"),d.$_terms.falsy.add(M)}return d}},sensitive:{method(u=!0){return this.$_setFlag("sensitive",u)}}},cast:{number:{from:s.isBool,to:(u,d)=>u?1:0},string:{from:s.isBool,to:(u,d)=>u?"true":"false"}},manifest:{build:(u,d)=>(d.truthy&&(u=u.truthy(...d.truthy)),d.falsy&&(u=u.falsy(...d.falsy)),u)},messages:{"boolean.base":"{{#label}} must be a boolean"}})},7500:(a,O,A)=>{const{assert:c}=A(8870),y=A(8068),v=A(8160),N=A(3328),s={isDate:function(u){return u instanceof Date}};a.exports=y.extend({type:"date",coerce:{from:["number","string"],method:(u,{schema:d})=>({value:s.parse(u,d._flags.format)||u})},validate(u,{schema:d,error:z,prefs:M}){if(u instanceof Date&&!isNaN(u.getTime()))return;const q=d._flags.format;return M.convert&&q&&typeof u=="string"?{value:u,errors:z("date.format",{format:q})}:{value:u,errors:z("date.base")}},rules:{compare:{method:!1,validate(u,d,{date:z},{name:M,operator:q,args:l}){const f=z==="now"?Date.now():z.getTime();return v.compare(u.getTime(),f,q)?u:d.error("date."+M,{limit:l.date,value:u})},args:[{name:"date",ref:!0,normalize:u=>u==="now"?u:s.parse(u),assert:u=>u!==null,message:"must have a valid date format"}]},format:{method(u){return c(["iso","javascript","unix"].includes(u),"Unknown date format",u),this.$_setFlag("format",u)}},greater:{method(u){return this.$_addRule({name:"greater",method:"compare",args:{date:u},operator:">"})}},iso:{method(){return this.format("iso")}},less:{method(u){return this.$_addRule({name:"less",method:"compare",args:{date:u},operator:"<"})}},max:{method(u){return this.$_addRule({name:"max",method:"compare",args:{date:u},operator:"<="})}},min:{method(u){return this.$_addRule({name:"min",method:"compare",args:{date:u},operator:">="})}},timestamp:{method(u="javascript"){return c(["javascript","unix"].includes(u),'"type" must be one of "javascript, unix"'),this.format(u)}}},cast:{number:{from:s.isDate,to:(u,d)=>u.getTime()},string:{from:s.isDate,to:(u,{prefs:d})=>N.date(u,d)}},messages:{"date.base":"{{#label}} must be a valid date","date.format":'{{#label}} must be in {msg("date.format." + #format) || #format} format',"date.greater":"{{#label}} must be greater than {{:#limit}}","date.less":"{{#label}} must be less than {{:#limit}}","date.max":"{{#label}} must be less than or equal to {{:#limit}}","date.min":"{{#label}} must be greater than or equal to {{:#limit}}","date.format.iso":"ISO 8601 date","date.format.javascript":"timestamp or number of milliseconds","date.format.unix":"timestamp or number of seconds"}}),s.parse=function(u,d){if(u instanceof Date)return u;if(typeof u!="string"&&(isNaN(u)||!isFinite(u))||/^\s*$/.test(u))return null;if(d==="iso")return v.isIsoDate(u)?s.date(u.toString()):null;const z=u;if(typeof u=="string"&&/^[+-]?\d+(\.\d+)?$/.test(u)&&(u=parseFloat(u)),d){if(d==="javascript")return s.date(1*u);if(d==="unix")return s.date(1e3*u);if(typeof z=="string")return null}return s.date(u)},s.date=function(u){const d=new Date(u);return isNaN(d.getTime())?null:d}},390:(a,O,A)=>{const{assert:c}=A(8870),y=A(7824);a.exports=y.extend({type:"function",properties:{typeof:"function"},rules:{arity:{method(v){return c(Number.isSafeInteger(v)&&v>=0,"n must be a positive integer"),this.$_addRule({name:"arity",args:{n:v}})},validate:(v,N,{n:s})=>v.length===s?v:N.error("function.arity",{n:s})},class:{method(){return this.$_addRule("class")},validate:(v,N)=>/^\s*class\s/.test(v.toString())?v:N.error("function.class",{value:v})},minArity:{method(v){return c(Number.isSafeInteger(v)&&v>0,"n must be a strict positive integer"),this.$_addRule({name:"minArity",args:{n:v}})},validate:(v,N,{n:s})=>v.length>=s?v:N.error("function.minArity",{n:s})},maxArity:{method(v){return c(Number.isSafeInteger(v)&&v>=0,"n must be a positive integer"),this.$_addRule({name:"maxArity",args:{n:v}})},validate:(v,N,{n:s})=>v.length<=s?v:N.error("function.maxArity",{n:s})}},messages:{"function.arity":"{{#label}} must have an arity of {{#n}}","function.class":"{{#label}} must be a class","function.maxArity":"{{#label}} must have an arity lesser or equal to {{#n}}","function.minArity":"{{#label}} must have an arity greater or equal to {{#n}}"}})},7824:(a,O,A)=>{const{applyToDefaults:c,assert:y,clone:v}=A(8870),N=A(3652),s=A(8068),u=A(8160),d=A(3292),z=A(6354),M=A(6133),q=A(3328),l={renameDefaults:{alias:!1,multiple:!1,override:!1}};a.exports=s.extend({type:"_keys",properties:{typeof:"object"},flags:{unknown:{default:!1}},terms:{dependencies:{init:null},keys:{init:null,manifest:{mapped:{from:"schema",to:"key"}}},patterns:{init:null},renames:{init:null}},args:(f,g)=>f.keys(g),validate(f,{schema:g,error:L,state:T,prefs:X}){if(!f||typeof f!==g.$_property("typeof")||Array.isArray(f))return{value:f,errors:L("object.base",{type:g.$_property("typeof")})};if(!(g.$_terms.renames||g.$_terms.dependencies||g.$_terms.keys||g.$_terms.patterns||g.$_terms.externals))return;f=l.clone(f,X);const C=[];if(g.$_terms.renames&&!l.rename(g,f,T,X,C))return{value:f,errors:C};if(!g.$_terms.keys&&!g.$_terms.patterns&&!g.$_terms.dependencies)return{value:f,errors:C};const m=new Set(Object.keys(f));if(g.$_terms.keys){const w=[f,...T.ancestors];for(const E of g.$_terms.keys){const U=E.key,z0=f[U];m.delete(U);const a0=T.localize([...T.path,U],w,E),V=E.schema.$_validate(z0,a0,X);if(V.errors){if(X.abortEarly)return{value:f,errors:V.errors};V.value!==void 0&&(f[U]=V.value),C.push(...V.errors)}else E.schema._flags.result==="strip"||V.value===void 0&&z0!==void 0?delete f[U]:V.value!==void 0&&(f[U]=V.value)}}if(m.size||g._flags._hasPatternMatch){const w=l.unknown(g,f,m,C,T,X);if(w)return w}if(g.$_terms.dependencies)for(const w of g.$_terms.dependencies){if(w.key!==null&&l.isPresent(w.options)(w.key.resolve(f,T,X,null,{shadow:!1}))===!1)continue;const E=l.dependencies[w.rel](g,w,f,T,X);if(E){const U=g.$_createError(E.code,f,E.context,T,X);if(X.abortEarly)return{value:f,errors:U};C.push(U)}}return{value:f,errors:C}},rules:{and:{method(...f){return u.verifyFlat(f,"and"),l.dependency(this,"and",null,f)}},append:{method(f){return f==null||Object.keys(f).length===0?this:this.keys(f)}},assert:{method(f,g,L){q.isTemplate(f)||(f=d.ref(f)),y(L===void 0||typeof L=="string","Message must be a string"),g=this.$_compile(g,{appendPath:!0});const T=this.$_addRule({name:"assert",args:{subject:f,schema:g,message:L}});return T.$_mutateRegister(f),T.$_mutateRegister(g),T},validate(f,{error:g,prefs:L,state:T},{subject:X,schema:C,message:m}){const w=X.resolve(f,T,L),E=M.isRef(X)?X.absolute(T):[];return C.$_match(w,T.localize(E,[f,...T.ancestors],C),L)?f:g("object.assert",{subject:X,message:m})},args:["subject","schema","message"],multi:!0},instance:{method(f,g){return y(typeof f=="function","constructor must be a function"),g=g||f.name,this.$_addRule({name:"instance",args:{constructor:f,name:g}})},validate:(f,g,{constructor:L,name:T})=>f instanceof L?f:g.error("object.instance",{type:T,value:f}),args:["constructor","name"]},keys:{method(f){y(f===void 0||typeof f=="object","Object schema must be a valid object"),y(!u.isSchema(f),"Object schema cannot be a joi schema");const g=this.clone();if(f)if(Object.keys(f).length){g.$_terms.keys=g.$_terms.keys?g.$_terms.keys.filter(L=>!f.hasOwnProperty(L.key)):new l.Keys;for(const L in f)u.tryWithPath(()=>g.$_terms.keys.push({key:L,schema:this.$_compile(f[L])}),L)}else g.$_terms.keys=new l.Keys;else g.$_terms.keys=null;return g.$_mutateRebuild()}},length:{method(f){return this.$_addRule({name:"length",args:{limit:f},operator:"="})},validate:(f,g,{limit:L},{name:T,operator:X,args:C})=>u.compare(Object.keys(f).length,L,X)?f:g.error("object."+T,{limit:C.limit,value:f}),args:[{name:"limit",ref:!0,assert:u.limit,message:"must be a positive integer"}]},max:{method(f){return this.$_addRule({name:"max",method:"length",args:{limit:f},operator:"<="})}},min:{method(f){return this.$_addRule({name:"min",method:"length",args:{limit:f},operator:">="})}},nand:{method(...f){return u.verifyFlat(f,"nand"),l.dependency(this,"nand",null,f)}},or:{method(...f){return u.verifyFlat(f,"or"),l.dependency(this,"or",null,f)}},oxor:{method(...f){return l.dependency(this,"oxor",null,f)}},pattern:{method(f,g,L={}){const T=f instanceof RegExp;T||(f=this.$_compile(f,{appendPath:!0})),y(g!==void 0,"Invalid rule"),u.assertOptions(L,["fallthrough","matches"]),T&&y(!f.flags.includes("g")&&!f.flags.includes("y"),"pattern should not use global or sticky mode"),g=this.$_compile(g,{appendPath:!0});const X=this.clone();X.$_terms.patterns=X.$_terms.patterns||[];const C={[T?"regex":"schema"]:f,rule:g};return L.matches&&(C.matches=this.$_compile(L.matches),C.matches.type!=="array"&&(C.matches=C.matches.$_root.array().items(C.matches)),X.$_mutateRegister(C.matches),X.$_setFlag("_hasPatternMatch",!0,{clone:!1})),L.fallthrough&&(C.fallthrough=!0),X.$_terms.patterns.push(C),X.$_mutateRegister(g),X}},ref:{method(){return this.$_addRule("ref")},validate:(f,g)=>M.isRef(f)?f:g.error("object.refType",{value:f})},regex:{method(){return this.$_addRule("regex")},validate:(f,g)=>f instanceof RegExp?f:g.error("object.regex",{value:f})},rename:{method(f,g,L={}){y(typeof f=="string"||f instanceof RegExp,"Rename missing the from argument"),y(typeof g=="string"||g instanceof q,"Invalid rename to argument"),y(g!==f,"Cannot rename key to same name:",f),u.assertOptions(L,["alias","ignoreUndefined","override","multiple"]);const T=this.clone();T.$_terms.renames=T.$_terms.renames||[];for(const X of T.$_terms.renames)y(X.from!==f,"Cannot rename the same key multiple times");return g instanceof q&&T.$_mutateRegister(g),T.$_terms.renames.push({from:f,to:g,options:c(l.renameDefaults,L)}),T}},schema:{method(f="any"){return this.$_addRule({name:"schema",args:{type:f}})},validate:(f,g,{type:L})=>!u.isSchema(f)||L!=="any"&&f.type!==L?g.error("object.schema",{type:L}):f},unknown:{method(f){return this.$_setFlag("unknown",f!==!1)}},with:{method(f,g,L={}){return l.dependency(this,"with",f,g,L)}},without:{method(f,g,L={}){return l.dependency(this,"without",f,g,L)}},xor:{method(...f){return u.verifyFlat(f,"xor"),l.dependency(this,"xor",null,f)}}},overrides:{default(f,g){return f===void 0&&(f=u.symbols.deepDefault),this.$_parent("default",f,g)}},rebuild(f){if(f.$_terms.keys){const g=new N.Sorter;for(const L of f.$_terms.keys)u.tryWithPath(()=>g.add(L,{after:L.schema.$_rootReferences(),group:L.key}),L.key);f.$_terms.keys=new l.Keys(...g.nodes)}},manifest:{build(f,g){if(g.keys&&(f=f.keys(g.keys)),g.dependencies)for(const{rel:L,key:T=null,peers:X,options:C}of g.dependencies)f=l.dependency(f,L,T,X,C);if(g.patterns)for(const{regex:L,schema:T,rule:X,fallthrough:C,matches:m}of g.patterns)f=f.pattern(L||T,X,{fallthrough:C,matches:m});if(g.renames)for(const{from:L,to:T,options:X}of g.renames)f=f.rename(L,T,X);return f}},messages:{"object.and":"{{#label}} contains {{#presentWithLabels}} without its required peers {{#missingWithLabels}}","object.assert":'{{#label}} is invalid because {if(#subject.key, `"` + #subject.key + `" failed to ` + (#message || "pass the assertion test"), #message || "the assertion failed")}',"object.base":"{{#label}} must be of type {{#type}}","object.instance":"{{#label}} must be an instance of {{:#type}}","object.length":'{{#label}} must have {{#limit}} key{if(#limit == 1, "", "s")}',"object.max":'{{#label}} must have less than or equal to {{#limit}} key{if(#limit == 1, "", "s")}',"object.min":'{{#label}} must have at least {{#limit}} key{if(#limit == 1, "", "s")}',"object.missing":"{{#label}} must contain at least one of {{#peersWithLabels}}","object.nand":"{{:#mainWithLabel}} must not exist simultaneously with {{#peersWithLabels}}","object.oxor":"{{#label}} contains a conflict between optional exclusive peers {{#peersWithLabels}}","object.pattern.match":"{{#label}} keys failed to match pattern requirements","object.refType":"{{#label}} must be a Joi reference","object.regex":"{{#label}} must be a RegExp object","object.rename.multiple":"{{#label}} cannot rename {{:#from}} because multiple renames are disabled and another key was already renamed to {{:#to}}","object.rename.override":"{{#label}} cannot rename {{:#from}} because override is disabled and target {{:#to}} exists","object.schema":"{{#label}} must be a Joi schema of {{#type}} type","object.unknown":"{{#label}} is not allowed","object.with":"{{:#mainWithLabel}} missing required peer {{:#peerWithLabel}}","object.without":"{{:#mainWithLabel}} conflict with forbidden peer {{:#peerWithLabel}}","object.xor":"{{#label}} contains a conflict between exclusive peers {{#peersWithLabels}}"}}),l.clone=function(f,g){if(typeof f=="object"){if(g.nonEnumerables)return v(f,{shallow:!0});const T=Object.create(Object.getPrototypeOf(f));return Object.assign(T,f),T}const L=function(...T){return f.apply(this,T)};return L.prototype=v(f.prototype),Object.defineProperty(L,"name",{value:f.name,writable:!1}),Object.defineProperty(L,"length",{value:f.length,writable:!1}),Object.assign(L,f),L},l.dependency=function(f,g,L,T,X){y(L===null||typeof L=="string",g,"key must be a strings"),X||(X=T.length>1&&typeof T[T.length-1]=="object"?T.pop():{}),u.assertOptions(X,["separator","isPresent"]),T=[].concat(T);const C=u.default(X.separator,"."),m=[];for(const E of T)y(typeof E=="string",g,"peers must be strings"),m.push(d.ref(E,{separator:C,ancestor:0,prefix:!1}));L!==null&&(L=d.ref(L,{separator:C,ancestor:0,prefix:!1}));const w=f.clone();return w.$_terms.dependencies=w.$_terms.dependencies||[],w.$_terms.dependencies.push(new l.Dependency(g,L,m,T,X)),w},l.dependencies={and(f,g,L,T,X){const C=[],m=[],w=g.peers.length,E=l.isPresent(g.options);for(const U of g.peers)E(U.resolve(L,T,X,null,{shadow:!1}))===!1?C.push(U.key):m.push(U.key);if(C.length!==w&&m.length!==w)return{code:"object.and",context:{present:m,presentWithLabels:l.keysToLabels(f,m),missing:C,missingWithLabels:l.keysToLabels(f,C)}}},nand(f,g,L,T,X){const C=[],m=l.isPresent(g.options);for(const U of g.peers)m(U.resolve(L,T,X,null,{shadow:!1}))&&C.push(U.key);if(C.length!==g.peers.length)return;const w=g.paths[0],E=g.paths.slice(1);return{code:"object.nand",context:{main:w,mainWithLabel:l.keysToLabels(f,w),peers:E,peersWithLabels:l.keysToLabels(f,E)}}},or(f,g,L,T,X){const C=l.isPresent(g.options);for(const m of g.peers)if(C(m.resolve(L,T,X,null,{shadow:!1})))return;return{code:"object.missing",context:{peers:g.paths,peersWithLabels:l.keysToLabels(f,g.paths)}}},oxor(f,g,L,T,X){const C=[],m=l.isPresent(g.options);for(const E of g.peers)m(E.resolve(L,T,X,null,{shadow:!1}))&&C.push(E.key);if(!C.length||C.length===1)return;const w={peers:g.paths,peersWithLabels:l.keysToLabels(f,g.paths)};return w.present=C,w.presentWithLabels=l.keysToLabels(f,C),{code:"object.oxor",context:w}},with(f,g,L,T,X){const C=l.isPresent(g.options);for(const m of g.peers)if(C(m.resolve(L,T,X,null,{shadow:!1}))===!1)return{code:"object.with",context:{main:g.key.key,mainWithLabel:l.keysToLabels(f,g.key.key),peer:m.key,peerWithLabel:l.keysToLabels(f,m.key)}}},without(f,g,L,T,X){const C=l.isPresent(g.options);for(const m of g.peers)if(C(m.resolve(L,T,X,null,{shadow:!1})))return{code:"object.without",context:{main:g.key.key,mainWithLabel:l.keysToLabels(f,g.key.key),peer:m.key,peerWithLabel:l.keysToLabels(f,m.key)}}},xor(f,g,L,T,X){const C=[],m=l.isPresent(g.options);for(const E of g.peers)m(E.resolve(L,T,X,null,{shadow:!1}))&&C.push(E.key);if(C.length===1)return;const w={peers:g.paths,peersWithLabels:l.keysToLabels(f,g.paths)};return C.length===0?{code:"object.missing",context:w}:(w.present=C,w.presentWithLabels=l.keysToLabels(f,C),{code:"object.xor",context:w})}},l.keysToLabels=function(f,g){return Array.isArray(g)?g.map(L=>f.$_mapLabels(L)):f.$_mapLabels(g)},l.isPresent=function(f){return typeof f.isPresent=="function"?f.isPresent:g=>g!==void 0},l.rename=function(f,g,L,T,X){const C={};for(const m of f.$_terms.renames){const w=[],E=typeof m.from!="string";if(E)for(const U in g){if(g[U]===void 0&&m.options.ignoreUndefined||U===m.to)continue;const z0=m.from.exec(U);z0&&w.push({from:U,to:m.to,match:z0})}else!Object.prototype.hasOwnProperty.call(g,m.from)||g[m.from]===void 0&&m.options.ignoreUndefined||w.push(m);for(const U of w){const z0=U.from;let a0=U.to;if(a0 instanceof q&&(a0=a0.render(g,L,T,U.match)),z0!==a0){if(!m.options.multiple&&C[a0]&&(X.push(f.$_createError("object.rename.multiple",g,{from:z0,to:a0,pattern:E},L,T)),T.abortEarly)||Object.prototype.hasOwnProperty.call(g,a0)&&!m.options.override&&!C[a0]&&(X.push(f.$_createError("object.rename.override",g,{from:z0,to:a0,pattern:E},L,T)),T.abortEarly))return!1;g[z0]===void 0?delete g[a0]:g[a0]=g[z0],C[a0]=!0,m.options.alias||delete g[z0]}}}return!0},l.unknown=function(f,g,L,T,X,C){if(f.$_terms.patterns){let m=!1;const w=f.$_terms.patterns.map(U=>{if(U.matches)return m=!0,[]}),E=[g,...X.ancestors];for(const U of L){const z0=g[U],a0=[...X.path,U];for(let V=0;V<f.$_terms.patterns.length;++V){const Z=f.$_terms.patterns[V];if(Z.regex){const X0=Z.regex.test(U);if(X.mainstay.tracer.debug(X,"rule",`pattern.${V}`,X0?"pass":"error"),!X0)continue}else if(!Z.schema.$_match(U,X.nest(Z.schema,`pattern.${V}`),C))continue;L.delete(U);const u0=X.localize(a0,E,{schema:Z.rule,key:U}),L0=Z.rule.$_validate(z0,u0,C);if(L0.errors){if(C.abortEarly)return{value:g,errors:L0.errors};T.push(...L0.errors)}if(Z.matches&&w[V].push(U),g[U]=L0.value,!Z.fallthrough)break}}if(m)for(let U=0;U<w.length;++U){const z0=w[U];if(!z0)continue;const a0=f.$_terms.patterns[U].matches,V=X.localize(X.path,E,a0),Z=a0.$_validate(z0,V,C);if(Z.errors){const u0=z.details(Z.errors,{override:!1});u0.matches=z0;const L0=f.$_createError("object.pattern.match",g,u0,X,C);if(C.abortEarly)return{value:g,errors:L0};T.push(L0)}}}if(L.size&&(f.$_terms.keys||f.$_terms.patterns)){if(C.stripUnknown&&!f._flags.unknown||C.skipFunctions){const m=!(!C.stripUnknown||C.stripUnknown!==!0&&!C.stripUnknown.objects);for(const w of L)m?(delete g[w],L.delete(w)):typeof g[w]=="function"&&L.delete(w)}if(!u.default(f._flags.unknown,C.allowUnknown))for(const m of L){const w=X.localize([...X.path,m],[]),E=f.$_createError("object.unknown",g[m],{child:m},w,C,{flags:!1});if(C.abortEarly)return{value:g,errors:E};T.push(E)}}},l.Dependency=class{constructor(f,g,L,T,X){this.rel=f,this.key=g,this.peers=L,this.paths=T,this.options=X}describe(){const f={rel:this.rel,peers:this.paths};return this.key!==null&&(f.key=this.key.key),this.peers[0].separator!=="."&&(f.options={...f.options,separator:this.peers[0].separator}),this.options.isPresent&&(f.options={...f.options,isPresent:this.options.isPresent}),f}},l.Keys=class extends Array{concat(f){const g=this.slice(),L=new Map;for(let T=0;T<g.length;++T)L.set(g[T].key,T);for(const T of f){const X=T.key,C=L.get(X);C!==void 0?g[C]={key:X,schema:g[C].schema.concat(T.schema)}:g.push(T)}return g}}},8785:(a,O,A)=>{const{assert:c}=A(8870),y=A(8068),v=A(8160),N=A(3292),s=A(6354),u={};a.exports=y.extend({type:"link",properties:{schemaChain:!0},terms:{link:{init:null,manifest:"single",register:!1}},args:(d,z)=>d.ref(z),validate(d,{schema:z,state:M,prefs:q}){c(z.$_terms.link,"Uninitialized link schema");const l=u.generate(z,d,M,q),f=z.$_terms.link[0].ref;return l.$_validate(d,M.nest(l,`link:${f.display}:${l.type}`),q)},generate:(d,z,M,q)=>u.generate(d,z,M,q),rules:{ref:{method(d){c(!this.$_terms.link,"Cannot reinitialize schema"),d=N.ref(d),c(d.type==="value"||d.type==="local","Invalid reference type:",d.type),c(d.type==="local"||d.ancestor==="root"||d.ancestor>0,"Link cannot reference itself");const z=this.clone();return z.$_terms.link=[{ref:d}],z}},relative:{method(d=!0){return this.$_setFlag("relative",d)}}},overrides:{concat(d){c(this.$_terms.link,"Uninitialized link schema"),c(v.isSchema(d),"Invalid schema object"),c(d.type!=="link","Cannot merge type link with another link");const z=this.clone();return z.$_terms.whens||(z.$_terms.whens=[]),z.$_terms.whens.push({concat:d}),z.$_mutateRebuild()}},manifest:{build:(d,z)=>(c(z.link,"Invalid link description missing link"),d.ref(z.link))}}),u.generate=function(d,z,M,q){let l=M.mainstay.links.get(d);if(l)return l._generate(z,M,q).schema;const f=d.$_terms.link[0].ref,{perspective:g,path:L}=u.perspective(f,M);u.assert(g,"which is outside of schema boundaries",f,d,M,q);try{l=L.length?g.$_reach(L):g}catch{u.assert(!1,"to non-existing schema",f,d,M,q)}return u.assert(l.type!=="link","which is another link",f,d,M,q),d._flags.relative||M.mainstay.links.set(d,l),l._generate(z,M,q).schema},u.perspective=function(d,z){if(d.type==="local"){for(const{schema:M,key:q}of z.schemas){if((M._flags.id||q)===d.path[0])return{perspective:M,path:d.path.slice(1)};if(M.$_terms.shared){for(const l of M.$_terms.shared)if(l._flags.id===d.path[0])return{perspective:l,path:d.path.slice(1)}}}return{perspective:null,path:null}}return d.ancestor==="root"?{perspective:z.schemas[z.schemas.length-1].schema,path:d.path}:{perspective:z.schemas[d.ancestor]&&z.schemas[d.ancestor].schema,path:d.path}},u.assert=function(d,z,M,q,l,f){d||c(!1,`"${s.label(q._flags,l,f)}" contains link reference "${M.display}" ${z}`)}},3832:(a,O,A)=>{const{assert:c}=A(8870),y=A(8068),v=A(8160),N={numberRx:/^\s*[+-]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e([+-]?\d+))?\s*$/i,precisionRx:/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/,exponentialPartRegex:/[eE][+-]?\d+$/,leadingSignAndZerosRegex:/^[+-]?(0*)?/,dotRegex:/\./,trailingZerosRegex:/0+$/};a.exports=y.extend({type:"number",flags:{unsafe:{default:!1}},coerce:{from:"string",method(s,{schema:u,error:d}){if(!s.match(N.numberRx))return;s=s.trim();const z={value:parseFloat(s)};if(z.value===0&&(z.value=0),!u._flags.unsafe)if(s.match(/e/i)){if(N.extractSignificantDigits(s)!==N.extractSignificantDigits(String(z.value)))return z.errors=d("number.unsafe"),z}else{const M=z.value.toString();if(M.match(/e/i))return z;if(M!==N.normalizeDecimal(s))return z.errors=d("number.unsafe"),z}return z}},validate(s,{schema:u,error:d,prefs:z}){if(s===1/0||s===-1/0)return{value:s,errors:d("number.infinity")};if(!v.isNumber(s))return{value:s,errors:d("number.base")};const M={value:s};if(z.convert){const q=u.$_getRule("precision");if(q){const l=Math.pow(10,q.args.limit);M.value=Math.round(M.value*l)/l}}return M.value===0&&(M.value=0),!u._flags.unsafe&&(s>Number.MAX_SAFE_INTEGER||s<Number.MIN_SAFE_INTEGER)&&(M.errors=d("number.unsafe")),M},rules:{compare:{method:!1,validate:(s,u,{limit:d},{name:z,operator:M,args:q})=>v.compare(s,d,M)?s:u.error("number."+z,{limit:q.limit,value:s}),args:[{name:"limit",ref:!0,assert:v.isNumber,message:"must be a number"}]},greater:{method(s){return this.$_addRule({name:"greater",method:"compare",args:{limit:s},operator:">"})}},integer:{method(){return this.$_addRule("integer")},validate:(s,u)=>Math.trunc(s)-s==0?s:u.error("number.integer")},less:{method(s){return this.$_addRule({name:"less",method:"compare",args:{limit:s},operator:"<"})}},max:{method(s){return this.$_addRule({name:"max",method:"compare",args:{limit:s},operator:"<="})}},min:{method(s){return this.$_addRule({name:"min",method:"compare",args:{limit:s},operator:">="})}},multiple:{method(s){return this.$_addRule({name:"multiple",args:{base:s}})},validate:(s,u,{base:d},z)=>s*(1/d)%1==0?s:u.error("number.multiple",{multiple:z.args.base,value:s}),args:[{name:"base",ref:!0,assert:s=>typeof s=="number"&&isFinite(s)&&s>0,message:"must be a positive number"}],multi:!0},negative:{method(){return this.sign("negative")}},port:{method(){return this.$_addRule("port")},validate:(s,u)=>Number.isSafeInteger(s)&&s>=0&&s<=65535?s:u.error("number.port")},positive:{method(){return this.sign("positive")}},precision:{method(s){return c(Number.isSafeInteger(s),"limit must be an integer"),this.$_addRule({name:"precision",args:{limit:s}})},validate(s,u,{limit:d}){const z=s.toString().match(N.precisionRx);return Math.max((z[1]?z[1].length:0)-(z[2]?parseInt(z[2],10):0),0)<=d?s:u.error("number.precision",{limit:d,value:s})},convert:!0},sign:{method(s){return c(["negative","positive"].includes(s),"Invalid sign",s),this.$_addRule({name:"sign",args:{sign:s}})},validate:(s,u,{sign:d})=>d==="negative"&&s<0||d==="positive"&&s>0?s:u.error(`number.${d}`)},unsafe:{method(s=!0){return c(typeof s=="boolean","enabled must be a boolean"),this.$_setFlag("unsafe",s)}}},cast:{string:{from:s=>typeof s=="number",to:(s,u)=>s.toString()}},messages:{"number.base":"{{#label}} must be a number","number.greater":"{{#label}} must be greater than {{#limit}}","number.infinity":"{{#label}} cannot be infinity","number.integer":"{{#label}} must be an integer","number.less":"{{#label}} must be less than {{#limit}}","number.max":"{{#label}} must be less than or equal to {{#limit}}","number.min":"{{#label}} must be greater than or equal to {{#limit}}","number.multiple":"{{#label}} must be a multiple of {{#multiple}}","number.negative":"{{#label}} must be a negative number","number.port":"{{#label}} must be a valid port","number.positive":"{{#label}} must be a positive number","number.precision":"{{#label}} must have no more than {{#limit}} decimal places","number.unsafe":"{{#label}} must be a safe number"}}),N.extractSignificantDigits=function(s){return s.replace(N.exponentialPartRegex,"").replace(N.dotRegex,"").replace(N.trailingZerosRegex,"").replace(N.leadingSignAndZerosRegex,"")},N.normalizeDecimal=function(s){return(s=s.replace(/^\+/,"").replace(/\.0*$/,"").replace(/^(-?)\.([^\.]*)$/,"$10.$2").replace(/^(-?)0+([0-9])/,"$1$2")).includes(".")&&s.endsWith("0")&&(s=s.replace(/0+$/,"")),s==="-0"?"0":s}},8966:(a,O,A)=>{const c=A(7824);a.exports=c.extend({type:"object",cast:{map:{from:y=>y&&typeof y=="object",to:(y,v)=>new Map(Object.entries(y))}}})},7417:(a,O,A)=>{const{assert:c,escapeRegex:y}=A(8870),{isDomainValid:v,isEmailValid:N,ipRegex:s,uriRegex:u}=A(4958),d=A(6264),z=A(8068),M=A(8160),q={tlds:d.tlds instanceof Set&&{tlds:{allow:d.tlds,deny:null}},base64Regex:{true:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}==|[\w\-]{3}=)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/},false:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}(==)?|[\w\-]{3}=?)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}(==)?|[A-Za-z0-9+\/]{3}=?)?$/}},dataUriRegex:/^data:[\w+.-]+\/[\w+.-]+;((charset=[\w-]+|base64),)?(.*)$/,hexRegex:/^[a-f0-9]+$/i,ipRegex:s({cidr:"forbidden"}).regex,isoDurationRegex:/^P(?!$)(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?$/,guidBrackets:{"{":"}","[":"]","(":")","":""},guidVersions:{uuidv1:"1",uuidv2:"2",uuidv3:"3",uuidv4:"4",uuidv5:"5",uuidv6:"6",uuidv7:"7",uuidv8:"8"},guidSeparators:new Set([void 0,!0,!1,"-",":"]),normalizationForms:["NFC","NFD","NFKC","NFKD"]};a.exports=z.extend({type:"string",flags:{insensitive:{default:!1},truncate:{default:!1}},terms:{replacements:{init:null}},coerce:{from:"string",method(l,{schema:f,state:g,prefs:L}){const T=f.$_getRule("normalize");T&&(l=l.normalize(T.args.form));const X=f.$_getRule("case");X&&(l=X.args.direction==="upper"?l.toLocaleUpperCase():l.toLocaleLowerCase());const C=f.$_getRule("trim");if(C&&C.args.enabled&&(l=l.trim()),f.$_terms.replacements)for(const w of f.$_terms.replacements)l=l.replace(w.pattern,w.replacement);const m=f.$_getRule("hex");if(m&&m.args.options.byteAligned&&l.length%2!=0&&(l=`0${l}`),f.$_getRule("isoDate")){const w=q.isoDate(l);w&&(l=w)}if(f._flags.truncate){const w=f.$_getRule("max");if(w){let E=w.args.limit;if(M.isResolvable(E)&&(E=E.resolve(l,g,L),!M.limit(E)))return{value:l,errors:f.$_createError("any.ref",E,{ref:w.args.limit,arg:"limit",reason:"must be a positive integer"},g,L)};l=l.slice(0,E)}}return{value:l}}},validate(l,{schema:f,error:g}){if(typeof l!="string")return{value:l,errors:g("string.base")};if(l===""){const L=f.$_getRule("min");return L&&L.args.limit===0?void 0:{value:l,errors:g("string.empty")}}},rules:{alphanum:{method(){return this.$_addRule("alphanum")},validate:(l,f)=>/^[a-zA-Z0-9]+$/.test(l)?l:f.error("string.alphanum")},base64:{method(l={}){return M.assertOptions(l,["paddingRequired","urlSafe"]),l={urlSafe:!1,paddingRequired:!0,...l},c(typeof l.paddingRequired=="boolean","paddingRequired must be boolean"),c(typeof l.urlSafe=="boolean","urlSafe must be boolean"),this.$_addRule({name:"base64",args:{options:l}})},validate:(l,f,{options:g})=>q.base64Regex[g.paddingRequired][g.urlSafe].test(l)?l:f.error("string.base64")},case:{method(l){return c(["lower","upper"].includes(l),"Invalid case:",l),this.$_addRule({name:"case",args:{direction:l}})},validate:(l,f,{direction:g})=>g==="lower"&&l===l.toLocaleLowerCase()||g==="upper"&&l===l.toLocaleUpperCase()?l:f.error(`string.${g}case`),convert:!0},creditCard:{method(){return this.$_addRule("creditCard")},validate(l,f){let g=l.length,L=0,T=1;for(;g--;){const X=l.charAt(g)*T;L+=X-9*(X>9),T^=3}return L>0&&L%10==0?l:f.error("string.creditCard")}},dataUri:{method(l={}){return M.assertOptions(l,["paddingRequired"]),l={paddingRequired:!0,...l},c(typeof l.paddingRequired=="boolean","paddingRequired must be boolean"),this.$_addRule({name:"dataUri",args:{options:l}})},validate(l,f,{options:g}){const L=l.match(q.dataUriRegex);return L&&(!L[2]||L[2]!=="base64"||q.base64Regex[g.paddingRequired].false.test(L[3]))?l:f.error("string.dataUri")}},domain:{method(l){l&&M.assertOptions(l,["allowFullyQualified","allowUnicode","allowUnderscore","maxDomainSegments","minDomainSegments","tlds"]);const f=q.addressOptions(l);return this.$_addRule({name:"domain",args:{options:l},address:f})},validate:(l,f,g,{address:L})=>v(l,L)?l:f.error("string.domain")},email:{method(l={}){M.assertOptions(l,["allowFullyQualified","allowUnicode","ignoreLength","maxDomainSegments","minDomainSegments","multiple","separator","tlds"]),c(l.multiple===void 0||typeof l.multiple=="boolean","multiple option must be an boolean");const f=q.addressOptions(l),g=new RegExp(`\\s*[${l.separator?y(l.separator):","}]\\s*`);return this.$_addRule({name:"email",args:{options:l},regex:g,address:f})},validate(l,f,{options:g},{regex:L,address:T}){const X=g.multiple?l.split(L):[l],C=[];for(const m of X)N(m,T)||C.push(m);return C.length?f.error("string.email",{value:l,invalids:C}):l}},guid:{alias:"uuid",method(l={}){M.assertOptions(l,["version","separator"]);let f="";if(l.version){const T=[].concat(l.version);c(T.length>=1,"version must have at least 1 valid version specified");const X=new Set;for(let C=0;C<T.length;++C){const m=T[C];c(typeof m=="string","version at position "+C+" must be a string");const w=q.guidVersions[m.toLowerCase()];c(w,"version at position "+C+" must be one of "+Object.keys(q.guidVersions).join(", ")),c(!X.has(w),"version at position "+C+" must not be a duplicate"),f+=w,X.add(w)}}c(q.guidSeparators.has(l.separator),'separator must be one of true, false, "-", or ":"');const g=l.separator===void 0?"[:-]?":l.separator===!0?"[:-]":l.separator===!1?"[]?":`\\${l.separator}`,L=new RegExp(`^([\\[{\\(]?)[0-9A-F]{8}(${g})[0-9A-F]{4}\\2?[${f||"0-9A-F"}][0-9A-F]{3}\\2?[${f?"89AB":"0-9A-F"}][0-9A-F]{3}\\2?[0-9A-F]{12}([\\]}\\)]?)$`,"i");return this.$_addRule({name:"guid",args:{options:l},regex:L})},validate(l,f,g,{regex:L}){const T=L.exec(l);return T?q.guidBrackets[T[1]]!==T[T.length-1]?f.error("string.guid"):l:f.error("string.guid")}},hex:{method(l={}){return M.assertOptions(l,["byteAligned"]),l={byteAligned:!1,...l},c(typeof l.byteAligned=="boolean","byteAligned must be boolean"),this.$_addRule({name:"hex",args:{options:l}})},validate:(l,f,{options:g})=>q.hexRegex.test(l)?g.byteAligned&&l.length%2!=0?f.error("string.hexAlign"):l:f.error("string.hex")},hostname:{method(){return this.$_addRule("hostname")},validate:(l,f)=>v(l,{minDomainSegments:1})||q.ipRegex.test(l)?l:f.error("string.hostname")},insensitive:{method(){return this.$_setFlag("insensitive",!0)}},ip:{method(l={}){M.assertOptions(l,["cidr","version"]);const{cidr:f,versions:g,regex:L}=s(l),T=l.version?g:void 0;return this.$_addRule({name:"ip",args:{options:{cidr:f,version:T}},regex:L})},validate:(l,f,{options:g},{regex:L})=>L.test(l)?l:g.version?f.error("string.ipVersion",{value:l,cidr:g.cidr,version:g.version}):f.error("string.ip",{value:l,cidr:g.cidr})},isoDate:{method(){return this.$_addRule("isoDate")},validate:(l,{error:f})=>q.isoDate(l)?l:f("string.isoDate")},isoDuration:{method(){return this.$_addRule("isoDuration")},validate:(l,f)=>q.isoDurationRegex.test(l)?l:f.error("string.isoDuration")},length:{method(l,f){return q.length(this,"length",l,"=",f)},validate(l,f,{limit:g,encoding:L},{name:T,operator:X,args:C}){const m=!L&&l.length;return M.compare(m,g,X)?l:f.error("string."+T,{limit:C.limit,value:l,encoding:L})},args:[{name:"limit",ref:!0,assert:M.limit,message:"must be a positive integer"},"encoding"]},lowercase:{method(){return this.case("lower")}},max:{method(l,f){return q.length(this,"max",l,"<=",f)},args:["limit","encoding"]},min:{method(l,f){return q.length(this,"min",l,">=",f)},args:["limit","encoding"]},normalize:{method(l="NFC"){return c(q.normalizationForms.includes(l),"normalization form must be one of "+q.normalizationForms.join(", ")),this.$_addRule({name:"normalize",args:{form:l}})},validate:(l,{error:f},{form:g})=>l===l.normalize(g)?l:f("string.normalize",{value:l,form:g}),convert:!0},pattern:{alias:"regex",method(l,f={}){c(l instanceof RegExp,"regex must be a RegExp"),c(!l.flags.includes("g")&&!l.flags.includes("y"),"regex should not use global or sticky mode"),typeof f=="string"&&(f={name:f}),M.assertOptions(f,["invert","name"]);const g=["string.pattern",f.invert?".invert":"",f.name?".name":".base"].join("");return this.$_addRule({name:"pattern",args:{regex:l,options:f},errorCode:g})},validate:(l,f,{regex:g,options:L},{errorCode:T})=>g.test(l)^L.invert?l:f.error(T,{name:L.name,regex:g,value:l}),args:["regex","options"],multi:!0},replace:{method(l,f){typeof l=="string"&&(l=new RegExp(y(l),"g")),c(l instanceof RegExp,"pattern must be a RegExp"),c(typeof f=="string","replacement must be a String");const g=this.clone();return g.$_terms.replacements||(g.$_terms.replacements=[]),g.$_terms.replacements.push({pattern:l,replacement:f}),g}},token:{method(){return this.$_addRule("token")},validate:(l,f)=>/^\w+$/.test(l)?l:f.error("string.token")},trim:{method(l=!0){return c(typeof l=="boolean","enabled must be a boolean"),this.$_addRule({name:"trim",args:{enabled:l}})},validate:(l,f,{enabled:g})=>g&&l!==l.trim()?f.error("string.trim"):l,convert:!0},truncate:{method(l=!0){return c(typeof l=="boolean","enabled must be a boolean"),this.$_setFlag("truncate",l)}},uppercase:{method(){return this.case("upper")}},uri:{method(l={}){M.assertOptions(l,["allowRelative","allowQuerySquareBrackets","domain","relativeOnly","scheme"]),l.domain&&M.assertOptions(l.domain,["allowFullyQualified","allowUnicode","maxDomainSegments","minDomainSegments","tlds"]);const{regex:f,scheme:g}=u(l),L=l.domain?q.addressOptions(l.domain):null;return this.$_addRule({name:"uri",args:{options:l},regex:f,domain:L,scheme:g})},validate(l,f,{options:g},{regex:L,domain:T,scheme:X}){if(["http:/","https:/"].includes(l))return f.error("string.uri");const C=L.exec(l);if(C){const m=C[1]||C[2];return!T||g.allowRelative&&!m||v(m,T)?l:f.error("string.domain",{value:m})}return g.relativeOnly?f.error("string.uriRelativeOnly"):g.scheme?f.error("string.uriCustomScheme",{scheme:X,value:l}):f.error("string.uri")}}},manifest:{build(l,f){if(f.replacements)for(const{pattern:g,replacement:L}of f.replacements)l=l.replace(g,L);return l}},messages:{"string.alphanum":"{{#label}} must only contain alpha-numeric characters","string.base":"{{#label}} must be a string","string.base64":"{{#label}} must be a valid base64 string","string.creditCard":"{{#label}} must be a credit card","string.dataUri":"{{#label}} must be a valid dataUri string","string.domain":"{{#label}} must contain a valid domain name","string.email":"{{#label}} must be a valid email","string.empty":"{{#label}} is not allowed to be empty","string.guid":"{{#label}} must be a valid GUID","string.hex":"{{#label}} must only contain hexadecimal characters","string.hexAlign":"{{#label}} hex decoded representation must be byte aligned","string.hostname":"{{#label}} must be a valid hostname","string.ip":"{{#label}} must be a valid ip address with a {{#cidr}} CIDR","string.ipVersion":"{{#label}} must be a valid ip address of one of the following versions {{#version}} with a {{#cidr}} CIDR","string.isoDate":"{{#label}} must be in iso format","string.isoDuration":"{{#label}} must be a valid ISO 8601 duration","string.length":"{{#label}} length must be {{#limit}} characters long","string.lowercase":"{{#label}} must only contain lowercase characters","string.max":"{{#label}} length must be less than or equal to {{#limit}} characters long","string.min":"{{#label}} length must be at least {{#limit}} characters long","string.normalize":"{{#label}} must be unicode normalized in the {{#form}} form","string.token":"{{#label}} must only contain alpha-numeric and underscore characters","string.pattern.base":"{{#label}} with value {:[.]} fails to match the required pattern: {{#regex}}","string.pattern.name":"{{#label}} with value {:[.]} fails to match the {{#name}} pattern","string.pattern.invert.base":"{{#label}} with value {:[.]} matches the inverted pattern: {{#regex}}","string.pattern.invert.name":"{{#label}} with value {:[.]} matches the inverted {{#name}} pattern","string.trim":"{{#label}} must not have leading or trailing whitespace","string.uri":"{{#label}} must be a valid uri","string.uriCustomScheme":"{{#label}} must be a valid uri with a scheme matching the {{#scheme}} pattern","string.uriRelativeOnly":"{{#label}} must be a valid relative uri","string.uppercase":"{{#label}} must only contain uppercase characters"}}),q.addressOptions=function(l){if(!l||(c(l.minDomainSegments===void 0||Number.isSafeInteger(l.minDomainSegments)&&l.minDomainSegments>0,"minDomainSegments must be a positive integer"),c(l.maxDomainSegments===void 0||Number.isSafeInteger(l.maxDomainSegments)&&l.maxDomainSegments>0,"maxDomainSegments must be a positive integer"),l.tlds===!1))return l;if(l.tlds===!0||l.tlds===void 0)return c(q.tlds,"Built-in TLD list disabled"),Object.assign({},l,q.tlds);c(typeof l.tlds=="object","tlds must be true, false, or an object");const f=l.tlds.deny;if(f)return Array.isArray(f)&&(l=Object.assign({},l,{tlds:{deny:new Set(f)}})),c(l.tlds.deny instanceof Set,"tlds.deny must be an array, Set, or boolean"),c(!l.tlds.allow,"Cannot specify both tlds.allow and tlds.deny lists"),q.validateTlds(l.tlds.deny,"tlds.deny"),l;const g=l.tlds.allow;return g?g===!0?(c(q.tlds,"Built-in TLD list disabled"),Object.assign({},l,q.tlds)):(Array.isArray(g)&&(l=Object.assign({},l,{tlds:{allow:new Set(g)}})),c(l.tlds.allow instanceof Set,"tlds.allow must be an array, Set, or boolean"),q.validateTlds(l.tlds.allow,"tlds.allow"),l):{...l,tlds:!1}},q.validateTlds=function(l,f){for(const g of l)c(v(g,{minDomainSegments:1,maxDomainSegments:1}),`${f} must contain valid top level domain names`)},q.isoDate=function(l){if(!M.isIsoDate(l))return null;/.*T.*[+-]\d\d$/.test(l)&&(l+="00");const f=new Date(l);return isNaN(f.getTime())?null:f.toISOString()},q.length=function(l,f,g,L,T){return c(!T||!1,"Invalid encoding:",T),l.$_addRule({name:f,method:"length",args:{limit:g,encoding:T},operator:L})}},8826:(a,O,A)=>{const{assert:c}=A(8870),y=A(8068),v={};v.Map=class extends Map{slice(){return new v.Map(this)}},a.exports=y.extend({type:"symbol",terms:{map:{init:new v.Map}},coerce:{method(N,{schema:s,error:u}){const d=s.$_terms.map.get(N);return d&&(N=d),s._flags.only&&typeof N!="symbol"?{value:N,errors:u("symbol.map",{map:s.$_terms.map})}:{value:N}}},validate(N,{error:s}){if(typeof N!="symbol")return{value:N,errors:s("symbol.base")}},rules:{map:{method(N){N&&!N[Symbol.iterator]&&typeof N=="object"&&(N=Object.entries(N)),c(N&&N[Symbol.iterator],"Iterable must be an iterable or object");const s=this.clone(),u=[];for(const d of N){c(d&&d[Symbol.iterator],"Entry must be an iterable");const[z,M]=d;c(typeof z!="object"&&typeof z!="function"&&typeof z!="symbol","Key must not be of type object, function, or Symbol"),c(typeof M=="symbol","Value must be a Symbol"),s.$_terms.map.set(z,M),u.push(M)}return s.valid(...u)}}},manifest:{build:(N,s)=>(s.map&&(N=N.map(s.map)),N)},messages:{"symbol.base":"{{#label}} must be a symbol","symbol.map":"{{#label}} must be one of {{#map}}"}})},8863:(a,O,A)=>{const{assert:c,clone:y,ignore:v,reach:N}=A(8870),s=A(8160),u=A(6354),d=A(493),z={result:Symbol("result")};O.entry=function(M,q,l){let f=s.defaults;l&&(c(l.warnings===void 0,"Cannot override warnings preference in synchronous validation"),c(l.artifacts===void 0,"Cannot override artifacts preference in synchronous validation"),f=s.preferences(s.defaults,l));const g=z.entry(M,q,f);c(!g.mainstay.externals.length,"Schema with external rules must use validateAsync()");const L={value:g.value};return g.error&&(L.error=g.error),g.mainstay.warnings.length&&(L.warning=u.details(g.mainstay.warnings)),g.mainstay.debug&&(L.debug=g.mainstay.debug),g.mainstay.artifacts&&(L.artifacts=g.mainstay.artifacts),L},O.entryAsync=async function(M,q,l){let f=s.defaults;l&&(f=s.preferences(s.defaults,l));const g=z.entry(M,q,f),L=g.mainstay;if(g.error)throw L.debug&&(g.error.debug=L.debug),g.error;if(L.externals.length){let X=g.value;const C=[];for(const m of L.externals){const w=m.state.path,E=m.schema.type==="link"?L.links.get(m.schema):null;let U,z0,a0=X;const V=w.length?[X]:[],Z=w.length?N(M,w):M;if(w.length){U=w[w.length-1];let u0=X;for(const L0 of w.slice(0,-1))u0=u0[L0],V.unshift(u0);z0=V[0],a0=z0[U]}try{const u0=(X0,B0)=>(E||m.schema).$_createError(X0,a0,B0,m.state,f),L0=await m.method(a0,{schema:m.schema,linked:E,state:m.state,prefs:l,original:Z,error:u0,errorsArray:z.errorsArray,warn:(X0,B0)=>L.warnings.push((E||m.schema).$_createError(X0,a0,B0,m.state,f)),message:(X0,B0)=>(E||m.schema).$_createError("external",a0,B0,m.state,f,{messages:X0})});if(L0===void 0||L0===a0)continue;if(L0 instanceof u.Report){if(L.tracer.log(m.schema,m.state,"rule","external","error"),C.push(L0),f.abortEarly)break;continue}if(Array.isArray(L0)&&L0[s.symbols.errors]){if(L.tracer.log(m.schema,m.state,"rule","external","error"),C.push(...L0),f.abortEarly)break;continue}z0?(L.tracer.value(m.state,"rule",a0,L0,"external"),z0[U]=L0):(L.tracer.value(m.state,"rule",X,L0,"external"),X=L0)}catch(u0){throw f.errors.label&&(u0.message+=` (${m.label})`),u0}}if(g.value=X,C.length)throw g.error=u.process(C,M,f),L.debug&&(g.error.debug=L.debug),g.error}if(!f.warnings&&!f.debug&&!f.artifacts)return g.value;const T={value:g.value};return L.warnings.length&&(T.warning=u.details(L.warnings)),L.debug&&(T.debug=L.debug),L.artifacts&&(T.artifacts=L.artifacts),T},z.Mainstay=class{constructor(M,q,l){this.externals=[],this.warnings=[],this.tracer=M,this.debug=q,this.links=l,this.shadow=null,this.artifacts=null,this._snapshots=[]}snapshot(){this._snapshots.push({externals:this.externals.slice(),warnings:this.warnings.slice()})}restore(){const M=this._snapshots.pop();this.externals=M.externals,this.warnings=M.warnings}commit(){this._snapshots.pop()}},z.entry=function(M,q,l){const{tracer:f,cleanup:g}=z.tracer(q,l),L=l.debug?[]:null,T=q._ids._schemaChain?new Map:null,X=new z.Mainstay(f,L,T),C=q._ids._schemaChain?[{schema:q}]:null,m=new d([],[],{mainstay:X,schemas:C}),w=O.validate(M,q,m,l);g&&q.$_root.untrace();const E=u.process(w.errors,M,l);return{value:w.value,error:E,mainstay:X}},z.tracer=function(M,q){return M.$_root._tracer?{tracer:M.$_root._tracer._register(M)}:q.debug?(c(M.$_root.trace,"Debug mode not supported"),{tracer:M.$_root.trace()._register(M),cleanup:!0}):{tracer:z.ignore}},O.validate=function(M,q,l,f,g={}){if(q.$_terms.whens&&(q=q._generate(M,l,f).schema),q._preferences&&(f=z.prefs(q,f)),q._cache&&f.cache){const E=q._cache.get(M);if(l.mainstay.tracer.debug(l,"validate","cached",!!E),E)return E}const L=(E,U,z0)=>q.$_createError(E,M,U,z0||l,f),T={original:M,prefs:f,schema:q,state:l,error:L,errorsArray:z.errorsArray,warn:(E,U,z0)=>l.mainstay.warnings.push(L(E,U,z0)),message:(E,U)=>q.$_createError("custom",M,U,l,f,{messages:E})};l.mainstay.tracer.entry(q,l);const X=q._definition;if(X.prepare&&M!==void 0&&f.convert){const E=X.prepare(M,T);if(E){if(l.mainstay.tracer.value(l,"prepare",M,E.value),E.errors)return z.finalize(E.value,[].concat(E.errors),T);M=E.value}}if(X.coerce&&M!==void 0&&f.convert&&(!X.coerce.from||X.coerce.from.includes(typeof M))){const E=X.coerce.method(M,T);if(E){if(l.mainstay.tracer.value(l,"coerced",M,E.value),E.errors)return z.finalize(E.value,[].concat(E.errors),T);M=E.value}}const C=q._flags.empty;C&&C.$_match(z.trim(M,q),l.nest(C),s.defaults)&&(l.mainstay.tracer.value(l,"empty",M,void 0),M=void 0);const m=g.presence||q._flags.presence||(q._flags._endedSwitch?null:f.presence);if(M===void 0){if(m==="forbidden")return z.finalize(M,null,T);if(m==="required")return z.finalize(M,[q.$_createError("any.required",M,null,l,f)],T);if(m==="optional"){if(q._flags.default!==s.symbols.deepDefault)return z.finalize(M,null,T);l.mainstay.tracer.value(l,"default",M,{}),M={}}}else if(m==="forbidden")return z.finalize(M,[q.$_createError("any.unknown",M,null,l,f)],T);const w=[];if(q._valids){const E=q._valids.get(M,l,f,q._flags.insensitive);if(E)return f.convert&&(l.mainstay.tracer.value(l,"valids",M,E.value),M=E.value),l.mainstay.tracer.filter(q,l,"valid",E),z.finalize(M,null,T);if(q._flags.only){const U=q.$_createError("any.only",M,{valids:q._valids.values({display:!0})},l,f);if(f.abortEarly)return z.finalize(M,[U],T);w.push(U)}}if(q._invalids){const E=q._invalids.get(M,l,f,q._flags.insensitive);if(E){l.mainstay.tracer.filter(q,l,"invalid",E);const U=q.$_createError("any.invalid",M,{invalids:q._invalids.values({display:!0})},l,f);if(f.abortEarly)return z.finalize(M,[U],T);w.push(U)}}if(X.validate){const E=X.validate(M,T);if(E&&(l.mainstay.tracer.value(l,"base",M,E.value),M=E.value,E.errors)){if(!Array.isArray(E.errors))return w.push(E.errors),z.finalize(M,w,T);if(E.errors.length)return w.push(...E.errors),z.finalize(M,w,T)}}return q._rules.length?z.rules(M,w,T):z.finalize(M,w,T)},z.rules=function(M,q,l){const{schema:f,state:g,prefs:L}=l;for(const T of f._rules){const X=f._definition.rules[T.method];if(X.convert&&L.convert){g.mainstay.tracer.log(f,g,"rule",T.name,"full");continue}let C,m=T.args;if(T._resolve.length){m=Object.assign({},m);for(const E of T._resolve){const U=X.argsByName.get(E),z0=m[E].resolve(M,g,L),a0=U.normalize?U.normalize(z0):z0,V=s.validateArg(a0,null,U);if(V){C=f.$_createError("any.ref",z0,{arg:E,ref:m[E],reason:V},g,L);break}m[E]=a0}}C=C||X.validate(M,l,m,T);const w=z.rule(C,T);if(w.errors){if(g.mainstay.tracer.log(f,g,"rule",T.name,"error"),T.warn){g.mainstay.warnings.push(...w.errors);continue}if(L.abortEarly)return z.finalize(M,w.errors,l);q.push(...w.errors)}else g.mainstay.tracer.log(f,g,"rule",T.name,"pass"),g.mainstay.tracer.value(g,"rule",M,w.value,T.name),M=w.value}return z.finalize(M,q,l)},z.rule=function(M,q){return M instanceof u.Report?(z.error(M,q),{errors:[M],value:null}):Array.isArray(M)&&M[s.symbols.errors]?(M.forEach(l=>z.error(l,q)),{errors:M,value:null}):{errors:null,value:M}},z.error=function(M,q){return q.message&&M._setTemplate(q.message),M},z.finalize=function(M,q,l){q=q||[];const{schema:f,state:g,prefs:L}=l;if(q.length){const X=z.default("failover",void 0,q,l);X!==void 0&&(g.mainstay.tracer.value(g,"failover",M,X),M=X,q=[])}if(q.length&&f._flags.error)if(typeof f._flags.error=="function"){q=f._flags.error(q),Array.isArray(q)||(q=[q]);for(const X of q)c(X instanceof Error||X instanceof u.Report,"error() must return an Error object")}else q=[f._flags.error];if(M===void 0){const X=z.default("default",M,q,l);g.mainstay.tracer.value(g,"default",M,X),M=X}if(f._flags.cast&&M!==void 0){const X=f._definition.cast[f._flags.cast];if(X.from(M)){const C=X.to(M,l);g.mainstay.tracer.value(g,"cast",M,C,f._flags.cast),M=C}}if(f.$_terms.externals&&L.externals&&L._externals!==!1)for(const{method:X}of f.$_terms.externals)g.mainstay.externals.push({method:X,schema:f,state:g,label:u.label(f._flags,g,L)});const T={value:M,errors:q.length?q:null};return f._flags.result&&(T.value=f._flags.result==="strip"?void 0:l.original,g.mainstay.tracer.value(g,f._flags.result,M,T.value),g.shadow(M,f._flags.result)),f._cache&&L.cache!==!1&&!f._refs.length&&f._cache.set(l.original,T),M===void 0||T.errors||f._flags.artifact===void 0||(g.mainstay.artifacts=g.mainstay.artifacts||new Map,g.mainstay.artifacts.has(f._flags.artifact)||g.mainstay.artifacts.set(f._flags.artifact,[]),g.mainstay.artifacts.get(f._flags.artifact).push(g.path)),T},z.prefs=function(M,q){const l=q===s.defaults;return l&&M._preferences[s.symbols.prefs]?M._preferences[s.symbols.prefs]:(q=s.preferences(q,M._preferences),l&&(M._preferences[s.symbols.prefs]=q),q)},z.default=function(M,q,l,f){const{schema:g,state:L,prefs:T}=f,X=g._flags[M];if(T.noDefaults||X===void 0)return q;if(L.mainstay.tracer.log(g,L,"rule",M,"full"),!X)return X;if(typeof X=="function"){const C=X.length?[y(L.ancestors[0]),f]:[];try{return X(...C)}catch(m){return void l.push(g.$_createError(`any.${M}`,null,{error:m},L,T))}}return typeof X!="object"?X:X[s.symbols.literal]?X.literal:s.isResolvable(X)?X.resolve(q,L,T):y(X)},z.trim=function(M,q){if(typeof M!="string")return M;const l=q.$_getRule("trim");return l&&l.args.enabled?M.trim():M},z.ignore={active:!1,debug:v,entry:v,filter:v,log:v,resolve:v,value:v},z.errorsArray=function(){const M=[];return M[s.symbols.errors]=!0,M}},2036:(a,O,A)=>{const{assert:c,deepEqual:y}=A(8870),v=A(8160),N={};a.exports=N.Values=class{constructor(s,u){this._values=new Set(s),this._refs=new Set(u),this._lowercase=N.lowercases(s),this._override=!1}get length(){return this._values.size+this._refs.size}add(s,u){v.isResolvable(s)?this._refs.has(s)||(this._refs.add(s),u&&u.register(s)):this.has(s,null,null,!1)||(this._values.add(s),typeof s=="string"&&this._lowercase.set(s.toLowerCase(),s))}static merge(s,u,d){if(s=s||new N.Values,u){if(u._override)return u.clone();for(const z of[...u._values,...u._refs])s.add(z)}if(d)for(const z of[...d._values,...d._refs])s.remove(z);return s.length?s:null}remove(s){v.isResolvable(s)?this._refs.delete(s):(this._values.delete(s),typeof s=="string"&&this._lowercase.delete(s.toLowerCase()))}has(s,u,d,z){return!!this.get(s,u,d,z)}get(s,u,d,z){if(!this.length)return!1;if(this._values.has(s))return{value:s};if(typeof s=="string"&&s&&z){const M=this._lowercase.get(s.toLowerCase());if(M)return{value:M}}if(!this._refs.size&&typeof s!="object")return!1;if(typeof s=="object"){for(const M of this._values)if(y(M,s))return{value:M}}if(u)for(const M of this._refs){const q=M.resolve(s,u,d,null,{in:!0});if(q===void 0)continue;const l=M.in&&typeof q=="object"?Array.isArray(q)?q:Object.keys(q):[q];for(const f of l)if(typeof f==typeof s){if(z&&s&&typeof s=="string"){if(f.toLowerCase()===s.toLowerCase())return{value:f,ref:M}}else if(y(f,s))return{value:f,ref:M}}}return!1}override(){this._override=!0}values(s){if(s&&s.display){const u=[];for(const d of[...this._values,...this._refs])d!==void 0&&u.push(d);return u}return Array.from([...this._values,...this._refs])}clone(){const s=new N.Values(this._values,this._refs);return s._override=this._override,s}concat(s){c(!s._override,"Cannot concat override set of values");const u=new N.Values([...this._values,...s._values],[...this._refs,...s._refs]);return u._override=this._override,u}describe(){const s=[];this._override&&s.push({override:!0});for(const u of this._values.values())s.push(u&&typeof u=="object"?{value:u}:u);for(const u of this._refs.values())s.push(u.describe());return s}},N.Values.prototype[v.symbols.values]=!0,N.Values.prototype.slice=N.Values.prototype.clone,N.lowercases=function(s){const u=new Map;if(s)for(const d of s)typeof d=="string"&&u.set(d.toLowerCase(),d);return u}},4958:(a,O,A)=>{A.r(O),A.d(O,{analyzeDomain:()=>f,analyzeEmail:()=>m,errorCodes:()=>y,ipRegex:()=>be,isDomainValid:()=>g,isEmailValid:()=>w,uriDecode:()=>T1,uriRegex:()=>k1,validateDomainOptions:()=>L});var c=A(1275);const y={EMPTY_STRING:"Address must be a non-empty string",FORBIDDEN_UNICODE:"Address contains forbidden Unicode characters",MULTIPLE_AT_CHAR:"Address cannot contain more than one @ character",MISSING_AT_CHAR:"Address must contain one @ character",EMPTY_LOCAL:"Address local part cannot be empty",ADDRESS_TOO_LONG:"Address too long",LOCAL_TOO_LONG:"Address local part too long",EMPTY_LOCAL_SEGMENT:"Address local part contains empty dot-separated segment",INVALID_LOCAL_CHARS:"Address local part contains invalid character",DOMAIN_NON_EMPTY_STRING:"Domain must be a non-empty string",DOMAIN_TOO_LONG:"Domain too long",DOMAIN_INVALID_UNICODE_CHARS:"Domain contains forbidden Unicode characters",DOMAIN_INVALID_CHARS:"Domain contains invalid character",DOMAIN_INVALID_TLDS_CHARS:"Domain contains invalid tld character",DOMAIN_SEGMENTS_COUNT:"Domain lacks the minimum required number of segments",DOMAIN_SEGMENTS_COUNT_MAX:"Domain contains too many segments",DOMAIN_FORBIDDEN_TLDS:"Domain uses forbidden TLD",DOMAIN_EMPTY_SEGMENT:"Domain contains empty dot-separated segment",DOMAIN_LONG_SEGMENT:"Domain contains dot-separated segment that is too long"};function v(M0){return{code:M0,error:y[M0]}}const N=2,s=/[^\x00-\x7f]/,u=/[\x00-\x20@\:\/\\#!\$&\'\(\)\*\+,;=\?]/,d=/^[a-zA-Z](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,z=/^[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,M=/^[a-zA-Z0-9_](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,q=c.URL||URL;function l(M0){return!!M0.allow}function f(M0,_0={}){if(!M0)return v("DOMAIN_NON_EMPTY_STRING");if(typeof M0!="string")throw new Error("Invalid input: domain must be a string");if(M0.length>256)return v("DOMAIN_TOO_LONG");if(s.test(M0)){if(_0.allowUnicode===!1)return v("DOMAIN_INVALID_UNICODE_CHARS");M0=M0.normalize("NFC")}if(u.test(M0))return v("DOMAIN_INVALID_CHARS");M0=function(t0){t0.includes("%")&&(t0=t0.replace(/%/g,"%25"));try{return new q(`http://${t0}`).host}catch{return t0}}(M0),_0.allowFullyQualified&&M0[M0.length-1]==="."&&(M0=M0.slice(0,-1));const e1=_0.minDomainSegments||N,j=M0.split(".");if(j.length<e1)return v("DOMAIN_SEGMENTS_COUNT");if(_0.maxDomainSegments&&j.length>_0.maxDomainSegments)return v("DOMAIN_SEGMENTS_COUNT_MAX");const e0=_0.tlds;if(e0){const t0=j[j.length-1].toLowerCase();if(l(e0)){if(!e0.allow.has(t0))return v("DOMAIN_FORBIDDEN_TLDS")}else if(e0.deny.has(t0))return v("DOMAIN_FORBIDDEN_TLDS")}for(let t0=0;t0<j.length;++t0){const c0=j[t0];if(!c0.length)return v("DOMAIN_EMPTY_SEGMENT");if(c0.length>63)return v("DOMAIN_LONG_SEGMENT");if(t0<j.length-1){if(_0.allowUnderscore){if(!M.test(c0))return v("DOMAIN_INVALID_CHARS")}else if(!z.test(c0))return v("DOMAIN_INVALID_CHARS")}else if(!d.test(c0))return v("DOMAIN_INVALID_TLDS_CHARS")}return null}function g(M0,_0){return!f(M0,_0)}function L(M0){if(M0){if(typeof M0.tlds!="object")throw new Error("Invalid options: tlds must be a boolean or an object");if(l(M0.tlds)){if(M0.tlds.allow instanceof Set==0)throw new Error("Invalid options: tlds.allow must be a Set object or true");if(M0.tlds.deny)throw new Error("Invalid options: cannot specify both tlds.allow and tlds.deny lists")}else if(M0.tlds.deny instanceof Set==0)throw new Error("Invalid options: tlds.deny must be a Set object")}}var T=A(3975);const X=/[^\x00-\x7f]/,C=new(T.TextEncoder||TextEncoder);function m(M0,_0){return E(M0,_0)}function w(M0,_0){return!E(M0,_0)}function E(M0,_0={}){if(typeof M0!="string")throw new Error("Invalid input: email must be a string");if(!M0)return v("EMPTY_STRING");const e1=!X.test(M0);if(!e1){if(_0.allowUnicode===!1)return v("FORBIDDEN_UNICODE");M0=M0.normalize("NFC")}const j=M0.split("@");if(j.length!==2)return j.length>2?v("MULTIPLE_AT_CHAR"):v("MISSING_AT_CHAR");const[e0,t0]=j;if(!e0)return v("EMPTY_LOCAL");if(!_0.ignoreLength){if(M0.length>254)return v("ADDRESS_TOO_LONG");if(C.encode(e0).length>64)return v("LOCAL_TOO_LONG")}return function(c0,R0){const x0=c0.split(".");for(const T0 of x0){if(!T0.length)return v("EMPTY_LOCAL_SEGMENT");if(R0){if(!z0.test(T0))return v("INVALID_LOCAL_CHARS")}else for(const F0 of T0){if(z0.test(F0))continue;const K0=U(F0);if(!a0.test(K0))return v("INVALID_LOCAL_CHARS")}}return null}(e0,e1)||f(t0,_0)}function U(M0){return Array.from(C.encode(M0),_0=>String.fromCharCode(_0)).join("")}const z0=/^[\w!#\$%&'\*\+\-/=\?\^`\{\|\}~]+$/,a0=new RegExp(["(?:[\\xc2-\\xdf][\\x80-\\xbf])","(?:\\xe0[\\xa0-\\xbf][\\x80-\\xbf])|(?:[\\xe1-\\xec][\\x80-\\xbf]{2})|(?:\\xed[\\x80-\\x9f][\\x80-\\xbf])|(?:[\\xee-\\xef][\\x80-\\xbf]{2})","(?:\\xf0[\\x90-\\xbf][\\x80-\\xbf]{2})|(?:[\\xf1-\\xf3][\\x80-\\xbf]{3})|(?:\\xf4[\\x80-\\x8f][\\x80-\\xbf]{2})"].join("|"));var V=A(375),Z=A.n(V),u0=A(6064),L0=A.n(u0);const X0=function(){const M0={},_0="\\dA-Fa-f",e1="["+_0+"]",j="\\w-\\.~",e0="!\\$&'\\(\\)\\*\\+,;=",t0="%"+_0,c0=j+t0+e0+":@",R0="["+c0+"]",x0="(?:0{0,2}\\d|0?[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";M0.ipv4address="(?:"+x0+"\\.){3}"+x0;const T0=e1+"{1,4}",F0="(?:"+T0+":"+T0+"|"+M0.ipv4address+")",K0="(?:"+T0+":){6}"+F0,Kt="::(?:"+T0+":){5}"+F0,D2="(?:"+T0+")?::(?:"+T0+":){4}"+F0,Tr="(?:(?:"+T0+":){0,1}"+T0+")?::(?:"+T0+":){3}"+F0,l2="(?:(?:"+T0+":){0,2}"+T0+")?::(?:"+T0+":){2}"+F0,Br="(?:(?:"+T0+":){0,3}"+T0+")?::"+T0+":"+F0,A2="(?:(?:"+T0+":){0,4}"+T0+")?::"+F0,Qt="(?:(?:"+T0+":){0,5}"+T0+")?::"+T0,mo="(?:(?:"+T0+":){0,6}"+T0+")?::";M0.ipv4Cidr="(?:\\d|[1-2]\\d|3[0-2])",M0.ipv6Cidr="(?:0{0,2}\\d|0?[1-9]\\d|1[01]\\d|12[0-8])",M0.ipv6address="(?:"+K0+"|"+Kt+"|"+D2+"|"+Tr+"|"+l2+"|"+Br+"|"+A2+"|"+Qt+"|"+mo+")",M0.ipvFuture="v"+e1+"+\\.["+j+e0+":]+",M0.scheme="[a-zA-Z][a-zA-Z\\d+-\\.]*",M0.schemeRegex=new RegExp(M0.scheme);const I2="["+j+t0+e0+":]*",er="["+j+t0+e0+"]{1,255}",go="(?:\\[(?:"+M0.ipv6address+"|"+M0.ipvFuture+")\\]|"+M0.ipv4address+"|"+er+")",P2="(?:"+I2+"@)?"+go+"(?::\\d*)?",F2="(?:"+I2+"@)?("+go+")(?::\\d*)?",yo=R0+"*",Ro=R0+"+",Ve="(?:\\/"+yo+")*",k2="\\/(?:"+Ro+Ve+")?",Sr=Ro+Ve,wr="["+j+t0+e0+"@]+"+Ve,xr="(?:\\/\\/\\/"+yo+Ve+")";return M0.hierPart="(?:(?:\\/\\/"+P2+Ve+")|"+k2+"|"+Sr+"|"+xr+")",M0.hierPartCapture="(?:(?:\\/\\/"+F2+Ve+")|"+k2+"|"+Sr+")",M0.relativeRef="(?:(?:\\/\\/"+P2+Ve+")|"+k2+"|"+wr+"|)",M0.relativeRefCapture="(?:(?:\\/\\/"+F2+Ve+")|"+k2+"|"+wr+"|)",M0.query="["+c0+"\\/\\?]*(?=#|$)",M0.queryWithSquareBrackets="["+c0+"\\[\\]\\/\\?]*(?=#|$)",M0.fragment="["+c0+"\\/\\?]*",M0}(),B0={v4Cidr:X0.ipv4Cidr,v6Cidr:X0.ipv6Cidr,ipv4:X0.ipv4address,ipv6:X0.ipv6address,ipvfuture:X0.ipvFuture};function $0(M0){const _0=X0,e1="(?:\\?"+(M0.allowQuerySquareBrackets?_0.queryWithSquareBrackets:_0.query)+")?(?:#"+_0.fragment+")?",j=M0.domain?_0.relativeRefCapture:_0.relativeRef;if(M0.relativeOnly)return h1(j+e1);let e0="";if(M0.scheme){Z()(M0.scheme instanceof RegExp||typeof M0.scheme=="string"||Array.isArray(M0.scheme),"scheme must be a RegExp, String, or Array");const c0=[].concat(M0.scheme);Z()(c0.length>=1,"scheme must have at least 1 scheme specified");const R0=[];for(let x0=0;x0<c0.length;++x0){const T0=c0[x0];Z()(T0 instanceof RegExp||typeof T0=="string","scheme at position "+x0+" must be a RegExp or String"),T0 instanceof RegExp?R0.push(T0.source.toString()):(Z()(_0.schemeRegex.test(T0),"scheme at position "+x0+" must be a valid scheme"),R0.push(L0()(T0)))}e0=R0.join("|")}const t0="(?:"+(e0?"(?:"+e0+")":_0.scheme)+":"+(M0.domain?_0.hierPartCapture:_0.hierPart)+")";return h1((M0.allowRelative?"(?:"+t0+"|"+j+")":t0)+e1,e0)}function h1(M0,_0=null){return{raw:M0=`(?=.)(?!https?:/(?:$|[^/]))(?!https?:///)(?!https?:[^/])${M0}`,regex:new RegExp(`^${M0}$`),scheme:_0}}const d1=$0({});function k1(M0={}){return M0.scheme||M0.allowRelative||M0.relativeOnly||M0.allowQuerySquareBrackets||M0.domain?$0(M0):d1}function be(M0={}){const _0=M0.cidr||"optional";Z()(["required","optional","forbidden"].includes(_0),"options.cidr must be one of required, optional, forbidden"),Z()(M0.version===void 0||typeof M0.version=="string"||Array.isArray(M0.version),"options.version must be a string or an array of string");let e1=M0.version||["ipv4","ipv6","ipvfuture"];Array.isArray(e1)||(e1=[e1]),Z()(e1.length>=1,"options.version must have at least 1 version specified");for(const t0 of e1)Z()(typeof t0=="string"&&t0===t0.toLowerCase(),"Invalid options.version value"),Z()(["ipv4","ipv6","ipvfuture"].includes(t0),"options.version contains unknown version "+t0+" - must be one of ipv4, ipv6, ipvfuture");e1=Array.from(new Set(e1));const j=`(?:${e1.map(t0=>{if(_0==="forbidden")return B0[t0];const c0=`\\/${t0==="ipv4"?B0.v4Cidr:B0.v6Cidr}`;return _0==="required"?`${B0[t0]}${c0}`:`${B0[t0]}(?:${c0})?`}).join("|")})`,e0=new RegExp(`^${j}$`);return{cidr:_0,versions:e1,regex:e0,raw:j}}const pe={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15},J0={accept:12,reject:0,data:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,7,7,7,7,7,7,7,7,7,7,7,7,8,7,7,10,9,9,9,11,4,4,4,4,4,4,4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,24,36,48,60,72,84,96,0,12,12,12,0,0,0,0,0,0,0,0,0,0,0,24,0,0,0,0,0,0,0,0,0,24,24,24,0,0,0,0,0,0,0,0,0,24,24,0,0,0,0,0,0,0,0,0,0,48,48,48,0,0,0,0,0,0,0,0,0,0,48,48,0,0,0,0,0,0,0,0,0,48,0,0,0,0,0,0,0,0,0,0,127,63,63,63,0,31,15,15,15,7,7,7]};function T1(M0){let _0=M0.indexOf("%");if(_0===-1)return M0;let e1="",j=0,e0=0,t0=_0,c0=J0.accept;for(;_0>-1&&_0<M0.length;){const R0=nt(M0[_0+1],4)|nt(M0[_0+2],0),x0=J0.data[R0];if(c0=J0.data[256+c0+x0],e0=e0<<6|R0&J0.data[364+x0],c0!==J0.accept){if(c0===J0.reject||(_0+=3,_0>=M0.length||M0[_0]!=="%"))return null}else e1+=M0.slice(j,t0),e1+=e0<=65535?String.fromCharCode(e0):String.fromCharCode(55232+(e0>>10),56320+(1023&e0)),e0=0,j=_0+3,_0=M0.indexOf("%",j),t0=_0}return e1+M0.slice(j)}function nt(M0,_0){const e1=pe[M0];return e1===void 0?255:e1<<_0}},4964:(a,O)=>{const A={operators:["!","^","*","/","%","+","-","<","<=",">",">=","==","!=","&&","||","??"],operatorCharacters:["!","^","*","/","%","+","-","<","=",">","&","|","?"],operatorsOrder:[["^"],["*","/","%"],["+","-"],["<","<=",">",">="],["==","!="],["&&"],["||","??"]],operatorsPrefix:["!","n"],literals:{'"':'"',"`":"`","'":"'","[":"]"},numberRx:/^(?:[0-9]*(\.[0-9]*)?){1}$/,tokenRx:/^[\w\$\#\.\@\:\{\}]+$/,symbol:Symbol("formula"),settings:Symbol("settings")};O.Parser=class{constructor(c,y={}){if(!y[A.settings]&&y.constants)for(const v in y.constants){const N=y.constants[v];if(N!==null&&!["boolean","number","string"].includes(typeof N))throw new Error(`Formula constant ${v} contains invalid ${typeof N} value type`)}this.settings=y[A.settings]?y:Object.assign({[A.settings]:!0,constants:{},functions:{}},y),this.single=null,this._parts=null,this._parse(c)}_parse(c){let y=[],v="",N=0,s=!1;const u=z=>{if(N)throw new Error("Formula missing closing parenthesis");const M=y.length?y[y.length-1]:null;if(s||v||z){if(M&&M.type==="reference"&&z===")")return M.type="function",M.value=this._subFormula(v,M.value),void(v="");if(z===")"){const q=new O.Parser(v,this.settings);y.push({type:"segment",value:q})}else if(s){if(s==="]")return y.push({type:"reference",value:v}),void(v="");y.push({type:"literal",value:v})}else if(A.operatorCharacters.includes(v))M&&M.type==="operator"&&A.operators.includes(M.value+v)?M.value+=v:y.push({type:"operator",value:v});else if(v.match(A.numberRx))y.push({type:"constant",value:parseFloat(v)});else if(this.settings.constants[v]!==void 0)y.push({type:"constant",value:this.settings.constants[v]});else{if(!v.match(A.tokenRx))throw new Error(`Formula contains invalid token: ${v}`);y.push({type:"reference",value:v})}v=""}};for(const z of c)s?z===s?(u(),s=!1):v+=z:N?z==="("?(v+=z,++N):z===")"?(--N,N?v+=z:u(z)):v+=z:z in A.literals?s=A.literals[z]:z==="("?(u(),++N):A.operatorCharacters.includes(z)?(u(),v=z,u()):z!==" "?v+=z:u();u(),y=y.map((z,M)=>z.type!=="operator"||z.value!=="-"||M&&y[M-1].type!=="operator"?z:{type:"operator",value:"n"});let d=!1;for(const z of y){if(z.type==="operator"){if(A.operatorsPrefix.includes(z.value))continue;if(!d)throw new Error("Formula contains an operator in invalid position");if(!A.operators.includes(z.value))throw new Error(`Formula contains an unknown operator ${z.value}`)}else if(d)throw new Error("Formula missing expected operator");d=!d}if(!d)throw new Error("Formula contains invalid trailing operator");y.length===1&&["reference","literal","constant"].includes(y[0].type)&&(this.single={type:y[0].type==="reference"?"reference":"value",value:y[0].value}),this._parts=y.map(z=>{if(z.type==="operator")return A.operatorsPrefix.includes(z.value)?z:z.value;if(z.type!=="reference")return z.value;if(this.settings.tokenRx&&!this.settings.tokenRx.test(z.value))throw new Error(`Formula contains invalid reference ${z.value}`);return this.settings.reference?this.settings.reference(z.value):A.reference(z.value)})}_subFormula(c,y){const v=this.settings.functions[y];if(typeof v!="function")throw new Error(`Formula contains unknown function ${y}`);let N=[];if(c){let s="",u=0,d=!1;const z=()=>{if(!s)throw new Error(`Formula contains function ${y} with invalid arguments ${c}`);N.push(s),s=""};for(let M=0;M<c.length;++M){const q=c[M];d?(s+=q,q===d&&(d=!1)):q in A.literals&&!u?(s+=q,d=A.literals[q]):q!==","||u?(s+=q,q==="("?++u:q===")"&&--u):z()}z()}return N=N.map(s=>new O.Parser(s,this.settings)),function(s){const u=[];for(const d of N)u.push(d.evaluate(s));return v.call(s,...u)}}evaluate(c){const y=this._parts.slice();for(let v=y.length-2;v>=0;--v){const N=y[v];if(N&&N.type==="operator"){const s=y[v+1];y.splice(v+1,1);const u=A.evaluate(s,c);y[v]=A.single(N.value,u)}}return A.operatorsOrder.forEach(v=>{for(let N=1;N<y.length-1;)if(v.includes(y[N])){const s=y[N],u=A.evaluate(y[N-1],c),d=A.evaluate(y[N+1],c);y.splice(N,2);const z=A.calculate(s,u,d);y[N-1]=z===0?0:z}else N+=2}),A.evaluate(y[0],c)}},O.Parser.prototype[A.symbol]=!0,A.reference=function(c){return function(y){return y&&y[c]!==void 0?y[c]:null}},A.evaluate=function(c,y){return c===null?null:typeof c=="function"?c(y):c[A.symbol]?c.evaluate(y):c},A.single=function(c,y){if(c==="!")return!y;const v=-y;return v===0?0:v},A.calculate=function(c,y,v){if(c==="??")return A.exists(y)?y:v;if(typeof y=="string"||typeof v=="string"){if(c==="+")return(y=A.exists(y)?y:"")+(A.exists(v)?v:"")}else switch(c){case"^":return Math.pow(y,v);case"*":return y*v;case"/":return y/v;case"%":return y%v;case"+":return y+v;case"-":return y-v}switch(c){case"<":return y<v;case"<=":return y<=v;case">":return y>v;case">=":return y>=v;case"==":return y===v;case"!=":return y!==v;case"&&":return y&&v;case"||":return y||v}return null},A.exists=function(c){return c!=null}},978:(a,O,A)=>{const c=A(375),y=A(8571),v=A(1687),N=A(9621),s={};a.exports=function(u,d,z={}){if(c(u&&typeof u=="object","Invalid defaults value: must be an object"),c(!d||d===!0||typeof d=="object","Invalid source value: must be true, falsy or an object"),c(typeof z=="object","Invalid options: must be an object"),!d)return null;if(z.shallow)return s.applyToDefaultsWithShallow(u,d,z);const M=y(u);if(d===!0)return M;const q=z.nullOverride!==void 0&&z.nullOverride;return v(M,d,{nullOverride:q,mergeArrays:!1})},s.applyToDefaultsWithShallow=function(u,d,z){const M=z.shallow;c(Array.isArray(M),"Invalid keys");const q=new Map,l=d===!0?null:new Set;for(let L of M){L=Array.isArray(L)?L:L.split(".");const T=N(u,L);T&&typeof T=="object"?q.set(T,l&&N(d,L)||T):l&&l.add(L)}const f=y(u,{},q);if(!l)return f;for(const L of l)s.reachCopy(f,d,L);const g=z.nullOverride!==void 0&&z.nullOverride;return v(f,d,{nullOverride:g,mergeArrays:!1})},s.reachCopy=function(u,d,z){for(const l of z){if(!(l in d))return;const f=d[l];if(typeof f!="object"||f===null)return;d=f}const M=d;let q=u;for(let l=0;l<z.length-1;++l){const f=z[l];typeof q[f]!="object"&&(q[f]={}),q=q[f]}q[z[z.length-1]]=M}},375:(a,O,A)=>{const c=A(4213),y=A(8761),v=a.exports=function(N,...s){if(N)return;if(s.length===1&&s[0]instanceof Error)throw s[0];const u=s.filter(d=>d!=="").map(d=>typeof d=="string"?d:d instanceof Error?d.message:y(d));throw new c(u.join(" "),v)}},4213:a=>{a.exports=class extends Error{constructor(O,A){var c,y,v,N;super(O||"Unknown error"),c=this,v="AssertError",(y=typeof(N=function(s,u){if(typeof s!="object"||!s)return s;var d=s[Symbol.toPrimitive];if(d!==void 0){var z=d.call(s,"string");if(typeof z!="object")return z;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(s)}(y="name"))=="symbol"?N:String(N))in c?Object.defineProperty(c,y,{value:v,enumerable:!0,configurable:!0,writable:!0}):c[y]=v,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,A)}}},9367:a=>{const O={};a.exports=O.Bench=class{constructor(){this.ts=0,this.reset()}reset(){this.ts=O.Bench.now()}elapsed(){return O.Bench.now()-this.ts}static now(){const A=process.hrtime();return 1e3*A[0]+A[1]/1e6}}},8630:(a,O,A)=>{const c=A(738);a.exports=function(){return new Promise(c)}},8571:(a,O,A)=>{const c=A(9621),y=A(4277),v=A(7043),N={needsProtoHack:new Set([y.set,y.map,y.weakSet,y.weakMap])};a.exports=N.clone=function(s,u={},d=null){if(typeof s!="object"||s===null)return s;let z=N.clone,M=d;if(u.shallow){if(u.shallow!==!0)return N.cloneWithShallow(s,u);z=g=>g}else if(M){const g=M.get(s);if(g)return g}else M=new Map;const q=y.getInternalProto(s);switch(q){case y.buffer:return(!1).from(s);case y.date:return new Date(s.getTime());case y.regex:case y.url:return new q.constructor(s)}const l=N.base(s,q,u);if(l===s)return s;if(M&&M.set(s,l),q===y.set)for(const g of s)l.add(z(g,u,M));else if(q===y.map)for(const[g,L]of s)l.set(g,z(L,u,M));const f=v.keys(s,u);for(const g of f){if(g==="__proto__")continue;if(q===y.array&&g==="length"){l.length=s.length;continue}const L=Object.getOwnPropertyDescriptor(s,g);L?L.get||L.set?Object.defineProperty(l,g,L):L.enumerable?l[g]=z(s[g],u,M):Object.defineProperty(l,g,{enumerable:!1,writable:!0,configurable:!0,value:z(s[g],u,M)}):Object.defineProperty(l,g,{enumerable:!0,writable:!0,configurable:!0,value:z(s[g],u,M)})}return l},N.cloneWithShallow=function(s,u){const d=u.shallow;(u=Object.assign({},u)).shallow=!1;const z=new Map;for(const M of d){const q=c(s,M);typeof q!="object"&&typeof q!="function"||z.set(q,q)}return N.clone(s,u,z)},N.base=function(s,u,d){if(d.prototype===!1)return N.needsProtoHack.has(u)?new u.constructor:u===y.array?[]:{};const z=Object.getPrototypeOf(s);if(z&&z.isImmutable)return s;if(u===y.array){const M=[];return z!==u&&Object.setPrototypeOf(M,z),M}if(N.needsProtoHack.has(u)){const M=new z.constructor;return z!==u&&Object.setPrototypeOf(M,z),M}return Object.create(z)}},1467:(a,O,A)=>{const c=A(375),y=A(9474),v=A(6064),N=A(7043),s={};a.exports=function(u,d,z={}){return typeof d!="object"&&(d=[d]),c(!Array.isArray(d)||d.length,"Values array cannot be empty"),typeof u=="string"?s.string(u,d,z):Array.isArray(u)?s.array(u,d,z):(c(typeof u=="object","Reference must be string or an object"),s.object(u,d,z))},s.array=function(u,d,z){if(Array.isArray(d)||(d=[d]),!u.length||z.only&&z.once&&u.length!==d.length)return!1;let M;const q=new Map;for(const L of d)if(z.deep&&L&&typeof L=="object"){var l;M=(l=M)!==null&&l!==void 0?l:s.compare(z);let T=!1;for(const[X,C]of q.entries())if(M(X,L)){++C.allowed,T=!0;break}T||q.set(L,{allowed:1,hits:0})}else{const T=q.get(L);T?++T.allowed:q.set(L,{allowed:1,hits:0})}let f=0;for(const L of u){let T;if(z.deep&&L&&typeof L=="object"){var g;M=(g=M)!==null&&g!==void 0?g:s.compare(z);for(const[X,C]of q.entries())if(M(X,L)){T=C;break}}else T=q.get(L);if(T&&(++T.hits,++f,z.once&&T.hits>T.allowed))return!1}if(z.only&&f!==u.length)return!1;for(const L of q.values())if(L.hits!==L.allowed&&L.hits<L.allowed&&!z.part)return!1;return!!f},s.object=function(u,d,z){c(z.once===void 0,"Cannot use option once with object");const M=N.keys(u,z);if(!M.length)return!1;if(Array.isArray(d))return s.array(M,d,z);const q=Object.getOwnPropertySymbols(d).filter(L=>d.propertyIsEnumerable(L)),l=[...Object.keys(d),...q],f=s.compare(z),g=new Set(l);for(const L of M)if(g.has(L)){if(!f(d[L],u[L]))return!1;g.delete(L)}else if(z.only)return!1;return!g.size||!!z.part&&g.size<l.length},s.string=function(u,d,z){if(u==="")return d.length===1&&d[0]===""||!z.once&&!d.some(L=>L!=="");const M=new Map,q=[];for(const L of d)if(c(typeof L=="string","Cannot compare string reference to non-string value"),L){const T=M.get(L);T?++T.allowed:(M.set(L,{allowed:1,hits:0}),q.push(v(L)))}else if(z.once||z.only)return!1;if(!q.length)return!0;const l=new RegExp(`(${q.join("|")})`,"g"),f=u.replace(l,(L,T)=>(++M.get(T).hits,""));if(z.only&&f)return!1;let g=!1;for(const L of M.values())if(L.hits&&(g=!0),L.hits!==L.allowed&&(L.hits<L.allowed&&!z.part||z.once))return!1;return!!g},s.compare=function(u){if(!u.deep)return s.shallow;const d=u.only!==void 0,z=u.part!==void 0,M={prototype:d?u.only:!!z&&!u.part,part:d?!u.only:!!z&&u.part};return(q,l)=>y(q,l,M)},s.shallow=function(u,d){return u===d}},9474:(a,O,A)=>{const c=A(4277),y={mismatched:null};a.exports=function(v,N,s){return s=Object.assign({prototype:!0},s),!!y.isDeepEqual(v,N,s,[])},y.isDeepEqual=function(v,N,s,u){if(v===N)return v!==0||1/v==1/N;const d=typeof v;if(d!==typeof N||v===null||N===null)return!1;if(d==="function"){if(!s.deepFunction||v.toString()!==N.toString())return!1}else if(d!=="object")return v!=v&&N!=N;const z=y.getSharedType(v,N,!!s.prototype);switch(z){case c.buffer:return!1;case c.promise:return v===N;case c.regex:case c.url:return v.toString()===N.toString();case y.mismatched:return!1}for(let M=u.length-1;M>=0;--M)if(u[M].isSame(v,N))return!0;u.push(new y.SeenEntry(v,N));try{return!!y.isDeepEqualObj(z,v,N,s,u)}finally{u.pop()}},y.getSharedType=function(v,N,s){if(s)return Object.getPrototypeOf(v)!==Object.getPrototypeOf(N)?y.mismatched:c.getInternalProto(v);const u=c.getInternalProto(v);return u!==c.getInternalProto(N)?y.mismatched:u},y.valueOf=function(v){const N=v.valueOf;if(N===void 0)return v;try{return N.call(v)}catch(s){return s}},y.hasOwnEnumerableProperty=function(v,N){return Object.prototype.propertyIsEnumerable.call(v,N)},y.isSetSimpleEqual=function(v,N){for(const s of Set.prototype.values.call(v))if(!Set.prototype.has.call(N,s))return!1;return!0},y.isDeepEqualObj=function(v,N,s,u,d){const{isDeepEqual:z,valueOf:M,hasOwnEnumerableProperty:q}=y,{keys:l,getOwnPropertySymbols:f}=Object;if(v===c.array){if(!u.part){if(N.length!==s.length)return!1;for(let m=0;m<N.length;++m)if(!z(N[m],s[m],u,d))return!1;return!0}for(const m of N)for(const w of s)if(z(m,w,u,d))return!0}else if(v===c.set){if(N.size!==s.size)return!1;if(!y.isSetSimpleEqual(N,s)){const m=new Set(Set.prototype.values.call(s));for(const w of Set.prototype.values.call(N)){if(m.delete(w))continue;let E=!1;for(const U of m)if(z(w,U,u,d)){m.delete(U),E=!0;break}if(!E)return!1}}}else if(v===c.map){if(N.size!==s.size)return!1;for(const[m,w]of Map.prototype.entries.call(N))if(w===void 0&&!Map.prototype.has.call(s,m)||!z(w,Map.prototype.get.call(s,m),u,d))return!1}else if(v===c.error&&(N.name!==s.name||N.message!==s.message))return!1;const g=M(N),L=M(s);if((N!==g||s!==L)&&!z(g,L,u,d))return!1;const T=l(N);if(!u.part&&T.length!==l(s).length&&!u.skip)return!1;let X=0;for(const m of T)if(u.skip&&u.skip.includes(m))s[m]===void 0&&++X;else if(!q(s,m)||!z(N[m],s[m],u,d))return!1;if(!u.part&&T.length-X!==l(s).length)return!1;if(u.symbols!==!1){const m=f(N),w=new Set(f(s));for(const E of m){var C;if((C=u.skip)===null||C===void 0||!C.includes(E)){if(q(N,E)){if(!q(s,E)||!z(N[E],s[E],u,d))return!1}else if(q(s,E))return!1}w.delete(E)}for(const E of w)if(q(s,E))return!1}return!0},y.SeenEntry=class{constructor(v,N){this.obj=v,this.ref=N}isSame(v,N){return this.obj===v&&this.ref===N}}},4168:(a,O,A)=>{const c=A(375);a.exports=function(y){return c(/^[ \w\!#\$%&'\(\)\*\+,\-\.\/\:;<\=>\?@\[\]\^`\{\|\}~\"\\]*$/.test(y),"Bad attribute value ("+y+")"),y.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')}},5277:a=>{const O={};a.exports=function(A){if(!A)return"";let c="";for(let y=0;y<A.length;++y){const v=A.charCodeAt(y);O.isSafe(v)?c+=A[y]:c+=O.escapeHtmlChar(v)}return c},O.escapeHtmlChar=function(A){return O.namedHtml.get(A)||(A>=256?"&#"+A+";":`&#x${A.toString(16).padStart(2,"0")};`)},O.isSafe=function(A){return O.safeCharCodes.has(A)},O.namedHtml=new Map([[38,"&amp;"],[60,"&lt;"],[62,"&gt;"],[34,"&quot;"],[160,"&nbsp;"],[162,"&cent;"],[163,"&pound;"],[164,"&curren;"],[169,"&copy;"],[174,"&reg;"]]),O.safeCharCodes=function(){const A=new Set;for(let c=32;c<123;++c)(c>=97||c>=65&&c<=90||c>=48&&c<=57||c===32||c===46||c===44||c===45||c===58||c===95)&&A.add(c);return A}()},7973:a=>{const O={};a.exports=function(A){return A?A.replace(/[<>&\u2028\u2029]/g,O.escape):""},O.escape=function(A){return O.replacements.get(A)},O.replacements=new Map([["<","\\u003c"],[">","\\u003e"],["&","\\u0026"],["\u2028","\\u2028"],["\u2029","\\u2029"]])},6064:a=>{a.exports=function(O){return O.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")}},655:a=>{const O={};a.exports=O.flatten=function(A,c){const y=c||[];for(const v of A)Array.isArray(v)?O.flatten(v,y):y.push(v);return y}},738:a=>{a.exports=function(){}},8870:(a,O,A)=>{O.applyToDefaults=A(978),O.assert=A(375),O.AssertError=A(4213),O.Bench=A(9367),O.block=A(8630),O.clone=A(8571),O.contain=A(1467),O.deepEqual=A(9474),O.escapeHeaderAttribute=A(4168),O.escapeHtml=A(5277),O.escapeJson=A(7973),O.escapeRegex=A(6064),O.flatten=A(655),O.ignore=A(738),O.intersect=A(5088),O.isPromise=A(7259),O.merge=A(1687),O.once=A(5022),O.reach=A(9621),O.reachTemplate=A(4069),O.stringify=A(8761),O.wait=A(2620)},5088:a=>{const O={};a.exports=function(A,c,y={}){if(!A||!c)return y.first?null:[];const v=[],N=Array.isArray(A)?new Set(A):A,s=new Set;for(const u of c)if(O.has(N,u)&&!s.has(u)){if(y.first)return u;v.push(u),s.add(u)}return y.first?null:v},O.has=function(A,c){return typeof A.has=="function"?A.has(c):A[c]!==void 0}},7259:a=>{a.exports=function(O){return typeof O?.then=="function"}},1687:(a,O,A)=>{const c=A(375),y=A(8571),v=A(7043),N={};a.exports=N.merge=function(s,u,d){if(c(s&&typeof s=="object","Invalid target value: must be an object"),c(u==null||typeof u=="object","Invalid source value: must be null, undefined, or an object"),!u)return s;if(d=Object.assign({nullOverride:!0,mergeArrays:!0},d),Array.isArray(u)){c(Array.isArray(s),"Cannot merge array onto an object"),d.mergeArrays||(s.length=0);for(let M=0;M<u.length;++M)s.push(y(u[M],{symbols:d.symbols}));return s}const z=v.keys(u,d);for(let M=0;M<z.length;++M){const q=z[M];if(q==="__proto__"||!Object.prototype.propertyIsEnumerable.call(u,q))continue;const l=u[q];if(l&&typeof l=="object"){if(s[q]===l)continue;!s[q]||typeof s[q]!="object"||Array.isArray(s[q])!==Array.isArray(l)||l instanceof Date||l instanceof RegExp?s[q]=y(l,{symbols:d.symbols}):N.merge(s[q],l,d)}else(l!=null||d.nullOverride)&&(s[q]=l)}return s}},5022:a=>{const O=Symbol("wrapped");a.exports=function(A){if(A[O])return A;let c=!1;const y=function(...v){c||(c=!0,A(...v))};return y[O]=!0,y}},9621:(a,O,A)=>{const c=A(375),y={};a.exports=function(v,N,s){if(N===!1||N==null)return v;typeof(s=s||{})=="string"&&(s={separator:s});const u=Array.isArray(N);c(!u||!s.separator,"Separator option is not valid for array-based chain");const d=u?N:N.split(s.separator||".");let z=v;for(let M=0;M<d.length;++M){let q=d[M];const l=s.iterables&&y.iterables(z);if(Array.isArray(z)||l==="set"){const f=Number(q);Number.isInteger(f)&&(q=f<0?z.length+f:f)}if(!z||typeof z=="function"&&s.functions===!1||!l&&z[q]===void 0){c(!s.strict||M+1===d.length,"Missing segment",q,"in reach path ",N),c(typeof z=="object"||s.functions===!0||typeof z!="function","Invalid segment",q,"in reach path ",N),z=s.default;break}z=l?l==="set"?[...z][q]:z.get(q):z[q]}return z},y.iterables=function(v){return v instanceof Set?"set":v instanceof Map?"map":void 0}},4069:(a,O,A)=>{const c=A(9621);a.exports=function(y,v,N){return v.replace(/{([^{}]+)}/g,(s,u)=>{const d=c(y,u,N);return d??""})}},8761:a=>{a.exports=function(...O){try{return JSON.stringify(...O)}catch(A){return"[Cannot display object: "+A.message+"]"}}},4277:(a,O)=>{const A={};O=a.exports={array:Array.prototype,buffer:!1,date:Date.prototype,error:Error.prototype,generic:Object.prototype,map:Map.prototype,promise:Promise.prototype,regex:RegExp.prototype,set:Set.prototype,url:URL.prototype,weakMap:WeakMap.prototype,weakSet:WeakSet.prototype},A.typeMap=new Map([["[object Error]",O.error],["[object Map]",O.map],["[object Promise]",O.promise],["[object Set]",O.set],["[object URL]",O.url],["[object WeakMap]",O.weakMap],["[object WeakSet]",O.weakSet]]),O.getInternalProto=function(c){if(Array.isArray(c))return O.array;if(c instanceof Date)return O.date;if(c instanceof RegExp)return O.regex;if(c instanceof Error)return O.error;const y=Object.prototype.toString.call(c);return A.typeMap.get(y)||O.generic}},7043:(a,O)=>{O.keys=function(A,c={}){return c.symbols!==!1?Reflect.ownKeys(A):Object.getOwnPropertyNames(A)}},2620:a=>{a.exports=function(O,A,c){if(typeof O=="bigint"&&(O=Number(O)),O>=Number.MAX_SAFE_INTEGER&&(O=1/0),typeof O!="number"&&O!==void 0)throw new TypeError("Timeout must be a number or bigint");return new Promise(y=>{const v=c?c.setTimeout:setTimeout,N=()=>{const s=Math.min(O,2147483647);O-=s,v(()=>O>0?N():y(A),s)};O!==1/0&&N()})}},7593:(a,O)=>{O.location=function(A=0){const c=Error.prepareStackTrace;Error.prepareStackTrace=(N,s)=>s;const y={};Error.captureStackTrace(y,this);const v=y.stack[A+1];return Error.prepareStackTrace=c,{filename:v.getFileName(),line:v.getLineNumber()}}},6264:(a,O,A)=>{A.r(O),A.d(O,{tlds:()=>c});const c=new Set(["AAA","AARP","ABB","ABBOTT","ABBVIE","ABC","ABLE","ABOGADO","ABUDHABI","AC","ACADEMY","ACCENTURE","ACCOUNTANT","ACCOUNTANTS","ACO","ACTOR","AD","ADS","ADULT","AE","AEG","AERO","AETNA","AF","AFL","AFRICA","AG","AGAKHAN","AGENCY","AI","AIG","AIRBUS","AIRFORCE","AIRTEL","AKDN","AL","ALIBABA","ALIPAY","ALLFINANZ","ALLSTATE","ALLY","ALSACE","ALSTOM","AM","AMAZON","AMERICANEXPRESS","AMERICANFAMILY","AMEX","AMFAM","AMICA","AMSTERDAM","ANALYTICS","ANDROID","ANQUAN","ANZ","AO","AOL","APARTMENTS","APP","APPLE","AQ","AQUARELLE","AR","ARAB","ARAMCO","ARCHI","ARMY","ARPA","ART","ARTE","AS","ASDA","ASIA","ASSOCIATES","AT","ATHLETA","ATTORNEY","AU","AUCTION","AUDI","AUDIBLE","AUDIO","AUSPOST","AUTHOR","AUTO","AUTOS","AVIANCA","AW","AWS","AX","AXA","AZ","AZURE","BA","BABY","BAIDU","BANAMEX","BANANAREPUBLIC","BAND","BANK","BAR","BARCELONA","BARCLAYCARD","BARCLAYS","BAREFOOT","BARGAINS","BASEBALL","BASKETBALL","BAUHAUS","BAYERN","BB","BBC","BBT","BBVA","BCG","BCN","BD","BE","BEATS","BEAUTY","BEER","BENTLEY","BERLIN","BEST","BESTBUY","BET","BF","BG","BH","BHARTI","BI","BIBLE","BID","BIKE","BING","BINGO","BIO","BIZ","BJ","BLACK","BLACKFRIDAY","BLOCKBUSTER","BLOG","BLOOMBERG","BLUE","BM","BMS","BMW","BN","BNPPARIBAS","BO","BOATS","BOEHRINGER","BOFA","BOM","BOND","BOO","BOOK","BOOKING","BOSCH","BOSTIK","BOSTON","BOT","BOUTIQUE","BOX","BR","BRADESCO","BRIDGESTONE","BROADWAY","BROKER","BROTHER","BRUSSELS","BS","BT","BUILD","BUILDERS","BUSINESS","BUY","BUZZ","BV","BW","BY","BZ","BZH","CA","CAB","CAFE","CAL","CALL","CALVINKLEIN","CAM","CAMERA","CAMP","CANON","CAPETOWN","CAPITAL","CAPITALONE","CAR","CARAVAN","CARDS","CARE","CAREER","CAREERS","CARS","CASA","CASE","CASH","CASINO","CAT","CATERING","CATHOLIC","CBA","CBN","CBRE","CBS","CC","CD","CENTER","CEO","CERN","CF","CFA","CFD","CG","CH","CHANEL","CHANNEL","CHARITY","CHASE","CHAT","CHEAP","CHINTAI","CHRISTMAS","CHROME","CHURCH","CI","CIPRIANI","CIRCLE","CISCO","CITADEL","CITI","CITIC","CITY","CITYEATS","CK","CL","CLAIMS","CLEANING","CLICK","CLINIC","CLINIQUE","CLOTHING","CLOUD","CLUB","CLUBMED","CM","CN","CO","COACH","CODES","COFFEE","COLLEGE","COLOGNE","COM","COMCAST","COMMBANK","COMMUNITY","COMPANY","COMPARE","COMPUTER","COMSEC","CONDOS","CONSTRUCTION","CONSULTING","CONTACT","CONTRACTORS","COOKING","COOL","COOP","CORSICA","COUNTRY","COUPON","COUPONS","COURSES","CPA","CR","CREDIT","CREDITCARD","CREDITUNION","CRICKET","CROWN","CRS","CRUISE","CRUISES","CU","CUISINELLA","CV","CW","CX","CY","CYMRU","CYOU","CZ","DABUR","DAD","DANCE","DATA","DATE","DATING","DATSUN","DAY","DCLK","DDS","DE","DEAL","DEALER","DEALS","DEGREE","DELIVERY","DELL","DELOITTE","DELTA","DEMOCRAT","DENTAL","DENTIST","DESI","DESIGN","DEV","DHL","DIAMONDS","DIET","DIGITAL","DIRECT","DIRECTORY","DISCOUNT","DISCOVER","DISH","DIY","DJ","DK","DM","DNP","DO","DOCS","DOCTOR","DOG","DOMAINS","DOT","DOWNLOAD","DRIVE","DTV","DUBAI","DUNLOP","DUPONT","DURBAN","DVAG","DVR","DZ","EARTH","EAT","EC","ECO","EDEKA","EDU","EDUCATION","EE","EG","EMAIL","EMERCK","ENERGY","ENGINEER","ENGINEERING","ENTERPRISES","EPSON","EQUIPMENT","ER","ERICSSON","ERNI","ES","ESQ","ESTATE","ET","ETISALAT","EU","EUROVISION","EUS","EVENTS","EXCHANGE","EXPERT","EXPOSED","EXPRESS","EXTRASPACE","FAGE","FAIL","FAIRWINDS","FAITH","FAMILY","FAN","FANS","FARM","FARMERS","FASHION","FAST","FEDEX","FEEDBACK","FERRARI","FERRERO","FI","FIDELITY","FIDO","FILM","FINAL","FINANCE","FINANCIAL","FIRE","FIRESTONE","FIRMDALE","FISH","FISHING","FIT","FITNESS","FJ","FK","FLICKR","FLIGHTS","FLIR","FLORIST","FLOWERS","FLY","FM","FO","FOO","FOOD","FOOTBALL","FORD","FOREX","FORSALE","FORUM","FOUNDATION","FOX","FR","FREE","FRESENIUS","FRL","FROGANS","FRONTDOOR","FRONTIER","FTR","FUJITSU","FUN","FUND","FURNITURE","FUTBOL","FYI","GA","GAL","GALLERY","GALLO","GALLUP","GAME","GAMES","GAP","GARDEN","GAY","GB","GBIZ","GD","GDN","GE","GEA","GENT","GENTING","GEORGE","GF","GG","GGEE","GH","GI","GIFT","GIFTS","GIVES","GIVING","GL","GLASS","GLE","GLOBAL","GLOBO","GM","GMAIL","GMBH","GMO","GMX","GN","GODADDY","GOLD","GOLDPOINT","GOLF","GOO","GOODYEAR","GOOG","GOOGLE","GOP","GOT","GOV","GP","GQ","GR","GRAINGER","GRAPHICS","GRATIS","GREEN","GRIPE","GROCERY","GROUP","GS","GT","GU","GUARDIAN","GUCCI","GUGE","GUIDE","GUITARS","GURU","GW","GY","HAIR","HAMBURG","HANGOUT","HAUS","HBO","HDFC","HDFCBANK","HEALTH","HEALTHCARE","HELP","HELSINKI","HERE","HERMES","HIPHOP","HISAMITSU","HITACHI","HIV","HK","HKT","HM","HN","HOCKEY","HOLDINGS","HOLIDAY","HOMEDEPOT","HOMEGOODS","HOMES","HOMESENSE","HONDA","HORSE","HOSPITAL","HOST","HOSTING","HOT","HOTELS","HOTMAIL","HOUSE","HOW","HR","HSBC","HT","HU","HUGHES","HYATT","HYUNDAI","IBM","ICBC","ICE","ICU","ID","IE","IEEE","IFM","IKANO","IL","IM","IMAMAT","IMDB","IMMO","IMMOBILIEN","IN","INC","INDUSTRIES","INFINITI","INFO","ING","INK","INSTITUTE","INSURANCE","INSURE","INT","INTERNATIONAL","INTUIT","INVESTMENTS","IO","IPIRANGA","IQ","IR","IRISH","IS","ISMAILI","IST","ISTANBUL","IT","ITAU","ITV","JAGUAR","JAVA","JCB","JE","JEEP","JETZT","JEWELRY","JIO","JLL","JM","JMP","JNJ","JO","JOBS","JOBURG","JOT","JOY","JP","JPMORGAN","JPRS","JUEGOS","JUNIPER","KAUFEN","KDDI","KE","KERRYHOTELS","KERRYLOGISTICS","KERRYPROPERTIES","KFH","KG","KH","KI","KIA","KIDS","KIM","KINDER","KINDLE","KITCHEN","KIWI","KM","KN","KOELN","KOMATSU","KOSHER","KP","KPMG","KPN","KR","KRD","KRED","KUOKGROUP","KW","KY","KYOTO","KZ","LA","LACAIXA","LAMBORGHINI","LAMER","LANCASTER","LAND","LANDROVER","LANXESS","LASALLE","LAT","LATINO","LATROBE","LAW","LAWYER","LB","LC","LDS","LEASE","LECLERC","LEFRAK","LEGAL","LEGO","LEXUS","LGBT","LI","LIDL","LIFE","LIFEINSURANCE","LIFESTYLE","LIGHTING","LIKE","LILLY","LIMITED","LIMO","LINCOLN","LINK","LIPSY","LIVE","LIVING","LK","LLC","LLP","LOAN","LOANS","LOCKER","LOCUS","LOL","LONDON","LOTTE","LOTTO","LOVE","LPL","LPLFINANCIAL","LR","LS","LT","LTD","LTDA","LU","LUNDBECK","LUXE","LUXURY","LV","LY","MA","MADRID","MAIF","MAISON","MAKEUP","MAN","MANAGEMENT","MANGO","MAP","MARKET","MARKETING","MARKETS","MARRIOTT","MARSHALLS","MATTEL","MBA","MC","MCKINSEY","MD","ME","MED","MEDIA","MEET","MELBOURNE","MEME","MEMORIAL","MEN","MENU","MERCKMSD","MG","MH","MIAMI","MICROSOFT","MIL","MINI","MINT","MIT","MITSUBISHI","MK","ML","MLB","MLS","MM","MMA","MN","MO","MOBI","MOBILE","MODA","MOE","MOI","MOM","MONASH","MONEY","MONSTER","MORMON","MORTGAGE","MOSCOW","MOTO","MOTORCYCLES","MOV","MOVIE","MP","MQ","MR","MS","MSD","MT","MTN","MTR","MU","MUSEUM","MUSIC","MV","MW","MX","MY","MZ","NA","NAB","NAGOYA","NAME","NATURA","NAVY","NBA","NC","NE","NEC","NET","NETBANK","NETFLIX","NETWORK","NEUSTAR","NEW","NEWS","NEXT","NEXTDIRECT","NEXUS","NF","NFL","NG","NGO","NHK","NI","NICO","NIKE","NIKON","NINJA","NISSAN","NISSAY","NL","NO","NOKIA","NORTON","NOW","NOWRUZ","NOWTV","NP","NR","NRA","NRW","NTT","NU","NYC","NZ","OBI","OBSERVER","OFFICE","OKINAWA","OLAYAN","OLAYANGROUP","OLDNAVY","OLLO","OM","OMEGA","ONE","ONG","ONL","ONLINE","OOO","OPEN","ORACLE","ORANGE","ORG","ORGANIC","ORIGINS","OSAKA","OTSUKA","OTT","OVH","PA","PAGE","PANASONIC","PARIS","PARS","PARTNERS","PARTS","PARTY","PAY","PCCW","PE","PET","PF","PFIZER","PG","PH","PHARMACY","PHD","PHILIPS","PHONE","PHOTO","PHOTOGRAPHY","PHOTOS","PHYSIO","PICS","PICTET","PICTURES","PID","PIN","PING","PINK","PIONEER","PIZZA","PK","PL","PLACE","PLAY","PLAYSTATION","PLUMBING","PLUS","PM","PN","PNC","POHL","POKER","POLITIE","PORN","POST","PR","PRAMERICA","PRAXI","PRESS","PRIME","PRO","PROD","PRODUCTIONS","PROF","PROGRESSIVE","PROMO","PROPERTIES","PROPERTY","PROTECTION","PRU","PRUDENTIAL","PS","PT","PUB","PW","PWC","PY","QA","QPON","QUEBEC","QUEST","RACING","RADIO","RE","READ","REALESTATE","REALTOR","REALTY","RECIPES","RED","REDSTONE","REDUMBRELLA","REHAB","REISE","REISEN","REIT","RELIANCE","REN","RENT","RENTALS","REPAIR","REPORT","REPUBLICAN","REST","RESTAURANT","REVIEW","REVIEWS","REXROTH","RICH","RICHARDLI","RICOH","RIL","RIO","RIP","RO","ROCHER","ROCKS","RODEO","ROGERS","ROOM","RS","RSVP","RU","RUGBY","RUHR","RUN","RW","RWE","RYUKYU","SA","SAARLAND","SAFE","SAFETY","SAKURA","SALE","SALON","SAMSCLUB","SAMSUNG","SANDVIK","SANDVIKCOROMANT","SANOFI","SAP","SARL","SAS","SAVE","SAXO","SB","SBI","SBS","SC","SCA","SCB","SCHAEFFLER","SCHMIDT","SCHOLARSHIPS","SCHOOL","SCHULE","SCHWARZ","SCIENCE","SCOT","SD","SE","SEARCH","SEAT","SECURE","SECURITY","SEEK","SELECT","SENER","SERVICES","SEVEN","SEW","SEX","SEXY","SFR","SG","SH","SHANGRILA","SHARP","SHAW","SHELL","SHIA","SHIKSHA","SHOES","SHOP","SHOPPING","SHOUJI","SHOW","SHOWTIME","SI","SILK","SINA","SINGLES","SITE","SJ","SK","SKI","SKIN","SKY","SKYPE","SL","SLING","SM","SMART","SMILE","SN","SNCF","SO","SOCCER","SOCIAL","SOFTBANK","SOFTWARE","SOHU","SOLAR","SOLUTIONS","SONG","SONY","SOY","SPA","SPACE","SPORT","SPOT","SR","SRL","SS","ST","STADA","STAPLES","STAR","STATEBANK","STATEFARM","STC","STCGROUP","STOCKHOLM","STORAGE","STORE","STREAM","STUDIO","STUDY","STYLE","SU","SUCKS","SUPPLIES","SUPPLY","SUPPORT","SURF","SURGERY","SUZUKI","SV","SWATCH","SWISS","SX","SY","SYDNEY","SYSTEMS","SZ","TAB","TAIPEI","TALK","TAOBAO","TARGET","TATAMOTORS","TATAR","TATTOO","TAX","TAXI","TC","TCI","TD","TDK","TEAM","TECH","TECHNOLOGY","TEL","TEMASEK","TENNIS","TEVA","TF","TG","TH","THD","THEATER","THEATRE","TIAA","TICKETS","TIENDA","TIPS","TIRES","TIROL","TJ","TJMAXX","TJX","TK","TKMAXX","TL","TM","TMALL","TN","TO","TODAY","TOKYO","TOOLS","TOP","TORAY","TOSHIBA","TOTAL","TOURS","TOWN","TOYOTA","TOYS","TR","TRADE","TRADING","TRAINING","TRAVEL","TRAVELERS","TRAVELERSINSURANCE","TRUST","TRV","TT","TUBE","TUI","TUNES","TUSHU","TV","TVS","TW","TZ","UA","UBANK","UBS","UG","UK","UNICOM","UNIVERSITY","UNO","UOL","UPS","US","UY","UZ","VA","VACATIONS","VANA","VANGUARD","VC","VE","VEGAS","VENTURES","VERISIGN","VERSICHERUNG","VET","VG","VI","VIAJES","VIDEO","VIG","VIKING","VILLAS","VIN","VIP","VIRGIN","VISA","VISION","VIVA","VIVO","VLAANDEREN","VN","VODKA","VOLKSWAGEN","VOLVO","VOTE","VOTING","VOTO","VOYAGE","VU","WALES","WALMART","WALTER","WANG","WANGGOU","WATCH","WATCHES","WEATHER","WEATHERCHANNEL","WEBCAM","WEBER","WEBSITE","WED","WEDDING","WEIBO","WEIR","WF","WHOSWHO","WIEN","WIKI","WILLIAMHILL","WIN","WINDOWS","WINE","WINNERS","WME","WOLTERSKLUWER","WOODSIDE","WORK","WORKS","WORLD","WOW","WS","WTC","WTF","XBOX","XEROX","XFINITY","XIHUAN","XIN","XN--11B4C3D","XN--1CK2E1B","XN--1QQW23A","XN--2SCRJ9C","XN--30RR7Y","XN--3BST00M","XN--3DS443G","XN--3E0B707E","XN--3HCRJ9C","XN--3PXU8K","XN--42C2D9A","XN--45BR5CYL","XN--45BRJ9C","XN--45Q11C","XN--4DBRK0CE","XN--4GBRIM","XN--54B7FTA0CC","XN--55QW42G","XN--55QX5D","XN--5SU34J936BGSG","XN--5TZM5G","XN--6FRZ82G","XN--6QQ986B3XL","XN--80ADXHKS","XN--80AO21A","XN--80AQECDR1A","XN--80ASEHDB","XN--80ASWG","XN--8Y0A063A","XN--90A3AC","XN--90AE","XN--90AIS","XN--9DBQ2A","XN--9ET52U","XN--9KRT00A","XN--B4W605FERD","XN--BCK1B9A5DRE4C","XN--C1AVG","XN--C2BR7G","XN--CCK2B3B","XN--CCKWCXETD","XN--CG4BKI","XN--CLCHC0EA0B2G2A9GCD","XN--CZR694B","XN--CZRS0T","XN--CZRU2D","XN--D1ACJ3B","XN--D1ALF","XN--E1A4C","XN--ECKVDTC9D","XN--EFVY88H","XN--FCT429K","XN--FHBEI","XN--FIQ228C5HS","XN--FIQ64B","XN--FIQS8S","XN--FIQZ9S","XN--FJQ720A","XN--FLW351E","XN--FPCRJ9C3D","XN--FZC2C9E2C","XN--FZYS8D69UVGM","XN--G2XX48C","XN--GCKR3F0F","XN--GECRJ9C","XN--GK3AT1E","XN--H2BREG3EVE","XN--H2BRJ9C","XN--H2BRJ9C8C","XN--HXT814E","XN--I1B6B1A6A2E","XN--IMR513N","XN--IO0A7I","XN--J1AEF","XN--J1AMH","XN--J6W193G","XN--JLQ480N2RG","XN--JVR189M","XN--KCRX77D1X4A","XN--KPRW13D","XN--KPRY57D","XN--KPUT3I","XN--L1ACC","XN--LGBBAT1AD8J","XN--MGB9AWBF","XN--MGBA3A3EJT","XN--MGBA3A4F16A","XN--MGBA7C0BBN0A","XN--MGBAAKC7DVF","XN--MGBAAM7A8H","XN--MGBAB2BD","XN--MGBAH1A3HJKRD","XN--MGBAI9AZGQP6J","XN--MGBAYH7GPA","XN--MGBBH1A","XN--MGBBH1A71E","XN--MGBC0A9AZCG","XN--MGBCA7DZDO","XN--MGBCPQ6GPA1A","XN--MGBERP4A5D4AR","XN--MGBGU82A","XN--MGBI4ECEXP","XN--MGBPL2FH","XN--MGBT3DHD","XN--MGBTX2B","XN--MGBX4CD0AB","XN--MIX891F","XN--MK1BU44C","XN--MXTQ1M","XN--NGBC5AZD","XN--NGBE9E0A","XN--NGBRX","XN--NODE","XN--NQV7F","XN--NQV7FS00EMA","XN--NYQY26A","XN--O3CW4H","XN--OGBPF8FL","XN--OTU796D","XN--P1ACF","XN--P1AI","XN--PGBS0DH","XN--PSSY2U","XN--Q7CE6A","XN--Q9JYB4C","XN--QCKA1PMC","XN--QXA6A","XN--QXAM","XN--RHQV96G","XN--ROVU88B","XN--RVC1E0AM3E","XN--S9BRJ9C","XN--SES554G","XN--T60B56A","XN--TCKWE","XN--TIQ49XQYJ","XN--UNUP4Y","XN--VERMGENSBERATER-CTB","XN--VERMGENSBERATUNG-PWB","XN--VHQUV","XN--VUQ861B","XN--W4R85EL8FHU5DNRA","XN--W4RS40L","XN--WGBH1C","XN--WGBL6A","XN--XHQ521B","XN--XKC2AL3HYE2A","XN--XKC2DL3A5EE0H","XN--Y9A3AQ","XN--YFRO4I67O","XN--YGBI2AMMX","XN--ZFR164B","XXX","XYZ","YACHTS","YAHOO","YAMAXUN","YANDEX","YE","YODOBASHI","YOGA","YOKOHAMA","YOU","YOUTUBE","YT","YUN","ZA","ZAPPOS","ZARA","ZERO","ZIP","ZM","ZONE","ZUERICH","ZW"].map(y=>y.toLowerCase()))},3652:(a,O,A)=>{const{assert:c}=A(8870),y={};O.Sorter=class{constructor(){this._items=[],this.nodes=[]}add(v,N){var s,u,d,z,M;N=(s=N)!==null&&s!==void 0?s:{};const q=[].concat((u=N.before)!==null&&u!==void 0?u:[]),l=[].concat((d=N.after)!==null&&d!==void 0?d:[]),f=(z=N.group)!==null&&z!==void 0?z:"?",g=(M=N.sort)!==null&&M!==void 0?M:0;c(!q.includes(f),`Item cannot come before itself: ${f}`),c(!q.includes("?"),"Item cannot come before unassociated items"),c(!l.includes(f),`Item cannot come after itself: ${f}`),c(!l.includes("?"),"Item cannot come after unassociated items"),Array.isArray(v)||(v=[v]);for(const L of v){const T={seq:this._items.length,sort:g,before:q,after:l,group:f,node:L};this._items.push(T)}if(!N.manual){const L=this._sort();c(L,"item",f!=="?"?`added into group ${f}`:"","created a dependencies error")}return this.nodes}merge(v){Array.isArray(v)||(v=[v]);for(const s of v)if(s)for(const u of s._items)this._items.push(Object.assign({},u));this._items.sort(y.mergeSort);for(let s=0;s<this._items.length;++s)this._items[s].seq=s;const N=this._sort();return c(N,"merge created a dependencies error"),this.nodes}sort(){const v=this._sort();return c(v,"sort created a dependencies error"),this.nodes}_sort(){const v={},N=Object.create(null),s=Object.create(null);for(const L of this._items){var u;const T=L.seq,X=L.group;s[X]=(u=s[X])!==null&&u!==void 0?u:[],s[X].push(T),v[T]=L.before;for(const C of L.after){var d;N[C]=(d=N[C])!==null&&d!==void 0?d:[],N[C].push(T)}}for(const L in v){const T=[];for(const X in v[L]){var z;const C=v[L][X];s[C]=(z=s[C])!==null&&z!==void 0?z:[],T.push(...s[C])}v[L]=T}for(const L in N)if(s[L])for(const T of s[L])v[T].push(...N[L]);const M={};for(const L in v){const T=v[L];for(const X of T){var q;M[X]=(q=M[X])!==null&&q!==void 0?q:[],M[X].push(L)}}const l={},f=[];for(let L=0;L<this._items.length;++L){let T=L;if(M[L]){T=null;for(let X=0;X<this._items.length;++X){if(l[X]===!0)continue;M[X]||(M[X]=[]);const C=M[X].length;let m=0;for(let w=0;w<C;++w)l[M[X][w]]&&++m;if(m===C){T=X;break}}}T!==null&&(l[T]=!0,f.push(T))}if(f.length!==this._items.length)return!1;const g={};for(const L of this._items)g[L.seq]=L;this._items=[],this.nodes=[];for(const L of f){const T=g[L];this.nodes.push(T.node),this._items.push(T)}return!0}},y.mergeSort=(v,N)=>v.sort===N.sort?0:v.sort<N.sort?-1:1},1275:()=>{},3975:()=>{},5934:a=>{a.exports=JSON.parse('{"version":"17.11.0"}')}},n={};function b(a){var O=n[a];if(O!==void 0)return O.exports;var A=n[a]={exports:{}};return o[a](A,A.exports,b),A.exports}return b.n=a=>{var O=a&&a.__esModule?()=>a.default:()=>a;return b.d(O,{a:O}),O},b.d=(a,O)=>{for(var A in O)b.o(O,A)&&!b.o(a,A)&&Object.defineProperty(a,A,{enumerable:!0,get:O[A]})},b.o=(a,O)=>Object.prototype.hasOwnProperty.call(a,O),b.r=a=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})},b(5107)})())})(dA);var uA=dA.exports;const R=pM(uA);var B2={},fA={},Zi={},zO={};Object.defineProperty(zO,"__esModule",{value:!0});zO.default={JSONB:{normalizedType:"string"},UUID:{normalizedType:"string"},DECIMAL:{normalizedType:"number"},NUMERIC:{normalizedType:"number"},INT:{normalizedType:"number",numberCanOnlyBeInteger:!0},INTEGER:{normalizedType:"number",numberCanOnlyBeInteger:!0},BIGINT:{normalizedType:"number",numberCanOnlyBeInteger:!0},SMALLINT:{normalizedType:"number",numberCanOnlyBeInteger:!0},DOUBLEPRECISION:{normalizedType:"number",castAs:"DOUBLE PRECISION"},"DOUBLE PRECISION":{normalizedType:"number"},REAL:{normalizedType:"number"},FLOAT:{normalizedType:"number"},NUMBER:{normalizedType:"number"},BINARY:{normalizedType:"string"},VARBINARY:{normalizedType:"string"},CHAR:{normalizedType:"string"},CHARACTER:{normalizedType:"string"},"CHARACTER VARYING":{normalizedType:"string"},TEXT:{normalizedType:"string"},VARCHAR:{normalizedType:"string"},TIME:{normalizedType:"date_time"},DATE:{normalizedType:"date_time"},TIMESTAMP_LTZ:{normalizedType:"date_time"},TIMESTAMP_NTZ:{normalizedType:"date_time"},TIMESTAMP_TZ:{normalizedType:"date_time"},TIMESTAMP:{normalizedType:"date_time"},BOOLEAN:{normalizedType:"boolean"},"TIMESTAMP WITH TIME ZONE":{normalizedType:"date_time"},"TIMESTAMP WITHOUT TIME ZONE":{normalizedType:"date_time"},ARRAY:{normalizedType:"string[]"}};var i6=O0&&O0.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Zi,"__esModule",{value:!0});Zi.NATIVE_DATA_TYPES_DATABASE=void 0;const b6=i6(zO);Zi.NATIVE_DATA_TYPES_DATABASE={microsoftSQLServer:{INT:{normalizedType:"number",numberCanOnlyBeInteger:!0},BIGINT:{normalizedType:"number",numberCanOnlyBeInteger:!0},NUMERIC:{normalizedType:"number"},BIT:{normalizedType:"number"},SMALLINT:{normalizedType:"number",numberCanOnlyBeInteger:!0},DECIMAL:{normalizedType:"number"},SMALLMONEY:{normalizedType:"number"},TINYINT:{normalizedType:"number",numberCanOnlyBeInteger:!0},MONEY:{normalizedType:"number"},FLOAT:{normalizedType:"number"},REAL:{normalizedType:"number"},DATE:{normalizedType:"date_time"},DATETIME2:{normalizedType:"date_time"},SMALLDATETIME:{normalizedType:"date_time"},DATETIME:{normalizedType:"date_time"},TIME:{normalizedType:"date_time"},UNIQUEIDENTIFIER:{normalizedType:"string"},CHAR:{normalizedType:"string"},VARCHAR:{normalizedType:"string"},TEXT:{normalizedType:"string",castAs:"VARCHAR(8000)"},NCHAR:{normalizedType:"string"},NVARCHAR:{normalizedType:"string"},NTEXT:{normalizedType:"string"},BINARY:{normalizedType:"string"},VARBINARY:{normalizedType:"string"}},bigquery:{INT64:{normalizedType:"number",numberCanOnlyBeInteger:!0},FLOAT64:{normalizedType:"number"},NUMERIC:{normalizedType:"number"},BIGNUMERIC:{normalizedType:"number"},STRING:{normalizedType:"string"},DATE:{normalizedType:"date_time"},DATETIME:{normalizedType:"date_time"},TIMESTAMP:{normalizedType:"date_time"},BOOL:{normalizedType:"boolean"},"ARRAY<STRING>":{normalizedType:"string[]"}},elasticsearch:{date_time:{normalizedType:"date_time"},number:{normalizedType:"number"},string:{normalizedType:"string"},boolean:{normalizedType:"boolean"}},mariadb:{TINYINT:{normalizedType:"number",castAs:"INT",numberCanOnlyBeInteger:!0},SMALLINT:{normalizedType:"number",castAs:"INT",numberCanOnlyBeInteger:!0},MEDIUMINT:{normalizedType:"number",castAs:"INT",numberCanOnlyBeInteger:!0},INT:{normalizedType:"number",numberCanOnlyBeInteger:!0},INTEGER:{normalizedType:"number",castAs:"INT",numberCanOnlyBeInteger:!0},BIGINT:{normalizedType:"number",castAs:"INT",numberCanOnlyBeInteger:!0},DECIMAL:{normalizedType:"number"},FLOAT:{normalizedType:"number"},DOUBLE:{normalizedType:"number"},VARCHAR:{normalizedType:"string",castAs:"CHAR"},TEXT:{normalizedType:"string",castAs:"CHAR"},TINYTEXT:{normalizedType:"string",castAs:"CHAR"},CHAR:{normalizedType:"string"},MEDIUMTEXT:{normalizedType:"string",castAs:"CHAR"},LONGTEXT:{normalizedType:"string",castAs:"CHAR"},DATE:{normalizedType:"date_time"},DATETIME:{normalizedType:"date_time"},TIMESTAMP:{normalizedType:"date_time",castAs:"DATETIME"},BOOLEAN:{normalizedType:"boolean",castAs:null},BOOL:{normalizedType:"boolean",castAs:null}},postgres:b6.default,SQLite:{BOOLEAN:{normalizedType:"boolean"},NULL:{normalizedType:"string"},INTEGER:{normalizedType:"number",numberCanOnlyBeInteger:!0},REAL:{normalizedType:"number"},DECIMAL:{normalizedType:"number"},CHAR:{normalizedType:"string"},TEXT:{normalizedType:"string"},DATE:{normalizedType:"date_time"},TIMESTAMP:{normalizedType:"date_time"}},snowflake:{FIXED:{normalizedType:"number"},DECIMAL:{normalizedType:"number"},NUMERIC:{normalizedType:"number"},INT:{normalizedType:"number",numberCanOnlyBeInteger:!0},INTEGER:{normalizedType:"number",numberCanOnlyBeInteger:!0},BIGINT:{normalizedType:"number",numberCanOnlyBeInteger:!0},SMALLINT:{normalizedType:"number",numberCanOnlyBeInteger:!0},TINYINT:{normalizedType:"number",numberCanOnlyBeInteger:!0},BYTEINT:{normalizedType:"number",numberCanOnlyBeInteger:!0},FLOAT:{normalizedType:"number"},FLOAT4:{normalizedType:"number"},FLOAT8:{normalizedType:"number"},DOUBLE:{normalizedType:"number"},DOUBLEPRECISION:{normalizedType:"number",castAs:"DOUBLE PRECISION"},"DOUBLE PRECISION":{normalizedType:"number"},REAL:{normalizedType:"number"},NUMBER:{normalizedType:"number"},BINARY:{normalizedType:"string"},VARBINARY:{normalizedType:"string"},CHAR:{normalizedType:"string"},CHARACTER:{normalizedType:"string"},"CHARACTER VARYING":{normalizedType:"string"},TEXT:{normalizedType:"string"},VARCHAR:{normalizedType:"string"},STRING:{normalizedType:"string"},TIME:{normalizedType:"date_time"},DATE:{normalizedType:"date_time"},DATETIME:{normalizedType:"date_time"},TIMESTAMP_LTZ:{normalizedType:"date_time"},TIMESTAMP_NTZ:{normalizedType:"date_time"},TIMESTAMP_TZ:{normalizedType:"date_time"},TIMESTAMP:{normalizedType:"date_time"},BOOLEAN:{normalizedType:"boolean"},ARRAY:{normalizedType:"string[]"},VARIANT:{normalizedType:"string"}},mysql:{TINYINT:{normalizedType:"number",castAs:"SIGNED",numberCanOnlyBeInteger:!0},SMALLINT:{normalizedType:"number",castAs:"SIGNED",numberCanOnlyBeInteger:!0},MEDIUMINT:{normalizedType:"number",castAs:"SIGNED",numberCanOnlyBeInteger:!0},INT:{normalizedType:"number",castAs:"SIGNED",numberCanOnlyBeInteger:!0},INTEGER:{normalizedType:"number",castAs:"SIGNED",numberCanOnlyBeInteger:!0},BIGINT:{normalizedType:"number",castAs:"SIGNED",numberCanOnlyBeInteger:!0},DECIMAL:{normalizedType:"number",castAs:"DECIMAL(65, 10)"},FLOAT:{normalizedType:"number",castAs:"DECIMAL(65, 10)"},DOUBLE:{normalizedType:"number",castAs:"DECIMAL(65, 10)"},CHAR:{normalizedType:"string",castAs:"CHAR"},VARCHAR:{normalizedType:"string",castAs:"CHAR"},TEXT:{normalizedType:"string",castAs:"CHAR"},TINYTEXT:{normalizedType:"string",castAs:"CHAR"},MEDIUMTEXT:{normalizedType:"string",castAs:"CHAR"},LONGTEXT:{normalizedType:"string",castAs:"CHAR"},DATE:{normalizedType:"date_time"},DATETIME:{normalizedType:"date_time"},TIMESTAMP:{normalizedType:"date_time",castAs:"DATETIME"},BOOLEAN:{normalizedType:"boolean"},BOOL:{normalizedType:"boolean"}},redshift:{SUPER:{normalizedType:"string[]"},UUID:{normalizedType:"string"},DECIMAL:{normalizedType:"number"},NUMERIC:{normalizedType:"number"},INT:{normalizedType:"number",numberCanOnlyBeInteger:!0},INTEGER:{normalizedType:"number",numberCanOnlyBeInteger:!0},BIGINT:{normalizedType:"number",numberCanOnlyBeInteger:!0},SMALLINT:{normalizedType:"number",numberCanOnlyBeInteger:!0},DOUBLEPRECISION:{normalizedType:"number",castAs:"DOUBLE PRECISION"},"DOUBLE PRECISION":{normalizedType:"number"},REAL:{normalizedType:"number"},FLOAT:{normalizedType:"number"},NUMBER:{normalizedType:"number"},BINARY:{normalizedType:"string"},VARBINARY:{normalizedType:"string"},CHAR:{normalizedType:"string"},CHARACTER:{normalizedType:"string"},"CHARACTER VARYING":{normalizedType:"string"},TEXT:{normalizedType:"string"},VARCHAR:{normalizedType:"string"},TIME:{normalizedType:"date_time"},DATE:{normalizedType:"date_time"},TIMESTAMP_LTZ:{normalizedType:"date_time"},TIMESTAMP_NTZ:{normalizedType:"date_time"},TIMESTAMP_TZ:{normalizedType:"date_time"},TIMESTAMP:{normalizedType:"date_time"},BOOLEAN:{normalizedType:"boolean"},"TIMESTAMP WITH TIME ZONE":{normalizedType:"date_time"},"TIMESTAMP WITHOUT TIME ZONE":{normalizedType:"date_time"},ARRAY:{normalizedType:"string[]"}}};var qA={},WA={};Object.defineProperty(WA,"__esModule",{value:!0});var hA={};Object.defineProperty(hA,"__esModule",{value:!0});var mA={};Object.defineProperty(mA,"__esModule",{value:!0});(function(t){var e=O0&&O0.__createBinding||(Object.create?function(n,b,a,O){O===void 0&&(O=a);var A=Object.getOwnPropertyDescriptor(b,a);(!A||("get"in A?!b.__esModule:A.writable||A.configurable))&&(A={enumerable:!0,get:function(){return b[a]}}),Object.defineProperty(n,O,A)}:function(n,b,a,O){O===void 0&&(O=a),n[O]=b[a]}),o=O0&&O0.__exportStar||function(n,b){for(var a in n)a!=="default"&&!Object.prototype.hasOwnProperty.call(b,a)&&e(b,n,a)};Object.defineProperty(t,"__esModule",{value:!0}),o(WA,t),o(hA,t),o(mA,t)})(qA);var wn={},DM={};Object.defineProperty(DM,"__esModule",{value:!0});class p6 extends Error{constructor(e){super(`Field with ID ${e} does not exist in the data set.`),this.name="MissingField",this.fieldId=e}}DM.default=p6;var a6=O0&&O0.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(wn,"__esModule",{value:!0});wn.findFieldById=wn.fromTable=void 0;const M6=a6(DM),z6=P0,c6=t=>{let e=(0,z6.find)(t.fields||[],n=>"address"in n);return(t.joins||[]).length==0?e.address:t.joins[0].left};wn.fromTable=c6;const s6=(t,e)=>{const o=t.fields.find(n=>n.id==e);if(!o)throw new M6.default(e);return o};wn.findFieldById=s6;var gA={},IM={};Object.defineProperty(IM,"__esModule",{value:!0});IM.upCastQuery=void 0;const cO=P0,Ji=t=>(0,cO.isArray)(t)?{type:"orWhere",value:t.map(e=>({type:"andWhere",value:e.map(o=>(o.field.type==="subquery"&&(o.field.value.filter=Ji(o.field.value.filter)),{type:"where",value:o}))}))}:t,Ca=t=>{if(t.type==="subquery"){const e=(0,cO.isArray)(t.value.filter)?Ji(t.value.filter):t.value.filter;return Object.assign(Object.assign({},t),{value:{measure:t.value.measure.map(Ca),filter:e}})}else if(t.type==="maths")return{left:Ca(t.left),right:Ca(t.right),op:t.op,type:t.type};return t},O6=t=>Object.assign(Object.assign({},t),{measure:t.measure.map(e=>Ca(e)),filter:(0,cO.isArray)(t.filter)?Ji(t.filter):t.filter}),l6=t=>{if(t.preparedQueryType==="preAggregated"){const e={};return Object.keys(t.filter).forEach(o=>{e[o]=Ji(t.filter[o])}),Object.assign(Object.assign({},t),{filter:e})}return Object.assign(Object.assign({},t),{filter:Ji(t.filter)})},A6=t=>t.type==="query"?O6(t):l6(t);IM.upCastQuery=A6;(function(t){var e=O0&&O0.__createBinding||(Object.create?function(n,b,a,O){O===void 0&&(O=a);var A=Object.getOwnPropertyDescriptor(b,a);(!A||("get"in A?!b.__esModule:A.writable||A.configurable))&&(A={enumerable:!0,get:function(){return b[a]}}),Object.defineProperty(n,O,A)}:function(n,b,a,O){O===void 0&&(O=a),n[O]=b[a]}),o=O0&&O0.__exportStar||function(n,b){for(var a in n)a!=="default"&&!Object.prototype.hasOwnProperty.call(b,a)&&e(b,n,a)};Object.defineProperty(t,"__esModule",{value:!0}),o(IM,t)})(gA);var yA={};(function(t){var e=O0&&O0.__createBinding||(Object.create?function(n,b,a,O){O===void 0&&(O=a);var A=Object.getOwnPropertyDescriptor(b,a);(!A||("get"in A?!b.__esModule:A.writable||A.configurable))&&(A={enumerable:!0,get:function(){return b[a]}}),Object.defineProperty(n,O,A)}:function(n,b,a,O){O===void 0&&(O=a),n[O]=b[a]}),o=O0&&O0.__exportStar||function(n,b){for(var a in n)a!=="default"&&!Object.prototype.hasOwnProperty.call(b,a)&&e(b,n,a)};Object.defineProperty(t,"__esModule",{value:!0}),o(DM,t)})(yA);var PM={};Object.defineProperty(PM,"__esModule",{value:!0});PM.lowestCommonGranularity=void 0;const gs=[void 0,null,"none","truncSecond","second","truncMinute","minute","truncHour","hour","truncDay","day","truncWeek","week","truncMonth","month","truncQuarter","quarter","truncYear","year"],d6=(...t)=>t.includes(void 0)||t.includes(null)||t.some(e=>!gs.includes(e))?"none":t.sort((e,o)=>{const n=gs.indexOf(e),b=gs.indexOf(o);return n===-1||b===-1?0:n-b})[0];PM.lowestCommonGranularity=d6;(function(t){var e=O0&&O0.__createBinding||(Object.create?function(A,c,y,v){v===void 0&&(v=y);var N=Object.getOwnPropertyDescriptor(c,y);(!N||("get"in N?!c.__esModule:N.writable||N.configurable))&&(N={enumerable:!0,get:function(){return c[y]}}),Object.defineProperty(A,v,N)}:function(A,c,y,v){v===void 0&&(v=y),A[v]=c[y]}),o=O0&&O0.__setModuleDefault||(Object.create?function(A,c){Object.defineProperty(A,"default",{enumerable:!0,value:c})}:function(A,c){A.default=c}),n=O0&&O0.__exportStar||function(A,c){for(var y in A)y!=="default"&&!Object.prototype.hasOwnProperty.call(c,y)&&e(c,A,y)},b=O0&&O0.__importStar||function(A){if(A&&A.__esModule)return A;var c={};if(A!=null)for(var y in A)y!=="default"&&Object.prototype.hasOwnProperty.call(A,y)&&e(c,A,y);return o(c,A),c};Object.defineProperty(t,"__esModule",{value:!0}),t.getNativeDataTypesOfNormalizedType=t.DATE_MATHS_OPERATORS=t.NORMALIZED_DATA_TYPES=t.DateFunctions=t.Errors=t.QueryLogic=t.DataSet=void 0;const a=Zi;n(Zi,t),n(qA,t),t.DataSet=b(wn),t.QueryLogic=b(gA),t.Errors=b(yA),t.DateFunctions=b(PM),t.NORMALIZED_DATA_TYPES=["number","boolean","string","date_time","string[]"],t.DATE_MATHS_OPERATORS=["seconds_between","minutes_between","hours_between","days_between"];const O=(A,c)=>Object.keys(a.NATIVE_DATA_TYPES_DATABASE[A]).filter(v=>a.NATIVE_DATA_TYPES_DATABASE[A][v].normalizedType===c);t.getNativeDataTypesOfNormalizedType=O})(fA);Object.defineProperty(B2,"__esModule",{value:!0});B2.ENVIRONMENT_VARIABLES_TO_REQUIRED=B2.vizzlyToPossibleNativeDataTypes=B2.NATIVE_DATA_TYPES=B2.SUPPORTED_CLIENTS=void 0;const u6=P0,RA=fA;B2.SUPPORTED_CLIENTS=["bigquery","mariadb","postgres","snowflake","mysql","microsoftSQLServer","redshift"];const dr=t=>(0,u6.reduce)(Object.keys(RA.NATIVE_DATA_TYPES_DATABASE[t]),(e,o)=>Object.assign(Object.assign({},e),{[o]:o}),{});B2.NATIVE_DATA_TYPES={mysql:dr("mysql"),snowflake:dr("snowflake"),postgres:dr("postgres"),redshift:dr("redshift"),mariadb:dr("mariadb"),bigquery:dr("bigquery"),microsoftSQLServer:dr("microsoftSQLServer")};const f6=(t,e)=>{let o=[];return Object.entries(RA.NATIVE_DATA_TYPES_DATABASE[t]).forEach(([n,{normalizedType:b}])=>{b==e&&(o=[...o,n])}),o};B2.vizzlyToPossibleNativeDataTypes=f6;B2.ENVIRONMENT_VARIABLES_TO_REQUIRED={postgres:{VIZZLY_POSTGRES_PASSWORD:!0,VIZZLY_POSTGRES_DATABASE:!0,VIZZLY_POSTGRES_USER:!0,VIZZLY_POSTGRES_HOST:!0,VIZZLY_POSTGRES_PORT:!1},mariadb:{VIZZLY_MARIADB_PASSWORD:!0,VIZZLY_MARIADB_DATABASE:!0,VIZZLY_MARIADB_USER:!0,VIZZLY_MARIADB_HOST:!0,VIZZLY_MARIADB_PORT:!1},mysql:{VIZZLY_MYSQL_PASSWORD:!0,VIZZLY_MYSQL_DATABASE:!0,VIZZLY_MYSQL_USER:!0,VIZZLY_MYSQL_HOST:!0,VIZZLY_MYSQL_PORT:!1},elasticsearch:{VIZZLY_ELASTICSEARCH_CLOUD_ID:!0,VIZZLY_ELASTICSEARCH_API_KEY:!0,VIZZLY_ELASTICSEARCH_NODE:!0,VIZZLY_ELASTICSEARCH_USERNAME:!0,VIZZLY_ELASTICSEARCH_PASSWORD:!0,VIZZLY_ELASTICSEARCH_API_KEY_ID:!0},bigquery:{VIZZLY_BIGQUERY_PROJECT_ID:!0,VIZZLY_BIGQUERY_REGION:!0,VIZZLY_BIGQUERY_KEY_FILENAME:!1,VIZZLY_BIGQUERY_CREDENTIALS:!1},snowflake:{VIZZLY_SNOWFLAKE_PASSWORD:!0,VIZZLY_SNOWFLAKE_DATABASE:!1,VIZZLY_SNOWFLAKE_USERNAME:!0,VIZZLY_SNOWFLAKE_ACCOUNT:!0,VIZZLY_SNOWFLAKE_WAREHOUSE:!0,VIZZLY_SNOWFLAKE_ROLE:!0,VIZZLY_SNOWFLAKE_SCHEMA:!1,VIZZLY_SNOWFLAKE_SESSION_KEEP_ALIVE:!1},microsoftSQLServer:{VIZZLY_MICROSOFT_SQL_SERVER_PASSWORD:!0,VIZZLY_MICROSOFT_SQL_SERVER_DATABASE:!0,VIZZLY_MICROSOFT_SQL_SERVER_USER:!0,VIZZLY_MICROSOFT_SQL_SERVER_HOST:!0,VIZZLY_MICROSOFT_SQL_SERVER_PORT:!1}};var FM={};Object.defineProperty(FM,"__esModule",{value:!0});FM.DataSetNotLinkedToConnection=void 0;class q6 extends Error{constructor(e){super(`Data set ${e} must be linked to a connection by setting a 'connectionId' property that references a connection in the 'connections' section.`),this.name="DataSetNotLinkedToConnection"}}FM.DataSetNotLinkedToConnection=q6;(function(t){var e=O0&&O0.__importDefault||function(L){return L&&L.__esModule?L:{default:L}};Object.defineProperty(t,"__esModule",{value:!0}),t.redshiftSchema=t.microsoftSQLServerSchema=t.snowflakeSchema=t.mySQLSchema=t.mariadbSchema=t.postgresSchema=t.bigQuerySchema=t._sqlDataSetSchema=t._fieldSchema=t.ID_REGEX_ERROR_MESSAGE=t.ALLOWED_ID_REGEX=void 0;const o=e(uA),n=Rb,b=B2,a=W1,O=$t,A=FM,c=["unencryptedCredentials","encryptedCredentials"],y=Object.keys(O.supportedOperatorsConstants),v=["rightJoin","leftJoin","innerJoin","outerJoin","leftOuterJoin","rightOuterJoin"];t.ALLOWED_ID_REGEX=/^[a-zA-Z0-9_+:\/=\-\s]*$/,t.ID_REGEX_ERROR_MESSAGE="IDs must only use alpha numeric characters and _";const N={checkConnectionSpecificDataSets:!0},s={abortEarly:!1,allowUnknown:!0},u=L=>o.default.object({id:o.default.string().required().regex(t.ALLOWED_ID_REGEX,t.ID_REGEX_ERROR_MESSAGE).description("A unique identifier for this field. It should not change unless the meaning of the field, or the data type has changed."),publicName:o.default.string().optional().allow("").description("The name of this field that you want your users to see. This can be changed as much as you like without causing a breaking change."),address:o.default.array().items(o.default.string()).optional().description('The address of the column in your database. For example; ["database_name", "table_name", "column_name"] or for BigQuery; ["bigquery project id", "bigquery data set id", "table name", "column name"]'),description:o.default.string().allow("").optional().max(110).description("A description of what the purpose of this data set is"),sql:o.default.string().optional().description("Provide a SQL definition of the field, instead of a table & name combination."),dataType:o.default.valid(...Object.values(b.NATIVE_DATA_TYPES[L])).required(),canBeDimension:o.default.boolean().optional().description("Can this field be used in groupings?"),canBeMeasure:o.default.boolean().optional().description("Can this field be used in aggregations?"),canBeUsedInSort:o.default.boolean().optional().description("__vizzly_hide_from_docs"),allowedGranularities:o.default.array().items(o.default.string().valid(...Object.keys((0,n.getQueryEngineConfig)(L).supportedTimeTruncFunctions))).optional(),allowedOperators:o.default.alternatives().conditional("..dataType",{is:o.default.string().valid(...(0,b.vizzlyToPossibleNativeDataTypes)(L,"string")),then:o.default.array().items(o.default.string().valid(...(0,a.validOperatorsForField)({dataType:"string"},(0,n.getQueryEngineConfig)(L)))).description("For fields that have a string data type.")}).conditional("..dataType",{is:o.default.string().valid(...(0,b.vizzlyToPossibleNativeDataTypes)(L,"number")),then:o.default.array().items(o.default.string().valid(...(0,a.validOperatorsForField)({dataType:"number"},(0,n.getQueryEngineConfig)(L)))).description("For fields that have a number data type.")}).conditional("..dataType",{is:o.default.string().valid(...(0,b.vizzlyToPossibleNativeDataTypes)(L,"date_time")),then:o.default.array().items(o.default.valid(...(0,a.validOperatorsForField)({dataType:"date_time"},(0,n.getQueryEngineConfig)(L)))).description("For fields that have a date time data type.")}).conditional("..dataType",{is:o.default.string().valid(...(0,b.vizzlyToPossibleNativeDataTypes)(L,"boolean")),then:o.default.array().items(o.default.string().valid(...(0,a.validOperatorsForField)({dataType:"boolean"},(0,n.getQueryEngineConfig)(L)))).description("For fields that have a boolean data type.")}).conditional("..dataType",{is:o.default.string().valid(...(0,b.vizzlyToPossibleNativeDataTypes)(L,"string[]")),then:o.default.array().items(o.default.string().valid(...(0,a.validOperatorsForField)({dataType:"string[]"},(0,n.getQueryEngineConfig)(L)))).description("For fields that have a string array data type.")}).optional()});t._fieldSchema=u;const d=o.default.object({type:o.default.string().valid(...v).required(),left:o.default.array().items(o.default.string()).required(),right:o.default.array().items(o.default.string()).required(),as:o.default.string().optional()}),z=o.default.object({fieldId:o.default.string().required(),op:o.default.string().valid(...y).required()}),M=L=>({id:o.default.string().required().regex(t.ALLOWED_ID_REGEX,t.ID_REGEX_ERROR_MESSAGE).description("A unique ID for the data set. This should not change unless the meaning of the data set represents changes."),connectionId:o.default.string().required().description("Reference the connection to use for this data set."),hide:o.default.boolean().optional().description("Hide the data set from the dashboard."),name:o.default.string().required().description("A public name for the data set. This can change as much as you like without causing a breaking change."),description:o.default.string().allow("").optional().max(110).description("A description of what this field represents"),sql:o.default.string().optional().description("Optionally define the data set using a SQL statement. If used, the `table` value for each field should equal `vizzly_data_set`."),testParameters:o.default.string().optional().description("Test parameters that are used when creating SQL backed data sets. This is a stringified JSON object."),preAggregated:o.default.alternatives(o.default.array().items(o.default.string()).description("Array of data set IDs relied on by the pre-aggregated data set"),o.default.boolean().allow(!1).description("Only `False` is a valid boolean option. For truthy values, provide an array of data set IDs")).optional().description("Optional - For pre-aggregated data sets or SQL views, provide a list of data sets that are relied upon."),fields:o.default.array().min(1).items(L).unique("id").message("Field IDs must be unique").required(),permanentFilters:o.default.object({type:o.default.valid("andWhere","orWhere","where"),value:o.default.array()}),secureFilterGuards:o.default.array().items(z).optional()}),q=L=>o.default.object(Object.assign(Object.assign({},M(L)),{joins:o.default.array().items(d).unique((T,X)=>{const C=JSON.stringify(T.right)===JSON.stringify(X.right);return!T.as&&!X.as&&C}).message("A table cannot be referenced in a right join multiple times.").optional()}));t._sqlDataSetSchema=q;const l=L=>{var T;if(((T=L.onlyClients)===null||T===void 0?void 0:T.length)===1)return(0,t._sqlDataSetSchema)((0,t._fieldSchema)(L.onlyClients[0]));const X=o.default.alternatives(...(L.onlyClients||b.SUPPORTED_CLIENTS).map(C=>(0,t._sqlDataSetSchema)((0,t._fieldSchema)(C))));if(L.dataSetIdToClientMapping){const C=Object.entries(L.dataSetIdToClientMapping).map(([m,w])=>({is:m,then:(0,t._sqlDataSetSchema)((0,t._fieldSchema)(w))}));return o.default.alternatives().conditional(".id",[...C,{is:!0,then:X}])}return X},f=(L,T)=>o.default.object({version:o.default.number(),connections:o.default.object().pattern(o.default.string(),o.default.object({client:o.default.string().allow(...b.SUPPORTED_CLIENTS).required(),name:o.default.string().optional().allow(""),encryptedCredentials:o.default.string().optional(),unencryptedCredentials:o.default.alternatives(o.default.string(),o.default.object()).optional()})),dataSets:o.default.array().items(T.checkConnectionSpecificDataSets?o.default.object().custom(X=>{var C,m;const w=X.connectionId||"___vizzly_default_conn",E=(m=(C=L?.connections)===null||C===void 0?void 0:C[w])===null||m===void 0?void 0:m.client;if(!E)throw new A.DataSetNotLinkedToConnection(X.id);const U=(0,t._sqlDataSetSchema)((0,t._fieldSchema)(E)).validate(X,s);if(U.error)throw U.error;return X},"Data sets linked to connections"):l(T)).unique("id").message("dataSet[x].id must be unique.").required(),executableDashboardConfigForPDF:o.default.string().allow(null).optional().description("JavaScript dashboard config for server-side generated PDFs"),publicKeys:o.default.array().items(o.default.string()).optional(),sqlViews:o.default.object().pattern(o.default.string(),o.default.object({name:o.default.string().required(),sql:o.default.string().allow("").required()})).optional()});t.bigQuerySchema=f({},{onlyClients:["bigquery"]}),t.postgresSchema=f({},{onlyClients:["postgres"]}),t.mariadbSchema=f({},{onlyClients:["mariadb"]}),t.mySQLSchema=f({},{onlyClients:["mysql"]}),t.snowflakeSchema=f({},{onlyClients:["snowflake"]}),t.microsoftSQLServerSchema=f({},{onlyClients:["microsoftSQLServer"]}),t.redshiftSchema=f({},{onlyClients:["redshift"]}),t.default=(L,T={})=>{const X=f(L,Object.assign(Object.assign(Object.assign({},N),T),{dataSetIdToClientMapping:g(L)})).validate(L,s);return X.error&&X.error.details.map(C=>{var m,w;c.includes(((m=C.context)===null||m===void 0?void 0:m.key)||"")&&!((w=C.context)===null||w===void 0)&&w.value&&(C.context.value="-- VIZZLY REDACTED --")}),X};const g=L=>{let T={};return L&&typeof L?.dataSets=="object"&&typeof L?.connections=="object"&&L.dataSets.forEach(X=>{var C,m;if(T){const w=X.connectionId||"___vizzly_default_conn",E=(m=(C=L?.connections)===null||C===void 0?void 0:C[w])===null||m===void 0?void 0:m.client;E&&(T[X.id]=E)}}),T}})(AA);(function(t){var e=O0&&O0.__createBinding||(Object.create?function(O,A,c,y){y===void 0&&(y=c);var v=Object.getOwnPropertyDescriptor(A,c);(!v||("get"in v?!A.__esModule:v.writable||v.configurable))&&(v={enumerable:!0,get:function(){return A[c]}}),Object.defineProperty(O,y,v)}:function(O,A,c,y){y===void 0&&(y=c),O[y]=A[c]}),o=O0&&O0.__setModuleDefault||(Object.create?function(O,A){Object.defineProperty(O,"default",{enumerable:!0,value:A})}:function(O,A){O.default=A}),n=O0&&O0.__importStar||function(O){if(O&&O.__esModule)return O;var A={};if(O!=null)for(var c in O)c!=="default"&&Object.prototype.hasOwnProperty.call(O,c)&&e(A,O,c);return o(A,O),A};Object.defineProperty(t,"__esModule",{value:!0}),t.Schemas=t.ID_REGEX_ERROR_MESSAGE=t.ALLOWED_ID_REGEX=t.validate=void 0;const b=n(AA);t.validate=b.default,Object.defineProperty(t,"ALLOWED_ID_REGEX",{enumerable:!0,get:function(){return b.ALLOWED_ID_REGEX}}),Object.defineProperty(t,"ID_REGEX_ERROR_MESSAGE",{enumerable:!0,get:function(){return b.ID_REGEX_ERROR_MESSAGE}});const a={bigQuery:b.bigQuerySchema,postgres:b.postgresSchema,mariadb:b.mariadbSchema,mySQL:b.mySQLSchema,snowflake:b.snowflakeSchema,microsoftSQLServer:b.microsoftSQLServerSchema,redshift:b.redshiftSchema};t.Schemas=a})(lA);var LA={};Object.defineProperty(LA,"__esModule",{value:!0});var vA={},kM={};Object.defineProperty(kM,"__esModule",{value:!0});kM.ianaTimeZonesDb=void 0;kM.ianaTimeZonesDb=["Africa/Abidjan","Africa/Accra","Africa/Addis_Ababa","Africa/Algiers","Africa/Asmera","Africa/Bamako","Africa/Bangui","Africa/Banjul","Africa/Bissau","Africa/Blantyre","Africa/Brazzaville","Africa/Bujumbura","Africa/Cairo","Africa/Casablanca","Africa/Ceuta","Africa/Conakry","Africa/Dakar","Africa/Dar_es_Salaam","Africa/Djibouti","Africa/Douala","Africa/El_Aaiun","Africa/Freetown","Africa/Gaborone","Africa/Harare","Africa/Johannesburg","Africa/Juba","Africa/Kampala","Africa/Khartoum","Africa/Kigali","Africa/Kinshasa","Africa/Lagos","Africa/Libreville","Africa/Lome","Africa/Luanda","Africa/Lubumbashi","Africa/Lusaka","Africa/Malabo","Africa/Maputo","Africa/Maseru","Africa/Mbabane","Africa/Mogadishu","Africa/Monrovia","Africa/Nairobi","Africa/Ndjamena","Africa/Niamey","Africa/Nouakchott","Africa/Ouagadougou","Africa/Porto-Novo","Africa/Sao_Tome","Africa/Tripoli","Africa/Tunis","Africa/Windhoek","America/Adak","America/Anchorage","America/Anguilla","America/Antigua","America/Araguaina","America/Argentina/La_Rioja","America/Argentina/Rio_Gallegos","America/Argentina/Salta","America/Argentina/San_Juan","America/Argentina/San_Luis","America/Argentina/Tucuman","America/Argentina/Ushuaia","America/Aruba","America/Asuncion","America/Bahia","America/Bahia_Banderas","America/Barbados","America/Belem","America/Belize","America/Blanc-Sablon","America/Boa_Vista","America/Bogota","America/Boise","America/Buenos_Aires","America/Cambridge_Bay","America/Campo_Grande","America/Cancun","America/Caracas","America/Catamarca","America/Cayenne","America/Cayman","America/Chicago","America/Chihuahua","America/Ciudad_Juarez","America/Coral_Harbour","America/Cordoba","America/Costa_Rica","America/Creston","America/Cuiaba","America/Curacao","America/Danmarkshavn","America/Dawson","America/Dawson_Creek","America/Denver","America/Detroit","America/Dominica","America/Edmonton","America/Eirunepe","America/El_Salvador","America/Fort_Nelson","America/Fortaleza","America/Glace_Bay","America/Godthab","America/Goose_Bay","America/Grand_Turk","America/Grenada","America/Guadeloupe","America/Guatemala","America/Guayaquil","America/Guyana","America/Halifax","America/Havana","America/Hermosillo","America/Indiana/Knox","America/Indiana/Marengo","America/Indiana/Petersburg","America/Indiana/Tell_City","America/Indiana/Vevay","America/Indiana/Vincennes","America/Indiana/Winamac","America/Indianapolis","America/Inuvik","America/Iqaluit","America/Jamaica","America/Jujuy","America/Juneau","America/Kentucky/Monticello","America/Kralendijk","America/La_Paz","America/Lima","America/Los_Angeles","America/Louisville","America/Lower_Princes","America/Maceio","America/Managua","America/Manaus","America/Marigot","America/Martinique","America/Matamoros","America/Mazatlan","America/Mendoza","America/Menominee","America/Merida","America/Metlakatla","America/Mexico_City","America/Miquelon","America/Moncton","America/Monterrey","America/Montevideo","America/Montserrat","America/Nassau","America/New_York","America/Nome","America/Noronha","America/North_Dakota/Beulah","America/North_Dakota/Center","America/North_Dakota/New_Salem","America/Ojinaga","America/Panama","America/Paramaribo","America/Phoenix","America/Port-au-Prince","America/Port_of_Spain","America/Porto_Velho","America/Puerto_Rico","America/Punta_Arenas","America/Rankin_Inlet","America/Recife","America/Regina","America/Resolute","America/Rio_Branco","America/Santarem","America/Santiago","America/Santo_Domingo","America/Sao_Paulo","America/Scoresbysund","America/Sitka","America/St_Barthelemy","America/St_Johns","America/St_Kitts","America/St_Lucia","America/St_Thomas","America/St_Vincent","America/Swift_Current","America/Tegucigalpa","America/Thule","America/Tijuana","America/Toronto","America/Tortola","America/Vancouver","America/Whitehorse","America/Winnipeg","America/Yakutat","Antarctica/Casey","Antarctica/Davis","Antarctica/DumontDUrville","Antarctica/Macquarie","Antarctica/Mawson","Antarctica/McMurdo","Antarctica/Palmer","Antarctica/Rothera","Antarctica/Syowa","Antarctica/Troll","Antarctica/Vostok","Arctic/Longyearbyen","Asia/Aden","Asia/Almaty","Asia/Amman","Asia/Anadyr","Asia/Aqtau","Asia/Aqtobe","Asia/Ashgabat","Asia/Atyrau","Asia/Baghdad","Asia/Bahrain","Asia/Baku","Asia/Bangkok","Asia/Barnaul","Asia/Beirut","Asia/Bishkek","Asia/Brunei","Asia/Calcutta","Asia/Chita","Asia/Choibalsan","Asia/Colombo","Asia/Damascus","Asia/Dhaka","Asia/Dili","Asia/Dubai","Asia/Dushanbe","Asia/Famagusta","Asia/Gaza","Asia/Hebron","Asia/Hong_Kong","Asia/Hovd","Asia/Irkutsk","Asia/Jakarta","Asia/Jayapura","Asia/Jerusalem","Asia/Kabul","Asia/Kamchatka","Asia/Karachi","Asia/Katmandu","Asia/Khandyga","Asia/Krasnoyarsk","Asia/Kuala_Lumpur","Asia/Kuching","Asia/Kuwait","Asia/Macau","Asia/Magadan","Asia/Makassar","Asia/Manila","Asia/Muscat","Asia/Nicosia","Asia/Novokuznetsk","Asia/Novosibirsk","Asia/Omsk","Asia/Oral","Asia/Phnom_Penh","Asia/Pontianak","Asia/Pyongyang","Asia/Qatar","Asia/Qostanay","Asia/Qyzylorda","Asia/Rangoon","Asia/Riyadh","Asia/Saigon","Asia/Sakhalin","Asia/Samarkand","Asia/Seoul","Asia/Shanghai","Asia/Singapore","Asia/Srednekolymsk","Asia/Taipei","Asia/Tashkent","Asia/Tbilisi","Asia/Tehran","Asia/Thimphu","Asia/Tokyo","Asia/Tomsk","Asia/Ulaanbaatar","Asia/Urumqi","Asia/Ust-Nera","Asia/Vientiane","Asia/Vladivostok","Asia/Yakutsk","Asia/Yekaterinburg","Asia/Yerevan","Atlantic/Azores","Atlantic/Bermuda","Atlantic/Canary","Atlantic/Cape_Verde","Atlantic/Faeroe","Atlantic/Madeira","Atlantic/Reykjavik","Atlantic/South_Georgia","Atlantic/St_Helena","Atlantic/Stanley","Australia/Adelaide","Australia/Brisbane","Australia/Broken_Hill","Australia/Darwin","Australia/Eucla","Australia/Hobart","Australia/Lindeman","Australia/Lord_Howe","Australia/Melbourne","Australia/Perth","Australia/Sydney","Europe/Amsterdam","Europe/Andorra","Europe/Astrakhan","Europe/Athens","Europe/Belgrade","Europe/Berlin","Europe/Bratislava","Europe/Brussels","Europe/Bucharest","Europe/Budapest","Europe/Busingen","Europe/Chisinau","Europe/Copenhagen","Europe/Dublin","Europe/Gibraltar","Europe/Guernsey","Europe/Helsinki","Europe/Isle_of_Man","Europe/Istanbul","Europe/Jersey","Europe/Kaliningrad","Europe/Kiev","Europe/Kirov","Europe/Lisbon","Europe/Ljubljana","Europe/London","Europe/Luxembourg","Europe/Madrid","Europe/Malta","Europe/Mariehamn","Europe/Minsk","Europe/Monaco","Europe/Moscow","Europe/Oslo","Europe/Paris","Europe/Podgorica","Europe/Prague","Europe/Riga","Europe/Rome","Europe/Samara","Europe/San_Marino","Europe/Sarajevo","Europe/Saratov","Europe/Simferopol","Europe/Skopje","Europe/Sofia","Europe/Stockholm","Europe/Tallinn","Europe/Tirane","Europe/Ulyanovsk","Europe/Vaduz","Europe/Vatican","Europe/Vienna","Europe/Vilnius","Europe/Volgograd","Europe/Warsaw","Europe/Zagreb","Europe/Zurich","Indian/Antananarivo","Indian/Chagos","Indian/Christmas","Indian/Cocos","Indian/Comoro","Indian/Kerguelen","Indian/Mahe","Indian/Maldives","Indian/Mauritius","Indian/Mayotte","Indian/Reunion","Pacific/Apia","Pacific/Auckland","Pacific/Bougainville","Pacific/Chatham","Pacific/Easter","Pacific/Efate","Pacific/Enderbury","Pacific/Fakaofo","Pacific/Fiji","Pacific/Funafuti","Pacific/Galapagos","Pacific/Gambier","Pacific/Guadalcanal","Pacific/Guam","Pacific/Honolulu","Pacific/Kiritimati","Pacific/Kosrae","Pacific/Kwajalein","Pacific/Majuro","Pacific/Marquesas","Pacific/Midway","Pacific/Nauru","Pacific/Niue","Pacific/Norfolk","Pacific/Noumea","Pacific/Pago_Pago","Pacific/Palau","Pacific/Pitcairn","Pacific/Ponape","Pacific/Port_Moresby","Pacific/Rarotonga","Pacific/Saipan","Pacific/Tahiti","Pacific/Tarawa","Pacific/Tongatapu","Pacific/Truk","Pacific/Wake","Pacific/Wallis"];(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ianaTimeZones=t.ETC_UTC_TIME_ZONE=void 0,t.ETC_UTC_TIME_ZONE="Etc/UTC";const e=kM,o=()=>[t.ETC_UTC_TIME_ZONE,...e.ianaTimeZonesDb];t.ianaTimeZones=o})(vA);(function(t){var e=O0&&O0.__createBinding||(Object.create?function(a,O,A,c){c===void 0&&(c=A);var y=Object.getOwnPropertyDescriptor(O,A);(!y||("get"in y?!O.__esModule:y.writable||y.configurable))&&(y={enumerable:!0,get:function(){return O[A]}}),Object.defineProperty(a,c,y)}:function(a,O,A,c){c===void 0&&(c=A),a[c]=O[A]}),o=O0&&O0.__setModuleDefault||(Object.create?function(a,O){Object.defineProperty(a,"default",{enumerable:!0,value:O})}:function(a,O){a.default=O}),n=O0&&O0.__importStar||function(a){if(a&&a.__esModule)return a;var O={};if(a!=null)for(var A in a)A!=="default"&&Object.prototype.hasOwnProperty.call(a,A)&&e(O,a,A);return o(O,a),O},b=O0&&O0.__exportStar||function(a,O){for(var A in a)A!=="default"&&!Object.prototype.hasOwnProperty.call(O,A)&&e(O,a,A)};Object.defineProperty(t,"__esModule",{value:!0}),t.VizzlyConfig=t.QueryEngineConfig=void 0,t.QueryEngineConfig=n(OA),t.VizzlyConfig=n(lA),b(LA,t),b(vA,t)})(Ut);const W6=Ut.QueryEngineConfig.Constants.timeDimensionsConstants,h6=t=>!t?.truncate||t?.truncate=="none"?t?.field:`${t.field}_${t.truncate}`,m6=(t,e)=>{const o=t.split("_"),n=o.pop();return n&&!_A(e,n)?null:{field:o.join("_"),truncate:n??""}},_A=(t,e)=>[...Object.keys(t),"none"].includes(e),NA=Ut.QueryEngineConfig.Constants.supportedOperatorsConstants,g6=(t,e)=>{let o=[...Object.keys(e.supportedOperators)];return o=o.filter(n=>y6[n].validDataTypes.includes(t.dataType)),o},y6=NA,V1=t=>t.map(e=>e.map(o=>(o.op=="is_one_of"||o.op=="is_not_one_of")&&!P0.isArray(o.value)?{...o,value:[o.value]}:o)),me=(t,e)=>t.map(o=>{let n={...o,aggregate:void 0,function:o.function||o.aggregate};return delete n.aggregate,e&&n.field==e.field&&n.function=="none"&&(n.function=e.truncate),n}),g1=t=>t.map(e=>{let o={...e,aggregate:void 0,function:e.function||e.aggregate};return delete o.aggregate,o}),y1=t=>t==="auto"||t===0||t===2?t:"auto",ut=t=>{if(!t)return{};let e={};return t.measure&&Object.entries(t.measure).forEach(([o,n])=>{e&&(e[o]=g1(n))}),{measure:P0.isEmpty(e)?void 0:e,group:t.group}},TA=Ut.QueryEngineConfig.Constants.supportedAggregatesConstants,R6=TA,L6=t=>P0.cloneDeep(R6),v6=(t,e)=>[...Object.keys(t),"none"].includes(e),_6=t=>t.charAt(0).toUpperCase()+t.slice(1),BA=(t,e,o)=>{const n=P0.replace(t,e,o);return n.indexOf(e)>=0?BA(n,e,o):n},N6=t=>_6(BA(t,"_"," ")),al=["debug","info","warning","error","properties"];let T6="error";const jM=t=>{const e=al.findIndex(n=>T6==n),o=al.findIndex(n=>t==n);return e<=o},$M=t=>t instanceof Error?t:P0.isObject(t)||P0.isArray(t)?JSON.stringify(t):t,G1=(...t)=>{jM("debug")&&console.info("[VIZZLY DEBUG]",...t.map($M))},B6=(...t)=>{jM("info")&&console.info("[VIZZLY INFO]",...t.map($M))},SA=(...t)=>{jM("warning")&&console.warn("[VIZZLY WARNING]",...t.map($M))},At=(...t)=>{jM("error")&&console.error("[VIZZLY ERROR]",...t.map($M))};Object.keys(L6());const S6=(t,e,o)=>{const n=w6(t.id);return{id:t.id,dataType:t.dataType,publicName:t.publicName||n,dashboardRequiredFilterGroups:t.dashboardRequiredFilterGroups||[],description:t.description||void 0,canBeDimension:t.canBeDimension===void 0?!0:t.canBeDimension,canBeMeasure:t.canBeMeasure===void 0?!0:t.canBeMeasure,allowedOperators:t.allowedOperators===void 0?g6(t,e):t.allowedOperators,allowedGranularities:t.allowedGranularities===void 0?Object.keys(e.supportedTimeTruncFunctions):t.allowedGranularities,supportedAggregateOptions:D6(e,t.dataType,t.supportedAggregateOptions)}},w6=t=>N6(t),x6=(t,e)=>X6(t,e)[0],X6=(t,e)=>{let o=t.supportedAggregateOptions??[],n=o.filter(b=>Object.keys(e).includes(b)&&e[b].validDataTypes.includes(t.dataType));return n.length===0?n=Object.keys(e).filter(b=>e[b].validDataTypes.includes(t.dataType)):n.sort((b,a)=>{const O=o.indexOf(b),A=o.indexOf(a);return O-A}),n},C6=t=>!t?.function||t?.function=="none"?t?.field:`${t.field}_${t.function}`,wA=(t,e)=>{const o=t.split("_"),n=o.pop();return[void 0,...Object.keys(e.supportedAggregates||{}),...Object.keys(e.supportedTimeTruncFunctions||{}),...Object.keys(e.supportedTransformationFunctions||{})].includes(n)?{field:o.join("_"),function:n??""}:{field:t,function:"none"}},E6=(t,e)=>Object.keys(e).filter(o=>e[o].validDataTypes.includes(t.dataType)),Oe=t=>t.map(e=>typeof e=="string"?{field:e,function:"none"}:e),D6=(t,e,o)=>{const n=t.supportedAggregates,b=Object.keys(n).filter(O=>n[O].validDataTypes.includes(e));o?.forEach(O=>{n.hasOwnProperty(O)||SA(`Unsupported aggregate option: ${O} on ${e}`)});let a=o&&o.length>0?o.filter(O=>b.includes(O)):b;return o&&o.length>0&&a.length===0&&(a=b),a},Vi=C6,I6=wA,P6=(t,e,o)=>{if("measure"in t&&t.measure){const n=k6(t.measure,o);if(n?.function&&n.field===e){const b=Vi(n);delete t.measure[b]}t.measure=Ml(t.measure,e)}if("group"in t&&t.group){const n=F6(t.group,o);if(n?.truncate&&n.field===e){const b=h6(n);delete t.group[b]}else t.group.hasOwnProperty(e)&&delete t.group[e];t.group=Ml(t.group,e)}return t};function F6(t,e){return Object.keys(t).map(o=>{const n=m6(o,e.supportedTimeTruncFunctions);return n?.truncate?n:null}).find(o=>o!==null)}function k6(t,e){return Object.keys(t).map(o=>{const n=I6(o,e);return n?.function?n:null}).find(o=>o!==null)}function Ml(t,e){const o={};for(const[n,b]of Object.entries(t))o[n]=b.filter(a=>a?.field!==e);return o}const Dn=(t,e)=>{let o=P0.remove(t.order,n=>P0.some(e,a=>{const O=a.function==n.function,A=a.field==n.field;return O&&A}));return{...t,order:o}},te=(t,e,o)=>{let n={...t};if("measure"in n&&P0.remove(n.measure,b=>b.field==e),"barMeasure"in n&&P0.remove(n.barMeasure,b=>b.field==e),"lineMeasure"in n&&P0.remove(n.lineMeasure,b=>b.field==e),"xMeasure"in n&&Array.isArray(n.xMeasure)&&P0.remove(n.xMeasure,b=>b.field==e),"yMeasure"in n&&n.yMeasure?.field==e&&(n.yMeasure=null),"order"in n&&P0.remove(n.order,b=>b.field==e),"dimension"in n&&P0.remove(n.dimension,b=>b.field==e),"barDimension"in n&&P0.remove(n.barDimension,b=>b.field==e),"lineDimension"in n&&P0.remove(n.lineDimension,b=>b.field==e),"filter"in n&&n.filter.forEach(b=>{P0.remove(b,a=>a.field==e)}),"parameters"in n&&n.parameters&&o){const b=P6(n.parameters,e,o);n.parameters=b}return"timeDimension"in n&&n.timeDimension?.field==e&&(n.timeDimension=null),n},wt=t=>{let e=[...t.measure];return t.dimension.forEach(o=>{e.push({field:o.field,function:o.function})}),t.timeDimension&&e.push({field:t.timeDimension.field,function:t.timeDimension.truncate}),t=Dn(t,e),t},I1=(t,e,o)=>{let n=Lm(e,t);const{value:b,error:a}=o.validate(n);if(a)throw a;return b},xA=t=>({minutes:{description:"Minutes",formatter:(e,o)=>{e.setMinutes(e.getMinutes()+o)}},hours:{description:"Hours",formatter:(e,o)=>{e.setHours(e.getHours()+o)}},days:{description:"Days",formatter:(e,o)=>{e.setDate(e.getDate()+o)}},weeks:{description:"Weeks",formatter:(e,o)=>{e.setDate(e.getDate()+o*7)}},months:{description:"Months",formatter:(e,o)=>{e.setMonth(e.getMonth()+o)}},years:{description:"Years",formatter:(e,o)=>{e.setFullYear(e.getFullYear()+o)}}}),j6=t=>({future:{description:"Future"},past:{description:"Past"}}),$6=()=>{const t=xA();return Object.keys(t)},U6=()=>{const t=j6();return Object.keys(t)},sO=R.object({unit:R.string().valid(...$6()).required(),value:R.number().integer().required(),timeFrame:R.string().valid(...U6()).required()});function G6(t){const{error:e}=sO.validate(t);return!e}const XA=(t,e)=>{const o=e?new Date(e):new Date;if(!t.value||t.unit===null)throw new Error(`Unrecognized value: ${t.value}`);let n=t.timeFrame==="future"?t.value:-t.value;return xA()[t.unit].formatter(o,n),o},V6=(t,e,o)=>{if(!o)throw new Error("appliesToFields is required");return t.map(n=>{const b=n.map(O=>({op:O.op,value:{...O.value}})),a=[];return o.forEach(O=>{O.dataSetId==e.id&&b.forEach(A=>{a.push({...A,field:O.fieldId})})}),a})},H6=()=>R.object({key:R.string().required()}),H1=()=>R.array().items(H6()).min(0),he=(t,e)=>{const o=(n,b)=>R.object({field:n.required(),function:b.required().description("Which if any, aggregate function should be applied to the field?")});return e?.restrictFields?R.alternatives(...e.restrictFields.filter(n=>n.canBeMeasure).map(n=>{const b=E6(n,t);return o(R.string().valid(n.id).description(`${n.publicName}, ${n.description||""}.`),R.string().valid(...b,"none"))})):o(R.string().description("The ID of the field from the data set to reference."),R.valid(...Object.keys(t),"none"))},uo=t=>R.object({field:R.string().required().description("The ID of the field from the data set to reference."),direction:R.string().valid("asc","desc").required().description("In which direction should the results be ordered?"),function:R.string().valid(...Object.keys(t.supportedAggregates),...Object.keys(t.supportedTimeTruncFunctions),"none").description("Which if any, function should be applied to the field?")}),In=t=>R.object({field:R.string().required().description("The ID of the field from the data set to reference."),truncate:R.valid(...Object.keys(t),"none"),bucketFill:R.boolean()}),Bt=(t,e)=>{const o=(n,b)=>R.object({field:n.required(),pivot:R.string().valid("x","y").optional(),function:b?R.valid(...Object.keys(t),"none").required():R.valid("none").required()});return e?.restrictFields?R.array().items(R.alternatives(...e.restrictFields.filter(n=>n.canBeDimension).map(n=>o(R.string().valid(n.id).description(`${n.publicName}, ${n.description||""}.`),n.dataType==="date_time")))).description("Fields to group the data by"):R.array().items(o(R.string().description("The ID of the field from the data set to reference."),!0)).description("Fields to group the data by")},Y6=(t,e=10)=>{const o=R.object({field:R.object({type:R.string().valid("field").required(),value:R.string().required().description("The ID of the field from the data set to reference."),function:R.string().valid(...Object.keys(t.supportedAggregates),...Object.keys(t.supportedTimeTruncFunctions),"none").description("Which function should be applied to the field?")}),op:R.string().valid(...Object.keys(t.supportedOperators)).required(),value:R.alternatives().try(IA,R.string().allow(null),R.number(),R.boolean(),R.array().items(R.string(),R.number(),R.allow(null)),sO).required()}),n=b=>b<=0?R.object({type:R.string().valid("where").required(),value:o.required()}):R.alternatives().try(R.object({type:R.string().valid("where").required(),value:o.required()}),R.object({type:R.string().valid("andWhere","orWhere").required(),value:R.array().items(n(b-1)).required().description("Array of nested filters")}));return n(e)},Pn=t=>R.object({field:R.string().required().description("The ID of the field from the data set to reference."),op:R.string().valid(...Object.keys(t.supportedOperators)).required(),value:R.alternatives().try(IA,R.string().allow(null),R.number(),R.boolean(),R.array().items(R.string(),R.number(),R.allow(null)),sO).required(),function:R.string().valid(...Object.keys(t.supportedAggregates),...Object.keys(t.supportedTimeTruncFunctions),"none").description("Which function should be applied to the field?")}),z2=t=>R.array().items(R.array().items(Pn(t))),Gt=()=>R.number().description("Limit the number of results returned after the query has been ran."),Y1=t=>{const e=t?.restrictDataSetIds?R.string().valid(...t.restrictDataSetIds):R.string();return{viewId:R.string().allow("").optional().description("__vizzly_hide_from_docs"),displayTitle:R.string().allow("").description("A title that explains what is being displayed."),displaySubject:R.string().allow("").description("A chance to add a more detailed description of what is being shown."),dataSetId:e.description("The ID of the data set that is being used by the view."),protectedByOrganisation:R.boolean().optional().description("Has the view been created by your organisation, and therefore cannot be modified by your users?")}},S2=R.valid("auto",2,0).description("Determine how many axis labels should be shown on the axis"),K6=(t,e)=>({measure:R.array().items(he(t.supportedAggregates,e)).required().description("A list of metrics that are to be shown. For example the `count` of a specific field in your data set."),dimension:Bt(t.supportedTimeTruncFunctions,e).required(),order:R.array().items(uo(t)),limit:Gt(),offset:R.number().min(0).description("Paginate results by using this property with limit.")}),c2=(t,e)=>({...K6(t,e),filter:R.array().items(R.array().items(Pn(t))),timeDimension:R.alternatives(In(t.supportedTimeTruncFunctions),R.valid(null)).required(),drilldown:R.alternatives(Bt(t.supportedTimeTruncFunctions,e).required(),R.string()),xAxisPrefix:R.string().allow("").description("Add a prefix to the X Axis"),yAxisPrefix:R.string().allow("").description("Add a prefix to the Y Axis"),xAxisPostfix:R.string().allow("").description("Add a postfix to the X Axis"),yAxisPostfix:R.string().allow("").description("Add a postfix to the Y Axis"),yAxisFormat:R.alternatives(R.string(),R.valid(null)).description("ID of the formatting function to apply to the Y Axis values"),xAxisFormat:R.alternatives(R.string(),R.valid(null)).description("ID of the formatting function to apply to the X Axis values"),approxYAxisLabelCount:S2,approxXAxisLabelCount:S2}),UM=R.string().valid("natural","straight","step","stepBefore","stepAfter","dotted"),Q6=R.string().valid("natural","straight","step"),OO=t=>R.array().items(R.object({function:R.string().valid(...Object.keys(t.supportedAggregates),...Object.keys(t.supportedTimeTruncFunctions),"none"),field:R.string().required().description("The ID of the field from the data set to reference.")})),CA=t=>R.array().items(R.object({function:R.string().valid(...Object.keys(t.supportedAggregates),...Object.keys(t.supportedTimeTruncFunctions),"none"),truncate:R.string(),field:R.string().required().description("The ID of the field from the data set to reference."),bucketFill:R.boolean().optional(),pivot:R.string().valid("x","y").optional()})),Z6=(t,e)=>R.object().pattern(R.string(),R.alternatives().try(R.array().items(In(t.supportedTimeTruncFunctions)).min(1),Bt(t.supportedTimeTruncFunctions,e))).unknown(!0),J6=(t,e)=>R.object().pattern(R.string(),R.array().items(he(t.supportedAggregates,e)).min(1)).unknown(!0),ft=(t,e)=>R.object({measure:J6(t,e),group:Z6(t,e)}),eg=R.alternatives().try(R.number().required(),R.string().pattern(/^\{\{.*\}\}$/).required()),tg=()=>R.object({color:R.string().required(),value:eg,strokeWidth:R.number().required(),strokeStyle:R.string().valid("dashed","solid").required(),label:R.boolean().optional()}),Vt=()=>R.array().items(tg()),EA=()=>R.object({enabled:R.boolean().required(),labels:R.object({quadrantOne:R.string().allow("").optional(),quadrantTwo:R.string().allow("").optional(),quadrantThree:R.string().allow("").optional(),quadrantFour:R.string().allow("").optional()}).required()}),X2=()=>R.object({func:R.string().valid("mean","sum","current").allow(null).optional()}),qt=()=>R.object({x:R.string().allow(""),y:R.string().allow("")}),DA=R.object().pattern(R.string(),R.object({width:R.number().min(0),height:R.number().min(0)})),IA=R.custom((t,e)=>Object.prototype.toString.call(t)==="[object Date]"?t:e.error("any.invalid"),"Date object validation"),eb=t=>R.object({filters:R.array().items(R.array().items(Pn(t)).required().max(1)).required().max(1),ruleValue:R.string().allow("").required(),ruleValueEnd:R.string().allow(""),ruleType:R.valid("backgroundColor","fontColor","lineColor","areaColor").required()}).description("A rule used to conditionally format a view."),PA=R.object({field:R.string().required().description("ID of the field in the data set to add a prefix too."),prefix:R.string().required().description("The prefix to be applied.")}),Wt=t=>R.array().items(eb(t)).description("Apply formatting based on a set of defined rules."),FA=t=>R.object({...Y1(t.attributesSchemaOptions),...c2(t.queryEngineConfig,t.attributesSchemaOptions),stacked:R.valid(!0,!1,"100%"),legend:R.valid(!0,!1),type:R.valid("areaChart").required(),lineCurve:UM,conditionalFormattingRules:Wt(t.queryEngineConfig),parameters:ft(t.queryEngineConfig,t.attributesSchemaOptions),goalLines:Vt(),axisTitles:qt(),headline:X2(),tags:H1()}),og=t=>(e,o)=>{let n=I1(e,o,FA(t));return n=wt(n),n},rg={barChart:{displayName:"Column Charts"},lineChart:{displayName:"Line Charts"},lineChartV2:{displayName:"Line Charts"},areaChart:{displayName:"Area Charts"},horizontalBarChart:{displayName:"Horizontal Bar Charts"},scatterChart:{displayName:"Scatter Charts"},pieChart:{displayName:"Pie Charts"},funnelChart:{displayName:"Funnel Charts"},sunburstChart:{displayName:"Sunburst Charts"},bubbleChart:{displayName:"Bubble Charts"},bubbleChartV2:{displayName:"Bubble Charts"},basicTable:{displayName:"Tables"},comboChart:{displayName:"Combo Charts",customMessage:"Combo Charts needs at least 1 grouping (Bar and Line), or, have time set to display correctly."},comboChartV2:{displayName:"Combo Charts",customMessage:"Combo Charts needs at least 1 grouping (Bar and Line), or, have time set to display correctly."}},ng=t=>{const e=rg[t.type];return e?.customMessage?e.customMessage:`${e?.displayName||"Charts"} need at least 1 grouping to display correctly.`},ig=t=>t.type==="comboChart"?!!(t.timeDimension||t.barDimension.length>0&&t.lineDimension.length>0):t.type==="barChart"||t.type==="lineChart"||t.type==="areaChart"||t.type==="horizontalBarChart"||t.type==="scatterChart"||t.type==="pieChart"||t.type==="funnelChart"||t.type==="sunburstChart"?!!(t.timeDimension||!t?.dimension||t?.dimension?.length!==0):!0,we=t=>ig(t)?!0:ng(t);var bg=typeof O0=="object"&&O0&&O0.Object===Object&&O0,kA=bg,pg=kA,ag=typeof ot=="object"&&ot&&ot.Object===Object&&ot,Mg=pg||ag||Function("return this")(),fo=Mg,zg=fo,cg=zg.Symbol,jA=cg,zl=jA,$A=Object.prototype,sg=$A.hasOwnProperty,Og=$A.toString,Fi=zl?zl.toStringTag:void 0;function lg(t){var e=sg.call(t,Fi),o=t[Fi];try{t[Fi]=void 0;var n=!0}catch{}var b=Og.call(t);return n&&(e?t[Fi]=o:delete t[Fi]),b}var Ag=lg,dg=Object.prototype,ug=dg.toString;function fg(t){return ug.call(t)}var qg=fg,cl=jA,Wg=Ag,hg=qg,mg="[object Null]",gg="[object Undefined]",sl=cl?cl.toStringTag:void 0;function yg(t){return t==null?t===void 0?gg:mg:sl&&sl in Object(t)?Wg(t):hg(t)}var GM=yg;function Rg(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var Lb=Rg,Lg=GM,vg=Lb,_g="[object AsyncFunction]",Ng="[object Function]",Tg="[object GeneratorFunction]",Bg="[object Proxy]";function Sg(t){if(!vg(t))return!1;var e=Lg(t);return e==Ng||e==Tg||e==_g||e==Bg}var wg=Sg,xg=fo,Xg=xg["__core-js_shared__"],Cg=Xg,ys=Cg,Ol=function(){var t=/[^.]+$/.exec(ys&&ys.keys&&ys.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Eg(t){return!!Ol&&Ol in t}var Dg=Eg,Ig=Function.prototype,Pg=Ig.toString;function Fg(t){if(t!=null){try{return Pg.call(t)}catch{}try{return t+""}catch{}}return""}var UA=Fg,kg=wg,jg=Dg,$g=Lb,Ug=UA,Gg=/[\\^$.*+?()[\]{}|]/g,Vg=/^\[object .+?Constructor\]$/,Hg=Function.prototype,Yg=Object.prototype,Kg=Hg.toString,Qg=Yg.hasOwnProperty,Zg=RegExp("^"+Kg.call(Qg).replace(Gg,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Jg(t){if(!$g(t)||jg(t))return!1;var e=kg(t)?Zg:Vg;return e.test(Ug(t))}var ey=Jg;function ty(t,e){return t?.[e]}var oy=ty,ry=ey,ny=oy;function iy(t,e){var o=ny(t,e);return ry(o)?o:void 0}var vb=iy,by=vb,py=fo,ay=by(py,"DataView"),My=ay,zy=vb,cy=fo,sy=zy(cy,"Map"),Oy=sy,ly=vb,Ay=fo,dy=ly(Ay,"Promise"),uy=dy,fy=vb,qy=fo,Wy=fy(qy,"Set"),hy=Wy,my=vb,gy=fo,yy=my(gy,"WeakMap"),Ry=yy,ks=My,js=Oy,$s=uy,Us=hy,Gs=Ry,GA=GM,Fn=UA,ll="[object Map]",Ly="[object Object]",Al="[object Promise]",dl="[object Set]",ul="[object WeakMap]",fl="[object DataView]",vy=Fn(ks),_y=Fn(js),Ny=Fn($s),Ty=Fn(Us),By=Fn(Gs),Rn=GA;(ks&&Rn(new ks(new ArrayBuffer(1)))!=fl||js&&Rn(new js)!=ll||$s&&Rn($s.resolve())!=Al||Us&&Rn(new Us)!=dl||Gs&&Rn(new Gs)!=ul)&&(Rn=function(t){var e=GA(t),o=e==Ly?t.constructor:void 0,n=o?Fn(o):"";if(n)switch(n){case vy:return fl;case _y:return ll;case Ny:return Al;case Ty:return dl;case By:return ul}return e});function Sy(t){return t!=null&&typeof t=="object"}var lO=Sy,wy=GM,xy=lO,Xy="[object Arguments]";function Cy(t){return xy(t)&&wy(t)==Xy}var Ey=Cy,ql=Ey,Dy=lO,VA=Object.prototype,Iy=VA.hasOwnProperty,Py=VA.propertyIsEnumerable;ql(function(){return arguments}());var Va={exports:{}};function Fy(){return!1}var ky=Fy;Va.exports;(function(t,e){var o=fo,n=ky,b=e&&!e.nodeType&&e,a=b&&!0&&t&&!t.nodeType&&t,O=a&&a.exports===b,A=O?o.Buffer:void 0,c=A?A.isBuffer:void 0,y=c||n;t.exports=y})(Va,Va.exports);Va.exports;var Ha={exports:{}};Ha.exports;(function(t,e){var o=kA,n=e&&!e.nodeType&&e,b=n&&!0&&t&&!t.nodeType&&t,a=b&&b.exports===n,O=a&&o.process,A=function(){try{var c=b&&b.require&&b.require("util").types;return c||O&&O.binding&&O.binding("util")}catch{}}();t.exports=A})(Ha,Ha.exports);var jy=Ha.exports,Wl=jy;Wl&&Wl.isTypedArray;class VM extends Error{constructor(e){super(e),this.name="ValidationError"}}class Ya extends VM{missingFieldId;constructor(e,o){super(`
32
+ [${q+1}] ${this.details[q].message}`;return M+=d,M},v.safeStringify=function(N,s){return JSON.stringify(N,v.serializer(),s)},v.serializer=function(){const N=[],s=[],u=(d,z)=>s[0]===z?"[Circular ~]":"[Circular ~."+N.slice(0,s.indexOf(z)).join(".")+"]";return function(d,z){if(s.length>0){const M=s.indexOf(this);~M?(s.length=M+1,N.length=M+1,N[M]=d):(s.push(this),N.push(d)),~s.indexOf(z)&&(z=u.call(this,d,z))}else s.push(z);if(z){const M=z[v.annotations];if(M){if(Array.isArray(z)){const q=[];for(let l=0;l<z.length;++l)M.errors[l]&&q.push(`_$idx$_${M.errors[l].sort().join(", ")}_$end$_`),q.push(z[l]);z=q}else{for(const q in M.errors)z[`${q}_$key$_${M.errors[q].sort().join(", ")}_$end$_`]=z[q],z[q]=void 0;for(const q in M.missing)z[`_$miss$_${q}|${M.missing[q]}_$end$_`]="__missing__"}return z}}return z===1/0||z===-1/0||Number.isNaN(z)||typeof z=="function"||typeof z=="symbol"?"["+z.toString()+"]":z}}},7629:(a,O,A)=>{const{assert:c,clone:y,deepEqual:v,merge:N}=A(8870),s=A(8652),u=A(8160),d=A(3292),z=A(6354),M=A(8901),q=A(1123),l=A(6914),f=A(2294),g=A(6133),L=A(2305),T=A(8863),X=A(2036),C={Base:class{constructor(m){this.type=m,this.$_root=null,this._definition={},this._reset()}_reset(){this._ids=new f.Ids,this._preferences=null,this._refs=new g.Manager,this._cache=null,this._valids=null,this._invalids=null,this._flags={},this._rules=[],this._singleRules=new Map,this.$_terms={},this.$_temp={ruleset:null,whens:{}}}describe(){return c(typeof q.describe=="function","Manifest functionality disabled"),q.describe(this)}allow(...m){return u.verifyFlat(m,"allow"),this._values(m,"_valids")}alter(m){c(m&&typeof m=="object"&&!Array.isArray(m),"Invalid targets argument"),c(!this._inRuleset(),"Cannot set alterations inside a ruleset");const w=this.clone();w.$_terms.alterations=w.$_terms.alterations||[];for(const E in m){const U=m[E];c(typeof U=="function","Alteration adjuster for",E,"must be a function"),w.$_terms.alterations.push({target:E,adjuster:U})}return w.$_temp.ruleset=!1,w}artifact(m){return c(m!==void 0,"Artifact cannot be undefined"),c(!this._cache,"Cannot set an artifact with a rule cache"),this.$_setFlag("artifact",m)}cast(m){return c(m===!1||typeof m=="string","Invalid to value"),c(m===!1||this._definition.cast[m],"Type",this.type,"does not support casting to",m),this.$_setFlag("cast",m===!1?void 0:m)}default(m,w){return this._default("default",m,w)}description(m){return c(m&&typeof m=="string","Description must be a non-empty string"),this.$_setFlag("description",m)}empty(m){const w=this.clone();return m!==void 0&&(m=w.$_compile(m,{override:!1})),w.$_setFlag("empty",m,{clone:!1})}error(m){return c(m,"Missing error"),c(m instanceof Error||typeof m=="function","Must provide a valid Error object or a function"),this.$_setFlag("error",m)}example(m,w={}){return c(m!==void 0,"Missing example"),u.assertOptions(w,["override"]),this._inner("examples",m,{single:!0,override:w.override})}external(m,w){return typeof m=="object"&&(c(!w,"Cannot combine options with description"),w=m.description,m=m.method),c(typeof m=="function","Method must be a function"),c(w===void 0||w&&typeof w=="string","Description must be a non-empty string"),this._inner("externals",{method:m,description:w},{single:!0})}failover(m,w){return this._default("failover",m,w)}forbidden(){return this.presence("forbidden")}id(m){return m?(c(typeof m=="string","id must be a non-empty string"),c(/^[^\.]+$/.test(m),"id cannot contain period character"),this.$_setFlag("id",m)):this.$_setFlag("id",void 0)}invalid(...m){return this._values(m,"_invalids")}label(m){return c(m&&typeof m=="string","Label name must be a non-empty string"),this.$_setFlag("label",m)}meta(m){return c(m!==void 0,"Meta cannot be undefined"),this._inner("metas",m,{single:!0})}note(...m){c(m.length,"Missing notes");for(const w of m)c(w&&typeof w=="string","Notes must be non-empty strings");return this._inner("notes",m)}only(m=!0){return c(typeof m=="boolean","Invalid mode:",m),this.$_setFlag("only",m)}optional(){return this.presence("optional")}prefs(m){c(m,"Missing preferences"),c(m.context===void 0,"Cannot override context"),c(m.externals===void 0,"Cannot override externals"),c(m.warnings===void 0,"Cannot override warnings"),c(m.debug===void 0,"Cannot override debug"),u.checkPreferences(m);const w=this.clone();return w._preferences=u.preferences(w._preferences,m),w}presence(m){return c(["optional","required","forbidden"].includes(m),"Unknown presence mode",m),this.$_setFlag("presence",m)}raw(m=!0){return this.$_setFlag("result",m?"raw":void 0)}result(m){return c(["raw","strip"].includes(m),"Unknown result mode",m),this.$_setFlag("result",m)}required(){return this.presence("required")}strict(m){const w=this.clone(),E=m!==void 0&&!m;return w._preferences=u.preferences(w._preferences,{convert:E}),w}strip(m=!0){return this.$_setFlag("result",m?"strip":void 0)}tag(...m){c(m.length,"Missing tags");for(const w of m)c(w&&typeof w=="string","Tags must be non-empty strings");return this._inner("tags",m)}unit(m){return c(m&&typeof m=="string","Unit name must be a non-empty string"),this.$_setFlag("unit",m)}valid(...m){u.verifyFlat(m,"valid");const w=this.allow(...m);return w.$_setFlag("only",!!w._valids,{clone:!1}),w}when(m,w){const E=this.clone();E.$_terms.whens||(E.$_terms.whens=[]);const U=d.when(E,m,w);if(!["any","link"].includes(E.type)){const z0=U.is?[U]:U.switch;for(const a0 of z0)c(!a0.then||a0.then.type==="any"||a0.then.type===E.type,"Cannot combine",E.type,"with",a0.then&&a0.then.type),c(!a0.otherwise||a0.otherwise.type==="any"||a0.otherwise.type===E.type,"Cannot combine",E.type,"with",a0.otherwise&&a0.otherwise.type)}return E.$_terms.whens.push(U),E.$_mutateRebuild()}cache(m){c(!this._inRuleset(),"Cannot set caching inside a ruleset"),c(!this._cache,"Cannot override schema cache"),c(this._flags.artifact===void 0,"Cannot cache a rule with an artifact");const w=this.clone();return w._cache=m||s.provider.provision(),w.$_temp.ruleset=!1,w}clone(){const m=Object.create(Object.getPrototypeOf(this));return this._assign(m)}concat(m){c(u.isSchema(m),"Invalid schema object"),c(this.type==="any"||m.type==="any"||m.type===this.type,"Cannot merge type",this.type,"with another type:",m.type),c(!this._inRuleset(),"Cannot concatenate onto a schema with open ruleset"),c(!m._inRuleset(),"Cannot concatenate a schema with open ruleset");let w=this.clone();if(this.type==="any"&&m.type!=="any"){const E=m.clone();for(const U of Object.keys(w))U!=="type"&&(E[U]=w[U]);w=E}w._ids.concat(m._ids),w._refs.register(m,g.toSibling),w._preferences=w._preferences?u.preferences(w._preferences,m._preferences):m._preferences,w._valids=X.merge(w._valids,m._valids,m._invalids),w._invalids=X.merge(w._invalids,m._invalids,m._valids);for(const E of m._singleRules.keys())w._singleRules.has(E)&&(w._rules=w._rules.filter(U=>U.keep||U.name!==E),w._singleRules.delete(E));for(const E of m._rules)m._definition.rules[E.method].multi||w._singleRules.set(E.name,E),w._rules.push(E);if(w._flags.empty&&m._flags.empty){w._flags.empty=w._flags.empty.concat(m._flags.empty);const E=Object.assign({},m._flags);delete E.empty,N(w._flags,E)}else if(m._flags.empty){w._flags.empty=m._flags.empty;const E=Object.assign({},m._flags);delete E.empty,N(w._flags,E)}else N(w._flags,m._flags);for(const E in m.$_terms){const U=m.$_terms[E];U?w.$_terms[E]?w.$_terms[E]=w.$_terms[E].concat(U):w.$_terms[E]=U.slice():w.$_terms[E]||(w.$_terms[E]=U)}return this.$_root._tracer&&this.$_root._tracer._combine(w,[this,m]),w.$_mutateRebuild()}extend(m){return c(!m.base,"Cannot extend type with another base"),M.type(this,m)}extract(m){return m=Array.isArray(m)?m:m.split("."),this._ids.reach(m)}fork(m,w){c(!this._inRuleset(),"Cannot fork inside a ruleset");let E=this;for(let U of[].concat(m))U=Array.isArray(U)?U:U.split("."),E=E._ids.fork(U,w,E);return E.$_temp.ruleset=!1,E}rule(m){const w=this._definition;u.assertOptions(m,Object.keys(w.modifiers)),c(this.$_temp.ruleset!==!1,"Cannot apply rules to empty ruleset or the last rule added does not support rule properties");const E=this.$_temp.ruleset===null?this._rules.length-1:this.$_temp.ruleset;c(E>=0&&E<this._rules.length,"Cannot apply rules to empty ruleset");const U=this.clone();for(let z0=E;z0<U._rules.length;++z0){const a0=U._rules[z0],V=y(a0);for(const Z in m)w.modifiers[Z](V,m[Z]),c(V.name===a0.name,"Cannot change rule name");U._rules[z0]=V,U._singleRules.get(V.name)===a0&&U._singleRules.set(V.name,V)}return U.$_temp.ruleset=!1,U.$_mutateRebuild()}get ruleset(){c(!this._inRuleset(),"Cannot start a new ruleset without closing the previous one");const m=this.clone();return m.$_temp.ruleset=m._rules.length,m}get $(){return this.ruleset}tailor(m){m=[].concat(m),c(!this._inRuleset(),"Cannot tailor inside a ruleset");let w=this;if(this.$_terms.alterations)for(const{target:E,adjuster:U}of this.$_terms.alterations)m.includes(E)&&(w=U(w),c(u.isSchema(w),"Alteration adjuster for",E,"failed to return a schema object"));return w=w.$_modify({each:E=>E.tailor(m),ref:!1}),w.$_temp.ruleset=!1,w.$_mutateRebuild()}tracer(){return L.location?L.location(this):this}validate(m,w){return T.entry(m,this,w)}validateAsync(m,w){return T.entryAsync(m,this,w)}$_addRule(m){typeof m=="string"&&(m={name:m}),c(m&&typeof m=="object","Invalid options"),c(m.name&&typeof m.name=="string","Invalid rule name");for(const a0 in m)c(a0[0]!=="_","Cannot set private rule properties");const w=Object.assign({},m);w._resolve=[],w.method=w.method||w.name;const E=this._definition.rules[w.method],U=w.args;c(E,"Unknown rule",w.method);const z0=this.clone();if(U){c(Object.keys(U).length===1||Object.keys(U).length===this._definition.rules[w.name].args.length,"Invalid rule definition for",this.type,w.name);for(const a0 in U){let V=U[a0];if(E.argsByName){const Z=E.argsByName.get(a0);if(Z.ref&&u.isResolvable(V))w._resolve.push(a0),z0.$_mutateRegister(V);else if(Z.normalize&&(V=Z.normalize(V),U[a0]=V),Z.assert){const u0=u.validateArg(V,a0,Z);c(!u0,u0,"or reference")}}V!==void 0?U[a0]=V:delete U[a0]}}return E.multi||(z0._ruleRemove(w.name,{clone:!1}),z0._singleRules.set(w.name,w)),z0.$_temp.ruleset===!1&&(z0.$_temp.ruleset=null),E.priority?z0._rules.unshift(w):z0._rules.push(w),z0}$_compile(m,w){return d.schema(this.$_root,m,w)}$_createError(m,w,E,U,z0,a0={}){const V=a0.flags!==!1?this._flags:{},Z=a0.messages?l.merge(this._definition.messages,a0.messages):this._definition.messages;return new z.Report(m,w,E,V,Z,U,z0)}$_getFlag(m){return this._flags[m]}$_getRule(m){return this._singleRules.get(m)}$_mapLabels(m){return m=Array.isArray(m)?m:m.split("."),this._ids.labels(m)}$_match(m,w,E,U){(E=Object.assign({},E)).abortEarly=!0,E._externals=!1,w.snapshot();const z0=!T.validate(m,this,w,E,U).errors;return w.restore(),z0}$_modify(m){return u.assertOptions(m,["each","once","ref","schema"]),f.schema(this,m)||this}$_mutateRebuild(){return c(!this._inRuleset(),"Cannot add this rule inside a ruleset"),this._refs.reset(),this._ids.reset(),this.$_modify({each:(m,{source:w,name:E,path:U,key:z0})=>{const a0=this._definition[w][E]&&this._definition[w][E].register;a0!==!1&&this.$_mutateRegister(m,{family:a0,key:z0})}}),this._definition.rebuild&&this._definition.rebuild(this),this.$_temp.ruleset=!1,this}$_mutateRegister(m,{family:w,key:E}={}){this._refs.register(m,w),this._ids.register(m,{key:E})}$_property(m){return this._definition.properties[m]}$_reach(m){return this._ids.reach(m)}$_rootReferences(){return this._refs.roots()}$_setFlag(m,w,E={}){c(m[0]==="_"||!this._inRuleset(),"Cannot set flag inside a ruleset");const U=this._definition.flags[m]||{};if(v(w,U.default)&&(w=void 0),v(w,this._flags[m]))return this;const z0=E.clone!==!1?this.clone():this;return w!==void 0?(z0._flags[m]=w,z0.$_mutateRegister(w)):delete z0._flags[m],m[0]!=="_"&&(z0.$_temp.ruleset=!1),z0}$_parent(m,...w){return this[m][u.symbols.parent].call(this,...w)}$_validate(m,w,E){return T.validate(m,this,w,E)}_assign(m){m.type=this.type,m.$_root=this.$_root,m.$_temp=Object.assign({},this.$_temp),m.$_temp.whens={},m._ids=this._ids.clone(),m._preferences=this._preferences,m._valids=this._valids&&this._valids.clone(),m._invalids=this._invalids&&this._invalids.clone(),m._rules=this._rules.slice(),m._singleRules=y(this._singleRules,{shallow:!0}),m._refs=this._refs.clone(),m._flags=Object.assign({},this._flags),m._cache=null,m.$_terms={};for(const w in this.$_terms)m.$_terms[w]=this.$_terms[w]?this.$_terms[w].slice():null;m.$_super={};for(const w in this.$_super)m.$_super[w]=this._super[w].bind(m);return m}_bare(){const m=this.clone();m._reset();const w=m._definition.terms;for(const E in w){const U=w[E];m.$_terms[E]=U.init}return m.$_mutateRebuild()}_default(m,w,E={}){return u.assertOptions(E,"literal"),c(w!==void 0,"Missing",m,"value"),c(typeof w=="function"||!E.literal,"Only function value supports literal option"),typeof w=="function"&&E.literal&&(w={[u.symbols.literal]:!0,literal:w}),this.$_setFlag(m,w)}_generate(m,w,E){if(!this.$_terms.whens)return{schema:this};const U=[],z0=[];for(let Z=0;Z<this.$_terms.whens.length;++Z){const u0=this.$_terms.whens[Z];if(u0.concat){U.push(u0.concat),z0.push(`${Z}.concat`);continue}const L0=u0.ref?u0.ref.resolve(m,w,E):m,X0=u0.is?[u0]:u0.switch,B0=z0.length;for(let $0=0;$0<X0.length;++$0){const{is:h1,then:d1,otherwise:k1}=X0[$0],be=`${Z}${u0.switch?"."+$0:""}`;if(h1.$_match(L0,w.nest(h1,`${be}.is`),E)){if(d1){const pe=w.localize([...w.path,`${be}.then`],w.ancestors,w.schemas),{schema:J0,id:T1}=d1._generate(m,pe,E);U.push(J0),z0.push(`${be}.then${T1?`(${T1})`:""}`);break}}else if(k1){const pe=w.localize([...w.path,`${be}.otherwise`],w.ancestors,w.schemas),{schema:J0,id:T1}=k1._generate(m,pe,E);U.push(J0),z0.push(`${be}.otherwise${T1?`(${T1})`:""}`);break}}if(u0.break&&z0.length>B0)break}const a0=z0.join(", ");if(w.mainstay.tracer.debug(w,"rule","when",a0),!a0)return{schema:this};if(!w.mainstay.tracer.active&&this.$_temp.whens[a0])return{schema:this.$_temp.whens[a0],id:a0};let V=this;this._definition.generate&&(V=this._definition.generate(this,m,w,E));for(const Z of U)V=V.concat(Z);return this.$_root._tracer&&this.$_root._tracer._combine(V,[this,...U]),this.$_temp.whens[a0]=V,{schema:V,id:a0}}_inner(m,w,E={}){c(!this._inRuleset(),`Cannot set ${m} inside a ruleset`);const U=this.clone();return U.$_terms[m]&&!E.override||(U.$_terms[m]=[]),E.single?U.$_terms[m].push(w):U.$_terms[m].push(...w),U.$_temp.ruleset=!1,U}_inRuleset(){return this.$_temp.ruleset!==null&&this.$_temp.ruleset!==!1}_ruleRemove(m,w={}){if(!this._singleRules.has(m))return this;const E=w.clone!==!1?this.clone():this;E._singleRules.delete(m);const U=[];for(let z0=0;z0<E._rules.length;++z0){const a0=E._rules[z0];a0.name!==m||a0.keep?U.push(a0):E._inRuleset()&&z0<E.$_temp.ruleset&&--E.$_temp.ruleset}return E._rules=U,E}_values(m,w){u.verifyFlat(m,w.slice(1,-1));const E=this.clone(),U=m[0]===u.symbols.override;if(U&&(m=m.slice(1)),!E[w]&&m.length?E[w]=new X:U&&(E[w]=m.length?new X:null,E.$_mutateRebuild()),!E[w])return E;U&&E[w].override();for(const z0 of m){c(z0!==void 0,"Cannot call allow/valid/invalid with undefined"),c(z0!==u.symbols.override,"Override must be the first value");const a0=w==="_invalids"?"_valids":"_invalids";E[a0]&&(E[a0].remove(z0),E[a0].length||(c(w==="_valids"||!E._flags.only,"Setting invalid value",z0,"leaves schema rejecting all values due to previous valid rule"),E[a0]=null)),E[w].add(z0,E._refs)}return E}}};C.Base.prototype[u.symbols.any]={version:u.version,compile:d.compile,root:"$_root"},C.Base.prototype.isImmutable=!0,C.Base.prototype.deny=C.Base.prototype.invalid,C.Base.prototype.disallow=C.Base.prototype.invalid,C.Base.prototype.equal=C.Base.prototype.valid,C.Base.prototype.exist=C.Base.prototype.required,C.Base.prototype.not=C.Base.prototype.invalid,C.Base.prototype.options=C.Base.prototype.prefs,C.Base.prototype.preferences=C.Base.prototype.prefs,a.exports=new C.Base},8652:(a,O,A)=>{const{assert:c,clone:y}=A(8870),v=A(8160),N={max:1e3,supported:new Set(["undefined","boolean","number","string"])};O.provider={provision:s=>new N.Cache(s)},N.Cache=class{constructor(s={}){v.assertOptions(s,["max"]),c(s.max===void 0||s.max&&s.max>0&&isFinite(s.max),"Invalid max cache size"),this._max=s.max||N.max,this._map=new Map,this._list=new N.List}get length(){return this._map.size}set(s,u){if(s!==null&&!N.supported.has(typeof s))return;let d=this._map.get(s);if(d)return d.value=u,void this._list.first(d);d=this._list.unshift({key:s,value:u}),this._map.set(s,d),this._compact()}get(s){const u=this._map.get(s);if(u)return this._list.first(u),y(u.value)}_compact(){if(this._map.size>this._max){const s=this._list.pop();this._map.delete(s.key)}}},N.List=class{constructor(){this.tail=null,this.head=null}unshift(s){return s.next=null,s.prev=this.head,this.head&&(this.head.next=s),this.head=s,this.tail||(this.tail=s),s}first(s){s!==this.head&&(this._remove(s),this.unshift(s))}pop(){return this._remove(this.tail)}_remove(s){const{next:u,prev:d}=s;return u.prev=d,d&&(d.next=u),s===this.tail&&(this.tail=u),s.prev=null,s.next=null,s}}},8160:(a,O,A)=>{const{assert:c,AssertError:y}=A(8870),v=A(5934);let N,s;const u={isoDate:/^(?:[-+]\d{2})?(?:\d{4}(?!\d{2}\b))(?:(-?)(?:(?:0[1-9]|1[0-2])(?:\1(?:[12]\d|0[1-9]|3[01]))?|W(?:[0-4]\d|5[0-2])(?:-?[1-7])?|(?:00[1-9]|0[1-9]\d|[12]\d{2}|3(?:[0-5]\d|6[1-6])))(?![T]$|[T][\d]+Z$)(?:[T\s](?:(?:(?:[01]\d|2[0-3])(?:(:?)[0-5]\d)?|24\:?00)(?:[.,]\d+(?!:))?)(?:\2[0-5]\d(?:[.,]\d+)?)?(?:[Z]|(?:[+-])(?:[01]\d|2[0-3])(?::?[0-5]\d)?)?)?)?$/};O.version=v.version,O.defaults={abortEarly:!0,allowUnknown:!1,artifacts:!1,cache:!0,context:null,convert:!0,dateFormat:"iso",errors:{escapeHtml:!1,label:"path",language:null,render:!0,stack:!1,wrap:{label:'"',array:"[]"}},externals:!0,messages:{},nonEnumerables:!1,noDefaults:!1,presence:"optional",skipFunctions:!1,stripUnknown:!1,warnings:!1},O.symbols={any:Symbol.for("@hapi/joi/schema"),arraySingle:Symbol("arraySingle"),deepDefault:Symbol("deepDefault"),errors:Symbol("errors"),literal:Symbol("literal"),override:Symbol("override"),parent:Symbol("parent"),prefs:Symbol("prefs"),ref:Symbol("ref"),template:Symbol("template"),values:Symbol("values")},O.assertOptions=function(d,z,M="Options"){c(d&&typeof d=="object"&&!Array.isArray(d),"Options must be of type object");const q=Object.keys(d).filter(l=>!z.includes(l));c(q.length===0,`${M} contain unknown keys: ${q}`)},O.checkPreferences=function(d){s=s||A(3378);const z=s.preferences.validate(d);if(z.error)throw new y([z.error.details[0].message])},O.compare=function(d,z,M){switch(M){case"=":return d===z;case">":return d>z;case"<":return d<z;case">=":return d>=z;case"<=":return d<=z}},O.default=function(d,z){return d===void 0?z:d},O.isIsoDate=function(d){return u.isoDate.test(d)},O.isNumber=function(d){return typeof d=="number"&&!isNaN(d)},O.isResolvable=function(d){return!!d&&(d[O.symbols.ref]||d[O.symbols.template])},O.isSchema=function(d,z={}){const M=d&&d[O.symbols.any];return!!M&&(c(z.legacy||M.version===O.version,"Cannot mix different versions of joi schemas"),!0)},O.isValues=function(d){return d[O.symbols.values]},O.limit=function(d){return Number.isSafeInteger(d)&&d>=0},O.preferences=function(d,z){N=N||A(6914),d=d||{},z=z||{};const M=Object.assign({},d,z);return z.errors&&d.errors&&(M.errors=Object.assign({},d.errors,z.errors),M.errors.wrap=Object.assign({},d.errors.wrap,z.errors.wrap)),z.messages&&(M.messages=N.compile(z.messages,d.messages)),delete M[O.symbols.prefs],M},O.tryWithPath=function(d,z,M={}){try{return d()}catch(q){throw q.path!==void 0?q.path=z+"."+q.path:q.path=z,M.append&&(q.message=`${q.message} (${q.path})`),q}},O.validateArg=function(d,z,{assert:M,message:q}){if(O.isSchema(M)){const l=M.validate(d);return l.error?l.error.message:void 0}if(!M(d))return z?`${z} ${q}`:q},O.verifyFlat=function(d,z){for(const M of d)c(!Array.isArray(M),"Method no longer accepts array arguments:",z)}},3292:(a,O,A)=>{const{assert:c}=A(8870),y=A(8160),v=A(6133),N={};O.schema=function(s,u,d={}){y.assertOptions(d,["appendPath","override"]);try{return N.schema(s,u,d)}catch(z){throw d.appendPath&&z.path!==void 0&&(z.message=`${z.message} (${z.path})`),z}},N.schema=function(s,u,d){c(u!==void 0,"Invalid undefined schema"),Array.isArray(u)&&(c(u.length,"Invalid empty array schema"),u.length===1&&(u=u[0]));const z=(M,...q)=>d.override!==!1?M.valid(s.override,...q):M.valid(...q);if(N.simple(u))return z(s,u);if(typeof u=="function")return s.custom(u);if(c(typeof u=="object","Invalid schema content:",typeof u),y.isResolvable(u))return z(s,u);if(y.isSchema(u))return u;if(Array.isArray(u)){for(const M of u)if(!N.simple(M))return s.alternatives().try(...u);return z(s,...u)}return u instanceof RegExp?s.string().regex(u):u instanceof Date?z(s.date(),u):(c(Object.getPrototypeOf(u)===Object.getPrototypeOf({}),"Schema can only contain plain objects"),s.object().keys(u))},O.ref=function(s,u){return v.isRef(s)?s:v.create(s,u)},O.compile=function(s,u,d={}){y.assertOptions(d,["legacy"]);const z=u&&u[y.symbols.any];if(z)return c(d.legacy||z.version===y.version,"Cannot mix different versions of joi schemas:",z.version,y.version),u;if(typeof u!="object"||!d.legacy)return O.schema(s,u,{appendPath:!0});const M=N.walk(u);return M?M.compile(M.root,u):O.schema(s,u,{appendPath:!0})},N.walk=function(s){if(typeof s!="object")return null;if(Array.isArray(s)){for(const d of s){const z=N.walk(d);if(z)return z}return null}const u=s[y.symbols.any];if(u)return{root:s[u.root],compile:u.compile};c(Object.getPrototypeOf(s)===Object.getPrototypeOf({}),"Schema can only contain plain objects");for(const d in s){const z=N.walk(s[d]);if(z)return z}return null},N.simple=function(s){return s===null||["boolean","string","number"].includes(typeof s)},O.when=function(s,u,d){if(d===void 0&&(c(u&&typeof u=="object","Missing options"),d=u,u=v.create(".")),Array.isArray(d)&&(d={switch:d}),y.assertOptions(d,["is","not","then","otherwise","switch","break"]),y.isSchema(u))return c(d.is===void 0,'"is" can not be used with a schema condition'),c(d.not===void 0,'"not" can not be used with a schema condition'),c(d.switch===void 0,'"switch" can not be used with a schema condition'),N.condition(s,{is:u,then:d.then,otherwise:d.otherwise,break:d.break});if(c(v.isRef(u)||typeof u=="string","Invalid condition:",u),c(d.not===void 0||d.is===void 0,'Cannot combine "is" with "not"'),d.switch===void 0){let M=d;d.not!==void 0&&(M={is:d.not,then:d.otherwise,otherwise:d.then,break:d.break});let q=M.is!==void 0?s.$_compile(M.is):s.$_root.invalid(null,!1,0,"").required();return c(M.then!==void 0||M.otherwise!==void 0,'options must have at least one of "then", "otherwise", or "switch"'),c(M.break===void 0||M.then===void 0||M.otherwise===void 0,"Cannot specify then, otherwise, and break all together"),d.is===void 0||v.isRef(d.is)||y.isSchema(d.is)||(q=q.required()),N.condition(s,{ref:O.ref(u),is:q,then:M.then,otherwise:M.otherwise,break:M.break})}c(Array.isArray(d.switch),'"switch" must be an array'),c(d.is===void 0,'Cannot combine "switch" with "is"'),c(d.not===void 0,'Cannot combine "switch" with "not"'),c(d.then===void 0,'Cannot combine "switch" with "then"');const z={ref:O.ref(u),switch:[],break:d.break};for(let M=0;M<d.switch.length;++M){const q=d.switch[M],l=M===d.switch.length-1;y.assertOptions(q,l?["is","then","otherwise"]:["is","then"]),c(q.is!==void 0,'Switch statement missing "is"'),c(q.then!==void 0,'Switch statement missing "then"');const f={is:s.$_compile(q.is),then:s.$_compile(q.then)};if(v.isRef(q.is)||y.isSchema(q.is)||(f.is=f.is.required()),l){c(d.otherwise===void 0||q.otherwise===void 0,'Cannot specify "otherwise" inside and outside a "switch"');const g=d.otherwise!==void 0?d.otherwise:q.otherwise;g!==void 0&&(c(z.break===void 0,"Cannot specify both otherwise and break"),f.otherwise=s.$_compile(g))}z.switch.push(f)}return z},N.condition=function(s,u){for(const d of["then","otherwise"])u[d]===void 0?delete u[d]:u[d]=s.$_compile(u[d]);return u}},6354:(a,O,A)=>{const c=A(514),y=A(8160),v=A(3328);O.Report=class{constructor(N,s,u,d,z,M,q){if(this.code=N,this.flags=d,this.messages=z,this.path=M.path,this.prefs=q,this.state=M,this.value=s,this.message=null,this.template=null,this.local=u||{},this.local.label=O.label(this.flags,this.state,this.prefs,this.messages),this.value===void 0||this.local.hasOwnProperty("value")||(this.local.value=this.value),this.path.length){const l=this.path[this.path.length-1];typeof l!="object"&&(this.local.key=l)}}_setTemplate(N){if(this.template=N,!this.flags.label&&this.path.length===0){const s=this._template(this.template,"root");s&&(this.local.label=s)}}toString(){if(this.message)return this.message;const N=this.code;if(!this.prefs.errors.render)return this.code;const s=this._template(this.template)||this._template(this.prefs.messages)||this._template(this.messages);return s===void 0?`Error code "${N}" is not defined, your custom type is missing the correct messages definition`:(this.message=s.render(this.value,this.state,this.prefs,this.local,{errors:this.prefs.errors,messages:[this.prefs.messages,this.messages]}),this.prefs.errors.label||(this.message=this.message.replace(/^"" /,"").trim()),this.message)}_template(N,s){return O.template(this.value,N,s||this.code,this.state,this.prefs)}},O.path=function(N){let s="";for(const u of N)typeof u!="object"&&(typeof u=="string"?(s&&(s+="."),s+=u):s+=`[${u}]`);return s},O.template=function(N,s,u,d,z){if(!s)return;if(v.isTemplate(s))return u!=="root"?s:null;let M=z.errors.language;if(y.isResolvable(M)&&(M=M.resolve(N,d,z)),M&&s[M]){if(s[M][u]!==void 0)return s[M][u];if(s[M]["*"]!==void 0)return s[M]["*"]}return s[u]?s[u]:s["*"]},O.label=function(N,s,u,d){if(N.label)return N.label;if(!u.errors.label)return"";let z=s.path;return u.errors.label==="key"&&s.path.length>1&&(z=s.path.slice(-1)),O.path(z)||O.template(null,u.messages,"root",s,u)||d&&O.template(null,d,"root",s,u)||"value"},O.process=function(N,s,u){if(!N)return null;const{override:d,message:z,details:M}=O.details(N);if(d)return d;if(u.errors.stack)return new O.ValidationError(z,M,s);const q=Error.stackTraceLimit;Error.stackTraceLimit=0;const l=new O.ValidationError(z,M,s);return Error.stackTraceLimit=q,l},O.details=function(N,s={}){let u=[];const d=[];for(const z of N){if(z instanceof Error){if(s.override!==!1)return{override:z};const q=z.toString();u.push(q),d.push({message:q,type:"override",context:{error:z}});continue}const M=z.toString();u.push(M),d.push({message:M,path:z.path.filter(q=>typeof q!="object"),type:z.code,context:z.local})}return u.length>1&&(u=[...new Set(u)]),{message:u.join(". "),details:d}},O.ValidationError=class extends Error{constructor(N,s,u){super(N),this._original=u,this.details=s}static isError(N){return N instanceof O.ValidationError}},O.ValidationError.prototype.isJoi=!0,O.ValidationError.prototype.name="ValidationError",O.ValidationError.prototype.annotate=c.error},8901:(a,O,A)=>{const{assert:c,clone:y}=A(8870),v=A(8160),N=A(6914),s={};O.type=function(u,d){const z=Object.getPrototypeOf(u),M=y(z),q=u._assign(Object.create(M)),l=Object.assign({},d);delete l.base,M._definition=l;const f=z._definition||{};l.messages=N.merge(f.messages,l.messages),l.properties=Object.assign({},f.properties,l.properties),q.type=l.type,l.flags=Object.assign({},f.flags,l.flags);const g=Object.assign({},f.terms);if(l.terms)for(const C in l.terms){const m=l.terms[C];c(q.$_terms[C]===void 0,"Invalid term override for",l.type,C),q.$_terms[C]=m.init,g[C]=m}l.terms=g,l.args||(l.args=f.args),l.prepare=s.prepare(l.prepare,f.prepare),l.coerce&&(typeof l.coerce=="function"&&(l.coerce={method:l.coerce}),l.coerce.from&&!Array.isArray(l.coerce.from)&&(l.coerce={method:l.coerce.method,from:[].concat(l.coerce.from)})),l.coerce=s.coerce(l.coerce,f.coerce),l.validate=s.validate(l.validate,f.validate);const L=Object.assign({},f.rules);if(l.rules)for(const C in l.rules){const m=l.rules[C];c(typeof m=="object","Invalid rule definition for",l.type,C);let w=m.method;if(w===void 0&&(w=function(){return this.$_addRule(C)}),w&&(c(!M[C],"Rule conflict in",l.type,C),M[C]=w),c(!L[C],"Rule conflict in",l.type,C),L[C]=m,m.alias){const E=[].concat(m.alias);for(const U of E)M[U]=m.method}m.args&&(m.argsByName=new Map,m.args=m.args.map(E=>(typeof E=="string"&&(E={name:E}),c(!m.argsByName.has(E.name),"Duplicated argument name",E.name),v.isSchema(E.assert)&&(E.assert=E.assert.strict().label(E.name)),m.argsByName.set(E.name,E),E)))}l.rules=L;const T=Object.assign({},f.modifiers);if(l.modifiers)for(const C in l.modifiers){c(!M[C],"Rule conflict in",l.type,C);const m=l.modifiers[C];c(typeof m=="function","Invalid modifier definition for",l.type,C);const w=function(E){return this.rule({[C]:E})};M[C]=w,T[C]=m}if(l.modifiers=T,l.overrides){M._super=z,q.$_super={};for(const C in l.overrides)c(z[C],"Cannot override missing",C),l.overrides[C][v.symbols.parent]=z[C],q.$_super[C]=z[C].bind(q);Object.assign(M,l.overrides)}l.cast=Object.assign({},f.cast,l.cast);const X=Object.assign({},f.manifest,l.manifest);return X.build=s.build(l.manifest&&l.manifest.build,f.manifest&&f.manifest.build),l.manifest=X,l.rebuild=s.rebuild(l.rebuild,f.rebuild),q},s.build=function(u,d){return u&&d?function(z,M){return d(u(z,M),M)}:u||d},s.coerce=function(u,d){return u&&d?{from:u.from&&d.from?[...new Set([...u.from,...d.from])]:null,method(z,M){let q;if((!d.from||d.from.includes(typeof z))&&(q=d.method(z,M),q)){if(q.errors||q.value===void 0)return q;z=q.value}if(!u.from||u.from.includes(typeof z)){const l=u.method(z,M);if(l)return l}return q}}:u||d},s.prepare=function(u,d){return u&&d?function(z,M){const q=u(z,M);if(q){if(q.errors||q.value===void 0)return q;z=q.value}return d(z,M)||q}:u||d},s.rebuild=function(u,d){return u&&d?function(z){d(z),u(z)}:u||d},s.validate=function(u,d){return u&&d?function(z,M){const q=d(z,M);if(q){if(q.errors&&(!Array.isArray(q.errors)||q.errors.length))return q;z=q.value}return u(z,M)||q}:u||d}},5107:(a,O,A)=>{const{assert:c,clone:y}=A(8870),v=A(8652),N=A(8160),s=A(3292),u=A(6354),d=A(8901),z=A(1123),M=A(6133),q=A(3328),l=A(2305);let f;const g={types:{alternatives:A(4946),any:A(8068),array:A(546),boolean:A(4937),date:A(7500),function:A(390),link:A(8785),number:A(3832),object:A(8966),string:A(7417),symbol:A(8826)},aliases:{alt:"alternatives",bool:"boolean",func:"function"},root:function(){const L={_types:new Set(Object.keys(g.types))};for(const T of L._types)L[T]=function(...X){return c(!X.length||["alternatives","link","object"].includes(T),"The",T,"type does not allow arguments"),g.generate(this,g.types[T],X)};for(const T of["allow","custom","disallow","equal","exist","forbidden","invalid","not","only","optional","options","prefs","preferences","required","strip","valid","when"])L[T]=function(...X){return this.any()[T](...X)};Object.assign(L,g.methods);for(const T in g.aliases){const X=g.aliases[T];L[T]=L[X]}return L.x=L.expression,l.setup&&l.setup(L),L}};g.methods={ValidationError:u.ValidationError,version:N.version,cache:v.provider,assert(L,T,...X){g.assert(L,T,!0,X)},attempt:(L,T,...X)=>g.assert(L,T,!1,X),build(L){return c(typeof z.build=="function","Manifest functionality disabled"),z.build(this,L)},checkPreferences(L){N.checkPreferences(L)},compile(L,T){return s.compile(this,L,T)},defaults(L){c(typeof L=="function","modifier must be a function");const T=Object.assign({},this);for(const X of T._types){const C=L(T[X]());c(N.isSchema(C),"modifier must return a valid schema object"),T[X]=function(...m){return g.generate(this,C,m)}}return T},expression:(...L)=>new q(...L),extend(...L){N.verifyFlat(L,"extend"),f=f||A(3378),c(L.length,"You need to provide at least one extension"),this.assert(L,f.extensions);const T=Object.assign({},this);T._types=new Set(T._types);for(let X of L){typeof X=="function"&&(X=X(T)),this.assert(X,f.extension);const C=g.expandExtension(X,T);for(const m of C){c(T[m.type]===void 0||T._types.has(m.type),"Cannot override name",m.type);const w=m.base||this.any(),E=d.type(w,m);T._types.add(m.type),T[m.type]=function(...U){return g.generate(this,E,U)}}}return T},isError:u.ValidationError.isError,isExpression:q.isTemplate,isRef:M.isRef,isSchema:N.isSchema,in:(...L)=>M.in(...L),override:N.symbols.override,ref:(...L)=>M.create(...L),types(){const L={};for(const T of this._types)L[T]=this[T]();for(const T in g.aliases)L[T]=this[T]();return L}},g.assert=function(L,T,X,C){const m=C[0]instanceof Error||typeof C[0]=="string"?C[0]:null,w=m!==null?C[1]:C[0],E=T.validate(L,N.preferences({errors:{stack:!0}},w||{}));let U=E.error;if(!U)return E.value;if(m instanceof Error)throw m;const z0=X&&typeof U.annotate=="function"?U.annotate():U.message;throw U instanceof u.ValidationError==0&&(U=y(U)),U.message=m?`${m} ${z0}`:z0,U},g.generate=function(L,T,X){return c(L,"Must be invoked on a Joi instance."),T.$_root=L,T._definition.args&&X.length?T._definition.args(T,...X):T},g.expandExtension=function(L,T){if(typeof L.type=="string")return[L];const X=[];for(const C of T._types)if(L.type.test(C)){const m=Object.assign({},L);m.type=C,m.base=T[C](),X.push(m)}return X},a.exports=g.root()},1123:(a,O,A)=>{const{assert:c,clone:y}=A(8870),v=A(8160),N=A(6914),s=A(6133),u=A(3328);let d;const z={};O.describe=function(M){const q=M._definition,l={type:M.type,flags:{},rules:[]};for(const f in M._flags)f[0]!=="_"&&(l.flags[f]=z.describe(M._flags[f]));Object.keys(l.flags).length||delete l.flags,M._preferences&&(l.preferences=y(M._preferences,{shallow:["messages"]}),delete l.preferences[v.symbols.prefs],l.preferences.messages&&(l.preferences.messages=N.decompile(l.preferences.messages))),M._valids&&(l.allow=M._valids.describe()),M._invalids&&(l.invalid=M._invalids.describe());for(const f of M._rules){if(q.rules[f.name].manifest===!1)continue;const g={name:f.name};for(const L in q.modifiers)f[L]!==void 0&&(g[L]=z.describe(f[L]));if(f.args){g.args={};for(const L in f.args){const T=f.args[L];(L!=="options"||Object.keys(T).length)&&(g.args[L]=z.describe(T,{assign:L}))}Object.keys(g.args).length||delete g.args}l.rules.push(g)}l.rules.length||delete l.rules;for(const f in M.$_terms){if(f[0]==="_")continue;c(!l[f],"Cannot describe schema due to internal name conflict with",f);const g=M.$_terms[f];if(!g)continue;if(g instanceof Map){g.size&&(l[f]=[...g.entries()]);continue}if(v.isValues(g)){l[f]=g.describe();continue}c(q.terms[f],"Term",f,"missing configuration");const L=q.terms[f].manifest,T=typeof L=="object";if(!g.length&&!T)continue;const X=[];for(const C of g)X.push(z.describe(C));if(T){const{from:C,to:m}=L.mapped;l[f]={};for(const w of X)l[f][w[m]]=w[C]}else L!=="single"?l[f]=X:(c(X.length===1,"Term",f,"contains more than one item"),l[f]=X[0])}return z.validate(M.$_root,l),l},z.describe=function(M,q={}){if(Array.isArray(M))return M.map(z.describe);if(M===v.symbols.deepDefault)return{special:"deep"};if(typeof M!="object"||M===null)return M;if(q.assign==="options")return y(M);if(M instanceof Date)return M.toISOString();if(M instanceof Error)return M;if(M instanceof RegExp)return q.assign==="regex"?M.toString():{regex:M.toString()};if(M[v.symbols.literal])return{function:M.literal};if(typeof M.describe=="function")return q.assign==="ref"?M.describe().ref:M.describe();const l={};for(const f in M){const g=M[f];g!==void 0&&(l[f]=z.describe(g,{assign:f}))}return l},O.build=function(M,q){return new z.Builder(M).parse(q)},z.Builder=class{constructor(M){this.joi=M}parse(M){z.validate(this.joi,M);let q=this.joi[M.type]()._bare();const l=q._definition;if(M.flags)for(const g in M.flags){const L=l.flags[g]&&l.flags[g].setter||g;c(typeof q[L]=="function","Invalid flag",g,"for type",M.type),q=q[L](this.build(M.flags[g]))}if(M.preferences&&(q=q.preferences(this.build(M.preferences))),M.allow&&(q=q.allow(...this.build(M.allow))),M.invalid&&(q=q.invalid(...this.build(M.invalid))),M.rules)for(const g of M.rules){c(typeof q[g.name]=="function","Invalid rule",g.name,"for type",M.type);const L=[];if(g.args){const X={};for(const w in g.args)X[w]=this.build(g.args[w],{assign:w});const C=Object.keys(X),m=l.rules[g.name].args;if(m){c(C.length<=m.length,"Invalid number of arguments for",M.type,g.name,"(expected up to",m.length,", found",C.length,")");for(const{name:w}of m)L.push(X[w])}else c(C.length===1,"Invalid number of arguments for",M.type,g.name,"(expected up to 1, found",C.length,")"),L.push(X[C[0]])}q=q[g.name](...L);const T={};for(const X in l.modifiers)g[X]!==void 0&&(T[X]=this.build(g[X]));Object.keys(T).length&&(q=q.rule(T))}const f={};for(const g in M){if(["allow","flags","invalid","whens","preferences","rules","type"].includes(g))continue;c(l.terms[g],"Term",g,"missing configuration");const L=l.terms[g].manifest;if(L!=="schema")if(L!=="values")if(L!=="single")if(typeof L!="object")f[g]=this.build(M[g]);else{f[g]={};for(const T in M[g]){const X=M[g][T];f[g][T]=this.parse(X)}}else f[g]=this.build(M[g]);else f[g]=M[g].map(T=>this.build(T));else f[g]=M[g].map(T=>this.parse(T))}return M.whens&&(f.whens=M.whens.map(g=>this.build(g))),q=l.manifest.build(q,f),q.$_temp.ruleset=!1,q}build(M,q={}){if(M===null)return null;if(Array.isArray(M))return M.map(f=>this.build(f));if(M instanceof Error)return M;if(q.assign==="options")return y(M);if(q.assign==="regex")return z.regex(M);if(q.assign==="ref")return s.build(M);if(typeof M!="object")return M;if(Object.keys(M).length===1){if(M.buffer)return c(!1,"Buffers are not supported"),!1;if(M.function)return{[v.symbols.literal]:!0,literal:M.function};if(M.override)return v.symbols.override;if(M.ref)return s.build(M.ref);if(M.regex)return z.regex(M.regex);if(M.special)return c(["deep"].includes(M.special),"Unknown special value",M.special),v.symbols.deepDefault;if(M.value)return y(M.value)}if(M.type)return this.parse(M);if(M.template)return u.build(M);const l={};for(const f in M)l[f]=this.build(M[f],{assign:f});return l}},z.regex=function(M){const q=M.lastIndexOf("/"),l=M.slice(1,q),f=M.slice(q+1);return new RegExp(l,f)},z.validate=function(M,q){d=d||A(3378),M.assert(q,d.description)}},6914:(a,O,A)=>{const{assert:c,clone:y}=A(8870),v=A(3328);O.compile=function(N,s){if(typeof N=="string")return c(!s,"Cannot set single message string"),new v(N);if(v.isTemplate(N))return c(!s,"Cannot set single message template"),N;c(typeof N=="object"&&!Array.isArray(N),"Invalid message options"),s=s?y(s):{};for(let u in N){const d=N[u];if(u==="root"||v.isTemplate(d)){s[u]=d;continue}if(typeof d=="string"){s[u]=new v(d);continue}c(typeof d=="object"&&!Array.isArray(d),"Invalid message for",u);const z=u;for(u in s[z]=s[z]||{},d){const M=d[u];u==="root"||v.isTemplate(M)?s[z][u]=M:(c(typeof M=="string","Invalid message for",u,"in",z),s[z][u]=new v(M))}}return s},O.decompile=function(N){const s={};for(let u in N){const d=N[u];if(u==="root"){s.root=d;continue}if(v.isTemplate(d)){s[u]=d.describe({compact:!0});continue}const z=u;for(u in s[z]={},d){const M=d[u];u!=="root"?s[z][u]=M.describe({compact:!0}):s[z].root=M}}return s},O.merge=function(N,s){if(!N)return O.compile(s);if(!s)return N;if(typeof s=="string")return new v(s);if(v.isTemplate(s))return s;const u=y(N);for(let d in s){const z=s[d];if(d==="root"||v.isTemplate(z)){u[d]=z;continue}if(typeof z=="string"){u[d]=new v(z);continue}c(typeof z=="object"&&!Array.isArray(z),"Invalid message for",d);const M=d;for(d in u[M]=u[M]||{},z){const q=z[d];d==="root"||v.isTemplate(q)?u[M][d]=q:(c(typeof q=="string","Invalid message for",d,"in",M),u[M][d]=new v(q))}}return u}},2294:(a,O,A)=>{const{assert:c}=A(8870),y=A(8160),v=A(6133),N={};O.Ids=N.Ids=class{constructor(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}clone(){const s=new N.Ids;return s._byId=new Map(this._byId),s._byKey=new Map(this._byKey),s._schemaChain=this._schemaChain,s}concat(s){s._schemaChain&&(this._schemaChain=!0);for(const[u,d]of s._byId.entries())c(!this._byKey.has(u),"Schema id conflicts with existing key:",u),this._byId.set(u,d);for(const[u,d]of s._byKey.entries())c(!this._byId.has(u),"Schema key conflicts with existing id:",u),this._byKey.set(u,d)}fork(s,u,d){const z=this._collect(s);z.push({schema:d});const M=z.shift();let q={id:M.id,schema:u(M.schema)};c(y.isSchema(q.schema),"adjuster function failed to return a joi schema type");for(const l of z)q={id:l.id,schema:N.fork(l.schema,q.id,q.schema)};return q.schema}labels(s,u=[]){const d=s[0],z=this._get(d);if(!z)return[...u,...s].join(".");const M=s.slice(1);return u=[...u,z.schema._flags.label||d],M.length?z.schema._ids.labels(M,u):u.join(".")}reach(s,u=[]){const d=s[0],z=this._get(d);c(z,"Schema does not contain path",[...u,...s].join("."));const M=s.slice(1);return M.length?z.schema._ids.reach(M,[...u,d]):z.schema}register(s,{key:u}={}){if(!s||!y.isSchema(s))return;(s.$_property("schemaChain")||s._ids._schemaChain)&&(this._schemaChain=!0);const d=s._flags.id;if(d){const z=this._byId.get(d);c(!z||z.schema===s,"Cannot add different schemas with the same id:",d),c(!this._byKey.has(d),"Schema id conflicts with existing key:",d),this._byId.set(d,{schema:s,id:d})}u&&(c(!this._byKey.has(u),"Schema already contains key:",u),c(!this._byId.has(u),"Schema key conflicts with existing id:",u),this._byKey.set(u,{schema:s,id:u}))}reset(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}_collect(s,u=[],d=[]){const z=s[0],M=this._get(z);c(M,"Schema does not contain path",[...u,...s].join(".")),d=[M,...d];const q=s.slice(1);return q.length?M.schema._ids._collect(q,[...u,z],d):d}_get(s){return this._byId.get(s)||this._byKey.get(s)}},N.fork=function(s,u,d){const z=O.schema(s,{each:(M,{key:q})=>{if(u===(M._flags.id||q))return d},ref:!1});return z?z.$_mutateRebuild():s},O.schema=function(s,u){let d;for(const z in s._flags){if(z[0]==="_")continue;const M=N.scan(s._flags[z],{source:"flags",name:z},u);M!==void 0&&(d=d||s.clone(),d._flags[z]=M)}for(let z=0;z<s._rules.length;++z){const M=s._rules[z],q=N.scan(M.args,{source:"rules",name:M.name},u);if(q!==void 0){d=d||s.clone();const l=Object.assign({},M);l.args=q,d._rules[z]=l,d._singleRules.get(M.name)===M&&d._singleRules.set(M.name,l)}}for(const z in s.$_terms){if(z[0]==="_")continue;const M=N.scan(s.$_terms[z],{source:"terms",name:z},u);M!==void 0&&(d=d||s.clone(),d.$_terms[z]=M)}return d},N.scan=function(s,u,d,z,M){const q=z||[];if(s===null||typeof s!="object")return;let l;if(Array.isArray(s)){for(let f=0;f<s.length;++f){const g=u.source==="terms"&&u.name==="keys"&&s[f].key,L=N.scan(s[f],u,d,[f,...q],g);L!==void 0&&(l=l||s.slice(),l[f]=L)}return l}if(d.schema!==!1&&y.isSchema(s)||d.ref!==!1&&v.isRef(s)){const f=d.each(s,{...u,path:q,key:M});return f===s?void 0:f}for(const f in s){if(f[0]==="_")continue;const g=N.scan(s[f],u,d,[f,...q],M);g!==void 0&&(l=l||Object.assign({},s),l[f]=g)}return l}},6133:(a,O,A)=>{const{assert:c,clone:y,reach:v}=A(8870),N=A(8160);let s;const u={symbol:Symbol("ref"),defaults:{adjust:null,in:!1,iterables:null,map:null,separator:".",type:"value"}};O.create=function(d,z={}){c(typeof d=="string","Invalid reference key:",d),N.assertOptions(z,["adjust","ancestor","in","iterables","map","prefix","render","separator"]),c(!z.prefix||typeof z.prefix=="object","options.prefix must be of type object");const M=Object.assign({},u.defaults,z);delete M.prefix;const q=M.separator,l=u.context(d,q,z.prefix);if(M.type=l.type,d=l.key,M.type==="value")if(l.root&&(c(!q||d[0]!==q,"Cannot specify relative path with root prefix"),M.ancestor="root",d||(d=null)),q&&q===d)d=null,M.ancestor=0;else if(M.ancestor!==void 0)c(!q||!d||d[0]!==q,"Cannot combine prefix with ancestor option");else{const[f,g]=u.ancestor(d,q);g&&(d=d.slice(g))===""&&(d=null),M.ancestor=f}return M.path=q?d===null?[]:d.split(q):[d],new u.Ref(M)},O.in=function(d,z={}){return O.create(d,{...z,in:!0})},O.isRef=function(d){return!!d&&!!d[N.symbols.ref]},u.Ref=class{constructor(d){c(typeof d=="object","Invalid reference construction"),N.assertOptions(d,["adjust","ancestor","in","iterables","map","path","render","separator","type","depth","key","root","display"]),c([!1,void 0].includes(d.separator)||typeof d.separator=="string"&&d.separator.length===1,"Invalid separator"),c(!d.adjust||typeof d.adjust=="function","options.adjust must be a function"),c(!d.map||Array.isArray(d.map),"options.map must be an array"),c(!d.map||!d.adjust,"Cannot set both map and adjust options"),Object.assign(this,u.defaults,d),c(this.type==="value"||this.ancestor===void 0,"Non-value references cannot reference ancestors"),Array.isArray(this.map)&&(this.map=new Map(this.map)),this.depth=this.path.length,this.key=this.path.length?this.path.join(this.separator):null,this.root=this.path[0],this.updateDisplay()}resolve(d,z,M,q,l={}){return c(!this.in||l.in,"Invalid in() reference usage"),this.type==="global"?this._resolve(M.context,z,l):this.type==="local"?this._resolve(q,z,l):this.ancestor?this.ancestor==="root"?this._resolve(z.ancestors[z.ancestors.length-1],z,l):(c(this.ancestor<=z.ancestors.length,"Invalid reference exceeds the schema root:",this.display),this._resolve(z.ancestors[this.ancestor-1],z,l)):this._resolve(d,z,l)}_resolve(d,z,M){let q;if(this.type==="value"&&z.mainstay.shadow&&M.shadow!==!1&&(q=z.mainstay.shadow.get(this.absolute(z))),q===void 0&&(q=v(d,this.path,{iterables:this.iterables,functions:!0})),this.adjust&&(q=this.adjust(q)),this.map){const l=this.map.get(q);l!==void 0&&(q=l)}return z.mainstay&&z.mainstay.tracer.resolve(z,this,q),q}toString(){return this.display}absolute(d){return[...d.path.slice(0,-this.ancestor),...this.path]}clone(){return new u.Ref(this)}describe(){const d={path:this.path};this.type!=="value"&&(d.type=this.type),this.separator!=="."&&(d.separator=this.separator),this.type==="value"&&this.ancestor!==1&&(d.ancestor=this.ancestor),this.map&&(d.map=[...this.map]);for(const z of["adjust","iterables","render"])this[z]!==null&&this[z]!==void 0&&(d[z]=this[z]);return this.in!==!1&&(d.in=!0),{ref:d}}updateDisplay(){const d=this.key!==null?this.key:"";if(this.type!=="value")return void(this.display=`ref:${this.type}:${d}`);if(!this.separator)return void(this.display=`ref:${d}`);if(!this.ancestor)return void(this.display=`ref:${this.separator}${d}`);if(this.ancestor==="root")return void(this.display=`ref:root:${d}`);if(this.ancestor===1)return void(this.display=`ref:${d||".."}`);const z=new Array(this.ancestor+1).fill(this.separator).join("");this.display=`ref:${z}${d||""}`}},u.Ref.prototype[N.symbols.ref]=!0,O.build=function(d){return(d=Object.assign({},u.defaults,d)).type==="value"&&d.ancestor===void 0&&(d.ancestor=1),new u.Ref(d)},u.context=function(d,z,M={}){if(d=d.trim(),M){const q=M.global===void 0?"$":M.global;if(q!==z&&d.startsWith(q))return{key:d.slice(q.length),type:"global"};const l=M.local===void 0?"#":M.local;if(l!==z&&d.startsWith(l))return{key:d.slice(l.length),type:"local"};const f=M.root===void 0?"/":M.root;if(f!==z&&d.startsWith(f))return{key:d.slice(f.length),type:"value",root:!0}}return{key:d,type:"value"}},u.ancestor=function(d,z){if(!z)return[1,0];if(d[0]!==z)return[1,0];if(d[1]!==z)return[0,1];let M=2;for(;d[M]===z;)++M;return[M-1,M]},O.toSibling=0,O.toParent=1,O.Manager=class{constructor(){this.refs=[]}register(d,z){if(d)if(z=z===void 0?O.toParent:z,Array.isArray(d))for(const M of d)this.register(M,z);else if(N.isSchema(d))for(const M of d._refs.refs)M.ancestor-z>=0&&this.refs.push({ancestor:M.ancestor-z,root:M.root});else O.isRef(d)&&d.type==="value"&&d.ancestor-z>=0&&this.refs.push({ancestor:d.ancestor-z,root:d.root}),s=s||A(3328),s.isTemplate(d)&&this.register(d.refs(),z)}get length(){return this.refs.length}clone(){const d=new O.Manager;return d.refs=y(this.refs),d}reset(){this.refs=[]}roots(){return this.refs.filter(d=>!d.ancestor).map(d=>d.root)}}},3378:(a,O,A)=>{const c=A(5107),y={};y.wrap=c.string().min(1).max(2).allow(!1),O.preferences=c.object({allowUnknown:c.boolean(),abortEarly:c.boolean(),artifacts:c.boolean(),cache:c.boolean(),context:c.object(),convert:c.boolean(),dateFormat:c.valid("date","iso","string","time","utc"),debug:c.boolean(),errors:{escapeHtml:c.boolean(),label:c.valid("path","key",!1),language:[c.string(),c.object().ref()],render:c.boolean(),stack:c.boolean(),wrap:{label:y.wrap,array:y.wrap,string:y.wrap}},externals:c.boolean(),messages:c.object(),noDefaults:c.boolean(),nonEnumerables:c.boolean(),presence:c.valid("required","optional","forbidden"),skipFunctions:c.boolean(),stripUnknown:c.object({arrays:c.boolean(),objects:c.boolean()}).or("arrays","objects").allow(!0,!1),warnings:c.boolean()}).strict(),y.nameRx=/^[a-zA-Z0-9]\w*$/,y.rule=c.object({alias:c.array().items(c.string().pattern(y.nameRx)).single(),args:c.array().items(c.string(),c.object({name:c.string().pattern(y.nameRx).required(),ref:c.boolean(),assert:c.alternatives([c.function(),c.object().schema()]).conditional("ref",{is:!0,then:c.required()}),normalize:c.function(),message:c.string().when("assert",{is:c.function(),then:c.required()})})),convert:c.boolean(),manifest:c.boolean(),method:c.function().allow(!1),multi:c.boolean(),validate:c.function()}),O.extension=c.object({type:c.alternatives([c.string(),c.object().regex()]).required(),args:c.function(),cast:c.object().pattern(y.nameRx,c.object({from:c.function().maxArity(1).required(),to:c.function().minArity(1).maxArity(2).required()})),base:c.object().schema().when("type",{is:c.object().regex(),then:c.forbidden()}),coerce:[c.function().maxArity(3),c.object({method:c.function().maxArity(3).required(),from:c.array().items(c.string()).single()})],flags:c.object().pattern(y.nameRx,c.object({setter:c.string(),default:c.any()})),manifest:{build:c.function().arity(2)},messages:[c.object(),c.string()],modifiers:c.object().pattern(y.nameRx,c.function().minArity(1).maxArity(2)),overrides:c.object().pattern(y.nameRx,c.function()),prepare:c.function().maxArity(3),rebuild:c.function().arity(1),rules:c.object().pattern(y.nameRx,y.rule),terms:c.object().pattern(y.nameRx,c.object({init:c.array().allow(null).required(),manifest:c.object().pattern(/.+/,[c.valid("schema","single"),c.object({mapped:c.object({from:c.string().required(),to:c.string().required()}).required()})])})),validate:c.function().maxArity(3)}).strict(),O.extensions=c.array().items(c.object(),c.function().arity(1)).strict(),y.desc={buffer:c.object({buffer:c.string()}),func:c.object({function:c.function().required(),options:{literal:!0}}),override:c.object({override:!0}),ref:c.object({ref:c.object({type:c.valid("value","global","local"),path:c.array().required(),separator:c.string().length(1).allow(!1),ancestor:c.number().min(0).integer().allow("root"),map:c.array().items(c.array().length(2)).min(1),adjust:c.function(),iterables:c.boolean(),in:c.boolean(),render:c.boolean()}).required()}),regex:c.object({regex:c.string().min(3)}),special:c.object({special:c.valid("deep").required()}),template:c.object({template:c.string().required(),options:c.object()}),value:c.object({value:c.alternatives([c.object(),c.array()]).required()})},y.desc.entity=c.alternatives([c.array().items(c.link("...")),c.boolean(),c.function(),c.number(),c.string(),y.desc.buffer,y.desc.func,y.desc.ref,y.desc.regex,y.desc.special,y.desc.template,y.desc.value,c.link("/")]),y.desc.values=c.array().items(null,c.boolean(),c.function(),c.number().allow(1/0,-1/0),c.string().allow(""),c.symbol(),y.desc.buffer,y.desc.func,y.desc.override,y.desc.ref,y.desc.regex,y.desc.template,y.desc.value),y.desc.messages=c.object().pattern(/.+/,[c.string(),y.desc.template,c.object().pattern(/.+/,[c.string(),y.desc.template])]),O.description=c.object({type:c.string().required(),flags:c.object({cast:c.string(),default:c.any(),description:c.string(),empty:c.link("/"),failover:y.desc.entity,id:c.string(),label:c.string(),only:!0,presence:["optional","required","forbidden"],result:["raw","strip"],strip:c.boolean(),unit:c.string()}).unknown(),preferences:{allowUnknown:c.boolean(),abortEarly:c.boolean(),artifacts:c.boolean(),cache:c.boolean(),convert:c.boolean(),dateFormat:["date","iso","string","time","utc"],errors:{escapeHtml:c.boolean(),label:["path","key"],language:[c.string(),y.desc.ref],wrap:{label:y.wrap,array:y.wrap}},externals:c.boolean(),messages:y.desc.messages,noDefaults:c.boolean(),nonEnumerables:c.boolean(),presence:["required","optional","forbidden"],skipFunctions:c.boolean(),stripUnknown:c.object({arrays:c.boolean(),objects:c.boolean()}).or("arrays","objects").allow(!0,!1),warnings:c.boolean()},allow:y.desc.values,invalid:y.desc.values,rules:c.array().min(1).items({name:c.string().required(),args:c.object().min(1),keep:c.boolean(),message:[c.string(),y.desc.messages],warn:c.boolean()}),keys:c.object().pattern(/.*/,c.link("/")),link:y.desc.ref}).pattern(/^[a-z]\w*$/,c.any())},493:(a,O,A)=>{const{clone:c,reach:y}=A(8870),v=A(8160),N={value:Symbol("value")};a.exports=N.State=class{constructor(s,u,d){this.path=s,this.ancestors=u,this.mainstay=d.mainstay,this.schemas=d.schemas,this.debug=null}localize(s,u=null,d=null){const z=new N.State(s,u,this);return d&&z.schemas&&(z.schemas=[N.schemas(d),...z.schemas]),z}nest(s,u){const d=new N.State(this.path,this.ancestors,this);return d.schemas=d.schemas&&[N.schemas(s),...d.schemas],d.debug=u,d}shadow(s,u){this.mainstay.shadow=this.mainstay.shadow||new N.Shadow,this.mainstay.shadow.set(this.path,s,u)}snapshot(){this.mainstay.shadow&&(this._snapshot=c(this.mainstay.shadow.node(this.path))),this.mainstay.snapshot()}restore(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0),this.mainstay.restore()}commit(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0),this.mainstay.commit()}},N.schemas=function(s){return v.isSchema(s)?{schema:s}:s},N.Shadow=class{constructor(){this._values=null}set(s,u,d){if(!s.length||d==="strip"&&typeof s[s.length-1]=="number")return;this._values=this._values||new Map;let z=this._values;for(let M=0;M<s.length;++M){const q=s[M];let l=z.get(q);l||(l=new Map,z.set(q,l)),z=l}z[N.value]=u}get(s){const u=this.node(s);if(u)return u[N.value]}node(s){if(this._values)return y(this._values,s,{iterables:!0})}override(s,u){if(!this._values)return;const d=s.slice(0,-1),z=s[s.length-1],M=y(this._values,d,{iterables:!0});u?M.set(z,u):M&&M.delete(z)}}},3328:(a,O,A)=>{const{assert:c,clone:y,escapeHtml:v}=A(8870),N=A(4964),s=A(8160),u=A(6354),d=A(6133),z={symbol:Symbol("template"),opens:new Array(1e3).join("\0"),closes:new Array(1e3).join(""),dateFormat:{date:Date.prototype.toDateString,iso:Date.prototype.toISOString,string:Date.prototype.toString,time:Date.prototype.toTimeString,utc:Date.prototype.toUTCString}};a.exports=z.Template=class{constructor(M,q){if(c(typeof M=="string","Template source must be a string"),c(!M.includes("\0")&&!M.includes(""),"Template source cannot contain reserved control characters"),this.source=M,this.rendered=M,this._template=null,q){const{functions:l,...f}=q;this._settings=Object.keys(f).length?y(f):void 0,this._functions=l,this._functions&&(c(Object.keys(this._functions).every(g=>typeof g=="string"),"Functions keys must be strings"),c(Object.values(this._functions).every(g=>typeof g=="function"),"Functions values must be functions"))}else this._settings=void 0,this._functions=void 0;this._parse()}_parse(){if(!this.source.includes("{"))return;const M=z.encode(this.source),q=z.split(M);let l=!1;const f=[],g=q.shift();g&&f.push(g);for(const L of q){const T=L[0]!=="{",X=T?"}":"}}",C=L.indexOf(X);if(C===-1||L[1]==="{"){f.push(`{${z.decode(L)}`);continue}let m=L.slice(T?0:1,C);const w=m[0]===":";w&&(m=m.slice(1));const E=this._ref(z.decode(m),{raw:T,wrapped:w});f.push(E),typeof E!="string"&&(l=!0);const U=L.slice(C+X.length);U&&f.push(z.decode(U))}l?this._template=f:this.rendered=f.join("")}static date(M,q){return z.dateFormat[q.dateFormat].call(M)}describe(M={}){if(!this._settings&&M.compact)return this.source;const q={template:this.source};return this._settings&&(q.options=this._settings),this._functions&&(q.functions=this._functions),q}static build(M){return new z.Template(M.template,M.options||M.functions?{...M.options,functions:M.functions}:void 0)}isDynamic(){return!!this._template}static isTemplate(M){return!!M&&!!M[s.symbols.template]}refs(){if(!this._template)return;const M=[];for(const q of this._template)typeof q!="string"&&M.push(...q.refs);return M}resolve(M,q,l,f){return this._template&&this._template.length===1?this._part(this._template[0],M,q,l,f,{}):this.render(M,q,l,f)}_part(M,...q){return M.ref?M.ref.resolve(...q):M.formula.evaluate(q)}render(M,q,l,f,g={}){if(!this.isDynamic())return this.rendered;const L=[];for(const T of this._template)if(typeof T=="string")L.push(T);else{const X=this._part(T,M,q,l,f,g),C=z.stringify(X,M,q,l,f,g);if(C!==void 0){const m=T.raw||(g.errors&&g.errors.escapeHtml)===!1?C:v(C);L.push(z.wrap(m,T.wrapped&&l.errors.wrap.label))}}return L.join("")}_ref(M,{raw:q,wrapped:l}){const f=[],g=T=>{const X=d.create(T,this._settings);return f.push(X),C=>{const m=X.resolve(...C);return m!==void 0?m:null}};try{const T=this._functions?{...z.functions,...this._functions}:z.functions;var L=new N.Parser(M,{reference:g,functions:T,constants:z.constants})}catch(T){throw T.message=`Invalid template variable "${M}" fails due to: ${T.message}`,T}if(L.single){if(L.single.type==="reference"){const T=f[0];return{ref:T,raw:q,refs:f,wrapped:l||T.type==="local"&&T.key==="label"}}return z.stringify(L.single.value)}return{formula:L,raw:q,refs:f}}toString(){return this.source}},z.Template.prototype[s.symbols.template]=!0,z.Template.prototype.isImmutable=!0,z.encode=function(M){return M.replace(/\\(\{+)/g,(q,l)=>z.opens.slice(0,l.length)).replace(/\\(\}+)/g,(q,l)=>z.closes.slice(0,l.length))},z.decode=function(M){return M.replace(/\u0000/g,"{").replace(/\u0001/g,"}")},z.split=function(M){const q=[];let l="";for(let f=0;f<M.length;++f){const g=M[f];if(g==="{"){let L="";for(;f+1<M.length&&M[f+1]==="{";)L+="{",++f;q.push(l),l=L}else l+=g}return q.push(l),q},z.wrap=function(M,q){return q?q.length===1?`${q}${M}${q}`:`${q[0]}${M}${q[1]}`:M},z.stringify=function(M,q,l,f,g,L={}){const T=typeof M,X=f&&f.errors&&f.errors.wrap||{};let C=!1;if(d.isRef(M)&&M.render&&(C=M.in,M=M.resolve(q,l,f,g,{in:M.in,...L})),M===null)return"null";if(T==="string")return z.wrap(M,L.arrayItems&&X.string);if(T==="number"||T==="function"||T==="symbol")return M.toString();if(T!=="object")return JSON.stringify(M);if(M instanceof Date)return z.Template.date(M,f);if(M instanceof Map){const w=[];for(const[E,U]of M.entries())w.push(`${E.toString()} -> ${U.toString()}`);M=w}if(!Array.isArray(M))return M.toString();const m=[];for(const w of M)m.push(z.stringify(w,q,l,f,g,{arrayItems:!0,...L}));return z.wrap(m.join(", "),!C&&X.array)},z.constants={true:!0,false:!1,null:null,second:1e3,minute:6e4,hour:36e5,day:864e5},z.functions={if:(M,q,l)=>M?q:l,length:M=>typeof M=="string"?M.length:M&&typeof M=="object"?Array.isArray(M)?M.length:Object.keys(M).length:null,msg(M){const[q,l,f,g,L]=this,T=L.messages;if(!T)return"";const X=u.template(q,T[0],M,l,f)||u.template(q,T[1],M,l,f);return X?X.render(q,l,f,g,L):""},number:M=>typeof M=="number"?M:typeof M=="string"?parseFloat(M):typeof M=="boolean"?M?1:0:M instanceof Date?M.getTime():null}},2305:(a,O,A)=>{const{deepEqual:c}=A(8870),y=A(7593),v=A(6354),N={codes:{error:1,pass:2,full:3},labels:{0:"never used",1:"always error",2:"always pass"}};O.setup=function(s){const u=function(){return s._tracer=s._tracer||new N.Tracer,s._tracer};s.trace=u,s[Symbol.for("@hapi/lab/coverage/initialize")]=u,s.untrace=()=>{s._tracer=null}},O.location=function(s){return s.$_setFlag("_tracerLocation",y.location(2))},N.Tracer=class{constructor(){this.name="Joi",this._schemas=new Map}_register(s){const u=this._schemas.get(s);if(u)return u.store;const d=new N.Store(s),{filename:z,line:M}=s._flags._tracerLocation||y.location(5);return this._schemas.set(s,{filename:z,line:M,store:d}),d}_combine(s,u){for(const{store:d}of this._schemas.values())d._combine(s,u)}report(s){const u=[];for(const{filename:d,line:z,store:M}of this._schemas.values()){if(s&&s!==d)continue;const q=[],l=[];for(const[f,g]of M._sources.entries()){if(N.sub(g.paths,l))continue;if(!g.entry){q.push({status:"never reached",paths:[...g.paths]}),l.push(...g.paths);continue}for(const T of["valid","invalid"]){const X=f[`_${T}s`];if(!X)continue;const C=new Set(X._values),m=new Set(X._refs);for(const{value:w,ref:E}of g[T])C.delete(w),m.delete(E);(C.size||m.size)&&q.push({status:[...C,...[...m].map(w=>w.display)],rule:`${T}s`})}const L=f._rules.map(T=>T.name);for(const T of["default","failover"])f._flags[T]!==void 0&&L.push(T);for(const T of L){const X=N.labels[g.rule[T]||0];if(X){const C={rule:T,status:X};g.paths.size&&(C.paths=[...g.paths]),q.push(C)}}}q.length&&u.push({filename:d,line:z,missing:q,severity:"error",message:`Schema missing tests for ${q.map(N.message).join(", ")}`})}return u.length?u:null}},N.Store=class{constructor(s){this.active=!0,this._sources=new Map,this._combos=new Map,this._scan(s)}debug(s,u,d,z){s.mainstay.debug&&s.mainstay.debug.push({type:u,name:d,result:z,path:s.path})}entry(s,u){N.debug(u,{type:"entry"}),this._record(s,d=>{d.entry=!0})}filter(s,u,d,z){N.debug(u,{type:d,...z}),this._record(s,M=>{M[d].add(z)})}log(s,u,d,z,M){N.debug(u,{type:d,name:z,result:M==="full"?"pass":M}),this._record(s,q=>{q[d][z]=q[d][z]||0,q[d][z]|=N.codes[M]})}resolve(s,u,d){if(!s.mainstay.debug)return;const z={type:"resolve",ref:u.display,to:d,path:s.path};s.mainstay.debug.push(z)}value(s,u,d,z,M){if(!s.mainstay.debug||c(d,z))return;const q={type:"value",by:u,from:d,to:z,path:s.path};M&&(q.name=M),s.mainstay.debug.push(q)}_record(s,u){const d=this._sources.get(s);if(d)return void u(d);const z=this._combos.get(s);for(const M of z)this._record(M,u)}_scan(s,u){const d=u||[];let z=this._sources.get(s);z||(z={paths:new Set,entry:!1,rule:{},valid:new Set,invalid:new Set},this._sources.set(s,z)),d.length&&z.paths.add(d),s.$_modify({each:(M,q)=>{const l=N.id(M,q);this._scan(M,d.concat(l))},ref:!1})}_combine(s,u){this._combos.set(s,u)}},N.message=function(s){return`${s.paths?v.path(s.paths[0])+(s.rule?":":""):""}${s.rule||""} (${s.status})`},N.id=function(s,{source:u,name:d,path:z,key:M}){return s._flags.id?s._flags.id:M||(d=`@${d}`,u==="terms"?[d,z[Math.min(z.length-1,1)]]:d)},N.sub=function(s,u){for(const d of s)for(const z of u)if(c(d.slice(0,z.length),z))return!0;return!1},N.debug=function(s,u){s.mainstay.debug&&(u.path=s.debug?[...s.path,s.debug]:s.path,s.mainstay.debug.push(u))}},4946:(a,O,A)=>{const{assert:c,merge:y}=A(8870),v=A(8068),N=A(8160),s=A(3292),u=A(6354),d=A(6133),z={};a.exports=v.extend({type:"alternatives",flags:{match:{default:"any"}},terms:{matches:{init:[],register:d.toSibling}},args:(M,...q)=>q.length===1&&Array.isArray(q[0])?M.try(...q[0]):M.try(...q),validate(M,q){const{schema:l,error:f,state:g,prefs:L}=q;if(l._flags.match){const X=[],C=[];for(let w=0;w<l.$_terms.matches.length;++w){const E=l.$_terms.matches[w],U=g.nest(E.schema,`match.${w}`);U.snapshot();const z0=E.schema.$_validate(M,U,L);z0.errors?(C.push(z0.errors),U.restore()):(X.push(z0.value),U.commit())}if(X.length===0)return{errors:f("alternatives.any",{details:C.map(w=>u.details(w,{override:!1}))})};if(l._flags.match==="one")return X.length===1?{value:X[0]}:{errors:f("alternatives.one")};if(X.length!==l.$_terms.matches.length)return{errors:f("alternatives.all",{details:C.map(w=>u.details(w,{override:!1}))})};const m=w=>w.$_terms.matches.some(E=>E.schema.type==="object"||E.schema.type==="alternatives"&&m(E.schema));return m(l)?{value:X.reduce((w,E)=>y(w,E,{mergeArrays:!1}))}:{value:X[X.length-1]}}const T=[];for(let X=0;X<l.$_terms.matches.length;++X){const C=l.$_terms.matches[X];if(C.schema){const E=g.nest(C.schema,`match.${X}`);E.snapshot();const U=C.schema.$_validate(M,E,L);if(!U.errors)return E.commit(),U;E.restore(),T.push({schema:C.schema,reports:U.errors});continue}const m=C.ref?C.ref.resolve(M,g,L):M,w=C.is?[C]:C.switch;for(let E=0;E<w.length;++E){const U=w[E],{is:z0,then:a0,otherwise:V}=U,Z=`match.${X}${C.switch?"."+E:""}`;if(z0.$_match(m,g.nest(z0,`${Z}.is`),L)){if(a0)return a0.$_validate(M,g.nest(a0,`${Z}.then`),L)}else if(V)return V.$_validate(M,g.nest(V,`${Z}.otherwise`),L)}}return z.errors(T,q)},rules:{conditional:{method(M,q){c(!this._flags._endedSwitch,"Unreachable condition"),c(!this._flags.match,"Cannot combine match mode",this._flags.match,"with conditional rule"),c(q.break===void 0,"Cannot use break option with alternatives conditional");const l=this.clone(),f=s.when(l,M,q),g=f.is?[f]:f.switch;for(const L of g)if(L.then&&L.otherwise){l.$_setFlag("_endedSwitch",!0,{clone:!1});break}return l.$_terms.matches.push(f),l.$_mutateRebuild()}},match:{method(M){if(c(["any","one","all"].includes(M),"Invalid alternatives match mode",M),M!=="any")for(const q of this.$_terms.matches)c(q.schema,"Cannot combine match mode",M,"with conditional rules");return this.$_setFlag("match",M)}},try:{method(...M){c(M.length,"Missing alternative schemas"),N.verifyFlat(M,"try"),c(!this._flags._endedSwitch,"Unreachable condition");const q=this.clone();for(const l of M)q.$_terms.matches.push({schema:q.$_compile(l)});return q.$_mutateRebuild()}}},overrides:{label(M){return this.$_parent("label",M).$_modify({each:(q,l)=>l.path[0]!=="is"?q.label(M):void 0,ref:!1})}},rebuild(M){M.$_modify({each:q=>{N.isSchema(q)&&q.type==="array"&&M.$_setFlag("_arrayItems",!0,{clone:!1})}})},manifest:{build(M,q){if(q.matches)for(const l of q.matches){const{schema:f,ref:g,is:L,not:T,then:X,otherwise:C}=l;M=f?M.try(f):g?M.conditional(g,{is:L,then:X,not:T,otherwise:C,switch:l.switch}):M.conditional(L,{then:X,otherwise:C})}return M}},messages:{"alternatives.all":"{{#label}} does not match all of the required types","alternatives.any":"{{#label}} does not match any of the allowed types","alternatives.match":"{{#label}} does not match any of the allowed types","alternatives.one":"{{#label}} matches more than one allowed type","alternatives.types":"{{#label}} must be one of {{#types}}"}}),z.errors=function(M,{error:q,state:l}){if(!M.length)return{errors:q("alternatives.any")};if(M.length===1)return{errors:M[0].reports};const f=new Set,g=[];for(const{reports:L,schema:T}of M){if(L.length>1)return z.unmatched(M,q);const X=L[0];if(X instanceof u.Report==0)return z.unmatched(M,q);if(X.state.path.length!==l.path.length){g.push({type:T.type,report:X});continue}if(X.code==="any.only"){for(const w of X.local.valids)f.add(w);continue}const[C,m]=X.code.split(".");m==="base"?f.add(C):g.push({type:T.type,report:X})}return g.length?g.length===1?{errors:g[0].report}:z.unmatched(M,q):{errors:q("alternatives.types",{types:[...f]})}},z.unmatched=function(M,q){const l=[];for(const f of M)l.push(...f.reports);return{errors:q("alternatives.match",u.details(l,{override:!1}))}}},8068:(a,O,A)=>{const{assert:c}=A(8870),y=A(7629),v=A(8160),N=A(6914);a.exports=y.extend({type:"any",flags:{only:{default:!1}},terms:{alterations:{init:null},examples:{init:null},externals:{init:null},metas:{init:[]},notes:{init:[]},shared:{init:null},tags:{init:[]},whens:{init:null}},rules:{custom:{method(s,u){return c(typeof s=="function","Method must be a function"),c(u===void 0||u&&typeof u=="string","Description must be a non-empty string"),this.$_addRule({name:"custom",args:{method:s,description:u}})},validate(s,u,{method:d}){try{return d(s,u)}catch(z){return u.error("any.custom",{error:z})}},args:["method","description"],multi:!0},messages:{method(s){return this.prefs({messages:s})}},shared:{method(s){c(v.isSchema(s)&&s._flags.id,"Schema must be a schema with an id");const u=this.clone();return u.$_terms.shared=u.$_terms.shared||[],u.$_terms.shared.push(s),u.$_mutateRegister(s),u}},warning:{method(s,u){return c(s&&typeof s=="string","Invalid warning code"),this.$_addRule({name:"warning",args:{code:s,local:u},warn:!0})},validate:(s,u,{code:d,local:z})=>u.error(d,z),args:["code","local"],multi:!0}},modifiers:{keep(s,u=!0){s.keep=u},message(s,u){s.message=N.compile(u)},warn(s,u=!0){s.warn=u}},manifest:{build(s,u){for(const d in u){const z=u[d];if(["examples","externals","metas","notes","tags"].includes(d))for(const M of z)s=s[d.slice(0,-1)](M);else if(d!=="alterations")if(d!=="whens"){if(d==="shared")for(const M of z)s=s.shared(M)}else for(const M of z){const{ref:q,is:l,not:f,then:g,otherwise:L,concat:T}=M;s=T?s.concat(T):q?s.when(q,{is:l,not:f,then:g,otherwise:L,switch:M.switch,break:M.break}):s.when(l,{then:g,otherwise:L,break:M.break})}else{const M={};for(const{target:q,adjuster:l}of z)M[q]=l;s=s.alter(M)}}return s}},messages:{"any.custom":"{{#label}} failed custom validation because {{#error.message}}","any.default":"{{#label}} threw an error when running default method","any.failover":"{{#label}} threw an error when running failover method","any.invalid":"{{#label}} contains an invalid value","any.only":'{{#label}} must be {if(#valids.length == 1, "", "one of ")}{{#valids}}',"any.ref":"{{#label}} {{#arg}} references {{:#ref}} which {{#reason}}","any.required":"{{#label}} is required","any.unknown":"{{#label}} is not allowed"}})},546:(a,O,A)=>{const{assert:c,deepEqual:y,reach:v}=A(8870),N=A(8068),s=A(8160),u=A(3292),d={};a.exports=N.extend({type:"array",flags:{single:{default:!1},sparse:{default:!1}},terms:{items:{init:[],manifest:"schema"},ordered:{init:[],manifest:"schema"},_exclusions:{init:[]},_inclusions:{init:[]},_requireds:{init:[]}},coerce:{from:"object",method(z,{schema:M,state:q,prefs:l}){if(!Array.isArray(z))return;const f=M.$_getRule("sort");return f?d.sort(M,z,f.args.options,q,l):void 0}},validate(z,{schema:M,error:q}){if(!Array.isArray(z)){if(M._flags.single){const l=[z];return l[s.symbols.arraySingle]=!0,{value:l}}return{errors:q("array.base")}}if(M.$_getRule("items")||M.$_terms.externals)return{value:z.slice()}},rules:{has:{method(z){z=this.$_compile(z,{appendPath:!0});const M=this.$_addRule({name:"has",args:{schema:z}});return M.$_mutateRegister(z),M},validate(z,{state:M,prefs:q,error:l},{schema:f}){const g=[z,...M.ancestors];for(let T=0;T<z.length;++T){const X=M.localize([...M.path,T],g,f);if(f.$_match(z[T],X,q))return z}const L=f._flags.label;return L?l("array.hasKnown",{patternLabel:L}):l("array.hasUnknown",null)},multi:!0},items:{method(...z){s.verifyFlat(z,"items");const M=this.$_addRule("items");for(let q=0;q<z.length;++q){const l=s.tryWithPath(()=>this.$_compile(z[q]),q,{append:!0});M.$_terms.items.push(l)}return M.$_mutateRebuild()},validate(z,{schema:M,error:q,state:l,prefs:f,errorsArray:g}){const L=M.$_terms._requireds.slice(),T=M.$_terms.ordered.slice(),X=[...M.$_terms._inclusions,...L],C=!z[s.symbols.arraySingle];delete z[s.symbols.arraySingle];const m=g();let w=z.length;for(let E=0;E<w;++E){const U=z[E];let z0=!1,a0=!1;const V=C?E:new Number(E),Z=[...l.path,V];if(!M._flags.sparse&&U===void 0){if(m.push(q("array.sparse",{key:V,path:Z,pos:E,value:void 0},l.localize(Z))),f.abortEarly)return m;T.shift();continue}const u0=[z,...l.ancestors];for(const $0 of M.$_terms._exclusions)if($0.$_match(U,l.localize(Z,u0,$0),f,{presence:"ignore"})){if(m.push(q("array.excludes",{pos:E,value:U},l.localize(Z))),f.abortEarly)return m;z0=!0,T.shift();break}if(z0)continue;if(M.$_terms.ordered.length){if(T.length){const $0=T.shift(),h1=$0.$_validate(U,l.localize(Z,u0,$0),f);if(h1.errors){if(m.push(...h1.errors),f.abortEarly)return m}else if($0._flags.result==="strip")d.fastSplice(z,E),--E,--w;else{if(!M._flags.sparse&&h1.value===void 0){if(m.push(q("array.sparse",{key:V,path:Z,pos:E,value:void 0},l.localize(Z))),f.abortEarly)return m;continue}z[E]=h1.value}continue}if(!M.$_terms.items.length){if(m.push(q("array.orderedLength",{pos:E,limit:M.$_terms.ordered.length})),f.abortEarly)return m;break}}const L0=[];let X0=L.length;for(let $0=0;$0<X0;++$0){const h1=l.localize(Z,u0,L[$0]);h1.snapshot();const d1=L[$0].$_validate(U,h1,f);if(L0[$0]=d1,!d1.errors){if(h1.commit(),z[E]=d1.value,a0=!0,d.fastSplice(L,$0),--$0,--X0,!M._flags.sparse&&d1.value===void 0&&(m.push(q("array.sparse",{key:V,path:Z,pos:E,value:void 0},l.localize(Z))),f.abortEarly))return m;break}h1.restore()}if(a0)continue;const B0=f.stripUnknown&&!!f.stripUnknown.arrays||!1;X0=X.length;for(const $0 of X){let h1;const d1=L.indexOf($0);if(d1!==-1)h1=L0[d1];else{const k1=l.localize(Z,u0,$0);if(k1.snapshot(),h1=$0.$_validate(U,k1,f),!h1.errors){k1.commit(),$0._flags.result==="strip"?(d.fastSplice(z,E),--E,--w):M._flags.sparse||h1.value!==void 0?z[E]=h1.value:(m.push(q("array.sparse",{key:V,path:Z,pos:E,value:void 0},l.localize(Z))),z0=!0),a0=!0;break}k1.restore()}if(X0===1){if(B0){d.fastSplice(z,E),--E,--w,a0=!0;break}if(m.push(...h1.errors),f.abortEarly)return m;z0=!0;break}}if(!z0&&(M.$_terms._inclusions.length||M.$_terms._requireds.length)&&!a0){if(B0){d.fastSplice(z,E),--E,--w;continue}if(m.push(q("array.includes",{pos:E,value:U},l.localize(Z))),f.abortEarly)return m}}return L.length&&d.fillMissedErrors(M,m,L,z,l,f),T.length&&(d.fillOrderedErrors(M,m,T,z,l,f),m.length||d.fillDefault(T,z,l,f)),m.length?m:z},priority:!0,manifest:!1},length:{method(z){return this.$_addRule({name:"length",args:{limit:z},operator:"="})},validate:(z,M,{limit:q},{name:l,operator:f,args:g})=>s.compare(z.length,q,f)?z:M.error("array."+l,{limit:g.limit,value:z}),args:[{name:"limit",ref:!0,assert:s.limit,message:"must be a positive integer"}]},max:{method(z){return this.$_addRule({name:"max",method:"length",args:{limit:z},operator:"<="})}},min:{method(z){return this.$_addRule({name:"min",method:"length",args:{limit:z},operator:">="})}},ordered:{method(...z){s.verifyFlat(z,"ordered");const M=this.$_addRule("items");for(let q=0;q<z.length;++q){const l=s.tryWithPath(()=>this.$_compile(z[q]),q,{append:!0});d.validateSingle(l,M),M.$_mutateRegister(l),M.$_terms.ordered.push(l)}return M.$_mutateRebuild()}},single:{method(z){const M=z===void 0||!!z;return c(!M||!this._flags._arrayItems,"Cannot specify single rule when array has array items"),this.$_setFlag("single",M)}},sort:{method(z={}){s.assertOptions(z,["by","order"]);const M={order:z.order||"ascending"};return z.by&&(M.by=u.ref(z.by,{ancestor:0}),c(!M.by.ancestor,"Cannot sort by ancestor")),this.$_addRule({name:"sort",args:{options:M}})},validate(z,{error:M,state:q,prefs:l,schema:f},{options:g}){const{value:L,errors:T}=d.sort(f,z,g,q,l);if(T)return T;for(let X=0;X<z.length;++X)if(z[X]!==L[X])return M("array.sort",{order:g.order,by:g.by?g.by.key:"value"});return z},convert:!0},sparse:{method(z){const M=z===void 0||!!z;return this._flags.sparse===M?this:(M?this.clone():this.$_addRule("items")).$_setFlag("sparse",M,{clone:!1})}},unique:{method(z,M={}){c(!z||typeof z=="function"||typeof z=="string","comparator must be a function or a string"),s.assertOptions(M,["ignoreUndefined","separator"]);const q={name:"unique",args:{options:M,comparator:z}};if(z)if(typeof z=="string"){const l=s.default(M.separator,".");q.path=l?z.split(l):[z]}else q.comparator=z;return this.$_addRule(q)},validate(z,{state:M,error:q,schema:l},{comparator:f,options:g},{comparator:L,path:T}){const X={string:Object.create(null),number:Object.create(null),undefined:Object.create(null),boolean:Object.create(null),object:new Map,function:new Map,custom:new Map},C=L||y,m=g.ignoreUndefined;for(let w=0;w<z.length;++w){const E=T?v(z[w],T):z[w],U=L?X.custom:X[typeof E];if(c(U,"Failed to find unique map container for type",typeof E),U instanceof Map){const z0=U.entries();let a0;for(;!(a0=z0.next()).done;)if(C(a0.value[0],E)){const V=M.localize([...M.path,w],[z,...M.ancestors]),Z={pos:w,value:z[w],dupePos:a0.value[1],dupeValue:z[a0.value[1]]};return T&&(Z.path=f),q("array.unique",Z,V)}U.set(E,w)}else{if((!m||E!==void 0)&&U[E]!==void 0){const z0={pos:w,value:z[w],dupePos:U[E],dupeValue:z[U[E]]};return T&&(z0.path=f),q("array.unique",z0,M.localize([...M.path,w],[z,...M.ancestors]))}U[E]=w}}return z},args:["comparator","options"],multi:!0}},cast:{set:{from:Array.isArray,to:(z,M)=>new Set(z)}},rebuild(z){z.$_terms._inclusions=[],z.$_terms._exclusions=[],z.$_terms._requireds=[];for(const M of z.$_terms.items)d.validateSingle(M,z),M._flags.presence==="required"?z.$_terms._requireds.push(M):M._flags.presence==="forbidden"?z.$_terms._exclusions.push(M):z.$_terms._inclusions.push(M);for(const M of z.$_terms.ordered)d.validateSingle(M,z)},manifest:{build:(z,M)=>(M.items&&(z=z.items(...M.items)),M.ordered&&(z=z.ordered(...M.ordered)),z)},messages:{"array.base":"{{#label}} must be an array","array.excludes":"{{#label}} contains an excluded value","array.hasKnown":"{{#label}} does not contain at least one required match for type {:#patternLabel}","array.hasUnknown":"{{#label}} does not contain at least one required match","array.includes":"{{#label}} does not match any of the allowed types","array.includesRequiredBoth":"{{#label}} does not contain {{#knownMisses}} and {{#unknownMisses}} other required value(s)","array.includesRequiredKnowns":"{{#label}} does not contain {{#knownMisses}}","array.includesRequiredUnknowns":"{{#label}} does not contain {{#unknownMisses}} required value(s)","array.length":"{{#label}} must contain {{#limit}} items","array.max":"{{#label}} must contain less than or equal to {{#limit}} items","array.min":"{{#label}} must contain at least {{#limit}} items","array.orderedLength":"{{#label}} must contain at most {{#limit}} items","array.sort":"{{#label}} must be sorted in {#order} order by {{#by}}","array.sort.mismatching":"{{#label}} cannot be sorted due to mismatching types","array.sort.unsupported":"{{#label}} cannot be sorted due to unsupported type {#type}","array.sparse":"{{#label}} must not be a sparse array item","array.unique":"{{#label}} contains a duplicate value"}}),d.fillMissedErrors=function(z,M,q,l,f,g){const L=[];let T=0;for(const X of q){const C=X._flags.label;C?L.push(C):++T}L.length?T?M.push(z.$_createError("array.includesRequiredBoth",l,{knownMisses:L,unknownMisses:T},f,g)):M.push(z.$_createError("array.includesRequiredKnowns",l,{knownMisses:L},f,g)):M.push(z.$_createError("array.includesRequiredUnknowns",l,{unknownMisses:T},f,g))},d.fillOrderedErrors=function(z,M,q,l,f,g){const L=[];for(const T of q)T._flags.presence==="required"&&L.push(T);L.length&&d.fillMissedErrors(z,M,L,l,f,g)},d.fillDefault=function(z,M,q,l){const f=[];let g=!0;for(let L=z.length-1;L>=0;--L){const T=z[L],X=[M,...q.ancestors],C=T.$_validate(void 0,q.localize(q.path,X,T),l).value;if(g){if(C===void 0)continue;g=!1}f.unshift(C)}f.length&&M.push(...f)},d.fastSplice=function(z,M){let q=M;for(;q<z.length;)z[q++]=z[q];--z.length},d.validateSingle=function(z,M){(z.type==="array"||z._flags._arrayItems)&&(c(!M._flags.single,"Cannot specify array item with single rule enabled"),M.$_setFlag("_arrayItems",!0,{clone:!1}))},d.sort=function(z,M,q,l,f){const g=q.order==="ascending"?1:-1,L=-1*g,T=g,X=(C,m)=>{let w=d.compare(C,m,L,T);if(w!==null||(q.by&&(C=q.by.resolve(C,l,f),m=q.by.resolve(m,l,f)),w=d.compare(C,m,L,T),w!==null))return w;const E=typeof C;if(E!==typeof m)throw z.$_createError("array.sort.mismatching",M,null,l,f);if(E!=="number"&&E!=="string")throw z.$_createError("array.sort.unsupported",M,{type:E},l,f);return E==="number"?(C-m)*g:C<m?L:T};try{return{value:M.slice().sort(X)}}catch(C){return{errors:C}}},d.compare=function(z,M,q,l){return z===M?0:z===void 0?1:M===void 0?-1:z===null?l:M===null?q:null}},4937:(a,O,A)=>{const{assert:c}=A(8870),y=A(8068),v=A(8160),N=A(2036),s={isBool:function(u){return typeof u=="boolean"}};a.exports=y.extend({type:"boolean",flags:{sensitive:{default:!1}},terms:{falsy:{init:null,manifest:"values"},truthy:{init:null,manifest:"values"}},coerce(u,{schema:d}){if(typeof u!="boolean"){if(typeof u=="string"){const z=d._flags.sensitive?u:u.toLowerCase();u=z==="true"||z!=="false"&&u}return typeof u!="boolean"&&(u=d.$_terms.truthy&&d.$_terms.truthy.has(u,null,null,!d._flags.sensitive)||(!d.$_terms.falsy||!d.$_terms.falsy.has(u,null,null,!d._flags.sensitive))&&u),{value:u}}},validate(u,{error:d}){if(typeof u!="boolean")return{value:u,errors:d("boolean.base")}},rules:{truthy:{method(...u){v.verifyFlat(u,"truthy");const d=this.clone();d.$_terms.truthy=d.$_terms.truthy||new N;for(let z=0;z<u.length;++z){const M=u[z];c(M!==void 0,"Cannot call truthy with undefined"),d.$_terms.truthy.add(M)}return d}},falsy:{method(...u){v.verifyFlat(u,"falsy");const d=this.clone();d.$_terms.falsy=d.$_terms.falsy||new N;for(let z=0;z<u.length;++z){const M=u[z];c(M!==void 0,"Cannot call falsy with undefined"),d.$_terms.falsy.add(M)}return d}},sensitive:{method(u=!0){return this.$_setFlag("sensitive",u)}}},cast:{number:{from:s.isBool,to:(u,d)=>u?1:0},string:{from:s.isBool,to:(u,d)=>u?"true":"false"}},manifest:{build:(u,d)=>(d.truthy&&(u=u.truthy(...d.truthy)),d.falsy&&(u=u.falsy(...d.falsy)),u)},messages:{"boolean.base":"{{#label}} must be a boolean"}})},7500:(a,O,A)=>{const{assert:c}=A(8870),y=A(8068),v=A(8160),N=A(3328),s={isDate:function(u){return u instanceof Date}};a.exports=y.extend({type:"date",coerce:{from:["number","string"],method:(u,{schema:d})=>({value:s.parse(u,d._flags.format)||u})},validate(u,{schema:d,error:z,prefs:M}){if(u instanceof Date&&!isNaN(u.getTime()))return;const q=d._flags.format;return M.convert&&q&&typeof u=="string"?{value:u,errors:z("date.format",{format:q})}:{value:u,errors:z("date.base")}},rules:{compare:{method:!1,validate(u,d,{date:z},{name:M,operator:q,args:l}){const f=z==="now"?Date.now():z.getTime();return v.compare(u.getTime(),f,q)?u:d.error("date."+M,{limit:l.date,value:u})},args:[{name:"date",ref:!0,normalize:u=>u==="now"?u:s.parse(u),assert:u=>u!==null,message:"must have a valid date format"}]},format:{method(u){return c(["iso","javascript","unix"].includes(u),"Unknown date format",u),this.$_setFlag("format",u)}},greater:{method(u){return this.$_addRule({name:"greater",method:"compare",args:{date:u},operator:">"})}},iso:{method(){return this.format("iso")}},less:{method(u){return this.$_addRule({name:"less",method:"compare",args:{date:u},operator:"<"})}},max:{method(u){return this.$_addRule({name:"max",method:"compare",args:{date:u},operator:"<="})}},min:{method(u){return this.$_addRule({name:"min",method:"compare",args:{date:u},operator:">="})}},timestamp:{method(u="javascript"){return c(["javascript","unix"].includes(u),'"type" must be one of "javascript, unix"'),this.format(u)}}},cast:{number:{from:s.isDate,to:(u,d)=>u.getTime()},string:{from:s.isDate,to:(u,{prefs:d})=>N.date(u,d)}},messages:{"date.base":"{{#label}} must be a valid date","date.format":'{{#label}} must be in {msg("date.format." + #format) || #format} format',"date.greater":"{{#label}} must be greater than {{:#limit}}","date.less":"{{#label}} must be less than {{:#limit}}","date.max":"{{#label}} must be less than or equal to {{:#limit}}","date.min":"{{#label}} must be greater than or equal to {{:#limit}}","date.format.iso":"ISO 8601 date","date.format.javascript":"timestamp or number of milliseconds","date.format.unix":"timestamp or number of seconds"}}),s.parse=function(u,d){if(u instanceof Date)return u;if(typeof u!="string"&&(isNaN(u)||!isFinite(u))||/^\s*$/.test(u))return null;if(d==="iso")return v.isIsoDate(u)?s.date(u.toString()):null;const z=u;if(typeof u=="string"&&/^[+-]?\d+(\.\d+)?$/.test(u)&&(u=parseFloat(u)),d){if(d==="javascript")return s.date(1*u);if(d==="unix")return s.date(1e3*u);if(typeof z=="string")return null}return s.date(u)},s.date=function(u){const d=new Date(u);return isNaN(d.getTime())?null:d}},390:(a,O,A)=>{const{assert:c}=A(8870),y=A(7824);a.exports=y.extend({type:"function",properties:{typeof:"function"},rules:{arity:{method(v){return c(Number.isSafeInteger(v)&&v>=0,"n must be a positive integer"),this.$_addRule({name:"arity",args:{n:v}})},validate:(v,N,{n:s})=>v.length===s?v:N.error("function.arity",{n:s})},class:{method(){return this.$_addRule("class")},validate:(v,N)=>/^\s*class\s/.test(v.toString())?v:N.error("function.class",{value:v})},minArity:{method(v){return c(Number.isSafeInteger(v)&&v>0,"n must be a strict positive integer"),this.$_addRule({name:"minArity",args:{n:v}})},validate:(v,N,{n:s})=>v.length>=s?v:N.error("function.minArity",{n:s})},maxArity:{method(v){return c(Number.isSafeInteger(v)&&v>=0,"n must be a positive integer"),this.$_addRule({name:"maxArity",args:{n:v}})},validate:(v,N,{n:s})=>v.length<=s?v:N.error("function.maxArity",{n:s})}},messages:{"function.arity":"{{#label}} must have an arity of {{#n}}","function.class":"{{#label}} must be a class","function.maxArity":"{{#label}} must have an arity lesser or equal to {{#n}}","function.minArity":"{{#label}} must have an arity greater or equal to {{#n}}"}})},7824:(a,O,A)=>{const{applyToDefaults:c,assert:y,clone:v}=A(8870),N=A(3652),s=A(8068),u=A(8160),d=A(3292),z=A(6354),M=A(6133),q=A(3328),l={renameDefaults:{alias:!1,multiple:!1,override:!1}};a.exports=s.extend({type:"_keys",properties:{typeof:"object"},flags:{unknown:{default:!1}},terms:{dependencies:{init:null},keys:{init:null,manifest:{mapped:{from:"schema",to:"key"}}},patterns:{init:null},renames:{init:null}},args:(f,g)=>f.keys(g),validate(f,{schema:g,error:L,state:T,prefs:X}){if(!f||typeof f!==g.$_property("typeof")||Array.isArray(f))return{value:f,errors:L("object.base",{type:g.$_property("typeof")})};if(!(g.$_terms.renames||g.$_terms.dependencies||g.$_terms.keys||g.$_terms.patterns||g.$_terms.externals))return;f=l.clone(f,X);const C=[];if(g.$_terms.renames&&!l.rename(g,f,T,X,C))return{value:f,errors:C};if(!g.$_terms.keys&&!g.$_terms.patterns&&!g.$_terms.dependencies)return{value:f,errors:C};const m=new Set(Object.keys(f));if(g.$_terms.keys){const w=[f,...T.ancestors];for(const E of g.$_terms.keys){const U=E.key,z0=f[U];m.delete(U);const a0=T.localize([...T.path,U],w,E),V=E.schema.$_validate(z0,a0,X);if(V.errors){if(X.abortEarly)return{value:f,errors:V.errors};V.value!==void 0&&(f[U]=V.value),C.push(...V.errors)}else E.schema._flags.result==="strip"||V.value===void 0&&z0!==void 0?delete f[U]:V.value!==void 0&&(f[U]=V.value)}}if(m.size||g._flags._hasPatternMatch){const w=l.unknown(g,f,m,C,T,X);if(w)return w}if(g.$_terms.dependencies)for(const w of g.$_terms.dependencies){if(w.key!==null&&l.isPresent(w.options)(w.key.resolve(f,T,X,null,{shadow:!1}))===!1)continue;const E=l.dependencies[w.rel](g,w,f,T,X);if(E){const U=g.$_createError(E.code,f,E.context,T,X);if(X.abortEarly)return{value:f,errors:U};C.push(U)}}return{value:f,errors:C}},rules:{and:{method(...f){return u.verifyFlat(f,"and"),l.dependency(this,"and",null,f)}},append:{method(f){return f==null||Object.keys(f).length===0?this:this.keys(f)}},assert:{method(f,g,L){q.isTemplate(f)||(f=d.ref(f)),y(L===void 0||typeof L=="string","Message must be a string"),g=this.$_compile(g,{appendPath:!0});const T=this.$_addRule({name:"assert",args:{subject:f,schema:g,message:L}});return T.$_mutateRegister(f),T.$_mutateRegister(g),T},validate(f,{error:g,prefs:L,state:T},{subject:X,schema:C,message:m}){const w=X.resolve(f,T,L),E=M.isRef(X)?X.absolute(T):[];return C.$_match(w,T.localize(E,[f,...T.ancestors],C),L)?f:g("object.assert",{subject:X,message:m})},args:["subject","schema","message"],multi:!0},instance:{method(f,g){return y(typeof f=="function","constructor must be a function"),g=g||f.name,this.$_addRule({name:"instance",args:{constructor:f,name:g}})},validate:(f,g,{constructor:L,name:T})=>f instanceof L?f:g.error("object.instance",{type:T,value:f}),args:["constructor","name"]},keys:{method(f){y(f===void 0||typeof f=="object","Object schema must be a valid object"),y(!u.isSchema(f),"Object schema cannot be a joi schema");const g=this.clone();if(f)if(Object.keys(f).length){g.$_terms.keys=g.$_terms.keys?g.$_terms.keys.filter(L=>!f.hasOwnProperty(L.key)):new l.Keys;for(const L in f)u.tryWithPath(()=>g.$_terms.keys.push({key:L,schema:this.$_compile(f[L])}),L)}else g.$_terms.keys=new l.Keys;else g.$_terms.keys=null;return g.$_mutateRebuild()}},length:{method(f){return this.$_addRule({name:"length",args:{limit:f},operator:"="})},validate:(f,g,{limit:L},{name:T,operator:X,args:C})=>u.compare(Object.keys(f).length,L,X)?f:g.error("object."+T,{limit:C.limit,value:f}),args:[{name:"limit",ref:!0,assert:u.limit,message:"must be a positive integer"}]},max:{method(f){return this.$_addRule({name:"max",method:"length",args:{limit:f},operator:"<="})}},min:{method(f){return this.$_addRule({name:"min",method:"length",args:{limit:f},operator:">="})}},nand:{method(...f){return u.verifyFlat(f,"nand"),l.dependency(this,"nand",null,f)}},or:{method(...f){return u.verifyFlat(f,"or"),l.dependency(this,"or",null,f)}},oxor:{method(...f){return l.dependency(this,"oxor",null,f)}},pattern:{method(f,g,L={}){const T=f instanceof RegExp;T||(f=this.$_compile(f,{appendPath:!0})),y(g!==void 0,"Invalid rule"),u.assertOptions(L,["fallthrough","matches"]),T&&y(!f.flags.includes("g")&&!f.flags.includes("y"),"pattern should not use global or sticky mode"),g=this.$_compile(g,{appendPath:!0});const X=this.clone();X.$_terms.patterns=X.$_terms.patterns||[];const C={[T?"regex":"schema"]:f,rule:g};return L.matches&&(C.matches=this.$_compile(L.matches),C.matches.type!=="array"&&(C.matches=C.matches.$_root.array().items(C.matches)),X.$_mutateRegister(C.matches),X.$_setFlag("_hasPatternMatch",!0,{clone:!1})),L.fallthrough&&(C.fallthrough=!0),X.$_terms.patterns.push(C),X.$_mutateRegister(g),X}},ref:{method(){return this.$_addRule("ref")},validate:(f,g)=>M.isRef(f)?f:g.error("object.refType",{value:f})},regex:{method(){return this.$_addRule("regex")},validate:(f,g)=>f instanceof RegExp?f:g.error("object.regex",{value:f})},rename:{method(f,g,L={}){y(typeof f=="string"||f instanceof RegExp,"Rename missing the from argument"),y(typeof g=="string"||g instanceof q,"Invalid rename to argument"),y(g!==f,"Cannot rename key to same name:",f),u.assertOptions(L,["alias","ignoreUndefined","override","multiple"]);const T=this.clone();T.$_terms.renames=T.$_terms.renames||[];for(const X of T.$_terms.renames)y(X.from!==f,"Cannot rename the same key multiple times");return g instanceof q&&T.$_mutateRegister(g),T.$_terms.renames.push({from:f,to:g,options:c(l.renameDefaults,L)}),T}},schema:{method(f="any"){return this.$_addRule({name:"schema",args:{type:f}})},validate:(f,g,{type:L})=>!u.isSchema(f)||L!=="any"&&f.type!==L?g.error("object.schema",{type:L}):f},unknown:{method(f){return this.$_setFlag("unknown",f!==!1)}},with:{method(f,g,L={}){return l.dependency(this,"with",f,g,L)}},without:{method(f,g,L={}){return l.dependency(this,"without",f,g,L)}},xor:{method(...f){return u.verifyFlat(f,"xor"),l.dependency(this,"xor",null,f)}}},overrides:{default(f,g){return f===void 0&&(f=u.symbols.deepDefault),this.$_parent("default",f,g)}},rebuild(f){if(f.$_terms.keys){const g=new N.Sorter;for(const L of f.$_terms.keys)u.tryWithPath(()=>g.add(L,{after:L.schema.$_rootReferences(),group:L.key}),L.key);f.$_terms.keys=new l.Keys(...g.nodes)}},manifest:{build(f,g){if(g.keys&&(f=f.keys(g.keys)),g.dependencies)for(const{rel:L,key:T=null,peers:X,options:C}of g.dependencies)f=l.dependency(f,L,T,X,C);if(g.patterns)for(const{regex:L,schema:T,rule:X,fallthrough:C,matches:m}of g.patterns)f=f.pattern(L||T,X,{fallthrough:C,matches:m});if(g.renames)for(const{from:L,to:T,options:X}of g.renames)f=f.rename(L,T,X);return f}},messages:{"object.and":"{{#label}} contains {{#presentWithLabels}} without its required peers {{#missingWithLabels}}","object.assert":'{{#label}} is invalid because {if(#subject.key, `"` + #subject.key + `" failed to ` + (#message || "pass the assertion test"), #message || "the assertion failed")}',"object.base":"{{#label}} must be of type {{#type}}","object.instance":"{{#label}} must be an instance of {{:#type}}","object.length":'{{#label}} must have {{#limit}} key{if(#limit == 1, "", "s")}',"object.max":'{{#label}} must have less than or equal to {{#limit}} key{if(#limit == 1, "", "s")}',"object.min":'{{#label}} must have at least {{#limit}} key{if(#limit == 1, "", "s")}',"object.missing":"{{#label}} must contain at least one of {{#peersWithLabels}}","object.nand":"{{:#mainWithLabel}} must not exist simultaneously with {{#peersWithLabels}}","object.oxor":"{{#label}} contains a conflict between optional exclusive peers {{#peersWithLabels}}","object.pattern.match":"{{#label}} keys failed to match pattern requirements","object.refType":"{{#label}} must be a Joi reference","object.regex":"{{#label}} must be a RegExp object","object.rename.multiple":"{{#label}} cannot rename {{:#from}} because multiple renames are disabled and another key was already renamed to {{:#to}}","object.rename.override":"{{#label}} cannot rename {{:#from}} because override is disabled and target {{:#to}} exists","object.schema":"{{#label}} must be a Joi schema of {{#type}} type","object.unknown":"{{#label}} is not allowed","object.with":"{{:#mainWithLabel}} missing required peer {{:#peerWithLabel}}","object.without":"{{:#mainWithLabel}} conflict with forbidden peer {{:#peerWithLabel}}","object.xor":"{{#label}} contains a conflict between exclusive peers {{#peersWithLabels}}"}}),l.clone=function(f,g){if(typeof f=="object"){if(g.nonEnumerables)return v(f,{shallow:!0});const T=Object.create(Object.getPrototypeOf(f));return Object.assign(T,f),T}const L=function(...T){return f.apply(this,T)};return L.prototype=v(f.prototype),Object.defineProperty(L,"name",{value:f.name,writable:!1}),Object.defineProperty(L,"length",{value:f.length,writable:!1}),Object.assign(L,f),L},l.dependency=function(f,g,L,T,X){y(L===null||typeof L=="string",g,"key must be a strings"),X||(X=T.length>1&&typeof T[T.length-1]=="object"?T.pop():{}),u.assertOptions(X,["separator","isPresent"]),T=[].concat(T);const C=u.default(X.separator,"."),m=[];for(const E of T)y(typeof E=="string",g,"peers must be strings"),m.push(d.ref(E,{separator:C,ancestor:0,prefix:!1}));L!==null&&(L=d.ref(L,{separator:C,ancestor:0,prefix:!1}));const w=f.clone();return w.$_terms.dependencies=w.$_terms.dependencies||[],w.$_terms.dependencies.push(new l.Dependency(g,L,m,T,X)),w},l.dependencies={and(f,g,L,T,X){const C=[],m=[],w=g.peers.length,E=l.isPresent(g.options);for(const U of g.peers)E(U.resolve(L,T,X,null,{shadow:!1}))===!1?C.push(U.key):m.push(U.key);if(C.length!==w&&m.length!==w)return{code:"object.and",context:{present:m,presentWithLabels:l.keysToLabels(f,m),missing:C,missingWithLabels:l.keysToLabels(f,C)}}},nand(f,g,L,T,X){const C=[],m=l.isPresent(g.options);for(const U of g.peers)m(U.resolve(L,T,X,null,{shadow:!1}))&&C.push(U.key);if(C.length!==g.peers.length)return;const w=g.paths[0],E=g.paths.slice(1);return{code:"object.nand",context:{main:w,mainWithLabel:l.keysToLabels(f,w),peers:E,peersWithLabels:l.keysToLabels(f,E)}}},or(f,g,L,T,X){const C=l.isPresent(g.options);for(const m of g.peers)if(C(m.resolve(L,T,X,null,{shadow:!1})))return;return{code:"object.missing",context:{peers:g.paths,peersWithLabels:l.keysToLabels(f,g.paths)}}},oxor(f,g,L,T,X){const C=[],m=l.isPresent(g.options);for(const E of g.peers)m(E.resolve(L,T,X,null,{shadow:!1}))&&C.push(E.key);if(!C.length||C.length===1)return;const w={peers:g.paths,peersWithLabels:l.keysToLabels(f,g.paths)};return w.present=C,w.presentWithLabels=l.keysToLabels(f,C),{code:"object.oxor",context:w}},with(f,g,L,T,X){const C=l.isPresent(g.options);for(const m of g.peers)if(C(m.resolve(L,T,X,null,{shadow:!1}))===!1)return{code:"object.with",context:{main:g.key.key,mainWithLabel:l.keysToLabels(f,g.key.key),peer:m.key,peerWithLabel:l.keysToLabels(f,m.key)}}},without(f,g,L,T,X){const C=l.isPresent(g.options);for(const m of g.peers)if(C(m.resolve(L,T,X,null,{shadow:!1})))return{code:"object.without",context:{main:g.key.key,mainWithLabel:l.keysToLabels(f,g.key.key),peer:m.key,peerWithLabel:l.keysToLabels(f,m.key)}}},xor(f,g,L,T,X){const C=[],m=l.isPresent(g.options);for(const E of g.peers)m(E.resolve(L,T,X,null,{shadow:!1}))&&C.push(E.key);if(C.length===1)return;const w={peers:g.paths,peersWithLabels:l.keysToLabels(f,g.paths)};return C.length===0?{code:"object.missing",context:w}:(w.present=C,w.presentWithLabels=l.keysToLabels(f,C),{code:"object.xor",context:w})}},l.keysToLabels=function(f,g){return Array.isArray(g)?g.map(L=>f.$_mapLabels(L)):f.$_mapLabels(g)},l.isPresent=function(f){return typeof f.isPresent=="function"?f.isPresent:g=>g!==void 0},l.rename=function(f,g,L,T,X){const C={};for(const m of f.$_terms.renames){const w=[],E=typeof m.from!="string";if(E)for(const U in g){if(g[U]===void 0&&m.options.ignoreUndefined||U===m.to)continue;const z0=m.from.exec(U);z0&&w.push({from:U,to:m.to,match:z0})}else!Object.prototype.hasOwnProperty.call(g,m.from)||g[m.from]===void 0&&m.options.ignoreUndefined||w.push(m);for(const U of w){const z0=U.from;let a0=U.to;if(a0 instanceof q&&(a0=a0.render(g,L,T,U.match)),z0!==a0){if(!m.options.multiple&&C[a0]&&(X.push(f.$_createError("object.rename.multiple",g,{from:z0,to:a0,pattern:E},L,T)),T.abortEarly)||Object.prototype.hasOwnProperty.call(g,a0)&&!m.options.override&&!C[a0]&&(X.push(f.$_createError("object.rename.override",g,{from:z0,to:a0,pattern:E},L,T)),T.abortEarly))return!1;g[z0]===void 0?delete g[a0]:g[a0]=g[z0],C[a0]=!0,m.options.alias||delete g[z0]}}}return!0},l.unknown=function(f,g,L,T,X,C){if(f.$_terms.patterns){let m=!1;const w=f.$_terms.patterns.map(U=>{if(U.matches)return m=!0,[]}),E=[g,...X.ancestors];for(const U of L){const z0=g[U],a0=[...X.path,U];for(let V=0;V<f.$_terms.patterns.length;++V){const Z=f.$_terms.patterns[V];if(Z.regex){const X0=Z.regex.test(U);if(X.mainstay.tracer.debug(X,"rule",`pattern.${V}`,X0?"pass":"error"),!X0)continue}else if(!Z.schema.$_match(U,X.nest(Z.schema,`pattern.${V}`),C))continue;L.delete(U);const u0=X.localize(a0,E,{schema:Z.rule,key:U}),L0=Z.rule.$_validate(z0,u0,C);if(L0.errors){if(C.abortEarly)return{value:g,errors:L0.errors};T.push(...L0.errors)}if(Z.matches&&w[V].push(U),g[U]=L0.value,!Z.fallthrough)break}}if(m)for(let U=0;U<w.length;++U){const z0=w[U];if(!z0)continue;const a0=f.$_terms.patterns[U].matches,V=X.localize(X.path,E,a0),Z=a0.$_validate(z0,V,C);if(Z.errors){const u0=z.details(Z.errors,{override:!1});u0.matches=z0;const L0=f.$_createError("object.pattern.match",g,u0,X,C);if(C.abortEarly)return{value:g,errors:L0};T.push(L0)}}}if(L.size&&(f.$_terms.keys||f.$_terms.patterns)){if(C.stripUnknown&&!f._flags.unknown||C.skipFunctions){const m=!(!C.stripUnknown||C.stripUnknown!==!0&&!C.stripUnknown.objects);for(const w of L)m?(delete g[w],L.delete(w)):typeof g[w]=="function"&&L.delete(w)}if(!u.default(f._flags.unknown,C.allowUnknown))for(const m of L){const w=X.localize([...X.path,m],[]),E=f.$_createError("object.unknown",g[m],{child:m},w,C,{flags:!1});if(C.abortEarly)return{value:g,errors:E};T.push(E)}}},l.Dependency=class{constructor(f,g,L,T,X){this.rel=f,this.key=g,this.peers=L,this.paths=T,this.options=X}describe(){const f={rel:this.rel,peers:this.paths};return this.key!==null&&(f.key=this.key.key),this.peers[0].separator!=="."&&(f.options={...f.options,separator:this.peers[0].separator}),this.options.isPresent&&(f.options={...f.options,isPresent:this.options.isPresent}),f}},l.Keys=class extends Array{concat(f){const g=this.slice(),L=new Map;for(let T=0;T<g.length;++T)L.set(g[T].key,T);for(const T of f){const X=T.key,C=L.get(X);C!==void 0?g[C]={key:X,schema:g[C].schema.concat(T.schema)}:g.push(T)}return g}}},8785:(a,O,A)=>{const{assert:c}=A(8870),y=A(8068),v=A(8160),N=A(3292),s=A(6354),u={};a.exports=y.extend({type:"link",properties:{schemaChain:!0},terms:{link:{init:null,manifest:"single",register:!1}},args:(d,z)=>d.ref(z),validate(d,{schema:z,state:M,prefs:q}){c(z.$_terms.link,"Uninitialized link schema");const l=u.generate(z,d,M,q),f=z.$_terms.link[0].ref;return l.$_validate(d,M.nest(l,`link:${f.display}:${l.type}`),q)},generate:(d,z,M,q)=>u.generate(d,z,M,q),rules:{ref:{method(d){c(!this.$_terms.link,"Cannot reinitialize schema"),d=N.ref(d),c(d.type==="value"||d.type==="local","Invalid reference type:",d.type),c(d.type==="local"||d.ancestor==="root"||d.ancestor>0,"Link cannot reference itself");const z=this.clone();return z.$_terms.link=[{ref:d}],z}},relative:{method(d=!0){return this.$_setFlag("relative",d)}}},overrides:{concat(d){c(this.$_terms.link,"Uninitialized link schema"),c(v.isSchema(d),"Invalid schema object"),c(d.type!=="link","Cannot merge type link with another link");const z=this.clone();return z.$_terms.whens||(z.$_terms.whens=[]),z.$_terms.whens.push({concat:d}),z.$_mutateRebuild()}},manifest:{build:(d,z)=>(c(z.link,"Invalid link description missing link"),d.ref(z.link))}}),u.generate=function(d,z,M,q){let l=M.mainstay.links.get(d);if(l)return l._generate(z,M,q).schema;const f=d.$_terms.link[0].ref,{perspective:g,path:L}=u.perspective(f,M);u.assert(g,"which is outside of schema boundaries",f,d,M,q);try{l=L.length?g.$_reach(L):g}catch{u.assert(!1,"to non-existing schema",f,d,M,q)}return u.assert(l.type!=="link","which is another link",f,d,M,q),d._flags.relative||M.mainstay.links.set(d,l),l._generate(z,M,q).schema},u.perspective=function(d,z){if(d.type==="local"){for(const{schema:M,key:q}of z.schemas){if((M._flags.id||q)===d.path[0])return{perspective:M,path:d.path.slice(1)};if(M.$_terms.shared){for(const l of M.$_terms.shared)if(l._flags.id===d.path[0])return{perspective:l,path:d.path.slice(1)}}}return{perspective:null,path:null}}return d.ancestor==="root"?{perspective:z.schemas[z.schemas.length-1].schema,path:d.path}:{perspective:z.schemas[d.ancestor]&&z.schemas[d.ancestor].schema,path:d.path}},u.assert=function(d,z,M,q,l,f){d||c(!1,`"${s.label(q._flags,l,f)}" contains link reference "${M.display}" ${z}`)}},3832:(a,O,A)=>{const{assert:c}=A(8870),y=A(8068),v=A(8160),N={numberRx:/^\s*[+-]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e([+-]?\d+))?\s*$/i,precisionRx:/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/,exponentialPartRegex:/[eE][+-]?\d+$/,leadingSignAndZerosRegex:/^[+-]?(0*)?/,dotRegex:/\./,trailingZerosRegex:/0+$/};a.exports=y.extend({type:"number",flags:{unsafe:{default:!1}},coerce:{from:"string",method(s,{schema:u,error:d}){if(!s.match(N.numberRx))return;s=s.trim();const z={value:parseFloat(s)};if(z.value===0&&(z.value=0),!u._flags.unsafe)if(s.match(/e/i)){if(N.extractSignificantDigits(s)!==N.extractSignificantDigits(String(z.value)))return z.errors=d("number.unsafe"),z}else{const M=z.value.toString();if(M.match(/e/i))return z;if(M!==N.normalizeDecimal(s))return z.errors=d("number.unsafe"),z}return z}},validate(s,{schema:u,error:d,prefs:z}){if(s===1/0||s===-1/0)return{value:s,errors:d("number.infinity")};if(!v.isNumber(s))return{value:s,errors:d("number.base")};const M={value:s};if(z.convert){const q=u.$_getRule("precision");if(q){const l=Math.pow(10,q.args.limit);M.value=Math.round(M.value*l)/l}}return M.value===0&&(M.value=0),!u._flags.unsafe&&(s>Number.MAX_SAFE_INTEGER||s<Number.MIN_SAFE_INTEGER)&&(M.errors=d("number.unsafe")),M},rules:{compare:{method:!1,validate:(s,u,{limit:d},{name:z,operator:M,args:q})=>v.compare(s,d,M)?s:u.error("number."+z,{limit:q.limit,value:s}),args:[{name:"limit",ref:!0,assert:v.isNumber,message:"must be a number"}]},greater:{method(s){return this.$_addRule({name:"greater",method:"compare",args:{limit:s},operator:">"})}},integer:{method(){return this.$_addRule("integer")},validate:(s,u)=>Math.trunc(s)-s==0?s:u.error("number.integer")},less:{method(s){return this.$_addRule({name:"less",method:"compare",args:{limit:s},operator:"<"})}},max:{method(s){return this.$_addRule({name:"max",method:"compare",args:{limit:s},operator:"<="})}},min:{method(s){return this.$_addRule({name:"min",method:"compare",args:{limit:s},operator:">="})}},multiple:{method(s){return this.$_addRule({name:"multiple",args:{base:s}})},validate:(s,u,{base:d},z)=>s*(1/d)%1==0?s:u.error("number.multiple",{multiple:z.args.base,value:s}),args:[{name:"base",ref:!0,assert:s=>typeof s=="number"&&isFinite(s)&&s>0,message:"must be a positive number"}],multi:!0},negative:{method(){return this.sign("negative")}},port:{method(){return this.$_addRule("port")},validate:(s,u)=>Number.isSafeInteger(s)&&s>=0&&s<=65535?s:u.error("number.port")},positive:{method(){return this.sign("positive")}},precision:{method(s){return c(Number.isSafeInteger(s),"limit must be an integer"),this.$_addRule({name:"precision",args:{limit:s}})},validate(s,u,{limit:d}){const z=s.toString().match(N.precisionRx);return Math.max((z[1]?z[1].length:0)-(z[2]?parseInt(z[2],10):0),0)<=d?s:u.error("number.precision",{limit:d,value:s})},convert:!0},sign:{method(s){return c(["negative","positive"].includes(s),"Invalid sign",s),this.$_addRule({name:"sign",args:{sign:s}})},validate:(s,u,{sign:d})=>d==="negative"&&s<0||d==="positive"&&s>0?s:u.error(`number.${d}`)},unsafe:{method(s=!0){return c(typeof s=="boolean","enabled must be a boolean"),this.$_setFlag("unsafe",s)}}},cast:{string:{from:s=>typeof s=="number",to:(s,u)=>s.toString()}},messages:{"number.base":"{{#label}} must be a number","number.greater":"{{#label}} must be greater than {{#limit}}","number.infinity":"{{#label}} cannot be infinity","number.integer":"{{#label}} must be an integer","number.less":"{{#label}} must be less than {{#limit}}","number.max":"{{#label}} must be less than or equal to {{#limit}}","number.min":"{{#label}} must be greater than or equal to {{#limit}}","number.multiple":"{{#label}} must be a multiple of {{#multiple}}","number.negative":"{{#label}} must be a negative number","number.port":"{{#label}} must be a valid port","number.positive":"{{#label}} must be a positive number","number.precision":"{{#label}} must have no more than {{#limit}} decimal places","number.unsafe":"{{#label}} must be a safe number"}}),N.extractSignificantDigits=function(s){return s.replace(N.exponentialPartRegex,"").replace(N.dotRegex,"").replace(N.trailingZerosRegex,"").replace(N.leadingSignAndZerosRegex,"")},N.normalizeDecimal=function(s){return(s=s.replace(/^\+/,"").replace(/\.0*$/,"").replace(/^(-?)\.([^\.]*)$/,"$10.$2").replace(/^(-?)0+([0-9])/,"$1$2")).includes(".")&&s.endsWith("0")&&(s=s.replace(/0+$/,"")),s==="-0"?"0":s}},8966:(a,O,A)=>{const c=A(7824);a.exports=c.extend({type:"object",cast:{map:{from:y=>y&&typeof y=="object",to:(y,v)=>new Map(Object.entries(y))}}})},7417:(a,O,A)=>{const{assert:c,escapeRegex:y}=A(8870),{isDomainValid:v,isEmailValid:N,ipRegex:s,uriRegex:u}=A(4958),d=A(6264),z=A(8068),M=A(8160),q={tlds:d.tlds instanceof Set&&{tlds:{allow:d.tlds,deny:null}},base64Regex:{true:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}==|[\w\-]{3}=)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/},false:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}(==)?|[\w\-]{3}=?)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}(==)?|[A-Za-z0-9+\/]{3}=?)?$/}},dataUriRegex:/^data:[\w+.-]+\/[\w+.-]+;((charset=[\w-]+|base64),)?(.*)$/,hexRegex:/^[a-f0-9]+$/i,ipRegex:s({cidr:"forbidden"}).regex,isoDurationRegex:/^P(?!$)(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?$/,guidBrackets:{"{":"}","[":"]","(":")","":""},guidVersions:{uuidv1:"1",uuidv2:"2",uuidv3:"3",uuidv4:"4",uuidv5:"5",uuidv6:"6",uuidv7:"7",uuidv8:"8"},guidSeparators:new Set([void 0,!0,!1,"-",":"]),normalizationForms:["NFC","NFD","NFKC","NFKD"]};a.exports=z.extend({type:"string",flags:{insensitive:{default:!1},truncate:{default:!1}},terms:{replacements:{init:null}},coerce:{from:"string",method(l,{schema:f,state:g,prefs:L}){const T=f.$_getRule("normalize");T&&(l=l.normalize(T.args.form));const X=f.$_getRule("case");X&&(l=X.args.direction==="upper"?l.toLocaleUpperCase():l.toLocaleLowerCase());const C=f.$_getRule("trim");if(C&&C.args.enabled&&(l=l.trim()),f.$_terms.replacements)for(const w of f.$_terms.replacements)l=l.replace(w.pattern,w.replacement);const m=f.$_getRule("hex");if(m&&m.args.options.byteAligned&&l.length%2!=0&&(l=`0${l}`),f.$_getRule("isoDate")){const w=q.isoDate(l);w&&(l=w)}if(f._flags.truncate){const w=f.$_getRule("max");if(w){let E=w.args.limit;if(M.isResolvable(E)&&(E=E.resolve(l,g,L),!M.limit(E)))return{value:l,errors:f.$_createError("any.ref",E,{ref:w.args.limit,arg:"limit",reason:"must be a positive integer"},g,L)};l=l.slice(0,E)}}return{value:l}}},validate(l,{schema:f,error:g}){if(typeof l!="string")return{value:l,errors:g("string.base")};if(l===""){const L=f.$_getRule("min");return L&&L.args.limit===0?void 0:{value:l,errors:g("string.empty")}}},rules:{alphanum:{method(){return this.$_addRule("alphanum")},validate:(l,f)=>/^[a-zA-Z0-9]+$/.test(l)?l:f.error("string.alphanum")},base64:{method(l={}){return M.assertOptions(l,["paddingRequired","urlSafe"]),l={urlSafe:!1,paddingRequired:!0,...l},c(typeof l.paddingRequired=="boolean","paddingRequired must be boolean"),c(typeof l.urlSafe=="boolean","urlSafe must be boolean"),this.$_addRule({name:"base64",args:{options:l}})},validate:(l,f,{options:g})=>q.base64Regex[g.paddingRequired][g.urlSafe].test(l)?l:f.error("string.base64")},case:{method(l){return c(["lower","upper"].includes(l),"Invalid case:",l),this.$_addRule({name:"case",args:{direction:l}})},validate:(l,f,{direction:g})=>g==="lower"&&l===l.toLocaleLowerCase()||g==="upper"&&l===l.toLocaleUpperCase()?l:f.error(`string.${g}case`),convert:!0},creditCard:{method(){return this.$_addRule("creditCard")},validate(l,f){let g=l.length,L=0,T=1;for(;g--;){const X=l.charAt(g)*T;L+=X-9*(X>9),T^=3}return L>0&&L%10==0?l:f.error("string.creditCard")}},dataUri:{method(l={}){return M.assertOptions(l,["paddingRequired"]),l={paddingRequired:!0,...l},c(typeof l.paddingRequired=="boolean","paddingRequired must be boolean"),this.$_addRule({name:"dataUri",args:{options:l}})},validate(l,f,{options:g}){const L=l.match(q.dataUriRegex);return L&&(!L[2]||L[2]!=="base64"||q.base64Regex[g.paddingRequired].false.test(L[3]))?l:f.error("string.dataUri")}},domain:{method(l){l&&M.assertOptions(l,["allowFullyQualified","allowUnicode","allowUnderscore","maxDomainSegments","minDomainSegments","tlds"]);const f=q.addressOptions(l);return this.$_addRule({name:"domain",args:{options:l},address:f})},validate:(l,f,g,{address:L})=>v(l,L)?l:f.error("string.domain")},email:{method(l={}){M.assertOptions(l,["allowFullyQualified","allowUnicode","ignoreLength","maxDomainSegments","minDomainSegments","multiple","separator","tlds"]),c(l.multiple===void 0||typeof l.multiple=="boolean","multiple option must be an boolean");const f=q.addressOptions(l),g=new RegExp(`\\s*[${l.separator?y(l.separator):","}]\\s*`);return this.$_addRule({name:"email",args:{options:l},regex:g,address:f})},validate(l,f,{options:g},{regex:L,address:T}){const X=g.multiple?l.split(L):[l],C=[];for(const m of X)N(m,T)||C.push(m);return C.length?f.error("string.email",{value:l,invalids:C}):l}},guid:{alias:"uuid",method(l={}){M.assertOptions(l,["version","separator"]);let f="";if(l.version){const T=[].concat(l.version);c(T.length>=1,"version must have at least 1 valid version specified");const X=new Set;for(let C=0;C<T.length;++C){const m=T[C];c(typeof m=="string","version at position "+C+" must be a string");const w=q.guidVersions[m.toLowerCase()];c(w,"version at position "+C+" must be one of "+Object.keys(q.guidVersions).join(", ")),c(!X.has(w),"version at position "+C+" must not be a duplicate"),f+=w,X.add(w)}}c(q.guidSeparators.has(l.separator),'separator must be one of true, false, "-", or ":"');const g=l.separator===void 0?"[:-]?":l.separator===!0?"[:-]":l.separator===!1?"[]?":`\\${l.separator}`,L=new RegExp(`^([\\[{\\(]?)[0-9A-F]{8}(${g})[0-9A-F]{4}\\2?[${f||"0-9A-F"}][0-9A-F]{3}\\2?[${f?"89AB":"0-9A-F"}][0-9A-F]{3}\\2?[0-9A-F]{12}([\\]}\\)]?)$`,"i");return this.$_addRule({name:"guid",args:{options:l},regex:L})},validate(l,f,g,{regex:L}){const T=L.exec(l);return T?q.guidBrackets[T[1]]!==T[T.length-1]?f.error("string.guid"):l:f.error("string.guid")}},hex:{method(l={}){return M.assertOptions(l,["byteAligned"]),l={byteAligned:!1,...l},c(typeof l.byteAligned=="boolean","byteAligned must be boolean"),this.$_addRule({name:"hex",args:{options:l}})},validate:(l,f,{options:g})=>q.hexRegex.test(l)?g.byteAligned&&l.length%2!=0?f.error("string.hexAlign"):l:f.error("string.hex")},hostname:{method(){return this.$_addRule("hostname")},validate:(l,f)=>v(l,{minDomainSegments:1})||q.ipRegex.test(l)?l:f.error("string.hostname")},insensitive:{method(){return this.$_setFlag("insensitive",!0)}},ip:{method(l={}){M.assertOptions(l,["cidr","version"]);const{cidr:f,versions:g,regex:L}=s(l),T=l.version?g:void 0;return this.$_addRule({name:"ip",args:{options:{cidr:f,version:T}},regex:L})},validate:(l,f,{options:g},{regex:L})=>L.test(l)?l:g.version?f.error("string.ipVersion",{value:l,cidr:g.cidr,version:g.version}):f.error("string.ip",{value:l,cidr:g.cidr})},isoDate:{method(){return this.$_addRule("isoDate")},validate:(l,{error:f})=>q.isoDate(l)?l:f("string.isoDate")},isoDuration:{method(){return this.$_addRule("isoDuration")},validate:(l,f)=>q.isoDurationRegex.test(l)?l:f.error("string.isoDuration")},length:{method(l,f){return q.length(this,"length",l,"=",f)},validate(l,f,{limit:g,encoding:L},{name:T,operator:X,args:C}){const m=!L&&l.length;return M.compare(m,g,X)?l:f.error("string."+T,{limit:C.limit,value:l,encoding:L})},args:[{name:"limit",ref:!0,assert:M.limit,message:"must be a positive integer"},"encoding"]},lowercase:{method(){return this.case("lower")}},max:{method(l,f){return q.length(this,"max",l,"<=",f)},args:["limit","encoding"]},min:{method(l,f){return q.length(this,"min",l,">=",f)},args:["limit","encoding"]},normalize:{method(l="NFC"){return c(q.normalizationForms.includes(l),"normalization form must be one of "+q.normalizationForms.join(", ")),this.$_addRule({name:"normalize",args:{form:l}})},validate:(l,{error:f},{form:g})=>l===l.normalize(g)?l:f("string.normalize",{value:l,form:g}),convert:!0},pattern:{alias:"regex",method(l,f={}){c(l instanceof RegExp,"regex must be a RegExp"),c(!l.flags.includes("g")&&!l.flags.includes("y"),"regex should not use global or sticky mode"),typeof f=="string"&&(f={name:f}),M.assertOptions(f,["invert","name"]);const g=["string.pattern",f.invert?".invert":"",f.name?".name":".base"].join("");return this.$_addRule({name:"pattern",args:{regex:l,options:f},errorCode:g})},validate:(l,f,{regex:g,options:L},{errorCode:T})=>g.test(l)^L.invert?l:f.error(T,{name:L.name,regex:g,value:l}),args:["regex","options"],multi:!0},replace:{method(l,f){typeof l=="string"&&(l=new RegExp(y(l),"g")),c(l instanceof RegExp,"pattern must be a RegExp"),c(typeof f=="string","replacement must be a String");const g=this.clone();return g.$_terms.replacements||(g.$_terms.replacements=[]),g.$_terms.replacements.push({pattern:l,replacement:f}),g}},token:{method(){return this.$_addRule("token")},validate:(l,f)=>/^\w+$/.test(l)?l:f.error("string.token")},trim:{method(l=!0){return c(typeof l=="boolean","enabled must be a boolean"),this.$_addRule({name:"trim",args:{enabled:l}})},validate:(l,f,{enabled:g})=>g&&l!==l.trim()?f.error("string.trim"):l,convert:!0},truncate:{method(l=!0){return c(typeof l=="boolean","enabled must be a boolean"),this.$_setFlag("truncate",l)}},uppercase:{method(){return this.case("upper")}},uri:{method(l={}){M.assertOptions(l,["allowRelative","allowQuerySquareBrackets","domain","relativeOnly","scheme"]),l.domain&&M.assertOptions(l.domain,["allowFullyQualified","allowUnicode","maxDomainSegments","minDomainSegments","tlds"]);const{regex:f,scheme:g}=u(l),L=l.domain?q.addressOptions(l.domain):null;return this.$_addRule({name:"uri",args:{options:l},regex:f,domain:L,scheme:g})},validate(l,f,{options:g},{regex:L,domain:T,scheme:X}){if(["http:/","https:/"].includes(l))return f.error("string.uri");const C=L.exec(l);if(C){const m=C[1]||C[2];return!T||g.allowRelative&&!m||v(m,T)?l:f.error("string.domain",{value:m})}return g.relativeOnly?f.error("string.uriRelativeOnly"):g.scheme?f.error("string.uriCustomScheme",{scheme:X,value:l}):f.error("string.uri")}}},manifest:{build(l,f){if(f.replacements)for(const{pattern:g,replacement:L}of f.replacements)l=l.replace(g,L);return l}},messages:{"string.alphanum":"{{#label}} must only contain alpha-numeric characters","string.base":"{{#label}} must be a string","string.base64":"{{#label}} must be a valid base64 string","string.creditCard":"{{#label}} must be a credit card","string.dataUri":"{{#label}} must be a valid dataUri string","string.domain":"{{#label}} must contain a valid domain name","string.email":"{{#label}} must be a valid email","string.empty":"{{#label}} is not allowed to be empty","string.guid":"{{#label}} must be a valid GUID","string.hex":"{{#label}} must only contain hexadecimal characters","string.hexAlign":"{{#label}} hex decoded representation must be byte aligned","string.hostname":"{{#label}} must be a valid hostname","string.ip":"{{#label}} must be a valid ip address with a {{#cidr}} CIDR","string.ipVersion":"{{#label}} must be a valid ip address of one of the following versions {{#version}} with a {{#cidr}} CIDR","string.isoDate":"{{#label}} must be in iso format","string.isoDuration":"{{#label}} must be a valid ISO 8601 duration","string.length":"{{#label}} length must be {{#limit}} characters long","string.lowercase":"{{#label}} must only contain lowercase characters","string.max":"{{#label}} length must be less than or equal to {{#limit}} characters long","string.min":"{{#label}} length must be at least {{#limit}} characters long","string.normalize":"{{#label}} must be unicode normalized in the {{#form}} form","string.token":"{{#label}} must only contain alpha-numeric and underscore characters","string.pattern.base":"{{#label}} with value {:[.]} fails to match the required pattern: {{#regex}}","string.pattern.name":"{{#label}} with value {:[.]} fails to match the {{#name}} pattern","string.pattern.invert.base":"{{#label}} with value {:[.]} matches the inverted pattern: {{#regex}}","string.pattern.invert.name":"{{#label}} with value {:[.]} matches the inverted {{#name}} pattern","string.trim":"{{#label}} must not have leading or trailing whitespace","string.uri":"{{#label}} must be a valid uri","string.uriCustomScheme":"{{#label}} must be a valid uri with a scheme matching the {{#scheme}} pattern","string.uriRelativeOnly":"{{#label}} must be a valid relative uri","string.uppercase":"{{#label}} must only contain uppercase characters"}}),q.addressOptions=function(l){if(!l||(c(l.minDomainSegments===void 0||Number.isSafeInteger(l.minDomainSegments)&&l.minDomainSegments>0,"minDomainSegments must be a positive integer"),c(l.maxDomainSegments===void 0||Number.isSafeInteger(l.maxDomainSegments)&&l.maxDomainSegments>0,"maxDomainSegments must be a positive integer"),l.tlds===!1))return l;if(l.tlds===!0||l.tlds===void 0)return c(q.tlds,"Built-in TLD list disabled"),Object.assign({},l,q.tlds);c(typeof l.tlds=="object","tlds must be true, false, or an object");const f=l.tlds.deny;if(f)return Array.isArray(f)&&(l=Object.assign({},l,{tlds:{deny:new Set(f)}})),c(l.tlds.deny instanceof Set,"tlds.deny must be an array, Set, or boolean"),c(!l.tlds.allow,"Cannot specify both tlds.allow and tlds.deny lists"),q.validateTlds(l.tlds.deny,"tlds.deny"),l;const g=l.tlds.allow;return g?g===!0?(c(q.tlds,"Built-in TLD list disabled"),Object.assign({},l,q.tlds)):(Array.isArray(g)&&(l=Object.assign({},l,{tlds:{allow:new Set(g)}})),c(l.tlds.allow instanceof Set,"tlds.allow must be an array, Set, or boolean"),q.validateTlds(l.tlds.allow,"tlds.allow"),l):{...l,tlds:!1}},q.validateTlds=function(l,f){for(const g of l)c(v(g,{minDomainSegments:1,maxDomainSegments:1}),`${f} must contain valid top level domain names`)},q.isoDate=function(l){if(!M.isIsoDate(l))return null;/.*T.*[+-]\d\d$/.test(l)&&(l+="00");const f=new Date(l);return isNaN(f.getTime())?null:f.toISOString()},q.length=function(l,f,g,L,T){return c(!T||!1,"Invalid encoding:",T),l.$_addRule({name:f,method:"length",args:{limit:g,encoding:T},operator:L})}},8826:(a,O,A)=>{const{assert:c}=A(8870),y=A(8068),v={};v.Map=class extends Map{slice(){return new v.Map(this)}},a.exports=y.extend({type:"symbol",terms:{map:{init:new v.Map}},coerce:{method(N,{schema:s,error:u}){const d=s.$_terms.map.get(N);return d&&(N=d),s._flags.only&&typeof N!="symbol"?{value:N,errors:u("symbol.map",{map:s.$_terms.map})}:{value:N}}},validate(N,{error:s}){if(typeof N!="symbol")return{value:N,errors:s("symbol.base")}},rules:{map:{method(N){N&&!N[Symbol.iterator]&&typeof N=="object"&&(N=Object.entries(N)),c(N&&N[Symbol.iterator],"Iterable must be an iterable or object");const s=this.clone(),u=[];for(const d of N){c(d&&d[Symbol.iterator],"Entry must be an iterable");const[z,M]=d;c(typeof z!="object"&&typeof z!="function"&&typeof z!="symbol","Key must not be of type object, function, or Symbol"),c(typeof M=="symbol","Value must be a Symbol"),s.$_terms.map.set(z,M),u.push(M)}return s.valid(...u)}}},manifest:{build:(N,s)=>(s.map&&(N=N.map(s.map)),N)},messages:{"symbol.base":"{{#label}} must be a symbol","symbol.map":"{{#label}} must be one of {{#map}}"}})},8863:(a,O,A)=>{const{assert:c,clone:y,ignore:v,reach:N}=A(8870),s=A(8160),u=A(6354),d=A(493),z={result:Symbol("result")};O.entry=function(M,q,l){let f=s.defaults;l&&(c(l.warnings===void 0,"Cannot override warnings preference in synchronous validation"),c(l.artifacts===void 0,"Cannot override artifacts preference in synchronous validation"),f=s.preferences(s.defaults,l));const g=z.entry(M,q,f);c(!g.mainstay.externals.length,"Schema with external rules must use validateAsync()");const L={value:g.value};return g.error&&(L.error=g.error),g.mainstay.warnings.length&&(L.warning=u.details(g.mainstay.warnings)),g.mainstay.debug&&(L.debug=g.mainstay.debug),g.mainstay.artifacts&&(L.artifacts=g.mainstay.artifacts),L},O.entryAsync=async function(M,q,l){let f=s.defaults;l&&(f=s.preferences(s.defaults,l));const g=z.entry(M,q,f),L=g.mainstay;if(g.error)throw L.debug&&(g.error.debug=L.debug),g.error;if(L.externals.length){let X=g.value;const C=[];for(const m of L.externals){const w=m.state.path,E=m.schema.type==="link"?L.links.get(m.schema):null;let U,z0,a0=X;const V=w.length?[X]:[],Z=w.length?N(M,w):M;if(w.length){U=w[w.length-1];let u0=X;for(const L0 of w.slice(0,-1))u0=u0[L0],V.unshift(u0);z0=V[0],a0=z0[U]}try{const u0=(X0,B0)=>(E||m.schema).$_createError(X0,a0,B0,m.state,f),L0=await m.method(a0,{schema:m.schema,linked:E,state:m.state,prefs:l,original:Z,error:u0,errorsArray:z.errorsArray,warn:(X0,B0)=>L.warnings.push((E||m.schema).$_createError(X0,a0,B0,m.state,f)),message:(X0,B0)=>(E||m.schema).$_createError("external",a0,B0,m.state,f,{messages:X0})});if(L0===void 0||L0===a0)continue;if(L0 instanceof u.Report){if(L.tracer.log(m.schema,m.state,"rule","external","error"),C.push(L0),f.abortEarly)break;continue}if(Array.isArray(L0)&&L0[s.symbols.errors]){if(L.tracer.log(m.schema,m.state,"rule","external","error"),C.push(...L0),f.abortEarly)break;continue}z0?(L.tracer.value(m.state,"rule",a0,L0,"external"),z0[U]=L0):(L.tracer.value(m.state,"rule",X,L0,"external"),X=L0)}catch(u0){throw f.errors.label&&(u0.message+=` (${m.label})`),u0}}if(g.value=X,C.length)throw g.error=u.process(C,M,f),L.debug&&(g.error.debug=L.debug),g.error}if(!f.warnings&&!f.debug&&!f.artifacts)return g.value;const T={value:g.value};return L.warnings.length&&(T.warning=u.details(L.warnings)),L.debug&&(T.debug=L.debug),L.artifacts&&(T.artifacts=L.artifacts),T},z.Mainstay=class{constructor(M,q,l){this.externals=[],this.warnings=[],this.tracer=M,this.debug=q,this.links=l,this.shadow=null,this.artifacts=null,this._snapshots=[]}snapshot(){this._snapshots.push({externals:this.externals.slice(),warnings:this.warnings.slice()})}restore(){const M=this._snapshots.pop();this.externals=M.externals,this.warnings=M.warnings}commit(){this._snapshots.pop()}},z.entry=function(M,q,l){const{tracer:f,cleanup:g}=z.tracer(q,l),L=l.debug?[]:null,T=q._ids._schemaChain?new Map:null,X=new z.Mainstay(f,L,T),C=q._ids._schemaChain?[{schema:q}]:null,m=new d([],[],{mainstay:X,schemas:C}),w=O.validate(M,q,m,l);g&&q.$_root.untrace();const E=u.process(w.errors,M,l);return{value:w.value,error:E,mainstay:X}},z.tracer=function(M,q){return M.$_root._tracer?{tracer:M.$_root._tracer._register(M)}:q.debug?(c(M.$_root.trace,"Debug mode not supported"),{tracer:M.$_root.trace()._register(M),cleanup:!0}):{tracer:z.ignore}},O.validate=function(M,q,l,f,g={}){if(q.$_terms.whens&&(q=q._generate(M,l,f).schema),q._preferences&&(f=z.prefs(q,f)),q._cache&&f.cache){const E=q._cache.get(M);if(l.mainstay.tracer.debug(l,"validate","cached",!!E),E)return E}const L=(E,U,z0)=>q.$_createError(E,M,U,z0||l,f),T={original:M,prefs:f,schema:q,state:l,error:L,errorsArray:z.errorsArray,warn:(E,U,z0)=>l.mainstay.warnings.push(L(E,U,z0)),message:(E,U)=>q.$_createError("custom",M,U,l,f,{messages:E})};l.mainstay.tracer.entry(q,l);const X=q._definition;if(X.prepare&&M!==void 0&&f.convert){const E=X.prepare(M,T);if(E){if(l.mainstay.tracer.value(l,"prepare",M,E.value),E.errors)return z.finalize(E.value,[].concat(E.errors),T);M=E.value}}if(X.coerce&&M!==void 0&&f.convert&&(!X.coerce.from||X.coerce.from.includes(typeof M))){const E=X.coerce.method(M,T);if(E){if(l.mainstay.tracer.value(l,"coerced",M,E.value),E.errors)return z.finalize(E.value,[].concat(E.errors),T);M=E.value}}const C=q._flags.empty;C&&C.$_match(z.trim(M,q),l.nest(C),s.defaults)&&(l.mainstay.tracer.value(l,"empty",M,void 0),M=void 0);const m=g.presence||q._flags.presence||(q._flags._endedSwitch?null:f.presence);if(M===void 0){if(m==="forbidden")return z.finalize(M,null,T);if(m==="required")return z.finalize(M,[q.$_createError("any.required",M,null,l,f)],T);if(m==="optional"){if(q._flags.default!==s.symbols.deepDefault)return z.finalize(M,null,T);l.mainstay.tracer.value(l,"default",M,{}),M={}}}else if(m==="forbidden")return z.finalize(M,[q.$_createError("any.unknown",M,null,l,f)],T);const w=[];if(q._valids){const E=q._valids.get(M,l,f,q._flags.insensitive);if(E)return f.convert&&(l.mainstay.tracer.value(l,"valids",M,E.value),M=E.value),l.mainstay.tracer.filter(q,l,"valid",E),z.finalize(M,null,T);if(q._flags.only){const U=q.$_createError("any.only",M,{valids:q._valids.values({display:!0})},l,f);if(f.abortEarly)return z.finalize(M,[U],T);w.push(U)}}if(q._invalids){const E=q._invalids.get(M,l,f,q._flags.insensitive);if(E){l.mainstay.tracer.filter(q,l,"invalid",E);const U=q.$_createError("any.invalid",M,{invalids:q._invalids.values({display:!0})},l,f);if(f.abortEarly)return z.finalize(M,[U],T);w.push(U)}}if(X.validate){const E=X.validate(M,T);if(E&&(l.mainstay.tracer.value(l,"base",M,E.value),M=E.value,E.errors)){if(!Array.isArray(E.errors))return w.push(E.errors),z.finalize(M,w,T);if(E.errors.length)return w.push(...E.errors),z.finalize(M,w,T)}}return q._rules.length?z.rules(M,w,T):z.finalize(M,w,T)},z.rules=function(M,q,l){const{schema:f,state:g,prefs:L}=l;for(const T of f._rules){const X=f._definition.rules[T.method];if(X.convert&&L.convert){g.mainstay.tracer.log(f,g,"rule",T.name,"full");continue}let C,m=T.args;if(T._resolve.length){m=Object.assign({},m);for(const E of T._resolve){const U=X.argsByName.get(E),z0=m[E].resolve(M,g,L),a0=U.normalize?U.normalize(z0):z0,V=s.validateArg(a0,null,U);if(V){C=f.$_createError("any.ref",z0,{arg:E,ref:m[E],reason:V},g,L);break}m[E]=a0}}C=C||X.validate(M,l,m,T);const w=z.rule(C,T);if(w.errors){if(g.mainstay.tracer.log(f,g,"rule",T.name,"error"),T.warn){g.mainstay.warnings.push(...w.errors);continue}if(L.abortEarly)return z.finalize(M,w.errors,l);q.push(...w.errors)}else g.mainstay.tracer.log(f,g,"rule",T.name,"pass"),g.mainstay.tracer.value(g,"rule",M,w.value,T.name),M=w.value}return z.finalize(M,q,l)},z.rule=function(M,q){return M instanceof u.Report?(z.error(M,q),{errors:[M],value:null}):Array.isArray(M)&&M[s.symbols.errors]?(M.forEach(l=>z.error(l,q)),{errors:M,value:null}):{errors:null,value:M}},z.error=function(M,q){return q.message&&M._setTemplate(q.message),M},z.finalize=function(M,q,l){q=q||[];const{schema:f,state:g,prefs:L}=l;if(q.length){const X=z.default("failover",void 0,q,l);X!==void 0&&(g.mainstay.tracer.value(g,"failover",M,X),M=X,q=[])}if(q.length&&f._flags.error)if(typeof f._flags.error=="function"){q=f._flags.error(q),Array.isArray(q)||(q=[q]);for(const X of q)c(X instanceof Error||X instanceof u.Report,"error() must return an Error object")}else q=[f._flags.error];if(M===void 0){const X=z.default("default",M,q,l);g.mainstay.tracer.value(g,"default",M,X),M=X}if(f._flags.cast&&M!==void 0){const X=f._definition.cast[f._flags.cast];if(X.from(M)){const C=X.to(M,l);g.mainstay.tracer.value(g,"cast",M,C,f._flags.cast),M=C}}if(f.$_terms.externals&&L.externals&&L._externals!==!1)for(const{method:X}of f.$_terms.externals)g.mainstay.externals.push({method:X,schema:f,state:g,label:u.label(f._flags,g,L)});const T={value:M,errors:q.length?q:null};return f._flags.result&&(T.value=f._flags.result==="strip"?void 0:l.original,g.mainstay.tracer.value(g,f._flags.result,M,T.value),g.shadow(M,f._flags.result)),f._cache&&L.cache!==!1&&!f._refs.length&&f._cache.set(l.original,T),M===void 0||T.errors||f._flags.artifact===void 0||(g.mainstay.artifacts=g.mainstay.artifacts||new Map,g.mainstay.artifacts.has(f._flags.artifact)||g.mainstay.artifacts.set(f._flags.artifact,[]),g.mainstay.artifacts.get(f._flags.artifact).push(g.path)),T},z.prefs=function(M,q){const l=q===s.defaults;return l&&M._preferences[s.symbols.prefs]?M._preferences[s.symbols.prefs]:(q=s.preferences(q,M._preferences),l&&(M._preferences[s.symbols.prefs]=q),q)},z.default=function(M,q,l,f){const{schema:g,state:L,prefs:T}=f,X=g._flags[M];if(T.noDefaults||X===void 0)return q;if(L.mainstay.tracer.log(g,L,"rule",M,"full"),!X)return X;if(typeof X=="function"){const C=X.length?[y(L.ancestors[0]),f]:[];try{return X(...C)}catch(m){return void l.push(g.$_createError(`any.${M}`,null,{error:m},L,T))}}return typeof X!="object"?X:X[s.symbols.literal]?X.literal:s.isResolvable(X)?X.resolve(q,L,T):y(X)},z.trim=function(M,q){if(typeof M!="string")return M;const l=q.$_getRule("trim");return l&&l.args.enabled?M.trim():M},z.ignore={active:!1,debug:v,entry:v,filter:v,log:v,resolve:v,value:v},z.errorsArray=function(){const M=[];return M[s.symbols.errors]=!0,M}},2036:(a,O,A)=>{const{assert:c,deepEqual:y}=A(8870),v=A(8160),N={};a.exports=N.Values=class{constructor(s,u){this._values=new Set(s),this._refs=new Set(u),this._lowercase=N.lowercases(s),this._override=!1}get length(){return this._values.size+this._refs.size}add(s,u){v.isResolvable(s)?this._refs.has(s)||(this._refs.add(s),u&&u.register(s)):this.has(s,null,null,!1)||(this._values.add(s),typeof s=="string"&&this._lowercase.set(s.toLowerCase(),s))}static merge(s,u,d){if(s=s||new N.Values,u){if(u._override)return u.clone();for(const z of[...u._values,...u._refs])s.add(z)}if(d)for(const z of[...d._values,...d._refs])s.remove(z);return s.length?s:null}remove(s){v.isResolvable(s)?this._refs.delete(s):(this._values.delete(s),typeof s=="string"&&this._lowercase.delete(s.toLowerCase()))}has(s,u,d,z){return!!this.get(s,u,d,z)}get(s,u,d,z){if(!this.length)return!1;if(this._values.has(s))return{value:s};if(typeof s=="string"&&s&&z){const M=this._lowercase.get(s.toLowerCase());if(M)return{value:M}}if(!this._refs.size&&typeof s!="object")return!1;if(typeof s=="object"){for(const M of this._values)if(y(M,s))return{value:M}}if(u)for(const M of this._refs){const q=M.resolve(s,u,d,null,{in:!0});if(q===void 0)continue;const l=M.in&&typeof q=="object"?Array.isArray(q)?q:Object.keys(q):[q];for(const f of l)if(typeof f==typeof s){if(z&&s&&typeof s=="string"){if(f.toLowerCase()===s.toLowerCase())return{value:f,ref:M}}else if(y(f,s))return{value:f,ref:M}}}return!1}override(){this._override=!0}values(s){if(s&&s.display){const u=[];for(const d of[...this._values,...this._refs])d!==void 0&&u.push(d);return u}return Array.from([...this._values,...this._refs])}clone(){const s=new N.Values(this._values,this._refs);return s._override=this._override,s}concat(s){c(!s._override,"Cannot concat override set of values");const u=new N.Values([...this._values,...s._values],[...this._refs,...s._refs]);return u._override=this._override,u}describe(){const s=[];this._override&&s.push({override:!0});for(const u of this._values.values())s.push(u&&typeof u=="object"?{value:u}:u);for(const u of this._refs.values())s.push(u.describe());return s}},N.Values.prototype[v.symbols.values]=!0,N.Values.prototype.slice=N.Values.prototype.clone,N.lowercases=function(s){const u=new Map;if(s)for(const d of s)typeof d=="string"&&u.set(d.toLowerCase(),d);return u}},4958:(a,O,A)=>{A.r(O),A.d(O,{analyzeDomain:()=>f,analyzeEmail:()=>m,errorCodes:()=>y,ipRegex:()=>be,isDomainValid:()=>g,isEmailValid:()=>w,uriDecode:()=>T1,uriRegex:()=>k1,validateDomainOptions:()=>L});var c=A(1275);const y={EMPTY_STRING:"Address must be a non-empty string",FORBIDDEN_UNICODE:"Address contains forbidden Unicode characters",MULTIPLE_AT_CHAR:"Address cannot contain more than one @ character",MISSING_AT_CHAR:"Address must contain one @ character",EMPTY_LOCAL:"Address local part cannot be empty",ADDRESS_TOO_LONG:"Address too long",LOCAL_TOO_LONG:"Address local part too long",EMPTY_LOCAL_SEGMENT:"Address local part contains empty dot-separated segment",INVALID_LOCAL_CHARS:"Address local part contains invalid character",DOMAIN_NON_EMPTY_STRING:"Domain must be a non-empty string",DOMAIN_TOO_LONG:"Domain too long",DOMAIN_INVALID_UNICODE_CHARS:"Domain contains forbidden Unicode characters",DOMAIN_INVALID_CHARS:"Domain contains invalid character",DOMAIN_INVALID_TLDS_CHARS:"Domain contains invalid tld character",DOMAIN_SEGMENTS_COUNT:"Domain lacks the minimum required number of segments",DOMAIN_SEGMENTS_COUNT_MAX:"Domain contains too many segments",DOMAIN_FORBIDDEN_TLDS:"Domain uses forbidden TLD",DOMAIN_EMPTY_SEGMENT:"Domain contains empty dot-separated segment",DOMAIN_LONG_SEGMENT:"Domain contains dot-separated segment that is too long"};function v(M0){return{code:M0,error:y[M0]}}const N=2,s=/[^\x00-\x7f]/,u=/[\x00-\x20@\:\/\\#!\$&\'\(\)\*\+,;=\?]/,d=/^[a-zA-Z](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,z=/^[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,M=/^[a-zA-Z0-9_](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,q=c.URL||URL;function l(M0){return!!M0.allow}function f(M0,_0={}){if(!M0)return v("DOMAIN_NON_EMPTY_STRING");if(typeof M0!="string")throw new Error("Invalid input: domain must be a string");if(M0.length>256)return v("DOMAIN_TOO_LONG");if(s.test(M0)){if(_0.allowUnicode===!1)return v("DOMAIN_INVALID_UNICODE_CHARS");M0=M0.normalize("NFC")}if(u.test(M0))return v("DOMAIN_INVALID_CHARS");M0=function(t0){t0.includes("%")&&(t0=t0.replace(/%/g,"%25"));try{return new q(`http://${t0}`).host}catch{return t0}}(M0),_0.allowFullyQualified&&M0[M0.length-1]==="."&&(M0=M0.slice(0,-1));const e1=_0.minDomainSegments||N,j=M0.split(".");if(j.length<e1)return v("DOMAIN_SEGMENTS_COUNT");if(_0.maxDomainSegments&&j.length>_0.maxDomainSegments)return v("DOMAIN_SEGMENTS_COUNT_MAX");const e0=_0.tlds;if(e0){const t0=j[j.length-1].toLowerCase();if(l(e0)){if(!e0.allow.has(t0))return v("DOMAIN_FORBIDDEN_TLDS")}else if(e0.deny.has(t0))return v("DOMAIN_FORBIDDEN_TLDS")}for(let t0=0;t0<j.length;++t0){const c0=j[t0];if(!c0.length)return v("DOMAIN_EMPTY_SEGMENT");if(c0.length>63)return v("DOMAIN_LONG_SEGMENT");if(t0<j.length-1){if(_0.allowUnderscore){if(!M.test(c0))return v("DOMAIN_INVALID_CHARS")}else if(!z.test(c0))return v("DOMAIN_INVALID_CHARS")}else if(!d.test(c0))return v("DOMAIN_INVALID_TLDS_CHARS")}return null}function g(M0,_0){return!f(M0,_0)}function L(M0){if(M0){if(typeof M0.tlds!="object")throw new Error("Invalid options: tlds must be a boolean or an object");if(l(M0.tlds)){if(M0.tlds.allow instanceof Set==0)throw new Error("Invalid options: tlds.allow must be a Set object or true");if(M0.tlds.deny)throw new Error("Invalid options: cannot specify both tlds.allow and tlds.deny lists")}else if(M0.tlds.deny instanceof Set==0)throw new Error("Invalid options: tlds.deny must be a Set object")}}var T=A(3975);const X=/[^\x00-\x7f]/,C=new(T.TextEncoder||TextEncoder);function m(M0,_0){return E(M0,_0)}function w(M0,_0){return!E(M0,_0)}function E(M0,_0={}){if(typeof M0!="string")throw new Error("Invalid input: email must be a string");if(!M0)return v("EMPTY_STRING");const e1=!X.test(M0);if(!e1){if(_0.allowUnicode===!1)return v("FORBIDDEN_UNICODE");M0=M0.normalize("NFC")}const j=M0.split("@");if(j.length!==2)return j.length>2?v("MULTIPLE_AT_CHAR"):v("MISSING_AT_CHAR");const[e0,t0]=j;if(!e0)return v("EMPTY_LOCAL");if(!_0.ignoreLength){if(M0.length>254)return v("ADDRESS_TOO_LONG");if(C.encode(e0).length>64)return v("LOCAL_TOO_LONG")}return function(c0,R0){const x0=c0.split(".");for(const T0 of x0){if(!T0.length)return v("EMPTY_LOCAL_SEGMENT");if(R0){if(!z0.test(T0))return v("INVALID_LOCAL_CHARS")}else for(const F0 of T0){if(z0.test(F0))continue;const K0=U(F0);if(!a0.test(K0))return v("INVALID_LOCAL_CHARS")}}return null}(e0,e1)||f(t0,_0)}function U(M0){return Array.from(C.encode(M0),_0=>String.fromCharCode(_0)).join("")}const z0=/^[\w!#\$%&'\*\+\-/=\?\^`\{\|\}~]+$/,a0=new RegExp(["(?:[\\xc2-\\xdf][\\x80-\\xbf])","(?:\\xe0[\\xa0-\\xbf][\\x80-\\xbf])|(?:[\\xe1-\\xec][\\x80-\\xbf]{2})|(?:\\xed[\\x80-\\x9f][\\x80-\\xbf])|(?:[\\xee-\\xef][\\x80-\\xbf]{2})","(?:\\xf0[\\x90-\\xbf][\\x80-\\xbf]{2})|(?:[\\xf1-\\xf3][\\x80-\\xbf]{3})|(?:\\xf4[\\x80-\\x8f][\\x80-\\xbf]{2})"].join("|"));var V=A(375),Z=A.n(V),u0=A(6064),L0=A.n(u0);const X0=function(){const M0={},_0="\\dA-Fa-f",e1="["+_0+"]",j="\\w-\\.~",e0="!\\$&'\\(\\)\\*\\+,;=",t0="%"+_0,c0=j+t0+e0+":@",R0="["+c0+"]",x0="(?:0{0,2}\\d|0?[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";M0.ipv4address="(?:"+x0+"\\.){3}"+x0;const T0=e1+"{1,4}",F0="(?:"+T0+":"+T0+"|"+M0.ipv4address+")",K0="(?:"+T0+":){6}"+F0,Kt="::(?:"+T0+":){5}"+F0,D2="(?:"+T0+")?::(?:"+T0+":){4}"+F0,Tr="(?:(?:"+T0+":){0,1}"+T0+")?::(?:"+T0+":){3}"+F0,l2="(?:(?:"+T0+":){0,2}"+T0+")?::(?:"+T0+":){2}"+F0,Br="(?:(?:"+T0+":){0,3}"+T0+")?::"+T0+":"+F0,A2="(?:(?:"+T0+":){0,4}"+T0+")?::"+F0,Qt="(?:(?:"+T0+":){0,5}"+T0+")?::"+T0,mo="(?:(?:"+T0+":){0,6}"+T0+")?::";M0.ipv4Cidr="(?:\\d|[1-2]\\d|3[0-2])",M0.ipv6Cidr="(?:0{0,2}\\d|0?[1-9]\\d|1[01]\\d|12[0-8])",M0.ipv6address="(?:"+K0+"|"+Kt+"|"+D2+"|"+Tr+"|"+l2+"|"+Br+"|"+A2+"|"+Qt+"|"+mo+")",M0.ipvFuture="v"+e1+"+\\.["+j+e0+":]+",M0.scheme="[a-zA-Z][a-zA-Z\\d+-\\.]*",M0.schemeRegex=new RegExp(M0.scheme);const I2="["+j+t0+e0+":]*",er="["+j+t0+e0+"]{1,255}",go="(?:\\[(?:"+M0.ipv6address+"|"+M0.ipvFuture+")\\]|"+M0.ipv4address+"|"+er+")",P2="(?:"+I2+"@)?"+go+"(?::\\d*)?",F2="(?:"+I2+"@)?("+go+")(?::\\d*)?",yo=R0+"*",Ro=R0+"+",Ve="(?:\\/"+yo+")*",k2="\\/(?:"+Ro+Ve+")?",Sr=Ro+Ve,wr="["+j+t0+e0+"@]+"+Ve,xr="(?:\\/\\/\\/"+yo+Ve+")";return M0.hierPart="(?:(?:\\/\\/"+P2+Ve+")|"+k2+"|"+Sr+"|"+xr+")",M0.hierPartCapture="(?:(?:\\/\\/"+F2+Ve+")|"+k2+"|"+Sr+")",M0.relativeRef="(?:(?:\\/\\/"+P2+Ve+")|"+k2+"|"+wr+"|)",M0.relativeRefCapture="(?:(?:\\/\\/"+F2+Ve+")|"+k2+"|"+wr+"|)",M0.query="["+c0+"\\/\\?]*(?=#|$)",M0.queryWithSquareBrackets="["+c0+"\\[\\]\\/\\?]*(?=#|$)",M0.fragment="["+c0+"\\/\\?]*",M0}(),B0={v4Cidr:X0.ipv4Cidr,v6Cidr:X0.ipv6Cidr,ipv4:X0.ipv4address,ipv6:X0.ipv6address,ipvfuture:X0.ipvFuture};function $0(M0){const _0=X0,e1="(?:\\?"+(M0.allowQuerySquareBrackets?_0.queryWithSquareBrackets:_0.query)+")?(?:#"+_0.fragment+")?",j=M0.domain?_0.relativeRefCapture:_0.relativeRef;if(M0.relativeOnly)return h1(j+e1);let e0="";if(M0.scheme){Z()(M0.scheme instanceof RegExp||typeof M0.scheme=="string"||Array.isArray(M0.scheme),"scheme must be a RegExp, String, or Array");const c0=[].concat(M0.scheme);Z()(c0.length>=1,"scheme must have at least 1 scheme specified");const R0=[];for(let x0=0;x0<c0.length;++x0){const T0=c0[x0];Z()(T0 instanceof RegExp||typeof T0=="string","scheme at position "+x0+" must be a RegExp or String"),T0 instanceof RegExp?R0.push(T0.source.toString()):(Z()(_0.schemeRegex.test(T0),"scheme at position "+x0+" must be a valid scheme"),R0.push(L0()(T0)))}e0=R0.join("|")}const t0="(?:"+(e0?"(?:"+e0+")":_0.scheme)+":"+(M0.domain?_0.hierPartCapture:_0.hierPart)+")";return h1((M0.allowRelative?"(?:"+t0+"|"+j+")":t0)+e1,e0)}function h1(M0,_0=null){return{raw:M0=`(?=.)(?!https?:/(?:$|[^/]))(?!https?:///)(?!https?:[^/])${M0}`,regex:new RegExp(`^${M0}$`),scheme:_0}}const d1=$0({});function k1(M0={}){return M0.scheme||M0.allowRelative||M0.relativeOnly||M0.allowQuerySquareBrackets||M0.domain?$0(M0):d1}function be(M0={}){const _0=M0.cidr||"optional";Z()(["required","optional","forbidden"].includes(_0),"options.cidr must be one of required, optional, forbidden"),Z()(M0.version===void 0||typeof M0.version=="string"||Array.isArray(M0.version),"options.version must be a string or an array of string");let e1=M0.version||["ipv4","ipv6","ipvfuture"];Array.isArray(e1)||(e1=[e1]),Z()(e1.length>=1,"options.version must have at least 1 version specified");for(const t0 of e1)Z()(typeof t0=="string"&&t0===t0.toLowerCase(),"Invalid options.version value"),Z()(["ipv4","ipv6","ipvfuture"].includes(t0),"options.version contains unknown version "+t0+" - must be one of ipv4, ipv6, ipvfuture");e1=Array.from(new Set(e1));const j=`(?:${e1.map(t0=>{if(_0==="forbidden")return B0[t0];const c0=`\\/${t0==="ipv4"?B0.v4Cidr:B0.v6Cidr}`;return _0==="required"?`${B0[t0]}${c0}`:`${B0[t0]}(?:${c0})?`}).join("|")})`,e0=new RegExp(`^${j}$`);return{cidr:_0,versions:e1,regex:e0,raw:j}}const pe={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15},J0={accept:12,reject:0,data:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,7,7,7,7,7,7,7,7,7,7,7,7,8,7,7,10,9,9,9,11,4,4,4,4,4,4,4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,24,36,48,60,72,84,96,0,12,12,12,0,0,0,0,0,0,0,0,0,0,0,24,0,0,0,0,0,0,0,0,0,24,24,24,0,0,0,0,0,0,0,0,0,24,24,0,0,0,0,0,0,0,0,0,0,48,48,48,0,0,0,0,0,0,0,0,0,0,48,48,0,0,0,0,0,0,0,0,0,48,0,0,0,0,0,0,0,0,0,0,127,63,63,63,0,31,15,15,15,7,7,7]};function T1(M0){let _0=M0.indexOf("%");if(_0===-1)return M0;let e1="",j=0,e0=0,t0=_0,c0=J0.accept;for(;_0>-1&&_0<M0.length;){const R0=nt(M0[_0+1],4)|nt(M0[_0+2],0),x0=J0.data[R0];if(c0=J0.data[256+c0+x0],e0=e0<<6|R0&J0.data[364+x0],c0!==J0.accept){if(c0===J0.reject||(_0+=3,_0>=M0.length||M0[_0]!=="%"))return null}else e1+=M0.slice(j,t0),e1+=e0<=65535?String.fromCharCode(e0):String.fromCharCode(55232+(e0>>10),56320+(1023&e0)),e0=0,j=_0+3,_0=M0.indexOf("%",j),t0=_0}return e1+M0.slice(j)}function nt(M0,_0){const e1=pe[M0];return e1===void 0?255:e1<<_0}},4964:(a,O)=>{const A={operators:["!","^","*","/","%","+","-","<","<=",">",">=","==","!=","&&","||","??"],operatorCharacters:["!","^","*","/","%","+","-","<","=",">","&","|","?"],operatorsOrder:[["^"],["*","/","%"],["+","-"],["<","<=",">",">="],["==","!="],["&&"],["||","??"]],operatorsPrefix:["!","n"],literals:{'"':'"',"`":"`","'":"'","[":"]"},numberRx:/^(?:[0-9]*(\.[0-9]*)?){1}$/,tokenRx:/^[\w\$\#\.\@\:\{\}]+$/,symbol:Symbol("formula"),settings:Symbol("settings")};O.Parser=class{constructor(c,y={}){if(!y[A.settings]&&y.constants)for(const v in y.constants){const N=y.constants[v];if(N!==null&&!["boolean","number","string"].includes(typeof N))throw new Error(`Formula constant ${v} contains invalid ${typeof N} value type`)}this.settings=y[A.settings]?y:Object.assign({[A.settings]:!0,constants:{},functions:{}},y),this.single=null,this._parts=null,this._parse(c)}_parse(c){let y=[],v="",N=0,s=!1;const u=z=>{if(N)throw new Error("Formula missing closing parenthesis");const M=y.length?y[y.length-1]:null;if(s||v||z){if(M&&M.type==="reference"&&z===")")return M.type="function",M.value=this._subFormula(v,M.value),void(v="");if(z===")"){const q=new O.Parser(v,this.settings);y.push({type:"segment",value:q})}else if(s){if(s==="]")return y.push({type:"reference",value:v}),void(v="");y.push({type:"literal",value:v})}else if(A.operatorCharacters.includes(v))M&&M.type==="operator"&&A.operators.includes(M.value+v)?M.value+=v:y.push({type:"operator",value:v});else if(v.match(A.numberRx))y.push({type:"constant",value:parseFloat(v)});else if(this.settings.constants[v]!==void 0)y.push({type:"constant",value:this.settings.constants[v]});else{if(!v.match(A.tokenRx))throw new Error(`Formula contains invalid token: ${v}`);y.push({type:"reference",value:v})}v=""}};for(const z of c)s?z===s?(u(),s=!1):v+=z:N?z==="("?(v+=z,++N):z===")"?(--N,N?v+=z:u(z)):v+=z:z in A.literals?s=A.literals[z]:z==="("?(u(),++N):A.operatorCharacters.includes(z)?(u(),v=z,u()):z!==" "?v+=z:u();u(),y=y.map((z,M)=>z.type!=="operator"||z.value!=="-"||M&&y[M-1].type!=="operator"?z:{type:"operator",value:"n"});let d=!1;for(const z of y){if(z.type==="operator"){if(A.operatorsPrefix.includes(z.value))continue;if(!d)throw new Error("Formula contains an operator in invalid position");if(!A.operators.includes(z.value))throw new Error(`Formula contains an unknown operator ${z.value}`)}else if(d)throw new Error("Formula missing expected operator");d=!d}if(!d)throw new Error("Formula contains invalid trailing operator");y.length===1&&["reference","literal","constant"].includes(y[0].type)&&(this.single={type:y[0].type==="reference"?"reference":"value",value:y[0].value}),this._parts=y.map(z=>{if(z.type==="operator")return A.operatorsPrefix.includes(z.value)?z:z.value;if(z.type!=="reference")return z.value;if(this.settings.tokenRx&&!this.settings.tokenRx.test(z.value))throw new Error(`Formula contains invalid reference ${z.value}`);return this.settings.reference?this.settings.reference(z.value):A.reference(z.value)})}_subFormula(c,y){const v=this.settings.functions[y];if(typeof v!="function")throw new Error(`Formula contains unknown function ${y}`);let N=[];if(c){let s="",u=0,d=!1;const z=()=>{if(!s)throw new Error(`Formula contains function ${y} with invalid arguments ${c}`);N.push(s),s=""};for(let M=0;M<c.length;++M){const q=c[M];d?(s+=q,q===d&&(d=!1)):q in A.literals&&!u?(s+=q,d=A.literals[q]):q!==","||u?(s+=q,q==="("?++u:q===")"&&--u):z()}z()}return N=N.map(s=>new O.Parser(s,this.settings)),function(s){const u=[];for(const d of N)u.push(d.evaluate(s));return v.call(s,...u)}}evaluate(c){const y=this._parts.slice();for(let v=y.length-2;v>=0;--v){const N=y[v];if(N&&N.type==="operator"){const s=y[v+1];y.splice(v+1,1);const u=A.evaluate(s,c);y[v]=A.single(N.value,u)}}return A.operatorsOrder.forEach(v=>{for(let N=1;N<y.length-1;)if(v.includes(y[N])){const s=y[N],u=A.evaluate(y[N-1],c),d=A.evaluate(y[N+1],c);y.splice(N,2);const z=A.calculate(s,u,d);y[N-1]=z===0?0:z}else N+=2}),A.evaluate(y[0],c)}},O.Parser.prototype[A.symbol]=!0,A.reference=function(c){return function(y){return y&&y[c]!==void 0?y[c]:null}},A.evaluate=function(c,y){return c===null?null:typeof c=="function"?c(y):c[A.symbol]?c.evaluate(y):c},A.single=function(c,y){if(c==="!")return!y;const v=-y;return v===0?0:v},A.calculate=function(c,y,v){if(c==="??")return A.exists(y)?y:v;if(typeof y=="string"||typeof v=="string"){if(c==="+")return(y=A.exists(y)?y:"")+(A.exists(v)?v:"")}else switch(c){case"^":return Math.pow(y,v);case"*":return y*v;case"/":return y/v;case"%":return y%v;case"+":return y+v;case"-":return y-v}switch(c){case"<":return y<v;case"<=":return y<=v;case">":return y>v;case">=":return y>=v;case"==":return y===v;case"!=":return y!==v;case"&&":return y&&v;case"||":return y||v}return null},A.exists=function(c){return c!=null}},978:(a,O,A)=>{const c=A(375),y=A(8571),v=A(1687),N=A(9621),s={};a.exports=function(u,d,z={}){if(c(u&&typeof u=="object","Invalid defaults value: must be an object"),c(!d||d===!0||typeof d=="object","Invalid source value: must be true, falsy or an object"),c(typeof z=="object","Invalid options: must be an object"),!d)return null;if(z.shallow)return s.applyToDefaultsWithShallow(u,d,z);const M=y(u);if(d===!0)return M;const q=z.nullOverride!==void 0&&z.nullOverride;return v(M,d,{nullOverride:q,mergeArrays:!1})},s.applyToDefaultsWithShallow=function(u,d,z){const M=z.shallow;c(Array.isArray(M),"Invalid keys");const q=new Map,l=d===!0?null:new Set;for(let L of M){L=Array.isArray(L)?L:L.split(".");const T=N(u,L);T&&typeof T=="object"?q.set(T,l&&N(d,L)||T):l&&l.add(L)}const f=y(u,{},q);if(!l)return f;for(const L of l)s.reachCopy(f,d,L);const g=z.nullOverride!==void 0&&z.nullOverride;return v(f,d,{nullOverride:g,mergeArrays:!1})},s.reachCopy=function(u,d,z){for(const l of z){if(!(l in d))return;const f=d[l];if(typeof f!="object"||f===null)return;d=f}const M=d;let q=u;for(let l=0;l<z.length-1;++l){const f=z[l];typeof q[f]!="object"&&(q[f]={}),q=q[f]}q[z[z.length-1]]=M}},375:(a,O,A)=>{const c=A(4213),y=A(8761),v=a.exports=function(N,...s){if(N)return;if(s.length===1&&s[0]instanceof Error)throw s[0];const u=s.filter(d=>d!=="").map(d=>typeof d=="string"?d:d instanceof Error?d.message:y(d));throw new c(u.join(" "),v)}},4213:a=>{a.exports=class extends Error{constructor(O,A){var c,y,v,N;super(O||"Unknown error"),c=this,v="AssertError",(y=typeof(N=function(s,u){if(typeof s!="object"||!s)return s;var d=s[Symbol.toPrimitive];if(d!==void 0){var z=d.call(s,"string");if(typeof z!="object")return z;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(s)}(y="name"))=="symbol"?N:String(N))in c?Object.defineProperty(c,y,{value:v,enumerable:!0,configurable:!0,writable:!0}):c[y]=v,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,A)}}},9367:a=>{const O={};a.exports=O.Bench=class{constructor(){this.ts=0,this.reset()}reset(){this.ts=O.Bench.now()}elapsed(){return O.Bench.now()-this.ts}static now(){const A=process.hrtime();return 1e3*A[0]+A[1]/1e6}}},8630:(a,O,A)=>{const c=A(738);a.exports=function(){return new Promise(c)}},8571:(a,O,A)=>{const c=A(9621),y=A(4277),v=A(7043),N={needsProtoHack:new Set([y.set,y.map,y.weakSet,y.weakMap])};a.exports=N.clone=function(s,u={},d=null){if(typeof s!="object"||s===null)return s;let z=N.clone,M=d;if(u.shallow){if(u.shallow!==!0)return N.cloneWithShallow(s,u);z=g=>g}else if(M){const g=M.get(s);if(g)return g}else M=new Map;const q=y.getInternalProto(s);switch(q){case y.buffer:return(!1).from(s);case y.date:return new Date(s.getTime());case y.regex:case y.url:return new q.constructor(s)}const l=N.base(s,q,u);if(l===s)return s;if(M&&M.set(s,l),q===y.set)for(const g of s)l.add(z(g,u,M));else if(q===y.map)for(const[g,L]of s)l.set(g,z(L,u,M));const f=v.keys(s,u);for(const g of f){if(g==="__proto__")continue;if(q===y.array&&g==="length"){l.length=s.length;continue}const L=Object.getOwnPropertyDescriptor(s,g);L?L.get||L.set?Object.defineProperty(l,g,L):L.enumerable?l[g]=z(s[g],u,M):Object.defineProperty(l,g,{enumerable:!1,writable:!0,configurable:!0,value:z(s[g],u,M)}):Object.defineProperty(l,g,{enumerable:!0,writable:!0,configurable:!0,value:z(s[g],u,M)})}return l},N.cloneWithShallow=function(s,u){const d=u.shallow;(u=Object.assign({},u)).shallow=!1;const z=new Map;for(const M of d){const q=c(s,M);typeof q!="object"&&typeof q!="function"||z.set(q,q)}return N.clone(s,u,z)},N.base=function(s,u,d){if(d.prototype===!1)return N.needsProtoHack.has(u)?new u.constructor:u===y.array?[]:{};const z=Object.getPrototypeOf(s);if(z&&z.isImmutable)return s;if(u===y.array){const M=[];return z!==u&&Object.setPrototypeOf(M,z),M}if(N.needsProtoHack.has(u)){const M=new z.constructor;return z!==u&&Object.setPrototypeOf(M,z),M}return Object.create(z)}},1467:(a,O,A)=>{const c=A(375),y=A(9474),v=A(6064),N=A(7043),s={};a.exports=function(u,d,z={}){return typeof d!="object"&&(d=[d]),c(!Array.isArray(d)||d.length,"Values array cannot be empty"),typeof u=="string"?s.string(u,d,z):Array.isArray(u)?s.array(u,d,z):(c(typeof u=="object","Reference must be string or an object"),s.object(u,d,z))},s.array=function(u,d,z){if(Array.isArray(d)||(d=[d]),!u.length||z.only&&z.once&&u.length!==d.length)return!1;let M;const q=new Map;for(const L of d)if(z.deep&&L&&typeof L=="object"){var l;M=(l=M)!==null&&l!==void 0?l:s.compare(z);let T=!1;for(const[X,C]of q.entries())if(M(X,L)){++C.allowed,T=!0;break}T||q.set(L,{allowed:1,hits:0})}else{const T=q.get(L);T?++T.allowed:q.set(L,{allowed:1,hits:0})}let f=0;for(const L of u){let T;if(z.deep&&L&&typeof L=="object"){var g;M=(g=M)!==null&&g!==void 0?g:s.compare(z);for(const[X,C]of q.entries())if(M(X,L)){T=C;break}}else T=q.get(L);if(T&&(++T.hits,++f,z.once&&T.hits>T.allowed))return!1}if(z.only&&f!==u.length)return!1;for(const L of q.values())if(L.hits!==L.allowed&&L.hits<L.allowed&&!z.part)return!1;return!!f},s.object=function(u,d,z){c(z.once===void 0,"Cannot use option once with object");const M=N.keys(u,z);if(!M.length)return!1;if(Array.isArray(d))return s.array(M,d,z);const q=Object.getOwnPropertySymbols(d).filter(L=>d.propertyIsEnumerable(L)),l=[...Object.keys(d),...q],f=s.compare(z),g=new Set(l);for(const L of M)if(g.has(L)){if(!f(d[L],u[L]))return!1;g.delete(L)}else if(z.only)return!1;return!g.size||!!z.part&&g.size<l.length},s.string=function(u,d,z){if(u==="")return d.length===1&&d[0]===""||!z.once&&!d.some(L=>L!=="");const M=new Map,q=[];for(const L of d)if(c(typeof L=="string","Cannot compare string reference to non-string value"),L){const T=M.get(L);T?++T.allowed:(M.set(L,{allowed:1,hits:0}),q.push(v(L)))}else if(z.once||z.only)return!1;if(!q.length)return!0;const l=new RegExp(`(${q.join("|")})`,"g"),f=u.replace(l,(L,T)=>(++M.get(T).hits,""));if(z.only&&f)return!1;let g=!1;for(const L of M.values())if(L.hits&&(g=!0),L.hits!==L.allowed&&(L.hits<L.allowed&&!z.part||z.once))return!1;return!!g},s.compare=function(u){if(!u.deep)return s.shallow;const d=u.only!==void 0,z=u.part!==void 0,M={prototype:d?u.only:!!z&&!u.part,part:d?!u.only:!!z&&u.part};return(q,l)=>y(q,l,M)},s.shallow=function(u,d){return u===d}},9474:(a,O,A)=>{const c=A(4277),y={mismatched:null};a.exports=function(v,N,s){return s=Object.assign({prototype:!0},s),!!y.isDeepEqual(v,N,s,[])},y.isDeepEqual=function(v,N,s,u){if(v===N)return v!==0||1/v==1/N;const d=typeof v;if(d!==typeof N||v===null||N===null)return!1;if(d==="function"){if(!s.deepFunction||v.toString()!==N.toString())return!1}else if(d!=="object")return v!=v&&N!=N;const z=y.getSharedType(v,N,!!s.prototype);switch(z){case c.buffer:return!1;case c.promise:return v===N;case c.regex:case c.url:return v.toString()===N.toString();case y.mismatched:return!1}for(let M=u.length-1;M>=0;--M)if(u[M].isSame(v,N))return!0;u.push(new y.SeenEntry(v,N));try{return!!y.isDeepEqualObj(z,v,N,s,u)}finally{u.pop()}},y.getSharedType=function(v,N,s){if(s)return Object.getPrototypeOf(v)!==Object.getPrototypeOf(N)?y.mismatched:c.getInternalProto(v);const u=c.getInternalProto(v);return u!==c.getInternalProto(N)?y.mismatched:u},y.valueOf=function(v){const N=v.valueOf;if(N===void 0)return v;try{return N.call(v)}catch(s){return s}},y.hasOwnEnumerableProperty=function(v,N){return Object.prototype.propertyIsEnumerable.call(v,N)},y.isSetSimpleEqual=function(v,N){for(const s of Set.prototype.values.call(v))if(!Set.prototype.has.call(N,s))return!1;return!0},y.isDeepEqualObj=function(v,N,s,u,d){const{isDeepEqual:z,valueOf:M,hasOwnEnumerableProperty:q}=y,{keys:l,getOwnPropertySymbols:f}=Object;if(v===c.array){if(!u.part){if(N.length!==s.length)return!1;for(let m=0;m<N.length;++m)if(!z(N[m],s[m],u,d))return!1;return!0}for(const m of N)for(const w of s)if(z(m,w,u,d))return!0}else if(v===c.set){if(N.size!==s.size)return!1;if(!y.isSetSimpleEqual(N,s)){const m=new Set(Set.prototype.values.call(s));for(const w of Set.prototype.values.call(N)){if(m.delete(w))continue;let E=!1;for(const U of m)if(z(w,U,u,d)){m.delete(U),E=!0;break}if(!E)return!1}}}else if(v===c.map){if(N.size!==s.size)return!1;for(const[m,w]of Map.prototype.entries.call(N))if(w===void 0&&!Map.prototype.has.call(s,m)||!z(w,Map.prototype.get.call(s,m),u,d))return!1}else if(v===c.error&&(N.name!==s.name||N.message!==s.message))return!1;const g=M(N),L=M(s);if((N!==g||s!==L)&&!z(g,L,u,d))return!1;const T=l(N);if(!u.part&&T.length!==l(s).length&&!u.skip)return!1;let X=0;for(const m of T)if(u.skip&&u.skip.includes(m))s[m]===void 0&&++X;else if(!q(s,m)||!z(N[m],s[m],u,d))return!1;if(!u.part&&T.length-X!==l(s).length)return!1;if(u.symbols!==!1){const m=f(N),w=new Set(f(s));for(const E of m){var C;if((C=u.skip)===null||C===void 0||!C.includes(E)){if(q(N,E)){if(!q(s,E)||!z(N[E],s[E],u,d))return!1}else if(q(s,E))return!1}w.delete(E)}for(const E of w)if(q(s,E))return!1}return!0},y.SeenEntry=class{constructor(v,N){this.obj=v,this.ref=N}isSame(v,N){return this.obj===v&&this.ref===N}}},4168:(a,O,A)=>{const c=A(375);a.exports=function(y){return c(/^[ \w\!#\$%&'\(\)\*\+,\-\.\/\:;<\=>\?@\[\]\^`\{\|\}~\"\\]*$/.test(y),"Bad attribute value ("+y+")"),y.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')}},5277:a=>{const O={};a.exports=function(A){if(!A)return"";let c="";for(let y=0;y<A.length;++y){const v=A.charCodeAt(y);O.isSafe(v)?c+=A[y]:c+=O.escapeHtmlChar(v)}return c},O.escapeHtmlChar=function(A){return O.namedHtml.get(A)||(A>=256?"&#"+A+";":`&#x${A.toString(16).padStart(2,"0")};`)},O.isSafe=function(A){return O.safeCharCodes.has(A)},O.namedHtml=new Map([[38,"&amp;"],[60,"&lt;"],[62,"&gt;"],[34,"&quot;"],[160,"&nbsp;"],[162,"&cent;"],[163,"&pound;"],[164,"&curren;"],[169,"&copy;"],[174,"&reg;"]]),O.safeCharCodes=function(){const A=new Set;for(let c=32;c<123;++c)(c>=97||c>=65&&c<=90||c>=48&&c<=57||c===32||c===46||c===44||c===45||c===58||c===95)&&A.add(c);return A}()},7973:a=>{const O={};a.exports=function(A){return A?A.replace(/[<>&\u2028\u2029]/g,O.escape):""},O.escape=function(A){return O.replacements.get(A)},O.replacements=new Map([["<","\\u003c"],[">","\\u003e"],["&","\\u0026"],["\u2028","\\u2028"],["\u2029","\\u2029"]])},6064:a=>{a.exports=function(O){return O.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")}},655:a=>{const O={};a.exports=O.flatten=function(A,c){const y=c||[];for(const v of A)Array.isArray(v)?O.flatten(v,y):y.push(v);return y}},738:a=>{a.exports=function(){}},8870:(a,O,A)=>{O.applyToDefaults=A(978),O.assert=A(375),O.AssertError=A(4213),O.Bench=A(9367),O.block=A(8630),O.clone=A(8571),O.contain=A(1467),O.deepEqual=A(9474),O.escapeHeaderAttribute=A(4168),O.escapeHtml=A(5277),O.escapeJson=A(7973),O.escapeRegex=A(6064),O.flatten=A(655),O.ignore=A(738),O.intersect=A(5088),O.isPromise=A(7259),O.merge=A(1687),O.once=A(5022),O.reach=A(9621),O.reachTemplate=A(4069),O.stringify=A(8761),O.wait=A(2620)},5088:a=>{const O={};a.exports=function(A,c,y={}){if(!A||!c)return y.first?null:[];const v=[],N=Array.isArray(A)?new Set(A):A,s=new Set;for(const u of c)if(O.has(N,u)&&!s.has(u)){if(y.first)return u;v.push(u),s.add(u)}return y.first?null:v},O.has=function(A,c){return typeof A.has=="function"?A.has(c):A[c]!==void 0}},7259:a=>{a.exports=function(O){return typeof O?.then=="function"}},1687:(a,O,A)=>{const c=A(375),y=A(8571),v=A(7043),N={};a.exports=N.merge=function(s,u,d){if(c(s&&typeof s=="object","Invalid target value: must be an object"),c(u==null||typeof u=="object","Invalid source value: must be null, undefined, or an object"),!u)return s;if(d=Object.assign({nullOverride:!0,mergeArrays:!0},d),Array.isArray(u)){c(Array.isArray(s),"Cannot merge array onto an object"),d.mergeArrays||(s.length=0);for(let M=0;M<u.length;++M)s.push(y(u[M],{symbols:d.symbols}));return s}const z=v.keys(u,d);for(let M=0;M<z.length;++M){const q=z[M];if(q==="__proto__"||!Object.prototype.propertyIsEnumerable.call(u,q))continue;const l=u[q];if(l&&typeof l=="object"){if(s[q]===l)continue;!s[q]||typeof s[q]!="object"||Array.isArray(s[q])!==Array.isArray(l)||l instanceof Date||l instanceof RegExp?s[q]=y(l,{symbols:d.symbols}):N.merge(s[q],l,d)}else(l!=null||d.nullOverride)&&(s[q]=l)}return s}},5022:a=>{const O=Symbol("wrapped");a.exports=function(A){if(A[O])return A;let c=!1;const y=function(...v){c||(c=!0,A(...v))};return y[O]=!0,y}},9621:(a,O,A)=>{const c=A(375),y={};a.exports=function(v,N,s){if(N===!1||N==null)return v;typeof(s=s||{})=="string"&&(s={separator:s});const u=Array.isArray(N);c(!u||!s.separator,"Separator option is not valid for array-based chain");const d=u?N:N.split(s.separator||".");let z=v;for(let M=0;M<d.length;++M){let q=d[M];const l=s.iterables&&y.iterables(z);if(Array.isArray(z)||l==="set"){const f=Number(q);Number.isInteger(f)&&(q=f<0?z.length+f:f)}if(!z||typeof z=="function"&&s.functions===!1||!l&&z[q]===void 0){c(!s.strict||M+1===d.length,"Missing segment",q,"in reach path ",N),c(typeof z=="object"||s.functions===!0||typeof z!="function","Invalid segment",q,"in reach path ",N),z=s.default;break}z=l?l==="set"?[...z][q]:z.get(q):z[q]}return z},y.iterables=function(v){return v instanceof Set?"set":v instanceof Map?"map":void 0}},4069:(a,O,A)=>{const c=A(9621);a.exports=function(y,v,N){return v.replace(/{([^{}]+)}/g,(s,u)=>{const d=c(y,u,N);return d??""})}},8761:a=>{a.exports=function(...O){try{return JSON.stringify(...O)}catch(A){return"[Cannot display object: "+A.message+"]"}}},4277:(a,O)=>{const A={};O=a.exports={array:Array.prototype,buffer:!1,date:Date.prototype,error:Error.prototype,generic:Object.prototype,map:Map.prototype,promise:Promise.prototype,regex:RegExp.prototype,set:Set.prototype,url:URL.prototype,weakMap:WeakMap.prototype,weakSet:WeakSet.prototype},A.typeMap=new Map([["[object Error]",O.error],["[object Map]",O.map],["[object Promise]",O.promise],["[object Set]",O.set],["[object URL]",O.url],["[object WeakMap]",O.weakMap],["[object WeakSet]",O.weakSet]]),O.getInternalProto=function(c){if(Array.isArray(c))return O.array;if(c instanceof Date)return O.date;if(c instanceof RegExp)return O.regex;if(c instanceof Error)return O.error;const y=Object.prototype.toString.call(c);return A.typeMap.get(y)||O.generic}},7043:(a,O)=>{O.keys=function(A,c={}){return c.symbols!==!1?Reflect.ownKeys(A):Object.getOwnPropertyNames(A)}},2620:a=>{a.exports=function(O,A,c){if(typeof O=="bigint"&&(O=Number(O)),O>=Number.MAX_SAFE_INTEGER&&(O=1/0),typeof O!="number"&&O!==void 0)throw new TypeError("Timeout must be a number or bigint");return new Promise(y=>{const v=c?c.setTimeout:setTimeout,N=()=>{const s=Math.min(O,2147483647);O-=s,v(()=>O>0?N():y(A),s)};O!==1/0&&N()})}},7593:(a,O)=>{O.location=function(A=0){const c=Error.prepareStackTrace;Error.prepareStackTrace=(N,s)=>s;const y={};Error.captureStackTrace(y,this);const v=y.stack[A+1];return Error.prepareStackTrace=c,{filename:v.getFileName(),line:v.getLineNumber()}}},6264:(a,O,A)=>{A.r(O),A.d(O,{tlds:()=>c});const c=new Set(["AAA","AARP","ABB","ABBOTT","ABBVIE","ABC","ABLE","ABOGADO","ABUDHABI","AC","ACADEMY","ACCENTURE","ACCOUNTANT","ACCOUNTANTS","ACO","ACTOR","AD","ADS","ADULT","AE","AEG","AERO","AETNA","AF","AFL","AFRICA","AG","AGAKHAN","AGENCY","AI","AIG","AIRBUS","AIRFORCE","AIRTEL","AKDN","AL","ALIBABA","ALIPAY","ALLFINANZ","ALLSTATE","ALLY","ALSACE","ALSTOM","AM","AMAZON","AMERICANEXPRESS","AMERICANFAMILY","AMEX","AMFAM","AMICA","AMSTERDAM","ANALYTICS","ANDROID","ANQUAN","ANZ","AO","AOL","APARTMENTS","APP","APPLE","AQ","AQUARELLE","AR","ARAB","ARAMCO","ARCHI","ARMY","ARPA","ART","ARTE","AS","ASDA","ASIA","ASSOCIATES","AT","ATHLETA","ATTORNEY","AU","AUCTION","AUDI","AUDIBLE","AUDIO","AUSPOST","AUTHOR","AUTO","AUTOS","AVIANCA","AW","AWS","AX","AXA","AZ","AZURE","BA","BABY","BAIDU","BANAMEX","BANANAREPUBLIC","BAND","BANK","BAR","BARCELONA","BARCLAYCARD","BARCLAYS","BAREFOOT","BARGAINS","BASEBALL","BASKETBALL","BAUHAUS","BAYERN","BB","BBC","BBT","BBVA","BCG","BCN","BD","BE","BEATS","BEAUTY","BEER","BENTLEY","BERLIN","BEST","BESTBUY","BET","BF","BG","BH","BHARTI","BI","BIBLE","BID","BIKE","BING","BINGO","BIO","BIZ","BJ","BLACK","BLACKFRIDAY","BLOCKBUSTER","BLOG","BLOOMBERG","BLUE","BM","BMS","BMW","BN","BNPPARIBAS","BO","BOATS","BOEHRINGER","BOFA","BOM","BOND","BOO","BOOK","BOOKING","BOSCH","BOSTIK","BOSTON","BOT","BOUTIQUE","BOX","BR","BRADESCO","BRIDGESTONE","BROADWAY","BROKER","BROTHER","BRUSSELS","BS","BT","BUILD","BUILDERS","BUSINESS","BUY","BUZZ","BV","BW","BY","BZ","BZH","CA","CAB","CAFE","CAL","CALL","CALVINKLEIN","CAM","CAMERA","CAMP","CANON","CAPETOWN","CAPITAL","CAPITALONE","CAR","CARAVAN","CARDS","CARE","CAREER","CAREERS","CARS","CASA","CASE","CASH","CASINO","CAT","CATERING","CATHOLIC","CBA","CBN","CBRE","CBS","CC","CD","CENTER","CEO","CERN","CF","CFA","CFD","CG","CH","CHANEL","CHANNEL","CHARITY","CHASE","CHAT","CHEAP","CHINTAI","CHRISTMAS","CHROME","CHURCH","CI","CIPRIANI","CIRCLE","CISCO","CITADEL","CITI","CITIC","CITY","CITYEATS","CK","CL","CLAIMS","CLEANING","CLICK","CLINIC","CLINIQUE","CLOTHING","CLOUD","CLUB","CLUBMED","CM","CN","CO","COACH","CODES","COFFEE","COLLEGE","COLOGNE","COM","COMCAST","COMMBANK","COMMUNITY","COMPANY","COMPARE","COMPUTER","COMSEC","CONDOS","CONSTRUCTION","CONSULTING","CONTACT","CONTRACTORS","COOKING","COOL","COOP","CORSICA","COUNTRY","COUPON","COUPONS","COURSES","CPA","CR","CREDIT","CREDITCARD","CREDITUNION","CRICKET","CROWN","CRS","CRUISE","CRUISES","CU","CUISINELLA","CV","CW","CX","CY","CYMRU","CYOU","CZ","DABUR","DAD","DANCE","DATA","DATE","DATING","DATSUN","DAY","DCLK","DDS","DE","DEAL","DEALER","DEALS","DEGREE","DELIVERY","DELL","DELOITTE","DELTA","DEMOCRAT","DENTAL","DENTIST","DESI","DESIGN","DEV","DHL","DIAMONDS","DIET","DIGITAL","DIRECT","DIRECTORY","DISCOUNT","DISCOVER","DISH","DIY","DJ","DK","DM","DNP","DO","DOCS","DOCTOR","DOG","DOMAINS","DOT","DOWNLOAD","DRIVE","DTV","DUBAI","DUNLOP","DUPONT","DURBAN","DVAG","DVR","DZ","EARTH","EAT","EC","ECO","EDEKA","EDU","EDUCATION","EE","EG","EMAIL","EMERCK","ENERGY","ENGINEER","ENGINEERING","ENTERPRISES","EPSON","EQUIPMENT","ER","ERICSSON","ERNI","ES","ESQ","ESTATE","ET","ETISALAT","EU","EUROVISION","EUS","EVENTS","EXCHANGE","EXPERT","EXPOSED","EXPRESS","EXTRASPACE","FAGE","FAIL","FAIRWINDS","FAITH","FAMILY","FAN","FANS","FARM","FARMERS","FASHION","FAST","FEDEX","FEEDBACK","FERRARI","FERRERO","FI","FIDELITY","FIDO","FILM","FINAL","FINANCE","FINANCIAL","FIRE","FIRESTONE","FIRMDALE","FISH","FISHING","FIT","FITNESS","FJ","FK","FLICKR","FLIGHTS","FLIR","FLORIST","FLOWERS","FLY","FM","FO","FOO","FOOD","FOOTBALL","FORD","FOREX","FORSALE","FORUM","FOUNDATION","FOX","FR","FREE","FRESENIUS","FRL","FROGANS","FRONTDOOR","FRONTIER","FTR","FUJITSU","FUN","FUND","FURNITURE","FUTBOL","FYI","GA","GAL","GALLERY","GALLO","GALLUP","GAME","GAMES","GAP","GARDEN","GAY","GB","GBIZ","GD","GDN","GE","GEA","GENT","GENTING","GEORGE","GF","GG","GGEE","GH","GI","GIFT","GIFTS","GIVES","GIVING","GL","GLASS","GLE","GLOBAL","GLOBO","GM","GMAIL","GMBH","GMO","GMX","GN","GODADDY","GOLD","GOLDPOINT","GOLF","GOO","GOODYEAR","GOOG","GOOGLE","GOP","GOT","GOV","GP","GQ","GR","GRAINGER","GRAPHICS","GRATIS","GREEN","GRIPE","GROCERY","GROUP","GS","GT","GU","GUARDIAN","GUCCI","GUGE","GUIDE","GUITARS","GURU","GW","GY","HAIR","HAMBURG","HANGOUT","HAUS","HBO","HDFC","HDFCBANK","HEALTH","HEALTHCARE","HELP","HELSINKI","HERE","HERMES","HIPHOP","HISAMITSU","HITACHI","HIV","HK","HKT","HM","HN","HOCKEY","HOLDINGS","HOLIDAY","HOMEDEPOT","HOMEGOODS","HOMES","HOMESENSE","HONDA","HORSE","HOSPITAL","HOST","HOSTING","HOT","HOTELS","HOTMAIL","HOUSE","HOW","HR","HSBC","HT","HU","HUGHES","HYATT","HYUNDAI","IBM","ICBC","ICE","ICU","ID","IE","IEEE","IFM","IKANO","IL","IM","IMAMAT","IMDB","IMMO","IMMOBILIEN","IN","INC","INDUSTRIES","INFINITI","INFO","ING","INK","INSTITUTE","INSURANCE","INSURE","INT","INTERNATIONAL","INTUIT","INVESTMENTS","IO","IPIRANGA","IQ","IR","IRISH","IS","ISMAILI","IST","ISTANBUL","IT","ITAU","ITV","JAGUAR","JAVA","JCB","JE","JEEP","JETZT","JEWELRY","JIO","JLL","JM","JMP","JNJ","JO","JOBS","JOBURG","JOT","JOY","JP","JPMORGAN","JPRS","JUEGOS","JUNIPER","KAUFEN","KDDI","KE","KERRYHOTELS","KERRYLOGISTICS","KERRYPROPERTIES","KFH","KG","KH","KI","KIA","KIDS","KIM","KINDER","KINDLE","KITCHEN","KIWI","KM","KN","KOELN","KOMATSU","KOSHER","KP","KPMG","KPN","KR","KRD","KRED","KUOKGROUP","KW","KY","KYOTO","KZ","LA","LACAIXA","LAMBORGHINI","LAMER","LANCASTER","LAND","LANDROVER","LANXESS","LASALLE","LAT","LATINO","LATROBE","LAW","LAWYER","LB","LC","LDS","LEASE","LECLERC","LEFRAK","LEGAL","LEGO","LEXUS","LGBT","LI","LIDL","LIFE","LIFEINSURANCE","LIFESTYLE","LIGHTING","LIKE","LILLY","LIMITED","LIMO","LINCOLN","LINK","LIPSY","LIVE","LIVING","LK","LLC","LLP","LOAN","LOANS","LOCKER","LOCUS","LOL","LONDON","LOTTE","LOTTO","LOVE","LPL","LPLFINANCIAL","LR","LS","LT","LTD","LTDA","LU","LUNDBECK","LUXE","LUXURY","LV","LY","MA","MADRID","MAIF","MAISON","MAKEUP","MAN","MANAGEMENT","MANGO","MAP","MARKET","MARKETING","MARKETS","MARRIOTT","MARSHALLS","MATTEL","MBA","MC","MCKINSEY","MD","ME","MED","MEDIA","MEET","MELBOURNE","MEME","MEMORIAL","MEN","MENU","MERCKMSD","MG","MH","MIAMI","MICROSOFT","MIL","MINI","MINT","MIT","MITSUBISHI","MK","ML","MLB","MLS","MM","MMA","MN","MO","MOBI","MOBILE","MODA","MOE","MOI","MOM","MONASH","MONEY","MONSTER","MORMON","MORTGAGE","MOSCOW","MOTO","MOTORCYCLES","MOV","MOVIE","MP","MQ","MR","MS","MSD","MT","MTN","MTR","MU","MUSEUM","MUSIC","MV","MW","MX","MY","MZ","NA","NAB","NAGOYA","NAME","NATURA","NAVY","NBA","NC","NE","NEC","NET","NETBANK","NETFLIX","NETWORK","NEUSTAR","NEW","NEWS","NEXT","NEXTDIRECT","NEXUS","NF","NFL","NG","NGO","NHK","NI","NICO","NIKE","NIKON","NINJA","NISSAN","NISSAY","NL","NO","NOKIA","NORTON","NOW","NOWRUZ","NOWTV","NP","NR","NRA","NRW","NTT","NU","NYC","NZ","OBI","OBSERVER","OFFICE","OKINAWA","OLAYAN","OLAYANGROUP","OLDNAVY","OLLO","OM","OMEGA","ONE","ONG","ONL","ONLINE","OOO","OPEN","ORACLE","ORANGE","ORG","ORGANIC","ORIGINS","OSAKA","OTSUKA","OTT","OVH","PA","PAGE","PANASONIC","PARIS","PARS","PARTNERS","PARTS","PARTY","PAY","PCCW","PE","PET","PF","PFIZER","PG","PH","PHARMACY","PHD","PHILIPS","PHONE","PHOTO","PHOTOGRAPHY","PHOTOS","PHYSIO","PICS","PICTET","PICTURES","PID","PIN","PING","PINK","PIONEER","PIZZA","PK","PL","PLACE","PLAY","PLAYSTATION","PLUMBING","PLUS","PM","PN","PNC","POHL","POKER","POLITIE","PORN","POST","PR","PRAMERICA","PRAXI","PRESS","PRIME","PRO","PROD","PRODUCTIONS","PROF","PROGRESSIVE","PROMO","PROPERTIES","PROPERTY","PROTECTION","PRU","PRUDENTIAL","PS","PT","PUB","PW","PWC","PY","QA","QPON","QUEBEC","QUEST","RACING","RADIO","RE","READ","REALESTATE","REALTOR","REALTY","RECIPES","RED","REDSTONE","REDUMBRELLA","REHAB","REISE","REISEN","REIT","RELIANCE","REN","RENT","RENTALS","REPAIR","REPORT","REPUBLICAN","REST","RESTAURANT","REVIEW","REVIEWS","REXROTH","RICH","RICHARDLI","RICOH","RIL","RIO","RIP","RO","ROCHER","ROCKS","RODEO","ROGERS","ROOM","RS","RSVP","RU","RUGBY","RUHR","RUN","RW","RWE","RYUKYU","SA","SAARLAND","SAFE","SAFETY","SAKURA","SALE","SALON","SAMSCLUB","SAMSUNG","SANDVIK","SANDVIKCOROMANT","SANOFI","SAP","SARL","SAS","SAVE","SAXO","SB","SBI","SBS","SC","SCA","SCB","SCHAEFFLER","SCHMIDT","SCHOLARSHIPS","SCHOOL","SCHULE","SCHWARZ","SCIENCE","SCOT","SD","SE","SEARCH","SEAT","SECURE","SECURITY","SEEK","SELECT","SENER","SERVICES","SEVEN","SEW","SEX","SEXY","SFR","SG","SH","SHANGRILA","SHARP","SHAW","SHELL","SHIA","SHIKSHA","SHOES","SHOP","SHOPPING","SHOUJI","SHOW","SHOWTIME","SI","SILK","SINA","SINGLES","SITE","SJ","SK","SKI","SKIN","SKY","SKYPE","SL","SLING","SM","SMART","SMILE","SN","SNCF","SO","SOCCER","SOCIAL","SOFTBANK","SOFTWARE","SOHU","SOLAR","SOLUTIONS","SONG","SONY","SOY","SPA","SPACE","SPORT","SPOT","SR","SRL","SS","ST","STADA","STAPLES","STAR","STATEBANK","STATEFARM","STC","STCGROUP","STOCKHOLM","STORAGE","STORE","STREAM","STUDIO","STUDY","STYLE","SU","SUCKS","SUPPLIES","SUPPLY","SUPPORT","SURF","SURGERY","SUZUKI","SV","SWATCH","SWISS","SX","SY","SYDNEY","SYSTEMS","SZ","TAB","TAIPEI","TALK","TAOBAO","TARGET","TATAMOTORS","TATAR","TATTOO","TAX","TAXI","TC","TCI","TD","TDK","TEAM","TECH","TECHNOLOGY","TEL","TEMASEK","TENNIS","TEVA","TF","TG","TH","THD","THEATER","THEATRE","TIAA","TICKETS","TIENDA","TIPS","TIRES","TIROL","TJ","TJMAXX","TJX","TK","TKMAXX","TL","TM","TMALL","TN","TO","TODAY","TOKYO","TOOLS","TOP","TORAY","TOSHIBA","TOTAL","TOURS","TOWN","TOYOTA","TOYS","TR","TRADE","TRADING","TRAINING","TRAVEL","TRAVELERS","TRAVELERSINSURANCE","TRUST","TRV","TT","TUBE","TUI","TUNES","TUSHU","TV","TVS","TW","TZ","UA","UBANK","UBS","UG","UK","UNICOM","UNIVERSITY","UNO","UOL","UPS","US","UY","UZ","VA","VACATIONS","VANA","VANGUARD","VC","VE","VEGAS","VENTURES","VERISIGN","VERSICHERUNG","VET","VG","VI","VIAJES","VIDEO","VIG","VIKING","VILLAS","VIN","VIP","VIRGIN","VISA","VISION","VIVA","VIVO","VLAANDEREN","VN","VODKA","VOLKSWAGEN","VOLVO","VOTE","VOTING","VOTO","VOYAGE","VU","WALES","WALMART","WALTER","WANG","WANGGOU","WATCH","WATCHES","WEATHER","WEATHERCHANNEL","WEBCAM","WEBER","WEBSITE","WED","WEDDING","WEIBO","WEIR","WF","WHOSWHO","WIEN","WIKI","WILLIAMHILL","WIN","WINDOWS","WINE","WINNERS","WME","WOLTERSKLUWER","WOODSIDE","WORK","WORKS","WORLD","WOW","WS","WTC","WTF","XBOX","XEROX","XFINITY","XIHUAN","XIN","XN--11B4C3D","XN--1CK2E1B","XN--1QQW23A","XN--2SCRJ9C","XN--30RR7Y","XN--3BST00M","XN--3DS443G","XN--3E0B707E","XN--3HCRJ9C","XN--3PXU8K","XN--42C2D9A","XN--45BR5CYL","XN--45BRJ9C","XN--45Q11C","XN--4DBRK0CE","XN--4GBRIM","XN--54B7FTA0CC","XN--55QW42G","XN--55QX5D","XN--5SU34J936BGSG","XN--5TZM5G","XN--6FRZ82G","XN--6QQ986B3XL","XN--80ADXHKS","XN--80AO21A","XN--80AQECDR1A","XN--80ASEHDB","XN--80ASWG","XN--8Y0A063A","XN--90A3AC","XN--90AE","XN--90AIS","XN--9DBQ2A","XN--9ET52U","XN--9KRT00A","XN--B4W605FERD","XN--BCK1B9A5DRE4C","XN--C1AVG","XN--C2BR7G","XN--CCK2B3B","XN--CCKWCXETD","XN--CG4BKI","XN--CLCHC0EA0B2G2A9GCD","XN--CZR694B","XN--CZRS0T","XN--CZRU2D","XN--D1ACJ3B","XN--D1ALF","XN--E1A4C","XN--ECKVDTC9D","XN--EFVY88H","XN--FCT429K","XN--FHBEI","XN--FIQ228C5HS","XN--FIQ64B","XN--FIQS8S","XN--FIQZ9S","XN--FJQ720A","XN--FLW351E","XN--FPCRJ9C3D","XN--FZC2C9E2C","XN--FZYS8D69UVGM","XN--G2XX48C","XN--GCKR3F0F","XN--GECRJ9C","XN--GK3AT1E","XN--H2BREG3EVE","XN--H2BRJ9C","XN--H2BRJ9C8C","XN--HXT814E","XN--I1B6B1A6A2E","XN--IMR513N","XN--IO0A7I","XN--J1AEF","XN--J1AMH","XN--J6W193G","XN--JLQ480N2RG","XN--JVR189M","XN--KCRX77D1X4A","XN--KPRW13D","XN--KPRY57D","XN--KPUT3I","XN--L1ACC","XN--LGBBAT1AD8J","XN--MGB9AWBF","XN--MGBA3A3EJT","XN--MGBA3A4F16A","XN--MGBA7C0BBN0A","XN--MGBAAKC7DVF","XN--MGBAAM7A8H","XN--MGBAB2BD","XN--MGBAH1A3HJKRD","XN--MGBAI9AZGQP6J","XN--MGBAYH7GPA","XN--MGBBH1A","XN--MGBBH1A71E","XN--MGBC0A9AZCG","XN--MGBCA7DZDO","XN--MGBCPQ6GPA1A","XN--MGBERP4A5D4AR","XN--MGBGU82A","XN--MGBI4ECEXP","XN--MGBPL2FH","XN--MGBT3DHD","XN--MGBTX2B","XN--MGBX4CD0AB","XN--MIX891F","XN--MK1BU44C","XN--MXTQ1M","XN--NGBC5AZD","XN--NGBE9E0A","XN--NGBRX","XN--NODE","XN--NQV7F","XN--NQV7FS00EMA","XN--NYQY26A","XN--O3CW4H","XN--OGBPF8FL","XN--OTU796D","XN--P1ACF","XN--P1AI","XN--PGBS0DH","XN--PSSY2U","XN--Q7CE6A","XN--Q9JYB4C","XN--QCKA1PMC","XN--QXA6A","XN--QXAM","XN--RHQV96G","XN--ROVU88B","XN--RVC1E0AM3E","XN--S9BRJ9C","XN--SES554G","XN--T60B56A","XN--TCKWE","XN--TIQ49XQYJ","XN--UNUP4Y","XN--VERMGENSBERATER-CTB","XN--VERMGENSBERATUNG-PWB","XN--VHQUV","XN--VUQ861B","XN--W4R85EL8FHU5DNRA","XN--W4RS40L","XN--WGBH1C","XN--WGBL6A","XN--XHQ521B","XN--XKC2AL3HYE2A","XN--XKC2DL3A5EE0H","XN--Y9A3AQ","XN--YFRO4I67O","XN--YGBI2AMMX","XN--ZFR164B","XXX","XYZ","YACHTS","YAHOO","YAMAXUN","YANDEX","YE","YODOBASHI","YOGA","YOKOHAMA","YOU","YOUTUBE","YT","YUN","ZA","ZAPPOS","ZARA","ZERO","ZIP","ZM","ZONE","ZUERICH","ZW"].map(y=>y.toLowerCase()))},3652:(a,O,A)=>{const{assert:c}=A(8870),y={};O.Sorter=class{constructor(){this._items=[],this.nodes=[]}add(v,N){var s,u,d,z,M;N=(s=N)!==null&&s!==void 0?s:{};const q=[].concat((u=N.before)!==null&&u!==void 0?u:[]),l=[].concat((d=N.after)!==null&&d!==void 0?d:[]),f=(z=N.group)!==null&&z!==void 0?z:"?",g=(M=N.sort)!==null&&M!==void 0?M:0;c(!q.includes(f),`Item cannot come before itself: ${f}`),c(!q.includes("?"),"Item cannot come before unassociated items"),c(!l.includes(f),`Item cannot come after itself: ${f}`),c(!l.includes("?"),"Item cannot come after unassociated items"),Array.isArray(v)||(v=[v]);for(const L of v){const T={seq:this._items.length,sort:g,before:q,after:l,group:f,node:L};this._items.push(T)}if(!N.manual){const L=this._sort();c(L,"item",f!=="?"?`added into group ${f}`:"","created a dependencies error")}return this.nodes}merge(v){Array.isArray(v)||(v=[v]);for(const s of v)if(s)for(const u of s._items)this._items.push(Object.assign({},u));this._items.sort(y.mergeSort);for(let s=0;s<this._items.length;++s)this._items[s].seq=s;const N=this._sort();return c(N,"merge created a dependencies error"),this.nodes}sort(){const v=this._sort();return c(v,"sort created a dependencies error"),this.nodes}_sort(){const v={},N=Object.create(null),s=Object.create(null);for(const L of this._items){var u;const T=L.seq,X=L.group;s[X]=(u=s[X])!==null&&u!==void 0?u:[],s[X].push(T),v[T]=L.before;for(const C of L.after){var d;N[C]=(d=N[C])!==null&&d!==void 0?d:[],N[C].push(T)}}for(const L in v){const T=[];for(const X in v[L]){var z;const C=v[L][X];s[C]=(z=s[C])!==null&&z!==void 0?z:[],T.push(...s[C])}v[L]=T}for(const L in N)if(s[L])for(const T of s[L])v[T].push(...N[L]);const M={};for(const L in v){const T=v[L];for(const X of T){var q;M[X]=(q=M[X])!==null&&q!==void 0?q:[],M[X].push(L)}}const l={},f=[];for(let L=0;L<this._items.length;++L){let T=L;if(M[L]){T=null;for(let X=0;X<this._items.length;++X){if(l[X]===!0)continue;M[X]||(M[X]=[]);const C=M[X].length;let m=0;for(let w=0;w<C;++w)l[M[X][w]]&&++m;if(m===C){T=X;break}}}T!==null&&(l[T]=!0,f.push(T))}if(f.length!==this._items.length)return!1;const g={};for(const L of this._items)g[L.seq]=L;this._items=[],this.nodes=[];for(const L of f){const T=g[L];this.nodes.push(T.node),this._items.push(T)}return!0}},y.mergeSort=(v,N)=>v.sort===N.sort?0:v.sort<N.sort?-1:1},1275:()=>{},3975:()=>{},5934:a=>{a.exports=JSON.parse('{"version":"17.11.0"}')}},n={};function b(a){var O=n[a];if(O!==void 0)return O.exports;var A=n[a]={exports:{}};return o[a](A,A.exports,b),A.exports}return b.n=a=>{var O=a&&a.__esModule?()=>a.default:()=>a;return b.d(O,{a:O}),O},b.d=(a,O)=>{for(var A in O)b.o(O,A)&&!b.o(a,A)&&Object.defineProperty(a,A,{enumerable:!0,get:O[A]})},b.o=(a,O)=>Object.prototype.hasOwnProperty.call(a,O),b.r=a=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})},b(5107)})())})(dA);var uA=dA.exports;const R=pM(uA);var B2={},fA={},Zi={},zO={};Object.defineProperty(zO,"__esModule",{value:!0});zO.default={JSONB:{normalizedType:"string"},UUID:{normalizedType:"string"},DECIMAL:{normalizedType:"number"},NUMERIC:{normalizedType:"number"},INT:{normalizedType:"number",numberCanOnlyBeInteger:!0},INTEGER:{normalizedType:"number",numberCanOnlyBeInteger:!0},BIGINT:{normalizedType:"number",numberCanOnlyBeInteger:!0},SMALLINT:{normalizedType:"number",numberCanOnlyBeInteger:!0},DOUBLEPRECISION:{normalizedType:"number",castAs:"DOUBLE PRECISION"},"DOUBLE PRECISION":{normalizedType:"number"},REAL:{normalizedType:"number"},FLOAT:{normalizedType:"number"},NUMBER:{normalizedType:"number"},BINARY:{normalizedType:"string"},VARBINARY:{normalizedType:"string"},CHAR:{normalizedType:"string"},CHARACTER:{normalizedType:"string"},"CHARACTER VARYING":{normalizedType:"string"},TEXT:{normalizedType:"string"},VARCHAR:{normalizedType:"string"},TIME:{normalizedType:"date_time"},DATE:{normalizedType:"date_time"},TIMESTAMP_LTZ:{normalizedType:"date_time"},TIMESTAMP_NTZ:{normalizedType:"date_time"},TIMESTAMP_TZ:{normalizedType:"date_time"},TIMESTAMP:{normalizedType:"date_time"},BOOLEAN:{normalizedType:"boolean"},"TIMESTAMP WITH TIME ZONE":{normalizedType:"date_time"},"TIMESTAMP WITHOUT TIME ZONE":{normalizedType:"date_time"},ARRAY:{normalizedType:"string[]"}};var i6=O0&&O0.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Zi,"__esModule",{value:!0});Zi.NATIVE_DATA_TYPES_DATABASE=void 0;const b6=i6(zO);Zi.NATIVE_DATA_TYPES_DATABASE={microsoftSQLServer:{INT:{normalizedType:"number",numberCanOnlyBeInteger:!0},BIGINT:{normalizedType:"number",numberCanOnlyBeInteger:!0},NUMERIC:{normalizedType:"number"},BIT:{normalizedType:"number"},SMALLINT:{normalizedType:"number",numberCanOnlyBeInteger:!0},DECIMAL:{normalizedType:"number"},SMALLMONEY:{normalizedType:"number"},TINYINT:{normalizedType:"number",numberCanOnlyBeInteger:!0},MONEY:{normalizedType:"number"},FLOAT:{normalizedType:"number"},REAL:{normalizedType:"number"},DATE:{normalizedType:"date_time"},DATETIME2:{normalizedType:"date_time"},SMALLDATETIME:{normalizedType:"date_time"},DATETIME:{normalizedType:"date_time"},TIME:{normalizedType:"date_time"},UNIQUEIDENTIFIER:{normalizedType:"string"},CHAR:{normalizedType:"string"},VARCHAR:{normalizedType:"string"},TEXT:{normalizedType:"string",castAs:"VARCHAR(8000)"},NCHAR:{normalizedType:"string"},NVARCHAR:{normalizedType:"string"},NTEXT:{normalizedType:"string"},BINARY:{normalizedType:"string"},VARBINARY:{normalizedType:"string"}},bigquery:{INT64:{normalizedType:"number",numberCanOnlyBeInteger:!0},FLOAT64:{normalizedType:"number"},NUMERIC:{normalizedType:"number"},BIGNUMERIC:{normalizedType:"number"},STRING:{normalizedType:"string"},DATE:{normalizedType:"date_time"},DATETIME:{normalizedType:"date_time"},TIMESTAMP:{normalizedType:"date_time"},BOOL:{normalizedType:"boolean"},"ARRAY<STRING>":{normalizedType:"string[]"}},elasticsearch:{date_time:{normalizedType:"date_time"},number:{normalizedType:"number"},string:{normalizedType:"string"},boolean:{normalizedType:"boolean"}},mariadb:{TINYINT:{normalizedType:"number",castAs:"INT",numberCanOnlyBeInteger:!0},SMALLINT:{normalizedType:"number",castAs:"INT",numberCanOnlyBeInteger:!0},MEDIUMINT:{normalizedType:"number",castAs:"INT",numberCanOnlyBeInteger:!0},INT:{normalizedType:"number",numberCanOnlyBeInteger:!0},INTEGER:{normalizedType:"number",castAs:"INT",numberCanOnlyBeInteger:!0},BIGINT:{normalizedType:"number",castAs:"INT",numberCanOnlyBeInteger:!0},DECIMAL:{normalizedType:"number"},FLOAT:{normalizedType:"number"},DOUBLE:{normalizedType:"number"},VARCHAR:{normalizedType:"string",castAs:"CHAR"},TEXT:{normalizedType:"string",castAs:"CHAR"},TINYTEXT:{normalizedType:"string",castAs:"CHAR"},CHAR:{normalizedType:"string"},MEDIUMTEXT:{normalizedType:"string",castAs:"CHAR"},LONGTEXT:{normalizedType:"string",castAs:"CHAR"},DATE:{normalizedType:"date_time"},DATETIME:{normalizedType:"date_time"},TIMESTAMP:{normalizedType:"date_time",castAs:"DATETIME"},BOOLEAN:{normalizedType:"boolean",castAs:null},BOOL:{normalizedType:"boolean",castAs:null}},postgres:b6.default,SQLite:{BOOLEAN:{normalizedType:"boolean"},NULL:{normalizedType:"string"},INTEGER:{normalizedType:"number",numberCanOnlyBeInteger:!0},REAL:{normalizedType:"number"},DECIMAL:{normalizedType:"number"},CHAR:{normalizedType:"string"},TEXT:{normalizedType:"string"},DATE:{normalizedType:"date_time"},TIMESTAMP:{normalizedType:"date_time"}},snowflake:{FIXED:{normalizedType:"number"},DECIMAL:{normalizedType:"number"},NUMERIC:{normalizedType:"number"},INT:{normalizedType:"number",numberCanOnlyBeInteger:!0},INTEGER:{normalizedType:"number",numberCanOnlyBeInteger:!0},BIGINT:{normalizedType:"number",numberCanOnlyBeInteger:!0},SMALLINT:{normalizedType:"number",numberCanOnlyBeInteger:!0},TINYINT:{normalizedType:"number",numberCanOnlyBeInteger:!0},BYTEINT:{normalizedType:"number",numberCanOnlyBeInteger:!0},FLOAT:{normalizedType:"number"},FLOAT4:{normalizedType:"number"},FLOAT8:{normalizedType:"number"},DOUBLE:{normalizedType:"number"},DOUBLEPRECISION:{normalizedType:"number",castAs:"DOUBLE PRECISION"},"DOUBLE PRECISION":{normalizedType:"number"},REAL:{normalizedType:"number"},NUMBER:{normalizedType:"number"},BINARY:{normalizedType:"string"},VARBINARY:{normalizedType:"string"},CHAR:{normalizedType:"string"},CHARACTER:{normalizedType:"string"},"CHARACTER VARYING":{normalizedType:"string"},TEXT:{normalizedType:"string"},VARCHAR:{normalizedType:"string"},STRING:{normalizedType:"string"},TIME:{normalizedType:"date_time"},DATE:{normalizedType:"date_time"},DATETIME:{normalizedType:"date_time"},TIMESTAMP_LTZ:{normalizedType:"date_time"},TIMESTAMP_NTZ:{normalizedType:"date_time"},TIMESTAMP_TZ:{normalizedType:"date_time"},TIMESTAMP:{normalizedType:"date_time"},BOOLEAN:{normalizedType:"boolean"},ARRAY:{normalizedType:"string[]"},VARIANT:{normalizedType:"string"}},mysql:{TINYINT:{normalizedType:"number",castAs:"SIGNED",numberCanOnlyBeInteger:!0},SMALLINT:{normalizedType:"number",castAs:"SIGNED",numberCanOnlyBeInteger:!0},MEDIUMINT:{normalizedType:"number",castAs:"SIGNED",numberCanOnlyBeInteger:!0},INT:{normalizedType:"number",castAs:"SIGNED",numberCanOnlyBeInteger:!0},INTEGER:{normalizedType:"number",castAs:"SIGNED",numberCanOnlyBeInteger:!0},BIGINT:{normalizedType:"number",castAs:"SIGNED",numberCanOnlyBeInteger:!0},DECIMAL:{normalizedType:"number",castAs:"DECIMAL(65, 10)"},FLOAT:{normalizedType:"number",castAs:"DECIMAL(65, 10)"},DOUBLE:{normalizedType:"number",castAs:"DECIMAL(65, 10)"},CHAR:{normalizedType:"string",castAs:"CHAR"},VARCHAR:{normalizedType:"string",castAs:"CHAR"},TEXT:{normalizedType:"string",castAs:"CHAR"},TINYTEXT:{normalizedType:"string",castAs:"CHAR"},MEDIUMTEXT:{normalizedType:"string",castAs:"CHAR"},LONGTEXT:{normalizedType:"string",castAs:"CHAR"},DATE:{normalizedType:"date_time"},DATETIME:{normalizedType:"date_time"},TIMESTAMP:{normalizedType:"date_time",castAs:"DATETIME"},BOOLEAN:{normalizedType:"boolean"},BOOL:{normalizedType:"boolean"}},redshift:{SUPER:{normalizedType:"string[]"},UUID:{normalizedType:"string"},DECIMAL:{normalizedType:"number"},NUMERIC:{normalizedType:"number"},INT:{normalizedType:"number",numberCanOnlyBeInteger:!0},INTEGER:{normalizedType:"number",numberCanOnlyBeInteger:!0},BIGINT:{normalizedType:"number",numberCanOnlyBeInteger:!0},SMALLINT:{normalizedType:"number",numberCanOnlyBeInteger:!0},DOUBLEPRECISION:{normalizedType:"number",castAs:"DOUBLE PRECISION"},"DOUBLE PRECISION":{normalizedType:"number"},REAL:{normalizedType:"number"},FLOAT:{normalizedType:"number"},NUMBER:{normalizedType:"number"},BINARY:{normalizedType:"string"},VARBINARY:{normalizedType:"string"},CHAR:{normalizedType:"string"},CHARACTER:{normalizedType:"string"},"CHARACTER VARYING":{normalizedType:"string"},TEXT:{normalizedType:"string"},VARCHAR:{normalizedType:"string"},TIME:{normalizedType:"date_time"},DATE:{normalizedType:"date_time"},TIMESTAMP_LTZ:{normalizedType:"date_time"},TIMESTAMP_NTZ:{normalizedType:"date_time"},TIMESTAMP_TZ:{normalizedType:"date_time"},TIMESTAMP:{normalizedType:"date_time"},BOOLEAN:{normalizedType:"boolean"},"TIMESTAMP WITH TIME ZONE":{normalizedType:"date_time"},"TIMESTAMP WITHOUT TIME ZONE":{normalizedType:"date_time"},ARRAY:{normalizedType:"string[]"}}};var qA={},WA={};Object.defineProperty(WA,"__esModule",{value:!0});var hA={};Object.defineProperty(hA,"__esModule",{value:!0});var mA={};Object.defineProperty(mA,"__esModule",{value:!0});(function(t){var e=O0&&O0.__createBinding||(Object.create?function(n,b,a,O){O===void 0&&(O=a);var A=Object.getOwnPropertyDescriptor(b,a);(!A||("get"in A?!b.__esModule:A.writable||A.configurable))&&(A={enumerable:!0,get:function(){return b[a]}}),Object.defineProperty(n,O,A)}:function(n,b,a,O){O===void 0&&(O=a),n[O]=b[a]}),o=O0&&O0.__exportStar||function(n,b){for(var a in n)a!=="default"&&!Object.prototype.hasOwnProperty.call(b,a)&&e(b,n,a)};Object.defineProperty(t,"__esModule",{value:!0}),o(WA,t),o(hA,t),o(mA,t)})(qA);var wn={},DM={};Object.defineProperty(DM,"__esModule",{value:!0});class p6 extends Error{constructor(e){super(`Field with ID ${e} does not exist in the data set.`),this.name="MissingField",this.fieldId=e}}DM.default=p6;var a6=O0&&O0.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(wn,"__esModule",{value:!0});wn.findFieldById=wn.fromTable=void 0;const M6=a6(DM),z6=P0,c6=t=>{let e=(0,z6.find)(t.fields||[],n=>"address"in n);return(t.joins||[]).length==0?e.address:t.joins[0].left};wn.fromTable=c6;const s6=(t,e)=>{const o=t.fields.find(n=>n.id==e);if(!o)throw new M6.default(e);return o};wn.findFieldById=s6;var gA={},IM={};Object.defineProperty(IM,"__esModule",{value:!0});IM.upCastQuery=void 0;const cO=P0,Ji=t=>(0,cO.isArray)(t)?{type:"orWhere",value:t.map(e=>({type:"andWhere",value:e.map(o=>(o.field.type==="subquery"&&(o.field.value.filter=Ji(o.field.value.filter)),{type:"where",value:o}))}))}:t,Ca=t=>{if(t.type==="subquery"){const e=(0,cO.isArray)(t.value.filter)?Ji(t.value.filter):t.value.filter;return Object.assign(Object.assign({},t),{value:{measure:t.value.measure.map(Ca),filter:e}})}else if(t.type==="maths")return{left:Ca(t.left),right:Ca(t.right),op:t.op,type:t.type};return t},O6=t=>Object.assign(Object.assign({},t),{measure:t.measure.map(e=>Ca(e)),filter:(0,cO.isArray)(t.filter)?Ji(t.filter):t.filter}),l6=t=>{if(t.preparedQueryType==="preAggregated"){const e={};return Object.keys(t.filter).forEach(o=>{e[o]=Ji(t.filter[o])}),Object.assign(Object.assign({},t),{filter:e})}return Object.assign(Object.assign({},t),{filter:Ji(t.filter)})},A6=t=>t.type==="query"?O6(t):l6(t);IM.upCastQuery=A6;(function(t){var e=O0&&O0.__createBinding||(Object.create?function(n,b,a,O){O===void 0&&(O=a);var A=Object.getOwnPropertyDescriptor(b,a);(!A||("get"in A?!b.__esModule:A.writable||A.configurable))&&(A={enumerable:!0,get:function(){return b[a]}}),Object.defineProperty(n,O,A)}:function(n,b,a,O){O===void 0&&(O=a),n[O]=b[a]}),o=O0&&O0.__exportStar||function(n,b){for(var a in n)a!=="default"&&!Object.prototype.hasOwnProperty.call(b,a)&&e(b,n,a)};Object.defineProperty(t,"__esModule",{value:!0}),o(IM,t)})(gA);var yA={};(function(t){var e=O0&&O0.__createBinding||(Object.create?function(n,b,a,O){O===void 0&&(O=a);var A=Object.getOwnPropertyDescriptor(b,a);(!A||("get"in A?!b.__esModule:A.writable||A.configurable))&&(A={enumerable:!0,get:function(){return b[a]}}),Object.defineProperty(n,O,A)}:function(n,b,a,O){O===void 0&&(O=a),n[O]=b[a]}),o=O0&&O0.__exportStar||function(n,b){for(var a in n)a!=="default"&&!Object.prototype.hasOwnProperty.call(b,a)&&e(b,n,a)};Object.defineProperty(t,"__esModule",{value:!0}),o(DM,t)})(yA);var PM={};Object.defineProperty(PM,"__esModule",{value:!0});PM.lowestCommonGranularity=void 0;const gs=[void 0,null,"none","truncSecond","second","truncMinute","minute","truncHour","hour","truncDay","day","truncWeek","week","truncMonth","month","truncQuarter","quarter","truncYear","year"],d6=(...t)=>t.includes(void 0)||t.includes(null)||t.some(e=>!gs.includes(e))?"none":t.sort((e,o)=>{const n=gs.indexOf(e),b=gs.indexOf(o);return n===-1||b===-1?0:n-b})[0];PM.lowestCommonGranularity=d6;(function(t){var e=O0&&O0.__createBinding||(Object.create?function(A,c,y,v){v===void 0&&(v=y);var N=Object.getOwnPropertyDescriptor(c,y);(!N||("get"in N?!c.__esModule:N.writable||N.configurable))&&(N={enumerable:!0,get:function(){return c[y]}}),Object.defineProperty(A,v,N)}:function(A,c,y,v){v===void 0&&(v=y),A[v]=c[y]}),o=O0&&O0.__setModuleDefault||(Object.create?function(A,c){Object.defineProperty(A,"default",{enumerable:!0,value:c})}:function(A,c){A.default=c}),n=O0&&O0.__exportStar||function(A,c){for(var y in A)y!=="default"&&!Object.prototype.hasOwnProperty.call(c,y)&&e(c,A,y)},b=O0&&O0.__importStar||function(A){if(A&&A.__esModule)return A;var c={};if(A!=null)for(var y in A)y!=="default"&&Object.prototype.hasOwnProperty.call(A,y)&&e(c,A,y);return o(c,A),c};Object.defineProperty(t,"__esModule",{value:!0}),t.getNativeDataTypesOfNormalizedType=t.DATE_MATHS_OPERATORS=t.NORMALIZED_DATA_TYPES=t.DateFunctions=t.Errors=t.QueryLogic=t.DataSet=void 0;const a=Zi;n(Zi,t),n(qA,t),t.DataSet=b(wn),t.QueryLogic=b(gA),t.Errors=b(yA),t.DateFunctions=b(PM),t.NORMALIZED_DATA_TYPES=["number","boolean","string","date_time","string[]"],t.DATE_MATHS_OPERATORS=["seconds_between","minutes_between","hours_between","days_between"];const O=(A,c)=>Object.keys(a.NATIVE_DATA_TYPES_DATABASE[A]).filter(v=>a.NATIVE_DATA_TYPES_DATABASE[A][v].normalizedType===c);t.getNativeDataTypesOfNormalizedType=O})(fA);Object.defineProperty(B2,"__esModule",{value:!0});B2.ENVIRONMENT_VARIABLES_TO_REQUIRED=B2.vizzlyToPossibleNativeDataTypes=B2.NATIVE_DATA_TYPES=B2.SUPPORTED_CLIENTS=void 0;const u6=P0,RA=fA;B2.SUPPORTED_CLIENTS=["bigquery","mariadb","postgres","snowflake","mysql","microsoftSQLServer","redshift"];const dr=t=>(0,u6.reduce)(Object.keys(RA.NATIVE_DATA_TYPES_DATABASE[t]),(e,o)=>Object.assign(Object.assign({},e),{[o]:o}),{});B2.NATIVE_DATA_TYPES={mysql:dr("mysql"),snowflake:dr("snowflake"),postgres:dr("postgres"),redshift:dr("redshift"),mariadb:dr("mariadb"),bigquery:dr("bigquery"),microsoftSQLServer:dr("microsoftSQLServer")};const f6=(t,e)=>{let o=[];return Object.entries(RA.NATIVE_DATA_TYPES_DATABASE[t]).forEach(([n,{normalizedType:b}])=>{b==e&&(o=[...o,n])}),o};B2.vizzlyToPossibleNativeDataTypes=f6;B2.ENVIRONMENT_VARIABLES_TO_REQUIRED={postgres:{VIZZLY_POSTGRES_PASSWORD:!0,VIZZLY_POSTGRES_DATABASE:!0,VIZZLY_POSTGRES_USER:!0,VIZZLY_POSTGRES_HOST:!0,VIZZLY_POSTGRES_PORT:!1},mariadb:{VIZZLY_MARIADB_PASSWORD:!0,VIZZLY_MARIADB_DATABASE:!0,VIZZLY_MARIADB_USER:!0,VIZZLY_MARIADB_HOST:!0,VIZZLY_MARIADB_PORT:!1},mysql:{VIZZLY_MYSQL_PASSWORD:!0,VIZZLY_MYSQL_DATABASE:!0,VIZZLY_MYSQL_USER:!0,VIZZLY_MYSQL_HOST:!0,VIZZLY_MYSQL_PORT:!1},elasticsearch:{VIZZLY_ELASTICSEARCH_CLOUD_ID:!0,VIZZLY_ELASTICSEARCH_API_KEY:!0,VIZZLY_ELASTICSEARCH_NODE:!0,VIZZLY_ELASTICSEARCH_USERNAME:!0,VIZZLY_ELASTICSEARCH_PASSWORD:!0,VIZZLY_ELASTICSEARCH_API_KEY_ID:!0},bigquery:{VIZZLY_BIGQUERY_PROJECT_ID:!0,VIZZLY_BIGQUERY_REGION:!0,VIZZLY_BIGQUERY_KEY_FILENAME:!1,VIZZLY_BIGQUERY_CREDENTIALS:!1},snowflake:{VIZZLY_SNOWFLAKE_PASSWORD:!0,VIZZLY_SNOWFLAKE_DATABASE:!1,VIZZLY_SNOWFLAKE_USERNAME:!0,VIZZLY_SNOWFLAKE_ACCOUNT:!0,VIZZLY_SNOWFLAKE_WAREHOUSE:!0,VIZZLY_SNOWFLAKE_ROLE:!0,VIZZLY_SNOWFLAKE_SCHEMA:!1,VIZZLY_SNOWFLAKE_SESSION_KEEP_ALIVE:!1},microsoftSQLServer:{VIZZLY_MICROSOFT_SQL_SERVER_PASSWORD:!0,VIZZLY_MICROSOFT_SQL_SERVER_DATABASE:!0,VIZZLY_MICROSOFT_SQL_SERVER_USER:!0,VIZZLY_MICROSOFT_SQL_SERVER_HOST:!0,VIZZLY_MICROSOFT_SQL_SERVER_PORT:!1}};var FM={};Object.defineProperty(FM,"__esModule",{value:!0});FM.DataSetNotLinkedToConnection=void 0;class q6 extends Error{constructor(e){super(`Data set ${e} must be linked to a connection by setting a 'connectionId' property that references a connection in the 'connections' section.`),this.name="DataSetNotLinkedToConnection"}}FM.DataSetNotLinkedToConnection=q6;(function(t){var e=O0&&O0.__importDefault||function(L){return L&&L.__esModule?L:{default:L}};Object.defineProperty(t,"__esModule",{value:!0}),t.redshiftSchema=t.microsoftSQLServerSchema=t.snowflakeSchema=t.mySQLSchema=t.mariadbSchema=t.postgresSchema=t.bigQuerySchema=t._sqlDataSetSchema=t._fieldSchema=t.ID_REGEX_ERROR_MESSAGE=t.ALLOWED_ID_REGEX=void 0;const o=e(uA),n=Rb,b=B2,a=W1,O=$t,A=FM,c=["unencryptedCredentials","encryptedCredentials"],y=Object.keys(O.supportedOperatorsConstants),v=["rightJoin","leftJoin","innerJoin","outerJoin","leftOuterJoin","rightOuterJoin"];t.ALLOWED_ID_REGEX=/^[a-zA-Z0-9_+:\/=\-\s]*$/,t.ID_REGEX_ERROR_MESSAGE="IDs must only use alpha numeric characters and _";const N={checkConnectionSpecificDataSets:!0},s={abortEarly:!1,allowUnknown:!0},u=L=>o.default.object({id:o.default.string().required().regex(t.ALLOWED_ID_REGEX,t.ID_REGEX_ERROR_MESSAGE).description("A unique identifier for this field. It should not change unless the meaning of the field, or the data type has changed."),publicName:o.default.string().optional().allow("").description("The name of this field that you want your users to see. This can be changed as much as you like without causing a breaking change."),address:o.default.array().items(o.default.string()).optional().description('The address of the column in your database. For example; ["database_name", "table_name", "column_name"] or for BigQuery; ["bigquery project id", "bigquery data set id", "table name", "column name"]'),description:o.default.string().allow("").optional().max(110).description("A description of what the purpose of this data set is"),sql:o.default.string().optional().description("Provide a SQL definition of the field, instead of a table & name combination."),dataType:o.default.valid(...Object.values(b.NATIVE_DATA_TYPES[L])).required(),canBeDimension:o.default.boolean().optional().description("Can this field be used in groupings?"),canBeMeasure:o.default.boolean().optional().description("Can this field be used in aggregations?"),canBeUsedInSort:o.default.boolean().optional().description("__vizzly_hide_from_docs"),allowedGranularities:o.default.array().items(o.default.string().valid(...Object.keys((0,n.getQueryEngineConfig)(L).supportedTimeTruncFunctions))).optional(),allowedOperators:o.default.alternatives().conditional("..dataType",{is:o.default.string().valid(...(0,b.vizzlyToPossibleNativeDataTypes)(L,"string")),then:o.default.array().items(o.default.string().valid(...(0,a.validOperatorsForField)({dataType:"string"},(0,n.getQueryEngineConfig)(L)))).description("For fields that have a string data type.")}).conditional("..dataType",{is:o.default.string().valid(...(0,b.vizzlyToPossibleNativeDataTypes)(L,"number")),then:o.default.array().items(o.default.string().valid(...(0,a.validOperatorsForField)({dataType:"number"},(0,n.getQueryEngineConfig)(L)))).description("For fields that have a number data type.")}).conditional("..dataType",{is:o.default.string().valid(...(0,b.vizzlyToPossibleNativeDataTypes)(L,"date_time")),then:o.default.array().items(o.default.valid(...(0,a.validOperatorsForField)({dataType:"date_time"},(0,n.getQueryEngineConfig)(L)))).description("For fields that have a date time data type.")}).conditional("..dataType",{is:o.default.string().valid(...(0,b.vizzlyToPossibleNativeDataTypes)(L,"boolean")),then:o.default.array().items(o.default.string().valid(...(0,a.validOperatorsForField)({dataType:"boolean"},(0,n.getQueryEngineConfig)(L)))).description("For fields that have a boolean data type.")}).conditional("..dataType",{is:o.default.string().valid(...(0,b.vizzlyToPossibleNativeDataTypes)(L,"string[]")),then:o.default.array().items(o.default.string().valid(...(0,a.validOperatorsForField)({dataType:"string[]"},(0,n.getQueryEngineConfig)(L)))).description("For fields that have a string array data type.")}).optional()});t._fieldSchema=u;const d=o.default.object({type:o.default.string().valid(...v).required(),left:o.default.array().items(o.default.string()).required(),right:o.default.array().items(o.default.string()).required(),as:o.default.string().optional()}),z=o.default.object({fieldId:o.default.string().required(),op:o.default.string().valid(...y).required()}),M=L=>({id:o.default.string().required().regex(t.ALLOWED_ID_REGEX,t.ID_REGEX_ERROR_MESSAGE).description("A unique ID for the data set. This should not change unless the meaning of the data set represents changes."),connectionId:o.default.string().required().description("Reference the connection to use for this data set."),hide:o.default.boolean().optional().description("Hide the data set from the dashboard."),name:o.default.string().required().description("A public name for the data set. This can change as much as you like without causing a breaking change."),description:o.default.string().allow("").optional().max(110).description("A description of what this field represents"),sql:o.default.string().optional().description("Optionally define the data set using a SQL statement. If used, the `table` value for each field should equal `vizzly_data_set`."),testParameters:o.default.string().optional().description("Test parameters that are used when creating SQL backed data sets. This is a stringified JSON object."),preAggregated:o.default.alternatives(o.default.array().items(o.default.string()).description("Array of data set IDs relied on by the pre-aggregated data set"),o.default.boolean().allow(!1).description("Only `False` is a valid boolean option. For truthy values, provide an array of data set IDs")).optional().description("Optional - For pre-aggregated data sets or SQL views, provide a list of data sets that are relied upon."),fields:o.default.array().min(1).items(L).unique("id").message("Field IDs must be unique").required(),permanentFilters:o.default.object({type:o.default.valid("andWhere","orWhere","where"),value:o.default.array()}),secureFilterGuards:o.default.array().items(z).optional()}),q=L=>o.default.object(Object.assign(Object.assign({},M(L)),{joins:o.default.array().items(d).unique((T,X)=>{const C=JSON.stringify(T.right)===JSON.stringify(X.right);return!T.as&&!X.as&&C}).message("A table cannot be referenced in a right join multiple times.").optional()}));t._sqlDataSetSchema=q;const l=L=>{var T;if(((T=L.onlyClients)===null||T===void 0?void 0:T.length)===1)return(0,t._sqlDataSetSchema)((0,t._fieldSchema)(L.onlyClients[0]));const X=o.default.alternatives(...(L.onlyClients||b.SUPPORTED_CLIENTS).map(C=>(0,t._sqlDataSetSchema)((0,t._fieldSchema)(C))));if(L.dataSetIdToClientMapping){const C=Object.entries(L.dataSetIdToClientMapping).map(([m,w])=>({is:m,then:(0,t._sqlDataSetSchema)((0,t._fieldSchema)(w))}));return o.default.alternatives().conditional(".id",[...C,{is:!0,then:X}])}return X},f=(L,T)=>o.default.object({version:o.default.number(),connections:o.default.object().pattern(o.default.string(),o.default.object({client:o.default.string().allow(...b.SUPPORTED_CLIENTS).required(),name:o.default.string().optional().allow(""),encryptedCredentials:o.default.string().optional(),unencryptedCredentials:o.default.alternatives(o.default.string(),o.default.object()).optional()})),dataSets:o.default.array().items(T.checkConnectionSpecificDataSets?o.default.object().custom(X=>{var C,m;const w=X.connectionId||"___vizzly_default_conn",E=(m=(C=L?.connections)===null||C===void 0?void 0:C[w])===null||m===void 0?void 0:m.client;if(!E)throw new A.DataSetNotLinkedToConnection(X.id);const U=(0,t._sqlDataSetSchema)((0,t._fieldSchema)(E)).validate(X,s);if(U.error)throw U.error;return X},"Data sets linked to connections"):l(T)).unique("id").message("dataSet[x].id must be unique.").required(),executableDashboardConfigForPDF:o.default.string().allow(null).optional().description("JavaScript dashboard config for server-side generated PDFs"),publicKeys:o.default.array().items(o.default.string()).optional(),sqlViews:o.default.object().pattern(o.default.string(),o.default.object({name:o.default.string().required(),sql:o.default.string().allow("").required()})).optional()});t.bigQuerySchema=f({},{onlyClients:["bigquery"]}),t.postgresSchema=f({},{onlyClients:["postgres"]}),t.mariadbSchema=f({},{onlyClients:["mariadb"]}),t.mySQLSchema=f({},{onlyClients:["mysql"]}),t.snowflakeSchema=f({},{onlyClients:["snowflake"]}),t.microsoftSQLServerSchema=f({},{onlyClients:["microsoftSQLServer"]}),t.redshiftSchema=f({},{onlyClients:["redshift"]}),t.default=(L,T={})=>{const X=f(L,Object.assign(Object.assign(Object.assign({},N),T),{dataSetIdToClientMapping:g(L)})).validate(L,s);return X.error&&X.error.details.map(C=>{var m,w;c.includes(((m=C.context)===null||m===void 0?void 0:m.key)||"")&&!((w=C.context)===null||w===void 0)&&w.value&&(C.context.value="-- VIZZLY REDACTED --")}),X};const g=L=>{let T={};return L&&typeof L?.dataSets=="object"&&typeof L?.connections=="object"&&L.dataSets.forEach(X=>{var C,m;if(T){const w=X.connectionId||"___vizzly_default_conn",E=(m=(C=L?.connections)===null||C===void 0?void 0:C[w])===null||m===void 0?void 0:m.client;E&&(T[X.id]=E)}}),T}})(AA);(function(t){var e=O0&&O0.__createBinding||(Object.create?function(O,A,c,y){y===void 0&&(y=c);var v=Object.getOwnPropertyDescriptor(A,c);(!v||("get"in v?!A.__esModule:v.writable||v.configurable))&&(v={enumerable:!0,get:function(){return A[c]}}),Object.defineProperty(O,y,v)}:function(O,A,c,y){y===void 0&&(y=c),O[y]=A[c]}),o=O0&&O0.__setModuleDefault||(Object.create?function(O,A){Object.defineProperty(O,"default",{enumerable:!0,value:A})}:function(O,A){O.default=A}),n=O0&&O0.__importStar||function(O){if(O&&O.__esModule)return O;var A={};if(O!=null)for(var c in O)c!=="default"&&Object.prototype.hasOwnProperty.call(O,c)&&e(A,O,c);return o(A,O),A};Object.defineProperty(t,"__esModule",{value:!0}),t.Schemas=t.ID_REGEX_ERROR_MESSAGE=t.ALLOWED_ID_REGEX=t.validate=void 0;const b=n(AA);t.validate=b.default,Object.defineProperty(t,"ALLOWED_ID_REGEX",{enumerable:!0,get:function(){return b.ALLOWED_ID_REGEX}}),Object.defineProperty(t,"ID_REGEX_ERROR_MESSAGE",{enumerable:!0,get:function(){return b.ID_REGEX_ERROR_MESSAGE}});const a={bigQuery:b.bigQuerySchema,postgres:b.postgresSchema,mariadb:b.mariadbSchema,mySQL:b.mySQLSchema,snowflake:b.snowflakeSchema,microsoftSQLServer:b.microsoftSQLServerSchema,redshift:b.redshiftSchema};t.Schemas=a})(lA);var LA={};Object.defineProperty(LA,"__esModule",{value:!0});var vA={},kM={};Object.defineProperty(kM,"__esModule",{value:!0});kM.ianaTimeZonesDb=void 0;kM.ianaTimeZonesDb=["Africa/Abidjan","Africa/Accra","Africa/Addis_Ababa","Africa/Algiers","Africa/Asmera","Africa/Bamako","Africa/Bangui","Africa/Banjul","Africa/Bissau","Africa/Blantyre","Africa/Brazzaville","Africa/Bujumbura","Africa/Cairo","Africa/Casablanca","Africa/Ceuta","Africa/Conakry","Africa/Dakar","Africa/Dar_es_Salaam","Africa/Djibouti","Africa/Douala","Africa/El_Aaiun","Africa/Freetown","Africa/Gaborone","Africa/Harare","Africa/Johannesburg","Africa/Juba","Africa/Kampala","Africa/Khartoum","Africa/Kigali","Africa/Kinshasa","Africa/Lagos","Africa/Libreville","Africa/Lome","Africa/Luanda","Africa/Lubumbashi","Africa/Lusaka","Africa/Malabo","Africa/Maputo","Africa/Maseru","Africa/Mbabane","Africa/Mogadishu","Africa/Monrovia","Africa/Nairobi","Africa/Ndjamena","Africa/Niamey","Africa/Nouakchott","Africa/Ouagadougou","Africa/Porto-Novo","Africa/Sao_Tome","Africa/Tripoli","Africa/Tunis","Africa/Windhoek","America/Adak","America/Anchorage","America/Anguilla","America/Antigua","America/Araguaina","America/Argentina/La_Rioja","America/Argentina/Rio_Gallegos","America/Argentina/Salta","America/Argentina/San_Juan","America/Argentina/San_Luis","America/Argentina/Tucuman","America/Argentina/Ushuaia","America/Aruba","America/Asuncion","America/Bahia","America/Bahia_Banderas","America/Barbados","America/Belem","America/Belize","America/Blanc-Sablon","America/Boa_Vista","America/Bogota","America/Boise","America/Buenos_Aires","America/Cambridge_Bay","America/Campo_Grande","America/Cancun","America/Caracas","America/Catamarca","America/Cayenne","America/Cayman","America/Chicago","America/Chihuahua","America/Ciudad_Juarez","America/Coral_Harbour","America/Cordoba","America/Costa_Rica","America/Creston","America/Cuiaba","America/Curacao","America/Danmarkshavn","America/Dawson","America/Dawson_Creek","America/Denver","America/Detroit","America/Dominica","America/Edmonton","America/Eirunepe","America/El_Salvador","America/Fort_Nelson","America/Fortaleza","America/Glace_Bay","America/Godthab","America/Goose_Bay","America/Grand_Turk","America/Grenada","America/Guadeloupe","America/Guatemala","America/Guayaquil","America/Guyana","America/Halifax","America/Havana","America/Hermosillo","America/Indiana/Knox","America/Indiana/Marengo","America/Indiana/Petersburg","America/Indiana/Tell_City","America/Indiana/Vevay","America/Indiana/Vincennes","America/Indiana/Winamac","America/Indianapolis","America/Inuvik","America/Iqaluit","America/Jamaica","America/Jujuy","America/Juneau","America/Kentucky/Monticello","America/Kralendijk","America/La_Paz","America/Lima","America/Los_Angeles","America/Louisville","America/Lower_Princes","America/Maceio","America/Managua","America/Manaus","America/Marigot","America/Martinique","America/Matamoros","America/Mazatlan","America/Mendoza","America/Menominee","America/Merida","America/Metlakatla","America/Mexico_City","America/Miquelon","America/Moncton","America/Monterrey","America/Montevideo","America/Montserrat","America/Nassau","America/New_York","America/Nome","America/Noronha","America/North_Dakota/Beulah","America/North_Dakota/Center","America/North_Dakota/New_Salem","America/Ojinaga","America/Panama","America/Paramaribo","America/Phoenix","America/Port-au-Prince","America/Port_of_Spain","America/Porto_Velho","America/Puerto_Rico","America/Punta_Arenas","America/Rankin_Inlet","America/Recife","America/Regina","America/Resolute","America/Rio_Branco","America/Santarem","America/Santiago","America/Santo_Domingo","America/Sao_Paulo","America/Scoresbysund","America/Sitka","America/St_Barthelemy","America/St_Johns","America/St_Kitts","America/St_Lucia","America/St_Thomas","America/St_Vincent","America/Swift_Current","America/Tegucigalpa","America/Thule","America/Tijuana","America/Toronto","America/Tortola","America/Vancouver","America/Whitehorse","America/Winnipeg","America/Yakutat","Antarctica/Casey","Antarctica/Davis","Antarctica/DumontDUrville","Antarctica/Macquarie","Antarctica/Mawson","Antarctica/McMurdo","Antarctica/Palmer","Antarctica/Rothera","Antarctica/Syowa","Antarctica/Troll","Antarctica/Vostok","Arctic/Longyearbyen","Asia/Aden","Asia/Almaty","Asia/Amman","Asia/Anadyr","Asia/Aqtau","Asia/Aqtobe","Asia/Ashgabat","Asia/Atyrau","Asia/Baghdad","Asia/Bahrain","Asia/Baku","Asia/Bangkok","Asia/Barnaul","Asia/Beirut","Asia/Bishkek","Asia/Brunei","Asia/Calcutta","Asia/Chita","Asia/Choibalsan","Asia/Colombo","Asia/Damascus","Asia/Dhaka","Asia/Dili","Asia/Dubai","Asia/Dushanbe","Asia/Famagusta","Asia/Gaza","Asia/Hebron","Asia/Hong_Kong","Asia/Hovd","Asia/Irkutsk","Asia/Jakarta","Asia/Jayapura","Asia/Jerusalem","Asia/Kabul","Asia/Kamchatka","Asia/Karachi","Asia/Katmandu","Asia/Khandyga","Asia/Krasnoyarsk","Asia/Kuala_Lumpur","Asia/Kuching","Asia/Kuwait","Asia/Macau","Asia/Magadan","Asia/Makassar","Asia/Manila","Asia/Muscat","Asia/Nicosia","Asia/Novokuznetsk","Asia/Novosibirsk","Asia/Omsk","Asia/Oral","Asia/Phnom_Penh","Asia/Pontianak","Asia/Pyongyang","Asia/Qatar","Asia/Qostanay","Asia/Qyzylorda","Asia/Rangoon","Asia/Riyadh","Asia/Saigon","Asia/Sakhalin","Asia/Samarkand","Asia/Seoul","Asia/Shanghai","Asia/Singapore","Asia/Srednekolymsk","Asia/Taipei","Asia/Tashkent","Asia/Tbilisi","Asia/Tehran","Asia/Thimphu","Asia/Tokyo","Asia/Tomsk","Asia/Ulaanbaatar","Asia/Urumqi","Asia/Ust-Nera","Asia/Vientiane","Asia/Vladivostok","Asia/Yakutsk","Asia/Yekaterinburg","Asia/Yerevan","Atlantic/Azores","Atlantic/Bermuda","Atlantic/Canary","Atlantic/Cape_Verde","Atlantic/Faeroe","Atlantic/Madeira","Atlantic/Reykjavik","Atlantic/South_Georgia","Atlantic/St_Helena","Atlantic/Stanley","Australia/Adelaide","Australia/Brisbane","Australia/Broken_Hill","Australia/Darwin","Australia/Eucla","Australia/Hobart","Australia/Lindeman","Australia/Lord_Howe","Australia/Melbourne","Australia/Perth","Australia/Sydney","Europe/Amsterdam","Europe/Andorra","Europe/Astrakhan","Europe/Athens","Europe/Belgrade","Europe/Berlin","Europe/Bratislava","Europe/Brussels","Europe/Bucharest","Europe/Budapest","Europe/Busingen","Europe/Chisinau","Europe/Copenhagen","Europe/Dublin","Europe/Gibraltar","Europe/Guernsey","Europe/Helsinki","Europe/Isle_of_Man","Europe/Istanbul","Europe/Jersey","Europe/Kaliningrad","Europe/Kiev","Europe/Kirov","Europe/Lisbon","Europe/Ljubljana","Europe/London","Europe/Luxembourg","Europe/Madrid","Europe/Malta","Europe/Mariehamn","Europe/Minsk","Europe/Monaco","Europe/Moscow","Europe/Oslo","Europe/Paris","Europe/Podgorica","Europe/Prague","Europe/Riga","Europe/Rome","Europe/Samara","Europe/San_Marino","Europe/Sarajevo","Europe/Saratov","Europe/Simferopol","Europe/Skopje","Europe/Sofia","Europe/Stockholm","Europe/Tallinn","Europe/Tirane","Europe/Ulyanovsk","Europe/Vaduz","Europe/Vatican","Europe/Vienna","Europe/Vilnius","Europe/Volgograd","Europe/Warsaw","Europe/Zagreb","Europe/Zurich","Indian/Antananarivo","Indian/Chagos","Indian/Christmas","Indian/Cocos","Indian/Comoro","Indian/Kerguelen","Indian/Mahe","Indian/Maldives","Indian/Mauritius","Indian/Mayotte","Indian/Reunion","Pacific/Apia","Pacific/Auckland","Pacific/Bougainville","Pacific/Chatham","Pacific/Easter","Pacific/Efate","Pacific/Enderbury","Pacific/Fakaofo","Pacific/Fiji","Pacific/Funafuti","Pacific/Galapagos","Pacific/Gambier","Pacific/Guadalcanal","Pacific/Guam","Pacific/Honolulu","Pacific/Kiritimati","Pacific/Kosrae","Pacific/Kwajalein","Pacific/Majuro","Pacific/Marquesas","Pacific/Midway","Pacific/Nauru","Pacific/Niue","Pacific/Norfolk","Pacific/Noumea","Pacific/Pago_Pago","Pacific/Palau","Pacific/Pitcairn","Pacific/Ponape","Pacific/Port_Moresby","Pacific/Rarotonga","Pacific/Saipan","Pacific/Tahiti","Pacific/Tarawa","Pacific/Tongatapu","Pacific/Truk","Pacific/Wake","Pacific/Wallis"];(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ianaTimeZones=t.ETC_UTC_TIME_ZONE=void 0,t.ETC_UTC_TIME_ZONE="Etc/UTC";const e=kM,o=()=>[t.ETC_UTC_TIME_ZONE,...e.ianaTimeZonesDb];t.ianaTimeZones=o})(vA);(function(t){var e=O0&&O0.__createBinding||(Object.create?function(a,O,A,c){c===void 0&&(c=A);var y=Object.getOwnPropertyDescriptor(O,A);(!y||("get"in y?!O.__esModule:y.writable||y.configurable))&&(y={enumerable:!0,get:function(){return O[A]}}),Object.defineProperty(a,c,y)}:function(a,O,A,c){c===void 0&&(c=A),a[c]=O[A]}),o=O0&&O0.__setModuleDefault||(Object.create?function(a,O){Object.defineProperty(a,"default",{enumerable:!0,value:O})}:function(a,O){a.default=O}),n=O0&&O0.__importStar||function(a){if(a&&a.__esModule)return a;var O={};if(a!=null)for(var A in a)A!=="default"&&Object.prototype.hasOwnProperty.call(a,A)&&e(O,a,A);return o(O,a),O},b=O0&&O0.__exportStar||function(a,O){for(var A in a)A!=="default"&&!Object.prototype.hasOwnProperty.call(O,A)&&e(O,a,A)};Object.defineProperty(t,"__esModule",{value:!0}),t.VizzlyConfig=t.QueryEngineConfig=void 0,t.QueryEngineConfig=n(OA),t.VizzlyConfig=n(lA),b(LA,t),b(vA,t)})(Ut);const W6=Ut.QueryEngineConfig.Constants.timeDimensionsConstants,h6=t=>!t?.truncate||t?.truncate=="none"?t?.field:`${t.field}_${t.truncate}`,m6=(t,e)=>{const o=t.split("_"),n=o.pop();return n&&!_A(e,n)?null:{field:o.join("_"),truncate:n??""}},_A=(t,e)=>[...Object.keys(t),"none"].includes(e),NA=Ut.QueryEngineConfig.Constants.supportedOperatorsConstants,g6=(t,e)=>{let o=[...Object.keys(e.supportedOperators)];return o=o.filter(n=>y6[n].validDataTypes.includes(t.dataType)),o},y6=NA,V1=t=>t.map(e=>e.map(o=>(o.op=="is_one_of"||o.op=="is_not_one_of")&&!P0.isArray(o.value)?{...o,value:[o.value]}:o)),me=(t,e)=>t.map(o=>{let n={...o,aggregate:void 0,function:o.function||o.aggregate};return delete n.aggregate,e&&n.field==e.field&&n.function=="none"&&(n.function=e.truncate),n}),g1=t=>t.map(e=>{let o={...e,aggregate:void 0,function:e.function||e.aggregate};return delete o.aggregate,o}),R1=t=>t==="auto"||t===0||t===2?t:"auto",ut=t=>{if(!t)return{};let e={};return t.measure&&Object.entries(t.measure).forEach(([o,n])=>{e&&(e[o]=g1(n))}),{measure:P0.isEmpty(e)?void 0:e,group:t.group}},TA=Ut.QueryEngineConfig.Constants.supportedAggregatesConstants,R6=TA,L6=t=>P0.cloneDeep(R6),v6=(t,e)=>[...Object.keys(t),"none"].includes(e),_6=t=>t.charAt(0).toUpperCase()+t.slice(1),BA=(t,e,o)=>{const n=P0.replace(t,e,o);return n.indexOf(e)>=0?BA(n,e,o):n},N6=t=>_6(BA(t,"_"," ")),al=["debug","info","warning","error","properties"];let T6="error";const jM=t=>{const e=al.findIndex(n=>T6==n),o=al.findIndex(n=>t==n);return e<=o},$M=t=>t instanceof Error?t:P0.isObject(t)||P0.isArray(t)?JSON.stringify(t):t,G1=(...t)=>{jM("debug")&&console.info("[VIZZLY DEBUG]",...t.map($M))},B6=(...t)=>{jM("info")&&console.info("[VIZZLY INFO]",...t.map($M))},SA=(...t)=>{jM("warning")&&console.warn("[VIZZLY WARNING]",...t.map($M))},At=(...t)=>{jM("error")&&console.error("[VIZZLY ERROR]",...t.map($M))};Object.keys(L6());const S6=(t,e,o)=>{const n=w6(t.id);return{id:t.id,dataType:t.dataType,publicName:t.publicName||n,dashboardRequiredFilterGroups:t.dashboardRequiredFilterGroups||[],description:t.description||void 0,canBeDimension:t.canBeDimension===void 0?!0:t.canBeDimension,canBeMeasure:t.canBeMeasure===void 0?!0:t.canBeMeasure,allowedOperators:t.allowedOperators===void 0?g6(t,e):t.allowedOperators,allowedGranularities:t.allowedGranularities===void 0?Object.keys(e.supportedTimeTruncFunctions):t.allowedGranularities,supportedAggregateOptions:D6(e,t.dataType,t.supportedAggregateOptions)}},w6=t=>N6(t),x6=(t,e)=>X6(t,e)[0],X6=(t,e)=>{let o=t.supportedAggregateOptions??[],n=o.filter(b=>Object.keys(e).includes(b)&&e[b].validDataTypes.includes(t.dataType));return n.length===0?n=Object.keys(e).filter(b=>e[b].validDataTypes.includes(t.dataType)):n.sort((b,a)=>{const O=o.indexOf(b),A=o.indexOf(a);return O-A}),n},C6=t=>!t?.function||t?.function=="none"?t?.field:`${t.field}_${t.function}`,wA=(t,e)=>{const o=t.split("_"),n=o.pop();return[void 0,...Object.keys(e.supportedAggregates||{}),...Object.keys(e.supportedTimeTruncFunctions||{}),...Object.keys(e.supportedTransformationFunctions||{})].includes(n)?{field:o.join("_"),function:n??""}:{field:t,function:"none"}},E6=(t,e)=>Object.keys(e).filter(o=>e[o].validDataTypes.includes(t.dataType)),Oe=t=>t.map(e=>typeof e=="string"?{field:e,function:"none"}:e),D6=(t,e,o)=>{const n=t.supportedAggregates,b=Object.keys(n).filter(O=>n[O].validDataTypes.includes(e));o?.forEach(O=>{n.hasOwnProperty(O)||SA(`Unsupported aggregate option: ${O} on ${e}`)});let a=o&&o.length>0?o.filter(O=>b.includes(O)):b;return o&&o.length>0&&a.length===0&&(a=b),a},Vi=C6,I6=wA,P6=(t,e,o)=>{if("measure"in t&&t.measure){const n=k6(t.measure,o);if(n?.function&&n.field===e){const b=Vi(n);delete t.measure[b]}t.measure=Ml(t.measure,e)}if("group"in t&&t.group){const n=F6(t.group,o);if(n?.truncate&&n.field===e){const b=h6(n);delete t.group[b]}else t.group.hasOwnProperty(e)&&delete t.group[e];t.group=Ml(t.group,e)}return t};function F6(t,e){return Object.keys(t).map(o=>{const n=m6(o,e.supportedTimeTruncFunctions);return n?.truncate?n:null}).find(o=>o!==null)}function k6(t,e){return Object.keys(t).map(o=>{const n=I6(o,e);return n?.function?n:null}).find(o=>o!==null)}function Ml(t,e){const o={};for(const[n,b]of Object.entries(t))o[n]=b.filter(a=>a?.field!==e);return o}const Dn=(t,e)=>{let o=P0.remove(t.order,n=>P0.some(e,a=>{const O=a.function==n.function,A=a.field==n.field;return O&&A}));return{...t,order:o}},te=(t,e,o)=>{let n={...t};if("measure"in n&&P0.remove(n.measure,b=>b.field==e),"barMeasure"in n&&P0.remove(n.barMeasure,b=>b.field==e),"lineMeasure"in n&&P0.remove(n.lineMeasure,b=>b.field==e),"xMeasure"in n&&Array.isArray(n.xMeasure)&&P0.remove(n.xMeasure,b=>b.field==e),"yMeasure"in n&&n.yMeasure?.field==e&&(n.yMeasure=null),"order"in n&&P0.remove(n.order,b=>b.field==e),"dimension"in n&&P0.remove(n.dimension,b=>b.field==e),"barDimension"in n&&P0.remove(n.barDimension,b=>b.field==e),"lineDimension"in n&&P0.remove(n.lineDimension,b=>b.field==e),"filter"in n&&n.filter.forEach(b=>{P0.remove(b,a=>a.field==e)}),"parameters"in n&&n.parameters&&o){const b=P6(n.parameters,e,o);n.parameters=b}return"timeDimension"in n&&n.timeDimension?.field==e&&(n.timeDimension=null),n},wt=t=>{let e=[...t.measure];return t.dimension.forEach(o=>{e.push({field:o.field,function:o.function})}),t.timeDimension&&e.push({field:t.timeDimension.field,function:t.timeDimension.truncate}),t=Dn(t,e),t},I1=(t,e,o)=>{let n=Lm(e,t);const{value:b,error:a}=o.validate(n);if(a)throw a;return b},xA=t=>({minutes:{description:"Minutes",formatter:(e,o)=>{e.setMinutes(e.getMinutes()+o)}},hours:{description:"Hours",formatter:(e,o)=>{e.setHours(e.getHours()+o)}},days:{description:"Days",formatter:(e,o)=>{e.setDate(e.getDate()+o)}},weeks:{description:"Weeks",formatter:(e,o)=>{e.setDate(e.getDate()+o*7)}},months:{description:"Months",formatter:(e,o)=>{e.setMonth(e.getMonth()+o)}},years:{description:"Years",formatter:(e,o)=>{e.setFullYear(e.getFullYear()+o)}}}),j6=t=>({future:{description:"Future"},past:{description:"Past"}}),$6=()=>{const t=xA();return Object.keys(t)},U6=()=>{const t=j6();return Object.keys(t)},sO=R.object({unit:R.string().valid(...$6()).required(),value:R.number().integer().required(),timeFrame:R.string().valid(...U6()).required()});function G6(t){const{error:e}=sO.validate(t);return!e}const XA=(t,e)=>{const o=e?new Date(e):new Date;if(!t.value||t.unit===null)throw new Error(`Unrecognized value: ${t.value}`);let n=t.timeFrame==="future"?t.value:-t.value;return xA()[t.unit].formatter(o,n),o},V6=(t,e,o)=>{if(!o)throw new Error("appliesToFields is required");return t.map(n=>{const b=n.map(O=>({op:O.op,value:{...O.value}})),a=[];return o.forEach(O=>{O.dataSetId==e.id&&b.forEach(A=>{a.push({...A,field:O.fieldId})})}),a})},H6=()=>R.object({key:R.string().required()}),H1=()=>R.array().items(H6()).min(0),he=(t,e)=>{const o=(n,b)=>R.object({field:n.required(),function:b.required().description("Which if any, aggregate function should be applied to the field?")});return e?.restrictFields?R.alternatives(...e.restrictFields.filter(n=>n.canBeMeasure).map(n=>{const b=E6(n,t);return o(R.string().valid(n.id).description(`${n.publicName}, ${n.description||""}.`),R.string().valid(...b,"none"))})):o(R.string().description("The ID of the field from the data set to reference."),R.valid(...Object.keys(t),"none"))},uo=t=>R.object({field:R.string().required().description("The ID of the field from the data set to reference."),direction:R.string().valid("asc","desc").required().description("In which direction should the results be ordered?"),function:R.string().valid(...Object.keys(t.supportedAggregates),...Object.keys(t.supportedTimeTruncFunctions),"none").description("Which if any, function should be applied to the field?")}),In=t=>R.object({field:R.string().required().description("The ID of the field from the data set to reference."),truncate:R.valid(...Object.keys(t),"none"),bucketFill:R.boolean()}),Bt=(t,e)=>{const o=(n,b)=>R.object({field:n.required(),pivot:R.string().valid("x","y").optional(),function:b?R.valid(...Object.keys(t),"none").required():R.valid("none").required()});return e?.restrictFields?R.array().items(R.alternatives(...e.restrictFields.filter(n=>n.canBeDimension).map(n=>o(R.string().valid(n.id).description(`${n.publicName}, ${n.description||""}.`),n.dataType==="date_time")))).description("Fields to group the data by"):R.array().items(o(R.string().description("The ID of the field from the data set to reference."),!0)).description("Fields to group the data by")},Y6=(t,e=10)=>{const o=R.object({field:R.object({type:R.string().valid("field").required(),value:R.string().required().description("The ID of the field from the data set to reference."),function:R.string().valid(...Object.keys(t.supportedAggregates),...Object.keys(t.supportedTimeTruncFunctions),"none").description("Which function should be applied to the field?")}),op:R.string().valid(...Object.keys(t.supportedOperators)).required(),value:R.alternatives().try(IA,R.string().allow(null),R.number(),R.boolean(),R.array().items(R.string(),R.number(),R.allow(null)),sO).required()}),n=b=>b<=0?R.object({type:R.string().valid("where").required(),value:o.required()}):R.alternatives().try(R.object({type:R.string().valid("where").required(),value:o.required()}),R.object({type:R.string().valid("andWhere","orWhere").required(),value:R.array().items(n(b-1)).required().description("Array of nested filters")}));return n(e)},Pn=t=>R.object({field:R.string().required().description("The ID of the field from the data set to reference."),op:R.string().valid(...Object.keys(t.supportedOperators)).required(),value:R.alternatives().try(IA,R.string().allow(null),R.number(),R.boolean(),R.array().items(R.string(),R.number(),R.allow(null)),sO).required(),function:R.string().valid(...Object.keys(t.supportedAggregates),...Object.keys(t.supportedTimeTruncFunctions),"none").description("Which function should be applied to the field?")}),z2=t=>R.array().items(R.array().items(Pn(t))),Gt=()=>R.number().description("Limit the number of results returned after the query has been ran."),Y1=t=>{const e=t?.restrictDataSetIds?R.string().valid(...t.restrictDataSetIds):R.string();return{viewId:R.string().allow("").optional().description("__vizzly_hide_from_docs"),displayTitle:R.string().allow("").description("A title that explains what is being displayed."),displaySubject:R.string().allow("").description("A chance to add a more detailed description of what is being shown."),dataSetId:e.description("The ID of the data set that is being used by the view."),protectedByOrganisation:R.boolean().optional().description("Has the view been created by your organisation, and therefore cannot be modified by your users?")}},S2=R.valid("auto",2,0).description("Determine how many axis labels should be shown on the axis"),K6=(t,e)=>({measure:R.array().items(he(t.supportedAggregates,e)).required().description("A list of metrics that are to be shown. For example the `count` of a specific field in your data set."),dimension:Bt(t.supportedTimeTruncFunctions,e).required(),order:R.array().items(uo(t)),limit:Gt(),offset:R.number().min(0).description("Paginate results by using this property with limit.")}),c2=(t,e)=>({...K6(t,e),filter:R.array().items(R.array().items(Pn(t))),timeDimension:R.alternatives(In(t.supportedTimeTruncFunctions),R.valid(null)).required(),drilldown:R.alternatives(Bt(t.supportedTimeTruncFunctions,e).required(),R.string()),xAxisPrefix:R.string().allow("").description("Add a prefix to the X Axis"),yAxisPrefix:R.string().allow("").description("Add a prefix to the Y Axis"),xAxisPostfix:R.string().allow("").description("Add a postfix to the X Axis"),yAxisPostfix:R.string().allow("").description("Add a postfix to the Y Axis"),yAxisFormat:R.alternatives(R.string(),R.valid(null)).description("ID of the formatting function to apply to the Y Axis values"),xAxisFormat:R.alternatives(R.string(),R.valid(null)).description("ID of the formatting function to apply to the X Axis values"),approxYAxisLabelCount:S2,approxXAxisLabelCount:S2}),UM=R.string().valid("natural","straight","step","stepBefore","stepAfter","dotted"),Q6=R.string().valid("natural","straight","step"),OO=t=>R.array().items(R.object({function:R.string().valid(...Object.keys(t.supportedAggregates),...Object.keys(t.supportedTimeTruncFunctions),"none"),field:R.string().required().description("The ID of the field from the data set to reference.")})),CA=t=>R.array().items(R.object({function:R.string().valid(...Object.keys(t.supportedAggregates),...Object.keys(t.supportedTimeTruncFunctions),"none"),truncate:R.string(),field:R.string().required().description("The ID of the field from the data set to reference."),bucketFill:R.boolean().optional(),pivot:R.string().valid("x","y").optional()})),Z6=(t,e)=>R.object().pattern(R.string(),R.alternatives().try(R.array().items(In(t.supportedTimeTruncFunctions)).min(1),Bt(t.supportedTimeTruncFunctions,e))).unknown(!0),J6=(t,e)=>R.object().pattern(R.string(),R.array().items(he(t.supportedAggregates,e)).min(1)).unknown(!0),ft=(t,e)=>R.object({measure:J6(t,e),group:Z6(t,e)}),eg=R.alternatives().try(R.number().required(),R.string().pattern(/^\{\{.*\}\}$/).required()),tg=()=>R.object({color:R.string().required(),value:eg,strokeWidth:R.number().required(),strokeStyle:R.string().valid("dashed","solid").required(),label:R.boolean().optional()}),Vt=()=>R.array().items(tg()),EA=()=>R.object({enabled:R.boolean().required(),labels:R.object({quadrantOne:R.string().allow("").optional(),quadrantTwo:R.string().allow("").optional(),quadrantThree:R.string().allow("").optional(),quadrantFour:R.string().allow("").optional()}).required()}),X2=()=>R.object({func:R.string().valid("mean","sum","current").allow(null).optional()}),qt=()=>R.object({x:R.string().allow(""),y:R.string().allow("")}),DA=R.object().pattern(R.string(),R.object({width:R.number().min(0),height:R.number().min(0)})),IA=R.custom((t,e)=>Object.prototype.toString.call(t)==="[object Date]"?t:e.error("any.invalid"),"Date object validation"),eb=t=>R.object({filters:R.array().items(R.array().items(Pn(t)).required().max(1)).required().max(1),ruleValue:R.string().allow("").required(),ruleValueEnd:R.string().allow(""),ruleType:R.valid("backgroundColor","fontColor","lineColor","areaColor").required()}).description("A rule used to conditionally format a view."),PA=R.object({field:R.string().required().description("ID of the field in the data set to add a prefix too."),prefix:R.string().required().description("The prefix to be applied.")}),Wt=t=>R.array().items(eb(t)).description("Apply formatting based on a set of defined rules."),FA=t=>R.object({...Y1(t.attributesSchemaOptions),...c2(t.queryEngineConfig,t.attributesSchemaOptions),stacked:R.valid(!0,!1,"100%"),legend:R.valid(!0,!1),type:R.valid("areaChart").required(),lineCurve:UM,conditionalFormattingRules:Wt(t.queryEngineConfig),parameters:ft(t.queryEngineConfig,t.attributesSchemaOptions),goalLines:Vt(),axisTitles:qt(),headline:X2(),tags:H1()}),og=t=>(e,o)=>{let n=I1(e,o,FA(t));return n=wt(n),n},rg={barChart:{displayName:"Column Charts"},lineChart:{displayName:"Line Charts"},lineChartV2:{displayName:"Line Charts"},areaChart:{displayName:"Area Charts"},horizontalBarChart:{displayName:"Horizontal Bar Charts"},scatterChart:{displayName:"Scatter Charts"},pieChart:{displayName:"Pie Charts"},funnelChart:{displayName:"Funnel Charts"},sunburstChart:{displayName:"Sunburst Charts"},bubbleChart:{displayName:"Bubble Charts"},bubbleChartV2:{displayName:"Bubble Charts"},basicTable:{displayName:"Tables"},comboChart:{displayName:"Combo Charts",customMessage:"Combo Charts needs at least 1 grouping (Bar and Line), or, have time set to display correctly."},comboChartV2:{displayName:"Combo Charts",customMessage:"Combo Charts needs at least 1 grouping (Bar and Line), or, have time set to display correctly."}},ng=t=>{const e=rg[t.type];return e?.customMessage?e.customMessage:`${e?.displayName||"Charts"} need at least 1 grouping to display correctly.`},ig=t=>t.type==="comboChart"?!!(t.timeDimension||t.barDimension.length>0&&t.lineDimension.length>0):t.type==="barChart"||t.type==="lineChart"||t.type==="areaChart"||t.type==="horizontalBarChart"||t.type==="scatterChart"||t.type==="pieChart"||t.type==="funnelChart"||t.type==="sunburstChart"?!!(t.timeDimension||!t?.dimension||t?.dimension?.length!==0):!0,we=t=>ig(t)?!0:ng(t);var bg=typeof O0=="object"&&O0&&O0.Object===Object&&O0,kA=bg,pg=kA,ag=typeof ot=="object"&&ot&&ot.Object===Object&&ot,Mg=pg||ag||Function("return this")(),fo=Mg,zg=fo,cg=zg.Symbol,jA=cg,zl=jA,$A=Object.prototype,sg=$A.hasOwnProperty,Og=$A.toString,Fi=zl?zl.toStringTag:void 0;function lg(t){var e=sg.call(t,Fi),o=t[Fi];try{t[Fi]=void 0;var n=!0}catch{}var b=Og.call(t);return n&&(e?t[Fi]=o:delete t[Fi]),b}var Ag=lg,dg=Object.prototype,ug=dg.toString;function fg(t){return ug.call(t)}var qg=fg,cl=jA,Wg=Ag,hg=qg,mg="[object Null]",gg="[object Undefined]",sl=cl?cl.toStringTag:void 0;function yg(t){return t==null?t===void 0?gg:mg:sl&&sl in Object(t)?Wg(t):hg(t)}var GM=yg;function Rg(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var Lb=Rg,Lg=GM,vg=Lb,_g="[object AsyncFunction]",Ng="[object Function]",Tg="[object GeneratorFunction]",Bg="[object Proxy]";function Sg(t){if(!vg(t))return!1;var e=Lg(t);return e==Ng||e==Tg||e==_g||e==Bg}var wg=Sg,xg=fo,Xg=xg["__core-js_shared__"],Cg=Xg,ys=Cg,Ol=function(){var t=/[^.]+$/.exec(ys&&ys.keys&&ys.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Eg(t){return!!Ol&&Ol in t}var Dg=Eg,Ig=Function.prototype,Pg=Ig.toString;function Fg(t){if(t!=null){try{return Pg.call(t)}catch{}try{return t+""}catch{}}return""}var UA=Fg,kg=wg,jg=Dg,$g=Lb,Ug=UA,Gg=/[\\^$.*+?()[\]{}|]/g,Vg=/^\[object .+?Constructor\]$/,Hg=Function.prototype,Yg=Object.prototype,Kg=Hg.toString,Qg=Yg.hasOwnProperty,Zg=RegExp("^"+Kg.call(Qg).replace(Gg,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Jg(t){if(!$g(t)||jg(t))return!1;var e=kg(t)?Zg:Vg;return e.test(Ug(t))}var ey=Jg;function ty(t,e){return t?.[e]}var oy=ty,ry=ey,ny=oy;function iy(t,e){var o=ny(t,e);return ry(o)?o:void 0}var vb=iy,by=vb,py=fo,ay=by(py,"DataView"),My=ay,zy=vb,cy=fo,sy=zy(cy,"Map"),Oy=sy,ly=vb,Ay=fo,dy=ly(Ay,"Promise"),uy=dy,fy=vb,qy=fo,Wy=fy(qy,"Set"),hy=Wy,my=vb,gy=fo,yy=my(gy,"WeakMap"),Ry=yy,ks=My,js=Oy,$s=uy,Us=hy,Gs=Ry,GA=GM,Fn=UA,ll="[object Map]",Ly="[object Object]",Al="[object Promise]",dl="[object Set]",ul="[object WeakMap]",fl="[object DataView]",vy=Fn(ks),_y=Fn(js),Ny=Fn($s),Ty=Fn(Us),By=Fn(Gs),Rn=GA;(ks&&Rn(new ks(new ArrayBuffer(1)))!=fl||js&&Rn(new js)!=ll||$s&&Rn($s.resolve())!=Al||Us&&Rn(new Us)!=dl||Gs&&Rn(new Gs)!=ul)&&(Rn=function(t){var e=GA(t),o=e==Ly?t.constructor:void 0,n=o?Fn(o):"";if(n)switch(n){case vy:return fl;case _y:return ll;case Ny:return Al;case Ty:return dl;case By:return ul}return e});function Sy(t){return t!=null&&typeof t=="object"}var lO=Sy,wy=GM,xy=lO,Xy="[object Arguments]";function Cy(t){return xy(t)&&wy(t)==Xy}var Ey=Cy,ql=Ey,Dy=lO,VA=Object.prototype,Iy=VA.hasOwnProperty,Py=VA.propertyIsEnumerable;ql(function(){return arguments}());var Va={exports:{}};function Fy(){return!1}var ky=Fy;Va.exports;(function(t,e){var o=fo,n=ky,b=e&&!e.nodeType&&e,a=b&&!0&&t&&!t.nodeType&&t,O=a&&a.exports===b,A=O?o.Buffer:void 0,c=A?A.isBuffer:void 0,y=c||n;t.exports=y})(Va,Va.exports);Va.exports;var Ha={exports:{}};Ha.exports;(function(t,e){var o=kA,n=e&&!e.nodeType&&e,b=n&&!0&&t&&!t.nodeType&&t,a=b&&b.exports===n,O=a&&o.process,A=function(){try{var c=b&&b.require&&b.require("util").types;return c||O&&O.binding&&O.binding("util")}catch{}}();t.exports=A})(Ha,Ha.exports);var jy=Ha.exports,Wl=jy;Wl&&Wl.isTypedArray;class VM extends Error{constructor(e){super(e),this.name="ValidationError"}}class Ya extends VM{missingFieldId;constructor(e,o){super(`
33
33
  An expected field is missing from a dataSet.
34
34
 
35
35
  Missing '${o}'. Got;
@@ -56,9 +56,9 @@ h0.version="2.30.1";Uy(D1);h0.fn=d0;h0.min=wL;h0.max=xL;h0.now=XL;h0.utc=C2;h0.u
56
56
 
57
57
  Missing '${o}'. Got;
58
58
  ${JSON.stringify([...e].map(n=>n.id))}
59
- `),this.name="DataSetNotFound"}}const F_=t=>{let e=[];if("measure"in t&&t.measure&&(e=[...e,...t.measure]),"xMeasure"in t&&Array.isArray(t.xMeasure)&&(e=[...e,...t.xMeasure]),"yMeasure"in t&&t.yMeasure&&(e=[...e,t.yMeasure]),"zMeasure"in t&&t.zMeasure){let o=Array.isArray(t.zMeasure)?t.zMeasure:[t.zMeasure];e=[...e,...o]}return e},k_=t=>{let e=[];return"dimension"in t&&t.dimension&&(e=[...e,...t.dimension]),"lineDimension"in t&&t.lineDimension&&(e=[...e,...t.lineDimension]),"barDimension"in t&&t.barDimension&&(e=[...e,...t.barDimension]),e},Jd=t=>{let e=[];return F_(t).forEach(o=>{e=[...e,{fieldId:o.field,function:o.function,dataSetId:t.dataSetId}]}),k_(t).forEach(o=>{e=[...e,{fieldId:o.field,function:o.function,dataSetId:t.dataSetId}]}),"order"in t&&t.order&&(e=[...e,...[...t.order].map(o=>({fieldId:o.field,function:o.function,dataSetId:t.dataSetId}))]),"timeDimension"in t&&t.timeDimension&&(e=[...e,{fieldId:t.timeDimension.field,function:t.timeDimension.truncate,dataSetId:t.dataSetId}]),e},j_={allowUnknown:!0,stripUnknown:!0},K1=(t,e,o)=>{const{error:n}=ib(t.type,{queryEngineConfig:o}).schema.validate(t,j_);if(n)return[new I_(n)];const b=T2(e,t.dataSetId);if(!b)return[new P_(e,t.dataSetId)];const a=Jd(t).map(O=>O.fieldId);try{a.forEach(O=>{dt(b,O)})}catch(O){if(O instanceof Ya)return[O];throw O}return[]},k0=t=>t||`view_${$d()}`,$_=t=>t&&t.length>0?t.map(U_):t||[];function U_(t){const{parentDimension:e,...o}=t;return o}const Nr=(t,e)=>{let o=null,n=P0.cloneDeep(t);return n.forEach(b=>{const a=dt(e,b.field);a.dataType=="date_time"&&(o={field:a.id,truncate:b.function})}),n=n.filter(b=>dt(e,b.field).dataType!="date_time"),{timeDimension:o,dimension:n}},Zo=t=>{let e=[...t.dimension];return"timeDimension"in t&&t.timeDimension&&(e=[{field:t.timeDimension.field,function:t.timeDimension.truncate},...e]),e},se={title:"Area chart",description:"Displays data as areas on a chart, useful for showing trends over time.",namespace:"area_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this area chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each area to measure?",callToAction:"Add metric"},field_x_axis:{type:"fieldCollector",title:"Grouping - X Axis",description:"What do you want each area to represent? An example might be an employee ID to represent each employee.",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this area chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this area chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},rich_text:{type:"richText",title:"Text format"},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{stacked:{type:"stacked",title:"Layout",description:"",namespace:"stacked"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"},curve:{type:"curve",title:"Line Curve",description:"",namespace:"curve"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""},headline:{type:"headline",title:"Headline",description:""},goal_line:{type:"goalLine",title:"Goal Lines",description:""}}};function P(t,e){return(n=>n in t.format_panel)(e)?{...t.format_panel[e],namespace:e}:{...t.data_panel[e],namespace:e}}function kt(t,e){return t.format_panel.axis_labels?.subSectionDefinition[e]}function F1(t){return{...P(t,"heading"),subSection:[t.format_panel.heading.subSectionDefinition.title,t.format_panel.heading.subSectionDefinition.subject]}}function Ge(t){return{...P(t,"axis_labels"),y:{...kt(t,"y"),prefix:kt(t,"y.prefix"),postfix:kt(t,"y.postfix"),format:kt(t,"y.format"),count:kt(t,"y.count"),axisTitle:kt(t,"y.axis_title")},x:{...kt(t,"x"),prefix:kt(t,"x.prefix"),postfix:kt(t,"x.postfix"),format:kt(t,"x.format"),count:kt(t,"x.count"),axisTitle:kt(t,"x.axis_title")}}}function Un(t,e,o){return e?{...P(t,"chart_styles"),subSection:[t.format_panel.chart_styles?.subSectionDefinition.curve,t.format_panel.chart_styles?.subSectionDefinition.legend]}:o?{...P(t,"chart_styles"),subSection:[t.format_panel.chart_styles?.subSectionDefinition.stacked,t.format_panel.chart_styles?.subSectionDefinition.legend]}:{...P(t,"chart_styles"),subSection:[t.format_panel.chart_styles?.subSectionDefinition.legend]}}function Vo(t,e){return{...t.format_panel.stats_labels?.subSectionDefinition[e],namespace:e}}const ho=(t,e)=>{if(t?.func==="current"&&e)return t};var W0=(t=>(t.Maths="maths",t.IfStatement="ifStatement",t.Aggregates="aggregates",t))(W0||{});const eu=t=>({title:se.title,description:se.description,servicesClass:"AreaChart",namespace:se.namespace,dump:e=>e,load:e=>({type:e.type,measure:g1(e.measure),displayTitle:e.displayTitle,dimension:Oe(e.dimension),timeDimension:e.timeDimension,displaySubject:e.displaySubject,viewId:k0(e.viewId),filter:V1(e.filter),order:me(e.order,e.timeDimension),dataSetId:e.dataSetId,limit:e.limit,offset:e.offset,xAxisPostfix:e.xAxisPostfix,xAxisPrefix:e.xAxisPrefix,yAxisPostfix:e.yAxisPostfix,yAxisPrefix:e.yAxisPrefix,lineCurve:e.lineCurve,conditionalFormattingRules:St(t.queryEngineConfig,e.conditionalFormattingRules),protectedByOrganisation:e.protectedByOrganisation,stacked:e.stacked,drilldown:e.drilldown,legend:e.legend,yAxisFormat:e.yAxisFormat,xAxisFormat:e.xAxisFormat,goalLines:e.goalLines,parameters:ut(e.parameters),approxXAxisLabelCount:y1(e.approxXAxisLabelCount),approxYAxisLabelCount:y1(e.approxYAxisLabelCount),headline:ho(e.headline,e.timeDimension),tags:e.tags??[]}),setAttributes:og(t),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"areaChart",measure:[],displayTitle:"",dimension:[],timeDimension:null,displaySubject:"",viewId:k0(o?.viewId),filter:[],order:[],dataSetId:e,limit:5e3,offset:0,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,lineCurve:"natural",conditionalFormattingRules:[],drilldown:[],legend:!0,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",parameters:{},goalLines:void 0,axisTitles:void 0,headline:void 0,tags:[],...o}),createFeedback:we,schema:FA(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(e){const{measure:o,dimension:n}=le(e,t.queryEngineConfig,"areaChart");return this.init(e.id,{measure:[o[0]],dimension:n})},dataPanelConfig:()=>[P(se,"data_set"),P(se,"views"),{...P(se,"field_y_axis"),fieldFilterOptions:{forComponent:"areaChart"},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"},{...P(se,"field_x_axis"),fieldFilterOptions:{forComponent:"areaChart",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:(e,o)=>Nr(e,o),getValues:e=>Zo(e),maxAllowed:2,testId:"add-dimension"},P(se,"sort"),P(se,"filter"),P(se,"custom_metrics"),P(se,"limit")],formatPanelConfig:()=>[F1(se),{...P(se,"chart_styles"),subSection:[se.format_panel.chart_styles?.subSectionDefinition.stacked,se.format_panel.chart_styles?.subSectionDefinition.legend,se.format_panel.chart_styles?.subSectionDefinition.curve]},Ge(se),{...P(se,"conditional_formatting"),ruleType:"areaColor"},P(se,"goal_line"),P(se,"headline")],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!0,colorGradient:!1}});var cz=(t=>(t.Forecast="Forecast",t.MovingAverage="Moving Average",t.Trend="Trend",t))(cz||{});const G_=R.object({type:R.string().valid(cz.Forecast),value:R.number()}),V_=R.object({type:R.string().valid(cz.Trend),value:R.number()}),H_=R.object({value:R.number().required()}),Y_=R.object({type:R.string().valid(cz.MovingAverage),averages:R.array().items(H_).required()}),sz=()=>R.array().items(R.alternatives(G_,V_,Y_)),tu=t=>R.object({...Y1(t.attributesSchemaOptions),...c2(t.queryEngineConfig,t.attributesSchemaOptions),stacked:R.valid(!0,!1),legend:R.valid(!0,!1),labels:R.valid(!0,!1).optional(),type:R.valid("areaChartV2").required(),parameters:ft(t.queryEngineConfig,t.attributesSchemaOptions),lineCurve:Q6,conditionalFormattingRules:Wt(t.queryEngineConfig),goalLines:Vt(),axisTitles:qt(),headline:X2(),tags:H1(),trends:sz()}),K_=t=>(e,o)=>{let n=I1(e,o,tu(t));return n=wt(n),n},O2=(t,e,o)=>{let n=P0.cloneDeep(yr(e.fields,{onlyFieldTypes:["boolean","string"]})),b=P0.cloneDeep(yr(e.fields,{onlyFieldTypes:["date_time"]})),a=P0.cloneDeep(yr(e.fields,{onlyFieldTypes:["number"]})),O=null;return b[0]&&(O={field:b[0].id,truncate:"none"}),o(t,{protectedByOrganisation:!0,dimension:n.map(c=>({field:c.id,function:"none"})),measure:[...a].map(c=>({function:"none",field:c.id})),order:[],timeDimension:O})},Ze={title:"Area chart",description:"Ideal for illustrating changes and trends over time with area graphs.",namespace:"area_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this area chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each area to measure?",callToAction:"Add metric"},drilldown:{type:"drilldown",title:"Drilldown",description:"After clicking on a segment of this area chart, what information do you want to see next?"},field_x_axis:{type:"fieldCollector",title:"Grouping - X Axis",description:"What do you want each area to represent? An example might be a `product category` field to represent each category as a area.",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this area chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this area chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{stacked:{type:"stacked",title:"Layout",description:"",namespace:"stacked"},curve:{type:"curve",title:"Area Style",description:"",namespace:"curve"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"},labels:{type:"labels",title:"Show Labels",description:"",namespace:"labels"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""},headline:{type:"headline",title:"Headarea",description:""},trends:{type:"trends",title:"Trend lines",description:"Specify a trend type for the area chart."},goal_line:{type:"goalLine",title:"Goal lines",description:""}}},ou=t=>({title:"Area chart",description:"Ideal for illustrating changes and trends over time with area graphs.",servicesClass:"AreaChart",namespace:"area_chart",dump:e=>e,load:e=>({type:e.type,measure:g1(e.measure),order:me(e.order,e.timeDimension),dimension:Oe(e.dimension),displayTitle:e.displayTitle,displaySubject:e.displaySubject,protectedByOrganisation:e.protectedByOrganisation,viewId:k0(e.viewId),filter:V1(e.filter),dataSetId:e.dataSetId,limit:e.limit,timeDimension:null,xAxisPostfix:e.xAxisPostfix,xAxisPrefix:e.xAxisPrefix,yAxisPostfix:e.yAxisPostfix,yAxisPrefix:e.yAxisPrefix,yAxisFormat:e.yAxisFormat,xAxisFormat:e.xAxisFormat,lineCurve:e.lineCurve,conditionalFormattingRules:St(t.queryEngineConfig,e.conditionalFormattingRules),drilldown:e.drilldown,legend:e.legend,labels:e.labels,goalLines:e.goalLines,headline:ho(e.headline,e.timeDimension),parameters:ut(e.parameters),approxXAxisLabelCount:y1(e.approxXAxisLabelCount),approxYAxisLabelCount:y1(e.approxYAxisLabelCount),axisTitles:e.axisTitles,tags:e.tags??[],trends:e.trends??[],stacked:e.stacked}),setAttributes:K_(t),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"areaChartV2",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:k0(o?.viewId),filter:[],order:[],dataSetId:e,limit:5e3,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,lineCurve:"natural",conditionalFormattingRules:[],drilldown:[],legend:!0,labels:!1,goalLines:void 0,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",parameters:{},axisTitles:void 0,headline:void 0,tags:[],trends:[],stacked:!1,...o}),createFeedback:we,schema:tu(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),isRunnable:e=>e.measure.length>0&&e.dimension.length>0,autoGenerate(e){const{measure:o,dimension:n}=le(e,t.queryEngineConfig,"lineChart");return this.init(e.id,{measure:[o[0]],dimension:n})},dataPanelConfig:()=>[P(Ze,"data_set"),P(Ze,"views"),{...P(Ze,"field_y_axis"),fieldFilterOptions:{forComponent:"lineChart"},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"},{...P(Ze,"field_x_axis"),fieldFilterOptions:{forComponent:"lineChart",onlyDimensions:!0},preventDuplicates:!1,preSetPartialAttributes:e=>({dimension:[...e]}),getValues:e=>[...e.dimension],maxAllowed:2,testId:"add-dimension"},P(Ze,"sort"),P(Ze,"filter"),P(Ze,"custom_metrics"),P(Ze,"limit")],formatPanelConfig:()=>[F1(Ze),{...P(Ze,"chart_styles"),subSection:[Ze.format_panel.chart_styles?.subSectionDefinition.legend,Ze.format_panel.chart_styles?.subSectionDefinition.labels]},Ge(Ze),{...P(Ze,"conditional_formatting"),ruleType:"lineColor"},P(Ze,"goal_line")],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet(e,o){return O2(e,o,this.setAttributes)}});function jO(t){return R.array().items(R.object({field:R.string().required(),function:R.string().valid(...Object.keys(t.supportedAggregates),...Object.keys(t.supportedTimeTruncFunctions),"none")}))}const Gn=t=>R.object({...Y1(t.attributesSchemaOptions),...c2(t.queryEngineConfig,t.attributesSchemaOptions),stacked:R.valid(!0,!1,"100%"),legend:R.valid(!0,!1),labels:R.valid(!0,!1).optional(),type:R.valid("barChart","horizontalBarChart","funnelChart").required(),conditionalFormattingRules:Wt(t.queryEngineConfig),protectedFields:R.object({dimension:CA(t.queryEngineConfig),measure:OO(t.queryEngineConfig)}).unknown(!0),parameters:ft(t.queryEngineConfig,t.attributesSchemaOptions),goalLines:Vt(),axisTitles:qt(),headline:X2(),tags:H1(),drilldownOptions:jO(t.queryEngineConfig)}),Q_=t=>(e,o)=>{let n=I1(e,o,Gn(t));return n=wt(n),n},ve={title:"Column chart",description:"Uses bars to compare different sets of data.",namespace:"bar_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this bar chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each bar to measure?",callToAction:"Add metric"},drilldown:{type:"drilldown",title:"Drilldown",description:"After clicking on a segment of this bar chart, what information do you want to see next?"},field_x_axis:{type:"fieldCollector",title:"Grouping - X Axis",description:"What do you want each bar to represent? An example might be a `product category` field to represent each category as a bar.",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this bar chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this bar chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{stacked:{type:"stacked",title:"Layout",description:"",namespace:"stacked"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},headline:{type:"headline",title:"Headline",description:""},goal_line:{type:"goalLine",title:"Goal Lines",description:""},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""}}},ru=t=>({title:ve.title,description:ve.description,servicesClass:"BarChart",namespace:ve.namespace,dump:e=>e,load:e=>({...e,measure:g1(e.measure),order:me(e.order,e.timeDimension),filter:V1(e.filter),viewId:k0(e.viewId),dimension:Oe(e.dimension),approxXAxisLabelCount:y1(e.approxXAxisLabelCount),approxYAxisLabelCount:y1(e.approxYAxisLabelCount),parameters:ut(e.parameters),conditionalFormattingRules:St(t.queryEngineConfig,e.conditionalFormattingRules),headline:ho(e.headline,e.timeDimension),tags:e.tags??[],drilldownOptions:e.drilldownOptions}),setAttributes:Q_(t),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"barChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",viewId:k0(o?.viewId),filter:[],order:[],stacked:void 0,dataSetId:e,limit:5e3,conditionalFormattingRules:[],protectedByOrganisation:void 0,protectedFields:void 0,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,drilldown:[],legend:!0,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",parameters:{},goalLines:void 0,axisTitles:void 0,headline:void 0,tags:[],drilldownOptions:void 0,...o}),createFeedback:we,schema:Gn(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(e){const{measure:o,dimension:n}=le(e,t.queryEngineConfig,"barChart");return this.init(e.id,{measure:[o[0]],dimension:n})},dataPanelConfig:()=>[P(ve,"data_set"),P(ve,"views"),{...P(ve,"field_y_axis"),fieldFilterOptions:{forComponent:"barChart",onlyMeasures:!0},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"},{...P(ve,"field_x_axis"),fieldFilterOptions:{forComponent:"barChart",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:(e,o)=>Nr(e,o),getValues:e=>Zo(e),maxAllowed:2,testId:"add-dimension"},P(ve,"sort"),P(ve,"filter"),{...P(ve,"drilldown"),options:{property:"drilldownOptions"}},P(ve,"custom_metrics"),P(ve,"limit")],formatPanelConfig:()=>[F1(ve),Un(ve,!1,!0),Ge(ve),{...P(ve,"conditional_formatting"),ruleType:"backgroundColor"},P(ve,"goal_line"),P(ve,"headline")],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet(e,o){return O2(e,o,this.setAttributes)}}),nu=t=>R.object({...Y1(t.attributesSchemaOptions),...c2(t.queryEngineConfig,t.attributesSchemaOptions),stacked:R.valid(!0,!1,"100%"),legend:R.valid(!0,!1),labels:R.valid(!0,!1).optional(),type:R.valid("barChartV2").required(),parameters:ft(t.queryEngineConfig,t.attributesSchemaOptions),conditionalFormattingRules:Wt(t.queryEngineConfig),goalLines:Vt(),axisTitles:qt(),headline:X2(),tags:H1()}),Z_=t=>(e,o)=>{let n=I1(e,o,nu(t));return n=wt(n),n},je={title:"Bar chart",description:"Ideal for illustrating changes and trends over time with bar graphs.",namespace:"bar_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this bar chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each bar to measure?",callToAction:"Add metric"},field_x_axis:{type:"fieldCollector",title:"Grouping - X Axis",description:"What do you want each bar to represent? An example might be a `product category` field to represent each category as a bar.",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this bar chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this bar chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{stacked:{type:"stacked",title:"Layout",description:"",namespace:"stacked"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"},labels:{type:"labels",title:"Show Labels",description:"",namespace:"labels"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""},headline:{type:"headline",title:"Headline",description:""},goal_line:{type:"goalLine",title:"Goal Lines",description:""}}},iu=t=>({title:"Bar chart",description:"Ideal for illustrating changes and trends over time with bar graphs.",servicesClass:"BarChart",namespace:"bar_chart",dump:e=>e,load:e=>({type:e.type,measure:g1(e.measure),order:me(e.order,e.timeDimension),dimension:Oe(e.dimension),displayTitle:e.displayTitle,displaySubject:e.displaySubject,protectedByOrganisation:e.protectedByOrganisation,viewId:k0(e.viewId),filter:V1(e.filter),dataSetId:e.dataSetId,limit:e.limit,timeDimension:null,xAxisPostfix:e.xAxisPostfix,xAxisPrefix:e.xAxisPrefix,yAxisPostfix:e.yAxisPostfix,yAxisPrefix:e.yAxisPrefix,yAxisFormat:e.yAxisFormat,xAxisFormat:e.xAxisFormat,conditionalFormattingRules:St(t.queryEngineConfig,e.conditionalFormattingRules),legend:e.legend,labels:e.labels,goalLines:e.goalLines,headline:ho(e.headline,e.timeDimension),parameters:ut(e.parameters),approxXAxisLabelCount:y1(e.approxXAxisLabelCount),approxYAxisLabelCount:y1(e.approxYAxisLabelCount),axisTitles:e.axisTitles,tags:e.tags??[],stacked:e.stacked}),setAttributes:Z_(t),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"barChartV2",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:k0(o?.viewId),filter:[],order:[],dataSetId:e,limit:5e3,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,conditionalFormattingRules:[],legend:!0,labels:!1,goalLines:void 0,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",parameters:{},axisTitles:void 0,headline:void 0,tags:[],...o}),createFeedback:we,schema:nu(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),isRunnable:e=>e.measure.length>0&&e.dimension.length>0,autoGenerate(e){const{measure:o,dimension:n}=le(e,t.queryEngineConfig,"barChart");return this.init(e.id,{measure:[o[0]],dimension:n})},dataPanelConfig:()=>[P(je,"data_set"),P(je,"views"),{...P(je,"field_y_axis"),fieldFilterOptions:{forComponent:"barChart"},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"},{...P(je,"field_x_axis"),fieldFilterOptions:{forComponent:"barChart",onlyDimensions:!0},preventDuplicates:!1,preSetPartialAttributes:e=>({dimension:[...e]}),getValues:e=>[...e.dimension],maxAllowed:2,testId:"add-dimension"},P(je,"sort"),P(je,"filter"),P(je,"custom_metrics"),P(je,"limit")],formatPanelConfig:()=>[F1(je),{...P(je,"chart_styles"),subSection:[je.format_panel.chart_styles?.subSectionDefinition.stacked,je.format_panel.chart_styles?.subSectionDefinition.legend,je.format_panel.chart_styles?.subSectionDefinition.labels]},Ge(je),{...P(je,"conditional_formatting"),ruleType:"lineColor"},P(je,"goal_line")],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet(e,o){return O2(e,o,this.setAttributes)}}),J_=R.object({field:R.string().required(),function:R.valid("none").required()}),bu=t=>R.object({...Y1(t.attributesSchemaOptions),type:R.valid("basicTable").required(),measure:R.array().items(J_).required(),dimension:R.array().max(0),order:R.array().items(uo(t.queryEngineConfig)),timeDimension:R.valid(null),limit:Gt().required(),offset:R.number().min(0),filter:z2(t.queryEngineConfig),prefixes:R.array().items(PA),exportNames:R.object(),numberFormat:R.object(),conditionalFormattingRules:Wt(t.queryEngineConfig),dateTimeFormat:R.string(),protectedFields:R.object({measure:OO(t.queryEngineConfig)}).unknown(!0),sizing:DA,tags:H1(),hiddenFields:R.array().items(R.string())}),Ns=t=>(e,o)=>{let n=I1(e,o,bu(t));return n=Dn(n,[...n.measure]),n},Xe={title:"Basic table",description:"Displays data in a simple, straightforward table format.",namespace:"basic_table",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this basic table?"},views:{type:"views",title:"View",description:""},fields:{type:"fields",title:"Columns",description:"Select which values you want to see in this table"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this basic table."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},pagination:{type:"pagination",title:"Pagination",description:"Define the size for each page in the table"}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{type:"subject",title:"Subject",description:"",namespace:"subject"}}},format:{type:"format",title:"Format",description:"",subSectionDefinition:{time:{type:"time",title:"Time",description:"",namespace:"time"}}},prefixes:{type:"prefixes",title:"Prefixes",description:""},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""},visual_format:{type:"visualFormat",title:"Visual Format",description:"Configure how group columns are visually represented"},kpi_summarisation:{type:"kpiSummarisation",title:"",description:"Show aggregate statistics above column headers"}}},pu=[3,5,10,20,50,100,200],au=t=>({title:Xe.title,description:Xe.description,servicesClass:"BasicTable",namespace:Xe.namespace,dump:e=>e,load:e=>({...e,measure:g1(e.measure),order:me(e.order,e.timeDimension),filter:V1(e.filter),dimension:Oe(e.dimension),viewId:k0(e.viewId),conditionalFormattingRules:St(t.queryEngineConfig,e.conditionalFormattingRules),tags:e.tags??[],hiddenFields:e.hiddenFields??[]}),setAttributes:Ns(t),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:function(e,o){const n={type:"basicTable",measure:[],displayTitle:"",dimension:[],timeDimension:null,displaySubject:"",filter:[],order:[],tags:[],hiddenFields:[],dataSetId:e,viewId:k0(o?.viewId),protectedFields:void 0,limit:50,offset:0,conditionalFormattingRules:[],prefixes:[],dateTimeFormat:"DD MMMM YYYY, hh:mm",exportNames:{},numberFormat:{},sizing:{}};return Ns(t)(n,o||{})},schema:bu(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),setFields:function(e,o){const n=[...o].map(b=>({field:b,function:"none"}));return Ns(t)(e,{measure:n})},setDateTimeFormat:function(e,o){return this.setAttributes(e,{dateTimeFormat:o})},isRunnable:e=>e.measure.length>0,autoGenerate(e){const n=[...yr(e.fields,{forComponent:"basicTable",onlyMeasures:!0,removeAggregateMaths:!0,removePercentage:!0})].map(b=>({field:b.id,function:"none"}));return this.init(e.id,{measure:n.slice(0,5)})},dataPanelConfig:()=>[P(Xe,"data_set"),P(Xe,"views"),P(Xe,"fields"),P(Xe,"sort"),{...P(Xe,"pagination"),options:pu},P(Xe,"filter"),P(Xe,"custom_metrics")],formatPanelConfig:()=>[F1(Xe),{...P(Xe,"format"),subSection:[Xe.format_panel.format?.subSectionDefinition.time]},P(Xe,"prefixes"),{...P(Xe,"conditional_formatting"),ruleType:"backgroundColor"},P(Xe,"visual_format"),P(Xe,"kpi_summarisation")],supportedCustomFields:{percentages:!1,simpleMaths:!0,rules:!0,aggregateMaths:!1,roundedNumbers:!0,dateCalculations:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement]},supportedFeatures:{parameters:!1,colorGradient:!0}}),Mu=t=>R.object({...Y1(t.attributesSchemaOptions),xMeasure:he(t.queryEngineConfig.supportedAggregates,t.attributesSchemaOptions).allow(null),yMeasure:he(t.queryEngineConfig.supportedAggregates,t.attributesSchemaOptions).allow(null),zMeasure:he(t.queryEngineConfig.supportedAggregates,t.attributesSchemaOptions).allow(null),dimension:Bt(t.queryEngineConfig.supportedTimeTruncFunctions,t.attributesSchemaOptions),order:R.array().items(uo(t.queryEngineConfig)),limit:Gt(),legend:R.valid(!0,!1),offset:R.number().min(0),filter:z2(t.queryEngineConfig),type:R.valid("bubbleChart").required(),timeDimension:R.valid(null),xAxisPrefix:R.string().allow(""),yAxisPrefix:R.string().allow(""),xAxisPostfix:R.string().allow(""),yAxisPostfix:R.string().allow(""),yAxisFormat:R.alternatives(R.string(),R.valid(null)),xAxisFormat:R.alternatives(R.string(),R.valid(null)),approxYAxisLabelCount:S2,approxXAxisLabelCount:S2,goalLines:Vt(),axisTitles:qt(),tags:H1()}),eN=t=>(e,o)=>{let n=I1(e,o,Mu(t)),b=[];return n.xMeasure&&b.push(n.xMeasure),n.yMeasure&&b.push(n.yMeasure),n.zMeasure&&b.push(n.zMeasure),n.dimension.forEach(a=>{b.push({field:a.field,function:a.function})}),n=Dn(n,b),n},_e={title:"Bubble chart",description:"Displays data points on a Cartesian plane, with a third metric corresponding to bubble size.",namespace:"bubble_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this bubble chart?"},views:{type:"views",title:"View",description:""},labelled_metrics:{type:"labelledMetrics",title:"Metric - Y Axis",description:"",subSectionDefinition:{xAxis:{type:"metrics",title:"X axis",namespace:"metrics.xAxis"},yAxis:{type:"metrics",title:"Y axis",namespace:"metrics.yAxis"},zAxis:{type:"metrics",title:"Metric - Bubble Size",namespace:"metrics.zAxis"}}},field_grouping:{type:"fieldCollector",title:"Grouping",description:"What do you want each bubble to represent?",callToAction:"Add comparison"},filter:{type:"filter",title:"Filters",description:"Only include the information you want in this bubble chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Limit the number of data points shown on this bubble chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"},z:{title:"Metric - Bubble Size",description:"",namespace:"z"},"z.prefix":{title:"Prefix",description:"",namespace:"z.prefix"},"z.postfix":{title:"Postfix",description:"",namespace:"z.postfix"},"z.format":{title:"Format",description:"",namespace:"z.format"},"z.count":{title:"Label count",description:"",namespace:"z.count"},"z.axis_title":{title:"Title",description:"",namespace:"z.axis_title"}}},goal_line:{type:"goalLine",title:"Goal Lines",description:""}}},zu=t=>({title:_e.title,description:_e.description,servicesClass:"BubbleChart",namespace:_e.namespace,dump:e=>e,load:e=>({type:e.type,xMeasure:g1(e.xMeasure?[e.xMeasure]:[])[0]||null,yMeasure:g1(e.yMeasure?[e.yMeasure]:[])[0]||null,zMeasure:g1(e.zMeasure?[e.zMeasure]:[])[0]||null,dimension:Oe(e.dimension),viewId:k0(e.viewId),timeDimension:e.timeDimension,displayTitle:e.displayTitle,displaySubject:e.displaySubject,protectedByOrganisation:e.protectedByOrganisation,filter:V1(e.filter),order:me(e.order,e.timeDimension),dataSetId:e.dataSetId,limit:e.limit,legend:e.legend,xAxisFormat:e.xAxisFormat,yAxisFormat:e.yAxisFormat,yAxisPostfix:e.yAxisPostfix,yAxisPrefix:e.yAxisPrefix,xAxisPostfix:e.xAxisPostfix,xAxisPrefix:e.xAxisPrefix,approxXAxisLabelCount:y1(e.approxXAxisLabelCount),approxYAxisLabelCount:y1(e.approxYAxisLabelCount),goalLines:e.goalLines,axisTitles:e.axisTitles,tags:e.tags??[]}),setAttributes:eN(t),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"bubbleChart",xMeasure:null,yMeasure:null,zMeasure:null,dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:k0(o?.viewId),filter:[],order:[],dataSetId:e,limit:5e3,legend:!0,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",goalLines:void 0,axisTitles:void 0,tags:[],...o}),createFeedback:we,schema:Mu(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),isRunnable:e=>!!e.xMeasure&&!!e.yMeasure&&!!e.zMeasure&&e.dimension.length>0,autoGenerate(e){const{measure:o,dimension:n}=le(e,t.queryEngineConfig,"bubbleChart");return this.init(e.id,{xMeasure:o[0],yMeasure:o[1],dimension:n})},dataPanelConfig:()=>[P(_e,"data_set"),P(_e,"views"),{...P(_e,"labelled_metrics"),subSection:[{..._e.data_panel.labelled_metrics?.subSectionDefinition.xAxis,propKey:"xMeasure",allowsMultiple:!1},{..._e.data_panel.labelled_metrics?.subSectionDefinition.yAxis,propKey:"yMeasure",allowsMultiple:!1},{..._e.data_panel.labelled_metrics?.subSectionDefinition.zAxis,propKey:"zMeasure",allowsMultiple:!1}]},{...P(_e,"field_grouping"),fieldFilterOptions:{onlyDimensions:!0,onlyFieldTypes:["boolean","number","string"],removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},maxAllowed:1,preSetPartialAttributes:e=>({dimension:e}),getValues:e=>e.dimension,testId:"add-dimension"},P(_e,"filter"),P(_e,"custom_metrics"),P(_e,"limit")],formatPanelConfig:()=>[F1(_e),{...P(_e,"chart_styles"),subSection:[_e.format_panel.chart_styles?.subSectionDefinition.legend]},Ge(_e),P(_e,"goal_line")],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!1,colorGradient:!1}}),cu=t=>R.object({...Y1(t.attributesSchemaOptions),...c2(t.queryEngineConfig,t.attributesSchemaOptions),zMeasure:R.array().items(he(t.queryEngineConfig.supportedAggregates,t.attributesSchemaOptions)).required().description("A list of metrics that are to be shown. For example the `count` of a specific field in your data set."),xMeasure:R.array().items(he(t.queryEngineConfig.supportedAggregates,t.attributesSchemaOptions)).required().description("A list of metrics that are to be shown. For example the `count` of a specific field in your data set."),stacked:R.valid(!0,!1,"100%"),legend:R.valid(!0,!1),type:R.valid("bubbleChartV2").required(),parameters:ft(t.queryEngineConfig,t.attributesSchemaOptions),lineCurve:UM,quadrants:EA(),conditionalFormattingRules:Wt(t.queryEngineConfig),goalLines:Vt(),axisTitles:qt(),headline:X2(),tags:H1(),trends:sz()}),tN=t=>(e,o)=>{let n=I1(e,o,cu(t));return n=wt(n),n},Ce={title:"Bubble chart",description:"Displays data points on a Cartesian plane, with a third metric corresponding to bubble size.",namespace:"bubble_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this bubble chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each bubble to measure?",callToAction:"Add metric"},drilldown:{type:"drilldown",title:"Drilldown",description:"After clicking on a segment of this line chart, what information do you want to see next?"},field_x_axis:{type:"fieldCollector",title:"Metric - X Axis",description:"What do you want each line to represent? An example might be a `product category` field to represent each category as a line.",callToAction:"Add metric"},field_z_axis:{type:"fieldCollector",title:"Metric - Bubble Size",description:"What do you want each bubble to represent? An example might be a `product category` field to represent each category as a bubble.",callToAction:"Add metric"},field_grouping:{type:"fieldCollector",title:"Grouping - Bubble series",description:"How do you want to group each bubble?",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this bubble chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this bubble chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{curve:{type:"curve",title:"Line Style",description:"",namespace:"curve"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},quadrants:{type:"quadrants",title:"",description:""},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""},headline:{type:"headline",title:"Headline",description:""},trends:{type:"trends",title:"Trend lines",description:"Specify a trend type for the line chart."},goal_line:{type:"goalLine",title:"Goal Lines",description:""}}},su=t=>({title:"Bubble chart",description:Ce.description,servicesClass:"BubbleChartV2",namespace:"bubble_chart",dump:e=>e,load:e=>({type:e.type,measure:g1(e.measure),zMeasure:g1(e.measure),xMeasure:g1(e.xMeasure),order:me(e.order,e.timeDimension),dimension:Oe(e.dimension),displayTitle:e.displayTitle,displaySubject:e.displaySubject,protectedByOrganisation:e.protectedByOrganisation,viewId:k0(e.viewId),filter:V1(e.filter),dataSetId:e.dataSetId,limit:e.limit,timeDimension:null,xAxisPostfix:e.xAxisPostfix,xAxisPrefix:e.xAxisPrefix,yAxisPostfix:e.yAxisPostfix,yAxisPrefix:e.yAxisPrefix,yAxisFormat:e.yAxisFormat,xAxisFormat:e.xAxisFormat,lineCurve:e.lineCurve,quadrants:e.quadrants,conditionalFormattingRules:St(t.queryEngineConfig,e.conditionalFormattingRules),drilldown:e.drilldown,legend:e.legend,goalLines:e.goalLines,headline:ho(e.headline,e.timeDimension),parameters:ut(e.parameters),approxXAxisLabelCount:y1(e.approxXAxisLabelCount),approxYAxisLabelCount:y1(e.approxYAxisLabelCount),axisTitles:e.axisTitles,tags:e.tags??[],trends:e.trends??[]}),setAttributes:tN(t),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"bubbleChartV2",measure:[],zMeasure:[],xMeasure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:k0(o?.viewId),filter:[],order:[],dataSetId:e,limit:5e3,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,lineCurve:"natural",quadrants:void 0,conditionalFormattingRules:[],drilldown:[],legend:!0,goalLines:void 0,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",parameters:{},axisTitles:void 0,headline:void 0,tags:[],trends:[],...o}),createFeedback:we,schema:cu(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),isRunnable:e=>e.measure.length>0&&e.dimension.length>0&&e.xMeasure.length>0&&e.zMeasure.length>0,autoGenerate(e){const{measure:o,dimension:n}=le(e,t.queryEngineConfig,"bubbleChartV2");return this.init(e.id,{measure:[o[0]],dimension:n,zMeasure:[o[0]],xMeasure:[o[0]]})},dataPanelConfig:()=>[P(Ce,"data_set"),P(Ce,"views"),{...P(Ce,"field_y_axis"),fieldFilterOptions:{forComponent:"bubbleChartV2"},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,maxAllowed:1,testId:"metric-input",propKey:"yMeasure"},{...P(Ce,"field_x_axis"),fieldFilterOptions:{forComponent:"bubbleChartV2",onlyMeasures:!0,onlyDimensions:!1},preSetPartialAttributes:e=>({xMeasure:[...e]}),getValues:e=>[...e.xMeasure],maxAllowed:1,testId:"x-metric-axis"},{...P(Ce,"field_z_axis"),fieldFilterOptions:{forComponent:"bubbleChartV2"},preSetPartialAttributes:e=>({zMeasure:[...e]}),getValues:e=>e.zMeasure,testId:"metric-input-z",maxAllowed:1,propKey:"zMeasure"},{...P(Ce,"field_grouping"),fieldFilterOptions:{forComponent:"bubbleChartV2",onlyDimensions:!0},preSetPartialAttributes:e=>({dimension:[...e]}),getValues:e=>[...e.dimension],maxAllowed:1,testId:"bubble-dimension"},P(Ce,"sort"),P(Ce,"filter"),P(Ce,"custom_metrics"),P(Ce,"limit")],formatPanelConfig:()=>[F1(Ce),Un(Ce,!0,!1),Ge(Ce),P(Ce,"quadrants"),{...P(Ce,"conditional_formatting"),ruleType:"lineColor"},P(Ce,"goal_line")],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet(e,o){return O2(e,o,this.setAttributes)}}),Ou=t=>R.object({...Y1(t.attributesSchemaOptions),stacked:R.valid(!0,!1,"100%"),legend:R.valid(!0,!1),barMeasure:R.array().items(he(t.queryEngineConfig.supportedAggregates,t.attributesSchemaOptions)),lineMeasure:R.array().items(he(t.queryEngineConfig.supportedAggregates,t.attributesSchemaOptions)),barDimension:Bt(t.queryEngineConfig.supportedTimeTruncFunctions,t.attributesSchemaOptions),lineDimension:Bt(t.queryEngineConfig.supportedTimeTruncFunctions,t.attributesSchemaOptions),order:R.array().items(uo(t.queryEngineConfig)),timeDimension:R.alternatives(In(t.queryEngineConfig.supportedTimeTruncFunctions),R.valid(null)),limit:Gt(),offset:R.number().min(0),filter:z2(t.queryEngineConfig),type:R.valid("comboChart").required(),xAxisPrefix:R.string().allow(""),yAxisPrefix:R.string().allow(""),xAxisPostfix:R.string().allow(""),yAxisPostfix:R.string().allow(""),yAxisFormat:R.alternatives(R.string(),R.valid(null)),xAxisFormat:R.alternatives(R.string(),R.valid(null)),approxYAxisLabelCount:S2,approxXAxisLabelCount:S2,goalLines:Vt(),conditionalFormattingRules:R.object({bar:R.array().items(eb(t.queryEngineConfig)),line:R.array().items(eb(t.queryEngineConfig))}),axisTitles:qt(),tags:H1()}),oN=t=>(e,o)=>{let n=I1(e,o,Ou(t)),b=[...n.lineMeasure,...n.barMeasure];return[...n.lineDimension,...n.barDimension].forEach(a=>{b.push({field:a.field,function:a.function})}),n.timeDimension&&b.push({field:n.timeDimension.field,function:n.timeDimension.truncate}),n=Dn(n,b),n};function lu(t,e){return{...t,lineMeasure:g1(t.lineMeasure),barMeasure:g1(t.barMeasure),order:me(t.order,t.timeDimension||null),filter:V1(t.filter),lineDimension:Oe(t.lineDimension||t.dimension||[]),barDimension:Oe(t.barDimension||t.dimension||[]),viewId:k0(t.viewId),approxXAxisLabelCount:y1(t.approxXAxisLabelCount),approxYAxisLabelCount:y1(t.approxYAxisLabelCount),conditionalFormattingRules:{bar:St(e,t.conditionalFormattingRules?.bar),line:St(e,t.conditionalFormattingRules?.line)},tags:t.tags??[]}}const ee={title:"Combo chart",description:"A versatile component that combines different chart types.",namespace:"combo_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this combo chart?"},views:{type:"views",title:"View",description:""},labelled_metrics:{type:"labelledMetrics",title:"Metric - Y Axis",description:"What do you want each line and bar to measure?",subSectionDefinition:{line:{type:"metrics",title:"Line",namespace:"metrics.line"},bar:{type:"metrics",title:"Bar",namespace:"metrics.bar"}}},combo_chart_dimension:{type:"comboChartDimension",title:"Grouping - X Axis",description:""},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this combo chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this bar chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{stacked:{type:"stacked",title:"Layout",description:"",namespace:"stacked"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},goal_line:{type:"goalLine",title:"Goal Lines",description:""},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:"",subSectionDefinition:{bar:{title:"Bar",namespace:"bar"},line:{title:"Line",namespace:"line"}}}}},Au=t=>({title:ee.title,description:ee.description,servicesClass:"ComboChart",namespace:ee.namespace,dump:e=>e,load:e=>lu(e,t.queryEngineConfig),setAttributes:oN(t),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"comboChart",barMeasure:[],lineMeasure:[],lineDimension:[],barDimension:[],timeDimension:null,displayTitle:"",displaySubject:"",viewId:k0(o?.viewId),filter:[],order:[],dataSetId:e,limit:5e3,xAxisPostfix:"",protectedByOrganisation:void 0,xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,legend:!0,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",goalLines:void 0,conditionalFormattingRules:void 0,axisTitles:void 0,tags:[],...o}),createFeedback:we,schema:Ou(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),isRunnable:e=>e.lineMeasure.length>0||e.barMeasure.length>0,autoGenerate(e){const{measure:o,dimension:n}=le(e,t.queryEngineConfig,"comboChart");return this.init(e.id,{barMeasure:[o[0]],lineMeasure:[o[1]||o[0]],barDimension:n,lineDimension:n})},dataPanelConfig:()=>[P(ee,"data_set"),P(ee,"views"),{...P(ee,"labelled_metrics"),subSection:[{...ee.data_panel.labelled_metrics?.subSectionDefinition.line,propKey:"lineMeasure",allowsMultiple:!0},{...ee.data_panel.labelled_metrics?.subSectionDefinition.bar,propKey:"barMeasure",allowsMultiple:!0}]},P(ee,"combo_chart_dimension"),P(ee,"sort"),P(ee,"filter"),P(ee,"custom_metrics"),P(ee,"limit")],formatPanelConfig:()=>[F1(ee),Un(ee,!1,!0),Ge(ee),{...P(ee,"conditional_formatting"),ruleType:"backgroundColor",subSection:[{title:ee.format_panel.conditional_formatting?.subSectionDefinition?.bar.title??"",namespace:ee.format_panel.conditional_formatting?.subSectionDefinition?.bar.namespace,propKey:"bar"},{title:ee.format_panel.conditional_formatting?.subSectionDefinition?.line.title??"",namespace:ee.format_panel.conditional_formatting?.subSectionDefinition?.line.namespace,propKey:"line"}]},P(ee,"goal_line")],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!1,colorGradient:!1}}),du=t=>R.object({...Y1(t.attributesSchemaOptions),stacked:R.valid(!0,!1),legend:R.valid(!0,!1),labels:R.valid(!0,!1).optional(),barMeasure:R.array().items(he(t.queryEngineConfig.supportedAggregates,t.attributesSchemaOptions)),lineMeasure:R.array().items(he(t.queryEngineConfig.supportedAggregates,t.attributesSchemaOptions)),barDimension:Bt(t.queryEngineConfig.supportedTimeTruncFunctions,t.attributesSchemaOptions),lineDimension:Bt(t.queryEngineConfig.supportedTimeTruncFunctions,t.attributesSchemaOptions),order:R.array().items(uo(t.queryEngineConfig)),timeDimension:R.alternatives(In(t.queryEngineConfig.supportedTimeTruncFunctions),R.valid(null)),limit:Gt(),offset:R.number().min(0),filter:z2(t.queryEngineConfig),type:R.valid("comboChartV2").required(),xAxisPrefix:R.string().allow(""),yAxisPrefix:R.string().allow(""),xAxisPostfix:R.string().allow(""),yAxisPostfix:R.string().allow(""),yAxisFormat:R.alternatives(R.string(),R.valid(null)),xAxisFormat:R.alternatives(R.string(),R.valid(null)),approxYAxisLabelCount:S2,approxXAxisLabelCount:S2,goalLines:Vt(),conditionalFormattingRules:R.object({bar:R.array().items(eb(t.queryEngineConfig)),line:R.array().items(eb(t.queryEngineConfig))}),axisTitles:qt(),tags:H1()}),rN=t=>(e,o)=>{let n=I1(e,o,du(t)),b=[...n.lineMeasure,...n.barMeasure];return[...n.lineDimension,...n.barDimension].forEach(a=>{b.push({field:a.field,function:a.function})}),n.timeDimension&&b.push({field:n.timeDimension.field,function:n.timeDimension.truncate}),n=Dn(n,b),n},X1={title:"Combo chart",description:"A versatile component that combines different chart types.",namespace:"combo_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this combo chart?"},views:{type:"views",title:"View",description:""},labelled_metrics:{type:"labelledMetrics",title:"Metric - Y Axis",description:"What do you want each line and bar to measure?",subSectionDefinition:{line:{type:"metrics",title:"Line",namespace:"metrics.line"},bar:{type:"metrics",title:"Bar",namespace:"metrics.bar"}}},combo_chart_dimension:{type:"comboChartDimension",title:"Grouping - X Axis",description:""},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this combo chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this bar chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{stacked:{type:"stacked",title:"Layout",description:"",namespace:"stacked"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"},labels:{type:"labels",title:"Show Labels",description:"",namespace:"labels"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},goal_line:{type:"goalLine",title:"Goal Lines",description:""},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:"",subSectionDefinition:{bar:{title:"Bar",namespace:"bar"},line:{title:"Line",namespace:"line"}}}}},uu=t=>({title:X1.title,description:X1.description,servicesClass:"ComboChartV2",namespace:X1.namespace,dump:e=>e,load:e=>lu(e,t.queryEngineConfig),setAttributes:rN(t),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"comboChartV2",barMeasure:[],lineMeasure:[],lineDimension:[],barDimension:[],timeDimension:null,displayTitle:"",displaySubject:"",viewId:k0(o?.viewId),filter:[],order:[],dataSetId:e,limit:5e3,xAxisPostfix:"",protectedByOrganisation:void 0,xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,legend:!0,labels:!1,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",goalLines:void 0,conditionalFormattingRules:void 0,axisTitles:void 0,tags:[],...o}),createFeedback:we,schema:du(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),isRunnable:e=>e.lineMeasure.length>0||e.barMeasure.length>0,autoGenerate(e){const{measure:o,dimension:n}=le(e,t.queryEngineConfig,"comboChart");return this.init(e.id,{barMeasure:[o[0]],lineMeasure:[o[1]||o[0]],barDimension:n,lineDimension:n})},dataPanelConfig:()=>[P(X1,"data_set"),P(X1,"views"),{...P(X1,"labelled_metrics"),subSection:[{...X1.data_panel.labelled_metrics?.subSectionDefinition.line,propKey:"lineMeasure",allowsMultiple:!0},{...X1.data_panel.labelled_metrics?.subSectionDefinition.bar,propKey:"barMeasure",allowsMultiple:!0}]},P(X1,"combo_chart_dimension"),P(X1,"sort"),P(X1,"filter"),P(X1,"custom_metrics"),P(X1,"limit")],formatPanelConfig:()=>[F1(X1),{...P(X1,"chart_styles"),subSection:[X1.format_panel.chart_styles?.subSectionDefinition.stacked,X1.format_panel.chart_styles?.subSectionDefinition.legend,X1.format_panel.chart_styles?.subSectionDefinition.labels]},Ge(X1),{...P(X1,"conditional_formatting"),ruleType:"backgroundColor",subSection:[{title:X1.format_panel.conditional_formatting?.subSectionDefinition?.bar.title??"",namespace:X1.format_panel.conditional_formatting?.subSectionDefinition?.bar.namespace,propKey:"bar"},{title:X1.format_panel.conditional_formatting?.subSectionDefinition?.line.title??"",namespace:X1.format_panel.conditional_formatting?.subSectionDefinition?.line.namespace,propKey:"line"}]},P(X1,"goal_line")],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!1,colorGradient:!1}}),wl=t=>R.object({...Y1(t.attributesSchemaOptions),type:R.valid("custom").required(),customViewId:R.string().required(),tags:H1()}),vn={title:"Progress",description:"Used to show progress towards goals, completion of tasks, or as indicators of performance metrics.",namespace:"progress",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this progress?"},views:{type:"views",title:"View",description:""}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}}}},fu=t=>({title:vn.title,description:vn.description,namespace:vn.namespace,servicesClass:"Custom",dump:e=>e,load:e=>({type:"custom",viewId:k0(e.viewId),customViewId:e.customViewId,displayTitle:e.displayTitle,displaySubject:e.displaySubject,dataSetId:e.dataSetId,tags:e.tags??[],protectedByOrganisation:e.protectedByOrganisation}),setAttributes:(e,o)=>I1(e,o,wl(t)),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"custom",viewId:k0(o?.viewId),customViewId:o?.customViewId||"",dataSetId:e,displaySubject:"",displayTitle:"",tags:[],protectedByOrganisation:void 0}),schema:wl(t),removeField(e,o){return e},isRunnable:()=>!0,autoGenerate(e){return this.init(e.id)},dataPanelConfig:()=>[P(vn,"data_set"),P(vn,"views")],formatPanelConfig:()=>[F1(vn)],supportedCustomFields:{percentages:!1,simpleMaths:!1,rules:!1,aggregateMaths:!1,roundedNumbers:!1,dateCalculations:!1,conditional:!1,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{colorGradient:!1,parameters:!1}}),qu=t=>R.object({...Y1(t.attributesSchemaOptions),type:R.valid("dataTable").required(),measure:R.array().items(he(t.queryEngineConfig.supportedAggregates,t.attributesSchemaOptions)).required(),dimension:Bt(t.queryEngineConfig.supportedTimeTruncFunctions,t.attributesSchemaOptions).required(),order:R.array().items(uo(t.queryEngineConfig)),timeDimension:R.alternatives(In(t.queryEngineConfig.supportedTimeTruncFunctions),R.valid(null)),limit:Gt().required(),offset:R.number().min(0),filter:z2(t.queryEngineConfig),prefixes:R.array().items(PA),exportNames:R.object(),numberFormat:R.object(),conditionalFormattingRules:Wt(t.queryEngineConfig),dateTimeFormat:R.string(),protectedFields:R.object({dimension:CA(t.queryEngineConfig),measure:OO(t.queryEngineConfig)}).unknown(!0),sizing:DA,tags:H1(),hiddenFields:R.array().items(R.string()),tableDrilldown:R.array().items(R.object({subsetDimension:R.string().required().description("The ID of the field in the data set to drill down by.")})).description("Drilldown configuration for a pivot table."),summarizeKPIs:R.boolean().default(!1).description("Enable/disable KPI summarisation above column headers."),visualFormatColumns:R.array().items(R.string().min(1)).default([]).sparse(!1).description("Array of column names to display as horizontal bars."),results:R.array().items(R.object({content:R.array().required(),fields:R.array().items(R.object({id:R.string().required(),publicName:R.string().required(),dataType:R.string().required(),hidden:R.boolean(),fieldId:R.string().required(),function:R.string().required(),outputDataType:R.string().required()}).unknown(!0)).required(),hasMoreResults:R.alternatives([R.boolean(),R.valid(null)])}).unknown(!0)).description("Query results data structure containing fields and content.")}),nN=t=>(e,o)=>{let n=I1(e,o,qu(t));const b=e.dimension.filter(c=>c.pivot==="y").length,a=o.dimension?.filter(c=>c.pivot==="y").length;return(a===void 0?!1:b!==a)&&!o.visualFormatColumns&&(n.visualFormatColumns=[]),n=wt(n),n},ue={title:"Pivot table",description:"Transforms data into a table with dynamic rows and columns.",namespace:"pivot_table",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this data table?"},views:{type:"views",title:"View",description:""},field_columns:{type:"fieldCollector",title:"Group columns",callToAction:"Add group column",description:""},field_rows:{type:"fieldCollector",title:"Group rows",description:"Which field do you want to group each row by? An example might be an employee ID or geographical location",callToAction:"Add group row"},drilldown:{type:"drilldown",title:"Drilldown",description:"Drilldowns in a pivot table reveals underlying data contributing to summarized figures upon clicking."},field_metrics:{type:"fieldCollector",title:"Metrics",description:"Select the columns to show in the data table",callToAction:"Add metric"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this data table."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},pagination:{type:"pagination",title:"Pagination",description:"Define the size for each page in the table"}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},kpi_summarisation:{type:"kpiSummarisation",title:"",description:"Show aggregate statistics above each column."},visual_format:{type:"visualFormat",title:"Visual Format",description:"Configure how the group column is displayed visually."},format:{type:"format",title:"Format",description:"",subSectionDefinition:{time:{type:"time",title:"Time",description:"",namespace:"time"}}},prefixes:{type:"prefixes",title:"Prefixes",description:""},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""}}},wa=(t,e)=>t.filter(o=>o.pivot==e),iN=t=>t.map(e=>({...e,pivot:e.pivot?e.pivot:"x"})),Wu=t=>({title:ue.title,description:ue.description,servicesClass:"PivotTable",namespace:ue.namespace,dump:e=>e,load:e=>({type:e.type,measure:g1(e.measure),order:me(e.order,e.timeDimension||null),displayTitle:e.displayTitle,dimension:iN(Zo({timeDimension:e.timeDimension,dimension:Oe(e.dimension)})),displaySubject:e.displaySubject,protectedByOrganisation:e.protectedByOrganisation,protectedFields:e.protectedFields,viewId:k0(e.viewId),filter:V1(e.filter),dataSetId:e.dataSetId,limit:e.limit,offset:e.offset,conditionalFormattingRules:St(t.queryEngineConfig,e.conditionalFormattingRules),dateTimeFormat:e.dateTimeFormat,prefixes:e.prefixes,exportNames:e.exportNames,numberFormat:e.numberFormat,sizing:e.sizing,tableDrilldown:$_(e.tableDrilldown),tags:e.tags??[],hiddenFields:e.hiddenFields??[],summarizeKPIs:e.summarizeKPIs??!1,visualFormatColumns:e.visualFormatColumns??[]}),setAttributes:nN(t),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"dataTable",measure:[],displayTitle:"",dimension:[],protectedByOrganisation:void 0,displaySubject:"",viewId:k0(o?.viewId),filter:[],order:[],dataSetId:e,limit:50,offset:0,conditionalFormattingRules:[],protectedFields:void 0,prefixes:[],dateTimeFormat:"DD MMMM YYYY, hh:mm",exportNames:{},numberFormat:{},sizing:{},tableDrilldown:[],tags:[],hiddenFields:[],summarizeKPIs:!1,visualFormatColumns:[],...o}),schema:qu(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(e){const{measure:o,dimension:n}=le(e,t.queryEngineConfig,"dataTable");return this.init(e.id,{measure:o.slice(0,5),dimension:n})},dataPanelConfig:()=>[P(ue,"data_set"),P(ue,"views"),{...P(ue,"field_columns"),fieldFilterOptions:{onlyFieldTypes:["boolean","number","string","date_time"],onlyDimensions:!0,removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},preventDuplicates:!0,preSetPartialAttributes:(e,o,n)=>({dimension:[...e.map(b=>({...b,pivot:"y"})),...wa(n.dimension,"x")]}),getValues:e=>wa(e.dimension,"y"),testId:"add-pivot-dimension"},{...P(ue,"field_rows"),fieldFilterOptions:{onlyFieldTypes:["boolean","number","string","date_time"],onlyDimensions:!0,removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},preventDuplicates:!0,preSetPartialAttributes:(e,o,n)=>({dimension:[...e.map(b=>({...b,pivot:"x"})),...wa(n.dimension,"y")]}),getValues:e=>wa(e.dimension,"x"),testId:"add-dimension"},{...P(ue,"field_metrics"),fieldFilterOptions:{forComponent:"dataTable"},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"},P(ue,"sort"),{...P(ue,"pagination"),options:pu},P(ue,"filter"),P(ue,"custom_metrics")],formatPanelConfig:()=>[F1(ue),P(ue,"kpi_summarisation"),P(ue,"visual_format"),{...P(ue,"format"),subSection:[ue.format_panel.format?.subSectionDefinition.time]},P(ue,"prefixes"),{...P(ue,"conditional_formatting"),ruleType:"backgroundColor"}],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!1,colorGradient:!0}}),bN=t=>(e,o)=>{let n=I1(e,o,Gn(t));return n=wt(n),n},Ne={title:"Funnel chart",description:"Track conversion between stages of a process.",namespace:"funnel_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this bar chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each bar to measure?",callToAction:"Add metric"},field_x_axis:{type:"fieldCollector",title:"Grouping - X Axis",description:"What do you want each bar to represent? An example might be a `product category` field to represent each category as a bar.",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this bar chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this bar chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"},labels:{type:"labels",title:"Show Labels",description:"",namespace:"labels"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},headline:{type:"headline",title:"Headline",description:""},goal_line:{type:"goalLine",title:"Goal Lines",description:""},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""}}},hu=t=>({title:Ne.title,description:Ne.description,servicesClass:"FunnelChart",namespace:Ne.namespace,dump:e=>e,load:e=>({...e,measure:g1(e.measure),order:me(e.order,e.timeDimension),dimension:Oe(e.dimension),viewId:k0(e.viewId),filter:V1(e.filter),approxXAxisLabelCount:y1(e.approxXAxisLabelCount),approxYAxisLabelCount:y1(e.approxYAxisLabelCount),tags:e.tags??[],labels:e.labels??!1,parameters:ut(e.parameters)}),setAttributes:bN(t),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"funnelChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",viewId:k0(o?.viewId),filter:[],parameters:{},order:[],dataSetId:e,limit:5e3,conditionalFormattingRules:[],protectedByOrganisation:void 0,protectedFields:void 0,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,legend:!0,labels:!1,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",axisTitles:void 0,tags:[],...o}),createFeedback:we,schema:Gn(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(e){const{measure:o,dimension:n}=le(e,t.queryEngineConfig,"funnelChart");return this.init(e.id,{measure:[o[0]],dimension:n})},dataPanelConfig:()=>[P(Ne,"data_set"),P(Ne,"views"),{...P(Ne,"field_y_axis"),fieldFilterOptions:{forComponent:"funnelChart"},preSetPartialAttributes:e=>({measure:e}),allowsMultiple:!1,maxAllowed:1,getValues:e=>e.measure,testId:"metric-input"},{...P(Ne,"field_x_axis"),fieldFilterOptions:{forComponent:"funnelChart",onlyDimensions:!0},allowsMultiple:!1,preventDuplicates:!0,preSetPartialAttributes:(e,o)=>Nr(e,o),getValues:e=>Zo(e),maxAllowed:1,testId:"add-dimension"},P(Ne,"sort"),P(Ne,"filter"),P(Ne,"custom_metrics"),P(Ne,"limit")],formatPanelConfig:()=>[F1(Ne),{...P(Ne,"chart_styles"),subSection:[Ne.format_panel.chart_styles?.subSectionDefinition.legend,Ne.format_panel.chart_styles?.subSectionDefinition.labels]},Ge(Ne),{...P(Ne,"conditional_formatting"),ruleType:"backgroundColor"},P(Ne,"headline")],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet(e,o){return O2(e,o,this.setAttributes)}}),pN=t=>(e,o)=>{let n=I1(e,o,Gn(t));return n=wt(n),n},Ee={title:"Horizontal bar chart",description:"Similar to a BarChart but with horizontal bars.",namespace:"horizontal_bar_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this bar chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each bar to measure?",callToAction:"Add metric"},drilldown:{type:"drilldown",title:"Drilldown",description:"After clicking on a segment of this bar chart, what information do you want to see next?"},field_x_axis:{type:"fieldCollector",title:"Grouping - X Axis",description:"What do you want each bar to represent? An example might be a `product category` field to represent each category as a bar.",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this bar chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this bar chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{stacked:{type:"stacked",title:"Layout",description:"",namespace:"stacked"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},headline:{type:"headline",title:"Headline",description:""},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""}}},mu=t=>({title:Ee.title,description:Ee.description,servicesClass:"HorizontalBarChart",namespace:Ee.namespace,dump:e=>e,load:e=>({...e,measure:g1(e.measure),order:me(e.order,e.timeDimension),dimension:Oe(e.dimension),viewId:k0(e.viewId),filter:V1(e.filter),approxXAxisLabelCount:y1(e.approxXAxisLabelCount),approxYAxisLabelCount:y1(e.approxYAxisLabelCount),tags:e.tags??[],parameters:ut(e.parameters)}),setAttributes:pN(t),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"horizontalBarChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",viewId:k0(o?.viewId),filter:[],order:[],dataSetId:e,limit:5e3,conditionalFormattingRules:[],protectedByOrganisation:void 0,protectedFields:void 0,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,legend:!0,parameters:{},drilldown:[],approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",axisTitles:void 0,tags:[],drilldownOptions:void 0,...o}),createFeedback:we,schema:Gn(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(e){const{measure:o,dimension:n}=le(e,t.queryEngineConfig,"horizontalBarChart");return this.init(e.id,{measure:[o[0]],dimension:n})},dataPanelConfig:()=>[P(Ee,"data_set"),P(Ee,"views"),{...P(Ee,"field_y_axis"),fieldFilterOptions:{forComponent:"horizontalBarChart"},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"},{...P(Ee,"field_x_axis"),fieldFilterOptions:{forComponent:"horizontalBarChart",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:(e,o)=>Nr(e,o),getValues:e=>Zo(e),maxAllowed:2,testId:"add-dimension"},P(Ee,"sort"),P(Ee,"filter"),{...P(Ee,"drilldown"),options:{property:"drilldownOptions"}},P(Ee,"custom_metrics"),P(Ee,"limit")],formatPanelConfig:()=>[F1(Ee),Un(Ee,!1,!0),Ge(Ee),{...P(Ee,"conditional_formatting"),ruleType:"backgroundColor"},P(Ee,"headline")],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet(e,o){return O2(e,o,this.setAttributes)}}),gu=t=>R.object({...Y1(t.attributesSchemaOptions),...c2(t.queryEngineConfig,t.attributesSchemaOptions),stacked:R.valid(!0,!1,"100%"),legend:R.valid(!0,!1),labels:R.valid(!0,!1).optional(),type:R.valid("horizontalBarChartV2").required(),parameters:ft(t.queryEngineConfig,t.attributesSchemaOptions),conditionalFormattingRules:Wt(t.queryEngineConfig),goalLines:Vt(),axisTitles:qt(),headline:X2(),tags:H1()}),fe={title:"Horizontal bar chart",description:"Ideal for illustrating changes and trends over time with bar graphs.",namespace:"horizontal_bar_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this bar chart?"},views:{type:"views",title:"View",description:""},field_x_axis:{type:"fieldCollector",title:"Metric - X Axis",description:"What do you want each bar to measure?",callToAction:"Add metric"},field_y_axis:{type:"fieldCollector",title:"Grouping - Y Axis",description:"What do you want each bar to represent? An example might be a `product category` field to represent each category as a bar.",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this bar chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this bar chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{stacked:{type:"stacked",title:"Layout",description:"",namespace:"stacked"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"},labels:{type:"labels",title:"Show Labels",description:"",namespace:"labels"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""},headline:{type:"headline",title:"Headline",description:""},goal_line:{type:"goalLine",title:"Goal Lines",description:""}}},aN=t=>(e,o)=>{let n=I1(e,o,gu(t));return n=wt(n),n},yu=t=>({title:fe.title,description:fe.description,servicesClass:"HorizontalBarChart",namespace:fe.namespace,dump:e=>e,load:e=>({type:e.type,measure:g1(e.measure),order:me(e.order,e.timeDimension),dimension:Oe(e.dimension),displayTitle:e.displayTitle,displaySubject:e.displaySubject,protectedByOrganisation:e.protectedByOrganisation,viewId:k0(e.viewId),filter:V1(e.filter),dataSetId:e.dataSetId,limit:e.limit,timeDimension:null,xAxisPostfix:e.xAxisPostfix,xAxisPrefix:e.xAxisPrefix,yAxisPostfix:e.yAxisPostfix,yAxisPrefix:e.yAxisPrefix,yAxisFormat:e.yAxisFormat,xAxisFormat:e.xAxisFormat,conditionalFormattingRules:St(t.queryEngineConfig,e.conditionalFormattingRules),legend:e.legend,labels:e.labels,goalLines:e.goalLines,headline:ho(e.headline,e.timeDimension),parameters:ut(e.parameters),approxXAxisLabelCount:y1(e.approxXAxisLabelCount),approxYAxisLabelCount:y1(e.approxYAxisLabelCount),axisTitles:e.axisTitles,tags:e.tags??[],stacked:e.stacked}),setAttributes:aN(t),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"horizontalBarChartV2",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:k0(o?.viewId),filter:[],order:[],dataSetId:e,limit:5e3,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,conditionalFormattingRules:[],legend:!0,labels:!1,goalLines:void 0,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",parameters:{},axisTitles:void 0,headline:void 0,tags:[],...o}),createFeedback:we,schema:gu(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),isRunnable:e=>e.measure.length>0&&e.dimension.length>0,autoGenerate(e){const{measure:o,dimension:n}=le(e,t.queryEngineConfig,"barChart");return this.init(e.id,{measure:[o[0]],dimension:n})},dataPanelConfig:()=>[P(fe,"data_set"),P(fe,"views"),{...P(fe,"field_x_axis"),fieldFilterOptions:{forComponent:"horizontalBarChartV2"},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"},{...P(fe,"field_y_axis"),fieldFilterOptions:{forComponent:"horizontalBarChartV2",onlyDimensions:!0},preventDuplicates:!1,preSetPartialAttributes:e=>({dimension:[...e]}),getValues:e=>[...e.dimension],maxAllowed:2,testId:"add-dimension"},P(fe,"sort"),P(fe,"filter"),P(fe,"custom_metrics"),P(fe,"limit")],formatPanelConfig:()=>[F1(fe),{...P(fe,"chart_styles"),subSection:[fe.format_panel.chart_styles?.subSectionDefinition.stacked,fe.format_panel.chart_styles?.subSectionDefinition.legend,fe.format_panel.chart_styles?.subSectionDefinition.labels],labels:{type:"labels",title:"Show Labels",description:"",namespace:"labels"}},Ge(fe),{...P(fe,"conditional_formatting"),ruleType:"lineColor"},P(fe,"goal_line")],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet(e,o){return O2(e,o,this.setAttributes)}}),Ru=t=>R.object({...Y1(t.attributesSchemaOptions),...c2(t.queryEngineConfig,t.attributesSchemaOptions),stacked:R.valid(!0,!1,"100%"),legend:R.valid(!0,!1),type:R.valid("lineChart").required(),parameters:ft(t.queryEngineConfig,t.attributesSchemaOptions),lineCurve:UM,conditionalFormattingRules:Wt(t.queryEngineConfig),goalLines:Vt(),axisTitles:qt(),headline:X2(),tags:H1(),trends:sz()}),MN=t=>(e,o)=>{let n=I1(e,o,Ru(t));return n=wt(n),n},Je={title:"Line chart",description:"Ideal for illustrating changes and trends over time with line graphs.",namespace:"line_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this line chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each line to measure?",callToAction:"Add metric"},drilldown:{type:"drilldown",title:"Drilldown",description:"After clicking on a segment of this line chart, what information do you want to see next?"},field_x_axis:{type:"fieldCollector",title:"Grouping - X Axis",description:"What do you want each line to represent? An example might be a `product category` field to represent each category as a line.",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this line chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this line chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{curve:{type:"curve",title:"Line Style",description:"",namespace:"curve"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""},headline:{type:"headline",title:"Headline",description:""},trends:{type:"trends",title:"Trend lines",description:"Specify a trend type for the line chart."},goal_line:{type:"goalLine",title:"Goal Lines",description:""}}},Lu=t=>({title:"Line chart",description:"Ideal for illustrating changes and trends over time with line graphs.",servicesClass:"LineChart",namespace:"line_chart",dump:e=>e,load:e=>({type:e.type,measure:g1(e.measure),order:me(e.order,e.timeDimension),dimension:Oe(e.dimension),timeDimension:e.timeDimension,displayTitle:e.displayTitle,displaySubject:e.displaySubject,protectedByOrganisation:e.protectedByOrganisation,viewId:k0(e.viewId),filter:V1(e.filter),dataSetId:e.dataSetId,limit:e.limit,xAxisPostfix:e.xAxisPostfix,xAxisPrefix:e.xAxisPrefix,yAxisPostfix:e.yAxisPostfix,yAxisPrefix:e.yAxisPrefix,yAxisFormat:e.yAxisFormat,xAxisFormat:e.xAxisFormat,lineCurve:e.lineCurve,conditionalFormattingRules:St(t.queryEngineConfig,e.conditionalFormattingRules),drilldown:e.drilldown,legend:e.legend,goalLines:e.goalLines,headline:ho(e.headline,e.timeDimension),parameters:ut(e.parameters),approxXAxisLabelCount:y1(e.approxXAxisLabelCount),approxYAxisLabelCount:y1(e.approxYAxisLabelCount),axisTitles:e.axisTitles,tags:e.tags??[],trends:e.trends??[]}),setAttributes:MN(t),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"lineChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:k0(o?.viewId),filter:[],order:[],dataSetId:e,limit:5e3,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,lineCurve:"natural",conditionalFormattingRules:[],drilldown:[],legend:!0,goalLines:void 0,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",parameters:{},axisTitles:void 0,headline:void 0,tags:[],trends:[],...o}),createFeedback:we,schema:Ru(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(e){const{measure:o,dimension:n}=le(e,t.queryEngineConfig,"lineChart");return this.init(e.id,{measure:[o[0]],dimension:n})},dataPanelConfig:()=>[P(Je,"data_set"),P(Je,"views"),{...P(Je,"field_y_axis"),fieldFilterOptions:{forComponent:"lineChart"},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"},{...P(Je,"field_x_axis"),fieldFilterOptions:{forComponent:"lineChart",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:(e,o)=>Nr(e,o),getValues:e=>Zo(e),maxAllowed:2,testId:"add-dimension"},P(Je,"sort"),P(Je,"filter"),P(Je,"custom_metrics"),P(Je,"limit")],formatPanelConfig:()=>[F1(Je),Un(Je,!0,!1),Ge(Je),{...P(Je,"conditional_formatting"),ruleType:"lineColor"},P(Je,"goal_line"),P(Je,"trends"),P(Je,"headline")],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet(e,o){return O2(e,o,this.setAttributes)}}),vu=t=>R.object({...Y1(t.attributesSchemaOptions),...c2(t.queryEngineConfig,t.attributesSchemaOptions),stacked:R.valid(!0,!1,"100%"),legend:R.valid(!0,!1),labels:R.valid(!0,!1).optional(),type:R.valid("lineChartV2").required(),parameters:ft(t.queryEngineConfig,t.attributesSchemaOptions),lineCurve:UM,conditionalFormattingRules:Wt(t.queryEngineConfig),goalLines:Vt(),axisTitles:qt(),headline:X2(),tags:H1(),trends:sz()}),zN=t=>(e,o)=>{let n=I1(e,o,vu(t));return n=wt(n),n},et={title:"Line chart",description:"Ideal for illustrating changes and trends over time with line graphs.",namespace:"line_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this line chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each line to measure?",callToAction:"Add metric"},drilldown:{type:"drilldown",title:"Drilldown",description:"After clicking on a segment of this line chart, what information do you want to see next?"},field_x_axis:{type:"fieldCollector",title:"Grouping - X Axis",description:"What do you want each line to represent? An example might be a `product category` field to represent each category as a line.",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this line chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this line chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{curve:{type:"curve",title:"Line Style",description:"",namespace:"curve"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"},labels:{type:"labels",title:"Show Labels",description:"",namespace:"labels"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""},headline:{type:"headline",title:"Headline",description:""},trends:{type:"trends",title:"Trend lines",description:"Specify a trend type for the line chart."},goal_line:{type:"goalLine",title:"Goal Lines",description:""}}},_u=t=>({title:"Line chart",description:"Ideal for illustrating changes and trends over time with line graphs.",servicesClass:"LineChart",namespace:"line_chart",dump:e=>e,load:e=>({type:e.type,measure:g1(e.measure),order:me(e.order,e.timeDimension),dimension:Oe(e.dimension),displayTitle:e.displayTitle,displaySubject:e.displaySubject,protectedByOrganisation:e.protectedByOrganisation,viewId:k0(e.viewId),filter:V1(e.filter),dataSetId:e.dataSetId,limit:e.limit,timeDimension:null,xAxisPostfix:e.xAxisPostfix,xAxisPrefix:e.xAxisPrefix,yAxisPostfix:e.yAxisPostfix,yAxisPrefix:e.yAxisPrefix,yAxisFormat:e.yAxisFormat,xAxisFormat:e.xAxisFormat,lineCurve:e.lineCurve,conditionalFormattingRules:St(t.queryEngineConfig,e.conditionalFormattingRules),drilldown:e.drilldown,legend:e.legend,labels:e.labels,goalLines:e.goalLines,headline:ho(e.headline,e.timeDimension),parameters:ut(e.parameters),approxXAxisLabelCount:y1(e.approxXAxisLabelCount),approxYAxisLabelCount:y1(e.approxYAxisLabelCount),axisTitles:e.axisTitles,tags:e.tags??[],trends:e.trends??[]}),setAttributes:zN(t),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"lineChartV2",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:k0(o?.viewId),filter:[],order:[],dataSetId:e,limit:5e3,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,lineCurve:"natural",conditionalFormattingRules:[],drilldown:[],legend:!0,labels:!1,goalLines:void 0,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",parameters:{},axisTitles:void 0,headline:void 0,tags:[],trends:[],...o}),createFeedback:we,schema:vu(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),isRunnable:e=>e.measure.length>0&&e.dimension.length>0,autoGenerate(e){const{measure:o,dimension:n}=le(e,t.queryEngineConfig,"lineChart");return this.init(e.id,{measure:[o[0]],dimension:n})},dataPanelConfig:()=>[P(et,"data_set"),P(et,"views"),{...P(et,"field_y_axis"),fieldFilterOptions:{forComponent:"lineChart"},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"},{...P(et,"field_x_axis"),fieldFilterOptions:{forComponent:"lineChart",onlyDimensions:!0},preventDuplicates:!1,preSetPartialAttributes:e=>({dimension:[...e]}),getValues:e=>[...e.dimension],maxAllowed:2,testId:"add-dimension"},P(et,"sort"),P(et,"filter"),P(et,"custom_metrics"),P(et,"limit")],formatPanelConfig:()=>[F1(et),{...P(et,"chart_styles"),subSection:[et.format_panel.chart_styles?.subSectionDefinition.legend,et.format_panel.chart_styles?.subSectionDefinition.labels]},Ge(et),{...P(et,"conditional_formatting"),ruleType:"lineColor"},P(et,"goal_line")],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet(e,o){return O2(e,o,this.setAttributes)}}),Nu=t=>R.object({...Y1(t.attributesSchemaOptions),type:R.valid("mercatorMap").required(),measure:R.array().items(he(t.queryEngineConfig.supportedAggregates,t.attributesSchemaOptions)),filter:z2(t.queryEngineConfig),limit:Gt(),dimension:Bt({},t.attributesSchemaOptions),labelFormat:R.alternatives(R.string(),R.valid(null)),noDataColor:R.string().required(),backgroundColor:R.string().required(),maxValueColor:R.string().required(),minValueColor:R.string().required(),position:R.object({scale:R.number(),centerX:R.number(),centerY:R.number()}),tags:H1()}),cN=t=>(e,o)=>I1(e,o,Nu(t)),st={title:"Country map",description:"A map component based on the Mercator projection, suitable for geographical data visualization.",namespace:"mercator_map",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use for this map?"},views:{type:"views",title:"View",description:""},field_metrics:{type:"fieldCollector",title:"Metric",description:"What do you want to show?",callToAction:"Add metric"},field_country:{type:"fieldCollector",title:"Country",description:"Which field contains the country code required to group results on?",callToAction:"Set country"},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use on this map."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this map."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Map Settings",description:"",subSectionDefinition:{number_format:{type:"numberFormat",title:"Value format",description:"",namespace:"number_format"}}},map_colors:{type:"mapColors",title:"Map colors",description:""}}},Tu=t=>({title:st.title,description:st.description,servicesClass:"MercatorMap",namespace:st.namespace,dump:e=>e,load:e=>({dataSetId:e.dataSetId,displaySubject:e.displaySubject,displayTitle:e.displayTitle,protectedByOrganisation:e.protectedByOrganisation,viewId:k0(e.viewId),type:"mercatorMap",dimension:e.dimension,limit:e.limit,measure:g1(e.measure),labelFormat:e.labelFormat,position:e.position,filter:V1(e.filter),noDataColor:e.noDataColor||"#ffffff",backgroundColor:e.backgroundColor||"#EFF5F6",maxValueColor:e.maxValueColor||"#000000",minValueColor:e.minValueColor||"#e0e0e0",tags:e.tags??[]}),setAttributes:cN(t),validate:()=>[],init:(e,o)=>({type:"mercatorMap",dataSetId:e,dimension:[],measure:[],displaySubject:"",displayTitle:"",limit:5e3,filter:[],viewId:k0(o?.viewId),labelFormat:null,noDataColor:"#ffffff",backgroundColor:"#EFF5F6",maxValueColor:"#000000",minValueColor:"#e0e0e0",tags:[],...o}),schema:Nu(t),removeField(e,o){return e},isRunnable:e=>!!(e.dimension&&e.dimension[0]&&e.measure&&e.measure[0]),autoGenerate(e){return this.init(e.id)},dataPanelConfig:()=>[P(st,"data_set"),P(st,"views"),{...P(st,"field_metrics"),type:"fieldCollector",fieldFilterOptions:{forComponent:"mercatorMap"},maxAllowed:1,preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"},{...P(st,"field_country"),fieldFilterOptions:{onlyDimensions:!0,onlyFieldTypes:["string"],removeRuleGrouping:!1,removeSimpleMaths:!0,removePercentage:!0,removeAggregateMaths:!0},maxAllowed:1,preSetPartialAttributes:e=>({dimension:e}),getValues:e=>e.dimension,testId:"add-dimension"},P(st,"filter"),P(st,"custom_metrics"),P(st,"limit")],formatPanelConfig:()=>[F1(st),{...P(st,"chart_styles"),subSection:[st.format_panel.chart_styles?.subSectionDefinition.number_format]},P(st,"map_colors")],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!1,colorGradient:!1}}),xl=t=>R.object({...Y1(t.attributesSchemaOptions),measure:R.array().items(he(t.queryEngineConfig.supportedAggregates,t.attributesSchemaOptions)),dimension:Bt(t.queryEngineConfig.supportedTimeTruncFunctions,t.attributesSchemaOptions),filter:z2(t.queryEngineConfig),timeDimension:R.valid(null),order:R.array().items(uo(t.queryEngineConfig)),type:R.valid("pieChart").required(),legend:R.valid(!0,!1),labels:R.valid(!0,!1).optional(),limit:Gt(),labelsAsPercentage:R.boolean(),conditionalFormattingRules:Wt(t.queryEngineConfig),labelFormat:R.alternatives(R.string(),R.valid(null)),parameters:ft(t.queryEngineConfig,t.attributesSchemaOptions),tags:H1(),drilldownOptions:jO(t.queryEngineConfig)}),Te={title:"Pie chart",description:"Represents data in a circular pie-like format, useful for showing proportions.",namespace:"pie_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this pie chart?"},views:{type:"views",title:"View",description:""},field_metrics:{type:"fieldCollector",title:"Metric",description:"What do you want each segment to measure?",callToAction:"Add metric"},drilldown:{type:"drilldown",title:"Drilldown",description:"After clicking on a segment of this bar chart, what information do you want to see next?"},field_grouping:{type:"fieldCollector",title:"Grouping",description:"How do you want to split each section of the pie chart?",callToAction:"Add comparison"},sort:{type:"sort",title:"Sort",description:"Choose the order of segments in the pie chart"},filter:{type:"filter",title:"Filters",description:"Only include the information you want in this pie chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Limit the number of segments shown on this pie chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{number_format:{type:"numberFormat",title:"Format",description:"",namespace:"number_format"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"},labels:{type:"labels",title:"Show Labels",description:"",namespace:"labels"}}},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""}}},Bu=t=>({title:Te.title,description:Te.description,servicesClass:"PieChart",namespace:Te.namespace,dump:e=>e,load:e=>({type:e.type,measure:g1(e.measure),order:me(e.order,e.timeDimension),dimension:Oe(e.dimension),viewId:k0(e.viewId),timeDimension:e.timeDimension,displayTitle:e.displayTitle,displaySubject:e.displaySubject,protectedByOrganisation:e.protectedByOrganisation,filter:V1(e.filter),dataSetId:e.dataSetId,limit:e.limit,conditionalFormattingRules:St(t.queryEngineConfig,e.conditionalFormattingRules),labelsAsPercentage:e.labelsAsPercentage,legend:e.legend,labels:e.labels,labelFormat:e.labelFormat,parameters:ut(e.parameters),tags:e.tags??[],drilldownOptions:e.drilldownOptions}),setAttributes:(e,o)=>I1(e,o,xl(t)),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"pieChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:k0(o?.viewId),filter:[],order:[],dataSetId:e,limit:5e3,conditionalFormattingRules:[],labelsAsPercentage:!1,legend:!0,labels:!1,labelFormat:null,parameters:{},tags:[],drilldownOptions:void 0,...o}),createFeedback:we,schema:xl(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(e){const{measure:o,dimension:n}=le(e,t.queryEngineConfig,"pieChart");return this.init(e.id,{measure:[o[0]],dimension:n})},dataPanelConfig:()=>[P(Te,"data_set"),P(Te,"views"),{...P(Te,"field_metrics"),fieldFilterOptions:{forComponent:"pieChart"},maxAllowed:1,preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"},{...P(Te,"field_grouping"),fieldFilterOptions:{onlyFieldTypes:["boolean","number","string"],onlyDimensions:!0,removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},maxAllowed:1,preSetPartialAttributes:e=>({dimension:e}),getValues:e=>e.dimension,testId:"add-dimension"},P(Te,"sort"),P(Te,"filter"),{...P(Te,"drilldown"),options:{property:"drilldownOptions"}},P(Te,"custom_metrics"),P(Te,"limit")],formatPanelConfig:()=>[F1(Te),{...P(Te,"conditional_formatting"),ruleType:"backgroundColor"},{...P(Te,"chart_styles"),subSection:[Te.format_panel.chart_styles?.subSectionDefinition.legend,Te.format_panel.chart_styles?.subSectionDefinition.labels,Te.format_panel.chart_styles?.subSectionDefinition.number_format]}],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!0,colorGradient:!1}});var rO=(t=>(t.Linear="linear",t.Circular="circular",t))(rO||{});const Xl=t=>R.object({...Y1(t.attributesSchemaOptions),measure:R.array().items(he(t.queryEngineConfig.supportedAggregates,t.attributesSchemaOptions)),filter:z2(t.queryEngineConfig),type:R.valid("progress").required(),limit:Gt(),conditionalFormattingRules:Wt(t.queryEngineConfig),parameters:ft(t.queryEngineConfig,t.attributesSchemaOptions),goals:R.array().items(R.object({field:R.string().required().description("ID of the field in the data set to which the goal applies too"),value:R.number().required().description("Value of which the goal is set")})).description("Set the target value that progression is shown towards."),progressType:R.array().items(R.object({field:R.string().required().description("ID of the field to set the progress type of"),value:R.valid(rO.Linear,rO.Circular).required()})).description("Set the display type of the progress view"),formatter:R.object().pattern(R.string(),R.string()),prefixes:R.object().pattern(R.string(),R.string()),postfixes:R.object().pattern(R.string(),R.string()),tags:H1()}),Su=t=>{if("singleMeasure"in t){let e={},o={},n=[],b={};return t.singleMeasure&&(n=[t.singleMeasure],e[Vi(t.singleMeasure)]=t.prefix,o[Vi(t.singleMeasure)]=t.postfix,b[Vi(t.singleMeasure)]=t.formatter),{type:"singleStat",prefixes:e,postfixes:o,measure:n,formatter:b,fontSize:t.fontSize,displayTitle:t.displayTitle,displaySubject:t.displaySubject,tags:t.tags,filter:V1(t.filter),dataSetId:t.dataSetId,limit:t.limit,conditionalFormattingRules:t.conditionalFormattingRules,deltaTimeDimension:t.deltaTimeDimension,parameters:ut(t.parameters)}}else return{...t,filter:V1(t.filter)}},tt={title:"Progress",description:"Used to show progress towards goals, completion of tasks, or as indicators of performance metrics.",namespace:"progress",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this progress?"},views:{type:"views",title:"View",description:""},progress_goals:{type:"progressGoals",title:"Metric",description:"What do you want to show in each progress bar?"},filter:{type:"filter",title:"Filters",description:"Only include the information you want in this progress chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},stats_labels:{type:"statsLabels",title:"Labels",description:"",subSectionDefinition:{prefix:{title:"Prefix",description:"",namespace:"prefix"},postfix:{title:"Postfix",description:"",namespace:"postfix"},format:{title:"Format",description:"",namespace:"format"},count:{title:"Label count",description:"",namespace:"count"}}},progress_type:{type:"progressType",title:"Type",description:""}}},wu=t=>({title:tt.title,description:tt.description,dump:e=>e,namespace:tt.namespace,servicesClass:"Progress",load:e=>{const o=Su(e);return{type:"progress",measure:g1(o.measure),displayTitle:o.displayTitle,displaySubject:o.displaySubject,protectedByOrganisation:o.protectedByOrganisation,viewId:k0(o.viewId),filter:o.filter,dataSetId:o.dataSetId,limit:o.limit,conditionalFormattingRules:o.conditionalFormattingRules,parameters:o.parameters,prefixes:o.prefixes,postfixes:o.postfixes,formatter:o.formatter,goals:o.goals,progressType:o.progressType,tags:o.tags??[]}},setAttributes:(e,o)=>I1(e,o,Xl(t)),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"progress",measure:[],displayTitle:"",protectedByOrganisation:void 0,displaySubject:"",viewId:k0(o?.viewId),filter:[],dataSetId:e,limit:5e3,conditionalFormattingRules:[],parameters:{},formatter:{},progressType:[],goals:[],postfixes:{},prefixes:{},tags:[],...o}),schema:Xl(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(e){return this.init(e.id)},dataPanelConfig:()=>[P(tt,"data_set"),P(tt,"views"),P(tt,"progress_goals"),P(tt,"filter"),P(tt,"custom_metrics")],formatPanelConfig:()=>[F1(tt),P(tt,"progress_type"),{...P(tt,"stats_labels"),prefix:Vo(tt,"prefix"),postfix:Vo(tt,"postfix"),format:Vo(tt,"format"),count:Vo(tt,"count")}],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,aggregateMaths:!0,rules:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!1,colorGradient:!1}}),xu=t=>R.object({...Y1(t.attributesSchemaOptions),...c2(t.queryEngineConfig,t.attributesSchemaOptions),legend:R.valid(!0,!1),type:R.valid("radarChart").required(),parameters:ft(t.queryEngineConfig,t.attributesSchemaOptions),axisTitles:qt(),headline:X2(),tags:H1()}),sN=t=>(e,o)=>{let n=I1(e,o,xu(t));return n=wt(n),n},Ot={title:"Radar chart",description:"Visualizes multiple variables as points on axes starting from the same center point, creating a spider web-like shape. Perfect for comparing strengths and weaknesses across multiple dimensions or showing performance metrics across different categories.",namespace:"radar_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this radar chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each line to measure?",callToAction:"Add metric"},field_x_axis:{type:"fieldCollector",title:"Grouping - X Axis",description:"What do you want each line to represent? An example might be a `product category` field to represent each category as a line.",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this radar chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this radar chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{curve:{type:"curve",title:"Line Style",description:"",namespace:"curve"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"Grouping - X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},y:{title:"Metric - Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"}}}}},Xu=t=>({title:Ot.title,description:Ot.description,servicesClass:"RadarChart",namespace:Ot.namespace,dump:e=>e,load:e=>({type:e.type,measure:g1(e.measure),order:me(e.order,e.timeDimension),dimension:Oe(e.dimension),displayTitle:e.displayTitle,displaySubject:e.displaySubject,protectedByOrganisation:e.protectedByOrganisation,viewId:k0(e.viewId),filter:V1(e.filter),dataSetId:e.dataSetId,limit:e.limit,timeDimension:null,xAxisPostfix:e.xAxisPostfix,xAxisPrefix:e.xAxisPrefix,yAxisPostfix:e.yAxisPostfix,yAxisPrefix:e.yAxisPrefix,yAxisFormat:e.yAxisFormat,xAxisFormat:e.xAxisFormat,approxXAxisLabelCount:y1(e.approxXAxisLabelCount),approxYAxisLabelCount:y1(e.approxYAxisLabelCount),legend:e.legend,tags:e.tags??[]}),setAttributes:sN(t),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"radarChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:k0(o?.viewId),filter:[],order:[],dataSetId:e,limit:5e3,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,legend:!0,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",parameters:{},axisTitles:void 0,headline:void 0,tags:[],...o}),createFeedback:we,schema:xu(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),isRunnable:e=>e.measure.length>0&&e.dimension.length>0,autoGenerate(e){const{measure:o,dimension:n}=le(e,t.queryEngineConfig,"radarChart");return this.init(e.id,{measure:[o[0]],dimension:n})},dataPanelConfig:()=>[P(Ot,"data_set"),P(Ot,"views"),{...P(Ot,"field_y_axis"),fieldFilterOptions:{forComponent:"radarChart"},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"},{...P(Ot,"field_x_axis"),fieldFilterOptions:{forComponent:"radarChart",onlyDimensions:!0},preventDuplicates:!1,preSetPartialAttributes:e=>({dimension:[...e]}),getValues:e=>[...e.dimension],maxAllowed:1,testId:"add-dimension"},P(Ot,"sort"),P(Ot,"filter"),P(Ot,"custom_metrics"),P(Ot,"limit")],formatPanelConfig:()=>[F1(Ot),Un(Ot,!1,!1),Ge(Ot)],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet(e,o){return O2(e,o,this.setAttributes)}}),Cu=t=>R.object({...Y1(t.attributesSchemaOptions),...c2(t.queryEngineConfig,t.attributesSchemaOptions),type:R.valid("richText").required(),tags:H1(),content:R.any()}),ON=t=>(e,o)=>I1(e,o,Cu(t)),Nt={title:"Rich text",description:"Add your data to a rich text component.",namespace:"rich_text",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this rich text view?"},views:{type:"views",title:"View",description:""},field_metrics:{type:"fieldCollector",title:"Metrics",description:"What metrics do you need to collect?",callToAction:"Add metric"},field_grouping:{type:"fieldCollector",title:"Grouping",description:"How do you want to group your results?",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"How should the results be ordered?"},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this text view."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to use on this text view."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},rich_text:{type:"richText",title:"Text format",description:""}}},lN={type:"doc",content:[{type:"heading",attrs:{level:1},content:[{type:"text",text:"Rich text views"}]},{type:"paragraph",content:[{type:"text",text:"In this view, you can add any "},{type:"text",marks:[{type:"bold"}],text:"text based content"},{type:"text",text:" to your dashboard, and "},{type:"text",marks:[{type:"italic"}],text:"mix in your data with it!"}]},{type:"paragraph",content:[{type:"text",text:"Remember to use the "},{type:"text",marks:[{type:"bold"}],text:"format"},{type:"text",text:" "},{type:"text",marks:[{type:"bold"}],text:"tab"},{type:"text",text:" to "},{type:"text",marks:[{type:"underline"}],text:"style"},{type:"text",text:" your contents"}]},{type:"heading",attrs:{level:2},content:[{type:"text",text:"Adding data?"}]},{type:"paragraph",content:[{type:"text",text:"You can add data to your text content by using templating. For example, is how to take metrics "},{type:"text",marks:[{type:"code"}],text:'"Metric Name"'},{type:"text",text:" and "},{type:"text",marks:[{type:"code"}],text:'"A different metric name" '},{type:"text",text:"from the first row of the results, and show it on this view;"}]},{type:"codeBlock",attrs:{language:null},content:[{type:"text",text:`{{ data.first.metric_name }}
59
+ `),this.name="DataSetNotFound"}}const F_=t=>{let e=[];if("measure"in t&&t.measure&&(e=[...e,...t.measure]),"xMeasure"in t&&Array.isArray(t.xMeasure)&&(e=[...e,...t.xMeasure]),"yMeasure"in t&&t.yMeasure&&(e=[...e,t.yMeasure]),"zMeasure"in t&&t.zMeasure){let o=Array.isArray(t.zMeasure)?t.zMeasure:[t.zMeasure];e=[...e,...o]}return e},k_=t=>{let e=[];return"dimension"in t&&t.dimension&&(e=[...e,...t.dimension]),"lineDimension"in t&&t.lineDimension&&(e=[...e,...t.lineDimension]),"barDimension"in t&&t.barDimension&&(e=[...e,...t.barDimension]),e},Jd=t=>{let e=[];return F_(t).forEach(o=>{e=[...e,{fieldId:o.field,function:o.function,dataSetId:t.dataSetId}]}),k_(t).forEach(o=>{e=[...e,{fieldId:o.field,function:o.function,dataSetId:t.dataSetId}]}),"order"in t&&t.order&&(e=[...e,...[...t.order].map(o=>({fieldId:o.field,function:o.function,dataSetId:t.dataSetId}))]),"timeDimension"in t&&t.timeDimension&&(e=[...e,{fieldId:t.timeDimension.field,function:t.timeDimension.truncate,dataSetId:t.dataSetId}]),e},j_={allowUnknown:!0,stripUnknown:!0},K1=(t,e,o)=>{const{error:n}=ib(t.type,{queryEngineConfig:o}).schema.validate(t,j_);if(n)return[new I_(n)];const b=T2(e,t.dataSetId);if(!b)return[new P_(e,t.dataSetId)];const a=Jd(t).map(O=>O.fieldId);try{a.forEach(O=>{dt(b,O)})}catch(O){if(O instanceof Ya)return[O];throw O}return[]},k0=t=>t||`view_${$d()}`,$_=t=>t&&t.length>0?t.map(U_):t||[];function U_(t){const{parentDimension:e,...o}=t;return o}const Nr=(t,e)=>{let o=null,n=P0.cloneDeep(t);return n.forEach(b=>{const a=dt(e,b.field);a.dataType=="date_time"&&(o={field:a.id,truncate:b.function})}),n=n.filter(b=>dt(e,b.field).dataType!="date_time"),{timeDimension:o,dimension:n}},Zo=t=>{let e=[...t.dimension];return"timeDimension"in t&&t.timeDimension&&(e=[{field:t.timeDimension.field,function:t.timeDimension.truncate},...e]),e},se={title:"Area chart",description:"Displays data as areas on a chart, useful for showing trends over time.",namespace:"area_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this area chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each area to measure?",callToAction:"Add metric"},field_x_axis:{type:"fieldCollector",title:"Grouping - X Axis",description:"What do you want each area to represent? An example might be an employee ID to represent each employee.",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this area chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this area chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},rich_text:{type:"richText",title:"Text format"},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{stacked:{type:"stacked",title:"Layout",description:"",namespace:"stacked"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"},curve:{type:"curve",title:"Line Curve",description:"",namespace:"curve"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""},headline:{type:"headline",title:"Headline",description:""},goal_line:{type:"goalLine",title:"Goal Lines",description:""}}};function P(t,e){return(n=>n in t.format_panel)(e)?{...t.format_panel[e],namespace:e}:{...t.data_panel[e],namespace:e}}function kt(t,e){return t.format_panel.axis_labels?.subSectionDefinition[e]}function F1(t){return{...P(t,"heading"),subSection:[t.format_panel.heading.subSectionDefinition.title,t.format_panel.heading.subSectionDefinition.subject]}}function Ge(t){return{...P(t,"axis_labels"),y:{...kt(t,"y"),prefix:kt(t,"y.prefix"),postfix:kt(t,"y.postfix"),format:kt(t,"y.format"),count:kt(t,"y.count"),axisTitle:kt(t,"y.axis_title")},x:{...kt(t,"x"),prefix:kt(t,"x.prefix"),postfix:kt(t,"x.postfix"),format:kt(t,"x.format"),count:kt(t,"x.count"),axisTitle:kt(t,"x.axis_title")}}}function Un(t,e,o){return e?{...P(t,"chart_styles"),subSection:[t.format_panel.chart_styles?.subSectionDefinition.curve,t.format_panel.chart_styles?.subSectionDefinition.legend]}:o?{...P(t,"chart_styles"),subSection:[t.format_panel.chart_styles?.subSectionDefinition.stacked,t.format_panel.chart_styles?.subSectionDefinition.legend]}:{...P(t,"chart_styles"),subSection:[t.format_panel.chart_styles?.subSectionDefinition.legend]}}function Vo(t,e){return{...t.format_panel.stats_labels?.subSectionDefinition[e],namespace:e}}const ho=(t,e)=>{if(t?.func==="current"&&e)return t};var W0=(t=>(t.Maths="maths",t.IfStatement="ifStatement",t.Aggregates="aggregates",t))(W0||{});const eu=t=>({title:se.title,description:se.description,servicesClass:"AreaChart",namespace:se.namespace,dump:e=>e,load:e=>({type:e.type,measure:g1(e.measure),displayTitle:e.displayTitle,dimension:Oe(e.dimension),timeDimension:e.timeDimension,displaySubject:e.displaySubject,viewId:k0(e.viewId),filter:V1(e.filter),order:me(e.order,e.timeDimension),dataSetId:e.dataSetId,limit:e.limit,offset:e.offset,xAxisPostfix:e.xAxisPostfix,xAxisPrefix:e.xAxisPrefix,yAxisPostfix:e.yAxisPostfix,yAxisPrefix:e.yAxisPrefix,lineCurve:e.lineCurve,conditionalFormattingRules:St(t.queryEngineConfig,e.conditionalFormattingRules),protectedByOrganisation:e.protectedByOrganisation,stacked:e.stacked,drilldown:e.drilldown,legend:e.legend,yAxisFormat:e.yAxisFormat,xAxisFormat:e.xAxisFormat,goalLines:e.goalLines,parameters:ut(e.parameters),approxXAxisLabelCount:R1(e.approxXAxisLabelCount),approxYAxisLabelCount:R1(e.approxYAxisLabelCount),headline:ho(e.headline,e.timeDimension),tags:e.tags??[]}),setAttributes:og(t),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"areaChart",measure:[],displayTitle:"",dimension:[],timeDimension:null,displaySubject:"",viewId:k0(o?.viewId),filter:[],order:[],dataSetId:e,limit:5e3,offset:0,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,lineCurve:"natural",conditionalFormattingRules:[],drilldown:[],legend:!0,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",parameters:{},goalLines:void 0,axisTitles:void 0,headline:void 0,tags:[],...o}),createFeedback:we,schema:FA(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(e){const{measure:o,dimension:n}=le(e,t.queryEngineConfig,"areaChart");return this.init(e.id,{measure:[o[0]],dimension:n})},dataPanelConfig:()=>[P(se,"data_set"),P(se,"views"),{...P(se,"field_y_axis"),fieldFilterOptions:{forComponent:"areaChart"},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"},{...P(se,"field_x_axis"),fieldFilterOptions:{forComponent:"areaChart",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:(e,o)=>Nr(e,o),getValues:e=>Zo(e),maxAllowed:2,testId:"add-dimension"},P(se,"sort"),P(se,"filter"),P(se,"custom_metrics"),P(se,"limit")],formatPanelConfig:()=>[F1(se),{...P(se,"chart_styles"),subSection:[se.format_panel.chart_styles?.subSectionDefinition.stacked,se.format_panel.chart_styles?.subSectionDefinition.legend,se.format_panel.chart_styles?.subSectionDefinition.curve]},Ge(se),{...P(se,"conditional_formatting"),ruleType:"areaColor"},P(se,"goal_line"),P(se,"headline")],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!0,colorGradient:!1}});var cz=(t=>(t.Forecast="Forecast",t.MovingAverage="Moving Average",t.Trend="Trend",t))(cz||{});const G_=R.object({type:R.string().valid(cz.Forecast),value:R.number()}),V_=R.object({type:R.string().valid(cz.Trend),value:R.number()}),H_=R.object({value:R.number().required()}),Y_=R.object({type:R.string().valid(cz.MovingAverage),averages:R.array().items(H_).required()}),sz=()=>R.array().items(R.alternatives(G_,V_,Y_)),tu=t=>R.object({...Y1(t.attributesSchemaOptions),...c2(t.queryEngineConfig,t.attributesSchemaOptions),stacked:R.valid(!0,!1),legend:R.valid(!0,!1),labels:R.valid(!0,!1).optional(),type:R.valid("areaChartV2").required(),parameters:ft(t.queryEngineConfig,t.attributesSchemaOptions),lineCurve:Q6,conditionalFormattingRules:Wt(t.queryEngineConfig),goalLines:Vt(),axisTitles:qt(),headline:X2(),tags:H1(),trends:sz()}),K_=t=>(e,o)=>{let n=I1(e,o,tu(t));return n=wt(n),n},O2=(t,e,o)=>{let n=P0.cloneDeep(yr(e.fields,{onlyFieldTypes:["boolean","string"]})),b=P0.cloneDeep(yr(e.fields,{onlyFieldTypes:["date_time"]})),a=P0.cloneDeep(yr(e.fields,{onlyFieldTypes:["number"]})),O=null;return b[0]&&(O={field:b[0].id,truncate:"none"}),o(t,{protectedByOrganisation:!0,dimension:n.map(c=>({field:c.id,function:"none"})),measure:[...a].map(c=>({function:"none",field:c.id})),order:[],timeDimension:O})},Ze={title:"Area chart",description:"Ideal for illustrating changes and trends over time with area graphs.",namespace:"area_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this area chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each area to measure?",callToAction:"Add metric"},drilldown:{type:"drilldown",title:"Drilldown",description:"After clicking on a segment of this area chart, what information do you want to see next?"},field_x_axis:{type:"fieldCollector",title:"Grouping - X Axis",description:"What do you want each area to represent? An example might be a `product category` field to represent each category as a area.",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this area chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this area chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{stacked:{type:"stacked",title:"Layout",description:"",namespace:"stacked"},curve:{type:"curve",title:"Area Style",description:"",namespace:"curve"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"},labels:{type:"labels",title:"Show Labels",description:"",namespace:"labels"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""},headline:{type:"headline",title:"Headarea",description:""},trends:{type:"trends",title:"Trend lines",description:"Specify a trend type for the area chart."},goal_line:{type:"goalLine",title:"Goal lines",description:""}}},ou=t=>({title:"Area chart",description:"Ideal for illustrating changes and trends over time with area graphs.",servicesClass:"AreaChart",namespace:"area_chart",dump:e=>e,load:e=>({type:e.type,measure:g1(e.measure),order:me(e.order,e.timeDimension),dimension:Oe(e.dimension),displayTitle:e.displayTitle,displaySubject:e.displaySubject,protectedByOrganisation:e.protectedByOrganisation,viewId:k0(e.viewId),filter:V1(e.filter),dataSetId:e.dataSetId,limit:e.limit,timeDimension:null,xAxisPostfix:e.xAxisPostfix,xAxisPrefix:e.xAxisPrefix,yAxisPostfix:e.yAxisPostfix,yAxisPrefix:e.yAxisPrefix,yAxisFormat:e.yAxisFormat,xAxisFormat:e.xAxisFormat,lineCurve:e.lineCurve,conditionalFormattingRules:St(t.queryEngineConfig,e.conditionalFormattingRules),drilldown:e.drilldown,legend:e.legend,labels:e.labels,goalLines:e.goalLines,headline:ho(e.headline,e.timeDimension),parameters:ut(e.parameters),approxXAxisLabelCount:R1(e.approxXAxisLabelCount),approxYAxisLabelCount:R1(e.approxYAxisLabelCount),axisTitles:e.axisTitles,tags:e.tags??[],trends:e.trends??[],stacked:e.stacked}),setAttributes:K_(t),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"areaChartV2",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:k0(o?.viewId),filter:[],order:[],dataSetId:e,limit:5e3,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,lineCurve:"natural",conditionalFormattingRules:[],drilldown:[],legend:!0,labels:!1,goalLines:void 0,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",parameters:{},axisTitles:void 0,headline:void 0,tags:[],trends:[],stacked:!1,...o}),createFeedback:we,schema:tu(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),isRunnable:e=>e.measure.length>0&&e.dimension.length>0,autoGenerate(e){const{measure:o,dimension:n}=le(e,t.queryEngineConfig,"lineChart");return this.init(e.id,{measure:[o[0]],dimension:n})},dataPanelConfig:()=>[P(Ze,"data_set"),P(Ze,"views"),{...P(Ze,"field_y_axis"),fieldFilterOptions:{forComponent:"lineChart"},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"},{...P(Ze,"field_x_axis"),fieldFilterOptions:{forComponent:"lineChart",onlyDimensions:!0},preventDuplicates:!1,preSetPartialAttributes:e=>({dimension:[...e]}),getValues:e=>[...e.dimension],maxAllowed:2,testId:"add-dimension"},P(Ze,"sort"),P(Ze,"filter"),P(Ze,"custom_metrics"),P(Ze,"limit")],formatPanelConfig:()=>[F1(Ze),{...P(Ze,"chart_styles"),subSection:[Ze.format_panel.chart_styles?.subSectionDefinition.legend,Ze.format_panel.chart_styles?.subSectionDefinition.labels]},Ge(Ze),{...P(Ze,"conditional_formatting"),ruleType:"lineColor"},P(Ze,"goal_line")],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet(e,o){return O2(e,o,this.setAttributes)}});function jO(t){return R.array().items(R.object({field:R.string().required(),function:R.string().valid(...Object.keys(t.supportedAggregates),...Object.keys(t.supportedTimeTruncFunctions),"none")}))}const Gn=t=>R.object({...Y1(t.attributesSchemaOptions),...c2(t.queryEngineConfig,t.attributesSchemaOptions),stacked:R.valid(!0,!1,"100%"),legend:R.valid(!0,!1),labels:R.valid(!0,!1).optional(),type:R.valid("barChart","horizontalBarChart","funnelChart").required(),conditionalFormattingRules:Wt(t.queryEngineConfig),protectedFields:R.object({dimension:CA(t.queryEngineConfig),measure:OO(t.queryEngineConfig)}).unknown(!0),parameters:ft(t.queryEngineConfig,t.attributesSchemaOptions),goalLines:Vt(),axisTitles:qt(),headline:X2(),tags:H1(),drilldownOptions:jO(t.queryEngineConfig)}),Q_=t=>(e,o)=>{let n=I1(e,o,Gn(t));return n=wt(n),n},ve={title:"Column chart",description:"Uses bars to compare different sets of data.",namespace:"bar_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this bar chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each bar to measure?",callToAction:"Add metric"},drilldown:{type:"drilldown",title:"Drilldown",description:"After clicking on a segment of this bar chart, what information do you want to see next?"},field_x_axis:{type:"fieldCollector",title:"Grouping - X Axis",description:"What do you want each bar to represent? An example might be a `product category` field to represent each category as a bar.",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this bar chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this bar chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{stacked:{type:"stacked",title:"Layout",description:"",namespace:"stacked"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},headline:{type:"headline",title:"Headline",description:""},goal_line:{type:"goalLine",title:"Goal Lines",description:""},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""}}},ru=t=>({title:ve.title,description:ve.description,servicesClass:"BarChart",namespace:ve.namespace,dump:e=>e,load:e=>({...e,measure:g1(e.measure),order:me(e.order,e.timeDimension),filter:V1(e.filter),viewId:k0(e.viewId),dimension:Oe(e.dimension),approxXAxisLabelCount:R1(e.approxXAxisLabelCount),approxYAxisLabelCount:R1(e.approxYAxisLabelCount),parameters:ut(e.parameters),conditionalFormattingRules:St(t.queryEngineConfig,e.conditionalFormattingRules),headline:ho(e.headline,e.timeDimension),tags:e.tags??[],drilldownOptions:e.drilldownOptions}),setAttributes:Q_(t),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"barChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",viewId:k0(o?.viewId),filter:[],order:[],stacked:void 0,dataSetId:e,limit:5e3,conditionalFormattingRules:[],protectedByOrganisation:void 0,protectedFields:void 0,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,drilldown:[],legend:!0,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",parameters:{},goalLines:void 0,axisTitles:void 0,headline:void 0,tags:[],drilldownOptions:void 0,...o}),createFeedback:we,schema:Gn(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(e){const{measure:o,dimension:n}=le(e,t.queryEngineConfig,"barChart");return this.init(e.id,{measure:[o[0]],dimension:n})},dataPanelConfig:()=>[P(ve,"data_set"),P(ve,"views"),{...P(ve,"field_y_axis"),fieldFilterOptions:{forComponent:"barChart",onlyMeasures:!0},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"},{...P(ve,"field_x_axis"),fieldFilterOptions:{forComponent:"barChart",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:(e,o)=>Nr(e,o),getValues:e=>Zo(e),maxAllowed:2,testId:"add-dimension"},P(ve,"sort"),P(ve,"filter"),{...P(ve,"drilldown"),options:{property:"drilldownOptions"}},P(ve,"custom_metrics"),P(ve,"limit")],formatPanelConfig:()=>[F1(ve),Un(ve,!1,!0),Ge(ve),{...P(ve,"conditional_formatting"),ruleType:"backgroundColor"},P(ve,"goal_line"),P(ve,"headline")],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet(e,o){return O2(e,o,this.setAttributes)}}),nu=t=>R.object({...Y1(t.attributesSchemaOptions),...c2(t.queryEngineConfig,t.attributesSchemaOptions),stacked:R.valid(!0,!1,"100%"),legend:R.valid(!0,!1),labels:R.valid(!0,!1).optional(),type:R.valid("barChartV2").required(),parameters:ft(t.queryEngineConfig,t.attributesSchemaOptions),conditionalFormattingRules:Wt(t.queryEngineConfig),goalLines:Vt(),axisTitles:qt(),headline:X2(),tags:H1()}),Z_=t=>(e,o)=>{let n=I1(e,o,nu(t));return n=wt(n),n},je={title:"Bar chart",description:"Ideal for illustrating changes and trends over time with bar graphs.",namespace:"bar_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this bar chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each bar to measure?",callToAction:"Add metric"},field_x_axis:{type:"fieldCollector",title:"Grouping - X Axis",description:"What do you want each bar to represent? An example might be a `product category` field to represent each category as a bar.",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this bar chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this bar chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{stacked:{type:"stacked",title:"Layout",description:"",namespace:"stacked"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"},labels:{type:"labels",title:"Show Labels",description:"",namespace:"labels"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""},headline:{type:"headline",title:"Headline",description:""},goal_line:{type:"goalLine",title:"Goal Lines",description:""}}},iu=t=>({title:"Bar chart",description:"Ideal for illustrating changes and trends over time with bar graphs.",servicesClass:"BarChart",namespace:"bar_chart",dump:e=>e,load:e=>({type:e.type,measure:g1(e.measure),order:me(e.order,e.timeDimension),dimension:Oe(e.dimension),displayTitle:e.displayTitle,displaySubject:e.displaySubject,protectedByOrganisation:e.protectedByOrganisation,viewId:k0(e.viewId),filter:V1(e.filter),dataSetId:e.dataSetId,limit:e.limit,timeDimension:null,xAxisPostfix:e.xAxisPostfix,xAxisPrefix:e.xAxisPrefix,yAxisPostfix:e.yAxisPostfix,yAxisPrefix:e.yAxisPrefix,yAxisFormat:e.yAxisFormat,xAxisFormat:e.xAxisFormat,conditionalFormattingRules:St(t.queryEngineConfig,e.conditionalFormattingRules),legend:e.legend,labels:e.labels,goalLines:e.goalLines,headline:ho(e.headline,e.timeDimension),parameters:ut(e.parameters),approxXAxisLabelCount:R1(e.approxXAxisLabelCount),approxYAxisLabelCount:R1(e.approxYAxisLabelCount),axisTitles:e.axisTitles,tags:e.tags??[],stacked:e.stacked}),setAttributes:Z_(t),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"barChartV2",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:k0(o?.viewId),filter:[],order:[],dataSetId:e,limit:5e3,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,conditionalFormattingRules:[],legend:!0,labels:!1,goalLines:void 0,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",parameters:{},axisTitles:void 0,headline:void 0,tags:[],...o}),createFeedback:we,schema:nu(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),isRunnable:e=>e.measure.length>0&&e.dimension.length>0,autoGenerate(e){const{measure:o,dimension:n}=le(e,t.queryEngineConfig,"barChart");return this.init(e.id,{measure:[o[0]],dimension:n})},dataPanelConfig:()=>[P(je,"data_set"),P(je,"views"),{...P(je,"field_y_axis"),fieldFilterOptions:{forComponent:"barChart"},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"},{...P(je,"field_x_axis"),fieldFilterOptions:{forComponent:"barChart",onlyDimensions:!0},preventDuplicates:!1,preSetPartialAttributes:e=>({dimension:[...e]}),getValues:e=>[...e.dimension],maxAllowed:2,testId:"add-dimension"},P(je,"sort"),P(je,"filter"),P(je,"custom_metrics"),P(je,"limit")],formatPanelConfig:()=>[F1(je),{...P(je,"chart_styles"),subSection:[je.format_panel.chart_styles?.subSectionDefinition.stacked,je.format_panel.chart_styles?.subSectionDefinition.legend,je.format_panel.chart_styles?.subSectionDefinition.labels]},Ge(je),{...P(je,"conditional_formatting"),ruleType:"lineColor"},P(je,"goal_line")],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet(e,o){return O2(e,o,this.setAttributes)}}),J_=R.object({field:R.string().required(),function:R.valid("none").required()}),bu=t=>R.object({...Y1(t.attributesSchemaOptions),type:R.valid("basicTable").required(),measure:R.array().items(J_).required(),dimension:R.array().max(0),order:R.array().items(uo(t.queryEngineConfig)),timeDimension:R.valid(null),limit:Gt().required(),offset:R.number().min(0),filter:z2(t.queryEngineConfig),prefixes:R.array().items(PA),exportNames:R.object(),numberFormat:R.object(),conditionalFormattingRules:Wt(t.queryEngineConfig),dateTimeFormat:R.string(),protectedFields:R.object({measure:OO(t.queryEngineConfig)}).unknown(!0),sizing:DA,tags:H1(),hiddenFields:R.array().items(R.string())}),Ns=t=>(e,o)=>{let n=I1(e,o,bu(t));return n=Dn(n,[...n.measure]),n},Xe={title:"Basic table",description:"Displays data in a simple, straightforward table format.",namespace:"basic_table",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this basic table?"},views:{type:"views",title:"View",description:""},fields:{type:"fields",title:"Columns",description:"Select which values you want to see in this table"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this basic table."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},pagination:{type:"pagination",title:"Pagination",description:"Define the size for each page in the table"}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{type:"subject",title:"Subject",description:"",namespace:"subject"}}},format:{type:"format",title:"Format",description:"",subSectionDefinition:{time:{type:"time",title:"Time",description:"",namespace:"time"}}},prefixes:{type:"prefixes",title:"Prefixes",description:""},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""},visual_format:{type:"visualFormat",title:"Visual Format",description:"Configure how group columns are visually represented"},kpi_summarisation:{type:"kpiSummarisation",title:"",description:"Show aggregate statistics above column headers"}}},pu=[3,5,10,20,50,100,200],au=t=>({title:Xe.title,description:Xe.description,servicesClass:"BasicTable",namespace:Xe.namespace,dump:e=>e,load:e=>({...e,measure:g1(e.measure),order:me(e.order,e.timeDimension),filter:V1(e.filter),dimension:Oe(e.dimension),viewId:k0(e.viewId),conditionalFormattingRules:St(t.queryEngineConfig,e.conditionalFormattingRules),tags:e.tags??[],hiddenFields:e.hiddenFields??[]}),setAttributes:Ns(t),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:function(e,o){const n={type:"basicTable",measure:[],displayTitle:"",dimension:[],timeDimension:null,displaySubject:"",filter:[],order:[],tags:[],hiddenFields:[],dataSetId:e,viewId:k0(o?.viewId),protectedFields:void 0,limit:50,offset:0,conditionalFormattingRules:[],prefixes:[],dateTimeFormat:"DD MMMM YYYY, hh:mm",exportNames:{},numberFormat:{},sizing:{}};return Ns(t)(n,o||{})},schema:bu(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),setFields:function(e,o){const n=[...o].map(b=>({field:b,function:"none"}));return Ns(t)(e,{measure:n})},setDateTimeFormat:function(e,o){return this.setAttributes(e,{dateTimeFormat:o})},isRunnable:e=>e.measure.length>0,autoGenerate(e){const n=[...yr(e.fields,{forComponent:"basicTable",onlyMeasures:!0,removeAggregateMaths:!0,removePercentage:!0})].map(b=>({field:b.id,function:"none"}));return this.init(e.id,{measure:n.slice(0,5)})},dataPanelConfig:()=>[P(Xe,"data_set"),P(Xe,"views"),P(Xe,"fields"),P(Xe,"sort"),{...P(Xe,"pagination"),options:pu},P(Xe,"filter"),P(Xe,"custom_metrics")],formatPanelConfig:()=>[F1(Xe),{...P(Xe,"format"),subSection:[Xe.format_panel.format?.subSectionDefinition.time]},P(Xe,"prefixes"),{...P(Xe,"conditional_formatting"),ruleType:"backgroundColor"},P(Xe,"visual_format"),P(Xe,"kpi_summarisation")],supportedCustomFields:{percentages:!1,simpleMaths:!0,rules:!0,aggregateMaths:!1,roundedNumbers:!0,dateCalculations:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement]},supportedFeatures:{parameters:!1,colorGradient:!0}}),Mu=t=>R.object({...Y1(t.attributesSchemaOptions),xMeasure:he(t.queryEngineConfig.supportedAggregates,t.attributesSchemaOptions).allow(null),yMeasure:he(t.queryEngineConfig.supportedAggregates,t.attributesSchemaOptions).allow(null),zMeasure:he(t.queryEngineConfig.supportedAggregates,t.attributesSchemaOptions).allow(null),dimension:Bt(t.queryEngineConfig.supportedTimeTruncFunctions,t.attributesSchemaOptions),order:R.array().items(uo(t.queryEngineConfig)),limit:Gt(),legend:R.valid(!0,!1),offset:R.number().min(0),filter:z2(t.queryEngineConfig),type:R.valid("bubbleChart").required(),timeDimension:R.valid(null),xAxisPrefix:R.string().allow(""),yAxisPrefix:R.string().allow(""),xAxisPostfix:R.string().allow(""),yAxisPostfix:R.string().allow(""),yAxisFormat:R.alternatives(R.string(),R.valid(null)),xAxisFormat:R.alternatives(R.string(),R.valid(null)),approxYAxisLabelCount:S2,approxXAxisLabelCount:S2,goalLines:Vt(),axisTitles:qt(),tags:H1()}),eN=t=>(e,o)=>{let n=I1(e,o,Mu(t)),b=[];return n.xMeasure&&b.push(n.xMeasure),n.yMeasure&&b.push(n.yMeasure),n.zMeasure&&b.push(n.zMeasure),n.dimension.forEach(a=>{b.push({field:a.field,function:a.function})}),n=Dn(n,b),n},_e={title:"Bubble chart",description:"Displays data points on a Cartesian plane, with a third metric corresponding to bubble size.",namespace:"bubble_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this bubble chart?"},views:{type:"views",title:"View",description:""},labelled_metrics:{type:"labelledMetrics",title:"Metric - Y Axis",description:"",subSectionDefinition:{xAxis:{type:"metrics",title:"X axis",namespace:"metrics.xAxis"},yAxis:{type:"metrics",title:"Y axis",namespace:"metrics.yAxis"},zAxis:{type:"metrics",title:"Metric - Bubble Size",namespace:"metrics.zAxis"}}},field_grouping:{type:"fieldCollector",title:"Grouping",description:"What do you want each bubble to represent?",callToAction:"Add comparison"},filter:{type:"filter",title:"Filters",description:"Only include the information you want in this bubble chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Limit the number of data points shown on this bubble chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"},z:{title:"Metric - Bubble Size",description:"",namespace:"z"},"z.prefix":{title:"Prefix",description:"",namespace:"z.prefix"},"z.postfix":{title:"Postfix",description:"",namespace:"z.postfix"},"z.format":{title:"Format",description:"",namespace:"z.format"},"z.count":{title:"Label count",description:"",namespace:"z.count"},"z.axis_title":{title:"Title",description:"",namespace:"z.axis_title"}}},goal_line:{type:"goalLine",title:"Goal Lines",description:""}}},zu=t=>({title:_e.title,description:_e.description,servicesClass:"BubbleChart",namespace:_e.namespace,dump:e=>e,load:e=>({type:e.type,xMeasure:g1(e.xMeasure?[e.xMeasure]:[])[0]||null,yMeasure:g1(e.yMeasure?[e.yMeasure]:[])[0]||null,zMeasure:g1(e.zMeasure?[e.zMeasure]:[])[0]||null,dimension:Oe(e.dimension),viewId:k0(e.viewId),timeDimension:e.timeDimension,displayTitle:e.displayTitle,displaySubject:e.displaySubject,protectedByOrganisation:e.protectedByOrganisation,filter:V1(e.filter),order:me(e.order,e.timeDimension),dataSetId:e.dataSetId,limit:e.limit,legend:e.legend,xAxisFormat:e.xAxisFormat,yAxisFormat:e.yAxisFormat,yAxisPostfix:e.yAxisPostfix,yAxisPrefix:e.yAxisPrefix,xAxisPostfix:e.xAxisPostfix,xAxisPrefix:e.xAxisPrefix,approxXAxisLabelCount:R1(e.approxXAxisLabelCount),approxYAxisLabelCount:R1(e.approxYAxisLabelCount),goalLines:e.goalLines,axisTitles:e.axisTitles,tags:e.tags??[]}),setAttributes:eN(t),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"bubbleChart",xMeasure:null,yMeasure:null,zMeasure:null,dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:k0(o?.viewId),filter:[],order:[],dataSetId:e,limit:5e3,legend:!0,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",goalLines:void 0,axisTitles:void 0,tags:[],...o}),createFeedback:we,schema:Mu(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),isRunnable:e=>!!e.xMeasure&&!!e.yMeasure&&!!e.zMeasure&&e.dimension.length>0,autoGenerate(e){const{measure:o,dimension:n}=le(e,t.queryEngineConfig,"bubbleChart");return this.init(e.id,{xMeasure:o[0],yMeasure:o[1],dimension:n})},dataPanelConfig:()=>[P(_e,"data_set"),P(_e,"views"),{...P(_e,"labelled_metrics"),subSection:[{..._e.data_panel.labelled_metrics?.subSectionDefinition.xAxis,propKey:"xMeasure",allowsMultiple:!1},{..._e.data_panel.labelled_metrics?.subSectionDefinition.yAxis,propKey:"yMeasure",allowsMultiple:!1},{..._e.data_panel.labelled_metrics?.subSectionDefinition.zAxis,propKey:"zMeasure",allowsMultiple:!1}]},{...P(_e,"field_grouping"),fieldFilterOptions:{onlyDimensions:!0,onlyFieldTypes:["boolean","number","string"],removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},maxAllowed:1,preSetPartialAttributes:e=>({dimension:e}),getValues:e=>e.dimension,testId:"add-dimension"},P(_e,"filter"),P(_e,"custom_metrics"),P(_e,"limit")],formatPanelConfig:()=>[F1(_e),{...P(_e,"chart_styles"),subSection:[_e.format_panel.chart_styles?.subSectionDefinition.legend]},Ge(_e),P(_e,"goal_line")],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!1,colorGradient:!1}}),cu=t=>R.object({...Y1(t.attributesSchemaOptions),...c2(t.queryEngineConfig,t.attributesSchemaOptions),zMeasure:R.array().items(he(t.queryEngineConfig.supportedAggregates,t.attributesSchemaOptions)).required().description("A list of metrics that are to be shown. For example the `count` of a specific field in your data set."),xMeasure:R.array().items(he(t.queryEngineConfig.supportedAggregates,t.attributesSchemaOptions)).required().description("A list of metrics that are to be shown. For example the `count` of a specific field in your data set."),stacked:R.valid(!0,!1,"100%"),legend:R.valid(!0,!1),type:R.valid("bubbleChartV2").required(),parameters:ft(t.queryEngineConfig,t.attributesSchemaOptions),lineCurve:UM,quadrants:EA(),conditionalFormattingRules:Wt(t.queryEngineConfig),goalLines:Vt(),axisTitles:qt(),headline:X2(),tags:H1(),trends:sz()}),tN=t=>(e,o)=>{let n=I1(e,o,cu(t));return n=wt(n),n},Ce={title:"Bubble chart",description:"Displays data points on a Cartesian plane, with a third metric corresponding to bubble size.",namespace:"bubble_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this bubble chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each bubble to measure?",callToAction:"Add metric"},drilldown:{type:"drilldown",title:"Drilldown",description:"After clicking on a segment of this line chart, what information do you want to see next?"},field_x_axis:{type:"fieldCollector",title:"Metric - X Axis",description:"What do you want each line to represent? An example might be a `product category` field to represent each category as a line.",callToAction:"Add metric"},field_z_axis:{type:"fieldCollector",title:"Metric - Bubble Size",description:"What do you want each bubble to represent? An example might be a `product category` field to represent each category as a bubble.",callToAction:"Add metric"},field_grouping:{type:"fieldCollector",title:"Grouping - Bubble series",description:"How do you want to group each bubble?",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this bubble chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this bubble chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{curve:{type:"curve",title:"Line Style",description:"",namespace:"curve"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},quadrants:{type:"quadrants",title:"",description:""},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""},headline:{type:"headline",title:"Headline",description:""},trends:{type:"trends",title:"Trend lines",description:"Specify a trend type for the line chart."},goal_line:{type:"goalLine",title:"Goal Lines",description:""}}},su=t=>({title:"Bubble chart",description:Ce.description,servicesClass:"BubbleChartV2",namespace:"bubble_chart",dump:e=>e,load:e=>({type:e.type,measure:g1(e.measure),zMeasure:g1(e.measure),xMeasure:g1(e.xMeasure),order:me(e.order,e.timeDimension),dimension:Oe(e.dimension),displayTitle:e.displayTitle,displaySubject:e.displaySubject,protectedByOrganisation:e.protectedByOrganisation,viewId:k0(e.viewId),filter:V1(e.filter),dataSetId:e.dataSetId,limit:e.limit,timeDimension:null,xAxisPostfix:e.xAxisPostfix,xAxisPrefix:e.xAxisPrefix,yAxisPostfix:e.yAxisPostfix,yAxisPrefix:e.yAxisPrefix,yAxisFormat:e.yAxisFormat,xAxisFormat:e.xAxisFormat,lineCurve:e.lineCurve,quadrants:e.quadrants,conditionalFormattingRules:St(t.queryEngineConfig,e.conditionalFormattingRules),drilldown:e.drilldown,legend:e.legend,goalLines:e.goalLines,headline:ho(e.headline,e.timeDimension),parameters:ut(e.parameters),approxXAxisLabelCount:R1(e.approxXAxisLabelCount),approxYAxisLabelCount:R1(e.approxYAxisLabelCount),axisTitles:e.axisTitles,tags:e.tags??[],trends:e.trends??[]}),setAttributes:tN(t),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"bubbleChartV2",measure:[],zMeasure:[],xMeasure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:k0(o?.viewId),filter:[],order:[],dataSetId:e,limit:5e3,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,lineCurve:"natural",quadrants:void 0,conditionalFormattingRules:[],drilldown:[],legend:!0,goalLines:void 0,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",parameters:{},axisTitles:void 0,headline:void 0,tags:[],trends:[],...o}),createFeedback:we,schema:cu(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),isRunnable:e=>e.measure.length>0&&e.dimension.length>0&&e.xMeasure.length>0&&e.zMeasure.length>0,autoGenerate(e){const{measure:o,dimension:n}=le(e,t.queryEngineConfig,"bubbleChartV2");return this.init(e.id,{measure:[o[0]],dimension:n,zMeasure:[o[0]],xMeasure:[o[0]]})},dataPanelConfig:()=>[P(Ce,"data_set"),P(Ce,"views"),{...P(Ce,"field_y_axis"),fieldFilterOptions:{forComponent:"bubbleChartV2"},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,maxAllowed:1,testId:"metric-input",propKey:"yMeasure"},{...P(Ce,"field_x_axis"),fieldFilterOptions:{forComponent:"bubbleChartV2",onlyMeasures:!0,onlyDimensions:!1},preSetPartialAttributes:e=>({xMeasure:[...e]}),getValues:e=>[...e.xMeasure],maxAllowed:1,testId:"x-metric-axis"},{...P(Ce,"field_z_axis"),fieldFilterOptions:{forComponent:"bubbleChartV2"},preSetPartialAttributes:e=>({zMeasure:[...e]}),getValues:e=>e.zMeasure,testId:"metric-input-z",maxAllowed:1,propKey:"zMeasure"},{...P(Ce,"field_grouping"),fieldFilterOptions:{forComponent:"bubbleChartV2",onlyDimensions:!0},preSetPartialAttributes:e=>({dimension:[...e]}),getValues:e=>[...e.dimension],maxAllowed:1,testId:"bubble-dimension"},P(Ce,"sort"),P(Ce,"filter"),P(Ce,"custom_metrics"),P(Ce,"limit")],formatPanelConfig:()=>[F1(Ce),Un(Ce,!0,!1),Ge(Ce),P(Ce,"quadrants"),{...P(Ce,"conditional_formatting"),ruleType:"lineColor"},P(Ce,"goal_line")],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet(e,o){return O2(e,o,this.setAttributes)}}),Ou=t=>R.object({...Y1(t.attributesSchemaOptions),stacked:R.valid(!0,!1,"100%"),legend:R.valid(!0,!1),barMeasure:R.array().items(he(t.queryEngineConfig.supportedAggregates,t.attributesSchemaOptions)),lineMeasure:R.array().items(he(t.queryEngineConfig.supportedAggregates,t.attributesSchemaOptions)),barDimension:Bt(t.queryEngineConfig.supportedTimeTruncFunctions,t.attributesSchemaOptions),lineDimension:Bt(t.queryEngineConfig.supportedTimeTruncFunctions,t.attributesSchemaOptions),order:R.array().items(uo(t.queryEngineConfig)),timeDimension:R.alternatives(In(t.queryEngineConfig.supportedTimeTruncFunctions),R.valid(null)),limit:Gt(),offset:R.number().min(0),filter:z2(t.queryEngineConfig),type:R.valid("comboChart").required(),xAxisPrefix:R.string().allow(""),yAxisPrefix:R.string().allow(""),xAxisPostfix:R.string().allow(""),yAxisPostfix:R.string().allow(""),yAxisFormat:R.alternatives(R.string(),R.valid(null)),xAxisFormat:R.alternatives(R.string(),R.valid(null)),approxYAxisLabelCount:S2,approxXAxisLabelCount:S2,goalLines:Vt(),conditionalFormattingRules:R.object({bar:R.array().items(eb(t.queryEngineConfig)),line:R.array().items(eb(t.queryEngineConfig))}),axisTitles:qt(),tags:H1()}),oN=t=>(e,o)=>{let n=I1(e,o,Ou(t)),b=[...n.lineMeasure,...n.barMeasure];return[...n.lineDimension,...n.barDimension].forEach(a=>{b.push({field:a.field,function:a.function})}),n.timeDimension&&b.push({field:n.timeDimension.field,function:n.timeDimension.truncate}),n=Dn(n,b),n};function lu(t,e){return{...t,lineMeasure:g1(t.lineMeasure),barMeasure:g1(t.barMeasure),order:me(t.order,t.timeDimension||null),filter:V1(t.filter),lineDimension:Oe(t.lineDimension||t.dimension||[]),barDimension:Oe(t.barDimension||t.dimension||[]),viewId:k0(t.viewId),approxXAxisLabelCount:R1(t.approxXAxisLabelCount),approxYAxisLabelCount:R1(t.approxYAxisLabelCount),conditionalFormattingRules:{bar:St(e,t.conditionalFormattingRules?.bar),line:St(e,t.conditionalFormattingRules?.line)},tags:t.tags??[]}}const ee={title:"Combo chart",description:"A versatile component that combines different chart types.",namespace:"combo_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this combo chart?"},views:{type:"views",title:"View",description:""},labelled_metrics:{type:"labelledMetrics",title:"Metric - Y Axis",description:"What do you want each line and bar to measure?",subSectionDefinition:{line:{type:"metrics",title:"Line",namespace:"metrics.line"},bar:{type:"metrics",title:"Bar",namespace:"metrics.bar"}}},combo_chart_dimension:{type:"comboChartDimension",title:"Grouping - X Axis",description:""},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this combo chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this bar chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{stacked:{type:"stacked",title:"Layout",description:"",namespace:"stacked"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},goal_line:{type:"goalLine",title:"Goal Lines",description:""},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:"",subSectionDefinition:{bar:{title:"Bar",namespace:"bar"},line:{title:"Line",namespace:"line"}}}}},Au=t=>({title:ee.title,description:ee.description,servicesClass:"ComboChart",namespace:ee.namespace,dump:e=>e,load:e=>lu(e,t.queryEngineConfig),setAttributes:oN(t),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"comboChart",barMeasure:[],lineMeasure:[],lineDimension:[],barDimension:[],timeDimension:null,displayTitle:"",displaySubject:"",viewId:k0(o?.viewId),filter:[],order:[],dataSetId:e,limit:5e3,xAxisPostfix:"",protectedByOrganisation:void 0,xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,legend:!0,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",goalLines:void 0,conditionalFormattingRules:void 0,axisTitles:void 0,tags:[],...o}),createFeedback:we,schema:Ou(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),isRunnable:e=>e.lineMeasure.length>0||e.barMeasure.length>0,autoGenerate(e){const{measure:o,dimension:n}=le(e,t.queryEngineConfig,"comboChart");return this.init(e.id,{barMeasure:[o[0]],lineMeasure:[o[1]||o[0]],barDimension:n,lineDimension:n})},dataPanelConfig:()=>[P(ee,"data_set"),P(ee,"views"),{...P(ee,"labelled_metrics"),subSection:[{...ee.data_panel.labelled_metrics?.subSectionDefinition.line,propKey:"lineMeasure",allowsMultiple:!0},{...ee.data_panel.labelled_metrics?.subSectionDefinition.bar,propKey:"barMeasure",allowsMultiple:!0}]},P(ee,"combo_chart_dimension"),P(ee,"sort"),P(ee,"filter"),P(ee,"custom_metrics"),P(ee,"limit")],formatPanelConfig:()=>[F1(ee),Un(ee,!1,!0),Ge(ee),{...P(ee,"conditional_formatting"),ruleType:"backgroundColor",subSection:[{title:ee.format_panel.conditional_formatting?.subSectionDefinition?.bar.title??"",namespace:ee.format_panel.conditional_formatting?.subSectionDefinition?.bar.namespace,propKey:"bar"},{title:ee.format_panel.conditional_formatting?.subSectionDefinition?.line.title??"",namespace:ee.format_panel.conditional_formatting?.subSectionDefinition?.line.namespace,propKey:"line"}]},P(ee,"goal_line")],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!1,colorGradient:!1}}),du=t=>R.object({...Y1(t.attributesSchemaOptions),stacked:R.valid(!0,!1),legend:R.valid(!0,!1),labels:R.valid(!0,!1).optional(),barMeasure:R.array().items(he(t.queryEngineConfig.supportedAggregates,t.attributesSchemaOptions)),lineMeasure:R.array().items(he(t.queryEngineConfig.supportedAggregates,t.attributesSchemaOptions)),barDimension:Bt(t.queryEngineConfig.supportedTimeTruncFunctions,t.attributesSchemaOptions),lineDimension:Bt(t.queryEngineConfig.supportedTimeTruncFunctions,t.attributesSchemaOptions),order:R.array().items(uo(t.queryEngineConfig)),timeDimension:R.alternatives(In(t.queryEngineConfig.supportedTimeTruncFunctions),R.valid(null)),limit:Gt(),offset:R.number().min(0),filter:z2(t.queryEngineConfig),type:R.valid("comboChartV2").required(),xAxisPrefix:R.string().allow(""),yAxisPrefix:R.string().allow(""),xAxisPostfix:R.string().allow(""),yAxisPostfix:R.string().allow(""),yAxisFormat:R.alternatives(R.string(),R.valid(null)),xAxisFormat:R.alternatives(R.string(),R.valid(null)),approxYAxisLabelCount:S2,approxXAxisLabelCount:S2,goalLines:Vt(),conditionalFormattingRules:R.object({bar:R.array().items(eb(t.queryEngineConfig)),line:R.array().items(eb(t.queryEngineConfig))}),axisTitles:qt(),tags:H1()}),rN=t=>(e,o)=>{let n=I1(e,o,du(t)),b=[...n.lineMeasure,...n.barMeasure];return[...n.lineDimension,...n.barDimension].forEach(a=>{b.push({field:a.field,function:a.function})}),n.timeDimension&&b.push({field:n.timeDimension.field,function:n.timeDimension.truncate}),n=Dn(n,b),n},X1={title:"Combo chart",description:"A versatile component that combines different chart types.",namespace:"combo_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this combo chart?"},views:{type:"views",title:"View",description:""},labelled_metrics:{type:"labelledMetrics",title:"Metric - Y Axis",description:"What do you want each line and bar to measure?",subSectionDefinition:{line:{type:"metrics",title:"Line",namespace:"metrics.line"},bar:{type:"metrics",title:"Bar",namespace:"metrics.bar"}}},combo_chart_dimension:{type:"comboChartDimension",title:"Grouping - X Axis",description:""},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this combo chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this bar chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{stacked:{type:"stacked",title:"Layout",description:"",namespace:"stacked"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"},labels:{type:"labels",title:"Show Labels",description:"",namespace:"labels"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},goal_line:{type:"goalLine",title:"Goal Lines",description:""},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:"",subSectionDefinition:{bar:{title:"Bar",namespace:"bar"},line:{title:"Line",namespace:"line"}}}}},uu=t=>({title:X1.title,description:X1.description,servicesClass:"ComboChartV2",namespace:X1.namespace,dump:e=>e,load:e=>lu(e,t.queryEngineConfig),setAttributes:rN(t),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"comboChartV2",barMeasure:[],lineMeasure:[],lineDimension:[],barDimension:[],timeDimension:null,displayTitle:"",displaySubject:"",viewId:k0(o?.viewId),filter:[],order:[],dataSetId:e,limit:5e3,xAxisPostfix:"",protectedByOrganisation:void 0,xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,legend:!0,labels:!1,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",goalLines:void 0,conditionalFormattingRules:void 0,axisTitles:void 0,tags:[],...o}),createFeedback:we,schema:du(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),isRunnable:e=>e.lineMeasure.length>0||e.barMeasure.length>0,autoGenerate(e){const{measure:o,dimension:n}=le(e,t.queryEngineConfig,"comboChart");return this.init(e.id,{barMeasure:[o[0]],lineMeasure:[o[1]||o[0]],barDimension:n,lineDimension:n})},dataPanelConfig:()=>[P(X1,"data_set"),P(X1,"views"),{...P(X1,"labelled_metrics"),subSection:[{...X1.data_panel.labelled_metrics?.subSectionDefinition.line,propKey:"lineMeasure",allowsMultiple:!0},{...X1.data_panel.labelled_metrics?.subSectionDefinition.bar,propKey:"barMeasure",allowsMultiple:!0}]},P(X1,"combo_chart_dimension"),P(X1,"sort"),P(X1,"filter"),P(X1,"custom_metrics"),P(X1,"limit")],formatPanelConfig:()=>[F1(X1),{...P(X1,"chart_styles"),subSection:[X1.format_panel.chart_styles?.subSectionDefinition.stacked,X1.format_panel.chart_styles?.subSectionDefinition.legend,X1.format_panel.chart_styles?.subSectionDefinition.labels]},Ge(X1),{...P(X1,"conditional_formatting"),ruleType:"backgroundColor",subSection:[{title:X1.format_panel.conditional_formatting?.subSectionDefinition?.bar.title??"",namespace:X1.format_panel.conditional_formatting?.subSectionDefinition?.bar.namespace,propKey:"bar"},{title:X1.format_panel.conditional_formatting?.subSectionDefinition?.line.title??"",namespace:X1.format_panel.conditional_formatting?.subSectionDefinition?.line.namespace,propKey:"line"}]},P(X1,"goal_line")],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!1,colorGradient:!1}}),wl=t=>R.object({...Y1(t.attributesSchemaOptions),type:R.valid("custom").required(),customViewId:R.string().required(),tags:H1()}),vn={title:"Progress",description:"Used to show progress towards goals, completion of tasks, or as indicators of performance metrics.",namespace:"progress",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this progress?"},views:{type:"views",title:"View",description:""}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}}}},fu=t=>({title:vn.title,description:vn.description,namespace:vn.namespace,servicesClass:"Custom",dump:e=>e,load:e=>({type:"custom",viewId:k0(e.viewId),customViewId:e.customViewId,displayTitle:e.displayTitle,displaySubject:e.displaySubject,dataSetId:e.dataSetId,tags:e.tags??[],protectedByOrganisation:e.protectedByOrganisation}),setAttributes:(e,o)=>I1(e,o,wl(t)),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"custom",viewId:k0(o?.viewId),customViewId:o?.customViewId||"",dataSetId:e,displaySubject:"",displayTitle:"",tags:[],protectedByOrganisation:void 0}),schema:wl(t),removeField(e,o){return e},isRunnable:()=>!0,autoGenerate(e){return this.init(e.id)},dataPanelConfig:()=>[P(vn,"data_set"),P(vn,"views")],formatPanelConfig:()=>[F1(vn)],supportedCustomFields:{percentages:!1,simpleMaths:!1,rules:!1,aggregateMaths:!1,roundedNumbers:!1,dateCalculations:!1,conditional:!1,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{colorGradient:!1,parameters:!1}}),qu=t=>R.object({...Y1(t.attributesSchemaOptions),type:R.valid("dataTable").required(),measure:R.array().items(he(t.queryEngineConfig.supportedAggregates,t.attributesSchemaOptions)).required(),dimension:Bt(t.queryEngineConfig.supportedTimeTruncFunctions,t.attributesSchemaOptions).required(),order:R.array().items(uo(t.queryEngineConfig)),timeDimension:R.alternatives(In(t.queryEngineConfig.supportedTimeTruncFunctions),R.valid(null)),limit:Gt().required(),offset:R.number().min(0),filter:z2(t.queryEngineConfig),prefixes:R.array().items(PA),exportNames:R.object(),numberFormat:R.object(),conditionalFormattingRules:Wt(t.queryEngineConfig),dateTimeFormat:R.string(),protectedFields:R.object({dimension:CA(t.queryEngineConfig),measure:OO(t.queryEngineConfig)}).unknown(!0),sizing:DA,tags:H1(),hiddenFields:R.array().items(R.string()),tableDrilldown:R.array().items(R.object({subsetDimension:R.string().required().description("The ID of the field in the data set to drill down by.")})).description("Drilldown configuration for a pivot table."),summarizeKPIs:R.boolean().default(!1).description("Enable/disable KPI summarisation above column headers."),visualFormatColumns:R.array().items(R.string().min(1)).default([]).sparse(!1).description("Array of column names to display as horizontal bars."),results:R.array().items(R.object({content:R.array().required(),fields:R.array().items(R.object({id:R.string().required(),publicName:R.string().required(),dataType:R.string().required(),hidden:R.boolean(),fieldId:R.string().required(),function:R.string().required(),outputDataType:R.string().required()}).unknown(!0)).required(),hasMoreResults:R.alternatives([R.boolean(),R.valid(null)])}).unknown(!0)).description("Query results data structure containing fields and content.")}),nN=t=>(e,o)=>{let n=I1(e,o,qu(t));const b=e.dimension.filter(c=>c.pivot==="y").length,a=o.dimension?.filter(c=>c.pivot==="y").length;return(a===void 0?!1:b!==a)&&!o.visualFormatColumns&&(n.visualFormatColumns=[]),n=wt(n),n},ue={title:"Pivot table",description:"Transforms data into a table with dynamic rows and columns.",namespace:"pivot_table",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this data table?"},views:{type:"views",title:"View",description:""},field_columns:{type:"fieldCollector",title:"Group columns",callToAction:"Add group column",description:""},field_rows:{type:"fieldCollector",title:"Group rows",description:"Which field do you want to group each row by? An example might be an employee ID or geographical location",callToAction:"Add group row"},drilldown:{type:"drilldown",title:"Drilldown",description:"Drilldowns in a pivot table reveals underlying data contributing to summarized figures upon clicking."},field_metrics:{type:"fieldCollector",title:"Metrics",description:"Select the columns to show in the data table",callToAction:"Add metric"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this data table."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},pagination:{type:"pagination",title:"Pagination",description:"Define the size for each page in the table"}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},kpi_summarisation:{type:"kpiSummarisation",title:"",description:"Show aggregate statistics above each column."},visual_format:{type:"visualFormat",title:"Visual Format",description:"Configure how the group column is displayed visually."},format:{type:"format",title:"Format",description:"",subSectionDefinition:{time:{type:"time",title:"Time",description:"",namespace:"time"}}},prefixes:{type:"prefixes",title:"Prefixes",description:""},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""}}},wa=(t,e)=>t.filter(o=>o.pivot==e),iN=t=>t.map(e=>({...e,pivot:e.pivot?e.pivot:"x"})),Wu=t=>({title:ue.title,description:ue.description,servicesClass:"PivotTable",namespace:ue.namespace,dump:e=>e,load:e=>({type:e.type,measure:g1(e.measure),order:me(e.order,e.timeDimension||null),displayTitle:e.displayTitle,dimension:iN(Zo({timeDimension:e.timeDimension,dimension:Oe(e.dimension)})),displaySubject:e.displaySubject,protectedByOrganisation:e.protectedByOrganisation,protectedFields:e.protectedFields,viewId:k0(e.viewId),filter:V1(e.filter),dataSetId:e.dataSetId,limit:e.limit,offset:e.offset,conditionalFormattingRules:St(t.queryEngineConfig,e.conditionalFormattingRules),dateTimeFormat:e.dateTimeFormat,prefixes:e.prefixes,exportNames:e.exportNames,numberFormat:e.numberFormat,sizing:e.sizing,tableDrilldown:$_(e.tableDrilldown),tags:e.tags??[],hiddenFields:e.hiddenFields??[],summarizeKPIs:e.summarizeKPIs??!1,visualFormatColumns:e.visualFormatColumns??[]}),setAttributes:nN(t),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"dataTable",measure:[],displayTitle:"",dimension:[],protectedByOrganisation:void 0,displaySubject:"",viewId:k0(o?.viewId),filter:[],order:[],dataSetId:e,limit:50,offset:0,conditionalFormattingRules:[],protectedFields:void 0,prefixes:[],dateTimeFormat:"DD MMMM YYYY, hh:mm",exportNames:{},numberFormat:{},sizing:{},tableDrilldown:[],tags:[],hiddenFields:[],summarizeKPIs:!1,visualFormatColumns:[],...o}),schema:qu(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(e){const{measure:o,dimension:n}=le(e,t.queryEngineConfig,"dataTable");return this.init(e.id,{measure:o.slice(0,5),dimension:n})},dataPanelConfig:()=>[P(ue,"data_set"),P(ue,"views"),{...P(ue,"field_columns"),fieldFilterOptions:{onlyFieldTypes:["boolean","number","string","date_time"],onlyDimensions:!0,removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},preventDuplicates:!0,preSetPartialAttributes:(e,o,n)=>({dimension:[...e.map(b=>({...b,pivot:"y"})),...wa(n.dimension,"x")]}),getValues:e=>wa(e.dimension,"y"),testId:"add-pivot-dimension"},{...P(ue,"field_rows"),fieldFilterOptions:{onlyFieldTypes:["boolean","number","string","date_time"],onlyDimensions:!0,removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},preventDuplicates:!0,preSetPartialAttributes:(e,o,n)=>({dimension:[...e.map(b=>({...b,pivot:"x"})),...wa(n.dimension,"y")]}),getValues:e=>wa(e.dimension,"x"),testId:"add-dimension"},{...P(ue,"field_metrics"),fieldFilterOptions:{forComponent:"dataTable"},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"},P(ue,"sort"),{...P(ue,"pagination"),options:pu},P(ue,"filter"),P(ue,"custom_metrics")],formatPanelConfig:()=>[F1(ue),P(ue,"kpi_summarisation"),P(ue,"visual_format"),{...P(ue,"format"),subSection:[ue.format_panel.format?.subSectionDefinition.time]},P(ue,"prefixes"),{...P(ue,"conditional_formatting"),ruleType:"backgroundColor"}],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!1,colorGradient:!0}}),bN=t=>(e,o)=>{let n=I1(e,o,Gn(t));return n=wt(n),n},Ne={title:"Funnel chart",description:"Track conversion between stages of a process.",namespace:"funnel_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this bar chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each bar to measure?",callToAction:"Add metric"},field_x_axis:{type:"fieldCollector",title:"Grouping - X Axis",description:"What do you want each bar to represent? An example might be a `product category` field to represent each category as a bar.",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this bar chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this bar chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"},labels:{type:"labels",title:"Show Labels",description:"",namespace:"labels"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},headline:{type:"headline",title:"Headline",description:""},goal_line:{type:"goalLine",title:"Goal Lines",description:""},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""}}},hu=t=>({title:Ne.title,description:Ne.description,servicesClass:"FunnelChart",namespace:Ne.namespace,dump:e=>e,load:e=>({...e,measure:g1(e.measure),order:me(e.order,e.timeDimension),dimension:Oe(e.dimension),viewId:k0(e.viewId),filter:V1(e.filter),approxXAxisLabelCount:R1(e.approxXAxisLabelCount),approxYAxisLabelCount:R1(e.approxYAxisLabelCount),tags:e.tags??[],labels:e.labels??!1,parameters:ut(e.parameters)}),setAttributes:bN(t),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"funnelChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",viewId:k0(o?.viewId),filter:[],parameters:{},order:[],dataSetId:e,limit:5e3,conditionalFormattingRules:[],protectedByOrganisation:void 0,protectedFields:void 0,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,legend:!0,labels:!1,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",axisTitles:void 0,tags:[],...o}),createFeedback:we,schema:Gn(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(e){const{measure:o,dimension:n}=le(e,t.queryEngineConfig,"funnelChart");return this.init(e.id,{measure:[o[0]],dimension:n})},dataPanelConfig:()=>[P(Ne,"data_set"),P(Ne,"views"),{...P(Ne,"field_y_axis"),fieldFilterOptions:{forComponent:"funnelChart"},preSetPartialAttributes:e=>({measure:e}),allowsMultiple:!1,maxAllowed:1,getValues:e=>e.measure,testId:"metric-input"},{...P(Ne,"field_x_axis"),fieldFilterOptions:{forComponent:"funnelChart",onlyDimensions:!0},allowsMultiple:!1,preventDuplicates:!0,preSetPartialAttributes:(e,o)=>Nr(e,o),getValues:e=>Zo(e),maxAllowed:1,testId:"add-dimension"},P(Ne,"sort"),P(Ne,"filter"),P(Ne,"custom_metrics"),P(Ne,"limit")],formatPanelConfig:()=>[F1(Ne),{...P(Ne,"chart_styles"),subSection:[Ne.format_panel.chart_styles?.subSectionDefinition.legend,Ne.format_panel.chart_styles?.subSectionDefinition.labels]},Ge(Ne),{...P(Ne,"conditional_formatting"),ruleType:"backgroundColor"},P(Ne,"headline")],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet(e,o){return O2(e,o,this.setAttributes)}}),pN=t=>(e,o)=>{let n=I1(e,o,Gn(t));return n=wt(n),n},Ee={title:"Horizontal bar chart",description:"Similar to a BarChart but with horizontal bars.",namespace:"horizontal_bar_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this bar chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each bar to measure?",callToAction:"Add metric"},drilldown:{type:"drilldown",title:"Drilldown",description:"After clicking on a segment of this bar chart, what information do you want to see next?"},field_x_axis:{type:"fieldCollector",title:"Grouping - X Axis",description:"What do you want each bar to represent? An example might be a `product category` field to represent each category as a bar.",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this bar chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this bar chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{stacked:{type:"stacked",title:"Layout",description:"",namespace:"stacked"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},headline:{type:"headline",title:"Headline",description:""},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""}}},mu=t=>({title:Ee.title,description:Ee.description,servicesClass:"HorizontalBarChart",namespace:Ee.namespace,dump:e=>e,load:e=>({...e,measure:g1(e.measure),order:me(e.order,e.timeDimension),dimension:Oe(e.dimension),viewId:k0(e.viewId),filter:V1(e.filter),approxXAxisLabelCount:R1(e.approxXAxisLabelCount),approxYAxisLabelCount:R1(e.approxYAxisLabelCount),tags:e.tags??[],parameters:ut(e.parameters)}),setAttributes:pN(t),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"horizontalBarChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",viewId:k0(o?.viewId),filter:[],order:[],dataSetId:e,limit:5e3,conditionalFormattingRules:[],protectedByOrganisation:void 0,protectedFields:void 0,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,legend:!0,parameters:{},drilldown:[],approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",axisTitles:void 0,tags:[],drilldownOptions:void 0,...o}),createFeedback:we,schema:Gn(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(e){const{measure:o,dimension:n}=le(e,t.queryEngineConfig,"horizontalBarChart");return this.init(e.id,{measure:[o[0]],dimension:n})},dataPanelConfig:()=>[P(Ee,"data_set"),P(Ee,"views"),{...P(Ee,"field_y_axis"),fieldFilterOptions:{forComponent:"horizontalBarChart"},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"},{...P(Ee,"field_x_axis"),fieldFilterOptions:{forComponent:"horizontalBarChart",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:(e,o)=>Nr(e,o),getValues:e=>Zo(e),maxAllowed:2,testId:"add-dimension"},P(Ee,"sort"),P(Ee,"filter"),{...P(Ee,"drilldown"),options:{property:"drilldownOptions"}},P(Ee,"custom_metrics"),P(Ee,"limit")],formatPanelConfig:()=>[F1(Ee),Un(Ee,!1,!0),Ge(Ee),{...P(Ee,"conditional_formatting"),ruleType:"backgroundColor"},P(Ee,"headline")],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet(e,o){return O2(e,o,this.setAttributes)}}),gu=t=>R.object({...Y1(t.attributesSchemaOptions),...c2(t.queryEngineConfig,t.attributesSchemaOptions),stacked:R.valid(!0,!1,"100%"),legend:R.valid(!0,!1),labels:R.valid(!0,!1).optional(),type:R.valid("horizontalBarChartV2").required(),parameters:ft(t.queryEngineConfig,t.attributesSchemaOptions),conditionalFormattingRules:Wt(t.queryEngineConfig),goalLines:Vt(),axisTitles:qt(),headline:X2(),tags:H1()}),fe={title:"Horizontal bar chart",description:"Ideal for illustrating changes and trends over time with bar graphs.",namespace:"horizontal_bar_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this bar chart?"},views:{type:"views",title:"View",description:""},field_x_axis:{type:"fieldCollector",title:"Metric - X Axis",description:"What do you want each bar to measure?",callToAction:"Add metric"},field_y_axis:{type:"fieldCollector",title:"Grouping - Y Axis",description:"What do you want each bar to represent? An example might be a `product category` field to represent each category as a bar.",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this bar chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this bar chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{stacked:{type:"stacked",title:"Layout",description:"",namespace:"stacked"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"},labels:{type:"labels",title:"Show Labels",description:"",namespace:"labels"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""},headline:{type:"headline",title:"Headline",description:""},goal_line:{type:"goalLine",title:"Goal Lines",description:""}}},aN=t=>(e,o)=>{let n=I1(e,o,gu(t));return n=wt(n),n},yu=t=>({title:fe.title,description:fe.description,servicesClass:"HorizontalBarChart",namespace:fe.namespace,dump:e=>e,load:e=>({type:e.type,measure:g1(e.measure),order:me(e.order,e.timeDimension),dimension:Oe(e.dimension),displayTitle:e.displayTitle,displaySubject:e.displaySubject,protectedByOrganisation:e.protectedByOrganisation,viewId:k0(e.viewId),filter:V1(e.filter),dataSetId:e.dataSetId,limit:e.limit,timeDimension:null,xAxisPostfix:e.xAxisPostfix,xAxisPrefix:e.xAxisPrefix,yAxisPostfix:e.yAxisPostfix,yAxisPrefix:e.yAxisPrefix,yAxisFormat:e.yAxisFormat,xAxisFormat:e.xAxisFormat,conditionalFormattingRules:St(t.queryEngineConfig,e.conditionalFormattingRules),legend:e.legend,labels:e.labels,goalLines:e.goalLines,headline:ho(e.headline,e.timeDimension),parameters:ut(e.parameters),approxXAxisLabelCount:R1(e.approxXAxisLabelCount),approxYAxisLabelCount:R1(e.approxYAxisLabelCount),axisTitles:e.axisTitles,tags:e.tags??[],stacked:e.stacked}),setAttributes:aN(t),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"horizontalBarChartV2",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:k0(o?.viewId),filter:[],order:[],dataSetId:e,limit:5e3,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,conditionalFormattingRules:[],legend:!0,labels:!1,goalLines:void 0,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",parameters:{},axisTitles:void 0,headline:void 0,tags:[],...o}),createFeedback:we,schema:gu(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),isRunnable:e=>e.measure.length>0&&e.dimension.length>0,autoGenerate(e){const{measure:o,dimension:n}=le(e,t.queryEngineConfig,"barChart");return this.init(e.id,{measure:[o[0]],dimension:n})},dataPanelConfig:()=>[P(fe,"data_set"),P(fe,"views"),{...P(fe,"field_x_axis"),fieldFilterOptions:{forComponent:"horizontalBarChartV2"},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"},{...P(fe,"field_y_axis"),fieldFilterOptions:{forComponent:"horizontalBarChartV2",onlyDimensions:!0},preventDuplicates:!1,preSetPartialAttributes:e=>({dimension:[...e]}),getValues:e=>[...e.dimension],maxAllowed:2,testId:"add-dimension"},P(fe,"sort"),P(fe,"filter"),P(fe,"custom_metrics"),P(fe,"limit")],formatPanelConfig:()=>[F1(fe),{...P(fe,"chart_styles"),subSection:[fe.format_panel.chart_styles?.subSectionDefinition.stacked,fe.format_panel.chart_styles?.subSectionDefinition.legend,fe.format_panel.chart_styles?.subSectionDefinition.labels],labels:{type:"labels",title:"Show Labels",description:"",namespace:"labels"}},Ge(fe),{...P(fe,"conditional_formatting"),ruleType:"lineColor"},P(fe,"goal_line")],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet(e,o){return O2(e,o,this.setAttributes)}}),Ru=t=>R.object({...Y1(t.attributesSchemaOptions),...c2(t.queryEngineConfig,t.attributesSchemaOptions),stacked:R.valid(!0,!1,"100%"),legend:R.valid(!0,!1),type:R.valid("lineChart").required(),parameters:ft(t.queryEngineConfig,t.attributesSchemaOptions),lineCurve:UM,conditionalFormattingRules:Wt(t.queryEngineConfig),goalLines:Vt(),axisTitles:qt(),headline:X2(),tags:H1(),trends:sz()}),MN=t=>(e,o)=>{let n=I1(e,o,Ru(t));return n=wt(n),n},Je={title:"Line chart",description:"Ideal for illustrating changes and trends over time with line graphs.",namespace:"line_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this line chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each line to measure?",callToAction:"Add metric"},drilldown:{type:"drilldown",title:"Drilldown",description:"After clicking on a segment of this line chart, what information do you want to see next?"},field_x_axis:{type:"fieldCollector",title:"Grouping - X Axis",description:"What do you want each line to represent? An example might be a `product category` field to represent each category as a line.",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this line chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this line chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{curve:{type:"curve",title:"Line Style",description:"",namespace:"curve"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""},headline:{type:"headline",title:"Headline",description:""},trends:{type:"trends",title:"Trend lines",description:"Specify a trend type for the line chart."},goal_line:{type:"goalLine",title:"Goal Lines",description:""}}},Lu=t=>({title:"Line chart",description:"Ideal for illustrating changes and trends over time with line graphs.",servicesClass:"LineChart",namespace:"line_chart",dump:e=>e,load:e=>({type:e.type,measure:g1(e.measure),order:me(e.order,e.timeDimension),dimension:Oe(e.dimension),timeDimension:e.timeDimension,displayTitle:e.displayTitle,displaySubject:e.displaySubject,protectedByOrganisation:e.protectedByOrganisation,viewId:k0(e.viewId),filter:V1(e.filter),dataSetId:e.dataSetId,limit:e.limit,xAxisPostfix:e.xAxisPostfix,xAxisPrefix:e.xAxisPrefix,yAxisPostfix:e.yAxisPostfix,yAxisPrefix:e.yAxisPrefix,yAxisFormat:e.yAxisFormat,xAxisFormat:e.xAxisFormat,lineCurve:e.lineCurve,conditionalFormattingRules:St(t.queryEngineConfig,e.conditionalFormattingRules),drilldown:e.drilldown,legend:e.legend,goalLines:e.goalLines,headline:ho(e.headline,e.timeDimension),parameters:ut(e.parameters),approxXAxisLabelCount:R1(e.approxXAxisLabelCount),approxYAxisLabelCount:R1(e.approxYAxisLabelCount),axisTitles:e.axisTitles,tags:e.tags??[],trends:e.trends??[]}),setAttributes:MN(t),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"lineChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:k0(o?.viewId),filter:[],order:[],dataSetId:e,limit:5e3,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,lineCurve:"natural",conditionalFormattingRules:[],drilldown:[],legend:!0,goalLines:void 0,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",parameters:{},axisTitles:void 0,headline:void 0,tags:[],trends:[],...o}),createFeedback:we,schema:Ru(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(e){const{measure:o,dimension:n}=le(e,t.queryEngineConfig,"lineChart");return this.init(e.id,{measure:[o[0]],dimension:n})},dataPanelConfig:()=>[P(Je,"data_set"),P(Je,"views"),{...P(Je,"field_y_axis"),fieldFilterOptions:{forComponent:"lineChart"},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"},{...P(Je,"field_x_axis"),fieldFilterOptions:{forComponent:"lineChart",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:(e,o)=>Nr(e,o),getValues:e=>Zo(e),maxAllowed:2,testId:"add-dimension"},P(Je,"sort"),P(Je,"filter"),P(Je,"custom_metrics"),P(Je,"limit")],formatPanelConfig:()=>[F1(Je),Un(Je,!0,!1),Ge(Je),{...P(Je,"conditional_formatting"),ruleType:"lineColor"},P(Je,"goal_line"),P(Je,"trends"),P(Je,"headline")],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet(e,o){return O2(e,o,this.setAttributes)}}),vu=t=>R.object({...Y1(t.attributesSchemaOptions),...c2(t.queryEngineConfig,t.attributesSchemaOptions),stacked:R.valid(!0,!1,"100%"),legend:R.valid(!0,!1),labels:R.valid(!0,!1).optional(),type:R.valid("lineChartV2").required(),parameters:ft(t.queryEngineConfig,t.attributesSchemaOptions),lineCurve:UM,conditionalFormattingRules:Wt(t.queryEngineConfig),goalLines:Vt(),axisTitles:qt(),headline:X2(),tags:H1(),trends:sz()}),zN=t=>(e,o)=>{let n=I1(e,o,vu(t));return n=wt(n),n},et={title:"Line chart",description:"Ideal for illustrating changes and trends over time with line graphs.",namespace:"line_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this line chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each line to measure?",callToAction:"Add metric"},drilldown:{type:"drilldown",title:"Drilldown",description:"After clicking on a segment of this line chart, what information do you want to see next?"},field_x_axis:{type:"fieldCollector",title:"Grouping - X Axis",description:"What do you want each line to represent? An example might be a `product category` field to represent each category as a line.",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this line chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this line chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{curve:{type:"curve",title:"Line Style",description:"",namespace:"curve"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"},labels:{type:"labels",title:"Show Labels",description:"",namespace:"labels"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""},headline:{type:"headline",title:"Headline",description:""},trends:{type:"trends",title:"Trend lines",description:"Specify a trend type for the line chart."},goal_line:{type:"goalLine",title:"Goal Lines",description:""}}},_u=t=>({title:"Line chart",description:"Ideal for illustrating changes and trends over time with line graphs.",servicesClass:"LineChart",namespace:"line_chart",dump:e=>e,load:e=>({type:e.type,measure:g1(e.measure),order:me(e.order,e.timeDimension),dimension:Oe(e.dimension),displayTitle:e.displayTitle,displaySubject:e.displaySubject,protectedByOrganisation:e.protectedByOrganisation,viewId:k0(e.viewId),filter:V1(e.filter),dataSetId:e.dataSetId,limit:e.limit,timeDimension:null,xAxisPostfix:e.xAxisPostfix,xAxisPrefix:e.xAxisPrefix,yAxisPostfix:e.yAxisPostfix,yAxisPrefix:e.yAxisPrefix,yAxisFormat:e.yAxisFormat,xAxisFormat:e.xAxisFormat,lineCurve:e.lineCurve,conditionalFormattingRules:St(t.queryEngineConfig,e.conditionalFormattingRules),drilldown:e.drilldown,legend:e.legend,labels:e.labels,goalLines:e.goalLines,headline:ho(e.headline,e.timeDimension),parameters:ut(e.parameters),approxXAxisLabelCount:R1(e.approxXAxisLabelCount),approxYAxisLabelCount:R1(e.approxYAxisLabelCount),axisTitles:e.axisTitles,tags:e.tags??[],trends:e.trends??[]}),setAttributes:zN(t),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"lineChartV2",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:k0(o?.viewId),filter:[],order:[],dataSetId:e,limit:5e3,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,lineCurve:"natural",conditionalFormattingRules:[],drilldown:[],legend:!0,labels:!1,goalLines:void 0,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",parameters:{},axisTitles:void 0,headline:void 0,tags:[],trends:[],...o}),createFeedback:we,schema:vu(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),isRunnable:e=>e.measure.length>0&&e.dimension.length>0,autoGenerate(e){const{measure:o,dimension:n}=le(e,t.queryEngineConfig,"lineChart");return this.init(e.id,{measure:[o[0]],dimension:n})},dataPanelConfig:()=>[P(et,"data_set"),P(et,"views"),{...P(et,"field_y_axis"),fieldFilterOptions:{forComponent:"lineChart"},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"},{...P(et,"field_x_axis"),fieldFilterOptions:{forComponent:"lineChart",onlyDimensions:!0},preventDuplicates:!1,preSetPartialAttributes:e=>({dimension:[...e]}),getValues:e=>[...e.dimension],maxAllowed:2,testId:"add-dimension"},P(et,"sort"),P(et,"filter"),P(et,"custom_metrics"),P(et,"limit")],formatPanelConfig:()=>[F1(et),{...P(et,"chart_styles"),subSection:[et.format_panel.chart_styles?.subSectionDefinition.legend,et.format_panel.chart_styles?.subSectionDefinition.labels]},Ge(et),{...P(et,"conditional_formatting"),ruleType:"lineColor"},P(et,"goal_line")],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet(e,o){return O2(e,o,this.setAttributes)}}),Nu=t=>R.object({...Y1(t.attributesSchemaOptions),type:R.valid("mercatorMap").required(),measure:R.array().items(he(t.queryEngineConfig.supportedAggregates,t.attributesSchemaOptions)),filter:z2(t.queryEngineConfig),limit:Gt(),dimension:Bt({},t.attributesSchemaOptions),labelFormat:R.alternatives(R.string(),R.valid(null)),noDataColor:R.string().required(),backgroundColor:R.string().required(),maxValueColor:R.string().required(),minValueColor:R.string().required(),position:R.object({scale:R.number(),centerX:R.number(),centerY:R.number()}),tags:H1()}),cN=t=>(e,o)=>I1(e,o,Nu(t)),st={title:"Country map",description:"A map component based on the Mercator projection, suitable for geographical data visualization.",namespace:"mercator_map",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use for this map?"},views:{type:"views",title:"View",description:""},field_metrics:{type:"fieldCollector",title:"Metric",description:"What do you want to show?",callToAction:"Add metric"},field_country:{type:"fieldCollector",title:"Country",description:"Which field contains the country code required to group results on?",callToAction:"Set country"},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use on this map."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this map."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Map Settings",description:"",subSectionDefinition:{number_format:{type:"numberFormat",title:"Value format",description:"",namespace:"number_format"}}},map_colors:{type:"mapColors",title:"Map colors",description:""}}},Tu=t=>({title:st.title,description:st.description,servicesClass:"MercatorMap",namespace:st.namespace,dump:e=>e,load:e=>({dataSetId:e.dataSetId,displaySubject:e.displaySubject,displayTitle:e.displayTitle,protectedByOrganisation:e.protectedByOrganisation,viewId:k0(e.viewId),type:"mercatorMap",dimension:e.dimension,limit:e.limit,measure:g1(e.measure),labelFormat:e.labelFormat,position:e.position,filter:V1(e.filter),noDataColor:e.noDataColor||"#ffffff",backgroundColor:e.backgroundColor||"#EFF5F6",maxValueColor:e.maxValueColor||"#000000",minValueColor:e.minValueColor||"#e0e0e0",tags:e.tags??[]}),setAttributes:cN(t),validate:()=>[],init:(e,o)=>({type:"mercatorMap",dataSetId:e,dimension:[],measure:[],displaySubject:"",displayTitle:"",limit:5e3,filter:[],viewId:k0(o?.viewId),labelFormat:null,noDataColor:"#ffffff",backgroundColor:"#EFF5F6",maxValueColor:"#000000",minValueColor:"#e0e0e0",tags:[],...o}),schema:Nu(t),removeField(e,o){return e},isRunnable:e=>!!(e.dimension&&e.dimension[0]&&e.measure&&e.measure[0]),autoGenerate(e){return this.init(e.id)},dataPanelConfig:()=>[P(st,"data_set"),P(st,"views"),{...P(st,"field_metrics"),type:"fieldCollector",fieldFilterOptions:{forComponent:"mercatorMap"},maxAllowed:1,preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"},{...P(st,"field_country"),fieldFilterOptions:{onlyDimensions:!0,onlyFieldTypes:["string"],removeRuleGrouping:!1,removeSimpleMaths:!0,removePercentage:!0,removeAggregateMaths:!0},maxAllowed:1,preSetPartialAttributes:e=>({dimension:e}),getValues:e=>e.dimension,testId:"add-dimension"},P(st,"filter"),P(st,"custom_metrics"),P(st,"limit")],formatPanelConfig:()=>[F1(st),{...P(st,"chart_styles"),subSection:[st.format_panel.chart_styles?.subSectionDefinition.number_format]},P(st,"map_colors")],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!1,colorGradient:!1}}),xl=t=>R.object({...Y1(t.attributesSchemaOptions),measure:R.array().items(he(t.queryEngineConfig.supportedAggregates,t.attributesSchemaOptions)),dimension:Bt(t.queryEngineConfig.supportedTimeTruncFunctions,t.attributesSchemaOptions),filter:z2(t.queryEngineConfig),timeDimension:R.valid(null),order:R.array().items(uo(t.queryEngineConfig)),type:R.valid("pieChart").required(),legend:R.valid(!0,!1),labels:R.valid(!0,!1).optional(),limit:Gt(),labelsAsPercentage:R.boolean(),conditionalFormattingRules:Wt(t.queryEngineConfig),labelFormat:R.alternatives(R.string(),R.valid(null)),parameters:ft(t.queryEngineConfig,t.attributesSchemaOptions),tags:H1(),drilldownOptions:jO(t.queryEngineConfig)}),Te={title:"Pie chart",description:"Represents data in a circular pie-like format, useful for showing proportions.",namespace:"pie_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this pie chart?"},views:{type:"views",title:"View",description:""},field_metrics:{type:"fieldCollector",title:"Metric",description:"What do you want each segment to measure?",callToAction:"Add metric"},drilldown:{type:"drilldown",title:"Drilldown",description:"After clicking on a segment of this bar chart, what information do you want to see next?"},field_grouping:{type:"fieldCollector",title:"Grouping",description:"How do you want to split each section of the pie chart?",callToAction:"Add comparison"},sort:{type:"sort",title:"Sort",description:"Choose the order of segments in the pie chart"},filter:{type:"filter",title:"Filters",description:"Only include the information you want in this pie chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Limit the number of segments shown on this pie chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{number_format:{type:"numberFormat",title:"Format",description:"",namespace:"number_format"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"},labels:{type:"labels",title:"Show Labels",description:"",namespace:"labels"}}},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""}}},Bu=t=>({title:Te.title,description:Te.description,servicesClass:"PieChart",namespace:Te.namespace,dump:e=>e,load:e=>({type:e.type,measure:g1(e.measure),order:me(e.order,e.timeDimension),dimension:Oe(e.dimension),viewId:k0(e.viewId),timeDimension:e.timeDimension,displayTitle:e.displayTitle,displaySubject:e.displaySubject,protectedByOrganisation:e.protectedByOrganisation,filter:V1(e.filter),dataSetId:e.dataSetId,limit:e.limit,conditionalFormattingRules:St(t.queryEngineConfig,e.conditionalFormattingRules),labelsAsPercentage:e.labelsAsPercentage,legend:e.legend,labels:e.labels,labelFormat:e.labelFormat,parameters:ut(e.parameters),tags:e.tags??[],drilldownOptions:e.drilldownOptions}),setAttributes:(e,o)=>I1(e,o,xl(t)),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"pieChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:k0(o?.viewId),filter:[],order:[],dataSetId:e,limit:5e3,conditionalFormattingRules:[],labelsAsPercentage:!1,legend:!0,labels:!1,labelFormat:null,parameters:{},tags:[],drilldownOptions:void 0,...o}),createFeedback:we,schema:xl(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(e){const{measure:o,dimension:n}=le(e,t.queryEngineConfig,"pieChart");return this.init(e.id,{measure:[o[0]],dimension:n})},dataPanelConfig:()=>[P(Te,"data_set"),P(Te,"views"),{...P(Te,"field_metrics"),fieldFilterOptions:{forComponent:"pieChart"},maxAllowed:1,preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"},{...P(Te,"field_grouping"),fieldFilterOptions:{onlyFieldTypes:["boolean","number","string"],onlyDimensions:!0,removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},maxAllowed:1,preSetPartialAttributes:e=>({dimension:e}),getValues:e=>e.dimension,testId:"add-dimension"},P(Te,"sort"),P(Te,"filter"),{...P(Te,"drilldown"),options:{property:"drilldownOptions"}},P(Te,"custom_metrics"),P(Te,"limit")],formatPanelConfig:()=>[F1(Te),{...P(Te,"conditional_formatting"),ruleType:"backgroundColor"},{...P(Te,"chart_styles"),subSection:[Te.format_panel.chart_styles?.subSectionDefinition.legend,Te.format_panel.chart_styles?.subSectionDefinition.labels,Te.format_panel.chart_styles?.subSectionDefinition.number_format]}],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!0,colorGradient:!1}});var rO=(t=>(t.Linear="linear",t.Circular="circular",t))(rO||{});const Xl=t=>R.object({...Y1(t.attributesSchemaOptions),measure:R.array().items(he(t.queryEngineConfig.supportedAggregates,t.attributesSchemaOptions)),filter:z2(t.queryEngineConfig),type:R.valid("progress").required(),limit:Gt(),conditionalFormattingRules:Wt(t.queryEngineConfig),parameters:ft(t.queryEngineConfig,t.attributesSchemaOptions),goals:R.array().items(R.object({field:R.string().required().description("ID of the field in the data set to which the goal applies too"),value:R.number().required().description("Value of which the goal is set")})).description("Set the target value that progression is shown towards."),progressType:R.array().items(R.object({field:R.string().required().description("ID of the field to set the progress type of"),value:R.valid(rO.Linear,rO.Circular).required()})).description("Set the display type of the progress view"),formatter:R.object().pattern(R.string(),R.string()),prefixes:R.object().pattern(R.string(),R.string()),postfixes:R.object().pattern(R.string(),R.string()),tags:H1()}),Su=t=>{if("singleMeasure"in t){let e={},o={},n=[],b={};return t.singleMeasure&&(n=[t.singleMeasure],e[Vi(t.singleMeasure)]=t.prefix,o[Vi(t.singleMeasure)]=t.postfix,b[Vi(t.singleMeasure)]=t.formatter),{type:"singleStat",prefixes:e,postfixes:o,measure:n,formatter:b,fontSize:t.fontSize,displayTitle:t.displayTitle,displaySubject:t.displaySubject,tags:t.tags,filter:V1(t.filter),dataSetId:t.dataSetId,limit:t.limit,conditionalFormattingRules:t.conditionalFormattingRules,deltaTimeDimension:t.deltaTimeDimension,parameters:ut(t.parameters)}}else return{...t,filter:V1(t.filter)}},tt={title:"Progress",description:"Used to show progress towards goals, completion of tasks, or as indicators of performance metrics.",namespace:"progress",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this progress?"},views:{type:"views",title:"View",description:""},progress_goals:{type:"progressGoals",title:"Metric",description:"What do you want to show in each progress bar?"},filter:{type:"filter",title:"Filters",description:"Only include the information you want in this progress chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},stats_labels:{type:"statsLabels",title:"Labels",description:"",subSectionDefinition:{prefix:{title:"Prefix",description:"",namespace:"prefix"},postfix:{title:"Postfix",description:"",namespace:"postfix"},format:{title:"Format",description:"",namespace:"format"},count:{title:"Label count",description:"",namespace:"count"}}},progress_type:{type:"progressType",title:"Type",description:""}}},wu=t=>({title:tt.title,description:tt.description,dump:e=>e,namespace:tt.namespace,servicesClass:"Progress",load:e=>{const o=Su(e);return{type:"progress",measure:g1(o.measure),displayTitle:o.displayTitle,displaySubject:o.displaySubject,protectedByOrganisation:o.protectedByOrganisation,viewId:k0(o.viewId),filter:o.filter,dataSetId:o.dataSetId,limit:o.limit,conditionalFormattingRules:o.conditionalFormattingRules,parameters:o.parameters,prefixes:o.prefixes,postfixes:o.postfixes,formatter:o.formatter,goals:o.goals,progressType:o.progressType,tags:o.tags??[]}},setAttributes:(e,o)=>I1(e,o,Xl(t)),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"progress",measure:[],displayTitle:"",protectedByOrganisation:void 0,displaySubject:"",viewId:k0(o?.viewId),filter:[],dataSetId:e,limit:5e3,conditionalFormattingRules:[],parameters:{},formatter:{},progressType:[],goals:[],postfixes:{},prefixes:{},tags:[],...o}),schema:Xl(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(e){return this.init(e.id)},dataPanelConfig:()=>[P(tt,"data_set"),P(tt,"views"),P(tt,"progress_goals"),P(tt,"filter"),P(tt,"custom_metrics")],formatPanelConfig:()=>[F1(tt),P(tt,"progress_type"),{...P(tt,"stats_labels"),prefix:Vo(tt,"prefix"),postfix:Vo(tt,"postfix"),format:Vo(tt,"format"),count:Vo(tt,"count")}],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,aggregateMaths:!0,rules:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!1,colorGradient:!1}}),xu=t=>R.object({...Y1(t.attributesSchemaOptions),...c2(t.queryEngineConfig,t.attributesSchemaOptions),legend:R.valid(!0,!1),type:R.valid("radarChart").required(),parameters:ft(t.queryEngineConfig,t.attributesSchemaOptions),axisTitles:qt(),headline:X2(),tags:H1()}),sN=t=>(e,o)=>{let n=I1(e,o,xu(t));return n=wt(n),n},Ot={title:"Radar chart",description:"Visualizes multiple variables as points on axes starting from the same center point, creating a spider web-like shape. Perfect for comparing strengths and weaknesses across multiple dimensions or showing performance metrics across different categories.",namespace:"radar_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this radar chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each line to measure?",callToAction:"Add metric"},field_x_axis:{type:"fieldCollector",title:"Grouping - X Axis",description:"What do you want each line to represent? An example might be a `product category` field to represent each category as a line.",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this radar chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this radar chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{curve:{type:"curve",title:"Line Style",description:"",namespace:"curve"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"Grouping - X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},y:{title:"Metric - Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"}}}}},Xu=t=>({title:Ot.title,description:Ot.description,servicesClass:"RadarChart",namespace:Ot.namespace,dump:e=>e,load:e=>({type:e.type,measure:g1(e.measure),order:me(e.order,e.timeDimension),dimension:Oe(e.dimension),displayTitle:e.displayTitle,displaySubject:e.displaySubject,protectedByOrganisation:e.protectedByOrganisation,viewId:k0(e.viewId),filter:V1(e.filter),dataSetId:e.dataSetId,limit:e.limit,timeDimension:null,xAxisPostfix:e.xAxisPostfix,xAxisPrefix:e.xAxisPrefix,yAxisPostfix:e.yAxisPostfix,yAxisPrefix:e.yAxisPrefix,yAxisFormat:e.yAxisFormat,xAxisFormat:e.xAxisFormat,approxXAxisLabelCount:R1(e.approxXAxisLabelCount),approxYAxisLabelCount:R1(e.approxYAxisLabelCount),legend:e.legend,tags:e.tags??[]}),setAttributes:sN(t),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"radarChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:k0(o?.viewId),filter:[],order:[],dataSetId:e,limit:5e3,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,legend:!0,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",parameters:{},axisTitles:void 0,headline:void 0,tags:[],...o}),createFeedback:we,schema:xu(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),isRunnable:e=>e.measure.length>0&&e.dimension.length>0,autoGenerate(e){const{measure:o,dimension:n}=le(e,t.queryEngineConfig,"radarChart");return this.init(e.id,{measure:[o[0]],dimension:n})},dataPanelConfig:()=>[P(Ot,"data_set"),P(Ot,"views"),{...P(Ot,"field_y_axis"),fieldFilterOptions:{forComponent:"radarChart"},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"},{...P(Ot,"field_x_axis"),fieldFilterOptions:{forComponent:"radarChart",onlyDimensions:!0},preventDuplicates:!1,preSetPartialAttributes:e=>({dimension:[...e]}),getValues:e=>[...e.dimension],maxAllowed:1,testId:"add-dimension"},P(Ot,"sort"),P(Ot,"filter"),P(Ot,"custom_metrics"),P(Ot,"limit")],formatPanelConfig:()=>[F1(Ot),Un(Ot,!1,!1),Ge(Ot)],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet(e,o){return O2(e,o,this.setAttributes)}}),Cu=t=>R.object({...Y1(t.attributesSchemaOptions),...c2(t.queryEngineConfig,t.attributesSchemaOptions),type:R.valid("richText").required(),tags:H1(),content:R.any()}),ON=t=>(e,o)=>I1(e,o,Cu(t)),Nt={title:"Rich text",description:"Add your data to a rich text component.",namespace:"rich_text",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this rich text view?"},views:{type:"views",title:"View",description:""},field_metrics:{type:"fieldCollector",title:"Metrics",description:"What metrics do you need to collect?",callToAction:"Add metric"},field_grouping:{type:"fieldCollector",title:"Grouping",description:"How do you want to group your results?",callToAction:"Add grouping"},sort:{type:"sort",title:"Sort",description:"How should the results be ordered?"},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this text view."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to use on this text view."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},rich_text:{type:"richText",title:"Text format",description:""}}},lN={type:"doc",content:[{type:"heading",attrs:{level:1},content:[{type:"text",text:"Rich text views"}]},{type:"paragraph",content:[{type:"text",text:"In this view, you can add any "},{type:"text",marks:[{type:"bold"}],text:"text based content"},{type:"text",text:" to your dashboard, and "},{type:"text",marks:[{type:"italic"}],text:"mix in your data with it!"}]},{type:"paragraph",content:[{type:"text",text:"Remember to use the "},{type:"text",marks:[{type:"bold"}],text:"format"},{type:"text",text:" "},{type:"text",marks:[{type:"bold"}],text:"tab"},{type:"text",text:" to "},{type:"text",marks:[{type:"underline"}],text:"style"},{type:"text",text:" your contents"}]},{type:"heading",attrs:{level:2},content:[{type:"text",text:"Adding data?"}]},{type:"paragraph",content:[{type:"text",text:"You can add data to your text content by using templating. For example, is how to take metrics "},{type:"text",marks:[{type:"code"}],text:'"Metric Name"'},{type:"text",text:" and "},{type:"text",marks:[{type:"code"}],text:'"A different metric name" '},{type:"text",text:"from the first row of the results, and show it on this view;"}]},{type:"codeBlock",attrs:{language:null},content:[{type:"text",text:`{{ data.first.metric_name }}
60
60
  {{ data.first.a_different_metric_name }}
61
- `}]}]},Eu=t=>({title:Nt.title,description:Nt.description,servicesClass:"RichText",namespace:Nt.namespace,dump:e=>e,load:e=>({dataSetId:e.dataSetId,displaySubject:e.displaySubject,displayTitle:e.displayTitle,protectedByOrganisation:e.protectedByOrganisation,viewId:k0(e.viewId),type:"richText",dimension:e.dimension,limit:e.limit,measure:g1(e.measure),filter:V1(e.filter),tags:e.tags??[],content:e.content||"",order:e.order||[],timeDimension:e.timeDimension||null}),setAttributes:ON(t),validate:()=>[],init:(e,o)=>({type:"richText",dataSetId:e,dimension:[],measure:[],displaySubject:"",displayTitle:"",limit:5e3,filter:[],viewId:k0(o?.viewId),tags:[],order:[],timeDimension:null,content:lN,...o}),schema:Cu(t),removeField(e,o){return e},isRunnable:e=>!!(e.measure&&e.measure[0]),autoGenerate(e){return this.init(e.id)},dataPanelConfig:()=>[P(Nt,"data_set"),P(Nt,"views"),{...P(Nt,"field_metrics"),fieldFilterOptions:{forComponent:"richText",onlyMeasures:!0},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"},{...P(Nt,"field_grouping"),fieldFilterOptions:{forComponent:"richText",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:(e,o)=>Nr(e,o),getValues:e=>Zo(e),maxAllowed:2,testId:"add-dimension"},P(Nt,"sort"),P(Nt,"filter"),P(Nt,"custom_metrics"),P(Nt,"limit")],formatPanelConfig:()=>[F1(Nt),{...P(Nt,"rich_text")}],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!1,colorGradient:!1}}),Du=t=>R.object({...Y1(t.attributesSchemaOptions),xMeasure:he(t.queryEngineConfig.supportedAggregates,t.attributesSchemaOptions).allow(null),yMeasure:he(t.queryEngineConfig.supportedAggregates,t.attributesSchemaOptions).allow(null),dimension:Bt(t.queryEngineConfig.supportedTimeTruncFunctions,t.attributesSchemaOptions),order:R.array().items(uo(t.queryEngineConfig)),limit:Gt(),legend:R.valid(!0,!1),offset:R.number().min(0),filter:z2(t.queryEngineConfig),type:R.valid("scatterChart").required(),timeDimension:R.valid(null),xAxisPrefix:R.string().allow(""),yAxisPrefix:R.string().allow(""),xAxisPostfix:R.string().allow(""),yAxisPostfix:R.string().allow(""),yAxisFormat:R.alternatives(R.string(),R.valid(null)),xAxisFormat:R.alternatives(R.string(),R.valid(null)),approxYAxisLabelCount:S2,approxXAxisLabelCount:S2,goalLines:Vt(),quadrants:EA(),axisTitles:qt(),tags:H1()}),AN=t=>(e,o)=>{let n=I1(e,o,Du(t)),b=[];return n.xMeasure&&b.push(n.xMeasure),n.yMeasure&&b.push(n.yMeasure),n.dimension.forEach(a=>{b.push({field:a.field,function:a.function})}),n=Dn(n,b),n},Be={title:"Scatter chart",description:"Displays data points on a Cartesian plane, perfect for showing correlations.",namespace:"scatter_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this scatter chart?"},views:{type:"views",title:"View",description:""},labelled_metrics:{type:"labelledMetrics",title:"Metric - Y Axis",description:"",subSectionDefinition:{xAxis:{type:"metrics",title:"X axis",namespace:"metrics.xAxis"},yAxis:{type:"metrics",title:"Y axis",namespace:"metrics.yAxis"}}},field_grouping:{type:"fieldCollector",title:"Grouping",description:"What do you want each dot to represent?",callToAction:"Add comparison"},filter:{type:"filter",title:"Filters",description:"Only include the information you want in this scatter chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Limit the number of data points shown on this scatter chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},goal_line:{type:"goalLine",title:"Goal Lines",description:""},quadrants:{type:"quadrants",title:"",description:""}}},Iu=t=>({title:Be.title,description:Be.description,servicesClass:"ScatterChart",namespace:Be.namespace,dump:e=>e,load:e=>({type:e.type,xMeasure:g1(e.xMeasure?[e.xMeasure]:[])[0]||null,yMeasure:g1(e.yMeasure?[e.yMeasure]:[])[0]||null,dimension:Oe(e.dimension),viewId:k0(e.viewId),timeDimension:e.timeDimension,displayTitle:e.displayTitle,displaySubject:e.displaySubject,protectedByOrganisation:e.protectedByOrganisation,filter:V1(e.filter),order:me(e.order,e.timeDimension),dataSetId:e.dataSetId,limit:e.limit,legend:e.legend,xAxisFormat:e.xAxisFormat,yAxisFormat:e.yAxisFormat,yAxisPostfix:e.yAxisPostfix,yAxisPrefix:e.yAxisPrefix,xAxisPostfix:e.xAxisPostfix,xAxisPrefix:e.xAxisPrefix,approxXAxisLabelCount:y1(e.approxXAxisLabelCount),approxYAxisLabelCount:y1(e.approxYAxisLabelCount),goalLines:e.goalLines,quadrants:e.quadrants,axisTitles:e.axisTitles,tags:e.tags??[]}),setAttributes:AN(t),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"scatterChart",xMeasure:null,yMeasure:null,dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:k0(o?.viewId),filter:[],order:[],dataSetId:e,limit:5e3,legend:!0,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",goalLines:void 0,quadrants:void 0,axisTitles:void 0,tags:[],...o}),createFeedback:we,schema:Du(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),isRunnable:e=>!!e.xMeasure&&!!e.yMeasure&&e.dimension.length>0,autoGenerate(e){const{measure:o,dimension:n}=le(e,t.queryEngineConfig,"scatterChart");return this.init(e.id,{xMeasure:o[0],yMeasure:o[1],dimension:n})},dataPanelConfig:()=>[P(Be,"data_set"),P(Be,"views"),{...P(Be,"labelled_metrics"),subSection:[{...Be.data_panel.labelled_metrics?.subSectionDefinition.xAxis,propKey:"xMeasure",allowsMultiple:!1},{...Be.data_panel.labelled_metrics?.subSectionDefinition.yAxis,propKey:"yMeasure",allowsMultiple:!1}]},{...P(Be,"field_grouping"),fieldFilterOptions:{onlyDimensions:!0,onlyFieldTypes:["boolean","number","string"],removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},maxAllowed:1,preSetPartialAttributes:e=>({dimension:e}),getValues:e=>e.dimension,testId:"add-dimension"},P(Be,"filter"),P(Be,"custom_metrics"),P(Be,"limit")],formatPanelConfig:()=>[F1(Be),{...P(Be,"chart_styles"),subSection:[Be.format_panel.chart_styles?.subSectionDefinition.legend]},Ge(Be),P(Be,"quadrants"),P(Be,"goal_line")],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!1,colorGradient:!1}}),Cl=t=>R.object({...Y1(t.attributesSchemaOptions),fontSize:R.string().allow(""),formatter:R.object(),measure:R.array().items(he(t.queryEngineConfig.supportedAggregates,t.attributesSchemaOptions)),filter:z2(t.queryEngineConfig),prefixes:R.object(),postfixes:R.object(),type:R.valid("singleStat").required(),limit:Gt(),direction:R.string().valid("horizontal","vertical"),conditionalFormattingRules:Wt(t.queryEngineConfig),deltaTimeDimension:R.alternatives(In(t.queryEngineConfig.supportedTimeTruncFunctions),R.valid(null)),parameters:ft(t.queryEngineConfig,t.attributesSchemaOptions),tags:H1()}),qe={title:"Single stat",description:"Shows a single statistical value, ideal for key data point representation.",namespace:"single_stat",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this single stat?"},views:{type:"views",title:"View",description:""},field_metrics:{type:"fieldCollector",title:"Metrics",description:"What do you want to show?",callToAction:"Add metric"},filter:{type:"filter",title:"Filters",description:"Only include the information you want in this scatter chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},comparison:{type:"comparison",title:"Comparison",description:""}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},stats_labels:{type:"statsLabels",title:"Labels",description:"",subSectionDefinition:{prefix:{title:"Prefix",description:"",namespace:"prefix"},postfix:{title:"Postfix",description:"",namespace:"postfix"},format:{title:"Format",description:"",namespace:"format"},count:{title:"Label count",description:"",namespace:"count"}}},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""},format:{type:"format",title:"Format",description:"",subSectionDefinition:{font_size:{title:"Font Size",type:"fontSize",description:"",namespace:"font_size"},direction:{title:"Direction",type:"direction",description:"",namespace:"direction"}}}}},Pu=t=>({title:qe.title,description:qe.description,servicesClass:"SingleStat",namespace:qe.namespace,dump:e=>e,load:e=>{const o=Su(e);return{type:"singleStat",prefixes:o.prefixes,postfixes:o.postfixes,formatter:o.formatter,fontSize:o.fontSize,measure:g1(o.measure),displayTitle:o.displayTitle,displaySubject:o.displaySubject,protectedByOrganisation:e.protectedByOrganisation,viewId:k0(e.viewId),filter:o.filter,dataSetId:o.dataSetId,limit:o.limit,direction:o.direction??"horizontal",conditionalFormattingRules:o.conditionalFormattingRules,deltaTimeDimension:o.deltaTimeDimension,parameters:ut(o.parameters),tags:o.tags??[]}},setAttributes:(e,o)=>I1(e,o,Cl(t)),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"singleStat",measure:[],displayTitle:"",postfixes:{},prefixes:{},formatter:{},fontSize:"2rem",protectedByOrganisation:void 0,displaySubject:"",viewId:k0(o?.viewId),filter:[],dataSetId:e,limit:5e3,direction:"horizontal",conditionalFormattingRules:[],deltaTimeDimension:null,parameters:{},tags:[],...o}),schema:Cl(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(e){const{measure:o}=le(e,t.queryEngineConfig,"singleStat");return this.init(e.id,{measure:[o[0]]})},dataPanelConfig:()=>[P(qe,"data_set"),P(qe,"views"),{...P(qe,"field_metrics"),fieldFilterOptions:{forComponent:"singleStat"},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"},P(qe,"filter"),P(qe,"custom_metrics"),P(qe,"comparison")],formatPanelConfig:()=>[F1(qe),{...P(qe,"stats_labels"),prefix:Vo(qe,"prefix"),postfix:Vo(qe,"postfix"),format:Vo(qe,"format"),count:Vo(qe,"count")},{...P(qe,"format"),subSection:[qe.format_panel.format?.subSectionDefinition.font_size,qe.format_panel.format?.subSectionDefinition.direction]},{...P(qe,"conditional_formatting"),ruleType:"fontColor"}],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,aggregateMaths:!0,rules:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet(e,o){let n=P0.cloneDeep(yr(o.fields,{onlyFieldTypes:["number"]}));return{...e,type:"singleStat",protectedByOrganisation:!0,measure:[...n].map(b=>({function:"none",field:b.id}))}}}),El=t=>R.object({...Y1(t.attributesSchemaOptions),measure:R.array().items(he(t.queryEngineConfig.supportedAggregates,t.attributesSchemaOptions)),dimension:Bt(t.queryEngineConfig.supportedTimeTruncFunctions,t.attributesSchemaOptions),filter:z2(t.queryEngineConfig),timeDimension:R.valid(null),order:R.array().items(uo(t.queryEngineConfig)),type:R.valid("sunburstChart").required(),legend:R.valid(!0,!1),labels:R.valid(!0,!1),limit:Gt(),labelsAsPercentage:R.boolean(),conditionalFormattingRules:Wt(t.queryEngineConfig),labelFormat:R.alternatives(R.string(),R.valid(null)),parameters:ft(t.queryEngineConfig,t.attributesSchemaOptions),tags:H1(),drilldownOptions:jO(t.queryEngineConfig)}),$e={title:"Sunburst chart",description:"Represents data in a sunburst format, useful for showing proportions.",namespace:"sunburst_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this sunburst chart?"},views:{type:"views",title:"View",description:""},field_metrics:{type:"fieldCollector",title:"Metric",description:"What do you want each segment to measure?",callToAction:"Add metric"},drilldown:{type:"drilldown",title:"Drilldown",description:"After clicking on a segment of this sunburst chart, what information do you want to see next?"},field_grouping:{type:"fieldCollector",title:"Grouping",description:"How do you want to split each section of the sunburst chart?",callToAction:"Add comparison"},sort:{type:"sort",title:"Sort",description:"Choose the order of segments in the sunburst chart"},filter:{type:"filter",title:"Filters",description:"Only include the information you want in this sunburst chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Limit the number of segments shown on this sunburst chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{number_format:{type:"numberFormat",title:"Format",description:"",namespace:"number_format"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"},labels:{type:"labels",title:"Show Labels",description:"",namespace:"labels"}}},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""}}},Fu=t=>({title:$e.title,description:$e.description,servicesClass:"SunburstChart",namespace:$e.namespace,dump:e=>e,load:e=>({type:e.type,measure:g1(e.measure),order:me(e.order,e.timeDimension),dimension:Oe(e.dimension),viewId:k0(e.viewId),timeDimension:e.timeDimension,displayTitle:e.displayTitle,displaySubject:e.displaySubject,protectedByOrganisation:e.protectedByOrganisation,filter:V1(e.filter),dataSetId:e.dataSetId,limit:e.limit,conditionalFormattingRules:e.conditionalFormattingRules??[],labelsAsPercentage:e.labelsAsPercentage??!1,legend:e.legend??!0,labels:e.labels??!1,labelFormat:e.labelFormat??null,parameters:e.parameters??{},tags:e.tags??[]}),setAttributes:(e,o)=>I1(e,o,El(t)),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"sunburstChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:k0(o?.viewId),filter:[],order:[],dataSetId:e,limit:5e3,conditionalFormattingRules:[],labelsAsPercentage:!1,legend:!0,labels:!1,labelFormat:null,parameters:{},tags:[],...o}),createFeedback:we,schema:El(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),isRunnable:e=>e.measure.length>0&&e.dimension.length>0,autoGenerate(e){const{measure:o,dimension:n}=le(e,t.queryEngineConfig,"sunburstChart");return this.init(e.id,{measure:[o[0]],dimension:n})},dataPanelConfig:()=>[P($e,"data_set"),P($e,"views"),{...P($e,"field_metrics"),fieldFilterOptions:{forComponent:"sunburstChart"},maxAllowed:1,preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"},{...P($e,"field_grouping"),fieldFilterOptions:{onlyFieldTypes:["boolean","number","string"],onlyDimensions:!0,removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},maxAllowed:5,preSetPartialAttributes:e=>({dimension:e}),getValues:e=>e.dimension,testId:"add-dimension"},P($e,"sort"),P($e,"filter"),P($e,"custom_metrics"),P($e,"limit")],formatPanelConfig:()=>[F1($e),{...P($e,"chart_styles"),subSection:[$e.format_panel.chart_styles?.subSectionDefinition.legend,$e.format_panel.chart_styles?.subSectionDefinition.labels,$e.format_panel.chart_styles?.subSectionDefinition.number_format]}],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!0,colorGradient:!1},supportedAggregations:["sum","count"]}),dN=["title","description","data_panel","format_panel"],uN=["title","description","callToAction"],fN="call_to_action",qN=R.alternatives().try(R.string(),R.object({sentence:R.string().custom((t,e)=>{const o=/\{\{(\w+)\}\}/g;let n;for(;(n=o.exec(t))!==null;){const b=n[1];if(!(e.state.ancestors[0][`${b}_singular`]&&e.state.ancestors[0][`${b}_plural`])){const a=`"textOverride": "${b}" found in sentence but corresponding "${b}_singular" and "${b}_plural" fields are missing`;return e.error("any.invalid",{message:a})}}return t})}).pattern(/.+_(singular|plural)$/,R.string())).messages({"any.custom":"{{#message}}"}),WN=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,hN=/<style\b[^<]*(?:(?!<\/style>)<[^<]*)*<\/style>/gi,mN=/on[a-z]+\s*=\s*["'][^"']*["']/gi,gN=/javascript:[^\s"']+/gi,yN=/<(b|strong)>(?:(?!<\/(b|strong)>).)*<\/(b|strong)>/,RN=/<(i|em)>(?:(?!<\/(i|em)>).)*<\/(i|em)>/,LN=new RegExp(`^(?:${yN.source}|${RN.source}|[^*_<>])*$`,"m"),Dl=t=>{if(WN.test(t)||hN.test(t)||mN.test(t)||gN.test(t))throw new Error("Invalid content: potentially malicious elements detected.");return LN.test(t)};function vN(t,e){const o=t[e],n=qN.validate(o);return n.error&&n.error.details.forEach(a=>{At(a.context?.message)}),(()=>{if(typeof o=="string")return Dl(o);if(typeof o=="object")return Dl(o.sentence);if(o===void 0)return!0;throw new Error("Invalid translation type")})()?o:void 0}const _N=(t,e,o,n)=>$O(t,e,o,void 0,n),$O=(t,e,o,n,b)=>{if(b)return`[key: ${t}]`;const a=n?vN(n,t):void 0;let O;return typeof a=="object"&&a!==null?O=a.sentence:typeof a=="string"?O=a:O=e,O=BN(O,o),o&&(O=NN(O,o,a)),TN(O,o)};function NN(t,e,o){return Object.entries(e).forEach(([n,b])=>{if(b&&typeof b=="object"&&"count"in b){const a=b,O=a.count===1?o&&o[`${n}_singular`]||a.singular:o&&o[`${n}_plural`]||a.plural;t=t.replace(new RegExp(`{{${n}}}`,"g"),O)}}),t}function TN(t,e){if(!e)return t;for(const[o,n]of Object.entries(e))if(typeof n=="string"||typeof n=="number"){const b=new RegExp(`\\[\\[${o}\\]\\]`,"g");t=t.replace(b,String(n))}return t}function BN(t,e){if(!e)return t;const o=/\[\[([^\]]+)\]\]/g;return t.replace(o,(n,b)=>{const a=b.split("|");for(const O of a){const A=e[O];if(typeof A=="string"&&A!=="")return A;if(typeof A=="number")return A.toString()}return""})}const C1=(t,e)=>{const o=e??$O;let n=t;const b=t.namespace;return dN.forEach(a=>{if(a==="title"||a==="description"){const O=o(`${b}.${a}`,t[a]);n={...n,[a]:O}}if(a==="data_panel"){const O=`${b}.${a}`,A=[];t.dataPanelConfig().forEach(c=>{c.subSection&&(c.subSection=Il(c,o,O)),nM(c).forEach(y=>{const v=o(`${O}.${y.key}`,y.defaultValue);c[y.property]=v}),A.push(c)}),n={...n,dataPanelConfig:()=>A}}if(a==="format_panel"){const O=`${b}.${a}`,A=[];t.formatPanelConfig().forEach(c=>{c.subSection&&(c.subSection=Il(c,o,O)),SN(o,O,c),nM(c).forEach(y=>{const v=o(`${O}.${y.key}`,y.defaultValue);c[y.property]=v}),A.push(c)}),n={...n,formatPanelConfig:()=>A}}}),n},Ts=["count","axisTitle","format","postfix","prefix"];function SN(t,e,o){function n(a,O){a&&nM(a).forEach(A=>{const c=t(`${e}.${O}.${A.key}`,A.defaultValue);a[A.property]=c})}function b(a,O,A){O.forEach(c=>{const y=a[c];y&&n(y,A)})}o.x&&(b(o.x,Ts,"axis_labels"),n(o.x,"axis_labels")),o.y&&(b(o.y,Ts,"axis_labels"),n(o.y,"axis_labels")),wN(o)&&b(o,Ts,"stats_labels")}function Il(t,e,o){return t.subSection?.map(n=>(nM(n).forEach(b=>{const a=e(`${o}.${t.namespace}.${b.key}`,b.defaultValue);n[b.property]=a}),n))}function nM(t){const e=t.namespace||t.type;if(!e)return[];const o=[];return uN.forEach(n=>{if(t[n]){let b=n;n==="callToAction"&&(b=fN),o.push({key:`${e}.${b}`,defaultValue:t[n],property:n})}}),o}function wN(t){return"prefix"in t}const ku=t=>R.object({...Y1(t.attributesSchemaOptions),...c2(t.queryEngineConfig,t.attributesSchemaOptions),legend:R.valid(!0,!1),labels:R.valid(!0,!1).optional(),type:R.valid("waterfallChart").required(),parameters:ft(t.queryEngineConfig,t.attributesSchemaOptions),axisTitles:qt(),headline:X2(),tags:H1(),increaseColor:R.string().required(),decreaseColor:R.string().required(),comparison:R.any()}),xN=t=>(e,o)=>{let n=I1(e,o,ku(t));return n=wt(n),n},Se={title:"Waterfall chart",description:"Shows a running total as values are added or subtracted. It's useful for understanding how an initial value is affected by a series of positive and negative values.",namespace:"waterfall_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this waterfall chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each bar to measure?",callToAction:"Add metric"},field_x_axis:{type:"fieldCollector",title:"Grouping - X Axis",description:"What do you want each bar to represent? An example would be a a date grouping to show each month as a bar",callToAction:"Add grouping"},dateComparison:{type:"dateComparison",title:"Comparison",description:"Compare the waterfall chart to a previous period.",callToAction:"Add comparison"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this waterfall chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this waterfall chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"},labels:{type:"labels",title:"Show Labels",description:"",namespace:"labels"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},headline:{type:"headline",title:"Headline",description:""},waterfall_colors:{type:"waterfallColors",title:"Color selector",description:""}}},ju=t=>({title:Se.title,description:Se.description,servicesClass:"WaterfallChart",namespace:Se.namespace,dump:e=>e,load:e=>({measure:g1(e.measure),order:me(e.order,e.timeDimension),filter:V1(e.filter),dimension:Oe(e.dimension),parameters:ut(e.parameters),headline:ho(e.headline,e.timeDimension),tags:e.tags??[],legend:e.legend,labels:e.labels,viewId:k0(e.viewId),dataSetId:e.dataSetId,limit:e.limit,timeDimension:null,xAxisPostfix:e.xAxisPostfix,xAxisPrefix:e.xAxisPrefix,yAxisPostfix:e.yAxisPostfix,yAxisPrefix:e.yAxisPrefix,yAxisFormat:e.yAxisFormat,xAxisFormat:e.xAxisFormat,approxXAxisLabelCount:y1(e.approxXAxisLabelCount),approxYAxisLabelCount:y1(e.approxYAxisLabelCount),axisTitles:e.axisTitles,displaySubject:e.displaySubject,displayTitle:e.displayTitle,increaseColor:e.increaseColor,decreaseColor:e.decreaseColor,protectedByOrganisation:e.protectedByOrganisation,type:e.type,offset:e.offset,comparison:e.comparison}),setAttributes:xN(t),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"waterfallChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",viewId:k0(o?.viewId),filter:[],order:[],dataSetId:e,limit:5e3,protectedByOrganisation:void 0,offset:void 0,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,legend:!0,labels:!1,parameters:{},axisTitles:void 0,headline:void 0,increaseColor:"#00FF00",decreaseColor:"#FF0000",tags:[],approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",comparison:null,...o}),createFeedback:we,schema:ku(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),isRunnable:e=>e.measure.length>0&&(e.dimension.length>0||e.timeDimension!==null),autoGenerate(e){const{measure:o,dimension:n}=le(e,t.queryEngineConfig,"waterfallChart");return this.init(e.id,{measure:[o[0]],dimension:n})},dataPanelConfig:()=>[P(Se,"data_set"),P(Se,"views"),{...P(Se,"field_y_axis"),fieldFilterOptions:{forComponent:"waterfallChart",onlyMeasures:!0},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input",maxAllowed:1},{...P(Se,"field_x_axis"),fieldFilterOptions:{forComponent:"waterfallChart",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:(e,o)=>Nr(e,o),getValues:e=>Zo(e),maxAllowed:1,testId:"add-dimension"},{...P(Se,"dateComparison"),maxAllowed:1},P(Se,"sort"),P(Se,"filter"),P(Se,"custom_metrics"),P(Se,"limit")],formatPanelConfig:()=>[F1(Se),P(Se,"waterfall_colors"),{...P(Se,"chart_styles"),subSection:[Se.format_panel.chart_styles?.subSectionDefinition.legend,Se.format_panel.chart_styles?.subSectionDefinition.labels]},Ge(Se)],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet(e,o){return O2(e,o,this.setAttributes)}}),E1={queryEngineConfig:{supportedFeatures:[],supportedAggregates:{},supportedTimeTruncFunctions:{},supportedOperators:{},supportedTransformationFunctions:{}}};function ib(t,e){if(t=="areaChart")return C1(eu(e||E1),e?.textOverride);if(t=="barChart")return C1(ru(e||E1),e?.textOverride);if(t=="basicTable")return C1(au(e||E1),e?.textOverride);if(t=="bubbleChart")return C1(zu(e||E1),e?.textOverride);if(t=="bubbleChartV2")return C1(su(e||E1),e?.textOverride);if(t=="comboChart")return C1(Au(e||E1),e?.textOverride);if(t=="custom")return C1(fu(e||E1),e?.textOverride);if(t=="dataTable")return C1(Wu(e||E1),e?.textOverride);if(t=="funnelChart")return C1(hu(e||E1),e?.textOverride);if(t=="richText")return C1(Eu(e||E1),e?.textOverride);if(t=="horizontalBarChart")return C1(mu(e||E1),e?.textOverride);if(t=="horizontalBarChartV2")return C1(yu(e||E1),e?.textOverride);if(t=="lineChart")return C1(Lu(e||E1),e?.textOverride);if(t=="lineChartV2")return C1(_u(e||E1),e?.textOverride);if(t=="barChartV2")return C1(iu(e||E1),e?.textOverride);if(t=="areaChartV2")return C1(ou(e||E1),e?.textOverride);if(t=="comboChartV2")return C1(uu(e||E1),e?.textOverride);if(t=="mercatorMap")return C1(Tu(e||E1),e?.textOverride);if(t=="pieChart")return C1(Bu(e||E1),e?.textOverride);if(t=="sunburstChart")return C1(Fu(e||E1),e?.textOverride);if(t=="progress")return C1(wu(e||E1),e?.textOverride);if(t=="scatterChart")return C1(Iu(e||E1),e?.textOverride);if(t=="singleStat")return C1(Pu(e||E1),e?.textOverride);if(t=="waterfallChart")return C1(ju(e||E1),e?.textOverride);if(t=="radarChart")return C1(Xu(e||E1),e?.textOverride);throw`Cannot get interface for ${t}. Please implement it.`}const Pl=R.object({fieldId:R.string().required(),dataSetId:R.string().required()}),XN=t=>R.object().pattern(R.string(),Y6(t)),Sb=t=>({title:R.string().allow(""),managedByConfiguration:R.boolean().optional(),requiresValue:R.boolean().optional(),optionsFilters:XN(t).optional(),appliesToFields:R.array().items(Pl).required(),optionsPulledFrom:R.array().items(Pl).optional(),hidden:R.boolean(),options:R.array().items(R.object({value:R.allow(R.number(),R.string()),label:R.string()})).optional()}),CN=(t,e)=>R.object({...Sb(t),type:R.valid(DO).required(),value:R.alternatives(R.string(),R.number(),R.boolean(),R.valid(...e?[]:[null]))}),EN=(t,e)=>R.object({...Sb(t),type:R.valid(Yi).required(),value:R.alternatives(R.array().items(R.string(),R.number()).single(),R.valid(...e?[]:[null]),R.array().items(R.array().items(Pn(t))))}),DN=(t,e)=>R.object({...Sb(t),type:R.valid(PO).required(),value:IN(t,e)}),IN=(t,e)=>R.alternatives(R.valid(...e?[]:[null]),R.array().items(R.array().items(Pn(t)))),Fl=(t,e,o)=>R.object({...Sb(t),type:R.valid(o).required(),inclusiveDate:R.boolean().optional(),allowTimeSelection:R.boolean().optional(),value:R.alternatives(R.valid(...e?[]:[null]),R.object({type:R.valid("fixedRange"),before:R.alternatives(R.date()).required(),after:R.alternatives(R.date()).required()}),R.object({type:R.valid("relative"),value:R.string()}),R.object({type:R.valid("relativeRange"),filters:R.array()}))}),PN=(t,e)=>R.object({...Sb(t),type:R.valid(IO).required(),value:R.alternatives(R.object({op:R.allow("=","<",">","<=",">="),value:R.number().allow(null,0)}),R.array().items(R.array().items(Pn(t))),R.valid(...e?[]:[null]))}),$u=(t,e)=>R.alternatives().conditional(".type",{is:DO,then:CN(t,e)}).conditional(".type",{is:Go,then:Fl(t,e,Go)}).conditional(".type",{is:mr,then:Fl(t,e,mr)}).conditional(".type",{is:Yi,then:EN(t,e)}).conditional(".type",{is:IO,then:PN(t,e)}).conditional(".type",{is:PO,then:DN(t,e)});function FN(t){return R.array().items(R.custom((e,o)=>{if(!t)return o.error("any.invalid");const n=$u(t,!!e.requiresValue),{error:b}=n.validate(e);return b?o.error("any.invalid",{message:b.message}):e})).required()}var kN={exports:{}};/**
61
+ `}]}]},Eu=t=>({title:Nt.title,description:Nt.description,servicesClass:"RichText",namespace:Nt.namespace,dump:e=>e,load:e=>({dataSetId:e.dataSetId,displaySubject:e.displaySubject,displayTitle:e.displayTitle,protectedByOrganisation:e.protectedByOrganisation,viewId:k0(e.viewId),type:"richText",dimension:e.dimension,limit:e.limit,measure:g1(e.measure),filter:V1(e.filter),tags:e.tags??[],content:e.content||"",order:e.order||[],timeDimension:e.timeDimension||null}),setAttributes:ON(t),validate:()=>[],init:(e,o)=>({type:"richText",dataSetId:e,dimension:[],measure:[],displaySubject:"",displayTitle:"",limit:5e3,filter:[],viewId:k0(o?.viewId),tags:[],order:[],timeDimension:null,content:lN,...o}),schema:Cu(t),removeField(e,o){return e},isRunnable:e=>!!(e.measure&&e.measure[0]),autoGenerate(e){return this.init(e.id)},dataPanelConfig:()=>[P(Nt,"data_set"),P(Nt,"views"),{...P(Nt,"field_metrics"),fieldFilterOptions:{forComponent:"richText",onlyMeasures:!0},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"},{...P(Nt,"field_grouping"),fieldFilterOptions:{forComponent:"richText",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:(e,o)=>Nr(e,o),getValues:e=>Zo(e),maxAllowed:2,testId:"add-dimension"},P(Nt,"sort"),P(Nt,"filter"),P(Nt,"custom_metrics"),P(Nt,"limit")],formatPanelConfig:()=>[F1(Nt),{...P(Nt,"rich_text")}],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!1,colorGradient:!1}}),Du=t=>R.object({...Y1(t.attributesSchemaOptions),xMeasure:he(t.queryEngineConfig.supportedAggregates,t.attributesSchemaOptions).allow(null),yMeasure:he(t.queryEngineConfig.supportedAggregates,t.attributesSchemaOptions).allow(null),dimension:Bt(t.queryEngineConfig.supportedTimeTruncFunctions,t.attributesSchemaOptions),order:R.array().items(uo(t.queryEngineConfig)),limit:Gt(),legend:R.valid(!0,!1),offset:R.number().min(0),filter:z2(t.queryEngineConfig),type:R.valid("scatterChart").required(),timeDimension:R.valid(null),xAxisPrefix:R.string().allow(""),yAxisPrefix:R.string().allow(""),xAxisPostfix:R.string().allow(""),yAxisPostfix:R.string().allow(""),yAxisFormat:R.alternatives(R.string(),R.valid(null)),xAxisFormat:R.alternatives(R.string(),R.valid(null)),approxYAxisLabelCount:S2,approxXAxisLabelCount:S2,goalLines:Vt(),quadrants:EA(),axisTitles:qt(),tags:H1()}),AN=t=>(e,o)=>{let n=I1(e,o,Du(t)),b=[];return n.xMeasure&&b.push(n.xMeasure),n.yMeasure&&b.push(n.yMeasure),n.dimension.forEach(a=>{b.push({field:a.field,function:a.function})}),n=Dn(n,b),n},Be={title:"Scatter chart",description:"Displays data points on a Cartesian plane, perfect for showing correlations.",namespace:"scatter_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this scatter chart?"},views:{type:"views",title:"View",description:""},labelled_metrics:{type:"labelledMetrics",title:"Metric - Y Axis",description:"",subSectionDefinition:{xAxis:{type:"metrics",title:"X axis",namespace:"metrics.xAxis"},yAxis:{type:"metrics",title:"Y axis",namespace:"metrics.yAxis"}}},field_grouping:{type:"fieldCollector",title:"Grouping",description:"What do you want each dot to represent?",callToAction:"Add comparison"},filter:{type:"filter",title:"Filters",description:"Only include the information you want in this scatter chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Limit the number of data points shown on this scatter chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},goal_line:{type:"goalLine",title:"Goal Lines",description:""},quadrants:{type:"quadrants",title:"",description:""}}},Iu=t=>({title:Be.title,description:Be.description,servicesClass:"ScatterChart",namespace:Be.namespace,dump:e=>e,load:e=>({type:e.type,xMeasure:g1(e.xMeasure?[e.xMeasure]:[])[0]||null,yMeasure:g1(e.yMeasure?[e.yMeasure]:[])[0]||null,dimension:Oe(e.dimension),viewId:k0(e.viewId),timeDimension:e.timeDimension,displayTitle:e.displayTitle,displaySubject:e.displaySubject,protectedByOrganisation:e.protectedByOrganisation,filter:V1(e.filter),order:me(e.order,e.timeDimension),dataSetId:e.dataSetId,limit:e.limit,legend:e.legend,xAxisFormat:e.xAxisFormat,yAxisFormat:e.yAxisFormat,yAxisPostfix:e.yAxisPostfix,yAxisPrefix:e.yAxisPrefix,xAxisPostfix:e.xAxisPostfix,xAxisPrefix:e.xAxisPrefix,approxXAxisLabelCount:R1(e.approxXAxisLabelCount),approxYAxisLabelCount:R1(e.approxYAxisLabelCount),goalLines:e.goalLines,quadrants:e.quadrants,axisTitles:e.axisTitles,tags:e.tags??[]}),setAttributes:AN(t),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"scatterChart",xMeasure:null,yMeasure:null,dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:k0(o?.viewId),filter:[],order:[],dataSetId:e,limit:5e3,legend:!0,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",goalLines:void 0,quadrants:void 0,axisTitles:void 0,tags:[],...o}),createFeedback:we,schema:Du(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),isRunnable:e=>!!e.xMeasure&&!!e.yMeasure&&e.dimension.length>0,autoGenerate(e){const{measure:o,dimension:n}=le(e,t.queryEngineConfig,"scatterChart");return this.init(e.id,{xMeasure:o[0],yMeasure:o[1],dimension:n})},dataPanelConfig:()=>[P(Be,"data_set"),P(Be,"views"),{...P(Be,"labelled_metrics"),subSection:[{...Be.data_panel.labelled_metrics?.subSectionDefinition.xAxis,propKey:"xMeasure",allowsMultiple:!1},{...Be.data_panel.labelled_metrics?.subSectionDefinition.yAxis,propKey:"yMeasure",allowsMultiple:!1}]},{...P(Be,"field_grouping"),fieldFilterOptions:{onlyDimensions:!0,onlyFieldTypes:["boolean","number","string"],removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},maxAllowed:1,preSetPartialAttributes:e=>({dimension:e}),getValues:e=>e.dimension,testId:"add-dimension"},P(Be,"filter"),P(Be,"custom_metrics"),P(Be,"limit")],formatPanelConfig:()=>[F1(Be),{...P(Be,"chart_styles"),subSection:[Be.format_panel.chart_styles?.subSectionDefinition.legend]},Ge(Be),P(Be,"quadrants"),P(Be,"goal_line")],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!1,colorGradient:!1}}),Cl=t=>R.object({...Y1(t.attributesSchemaOptions),fontSize:R.string().allow(""),formatter:R.object(),measure:R.array().items(he(t.queryEngineConfig.supportedAggregates,t.attributesSchemaOptions)),filter:z2(t.queryEngineConfig),prefixes:R.object(),postfixes:R.object(),type:R.valid("singleStat").required(),limit:Gt(),direction:R.string().valid("horizontal","vertical"),conditionalFormattingRules:Wt(t.queryEngineConfig),deltaTimeDimension:R.alternatives(In(t.queryEngineConfig.supportedTimeTruncFunctions),R.valid(null)),parameters:ft(t.queryEngineConfig,t.attributesSchemaOptions),tags:H1()}),qe={title:"Single stat",description:"Shows a single statistical value, ideal for key data point representation.",namespace:"single_stat",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this single stat?"},views:{type:"views",title:"View",description:""},field_metrics:{type:"fieldCollector",title:"Metrics",description:"What do you want to show?",callToAction:"Add metric"},filter:{type:"filter",title:"Filters",description:"Only include the information you want in this scatter chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},comparison:{type:"comparison",title:"Comparison",description:""}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},stats_labels:{type:"statsLabels",title:"Labels",description:"",subSectionDefinition:{prefix:{title:"Prefix",description:"",namespace:"prefix"},postfix:{title:"Postfix",description:"",namespace:"postfix"},format:{title:"Format",description:"",namespace:"format"},count:{title:"Label count",description:"",namespace:"count"}}},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""},format:{type:"format",title:"Format",description:"",subSectionDefinition:{font_size:{title:"Font Size",type:"fontSize",description:"",namespace:"font_size"},direction:{title:"Direction",type:"direction",description:"",namespace:"direction"}}}}},Pu=t=>({title:qe.title,description:qe.description,servicesClass:"SingleStat",namespace:qe.namespace,dump:e=>e,load:e=>{const o=Su(e);return{type:"singleStat",prefixes:o.prefixes,postfixes:o.postfixes,formatter:o.formatter,fontSize:o.fontSize,measure:g1(o.measure),displayTitle:o.displayTitle,displaySubject:o.displaySubject,protectedByOrganisation:e.protectedByOrganisation,viewId:k0(e.viewId),filter:o.filter,dataSetId:o.dataSetId,limit:o.limit,direction:o.direction??"horizontal",conditionalFormattingRules:o.conditionalFormattingRules,deltaTimeDimension:o.deltaTimeDimension,parameters:ut(o.parameters),tags:o.tags??[]}},setAttributes:(e,o)=>I1(e,o,Cl(t)),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"singleStat",measure:[],displayTitle:"",postfixes:{},prefixes:{},formatter:{},fontSize:"2rem",protectedByOrganisation:void 0,displaySubject:"",viewId:k0(o?.viewId),filter:[],dataSetId:e,limit:5e3,direction:"horizontal",conditionalFormattingRules:[],deltaTimeDimension:null,parameters:{},tags:[],...o}),schema:Cl(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),isRunnable:e=>e.measure.length>0,autoGenerate(e){const{measure:o}=le(e,t.queryEngineConfig,"singleStat");return this.init(e.id,{measure:[o[0]]})},dataPanelConfig:()=>[P(qe,"data_set"),P(qe,"views"),{...P(qe,"field_metrics"),fieldFilterOptions:{forComponent:"singleStat"},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"},P(qe,"filter"),P(qe,"custom_metrics"),P(qe,"comparison")],formatPanelConfig:()=>[F1(qe),{...P(qe,"stats_labels"),prefix:Vo(qe,"prefix"),postfix:Vo(qe,"postfix"),format:Vo(qe,"format"),count:Vo(qe,"count")},{...P(qe,"format"),subSection:[qe.format_panel.format?.subSectionDefinition.font_size,qe.format_panel.format?.subSectionDefinition.direction]},{...P(qe,"conditional_formatting"),ruleType:"fontColor"}],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,aggregateMaths:!0,rules:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet(e,o){let n=P0.cloneDeep(yr(o.fields,{onlyFieldTypes:["number"]}));return{...e,type:"singleStat",protectedByOrganisation:!0,measure:[...n].map(b=>({function:"none",field:b.id}))}}}),El=t=>R.object({...Y1(t.attributesSchemaOptions),measure:R.array().items(he(t.queryEngineConfig.supportedAggregates,t.attributesSchemaOptions)),dimension:Bt(t.queryEngineConfig.supportedTimeTruncFunctions,t.attributesSchemaOptions),filter:z2(t.queryEngineConfig),timeDimension:R.valid(null),order:R.array().items(uo(t.queryEngineConfig)),type:R.valid("sunburstChart").required(),legend:R.valid(!0,!1),labels:R.valid(!0,!1),limit:Gt(),labelsAsPercentage:R.boolean(),conditionalFormattingRules:Wt(t.queryEngineConfig),labelFormat:R.alternatives(R.string(),R.valid(null)),parameters:ft(t.queryEngineConfig,t.attributesSchemaOptions),tags:H1(),drilldownOptions:jO(t.queryEngineConfig)}),$e={title:"Sunburst chart",description:"Represents data in a sunburst format, useful for showing proportions.",namespace:"sunburst_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this sunburst chart?"},views:{type:"views",title:"View",description:""},field_metrics:{type:"fieldCollector",title:"Metric",description:"What do you want each segment to measure?",callToAction:"Add metric"},drilldown:{type:"drilldown",title:"Drilldown",description:"After clicking on a segment of this sunburst chart, what information do you want to see next?"},field_grouping:{type:"fieldCollector",title:"Grouping",description:"How do you want to split each section of the sunburst chart?",callToAction:"Add comparison"},sort:{type:"sort",title:"Sort",description:"Choose the order of segments in the sunburst chart"},filter:{type:"filter",title:"Filters",description:"Only include the information you want in this sunburst chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Limit the number of segments shown on this sunburst chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{number_format:{type:"numberFormat",title:"Format",description:"",namespace:"number_format"},legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"},labels:{type:"labels",title:"Show Labels",description:"",namespace:"labels"}}},conditional_formatting:{type:"conditionalFormatting",title:"Conditional Formatting",description:""}}},Fu=t=>({title:$e.title,description:$e.description,servicesClass:"SunburstChart",namespace:$e.namespace,dump:e=>e,load:e=>({type:e.type,measure:g1(e.measure),order:me(e.order,e.timeDimension),dimension:Oe(e.dimension),viewId:k0(e.viewId),timeDimension:e.timeDimension,displayTitle:e.displayTitle,displaySubject:e.displaySubject,protectedByOrganisation:e.protectedByOrganisation,filter:V1(e.filter),dataSetId:e.dataSetId,limit:e.limit,conditionalFormattingRules:e.conditionalFormattingRules??[],labelsAsPercentage:e.labelsAsPercentage??!1,legend:e.legend??!0,labels:e.labels??!1,labelFormat:e.labelFormat??null,parameters:e.parameters??{},tags:e.tags??[]}),setAttributes:(e,o)=>I1(e,o,El(t)),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"sunburstChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",protectedByOrganisation:void 0,viewId:k0(o?.viewId),filter:[],order:[],dataSetId:e,limit:5e3,conditionalFormattingRules:[],labelsAsPercentage:!1,legend:!0,labels:!1,labelFormat:null,parameters:{},tags:[],...o}),createFeedback:we,schema:El(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),isRunnable:e=>e.measure.length>0&&e.dimension.length>0,autoGenerate(e){const{measure:o,dimension:n}=le(e,t.queryEngineConfig,"sunburstChart");return this.init(e.id,{measure:[o[0]],dimension:n})},dataPanelConfig:()=>[P($e,"data_set"),P($e,"views"),{...P($e,"field_metrics"),fieldFilterOptions:{forComponent:"sunburstChart"},maxAllowed:1,preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input"},{...P($e,"field_grouping"),fieldFilterOptions:{onlyFieldTypes:["boolean","number","string"],onlyDimensions:!0,removePercentage:!0,removeSimpleMaths:!0,removeAggregateMaths:!0},maxAllowed:5,preSetPartialAttributes:e=>({dimension:e}),getValues:e=>e.dimension,testId:"add-dimension"},P($e,"sort"),P($e,"filter"),P($e,"custom_metrics"),P($e,"limit")],formatPanelConfig:()=>[F1($e),{...P($e,"chart_styles"),subSection:[$e.format_panel.chart_styles?.subSectionDefinition.legend,$e.format_panel.chart_styles?.subSectionDefinition.labels,$e.format_panel.chart_styles?.subSectionDefinition.number_format]}],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!0,colorGradient:!1},supportedAggregations:["sum","count"]}),dN=["title","description","data_panel","format_panel"],uN=["title","description","callToAction"],fN="call_to_action",qN=R.alternatives().try(R.string(),R.object({sentence:R.string().custom((t,e)=>{const o=/\{\{(\w+)\}\}/g;let n;for(;(n=o.exec(t))!==null;){const b=n[1];if(!(e.state.ancestors[0][`${b}_singular`]&&e.state.ancestors[0][`${b}_plural`])){const a=`"textOverride": "${b}" found in sentence but corresponding "${b}_singular" and "${b}_plural" fields are missing`;return e.error("any.invalid",{message:a})}}return t})}).pattern(/.+_(singular|plural)$/,R.string())).messages({"any.custom":"{{#message}}"}),WN=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,hN=/<style\b[^<]*(?:(?!<\/style>)<[^<]*)*<\/style>/gi,mN=/on[a-z]+\s*=\s*["'][^"']*["']/gi,gN=/javascript:[^\s"']+/gi,yN=/<(b|strong)>(?:(?!<\/(b|strong)>).)*<\/(b|strong)>/,RN=/<(i|em)>(?:(?!<\/(i|em)>).)*<\/(i|em)>/,LN=new RegExp(`^(?:${yN.source}|${RN.source}|[^*_<>])*$`,"m"),Dl=t=>{if(WN.test(t)||hN.test(t)||mN.test(t)||gN.test(t))throw new Error("Invalid content: potentially malicious elements detected.");return LN.test(t)};function vN(t,e){const o=t[e],n=qN.validate(o);return n.error&&n.error.details.forEach(a=>{At(a.context?.message)}),(()=>{if(typeof o=="string")return Dl(o);if(typeof o=="object")return Dl(o.sentence);if(o===void 0)return!0;throw new Error("Invalid translation type")})()?o:void 0}const _N=(t,e,o,n)=>$O(t,e,o,void 0,n),$O=(t,e,o,n,b)=>{if(b)return`[key: ${t}]`;const a=n?vN(n,t):void 0;let O;return typeof a=="object"&&a!==null?O=a.sentence:typeof a=="string"?O=a:O=e,O=BN(O,o),o&&(O=NN(O,o,a)),TN(O,o)};function NN(t,e,o){return Object.entries(e).forEach(([n,b])=>{if(b&&typeof b=="object"&&"count"in b){const a=b,O=a.count===1?o&&o[`${n}_singular`]||a.singular:o&&o[`${n}_plural`]||a.plural;t=t.replace(new RegExp(`{{${n}}}`,"g"),O)}}),t}function TN(t,e){if(!e)return t;for(const[o,n]of Object.entries(e))if(typeof n=="string"||typeof n=="number"){const b=new RegExp(`\\[\\[${o}\\]\\]`,"g");t=t.replace(b,String(n))}return t}function BN(t,e){if(!e)return t;const o=/\[\[([^\]]+)\]\]/g;return t.replace(o,(n,b)=>{const a=b.split("|");for(const O of a){const A=e[O];if(typeof A=="string"&&A!=="")return A;if(typeof A=="number")return A.toString()}return""})}const C1=(t,e)=>{const o=e??$O;let n=t;const b=t.namespace;return dN.forEach(a=>{if(a==="title"||a==="description"){const O=o(`${b}.${a}`,t[a]);n={...n,[a]:O}}if(a==="data_panel"){const O=`${b}.${a}`,A=[];t.dataPanelConfig().forEach(c=>{c.subSection&&(c.subSection=Il(c,o,O)),nM(c).forEach(y=>{const v=o(`${O}.${y.key}`,y.defaultValue);c[y.property]=v}),A.push(c)}),n={...n,dataPanelConfig:()=>A}}if(a==="format_panel"){const O=`${b}.${a}`,A=[];t.formatPanelConfig().forEach(c=>{c.subSection&&(c.subSection=Il(c,o,O)),SN(o,O,c),nM(c).forEach(y=>{const v=o(`${O}.${y.key}`,y.defaultValue);c[y.property]=v}),A.push(c)}),n={...n,formatPanelConfig:()=>A}}}),n},Ts=["count","axisTitle","format","postfix","prefix"];function SN(t,e,o){function n(a,O){a&&nM(a).forEach(A=>{const c=t(`${e}.${O}.${A.key}`,A.defaultValue);a[A.property]=c})}function b(a,O,A){O.forEach(c=>{const y=a[c];y&&n(y,A)})}o.x&&(b(o.x,Ts,"axis_labels"),n(o.x,"axis_labels")),o.y&&(b(o.y,Ts,"axis_labels"),n(o.y,"axis_labels")),wN(o)&&b(o,Ts,"stats_labels")}function Il(t,e,o){return t.subSection?.map(n=>(nM(n).forEach(b=>{const a=e(`${o}.${t.namespace}.${b.key}`,b.defaultValue);n[b.property]=a}),n))}function nM(t){const e=t.namespace||t.type;if(!e)return[];const o=[];return uN.forEach(n=>{if(t[n]){let b=n;n==="callToAction"&&(b=fN),o.push({key:`${e}.${b}`,defaultValue:t[n],property:n})}}),o}function wN(t){return"prefix"in t}const ku=t=>R.object({...Y1(t.attributesSchemaOptions),...c2(t.queryEngineConfig,t.attributesSchemaOptions),legend:R.valid(!0,!1),labels:R.valid(!0,!1).optional(),type:R.valid("waterfallChart").required(),parameters:ft(t.queryEngineConfig,t.attributesSchemaOptions),axisTitles:qt(),headline:X2(),tags:H1(),increaseColor:R.string().required(),decreaseColor:R.string().required(),comparison:R.any()}),xN=t=>(e,o)=>{let n=I1(e,o,ku(t));return n=wt(n),n},Se={title:"Waterfall chart",description:"Shows a running total as values are added or subtracted. It's useful for understanding how an initial value is affected by a series of positive and negative values.",namespace:"waterfall_chart",data_panel:{data_set:{type:"dataSet",title:"Data set",description:"What data do you want to use in this waterfall chart?"},views:{type:"views",title:"View",description:""},field_y_axis:{type:"fieldCollector",title:"Metric - Y Axis",description:"What do you want each bar to measure?",callToAction:"Add metric"},field_x_axis:{type:"fieldCollector",title:"Grouping - X Axis",description:"What do you want each bar to represent? An example would be a a date grouping to show each month as a bar",callToAction:"Add grouping"},dateComparison:{type:"dateComparison",title:"Comparison",description:"Compare the waterfall chart to a previous period.",callToAction:"Add comparison"},sort:{type:"sort",title:"Sort",description:"Select the order of categories or time on the x Axis."},filter:{type:"filter",title:"Filters",description:"Only include the information you want to use in this waterfall chart."},custom_metrics:{type:"customMetrics",title:"Custom metrics",description:"Build your own metrics, such as a percentage."},limit:{type:"limit",title:"Limit",description:"Set the maximum number of records to show on this waterfall chart."}},format_panel:{heading:{type:"heading",title:"Heading",description:"",subSectionDefinition:{title:{type:"title",title:"Title",description:"",namespace:"title"},subject:{title:"Subject",type:"subject",description:"",namespace:"subject"}}},chart_styles:{type:"chartStyles",title:"Chart Settings",description:"",subSectionDefinition:{legend:{type:"legend",title:"Show Legend",description:"",namespace:"legend"},labels:{type:"labels",title:"Show Labels",description:"",namespace:"labels"}}},axis_labels:{type:"axisLabels",title:"Axis Preferences",description:"",subSectionDefinition:{x:{title:"X Axis",description:"",namespace:"x"},"x.prefix":{title:"Prefix",description:"",namespace:"x.prefix"},"x.postfix":{title:"Postfix",description:"",namespace:"x.postfix"},"x.format":{title:"Format",description:"",namespace:"x.format"},"x.count":{title:"Label count",description:"",namespace:"x.count"},"x.axis_title":{title:"Title",description:"",namespace:"x.axis_title"},y:{title:"Y Axis",description:"",namespace:"y"},"y.prefix":{title:"Prefix",description:"",namespace:"y.prefix"},"y.postfix":{title:"Postfix",description:"",namespace:"y.postfix"},"y.format":{title:"Format",description:"",namespace:"y.format"},"y.count":{title:"Label count",description:"",namespace:"y.count"},"y.axis_title":{title:"Title",description:"",namespace:"y.axis_title"}}},headline:{type:"headline",title:"Headline",description:""},waterfall_colors:{type:"waterfallColors",title:"Color selector",description:""}}},ju=t=>({title:Se.title,description:Se.description,servicesClass:"WaterfallChart",namespace:Se.namespace,dump:e=>e,load:e=>({measure:g1(e.measure),order:me(e.order,e.timeDimension),filter:V1(e.filter),dimension:Oe(e.dimension),parameters:ut(e.parameters),headline:ho(e.headline,e.timeDimension),tags:e.tags??[],legend:e.legend,labels:e.labels,viewId:k0(e.viewId),dataSetId:e.dataSetId,limit:e.limit,timeDimension:null,xAxisPostfix:e.xAxisPostfix,xAxisPrefix:e.xAxisPrefix,yAxisPostfix:e.yAxisPostfix,yAxisPrefix:e.yAxisPrefix,yAxisFormat:e.yAxisFormat,xAxisFormat:e.xAxisFormat,approxXAxisLabelCount:R1(e.approxXAxisLabelCount),approxYAxisLabelCount:R1(e.approxYAxisLabelCount),axisTitles:e.axisTitles,displaySubject:e.displaySubject,displayTitle:e.displayTitle,increaseColor:e.increaseColor,decreaseColor:e.decreaseColor,protectedByOrganisation:e.protectedByOrganisation,type:e.type,offset:e.offset,comparison:e.comparison}),setAttributes:xN(t),validate:(e,o)=>K1(e,o,t.queryEngineConfig),init:(e,o)=>({type:"waterfallChart",measure:[],dimension:[],timeDimension:null,displayTitle:"",displaySubject:"",viewId:k0(o?.viewId),filter:[],order:[],dataSetId:e,limit:5e3,protectedByOrganisation:void 0,offset:void 0,xAxisPostfix:"",xAxisPrefix:"",yAxisPostfix:"",yAxisPrefix:"",yAxisFormat:null,xAxisFormat:null,legend:!0,labels:!1,parameters:{},axisTitles:void 0,headline:void 0,increaseColor:"#00FF00",decreaseColor:"#FF0000",tags:[],approxXAxisLabelCount:"auto",approxYAxisLabelCount:"auto",comparison:null,...o}),createFeedback:we,schema:ku(t),removeField:(e,o)=>te(e,o,t.queryEngineConfig),isRunnable:e=>e.measure.length>0&&(e.dimension.length>0||e.timeDimension!==null),autoGenerate(e){const{measure:o,dimension:n}=le(e,t.queryEngineConfig,"waterfallChart");return this.init(e.id,{measure:[o[0]],dimension:n})},dataPanelConfig:()=>[P(Se,"data_set"),P(Se,"views"),{...P(Se,"field_y_axis"),fieldFilterOptions:{forComponent:"waterfallChart",onlyMeasures:!0},preSetPartialAttributes:e=>({measure:e}),getValues:e=>e.measure,testId:"metric-input",maxAllowed:1},{...P(Se,"field_x_axis"),fieldFilterOptions:{forComponent:"waterfallChart",onlyDimensions:!0},preventDuplicates:!0,preSetPartialAttributes:(e,o)=>Nr(e,o),getValues:e=>Zo(e),maxAllowed:1,testId:"add-dimension"},{...P(Se,"dateComparison"),maxAllowed:1},P(Se,"sort"),P(Se,"filter"),P(Se,"custom_metrics"),P(Se,"limit")],formatPanelConfig:()=>[F1(Se),P(Se,"waterfall_colors"),{...P(Se,"chart_styles"),subSection:[Se.format_panel.chart_styles?.subSectionDefinition.legend,Se.format_panel.chart_styles?.subSectionDefinition.labels]},Ge(Se)],supportedCustomFields:{percentages:!0,dateCalculations:!0,simpleMaths:!0,rules:!0,aggregateMaths:!0,roundedNumbers:!0,conditional:!0,customBuild:[W0.Maths,W0.IfStatement,W0.Aggregates]},supportedFeatures:{parameters:!0,colorGradient:!1},setDataAttributesFromPreAggregatedDataSet(e,o){return O2(e,o,this.setAttributes)}}),E1={queryEngineConfig:{supportedFeatures:[],supportedAggregates:{},supportedTimeTruncFunctions:{},supportedOperators:{},supportedTransformationFunctions:{}}};function ib(t,e){if(t=="areaChart")return C1(eu(e||E1),e?.textOverride);if(t=="barChart")return C1(ru(e||E1),e?.textOverride);if(t=="basicTable")return C1(au(e||E1),e?.textOverride);if(t=="bubbleChart")return C1(zu(e||E1),e?.textOverride);if(t=="bubbleChartV2")return C1(su(e||E1),e?.textOverride);if(t=="comboChart")return C1(Au(e||E1),e?.textOverride);if(t=="custom")return C1(fu(e||E1),e?.textOverride);if(t=="dataTable")return C1(Wu(e||E1),e?.textOverride);if(t=="funnelChart")return C1(hu(e||E1),e?.textOverride);if(t=="richText")return C1(Eu(e||E1),e?.textOverride);if(t=="horizontalBarChart")return C1(mu(e||E1),e?.textOverride);if(t=="horizontalBarChartV2")return C1(yu(e||E1),e?.textOverride);if(t=="lineChart")return C1(Lu(e||E1),e?.textOverride);if(t=="lineChartV2")return C1(_u(e||E1),e?.textOverride);if(t=="barChartV2")return C1(iu(e||E1),e?.textOverride);if(t=="areaChartV2")return C1(ou(e||E1),e?.textOverride);if(t=="comboChartV2")return C1(uu(e||E1),e?.textOverride);if(t=="mercatorMap")return C1(Tu(e||E1),e?.textOverride);if(t=="pieChart")return C1(Bu(e||E1),e?.textOverride);if(t=="sunburstChart")return C1(Fu(e||E1),e?.textOverride);if(t=="progress")return C1(wu(e||E1),e?.textOverride);if(t=="scatterChart")return C1(Iu(e||E1),e?.textOverride);if(t=="singleStat")return C1(Pu(e||E1),e?.textOverride);if(t=="waterfallChart")return C1(ju(e||E1),e?.textOverride);if(t=="radarChart")return C1(Xu(e||E1),e?.textOverride);throw`Cannot get interface for ${t}. Please implement it.`}const Pl=R.object({fieldId:R.string().required(),dataSetId:R.string().required()}),XN=t=>R.object().pattern(R.string(),Y6(t)),Sb=t=>({title:R.string().allow(""),managedByConfiguration:R.boolean().optional(),requiresValue:R.boolean().optional(),optionsFilters:XN(t).optional(),appliesToFields:R.array().items(Pl).required(),optionsPulledFrom:R.array().items(Pl).optional(),hidden:R.boolean(),options:R.array().items(R.object({value:R.allow(R.number(),R.string()),label:R.string()})).optional()}),CN=(t,e)=>R.object({...Sb(t),type:R.valid(DO).required(),value:R.alternatives(R.string(),R.number(),R.boolean(),R.valid(...e?[]:[null]))}),EN=(t,e)=>R.object({...Sb(t),type:R.valid(Yi).required(),value:R.alternatives(R.array().items(R.string(),R.number()).single(),R.valid(...e?[]:[null]),R.array().items(R.array().items(Pn(t))))}),DN=(t,e)=>R.object({...Sb(t),type:R.valid(PO).required(),value:IN(t,e)}),IN=(t,e)=>R.alternatives(R.valid(...e?[]:[null]),R.array().items(R.array().items(Pn(t)))),Fl=(t,e,o)=>R.object({...Sb(t),type:R.valid(o).required(),inclusiveDate:R.boolean().optional(),allowTimeSelection:R.boolean().optional(),value:R.alternatives(R.valid(...e?[]:[null]),R.object({type:R.valid("fixedRange"),before:R.alternatives(R.date()).required(),after:R.alternatives(R.date()).required()}),R.object({type:R.valid("relative"),value:R.string()}),R.object({type:R.valid("relativeRange"),filters:R.array()}))}),PN=(t,e)=>R.object({...Sb(t),type:R.valid(IO).required(),value:R.alternatives(R.object({op:R.allow("=","<",">","<=",">="),value:R.number().allow(null,0)}),R.array().items(R.array().items(Pn(t))),R.valid(...e?[]:[null]))}),$u=(t,e)=>R.alternatives().conditional(".type",{is:DO,then:CN(t,e)}).conditional(".type",{is:Go,then:Fl(t,e,Go)}).conditional(".type",{is:mr,then:Fl(t,e,mr)}).conditional(".type",{is:Yi,then:EN(t,e)}).conditional(".type",{is:IO,then:PN(t,e)}).conditional(".type",{is:PO,then:DN(t,e)});function FN(t){return R.array().items(R.custom((e,o)=>{if(!t)return o.error("any.invalid");const n=$u(t,!!e.requiresValue),{error:b}=n.validate(e);return b?o.error("any.invalid",{message:b.message}):e})).required()}var kN={exports:{}};/**
62
62
  * chroma.js - JavaScript library for color conversions
63
63
  *
64
64
  * Copyright (c) 2011-2019, Gregor Aisch
@@ -113,7 +113,7 @@ h0.version="2.30.1";Uy(D1);h0.fn=d0;h0.min=wL;h0.max=xL;h0.now=XL;h0.utc=C2;h0.u
113
113
  * http://www.w3.org/TR/css3-color/#svg-color
114
114
  *
115
115
  * @preserve
116
- */(function(t,e){(function(o,n){t.exports=n()})(O0,function(){for(var o=function(W,_,S){return _===void 0&&(_=0),S===void 0&&(S=1),W<_?_:W>S?S:W},n=o,b=function(W){W._clipped=!1,W._unclipped=W.slice(0);for(var _=0;_<=3;_++)_<3?((W[_]<0||W[_]>255)&&(W._clipped=!0),W[_]=n(W[_],0,255)):_===3&&(W[_]=n(W[_],0,1));return W},a={},O=0,A=["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"];O<A.length;O+=1){var c=A[O];a["[object "+c+"]"]=c.toLowerCase()}var y=function(W){return a[Object.prototype.toString.call(W)]||"object"},v=y,N=function(W,_){return _===void 0&&(_=null),W.length>=3?Array.prototype.slice.call(W):v(W[0])=="object"&&_?_.split("").filter(function(S){return W[0][S]!==void 0}).map(function(S){return W[0][S]}):W[0]},s=y,u=function(W){if(W.length<2)return null;var _=W.length-1;return s(W[_])=="string"?W[_].toLowerCase():null},d=Math.PI,z={clip_rgb:b,limit:o,type:y,unpack:N,last:u,PI:d,TWOPI:d*2,PITHIRD:d/3,DEG2RAD:d/180,RAD2DEG:180/d},M={format:{},autodetect:[]},q=z.last,l=z.clip_rgb,f=z.type,g=M,L=function(){for(var _=[],S=arguments.length;S--;)_[S]=arguments[S];var I=this;if(f(_[0])==="object"&&_[0].constructor&&_[0].constructor===this.constructor)return _[0];var $=q(_),H=!1;if(!$){H=!0,g.sorted||(g.autodetect=g.autodetect.sort(function(b0,f0){return f0.p-b0.p}),g.sorted=!0);for(var k=0,Q=g.autodetect;k<Q.length;k+=1){var J=Q[k];if($=J.test.apply(J,_),$)break}}if(g.format[$]){var n0=g.format[$].apply(null,H?_:_.slice(0,-1));I._rgb=l(n0)}else throw new Error("unknown format: "+_);I._rgb.length===3&&I._rgb.push(1)};L.prototype.toString=function(){return f(this.hex)=="function"?this.hex():"["+this._rgb.join(",")+"]"};var T=L,X=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];return new(Function.prototype.bind.apply(X.Color,[null].concat(W)))};X.Color=T,X.version="2.4.2";var C=X,m=z.unpack,w=Math.max,E=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];var S=m(W,"rgb"),I=S[0],$=S[1],H=S[2];I=I/255,$=$/255,H=H/255;var k=1-w(I,w($,H)),Q=k<1?1/(1-k):0,J=(1-I-k)*Q,n0=(1-$-k)*Q,b0=(1-H-k)*Q;return[J,n0,b0,k]},U=E,z0=z.unpack,a0=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];W=z0(W,"cmyk");var S=W[0],I=W[1],$=W[2],H=W[3],k=W.length>4?W[4]:1;return H===1?[0,0,0,k]:[S>=1?0:255*(1-S)*(1-H),I>=1?0:255*(1-I)*(1-H),$>=1?0:255*(1-$)*(1-H),k]},V=a0,Z=C,u0=T,L0=M,X0=z.unpack,B0=z.type,$0=U;u0.prototype.cmyk=function(){return $0(this._rgb)},Z.cmyk=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];return new(Function.prototype.bind.apply(u0,[null].concat(W,["cmyk"])))},L0.format.cmyk=V,L0.autodetect.push({p:2,test:function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];if(W=X0(W,"cmyk"),B0(W)==="array"&&W.length===4)return"cmyk"}});var h1=z.unpack,d1=z.last,k1=function(W){return Math.round(W*100)/100},be=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];var S=h1(W,"hsla"),I=d1(W)||"lsa";return S[0]=k1(S[0]||0),S[1]=k1(S[1]*100)+"%",S[2]=k1(S[2]*100)+"%",I==="hsla"||S.length>3&&S[3]<1?(S[3]=S.length>3?S[3]:1,I="hsla"):S.length=3,I+"("+S.join(",")+")"},pe=be,J0=z.unpack,T1=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];W=J0(W,"rgba");var S=W[0],I=W[1],$=W[2];S/=255,I/=255,$/=255;var H=Math.min(S,I,$),k=Math.max(S,I,$),Q=(k+H)/2,J,n0;return k===H?(J=0,n0=Number.NaN):J=Q<.5?(k-H)/(k+H):(k-H)/(2-k-H),S==k?n0=(I-$)/(k-H):I==k?n0=2+($-S)/(k-H):$==k&&(n0=4+(S-I)/(k-H)),n0*=60,n0<0&&(n0+=360),W.length>3&&W[3]!==void 0?[n0,J,Q,W[3]]:[n0,J,Q]},nt=T1,M0=z.unpack,_0=z.last,e1=pe,j=nt,e0=Math.round,t0=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];var S=M0(W,"rgba"),I=_0(W)||"rgb";return I.substr(0,3)=="hsl"?e1(j(S),I):(S[0]=e0(S[0]),S[1]=e0(S[1]),S[2]=e0(S[2]),(I==="rgba"||S.length>3&&S[3]<1)&&(S[3]=S.length>3?S[3]:1,I="rgba"),I+"("+S.slice(0,I==="rgb"?3:4).join(",")+")")},c0=t0,R0=z.unpack,x0=Math.round,T0=function(){for(var W,_=[],S=arguments.length;S--;)_[S]=arguments[S];_=R0(_,"hsl");var I=_[0],$=_[1],H=_[2],k,Q,J;if($===0)k=Q=J=H*255;else{var n0=[0,0,0],b0=[0,0,0],f0=H<.5?H*(1+$):H+$-H*$,l0=2*H-f0,g0=I/360;n0[0]=g0+1/3,n0[1]=g0,n0[2]=g0-1/3;for(var y0=0;y0<3;y0++)n0[y0]<0&&(n0[y0]+=1),n0[y0]>1&&(n0[y0]-=1),6*n0[y0]<1?b0[y0]=l0+(f0-l0)*6*n0[y0]:2*n0[y0]<1?b0[y0]=f0:3*n0[y0]<2?b0[y0]=l0+(f0-l0)*(2/3-n0[y0])*6:b0[y0]=l0;W=[x0(b0[0]*255),x0(b0[1]*255),x0(b0[2]*255)],k=W[0],Q=W[1],J=W[2]}return _.length>3?[k,Q,J,_[3]]:[k,Q,J,1]},F0=T0,K0=F0,Kt=M,D2=/^rgb\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*\)$/,Tr=/^rgba\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*,\s*([01]|[01]?\.\d+)\)$/,l2=/^rgb\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,Br=/^rgba\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,A2=/^hsl\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,Qt=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,mo=Math.round,I2=function(W){W=W.toLowerCase().trim();var _;if(Kt.format.named)try{return Kt.format.named(W)}catch{}if(_=W.match(D2)){for(var S=_.slice(1,4),I=0;I<3;I++)S[I]=+S[I];return S[3]=1,S}if(_=W.match(Tr)){for(var $=_.slice(1,5),H=0;H<4;H++)$[H]=+$[H];return $}if(_=W.match(l2)){for(var k=_.slice(1,4),Q=0;Q<3;Q++)k[Q]=mo(k[Q]*2.55);return k[3]=1,k}if(_=W.match(Br)){for(var J=_.slice(1,5),n0=0;n0<3;n0++)J[n0]=mo(J[n0]*2.55);return J[3]=+J[3],J}if(_=W.match(A2)){var b0=_.slice(1,4);b0[1]*=.01,b0[2]*=.01;var f0=K0(b0);return f0[3]=1,f0}if(_=W.match(Qt)){var l0=_.slice(1,4);l0[1]*=.01,l0[2]*=.01;var g0=K0(l0);return g0[3]=+_[4],g0}};I2.test=function(W){return D2.test(W)||Tr.test(W)||l2.test(W)||Br.test(W)||A2.test(W)||Qt.test(W)};var er=I2,go=C,P2=T,F2=M,yo=z.type,Ro=c0,Ve=er;P2.prototype.css=function(W){return Ro(this._rgb,W)},go.css=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];return new(Function.prototype.bind.apply(P2,[null].concat(W,["css"])))},F2.format.css=Ve,F2.autodetect.push({p:5,test:function(W){for(var _=[],S=arguments.length-1;S-- >0;)_[S]=arguments[S+1];if(!_.length&&yo(W)==="string"&&Ve.test(W))return"css"}});var k2=T,Sr=C,wr=M,xr=z.unpack;wr.format.gl=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];var S=xr(W,"rgba");return S[0]*=255,S[1]*=255,S[2]*=255,S},Sr.gl=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];return new(Function.prototype.bind.apply(k2,[null].concat(W,["gl"])))},k2.prototype.gl=function(){var W=this._rgb;return[W[0]/255,W[1]/255,W[2]/255,W[3]]};var wb=z.unpack,lz=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];var S=wb(W,"rgb"),I=S[0],$=S[1],H=S[2],k=Math.min(I,$,H),Q=Math.max(I,$,H),J=Q-k,n0=J*100/255,b0=k/(255-J)*100,f0;return J===0?f0=Number.NaN:(I===Q&&(f0=($-H)/J),$===Q&&(f0=2+(H-I)/J),H===Q&&(f0=4+(I-$)/J),f0*=60,f0<0&&(f0+=360)),[f0,n0,b0]},Az=lz,dz=z.unpack,uz=Math.floor,xb=function(){for(var W,_,S,I,$,H,k=[],Q=arguments.length;Q--;)k[Q]=arguments[Q];k=dz(k,"hcg");var J=k[0],n0=k[1],b0=k[2],f0,l0,g0;b0=b0*255;var y0=n0*255;if(n0===0)f0=l0=g0=b0;else{J===360&&(J=0),J>360&&(J-=360),J<0&&(J+=360),J/=60;var H0=uz(J),C0=J-H0,G0=b0*(1-n0),p1=G0+y0*(1-C0),ze=G0+y0*C0,$1=G0+y0;switch(H0){case 0:W=[$1,ze,G0],f0=W[0],l0=W[1],g0=W[2];break;case 1:_=[p1,$1,G0],f0=_[0],l0=_[1],g0=_[2];break;case 2:S=[G0,$1,ze],f0=S[0],l0=S[1],g0=S[2];break;case 3:I=[G0,p1,$1],f0=I[0],l0=I[1],g0=I[2];break;case 4:$=[ze,G0,$1],f0=$[0],l0=$[1],g0=$[2];break;case 5:H=[$1,G0,p1],f0=H[0],l0=H[1],g0=H[2];break}}return[f0,l0,g0,k.length>3?k[3]:1]},fz=xb,qz=z.unpack,Wz=z.type,Vn=C,Xb=T,Xr=M,hz=Az;Xb.prototype.hcg=function(){return hz(this._rgb)},Vn.hcg=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];return new(Function.prototype.bind.apply(Xb,[null].concat(W,["hcg"])))},Xr.format.hcg=fz,Xr.autodetect.push({p:1,test:function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];if(W=qz(W,"hcg"),Wz(W)==="array"&&W.length===3)return"hcg"}});var mz=z.unpack,gz=z.last,Cr=Math.round,yz=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];var S=mz(W,"rgba"),I=S[0],$=S[1],H=S[2],k=S[3],Q=gz(W)||"auto";k===void 0&&(k=1),Q==="auto"&&(Q=k<1?"rgba":"rgb"),I=Cr(I),$=Cr($),H=Cr(H);var J=I<<16|$<<8|H,n0="000000"+J.toString(16);n0=n0.substr(n0.length-6);var b0="0"+Cr(k*255).toString(16);switch(b0=b0.substr(b0.length-2),Q.toLowerCase()){case"rgba":return"#"+n0+b0;case"argb":return"#"+b0+n0;default:return"#"+n0}},Cb=yz,Rz=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,Lz=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,Eb=function(W){if(W.match(Rz)){(W.length===4||W.length===7)&&(W=W.substr(1)),W.length===3&&(W=W.split(""),W=W[0]+W[0]+W[1]+W[1]+W[2]+W[2]);var _=parseInt(W,16),S=_>>16,I=_>>8&255,$=_&255;return[S,I,$,1]}if(W.match(Lz)){(W.length===5||W.length===9)&&(W=W.substr(1)),W.length===4&&(W=W.split(""),W=W[0]+W[0]+W[1]+W[1]+W[2]+W[2]+W[3]+W[3]);var H=parseInt(W,16),k=H>>24&255,Q=H>>16&255,J=H>>8&255,n0=Math.round((H&255)/255*100)/100;return[k,Q,J,n0]}throw new Error("unknown hex color: "+W)},Db=Eb,vz=C,Ib=T,_z=z.type,Pb=M,Nz=Cb;Ib.prototype.hex=function(W){return Nz(this._rgb,W)},vz.hex=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];return new(Function.prototype.bind.apply(Ib,[null].concat(W,["hex"])))},Pb.format.hex=Db,Pb.autodetect.push({p:4,test:function(W){for(var _=[],S=arguments.length-1;S-- >0;)_[S]=arguments[S+1];if(!_.length&&_z(W)==="string"&&[3,4,5,6,7,8,9].indexOf(W.length)>=0)return"hex"}});var Er=z.unpack,Fb=z.TWOPI,Dr=Math.min,Tz=Math.sqrt,Bz=Math.acos,Sz=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];var S=Er(W,"rgb"),I=S[0],$=S[1],H=S[2];I/=255,$/=255,H/=255;var k,Q=Dr(I,$,H),J=(I+$+H)/3,n0=J>0?1-Q/J:0;return n0===0?k=NaN:(k=(I-$+(I-H))/2,k/=Tz((I-$)*(I-$)+(I-H)*($-H)),k=Bz(k),H>$&&(k=Fb-k),k/=Fb),[k*360,n0,J]},kb=Sz,jb=z.unpack,Ir=z.limit,Lo=z.TWOPI,Hn=z.PITHIRD,vo=Math.cos,wz=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];W=jb(W,"hsi");var S=W[0],I=W[1],$=W[2],H,k,Q;return isNaN(S)&&(S=0),isNaN(I)&&(I=0),S>360&&(S-=360),S<0&&(S+=360),S/=360,S<1/3?(Q=(1-I)/3,H=(1+I*vo(Lo*S)/vo(Hn-Lo*S))/3,k=1-(Q+H)):S<2/3?(S-=1/3,H=(1-I)/3,k=(1+I*vo(Lo*S)/vo(Hn-Lo*S))/3,Q=1-(H+k)):(S-=2/3,k=(1-I)/3,Q=(1+I*vo(Lo*S)/vo(Hn-Lo*S))/3,H=1-(k+Q)),H=Ir($*H*3),k=Ir($*k*3),Q=Ir($*Q*3),[H*255,k*255,Q*255,W.length>3?W[3]:1]},$b=wz,Ub=z.unpack,Gb=z.type,Yn=C,Vb=T,Kn=M,Pr=kb;Vb.prototype.hsi=function(){return Pr(this._rgb)},Yn.hsi=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];return new(Function.prototype.bind.apply(Vb,[null].concat(W,["hsi"])))},Kn.format.hsi=$b,Kn.autodetect.push({p:2,test:function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];if(W=Ub(W,"hsi"),Gb(W)==="array"&&W.length===3)return"hsi"}});var Hb=z.unpack,xz=z.type,Yb=C,Qn=T,Fr=M,Xz=nt;Qn.prototype.hsl=function(){return Xz(this._rgb)},Yb.hsl=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];return new(Function.prototype.bind.apply(Qn,[null].concat(W,["hsl"])))},Fr.format.hsl=F0,Fr.autodetect.push({p:2,test:function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];if(W=Hb(W,"hsl"),xz(W)==="array"&&W.length===3)return"hsl"}});var Kb=z.unpack,Zn=Math.min,Jn=Math.max,_o=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];W=Kb(W,"rgb");var S=W[0],I=W[1],$=W[2],H=Zn(S,I,$),k=Jn(S,I,$),Q=k-H,J,n0,b0;return b0=k/255,k===0?(J=Number.NaN,n0=0):(n0=Q/k,S===k&&(J=(I-$)/Q),I===k&&(J=2+($-S)/Q),$===k&&(J=4+(S-I)/Q),J*=60,J<0&&(J+=360)),[J,n0,b0]},Qb=_o,Zb=z.unpack,Cz=Math.floor,Jb=function(){for(var W,_,S,I,$,H,k=[],Q=arguments.length;Q--;)k[Q]=arguments[Q];k=Zb(k,"hsv");var J=k[0],n0=k[1],b0=k[2],f0,l0,g0;if(b0*=255,n0===0)f0=l0=g0=b0;else{J===360&&(J=0),J>360&&(J-=360),J<0&&(J+=360),J/=60;var y0=Cz(J),H0=J-y0,C0=b0*(1-n0),G0=b0*(1-n0*H0),p1=b0*(1-n0*(1-H0));switch(y0){case 0:W=[b0,p1,C0],f0=W[0],l0=W[1],g0=W[2];break;case 1:_=[G0,b0,C0],f0=_[0],l0=_[1],g0=_[2];break;case 2:S=[C0,b0,p1],f0=S[0],l0=S[1],g0=S[2];break;case 3:I=[C0,G0,b0],f0=I[0],l0=I[1],g0=I[2];break;case 4:$=[p1,C0,b0],f0=$[0],l0=$[1],g0=$[2];break;case 5:H=[b0,C0,G0],f0=H[0],l0=H[1],g0=H[2];break}}return[f0,l0,g0,k.length>3?k[3]:1]},ep=Jb,tp=z.unpack,op=z.type,Ez=C,rp=T,np=M,ip=Qb;rp.prototype.hsv=function(){return ip(this._rgb)},Ez.hsv=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];return new(Function.prototype.bind.apply(rp,[null].concat(W,["hsv"])))},np.format.hsv=ep,np.autodetect.push({p:2,test:function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];if(W=tp(W,"hsv"),op(W)==="array"&&W.length===3)return"hsv"}});var kr={Kn:18,Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452},No=kr,Dz=z.unpack,bp=Math.pow,ei=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];var S=Dz(W,"rgb"),I=S[0],$=S[1],H=S[2],k=Iz(I,$,H),Q=k[0],J=k[1],n0=k[2],b0=116*J-16;return[b0<0?0:b0,500*(Q-J),200*(J-n0)]},ti=function(W){return(W/=255)<=.04045?W/12.92:bp((W+.055)/1.055,2.4)},oi=function(W){return W>No.t3?bp(W,1/3):W/No.t2+No.t0},Iz=function(W,_,S){W=ti(W),_=ti(_),S=ti(S);var I=oi((.4124564*W+.3575761*_+.1804375*S)/No.Xn),$=oi((.2126729*W+.7151522*_+.072175*S)/No.Yn),H=oi((.0193339*W+.119192*_+.9503041*S)/No.Zn);return[I,$,H]},pp=ei,To=kr,B1=z.unpack,_1=Math.pow,Pz=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];W=B1(W,"lab");var S=W[0],I=W[1],$=W[2],H,k,Q,J,n0,b0;return k=(S+16)/116,H=isNaN(I)?k:k+I/500,Q=isNaN($)?k:k-$/200,k=To.Yn*ni(k),H=To.Xn*ni(H),Q=To.Zn*ni(Q),J=ri(3.2404542*H-1.5371385*k-.4985314*Q),n0=ri(-.969266*H+1.8760108*k+.041556*Q),b0=ri(.0556434*H-.2040259*k+1.0572252*Q),[J,n0,b0,W.length>3?W[3]:1]},ri=function(W){return 255*(W<=.00304?12.92*W:1.055*_1(W,1/2.4)-.055)},ni=function(W){return W>To.t1?W*W*W:To.t2*(W-To.t0)},ap=Pz,Fz=z.unpack,kz=z.type,Mp=C,zp=T,ae=M,ii=pp;zp.prototype.lab=function(){return ii(this._rgb)},Mp.lab=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];return new(Function.prototype.bind.apply(zp,[null].concat(W,["lab"])))},ae.format.lab=ap,ae.autodetect.push({p:2,test:function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];if(W=Fz(W,"lab"),kz(W)==="array"&&W.length===3)return"lab"}});var j2=z.unpack,cp=z.RAD2DEG,bi=Math.sqrt,it=Math.atan2,sp=Math.round,Op=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];var S=j2(W,"lab"),I=S[0],$=S[1],H=S[2],k=bi($*$+H*H),Q=(it(H,$)*cp+360)%360;return sp(k*1e4)===0&&(Q=Number.NaN),[I,k,Q]},pi=Op,lp=z.unpack,Ap=pp,dp=pi,He=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];var S=lp(W,"rgb"),I=S[0],$=S[1],H=S[2],k=Ap(I,$,H),Q=k[0],J=k[1],n0=k[2];return dp(Q,J,n0)},jz=He,bt=z.unpack,$z=z.DEG2RAD,up=Math.sin,d2=Math.cos,jr=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];var S=bt(W,"lch"),I=S[0],$=S[1],H=S[2];return isNaN(H)&&(H=0),H=H*$z,[I,d2(H)*$,up(H)*$]},$r=jr,S1=z.unpack,u2=$r,ai=ap,Uz=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];W=S1(W,"lch");var S=W[0],I=W[1],$=W[2],H=u2(S,I,$),k=H[0],Q=H[1],J=H[2],n0=ai(k,Q,J),b0=n0[0],f0=n0[1],l0=n0[2];return[b0,f0,l0,W.length>3?W[3]:1]},Ur=Uz,Gz=z.unpack,Vz=Ur,Hz=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];var S=Gz(W,"hcl").reverse();return Vz.apply(void 0,S)},fp=Hz,Gr=z.unpack,Bo=z.type,qp=C,tr=T,Vr=M,Hr=jz;tr.prototype.lch=function(){return Hr(this._rgb)},tr.prototype.hcl=function(){return Hr(this._rgb).reverse()},qp.lch=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];return new(Function.prototype.bind.apply(tr,[null].concat(W,["lch"])))},qp.hcl=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];return new(Function.prototype.bind.apply(tr,[null].concat(W,["hcl"])))},Vr.format.lch=Ur,Vr.format.hcl=fp,["lch","hcl"].forEach(function(W){return Vr.autodetect.push({p:2,test:function(){for(var _=[],S=arguments.length;S--;)_[S]=arguments[S];if(_=Gr(_,W),Bo(_)==="array"&&_.length===3)return W}})});var Mi={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflower:"#6495ed",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",laserlemon:"#ffff54",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrod:"#fafad2",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",maroon2:"#7f0000",maroon3:"#b03060",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",purple2:"#7f007f",purple3:"#a020f0",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},zi=Mi,Yz=T,Yr=M,ci=z.type,or=zi,Wp=Db,Ye=Cb;Yz.prototype.name=function(){for(var W=Ye(this._rgb,"rgb"),_=0,S=Object.keys(or);_<S.length;_+=1){var I=S[_];if(or[I]===W)return I.toLowerCase()}return W},Yr.format.named=function(W){if(W=W.toLowerCase(),or[W])return Wp(or[W]);throw new Error("unknown color name: "+W)},Yr.autodetect.push({p:5,test:function(W){for(var _=[],S=arguments.length-1;S-- >0;)_[S]=arguments[S+1];if(!_.length&&ci(W)==="string"&&or[W.toLowerCase()])return"named"}});var si=z.unpack,rr=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];var S=si(W,"rgb"),I=S[0],$=S[1],H=S[2];return(I<<16)+($<<8)+H},hp=rr,mp=z.type,Kz=function(W){if(mp(W)=="number"&&W>=0&&W<=16777215){var _=W>>16,S=W>>8&255,I=W&255;return[_,S,I,1]}throw new Error("unknown num color: "+W)},Qz=Kz,Zz=C,gp=T,yp=M,So=z.type,Jz=hp;gp.prototype.num=function(){return Jz(this._rgb)},Zz.num=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];return new(Function.prototype.bind.apply(gp,[null].concat(W,["num"])))},yp.format.num=Qz,yp.autodetect.push({p:5,test:function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];if(W.length===1&&So(W[0])==="number"&&W[0]>=0&&W[0]<=16777215)return"num"}});var ec=C,nr=T,Oi=M,Zt=z.unpack,ir=z.type,Rp=Math.round;nr.prototype.rgb=function(W){return W===void 0&&(W=!0),W===!1?this._rgb.slice(0,3):this._rgb.slice(0,3).map(Rp)},nr.prototype.rgba=function(W){return W===void 0&&(W=!0),this._rgb.slice(0,4).map(function(_,S){return S<3?W===!1?_:Rp(_):_})},ec.rgb=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];return new(Function.prototype.bind.apply(nr,[null].concat(W,["rgb"])))},Oi.format.rgb=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];var S=Zt(W,"rgba");return S[3]===void 0&&(S[3]=1),S},Oi.autodetect.push({p:3,test:function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];if(W=Zt(W,"rgba"),ir(W)==="array"&&(W.length===3||W.length===4&&ir(W[3])=="number"&&W[3]>=0&&W[3]<=1))return"rgb"}});var Kr=Math.log,tc=function(W){var _=W/100,S,I,$;return _<66?(S=255,I=_<6?0:-155.25485562709179-.44596950469579133*(I=_-2)+104.49216199393888*Kr(I),$=_<20?0:-254.76935184120902+.8274096064007395*($=_-10)+115.67994401066147*Kr($)):(S=351.97690566805693+.114206453784165*(S=_-55)-40.25366309332127*Kr(S),I=325.4494125711974+.07943456536662342*(I=_-50)-28.0852963507957*Kr(I),$=255),[S,I,$,1]},$2=tc,ht=$2,Lp=z.unpack,oc=Math.round,rc=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];for(var S=Lp(W,"rgb"),I=S[0],$=S[2],H=1e3,k=4e4,Q=.4,J;k-H>Q;){J=(k+H)*.5;var n0=ht(J);n0[2]/n0[0]>=$/I?k=J:H=J}return oc(J)},nc=rc,li=C,Qr=T,f2=M,Y=nc;Qr.prototype.temp=Qr.prototype.kelvin=Qr.prototype.temperature=function(){return Y(this._rgb)},li.temp=li.kelvin=li.temperature=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];return new(Function.prototype.bind.apply(Qr,[null].concat(W,["temp"])))},f2.format.temp=f2.format.kelvin=f2.format.temperature=$2;var r0=z.unpack,o0=Math.cbrt,m0=Math.pow,U0=Math.sign,s1=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];var S=r0(W,"rgb"),I=S[0],$=S[1],H=S[2],k=[u1(I/255),u1($/255),u1(H/255)],Q=k[0],J=k[1],n0=k[2],b0=o0(.4122214708*Q+.5363325363*J+.0514459929*n0),f0=o0(.2119034982*Q+.6806995451*J+.1073969566*n0),l0=o0(.0883024619*Q+.2817188376*J+.6299787005*n0);return[.2104542553*b0+.793617785*f0-.0040720468*l0,1.9779984951*b0-2.428592205*f0+.4505937099*l0,.0259040371*b0+.7827717662*f0-.808675766*l0]},Q1=s1;function u1(W){var _=Math.abs(W);return _<.04045?W/12.92:(U0(W)||1)*m0((_+.055)/1.055,2.4)}var Ai=z.unpack,Zr=Math.pow,pt=Math.sign,Jr=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];W=Ai(W,"lab");var S=W[0],I=W[1],$=W[2],H=Zr(S+.3963377774*I+.2158037573*$,3),k=Zr(S-.1055613458*I-.0638541728*$,3),Q=Zr(S-.0894841775*I-1.291485548*$,3);return[255*q2(4.0767416621*H-3.3077115913*k+.2309699292*Q),255*q2(-1.2684380046*H+2.6097574011*k-.3413193965*Q),255*q2(-.0041960863*H-.7034186147*k+1.707614701*Q),W.length>3?W[3]:1]},vp=Jr;function q2(W){var _=Math.abs(W);return _>.0031308?(pt(W)||1)*(1.055*Zr(_,1/2.4)-.055):W*12.92}var en=z.unpack,tn=z.type,f1=C,_p=T,di=M,on=Q1;_p.prototype.oklab=function(){return on(this._rgb)},f1.oklab=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];return new(Function.prototype.bind.apply(_p,[null].concat(W,["oklab"])))},di.format.oklab=vp,di.autodetect.push({p:3,test:function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];if(W=en(W,"oklab"),tn(W)==="array"&&W.length===3)return"oklab"}});var ic=z.unpack,bc=Q1,pc=pi,rn=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];var S=ic(W,"rgb"),I=S[0],$=S[1],H=S[2],k=bc(I,$,H),Q=k[0],J=k[1],n0=k[2];return pc(Q,J,n0)},W2=rn,nn=z.unpack,Np=$r,bn=vp,Tp=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];W=nn(W,"lch");var S=W[0],I=W[1],$=W[2],H=Np(S,I,$),k=H[0],Q=H[1],J=H[2],n0=bn(k,Q,J),b0=n0[0],f0=n0[1],l0=n0[2];return[b0,f0,l0,W.length>3?W[3]:1]},Bp=Tp,pn=z.unpack,Sp=z.type,br=C,h2=T,pr=M,ac=W2;h2.prototype.oklch=function(){return ac(this._rgb)},br.oklch=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];return new(Function.prototype.bind.apply(h2,[null].concat(W,["oklch"])))},pr.format.oklch=Bp,pr.autodetect.push({p:3,test:function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];if(W=pn(W,"oklch"),Sp(W)==="array"&&W.length===3)return"oklch"}});var wp=T,Mc=z.type;wp.prototype.alpha=function(W,_){return _===void 0&&(_=!1),W!==void 0&&Mc(W)==="number"?_?(this._rgb[3]=W,this):new wp([this._rgb[0],this._rgb[1],this._rgb[2],W],"rgb"):this._rgb[3]};var an=T;an.prototype.clipped=function(){return this._rgb._clipped||!1};var Xt=T,ui=kr;Xt.prototype.darken=function(W){W===void 0&&(W=1);var _=this,S=_.lab();return S[0]-=ui.Kn*W,new Xt(S,"lab").alpha(_.alpha(),!0)},Xt.prototype.brighten=function(W){return W===void 0&&(W=1),this.darken(-W)},Xt.prototype.darker=Xt.prototype.darken,Xt.prototype.brighter=Xt.prototype.brighten;var zc=T;zc.prototype.get=function(W){var _=W.split("."),S=_[0],I=_[1],$=this[S]();if(I){var H=S.indexOf(I)-(S.substr(0,2)==="ok"?2:0);if(H>-1)return $[H];throw new Error("unknown channel "+I+" in mode "+S)}else return $};var U2=T,cc=z.type,sc=Math.pow,oe=1e-7,ge=20;U2.prototype.luminance=function(W){if(W!==void 0&&cc(W)==="number"){if(W===0)return new U2([0,0,0,this._rgb[3]],"rgb");if(W===1)return new U2([255,255,255,this._rgb[3]],"rgb");var _=this.luminance(),S="rgb",I=ge,$=function(k,Q){var J=k.interpolate(Q,.5,S),n0=J.luminance();return Math.abs(W-n0)<oe||!I--?J:n0>W?$(k,J):$(J,Q)},H=(_>W?$(new U2([0,0,0]),this):$(this,new U2([255,255,255]))).rgb();return new U2(H.concat([this._rgb[3]]))}return Oc.apply(void 0,this._rgb.slice(0,3))};var Oc=function(W,_,S){return W=fi(W),_=fi(_),S=fi(S),.2126*W+.7152*_+.0722*S},fi=function(W){return W/=255,W<=.03928?W/12.92:sc((W+.055)/1.055,2.4)},Pe={},xp=T,Mn=z.type,m2=Pe,zn=function(W,_,S){S===void 0&&(S=.5);for(var I=[],$=arguments.length-3;$-- >0;)I[$]=arguments[$+3];var H=I[0]||"lrgb";if(!m2[H]&&!I.length&&(H=Object.keys(m2)[0]),!m2[H])throw new Error("interpolation mode "+H+" is not defined");return Mn(W)!=="object"&&(W=new xp(W)),Mn(_)!=="object"&&(_=new xp(_)),m2[H](W,_,S).alpha(W.alpha()+S*(_.alpha()-W.alpha()))},G2=T,ar=zn;G2.prototype.mix=G2.prototype.interpolate=function(W,_){_===void 0&&(_=.5);for(var S=[],I=arguments.length-2;I-- >0;)S[I]=arguments[I+2];return ar.apply(void 0,[this,W,_].concat(S))};var wo=T;wo.prototype.premultiply=function(W){W===void 0&&(W=!1);var _=this._rgb,S=_[3];return W?(this._rgb=[_[0]*S,_[1]*S,_[2]*S,S],this):new wo([_[0]*S,_[1]*S,_[2]*S,S],"rgb")};var xo=T,Xo=kr;xo.prototype.saturate=function(W){W===void 0&&(W=1);var _=this,S=_.lch();return S[1]+=Xo.Kn*W,S[1]<0&&(S[1]=0),new xo(S,"lch").alpha(_.alpha(),!0)},xo.prototype.desaturate=function(W){return W===void 0&&(W=1),this.saturate(-W)};var Xp=T,Cp=z.type;Xp.prototype.set=function(W,_,S){S===void 0&&(S=!1);var I=W.split("."),$=I[0],H=I[1],k=this[$]();if(H){var Q=$.indexOf(H)-($.substr(0,2)==="ok"?2:0);if(Q>-1){if(Cp(_)=="string")switch(_.charAt(0)){case"+":k[Q]+=+_;break;case"-":k[Q]+=+_;break;case"*":k[Q]*=+_.substr(1);break;case"/":k[Q]/=+_.substr(1);break;default:k[Q]=+_}else if(Cp(_)==="number")k[Q]=_;else throw new Error("unsupported value for Color.set");var J=new Xp(k,$);return S?(this._rgb=J._rgb,this):J}throw new Error("unknown channel "+H+" in mode "+$)}else return k};var lc=T,Ac=function(W,_,S){var I=W._rgb,$=_._rgb;return new lc(I[0]+S*($[0]-I[0]),I[1]+S*($[1]-I[1]),I[2]+S*($[2]-I[2]),"rgb")};Pe.rgb=Ac;var dc=T,Co=Math.sqrt,Ct=Math.pow,Ep=function(W,_,S){var I=W._rgb,$=I[0],H=I[1],k=I[2],Q=_._rgb,J=Q[0],n0=Q[1],b0=Q[2];return new dc(Co(Ct($,2)*(1-S)+Ct(J,2)*S),Co(Ct(H,2)*(1-S)+Ct(n0,2)*S),Co(Ct(k,2)*(1-S)+Ct(b0,2)*S),"rgb")};Pe.lrgb=Ep;var x=T,Eo=function(W,_,S){var I=W.lab(),$=_.lab();return new x(I[0]+S*($[0]-I[0]),I[1]+S*($[1]-I[1]),I[2]+S*($[2]-I[2]),"lab")};Pe.lab=Eo;var Mr=T,Ae=function(W,_,S,I){var $,H,k,Q;I==="hsl"?(k=W.hsl(),Q=_.hsl()):I==="hsv"?(k=W.hsv(),Q=_.hsv()):I==="hcg"?(k=W.hcg(),Q=_.hcg()):I==="hsi"?(k=W.hsi(),Q=_.hsi()):I==="lch"||I==="hcl"?(I="hcl",k=W.hcl(),Q=_.hcl()):I==="oklch"&&(k=W.oklch().reverse(),Q=_.oklch().reverse());var J,n0,b0,f0,l0,g0;(I.substr(0,1)==="h"||I==="oklch")&&($=k,J=$[0],b0=$[1],l0=$[2],H=Q,n0=H[0],f0=H[1],g0=H[2]);var y0,H0,C0,G0;return!isNaN(J)&&!isNaN(n0)?(n0>J&&n0-J>180?G0=n0-(J+360):n0<J&&J-n0>180?G0=n0+360-J:G0=n0-J,H0=J+S*G0):isNaN(J)?isNaN(n0)?H0=Number.NaN:(H0=n0,(l0==1||l0==0)&&I!="hsv"&&(y0=f0)):(H0=J,(g0==1||g0==0)&&I!="hsv"&&(y0=b0)),y0===void 0&&(y0=b0+S*(f0-b0)),C0=l0+S*(g0-l0),I==="oklch"?new Mr([C0,y0,H0],I):new Mr([H0,y0,C0],I)},r1=Ae,Dp=function(W,_,S){return r1(W,_,S,"lch")};Pe.lch=Dp,Pe.hcl=Dp;var uc=T,fc=function(W,_,S){var I=W.num(),$=_.num();return new uc(I+S*($-I),"num")};Pe.num=fc;var V2=Ae,qc=function(W,_,S){return V2(W,_,S,"hcg")};Pe.hcg=qc;var Wc=Ae,hc=function(W,_,S){return Wc(W,_,S,"hsi")};Pe.hsi=hc;var mc=Ae,gc=function(W,_,S){return mc(W,_,S,"hsl")};Pe.hsl=gc;var Jt=Ae,yc=function(W,_,S){return Jt(W,_,S,"hsv")};Pe.hsv=yc;var Rc=T,Lc=function(W,_,S){var I=W.oklab(),$=_.oklab();return new Rc(I[0]+S*($[0]-I[0]),I[1]+S*($[1]-I[1]),I[2]+S*($[2]-I[2]),"oklab")};Pe.oklab=Lc;var vc=Ae,_c=function(W,_,S){return vc(W,_,S,"oklch")};Pe.oklch=_c;var mt=T,Nc=z.clip_rgb,qi=Math.pow,Wi=Math.sqrt,hi=Math.PI,Ip=Math.cos,g2=Math.sin,Tc=Math.atan2,Bc=function(W,_,S){_===void 0&&(_="lrgb"),S===void 0&&(S=null);var I=W.length;S||(S=Array.from(new Array(I)).map(function(){return 1}));var $=I/S.reduce(function(H0,C0){return H0+C0});if(S.forEach(function(H0,C0){S[C0]*=$}),W=W.map(function(H0){return new mt(H0)}),_==="lrgb")return gt(W,S);for(var H=W.shift(),k=H.get(_),Q=[],J=0,n0=0,b0=0;b0<k.length;b0++)if(k[b0]=(k[b0]||0)*S[0],Q.push(isNaN(k[b0])?0:S[0]),_.charAt(b0)==="h"&&!isNaN(k[b0])){var f0=k[b0]/180*hi;J+=Ip(f0)*S[0],n0+=g2(f0)*S[0]}var l0=H.alpha()*S[0];W.forEach(function(H0,C0){var G0=H0.get(_);l0+=H0.alpha()*S[C0+1];for(var p1=0;p1<k.length;p1++)if(!isNaN(G0[p1]))if(Q[p1]+=S[C0+1],_.charAt(p1)==="h"){var ze=G0[p1]/180*hi;J+=Ip(ze)*S[C0+1],n0+=g2(ze)*S[C0+1]}else k[p1]+=G0[p1]*S[C0+1]});for(var g0=0;g0<k.length;g0++)if(_.charAt(g0)==="h"){for(var y0=Tc(n0/Q[g0],J/Q[g0])/hi*180;y0<0;)y0+=360;for(;y0>=360;)y0-=360;k[g0]=y0}else k[g0]=k[g0]/Q[g0];return l0/=I,new mt(k,_).alpha(l0>.99999?1:l0,!0)},gt=function(W,_){for(var S=W.length,I=[0,0,0,0],$=0;$<W.length;$++){var H=W[$],k=_[$]/S,Q=H._rgb;I[0]+=qi(Q[0],2)*k,I[1]+=qi(Q[1],2)*k,I[2]+=qi(Q[2],2)*k,I[3]+=Q[3]*k}return I[0]=Wi(I[0]),I[1]=Wi(I[1]),I[2]=Wi(I[2]),I[3]>.9999999&&(I[3]=1),new mt(Nc(I))},yt=C,Do=z.type,Sc=Math.pow,mi=function(W){var _="rgb",S=yt("#ccc"),I=0,$=[0,1],H=[],k=[0,0],Q=!1,J=[],n0=!1,b0=0,f0=1,l0=!1,g0={},y0=!0,H0=1,C0=function(A0){if(A0=A0||["#fff","#000"],A0&&Do(A0)==="string"&&yt.brewer&&yt.brewer[A0.toLowerCase()]&&(A0=yt.brewer[A0.toLowerCase()]),Do(A0)==="array"){A0.length===1&&(A0=[A0[0],A0[0]]),A0=A0.slice(0);for(var S0=0;S0<A0.length;S0++)A0[S0]=yt(A0[S0]);H.length=0;for(var Y0=0;Y0<A0.length;Y0++)H.push(Y0/(A0.length-1))}return xe(),J=A0},G0=function(A0){if(Q!=null){for(var S0=Q.length-1,Y0=0;Y0<S0&&A0>=Q[Y0];)Y0++;return Y0-1}return 0},p1=function(A0){return A0},ze=function(A0){return A0},$1=function(A0,S0){var Y0,j0;if(S0==null&&(S0=!1),isNaN(A0)||A0===null)return S;if(S0)j0=A0;else if(Q&&Q.length>2){var de=G0(A0);j0=de/(Q.length-2)}else f0!==b0?j0=(A0-b0)/(f0-b0):j0=1;j0=ze(j0),S0||(j0=p1(j0)),H0!==1&&(j0=Sc(j0,H0)),j0=k[0]+j0*(1-k[0]-k[1]),j0=Math.min(1,Math.max(0,j0));var a1=Math.floor(j0*1e4);if(y0&&g0[a1])Y0=g0[a1];else{if(Do(J)==="array")for(var n1=0;n1<H.length;n1++){var O1=H[n1];if(j0<=O1){Y0=J[n1];break}if(j0>=O1&&n1===H.length-1){Y0=J[n1];break}if(j0>O1&&j0<H[n1+1]){j0=(j0-O1)/(H[n1+1]-O1),Y0=yt.interpolate(J[n1],J[n1+1],j0,_);break}}else Do(J)==="function"&&(Y0=J(j0));y0&&(g0[a1]=Y0)}return Y0},xe=function(){return g0={}};C0(W);var o1=function(A0){var S0=yt($1(A0));return n0&&S0[n0]?S0[n0]():S0};return o1.classes=function(A0){if(A0!=null){if(Do(A0)==="array")Q=A0,$=[A0[0],A0[A0.length-1]];else{var S0=yt.analyze($);A0===0?Q=[S0.min,S0.max]:Q=yt.limits(S0,"e",A0)}return o1}return Q},o1.domain=function(A0){if(!arguments.length)return $;b0=A0[0],f0=A0[A0.length-1],H=[];var S0=J.length;if(A0.length===S0&&b0!==f0)for(var Y0=0,j0=Array.from(A0);Y0<j0.length;Y0+=1){var de=j0[Y0];H.push((de-b0)/(f0-b0))}else{for(var a1=0;a1<S0;a1++)H.push(a1/(S0-1));if(A0.length>2){var n1=A0.map(function(z1,q1){return q1/(A0.length-1)}),O1=A0.map(function(z1){return(z1-b0)/(f0-b0)});O1.every(function(z1,q1){return n1[q1]===z1})||(ze=function(z1){if(z1<=0||z1>=1)return z1;for(var q1=0;z1>=O1[q1+1];)q1++;var Rt=(z1-O1[q1])/(O1[q1+1]-O1[q1]),R2=n1[q1]+Rt*(n1[q1+1]-n1[q1]);return R2})}}return $=[b0,f0],o1},o1.mode=function(A0){return arguments.length?(_=A0,xe(),o1):_},o1.range=function(A0,S0){return C0(A0),o1},o1.out=function(A0){return n0=A0,o1},o1.spread=function(A0){return arguments.length?(I=A0,o1):I},o1.correctLightness=function(A0){return A0==null&&(A0=!0),l0=A0,xe(),l0?p1=function(S0){for(var Y0=$1(0,!0).lab()[0],j0=$1(1,!0).lab()[0],de=Y0>j0,a1=$1(S0,!0).lab()[0],n1=Y0+(j0-Y0)*S0,O1=a1-n1,z1=0,q1=1,Rt=20;Math.abs(O1)>.01&&Rt-- >0;)(function(){return de&&(O1*=-1),O1<0?(z1=S0,S0+=(q1-S0)*.5):(q1=S0,S0+=(z1-S0)*.5),a1=$1(S0,!0).lab()[0],O1=a1-n1})();return S0}:p1=function(S0){return S0},o1},o1.padding=function(A0){return A0!=null?(Do(A0)==="number"&&(A0=[A0,A0]),k=A0,o1):k},o1.colors=function(A0,S0){arguments.length<2&&(S0="hex");var Y0=[];if(arguments.length===0)Y0=J.slice(0);else if(A0===1)Y0=[o1(.5)];else if(A0>1){var j0=$[0],de=$[1]-j0;Y0=wc(0,A0).map(function(q1){return o1(j0+q1/(A0-1)*de)})}else{W=[];var a1=[];if(Q&&Q.length>2)for(var n1=1,O1=Q.length,z1=1<=O1;z1?n1<O1:n1>O1;z1?n1++:n1--)a1.push((Q[n1-1]+Q[n1])*.5);else a1=$;Y0=a1.map(function(q1){return o1(q1)})}return yt[S0]&&(Y0=Y0.map(function(q1){return q1[S0]()})),Y0},o1.cache=function(A0){return A0!=null?(y0=A0,o1):y0},o1.gamma=function(A0){return A0!=null?(H0=A0,o1):H0},o1.nodata=function(A0){return A0!=null?(S=yt(A0),o1):S},o1};function wc(W,_,S){for(var I=[],$=W<_,H=_,k=W;$?k<H:k>H;$?k++:k--)I.push(k);return I}var Io=T,Pp=mi,xc=function(W){for(var _=[1,1],S=1;S<W;S++){for(var I=[1],$=1;$<=_.length;$++)I[$]=(_[$]||0)+_[$-1];_=I}return _},Xc=function(W){var _,S,I,$,H,k,Q;if(W=W.map(function(l0){return new Io(l0)}),W.length===2)_=W.map(function(l0){return l0.lab()}),H=_[0],k=_[1],$=function(l0){var g0=[0,1,2].map(function(y0){return H[y0]+l0*(k[y0]-H[y0])});return new Io(g0,"lab")};else if(W.length===3)S=W.map(function(l0){return l0.lab()}),H=S[0],k=S[1],Q=S[2],$=function(l0){var g0=[0,1,2].map(function(y0){return(1-l0)*(1-l0)*H[y0]+2*(1-l0)*l0*k[y0]+l0*l0*Q[y0]});return new Io(g0,"lab")};else if(W.length===4){var J;I=W.map(function(l0){return l0.lab()}),H=I[0],k=I[1],Q=I[2],J=I[3],$=function(l0){var g0=[0,1,2].map(function(y0){return(1-l0)*(1-l0)*(1-l0)*H[y0]+3*(1-l0)*(1-l0)*l0*k[y0]+3*(1-l0)*l0*l0*Q[y0]+l0*l0*l0*J[y0]});return new Io(g0,"lab")}}else if(W.length>=5){var n0,b0,f0;n0=W.map(function(l0){return l0.lab()}),f0=W.length-1,b0=xc(f0),$=function(l0){var g0=1-l0,y0=[0,1,2].map(function(H0){return n0.reduce(function(C0,G0,p1){return C0+b0[p1]*Math.pow(g0,f0-p1)*Math.pow(l0,p1)*G0[H0]},0)});return new Io(y0,"lab")}}else throw new RangeError("No point in running bezier with only one color.");return $},gi=function(W){var _=Xc(W);return _.scale=function(){return Pp(_)},_},H2=C,Fe=function(W,_,S){if(!Fe[S])throw new Error("unknown blend mode "+S);return Fe[S](W,_)},y2=function(W){return function(_,S){var I=H2(S).rgb(),$=H2(_).rgb();return H2.rgb(W(I,$))}},e2=function(W){return function(_,S){var I=[];return I[0]=W(_[0],S[0]),I[1]=W(_[1],S[1]),I[2]=W(_[2],S[2]),I}},Cc=function(W){return W},t2=function(W,_){return W*_/255},yi=function(W,_){return W>_?_:W},Y2=function(W,_){return W>_?W:_},at=function(W,_){return 255*(1-(1-W/255)*(1-_/255))},Ec=function(W,_){return _<128?2*W*_/255:255*(1-2*(1-W/255)*(1-_/255))},Fp=function(W,_){return 255*(1-(1-_/255)/(W/255))},kp=function(W,_){return W===255?255:(W=255*(_/255)/(1-W/255),W>255?255:W)};Fe.normal=y2(e2(Cc)),Fe.multiply=y2(e2(t2)),Fe.screen=y2(e2(at)),Fe.overlay=y2(e2(Ec)),Fe.darken=y2(e2(yi)),Fe.lighten=y2(e2(Y2)),Fe.dodge=y2(e2(kp)),Fe.burn=y2(e2(Fp));for(var zr=Fe,Et=z.type,jp=z.clip_rgb,Dc=z.TWOPI,cn=Math.pow,Ic=Math.sin,$p=Math.cos,Me=C,Ri=function(W,_,S,I,$){W===void 0&&(W=300),_===void 0&&(_=-1.5),S===void 0&&(S=1),I===void 0&&(I=1),$===void 0&&($=[0,1]);var H=0,k;Et($)==="array"?k=$[1]-$[0]:(k=0,$=[$,$]);var Q=function(J){var n0=Dc*((W+120)/360+_*J),b0=cn($[0]+k*J,I),f0=H!==0?S[0]+J*H:S,l0=f0*b0*(1-b0)/2,g0=$p(n0),y0=Ic(n0),H0=b0+l0*(-.14861*g0+1.78277*y0),C0=b0+l0*(-.29227*g0-.90649*y0),G0=b0+l0*(1.97294*g0);return Me(jp([H0*255,C0*255,G0*255,1]))};return Q.start=function(J){return J==null?W:(W=J,Q)},Q.rotations=function(J){return J==null?_:(_=J,Q)},Q.gamma=function(J){return J==null?I:(I=J,Q)},Q.hue=function(J){return J==null?S:(S=J,Et(S)==="array"?(H=S[1]-S[0],H===0&&(S=S[1])):H=0,Q)},Q.lightness=function(J){return J==null?$:(Et(J)==="array"?($=J,k=J[1]-J[0]):($=[J,J],k=0),Q)},Q.scale=function(){return Me.scale(Q)},Q.hue(S),Q},Up=T,Dt="0123456789abcdef",Li=Math.floor,sn=Math.random,K2=function(){for(var W="#",_=0;_<6;_++)W+=Dt.charAt(Li(sn()*16));return new Up(W,"hex")},On=y,ye=Math.log,vi=Math.pow,Pc=Math.floor,Fc=Math.abs,Gp=function(W,_){_===void 0&&(_=null);var S={min:Number.MAX_VALUE,max:Number.MAX_VALUE*-1,sum:0,values:[],count:0};return On(W)==="object"&&(W=Object.values(W)),W.forEach(function(I){_&&On(I)==="object"&&(I=I[_]),I!=null&&!isNaN(I)&&(S.values.push(I),S.sum+=I,I<S.min&&(S.min=I),I>S.max&&(S.max=I),S.count+=1)}),S.domain=[S.min,S.max],S.limits=function(I,$){return ln(S,I,$)},S},ln=function(W,_,S){_===void 0&&(_="equal"),S===void 0&&(S=7),On(W)=="array"&&(W=Gp(W));var I=W.min,$=W.max,H=W.values.sort(function(xi,Xi){return xi-Xi});if(S===1)return[I,$];var k=[];if(_.substr(0,1)==="c"&&(k.push(I),k.push($)),_.substr(0,1)==="e"){k.push(I);for(var Q=1;Q<S;Q++)k.push(I+Q/S*($-I));k.push($)}else if(_.substr(0,1)==="l"){if(I<=0)throw new Error("Logarithmic scales are only possible for values > 0");var J=Math.LOG10E*ye(I),n0=Math.LOG10E*ye($);k.push(I);for(var b0=1;b0<S;b0++)k.push(vi(10,J+b0/S*(n0-J)));k.push($)}else if(_.substr(0,1)==="q"){k.push(I);for(var f0=1;f0<S;f0++){var l0=(H.length-1)*f0/S,g0=Pc(l0);if(g0===l0)k.push(H[g0]);else{var y0=l0-g0;k.push(H[g0]*(1-y0)+H[g0+1]*y0)}}k.push($)}else if(_.substr(0,1)==="k"){var H0,C0=H.length,G0=new Array(C0),p1=new Array(S),ze=!0,$1=0,xe=null;xe=[],xe.push(I);for(var o1=1;o1<S;o1++)xe.push(I+o1/S*($-I));for(xe.push($);ze;){for(var A0=0;A0<S;A0++)p1[A0]=0;for(var S0=0;S0<C0;S0++)for(var Y0=H[S0],j0=Number.MAX_VALUE,de=void 0,a1=0;a1<S;a1++){var n1=Fc(xe[a1]-Y0);n1<j0&&(j0=n1,de=a1),p1[de]++,G0[S0]=de}for(var O1=new Array(S),z1=0;z1<S;z1++)O1[z1]=null;for(var q1=0;q1<C0;q1++)H0=G0[q1],O1[H0]===null?O1[H0]=H[q1]:O1[H0]+=H[q1];for(var Rt=0;Rt<S;Rt++)O1[Rt]*=1/p1[Rt];ze=!1;for(var R2=0;R2<S;R2++)if(O1[R2]!==xe[R2]){ze=!0;break}xe=O1,$1++,$1>200&&(ze=!1)}for(var r2={},Q2=0;Q2<S;Q2++)r2[Q2]=[];for(var Fo=0;Fo<C0;Fo++)H0=G0[Fo],r2[H0].push(H[Fo]);for(var It=[],L2=0;L2<S;L2++)It.push(r2[L2][0]),It.push(r2[L2][r2[L2].length-1]);It=It.sort(function(xi,Xi){return xi-Xi}),k.push(It[0]);for(var ce=1;ce<It.length;ce+=2){var Re=It[ce];!isNaN(Re)&&k.indexOf(Re)===-1&&k.push(Re)}}return k},Vp={analyze:Gp,limits:ln},Po=T,Hp=function(W,_){W=new Po(W),_=new Po(_);var S=W.luminance(),I=_.luminance();return S>I?(S+.05)/(I+.05):(I+.05)/(S+.05)},Yp=T,o2=Math.sqrt,w1=Math.pow,kc=Math.min,jc=Math.max,An=Math.atan2,_i=Math.abs,dn=Math.cos,Kp=Math.sin,$c=Math.exp,Ni=Math.PI,Ti=function(W,_,S,I,$){S===void 0&&(S=1),I===void 0&&(I=1),$===void 0&&($=1);var H=function(Re){return 360*Re/(2*Ni)},k=function(Re){return 2*Ni*Re/360};W=new Yp(W),_=new Yp(_);var Q=Array.from(W.lab()),J=Q[0],n0=Q[1],b0=Q[2],f0=Array.from(_.lab()),l0=f0[0],g0=f0[1],y0=f0[2],H0=(J+l0)/2,C0=o2(w1(n0,2)+w1(b0,2)),G0=o2(w1(g0,2)+w1(y0,2)),p1=(C0+G0)/2,ze=.5*(1-o2(w1(p1,7)/(w1(p1,7)+w1(25,7)))),$1=n0*(1+ze),xe=g0*(1+ze),o1=o2(w1($1,2)+w1(b0,2)),A0=o2(w1(xe,2)+w1(y0,2)),S0=(o1+A0)/2,Y0=H(An(b0,$1)),j0=H(An(y0,xe)),de=Y0>=0?Y0:Y0+360,a1=j0>=0?j0:j0+360,n1=_i(de-a1)>180?(de+a1+360)/2:(de+a1)/2,O1=1-.17*dn(k(n1-30))+.24*dn(k(2*n1))+.32*dn(k(3*n1+6))-.2*dn(k(4*n1-63)),z1=a1-de;z1=_i(z1)<=180?z1:a1<=de?z1+360:z1-360,z1=2*o2(o1*A0)*Kp(k(z1)/2);var q1=l0-J,Rt=A0-o1,R2=1+.015*w1(H0-50,2)/o2(20+w1(H0-50,2)),r2=1+.045*S0,Q2=1+.015*S0*O1,Fo=30*$c(-w1((n1-275)/25,2)),It=2*o2(w1(S0,7)/(w1(S0,7)+w1(25,7))),L2=-It*Kp(2*k(Fo)),ce=o2(w1(q1/(S*R2),2)+w1(Rt/(I*r2),2)+w1(z1/($*Q2),2)+L2*(Rt/(I*r2))*(z1/($*Q2)));return jc(0,kc(100,ce))},Qp=T,Bi=function(W,_,S){S===void 0&&(S="lab"),W=new Qp(W),_=new Qp(_);var I=W.get(S),$=_.get(S),H=0;for(var k in I){var Q=(I[k]||0)-($[k]||0);H+=Q*Q}return Math.sqrt(H)},Zp=T,Jp=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];try{return new(Function.prototype.bind.apply(Zp,[null].concat(W))),!0}catch{return!1}},Si=C,cr=mi,Uc={cool:function(){return cr([Si.hsl(180,1,.9),Si.hsl(250,.7,.4)])},hot:function(){return cr(["#000","#f00","#ff0","#fff"]).mode("rgb")}},sr={OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],Viridis:["#440154","#482777","#3f4a8a","#31678e","#26838f","#1f9d8a","#6cce5a","#b6de2b","#fee825"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],Set2:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],Accent:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],Set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],Set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],Dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Paired:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],Pastel2:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],Pastel1:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},un=0,ea=Object.keys(sr);un<ea.length;un+=1){var wi=ea[un];sr[wi.toLowerCase()]=sr[wi]}var Gc=sr,Z1=C;Z1.average=Bc,Z1.bezier=gi,Z1.blend=zr,Z1.cubehelix=Ri,Z1.mix=Z1.interpolate=zn,Z1.random=K2,Z1.scale=mi,Z1.analyze=Vp.analyze,Z1.contrast=Hp,Z1.deltaE=Ti,Z1.distance=Bi,Z1.limits=Vp.limits,Z1.valid=Jp,Z1.scales=Uc,Z1.colors=zi,Z1.brewer=Gc;var ta=Z1;return ta})})(kN);const Qo=350,jN=52,$N={colors:["#feae4a","#5fbaff","#e15e9d"],detail:"minimal",fontFamily:"Inter, sans-serif",rowLimit:6,fontSize:"0.65rem"},UN=t=>({displayTitle:t,colSpan:12}),UO=t=>"displayTitle"in t,Wr=t=>({colSpan:t,isEmpty:!0}),GN=12,VN=(t,e)=>({components:t,height:e}),Uu=t=>"isEmpty"in t,HN=t=>{const e=[...t],o=P0.sumBy(e,n=>n.colSpan);return o==12||(e[e.length-1].colSpan+=12-o),e},YN=t=>"components"in t?t:{components:t,height:Qo},KN=t=>!(t&&Uu(t)&&t.colSpan<=0),QN=(t,e)=>{const o=YN(t),n=v=>v&&v.colSpan<=0?{...v,colSpan:1}:v,b=o.components.filter(KN).map(n),a=P0.sumBy(b,v=>v==null?1:0),A=12-P0.sumBy(b,v=>v==null?0:v.colSpan),c=Math.floor(A/a),y=[...b].map(v=>v===null?{isEmpty:!0,colSpan:c}:Uu(v)||UO(v)?v:Gu({...v,colSpan:v.colSpan},e));return{components:HN(y),height:o.height||Qo}},ZN=(t,e)=>t.map(o=>QN(o,e)),Gu=(t,e)=>{if("isEmpty"in t||UO(t))return t;const{load:o}=ib(t.attributes.type,e),n=o(t.attributes);let b=[];return P0.isArray(t.localFilters)&&(b=[...t.localFilters?t.localFilters:[]].map(a=>jd(a))),"addOns"in t.attributes&&P0.isEmpty(b)&&t.attributes.addOns.forEach(a=>{b=[...b,{type:a.type=="dateFilter"?"dateFilter":"singleSelectFilter",value:null,requiresValue:!1,managedByConfiguration:!1,appliesToFields:[{fieldId:a.field,dataSetId:n.dataSetId}]}]}),delete t.addOns,delete n.addOns,delete n.results,{...t,localFilters:b,attributes:n}},JN=(t,e)=>{if(!t.attributes)throw new Error("Component attributes are required in saveable");return{attributes:{...t.attributes,protectedByOrganisation:e?!0:void 0},localFilters:t.localFilters??[],colSpan:1,reports:[]}},Vu=t=>R.alternatives().conditional(".type",{is:"barChart",then:ru(t).schema}).conditional(".type",{is:"richText",then:Eu(t).schema}).conditional(".type",{is:"mercatorMap",then:Tu(t).schema}).conditional(".type",{is:"horizontalBarChart",then:mu(t).schema}).conditional(".type",{is:"lineChart",then:Lu(t).schema}).conditional(".type",{is:"lineChartV2",then:_u(t).schema}).conditional(".type",{is:"barChartV2",then:iu(t).schema}).conditional(".type",{is:"areaChartV2",then:ou(t).schema}).conditional(".type",{is:"comboChartV2",then:uu(t).schema}).conditional(".type",{is:"comboChart",then:Au(t).schema}).conditional(".type",{is:"areaChart",then:eu(t).schema}).conditional(".type",{is:"pieChart",then:Bu(t).schema}).conditional(".type",{is:"bubbleChart",then:zu(t).schema}).conditional(".type",{is:"bubbleChartV2",then:su(t).schema}).conditional(".type",{is:"sunburstChart",then:Fu(t).schema}).conditional(".type",{is:"scatterChart",then:Iu(t).schema}).conditional(".type",{is:"singleStat",then:Pu(t).schema}).conditional(".type",{is:"dataTable",then:Wu(t).schema}).conditional(".type",{is:"basicTable",then:au(t).schema}).conditional(".type",{is:"progress",then:wu(t).schema}).conditional(".type",{is:"custom",then:fu(t).schema}).conditional(".type",{is:"funnelChart",then:hu(t).schema}).conditional(".type",{is:"waterfallChart",then:ju(t).schema}).conditional(".type",{is:"radarChart",then:Xu(t).schema}).conditional(".type",{is:"horizontalBarChartV2",then:yu(t).schema}),e7=R.object({displayTitle:R.string().min(1).required(),colSpan:R.number().valid(12).required()}),GO=R.number().min(1).max(12).required().messages({"number.base":'"colSpan" must be a number',"number.min":'"colSpan" must be at least {#limit}',"number.max":'"colSpan" must be less than or equal to {#limit}',"any.required":'"colSpan" is a required field'}),t7=R.object({isEmpty:R.valid(!0).required(),colSpan:GO}),o7=t=>R.object({attributes:Vu({queryEngineConfig:t}),colSpan:GO}),Hu=t=>R.object({id:R.string(),display:r7(t),componentLibrary:R.array().required().items(R.object({attributes:Vu({queryEngineConfig:t})})),globalFilters:FN(t),customFields:R.object().required()});function r7(t){return R.array().required().items(R.object({height:R.number().required(),components:R.array().required().min(1).items(R.alternatives(t7,o7(t),e7))}))}const n7=1,Bs=(t,e)=>{const o=e?{queryEngineConfig:e}:void 0;if(typeof t.definition=="string")throw new Error("Dashboard is an encrypted string, use the query engine to fetch the dashboard. Please use the queryEngineConfig prop to pass the query engine configuration.");return{id:t.id,parentDashboardId:t.parent_dashboard_id,isPlayground:!1,permission:t.permission,name:t.name,globalFilters:a_(t.definition.globalFilters,o),componentLibrary:[...t.definition.componentLibrary||[]].map(n=>Gu({...n,colSpan:n?.colSpan||n7},o)),theme:{...$N,...t.theme},display:ZN(t.definition.display,o),webhookId:t.webhook_id||null,createdAt:new Date(t.created_at),updatedAt:new Date(t.updated_at),metadata:t.metadata||{}}},Pa=(t,e,o)=>({...t,dataSets:D_(e,o)}),i7=t=>({isPlayground:!1,display:[{components:[Wr(8),Wr(4)],height:Qo},{components:[Wr(4),Wr(4),Wr(4)],height:Qo}],componentLibrary:[],globalFilters:[],customFields:{},...t}),b7=(t,e)=>{let o=[];return t.map(n=>{if(n.id===void 0)throw new Error("Dashboard id is undefined");const b=Pa(n,e,n.customFields||{});o.push({id:b.id,dataSets:b.dataSets,display:b.display??[],globalFilters:[],componentLibrary:b.componentLibrary||[],parentDashboardId:null,metadata:{},theme:{},webhookId:"",isPlayground:!1,createdAt:new Date,updatedAt:new Date,isProgrammatic:!0})}),o},p7="vizzly_editor",a7=(t,e)=>{if(e.length>0&&e[0].id===p7)return[...t,{...e[0],parentDashboardId:t[0].id,isProgrammatic:!0,permission:t[0].permission}]};function M7(t,e){const o=a7(t,e);if(o)return o;const n=new Map(e.map(b=>[b.id,b]));return t.map(b=>{const a=n.get(b.id);if(b.parentDashboardId!==null){const O=n.get(b.parentDashboardId);if(O?.id===b.parentDashboardId)return{...b,componentLibrary:z7(O?.componentLibrary,b.componentLibrary)}}return a??b})}const z7=(t,e)=>{const o=new Map;return t.forEach(b=>{const a=b.attributes.viewId;o.set(a??"",b)}),e.forEach(b=>{const a=b.attributes.viewId;o.has(a??"")||o.set(a??"",b)}),Array.from(o.values())},kl=(t,e)=>{let o=[];return t.globalFilters.forEach(n=>{n.appliesToFields.forEach(b=>{try{const a=T2(e,b.dataSetId);if(!a){G1("Did not find data set when finding field usage",b.dataSetId);return}const O=dt(a,b.fieldId);o=[...o,{data_set_id:b.dataSetId,field_id:b.fieldId,function:"none",name:O.publicName}]}catch(a){a instanceof Ya?G1(`Did not find field in data set, assuming custom metric. ${b.fieldId}`):At(a);return}})}),t.display.forEach(n=>{n.components.forEach(b=>{if(!("attributes"in b))return;const a=T2(e,b.attributes.dataSetId);if(!a){G1("Did not find field in data set, assuming custom metric. ",b.attributes.dataSetId);return}let O=Jd(b.attributes).flatMap(A=>{try{const c=dt(a,A.fieldId);return[{data_set_id:A.dataSetId,field_id:A.fieldId,function:A.function,name:c.publicName}]}catch(c){c instanceof Ya?G1(`Did not find field in data set, assuming custom metric. ${A.fieldId}`):At(c)}return[]});o=[...o,...O]})}),{fields:o}},c7=t=>({id:t.id,name:t.name,library:t.library,createdAt:new Date(t.created_at),updatedAt:new Date(t.updated_at),parentGlobalLibraryId:t.parent_global_library_id});function s7(t,e){return t.find(o=>o.scope==="read_write"&&e[0].id===o.globalLibraryId)?.token||""}function O7(t,e,o){const n=VO(t);if(!n)throw new Error("No matching library found.");return(!n.library.views||!n.library.customFields)&&u7(n),A7(n.library.views,e),l7(o,n),n}function l7(t,e){if(!t)throw new Error("View object needs initialised");for(const o in t)t.hasOwnProperty(o)&&e.library.customFields?.hasOwnProperty(o)&&(e.library.customFields[o]=t[o])}function A7(t,e){if(!t)throw new Error("View array needs initialised");const o=t.findIndex(n=>n.attributes.viewId===e?.attributes.viewId);o!==-1?t[o]=e:t.push(e)}const d7=(t,e)=>{const o=VO(t);if(!o)throw new Error("No matching library found.");return o.library.views?o.library.views=o.library.views.filter(n=>n.attributes.viewId!==e.attributes.viewId):o.library.views=[],o};function VO(t){const e=t.find(o=>t.some(n=>n.id===o.parentGlobalLibraryId))||t.find(o=>o.parentGlobalLibraryId===null);if(!e)throw new Error("No matching library found.");return e}const u7=t=>{t.library.views=[],t.library.customFields={}},f7=t=>[...t].filter(e=>e.parentGlobalLibraryId!==null),q7=t=>[...t].find(e=>e.parentGlobalLibraryId===null);class Ss extends Error{constructor(e){super(e),this.name="FailedToLoadQueryEngineConfig"}}class ws extends Error{invalidEndpoint;constructor(e){super(`The queryEngineEndpoint value '${e}' is not valid.`),this.name="InvalidQueryEngineEndpoint",this.invalidEndpoint=e}}class jl extends Error{constructor(){super("The queryEngineEndpoint value is not of the correct type. It must be a string or a function."),this.name="InvalidQueryEngineEndpointType"}}const iM=t=>t.startsWith("/")?iM(t.slice(1)):t.endsWith("/")?iM(t.slice(0,-1)):t,W7=t=>t.startsWith("https://")||t.startsWith("http://")||t.startsWith("."),h7=(t,e)=>{const o=iM(t),n=iM(e),b=W7(t)?"":"/";return o==""&&n==""?"/":n==""?`${b}${o}`:o!=""&&n!=""?`${b}${o}/${n}`:`${b}${n}`},m7=t=>t.split("#vizzly_")[1]||null,g7=t=>async(e,o,n)=>{let b={};o&&(b.auth=`Bearer ${o}`);let a="";n&&(a=`filter=${n.join(",")}`);const{status:O,body:A}=await t({path:`/api/v2/auth/project/${e}/access_token?${a}`,method:"get",headers:b});if(O==200)return A.token.token},y7=async(t,e)=>{if(t.dashboardAccessToken)return G1("Using dashboard access token for auth header"),{auth:`Bearer ${t.dashboardAccessToken}`};if(t.projectAccessToken)return G1("Using project access token for auth header"),{auth:`Bearer ${t.projectAccessToken}`};if(t.apiKey)return G1("Using API Key for auth header"),{auth:`Api-Key ${t.apiKey}`};if(e.preFetchProjectAccessTokens&&(t.useCookieAuth||t.appSessionAuthToken)){G1("Fetching project access token from the Vizzly API",e.preFetchProjectAccessTokens.projectId,"Filtering by",e.preFetchProjectAccessTokens.resourceFilters);const o=await g7(Yu(t))(e.preFetchProjectAccessTokens.projectId,t.appSessionAuthToken,e.preFetchProjectAccessTokens.resourceFilters);if(o)return G1("Project access token received."),{auth:`Bearer ${o}`};G1("Failed to receive project access token.")}else G1("Not pre-fetching project access token.");return{}},Yu=t=>async e=>{try{const o=await y7(t,e),n=e.headers||{},b=h7(t.host,e.path),a=await dh(b,{method:e.method,headers:{"Content-Type":"application/json",Accept:"application/json",...o,...n},redirect:"follow",referrerPolicy:"no-referrer",body:e.body?JSON.stringify(e.body):null,signal:e.abortSignal,mode:e.mode||void 0});let O=await a.json();return G1("HTTP Client Response",{host:t.host,path:e.path,status:a.status,responseId:a.headers.get("X-Request-Id")}),{body:O,status:a.status,headers:a.headers}}catch(o){if(e.abortSignal?.aborted)return console.log("Aborted a request."),{status:500,body:{reason:"Aborted"},headers:null};throw o}},R7=t=>typeof t=="string"?t:t.endpoint,L7=t=>typeof t=="string"?{}:t.customHeaders?t.customHeaders():{},v7=()=>{if(typeof window>"u")return{};const t=window?.VizzlyDev?.getServerLogLevel?window?.VizzlyDev?.getServerLogLevel():void 0;return t?{"vizzly-log-level":t}:{}},HO=t=>async e=>{const o={host:R7(t)},n={...e,headers:{"vizzly-query-engine-request-id":$d(),...e.headers,...L7(t),...v7()}};return Yu(o)(n)},_7=t=>"supportedFeatures"in t?t:{...t,supportedFeatures:["subquery"]},N7=async t=>{const o=await HO(t)({method:"post",mode:"cors",path:"/api/v1/support",body:{frontendFeatures:["formatter:monthOfYearOnly"]}});return o.status==200?_7(o.body):null},bM=Ut.QueryEngineConfig.getQueryEngineConfig("js"),$l=t=>{let e=typeof t=="string"?t:t.endpoint;return!!(e.startsWith("http://")||e.startsWith("https://")||e.startsWith("/"))},T7=async(t,e)=>{try{if(t==="in-browser")return bM;if(typeof t=="function"){let o=await t();if(!o)throw new Ss("Failed to load query engine config.");return{...o}}else if(e){if(!$l(t))throw new ws(t);return bM}else if(typeof t=="string"||typeof t=="object"&&"endpoint"in t){if(!$l(t))throw new ws(t);const o=await N7(t);if(!o)throw new Ss("Failed to load query engine config.");return o}else throw new jl}catch(o){throw At(o),o instanceof ws||o instanceof jl?o:new Ss("Failed to load query engine config.")}};class B7 extends Error{constructor(e){super(e),this.name="FailedToLoadIdentity"}}class Ul extends Error{constructor(e){super(e),this.name="InvalidIdentityReturn"}}const S7="_vizzlyDashboardAdmin",w7=t=>{let e=m7(t);return e||new URLSearchParams(new URL(t).search).get(S7)||null},x7=t=>typeof window=="object"&&window&&window.atob?window.atob(t):Buffer.from(t,"base64").toString(),X7=t=>{const e=t.split(".")?.[1];return JSON.parse(x7(e).toString())},xa=t=>({...X7(t),signature:t}),C7=(t,e,o,n)=>{let b=xa(t);"scope"in b||(b.scope="read_write");const a={dashboardAccess:b,dataAccess:e?xa(e):void 0,queryEngineAccessConfig:o?xa(o):void 0,dashboardAdminOverride:n?xa(n):void 0};return D7(a),a},E7=t=>["accessType","dashboardId","projectId","userReference","scope"].map(o=>`${o}:${t[o]}`).join(":::"),D7=t=>{const e=new Date,o=new Date(t.dashboardAccess.expires),n=t.dataAccess?new Date(t.dataAccess.expires):!1;n!==!1&&n<e&&console.warn("Vizzly data access token expired at;",n),o<e&&console.warn("Vizzly dashboard access token expired at;",o)},I7=t=>{if(!t)throw new Ul("Failed to load identity.");const{error:e}=R.object({dashboardAccessToken:R.string().required(),dataAccessToken:R.string(),queryEngineAccessToken:R.string(),projectAccessToken:R.string().optional()}).validate(t);if(e)throw new Ul(e.message);return t},P7=async t=>{let e=await t();if(e=I7(e),!e)throw new B7("Failed to fetch identity config.");const o=F7()?w7(window.location.href):null;return{identityConfig:C7(e.dashboardAccessToken,e.dataAccessToken,e.queryEngineAccessToken,o),tokens:e}},F7=()=>typeof window<"u",xs=[{namespace:"config.supported_operator",constants:NA},{namespace:"config.supported_aggregate",constants:TA},{namespace:"config.supported_time",constants:W6}],Xs=(t,e,o)=>{const n={};return Object.entries(t).forEach(([b,a])=>{n[b]={...a,publicName:e(`${o}.${b}`,a.publicName)}}),n},k7=(t,e)=>{const o={...t};return o.supportedAggregates&&(o.supportedAggregates=Xs(o.supportedAggregates,e,xs[1].namespace)),o.supportedTimeTruncFunctions&&(o.supportedTimeTruncFunctions=Xs(o.supportedTimeTruncFunctions,e,xs[2].namespace)),o.supportedOperators&&(o.supportedOperators=Xs(o.supportedOperators,e,xs[0].namespace)),o};class j7 extends Error{constructor(){super("Identity prop type is invalid."),this.name="InvalidIdentityPropType"}}class Fa extends Error{constructor(e){super(e),this.name="FailedToResolveDataSets"}}class nO extends Error{constructor(){super("dataSets property is not valid"),this.name="InvalidDataSetsPropType"}}const $7=async(t,e,o)=>{const b=await HO(t)({method:"post",body:{dynamicConfig:typeof t=="object"?t.dynamicConfig:void 0,integritySignature:e},mode:"cors",path:"/api/v1/resolve-data-sets",abortSignal:o});if(b.status==200)return b.body.dataSets;throw new Fa(`Failed to resolve data sets from ${JSON.stringify(t)}. Received status ${b.status}`)};R.function();const U7=t=>async e=>await $7(t,e.dataAccess?.signature),G7=(t,e)=>{if(t)return t;if(typeof e=="function"){if(!t)throw"dataSets function is required when loading a custom query engine config.";return t}if(e)return U7(e);throw new nO},V7=(t,e)=>async(o,n)=>{try{let b=G7(t,e);if(typeof b!="function")throw new nO;let a=await b(o,n);if(!a)throw new Fa("Failed to fetch data sets from the query engine endpoint");return a.map(O=>x_(O,n))}catch(b){throw At(b),b instanceof nO?b:b instanceof _2.Errors.FailedToResolveDataSets?new Fa(b.message):new Fa("Failed to fetch data sets.")}},Gl={apiHost:"https://api.vizzly.co"},Vl="in-browser";class H7{constructor(e,o,n,b,a=Gl){this.queryEngineConfig=void 0,this.dataSets=void 0,this.extraCustomFields=b,this.queryEngine=e||Vl,this.loadAccessTokens=o,this.loadDataSetsCallback=n,this.options={...Gl,...a}}async getQueryEngineConfig(){if(this.queryEngineConfig)return this.queryEngineConfig;this.queryEngineConfig=await T7(this.queryEngine,this.loadDataSetsCallback);const e=(o,n,b)=>$O(o,n,b,this.options.textOverrides,this.options.developerMode);return this.queryEngineConfig=k7(this.queryEngineConfig,e),this.queryEngineConfig}async getIdentity(){if(typeof this.loadAccessTokens!="function")throw new j7;const{tokens:e,identityConfig:o}=await P7(this.loadAccessTokens);return{accessTokens:e,identityConfig:o}}async getDataSets(){const{identityConfig:e}=await this.getIdentity(),o=await this.getQueryEngineConfig(),n=V7(this.loadDataSetsCallback,this.queryEngine);return this.dataSets=await n(e,o),this.dataSets}async load(){let[{identityConfig:e},o,n]=await Promise.all([this.getIdentity(),this.getQueryEngineConfig(),this.getDataSets()]);const b=this.getDashboardStorageStrategy(o);return this.extraCustomFields&&(n=n.map(a=>{let O=this.extraCustomFields?this.extraCustomFields(a):[];return{...a,fields:[...a.fields,...O]}})),{queryEngineConfig:o,dataSets:n,identityConfig:e,dashboardStorageStrategy:b}}getDashboardStorageStrategy(e){return typeof this.queryEngine=="function"?{strategy:"vizzlyApi"}:!e.supportedFeatures.includes("encryptedDashboards")||this.queryEngine===Vl?{strategy:"vizzlyApi"}:{strategy:"queryEngine",endpoint:this.queryEngine}}}const Y7=(t,e)=>{const o=[];return t.forEach(n=>{const b=$u(e,!!n.requiresValue),{error:a,value:O}=b.validate(n);if(a)throw At(`Invalid global filter configuration: ${a.message}`),a;o.push(O)}),o};function Hl(t,e){if(!e)throw new Error("Query engine config is required to validate filters");return Y7(t,e)}class Oz extends Error{}function K7(t){const{error:e,value:o}=GO.validate(t);if(e)throw new Oz(e.message);return o}class ka extends VM{constructor(e,o){super(`'Issue with Services in ${o}: '${e}'`),this.name="ServicesValidation"}}const Xa=12;class iO{constructor(e){if(this.component=void 0,this.localFilters=void 0,this.isEmpty=void 0,e?.component)this.component=e?.component,this.colSpan=e?.colSpan??Xa;else{const o=Wr(e?.colSpan??Xa);this.colSpan=o.colSpan,this.isEmpty=o.isEmpty}e?.localFilters&&(this.localFilters=Hl(e.localFilters,Ie.use().getViewConfiguration().queryEngineConfig))}set(e){this.component=e.component,this.colSpan=e.colSpan??Xa,this.isEmpty=e.component?void 0:!0,e?.localFilters&&(this.localFilters=Hl(e.localFilters,Ie.use().getViewConfiguration().queryEngineConfig))}setColSpan(e){try{K7(e),this.colSpan=e}catch(o){throw new ka(o,"Cell.setColSpan")}}setComponent(e){this.component=e,this.isEmpty=void 0}emptyCell(e){const o=Wr(e??Xa);this.colSpan=o.colSpan,this.isEmpty=o.isEmpty,this.component=void 0}}class Ku{constructor(e,o){this.components=[],this.height=Qo,this.components=e??[],this.height=o??Qo,this.validateTotalColSpan()}addCell(e,o){o===void 0?this.components.push(e):this.components.splice(o,0,e),this.validateTotalColSpan()}setHeight(e){this.height=e}setRow(e){this.components=e,this.validateTotalColSpan()}set(e,o){this.components=e,this.height=o??Qo,this.validateTotalColSpan()}validateTotalColSpan(){if(this.components.reduce((o,n)=>o+n.colSpan,0)>GN)throw new Error("Total column span of cells exceeds the allowed limit of 12.")}}class Qu{constructor(e){this.component=void 0;let o=UN("New Header");e&&(o={...o,displayTitle:e});const n=VN([o],jN);this.component=[n]}setTitle(e){if(!this.component)throw new Error("Header is undefined");UO(this.component[0].components[0])&&(this.component[0].components[0].displayTitle=e)}}class Q7{constructor(e,o){this.dashboard=void 0;let n={id:e};o?.display&&(n={...n,display:Yl(o?.display)}),o?.customFields&&(n={...n,customFields:o.customFields}),o?.library&&(n={...n,componentLibrary:Kl(o?.library)}),this.dashboard=i7(n)}setDisplay(e){let o=Yl(e);if(!this.dashboard)throw new Error("Dashboard is undefined");this.dashboard.display=o}setCustomFields(e){if(!this.dashboard)throw new Error("Dashboard is undefined");this.dashboard.customFields=e}setLibrary(e){if(!this.dashboard)throw new Error("Dashboard is undefined");this.dashboard.componentLibrary=Kl(e)}build(){if(!this.dashboard)throw new Error("Dashboard is undefined");return{...this.dashboard,display:this.dashboard?.display,componentLibrary:this.dashboard?.componentLibrary}}}function Yl(t){let e=[];return t.forEach(o=>{if(o instanceof Ku){const n=o?.components.map(b=>b.component&&!b.isEmpty?{attributes:b.component.attributes,localFilters:b.localFilters??[],results:[],colSpan:b.colSpan,reports:[]}:b.isEmpty?{colSpan:b.colSpan,isEmpty:!0}:{colSpan:b.colSpan,isEmpty:!0});e.push({height:o.height??Qo,components:n})}o instanceof Qu&&o.component?.forEach(n=>{e.push({height:n.height,components:n.components})})}),e}const Kl=t=>{let e=[],o=new Set;return t?.library?.forEach(n=>{if(n.component&&n.component.attributes){const{viewId:b}=n.component.attributes;if(o.has(b??""))throw new Error(`Duplicate viewId found: ${b}`);o.add(b??""),e.push({attributes:n.component.attributes,localFilters:n.localFilters??[],colSpan:1,reports:[]})}}),e};function Ql(t){const e=R.object({component:R.object().required(),uniqueViewId:R.string().min(1).required().messages({"string.base":`"uniqueViewId" should be a type of 'text'`,"string.empty":'"uniqueViewId" cannot be an empty field',"string.min":'"uniqueViewId" should have a minimum length of {#limit}',"any.required":'"uniqueViewId" maybe undefined or null'})}),{error:o}=e.validate(t);if(o)throw new Oz(o.message)}class Z7{constructor(e){this.library=void 0,this.library=[],e?.components&&this.addComponents(e?.components)}addComponent(e,o,n){try{Ql({component:e,uniqueViewId:o});const b=new iO({component:Zl(e,o),colSpan:1,localFilters:n?.localFilters});n?.position===void 0?this.library?.push(b):this.library?.splice(n.position,0,b)}catch(b){throw new ka(b,"Library.addComponent")}}addComponents(e){try{if(e===void 0)throw new ka("Components are undefined","Library.addComponents");e.forEach(o=>{Ql(o);const n=new iO({component:Zl(o.component,o.uniqueViewId),colSpan:1});this.library?.push(n)})}catch(o){throw new ka(o,"Library.addComponents")}}}const Zl=(t,e)=>({...t,attributes:{...t.attributes,viewId:e}});class J7{constructor(e){this.editor=void 0,e?.component&&(this.editor=e.component)}setComponent(e){if(!this.editor)throw new Error("Editor is undefined");this.editor=e}build(){if(!this.editor)throw new Error("Editor is undefined");return JN({attributes:this.editor.attributes})}}const eT=()=>Ut.QueryEngineConfig.getQueryEngineConfig("postgres"),tT=()=>Ut.QueryEngineConfig.getQueryEngineConfig("redshift"),oT=()=>Ut.QueryEngineConfig.getQueryEngineConfig("bigquery"),rT=()=>Ut.QueryEngineConfig.getQueryEngineConfig("microsoftSQLServer"),nT=()=>Ut.QueryEngineConfig.getQueryEngineConfig("mariadb"),iT=()=>Ut.QueryEngineConfig.getQueryEngineConfig("snowflake"),bT=()=>Ut.QueryEngineConfig.getQueryEngineConfig("mysql"),pT=t=>{switch(t){case"js":return bM;case"postgres":return eT();case"redshift":return tT();case"bigquery":return oT();case"mariadb":return nT();case"snowflake":return iT();case"mysql":return bT();case"microsoftSQLServer":return rT();case"SQLite":throw"SQLite not support via the query engine"}};class v1{constructor(e){const{init:o}=ib(e.type,{queryEngineConfig:this.getQueryEngineConfig()});this.attributes=o(e?.dataSetId,e)}getQueryEngineConfig(){return v1.queryEngineConfig||Ie.use().getViewConfiguration().queryEngineConfig}static setQueryEngineConfig(e){typeof e=="string"?v1.queryEngineConfig=pT(e):v1.queryEngineConfig=e}updateAttributes(e){const{setAttributes:o}=ib(this.attributes.type,{queryEngineConfig:this.getQueryEngineConfig()});if(!this.attributes)throw new Error("Attributes have not been initialized yet");this.attributes=o(this.attributes,e)}}class aT extends v1{constructor(e){super({...e,type:"areaChart"})}static type(){return"areaChart"}}class MT extends v1{constructor(e){super({...e,type:"areaChartV2"})}static type(){return"areaChartV2"}}class zT extends v1{constructor(e){super({...e,type:"lineChart"})}static type(){return"lineChart"}}class cT extends v1{constructor(e){super({...e,type:"lineChartV2"})}static type(){return"lineChartV2"}}class sT extends v1{constructor(e){super({...e,type:"barChart"})}static type(){return"barChart"}}class OT extends v1{constructor(e){super({...e,type:"barChartV2"})}static type(){return"barChartV2"}}class lT extends v1{constructor(e){super({...e,type:"pieChart"})}static type(){return"pieChart"}}class AT extends v1{constructor(e){super({...e,type:"bubbleChart"})}static type(){return"bubbleChart"}}class dT extends v1{constructor(e){super({...e,type:"bubbleChartV2"})}static type(){return"bubbleChartV2"}}class uT extends v1{constructor(e){super({...e,type:"sunburstChart"})}static type(){return"sunburstChart"}}class fT extends v1{constructor(e){super({...e,type:"scatterChart"})}static type(){return"scatterChart"}}class qT extends v1{constructor(e){super({...e,type:"comboChart"})}static type(){return"comboChart"}}class WT extends v1{constructor(e){super({...e,type:"comboChartV2"})}static type(){return"comboChartV2"}}class hT extends v1{constructor(e){super({...e,type:"dataTable"})}static type(){return"dataTable"}}class mT extends v1{constructor(e){super({...e,type:"basicTable"})}static type(){return"basicTable"}}class gT extends v1{constructor(e){super({...e,type:"horizontalBarChart"})}static type(){return"horizontalBarChart"}}class yT extends v1{constructor(e){super({...e,type:"horizontalBarChartV2"})}static type(){return"horizontalBarChartV2"}}class RT extends v1{constructor(e){super({...e,type:"mercatorMap"})}static type(){return"mercatorMap"}}class LT extends v1{constructor(e){super({...e,type:"singleStat"})}static type(){return"singleStat"}}class vT extends v1{constructor(e){super({...e,type:"progress"})}static type(){return"progress"}}class _T extends v1{constructor(e){super({...e,type:"richText"})}static type(){return"richText"}}class NT extends v1{constructor(e){super({...e,type:"waterfallChart"})}static type(){return"waterfallChart"}}class TT extends v1{constructor(e){super({...e,type:"radarChart"})}static type(){return"radarChart"}}class BT extends v1{constructor(e){super({...e,type:"funnelChart"})}static type(){return"funnelChart"}}class Zu extends Error{constructor(e){super(`Vizzly has not yet been loaded. Please see the instantiation docs;
116
+ */(function(t,e){(function(o,n){t.exports=n()})(O0,function(){for(var o=function(W,_,S){return _===void 0&&(_=0),S===void 0&&(S=1),W<_?_:W>S?S:W},n=o,b=function(W){W._clipped=!1,W._unclipped=W.slice(0);for(var _=0;_<=3;_++)_<3?((W[_]<0||W[_]>255)&&(W._clipped=!0),W[_]=n(W[_],0,255)):_===3&&(W[_]=n(W[_],0,1));return W},a={},O=0,A=["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"];O<A.length;O+=1){var c=A[O];a["[object "+c+"]"]=c.toLowerCase()}var y=function(W){return a[Object.prototype.toString.call(W)]||"object"},v=y,N=function(W,_){return _===void 0&&(_=null),W.length>=3?Array.prototype.slice.call(W):v(W[0])=="object"&&_?_.split("").filter(function(S){return W[0][S]!==void 0}).map(function(S){return W[0][S]}):W[0]},s=y,u=function(W){if(W.length<2)return null;var _=W.length-1;return s(W[_])=="string"?W[_].toLowerCase():null},d=Math.PI,z={clip_rgb:b,limit:o,type:y,unpack:N,last:u,PI:d,TWOPI:d*2,PITHIRD:d/3,DEG2RAD:d/180,RAD2DEG:180/d},M={format:{},autodetect:[]},q=z.last,l=z.clip_rgb,f=z.type,g=M,L=function(){for(var _=[],S=arguments.length;S--;)_[S]=arguments[S];var I=this;if(f(_[0])==="object"&&_[0].constructor&&_[0].constructor===this.constructor)return _[0];var $=q(_),H=!1;if(!$){H=!0,g.sorted||(g.autodetect=g.autodetect.sort(function(b0,f0){return f0.p-b0.p}),g.sorted=!0);for(var k=0,Q=g.autodetect;k<Q.length;k+=1){var J=Q[k];if($=J.test.apply(J,_),$)break}}if(g.format[$]){var n0=g.format[$].apply(null,H?_:_.slice(0,-1));I._rgb=l(n0)}else throw new Error("unknown format: "+_);I._rgb.length===3&&I._rgb.push(1)};L.prototype.toString=function(){return f(this.hex)=="function"?this.hex():"["+this._rgb.join(",")+"]"};var T=L,X=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];return new(Function.prototype.bind.apply(X.Color,[null].concat(W)))};X.Color=T,X.version="2.4.2";var C=X,m=z.unpack,w=Math.max,E=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];var S=m(W,"rgb"),I=S[0],$=S[1],H=S[2];I=I/255,$=$/255,H=H/255;var k=1-w(I,w($,H)),Q=k<1?1/(1-k):0,J=(1-I-k)*Q,n0=(1-$-k)*Q,b0=(1-H-k)*Q;return[J,n0,b0,k]},U=E,z0=z.unpack,a0=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];W=z0(W,"cmyk");var S=W[0],I=W[1],$=W[2],H=W[3],k=W.length>4?W[4]:1;return H===1?[0,0,0,k]:[S>=1?0:255*(1-S)*(1-H),I>=1?0:255*(1-I)*(1-H),$>=1?0:255*(1-$)*(1-H),k]},V=a0,Z=C,u0=T,L0=M,X0=z.unpack,B0=z.type,$0=U;u0.prototype.cmyk=function(){return $0(this._rgb)},Z.cmyk=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];return new(Function.prototype.bind.apply(u0,[null].concat(W,["cmyk"])))},L0.format.cmyk=V,L0.autodetect.push({p:2,test:function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];if(W=X0(W,"cmyk"),B0(W)==="array"&&W.length===4)return"cmyk"}});var h1=z.unpack,d1=z.last,k1=function(W){return Math.round(W*100)/100},be=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];var S=h1(W,"hsla"),I=d1(W)||"lsa";return S[0]=k1(S[0]||0),S[1]=k1(S[1]*100)+"%",S[2]=k1(S[2]*100)+"%",I==="hsla"||S.length>3&&S[3]<1?(S[3]=S.length>3?S[3]:1,I="hsla"):S.length=3,I+"("+S.join(",")+")"},pe=be,J0=z.unpack,T1=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];W=J0(W,"rgba");var S=W[0],I=W[1],$=W[2];S/=255,I/=255,$/=255;var H=Math.min(S,I,$),k=Math.max(S,I,$),Q=(k+H)/2,J,n0;return k===H?(J=0,n0=Number.NaN):J=Q<.5?(k-H)/(k+H):(k-H)/(2-k-H),S==k?n0=(I-$)/(k-H):I==k?n0=2+($-S)/(k-H):$==k&&(n0=4+(S-I)/(k-H)),n0*=60,n0<0&&(n0+=360),W.length>3&&W[3]!==void 0?[n0,J,Q,W[3]]:[n0,J,Q]},nt=T1,M0=z.unpack,_0=z.last,e1=pe,j=nt,e0=Math.round,t0=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];var S=M0(W,"rgba"),I=_0(W)||"rgb";return I.substr(0,3)=="hsl"?e1(j(S),I):(S[0]=e0(S[0]),S[1]=e0(S[1]),S[2]=e0(S[2]),(I==="rgba"||S.length>3&&S[3]<1)&&(S[3]=S.length>3?S[3]:1,I="rgba"),I+"("+S.slice(0,I==="rgb"?3:4).join(",")+")")},c0=t0,R0=z.unpack,x0=Math.round,T0=function(){for(var W,_=[],S=arguments.length;S--;)_[S]=arguments[S];_=R0(_,"hsl");var I=_[0],$=_[1],H=_[2],k,Q,J;if($===0)k=Q=J=H*255;else{var n0=[0,0,0],b0=[0,0,0],f0=H<.5?H*(1+$):H+$-H*$,l0=2*H-f0,g0=I/360;n0[0]=g0+1/3,n0[1]=g0,n0[2]=g0-1/3;for(var y0=0;y0<3;y0++)n0[y0]<0&&(n0[y0]+=1),n0[y0]>1&&(n0[y0]-=1),6*n0[y0]<1?b0[y0]=l0+(f0-l0)*6*n0[y0]:2*n0[y0]<1?b0[y0]=f0:3*n0[y0]<2?b0[y0]=l0+(f0-l0)*(2/3-n0[y0])*6:b0[y0]=l0;W=[x0(b0[0]*255),x0(b0[1]*255),x0(b0[2]*255)],k=W[0],Q=W[1],J=W[2]}return _.length>3?[k,Q,J,_[3]]:[k,Q,J,1]},F0=T0,K0=F0,Kt=M,D2=/^rgb\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*\)$/,Tr=/^rgba\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*,\s*([01]|[01]?\.\d+)\)$/,l2=/^rgb\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,Br=/^rgba\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,A2=/^hsl\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,Qt=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,mo=Math.round,I2=function(W){W=W.toLowerCase().trim();var _;if(Kt.format.named)try{return Kt.format.named(W)}catch{}if(_=W.match(D2)){for(var S=_.slice(1,4),I=0;I<3;I++)S[I]=+S[I];return S[3]=1,S}if(_=W.match(Tr)){for(var $=_.slice(1,5),H=0;H<4;H++)$[H]=+$[H];return $}if(_=W.match(l2)){for(var k=_.slice(1,4),Q=0;Q<3;Q++)k[Q]=mo(k[Q]*2.55);return k[3]=1,k}if(_=W.match(Br)){for(var J=_.slice(1,5),n0=0;n0<3;n0++)J[n0]=mo(J[n0]*2.55);return J[3]=+J[3],J}if(_=W.match(A2)){var b0=_.slice(1,4);b0[1]*=.01,b0[2]*=.01;var f0=K0(b0);return f0[3]=1,f0}if(_=W.match(Qt)){var l0=_.slice(1,4);l0[1]*=.01,l0[2]*=.01;var g0=K0(l0);return g0[3]=+_[4],g0}};I2.test=function(W){return D2.test(W)||Tr.test(W)||l2.test(W)||Br.test(W)||A2.test(W)||Qt.test(W)};var er=I2,go=C,P2=T,F2=M,yo=z.type,Ro=c0,Ve=er;P2.prototype.css=function(W){return Ro(this._rgb,W)},go.css=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];return new(Function.prototype.bind.apply(P2,[null].concat(W,["css"])))},F2.format.css=Ve,F2.autodetect.push({p:5,test:function(W){for(var _=[],S=arguments.length-1;S-- >0;)_[S]=arguments[S+1];if(!_.length&&yo(W)==="string"&&Ve.test(W))return"css"}});var k2=T,Sr=C,wr=M,xr=z.unpack;wr.format.gl=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];var S=xr(W,"rgba");return S[0]*=255,S[1]*=255,S[2]*=255,S},Sr.gl=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];return new(Function.prototype.bind.apply(k2,[null].concat(W,["gl"])))},k2.prototype.gl=function(){var W=this._rgb;return[W[0]/255,W[1]/255,W[2]/255,W[3]]};var wb=z.unpack,lz=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];var S=wb(W,"rgb"),I=S[0],$=S[1],H=S[2],k=Math.min(I,$,H),Q=Math.max(I,$,H),J=Q-k,n0=J*100/255,b0=k/(255-J)*100,f0;return J===0?f0=Number.NaN:(I===Q&&(f0=($-H)/J),$===Q&&(f0=2+(H-I)/J),H===Q&&(f0=4+(I-$)/J),f0*=60,f0<0&&(f0+=360)),[f0,n0,b0]},Az=lz,dz=z.unpack,uz=Math.floor,xb=function(){for(var W,_,S,I,$,H,k=[],Q=arguments.length;Q--;)k[Q]=arguments[Q];k=dz(k,"hcg");var J=k[0],n0=k[1],b0=k[2],f0,l0,g0;b0=b0*255;var y0=n0*255;if(n0===0)f0=l0=g0=b0;else{J===360&&(J=0),J>360&&(J-=360),J<0&&(J+=360),J/=60;var H0=uz(J),C0=J-H0,G0=b0*(1-n0),p1=G0+y0*(1-C0),ze=G0+y0*C0,$1=G0+y0;switch(H0){case 0:W=[$1,ze,G0],f0=W[0],l0=W[1],g0=W[2];break;case 1:_=[p1,$1,G0],f0=_[0],l0=_[1],g0=_[2];break;case 2:S=[G0,$1,ze],f0=S[0],l0=S[1],g0=S[2];break;case 3:I=[G0,p1,$1],f0=I[0],l0=I[1],g0=I[2];break;case 4:$=[ze,G0,$1],f0=$[0],l0=$[1],g0=$[2];break;case 5:H=[$1,G0,p1],f0=H[0],l0=H[1],g0=H[2];break}}return[f0,l0,g0,k.length>3?k[3]:1]},fz=xb,qz=z.unpack,Wz=z.type,Vn=C,Xb=T,Xr=M,hz=Az;Xb.prototype.hcg=function(){return hz(this._rgb)},Vn.hcg=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];return new(Function.prototype.bind.apply(Xb,[null].concat(W,["hcg"])))},Xr.format.hcg=fz,Xr.autodetect.push({p:1,test:function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];if(W=qz(W,"hcg"),Wz(W)==="array"&&W.length===3)return"hcg"}});var mz=z.unpack,gz=z.last,Cr=Math.round,yz=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];var S=mz(W,"rgba"),I=S[0],$=S[1],H=S[2],k=S[3],Q=gz(W)||"auto";k===void 0&&(k=1),Q==="auto"&&(Q=k<1?"rgba":"rgb"),I=Cr(I),$=Cr($),H=Cr(H);var J=I<<16|$<<8|H,n0="000000"+J.toString(16);n0=n0.substr(n0.length-6);var b0="0"+Cr(k*255).toString(16);switch(b0=b0.substr(b0.length-2),Q.toLowerCase()){case"rgba":return"#"+n0+b0;case"argb":return"#"+b0+n0;default:return"#"+n0}},Cb=yz,Rz=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,Lz=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,Eb=function(W){if(W.match(Rz)){(W.length===4||W.length===7)&&(W=W.substr(1)),W.length===3&&(W=W.split(""),W=W[0]+W[0]+W[1]+W[1]+W[2]+W[2]);var _=parseInt(W,16),S=_>>16,I=_>>8&255,$=_&255;return[S,I,$,1]}if(W.match(Lz)){(W.length===5||W.length===9)&&(W=W.substr(1)),W.length===4&&(W=W.split(""),W=W[0]+W[0]+W[1]+W[1]+W[2]+W[2]+W[3]+W[3]);var H=parseInt(W,16),k=H>>24&255,Q=H>>16&255,J=H>>8&255,n0=Math.round((H&255)/255*100)/100;return[k,Q,J,n0]}throw new Error("unknown hex color: "+W)},Db=Eb,vz=C,Ib=T,_z=z.type,Pb=M,Nz=Cb;Ib.prototype.hex=function(W){return Nz(this._rgb,W)},vz.hex=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];return new(Function.prototype.bind.apply(Ib,[null].concat(W,["hex"])))},Pb.format.hex=Db,Pb.autodetect.push({p:4,test:function(W){for(var _=[],S=arguments.length-1;S-- >0;)_[S]=arguments[S+1];if(!_.length&&_z(W)==="string"&&[3,4,5,6,7,8,9].indexOf(W.length)>=0)return"hex"}});var Er=z.unpack,Fb=z.TWOPI,Dr=Math.min,Tz=Math.sqrt,Bz=Math.acos,Sz=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];var S=Er(W,"rgb"),I=S[0],$=S[1],H=S[2];I/=255,$/=255,H/=255;var k,Q=Dr(I,$,H),J=(I+$+H)/3,n0=J>0?1-Q/J:0;return n0===0?k=NaN:(k=(I-$+(I-H))/2,k/=Tz((I-$)*(I-$)+(I-H)*($-H)),k=Bz(k),H>$&&(k=Fb-k),k/=Fb),[k*360,n0,J]},kb=Sz,jb=z.unpack,Ir=z.limit,Lo=z.TWOPI,Hn=z.PITHIRD,vo=Math.cos,wz=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];W=jb(W,"hsi");var S=W[0],I=W[1],$=W[2],H,k,Q;return isNaN(S)&&(S=0),isNaN(I)&&(I=0),S>360&&(S-=360),S<0&&(S+=360),S/=360,S<1/3?(Q=(1-I)/3,H=(1+I*vo(Lo*S)/vo(Hn-Lo*S))/3,k=1-(Q+H)):S<2/3?(S-=1/3,H=(1-I)/3,k=(1+I*vo(Lo*S)/vo(Hn-Lo*S))/3,Q=1-(H+k)):(S-=2/3,k=(1-I)/3,Q=(1+I*vo(Lo*S)/vo(Hn-Lo*S))/3,H=1-(k+Q)),H=Ir($*H*3),k=Ir($*k*3),Q=Ir($*Q*3),[H*255,k*255,Q*255,W.length>3?W[3]:1]},$b=wz,Ub=z.unpack,Gb=z.type,Yn=C,Vb=T,Kn=M,Pr=kb;Vb.prototype.hsi=function(){return Pr(this._rgb)},Yn.hsi=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];return new(Function.prototype.bind.apply(Vb,[null].concat(W,["hsi"])))},Kn.format.hsi=$b,Kn.autodetect.push({p:2,test:function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];if(W=Ub(W,"hsi"),Gb(W)==="array"&&W.length===3)return"hsi"}});var Hb=z.unpack,xz=z.type,Yb=C,Qn=T,Fr=M,Xz=nt;Qn.prototype.hsl=function(){return Xz(this._rgb)},Yb.hsl=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];return new(Function.prototype.bind.apply(Qn,[null].concat(W,["hsl"])))},Fr.format.hsl=F0,Fr.autodetect.push({p:2,test:function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];if(W=Hb(W,"hsl"),xz(W)==="array"&&W.length===3)return"hsl"}});var Kb=z.unpack,Zn=Math.min,Jn=Math.max,_o=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];W=Kb(W,"rgb");var S=W[0],I=W[1],$=W[2],H=Zn(S,I,$),k=Jn(S,I,$),Q=k-H,J,n0,b0;return b0=k/255,k===0?(J=Number.NaN,n0=0):(n0=Q/k,S===k&&(J=(I-$)/Q),I===k&&(J=2+($-S)/Q),$===k&&(J=4+(S-I)/Q),J*=60,J<0&&(J+=360)),[J,n0,b0]},Qb=_o,Zb=z.unpack,Cz=Math.floor,Jb=function(){for(var W,_,S,I,$,H,k=[],Q=arguments.length;Q--;)k[Q]=arguments[Q];k=Zb(k,"hsv");var J=k[0],n0=k[1],b0=k[2],f0,l0,g0;if(b0*=255,n0===0)f0=l0=g0=b0;else{J===360&&(J=0),J>360&&(J-=360),J<0&&(J+=360),J/=60;var y0=Cz(J),H0=J-y0,C0=b0*(1-n0),G0=b0*(1-n0*H0),p1=b0*(1-n0*(1-H0));switch(y0){case 0:W=[b0,p1,C0],f0=W[0],l0=W[1],g0=W[2];break;case 1:_=[G0,b0,C0],f0=_[0],l0=_[1],g0=_[2];break;case 2:S=[C0,b0,p1],f0=S[0],l0=S[1],g0=S[2];break;case 3:I=[C0,G0,b0],f0=I[0],l0=I[1],g0=I[2];break;case 4:$=[p1,C0,b0],f0=$[0],l0=$[1],g0=$[2];break;case 5:H=[b0,C0,G0],f0=H[0],l0=H[1],g0=H[2];break}}return[f0,l0,g0,k.length>3?k[3]:1]},ep=Jb,tp=z.unpack,op=z.type,Ez=C,rp=T,np=M,ip=Qb;rp.prototype.hsv=function(){return ip(this._rgb)},Ez.hsv=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];return new(Function.prototype.bind.apply(rp,[null].concat(W,["hsv"])))},np.format.hsv=ep,np.autodetect.push({p:2,test:function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];if(W=tp(W,"hsv"),op(W)==="array"&&W.length===3)return"hsv"}});var kr={Kn:18,Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452},No=kr,Dz=z.unpack,bp=Math.pow,ei=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];var S=Dz(W,"rgb"),I=S[0],$=S[1],H=S[2],k=Iz(I,$,H),Q=k[0],J=k[1],n0=k[2],b0=116*J-16;return[b0<0?0:b0,500*(Q-J),200*(J-n0)]},ti=function(W){return(W/=255)<=.04045?W/12.92:bp((W+.055)/1.055,2.4)},oi=function(W){return W>No.t3?bp(W,1/3):W/No.t2+No.t0},Iz=function(W,_,S){W=ti(W),_=ti(_),S=ti(S);var I=oi((.4124564*W+.3575761*_+.1804375*S)/No.Xn),$=oi((.2126729*W+.7151522*_+.072175*S)/No.Yn),H=oi((.0193339*W+.119192*_+.9503041*S)/No.Zn);return[I,$,H]},pp=ei,To=kr,B1=z.unpack,_1=Math.pow,Pz=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];W=B1(W,"lab");var S=W[0],I=W[1],$=W[2],H,k,Q,J,n0,b0;return k=(S+16)/116,H=isNaN(I)?k:k+I/500,Q=isNaN($)?k:k-$/200,k=To.Yn*ni(k),H=To.Xn*ni(H),Q=To.Zn*ni(Q),J=ri(3.2404542*H-1.5371385*k-.4985314*Q),n0=ri(-.969266*H+1.8760108*k+.041556*Q),b0=ri(.0556434*H-.2040259*k+1.0572252*Q),[J,n0,b0,W.length>3?W[3]:1]},ri=function(W){return 255*(W<=.00304?12.92*W:1.055*_1(W,1/2.4)-.055)},ni=function(W){return W>To.t1?W*W*W:To.t2*(W-To.t0)},ap=Pz,Fz=z.unpack,kz=z.type,Mp=C,zp=T,ae=M,ii=pp;zp.prototype.lab=function(){return ii(this._rgb)},Mp.lab=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];return new(Function.prototype.bind.apply(zp,[null].concat(W,["lab"])))},ae.format.lab=ap,ae.autodetect.push({p:2,test:function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];if(W=Fz(W,"lab"),kz(W)==="array"&&W.length===3)return"lab"}});var j2=z.unpack,cp=z.RAD2DEG,bi=Math.sqrt,it=Math.atan2,sp=Math.round,Op=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];var S=j2(W,"lab"),I=S[0],$=S[1],H=S[2],k=bi($*$+H*H),Q=(it(H,$)*cp+360)%360;return sp(k*1e4)===0&&(Q=Number.NaN),[I,k,Q]},pi=Op,lp=z.unpack,Ap=pp,dp=pi,He=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];var S=lp(W,"rgb"),I=S[0],$=S[1],H=S[2],k=Ap(I,$,H),Q=k[0],J=k[1],n0=k[2];return dp(Q,J,n0)},jz=He,bt=z.unpack,$z=z.DEG2RAD,up=Math.sin,d2=Math.cos,jr=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];var S=bt(W,"lch"),I=S[0],$=S[1],H=S[2];return isNaN(H)&&(H=0),H=H*$z,[I,d2(H)*$,up(H)*$]},$r=jr,S1=z.unpack,u2=$r,ai=ap,Uz=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];W=S1(W,"lch");var S=W[0],I=W[1],$=W[2],H=u2(S,I,$),k=H[0],Q=H[1],J=H[2],n0=ai(k,Q,J),b0=n0[0],f0=n0[1],l0=n0[2];return[b0,f0,l0,W.length>3?W[3]:1]},Ur=Uz,Gz=z.unpack,Vz=Ur,Hz=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];var S=Gz(W,"hcl").reverse();return Vz.apply(void 0,S)},fp=Hz,Gr=z.unpack,Bo=z.type,qp=C,tr=T,Vr=M,Hr=jz;tr.prototype.lch=function(){return Hr(this._rgb)},tr.prototype.hcl=function(){return Hr(this._rgb).reverse()},qp.lch=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];return new(Function.prototype.bind.apply(tr,[null].concat(W,["lch"])))},qp.hcl=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];return new(Function.prototype.bind.apply(tr,[null].concat(W,["hcl"])))},Vr.format.lch=Ur,Vr.format.hcl=fp,["lch","hcl"].forEach(function(W){return Vr.autodetect.push({p:2,test:function(){for(var _=[],S=arguments.length;S--;)_[S]=arguments[S];if(_=Gr(_,W),Bo(_)==="array"&&_.length===3)return W}})});var Mi={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflower:"#6495ed",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",laserlemon:"#ffff54",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrod:"#fafad2",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",maroon2:"#7f0000",maroon3:"#b03060",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",purple2:"#7f007f",purple3:"#a020f0",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},zi=Mi,Yz=T,Yr=M,ci=z.type,or=zi,Wp=Db,Ye=Cb;Yz.prototype.name=function(){for(var W=Ye(this._rgb,"rgb"),_=0,S=Object.keys(or);_<S.length;_+=1){var I=S[_];if(or[I]===W)return I.toLowerCase()}return W},Yr.format.named=function(W){if(W=W.toLowerCase(),or[W])return Wp(or[W]);throw new Error("unknown color name: "+W)},Yr.autodetect.push({p:5,test:function(W){for(var _=[],S=arguments.length-1;S-- >0;)_[S]=arguments[S+1];if(!_.length&&ci(W)==="string"&&or[W.toLowerCase()])return"named"}});var si=z.unpack,rr=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];var S=si(W,"rgb"),I=S[0],$=S[1],H=S[2];return(I<<16)+($<<8)+H},hp=rr,mp=z.type,Kz=function(W){if(mp(W)=="number"&&W>=0&&W<=16777215){var _=W>>16,S=W>>8&255,I=W&255;return[_,S,I,1]}throw new Error("unknown num color: "+W)},Qz=Kz,Zz=C,gp=T,yp=M,So=z.type,Jz=hp;gp.prototype.num=function(){return Jz(this._rgb)},Zz.num=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];return new(Function.prototype.bind.apply(gp,[null].concat(W,["num"])))},yp.format.num=Qz,yp.autodetect.push({p:5,test:function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];if(W.length===1&&So(W[0])==="number"&&W[0]>=0&&W[0]<=16777215)return"num"}});var ec=C,nr=T,Oi=M,Zt=z.unpack,ir=z.type,Rp=Math.round;nr.prototype.rgb=function(W){return W===void 0&&(W=!0),W===!1?this._rgb.slice(0,3):this._rgb.slice(0,3).map(Rp)},nr.prototype.rgba=function(W){return W===void 0&&(W=!0),this._rgb.slice(0,4).map(function(_,S){return S<3?W===!1?_:Rp(_):_})},ec.rgb=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];return new(Function.prototype.bind.apply(nr,[null].concat(W,["rgb"])))},Oi.format.rgb=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];var S=Zt(W,"rgba");return S[3]===void 0&&(S[3]=1),S},Oi.autodetect.push({p:3,test:function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];if(W=Zt(W,"rgba"),ir(W)==="array"&&(W.length===3||W.length===4&&ir(W[3])=="number"&&W[3]>=0&&W[3]<=1))return"rgb"}});var Kr=Math.log,tc=function(W){var _=W/100,S,I,$;return _<66?(S=255,I=_<6?0:-155.25485562709179-.44596950469579133*(I=_-2)+104.49216199393888*Kr(I),$=_<20?0:-254.76935184120902+.8274096064007395*($=_-10)+115.67994401066147*Kr($)):(S=351.97690566805693+.114206453784165*(S=_-55)-40.25366309332127*Kr(S),I=325.4494125711974+.07943456536662342*(I=_-50)-28.0852963507957*Kr(I),$=255),[S,I,$,1]},$2=tc,ht=$2,Lp=z.unpack,oc=Math.round,rc=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];for(var S=Lp(W,"rgb"),I=S[0],$=S[2],H=1e3,k=4e4,Q=.4,J;k-H>Q;){J=(k+H)*.5;var n0=ht(J);n0[2]/n0[0]>=$/I?k=J:H=J}return oc(J)},nc=rc,li=C,Qr=T,f2=M,Y=nc;Qr.prototype.temp=Qr.prototype.kelvin=Qr.prototype.temperature=function(){return Y(this._rgb)},li.temp=li.kelvin=li.temperature=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];return new(Function.prototype.bind.apply(Qr,[null].concat(W,["temp"])))},f2.format.temp=f2.format.kelvin=f2.format.temperature=$2;var r0=z.unpack,o0=Math.cbrt,m0=Math.pow,U0=Math.sign,s1=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];var S=r0(W,"rgb"),I=S[0],$=S[1],H=S[2],k=[u1(I/255),u1($/255),u1(H/255)],Q=k[0],J=k[1],n0=k[2],b0=o0(.4122214708*Q+.5363325363*J+.0514459929*n0),f0=o0(.2119034982*Q+.6806995451*J+.1073969566*n0),l0=o0(.0883024619*Q+.2817188376*J+.6299787005*n0);return[.2104542553*b0+.793617785*f0-.0040720468*l0,1.9779984951*b0-2.428592205*f0+.4505937099*l0,.0259040371*b0+.7827717662*f0-.808675766*l0]},Q1=s1;function u1(W){var _=Math.abs(W);return _<.04045?W/12.92:(U0(W)||1)*m0((_+.055)/1.055,2.4)}var Ai=z.unpack,Zr=Math.pow,pt=Math.sign,Jr=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];W=Ai(W,"lab");var S=W[0],I=W[1],$=W[2],H=Zr(S+.3963377774*I+.2158037573*$,3),k=Zr(S-.1055613458*I-.0638541728*$,3),Q=Zr(S-.0894841775*I-1.291485548*$,3);return[255*q2(4.0767416621*H-3.3077115913*k+.2309699292*Q),255*q2(-1.2684380046*H+2.6097574011*k-.3413193965*Q),255*q2(-.0041960863*H-.7034186147*k+1.707614701*Q),W.length>3?W[3]:1]},vp=Jr;function q2(W){var _=Math.abs(W);return _>.0031308?(pt(W)||1)*(1.055*Zr(_,1/2.4)-.055):W*12.92}var en=z.unpack,tn=z.type,f1=C,_p=T,di=M,on=Q1;_p.prototype.oklab=function(){return on(this._rgb)},f1.oklab=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];return new(Function.prototype.bind.apply(_p,[null].concat(W,["oklab"])))},di.format.oklab=vp,di.autodetect.push({p:3,test:function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];if(W=en(W,"oklab"),tn(W)==="array"&&W.length===3)return"oklab"}});var ic=z.unpack,bc=Q1,pc=pi,rn=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];var S=ic(W,"rgb"),I=S[0],$=S[1],H=S[2],k=bc(I,$,H),Q=k[0],J=k[1],n0=k[2];return pc(Q,J,n0)},W2=rn,nn=z.unpack,Np=$r,bn=vp,Tp=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];W=nn(W,"lch");var S=W[0],I=W[1],$=W[2],H=Np(S,I,$),k=H[0],Q=H[1],J=H[2],n0=bn(k,Q,J),b0=n0[0],f0=n0[1],l0=n0[2];return[b0,f0,l0,W.length>3?W[3]:1]},Bp=Tp,pn=z.unpack,Sp=z.type,br=C,h2=T,pr=M,ac=W2;h2.prototype.oklch=function(){return ac(this._rgb)},br.oklch=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];return new(Function.prototype.bind.apply(h2,[null].concat(W,["oklch"])))},pr.format.oklch=Bp,pr.autodetect.push({p:3,test:function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];if(W=pn(W,"oklch"),Sp(W)==="array"&&W.length===3)return"oklch"}});var wp=T,Mc=z.type;wp.prototype.alpha=function(W,_){return _===void 0&&(_=!1),W!==void 0&&Mc(W)==="number"?_?(this._rgb[3]=W,this):new wp([this._rgb[0],this._rgb[1],this._rgb[2],W],"rgb"):this._rgb[3]};var an=T;an.prototype.clipped=function(){return this._rgb._clipped||!1};var Xt=T,ui=kr;Xt.prototype.darken=function(W){W===void 0&&(W=1);var _=this,S=_.lab();return S[0]-=ui.Kn*W,new Xt(S,"lab").alpha(_.alpha(),!0)},Xt.prototype.brighten=function(W){return W===void 0&&(W=1),this.darken(-W)},Xt.prototype.darker=Xt.prototype.darken,Xt.prototype.brighter=Xt.prototype.brighten;var zc=T;zc.prototype.get=function(W){var _=W.split("."),S=_[0],I=_[1],$=this[S]();if(I){var H=S.indexOf(I)-(S.substr(0,2)==="ok"?2:0);if(H>-1)return $[H];throw new Error("unknown channel "+I+" in mode "+S)}else return $};var U2=T,cc=z.type,sc=Math.pow,oe=1e-7,ge=20;U2.prototype.luminance=function(W){if(W!==void 0&&cc(W)==="number"){if(W===0)return new U2([0,0,0,this._rgb[3]],"rgb");if(W===1)return new U2([255,255,255,this._rgb[3]],"rgb");var _=this.luminance(),S="rgb",I=ge,$=function(k,Q){var J=k.interpolate(Q,.5,S),n0=J.luminance();return Math.abs(W-n0)<oe||!I--?J:n0>W?$(k,J):$(J,Q)},H=(_>W?$(new U2([0,0,0]),this):$(this,new U2([255,255,255]))).rgb();return new U2(H.concat([this._rgb[3]]))}return Oc.apply(void 0,this._rgb.slice(0,3))};var Oc=function(W,_,S){return W=fi(W),_=fi(_),S=fi(S),.2126*W+.7152*_+.0722*S},fi=function(W){return W/=255,W<=.03928?W/12.92:sc((W+.055)/1.055,2.4)},Pe={},xp=T,Mn=z.type,m2=Pe,zn=function(W,_,S){S===void 0&&(S=.5);for(var I=[],$=arguments.length-3;$-- >0;)I[$]=arguments[$+3];var H=I[0]||"lrgb";if(!m2[H]&&!I.length&&(H=Object.keys(m2)[0]),!m2[H])throw new Error("interpolation mode "+H+" is not defined");return Mn(W)!=="object"&&(W=new xp(W)),Mn(_)!=="object"&&(_=new xp(_)),m2[H](W,_,S).alpha(W.alpha()+S*(_.alpha()-W.alpha()))},G2=T,ar=zn;G2.prototype.mix=G2.prototype.interpolate=function(W,_){_===void 0&&(_=.5);for(var S=[],I=arguments.length-2;I-- >0;)S[I]=arguments[I+2];return ar.apply(void 0,[this,W,_].concat(S))};var wo=T;wo.prototype.premultiply=function(W){W===void 0&&(W=!1);var _=this._rgb,S=_[3];return W?(this._rgb=[_[0]*S,_[1]*S,_[2]*S,S],this):new wo([_[0]*S,_[1]*S,_[2]*S,S],"rgb")};var xo=T,Xo=kr;xo.prototype.saturate=function(W){W===void 0&&(W=1);var _=this,S=_.lch();return S[1]+=Xo.Kn*W,S[1]<0&&(S[1]=0),new xo(S,"lch").alpha(_.alpha(),!0)},xo.prototype.desaturate=function(W){return W===void 0&&(W=1),this.saturate(-W)};var Xp=T,Cp=z.type;Xp.prototype.set=function(W,_,S){S===void 0&&(S=!1);var I=W.split("."),$=I[0],H=I[1],k=this[$]();if(H){var Q=$.indexOf(H)-($.substr(0,2)==="ok"?2:0);if(Q>-1){if(Cp(_)=="string")switch(_.charAt(0)){case"+":k[Q]+=+_;break;case"-":k[Q]+=+_;break;case"*":k[Q]*=+_.substr(1);break;case"/":k[Q]/=+_.substr(1);break;default:k[Q]=+_}else if(Cp(_)==="number")k[Q]=_;else throw new Error("unsupported value for Color.set");var J=new Xp(k,$);return S?(this._rgb=J._rgb,this):J}throw new Error("unknown channel "+H+" in mode "+$)}else return k};var lc=T,Ac=function(W,_,S){var I=W._rgb,$=_._rgb;return new lc(I[0]+S*($[0]-I[0]),I[1]+S*($[1]-I[1]),I[2]+S*($[2]-I[2]),"rgb")};Pe.rgb=Ac;var dc=T,Co=Math.sqrt,Ct=Math.pow,Ep=function(W,_,S){var I=W._rgb,$=I[0],H=I[1],k=I[2],Q=_._rgb,J=Q[0],n0=Q[1],b0=Q[2];return new dc(Co(Ct($,2)*(1-S)+Ct(J,2)*S),Co(Ct(H,2)*(1-S)+Ct(n0,2)*S),Co(Ct(k,2)*(1-S)+Ct(b0,2)*S),"rgb")};Pe.lrgb=Ep;var x=T,Eo=function(W,_,S){var I=W.lab(),$=_.lab();return new x(I[0]+S*($[0]-I[0]),I[1]+S*($[1]-I[1]),I[2]+S*($[2]-I[2]),"lab")};Pe.lab=Eo;var Mr=T,Ae=function(W,_,S,I){var $,H,k,Q;I==="hsl"?(k=W.hsl(),Q=_.hsl()):I==="hsv"?(k=W.hsv(),Q=_.hsv()):I==="hcg"?(k=W.hcg(),Q=_.hcg()):I==="hsi"?(k=W.hsi(),Q=_.hsi()):I==="lch"||I==="hcl"?(I="hcl",k=W.hcl(),Q=_.hcl()):I==="oklch"&&(k=W.oklch().reverse(),Q=_.oklch().reverse());var J,n0,b0,f0,l0,g0;(I.substr(0,1)==="h"||I==="oklch")&&($=k,J=$[0],b0=$[1],l0=$[2],H=Q,n0=H[0],f0=H[1],g0=H[2]);var y0,H0,C0,G0;return!isNaN(J)&&!isNaN(n0)?(n0>J&&n0-J>180?G0=n0-(J+360):n0<J&&J-n0>180?G0=n0+360-J:G0=n0-J,H0=J+S*G0):isNaN(J)?isNaN(n0)?H0=Number.NaN:(H0=n0,(l0==1||l0==0)&&I!="hsv"&&(y0=f0)):(H0=J,(g0==1||g0==0)&&I!="hsv"&&(y0=b0)),y0===void 0&&(y0=b0+S*(f0-b0)),C0=l0+S*(g0-l0),I==="oklch"?new Mr([C0,y0,H0],I):new Mr([H0,y0,C0],I)},r1=Ae,Dp=function(W,_,S){return r1(W,_,S,"lch")};Pe.lch=Dp,Pe.hcl=Dp;var uc=T,fc=function(W,_,S){var I=W.num(),$=_.num();return new uc(I+S*($-I),"num")};Pe.num=fc;var V2=Ae,qc=function(W,_,S){return V2(W,_,S,"hcg")};Pe.hcg=qc;var Wc=Ae,hc=function(W,_,S){return Wc(W,_,S,"hsi")};Pe.hsi=hc;var mc=Ae,gc=function(W,_,S){return mc(W,_,S,"hsl")};Pe.hsl=gc;var Jt=Ae,yc=function(W,_,S){return Jt(W,_,S,"hsv")};Pe.hsv=yc;var Rc=T,Lc=function(W,_,S){var I=W.oklab(),$=_.oklab();return new Rc(I[0]+S*($[0]-I[0]),I[1]+S*($[1]-I[1]),I[2]+S*($[2]-I[2]),"oklab")};Pe.oklab=Lc;var vc=Ae,_c=function(W,_,S){return vc(W,_,S,"oklch")};Pe.oklch=_c;var mt=T,Nc=z.clip_rgb,qi=Math.pow,Wi=Math.sqrt,hi=Math.PI,Ip=Math.cos,g2=Math.sin,Tc=Math.atan2,Bc=function(W,_,S){_===void 0&&(_="lrgb"),S===void 0&&(S=null);var I=W.length;S||(S=Array.from(new Array(I)).map(function(){return 1}));var $=I/S.reduce(function(H0,C0){return H0+C0});if(S.forEach(function(H0,C0){S[C0]*=$}),W=W.map(function(H0){return new mt(H0)}),_==="lrgb")return gt(W,S);for(var H=W.shift(),k=H.get(_),Q=[],J=0,n0=0,b0=0;b0<k.length;b0++)if(k[b0]=(k[b0]||0)*S[0],Q.push(isNaN(k[b0])?0:S[0]),_.charAt(b0)==="h"&&!isNaN(k[b0])){var f0=k[b0]/180*hi;J+=Ip(f0)*S[0],n0+=g2(f0)*S[0]}var l0=H.alpha()*S[0];W.forEach(function(H0,C0){var G0=H0.get(_);l0+=H0.alpha()*S[C0+1];for(var p1=0;p1<k.length;p1++)if(!isNaN(G0[p1]))if(Q[p1]+=S[C0+1],_.charAt(p1)==="h"){var ze=G0[p1]/180*hi;J+=Ip(ze)*S[C0+1],n0+=g2(ze)*S[C0+1]}else k[p1]+=G0[p1]*S[C0+1]});for(var g0=0;g0<k.length;g0++)if(_.charAt(g0)==="h"){for(var y0=Tc(n0/Q[g0],J/Q[g0])/hi*180;y0<0;)y0+=360;for(;y0>=360;)y0-=360;k[g0]=y0}else k[g0]=k[g0]/Q[g0];return l0/=I,new mt(k,_).alpha(l0>.99999?1:l0,!0)},gt=function(W,_){for(var S=W.length,I=[0,0,0,0],$=0;$<W.length;$++){var H=W[$],k=_[$]/S,Q=H._rgb;I[0]+=qi(Q[0],2)*k,I[1]+=qi(Q[1],2)*k,I[2]+=qi(Q[2],2)*k,I[3]+=Q[3]*k}return I[0]=Wi(I[0]),I[1]=Wi(I[1]),I[2]=Wi(I[2]),I[3]>.9999999&&(I[3]=1),new mt(Nc(I))},yt=C,Do=z.type,Sc=Math.pow,mi=function(W){var _="rgb",S=yt("#ccc"),I=0,$=[0,1],H=[],k=[0,0],Q=!1,J=[],n0=!1,b0=0,f0=1,l0=!1,g0={},y0=!0,H0=1,C0=function(A0){if(A0=A0||["#fff","#000"],A0&&Do(A0)==="string"&&yt.brewer&&yt.brewer[A0.toLowerCase()]&&(A0=yt.brewer[A0.toLowerCase()]),Do(A0)==="array"){A0.length===1&&(A0=[A0[0],A0[0]]),A0=A0.slice(0);for(var S0=0;S0<A0.length;S0++)A0[S0]=yt(A0[S0]);H.length=0;for(var Y0=0;Y0<A0.length;Y0++)H.push(Y0/(A0.length-1))}return xe(),J=A0},G0=function(A0){if(Q!=null){for(var S0=Q.length-1,Y0=0;Y0<S0&&A0>=Q[Y0];)Y0++;return Y0-1}return 0},p1=function(A0){return A0},ze=function(A0){return A0},$1=function(A0,S0){var Y0,j0;if(S0==null&&(S0=!1),isNaN(A0)||A0===null)return S;if(S0)j0=A0;else if(Q&&Q.length>2){var de=G0(A0);j0=de/(Q.length-2)}else f0!==b0?j0=(A0-b0)/(f0-b0):j0=1;j0=ze(j0),S0||(j0=p1(j0)),H0!==1&&(j0=Sc(j0,H0)),j0=k[0]+j0*(1-k[0]-k[1]),j0=Math.min(1,Math.max(0,j0));var a1=Math.floor(j0*1e4);if(y0&&g0[a1])Y0=g0[a1];else{if(Do(J)==="array")for(var n1=0;n1<H.length;n1++){var O1=H[n1];if(j0<=O1){Y0=J[n1];break}if(j0>=O1&&n1===H.length-1){Y0=J[n1];break}if(j0>O1&&j0<H[n1+1]){j0=(j0-O1)/(H[n1+1]-O1),Y0=yt.interpolate(J[n1],J[n1+1],j0,_);break}}else Do(J)==="function"&&(Y0=J(j0));y0&&(g0[a1]=Y0)}return Y0},xe=function(){return g0={}};C0(W);var o1=function(A0){var S0=yt($1(A0));return n0&&S0[n0]?S0[n0]():S0};return o1.classes=function(A0){if(A0!=null){if(Do(A0)==="array")Q=A0,$=[A0[0],A0[A0.length-1]];else{var S0=yt.analyze($);A0===0?Q=[S0.min,S0.max]:Q=yt.limits(S0,"e",A0)}return o1}return Q},o1.domain=function(A0){if(!arguments.length)return $;b0=A0[0],f0=A0[A0.length-1],H=[];var S0=J.length;if(A0.length===S0&&b0!==f0)for(var Y0=0,j0=Array.from(A0);Y0<j0.length;Y0+=1){var de=j0[Y0];H.push((de-b0)/(f0-b0))}else{for(var a1=0;a1<S0;a1++)H.push(a1/(S0-1));if(A0.length>2){var n1=A0.map(function(z1,q1){return q1/(A0.length-1)}),O1=A0.map(function(z1){return(z1-b0)/(f0-b0)});O1.every(function(z1,q1){return n1[q1]===z1})||(ze=function(z1){if(z1<=0||z1>=1)return z1;for(var q1=0;z1>=O1[q1+1];)q1++;var Rt=(z1-O1[q1])/(O1[q1+1]-O1[q1]),R2=n1[q1]+Rt*(n1[q1+1]-n1[q1]);return R2})}}return $=[b0,f0],o1},o1.mode=function(A0){return arguments.length?(_=A0,xe(),o1):_},o1.range=function(A0,S0){return C0(A0),o1},o1.out=function(A0){return n0=A0,o1},o1.spread=function(A0){return arguments.length?(I=A0,o1):I},o1.correctLightness=function(A0){return A0==null&&(A0=!0),l0=A0,xe(),l0?p1=function(S0){for(var Y0=$1(0,!0).lab()[0],j0=$1(1,!0).lab()[0],de=Y0>j0,a1=$1(S0,!0).lab()[0],n1=Y0+(j0-Y0)*S0,O1=a1-n1,z1=0,q1=1,Rt=20;Math.abs(O1)>.01&&Rt-- >0;)(function(){return de&&(O1*=-1),O1<0?(z1=S0,S0+=(q1-S0)*.5):(q1=S0,S0+=(z1-S0)*.5),a1=$1(S0,!0).lab()[0],O1=a1-n1})();return S0}:p1=function(S0){return S0},o1},o1.padding=function(A0){return A0!=null?(Do(A0)==="number"&&(A0=[A0,A0]),k=A0,o1):k},o1.colors=function(A0,S0){arguments.length<2&&(S0="hex");var Y0=[];if(arguments.length===0)Y0=J.slice(0);else if(A0===1)Y0=[o1(.5)];else if(A0>1){var j0=$[0],de=$[1]-j0;Y0=wc(0,A0).map(function(q1){return o1(j0+q1/(A0-1)*de)})}else{W=[];var a1=[];if(Q&&Q.length>2)for(var n1=1,O1=Q.length,z1=1<=O1;z1?n1<O1:n1>O1;z1?n1++:n1--)a1.push((Q[n1-1]+Q[n1])*.5);else a1=$;Y0=a1.map(function(q1){return o1(q1)})}return yt[S0]&&(Y0=Y0.map(function(q1){return q1[S0]()})),Y0},o1.cache=function(A0){return A0!=null?(y0=A0,o1):y0},o1.gamma=function(A0){return A0!=null?(H0=A0,o1):H0},o1.nodata=function(A0){return A0!=null?(S=yt(A0),o1):S},o1};function wc(W,_,S){for(var I=[],$=W<_,H=_,k=W;$?k<H:k>H;$?k++:k--)I.push(k);return I}var Io=T,Pp=mi,xc=function(W){for(var _=[1,1],S=1;S<W;S++){for(var I=[1],$=1;$<=_.length;$++)I[$]=(_[$]||0)+_[$-1];_=I}return _},Xc=function(W){var _,S,I,$,H,k,Q;if(W=W.map(function(l0){return new Io(l0)}),W.length===2)_=W.map(function(l0){return l0.lab()}),H=_[0],k=_[1],$=function(l0){var g0=[0,1,2].map(function(y0){return H[y0]+l0*(k[y0]-H[y0])});return new Io(g0,"lab")};else if(W.length===3)S=W.map(function(l0){return l0.lab()}),H=S[0],k=S[1],Q=S[2],$=function(l0){var g0=[0,1,2].map(function(y0){return(1-l0)*(1-l0)*H[y0]+2*(1-l0)*l0*k[y0]+l0*l0*Q[y0]});return new Io(g0,"lab")};else if(W.length===4){var J;I=W.map(function(l0){return l0.lab()}),H=I[0],k=I[1],Q=I[2],J=I[3],$=function(l0){var g0=[0,1,2].map(function(y0){return(1-l0)*(1-l0)*(1-l0)*H[y0]+3*(1-l0)*(1-l0)*l0*k[y0]+3*(1-l0)*l0*l0*Q[y0]+l0*l0*l0*J[y0]});return new Io(g0,"lab")}}else if(W.length>=5){var n0,b0,f0;n0=W.map(function(l0){return l0.lab()}),f0=W.length-1,b0=xc(f0),$=function(l0){var g0=1-l0,y0=[0,1,2].map(function(H0){return n0.reduce(function(C0,G0,p1){return C0+b0[p1]*Math.pow(g0,f0-p1)*Math.pow(l0,p1)*G0[H0]},0)});return new Io(y0,"lab")}}else throw new RangeError("No point in running bezier with only one color.");return $},gi=function(W){var _=Xc(W);return _.scale=function(){return Pp(_)},_},H2=C,Fe=function(W,_,S){if(!Fe[S])throw new Error("unknown blend mode "+S);return Fe[S](W,_)},y2=function(W){return function(_,S){var I=H2(S).rgb(),$=H2(_).rgb();return H2.rgb(W(I,$))}},e2=function(W){return function(_,S){var I=[];return I[0]=W(_[0],S[0]),I[1]=W(_[1],S[1]),I[2]=W(_[2],S[2]),I}},Cc=function(W){return W},t2=function(W,_){return W*_/255},yi=function(W,_){return W>_?_:W},Y2=function(W,_){return W>_?W:_},at=function(W,_){return 255*(1-(1-W/255)*(1-_/255))},Ec=function(W,_){return _<128?2*W*_/255:255*(1-2*(1-W/255)*(1-_/255))},Fp=function(W,_){return 255*(1-(1-_/255)/(W/255))},kp=function(W,_){return W===255?255:(W=255*(_/255)/(1-W/255),W>255?255:W)};Fe.normal=y2(e2(Cc)),Fe.multiply=y2(e2(t2)),Fe.screen=y2(e2(at)),Fe.overlay=y2(e2(Ec)),Fe.darken=y2(e2(yi)),Fe.lighten=y2(e2(Y2)),Fe.dodge=y2(e2(kp)),Fe.burn=y2(e2(Fp));for(var zr=Fe,Et=z.type,jp=z.clip_rgb,Dc=z.TWOPI,cn=Math.pow,Ic=Math.sin,$p=Math.cos,Me=C,Ri=function(W,_,S,I,$){W===void 0&&(W=300),_===void 0&&(_=-1.5),S===void 0&&(S=1),I===void 0&&(I=1),$===void 0&&($=[0,1]);var H=0,k;Et($)==="array"?k=$[1]-$[0]:(k=0,$=[$,$]);var Q=function(J){var n0=Dc*((W+120)/360+_*J),b0=cn($[0]+k*J,I),f0=H!==0?S[0]+J*H:S,l0=f0*b0*(1-b0)/2,g0=$p(n0),y0=Ic(n0),H0=b0+l0*(-.14861*g0+1.78277*y0),C0=b0+l0*(-.29227*g0-.90649*y0),G0=b0+l0*(1.97294*g0);return Me(jp([H0*255,C0*255,G0*255,1]))};return Q.start=function(J){return J==null?W:(W=J,Q)},Q.rotations=function(J){return J==null?_:(_=J,Q)},Q.gamma=function(J){return J==null?I:(I=J,Q)},Q.hue=function(J){return J==null?S:(S=J,Et(S)==="array"?(H=S[1]-S[0],H===0&&(S=S[1])):H=0,Q)},Q.lightness=function(J){return J==null?$:(Et(J)==="array"?($=J,k=J[1]-J[0]):($=[J,J],k=0),Q)},Q.scale=function(){return Me.scale(Q)},Q.hue(S),Q},Up=T,Dt="0123456789abcdef",Li=Math.floor,sn=Math.random,K2=function(){for(var W="#",_=0;_<6;_++)W+=Dt.charAt(Li(sn()*16));return new Up(W,"hex")},On=y,ye=Math.log,vi=Math.pow,Pc=Math.floor,Fc=Math.abs,Gp=function(W,_){_===void 0&&(_=null);var S={min:Number.MAX_VALUE,max:Number.MAX_VALUE*-1,sum:0,values:[],count:0};return On(W)==="object"&&(W=Object.values(W)),W.forEach(function(I){_&&On(I)==="object"&&(I=I[_]),I!=null&&!isNaN(I)&&(S.values.push(I),S.sum+=I,I<S.min&&(S.min=I),I>S.max&&(S.max=I),S.count+=1)}),S.domain=[S.min,S.max],S.limits=function(I,$){return ln(S,I,$)},S},ln=function(W,_,S){_===void 0&&(_="equal"),S===void 0&&(S=7),On(W)=="array"&&(W=Gp(W));var I=W.min,$=W.max,H=W.values.sort(function(xi,Xi){return xi-Xi});if(S===1)return[I,$];var k=[];if(_.substr(0,1)==="c"&&(k.push(I),k.push($)),_.substr(0,1)==="e"){k.push(I);for(var Q=1;Q<S;Q++)k.push(I+Q/S*($-I));k.push($)}else if(_.substr(0,1)==="l"){if(I<=0)throw new Error("Logarithmic scales are only possible for values > 0");var J=Math.LOG10E*ye(I),n0=Math.LOG10E*ye($);k.push(I);for(var b0=1;b0<S;b0++)k.push(vi(10,J+b0/S*(n0-J)));k.push($)}else if(_.substr(0,1)==="q"){k.push(I);for(var f0=1;f0<S;f0++){var l0=(H.length-1)*f0/S,g0=Pc(l0);if(g0===l0)k.push(H[g0]);else{var y0=l0-g0;k.push(H[g0]*(1-y0)+H[g0+1]*y0)}}k.push($)}else if(_.substr(0,1)==="k"){var H0,C0=H.length,G0=new Array(C0),p1=new Array(S),ze=!0,$1=0,xe=null;xe=[],xe.push(I);for(var o1=1;o1<S;o1++)xe.push(I+o1/S*($-I));for(xe.push($);ze;){for(var A0=0;A0<S;A0++)p1[A0]=0;for(var S0=0;S0<C0;S0++)for(var Y0=H[S0],j0=Number.MAX_VALUE,de=void 0,a1=0;a1<S;a1++){var n1=Fc(xe[a1]-Y0);n1<j0&&(j0=n1,de=a1),p1[de]++,G0[S0]=de}for(var O1=new Array(S),z1=0;z1<S;z1++)O1[z1]=null;for(var q1=0;q1<C0;q1++)H0=G0[q1],O1[H0]===null?O1[H0]=H[q1]:O1[H0]+=H[q1];for(var Rt=0;Rt<S;Rt++)O1[Rt]*=1/p1[Rt];ze=!1;for(var R2=0;R2<S;R2++)if(O1[R2]!==xe[R2]){ze=!0;break}xe=O1,$1++,$1>200&&(ze=!1)}for(var r2={},Q2=0;Q2<S;Q2++)r2[Q2]=[];for(var Fo=0;Fo<C0;Fo++)H0=G0[Fo],r2[H0].push(H[Fo]);for(var It=[],L2=0;L2<S;L2++)It.push(r2[L2][0]),It.push(r2[L2][r2[L2].length-1]);It=It.sort(function(xi,Xi){return xi-Xi}),k.push(It[0]);for(var ce=1;ce<It.length;ce+=2){var Re=It[ce];!isNaN(Re)&&k.indexOf(Re)===-1&&k.push(Re)}}return k},Vp={analyze:Gp,limits:ln},Po=T,Hp=function(W,_){W=new Po(W),_=new Po(_);var S=W.luminance(),I=_.luminance();return S>I?(S+.05)/(I+.05):(I+.05)/(S+.05)},Yp=T,o2=Math.sqrt,w1=Math.pow,kc=Math.min,jc=Math.max,An=Math.atan2,_i=Math.abs,dn=Math.cos,Kp=Math.sin,$c=Math.exp,Ni=Math.PI,Ti=function(W,_,S,I,$){S===void 0&&(S=1),I===void 0&&(I=1),$===void 0&&($=1);var H=function(Re){return 360*Re/(2*Ni)},k=function(Re){return 2*Ni*Re/360};W=new Yp(W),_=new Yp(_);var Q=Array.from(W.lab()),J=Q[0],n0=Q[1],b0=Q[2],f0=Array.from(_.lab()),l0=f0[0],g0=f0[1],y0=f0[2],H0=(J+l0)/2,C0=o2(w1(n0,2)+w1(b0,2)),G0=o2(w1(g0,2)+w1(y0,2)),p1=(C0+G0)/2,ze=.5*(1-o2(w1(p1,7)/(w1(p1,7)+w1(25,7)))),$1=n0*(1+ze),xe=g0*(1+ze),o1=o2(w1($1,2)+w1(b0,2)),A0=o2(w1(xe,2)+w1(y0,2)),S0=(o1+A0)/2,Y0=H(An(b0,$1)),j0=H(An(y0,xe)),de=Y0>=0?Y0:Y0+360,a1=j0>=0?j0:j0+360,n1=_i(de-a1)>180?(de+a1+360)/2:(de+a1)/2,O1=1-.17*dn(k(n1-30))+.24*dn(k(2*n1))+.32*dn(k(3*n1+6))-.2*dn(k(4*n1-63)),z1=a1-de;z1=_i(z1)<=180?z1:a1<=de?z1+360:z1-360,z1=2*o2(o1*A0)*Kp(k(z1)/2);var q1=l0-J,Rt=A0-o1,R2=1+.015*w1(H0-50,2)/o2(20+w1(H0-50,2)),r2=1+.045*S0,Q2=1+.015*S0*O1,Fo=30*$c(-w1((n1-275)/25,2)),It=2*o2(w1(S0,7)/(w1(S0,7)+w1(25,7))),L2=-It*Kp(2*k(Fo)),ce=o2(w1(q1/(S*R2),2)+w1(Rt/(I*r2),2)+w1(z1/($*Q2),2)+L2*(Rt/(I*r2))*(z1/($*Q2)));return jc(0,kc(100,ce))},Qp=T,Bi=function(W,_,S){S===void 0&&(S="lab"),W=new Qp(W),_=new Qp(_);var I=W.get(S),$=_.get(S),H=0;for(var k in I){var Q=(I[k]||0)-($[k]||0);H+=Q*Q}return Math.sqrt(H)},Zp=T,Jp=function(){for(var W=[],_=arguments.length;_--;)W[_]=arguments[_];try{return new(Function.prototype.bind.apply(Zp,[null].concat(W))),!0}catch{return!1}},Si=C,cr=mi,Uc={cool:function(){return cr([Si.hsl(180,1,.9),Si.hsl(250,.7,.4)])},hot:function(){return cr(["#000","#f00","#ff0","#fff"]).mode("rgb")}},sr={OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],Viridis:["#440154","#482777","#3f4a8a","#31678e","#26838f","#1f9d8a","#6cce5a","#b6de2b","#fee825"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],Set2:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],Accent:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],Set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],Set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],Dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Paired:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],Pastel2:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],Pastel1:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},un=0,ea=Object.keys(sr);un<ea.length;un+=1){var wi=ea[un];sr[wi.toLowerCase()]=sr[wi]}var Gc=sr,Z1=C;Z1.average=Bc,Z1.bezier=gi,Z1.blend=zr,Z1.cubehelix=Ri,Z1.mix=Z1.interpolate=zn,Z1.random=K2,Z1.scale=mi,Z1.analyze=Vp.analyze,Z1.contrast=Hp,Z1.deltaE=Ti,Z1.distance=Bi,Z1.limits=Vp.limits,Z1.valid=Jp,Z1.scales=Uc,Z1.colors=zi,Z1.brewer=Gc;var ta=Z1;return ta})})(kN);const Qo=350,jN=52,$N={colors:["#feae4a","#5fbaff","#e15e9d"],detail:"minimal",fontFamily:"Inter, sans-serif",rowLimit:6,fontSize:"0.65rem"},UN=t=>({displayTitle:t,colSpan:12}),UO=t=>"displayTitle"in t,Wr=t=>({colSpan:t,isEmpty:!0}),GN=12,VN=(t,e)=>({components:t,height:e}),Uu=t=>"isEmpty"in t,HN=t=>{const e=[...t],o=P0.sumBy(e,n=>n.colSpan);return o==12||(e[e.length-1].colSpan+=12-o),e},YN=t=>"components"in t?t:{components:t,height:Qo},KN=t=>!(t&&Uu(t)&&t.colSpan<=0),QN=(t,e)=>{const o=YN(t),n=v=>v&&v.colSpan<=0?{...v,colSpan:1}:v,b=o.components.filter(KN).map(n),a=P0.sumBy(b,v=>v==null?1:0),A=12-P0.sumBy(b,v=>v==null?0:v.colSpan),c=Math.floor(A/a),y=[...b].map(v=>v===null?{isEmpty:!0,colSpan:c}:Uu(v)||UO(v)?v:Gu({...v,colSpan:v.colSpan},e));return{components:HN(y),height:o.height||Qo}},ZN=(t,e)=>t.map(o=>QN(o,e)),Gu=(t,e)=>{if("isEmpty"in t||UO(t))return t;const{load:o}=ib(t.attributes.type,e),n=o(t.attributes);let b=[];return P0.isArray(t.localFilters)&&(b=[...t.localFilters?t.localFilters:[]].map(a=>jd(a))),"addOns"in t.attributes&&P0.isEmpty(b)&&t.attributes.addOns.forEach(a=>{b=[...b,{type:a.type=="dateFilter"?"dateFilter":"singleSelectFilter",value:null,requiresValue:!1,managedByConfiguration:!1,appliesToFields:[{fieldId:a.field,dataSetId:n.dataSetId}]}]}),delete t.addOns,delete n.addOns,delete n.results,{...t,localFilters:b,attributes:n}},JN=(t,e)=>{if(!t.attributes)throw new Error("Component attributes are required in saveable");return{attributes:{...t.attributes,protectedByOrganisation:e?!0:void 0},localFilters:t.localFilters??[],colSpan:1,reports:[]}},Vu=t=>R.alternatives().conditional(".type",{is:"barChart",then:ru(t).schema}).conditional(".type",{is:"richText",then:Eu(t).schema}).conditional(".type",{is:"mercatorMap",then:Tu(t).schema}).conditional(".type",{is:"horizontalBarChart",then:mu(t).schema}).conditional(".type",{is:"lineChart",then:Lu(t).schema}).conditional(".type",{is:"lineChartV2",then:_u(t).schema}).conditional(".type",{is:"barChartV2",then:iu(t).schema}).conditional(".type",{is:"areaChartV2",then:ou(t).schema}).conditional(".type",{is:"comboChartV2",then:uu(t).schema}).conditional(".type",{is:"comboChart",then:Au(t).schema}).conditional(".type",{is:"areaChart",then:eu(t).schema}).conditional(".type",{is:"pieChart",then:Bu(t).schema}).conditional(".type",{is:"bubbleChart",then:zu(t).schema}).conditional(".type",{is:"bubbleChartV2",then:su(t).schema}).conditional(".type",{is:"sunburstChart",then:Fu(t).schema}).conditional(".type",{is:"scatterChart",then:Iu(t).schema}).conditional(".type",{is:"singleStat",then:Pu(t).schema}).conditional(".type",{is:"dataTable",then:Wu(t).schema}).conditional(".type",{is:"basicTable",then:au(t).schema}).conditional(".type",{is:"progress",then:wu(t).schema}).conditional(".type",{is:"custom",then:fu(t).schema}).conditional(".type",{is:"funnelChart",then:hu(t).schema}).conditional(".type",{is:"waterfallChart",then:ju(t).schema}).conditional(".type",{is:"radarChart",then:Xu(t).schema}).conditional(".type",{is:"horizontalBarChartV2",then:yu(t).schema}),e7=R.object({displayTitle:R.string().min(1).required(),colSpan:R.number().valid(12).required()}),GO=R.number().min(1).max(12).required().messages({"number.base":'"colSpan" must be a number',"number.min":'"colSpan" must be at least {#limit}',"number.max":'"colSpan" must be less than or equal to {#limit}',"any.required":'"colSpan" is a required field'}),t7=R.object({isEmpty:R.valid(!0).required(),colSpan:GO}),o7=t=>R.object({attributes:Vu({queryEngineConfig:t}),colSpan:GO}),Hu=t=>R.object({id:R.string(),display:r7(t),componentLibrary:R.array().required().items(R.object({attributes:Vu({queryEngineConfig:t})})),globalFilters:FN(t),customFields:R.object().required()});function r7(t){return R.array().required().items(R.object({height:R.number().required(),components:R.array().required().min(1).items(R.alternatives(t7,o7(t),e7))}))}const n7=1,Bs=(t,e)=>{const o=e?{queryEngineConfig:e}:void 0;if(typeof t.definition=="string")throw new Error("Dashboard is an encrypted string, use the query engine to fetch the dashboard. Please use the queryEngineConfig prop to pass the query engine configuration.");return{id:t.id,parentDashboardId:t.parent_dashboard_id,isPlayground:!1,permission:t.permission,name:t.name,globalFilters:a_(t.definition.globalFilters,o),componentLibrary:[...t.definition.componentLibrary||[]].map(n=>Gu({...n,colSpan:n?.colSpan||n7},o)),theme:{...$N,...t.theme},display:ZN(t.definition.display,o),webhookId:t.webhook_id||null,createdAt:new Date(t.created_at),updatedAt:new Date(t.updated_at),metadata:t.metadata||{}}},Pa=(t,e,o)=>({...t,dataSets:D_(e,o)}),i7=t=>({isPlayground:!1,display:[{components:[Wr(8),Wr(4)],height:Qo},{components:[Wr(4),Wr(4),Wr(4)],height:Qo}],componentLibrary:[],globalFilters:[],customFields:{},...t}),b7=(t,e)=>{let o=[];return t.map(n=>{if(n.id===void 0)throw new Error("Dashboard id is undefined");const b=Pa(n,e,n.customFields||{});o.push({id:b.id,dataSets:b.dataSets,display:b.display??[],globalFilters:[],componentLibrary:b.componentLibrary||[],parentDashboardId:null,metadata:{},theme:{},webhookId:"",isPlayground:!1,createdAt:new Date,updatedAt:new Date,isProgrammatic:!0})}),o},p7="vizzly_editor",a7=(t,e)=>{if(e.length>0&&e[0].id===p7)return[...t,{...e[0],parentDashboardId:t[0].id,isProgrammatic:!0,permission:t[0].permission}]};function M7(t,e){const o=a7(t,e);if(o)return o;const n=new Map(e.map(b=>[b.id,b]));return t.map(b=>{const a=n.get(b.id);if(b.parentDashboardId!==null){const O=n.get(b.parentDashboardId);if(O?.id===b.parentDashboardId)return{...b,componentLibrary:z7(O?.componentLibrary,b.componentLibrary)}}return a??b})}const z7=(t,e)=>{const o=new Map;return t.forEach(b=>{const a=b.attributes.viewId;o.set(a??"",b)}),e.forEach(b=>{const a=b.attributes.viewId;o.has(a??"")||o.set(a??"",b)}),Array.from(o.values())},kl=(t,e)=>{let o=[];return t.globalFilters.forEach(n=>{n.appliesToFields.forEach(b=>{try{const a=T2(e,b.dataSetId);if(!a){G1("Did not find data set when finding field usage",b.dataSetId);return}const O=dt(a,b.fieldId);o=[...o,{data_set_id:b.dataSetId,field_id:b.fieldId,function:"none",name:O.publicName}]}catch(a){a instanceof Ya?G1(`Did not find field in data set, assuming custom metric. ${b.fieldId}`):At(a);return}})}),t.display.forEach(n=>{n.components.forEach(b=>{if(!("attributes"in b))return;const a=T2(e,b.attributes.dataSetId);if(!a){G1("Did not find field in data set, assuming custom metric. ",b.attributes.dataSetId);return}let O=Jd(b.attributes).flatMap(A=>{try{const c=dt(a,A.fieldId);return[{data_set_id:A.dataSetId,field_id:A.fieldId,function:A.function,name:c.publicName}]}catch(c){c instanceof Ya?G1(`Did not find field in data set, assuming custom metric. ${A.fieldId}`):At(c)}return[]});o=[...o,...O]})}),{fields:o}},c7=t=>({id:t.id,name:t.name,library:t.library,createdAt:new Date(t.created_at),updatedAt:new Date(t.updated_at),parentGlobalLibraryId:t.parent_global_library_id});function s7(t,e){return t.find(o=>o.scope==="read_write"&&e[0].id===o.globalLibraryId)?.token||""}function O7(t,e,o){const n=VO(t);if(!n)throw new Error("No matching library found.");return(!n.library.views||!n.library.customFields)&&u7(n),A7(n.library.views,e),l7(o,n),n}function l7(t,e){if(!t)throw new Error("View object needs initialised");for(const o in t)t.hasOwnProperty(o)&&e.library.customFields?.hasOwnProperty(o)&&(e.library.customFields[o]=t[o])}function A7(t,e){if(!t)throw new Error("View array needs initialised");const o=t.findIndex(n=>n.attributes.viewId===e?.attributes.viewId);o!==-1?t[o]=e:t.push(e)}const d7=(t,e)=>{const o=VO(t);if(!o)throw new Error("No matching library found.");return o.library.views?o.library.views=o.library.views.filter(n=>n.attributes.viewId!==e.attributes.viewId):o.library.views=[],o};function VO(t){const e=t.find(o=>t.some(n=>n.id===o.parentGlobalLibraryId))||t.find(o=>o.parentGlobalLibraryId===null);if(!e)throw new Error("No matching library found.");return e}const u7=t=>{t.library.views=[],t.library.customFields={}},f7=t=>[...t].filter(e=>e.parentGlobalLibraryId!==null),q7=t=>[...t].find(e=>e.parentGlobalLibraryId===null);class Ss extends Error{constructor(e){super(e),this.name="FailedToLoadQueryEngineConfig"}}class ws extends Error{invalidEndpoint;constructor(e){super(`The queryEngineEndpoint value '${e}' is not valid.`),this.name="InvalidQueryEngineEndpoint",this.invalidEndpoint=e}}class jl extends Error{constructor(){super("The queryEngineEndpoint value is not of the correct type. It must be a string or a function."),this.name="InvalidQueryEngineEndpointType"}}const iM=t=>t.startsWith("/")?iM(t.slice(1)):t.endsWith("/")?iM(t.slice(0,-1)):t,W7=t=>t.startsWith("https://")||t.startsWith("http://")||t.startsWith("."),h7=(t,e)=>{const o=iM(t),n=iM(e),b=W7(t)?"":"/";return o==""&&n==""?"/":n==""?`${b}${o}`:o!=""&&n!=""?`${b}${o}/${n}`:`${b}${n}`},m7=t=>t.split("#vizzly_")[1]||null,g7=t=>async(e,o,n)=>{let b={};o&&(b.auth=`Bearer ${o}`);let a="";n&&(a=`filter=${n.join(",")}`);const{status:O,body:A}=await t({path:`/api/v2/auth/project/${e}/access_token?${a}`,method:"get",headers:b});if(O==200)return A.token.token},y7=async(t,e)=>{if(t.dashboardAccessToken)return G1("Using dashboard access token for auth header"),{auth:`Bearer ${t.dashboardAccessToken}`};if(t.projectAccessToken)return G1("Using project access token for auth header"),{auth:`Bearer ${t.projectAccessToken}`};if(t.apiKey)return G1("Using API Key for auth header"),{auth:`Api-Key ${t.apiKey}`};if(e.preFetchProjectAccessTokens&&(t.useCookieAuth||t.appSessionAuthToken)){G1("Fetching project access token from the Vizzly API",e.preFetchProjectAccessTokens.projectId,"Filtering by",e.preFetchProjectAccessTokens.resourceFilters);const o=await g7(Yu(t))(e.preFetchProjectAccessTokens.projectId,t.appSessionAuthToken,e.preFetchProjectAccessTokens.resourceFilters);if(o)return G1("Project access token received."),{auth:`Bearer ${o}`};G1("Failed to receive project access token.")}else G1("Not pre-fetching project access token.");return{}},Yu=t=>async e=>{try{const o=await y7(t,e),n=e.headers||{},b=h7(t.host,e.path),a=await dh(b,{method:e.method,headers:{"Content-Type":"application/json",Accept:"application/json",...o,...n},redirect:"follow",referrerPolicy:"no-referrer",body:e.body?JSON.stringify(e.body):null,signal:e.abortSignal,mode:e.mode||void 0});let O=await a.json();return G1("HTTP Client Response",{host:t.host,path:e.path,status:a.status,responseId:a.headers.get("X-Request-Id")}),{body:O,status:a.status,headers:a.headers}}catch(o){if(e.abortSignal?.aborted)return console.log("Aborted a request."),{status:500,body:{reason:"Aborted"},headers:null};throw o}},R7=t=>typeof t=="string"?t:t.endpoint,L7=t=>typeof t=="string"?{}:t.customHeaders?t.customHeaders():{},v7=()=>{if(typeof window>"u")return{};const t=window?.VizzlyDev?.getServerLogLevel?window?.VizzlyDev?.getServerLogLevel():void 0;return t?{"vizzly-log-level":t}:{}},HO=t=>async e=>{const o={host:R7(t)},n={...e,headers:{"vizzly-query-engine-request-id":$d(),...e.headers,...L7(t),...v7()}};return Yu(o)(n)},_7=t=>"supportedFeatures"in t?t:{...t,supportedFeatures:["subquery"]},N7=async t=>{const o=await HO(t)({method:"post",mode:"cors",path:"/api/v1/support",body:{frontendFeatures:["formatter:monthOfYearOnly"]}});return o.status==200?_7(o.body):null},bM=Ut.QueryEngineConfig.getQueryEngineConfig("js"),$l=t=>{let e=typeof t=="string"?t:t.endpoint;return!!(e.startsWith("http://")||e.startsWith("https://")||e.startsWith("/"))},T7=async(t,e)=>{try{if(t==="in-browser")return bM;if(typeof t=="function"){let o=await t();if(!o)throw new Ss("Failed to load query engine config.");return{...o}}else if(e){if(!$l(t))throw new ws(t);return bM}else if(typeof t=="string"||typeof t=="object"&&"endpoint"in t){if(!$l(t))throw new ws(t);const o=await N7(t);if(!o)throw new Ss("Failed to load query engine config.");return o}else throw new jl}catch(o){throw At(o),o instanceof ws||o instanceof jl?o:new Ss("Failed to load query engine config.")}};class B7 extends Error{constructor(e){super(e),this.name="FailedToLoadIdentity"}}class Ul extends Error{constructor(e){super(e),this.name="InvalidIdentityReturn"}}const S7="_vizzlyDashboardAdmin",w7=t=>{let e=m7(t);return e||new URLSearchParams(new URL(t).search).get(S7)||null},x7=t=>typeof window=="object"&&window&&window.atob?window.atob(t):Buffer.from(t,"base64").toString(),X7=t=>{const e=t.split(".")?.[1];return JSON.parse(x7(e).toString())},xa=t=>({...X7(t),signature:t}),C7=(t,e,o,n)=>{let b=xa(t);"scope"in b||(b.scope="read_write");const a={dashboardAccess:b,dataAccess:e?xa(e):void 0,queryEngineAccessConfig:o?xa(o):void 0,dashboardAdminOverride:n?xa(n):void 0};return D7(a),a},E7=t=>["accessType","dashboardId","projectId","userReference","scope"].map(o=>`${o}:${t[o]}`).join(":::"),D7=t=>{const e=new Date,o=new Date(t.dashboardAccess.expires),n=t.dataAccess?new Date(t.dataAccess.expires):!1;n!==!1&&n<e&&console.warn("Vizzly data access token expired at;",n),o<e&&console.warn("Vizzly dashboard access token expired at;",o)},I7=t=>{if(!t)throw new Ul("Failed to load identity.");const{error:e}=R.object({dashboardAccessToken:R.string().required(),dataAccessToken:R.string(),queryEngineAccessToken:R.string(),projectAccessToken:R.string().optional()}).validate(t);if(e)throw new Ul(e.message);return t},P7=async t=>{let e=await t();if(e=I7(e),!e)throw new B7("Failed to fetch identity config.");const o=F7()?w7(window.location.href):null;return{identityConfig:C7(e.dashboardAccessToken,e.dataAccessToken,e.queryEngineAccessToken,o),tokens:e}},F7=()=>typeof window<"u",xs=[{namespace:"config.supported_operator",constants:NA},{namespace:"config.supported_aggregate",constants:TA},{namespace:"config.supported_time",constants:W6}],Xs=(t,e,o)=>{const n={};return Object.entries(t).forEach(([b,a])=>{n[b]={...a,publicName:e(`${o}.${b}`,a.publicName)}}),n},k7=(t,e)=>{const o={...t};return o.supportedAggregates&&(o.supportedAggregates=Xs(o.supportedAggregates,e,xs[1].namespace)),o.supportedTimeTruncFunctions&&(o.supportedTimeTruncFunctions=Xs(o.supportedTimeTruncFunctions,e,xs[2].namespace)),o.supportedOperators&&(o.supportedOperators=Xs(o.supportedOperators,e,xs[0].namespace)),o};class j7 extends Error{constructor(){super("Identity prop type is invalid."),this.name="InvalidIdentityPropType"}}class Fa extends Error{constructor(e){super(e),this.name="FailedToResolveDataSets"}}class nO extends Error{constructor(){super("dataSets property is not valid"),this.name="InvalidDataSetsPropType"}}const $7=async(t,e,o)=>{const b=await HO(t)({method:"post",body:{dynamicConfig:typeof t=="object"?t.dynamicConfig:void 0,integritySignature:e},mode:"cors",path:"/api/v1/resolve-data-sets",abortSignal:o});if(b.status==200)return b.body.dataSets;throw new Fa(`Failed to resolve data sets from ${JSON.stringify(t)}. Received status ${b.status}`)};R.function();const U7=t=>async e=>await $7(t,e.dataAccess?.signature),G7=(t,e)=>{if(t)return t;if(typeof e=="function"){if(!t)throw"dataSets function is required when loading a custom query engine config.";return t}if(e)return U7(e);throw new nO},V7=(t,e)=>async(o,n)=>{try{let b=G7(t,e);if(typeof b!="function")throw new nO;let a=await b(o,n);if(!a)throw new Fa("Failed to fetch data sets from the query engine endpoint");return a.map(O=>x_(O,n))}catch(b){throw At(b),b instanceof nO?b:b instanceof _2.Errors.FailedToResolveDataSets?new Fa(b.message):new Fa("Failed to fetch data sets.")}},Gl={apiHost:"https://api.vizzly.co"},Vl="in-browser";class H7{constructor(e,o,n,b,a=Gl){this.queryEngineConfig=void 0,this.dataSets=void 0,this.extraCustomFields=b,this.queryEngine=e||Vl,this.loadAccessTokens=o,this.loadDataSetsCallback=n,this.options={...Gl,...a}}async getQueryEngineConfig(){if(this.queryEngineConfig)return this.queryEngineConfig;this.queryEngineConfig=await T7(this.queryEngine,this.loadDataSetsCallback);const e=(o,n,b)=>$O(o,n,b,this.options.textOverrides,this.options.developerMode);return this.queryEngineConfig=k7(this.queryEngineConfig,e),this.queryEngineConfig}async getIdentity(){if(typeof this.loadAccessTokens!="function")throw new j7;const{tokens:e,identityConfig:o}=await P7(this.loadAccessTokens);return{accessTokens:e,identityConfig:o}}async getDataSets(){const{identityConfig:e}=await this.getIdentity(),o=await this.getQueryEngineConfig(),n=V7(this.loadDataSetsCallback,this.queryEngine);return this.dataSets=await n(e,o),this.dataSets}async load(){let[{identityConfig:e},o,n]=await Promise.all([this.getIdentity(),this.getQueryEngineConfig(),this.getDataSets()]);const b=this.getDashboardStorageStrategy(o);return this.extraCustomFields&&(n=n.map(a=>{let O=this.extraCustomFields?this.extraCustomFields(a):[];return{...a,fields:[...a.fields,...O]}})),{queryEngineConfig:o,dataSets:n,identityConfig:e,dashboardStorageStrategy:b}}getDashboardStorageStrategy(e){return typeof this.queryEngine=="function"?{strategy:"vizzlyApi"}:!e.supportedFeatures.includes("encryptedDashboards")||this.queryEngine===Vl?{strategy:"vizzlyApi"}:{strategy:"queryEngine",endpoint:this.queryEngine}}}const Y7=(t,e)=>{const o=[];return t.forEach(n=>{const b=$u(e,!!n.requiresValue),{error:a,value:O}=b.validate(n);if(a)throw At(`Invalid global filter configuration: ${a.message}`),a;o.push(O)}),o};function Hl(t,e){if(!e)throw new Error("Query engine config is required to validate filters");return Y7(t,e)}class Oz extends Error{}function K7(t){const{error:e,value:o}=GO.validate(t);if(e)throw new Oz(e.message);return o}class ka extends VM{constructor(e,o){super(`'Issue with Services in ${o}: '${e}'`),this.name="ServicesValidation"}}const Xa=12;class iO{constructor(e){if(this.component=void 0,this.localFilters=void 0,this.isEmpty=void 0,e?.component)this.component=e?.component,this.colSpan=e?.colSpan??Xa;else{const o=Wr(e?.colSpan??Xa);this.colSpan=o.colSpan,this.isEmpty=o.isEmpty}e?.localFilters&&(this.localFilters=Hl(e.localFilters,Ie.use().getViewConfiguration().queryEngineConfig))}set(e){this.component=e.component,this.colSpan=e.colSpan??Xa,this.isEmpty=e.component?void 0:!0,e?.localFilters&&(this.localFilters=Hl(e.localFilters,Ie.use().getViewConfiguration().queryEngineConfig))}setColSpan(e){try{K7(e),this.colSpan=e}catch(o){throw new ka(o,"Cell.setColSpan")}}setComponent(e){this.component=e,this.isEmpty=void 0}emptyCell(e){const o=Wr(e??Xa);this.colSpan=o.colSpan,this.isEmpty=o.isEmpty,this.component=void 0}}class Ku{constructor(e,o){this.components=[],this.height=Qo,this.components=e??[],this.height=o??Qo,this.validateTotalColSpan()}addCell(e,o){o===void 0?this.components.push(e):this.components.splice(o,0,e),this.validateTotalColSpan()}setHeight(e){this.height=e}setRow(e){this.components=e,this.validateTotalColSpan()}set(e,o){this.components=e,this.height=o??Qo,this.validateTotalColSpan()}validateTotalColSpan(){if(this.components.reduce((o,n)=>o+n.colSpan,0)>GN)throw new Error("Total column span of cells exceeds the allowed limit of 12.")}}class Qu{constructor(e){this.component=void 0;let o=UN("New Header");e&&(o={...o,displayTitle:e});const n=VN([o],jN);this.component=[n]}setTitle(e){if(!this.component)throw new Error("Header is undefined");UO(this.component[0].components[0])&&(this.component[0].components[0].displayTitle=e)}}class Q7{constructor(e,o){this.dashboard=void 0;let n={id:e};o?.display&&(n={...n,display:Yl(o?.display)}),o?.customFields&&(n={...n,customFields:o.customFields}),o?.library&&(n={...n,componentLibrary:Kl(o?.library)}),this.dashboard=i7(n)}setDisplay(e){let o=Yl(e);if(!this.dashboard)throw new Error("Dashboard is undefined");this.dashboard.display=o}setCustomFields(e){if(!this.dashboard)throw new Error("Dashboard is undefined");this.dashboard.customFields=e}setLibrary(e){if(!this.dashboard)throw new Error("Dashboard is undefined");this.dashboard.componentLibrary=Kl(e)}build(){if(!this.dashboard)throw new Error("Dashboard is undefined");return{...this.dashboard,display:this.dashboard?.display,componentLibrary:this.dashboard?.componentLibrary}}}function Yl(t){let e=[];return t.forEach(o=>{if(o instanceof Ku){const n=o?.components.map(b=>b.component&&!b.isEmpty?{attributes:b.component.attributes,localFilters:b.localFilters??[],results:[],colSpan:b.colSpan,reports:[]}:b.isEmpty?{colSpan:b.colSpan,isEmpty:!0}:{colSpan:b.colSpan,isEmpty:!0});e.push({height:o.height??Qo,components:n})}o instanceof Qu&&o.component?.forEach(n=>{e.push({height:n.height,components:n.components})})}),e}const Kl=t=>{let e=[],o=new Set;return t?.library?.forEach(n=>{if(n.component&&n.component.attributes){const{viewId:b}=n.component.attributes;if(o.has(b??""))throw new Error(`Duplicate viewId found: ${b}`);o.add(b??""),e.push({attributes:n.component.attributes,localFilters:n.localFilters??[],colSpan:1,reports:[]})}}),e};function Ql(t){const e=R.object({component:R.object().required(),uniqueViewId:R.string().min(1).required().messages({"string.base":`"uniqueViewId" should be a type of 'text'`,"string.empty":'"uniqueViewId" cannot be an empty field',"string.min":'"uniqueViewId" should have a minimum length of {#limit}',"any.required":'"uniqueViewId" maybe undefined or null'})}),{error:o}=e.validate(t);if(o)throw new Oz(o.message)}class Z7{constructor(e){this.library=void 0,this.library=[],e?.components&&this.addComponents(e?.components)}addComponent(e,o,n){try{Ql({component:e,uniqueViewId:o});const b=new iO({component:Zl(e,o),colSpan:1,localFilters:n?.localFilters});n?.position===void 0?this.library?.push(b):this.library?.splice(n.position,0,b)}catch(b){throw new ka(b,"Library.addComponent")}}addComponents(e){try{if(e===void 0)throw new ka("Components are undefined","Library.addComponents");e.forEach(o=>{Ql(o);const n=new iO({component:Zl(o.component,o.uniqueViewId),colSpan:1});this.library?.push(n)})}catch(o){throw new ka(o,"Library.addComponents")}}}const Zl=(t,e)=>({...t,attributes:{...t.attributes,viewId:e}});class J7{constructor(e){this.editor=void 0,e?.component&&(this.editor=e.component)}setComponent(e){if(!this.editor)throw new Error("Editor is undefined");this.editor=e}build(){if(!this.editor)throw new Error("Editor is undefined");return JN({attributes:this.editor.attributes})}}const eT=()=>Ut.QueryEngineConfig.getQueryEngineConfig("postgres"),tT=()=>Ut.QueryEngineConfig.getQueryEngineConfig("redshift"),oT=()=>Ut.QueryEngineConfig.getQueryEngineConfig("bigquery"),rT=()=>Ut.QueryEngineConfig.getQueryEngineConfig("microsoftSQLServer"),nT=()=>Ut.QueryEngineConfig.getQueryEngineConfig("mariadb"),iT=()=>Ut.QueryEngineConfig.getQueryEngineConfig("snowflake"),bT=()=>Ut.QueryEngineConfig.getQueryEngineConfig("mysql"),pT=t=>{switch(t){case"js":return bM;case"postgres":return eT();case"redshift":return tT();case"bigquery":return oT();case"mariadb":return nT();case"snowflake":return iT();case"mysql":return bT();case"microsoftSQLServer":return rT();case"SQLite":throw"SQLite not support via the query engine"}};class y1{constructor(e){const{init:o}=ib(e.type,{queryEngineConfig:this.getQueryEngineConfig()});this.attributes=o(e?.dataSetId,e)}getQueryEngineConfig(){return y1.queryEngineConfig||Ie.use().getViewConfiguration().queryEngineConfig}static setQueryEngineConfig(e){typeof e=="string"?y1.queryEngineConfig=pT(e):y1.queryEngineConfig=e}updateAttributes(e){const{setAttributes:o}=ib(this.attributes.type,{queryEngineConfig:this.getQueryEngineConfig()});if(!this.attributes)throw new Error("Attributes have not been initialized yet");this.attributes=o(this.attributes,e)}}class aT extends y1{constructor(e){super({...e,type:"areaChart"})}static type(){return"areaChart"}}class MT extends y1{constructor(e){super({...e,type:"areaChartV2"})}static type(){return"areaChartV2"}}class zT extends y1{constructor(e){super({...e,type:"lineChart"})}static type(){return"lineChart"}}class cT extends y1{constructor(e){super({...e,type:"lineChartV2"})}static type(){return"lineChartV2"}}class sT extends y1{constructor(e){super({...e,type:"barChart"})}static type(){return"barChart"}}class OT extends y1{constructor(e){super({...e,type:"barChartV2"})}static type(){return"barChartV2"}}class lT extends y1{constructor(e){super({...e,type:"pieChart"})}static type(){return"pieChart"}}class AT extends y1{constructor(e){super({...e,type:"bubbleChart"})}static type(){return"bubbleChart"}}class dT extends y1{constructor(e){super({...e,type:"bubbleChartV2"})}static type(){return"bubbleChartV2"}}class uT extends y1{constructor(e){super({...e,type:"sunburstChart"})}static type(){return"sunburstChart"}}class fT extends y1{constructor(e){super({...e,type:"scatterChart"})}static type(){return"scatterChart"}}class qT extends y1{constructor(e){super({...e,type:"comboChart"})}static type(){return"comboChart"}}class WT extends y1{constructor(e){super({...e,type:"comboChartV2"})}static type(){return"comboChartV2"}}class hT extends y1{constructor(e){super({...e,type:"dataTable"})}static type(){return"dataTable"}}class mT extends y1{constructor(e){super({...e,type:"basicTable"})}static type(){return"basicTable"}}class gT extends y1{constructor(e){super({...e,type:"horizontalBarChart"})}static type(){return"horizontalBarChart"}}class yT extends y1{constructor(e){super({...e,type:"horizontalBarChartV2"})}static type(){return"horizontalBarChartV2"}}class RT extends y1{constructor(e){super({...e,type:"mercatorMap"})}static type(){return"mercatorMap"}}class LT extends y1{constructor(e){super({...e,type:"singleStat"})}static type(){return"singleStat"}}class vT extends y1{constructor(e){super({...e,type:"progress"})}static type(){return"progress"}}class _T extends y1{constructor(e){super({...e,type:"richText"})}static type(){return"richText"}}class NT extends y1{constructor(e){super({...e,type:"waterfallChart"})}static type(){return"waterfallChart"}}class TT extends y1{constructor(e){super({...e,type:"radarChart"})}static type(){return"radarChart"}}class BT extends y1{constructor(e){super({...e,type:"funnelChart"})}static type(){return"funnelChart"}}class Zu extends Error{constructor(e){super(`Vizzly has not yet been loaded. Please see the instantiation docs;
117
117
  https://docs.vizzly.co/services/initializing
118
118
 
119
119
  This might be expected behavior if you have set it up correctly. If so, you will need
@@ -133,4 +133,4 @@ For example, this should be added within the <head> tag;
133
133
  <script src="https://static.app.vizzly.co/query-engine/0.8.29/vizzly-in-memory-db.umd.js"><\/script>
134
134
 
135
135
  Note, you can change the version of the in-memory database by changing '0.8.3' to the version you require.
136
- `);return t},tS=async(t,e)=>{if("measure"in t&&t.measure.length===0)return[[]];const o={id:e.id,fields:e.fields.map(b=>({id:b.id,address:["_",e.id,b.id],dataType:b.dataType})),joins:[]};return(await pO().queryV2(t,o))?.[0]?.values||[]},rf=(t,e)=>`${t}::${e}`,oS=async(t,e,o)=>{const n=[...t].map(async a=>{const[O]=Zd(e,a.dataSetId),A=rf(o,a.dataSetId);return Ua[A]&&O?{content:await tS(a,O),hasMoreResults:!1}:(console.warn("Returning an empty result."),{content:[],hasMoreResults:null})});return{results:await Promise.all(n)}},rS=async(t,e,o,n)=>(await pO().init(e.map(b=>({id:b?.id,fields:b?.fields.map(a=>({id:a.id,dataType:a.dataType}))}))),await Promise.all([...t].flatMap(async b=>{const[a]=Zd(e,b.dataSetId);if(a){const O=await JB(a,o,rf(n,b.dataSetId)),A={id:a?.id,fields:a?.fields.map(c=>({id:c.id,dataType:c.dataType}))};await pO().ingest(A,O||[])}return[]})),await oS(t,e,n)),nS=async(t,e,o)=>{const{queries:n,resultFields:b}=KO(e,bM,o);let a=await QO(n,A=>!0,async A=>await rS(A,o.dataSets,t.loadData,t.cacheKeyNamespace),A=>({query:A,cacheKeyNamespace:t.cacheKeyNamespace}));return a===null&&(a=n.map(()=>null)),[...n].map((A,c)=>{if(a===null)return null;const y=a[c];return y==null?null:{content:y.content,fields:b[c],hasMoreResults:y.hasMoreResults}})},iS=async(t,e,o)=>{const{queries:n,resultFields:b}=KO(e,t.queryEngineConfig,o),a=await QO(n,O=>(O.type=="preparedQuery"&&SA("Custom query engine does not support prepared queries."),O.type=="query"),async O=>{const A=await t.runQueries(O,{...o,dataAccessToken:t.dataAccessToken});return A==null?{results:O.map(()=>null)}:{results:A.map((c,y)=>Array.isArray(c)?{fields:b[y],content:c,hasMoreResults:null}:c)}},O=>({query:O,cacheKeyNamespace:t.cacheKeyNamespace}));return a===null?n.map(()=>null):a};async function Is(t,e,o){return t.type=="vizzlyQueryEngine"?await uB(t,e,o):t.type=="vizzlyJsQueryEngine"?await nS(t,e,o):t.type=="custom"?await iS(t,e,o):[]}const bS=(t,e,o,n,b,a,O,A,c)=>{let y=E7(t.dashboardAccess);if(a)return async(v,N)=>await Is({type:"custom",queryEngineConfig:e,runQueries:a,dataAccessToken:t.dataAccess?.signature,cacheKeyNamespace:y},v,{abortSignal:N.abortSignal,dataSets:N.dataSets,filterConfig:N.filterConfig||{},timeRangeOptions:o,timeZone:c,variables:n,aliasFields:b});if(O)return async(v,N)=>await Is({type:"vizzlyJsQueryEngine",loadData:O,cacheKeyNamespace:y},v,{abortSignal:N.abortSignal,dataSets:N.dataSets,filterConfig:N.filterConfig||{},timeRangeOptions:o,timeZone:c,variables:n,aliasFields:b});if(A&&t.dataAccess?.signature)return async(v,N)=>await Is({type:"vizzlyQueryEngine",queryEngineConfig:e,dataAccessToken:t.dataAccess?.signature,queryEngineEndpoint:A,cacheKeyNamespace:y},v,{abortSignal:N.abortSignal,dataSets:N.dataSets,filterConfig:N.filterConfig||{},timeRangeOptions:o,timeZone:c,variables:n,aliasFields:b});throw"Missing required props."},pS=(t,e)=>{const o=new Date(t.getTime()-e*24*60*60*1e3);return new Date(o.getFullYear(),o.getMonth(),o.getDate())},aO=t=>new Date(t.getFullYear(),t.getMonth(),t.getDate()),Ps={today:!1,past_1_day:!0,yesterday:!0,past_3_days:!0,past_7_days:!0,past_30_days:!0,past_90_days:!0,past_3_months:!1,past_6_months:!1,past_12_months:!1,past_18_months:!1},aS=(t,e)=>{const o=aO(t),n=new Date(o);return n.setDate(n.getDate()+1),n.setMilliseconds(n.getMilliseconds()-1),{description:e,range:{before:n,after:o}}},MS=(t,e)=>({description:e,range:{before:aO(t),after:aO(pS(t,1))}}),bo=(t,e,o)=>{const n=new Date;let b=new Date(n);return e>0&&b.setMonth(n.getMonth()-e),t>0&&(b=new Date(n.getTime()-t*24*60*60*1e3)),{description:o,range:{before:n,after:b}}},zS=t=>({today:aS(new Date,t("filter.today","Today")),past_1_day:bo(1,0,t("filter.past_1_day","Last 24 hours")),yesterday:MS(new Date,t("filter.yesterday","Yesterday")),past_3_days:bo(3,0,t("filter.past_3_days","Last 3 days")),past_7_days:bo(7,0,t("filter.past_7_days","Last 7 days")),past_30_days:bo(30,0,t("filter.past_30_days","Last 30 days")),past_90_days:bo(90,0,t("filter.past_90_days","Last 90 days")),past_3_months:bo(0,3,t("filter.past_3_months","Last 3 months")),past_6_months:bo(0,6,t("filter.past_6_months","Last 6 months")),past_12_months:bo(0,12,t("filter.past_12_months","Last 12 months")),past_18_months:bo(0,18,t("filter.past_18_months","Last 18 months"))}),cS=(t,e)=>{const o=zS(t),n=Object.keys(Ps).map(A=>A in o?`_vizzly_${A}`:A),b=n.indexOf("_vizzly_today");b>-1&&(n.splice(b,1),n.unshift("_vizzly_today"));let a={},O={};for(const A of n){const c=A.replace("_vizzly_",""),y=o[c],v=e?.[c];typeof v=="boolean"?v&&(O[A]=y):v!=null?O[A]=v:Ps[c]!==!1&&(O[A]=y)}if(e)for(const[A,c]of Object.entries(e))A in Ps||(n.push(A),O[A]=c);for(const A of n)A in O&&(a[A]=O[A]);return a},sS=(t,e)=>{const o=q7(t);if(o&&e.dashboardAccess.scope==="read")return{type:"exact",globalLibrary:o};if(o&&e.dashboardAccess.scope==="read_write"&&e.dashboardAccess.accessType!=="admin")return{type:"exact",globalLibrary:f7(t)[0]};if(o&&e.dashboardAccess.accessType==="admin")return{type:"exact",globalLibrary:o};throw"No strategy found."},$i="default";_2.VizzlyApiClientLogger.UserAgentProduct="Services";const OS={apiHost:"https://api.vizzly.co"};class Ho{static{this._instanceStore={}}static{this.DEFAULT_INSTANCE_ID=$i}static{this.eventBus=[]}constructor(e,o,n,b,a,O){this.programmaticDashboard=a,this.dataSets=n,this.queryEngineConfig=o,this.identityConfig=e,this.vizzlyAPIClient=Rm(e,b,O)}getDataSets(){return this.dataSets}static async load(e,o=OS){G1("Starting load process for the services package.");const{queryEngine:n,dataSets:b,identity:a,programmaticDashboard:O,extraCustomFields:A}=e,c=new H7(n,a,b,A,o),{queryEngineConfig:y,dataSets:v,identityConfig:N,dashboardStorageStrategy:s}=await c.load(),u=new Ie(N,y,v,s,O,{host:o.apiHost});return Ie._instanceStore[o.instanceId||$i]=u,Ie.queryEngine=n,G1("Loaded services package and added it to the instance store."),u}static use(e=$i){const o=Ie._instanceStore[e];if(!o)throw new Zu(e);return o}static async waitToUse(e=$i,o=1e4){const n=Ho._instanceStore,b=e;return new Promise((a,O)=>{if(n.hasOwnProperty(b)){a(n[b]);return}const A=setTimeout(()=>{clearTimeout(A),O(new ST(e,o))},o),c=setInterval(()=>{n.hasOwnProperty(b)&&(clearTimeout(A),clearInterval(c),a(n[b]))},10)})}static clearInstances(){Ie._instanceStore={},v1.setQueryEngineConfig(null)}async createDashboard(e){wT(e,this.queryEngineConfig);const n=this.vizzlyAPIClient.getDashboardManager(),{dashboard:b}=await n.create({metadata:e.metadata||e.meta,definition:e.definition,parentDashboardId:e.parentDashboardId,permissions:[{scope:"read_write"}],usage_metadata:e.definition?kl(e.definition,this.dataSets):void 0}),a=Bs(b,this.queryEngineConfig);return Pa(a,this.dataSets,b.definition?.customFields||{})}async updateDashboard(e){xT(e,this.queryEngineConfig);const b=await this.vizzlyAPIClient.getDashboardManager().update({dashboardId:e.dashboardId,metadata:e.metadata||e.meta,definition:e.definition,deleted:e.deleted,abortSignal:e.abortSignal,name:e.name,usage_metadata:e.definition?kl(e.definition,this.dataSets):void 0}),a=Bs(b,this.queryEngineConfig);return Pa(a,this.dataSets,b.definition?.customFields||{})}async updateScheduledReport(e,o,n){const a=await this.vizzlyAPIClient.getAPIs().vizzlyApi.saveScheduledReport({scheduledReportId:o,cronSchedule:n,dashboardAccessToken:e});if(a.status===200)return n===null?!0:a.body}async getScheduledReports(e){if(this.vizzlyAPIClient){const n=await this.vizzlyAPIClient.getAPIs().vizzlyApi.getScheduledReports({dashboardAccessToken:e});if(n.status===200)return n.body}return{reports:[]}}async getDashboards(e){const a=(await this.vizzlyAPIClient.getDashboardManager().getDashboards(e?.abortController?{abortSignal:e?.abortController.signal}:{})).flatMap(O=>Ho.upcastDashboard(O,this.dataSets,this.queryEngineConfig));return this.programmaticDashboard?M7(a,b7(await this.programmaticDashboard(this.dataSets),this.dataSets)):a}async createGlobalLibrary(e){return await this.vizzlyAPIClient.getGlobalLibraryManager().create(e)}async getGlobalLibraries(e){const b=await this.vizzlyAPIClient.getGlobalLibraryManager().getGlobalLibraries(e?.abortController?{abortSignal:e?.abortController.signal}:{});this.globalLibraryPermissions=b.permissions;const a=b.global_libraries.map(A=>c7(A));return[sS(a,this.getIdentityConfig()).globalLibrary]}getViewConfiguration(){return{queryEngineConfig:this.queryEngineConfig}}getIdentityConfig(){return this.identityConfig}async query(e,o){G1("[Services] Querying data with queries:",e);let n=$i;o?.instanceId&&(n=o.instanceId);const b=Ho._instanceStore[n],a=bS(b.identityConfig,b.queryEngineConfig,cS(_N,o?.dateFilterOptions),o?.variables||{},o?.aliasFields||{},o?.runQueries,o?.data,o?.queryEngineEndpoint);return{results:await(async()=>{try{return await a(e,{abortSignal:o?.abortController?.signal,dataSets:this.dataSets,filterConfig:o?.filterConfig})}catch(A){return At("[Services] Error fetching data on query:",A),null}})()}}static upcastDashboard(e,o,n){try{const b=Bs(e,n);return[Pa(b,o,e.definition?.customFields||{})]}catch(b){return At(`Failed to upcast dashboard ${e.id}. This dashboard will not be available for use.`,b),[]}}static filterDashboards(e,o){let n=P0.cloneDeep(e);return o.onlyParentDashboards&&(n=n.filter(b=>b.parentDashboardId===null)),o.onlyChildDashboards&&(n=n.filter(b=>b.parentDashboardId!==null)),o.onlyChildDashboardsForParent&&(n=n.filter(b=>b.parentDashboardId===o.onlyChildDashboardsForParent)),o.onlyAllowScope&&(n=n.filter(b=>b.permission?.scope===o.onlyAllowScope)),o.onlyDashboardsIncludingMetadata&&(n=n.filter(b=>{const a=Object.keys(o.onlyDashboardsIncludingMetadata||{});return P0.every(a,O=>b.metadata[O]===o?.onlyDashboardsIncludingMetadata?.[O])})),n}async updateGlobalLibrary(e){try{return await this.vizzlyAPIClient.getGlobalLibraryManager().update(e)}catch(o){At("Error updating global library:",o)}}static async eventBusController(e,o){try{const n=Ho.use();if((e.action==="addComponentToLibrary"||e.action==="deleteComponentFromLibrary")&&n.globalLibraryPermissions){Ie.publish({data:{action:"updateToGlobalLibraryStatus",state:ja.SAVING}});const[b]=await Promise.all([await n.getGlobalLibraries({abortController:o?.abortController})]);let a=VO(b);e.action==="addComponentToLibrary"&&(a=O7(b,e.component,e.customFields)),e.action==="deleteComponentFromLibrary"&&(a=d7(b,e.component));const O=s7(n.globalLibraryPermissions,[a]);B6("library and tokens for update",{libraryForUpdate:a,tokenForLibrary:O});const A={globalLibraryId:a.id,library:a.library,abortSignal:o?.abortController?.signal,globalLibrarySessionToken:O};if(await n.updateGlobalLibrary(A)){let y=ja.SAVED;e.action==="deleteComponentFromLibrary"&&(y=ja.DELETED),Ie.publish({data:{action:"newViewsInGlobalLibrary"}}),Ie.publish({data:{action:"updateToGlobalLibraryStatus",state:y}})}}}catch(n){At("Error handling event:",n)}}static publish(e){Ie.eventBus.map(o=>{o(e)}),Ie.eventBusController(e.data).catch(o=>{At("Failed to handle event:",o)})}static subscription(e){return Ie.eventBus.push(e),()=>{Ie.eventBus=Ie.eventBus.filter(o=>o!==e)}}static{this.Row=Ku}static{this.Cell=iO}static{this.Dashboard=Q7}static{this.Editor=J7}static{this.Header=Qu}static{this.Library=Z7}static{this.AreaChart=aT}static{this.AreaChartV2=MT}static{this.LineChart=zT}static{this.LineChartV2=cT}static{this.BarChart=sT}static{this.BarChartV2=OT}static{this.PieChart=lT}static{this.BubbleChart=AT}static{this.BubbleChartV2=dT}static{this.ScatterChart=fT}static{this.ComboChart=qT}static{this.ComboChartV2=WT}static{this.PivotTable=hT}static{this.BasicTable=mT}static{this.HorizontalBarChart=gT}static{this.HorizontalBarChartV2=yT}static{this.MercatorMap=RT}static{this.SingleStat=LT}static{this.Progress=vT}static{this.RichText=_T}static{this.WaterfallChart=NT}static{this.FunnelChart=BT}static{this.SunburstChart=uT}static{this.RadarChart=TT}}typeof window<"u"&&!window.Vizzly&&(window.Vizzly=Ho);const Ie=typeof window<"u"&&window.Vizzly||Ho;exports.Vizzly=Ie;exports.VizzlyInstanceNotLoaded=Zu;
136
+ `);return t},tS=async(t,e)=>{if("measure"in t&&t.measure.length===0)return[[]];const o={id:e.id,fields:e.fields.map(b=>({id:b.id,address:["_",e.id,b.id],dataType:b.dataType})),joins:[]};return(await pO().queryV2(t,o))?.[0]?.values||[]},rf=(t,e)=>`${t}::${e}`,oS=async(t,e,o)=>{const n=[...t].map(async a=>{const[O]=Zd(e,a.dataSetId),A=rf(o,a.dataSetId);return Ua[A]&&O?{content:await tS(a,O),hasMoreResults:!1}:(console.warn("Returning an empty result."),{content:[],hasMoreResults:null})});return{results:await Promise.all(n)}},rS=async(t,e,o,n)=>(await pO().init(e.map(b=>({id:b?.id,fields:b?.fields.map(a=>({id:a.id,dataType:a.dataType}))}))),await Promise.all([...t].flatMap(async b=>{const[a]=Zd(e,b.dataSetId);if(a){const O=await JB(a,o,rf(n,b.dataSetId)),A={id:a?.id,fields:a?.fields.map(c=>({id:c.id,dataType:c.dataType}))};await pO().ingest(A,O||[])}return[]})),await oS(t,e,n)),nS=async(t,e,o)=>{const{queries:n,resultFields:b}=KO(e,bM,o);let a=await QO(n,A=>!0,async A=>await rS(A,o.dataSets,t.loadData,t.cacheKeyNamespace),A=>({query:A,cacheKeyNamespace:t.cacheKeyNamespace}));return a===null&&(a=n.map(()=>null)),[...n].map((A,c)=>{if(a===null)return null;const y=a[c];return y==null?null:{content:y.content,fields:b[c],hasMoreResults:y.hasMoreResults}})},iS=async(t,e,o)=>{const{queries:n,resultFields:b}=KO(e,t.queryEngineConfig,o),a=await QO(n,O=>(O.type=="preparedQuery"&&SA("Custom query engine does not support prepared queries."),O.type=="query"),async O=>{const A=await t.runQueries(O,{...o,dataAccessToken:t.dataAccessToken});return A==null?{results:O.map(()=>null)}:{results:A.map((c,y)=>Array.isArray(c)?{fields:b[y],content:c,hasMoreResults:null}:c)}},O=>({query:O,cacheKeyNamespace:t.cacheKeyNamespace}));return a===null?n.map(()=>null):a};async function Is(t,e,o){return t.type=="vizzlyQueryEngine"?await uB(t,e,o):t.type=="vizzlyJsQueryEngine"?await nS(t,e,o):t.type=="custom"?await iS(t,e,o):[]}const bS=(t,e,o,n,b,a,O,A,c)=>{let y=E7(t.dashboardAccess);if(a)return async(v,N)=>await Is({type:"custom",queryEngineConfig:e,runQueries:a,dataAccessToken:t.dataAccess?.signature,cacheKeyNamespace:y},v,{abortSignal:N.abortSignal,dataSets:N.dataSets,filterConfig:N.filterConfig||{},timeRangeOptions:o,timeZone:c,variables:n,aliasFields:b});if(O)return async(v,N)=>await Is({type:"vizzlyJsQueryEngine",loadData:O,cacheKeyNamespace:y},v,{abortSignal:N.abortSignal,dataSets:N.dataSets,filterConfig:N.filterConfig||{},timeRangeOptions:o,timeZone:c,variables:n,aliasFields:b});if(A&&t.dataAccess?.signature)return async(v,N)=>await Is({type:"vizzlyQueryEngine",queryEngineConfig:e,dataAccessToken:t.dataAccess?.signature,queryEngineEndpoint:A,cacheKeyNamespace:y},v,{abortSignal:N.abortSignal,dataSets:N.dataSets,filterConfig:N.filterConfig||{},timeRangeOptions:o,timeZone:c,variables:n,aliasFields:b});throw"Missing required props."},pS=(t,e)=>{const o=new Date(t.getTime()-e*24*60*60*1e3);return new Date(o.getFullYear(),o.getMonth(),o.getDate())},aO=t=>new Date(t.getFullYear(),t.getMonth(),t.getDate()),Ps={today:!1,past_1_day:!0,yesterday:!0,past_3_days:!0,past_7_days:!0,past_30_days:!0,past_90_days:!0,past_3_months:!1,past_6_months:!1,past_12_months:!1,past_18_months:!1},aS=(t,e)=>{const o=aO(t),n=new Date(o);return n.setDate(n.getDate()+1),n.setMilliseconds(n.getMilliseconds()-1),{description:e,range:{before:n,after:o}}},MS=(t,e)=>({description:e,range:{before:aO(t),after:aO(pS(t,1))}}),bo=(t,e,o)=>{const n=new Date;let b=new Date(n);return e>0&&b.setMonth(n.getMonth()-e),t>0&&(b=new Date(n.getTime()-t*24*60*60*1e3)),{description:o,range:{before:n,after:b}}},zS=t=>({today:aS(new Date,t("filter.today","Today")),past_1_day:bo(1,0,t("filter.past_1_day","Last 24 hours")),yesterday:MS(new Date,t("filter.yesterday","Yesterday")),past_3_days:bo(3,0,t("filter.past_3_days","Last 3 days")),past_7_days:bo(7,0,t("filter.past_7_days","Last 7 days")),past_30_days:bo(30,0,t("filter.past_30_days","Last 30 days")),past_90_days:bo(90,0,t("filter.past_90_days","Last 90 days")),past_3_months:bo(0,3,t("filter.past_3_months","Last 3 months")),past_6_months:bo(0,6,t("filter.past_6_months","Last 6 months")),past_12_months:bo(0,12,t("filter.past_12_months","Last 12 months")),past_18_months:bo(0,18,t("filter.past_18_months","Last 18 months"))}),cS=(t,e)=>{const o=zS(t),n=Object.keys(Ps).map(A=>A in o?`_vizzly_${A}`:A),b=n.indexOf("_vizzly_today");b>-1&&(n.splice(b,1),n.unshift("_vizzly_today"));let a={},O={};for(const A of n){const c=A.replace("_vizzly_",""),y=o[c],v=e?.[c];typeof v=="boolean"?v&&(O[A]=y):v!=null?O[A]=v:Ps[c]!==!1&&(O[A]=y)}if(e)for(const[A,c]of Object.entries(e))A in Ps||(n.push(A),O[A]=c);for(const A of n)A in O&&(a[A]=O[A]);return a},sS=(t,e)=>{const o=q7(t);if(o&&e.dashboardAccess.scope==="read")return{type:"exact",globalLibrary:o};if(o&&e.dashboardAccess.scope==="read_write"&&e.dashboardAccess.accessType!=="admin")return{type:"exact",globalLibrary:f7(t)[0]};if(o&&e.dashboardAccess.accessType==="admin")return{type:"exact",globalLibrary:o};throw"No strategy found."},$i="default";_2.VizzlyApiClientLogger.UserAgentProduct="Services";const OS={apiHost:"https://api.vizzly.co"};class Ho{static{this._instanceStore={}}static{this.DEFAULT_INSTANCE_ID=$i}static{this.eventBus=[]}constructor(e,o,n,b,a,O){this.programmaticDashboard=a,this.dataSets=n,this.queryEngineConfig=o,this.identityConfig=e,this.vizzlyAPIClient=Rm(e,b,O)}getDataSets(){return this.dataSets}static async load(e,o=OS){G1("Starting load process for the services package.");const{queryEngine:n,dataSets:b,identity:a,programmaticDashboard:O,extraCustomFields:A}=e,c=new H7(n,a,b,A,o),{queryEngineConfig:y,dataSets:v,identityConfig:N,dashboardStorageStrategy:s}=await c.load(),u=new Ie(N,y,v,s,O,{host:o.apiHost});return Ie._instanceStore[o.instanceId||$i]=u,Ie.queryEngine=n,G1("Loaded services package and added it to the instance store."),u}static use(e=$i){const o=Ie._instanceStore[e];if(!o)throw new Zu(e);return o}static async waitToUse(e=$i,o=1e4){const n=Ho._instanceStore,b=e;return new Promise((a,O)=>{if(n.hasOwnProperty(b)){a(n[b]);return}const A=setTimeout(()=>{clearTimeout(A),O(new ST(e,o))},o),c=setInterval(()=>{n.hasOwnProperty(b)&&(clearTimeout(A),clearInterval(c),a(n[b]))},10)})}static clearInstances(){Ie._instanceStore={},y1.setQueryEngineConfig(null)}async createDashboard(e){wT(e,this.queryEngineConfig);const n=this.vizzlyAPIClient.getDashboardManager(),{dashboard:b}=await n.create({metadata:e.metadata||e.meta,definition:e.definition,parentDashboardId:e.parentDashboardId,permissions:[{scope:"read_write"}],usage_metadata:e.definition?kl(e.definition,this.dataSets):void 0}),a=Bs(b,this.queryEngineConfig);return Pa(a,this.dataSets,b.definition?.customFields||{})}async updateDashboard(e){xT(e,this.queryEngineConfig);const b=await this.vizzlyAPIClient.getDashboardManager().update({dashboardId:e.dashboardId,metadata:e.metadata||e.meta,definition:e.definition,deleted:e.deleted,abortSignal:e.abortSignal,name:e.name,usage_metadata:e.definition?kl(e.definition,this.dataSets):void 0}),a=Bs(b,this.queryEngineConfig);return Pa(a,this.dataSets,b.definition?.customFields||{})}async updateScheduledReport(e,o,n){const a=await this.vizzlyAPIClient.getAPIs().vizzlyApi.saveScheduledReport({scheduledReportId:o,cronSchedule:n,dashboardAccessToken:e});if(a.status===200)return n===null?!0:a.body}async getScheduledReports(e){if(this.vizzlyAPIClient){const n=await this.vizzlyAPIClient.getAPIs().vizzlyApi.getScheduledReports({dashboardAccessToken:e});if(n.status===200)return n.body}return{reports:[]}}async getDashboards(e){const a=(await this.vizzlyAPIClient.getDashboardManager().getDashboards(e?.abortController?{abortSignal:e?.abortController.signal}:{})).flatMap(O=>Ho.upcastDashboard(O,this.dataSets,this.queryEngineConfig));return this.programmaticDashboard?M7(a,b7(await this.programmaticDashboard(this.dataSets),this.dataSets)):a}async createGlobalLibrary(e){return await this.vizzlyAPIClient.getGlobalLibraryManager().create(e)}async getGlobalLibraries(e){const b=await this.vizzlyAPIClient.getGlobalLibraryManager().getGlobalLibraries(e?.abortController?{abortSignal:e?.abortController.signal}:{});this.globalLibraryPermissions=b.permissions;const a=b.global_libraries.map(A=>c7(A));return[sS(a,this.getIdentityConfig()).globalLibrary]}getViewConfiguration(){return{queryEngineConfig:this.queryEngineConfig}}getIdentityConfig(){return this.identityConfig}async query(e,o){G1("[Services] Querying data with queries:",e);let n=$i;o?.instanceId&&(n=o.instanceId);const b=Ho._instanceStore[n],a=bS(b.identityConfig,b.queryEngineConfig,cS(_N,o?.dateFilterOptions),o?.variables||{},o?.aliasFields||{},o?.runQueries,o?.data,o?.queryEngineEndpoint);return{results:await(async()=>{try{return await a(e,{abortSignal:o?.abortController?.signal,dataSets:this.dataSets,filterConfig:o?.filterConfig})}catch(A){return At("[Services] Error fetching data on query:",A),null}})()}}static upcastDashboard(e,o,n){try{const b=Bs(e,n);return[Pa(b,o,e.definition?.customFields||{})]}catch(b){return At(`Failed to upcast dashboard ${e.id}. This dashboard will not be available for use.`,b),[]}}static filterDashboards(e,o){let n=P0.cloneDeep(e);return o.onlyParentDashboards&&(n=n.filter(b=>b.parentDashboardId===null)),o.onlyChildDashboards&&(n=n.filter(b=>b.parentDashboardId!==null)),o.onlyChildDashboardsForParent&&(n=n.filter(b=>b.parentDashboardId===o.onlyChildDashboardsForParent)),o.onlyAllowScope&&(n=n.filter(b=>b.permission?.scope===o.onlyAllowScope)),o.onlyDashboardsIncludingMetadata&&(n=n.filter(b=>{const a=Object.keys(o.onlyDashboardsIncludingMetadata||{});return P0.every(a,O=>b.metadata[O]===o?.onlyDashboardsIncludingMetadata?.[O])})),n}async updateGlobalLibrary(e){try{return await this.vizzlyAPIClient.getGlobalLibraryManager().update(e)}catch(o){At("Error updating global library:",o)}}static async eventBusController(e,o){try{const n=Ho.use();if((e.action==="addComponentToLibrary"||e.action==="deleteComponentFromLibrary")&&n.globalLibraryPermissions){Ie.publish({data:{action:"updateToGlobalLibraryStatus",state:ja.SAVING}});const[b]=await Promise.all([await n.getGlobalLibraries({abortController:o?.abortController})]);let a=VO(b);e.action==="addComponentToLibrary"&&(a=O7(b,e.component,e.customFields)),e.action==="deleteComponentFromLibrary"&&(a=d7(b,e.component));const O=s7(n.globalLibraryPermissions,[a]);B6("library and tokens for update",{libraryForUpdate:a,tokenForLibrary:O});const A={globalLibraryId:a.id,library:a.library,abortSignal:o?.abortController?.signal,globalLibrarySessionToken:O};if(await n.updateGlobalLibrary(A)){let y=ja.SAVED;e.action==="deleteComponentFromLibrary"&&(y=ja.DELETED),Ie.publish({data:{action:"newViewsInGlobalLibrary"}}),Ie.publish({data:{action:"updateToGlobalLibraryStatus",state:y}})}}}catch(n){At("Error handling event:",n)}}static publish(e){Ie.eventBus.map(o=>{o(e)}),Ie.eventBusController(e.data).catch(o=>{At("Failed to handle event:",o)})}static subscription(e){return Ie.eventBus.push(e),()=>{Ie.eventBus=Ie.eventBus.filter(o=>o!==e)}}static{this.Row=Ku}static{this.Cell=iO}static{this.Dashboard=Q7}static{this.Editor=J7}static{this.Header=Qu}static{this.Library=Z7}static{this.View=y1}static{this.AreaChart=aT}static{this.AreaChartV2=MT}static{this.LineChart=zT}static{this.LineChartV2=cT}static{this.BarChart=sT}static{this.BarChartV2=OT}static{this.PieChart=lT}static{this.BubbleChart=AT}static{this.BubbleChartV2=dT}static{this.ScatterChart=fT}static{this.ComboChart=qT}static{this.ComboChartV2=WT}static{this.PivotTable=hT}static{this.BasicTable=mT}static{this.HorizontalBarChart=gT}static{this.HorizontalBarChartV2=yT}static{this.MercatorMap=RT}static{this.SingleStat=LT}static{this.Progress=vT}static{this.RichText=_T}static{this.WaterfallChart=NT}static{this.FunnelChart=BT}static{this.SunburstChart=uT}static{this.RadarChart=TT}}typeof window<"u"&&!window.Vizzly&&(window.Vizzly=Ho);const Ie=typeof window<"u"&&window.Vizzly||Ho;exports.Vizzly=Ie;exports.VizzlyInstanceNotLoaded=Zu;