@budibase/server 3.2.41 → 3.2.42
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.
|
@@ -29,7 +29,7 @@ __p += '`),fl&&(ps+=`' +
|
|
|
29
29
|
function print() { __p += __j.call(arguments, '') }
|
|
30
30
|
`:`;
|
|
31
31
|
`)+ps+`return __p
|
|
32
|
-
}`;var rl=Lh(function(){return Us(ca,Rs+"return "+ps).apply(eo,Sa)});if(rl.source=ps,Ch(rl))throw rl;return rl}function Ph($o){return wc($o).toLowerCase()}function O_($o){return wc($o).toUpperCase()}function s3($o,Oo,Lo){if($o=wc($o),$o&&(Lo||Oo===eo))return Gp($o);if(!$o||!(Oo=o1(Oo)))return $o;var Go=O1($o),oa=O1(Oo),ca=y0(Go,oa),Sa=lu(Go,oa)+1;return A0(Go,ca,Sa).join("")}function l3($o,Oo,Lo){if($o=wc($o),$o&&(Lo||Oo===eo))return $o.slice(0,Qp($o)+1);if(!$o||!(Oo=o1(Oo)))return $o;var Go=O1($o),oa=lu(Go,O1(Oo))+1;return A0(Go,0,oa).join("")}function c3($o,Oo,Lo){if($o=wc($o),$o&&(Lo||Oo===eo))return $o.replace(_l,"");if(!$o||!(Oo=o1(Oo)))return $o;var Go=O1($o),oa=y0(Go,O1(Oo));return A0(Go,oa).join("")}function Y2($o,Oo){var Lo=To,Go=Mo;if(Ru(Oo)){var oa="separator"in Oo?Oo.separator:oa;Lo="length"in Oo?Pl(Oo.length):Lo,Go="omission"in Oo?o1(Oo.omission):Go}$o=wc($o);var ca=$o.length;if(vu($o)){var Sa=O1($o);ca=Sa.length}if(Lo>=ca)return $o;var za=Lo-Pf(Go);if(za<1)return Go;var Va=Sa?A0(Sa,0,za).join(""):$o.slice(0,za);if(oa===eo)return Va+Go;if(Sa&&(za+=Va.length-za),Hp(oa)){if($o.slice(za).search(oa)){var as,Ka=Va;for(oa.global||(oa=mp(oa.source,wc(iu.exec(oa))+"g")),oa.lastIndex=0;as=oa.exec(Ka);)var ps=as.index;Va=Va.slice(0,ps===eo?za:ps)}}else if($o.indexOf(o1(oa),za)!=za){var Os=Va.lastIndexOf(oa);Os>-1&&(Va=Va.slice(0,Os))}return Va+Go}function Zl($o){return $o=wc($o),$o&&yl.test($o)?$o.replace(Ms,Yp):$o}var u3=bd(function($o,Oo,Lo){return $o+(Lo?" ":"")+Oo.toUpperCase()}),tp=i2("toUpperCase");function E_($o,Oo,Lo){return $o=wc($o),Oo=Lo?eo:Oo,Oo===eo?yu($o)?R2($o):E2($o):$o.match(Oo)||[]}var Lh=Nl(function($o,Oo){try{return k1($o,eo,Oo)}catch(Lo){return Ch(Lo)?Lo:new Vs(Lo)}}),Dh=Y0(function($o,Oo){return D1(Oo,function(Lo){Lo=Hc(Lo),jc($o,Lo,g0($o[Lo],$o))}),$o});function A_($o){var Oo=$o==null?0:$o.length,Lo=Rl();return $o=Oo?nl($o,function(Go){if(typeof Go[1]!="function")throw new n0(io);return[Lo(Go[0]),Go[1]]}):[],Nl(function(Go){for(var oa=-1;++oa<Oo;){var ca=$o[oa];if(k1(ca[0],this,Go))return k1(ca[1],this,Go)}})}function Em($o){return N2(Wc($o,uo))}function Bh($o){return function(){return $o}}function f3($o,Oo){return $o==null||$o!==$o?Oo:$o}var d3=a2(),T_=a2(!0);function Q1($o){return $o}function Nh($o){return lc(typeof $o=="function"?$o:Wc($o,uo))}function p3($o){return V2(Wc($o,uo))}function m3($o,Oo){return W0($o,Wc(Oo,uo))}var h3=Nl(function($o,Oo){return function(Lo){return wu(Lo,$o,Oo)}}),_3=Nl(function($o,Oo){return function(Lo){return wu($o,Lo,Oo)}});function Hh($o,Oo,Lo){var Go=L1(Oo),oa=ud(Oo,Go);Lo==null&&!(Ru(Oo)&&(oa.length||!Go.length))&&(Lo=Oo,Oo=$o,$o=this,oa=ud(Oo,L1(Oo)));var ca=!(Ru(Lo)&&"chain"in Lo)||!!Lo.chain,Sa=Xf($o);return D1(oa,function(za){var Va=Oo[za];$o[za]=Va,Sa&&($o.prototype[za]=function(){var as=this.__chain__;if(ca||as){var Ka=$o(this.__wrapped__),ps=Ka.__actions__=v1(this.__actions__);return ps.push({func:Va,args:arguments,thisArg:$o}),Ka.__chain__=as,Ka}return Va.apply($o,el([this.value()],arguments))})}),$o}function g3(){return mc._===this&&(mc._=Ec),this}function Vh(){}function I_($o){return $o=Pl($o),Nl(function(Oo){return tc(Oo,$o)})}var b3=l2(nl),v3=l2($s),M_=l2(S1);function Fh($o){return xo($o)?T2(Hc($o)):Rm($o)}function y3($o){return function(Oo){return $o==null?eo:q0($o,Oo)}}var $3=yf(),w3=yf(!0);function Uh(){return[]}function qh(){return!1}function k3(){return{}}function C3(){return""}function xh(){return!0}function z_($o,Oo){if($o=Pl($o),$o<1||$o>Uo)return[];var Lo=Qo,Go=bc($o,Qo);Oo=Rl(Oo),$o-=Qo;for(var oa=C1(Go,Oo);++Lo<$o;)Oo(Lo);return oa}function O3($o){return Fl($o)?nl($o,Hc):Cf($o)?[$o]:v1(Tc(wc($o)))}function E3($o){var Oo=++A1;return wc($o)+Oo}var A3=fu(function($o,Oo){return $o+Oo},0),T3=Z2("ceil"),I3=fu(function($o,Oo){return $o/Oo},1),M3=Z2("floor");function z3($o){return $o&&$o.length?Zc($o,Q1,Fu):eo}function R3($o,Oo){return $o&&$o.length?Zc($o,Rl(Oo,2),Fu):eo}function P3($o){return rf($o,Q1)}function L3($o,Oo){return rf($o,Rl(Oo,2))}function D3($o){return $o&&$o.length?Zc($o,Q1,Tu):eo}function B3($o,Oo){return $o&&$o.length?Zc($o,Rl(Oo,2),Tu):eo}var N3=fu(function($o,Oo){return $o*Oo},1),H3=Z2("round"),V3=fu(function($o,Oo){return $o-Oo},0);function F3($o){return $o&&$o.length?R0($o,Q1):0}function U3($o,Oo){return $o&&$o.length?R0($o,Rl(Oo,2)):0}return Ba.after=ug,Ba.ary=Gm,Ba.assign=Bm,Ba.assignIn=lh,Ba.assignInWith=Fp,Ba.assignWith=Nm,Ba.at=Hm,Ba.before=n_,Ba.bind=g0,Ba.bindAll=Dh,Ba.bindKey=Xm,Ba.castArray=vg,Ba.chain=gm,Ba.chunk=zu,Ba.compact=du,Ba.concat=pu,Ba.cond=A_,Ba.conforms=Em,Ba.constant=Bh,Ba.countBy=x_,Ba.create=ch,Ba.curry=r_,Ba.curryRight=o_,Ba.debounce=Qm,Ba.defaults=km,Ba.defaultsDeep=Tg,Ba.defer=fg,Ba.delay=yh,Ba.difference=Yc,Ba.differenceBy=y1,Ba.differenceWith=Yd,Ba.drop=Zf,Ba.dropRight=Qu,Ba.dropRightWhile=K0,Ba.dropWhile=mu,Ba.fill=h2,Ba.filter=W_,Ba.flatMap=Kh,Ba.flatMapDeep=G_,Ba.flatMapDepth=X_,Ba.flatten=hu,Ba.flattenDeep=Jl,Ba.flattenDepth=Kd,Ba.flip=dg,Ba.flow=d3,Ba.flowRight=T_,Ba.fromPairs=Q2,Ba.functions=h_,Ba.functionsIn=Sm,Ba.groupBy=Q_,Ba.initial=gh,Ba.intersection=Lm,Ba.intersectionBy=bh,Ba.intersectionWith=wd,Ba.invert=g_,Ba.invertBy=b_,Ba.invokeMap=K_,Ba.iteratee=Nh,Ba.keyBy=J_,Ba.keys=L1,Ba.keysIn=I0,Ba.map=Wm,Ba.mapKeys=Lg,Ba.mapValues=Th,Ba.matches=p3,Ba.matchesProperty=m3,Ba.memoize=Dm,Ba.merge=Ih,Ba.mergeWith=Mh,Ba.method=h3,Ba.methodOf=_3,Ba.mixin=Hh,Ba.negate=Ym,Ba.nthArg=I_,Ba.omit=v0,Ba.omitBy=Dg,Ba.once=$h,Ba.orderBy=eg,Ba.over=b3,Ba.overArgs=wh,Ba.overEvery=v3,Ba.overSome=M_,Ba.partial=kh,Ba.partialRight=i_,Ba.partition=tg,Ba.pick=v_,Ba.pickBy=Cm,Ba.property=Fh,Ba.propertyOf=y3,Ba.pull=vh,Ba.pullAll=Bo,Ba.pullAllBy=Wo,Ba.pullAllWith=na,Ba.pullAt=ha,Ba.range=$3,Ba.rangeRight=w3,Ba.rearg=pg,Ba.reject=og,Ba.remove=Ta,Ba.rest=mg,Ba.reverse=Ua,Ba.sampleSize=ag,Ba.set=y_,Ba.setWith=Bg,Ba.shuffle=sg,Ba.slice=Ya,Ba.sortBy=t_,Ba.sortedUniq=ml,Ba.sortedUniqBy=hl,Ba.split=C_,Ba.spread=hg,Ba.tail=Es,Ba.take=Js,Ba.takeRight=zl,Ba.takeRightWhile=ll,Ba.takeWhile=Vl,Ba.tap=bm,Ba.throttle=_g,Ba.thru=Jd,Ba.toArray=p_,Ba.toPairs=$_,Ba.toPairsIn=w_,Ba.toPath=O3,Ba.toPlainObject=Ah,Ba.transform=Ng,Ba.unary=gg,Ba.union=Tl,Ba.unionBy=a1,Ba.unionWith=Dl,Ba.uniq=xl,Ba.uniqBy=Z1,Ba.uniqWith=G1,Ba.unset=Hg,Ba.unzip=_0,Ba.unzipWith=Kc,Ba.update=Vg,Ba.updateWith=Fg,Ba.values=Om,Ba.valuesIn=Ug,Ba.without=wf,Ba.words=E_,Ba.wrap=bg,Ba.xor=kf,Ba.xorBy=Lp,Ba.xorWith=Dp,Ba.zip=Sf,Ba.zipObject=Yu,Ba.zipObjectDeep=X1,Ba.zipWith=_m,Ba.entries=$_,Ba.entriesIn=w_,Ba.extend=lh,Ba.extendWith=Fp,Hh(Ba,Ba),Ba.add=A3,Ba.attempt=Lh,Ba.camelCase=Wg,Ba.capitalize=k_,Ba.ceil=T3,Ba.clamp=qg,Ba.clone=yg,Ba.cloneDeep=wg,Ba.cloneDeepWith=kg,Ba.cloneWith=$g,Ba.conformsTo=Sg,Ba.deburr=S_,Ba.defaultTo=f3,Ba.divide=I3,Ba.endsWith=Zg,Ba.eq=Lc,Ba.escape=Gg,Ba.escapeRegExp=Xg,Ba.every=j_,Ba.find=Z_,Ba.findIndex=J0,Ba.findKey=Ig,Ba.findLast=Yh,Ba.findLastIndex=qu,Ba.findLastKey=Mg,Ba.floor=M3,Ba.forEach=Jh,Ba.forEachRight=e_,Ba.forIn=zg,Ba.forInRight=Rg,Ba.forOwn=uh,Ba.forOwnRight=Vm,Ba.get=ep,Ba.gt=Km,Ba.gte=Sh,Ba.has=__,Ba.hasIn=Fm,Ba.head=qm,Ba.identity=Q1,Ba.includes=Y_,Ba.indexOf=_h,Ba.inRange=xg,Ba.invoke=Pg,Ba.isArguments=_2,Ba.isArray=Fl,Ba.isArrayBuffer=gu,Ba.isArrayLike=b0,Ba.isArrayLikeObject=Ku,Ba.isBoolean=Gf,Ba.isBuffer=kd,Ba.isDate=Cg,Ba.isElement=wm,Ba.isEmpty=Jm,Ba.isEqual=eh,Ba.isEqualWith=Dc,Ba.isError=Ch,Ba.isFinite=a_,Ba.isFunction=Xf,Ba.isInteger=s_,Ba.isLength=th,Ba.isMap=Bp,Ba.isMatch=nh,Ba.isMatchWith=l_,Ba.isNaN=rh,Ba.isNative=c_,Ba.isNil=oh,Ba.isNull=u_,Ba.isNumber=Oh,Ba.isObject=Ru,Ba.isObjectLike=bu,Ba.isPlainObject=Np,Ba.isRegExp=Hp,Ba.isSafeInteger=ih,Ba.isSet=f_,Ba.isString=ah,Ba.isSymbol=Cf,Ba.isTypedArray=Vp,Ba.isUndefined=sh,Ba.isWeakMap=Eh,Ba.isWeakSet=Og,Ba.join=xm,Ba.kebabCase=Qg,Ba.last=W1,Ba.lastIndexOf=_u,Ba.lowerCase=Yg,Ba.lowerFirst=Kg,Ba.lt=d_,Ba.lte=Eg,Ba.max=z3,Ba.maxBy=R3,Ba.mean=P3,Ba.meanBy=L3,Ba.min=D3,Ba.minBy=B3,Ba.stubArray=Uh,Ba.stubFalse=qh,Ba.stubObject=k3,Ba.stubString=C3,Ba.stubTrue=xh,Ba.multiply=N3,Ba.nth=ku,Ba.noConflict=g3,Ba.noop=Vh,Ba.now=Zm,Ba.pad=Jg,Ba.padEnd=e3,Ba.padStart=t3,Ba.parseInt=n3,Ba.random=jg,Ba.reduce=ng,Ba.reduceRight=rg,Ba.repeat=r3,Ba.replace=fh,Ba.result=zh,Ba.round=H3,Ba.runInContext=Pa,Ba.sample=ig,Ba.size=lg,Ba.snakeCase=Rh,Ba.some=cg,Ba.sortedIndex=gs,Ba.sortedIndexBy=vs,Ba.sortedIndexOf=Is,Ba.sortedLastIndex=Ls,Ba.sortedLastIndexBy=Zs,Ba.sortedLastIndexOf=al,Ba.startCase=o3,Ba.startsWith=i3,Ba.subtract=V3,Ba.sum=F3,Ba.sumBy=U3,Ba.template=a3,Ba.times=z_,Ba.toFinite=Jc,Ba.toInteger=Pl,Ba.toLength=m_,Ba.toLower=Ph,Ba.toNumber=Qf,Ba.toSafeInteger=Ag,Ba.toString=wc,Ba.toUpper=O_,Ba.trim=s3,Ba.trimEnd=l3,Ba.trimStart=c3,Ba.truncate=Y2,Ba.unescape=Zl,Ba.uniqueId=E3,Ba.upperCase=u3,Ba.upperFirst=tp,Ba.each=Jh,Ba.eachRight=e_,Ba.first=qm,Hh(Ba,function(){var $o={};return j1(Ba,function(Oo,Lo){ic.call(Ba.prototype,Lo)||($o[Lo]=Oo)}),$o}(),{chain:!1}),Ba.VERSION=no,D1(["bind","bindKey","curry","curryRight","partial","partialRight"],function($o){Ba[$o].placeholder=Ba}),D1(["drop","take"],function($o,Oo){wl.prototype[$o]=function(Lo){Lo=Lo===eo?1:Mc(Pl(Lo),0);var Go=this.__filtered__&&!Oo?new wl(this):this.clone();return Go.__filtered__?Go.__takeCount__=bc(Lo,Go.__takeCount__):Go.__views__.push({size:bc(Lo,Qo),type:$o+(Go.__dir__<0?"Right":"")}),Go},wl.prototype[$o+"Right"]=function(Lo){return this.reverse()[$o](Lo).reverse()}}),D1(["filter","map","takeWhile"],function($o,Oo){var Lo=Oo+1,Go=Lo==Po||Lo==Do;wl.prototype[$o]=function(oa){var ca=this.clone();return ca.__iteratees__.push({iteratee:Rl(oa,3),type:Lo}),ca.__filtered__=ca.__filtered__||Go,ca}}),D1(["head","last"],function($o,Oo){var Lo="take"+(Oo?"Right":"");wl.prototype[$o]=function(){return this[Lo](1).value()[0]}}),D1(["initial","tail"],function($o,Oo){var Lo="drop"+(Oo?"":"Right");wl.prototype[$o]=function(){return this.__filtered__?new wl(this):this[Lo](1)}}),wl.prototype.compact=function(){return this.filter(Q1)},wl.prototype.find=function($o){return this.filter($o).head()},wl.prototype.findLast=function($o){return this.reverse().find($o)},wl.prototype.invokeMap=Nl(function($o,Oo){return typeof $o=="function"?new wl(this):this.map(function(Lo){return wu(Lo,$o,Oo)})}),wl.prototype.reject=function($o){return this.filter(Ym(Rl($o)))},wl.prototype.slice=function($o,Oo){$o=Pl($o);var Lo=this;return Lo.__filtered__&&($o>0||Oo<0)?new wl(Lo):($o<0?Lo=Lo.takeRight(-$o):$o&&(Lo=Lo.drop($o)),Oo!==eo&&(Oo=Pl(Oo),Lo=Oo<0?Lo.dropRight(-Oo):Lo.take(Oo-$o)),Lo)},wl.prototype.takeRightWhile=function($o){return this.reverse().takeWhile($o).reverse()},wl.prototype.toArray=function(){return this.take(Qo)},j1(wl.prototype,function($o,Oo){var Lo=/^(?:filter|find|map|reject)|While$/.test(Oo),Go=/^(?:head|last)$/.test(Oo),oa=Ba[Go?"take"+(Oo=="last"?"Right":""):Oo],ca=Go||/^find/.test(Oo);oa&&(Ba.prototype[Oo]=function(){var Sa=this.__wrapped__,za=Go?[1]:arguments,Va=Sa instanceof wl,as=za[0],Ka=Va||Fl(Sa),ps=function(cl){var fl=oa.apply(Ba,el([cl],za));return Go&&Os?fl[0]:fl};Ka&&Lo&&typeof as=="function"&&as.length!=1&&(Va=Ka=!1);var Os=this.__chain__,Rs=!!this.__actions__.length,Fs=ca&&!Os,rl=Va&&!Rs;if(!ca&&Ka){Sa=rl?Sa:new wl(this);var xs=$o.apply(Sa,za);return xs.__actions__.push({func:Jd,args:[ps],thisArg:eo}),new ac(xs,Os)}return Fs&&rl?$o.apply(this,za):(xs=this.thru(ps),Fs?Go?xs.value()[0]:xs.value():xs)})}),D1(["pop","push","shift","sort","splice","unshift"],function($o){var Oo=p1[$o],Lo=/^(?:push|sort|unshift)$/.test($o)?"tap":"thru",Go=/^(?:pop|shift)$/.test($o);Ba.prototype[$o]=function(){var oa=arguments;if(Go&&!this.__chain__){var ca=this.value();return Oo.apply(Fl(ca)?ca:[],oa)}return this[Lo](function(Sa){return Oo.apply(Fl(Sa)?Sa:[],oa)})}}),j1(wl.prototype,function($o,Oo){var Lo=Ba[Oo];if(Lo){var Go=Lo.name+"";ic.call(pc,Go)||(pc[Go]=[]),pc[Go].push({name:Oo,func:Lo})}}),pc[vd(eo,bo).name]=[{name:"wrapper",func:eo}],wl.prototype.clone=uu,wl.prototype.reverse=Dd,wl.prototype.value=zm,Ba.prototype.at=jm,Ba.prototype.chain=vm,Ba.prototype.commit=ym,Ba.prototype.next=V_,Ba.prototype.plant=U_,Ba.prototype.reverse=q_,Ba.prototype.toJSON=Ba.prototype.valueOf=Ba.prototype.value=$m,Ba.prototype.first=Ba.prototype.head,Df&&(Ba.prototype[Df]=F_),Ba},d1=Md();Tf?((Tf.exports=d1)._=d1,tf._=d1):mc._=d1}).call(commonjsGlobal$1)})(lodash$2,lodash$2.exports);var lodashExports=lodash$2.exports;const _$3=getDefaultExportFromCjs$1(lodashExports),FILTER_ALLOWED_KEYS=["field","operator","value","type","externalType","valueType","noValue","formulaType"];function hasSchema(to){return typeof to=="object"&&!Array.isArray(to)&&to!==null&&!(to instanceof Date)&&Object.keys(to).length>0}function trimOtherProps(to,ue){return Object.keys(to).filter(no=>ue.includes(no)).reduce((no,ro)=>({...no,[ro]:to[ro]}),{})}function isSupportedUserSearch(to){const ue=[{op:BasicOperator.STRING,key:"email"},{op:BasicOperator.EQUAL,key:"_id"},{op:ArrayOperator.ONE_OF,key:"_id"}];for(const[eo,no]of Object.entries(to)){if(typeof no!="object")return!1;if(isLogicalSearchOperator(eo)){for(const io of to[eo].conditions)if(!isSupportedUserSearch(io))return!1;return!0}const ro=Object.keys(no||{});if(ro.length===0)continue;if(!ue.find(io=>io.op===eo&&ro.length===1&&ro[0]===io.key))return!1}return!0}function processSearchFilters(to){if(!to||to.length===0)return;const{allOr:ue,onEmptyFilter:eo,filters:no}=splitFiltersArray(to);return{logicalOperator:UILogicalOperator.ALL,onEmptyFilter:eo||EmptyFilterOption.RETURN_ALL,groups:[{logicalOperator:ue?UILogicalOperator.ANY:UILogicalOperator.ALL,filters:no.map(ro=>{const oo=_$3.pick(ro,FILTER_ALLOWED_KEYS);return oo.field=removeKeyNumbering(oo.field),oo})}]}}const deepGet$1=(to,ue)=>{if(!to||!ue)return null;if(Object.prototype.hasOwnProperty.call(to,ue))return to[ue];const eo=ue.split(".");for(let no=0;no<eo.length;no++)to=to==null?void 0:to[eo[no]];return to},getUserInitials=to=>{var eo;if(!to)return"?";let ue="";return ue+=to.firstName?to.firstName[0]:"",ue+=to.lastName?to.lastName[0]:"",ue!==""?ue:((eo=to.email)==null?void 0:eo[0])||"U"},getUserColor=to=>{let ue=to==null?void 0:to._id;if(!ue)return"var(--spectrum-global-color-blue-400)";ue=ue.replace("ro_ta_users_","");let eo=1;for(let no=0;no<ue.length;no++)eo+=ue.charCodeAt(no),eo=eo%36;return`hsl(${eo*10}, 50%, 40%)`},getUserLabel=to=>{if(!to)return"";const{firstName:ue,lastName:eo,email:no}=to;return ue&&eo?`${ue} ${eo}`:ue||eo||no};function isSQL(to){return!to||!to.source?!1:[SourceName.POSTGRES,SourceName.SQL_SERVER,SourceName.MYSQL,SourceName.ORACLE].indexOf(to.source)!==-1||to.isSQL===!0}var lib$b={exports:{}},result$1={};(function(to){Object.defineProperty(to,"__esModule",{value:!0}),to.Err=to.Valid=to.err=to.valid=void 0;const ue=oo=>new no(oo);to.valid=ue;const eo=oo=>new ro(oo);to.err=eo;class no{constructor(io){this.value=io}isValid(){return!0}isError(){return!this.isValid()}getValue(){return this.value}getError(){throw new Error("Tried to get error from a valid.")}map(io){return(0,to.valid)(io(this.value))}mapErr(io){return(0,to.valid)(this.value)}}to.Valid=no;class ro{constructor(io){this.error=io}isError(){return!0}isValid(){return!this.isError()}getValue(){throw new Error("Tried to get success value from an error.")}getError(){return this.error}map(io){return(0,to.err)(this.error)}mapErr(io){return(0,to.err)(io(this.error))}}to.Err=ro})(result$1);var secondChecker={},helper={},hasRequiredHelper;function requireHelper(){if(hasRequiredHelper)return helper;hasRequiredHelper=1,Object.defineProperty(helper,"__esModule",{value:!0}),requireLib();const to=result$1,ue=["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],eo=["sun","mon","tue","wed","thu","fri","sat"],no=(co,uo)=>uo[co].lowerLimit===uo.preset[co].minValue&&uo[co].upperLimit===uo.preset[co].maxValue,ro=(co,uo,fo)=>{if(uo==="months"&&fo.useAliases&&ue.indexOf(co.toLowerCase())!==-1||uo==="daysOfWeek"&&fo.useAliases&&eo.indexOf(co.toLowerCase())!==-1)return(0,to.valid)(!0);const po=Number(co);if(isNaN(po))return(0,to.err)(`Element '${co} of ${uo} field is invalid.`);const{lowerLimit:ho}=fo[uo],{upperLimit:_o}=fo[uo];return ho&&po<ho?(0,to.err)(`Number ${po} of ${uo} field is smaller than lower limit '${ho}'`):_o&&po>_o?(0,to.err)(`Number ${po} of ${uo} field is bigger than upper limit '${_o}'`):(0,to.valid)(!0)},oo=(co,uo,fo)=>{if(co==="*")return no(uo,fo)?(0,to.valid)(!0):(0,to.err)(`Field ${uo} uses wildcard '*', but is limited to ${fo[uo].lowerLimit}-${fo[uo].upperLimit}`);if(co==="")return(0,to.err)(`One of the elements is empty in ${uo} field.`);if(uo==="daysOfMonth"&&fo.useLastDayOfMonth&&co==="L")return(0,to.valid)(!0);if(uo==="daysOfWeek"&&fo.useLastDayOfWeek&&co.endsWith("L")){const po=co.slice(0,-1);return po===""?(0,to.valid)(!0):ro(po,uo,fo)}if(uo==="daysOfMonth"&&fo.useNearestWeekday&&co.endsWith("W")){const po=co.slice(0,-1);return po===""?(0,to.err)("The 'W' must be preceded by a day"):fo.useLastDayOfMonth&&po==="L"?(0,to.valid)(!0):ro(po,uo,fo)}if(uo==="daysOfWeek"&&fo.useNthWeekdayOfMonth&&co.indexOf("#")!==-1){const[po,ho,..._o]=co.split("#");if(_o.length!==0)return(0,to.err)(`Unexpected number of '#' in ${co}, can only be used once.`);const go=Number(ho);return!ho||isNaN(go)?(0,to.err)(`Unexpected value following the '#' symbol, a positive number was expected but found ${ho}.`):go>5?(0,to.err)("Number of occurrence of the day of the week cannot be greater than 5."):ro(po,uo,fo)}return ro(co,uo,fo)},io=(co,uo,fo,po)=>co==="*"?(0,to.err)(`'*' can't be part of a range in ${uo} field.`):co===""?(0,to.err)(`One of the range elements is empty in ${uo} field.`):fo.useLastDayOfMonth&&uo==="daysOfMonth"&&co==="L"&&po===0?(0,to.valid)(!0):ro(co,uo,fo),ao=(co,uo,fo)=>{const po=co.split("-");if(po.length>2)return(0,to.err)(`List element '${co}' is not valid. (More than one '-')`);if(po.length===1)return oo(po[0],uo,fo);if(po.length===2){const ho=io(po[0],uo,fo,0),_o=io(po[1],uo,fo,1);return ho.isError()?ho:_o.isError()?_o:Number(po[0])>Number(po[1])?(0,to.err)(`Lower range end '${po[0]}' is bigger than upper range end '${po[1]}' of ${uo} field.`):(0,to.valid)(!0)}return(0,to.err)("Some other error in checkFirstStepElement (rangeArray less than 1)")},so=(co,uo,fo)=>{const po=co.split("/");if(po.length>2)return(0,to.err)(`List element '${co}' is not valid. (More than one '/')`);const ho=ao(po[0],uo,fo);if(ho.isError())return ho;if(po.length===2){const _o=po[1];if(!_o)return(0,to.err)(`Second step element '${_o}' of '${co}' is not valid (doesnt exist).`);if(isNaN(Number(_o)))return(0,to.err)(`Second step element '${_o}' of '${co}' is not valid (not a number).`);if(Number(_o)===0)return(0,to.err)(`Second step element '${_o}' of '${co}' cannot be zero.`)}return(0,to.valid)(!0)},lo=(co,uo,fo)=>{if(!["seconds","minutes","hours","daysOfMonth","months","daysOfWeek","years"].includes(uo))return(0,to.err)([`Cron field type '${uo}' does not exist.`]);if(co==="?")return uo==="daysOfMonth"||uo==="daysOfWeek"?fo.useBlankDay?(0,to.valid)(!0):(0,to.err)([`useBlankDay is not enabled, but is used in ${uo} field`]):(0,to.err)([`blank notation is not allowed in ${uo} field`]);const po=co.split(","),ho=[];if(po.forEach(go=>{ho.push(so(go,uo,fo))}),ho.every(go=>go.isValid()))return(0,to.valid)(!0);const _o=[];return ho.forEach(go=>{go.isError()&&_o.push(go.getError())}),(0,to.err)(_o)};return helper.default=lo,helper}var hasRequiredSecondChecker;function requireSecondChecker(){if(hasRequiredSecondChecker)return secondChecker;hasRequiredSecondChecker=1;var to=commonjsGlobal$1&&commonjsGlobal$1.__importDefault||function(ro){return ro&&ro.__esModule?ro:{default:ro}};Object.defineProperty(secondChecker,"__esModule",{value:!0}),requireLib();const ue=result$1,eo=to(requireHelper()),no=(ro,oo)=>{if(!ro.seconds)return(0,ue.err)(["seconds field is undefined, but useSeconds options is enabled."]);const{seconds:io}=ro;return(0,eo.default)(io,"seconds",oo)};return secondChecker.default=no,secondChecker}var minuteChecker={},hasRequiredMinuteChecker;function requireMinuteChecker(){if(hasRequiredMinuteChecker)return minuteChecker;hasRequiredMinuteChecker=1;var to=commonjsGlobal$1&&commonjsGlobal$1.__importDefault||function(ro){return ro&&ro.__esModule?ro:{default:ro}};Object.defineProperty(minuteChecker,"__esModule",{value:!0}),requireLib();const ue=result$1,eo=to(requireHelper()),no=(ro,oo)=>{if(!ro.minutes)return(0,ue.err)(["minutes field is undefined."]);const{minutes:io}=ro;return(0,eo.default)(io,"minutes",oo)};return minuteChecker.default=no,minuteChecker}var hourChecker={},hasRequiredHourChecker;function requireHourChecker(){if(hasRequiredHourChecker)return hourChecker;hasRequiredHourChecker=1;var to=commonjsGlobal$1&&commonjsGlobal$1.__importDefault||function(ro){return ro&&ro.__esModule?ro:{default:ro}};Object.defineProperty(hourChecker,"__esModule",{value:!0}),requireLib();const ue=result$1,eo=to(requireHelper()),no=(ro,oo)=>{if(!ro.hours)return(0,ue.err)(["hours field is undefined."]);const{hours:io}=ro;return(0,eo.default)(io,"hours",oo)};return hourChecker.default=no,hourChecker}var dayOfMonthChecker={},hasRequiredDayOfMonthChecker;function requireDayOfMonthChecker(){if(hasRequiredDayOfMonthChecker)return dayOfMonthChecker;hasRequiredDayOfMonthChecker=1;var to=commonjsGlobal$1&&commonjsGlobal$1.__importDefault||function(ro){return ro&&ro.__esModule?ro:{default:ro}};Object.defineProperty(dayOfMonthChecker,"__esModule",{value:!0}),requireLib();const ue=result$1,eo=to(requireHelper()),no=(ro,oo)=>{if(!ro.daysOfMonth)return(0,ue.err)(["daysOfMonth field is undefined."]);const{daysOfMonth:io}=ro;return oo.allowOnlyOneBlankDayField&&oo.useBlankDay&&ro.daysOfMonth==="?"&&ro.daysOfWeek==="?"?(0,ue.err)(["Cannot use blank value in daysOfMonth and daysOfWeek field when allowOnlyOneBlankDayField option is enabled."]):oo.mustHaveBlankDayField&&ro.daysOfMonth!=="?"&&ro.daysOfWeek!=="?"?(0,ue.err)(["Cannot specify both daysOfMonth and daysOfWeek field when mustHaveBlankDayField option is enabled."]):oo.useLastDayOfMonth&&ro.daysOfMonth.indexOf("L")!==-1&&ro.daysOfMonth.match(/[,/]/)?(0,ue.err)(["Cannot specify last day of month with lists, or ranges (symbols ,/)."]):oo.useNearestWeekday&&ro.daysOfMonth.indexOf("W")!==-1&&ro.daysOfMonth.match(/[,/-]/)?(0,ue.err)(["Cannot specify nearest weekday with lists, steps or ranges (symbols ,-/)."]):(0,eo.default)(io,"daysOfMonth",oo)};return dayOfMonthChecker.default=no,dayOfMonthChecker}var monthChecker={},hasRequiredMonthChecker;function requireMonthChecker(){if(hasRequiredMonthChecker)return monthChecker;hasRequiredMonthChecker=1;var to=commonjsGlobal$1&&commonjsGlobal$1.__importDefault||function(ro){return ro&&ro.__esModule?ro:{default:ro}};Object.defineProperty(monthChecker,"__esModule",{value:!0}),requireLib();const ue=result$1,eo=to(requireHelper()),no=(ro,oo)=>{if(!ro.months)return(0,ue.err)(["months field is undefined."]);const{months:io}=ro;return(0,eo.default)(io,"months",oo)};return monthChecker.default=no,monthChecker}var dayOfWeekChecker={},hasRequiredDayOfWeekChecker;function requireDayOfWeekChecker(){if(hasRequiredDayOfWeekChecker)return dayOfWeekChecker;hasRequiredDayOfWeekChecker=1;var to=commonjsGlobal$1&&commonjsGlobal$1.__importDefault||function(ro){return ro&&ro.__esModule?ro:{default:ro}};Object.defineProperty(dayOfWeekChecker,"__esModule",{value:!0}),requireLib();const ue=result$1,eo=to(requireHelper()),no=(ro,oo)=>{if(!ro.daysOfWeek)return(0,ue.err)(["daysOfWeek field is undefined."]);const{daysOfWeek:io}=ro;return oo.allowOnlyOneBlankDayField&&ro.daysOfMonth==="?"&&ro.daysOfWeek==="?"?(0,ue.err)(["Cannot use blank value in daysOfMonth and daysOfWeek field when allowOnlyOneBlankDayField option is enabled."]):oo.mustHaveBlankDayField&&ro.daysOfMonth!=="?"&&ro.daysOfWeek!=="?"?(0,ue.err)(["Cannot specify both daysOfMonth and daysOfWeek field when mustHaveBlankDayField option is enabled."]):oo.useLastDayOfWeek&&ro.daysOfWeek.indexOf("L")!==-1&&ro.daysOfWeek.match(/[,/-]/)?(0,ue.err)(["Cannot specify last day of week with lists, steps or ranges (symbols ,-/)."]):oo.useNthWeekdayOfMonth&&ro.daysOfWeek.indexOf("#")!==-1&&ro.daysOfWeek.match(/[,/-]/)?(0,ue.err)(["Cannot specify Nth weekday of month with lists, steps or ranges (symbols ,-/)."]):(0,eo.default)(io,"daysOfWeek",oo)};return dayOfWeekChecker.default=no,dayOfWeekChecker}var yearChecker={},hasRequiredYearChecker;function requireYearChecker(){if(hasRequiredYearChecker)return yearChecker;hasRequiredYearChecker=1;var to=commonjsGlobal$1&&commonjsGlobal$1.__importDefault||function(ro){return ro&&ro.__esModule?ro:{default:ro}};Object.defineProperty(yearChecker,"__esModule",{value:!0}),requireLib();const ue=result$1,eo=to(requireHelper()),no=(ro,oo)=>{if(!ro.years)return(0,ue.err)(["years field is undefined, but useYears option is enabled."]);const{years:io}=ro;return(0,eo.default)(io,"years",oo)};return yearChecker.default=no,yearChecker}var option={},map$3;try{map$3=Map}catch{}var set$2;try{set$2=Set}catch{}function baseClone$3(to,ue,eo){if(!to||typeof to!="object"||typeof to=="function")return to;if(to.nodeType&&"cloneNode"in to)return to.cloneNode(!0);if(to instanceof Date)return new Date(to.getTime());if(to instanceof RegExp)return new RegExp(to);if(Array.isArray(to))return to.map(clone$3);if(map$3&&to instanceof map$3)return new Map(Array.from(to.entries()));if(set$2&&to instanceof set$2)return new Set(Array.from(to.values()));if(to instanceof Object){ue.push(to);var no=Object.create(to);eo.push(no);for(var ro in to){var oo=ue.findIndex(function(io){return io===to[ro]});no[ro]=oo>-1?eo[oo]:baseClone$3(to[ro],ue,eo)}return no}return to}function clone$3(to){return baseClone$3(to,[],[])}const toString$c=Object.prototype.toString,errorToString$1=Error.prototype.toString,regExpToString$1=RegExp.prototype.toString,symbolToString$2=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",SYMBOL_REGEXP$1=/^Symbol\((.*)\)(.*)$/;function printNumber$1(to){return to!=+to?"NaN":to===0&&1/to<0?"-0":""+to}function printSimpleValue$1(to,ue=!1){if(to==null||to===!0||to===!1)return""+to;const eo=typeof to;if(eo==="number")return printNumber$1(to);if(eo==="string")return ue?`"${to}"`:to;if(eo==="function")return"[Function "+(to.name||"anonymous")+"]";if(eo==="symbol")return symbolToString$2.call(to).replace(SYMBOL_REGEXP$1,"Symbol($1)");const no=toString$c.call(to).slice(8,-1);return no==="Date"?isNaN(to.getTime())?""+to:to.toISOString(to):no==="Error"||to instanceof Error?"["+errorToString$1.call(to)+"]":no==="RegExp"?regExpToString$1.call(to):null}function printValue$1(to,ue){let eo=printSimpleValue$1(to,ue);return eo!==null?eo:JSON.stringify(to,function(no,ro){let oo=printSimpleValue$1(this[no],ue);return oo!==null?oo:ro},2)}let mixed$1={default:"${path} is invalid",required:"${path} is a required field",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:to,type:ue,value:eo,originalValue:no})=>{let ro=no!=null&&no!==eo,oo=`${to} must be a \`${ue}\` type, but the final value was: \`${printValue$1(eo,!0)}\``+(ro?` (cast from the value \`${printValue$1(no,!0)}\`).`:".");return eo===null&&(oo+='\n If "null" is intended as an empty value be sure to mark the schema as `.nullable()`'),oo},defined:"${path} must be defined"},string$3={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},number$3={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},date$4={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},boolean$1={isValue:"${path} field must be ${value}"},object$3={noUnknown:"${path} field has unspecified keys: ${unknown}"},array$3={min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must be have ${length} items"};const locale=Object.assign(Object.create(null),{mixed:mixed$1,string:string$3,number:number$3,date:date$4,object:object$3,array:array$3,boolean:boolean$1});var objectProto$i=Object.prototype,hasOwnProperty$i=objectProto$i.hasOwnProperty;function baseHas$1(to,ue){return to!=null&&hasOwnProperty$i.call(to,ue)}var _baseHas=baseHas$1,isArray$h=Array.isArray,isArray_1=isArray$h,freeGlobal$1=typeof commonjsGlobal$1=="object"&&commonjsGlobal$1&&commonjsGlobal$1.Object===Object&&commonjsGlobal$1,_freeGlobal=freeGlobal$1,freeGlobal=_freeGlobal,freeSelf=typeof self=="object"&&self&&self.Object===Object&&self,root$e=freeGlobal||freeSelf||Function("return this")(),_root=root$e,root$d=_root,Symbol$7=root$d.Symbol,_Symbol=Symbol$7,Symbol$6=_Symbol,objectProto$h=Object.prototype,hasOwnProperty$h=objectProto$h.hasOwnProperty,nativeObjectToString$1=objectProto$h.toString,symToStringTag$1=Symbol$6?Symbol$6.toStringTag:void 0;function getRawTag$1(to){var ue=hasOwnProperty$h.call(to,symToStringTag$1),eo=to[symToStringTag$1];try{to[symToStringTag$1]=void 0;var no=!0}catch{}var ro=nativeObjectToString$1.call(to);return no&&(ue?to[symToStringTag$1]=eo:delete to[symToStringTag$1]),ro}var _getRawTag=getRawTag$1,objectProto$g=Object.prototype,nativeObjectToString=objectProto$g.toString;function objectToString$3(to){return nativeObjectToString.call(to)}var _objectToString=objectToString$3,Symbol$5=_Symbol,getRawTag=_getRawTag,objectToString$2=_objectToString,nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag=Symbol$5?Symbol$5.toStringTag:void 0;function baseGetTag$7(to){return to==null?to===void 0?undefinedTag:nullTag:symToStringTag&&symToStringTag in Object(to)?getRawTag(to):objectToString$2(to)}var _baseGetTag=baseGetTag$7;function isObjectLike$b(to){return to!=null&&typeof to=="object"}var isObjectLike_1=isObjectLike$b,baseGetTag$6=_baseGetTag,isObjectLike$a=isObjectLike_1,symbolTag$3="[object Symbol]";function isSymbol$7(to){return typeof to=="symbol"||isObjectLike$a(to)&&baseGetTag$6(to)==symbolTag$3}var isSymbol_1=isSymbol$7,isArray$g=isArray_1,isSymbol$6=isSymbol_1,reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/;function isKey$3(to,ue){if(isArray$g(to))return!1;var eo=typeof to;return eo=="number"||eo=="symbol"||eo=="boolean"||to==null||isSymbol$6(to)?!0:reIsPlainProp.test(to)||!reIsDeepProp.test(to)||ue!=null&&to in Object(ue)}var _isKey=isKey$3;function isObject$d(to){var ue=typeof to;return to!=null&&(ue=="object"||ue=="function")}var isObject_1=isObject$d,baseGetTag$5=_baseGetTag,isObject$c=isObject_1,asyncTag="[object AsyncFunction]",funcTag$2="[object Function]",genTag$1="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction$3(to){if(!isObject$c(to))return!1;var ue=baseGetTag$5(to);return ue==funcTag$2||ue==genTag$1||ue==asyncTag||ue==proxyTag}var isFunction_1=isFunction$3,root$c=_root,coreJsData$1=root$c["__core-js_shared__"],_coreJsData=coreJsData$1,coreJsData=_coreJsData,maskSrcKey=function(){var to=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return to?"Symbol(src)_1."+to:""}();function isMasked$1(to){return!!maskSrcKey&&maskSrcKey in to}var _isMasked=isMasked$1,funcProto$2=Function.prototype,funcToString$2=funcProto$2.toString;function toSource$2(to){if(to!=null){try{return funcToString$2.call(to)}catch{}try{return to+""}catch{}}return""}var _toSource=toSource$2,isFunction$2=isFunction_1,isMasked=_isMasked,isObject$b=isObject_1,toSource$1=_toSource,reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor=/^\[object .+?Constructor\]$/,funcProto$1=Function.prototype,objectProto$f=Object.prototype,funcToString$1=funcProto$1.toString,hasOwnProperty$g=objectProto$f.hasOwnProperty,reIsNative=RegExp("^"+funcToString$1.call(hasOwnProperty$g).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative$1(to){if(!isObject$b(to)||isMasked(to))return!1;var ue=isFunction$2(to)?reIsNative:reIsHostCtor;return ue.test(toSource$1(to))}var _baseIsNative=baseIsNative$1;function getValue$2(to,ue){return to==null?void 0:to[ue]}var _getValue=getValue$2,baseIsNative=_baseIsNative,getValue$1=_getValue;function getNative$7(to,ue){var eo=getValue$1(to,ue);return baseIsNative(eo)?eo:void 0}var _getNative=getNative$7,getNative$6=_getNative,nativeCreate$4=getNative$6(Object,"create"),_nativeCreate=nativeCreate$4,nativeCreate$3=_nativeCreate;function hashClear$1(){this.__data__=nativeCreate$3?nativeCreate$3(null):{},this.size=0}var _hashClear=hashClear$1;function hashDelete$1(to){var ue=this.has(to)&&delete this.__data__[to];return this.size-=ue?1:0,ue}var _hashDelete=hashDelete$1,nativeCreate$2=_nativeCreate,HASH_UNDEFINED$2="__lodash_hash_undefined__",objectProto$e=Object.prototype,hasOwnProperty$f=objectProto$e.hasOwnProperty;function hashGet$1(to){var ue=this.__data__;if(nativeCreate$2){var eo=ue[to];return eo===HASH_UNDEFINED$2?void 0:eo}return hasOwnProperty$f.call(ue,to)?ue[to]:void 0}var _hashGet=hashGet$1,nativeCreate$1=_nativeCreate,objectProto$d=Object.prototype,hasOwnProperty$e=objectProto$d.hasOwnProperty;function hashHas$1(to){var ue=this.__data__;return nativeCreate$1?ue[to]!==void 0:hasOwnProperty$e.call(ue,to)}var _hashHas=hashHas$1,nativeCreate=_nativeCreate,HASH_UNDEFINED$1="__lodash_hash_undefined__";function hashSet$1(to,ue){var eo=this.__data__;return this.size+=this.has(to)?0:1,eo[to]=nativeCreate&&ue===void 0?HASH_UNDEFINED$1:ue,this}var _hashSet=hashSet$1,hashClear=_hashClear,hashDelete=_hashDelete,hashGet=_hashGet,hashHas=_hashHas,hashSet=_hashSet;function Hash$1(to){var ue=-1,eo=to==null?0:to.length;for(this.clear();++ue<eo;){var no=to[ue];this.set(no[0],no[1])}}Hash$1.prototype.clear=hashClear;Hash$1.prototype.delete=hashDelete;Hash$1.prototype.get=hashGet;Hash$1.prototype.has=hashHas;Hash$1.prototype.set=hashSet;var _Hash=Hash$1;function listCacheClear$1(){this.__data__=[],this.size=0}var _listCacheClear=listCacheClear$1;function eq$3(to,ue){return to===ue||to!==to&&ue!==ue}var eq_1=eq$3,eq$2=eq_1;function assocIndexOf$4(to,ue){for(var eo=to.length;eo--;)if(eq$2(to[eo][0],ue))return eo;return-1}var _assocIndexOf=assocIndexOf$4,assocIndexOf$3=_assocIndexOf,arrayProto=Array.prototype,splice=arrayProto.splice;function listCacheDelete$1(to){var ue=this.__data__,eo=assocIndexOf$3(ue,to);if(eo<0)return!1;var no=ue.length-1;return eo==no?ue.pop():splice.call(ue,eo,1),--this.size,!0}var _listCacheDelete=listCacheDelete$1,assocIndexOf$2=_assocIndexOf;function listCacheGet$1(to){var ue=this.__data__,eo=assocIndexOf$2(ue,to);return eo<0?void 0:ue[eo][1]}var _listCacheGet=listCacheGet$1,assocIndexOf$1=_assocIndexOf;function listCacheHas$1(to){return assocIndexOf$1(this.__data__,to)>-1}var _listCacheHas=listCacheHas$1,assocIndexOf=_assocIndexOf;function listCacheSet$1(to,ue){var eo=this.__data__,no=assocIndexOf(eo,to);return no<0?(++this.size,eo.push([to,ue])):eo[no][1]=ue,this}var _listCacheSet=listCacheSet$1,listCacheClear=_listCacheClear,listCacheDelete=_listCacheDelete,listCacheGet=_listCacheGet,listCacheHas=_listCacheHas,listCacheSet=_listCacheSet;function ListCache$4(to){var ue=-1,eo=to==null?0:to.length;for(this.clear();++ue<eo;){var no=to[ue];this.set(no[0],no[1])}}ListCache$4.prototype.clear=listCacheClear;ListCache$4.prototype.delete=listCacheDelete;ListCache$4.prototype.get=listCacheGet;ListCache$4.prototype.has=listCacheHas;ListCache$4.prototype.set=listCacheSet;var _ListCache=ListCache$4,getNative$5=_getNative,root$b=_root,Map$4=getNative$5(root$b,"Map"),_Map=Map$4,Hash=_Hash,ListCache$3=_ListCache,Map$3=_Map;function mapCacheClear$1(){this.size=0,this.__data__={hash:new Hash,map:new(Map$3||ListCache$3),string:new Hash}}var _mapCacheClear=mapCacheClear$1;function isKeyable$1(to){var ue=typeof to;return ue=="string"||ue=="number"||ue=="symbol"||ue=="boolean"?to!=="__proto__":to===null}var _isKeyable=isKeyable$1,isKeyable=_isKeyable;function getMapData$4(to,ue){var eo=to.__data__;return isKeyable(ue)?eo[typeof ue=="string"?"string":"hash"]:eo.map}var _getMapData=getMapData$4,getMapData$3=_getMapData;function mapCacheDelete$1(to){var ue=getMapData$3(this,to).delete(to);return this.size-=ue?1:0,ue}var _mapCacheDelete=mapCacheDelete$1,getMapData$2=_getMapData;function mapCacheGet$1(to){return getMapData$2(this,to).get(to)}var _mapCacheGet=mapCacheGet$1,getMapData$1=_getMapData;function mapCacheHas$1(to){return getMapData$1(this,to).has(to)}var _mapCacheHas=mapCacheHas$1,getMapData=_getMapData;function mapCacheSet$1(to,ue){var eo=getMapData(this,to),no=eo.size;return eo.set(to,ue),this.size+=eo.size==no?0:1,this}var _mapCacheSet=mapCacheSet$1,mapCacheClear=_mapCacheClear,mapCacheDelete=_mapCacheDelete,mapCacheGet=_mapCacheGet,mapCacheHas=_mapCacheHas,mapCacheSet=_mapCacheSet;function MapCache$3(to){var ue=-1,eo=to==null?0:to.length;for(this.clear();++ue<eo;){var no=to[ue];this.set(no[0],no[1])}}MapCache$3.prototype.clear=mapCacheClear;MapCache$3.prototype.delete=mapCacheDelete;MapCache$3.prototype.get=mapCacheGet;MapCache$3.prototype.has=mapCacheHas;MapCache$3.prototype.set=mapCacheSet;var _MapCache=MapCache$3,MapCache$2=_MapCache,FUNC_ERROR_TEXT$1="Expected a function";function memoize$1(to,ue){if(typeof to!="function"||ue!=null&&typeof ue!="function")throw new TypeError(FUNC_ERROR_TEXT$1);var eo=function(){var no=arguments,ro=ue?ue.apply(this,no):no[0],oo=eo.cache;if(oo.has(ro))return oo.get(ro);var io=to.apply(this,no);return eo.cache=oo.set(ro,io)||oo,io};return eo.cache=new(memoize$1.Cache||MapCache$2),eo}memoize$1.Cache=MapCache$2;var memoize_1=memoize$1,memoize=memoize_1,MAX_MEMOIZE_SIZE=500;function memoizeCapped$1(to){var ue=memoize(to,function(no){return eo.size===MAX_MEMOIZE_SIZE&&eo.clear(),no}),eo=ue.cache;return ue}var _memoizeCapped=memoizeCapped$1,memoizeCapped=_memoizeCapped,rePropName$1=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,reEscapeChar$1=/\\(\\)?/g,stringToPath$3=memoizeCapped(function(to){var ue=[];return to.charCodeAt(0)===46&&ue.push(""),to.replace(rePropName$1,function(eo,no,ro,oo){ue.push(ro?oo.replace(reEscapeChar$1,"$1"):no||eo)}),ue}),_stringToPath=stringToPath$3;function arrayMap$2(to,ue){for(var eo=-1,no=to==null?0:to.length,ro=Array(no);++eo<no;)ro[eo]=ue(to[eo],eo,to);return ro}var _arrayMap=arrayMap$2,Symbol$4=_Symbol,arrayMap$1=_arrayMap,isArray$f=isArray_1,isSymbol$5=isSymbol_1,INFINITY$2=1/0,symbolProto$2=Symbol$4?Symbol$4.prototype:void 0,symbolToString$1=symbolProto$2?symbolProto$2.toString:void 0;function baseToString$1(to){if(typeof to=="string")return to;if(isArray$f(to))return arrayMap$1(to,baseToString$1)+"";if(isSymbol$5(to))return symbolToString$1?symbolToString$1.call(to):"";var ue=to+"";return ue=="0"&&1/to==-INFINITY$2?"-0":ue}var _baseToString=baseToString$1,baseToString=_baseToString;function toString$b(to){return to==null?"":baseToString(to)}var toString_1=toString$b,isArray$e=isArray_1,isKey$2=_isKey,stringToPath$2=_stringToPath,toString$a=toString_1;function castPath$2(to,ue){return isArray$e(to)?to:isKey$2(to,ue)?[to]:stringToPath$2(toString$a(to))}var _castPath=castPath$2,baseGetTag$4=_baseGetTag,isObjectLike$9=isObjectLike_1,argsTag$3="[object Arguments]";function baseIsArguments$1(to){return isObjectLike$9(to)&&baseGetTag$4(to)==argsTag$3}var _baseIsArguments=baseIsArguments$1,baseIsArguments=_baseIsArguments,isObjectLike$8=isObjectLike_1,objectProto$c=Object.prototype,hasOwnProperty$d=objectProto$c.hasOwnProperty,propertyIsEnumerable$1=objectProto$c.propertyIsEnumerable,isArguments$4=baseIsArguments(function(){return arguments}())?baseIsArguments:function(to){return isObjectLike$8(to)&&hasOwnProperty$d.call(to,"callee")&&!propertyIsEnumerable$1.call(to,"callee")},isArguments_1=isArguments$4,MAX_SAFE_INTEGER$1=9007199254740991,reIsUint=/^(?:0|[1-9]\d*)$/;function isIndex$3(to,ue){var eo=typeof to;return ue=ue??MAX_SAFE_INTEGER$1,!!ue&&(eo=="number"||eo!="symbol"&&reIsUint.test(to))&&to>-1&&to%1==0&&to<ue}var _isIndex=isIndex$3,MAX_SAFE_INTEGER=9007199254740991;function isLength$3(to){return typeof to=="number"&&to>-1&&to%1==0&&to<=MAX_SAFE_INTEGER}var isLength_1=isLength$3,isSymbol$4=isSymbol_1,INFINITY$1=1/0;function toKey$5(to){if(typeof to=="string"||isSymbol$4(to))return to;var ue=to+"";return ue=="0"&&1/to==-INFINITY$1?"-0":ue}var _toKey=toKey$5,castPath$1=_castPath,isArguments$3=isArguments_1,isArray$d=isArray_1,isIndex$2=_isIndex,isLength$2=isLength_1,toKey$4=_toKey;function hasPath$2(to,ue,eo){ue=castPath$1(ue,to);for(var no=-1,ro=ue.length,oo=!1;++no<ro;){var io=toKey$4(ue[no]);if(!(oo=to!=null&&eo(to,io)))break;to=to[io]}return oo||++no!=ro?oo:(ro=to==null?0:to.length,!!ro&&isLength$2(ro)&&isIndex$2(io,ro)&&(isArray$d(to)||isArguments$3(to)))}var _hasPath=hasPath$2,baseHas=_baseHas,hasPath$1=_hasPath;function has$6(to,ue){return to!=null&&hasPath$1(to,ue,baseHas)}var has_1=has$6;const has$7=getDefaultExportFromCjs$1(has_1),isSchema$1=to=>to&&to.__isYupSchema__;let Condition$1=class{constructor(ue,eo){if(this.refs=ue,this.refs=ue,typeof eo=="function"){this.fn=eo;return}if(!has$7(eo,"is"))throw new TypeError("`is:` is required for `when()` conditions");if(!eo.then&&!eo.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:no,then:ro,otherwise:oo}=eo,io=typeof no=="function"?no:(...ao)=>ao.every(so=>so===no);this.fn=function(...ao){let so=ao.pop(),lo=ao.pop(),co=io(...ao)?ro:oo;if(co)return typeof co=="function"?co(lo):lo.concat(co.resolve(so))}}resolve(ue,eo){let no=this.refs.map(oo=>oo.getValue(eo==null?void 0:eo.value,eo==null?void 0:eo.parent,eo==null?void 0:eo.context)),ro=this.fn.apply(ue,no.concat(ue,eo));if(ro===void 0||ro===ue)return ue;if(!isSchema$1(ro))throw new TypeError("conditions must return a schema object");return ro.resolve(eo)}};function toArray$3(to){return to==null?[]:[].concat(to)}function _extends$8(){return _extends$8=Object.assign||function(to){for(var ue=1;ue<arguments.length;ue++){var eo=arguments[ue];for(var no in eo)Object.prototype.hasOwnProperty.call(eo,no)&&(to[no]=eo[no])}return to},_extends$8.apply(this,arguments)}let strReg$1=/\$\{\s*(\w+)\s*\}/g,ValidationError$1=class x3 extends Error{static formatError(ue,eo){const no=eo.label||eo.path||"this";return no!==eo.path&&(eo=_extends$8({},eo,{path:no})),typeof ue=="string"?ue.replace(strReg$1,(ro,oo)=>printValue$1(eo[oo])):typeof ue=="function"?ue(eo):ue}static isError(ue){return ue&&ue.name==="ValidationError"}constructor(ue,eo,no,ro){super(),this.name="ValidationError",this.value=eo,this.path=no,this.type=ro,this.errors=[],this.inner=[],toArray$3(ue).forEach(oo=>{x3.isError(oo)?(this.errors.push(...oo.errors),this.inner=this.inner.concat(oo.inner.length?oo.inner:oo)):this.errors.push(oo)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0],Error.captureStackTrace&&Error.captureStackTrace(this,x3)}};const once$2=to=>{let ue=!1;return(...eo)=>{ue||(ue=!0,to(...eo))}};function runTests$1(to,ue){let{endEarly:eo,tests:no,args:ro,value:oo,errors:io,sort:ao,path:so}=to,lo=once$2(ue),co=no.length;const uo=[];if(io=io||[],!co)return io.length?lo(new ValidationError$1(io,oo,so)):lo(null,oo);for(let fo=0;fo<no.length;fo++){const po=no[fo];po(ro,function(_o){if(_o){if(!ValidationError$1.isError(_o))return lo(_o,oo);if(eo)return _o.value=oo,lo(_o,oo);uo.push(_o)}if(--co<=0){if(uo.length&&(ao&&uo.sort(ao),io.length&&uo.push(...io),io=uo),io.length){lo(new ValidationError$1(io,oo,so),oo);return}lo(null,oo)}})}}var getNative$4=_getNative,defineProperty$2=function(){try{var to=getNative$4(Object,"defineProperty");return to({},"",{}),to}catch{}}(),_defineProperty$1=defineProperty$2,defineProperty$1=_defineProperty$1;function baseAssignValue$4(to,ue,eo){ue=="__proto__"&&defineProperty$1?defineProperty$1(to,ue,{configurable:!0,enumerable:!0,value:eo,writable:!0}):to[ue]=eo}var _baseAssignValue=baseAssignValue$4;function createBaseFor$1(to){return function(ue,eo,no){for(var ro=-1,oo=Object(ue),io=no(ue),ao=io.length;ao--;){var so=io[to?ao:++ro];if(eo(oo[so],so,oo)===!1)break}return ue}}var _createBaseFor=createBaseFor$1,createBaseFor=_createBaseFor,baseFor$1=createBaseFor(),_baseFor=baseFor$1;function baseTimes$1(to,ue){for(var eo=-1,no=Array(to);++eo<to;)no[eo]=ue(eo);return no}var _baseTimes=baseTimes$1,isBuffer$8={exports:{}};function stubFalse(){return!1}var stubFalse_1=stubFalse;isBuffer$8.exports;(function(to,ue){var eo=_root,no=stubFalse_1,ro=ue&&!ue.nodeType&&ue,oo=ro&&!0&&to&&!to.nodeType&&to,io=oo&&oo.exports===ro,ao=io?eo.Buffer:void 0,so=ao?ao.isBuffer:void 0,lo=so||no;to.exports=lo})(isBuffer$8,isBuffer$8.exports);var isBufferExports=isBuffer$8.exports,baseGetTag$3=_baseGetTag,isLength$1=isLength_1,isObjectLike$7=isObjectLike_1,argsTag$2="[object Arguments]",arrayTag$2="[object Array]",boolTag$3="[object Boolean]",dateTag$3="[object Date]",errorTag$3="[object Error]",funcTag$1="[object Function]",mapTag$5="[object Map]",numberTag$3="[object Number]",objectTag$4="[object Object]",regexpTag$3="[object RegExp]",setTag$5="[object Set]",stringTag$3="[object String]",weakMapTag$3="[object WeakMap]",arrayBufferTag$3="[object ArrayBuffer]",dataViewTag$4="[object DataView]",float32Tag$2="[object Float32Array]",float64Tag$2="[object Float64Array]",int8Tag$2="[object Int8Array]",int16Tag$2="[object Int16Array]",int32Tag$2="[object Int32Array]",uint8Tag$2="[object Uint8Array]",uint8ClampedTag$2="[object Uint8ClampedArray]",uint16Tag$2="[object Uint16Array]",uint32Tag$2="[object Uint32Array]",typedArrayTags={};typedArrayTags[float32Tag$2]=typedArrayTags[float64Tag$2]=typedArrayTags[int8Tag$2]=typedArrayTags[int16Tag$2]=typedArrayTags[int32Tag$2]=typedArrayTags[uint8Tag$2]=typedArrayTags[uint8ClampedTag$2]=typedArrayTags[uint16Tag$2]=typedArrayTags[uint32Tag$2]=!0;typedArrayTags[argsTag$2]=typedArrayTags[arrayTag$2]=typedArrayTags[arrayBufferTag$3]=typedArrayTags[boolTag$3]=typedArrayTags[dataViewTag$4]=typedArrayTags[dateTag$3]=typedArrayTags[errorTag$3]=typedArrayTags[funcTag$1]=typedArrayTags[mapTag$5]=typedArrayTags[numberTag$3]=typedArrayTags[objectTag$4]=typedArrayTags[regexpTag$3]=typedArrayTags[setTag$5]=typedArrayTags[stringTag$3]=typedArrayTags[weakMapTag$3]=!1;function baseIsTypedArray$1(to){return isObjectLike$7(to)&&isLength$1(to.length)&&!!typedArrayTags[baseGetTag$3(to)]}var _baseIsTypedArray=baseIsTypedArray$1;function baseUnary$3(to){return function(ue){return to(ue)}}var _baseUnary=baseUnary$3,_nodeUtil={exports:{}};_nodeUtil.exports;(function(to,ue){var eo=_freeGlobal,no=ue&&!ue.nodeType&&ue,ro=no&&!0&&to&&!to.nodeType&&to,oo=ro&&ro.exports===no,io=oo&&eo.process,ao=function(){try{var so=ro&&ro.require&&ro.require("util").types;return so||io&&io.binding&&io.binding("util")}catch{}}();to.exports=ao})(_nodeUtil,_nodeUtil.exports);var _nodeUtilExports=_nodeUtil.exports,baseIsTypedArray=_baseIsTypedArray,baseUnary$2=_baseUnary,nodeUtil$2=_nodeUtilExports,nodeIsTypedArray=nodeUtil$2&&nodeUtil$2.isTypedArray,isTypedArray$2=nodeIsTypedArray?baseUnary$2(nodeIsTypedArray):baseIsTypedArray,isTypedArray_1=isTypedArray$2,baseTimes=_baseTimes,isArguments$2=isArguments_1,isArray$c=isArray_1,isBuffer$7=isBufferExports,isIndex$1=_isIndex,isTypedArray$1=isTypedArray_1,objectProto$b=Object.prototype,hasOwnProperty$c=objectProto$b.hasOwnProperty;function arrayLikeKeys$2(to,ue){var eo=isArray$c(to),no=!eo&&isArguments$2(to),ro=!eo&&!no&&isBuffer$7(to),oo=!eo&&!no&&!ro&&isTypedArray$1(to),io=eo||no||ro||oo,ao=io?baseTimes(to.length,String):[],so=ao.length;for(var lo in to)(ue||hasOwnProperty$c.call(to,lo))&&!(io&&(lo=="length"||ro&&(lo=="offset"||lo=="parent")||oo&&(lo=="buffer"||lo=="byteLength"||lo=="byteOffset")||isIndex$1(lo,so)))&&ao.push(lo);return ao}var _arrayLikeKeys=arrayLikeKeys$2,objectProto$a=Object.prototype;function isPrototype$3(to){var ue=to&&to.constructor,eo=typeof ue=="function"&&ue.prototype||objectProto$a;return to===eo}var _isPrototype=isPrototype$3;function overArg$2(to,ue){return function(eo){return to(ue(eo))}}var _overArg=overArg$2,overArg$1=_overArg,nativeKeys$1=overArg$1(Object.keys,Object),_nativeKeys=nativeKeys$1,isPrototype$2=_isPrototype,nativeKeys=_nativeKeys,objectProto$9=Object.prototype,hasOwnProperty$b=objectProto$9.hasOwnProperty;function baseKeys$1(to){if(!isPrototype$2(to))return nativeKeys(to);var ue=[];for(var eo in Object(to))hasOwnProperty$b.call(to,eo)&&eo!="constructor"&&ue.push(eo);return ue}var _baseKeys=baseKeys$1,isFunction$1=isFunction_1,isLength=isLength_1;function isArrayLike$2(to){return to!=null&&isLength(to.length)&&!isFunction$1(to)}var isArrayLike_1=isArrayLike$2,arrayLikeKeys$1=_arrayLikeKeys,baseKeys=_baseKeys,isArrayLike$1=isArrayLike_1;function keys$5(to){return isArrayLike$1(to)?arrayLikeKeys$1(to):baseKeys(to)}var keys_1=keys$5,baseFor=_baseFor,keys$4=keys_1;function baseForOwn$2(to,ue){return to&&baseFor(to,ue,keys$4)}var _baseForOwn=baseForOwn$2,ListCache$2=_ListCache;function stackClear$1(){this.__data__=new ListCache$2,this.size=0}var _stackClear=stackClear$1;function stackDelete$1(to){var ue=this.__data__,eo=ue.delete(to);return this.size=ue.size,eo}var _stackDelete=stackDelete$1;function stackGet$1(to){return this.__data__.get(to)}var _stackGet=stackGet$1;function stackHas$1(to){return this.__data__.has(to)}var _stackHas=stackHas$1,ListCache$1=_ListCache,Map$2=_Map,MapCache$1=_MapCache,LARGE_ARRAY_SIZE=200;function stackSet$1(to,ue){var eo=this.__data__;if(eo instanceof ListCache$1){var no=eo.__data__;if(!Map$2||no.length<LARGE_ARRAY_SIZE-1)return no.push([to,ue]),this.size=++eo.size,this;eo=this.__data__=new MapCache$1(no)}return eo.set(to,ue),this.size=eo.size,this}var _stackSet=stackSet$1,ListCache=_ListCache,stackClear=_stackClear,stackDelete=_stackDelete,stackGet=_stackGet,stackHas=_stackHas,stackSet=_stackSet;function Stack$4(to){var ue=this.__data__=new ListCache(to);this.size=ue.size}Stack$4.prototype.clear=stackClear;Stack$4.prototype.delete=stackDelete;Stack$4.prototype.get=stackGet;Stack$4.prototype.has=stackHas;Stack$4.prototype.set=stackSet;var _Stack=Stack$4,HASH_UNDEFINED="__lodash_hash_undefined__";function setCacheAdd$1(to){return this.__data__.set(to,HASH_UNDEFINED),this}var _setCacheAdd=setCacheAdd$1;function setCacheHas$1(to){return this.__data__.has(to)}var _setCacheHas=setCacheHas$1,MapCache=_MapCache,setCacheAdd=_setCacheAdd,setCacheHas=_setCacheHas;function SetCache$1(to){var ue=-1,eo=to==null?0:to.length;for(this.__data__=new MapCache;++ue<eo;)this.add(to[ue])}SetCache$1.prototype.add=SetCache$1.prototype.push=setCacheAdd;SetCache$1.prototype.has=setCacheHas;var _SetCache=SetCache$1;function arraySome$1(to,ue){for(var eo=-1,no=to==null?0:to.length;++eo<no;)if(ue(to[eo],eo,to))return!0;return!1}var _arraySome=arraySome$1;function cacheHas$1(to,ue){return to.has(ue)}var _cacheHas=cacheHas$1,SetCache=_SetCache,arraySome=_arraySome,cacheHas=_cacheHas,COMPARE_PARTIAL_FLAG$5=1,COMPARE_UNORDERED_FLAG$3=2;function equalArrays$2(to,ue,eo,no,ro,oo){var io=eo&COMPARE_PARTIAL_FLAG$5,ao=to.length,so=ue.length;if(ao!=so&&!(io&&so>ao))return!1;var lo=oo.get(to),co=oo.get(ue);if(lo&&co)return lo==ue&&co==to;var uo=-1,fo=!0,po=eo&COMPARE_UNORDERED_FLAG$3?new SetCache:void 0;for(oo.set(to,ue),oo.set(ue,to);++uo<ao;){var ho=to[uo],_o=ue[uo];if(no)var go=io?no(_o,ho,uo,ue,to,oo):no(ho,_o,uo,to,ue,oo);if(go!==void 0){if(go)continue;fo=!1;break}if(po){if(!arraySome(ue,function(bo,vo){if(!cacheHas(po,vo)&&(ho===bo||ro(ho,bo,eo,no,oo)))return po.push(vo)})){fo=!1;break}}else if(!(ho===_o||ro(ho,_o,eo,no,oo))){fo=!1;break}}return oo.delete(to),oo.delete(ue),fo}var _equalArrays=equalArrays$2,root$a=_root,Uint8Array$3=root$a.Uint8Array,_Uint8Array=Uint8Array$3;function mapToArray$1(to){var ue=-1,eo=Array(to.size);return to.forEach(function(no,ro){eo[++ue]=[ro,no]}),eo}var _mapToArray=mapToArray$1;function setToArray$1(to){var ue=-1,eo=Array(to.size);return to.forEach(function(no){eo[++ue]=no}),eo}var _setToArray=setToArray$1,Symbol$3=_Symbol,Uint8Array$2=_Uint8Array,eq$1=eq_1,equalArrays$1=_equalArrays,mapToArray=_mapToArray,setToArray=_setToArray,COMPARE_PARTIAL_FLAG$4=1,COMPARE_UNORDERED_FLAG$2=2,boolTag$2="[object Boolean]",dateTag$2="[object Date]",errorTag$2="[object Error]",mapTag$4="[object Map]",numberTag$2="[object Number]",regexpTag$2="[object RegExp]",setTag$4="[object Set]",stringTag$2="[object String]",symbolTag$2="[object Symbol]",arrayBufferTag$2="[object ArrayBuffer]",dataViewTag$3="[object DataView]",symbolProto$1=Symbol$3?Symbol$3.prototype:void 0,symbolValueOf$1=symbolProto$1?symbolProto$1.valueOf:void 0;function equalByTag$1(to,ue,eo,no,ro,oo,io){switch(eo){case dataViewTag$3:if(to.byteLength!=ue.byteLength||to.byteOffset!=ue.byteOffset)return!1;to=to.buffer,ue=ue.buffer;case arrayBufferTag$2:return!(to.byteLength!=ue.byteLength||!oo(new Uint8Array$2(to),new Uint8Array$2(ue)));case boolTag$2:case dateTag$2:case numberTag$2:return eq$1(+to,+ue);case errorTag$2:return to.name==ue.name&&to.message==ue.message;case regexpTag$2:case stringTag$2:return to==ue+"";case mapTag$4:var ao=mapToArray;case setTag$4:var so=no&COMPARE_PARTIAL_FLAG$4;if(ao||(ao=setToArray),to.size!=ue.size&&!so)return!1;var lo=io.get(to);if(lo)return lo==ue;no|=COMPARE_UNORDERED_FLAG$2,io.set(to,ue);var co=equalArrays$1(ao(to),ao(ue),no,ro,oo,io);return io.delete(to),co;case symbolTag$2:if(symbolValueOf$1)return symbolValueOf$1.call(to)==symbolValueOf$1.call(ue)}return!1}var _equalByTag=equalByTag$1;function arrayPush$3(to,ue){for(var eo=-1,no=ue.length,ro=to.length;++eo<no;)to[ro+eo]=ue[eo];return to}var _arrayPush=arrayPush$3,arrayPush$2=_arrayPush,isArray$b=isArray_1;function baseGetAllKeys$2(to,ue,eo){var no=ue(to);return isArray$b(to)?no:arrayPush$2(no,eo(to))}var _baseGetAllKeys=baseGetAllKeys$2;function arrayFilter$1(to,ue){for(var eo=-1,no=to==null?0:to.length,ro=0,oo=[];++eo<no;){var io=to[eo];ue(io,eo,to)&&(oo[ro++]=io)}return oo}var _arrayFilter=arrayFilter$1;function stubArray$2(){return[]}var stubArray_1=stubArray$2,arrayFilter=_arrayFilter,stubArray$1=stubArray_1,objectProto$8=Object.prototype,propertyIsEnumerable=objectProto$8.propertyIsEnumerable,nativeGetSymbols$1=Object.getOwnPropertySymbols,getSymbols$3=nativeGetSymbols$1?function(to){return to==null?[]:(to=Object(to),arrayFilter(nativeGetSymbols$1(to),function(ue){return propertyIsEnumerable.call(to,ue)}))}:stubArray$1,_getSymbols=getSymbols$3,baseGetAllKeys$1=_baseGetAllKeys,getSymbols$2=_getSymbols,keys$3=keys_1;function getAllKeys$2(to){return baseGetAllKeys$1(to,keys$3,getSymbols$2)}var _getAllKeys=getAllKeys$2,getAllKeys$1=_getAllKeys,COMPARE_PARTIAL_FLAG$3=1,objectProto$7=Object.prototype,hasOwnProperty$a=objectProto$7.hasOwnProperty;function equalObjects$1(to,ue,eo,no,ro,oo){var io=eo&COMPARE_PARTIAL_FLAG$3,ao=getAllKeys$1(to),so=ao.length,lo=getAllKeys$1(ue),co=lo.length;if(so!=co&&!io)return!1;for(var uo=so;uo--;){var fo=ao[uo];if(!(io?fo in ue:hasOwnProperty$a.call(ue,fo)))return!1}var po=oo.get(to),ho=oo.get(ue);if(po&&ho)return po==ue&&ho==to;var _o=!0;oo.set(to,ue),oo.set(ue,to);for(var go=io;++uo<so;){fo=ao[uo];var bo=to[fo],vo=ue[fo];if(no)var yo=io?no(vo,bo,fo,ue,to,oo):no(bo,vo,fo,to,ue,oo);if(!(yo===void 0?bo===vo||ro(bo,vo,eo,no,oo):yo)){_o=!1;break}go||(go=fo=="constructor")}if(_o&&!go){var wo=to.constructor,ko=ue.constructor;wo!=ko&&"constructor"in to&&"constructor"in ue&&!(typeof wo=="function"&&wo instanceof wo&&typeof ko=="function"&&ko instanceof ko)&&(_o=!1)}return oo.delete(to),oo.delete(ue),_o}var _equalObjects=equalObjects$1,getNative$3=_getNative,root$9=_root,DataView$2=getNative$3(root$9,"DataView"),_DataView=DataView$2,getNative$2=_getNative,root$8=_root,Promise$2=getNative$2(root$8,"Promise"),_Promise=Promise$2,getNative$1=_getNative,root$7=_root,Set$2=getNative$1(root$7,"Set"),_Set=Set$2,getNative=_getNative,root$6=_root,WeakMap$3=getNative(root$6,"WeakMap"),_WeakMap=WeakMap$3,DataView$1=_DataView,Map$1=_Map,Promise$1=_Promise,Set$1=_Set,WeakMap$2=_WeakMap,baseGetTag$2=_baseGetTag,toSource=_toSource,mapTag$3="[object Map]",objectTag$3="[object Object]",promiseTag="[object Promise]",setTag$3="[object Set]",weakMapTag$2="[object WeakMap]",dataViewTag$2="[object DataView]",dataViewCtorString=toSource(DataView$1),mapCtorString=toSource(Map$1),promiseCtorString=toSource(Promise$1),setCtorString=toSource(Set$1),weakMapCtorString=toSource(WeakMap$2),getTag$5=baseGetTag$2;(DataView$1&&getTag$5(new DataView$1(new ArrayBuffer(1)))!=dataViewTag$2||Map$1&&getTag$5(new Map$1)!=mapTag$3||Promise$1&&getTag$5(Promise$1.resolve())!=promiseTag||Set$1&&getTag$5(new Set$1)!=setTag$3||WeakMap$2&&getTag$5(new WeakMap$2)!=weakMapTag$2)&&(getTag$5=function(to){var ue=baseGetTag$2(to),eo=ue==objectTag$3?to.constructor:void 0,no=eo?toSource(eo):"";if(no)switch(no){case dataViewCtorString:return dataViewTag$2;case mapCtorString:return mapTag$3;case promiseCtorString:return promiseTag;case setCtorString:return setTag$3;case weakMapCtorString:return weakMapTag$2}return ue});var _getTag=getTag$5,Stack$3=_Stack,equalArrays=_equalArrays,equalByTag=_equalByTag,equalObjects=_equalObjects,getTag$4=_getTag,isArray$a=isArray_1,isBuffer$6=isBufferExports,isTypedArray=isTypedArray_1,COMPARE_PARTIAL_FLAG$2=1,argsTag$1="[object Arguments]",arrayTag$1="[object Array]",objectTag$2="[object Object]",objectProto$6=Object.prototype,hasOwnProperty$9=objectProto$6.hasOwnProperty;function baseIsEqualDeep$1(to,ue,eo,no,ro,oo){var io=isArray$a(to),ao=isArray$a(ue),so=io?arrayTag$1:getTag$4(to),lo=ao?arrayTag$1:getTag$4(ue);so=so==argsTag$1?objectTag$2:so,lo=lo==argsTag$1?objectTag$2:lo;var co=so==objectTag$2,uo=lo==objectTag$2,fo=so==lo;if(fo&&isBuffer$6(to)){if(!isBuffer$6(ue))return!1;io=!0,co=!1}if(fo&&!co)return oo||(oo=new Stack$3),io||isTypedArray(to)?equalArrays(to,ue,eo,no,ro,oo):equalByTag(to,ue,so,eo,no,ro,oo);if(!(eo&COMPARE_PARTIAL_FLAG$2)){var po=co&&hasOwnProperty$9.call(to,"__wrapped__"),ho=uo&&hasOwnProperty$9.call(ue,"__wrapped__");if(po||ho){var _o=po?to.value():to,go=ho?ue.value():ue;return oo||(oo=new Stack$3),ro(_o,go,eo,no,oo)}}return fo?(oo||(oo=new Stack$3),equalObjects(to,ue,eo,no,ro,oo)):!1}var _baseIsEqualDeep=baseIsEqualDeep$1,baseIsEqualDeep=_baseIsEqualDeep,isObjectLike$6=isObjectLike_1;function baseIsEqual$2(to,ue,eo,no,ro){return to===ue?!0:to==null||ue==null||!isObjectLike$6(to)&&!isObjectLike$6(ue)?to!==to&&ue!==ue:baseIsEqualDeep(to,ue,eo,no,baseIsEqual$2,ro)}var _baseIsEqual=baseIsEqual$2,Stack$2=_Stack,baseIsEqual$1=_baseIsEqual,COMPARE_PARTIAL_FLAG$1=1,COMPARE_UNORDERED_FLAG$1=2;function baseIsMatch$1(to,ue,eo,no){var ro=eo.length,oo=ro,io=!no;if(to==null)return!oo;for(to=Object(to);ro--;){var ao=eo[ro];if(io&&ao[2]?ao[1]!==to[ao[0]]:!(ao[0]in to))return!1}for(;++ro<oo;){ao=eo[ro];var so=ao[0],lo=to[so],co=ao[1];if(io&&ao[2]){if(lo===void 0&&!(so in to))return!1}else{var uo=new Stack$2;if(no)var fo=no(lo,co,so,to,ue,uo);if(!(fo===void 0?baseIsEqual$1(co,lo,COMPARE_PARTIAL_FLAG$1|COMPARE_UNORDERED_FLAG$1,no,uo):fo))return!1}}return!0}var _baseIsMatch=baseIsMatch$1,isObject$a=isObject_1;function isStrictComparable$2(to){return to===to&&!isObject$a(to)}var _isStrictComparable=isStrictComparable$2,isStrictComparable$1=_isStrictComparable,keys$2=keys_1;function getMatchData$1(to){for(var ue=keys$2(to),eo=ue.length;eo--;){var no=ue[eo],ro=to[no];ue[eo]=[no,ro,isStrictComparable$1(ro)]}return ue}var _getMatchData=getMatchData$1;function matchesStrictComparable$2(to,ue){return function(eo){return eo==null?!1:eo[to]===ue&&(ue!==void 0||to in Object(eo))}}var _matchesStrictComparable=matchesStrictComparable$2,baseIsMatch=_baseIsMatch,getMatchData=_getMatchData,matchesStrictComparable$1=_matchesStrictComparable;function baseMatches$1(to){var ue=getMatchData(to);return ue.length==1&&ue[0][2]?matchesStrictComparable$1(ue[0][0],ue[0][1]):function(eo){return eo===to||baseIsMatch(eo,to,ue)}}var _baseMatches=baseMatches$1,castPath=_castPath,toKey$3=_toKey;function baseGet$2(to,ue){ue=castPath(ue,to);for(var eo=0,no=ue.length;to!=null&&eo<no;)to=to[toKey$3(ue[eo++])];return eo&&eo==no?to:void 0}var _baseGet=baseGet$2,baseGet$1=_baseGet;function get$4(to,ue,eo){var no=to==null?void 0:baseGet$1(to,ue);return no===void 0?eo:no}var get_1=get$4;function baseHasIn$1(to,ue){return to!=null&&ue in Object(to)}var _baseHasIn=baseHasIn$1,baseHasIn=_baseHasIn,hasPath=_hasPath;function hasIn$1(to,ue){return to!=null&&hasPath(to,ue,baseHasIn)}var hasIn_1=hasIn$1,baseIsEqual=_baseIsEqual,get$3=get_1,hasIn=hasIn_1,isKey$1=_isKey,isStrictComparable=_isStrictComparable,matchesStrictComparable=_matchesStrictComparable,toKey$2=_toKey,COMPARE_PARTIAL_FLAG=1,COMPARE_UNORDERED_FLAG=2;function baseMatchesProperty$1(to,ue){return isKey$1(to)&&isStrictComparable(ue)?matchesStrictComparable(toKey$2(to),ue):function(eo){var no=get$3(eo,to);return no===void 0&&no===ue?hasIn(eo,to):baseIsEqual(ue,no,COMPARE_PARTIAL_FLAG|COMPARE_UNORDERED_FLAG)}}var _baseMatchesProperty=baseMatchesProperty$1;function identity$5(to){return to}var identity_1=identity$5;function baseProperty$1(to){return function(ue){return ue==null?void 0:ue[to]}}var _baseProperty=baseProperty$1,baseGet=_baseGet;function basePropertyDeep$1(to){return function(ue){return baseGet(ue,to)}}var _basePropertyDeep=basePropertyDeep$1,baseProperty=_baseProperty,basePropertyDeep=_basePropertyDeep,isKey=_isKey,toKey$1=_toKey;function property$1(to){return isKey(to)?baseProperty(toKey$1(to)):basePropertyDeep(to)}var property_1=property$1,baseMatches=_baseMatches,baseMatchesProperty=_baseMatchesProperty,identity$4=identity_1,isArray$9=isArray_1,property=property_1;function baseIteratee$3(to){return typeof to=="function"?to:to==null?identity$4:typeof to=="object"?isArray$9(to)?baseMatchesProperty(to[0],to[1]):baseMatches(to):property(to)}var _baseIteratee=baseIteratee$3,baseAssignValue$3=_baseAssignValue,baseForOwn$1=_baseForOwn,baseIteratee$2=_baseIteratee;function mapValues$1(to,ue){var eo={};return ue=baseIteratee$2(ue),baseForOwn$1(to,function(no,ro,oo){baseAssignValue$3(eo,ro,ue(no,ro,oo))}),eo}var mapValues_1=mapValues$1;const mapValues$2=getDefaultExportFromCjs$1(mapValues_1);function Cache$1(to){this._maxSize=to,this.clear()}Cache$1.prototype.clear=function(){this._size=0,this._values=Object.create(null)};Cache$1.prototype.get=function(to){return this._values[to]};Cache$1.prototype.set=function(to,ue){return this._size>=this._maxSize&&this.clear(),to in this._values||this._size++,this._values[to]=ue};var SPLIT_REGEX=/[^.^\]^[]+|(?=\[\]|\.\.)/g,DIGIT_REGEX=/^\d+$/,LEAD_DIGIT_REGEX=/^\d/,SPEC_CHAR_REGEX=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,CLEAN_QUOTES_REGEX=/^\s*(['"]?)(.*?)(\1)\s*$/,MAX_CACHE_SIZE=512,pathCache=new Cache$1(MAX_CACHE_SIZE),setCache=new Cache$1(MAX_CACHE_SIZE),getCache=new Cache$1(MAX_CACHE_SIZE),propertyExpr={Cache:Cache$1,split:split$1,normalizePath,setter:function(to){var ue=normalizePath(to);return setCache.get(to)||setCache.set(to,function(no,ro){for(var oo=0,io=ue.length,ao=no;oo<io-1;){var so=ue[oo];if(so==="__proto__"||so==="constructor"||so==="prototype")return no;ao=ao[ue[oo++]]}ao[ue[oo]]=ro})},getter:function(to,ue){var eo=normalizePath(to);return getCache.get(to)||getCache.set(to,function(ro){for(var oo=0,io=eo.length;oo<io;)if(ro!=null||!ue)ro=ro[eo[oo++]];else return;return ro})},join:function(to){return to.reduce(function(ue,eo){return ue+(isQuoted(eo)||DIGIT_REGEX.test(eo)?"["+eo+"]":(ue?".":"")+eo)},"")},forEach:function(to,ue,eo){forEach$1(Array.isArray(to)?to:split$1(to),ue,eo)}};function normalizePath(to){return pathCache.get(to)||pathCache.set(to,split$1(to).map(function(ue){return ue.replace(CLEAN_QUOTES_REGEX,"$2")}))}function split$1(to){return to.match(SPLIT_REGEX)||[""]}function forEach$1(to,ue,eo){var no=to.length,ro,oo,io,ao;for(oo=0;oo<no;oo++)ro=to[oo],ro&&(shouldBeQuoted(ro)&&(ro='"'+ro+'"'),ao=isQuoted(ro),io=!ao&&/^\d+$/.test(ro),ue.call(eo,ro,ao,io,oo,to))}function isQuoted(to){return typeof to=="string"&&to&&["'",'"'].indexOf(to.charAt(0))!==-1}function hasLeadingNumber(to){return to.match(LEAD_DIGIT_REGEX)&&!to.match(DIGIT_REGEX)}function hasSpecialChars(to){return SPEC_CHAR_REGEX.test(to)}function shouldBeQuoted(to){return!isQuoted(to)&&(hasLeadingNumber(to)||hasSpecialChars(to))}const prefixes$2={context:"$",value:"."};function create$e(to,ue){return new Reference$1(to,ue)}let Reference$1=class{constructor(ue,eo={}){if(typeof ue!="string")throw new TypeError("ref must be a string, got: "+ue);if(this.key=ue.trim(),ue==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===prefixes$2.context,this.isValue=this.key[0]===prefixes$2.value,this.isSibling=!this.isContext&&!this.isValue;let no=this.isContext?prefixes$2.context:this.isValue?prefixes$2.value:"";this.path=this.key.slice(no.length),this.getter=this.path&&propertyExpr.getter(this.path,!0),this.map=eo.map}getValue(ue,eo,no){let ro=this.isContext?no:this.isValue?ue:eo;return this.getter&&(ro=this.getter(ro||{})),this.map&&(ro=this.map(ro)),ro}cast(ue,eo){return this.getValue(ue,eo==null?void 0:eo.parent,eo==null?void 0:eo.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(ue){return ue&&ue.__isYupRef}};Reference$1.prototype.__isYupRef=!0;function _extends$7(){return _extends$7=Object.assign||function(to){for(var ue=1;ue<arguments.length;ue++){var eo=arguments[ue];for(var no in eo)Object.prototype.hasOwnProperty.call(eo,no)&&(to[no]=eo[no])}return to},_extends$7.apply(this,arguments)}function _objectWithoutPropertiesLoose$1(to,ue){if(to==null)return{};var eo={},no=Object.keys(to),ro,oo;for(oo=0;oo<no.length;oo++)ro=no[oo],!(ue.indexOf(ro)>=0)&&(eo[ro]=to[ro]);return eo}function createValidation$1(to){function ue(eo,no){let{value:ro,path:oo="",label:io,options:ao,originalValue:so,sync:lo}=eo,co=_objectWithoutPropertiesLoose$1(eo,["value","path","label","options","originalValue","sync"]);const{name:uo,test:fo,params:po,message:ho}=to;let{parent:_o,context:go}=ao;function bo(So){return Reference$1.isRef(So)?So.getValue(ro,_o,go):So}function vo(So={}){const Eo=mapValues$2(_extends$7({value:ro,originalValue:so,label:io,path:So.path||oo},po,So.params),bo),Io=new ValidationError$1(ValidationError$1.formatError(So.message||ho,Eo),ro,Eo.path,So.type||uo);return Io.params=Eo,Io}let yo=_extends$7({path:oo,parent:_o,type:uo,createError:vo,resolve:bo,options:ao,originalValue:so},co);if(!lo){try{Promise.resolve(fo.call(yo,ro,yo)).then(So=>{ValidationError$1.isError(So)?no(So):So?no(null,So):no(vo())})}catch(So){no(So)}return}let wo;try{var ko;if(wo=fo.call(yo,ro,yo),typeof((ko=wo)==null?void 0:ko.then)=="function")throw new Error(`Validation test of type: "${yo.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`)}catch(So){no(So);return}ValidationError$1.isError(wo)?no(wo):wo?no(null,wo):no(vo())}return ue.OPTIONS=to,ue}let trim$1=to=>to.substr(0,to.length-1).substr(1);function getIn$1(to,ue,eo,no=eo){let ro,oo,io;return ue?(propertyExpr.forEach(ue,(ao,so,lo)=>{let co=so?trim$1(ao):ao;if(to=to.resolve({context:no,parent:ro,value:eo}),to.innerType){let uo=lo?parseInt(co,10):0;if(eo&&uo>=eo.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${ao}, in the path: ${ue}. because there is no value at that index. `);ro=eo,eo=eo&&eo[uo],to=to.innerType}if(!lo){if(!to.fields||!to.fields[co])throw new Error(`The schema does not contain the path: ${ue}. (failed at: ${io} which is a type: "${to._type}")`);ro=eo,eo=eo&&eo[co],to=to.fields[co]}oo=co,io=so?"["+ao+"]":"."+ao}),{schema:to,parent:ro,parentPath:oo}):{parent:ro,parentPath:ue,schema:to}}const reach=(to,ue,eo,no)=>getIn$1(to,ue,eo,no).schema;let ReferenceSet$1=class G3{constructor(){this.list=new Set,this.refs=new Map}get size(){return this.list.size+this.refs.size}describe(){const ue=[];for(const eo of this.list)ue.push(eo);for(const[,eo]of this.refs)ue.push(eo.describe());return ue}toArray(){return Array.from(this.list).concat(Array.from(this.refs.values()))}add(ue){Reference$1.isRef(ue)?this.refs.set(ue.key,ue):this.list.add(ue)}delete(ue){Reference$1.isRef(ue)?this.refs.delete(ue.key):this.list.delete(ue)}has(ue,eo){if(this.list.has(ue))return!0;let no,ro=this.refs.values();for(;no=ro.next(),!no.done;)if(eo(no.value)===ue)return!0;return!1}clone(){const ue=new G3;return ue.list=new Set(this.list),ue.refs=new Map(this.refs),ue}merge(ue,eo){const no=this.clone();return ue.list.forEach(ro=>no.add(ro)),ue.refs.forEach(ro=>no.add(ro)),eo.list.forEach(ro=>no.delete(ro)),eo.refs.forEach(ro=>no.delete(ro)),no}};function _extends$6(){return _extends$6=Object.assign||function(to){for(var ue=1;ue<arguments.length;ue++){var eo=arguments[ue];for(var no in eo)Object.prototype.hasOwnProperty.call(eo,no)&&(to[no]=eo[no])}return to},_extends$6.apply(this,arguments)}let BaseSchema$1=class{constructor(ue){this.deps=[],this.conditions=[],this._whitelist=new ReferenceSet$1,this._blacklist=new ReferenceSet$1,this.exclusiveTests=Object.create(null),this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(mixed$1.notType)}),this.type=(ue==null?void 0:ue.type)||"mixed",this.spec=_extends$6({strip:!1,strict:!1,abortEarly:!0,recursive:!0,nullable:!1,presence:"optional"},ue==null?void 0:ue.spec)}get _type(){return this.type}_typeCheck(ue){return!0}clone(ue){if(this._mutate)return ue&&Object.assign(this.spec,ue),this;const eo=Object.create(Object.getPrototypeOf(this));return eo.type=this.type,eo._typeError=this._typeError,eo._whitelistError=this._whitelistError,eo._blacklistError=this._blacklistError,eo._whitelist=this._whitelist.clone(),eo._blacklist=this._blacklist.clone(),eo.exclusiveTests=_extends$6({},this.exclusiveTests),eo.deps=[...this.deps],eo.conditions=[...this.conditions],eo.tests=[...this.tests],eo.transforms=[...this.transforms],eo.spec=clone$3(_extends$6({},this.spec,ue)),eo}label(ue){var eo=this.clone();return eo.spec.label=ue,eo}meta(...ue){if(ue.length===0)return this.spec.meta;let eo=this.clone();return eo.spec.meta=Object.assign(eo.spec.meta||{},ue[0]),eo}withMutation(ue){let eo=this._mutate;this._mutate=!0;let no=ue(this);return this._mutate=eo,no}concat(ue){if(!ue||ue===this)return this;if(ue.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${ue.type}`);let eo=this,no=ue.clone();const ro=_extends$6({},eo.spec,no.spec);return no.spec=ro,no._typeError||(no._typeError=eo._typeError),no._whitelistError||(no._whitelistError=eo._whitelistError),no._blacklistError||(no._blacklistError=eo._blacklistError),no._whitelist=eo._whitelist.merge(ue._whitelist,ue._blacklist),no._blacklist=eo._blacklist.merge(ue._blacklist,ue._whitelist),no.tests=eo.tests,no.exclusiveTests=eo.exclusiveTests,no.withMutation(oo=>{ue.tests.forEach(io=>{oo.test(io.OPTIONS)})}),no}isType(ue){return this.spec.nullable&&ue===null?!0:this._typeCheck(ue)}resolve(ue){let eo=this;if(eo.conditions.length){let no=eo.conditions;eo=eo.clone(),eo.conditions=[],eo=no.reduce((ro,oo)=>oo.resolve(ro,ue),eo),eo=eo.resolve(ue)}return eo}cast(ue,eo={}){let no=this.resolve(_extends$6({value:ue},eo)),ro=no._cast(ue,eo);if(ue!==void 0&&eo.assert!==!1&&no.isType(ro)!==!0){let oo=printValue$1(ue),io=printValue$1(ro);throw new TypeError(`The value of ${eo.path||"field"} could not be cast to a value that satisfies the schema type: "${no._type}".
|
|
32
|
+
}`;var rl=Lh(function(){return Us(ca,Rs+"return "+ps).apply(eo,Sa)});if(rl.source=ps,Ch(rl))throw rl;return rl}function Ph($o){return wc($o).toLowerCase()}function O_($o){return wc($o).toUpperCase()}function s3($o,Oo,Lo){if($o=wc($o),$o&&(Lo||Oo===eo))return Gp($o);if(!$o||!(Oo=o1(Oo)))return $o;var Go=O1($o),oa=O1(Oo),ca=y0(Go,oa),Sa=lu(Go,oa)+1;return A0(Go,ca,Sa).join("")}function l3($o,Oo,Lo){if($o=wc($o),$o&&(Lo||Oo===eo))return $o.slice(0,Qp($o)+1);if(!$o||!(Oo=o1(Oo)))return $o;var Go=O1($o),oa=lu(Go,O1(Oo))+1;return A0(Go,0,oa).join("")}function c3($o,Oo,Lo){if($o=wc($o),$o&&(Lo||Oo===eo))return $o.replace(_l,"");if(!$o||!(Oo=o1(Oo)))return $o;var Go=O1($o),oa=y0(Go,O1(Oo));return A0(Go,oa).join("")}function Y2($o,Oo){var Lo=To,Go=Mo;if(Ru(Oo)){var oa="separator"in Oo?Oo.separator:oa;Lo="length"in Oo?Pl(Oo.length):Lo,Go="omission"in Oo?o1(Oo.omission):Go}$o=wc($o);var ca=$o.length;if(vu($o)){var Sa=O1($o);ca=Sa.length}if(Lo>=ca)return $o;var za=Lo-Pf(Go);if(za<1)return Go;var Va=Sa?A0(Sa,0,za).join(""):$o.slice(0,za);if(oa===eo)return Va+Go;if(Sa&&(za+=Va.length-za),Hp(oa)){if($o.slice(za).search(oa)){var as,Ka=Va;for(oa.global||(oa=mp(oa.source,wc(iu.exec(oa))+"g")),oa.lastIndex=0;as=oa.exec(Ka);)var ps=as.index;Va=Va.slice(0,ps===eo?za:ps)}}else if($o.indexOf(o1(oa),za)!=za){var Os=Va.lastIndexOf(oa);Os>-1&&(Va=Va.slice(0,Os))}return Va+Go}function Zl($o){return $o=wc($o),$o&&yl.test($o)?$o.replace(Ms,Yp):$o}var u3=bd(function($o,Oo,Lo){return $o+(Lo?" ":"")+Oo.toUpperCase()}),tp=i2("toUpperCase");function E_($o,Oo,Lo){return $o=wc($o),Oo=Lo?eo:Oo,Oo===eo?yu($o)?R2($o):E2($o):$o.match(Oo)||[]}var Lh=Nl(function($o,Oo){try{return k1($o,eo,Oo)}catch(Lo){return Ch(Lo)?Lo:new Vs(Lo)}}),Dh=Y0(function($o,Oo){return D1(Oo,function(Lo){Lo=Hc(Lo),jc($o,Lo,g0($o[Lo],$o))}),$o});function A_($o){var Oo=$o==null?0:$o.length,Lo=Rl();return $o=Oo?nl($o,function(Go){if(typeof Go[1]!="function")throw new n0(io);return[Lo(Go[0]),Go[1]]}):[],Nl(function(Go){for(var oa=-1;++oa<Oo;){var ca=$o[oa];if(k1(ca[0],this,Go))return k1(ca[1],this,Go)}})}function Em($o){return N2(Wc($o,uo))}function Bh($o){return function(){return $o}}function f3($o,Oo){return $o==null||$o!==$o?Oo:$o}var d3=a2(),T_=a2(!0);function Q1($o){return $o}function Nh($o){return lc(typeof $o=="function"?$o:Wc($o,uo))}function p3($o){return V2(Wc($o,uo))}function m3($o,Oo){return W0($o,Wc(Oo,uo))}var h3=Nl(function($o,Oo){return function(Lo){return wu(Lo,$o,Oo)}}),_3=Nl(function($o,Oo){return function(Lo){return wu($o,Lo,Oo)}});function Hh($o,Oo,Lo){var Go=L1(Oo),oa=ud(Oo,Go);Lo==null&&!(Ru(Oo)&&(oa.length||!Go.length))&&(Lo=Oo,Oo=$o,$o=this,oa=ud(Oo,L1(Oo)));var ca=!(Ru(Lo)&&"chain"in Lo)||!!Lo.chain,Sa=Xf($o);return D1(oa,function(za){var Va=Oo[za];$o[za]=Va,Sa&&($o.prototype[za]=function(){var as=this.__chain__;if(ca||as){var Ka=$o(this.__wrapped__),ps=Ka.__actions__=v1(this.__actions__);return ps.push({func:Va,args:arguments,thisArg:$o}),Ka.__chain__=as,Ka}return Va.apply($o,el([this.value()],arguments))})}),$o}function g3(){return mc._===this&&(mc._=Ec),this}function Vh(){}function I_($o){return $o=Pl($o),Nl(function(Oo){return tc(Oo,$o)})}var b3=l2(nl),v3=l2($s),M_=l2(S1);function Fh($o){return xo($o)?T2(Hc($o)):Rm($o)}function y3($o){return function(Oo){return $o==null?eo:q0($o,Oo)}}var $3=yf(),w3=yf(!0);function Uh(){return[]}function qh(){return!1}function k3(){return{}}function C3(){return""}function xh(){return!0}function z_($o,Oo){if($o=Pl($o),$o<1||$o>Uo)return[];var Lo=Qo,Go=bc($o,Qo);Oo=Rl(Oo),$o-=Qo;for(var oa=C1(Go,Oo);++Lo<$o;)Oo(Lo);return oa}function O3($o){return Fl($o)?nl($o,Hc):Cf($o)?[$o]:v1(Tc(wc($o)))}function E3($o){var Oo=++A1;return wc($o)+Oo}var A3=fu(function($o,Oo){return $o+Oo},0),T3=Z2("ceil"),I3=fu(function($o,Oo){return $o/Oo},1),M3=Z2("floor");function z3($o){return $o&&$o.length?Zc($o,Q1,Fu):eo}function R3($o,Oo){return $o&&$o.length?Zc($o,Rl(Oo,2),Fu):eo}function P3($o){return rf($o,Q1)}function L3($o,Oo){return rf($o,Rl(Oo,2))}function D3($o){return $o&&$o.length?Zc($o,Q1,Tu):eo}function B3($o,Oo){return $o&&$o.length?Zc($o,Rl(Oo,2),Tu):eo}var N3=fu(function($o,Oo){return $o*Oo},1),H3=Z2("round"),V3=fu(function($o,Oo){return $o-Oo},0);function F3($o){return $o&&$o.length?R0($o,Q1):0}function U3($o,Oo){return $o&&$o.length?R0($o,Rl(Oo,2)):0}return Ba.after=ug,Ba.ary=Gm,Ba.assign=Bm,Ba.assignIn=lh,Ba.assignInWith=Fp,Ba.assignWith=Nm,Ba.at=Hm,Ba.before=n_,Ba.bind=g0,Ba.bindAll=Dh,Ba.bindKey=Xm,Ba.castArray=vg,Ba.chain=gm,Ba.chunk=zu,Ba.compact=du,Ba.concat=pu,Ba.cond=A_,Ba.conforms=Em,Ba.constant=Bh,Ba.countBy=x_,Ba.create=ch,Ba.curry=r_,Ba.curryRight=o_,Ba.debounce=Qm,Ba.defaults=km,Ba.defaultsDeep=Tg,Ba.defer=fg,Ba.delay=yh,Ba.difference=Yc,Ba.differenceBy=y1,Ba.differenceWith=Yd,Ba.drop=Zf,Ba.dropRight=Qu,Ba.dropRightWhile=K0,Ba.dropWhile=mu,Ba.fill=h2,Ba.filter=W_,Ba.flatMap=Kh,Ba.flatMapDeep=G_,Ba.flatMapDepth=X_,Ba.flatten=hu,Ba.flattenDeep=Jl,Ba.flattenDepth=Kd,Ba.flip=dg,Ba.flow=d3,Ba.flowRight=T_,Ba.fromPairs=Q2,Ba.functions=h_,Ba.functionsIn=Sm,Ba.groupBy=Q_,Ba.initial=gh,Ba.intersection=Lm,Ba.intersectionBy=bh,Ba.intersectionWith=wd,Ba.invert=g_,Ba.invertBy=b_,Ba.invokeMap=K_,Ba.iteratee=Nh,Ba.keyBy=J_,Ba.keys=L1,Ba.keysIn=I0,Ba.map=Wm,Ba.mapKeys=Lg,Ba.mapValues=Th,Ba.matches=p3,Ba.matchesProperty=m3,Ba.memoize=Dm,Ba.merge=Ih,Ba.mergeWith=Mh,Ba.method=h3,Ba.methodOf=_3,Ba.mixin=Hh,Ba.negate=Ym,Ba.nthArg=I_,Ba.omit=v0,Ba.omitBy=Dg,Ba.once=$h,Ba.orderBy=eg,Ba.over=b3,Ba.overArgs=wh,Ba.overEvery=v3,Ba.overSome=M_,Ba.partial=kh,Ba.partialRight=i_,Ba.partition=tg,Ba.pick=v_,Ba.pickBy=Cm,Ba.property=Fh,Ba.propertyOf=y3,Ba.pull=vh,Ba.pullAll=Bo,Ba.pullAllBy=Wo,Ba.pullAllWith=na,Ba.pullAt=ha,Ba.range=$3,Ba.rangeRight=w3,Ba.rearg=pg,Ba.reject=og,Ba.remove=Ta,Ba.rest=mg,Ba.reverse=Ua,Ba.sampleSize=ag,Ba.set=y_,Ba.setWith=Bg,Ba.shuffle=sg,Ba.slice=Ya,Ba.sortBy=t_,Ba.sortedUniq=ml,Ba.sortedUniqBy=hl,Ba.split=C_,Ba.spread=hg,Ba.tail=Es,Ba.take=Js,Ba.takeRight=zl,Ba.takeRightWhile=ll,Ba.takeWhile=Vl,Ba.tap=bm,Ba.throttle=_g,Ba.thru=Jd,Ba.toArray=p_,Ba.toPairs=$_,Ba.toPairsIn=w_,Ba.toPath=O3,Ba.toPlainObject=Ah,Ba.transform=Ng,Ba.unary=gg,Ba.union=Tl,Ba.unionBy=a1,Ba.unionWith=Dl,Ba.uniq=xl,Ba.uniqBy=Z1,Ba.uniqWith=G1,Ba.unset=Hg,Ba.unzip=_0,Ba.unzipWith=Kc,Ba.update=Vg,Ba.updateWith=Fg,Ba.values=Om,Ba.valuesIn=Ug,Ba.without=wf,Ba.words=E_,Ba.wrap=bg,Ba.xor=kf,Ba.xorBy=Lp,Ba.xorWith=Dp,Ba.zip=Sf,Ba.zipObject=Yu,Ba.zipObjectDeep=X1,Ba.zipWith=_m,Ba.entries=$_,Ba.entriesIn=w_,Ba.extend=lh,Ba.extendWith=Fp,Hh(Ba,Ba),Ba.add=A3,Ba.attempt=Lh,Ba.camelCase=Wg,Ba.capitalize=k_,Ba.ceil=T3,Ba.clamp=qg,Ba.clone=yg,Ba.cloneDeep=wg,Ba.cloneDeepWith=kg,Ba.cloneWith=$g,Ba.conformsTo=Sg,Ba.deburr=S_,Ba.defaultTo=f3,Ba.divide=I3,Ba.endsWith=Zg,Ba.eq=Lc,Ba.escape=Gg,Ba.escapeRegExp=Xg,Ba.every=j_,Ba.find=Z_,Ba.findIndex=J0,Ba.findKey=Ig,Ba.findLast=Yh,Ba.findLastIndex=qu,Ba.findLastKey=Mg,Ba.floor=M3,Ba.forEach=Jh,Ba.forEachRight=e_,Ba.forIn=zg,Ba.forInRight=Rg,Ba.forOwn=uh,Ba.forOwnRight=Vm,Ba.get=ep,Ba.gt=Km,Ba.gte=Sh,Ba.has=__,Ba.hasIn=Fm,Ba.head=qm,Ba.identity=Q1,Ba.includes=Y_,Ba.indexOf=_h,Ba.inRange=xg,Ba.invoke=Pg,Ba.isArguments=_2,Ba.isArray=Fl,Ba.isArrayBuffer=gu,Ba.isArrayLike=b0,Ba.isArrayLikeObject=Ku,Ba.isBoolean=Gf,Ba.isBuffer=kd,Ba.isDate=Cg,Ba.isElement=wm,Ba.isEmpty=Jm,Ba.isEqual=eh,Ba.isEqualWith=Dc,Ba.isError=Ch,Ba.isFinite=a_,Ba.isFunction=Xf,Ba.isInteger=s_,Ba.isLength=th,Ba.isMap=Bp,Ba.isMatch=nh,Ba.isMatchWith=l_,Ba.isNaN=rh,Ba.isNative=c_,Ba.isNil=oh,Ba.isNull=u_,Ba.isNumber=Oh,Ba.isObject=Ru,Ba.isObjectLike=bu,Ba.isPlainObject=Np,Ba.isRegExp=Hp,Ba.isSafeInteger=ih,Ba.isSet=f_,Ba.isString=ah,Ba.isSymbol=Cf,Ba.isTypedArray=Vp,Ba.isUndefined=sh,Ba.isWeakMap=Eh,Ba.isWeakSet=Og,Ba.join=xm,Ba.kebabCase=Qg,Ba.last=W1,Ba.lastIndexOf=_u,Ba.lowerCase=Yg,Ba.lowerFirst=Kg,Ba.lt=d_,Ba.lte=Eg,Ba.max=z3,Ba.maxBy=R3,Ba.mean=P3,Ba.meanBy=L3,Ba.min=D3,Ba.minBy=B3,Ba.stubArray=Uh,Ba.stubFalse=qh,Ba.stubObject=k3,Ba.stubString=C3,Ba.stubTrue=xh,Ba.multiply=N3,Ba.nth=ku,Ba.noConflict=g3,Ba.noop=Vh,Ba.now=Zm,Ba.pad=Jg,Ba.padEnd=e3,Ba.padStart=t3,Ba.parseInt=n3,Ba.random=jg,Ba.reduce=ng,Ba.reduceRight=rg,Ba.repeat=r3,Ba.replace=fh,Ba.result=zh,Ba.round=H3,Ba.runInContext=Pa,Ba.sample=ig,Ba.size=lg,Ba.snakeCase=Rh,Ba.some=cg,Ba.sortedIndex=gs,Ba.sortedIndexBy=vs,Ba.sortedIndexOf=Is,Ba.sortedLastIndex=Ls,Ba.sortedLastIndexBy=Zs,Ba.sortedLastIndexOf=al,Ba.startCase=o3,Ba.startsWith=i3,Ba.subtract=V3,Ba.sum=F3,Ba.sumBy=U3,Ba.template=a3,Ba.times=z_,Ba.toFinite=Jc,Ba.toInteger=Pl,Ba.toLength=m_,Ba.toLower=Ph,Ba.toNumber=Qf,Ba.toSafeInteger=Ag,Ba.toString=wc,Ba.toUpper=O_,Ba.trim=s3,Ba.trimEnd=l3,Ba.trimStart=c3,Ba.truncate=Y2,Ba.unescape=Zl,Ba.uniqueId=E3,Ba.upperCase=u3,Ba.upperFirst=tp,Ba.each=Jh,Ba.eachRight=e_,Ba.first=qm,Hh(Ba,function(){var $o={};return j1(Ba,function(Oo,Lo){ic.call(Ba.prototype,Lo)||($o[Lo]=Oo)}),$o}(),{chain:!1}),Ba.VERSION=no,D1(["bind","bindKey","curry","curryRight","partial","partialRight"],function($o){Ba[$o].placeholder=Ba}),D1(["drop","take"],function($o,Oo){wl.prototype[$o]=function(Lo){Lo=Lo===eo?1:Mc(Pl(Lo),0);var Go=this.__filtered__&&!Oo?new wl(this):this.clone();return Go.__filtered__?Go.__takeCount__=bc(Lo,Go.__takeCount__):Go.__views__.push({size:bc(Lo,Qo),type:$o+(Go.__dir__<0?"Right":"")}),Go},wl.prototype[$o+"Right"]=function(Lo){return this.reverse()[$o](Lo).reverse()}}),D1(["filter","map","takeWhile"],function($o,Oo){var Lo=Oo+1,Go=Lo==Po||Lo==Do;wl.prototype[$o]=function(oa){var ca=this.clone();return ca.__iteratees__.push({iteratee:Rl(oa,3),type:Lo}),ca.__filtered__=ca.__filtered__||Go,ca}}),D1(["head","last"],function($o,Oo){var Lo="take"+(Oo?"Right":"");wl.prototype[$o]=function(){return this[Lo](1).value()[0]}}),D1(["initial","tail"],function($o,Oo){var Lo="drop"+(Oo?"":"Right");wl.prototype[$o]=function(){return this.__filtered__?new wl(this):this[Lo](1)}}),wl.prototype.compact=function(){return this.filter(Q1)},wl.prototype.find=function($o){return this.filter($o).head()},wl.prototype.findLast=function($o){return this.reverse().find($o)},wl.prototype.invokeMap=Nl(function($o,Oo){return typeof $o=="function"?new wl(this):this.map(function(Lo){return wu(Lo,$o,Oo)})}),wl.prototype.reject=function($o){return this.filter(Ym(Rl($o)))},wl.prototype.slice=function($o,Oo){$o=Pl($o);var Lo=this;return Lo.__filtered__&&($o>0||Oo<0)?new wl(Lo):($o<0?Lo=Lo.takeRight(-$o):$o&&(Lo=Lo.drop($o)),Oo!==eo&&(Oo=Pl(Oo),Lo=Oo<0?Lo.dropRight(-Oo):Lo.take(Oo-$o)),Lo)},wl.prototype.takeRightWhile=function($o){return this.reverse().takeWhile($o).reverse()},wl.prototype.toArray=function(){return this.take(Qo)},j1(wl.prototype,function($o,Oo){var Lo=/^(?:filter|find|map|reject)|While$/.test(Oo),Go=/^(?:head|last)$/.test(Oo),oa=Ba[Go?"take"+(Oo=="last"?"Right":""):Oo],ca=Go||/^find/.test(Oo);oa&&(Ba.prototype[Oo]=function(){var Sa=this.__wrapped__,za=Go?[1]:arguments,Va=Sa instanceof wl,as=za[0],Ka=Va||Fl(Sa),ps=function(cl){var fl=oa.apply(Ba,el([cl],za));return Go&&Os?fl[0]:fl};Ka&&Lo&&typeof as=="function"&&as.length!=1&&(Va=Ka=!1);var Os=this.__chain__,Rs=!!this.__actions__.length,Fs=ca&&!Os,rl=Va&&!Rs;if(!ca&&Ka){Sa=rl?Sa:new wl(this);var xs=$o.apply(Sa,za);return xs.__actions__.push({func:Jd,args:[ps],thisArg:eo}),new ac(xs,Os)}return Fs&&rl?$o.apply(this,za):(xs=this.thru(ps),Fs?Go?xs.value()[0]:xs.value():xs)})}),D1(["pop","push","shift","sort","splice","unshift"],function($o){var Oo=p1[$o],Lo=/^(?:push|sort|unshift)$/.test($o)?"tap":"thru",Go=/^(?:pop|shift)$/.test($o);Ba.prototype[$o]=function(){var oa=arguments;if(Go&&!this.__chain__){var ca=this.value();return Oo.apply(Fl(ca)?ca:[],oa)}return this[Lo](function(Sa){return Oo.apply(Fl(Sa)?Sa:[],oa)})}}),j1(wl.prototype,function($o,Oo){var Lo=Ba[Oo];if(Lo){var Go=Lo.name+"";ic.call(pc,Go)||(pc[Go]=[]),pc[Go].push({name:Oo,func:Lo})}}),pc[vd(eo,bo).name]=[{name:"wrapper",func:eo}],wl.prototype.clone=uu,wl.prototype.reverse=Dd,wl.prototype.value=zm,Ba.prototype.at=jm,Ba.prototype.chain=vm,Ba.prototype.commit=ym,Ba.prototype.next=V_,Ba.prototype.plant=U_,Ba.prototype.reverse=q_,Ba.prototype.toJSON=Ba.prototype.valueOf=Ba.prototype.value=$m,Ba.prototype.first=Ba.prototype.head,Df&&(Ba.prototype[Df]=F_),Ba},d1=Md();Tf?((Tf.exports=d1)._=d1,tf._=d1):mc._=d1}).call(commonjsGlobal$1)})(lodash$2,lodash$2.exports);var lodashExports=lodash$2.exports;const _$3=getDefaultExportFromCjs$1(lodashExports),FILTER_ALLOWED_KEYS=["field","operator","value","type","externalType","valueType","noValue","formulaType"];function unreachable(to,ue){const eo=(ue==null?void 0:ue.message)||`No such case in exhaustive switch: ${to}`;if(!!!(ue!=null&&ue.doNotThrow))throw new Error(eo)}function hasSchema(to){return typeof to=="object"&&!Array.isArray(to)&&to!==null&&!(to instanceof Date)&&Object.keys(to).length>0}function trimOtherProps(to,ue){return Object.keys(to).filter(no=>ue.includes(no)).reduce((no,ro)=>({...no,[ro]:to[ro]}),{})}function isSupportedUserSearch(to){const ue=[{op:BasicOperator.STRING,key:"email"},{op:BasicOperator.EQUAL,key:"_id"},{op:ArrayOperator.ONE_OF,key:"_id"}];for(const[eo,no]of Object.entries(to)){if(typeof no!="object")return!1;if(isLogicalSearchOperator(eo)){for(const io of to[eo].conditions)if(!isSupportedUserSearch(io))return!1;return!0}const ro=Object.keys(no||{});if(ro.length===0)continue;if(!ue.find(io=>io.op===eo&&ro.length===1&&ro[0]===io.key))return!1}return!0}function processSearchFilters(to){if(!to||to.length===0)return;const{allOr:ue,onEmptyFilter:eo,filters:no}=splitFiltersArray(to);return{logicalOperator:UILogicalOperator.ALL,onEmptyFilter:eo||EmptyFilterOption.RETURN_ALL,groups:[{logicalOperator:ue?UILogicalOperator.ANY:UILogicalOperator.ALL,filters:no.map(ro=>{const oo=_$3.pick(ro,FILTER_ALLOWED_KEYS);return oo.field=removeKeyNumbering(oo.field),oo})}]}}const deepGet$1=(to,ue)=>{if(!to||!ue)return null;if(Object.prototype.hasOwnProperty.call(to,ue))return to[ue];const eo=ue.split(".");for(let no=0;no<eo.length;no++)to=to==null?void 0:to[eo[no]];return to},getUserInitials=to=>{var eo;if(!to)return"?";let ue="";return ue+=to.firstName?to.firstName[0]:"",ue+=to.lastName?to.lastName[0]:"",ue!==""?ue:((eo=to.email)==null?void 0:eo[0])||"U"},getUserColor=to=>{let ue=to==null?void 0:to._id;if(!ue)return"var(--spectrum-global-color-blue-400)";ue=ue.replace("ro_ta_users_","");let eo=1;for(let no=0;no<ue.length;no++)eo+=ue.charCodeAt(no),eo=eo%36;return`hsl(${eo*10}, 50%, 40%)`},getUserLabel=to=>{if(!to)return"";const{firstName:ue,lastName:eo,email:no}=to;return ue&&eo?`${ue} ${eo}`:ue||eo||no};function isSQL(to){return!to||!to.source?!1:[SourceName.POSTGRES,SourceName.SQL_SERVER,SourceName.MYSQL,SourceName.ORACLE].indexOf(to.source)!==-1||to.isSQL===!0}var lib$b={exports:{}},result$1={};(function(to){Object.defineProperty(to,"__esModule",{value:!0}),to.Err=to.Valid=to.err=to.valid=void 0;const ue=oo=>new no(oo);to.valid=ue;const eo=oo=>new ro(oo);to.err=eo;class no{constructor(io){this.value=io}isValid(){return!0}isError(){return!this.isValid()}getValue(){return this.value}getError(){throw new Error("Tried to get error from a valid.")}map(io){return(0,to.valid)(io(this.value))}mapErr(io){return(0,to.valid)(this.value)}}to.Valid=no;class ro{constructor(io){this.error=io}isError(){return!0}isValid(){return!this.isError()}getValue(){throw new Error("Tried to get success value from an error.")}getError(){return this.error}map(io){return(0,to.err)(this.error)}mapErr(io){return(0,to.err)(io(this.error))}}to.Err=ro})(result$1);var secondChecker={},helper={},hasRequiredHelper;function requireHelper(){if(hasRequiredHelper)return helper;hasRequiredHelper=1,Object.defineProperty(helper,"__esModule",{value:!0}),requireLib();const to=result$1,ue=["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],eo=["sun","mon","tue","wed","thu","fri","sat"],no=(co,uo)=>uo[co].lowerLimit===uo.preset[co].minValue&&uo[co].upperLimit===uo.preset[co].maxValue,ro=(co,uo,fo)=>{if(uo==="months"&&fo.useAliases&&ue.indexOf(co.toLowerCase())!==-1||uo==="daysOfWeek"&&fo.useAliases&&eo.indexOf(co.toLowerCase())!==-1)return(0,to.valid)(!0);const po=Number(co);if(isNaN(po))return(0,to.err)(`Element '${co} of ${uo} field is invalid.`);const{lowerLimit:ho}=fo[uo],{upperLimit:_o}=fo[uo];return ho&&po<ho?(0,to.err)(`Number ${po} of ${uo} field is smaller than lower limit '${ho}'`):_o&&po>_o?(0,to.err)(`Number ${po} of ${uo} field is bigger than upper limit '${_o}'`):(0,to.valid)(!0)},oo=(co,uo,fo)=>{if(co==="*")return no(uo,fo)?(0,to.valid)(!0):(0,to.err)(`Field ${uo} uses wildcard '*', but is limited to ${fo[uo].lowerLimit}-${fo[uo].upperLimit}`);if(co==="")return(0,to.err)(`One of the elements is empty in ${uo} field.`);if(uo==="daysOfMonth"&&fo.useLastDayOfMonth&&co==="L")return(0,to.valid)(!0);if(uo==="daysOfWeek"&&fo.useLastDayOfWeek&&co.endsWith("L")){const po=co.slice(0,-1);return po===""?(0,to.valid)(!0):ro(po,uo,fo)}if(uo==="daysOfMonth"&&fo.useNearestWeekday&&co.endsWith("W")){const po=co.slice(0,-1);return po===""?(0,to.err)("The 'W' must be preceded by a day"):fo.useLastDayOfMonth&&po==="L"?(0,to.valid)(!0):ro(po,uo,fo)}if(uo==="daysOfWeek"&&fo.useNthWeekdayOfMonth&&co.indexOf("#")!==-1){const[po,ho,..._o]=co.split("#");if(_o.length!==0)return(0,to.err)(`Unexpected number of '#' in ${co}, can only be used once.`);const go=Number(ho);return!ho||isNaN(go)?(0,to.err)(`Unexpected value following the '#' symbol, a positive number was expected but found ${ho}.`):go>5?(0,to.err)("Number of occurrence of the day of the week cannot be greater than 5."):ro(po,uo,fo)}return ro(co,uo,fo)},io=(co,uo,fo,po)=>co==="*"?(0,to.err)(`'*' can't be part of a range in ${uo} field.`):co===""?(0,to.err)(`One of the range elements is empty in ${uo} field.`):fo.useLastDayOfMonth&&uo==="daysOfMonth"&&co==="L"&&po===0?(0,to.valid)(!0):ro(co,uo,fo),ao=(co,uo,fo)=>{const po=co.split("-");if(po.length>2)return(0,to.err)(`List element '${co}' is not valid. (More than one '-')`);if(po.length===1)return oo(po[0],uo,fo);if(po.length===2){const ho=io(po[0],uo,fo,0),_o=io(po[1],uo,fo,1);return ho.isError()?ho:_o.isError()?_o:Number(po[0])>Number(po[1])?(0,to.err)(`Lower range end '${po[0]}' is bigger than upper range end '${po[1]}' of ${uo} field.`):(0,to.valid)(!0)}return(0,to.err)("Some other error in checkFirstStepElement (rangeArray less than 1)")},so=(co,uo,fo)=>{const po=co.split("/");if(po.length>2)return(0,to.err)(`List element '${co}' is not valid. (More than one '/')`);const ho=ao(po[0],uo,fo);if(ho.isError())return ho;if(po.length===2){const _o=po[1];if(!_o)return(0,to.err)(`Second step element '${_o}' of '${co}' is not valid (doesnt exist).`);if(isNaN(Number(_o)))return(0,to.err)(`Second step element '${_o}' of '${co}' is not valid (not a number).`);if(Number(_o)===0)return(0,to.err)(`Second step element '${_o}' of '${co}' cannot be zero.`)}return(0,to.valid)(!0)},lo=(co,uo,fo)=>{if(!["seconds","minutes","hours","daysOfMonth","months","daysOfWeek","years"].includes(uo))return(0,to.err)([`Cron field type '${uo}' does not exist.`]);if(co==="?")return uo==="daysOfMonth"||uo==="daysOfWeek"?fo.useBlankDay?(0,to.valid)(!0):(0,to.err)([`useBlankDay is not enabled, but is used in ${uo} field`]):(0,to.err)([`blank notation is not allowed in ${uo} field`]);const po=co.split(","),ho=[];if(po.forEach(go=>{ho.push(so(go,uo,fo))}),ho.every(go=>go.isValid()))return(0,to.valid)(!0);const _o=[];return ho.forEach(go=>{go.isError()&&_o.push(go.getError())}),(0,to.err)(_o)};return helper.default=lo,helper}var hasRequiredSecondChecker;function requireSecondChecker(){if(hasRequiredSecondChecker)return secondChecker;hasRequiredSecondChecker=1;var to=commonjsGlobal$1&&commonjsGlobal$1.__importDefault||function(ro){return ro&&ro.__esModule?ro:{default:ro}};Object.defineProperty(secondChecker,"__esModule",{value:!0}),requireLib();const ue=result$1,eo=to(requireHelper()),no=(ro,oo)=>{if(!ro.seconds)return(0,ue.err)(["seconds field is undefined, but useSeconds options is enabled."]);const{seconds:io}=ro;return(0,eo.default)(io,"seconds",oo)};return secondChecker.default=no,secondChecker}var minuteChecker={},hasRequiredMinuteChecker;function requireMinuteChecker(){if(hasRequiredMinuteChecker)return minuteChecker;hasRequiredMinuteChecker=1;var to=commonjsGlobal$1&&commonjsGlobal$1.__importDefault||function(ro){return ro&&ro.__esModule?ro:{default:ro}};Object.defineProperty(minuteChecker,"__esModule",{value:!0}),requireLib();const ue=result$1,eo=to(requireHelper()),no=(ro,oo)=>{if(!ro.minutes)return(0,ue.err)(["minutes field is undefined."]);const{minutes:io}=ro;return(0,eo.default)(io,"minutes",oo)};return minuteChecker.default=no,minuteChecker}var hourChecker={},hasRequiredHourChecker;function requireHourChecker(){if(hasRequiredHourChecker)return hourChecker;hasRequiredHourChecker=1;var to=commonjsGlobal$1&&commonjsGlobal$1.__importDefault||function(ro){return ro&&ro.__esModule?ro:{default:ro}};Object.defineProperty(hourChecker,"__esModule",{value:!0}),requireLib();const ue=result$1,eo=to(requireHelper()),no=(ro,oo)=>{if(!ro.hours)return(0,ue.err)(["hours field is undefined."]);const{hours:io}=ro;return(0,eo.default)(io,"hours",oo)};return hourChecker.default=no,hourChecker}var dayOfMonthChecker={},hasRequiredDayOfMonthChecker;function requireDayOfMonthChecker(){if(hasRequiredDayOfMonthChecker)return dayOfMonthChecker;hasRequiredDayOfMonthChecker=1;var to=commonjsGlobal$1&&commonjsGlobal$1.__importDefault||function(ro){return ro&&ro.__esModule?ro:{default:ro}};Object.defineProperty(dayOfMonthChecker,"__esModule",{value:!0}),requireLib();const ue=result$1,eo=to(requireHelper()),no=(ro,oo)=>{if(!ro.daysOfMonth)return(0,ue.err)(["daysOfMonth field is undefined."]);const{daysOfMonth:io}=ro;return oo.allowOnlyOneBlankDayField&&oo.useBlankDay&&ro.daysOfMonth==="?"&&ro.daysOfWeek==="?"?(0,ue.err)(["Cannot use blank value in daysOfMonth and daysOfWeek field when allowOnlyOneBlankDayField option is enabled."]):oo.mustHaveBlankDayField&&ro.daysOfMonth!=="?"&&ro.daysOfWeek!=="?"?(0,ue.err)(["Cannot specify both daysOfMonth and daysOfWeek field when mustHaveBlankDayField option is enabled."]):oo.useLastDayOfMonth&&ro.daysOfMonth.indexOf("L")!==-1&&ro.daysOfMonth.match(/[,/]/)?(0,ue.err)(["Cannot specify last day of month with lists, or ranges (symbols ,/)."]):oo.useNearestWeekday&&ro.daysOfMonth.indexOf("W")!==-1&&ro.daysOfMonth.match(/[,/-]/)?(0,ue.err)(["Cannot specify nearest weekday with lists, steps or ranges (symbols ,-/)."]):(0,eo.default)(io,"daysOfMonth",oo)};return dayOfMonthChecker.default=no,dayOfMonthChecker}var monthChecker={},hasRequiredMonthChecker;function requireMonthChecker(){if(hasRequiredMonthChecker)return monthChecker;hasRequiredMonthChecker=1;var to=commonjsGlobal$1&&commonjsGlobal$1.__importDefault||function(ro){return ro&&ro.__esModule?ro:{default:ro}};Object.defineProperty(monthChecker,"__esModule",{value:!0}),requireLib();const ue=result$1,eo=to(requireHelper()),no=(ro,oo)=>{if(!ro.months)return(0,ue.err)(["months field is undefined."]);const{months:io}=ro;return(0,eo.default)(io,"months",oo)};return monthChecker.default=no,monthChecker}var dayOfWeekChecker={},hasRequiredDayOfWeekChecker;function requireDayOfWeekChecker(){if(hasRequiredDayOfWeekChecker)return dayOfWeekChecker;hasRequiredDayOfWeekChecker=1;var to=commonjsGlobal$1&&commonjsGlobal$1.__importDefault||function(ro){return ro&&ro.__esModule?ro:{default:ro}};Object.defineProperty(dayOfWeekChecker,"__esModule",{value:!0}),requireLib();const ue=result$1,eo=to(requireHelper()),no=(ro,oo)=>{if(!ro.daysOfWeek)return(0,ue.err)(["daysOfWeek field is undefined."]);const{daysOfWeek:io}=ro;return oo.allowOnlyOneBlankDayField&&ro.daysOfMonth==="?"&&ro.daysOfWeek==="?"?(0,ue.err)(["Cannot use blank value in daysOfMonth and daysOfWeek field when allowOnlyOneBlankDayField option is enabled."]):oo.mustHaveBlankDayField&&ro.daysOfMonth!=="?"&&ro.daysOfWeek!=="?"?(0,ue.err)(["Cannot specify both daysOfMonth and daysOfWeek field when mustHaveBlankDayField option is enabled."]):oo.useLastDayOfWeek&&ro.daysOfWeek.indexOf("L")!==-1&&ro.daysOfWeek.match(/[,/-]/)?(0,ue.err)(["Cannot specify last day of week with lists, steps or ranges (symbols ,-/)."]):oo.useNthWeekdayOfMonth&&ro.daysOfWeek.indexOf("#")!==-1&&ro.daysOfWeek.match(/[,/-]/)?(0,ue.err)(["Cannot specify Nth weekday of month with lists, steps or ranges (symbols ,-/)."]):(0,eo.default)(io,"daysOfWeek",oo)};return dayOfWeekChecker.default=no,dayOfWeekChecker}var yearChecker={},hasRequiredYearChecker;function requireYearChecker(){if(hasRequiredYearChecker)return yearChecker;hasRequiredYearChecker=1;var to=commonjsGlobal$1&&commonjsGlobal$1.__importDefault||function(ro){return ro&&ro.__esModule?ro:{default:ro}};Object.defineProperty(yearChecker,"__esModule",{value:!0}),requireLib();const ue=result$1,eo=to(requireHelper()),no=(ro,oo)=>{if(!ro.years)return(0,ue.err)(["years field is undefined, but useYears option is enabled."]);const{years:io}=ro;return(0,eo.default)(io,"years",oo)};return yearChecker.default=no,yearChecker}var option={},map$3;try{map$3=Map}catch{}var set$2;try{set$2=Set}catch{}function baseClone$3(to,ue,eo){if(!to||typeof to!="object"||typeof to=="function")return to;if(to.nodeType&&"cloneNode"in to)return to.cloneNode(!0);if(to instanceof Date)return new Date(to.getTime());if(to instanceof RegExp)return new RegExp(to);if(Array.isArray(to))return to.map(clone$3);if(map$3&&to instanceof map$3)return new Map(Array.from(to.entries()));if(set$2&&to instanceof set$2)return new Set(Array.from(to.values()));if(to instanceof Object){ue.push(to);var no=Object.create(to);eo.push(no);for(var ro in to){var oo=ue.findIndex(function(io){return io===to[ro]});no[ro]=oo>-1?eo[oo]:baseClone$3(to[ro],ue,eo)}return no}return to}function clone$3(to){return baseClone$3(to,[],[])}const toString$c=Object.prototype.toString,errorToString$1=Error.prototype.toString,regExpToString$1=RegExp.prototype.toString,symbolToString$2=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",SYMBOL_REGEXP$1=/^Symbol\((.*)\)(.*)$/;function printNumber$1(to){return to!=+to?"NaN":to===0&&1/to<0?"-0":""+to}function printSimpleValue$1(to,ue=!1){if(to==null||to===!0||to===!1)return""+to;const eo=typeof to;if(eo==="number")return printNumber$1(to);if(eo==="string")return ue?`"${to}"`:to;if(eo==="function")return"[Function "+(to.name||"anonymous")+"]";if(eo==="symbol")return symbolToString$2.call(to).replace(SYMBOL_REGEXP$1,"Symbol($1)");const no=toString$c.call(to).slice(8,-1);return no==="Date"?isNaN(to.getTime())?""+to:to.toISOString(to):no==="Error"||to instanceof Error?"["+errorToString$1.call(to)+"]":no==="RegExp"?regExpToString$1.call(to):null}function printValue$1(to,ue){let eo=printSimpleValue$1(to,ue);return eo!==null?eo:JSON.stringify(to,function(no,ro){let oo=printSimpleValue$1(this[no],ue);return oo!==null?oo:ro},2)}let mixed$1={default:"${path} is invalid",required:"${path} is a required field",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:to,type:ue,value:eo,originalValue:no})=>{let ro=no!=null&&no!==eo,oo=`${to} must be a \`${ue}\` type, but the final value was: \`${printValue$1(eo,!0)}\``+(ro?` (cast from the value \`${printValue$1(no,!0)}\`).`:".");return eo===null&&(oo+='\n If "null" is intended as an empty value be sure to mark the schema as `.nullable()`'),oo},defined:"${path} must be defined"},string$3={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},number$3={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},date$4={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},boolean$1={isValue:"${path} field must be ${value}"},object$3={noUnknown:"${path} field has unspecified keys: ${unknown}"},array$3={min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must be have ${length} items"};const locale=Object.assign(Object.create(null),{mixed:mixed$1,string:string$3,number:number$3,date:date$4,object:object$3,array:array$3,boolean:boolean$1});var objectProto$i=Object.prototype,hasOwnProperty$i=objectProto$i.hasOwnProperty;function baseHas$1(to,ue){return to!=null&&hasOwnProperty$i.call(to,ue)}var _baseHas=baseHas$1,isArray$h=Array.isArray,isArray_1=isArray$h,freeGlobal$1=typeof commonjsGlobal$1=="object"&&commonjsGlobal$1&&commonjsGlobal$1.Object===Object&&commonjsGlobal$1,_freeGlobal=freeGlobal$1,freeGlobal=_freeGlobal,freeSelf=typeof self=="object"&&self&&self.Object===Object&&self,root$e=freeGlobal||freeSelf||Function("return this")(),_root=root$e,root$d=_root,Symbol$7=root$d.Symbol,_Symbol=Symbol$7,Symbol$6=_Symbol,objectProto$h=Object.prototype,hasOwnProperty$h=objectProto$h.hasOwnProperty,nativeObjectToString$1=objectProto$h.toString,symToStringTag$1=Symbol$6?Symbol$6.toStringTag:void 0;function getRawTag$1(to){var ue=hasOwnProperty$h.call(to,symToStringTag$1),eo=to[symToStringTag$1];try{to[symToStringTag$1]=void 0;var no=!0}catch{}var ro=nativeObjectToString$1.call(to);return no&&(ue?to[symToStringTag$1]=eo:delete to[symToStringTag$1]),ro}var _getRawTag=getRawTag$1,objectProto$g=Object.prototype,nativeObjectToString=objectProto$g.toString;function objectToString$3(to){return nativeObjectToString.call(to)}var _objectToString=objectToString$3,Symbol$5=_Symbol,getRawTag=_getRawTag,objectToString$2=_objectToString,nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag=Symbol$5?Symbol$5.toStringTag:void 0;function baseGetTag$7(to){return to==null?to===void 0?undefinedTag:nullTag:symToStringTag&&symToStringTag in Object(to)?getRawTag(to):objectToString$2(to)}var _baseGetTag=baseGetTag$7;function isObjectLike$b(to){return to!=null&&typeof to=="object"}var isObjectLike_1=isObjectLike$b,baseGetTag$6=_baseGetTag,isObjectLike$a=isObjectLike_1,symbolTag$3="[object Symbol]";function isSymbol$7(to){return typeof to=="symbol"||isObjectLike$a(to)&&baseGetTag$6(to)==symbolTag$3}var isSymbol_1=isSymbol$7,isArray$g=isArray_1,isSymbol$6=isSymbol_1,reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/;function isKey$3(to,ue){if(isArray$g(to))return!1;var eo=typeof to;return eo=="number"||eo=="symbol"||eo=="boolean"||to==null||isSymbol$6(to)?!0:reIsPlainProp.test(to)||!reIsDeepProp.test(to)||ue!=null&&to in Object(ue)}var _isKey=isKey$3;function isObject$d(to){var ue=typeof to;return to!=null&&(ue=="object"||ue=="function")}var isObject_1=isObject$d,baseGetTag$5=_baseGetTag,isObject$c=isObject_1,asyncTag="[object AsyncFunction]",funcTag$2="[object Function]",genTag$1="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction$3(to){if(!isObject$c(to))return!1;var ue=baseGetTag$5(to);return ue==funcTag$2||ue==genTag$1||ue==asyncTag||ue==proxyTag}var isFunction_1=isFunction$3,root$c=_root,coreJsData$1=root$c["__core-js_shared__"],_coreJsData=coreJsData$1,coreJsData=_coreJsData,maskSrcKey=function(){var to=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return to?"Symbol(src)_1."+to:""}();function isMasked$1(to){return!!maskSrcKey&&maskSrcKey in to}var _isMasked=isMasked$1,funcProto$2=Function.prototype,funcToString$2=funcProto$2.toString;function toSource$2(to){if(to!=null){try{return funcToString$2.call(to)}catch{}try{return to+""}catch{}}return""}var _toSource=toSource$2,isFunction$2=isFunction_1,isMasked=_isMasked,isObject$b=isObject_1,toSource$1=_toSource,reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor=/^\[object .+?Constructor\]$/,funcProto$1=Function.prototype,objectProto$f=Object.prototype,funcToString$1=funcProto$1.toString,hasOwnProperty$g=objectProto$f.hasOwnProperty,reIsNative=RegExp("^"+funcToString$1.call(hasOwnProperty$g).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative$1(to){if(!isObject$b(to)||isMasked(to))return!1;var ue=isFunction$2(to)?reIsNative:reIsHostCtor;return ue.test(toSource$1(to))}var _baseIsNative=baseIsNative$1;function getValue$2(to,ue){return to==null?void 0:to[ue]}var _getValue=getValue$2,baseIsNative=_baseIsNative,getValue$1=_getValue;function getNative$7(to,ue){var eo=getValue$1(to,ue);return baseIsNative(eo)?eo:void 0}var _getNative=getNative$7,getNative$6=_getNative,nativeCreate$4=getNative$6(Object,"create"),_nativeCreate=nativeCreate$4,nativeCreate$3=_nativeCreate;function hashClear$1(){this.__data__=nativeCreate$3?nativeCreate$3(null):{},this.size=0}var _hashClear=hashClear$1;function hashDelete$1(to){var ue=this.has(to)&&delete this.__data__[to];return this.size-=ue?1:0,ue}var _hashDelete=hashDelete$1,nativeCreate$2=_nativeCreate,HASH_UNDEFINED$2="__lodash_hash_undefined__",objectProto$e=Object.prototype,hasOwnProperty$f=objectProto$e.hasOwnProperty;function hashGet$1(to){var ue=this.__data__;if(nativeCreate$2){var eo=ue[to];return eo===HASH_UNDEFINED$2?void 0:eo}return hasOwnProperty$f.call(ue,to)?ue[to]:void 0}var _hashGet=hashGet$1,nativeCreate$1=_nativeCreate,objectProto$d=Object.prototype,hasOwnProperty$e=objectProto$d.hasOwnProperty;function hashHas$1(to){var ue=this.__data__;return nativeCreate$1?ue[to]!==void 0:hasOwnProperty$e.call(ue,to)}var _hashHas=hashHas$1,nativeCreate=_nativeCreate,HASH_UNDEFINED$1="__lodash_hash_undefined__";function hashSet$1(to,ue){var eo=this.__data__;return this.size+=this.has(to)?0:1,eo[to]=nativeCreate&&ue===void 0?HASH_UNDEFINED$1:ue,this}var _hashSet=hashSet$1,hashClear=_hashClear,hashDelete=_hashDelete,hashGet=_hashGet,hashHas=_hashHas,hashSet=_hashSet;function Hash$1(to){var ue=-1,eo=to==null?0:to.length;for(this.clear();++ue<eo;){var no=to[ue];this.set(no[0],no[1])}}Hash$1.prototype.clear=hashClear;Hash$1.prototype.delete=hashDelete;Hash$1.prototype.get=hashGet;Hash$1.prototype.has=hashHas;Hash$1.prototype.set=hashSet;var _Hash=Hash$1;function listCacheClear$1(){this.__data__=[],this.size=0}var _listCacheClear=listCacheClear$1;function eq$3(to,ue){return to===ue||to!==to&&ue!==ue}var eq_1=eq$3,eq$2=eq_1;function assocIndexOf$4(to,ue){for(var eo=to.length;eo--;)if(eq$2(to[eo][0],ue))return eo;return-1}var _assocIndexOf=assocIndexOf$4,assocIndexOf$3=_assocIndexOf,arrayProto=Array.prototype,splice=arrayProto.splice;function listCacheDelete$1(to){var ue=this.__data__,eo=assocIndexOf$3(ue,to);if(eo<0)return!1;var no=ue.length-1;return eo==no?ue.pop():splice.call(ue,eo,1),--this.size,!0}var _listCacheDelete=listCacheDelete$1,assocIndexOf$2=_assocIndexOf;function listCacheGet$1(to){var ue=this.__data__,eo=assocIndexOf$2(ue,to);return eo<0?void 0:ue[eo][1]}var _listCacheGet=listCacheGet$1,assocIndexOf$1=_assocIndexOf;function listCacheHas$1(to){return assocIndexOf$1(this.__data__,to)>-1}var _listCacheHas=listCacheHas$1,assocIndexOf=_assocIndexOf;function listCacheSet$1(to,ue){var eo=this.__data__,no=assocIndexOf(eo,to);return no<0?(++this.size,eo.push([to,ue])):eo[no][1]=ue,this}var _listCacheSet=listCacheSet$1,listCacheClear=_listCacheClear,listCacheDelete=_listCacheDelete,listCacheGet=_listCacheGet,listCacheHas=_listCacheHas,listCacheSet=_listCacheSet;function ListCache$4(to){var ue=-1,eo=to==null?0:to.length;for(this.clear();++ue<eo;){var no=to[ue];this.set(no[0],no[1])}}ListCache$4.prototype.clear=listCacheClear;ListCache$4.prototype.delete=listCacheDelete;ListCache$4.prototype.get=listCacheGet;ListCache$4.prototype.has=listCacheHas;ListCache$4.prototype.set=listCacheSet;var _ListCache=ListCache$4,getNative$5=_getNative,root$b=_root,Map$4=getNative$5(root$b,"Map"),_Map=Map$4,Hash=_Hash,ListCache$3=_ListCache,Map$3=_Map;function mapCacheClear$1(){this.size=0,this.__data__={hash:new Hash,map:new(Map$3||ListCache$3),string:new Hash}}var _mapCacheClear=mapCacheClear$1;function isKeyable$1(to){var ue=typeof to;return ue=="string"||ue=="number"||ue=="symbol"||ue=="boolean"?to!=="__proto__":to===null}var _isKeyable=isKeyable$1,isKeyable=_isKeyable;function getMapData$4(to,ue){var eo=to.__data__;return isKeyable(ue)?eo[typeof ue=="string"?"string":"hash"]:eo.map}var _getMapData=getMapData$4,getMapData$3=_getMapData;function mapCacheDelete$1(to){var ue=getMapData$3(this,to).delete(to);return this.size-=ue?1:0,ue}var _mapCacheDelete=mapCacheDelete$1,getMapData$2=_getMapData;function mapCacheGet$1(to){return getMapData$2(this,to).get(to)}var _mapCacheGet=mapCacheGet$1,getMapData$1=_getMapData;function mapCacheHas$1(to){return getMapData$1(this,to).has(to)}var _mapCacheHas=mapCacheHas$1,getMapData=_getMapData;function mapCacheSet$1(to,ue){var eo=getMapData(this,to),no=eo.size;return eo.set(to,ue),this.size+=eo.size==no?0:1,this}var _mapCacheSet=mapCacheSet$1,mapCacheClear=_mapCacheClear,mapCacheDelete=_mapCacheDelete,mapCacheGet=_mapCacheGet,mapCacheHas=_mapCacheHas,mapCacheSet=_mapCacheSet;function MapCache$3(to){var ue=-1,eo=to==null?0:to.length;for(this.clear();++ue<eo;){var no=to[ue];this.set(no[0],no[1])}}MapCache$3.prototype.clear=mapCacheClear;MapCache$3.prototype.delete=mapCacheDelete;MapCache$3.prototype.get=mapCacheGet;MapCache$3.prototype.has=mapCacheHas;MapCache$3.prototype.set=mapCacheSet;var _MapCache=MapCache$3,MapCache$2=_MapCache,FUNC_ERROR_TEXT$1="Expected a function";function memoize$1(to,ue){if(typeof to!="function"||ue!=null&&typeof ue!="function")throw new TypeError(FUNC_ERROR_TEXT$1);var eo=function(){var no=arguments,ro=ue?ue.apply(this,no):no[0],oo=eo.cache;if(oo.has(ro))return oo.get(ro);var io=to.apply(this,no);return eo.cache=oo.set(ro,io)||oo,io};return eo.cache=new(memoize$1.Cache||MapCache$2),eo}memoize$1.Cache=MapCache$2;var memoize_1=memoize$1,memoize=memoize_1,MAX_MEMOIZE_SIZE=500;function memoizeCapped$1(to){var ue=memoize(to,function(no){return eo.size===MAX_MEMOIZE_SIZE&&eo.clear(),no}),eo=ue.cache;return ue}var _memoizeCapped=memoizeCapped$1,memoizeCapped=_memoizeCapped,rePropName$1=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,reEscapeChar$1=/\\(\\)?/g,stringToPath$3=memoizeCapped(function(to){var ue=[];return to.charCodeAt(0)===46&&ue.push(""),to.replace(rePropName$1,function(eo,no,ro,oo){ue.push(ro?oo.replace(reEscapeChar$1,"$1"):no||eo)}),ue}),_stringToPath=stringToPath$3;function arrayMap$2(to,ue){for(var eo=-1,no=to==null?0:to.length,ro=Array(no);++eo<no;)ro[eo]=ue(to[eo],eo,to);return ro}var _arrayMap=arrayMap$2,Symbol$4=_Symbol,arrayMap$1=_arrayMap,isArray$f=isArray_1,isSymbol$5=isSymbol_1,INFINITY$2=1/0,symbolProto$2=Symbol$4?Symbol$4.prototype:void 0,symbolToString$1=symbolProto$2?symbolProto$2.toString:void 0;function baseToString$1(to){if(typeof to=="string")return to;if(isArray$f(to))return arrayMap$1(to,baseToString$1)+"";if(isSymbol$5(to))return symbolToString$1?symbolToString$1.call(to):"";var ue=to+"";return ue=="0"&&1/to==-INFINITY$2?"-0":ue}var _baseToString=baseToString$1,baseToString=_baseToString;function toString$b(to){return to==null?"":baseToString(to)}var toString_1=toString$b,isArray$e=isArray_1,isKey$2=_isKey,stringToPath$2=_stringToPath,toString$a=toString_1;function castPath$2(to,ue){return isArray$e(to)?to:isKey$2(to,ue)?[to]:stringToPath$2(toString$a(to))}var _castPath=castPath$2,baseGetTag$4=_baseGetTag,isObjectLike$9=isObjectLike_1,argsTag$3="[object Arguments]";function baseIsArguments$1(to){return isObjectLike$9(to)&&baseGetTag$4(to)==argsTag$3}var _baseIsArguments=baseIsArguments$1,baseIsArguments=_baseIsArguments,isObjectLike$8=isObjectLike_1,objectProto$c=Object.prototype,hasOwnProperty$d=objectProto$c.hasOwnProperty,propertyIsEnumerable$1=objectProto$c.propertyIsEnumerable,isArguments$4=baseIsArguments(function(){return arguments}())?baseIsArguments:function(to){return isObjectLike$8(to)&&hasOwnProperty$d.call(to,"callee")&&!propertyIsEnumerable$1.call(to,"callee")},isArguments_1=isArguments$4,MAX_SAFE_INTEGER$1=9007199254740991,reIsUint=/^(?:0|[1-9]\d*)$/;function isIndex$3(to,ue){var eo=typeof to;return ue=ue??MAX_SAFE_INTEGER$1,!!ue&&(eo=="number"||eo!="symbol"&&reIsUint.test(to))&&to>-1&&to%1==0&&to<ue}var _isIndex=isIndex$3,MAX_SAFE_INTEGER=9007199254740991;function isLength$3(to){return typeof to=="number"&&to>-1&&to%1==0&&to<=MAX_SAFE_INTEGER}var isLength_1=isLength$3,isSymbol$4=isSymbol_1,INFINITY$1=1/0;function toKey$5(to){if(typeof to=="string"||isSymbol$4(to))return to;var ue=to+"";return ue=="0"&&1/to==-INFINITY$1?"-0":ue}var _toKey=toKey$5,castPath$1=_castPath,isArguments$3=isArguments_1,isArray$d=isArray_1,isIndex$2=_isIndex,isLength$2=isLength_1,toKey$4=_toKey;function hasPath$2(to,ue,eo){ue=castPath$1(ue,to);for(var no=-1,ro=ue.length,oo=!1;++no<ro;){var io=toKey$4(ue[no]);if(!(oo=to!=null&&eo(to,io)))break;to=to[io]}return oo||++no!=ro?oo:(ro=to==null?0:to.length,!!ro&&isLength$2(ro)&&isIndex$2(io,ro)&&(isArray$d(to)||isArguments$3(to)))}var _hasPath=hasPath$2,baseHas=_baseHas,hasPath$1=_hasPath;function has$6(to,ue){return to!=null&&hasPath$1(to,ue,baseHas)}var has_1=has$6;const has$7=getDefaultExportFromCjs$1(has_1),isSchema$1=to=>to&&to.__isYupSchema__;let Condition$1=class{constructor(ue,eo){if(this.refs=ue,this.refs=ue,typeof eo=="function"){this.fn=eo;return}if(!has$7(eo,"is"))throw new TypeError("`is:` is required for `when()` conditions");if(!eo.then&&!eo.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:no,then:ro,otherwise:oo}=eo,io=typeof no=="function"?no:(...ao)=>ao.every(so=>so===no);this.fn=function(...ao){let so=ao.pop(),lo=ao.pop(),co=io(...ao)?ro:oo;if(co)return typeof co=="function"?co(lo):lo.concat(co.resolve(so))}}resolve(ue,eo){let no=this.refs.map(oo=>oo.getValue(eo==null?void 0:eo.value,eo==null?void 0:eo.parent,eo==null?void 0:eo.context)),ro=this.fn.apply(ue,no.concat(ue,eo));if(ro===void 0||ro===ue)return ue;if(!isSchema$1(ro))throw new TypeError("conditions must return a schema object");return ro.resolve(eo)}};function toArray$3(to){return to==null?[]:[].concat(to)}function _extends$8(){return _extends$8=Object.assign||function(to){for(var ue=1;ue<arguments.length;ue++){var eo=arguments[ue];for(var no in eo)Object.prototype.hasOwnProperty.call(eo,no)&&(to[no]=eo[no])}return to},_extends$8.apply(this,arguments)}let strReg$1=/\$\{\s*(\w+)\s*\}/g,ValidationError$1=class x3 extends Error{static formatError(ue,eo){const no=eo.label||eo.path||"this";return no!==eo.path&&(eo=_extends$8({},eo,{path:no})),typeof ue=="string"?ue.replace(strReg$1,(ro,oo)=>printValue$1(eo[oo])):typeof ue=="function"?ue(eo):ue}static isError(ue){return ue&&ue.name==="ValidationError"}constructor(ue,eo,no,ro){super(),this.name="ValidationError",this.value=eo,this.path=no,this.type=ro,this.errors=[],this.inner=[],toArray$3(ue).forEach(oo=>{x3.isError(oo)?(this.errors.push(...oo.errors),this.inner=this.inner.concat(oo.inner.length?oo.inner:oo)):this.errors.push(oo)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0],Error.captureStackTrace&&Error.captureStackTrace(this,x3)}};const once$2=to=>{let ue=!1;return(...eo)=>{ue||(ue=!0,to(...eo))}};function runTests$1(to,ue){let{endEarly:eo,tests:no,args:ro,value:oo,errors:io,sort:ao,path:so}=to,lo=once$2(ue),co=no.length;const uo=[];if(io=io||[],!co)return io.length?lo(new ValidationError$1(io,oo,so)):lo(null,oo);for(let fo=0;fo<no.length;fo++){const po=no[fo];po(ro,function(_o){if(_o){if(!ValidationError$1.isError(_o))return lo(_o,oo);if(eo)return _o.value=oo,lo(_o,oo);uo.push(_o)}if(--co<=0){if(uo.length&&(ao&&uo.sort(ao),io.length&&uo.push(...io),io=uo),io.length){lo(new ValidationError$1(io,oo,so),oo);return}lo(null,oo)}})}}var getNative$4=_getNative,defineProperty$2=function(){try{var to=getNative$4(Object,"defineProperty");return to({},"",{}),to}catch{}}(),_defineProperty$1=defineProperty$2,defineProperty$1=_defineProperty$1;function baseAssignValue$4(to,ue,eo){ue=="__proto__"&&defineProperty$1?defineProperty$1(to,ue,{configurable:!0,enumerable:!0,value:eo,writable:!0}):to[ue]=eo}var _baseAssignValue=baseAssignValue$4;function createBaseFor$1(to){return function(ue,eo,no){for(var ro=-1,oo=Object(ue),io=no(ue),ao=io.length;ao--;){var so=io[to?ao:++ro];if(eo(oo[so],so,oo)===!1)break}return ue}}var _createBaseFor=createBaseFor$1,createBaseFor=_createBaseFor,baseFor$1=createBaseFor(),_baseFor=baseFor$1;function baseTimes$1(to,ue){for(var eo=-1,no=Array(to);++eo<to;)no[eo]=ue(eo);return no}var _baseTimes=baseTimes$1,isBuffer$8={exports:{}};function stubFalse(){return!1}var stubFalse_1=stubFalse;isBuffer$8.exports;(function(to,ue){var eo=_root,no=stubFalse_1,ro=ue&&!ue.nodeType&&ue,oo=ro&&!0&&to&&!to.nodeType&&to,io=oo&&oo.exports===ro,ao=io?eo.Buffer:void 0,so=ao?ao.isBuffer:void 0,lo=so||no;to.exports=lo})(isBuffer$8,isBuffer$8.exports);var isBufferExports=isBuffer$8.exports,baseGetTag$3=_baseGetTag,isLength$1=isLength_1,isObjectLike$7=isObjectLike_1,argsTag$2="[object Arguments]",arrayTag$2="[object Array]",boolTag$3="[object Boolean]",dateTag$3="[object Date]",errorTag$3="[object Error]",funcTag$1="[object Function]",mapTag$5="[object Map]",numberTag$3="[object Number]",objectTag$4="[object Object]",regexpTag$3="[object RegExp]",setTag$5="[object Set]",stringTag$3="[object String]",weakMapTag$3="[object WeakMap]",arrayBufferTag$3="[object ArrayBuffer]",dataViewTag$4="[object DataView]",float32Tag$2="[object Float32Array]",float64Tag$2="[object Float64Array]",int8Tag$2="[object Int8Array]",int16Tag$2="[object Int16Array]",int32Tag$2="[object Int32Array]",uint8Tag$2="[object Uint8Array]",uint8ClampedTag$2="[object Uint8ClampedArray]",uint16Tag$2="[object Uint16Array]",uint32Tag$2="[object Uint32Array]",typedArrayTags={};typedArrayTags[float32Tag$2]=typedArrayTags[float64Tag$2]=typedArrayTags[int8Tag$2]=typedArrayTags[int16Tag$2]=typedArrayTags[int32Tag$2]=typedArrayTags[uint8Tag$2]=typedArrayTags[uint8ClampedTag$2]=typedArrayTags[uint16Tag$2]=typedArrayTags[uint32Tag$2]=!0;typedArrayTags[argsTag$2]=typedArrayTags[arrayTag$2]=typedArrayTags[arrayBufferTag$3]=typedArrayTags[boolTag$3]=typedArrayTags[dataViewTag$4]=typedArrayTags[dateTag$3]=typedArrayTags[errorTag$3]=typedArrayTags[funcTag$1]=typedArrayTags[mapTag$5]=typedArrayTags[numberTag$3]=typedArrayTags[objectTag$4]=typedArrayTags[regexpTag$3]=typedArrayTags[setTag$5]=typedArrayTags[stringTag$3]=typedArrayTags[weakMapTag$3]=!1;function baseIsTypedArray$1(to){return isObjectLike$7(to)&&isLength$1(to.length)&&!!typedArrayTags[baseGetTag$3(to)]}var _baseIsTypedArray=baseIsTypedArray$1;function baseUnary$3(to){return function(ue){return to(ue)}}var _baseUnary=baseUnary$3,_nodeUtil={exports:{}};_nodeUtil.exports;(function(to,ue){var eo=_freeGlobal,no=ue&&!ue.nodeType&&ue,ro=no&&!0&&to&&!to.nodeType&&to,oo=ro&&ro.exports===no,io=oo&&eo.process,ao=function(){try{var so=ro&&ro.require&&ro.require("util").types;return so||io&&io.binding&&io.binding("util")}catch{}}();to.exports=ao})(_nodeUtil,_nodeUtil.exports);var _nodeUtilExports=_nodeUtil.exports,baseIsTypedArray=_baseIsTypedArray,baseUnary$2=_baseUnary,nodeUtil$2=_nodeUtilExports,nodeIsTypedArray=nodeUtil$2&&nodeUtil$2.isTypedArray,isTypedArray$2=nodeIsTypedArray?baseUnary$2(nodeIsTypedArray):baseIsTypedArray,isTypedArray_1=isTypedArray$2,baseTimes=_baseTimes,isArguments$2=isArguments_1,isArray$c=isArray_1,isBuffer$7=isBufferExports,isIndex$1=_isIndex,isTypedArray$1=isTypedArray_1,objectProto$b=Object.prototype,hasOwnProperty$c=objectProto$b.hasOwnProperty;function arrayLikeKeys$2(to,ue){var eo=isArray$c(to),no=!eo&&isArguments$2(to),ro=!eo&&!no&&isBuffer$7(to),oo=!eo&&!no&&!ro&&isTypedArray$1(to),io=eo||no||ro||oo,ao=io?baseTimes(to.length,String):[],so=ao.length;for(var lo in to)(ue||hasOwnProperty$c.call(to,lo))&&!(io&&(lo=="length"||ro&&(lo=="offset"||lo=="parent")||oo&&(lo=="buffer"||lo=="byteLength"||lo=="byteOffset")||isIndex$1(lo,so)))&&ao.push(lo);return ao}var _arrayLikeKeys=arrayLikeKeys$2,objectProto$a=Object.prototype;function isPrototype$3(to){var ue=to&&to.constructor,eo=typeof ue=="function"&&ue.prototype||objectProto$a;return to===eo}var _isPrototype=isPrototype$3;function overArg$2(to,ue){return function(eo){return to(ue(eo))}}var _overArg=overArg$2,overArg$1=_overArg,nativeKeys$1=overArg$1(Object.keys,Object),_nativeKeys=nativeKeys$1,isPrototype$2=_isPrototype,nativeKeys=_nativeKeys,objectProto$9=Object.prototype,hasOwnProperty$b=objectProto$9.hasOwnProperty;function baseKeys$1(to){if(!isPrototype$2(to))return nativeKeys(to);var ue=[];for(var eo in Object(to))hasOwnProperty$b.call(to,eo)&&eo!="constructor"&&ue.push(eo);return ue}var _baseKeys=baseKeys$1,isFunction$1=isFunction_1,isLength=isLength_1;function isArrayLike$2(to){return to!=null&&isLength(to.length)&&!isFunction$1(to)}var isArrayLike_1=isArrayLike$2,arrayLikeKeys$1=_arrayLikeKeys,baseKeys=_baseKeys,isArrayLike$1=isArrayLike_1;function keys$5(to){return isArrayLike$1(to)?arrayLikeKeys$1(to):baseKeys(to)}var keys_1=keys$5,baseFor=_baseFor,keys$4=keys_1;function baseForOwn$2(to,ue){return to&&baseFor(to,ue,keys$4)}var _baseForOwn=baseForOwn$2,ListCache$2=_ListCache;function stackClear$1(){this.__data__=new ListCache$2,this.size=0}var _stackClear=stackClear$1;function stackDelete$1(to){var ue=this.__data__,eo=ue.delete(to);return this.size=ue.size,eo}var _stackDelete=stackDelete$1;function stackGet$1(to){return this.__data__.get(to)}var _stackGet=stackGet$1;function stackHas$1(to){return this.__data__.has(to)}var _stackHas=stackHas$1,ListCache$1=_ListCache,Map$2=_Map,MapCache$1=_MapCache,LARGE_ARRAY_SIZE=200;function stackSet$1(to,ue){var eo=this.__data__;if(eo instanceof ListCache$1){var no=eo.__data__;if(!Map$2||no.length<LARGE_ARRAY_SIZE-1)return no.push([to,ue]),this.size=++eo.size,this;eo=this.__data__=new MapCache$1(no)}return eo.set(to,ue),this.size=eo.size,this}var _stackSet=stackSet$1,ListCache=_ListCache,stackClear=_stackClear,stackDelete=_stackDelete,stackGet=_stackGet,stackHas=_stackHas,stackSet=_stackSet;function Stack$4(to){var ue=this.__data__=new ListCache(to);this.size=ue.size}Stack$4.prototype.clear=stackClear;Stack$4.prototype.delete=stackDelete;Stack$4.prototype.get=stackGet;Stack$4.prototype.has=stackHas;Stack$4.prototype.set=stackSet;var _Stack=Stack$4,HASH_UNDEFINED="__lodash_hash_undefined__";function setCacheAdd$1(to){return this.__data__.set(to,HASH_UNDEFINED),this}var _setCacheAdd=setCacheAdd$1;function setCacheHas$1(to){return this.__data__.has(to)}var _setCacheHas=setCacheHas$1,MapCache=_MapCache,setCacheAdd=_setCacheAdd,setCacheHas=_setCacheHas;function SetCache$1(to){var ue=-1,eo=to==null?0:to.length;for(this.__data__=new MapCache;++ue<eo;)this.add(to[ue])}SetCache$1.prototype.add=SetCache$1.prototype.push=setCacheAdd;SetCache$1.prototype.has=setCacheHas;var _SetCache=SetCache$1;function arraySome$1(to,ue){for(var eo=-1,no=to==null?0:to.length;++eo<no;)if(ue(to[eo],eo,to))return!0;return!1}var _arraySome=arraySome$1;function cacheHas$1(to,ue){return to.has(ue)}var _cacheHas=cacheHas$1,SetCache=_SetCache,arraySome=_arraySome,cacheHas=_cacheHas,COMPARE_PARTIAL_FLAG$5=1,COMPARE_UNORDERED_FLAG$3=2;function equalArrays$2(to,ue,eo,no,ro,oo){var io=eo&COMPARE_PARTIAL_FLAG$5,ao=to.length,so=ue.length;if(ao!=so&&!(io&&so>ao))return!1;var lo=oo.get(to),co=oo.get(ue);if(lo&&co)return lo==ue&&co==to;var uo=-1,fo=!0,po=eo&COMPARE_UNORDERED_FLAG$3?new SetCache:void 0;for(oo.set(to,ue),oo.set(ue,to);++uo<ao;){var ho=to[uo],_o=ue[uo];if(no)var go=io?no(_o,ho,uo,ue,to,oo):no(ho,_o,uo,to,ue,oo);if(go!==void 0){if(go)continue;fo=!1;break}if(po){if(!arraySome(ue,function(bo,vo){if(!cacheHas(po,vo)&&(ho===bo||ro(ho,bo,eo,no,oo)))return po.push(vo)})){fo=!1;break}}else if(!(ho===_o||ro(ho,_o,eo,no,oo))){fo=!1;break}}return oo.delete(to),oo.delete(ue),fo}var _equalArrays=equalArrays$2,root$a=_root,Uint8Array$3=root$a.Uint8Array,_Uint8Array=Uint8Array$3;function mapToArray$1(to){var ue=-1,eo=Array(to.size);return to.forEach(function(no,ro){eo[++ue]=[ro,no]}),eo}var _mapToArray=mapToArray$1;function setToArray$1(to){var ue=-1,eo=Array(to.size);return to.forEach(function(no){eo[++ue]=no}),eo}var _setToArray=setToArray$1,Symbol$3=_Symbol,Uint8Array$2=_Uint8Array,eq$1=eq_1,equalArrays$1=_equalArrays,mapToArray=_mapToArray,setToArray=_setToArray,COMPARE_PARTIAL_FLAG$4=1,COMPARE_UNORDERED_FLAG$2=2,boolTag$2="[object Boolean]",dateTag$2="[object Date]",errorTag$2="[object Error]",mapTag$4="[object Map]",numberTag$2="[object Number]",regexpTag$2="[object RegExp]",setTag$4="[object Set]",stringTag$2="[object String]",symbolTag$2="[object Symbol]",arrayBufferTag$2="[object ArrayBuffer]",dataViewTag$3="[object DataView]",symbolProto$1=Symbol$3?Symbol$3.prototype:void 0,symbolValueOf$1=symbolProto$1?symbolProto$1.valueOf:void 0;function equalByTag$1(to,ue,eo,no,ro,oo,io){switch(eo){case dataViewTag$3:if(to.byteLength!=ue.byteLength||to.byteOffset!=ue.byteOffset)return!1;to=to.buffer,ue=ue.buffer;case arrayBufferTag$2:return!(to.byteLength!=ue.byteLength||!oo(new Uint8Array$2(to),new Uint8Array$2(ue)));case boolTag$2:case dateTag$2:case numberTag$2:return eq$1(+to,+ue);case errorTag$2:return to.name==ue.name&&to.message==ue.message;case regexpTag$2:case stringTag$2:return to==ue+"";case mapTag$4:var ao=mapToArray;case setTag$4:var so=no&COMPARE_PARTIAL_FLAG$4;if(ao||(ao=setToArray),to.size!=ue.size&&!so)return!1;var lo=io.get(to);if(lo)return lo==ue;no|=COMPARE_UNORDERED_FLAG$2,io.set(to,ue);var co=equalArrays$1(ao(to),ao(ue),no,ro,oo,io);return io.delete(to),co;case symbolTag$2:if(symbolValueOf$1)return symbolValueOf$1.call(to)==symbolValueOf$1.call(ue)}return!1}var _equalByTag=equalByTag$1;function arrayPush$3(to,ue){for(var eo=-1,no=ue.length,ro=to.length;++eo<no;)to[ro+eo]=ue[eo];return to}var _arrayPush=arrayPush$3,arrayPush$2=_arrayPush,isArray$b=isArray_1;function baseGetAllKeys$2(to,ue,eo){var no=ue(to);return isArray$b(to)?no:arrayPush$2(no,eo(to))}var _baseGetAllKeys=baseGetAllKeys$2;function arrayFilter$1(to,ue){for(var eo=-1,no=to==null?0:to.length,ro=0,oo=[];++eo<no;){var io=to[eo];ue(io,eo,to)&&(oo[ro++]=io)}return oo}var _arrayFilter=arrayFilter$1;function stubArray$2(){return[]}var stubArray_1=stubArray$2,arrayFilter=_arrayFilter,stubArray$1=stubArray_1,objectProto$8=Object.prototype,propertyIsEnumerable=objectProto$8.propertyIsEnumerable,nativeGetSymbols$1=Object.getOwnPropertySymbols,getSymbols$3=nativeGetSymbols$1?function(to){return to==null?[]:(to=Object(to),arrayFilter(nativeGetSymbols$1(to),function(ue){return propertyIsEnumerable.call(to,ue)}))}:stubArray$1,_getSymbols=getSymbols$3,baseGetAllKeys$1=_baseGetAllKeys,getSymbols$2=_getSymbols,keys$3=keys_1;function getAllKeys$2(to){return baseGetAllKeys$1(to,keys$3,getSymbols$2)}var _getAllKeys=getAllKeys$2,getAllKeys$1=_getAllKeys,COMPARE_PARTIAL_FLAG$3=1,objectProto$7=Object.prototype,hasOwnProperty$a=objectProto$7.hasOwnProperty;function equalObjects$1(to,ue,eo,no,ro,oo){var io=eo&COMPARE_PARTIAL_FLAG$3,ao=getAllKeys$1(to),so=ao.length,lo=getAllKeys$1(ue),co=lo.length;if(so!=co&&!io)return!1;for(var uo=so;uo--;){var fo=ao[uo];if(!(io?fo in ue:hasOwnProperty$a.call(ue,fo)))return!1}var po=oo.get(to),ho=oo.get(ue);if(po&&ho)return po==ue&&ho==to;var _o=!0;oo.set(to,ue),oo.set(ue,to);for(var go=io;++uo<so;){fo=ao[uo];var bo=to[fo],vo=ue[fo];if(no)var yo=io?no(vo,bo,fo,ue,to,oo):no(bo,vo,fo,to,ue,oo);if(!(yo===void 0?bo===vo||ro(bo,vo,eo,no,oo):yo)){_o=!1;break}go||(go=fo=="constructor")}if(_o&&!go){var wo=to.constructor,ko=ue.constructor;wo!=ko&&"constructor"in to&&"constructor"in ue&&!(typeof wo=="function"&&wo instanceof wo&&typeof ko=="function"&&ko instanceof ko)&&(_o=!1)}return oo.delete(to),oo.delete(ue),_o}var _equalObjects=equalObjects$1,getNative$3=_getNative,root$9=_root,DataView$2=getNative$3(root$9,"DataView"),_DataView=DataView$2,getNative$2=_getNative,root$8=_root,Promise$2=getNative$2(root$8,"Promise"),_Promise=Promise$2,getNative$1=_getNative,root$7=_root,Set$2=getNative$1(root$7,"Set"),_Set=Set$2,getNative=_getNative,root$6=_root,WeakMap$3=getNative(root$6,"WeakMap"),_WeakMap=WeakMap$3,DataView$1=_DataView,Map$1=_Map,Promise$1=_Promise,Set$1=_Set,WeakMap$2=_WeakMap,baseGetTag$2=_baseGetTag,toSource=_toSource,mapTag$3="[object Map]",objectTag$3="[object Object]",promiseTag="[object Promise]",setTag$3="[object Set]",weakMapTag$2="[object WeakMap]",dataViewTag$2="[object DataView]",dataViewCtorString=toSource(DataView$1),mapCtorString=toSource(Map$1),promiseCtorString=toSource(Promise$1),setCtorString=toSource(Set$1),weakMapCtorString=toSource(WeakMap$2),getTag$5=baseGetTag$2;(DataView$1&&getTag$5(new DataView$1(new ArrayBuffer(1)))!=dataViewTag$2||Map$1&&getTag$5(new Map$1)!=mapTag$3||Promise$1&&getTag$5(Promise$1.resolve())!=promiseTag||Set$1&&getTag$5(new Set$1)!=setTag$3||WeakMap$2&&getTag$5(new WeakMap$2)!=weakMapTag$2)&&(getTag$5=function(to){var ue=baseGetTag$2(to),eo=ue==objectTag$3?to.constructor:void 0,no=eo?toSource(eo):"";if(no)switch(no){case dataViewCtorString:return dataViewTag$2;case mapCtorString:return mapTag$3;case promiseCtorString:return promiseTag;case setCtorString:return setTag$3;case weakMapCtorString:return weakMapTag$2}return ue});var _getTag=getTag$5,Stack$3=_Stack,equalArrays=_equalArrays,equalByTag=_equalByTag,equalObjects=_equalObjects,getTag$4=_getTag,isArray$a=isArray_1,isBuffer$6=isBufferExports,isTypedArray=isTypedArray_1,COMPARE_PARTIAL_FLAG$2=1,argsTag$1="[object Arguments]",arrayTag$1="[object Array]",objectTag$2="[object Object]",objectProto$6=Object.prototype,hasOwnProperty$9=objectProto$6.hasOwnProperty;function baseIsEqualDeep$1(to,ue,eo,no,ro,oo){var io=isArray$a(to),ao=isArray$a(ue),so=io?arrayTag$1:getTag$4(to),lo=ao?arrayTag$1:getTag$4(ue);so=so==argsTag$1?objectTag$2:so,lo=lo==argsTag$1?objectTag$2:lo;var co=so==objectTag$2,uo=lo==objectTag$2,fo=so==lo;if(fo&&isBuffer$6(to)){if(!isBuffer$6(ue))return!1;io=!0,co=!1}if(fo&&!co)return oo||(oo=new Stack$3),io||isTypedArray(to)?equalArrays(to,ue,eo,no,ro,oo):equalByTag(to,ue,so,eo,no,ro,oo);if(!(eo&COMPARE_PARTIAL_FLAG$2)){var po=co&&hasOwnProperty$9.call(to,"__wrapped__"),ho=uo&&hasOwnProperty$9.call(ue,"__wrapped__");if(po||ho){var _o=po?to.value():to,go=ho?ue.value():ue;return oo||(oo=new Stack$3),ro(_o,go,eo,no,oo)}}return fo?(oo||(oo=new Stack$3),equalObjects(to,ue,eo,no,ro,oo)):!1}var _baseIsEqualDeep=baseIsEqualDeep$1,baseIsEqualDeep=_baseIsEqualDeep,isObjectLike$6=isObjectLike_1;function baseIsEqual$2(to,ue,eo,no,ro){return to===ue?!0:to==null||ue==null||!isObjectLike$6(to)&&!isObjectLike$6(ue)?to!==to&&ue!==ue:baseIsEqualDeep(to,ue,eo,no,baseIsEqual$2,ro)}var _baseIsEqual=baseIsEqual$2,Stack$2=_Stack,baseIsEqual$1=_baseIsEqual,COMPARE_PARTIAL_FLAG$1=1,COMPARE_UNORDERED_FLAG$1=2;function baseIsMatch$1(to,ue,eo,no){var ro=eo.length,oo=ro,io=!no;if(to==null)return!oo;for(to=Object(to);ro--;){var ao=eo[ro];if(io&&ao[2]?ao[1]!==to[ao[0]]:!(ao[0]in to))return!1}for(;++ro<oo;){ao=eo[ro];var so=ao[0],lo=to[so],co=ao[1];if(io&&ao[2]){if(lo===void 0&&!(so in to))return!1}else{var uo=new Stack$2;if(no)var fo=no(lo,co,so,to,ue,uo);if(!(fo===void 0?baseIsEqual$1(co,lo,COMPARE_PARTIAL_FLAG$1|COMPARE_UNORDERED_FLAG$1,no,uo):fo))return!1}}return!0}var _baseIsMatch=baseIsMatch$1,isObject$a=isObject_1;function isStrictComparable$2(to){return to===to&&!isObject$a(to)}var _isStrictComparable=isStrictComparable$2,isStrictComparable$1=_isStrictComparable,keys$2=keys_1;function getMatchData$1(to){for(var ue=keys$2(to),eo=ue.length;eo--;){var no=ue[eo],ro=to[no];ue[eo]=[no,ro,isStrictComparable$1(ro)]}return ue}var _getMatchData=getMatchData$1;function matchesStrictComparable$2(to,ue){return function(eo){return eo==null?!1:eo[to]===ue&&(ue!==void 0||to in Object(eo))}}var _matchesStrictComparable=matchesStrictComparable$2,baseIsMatch=_baseIsMatch,getMatchData=_getMatchData,matchesStrictComparable$1=_matchesStrictComparable;function baseMatches$1(to){var ue=getMatchData(to);return ue.length==1&&ue[0][2]?matchesStrictComparable$1(ue[0][0],ue[0][1]):function(eo){return eo===to||baseIsMatch(eo,to,ue)}}var _baseMatches=baseMatches$1,castPath=_castPath,toKey$3=_toKey;function baseGet$2(to,ue){ue=castPath(ue,to);for(var eo=0,no=ue.length;to!=null&&eo<no;)to=to[toKey$3(ue[eo++])];return eo&&eo==no?to:void 0}var _baseGet=baseGet$2,baseGet$1=_baseGet;function get$4(to,ue,eo){var no=to==null?void 0:baseGet$1(to,ue);return no===void 0?eo:no}var get_1=get$4;function baseHasIn$1(to,ue){return to!=null&&ue in Object(to)}var _baseHasIn=baseHasIn$1,baseHasIn=_baseHasIn,hasPath=_hasPath;function hasIn$1(to,ue){return to!=null&&hasPath(to,ue,baseHasIn)}var hasIn_1=hasIn$1,baseIsEqual=_baseIsEqual,get$3=get_1,hasIn=hasIn_1,isKey$1=_isKey,isStrictComparable=_isStrictComparable,matchesStrictComparable=_matchesStrictComparable,toKey$2=_toKey,COMPARE_PARTIAL_FLAG=1,COMPARE_UNORDERED_FLAG=2;function baseMatchesProperty$1(to,ue){return isKey$1(to)&&isStrictComparable(ue)?matchesStrictComparable(toKey$2(to),ue):function(eo){var no=get$3(eo,to);return no===void 0&&no===ue?hasIn(eo,to):baseIsEqual(ue,no,COMPARE_PARTIAL_FLAG|COMPARE_UNORDERED_FLAG)}}var _baseMatchesProperty=baseMatchesProperty$1;function identity$5(to){return to}var identity_1=identity$5;function baseProperty$1(to){return function(ue){return ue==null?void 0:ue[to]}}var _baseProperty=baseProperty$1,baseGet=_baseGet;function basePropertyDeep$1(to){return function(ue){return baseGet(ue,to)}}var _basePropertyDeep=basePropertyDeep$1,baseProperty=_baseProperty,basePropertyDeep=_basePropertyDeep,isKey=_isKey,toKey$1=_toKey;function property$1(to){return isKey(to)?baseProperty(toKey$1(to)):basePropertyDeep(to)}var property_1=property$1,baseMatches=_baseMatches,baseMatchesProperty=_baseMatchesProperty,identity$4=identity_1,isArray$9=isArray_1,property=property_1;function baseIteratee$3(to){return typeof to=="function"?to:to==null?identity$4:typeof to=="object"?isArray$9(to)?baseMatchesProperty(to[0],to[1]):baseMatches(to):property(to)}var _baseIteratee=baseIteratee$3,baseAssignValue$3=_baseAssignValue,baseForOwn$1=_baseForOwn,baseIteratee$2=_baseIteratee;function mapValues$1(to,ue){var eo={};return ue=baseIteratee$2(ue),baseForOwn$1(to,function(no,ro,oo){baseAssignValue$3(eo,ro,ue(no,ro,oo))}),eo}var mapValues_1=mapValues$1;const mapValues$2=getDefaultExportFromCjs$1(mapValues_1);function Cache$1(to){this._maxSize=to,this.clear()}Cache$1.prototype.clear=function(){this._size=0,this._values=Object.create(null)};Cache$1.prototype.get=function(to){return this._values[to]};Cache$1.prototype.set=function(to,ue){return this._size>=this._maxSize&&this.clear(),to in this._values||this._size++,this._values[to]=ue};var SPLIT_REGEX=/[^.^\]^[]+|(?=\[\]|\.\.)/g,DIGIT_REGEX=/^\d+$/,LEAD_DIGIT_REGEX=/^\d/,SPEC_CHAR_REGEX=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,CLEAN_QUOTES_REGEX=/^\s*(['"]?)(.*?)(\1)\s*$/,MAX_CACHE_SIZE=512,pathCache=new Cache$1(MAX_CACHE_SIZE),setCache=new Cache$1(MAX_CACHE_SIZE),getCache=new Cache$1(MAX_CACHE_SIZE),propertyExpr={Cache:Cache$1,split:split$1,normalizePath,setter:function(to){var ue=normalizePath(to);return setCache.get(to)||setCache.set(to,function(no,ro){for(var oo=0,io=ue.length,ao=no;oo<io-1;){var so=ue[oo];if(so==="__proto__"||so==="constructor"||so==="prototype")return no;ao=ao[ue[oo++]]}ao[ue[oo]]=ro})},getter:function(to,ue){var eo=normalizePath(to);return getCache.get(to)||getCache.set(to,function(ro){for(var oo=0,io=eo.length;oo<io;)if(ro!=null||!ue)ro=ro[eo[oo++]];else return;return ro})},join:function(to){return to.reduce(function(ue,eo){return ue+(isQuoted(eo)||DIGIT_REGEX.test(eo)?"["+eo+"]":(ue?".":"")+eo)},"")},forEach:function(to,ue,eo){forEach$1(Array.isArray(to)?to:split$1(to),ue,eo)}};function normalizePath(to){return pathCache.get(to)||pathCache.set(to,split$1(to).map(function(ue){return ue.replace(CLEAN_QUOTES_REGEX,"$2")}))}function split$1(to){return to.match(SPLIT_REGEX)||[""]}function forEach$1(to,ue,eo){var no=to.length,ro,oo,io,ao;for(oo=0;oo<no;oo++)ro=to[oo],ro&&(shouldBeQuoted(ro)&&(ro='"'+ro+'"'),ao=isQuoted(ro),io=!ao&&/^\d+$/.test(ro),ue.call(eo,ro,ao,io,oo,to))}function isQuoted(to){return typeof to=="string"&&to&&["'",'"'].indexOf(to.charAt(0))!==-1}function hasLeadingNumber(to){return to.match(LEAD_DIGIT_REGEX)&&!to.match(DIGIT_REGEX)}function hasSpecialChars(to){return SPEC_CHAR_REGEX.test(to)}function shouldBeQuoted(to){return!isQuoted(to)&&(hasLeadingNumber(to)||hasSpecialChars(to))}const prefixes$2={context:"$",value:"."};function create$e(to,ue){return new Reference$1(to,ue)}let Reference$1=class{constructor(ue,eo={}){if(typeof ue!="string")throw new TypeError("ref must be a string, got: "+ue);if(this.key=ue.trim(),ue==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===prefixes$2.context,this.isValue=this.key[0]===prefixes$2.value,this.isSibling=!this.isContext&&!this.isValue;let no=this.isContext?prefixes$2.context:this.isValue?prefixes$2.value:"";this.path=this.key.slice(no.length),this.getter=this.path&&propertyExpr.getter(this.path,!0),this.map=eo.map}getValue(ue,eo,no){let ro=this.isContext?no:this.isValue?ue:eo;return this.getter&&(ro=this.getter(ro||{})),this.map&&(ro=this.map(ro)),ro}cast(ue,eo){return this.getValue(ue,eo==null?void 0:eo.parent,eo==null?void 0:eo.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(ue){return ue&&ue.__isYupRef}};Reference$1.prototype.__isYupRef=!0;function _extends$7(){return _extends$7=Object.assign||function(to){for(var ue=1;ue<arguments.length;ue++){var eo=arguments[ue];for(var no in eo)Object.prototype.hasOwnProperty.call(eo,no)&&(to[no]=eo[no])}return to},_extends$7.apply(this,arguments)}function _objectWithoutPropertiesLoose$1(to,ue){if(to==null)return{};var eo={},no=Object.keys(to),ro,oo;for(oo=0;oo<no.length;oo++)ro=no[oo],!(ue.indexOf(ro)>=0)&&(eo[ro]=to[ro]);return eo}function createValidation$1(to){function ue(eo,no){let{value:ro,path:oo="",label:io,options:ao,originalValue:so,sync:lo}=eo,co=_objectWithoutPropertiesLoose$1(eo,["value","path","label","options","originalValue","sync"]);const{name:uo,test:fo,params:po,message:ho}=to;let{parent:_o,context:go}=ao;function bo(So){return Reference$1.isRef(So)?So.getValue(ro,_o,go):So}function vo(So={}){const Eo=mapValues$2(_extends$7({value:ro,originalValue:so,label:io,path:So.path||oo},po,So.params),bo),Io=new ValidationError$1(ValidationError$1.formatError(So.message||ho,Eo),ro,Eo.path,So.type||uo);return Io.params=Eo,Io}let yo=_extends$7({path:oo,parent:_o,type:uo,createError:vo,resolve:bo,options:ao,originalValue:so},co);if(!lo){try{Promise.resolve(fo.call(yo,ro,yo)).then(So=>{ValidationError$1.isError(So)?no(So):So?no(null,So):no(vo())})}catch(So){no(So)}return}let wo;try{var ko;if(wo=fo.call(yo,ro,yo),typeof((ko=wo)==null?void 0:ko.then)=="function")throw new Error(`Validation test of type: "${yo.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`)}catch(So){no(So);return}ValidationError$1.isError(wo)?no(wo):wo?no(null,wo):no(vo())}return ue.OPTIONS=to,ue}let trim$1=to=>to.substr(0,to.length-1).substr(1);function getIn$1(to,ue,eo,no=eo){let ro,oo,io;return ue?(propertyExpr.forEach(ue,(ao,so,lo)=>{let co=so?trim$1(ao):ao;if(to=to.resolve({context:no,parent:ro,value:eo}),to.innerType){let uo=lo?parseInt(co,10):0;if(eo&&uo>=eo.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${ao}, in the path: ${ue}. because there is no value at that index. `);ro=eo,eo=eo&&eo[uo],to=to.innerType}if(!lo){if(!to.fields||!to.fields[co])throw new Error(`The schema does not contain the path: ${ue}. (failed at: ${io} which is a type: "${to._type}")`);ro=eo,eo=eo&&eo[co],to=to.fields[co]}oo=co,io=so?"["+ao+"]":"."+ao}),{schema:to,parent:ro,parentPath:oo}):{parent:ro,parentPath:ue,schema:to}}const reach=(to,ue,eo,no)=>getIn$1(to,ue,eo,no).schema;let ReferenceSet$1=class G3{constructor(){this.list=new Set,this.refs=new Map}get size(){return this.list.size+this.refs.size}describe(){const ue=[];for(const eo of this.list)ue.push(eo);for(const[,eo]of this.refs)ue.push(eo.describe());return ue}toArray(){return Array.from(this.list).concat(Array.from(this.refs.values()))}add(ue){Reference$1.isRef(ue)?this.refs.set(ue.key,ue):this.list.add(ue)}delete(ue){Reference$1.isRef(ue)?this.refs.delete(ue.key):this.list.delete(ue)}has(ue,eo){if(this.list.has(ue))return!0;let no,ro=this.refs.values();for(;no=ro.next(),!no.done;)if(eo(no.value)===ue)return!0;return!1}clone(){const ue=new G3;return ue.list=new Set(this.list),ue.refs=new Map(this.refs),ue}merge(ue,eo){const no=this.clone();return ue.list.forEach(ro=>no.add(ro)),ue.refs.forEach(ro=>no.add(ro)),eo.list.forEach(ro=>no.delete(ro)),eo.refs.forEach(ro=>no.delete(ro)),no}};function _extends$6(){return _extends$6=Object.assign||function(to){for(var ue=1;ue<arguments.length;ue++){var eo=arguments[ue];for(var no in eo)Object.prototype.hasOwnProperty.call(eo,no)&&(to[no]=eo[no])}return to},_extends$6.apply(this,arguments)}let BaseSchema$1=class{constructor(ue){this.deps=[],this.conditions=[],this._whitelist=new ReferenceSet$1,this._blacklist=new ReferenceSet$1,this.exclusiveTests=Object.create(null),this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(mixed$1.notType)}),this.type=(ue==null?void 0:ue.type)||"mixed",this.spec=_extends$6({strip:!1,strict:!1,abortEarly:!0,recursive:!0,nullable:!1,presence:"optional"},ue==null?void 0:ue.spec)}get _type(){return this.type}_typeCheck(ue){return!0}clone(ue){if(this._mutate)return ue&&Object.assign(this.spec,ue),this;const eo=Object.create(Object.getPrototypeOf(this));return eo.type=this.type,eo._typeError=this._typeError,eo._whitelistError=this._whitelistError,eo._blacklistError=this._blacklistError,eo._whitelist=this._whitelist.clone(),eo._blacklist=this._blacklist.clone(),eo.exclusiveTests=_extends$6({},this.exclusiveTests),eo.deps=[...this.deps],eo.conditions=[...this.conditions],eo.tests=[...this.tests],eo.transforms=[...this.transforms],eo.spec=clone$3(_extends$6({},this.spec,ue)),eo}label(ue){var eo=this.clone();return eo.spec.label=ue,eo}meta(...ue){if(ue.length===0)return this.spec.meta;let eo=this.clone();return eo.spec.meta=Object.assign(eo.spec.meta||{},ue[0]),eo}withMutation(ue){let eo=this._mutate;this._mutate=!0;let no=ue(this);return this._mutate=eo,no}concat(ue){if(!ue||ue===this)return this;if(ue.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${ue.type}`);let eo=this,no=ue.clone();const ro=_extends$6({},eo.spec,no.spec);return no.spec=ro,no._typeError||(no._typeError=eo._typeError),no._whitelistError||(no._whitelistError=eo._whitelistError),no._blacklistError||(no._blacklistError=eo._blacklistError),no._whitelist=eo._whitelist.merge(ue._whitelist,ue._blacklist),no._blacklist=eo._blacklist.merge(ue._blacklist,ue._whitelist),no.tests=eo.tests,no.exclusiveTests=eo.exclusiveTests,no.withMutation(oo=>{ue.tests.forEach(io=>{oo.test(io.OPTIONS)})}),no}isType(ue){return this.spec.nullable&&ue===null?!0:this._typeCheck(ue)}resolve(ue){let eo=this;if(eo.conditions.length){let no=eo.conditions;eo=eo.clone(),eo.conditions=[],eo=no.reduce((ro,oo)=>oo.resolve(ro,ue),eo),eo=eo.resolve(ue)}return eo}cast(ue,eo={}){let no=this.resolve(_extends$6({value:ue},eo)),ro=no._cast(ue,eo);if(ue!==void 0&&eo.assert!==!1&&no.isType(ro)!==!0){let oo=printValue$1(ue),io=printValue$1(ro);throw new TypeError(`The value of ${eo.path||"field"} could not be cast to a value that satisfies the schema type: "${no._type}".
|
|
33
33
|
|
|
34
34
|
attempted value: ${oo}
|
|
35
35
|
`+(io!==oo?`result of cast: ${io}`:""))}return ro}_cast(ue,eo){let no=ue===void 0?ue:this.transforms.reduce((ro,oo)=>oo.call(this,ro,ue,this),ue);return no===void 0&&(no=this.getDefault()),no}_validate(ue,eo={},no){let{sync:ro,path:oo,from:io=[],originalValue:ao=ue,strict:so=this.spec.strict,abortEarly:lo=this.spec.abortEarly}=eo,co=ue;so||(co=this._cast(co,_extends$6({assert:!1},eo)));let uo={value:co,path:oo,options:eo,originalValue:ao,schema:this,label:this.spec.label,sync:ro,from:io},fo=[];this._typeError&&fo.push(this._typeError),this._whitelistError&&fo.push(this._whitelistError),this._blacklistError&&fo.push(this._blacklistError),runTests$1({args:uo,value:co,path:oo,sync:ro,tests:fo,endEarly:lo},po=>{if(po)return void no(po,co);runTests$1({tests:this.tests,args:uo,path:oo,sync:ro,value:co,endEarly:lo},no)})}validate(ue,eo,no){let ro=this.resolve(_extends$6({},eo,{value:ue}));return typeof no=="function"?ro._validate(ue,eo,no):new Promise((oo,io)=>ro._validate(ue,eo,(ao,so)=>{ao?io(ao):oo(so)}))}validateSync(ue,eo){let no=this.resolve(_extends$6({},eo,{value:ue})),ro;return no._validate(ue,_extends$6({},eo,{sync:!0}),(oo,io)=>{if(oo)throw oo;ro=io}),ro}isValid(ue,eo){return this.validate(ue,eo).then(()=>!0,no=>{if(ValidationError$1.isError(no))return!1;throw no})}isValidSync(ue,eo){try{return this.validateSync(ue,eo),!0}catch(no){if(ValidationError$1.isError(no))return!1;throw no}}_getDefault(){let ue=this.spec.default;return ue==null?ue:typeof ue=="function"?ue.call(this):clone$3(ue)}getDefault(ue){return this.resolve(ue||{})._getDefault()}default(ue){return arguments.length===0?this._getDefault():this.clone({default:ue})}strict(ue=!0){var eo=this.clone();return eo.spec.strict=ue,eo}_isPresent(ue){return ue!=null}defined(ue=mixed$1.defined){return this.test({message:ue,name:"defined",exclusive:!0,test(eo){return eo!==void 0}})}required(ue=mixed$1.required){return this.clone({presence:"required"}).withMutation(eo=>eo.test({message:ue,name:"required",exclusive:!0,test(no){return this.schema._isPresent(no)}}))}notRequired(){var ue=this.clone({presence:"optional"});return ue.tests=ue.tests.filter(eo=>eo.OPTIONS.name!=="required"),ue}nullable(ue=!0){var eo=this.clone({nullable:ue!==!1});return eo}transform(ue){var eo=this.clone();return eo.transforms.push(ue),eo}test(...ue){let eo;if(ue.length===1?typeof ue[0]=="function"?eo={test:ue[0]}:eo=ue[0]:ue.length===2?eo={name:ue[0],test:ue[1]}:eo={name:ue[0],message:ue[1],test:ue[2]},eo.message===void 0&&(eo.message=mixed$1.default),typeof eo.test!="function")throw new TypeError("`test` is a required parameters");let no=this.clone(),ro=createValidation$1(eo),oo=eo.exclusive||eo.name&&no.exclusiveTests[eo.name]===!0;if(eo.exclusive&&!eo.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return eo.name&&(no.exclusiveTests[eo.name]=!!eo.exclusive),no.tests=no.tests.filter(io=>!(io.OPTIONS.name===eo.name&&(oo||io.OPTIONS.test===ro.OPTIONS.test))),no.tests.push(ro),no}when(ue,eo){!Array.isArray(ue)&&typeof ue!="string"&&(eo=ue,ue=".");let no=this.clone(),ro=toArray$3(ue).map(oo=>new Reference$1(oo));return ro.forEach(oo=>{oo.isSibling&&no.deps.push(oo.key)}),no.conditions.push(new Condition$1(ro,eo)),no}typeError(ue){var eo=this.clone();return eo._typeError=createValidation$1({message:ue,name:"typeError",test(no){return no!==void 0&&!this.schema.isType(no)?this.createError({params:{type:this.schema._type}}):!0}}),eo}oneOf(ue,eo=mixed$1.oneOf){var no=this.clone();return ue.forEach(ro=>{no._whitelist.add(ro),no._blacklist.delete(ro)}),no._whitelistError=createValidation$1({message:eo,name:"oneOf",test(ro){if(ro===void 0)return!0;let oo=this.schema._whitelist;return oo.has(ro,this.resolve)?!0:this.createError({params:{values:oo.toArray().join(", ")}})}}),no}notOneOf(ue,eo=mixed$1.notOneOf){var no=this.clone();return ue.forEach(ro=>{no._blacklist.add(ro),no._whitelist.delete(ro)}),no._blacklistError=createValidation$1({message:eo,name:"notOneOf",test(ro){let oo=this.schema._blacklist;return oo.has(ro,this.resolve)?this.createError({params:{values:oo.toArray().join(", ")}}):!0}}),no}strip(ue=!0){let eo=this.clone();return eo.spec.strip=ue,eo}describe(){const ue=this.clone(),{label:eo,meta:no}=ue.spec;return{meta:no,label:eo,type:ue.type,oneOf:ue._whitelist.describe(),notOneOf:ue._blacklist.describe(),tests:ue.tests.map(oo=>({name:oo.OPTIONS.name,params:oo.OPTIONS.params})).filter((oo,io,ao)=>ao.findIndex(so=>so.name===oo.name)===io)}}};BaseSchema$1.prototype.__isYupSchema__=!0;for(const to of["validate","validateSync"])BaseSchema$1.prototype[`${to}At`]=function(ue,eo,no={}){const{parent:ro,parentPath:oo,schema:io}=getIn$1(this,ue,eo,no.context);return io[to](ro&&ro[oo],_extends$6({},no,{parent:ro,path:ue}))};for(const to of["equals","is"])BaseSchema$1.prototype[to]=BaseSchema$1.prototype.oneOf;for(const to of["not","nope"])BaseSchema$1.prototype[to]=BaseSchema$1.prototype.notOneOf;BaseSchema$1.prototype.optional=BaseSchema$1.prototype.notRequired;const Mixed$1=BaseSchema$1;function create$d(){return new Mixed$1}create$d.prototype=Mixed$1.prototype;const isAbsent$1=to=>to==null;function create$c(){return new BooleanSchema}class BooleanSchema extends BaseSchema$1{constructor(){super({type:"boolean"}),this.withMutation(()=>{this.transform(function(ue){if(!this.isType(ue)){if(/^(true|1)$/i.test(String(ue)))return!0;if(/^(false|0)$/i.test(String(ue)))return!1}return ue})})}_typeCheck(ue){return ue instanceof Boolean&&(ue=ue.valueOf()),typeof ue=="boolean"}isTrue(ue=boolean$1.isValue){return this.test({message:ue,name:"is-value",exclusive:!0,params:{value:"true"},test(eo){return isAbsent$1(eo)||eo===!0}})}isFalse(ue=boolean$1.isValue){return this.test({message:ue,name:"is-value",exclusive:!0,params:{value:"false"},test(eo){return isAbsent$1(eo)||eo===!1}})}}create$c.prototype=BooleanSchema.prototype;let rEmail$1=/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i,rUrl$1=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,rUUID$1=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,isTrimmed$1=to=>isAbsent$1(to)||to===to.trim(),objStringTag$1={}.toString();function create$b(){return new StringSchema$1}let StringSchema$1=class extends BaseSchema$1{constructor(){super({type:"string"}),this.withMutation(()=>{this.transform(function(ue){if(this.isType(ue)||Array.isArray(ue))return ue;const eo=ue!=null&&ue.toString?ue.toString():ue;return eo===objStringTag$1?ue:eo})})}_typeCheck(ue){return ue instanceof String&&(ue=ue.valueOf()),typeof ue=="string"}_isPresent(ue){return super._isPresent(ue)&&!!ue.length}length(ue,eo=string$3.length){return this.test({message:eo,name:"length",exclusive:!0,params:{length:ue},test(no){return isAbsent$1(no)||no.length===this.resolve(ue)}})}min(ue,eo=string$3.min){return this.test({message:eo,name:"min",exclusive:!0,params:{min:ue},test(no){return isAbsent$1(no)||no.length>=this.resolve(ue)}})}max(ue,eo=string$3.max){return this.test({name:"max",exclusive:!0,message:eo,params:{max:ue},test(no){return isAbsent$1(no)||no.length<=this.resolve(ue)}})}matches(ue,eo){let no=!1,ro,oo;return eo&&(typeof eo=="object"?{excludeEmptyString:no=!1,message:ro,name:oo}=eo:ro=eo),this.test({name:oo||"matches",message:ro||string$3.matches,params:{regex:ue},test:io=>isAbsent$1(io)||io===""&&no||io.search(ue)!==-1})}email(ue=string$3.email){return this.matches(rEmail$1,{name:"email",message:ue,excludeEmptyString:!0})}url(ue=string$3.url){return this.matches(rUrl$1,{name:"url",message:ue,excludeEmptyString:!0})}uuid(ue=string$3.uuid){return this.matches(rUUID$1,{name:"uuid",message:ue,excludeEmptyString:!1})}ensure(){return this.default("").transform(ue=>ue===null?"":ue)}trim(ue=string$3.trim){return this.transform(eo=>eo!=null?eo.trim():eo).test({message:ue,name:"trim",test:isTrimmed$1})}lowercase(ue=string$3.lowercase){return this.transform(eo=>isAbsent$1(eo)?eo:eo.toLowerCase()).test({message:ue,name:"string_case",exclusive:!0,test:eo=>isAbsent$1(eo)||eo===eo.toLowerCase()})}uppercase(ue=string$3.uppercase){return this.transform(eo=>isAbsent$1(eo)?eo:eo.toUpperCase()).test({message:ue,name:"string_case",exclusive:!0,test:eo=>isAbsent$1(eo)||eo===eo.toUpperCase()})}};create$b.prototype=StringSchema$1.prototype;let isNaN$2=to=>to!=+to;function create$a(){return new NumberSchema$1}let NumberSchema$1=class extends BaseSchema$1{constructor(){super({type:"number"}),this.withMutation(()=>{this.transform(function(ue){let eo=ue;if(typeof eo=="string"){if(eo=eo.replace(/\s/g,""),eo==="")return NaN;eo=+eo}return this.isType(eo)?eo:parseFloat(eo)})})}_typeCheck(ue){return ue instanceof Number&&(ue=ue.valueOf()),typeof ue=="number"&&!isNaN$2(ue)}min(ue,eo=number$3.min){return this.test({message:eo,name:"min",exclusive:!0,params:{min:ue},test(no){return isAbsent$1(no)||no>=this.resolve(ue)}})}max(ue,eo=number$3.max){return this.test({message:eo,name:"max",exclusive:!0,params:{max:ue},test(no){return isAbsent$1(no)||no<=this.resolve(ue)}})}lessThan(ue,eo=number$3.lessThan){return this.test({message:eo,name:"max",exclusive:!0,params:{less:ue},test(no){return isAbsent$1(no)||no<this.resolve(ue)}})}moreThan(ue,eo=number$3.moreThan){return this.test({message:eo,name:"min",exclusive:!0,params:{more:ue},test(no){return isAbsent$1(no)||no>this.resolve(ue)}})}positive(ue=number$3.positive){return this.moreThan(0,ue)}negative(ue=number$3.negative){return this.lessThan(0,ue)}integer(ue=number$3.integer){return this.test({name:"integer",message:ue,test:eo=>isAbsent$1(eo)||Number.isInteger(eo)})}truncate(){return this.transform(ue=>isAbsent$1(ue)?ue:ue|0)}round(ue){var eo,no=["ceil","floor","round","trunc"];if(ue=((eo=ue)==null?void 0:eo.toLowerCase())||"round",ue==="trunc")return this.truncate();if(no.indexOf(ue.toLowerCase())===-1)throw new TypeError("Only valid options for round() are: "+no.join(", "));return this.transform(ro=>isAbsent$1(ro)?ro:Math[ue](ro))}};create$a.prototype=NumberSchema$1.prototype;var isoReg$1=/^(\d{4}|[+\-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,\.](\d{1,}))?)?(?:(Z)|([+\-])(\d{2})(?::?(\d{2}))?)?)?$/;function parseIsoDate$1(to){var ue=[1,4,5,6,7,10,11],eo=0,no,ro;if(ro=isoReg$1.exec(to)){for(var oo=0,io;io=ue[oo];++oo)ro[io]=+ro[io]||0;ro[2]=(+ro[2]||1)-1,ro[3]=+ro[3]||1,ro[7]=ro[7]?String(ro[7]).substr(0,3):0,(ro[8]===void 0||ro[8]==="")&&(ro[9]===void 0||ro[9]==="")?no=+new Date(ro[1],ro[2],ro[3],ro[4],ro[5],ro[6],ro[7]):(ro[8]!=="Z"&&ro[9]!==void 0&&(eo=ro[10]*60+ro[11],ro[9]==="+"&&(eo=0-eo)),no=Date.UTC(ro[1],ro[2],ro[3],ro[4],ro[5]+eo,ro[6],ro[7]))}else no=Date.parse?Date.parse(to):NaN;return no}let invalidDate$1=new Date(""),isDate$4=to=>Object.prototype.toString.call(to)==="[object Date]";function create$9(){return new DateSchema$1}let DateSchema$1=class extends BaseSchema$1{constructor(){super({type:"date"}),this.withMutation(()=>{this.transform(function(ue){return this.isType(ue)?ue:(ue=parseIsoDate$1(ue),isNaN(ue)?invalidDate$1:new Date(ue))})})}_typeCheck(ue){return isDate$4(ue)&&!isNaN(ue.getTime())}prepareParam(ue,eo){let no;if(Reference$1.isRef(ue))no=ue;else{let ro=this.cast(ue);if(!this._typeCheck(ro))throw new TypeError(`\`${eo}\` must be a Date or a value that can be \`cast()\` to a Date`);no=ro}return no}min(ue,eo=date$4.min){let no=this.prepareParam(ue,"min");return this.test({message:eo,name:"min",exclusive:!0,params:{min:ue},test(ro){return isAbsent$1(ro)||ro>=this.resolve(no)}})}max(ue,eo=date$4.max){var no=this.prepareParam(ue,"max");return this.test({message:eo,name:"max",exclusive:!0,params:{max:ue},test(ro){return isAbsent$1(ro)||ro<=this.resolve(no)}})}};DateSchema$1.INVALID_DATE=invalidDate$1;create$9.prototype=DateSchema$1.prototype;create$9.INVALID_DATE=invalidDate$1;function arrayReduce$1(to,ue,eo,no){var ro=-1,oo=to==null?0:to.length;for(no&&oo&&(eo=to[++ro]);++ro<oo;)eo=ue(eo,to[ro],ro,to);return eo}var _arrayReduce=arrayReduce$1;function basePropertyOf$1(to){return function(ue){return to==null?void 0:to[ue]}}var _basePropertyOf=basePropertyOf$1,basePropertyOf=_basePropertyOf,deburredLetters={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},deburrLetter$1=basePropertyOf(deburredLetters),_deburrLetter=deburrLetter$1,deburrLetter=_deburrLetter,toString$9=toString_1,reLatin=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,rsComboMarksRange$3="\\u0300-\\u036f",reComboHalfMarksRange$3="\\ufe20-\\ufe2f",rsComboSymbolsRange$3="\\u20d0-\\u20ff",rsComboRange$3=rsComboMarksRange$3+reComboHalfMarksRange$3+rsComboSymbolsRange$3,rsCombo$2="["+rsComboRange$3+"]",reComboMark=RegExp(rsCombo$2,"g");function deburr$1(to){return to=toString$9(to),to&&to.replace(reLatin,deburrLetter).replace(reComboMark,"")}var deburr_1=deburr$1,reAsciiWord=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function asciiWords$1(to){return to.match(reAsciiWord)||[]}var _asciiWords=asciiWords$1,reHasUnicodeWord=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function hasUnicodeWord$1(to){return reHasUnicodeWord.test(to)}var _hasUnicodeWord=hasUnicodeWord$1,rsAstralRange$2="\\ud800-\\udfff",rsComboMarksRange$2="\\u0300-\\u036f",reComboHalfMarksRange$2="\\ufe20-\\ufe2f",rsComboSymbolsRange$2="\\u20d0-\\u20ff",rsComboRange$2=rsComboMarksRange$2+reComboHalfMarksRange$2+rsComboSymbolsRange$2,rsDingbatRange="\\u2700-\\u27bf",rsLowerRange="a-z\\xdf-\\xf6\\xf8-\\xff",rsMathOpRange="\\xac\\xb1\\xd7\\xf7",rsNonCharRange="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",rsPunctuationRange="\\u2000-\\u206f",rsSpaceRange=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",rsUpperRange="A-Z\\xc0-\\xd6\\xd8-\\xde",rsVarRange$2="\\ufe0e\\ufe0f",rsBreakRange=rsMathOpRange+rsNonCharRange+rsPunctuationRange+rsSpaceRange,rsApos$1="['’]",rsBreak="["+rsBreakRange+"]",rsCombo$1="["+rsComboRange$2+"]",rsDigits="\\d+",rsDingbat="["+rsDingbatRange+"]",rsLower="["+rsLowerRange+"]",rsMisc="[^"+rsAstralRange$2+rsBreakRange+rsDigits+rsDingbatRange+rsLowerRange+rsUpperRange+"]",rsFitz$1="\\ud83c[\\udffb-\\udfff]",rsModifier$1="(?:"+rsCombo$1+"|"+rsFitz$1+")",rsNonAstral$1="[^"+rsAstralRange$2+"]",rsRegional$1="(?:\\ud83c[\\udde6-\\uddff]){2}",rsSurrPair$1="[\\ud800-\\udbff][\\udc00-\\udfff]",rsUpper="["+rsUpperRange+"]",rsZWJ$2="\\u200d",rsMiscLower="(?:"+rsLower+"|"+rsMisc+")",rsMiscUpper="(?:"+rsUpper+"|"+rsMisc+")",rsOptContrLower="(?:"+rsApos$1+"(?:d|ll|m|re|s|t|ve))?",rsOptContrUpper="(?:"+rsApos$1+"(?:D|LL|M|RE|S|T|VE))?",reOptMod$1=rsModifier$1+"?",rsOptVar$1="["+rsVarRange$2+"]?",rsOptJoin$1="(?:"+rsZWJ$2+"(?:"+[rsNonAstral$1,rsRegional$1,rsSurrPair$1].join("|")+")"+rsOptVar$1+reOptMod$1+")*",rsOrdLower="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",rsOrdUpper="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",rsSeq$1=rsOptVar$1+reOptMod$1+rsOptJoin$1,rsEmoji="(?:"+[rsDingbat,rsRegional$1,rsSurrPair$1].join("|")+")"+rsSeq$1,reUnicodeWord=RegExp([rsUpper+"?"+rsLower+"+"+rsOptContrLower+"(?="+[rsBreak,rsUpper,"$"].join("|")+")",rsMiscUpper+"+"+rsOptContrUpper+"(?="+[rsBreak,rsUpper+rsMiscLower,"$"].join("|")+")",rsUpper+"?"+rsMiscLower+"+"+rsOptContrLower,rsUpper+"+"+rsOptContrUpper,rsOrdUpper,rsOrdLower,rsDigits,rsEmoji].join("|"),"g");function unicodeWords$1(to){return to.match(reUnicodeWord)||[]}var _unicodeWords=unicodeWords$1,asciiWords=_asciiWords,hasUnicodeWord=_hasUnicodeWord,toString$8=toString_1,unicodeWords=_unicodeWords;function words$1(to,ue,eo){return to=toString$8(to),ue=eo?void 0:ue,ue===void 0?hasUnicodeWord(to)?unicodeWords(to):asciiWords(to):to.match(ue)||[]}var words_1=words$1,arrayReduce=_arrayReduce,deburr=deburr_1,words=words_1,rsApos="['’]",reApos=RegExp(rsApos,"g");function createCompounder$2(to){return function(ue){return arrayReduce(words(deburr(ue).replace(reApos,"")),to,"")}}var _createCompounder=createCompounder$2,createCompounder$1=_createCompounder,snakeCase=createCompounder$1(function(to,ue,eo){return to+(eo?"_":"")+ue.toLowerCase()}),snakeCase_1=snakeCase;const snakeCase$1=getDefaultExportFromCjs$1(snakeCase_1);function baseSlice$1(to,ue,eo){var no=-1,ro=to.length;ue<0&&(ue=-ue>ro?0:ro+ue),eo=eo>ro?ro:eo,eo<0&&(eo+=ro),ro=ue>eo?0:eo-ue>>>0,ue>>>=0;for(var oo=Array(ro);++no<ro;)oo[no]=to[no+ue];return oo}var _baseSlice=baseSlice$1,baseSlice=_baseSlice;function castSlice$1(to,ue,eo){var no=to.length;return eo=eo===void 0?no:eo,!ue&&eo>=no?to:baseSlice(to,ue,eo)}var _castSlice=castSlice$1,rsAstralRange$1="\\ud800-\\udfff",rsComboMarksRange$1="\\u0300-\\u036f",reComboHalfMarksRange$1="\\ufe20-\\ufe2f",rsComboSymbolsRange$1="\\u20d0-\\u20ff",rsComboRange$1=rsComboMarksRange$1+reComboHalfMarksRange$1+rsComboSymbolsRange$1,rsVarRange$1="\\ufe0e\\ufe0f",rsZWJ$1="\\u200d",reHasUnicode=RegExp("["+rsZWJ$1+rsAstralRange$1+rsComboRange$1+rsVarRange$1+"]");function hasUnicode$2(to){return reHasUnicode.test(to)}var _hasUnicode=hasUnicode$2;function asciiToArray$1(to){return to.split("")}var _asciiToArray=asciiToArray$1,rsAstralRange="\\ud800-\\udfff",rsComboMarksRange="\\u0300-\\u036f",reComboHalfMarksRange="\\ufe20-\\ufe2f",rsComboSymbolsRange="\\u20d0-\\u20ff",rsComboRange=rsComboMarksRange+reComboHalfMarksRange+rsComboSymbolsRange,rsVarRange="\\ufe0e\\ufe0f",rsAstral="["+rsAstralRange+"]",rsCombo="["+rsComboRange+"]",rsFitz="\\ud83c[\\udffb-\\udfff]",rsModifier="(?:"+rsCombo+"|"+rsFitz+")",rsNonAstral="[^"+rsAstralRange+"]",rsRegional="(?:\\ud83c[\\udde6-\\uddff]){2}",rsSurrPair="[\\ud800-\\udbff][\\udc00-\\udfff]",rsZWJ="\\u200d",reOptMod=rsModifier+"?",rsOptVar="["+rsVarRange+"]?",rsOptJoin="(?:"+rsZWJ+"(?:"+[rsNonAstral,rsRegional,rsSurrPair].join("|")+")"+rsOptVar+reOptMod+")*",rsSeq=rsOptVar+reOptMod+rsOptJoin,rsSymbol="(?:"+[rsNonAstral+rsCombo+"?",rsCombo,rsRegional,rsSurrPair,rsAstral].join("|")+")",reUnicode=RegExp(rsFitz+"(?="+rsFitz+")|"+rsSymbol+rsSeq,"g");function unicodeToArray$1(to){return to.match(reUnicode)||[]}var _unicodeToArray=unicodeToArray$1,asciiToArray=_asciiToArray,hasUnicode$1=_hasUnicode,unicodeToArray=_unicodeToArray;function stringToArray$1(to){return hasUnicode$1(to)?unicodeToArray(to):asciiToArray(to)}var _stringToArray=stringToArray$1,castSlice=_castSlice,hasUnicode=_hasUnicode,stringToArray=_stringToArray,toString$7=toString_1;function createCaseFirst$1(to){return function(ue){ue=toString$7(ue);var eo=hasUnicode(ue)?stringToArray(ue):void 0,no=eo?eo[0]:ue.charAt(0),ro=eo?castSlice(eo,1).join(""):ue.slice(1);return no[to]()+ro}}var _createCaseFirst=createCaseFirst$1,createCaseFirst=_createCaseFirst,upperFirst$1=createCaseFirst("toUpperCase"),upperFirst_1=upperFirst$1,toString$6=toString_1,upperFirst=upperFirst_1;function capitalize$2(to){return upperFirst(toString$6(to).toLowerCase())}var capitalize_1=capitalize$2,capitalize$1=capitalize_1,createCompounder=_createCompounder,camelCase=createCompounder(function(to,ue,eo){return ue=ue.toLowerCase(),to+(eo?capitalize$1(ue):ue)}),camelCase_1=camelCase;const camelCase$1=getDefaultExportFromCjs$1(camelCase_1);var baseAssignValue$2=_baseAssignValue,baseForOwn=_baseForOwn,baseIteratee$1=_baseIteratee;function mapKeys(to,ue){var eo={};return ue=baseIteratee$1(ue),baseForOwn(to,function(no,ro,oo){baseAssignValue$2(eo,ue(no,ro,oo),no)}),eo}var mapKeys_1=mapKeys;const mapKeys$1=getDefaultExportFromCjs$1(mapKeys_1);var toposort$2={exports:{}};toposort$2.exports=function(to){return toposort(uniqueNodes(to),to)};toposort$2.exports.array=toposort;function toposort(to,ue){var eo=to.length,no=new Array(eo),ro={},oo=eo,io=makeOutgoingEdges(ue),ao=makeNodesHash(to);for(ue.forEach(function(lo){if(!ao.has(lo[0])||!ao.has(lo[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});oo--;)ro[oo]||so(to[oo],oo,new Set);return no;function so(lo,co,uo){if(uo.has(lo)){var fo;try{fo=", node was:"+JSON.stringify(lo)}catch{fo=""}throw new Error("Cyclic dependency"+fo)}if(!ao.has(lo))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(lo));if(!ro[co]){ro[co]=!0;var po=io.get(lo)||new Set;if(po=Array.from(po),co=po.length){uo.add(lo);do{var ho=po[--co];so(ho,ao.get(ho),uo)}while(co);uo.delete(lo)}no[--eo]=lo}}}function uniqueNodes(to){for(var ue=new Set,eo=0,no=to.length;eo<no;eo++){var ro=to[eo];ue.add(ro[0]),ue.add(ro[1])}return Array.from(ue)}function makeOutgoingEdges(to){for(var ue=new Map,eo=0,no=to.length;eo<no;eo++){var ro=to[eo];ue.has(ro[0])||ue.set(ro[0],new Set),ue.has(ro[1])||ue.set(ro[1],new Set),ue.get(ro[0]).add(ro[1])}return ue}function makeNodesHash(to){for(var ue=new Map,eo=0,no=to.length;eo<no;eo++)ue.set(to[eo],eo);return ue}var toposortExports=toposort$2.exports;const toposort$1=getDefaultExportFromCjs$1(toposortExports);function sortFields$1(to,ue=[]){let eo=[],no=[];function ro(oo,io){var ao=propertyExpr.split(oo)[0];~no.indexOf(ao)||no.push(ao),~ue.indexOf(`${io}-${ao}`)||eo.push([io,ao])}for(const oo in to)if(has$7(to,oo)){let io=to[oo];~no.indexOf(oo)||no.push(oo),Reference$1.isRef(io)&&io.isSibling?ro(io.path,oo):isSchema$1(io)&&"deps"in io&&io.deps.forEach(ao=>ro(ao,oo))}return toposort$1.array(no,eo).reverse()}function findIndex$1(to,ue){let eo=1/0;return to.some((no,ro)=>{var oo;if(((oo=ue.path)==null?void 0:oo.indexOf(no))!==-1)return eo=ro,!0}),eo}function sortByKeyOrder$1(to){return(ue,eo)=>findIndex$1(to,ue)-findIndex$1(to,eo)}function _extends$5(){return _extends$5=Object.assign||function(to){for(var ue=1;ue<arguments.length;ue++){var eo=arguments[ue];for(var no in eo)Object.prototype.hasOwnProperty.call(eo,no)&&(to[no]=eo[no])}return to},_extends$5.apply(this,arguments)}let isObject$9=to=>Object.prototype.toString.call(to)==="[object Object]";function unknown$1(to,ue){let eo=Object.keys(to.fields);return Object.keys(ue).filter(no=>eo.indexOf(no)===-1)}const defaultSort$1=sortByKeyOrder$1([]);let ObjectSchema$1=class extends BaseSchema$1{constructor(ue){super({type:"object"}),this.fields=Object.create(null),this._sortErrors=defaultSort$1,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{this.transform(function(no){if(typeof no=="string")try{no=JSON.parse(no)}catch{no=null}return this.isType(no)?no:null}),ue&&this.shape(ue)})}_typeCheck(ue){return isObject$9(ue)||typeof ue=="function"}_cast(ue,eo={}){var no;let ro=super._cast(ue,eo);if(ro===void 0)return this.getDefault();if(!this._typeCheck(ro))return ro;let oo=this.fields,io=(no=eo.stripUnknown)!=null?no:this.spec.noUnknown,ao=this._nodes.concat(Object.keys(ro).filter(uo=>this._nodes.indexOf(uo)===-1)),so={},lo=_extends$5({},eo,{parent:so,__validating:eo.__validating||!1}),co=!1;for(const uo of ao){let fo=oo[uo],po=has$7(ro,uo);if(fo){let ho,_o=ro[uo];lo.path=(eo.path?`${eo.path}.`:"")+uo,fo=fo.resolve({value:_o,context:eo.context,parent:so});let go="spec"in fo?fo.spec:void 0,bo=go==null?void 0:go.strict;if(go!=null&&go.strip){co=co||uo in ro;continue}ho=!eo.__validating||!bo?fo.cast(ro[uo],lo):ro[uo],ho!==void 0&&(so[uo]=ho)}else po&&!io&&(so[uo]=ro[uo]);so[uo]!==ro[uo]&&(co=!0)}return co?so:ro}_validate(ue,eo={},no){let ro=[],{sync:oo,from:io=[],originalValue:ao=ue,abortEarly:so=this.spec.abortEarly,recursive:lo=this.spec.recursive}=eo;io=[{schema:this,value:ao},...io],eo.__validating=!0,eo.originalValue=ao,eo.from=io,super._validate(ue,eo,(co,uo)=>{if(co){if(!ValidationError$1.isError(co)||so)return void no(co,uo);ro.push(co)}if(!lo||!isObject$9(uo)){no(ro[0]||null,uo);return}ao=ao||uo;let fo=this._nodes.map(po=>(ho,_o)=>{let go=po.indexOf(".")===-1?(eo.path?`${eo.path}.`:"")+po:`${eo.path||""}["${po}"]`,bo=this.fields[po];if(bo&&"validate"in bo){bo.validate(uo[po],_extends$5({},eo,{path:go,from:io,strict:!0,parent:uo,originalValue:ao[po]}),_o);return}_o(null)});runTests$1({sync:oo,tests:fo,value:uo,errors:ro,endEarly:so,sort:this._sortErrors,path:eo.path},no)})}clone(ue){const eo=super.clone(ue);return eo.fields=_extends$5({},this.fields),eo._nodes=this._nodes,eo._excludedEdges=this._excludedEdges,eo._sortErrors=this._sortErrors,eo}concat(ue){let eo=super.concat(ue),no=eo.fields;for(let[ro,oo]of Object.entries(this.fields)){const io=no[ro];io===void 0?no[ro]=oo:io instanceof BaseSchema$1&&oo instanceof BaseSchema$1&&(no[ro]=oo.concat(io))}return eo.withMutation(()=>eo.shape(no))}getDefaultFromShape(){let ue={};return this._nodes.forEach(eo=>{const no=this.fields[eo];ue[eo]="default"in no?no.getDefault():void 0}),ue}_getDefault(){if("default"in this.spec)return super._getDefault();if(this._nodes.length)return this.getDefaultFromShape()}shape(ue,eo=[]){let no=this.clone(),ro=Object.assign(no.fields,ue);if(no.fields=ro,no._sortErrors=sortByKeyOrder$1(Object.keys(ro)),eo.length){Array.isArray(eo[0])||(eo=[eo]);let oo=eo.map(([io,ao])=>`${io}-${ao}`);no._excludedEdges=no._excludedEdges.concat(oo)}return no._nodes=sortFields$1(ro,no._excludedEdges),no}pick(ue){const eo={};for(const no of ue)this.fields[no]&&(eo[no]=this.fields[no]);return this.clone().withMutation(no=>(no.fields={},no.shape(eo)))}omit(ue){const eo=this.clone(),no=eo.fields;eo.fields={};for(const ro of ue)delete no[ro];return eo.withMutation(()=>eo.shape(no))}from(ue,eo,no){let ro=propertyExpr.getter(ue,!0);return this.transform(oo=>{if(oo==null)return oo;let io=oo;return has$7(oo,ue)&&(io=_extends$5({},oo),no||delete io[ue],io[eo]=ro(oo)),io})}noUnknown(ue=!0,eo=object$3.noUnknown){typeof ue=="string"&&(eo=ue,ue=!0);let no=this.test({name:"noUnknown",exclusive:!0,message:eo,test(ro){if(ro==null)return!0;const oo=unknown$1(this.schema,ro);return!ue||oo.length===0||this.createError({params:{unknown:oo.join(", ")}})}});return no.spec.noUnknown=ue,no}unknown(ue=!0,eo=object$3.noUnknown){return this.noUnknown(!ue,eo)}transformKeys(ue){return this.transform(eo=>eo&&mapKeys$1(eo,(no,ro)=>ue(ro)))}camelCase(){return this.transformKeys(camelCase$1)}snakeCase(){return this.transformKeys(snakeCase$1)}constantCase(){return this.transformKeys(ue=>snakeCase$1(ue).toUpperCase())}describe(){let ue=super.describe();return ue.fields=mapValues$2(this.fields,eo=>eo.describe()),ue}};function create$8(to){return new ObjectSchema$1(to)}create$8.prototype=ObjectSchema$1.prototype;function _extends$4(){return _extends$4=Object.assign||function(to){for(var ue=1;ue<arguments.length;ue++){var eo=arguments[ue];for(var no in eo)Object.prototype.hasOwnProperty.call(eo,no)&&(to[no]=eo[no])}return to},_extends$4.apply(this,arguments)}function create$7(to){return new ArraySchema(to)}class ArraySchema extends BaseSchema$1{constructor(ue){super({type:"array"}),this.innerType=ue,this.withMutation(()=>{this.transform(function(eo){if(typeof eo=="string")try{eo=JSON.parse(eo)}catch{eo=null}return this.isType(eo)?eo:null})})}_typeCheck(ue){return Array.isArray(ue)}get _subType(){return this.innerType}_cast(ue,eo){const no=super._cast(ue,eo);if(!this._typeCheck(no)||!this.innerType)return no;let ro=!1;const oo=no.map((io,ao)=>{const so=this.innerType.cast(io,_extends$4({},eo,{path:`${eo.path||""}[${ao}]`}));return so!==io&&(ro=!0),so});return ro?oo:no}_validate(ue,eo={},no){var ro,oo;let io=[],ao=eo.sync,so=eo.path,lo=this.innerType,co=(ro=eo.abortEarly)!=null?ro:this.spec.abortEarly,uo=(oo=eo.recursive)!=null?oo:this.spec.recursive,fo=eo.originalValue!=null?eo.originalValue:ue;super._validate(ue,eo,(po,ho)=>{if(po){if(!ValidationError$1.isError(po)||co)return void no(po,ho);io.push(po)}if(!uo||!lo||!this._typeCheck(ho)){no(io[0]||null,ho);return}fo=fo||ho;let _o=new Array(ho.length);for(let go=0;go<ho.length;go++){let bo=ho[go],vo=`${eo.path||""}[${go}]`,yo=_extends$4({},eo,{path:vo,strict:!0,parent:ho,index:go,originalValue:fo[go]});_o[go]=(wo,ko)=>lo.validate(bo,yo,ko)}runTests$1({sync:ao,path:so,value:ho,errors:io,endEarly:co,tests:_o},no)})}clone(ue){const eo=super.clone(ue);return eo.innerType=this.innerType,eo}concat(ue){let eo=super.concat(ue);return eo.innerType=this.innerType,ue.innerType&&(eo.innerType=eo.innerType?eo.innerType.concat(ue.innerType):ue.innerType),eo}of(ue){let eo=this.clone();if(!isSchema$1(ue))throw new TypeError("`array.of()` sub-schema must be a valid yup schema not: "+printValue$1(ue));return eo.innerType=ue,eo}length(ue,eo=array$3.length){return this.test({message:eo,name:"length",exclusive:!0,params:{length:ue},test(no){return isAbsent$1(no)||no.length===this.resolve(ue)}})}min(ue,eo){return eo=eo||array$3.min,this.test({message:eo,name:"min",exclusive:!0,params:{min:ue},test(no){return isAbsent$1(no)||no.length>=this.resolve(ue)}})}max(ue,eo){return eo=eo||array$3.max,this.test({message:eo,name:"max",exclusive:!0,params:{max:ue},test(no){return isAbsent$1(no)||no.length<=this.resolve(ue)}})}ensure(){return this.default(()=>[]).transform((ue,eo)=>this._typeCheck(ue)?ue:eo==null?[]:[].concat(eo))}compact(ue){let eo=ue?(no,ro,oo)=>!ue(no,ro,oo):no=>!!no;return this.transform(no=>no!=null?no.filter(eo):no)}describe(){let ue=super.describe();return this.innerType&&(ue.innerType=this.innerType.describe()),ue}nullable(ue=!0){return super.nullable(ue)}defined(){return super.defined()}required(ue){return super.required(ue)}}create$7.prototype=ArraySchema.prototype;function create$6(to){return new Lazy(to)}class Lazy{constructor(ue){this.type="lazy",this.__isYupSchema__=!0,this._resolve=(eo,no={})=>{let ro=this.builder(eo,no);if(!isSchema$1(ro))throw new TypeError("lazy() functions must return a valid schema");return ro.resolve(no)},this.builder=ue}resolve(ue){return this._resolve(ue.value,ue)}cast(ue,eo){return this._resolve(ue,eo).cast(ue,eo)}validate(ue,eo,no){return this._resolve(ue,eo).validate(ue,eo,no)}validateSync(ue,eo){return this._resolve(ue,eo).validateSync(ue,eo)}validateAt(ue,eo,no){return this._resolve(eo,no).validateAt(ue,eo,no)}validateSyncAt(ue,eo,no){return this._resolve(eo,no).validateSyncAt(ue,eo,no)}describe(){return null}isValid(ue,eo){return this._resolve(ue,eo).isValid(ue,eo)}isValidSync(ue,eo){return this._resolve(ue,eo).isValidSync(ue,eo)}}function setLocale$1(to){Object.keys(to).forEach(ue=>{Object.keys(to[ue]).forEach(eo=>{locale[ue][eo]=to[ue][eo]})})}function addMethod(to,ue,eo){if(!to||!isSchema$1(to.prototype))throw new TypeError("You must provide a yup schema constructor function");if(typeof ue!="string")throw new TypeError("A Method name must be provided");if(typeof eo!="function")throw new TypeError("Method function must be provided");to.prototype[ue]=eo}const es$1=Object.freeze(Object.defineProperty({__proto__:null,ArraySchema,BaseSchema:BaseSchema$1,BooleanSchema,DateSchema:DateSchema$1,MixedSchema:Mixed$1,NumberSchema:NumberSchema$1,ObjectSchema:ObjectSchema$1,StringSchema:StringSchema$1,ValidationError:ValidationError$1,addMethod,array:create$7,bool:create$c,boolean:create$c,date:create$9,isSchema:isSchema$1,lazy:create$6,mixed:create$d,number:create$a,object:create$8,reach,ref:create$e,setLocale:setLocale$1,string:create$b},Symbol.toStringTag,{value:"Module"})),require$$0$1=getAugmentedNamespace(es$1);var presets={},hasRequiredPresets;function requirePresets(){if(hasRequiredPresets)return presets;hasRequiredPresets=1,Object.defineProperty(presets,"__esModule",{value:!0});const to=requireOption();return presets.default=()=>{(0,to.registerOptionPreset)("npm-node-cron",{presetId:"npm-node-cron",useSeconds:!0,useYears:!1,useAliases:!0,useBlankDay:!1,allowOnlyOneBlankDayField:!1,mustHaveBlankDayField:!1,useLastDayOfMonth:!1,useLastDayOfWeek:!1,useNearestWeekday:!1,useNthWeekdayOfMonth:!1,seconds:{minValue:0,maxValue:59},minutes:{minValue:0,maxValue:59},hours:{minValue:0,maxValue:23},daysOfMonth:{minValue:1,maxValue:31},months:{minValue:0,maxValue:11},daysOfWeek:{minValue:0,maxValue:6},years:{minValue:1970,maxValue:2099}}),(0,to.registerOptionPreset)("aws-cloud-watch",{presetId:"aws-cloud-watch",useSeconds:!1,useYears:!0,useAliases:!0,useBlankDay:!0,allowOnlyOneBlankDayField:!0,mustHaveBlankDayField:!0,useLastDayOfMonth:!0,useLastDayOfWeek:!0,useNearestWeekday:!0,useNthWeekdayOfMonth:!0,seconds:{minValue:0,maxValue:59},minutes:{minValue:0,maxValue:59},hours:{minValue:0,maxValue:23},daysOfMonth:{minValue:1,maxValue:31},months:{minValue:1,maxValue:12},daysOfWeek:{minValue:1,maxValue:7},years:{minValue:1970,maxValue:2199}}),(0,to.registerOptionPreset)("npm-cron-schedule",{presetId:"npm-cron-schedule",useSeconds:!0,useYears:!1,useAliases:!0,useBlankDay:!1,allowOnlyOneBlankDayField:!1,mustHaveBlankDayField:!1,useLastDayOfMonth:!1,useLastDayOfWeek:!1,useNearestWeekday:!1,useNthWeekdayOfMonth:!1,seconds:{minValue:0,maxValue:59},minutes:{minValue:0,maxValue:59},hours:{minValue:0,maxValue:23},daysOfMonth:{minValue:1,maxValue:31},months:{minValue:1,maxValue:12},daysOfWeek:{minValue:0,maxValue:7},years:{minValue:1970,maxValue:2099}})},presets}var hasRequiredOption;function requireOption(){if(hasRequiredOption)return option;hasRequiredOption=1;var to=commonjsGlobal$1&&commonjsGlobal$1.__createBinding||(Object.create?function(po,ho,_o,go){go===void 0&&(go=_o);var bo=Object.getOwnPropertyDescriptor(ho,_o);(!bo||("get"in bo?!ho.__esModule:bo.writable||bo.configurable))&&(bo={enumerable:!0,get:function(){return ho[_o]}}),Object.defineProperty(po,go,bo)}:function(po,ho,_o,go){go===void 0&&(go=_o),po[go]=ho[_o]}),ue=commonjsGlobal$1&&commonjsGlobal$1.__setModuleDefault||(Object.create?function(po,ho){Object.defineProperty(po,"default",{enumerable:!0,value:ho})}:function(po,ho){po.default=ho}),eo=commonjsGlobal$1&&commonjsGlobal$1.__importStar||function(po){if(po&&po.__esModule)return po;var ho={};if(po!=null)for(var _o in po)_o!=="default"&&Object.prototype.hasOwnProperty.call(po,_o)&&to(ho,po,_o);return ue(ho,po),ho},no=commonjsGlobal$1&&commonjsGlobal$1.__importDefault||function(po){return po&&po.__esModule?po:{default:po}};Object.defineProperty(option,"__esModule",{value:!0}),option.validateOptions=option.registerOptionPreset=option.getOptionPresets=option.getOptionPreset=void 0;const ro=eo(require$$0$1),oo=result$1,io=no(requirePresets()),ao={default:{presetId:"default",useSeconds:!1,useYears:!1,useAliases:!1,useBlankDay:!1,allowOnlyOneBlankDayField:!1,mustHaveBlankDayField:!1,useLastDayOfMonth:!1,useLastDayOfWeek:!1,useNearestWeekday:!1,useNthWeekdayOfMonth:!1,seconds:{minValue:0,maxValue:59},minutes:{minValue:0,maxValue:59},hours:{minValue:0,maxValue:23},daysOfMonth:{minValue:0,maxValue:31},months:{minValue:0,maxValue:12},daysOfWeek:{minValue:0,maxValue:7},years:{minValue:1970,maxValue:2099}}},so=ro.object({presetId:ro.string().required(),useSeconds:ro.boolean().required(),useYears:ro.boolean().required(),useAliases:ro.boolean(),useBlankDay:ro.boolean().required(),allowOnlyOneBlankDayField:ro.boolean().required(),mustHaveBlankDayField:ro.boolean(),useLastDayOfMonth:ro.boolean(),useLastDayOfWeek:ro.boolean(),useNearestWeekday:ro.boolean(),useNthWeekdayOfMonth:ro.boolean(),seconds:ro.object({minValue:ro.number().min(0).required(),maxValue:ro.number().min(0).required(),lowerLimit:ro.number().min(0),upperLimit:ro.number().min(0)}).required(),minutes:ro.object({minValue:ro.number().min(0).required(),maxValue:ro.number().min(0).required(),lowerLimit:ro.number().min(0),upperLimit:ro.number().min(0)}).required(),hours:ro.object({minValue:ro.number().min(0).required(),maxValue:ro.number().min(0).required(),lowerLimit:ro.number().min(0),upperLimit:ro.number().min(0)}).required(),daysOfMonth:ro.object({minValue:ro.number().min(0).required(),maxValue:ro.number().min(0).required(),lowerLimit:ro.number().min(0),upperLimit:ro.number().min(0)}).required(),months:ro.object({minValue:ro.number().min(0).required(),maxValue:ro.number().min(0).required(),lowerLimit:ro.number().min(0),upperLimit:ro.number().min(0)}).required(),daysOfWeek:ro.object({minValue:ro.number().min(0).required(),maxValue:ro.number().min(0).required(),lowerLimit:ro.number().min(0),upperLimit:ro.number().min(0)}).required(),years:ro.object({minValue:ro.number().min(0).required(),maxValue:ro.number().min(0).required(),lowerLimit:ro.number().min(0),upperLimit:ro.number().min(0)}).required()}).required(),lo=po=>ao[po]?(0,oo.valid)(ao[po]):(0,oo.err)(`Option preset '${po}' not found.`);option.getOptionPreset=lo;const co=()=>ao;option.getOptionPresets=co;const uo=(po,ho)=>{ao[po]=so.validateSync(ho,{strict:!1,abortEarly:!1,stripUnknown:!0,recursive:!0})};option.registerOptionPreset=uo;const fo=po=>{var ho,_o,go,bo,vo,yo,wo,ko,So,Eo,Io,Ao,To,Mo,Vo,Fo,Po,Ro,Do,qo;try{(0,io.default)();let Uo;if(po.preset)if(typeof po.preset=="string"){if(!ao[po.preset])return(0,oo.err)([`Option preset ${po.preset} does not exist.`]);Uo=ao[po.preset]}else Uo=po.preset;else Uo=ao.default;const jo=Object.assign(Object.assign({presetId:Uo.presetId,preset:Uo},{useSeconds:Uo.useSeconds,useYears:Uo.useYears,useAliases:(ho=Uo.useAliases)!==null&&ho!==void 0?ho:!1,useBlankDay:Uo.useBlankDay,allowOnlyOneBlankDayField:Uo.allowOnlyOneBlankDayField,mustHaveBlankDayField:(_o=Uo.mustHaveBlankDayField)!==null&&_o!==void 0?_o:!1,useLastDayOfMonth:(go=Uo.useLastDayOfMonth)!==null&&go!==void 0?go:!1,useLastDayOfWeek:(bo=Uo.useLastDayOfWeek)!==null&&bo!==void 0?bo:!1,useNearestWeekday:(vo=Uo.useNearestWeekday)!==null&&vo!==void 0?vo:!1,useNthWeekdayOfMonth:(yo=Uo.useNthWeekdayOfMonth)!==null&&yo!==void 0?yo:!1,seconds:{lowerLimit:(wo=Uo.seconds.lowerLimit)!==null&&wo!==void 0?wo:Uo.seconds.minValue,upperLimit:(ko=Uo.seconds.upperLimit)!==null&&ko!==void 0?ko:Uo.seconds.maxValue},minutes:{lowerLimit:(So=Uo.minutes.lowerLimit)!==null&&So!==void 0?So:Uo.minutes.minValue,upperLimit:(Eo=Uo.minutes.upperLimit)!==null&&Eo!==void 0?Eo:Uo.minutes.maxValue},hours:{lowerLimit:(Io=Uo.hours.lowerLimit)!==null&&Io!==void 0?Io:Uo.hours.minValue,upperLimit:(Ao=Uo.hours.upperLimit)!==null&&Ao!==void 0?Ao:Uo.hours.maxValue},daysOfMonth:{lowerLimit:(To=Uo.daysOfMonth.lowerLimit)!==null&&To!==void 0?To:Uo.daysOfMonth.minValue,upperLimit:(Mo=Uo.daysOfMonth.upperLimit)!==null&&Mo!==void 0?Mo:Uo.daysOfMonth.maxValue},months:{lowerLimit:(Vo=Uo.months.lowerLimit)!==null&&Vo!==void 0?Vo:Uo.months.minValue,upperLimit:(Fo=Uo.months.upperLimit)!==null&&Fo!==void 0?Fo:Uo.months.maxValue},daysOfWeek:{lowerLimit:(Po=Uo.daysOfWeek.lowerLimit)!==null&&Po!==void 0?Po:Uo.daysOfWeek.minValue,upperLimit:(Ro=Uo.daysOfWeek.upperLimit)!==null&&Ro!==void 0?Ro:Uo.daysOfWeek.maxValue},years:{lowerLimit:(Do=Uo.years.lowerLimit)!==null&&Do!==void 0?Do:Uo.years.minValue,upperLimit:(qo=Uo.years.upperLimit)!==null&&qo!==void 0?qo:Uo.years.maxValue}}),po.override),Qo=ro.object({presetId:ro.string().required(),preset:so.required(),useSeconds:ro.boolean().required(),useYears:ro.boolean().required(),useAliases:ro.boolean(),useBlankDay:ro.boolean().required(),allowOnlyOneBlankDayField:ro.boolean().required(),mustHaveBlankDayField:ro.boolean(),useLastDayOfMonth:ro.boolean(),useLastDayOfWeek:ro.boolean(),useNearestWeekday:ro.boolean(),useNthWeekdayOfMonth:ro.boolean(),seconds:ro.object({lowerLimit:ro.number().min(Uo.seconds.minValue).max(Uo.seconds.maxValue),upperLimit:ro.number().min(Uo.seconds.minValue).max(Uo.seconds.maxValue)}).required(),minutes:ro.object({lowerLimit:ro.number().min(Uo.minutes.minValue).max(Uo.minutes.maxValue),upperLimit:ro.number().min(Uo.minutes.minValue).max(Uo.minutes.maxValue)}).required(),hours:ro.object({lowerLimit:ro.number().min(Uo.hours.minValue).max(Uo.hours.maxValue),upperLimit:ro.number().min(Uo.hours.minValue).max(Uo.hours.maxValue)}).required(),daysOfMonth:ro.object({lowerLimit:ro.number().min(Uo.daysOfMonth.minValue).max(Uo.daysOfMonth.maxValue),upperLimit:ro.number().min(Uo.daysOfMonth.minValue).max(Uo.daysOfMonth.maxValue)}).required(),months:ro.object({lowerLimit:ro.number().min(Uo.months.minValue).max(Uo.months.maxValue),upperLimit:ro.number().min(Uo.months.minValue).max(Uo.months.maxValue)}).required(),daysOfWeek:ro.object({lowerLimit:ro.number().min(Uo.daysOfWeek.minValue).max(Uo.daysOfWeek.maxValue),upperLimit:ro.number().min(Uo.daysOfWeek.minValue).max(Uo.daysOfWeek.maxValue)}).required(),years:ro.object({lowerLimit:ro.number().min(Uo.years.minValue).max(Uo.years.maxValue),upperLimit:ro.number().min(Uo.years.minValue).max(Uo.years.maxValue)}).required()}).required().validateSync(jo,{strict:!1,abortEarly:!1,stripUnknown:!0,recursive:!0});return(0,oo.valid)(Qo)}catch(Uo){return(0,oo.err)(Uo.errors)}};return option.validateOptions=fo,option}var hasRequiredLib;function requireLib(){return hasRequiredLib||(hasRequiredLib=1,function(to,ue){var eo=commonjsGlobal$1&&commonjsGlobal$1.__importDefault||function(ho){return ho&&ho.__esModule?ho:{default:ho}};Object.defineProperty(ue,"__esModule",{value:!0});const no=result$1,ro=eo(requireSecondChecker()),oo=eo(requireMinuteChecker()),io=eo(requireHourChecker()),ao=eo(requireDayOfMonthChecker()),so=eo(requireMonthChecker()),lo=eo(requireDayOfWeekChecker()),co=eo(requireYearChecker()),uo=requireOption(),fo=(ho,_o)=>{const go=ho.trim().split(" ");if(_o.useSeconds&&_o.useYears&&go.length!==7)return(0,no.err)(`Expected 7 values, but got ${go.length}.`);if((_o.useSeconds&&!_o.useYears||_o.useYears&&!_o.useSeconds)&&go.length!==6)return(0,no.err)(`Expected 6 values, but got ${go.length}.`);if(!_o.useSeconds&&!_o.useYears&&go.length!==5)return(0,no.err)(`Expected 5 values, but got ${go.length}.`);const bo={seconds:_o.useSeconds?go[0]:void 0,minutes:go[_o.useSeconds?1:0],hours:go[_o.useSeconds?2:1],daysOfMonth:go[_o.useSeconds?3:2],months:go[_o.useSeconds?4:3],daysOfWeek:go[_o.useSeconds?5:4],years:_o.useYears?go[_o.useSeconds?6:5]:void 0};return(0,no.valid)(bo)},po=(ho,_o={})=>{const go=(0,uo.validateOptions)(_o);if(go.isError())return go;const bo=go.getValue(),vo=fo(ho,bo);if(vo.isError())return(0,no.err)([`${vo.getError()} (Input cron: '${ho}')`]);const yo=vo.getValue(),wo=[];if(bo.useSeconds&&wo.push((0,ro.default)(yo,bo)),wo.push((0,oo.default)(yo,bo)),wo.push((0,io.default)(yo,bo)),wo.push((0,ao.default)(yo,bo)),wo.push((0,so.default)(yo,bo)),wo.push((0,lo.default)(yo,bo)),bo.useYears&&wo.push((0,co.default)(yo,bo)),wo.every(So=>So.isValid()))return(0,no.valid)(yo);const ko=[];return wo.forEach(So=>{So.isError()&&So.getError().forEach(Eo=>{ko.push(Eo)})}),ko.forEach((So,Eo)=>{ko[Eo]=`${So} (Input cron: '${ho}')`}),(0,no.err)(ko)};ue.default=po,to.exports=po,to.exports.default=po}(lib$b,lib$b.exports)),lib$b.exports}var libExports$1=requireLib();const cronValidate=getDefaultExportFromCjs$1(libExports$1);var luxon$1={};Object.defineProperty(luxon$1,"__esModule",{value:!0});class LuxonError extends Error{}class InvalidDateTimeError extends LuxonError{constructor(ue){super(`Invalid DateTime: ${ue.toMessage()}`)}}class InvalidIntervalError extends LuxonError{constructor(ue){super(`Invalid Interval: ${ue.toMessage()}`)}}class InvalidDurationError extends LuxonError{constructor(ue){super(`Invalid Duration: ${ue.toMessage()}`)}}class ConflictingSpecificationError extends LuxonError{}class InvalidUnitError extends LuxonError{constructor(ue){super(`Invalid unit ${ue}`)}}class InvalidArgumentError extends LuxonError{}class ZoneIsAbstractError extends LuxonError{constructor(){super("Zone is an abstract class")}}const n$2="numeric",s$2="short",l$2="long",DATE_SHORT={year:n$2,month:n$2,day:n$2},DATE_MED={year:n$2,month:s$2,day:n$2},DATE_MED_WITH_WEEKDAY={year:n$2,month:s$2,day:n$2,weekday:s$2},DATE_FULL={year:n$2,month:l$2,day:n$2},DATE_HUGE={year:n$2,month:l$2,day:n$2,weekday:l$2},TIME_SIMPLE={hour:n$2,minute:n$2},TIME_WITH_SECONDS={hour:n$2,minute:n$2,second:n$2},TIME_WITH_SHORT_OFFSET={hour:n$2,minute:n$2,second:n$2,timeZoneName:s$2},TIME_WITH_LONG_OFFSET={hour:n$2,minute:n$2,second:n$2,timeZoneName:l$2},TIME_24_SIMPLE={hour:n$2,minute:n$2,hourCycle:"h23"},TIME_24_WITH_SECONDS={hour:n$2,minute:n$2,second:n$2,hourCycle:"h23"},TIME_24_WITH_SHORT_OFFSET={hour:n$2,minute:n$2,second:n$2,hourCycle:"h23",timeZoneName:s$2},TIME_24_WITH_LONG_OFFSET={hour:n$2,minute:n$2,second:n$2,hourCycle:"h23",timeZoneName:l$2},DATETIME_SHORT={year:n$2,month:n$2,day:n$2,hour:n$2,minute:n$2},DATETIME_SHORT_WITH_SECONDS={year:n$2,month:n$2,day:n$2,hour:n$2,minute:n$2,second:n$2},DATETIME_MED={year:n$2,month:s$2,day:n$2,hour:n$2,minute:n$2},DATETIME_MED_WITH_SECONDS={year:n$2,month:s$2,day:n$2,hour:n$2,minute:n$2,second:n$2},DATETIME_MED_WITH_WEEKDAY={year:n$2,month:s$2,day:n$2,weekday:s$2,hour:n$2,minute:n$2},DATETIME_FULL={year:n$2,month:l$2,day:n$2,hour:n$2,minute:n$2,timeZoneName:s$2},DATETIME_FULL_WITH_SECONDS={year:n$2,month:l$2,day:n$2,hour:n$2,minute:n$2,second:n$2,timeZoneName:s$2},DATETIME_HUGE={year:n$2,month:l$2,day:n$2,weekday:l$2,hour:n$2,minute:n$2,timeZoneName:l$2},DATETIME_HUGE_WITH_SECONDS={year:n$2,month:l$2,day:n$2,weekday:l$2,hour:n$2,minute:n$2,second:n$2,timeZoneName:l$2};class Zone{get type(){throw new ZoneIsAbstractError}get name(){throw new ZoneIsAbstractError}get ianaName(){return this.name}get isUniversal(){throw new ZoneIsAbstractError}offsetName(ue,eo){throw new ZoneIsAbstractError}formatOffset(ue,eo){throw new ZoneIsAbstractError}offset(ue){throw new ZoneIsAbstractError}equals(ue){throw new ZoneIsAbstractError}get isValid(){throw new ZoneIsAbstractError}}let singleton$1=null;class SystemZone extends Zone{static get instance(){return singleton$1===null&&(singleton$1=new SystemZone),singleton$1}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(ue,{format:eo,locale:no}){return parseZoneInfo(ue,eo,no)}formatOffset(ue,eo){return formatOffset(this.offset(ue),eo)}offset(ue){return-new Date(ue).getTimezoneOffset()}equals(ue){return ue.type==="system"}get isValid(){return!0}}let dtfCache={};function makeDTF(to){return dtfCache[to]||(dtfCache[to]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:to,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"})),dtfCache[to]}const typeToPos={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function hackyOffset(to,ue){const eo=to.format(ue).replace(/\u200E/g,""),no=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(eo),[,ro,oo,io,ao,so,lo,co]=no;return[io,ro,oo,ao,so,lo,co]}function partsOffset(to,ue){const eo=to.formatToParts(ue),no=[];for(let ro=0;ro<eo.length;ro++){const{type:oo,value:io}=eo[ro],ao=typeToPos[oo];oo==="era"?no[ao]=io:isUndefined$1(ao)||(no[ao]=parseInt(io,10))}return no}let ianaZoneCache={};class IANAZone extends Zone{static create(ue){return ianaZoneCache[ue]||(ianaZoneCache[ue]=new IANAZone(ue)),ianaZoneCache[ue]}static resetCache(){ianaZoneCache={},dtfCache={}}static isValidSpecifier(ue){return this.isValidZone(ue)}static isValidZone(ue){if(!ue)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:ue}).format(),!0}catch{return!1}}constructor(ue){super(),this.zoneName=ue,this.valid=IANAZone.isValidZone(ue)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(ue,{format:eo,locale:no}){return parseZoneInfo(ue,eo,no,this.name)}formatOffset(ue,eo){return formatOffset(this.offset(ue),eo)}offset(ue){const eo=new Date(ue);if(isNaN(eo))return NaN;const no=makeDTF(this.name);let[ro,oo,io,ao,so,lo,co]=no.formatToParts?partsOffset(no,eo):hackyOffset(no,eo);ao==="BC"&&(ro=-Math.abs(ro)+1);const fo=objToLocalTS({year:ro,month:oo,day:io,hour:so===24?0:so,minute:lo,second:co,millisecond:0});let po=+eo;const ho=po%1e3;return po-=ho>=0?ho:1e3+ho,(fo-po)/(60*1e3)}equals(ue){return ue.type==="iana"&&ue.name===this.name}get isValid(){return this.valid}}let intlLFCache={};function getCachedLF(to,ue={}){const eo=JSON.stringify([to,ue]);let no=intlLFCache[eo];return no||(no=new Intl.ListFormat(to,ue),intlLFCache[eo]=no),no}let intlDTCache={};function getCachedDTF(to,ue={}){const eo=JSON.stringify([to,ue]);let no=intlDTCache[eo];return no||(no=new Intl.DateTimeFormat(to,ue),intlDTCache[eo]=no),no}let intlNumCache={};function getCachedINF(to,ue={}){const eo=JSON.stringify([to,ue]);let no=intlNumCache[eo];return no||(no=new Intl.NumberFormat(to,ue),intlNumCache[eo]=no),no}let intlRelCache={};function getCachedRTF(to,ue={}){const{base:eo,...no}=ue,ro=JSON.stringify([to,no]);let oo=intlRelCache[ro];return oo||(oo=new Intl.RelativeTimeFormat(to,ue),intlRelCache[ro]=oo),oo}let sysLocaleCache=null;function systemLocale(){return sysLocaleCache||(sysLocaleCache=new Intl.DateTimeFormat().resolvedOptions().locale,sysLocaleCache)}function parseLocaleString(to){const ue=to.indexOf("-x-");ue!==-1&&(to=to.substring(0,ue));const eo=to.indexOf("-u-");if(eo===-1)return[to];{let no,ro;try{no=getCachedDTF(to).resolvedOptions(),ro=to}catch{const so=to.substring(0,eo);no=getCachedDTF(so).resolvedOptions(),ro=so}const{numberingSystem:oo,calendar:io}=no;return[ro,oo,io]}}function intlConfigString(to,ue,eo){return(eo||ue)&&(to.includes("-u-")||(to+="-u"),eo&&(to+=`-ca-${eo}`),ue&&(to+=`-nu-${ue}`)),to}function mapMonths(to){const ue=[];for(let eo=1;eo<=12;eo++){const no=DateTime.utc(2016,eo,1);ue.push(to(no))}return ue}function mapWeekdays(to){const ue=[];for(let eo=1;eo<=7;eo++){const no=DateTime.utc(2016,11,13+eo);ue.push(to(no))}return ue}function listStuff(to,ue,eo,no,ro){const oo=to.listingMode(eo);return oo==="error"?null:oo==="en"?no(ue):ro(ue)}function supportsFastNumbers(to){return to.numberingSystem&&to.numberingSystem!=="latn"?!1:to.numberingSystem==="latn"||!to.locale||to.locale.startsWith("en")||new Intl.DateTimeFormat(to.intl).resolvedOptions().numberingSystem==="latn"}class PolyNumberFormatter{constructor(ue,eo,no){this.padTo=no.padTo||0,this.floor=no.floor||!1;const{padTo:ro,floor:oo,...io}=no;if(!eo||Object.keys(io).length>0){const ao={useGrouping:!1,...no};no.padTo>0&&(ao.minimumIntegerDigits=no.padTo),this.inf=getCachedINF(ue,ao)}}format(ue){if(this.inf){const eo=this.floor?Math.floor(ue):ue;return this.inf.format(eo)}else{const eo=this.floor?Math.floor(ue):roundTo(ue,3);return padStart(eo,this.padTo)}}}class PolyDateFormatter{constructor(ue,eo,no){this.opts=no;let ro;if(ue.zone.isUniversal){const io=-1*(ue.offset/60),ao=io>=0?`Etc/GMT+${io}`:`Etc/GMT${io}`;ue.offset!==0&&IANAZone.create(ao).valid?(ro=ao,this.dt=ue):(ro="UTC",no.timeZoneName?this.dt=ue:this.dt=ue.offset===0?ue:DateTime.fromMillis(ue.ts+ue.offset*60*1e3))}else ue.zone.type==="system"?this.dt=ue:(this.dt=ue,ro=ue.zone.name);const oo={...this.opts};oo.timeZone=oo.timeZone||ro,this.dtf=getCachedDTF(eo,oo)}format(){return this.dtf.format(this.dt.toJSDate())}formatToParts(){return this.dtf.formatToParts(this.dt.toJSDate())}resolvedOptions(){return this.dtf.resolvedOptions()}}class PolyRelFormatter{constructor(ue,eo,no){this.opts={style:"long",...no},!eo&&hasRelative()&&(this.rtf=getCachedRTF(ue,no))}format(ue,eo){return this.rtf?this.rtf.format(ue,eo):formatRelativeTime(eo,ue,this.opts.numeric,this.opts.style!=="long")}formatToParts(ue,eo){return this.rtf?this.rtf.formatToParts(ue,eo):[]}}class Locale{static fromOpts(ue){return Locale.create(ue.locale,ue.numberingSystem,ue.outputCalendar,ue.defaultToEN)}static create(ue,eo,no,ro=!1){const oo=ue||Settings$3.defaultLocale,io=oo||(ro?"en-US":systemLocale()),ao=eo||Settings$3.defaultNumberingSystem,so=no||Settings$3.defaultOutputCalendar;return new Locale(io,ao,so,oo)}static resetCache(){sysLocaleCache=null,intlDTCache={},intlNumCache={},intlRelCache={}}static fromObject({locale:ue,numberingSystem:eo,outputCalendar:no}={}){return Locale.create(ue,eo,no)}constructor(ue,eo,no,ro){const[oo,io,ao]=parseLocaleString(ue);this.locale=oo,this.numberingSystem=eo||io||null,this.outputCalendar=no||ao||null,this.intl=intlConfigString(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=ro,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=supportsFastNumbers(this)),this.fastNumbersCached}listingMode(){const ue=this.isEnglish(),eo=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return ue&&eo?"en":"intl"}clone(ue){return!ue||Object.getOwnPropertyNames(ue).length===0?this:Locale.create(ue.locale||this.specifiedLocale,ue.numberingSystem||this.numberingSystem,ue.outputCalendar||this.outputCalendar,ue.defaultToEN||!1)}redefaultToEN(ue={}){return this.clone({...ue,defaultToEN:!0})}redefaultToSystem(ue={}){return this.clone({...ue,defaultToEN:!1})}months(ue,eo=!1,no=!0){return listStuff(this,ue,no,months$1,()=>{const ro=eo?{month:ue,day:"numeric"}:{month:ue},oo=eo?"format":"standalone";return this.monthsCache[oo][ue]||(this.monthsCache[oo][ue]=mapMonths(io=>this.extract(io,ro,"month"))),this.monthsCache[oo][ue]})}weekdays(ue,eo=!1,no=!0){return listStuff(this,ue,no,weekdays,()=>{const ro=eo?{weekday:ue,year:"numeric",month:"long",day:"numeric"}:{weekday:ue},oo=eo?"format":"standalone";return this.weekdaysCache[oo][ue]||(this.weekdaysCache[oo][ue]=mapWeekdays(io=>this.extract(io,ro,"weekday"))),this.weekdaysCache[oo][ue]})}meridiems(ue=!0){return listStuff(this,void 0,ue,()=>meridiems,()=>{if(!this.meridiemCache){const eo={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[DateTime.utc(2016,11,13,9),DateTime.utc(2016,11,13,19)].map(no=>this.extract(no,eo,"dayperiod"))}return this.meridiemCache})}eras(ue,eo=!0){return listStuff(this,ue,eo,eras,()=>{const no={era:ue};return this.eraCache[ue]||(this.eraCache[ue]=[DateTime.utc(-40,1,1),DateTime.utc(2017,1,1)].map(ro=>this.extract(ro,no,"era"))),this.eraCache[ue]})}extract(ue,eo,no){const ro=this.dtFormatter(ue,eo),oo=ro.formatToParts(),io=oo.find(ao=>ao.type.toLowerCase()===no);return io?io.value:null}numberFormatter(ue={}){return new PolyNumberFormatter(this.intl,ue.forceSimple||this.fastNumbers,ue)}dtFormatter(ue,eo={}){return new PolyDateFormatter(ue,this.intl,eo)}relFormatter(ue={}){return new PolyRelFormatter(this.intl,this.isEnglish(),ue)}listFormatter(ue={}){return getCachedLF(this.intl,ue)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")}equals(ue){return this.locale===ue.locale&&this.numberingSystem===ue.numberingSystem&&this.outputCalendar===ue.outputCalendar}}let singleton=null;class FixedOffsetZone extends Zone{static get utcInstance(){return singleton===null&&(singleton=new FixedOffsetZone(0)),singleton}static instance(ue){return ue===0?FixedOffsetZone.utcInstance:new FixedOffsetZone(ue)}static parseSpecifier(ue){if(ue){const eo=ue.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(eo)return new FixedOffsetZone(signedOffset(eo[1],eo[2]))}return null}constructor(ue){super(),this.fixed=ue}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${formatOffset(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${formatOffset(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(ue,eo){return formatOffset(this.fixed,eo)}get isUniversal(){return!0}offset(){return this.fixed}equals(ue){return ue.type==="fixed"&&ue.fixed===this.fixed}get isValid(){return!0}}class InvalidZone extends Zone{constructor(ue){super(),this.zoneName=ue}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function normalizeZone(to,ue){if(isUndefined$1(to)||to===null)return ue;if(to instanceof Zone)return to;if(isString$2(to)){const eo=to.toLowerCase();return eo==="default"?ue:eo==="local"||eo==="system"?SystemZone.instance:eo==="utc"||eo==="gmt"?FixedOffsetZone.utcInstance:FixedOffsetZone.parseSpecifier(eo)||IANAZone.create(to)}else return isNumber$5(to)?FixedOffsetZone.instance(to):typeof to=="object"&&to.offset&&typeof to.offset=="number"?to:new InvalidZone(to)}let now$1=()=>Date.now(),defaultZone="system",defaultLocale=null,defaultNumberingSystem=null,defaultOutputCalendar=null,twoDigitCutoffYear=60,throwOnInvalid,Settings$3=class{static get now(){return now$1}static set now(ue){now$1=ue}static set defaultZone(ue){defaultZone=ue}static get defaultZone(){return normalizeZone(defaultZone,SystemZone.instance)}static get defaultLocale(){return defaultLocale}static set defaultLocale(ue){defaultLocale=ue}static get defaultNumberingSystem(){return defaultNumberingSystem}static set defaultNumberingSystem(ue){defaultNumberingSystem=ue}static get defaultOutputCalendar(){return defaultOutputCalendar}static set defaultOutputCalendar(ue){defaultOutputCalendar=ue}static get twoDigitCutoffYear(){return twoDigitCutoffYear}static set twoDigitCutoffYear(ue){twoDigitCutoffYear=ue%100}static get throwOnInvalid(){return throwOnInvalid}static set throwOnInvalid(ue){throwOnInvalid=ue}static resetCaches(){Locale.resetCache(),IANAZone.resetCache()}};function isUndefined$1(to){return typeof to>"u"}function isNumber$5(to){return typeof to=="number"}function isInteger$1(to){return typeof to=="number"&&to%1===0}function isString$2(to){return typeof to=="string"}function isDate$3(to){return Object.prototype.toString.call(to)==="[object Date]"}function hasRelative(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function maybeArray(to){return Array.isArray(to)?to:[to]}function bestBy(to,ue,eo){if(to.length!==0)return to.reduce((no,ro)=>{const oo=[ue(ro),ro];return no&&eo(no[0],oo[0])===no[0]?no:oo},null)[1]}function pick$2(to,ue){return ue.reduce((eo,no)=>(eo[no]=to[no],eo),{})}function hasOwnProperty$8(to,ue){return Object.prototype.hasOwnProperty.call(to,ue)}function integerBetween(to,ue,eo){return isInteger$1(to)&&to>=ue&&to<=eo}function floorMod(to,ue){return to-ue*Math.floor(to/ue)}function padStart(to,ue=2){const eo=to<0;let no;return eo?no="-"+(""+-to).padStart(ue,"0"):no=(""+to).padStart(ue,"0"),no}function parseInteger(to){if(!(isUndefined$1(to)||to===null||to===""))return parseInt(to,10)}function parseFloating(to){if(!(isUndefined$1(to)||to===null||to===""))return parseFloat(to)}function parseMillis(to){if(!(isUndefined$1(to)||to===null||to==="")){const ue=parseFloat("0."+to)*1e3;return Math.floor(ue)}}function roundTo(to,ue,eo=!1){const no=10**ue;return(eo?Math.trunc:Math.round)(to*no)/no}function isLeapYear(to){return to%4===0&&(to%100!==0||to%400===0)}function daysInYear(to){return isLeapYear(to)?366:365}function daysInMonth(to,ue){const eo=floorMod(ue-1,12)+1,no=to+(ue-eo)/12;return eo===2?isLeapYear(no)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][eo-1]}function objToLocalTS(to){let ue=Date.UTC(to.year,to.month-1,to.day,to.hour,to.minute,to.second,to.millisecond);return to.year<100&&to.year>=0&&(ue=new Date(ue),ue.setUTCFullYear(ue.getUTCFullYear()-1900)),+ue}function weeksInWeekYear(to){const ue=(to+Math.floor(to/4)-Math.floor(to/100)+Math.floor(to/400))%7,eo=to-1,no=(eo+Math.floor(eo/4)-Math.floor(eo/100)+Math.floor(eo/400))%7;return ue===4||no===3?53:52}function untruncateYear(to){return to>99?to:to>Settings$3.twoDigitCutoffYear?1900+to:2e3+to}function parseZoneInfo(to,ue,eo,no=null){const ro=new Date(to),oo={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};no&&(oo.timeZone=no);const io={timeZoneName:ue,...oo},ao=new Intl.DateTimeFormat(eo,io).formatToParts(ro).find(so=>so.type.toLowerCase()==="timezonename");return ao?ao.value:null}function signedOffset(to,ue){let eo=parseInt(to,10);Number.isNaN(eo)&&(eo=0);const no=parseInt(ue,10)||0,ro=eo<0||Object.is(eo,-0)?-no:no;return eo*60+ro}function asNumber(to){const ue=Number(to);if(typeof to=="boolean"||to===""||Number.isNaN(ue))throw new InvalidArgumentError(`Invalid unit value ${to}`);return ue}function normalizeObject(to,ue){const eo={};for(const no in to)if(hasOwnProperty$8(to,no)){const ro=to[no];if(ro==null)continue;eo[ue(no)]=asNumber(ro)}return eo}function formatOffset(to,ue){const eo=Math.trunc(Math.abs(to/60)),no=Math.trunc(Math.abs(to%60)),ro=to>=0?"+":"-";switch(ue){case"short":return`${ro}${padStart(eo,2)}:${padStart(no,2)}`;case"narrow":return`${ro}${eo}${no>0?`:${no}`:""}`;case"techie":return`${ro}${padStart(eo,2)}${padStart(no,2)}`;default:throw new RangeError(`Value format ${ue} is out of range for property format`)}}function timeObject(to){return pick$2(to,["hour","minute","second","millisecond"])}const monthsLong=["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],monthsNarrow=["J","F","M","A","M","J","J","A","S","O","N","D"];function months$1(to){switch(to){case"narrow":return[...monthsNarrow];case"short":return[...monthsShort];case"long":return[...monthsLong];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}const weekdaysLong=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],weekdaysShort=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],weekdaysNarrow=["M","T","W","T","F","S","S"];function weekdays(to){switch(to){case"narrow":return[...weekdaysNarrow];case"short":return[...weekdaysShort];case"long":return[...weekdaysLong];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const meridiems=["AM","PM"],erasLong=["Before Christ","Anno Domini"],erasShort=["BC","AD"],erasNarrow=["B","A"];function eras(to){switch(to){case"narrow":return[...erasNarrow];case"short":return[...erasShort];case"long":return[...erasLong];default:return null}}function meridiemForDateTime(to){return meridiems[to.hour<12?0:1]}function weekdayForDateTime(to,ue){return weekdays(ue)[to.weekday-1]}function monthForDateTime(to,ue){return months$1(ue)[to.month-1]}function eraForDateTime(to,ue){return eras(ue)[to.year<0?0:1]}function formatRelativeTime(to,ue,eo="always",no=!1){const ro={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},oo=["hours","minutes","seconds"].indexOf(to)===-1;if(eo==="auto"&&oo){const uo=to==="days";switch(ue){case 1:return uo?"tomorrow":`next ${ro[to][0]}`;case-1:return uo?"yesterday":`last ${ro[to][0]}`;case 0:return uo?"today":`this ${ro[to][0]}`}}const io=Object.is(ue,-0)||ue<0,ao=Math.abs(ue),so=ao===1,lo=ro[to],co=no?so?lo[1]:lo[2]||lo[1]:so?ro[to][0]:to;return io?`${ao} ${co} ago`:`in ${ao} ${co}`}function stringifyTokens(to,ue){let eo="";for(const no of to)no.literal?eo+=no.val:eo+=ue(no.val);return eo}const macroTokenToFormatOpts={D:DATE_SHORT,DD:DATE_MED,DDD:DATE_FULL,DDDD:DATE_HUGE,t:TIME_SIMPLE,tt:TIME_WITH_SECONDS,ttt:TIME_WITH_SHORT_OFFSET,tttt:TIME_WITH_LONG_OFFSET,T:TIME_24_SIMPLE,TT:TIME_24_WITH_SECONDS,TTT:TIME_24_WITH_SHORT_OFFSET,TTTT:TIME_24_WITH_LONG_OFFSET,f:DATETIME_SHORT,ff:DATETIME_MED,fff:DATETIME_FULL,ffff:DATETIME_HUGE,F:DATETIME_SHORT_WITH_SECONDS,FF:DATETIME_MED_WITH_SECONDS,FFF:DATETIME_FULL_WITH_SECONDS,FFFF:DATETIME_HUGE_WITH_SECONDS};class Formatter{static create(ue,eo={}){return new Formatter(ue,eo)}static parseFormat(ue){let eo=null,no="",ro=!1;const oo=[];for(let io=0;io<ue.length;io++){const ao=ue.charAt(io);ao==="'"?(no.length>0&&oo.push({literal:ro,val:no}),eo=null,no="",ro=!ro):ro||ao===eo?no+=ao:(no.length>0&&oo.push({literal:!1,val:no}),no=ao,eo=ao)}return no.length>0&&oo.push({literal:ro,val:no}),oo}static macroTokenToFormatOpts(ue){return macroTokenToFormatOpts[ue]}constructor(ue,eo){this.opts=eo,this.loc=ue,this.systemLoc=null}formatWithSystemDefault(ue,eo){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(ue,{...this.opts,...eo}).format()}formatDateTime(ue,eo={}){return this.loc.dtFormatter(ue,{...this.opts,...eo}).format()}formatDateTimeParts(ue,eo={}){return this.loc.dtFormatter(ue,{...this.opts,...eo}).formatToParts()}formatInterval(ue,eo={}){return this.loc.dtFormatter(ue.start,{...this.opts,...eo}).dtf.formatRange(ue.start.toJSDate(),ue.end.toJSDate())}resolvedOptions(ue,eo={}){return this.loc.dtFormatter(ue,{...this.opts,...eo}).resolvedOptions()}num(ue,eo=0){if(this.opts.forceSimple)return padStart(ue,eo);const no={...this.opts};return eo>0&&(no.padTo=eo),this.loc.numberFormatter(no).format(ue)}formatDateTimeFromString(ue,eo){const no=this.loc.listingMode()==="en",ro=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",oo=(po,ho)=>this.loc.extract(ue,po,ho),io=po=>ue.isOffsetFixed&&ue.offset===0&&po.allowZ?"Z":ue.isValid?ue.zone.formatOffset(ue.ts,po.format):"",ao=()=>no?meridiemForDateTime(ue):oo({hour:"numeric",hourCycle:"h12"},"dayperiod"),so=(po,ho)=>no?monthForDateTime(ue,po):oo(ho?{month:po}:{month:po,day:"numeric"},"month"),lo=(po,ho)=>no?weekdayForDateTime(ue,po):oo(ho?{weekday:po}:{weekday:po,month:"long",day:"numeric"},"weekday"),co=po=>{const ho=Formatter.macroTokenToFormatOpts(po);return ho?this.formatWithSystemDefault(ue,ho):po},uo=po=>no?eraForDateTime(ue,po):oo({era:po},"era"),fo=po=>{switch(po){case"S":return this.num(ue.millisecond);case"u":case"SSS":return this.num(ue.millisecond,3);case"s":return this.num(ue.second);case"ss":return this.num(ue.second,2);case"uu":return this.num(Math.floor(ue.millisecond/10),2);case"uuu":return this.num(Math.floor(ue.millisecond/100));case"m":return this.num(ue.minute);case"mm":return this.num(ue.minute,2);case"h":return this.num(ue.hour%12===0?12:ue.hour%12);case"hh":return this.num(ue.hour%12===0?12:ue.hour%12,2);case"H":return this.num(ue.hour);case"HH":return this.num(ue.hour,2);case"Z":return io({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return io({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return io({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return ue.zone.offsetName(ue.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return ue.zone.offsetName(ue.ts,{format:"long",locale:this.loc.locale});case"z":return ue.zoneName;case"a":return ao();case"d":return ro?oo({day:"numeric"},"day"):this.num(ue.day);case"dd":return ro?oo({day:"2-digit"},"day"):this.num(ue.day,2);case"c":return this.num(ue.weekday);case"ccc":return lo("short",!0);case"cccc":return lo("long",!0);case"ccccc":return lo("narrow",!0);case"E":return this.num(ue.weekday);case"EEE":return lo("short",!1);case"EEEE":return lo("long",!1);case"EEEEE":return lo("narrow",!1);case"L":return ro?oo({month:"numeric",day:"numeric"},"month"):this.num(ue.month);case"LL":return ro?oo({month:"2-digit",day:"numeric"},"month"):this.num(ue.month,2);case"LLL":return so("short",!0);case"LLLL":return so("long",!0);case"LLLLL":return so("narrow",!0);case"M":return ro?oo({month:"numeric"},"month"):this.num(ue.month);case"MM":return ro?oo({month:"2-digit"},"month"):this.num(ue.month,2);case"MMM":return so("short",!1);case"MMMM":return so("long",!1);case"MMMMM":return so("narrow",!1);case"y":return ro?oo({year:"numeric"},"year"):this.num(ue.year);case"yy":return ro?oo({year:"2-digit"},"year"):this.num(ue.year.toString().slice(-2),2);case"yyyy":return ro?oo({year:"numeric"},"year"):this.num(ue.year,4);case"yyyyyy":return ro?oo({year:"numeric"},"year"):this.num(ue.year,6);case"G":return uo("short");case"GG":return uo("long");case"GGGGG":return uo("narrow");case"kk":return this.num(ue.weekYear.toString().slice(-2),2);case"kkkk":return this.num(ue.weekYear,4);case"W":return this.num(ue.weekNumber);case"WW":return this.num(ue.weekNumber,2);case"o":return this.num(ue.ordinal);case"ooo":return this.num(ue.ordinal,3);case"q":return this.num(ue.quarter);case"qq":return this.num(ue.quarter,2);case"X":return this.num(Math.floor(ue.ts/1e3));case"x":return this.num(ue.ts);default:return co(po)}};return stringifyTokens(Formatter.parseFormat(eo),fo)}formatDurationFromString(ue,eo){const no=so=>{switch(so[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},ro=so=>lo=>{const co=no(lo);return co?this.num(so.get(co),lo.length):lo},oo=Formatter.parseFormat(eo),io=oo.reduce((so,{literal:lo,val:co})=>lo?so:so.concat(co),[]),ao=ue.shiftTo(...io.map(no).filter(so=>so));return stringifyTokens(oo,ro(ao))}}class Invalid{constructor(ue,eo){this.reason=ue,this.explanation=eo}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const ianaRegex=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function combineRegexes(...to){const ue=to.reduce((eo,no)=>eo+no.source,"");return RegExp(`^${ue}$`)}function combineExtractors(...to){return ue=>to.reduce(([eo,no,ro],oo)=>{const[io,ao,so]=oo(ue,ro);return[{...eo,...io},ao||no,so]},[{},null,1]).slice(0,2)}function parse$a(to,...ue){if(to==null)return[null,null];for(const[eo,no]of ue){const ro=eo.exec(to);if(ro)return no(ro)}return[null,null]}function simpleParse(...to){return(ue,eo)=>{const no={};let ro;for(ro=0;ro<to.length;ro++)no[to[ro]]=parseInteger(ue[eo+ro]);return[no,null,eo+ro]}}const offsetRegex=/(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/,isoExtendedZone=`(?:${offsetRegex.source}?(?:\\[(${ianaRegex.source})\\])?)?`,isoTimeBaseRegex=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,isoTimeRegex=RegExp(`${isoTimeBaseRegex.source}${isoExtendedZone}`),isoTimeExtensionRegex=RegExp(`(?:T${isoTimeRegex.source})?`),isoYmdRegex=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,isoWeekRegex=/(\d{4})-?W(\d\d)(?:-?(\d))?/,isoOrdinalRegex=/(\d{4})-?(\d{3})/,extractISOWeekData=simpleParse("weekYear","weekNumber","weekDay"),extractISOOrdinalData=simpleParse("year","ordinal"),sqlYmdRegex=/(\d{4})-(\d\d)-(\d\d)/,sqlTimeRegex=RegExp(`${isoTimeBaseRegex.source} ?(?:${offsetRegex.source}|(${ianaRegex.source}))?`),sqlTimeExtensionRegex=RegExp(`(?: ${sqlTimeRegex.source})?`);function int(to,ue,eo){const no=to[ue];return isUndefined$1(no)?eo:parseInteger(no)}function extractISOYmd(to,ue){return[{year:int(to,ue),month:int(to,ue+1,1),day:int(to,ue+2,1)},null,ue+3]}function extractISOTime(to,ue){return[{hours:int(to,ue,0),minutes:int(to,ue+1,0),seconds:int(to,ue+2,0),milliseconds:parseMillis(to[ue+3])},null,ue+4]}function extractISOOffset(to,ue){const eo=!to[ue]&&!to[ue+1],no=signedOffset(to[ue+1],to[ue+2]),ro=eo?null:FixedOffsetZone.instance(no);return[{},ro,ue+3]}function extractIANAZone(to,ue){const eo=to[ue]?IANAZone.create(to[ue]):null;return[{},eo,ue+1]}const isoTimeOnly=RegExp(`^T?${isoTimeBaseRegex.source}$`),isoDuration=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function extractISODuration(to){const[ue,eo,no,ro,oo,io,ao,so,lo]=to,co=ue[0]==="-",uo=so&&so[0]==="-",fo=(po,ho=!1)=>po!==void 0&&(ho||po&&co)?-po:po;return[{years:fo(parseFloating(eo)),months:fo(parseFloating(no)),weeks:fo(parseFloating(ro)),days:fo(parseFloating(oo)),hours:fo(parseFloating(io)),minutes:fo(parseFloating(ao)),seconds:fo(parseFloating(so),so==="-0"),milliseconds:fo(parseMillis(lo),uo)}]}const obsOffsets={GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function fromStrings(to,ue,eo,no,ro,oo,io){const ao={year:ue.length===2?untruncateYear(parseInteger(ue)):parseInteger(ue),month:monthsShort.indexOf(eo)+1,day:parseInteger(no),hour:parseInteger(ro),minute:parseInteger(oo)};return io&&(ao.second=parseInteger(io)),to&&(ao.weekday=to.length>3?weekdaysLong.indexOf(to)+1:weekdaysShort.indexOf(to)+1),ao}const rfc2822=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function extractRFC2822(to){const[,ue,eo,no,ro,oo,io,ao,so,lo,co,uo]=to,fo=fromStrings(ue,ro,no,eo,oo,io,ao);let po;return so?po=obsOffsets[so]:lo?po=0:po=signedOffset(co,uo),[fo,new FixedOffsetZone(po)]}function preprocessRFC2822(to){return to.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const rfc1123=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,rfc850=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,ascii=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function extractRFC1123Or850(to){const[,ue,eo,no,ro,oo,io,ao]=to;return[fromStrings(ue,ro,no,eo,oo,io,ao),FixedOffsetZone.utcInstance]}function extractASCII(to){const[,ue,eo,no,ro,oo,io,ao]=to;return[fromStrings(ue,ao,eo,no,ro,oo,io),FixedOffsetZone.utcInstance]}const isoYmdWithTimeExtensionRegex=combineRegexes(isoYmdRegex,isoTimeExtensionRegex),isoWeekWithTimeExtensionRegex=combineRegexes(isoWeekRegex,isoTimeExtensionRegex),isoOrdinalWithTimeExtensionRegex=combineRegexes(isoOrdinalRegex,isoTimeExtensionRegex),isoTimeCombinedRegex=combineRegexes(isoTimeRegex),extractISOYmdTimeAndOffset=combineExtractors(extractISOYmd,extractISOTime,extractISOOffset,extractIANAZone),extractISOWeekTimeAndOffset=combineExtractors(extractISOWeekData,extractISOTime,extractISOOffset,extractIANAZone),extractISOOrdinalDateAndTime=combineExtractors(extractISOOrdinalData,extractISOTime,extractISOOffset,extractIANAZone),extractISOTimeAndOffset=combineExtractors(extractISOTime,extractISOOffset,extractIANAZone);function parseISODate(to){return parse$a(to,[isoYmdWithTimeExtensionRegex,extractISOYmdTimeAndOffset],[isoWeekWithTimeExtensionRegex,extractISOWeekTimeAndOffset],[isoOrdinalWithTimeExtensionRegex,extractISOOrdinalDateAndTime],[isoTimeCombinedRegex,extractISOTimeAndOffset])}function parseRFC2822Date(to){return parse$a(preprocessRFC2822(to),[rfc2822,extractRFC2822])}function parseHTTPDate(to){return parse$a(to,[rfc1123,extractRFC1123Or850],[rfc850,extractRFC1123Or850],[ascii,extractASCII])}function parseISODuration(to){return parse$a(to,[isoDuration,extractISODuration])}const extractISOTimeOnly=combineExtractors(extractISOTime);function parseISOTimeOnly(to){return parse$a(to,[isoTimeOnly,extractISOTimeOnly])}const sqlYmdWithTimeExtensionRegex=combineRegexes(sqlYmdRegex,sqlTimeExtensionRegex),sqlTimeCombinedRegex=combineRegexes(sqlTimeRegex),extractISOTimeOffsetAndIANAZone=combineExtractors(extractISOTime,extractISOOffset,extractIANAZone);function parseSQL(to){return parse$a(to,[sqlYmdWithTimeExtensionRegex,extractISOYmdTimeAndOffset],[sqlTimeCombinedRegex,extractISOTimeOffsetAndIANAZone])}const INVALID$2="Invalid Duration",lowOrderMatrix={weeks:{days:7,hours:7*24,minutes:7*24*60,seconds:7*24*60*60,milliseconds:7*24*60*60*1e3},days:{hours:24,minutes:24*60,seconds:24*60*60,milliseconds:24*60*60*1e3},hours:{minutes:60,seconds:60*60,milliseconds:60*60*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},casualMatrix={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:91*24,minutes:91*24*60,seconds:91*24*60*60,milliseconds:91*24*60*60*1e3},months:{weeks:4,days:30,hours:30*24,minutes:30*24*60,seconds:30*24*60*60,milliseconds:30*24*60*60*1e3},...lowOrderMatrix},daysInYearAccurate=146097/400,daysInMonthAccurate=146097/4800,accurateMatrix={years:{quarters:4,months:12,weeks:daysInYearAccurate/7,days:daysInYearAccurate,hours:daysInYearAccurate*24,minutes:daysInYearAccurate*24*60,seconds:daysInYearAccurate*24*60*60,milliseconds:daysInYearAccurate*24*60*60*1e3},quarters:{months:3,weeks:daysInYearAccurate/28,days:daysInYearAccurate/4,hours:daysInYearAccurate*24/4,minutes:daysInYearAccurate*24*60/4,seconds:daysInYearAccurate*24*60*60/4,milliseconds:daysInYearAccurate*24*60*60*1e3/4},months:{weeks:daysInMonthAccurate/7,days:daysInMonthAccurate,hours:daysInMonthAccurate*24,minutes:daysInMonthAccurate*24*60,seconds:daysInMonthAccurate*24*60*60,milliseconds:daysInMonthAccurate*24*60*60*1e3},...lowOrderMatrix},orderedUnits$1=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],reverseUnits=orderedUnits$1.slice(0).reverse();function clone$1(to,ue,eo=!1){const no={values:eo?ue.values:{...to.values,...ue.values||{}},loc:to.loc.clone(ue.loc),conversionAccuracy:ue.conversionAccuracy||to.conversionAccuracy,matrix:ue.matrix||to.matrix};return new Duration(no)}function antiTrunc(to){return to<0?Math.floor(to):Math.ceil(to)}function convert$2(to,ue,eo,no,ro){const oo=to[ro][eo],io=ue[eo]/oo,ao=Math.sign(io)===Math.sign(no[ro]),so=!ao&&no[ro]!==0&&Math.abs(io)<=1?antiTrunc(io):Math.trunc(io);no[ro]+=so,ue[eo]-=so*oo}function normalizeValues(to,ue){reverseUnits.reduce((eo,no)=>isUndefined$1(ue[no])?eo:(eo&&convert$2(to,ue,eo,ue,no),no),null)}function removeZeroes(to){const ue={};for(const[eo,no]of Object.entries(to))no!==0&&(ue[eo]=no);return ue}class Duration{constructor(ue){const eo=ue.conversionAccuracy==="longterm"||!1;let no=eo?accurateMatrix:casualMatrix;ue.matrix&&(no=ue.matrix),this.values=ue.values,this.loc=ue.loc||Locale.create(),this.conversionAccuracy=eo?"longterm":"casual",this.invalid=ue.invalid||null,this.matrix=no,this.isLuxonDuration=!0}static fromMillis(ue,eo){return Duration.fromObject({milliseconds:ue},eo)}static fromObject(ue,eo={}){if(ue==null||typeof ue!="object")throw new InvalidArgumentError(`Duration.fromObject: argument expected to be an object, got ${ue===null?"null":typeof ue}`);return new Duration({values:normalizeObject(ue,Duration.normalizeUnit),loc:Locale.fromObject(eo),conversionAccuracy:eo.conversionAccuracy,matrix:eo.matrix})}static fromDurationLike(ue){if(isNumber$5(ue))return Duration.fromMillis(ue);if(Duration.isDuration(ue))return ue;if(typeof ue=="object")return Duration.fromObject(ue);throw new InvalidArgumentError(`Unknown duration argument ${ue} of type ${typeof ue}`)}static fromISO(ue,eo){const[no]=parseISODuration(ue);return no?Duration.fromObject(no,eo):Duration.invalid("unparsable",`the input "${ue}" can't be parsed as ISO 8601`)}static fromISOTime(ue,eo){const[no]=parseISOTimeOnly(ue);return no?Duration.fromObject(no,eo):Duration.invalid("unparsable",`the input "${ue}" can't be parsed as ISO 8601`)}static invalid(ue,eo=null){if(!ue)throw new InvalidArgumentError("need to specify a reason the Duration is invalid");const no=ue instanceof Invalid?ue:new Invalid(ue,eo);if(Settings$3.throwOnInvalid)throw new InvalidDurationError(no);return new Duration({invalid:no})}static normalizeUnit(ue){const eo={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[ue&&ue.toLowerCase()];if(!eo)throw new InvalidUnitError(ue);return eo}static isDuration(ue){return ue&&ue.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(ue,eo={}){const no={...eo,floor:eo.round!==!1&&eo.floor!==!1};return this.isValid?Formatter.create(this.loc,no).formatDurationFromString(this,ue):INVALID$2}toHuman(ue={}){const eo=orderedUnits$1.map(no=>{const ro=this.values[no];return isUndefined$1(ro)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...ue,unit:no.slice(0,-1)}).format(ro)}).filter(no=>no);return this.loc.listFormatter({type:"conjunction",style:ue.listStyle||"narrow",...ue}).format(eo)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let ue="P";return this.years!==0&&(ue+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(ue+=this.months+this.quarters*3+"M"),this.weeks!==0&&(ue+=this.weeks+"W"),this.days!==0&&(ue+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(ue+="T"),this.hours!==0&&(ue+=this.hours+"H"),this.minutes!==0&&(ue+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(ue+=roundTo(this.seconds+this.milliseconds/1e3,3)+"S"),ue==="P"&&(ue+="T0S"),ue}toISOTime(ue={}){if(!this.isValid)return null;const eo=this.toMillis();if(eo<0||eo>=864e5)return null;ue={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...ue};const no=this.shiftTo("hours","minutes","seconds","milliseconds");let ro=ue.format==="basic"?"hhmm":"hh:mm";(!ue.suppressSeconds||no.seconds!==0||no.milliseconds!==0)&&(ro+=ue.format==="basic"?"ss":":ss",(!ue.suppressMilliseconds||no.milliseconds!==0)&&(ro+=".SSS"));let oo=no.toFormat(ro);return ue.includePrefix&&(oo="T"+oo),oo}toJSON(){return this.toISO()}toString(){return this.toISO()}toMillis(){return this.as("milliseconds")}valueOf(){return this.toMillis()}plus(ue){if(!this.isValid)return this;const eo=Duration.fromDurationLike(ue),no={};for(const ro of orderedUnits$1)(hasOwnProperty$8(eo.values,ro)||hasOwnProperty$8(this.values,ro))&&(no[ro]=eo.get(ro)+this.get(ro));return clone$1(this,{values:no},!0)}minus(ue){if(!this.isValid)return this;const eo=Duration.fromDurationLike(ue);return this.plus(eo.negate())}mapUnits(ue){if(!this.isValid)return this;const eo={};for(const no of Object.keys(this.values))eo[no]=asNumber(ue(this.values[no],no));return clone$1(this,{values:eo},!0)}get(ue){return this[Duration.normalizeUnit(ue)]}set(ue){if(!this.isValid)return this;const eo={...this.values,...normalizeObject(ue,Duration.normalizeUnit)};return clone$1(this,{values:eo})}reconfigure({locale:ue,numberingSystem:eo,conversionAccuracy:no,matrix:ro}={}){const io={loc:this.loc.clone({locale:ue,numberingSystem:eo}),matrix:ro,conversionAccuracy:no};return clone$1(this,io)}as(ue){return this.isValid?this.shiftTo(ue).get(ue):NaN}normalize(){if(!this.isValid)return this;const ue=this.toObject();return normalizeValues(this.matrix,ue),clone$1(this,{values:ue},!0)}rescale(){if(!this.isValid)return this;const ue=removeZeroes(this.normalize().shiftToAll().toObject());return clone$1(this,{values:ue},!0)}shiftTo(...ue){if(!this.isValid)return this;if(ue.length===0)return this;ue=ue.map(io=>Duration.normalizeUnit(io));const eo={},no={},ro=this.toObject();let oo;for(const io of orderedUnits$1)if(ue.indexOf(io)>=0){oo=io;let ao=0;for(const lo in no)ao+=this.matrix[lo][io]*no[lo],no[lo]=0;isNumber$5(ro[io])&&(ao+=ro[io]);const so=Math.trunc(ao);eo[io]=so,no[io]=(ao*1e3-so*1e3)/1e3;for(const lo in ro)orderedUnits$1.indexOf(lo)>orderedUnits$1.indexOf(io)&&convert$2(this.matrix,ro,lo,eo,io)}else isNumber$5(ro[io])&&(no[io]=ro[io]);for(const io in no)no[io]!==0&&(eo[oo]+=io===oo?no[io]:no[io]/this.matrix[oo][io]);return clone$1(this,{values:eo},!0).normalize()}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const ue={};for(const eo of Object.keys(this.values))ue[eo]=this.values[eo]===0?0:-this.values[eo];return clone$1(this,{values:ue},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(ue){if(!this.isValid||!ue.isValid||!this.loc.equals(ue.loc))return!1;function eo(no,ro){return no===void 0||no===0?ro===void 0||ro===0:no===ro}for(const no of orderedUnits$1)if(!eo(this.values[no],ue.values[no]))return!1;return!0}}const INVALID$1="Invalid Interval";function validateStartEnd(to,ue){return!to||!to.isValid?Interval.invalid("missing or invalid start"):!ue||!ue.isValid?Interval.invalid("missing or invalid end"):ue<to?Interval.invalid("end before start",`The end of an interval must be after its start, but you had start=${to.toISO()} and end=${ue.toISO()}`):null}class Interval{constructor(ue){this.s=ue.start,this.e=ue.end,this.invalid=ue.invalid||null,this.isLuxonInterval=!0}static invalid(ue,eo=null){if(!ue)throw new InvalidArgumentError("need to specify a reason the Interval is invalid");const no=ue instanceof Invalid?ue:new Invalid(ue,eo);if(Settings$3.throwOnInvalid)throw new InvalidIntervalError(no);return new Interval({invalid:no})}static fromDateTimes(ue,eo){const no=friendlyDateTime(ue),ro=friendlyDateTime(eo),oo=validateStartEnd(no,ro);return oo??new Interval({start:no,end:ro})}static after(ue,eo){const no=Duration.fromDurationLike(eo),ro=friendlyDateTime(ue);return Interval.fromDateTimes(ro,ro.plus(no))}static before(ue,eo){const no=Duration.fromDurationLike(eo),ro=friendlyDateTime(ue);return Interval.fromDateTimes(ro.minus(no),ro)}static fromISO(ue,eo){const[no,ro]=(ue||"").split("/",2);if(no&&ro){let oo,io;try{oo=DateTime.fromISO(no,eo),io=oo.isValid}catch{io=!1}let ao,so;try{ao=DateTime.fromISO(ro,eo),so=ao.isValid}catch{so=!1}if(io&&so)return Interval.fromDateTimes(oo,ao);if(io){const lo=Duration.fromISO(ro,eo);if(lo.isValid)return Interval.after(oo,lo)}else if(so){const lo=Duration.fromISO(no,eo);if(lo.isValid)return Interval.before(ao,lo)}}return Interval.invalid("unparsable",`the input "${ue}" can't be parsed as ISO 8601`)}static isInterval(ue){return ue&&ue.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(ue="milliseconds"){return this.isValid?this.toDuration(ue).get(ue):NaN}count(ue="milliseconds"){if(!this.isValid)return NaN;const eo=this.start.startOf(ue),no=this.end.startOf(ue);return Math.floor(no.diff(eo,ue).get(ue))+1}hasSame(ue){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,ue):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(ue){return this.isValid?this.s>ue:!1}isBefore(ue){return this.isValid?this.e<=ue:!1}contains(ue){return this.isValid?this.s<=ue&&this.e>ue:!1}set({start:ue,end:eo}={}){return this.isValid?Interval.fromDateTimes(ue||this.s,eo||this.e):this}splitAt(...ue){if(!this.isValid)return[];const eo=ue.map(friendlyDateTime).filter(io=>this.contains(io)).sort(),no=[];let{s:ro}=this,oo=0;for(;ro<this.e;){const io=eo[oo]||this.e,ao=+io>+this.e?this.e:io;no.push(Interval.fromDateTimes(ro,ao)),ro=ao,oo+=1}return no}splitBy(ue){const eo=Duration.fromDurationLike(ue);if(!this.isValid||!eo.isValid||eo.as("milliseconds")===0)return[];let{s:no}=this,ro=1,oo;const io=[];for(;no<this.e;){const ao=this.start.plus(eo.mapUnits(so=>so*ro));oo=+ao>+this.e?this.e:ao,io.push(Interval.fromDateTimes(no,oo)),no=oo,ro+=1}return io}divideEqually(ue){return this.isValid?this.splitBy(this.length()/ue).slice(0,ue):[]}overlaps(ue){return this.e>ue.s&&this.s<ue.e}abutsStart(ue){return this.isValid?+this.e==+ue.s:!1}abutsEnd(ue){return this.isValid?+ue.e==+this.s:!1}engulfs(ue){return this.isValid?this.s<=ue.s&&this.e>=ue.e:!1}equals(ue){return!this.isValid||!ue.isValid?!1:this.s.equals(ue.s)&&this.e.equals(ue.e)}intersection(ue){if(!this.isValid)return this;const eo=this.s>ue.s?this.s:ue.s,no=this.e<ue.e?this.e:ue.e;return eo>=no?null:Interval.fromDateTimes(eo,no)}union(ue){if(!this.isValid)return this;const eo=this.s<ue.s?this.s:ue.s,no=this.e>ue.e?this.e:ue.e;return Interval.fromDateTimes(eo,no)}static merge(ue){const[eo,no]=ue.sort((ro,oo)=>ro.s-oo.s).reduce(([ro,oo],io)=>oo?oo.overlaps(io)||oo.abutsStart(io)?[ro,oo.union(io)]:[ro.concat([oo]),io]:[ro,io],[[],null]);return no&&eo.push(no),eo}static xor(ue){let eo=null,no=0;const ro=[],oo=ue.map(so=>[{time:so.s,type:"s"},{time:so.e,type:"e"}]),io=Array.prototype.concat(...oo),ao=io.sort((so,lo)=>so.time-lo.time);for(const so of ao)no+=so.type==="s"?1:-1,no===1?eo=so.time:(eo&&+eo!=+so.time&&ro.push(Interval.fromDateTimes(eo,so.time)),eo=null);return Interval.merge(ro)}difference(...ue){return Interval.xor([this].concat(ue)).map(eo=>this.intersection(eo)).filter(eo=>eo&&!eo.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:INVALID$1}toLocaleString(ue=DATE_SHORT,eo={}){return this.isValid?Formatter.create(this.s.loc.clone(eo),ue).formatInterval(this):INVALID$1}toISO(ue){return this.isValid?`${this.s.toISO(ue)}/${this.e.toISO(ue)}`:INVALID$1}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:INVALID$1}toISOTime(ue){return this.isValid?`${this.s.toISOTime(ue)}/${this.e.toISOTime(ue)}`:INVALID$1}toFormat(ue,{separator:eo=" – "}={}){return this.isValid?`${this.s.toFormat(ue)}${eo}${this.e.toFormat(ue)}`:INVALID$1}toDuration(ue,eo){return this.isValid?this.e.diff(this.s,ue,eo):Duration.invalid(this.invalidReason)}mapEndpoints(ue){return Interval.fromDateTimes(ue(this.s),ue(this.e))}}class Info{static hasDST(ue=Settings$3.defaultZone){const eo=DateTime.now().setZone(ue).set({month:12});return!ue.isUniversal&&eo.offset!==eo.set({month:6}).offset}static isValidIANAZone(ue){return IANAZone.isValidZone(ue)}static normalizeZone(ue){return normalizeZone(ue,Settings$3.defaultZone)}static months(ue="long",{locale:eo=null,numberingSystem:no=null,locObj:ro=null,outputCalendar:oo="gregory"}={}){return(ro||Locale.create(eo,no,oo)).months(ue)}static monthsFormat(ue="long",{locale:eo=null,numberingSystem:no=null,locObj:ro=null,outputCalendar:oo="gregory"}={}){return(ro||Locale.create(eo,no,oo)).months(ue,!0)}static weekdays(ue="long",{locale:eo=null,numberingSystem:no=null,locObj:ro=null}={}){return(ro||Locale.create(eo,no,null)).weekdays(ue)}static weekdaysFormat(ue="long",{locale:eo=null,numberingSystem:no=null,locObj:ro=null}={}){return(ro||Locale.create(eo,no,null)).weekdays(ue,!0)}static meridiems({locale:ue=null}={}){return Locale.create(ue).meridiems()}static eras(ue="short",{locale:eo=null}={}){return Locale.create(eo,null,"gregory").eras(ue)}static features(){return{relative:hasRelative()}}}function dayDiff(to,ue){const eo=ro=>ro.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),no=eo(ue)-eo(to);return Math.floor(Duration.fromMillis(no).as("days"))}function highOrderDiffs(to,ue,eo){const no=[["years",(so,lo)=>lo.year-so.year],["quarters",(so,lo)=>lo.quarter-so.quarter+(lo.year-so.year)*4],["months",(so,lo)=>lo.month-so.month+(lo.year-so.year)*12],["weeks",(so,lo)=>{const co=dayDiff(so,lo);return(co-co%7)/7}],["days",dayDiff]],ro={},oo=to;let io,ao;for(const[so,lo]of no)eo.indexOf(so)>=0&&(io=so,ro[so]=lo(to,ue),ao=oo.plus(ro),ao>ue?(ro[so]--,to=oo.plus(ro)):to=ao);return[to,ro,ao,io]}function diff(to,ue,eo,no){let[ro,oo,io,ao]=highOrderDiffs(to,ue,eo);const so=ue-ro,lo=eo.filter(uo=>["hours","minutes","seconds","milliseconds"].indexOf(uo)>=0);lo.length===0&&(io<ue&&(io=ro.plus({[ao]:1})),io!==ro&&(oo[ao]=(oo[ao]||0)+so/(io-ro)));const co=Duration.fromObject(oo,no);return lo.length>0?Duration.fromMillis(so,no).shiftTo(...lo).plus(co):co}const numberingSystems={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},numberingSystemsUTF16={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},hanidecChars=numberingSystems.hanidec.replace(/[\[|\]]/g,"").split("");function parseDigits(to){let ue=parseInt(to,10);if(isNaN(ue)){ue="";for(let eo=0;eo<to.length;eo++){const no=to.charCodeAt(eo);if(to[eo].search(numberingSystems.hanidec)!==-1)ue+=hanidecChars.indexOf(to[eo]);else for(const ro in numberingSystemsUTF16){const[oo,io]=numberingSystemsUTF16[ro];no>=oo&&no<=io&&(ue+=no-oo)}}return parseInt(ue,10)}else return ue}function digitRegex({numberingSystem:to},ue=""){return new RegExp(`${numberingSystems[to||"latn"]}${ue}`)}const MISSING_FTP="missing Intl.DateTimeFormat.formatToParts support";function intUnit(to,ue=eo=>eo){return{regex:to,deser:([eo])=>ue(parseDigits(eo))}}const NBSP=String.fromCharCode(160),spaceOrNBSP=`[ ${NBSP}]`,spaceOrNBSPRegExp=new RegExp(spaceOrNBSP,"g");function fixListRegex(to){return to.replace(/\./g,"\\.?").replace(spaceOrNBSPRegExp,spaceOrNBSP)}function stripInsensitivities(to){return to.replace(/\./g,"").replace(spaceOrNBSPRegExp," ").toLowerCase()}function oneOf(to,ue){return to===null?null:{regex:RegExp(to.map(fixListRegex).join("|")),deser:([eo])=>to.findIndex(no=>stripInsensitivities(eo)===stripInsensitivities(no))+ue}}function offset(to,ue){return{regex:to,deser:([,eo,no])=>signedOffset(eo,no),groups:ue}}function simple$1(to){return{regex:to,deser:([ue])=>ue}}function escapeToken(to){return to.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function unitForToken(to,ue){const eo=digitRegex(ue),no=digitRegex(ue,"{2}"),ro=digitRegex(ue,"{3}"),oo=digitRegex(ue,"{4}"),io=digitRegex(ue,"{6}"),ao=digitRegex(ue,"{1,2}"),so=digitRegex(ue,"{1,3}"),lo=digitRegex(ue,"{1,6}"),co=digitRegex(ue,"{1,9}"),uo=digitRegex(ue,"{2,4}"),fo=digitRegex(ue,"{4,6}"),po=go=>({regex:RegExp(escapeToken(go.val)),deser:([bo])=>bo,literal:!0}),_o=(go=>{if(to.literal)return po(go);switch(go.val){case"G":return oneOf(ue.eras("short",!1),0);case"GG":return oneOf(ue.eras("long",!1),0);case"y":return intUnit(lo);case"yy":return intUnit(uo,untruncateYear);case"yyyy":return intUnit(oo);case"yyyyy":return intUnit(fo);case"yyyyyy":return intUnit(io);case"M":return intUnit(ao);case"MM":return intUnit(no);case"MMM":return oneOf(ue.months("short",!0,!1),1);case"MMMM":return oneOf(ue.months("long",!0,!1),1);case"L":return intUnit(ao);case"LL":return intUnit(no);case"LLL":return oneOf(ue.months("short",!1,!1),1);case"LLLL":return oneOf(ue.months("long",!1,!1),1);case"d":return intUnit(ao);case"dd":return intUnit(no);case"o":return intUnit(so);case"ooo":return intUnit(ro);case"HH":return intUnit(no);case"H":return intUnit(ao);case"hh":return intUnit(no);case"h":return intUnit(ao);case"mm":return intUnit(no);case"m":return intUnit(ao);case"q":return intUnit(ao);case"qq":return intUnit(no);case"s":return intUnit(ao);case"ss":return intUnit(no);case"S":return intUnit(so);case"SSS":return intUnit(ro);case"u":return simple$1(co);case"uu":return simple$1(ao);case"uuu":return intUnit(eo);case"a":return oneOf(ue.meridiems(),0);case"kkkk":return intUnit(oo);case"kk":return intUnit(uo,untruncateYear);case"W":return intUnit(ao);case"WW":return intUnit(no);case"E":case"c":return intUnit(eo);case"EEE":return oneOf(ue.weekdays("short",!1,!1),1);case"EEEE":return oneOf(ue.weekdays("long",!1,!1),1);case"ccc":return oneOf(ue.weekdays("short",!0,!1),1);case"cccc":return oneOf(ue.weekdays("long",!0,!1),1);case"Z":case"ZZ":return offset(new RegExp(`([+-]${ao.source})(?::(${no.source}))?`),2);case"ZZZ":return offset(new RegExp(`([+-]${ao.source})(${no.source})?`),2);case"z":return simple$1(/[a-z_+-/]{1,256}?/i);default:return po(go)}})(to)||{invalidReason:MISSING_FTP};return _o.token=to,_o}const partTypeStyleToTokenVal={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour:{numeric:"h","2-digit":"hh"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function tokenForPart(to,ue){const{type:eo,value:no}=to;if(eo==="literal")return{literal:!0,val:no};const ro=ue[eo];let oo=partTypeStyleToTokenVal[eo];if(typeof oo=="object"&&(oo=oo[ro]),oo)return{literal:!1,val:oo}}function buildRegex(to){return[`^${to.map(eo=>eo.regex).reduce((eo,no)=>`${eo}(${no.source})`,"")}$`,to]}function match$1(to,ue,eo){const no=to.match(ue);if(no){const ro={};let oo=1;for(const io in eo)if(hasOwnProperty$8(eo,io)){const ao=eo[io],so=ao.groups?ao.groups+1:1;!ao.literal&&ao.token&&(ro[ao.token.val[0]]=ao.deser(no.slice(oo,oo+so))),oo+=so}return[no,ro]}else return[no,{}]}function dateTimeFromMatches(to){const ue=oo=>{switch(oo){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}};let eo=null,no;return isUndefined$1(to.z)||(eo=IANAZone.create(to.z)),isUndefined$1(to.Z)||(eo||(eo=new FixedOffsetZone(to.Z)),no=to.Z),isUndefined$1(to.q)||(to.M=(to.q-1)*3+1),isUndefined$1(to.h)||(to.h<12&&to.a===1?to.h+=12:to.h===12&&to.a===0&&(to.h=0)),to.G===0&&to.y&&(to.y=-to.y),isUndefined$1(to.u)||(to.S=parseMillis(to.u)),[Object.keys(to).reduce((oo,io)=>{const ao=ue(io);return ao&&(oo[ao]=to[io]),oo},{}),eo,no]}let dummyDateTimeCache=null;function getDummyDateTime(){return dummyDateTimeCache||(dummyDateTimeCache=DateTime.fromMillis(1555555555555)),dummyDateTimeCache}function maybeExpandMacroToken(to,ue){if(to.literal)return to;const eo=Formatter.macroTokenToFormatOpts(to.val),no=formatOptsToTokens(eo,ue);return no==null||no.includes(void 0)?to:no}function expandMacroTokens(to,ue){return Array.prototype.concat(...to.map(eo=>maybeExpandMacroToken(eo,ue)))}function explainFromTokens(to,ue,eo){const no=expandMacroTokens(Formatter.parseFormat(eo),to),ro=no.map(io=>unitForToken(io,to)),oo=ro.find(io=>io.invalidReason);if(oo)return{input:ue,tokens:no,invalidReason:oo.invalidReason};{const[io,ao]=buildRegex(ro),so=RegExp(io,"i"),[lo,co]=match$1(ue,so,ao),[uo,fo,po]=co?dateTimeFromMatches(co):[null,null,void 0];if(hasOwnProperty$8(co,"a")&&hasOwnProperty$8(co,"H"))throw new ConflictingSpecificationError("Can't include meridiem when specifying 24-hour format");return{input:ue,tokens:no,regex:so,rawMatches:lo,matches:co,result:uo,zone:fo,specificOffset:po}}}function parseFromTokens(to,ue,eo){const{result:no,zone:ro,specificOffset:oo,invalidReason:io}=explainFromTokens(to,ue,eo);return[no,ro,oo,io]}function formatOptsToTokens(to,ue){return to?Formatter.create(ue,to).formatDateTimeParts(getDummyDateTime()).map(ro=>tokenForPart(ro,to)):null}const nonLeapLadder=[0,31,59,90,120,151,181,212,243,273,304,334],leapLadder=[0,31,60,91,121,152,182,213,244,274,305,335];function unitOutOfRange(to,ue){return new Invalid("unit out of range",`you specified ${ue} (of type ${typeof ue}) as a ${to}, which is invalid`)}function dayOfWeek(to,ue,eo){const no=new Date(Date.UTC(to,ue-1,eo));to<100&&to>=0&&no.setUTCFullYear(no.getUTCFullYear()-1900);const ro=no.getUTCDay();return ro===0?7:ro}function computeOrdinal(to,ue,eo){return eo+(isLeapYear(to)?leapLadder:nonLeapLadder)[ue-1]}function uncomputeOrdinal(to,ue){const eo=isLeapYear(to)?leapLadder:nonLeapLadder,no=eo.findIndex(oo=>oo<ue),ro=ue-eo[no];return{month:no+1,day:ro}}function gregorianToWeek(to){const{year:ue,month:eo,day:no}=to,ro=computeOrdinal(ue,eo,no),oo=dayOfWeek(ue,eo,no);let io=Math.floor((ro-oo+10)/7),ao;return io<1?(ao=ue-1,io=weeksInWeekYear(ao)):io>weeksInWeekYear(ue)?(ao=ue+1,io=1):ao=ue,{weekYear:ao,weekNumber:io,weekday:oo,...timeObject(to)}}function weekToGregorian(to){const{weekYear:ue,weekNumber:eo,weekday:no}=to,ro=dayOfWeek(ue,1,4),oo=daysInYear(ue);let io=eo*7+no-ro-3,ao;io<1?(ao=ue-1,io+=daysInYear(ao)):io>oo?(ao=ue+1,io-=daysInYear(ue)):ao=ue;const{month:so,day:lo}=uncomputeOrdinal(ao,io);return{year:ao,month:so,day:lo,...timeObject(to)}}function gregorianToOrdinal(to){const{year:ue,month:eo,day:no}=to,ro=computeOrdinal(ue,eo,no);return{year:ue,ordinal:ro,...timeObject(to)}}function ordinalToGregorian(to){const{year:ue,ordinal:eo}=to,{month:no,day:ro}=uncomputeOrdinal(ue,eo);return{year:ue,month:no,day:ro,...timeObject(to)}}function hasInvalidWeekData(to){const ue=isInteger$1(to.weekYear),eo=integerBetween(to.weekNumber,1,weeksInWeekYear(to.weekYear)),no=integerBetween(to.weekday,1,7);return ue?eo?no?!1:unitOutOfRange("weekday",to.weekday):unitOutOfRange("week",to.week):unitOutOfRange("weekYear",to.weekYear)}function hasInvalidOrdinalData(to){const ue=isInteger$1(to.year),eo=integerBetween(to.ordinal,1,daysInYear(to.year));return ue?eo?!1:unitOutOfRange("ordinal",to.ordinal):unitOutOfRange("year",to.year)}function hasInvalidGregorianData(to){const ue=isInteger$1(to.year),eo=integerBetween(to.month,1,12),no=integerBetween(to.day,1,daysInMonth(to.year,to.month));return ue?eo?no?!1:unitOutOfRange("day",to.day):unitOutOfRange("month",to.month):unitOutOfRange("year",to.year)}function hasInvalidTimeData(to){const{hour:ue,minute:eo,second:no,millisecond:ro}=to,oo=integerBetween(ue,0,23)||ue===24&&eo===0&&no===0&&ro===0,io=integerBetween(eo,0,59),ao=integerBetween(no,0,59),so=integerBetween(ro,0,999);return oo?io?ao?so?!1:unitOutOfRange("millisecond",ro):unitOutOfRange("second",no):unitOutOfRange("minute",eo):unitOutOfRange("hour",ue)}const INVALID="Invalid DateTime",MAX_DATE=864e13;function unsupportedZone(to){return new Invalid("unsupported zone",`the zone "${to.name}" is not supported`)}function possiblyCachedWeekData(to){return to.weekData===null&&(to.weekData=gregorianToWeek(to.c)),to.weekData}function clone$2(to,ue){const eo={ts:to.ts,zone:to.zone,c:to.c,o:to.o,loc:to.loc,invalid:to.invalid};return new DateTime({...eo,...ue,old:eo})}function fixOffset(to,ue,eo){let no=to-ue*60*1e3;const ro=eo.offset(no);if(ue===ro)return[no,ue];no-=(ro-ue)*60*1e3;const oo=eo.offset(no);return ro===oo?[no,ro]:[to-Math.min(ro,oo)*60*1e3,Math.max(ro,oo)]}function tsToObj(to,ue){to+=ue*60*1e3;const eo=new Date(to);return{year:eo.getUTCFullYear(),month:eo.getUTCMonth()+1,day:eo.getUTCDate(),hour:eo.getUTCHours(),minute:eo.getUTCMinutes(),second:eo.getUTCSeconds(),millisecond:eo.getUTCMilliseconds()}}function objToTS(to,ue,eo){return fixOffset(objToLocalTS(to),ue,eo)}function adjustTime(to,ue){const eo=to.o,no=to.c.year+Math.trunc(ue.years),ro=to.c.month+Math.trunc(ue.months)+Math.trunc(ue.quarters)*3,oo={...to.c,year:no,month:ro,day:Math.min(to.c.day,daysInMonth(no,ro))+Math.trunc(ue.days)+Math.trunc(ue.weeks)*7},io=Duration.fromObject({years:ue.years-Math.trunc(ue.years),quarters:ue.quarters-Math.trunc(ue.quarters),months:ue.months-Math.trunc(ue.months),weeks:ue.weeks-Math.trunc(ue.weeks),days:ue.days-Math.trunc(ue.days),hours:ue.hours,minutes:ue.minutes,seconds:ue.seconds,milliseconds:ue.milliseconds}).as("milliseconds"),ao=objToLocalTS(oo);let[so,lo]=fixOffset(ao,eo,to.zone);return io!==0&&(so+=io,lo=to.zone.offset(so)),{ts:so,o:lo}}function parseDataToDateTime(to,ue,eo,no,ro,oo){const{setZone:io,zone:ao}=eo;if(to&&Object.keys(to).length!==0){const so=ue||ao,lo=DateTime.fromObject(to,{...eo,zone:so,specificOffset:oo});return io?lo:lo.setZone(ao)}else return DateTime.invalid(new Invalid("unparsable",`the input "${ro}" can't be parsed as ${no}`))}function toTechFormat(to,ue,eo=!0){return to.isValid?Formatter.create(Locale.create("en-US"),{allowZ:eo,forceSimple:!0}).formatDateTimeFromString(to,ue):null}function toISODate(to,ue){const eo=to.c.year>9999||to.c.year<0;let no="";return eo&&to.c.year>=0&&(no+="+"),no+=padStart(to.c.year,eo?6:4),ue?(no+="-",no+=padStart(to.c.month),no+="-",no+=padStart(to.c.day)):(no+=padStart(to.c.month),no+=padStart(to.c.day)),no}function toISOTime(to,ue,eo,no,ro,oo){let io=padStart(to.c.hour);return ue?(io+=":",io+=padStart(to.c.minute),(to.c.second!==0||!eo)&&(io+=":")):io+=padStart(to.c.minute),(to.c.second!==0||!eo)&&(io+=padStart(to.c.second),(to.c.millisecond!==0||!no)&&(io+=".",io+=padStart(to.c.millisecond,3))),ro&&(to.isOffsetFixed&&to.offset===0&&!oo?io+="Z":to.o<0?(io+="-",io+=padStart(Math.trunc(-to.o/60)),io+=":",io+=padStart(Math.trunc(-to.o%60))):(io+="+",io+=padStart(Math.trunc(to.o/60)),io+=":",io+=padStart(Math.trunc(to.o%60)))),oo&&(io+="["+to.zone.ianaName+"]"),io}const defaultUnitValues={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},defaultWeekUnitValues={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},defaultOrdinalUnitValues={ordinal:1,hour:0,minute:0,second:0,millisecond:0},orderedUnits=["year","month","day","hour","minute","second","millisecond"],orderedWeekUnits=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],orderedOrdinalUnits=["year","ordinal","hour","minute","second","millisecond"];function normalizeUnit(to){const ue={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[to.toLowerCase()];if(!ue)throw new InvalidUnitError(to);return ue}function quickDT(to,ue){const eo=normalizeZone(ue.zone,Settings$3.defaultZone),no=Locale.fromObject(ue),ro=Settings$3.now();let oo,io;if(isUndefined$1(to.year))oo=ro;else{for(const lo of orderedUnits)isUndefined$1(to[lo])&&(to[lo]=defaultUnitValues[lo]);const ao=hasInvalidGregorianData(to)||hasInvalidTimeData(to);if(ao)return DateTime.invalid(ao);const so=eo.offset(ro);[oo,io]=objToTS(to,so,eo)}return new DateTime({ts:oo,zone:eo,loc:no,o:io})}function diffRelative(to,ue,eo){const no=isUndefined$1(eo.round)?!0:eo.round,ro=(io,ao)=>(io=roundTo(io,no||eo.calendary?0:2,!0),ue.loc.clone(eo).relFormatter(eo).format(io,ao)),oo=io=>eo.calendary?ue.hasSame(to,io)?0:ue.startOf(io).diff(to.startOf(io),io).get(io):ue.diff(to,io).get(io);if(eo.unit)return ro(oo(eo.unit),eo.unit);for(const io of eo.units){const ao=oo(io);if(Math.abs(ao)>=1)return ro(ao,io)}return ro(to>ue?-0:0,eo.units[eo.units.length-1])}function lastOpts(to){let ue={},eo;return to.length>0&&typeof to[to.length-1]=="object"?(ue=to[to.length-1],eo=Array.from(to).slice(0,to.length-1)):eo=Array.from(to),[ue,eo]}class DateTime{constructor(ue){const eo=ue.zone||Settings$3.defaultZone;let no=ue.invalid||(Number.isNaN(ue.ts)?new Invalid("invalid input"):null)||(eo.isValid?null:unsupportedZone(eo));this.ts=isUndefined$1(ue.ts)?Settings$3.now():ue.ts;let ro=null,oo=null;if(!no)if(ue.old&&ue.old.ts===this.ts&&ue.old.zone.equals(eo))[ro,oo]=[ue.old.c,ue.old.o];else{const ao=eo.offset(this.ts);ro=tsToObj(this.ts,ao),no=Number.isNaN(ro.year)?new Invalid("invalid input"):null,ro=no?null:ro,oo=no?null:ao}this._zone=eo,this.loc=ue.loc||Locale.create(),this.invalid=no,this.weekData=null,this.c=ro,this.o=oo,this.isLuxonDateTime=!0}static now(){return new DateTime({})}static local(){const[ue,eo]=lastOpts(arguments),[no,ro,oo,io,ao,so,lo]=eo;return quickDT({year:no,month:ro,day:oo,hour:io,minute:ao,second:so,millisecond:lo},ue)}static utc(){const[ue,eo]=lastOpts(arguments),[no,ro,oo,io,ao,so,lo]=eo;return ue.zone=FixedOffsetZone.utcInstance,quickDT({year:no,month:ro,day:oo,hour:io,minute:ao,second:so,millisecond:lo},ue)}static fromJSDate(ue,eo={}){const no=isDate$3(ue)?ue.valueOf():NaN;if(Number.isNaN(no))return DateTime.invalid("invalid input");const ro=normalizeZone(eo.zone,Settings$3.defaultZone);return ro.isValid?new DateTime({ts:no,zone:ro,loc:Locale.fromObject(eo)}):DateTime.invalid(unsupportedZone(ro))}static fromMillis(ue,eo={}){if(isNumber$5(ue))return ue<-MAX_DATE||ue>MAX_DATE?DateTime.invalid("Timestamp out of range"):new DateTime({ts:ue,zone:normalizeZone(eo.zone,Settings$3.defaultZone),loc:Locale.fromObject(eo)});throw new InvalidArgumentError(`fromMillis requires a numerical input, but received a ${typeof ue} with value ${ue}`)}static fromSeconds(ue,eo={}){if(isNumber$5(ue))return new DateTime({ts:ue*1e3,zone:normalizeZone(eo.zone,Settings$3.defaultZone),loc:Locale.fromObject(eo)});throw new InvalidArgumentError("fromSeconds requires a numerical input")}static fromObject(ue,eo={}){ue=ue||{};const no=normalizeZone(eo.zone,Settings$3.defaultZone);if(!no.isValid)return DateTime.invalid(unsupportedZone(no));const ro=Settings$3.now(),oo=isUndefined$1(eo.specificOffset)?no.offset(ro):eo.specificOffset,io=normalizeObject(ue,normalizeUnit),ao=!isUndefined$1(io.ordinal),so=!isUndefined$1(io.year),lo=!isUndefined$1(io.month)||!isUndefined$1(io.day),co=so||lo,uo=io.weekYear||io.weekNumber,fo=Locale.fromObject(eo);if((co||ao)&&uo)throw new ConflictingSpecificationError("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(lo&&ao)throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day");const po=uo||io.weekday&&!co;let ho,_o,go=tsToObj(ro,oo);po?(ho=orderedWeekUnits,_o=defaultWeekUnitValues,go=gregorianToWeek(go)):ao?(ho=orderedOrdinalUnits,_o=defaultOrdinalUnitValues,go=gregorianToOrdinal(go)):(ho=orderedUnits,_o=defaultUnitValues);let bo=!1;for(const Io of ho){const Ao=io[Io];isUndefined$1(Ao)?bo?io[Io]=_o[Io]:io[Io]=go[Io]:bo=!0}const vo=po?hasInvalidWeekData(io):ao?hasInvalidOrdinalData(io):hasInvalidGregorianData(io),yo=vo||hasInvalidTimeData(io);if(yo)return DateTime.invalid(yo);const wo=po?weekToGregorian(io):ao?ordinalToGregorian(io):io,[ko,So]=objToTS(wo,oo,no),Eo=new DateTime({ts:ko,zone:no,o:So,loc:fo});return io.weekday&&co&&ue.weekday!==Eo.weekday?DateTime.invalid("mismatched weekday",`you can't specify both a weekday of ${io.weekday} and a date of ${Eo.toISO()}`):Eo}static fromISO(ue,eo={}){const[no,ro]=parseISODate(ue);return parseDataToDateTime(no,ro,eo,"ISO 8601",ue)}static fromRFC2822(ue,eo={}){const[no,ro]=parseRFC2822Date(ue);return parseDataToDateTime(no,ro,eo,"RFC 2822",ue)}static fromHTTP(ue,eo={}){const[no,ro]=parseHTTPDate(ue);return parseDataToDateTime(no,ro,eo,"HTTP",eo)}static fromFormat(ue,eo,no={}){if(isUndefined$1(ue)||isUndefined$1(eo))throw new InvalidArgumentError("fromFormat requires an input string and a format");const{locale:ro=null,numberingSystem:oo=null}=no,io=Locale.fromOpts({locale:ro,numberingSystem:oo,defaultToEN:!0}),[ao,so,lo,co]=parseFromTokens(io,ue,eo);return co?DateTime.invalid(co):parseDataToDateTime(ao,so,no,`format ${eo}`,ue,lo)}static fromString(ue,eo,no={}){return DateTime.fromFormat(ue,eo,no)}static fromSQL(ue,eo={}){const[no,ro]=parseSQL(ue);return parseDataToDateTime(no,ro,eo,"SQL",ue)}static invalid(ue,eo=null){if(!ue)throw new InvalidArgumentError("need to specify a reason the DateTime is invalid");const no=ue instanceof Invalid?ue:new Invalid(ue,eo);if(Settings$3.throwOnInvalid)throw new InvalidDateTimeError(no);return new DateTime({invalid:no})}static isDateTime(ue){return ue&&ue.isLuxonDateTime||!1}static parseFormatForOpts(ue,eo={}){const no=formatOptsToTokens(ue,Locale.fromObject(eo));return no?no.map(ro=>ro?ro.val:null).join(""):null}static expandFormat(ue,eo={}){return expandMacroTokens(Formatter.parseFormat(ue),Locale.fromObject(eo)).map(ro=>ro.val).join("")}get(ue){return this[ue]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?possiblyCachedWeekData(this).weekYear:NaN}get weekNumber(){return this.isValid?possiblyCachedWeekData(this).weekNumber:NaN}get weekday(){return this.isValid?possiblyCachedWeekData(this).weekday:NaN}get ordinal(){return this.isValid?gregorianToOrdinal(this.c).ordinal:NaN}get monthShort(){return this.isValid?Info.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?Info.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?Info.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?Info.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}get isInLeapYear(){return isLeapYear(this.year)}get daysInMonth(){return daysInMonth(this.year,this.month)}get daysInYear(){return this.isValid?daysInYear(this.year):NaN}get weeksInWeekYear(){return this.isValid?weeksInWeekYear(this.weekYear):NaN}resolvedLocaleOptions(ue={}){const{locale:eo,numberingSystem:no,calendar:ro}=Formatter.create(this.loc.clone(ue),ue).resolvedOptions(this);return{locale:eo,numberingSystem:no,outputCalendar:ro}}toUTC(ue=0,eo={}){return this.setZone(FixedOffsetZone.instance(ue),eo)}toLocal(){return this.setZone(Settings$3.defaultZone)}setZone(ue,{keepLocalTime:eo=!1,keepCalendarTime:no=!1}={}){if(ue=normalizeZone(ue,Settings$3.defaultZone),ue.equals(this.zone))return this;if(ue.isValid){let ro=this.ts;if(eo||no){const oo=ue.offset(this.ts),io=this.toObject();[ro]=objToTS(io,oo,ue)}return clone$2(this,{ts:ro,zone:ue})}else return DateTime.invalid(unsupportedZone(ue))}reconfigure({locale:ue,numberingSystem:eo,outputCalendar:no}={}){const ro=this.loc.clone({locale:ue,numberingSystem:eo,outputCalendar:no});return clone$2(this,{loc:ro})}setLocale(ue){return this.reconfigure({locale:ue})}set(ue){if(!this.isValid)return this;const eo=normalizeObject(ue,normalizeUnit),no=!isUndefined$1(eo.weekYear)||!isUndefined$1(eo.weekNumber)||!isUndefined$1(eo.weekday),ro=!isUndefined$1(eo.ordinal),oo=!isUndefined$1(eo.year),io=!isUndefined$1(eo.month)||!isUndefined$1(eo.day),ao=oo||io,so=eo.weekYear||eo.weekNumber;if((ao||ro)&&so)throw new ConflictingSpecificationError("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(io&&ro)throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day");let lo;no?lo=weekToGregorian({...gregorianToWeek(this.c),...eo}):isUndefined$1(eo.ordinal)?(lo={...this.toObject(),...eo},isUndefined$1(eo.day)&&(lo.day=Math.min(daysInMonth(lo.year,lo.month),lo.day))):lo=ordinalToGregorian({...gregorianToOrdinal(this.c),...eo});const[co,uo]=objToTS(lo,this.o,this.zone);return clone$2(this,{ts:co,o:uo})}plus(ue){if(!this.isValid)return this;const eo=Duration.fromDurationLike(ue);return clone$2(this,adjustTime(this,eo))}minus(ue){if(!this.isValid)return this;const eo=Duration.fromDurationLike(ue).negate();return clone$2(this,adjustTime(this,eo))}startOf(ue){if(!this.isValid)return this;const eo={},no=Duration.normalizeUnit(ue);switch(no){case"years":eo.month=1;case"quarters":case"months":eo.day=1;case"weeks":case"days":eo.hour=0;case"hours":eo.minute=0;case"minutes":eo.second=0;case"seconds":eo.millisecond=0;break}if(no==="weeks"&&(eo.weekday=1),no==="quarters"){const ro=Math.ceil(this.month/3);eo.month=(ro-1)*3+1}return this.set(eo)}endOf(ue){return this.isValid?this.plus({[ue]:1}).startOf(ue).minus(1):this}toFormat(ue,eo={}){return this.isValid?Formatter.create(this.loc.redefaultToEN(eo)).formatDateTimeFromString(this,ue):INVALID}toLocaleString(ue=DATE_SHORT,eo={}){return this.isValid?Formatter.create(this.loc.clone(eo),ue).formatDateTime(this):INVALID}toLocaleParts(ue={}){return this.isValid?Formatter.create(this.loc.clone(ue),ue).formatDateTimeParts(this):[]}toISO({format:ue="extended",suppressSeconds:eo=!1,suppressMilliseconds:no=!1,includeOffset:ro=!0,extendedZone:oo=!1}={}){if(!this.isValid)return null;const io=ue==="extended";let ao=toISODate(this,io);return ao+="T",ao+=toISOTime(this,io,eo,no,ro,oo),ao}toISODate({format:ue="extended"}={}){return this.isValid?toISODate(this,ue==="extended"):null}toISOWeekDate(){return toTechFormat(this,"kkkk-'W'WW-c")}toISOTime({suppressMilliseconds:ue=!1,suppressSeconds:eo=!1,includeOffset:no=!0,includePrefix:ro=!1,extendedZone:oo=!1,format:io="extended"}={}){return this.isValid?(ro?"T":"")+toISOTime(this,io==="extended",eo,ue,no,oo):null}toRFC2822(){return toTechFormat(this,"EEE, dd LLL yyyy HH:mm:ss ZZZ",!1)}toHTTP(){return toTechFormat(this.toUTC(),"EEE, dd LLL yyyy HH:mm:ss 'GMT'")}toSQLDate(){return this.isValid?toISODate(this,!0):null}toSQLTime({includeOffset:ue=!0,includeZone:eo=!1,includeOffsetSpace:no=!0}={}){let ro="HH:mm:ss.SSS";return(eo||ue)&&(no&&(ro+=" "),eo?ro+="z":ue&&(ro+="ZZ")),toTechFormat(this,ro,!0)}toSQL(ue={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(ue)}`:null}toString(){return this.isValid?this.toISO():INVALID}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(ue={}){if(!this.isValid)return{};const eo={...this.c};return ue.includeConfig&&(eo.outputCalendar=this.outputCalendar,eo.numberingSystem=this.loc.numberingSystem,eo.locale=this.loc.locale),eo}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(ue,eo="milliseconds",no={}){if(!this.isValid||!ue.isValid)return Duration.invalid("created by diffing an invalid DateTime");const ro={locale:this.locale,numberingSystem:this.numberingSystem,...no},oo=maybeArray(eo).map(Duration.normalizeUnit),io=ue.valueOf()>this.valueOf(),ao=io?this:ue,so=io?ue:this,lo=diff(ao,so,oo,ro);return io?lo.negate():lo}diffNow(ue="milliseconds",eo={}){return this.diff(DateTime.now(),ue,eo)}until(ue){return this.isValid?Interval.fromDateTimes(this,ue):this}hasSame(ue,eo){if(!this.isValid)return!1;const no=ue.valueOf(),ro=this.setZone(ue.zone,{keepLocalTime:!0});return ro.startOf(eo)<=no&&no<=ro.endOf(eo)}equals(ue){return this.isValid&&ue.isValid&&this.valueOf()===ue.valueOf()&&this.zone.equals(ue.zone)&&this.loc.equals(ue.loc)}toRelative(ue={}){if(!this.isValid)return null;const eo=ue.base||DateTime.fromObject({},{zone:this.zone}),no=ue.padding?this<eo?-ue.padding:ue.padding:0;let ro=["years","months","days","hours","minutes","seconds"],oo=ue.unit;return Array.isArray(ue.unit)&&(ro=ue.unit,oo=void 0),diffRelative(eo,this.plus(no),{...ue,numeric:"always",units:ro,unit:oo})}toRelativeCalendar(ue={}){return this.isValid?diffRelative(ue.base||DateTime.fromObject({},{zone:this.zone}),this,{...ue,numeric:"auto",units:["years","months","days"],calendary:!0}):null}static min(...ue){if(!ue.every(DateTime.isDateTime))throw new InvalidArgumentError("min requires all arguments be DateTimes");return bestBy(ue,eo=>eo.valueOf(),Math.min)}static max(...ue){if(!ue.every(DateTime.isDateTime))throw new InvalidArgumentError("max requires all arguments be DateTimes");return bestBy(ue,eo=>eo.valueOf(),Math.max)}static fromFormatExplain(ue,eo,no={}){const{locale:ro=null,numberingSystem:oo=null}=no,io=Locale.fromOpts({locale:ro,numberingSystem:oo,defaultToEN:!0});return explainFromTokens(io,ue,eo)}static fromStringExplain(ue,eo,no={}){return DateTime.fromFormatExplain(ue,eo,no)}static get DATE_SHORT(){return DATE_SHORT}static get DATE_MED(){return DATE_MED}static get DATE_MED_WITH_WEEKDAY(){return DATE_MED_WITH_WEEKDAY}static get DATE_FULL(){return DATE_FULL}static get DATE_HUGE(){return DATE_HUGE}static get TIME_SIMPLE(){return TIME_SIMPLE}static get TIME_WITH_SECONDS(){return TIME_WITH_SECONDS}static get TIME_WITH_SHORT_OFFSET(){return TIME_WITH_SHORT_OFFSET}static get TIME_WITH_LONG_OFFSET(){return TIME_WITH_LONG_OFFSET}static get TIME_24_SIMPLE(){return TIME_24_SIMPLE}static get TIME_24_WITH_SECONDS(){return TIME_24_WITH_SECONDS}static get TIME_24_WITH_SHORT_OFFSET(){return TIME_24_WITH_SHORT_OFFSET}static get TIME_24_WITH_LONG_OFFSET(){return TIME_24_WITH_LONG_OFFSET}static get DATETIME_SHORT(){return DATETIME_SHORT}static get DATETIME_SHORT_WITH_SECONDS(){return DATETIME_SHORT_WITH_SECONDS}static get DATETIME_MED(){return DATETIME_MED}static get DATETIME_MED_WITH_SECONDS(){return DATETIME_MED_WITH_SECONDS}static get DATETIME_MED_WITH_WEEKDAY(){return DATETIME_MED_WITH_WEEKDAY}static get DATETIME_FULL(){return DATETIME_FULL}static get DATETIME_FULL_WITH_SECONDS(){return DATETIME_FULL_WITH_SECONDS}static get DATETIME_HUGE(){return DATETIME_HUGE}static get DATETIME_HUGE_WITH_SECONDS(){return DATETIME_HUGE_WITH_SECONDS}}function friendlyDateTime(to){if(DateTime.isDateTime(to))return to;if(to&&to.valueOf&&isNumber$5(to.valueOf()))return DateTime.fromJSDate(to);if(to&&typeof to=="object")return DateTime.fromObject(to);throw new InvalidArgumentError(`Unknown datetime argument: ${to}, of type ${typeof to}`)}const VERSION$1="3.2.1";luxon$1.DateTime=DateTime;luxon$1.Duration=Duration;luxon$1.FixedOffsetZone=FixedOffsetZone;luxon$1.IANAZone=IANAZone;luxon$1.Info=Info;luxon$1.Interval=Interval;luxon$1.InvalidZone=InvalidZone;luxon$1.Settings=Settings$3;luxon$1.SystemZone=SystemZone;luxon$1.VERSION=VERSION$1;luxon$1.Zone=Zone;var luxon=luxon$1;CronDate$1.prototype.addYear=function(){this._date=this._date.plus({years:1})};CronDate$1.prototype.addMonth=function(){this._date=this._date.plus({months:1}).startOf("month")};CronDate$1.prototype.addDay=function(){this._date=this._date.plus({days:1}).startOf("day")};CronDate$1.prototype.addHour=function(){var to=this._date;this._date=this._date.plus({hours:1}).startOf("hour"),this._date<=to&&(this._date=this._date.plus({hours:1}))};CronDate$1.prototype.addMinute=function(){var to=this._date;this._date=this._date.plus({minutes:1}).startOf("minute"),this._date<to&&(this._date=this._date.plus({hours:1}))};CronDate$1.prototype.addSecond=function(){var to=this._date;this._date=this._date.plus({seconds:1}).startOf("second"),this._date<to&&(this._date=this._date.plus({hours:1}))};CronDate$1.prototype.subtractYear=function(){this._date=this._date.minus({years:1})};CronDate$1.prototype.subtractMonth=function(){this._date=this._date.minus({months:1}).endOf("month").startOf("second")};CronDate$1.prototype.subtractDay=function(){this._date=this._date.minus({days:1}).endOf("day").startOf("second")};CronDate$1.prototype.subtractHour=function(){var to=this._date;this._date=this._date.minus({hours:1}).endOf("hour").startOf("second"),this._date>=to&&(this._date=this._date.minus({hours:1}))};CronDate$1.prototype.subtractMinute=function(){var to=this._date;this._date=this._date.minus({minutes:1}).endOf("minute").startOf("second"),this._date>to&&(this._date=this._date.minus({hours:1}))};CronDate$1.prototype.subtractSecond=function(){var to=this._date;this._date=this._date.minus({seconds:1}).startOf("second"),this._date>to&&(this._date=this._date.minus({hours:1}))};CronDate$1.prototype.getDate=function(){return this._date.day};CronDate$1.prototype.getFullYear=function(){return this._date.year};CronDate$1.prototype.getDay=function(){var to=this._date.weekday;return to==7?0:to};CronDate$1.prototype.getMonth=function(){return this._date.month-1};CronDate$1.prototype.getHours=function(){return this._date.hour};CronDate$1.prototype.getMinutes=function(){return this._date.minute};CronDate$1.prototype.getSeconds=function(){return this._date.second};CronDate$1.prototype.getMilliseconds=function(){return this._date.millisecond};CronDate$1.prototype.getTime=function(){return this._date.valueOf()};CronDate$1.prototype.getUTCDate=function(){return this._getUTC().day};CronDate$1.prototype.getUTCFullYear=function(){return this._getUTC().year};CronDate$1.prototype.getUTCDay=function(){var to=this._getUTC().weekday;return to==7?0:to};CronDate$1.prototype.getUTCMonth=function(){return this._getUTC().month-1};CronDate$1.prototype.getUTCHours=function(){return this._getUTC().hour};CronDate$1.prototype.getUTCMinutes=function(){return this._getUTC().minute};CronDate$1.prototype.getUTCSeconds=function(){return this._getUTC().second};CronDate$1.prototype.toISOString=function(){return this._date.toUTC().toISO()};CronDate$1.prototype.toJSON=function(){return this._date.toJSON()};CronDate$1.prototype.setDate=function(to){this._date=this._date.set({day:to})};CronDate$1.prototype.setFullYear=function(to){this._date=this._date.set({year:to})};CronDate$1.prototype.setDay=function(to){this._date=this._date.set({weekday:to})};CronDate$1.prototype.setMonth=function(to){this._date=this._date.set({month:to+1})};CronDate$1.prototype.setHours=function(to){this._date=this._date.set({hour:to})};CronDate$1.prototype.setMinutes=function(to){this._date=this._date.set({minute:to})};CronDate$1.prototype.setSeconds=function(to){this._date=this._date.set({second:to})};CronDate$1.prototype.setMilliseconds=function(to){this._date=this._date.set({millisecond:to})};CronDate$1.prototype._getUTC=function(){return this._date.toUTC()};CronDate$1.prototype.toString=function(){return this.toDate().toString()};CronDate$1.prototype.toDate=function(){return this._date.toJSDate()};CronDate$1.prototype.isLastDayOfMonth=function(){var to=this._date.plus({days:1}).startOf("day");return this._date.month!==to.month};CronDate$1.prototype.isLastWeekdayOfMonth=function(){var to=this._date.plus({days:7}).startOf("day");return this._date.month!==to.month};function CronDate$1(to,ue){var eo={zone:ue};if(to?to instanceof CronDate$1?this._date=to._date:to instanceof Date?this._date=luxon.DateTime.fromJSDate(to,eo):typeof to=="number"?this._date=luxon.DateTime.fromMillis(to,eo):typeof to=="string"&&(this._date=luxon.DateTime.fromISO(to,eo),this._date.isValid||(this._date=luxon.DateTime.fromRFC2822(to,eo)),this._date.isValid||(this._date=luxon.DateTime.fromSQL(to,eo)),this._date.isValid||(this._date=luxon.DateTime.fromFormat(to,"EEE, d MMM yyyy HH:mm:ss",eo))):this._date=luxon.DateTime.local(),!this._date||!this._date.isValid)throw new Error("CronDate: unhandled timestamp: "+JSON.stringify(to));ue&&ue!==this._date.zoneName&&(this._date=this._date.setZone(ue))}var date$3=CronDate$1;function buildRange(to){return{start:to,count:1}}function completeRangeWithItem(to,ue){to.end=ue,to.step=ue-to.start,to.count=2}function finalizeCurrentRange(to,ue,eo){ue&&(ue.count===2?(to.push(buildRange(ue.start)),to.push(buildRange(ue.end))):to.push(ue)),eo&&to.push(eo)}function compactField$1(to){for(var ue=[],eo=void 0,no=0;no<to.length;no++){var ro=to[no];typeof ro!="number"?(finalizeCurrentRange(ue,eo,buildRange(ro)),eo=void 0):eo?eo.count===1?completeRangeWithItem(eo,ro):eo.step===ro-eo.end?(eo.count++,eo.end=ro):eo.count===2?(ue.push(buildRange(eo.start)),eo=buildRange(eo.end),completeRangeWithItem(eo,ro)):(finalizeCurrentRange(ue,eo),eo=buildRange(ro)):eo=buildRange(ro)}return finalizeCurrentRange(ue,eo),ue}var field_compactor=compactField$1,compactField=field_compactor;function stringifyField$1(to,ue,eo){var no=compactField(to);if(no.length===1){var ro=no[0],oo=ro.step;if(oo===1&&ro.start===ue&&ro.end===eo)return"*";if(oo!==1&&ro.start===ue&&ro.end===eo-oo+1)return"*/"+oo}for(var io=[],ao=0,so=no.length;ao<so;++ao){var lo=no[ao];if(lo.count===1){io.push(lo.start);continue}var oo=lo.step;if(lo.step===1){io.push(lo.start+"-"+lo.end);continue}var co=lo.start==0?lo.count-1:lo.count;lo.step*co>lo.end?io=io.concat(Array.from({length:lo.end-lo.start+1}).map(function(fo,po){var ho=lo.start+po;return(ho-lo.start)%lo.step===0?ho:null}).filter(function(fo){return fo!=null})):lo.end===eo-lo.step+1?io.push(lo.start+"/"+lo.step):io.push(lo.start+"-"+lo.end+"/"+lo.step)}return io.join(",")}var field_stringify=stringifyField$1,CronDate=date$3,stringifyField=field_stringify,LOOP_LIMIT=1e4;function CronExpression$1(to,ue){this._options=ue,this._utc=ue.utc||!1,this._tz=this._utc?"UTC":ue.tz,this._currentDate=new CronDate(ue.currentDate,this._tz),this._startDate=ue.startDate?new CronDate(ue.startDate,this._tz):null,this._endDate=ue.endDate?new CronDate(ue.endDate,this._tz):null,this._isIterator=ue.iterator||!1,this._hasIterated=!1,this._nthDayOfWeek=ue.nthDayOfWeek||0,this.fields=CronExpression$1._freezeFields(to)}CronExpression$1.map=["second","minute","hour","dayOfMonth","month","dayOfWeek"];CronExpression$1.predefined={"@yearly":"0 0 1 1 *","@monthly":"0 0 1 * *","@weekly":"0 0 * * 0","@daily":"0 0 * * *","@hourly":"0 * * * *"};CronExpression$1.constraints=[{min:0,max:59,chars:[]},{min:0,max:59,chars:[]},{min:0,max:23,chars:[]},{min:1,max:31,chars:["L"]},{min:1,max:12,chars:[]},{min:0,max:7,chars:["L"]}];CronExpression$1.daysInMonth=[31,29,31,30,31,30,31,31,30,31,30,31];CronExpression$1.aliases={month:{jan:1,feb:2,mar:3,apr:4,may:5,jun:6,jul:7,aug:8,sep:9,oct:10,nov:11,dec:12},dayOfWeek:{sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6}};CronExpression$1.parseDefaults=["0","*","*","*","*","*"];CronExpression$1.standardValidCharacters=/^[,*\d/-]+$/;CronExpression$1.dayOfWeekValidCharacters=/^[?,*\dL#/-]+$/;CronExpression$1.dayOfMonthValidCharacters=/^[?,*\dL/-]+$/;CronExpression$1.validCharacters={second:CronExpression$1.standardValidCharacters,minute:CronExpression$1.standardValidCharacters,hour:CronExpression$1.standardValidCharacters,dayOfMonth:CronExpression$1.dayOfMonthValidCharacters,month:CronExpression$1.standardValidCharacters,dayOfWeek:CronExpression$1.dayOfWeekValidCharacters};CronExpression$1._isValidConstraintChar=function(ue,eo){return typeof eo!="string"?!1:ue.chars.some(function(no){return eo.indexOf(no)>-1})};CronExpression$1._parseField=function(ue,eo,no){switch(ue){case"month":case"dayOfWeek":var ro=CronExpression$1.aliases[ue];eo=eo.replace(/[a-z]{3}/gi,function(so){if(so=so.toLowerCase(),typeof ro[so]<"u")return ro[so];throw new Error('Validation error, cannot resolve alias "'+so+'"')});break}if(!CronExpression$1.validCharacters[ue].test(eo))throw new Error("Invalid characters, got value: "+eo);eo.indexOf("*")!==-1?eo=eo.replace(/\*/g,no.min+"-"+no.max):eo.indexOf("?")!==-1&&(eo=eo.replace(/\?/g,no.min+"-"+no.max));function oo(so){var lo=[];function co(ho){if(ho instanceof Array)for(var _o=0,go=ho.length;_o<go;_o++){var bo=ho[_o];if(CronExpression$1._isValidConstraintChar(no,bo)){lo.push(bo);continue}if(typeof bo!="number"||Number.isNaN(bo)||bo<no.min||bo>no.max)throw new Error("Constraint error, got value "+bo+" expected range "+no.min+"-"+no.max);lo.push(bo)}else{if(CronExpression$1._isValidConstraintChar(no,ho)){lo.push(ho);return}var vo=+ho;if(Number.isNaN(vo)||vo<no.min||vo>no.max)throw new Error("Constraint error, got value "+ho+" expected range "+no.min+"-"+no.max);ue==="dayOfWeek"&&(vo=vo%7),lo.push(vo)}}var uo=so.split(",");if(!uo.every(function(ho){return ho.length>0}))throw new Error("Invalid list value format");if(uo.length>1)for(var fo=0,po=uo.length;fo<po;fo++)co(io(uo[fo]));else co(io(so));return lo.sort(CronExpression$1._sortCompareFn),lo}function io(so){var lo=1,co=so.split("/");if(co.length>2)throw new Error("Invalid repeat: "+so);return co.length>1?(co[0]==+co[0]&&(co=[co[0]+"-"+no.max,co[1]]),ao(co[0],co[co.length-1])):ao(so,lo)}function ao(so,lo){var co=[],uo=so.split("-");if(uo.length>1){if(uo.length<2)return+so;if(!uo[0].length){if(!uo[1].length)throw new Error("Invalid range: "+so);return+so}var fo=+uo[0],po=+uo[1];if(Number.isNaN(fo)||Number.isNaN(po)||fo<no.min||po>no.max)throw new Error("Constraint error, got range "+fo+"-"+po+" expected range "+no.min+"-"+no.max);if(fo>po)throw new Error("Invalid range: "+so);var ho=+lo;if(Number.isNaN(ho)||ho<=0)throw new Error("Constraint error, cannot repeat at every "+ho+" time.");ue==="dayOfWeek"&&po%7===0&&co.push(0);for(var _o=fo,go=po;_o<=go;_o++){var bo=co.indexOf(_o)!==-1;!bo&&ho>0&&ho%lo===0?(ho=1,co.push(_o)):ho++}return co}return Number.isNaN(+so)?so:+so}return oo(eo)};CronExpression$1._sortCompareFn=function(to,ue){var eo=typeof to=="number",no=typeof ue=="number";return eo&&no?to-ue:!eo&&no?1:eo&&!no?-1:to.localeCompare(ue)};CronExpression$1._handleMaxDaysInMonth=function(to){if(to.month.length===1){var ue=CronExpression$1.daysInMonth[to.month[0]-1];if(to.dayOfMonth[0]>ue)throw new Error("Invalid explicit day of month definition");return to.dayOfMonth.filter(function(eo){return eo==="L"?!0:eo<=ue}).sort(CronExpression$1._sortCompareFn)}};CronExpression$1._freezeFields=function(to){for(var ue=0,eo=CronExpression$1.map.length;ue<eo;++ue){var no=CronExpression$1.map[ue],ro=to[no];to[no]=Object.freeze(ro)}return Object.freeze(to)};CronExpression$1.prototype._applyTimezoneShift=function(to,ue,eo){if(eo==="Month"||eo==="Day"){var no=to.getTime();to[ue+eo]();var ro=to.getTime();no===ro&&(to.getMinutes()===0&&to.getSeconds()===0?to.addHour():to.getMinutes()===59&&to.getSeconds()===59&&to.subtractHour())}else{var oo=to.getHours();to[ue+eo]();var io=to.getHours(),ao=io-oo;ao===2?this.fields.hour.length!==24&&(this._dstStart=io):ao===0&&to.getMinutes()===0&&to.getSeconds()===0&&this.fields.hour.length!==24&&(this._dstEnd=io)}};CronExpression$1.prototype._findSchedule=function(ue){function eo(bo,vo){for(var yo=0,wo=vo.length;yo<wo;yo++)if(vo[yo]>=bo)return vo[yo]===bo;return vo[0]===bo}function no(bo,vo){if(vo<6){if(bo.getDate()<8&&vo===1)return!0;var yo=bo.getDate()%7?1:0,wo=bo.getDate()-bo.getDate()%7,ko=Math.floor(wo/7)+yo;return ko===vo}return!1}function ro(bo){return bo.length>0&&bo.some(function(vo){return typeof vo=="string"&&vo.indexOf("L")>=0})}ue=ue||!1;var oo=ue?"subtract":"add",io=new CronDate(this._currentDate,this._tz),ao=this._startDate,so=this._endDate,lo=io.getTime(),co=0;function uo(bo){return bo.some(function(vo){if(!ro([vo]))return!1;var yo=Number.parseInt(vo[0])%7;if(Number.isNaN(yo))throw new Error("Invalid last weekday of the month expression: "+vo);return io.getDay()===yo&&io.isLastWeekdayOfMonth()})}for(;co<LOOP_LIMIT;){if(co++,ue){if(ao&&io.getTime()-ao.getTime()<0)throw new Error("Out of the timespan range")}else if(so&&so.getTime()-io.getTime()<0)throw new Error("Out of the timespan range");var fo=eo(io.getDate(),this.fields.dayOfMonth);ro(this.fields.dayOfMonth)&&(fo=fo||io.isLastDayOfMonth());var po=eo(io.getDay(),this.fields.dayOfWeek);ro(this.fields.dayOfWeek)&&(po=po||uo(this.fields.dayOfWeek));var ho=this.fields.dayOfMonth.length>=CronExpression$1.daysInMonth[io.getMonth()],_o=this.fields.dayOfWeek.length===CronExpression$1.constraints[5].max-CronExpression$1.constraints[5].min+1,go=io.getHours();if(!fo&&(!po||_o)){this._applyTimezoneShift(io,oo,"Day");continue}if(!ho&&_o&&!fo){this._applyTimezoneShift(io,oo,"Day");continue}if(ho&&!_o&&!po){this._applyTimezoneShift(io,oo,"Day");continue}if(this._nthDayOfWeek>0&&!no(io,this._nthDayOfWeek)){this._applyTimezoneShift(io,oo,"Day");continue}if(!eo(io.getMonth()+1,this.fields.month)){this._applyTimezoneShift(io,oo,"Month");continue}if(eo(go,this.fields.hour)){if(this._dstEnd===go&&!ue){this._dstEnd=null,this._applyTimezoneShift(io,"add","Hour");continue}}else if(this._dstStart!==go){this._dstStart=null,this._applyTimezoneShift(io,oo,"Hour");continue}else if(!eo(go-1,this.fields.hour)){io[oo+"Hour"]();continue}if(!eo(io.getMinutes(),this.fields.minute)){this._applyTimezoneShift(io,oo,"Minute");continue}if(!eo(io.getSeconds(),this.fields.second)){this._applyTimezoneShift(io,oo,"Second");continue}if(lo===io.getTime()){oo==="add"||io.getMilliseconds()===0?this._applyTimezoneShift(io,oo,"Second"):io.setMilliseconds(0);continue}break}if(co>=LOOP_LIMIT)throw new Error("Invalid expression, loop limit exceeded");return this._currentDate=new CronDate(io,this._tz),this._hasIterated=!0,io};CronExpression$1.prototype.next=function(){var ue=this._findSchedule();return this._isIterator?{value:ue,done:!this.hasNext()}:ue};CronExpression$1.prototype.prev=function(){var ue=this._findSchedule(!0);return this._isIterator?{value:ue,done:!this.hasPrev()}:ue};CronExpression$1.prototype.hasNext=function(){var to=this._currentDate,ue=this._hasIterated;try{return this._findSchedule(),!0}catch{return!1}finally{this._currentDate=to,this._hasIterated=ue}};CronExpression$1.prototype.hasPrev=function(){var to=this._currentDate,ue=this._hasIterated;try{return this._findSchedule(!0),!0}catch{return!1}finally{this._currentDate=to,this._hasIterated=ue}};CronExpression$1.prototype.iterate=function(ue,eo){var no=[];if(ue>=0)for(var ro=0,oo=ue;ro<oo;ro++)try{var io=this.next();no.push(io),eo&&eo(io,ro)}catch{break}else for(var ro=0,oo=ue;ro>oo;ro--)try{var io=this.prev();no.push(io),eo&&eo(io,ro)}catch{break}return no};CronExpression$1.prototype.reset=function(ue){this._currentDate=new CronDate(ue||this._options.currentDate)};CronExpression$1.prototype.stringify=function(ue){for(var eo=[],no=ue?0:1,ro=CronExpression$1.map.length;no<ro;++no){var oo=CronExpression$1.map[no],io=this.fields[oo],ao=CronExpression$1.constraints[no];oo==="dayOfMonth"&&this.fields.month.length===1?ao={min:1,max:CronExpression$1.daysInMonth[this.fields.month[0]-1]}:oo==="dayOfWeek"&&(ao={min:0,max:6},io=io[io.length-1]===7?io.slice(0,-1):io),eo.push(stringifyField(io,ao.min,ao.max))}return eo.join(" ")};CronExpression$1.parse=function(ue,eo){var no=this;typeof eo=="function"&&(eo={});function ro(oo,io){io||(io={}),typeof io.currentDate>"u"&&(io.currentDate=new CronDate(void 0,no._tz)),CronExpression$1.predefined[oo]&&(oo=CronExpression$1.predefined[oo]);var ao=[],so=(oo+"").trim().split(/\s+/);if(so.length>6)throw new Error("Invalid cron expression");for(var lo=CronExpression$1.map.length-so.length,co=0,uo=CronExpression$1.map.length;co<uo;++co){var fo=CronExpression$1.map[co],po=so[so.length>uo?co:co-lo];if(co<lo||!po)ao.push(CronExpression$1._parseField(fo,CronExpression$1.parseDefaults[co],CronExpression$1.constraints[co]));else{var ho=fo==="dayOfWeek"?vo(po):po;ao.push(CronExpression$1._parseField(fo,ho,CronExpression$1.constraints[co]))}}for(var _o={},co=0,uo=CronExpression$1.map.length;co<uo;co++){var go=CronExpression$1.map[co];_o[go]=ao[co]}var bo=CronExpression$1._handleMaxDaysInMonth(_o);return _o.dayOfMonth=bo||_o.dayOfMonth,new CronExpression$1(_o,io);function vo(yo){var wo=yo.split("#");if(wo.length>1){var ko=+wo[wo.length-1];if(/,/.test(yo))throw new Error("Constraint error, invalid dayOfWeek `#` and `,` special characters are incompatible");if(/\//.test(yo))throw new Error("Constraint error, invalid dayOfWeek `#` and `/` special characters are incompatible");if(/-/.test(yo))throw new Error("Constraint error, invalid dayOfWeek `#` and `-` special characters are incompatible");if(wo.length>2||Number.isNaN(ko)||ko<1||ko>5)throw new Error("Constraint error, invalid dayOfWeek occurrence number (#)");return io.nthDayOfWeek=ko,wo[0]}return yo}}return ro(ue,eo)};CronExpression$1.fieldsToExpression=function(ue,eo){function no(fo,po,ho){if(!po)throw new Error("Validation error, Field "+fo+" is missing");if(po.length===0)throw new Error("Validation error, Field "+fo+" contains no values");for(var _o=0,go=po.length;_o<go;_o++){var bo=po[_o];if(!CronExpression$1._isValidConstraintChar(ho,bo)&&(typeof bo!="number"||Number.isNaN(bo)||bo<ho.min||bo>ho.max))throw new Error("Constraint error, got value "+bo+" expected range "+ho.min+"-"+ho.max)}}for(var ro={},oo=0,io=CronExpression$1.map.length;oo<io;++oo){var ao=CronExpression$1.map[oo],so=ue[ao];no(ao,so,CronExpression$1.constraints[oo]);for(var lo=[],co=-1;++co<so.length;)lo[co]=so[co];if(so=lo.sort(CronExpression$1._sortCompareFn).filter(function(fo,po,ho){return!po||fo!==ho[po-1]}),so.length!==lo.length)throw new Error("Validation error, Field "+ao+" contains duplicate values");ro[ao]=so}var uo=CronExpression$1._handleMaxDaysInMonth(ro);return ro.dayOfMonth=uo||ro.dayOfMonth,new CronExpression$1(ro,eo||{})};var expression=CronExpression$1;const __viteBrowserExternal={},__viteBrowserExternal$1=Object.freeze(Object.defineProperty({__proto__:null,default:__viteBrowserExternal},Symbol.toStringTag,{value:"Module"})),require$$0=getAugmentedNamespace(__viteBrowserExternal$1);var CronExpression=expression;function CronParser(){}CronParser._parseEntry=function(ue){var eo=ue.split(" ");if(eo.length===6)return{interval:CronExpression.parse(ue)};if(eo.length>6)return{interval:CronExpression.parse(eo.slice(0,6).join(" ")),command:eo.slice(6,eo.length)};throw new Error("Invalid entry: "+ue)};CronParser.parseExpression=function(ue,eo){return CronExpression.parse(ue,eo)};CronParser.fieldsToExpression=function(ue,eo){return CronExpression.fieldsToExpression(ue,eo)};CronParser.parseString=function(ue){for(var eo=ue.split(`
|
|
@@ -495,7 +495,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
495
495
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function c(to,ue){if(to){if(typeof to=="string")return d$1(to,ue);var eo=Object.prototype.toString.call(to).slice(8,-1);return eo==="Object"&&to.constructor&&(eo=to.constructor.name),eo==="Map"||eo==="Set"?Array.from(to):eo==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(eo)?d$1(to,ue):void 0}}function d$1(to,ue){(ue==null||ue>to.length)&&(ue=to.length);for(var eo=0,no=new Array(ue);eo<ue;eo++)no[eo]=to[eo];return no}function h(to,ue){var eo=typeof Symbol<"u"&&to[Symbol.iterator]||to["@@iterator"];if(!eo){if(Array.isArray(to)||(eo=c(to))||ue&&to&&typeof to.length=="number"){eo&&(to=eo);var no=0,ro=function(){};return{s:ro,n:function(){return no>=to.length?{done:!0}:{done:!1,value:to[no++]}},e:function(so){throw so},f:ro}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
496
496
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var oo,io=!0,ao=!1;return{s:function(){eo=eo.call(to)},n:function(){var so=eo.next();return io=so.done,so},e:function(so){ao=!0,oo=so},f:function(){try{io||eo.return==null||eo.return()}finally{if(ao)throw oo}}}}var f={DEBUG:!1,LIB_VERSION:"1.160.0"},v=Array.isArray,p$1=Object.prototype,g=p$1.hasOwnProperty,_=p$1.toString,m=v||function(to){return _.call(to)==="[object Array]"},y=function(to){return typeof to=="function"},b=function(to){return to===Object(to)&&!m(to)},k=function(to){if(b(to)){for(var ue in to)if(g.call(to,ue))return!1;return!0}return!1},w$1=function(to){return to===void 0},S=function(to){return _.call(to)=="[object String]"},E=function(to){return S(to)&&to.trim().length===0},I=function(to){return to===null},R=function(to){return w$1(to)||I(to)},F=function(to){return _.call(to)=="[object Number]"},x$1=function(to){return _.call(to)==="[object Boolean]"},P=function(to){return to instanceof FormData},T=typeof window<"u"?window:void 0,C$1=typeof globalThis<"u"?globalThis:T,$=Array.prototype,O=$.forEach,M=$.indexOf,A=C$1==null?void 0:C$1.navigator,L=C$1==null?void 0:C$1.document,D=C$1==null?void 0:C$1.location,q=C$1==null?void 0:C$1.fetch,N=C$1!=null&&C$1.XMLHttpRequest&&"withCredentials"in new C$1.XMLHttpRequest?C$1.XMLHttpRequest:void 0,B=C$1==null?void 0:C$1.AbortController,H=A==null?void 0:A.userAgent,U=T??{},j="[PostHog.js]",G={_log:function(to){if(T&&(f.DEBUG||U.POSTHOG_DEBUG)&&!w$1(T.console)&&T.console){for(var ue=("__rrweb_original__"in T.console[to])?T.console[to].__rrweb_original__:T.console[to],eo=arguments.length,no=new Array(eo>1?eo-1:0),ro=1;ro<eo;ro++)no[ro-1]=arguments[ro];ue.apply(void 0,[j].concat(no))}},info:function(){for(var to=arguments.length,ue=new Array(to),eo=0;eo<to;eo++)ue[eo]=arguments[eo];G._log.apply(G,["log"].concat(ue))},warn:function(){for(var to=arguments.length,ue=new Array(to),eo=0;eo<to;eo++)ue[eo]=arguments[eo];G._log.apply(G,["warn"].concat(ue))},error:function(){for(var to=arguments.length,ue=new Array(to),eo=0;eo<to;eo++)ue[eo]=arguments[eo];G._log.apply(G,["error"].concat(ue))},critical:function(){for(var to,ue=arguments.length,eo=new Array(ue),no=0;no<ue;no++)eo[no]=arguments[no];(to=console).error.apply(to,[j].concat(eo))},uninitializedWarning:function(to){G.error("You must initialize PostHog before calling ".concat(to))}},W={},V=function(to){return to.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};function z(to,ue,eo){if(m(to)){if(O&&to.forEach===O)to.forEach(ue,eo);else if("length"in to&&to.length===+to.length){for(var no=0,ro=to.length;no<ro;no++)if(no in to&&ue.call(eo,to[no],no)===W)return}}}function Q(to,ue,eo){if(!R(to)){if(m(to))return z(to,ue,eo);if(P(to)){var no,ro=h(to.entries());try{for(ro.s();!(no=ro.n()).done;){var oo=no.value;if(ue.call(eo,oo[1],oo[0])===W)return}}catch(ao){ro.e(ao)}finally{ro.f()}}else for(var io in to)if(g.call(to,io)&&ue.call(eo,to[io],io)===W)return}}var J=function(to){for(var ue=arguments.length,eo=new Array(ue>1?ue-1:0),no=1;no<ue;no++)eo[no-1]=arguments[no];return z(eo,function(ro){for(var oo in ro)ro[oo]!==void 0&&(to[oo]=ro[oo])}),to};function Y(to,ue){return to.indexOf(ue)!==-1}function X(to){for(var ue=Object.keys(to),eo=ue.length,no=new Array(eo);eo--;)no[eo]=[ue[eo],to[ue[eo]]];return no}var K=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},Z=function(to){try{return to()}catch{return}},ee=function(to){return function(){try{for(var ue=arguments.length,eo=new Array(ue),no=0;no<ue;no++)eo[no]=arguments[no];return to.apply(this,eo)}catch(ro){G.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),G.critical(ro)}}},te=function(to){var ue={};return Q(to,function(eo,no){S(eo)&&eo.length>0&&(ue[no]=eo)}),ue},ne=function(to){return to.replace(/^\$/,"")};function ie$2(to,ue){return eo=to,no=function(oo){return S(oo)&&!I(ue)?oo.slice(0,ue):oo},ro=new Set,function oo(io,ao){return io!==Object(io)?no?no(io,ao):io:ro.has(io)?void 0:(ro.add(io),m(io)?(so=[],z(io,function(lo){so.push(oo(lo))})):(so={},Q(io,function(lo,co){ro.has(lo)||(so[co]=oo(lo,co))})),so);var so}(eo);var eo,no,ro}var re,se=function(to){var ue,eo,no,ro,oo="";for(ue=eo=0,no=(to=(to+"").replace(/\r\n/g,`
|
|
497
497
|
`).replace(/\r/g,`
|
|
498
|
-
`)).length,ro=0;ro<no;ro++){var io=to.charCodeAt(ro),ao=null;io<128?eo++:ao=io>127&&io<2048?String.fromCharCode(io>>6|192,63&io|128):String.fromCharCode(io>>12|224,io>>6&63|128,63&io|128),I(ao)||(eo>ue&&(oo+=to.substring(ue,eo)),oo+=ao,ue=eo=ro+1)}return eo>ue&&(oo+=to.substring(ue,to.length)),oo},oe=function(){function to(ue){return ue&&(ue.preventDefault=to.preventDefault,ue.stopPropagation=to.stopPropagation),ue}return to.preventDefault=function(){this.returnValue=!1},to.stopPropagation=function(){this.cancelBubble=!0},function(ue,eo,no,ro,oo){if(ue)if(ue.addEventListener&&!ro)ue.addEventListener(eo,no,!!oo);else{var io="on"+eo,ao=ue[io];ue[io]=function(so,lo,co){return function(uo){if(uo=uo||to(T==null?void 0:T.event)){var fo,po=!0;y(co)&&(fo=co(uo));var ho=lo.call(so,uo);return fo!==!1&&ho!==!1||(po=!1),po}}}(ue,no,ao)}else G.error("No valid element provided to register_event")}}();function ae(to,ue){for(var eo=0;eo<to.length;eo++)if(ue(to[eo]))return to[eo]}(function(to){to.GZipJS="gzip-js",to.Base64="base64"})(re||(re={}));var le="$people_distinct_id",ce="__alias",de="__timers",he="$autocapture_disabled_server_side",fe="$heatmaps_enabled_server_side",ve="$exception_capture_enabled_server_side",pe="$exception_capture_endpoint_suffix",ge="$web_vitals_enabled_server_side",_e="$session_recording_enabled_server_side",me="$console_log_recording_enabled_server_side",ye="$session_recording_network_payload_capture",be="$session_recording_canvas_recording",ke="$replay_sample_rate",we="$replay_minimum_duration",Se="$sesid",Ee="$session_is_sampled",Ie="$enabled_feature_flags",Re="$early_access_features",Fe="$stored_person_properties",xe="$stored_group_properties",Pe="$surveys",Te="$surveys_activated",Ce="$flag_call_reported",$e="$user_state",Oe="$client_session_props",Me="$capture_rate_limit",Ae="$initial_campaign_params",Le="$initial_referrer_info",De="$initial_person_info",qe="$epp",Ne="__POSTHOG_TOOLBAR__",Be=[le,ce,"__cmpns",de,_e,fe,Se,Ie,$e,Re,xe,Fe,Pe,Ce,Oe,Me,Ae,Le,qe],He="$active_feature_flags",Ue="$override_feature_flags",je="$feature_flag_payloads",Ge=function(to){var ue,eo={},no=h(X(to||{}));try{for(no.s();!(ue=no.n()).done;){var ro=u(ue.value,2),oo=ro[0],io=ro[1];io&&(eo[oo]=io)}}catch(ao){no.e(ao)}finally{no.f()}return eo},We=function(){function to(ue){i$1(this,to),this.instance=ue,this._override_warning=!1,this.featureFlagEventHandlers=[],this.reloadFeatureFlagsQueued=!1,this.reloadFeatureFlagsInAction=!1}return s(to,[{key:"getFlags",value:function(){return Object.keys(this.getFlagVariants())}},{key:"getFlagVariants",value:function(){var ue=this.instance.get_property(Ie),eo=this.instance.get_property(Ue);if(!eo)return ue||{};for(var no=J({},ue),ro=Object.keys(eo),oo=0;oo<ro.length;oo++)no[ro[oo]]=eo[ro[oo]];return this._override_warning||(G.warn(" Overriding feature flags!",{enabledFlags:ue,overriddenFlags:eo,finalFlags:no}),this._override_warning=!0),no}},{key:"getFlagPayloads",value:function(){return this.instance.get_property(je)||{}}},{key:"reloadFeatureFlags",value:function(){this.reloadFeatureFlagsQueued||(this.reloadFeatureFlagsQueued=!0,this._startReloadTimer())}},{key:"setAnonymousDistinctId",value:function(ue){this.$anon_distinct_id=ue}},{key:"setReloadingPaused",value:function(ue){this.reloadFeatureFlagsInAction=ue}},{key:"resetRequestQueue",value:function(){this.reloadFeatureFlagsQueued=!1}},{key:"_startReloadTimer",value:function(){var ue=this;this.reloadFeatureFlagsQueued&&!this.reloadFeatureFlagsInAction&&setTimeout(function(){!ue.reloadFeatureFlagsInAction&&ue.reloadFeatureFlagsQueued&&(ue.reloadFeatureFlagsQueued=!1,ue._reloadFeatureFlagsRequest())},5)}},{key:"_reloadFeatureFlagsRequest",value:function(){var ue=this;if(!this.instance.config.advanced_disable_feature_flags){this.setReloadingPaused(!0);var eo=this.instance.config.token,no=this.instance.get_property(Fe),ro=this.instance.get_property(xe),oo={token:eo,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:no,group_properties:ro,disable_flags:this.instance.config.advanced_disable_feature_flags||void 0};this.instance._send_request({method:"POST",url:this.instance.requestRouter.endpointFor("api","/decide/?v=3"),data:oo,compression:this.instance.config.disable_compression?void 0:re.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:function(io){var ao;ue.setReloadingPaused(!1);var so=!0;io.statusCode===200&&(ue.$anon_distinct_id=void 0,so=!1),ue.receivedFeatureFlags((ao=io.json)!==null&&ao!==void 0?ao:{},so),ue._startReloadTimer()}})}}},{key:"getFeatureFlag",value:function(ue){var eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.instance.decideEndpointWasHit||this.getFlags()&&this.getFlags().length>0){var no,ro=this.getFlagVariants()[ue],oo="".concat(ro),io=this.instance.get_property(Ce)||{};return(eo.send_event||!("send_event"in eo))&&(!(ue in io)||!io[ue].includes(oo))&&(m(io[ue])?io[ue].push(oo):io[ue]=[oo],(no=this.instance.persistence)===null||no===void 0||no.register(o({},Ce,io)),this.instance.capture("$feature_flag_called",{$feature_flag:ue,$feature_flag_response:ro})),ro}G.warn('getFeatureFlag for key "'+ue+`" failed. Feature flags didn't load in time.`)}},{key:"getFeatureFlagPayload",value:function(ue){return this.getFlagPayloads()[ue]}},{key:"isFeatureEnabled",value:function(ue){var eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.instance.decideEndpointWasHit||this.getFlags()&&this.getFlags().length>0)return!!this.getFeatureFlag(ue,eo);G.warn('isFeatureEnabled for key "'+ue+`" failed. Feature flags didn't load in time.`)}},{key:"addFeatureFlagsHandler",value:function(ue){this.featureFlagEventHandlers.push(ue)}},{key:"removeFeatureFlagsHandler",value:function(ue){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(function(eo){return eo!==ue})}},{key:"receivedFeatureFlags",value:function(ue,eo){if(this.instance.persistence){this.instance.decideEndpointWasHit=!0;var no=this.getFlagVariants(),ro=this.getFlagPayloads();(function(oo,io){var ao,so=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},lo=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},co=oo.featureFlags,uo=oo.featureFlagPayloads;if(co)if(m(co)){var fo,po={};if(co)for(var ho=0;ho<co.length;ho++)po[co[ho]]=!0;io&&io.register((o(fo={},He,co),o(fo,Ie,po),fo))}else{var _o=co,go=uo;oo.errorsWhileComputingFlags&&(_o=t$1(t$1({},so),_o),go=t$1(t$1({},lo),go)),io&&io.register((o(ao={},He,Object.keys(Ge(_o))),o(ao,Ie,_o||{}),o(ao,je,go||{}),ao))}})(ue,this.instance.persistence,no,ro),this._fireFeatureFlagsCallbacks(eo)}}},{key:"override",value:function(ue){var eo=arguments.length>1&&arguments[1]!==void 0&&arguments[1];if(!this.instance.__loaded||!this.instance.persistence)return G.uninitializedWarning("posthog.feature_flags.override");if(this._override_warning=eo,ue===!1)this.instance.persistence.unregister(Ue);else if(m(ue)){for(var no={},ro=0;ro<ue.length;ro++)no[ue[ro]]=!0;this.instance.persistence.register(o({},Ue,no))}else this.instance.persistence.register(o({},Ue,ue))}},{key:"onFeatureFlags",value:function(ue){var eo=this;if(this.addFeatureFlagsHandler(ue),this.instance.decideEndpointWasHit){var no=this._prepareFeatureFlagsForCallbacks(),ro=no.flags,oo=no.flagVariants;ue(ro,oo)}return function(){return eo.removeFeatureFlagsHandler(ue)}}},{key:"updateEarlyAccessFeatureEnrollment",value:function(ue,eo){var no,ro,oo=o({},"$feature_enrollment/".concat(ue),eo);this.instance.capture("$feature_enrollment_update",{$feature_flag:ue,$feature_enrollment:eo,$set:oo}),this.setPersonPropertiesForFlags(oo,!1);var io=t$1(t$1({},this.getFlagVariants()),{},o({},ue,eo));(no=this.instance.persistence)===null||no===void 0||no.register((o(ro={},He,Object.keys(Ge(io))),o(ro,Ie,io),ro)),this._fireFeatureFlagsCallbacks()}},{key:"getEarlyAccessFeatures",value:function(ue){var eo=this,no=arguments.length>1&&arguments[1]!==void 0&&arguments[1],ro=this.instance.get_property(Re);if(ro&&!no)return ue(ro);this.instance._send_request({transport:"XHR",url:this.instance.requestRouter.endpointFor("api","/api/early_access_features/?token=".concat(this.instance.config.token)),method:"GET",callback:function(oo){var io;if(oo.json){var ao=oo.json.earlyAccessFeatures;return(io=eo.instance.persistence)===null||io===void 0||io.register(o({},Re,ao)),ue(ao)}}})}},{key:"_prepareFeatureFlagsForCallbacks",value:function(){var ue=this.getFlags(),eo=this.getFlagVariants();return{flags:ue.filter(function(no){return eo[no]}),flagVariants:Object.keys(eo).filter(function(no){return eo[no]}).reduce(function(no,ro){return no[ro]=eo[ro],no},{})}}},{key:"_fireFeatureFlagsCallbacks",value:function(ue){var eo=this._prepareFeatureFlagsForCallbacks(),no=eo.flags,ro=eo.flagVariants;this.featureFlagEventHandlers.forEach(function(oo){return oo(no,ro,{errorsLoading:ue})})}},{key:"setPersonPropertiesForFlags",value:function(ue){var eo=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],no=this.instance.get_property(Fe)||{};this.instance.register(o({},Fe,t$1(t$1({},no),ue))),eo&&this.instance.reloadFeatureFlags()}},{key:"resetPersonPropertiesForFlags",value:function(){this.instance.unregister(Fe)}},{key:"setGroupPropertiesForFlags",value:function(ue){var eo=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],no=this.instance.get_property(xe)||{};Object.keys(no).length!==0&&Object.keys(no).forEach(function(ro){no[ro]=t$1(t$1({},no[ro]),ue[ro]),delete ue[ro]}),this.instance.register(o({},xe,t$1(t$1({},no),ue))),eo&&this.instance.reloadFeatureFlags()}},{key:"resetGroupPropertiesForFlags",value:function(ue){if(ue){var eo=this.instance.get_property(xe)||{};this.instance.register(o({},xe,t$1(t$1({},eo),{},o({},ue,{}))))}else this.instance.unregister(xe)}}]),to}();Math.trunc||(Math.trunc=function(to){return to<0?Math.ceil(to):Math.floor(to)}),Number.isInteger||(Number.isInteger=function(to){return F(to)&&isFinite(to)&&Math.floor(to)===to});var Ve="0123456789abcdef",ze=function(){function to(ue){if(i$1(this,to),this.bytes=ue,ue.length!==16)throw new TypeError("not 128-bit length")}return s(to,[{key:"toString",value:function(){for(var ue="",eo=0;eo<this.bytes.length;eo++)ue=ue+Ve.charAt(this.bytes[eo]>>>4)+Ve.charAt(15&this.bytes[eo]),eo!==3&&eo!==5&&eo!==7&&eo!==9||(ue+="-");if(ue.length!==36)throw new Error("Invalid UUIDv7 was generated");return ue}},{key:"clone",value:function(){return new to(this.bytes.slice(0))}},{key:"equals",value:function(ue){return this.compareTo(ue)===0}},{key:"compareTo",value:function(ue){for(var eo=0;eo<16;eo++){var no=this.bytes[eo]-ue.bytes[eo];if(no!==0)return Math.sign(no)}return 0}}],[{key:"fromFieldsV7",value:function(ue,eo,no,ro){if(!Number.isInteger(ue)||!Number.isInteger(eo)||!Number.isInteger(no)||!Number.isInteger(ro)||ue<0||eo<0||no<0||ro<0||ue>0xffffffffffff||eo>4095||no>1073741823||ro>4294967295)throw new RangeError("invalid field value");var oo=new Uint8Array(16);return oo[0]=ue/Math.pow(2,40),oo[1]=ue/Math.pow(2,32),oo[2]=ue/Math.pow(2,24),oo[3]=ue/Math.pow(2,16),oo[4]=ue/Math.pow(2,8),oo[5]=ue,oo[6]=112|eo>>>8,oo[7]=eo,oo[8]=128|no>>>24,oo[9]=no>>>16,oo[10]=no>>>8,oo[11]=no,oo[12]=ro>>>24,oo[13]=ro>>>16,oo[14]=ro>>>8,oo[15]=ro,new to(oo)}}]),to}(),Qe=function(){function to(){i$1(this,to),o(this,"timestamp",0),o(this,"counter",0),o(this,"random",new Xe)}return s(to,[{key:"generate",value:function(){var ue=this.generateOrAbort();if(w$1(ue)){this.timestamp=0;var eo=this.generateOrAbort();if(w$1(eo))throw new Error("Could not generate UUID after timestamp reset");return eo}return ue}},{key:"generateOrAbort",value:function(){var ue=Date.now();if(ue>this.timestamp)this.timestamp=ue,this.resetCounter();else{if(!(ue+1e4>this.timestamp))return;this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter())}return ze.fromFieldsV7(this.timestamp,Math.trunc(this.counter/Math.pow(2,30)),this.counter&Math.pow(2,30)-1,this.random.nextUint32())}},{key:"resetCounter",value:function(){this.counter=1024*this.random.nextUint32()+(1023&this.random.nextUint32())}}]),to}(),Je=function(to){if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var ue=0;ue<to.length;ue++)to[ue]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return to};T&&!w$1(T.crypto)&&crypto.getRandomValues&&(Je=function(to){return crypto.getRandomValues(to)});var Ye,Xe=function(){function to(){i$1(this,to),o(this,"buffer",new Uint32Array(8)),o(this,"cursor",1/0)}return s(to,[{key:"nextUint32",value:function(){return this.cursor>=this.buffer.length&&(Je(this.buffer),this.cursor=0),this.buffer[this.cursor++]}}]),to}(),Ke=function(){return Ze().toString()},Ze=function(){return(Ye||(Ye=new Qe)).generate()},et="Thu, 01 Jan 1970 00:00:00 GMT",tt="",nt=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function it(to,ue){if(ue){var eo=function(ro){var oo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:L;if(tt)return tt;if(!oo||["localhost","127.0.0.1"].includes(ro))return"";for(var io=ro.split("."),ao=Math.min(io.length,8),so="dmn_chk_"+Ke(),lo=new RegExp("(^|;)\\s*"+so+"=1");!tt&&ao--;){var co=io.slice(ao).join("."),uo=so+"=1;domain=."+co;oo.cookie=uo,lo.test(oo.cookie)&&(oo.cookie=uo+";expires="+et,tt=co)}return tt}(to);if(!eo){var no=function(ro){var oo=ro.match(nt);return oo?oo[0]:""}(to);no!==eo&&G.info("Warning: cookie subdomain discovery mismatch",no,eo),eo=no}return eo?"; domain=."+eo:""}return""}var rt,st={is_supported:function(){return!!L},error:function(to){G.error("cookieStore error: "+to)},get:function(to){if(L){try{for(var ue=to+"=",eo=L.cookie.split(";").filter(function(oo){return oo.length}),no=0;no<eo.length;no++){for(var ro=eo[no];ro.charAt(0)==" ";)ro=ro.substring(1,ro.length);if(ro.indexOf(ue)===0)return decodeURIComponent(ro.substring(ue.length,ro.length))}}catch{}return null}},parse:function(to){var ue;try{ue=JSON.parse(st.get(to))||{}}catch{}return ue},set:function(to,ue,eo,no,ro){if(L)try{var oo="",io="",ao=it(L.location.hostname,no);if(eo){var so=new Date;so.setTime(so.getTime()+24*eo*60*60*1e3),oo="; expires="+so.toUTCString()}ro&&(io="; secure");var lo=to+"="+encodeURIComponent(JSON.stringify(ue))+oo+"; SameSite=Lax; path=/"+ao+io;return lo.length>3686.4&&G.warn("cookieStore warning: large cookie, len="+lo.length),L.cookie=lo,lo}catch{return}},remove:function(to,ue){try{st.set(to,"",-1,ue)}catch{return}}},ot=null,at={is_supported:function(){if(!I(ot))return ot;var to=!0;if(w$1(T))to=!1;else try{var ue="__mplssupport__";at.set(ue,"xyz"),at.get(ue)!=='"xyz"'&&(to=!1),at.remove(ue)}catch{to=!1}return to||G.error("localStorage unsupported; falling back to cookie store"),ot=to,to},error:function(to){G.error("localStorage error: "+to)},get:function(to){try{return T==null?void 0:T.localStorage.getItem(to)}catch(ue){at.error(ue)}return null},parse:function(to){try{return JSON.parse(at.get(to))||{}}catch{}return null},set:function(to,ue){try{T==null||T.localStorage.setItem(to,JSON.stringify(ue))}catch(eo){at.error(eo)}},remove:function(to){try{T==null||T.localStorage.removeItem(to)}catch(ue){at.error(ue)}}},ut=["distinct_id",Se,Ee,qe],lt=t$1(t$1({},at),{},{parse:function(to){try{var ue={};try{ue=st.parse(to)||{}}catch{}var eo=J(ue,JSON.parse(at.get(to)||"{}"));return at.set(to,eo),eo}catch{}return null},set:function(to,ue,eo,no,ro,oo){try{at.set(to,ue,void 0,void 0,oo);var io={};ut.forEach(function(ao){ue[ao]&&(io[ao]=ue[ao])}),Object.keys(io).length&&st.set(to,io,eo,no,ro,oo)}catch(ao){at.error(ao)}},remove:function(to,ue){try{T==null||T.localStorage.removeItem(to),st.remove(to,ue)}catch(eo){at.error(eo)}}}),ct={},dt={is_supported:function(){return!0},error:function(to){G.error("memoryStorage error: "+to)},get:function(to){return ct[to]||null},parse:function(to){return ct[to]||null},set:function(to,ue){ct[to]=ue},remove:function(to){delete ct[to]}},ht=null,ft={is_supported:function(){if(!I(ht))return ht;if(ht=!0,w$1(T))ht=!1;else try{var to="__support__";ft.set(to,"xyz"),ft.get(to)!=='"xyz"'&&(ht=!1),ft.remove(to)}catch{ht=!1}return ht},error:function(to){G.error("sessionStorage error: ",to)},get:function(to){try{return T==null?void 0:T.sessionStorage.getItem(to)}catch(ue){ft.error(ue)}return null},parse:function(to){try{return JSON.parse(ft.get(to))||null}catch{}return null},set:function(to,ue){try{T==null||T.sessionStorage.setItem(to,JSON.stringify(ue))}catch(eo){ft.error(eo)}},remove:function(to){try{T==null||T.sessionStorage.removeItem(to)}catch(ue){ft.error(ue)}}},vt=["localhost","127.0.0.1"],pt=function(to){var ue=L==null?void 0:L.createElement("a");return w$1(ue)?null:(ue.href=to,ue)},gt=function(to,ue){return!!function(eo){try{new RegExp(eo)}catch{return!1}return!0}(ue)&&new RegExp(ue).test(to)},_t=function(to){var ue,eo,no=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"&",ro=[];return Q(to,function(oo,io){w$1(oo)||w$1(io)||io==="undefined"||(ue=encodeURIComponent(function(ao){return ao instanceof File}(oo)?oo.name:oo.toString()),eo=encodeURIComponent(io),ro[ro.length]=eo+"="+ue)}),ro.join(no)},mt=function(to,ue){for(var eo,no=((to.split("#")[0]||"").split("?")[1]||"").split("&"),ro=0;ro<no.length;ro++){var oo=no[ro].split("=");if(oo[0]===ue){eo=oo;break}}if(!m(eo)||eo.length<2)return"";var io=eo[1];try{io=decodeURIComponent(io)}catch{G.error("Skipping decoding for malformed query param: "+io)}return io.replace(/\+/g," ")},yt=function(to,ue){var eo=to.match(new RegExp(ue+"=([^&]*)"));return eo?eo[1]:null},bt="Mobile",kt="iOS",wt="Android",St="Tablet",Et=wt+" "+St,It="iPad",Rt="Apple",Ft=Rt+" Watch",xt="Safari",Pt="BlackBerry",Tt="Samsung",Ct=Tt+"Browser",$t=Tt+" Internet",Ot="Chrome",Mt=Ot+" OS",At=Ot+" "+kt,Lt="Internet Explorer",Dt=Lt+" "+bt,qt="Opera",Nt=qt+" Mini",Bt="Edge",Ht="Microsoft "+Bt,Ut="Firefox",jt=Ut+" "+kt,Gt="Nintendo",Wt="PlayStation",Vt="Xbox",zt=wt+" "+bt,Qt=bt+" "+xt,Jt="Windows",Yt=Jt+" Phone",Xt="Nokia",Kt="Ouya",Zt="Generic",en=Zt+" "+bt.toLowerCase(),tn=Zt+" "+St.toLowerCase(),nn="Konqueror",rn="(\\d+(\\.\\d+)?)",sn=new RegExp("Version/"+rn),on=new RegExp(Vt,"i"),an=new RegExp(Wt+" \\w+","i"),un=new RegExp(Gt+" \\w+","i"),ln=new RegExp(Pt+"|PlayBook|BB10","i"),cn={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},dn=function(to,ue){return ue&&Y(ue,Rt)||function(eo){return Y(eo,xt)&&!Y(eo,Ot)&&!Y(eo,wt)}(to)},hn=function(to,ue){return ue=ue||"",Y(to," OPR/")&&Y(to,"Mini")?Nt:Y(to," OPR/")?qt:ln.test(to)?Pt:Y(to,"IE"+bt)||Y(to,"WPDesktop")?Dt:Y(to,Ct)?$t:Y(to,Bt)||Y(to,"Edg/")?Ht:Y(to,"FBIOS")?"Facebook "+bt:Y(to,"UCWEB")||Y(to,"UCBrowser")?"UC Browser":Y(to,"CriOS")?At:Y(to,"CrMo")?Ot:Y(to,wt)&&Y(to,xt)?zt:Y(to,Ot)?Ot:Y(to,"FxiOS")?jt:Y(to.toLowerCase(),nn.toLowerCase())?nn:dn(to,ue)?Y(to,bt)?Qt:xt:Y(to,Ut)?Ut:Y(to,"MSIE")||Y(to,"Trident/")?Lt:Y(to,"Gecko")?Ut:""},fn=(o(rt={},Dt,[new RegExp("rv:"+rn)]),o(rt,Ht,[new RegExp(Bt+"?\\/"+rn)]),o(rt,Ot,[new RegExp("("+Ot+"|CrMo)\\/"+rn)]),o(rt,At,[new RegExp("CriOS\\/"+rn)]),o(rt,"UC Browser",[new RegExp("(UCBrowser|UCWEB)\\/"+rn)]),o(rt,xt,[sn]),o(rt,Qt,[sn]),o(rt,qt,[new RegExp("(Opera|OPR)\\/"+rn)]),o(rt,Ut,[new RegExp(Ut+"\\/"+rn)]),o(rt,jt,[new RegExp("FxiOS\\/"+rn)]),o(rt,nn,[new RegExp("Konqueror[:/]?"+rn,"i")]),o(rt,Pt,[new RegExp(Pt+" "+rn),sn]),o(rt,zt,[new RegExp("android\\s"+rn,"i")]),o(rt,$t,[new RegExp(Ct+"\\/"+rn)]),o(rt,Lt,[new RegExp("(rv:|MSIE )"+rn)]),o(rt,"Mozilla",[new RegExp("rv:"+rn)]),rt),vn=[[new RegExp(Vt+"; "+Vt+" (.*?)[);]","i"),function(to){return[Vt,to&&to[1]||""]}],[new RegExp(Gt,"i"),[Gt,""]],[new RegExp(Wt,"i"),[Wt,""]],[ln,[Pt,""]],[new RegExp(Jt,"i"),function(to,ue){if(/Phone/.test(ue)||/WPDesktop/.test(ue))return[Yt,""];if(new RegExp(bt).test(ue)&&!/IEMobile\b/.test(ue))return[Jt+" "+bt,""];var eo=/Windows NT ([0-9.]+)/i.exec(ue);if(eo&&eo[1]){var no=eo[1],ro=cn[no]||"";return/arm/i.test(ue)&&(ro="RT"),[Jt,ro]}return[Jt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,function(to){if(to&&to[3]){var ue=[to[3],to[4],to[5]||"0"];return[kt,ue.join(".")]}return[kt,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,function(to){var ue="";return to&&to.length>=3&&(ue=w$1(to[2])?to[3]:to[2]),["watchOS",ue]}],[new RegExp("("+wt+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+wt+")","i"),function(to){if(to&&to[2]){var ue=[to[2],to[3],to[4]||"0"];return[wt,ue.join(".")]}return[wt,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,function(to){var ue=["Mac OS X",""];if(to&&to[1]){var eo=[to[1],to[2],to[3]||"0"];ue[1]=eo.join(".")}return ue}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Mt,""]],[/Linux|debian/i,["Linux",""]]],pn=function(to){return un.test(to)?Gt:an.test(to)?Wt:on.test(to)?Vt:new RegExp(Kt,"i").test(to)?Kt:new RegExp("("+Yt+"|WPDesktop)","i").test(to)?Yt:/iPad/.test(to)?It:/iPod/.test(to)?"iPod Touch":/iPhone/.test(to)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(to)?Ft:ln.test(to)?Pt:/(kobo)\s(ereader|touch)/i.test(to)?"Kobo":new RegExp(Xt,"i").test(to)?Xt:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(to)||/(kf[a-z]+)( bui|\)).+silk\//i.test(to)?"Kindle Fire":/(Android|ZTE)/i.test(to)?!new RegExp(bt).test(to)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(to)?/pixel[\daxl ]{1,6}/i.test(to)&&!/pixel c/i.test(to)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(to)||/lmy47v/i.test(to)&&!/QTAQZ3/i.test(to)?wt:Et:wt:new RegExp("(pda|"+bt+")","i").test(to)?en:new RegExp(St,"i").test(to)&&!new RegExp(St+" pc","i").test(to)?tn:""},gn="https?://(.*)",_n=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gclid","gad_source","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","mc_cid","igshid","ttclid","rdt_cid"],mn={campaignParams:function(to){return L?this._campaignParamsFromUrl(L.URL,to):{}},_campaignParamsFromUrl:function(to,ue){var eo=_n.concat(ue||[]),no={};return Q(eo,function(ro){var oo=mt(to,ro);oo&&(no[ro]=oo)}),no},_searchEngine:function(to){return to?to.search(gn+"google.([^/?]*)")===0?"google":to.search(gn+"bing.com")===0?"bing":to.search(gn+"yahoo.com")===0?"yahoo":to.search(gn+"duckduckgo.com")===0?"duckduckgo":null:null},_searchInfoFromReferrer:function(to){var ue=mn._searchEngine(to),eo=ue!="yahoo"?"q":"p",no={};if(!I(ue)){no.$search_engine=ue;var ro=L?mt(L.referrer,eo):"";ro.length&&(no.ph_keyword=ro)}return no},searchInfo:function(){var to=L==null?void 0:L.referrer;return to?this._searchInfoFromReferrer(to):{}},browser:hn,browserVersion:function(to,ue){var eo=hn(to,ue),no=fn[eo];if(w$1(no))return null;for(var ro=0;ro<no.length;ro++){var oo=no[ro],io=to.match(oo);if(io)return parseFloat(io[io.length-2])}return null},browserLanguage:function(){return navigator.language||navigator.userLanguage},os:function(to){for(var ue=0;ue<vn.length;ue++){var eo=u(vn[ue],2),no=eo[0],ro=eo[1],oo=no.exec(to),io=oo&&(y(ro)?ro(oo,to):ro);if(io)return io}return["",""]},device:pn,deviceType:function(to){var ue=pn(to);return ue===It||ue===Et||ue==="Kobo"||ue==="Kindle Fire"||ue===tn?St:ue===Gt||ue===Vt||ue===Wt||ue===Kt?"Console":ue===Ft?"Wearable":ue?bt:"Desktop"},referrer:function(){return(L==null?void 0:L.referrer)||"$direct"},referringDomain:function(){var to;return L!=null&&L.referrer&&((to=pt(L.referrer))===null||to===void 0?void 0:to.host)||"$direct"},referrerInfo:function(){return{$referrer:this.referrer(),$referring_domain:this.referringDomain()}},initialPersonInfo:function(){return{r:this.referrer(),u:D==null?void 0:D.href}},initialPersonPropsFromInfo:function(to){var ue,eo=to.r,no=to.u,ro={$initial_referrer:eo,$initial_referring_domain:eo==null?void 0:eo=="$direct"?"$direct":(ue=pt(eo))===null||ue===void 0?void 0:ue.host};if(no){ro.$initial_current_url=no;var oo=pt(no);ro.$initial_host=oo==null?void 0:oo.host,ro.$initial_pathname=oo==null?void 0:oo.pathname,Q(this._campaignParamsFromUrl(no),function(io,ao){ro["$initial_"+ne(ao)]=io})}return eo&&Q(this._searchInfoFromReferrer(eo),function(io,ao){ro["$initial_"+ne(ao)]=io}),ro},properties:function(){if(!H)return{};var to=u(mn.os(H),2),ue=to[0],eo=to[1];return J(te({$os:ue,$os_version:eo,$browser:mn.browser(H,navigator.vendor),$device:mn.device(H),$device_type:mn.deviceType(H)}),{$current_url:D==null?void 0:D.href,$host:D==null?void 0:D.host,$pathname:D==null?void 0:D.pathname,$raw_user_agent:H.length>1e3?H.substring(0,997)+"...":H,$browser_version:mn.browserVersion(H,navigator.vendor),$browser_language:mn.browserLanguage(),$screen_height:T==null?void 0:T.screen.height,$screen_width:T==null?void 0:T.screen.width,$viewport_height:T==null?void 0:T.innerHeight,$viewport_width:T==null?void 0:T.innerWidth,$lib:"web",$lib_version:f.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:K()/1e3})},people_properties:function(){if(!H)return{};var to=u(mn.os(H),2),ue=to[0],eo=to[1];return J(te({$os:ue,$os_version:eo,$browser:mn.browser(H,navigator.vendor)}),{$browser_version:mn.browserVersion(H,navigator.vendor)})}},yn=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],bn=function(){function to(ue){i$1(this,to),this.config=ue,this.props={},this.campaign_params_saved=!1,this.name=function(eo){var no="";return eo.token&&(no=eo.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),eo.persistence_name?"ph_"+eo.persistence_name:"ph_"+no+"_posthog"}(ue),this.storage=this.buildStorage(ue),this.load(),ue.debug&&G.info("Persistence loaded",ue.persistence,t$1({},this.props)),this.update_config(ue,ue),this.save()}return s(to,[{key:"buildStorage",value:function(ue){yn.indexOf(ue.persistence.toLowerCase())===-1&&(G.critical("Unknown persistence type "+ue.persistence+"; falling back to localStorage+cookie"),ue.persistence="localStorage+cookie");var eo=ue.persistence.toLowerCase();return eo==="localstorage"&&at.is_supported()?at:eo==="localstorage+cookie"&<.is_supported()?lt:eo==="sessionstorage"&&ft.is_supported()?ft:eo==="memory"?dt:eo==="cookie"?st:lt.is_supported()?lt:st}},{key:"properties",value:function(){var ue={};return Q(this.props,function(eo,no){if(no===Ie&&b(eo))for(var ro=Object.keys(eo),oo=0;oo<ro.length;oo++)ue["$feature/".concat(ro[oo])]=eo[ro[oo]];else ao=no,so=!1,(I(io=Be)?so:M&&io.indexOf===M?io.indexOf(ao)!=-1:(Q(io,function(lo){if(so||(so=lo===ao))return W}),so))||(ue[no]=eo);var io,ao,so}),ue}},{key:"load",value:function(){if(!this.disabled){var ue=this.storage.parse(this.name);ue&&(this.props=J({},ue))}}},{key:"save",value:function(){this.disabled||this.storage.set(this.name,this.props,this.expire_days,this.cross_subdomain,this.secure,this.config.debug)}},{key:"remove",value:function(){this.storage.remove(this.name,!1),this.storage.remove(this.name,!0)}},{key:"clear",value:function(){this.remove(),this.props={}}},{key:"register_once",value:function(ue,eo,no){var ro=this;if(b(ue)){w$1(eo)&&(eo="None"),this.expire_days=w$1(no)?this.default_expiry:no;var oo=!1;if(Q(ue,function(io,ao){ro.props.hasOwnProperty(ao)&&ro.props[ao]!==eo||(ro.props[ao]=io,oo=!0)}),oo)return this.save(),!0}return!1}},{key:"register",value:function(ue,eo){var no=this;if(b(ue)){this.expire_days=w$1(eo)?this.default_expiry:eo;var ro=!1;if(Q(ue,function(oo,io){ue.hasOwnProperty(io)&&no.props[io]!==oo&&(no.props[io]=oo,ro=!0)}),ro)return this.save(),!0}return!1}},{key:"unregister",value:function(ue){ue in this.props&&(delete this.props[ue],this.save())}},{key:"update_campaign_params",value:function(){this.campaign_params_saved||(this.register(mn.campaignParams(this.config.custom_campaign_params)),this.campaign_params_saved=!0)}},{key:"update_search_keyword",value:function(){this.register(mn.searchInfo())}},{key:"update_referrer_info",value:function(){this.register_once(mn.referrerInfo(),void 0)}},{key:"set_initial_person_info",value:function(){this.props[Ae]||this.props[Le]||this.register_once(o({},De,mn.initialPersonInfo()),void 0)}},{key:"get_referrer_info",value:function(){return te({$referrer:this.props.$referrer,$referring_domain:this.props.$referring_domain})}},{key:"get_initial_props",value:function(){var ue=this,eo={};Q([Le,Ae],function(oo){var io=ue.props[oo];io&&Q(io,function(ao,so){eo["$initial_"+ne(so)]=ao})});var no=this.props[De];if(no){var ro=mn.initialPersonPropsFromInfo(no);J(eo,ro)}return eo}},{key:"safe_merge",value:function(ue){return Q(this.props,function(eo,no){no in ue||(ue[no]=eo)}),ue}},{key:"update_config",value:function(ue,eo){if(this.default_expiry=this.expire_days=ue.cookie_expiration,this.set_disabled(ue.disable_persistence),this.set_cross_subdomain(ue.cross_subdomain_cookie),this.set_secure(ue.secure_cookie),ue.persistence!==eo.persistence){var no=this.buildStorage(ue),ro=this.props;this.clear(),this.storage=no,this.props=ro,this.save()}}},{key:"set_disabled",value:function(ue){this.disabled=ue,this.disabled?this.remove():this.save()}},{key:"set_cross_subdomain",value:function(ue){ue!==this.cross_subdomain&&(this.cross_subdomain=ue,this.remove(),this.save())}},{key:"get_cross_subdomain",value:function(){return!!this.cross_subdomain}},{key:"set_secure",value:function(ue){ue!==this.secure&&(this.secure=ue,this.remove(),this.save())}},{key:"set_event_timer",value:function(ue,eo){var no=this.props[de]||{};no[ue]=eo,this.props[de]=no,this.save()}},{key:"remove_event_timer",value:function(ue){var eo=(this.props[de]||{})[ue];return w$1(eo)||(delete this.props[de][ue],this.save()),eo}},{key:"get_property",value:function(ue){return this.props[ue]}},{key:"set_property",value:function(ue,eo){this.props[ue]=eo,this.save()}}]),to}();function kn(to){return JSON.stringify(to,(ue=[],function(eo,no){if(b(no)){for(;ue.length>0&&ue.at(-1)!==this;)ue.pop();return ue.includes(no)?"[Circular]":(ue.push(no),no)}return no})).length;var ue}var wn=2,Sn=4;function En(to){var ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:66060288e-1;if(to.size>=ue&&to.data.length>1){var eo=Math.floor(to.data.length/2),no=to.data.slice(0,eo),ro=to.data.slice(eo);return[En({size:kn(no),data:no,sessionId:to.sessionId,windowId:to.windowId}),En({size:kn(ro),data:ro,sessionId:to.sessionId,windowId:to.windowId})].flatMap(function(oo){return oo})}return[to]}var In=function(to){return to[to.DomContentLoaded=0]="DomContentLoaded",to[to.Load=1]="Load",to[to.FullSnapshot=2]="FullSnapshot",to[to.IncrementalSnapshot=3]="IncrementalSnapshot",to[to.Meta=4]="Meta",to[to.Custom=5]="Custom",to[to.Plugin=6]="Plugin",to}(In||{}),Rn=function(to){return to[to.Mutation=0]="Mutation",to[to.MouseMove=1]="MouseMove",to[to.MouseInteraction=2]="MouseInteraction",to[to.Scroll=3]="Scroll",to[to.ViewportResize=4]="ViewportResize",to[to.Input=5]="Input",to[to.TouchMove=6]="TouchMove",to[to.MediaInteraction=7]="MediaInteraction",to[to.StyleSheetRule=8]="StyleSheetRule",to[to.CanvasMutation=9]="CanvasMutation",to[to.Font=10]="Font",to[to.Log=11]="Log",to[to.Drag=12]="Drag",to[to.StyleDeclaration=13]="StyleDeclaration",to[to.Selection=14]="Selection",to[to.AdoptedStyleSheet=15]="AdoptedStyleSheet",to[to.CustomElement=16]="CustomElement",to}(Rn||{});function Fn(to){return to?V(to).split(/\s+/):[]}function xn(to){var ue=T==null?void 0:T.location.href;return!!(ue&&to&&to.some(function(eo){return ue.match(eo)}))}function Pn(to){var ue="";switch(n(to.className)){case"string":ue=to.className;break;case"object":ue=(to.className&&"baseVal"in to.className?to.className.baseVal:null)||to.getAttribute("class")||"";break;default:ue=""}return Fn(ue)}function Tn(to){return R(to)?null:V(to).split(/(\s+)/).filter(function(ue){return zn(ue)}).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Cn(to){var ue="";return Nn(to)&&!Bn(to)&&to.childNodes&&to.childNodes.length&&Q(to.childNodes,function(eo){var no;Mn(eo)&&eo.textContent&&(ue+=(no=Tn(eo.textContent))!==null&&no!==void 0?no:"")}),V(ue)}function $n(to){return!!to&&to.nodeType===1}function On(to,ue){return!!to&&!!to.tagName&&to.tagName.toLowerCase()===ue.toLowerCase()}function Mn(to){return!!to&&to.nodeType===3}function An(to){return!!to&&to.nodeType===11}var Ln=["a","button","form","input","select","textarea","label"];function Dn(to){var ue=to.parentNode;return!(!ue||!$n(ue))&&ue}function qn(to,ue){var eo=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,no=arguments.length>3?arguments[3]:void 0,ro=arguments.length>4?arguments[4]:void 0;if(!T||!to||On(to,"html")||!$n(to)||eo!=null&&eo.url_allowlist&&!xn(eo.url_allowlist)||eo!=null&&eo.url_ignorelist&&xn(eo.url_ignorelist))return!1;if(eo!=null&&eo.dom_event_allowlist){var oo=eo.dom_event_allowlist;if(oo&&!oo.some(function(po){return ue.type===po}))return!1}for(var io=!1,ao=[to],so=!0,lo=to;lo.parentNode&&!On(lo,"body");)if(An(lo.parentNode))ao.push(lo.parentNode.host),lo=lo.parentNode.host;else{if(!(so=Dn(lo)))break;if(no||Ln.indexOf(so.tagName.toLowerCase())>-1)io=!0;else{var co=T.getComputedStyle(so);co&&co.getPropertyValue("cursor")==="pointer"&&(io=!0)}ao.push(so),lo=so}if(!function(po,ho){var _o=ho==null?void 0:ho.element_allowlist;if(w$1(_o))return!0;var go,bo=h(po);try{var vo=function(){var wo=go.value;if(_o.some(function(ko){return wo.tagName.toLowerCase()===ko}))return{v:!0}};for(bo.s();!(go=bo.n()).done;){var yo=vo();if(n(yo)==="object")return yo.v}}catch(wo){bo.e(wo)}finally{bo.f()}return!1}(ao,eo)||!function(po,ho){var _o=ho==null?void 0:ho.css_selector_allowlist;if(w$1(_o))return!0;var go,bo=h(po);try{var vo=function(){var wo=go.value;if(_o.some(function(ko){return wo.matches(ko)}))return{v:!0}};for(bo.s();!(go=bo.n()).done;){var yo=vo();if(n(yo)==="object")return yo.v}}catch(wo){bo.e(wo)}finally{bo.f()}return!1}(ao,eo))return!1;var uo=T.getComputedStyle(to);if(uo&&uo.getPropertyValue("cursor")==="pointer"&&ue.type==="click")return!0;var fo=to.tagName.toLowerCase();switch(fo){case"html":return!1;case"form":return(ro||["submit"]).indexOf(ue.type)>=0;case"input":case"select":case"textarea":return(ro||["change","click"]).indexOf(ue.type)>=0;default:return io?(ro||["click"]).indexOf(ue.type)>=0:(ro||["click"]).indexOf(ue.type)>=0&&(Ln.indexOf(fo)>-1||to.getAttribute("contenteditable")==="true")}}function Nn(to){for(var ue=to;ue.parentNode&&!On(ue,"body");ue=ue.parentNode){var eo=Pn(ue);if(Y(eo,"ph-sensitive")||Y(eo,"ph-no-capture"))return!1}if(Y(Pn(to),"ph-include"))return!0;var no=to.type||"";if(S(no))switch(no.toLowerCase()){case"hidden":case"password":return!1}var ro=to.name||to.id||"";return!(S(ro)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(ro.replace(/[^a-zA-Z0-9]/g,"")))}function Bn(to){return!!(On(to,"input")&&!["button","checkbox","submit","reset"].includes(to.type)||On(to,"select")||On(to,"textarea")||to.getAttribute("contenteditable")==="true")}var Hn="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",Un=new RegExp("^(?:".concat(Hn,")$")),jn=new RegExp(Hn),Gn="\\d{3}-?\\d{2}-?\\d{4}",Wn=new RegExp("^(".concat(Gn,")$")),Vn=new RegExp("(".concat(Gn,")"));function zn(to){var ue=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];return!(R(to)||S(to)&&(to=V(to),(ue?Un:jn).test((to||"").replace(/[- ]/g,""))||(ue?Wn:Vn).test(to)))}function Qn(to){var ue=Cn(to);return zn(ue="".concat(ue," ").concat(Jn(to)).trim())?ue:""}function Jn(to){var ue="";return to&&to.childNodes&&to.childNodes.length&&Q(to.childNodes,function(eo){var no;if(eo&&((no=eo.tagName)===null||no===void 0?void 0:no.toLowerCase())==="span")try{var ro=Cn(eo);ue="".concat(ue," ").concat(ro).trim(),eo.childNodes&&eo.childNodes.length&&(ue="".concat(ue," ").concat(Jn(eo)).trim())}catch(oo){G.error(oo)}}),ue}function Yn(to){return function(ue){var eo=ue.map(function(no){var ro,oo,io="";if(no.tag_name&&(io+=no.tag_name),no.attr_class){no.attr_class.sort();var ao,so=h(no.attr_class);try{for(so.s();!(ao=so.n()).done;){var lo=ao.value;io+=".".concat(lo.replace(/"/g,""))}}catch(fo){so.e(fo)}finally{so.f()}}var co=t$1(t$1(t$1(t$1({},no.text?{text:no.text}:{}),{},{"nth-child":(ro=no.nth_child)!==null&&ro!==void 0?ro:0,"nth-of-type":(oo=no.nth_of_type)!==null&&oo!==void 0?oo:0},no.href?{href:no.href}:{}),no.attr_id?{attr_id:no.attr_id}:{}),no.attributes),uo={};return X(co).sort(function(fo,po){var ho=u(fo,1)[0],_o=u(po,1)[0];return ho.localeCompare(_o)}).forEach(function(fo){var po=u(fo,2),ho=po[0],_o=po[1];return uo[Xn(ho.toString())]=Xn(_o.toString())}),io+=":",io+=X(co).map(function(fo){var po=u(fo,2),ho=po[0],_o=po[1];return"".concat(ho,'="').concat(_o,'"')}).join("")});return eo.join(";")}(function(ue){return ue.map(function(eo){var no,ro,oo={text:(no=eo.$el_text)===null||no===void 0?void 0:no.slice(0,400),tag_name:eo.tag_name,href:(ro=eo.attr__href)===null||ro===void 0?void 0:ro.slice(0,2048),attr_class:Kn(eo),attr_id:eo.attr__id,nth_child:eo.nth_child,nth_of_type:eo.nth_of_type,attributes:{}};return X(eo).filter(function(io){return u(io,1)[0].indexOf("attr__")===0}).forEach(function(io){var ao=u(io,2),so=ao[0],lo=ao[1];return oo.attributes[so]=lo}),oo})}(to))}function Xn(to){return to.replace(/"|\\"/g,'\\"')}function Kn(to){var ue=to.attr__class;return ue?m(ue)?ue:Fn(ue):void 0}var Zn="[SessionRecording]",ei="redacted",ti={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:function(to){return to},recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:1e6,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io"]},ni=["authorization","x-forwarded-for","authorization","cookie","set-cookie","x-api-key","x-real-ip","remote-addr","forwarded","proxy-authorization","x-csrf-token","x-csrftoken","x-xsrf-token"],ii=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],ri=["/s/","/e/","/i/"];function si(to,ue,eo,no){if(R(to))return to;var ro=(ue==null?void 0:ue["content-length"])||function(oo){return new Blob([oo]).size}(to);return S(ro)&&(ro=parseInt(ro)),ro>eo?Zn+" ".concat(no," body too large to record (").concat(ro," bytes)"):to}function oi(to,ue){if(R(to))return to;var eo=to;return zn(eo,!1)||(eo=Zn+" "+ue+" body "+ei),Q(ii,function(no){var ro,oo;(ro=eo)!==null&&ro!==void 0&&ro.length&&((oo=eo)===null||oo===void 0?void 0:oo.indexOf(no))!==-1&&(eo=Zn+" "+ue+" body "+ei+" as might contain: "+no)}),eo}var ai,ui=function(to,ue){var eo,no,ro,oo={payloadSizeLimitBytes:ti.payloadSizeLimitBytes,performanceEntryTypeToObserve:l(ti.performanceEntryTypeToObserve),payloadHostDenyList:[].concat(l(ue.payloadHostDenyList||[]),l(ti.payloadHostDenyList))},io=to.session_recording.recordHeaders!==!1&&ue.recordHeaders,ao=to.session_recording.recordBody!==!1&&ue.recordBody,so=to.capture_performance!==!1&&ue.recordPerformance,lo=(eo=oo,ro=Math.min(1e6,(no=eo.payloadSizeLimitBytes)!==null&&no!==void 0?no:1e6),function(fo){return fo!=null&&fo.requestBody&&(fo.requestBody=si(fo.requestBody,fo.requestHeaders,ro,"Request")),fo!=null&&fo.responseBody&&(fo.responseBody=si(fo.responseBody,fo.responseHeaders,ro,"Response")),fo}),co=function(fo){return lo(function(_o){var go=pt(_o.name);if(!(go&&go.pathname&&ri.some(function(bo){return go.pathname.indexOf(bo)===0})))return _o}((ho=(po=fo).requestHeaders,R(ho)||Q(Object.keys(ho??{}),function(_o){ni.includes(_o.toLowerCase())&&(ho[_o]=ei)}),po)));var po,ho},uo=y(to.session_recording.maskNetworkRequestFn);return uo&&y(to.session_recording.maskCapturedNetworkRequestFn)&&G.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),uo&&(to.session_recording.maskCapturedNetworkRequestFn=function(fo){var po=to.session_recording.maskNetworkRequestFn({url:fo.name});return t$1(t$1({},fo),{},{name:po==null?void 0:po.url})}),oo.maskRequestFn=y(to.session_recording.maskCapturedNetworkRequestFn)?function(fo){var po,ho,_o,go=co(fo);return go&&(po=(ho=(_o=to.session_recording).maskCapturedNetworkRequestFn)===null||ho===void 0?void 0:ho.call(_o,go))!==null&&po!==void 0?po:void 0}:function(fo){return function(po){if(!w$1(po))return po.requestBody=oi(po.requestBody,"Request"),po.responseBody=oi(po.responseBody,"Response"),po}(co(fo))},t$1(t$1(t$1({},ti),oo),{},{recordHeaders:io,recordBody:ao,recordPerformance:so,recordInitialRequests:so})},li=s(function to(ue){var eo,no,ro=this,oo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};i$1(this,to),o(this,"bucketSize",100),o(this,"refillRate",10),o(this,"mutationBuckets",{}),o(this,"loggedTracker",{}),o(this,"refillBuckets",function(){Object.keys(ro.mutationBuckets).forEach(function(io){ro.mutationBuckets[io]=ro.mutationBuckets[io]+ro.refillRate,ro.mutationBuckets[io]>=ro.bucketSize&&delete ro.mutationBuckets[io]})}),o(this,"getNodeOrRelevantParent",function(io){var ao=ro.rrweb.mirror.getNode(io);if((ao==null?void 0:ao.nodeName)!=="svg"&&ao instanceof Element){var so=ao.closest("svg");if(so)return[ro.rrweb.mirror.getId(so),so]}return[io,ao]}),o(this,"numberOfChanges",function(io){var ao,so,lo,co,uo,fo,po,ho;return((ao=(so=io.removes)===null||so===void 0?void 0:so.length)!==null&&ao!==void 0?ao:0)+((lo=(co=io.attributes)===null||co===void 0?void 0:co.length)!==null&&lo!==void 0?lo:0)+((uo=(fo=io.texts)===null||fo===void 0?void 0:fo.length)!==null&&uo!==void 0?uo:0)+((po=(ho=io.adds)===null||ho===void 0?void 0:ho.length)!==null&&po!==void 0?po:0)}),o(this,"throttleMutations",function(io){if(io.type!==3||io.data.source!==0)return io;var ao=io.data,so=ro.numberOfChanges(ao);ao.attributes&&(ao.attributes=ao.attributes.filter(function(co){var uo,fo,po,ho=u(ro.getNodeOrRelevantParent(co.id),2),_o=ho[0],go=ho[1];return ro.mutationBuckets[_o]===0?!1:(ro.mutationBuckets[_o]=(uo=ro.mutationBuckets[_o])!==null&&uo!==void 0?uo:ro.bucketSize,ro.mutationBuckets[_o]=Math.max(ro.mutationBuckets[_o]-1,0),ro.mutationBuckets[_o]===0&&(ro.loggedTracker[_o]||(ro.loggedTracker[_o]=!0,(fo=(po=ro.options).onBlockedNode)===null||fo===void 0||fo.call(po,_o,go))),co)}));var lo=ro.numberOfChanges(ao);return lo!==0||so===lo?io:void 0}),this.rrweb=ue,this.options=oo,this.refillRate=(eo=this.options.refillRate)!==null&&eo!==void 0?eo:this.refillRate,this.bucketSize=(no=this.options.bucketSize)!==null&&no!==void 0?no:this.bucketSize,setInterval(function(){ro.refillBuckets()},1e3)}),ci=3e5,di=[Rn.MouseMove,Rn.MouseInteraction,Rn.Scroll,Rn.ViewportResize,Rn.Input,Rn.TouchMove,Rn.MediaInteraction,Rn.Drag],hi=function(to){return{rrwebMethod:to,enqueuedAt:Date.now(),attempt:1}},fi="[SessionRecording]",vi=function(){function to(ue){var eo=this;if(i$1(this,to),o(this,"queuedRRWebEvents",[]),o(this,"isIdle",!1),o(this,"_linkedFlagSeen",!1),o(this,"_lastActivityTimestamp",Date.now()),o(this,"_linkedFlag",null),o(this,"_forceAllowLocalhostNetworkCapture",!1),o(this,"_onBeforeUnload",function(){eo._flushBuffer()}),o(this,"_onOffline",function(){eo._tryAddCustomEvent("browser offline",{})}),o(this,"_onOnline",function(){eo._tryAddCustomEvent("browser online",{})}),o(this,"_onVisibilityChange",function(){if(L!=null&&L.visibilityState){var io="window "+L.visibilityState;eo._tryAddCustomEvent(io,{})}}),o(this,"_samplingSessionListener",null),this.instance=ue,this._captureStarted=!1,this._endpoint="/s/",this.stopRrweb=void 0,this.receivedDecide=!1,!this.instance.sessionManager)throw G.error(fi+" started without valid sessionManager"),new Error(fi+" started without valid sessionManager. This is a bug.");var no=this.sessionManager.checkAndGetSessionAndWindowId(),ro=no.sessionId,oo=no.windowId;this.sessionId=ro,this.windowId=oo,this.buffer=this.clearBuffer(),this._setupSampling()}return s(to,[{key:"rrwebRecord",get:function(){var ue;return U==null||(ue=U.rrweb)===null||ue===void 0?void 0:ue.record}},{key:"started",get:function(){return this._captureStarted}},{key:"sessionManager",get:function(){if(!this.instance.sessionManager)throw new Error(fi+" must be started with a valid sessionManager.");return this.instance.sessionManager}},{key:"fullSnapshotIntervalMillis",get:function(){var ue;return((ue=this.instance.config.session_recording)===null||ue===void 0?void 0:ue.full_snapshot_interval_millis)||ci}},{key:"isSampled",get:function(){var ue=this.instance.get_property(Ee);return x$1(ue)?ue:null}},{key:"sessionDuration",get:function(){var ue,eo,no=(ue=this.buffer)===null||ue===void 0?void 0:ue.data[((eo=this.buffer)===null||eo===void 0?void 0:eo.data.length)-1],ro=this.sessionManager.checkAndGetSessionAndWindowId(!0).sessionStartTimestamp;return no?no.timestamp-ro:null}},{key:"isRecordingEnabled",get:function(){var ue=!!this.instance.get_property(_e),eo=!this.instance.config.disable_session_recording;return T&&ue&&eo}},{key:"isConsoleLogCaptureEnabled",get:function(){var ue=!!this.instance.get_property(me),eo=this.instance.config.enable_recording_console_log;return eo??ue}},{key:"canvasRecording",get:function(){var ue=this.instance.get_property(be);return ue&&ue.fps&&ue.quality?{enabled:ue.enabled,fps:ue.fps,quality:ue.quality}:void 0}},{key:"networkPayloadCapture",get:function(){var ue,eo,no=this.instance.get_property(ye),ro={recordHeaders:(ue=this.instance.config.session_recording)===null||ue===void 0?void 0:ue.recordHeaders,recordBody:(eo=this.instance.config.session_recording)===null||eo===void 0?void 0:eo.recordBody},oo=(ro==null?void 0:ro.recordHeaders)||(no==null?void 0:no.recordHeaders),io=(ro==null?void 0:ro.recordBody)||(no==null?void 0:no.recordBody),ao=b(this.instance.config.capture_performance)?this.instance.config.capture_performance.network_timing:this.instance.config.capture_performance,so=!!(x$1(ao)?ao:no!=null&&no.capturePerformance);return oo||io||so?{recordHeaders:oo,recordBody:io,recordPerformance:so}:void 0}},{key:"sampleRate",get:function(){var ue=this.instance.get_property(ke);return F(ue)?ue:null}},{key:"minimumDuration",get:function(){var ue=this.instance.get_property(we);return F(ue)?ue:null}},{key:"status",get:function(){return this.receivedDecide?this.isRecordingEnabled?R(this._linkedFlag)||this._linkedFlagSeen?x$1(this.isSampled)?this.isSampled?"sampled":"disabled":"active":"buffering":"disabled":"buffering"}},{key:"startIfEnabledOrStop",value:function(){this.isRecordingEnabled?(this._startCapture(),T==null||T.addEventListener("beforeunload",this._onBeforeUnload),T==null||T.addEventListener("offline",this._onOffline),T==null||T.addEventListener("online",this._onOnline),T==null||T.addEventListener("visibilitychange",this._onVisibilityChange),G.info(fi+" started")):(this.stopRecording(),this.clearBuffer())}},{key:"stopRecording",value:function(){this._captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=void 0,this._captureStarted=!1,T==null||T.removeEventListener("beforeunload",this._onBeforeUnload),T==null||T.removeEventListener("offline",this._onOffline),T==null||T.removeEventListener("online",this._onOnline),T==null||T.removeEventListener("visibilitychange",this._onVisibilityChange),G.info(fi+" stopped"))}},{key:"makeSamplingDecision",value:function(ue){var eo,no=this.sessionId!==ue,ro=this.sampleRate;if(F(ro)){var oo,io=this.isSampled,ao=no||!x$1(io);ao?oo=Math.random()<ro:oo=io,!oo&&ao&&G.warn(fi+" Sample rate (".concat(ro,") has determined that this sessionId (").concat(ue,") will not be sent to the server.")),this._tryAddCustomEvent("samplingDecisionMade",{sampleRate:ro}),(eo=this.instance.persistence)===null||eo===void 0||eo.register(o({},Ee,oo))}else{var so;(so=this.instance.persistence)===null||so===void 0||so.register(o({},Ee,null))}}},{key:"afterDecideResponse",value:function(ue){var eo,no,ro,oo=this;if(this._persistDecideResponse(ue),this._linkedFlag=((eo=ue.sessionRecording)===null||eo===void 0?void 0:eo.linkedFlag)||null,(no=ue.sessionRecording)!==null&&no!==void 0&&no.endpoint&&(this._endpoint=(ro=ue.sessionRecording)===null||ro===void 0?void 0:ro.endpoint),this._setupSampling(),!R(this._linkedFlag)&&!this._linkedFlagSeen){var io=S(this._linkedFlag)?this._linkedFlag:this._linkedFlag.flag,ao=S(this._linkedFlag)?null:this._linkedFlag.variant;this.instance.onFeatureFlags(function(so,lo){var co=b(lo)&&io in lo,uo=ao?lo[io]===ao:co;if(uo){var fo={linkedFlag:io,linkedVariant:ao},po="linked flag matched";G.info(fi+" "+po,fo),oo._tryAddCustomEvent(po,fo)}oo._linkedFlagSeen=uo})}this.receivedDecide=!0,this.startIfEnabledOrStop()}},{key:"_setupSampling",value:function(){var ue=this;F(this.sampleRate)&&I(this._samplingSessionListener)&&(this._samplingSessionListener=this.sessionManager.onSessionId(function(eo){ue.makeSamplingDecision(eo)}))}},{key:"_persistDecideResponse",value:function(ue){if(this.instance.persistence){var eo=this.instance.persistence,no=function(){var ro,oo,io,ao,so,lo,co,uo,fo=(ro=ue.sessionRecording)===null||ro===void 0?void 0:ro.sampleRate,po=R(fo)?null:parseFloat(fo),ho=(oo=ue.sessionRecording)===null||oo===void 0?void 0:oo.minimumDurationMilliseconds;eo.register((o(uo={},_e,!!ue.sessionRecording),o(uo,me,(io=ue.sessionRecording)===null||io===void 0?void 0:io.consoleLogRecordingEnabled),o(uo,ye,t$1({capturePerformance:ue.capturePerformance},(ao=ue.sessionRecording)===null||ao===void 0?void 0:ao.networkPayloadCapture)),o(uo,be,{enabled:(so=ue.sessionRecording)===null||so===void 0?void 0:so.recordCanvas,fps:(lo=ue.sessionRecording)===null||lo===void 0?void 0:lo.canvasFps,quality:(co=ue.sessionRecording)===null||co===void 0?void 0:co.canvasQuality}),o(uo,ke,po),o(uo,we,w$1(ho)?null:ho),uo))};no(),this.sessionManager.onSessionId(no)}}},{key:"log",value:function(ue){var eo,no=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"log";(eo=this.instance.sessionRecording)===null||eo===void 0||eo.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:no,trace:[],payload:[JSON.stringify(ue)]}},timestamp:K()})}},{key:"_startCapture",value:function(){var ue=this;w$1(Object.assign)||this._captureStarted||this.instance.config.disable_session_recording||this.instance.consent.isOptedOut()||(this._captureStarted=!0,this.sessionManager.checkAndGetSessionAndWindowId(),this.rrwebRecord?this._onScriptLoaded():this.instance.requestRouter.loadScript("/static/recorder.js?v=".concat(f.LIB_VERSION),function(eo){if(eo)return G.error(fi+" could not load recorder.js",eo);ue._onScriptLoaded()}))}},{key:"isInteractiveEvent",value:function(ue){var eo;return ue.type===3&&di.indexOf((eo=ue.data)===null||eo===void 0?void 0:eo.source)!==-1}},{key:"_updateWindowAndSessionIds",value:function(ue){var eo=this.isInteractiveEvent(ue);eo||this.isIdle||ue.timestamp-this._lastActivityTimestamp>3e5&&(this.isIdle=!0,clearTimeout(this._fullSnapshotTimer),this._flushBuffer());var no=!1;if(eo&&(this._lastActivityTimestamp=ue.timestamp,this.isIdle&&(this.isIdle=!1,this._tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:ue.type}),no=!0)),!this.isIdle){var ro=this.sessionManager.checkAndGetSessionAndWindowId(!eo,ue.timestamp),oo=ro.windowId,io=ro.sessionId,ao=this.sessionId!==io,so=this.windowId!==oo;this.windowId=oo,this.sessionId=io,(no||[wn,Sn].indexOf(ue.type)===-1&&(so||ao||w$1(this._fullSnapshotTimer)))&&this._tryTakeFullSnapshot()}}},{key:"_tryRRWebMethod",value:function(ue){try{return ue.rrwebMethod(),!0}catch(eo){return this.queuedRRWebEvents.length<10?this.queuedRRWebEvents.push({enqueuedAt:ue.enqueuedAt||Date.now(),attempt:ue.attempt++,rrwebMethod:ue.rrwebMethod}):G.warn(fi+" could not emit queued rrweb event.",eo,ue),!1}}},{key:"_tryAddCustomEvent",value:function(ue,eo){var no=this;return this._tryRRWebMethod(hi(function(){return no.rrwebRecord.addCustomEvent(ue,eo)}))}},{key:"_tryTakeFullSnapshot",value:function(){var ue=this;return this._tryRRWebMethod(hi(function(){return ue.rrwebRecord.takeFullSnapshot()}))}},{key:"_onScriptLoaded",value:function(){for(var ue,eo=this,no={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1},ro=this.instance.config.session_recording,oo=0,io=Object.entries(ro||{});oo<io.length;oo++){var ao=u(io[oo],2),so=ao[0],lo=ao[1];so in no&&(so==="maskInputOptions"?no.maskInputOptions=t$1({password:!0},lo):no[so]=lo)}if(this.canvasRecording&&this.canvasRecording.enabled&&(no.recordCanvas=!0,no.sampling={canvas:this.canvasRecording.fps},no.dataURLOptions={type:"image/webp",quality:this.canvasRecording.quality}),this.rrwebRecord){this.mutationRateLimiter=(ue=this.mutationRateLimiter)!==null&&ue!==void 0?ue:new li(this.rrwebRecord,{onBlockedNode:function(uo,fo){var po="Too many mutations on node '".concat(uo,"'. Rate limiting. This could be due to SVG animations or something similar");G.info(po,{node:fo}),eo.log(fi+" "+po,"warn")}});var co=this._gatherRRWebPlugins();this.stopRrweb=this.rrwebRecord(t$1({emit:function(uo){eo.onRRwebEmit(uo)},plugins:co},no)),this.instance._addCaptureHook(function(uo){try{if(uo==="$pageview"){var fo=T?eo._maskUrl(T.location.href):"";if(!fo)return;eo._tryAddCustomEvent("$pageview",{href:fo})}}catch(po){G.error("Could not add $pageview to rrweb session",po)}}),this._lastActivityTimestamp=Date.now(),this.isIdle=!1,this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:no,activePlugins:co.map(function(uo){return uo==null?void 0:uo.name})}),this._tryAddCustomEvent("$posthog_config",{config:this.instance.config})}else G.error(fi+"onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.")}},{key:"_scheduleFullSnapshot",value:function(){var ue=this;if(this._fullSnapshotTimer&&clearInterval(this._fullSnapshotTimer),!this.isIdle){var eo=this.fullSnapshotIntervalMillis;eo&&(this._fullSnapshotTimer=setInterval(function(){ue._tryTakeFullSnapshot()},eo))}}},{key:"_gatherRRWebPlugins",value:function(){var ue=[];return U.rrwebConsoleRecord&&this.isConsoleLogCaptureEnabled&&ue.push(U.rrwebConsoleRecord.getRecordConsolePlugin()),this.networkPayloadCapture&&y(U.getRecordNetworkPlugin)&&(!vt.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?ue.push(U.getRecordNetworkPlugin(ui(this.instance.config,this.networkPayloadCapture))):G.info(fi+" NetworkCapture not started because we are on localhost.")),ue}},{key:"onRRwebEmit",value:function(ue){if(this._processQueuedEvents(),ue&&b(ue)){if(ue.type===In.Meta){var eo=this._maskUrl(ue.data.href);if(this._lastHref=eo,!eo)return;ue.data.href=eo}else this._pageViewFallBack();ue.type===In.FullSnapshot&&this._scheduleFullSnapshot();var no=this.mutationRateLimiter?this.mutationRateLimiter.throttleMutations(ue):ue;if(no){var ro=function(ao){var so=ao;if(so&&b(so)&&so.type===6&&b(so.data)&&so.data.plugin==="rrweb/console@1"){so.data.payload.payload.length>10&&(so.data.payload.payload=so.data.payload.payload.slice(0,10),so.data.payload.payload.push("...[truncated]"));for(var lo=[],co=0;co<so.data.payload.payload.length;co++)so.data.payload.payload[co]&&so.data.payload.payload[co].length>2e3?lo.push(so.data.payload.payload[co].slice(0,2e3)+"...[truncated]"):lo.push(so.data.payload.payload[co]);return so.data.payload.payload=lo,ao}return ao}(no),oo=kn(ro);if(this._updateWindowAndSessionIds(ro),!this.isIdle||ro.type===In.Custom){var io={$snapshot_bytes:oo,$snapshot_data:ro,$session_id:this.sessionId,$window_id:this.windowId};this.status!=="disabled"?this._captureSnapshotBuffered(io):this.clearBuffer()}}}}},{key:"_pageViewFallBack",value:function(){if(!this.instance.config.capture_pageview&&T){var ue=this._maskUrl(T.location.href);this._lastHref!==ue&&(this._tryAddCustomEvent("$url_changed",{href:ue}),this._lastHref=ue)}}},{key:"_processQueuedEvents",value:function(){var ue=this;if(this.queuedRRWebEvents.length){var eo=l(this.queuedRRWebEvents);this.queuedRRWebEvents=[],eo.forEach(function(no){Date.now()-no.enqueuedAt<=2e3&&ue._tryRRWebMethod(no)})}}},{key:"_maskUrl",value:function(ue){var eo=this.instance.config.session_recording;if(eo.maskNetworkRequestFn){var no,ro={url:ue};return(no=ro=eo.maskNetworkRequestFn(ro))===null||no===void 0?void 0:no.url}return ue}},{key:"clearBuffer",value:function(){return this.buffer={size:0,data:[],sessionId:this.sessionId,windowId:this.windowId},this.buffer}},{key:"_flushBuffer",value:function(){var ue=this;this.flushBufferTimer&&(clearTimeout(this.flushBufferTimer),this.flushBufferTimer=void 0);var eo=this.minimumDuration,no=this.sessionDuration,ro=F(no)&&no>=0,oo=F(eo)&&ro&&no<eo;return this.status==="buffering"||oo?(this.flushBufferTimer=setTimeout(function(){ue._flushBuffer()},2e3),this.buffer):(this.buffer.data.length>0&&En(this.buffer).forEach(function(io){ue._captureSnapshot({$snapshot_bytes:io.size,$snapshot_data:io.data,$session_id:io.sessionId,$window_id:io.windowId})}),this.clearBuffer())}},{key:"_captureSnapshotBuffered",value:function(ue){var eo,no=this,ro=2+(((eo=this.buffer)===null||eo===void 0?void 0:eo.data.length)||0);(this.buffer.size+ue.$snapshot_bytes+ro>943718.4||this.buffer.sessionId!==this.sessionId)&&(this.buffer=this._flushBuffer()),this.buffer.size+=ue.$snapshot_bytes,this.buffer.data.push(ue.$snapshot_data),this.flushBufferTimer||(this.flushBufferTimer=setTimeout(function(){no._flushBuffer()},2e3))}},{key:"_captureSnapshot",value:function(ue){this.instance.capture("$snapshot",ue,{_url:this.instance.requestRouter.endpointFor("api",this._endpoint),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}},{key:"overrideLinkedFlag",value:function(){this._linkedFlagSeen=!0}}]),to}(),pi=function(){function to(ue){i$1(this,to),this.instance=ue,this.instance.decideEndpointWasHit=this.instance._hasBootstrappedFeatureFlags()}return s(to,[{key:"call",value:function(){var ue=this,eo={token:this.instance.config.token,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),person_properties:this.instance.get_property(Fe),group_properties:this.instance.get_property(xe),disable_flags:this.instance.config.advanced_disable_feature_flags||this.instance.config.advanced_disable_feature_flags_on_first_load||void 0};this.instance._send_request({method:"POST",url:this.instance.requestRouter.endpointFor("api","/decide/?v=3"),data:eo,compression:this.instance.config.disable_compression?void 0:re.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:function(no){return ue.parseDecideResponse(no.json)}})}},{key:"parseDecideResponse",value:function(ue){var eo=this;this.instance.featureFlags.setReloadingPaused(!1),this.instance.featureFlags._startReloadTimer();var no=!ue;if(this.instance.config.advanced_disable_feature_flags_on_first_load||this.instance.config.advanced_disable_feature_flags||this.instance.featureFlags.receivedFeatureFlags(ue??{},no),no)G.error("Failed to fetch feature flags from PostHog.");else{if(!L||!L.body)return G.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(function(){eo.parseDecideResponse(ue)},500);if(this.instance._afterDecideResponse(ue),ue.siteApps)if(this.instance.config.opt_in_site_apps){var ro,oo=h(ue.siteApps);try{var io=function(){var ao=ro.value,so=ao.id,lo=ao.url,co=eo.instance.requestRouter.endpointFor("api",lo);U["__$$ph_site_app_".concat(so)]=eo.instance,eo.instance.requestRouter.loadScript(co,function(uo){if(uo)return G.error("Error while initializing PostHog app with config id ".concat(so),uo)})};for(oo.s();!(ro=oo.n()).done;)io()}catch(ao){oo.e(ao)}finally{oo.f()}}else ue.siteApps.length>0&&G.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}]),to}(),gi=T!=null&&T.location?yt(T.location.hash,"__posthog")||yt(location.hash,"state"):null,_i="_postHogToolbarParams";(function(to){to[to.UNINITIALIZED=0]="UNINITIALIZED",to[to.LOADING=1]="LOADING",to[to.LOADED=2]="LOADED"})(ai||(ai={}));var mi=function(){function to(ue){i$1(this,to),this.instance=ue}return s(to,[{key:"setToolbarState",value:function(ue){U.ph_toolbar_state=ue}},{key:"getToolbarState",value:function(){var ue;return(ue=U.ph_toolbar_state)!==null&&ue!==void 0?ue:ai.UNINITIALIZED}},{key:"maybeLoadToolbar",value:function(){var ue,eo,no=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0,ro=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,oo=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;if(!T||!L)return!1;no=(ue=no)!==null&&ue!==void 0?ue:T.location,oo=(eo=oo)!==null&&eo!==void 0?eo:T.history;try{if(!ro){try{T.localStorage.setItem("test","test"),T.localStorage.removeItem("test")}catch{return!1}ro=T==null?void 0:T.localStorage}var io,ao=gi||yt(no.hash,"__posthog")||yt(no.hash,"state"),so=ao?Z(function(){return JSON.parse(atob(decodeURIComponent(ao)))})||Z(function(){return JSON.parse(decodeURIComponent(ao))}):null;return so&&so.action==="ph_authorize"?((io=so).source="url",io&&Object.keys(io).length>0&&(so.desiredHash?no.hash=so.desiredHash:oo?oo.replaceState(oo.state,"",no.pathname+no.search):no.hash="")):((io=JSON.parse(ro.getItem(_i)||"{}")).source="localstorage",delete io.userIntent),!(!io.token||this.instance.config.token!==io.token)&&(this.loadToolbar(io),!0)}catch{return!1}}},{key:"_callLoadToolbar",value:function(ue){(U.ph_load_toolbar||U.ph_load_editor)(ue,this.instance)}},{key:"loadToolbar",value:function(ue){var eo=this,no=!(L==null||!L.getElementById(Ne));if(!T||no)return!1;var ro=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,oo=t$1(t$1({token:this.instance.config.token},ue),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},ro?{instrument:!1}:{});if(T.localStorage.setItem(_i,JSON.stringify(t$1(t$1({},oo),{},{source:void 0}))),this.getToolbarState()===ai.LOADED)this._callLoadToolbar(oo);else if(this.getToolbarState()===ai.UNINITIALIZED){this.setToolbarState(ai.LOADING);var io=3e5,ao=Math.floor(Date.now()/io)*io;this.instance.requestRouter.loadScript("/static/toolbar.js?t=".concat(ao),function(so){if(so)return G.error("Failed to load toolbar",so),void eo.setToolbarState(ai.UNINITIALIZED);eo.setToolbarState(ai.LOADED),eo._callLoadToolbar(oo)}),oe(T,"turbolinks:load",function(){eo.setToolbarState(ai.UNINITIALIZED),eo.loadToolbar(oo)})}return!0}},{key:"_loadEditor",value:function(ue){return this.loadToolbar(ue)}},{key:"maybeLoadEditor",value:function(){var ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0,eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,no=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;return this.maybeLoadToolbar(ue,eo,no)}}]),to}(),yi=function(){function to(ue){i$1(this,to),o(this,"isPaused",!0),o(this,"queue",[]),o(this,"flushTimeoutMs",3e3),this.sendRequest=ue}return s(to,[{key:"enqueue",value:function(ue){this.queue.push(ue),this.flushTimeout||this.setFlushTimeout()}},{key:"unload",value:function(){var ue=this;this.clearFlushTimeout();var eo=this.queue.length>0?this.formatQueue():{},no=Object.values(eo);[].concat(l(no.filter(function(ro){return ro.url.indexOf("/e")===0})),l(no.filter(function(ro){return ro.url.indexOf("/e")!==0}))).map(function(ro){ue.sendRequest(t$1(t$1({},ro),{},{transport:"sendBeacon"}))})}},{key:"enable",value:function(){this.isPaused=!1,this.setFlushTimeout()}},{key:"setFlushTimeout",value:function(){var ue=this;this.isPaused||(this.flushTimeout=setTimeout(function(){if(ue.clearFlushTimeout(),ue.queue.length>0){var eo=ue.formatQueue(),no=function(oo){var io=eo[oo],ao=new Date().getTime();io.data&&m(io.data)&&Q(io.data,function(so){so.offset=Math.abs(so.timestamp-ao),delete so.timestamp}),ue.sendRequest(io)};for(var ro in eo)no(ro)}},this.flushTimeoutMs))}},{key:"clearFlushTimeout",value:function(){clearTimeout(this.flushTimeout),this.flushTimeout=void 0}},{key:"formatQueue",value:function(){var ue={};return Q(this.queue,function(eo){var no,ro=eo,oo=(ro?ro.batchKey:null)||ro.url;w$1(ue[oo])&&(ue[oo]=t$1(t$1({},ro),{},{data:[]})),(no=ue[oo].data)===null||no===void 0||no.push(ro.data)}),this.queue=[],ue}}]),to}(),bi=Uint8Array,ki=Uint16Array,wi=Uint32Array,Si=new bi([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Ei=new bi([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Ii=new bi([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ri=function(to,ue){for(var eo=new ki(31),no=0;no<31;++no)eo[no]=ue+=1<<to[no-1];var ro=new wi(eo[30]);for(no=1;no<30;++no)for(var oo=eo[no];oo<eo[no+1];++oo)ro[oo]=oo-eo[no]<<5|no;return[eo,ro]},Fi=Ri(Si,2),xi=Fi[0],Pi=Fi[1];xi[28]=258,Pi[258]=28;for(var Ti=Ri(Ei,0)[1],Ci=new ki(32768),$i=0;$i<32768;++$i){var Oi=(43690&$i)>>>1|(21845&$i)<<1;Oi=(61680&(Oi=(52428&Oi)>>>2|(13107&Oi)<<2))>>>4|(3855&Oi)<<4,Ci[$i]=((65280&Oi)>>>8|(255&Oi)<<8)>>>1}var Mi=function(to,ue,eo){for(var no=to.length,ro=0,oo=new ki(ue);ro<no;++ro)++oo[to[ro]-1];var io,ao=new ki(ue);for(ro=0;ro<ue;++ro)ao[ro]=ao[ro-1]+oo[ro-1]<<1;if(eo){io=new ki(1<<ue);var so=15-ue;for(ro=0;ro<no;++ro)if(to[ro])for(var lo=ro<<4|to[ro],co=ue-to[ro],uo=ao[to[ro]-1]++<<co,fo=uo|(1<<co)-1;uo<=fo;++uo)io[Ci[uo]>>>so]=lo}else for(io=new ki(no),ro=0;ro<no;++ro)io[ro]=Ci[ao[to[ro]-1]++]>>>15-to[ro];return io},Ai$1=new bi(288);for($i=0;$i<144;++$i)Ai$1[$i]=8;for($i=144;$i<256;++$i)Ai$1[$i]=9;for($i=256;$i<280;++$i)Ai$1[$i]=7;for($i=280;$i<288;++$i)Ai$1[$i]=8;var Li=new bi(32);for($i=0;$i<32;++$i)Li[$i]=5;var Di=Mi(Ai$1,9,0),qi=Mi(Li,5,0),Ni=function(to){return(to/8>>0)+(7&to&&1)},Bi=function(to,ue,eo){(ue==null||ue<0)&&(ue=0),(eo==null||eo>to.length)&&(eo=to.length);var no=new(to instanceof ki?ki:to instanceof wi?wi:bi)(eo-ue);return no.set(to.subarray(ue,eo)),no},Hi=function(to,ue,eo){eo<<=7&ue;var no=ue/8>>0;to[no]|=eo,to[no+1]|=eo>>>8},Ui=function(to,ue,eo){eo<<=7&ue;var no=ue/8>>0;to[no]|=eo,to[no+1]|=eo>>>8,to[no+2]|=eo>>>16},ji=function(to,ue){for(var eo=[],no=0;no<to.length;++no)to[no]&&eo.push({s:no,f:to[no]});var ro=eo.length,oo=eo.slice();if(!ro)return[new bi(0),0];if(ro==1){var io=new bi(eo[0].s+1);return io[eo[0].s]=1,[io,1]}eo.sort(function(ko,So){return ko.f-So.f}),eo.push({s:-1,f:25001});var ao=eo[0],so=eo[1],lo=0,co=1,uo=2;for(eo[0]={s:-1,f:ao.f+so.f,l:ao,r:so};co!=ro-1;)ao=eo[eo[lo].f<eo[uo].f?lo++:uo++],so=eo[lo!=co&&eo[lo].f<eo[uo].f?lo++:uo++],eo[co++]={s:-1,f:ao.f+so.f,l:ao,r:so};var fo=oo[0].s;for(no=1;no<ro;++no)oo[no].s>fo&&(fo=oo[no].s);var po=new ki(fo+1),ho=Gi(eo[co-1],po,0);if(ho>ue){no=0;var _o=0,go=ho-ue,bo=1<<go;for(oo.sort(function(ko,So){return po[So.s]-po[ko.s]||ko.f-So.f});no<ro;++no){var vo=oo[no].s;if(!(po[vo]>ue))break;_o+=bo-(1<<ho-po[vo]),po[vo]=ue}for(_o>>>=go;_o>0;){var yo=oo[no].s;po[yo]<ue?_o-=1<<ue-po[yo]++-1:++no}for(;no>=0&&_o;--no){var wo=oo[no].s;po[wo]==ue&&(--po[wo],++_o)}ho=ue}return[new bi(po),ho]},Gi=function to(ue,eo,no){return ue.s==-1?Math.max(to(ue.l,eo,no+1),to(ue.r,eo,no+1)):eo[ue.s]=no},Wi=function(to){for(var ue=to.length;ue&&!to[--ue];);for(var eo=new ki(++ue),no=0,ro=to[0],oo=1,io=function(so){eo[no++]=so},ao=1;ao<=ue;++ao)if(to[ao]==ro&&ao!=ue)++oo;else{if(!ro&&oo>2){for(;oo>138;oo-=138)io(32754);oo>2&&(io(oo>10?oo-11<<5|28690:oo-3<<5|12305),oo=0)}else if(oo>3){for(io(ro),--oo;oo>6;oo-=6)io(8304);oo>2&&(io(oo-3<<5|8208),oo=0)}for(;oo--;)io(ro);oo=1,ro=to[ao]}return[eo.subarray(0,no),ue]},Vi=function(to,ue){for(var eo=0,no=0;no<ue.length;++no)eo+=to[no]*ue[no];return eo},zi=function(to,ue,eo){var no=eo.length,ro=Ni(ue+2);to[ro]=255&no,to[ro+1]=no>>>8,to[ro+2]=255^to[ro],to[ro+3]=255^to[ro+1];for(var oo=0;oo<no;++oo)to[ro+oo+4]=eo[oo];return 8*(ro+4+no)},Qi=function(to,ue,eo,no,ro,oo,io,ao,so,lo,co){Hi(ue,co++,eo),++ro[256];for(var uo=ji(ro,15),fo=uo[0],po=uo[1],ho=ji(oo,15),_o=ho[0],go=ho[1],bo=Wi(fo),vo=bo[0],yo=bo[1],wo=Wi(_o),ko=wo[0],So=wo[1],Eo=new ki(19),Io=0;Io<vo.length;++Io)Eo[31&vo[Io]]++;for(Io=0;Io<ko.length;++Io)Eo[31&ko[Io]]++;for(var Ao=ji(Eo,7),To=Ao[0],Mo=Ao[1],Vo=19;Vo>4&&!To[Ii[Vo-1]];--Vo);var Fo,Po,Ro,Do,qo=lo+5<<3,Uo=Vi(ro,Ai$1)+Vi(oo,Li)+io,jo=Vi(ro,fo)+Vi(oo,_o)+io+14+3*Vo+Vi(Eo,To)+(2*Eo[16]+3*Eo[17]+7*Eo[18]);if(qo<=Uo&&qo<=jo)return zi(ue,co,to.subarray(so,so+lo));if(Hi(ue,co,1+(jo<Uo)),co+=2,jo<Uo){Fo=Mi(fo,po,0),Po=fo,Ro=Mi(_o,go,0),Do=_o;var Zo=Mi(To,Mo,0);for(Hi(ue,co,yo-257),Hi(ue,co+5,So-1),Hi(ue,co+10,Vo-4),co+=14,Io=0;Io<Vo;++Io)Hi(ue,co+3*Io,To[Ii[Io]]);co+=3*Vo;for(var Qo=[vo,ko],Yo=0;Yo<2;++Yo){var Xo=Qo[Yo];for(Io=0;Io<Xo.length;++Io){var Ko=31&Xo[Io];Hi(ue,co,Zo[Ko]),co+=To[Ko],Ko>15&&(Hi(ue,co,Xo[Io]>>>5&127),co+=Xo[Io]>>>12)}}}else Fo=Di,Po=Ai$1,Ro=qi,Do=Li;for(Io=0;Io<ao;++Io)if(no[Io]>255){Ko=no[Io]>>>18&31,Ui(ue,co,Fo[Ko+257]),co+=Po[Ko+257],Ko>7&&(Hi(ue,co,no[Io]>>>23&31),co+=Si[Ko]);var ra=31&no[Io];Ui(ue,co,Ro[ra]),co+=Do[ra],ra>3&&(Ui(ue,co,no[Io]>>>5&8191),co+=Ei[ra])}else Ui(ue,co,Fo[no[Io]]),co+=Po[no[Io]];return Ui(ue,co,Fo[256]),co+Po[256]},Ji=new wi([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Yi=new bi(0),Xi=function(){for(var to=new wi(256),ue=0;ue<256;++ue){for(var eo=ue,no=9;--no;)eo=(1&eo&&3988292384)^eo>>>1;to[ue]=eo}return to}(),Ki=function(to,ue,eo,no,ro){return function(oo,io,ao,so,lo,co){var uo=oo.length,fo=new bi(so+uo+5*(1+Math.floor(uo/7e3))+lo),po=fo.subarray(so,fo.length-lo),ho=0;if(!io||uo<8)for(var _o=0;_o<=uo;_o+=65535){var go=_o+65535;go<uo?ho=zi(po,ho,oo.subarray(_o,go)):(po[_o]=co,ho=zi(po,ho,oo.subarray(_o,uo)))}else{for(var bo=Ji[io-1],vo=bo>>>13,yo=8191&bo,wo=(1<<ao)-1,ko=new ki(32768),So=new ki(wo+1),Eo=Math.ceil(ao/3),Io=2*Eo,Ao=function(ka){return(oo[ka]^oo[ka+1]<<Eo^oo[ka+2]<<Io)&wo},To=new wi(25e3),Mo=new ki(288),Vo=new ki(32),Fo=0,Po=0,Ro=(_o=0,0),Do=0,qo=0;_o<uo;++_o){var Uo=Ao(_o),jo=32767&_o,Zo=So[Uo];if(ko[jo]=Zo,So[Uo]=jo,Do<=_o){var Qo=uo-_o;if((Fo>7e3||Ro>24576)&&Qo>423){ho=Qi(oo,po,0,To,Mo,Vo,Po,Ro,qo,_o-qo,ho),Ro=Fo=Po=0,qo=_o;for(var Yo=0;Yo<286;++Yo)Mo[Yo]=0;for(Yo=0;Yo<30;++Yo)Vo[Yo]=0}var Xo=2,Ko=0,ra=yo,ea=jo-Zo&32767;if(Qo>2&&Uo==Ao(_o-ea))for(var ia=Math.min(vo,Qo)-1,Jo=Math.min(32767,_o),sa=Math.min(258,Qo);ea<=Jo&&--ra&&jo!=Zo;){if(oo[_o+Xo]==oo[_o+Xo-ea]){for(var Ea=0;Ea<sa&&oo[_o+Ea]==oo[_o+Ea-ea];++Ea);if(Ea>Xo){if(Xo=Ea,Ko=ea,Ea>ia)break;var pa=Math.min(ea,Ea-2),ya=0;for(Yo=0;Yo<pa;++Yo){var da=_o-ea+Yo+32768&32767,Ra=da-ko[da]+32768&32767;Ra>ya&&(ya=Ra,Zo=da)}}}ea+=(jo=Zo)-(Zo=ko[jo])+32768&32767}if(Ko){To[Ro++]=268435456|Pi[Xo]<<18|Ti[Ko];var Da=31&Pi[Xo],Na=31&Ti[Ko];Po+=Si[Da]+Ei[Na],++Mo[257+Da],++Vo[Na],Do=_o+Xo,++Fo}else To[Ro++]=oo[_o],++Mo[oo[_o]]}}ho=Qi(oo,po,co,To,Mo,Vo,Po,Ro,qo,_o-qo,ho),co||(ho=zi(po,ho,Yi))}return Bi(fo,0,so+Ni(ho)+lo)}(to,ue.level==null?6:ue.level,ue.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(to.length)))):12+ue.mem,eo,no,!ro)},Zi=function(to,ue,eo){for(;eo;++ue)to[ue]=eo,eo>>>=8};function er(to,ue){ue===void 0&&(ue={});var eo=function(){var ao=4294967295;return{p:function(so){for(var lo=ao,co=0;co<so.length;++co)lo=Xi[255&lo^so[co]]^lo>>>8;ao=lo},d:function(){return 4294967295^ao}}}(),no=to.length;eo.p(to);var ro,oo=Ki(to,ue,10+((ro=ue).filename&&ro.filename.length+1||0),8),io=oo.length;return function(ao,so){var lo=so.filename;if(ao[0]=31,ao[1]=139,ao[2]=8,ao[8]=so.level<2?4:so.level==9?2:0,ao[9]=3,so.mtime!=0&&Zi(ao,4,Math.floor(new Date(so.mtime||Date.now())/1e3)),lo){ao[3]=8;for(var co=0;co<=lo.length;++co)ao[co+10]=lo.charCodeAt(co)}}(oo,ue),Zi(oo,io-8,eo.d()),Zi(oo,io-4,no),oo}var tr=!!N||!!q,nr="text/plain",ir=function(to,ue){var eo=u(to.split("?"),2),no=eo[0],ro=eo[1],oo=t$1({},ue);ro==null||ro.split("&").forEach(function(ao){var so=u(ao.split("="),1)[0];delete oo[so]});var io=_t(oo);return io=io?(ro?ro+"&":"")+io:ro,"".concat(no,"?").concat(io)},rr=function(to){return"data="+encodeURIComponent(typeof to=="string"?to:JSON.stringify(to))},sr=function(to){var ue=to.data,eo=to.compression;if(ue){if(eo===re.GZipJS){var no=er(function(oo,io){var ao=oo.length;if(!io&&typeof TextEncoder<"u")return new TextEncoder().encode(oo);for(var so=new bi(oo.length+(oo.length>>>1)),lo=0,co=function(ho){so[lo++]=ho},uo=0;uo<ao;++uo){if(lo+5>so.length){var fo=new bi(lo+8+(ao-uo<<1));fo.set(so),so=fo}var po=oo.charCodeAt(uo);po<128||io?co(po):po<2048?(co(192|po>>>6),co(128|63&po)):po>55295&&po<57344?(co(240|(po=65536+(1047552&po)|1023&oo.charCodeAt(++uo))>>>18),co(128|po>>>12&63),co(128|po>>>6&63),co(128|63&po)):(co(224|po>>>12),co(128|po>>>6&63),co(128|63&po))}return Bi(so,0,lo)}(JSON.stringify(ue)),{mtime:0});return{contentType:nr,body:new Blob([no],{type:nr})}}if(eo===re.Base64){var ro=function(oo){var io,ao,so,lo,co,uo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",fo=0,po=0,ho="",_o=[];if(!oo)return oo;oo=se(oo);do io=(co=oo.charCodeAt(fo++)<<16|oo.charCodeAt(fo++)<<8|oo.charCodeAt(fo++))>>18&63,ao=co>>12&63,so=co>>6&63,lo=63&co,_o[po++]=uo.charAt(io)+uo.charAt(ao)+uo.charAt(so)+uo.charAt(lo);while(fo<oo.length);switch(ho=_o.join(""),oo.length%3){case 1:ho=ho.slice(0,-2)+"==";break;case 2:ho=ho.slice(0,-1)+"="}return ho}(JSON.stringify(ue));return{contentType:"application/x-www-form-urlencoded",body:rr(ro)}}return{contentType:"application/json",body:JSON.stringify(ue)}}},or=[];N&&or.push({transport:"XHR",method:function(to){var ue,eo=new N;eo.open(to.method||"GET",to.url,!0);var no=(ue=sr(to))!==null&&ue!==void 0?ue:{},ro=no.contentType,oo=no.body;Q(to.headers,function(io,ao){eo.setRequestHeader(ao,io)}),ro&&eo.setRequestHeader("Content-Type",ro),to.timeout&&(eo.timeout=to.timeout),eo.withCredentials=!0,eo.onreadystatechange=function(){if(eo.readyState===4){var io,ao={statusCode:eo.status,text:eo.responseText};if(eo.status===200)try{ao.json=JSON.parse(eo.responseText)}catch{}(io=to.callback)===null||io===void 0||io.call(to,ao)}},eo.send(oo)}}),q&&or.push({transport:"fetch",method:function(to){var ue,eo,no=(ue=sr(to))!==null&&ue!==void 0?ue:{},ro=no.contentType,oo=no.body,io=new Headers;Q(to.headers,function(co,uo){io.append(uo,co)}),ro&&io.append("Content-Type",ro);var ao=to.url,so=null;if(B){var lo=new B;so={signal:lo.signal,timeout:setTimeout(function(){return lo.abort()},to.timeout)}}q(ao,{method:(to==null?void 0:to.method)||"GET",headers:io,keepalive:to.method==="POST",body:oo,signal:(eo=so)===null||eo===void 0?void 0:eo.signal}).then(function(co){return co.text().then(function(uo){var fo,po={statusCode:co.status,text:uo};if(co.status===200)try{po.json=JSON.parse(uo)}catch(ho){G.error(ho)}(fo=to.callback)===null||fo===void 0||fo.call(to,po)})}).catch(function(co){var uo;G.error(co),(uo=to.callback)===null||uo===void 0||uo.call(to,{statusCode:0,text:co})}).finally(function(){return so?clearTimeout(so.timeout):null})}}),A!=null&&A.sendBeacon&&or.push({transport:"sendBeacon",method:function(to){var ue=ir(to.url,{beacon:"1"});try{var eo,no=(eo=sr(to))!==null&&eo!==void 0?eo:{},ro=no.contentType,oo=no.body,io=typeof oo=="string"?new Blob([oo],{type:ro}):oo;A.sendBeacon(ue,io)}catch{}}});var ar=["retriesPerformedSoFar"],ur,lr=function(){function to(ue){var eo=this;i$1(this,to),o(this,"isPolling",!1),o(this,"pollIntervalMs",3e3),o(this,"queue",[]),this.instance=ue,this.queue=[],this.areWeOnline=!0,!w$1(T)&&"onLine"in T.navigator&&(this.areWeOnline=T.navigator.onLine,T.addEventListener("online",function(){eo.areWeOnline=!0,eo.flush()}),T.addEventListener("offline",function(){eo.areWeOnline=!1}))}return s(to,[{key:"retriableRequest",value:function(ue){var eo=this,no=ue.retriesPerformedSoFar,ro=a(ue,ar);F(no)&&no>0&&(ro.url=ir(ro.url,{retry_count:no})),this.instance._send_request(t$1(t$1({},ro),{},{callback:function(oo){var io;oo.statusCode!==200&&(oo.statusCode<400||oo.statusCode>=500)&&(no??0)<10?eo.enqueue(t$1({retriesPerformedSoFar:no},ro)):(io=ro.callback)===null||io===void 0||io.call(ro,oo)}}))}},{key:"enqueue",value:function(ue){var eo=ue.retriesPerformedSoFar||0;ue.retriesPerformedSoFar=eo+1;var no=function(io){var ao=3e3*Math.pow(2,io),so=ao/2,lo=Math.min(18e5,ao),co=(Math.random()-.5)*(lo-so);return Math.ceil(lo+co)}(eo),ro=Date.now()+no;this.queue.push({retryAt:ro,requestOptions:ue});var oo="Enqueued failed request for retry in ".concat(no);navigator.onLine||(oo+=" (Browser is offline)"),G.warn(oo),this.isPolling||(this.isPolling=!0,this.poll())}},{key:"poll",value:function(){var ue=this;this.poller&&clearTimeout(this.poller),this.poller=setTimeout(function(){ue.areWeOnline&&ue.queue.length>0&&ue.flush(),ue.poll()},this.pollIntervalMs)}},{key:"flush",value:function(){var ue=Date.now(),eo=[],no=this.queue.filter(function(ao){return ao.retryAt<ue||(eo.push(ao),!1)});if(this.queue=eo,no.length>0){var ro,oo=h(no);try{for(oo.s();!(ro=oo.n()).done;){var io=ro.value.requestOptions;this.retriableRequest(io)}}catch(ao){oo.e(ao)}finally{oo.f()}}}},{key:"unload",value:function(){this.poller&&(clearTimeout(this.poller),this.poller=void 0);var ue,eo=h(this.queue);try{for(eo.s();!(ue=eo.n()).done;){var no=ue.value.requestOptions;try{this.instance._send_request(t$1(t$1({},no),{},{transport:"sendBeacon"}))}catch(ro){G.error(ro)}}}catch(ro){eo.e(ro)}finally{eo.f()}this.queue=[]}}]),to}(),cr=1800,dr=function(){function to(ue,eo,no,ro){var oo;i$1(this,to),o(this,"_sessionIdChangedHandlers",[]),this.config=ue,this.persistence=eo,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=no||Ke,this._windowIdGenerator=ro||Ke;var io=ue.persistence_name||ue.token,ao=ue.session_idle_timeout_seconds||cr;if(F(ao)?ao>cr?G.warn("session_idle_timeout_seconds cannot be greater than 30 minutes. Using 30 minutes instead."):ao<60&&G.warn("session_idle_timeout_seconds cannot be less than 60 seconds. Using 60 seconds instead."):(G.warn("session_idle_timeout_seconds must be a number. Defaulting to 30 minutes."),ao=cr),this._sessionTimeoutMs=1e3*Math.min(Math.max(ao,60),cr),this._window_id_storage_key="ph_"+io+"_window_id",this._primary_window_exists_storage_key="ph_"+io+"_primary_window_exists",this._canUseSessionStorage()){var so=ft.parse(this._window_id_storage_key),lo=ft.parse(this._primary_window_exists_storage_key);so&&!lo?this._windowId=so:ft.remove(this._window_id_storage_key),ft.set(this._primary_window_exists_storage_key,!0)}if((oo=this.config.bootstrap)!==null&&oo!==void 0&&oo.sessionID)try{var co=function(uo){var fo=uo.replace(/-/g,"");if(fo.length!==32)throw new Error("Not a valid UUID");if(fo[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(fo.substring(0,12),16)}(this.config.bootstrap.sessionID);this._setSessionId(this.config.bootstrap.sessionID,new Date().getTime(),co)}catch(uo){G.error("Invalid sessionID in bootstrap",uo)}this._listenToReloadWindow()}return s(to,[{key:"onSessionId",value:function(ue){var eo=this;return w$1(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(ue),this._sessionId&&ue(this._sessionId,this._windowId),function(){eo._sessionIdChangedHandlers=eo._sessionIdChangedHandlers.filter(function(no){return no!==ue})}}},{key:"_canUseSessionStorage",value:function(){return this.config.persistence!=="memory"&&!this.persistence.disabled&&ft.is_supported()}},{key:"_setWindowId",value:function(ue){ue!==this._windowId&&(this._windowId=ue,this._canUseSessionStorage()&&ft.set(this._window_id_storage_key,ue))}},{key:"_getWindowId",value:function(){return this._windowId?this._windowId:this._canUseSessionStorage()?ft.parse(this._window_id_storage_key):null}},{key:"_setSessionId",value:function(ue,eo,no){ue===this._sessionId&&eo===this._sessionActivityTimestamp&&no===this._sessionStartTimestamp||(this._sessionStartTimestamp=no,this._sessionActivityTimestamp=eo,this._sessionId=ue,this.persistence.register(o({},Se,[eo,ue,no])))}},{key:"_getSessionId",value:function(){if(this._sessionId&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this._sessionId,this._sessionStartTimestamp];var ue=this.persistence.props[Se];return m(ue)&&ue.length===2&&ue.push(ue[0]),ue||[0,null,0]}},{key:"resetSessionId",value:function(){this._setSessionId(null,null,null)}},{key:"_listenToReloadWindow",value:function(){var ue=this;T==null||T.addEventListener("beforeunload",function(){ue._canUseSessionStorage()&&ft.remove(ue._primary_window_exists_storage_key)})}},{key:"checkAndGetSessionAndWindowId",value:function(){var ue=arguments.length>0&&arguments[0]!==void 0&&arguments[0],eo=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:null)||new Date().getTime(),no=u(this._getSessionId(),3),ro=no[0],oo=no[1],io=no[2],ao=this._getWindowId(),so=io&&io>0&&Math.abs(eo-io)>864e5,lo=!1,co=!oo,uo=!ue&&Math.abs(eo-ro)>this._sessionTimeoutMs;co||uo||so?(oo=this._sessionIdGenerator(),ao=this._windowIdGenerator(),G.info("[SessionId] new session ID generated",{sessionId:oo,windowId:ao,changeReason:{noSessionId:co,activityTimeout:uo,sessionPastMaximumLength:so}}),io=eo,lo=!0):ao||(ao=this._windowIdGenerator(),lo=!0);var fo=ro===0||!ue||so?eo:ro,po=io===0?new Date().getTime():io;return this._setWindowId(ao),this._setSessionId(oo,fo,po),lo&&this._sessionIdChangedHandlers.forEach(function(ho){return ho(oo,ao)}),{sessionId:oo,windowId:ao,sessionStartTimestamp:po}}}]),to}();(function(to){to.US="us",to.EU="eu",to.CUSTOM="custom"})(ur||(ur={}));var hr="i.posthog.com",fr=function(){function to(ue){i$1(this,to),o(this,"_regionCache",{}),this.instance=ue}return s(to,[{key:"apiHost",get:function(){var ue=this.instance.config.api_host.trim().replace(/\/$/,"");return ue==="https://app.posthog.com"?"https://us.i.posthog.com":ue}},{key:"uiHost",get:function(){var ue,eo=(ue=this.instance.config.ui_host)===null||ue===void 0?void 0:ue.replace(/\/$/,"");return eo||(eo=this.apiHost.replace(".".concat(hr),".posthog.com")),eo==="https://app.posthog.com"?"https://us.posthog.com":eo}},{key:"region",get:function(){return this._regionCache[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=ur.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=ur.EU:this._regionCache[this.apiHost]=ur.CUSTOM),this._regionCache[this.apiHost]}},{key:"endpointFor",value:function(ue){var eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";if(eo&&(eo=eo[0]==="/"?eo:"/".concat(eo)),ue==="ui")return this.uiHost+eo;if(this.region===ur.CUSTOM)return this.apiHost+eo;var no=hr+eo;switch(ue){case"assets":return"https://".concat(this.region,"-assets.").concat(no);case"api":return"https://".concat(this.region,".").concat(no)}}},{key:"loadScript",value:function(ue,eo){if(this.instance.config.disable_external_dependency_loading)return G.warn("".concat(ue," was requested but loading of external scripts is disabled.")),eo("Loading of external scripts is disabled");var no=ue[0]==="/"?this.endpointFor("assets",ue):ue,ro=function(){if(!L)return eo("document not found");var oo=L.createElement("script");oo.type="text/javascript",oo.src=no,oo.onload=function(so){return eo(void 0,so)},oo.onerror=function(so){return eo(so)};var io,ao=L.querySelectorAll("body > script");ao.length>0?(io=ao[0].parentNode)===null||io===void 0||io.insertBefore(oo,ao[0]):L.body.appendChild(oo)};L!=null&&L.body?ro():L==null||L.addEventListener("DOMContentLoaded",ro)}}]),to}(),vr="posthog-js";function pr(to){var ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},eo=ue.organization,no=ue.projectId,ro=ue.prefix,oo=ue.severityAllowList,io=oo===void 0?["error"]:oo;return function(ao){var so,lo,co,uo,fo;if(!(io==="*"||io.includes(ao.level))||!to.__loaded)return ao;ao.tags||(ao.tags={});var po=to.requestRouter.endpointFor("ui","/project/".concat(to.config.token,"/person/").concat(to.get_distinct_id()));ao.tags["PostHog Person URL"]=po,to.sessionRecordingStarted()&&(ao.tags["PostHog Recording URL"]=to.get_session_replay_url({withTimestamp:!0}));var ho=((so=ao.exception)===null||so===void 0?void 0:so.values)||[],_o={$exception_message:((lo=ho[0])===null||lo===void 0?void 0:lo.value)||ao.message,$exception_type:(co=ho[0])===null||co===void 0?void 0:co.type,$exception_personURL:po,$exception_level:ao.level,$sentry_event_id:ao.event_id,$sentry_exception:ao.exception,$sentry_exception_message:((uo=ho[0])===null||uo===void 0?void 0:uo.value)||ao.message,$sentry_exception_type:(fo=ho[0])===null||fo===void 0?void 0:fo.type,$sentry_tags:ao.tags,$level:ao.level};return eo&&no&&(_o.$sentry_url=(ro||"https://sentry.io/organizations/")+eo+"/issues/?project="+no+"&query="+ao.event_id),to.exceptions.sendExceptionEvent(_o),ao}}var gr=s(function to(ue,eo,no,ro,oo){i$1(this,to),this.name=vr,this.setupOnce=function(io){io(pr(ue,{organization:eo,projectId:no,prefix:ro,severityAllowList:oo}))}});function _r(to,ue){var eo=to.config.segment;if(!eo)return ue();(function(no,ro){var oo=no.config.segment;if(!oo)return ro();var io=function(so){var lo=function(){return so.anonymousId()||Ke()};no.config.get_device_id=lo,so.id()&&(no.register({distinct_id:so.id(),$device_id:lo()}),no.persistence.set_property($e,"identified")),ro()},ao=oo.user();"then"in ao&&y(ao.then)?ao.then(function(so){return io(so)}):io(ao)})(to,function(){eo.register(function(no){Promise&&Promise.resolve||G.warn("This browser does not have Promise support, and can not use the segment integration");var ro=function(oo,io){var ao;if(!io)return oo;oo.event.userId||oo.event.anonymousId===no.get_distinct_id()||(G.info("Segment integration does not have a userId set, resetting PostHog"),no.reset()),oo.event.userId&&oo.event.userId!==no.get_distinct_id()&&(G.info("Segment integration has a userId set, identifying with PostHog"),no.identify(oo.event.userId));var so=no._calculate_event_properties(io,(ao=oo.event.properties)!==null&&ao!==void 0?ao:{},new Date);return oo.event.properties=Object.assign({},so,oo.event.properties),oo};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:function(){return!0},load:function(){return Promise.resolve()},track:function(oo){return ro(oo,oo.event.event)},page:function(oo){return ro(oo,"$pageview")},identify:function(oo){return ro(oo,"$identify")},screen:function(oo){return ro(oo,"$screen")}}}(to)).then(function(){ue()})})}var mr,yr,br,kr=function(){function to(ue){i$1(this,to),this._instance=ue}return s(to,[{key:"doPageView",value:function(ue){var eo,no=this._previousPageViewProperties(ue);return this._currentPath=(eo=T==null?void 0:T.location.pathname)!==null&&eo!==void 0?eo:"",this._instance.scrollManager.resetContext(),this._prevPageviewTimestamp=ue,no}},{key:"doPageLeave",value:function(ue){return this._previousPageViewProperties(ue)}},{key:"_previousPageViewProperties",value:function(ue){var eo=this._currentPath,no=this._prevPageviewTimestamp,ro=this._instance.scrollManager.getContext();if(!no)return{};var oo={};if(ro){var io=ro.maxScrollHeight,ao=ro.lastScrollY,so=ro.maxScrollY,lo=ro.maxContentHeight,co=ro.lastContentY,uo=ro.maxContentY;w$1(io)||w$1(ao)||w$1(so)||w$1(lo)||w$1(co)||w$1(uo)||(io=Math.ceil(io),ao=Math.ceil(ao),so=Math.ceil(so),lo=Math.ceil(lo),co=Math.ceil(co),uo=Math.ceil(uo),oo={$prev_pageview_last_scroll:ao,$prev_pageview_last_scroll_percentage:io<=1?1:wr(ao/io,0,1),$prev_pageview_max_scroll:so,$prev_pageview_max_scroll_percentage:io<=1?1:wr(so/io,0,1),$prev_pageview_last_content:co,$prev_pageview_last_content_percentage:lo<=1?1:wr(co/lo,0,1),$prev_pageview_max_content:uo,$prev_pageview_max_content_percentage:lo<=1?1:wr(uo/lo,0,1)})}return eo&&(oo.$prev_pageview_pathname=eo),no&&(oo.$prev_pageview_duration=(ue.getTime()-no.getTime())/1e3),oo}}]),to}();function wr(to,ue,eo){return Math.max(ue,Math.min(to,eo))}(function(to){to.Popover="popover",to.API="api",to.Widget="widget"})(mr||(mr={})),function(to){to.Open="open",to.MultipleChoice="multiple_choice",to.SingleChoice="single_choice",to.Rating="rating",to.Link="link"}(yr||(yr={})),function(to){to.NextQuestion="next_question",to.End="end",to.ResponseBased="response_based",to.SpecificQuestion="specific_question"}(br||(br={}));var Sr=function(){function to(){i$1(this,to),o(this,"events",{}),this.events={}}return s(to,[{key:"on",value:function(ue,eo){var no=this;return this.events[ue]||(this.events[ue]=[]),this.events[ue].push(eo),function(){no.events[ue]=no.events[ue].filter(function(ro){return ro!==eo})}}},{key:"emit",value:function(ue,eo){var no,ro=h(this.events[ue]||[]);try{for(ro.s();!(no=ro.n()).done;)(0,no.value)(eo)}catch(ao){ro.e(ao)}finally{ro.f()}var oo,io=h(this.events["*"]||[]);try{for(io.s();!(oo=io.n()).done;)(0,oo.value)(ue,eo)}catch(ao){io.e(ao)}finally{io.f()}}}]),to}(),Er=function(){function to(ue){var eo=this;i$1(this,to),o(this,"_debugEventEmitter",new Sr),o(this,"checkStep",function(no,ro){return eo.checkStepEvent(no,ro)&&eo.checkStepUrl(no,ro)&&eo.checkStepElement(no,ro)}),o(this,"checkStepEvent",function(no,ro){return ro==null||!ro.event||(no==null?void 0:no.event)===(ro==null?void 0:ro.event)}),this.instance=ue,this.actionEvents=new Set,this.actionRegistry=new Set}return s(to,[{key:"init",value:function(){var ue,eo=this;if(!w$1((ue=this.instance)===null||ue===void 0?void 0:ue._addCaptureHook)){var no;(no=this.instance)===null||no===void 0||no._addCaptureHook(function(ro,oo){eo.on(ro,oo)})}}},{key:"register",value:function(ue){var eo,no,ro=this;if(!w$1((eo=this.instance)===null||eo===void 0?void 0:eo._addCaptureHook)&&(ue.forEach(function(ao){var so,lo;(so=ro.actionRegistry)===null||so===void 0||so.add(ao),(lo=ao.steps)===null||lo===void 0||lo.forEach(function(co){var uo;(uo=ro.actionEvents)===null||uo===void 0||uo.add((co==null?void 0:co.event)||"")})}),(no=this.instance)!==null&&no!==void 0&&no.autocapture)){var oo,io=new Set;ue.forEach(function(ao){var so;(so=ao.steps)===null||so===void 0||so.forEach(function(lo){lo!=null&&lo.selector&&io.add(lo==null?void 0:lo.selector)})}),(oo=this.instance)===null||oo===void 0||oo.autocapture.setElementSelectors(io)}}},{key:"on",value:function(ue,eo){var no,ro=this;eo!=null&&ue.length!=0&&(this.actionEvents.has(ue)||this.actionEvents.has(eo==null?void 0:eo.event))&&this.actionRegistry&&((no=this.actionRegistry)===null||no===void 0?void 0:no.size)>0&&this.actionRegistry.forEach(function(oo){ro.checkAction(eo,oo)&&ro._debugEventEmitter.emit("actionCaptured",oo.name)})}},{key:"_addActionHook",value:function(ue){this.onAction("actionCaptured",function(eo){return ue(eo)})}},{key:"checkAction",value:function(ue,eo){if((eo==null?void 0:eo.steps)==null)return!1;var no,ro=h(eo.steps);try{for(ro.s();!(no=ro.n()).done;){var oo=no.value;if(this.checkStep(ue,oo))return!0}}catch(io){ro.e(io)}finally{ro.f()}return!1}},{key:"onAction",value:function(ue,eo){return this._debugEventEmitter.on(ue,eo)}},{key:"checkStepUrl",value:function(ue,eo){if(eo!=null&&eo.url){var no,ro=ue==null||(no=ue.properties)===null||no===void 0?void 0:no.$current_url;if(!ro||typeof ro!="string"||!to.matchString(ro,eo==null?void 0:eo.url,(eo==null?void 0:eo.url_matching)||"contains"))return!1}return!0}},{key:"checkStepElement",value:function(ue,eo){if((eo!=null&&eo.href||eo!=null&&eo.tag_name||eo!=null&&eo.text)&&!this.getElementsList(ue).some(function(oo){return!(eo!=null&&eo.href&&!to.matchString(oo.href||"",eo==null?void 0:eo.href,(eo==null?void 0:eo.href_matching)||"exact"))&&(eo==null||!eo.tag_name||oo.tag_name===(eo==null?void 0:eo.tag_name))&&!(eo!=null&&eo.text&&!to.matchString(oo.text||"",eo==null?void 0:eo.text,(eo==null?void 0:eo.text_matching)||"exact")&&!to.matchString(oo.$el_text||"",eo==null?void 0:eo.text,(eo==null?void 0:eo.text_matching)||"exact"))}))return!1;if(eo!=null&&eo.selector){var no,ro=ue==null||(no=ue.properties)===null||no===void 0?void 0:no.$element_selectors;if(!ro||!ro.includes(eo==null?void 0:eo.selector))return!1}return!0}},{key:"getElementsList",value:function(ue){return(ue==null?void 0:ue.properties.$elements)==null?[]:ue==null?void 0:ue.properties.$elements}}],[{key:"matchString",value:function(ue,eo,no){switch(no){case"regex":return!!T&>(ue,eo);case"exact":return eo===ue;case"contains":var ro=to.escapeStringRegexp(eo).replace(/_/g,".").replace(/%/g,".*");return gt(ue,ro);default:return!1}}},{key:"escapeStringRegexp",value:function(ue){return ue.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}}]),to}(),Ir=function(){function to(ue){i$1(this,to),this.instance=ue,this.eventToSurveys=new Map,this.actionToSurveys=new Map}return s(to,[{key:"register",value:function(ue){var eo;w$1((eo=this.instance)===null||eo===void 0?void 0:eo._addCaptureHook)||(this.setupEventBasedSurveys(ue),this.setupActionBasedSurveys(ue))}},{key:"setupActionBasedSurveys",value:function(ue){var eo=this,no=ue.filter(function(ro){var oo,io,ao,so;return((oo=ro.conditions)===null||oo===void 0?void 0:oo.actions)&&((io=ro.conditions)===null||io===void 0||(ao=io.actions)===null||ao===void 0||(so=ao.values)===null||so===void 0?void 0:so.length)>0});no.length!==0&&(this.actionMatcher==null&&(this.actionMatcher=new Er(this.instance),this.actionMatcher.init(),this.actionMatcher._addActionHook(function(ro){eo.onAction(ro)})),no.forEach(function(ro){var oo,io,ao,so,lo,co,uo,fo,po,ho;ro.conditions&&(oo=ro.conditions)!==null&&oo!==void 0&&oo.actions&&(io=ro.conditions)!==null&&io!==void 0&&(ao=io.actions)!==null&&ao!==void 0&&ao.values&&((so=ro.conditions)===null||so===void 0||(lo=so.actions)===null||lo===void 0||(co=lo.values)===null||co===void 0?void 0:co.length)>0&&((uo=eo.actionMatcher)===null||uo===void 0||uo.register(ro.conditions.actions.values),(fo=ro.conditions)===null||fo===void 0||(po=fo.actions)===null||po===void 0||(ho=po.values)===null||ho===void 0||ho.forEach(function(_o){if(_o&&_o.name){var go=eo.actionToSurveys.get(_o.name);go&&go.push(ro.id),eo.actionToSurveys.set(_o.name,go||[ro.id])}}))}))}},{key:"setupEventBasedSurveys",value:function(ue){var eo,no=this;ue.filter(function(ro){var oo,io,ao,so;return((oo=ro.conditions)===null||oo===void 0?void 0:oo.events)&&((io=ro.conditions)===null||io===void 0||(ao=io.events)===null||ao===void 0||(so=ao.values)===null||so===void 0?void 0:so.length)>0}).length!==0&&((eo=this.instance)===null||eo===void 0||eo._addCaptureHook(function(ro,oo){no.onEvent(ro,oo)}),ue.forEach(function(ro){var oo,io,ao;(oo=ro.conditions)===null||oo===void 0||(io=oo.events)===null||io===void 0||(ao=io.values)===null||ao===void 0||ao.forEach(function(so){if(so&&so.name){var lo=no.eventToSurveys.get(so.name);lo&&lo.push(ro.id),no.eventToSurveys.set(so.name,lo||[ro.id])}})}))}},{key:"onEvent",value:function(ue,eo){var no,ro,oo=((no=this.instance)===null||no===void 0||(ro=no.persistence)===null||ro===void 0?void 0:ro.props[Te])||[];if(to.SURVEY_SHOWN_EVENT_NAME==ue&&eo&&oo.length>0){var io,ao=eo==null||(io=eo.properties)===null||io===void 0?void 0:io.$survey_id;if(ao){var so=oo.indexOf(ao);so>=0&&(oo.splice(so,1),this._updateActivatedSurveys(oo))}}else this.eventToSurveys.has(ue)&&this._updateActivatedSurveys(oo.concat(this.eventToSurveys.get(ue)||[]))}},{key:"onAction",value:function(ue){var eo,no,ro=((eo=this.instance)===null||eo===void 0||(no=eo.persistence)===null||no===void 0?void 0:no.props[Te])||[];this.actionToSurveys.has(ue)&&this._updateActivatedSurveys(ro.concat(this.actionToSurveys.get(ue)||[]))}},{key:"_updateActivatedSurveys",value:function(ue){var eo,no;(eo=this.instance)===null||eo===void 0||(no=eo.persistence)===null||no===void 0||no.register(o({},Te,l(new Set(ue))))}},{key:"getSurveys",value:function(){var ue,eo,no=(ue=this.instance)===null||ue===void 0||(eo=ue.persistence)===null||eo===void 0?void 0:eo.props[Te];return no||[]}},{key:"getEventToSurveys",value:function(){return this.eventToSurveys}},{key:"_getActionMatcher",value:function(){return this.actionMatcher}}]),to}();o(Ir,"SURVEY_SHOWN_EVENT_NAME","survey shown");var Rr="[Surveys]",Fr={icontains:function(to){return!!T&&T.location.href.toLowerCase().indexOf(to.toLowerCase())>-1},not_icontains:function(to){return!!T&&T.location.href.toLowerCase().indexOf(to.toLowerCase())===-1},regex:function(to){return!!T&>(T.location.href,to)},not_regex:function(to){return!!T&&!gt(T.location.href,to)},exact:function(to){return(T==null?void 0:T.location.href)===to},is_not:function(to){return(T==null?void 0:T.location.href)!==to}},xr=function(){function to(ue){i$1(this,to),this.instance=ue,this._surveyEventReceiver=null}return s(to,[{key:"afterDecideResponse",value:function(ue){this._decideServerResponse=!!ue.surveys,this.loadIfEnabled()}},{key:"loadIfEnabled",value:function(){var ue=this,eo=U==null?void 0:U.extendPostHogWithSurveys;this.instance.config.disable_surveys||!this._decideServerResponse||eo||(this._surveyEventReceiver==null&&(this._surveyEventReceiver=new Ir(this.instance)),this.instance.requestRouter.loadScript("/static/surveys.js",function(no){if(no)return G.error(Rr,"Could not load surveys script",no);ue._surveyManager=U.extendPostHogWithSurveys(ue.instance)}))}},{key:"getSurveys",value:function(ue){var eo=this,no=arguments.length>1&&arguments[1]!==void 0&&arguments[1];if(this.instance.config.disable_surveys)return ue([]);this._surveyEventReceiver==null&&(this._surveyEventReceiver=new Ir(this.instance));var ro=this.instance.get_property(Pe);if(ro&&!no)return ue(ro);this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/surveys/?token=".concat(this.instance.config.token)),method:"GET",transport:"XHR",callback:function(oo){var io;if(oo.statusCode!==200||!oo.json)return ue([]);var ao,so=oo.json.surveys||[],lo=so.filter(function(co){var uo,fo,po,ho,_o,go,bo,vo,yo,wo,ko,So;return((uo=co.conditions)===null||uo===void 0?void 0:uo.events)&&((fo=co.conditions)===null||fo===void 0||(po=fo.events)===null||po===void 0?void 0:po.values)&&((ho=co.conditions)===null||ho===void 0||(_o=ho.events)===null||_o===void 0||(go=_o.values)===null||go===void 0?void 0:go.length)>0||((bo=co.conditions)===null||bo===void 0?void 0:bo.actions)&&((vo=co.conditions)===null||vo===void 0||(yo=vo.actions)===null||yo===void 0?void 0:yo.values)&&((wo=co.conditions)===null||wo===void 0||(ko=wo.actions)===null||ko===void 0||(So=ko.values)===null||So===void 0?void 0:So.length)>0});return lo.length>0&&((ao=eo._surveyEventReceiver)===null||ao===void 0||ao.register(lo)),(io=eo.instance.persistence)===null||io===void 0||io.register(o({},Pe,so)),ue(so)}})}},{key:"getActiveMatchingSurveys",value:function(ue){var eo=this,no=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.getSurveys(function(ro){var oo,io=ro.filter(function(lo){return!(!lo.start_date||lo.end_date)}).filter(function(lo){var co,uo,fo,po;if(!lo.conditions)return!0;var ho=(co=lo.conditions)===null||co===void 0||!co.url||Fr[(uo=(fo=lo.conditions)===null||fo===void 0?void 0:fo.urlMatchType)!==null&&uo!==void 0?uo:"icontains"](lo.conditions.url),_o=(po=lo.conditions)===null||po===void 0||!po.selector||(L==null?void 0:L.querySelector(lo.conditions.selector));return ho&&_o}),ao=(oo=eo._surveyEventReceiver)===null||oo===void 0?void 0:oo.getSurveys(),so=io.filter(function(lo){var co,uo,fo,po,ho,_o,go,bo,vo,yo;if(!lo.linked_flag_key&&!lo.targeting_flag_key&&!lo.internal_targeting_flag_key)return!0;var wo=!lo.linked_flag_key||eo.instance.featureFlags.isFeatureEnabled(lo.linked_flag_key),ko=!lo.targeting_flag_key||eo.instance.featureFlags.isFeatureEnabled(lo.targeting_flag_key),So=((co=lo.conditions)===null||co===void 0?void 0:co.events)&&((uo=lo.conditions)===null||uo===void 0||(fo=uo.events)===null||fo===void 0?void 0:fo.values)&&((po=lo.conditions)===null||po===void 0||(ho=po.events)===null||ho===void 0?void 0:ho.values.length)>0,Eo=((_o=lo.conditions)===null||_o===void 0?void 0:_o.actions)&&((go=lo.conditions)===null||go===void 0||(bo=go.actions)===null||bo===void 0?void 0:bo.values)&&((vo=lo.conditions)===null||vo===void 0||(yo=vo.actions)===null||yo===void 0?void 0:yo.values.length)>0,Io=!So&&!Eo||(ao==null?void 0:ao.includes(lo.id)),Ao=eo._canActivateRepeatedly(lo),To=!(lo.internal_targeting_flag_key&&!Ao)||eo.instance.featureFlags.isFeatureEnabled(lo.internal_targeting_flag_key);return wo&&ko&&To&&Io});return ue(so)},no)}},{key:"getNextSurveyStep",value:function(ue,eo,no){var ro,oo=ue.questions[eo],io=eo+1;if((ro=oo.branching)===null||ro===void 0||!ro.type)return eo===ue.questions.length-1?br.End:io;if(oo.branching.type===br.End)return br.End;if(oo.branching.type===br.SpecificQuestion){if(Number.isInteger(oo.branching.index))return oo.branching.index}else if(oo.branching.type===br.ResponseBased){if(oo.type===yr.SingleChoice){var ao,so,lo=oo.choices.indexOf("".concat(no));if((ao=oo.branching)!==null&&ao!==void 0&&(so=ao.responseValues)!==null&&so!==void 0&&so.hasOwnProperty(lo)){var co=oo.branching.responseValues[lo];return Number.isInteger(co)?co:co===br.End?br.End:io}}else if(oo.type===yr.Rating){var uo,fo;if(typeof no!="number"||!Number.isInteger(no))throw new Error("The response type must be an integer");var po=function(_o,go){if(go===3){if(_o<1||_o>3)throw new Error("The response must be in range 1-3");return _o===1?"negative":_o===2?"neutral":"positive"}if(go===5){if(_o<1||_o>5)throw new Error("The response must be in range 1-5");return _o<=2?"negative":_o===3?"neutral":"positive"}if(go===10){if(_o<0||_o>10)throw new Error("The response must be in range 0-10");return _o<=6?"detractors":_o<=8?"passives":"promoters"}throw new Error("The scale must be one of: 3, 5, 10")}(no,oo.scale);if((uo=oo.branching)!==null&&uo!==void 0&&(fo=uo.responseValues)!==null&&fo!==void 0&&fo.hasOwnProperty(po)){var ho=oo.branching.responseValues[po];return Number.isInteger(ho)?ho:ho===br.End?br.End:io}}return io}return G.warn(Rr,"Falling back to next question index due to unexpected branching type"),io}},{key:"_canActivateRepeatedly",value:function(ue){return R(U.__PosthogExtensions__.canActivateRepeatedly)&&G.warn(Rr,"canActivateRepeatedly is not defined, must init before calling"),U.__PosthogExtensions__.canActivateRepeatedly(ue)}},{key:"canRenderSurvey",value:function(ue){var eo=this;R(this._surveyManager)?G.warn(Rr,"canActivateRepeatedly is not defined, must init before calling"):this.getSurveys(function(no){var ro=no.filter(function(oo){return oo.id===ue})[0];eo._surveyManager.canRenderSurvey(ro)})}},{key:"renderSurvey",value:function(ue,eo){var no=this;R(this._surveyManager)?G.warn(Rr,"canActivateRepeatedly is not defined, must init before calling"):this.getSurveys(function(ro){var oo=ro.filter(function(io){return io.id===ue})[0];no._surveyManager.renderSurvey(oo,L==null?void 0:L.querySelector(eo))})}}]),to}(),Pr=function(){function to(ue){var eo,no,ro=this;i$1(this,to),o(this,"serverLimits",{}),o(this,"lastEventRateLimited",!1),o(this,"checkForLimiting",function(oo){var io=oo.text;if(io&&io.length)try{(JSON.parse(io).quota_limited||[]).forEach(function(ao){G.info("[RateLimiter] ".concat(ao||"events"," is quota limited.")),ro.serverLimits[ao]=new Date().getTime()+6e4})}catch(ao){return void G.warn('[RateLimiter] could not rate limit - continuing. Error: "'.concat(ao==null?void 0:ao.message,'"'),{text:io})}}),this.instance=ue,this.captureEventsPerSecond=((eo=ue.config.rate_limiting)===null||eo===void 0?void 0:eo.events_per_second)||10,this.captureEventsBurstLimit=Math.max(((no=ue.config.rate_limiting)===null||no===void 0?void 0:no.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}return s(to,[{key:"clientRateLimitContext",value:function(){var ue,eo,no,ro=arguments.length>0&&arguments[0]!==void 0&&arguments[0],oo=new Date().getTime(),io=(ue=(eo=this.instance.persistence)===null||eo===void 0?void 0:eo.get_property(Me))!==null&&ue!==void 0?ue:{tokens:this.captureEventsBurstLimit,last:oo};io.tokens+=(oo-io.last)/1e3*this.captureEventsPerSecond,io.last=oo,io.tokens>this.captureEventsBurstLimit&&(io.tokens=this.captureEventsBurstLimit);var ao=io.tokens<1;return ao||ro||(io.tokens=Math.max(0,io.tokens-1)),!ao||this.lastEventRateLimited||ro||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to ".concat(this.captureEventsPerSecond," events per second and ").concat(this.captureEventsBurstLimit," events burst limit.")},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=ao,(no=this.instance.persistence)===null||no===void 0||no.set_property(Me,io),{isRateLimited:ao,remainingTokens:io.tokens}}},{key:"isServerRateLimited",value:function(ue){var eo=this.serverLimits[ue||"events"]||!1;return eo!==!1&&new Date().getTime()<eo}}]),to}(),Tr=function(){return t$1({initialPathName:(D==null?void 0:D.pathname)||"",referringDomain:mn.referringDomain()},mn.campaignParams())},Cr=function(){function to(ue,eo,no){var ro=this;i$1(this,to),o(this,"_onSessionIdCallback",function(oo){var io=ro._getStoredProps();if(!io||io.sessionId!==oo){var ao={sessionId:oo,props:ro._sessionSourceParamGenerator()};ro._persistence.register(o({},Oe,ao))}}),this._sessionIdManager=ue,this._persistence=eo,this._sessionSourceParamGenerator=no||Tr,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}return s(to,[{key:"_getStoredProps",value:function(){return this._persistence.props[Oe]}},{key:"getSessionProps",value:function(){var ue,eo=(ue=this._getStoredProps())===null||ue===void 0?void 0:ue.props;return eo?{$client_session_initial_referring_host:eo.referringDomain,$client_session_initial_pathname:eo.initialPathName,$client_session_initial_utm_source:eo.utm_source,$client_session_initial_utm_campaign:eo.utm_campaign,$client_session_initial_utm_medium:eo.utm_medium,$client_session_initial_utm_content:eo.utm_content,$client_session_initial_utm_term:eo.utm_term}:{}}}]),to}(),$r=["ahrefsbot","ahrefssiteaudit","applebot","baiduspider","bingbot","bingpreview","bot.htm","bot.php","crawler","deepscan","duckduckbot","facebookexternal","facebookcatalog","gptbot","http://yandex.com/bots","hubspot","ia_archiver","linkedinbot","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","semrushbot","sitebulb","slurp","turnitin","twitterbot","vercelbot","yahoo! slurp","yandexbot","headlesschrome","cypress","Google-HotelAdsVerifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google","Bytespider;"],Or=function(to,ue){if(!to)return!1;var eo=to.toLowerCase();return $r.concat(ue||[]).some(function(no){var ro=no.toLowerCase();return eo.indexOf(ro)!==-1})},Mr=function(){function to(){i$1(this,to),this.clicks=[]}return s(to,[{key:"isRageClick",value:function(ue,eo,no){var ro=this.clicks[this.clicks.length-1];if(ro&&Math.abs(ue-ro.x)+Math.abs(eo-ro.y)<30&&no-ro.timestamp<1e3){if(this.clicks.push({x:ue,y:eo,timestamp:no}),this.clicks.length===3)return!0}else this.clicks=[{x:ue,y:eo,timestamp:no}];return!1}}]),to}();function Ar(to){var ue;return to.id===Ne||!((ue=to.closest)===null||ue===void 0||!ue.call(to,"#"+Ne))}var Lr=function(){function to(ue){var eo,no=this;i$1(this,to),o(this,"rageclicks",new Mr),o(this,"_enabledServerSide",!1),o(this,"_initialized",!1),o(this,"_flushInterval",null),this.instance=ue,this._enabledServerSide=!((eo=this.instance.persistence)===null||eo===void 0||!eo.props[fe]),T==null||T.addEventListener("beforeunload",function(){no.flush()})}return s(to,[{key:"flushIntervalMilliseconds",get:function(){var ue=5e3;return b(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(ue=this.instance.config.capture_heatmaps.flush_interval_milliseconds),ue}},{key:"isEnabled",get:function(){return w$1(this.instance.config.capture_heatmaps)?w$1(this.instance.config.enable_heatmaps)?this._enabledServerSide:this.instance.config.enable_heatmaps:this.instance.config.capture_heatmaps!==!1}},{key:"startIfEnabled",value:function(){if(this.isEnabled){if(this._initialized)return;G.info("[heatmaps] starting..."),this._setupListeners(),this._flushInterval=setInterval(this.flush.bind(this),this.flushIntervalMilliseconds)}else{var ue;clearInterval((ue=this._flushInterval)!==null&&ue!==void 0?ue:void 0),this.getAndClearBuffer()}}},{key:"afterDecideResponse",value:function(ue){var eo=!!ue.heatmaps;this.instance.persistence&&this.instance.persistence.register(o({},fe,eo)),this._enabledServerSide=eo,this.startIfEnabled()}},{key:"getAndClearBuffer",value:function(){var ue=this.buffer;return this.buffer=void 0,ue}},{key:"_setupListeners",value:function(){var ue=this;T&&L&&(oe(L,"click",function(eo){return ue._onClick(eo||(T==null?void 0:T.event))},!1,!0),oe(L,"mousemove",function(eo){return ue._onMouseMove(eo||(T==null?void 0:T.event))},!1,!0),this._initialized=!0)}},{key:"_getProperties",value:function(ue,eo){var no=this.instance.scrollManager.scrollY(),ro=this.instance.scrollManager.scrollX(),oo=this.instance.scrollManager.scrollElement(),io=function(ao,so,lo){for(var co=ao;co&&!On(co,"body");){if(co===lo)return!1;if(Y(so,T==null?void 0:T.getComputedStyle(co).position))return!0;co=Dn(co)}return!1}(ue.target,["fixed","sticky"],oo);return{x:ue.clientX+(io?0:ro),y:ue.clientY+(io?0:no),target_fixed:io,type:eo}}},{key:"_onClick",value:function(ue){var eo;if(!Ar(ue.target)){var no=this._getProperties(ue,"click");(eo=this.rageclicks)!==null&&eo!==void 0&&eo.isRageClick(ue.clientX,ue.clientY,new Date().getTime())&&this._capture(t$1(t$1({},no),{},{type:"rageclick"})),this._capture(no)}}},{key:"_onMouseMove",value:function(ue){var eo=this;Ar(ue.target)||(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout(function(){eo._capture(eo._getProperties(ue,"mousemove"))},500))}},{key:"_capture",value:function(ue){if(T){var eo=T.location.href;this.buffer=this.buffer||{},this.buffer[eo]||(this.buffer[eo]=[]),this.buffer[eo].push(ue)}}},{key:"flush",value:function(){this.buffer&&!k(this.buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}]),to}(),Dr=function(){function to(ue){var eo=this;i$1(this,to),o(this,"_updateScrollData",function(){var no,ro,oo,io;eo.context||(eo.context={});var ao=eo.scrollElement(),so=eo.scrollY(),lo=ao?Math.max(0,ao.scrollHeight-ao.clientHeight):0,co=so+((ao==null?void 0:ao.clientHeight)||0),uo=(ao==null?void 0:ao.scrollHeight)||0;eo.context.lastScrollY=Math.ceil(so),eo.context.maxScrollY=Math.max(so,(no=eo.context.maxScrollY)!==null&&no!==void 0?no:0),eo.context.maxScrollHeight=Math.max(lo,(ro=eo.context.maxScrollHeight)!==null&&ro!==void 0?ro:0),eo.context.lastContentY=co,eo.context.maxContentY=Math.max(co,(oo=eo.context.maxContentY)!==null&&oo!==void 0?oo:0),eo.context.maxContentHeight=Math.max(uo,(io=eo.context.maxContentHeight)!==null&&io!==void 0?io:0)}),this.instance=ue}return s(to,[{key:"getContext",value:function(){return this.context}},{key:"resetContext",value:function(){var ue=this.context;return setTimeout(this._updateScrollData,0),ue}},{key:"startMeasuringScrollPosition",value:function(){T==null||T.addEventListener("scroll",this._updateScrollData,!0),T==null||T.addEventListener("scrollend",this._updateScrollData,!0),T==null||T.addEventListener("resize",this._updateScrollData)}},{key:"scrollElement",value:function(){if(!this.instance.config.scroll_root_selector)return T==null?void 0:T.document.documentElement;var ue,eo=h(m(this.instance.config.scroll_root_selector)?this.instance.config.scroll_root_selector:[this.instance.config.scroll_root_selector]);try{for(eo.s();!(ue=eo.n()).done;){var no=ue.value,ro=T==null?void 0:T.document.querySelector(no);if(ro)return ro}}catch(oo){eo.e(oo)}finally{eo.f()}}},{key:"scrollY",value:function(){if(this.instance.config.scroll_root_selector){var ue=this.scrollElement();return ue&&ue.scrollTop||0}return T&&(T.scrollY||T.pageYOffset||T.document.documentElement.scrollTop)||0}},{key:"scrollX",value:function(){if(this.instance.config.scroll_root_selector){var ue=this.scrollElement();return ue&&ue.scrollLeft||0}return T&&(T.scrollX||T.pageXOffset||T.document.documentElement.scrollLeft)||0}}]),to}(),qr="$copy_autocapture";function Nr(to,ue){return ue.length>to?ue.slice(0,to)+"...":ue}var Br,Hr=function(){function to(ue){i$1(this,to),o(this,"_initialized",!1),o(this,"_isDisabledServerSide",null),o(this,"rageclicks",new Mr),o(this,"_elementsChainAsString",!1),this.instance=ue,this._elementSelectors=null}return s(to,[{key:"config",get:function(){var ue,eo,no=b(this.instance.config.autocapture)?this.instance.config.autocapture:{};return no.url_allowlist=(ue=no.url_allowlist)===null||ue===void 0?void 0:ue.map(function(ro){return new RegExp(ro)}),no.url_ignorelist=(eo=no.url_ignorelist)===null||eo===void 0?void 0:eo.map(function(ro){return new RegExp(ro)}),no}},{key:"_addDomEventHandlers",value:function(){var ue=this;if(this.isBrowserSupported()){if(T&&L){var eo=function(ro){ro=ro||(T==null?void 0:T.event);try{ue._captureEvent(ro)}catch(oo){G.error("Failed to capture event",oo)}},no=function(ro){ro=ro||(T==null?void 0:T.event),ue._captureEvent(ro,qr)};oe(L,"submit",eo,!1,!0),oe(L,"change",eo,!1,!0),oe(L,"click",eo,!1,!0),this.config.capture_copied_text&&(oe(L,"copy",no,!1,!0),oe(L,"cut",no,!1,!0))}}else G.info("Disabling Automatic Event Collection because this browser is not supported")}},{key:"startIfEnabled",value:function(){this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}},{key:"afterDecideResponse",value:function(ue){ue.elementsChainAsString&&(this._elementsChainAsString=ue.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register(o({},he,!!ue.autocapture_opt_out)),this._isDisabledServerSide=!!ue.autocapture_opt_out,this.startIfEnabled()}},{key:"setElementSelectors",value:function(ue){this._elementSelectors=ue}},{key:"getElementSelectors",value:function(ue){var eo,no=[];return(eo=this._elementSelectors)===null||eo===void 0||eo.forEach(function(ro){var oo=L==null?void 0:L.querySelectorAll(ro);oo==null||oo.forEach(function(io){ue===io&&no.push(ro)})}),no}},{key:"isEnabled",get:function(){var ue,eo,no=(ue=this.instance.persistence)===null||ue===void 0?void 0:ue.props[he],ro=this._isDisabledServerSide;if(I(ro)&&!x$1(no)&&!this.instance.config.advanced_disable_decide)return!1;var oo=(eo=this._isDisabledServerSide)!==null&&eo!==void 0?eo:!!no;return!!this.instance.config.autocapture&&!oo}},{key:"_previousElementSibling",value:function(ue){if(ue.previousElementSibling)return ue.previousElementSibling;var eo=ue;do eo=eo.previousSibling;while(eo&&!$n(eo));return eo}},{key:"_getAugmentPropertiesFromElement",value:function(ue){if(!Nn(ue))return{};var eo={};return Q(ue.attributes,function(no){if(no.name&&no.name.indexOf("data-ph-capture-attribute")===0){var ro=no.name.replace("data-ph-capture-attribute-",""),oo=no.value;ro&&oo&&zn(oo)&&(eo[ro]=oo)}}),eo}},{key:"_getPropertiesFromElement",value:function(ue,eo,no){var ro,oo=ue.tagName.toLowerCase(),io={tag_name:oo};Ln.indexOf(oo)>-1&&!no&&(oo.toLowerCase()==="a"||oo.toLowerCase()==="button"?io.$el_text=Nr(1024,Qn(ue)):io.$el_text=Nr(1024,Cn(ue)));var ao=Pn(ue);ao.length>0&&(io.classes=ao.filter(function(fo){return fo!==""}));var so=(ro=this.config)===null||ro===void 0?void 0:ro.element_attribute_ignorelist;Q(ue.attributes,function(fo){var po;if((!Bn(ue)||["name","id","class","aria-label"].indexOf(fo.name)!==-1)&&(so==null||!so.includes(fo.name))&&!eo&&zn(fo.value)&&(po=fo.name,!S(po)||po.substring(0,10)!=="_ngcontent"&&po.substring(0,7)!=="_nghost")){var ho=fo.value;fo.name==="class"&&(ho=Fn(ho).join(" ")),io["attr__"+fo.name]=Nr(1024,ho)}});for(var lo=1,co=1,uo=ue;uo=this._previousElementSibling(uo);)lo++,uo.tagName===ue.tagName&&co++;return io.nth_child=lo,io.nth_of_type=co,io}},{key:"_getDefaultProperties",value:function(ue){return{$event_type:ue,$ce_version:1}}},{key:"_getEventTarget",value:function(ue){return w$1(ue.target)?ue.srcElement||null:(eo=ue.target)!==null&&eo!==void 0&&eo.shadowRoot?ue.composedPath()[0]||null:ue.target||null;var eo}},{key:"_captureEvent",value:function(ue){var eo=this,no=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"$autocapture";if(this.isEnabled){var ro,oo=this._getEventTarget(ue);Mn(oo)&&(oo=oo.parentNode||null),no==="$autocapture"&&ue.type==="click"&&ue instanceof MouseEvent&&this.instance.config.rageclick&&(ro=this.rageclicks)!==null&&ro!==void 0&&ro.isRageClick(ue.clientX,ue.clientY,new Date().getTime())&&this._captureEvent(ue,"$rageclick");var io=no===qr;if(oo&&qn(oo,ue,this.config,io,io?["copy","cut"]:void 0)){for(var ao,so,lo=[oo],co=oo;co.parentNode&&!On(co,"body");)An(co.parentNode)?(lo.push(co.parentNode.host),co=co.parentNode.host):(lo.push(co.parentNode),co=co.parentNode);var uo,fo,po=[],ho={},_o=!1;if(Q(lo,function(Ao){var To=Nn(Ao);Ao.tagName.toLowerCase()==="a"&&(uo=Ao.getAttribute("href"),uo=To&&zn(uo)&&uo),Y(Pn(Ao),"ph-no-capture")&&(_o=!0),po.push(eo._getPropertiesFromElement(Ao,eo.instance.config.mask_all_element_attributes,eo.instance.config.mask_all_text));var Mo=eo._getAugmentPropertiesFromElement(Ao);J(ho,Mo)}),this.instance.config.mask_all_text||(oo.tagName.toLowerCase()==="a"||oo.tagName.toLowerCase()==="button"?po[0].$el_text=Qn(oo):po[0].$el_text=Cn(oo)),uo){var go,bo;po[0].attr__href=uo;var vo=(go=pt(uo))===null||go===void 0?void 0:go.host,yo=T==null||(bo=T.location)===null||bo===void 0?void 0:bo.host;vo&&yo&&vo!==yo&&(fo=uo)}if(_o)return!1;var wo=J(this._getDefaultProperties(ue.type),this._elementsChainAsString?{$elements_chain:Yn(po)}:{$elements:po},(ao=po[0])!==null&&ao!==void 0&&ao.$el_text?{$el_text:(so=po[0])===null||so===void 0?void 0:so.$el_text}:{},fo&&ue.type==="click"?{$external_click_url:fo}:{},ho),ko=this.getElementSelectors(oo);if(ko&&ko.length>0&&(wo.$element_selectors=ko),no===qr){var So,Eo=Tn(T==null||(So=T.getSelection())===null||So===void 0?void 0:So.toString()),Io=ue.type||"clipboard";if(!Eo)return!1;wo.$selected_content=Eo,wo.$copy_type=Io}return this.instance.capture(no,wo),!0}}}},{key:"isBrowserSupported",value:function(){return y(L==null?void 0:L.querySelectorAll)}}]),to}(),Ur=function(){function to(ue){var eo=this;i$1(this,to),o(this,"_restoreXHRPatch",void 0),o(this,"_restoreFetchPatch",void 0),o(this,"_startCapturing",function(){w$1(eo._restoreXHRPatch)&&U.postHogTracingHeadersPatchFns._patchXHR(eo.instance.sessionManager),w$1(eo._restoreFetchPatch)&&U.postHogTracingHeadersPatchFns._patchFetch(eo.instance.sessionManager)}),this.instance=ue}return s(to,[{key:"_loadScript",value:function(ue){U.postHogTracingHeadersPatchFns&&ue(),this.instance.requestRouter.loadScript("/static/tracing-headers.js?v=".concat(f.LIB_VERSION),function(eo){if(eo)return G.error("[TRACING-HEADERS] failed to load script",eo);ue()})}},{key:"startIfEnabledOrStop",value:function(){var ue,eo;this.instance.config.__add_tracing_headers?this._loadScript(this._startCapturing):((ue=this._restoreXHRPatch)===null||ue===void 0||ue.call(this),(eo=this._restoreFetchPatch)===null||eo===void 0||eo.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0)}}]),to}();(function(to){to[to.PENDING=-1]="PENDING",to[to.DENIED=0]="DENIED",to[to.GRANTED=1]="GRANTED"})(Br||(Br={}));var jr=function(){function to(ue){i$1(this,to),this.instance=ue}return s(to,[{key:"config",get:function(){return this.instance.config}},{key:"consent",get:function(){return this.getDnt()?Br.DENIED:this.storedConsent}},{key:"isOptedOut",value:function(){return this.consent===Br.DENIED||this.consent===Br.PENDING&&this.config.opt_out_capturing_by_default}},{key:"isOptedIn",value:function(){return!this.isOptedOut()}},{key:"optInOut",value:function(ue){this.storage.set(this.storageKey,ue?1:0,this.config.cookie_expiration,this.config.cross_subdomain_cookie,this.config.secure_cookie)}},{key:"reset",value:function(){this.storage.remove(this.storageKey,this.config.cross_subdomain_cookie)}},{key:"storageKey",get:function(){var ue=this.instance.config,eo=ue.token;return(ue.opt_out_capturing_cookie_prefix||"__ph_opt_in_out_")+eo}},{key:"storedConsent",get:function(){var ue=this.storage.get(this.storageKey);return ue==="1"?Br.GRANTED:ue==="0"?Br.DENIED:Br.PENDING}},{key:"storage",get:function(){if(!this._storage){var ue=this.config.opt_out_capturing_persistence_type;this._storage=ue==="localStorage"?at:st;var eo=ue==="localStorage"?st:at;eo.get(this.storageKey)&&(this._storage.get(this.storageKey)||this.optInOut(eo.get(this.storageKey)==="1"),eo.remove(this.storageKey,this.config.cross_subdomain_cookie))}return this._storage}},{key:"getDnt",value:function(){return!!this.config.respect_dnt&&!!ae([A==null?void 0:A.doNotTrack,A==null?void 0:A.msDoNotTrack,U.doNotTrack],function(ue){return Y([!0,1,"1","yes"],ue)})}}]),to}(),Gr="[Exception Autocapture]",Wr=function(){function to(ue){var eo,no=this;i$1(this,to),o(this,"originalOnUnhandledRejectionHandler",void 0),o(this,"startCapturing",function(){if(T&&no.isEnabled&&!no.hasHandlers&&!no.isCapturing){var ro=T.posthogErrorWrappingFunctions.wrapOnError,oo=T.posthogErrorWrappingFunctions.wrapUnhandledRejection;if(ro&&oo)try{no.unwrapOnError=ro(no.captureException.bind(no)),no.unwrapUnhandledRejection=oo(no.captureException.bind(no))}catch(io){G.error(Gr+" failed to start",io),no.stopCapturing()}else G.error(Gr+" failed to load error wrapping functions - cannot start")}}),this.instance=ue,this.remoteEnabled=!((eo=this.instance.persistence)===null||eo===void 0||!eo.props[ve]),this.startIfEnabled()}return s(to,[{key:"isEnabled",get:function(){var ue;return(ue=this.remoteEnabled)!==null&&ue!==void 0&&ue}},{key:"isCapturing",get:function(){var ue;return!(T==null||(ue=T.onerror)===null||ue===void 0||!ue.__POSTHOG_INSTRUMENTED__)}},{key:"hasHandlers",get:function(){return this.originalOnUnhandledRejectionHandler||this.unwrapOnError}},{key:"startIfEnabled",value:function(){this.isEnabled&&!this.isCapturing&&(G.info(Gr+" enabled, starting..."),this.loadScript(this.startCapturing))}},{key:"loadScript",value:function(ue){this.hasHandlers&&ue(),this.instance.requestRouter.loadScript("/static/exception-autocapture.js?v=".concat(f.LIB_VERSION),function(eo){if(eo)return G.error(Gr+" failed to load script",eo);ue()})}},{key:"stopCapturing",value:function(){var ue,eo;(ue=this.unwrapOnError)===null||ue===void 0||ue.call(this),(eo=this.unwrapUnhandledRejection)===null||eo===void 0||eo.call(this)}},{key:"afterDecideResponse",value:function(ue){var eo=ue.autocaptureExceptions;this.remoteEnabled=!!eo||!1,this.instance.persistence&&this.instance.persistence.register(o({},ve,this.remoteEnabled)),this.startIfEnabled()}},{key:"captureException",value:function(ue){var eo=this.instance.requestRouter.endpointFor("ui");ue.$exception_personURL="".concat(eo,"/project/").concat(this.instance.config.token,"/person/").concat(this.instance.get_distinct_id()),this.instance.exceptions.sendExceptionEvent(ue)}}]),to}(),Vr=9e5,zr="[Web Vitals]",Qr=function(){function to(ue){var eo,no=this;i$1(this,to),o(this,"_enabledServerSide",!1),o(this,"_initialized",!1),o(this,"buffer",{url:void 0,metrics:[],firstMetricTimestamp:void 0}),o(this,"_flushToCapture",function(){clearTimeout(no._delayedFlushTimer),no.buffer.metrics.length!==0&&(no.instance.capture("$web_vitals",no.buffer.metrics.reduce(function(ro,oo){var io;return t$1(t$1({},ro),{},(o(io={},"$web_vitals_".concat(oo.name,"_event"),t$1({},oo)),o(io,"$web_vitals_".concat(oo.name,"_value"),oo.value),io))},{})),no.buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0})}),o(this,"_addToBuffer",function(ro){var oo,io=(oo=no.instance.sessionManager)===null||oo===void 0?void 0:oo.checkAndGetSessionAndWindowId(!0);if(w$1(io))G.error(zr+"Could not read session ID. Dropping metrics!");else{no.buffer=no.buffer||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var ao=no._currentURL();w$1(ao)||(R(ro==null?void 0:ro.name)||R(ro==null?void 0:ro.value)?G.error(zr+"Invalid metric received",ro):no._maxAllowedValue&&ro.value>=no._maxAllowedValue?G.error(zr+"Ignoring metric with value >= "+no._maxAllowedValue,ro):(no.buffer.url!==ao&&(no._flushToCapture(),no._delayedFlushTimer=setTimeout(no._flushToCapture,8e3)),w$1(no.buffer.url)&&(no.buffer.url=ao),no.buffer.firstMetricTimestamp=w$1(no.buffer.firstMetricTimestamp)?Date.now():no.buffer.firstMetricTimestamp,no.buffer.metrics.push(t$1(t$1({},ro),{},{$current_url:ao,$session_id:io.sessionId,$window_id:io.windowId,timestamp:Date.now()})),no.buffer.metrics.length===4&&no._flushToCapture()))}}),o(this,"_startCapturing",function(){var ro=U.postHogWebVitalsCallbacks,oo=ro.onLCP,io=ro.onCLS,ao=ro.onFCP,so=ro.onINP;oo&&io&&ao&&so?(oo(no._addToBuffer),io(no._addToBuffer),ao(no._addToBuffer),so(no._addToBuffer),no._initialized=!0):G.error(zr+"web vitals callbacks not loaded - not starting")}),this.instance=ue,this._enabledServerSide=!((eo=this.instance.persistence)===null||eo===void 0||!eo.props[ge]),this.startIfEnabled()}return s(to,[{key:"_maxAllowedValue",get:function(){var ue=b(this.instance.config.capture_performance)&&F(this.instance.config.capture_performance.__web_vitals_max_value)?this.instance.config.capture_performance.__web_vitals_max_value:Vr;return 0<ue&&ue<=6e4?Vr:ue}},{key:"isEnabled",get:function(){var ue=b(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals:void 0;return x$1(ue)?ue:this._enabledServerSide}},{key:"startIfEnabled",value:function(){this.isEnabled&&!this._initialized&&(G.info(zr+" enabled, starting..."),this.loadScript(this._startCapturing))}},{key:"afterDecideResponse",value:function(ue){var eo=b(ue.capturePerformance)&&!!ue.capturePerformance.web_vitals;this.instance.persistence&&this.instance.persistence.register(o({},ge,eo)),this._enabledServerSide=eo,this.startIfEnabled()}},{key:"loadScript",value:function(ue){T.postHogWebVitalsCallbacks&&ue(),this.instance.requestRouter.loadScript("/static/web-vitals.js?v=".concat(f.LIB_VERSION),function(eo){eo?G.error(zr+" failed to load script",eo):ue()})}},{key:"_currentURL",value:function(){var ue=T?T.location.href:void 0;return ue||G.error(zr+"Could not determine current URL"),ue}}]),to}(),Jr="/e/",Yr=function(){function to(ue){var eo;i$1(this,to),this.instance=ue,this._endpointSuffix=((eo=this.instance.persistence)===null||eo===void 0?void 0:eo.props[pe])||Jr}return s(to,[{key:"endpoint",get:function(){return this.instance.requestRouter.endpointFor("api",this._endpointSuffix)}},{key:"afterDecideResponse",value:function(ue){var eo=ue.autocaptureExceptions;this._endpointSuffix=b(eo)&&eo.endpoint||Jr,this.instance.persistence&&this.instance.persistence.register(o({},pe,this._endpointSuffix))}},{key:"sendExceptionEvent",value:function(ue){this.instance.capture("$exception",ue,{_noTruncate:!0,_batchKey:"exceptionEvent",_url:this.endpoint})}}]),to}(),Xr={},Kr=function(){},Zr="posthog",es=!tr&&(H==null?void 0:H.indexOf("MSIE"))===-1&&(H==null?void 0:H.indexOf("Mozilla"))===-1,ts=function(){var to,ue,eo;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:(ue=L==null?void 0:L.location,eo=ue==null?void 0:ue.hostname,!!S(eo)&&eo.split(".").slice(-2).join(".")!=="herokuapp.com"),persistence:"localStorage+cookie",persistence_name:"",loaded:Kr,store_google:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:!0,capture_pageleave:"if_capture_pageview",debug:D&&S(D==null?void 0:D.search)&&D.search.indexOf("__posthog_debug=true")!==-1||!1,verbose:!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_surveys:!1,enable_recording_console_log:void 0,secure_cookie:(T==null||(to=T.location)===null||to===void 0?void 0:to.protocol)==="https:",ip:!0,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},inapp_protocol:"//",inapp_link_new_window:!1,request_batching:!0,properties_string_max_length:65535,session_recording:{},mask_all_element_attributes:!1,mask_all_text:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,on_request_error:function(no){var ro="Bad HTTP status: "+no.statusCode+" "+no.text;G.error(ro)},get_device_id:function(no){return no},_onCapture:Kr,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"always",__add_tracing_headers:!1}},ns=function(to){var ue={};w$1(to.process_person)||(ue.person_profiles=to.process_person),w$1(to.xhr_headers)||(ue.request_headers=to.xhr_headers),w$1(to.cookie_name)||(ue.persistence_name=to.cookie_name),w$1(to.disable_cookie)||(ue.disable_persistence=to.disable_cookie);var eo=J({},ue,to);return m(to.property_blacklist)&&(w$1(to.property_denylist)?eo.property_denylist=to.property_blacklist:m(to.property_denylist)?eo.property_denylist=[].concat(l(to.property_blacklist),l(to.property_denylist)):G.error("Invalid value for property_denylist config: "+to.property_denylist)),eo},is=function(){function to(){i$1(this,to),o(this,"__forceAllowLocalhost",!1)}return s(to,[{key:"_forceAllowLocalhost",get:function(){return this.__forceAllowLocalhost},set:function(ue){G.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=ue}}]),to}(),rs=function(){function to(){var ue=this;i$1(this,to),o(this,"webPerformance",new is),o(this,"version",f.LIB_VERSION),o(this,"_internalEventEmitter",new Sr),this.config=ts(),this.decideEndpointWasHit=!1,this.SentryIntegration=gr,this.sentryIntegration=function(eo){return function(no,ro){var oo=pr(no,ro);return{name:vr,processEvent:function(io){return oo(io)}}}(ue,eo)},this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this.featureFlags=new We(this),this.toolbar=new mi(this),this.scrollManager=new Dr(this),this.pageViewManager=new kr(this),this.surveys=new xr(this),this.exceptions=new Yr(this),this.rateLimiter=new Pr(this),this.requestRouter=new fr(this),this.consent=new jr(this),this.people={set:function(eo,no,ro){var oo=S(eo)?o({},eo,no):eo;ue.setPersonProperties(oo),ro==null||ro({})},set_once:function(eo,no,ro){var oo=S(eo)?o({},eo,no):eo;ue.setPersonProperties(void 0,oo),ro==null||ro({})}},this.on("eventCaptured",function(eo){return G.info("send",eo)})}return s(to,[{key:"init",value:function(ue,eo,no){if(no&&no!==Zr){var ro,oo=(ro=Xr[no])!==null&&ro!==void 0?ro:new to;return oo._init(ue,eo,no),Xr[no]=oo,Xr[Zr][no]=oo,oo}return this._init(ue,eo,no)}},{key:"_init",value:function(ue){var eo,no,ro=this,oo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},io=arguments.length>2?arguments[2]:void 0;if(w$1(ue)||E(ue))return G.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return G.warn("You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},this._triggered_notifs=[],this.set_config(J({},ts(),ns(oo),{name:io,token:ue})),this.config.on_xhr_error&&G.error("[posthog] on_xhr_error is deprecated. Use on_request_error instead"),this.compression=oo.disable_compression?void 0:re.GZipJS,this.persistence=new bn(this.config),this.sessionPersistence=this.config.persistence==="sessionStorage"?this.persistence:new bn(t$1(t$1({},this.config),{},{persistence:"sessionStorage"}));var ao=t$1({},this.persistence.props),so=t$1({},this.sessionPersistence.props);if(this._requestQueue=new yi(function(vo){return ro._send_retriable_request(vo)}),this._retryQueue=new lr(this),this.__request_queue=[],this.sessionManager=new dr(this.config,this.persistence),this.sessionPropsManager=new Cr(this.sessionManager,this.persistence),new Ur(this).startIfEnabledOrStop(),this.sessionRecording=new vi(this),this.sessionRecording.startIfEnabledOrStop(),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new Hr(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new Lr(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new Qr(this),this.exceptionObserver=new Wr(this),this.exceptionObserver.startIfEnabled(),f.DEBUG=f.DEBUG||this.config.debug,f.DEBUG&&G.info("Starting in debug mode",{this:this,config:oo,thisC:t$1({},this.config),p:ao,s:so}),this._sync_opt_out_with_persistence(),((eo=oo.bootstrap)===null||eo===void 0?void 0:eo.distinctID)!==void 0){var lo,co,uo=this.config.get_device_id(Ke()),fo=(lo=oo.bootstrap)!==null&&lo!==void 0&&lo.isIdentifiedID?uo:oo.bootstrap.distinctID;this.persistence.set_property($e,(co=oo.bootstrap)!==null&&co!==void 0&&co.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:oo.bootstrap.distinctID,$device_id:fo})}if(this._hasBootstrappedFeatureFlags()){var po,ho,_o=Object.keys(((po=oo.bootstrap)===null||po===void 0?void 0:po.featureFlags)||{}).filter(function(vo){var yo,wo;return!((yo=oo.bootstrap)===null||yo===void 0||(wo=yo.featureFlags)===null||wo===void 0||!wo[vo])}).reduce(function(vo,yo){var wo,ko;return vo[yo]=((wo=oo.bootstrap)===null||wo===void 0||(ko=wo.featureFlags)===null||ko===void 0?void 0:ko[yo])||!1,vo},{}),go=Object.keys(((ho=oo.bootstrap)===null||ho===void 0?void 0:ho.featureFlagPayloads)||{}).filter(function(vo){return _o[vo]}).reduce(function(vo,yo){var wo,ko,So,Eo;return(wo=oo.bootstrap)!==null&&wo!==void 0&&(ko=wo.featureFlagPayloads)!==null&&ko!==void 0&&ko[yo]&&(vo[yo]=(So=oo.bootstrap)===null||So===void 0||(Eo=So.featureFlagPayloads)===null||Eo===void 0?void 0:Eo[yo]),vo},{});this.featureFlags.receivedFeatureFlags({featureFlags:_o,featureFlagPayloads:go})}if(!this.get_distinct_id()){var bo=this.config.get_device_id(Ke());this.register_once({distinct_id:bo,$device_id:bo},""),this.persistence.set_property($e,"anonymous")}return T==null||(no=T.addEventListener)===null||no===void 0||no.call(T,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this)),this.toolbar.maybeLoadToolbar(),oo.segment?_r(this,function(){return ro._loaded()}):this._loaded(),y(this.config._onCapture)&&this.on("eventCaptured",function(vo){return ro.config._onCapture(vo.event,vo)}),this}},{key:"_afterDecideResponse",value:function(ue){var eo,no,ro,oo,io,ao,so,lo;this.compression=void 0,ue.supportedCompression&&!this.config.disable_compression&&(this.compression=Y(ue.supportedCompression,re.GZipJS)?re.GZipJS:Y(ue.supportedCompression,re.Base64)?re.Base64:void 0),(eo=ue.analytics)!==null&&eo!==void 0&&eo.endpoint&&(this.analyticsDefaultEndpoint=ue.analytics.endpoint),(no=this.sessionRecording)===null||no===void 0||no.afterDecideResponse(ue),(ro=this.autocapture)===null||ro===void 0||ro.afterDecideResponse(ue),(oo=this.heatmaps)===null||oo===void 0||oo.afterDecideResponse(ue),(io=this.surveys)===null||io===void 0||io.afterDecideResponse(ue),(ao=this.webVitalsAutocapture)===null||ao===void 0||ao.afterDecideResponse(ue),(so=this.exceptions)===null||so===void 0||so.afterDecideResponse(ue),(lo=this.exceptionObserver)===null||lo===void 0||lo.afterDecideResponse(ue)}},{key:"_loaded",value:function(){var ue=this,eo=this.config.advanced_disable_decide;eo||this.featureFlags.setReloadingPaused(!0);try{this.config.loaded(this)}catch(no){G.critical("`loaded` function failed",no)}this._start_queue_if_opted_in(),this.config.capture_pageview&&setTimeout(function(){ue.consent.isOptedIn()&&ue._captureInitialPageview()},1),eo||(new pi(this).call(),this.featureFlags.resetRequestQueue())}},{key:"_start_queue_if_opted_in",value:function(){var ue;this.has_opted_out_capturing()||this.config.request_batching&&((ue=this._requestQueue)===null||ue===void 0||ue.enable())}},{key:"_dom_loaded",value:function(){var ue=this;this.has_opted_out_capturing()||z(this.__request_queue,function(eo){return ue._send_retriable_request(eo)}),this.__request_queue=[],this._start_queue_if_opted_in()}},{key:"_handle_unload",value:function(){var ue,eo;this.config.request_batching?(this._shouldCapturePageleave()&&this.capture("$pageleave"),(ue=this._requestQueue)===null||ue===void 0||ue.unload(),(eo=this._retryQueue)===null||eo===void 0||eo.unload()):this._shouldCapturePageleave()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}},{key:"_send_request",value:function(ue){var eo=this;this.__loaded&&(es?this.__request_queue.push(ue):this.rateLimiter.isServerRateLimited(ue.batchKey)||(ue.transport=ue.transport||this.config.api_transport,ue.url=ir(ue.url,{ip:this.config.ip?1:0}),ue.headers=t$1({},this.config.request_headers),ue.compression=ue.compression==="best-available"?this.compression:ue.compression,function(no){var ro,oo,io,ao=t$1({},no);ao.timeout=ao.timeout||6e4,ao.url=ir(ao.url,{_:new Date().getTime().toString(),ver:f.LIB_VERSION,compression:ao.compression});var so=(ro=ao.transport)!==null&&ro!==void 0?ro:"XHR",lo=(oo=(io=ae(or,function(co){return co.transport===so}))===null||io===void 0?void 0:io.method)!==null&&oo!==void 0?oo:or[0].method;if(!lo)throw new Error("No available transport method");lo(ao)}(t$1(t$1({},ue),{},{callback:function(no){var ro,oo,io;eo.rateLimiter.checkForLimiting(no),no.statusCode>=400&&((oo=(io=eo.config).on_request_error)===null||oo===void 0||oo.call(io,no)),(ro=ue.callback)===null||ro===void 0||ro.call(ue,no)}}))))}},{key:"_send_retriable_request",value:function(ue){this._retryQueue?this._retryQueue.retriableRequest(ue):this._send_request(ue)}},{key:"_execute_array",value:function(ue){var eo,no=this,ro=[],oo=[],io=[];z(ue,function(so){so&&(eo=so[0],m(eo)?io.push(so):y(so)?so.call(no):m(so)&&eo==="alias"?ro.push(so):m(so)&&eo.indexOf("capture")!==-1&&y(no[eo])?io.push(so):oo.push(so))});var ao=function(so,lo){z(so,function(co){if(m(co[0])){var uo=lo;Q(co,function(fo){uo=uo[fo[0]].apply(uo,fo.slice(1))})}else this[co[0]].apply(this,co.slice(1))},lo)};ao(ro,this),ao(oo,this),ao(io,this)}},{key:"_hasBootstrappedFeatureFlags",value:function(){var ue,eo;return((ue=this.config.bootstrap)===null||ue===void 0?void 0:ue.featureFlags)&&Object.keys((eo=this.config.bootstrap)===null||eo===void 0?void 0:eo.featureFlags).length>0||!1}},{key:"push",value:function(ue){this._execute_array([ue])}},{key:"capture",value:function(ue,eo,no){var ro;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(!this.consent.isOptedOut())if(!w$1(ue)&&S(ue)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var oo=no!=null&&no.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(oo==null||!oo.isRateLimited){this.sessionPersistence.update_search_keyword(),this.config.store_google&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.store_google||this.config.save_referrer)&&this.persistence.set_initial_person_info();var io=new Date,ao=(no==null?void 0:no.timestamp)||io,so={uuid:Ke(),event:ue,properties:this._calculate_event_properties(ue,eo||{},ao)};oo&&(so.properties.$lib_rate_limit_remaining_tokens=oo.remainingTokens),no!=null&&no.$set&&(so.$set=no==null?void 0:no.$set);var lo=this._calculate_set_once_properties(no==null?void 0:no.$set_once);lo&&(so.$set_once=lo),(so=ie$2(so,no!=null&&no._noTruncate?null:this.config.properties_string_max_length)).timestamp=ao,w$1(no==null?void 0:no.timestamp)||(so.properties.$event_time_override_provided=!0,so.properties.$event_time_override_system_time=io);var co=t$1(t$1({},so.properties.$set),so.$set);k(co)||this.setPersonPropertiesForFlags(co),this._internalEventEmitter.emit("eventCaptured",so);var uo={method:"POST",url:(ro=no==null?void 0:no._url)!==null&&ro!==void 0?ro:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:so,compression:"best-available",batchKey:no==null?void 0:no._batchKey};return!this.config.request_batching||no&&(no==null||!no._batchKey)||no!=null&&no.send_instantly?this._send_retriable_request(uo):this._requestQueue.enqueue(uo),so}G.critical("This capture call is ignored due to client rate limiting.")}}else G.error("No event name provided to posthog.capture")}else G.uninitializedWarning("posthog.capture")}},{key:"_addCaptureHook",value:function(ue){this.on("eventCaptured",function(eo){return ue(eo.event,eo)})}},{key:"_calculate_event_properties",value:function(ue,eo,no){if(no=no||new Date,!this.persistence||!this.sessionPersistence)return eo;var ro=this.persistence.remove_event_timer(ue),oo=t$1({},eo);if(oo.token=this.config.token,ue==="$snapshot"){var io=t$1(t$1({},this.persistence.properties()),this.sessionPersistence.properties());return oo.distinct_id=io.distinct_id,(!S(oo.distinct_id)&&!F(oo.distinct_id)||E(oo.distinct_id))&&G.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),oo}var ao=mn.properties();if(this.sessionManager){var so=this.sessionManager.checkAndGetSessionAndWindowId(),lo=so.sessionId,co=so.windowId;oo.$session_id=lo,oo.$window_id=co}if(this.requestRouter.region===ur.CUSTOM&&(oo.$lib_custom_api_host=this.config.api_host),this.sessionPropsManager&&this.config.__preview_send_client_session_params&&(ue==="$pageview"||ue==="$pageleave"||ue==="$autocapture")){var uo=this.sessionPropsManager.getSessionProps();oo=J(oo,uo)}if(!this.config.disable_scroll_properties){var fo={};ue==="$pageview"?fo=this.pageViewManager.doPageView(no):ue==="$pageleave"&&(fo=this.pageViewManager.doPageLeave(no)),oo=J(oo,fo)}if(ue==="$pageview"&&L&&(oo.title=L.title),!w$1(ro)){var po=no.getTime()-ro;oo.$duration=parseFloat((po/1e3).toFixed(3))}H&&this.config.opt_out_useragent_filter&&(oo.$browser_type=this._is_bot()?"bot":"browser"),(oo=J({},ao,this.persistence.properties(),this.sessionPersistence.properties(),oo)).$is_identified=this._isIdentified(),m(this.config.property_denylist)?Q(this.config.property_denylist,function(_o){delete oo[_o]}):G.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var ho=this.config.sanitize_properties;return ho&&(oo=ho(oo,ue)),oo.$process_person_profile=this._hasPersonProcessing(),oo}},{key:"_calculate_set_once_properties",value:function(ue){if(!this.persistence||!this._hasPersonProcessing())return ue;var eo=J({},this.persistence.get_initial_props(),ue||{});return k(eo)?void 0:eo}},{key:"register",value:function(ue,eo){var no;(no=this.persistence)===null||no===void 0||no.register(ue,eo)}},{key:"register_once",value:function(ue,eo,no){var ro;(ro=this.persistence)===null||ro===void 0||ro.register_once(ue,eo,no)}},{key:"register_for_session",value:function(ue){var eo;(eo=this.sessionPersistence)===null||eo===void 0||eo.register(ue)}},{key:"unregister",value:function(ue){var eo;(eo=this.persistence)===null||eo===void 0||eo.unregister(ue)}},{key:"unregister_for_session",value:function(ue){var eo;(eo=this.sessionPersistence)===null||eo===void 0||eo.unregister(ue)}},{key:"_register_single",value:function(ue,eo){this.register(o({},ue,eo))}},{key:"getFeatureFlag",value:function(ue,eo){return this.featureFlags.getFeatureFlag(ue,eo)}},{key:"getFeatureFlagPayload",value:function(ue){var eo=this.featureFlags.getFeatureFlagPayload(ue);try{return JSON.parse(eo)}catch{return eo}}},{key:"isFeatureEnabled",value:function(ue,eo){return this.featureFlags.isFeatureEnabled(ue,eo)}},{key:"reloadFeatureFlags",value:function(){this.featureFlags.reloadFeatureFlags()}},{key:"updateEarlyAccessFeatureEnrollment",value:function(ue,eo){this.featureFlags.updateEarlyAccessFeatureEnrollment(ue,eo)}},{key:"getEarlyAccessFeatures",value:function(ue){var eo=arguments.length>1&&arguments[1]!==void 0&&arguments[1];return this.featureFlags.getEarlyAccessFeatures(ue,eo)}},{key:"on",value:function(ue,eo){return this._internalEventEmitter.on(ue,eo)}},{key:"onFeatureFlags",value:function(ue){return this.featureFlags.onFeatureFlags(ue)}},{key:"onSessionId",value:function(ue){var eo,no;return(eo=(no=this.sessionManager)===null||no===void 0?void 0:no.onSessionId(ue))!==null&&eo!==void 0?eo:function(){}}},{key:"getSurveys",value:function(ue){var eo=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.surveys.getSurveys(ue,eo)}},{key:"getActiveMatchingSurveys",value:function(ue){var eo=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.surveys.getActiveMatchingSurveys(ue,eo)}},{key:"renderSurvey",value:function(ue,eo){this.surveys.renderSurvey(ue,eo)}},{key:"canRenderSurvey",value:function(ue){this.surveys.canRenderSurvey(ue)}},{key:"getNextSurveyStep",value:function(ue,eo,no){return this.surveys.getNextSurveyStep(ue,eo,no)}},{key:"identify",value:function(ue,eo,no){if(!this.__loaded||!this.persistence)return G.uninitializedWarning("posthog.identify");if(F(ue)&&(ue=ue.toString(),G.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),ue){if(["distinct_id","distinctid"].includes(ue.toLowerCase()))G.critical('The string "'.concat(ue,'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'));else if(this._requirePersonProcessing("posthog.identify")){var ro=this.get_distinct_id();if(this.register({$user_id:ue}),!this.get_property("$device_id")){var oo=ro;this.register_once({$had_persisted_distinct_id:!0,$device_id:oo},"")}ue!==ro&&ue!==this.get_property(ce)&&(this.unregister(ce),this.register({distinct_id:ue}));var io=(this.persistence.get_property($e)||"anonymous")==="anonymous";ue!==ro&&io?(this.persistence.set_property($e,"identified"),this.setPersonPropertiesForFlags(eo||{},!1),this.capture("$identify",{distinct_id:ue,$anon_distinct_id:ro},{$set:eo||{},$set_once:no||{}}),this.featureFlags.setAnonymousDistinctId(ro)):(eo||no)&&this.setPersonProperties(eo,no),ue!==ro&&(this.reloadFeatureFlags(),this.unregister(Ce))}}else G.error("Unique user id has not been set in posthog.identify")}},{key:"setPersonProperties",value:function(ue,eo){(ue||eo)&&this._requirePersonProcessing("posthog.setPersonProperties")&&(this.setPersonPropertiesForFlags(ue||{}),this.capture("$set",{$set:ue||{},$set_once:eo||{}}))}},{key:"group",value:function(ue,eo,no){if(ue&&eo){if(this._requirePersonProcessing("posthog.group")){var ro=this.getGroups();ro[ue]!==eo&&this.resetGroupPropertiesForFlags(ue),this.register({$groups:t$1(t$1({},ro),{},o({},ue,eo))}),no&&(this.capture("$groupidentify",{$group_type:ue,$group_key:eo,$group_set:no}),this.setGroupPropertiesForFlags(o({},ue,no))),ro[ue]===eo||no||this.reloadFeatureFlags()}}else G.error("posthog.group requires a group type and group key")}},{key:"resetGroups",value:function(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}},{key:"setPersonPropertiesForFlags",value:function(ue){var eo=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this._requirePersonProcessing("posthog.setPersonPropertiesForFlags")&&this.featureFlags.setPersonPropertiesForFlags(ue,eo)}},{key:"resetPersonPropertiesForFlags",value:function(){this.featureFlags.resetPersonPropertiesForFlags()}},{key:"setGroupPropertiesForFlags",value:function(ue){var eo=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(ue,eo)}},{key:"resetGroupPropertiesForFlags",value:function(ue){this.featureFlags.resetGroupPropertiesForFlags(ue)}},{key:"reset",value:function(ue){var eo,no,ro,oo;if(G.info("reset"),!this.__loaded)return G.uninitializedWarning("posthog.reset");var io=this.get_property("$device_id");this.consent.reset(),(eo=this.persistence)===null||eo===void 0||eo.clear(),(no=this.sessionPersistence)===null||no===void 0||no.clear(),(ro=this.persistence)===null||ro===void 0||ro.set_property($e,"anonymous"),(oo=this.sessionManager)===null||oo===void 0||oo.resetSessionId();var ao=this.config.get_device_id(Ke());this.register_once({distinct_id:ao,$device_id:ue?ao:io},"")}},{key:"get_distinct_id",value:function(){return this.get_property("distinct_id")}},{key:"getGroups",value:function(){return this.get_property("$groups")||{}}},{key:"get_session_id",value:function(){var ue,eo;return(ue=(eo=this.sessionManager)===null||eo===void 0?void 0:eo.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&ue!==void 0?ue:""}},{key:"get_session_replay_url",value:function(ue){if(!this.sessionManager)return"";var eo=this.sessionManager.checkAndGetSessionAndWindowId(!0),no=eo.sessionId,ro=eo.sessionStartTimestamp,oo=this.requestRouter.endpointFor("ui","/project/".concat(this.config.token,"/replay/").concat(no));if(ue!=null&&ue.withTimestamp&&ro){var io,ao=(io=ue.timestampLookBack)!==null&&io!==void 0?io:10;if(!ro)return oo;var so=Math.max(Math.floor((new Date().getTime()-ro)/1e3)-ao,0);oo+="?t=".concat(so)}return oo}},{key:"alias",value:function(ue,eo){return ue===this.get_property(le)?(G.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(w$1(eo)&&(eo=this.get_distinct_id()),ue!==eo?(this._register_single(ce,ue),this.capture("$create_alias",{alias:ue,distinct_id:eo})):(G.warn("alias matches current distinct_id - skipping api call."),this.identify(ue),-1)):void 0}},{key:"set_config",value:function(ue){var eo,no,ro,oo,io=t$1({},this.config);b(ue)&&(J(this.config,ns(ue)),(eo=this.persistence)===null||eo===void 0||eo.update_config(this.config,io),this.sessionPersistence=this.config.persistence==="sessionStorage"?this.persistence:new bn(t$1(t$1({},this.config),{},{persistence:"sessionStorage"})),at.is_supported()&&at.get("ph_debug")==="true"&&(this.config.debug=!0),this.config.debug&&(f.DEBUG=!0,G.info("set_config",{config:ue,oldConfig:io,newConfig:t$1({},this.config)})),(no=this.sessionRecording)===null||no===void 0||no.startIfEnabledOrStop(),(ro=this.autocapture)===null||ro===void 0||ro.startIfEnabled(),(oo=this.heatmaps)===null||oo===void 0||oo.startIfEnabled(),this.surveys.loadIfEnabled(),this._sync_opt_out_with_persistence())}},{key:"startSessionRecording",value:function(ue){var eo,no=x$1(ue)&&ue;if(no||ue!=null&&ue.sampling){var ro,oo,io=(ro=this.sessionManager)===null||ro===void 0?void 0:ro.checkAndGetSessionAndWindowId();(oo=this.persistence)===null||oo===void 0||oo.register(o({},Ee,!0)),G.info("Session recording started with sampling override for session: ",io==null?void 0:io.sessionId)}(no||ue!=null&&ue.linked_flag)&&((eo=this.sessionRecording)===null||eo===void 0||eo.overrideLinkedFlag(),G.info("Session recording started with linked_flags override")),this.set_config({disable_session_recording:!1})}},{key:"stopSessionRecording",value:function(){this.set_config({disable_session_recording:!0})}},{key:"sessionRecordingStarted",value:function(){var ue;return!((ue=this.sessionRecording)===null||ue===void 0||!ue.started)}},{key:"captureException",value:function(ue,eo){var no=y(U.parseErrorAsProperties)?U.parseErrorAsProperties([ue.message,void 0,void 0,void 0,ue]):t$1({$exception_type:ue.name,$exception_message:ue.message,$exception_level:"error"},eo);this.exceptions.sendExceptionEvent(no)}},{key:"loadToolbar",value:function(ue){return this.toolbar.loadToolbar(ue)}},{key:"get_property",value:function(ue){var eo;return(eo=this.persistence)===null||eo===void 0?void 0:eo.props[ue]}},{key:"getSessionProperty",value:function(ue){var eo;return(eo=this.sessionPersistence)===null||eo===void 0?void 0:eo.props[ue]}},{key:"toString",value:function(){var ue,eo=(ue=this.config.name)!==null&&ue!==void 0?ue:Zr;return eo!==Zr&&(eo=Zr+"."+eo),eo}},{key:"_isIdentified",value:function(){var ue,eo;return((ue=this.persistence)===null||ue===void 0?void 0:ue.get_property($e))==="identified"||((eo=this.sessionPersistence)===null||eo===void 0?void 0:eo.get_property($e))==="identified"}},{key:"_hasPersonProcessing",value:function(){var ue,eo,no,ro;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&k(this.getGroups())&&((ue=this.persistence)===null||ue===void 0||(eo=ue.props)===null||eo===void 0||!eo[ce])&&((no=this.persistence)===null||no===void 0||(ro=no.props)===null||ro===void 0||!ro[qe]))}},{key:"_shouldCapturePageleave",value:function(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&this.config.capture_pageview}},{key:"createPersonProfile",value:function(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}},{key:"_requirePersonProcessing",value:function(ue){return this.config.person_profiles==="never"?(G.error(ue+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(qe,!0),!0)}},{key:"_sync_opt_out_with_persistence",value:function(){var ue,eo,no,ro,oo=this.consent.isOptedOut(),io=this.config.opt_out_persistence_by_default,ao=this.config.disable_persistence||oo&&!!io;((ue=this.persistence)===null||ue===void 0?void 0:ue.disabled)!==ao&&((no=this.persistence)===null||no===void 0||no.set_disabled(ao)),((eo=this.sessionPersistence)===null||eo===void 0?void 0:eo.disabled)!==ao&&((ro=this.sessionPersistence)===null||ro===void 0||ro.set_disabled(ao))}},{key:"opt_in_capturing",value:function(ue){var eo;this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),(w$1(ue==null?void 0:ue.captureEventName)||ue!=null&&ue.captureEventName)&&this.capture((eo=ue==null?void 0:ue.captureEventName)!==null&&eo!==void 0?eo:"$opt_in",ue==null?void 0:ue.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._captureInitialPageview()}},{key:"opt_out_capturing",value:function(){this.consent.optInOut(!1),this._sync_opt_out_with_persistence()}},{key:"has_opted_in_capturing",value:function(){return this.consent.isOptedIn()}},{key:"has_opted_out_capturing",value:function(){return this.consent.isOptedOut()}},{key:"clear_opt_in_out_capturing",value:function(){this.consent.reset(),this._sync_opt_out_with_persistence()}},{key:"_is_bot",value:function(){return A?function(ue,eo){if(!ue)return!1;var no=ue.userAgent;if(no&&Or(no,eo))return!0;try{var ro=ue==null?void 0:ue.userAgentData;if(ro!=null&&ro.brands&&ro.brands.some(function(oo){return Or(oo==null?void 0:oo.brand,eo)}))return!0}catch{}return!!ue.webdriver}(A,this.config.custom_blocked_useragents):void 0}},{key:"_captureInitialPageview",value:function(){L&&!this._initialPageviewCaptured&&(this._initialPageviewCaptured=!0,this.capture("$pageview",{title:L.title},{send_instantly:!0}))}},{key:"debug",value:function(ue){ue===!1?(T==null||T.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(T==null||T.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),localStorage&&localStorage.setItem("ph_debug","true"),this.set_config({debug:!0}))}}]),to}();(function(to,ue){for(var eo=0;eo<ue.length;eo++)to.prototype[ue[eo]]=ee(to.prototype[ue[eo]])})(rs,["identify"]);var ss,os=(ss=Xr[Zr]=new rs,function(){function to(){to.done||(to.done=!0,es=!1,Q(Xr,function(ue){ue._dom_loaded()}))}L!=null&&L.addEventListener&&(L.readyState==="complete"?to():L.addEventListener("DOMContentLoaded",to,!1)),T&&oe(T,"load",to,!0)}(),ss);const Events={COMPONENT_CREATED:"component:created",COMPONENT_UPDATED:"component:updated",APP_VIEW_PUBLISHED:"app:view_published",BLOCK_EJECTED:"block:ejected"},EventSource$1={PORTAL:"portal",URL:"url",NOTIFICATION:"notification"};class PosthogClient{constructor(ue){this.token=ue}init(){this.token&&(os.init(this.token,{autocapture:!1,capture_pageview:!1}),os.set_config({persistence:"cookie"}),this.initialised=!0)}identify(ue){this.initialised&&os.identify(ue)}updateUser(ue){this.initialised&&os.people.set(ue)}captureEvent(ue,eo){this.initialised&&(eo.sourceApp="builder",os.capture(ue,eo))}npsFeedback(ue){if(!this.initialised)return;localStorage.setItem(Events.NPS.SUBMITTED,Date.now());const eo={};for(let no in ue)eo[`feedback_${no}`]=ue[no];os.capture(Events.NPS.SUBMITTED,eo)}logout(){this.initialised&&os.reset()}}const posthog=new PosthogClient(void 0);class AnalyticsHub{constructor(){this.clients=[posthog],this.initialised=!1}async activate(){(await API.getAnalyticsStatus()).enabled&&!this.initialised&&(this.clients.forEach(eo=>{eo.init()}),this.initialised=!0)}identify(ue){posthog.identify(ue)}captureException(ue){}captureEvent(ue,eo={}){posthog.captureEvent(ue,eo)}async logout(){posthog.logout()}}const analytics=new AnalyticsHub,capitalise=to=>to&&to.substring(0,1).toUpperCase()+to.substring(1),lowercase=to=>to.substring(0,1).toLowerCase()+to.substring(1),isBuilderInputFocused=to=>{var no,ro,oo;const ue=(no=document.activeElement)==null?void 0:no.tagName.toLowerCase();return!!((((oo=(ro=document.activeElement)==null?void 0:ro.classList)==null?void 0:oo.contains("cm-content"))||["input","textarea"].indexOf(ue)!==-1)&&to.key!=="Escape")},{ContextScopes:ContextScopes$1}=Constants$1,findComponent=(to,ue)=>searchComponentTree(to,eo=>eo._id===ue),findComponentParent=(to,ue,eo)=>{if(!to||!ue)return null;if(to._id===ue)return eo;if(!to._children)return null;for(const no of to._children){const ro=findComponentParent(no,ue,to);if(ro)return ro}return null},findComponentPath=(to,ue,eo=[])=>{if(!to||!ue)return[];if(to._id===ue)return[...eo,to];if(!to._children)return[];for(const no of to._children){const ro=[...eo,to],oo=findComponentPath(no,ue,ro);if(oo!=null&&oo.length)return oo}return[]},findAllMatchingComponents=(to,ue)=>{if(!to||!ue)return[];let eo=[];return to._children&&to._children.forEach(no=>{eo=[...eo,...findAllMatchingComponents(no,ue)]}),ue(to)&&eo.push(to),eo.reverse()},findAllComponents=to=>findAllMatchingComponents(to,()=>!0),findClosestMatchingComponent=(to,ue,eo)=>{if(!eo)return null;const no=findComponentPath(to,ue).reverse();for(let ro of no)if(eo(ro))return ro;return null},searchComponentTree=(to,ue)=>{if(!to||!ue)return null;if(ue(to))return to;if(!to._children)return null;for(const eo of to._children){const no=searchComponentTree(eo,ue);if(no)return no}return null},makeComponentUnique=to=>{if(!to)return;const ue=[],eo=(oo,io)=>{var lo;const ao=oo._id,so=uuid$1();io.push([ao,so]),(lo=oo._children)==null||lo.forEach(co=>eo(co,io))};eo(to,ue);let no=JSON.stringify(to);return ue.forEach(([oo,io])=>{no=no.replace(new RegExp(oo,"g"),io)}),findHBSBlocks(no).forEach(oo=>{let io=oo.replace(/\\"/g,'"'),ao=decodeJSBinding(io);if(ao!=null){ue.forEach(([lo,co])=>{ao=ao.replace(new RegExp(lo,"g"),co)});let so=encodeJSBinding(ao);so=so.replace(/"/g,'\\"'),no=no.replace(oo,so)}}),JSON.parse(no)},getComponentText=to=>{var eo;if(to==null)return"";if(to!=null&&to._instanceName)return to._instanceName;const ue=((eo=to._component)==null?void 0:eo.replace("@budibase/standard-components/",""))||"component";return capitalise(ue)},getComponentName=to=>{var no;if(to==null)return"";const eo=(((no=get_store_value(componentStore))==null?void 0:no.components)||{})[to._component]||{};return eo.friendlyName||eo.name||""},getComponentContexts=to=>{const ue=componentStore.getDefinition(to);let eo=[];return ue!=null&&ue.context&&(eo=Array.isArray(ue.context)?[...ue.context]:[ue.context]),ue!=null&&ue.actions&&eo.push({type:"action",scope:ContextScopes$1.Global,actions:ue.actions.map(no=>typeof no=="string"?{type:no}:no)}),eo},buildContextTree=(to,ue={root:[]},eo="root")=>{if(!to)return ue;const no=getComponentContexts(to._component);return no.length&&(ue[eo].push(to._id),no.some(ro=>ro.scope===ContextScopes$1.Local)&&(eo=to._id,ue[to._id]=[])),to._children&&to._children.forEach(ro=>{buildContextTree(ro,ue,eo)}),ue},buildContextTreeLookupMap=to=>{const ue=buildContextTree(to);let eo={};return Object.entries(ue).forEach(([no,ro])=>{ro.forEach(oo=>{eo[oo]=no})}),eo},getChildIdsForComponent=to=>[to._id,...((to==null?void 0:to._children)??[]).map(getChildIdsForComponent).flat(1)],TableNames={USERS:"ta_users"},AppStatus={ALL:"all",DEV:"development",DEPLOYED:"published"},IntegrationNames={POSTGRES:"PostgreSQL",MONGODB:"MongoDB",COUCHDB:"CouchDB",S3:"S3",MYSQL:"MySQL",REST:"REST",DYNAMODB:"DynamoDB",ELASTICSEARCH:"ElasticSearch",SQL_SERVER:"SQL Server",AIRTABLE:"Airtable",ARANGODB:"ArangoDB",ORACLE:"Oracle",GOOGLE_SHEETS:"Google Sheets"},UNEDITABLE_USER_FIELDS=["email","password","roleId","status","firstName","lastName"],APP_NAME_REGEX=/^[\w\s]+$/,APP_URL_REGEX=/^[0-9a-zA-Z-_]+$/,DefaultAppTheme={primaryColor:"var(--spectrum-global-color-blue-600)",primaryColorHover:"var(--spectrum-global-color-blue-500)",buttonBorderRadius:"16px",navBackground:"var(--spectrum-global-color-gray-50)",navTextColor:"var(--spectrum-global-color-gray-800)"},PluginSource={URL:"URL",NPM:"NPM",GITHUB:"Github",FILE:"File Upload"},OnboardingType={EMAIL:"email",PASSWORD:"password"},PlanModel={PER_USER:"perUser"},ChangelogURL="https://docs.budibase.com/changelog",AutoScreenTypes={BLANK:"blank",TABLE:"table",FORM:"form"},actions=[{name:"Save Row",type:"data",component:"SaveRow",context:[{label:"Saved row",value:"row"}]},{name:"Duplicate Row",type:"data",component:"DuplicateRow",context:[{label:"Duplicated row",value:"row"}]},{name:"Delete Row",displayName:"Delete Rows",type:"data",component:"DeleteRow"},{name:"Fetch Row",type:"data",component:"FetchRow",context:[{label:"Fetched row",value:"row"}]},{name:"Navigate To",type:"application",component:"NavigateTo"},{name:"Execute Query",type:"data",component:"ExecuteQuery",context:[{label:"Query result",value:"result"}]},{name:"Trigger Automation",type:"application",component:"TriggerAutomation",context:[{label:"Automation Result",value:"result"}]},{name:"Update Field Value",type:"form",component:"UpdateFieldValue"},{name:"Scroll To Field",type:"form",component:"ScrollTo"},{name:"Validate Form",type:"form",component:"ValidateForm"},{name:"Change Form Step",type:"form",component:"ChangeFormStep"},{name:"Clear Form",type:"form",component:"ClearForm"},{name:"Log Out",type:"application",component:"LogOut"},{name:"Close Screen Modal",type:"application",component:"CloseScreenModal"},{name:"Refresh Data Provider",type:"data",component:"RefreshDataProvider"},{name:"Update State",type:"data",component:"UpdateState",dependsOnFeature:"state"},{name:"Upload File to S3",type:"data",component:"S3Upload",context:[{label:"File URL",value:"publicUrl"}]},{name:"Export Data",type:"data",component:"ExportData"},{name:"Continue if / Stop if",type:"logic",component:"ContinueIf",dependsOnFeature:"continueIfAction"},{name:"Show Notification",type:"application",component:"ShowNotification",dependsOnFeature:"showNotificationAction"},{name:"Prompt User",type:"application",component:"PromptUser"},{name:"Open Side Panel",type:"application",component:"OpenSidePanel",dependsOnFeature:"sidePanel"},{name:"Close Side Panel",type:"application",component:"CloseSidePanel",dependsOnFeature:"sidePanel"},{name:"Open Modal",type:"application",component:"OpenModal",dependsOnFeature:"modal"},{name:"Close Modal",type:"application",component:"CloseModal",dependsOnFeature:"modal"},{name:"Clear Row Selection",type:"data",component:"ClearRowSelection"},{name:"Download File",type:"data",component:"DownloadFile"},{name:"Row Action",type:"data",component:"RowAction"}],ActionDefinitions={actions},DEFAULT_STATE={platformUrl:"",emailBrandingEnabled:!0,testimonialsEnabled:!0,platformTitle:"Budibase",company:"Budibase",google:!1,googleDatasourceConfigured:!1,oidc:!1,oidcCallbackUrl:"",googleCallbackUrl:"",loaded:!1};class OrganisationStore extends BudiStore{constructor(){super(DEFAULT_STATE)}async init(){const ue=get_store_value(auth).tenantId,eo=await API.getTenantConfig(ue);this.set({...DEFAULT_STATE,...eo.config,loaded:!0})}async save(ue){const{oidc:eo,google:no,googleDatasourceConfigured:ro,oidcCallbackUrl:oo,googleCallbackUrl:io,loaded:ao,...so}=get_store_value(this.store),lo={...so,...ue};await API.saveConfig({type:ConfigType.SETTINGS,config:lo}),await this.init()}}const organisation=new OrganisationStore;let UserStore$1=class extends BudiStore{constructor(){super({data:[]})}async search(ue={}){const eo=await API.searchUsers(ue);return this.set({...eo,...ue}),eo}async get(ue){try{return await API.getUser(ue)}catch{return null}}async fetch(){return await API.getUsers()}async onboard(ue){return await API.onboardUsers(ue)}async invite(ue){const eo=ue.map(no=>{let ro;return no.admin||no.builder?ro={global:!0}:no.creator&&(ro={creator:!0}),{email:no.email,userInfo:{admin:no.admin?{global:!0}:void 0,builder:ro,userGroups:no.groups,roles:no.apps?no.apps:void 0}}});return API.inviteUsers(eo)}async removeInvites(ue){return API.removeUserInvites(ue)}async acceptInvite(ue,eo,no,ro){return API.acceptInvite({inviteCode:ue,password:eo,firstName:no,lastName:ro!=null&&ro.trim()?ro:void 0})}async fetchInvite(ue){return API.getUserInvite(ue)}async getInvites(){return API.getUserInvites()}async updateInvite(ue,eo){return API.updateUserInvite(ue,eo)}async getUserCountByApp(ue){return await API.getUserCountByApp(ue)}async create(ue){let eo=ue.users.map(ro=>{const oo={email:ro.email,password:ro.password,roles:{}};switch(ro.forceResetPassword&&(oo.forceResetPassword=ro.forceResetPassword),ro.role){case BudibaseRoles.AppUser:oo.builder={global:!1},oo.admin={global:!1};break;case BudibaseRoles.Developer:oo.builder={global:!0};break;case BudibaseRoles.Creator:oo.builder={creator:!0,global:!1};break;case BudibaseRoles.Admin:oo.admin={global:!0},oo.builder={global:!0};break}return oo});const no=await API.createUsers(eo,ue.groups);return licensing.setQuotaUsage(),await this.search(),no}async delete(ue){await API.deleteUser(ue),licensing.setQuotaUsage()}async bulkDelete(ue){const eo=API.deleteUsers(ue);return licensing.setQuotaUsage(),eo}async save(ue){const eo=await API.saveUser(ue);return licensing.setQuotaUsage(),eo}async addAppBuilder(ue,eo){return await API.addAppBuilder(ue,eo)}async removeAppBuilder(ue,eo){return await API.removeAppBuilder(ue,eo)}async getAccountHolder(){return await API.getAccountHolder()}getUserRole(ue){return ue?ue.email===ue.tenantOwnerEmail?BudibaseRoles.Owner:isAdmin(ue)?BudibaseRoles.Admin:isBuilder(ue)?BudibaseRoles.Developer:hasCreatorPermissions(ue)?BudibaseRoles.Creator:BudibaseRoles.AppUser:BudibaseRoles.AppUser}};const users=new UserStore$1;function createAdminStore(){const to=writable({loaded:!1,multiTenancy:!1,cloud:!1,isDev:!1,disableAccountPortal:!1,offlineMode:!1,maintenance:[]});async function ue(){await oo(),await eo(),get_store_value(to).cloud&&(await ro(),no()),to.update(ao=>(ao.loaded=!0,ao))}async function eo(){const ao=await API.getEnvironment();to.update(so=>(so.multiTenancy=ao.multiTenancy,so.cloud=ao.cloud,so.disableAccountPortal=ao.disableAccountPortal,so.accountPortalUrl=ao.accountPortalUrl,so.isDev=ao.isDev,so.baseUrl=ao.baseUrl,so.offlineMode=ao.offlineMode,so.maintenance=ao.maintenance,so.passwordMinLength=ao.passwordMinLength,so))}const no=async()=>{var so,lo;const ao=(lo=(so=get_store_value(to))==null?void 0:so.status)==null?void 0:lo.health;ao!=null&&ao.passing||await banner.showStatus()};async function ro(){const ao=await API.getSystemStatus();to.update(so=>(so.status=ao,so))}async function oo(){const ao=get_store_value(auth).tenantId,so=await API.getChecklist(ao);to.update(lo=>(lo.checklist=so,lo))}function io(){to.update(ao=>(ao.loaded=!1,ao))}return{subscribe:to.subscribe,init:ue,unload:io,getChecklist:oo}}const admin=createAdminStore();class AuthStore extends BudiStore{constructor(){super({accountPortalAccess:!1,tenantId:"default",tenantSet:!1,loaded:!1,postLogout:!1,isSSO:!1})}setUser(ue){this.set({loaded:!0,user:ue,accountPortalAccess:!!(ue!=null&&ue.accountPortalAccess),tenantId:(ue==null?void 0:ue.tenantId)||"default",tenantSet:!!ue,isSSO:ue!=null&&isSSOUser(ue),postLogout:!1}),ue&&analytics.activate().then(()=>{analytics.identify(ue._id)}).catch(()=>{})}async setOrganisation(ue){const eo=get_store_value(this.store).tenantId;auth.update(no=>(no.tenantId=ue,no.tenantSet=!!ue,no)),eo!==ue&&await admin.init()}async setInitInfo(ue){return await API.setInitInfo(ue),auth.update(eo=>(eo.initInfo=ue,eo)),ue}setPostLogout(){auth.update(ue=>(ue.postLogout=!0,ue))}async getInitInfo(){const ue=await API.getInitInfo();return auth.update(eo=>(eo.initInfo=ue,eo)),ue}async checkQueryString(){const eo=new URLSearchParams(window.location.search).get("tenantId");eo&&await this.setOrganisation(eo)}async setOrg(ue){await this.setOrganisation(ue)}async getSelf(){try{const ue=await API.fetchBuilderSelf();this.setUser(ue)}catch{this.setUser()}}async login(ue,eo){const no=get_store_value(this.store).tenantId;await API.logIn(no,ue,eo),await this.getSelf()}async logout(){await API.logOut(),this.setPostLogout(),this.setUser(),await this.setInitInfo({})}async updateSelf(ue){await API.updateSelf(ue);try{const eo=await API.fetchBuilderSelf();this.setUser(eo)}catch{this.setUser()}}async forgotPassword(ue){const eo=get_store_value(this.store).tenantId;await API.requestForgotPassword(eo,ue)}async resetPassword(ue,eo){const no=get_store_value(this.store).tenantId;await API.resetPassword(no,ue,eo)}async generateAPIKey(){return API.generateAPIKey()}async fetchAPIKey(){const ue=await API.fetchDeveloperInfo();return ue==null?void 0:ue.apiKey}}const auth=new AuthStore;class AppsStore extends BudiStore{constructor(){super({apps:[]}),this.extractAppId=this.extractAppId.bind(this),this.getProdAppID=this.getProdAppID.bind(this),this.updateSort=this.updateSort.bind(this),this.load=this.load.bind(this),this.save=this.save.bind(this)}extractAppId(ue){const eo=(ue==null?void 0:ue.split("_"))||[];return eo.length?eo[eo.length-1]:null}getProdAppID(ue){if(!ue)return ue;let eo,no="";if(ue.startsWith("app_dev")){const ro=ue.split("app_dev");ro.shift(),eo=ro.join("app_dev")}else if(!ue.startsWith("app"))eo=ue,no="_";else return ue;return`app${no}${eo}`}async updateSort(ue){this.update(eo=>({...eo,sortBy:ue})),await this.updateUserSort(ue)}async updateUserSort(ue){try{await auth.updateSelf({appSort:ue})}catch(eo){console.error("couldn't save user sort: ",eo)}}async load(){const ue=await API.getApps();if(Array.isArray(ue)){let eo={},no=ue.filter(io=>io.status===AppStatus.DEV),ro=ue.filter(io=>io.status===AppStatus.DEPLOYED);no.forEach(io=>{const ao=this.extractAppId(io.appId);ao&&(eo[ao]={...io,devId:io.appId,devRev:io._rev})}),ro.forEach(io=>{const ao=this.extractAppId(io.appId);if(!ao||!eo[ao])return;let so={};eo[ao]&&(so={updatedBy:eo[ao].updatedBy,updatedAt:eo[ao].updatedAt}),eo[ao]={...eo[ao],...io,...so,prodId:io.appId,prodRev:io._rev}});const oo=Object.values(eo);oo.forEach(io=>{const ao=this.extractAppId(io.devId);ao&&(io.appId=ao),delete io._id,delete io._rev}),this.update(io=>({...io,apps:oo}))}else this.update(eo=>({...eo,apps:[]}))}async save(ue,eo){await API.saveAppMetadata(ue,eo),this.update(no=>{const ro=no.apps.findIndex(oo=>oo.instance._id===ue);if(ro!==-1){let oo=no.apps[ro];oo={...oo,...eo},no.apps.splice(ro,1,oo)}return no})}}const appsStore=new AppsStore,sortBy=derived([appsStore,auth],([to,ue])=>{var eo;return to.sortBy||((eo=ue.user)==null?void 0:eo.appSort)||"name"}),enrichedApps=derived([appsStore,auth,sortBy],([to,ue,eo])=>{const no=to.apps.map(ro=>{var io;const oo=ue.user;return{...ro,deployed:ro.status===AppStatus.DEPLOYED,lockedYou:ro.lockedBy!=null&&ro.lockedBy.email===(oo==null?void 0:oo.email),lockedOther:ro.lockedBy!=null&&ro.lockedBy.email!==(oo==null?void 0:oo.email),favourite:!!((io=oo==null?void 0:oo.appFavourites)!=null&&io.includes(ro.appId))}});return eo==="status"?no.sort((ro,oo)=>{var io,ao;return ro.favourite===oo.favourite?ro.status===oo.status?((io=ro.name)==null?void 0:io.toLowerCase())<((ao=oo.name)==null?void 0:ao.toLowerCase())?-1:1:ro.status===AppStatus.DEPLOYED?-1:1:ro.favourite?-1:1}):eo==="updated"?no==null?void 0:no.sort((ro,oo)=>{if(ro.favourite===oo.favourite){const io=ro.updatedAt||"9999",ao=oo.updatedAt||"9999";return io<ao?1:-1}return ro.favourite?-1:1}):no==null?void 0:no.sort((ro,oo)=>{var io,ao;return ro.favourite===oo.favourite?((io=ro.name)==null?void 0:io.toLowerCase())<((ao=oo.name)==null?void 0:ao.toLowerCase())?-1:1:ro.favourite?-1:1})});class EmailStore extends BudiStore{constructor(){super({templates:[]})}async fetchTemplates(){const ue=await API.getEmailTemplateDefinitions(),eo=await API.getEmailTemplates();this.set({definitions:ue,templates:eo})}async saveTemplate(ue){const eo=await API.saveEmailTemplate(ue);ue._rev=eo._rev,ue._id=eo._id,this.update(no=>{const ro=no.templates.findIndex(oo=>oo.purpose===eo.purpose);return no.templates.splice(ro,1,ue),no})}}const email=new EmailStore;class OIDCStore extends BudiStore{constructor(){super({})}async init(){const ue=get_store_value(auth).tenantId,eo=await API.getOIDCConfigs(ue);this.set(eo[0]||{})}}const oidc=new OIDCStore;function templatesStore(){const{subscribe:to,set:ue}=writable([]);return{subscribe:to,load:async()=>{const eo=await API.getAppTemplates();ue(eo)}}}const templates=templatesStore(),ExpiringKeys={LICENSING_PAYMENT_FAILED:"licensing_payment_failed",LICENSING_ACCOUNT_DOWNGRADED_MODAL:"licensing_account_downgraded_modal",LICENSING_APP_LIMIT_MODAL:"licensing_app_limit_modal",LICENSING_ROWS_WARNING_BANNER:"licensing_rows_warning_banner",LICENSING_AUTOMATIONS_WARNING_BANNER:"licensing_automations_warning_banner",LICENSING_QUERIES_WARNING_BANNER:"licensing_queries_warning_banner",LICENSING_USERS_ABOVE_LIMIT_BANNER:"licensing_users_above_limit_banner"},StripeStatus={PAST_DUE:"past_due",ACTIVE:"active"},UNLIMITED=-1,ONE_DAY_MILLIS=864e5;class LicensingStore extends BudiStore{constructor(){super({goToUpgradePage:()=>{},goToPricingPage:()=>{},license:void 0,isFreePlan:!0,isEnterprisePlan:!0,isBusinessPlan:!0,groupsEnabled:!1,backupsEnabled:!1,brandingEnabled:!1,scimEnabled:!1,environmentVariablesEnabled:!1,budibaseAIEnabled:!1,customAIConfigsEnabled:!1,auditLogsEnabled:!1,quotaUsage:void 0,usageMetrics:void 0,quotaResetDaysRemaining:void 0,quotaResetDate:void 0,accountPastDue:!1,pastDueEndDate:void 0,pastDueDaysRemaining:void 0,accountDowngraded:!1,userCount:void 0,userLimit:void 0,userLimitReached:!1,errUserLimit:!1})}usersLimitReached(ue,eo=get_store_value(this.store).userLimit){return eo===UNLIMITED||eo===void 0?!1:ue>=eo}usersLimitExceeded(ue,eo=get_store_value(this.store).userLimit){return eo===UNLIMITED||eo===void 0?!1:ue>eo}async isCloud(){let ue=get_store_value(admin);return ue.loaded||(await admin.init(),ue=get_store_value(admin)),ue.cloud}async init(){this.setNavigation(),this.setLicense(),await this.setQuotaUsage()}setNavigation(){var io;const ue=get_store_value(admin),eo=get_store_value(auth),no=(io=eo==null?void 0:eo.user)!=null&&io.accountPortalAccess?`${ue.accountPortalUrl}/portal/upgrade`:"/builder/portal/account/upgrade",ro=()=>{window.location.href=no},oo=()=>{window.open("https://budibase.com/pricing/","_blank")};this.update(ao=>({...ao,goToUpgradePage:ro,goToPricingPage:oo}))}setLicense(){var wo;const ue=(wo=get_store_value(auth).user)==null?void 0:wo.license,eo=ue==null?void 0:ue.plan.type,no=(ue==null?void 0:ue.features)||[],ro=eo===PlanType.ENTERPRISE,oo=eo===PlanType.FREE,io=eo===PlanType.BUSINESS,ao=eo===PlanType.ENTERPRISE_BASIC_TRIAL,so=no.includes(Feature.USER_GROUPS),lo=no.includes(Feature.APP_BACKUPS),co=no.includes(Feature.SCIM),uo=no.includes(Feature.ENVIRONMENT_VARIABLES),fo=no.includes(Feature.ENFORCEABLE_SSO),po=no.includes(Feature.BRANDING),ho=no.includes(Feature.AUDIT_LOGS),_o=no.includes(Feature.SYNC_AUTOMATIONS),go=no.includes(Feature.TRIGGER_AUTOMATION_RUN),bo=no.includes(Feature.APP_BUILDERS),vo=no.includes(Feature.BUDIBASE_AI),yo=no.includes(Feature.AI_CUSTOM_CONFIGS);this.update(ko=>({...ko,license:ue,isEnterprisePlan:ro,isFreePlan:oo,isBusinessPlan:io,isEnterpriseTrial:ao,groupsEnabled:so,backupsEnabled:lo,brandingEnabled:po,budibaseAIEnabled:vo,customAIConfigsEnabled:yo,scimEnabled:co,environmentVariablesEnabled:uo,auditLogsEnabled:ho,enforceableSSO:fo,syncAutomationsEnabled:_o,triggerAutomationRunEnabled:go,perAppBuildersEnabled:bo}))}async setQuotaUsage(){const ue=await API.getQuotaUsage();this.update(eo=>({...eo,quotaUsage:ue})),await this.setUsageMetrics()}async setUsageMetrics(){var ko,So,Eo,Io,Ao,To,Mo,Vo,Fo,Po,Ro;const ue=get_store_value(this.store).quotaUsage,eo=(ko=get_store_value(auth).user)==null?void 0:ko.license,no=new Date;if(!eo||!ue)return;const ro=[MonthlyQuotaName.QUERIES,MonthlyQuotaName.AUTOMATIONS].reduce((Do,qo)=>{var Zo;const Uo=eo.quotas.usage.monthly[qo].value,jo=(((Zo=ue.monthly.current)==null?void 0:Zo[qo])||0)/Uo*100;return Do[qo]=Uo>-1?Math.floor(jo):-1,Do},{}),oo=[StaticQuotaName.APPS,StaticQuotaName.ROWS].reduce((Do,qo)=>{const Uo=eo.quotas.usage.static[qo].value,jo=(ue.usageQuota[qo]||0)/Uo*100;return Do[qo]=Uo>-1?Math.floor(jo):-1,Do},{}),io=(Do,qo)=>qo>Do?Math.round((qo.getTime()-Do.getTime())/ONE_DAY_MILLIS):0,ao=new Date(ue.quotaReset),so=io(no,ao),lo=!!((Eo=(So=eo.billing)==null?void 0:So.subscription)!=null&&Eo.downgradeAt)&&((Ao=(Io=eo.billing)==null?void 0:Io.subscription)==null?void 0:Ao.downgradeAt)<=no.getTime()&&((Mo=(To=eo.billing)==null?void 0:To.subscription)==null?void 0:Mo.status)===StripeStatus.PAST_DUE&&eo.plan.type===PlanType.FREE,co=(Fo=(Vo=eo.billing)==null?void 0:Vo.subscription)==null?void 0:Fo.pastDueAt,uo=(Ro=(Po=eo.billing)==null?void 0:Po.subscription)==null?void 0:Ro.downgradeAt;let fo,po;co&&uo&&(po=new Date(uo),fo=io(new Date(co),po));const _o=eo.quotas.usage.static.users.value,go=ue.usageQuota.users,bo=this.usersLimitReached(go,_o),vo=this.usersLimitExceeded(go,_o),wo=await this.isCloud()&&eo.plan.model===PlanModel$1.PER_USER&&vo;this.update(Do=>({...Do,usageMetrics:{...ro,...oo},quotaResetDaysRemaining:so,quotaResetDate:ao,accountDowngraded:lo,accountPastDue:co!=null,pastDueEndDate:po,pastDueDaysRemaining:fo,userCount:go,userLimit:_o,userLimitReached:bo,errUserLimit:wo}))}}const licensing=new LicensingStore;class GroupStore extends BudiStore{constructor(){super([]),this.updateStore=ue=>{this.update(eo=>{const no=eo.findIndex(ro=>ro._id===ue._id);return no>=0?eo.splice(no,1,ue):eo.push(ue),eo})}}async init(){if(get_store_value(licensing).groupsEnabled){const ue=await API.getGroups();this.set(ue)}}async refreshGroup(ue){const eo=await API.getGroup(ue);this.updateStore(eo)}async save(ue){const{...eo}=ue;delete eo.scimInfo;const no=await API.saveGroup(eo);return ue._id=no._id,ue._rev=no._rev,this.updateStore(ue),ue}async delete(ue){await API.deleteGroup(ue._id,ue._rev),this.update(eo=>{const no=eo.findIndex(ro=>ro._id===ue._id);return no!==-1&&eo.splice(no,1),eo})}async addUser(ue,eo){await API.addUsersToGroup(ue,[eo]),await this.refreshGroup(ue)}async removeUser(ue,eo){await API.removeUsersFromGroup(ue,[eo]),await this.refreshGroup(ue)}async addApp(ue,eo,no){await API.addAppsToGroup(ue,[{appId:eo,roleId:no}]),await this.refreshGroup(ue)}async removeApp(ue,eo){await API.removeAppsFromGroup(ue,[{appId:eo}]),await this.refreshGroup(ue)}getGroupAppIds(ue){var no;let eo=Object.keys((ue==null?void 0:ue.roles)||{});return(no=ue==null?void 0:ue.builder)!=null&&no.apps&&(eo=eo.concat(ue.builder.apps)),eo}async addGroupAppBuilder(ue,eo){return await API.addGroupAppBuilder(ue,eo)}async removeGroupAppBuilder(ue,eo){return await API.removeGroupAppBuilder(ue,eo)}}const groups=new GroupStore;function createPluginsStore(){const{subscribe:to,set:ue,update:eo}=writable([]);async function no(){const ao=await API.getPlugins();ue(ao)}async function ro(ao){await API.deletePlugin(ao),eo(so=>(so=so.filter(lo=>lo._id!==ao),so))}async function oo(ao,so,lo=null){let co={source:ao,url:so};switch(ao){case PluginSource.URL:co.headers=lo;break;case PluginSource.GITHUB:co.githubToken=lo;break}let fo=(await API.createPlugin(co)).plugin;eo(po=>{const ho=po.findIndex(_o=>_o._id===fo._id);return ho>=0?po.splice(ho,1,fo):po.push(fo),po})}async function io(ao){if(!ao)return;let so=new FormData;so.append("file",ao);let co=(await API.uploadPlugin(so)).plugins[0];eo(uo=>{const fo=uo.findIndex(po=>po._id===co._id);return fo>=0?uo.splice(fo,1,co):uo.push(co),uo})}return{subscribe:to,load:no,createPlugin:oo,deletePlugin:ro,uploadPlugin:io}}const plugins$1=createPluginsStore();class BackupStore extends BudiStore{constructor(){super({})}selectBackup(ue){this.update(eo=>(eo.selectedBackup=ue,eo))}async searchBackups(ue,eo){return API.searchBackups(ue,eo)}async restoreBackup(ue,eo,no){return API.restoreBackup(ue,eo,no)}async deleteBackup(ue,eo){return API.deleteBackup(ue,eo)}async createManualBackup(ue){return API.createManualBackup(ue)}}const backups=new BackupStore;class EnvironmentStore extends BudiStore{constructor(){super({variables:[],status:{encryptionKeyAvailable:!1}})}async checkStatus(){const ue=await API.checkEnvironmentVariableStatus();this.update(eo=>(eo.status=ue,eo))}async loadVariables(){if(get_store_value(licensing).environmentVariablesEnabled){const eo=(await API.fetchEnvironmentVariables()).variables.map(no=>({name:no}));this.update(no=>(no.variables=eo,no))}}async createVariable(ue){await API.createEnvironmentVariable(ue);let eo={name:ue.name};this.update(no=>(no.variables=[eo,...no.variables],no))}async deleteVariable(ue){await API.deleteEnvironmentVariable(ue),this.update(eo=>(eo.variables=eo.variables.filter(no=>no.name!==ue),eo))}async updateVariable(ue,eo){await API.updateEnvironmentVariable(ue,eo)}async upgradePanelOpened(){await API.publishEvent(EventPublishType$1.ENVIRONMENT_VARIABLE_UPGRADE_PANEL_OPENED)}}const environment=new EnvironmentStore,menu=derived([admin,auth],([to,ue])=>{var lo;const eo=ue==null?void 0:ue.user,no=eo!=null&&isAdmin(eo),ro=eo!=null&&isGlobalBuilder(eo),oo=to==null?void 0:to.cloud;let io=[{title:"Users",href:"/builder/portal/users/users"}];io.push({title:"Groups",href:"/builder/portal/users/groups"});let ao=[{title:"Apps",href:"/builder/portal/apps"}];if(ro&&(ao.push({title:"Users",href:"/builder/portal/users",subPages:io}),ao.push({title:"Plugins",href:"/builder/portal/plugins"})),no){let co=[{title:"Auth",href:"/builder/portal/settings/auth"},{title:"Email",href:"/builder/portal/settings/email"},{title:"Organisation",href:"/builder/portal/settings/organisation"},{title:"Branding",href:"/builder/portal/settings/branding"},{title:"Environment",href:"/builder/portal/settings/environment"},{title:"AI",href:"/builder/portal/settings/ai"}];oo||(co.push({title:"Version",href:"/builder/portal/settings/version"}),co.push({title:"Diagnostics",href:"/builder/portal/settings/diagnostics"})),ao.push({title:"Settings",href:"/builder/portal/settings",subPages:[...co].sort((uo,fo)=>uo.title.localeCompare(fo.title))})}let so=[{title:"Usage",href:"/builder/portal/account/usage"}];return no&&(so.push({title:"Audit Logs",href:"/builder/portal/account/auditLogs"}),oo||so.push({title:"System Logs",href:"/builder/portal/account/systemLogs"})),oo&&(eo!=null&&eo.accountPortalAccess)?so.push({title:"Upgrade",href:(to==null?void 0:to.accountPortalUrl)+"/portal/upgrade"}):!oo&&no&&so.push({title:"Upgrade",href:"/builder/portal/account/upgrade"}),eo!=null&&eo.accountPortalAccess&&((lo=eo==null?void 0:eo.account)!=null&&lo.stripeCustomerId)&&so.push({title:"Billing",href:(to==null?void 0:to.accountPortalUrl)+"/portal/billing"}),ao.push({title:"Account",href:"/builder/portal/account",subPages:so}),ao});class AuditLogsStore extends BudiStore{constructor(){super({})}async search(ue={}){if(get_store_value(licensing).auditLogsEnabled){const eo=await API.searchAuditLogs(ue);return this.update(no=>({...no,logs:eo})),eo}}async getEventDefinitions(){const ue=await API.getEventDefinitions();this.update(eo=>({...eo,events:ue.events}))}getDownloadUrl(ue={}){return API.getDownloadUrl(ue)}}const auditLogs=new AuditLogsStore;class FeatureStore extends DerivedBudiStore{constructor(){const ue=eo=>derived([eo,licensing],([no,ro])=>({isScimEnabled:no.scimConfigEnabled&&ro.scimEnabled}));super({scimConfigEnabled:!1},ue)}async init(){const ue=await API.getConfig(ConfigType.SCIM);this.update(eo=>({...eo,scimConfigEnabled:isConfig(ue)&&isSCIMConfig(ue)&&ue.config.enabled}))}}const features=new FeatureStore,getThemeStore=()=>{const to=document.documentElement,eo=createLocalStorageStore("bb-theme",{theme:DefaultBuilderTheme}),no=derived(eo,ro=>({...ro,theme:ensureValidTheme(ro.theme,DefaultBuilderTheme)}));return no.subscribe(({theme:ro})=>{const oo=getThemeClassNames(ro).split(" ");ThemeOptions.forEach(io=>{const ao=`${ThemeClassPrefix}${io.id}`;to.classList.toggle(ao,oo.includes(ao))})}),{...eo,subscribe:no.subscribe}},themeStore$1=getThemeStore(),createTemporalStore=()=>{const eo=createLocalStorageStore("bb-temporal",{}),no=(oo,io,ao)=>{const so={...io,expiry:Date.now()+ao*1e3};eo.update(lo=>({...lo,[oo]:so}))},ro=oo=>{const io=get_store_value(eo)[oo];return io?io.expiry<Date.now()?(eo.update(so=>(delete so[oo],so)),null):io:void 0};return{subscribe:eo.subscribe,actions:{setExpiring:no,getExpiring:ro}}},temporalStore=createTemporalStore();function createNavigationStore(){const to=writable({initialisated:!1,goto:void 0}),{set:ue,subscribe:eo}=to;return{subscribe:eo,actions:{init:ro=>{if(typeof ro!="function")throw new Error(`gotoFunc must be a function, found a "${typeof ro}" instead`);ue({initialisated:!0,goto:ro})}}}}const navigation=createNavigationStore(),featureFlags=derived(auth,to=>{var ue;return{...FeatureFlagDefaults,...((ue=to==null?void 0:to.user)==null?void 0:ue.flags)||{}}}),sideBarCollapsed=writable(!1),convertOldFieldFormat=to=>to?to.map(eo=>typeof eo=="string"?{field:eo,active:!0}:typeof(eo==null?void 0:eo.active)!="boolean"?{field:eo.name,active:!0}:eo):[],getComponentForField=(to,ue)=>{if(!to||!(ue!=null&&ue[to]))return null;const eo=ue[to].type;return FieldTypeToComponentMap[eo]},FieldTypeToComponentMap={[FieldType.STRING]:"stringfield",[FieldType.NUMBER]:"numberfield",[FieldType.BIGINT]:"bigintfield",[FieldType.OPTIONS]:"optionsfield",[FieldType.ARRAY]:"multifieldselect",[FieldType.BOOLEAN]:"booleanfield",[FieldType.LONGFORM]:"longformfield",[FieldType.DATETIME]:"datetimefield",[FieldType.SIGNATURE_SINGLE]:"signaturesinglefield",[FieldType.ATTACHMENTS]:"attachmentfield",[FieldType.ATTACHMENT_SINGLE]:"attachmentsinglefield",[FieldType.LINK]:"relationshipfield",[FieldType.JSON]:"jsonfield",[FieldType.BARCODEQR]:"codescanner",[FieldType.BB_REFERENCE]:"bbreferencefield",[FieldType.BB_REFERENCE_SINGLE]:"bbreferencesinglefield"},{TypeIconMap}=Constants$1,AUTO_COLUMN_SUB_TYPES=AutoFieldSubType,AUTO_COLUMN_DISPLAY_NAMES={AUTO_ID:"Auto ID",CREATED_BY:"Created By",CREATED_AT:"Created At",UPDATED_BY:"Updated By",UPDATED_AT:"Updated At"},FIELDS={STRING:{name:"Text",type:FieldType.STRING,icon:TypeIconMap[FieldType.STRING],constraints:{type:"string",length:{},presence:!1}},BARCODEQR:{name:"Barcode / QR",type:FieldType.BARCODEQR,icon:TypeIconMap[FieldType.BARCODEQR],constraints:{type:"string",length:{},presence:!1}},LONGFORM:{name:"Long form text",type:FieldType.LONGFORM,icon:TypeIconMap[FieldType.LONGFORM],constraints:{type:"string",length:{},presence:!1}},OPTIONS:{name:"Single select",type:FieldType.OPTIONS,icon:TypeIconMap[FieldType.OPTIONS],constraints:{type:"string",presence:!1,inclusion:[]}},ARRAY:{name:"Multi select",type:FieldType.ARRAY,icon:TypeIconMap[FieldType.ARRAY],constraints:{type:"array",presence:!1,inclusion:[]}},NUMBER:{name:"Number",type:FieldType.NUMBER,icon:TypeIconMap[FieldType.NUMBER],constraints:{type:"number",presence:!1,numericality:{greaterThanOrEqualTo:"",lessThanOrEqualTo:""}}},BIGINT:{name:"Big integer",type:FieldType.BIGINT,icon:TypeIconMap[FieldType.BIGINT]},BOOLEAN:{name:"Boolean",type:FieldType.BOOLEAN,icon:TypeIconMap[FieldType.BOOLEAN],constraints:{type:"boolean",presence:!1}},DATETIME:{name:"Date / time",type:FieldType.DATETIME,icon:TypeIconMap[FieldType.DATETIME],constraints:{type:"string",length:{},presence:!1,datetime:{latest:"",earliest:""}}},ATTACHMENT_SINGLE:{name:"Single attachment",type:FieldType.ATTACHMENT_SINGLE,icon:TypeIconMap[FieldType.ATTACHMENT_SINGLE],constraints:{presence:!1}},ATTACHMENTS:{name:"Multi attachment",type:FieldType.ATTACHMENTS,icon:TypeIconMap[FieldType.ATTACHMENTS],constraints:{type:"array",presence:!1}},SIGNATURE_SINGLE:{name:"Signature",type:FieldType.SIGNATURE_SINGLE,icon:"AnnotatePen",constraints:{presence:!1}},LINK:{name:"Relationship",type:FieldType.LINK,icon:TypeIconMap[FieldType.LINK],constraints:{type:"array",presence:!1}},AUTO:{name:"Auto column",type:FieldType.AUTO,icon:TypeIconMap[FieldType.AUTO],constraints:{}},FORMULA:{name:"Formula",type:FieldType.FORMULA,icon:TypeIconMap[FieldType.FORMULA],constraints:{}},AI:{name:"AI",type:FieldType.AI,icon:TypeIconMap[FieldType.AI],constraints:{}},JSON:{name:"JSON",type:FieldType.JSON,icon:TypeIconMap[FieldType.JSON],constraints:{type:"object",presence:!1}},USER:{name:"Single user",type:FieldType.BB_REFERENCE_SINGLE,subtype:BBReferenceFieldSubType.USER,icon:TypeIconMap[FieldType.BB_REFERENCE_SINGLE][BBReferenceFieldSubType.USER]},USERS:{name:"Multi user",type:FieldType.BB_REFERENCE,subtype:BBReferenceFieldSubType.USER,icon:TypeIconMap[FieldType.BB_REFERENCE][BBReferenceFieldSubType.USER],constraints:{type:"array"}}},Roles$1={ADMIN:"ADMIN",POWER:"POWER",BASIC:"BASIC",PUBLIC:"PUBLIC",BUILDER:"BUILDER"};function isAutoColumnUserRelationship(to){return to===AUTO_COLUMN_SUB_TYPES.CREATED_BY||to===AUTO_COLUMN_SUB_TYPES.UPDATED_BY}const PrettyRelationshipDefinitions={MANY:"Many rows",ONE:"One row"},BUDIBASE_INTERNAL_DB_ID=INTERNAL_TABLE_SOURCE_ID,DEFAULT_BB_DATASOURCE_ID="datasource_internal_bb_default",BUDIBASE_DATASOURCE_TYPE="budibase",DB_TYPE_INTERNAL="internal",DB_TYPE_EXTERNAL="external",IntegrationTypes={POSTGRES:"POSTGRES",MONGODB:"MONGODB",COUCHDB:"COUCHDB",S3:"S3",MYSQL:"MYSQL",REST:"REST",DYNAMODB:"DYNAMODB",ELASTICSEARCH:"ELASTICSEARCH",SQL_SERVER:"SQL_SERVER",AIRTABLE:"AIRTABLE",ARANGODB:"ARANGODB",ORACLE:"ORACLE",INTERNAL:"INTERNAL",GOOGLE_SHEETS:"GOOGLE_SHEETS",FIRESTORE:"FIRESTORE",REDIS:"REDIS",SNOWFLAKE:"SNOWFLAKE"},SchemaTypeOptions=[{label:"Text",value:FieldType.STRING},{label:"Number",value:FieldType.NUMBER},{label:"Boolean",value:FieldType.BOOLEAN},{label:"Datetime",value:FieldType.DATETIME},{label:"JSON",value:FieldType.JSON}],SchemaTypeOptionsExpanded=SchemaTypeOptions.map(to=>({...to,value:{type:to.value}})),RawRestBodyTypes={NONE:"none",FORM:"form",ENCODED:"encoded",JSON:"json",TEXT:"text",XML:"xml"},RestBodyTypes=[{name:"none",value:"none"},{name:"form-data",value:"form"},{name:"x-www-form-encoded",value:"encoded"},{name:"raw (JSON)",value:"json"},{name:"raw (XML)",value:"xml"},{name:"raw (Text)",value:"text"}],PaginationTypes=[{label:"Page number based",value:"page"},{label:"Cursor based",value:"cursor"}],PaginationLocations=[{label:"Query parameters",value:"query"},{label:"Request body",value:"body"}],DatasourceTypes={RELATIONAL:"Relational",NON_RELATIONAL:"Non-relational",SPREADSHEET:"Spreadsheet",OBJECT_STORE:"Object store",GRAPH:"Graph",API:"API"},{ContextScopes}=Constants$1,CAPTURE_VAR_INSIDE_TEMPLATE=/{{([^}]+)}}/g,CAPTURE_VAR_INSIDE_JS=/\$\("([^")]+)"\)/g,UpdateReferenceAction={ADD:"add",DELETE:"delete",MOVE:"move"},getBindableProperties=(to,ue)=>{const eo=getContextBindings(to,ue),no=getUserBindings(),ro=getUrlBindings(to),oo=getDeviceBindings(),io=getStateBindings(),ao=getSelectedRowsBindings(to),so=getRoleBindings(),lo=getEmbedBindings();return[...eo,...ro,...io,...no,...oo,...ao,...so,...lo]},getRestBindings=()=>{const to=get_store_value(licensing).environmentVariablesEnabled;return[...getUserBindings(),...getAuthBindings(),...to?getEnvironmentBindings():[]]},getAuthBindings=()=>{let to=[];const ue=makePropSafe("user"),eo=makePropSafe("oauth2"),no=makePropSafe("accessToken");return to=[{runtime:`${ue}.${eo}.${no}`,readable:"Current User.OAuthToken",key:"accessToken",display:{name:"OAuthToken",type:"text"}}].map(oo=>({type:"context",runtimeBinding:oo.runtime,readableBinding:oo.readable,fieldSchema:{type:"string",name:oo.key},providerId:"user",category:"Current User",display:oo.display})),to},getEnvironmentBindings=()=>get_store_value(environment).variables.map(ue=>({type:"context",runtimeBinding:`env.${makePropSafe(ue.name)}`,readableBinding:`env.${ue.name}`,category:"Environment",icon:"Key",display:{type:"string",name:ue.name}})),toBindingsArray=(to,ue,eo)=>to?Object.keys(to).reduce((no,ro)=>{if(!ro)return no;let oo={type:"context",runtimeBinding:ro,readableBinding:`${ue}.${ro}`,icon:"Brackets"};return eo&&(oo.category=eo),no.push(oo),no},[]):[],readableToRuntimeMap=(to,ue)=>!to||!ue?{}:Object.keys(ue).reduce((eo,no)=>(eo[no]=readableToRuntimeBinding(to,ue[no]),eo),{}),runtimeToReadableMap=(to,ue)=>!to||!ue?{}:Object.keys(ue).reduce((eo,no)=>(eo[no]=runtimeToReadableBinding(to,ue[no]),eo),{}),getComponentBindableProperties=(to,ue)=>{if(!to||!ue)return[];const eo=findComponent(to.props,ue),no=componentStore.getDefinition(eo==null?void 0:eo._component);if(!(no!=null&&no.context))return[];const ro=Array.isArray(no.context)?no.context:[no.context];return generateComponentContextBindings(to,{component:eo,definition:no,contexts:ro})},getAllComponentContexts=(to,ue,eo,no={includeSelf:!1})=>{if(!to||!ue)return[];let ro={};const oo=findComponentPath(to.props,ue),io=oo.map(co=>co._id),ao=buildContextTreeLookupMap(to.props),so=co=>uo=>{const fo=ao[uo._id];if(fo!=="root"&&!io.includes(fo))return;const po=uo._component;getComponentContexts(po).forEach(_o=>{eo&&_o.type!==eo||(_o.scope||ContextScopes.Global)!==co||isContextCompatibleWithComponent(_o,uo)&&(ro[uo._id]||(ro[uo._id]={component:uo,definition:componentStore.getDefinition(po),contexts:[]}),ro[uo._id].contexts.push(_o))})};return findAllComponents(to.props).forEach(so(ContextScopes.Global)),oo.forEach(so(ContextScopes.Local)),no!=null&&no.includeSelf||delete ro[ue],Object.values(ro).filter(co=>co.contexts.length>0)},getActionProviders=(to,ue,eo,no={includeSelf:!1})=>getAllComponentContexts(to,ue,"action",{includeSelf:no==null?void 0:no.includeSelf}).map(oo=>{var io,ao;return{...oo,action:(ao=(io=oo.contexts[0])==null?void 0:io.actions)==null?void 0:ao.find(so=>so.type===eo)}}).filter(({action:oo})=>oo!=null).map(({component:oo,action:io})=>{let ao=oo._id;return io.suffix&&(ao+=`-${io.suffix}`),{readableBinding:oo._instanceName,runtimeBinding:ao}}),getDatasourceForProvider=(to,ue)=>{const eo=componentStore.getComponentSettings(ue==null?void 0:ue._component),no=eo.find(ao=>ao.type==="dataProvider");if(no){const ao=ue[no.key],so=extractLiteralHandlebarsID(ao),lo=findComponent(to==null?void 0:to.props,so);return getDatasourceForProvider(to,lo)}const ro=["dataSource","table","schema"],oo=eo.find(ao=>ro.includes(ao.type));if(!oo)return null;const io=ue[oo==null?void 0:oo.key];return typeof io=="string"?{tableId:io,type:"table"}:io},getContextBindings=(to,ue)=>getAllComponentContexts(to,ue).map(no=>generateComponentContextBindings(to,no)).flat(),generateComponentContextBindings=(to,ue)=>{const{component:eo,definition:no,contexts:ro}=ue;if(!eo||!no||!(ro!=null&&ro.length))return[];let oo=[];return ro.forEach(io=>{var ho;if(!(io!=null&&io.type))return;let ao,so,lo,co=io.suffix;if(io.type==="form")ao=buildFormSchema(eo,to),lo="Fields";else if(io.type==="static")ao={},(io.values||[]).forEach(go=>{ao[go.key]={name:go.label,type:go.type||"string"}});else if(io.type==="schema"){const _o=getDatasourceForProvider(to,eo);if(!_o)return;const go=getSchemaForDatasource(to,_o);if(ao=go.schema,so=go.table,_o.type==="jsonarray"||_o.type==="queryarray"){const bo=_o.label.split(".");lo=bo[bo.length-1]}else if(_o.type==="viewV2"){const bo=Object.values((so==null?void 0:so.views)||{}).find(vo=>vo.id===_o.id);lo=bo==null?void 0:bo.name}else lo=(ho=go.table)==null?void 0:ho.name}if(!ao)return;const uo=Object.keys(ao).sort();let fo=eo._id;co&&(fo+=`-${co}`);const po=makePropSafe(fo);uo.forEach(_o=>{var ko;const go=ao[_o],bo=_o.split(".").map(makePropSafe).join("."),vo=`${po}.${bo}`;let yo=eo._instanceName;lo&&(yo+=`.${lo}`),yo+=`.${go.name||_o}`;const wo=getComponentBindingCategory(eo,io,no);oo.push({type:"context",runtimeBinding:vo,readableBinding:`${yo}`,fieldSchema:go,providerId:fo,tableId:so==null?void 0:so._id,component:eo._component,category:wo.category,icon:wo.icon,display:{name:`${go.name||_o}`,type:((ko=go.display)==null?void 0:ko.type)||go.type}})})}),oo},isContextCompatibleWithComponent=(to,ue)=>{if(!ue)return!1;const{_component:eo,actionType:no}=ue,{type:ro}=to;return!(eo.endsWith("formblock")&&(no==="Create"&&ro==="schema"||no==="View"&&ro==="form"))},getComponentBindingCategory=(to,ue,eo)=>{let no=eo.icon,ro=to._instanceName;return to._component.endsWith("formblock")&&(ue.type==="form"?(ro=`${to._instanceName} - Fields`,no="Form"):ue.type==="schema"&&(ro=`${to._instanceName} - Row`,no="Data")),{icon:no,category:ro}},getUserBindings=()=>{let to=[];const{schema:ue}=getSchemaForDatasourcePlus(TableNames.USERS);ue.globalId={type:FieldType.STRING};const eo=Object.keys(ue).sort(),no=makePropSafe("user");return to=eo.reduce((ro,oo)=>{const io=ue[oo];return ro.push({type:"context",runtimeBinding:`${no}.${makePropSafe(oo)}`,readableBinding:`Current User.${oo}`,fieldSchema:io,providerId:"user",category:"Current User",icon:"User",display:{name:oo}}),ro},[]),to},getDeviceBindings=()=>{var ue;let to=[];if((ue=get_store_value(appStore).clientFeatures)!=null&&ue.deviceAwareness){const eo=makePropSafe("device");to=[{type:"context",runtimeBinding:`${eo}.${makePropSafe("mobile")}`,readableBinding:"Device.Mobile",category:"Device",icon:"DevicePhone",display:{type:"boolean",name:"mobile"}},{type:"context",runtimeBinding:`${eo}.${makePropSafe("tablet")}`,readableBinding:"Device.Tablet",category:"Device",icon:"DevicePhone",display:{type:"boolean",name:"tablet"}},{type:"context",runtimeBinding:`${eo}.${makePropSafe("theme")}`,readableBinding:"App.Theme",category:"Device",icon:"DevicePhone",display:{type:"string",name:"App Theme"}}]}return to},getSettingBindings=()=>{let to=[];const ue=makePropSafe("settings");return to=[{type:"context",runtimeBinding:`${ue}.${makePropSafe("url")}`,readableBinding:"Settings.url",category:"Settings",icon:"Settings",display:{type:"string",name:"url"}},{type:"context",runtimeBinding:`${ue}.${makePropSafe("logo")}`,readableBinding:"Settings.logo",category:"Settings",icon:"Settings",display:{type:"string",name:"logo"}},{type:"context",runtimeBinding:`${ue}.${makePropSafe("company")}`,readableBinding:"Settings.company",category:"Settings",icon:"Settings",display:{type:"string",name:"company"}}],to},getSelectedRowsBindings=to=>{var eo;let ue=[];if((eo=get_store_value(appStore).clientFeatures)!=null&&eo.rowSelection){let no=findAllMatchingComponents(to==null?void 0:to.props,io=>io._component.endsWith("table"));const ro=makePropSafe("rowSelection");ue=ue.concat(no.map(io=>({type:"context",runtimeBinding:`${ro}.${makePropSafe(io._id)}.${makePropSafe("selectedRows")}`,readableBinding:`${io._instanceName}.Selected Row IDs (deprecated)`,category:"Selected Row IDs (deprecated)",icon:"ViewRow",display:{name:io._instanceName}})));let oo=findAllMatchingComponents(to==null?void 0:to.props,io=>io._component.endsWith("tableblock"));ue=ue.concat(oo.map(io=>({type:"context",runtimeBinding:`${ro}.${makePropSafe(io._id+"-table")}.${makePropSafe("selectedRows")}`,readableBinding:`${io._instanceName}.Selected Row IDs (deprecated)`,category:"Selected Row IDs (deprecated)",icon:"ViewRow",display:{name:io._instanceName}})))}return ue},makeStateBinding=to=>({type:"context",runtimeBinding:`${makePropSafe("state")}.${makePropSafe(to)}`,readableBinding:`State.${to}`,category:"State",icon:"AutomatedSegment",display:{name:to}}),getStateBindings=()=>{var ue;let to=[];return(ue=get_store_value(appStore).clientFeatures)!=null&&ue.state&&(to=getAllStateVariables().map(makeStateBinding)),to},getUrlBindings=to=>{var ao;const eo=(((ao=to==null?void 0:to.routing)==null?void 0:ao.route)??"").split("/");let no=[];eo.forEach(so=>{so.startsWith(":")&&so.length>1&&no.push(so.replace(/:/g,"").replace(/\?/g,""))});const ro=makePropSafe("url"),oo=no.map(so=>({type:"context",runtimeBinding:`${ro}.${makePropSafe(so)}`,readableBinding:`URL.${so}`,category:"URL",icon:"RailTop",display:{type:"string",name:so}})),io={type:"context",runtimeBinding:makePropSafe("query"),readableBinding:"Query params",category:"URL",icon:"RailTop",display:{type:"object",name:"Query params"}};return oo.concat([io])},getRoleBindings=()=>(get_store_value(roles)||[]).map(to=>({type:"context",runtimeBinding:`'${to._id}'`,readableBinding:`Role.${to.uiMetadata.displayName}`,category:"Role",icon:"UserGroup",display:{type:"string",name:to.uiMetadata.displayName}})),getEventContextBindings=({settingKey:to,componentInstance:ue,componentId:eo,componentDefinition:no,asset:ro})=>{var co;let oo=[];ro=ro??get_store_value(selectedScreen);const io=ue??findComponent(ro.props,eo);if(!io)return oo;const ao=no??componentStore.getDefinition(io==null?void 0:io._component),lo=componentStore.getComponentSettings(io==null?void 0:io._component).find(uo=>uo.key===to);return(co=lo==null?void 0:lo.context)!=null&&co.length&&lo.context.forEach(uo=>{oo.push({readableBinding:uo.label,runtimeBinding:`${makePropSafe("eventContext")}.${makePropSafe(uo.key)}`,category:io._instanceName,icon:ao.icon,display:{name:uo.label}})}),oo},getActionBindings=(to,ue)=>{let eo=[];const no=to==null?void 0:to.findIndex(oo=>oo.id===ue);return no==null||no===-1||to.slice(0,no).forEach((oo,io)=>{const ao=ActionDefinitions.actions.find(so=>so.name===oo["##eventHandlerType"]);ao.context&&ao.context.forEach(so=>{eo.push({readableBinding:`Action ${io+1}.${so.label}`,runtimeBinding:`actions.${io}.${so.value}`,category:"Actions",icon:"JourneyAction",display:{name:so.label}})})}),eo},getEmbedBindings=()=>{let to=[];return to=[{type:"context",runtimeBinding:`${makePropSafe("embed")}`,readableBinding:"ParentWindow",category:"Embed",icon:"DistributeVertically"}],to},getSchemaForDatasourcePlus=(to,ue)=>{const no=(to==null?void 0:to.startsWith("view_"))?{type:"viewV2",id:to,tableId:to.split("_").slice(1,3).join("_")}:{type:"table",tableId:to};return getSchemaForDatasource(null,no,ue)},getSchemaForDatasource=(to,ue,eo)=>{var oo,io;eo=eo||{};let no,ro;if(ue){const{type:ao}=ue,so=get_store_value(tables).list;if(ao==="provider"){const ho=findComponent(to==null?void 0:to.props,ue.providerId),_o=getDatasourceForProvider(to,ho);return getSchemaForDatasource(to,_o,eo)}else if(ao==="query")ro=get_store_value(queries).list.find(_o=>_o._id===ue._id);else if(ao==="field"){ro={name:ue.fieldName};const{fieldType:ho}=ue;ho==="attachment"?no={url:{type:"string"},name:{type:"string"}}:ho==="array"&&(no={value:{type:"string"}})}else if(ao==="jsonarray"){ro=so.find(_o=>_o._id===ue.tableId);let ho=ro==null?void 0:ro.schema;no=getJSONArrayDatasourceSchema(ho,ue)}else if(ao==="queryarray"){ro=get_store_value(queries).list.find(bo=>bo._id===ue.tableId);let _o=ro==null?void 0:ro.schema,go=ro==null?void 0:ro.nestedSchemaFields;no=generateQueryArraySchemas(_o,go),no=getJSONArrayDatasourceSchema(no,ue)}else ro=so.find(ho=>ho._id===ue.tableId);if(ro&&!no)if(ao==="view")no=fp$1.cloneDeep((io=(oo=ro.views)==null?void 0:oo[ue.name])==null?void 0:io.schema);else if(ao==="viewV2"){const ho=Object.values(ro.views||{}).find(_o=>_o.id===ue.id);no=fp$1.cloneDeep(ho==null?void 0:ho.schema),Object.keys(no||{}).forEach(_o=>{no[_o].visible||delete no[_o]})}else ao==="query"&&(eo.formSchema||eo.searchableSchema)?(no={},(ro.parameters||[]).forEach(_o=>{_o!=null&&_o.name&&(no[_o.name]={..._o,type:"string"})})):no=fp$1.cloneDeep(ro.schema);if(no){let ho={};Object.keys(no).forEach(_o=>{const go=no[_o];if((go==null?void 0:go.type)==="json"){const bo=convertJSONSchemaToTableSchema(go,{squashObjects:!0});Object.keys(bo).forEach(vo=>{ho[`${_o}.${vo}`]={type:bo[vo].type,nestedJSON:!0}})}}),no={...no,...ho}}const lo=ro&&(ro==null?void 0:ro.sourceType)===DB_TYPE_INTERNAL,co=["table","link","viewV2"].includes(ue.type);let uo=co,fo=co&&lo;eo.formSchema?(uo=!1,fo=!1):eo.searchableSchema&&(uo=co&&lo),no&&(uo&&(no._id={type:"string"}),fo&&(no._rev={type:"string"}));let po={};Object.entries(no||{}).forEach(([ho,_o])=>{const go=Object.values(FIELDS).find(bo=>bo.type===_o.type&&bo.subtype===_o.subtype);typeof _o=="string"?po[ho]={type:_o,name:ho,display:{type:_o}}:po[ho]={..._o,name:ho,display:{type:(go==null?void 0:go.name)||_o.type}}}),no=po}return{schema:no,table:ro}},buildFormSchema=(to,ue)=>{var oo;let eo={};if(!to)return eo;if(to._component.endsWith("formblock")){let io={};const ao=getDatasourceForProvider(ue,to),so=getSchemaForDatasource(to,ao);if(!(so!=null&&so.schema))return io;if(!to.fields)Object.values(so.schema).filter(({autocolumn:lo,name:co})=>!lo&&!["_rev","_id"].includes(co)).forEach(({name:lo})=>{io[lo]={type:so==null?void 0:so.schema[lo].type}});else{const lo=convertOldFieldFormat(to.fields||[]);lo==null||lo.forEach(({field:co,active:uo})=>{uo&&so!=null&&so.schema[co]&&(io[co]={type:so==null?void 0:so.schema[co].type})})}return io}const ro=componentStore.getComponentSettings(to._component).find(io=>io.key==="field"&&io.type.startsWith("field/"));if(ro){const io=ro.type.split("field/")[1],ao=to.field||to._instanceName;io&&ao&&(eo[ao]={type:io})}return(oo=to._children)==null||oo.forEach(io=>{const ao=buildFormSchema(io,ue);eo={...eo,...ao}}),eo},getAllStateVariables=()=>{let to=[];getAllAssets().forEach(eo=>{findAllMatchingComponents(eo.props,no=>{const ro=componentStore.getComponentSettings(no._component),oo=["buttonConfiguration","fieldConfiguration","stepConfiguration"],io=(ao,so)=>{ao!=null&&ao.length&&(ao.filter(lo=>lo.type==="event").forEach(lo=>{to.push(so[lo.key])}),ao.filter(lo=>oo.includes(lo.type)).forEach(lo=>{const co=so[lo.key];Array.isArray(co)&&co.length&&co.forEach(uo=>{let fo=uo==null?void 0:uo._component;lo.type==="stepConfiguration"&&!fo&&(fo="@budibase/standard-components/multistepformblockstep");const po=componentStore.getComponentSettings(fo);io(po,uo)})}))};io(ro,no)})}),get_store_value(screenStore).screens.forEach(eo=>{eo.onLoad&&to.push(eo.onLoad)});let ue=new Set;return to.forEach(eo=>{Array.isArray(eo)&&eo.forEach(no=>{var ro,oo,io;no["##eventHandlerType"]==="Update State"&&((ro=no.parameters)==null?void 0:ro.type)==="set"&&((oo=no.parameters)!=null&&oo.key)&&((io=no.parameters)!=null&&io.value)&&ue.add(no.parameters.key)})}),Array.from(ue)},getAllAssets=()=>{let to=[];return to=to.concat(get_store_value(layoutStore).layouts||[]),to=to.concat(get_store_value(screenStore).screens||[]),to},shouldReplaceBinding=(to,ue,eo,no)=>{if(!(to!=null&&to.includes(ue)))return!1;const ro=no.runtimeBinding.includes(no.readableBinding),oo=eo==="readableBinding",ao=Object.keys(getJsHelperList()).filter(uo=>uo.includes(ue)&&to.includes(uo));if(ao.length>0){const uo=to.indexOf(ue),fo=uo+ue.length;for(let po of ao){const ho=to.indexOf(po),_o=ho+po.length;if(uo>=ho&&fo<=_o)return!1}}if(oo&&!ro)return to.indexOf(no.readableBinding)===-1;if(oo)return!0;const so=to.replace(/\s+/g,""),lo=ue.replace(/\s+/g,"");return![`[${lo}]`,`"${lo}"`,`'${lo}'`].find(uo=>so==null?void 0:so.includes(uo))},replaceBetween=(to,ue,eo,no)=>to.substring(0,ue)+no+to.substring(eo),bindingReplacement=(to,ue,eo)=>{const no=isJSBinding(ue);no&&(ue=decodeJSBinding(ue));const ro=no?CAPTURE_VAR_INSIDE_JS:CAPTURE_VAR_INSIDE_TEMPLATE,oo=eo==="runtimeBinding"?"readableBinding":"runtimeBinding";if(typeof ue!="string")return ue;const io=to.map(lo=>lo[oo]).sort((lo,co)=>co.length-lo.length),ao=ue.match(ro)||[];let so=ue;for(let lo of ao){let co=lo,uo=co;for(let fo of io){const po=to.find(ho=>ho[oo]===fo);if(no||shouldReplaceBinding(co,fo,eo,po)){let ho;do if(ho=uo.indexOf(fo),ho!==-1){let _o=ho+fo.length,go=Array(po[eo].length+1).join("*");uo=replaceBetween(uo,ho,_o,go),co=replaceBetween(co,ho,_o,po[eo])}while(ho!==-1)}}so=so.replace(lo,co)}return no&&(so=encodeJSBinding(so)),so},extractLiteralHandlebarsID=to=>{var ue;return!to||typeof to!="string"?null:(ue=to.match(/{{\s*literal\s*\[+([^\]]+)].*}}/))==null?void 0:ue[1]},readableToRuntimeBinding=(to,ue)=>bindingReplacement(to,ue,"runtimeBinding"),runtimeToReadableBinding=(to,ue)=>bindingReplacement(to,ue,"readableBinding"),updateReferencesInObject=({obj:to,modifiedIndex:ue,action:eo,label:no,originalIndex:ro})=>{const oo=new RegExp(`{{\\s*${no}\\.(\\d+)\\.`,"g"),io=(ao,so,lo)=>ao.replace(`{{ ${no}.${so}.`,`{{ ${no}.${lo}.`);for(const ao in to)if(typeof to[ao]=="string"){let so;for(;(so=oo.exec(to[ao]))!==null;){const lo=parseInt(so[1]);eo===UpdateReferenceAction.ADD&&lo>=ue?to[ao]=io(to[ao],lo,lo+1):eo===UpdateReferenceAction.DELETE&&lo>ue?to[ao]=io(to[ao],lo,lo-1):eo===UpdateReferenceAction.MOVE&&(lo===ro?to[ao]=io(to[ao],lo,ue):ue<=lo&&ue<ro?to[ao]=io(to[ao],lo,lo+1):ue>=lo&&ue>ro&&(to[ao]=io(to[ao],lo,lo-1)))}}else typeof to[ao]=="object"&&to[ao]!==null&&updateReferencesInObject({obj:to[ao],modifiedIndex:ue,action:eo,label:no,originalIndex:ro})},migrateReferencesInObject=({obj:to,label:ue="steps",steps:eo,originalIndex:no})=>{var io;const ro=new RegExp(`{{\\s*${ue}\\.(\\d+)\\.`,"g"),oo=(ao,so,lo)=>ao.replace(`{{ ${ue}.${so}.`,`{{ ${ue}.${lo}.`);for(const ao in to)if(typeof to[ao]=="string"){let so;for(;(so=ro.exec(to[ao]))!==null;){const lo=parseInt(so[1]);to[ao]=oo(to[ao],lo,(io=eo[lo])==null?void 0:io.id)}}else typeof to[ao]=="object"&&to[ao]!==null&&migrateReferencesInObject({obj:to[ao],steps:eo,originalIndex:no})},getComponentFieldOptions=(to,ue,eo,no=!0)=>{const ro=findClosestMatchingComponent(to,ue,so=>so._component==="@budibase/standard-components/form"),oo=getDatasourceForProvider(to,ro),io=getSchemaForDatasource(to,oo,{formSchema:!0}).schema;let ao=[eo];return no&&(eo==="field/options"||eo==="field/longform")&&(ao=[eo,"field/string"]),ao=ao.map(so=>so.slice(so.indexOf("/")+1)),Object.entries(io||{}).filter(so=>ao.includes(so[1].type)).map(so=>so[0])};/*!
|
|
498
|
+
`)).length,ro=0;ro<no;ro++){var io=to.charCodeAt(ro),ao=null;io<128?eo++:ao=io>127&&io<2048?String.fromCharCode(io>>6|192,63&io|128):String.fromCharCode(io>>12|224,io>>6&63|128,63&io|128),I(ao)||(eo>ue&&(oo+=to.substring(ue,eo)),oo+=ao,ue=eo=ro+1)}return eo>ue&&(oo+=to.substring(ue,to.length)),oo},oe=function(){function to(ue){return ue&&(ue.preventDefault=to.preventDefault,ue.stopPropagation=to.stopPropagation),ue}return to.preventDefault=function(){this.returnValue=!1},to.stopPropagation=function(){this.cancelBubble=!0},function(ue,eo,no,ro,oo){if(ue)if(ue.addEventListener&&!ro)ue.addEventListener(eo,no,!!oo);else{var io="on"+eo,ao=ue[io];ue[io]=function(so,lo,co){return function(uo){if(uo=uo||to(T==null?void 0:T.event)){var fo,po=!0;y(co)&&(fo=co(uo));var ho=lo.call(so,uo);return fo!==!1&&ho!==!1||(po=!1),po}}}(ue,no,ao)}else G.error("No valid element provided to register_event")}}();function ae(to,ue){for(var eo=0;eo<to.length;eo++)if(ue(to[eo]))return to[eo]}(function(to){to.GZipJS="gzip-js",to.Base64="base64"})(re||(re={}));var le="$people_distinct_id",ce="__alias",de="__timers",he="$autocapture_disabled_server_side",fe="$heatmaps_enabled_server_side",ve="$exception_capture_enabled_server_side",pe="$exception_capture_endpoint_suffix",ge="$web_vitals_enabled_server_side",_e="$session_recording_enabled_server_side",me="$console_log_recording_enabled_server_side",ye="$session_recording_network_payload_capture",be="$session_recording_canvas_recording",ke="$replay_sample_rate",we="$replay_minimum_duration",Se="$sesid",Ee="$session_is_sampled",Ie="$enabled_feature_flags",Re="$early_access_features",Fe="$stored_person_properties",xe="$stored_group_properties",Pe="$surveys",Te="$surveys_activated",Ce="$flag_call_reported",$e="$user_state",Oe="$client_session_props",Me="$capture_rate_limit",Ae="$initial_campaign_params",Le="$initial_referrer_info",De="$initial_person_info",qe="$epp",Ne="__POSTHOG_TOOLBAR__",Be=[le,ce,"__cmpns",de,_e,fe,Se,Ie,$e,Re,xe,Fe,Pe,Ce,Oe,Me,Ae,Le,qe],He="$active_feature_flags",Ue="$override_feature_flags",je="$feature_flag_payloads",Ge=function(to){var ue,eo={},no=h(X(to||{}));try{for(no.s();!(ue=no.n()).done;){var ro=u(ue.value,2),oo=ro[0],io=ro[1];io&&(eo[oo]=io)}}catch(ao){no.e(ao)}finally{no.f()}return eo},We=function(){function to(ue){i$1(this,to),this.instance=ue,this._override_warning=!1,this.featureFlagEventHandlers=[],this.reloadFeatureFlagsQueued=!1,this.reloadFeatureFlagsInAction=!1}return s(to,[{key:"getFlags",value:function(){return Object.keys(this.getFlagVariants())}},{key:"getFlagVariants",value:function(){var ue=this.instance.get_property(Ie),eo=this.instance.get_property(Ue);if(!eo)return ue||{};for(var no=J({},ue),ro=Object.keys(eo),oo=0;oo<ro.length;oo++)no[ro[oo]]=eo[ro[oo]];return this._override_warning||(G.warn(" Overriding feature flags!",{enabledFlags:ue,overriddenFlags:eo,finalFlags:no}),this._override_warning=!0),no}},{key:"getFlagPayloads",value:function(){return this.instance.get_property(je)||{}}},{key:"reloadFeatureFlags",value:function(){this.reloadFeatureFlagsQueued||(this.reloadFeatureFlagsQueued=!0,this._startReloadTimer())}},{key:"setAnonymousDistinctId",value:function(ue){this.$anon_distinct_id=ue}},{key:"setReloadingPaused",value:function(ue){this.reloadFeatureFlagsInAction=ue}},{key:"resetRequestQueue",value:function(){this.reloadFeatureFlagsQueued=!1}},{key:"_startReloadTimer",value:function(){var ue=this;this.reloadFeatureFlagsQueued&&!this.reloadFeatureFlagsInAction&&setTimeout(function(){!ue.reloadFeatureFlagsInAction&&ue.reloadFeatureFlagsQueued&&(ue.reloadFeatureFlagsQueued=!1,ue._reloadFeatureFlagsRequest())},5)}},{key:"_reloadFeatureFlagsRequest",value:function(){var ue=this;if(!this.instance.config.advanced_disable_feature_flags){this.setReloadingPaused(!0);var eo=this.instance.config.token,no=this.instance.get_property(Fe),ro=this.instance.get_property(xe),oo={token:eo,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:no,group_properties:ro,disable_flags:this.instance.config.advanced_disable_feature_flags||void 0};this.instance._send_request({method:"POST",url:this.instance.requestRouter.endpointFor("api","/decide/?v=3"),data:oo,compression:this.instance.config.disable_compression?void 0:re.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:function(io){var ao;ue.setReloadingPaused(!1);var so=!0;io.statusCode===200&&(ue.$anon_distinct_id=void 0,so=!1),ue.receivedFeatureFlags((ao=io.json)!==null&&ao!==void 0?ao:{},so),ue._startReloadTimer()}})}}},{key:"getFeatureFlag",value:function(ue){var eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.instance.decideEndpointWasHit||this.getFlags()&&this.getFlags().length>0){var no,ro=this.getFlagVariants()[ue],oo="".concat(ro),io=this.instance.get_property(Ce)||{};return(eo.send_event||!("send_event"in eo))&&(!(ue in io)||!io[ue].includes(oo))&&(m(io[ue])?io[ue].push(oo):io[ue]=[oo],(no=this.instance.persistence)===null||no===void 0||no.register(o({},Ce,io)),this.instance.capture("$feature_flag_called",{$feature_flag:ue,$feature_flag_response:ro})),ro}G.warn('getFeatureFlag for key "'+ue+`" failed. Feature flags didn't load in time.`)}},{key:"getFeatureFlagPayload",value:function(ue){return this.getFlagPayloads()[ue]}},{key:"isFeatureEnabled",value:function(ue){var eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.instance.decideEndpointWasHit||this.getFlags()&&this.getFlags().length>0)return!!this.getFeatureFlag(ue,eo);G.warn('isFeatureEnabled for key "'+ue+`" failed. Feature flags didn't load in time.`)}},{key:"addFeatureFlagsHandler",value:function(ue){this.featureFlagEventHandlers.push(ue)}},{key:"removeFeatureFlagsHandler",value:function(ue){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(function(eo){return eo!==ue})}},{key:"receivedFeatureFlags",value:function(ue,eo){if(this.instance.persistence){this.instance.decideEndpointWasHit=!0;var no=this.getFlagVariants(),ro=this.getFlagPayloads();(function(oo,io){var ao,so=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},lo=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},co=oo.featureFlags,uo=oo.featureFlagPayloads;if(co)if(m(co)){var fo,po={};if(co)for(var ho=0;ho<co.length;ho++)po[co[ho]]=!0;io&&io.register((o(fo={},He,co),o(fo,Ie,po),fo))}else{var _o=co,go=uo;oo.errorsWhileComputingFlags&&(_o=t$1(t$1({},so),_o),go=t$1(t$1({},lo),go)),io&&io.register((o(ao={},He,Object.keys(Ge(_o))),o(ao,Ie,_o||{}),o(ao,je,go||{}),ao))}})(ue,this.instance.persistence,no,ro),this._fireFeatureFlagsCallbacks(eo)}}},{key:"override",value:function(ue){var eo=arguments.length>1&&arguments[1]!==void 0&&arguments[1];if(!this.instance.__loaded||!this.instance.persistence)return G.uninitializedWarning("posthog.feature_flags.override");if(this._override_warning=eo,ue===!1)this.instance.persistence.unregister(Ue);else if(m(ue)){for(var no={},ro=0;ro<ue.length;ro++)no[ue[ro]]=!0;this.instance.persistence.register(o({},Ue,no))}else this.instance.persistence.register(o({},Ue,ue))}},{key:"onFeatureFlags",value:function(ue){var eo=this;if(this.addFeatureFlagsHandler(ue),this.instance.decideEndpointWasHit){var no=this._prepareFeatureFlagsForCallbacks(),ro=no.flags,oo=no.flagVariants;ue(ro,oo)}return function(){return eo.removeFeatureFlagsHandler(ue)}}},{key:"updateEarlyAccessFeatureEnrollment",value:function(ue,eo){var no,ro,oo=o({},"$feature_enrollment/".concat(ue),eo);this.instance.capture("$feature_enrollment_update",{$feature_flag:ue,$feature_enrollment:eo,$set:oo}),this.setPersonPropertiesForFlags(oo,!1);var io=t$1(t$1({},this.getFlagVariants()),{},o({},ue,eo));(no=this.instance.persistence)===null||no===void 0||no.register((o(ro={},He,Object.keys(Ge(io))),o(ro,Ie,io),ro)),this._fireFeatureFlagsCallbacks()}},{key:"getEarlyAccessFeatures",value:function(ue){var eo=this,no=arguments.length>1&&arguments[1]!==void 0&&arguments[1],ro=this.instance.get_property(Re);if(ro&&!no)return ue(ro);this.instance._send_request({transport:"XHR",url:this.instance.requestRouter.endpointFor("api","/api/early_access_features/?token=".concat(this.instance.config.token)),method:"GET",callback:function(oo){var io;if(oo.json){var ao=oo.json.earlyAccessFeatures;return(io=eo.instance.persistence)===null||io===void 0||io.register(o({},Re,ao)),ue(ao)}}})}},{key:"_prepareFeatureFlagsForCallbacks",value:function(){var ue=this.getFlags(),eo=this.getFlagVariants();return{flags:ue.filter(function(no){return eo[no]}),flagVariants:Object.keys(eo).filter(function(no){return eo[no]}).reduce(function(no,ro){return no[ro]=eo[ro],no},{})}}},{key:"_fireFeatureFlagsCallbacks",value:function(ue){var eo=this._prepareFeatureFlagsForCallbacks(),no=eo.flags,ro=eo.flagVariants;this.featureFlagEventHandlers.forEach(function(oo){return oo(no,ro,{errorsLoading:ue})})}},{key:"setPersonPropertiesForFlags",value:function(ue){var eo=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],no=this.instance.get_property(Fe)||{};this.instance.register(o({},Fe,t$1(t$1({},no),ue))),eo&&this.instance.reloadFeatureFlags()}},{key:"resetPersonPropertiesForFlags",value:function(){this.instance.unregister(Fe)}},{key:"setGroupPropertiesForFlags",value:function(ue){var eo=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],no=this.instance.get_property(xe)||{};Object.keys(no).length!==0&&Object.keys(no).forEach(function(ro){no[ro]=t$1(t$1({},no[ro]),ue[ro]),delete ue[ro]}),this.instance.register(o({},xe,t$1(t$1({},no),ue))),eo&&this.instance.reloadFeatureFlags()}},{key:"resetGroupPropertiesForFlags",value:function(ue){if(ue){var eo=this.instance.get_property(xe)||{};this.instance.register(o({},xe,t$1(t$1({},eo),{},o({},ue,{}))))}else this.instance.unregister(xe)}}]),to}();Math.trunc||(Math.trunc=function(to){return to<0?Math.ceil(to):Math.floor(to)}),Number.isInteger||(Number.isInteger=function(to){return F(to)&&isFinite(to)&&Math.floor(to)===to});var Ve="0123456789abcdef",ze=function(){function to(ue){if(i$1(this,to),this.bytes=ue,ue.length!==16)throw new TypeError("not 128-bit length")}return s(to,[{key:"toString",value:function(){for(var ue="",eo=0;eo<this.bytes.length;eo++)ue=ue+Ve.charAt(this.bytes[eo]>>>4)+Ve.charAt(15&this.bytes[eo]),eo!==3&&eo!==5&&eo!==7&&eo!==9||(ue+="-");if(ue.length!==36)throw new Error("Invalid UUIDv7 was generated");return ue}},{key:"clone",value:function(){return new to(this.bytes.slice(0))}},{key:"equals",value:function(ue){return this.compareTo(ue)===0}},{key:"compareTo",value:function(ue){for(var eo=0;eo<16;eo++){var no=this.bytes[eo]-ue.bytes[eo];if(no!==0)return Math.sign(no)}return 0}}],[{key:"fromFieldsV7",value:function(ue,eo,no,ro){if(!Number.isInteger(ue)||!Number.isInteger(eo)||!Number.isInteger(no)||!Number.isInteger(ro)||ue<0||eo<0||no<0||ro<0||ue>0xffffffffffff||eo>4095||no>1073741823||ro>4294967295)throw new RangeError("invalid field value");var oo=new Uint8Array(16);return oo[0]=ue/Math.pow(2,40),oo[1]=ue/Math.pow(2,32),oo[2]=ue/Math.pow(2,24),oo[3]=ue/Math.pow(2,16),oo[4]=ue/Math.pow(2,8),oo[5]=ue,oo[6]=112|eo>>>8,oo[7]=eo,oo[8]=128|no>>>24,oo[9]=no>>>16,oo[10]=no>>>8,oo[11]=no,oo[12]=ro>>>24,oo[13]=ro>>>16,oo[14]=ro>>>8,oo[15]=ro,new to(oo)}}]),to}(),Qe=function(){function to(){i$1(this,to),o(this,"timestamp",0),o(this,"counter",0),o(this,"random",new Xe)}return s(to,[{key:"generate",value:function(){var ue=this.generateOrAbort();if(w$1(ue)){this.timestamp=0;var eo=this.generateOrAbort();if(w$1(eo))throw new Error("Could not generate UUID after timestamp reset");return eo}return ue}},{key:"generateOrAbort",value:function(){var ue=Date.now();if(ue>this.timestamp)this.timestamp=ue,this.resetCounter();else{if(!(ue+1e4>this.timestamp))return;this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter())}return ze.fromFieldsV7(this.timestamp,Math.trunc(this.counter/Math.pow(2,30)),this.counter&Math.pow(2,30)-1,this.random.nextUint32())}},{key:"resetCounter",value:function(){this.counter=1024*this.random.nextUint32()+(1023&this.random.nextUint32())}}]),to}(),Je=function(to){if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var ue=0;ue<to.length;ue++)to[ue]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return to};T&&!w$1(T.crypto)&&crypto.getRandomValues&&(Je=function(to){return crypto.getRandomValues(to)});var Ye,Xe=function(){function to(){i$1(this,to),o(this,"buffer",new Uint32Array(8)),o(this,"cursor",1/0)}return s(to,[{key:"nextUint32",value:function(){return this.cursor>=this.buffer.length&&(Je(this.buffer),this.cursor=0),this.buffer[this.cursor++]}}]),to}(),Ke=function(){return Ze().toString()},Ze=function(){return(Ye||(Ye=new Qe)).generate()},et="Thu, 01 Jan 1970 00:00:00 GMT",tt="",nt=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function it(to,ue){if(ue){var eo=function(ro){var oo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:L;if(tt)return tt;if(!oo||["localhost","127.0.0.1"].includes(ro))return"";for(var io=ro.split("."),ao=Math.min(io.length,8),so="dmn_chk_"+Ke(),lo=new RegExp("(^|;)\\s*"+so+"=1");!tt&&ao--;){var co=io.slice(ao).join("."),uo=so+"=1;domain=."+co;oo.cookie=uo,lo.test(oo.cookie)&&(oo.cookie=uo+";expires="+et,tt=co)}return tt}(to);if(!eo){var no=function(ro){var oo=ro.match(nt);return oo?oo[0]:""}(to);no!==eo&&G.info("Warning: cookie subdomain discovery mismatch",no,eo),eo=no}return eo?"; domain=."+eo:""}return""}var rt,st={is_supported:function(){return!!L},error:function(to){G.error("cookieStore error: "+to)},get:function(to){if(L){try{for(var ue=to+"=",eo=L.cookie.split(";").filter(function(oo){return oo.length}),no=0;no<eo.length;no++){for(var ro=eo[no];ro.charAt(0)==" ";)ro=ro.substring(1,ro.length);if(ro.indexOf(ue)===0)return decodeURIComponent(ro.substring(ue.length,ro.length))}}catch{}return null}},parse:function(to){var ue;try{ue=JSON.parse(st.get(to))||{}}catch{}return ue},set:function(to,ue,eo,no,ro){if(L)try{var oo="",io="",ao=it(L.location.hostname,no);if(eo){var so=new Date;so.setTime(so.getTime()+24*eo*60*60*1e3),oo="; expires="+so.toUTCString()}ro&&(io="; secure");var lo=to+"="+encodeURIComponent(JSON.stringify(ue))+oo+"; SameSite=Lax; path=/"+ao+io;return lo.length>3686.4&&G.warn("cookieStore warning: large cookie, len="+lo.length),L.cookie=lo,lo}catch{return}},remove:function(to,ue){try{st.set(to,"",-1,ue)}catch{return}}},ot=null,at={is_supported:function(){if(!I(ot))return ot;var to=!0;if(w$1(T))to=!1;else try{var ue="__mplssupport__";at.set(ue,"xyz"),at.get(ue)!=='"xyz"'&&(to=!1),at.remove(ue)}catch{to=!1}return to||G.error("localStorage unsupported; falling back to cookie store"),ot=to,to},error:function(to){G.error("localStorage error: "+to)},get:function(to){try{return T==null?void 0:T.localStorage.getItem(to)}catch(ue){at.error(ue)}return null},parse:function(to){try{return JSON.parse(at.get(to))||{}}catch{}return null},set:function(to,ue){try{T==null||T.localStorage.setItem(to,JSON.stringify(ue))}catch(eo){at.error(eo)}},remove:function(to){try{T==null||T.localStorage.removeItem(to)}catch(ue){at.error(ue)}}},ut=["distinct_id",Se,Ee,qe],lt=t$1(t$1({},at),{},{parse:function(to){try{var ue={};try{ue=st.parse(to)||{}}catch{}var eo=J(ue,JSON.parse(at.get(to)||"{}"));return at.set(to,eo),eo}catch{}return null},set:function(to,ue,eo,no,ro,oo){try{at.set(to,ue,void 0,void 0,oo);var io={};ut.forEach(function(ao){ue[ao]&&(io[ao]=ue[ao])}),Object.keys(io).length&&st.set(to,io,eo,no,ro,oo)}catch(ao){at.error(ao)}},remove:function(to,ue){try{T==null||T.localStorage.removeItem(to),st.remove(to,ue)}catch(eo){at.error(eo)}}}),ct={},dt={is_supported:function(){return!0},error:function(to){G.error("memoryStorage error: "+to)},get:function(to){return ct[to]||null},parse:function(to){return ct[to]||null},set:function(to,ue){ct[to]=ue},remove:function(to){delete ct[to]}},ht=null,ft={is_supported:function(){if(!I(ht))return ht;if(ht=!0,w$1(T))ht=!1;else try{var to="__support__";ft.set(to,"xyz"),ft.get(to)!=='"xyz"'&&(ht=!1),ft.remove(to)}catch{ht=!1}return ht},error:function(to){G.error("sessionStorage error: ",to)},get:function(to){try{return T==null?void 0:T.sessionStorage.getItem(to)}catch(ue){ft.error(ue)}return null},parse:function(to){try{return JSON.parse(ft.get(to))||null}catch{}return null},set:function(to,ue){try{T==null||T.sessionStorage.setItem(to,JSON.stringify(ue))}catch(eo){ft.error(eo)}},remove:function(to){try{T==null||T.sessionStorage.removeItem(to)}catch(ue){ft.error(ue)}}},vt=["localhost","127.0.0.1"],pt=function(to){var ue=L==null?void 0:L.createElement("a");return w$1(ue)?null:(ue.href=to,ue)},gt=function(to,ue){return!!function(eo){try{new RegExp(eo)}catch{return!1}return!0}(ue)&&new RegExp(ue).test(to)},_t=function(to){var ue,eo,no=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"&",ro=[];return Q(to,function(oo,io){w$1(oo)||w$1(io)||io==="undefined"||(ue=encodeURIComponent(function(ao){return ao instanceof File}(oo)?oo.name:oo.toString()),eo=encodeURIComponent(io),ro[ro.length]=eo+"="+ue)}),ro.join(no)},mt=function(to,ue){for(var eo,no=((to.split("#")[0]||"").split("?")[1]||"").split("&"),ro=0;ro<no.length;ro++){var oo=no[ro].split("=");if(oo[0]===ue){eo=oo;break}}if(!m(eo)||eo.length<2)return"";var io=eo[1];try{io=decodeURIComponent(io)}catch{G.error("Skipping decoding for malformed query param: "+io)}return io.replace(/\+/g," ")},yt=function(to,ue){var eo=to.match(new RegExp(ue+"=([^&]*)"));return eo?eo[1]:null},bt="Mobile",kt="iOS",wt="Android",St="Tablet",Et=wt+" "+St,It="iPad",Rt="Apple",Ft=Rt+" Watch",xt="Safari",Pt="BlackBerry",Tt="Samsung",Ct=Tt+"Browser",$t=Tt+" Internet",Ot="Chrome",Mt=Ot+" OS",At=Ot+" "+kt,Lt="Internet Explorer",Dt=Lt+" "+bt,qt="Opera",Nt=qt+" Mini",Bt="Edge",Ht="Microsoft "+Bt,Ut="Firefox",jt=Ut+" "+kt,Gt="Nintendo",Wt="PlayStation",Vt="Xbox",zt=wt+" "+bt,Qt=bt+" "+xt,Jt="Windows",Yt=Jt+" Phone",Xt="Nokia",Kt="Ouya",Zt="Generic",en=Zt+" "+bt.toLowerCase(),tn=Zt+" "+St.toLowerCase(),nn="Konqueror",rn="(\\d+(\\.\\d+)?)",sn=new RegExp("Version/"+rn),on=new RegExp(Vt,"i"),an=new RegExp(Wt+" \\w+","i"),un=new RegExp(Gt+" \\w+","i"),ln=new RegExp(Pt+"|PlayBook|BB10","i"),cn={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},dn=function(to,ue){return ue&&Y(ue,Rt)||function(eo){return Y(eo,xt)&&!Y(eo,Ot)&&!Y(eo,wt)}(to)},hn=function(to,ue){return ue=ue||"",Y(to," OPR/")&&Y(to,"Mini")?Nt:Y(to," OPR/")?qt:ln.test(to)?Pt:Y(to,"IE"+bt)||Y(to,"WPDesktop")?Dt:Y(to,Ct)?$t:Y(to,Bt)||Y(to,"Edg/")?Ht:Y(to,"FBIOS")?"Facebook "+bt:Y(to,"UCWEB")||Y(to,"UCBrowser")?"UC Browser":Y(to,"CriOS")?At:Y(to,"CrMo")?Ot:Y(to,wt)&&Y(to,xt)?zt:Y(to,Ot)?Ot:Y(to,"FxiOS")?jt:Y(to.toLowerCase(),nn.toLowerCase())?nn:dn(to,ue)?Y(to,bt)?Qt:xt:Y(to,Ut)?Ut:Y(to,"MSIE")||Y(to,"Trident/")?Lt:Y(to,"Gecko")?Ut:""},fn=(o(rt={},Dt,[new RegExp("rv:"+rn)]),o(rt,Ht,[new RegExp(Bt+"?\\/"+rn)]),o(rt,Ot,[new RegExp("("+Ot+"|CrMo)\\/"+rn)]),o(rt,At,[new RegExp("CriOS\\/"+rn)]),o(rt,"UC Browser",[new RegExp("(UCBrowser|UCWEB)\\/"+rn)]),o(rt,xt,[sn]),o(rt,Qt,[sn]),o(rt,qt,[new RegExp("(Opera|OPR)\\/"+rn)]),o(rt,Ut,[new RegExp(Ut+"\\/"+rn)]),o(rt,jt,[new RegExp("FxiOS\\/"+rn)]),o(rt,nn,[new RegExp("Konqueror[:/]?"+rn,"i")]),o(rt,Pt,[new RegExp(Pt+" "+rn),sn]),o(rt,zt,[new RegExp("android\\s"+rn,"i")]),o(rt,$t,[new RegExp(Ct+"\\/"+rn)]),o(rt,Lt,[new RegExp("(rv:|MSIE )"+rn)]),o(rt,"Mozilla",[new RegExp("rv:"+rn)]),rt),vn=[[new RegExp(Vt+"; "+Vt+" (.*?)[);]","i"),function(to){return[Vt,to&&to[1]||""]}],[new RegExp(Gt,"i"),[Gt,""]],[new RegExp(Wt,"i"),[Wt,""]],[ln,[Pt,""]],[new RegExp(Jt,"i"),function(to,ue){if(/Phone/.test(ue)||/WPDesktop/.test(ue))return[Yt,""];if(new RegExp(bt).test(ue)&&!/IEMobile\b/.test(ue))return[Jt+" "+bt,""];var eo=/Windows NT ([0-9.]+)/i.exec(ue);if(eo&&eo[1]){var no=eo[1],ro=cn[no]||"";return/arm/i.test(ue)&&(ro="RT"),[Jt,ro]}return[Jt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,function(to){if(to&&to[3]){var ue=[to[3],to[4],to[5]||"0"];return[kt,ue.join(".")]}return[kt,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,function(to){var ue="";return to&&to.length>=3&&(ue=w$1(to[2])?to[3]:to[2]),["watchOS",ue]}],[new RegExp("("+wt+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+wt+")","i"),function(to){if(to&&to[2]){var ue=[to[2],to[3],to[4]||"0"];return[wt,ue.join(".")]}return[wt,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,function(to){var ue=["Mac OS X",""];if(to&&to[1]){var eo=[to[1],to[2],to[3]||"0"];ue[1]=eo.join(".")}return ue}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Mt,""]],[/Linux|debian/i,["Linux",""]]],pn=function(to){return un.test(to)?Gt:an.test(to)?Wt:on.test(to)?Vt:new RegExp(Kt,"i").test(to)?Kt:new RegExp("("+Yt+"|WPDesktop)","i").test(to)?Yt:/iPad/.test(to)?It:/iPod/.test(to)?"iPod Touch":/iPhone/.test(to)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(to)?Ft:ln.test(to)?Pt:/(kobo)\s(ereader|touch)/i.test(to)?"Kobo":new RegExp(Xt,"i").test(to)?Xt:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(to)||/(kf[a-z]+)( bui|\)).+silk\//i.test(to)?"Kindle Fire":/(Android|ZTE)/i.test(to)?!new RegExp(bt).test(to)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(to)?/pixel[\daxl ]{1,6}/i.test(to)&&!/pixel c/i.test(to)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(to)||/lmy47v/i.test(to)&&!/QTAQZ3/i.test(to)?wt:Et:wt:new RegExp("(pda|"+bt+")","i").test(to)?en:new RegExp(St,"i").test(to)&&!new RegExp(St+" pc","i").test(to)?tn:""},gn="https?://(.*)",_n=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gclid","gad_source","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","mc_cid","igshid","ttclid","rdt_cid"],mn={campaignParams:function(to){return L?this._campaignParamsFromUrl(L.URL,to):{}},_campaignParamsFromUrl:function(to,ue){var eo=_n.concat(ue||[]),no={};return Q(eo,function(ro){var oo=mt(to,ro);oo&&(no[ro]=oo)}),no},_searchEngine:function(to){return to?to.search(gn+"google.([^/?]*)")===0?"google":to.search(gn+"bing.com")===0?"bing":to.search(gn+"yahoo.com")===0?"yahoo":to.search(gn+"duckduckgo.com")===0?"duckduckgo":null:null},_searchInfoFromReferrer:function(to){var ue=mn._searchEngine(to),eo=ue!="yahoo"?"q":"p",no={};if(!I(ue)){no.$search_engine=ue;var ro=L?mt(L.referrer,eo):"";ro.length&&(no.ph_keyword=ro)}return no},searchInfo:function(){var to=L==null?void 0:L.referrer;return to?this._searchInfoFromReferrer(to):{}},browser:hn,browserVersion:function(to,ue){var eo=hn(to,ue),no=fn[eo];if(w$1(no))return null;for(var ro=0;ro<no.length;ro++){var oo=no[ro],io=to.match(oo);if(io)return parseFloat(io[io.length-2])}return null},browserLanguage:function(){return navigator.language||navigator.userLanguage},os:function(to){for(var ue=0;ue<vn.length;ue++){var eo=u(vn[ue],2),no=eo[0],ro=eo[1],oo=no.exec(to),io=oo&&(y(ro)?ro(oo,to):ro);if(io)return io}return["",""]},device:pn,deviceType:function(to){var ue=pn(to);return ue===It||ue===Et||ue==="Kobo"||ue==="Kindle Fire"||ue===tn?St:ue===Gt||ue===Vt||ue===Wt||ue===Kt?"Console":ue===Ft?"Wearable":ue?bt:"Desktop"},referrer:function(){return(L==null?void 0:L.referrer)||"$direct"},referringDomain:function(){var to;return L!=null&&L.referrer&&((to=pt(L.referrer))===null||to===void 0?void 0:to.host)||"$direct"},referrerInfo:function(){return{$referrer:this.referrer(),$referring_domain:this.referringDomain()}},initialPersonInfo:function(){return{r:this.referrer(),u:D==null?void 0:D.href}},initialPersonPropsFromInfo:function(to){var ue,eo=to.r,no=to.u,ro={$initial_referrer:eo,$initial_referring_domain:eo==null?void 0:eo=="$direct"?"$direct":(ue=pt(eo))===null||ue===void 0?void 0:ue.host};if(no){ro.$initial_current_url=no;var oo=pt(no);ro.$initial_host=oo==null?void 0:oo.host,ro.$initial_pathname=oo==null?void 0:oo.pathname,Q(this._campaignParamsFromUrl(no),function(io,ao){ro["$initial_"+ne(ao)]=io})}return eo&&Q(this._searchInfoFromReferrer(eo),function(io,ao){ro["$initial_"+ne(ao)]=io}),ro},properties:function(){if(!H)return{};var to=u(mn.os(H),2),ue=to[0],eo=to[1];return J(te({$os:ue,$os_version:eo,$browser:mn.browser(H,navigator.vendor),$device:mn.device(H),$device_type:mn.deviceType(H)}),{$current_url:D==null?void 0:D.href,$host:D==null?void 0:D.host,$pathname:D==null?void 0:D.pathname,$raw_user_agent:H.length>1e3?H.substring(0,997)+"...":H,$browser_version:mn.browserVersion(H,navigator.vendor),$browser_language:mn.browserLanguage(),$screen_height:T==null?void 0:T.screen.height,$screen_width:T==null?void 0:T.screen.width,$viewport_height:T==null?void 0:T.innerHeight,$viewport_width:T==null?void 0:T.innerWidth,$lib:"web",$lib_version:f.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:K()/1e3})},people_properties:function(){if(!H)return{};var to=u(mn.os(H),2),ue=to[0],eo=to[1];return J(te({$os:ue,$os_version:eo,$browser:mn.browser(H,navigator.vendor)}),{$browser_version:mn.browserVersion(H,navigator.vendor)})}},yn=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],bn=function(){function to(ue){i$1(this,to),this.config=ue,this.props={},this.campaign_params_saved=!1,this.name=function(eo){var no="";return eo.token&&(no=eo.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),eo.persistence_name?"ph_"+eo.persistence_name:"ph_"+no+"_posthog"}(ue),this.storage=this.buildStorage(ue),this.load(),ue.debug&&G.info("Persistence loaded",ue.persistence,t$1({},this.props)),this.update_config(ue,ue),this.save()}return s(to,[{key:"buildStorage",value:function(ue){yn.indexOf(ue.persistence.toLowerCase())===-1&&(G.critical("Unknown persistence type "+ue.persistence+"; falling back to localStorage+cookie"),ue.persistence="localStorage+cookie");var eo=ue.persistence.toLowerCase();return eo==="localstorage"&&at.is_supported()?at:eo==="localstorage+cookie"&<.is_supported()?lt:eo==="sessionstorage"&&ft.is_supported()?ft:eo==="memory"?dt:eo==="cookie"?st:lt.is_supported()?lt:st}},{key:"properties",value:function(){var ue={};return Q(this.props,function(eo,no){if(no===Ie&&b(eo))for(var ro=Object.keys(eo),oo=0;oo<ro.length;oo++)ue["$feature/".concat(ro[oo])]=eo[ro[oo]];else ao=no,so=!1,(I(io=Be)?so:M&&io.indexOf===M?io.indexOf(ao)!=-1:(Q(io,function(lo){if(so||(so=lo===ao))return W}),so))||(ue[no]=eo);var io,ao,so}),ue}},{key:"load",value:function(){if(!this.disabled){var ue=this.storage.parse(this.name);ue&&(this.props=J({},ue))}}},{key:"save",value:function(){this.disabled||this.storage.set(this.name,this.props,this.expire_days,this.cross_subdomain,this.secure,this.config.debug)}},{key:"remove",value:function(){this.storage.remove(this.name,!1),this.storage.remove(this.name,!0)}},{key:"clear",value:function(){this.remove(),this.props={}}},{key:"register_once",value:function(ue,eo,no){var ro=this;if(b(ue)){w$1(eo)&&(eo="None"),this.expire_days=w$1(no)?this.default_expiry:no;var oo=!1;if(Q(ue,function(io,ao){ro.props.hasOwnProperty(ao)&&ro.props[ao]!==eo||(ro.props[ao]=io,oo=!0)}),oo)return this.save(),!0}return!1}},{key:"register",value:function(ue,eo){var no=this;if(b(ue)){this.expire_days=w$1(eo)?this.default_expiry:eo;var ro=!1;if(Q(ue,function(oo,io){ue.hasOwnProperty(io)&&no.props[io]!==oo&&(no.props[io]=oo,ro=!0)}),ro)return this.save(),!0}return!1}},{key:"unregister",value:function(ue){ue in this.props&&(delete this.props[ue],this.save())}},{key:"update_campaign_params",value:function(){this.campaign_params_saved||(this.register(mn.campaignParams(this.config.custom_campaign_params)),this.campaign_params_saved=!0)}},{key:"update_search_keyword",value:function(){this.register(mn.searchInfo())}},{key:"update_referrer_info",value:function(){this.register_once(mn.referrerInfo(),void 0)}},{key:"set_initial_person_info",value:function(){this.props[Ae]||this.props[Le]||this.register_once(o({},De,mn.initialPersonInfo()),void 0)}},{key:"get_referrer_info",value:function(){return te({$referrer:this.props.$referrer,$referring_domain:this.props.$referring_domain})}},{key:"get_initial_props",value:function(){var ue=this,eo={};Q([Le,Ae],function(oo){var io=ue.props[oo];io&&Q(io,function(ao,so){eo["$initial_"+ne(so)]=ao})});var no=this.props[De];if(no){var ro=mn.initialPersonPropsFromInfo(no);J(eo,ro)}return eo}},{key:"safe_merge",value:function(ue){return Q(this.props,function(eo,no){no in ue||(ue[no]=eo)}),ue}},{key:"update_config",value:function(ue,eo){if(this.default_expiry=this.expire_days=ue.cookie_expiration,this.set_disabled(ue.disable_persistence),this.set_cross_subdomain(ue.cross_subdomain_cookie),this.set_secure(ue.secure_cookie),ue.persistence!==eo.persistence){var no=this.buildStorage(ue),ro=this.props;this.clear(),this.storage=no,this.props=ro,this.save()}}},{key:"set_disabled",value:function(ue){this.disabled=ue,this.disabled?this.remove():this.save()}},{key:"set_cross_subdomain",value:function(ue){ue!==this.cross_subdomain&&(this.cross_subdomain=ue,this.remove(),this.save())}},{key:"get_cross_subdomain",value:function(){return!!this.cross_subdomain}},{key:"set_secure",value:function(ue){ue!==this.secure&&(this.secure=ue,this.remove(),this.save())}},{key:"set_event_timer",value:function(ue,eo){var no=this.props[de]||{};no[ue]=eo,this.props[de]=no,this.save()}},{key:"remove_event_timer",value:function(ue){var eo=(this.props[de]||{})[ue];return w$1(eo)||(delete this.props[de][ue],this.save()),eo}},{key:"get_property",value:function(ue){return this.props[ue]}},{key:"set_property",value:function(ue,eo){this.props[ue]=eo,this.save()}}]),to}();function kn(to){return JSON.stringify(to,(ue=[],function(eo,no){if(b(no)){for(;ue.length>0&&ue.at(-1)!==this;)ue.pop();return ue.includes(no)?"[Circular]":(ue.push(no),no)}return no})).length;var ue}var wn=2,Sn=4;function En(to){var ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:66060288e-1;if(to.size>=ue&&to.data.length>1){var eo=Math.floor(to.data.length/2),no=to.data.slice(0,eo),ro=to.data.slice(eo);return[En({size:kn(no),data:no,sessionId:to.sessionId,windowId:to.windowId}),En({size:kn(ro),data:ro,sessionId:to.sessionId,windowId:to.windowId})].flatMap(function(oo){return oo})}return[to]}var In=function(to){return to[to.DomContentLoaded=0]="DomContentLoaded",to[to.Load=1]="Load",to[to.FullSnapshot=2]="FullSnapshot",to[to.IncrementalSnapshot=3]="IncrementalSnapshot",to[to.Meta=4]="Meta",to[to.Custom=5]="Custom",to[to.Plugin=6]="Plugin",to}(In||{}),Rn=function(to){return to[to.Mutation=0]="Mutation",to[to.MouseMove=1]="MouseMove",to[to.MouseInteraction=2]="MouseInteraction",to[to.Scroll=3]="Scroll",to[to.ViewportResize=4]="ViewportResize",to[to.Input=5]="Input",to[to.TouchMove=6]="TouchMove",to[to.MediaInteraction=7]="MediaInteraction",to[to.StyleSheetRule=8]="StyleSheetRule",to[to.CanvasMutation=9]="CanvasMutation",to[to.Font=10]="Font",to[to.Log=11]="Log",to[to.Drag=12]="Drag",to[to.StyleDeclaration=13]="StyleDeclaration",to[to.Selection=14]="Selection",to[to.AdoptedStyleSheet=15]="AdoptedStyleSheet",to[to.CustomElement=16]="CustomElement",to}(Rn||{});function Fn(to){return to?V(to).split(/\s+/):[]}function xn(to){var ue=T==null?void 0:T.location.href;return!!(ue&&to&&to.some(function(eo){return ue.match(eo)}))}function Pn(to){var ue="";switch(n(to.className)){case"string":ue=to.className;break;case"object":ue=(to.className&&"baseVal"in to.className?to.className.baseVal:null)||to.getAttribute("class")||"";break;default:ue=""}return Fn(ue)}function Tn(to){return R(to)?null:V(to).split(/(\s+)/).filter(function(ue){return zn(ue)}).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Cn(to){var ue="";return Nn(to)&&!Bn(to)&&to.childNodes&&to.childNodes.length&&Q(to.childNodes,function(eo){var no;Mn(eo)&&eo.textContent&&(ue+=(no=Tn(eo.textContent))!==null&&no!==void 0?no:"")}),V(ue)}function $n(to){return!!to&&to.nodeType===1}function On(to,ue){return!!to&&!!to.tagName&&to.tagName.toLowerCase()===ue.toLowerCase()}function Mn(to){return!!to&&to.nodeType===3}function An(to){return!!to&&to.nodeType===11}var Ln=["a","button","form","input","select","textarea","label"];function Dn(to){var ue=to.parentNode;return!(!ue||!$n(ue))&&ue}function qn(to,ue){var eo=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,no=arguments.length>3?arguments[3]:void 0,ro=arguments.length>4?arguments[4]:void 0;if(!T||!to||On(to,"html")||!$n(to)||eo!=null&&eo.url_allowlist&&!xn(eo.url_allowlist)||eo!=null&&eo.url_ignorelist&&xn(eo.url_ignorelist))return!1;if(eo!=null&&eo.dom_event_allowlist){var oo=eo.dom_event_allowlist;if(oo&&!oo.some(function(po){return ue.type===po}))return!1}for(var io=!1,ao=[to],so=!0,lo=to;lo.parentNode&&!On(lo,"body");)if(An(lo.parentNode))ao.push(lo.parentNode.host),lo=lo.parentNode.host;else{if(!(so=Dn(lo)))break;if(no||Ln.indexOf(so.tagName.toLowerCase())>-1)io=!0;else{var co=T.getComputedStyle(so);co&&co.getPropertyValue("cursor")==="pointer"&&(io=!0)}ao.push(so),lo=so}if(!function(po,ho){var _o=ho==null?void 0:ho.element_allowlist;if(w$1(_o))return!0;var go,bo=h(po);try{var vo=function(){var wo=go.value;if(_o.some(function(ko){return wo.tagName.toLowerCase()===ko}))return{v:!0}};for(bo.s();!(go=bo.n()).done;){var yo=vo();if(n(yo)==="object")return yo.v}}catch(wo){bo.e(wo)}finally{bo.f()}return!1}(ao,eo)||!function(po,ho){var _o=ho==null?void 0:ho.css_selector_allowlist;if(w$1(_o))return!0;var go,bo=h(po);try{var vo=function(){var wo=go.value;if(_o.some(function(ko){return wo.matches(ko)}))return{v:!0}};for(bo.s();!(go=bo.n()).done;){var yo=vo();if(n(yo)==="object")return yo.v}}catch(wo){bo.e(wo)}finally{bo.f()}return!1}(ao,eo))return!1;var uo=T.getComputedStyle(to);if(uo&&uo.getPropertyValue("cursor")==="pointer"&&ue.type==="click")return!0;var fo=to.tagName.toLowerCase();switch(fo){case"html":return!1;case"form":return(ro||["submit"]).indexOf(ue.type)>=0;case"input":case"select":case"textarea":return(ro||["change","click"]).indexOf(ue.type)>=0;default:return io?(ro||["click"]).indexOf(ue.type)>=0:(ro||["click"]).indexOf(ue.type)>=0&&(Ln.indexOf(fo)>-1||to.getAttribute("contenteditable")==="true")}}function Nn(to){for(var ue=to;ue.parentNode&&!On(ue,"body");ue=ue.parentNode){var eo=Pn(ue);if(Y(eo,"ph-sensitive")||Y(eo,"ph-no-capture"))return!1}if(Y(Pn(to),"ph-include"))return!0;var no=to.type||"";if(S(no))switch(no.toLowerCase()){case"hidden":case"password":return!1}var ro=to.name||to.id||"";return!(S(ro)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(ro.replace(/[^a-zA-Z0-9]/g,"")))}function Bn(to){return!!(On(to,"input")&&!["button","checkbox","submit","reset"].includes(to.type)||On(to,"select")||On(to,"textarea")||to.getAttribute("contenteditable")==="true")}var Hn="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",Un=new RegExp("^(?:".concat(Hn,")$")),jn=new RegExp(Hn),Gn="\\d{3}-?\\d{2}-?\\d{4}",Wn=new RegExp("^(".concat(Gn,")$")),Vn=new RegExp("(".concat(Gn,")"));function zn(to){var ue=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];return!(R(to)||S(to)&&(to=V(to),(ue?Un:jn).test((to||"").replace(/[- ]/g,""))||(ue?Wn:Vn).test(to)))}function Qn(to){var ue=Cn(to);return zn(ue="".concat(ue," ").concat(Jn(to)).trim())?ue:""}function Jn(to){var ue="";return to&&to.childNodes&&to.childNodes.length&&Q(to.childNodes,function(eo){var no;if(eo&&((no=eo.tagName)===null||no===void 0?void 0:no.toLowerCase())==="span")try{var ro=Cn(eo);ue="".concat(ue," ").concat(ro).trim(),eo.childNodes&&eo.childNodes.length&&(ue="".concat(ue," ").concat(Jn(eo)).trim())}catch(oo){G.error(oo)}}),ue}function Yn(to){return function(ue){var eo=ue.map(function(no){var ro,oo,io="";if(no.tag_name&&(io+=no.tag_name),no.attr_class){no.attr_class.sort();var ao,so=h(no.attr_class);try{for(so.s();!(ao=so.n()).done;){var lo=ao.value;io+=".".concat(lo.replace(/"/g,""))}}catch(fo){so.e(fo)}finally{so.f()}}var co=t$1(t$1(t$1(t$1({},no.text?{text:no.text}:{}),{},{"nth-child":(ro=no.nth_child)!==null&&ro!==void 0?ro:0,"nth-of-type":(oo=no.nth_of_type)!==null&&oo!==void 0?oo:0},no.href?{href:no.href}:{}),no.attr_id?{attr_id:no.attr_id}:{}),no.attributes),uo={};return X(co).sort(function(fo,po){var ho=u(fo,1)[0],_o=u(po,1)[0];return ho.localeCompare(_o)}).forEach(function(fo){var po=u(fo,2),ho=po[0],_o=po[1];return uo[Xn(ho.toString())]=Xn(_o.toString())}),io+=":",io+=X(co).map(function(fo){var po=u(fo,2),ho=po[0],_o=po[1];return"".concat(ho,'="').concat(_o,'"')}).join("")});return eo.join(";")}(function(ue){return ue.map(function(eo){var no,ro,oo={text:(no=eo.$el_text)===null||no===void 0?void 0:no.slice(0,400),tag_name:eo.tag_name,href:(ro=eo.attr__href)===null||ro===void 0?void 0:ro.slice(0,2048),attr_class:Kn(eo),attr_id:eo.attr__id,nth_child:eo.nth_child,nth_of_type:eo.nth_of_type,attributes:{}};return X(eo).filter(function(io){return u(io,1)[0].indexOf("attr__")===0}).forEach(function(io){var ao=u(io,2),so=ao[0],lo=ao[1];return oo.attributes[so]=lo}),oo})}(to))}function Xn(to){return to.replace(/"|\\"/g,'\\"')}function Kn(to){var ue=to.attr__class;return ue?m(ue)?ue:Fn(ue):void 0}var Zn="[SessionRecording]",ei="redacted",ti={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:function(to){return to},recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:1e6,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io"]},ni=["authorization","x-forwarded-for","authorization","cookie","set-cookie","x-api-key","x-real-ip","remote-addr","forwarded","proxy-authorization","x-csrf-token","x-csrftoken","x-xsrf-token"],ii=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],ri=["/s/","/e/","/i/"];function si(to,ue,eo,no){if(R(to))return to;var ro=(ue==null?void 0:ue["content-length"])||function(oo){return new Blob([oo]).size}(to);return S(ro)&&(ro=parseInt(ro)),ro>eo?Zn+" ".concat(no," body too large to record (").concat(ro," bytes)"):to}function oi(to,ue){if(R(to))return to;var eo=to;return zn(eo,!1)||(eo=Zn+" "+ue+" body "+ei),Q(ii,function(no){var ro,oo;(ro=eo)!==null&&ro!==void 0&&ro.length&&((oo=eo)===null||oo===void 0?void 0:oo.indexOf(no))!==-1&&(eo=Zn+" "+ue+" body "+ei+" as might contain: "+no)}),eo}var ai,ui=function(to,ue){var eo,no,ro,oo={payloadSizeLimitBytes:ti.payloadSizeLimitBytes,performanceEntryTypeToObserve:l(ti.performanceEntryTypeToObserve),payloadHostDenyList:[].concat(l(ue.payloadHostDenyList||[]),l(ti.payloadHostDenyList))},io=to.session_recording.recordHeaders!==!1&&ue.recordHeaders,ao=to.session_recording.recordBody!==!1&&ue.recordBody,so=to.capture_performance!==!1&&ue.recordPerformance,lo=(eo=oo,ro=Math.min(1e6,(no=eo.payloadSizeLimitBytes)!==null&&no!==void 0?no:1e6),function(fo){return fo!=null&&fo.requestBody&&(fo.requestBody=si(fo.requestBody,fo.requestHeaders,ro,"Request")),fo!=null&&fo.responseBody&&(fo.responseBody=si(fo.responseBody,fo.responseHeaders,ro,"Response")),fo}),co=function(fo){return lo(function(_o){var go=pt(_o.name);if(!(go&&go.pathname&&ri.some(function(bo){return go.pathname.indexOf(bo)===0})))return _o}((ho=(po=fo).requestHeaders,R(ho)||Q(Object.keys(ho??{}),function(_o){ni.includes(_o.toLowerCase())&&(ho[_o]=ei)}),po)));var po,ho},uo=y(to.session_recording.maskNetworkRequestFn);return uo&&y(to.session_recording.maskCapturedNetworkRequestFn)&&G.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),uo&&(to.session_recording.maskCapturedNetworkRequestFn=function(fo){var po=to.session_recording.maskNetworkRequestFn({url:fo.name});return t$1(t$1({},fo),{},{name:po==null?void 0:po.url})}),oo.maskRequestFn=y(to.session_recording.maskCapturedNetworkRequestFn)?function(fo){var po,ho,_o,go=co(fo);return go&&(po=(ho=(_o=to.session_recording).maskCapturedNetworkRequestFn)===null||ho===void 0?void 0:ho.call(_o,go))!==null&&po!==void 0?po:void 0}:function(fo){return function(po){if(!w$1(po))return po.requestBody=oi(po.requestBody,"Request"),po.responseBody=oi(po.responseBody,"Response"),po}(co(fo))},t$1(t$1(t$1({},ti),oo),{},{recordHeaders:io,recordBody:ao,recordPerformance:so,recordInitialRequests:so})},li=s(function to(ue){var eo,no,ro=this,oo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};i$1(this,to),o(this,"bucketSize",100),o(this,"refillRate",10),o(this,"mutationBuckets",{}),o(this,"loggedTracker",{}),o(this,"refillBuckets",function(){Object.keys(ro.mutationBuckets).forEach(function(io){ro.mutationBuckets[io]=ro.mutationBuckets[io]+ro.refillRate,ro.mutationBuckets[io]>=ro.bucketSize&&delete ro.mutationBuckets[io]})}),o(this,"getNodeOrRelevantParent",function(io){var ao=ro.rrweb.mirror.getNode(io);if((ao==null?void 0:ao.nodeName)!=="svg"&&ao instanceof Element){var so=ao.closest("svg");if(so)return[ro.rrweb.mirror.getId(so),so]}return[io,ao]}),o(this,"numberOfChanges",function(io){var ao,so,lo,co,uo,fo,po,ho;return((ao=(so=io.removes)===null||so===void 0?void 0:so.length)!==null&&ao!==void 0?ao:0)+((lo=(co=io.attributes)===null||co===void 0?void 0:co.length)!==null&&lo!==void 0?lo:0)+((uo=(fo=io.texts)===null||fo===void 0?void 0:fo.length)!==null&&uo!==void 0?uo:0)+((po=(ho=io.adds)===null||ho===void 0?void 0:ho.length)!==null&&po!==void 0?po:0)}),o(this,"throttleMutations",function(io){if(io.type!==3||io.data.source!==0)return io;var ao=io.data,so=ro.numberOfChanges(ao);ao.attributes&&(ao.attributes=ao.attributes.filter(function(co){var uo,fo,po,ho=u(ro.getNodeOrRelevantParent(co.id),2),_o=ho[0],go=ho[1];return ro.mutationBuckets[_o]===0?!1:(ro.mutationBuckets[_o]=(uo=ro.mutationBuckets[_o])!==null&&uo!==void 0?uo:ro.bucketSize,ro.mutationBuckets[_o]=Math.max(ro.mutationBuckets[_o]-1,0),ro.mutationBuckets[_o]===0&&(ro.loggedTracker[_o]||(ro.loggedTracker[_o]=!0,(fo=(po=ro.options).onBlockedNode)===null||fo===void 0||fo.call(po,_o,go))),co)}));var lo=ro.numberOfChanges(ao);return lo!==0||so===lo?io:void 0}),this.rrweb=ue,this.options=oo,this.refillRate=(eo=this.options.refillRate)!==null&&eo!==void 0?eo:this.refillRate,this.bucketSize=(no=this.options.bucketSize)!==null&&no!==void 0?no:this.bucketSize,setInterval(function(){ro.refillBuckets()},1e3)}),ci=3e5,di=[Rn.MouseMove,Rn.MouseInteraction,Rn.Scroll,Rn.ViewportResize,Rn.Input,Rn.TouchMove,Rn.MediaInteraction,Rn.Drag],hi=function(to){return{rrwebMethod:to,enqueuedAt:Date.now(),attempt:1}},fi="[SessionRecording]",vi=function(){function to(ue){var eo=this;if(i$1(this,to),o(this,"queuedRRWebEvents",[]),o(this,"isIdle",!1),o(this,"_linkedFlagSeen",!1),o(this,"_lastActivityTimestamp",Date.now()),o(this,"_linkedFlag",null),o(this,"_forceAllowLocalhostNetworkCapture",!1),o(this,"_onBeforeUnload",function(){eo._flushBuffer()}),o(this,"_onOffline",function(){eo._tryAddCustomEvent("browser offline",{})}),o(this,"_onOnline",function(){eo._tryAddCustomEvent("browser online",{})}),o(this,"_onVisibilityChange",function(){if(L!=null&&L.visibilityState){var io="window "+L.visibilityState;eo._tryAddCustomEvent(io,{})}}),o(this,"_samplingSessionListener",null),this.instance=ue,this._captureStarted=!1,this._endpoint="/s/",this.stopRrweb=void 0,this.receivedDecide=!1,!this.instance.sessionManager)throw G.error(fi+" started without valid sessionManager"),new Error(fi+" started without valid sessionManager. This is a bug.");var no=this.sessionManager.checkAndGetSessionAndWindowId(),ro=no.sessionId,oo=no.windowId;this.sessionId=ro,this.windowId=oo,this.buffer=this.clearBuffer(),this._setupSampling()}return s(to,[{key:"rrwebRecord",get:function(){var ue;return U==null||(ue=U.rrweb)===null||ue===void 0?void 0:ue.record}},{key:"started",get:function(){return this._captureStarted}},{key:"sessionManager",get:function(){if(!this.instance.sessionManager)throw new Error(fi+" must be started with a valid sessionManager.");return this.instance.sessionManager}},{key:"fullSnapshotIntervalMillis",get:function(){var ue;return((ue=this.instance.config.session_recording)===null||ue===void 0?void 0:ue.full_snapshot_interval_millis)||ci}},{key:"isSampled",get:function(){var ue=this.instance.get_property(Ee);return x$1(ue)?ue:null}},{key:"sessionDuration",get:function(){var ue,eo,no=(ue=this.buffer)===null||ue===void 0?void 0:ue.data[((eo=this.buffer)===null||eo===void 0?void 0:eo.data.length)-1],ro=this.sessionManager.checkAndGetSessionAndWindowId(!0).sessionStartTimestamp;return no?no.timestamp-ro:null}},{key:"isRecordingEnabled",get:function(){var ue=!!this.instance.get_property(_e),eo=!this.instance.config.disable_session_recording;return T&&ue&&eo}},{key:"isConsoleLogCaptureEnabled",get:function(){var ue=!!this.instance.get_property(me),eo=this.instance.config.enable_recording_console_log;return eo??ue}},{key:"canvasRecording",get:function(){var ue=this.instance.get_property(be);return ue&&ue.fps&&ue.quality?{enabled:ue.enabled,fps:ue.fps,quality:ue.quality}:void 0}},{key:"networkPayloadCapture",get:function(){var ue,eo,no=this.instance.get_property(ye),ro={recordHeaders:(ue=this.instance.config.session_recording)===null||ue===void 0?void 0:ue.recordHeaders,recordBody:(eo=this.instance.config.session_recording)===null||eo===void 0?void 0:eo.recordBody},oo=(ro==null?void 0:ro.recordHeaders)||(no==null?void 0:no.recordHeaders),io=(ro==null?void 0:ro.recordBody)||(no==null?void 0:no.recordBody),ao=b(this.instance.config.capture_performance)?this.instance.config.capture_performance.network_timing:this.instance.config.capture_performance,so=!!(x$1(ao)?ao:no!=null&&no.capturePerformance);return oo||io||so?{recordHeaders:oo,recordBody:io,recordPerformance:so}:void 0}},{key:"sampleRate",get:function(){var ue=this.instance.get_property(ke);return F(ue)?ue:null}},{key:"minimumDuration",get:function(){var ue=this.instance.get_property(we);return F(ue)?ue:null}},{key:"status",get:function(){return this.receivedDecide?this.isRecordingEnabled?R(this._linkedFlag)||this._linkedFlagSeen?x$1(this.isSampled)?this.isSampled?"sampled":"disabled":"active":"buffering":"disabled":"buffering"}},{key:"startIfEnabledOrStop",value:function(){this.isRecordingEnabled?(this._startCapture(),T==null||T.addEventListener("beforeunload",this._onBeforeUnload),T==null||T.addEventListener("offline",this._onOffline),T==null||T.addEventListener("online",this._onOnline),T==null||T.addEventListener("visibilitychange",this._onVisibilityChange),G.info(fi+" started")):(this.stopRecording(),this.clearBuffer())}},{key:"stopRecording",value:function(){this._captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=void 0,this._captureStarted=!1,T==null||T.removeEventListener("beforeunload",this._onBeforeUnload),T==null||T.removeEventListener("offline",this._onOffline),T==null||T.removeEventListener("online",this._onOnline),T==null||T.removeEventListener("visibilitychange",this._onVisibilityChange),G.info(fi+" stopped"))}},{key:"makeSamplingDecision",value:function(ue){var eo,no=this.sessionId!==ue,ro=this.sampleRate;if(F(ro)){var oo,io=this.isSampled,ao=no||!x$1(io);ao?oo=Math.random()<ro:oo=io,!oo&&ao&&G.warn(fi+" Sample rate (".concat(ro,") has determined that this sessionId (").concat(ue,") will not be sent to the server.")),this._tryAddCustomEvent("samplingDecisionMade",{sampleRate:ro}),(eo=this.instance.persistence)===null||eo===void 0||eo.register(o({},Ee,oo))}else{var so;(so=this.instance.persistence)===null||so===void 0||so.register(o({},Ee,null))}}},{key:"afterDecideResponse",value:function(ue){var eo,no,ro,oo=this;if(this._persistDecideResponse(ue),this._linkedFlag=((eo=ue.sessionRecording)===null||eo===void 0?void 0:eo.linkedFlag)||null,(no=ue.sessionRecording)!==null&&no!==void 0&&no.endpoint&&(this._endpoint=(ro=ue.sessionRecording)===null||ro===void 0?void 0:ro.endpoint),this._setupSampling(),!R(this._linkedFlag)&&!this._linkedFlagSeen){var io=S(this._linkedFlag)?this._linkedFlag:this._linkedFlag.flag,ao=S(this._linkedFlag)?null:this._linkedFlag.variant;this.instance.onFeatureFlags(function(so,lo){var co=b(lo)&&io in lo,uo=ao?lo[io]===ao:co;if(uo){var fo={linkedFlag:io,linkedVariant:ao},po="linked flag matched";G.info(fi+" "+po,fo),oo._tryAddCustomEvent(po,fo)}oo._linkedFlagSeen=uo})}this.receivedDecide=!0,this.startIfEnabledOrStop()}},{key:"_setupSampling",value:function(){var ue=this;F(this.sampleRate)&&I(this._samplingSessionListener)&&(this._samplingSessionListener=this.sessionManager.onSessionId(function(eo){ue.makeSamplingDecision(eo)}))}},{key:"_persistDecideResponse",value:function(ue){if(this.instance.persistence){var eo=this.instance.persistence,no=function(){var ro,oo,io,ao,so,lo,co,uo,fo=(ro=ue.sessionRecording)===null||ro===void 0?void 0:ro.sampleRate,po=R(fo)?null:parseFloat(fo),ho=(oo=ue.sessionRecording)===null||oo===void 0?void 0:oo.minimumDurationMilliseconds;eo.register((o(uo={},_e,!!ue.sessionRecording),o(uo,me,(io=ue.sessionRecording)===null||io===void 0?void 0:io.consoleLogRecordingEnabled),o(uo,ye,t$1({capturePerformance:ue.capturePerformance},(ao=ue.sessionRecording)===null||ao===void 0?void 0:ao.networkPayloadCapture)),o(uo,be,{enabled:(so=ue.sessionRecording)===null||so===void 0?void 0:so.recordCanvas,fps:(lo=ue.sessionRecording)===null||lo===void 0?void 0:lo.canvasFps,quality:(co=ue.sessionRecording)===null||co===void 0?void 0:co.canvasQuality}),o(uo,ke,po),o(uo,we,w$1(ho)?null:ho),uo))};no(),this.sessionManager.onSessionId(no)}}},{key:"log",value:function(ue){var eo,no=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"log";(eo=this.instance.sessionRecording)===null||eo===void 0||eo.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:no,trace:[],payload:[JSON.stringify(ue)]}},timestamp:K()})}},{key:"_startCapture",value:function(){var ue=this;w$1(Object.assign)||this._captureStarted||this.instance.config.disable_session_recording||this.instance.consent.isOptedOut()||(this._captureStarted=!0,this.sessionManager.checkAndGetSessionAndWindowId(),this.rrwebRecord?this._onScriptLoaded():this.instance.requestRouter.loadScript("/static/recorder.js?v=".concat(f.LIB_VERSION),function(eo){if(eo)return G.error(fi+" could not load recorder.js",eo);ue._onScriptLoaded()}))}},{key:"isInteractiveEvent",value:function(ue){var eo;return ue.type===3&&di.indexOf((eo=ue.data)===null||eo===void 0?void 0:eo.source)!==-1}},{key:"_updateWindowAndSessionIds",value:function(ue){var eo=this.isInteractiveEvent(ue);eo||this.isIdle||ue.timestamp-this._lastActivityTimestamp>3e5&&(this.isIdle=!0,clearTimeout(this._fullSnapshotTimer),this._flushBuffer());var no=!1;if(eo&&(this._lastActivityTimestamp=ue.timestamp,this.isIdle&&(this.isIdle=!1,this._tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:ue.type}),no=!0)),!this.isIdle){var ro=this.sessionManager.checkAndGetSessionAndWindowId(!eo,ue.timestamp),oo=ro.windowId,io=ro.sessionId,ao=this.sessionId!==io,so=this.windowId!==oo;this.windowId=oo,this.sessionId=io,(no||[wn,Sn].indexOf(ue.type)===-1&&(so||ao||w$1(this._fullSnapshotTimer)))&&this._tryTakeFullSnapshot()}}},{key:"_tryRRWebMethod",value:function(ue){try{return ue.rrwebMethod(),!0}catch(eo){return this.queuedRRWebEvents.length<10?this.queuedRRWebEvents.push({enqueuedAt:ue.enqueuedAt||Date.now(),attempt:ue.attempt++,rrwebMethod:ue.rrwebMethod}):G.warn(fi+" could not emit queued rrweb event.",eo,ue),!1}}},{key:"_tryAddCustomEvent",value:function(ue,eo){var no=this;return this._tryRRWebMethod(hi(function(){return no.rrwebRecord.addCustomEvent(ue,eo)}))}},{key:"_tryTakeFullSnapshot",value:function(){var ue=this;return this._tryRRWebMethod(hi(function(){return ue.rrwebRecord.takeFullSnapshot()}))}},{key:"_onScriptLoaded",value:function(){for(var ue,eo=this,no={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1},ro=this.instance.config.session_recording,oo=0,io=Object.entries(ro||{});oo<io.length;oo++){var ao=u(io[oo],2),so=ao[0],lo=ao[1];so in no&&(so==="maskInputOptions"?no.maskInputOptions=t$1({password:!0},lo):no[so]=lo)}if(this.canvasRecording&&this.canvasRecording.enabled&&(no.recordCanvas=!0,no.sampling={canvas:this.canvasRecording.fps},no.dataURLOptions={type:"image/webp",quality:this.canvasRecording.quality}),this.rrwebRecord){this.mutationRateLimiter=(ue=this.mutationRateLimiter)!==null&&ue!==void 0?ue:new li(this.rrwebRecord,{onBlockedNode:function(uo,fo){var po="Too many mutations on node '".concat(uo,"'. Rate limiting. This could be due to SVG animations or something similar");G.info(po,{node:fo}),eo.log(fi+" "+po,"warn")}});var co=this._gatherRRWebPlugins();this.stopRrweb=this.rrwebRecord(t$1({emit:function(uo){eo.onRRwebEmit(uo)},plugins:co},no)),this.instance._addCaptureHook(function(uo){try{if(uo==="$pageview"){var fo=T?eo._maskUrl(T.location.href):"";if(!fo)return;eo._tryAddCustomEvent("$pageview",{href:fo})}}catch(po){G.error("Could not add $pageview to rrweb session",po)}}),this._lastActivityTimestamp=Date.now(),this.isIdle=!1,this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:no,activePlugins:co.map(function(uo){return uo==null?void 0:uo.name})}),this._tryAddCustomEvent("$posthog_config",{config:this.instance.config})}else G.error(fi+"onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.")}},{key:"_scheduleFullSnapshot",value:function(){var ue=this;if(this._fullSnapshotTimer&&clearInterval(this._fullSnapshotTimer),!this.isIdle){var eo=this.fullSnapshotIntervalMillis;eo&&(this._fullSnapshotTimer=setInterval(function(){ue._tryTakeFullSnapshot()},eo))}}},{key:"_gatherRRWebPlugins",value:function(){var ue=[];return U.rrwebConsoleRecord&&this.isConsoleLogCaptureEnabled&&ue.push(U.rrwebConsoleRecord.getRecordConsolePlugin()),this.networkPayloadCapture&&y(U.getRecordNetworkPlugin)&&(!vt.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?ue.push(U.getRecordNetworkPlugin(ui(this.instance.config,this.networkPayloadCapture))):G.info(fi+" NetworkCapture not started because we are on localhost.")),ue}},{key:"onRRwebEmit",value:function(ue){if(this._processQueuedEvents(),ue&&b(ue)){if(ue.type===In.Meta){var eo=this._maskUrl(ue.data.href);if(this._lastHref=eo,!eo)return;ue.data.href=eo}else this._pageViewFallBack();ue.type===In.FullSnapshot&&this._scheduleFullSnapshot();var no=this.mutationRateLimiter?this.mutationRateLimiter.throttleMutations(ue):ue;if(no){var ro=function(ao){var so=ao;if(so&&b(so)&&so.type===6&&b(so.data)&&so.data.plugin==="rrweb/console@1"){so.data.payload.payload.length>10&&(so.data.payload.payload=so.data.payload.payload.slice(0,10),so.data.payload.payload.push("...[truncated]"));for(var lo=[],co=0;co<so.data.payload.payload.length;co++)so.data.payload.payload[co]&&so.data.payload.payload[co].length>2e3?lo.push(so.data.payload.payload[co].slice(0,2e3)+"...[truncated]"):lo.push(so.data.payload.payload[co]);return so.data.payload.payload=lo,ao}return ao}(no),oo=kn(ro);if(this._updateWindowAndSessionIds(ro),!this.isIdle||ro.type===In.Custom){var io={$snapshot_bytes:oo,$snapshot_data:ro,$session_id:this.sessionId,$window_id:this.windowId};this.status!=="disabled"?this._captureSnapshotBuffered(io):this.clearBuffer()}}}}},{key:"_pageViewFallBack",value:function(){if(!this.instance.config.capture_pageview&&T){var ue=this._maskUrl(T.location.href);this._lastHref!==ue&&(this._tryAddCustomEvent("$url_changed",{href:ue}),this._lastHref=ue)}}},{key:"_processQueuedEvents",value:function(){var ue=this;if(this.queuedRRWebEvents.length){var eo=l(this.queuedRRWebEvents);this.queuedRRWebEvents=[],eo.forEach(function(no){Date.now()-no.enqueuedAt<=2e3&&ue._tryRRWebMethod(no)})}}},{key:"_maskUrl",value:function(ue){var eo=this.instance.config.session_recording;if(eo.maskNetworkRequestFn){var no,ro={url:ue};return(no=ro=eo.maskNetworkRequestFn(ro))===null||no===void 0?void 0:no.url}return ue}},{key:"clearBuffer",value:function(){return this.buffer={size:0,data:[],sessionId:this.sessionId,windowId:this.windowId},this.buffer}},{key:"_flushBuffer",value:function(){var ue=this;this.flushBufferTimer&&(clearTimeout(this.flushBufferTimer),this.flushBufferTimer=void 0);var eo=this.minimumDuration,no=this.sessionDuration,ro=F(no)&&no>=0,oo=F(eo)&&ro&&no<eo;return this.status==="buffering"||oo?(this.flushBufferTimer=setTimeout(function(){ue._flushBuffer()},2e3),this.buffer):(this.buffer.data.length>0&&En(this.buffer).forEach(function(io){ue._captureSnapshot({$snapshot_bytes:io.size,$snapshot_data:io.data,$session_id:io.sessionId,$window_id:io.windowId})}),this.clearBuffer())}},{key:"_captureSnapshotBuffered",value:function(ue){var eo,no=this,ro=2+(((eo=this.buffer)===null||eo===void 0?void 0:eo.data.length)||0);(this.buffer.size+ue.$snapshot_bytes+ro>943718.4||this.buffer.sessionId!==this.sessionId)&&(this.buffer=this._flushBuffer()),this.buffer.size+=ue.$snapshot_bytes,this.buffer.data.push(ue.$snapshot_data),this.flushBufferTimer||(this.flushBufferTimer=setTimeout(function(){no._flushBuffer()},2e3))}},{key:"_captureSnapshot",value:function(ue){this.instance.capture("$snapshot",ue,{_url:this.instance.requestRouter.endpointFor("api",this._endpoint),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}},{key:"overrideLinkedFlag",value:function(){this._linkedFlagSeen=!0}}]),to}(),pi=function(){function to(ue){i$1(this,to),this.instance=ue,this.instance.decideEndpointWasHit=this.instance._hasBootstrappedFeatureFlags()}return s(to,[{key:"call",value:function(){var ue=this,eo={token:this.instance.config.token,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),person_properties:this.instance.get_property(Fe),group_properties:this.instance.get_property(xe),disable_flags:this.instance.config.advanced_disable_feature_flags||this.instance.config.advanced_disable_feature_flags_on_first_load||void 0};this.instance._send_request({method:"POST",url:this.instance.requestRouter.endpointFor("api","/decide/?v=3"),data:eo,compression:this.instance.config.disable_compression?void 0:re.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:function(no){return ue.parseDecideResponse(no.json)}})}},{key:"parseDecideResponse",value:function(ue){var eo=this;this.instance.featureFlags.setReloadingPaused(!1),this.instance.featureFlags._startReloadTimer();var no=!ue;if(this.instance.config.advanced_disable_feature_flags_on_first_load||this.instance.config.advanced_disable_feature_flags||this.instance.featureFlags.receivedFeatureFlags(ue??{},no),no)G.error("Failed to fetch feature flags from PostHog.");else{if(!L||!L.body)return G.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(function(){eo.parseDecideResponse(ue)},500);if(this.instance._afterDecideResponse(ue),ue.siteApps)if(this.instance.config.opt_in_site_apps){var ro,oo=h(ue.siteApps);try{var io=function(){var ao=ro.value,so=ao.id,lo=ao.url,co=eo.instance.requestRouter.endpointFor("api",lo);U["__$$ph_site_app_".concat(so)]=eo.instance,eo.instance.requestRouter.loadScript(co,function(uo){if(uo)return G.error("Error while initializing PostHog app with config id ".concat(so),uo)})};for(oo.s();!(ro=oo.n()).done;)io()}catch(ao){oo.e(ao)}finally{oo.f()}}else ue.siteApps.length>0&&G.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}]),to}(),gi=T!=null&&T.location?yt(T.location.hash,"__posthog")||yt(location.hash,"state"):null,_i="_postHogToolbarParams";(function(to){to[to.UNINITIALIZED=0]="UNINITIALIZED",to[to.LOADING=1]="LOADING",to[to.LOADED=2]="LOADED"})(ai||(ai={}));var mi=function(){function to(ue){i$1(this,to),this.instance=ue}return s(to,[{key:"setToolbarState",value:function(ue){U.ph_toolbar_state=ue}},{key:"getToolbarState",value:function(){var ue;return(ue=U.ph_toolbar_state)!==null&&ue!==void 0?ue:ai.UNINITIALIZED}},{key:"maybeLoadToolbar",value:function(){var ue,eo,no=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0,ro=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,oo=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;if(!T||!L)return!1;no=(ue=no)!==null&&ue!==void 0?ue:T.location,oo=(eo=oo)!==null&&eo!==void 0?eo:T.history;try{if(!ro){try{T.localStorage.setItem("test","test"),T.localStorage.removeItem("test")}catch{return!1}ro=T==null?void 0:T.localStorage}var io,ao=gi||yt(no.hash,"__posthog")||yt(no.hash,"state"),so=ao?Z(function(){return JSON.parse(atob(decodeURIComponent(ao)))})||Z(function(){return JSON.parse(decodeURIComponent(ao))}):null;return so&&so.action==="ph_authorize"?((io=so).source="url",io&&Object.keys(io).length>0&&(so.desiredHash?no.hash=so.desiredHash:oo?oo.replaceState(oo.state,"",no.pathname+no.search):no.hash="")):((io=JSON.parse(ro.getItem(_i)||"{}")).source="localstorage",delete io.userIntent),!(!io.token||this.instance.config.token!==io.token)&&(this.loadToolbar(io),!0)}catch{return!1}}},{key:"_callLoadToolbar",value:function(ue){(U.ph_load_toolbar||U.ph_load_editor)(ue,this.instance)}},{key:"loadToolbar",value:function(ue){var eo=this,no=!(L==null||!L.getElementById(Ne));if(!T||no)return!1;var ro=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,oo=t$1(t$1({token:this.instance.config.token},ue),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},ro?{instrument:!1}:{});if(T.localStorage.setItem(_i,JSON.stringify(t$1(t$1({},oo),{},{source:void 0}))),this.getToolbarState()===ai.LOADED)this._callLoadToolbar(oo);else if(this.getToolbarState()===ai.UNINITIALIZED){this.setToolbarState(ai.LOADING);var io=3e5,ao=Math.floor(Date.now()/io)*io;this.instance.requestRouter.loadScript("/static/toolbar.js?t=".concat(ao),function(so){if(so)return G.error("Failed to load toolbar",so),void eo.setToolbarState(ai.UNINITIALIZED);eo.setToolbarState(ai.LOADED),eo._callLoadToolbar(oo)}),oe(T,"turbolinks:load",function(){eo.setToolbarState(ai.UNINITIALIZED),eo.loadToolbar(oo)})}return!0}},{key:"_loadEditor",value:function(ue){return this.loadToolbar(ue)}},{key:"maybeLoadEditor",value:function(){var ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0,eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,no=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;return this.maybeLoadToolbar(ue,eo,no)}}]),to}(),yi=function(){function to(ue){i$1(this,to),o(this,"isPaused",!0),o(this,"queue",[]),o(this,"flushTimeoutMs",3e3),this.sendRequest=ue}return s(to,[{key:"enqueue",value:function(ue){this.queue.push(ue),this.flushTimeout||this.setFlushTimeout()}},{key:"unload",value:function(){var ue=this;this.clearFlushTimeout();var eo=this.queue.length>0?this.formatQueue():{},no=Object.values(eo);[].concat(l(no.filter(function(ro){return ro.url.indexOf("/e")===0})),l(no.filter(function(ro){return ro.url.indexOf("/e")!==0}))).map(function(ro){ue.sendRequest(t$1(t$1({},ro),{},{transport:"sendBeacon"}))})}},{key:"enable",value:function(){this.isPaused=!1,this.setFlushTimeout()}},{key:"setFlushTimeout",value:function(){var ue=this;this.isPaused||(this.flushTimeout=setTimeout(function(){if(ue.clearFlushTimeout(),ue.queue.length>0){var eo=ue.formatQueue(),no=function(oo){var io=eo[oo],ao=new Date().getTime();io.data&&m(io.data)&&Q(io.data,function(so){so.offset=Math.abs(so.timestamp-ao),delete so.timestamp}),ue.sendRequest(io)};for(var ro in eo)no(ro)}},this.flushTimeoutMs))}},{key:"clearFlushTimeout",value:function(){clearTimeout(this.flushTimeout),this.flushTimeout=void 0}},{key:"formatQueue",value:function(){var ue={};return Q(this.queue,function(eo){var no,ro=eo,oo=(ro?ro.batchKey:null)||ro.url;w$1(ue[oo])&&(ue[oo]=t$1(t$1({},ro),{},{data:[]})),(no=ue[oo].data)===null||no===void 0||no.push(ro.data)}),this.queue=[],ue}}]),to}(),bi=Uint8Array,ki=Uint16Array,wi=Uint32Array,Si=new bi([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Ei=new bi([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Ii=new bi([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ri=function(to,ue){for(var eo=new ki(31),no=0;no<31;++no)eo[no]=ue+=1<<to[no-1];var ro=new wi(eo[30]);for(no=1;no<30;++no)for(var oo=eo[no];oo<eo[no+1];++oo)ro[oo]=oo-eo[no]<<5|no;return[eo,ro]},Fi=Ri(Si,2),xi=Fi[0],Pi=Fi[1];xi[28]=258,Pi[258]=28;for(var Ti=Ri(Ei,0)[1],Ci=new ki(32768),$i=0;$i<32768;++$i){var Oi=(43690&$i)>>>1|(21845&$i)<<1;Oi=(61680&(Oi=(52428&Oi)>>>2|(13107&Oi)<<2))>>>4|(3855&Oi)<<4,Ci[$i]=((65280&Oi)>>>8|(255&Oi)<<8)>>>1}var Mi=function(to,ue,eo){for(var no=to.length,ro=0,oo=new ki(ue);ro<no;++ro)++oo[to[ro]-1];var io,ao=new ki(ue);for(ro=0;ro<ue;++ro)ao[ro]=ao[ro-1]+oo[ro-1]<<1;if(eo){io=new ki(1<<ue);var so=15-ue;for(ro=0;ro<no;++ro)if(to[ro])for(var lo=ro<<4|to[ro],co=ue-to[ro],uo=ao[to[ro]-1]++<<co,fo=uo|(1<<co)-1;uo<=fo;++uo)io[Ci[uo]>>>so]=lo}else for(io=new ki(no),ro=0;ro<no;++ro)io[ro]=Ci[ao[to[ro]-1]++]>>>15-to[ro];return io},Ai$1=new bi(288);for($i=0;$i<144;++$i)Ai$1[$i]=8;for($i=144;$i<256;++$i)Ai$1[$i]=9;for($i=256;$i<280;++$i)Ai$1[$i]=7;for($i=280;$i<288;++$i)Ai$1[$i]=8;var Li=new bi(32);for($i=0;$i<32;++$i)Li[$i]=5;var Di=Mi(Ai$1,9,0),qi=Mi(Li,5,0),Ni=function(to){return(to/8>>0)+(7&to&&1)},Bi=function(to,ue,eo){(ue==null||ue<0)&&(ue=0),(eo==null||eo>to.length)&&(eo=to.length);var no=new(to instanceof ki?ki:to instanceof wi?wi:bi)(eo-ue);return no.set(to.subarray(ue,eo)),no},Hi=function(to,ue,eo){eo<<=7&ue;var no=ue/8>>0;to[no]|=eo,to[no+1]|=eo>>>8},Ui=function(to,ue,eo){eo<<=7&ue;var no=ue/8>>0;to[no]|=eo,to[no+1]|=eo>>>8,to[no+2]|=eo>>>16},ji=function(to,ue){for(var eo=[],no=0;no<to.length;++no)to[no]&&eo.push({s:no,f:to[no]});var ro=eo.length,oo=eo.slice();if(!ro)return[new bi(0),0];if(ro==1){var io=new bi(eo[0].s+1);return io[eo[0].s]=1,[io,1]}eo.sort(function(ko,So){return ko.f-So.f}),eo.push({s:-1,f:25001});var ao=eo[0],so=eo[1],lo=0,co=1,uo=2;for(eo[0]={s:-1,f:ao.f+so.f,l:ao,r:so};co!=ro-1;)ao=eo[eo[lo].f<eo[uo].f?lo++:uo++],so=eo[lo!=co&&eo[lo].f<eo[uo].f?lo++:uo++],eo[co++]={s:-1,f:ao.f+so.f,l:ao,r:so};var fo=oo[0].s;for(no=1;no<ro;++no)oo[no].s>fo&&(fo=oo[no].s);var po=new ki(fo+1),ho=Gi(eo[co-1],po,0);if(ho>ue){no=0;var _o=0,go=ho-ue,bo=1<<go;for(oo.sort(function(ko,So){return po[So.s]-po[ko.s]||ko.f-So.f});no<ro;++no){var vo=oo[no].s;if(!(po[vo]>ue))break;_o+=bo-(1<<ho-po[vo]),po[vo]=ue}for(_o>>>=go;_o>0;){var yo=oo[no].s;po[yo]<ue?_o-=1<<ue-po[yo]++-1:++no}for(;no>=0&&_o;--no){var wo=oo[no].s;po[wo]==ue&&(--po[wo],++_o)}ho=ue}return[new bi(po),ho]},Gi=function to(ue,eo,no){return ue.s==-1?Math.max(to(ue.l,eo,no+1),to(ue.r,eo,no+1)):eo[ue.s]=no},Wi=function(to){for(var ue=to.length;ue&&!to[--ue];);for(var eo=new ki(++ue),no=0,ro=to[0],oo=1,io=function(so){eo[no++]=so},ao=1;ao<=ue;++ao)if(to[ao]==ro&&ao!=ue)++oo;else{if(!ro&&oo>2){for(;oo>138;oo-=138)io(32754);oo>2&&(io(oo>10?oo-11<<5|28690:oo-3<<5|12305),oo=0)}else if(oo>3){for(io(ro),--oo;oo>6;oo-=6)io(8304);oo>2&&(io(oo-3<<5|8208),oo=0)}for(;oo--;)io(ro);oo=1,ro=to[ao]}return[eo.subarray(0,no),ue]},Vi=function(to,ue){for(var eo=0,no=0;no<ue.length;++no)eo+=to[no]*ue[no];return eo},zi=function(to,ue,eo){var no=eo.length,ro=Ni(ue+2);to[ro]=255&no,to[ro+1]=no>>>8,to[ro+2]=255^to[ro],to[ro+3]=255^to[ro+1];for(var oo=0;oo<no;++oo)to[ro+oo+4]=eo[oo];return 8*(ro+4+no)},Qi=function(to,ue,eo,no,ro,oo,io,ao,so,lo,co){Hi(ue,co++,eo),++ro[256];for(var uo=ji(ro,15),fo=uo[0],po=uo[1],ho=ji(oo,15),_o=ho[0],go=ho[1],bo=Wi(fo),vo=bo[0],yo=bo[1],wo=Wi(_o),ko=wo[0],So=wo[1],Eo=new ki(19),Io=0;Io<vo.length;++Io)Eo[31&vo[Io]]++;for(Io=0;Io<ko.length;++Io)Eo[31&ko[Io]]++;for(var Ao=ji(Eo,7),To=Ao[0],Mo=Ao[1],Vo=19;Vo>4&&!To[Ii[Vo-1]];--Vo);var Fo,Po,Ro,Do,qo=lo+5<<3,Uo=Vi(ro,Ai$1)+Vi(oo,Li)+io,jo=Vi(ro,fo)+Vi(oo,_o)+io+14+3*Vo+Vi(Eo,To)+(2*Eo[16]+3*Eo[17]+7*Eo[18]);if(qo<=Uo&&qo<=jo)return zi(ue,co,to.subarray(so,so+lo));if(Hi(ue,co,1+(jo<Uo)),co+=2,jo<Uo){Fo=Mi(fo,po,0),Po=fo,Ro=Mi(_o,go,0),Do=_o;var Zo=Mi(To,Mo,0);for(Hi(ue,co,yo-257),Hi(ue,co+5,So-1),Hi(ue,co+10,Vo-4),co+=14,Io=0;Io<Vo;++Io)Hi(ue,co+3*Io,To[Ii[Io]]);co+=3*Vo;for(var Qo=[vo,ko],Yo=0;Yo<2;++Yo){var Xo=Qo[Yo];for(Io=0;Io<Xo.length;++Io){var Ko=31&Xo[Io];Hi(ue,co,Zo[Ko]),co+=To[Ko],Ko>15&&(Hi(ue,co,Xo[Io]>>>5&127),co+=Xo[Io]>>>12)}}}else Fo=Di,Po=Ai$1,Ro=qi,Do=Li;for(Io=0;Io<ao;++Io)if(no[Io]>255){Ko=no[Io]>>>18&31,Ui(ue,co,Fo[Ko+257]),co+=Po[Ko+257],Ko>7&&(Hi(ue,co,no[Io]>>>23&31),co+=Si[Ko]);var ra=31&no[Io];Ui(ue,co,Ro[ra]),co+=Do[ra],ra>3&&(Ui(ue,co,no[Io]>>>5&8191),co+=Ei[ra])}else Ui(ue,co,Fo[no[Io]]),co+=Po[no[Io]];return Ui(ue,co,Fo[256]),co+Po[256]},Ji=new wi([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Yi=new bi(0),Xi=function(){for(var to=new wi(256),ue=0;ue<256;++ue){for(var eo=ue,no=9;--no;)eo=(1&eo&&3988292384)^eo>>>1;to[ue]=eo}return to}(),Ki=function(to,ue,eo,no,ro){return function(oo,io,ao,so,lo,co){var uo=oo.length,fo=new bi(so+uo+5*(1+Math.floor(uo/7e3))+lo),po=fo.subarray(so,fo.length-lo),ho=0;if(!io||uo<8)for(var _o=0;_o<=uo;_o+=65535){var go=_o+65535;go<uo?ho=zi(po,ho,oo.subarray(_o,go)):(po[_o]=co,ho=zi(po,ho,oo.subarray(_o,uo)))}else{for(var bo=Ji[io-1],vo=bo>>>13,yo=8191&bo,wo=(1<<ao)-1,ko=new ki(32768),So=new ki(wo+1),Eo=Math.ceil(ao/3),Io=2*Eo,Ao=function(ka){return(oo[ka]^oo[ka+1]<<Eo^oo[ka+2]<<Io)&wo},To=new wi(25e3),Mo=new ki(288),Vo=new ki(32),Fo=0,Po=0,Ro=(_o=0,0),Do=0,qo=0;_o<uo;++_o){var Uo=Ao(_o),jo=32767&_o,Zo=So[Uo];if(ko[jo]=Zo,So[Uo]=jo,Do<=_o){var Qo=uo-_o;if((Fo>7e3||Ro>24576)&&Qo>423){ho=Qi(oo,po,0,To,Mo,Vo,Po,Ro,qo,_o-qo,ho),Ro=Fo=Po=0,qo=_o;for(var Yo=0;Yo<286;++Yo)Mo[Yo]=0;for(Yo=0;Yo<30;++Yo)Vo[Yo]=0}var Xo=2,Ko=0,ra=yo,ea=jo-Zo&32767;if(Qo>2&&Uo==Ao(_o-ea))for(var ia=Math.min(vo,Qo)-1,Jo=Math.min(32767,_o),sa=Math.min(258,Qo);ea<=Jo&&--ra&&jo!=Zo;){if(oo[_o+Xo]==oo[_o+Xo-ea]){for(var Ea=0;Ea<sa&&oo[_o+Ea]==oo[_o+Ea-ea];++Ea);if(Ea>Xo){if(Xo=Ea,Ko=ea,Ea>ia)break;var pa=Math.min(ea,Ea-2),ya=0;for(Yo=0;Yo<pa;++Yo){var da=_o-ea+Yo+32768&32767,Ra=da-ko[da]+32768&32767;Ra>ya&&(ya=Ra,Zo=da)}}}ea+=(jo=Zo)-(Zo=ko[jo])+32768&32767}if(Ko){To[Ro++]=268435456|Pi[Xo]<<18|Ti[Ko];var Da=31&Pi[Xo],Na=31&Ti[Ko];Po+=Si[Da]+Ei[Na],++Mo[257+Da],++Vo[Na],Do=_o+Xo,++Fo}else To[Ro++]=oo[_o],++Mo[oo[_o]]}}ho=Qi(oo,po,co,To,Mo,Vo,Po,Ro,qo,_o-qo,ho),co||(ho=zi(po,ho,Yi))}return Bi(fo,0,so+Ni(ho)+lo)}(to,ue.level==null?6:ue.level,ue.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(to.length)))):12+ue.mem,eo,no,!ro)},Zi=function(to,ue,eo){for(;eo;++ue)to[ue]=eo,eo>>>=8};function er(to,ue){ue===void 0&&(ue={});var eo=function(){var ao=4294967295;return{p:function(so){for(var lo=ao,co=0;co<so.length;++co)lo=Xi[255&lo^so[co]]^lo>>>8;ao=lo},d:function(){return 4294967295^ao}}}(),no=to.length;eo.p(to);var ro,oo=Ki(to,ue,10+((ro=ue).filename&&ro.filename.length+1||0),8),io=oo.length;return function(ao,so){var lo=so.filename;if(ao[0]=31,ao[1]=139,ao[2]=8,ao[8]=so.level<2?4:so.level==9?2:0,ao[9]=3,so.mtime!=0&&Zi(ao,4,Math.floor(new Date(so.mtime||Date.now())/1e3)),lo){ao[3]=8;for(var co=0;co<=lo.length;++co)ao[co+10]=lo.charCodeAt(co)}}(oo,ue),Zi(oo,io-8,eo.d()),Zi(oo,io-4,no),oo}var tr=!!N||!!q,nr="text/plain",ir=function(to,ue){var eo=u(to.split("?"),2),no=eo[0],ro=eo[1],oo=t$1({},ue);ro==null||ro.split("&").forEach(function(ao){var so=u(ao.split("="),1)[0];delete oo[so]});var io=_t(oo);return io=io?(ro?ro+"&":"")+io:ro,"".concat(no,"?").concat(io)},rr=function(to){return"data="+encodeURIComponent(typeof to=="string"?to:JSON.stringify(to))},sr=function(to){var ue=to.data,eo=to.compression;if(ue){if(eo===re.GZipJS){var no=er(function(oo,io){var ao=oo.length;if(!io&&typeof TextEncoder<"u")return new TextEncoder().encode(oo);for(var so=new bi(oo.length+(oo.length>>>1)),lo=0,co=function(ho){so[lo++]=ho},uo=0;uo<ao;++uo){if(lo+5>so.length){var fo=new bi(lo+8+(ao-uo<<1));fo.set(so),so=fo}var po=oo.charCodeAt(uo);po<128||io?co(po):po<2048?(co(192|po>>>6),co(128|63&po)):po>55295&&po<57344?(co(240|(po=65536+(1047552&po)|1023&oo.charCodeAt(++uo))>>>18),co(128|po>>>12&63),co(128|po>>>6&63),co(128|63&po)):(co(224|po>>>12),co(128|po>>>6&63),co(128|63&po))}return Bi(so,0,lo)}(JSON.stringify(ue)),{mtime:0});return{contentType:nr,body:new Blob([no],{type:nr})}}if(eo===re.Base64){var ro=function(oo){var io,ao,so,lo,co,uo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",fo=0,po=0,ho="",_o=[];if(!oo)return oo;oo=se(oo);do io=(co=oo.charCodeAt(fo++)<<16|oo.charCodeAt(fo++)<<8|oo.charCodeAt(fo++))>>18&63,ao=co>>12&63,so=co>>6&63,lo=63&co,_o[po++]=uo.charAt(io)+uo.charAt(ao)+uo.charAt(so)+uo.charAt(lo);while(fo<oo.length);switch(ho=_o.join(""),oo.length%3){case 1:ho=ho.slice(0,-2)+"==";break;case 2:ho=ho.slice(0,-1)+"="}return ho}(JSON.stringify(ue));return{contentType:"application/x-www-form-urlencoded",body:rr(ro)}}return{contentType:"application/json",body:JSON.stringify(ue)}}},or=[];N&&or.push({transport:"XHR",method:function(to){var ue,eo=new N;eo.open(to.method||"GET",to.url,!0);var no=(ue=sr(to))!==null&&ue!==void 0?ue:{},ro=no.contentType,oo=no.body;Q(to.headers,function(io,ao){eo.setRequestHeader(ao,io)}),ro&&eo.setRequestHeader("Content-Type",ro),to.timeout&&(eo.timeout=to.timeout),eo.withCredentials=!0,eo.onreadystatechange=function(){if(eo.readyState===4){var io,ao={statusCode:eo.status,text:eo.responseText};if(eo.status===200)try{ao.json=JSON.parse(eo.responseText)}catch{}(io=to.callback)===null||io===void 0||io.call(to,ao)}},eo.send(oo)}}),q&&or.push({transport:"fetch",method:function(to){var ue,eo,no=(ue=sr(to))!==null&&ue!==void 0?ue:{},ro=no.contentType,oo=no.body,io=new Headers;Q(to.headers,function(co,uo){io.append(uo,co)}),ro&&io.append("Content-Type",ro);var ao=to.url,so=null;if(B){var lo=new B;so={signal:lo.signal,timeout:setTimeout(function(){return lo.abort()},to.timeout)}}q(ao,{method:(to==null?void 0:to.method)||"GET",headers:io,keepalive:to.method==="POST",body:oo,signal:(eo=so)===null||eo===void 0?void 0:eo.signal}).then(function(co){return co.text().then(function(uo){var fo,po={statusCode:co.status,text:uo};if(co.status===200)try{po.json=JSON.parse(uo)}catch(ho){G.error(ho)}(fo=to.callback)===null||fo===void 0||fo.call(to,po)})}).catch(function(co){var uo;G.error(co),(uo=to.callback)===null||uo===void 0||uo.call(to,{statusCode:0,text:co})}).finally(function(){return so?clearTimeout(so.timeout):null})}}),A!=null&&A.sendBeacon&&or.push({transport:"sendBeacon",method:function(to){var ue=ir(to.url,{beacon:"1"});try{var eo,no=(eo=sr(to))!==null&&eo!==void 0?eo:{},ro=no.contentType,oo=no.body,io=typeof oo=="string"?new Blob([oo],{type:ro}):oo;A.sendBeacon(ue,io)}catch{}}});var ar=["retriesPerformedSoFar"],ur,lr=function(){function to(ue){var eo=this;i$1(this,to),o(this,"isPolling",!1),o(this,"pollIntervalMs",3e3),o(this,"queue",[]),this.instance=ue,this.queue=[],this.areWeOnline=!0,!w$1(T)&&"onLine"in T.navigator&&(this.areWeOnline=T.navigator.onLine,T.addEventListener("online",function(){eo.areWeOnline=!0,eo.flush()}),T.addEventListener("offline",function(){eo.areWeOnline=!1}))}return s(to,[{key:"retriableRequest",value:function(ue){var eo=this,no=ue.retriesPerformedSoFar,ro=a(ue,ar);F(no)&&no>0&&(ro.url=ir(ro.url,{retry_count:no})),this.instance._send_request(t$1(t$1({},ro),{},{callback:function(oo){var io;oo.statusCode!==200&&(oo.statusCode<400||oo.statusCode>=500)&&(no??0)<10?eo.enqueue(t$1({retriesPerformedSoFar:no},ro)):(io=ro.callback)===null||io===void 0||io.call(ro,oo)}}))}},{key:"enqueue",value:function(ue){var eo=ue.retriesPerformedSoFar||0;ue.retriesPerformedSoFar=eo+1;var no=function(io){var ao=3e3*Math.pow(2,io),so=ao/2,lo=Math.min(18e5,ao),co=(Math.random()-.5)*(lo-so);return Math.ceil(lo+co)}(eo),ro=Date.now()+no;this.queue.push({retryAt:ro,requestOptions:ue});var oo="Enqueued failed request for retry in ".concat(no);navigator.onLine||(oo+=" (Browser is offline)"),G.warn(oo),this.isPolling||(this.isPolling=!0,this.poll())}},{key:"poll",value:function(){var ue=this;this.poller&&clearTimeout(this.poller),this.poller=setTimeout(function(){ue.areWeOnline&&ue.queue.length>0&&ue.flush(),ue.poll()},this.pollIntervalMs)}},{key:"flush",value:function(){var ue=Date.now(),eo=[],no=this.queue.filter(function(ao){return ao.retryAt<ue||(eo.push(ao),!1)});if(this.queue=eo,no.length>0){var ro,oo=h(no);try{for(oo.s();!(ro=oo.n()).done;){var io=ro.value.requestOptions;this.retriableRequest(io)}}catch(ao){oo.e(ao)}finally{oo.f()}}}},{key:"unload",value:function(){this.poller&&(clearTimeout(this.poller),this.poller=void 0);var ue,eo=h(this.queue);try{for(eo.s();!(ue=eo.n()).done;){var no=ue.value.requestOptions;try{this.instance._send_request(t$1(t$1({},no),{},{transport:"sendBeacon"}))}catch(ro){G.error(ro)}}}catch(ro){eo.e(ro)}finally{eo.f()}this.queue=[]}}]),to}(),cr=1800,dr=function(){function to(ue,eo,no,ro){var oo;i$1(this,to),o(this,"_sessionIdChangedHandlers",[]),this.config=ue,this.persistence=eo,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=no||Ke,this._windowIdGenerator=ro||Ke;var io=ue.persistence_name||ue.token,ao=ue.session_idle_timeout_seconds||cr;if(F(ao)?ao>cr?G.warn("session_idle_timeout_seconds cannot be greater than 30 minutes. Using 30 minutes instead."):ao<60&&G.warn("session_idle_timeout_seconds cannot be less than 60 seconds. Using 60 seconds instead."):(G.warn("session_idle_timeout_seconds must be a number. Defaulting to 30 minutes."),ao=cr),this._sessionTimeoutMs=1e3*Math.min(Math.max(ao,60),cr),this._window_id_storage_key="ph_"+io+"_window_id",this._primary_window_exists_storage_key="ph_"+io+"_primary_window_exists",this._canUseSessionStorage()){var so=ft.parse(this._window_id_storage_key),lo=ft.parse(this._primary_window_exists_storage_key);so&&!lo?this._windowId=so:ft.remove(this._window_id_storage_key),ft.set(this._primary_window_exists_storage_key,!0)}if((oo=this.config.bootstrap)!==null&&oo!==void 0&&oo.sessionID)try{var co=function(uo){var fo=uo.replace(/-/g,"");if(fo.length!==32)throw new Error("Not a valid UUID");if(fo[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(fo.substring(0,12),16)}(this.config.bootstrap.sessionID);this._setSessionId(this.config.bootstrap.sessionID,new Date().getTime(),co)}catch(uo){G.error("Invalid sessionID in bootstrap",uo)}this._listenToReloadWindow()}return s(to,[{key:"onSessionId",value:function(ue){var eo=this;return w$1(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(ue),this._sessionId&&ue(this._sessionId,this._windowId),function(){eo._sessionIdChangedHandlers=eo._sessionIdChangedHandlers.filter(function(no){return no!==ue})}}},{key:"_canUseSessionStorage",value:function(){return this.config.persistence!=="memory"&&!this.persistence.disabled&&ft.is_supported()}},{key:"_setWindowId",value:function(ue){ue!==this._windowId&&(this._windowId=ue,this._canUseSessionStorage()&&ft.set(this._window_id_storage_key,ue))}},{key:"_getWindowId",value:function(){return this._windowId?this._windowId:this._canUseSessionStorage()?ft.parse(this._window_id_storage_key):null}},{key:"_setSessionId",value:function(ue,eo,no){ue===this._sessionId&&eo===this._sessionActivityTimestamp&&no===this._sessionStartTimestamp||(this._sessionStartTimestamp=no,this._sessionActivityTimestamp=eo,this._sessionId=ue,this.persistence.register(o({},Se,[eo,ue,no])))}},{key:"_getSessionId",value:function(){if(this._sessionId&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this._sessionId,this._sessionStartTimestamp];var ue=this.persistence.props[Se];return m(ue)&&ue.length===2&&ue.push(ue[0]),ue||[0,null,0]}},{key:"resetSessionId",value:function(){this._setSessionId(null,null,null)}},{key:"_listenToReloadWindow",value:function(){var ue=this;T==null||T.addEventListener("beforeunload",function(){ue._canUseSessionStorage()&&ft.remove(ue._primary_window_exists_storage_key)})}},{key:"checkAndGetSessionAndWindowId",value:function(){var ue=arguments.length>0&&arguments[0]!==void 0&&arguments[0],eo=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:null)||new Date().getTime(),no=u(this._getSessionId(),3),ro=no[0],oo=no[1],io=no[2],ao=this._getWindowId(),so=io&&io>0&&Math.abs(eo-io)>864e5,lo=!1,co=!oo,uo=!ue&&Math.abs(eo-ro)>this._sessionTimeoutMs;co||uo||so?(oo=this._sessionIdGenerator(),ao=this._windowIdGenerator(),G.info("[SessionId] new session ID generated",{sessionId:oo,windowId:ao,changeReason:{noSessionId:co,activityTimeout:uo,sessionPastMaximumLength:so}}),io=eo,lo=!0):ao||(ao=this._windowIdGenerator(),lo=!0);var fo=ro===0||!ue||so?eo:ro,po=io===0?new Date().getTime():io;return this._setWindowId(ao),this._setSessionId(oo,fo,po),lo&&this._sessionIdChangedHandlers.forEach(function(ho){return ho(oo,ao)}),{sessionId:oo,windowId:ao,sessionStartTimestamp:po}}}]),to}();(function(to){to.US="us",to.EU="eu",to.CUSTOM="custom"})(ur||(ur={}));var hr="i.posthog.com",fr=function(){function to(ue){i$1(this,to),o(this,"_regionCache",{}),this.instance=ue}return s(to,[{key:"apiHost",get:function(){var ue=this.instance.config.api_host.trim().replace(/\/$/,"");return ue==="https://app.posthog.com"?"https://us.i.posthog.com":ue}},{key:"uiHost",get:function(){var ue,eo=(ue=this.instance.config.ui_host)===null||ue===void 0?void 0:ue.replace(/\/$/,"");return eo||(eo=this.apiHost.replace(".".concat(hr),".posthog.com")),eo==="https://app.posthog.com"?"https://us.posthog.com":eo}},{key:"region",get:function(){return this._regionCache[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=ur.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=ur.EU:this._regionCache[this.apiHost]=ur.CUSTOM),this._regionCache[this.apiHost]}},{key:"endpointFor",value:function(ue){var eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";if(eo&&(eo=eo[0]==="/"?eo:"/".concat(eo)),ue==="ui")return this.uiHost+eo;if(this.region===ur.CUSTOM)return this.apiHost+eo;var no=hr+eo;switch(ue){case"assets":return"https://".concat(this.region,"-assets.").concat(no);case"api":return"https://".concat(this.region,".").concat(no)}}},{key:"loadScript",value:function(ue,eo){if(this.instance.config.disable_external_dependency_loading)return G.warn("".concat(ue," was requested but loading of external scripts is disabled.")),eo("Loading of external scripts is disabled");var no=ue[0]==="/"?this.endpointFor("assets",ue):ue,ro=function(){if(!L)return eo("document not found");var oo=L.createElement("script");oo.type="text/javascript",oo.src=no,oo.onload=function(so){return eo(void 0,so)},oo.onerror=function(so){return eo(so)};var io,ao=L.querySelectorAll("body > script");ao.length>0?(io=ao[0].parentNode)===null||io===void 0||io.insertBefore(oo,ao[0]):L.body.appendChild(oo)};L!=null&&L.body?ro():L==null||L.addEventListener("DOMContentLoaded",ro)}}]),to}(),vr="posthog-js";function pr(to){var ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},eo=ue.organization,no=ue.projectId,ro=ue.prefix,oo=ue.severityAllowList,io=oo===void 0?["error"]:oo;return function(ao){var so,lo,co,uo,fo;if(!(io==="*"||io.includes(ao.level))||!to.__loaded)return ao;ao.tags||(ao.tags={});var po=to.requestRouter.endpointFor("ui","/project/".concat(to.config.token,"/person/").concat(to.get_distinct_id()));ao.tags["PostHog Person URL"]=po,to.sessionRecordingStarted()&&(ao.tags["PostHog Recording URL"]=to.get_session_replay_url({withTimestamp:!0}));var ho=((so=ao.exception)===null||so===void 0?void 0:so.values)||[],_o={$exception_message:((lo=ho[0])===null||lo===void 0?void 0:lo.value)||ao.message,$exception_type:(co=ho[0])===null||co===void 0?void 0:co.type,$exception_personURL:po,$exception_level:ao.level,$sentry_event_id:ao.event_id,$sentry_exception:ao.exception,$sentry_exception_message:((uo=ho[0])===null||uo===void 0?void 0:uo.value)||ao.message,$sentry_exception_type:(fo=ho[0])===null||fo===void 0?void 0:fo.type,$sentry_tags:ao.tags,$level:ao.level};return eo&&no&&(_o.$sentry_url=(ro||"https://sentry.io/organizations/")+eo+"/issues/?project="+no+"&query="+ao.event_id),to.exceptions.sendExceptionEvent(_o),ao}}var gr=s(function to(ue,eo,no,ro,oo){i$1(this,to),this.name=vr,this.setupOnce=function(io){io(pr(ue,{organization:eo,projectId:no,prefix:ro,severityAllowList:oo}))}});function _r(to,ue){var eo=to.config.segment;if(!eo)return ue();(function(no,ro){var oo=no.config.segment;if(!oo)return ro();var io=function(so){var lo=function(){return so.anonymousId()||Ke()};no.config.get_device_id=lo,so.id()&&(no.register({distinct_id:so.id(),$device_id:lo()}),no.persistence.set_property($e,"identified")),ro()},ao=oo.user();"then"in ao&&y(ao.then)?ao.then(function(so){return io(so)}):io(ao)})(to,function(){eo.register(function(no){Promise&&Promise.resolve||G.warn("This browser does not have Promise support, and can not use the segment integration");var ro=function(oo,io){var ao;if(!io)return oo;oo.event.userId||oo.event.anonymousId===no.get_distinct_id()||(G.info("Segment integration does not have a userId set, resetting PostHog"),no.reset()),oo.event.userId&&oo.event.userId!==no.get_distinct_id()&&(G.info("Segment integration has a userId set, identifying with PostHog"),no.identify(oo.event.userId));var so=no._calculate_event_properties(io,(ao=oo.event.properties)!==null&&ao!==void 0?ao:{},new Date);return oo.event.properties=Object.assign({},so,oo.event.properties),oo};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:function(){return!0},load:function(){return Promise.resolve()},track:function(oo){return ro(oo,oo.event.event)},page:function(oo){return ro(oo,"$pageview")},identify:function(oo){return ro(oo,"$identify")},screen:function(oo){return ro(oo,"$screen")}}}(to)).then(function(){ue()})})}var mr,yr,br,kr=function(){function to(ue){i$1(this,to),this._instance=ue}return s(to,[{key:"doPageView",value:function(ue){var eo,no=this._previousPageViewProperties(ue);return this._currentPath=(eo=T==null?void 0:T.location.pathname)!==null&&eo!==void 0?eo:"",this._instance.scrollManager.resetContext(),this._prevPageviewTimestamp=ue,no}},{key:"doPageLeave",value:function(ue){return this._previousPageViewProperties(ue)}},{key:"_previousPageViewProperties",value:function(ue){var eo=this._currentPath,no=this._prevPageviewTimestamp,ro=this._instance.scrollManager.getContext();if(!no)return{};var oo={};if(ro){var io=ro.maxScrollHeight,ao=ro.lastScrollY,so=ro.maxScrollY,lo=ro.maxContentHeight,co=ro.lastContentY,uo=ro.maxContentY;w$1(io)||w$1(ao)||w$1(so)||w$1(lo)||w$1(co)||w$1(uo)||(io=Math.ceil(io),ao=Math.ceil(ao),so=Math.ceil(so),lo=Math.ceil(lo),co=Math.ceil(co),uo=Math.ceil(uo),oo={$prev_pageview_last_scroll:ao,$prev_pageview_last_scroll_percentage:io<=1?1:wr(ao/io,0,1),$prev_pageview_max_scroll:so,$prev_pageview_max_scroll_percentage:io<=1?1:wr(so/io,0,1),$prev_pageview_last_content:co,$prev_pageview_last_content_percentage:lo<=1?1:wr(co/lo,0,1),$prev_pageview_max_content:uo,$prev_pageview_max_content_percentage:lo<=1?1:wr(uo/lo,0,1)})}return eo&&(oo.$prev_pageview_pathname=eo),no&&(oo.$prev_pageview_duration=(ue.getTime()-no.getTime())/1e3),oo}}]),to}();function wr(to,ue,eo){return Math.max(ue,Math.min(to,eo))}(function(to){to.Popover="popover",to.API="api",to.Widget="widget"})(mr||(mr={})),function(to){to.Open="open",to.MultipleChoice="multiple_choice",to.SingleChoice="single_choice",to.Rating="rating",to.Link="link"}(yr||(yr={})),function(to){to.NextQuestion="next_question",to.End="end",to.ResponseBased="response_based",to.SpecificQuestion="specific_question"}(br||(br={}));var Sr=function(){function to(){i$1(this,to),o(this,"events",{}),this.events={}}return s(to,[{key:"on",value:function(ue,eo){var no=this;return this.events[ue]||(this.events[ue]=[]),this.events[ue].push(eo),function(){no.events[ue]=no.events[ue].filter(function(ro){return ro!==eo})}}},{key:"emit",value:function(ue,eo){var no,ro=h(this.events[ue]||[]);try{for(ro.s();!(no=ro.n()).done;)(0,no.value)(eo)}catch(ao){ro.e(ao)}finally{ro.f()}var oo,io=h(this.events["*"]||[]);try{for(io.s();!(oo=io.n()).done;)(0,oo.value)(ue,eo)}catch(ao){io.e(ao)}finally{io.f()}}}]),to}(),Er=function(){function to(ue){var eo=this;i$1(this,to),o(this,"_debugEventEmitter",new Sr),o(this,"checkStep",function(no,ro){return eo.checkStepEvent(no,ro)&&eo.checkStepUrl(no,ro)&&eo.checkStepElement(no,ro)}),o(this,"checkStepEvent",function(no,ro){return ro==null||!ro.event||(no==null?void 0:no.event)===(ro==null?void 0:ro.event)}),this.instance=ue,this.actionEvents=new Set,this.actionRegistry=new Set}return s(to,[{key:"init",value:function(){var ue,eo=this;if(!w$1((ue=this.instance)===null||ue===void 0?void 0:ue._addCaptureHook)){var no;(no=this.instance)===null||no===void 0||no._addCaptureHook(function(ro,oo){eo.on(ro,oo)})}}},{key:"register",value:function(ue){var eo,no,ro=this;if(!w$1((eo=this.instance)===null||eo===void 0?void 0:eo._addCaptureHook)&&(ue.forEach(function(ao){var so,lo;(so=ro.actionRegistry)===null||so===void 0||so.add(ao),(lo=ao.steps)===null||lo===void 0||lo.forEach(function(co){var uo;(uo=ro.actionEvents)===null||uo===void 0||uo.add((co==null?void 0:co.event)||"")})}),(no=this.instance)!==null&&no!==void 0&&no.autocapture)){var oo,io=new Set;ue.forEach(function(ao){var so;(so=ao.steps)===null||so===void 0||so.forEach(function(lo){lo!=null&&lo.selector&&io.add(lo==null?void 0:lo.selector)})}),(oo=this.instance)===null||oo===void 0||oo.autocapture.setElementSelectors(io)}}},{key:"on",value:function(ue,eo){var no,ro=this;eo!=null&&ue.length!=0&&(this.actionEvents.has(ue)||this.actionEvents.has(eo==null?void 0:eo.event))&&this.actionRegistry&&((no=this.actionRegistry)===null||no===void 0?void 0:no.size)>0&&this.actionRegistry.forEach(function(oo){ro.checkAction(eo,oo)&&ro._debugEventEmitter.emit("actionCaptured",oo.name)})}},{key:"_addActionHook",value:function(ue){this.onAction("actionCaptured",function(eo){return ue(eo)})}},{key:"checkAction",value:function(ue,eo){if((eo==null?void 0:eo.steps)==null)return!1;var no,ro=h(eo.steps);try{for(ro.s();!(no=ro.n()).done;){var oo=no.value;if(this.checkStep(ue,oo))return!0}}catch(io){ro.e(io)}finally{ro.f()}return!1}},{key:"onAction",value:function(ue,eo){return this._debugEventEmitter.on(ue,eo)}},{key:"checkStepUrl",value:function(ue,eo){if(eo!=null&&eo.url){var no,ro=ue==null||(no=ue.properties)===null||no===void 0?void 0:no.$current_url;if(!ro||typeof ro!="string"||!to.matchString(ro,eo==null?void 0:eo.url,(eo==null?void 0:eo.url_matching)||"contains"))return!1}return!0}},{key:"checkStepElement",value:function(ue,eo){if((eo!=null&&eo.href||eo!=null&&eo.tag_name||eo!=null&&eo.text)&&!this.getElementsList(ue).some(function(oo){return!(eo!=null&&eo.href&&!to.matchString(oo.href||"",eo==null?void 0:eo.href,(eo==null?void 0:eo.href_matching)||"exact"))&&(eo==null||!eo.tag_name||oo.tag_name===(eo==null?void 0:eo.tag_name))&&!(eo!=null&&eo.text&&!to.matchString(oo.text||"",eo==null?void 0:eo.text,(eo==null?void 0:eo.text_matching)||"exact")&&!to.matchString(oo.$el_text||"",eo==null?void 0:eo.text,(eo==null?void 0:eo.text_matching)||"exact"))}))return!1;if(eo!=null&&eo.selector){var no,ro=ue==null||(no=ue.properties)===null||no===void 0?void 0:no.$element_selectors;if(!ro||!ro.includes(eo==null?void 0:eo.selector))return!1}return!0}},{key:"getElementsList",value:function(ue){return(ue==null?void 0:ue.properties.$elements)==null?[]:ue==null?void 0:ue.properties.$elements}}],[{key:"matchString",value:function(ue,eo,no){switch(no){case"regex":return!!T&>(ue,eo);case"exact":return eo===ue;case"contains":var ro=to.escapeStringRegexp(eo).replace(/_/g,".").replace(/%/g,".*");return gt(ue,ro);default:return!1}}},{key:"escapeStringRegexp",value:function(ue){return ue.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}}]),to}(),Ir=function(){function to(ue){i$1(this,to),this.instance=ue,this.eventToSurveys=new Map,this.actionToSurveys=new Map}return s(to,[{key:"register",value:function(ue){var eo;w$1((eo=this.instance)===null||eo===void 0?void 0:eo._addCaptureHook)||(this.setupEventBasedSurveys(ue),this.setupActionBasedSurveys(ue))}},{key:"setupActionBasedSurveys",value:function(ue){var eo=this,no=ue.filter(function(ro){var oo,io,ao,so;return((oo=ro.conditions)===null||oo===void 0?void 0:oo.actions)&&((io=ro.conditions)===null||io===void 0||(ao=io.actions)===null||ao===void 0||(so=ao.values)===null||so===void 0?void 0:so.length)>0});no.length!==0&&(this.actionMatcher==null&&(this.actionMatcher=new Er(this.instance),this.actionMatcher.init(),this.actionMatcher._addActionHook(function(ro){eo.onAction(ro)})),no.forEach(function(ro){var oo,io,ao,so,lo,co,uo,fo,po,ho;ro.conditions&&(oo=ro.conditions)!==null&&oo!==void 0&&oo.actions&&(io=ro.conditions)!==null&&io!==void 0&&(ao=io.actions)!==null&&ao!==void 0&&ao.values&&((so=ro.conditions)===null||so===void 0||(lo=so.actions)===null||lo===void 0||(co=lo.values)===null||co===void 0?void 0:co.length)>0&&((uo=eo.actionMatcher)===null||uo===void 0||uo.register(ro.conditions.actions.values),(fo=ro.conditions)===null||fo===void 0||(po=fo.actions)===null||po===void 0||(ho=po.values)===null||ho===void 0||ho.forEach(function(_o){if(_o&&_o.name){var go=eo.actionToSurveys.get(_o.name);go&&go.push(ro.id),eo.actionToSurveys.set(_o.name,go||[ro.id])}}))}))}},{key:"setupEventBasedSurveys",value:function(ue){var eo,no=this;ue.filter(function(ro){var oo,io,ao,so;return((oo=ro.conditions)===null||oo===void 0?void 0:oo.events)&&((io=ro.conditions)===null||io===void 0||(ao=io.events)===null||ao===void 0||(so=ao.values)===null||so===void 0?void 0:so.length)>0}).length!==0&&((eo=this.instance)===null||eo===void 0||eo._addCaptureHook(function(ro,oo){no.onEvent(ro,oo)}),ue.forEach(function(ro){var oo,io,ao;(oo=ro.conditions)===null||oo===void 0||(io=oo.events)===null||io===void 0||(ao=io.values)===null||ao===void 0||ao.forEach(function(so){if(so&&so.name){var lo=no.eventToSurveys.get(so.name);lo&&lo.push(ro.id),no.eventToSurveys.set(so.name,lo||[ro.id])}})}))}},{key:"onEvent",value:function(ue,eo){var no,ro,oo=((no=this.instance)===null||no===void 0||(ro=no.persistence)===null||ro===void 0?void 0:ro.props[Te])||[];if(to.SURVEY_SHOWN_EVENT_NAME==ue&&eo&&oo.length>0){var io,ao=eo==null||(io=eo.properties)===null||io===void 0?void 0:io.$survey_id;if(ao){var so=oo.indexOf(ao);so>=0&&(oo.splice(so,1),this._updateActivatedSurveys(oo))}}else this.eventToSurveys.has(ue)&&this._updateActivatedSurveys(oo.concat(this.eventToSurveys.get(ue)||[]))}},{key:"onAction",value:function(ue){var eo,no,ro=((eo=this.instance)===null||eo===void 0||(no=eo.persistence)===null||no===void 0?void 0:no.props[Te])||[];this.actionToSurveys.has(ue)&&this._updateActivatedSurveys(ro.concat(this.actionToSurveys.get(ue)||[]))}},{key:"_updateActivatedSurveys",value:function(ue){var eo,no;(eo=this.instance)===null||eo===void 0||(no=eo.persistence)===null||no===void 0||no.register(o({},Te,l(new Set(ue))))}},{key:"getSurveys",value:function(){var ue,eo,no=(ue=this.instance)===null||ue===void 0||(eo=ue.persistence)===null||eo===void 0?void 0:eo.props[Te];return no||[]}},{key:"getEventToSurveys",value:function(){return this.eventToSurveys}},{key:"_getActionMatcher",value:function(){return this.actionMatcher}}]),to}();o(Ir,"SURVEY_SHOWN_EVENT_NAME","survey shown");var Rr="[Surveys]",Fr={icontains:function(to){return!!T&&T.location.href.toLowerCase().indexOf(to.toLowerCase())>-1},not_icontains:function(to){return!!T&&T.location.href.toLowerCase().indexOf(to.toLowerCase())===-1},regex:function(to){return!!T&>(T.location.href,to)},not_regex:function(to){return!!T&&!gt(T.location.href,to)},exact:function(to){return(T==null?void 0:T.location.href)===to},is_not:function(to){return(T==null?void 0:T.location.href)!==to}},xr=function(){function to(ue){i$1(this,to),this.instance=ue,this._surveyEventReceiver=null}return s(to,[{key:"afterDecideResponse",value:function(ue){this._decideServerResponse=!!ue.surveys,this.loadIfEnabled()}},{key:"loadIfEnabled",value:function(){var ue=this,eo=U==null?void 0:U.extendPostHogWithSurveys;this.instance.config.disable_surveys||!this._decideServerResponse||eo||(this._surveyEventReceiver==null&&(this._surveyEventReceiver=new Ir(this.instance)),this.instance.requestRouter.loadScript("/static/surveys.js",function(no){if(no)return G.error(Rr,"Could not load surveys script",no);ue._surveyManager=U.extendPostHogWithSurveys(ue.instance)}))}},{key:"getSurveys",value:function(ue){var eo=this,no=arguments.length>1&&arguments[1]!==void 0&&arguments[1];if(this.instance.config.disable_surveys)return ue([]);this._surveyEventReceiver==null&&(this._surveyEventReceiver=new Ir(this.instance));var ro=this.instance.get_property(Pe);if(ro&&!no)return ue(ro);this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/surveys/?token=".concat(this.instance.config.token)),method:"GET",transport:"XHR",callback:function(oo){var io;if(oo.statusCode!==200||!oo.json)return ue([]);var ao,so=oo.json.surveys||[],lo=so.filter(function(co){var uo,fo,po,ho,_o,go,bo,vo,yo,wo,ko,So;return((uo=co.conditions)===null||uo===void 0?void 0:uo.events)&&((fo=co.conditions)===null||fo===void 0||(po=fo.events)===null||po===void 0?void 0:po.values)&&((ho=co.conditions)===null||ho===void 0||(_o=ho.events)===null||_o===void 0||(go=_o.values)===null||go===void 0?void 0:go.length)>0||((bo=co.conditions)===null||bo===void 0?void 0:bo.actions)&&((vo=co.conditions)===null||vo===void 0||(yo=vo.actions)===null||yo===void 0?void 0:yo.values)&&((wo=co.conditions)===null||wo===void 0||(ko=wo.actions)===null||ko===void 0||(So=ko.values)===null||So===void 0?void 0:So.length)>0});return lo.length>0&&((ao=eo._surveyEventReceiver)===null||ao===void 0||ao.register(lo)),(io=eo.instance.persistence)===null||io===void 0||io.register(o({},Pe,so)),ue(so)}})}},{key:"getActiveMatchingSurveys",value:function(ue){var eo=this,no=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.getSurveys(function(ro){var oo,io=ro.filter(function(lo){return!(!lo.start_date||lo.end_date)}).filter(function(lo){var co,uo,fo,po;if(!lo.conditions)return!0;var ho=(co=lo.conditions)===null||co===void 0||!co.url||Fr[(uo=(fo=lo.conditions)===null||fo===void 0?void 0:fo.urlMatchType)!==null&&uo!==void 0?uo:"icontains"](lo.conditions.url),_o=(po=lo.conditions)===null||po===void 0||!po.selector||(L==null?void 0:L.querySelector(lo.conditions.selector));return ho&&_o}),ao=(oo=eo._surveyEventReceiver)===null||oo===void 0?void 0:oo.getSurveys(),so=io.filter(function(lo){var co,uo,fo,po,ho,_o,go,bo,vo,yo;if(!lo.linked_flag_key&&!lo.targeting_flag_key&&!lo.internal_targeting_flag_key)return!0;var wo=!lo.linked_flag_key||eo.instance.featureFlags.isFeatureEnabled(lo.linked_flag_key),ko=!lo.targeting_flag_key||eo.instance.featureFlags.isFeatureEnabled(lo.targeting_flag_key),So=((co=lo.conditions)===null||co===void 0?void 0:co.events)&&((uo=lo.conditions)===null||uo===void 0||(fo=uo.events)===null||fo===void 0?void 0:fo.values)&&((po=lo.conditions)===null||po===void 0||(ho=po.events)===null||ho===void 0?void 0:ho.values.length)>0,Eo=((_o=lo.conditions)===null||_o===void 0?void 0:_o.actions)&&((go=lo.conditions)===null||go===void 0||(bo=go.actions)===null||bo===void 0?void 0:bo.values)&&((vo=lo.conditions)===null||vo===void 0||(yo=vo.actions)===null||yo===void 0?void 0:yo.values.length)>0,Io=!So&&!Eo||(ao==null?void 0:ao.includes(lo.id)),Ao=eo._canActivateRepeatedly(lo),To=!(lo.internal_targeting_flag_key&&!Ao)||eo.instance.featureFlags.isFeatureEnabled(lo.internal_targeting_flag_key);return wo&&ko&&To&&Io});return ue(so)},no)}},{key:"getNextSurveyStep",value:function(ue,eo,no){var ro,oo=ue.questions[eo],io=eo+1;if((ro=oo.branching)===null||ro===void 0||!ro.type)return eo===ue.questions.length-1?br.End:io;if(oo.branching.type===br.End)return br.End;if(oo.branching.type===br.SpecificQuestion){if(Number.isInteger(oo.branching.index))return oo.branching.index}else if(oo.branching.type===br.ResponseBased){if(oo.type===yr.SingleChoice){var ao,so,lo=oo.choices.indexOf("".concat(no));if((ao=oo.branching)!==null&&ao!==void 0&&(so=ao.responseValues)!==null&&so!==void 0&&so.hasOwnProperty(lo)){var co=oo.branching.responseValues[lo];return Number.isInteger(co)?co:co===br.End?br.End:io}}else if(oo.type===yr.Rating){var uo,fo;if(typeof no!="number"||!Number.isInteger(no))throw new Error("The response type must be an integer");var po=function(_o,go){if(go===3){if(_o<1||_o>3)throw new Error("The response must be in range 1-3");return _o===1?"negative":_o===2?"neutral":"positive"}if(go===5){if(_o<1||_o>5)throw new Error("The response must be in range 1-5");return _o<=2?"negative":_o===3?"neutral":"positive"}if(go===10){if(_o<0||_o>10)throw new Error("The response must be in range 0-10");return _o<=6?"detractors":_o<=8?"passives":"promoters"}throw new Error("The scale must be one of: 3, 5, 10")}(no,oo.scale);if((uo=oo.branching)!==null&&uo!==void 0&&(fo=uo.responseValues)!==null&&fo!==void 0&&fo.hasOwnProperty(po)){var ho=oo.branching.responseValues[po];return Number.isInteger(ho)?ho:ho===br.End?br.End:io}}return io}return G.warn(Rr,"Falling back to next question index due to unexpected branching type"),io}},{key:"_canActivateRepeatedly",value:function(ue){return R(U.__PosthogExtensions__.canActivateRepeatedly)&&G.warn(Rr,"canActivateRepeatedly is not defined, must init before calling"),U.__PosthogExtensions__.canActivateRepeatedly(ue)}},{key:"canRenderSurvey",value:function(ue){var eo=this;R(this._surveyManager)?G.warn(Rr,"canActivateRepeatedly is not defined, must init before calling"):this.getSurveys(function(no){var ro=no.filter(function(oo){return oo.id===ue})[0];eo._surveyManager.canRenderSurvey(ro)})}},{key:"renderSurvey",value:function(ue,eo){var no=this;R(this._surveyManager)?G.warn(Rr,"canActivateRepeatedly is not defined, must init before calling"):this.getSurveys(function(ro){var oo=ro.filter(function(io){return io.id===ue})[0];no._surveyManager.renderSurvey(oo,L==null?void 0:L.querySelector(eo))})}}]),to}(),Pr=function(){function to(ue){var eo,no,ro=this;i$1(this,to),o(this,"serverLimits",{}),o(this,"lastEventRateLimited",!1),o(this,"checkForLimiting",function(oo){var io=oo.text;if(io&&io.length)try{(JSON.parse(io).quota_limited||[]).forEach(function(ao){G.info("[RateLimiter] ".concat(ao||"events"," is quota limited.")),ro.serverLimits[ao]=new Date().getTime()+6e4})}catch(ao){return void G.warn('[RateLimiter] could not rate limit - continuing. Error: "'.concat(ao==null?void 0:ao.message,'"'),{text:io})}}),this.instance=ue,this.captureEventsPerSecond=((eo=ue.config.rate_limiting)===null||eo===void 0?void 0:eo.events_per_second)||10,this.captureEventsBurstLimit=Math.max(((no=ue.config.rate_limiting)===null||no===void 0?void 0:no.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}return s(to,[{key:"clientRateLimitContext",value:function(){var ue,eo,no,ro=arguments.length>0&&arguments[0]!==void 0&&arguments[0],oo=new Date().getTime(),io=(ue=(eo=this.instance.persistence)===null||eo===void 0?void 0:eo.get_property(Me))!==null&&ue!==void 0?ue:{tokens:this.captureEventsBurstLimit,last:oo};io.tokens+=(oo-io.last)/1e3*this.captureEventsPerSecond,io.last=oo,io.tokens>this.captureEventsBurstLimit&&(io.tokens=this.captureEventsBurstLimit);var ao=io.tokens<1;return ao||ro||(io.tokens=Math.max(0,io.tokens-1)),!ao||this.lastEventRateLimited||ro||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to ".concat(this.captureEventsPerSecond," events per second and ").concat(this.captureEventsBurstLimit," events burst limit.")},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=ao,(no=this.instance.persistence)===null||no===void 0||no.set_property(Me,io),{isRateLimited:ao,remainingTokens:io.tokens}}},{key:"isServerRateLimited",value:function(ue){var eo=this.serverLimits[ue||"events"]||!1;return eo!==!1&&new Date().getTime()<eo}}]),to}(),Tr=function(){return t$1({initialPathName:(D==null?void 0:D.pathname)||"",referringDomain:mn.referringDomain()},mn.campaignParams())},Cr=function(){function to(ue,eo,no){var ro=this;i$1(this,to),o(this,"_onSessionIdCallback",function(oo){var io=ro._getStoredProps();if(!io||io.sessionId!==oo){var ao={sessionId:oo,props:ro._sessionSourceParamGenerator()};ro._persistence.register(o({},Oe,ao))}}),this._sessionIdManager=ue,this._persistence=eo,this._sessionSourceParamGenerator=no||Tr,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}return s(to,[{key:"_getStoredProps",value:function(){return this._persistence.props[Oe]}},{key:"getSessionProps",value:function(){var ue,eo=(ue=this._getStoredProps())===null||ue===void 0?void 0:ue.props;return eo?{$client_session_initial_referring_host:eo.referringDomain,$client_session_initial_pathname:eo.initialPathName,$client_session_initial_utm_source:eo.utm_source,$client_session_initial_utm_campaign:eo.utm_campaign,$client_session_initial_utm_medium:eo.utm_medium,$client_session_initial_utm_content:eo.utm_content,$client_session_initial_utm_term:eo.utm_term}:{}}}]),to}(),$r=["ahrefsbot","ahrefssiteaudit","applebot","baiduspider","bingbot","bingpreview","bot.htm","bot.php","crawler","deepscan","duckduckbot","facebookexternal","facebookcatalog","gptbot","http://yandex.com/bots","hubspot","ia_archiver","linkedinbot","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","semrushbot","sitebulb","slurp","turnitin","twitterbot","vercelbot","yahoo! slurp","yandexbot","headlesschrome","cypress","Google-HotelAdsVerifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google","Bytespider;"],Or=function(to,ue){if(!to)return!1;var eo=to.toLowerCase();return $r.concat(ue||[]).some(function(no){var ro=no.toLowerCase();return eo.indexOf(ro)!==-1})},Mr=function(){function to(){i$1(this,to),this.clicks=[]}return s(to,[{key:"isRageClick",value:function(ue,eo,no){var ro=this.clicks[this.clicks.length-1];if(ro&&Math.abs(ue-ro.x)+Math.abs(eo-ro.y)<30&&no-ro.timestamp<1e3){if(this.clicks.push({x:ue,y:eo,timestamp:no}),this.clicks.length===3)return!0}else this.clicks=[{x:ue,y:eo,timestamp:no}];return!1}}]),to}();function Ar(to){var ue;return to.id===Ne||!((ue=to.closest)===null||ue===void 0||!ue.call(to,"#"+Ne))}var Lr=function(){function to(ue){var eo,no=this;i$1(this,to),o(this,"rageclicks",new Mr),o(this,"_enabledServerSide",!1),o(this,"_initialized",!1),o(this,"_flushInterval",null),this.instance=ue,this._enabledServerSide=!((eo=this.instance.persistence)===null||eo===void 0||!eo.props[fe]),T==null||T.addEventListener("beforeunload",function(){no.flush()})}return s(to,[{key:"flushIntervalMilliseconds",get:function(){var ue=5e3;return b(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(ue=this.instance.config.capture_heatmaps.flush_interval_milliseconds),ue}},{key:"isEnabled",get:function(){return w$1(this.instance.config.capture_heatmaps)?w$1(this.instance.config.enable_heatmaps)?this._enabledServerSide:this.instance.config.enable_heatmaps:this.instance.config.capture_heatmaps!==!1}},{key:"startIfEnabled",value:function(){if(this.isEnabled){if(this._initialized)return;G.info("[heatmaps] starting..."),this._setupListeners(),this._flushInterval=setInterval(this.flush.bind(this),this.flushIntervalMilliseconds)}else{var ue;clearInterval((ue=this._flushInterval)!==null&&ue!==void 0?ue:void 0),this.getAndClearBuffer()}}},{key:"afterDecideResponse",value:function(ue){var eo=!!ue.heatmaps;this.instance.persistence&&this.instance.persistence.register(o({},fe,eo)),this._enabledServerSide=eo,this.startIfEnabled()}},{key:"getAndClearBuffer",value:function(){var ue=this.buffer;return this.buffer=void 0,ue}},{key:"_setupListeners",value:function(){var ue=this;T&&L&&(oe(L,"click",function(eo){return ue._onClick(eo||(T==null?void 0:T.event))},!1,!0),oe(L,"mousemove",function(eo){return ue._onMouseMove(eo||(T==null?void 0:T.event))},!1,!0),this._initialized=!0)}},{key:"_getProperties",value:function(ue,eo){var no=this.instance.scrollManager.scrollY(),ro=this.instance.scrollManager.scrollX(),oo=this.instance.scrollManager.scrollElement(),io=function(ao,so,lo){for(var co=ao;co&&!On(co,"body");){if(co===lo)return!1;if(Y(so,T==null?void 0:T.getComputedStyle(co).position))return!0;co=Dn(co)}return!1}(ue.target,["fixed","sticky"],oo);return{x:ue.clientX+(io?0:ro),y:ue.clientY+(io?0:no),target_fixed:io,type:eo}}},{key:"_onClick",value:function(ue){var eo;if(!Ar(ue.target)){var no=this._getProperties(ue,"click");(eo=this.rageclicks)!==null&&eo!==void 0&&eo.isRageClick(ue.clientX,ue.clientY,new Date().getTime())&&this._capture(t$1(t$1({},no),{},{type:"rageclick"})),this._capture(no)}}},{key:"_onMouseMove",value:function(ue){var eo=this;Ar(ue.target)||(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout(function(){eo._capture(eo._getProperties(ue,"mousemove"))},500))}},{key:"_capture",value:function(ue){if(T){var eo=T.location.href;this.buffer=this.buffer||{},this.buffer[eo]||(this.buffer[eo]=[]),this.buffer[eo].push(ue)}}},{key:"flush",value:function(){this.buffer&&!k(this.buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}]),to}(),Dr=function(){function to(ue){var eo=this;i$1(this,to),o(this,"_updateScrollData",function(){var no,ro,oo,io;eo.context||(eo.context={});var ao=eo.scrollElement(),so=eo.scrollY(),lo=ao?Math.max(0,ao.scrollHeight-ao.clientHeight):0,co=so+((ao==null?void 0:ao.clientHeight)||0),uo=(ao==null?void 0:ao.scrollHeight)||0;eo.context.lastScrollY=Math.ceil(so),eo.context.maxScrollY=Math.max(so,(no=eo.context.maxScrollY)!==null&&no!==void 0?no:0),eo.context.maxScrollHeight=Math.max(lo,(ro=eo.context.maxScrollHeight)!==null&&ro!==void 0?ro:0),eo.context.lastContentY=co,eo.context.maxContentY=Math.max(co,(oo=eo.context.maxContentY)!==null&&oo!==void 0?oo:0),eo.context.maxContentHeight=Math.max(uo,(io=eo.context.maxContentHeight)!==null&&io!==void 0?io:0)}),this.instance=ue}return s(to,[{key:"getContext",value:function(){return this.context}},{key:"resetContext",value:function(){var ue=this.context;return setTimeout(this._updateScrollData,0),ue}},{key:"startMeasuringScrollPosition",value:function(){T==null||T.addEventListener("scroll",this._updateScrollData,!0),T==null||T.addEventListener("scrollend",this._updateScrollData,!0),T==null||T.addEventListener("resize",this._updateScrollData)}},{key:"scrollElement",value:function(){if(!this.instance.config.scroll_root_selector)return T==null?void 0:T.document.documentElement;var ue,eo=h(m(this.instance.config.scroll_root_selector)?this.instance.config.scroll_root_selector:[this.instance.config.scroll_root_selector]);try{for(eo.s();!(ue=eo.n()).done;){var no=ue.value,ro=T==null?void 0:T.document.querySelector(no);if(ro)return ro}}catch(oo){eo.e(oo)}finally{eo.f()}}},{key:"scrollY",value:function(){if(this.instance.config.scroll_root_selector){var ue=this.scrollElement();return ue&&ue.scrollTop||0}return T&&(T.scrollY||T.pageYOffset||T.document.documentElement.scrollTop)||0}},{key:"scrollX",value:function(){if(this.instance.config.scroll_root_selector){var ue=this.scrollElement();return ue&&ue.scrollLeft||0}return T&&(T.scrollX||T.pageXOffset||T.document.documentElement.scrollLeft)||0}}]),to}(),qr="$copy_autocapture";function Nr(to,ue){return ue.length>to?ue.slice(0,to)+"...":ue}var Br,Hr=function(){function to(ue){i$1(this,to),o(this,"_initialized",!1),o(this,"_isDisabledServerSide",null),o(this,"rageclicks",new Mr),o(this,"_elementsChainAsString",!1),this.instance=ue,this._elementSelectors=null}return s(to,[{key:"config",get:function(){var ue,eo,no=b(this.instance.config.autocapture)?this.instance.config.autocapture:{};return no.url_allowlist=(ue=no.url_allowlist)===null||ue===void 0?void 0:ue.map(function(ro){return new RegExp(ro)}),no.url_ignorelist=(eo=no.url_ignorelist)===null||eo===void 0?void 0:eo.map(function(ro){return new RegExp(ro)}),no}},{key:"_addDomEventHandlers",value:function(){var ue=this;if(this.isBrowserSupported()){if(T&&L){var eo=function(ro){ro=ro||(T==null?void 0:T.event);try{ue._captureEvent(ro)}catch(oo){G.error("Failed to capture event",oo)}},no=function(ro){ro=ro||(T==null?void 0:T.event),ue._captureEvent(ro,qr)};oe(L,"submit",eo,!1,!0),oe(L,"change",eo,!1,!0),oe(L,"click",eo,!1,!0),this.config.capture_copied_text&&(oe(L,"copy",no,!1,!0),oe(L,"cut",no,!1,!0))}}else G.info("Disabling Automatic Event Collection because this browser is not supported")}},{key:"startIfEnabled",value:function(){this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}},{key:"afterDecideResponse",value:function(ue){ue.elementsChainAsString&&(this._elementsChainAsString=ue.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register(o({},he,!!ue.autocapture_opt_out)),this._isDisabledServerSide=!!ue.autocapture_opt_out,this.startIfEnabled()}},{key:"setElementSelectors",value:function(ue){this._elementSelectors=ue}},{key:"getElementSelectors",value:function(ue){var eo,no=[];return(eo=this._elementSelectors)===null||eo===void 0||eo.forEach(function(ro){var oo=L==null?void 0:L.querySelectorAll(ro);oo==null||oo.forEach(function(io){ue===io&&no.push(ro)})}),no}},{key:"isEnabled",get:function(){var ue,eo,no=(ue=this.instance.persistence)===null||ue===void 0?void 0:ue.props[he],ro=this._isDisabledServerSide;if(I(ro)&&!x$1(no)&&!this.instance.config.advanced_disable_decide)return!1;var oo=(eo=this._isDisabledServerSide)!==null&&eo!==void 0?eo:!!no;return!!this.instance.config.autocapture&&!oo}},{key:"_previousElementSibling",value:function(ue){if(ue.previousElementSibling)return ue.previousElementSibling;var eo=ue;do eo=eo.previousSibling;while(eo&&!$n(eo));return eo}},{key:"_getAugmentPropertiesFromElement",value:function(ue){if(!Nn(ue))return{};var eo={};return Q(ue.attributes,function(no){if(no.name&&no.name.indexOf("data-ph-capture-attribute")===0){var ro=no.name.replace("data-ph-capture-attribute-",""),oo=no.value;ro&&oo&&zn(oo)&&(eo[ro]=oo)}}),eo}},{key:"_getPropertiesFromElement",value:function(ue,eo,no){var ro,oo=ue.tagName.toLowerCase(),io={tag_name:oo};Ln.indexOf(oo)>-1&&!no&&(oo.toLowerCase()==="a"||oo.toLowerCase()==="button"?io.$el_text=Nr(1024,Qn(ue)):io.$el_text=Nr(1024,Cn(ue)));var ao=Pn(ue);ao.length>0&&(io.classes=ao.filter(function(fo){return fo!==""}));var so=(ro=this.config)===null||ro===void 0?void 0:ro.element_attribute_ignorelist;Q(ue.attributes,function(fo){var po;if((!Bn(ue)||["name","id","class","aria-label"].indexOf(fo.name)!==-1)&&(so==null||!so.includes(fo.name))&&!eo&&zn(fo.value)&&(po=fo.name,!S(po)||po.substring(0,10)!=="_ngcontent"&&po.substring(0,7)!=="_nghost")){var ho=fo.value;fo.name==="class"&&(ho=Fn(ho).join(" ")),io["attr__"+fo.name]=Nr(1024,ho)}});for(var lo=1,co=1,uo=ue;uo=this._previousElementSibling(uo);)lo++,uo.tagName===ue.tagName&&co++;return io.nth_child=lo,io.nth_of_type=co,io}},{key:"_getDefaultProperties",value:function(ue){return{$event_type:ue,$ce_version:1}}},{key:"_getEventTarget",value:function(ue){return w$1(ue.target)?ue.srcElement||null:(eo=ue.target)!==null&&eo!==void 0&&eo.shadowRoot?ue.composedPath()[0]||null:ue.target||null;var eo}},{key:"_captureEvent",value:function(ue){var eo=this,no=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"$autocapture";if(this.isEnabled){var ro,oo=this._getEventTarget(ue);Mn(oo)&&(oo=oo.parentNode||null),no==="$autocapture"&&ue.type==="click"&&ue instanceof MouseEvent&&this.instance.config.rageclick&&(ro=this.rageclicks)!==null&&ro!==void 0&&ro.isRageClick(ue.clientX,ue.clientY,new Date().getTime())&&this._captureEvent(ue,"$rageclick");var io=no===qr;if(oo&&qn(oo,ue,this.config,io,io?["copy","cut"]:void 0)){for(var ao,so,lo=[oo],co=oo;co.parentNode&&!On(co,"body");)An(co.parentNode)?(lo.push(co.parentNode.host),co=co.parentNode.host):(lo.push(co.parentNode),co=co.parentNode);var uo,fo,po=[],ho={},_o=!1;if(Q(lo,function(Ao){var To=Nn(Ao);Ao.tagName.toLowerCase()==="a"&&(uo=Ao.getAttribute("href"),uo=To&&zn(uo)&&uo),Y(Pn(Ao),"ph-no-capture")&&(_o=!0),po.push(eo._getPropertiesFromElement(Ao,eo.instance.config.mask_all_element_attributes,eo.instance.config.mask_all_text));var Mo=eo._getAugmentPropertiesFromElement(Ao);J(ho,Mo)}),this.instance.config.mask_all_text||(oo.tagName.toLowerCase()==="a"||oo.tagName.toLowerCase()==="button"?po[0].$el_text=Qn(oo):po[0].$el_text=Cn(oo)),uo){var go,bo;po[0].attr__href=uo;var vo=(go=pt(uo))===null||go===void 0?void 0:go.host,yo=T==null||(bo=T.location)===null||bo===void 0?void 0:bo.host;vo&&yo&&vo!==yo&&(fo=uo)}if(_o)return!1;var wo=J(this._getDefaultProperties(ue.type),this._elementsChainAsString?{$elements_chain:Yn(po)}:{$elements:po},(ao=po[0])!==null&&ao!==void 0&&ao.$el_text?{$el_text:(so=po[0])===null||so===void 0?void 0:so.$el_text}:{},fo&&ue.type==="click"?{$external_click_url:fo}:{},ho),ko=this.getElementSelectors(oo);if(ko&&ko.length>0&&(wo.$element_selectors=ko),no===qr){var So,Eo=Tn(T==null||(So=T.getSelection())===null||So===void 0?void 0:So.toString()),Io=ue.type||"clipboard";if(!Eo)return!1;wo.$selected_content=Eo,wo.$copy_type=Io}return this.instance.capture(no,wo),!0}}}},{key:"isBrowserSupported",value:function(){return y(L==null?void 0:L.querySelectorAll)}}]),to}(),Ur=function(){function to(ue){var eo=this;i$1(this,to),o(this,"_restoreXHRPatch",void 0),o(this,"_restoreFetchPatch",void 0),o(this,"_startCapturing",function(){w$1(eo._restoreXHRPatch)&&U.postHogTracingHeadersPatchFns._patchXHR(eo.instance.sessionManager),w$1(eo._restoreFetchPatch)&&U.postHogTracingHeadersPatchFns._patchFetch(eo.instance.sessionManager)}),this.instance=ue}return s(to,[{key:"_loadScript",value:function(ue){U.postHogTracingHeadersPatchFns&&ue(),this.instance.requestRouter.loadScript("/static/tracing-headers.js?v=".concat(f.LIB_VERSION),function(eo){if(eo)return G.error("[TRACING-HEADERS] failed to load script",eo);ue()})}},{key:"startIfEnabledOrStop",value:function(){var ue,eo;this.instance.config.__add_tracing_headers?this._loadScript(this._startCapturing):((ue=this._restoreXHRPatch)===null||ue===void 0||ue.call(this),(eo=this._restoreFetchPatch)===null||eo===void 0||eo.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0)}}]),to}();(function(to){to[to.PENDING=-1]="PENDING",to[to.DENIED=0]="DENIED",to[to.GRANTED=1]="GRANTED"})(Br||(Br={}));var jr=function(){function to(ue){i$1(this,to),this.instance=ue}return s(to,[{key:"config",get:function(){return this.instance.config}},{key:"consent",get:function(){return this.getDnt()?Br.DENIED:this.storedConsent}},{key:"isOptedOut",value:function(){return this.consent===Br.DENIED||this.consent===Br.PENDING&&this.config.opt_out_capturing_by_default}},{key:"isOptedIn",value:function(){return!this.isOptedOut()}},{key:"optInOut",value:function(ue){this.storage.set(this.storageKey,ue?1:0,this.config.cookie_expiration,this.config.cross_subdomain_cookie,this.config.secure_cookie)}},{key:"reset",value:function(){this.storage.remove(this.storageKey,this.config.cross_subdomain_cookie)}},{key:"storageKey",get:function(){var ue=this.instance.config,eo=ue.token;return(ue.opt_out_capturing_cookie_prefix||"__ph_opt_in_out_")+eo}},{key:"storedConsent",get:function(){var ue=this.storage.get(this.storageKey);return ue==="1"?Br.GRANTED:ue==="0"?Br.DENIED:Br.PENDING}},{key:"storage",get:function(){if(!this._storage){var ue=this.config.opt_out_capturing_persistence_type;this._storage=ue==="localStorage"?at:st;var eo=ue==="localStorage"?st:at;eo.get(this.storageKey)&&(this._storage.get(this.storageKey)||this.optInOut(eo.get(this.storageKey)==="1"),eo.remove(this.storageKey,this.config.cross_subdomain_cookie))}return this._storage}},{key:"getDnt",value:function(){return!!this.config.respect_dnt&&!!ae([A==null?void 0:A.doNotTrack,A==null?void 0:A.msDoNotTrack,U.doNotTrack],function(ue){return Y([!0,1,"1","yes"],ue)})}}]),to}(),Gr="[Exception Autocapture]",Wr=function(){function to(ue){var eo,no=this;i$1(this,to),o(this,"originalOnUnhandledRejectionHandler",void 0),o(this,"startCapturing",function(){if(T&&no.isEnabled&&!no.hasHandlers&&!no.isCapturing){var ro=T.posthogErrorWrappingFunctions.wrapOnError,oo=T.posthogErrorWrappingFunctions.wrapUnhandledRejection;if(ro&&oo)try{no.unwrapOnError=ro(no.captureException.bind(no)),no.unwrapUnhandledRejection=oo(no.captureException.bind(no))}catch(io){G.error(Gr+" failed to start",io),no.stopCapturing()}else G.error(Gr+" failed to load error wrapping functions - cannot start")}}),this.instance=ue,this.remoteEnabled=!((eo=this.instance.persistence)===null||eo===void 0||!eo.props[ve]),this.startIfEnabled()}return s(to,[{key:"isEnabled",get:function(){var ue;return(ue=this.remoteEnabled)!==null&&ue!==void 0&&ue}},{key:"isCapturing",get:function(){var ue;return!(T==null||(ue=T.onerror)===null||ue===void 0||!ue.__POSTHOG_INSTRUMENTED__)}},{key:"hasHandlers",get:function(){return this.originalOnUnhandledRejectionHandler||this.unwrapOnError}},{key:"startIfEnabled",value:function(){this.isEnabled&&!this.isCapturing&&(G.info(Gr+" enabled, starting..."),this.loadScript(this.startCapturing))}},{key:"loadScript",value:function(ue){this.hasHandlers&&ue(),this.instance.requestRouter.loadScript("/static/exception-autocapture.js?v=".concat(f.LIB_VERSION),function(eo){if(eo)return G.error(Gr+" failed to load script",eo);ue()})}},{key:"stopCapturing",value:function(){var ue,eo;(ue=this.unwrapOnError)===null||ue===void 0||ue.call(this),(eo=this.unwrapUnhandledRejection)===null||eo===void 0||eo.call(this)}},{key:"afterDecideResponse",value:function(ue){var eo=ue.autocaptureExceptions;this.remoteEnabled=!!eo||!1,this.instance.persistence&&this.instance.persistence.register(o({},ve,this.remoteEnabled)),this.startIfEnabled()}},{key:"captureException",value:function(ue){var eo=this.instance.requestRouter.endpointFor("ui");ue.$exception_personURL="".concat(eo,"/project/").concat(this.instance.config.token,"/person/").concat(this.instance.get_distinct_id()),this.instance.exceptions.sendExceptionEvent(ue)}}]),to}(),Vr=9e5,zr="[Web Vitals]",Qr=function(){function to(ue){var eo,no=this;i$1(this,to),o(this,"_enabledServerSide",!1),o(this,"_initialized",!1),o(this,"buffer",{url:void 0,metrics:[],firstMetricTimestamp:void 0}),o(this,"_flushToCapture",function(){clearTimeout(no._delayedFlushTimer),no.buffer.metrics.length!==0&&(no.instance.capture("$web_vitals",no.buffer.metrics.reduce(function(ro,oo){var io;return t$1(t$1({},ro),{},(o(io={},"$web_vitals_".concat(oo.name,"_event"),t$1({},oo)),o(io,"$web_vitals_".concat(oo.name,"_value"),oo.value),io))},{})),no.buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0})}),o(this,"_addToBuffer",function(ro){var oo,io=(oo=no.instance.sessionManager)===null||oo===void 0?void 0:oo.checkAndGetSessionAndWindowId(!0);if(w$1(io))G.error(zr+"Could not read session ID. Dropping metrics!");else{no.buffer=no.buffer||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var ao=no._currentURL();w$1(ao)||(R(ro==null?void 0:ro.name)||R(ro==null?void 0:ro.value)?G.error(zr+"Invalid metric received",ro):no._maxAllowedValue&&ro.value>=no._maxAllowedValue?G.error(zr+"Ignoring metric with value >= "+no._maxAllowedValue,ro):(no.buffer.url!==ao&&(no._flushToCapture(),no._delayedFlushTimer=setTimeout(no._flushToCapture,8e3)),w$1(no.buffer.url)&&(no.buffer.url=ao),no.buffer.firstMetricTimestamp=w$1(no.buffer.firstMetricTimestamp)?Date.now():no.buffer.firstMetricTimestamp,no.buffer.metrics.push(t$1(t$1({},ro),{},{$current_url:ao,$session_id:io.sessionId,$window_id:io.windowId,timestamp:Date.now()})),no.buffer.metrics.length===4&&no._flushToCapture()))}}),o(this,"_startCapturing",function(){var ro=U.postHogWebVitalsCallbacks,oo=ro.onLCP,io=ro.onCLS,ao=ro.onFCP,so=ro.onINP;oo&&io&&ao&&so?(oo(no._addToBuffer),io(no._addToBuffer),ao(no._addToBuffer),so(no._addToBuffer),no._initialized=!0):G.error(zr+"web vitals callbacks not loaded - not starting")}),this.instance=ue,this._enabledServerSide=!((eo=this.instance.persistence)===null||eo===void 0||!eo.props[ge]),this.startIfEnabled()}return s(to,[{key:"_maxAllowedValue",get:function(){var ue=b(this.instance.config.capture_performance)&&F(this.instance.config.capture_performance.__web_vitals_max_value)?this.instance.config.capture_performance.__web_vitals_max_value:Vr;return 0<ue&&ue<=6e4?Vr:ue}},{key:"isEnabled",get:function(){var ue=b(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals:void 0;return x$1(ue)?ue:this._enabledServerSide}},{key:"startIfEnabled",value:function(){this.isEnabled&&!this._initialized&&(G.info(zr+" enabled, starting..."),this.loadScript(this._startCapturing))}},{key:"afterDecideResponse",value:function(ue){var eo=b(ue.capturePerformance)&&!!ue.capturePerformance.web_vitals;this.instance.persistence&&this.instance.persistence.register(o({},ge,eo)),this._enabledServerSide=eo,this.startIfEnabled()}},{key:"loadScript",value:function(ue){T.postHogWebVitalsCallbacks&&ue(),this.instance.requestRouter.loadScript("/static/web-vitals.js?v=".concat(f.LIB_VERSION),function(eo){eo?G.error(zr+" failed to load script",eo):ue()})}},{key:"_currentURL",value:function(){var ue=T?T.location.href:void 0;return ue||G.error(zr+"Could not determine current URL"),ue}}]),to}(),Jr="/e/",Yr=function(){function to(ue){var eo;i$1(this,to),this.instance=ue,this._endpointSuffix=((eo=this.instance.persistence)===null||eo===void 0?void 0:eo.props[pe])||Jr}return s(to,[{key:"endpoint",get:function(){return this.instance.requestRouter.endpointFor("api",this._endpointSuffix)}},{key:"afterDecideResponse",value:function(ue){var eo=ue.autocaptureExceptions;this._endpointSuffix=b(eo)&&eo.endpoint||Jr,this.instance.persistence&&this.instance.persistence.register(o({},pe,this._endpointSuffix))}},{key:"sendExceptionEvent",value:function(ue){this.instance.capture("$exception",ue,{_noTruncate:!0,_batchKey:"exceptionEvent",_url:this.endpoint})}}]),to}(),Xr={},Kr=function(){},Zr="posthog",es=!tr&&(H==null?void 0:H.indexOf("MSIE"))===-1&&(H==null?void 0:H.indexOf("Mozilla"))===-1,ts=function(){var to,ue,eo;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:(ue=L==null?void 0:L.location,eo=ue==null?void 0:ue.hostname,!!S(eo)&&eo.split(".").slice(-2).join(".")!=="herokuapp.com"),persistence:"localStorage+cookie",persistence_name:"",loaded:Kr,store_google:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:!0,capture_pageleave:"if_capture_pageview",debug:D&&S(D==null?void 0:D.search)&&D.search.indexOf("__posthog_debug=true")!==-1||!1,verbose:!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_surveys:!1,enable_recording_console_log:void 0,secure_cookie:(T==null||(to=T.location)===null||to===void 0?void 0:to.protocol)==="https:",ip:!0,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},inapp_protocol:"//",inapp_link_new_window:!1,request_batching:!0,properties_string_max_length:65535,session_recording:{},mask_all_element_attributes:!1,mask_all_text:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,on_request_error:function(no){var ro="Bad HTTP status: "+no.statusCode+" "+no.text;G.error(ro)},get_device_id:function(no){return no},_onCapture:Kr,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"always",__add_tracing_headers:!1}},ns=function(to){var ue={};w$1(to.process_person)||(ue.person_profiles=to.process_person),w$1(to.xhr_headers)||(ue.request_headers=to.xhr_headers),w$1(to.cookie_name)||(ue.persistence_name=to.cookie_name),w$1(to.disable_cookie)||(ue.disable_persistence=to.disable_cookie);var eo=J({},ue,to);return m(to.property_blacklist)&&(w$1(to.property_denylist)?eo.property_denylist=to.property_blacklist:m(to.property_denylist)?eo.property_denylist=[].concat(l(to.property_blacklist),l(to.property_denylist)):G.error("Invalid value for property_denylist config: "+to.property_denylist)),eo},is=function(){function to(){i$1(this,to),o(this,"__forceAllowLocalhost",!1)}return s(to,[{key:"_forceAllowLocalhost",get:function(){return this.__forceAllowLocalhost},set:function(ue){G.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=ue}}]),to}(),rs=function(){function to(){var ue=this;i$1(this,to),o(this,"webPerformance",new is),o(this,"version",f.LIB_VERSION),o(this,"_internalEventEmitter",new Sr),this.config=ts(),this.decideEndpointWasHit=!1,this.SentryIntegration=gr,this.sentryIntegration=function(eo){return function(no,ro){var oo=pr(no,ro);return{name:vr,processEvent:function(io){return oo(io)}}}(ue,eo)},this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this.featureFlags=new We(this),this.toolbar=new mi(this),this.scrollManager=new Dr(this),this.pageViewManager=new kr(this),this.surveys=new xr(this),this.exceptions=new Yr(this),this.rateLimiter=new Pr(this),this.requestRouter=new fr(this),this.consent=new jr(this),this.people={set:function(eo,no,ro){var oo=S(eo)?o({},eo,no):eo;ue.setPersonProperties(oo),ro==null||ro({})},set_once:function(eo,no,ro){var oo=S(eo)?o({},eo,no):eo;ue.setPersonProperties(void 0,oo),ro==null||ro({})}},this.on("eventCaptured",function(eo){return G.info("send",eo)})}return s(to,[{key:"init",value:function(ue,eo,no){if(no&&no!==Zr){var ro,oo=(ro=Xr[no])!==null&&ro!==void 0?ro:new to;return oo._init(ue,eo,no),Xr[no]=oo,Xr[Zr][no]=oo,oo}return this._init(ue,eo,no)}},{key:"_init",value:function(ue){var eo,no,ro=this,oo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},io=arguments.length>2?arguments[2]:void 0;if(w$1(ue)||E(ue))return G.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return G.warn("You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},this._triggered_notifs=[],this.set_config(J({},ts(),ns(oo),{name:io,token:ue})),this.config.on_xhr_error&&G.error("[posthog] on_xhr_error is deprecated. Use on_request_error instead"),this.compression=oo.disable_compression?void 0:re.GZipJS,this.persistence=new bn(this.config),this.sessionPersistence=this.config.persistence==="sessionStorage"?this.persistence:new bn(t$1(t$1({},this.config),{},{persistence:"sessionStorage"}));var ao=t$1({},this.persistence.props),so=t$1({},this.sessionPersistence.props);if(this._requestQueue=new yi(function(vo){return ro._send_retriable_request(vo)}),this._retryQueue=new lr(this),this.__request_queue=[],this.sessionManager=new dr(this.config,this.persistence),this.sessionPropsManager=new Cr(this.sessionManager,this.persistence),new Ur(this).startIfEnabledOrStop(),this.sessionRecording=new vi(this),this.sessionRecording.startIfEnabledOrStop(),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new Hr(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new Lr(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new Qr(this),this.exceptionObserver=new Wr(this),this.exceptionObserver.startIfEnabled(),f.DEBUG=f.DEBUG||this.config.debug,f.DEBUG&&G.info("Starting in debug mode",{this:this,config:oo,thisC:t$1({},this.config),p:ao,s:so}),this._sync_opt_out_with_persistence(),((eo=oo.bootstrap)===null||eo===void 0?void 0:eo.distinctID)!==void 0){var lo,co,uo=this.config.get_device_id(Ke()),fo=(lo=oo.bootstrap)!==null&&lo!==void 0&&lo.isIdentifiedID?uo:oo.bootstrap.distinctID;this.persistence.set_property($e,(co=oo.bootstrap)!==null&&co!==void 0&&co.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:oo.bootstrap.distinctID,$device_id:fo})}if(this._hasBootstrappedFeatureFlags()){var po,ho,_o=Object.keys(((po=oo.bootstrap)===null||po===void 0?void 0:po.featureFlags)||{}).filter(function(vo){var yo,wo;return!((yo=oo.bootstrap)===null||yo===void 0||(wo=yo.featureFlags)===null||wo===void 0||!wo[vo])}).reduce(function(vo,yo){var wo,ko;return vo[yo]=((wo=oo.bootstrap)===null||wo===void 0||(ko=wo.featureFlags)===null||ko===void 0?void 0:ko[yo])||!1,vo},{}),go=Object.keys(((ho=oo.bootstrap)===null||ho===void 0?void 0:ho.featureFlagPayloads)||{}).filter(function(vo){return _o[vo]}).reduce(function(vo,yo){var wo,ko,So,Eo;return(wo=oo.bootstrap)!==null&&wo!==void 0&&(ko=wo.featureFlagPayloads)!==null&&ko!==void 0&&ko[yo]&&(vo[yo]=(So=oo.bootstrap)===null||So===void 0||(Eo=So.featureFlagPayloads)===null||Eo===void 0?void 0:Eo[yo]),vo},{});this.featureFlags.receivedFeatureFlags({featureFlags:_o,featureFlagPayloads:go})}if(!this.get_distinct_id()){var bo=this.config.get_device_id(Ke());this.register_once({distinct_id:bo,$device_id:bo},""),this.persistence.set_property($e,"anonymous")}return T==null||(no=T.addEventListener)===null||no===void 0||no.call(T,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this)),this.toolbar.maybeLoadToolbar(),oo.segment?_r(this,function(){return ro._loaded()}):this._loaded(),y(this.config._onCapture)&&this.on("eventCaptured",function(vo){return ro.config._onCapture(vo.event,vo)}),this}},{key:"_afterDecideResponse",value:function(ue){var eo,no,ro,oo,io,ao,so,lo;this.compression=void 0,ue.supportedCompression&&!this.config.disable_compression&&(this.compression=Y(ue.supportedCompression,re.GZipJS)?re.GZipJS:Y(ue.supportedCompression,re.Base64)?re.Base64:void 0),(eo=ue.analytics)!==null&&eo!==void 0&&eo.endpoint&&(this.analyticsDefaultEndpoint=ue.analytics.endpoint),(no=this.sessionRecording)===null||no===void 0||no.afterDecideResponse(ue),(ro=this.autocapture)===null||ro===void 0||ro.afterDecideResponse(ue),(oo=this.heatmaps)===null||oo===void 0||oo.afterDecideResponse(ue),(io=this.surveys)===null||io===void 0||io.afterDecideResponse(ue),(ao=this.webVitalsAutocapture)===null||ao===void 0||ao.afterDecideResponse(ue),(so=this.exceptions)===null||so===void 0||so.afterDecideResponse(ue),(lo=this.exceptionObserver)===null||lo===void 0||lo.afterDecideResponse(ue)}},{key:"_loaded",value:function(){var ue=this,eo=this.config.advanced_disable_decide;eo||this.featureFlags.setReloadingPaused(!0);try{this.config.loaded(this)}catch(no){G.critical("`loaded` function failed",no)}this._start_queue_if_opted_in(),this.config.capture_pageview&&setTimeout(function(){ue.consent.isOptedIn()&&ue._captureInitialPageview()},1),eo||(new pi(this).call(),this.featureFlags.resetRequestQueue())}},{key:"_start_queue_if_opted_in",value:function(){var ue;this.has_opted_out_capturing()||this.config.request_batching&&((ue=this._requestQueue)===null||ue===void 0||ue.enable())}},{key:"_dom_loaded",value:function(){var ue=this;this.has_opted_out_capturing()||z(this.__request_queue,function(eo){return ue._send_retriable_request(eo)}),this.__request_queue=[],this._start_queue_if_opted_in()}},{key:"_handle_unload",value:function(){var ue,eo;this.config.request_batching?(this._shouldCapturePageleave()&&this.capture("$pageleave"),(ue=this._requestQueue)===null||ue===void 0||ue.unload(),(eo=this._retryQueue)===null||eo===void 0||eo.unload()):this._shouldCapturePageleave()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}},{key:"_send_request",value:function(ue){var eo=this;this.__loaded&&(es?this.__request_queue.push(ue):this.rateLimiter.isServerRateLimited(ue.batchKey)||(ue.transport=ue.transport||this.config.api_transport,ue.url=ir(ue.url,{ip:this.config.ip?1:0}),ue.headers=t$1({},this.config.request_headers),ue.compression=ue.compression==="best-available"?this.compression:ue.compression,function(no){var ro,oo,io,ao=t$1({},no);ao.timeout=ao.timeout||6e4,ao.url=ir(ao.url,{_:new Date().getTime().toString(),ver:f.LIB_VERSION,compression:ao.compression});var so=(ro=ao.transport)!==null&&ro!==void 0?ro:"XHR",lo=(oo=(io=ae(or,function(co){return co.transport===so}))===null||io===void 0?void 0:io.method)!==null&&oo!==void 0?oo:or[0].method;if(!lo)throw new Error("No available transport method");lo(ao)}(t$1(t$1({},ue),{},{callback:function(no){var ro,oo,io;eo.rateLimiter.checkForLimiting(no),no.statusCode>=400&&((oo=(io=eo.config).on_request_error)===null||oo===void 0||oo.call(io,no)),(ro=ue.callback)===null||ro===void 0||ro.call(ue,no)}}))))}},{key:"_send_retriable_request",value:function(ue){this._retryQueue?this._retryQueue.retriableRequest(ue):this._send_request(ue)}},{key:"_execute_array",value:function(ue){var eo,no=this,ro=[],oo=[],io=[];z(ue,function(so){so&&(eo=so[0],m(eo)?io.push(so):y(so)?so.call(no):m(so)&&eo==="alias"?ro.push(so):m(so)&&eo.indexOf("capture")!==-1&&y(no[eo])?io.push(so):oo.push(so))});var ao=function(so,lo){z(so,function(co){if(m(co[0])){var uo=lo;Q(co,function(fo){uo=uo[fo[0]].apply(uo,fo.slice(1))})}else this[co[0]].apply(this,co.slice(1))},lo)};ao(ro,this),ao(oo,this),ao(io,this)}},{key:"_hasBootstrappedFeatureFlags",value:function(){var ue,eo;return((ue=this.config.bootstrap)===null||ue===void 0?void 0:ue.featureFlags)&&Object.keys((eo=this.config.bootstrap)===null||eo===void 0?void 0:eo.featureFlags).length>0||!1}},{key:"push",value:function(ue){this._execute_array([ue])}},{key:"capture",value:function(ue,eo,no){var ro;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(!this.consent.isOptedOut())if(!w$1(ue)&&S(ue)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var oo=no!=null&&no.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(oo==null||!oo.isRateLimited){this.sessionPersistence.update_search_keyword(),this.config.store_google&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.store_google||this.config.save_referrer)&&this.persistence.set_initial_person_info();var io=new Date,ao=(no==null?void 0:no.timestamp)||io,so={uuid:Ke(),event:ue,properties:this._calculate_event_properties(ue,eo||{},ao)};oo&&(so.properties.$lib_rate_limit_remaining_tokens=oo.remainingTokens),no!=null&&no.$set&&(so.$set=no==null?void 0:no.$set);var lo=this._calculate_set_once_properties(no==null?void 0:no.$set_once);lo&&(so.$set_once=lo),(so=ie$2(so,no!=null&&no._noTruncate?null:this.config.properties_string_max_length)).timestamp=ao,w$1(no==null?void 0:no.timestamp)||(so.properties.$event_time_override_provided=!0,so.properties.$event_time_override_system_time=io);var co=t$1(t$1({},so.properties.$set),so.$set);k(co)||this.setPersonPropertiesForFlags(co),this._internalEventEmitter.emit("eventCaptured",so);var uo={method:"POST",url:(ro=no==null?void 0:no._url)!==null&&ro!==void 0?ro:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:so,compression:"best-available",batchKey:no==null?void 0:no._batchKey};return!this.config.request_batching||no&&(no==null||!no._batchKey)||no!=null&&no.send_instantly?this._send_retriable_request(uo):this._requestQueue.enqueue(uo),so}G.critical("This capture call is ignored due to client rate limiting.")}}else G.error("No event name provided to posthog.capture")}else G.uninitializedWarning("posthog.capture")}},{key:"_addCaptureHook",value:function(ue){this.on("eventCaptured",function(eo){return ue(eo.event,eo)})}},{key:"_calculate_event_properties",value:function(ue,eo,no){if(no=no||new Date,!this.persistence||!this.sessionPersistence)return eo;var ro=this.persistence.remove_event_timer(ue),oo=t$1({},eo);if(oo.token=this.config.token,ue==="$snapshot"){var io=t$1(t$1({},this.persistence.properties()),this.sessionPersistence.properties());return oo.distinct_id=io.distinct_id,(!S(oo.distinct_id)&&!F(oo.distinct_id)||E(oo.distinct_id))&&G.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),oo}var ao=mn.properties();if(this.sessionManager){var so=this.sessionManager.checkAndGetSessionAndWindowId(),lo=so.sessionId,co=so.windowId;oo.$session_id=lo,oo.$window_id=co}if(this.requestRouter.region===ur.CUSTOM&&(oo.$lib_custom_api_host=this.config.api_host),this.sessionPropsManager&&this.config.__preview_send_client_session_params&&(ue==="$pageview"||ue==="$pageleave"||ue==="$autocapture")){var uo=this.sessionPropsManager.getSessionProps();oo=J(oo,uo)}if(!this.config.disable_scroll_properties){var fo={};ue==="$pageview"?fo=this.pageViewManager.doPageView(no):ue==="$pageleave"&&(fo=this.pageViewManager.doPageLeave(no)),oo=J(oo,fo)}if(ue==="$pageview"&&L&&(oo.title=L.title),!w$1(ro)){var po=no.getTime()-ro;oo.$duration=parseFloat((po/1e3).toFixed(3))}H&&this.config.opt_out_useragent_filter&&(oo.$browser_type=this._is_bot()?"bot":"browser"),(oo=J({},ao,this.persistence.properties(),this.sessionPersistence.properties(),oo)).$is_identified=this._isIdentified(),m(this.config.property_denylist)?Q(this.config.property_denylist,function(_o){delete oo[_o]}):G.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var ho=this.config.sanitize_properties;return ho&&(oo=ho(oo,ue)),oo.$process_person_profile=this._hasPersonProcessing(),oo}},{key:"_calculate_set_once_properties",value:function(ue){if(!this.persistence||!this._hasPersonProcessing())return ue;var eo=J({},this.persistence.get_initial_props(),ue||{});return k(eo)?void 0:eo}},{key:"register",value:function(ue,eo){var no;(no=this.persistence)===null||no===void 0||no.register(ue,eo)}},{key:"register_once",value:function(ue,eo,no){var ro;(ro=this.persistence)===null||ro===void 0||ro.register_once(ue,eo,no)}},{key:"register_for_session",value:function(ue){var eo;(eo=this.sessionPersistence)===null||eo===void 0||eo.register(ue)}},{key:"unregister",value:function(ue){var eo;(eo=this.persistence)===null||eo===void 0||eo.unregister(ue)}},{key:"unregister_for_session",value:function(ue){var eo;(eo=this.sessionPersistence)===null||eo===void 0||eo.unregister(ue)}},{key:"_register_single",value:function(ue,eo){this.register(o({},ue,eo))}},{key:"getFeatureFlag",value:function(ue,eo){return this.featureFlags.getFeatureFlag(ue,eo)}},{key:"getFeatureFlagPayload",value:function(ue){var eo=this.featureFlags.getFeatureFlagPayload(ue);try{return JSON.parse(eo)}catch{return eo}}},{key:"isFeatureEnabled",value:function(ue,eo){return this.featureFlags.isFeatureEnabled(ue,eo)}},{key:"reloadFeatureFlags",value:function(){this.featureFlags.reloadFeatureFlags()}},{key:"updateEarlyAccessFeatureEnrollment",value:function(ue,eo){this.featureFlags.updateEarlyAccessFeatureEnrollment(ue,eo)}},{key:"getEarlyAccessFeatures",value:function(ue){var eo=arguments.length>1&&arguments[1]!==void 0&&arguments[1];return this.featureFlags.getEarlyAccessFeatures(ue,eo)}},{key:"on",value:function(ue,eo){return this._internalEventEmitter.on(ue,eo)}},{key:"onFeatureFlags",value:function(ue){return this.featureFlags.onFeatureFlags(ue)}},{key:"onSessionId",value:function(ue){var eo,no;return(eo=(no=this.sessionManager)===null||no===void 0?void 0:no.onSessionId(ue))!==null&&eo!==void 0?eo:function(){}}},{key:"getSurveys",value:function(ue){var eo=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.surveys.getSurveys(ue,eo)}},{key:"getActiveMatchingSurveys",value:function(ue){var eo=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.surveys.getActiveMatchingSurveys(ue,eo)}},{key:"renderSurvey",value:function(ue,eo){this.surveys.renderSurvey(ue,eo)}},{key:"canRenderSurvey",value:function(ue){this.surveys.canRenderSurvey(ue)}},{key:"getNextSurveyStep",value:function(ue,eo,no){return this.surveys.getNextSurveyStep(ue,eo,no)}},{key:"identify",value:function(ue,eo,no){if(!this.__loaded||!this.persistence)return G.uninitializedWarning("posthog.identify");if(F(ue)&&(ue=ue.toString(),G.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),ue){if(["distinct_id","distinctid"].includes(ue.toLowerCase()))G.critical('The string "'.concat(ue,'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'));else if(this._requirePersonProcessing("posthog.identify")){var ro=this.get_distinct_id();if(this.register({$user_id:ue}),!this.get_property("$device_id")){var oo=ro;this.register_once({$had_persisted_distinct_id:!0,$device_id:oo},"")}ue!==ro&&ue!==this.get_property(ce)&&(this.unregister(ce),this.register({distinct_id:ue}));var io=(this.persistence.get_property($e)||"anonymous")==="anonymous";ue!==ro&&io?(this.persistence.set_property($e,"identified"),this.setPersonPropertiesForFlags(eo||{},!1),this.capture("$identify",{distinct_id:ue,$anon_distinct_id:ro},{$set:eo||{},$set_once:no||{}}),this.featureFlags.setAnonymousDistinctId(ro)):(eo||no)&&this.setPersonProperties(eo,no),ue!==ro&&(this.reloadFeatureFlags(),this.unregister(Ce))}}else G.error("Unique user id has not been set in posthog.identify")}},{key:"setPersonProperties",value:function(ue,eo){(ue||eo)&&this._requirePersonProcessing("posthog.setPersonProperties")&&(this.setPersonPropertiesForFlags(ue||{}),this.capture("$set",{$set:ue||{},$set_once:eo||{}}))}},{key:"group",value:function(ue,eo,no){if(ue&&eo){if(this._requirePersonProcessing("posthog.group")){var ro=this.getGroups();ro[ue]!==eo&&this.resetGroupPropertiesForFlags(ue),this.register({$groups:t$1(t$1({},ro),{},o({},ue,eo))}),no&&(this.capture("$groupidentify",{$group_type:ue,$group_key:eo,$group_set:no}),this.setGroupPropertiesForFlags(o({},ue,no))),ro[ue]===eo||no||this.reloadFeatureFlags()}}else G.error("posthog.group requires a group type and group key")}},{key:"resetGroups",value:function(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}},{key:"setPersonPropertiesForFlags",value:function(ue){var eo=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this._requirePersonProcessing("posthog.setPersonPropertiesForFlags")&&this.featureFlags.setPersonPropertiesForFlags(ue,eo)}},{key:"resetPersonPropertiesForFlags",value:function(){this.featureFlags.resetPersonPropertiesForFlags()}},{key:"setGroupPropertiesForFlags",value:function(ue){var eo=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(ue,eo)}},{key:"resetGroupPropertiesForFlags",value:function(ue){this.featureFlags.resetGroupPropertiesForFlags(ue)}},{key:"reset",value:function(ue){var eo,no,ro,oo;if(G.info("reset"),!this.__loaded)return G.uninitializedWarning("posthog.reset");var io=this.get_property("$device_id");this.consent.reset(),(eo=this.persistence)===null||eo===void 0||eo.clear(),(no=this.sessionPersistence)===null||no===void 0||no.clear(),(ro=this.persistence)===null||ro===void 0||ro.set_property($e,"anonymous"),(oo=this.sessionManager)===null||oo===void 0||oo.resetSessionId();var ao=this.config.get_device_id(Ke());this.register_once({distinct_id:ao,$device_id:ue?ao:io},"")}},{key:"get_distinct_id",value:function(){return this.get_property("distinct_id")}},{key:"getGroups",value:function(){return this.get_property("$groups")||{}}},{key:"get_session_id",value:function(){var ue,eo;return(ue=(eo=this.sessionManager)===null||eo===void 0?void 0:eo.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&ue!==void 0?ue:""}},{key:"get_session_replay_url",value:function(ue){if(!this.sessionManager)return"";var eo=this.sessionManager.checkAndGetSessionAndWindowId(!0),no=eo.sessionId,ro=eo.sessionStartTimestamp,oo=this.requestRouter.endpointFor("ui","/project/".concat(this.config.token,"/replay/").concat(no));if(ue!=null&&ue.withTimestamp&&ro){var io,ao=(io=ue.timestampLookBack)!==null&&io!==void 0?io:10;if(!ro)return oo;var so=Math.max(Math.floor((new Date().getTime()-ro)/1e3)-ao,0);oo+="?t=".concat(so)}return oo}},{key:"alias",value:function(ue,eo){return ue===this.get_property(le)?(G.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(w$1(eo)&&(eo=this.get_distinct_id()),ue!==eo?(this._register_single(ce,ue),this.capture("$create_alias",{alias:ue,distinct_id:eo})):(G.warn("alias matches current distinct_id - skipping api call."),this.identify(ue),-1)):void 0}},{key:"set_config",value:function(ue){var eo,no,ro,oo,io=t$1({},this.config);b(ue)&&(J(this.config,ns(ue)),(eo=this.persistence)===null||eo===void 0||eo.update_config(this.config,io),this.sessionPersistence=this.config.persistence==="sessionStorage"?this.persistence:new bn(t$1(t$1({},this.config),{},{persistence:"sessionStorage"})),at.is_supported()&&at.get("ph_debug")==="true"&&(this.config.debug=!0),this.config.debug&&(f.DEBUG=!0,G.info("set_config",{config:ue,oldConfig:io,newConfig:t$1({},this.config)})),(no=this.sessionRecording)===null||no===void 0||no.startIfEnabledOrStop(),(ro=this.autocapture)===null||ro===void 0||ro.startIfEnabled(),(oo=this.heatmaps)===null||oo===void 0||oo.startIfEnabled(),this.surveys.loadIfEnabled(),this._sync_opt_out_with_persistence())}},{key:"startSessionRecording",value:function(ue){var eo,no=x$1(ue)&&ue;if(no||ue!=null&&ue.sampling){var ro,oo,io=(ro=this.sessionManager)===null||ro===void 0?void 0:ro.checkAndGetSessionAndWindowId();(oo=this.persistence)===null||oo===void 0||oo.register(o({},Ee,!0)),G.info("Session recording started with sampling override for session: ",io==null?void 0:io.sessionId)}(no||ue!=null&&ue.linked_flag)&&((eo=this.sessionRecording)===null||eo===void 0||eo.overrideLinkedFlag(),G.info("Session recording started with linked_flags override")),this.set_config({disable_session_recording:!1})}},{key:"stopSessionRecording",value:function(){this.set_config({disable_session_recording:!0})}},{key:"sessionRecordingStarted",value:function(){var ue;return!((ue=this.sessionRecording)===null||ue===void 0||!ue.started)}},{key:"captureException",value:function(ue,eo){var no=y(U.parseErrorAsProperties)?U.parseErrorAsProperties([ue.message,void 0,void 0,void 0,ue]):t$1({$exception_type:ue.name,$exception_message:ue.message,$exception_level:"error"},eo);this.exceptions.sendExceptionEvent(no)}},{key:"loadToolbar",value:function(ue){return this.toolbar.loadToolbar(ue)}},{key:"get_property",value:function(ue){var eo;return(eo=this.persistence)===null||eo===void 0?void 0:eo.props[ue]}},{key:"getSessionProperty",value:function(ue){var eo;return(eo=this.sessionPersistence)===null||eo===void 0?void 0:eo.props[ue]}},{key:"toString",value:function(){var ue,eo=(ue=this.config.name)!==null&&ue!==void 0?ue:Zr;return eo!==Zr&&(eo=Zr+"."+eo),eo}},{key:"_isIdentified",value:function(){var ue,eo;return((ue=this.persistence)===null||ue===void 0?void 0:ue.get_property($e))==="identified"||((eo=this.sessionPersistence)===null||eo===void 0?void 0:eo.get_property($e))==="identified"}},{key:"_hasPersonProcessing",value:function(){var ue,eo,no,ro;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&k(this.getGroups())&&((ue=this.persistence)===null||ue===void 0||(eo=ue.props)===null||eo===void 0||!eo[ce])&&((no=this.persistence)===null||no===void 0||(ro=no.props)===null||ro===void 0||!ro[qe]))}},{key:"_shouldCapturePageleave",value:function(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&this.config.capture_pageview}},{key:"createPersonProfile",value:function(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}},{key:"_requirePersonProcessing",value:function(ue){return this.config.person_profiles==="never"?(G.error(ue+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(qe,!0),!0)}},{key:"_sync_opt_out_with_persistence",value:function(){var ue,eo,no,ro,oo=this.consent.isOptedOut(),io=this.config.opt_out_persistence_by_default,ao=this.config.disable_persistence||oo&&!!io;((ue=this.persistence)===null||ue===void 0?void 0:ue.disabled)!==ao&&((no=this.persistence)===null||no===void 0||no.set_disabled(ao)),((eo=this.sessionPersistence)===null||eo===void 0?void 0:eo.disabled)!==ao&&((ro=this.sessionPersistence)===null||ro===void 0||ro.set_disabled(ao))}},{key:"opt_in_capturing",value:function(ue){var eo;this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),(w$1(ue==null?void 0:ue.captureEventName)||ue!=null&&ue.captureEventName)&&this.capture((eo=ue==null?void 0:ue.captureEventName)!==null&&eo!==void 0?eo:"$opt_in",ue==null?void 0:ue.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._captureInitialPageview()}},{key:"opt_out_capturing",value:function(){this.consent.optInOut(!1),this._sync_opt_out_with_persistence()}},{key:"has_opted_in_capturing",value:function(){return this.consent.isOptedIn()}},{key:"has_opted_out_capturing",value:function(){return this.consent.isOptedOut()}},{key:"clear_opt_in_out_capturing",value:function(){this.consent.reset(),this._sync_opt_out_with_persistence()}},{key:"_is_bot",value:function(){return A?function(ue,eo){if(!ue)return!1;var no=ue.userAgent;if(no&&Or(no,eo))return!0;try{var ro=ue==null?void 0:ue.userAgentData;if(ro!=null&&ro.brands&&ro.brands.some(function(oo){return Or(oo==null?void 0:oo.brand,eo)}))return!0}catch{}return!!ue.webdriver}(A,this.config.custom_blocked_useragents):void 0}},{key:"_captureInitialPageview",value:function(){L&&!this._initialPageviewCaptured&&(this._initialPageviewCaptured=!0,this.capture("$pageview",{title:L.title},{send_instantly:!0}))}},{key:"debug",value:function(ue){ue===!1?(T==null||T.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(T==null||T.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),localStorage&&localStorage.setItem("ph_debug","true"),this.set_config({debug:!0}))}}]),to}();(function(to,ue){for(var eo=0;eo<ue.length;eo++)to.prototype[ue[eo]]=ee(to.prototype[ue[eo]])})(rs,["identify"]);var ss,os=(ss=Xr[Zr]=new rs,function(){function to(){to.done||(to.done=!0,es=!1,Q(Xr,function(ue){ue._dom_loaded()}))}L!=null&&L.addEventListener&&(L.readyState==="complete"?to():L.addEventListener("DOMContentLoaded",to,!1)),T&&oe(T,"load",to,!0)}(),ss);const Events={COMPONENT_CREATED:"component:created",COMPONENT_UPDATED:"component:updated",APP_VIEW_PUBLISHED:"app:view_published",BLOCK_EJECTED:"block:ejected"},EventSource$1={PORTAL:"portal",URL:"url",NOTIFICATION:"notification"};class PosthogClient{constructor(ue){this.token=ue}init(){this.token&&(os.init(this.token,{autocapture:!1,capture_pageview:!1}),os.set_config({persistence:"cookie"}),this.initialised=!0)}identify(ue){this.initialised&&os.identify(ue)}updateUser(ue){this.initialised&&os.people.set(ue)}captureEvent(ue,eo){this.initialised&&(eo.sourceApp="builder",os.capture(ue,eo))}npsFeedback(ue){if(!this.initialised)return;localStorage.setItem(Events.NPS.SUBMITTED,Date.now());const eo={};for(let no in ue)eo[`feedback_${no}`]=ue[no];os.capture(Events.NPS.SUBMITTED,eo)}logout(){this.initialised&&os.reset()}}const posthog=new PosthogClient(void 0);class AnalyticsHub{constructor(){this.clients=[posthog],this.initialised=!1}async activate(){(await API.getAnalyticsStatus()).enabled&&!this.initialised&&(this.clients.forEach(eo=>{eo.init()}),this.initialised=!0)}identify(ue){posthog.identify(ue)}captureException(ue){}captureEvent(ue,eo={}){posthog.captureEvent(ue,eo)}async logout(){posthog.logout()}}const analytics=new AnalyticsHub,capitalise=to=>to&&to.substring(0,1).toUpperCase()+to.substring(1),lowercase=to=>to.substring(0,1).toLowerCase()+to.substring(1),isBuilderInputFocused=to=>{var no,ro,oo;const ue=(no=document.activeElement)==null?void 0:no.tagName.toLowerCase();return!!((((oo=(ro=document.activeElement)==null?void 0:ro.classList)==null?void 0:oo.contains("cm-content"))||["input","textarea"].indexOf(ue)!==-1)&&to.key!=="Escape")},{ContextScopes:ContextScopes$1}=Constants$1,findComponent=(to,ue)=>searchComponentTree(to,eo=>eo._id===ue),findComponentParent=(to,ue,eo)=>{if(!to||!ue)return null;if(to._id===ue)return eo;if(!to._children)return null;for(const no of to._children){const ro=findComponentParent(no,ue,to);if(ro)return ro}return null},findComponentPath=(to,ue,eo=[])=>{if(!to||!ue)return[];if(to._id===ue)return[...eo,to];if(!to._children)return[];for(const no of to._children){const ro=[...eo,to],oo=findComponentPath(no,ue,ro);if(oo!=null&&oo.length)return oo}return[]},findAllMatchingComponents=(to,ue)=>{if(!to||!ue)return[];let eo=[];return to._children&&to._children.forEach(no=>{eo=[...eo,...findAllMatchingComponents(no,ue)]}),ue(to)&&eo.push(to),eo.reverse()},findAllComponents=to=>findAllMatchingComponents(to,()=>!0),findClosestMatchingComponent=(to,ue,eo)=>{if(!eo)return null;const no=findComponentPath(to,ue).reverse();for(let ro of no)if(eo(ro))return ro;return null},searchComponentTree=(to,ue)=>{if(!to||!ue)return null;if(ue(to))return to;if(!to._children)return null;for(const eo of to._children){const no=searchComponentTree(eo,ue);if(no)return no}return null},makeComponentUnique=to=>{if(!to)return;const ue=[],eo=(oo,io)=>{var lo;const ao=oo._id,so=uuid$1();io.push([ao,so]),(lo=oo._children)==null||lo.forEach(co=>eo(co,io))};eo(to,ue);let no=JSON.stringify(to);return ue.forEach(([oo,io])=>{no=no.replace(new RegExp(oo,"g"),io)}),findHBSBlocks(no).forEach(oo=>{let io=oo.replace(/\\"/g,'"'),ao=decodeJSBinding(io);if(ao!=null){ue.forEach(([lo,co])=>{ao=ao.replace(new RegExp(lo,"g"),co)});let so=encodeJSBinding(ao);so=so.replace(/"/g,'\\"'),no=no.replace(oo,so)}}),JSON.parse(no)},getComponentText=to=>{var eo;if(to==null)return"";if(to!=null&&to._instanceName)return to._instanceName;const ue=((eo=to._component)==null?void 0:eo.replace("@budibase/standard-components/",""))||"component";return capitalise(ue)},getComponentName=to=>{var no;if(to==null)return"";const eo=(((no=get_store_value(componentStore))==null?void 0:no.components)||{})[to._component]||{};return eo.friendlyName||eo.name||""},getComponentContexts=to=>{const ue=componentStore.getDefinition(to);let eo=[];return ue!=null&&ue.context&&(eo=Array.isArray(ue.context)?[...ue.context]:[ue.context]),ue!=null&&ue.actions&&eo.push({type:"action",scope:ContextScopes$1.Global,actions:ue.actions.map(no=>typeof no=="string"?{type:no}:no)}),eo},buildContextTree=(to,ue={root:[]},eo="root")=>{if(!to)return ue;const no=getComponentContexts(to._component);return no.length&&(ue[eo].push(to._id),no.some(ro=>ro.scope===ContextScopes$1.Local)&&(eo=to._id,ue[to._id]=[])),to._children&&to._children.forEach(ro=>{buildContextTree(ro,ue,eo)}),ue},buildContextTreeLookupMap=to=>{const ue=buildContextTree(to);let eo={};return Object.entries(ue).forEach(([no,ro])=>{ro.forEach(oo=>{eo[oo]=no})}),eo},getChildIdsForComponent=to=>[to._id,...((to==null?void 0:to._children)??[]).map(getChildIdsForComponent).flat(1)],TableNames={USERS:"ta_users"},AppStatus={ALL:"all",DEV:"development",DEPLOYED:"published"},IntegrationNames={POSTGRES:"PostgreSQL",MONGODB:"MongoDB",COUCHDB:"CouchDB",S3:"S3",MYSQL:"MySQL",REST:"REST",DYNAMODB:"DynamoDB",ELASTICSEARCH:"ElasticSearch",SQL_SERVER:"SQL Server",AIRTABLE:"Airtable",ARANGODB:"ArangoDB",ORACLE:"Oracle",GOOGLE_SHEETS:"Google Sheets"},UNEDITABLE_USER_FIELDS=["email","password","roleId","status","firstName","lastName"],APP_NAME_REGEX=/^[\w\s]+$/,APP_URL_REGEX=/^[0-9a-zA-Z-_]+$/,DefaultAppTheme={primaryColor:"var(--spectrum-global-color-blue-600)",primaryColorHover:"var(--spectrum-global-color-blue-500)",buttonBorderRadius:"16px",navBackground:"var(--spectrum-global-color-gray-50)",navTextColor:"var(--spectrum-global-color-gray-800)"},PluginSource={URL:"URL",NPM:"NPM",GITHUB:"Github",FILE:"File Upload"},OnboardingType={EMAIL:"email",PASSWORD:"password"},PlanModel={PER_USER:"perUser"},ChangelogURL="https://docs.budibase.com/changelog",AutoScreenTypes={BLANK:"blank",TABLE:"table",FORM:"form"},actions=[{name:"Save Row",type:"data",component:"SaveRow",context:[{label:"Saved row",value:"row"}]},{name:"Duplicate Row",type:"data",component:"DuplicateRow",context:[{label:"Duplicated row",value:"row"}]},{name:"Delete Row",displayName:"Delete Rows",type:"data",component:"DeleteRow"},{name:"Fetch Row",type:"data",component:"FetchRow",context:[{label:"Fetched row",value:"row"}]},{name:"Navigate To",type:"application",component:"NavigateTo"},{name:"Execute Query",type:"data",component:"ExecuteQuery",context:[{label:"Query result",value:"result"}]},{name:"Trigger Automation",type:"application",component:"TriggerAutomation",context:[{label:"Automation Result",value:"result"}]},{name:"Update Field Value",type:"form",component:"UpdateFieldValue"},{name:"Scroll To Field",type:"form",component:"ScrollTo"},{name:"Validate Form",type:"form",component:"ValidateForm"},{name:"Change Form Step",type:"form",component:"ChangeFormStep"},{name:"Clear Form",type:"form",component:"ClearForm"},{name:"Log Out",type:"application",component:"LogOut"},{name:"Close Screen Modal",type:"application",component:"CloseScreenModal"},{name:"Refresh Data Provider",type:"data",component:"RefreshDataProvider"},{name:"Update State",type:"data",component:"UpdateState",dependsOnFeature:"state"},{name:"Upload File to S3",type:"data",component:"S3Upload",context:[{label:"File URL",value:"publicUrl"}]},{name:"Export Data",type:"data",component:"ExportData"},{name:"Continue if / Stop if",type:"logic",component:"ContinueIf",dependsOnFeature:"continueIfAction"},{name:"Show Notification",type:"application",component:"ShowNotification",dependsOnFeature:"showNotificationAction"},{name:"Prompt User",type:"application",component:"PromptUser"},{name:"Open Side Panel",type:"application",component:"OpenSidePanel",dependsOnFeature:"sidePanel"},{name:"Close Side Panel",type:"application",component:"CloseSidePanel",dependsOnFeature:"sidePanel"},{name:"Open Modal",type:"application",component:"OpenModal",dependsOnFeature:"modal"},{name:"Close Modal",type:"application",component:"CloseModal",dependsOnFeature:"modal"},{name:"Clear Row Selection",type:"data",component:"ClearRowSelection"},{name:"Download File",type:"data",component:"DownloadFile"},{name:"Row Action",type:"data",component:"RowAction"}],ActionDefinitions={actions},DEFAULT_STATE={platformUrl:"",emailBrandingEnabled:!0,testimonialsEnabled:!0,platformTitle:"Budibase",company:"Budibase",google:!1,googleDatasourceConfigured:!1,oidc:!1,oidcCallbackUrl:"",googleCallbackUrl:"",loaded:!1};class OrganisationStore extends BudiStore{constructor(){super(DEFAULT_STATE)}async init(){const ue=get_store_value(auth).tenantId,eo=await API.getTenantConfig(ue);this.set({...DEFAULT_STATE,...eo.config,loaded:!0})}async save(ue){const{oidc:eo,google:no,googleDatasourceConfigured:ro,oidcCallbackUrl:oo,googleCallbackUrl:io,loaded:ao,...so}=get_store_value(this.store),lo={...so,...ue};await API.saveConfig({type:ConfigType.SETTINGS,config:lo}),await this.init()}}const organisation=new OrganisationStore;let UserStore$1=class extends BudiStore{constructor(){super({data:[]})}async search(ue={}){const eo=await API.searchUsers(ue);return this.set({...eo,...ue}),eo}async get(ue){try{return await API.getUser(ue)}catch{return null}}async fetch(){return await API.getUsers()}async onboard(ue){return await API.onboardUsers(ue)}async invite(ue){const eo=ue.map(no=>{let ro;return no.admin||no.builder?ro={global:!0}:no.creator&&(ro={creator:!0}),{email:no.email,userInfo:{admin:no.admin?{global:!0}:void 0,builder:ro,userGroups:no.groups,roles:no.apps?no.apps:void 0}}});return API.inviteUsers(eo)}async removeInvites(ue){return API.removeUserInvites(ue)}async acceptInvite(ue,eo,no,ro){return API.acceptInvite({inviteCode:ue,password:eo,firstName:no,lastName:ro!=null&&ro.trim()?ro:void 0})}async fetchInvite(ue){return API.getUserInvite(ue)}async getInvites(){return API.getUserInvites()}async updateInvite(ue,eo){return API.updateUserInvite(ue,eo)}async getUserCountByApp(ue){return await API.getUserCountByApp(ue)}async create(ue){let eo=ue.users.map(ro=>{const oo={email:ro.email,password:ro.password,roles:{}};switch(ro.forceResetPassword&&(oo.forceResetPassword=ro.forceResetPassword),ro.role){case BudibaseRoles.AppUser:oo.builder={global:!1},oo.admin={global:!1};break;case BudibaseRoles.Developer:oo.builder={global:!0};break;case BudibaseRoles.Creator:oo.builder={creator:!0,global:!1};break;case BudibaseRoles.Admin:oo.admin={global:!0},oo.builder={global:!0};break}return oo});const no=await API.createUsers(eo,ue.groups);return licensing.setQuotaUsage(),await this.search(),no}async delete(ue){await API.deleteUser(ue),licensing.setQuotaUsage()}async bulkDelete(ue){const eo=API.deleteUsers(ue);return licensing.setQuotaUsage(),eo}async save(ue){const eo=await API.saveUser(ue);return licensing.setQuotaUsage(),eo}async addAppBuilder(ue,eo){return await API.addAppBuilder(ue,eo)}async removeAppBuilder(ue,eo){return await API.removeAppBuilder(ue,eo)}async getAccountHolder(){return await API.getAccountHolder()}getUserRole(ue){return ue?ue.email===ue.tenantOwnerEmail?BudibaseRoles.Owner:isAdmin(ue)?BudibaseRoles.Admin:isBuilder(ue)?BudibaseRoles.Developer:hasCreatorPermissions(ue)?BudibaseRoles.Creator:BudibaseRoles.AppUser:BudibaseRoles.AppUser}};const users=new UserStore$1;function createAdminStore(){const to=writable({loaded:!1,multiTenancy:!1,cloud:!1,isDev:!1,disableAccountPortal:!1,offlineMode:!1,maintenance:[]});async function ue(){await oo(),await eo(),get_store_value(to).cloud&&(await ro(),no()),to.update(ao=>(ao.loaded=!0,ao))}async function eo(){const ao=await API.getEnvironment();to.update(so=>(so.multiTenancy=ao.multiTenancy,so.cloud=ao.cloud,so.disableAccountPortal=ao.disableAccountPortal,so.accountPortalUrl=ao.accountPortalUrl,so.isDev=ao.isDev,so.baseUrl=ao.baseUrl,so.offlineMode=ao.offlineMode,so.maintenance=ao.maintenance,so.passwordMinLength=ao.passwordMinLength,so))}const no=async()=>{var so,lo;const ao=(lo=(so=get_store_value(to))==null?void 0:so.status)==null?void 0:lo.health;ao!=null&&ao.passing||await banner.showStatus()};async function ro(){const ao=await API.getSystemStatus();to.update(so=>(so.status=ao,so))}async function oo(){const ao=get_store_value(auth).tenantId,so=await API.getChecklist(ao);to.update(lo=>(lo.checklist=so,lo))}function io(){to.update(ao=>(ao.loaded=!1,ao))}return{subscribe:to.subscribe,init:ue,unload:io,getChecklist:oo}}const admin=createAdminStore();class AuthStore extends BudiStore{constructor(){super({accountPortalAccess:!1,tenantId:"default",tenantSet:!1,loaded:!1,postLogout:!1,isSSO:!1})}setUser(ue){this.set({loaded:!0,user:ue,accountPortalAccess:!!(ue!=null&&ue.accountPortalAccess),tenantId:(ue==null?void 0:ue.tenantId)||"default",tenantSet:!!ue,isSSO:ue!=null&&isSSOUser(ue),postLogout:!1}),ue&&analytics.activate().then(()=>{analytics.identify(ue._id)}).catch(()=>{})}async setOrganisation(ue){const eo=get_store_value(this.store).tenantId;auth.update(no=>(no.tenantId=ue,no.tenantSet=!!ue,no)),eo!==ue&&await admin.init()}async setInitInfo(ue){return await API.setInitInfo(ue),auth.update(eo=>(eo.initInfo=ue,eo)),ue}setPostLogout(){auth.update(ue=>(ue.postLogout=!0,ue))}async getInitInfo(){const ue=await API.getInitInfo();return auth.update(eo=>(eo.initInfo=ue,eo)),ue}async checkQueryString(){const eo=new URLSearchParams(window.location.search).get("tenantId");eo&&await this.setOrganisation(eo)}async setOrg(ue){await this.setOrganisation(ue)}async getSelf(){try{const ue=await API.fetchBuilderSelf();this.setUser(ue)}catch{this.setUser()}}async login(ue,eo){const no=get_store_value(this.store).tenantId;await API.logIn(no,ue,eo),await this.getSelf()}async logout(){await API.logOut(),this.setPostLogout(),this.setUser(),await this.setInitInfo({})}async updateSelf(ue){await API.updateSelf(ue);try{const eo=await API.fetchBuilderSelf();this.setUser(eo)}catch{this.setUser()}}async forgotPassword(ue){const eo=get_store_value(this.store).tenantId;await API.requestForgotPassword(eo,ue)}async resetPassword(ue,eo){const no=get_store_value(this.store).tenantId;await API.resetPassword(no,ue,eo)}async generateAPIKey(){return API.generateAPIKey()}async fetchAPIKey(){const ue=await API.fetchDeveloperInfo();return ue==null?void 0:ue.apiKey}}const auth=new AuthStore;class AppsStore extends BudiStore{constructor(){super({apps:[]}),this.extractAppId=this.extractAppId.bind(this),this.getProdAppID=this.getProdAppID.bind(this),this.updateSort=this.updateSort.bind(this),this.load=this.load.bind(this),this.save=this.save.bind(this)}extractAppId(ue){const eo=(ue==null?void 0:ue.split("_"))||[];return eo.length?eo[eo.length-1]:null}getProdAppID(ue){if(!ue)return ue;let eo,no="";if(ue.startsWith("app_dev")){const ro=ue.split("app_dev");ro.shift(),eo=ro.join("app_dev")}else if(!ue.startsWith("app"))eo=ue,no="_";else return ue;return`app${no}${eo}`}async updateSort(ue){this.update(eo=>({...eo,sortBy:ue})),await this.updateUserSort(ue)}async updateUserSort(ue){try{await auth.updateSelf({appSort:ue})}catch(eo){console.error("couldn't save user sort: ",eo)}}async load(){const ue=await API.getApps();if(Array.isArray(ue)){let eo={},no=ue.filter(io=>io.status===AppStatus.DEV),ro=ue.filter(io=>io.status===AppStatus.DEPLOYED);no.forEach(io=>{const ao=this.extractAppId(io.appId);ao&&(eo[ao]={...io,devId:io.appId,devRev:io._rev})}),ro.forEach(io=>{const ao=this.extractAppId(io.appId);if(!ao||!eo[ao])return;let so={};eo[ao]&&(so={updatedBy:eo[ao].updatedBy,updatedAt:eo[ao].updatedAt}),eo[ao]={...eo[ao],...io,...so,prodId:io.appId,prodRev:io._rev}});const oo=Object.values(eo);oo.forEach(io=>{const ao=this.extractAppId(io.devId);ao&&(io.appId=ao),delete io._id,delete io._rev}),this.update(io=>({...io,apps:oo}))}else this.update(eo=>({...eo,apps:[]}))}async save(ue,eo){await API.saveAppMetadata(ue,eo),this.update(no=>{const ro=no.apps.findIndex(oo=>oo.instance._id===ue);if(ro!==-1){let oo=no.apps[ro];oo={...oo,...eo},no.apps.splice(ro,1,oo)}return no})}}const appsStore=new AppsStore,sortBy=derived([appsStore,auth],([to,ue])=>{var eo;return to.sortBy||((eo=ue.user)==null?void 0:eo.appSort)||"name"}),enrichedApps=derived([appsStore,auth,sortBy],([to,ue,eo])=>{const no=to.apps.map(ro=>{var io;const oo=ue.user;return{...ro,deployed:ro.status===AppStatus.DEPLOYED,lockedYou:ro.lockedBy!=null&&ro.lockedBy.email===(oo==null?void 0:oo.email),lockedOther:ro.lockedBy!=null&&ro.lockedBy.email!==(oo==null?void 0:oo.email),favourite:!!((io=oo==null?void 0:oo.appFavourites)!=null&&io.includes(ro.appId))}});return eo==="status"?no.sort((ro,oo)=>{var io,ao;return ro.favourite===oo.favourite?ro.status===oo.status?((io=ro.name)==null?void 0:io.toLowerCase())<((ao=oo.name)==null?void 0:ao.toLowerCase())?-1:1:ro.status===AppStatus.DEPLOYED?-1:1:ro.favourite?-1:1}):eo==="updated"?no==null?void 0:no.sort((ro,oo)=>{if(ro.favourite===oo.favourite){const io=ro.updatedAt||"9999",ao=oo.updatedAt||"9999";return io<ao?1:-1}return ro.favourite?-1:1}):no==null?void 0:no.sort((ro,oo)=>{var io,ao;return ro.favourite===oo.favourite?((io=ro.name)==null?void 0:io.toLowerCase())<((ao=oo.name)==null?void 0:ao.toLowerCase())?-1:1:ro.favourite?-1:1})});class EmailStore extends BudiStore{constructor(){super({templates:[]})}async fetchTemplates(){const ue=await API.getEmailTemplateDefinitions(),eo=await API.getEmailTemplates();this.set({definitions:ue,templates:eo})}async saveTemplate(ue){const eo=await API.saveEmailTemplate(ue);ue._rev=eo._rev,ue._id=eo._id,this.update(no=>{const ro=no.templates.findIndex(oo=>oo.purpose===eo.purpose);return no.templates.splice(ro,1,ue),no})}}const email=new EmailStore;class OIDCStore extends BudiStore{constructor(){super({})}async init(){const ue=get_store_value(auth).tenantId,eo=await API.getOIDCConfigs(ue);this.set(eo[0]||{})}}const oidc=new OIDCStore;function templatesStore(){const{subscribe:to,set:ue}=writable([]);return{subscribe:to,load:async()=>{const eo=await API.getAppTemplates();ue(eo)}}}const templates=templatesStore(),ExpiringKeys={LICENSING_PAYMENT_FAILED:"licensing_payment_failed",LICENSING_ACCOUNT_DOWNGRADED_MODAL:"licensing_account_downgraded_modal",LICENSING_APP_LIMIT_MODAL:"licensing_app_limit_modal",LICENSING_ROWS_WARNING_BANNER:"licensing_rows_warning_banner",LICENSING_AUTOMATIONS_WARNING_BANNER:"licensing_automations_warning_banner",LICENSING_QUERIES_WARNING_BANNER:"licensing_queries_warning_banner",LICENSING_USERS_ABOVE_LIMIT_BANNER:"licensing_users_above_limit_banner"},StripeStatus={PAST_DUE:"past_due",ACTIVE:"active"},UNLIMITED=-1,ONE_DAY_MILLIS=864e5;class LicensingStore extends BudiStore{constructor(){super({goToUpgradePage:()=>{},goToPricingPage:()=>{},license:void 0,isFreePlan:!0,isEnterprisePlan:!0,isBusinessPlan:!0,groupsEnabled:!1,backupsEnabled:!1,brandingEnabled:!1,scimEnabled:!1,environmentVariablesEnabled:!1,budibaseAIEnabled:!1,customAIConfigsEnabled:!1,auditLogsEnabled:!1,quotaUsage:void 0,usageMetrics:void 0,quotaResetDaysRemaining:void 0,quotaResetDate:void 0,accountPastDue:!1,pastDueEndDate:void 0,pastDueDaysRemaining:void 0,accountDowngraded:!1,userCount:void 0,userLimit:void 0,userLimitReached:!1,errUserLimit:!1})}usersLimitReached(ue,eo=get_store_value(this.store).userLimit){return eo===UNLIMITED||eo===void 0?!1:ue>=eo}usersLimitExceeded(ue,eo=get_store_value(this.store).userLimit){return eo===UNLIMITED||eo===void 0?!1:ue>eo}async isCloud(){let ue=get_store_value(admin);return ue.loaded||(await admin.init(),ue=get_store_value(admin)),ue.cloud}async init(){this.setNavigation(),this.setLicense(),await this.setQuotaUsage()}setNavigation(){var io;const ue=get_store_value(admin),eo=get_store_value(auth),no=(io=eo==null?void 0:eo.user)!=null&&io.accountPortalAccess?`${ue.accountPortalUrl}/portal/upgrade`:"/builder/portal/account/upgrade",ro=()=>{window.location.href=no},oo=()=>{window.open("https://budibase.com/pricing/","_blank")};this.update(ao=>({...ao,goToUpgradePage:ro,goToPricingPage:oo}))}setLicense(){var wo;const ue=(wo=get_store_value(auth).user)==null?void 0:wo.license,eo=ue==null?void 0:ue.plan.type,no=(ue==null?void 0:ue.features)||[],ro=eo===PlanType.ENTERPRISE,oo=eo===PlanType.FREE,io=eo===PlanType.BUSINESS,ao=eo===PlanType.ENTERPRISE_BASIC_TRIAL,so=no.includes(Feature.USER_GROUPS),lo=no.includes(Feature.APP_BACKUPS),co=no.includes(Feature.SCIM),uo=no.includes(Feature.ENVIRONMENT_VARIABLES),fo=no.includes(Feature.ENFORCEABLE_SSO),po=no.includes(Feature.BRANDING),ho=no.includes(Feature.AUDIT_LOGS),_o=no.includes(Feature.SYNC_AUTOMATIONS),go=no.includes(Feature.TRIGGER_AUTOMATION_RUN),bo=no.includes(Feature.APP_BUILDERS),vo=no.includes(Feature.BUDIBASE_AI),yo=no.includes(Feature.AI_CUSTOM_CONFIGS);this.update(ko=>({...ko,license:ue,isEnterprisePlan:ro,isFreePlan:oo,isBusinessPlan:io,isEnterpriseTrial:ao,groupsEnabled:so,backupsEnabled:lo,brandingEnabled:po,budibaseAIEnabled:vo,customAIConfigsEnabled:yo,scimEnabled:co,environmentVariablesEnabled:uo,auditLogsEnabled:ho,enforceableSSO:fo,syncAutomationsEnabled:_o,triggerAutomationRunEnabled:go,perAppBuildersEnabled:bo}))}async setQuotaUsage(){const ue=await API.getQuotaUsage();this.update(eo=>({...eo,quotaUsage:ue})),await this.setUsageMetrics()}async setUsageMetrics(){var ko,So,Eo,Io,Ao,To,Mo,Vo,Fo,Po,Ro;const ue=get_store_value(this.store).quotaUsage,eo=(ko=get_store_value(auth).user)==null?void 0:ko.license,no=new Date;if(!eo||!ue)return;const ro=[MonthlyQuotaName.QUERIES,MonthlyQuotaName.AUTOMATIONS].reduce((Do,qo)=>{var Zo;const Uo=eo.quotas.usage.monthly[qo].value,jo=(((Zo=ue.monthly.current)==null?void 0:Zo[qo])||0)/Uo*100;return Do[qo]=Uo>-1?Math.floor(jo):-1,Do},{}),oo=[StaticQuotaName.APPS,StaticQuotaName.ROWS].reduce((Do,qo)=>{const Uo=eo.quotas.usage.static[qo].value,jo=(ue.usageQuota[qo]||0)/Uo*100;return Do[qo]=Uo>-1?Math.floor(jo):-1,Do},{}),io=(Do,qo)=>qo>Do?Math.round((qo.getTime()-Do.getTime())/ONE_DAY_MILLIS):0,ao=new Date(ue.quotaReset),so=io(no,ao),lo=!!((Eo=(So=eo.billing)==null?void 0:So.subscription)!=null&&Eo.downgradeAt)&&((Ao=(Io=eo.billing)==null?void 0:Io.subscription)==null?void 0:Ao.downgradeAt)<=no.getTime()&&((Mo=(To=eo.billing)==null?void 0:To.subscription)==null?void 0:Mo.status)===StripeStatus.PAST_DUE&&eo.plan.type===PlanType.FREE,co=(Fo=(Vo=eo.billing)==null?void 0:Vo.subscription)==null?void 0:Fo.pastDueAt,uo=(Ro=(Po=eo.billing)==null?void 0:Po.subscription)==null?void 0:Ro.downgradeAt;let fo,po;co&&uo&&(po=new Date(uo),fo=io(new Date(co),po));const _o=eo.quotas.usage.static.users.value,go=ue.usageQuota.users,bo=this.usersLimitReached(go,_o),vo=this.usersLimitExceeded(go,_o),wo=await this.isCloud()&&eo.plan.model===PlanModel$1.PER_USER&&vo;this.update(Do=>({...Do,usageMetrics:{...ro,...oo},quotaResetDaysRemaining:so,quotaResetDate:ao,accountDowngraded:lo,accountPastDue:co!=null,pastDueEndDate:po,pastDueDaysRemaining:fo,userCount:go,userLimit:_o,userLimitReached:bo,errUserLimit:wo}))}}const licensing=new LicensingStore;class GroupStore extends BudiStore{constructor(){super([]),this.updateStore=ue=>{this.update(eo=>{const no=eo.findIndex(ro=>ro._id===ue._id);return no>=0?eo.splice(no,1,ue):eo.push(ue),eo})}}async init(){if(get_store_value(licensing).groupsEnabled){const ue=await API.getGroups();this.set(ue)}}async refreshGroup(ue){const eo=await API.getGroup(ue);this.updateStore(eo)}async save(ue){const{...eo}=ue;delete eo.scimInfo;const no=await API.saveGroup(eo);return ue._id=no._id,ue._rev=no._rev,this.updateStore(ue),ue}async delete(ue){await API.deleteGroup(ue._id,ue._rev),this.update(eo=>{const no=eo.findIndex(ro=>ro._id===ue._id);return no!==-1&&eo.splice(no,1),eo})}async addUser(ue,eo){await API.addUsersToGroup(ue,[eo]),await this.refreshGroup(ue)}async removeUser(ue,eo){await API.removeUsersFromGroup(ue,[eo]),await this.refreshGroup(ue)}async addApp(ue,eo,no){await API.addAppsToGroup(ue,[{appId:eo,roleId:no}]),await this.refreshGroup(ue)}async removeApp(ue,eo){await API.removeAppsFromGroup(ue,[{appId:eo}]),await this.refreshGroup(ue)}getGroupAppIds(ue){var no;let eo=Object.keys((ue==null?void 0:ue.roles)||{});return(no=ue==null?void 0:ue.builder)!=null&&no.apps&&(eo=eo.concat(ue.builder.apps)),eo}async addGroupAppBuilder(ue,eo){return await API.addGroupAppBuilder(ue,eo)}async removeGroupAppBuilder(ue,eo){return await API.removeGroupAppBuilder(ue,eo)}}const groups=new GroupStore;function createPluginsStore(){const{subscribe:to,set:ue,update:eo}=writable([]);async function no(){const ao=await API.getPlugins();ue(ao)}async function ro(ao){await API.deletePlugin(ao),eo(so=>(so=so.filter(lo=>lo._id!==ao),so))}async function oo(ao,so,lo=null){let co={source:ao,url:so};switch(ao){case PluginSource.URL:co.headers=lo;break;case PluginSource.GITHUB:co.githubToken=lo;break}let fo=(await API.createPlugin(co)).plugin;eo(po=>{const ho=po.findIndex(_o=>_o._id===fo._id);return ho>=0?po.splice(ho,1,fo):po.push(fo),po})}async function io(ao){if(!ao)return;let so=new FormData;so.append("file",ao);let co=(await API.uploadPlugin(so)).plugins[0];eo(uo=>{const fo=uo.findIndex(po=>po._id===co._id);return fo>=0?uo.splice(fo,1,co):uo.push(co),uo})}return{subscribe:to,load:no,createPlugin:oo,deletePlugin:ro,uploadPlugin:io}}const plugins$1=createPluginsStore();class BackupStore extends BudiStore{constructor(){super({})}selectBackup(ue){this.update(eo=>(eo.selectedBackup=ue,eo))}async searchBackups(ue,eo){return API.searchBackups(ue,eo)}async restoreBackup(ue,eo,no){return API.restoreBackup(ue,eo,no)}async deleteBackup(ue,eo){return API.deleteBackup(ue,eo)}async createManualBackup(ue){return API.createManualBackup(ue)}}const backups=new BackupStore;class EnvironmentStore extends BudiStore{constructor(){super({variables:[],status:{encryptionKeyAvailable:!1}})}async checkStatus(){const ue=await API.checkEnvironmentVariableStatus();this.update(eo=>(eo.status=ue,eo))}async loadVariables(){if(get_store_value(licensing).environmentVariablesEnabled){const eo=(await API.fetchEnvironmentVariables()).variables.map(no=>({name:no}));this.update(no=>(no.variables=eo,no))}}async createVariable(ue){await API.createEnvironmentVariable(ue);let eo={name:ue.name};this.update(no=>(no.variables=[eo,...no.variables],no))}async deleteVariable(ue){await API.deleteEnvironmentVariable(ue),this.update(eo=>(eo.variables=eo.variables.filter(no=>no.name!==ue),eo))}async updateVariable(ue,eo){await API.updateEnvironmentVariable(ue,eo)}async upgradePanelOpened(){await API.publishEvent(EventPublishType$1.ENVIRONMENT_VARIABLE_UPGRADE_PANEL_OPENED)}}const environment=new EnvironmentStore,menu=derived([admin,auth],([to,ue])=>{var lo;const eo=ue==null?void 0:ue.user,no=eo!=null&&isAdmin(eo),ro=eo!=null&&isGlobalBuilder(eo),oo=to==null?void 0:to.cloud;let io=[{title:"Users",href:"/builder/portal/users/users"}];io.push({title:"Groups",href:"/builder/portal/users/groups"});let ao=[{title:"Apps",href:"/builder/portal/apps"}];if(ro&&(ao.push({title:"Users",href:"/builder/portal/users",subPages:io}),ao.push({title:"Plugins",href:"/builder/portal/plugins"})),no){let co=[{title:"Auth",href:"/builder/portal/settings/auth"},{title:"Email",href:"/builder/portal/settings/email"},{title:"Organisation",href:"/builder/portal/settings/organisation"},{title:"Branding",href:"/builder/portal/settings/branding"},{title:"Environment",href:"/builder/portal/settings/environment"},{title:"AI",href:"/builder/portal/settings/ai"}];oo||(co.push({title:"Version",href:"/builder/portal/settings/version"}),co.push({title:"Diagnostics",href:"/builder/portal/settings/diagnostics"})),ao.push({title:"Settings",href:"/builder/portal/settings",subPages:[...co].sort((uo,fo)=>uo.title.localeCompare(fo.title))})}let so=[{title:"Usage",href:"/builder/portal/account/usage"}];return no&&(so.push({title:"Audit Logs",href:"/builder/portal/account/auditLogs"}),oo||so.push({title:"System Logs",href:"/builder/portal/account/systemLogs"})),oo&&(eo!=null&&eo.accountPortalAccess)?so.push({title:"Upgrade",href:(to==null?void 0:to.accountPortalUrl)+"/portal/upgrade"}):!oo&&no&&so.push({title:"Upgrade",href:"/builder/portal/account/upgrade"}),eo!=null&&eo.accountPortalAccess&&((lo=eo==null?void 0:eo.account)!=null&&lo.stripeCustomerId)&&so.push({title:"Billing",href:(to==null?void 0:to.accountPortalUrl)+"/portal/billing"}),ao.push({title:"Account",href:"/builder/portal/account",subPages:so}),ao});class AuditLogsStore extends BudiStore{constructor(){super({})}async search(ue={}){if(get_store_value(licensing).auditLogsEnabled){const eo=await API.searchAuditLogs(ue);return this.update(no=>({...no,logs:eo})),eo}}async getEventDefinitions(){const ue=await API.getEventDefinitions();this.update(eo=>({...eo,events:ue.events}))}getDownloadUrl(ue={}){return API.getDownloadUrl(ue)}}const auditLogs=new AuditLogsStore;class FeatureStore extends DerivedBudiStore{constructor(){const ue=eo=>derived([eo,licensing],([no,ro])=>({isScimEnabled:no.scimConfigEnabled&&ro.scimEnabled}));super({scimConfigEnabled:!1},ue)}async init(){const ue=await API.getConfig(ConfigType.SCIM);this.update(eo=>({...eo,scimConfigEnabled:isConfig(ue)&&isSCIMConfig(ue)&&ue.config.enabled}))}}const features=new FeatureStore,getThemeStore=()=>{const to=document.documentElement,eo=createLocalStorageStore("bb-theme",{theme:DefaultBuilderTheme}),no=derived(eo,ro=>({...ro,theme:ensureValidTheme(ro.theme,DefaultBuilderTheme)}));return no.subscribe(({theme:ro})=>{const oo=getThemeClassNames(ro).split(" ");ThemeOptions.forEach(io=>{const ao=`${ThemeClassPrefix}${io.id}`;to.classList.toggle(ao,oo.includes(ao))})}),{...eo,subscribe:no.subscribe}},themeStore$1=getThemeStore(),createTemporalStore=()=>{const eo=createLocalStorageStore("bb-temporal",{}),no=(oo,io,ao)=>{const so={...io,expiry:Date.now()+ao*1e3};eo.update(lo=>({...lo,[oo]:so}))},ro=oo=>{const io=get_store_value(eo)[oo];return io?io.expiry<Date.now()?(eo.update(so=>(delete so[oo],so)),null):io:void 0};return{subscribe:eo.subscribe,actions:{setExpiring:no,getExpiring:ro}}},temporalStore=createTemporalStore();function createNavigationStore(){const to=writable({initialisated:!1,goto:void 0}),{set:ue,subscribe:eo}=to;return{subscribe:eo,actions:{init:ro=>{if(typeof ro!="function")throw new Error(`gotoFunc must be a function, found a "${typeof ro}" instead`);ue({initialisated:!0,goto:ro})}}}}const navigation=createNavigationStore(),featureFlags=derived(auth,to=>{var ue;return{...FeatureFlagDefaults,...((ue=to==null?void 0:to.user)==null?void 0:ue.flags)||{}}}),sideBarCollapsed=writable(!1),convertOldFieldFormat=to=>to?to.map(eo=>typeof eo=="string"?{field:eo,active:!0}:typeof(eo==null?void 0:eo.active)!="boolean"?{field:eo.name,active:!0}:eo):[],getComponentForField=(to,ue)=>{if(!to||!(ue!=null&&ue[to]))return null;const eo=ue[to].type;return FieldTypeToComponentMap[eo]},FieldTypeToComponentMap={[FieldType.STRING]:"stringfield",[FieldType.NUMBER]:"numberfield",[FieldType.BIGINT]:"bigintfield",[FieldType.OPTIONS]:"optionsfield",[FieldType.ARRAY]:"multifieldselect",[FieldType.BOOLEAN]:"booleanfield",[FieldType.LONGFORM]:"longformfield",[FieldType.DATETIME]:"datetimefield",[FieldType.SIGNATURE_SINGLE]:"signaturesinglefield",[FieldType.ATTACHMENTS]:"attachmentfield",[FieldType.ATTACHMENT_SINGLE]:"attachmentsinglefield",[FieldType.LINK]:"relationshipfield",[FieldType.JSON]:"jsonfield",[FieldType.BARCODEQR]:"codescanner",[FieldType.BB_REFERENCE]:"bbreferencefield",[FieldType.BB_REFERENCE_SINGLE]:"bbreferencesinglefield"},{TypeIconMap}=Constants$1,AUTO_COLUMN_SUB_TYPES=AutoFieldSubType,AUTO_COLUMN_DISPLAY_NAMES={AUTO_ID:"Auto ID",CREATED_BY:"Created By",CREATED_AT:"Created At",UPDATED_BY:"Updated By",UPDATED_AT:"Updated At"},FIELDS={STRING:{name:"Text",type:FieldType.STRING,icon:TypeIconMap[FieldType.STRING],constraints:{type:"string",length:{},presence:!1}},BARCODEQR:{name:"Barcode / QR",type:FieldType.BARCODEQR,icon:TypeIconMap[FieldType.BARCODEQR],constraints:{type:"string",length:{},presence:!1}},LONGFORM:{name:"Long form text",type:FieldType.LONGFORM,icon:TypeIconMap[FieldType.LONGFORM],constraints:{type:"string",length:{},presence:!1}},OPTIONS:{name:"Single select",type:FieldType.OPTIONS,icon:TypeIconMap[FieldType.OPTIONS],constraints:{type:"string",presence:!1,inclusion:[]}},ARRAY:{name:"Multi select",type:FieldType.ARRAY,icon:TypeIconMap[FieldType.ARRAY],constraints:{type:"array",presence:!1,inclusion:[]}},NUMBER:{name:"Number",type:FieldType.NUMBER,icon:TypeIconMap[FieldType.NUMBER],constraints:{type:"number",presence:!1,numericality:{greaterThanOrEqualTo:"",lessThanOrEqualTo:""}}},BIGINT:{name:"Big integer",type:FieldType.BIGINT,icon:TypeIconMap[FieldType.BIGINT]},BOOLEAN:{name:"Boolean",type:FieldType.BOOLEAN,icon:TypeIconMap[FieldType.BOOLEAN],constraints:{type:"boolean",presence:!1}},DATETIME:{name:"Date / time",type:FieldType.DATETIME,icon:TypeIconMap[FieldType.DATETIME],constraints:{type:"string",length:{},presence:!1,datetime:{latest:"",earliest:""}}},ATTACHMENT_SINGLE:{name:"Single attachment",type:FieldType.ATTACHMENT_SINGLE,icon:TypeIconMap[FieldType.ATTACHMENT_SINGLE],constraints:{presence:!1}},ATTACHMENTS:{name:"Multi attachment",type:FieldType.ATTACHMENTS,icon:TypeIconMap[FieldType.ATTACHMENTS],constraints:{type:"array",presence:!1}},SIGNATURE_SINGLE:{name:"Signature",type:FieldType.SIGNATURE_SINGLE,icon:"AnnotatePen",constraints:{presence:!1}},LINK:{name:"Relationship",type:FieldType.LINK,icon:TypeIconMap[FieldType.LINK],constraints:{type:"array",presence:!1}},AUTO:{name:"Auto column",type:FieldType.AUTO,icon:TypeIconMap[FieldType.AUTO],constraints:{}},FORMULA:{name:"Formula",type:FieldType.FORMULA,icon:TypeIconMap[FieldType.FORMULA],constraints:{}},AI:{name:"AI",type:FieldType.AI,icon:TypeIconMap[FieldType.AI],constraints:{}},JSON:{name:"JSON",type:FieldType.JSON,icon:TypeIconMap[FieldType.JSON],constraints:{type:"object",presence:!1}},USER:{name:"Single user",type:FieldType.BB_REFERENCE_SINGLE,subtype:BBReferenceFieldSubType.USER,icon:TypeIconMap[FieldType.BB_REFERENCE_SINGLE][BBReferenceFieldSubType.USER]},USERS:{name:"Multi user",type:FieldType.BB_REFERENCE,subtype:BBReferenceFieldSubType.USER,icon:TypeIconMap[FieldType.BB_REFERENCE][BBReferenceFieldSubType.USER],constraints:{type:"array"}}},Roles$1={ADMIN:"ADMIN",POWER:"POWER",BASIC:"BASIC",PUBLIC:"PUBLIC",BUILDER:"BUILDER"},PrettyRelationshipDefinitions={MANY:"Many rows",ONE:"One row"},BUDIBASE_INTERNAL_DB_ID=INTERNAL_TABLE_SOURCE_ID,DEFAULT_BB_DATASOURCE_ID="datasource_internal_bb_default",BUDIBASE_DATASOURCE_TYPE="budibase",DB_TYPE_INTERNAL="internal",DB_TYPE_EXTERNAL="external",IntegrationTypes={POSTGRES:"POSTGRES",MONGODB:"MONGODB",COUCHDB:"COUCHDB",S3:"S3",MYSQL:"MYSQL",REST:"REST",DYNAMODB:"DYNAMODB",ELASTICSEARCH:"ELASTICSEARCH",SQL_SERVER:"SQL_SERVER",AIRTABLE:"AIRTABLE",ARANGODB:"ARANGODB",ORACLE:"ORACLE",INTERNAL:"INTERNAL",GOOGLE_SHEETS:"GOOGLE_SHEETS",FIRESTORE:"FIRESTORE",REDIS:"REDIS",SNOWFLAKE:"SNOWFLAKE"},SchemaTypeOptions=[{label:"Text",value:FieldType.STRING},{label:"Number",value:FieldType.NUMBER},{label:"Boolean",value:FieldType.BOOLEAN},{label:"Datetime",value:FieldType.DATETIME},{label:"JSON",value:FieldType.JSON}],SchemaTypeOptionsExpanded=SchemaTypeOptions.map(to=>({...to,value:{type:to.value}})),RawRestBodyTypes={NONE:"none",FORM:"form",ENCODED:"encoded",JSON:"json",TEXT:"text",XML:"xml"},RestBodyTypes=[{name:"none",value:"none"},{name:"form-data",value:"form"},{name:"x-www-form-encoded",value:"encoded"},{name:"raw (JSON)",value:"json"},{name:"raw (XML)",value:"xml"},{name:"raw (Text)",value:"text"}],PaginationTypes=[{label:"Page number based",value:"page"},{label:"Cursor based",value:"cursor"}],PaginationLocations=[{label:"Query parameters",value:"query"},{label:"Request body",value:"body"}],DatasourceTypes={RELATIONAL:"Relational",NON_RELATIONAL:"Non-relational",SPREADSHEET:"Spreadsheet",OBJECT_STORE:"Object store",GRAPH:"Graph",API:"API"},{ContextScopes}=Constants$1,CAPTURE_VAR_INSIDE_TEMPLATE=/{{([^}]+)}}/g,CAPTURE_VAR_INSIDE_JS=/\$\("([^")]+)"\)/g,UpdateReferenceAction={ADD:"add",DELETE:"delete",MOVE:"move"},getBindableProperties=(to,ue)=>{const eo=getContextBindings(to,ue),no=getUserBindings(),ro=getUrlBindings(to),oo=getDeviceBindings(),io=getStateBindings(),ao=getSelectedRowsBindings(to),so=getRoleBindings(),lo=getEmbedBindings();return[...eo,...ro,...io,...no,...oo,...ao,...so,...lo]},getRestBindings=()=>{const to=get_store_value(licensing).environmentVariablesEnabled;return[...getUserBindings(),...getAuthBindings(),...to?getEnvironmentBindings():[]]},getAuthBindings=()=>{let to=[];const ue=makePropSafe("user"),eo=makePropSafe("oauth2"),no=makePropSafe("accessToken");return to=[{runtime:`${ue}.${eo}.${no}`,readable:"Current User.OAuthToken",key:"accessToken",display:{name:"OAuthToken",type:"text"}}].map(oo=>({type:"context",runtimeBinding:oo.runtime,readableBinding:oo.readable,fieldSchema:{type:"string",name:oo.key},providerId:"user",category:"Current User",display:oo.display})),to},getEnvironmentBindings=()=>get_store_value(environment).variables.map(ue=>({type:"context",runtimeBinding:`env.${makePropSafe(ue.name)}`,readableBinding:`env.${ue.name}`,category:"Environment",icon:"Key",display:{type:"string",name:ue.name}})),toBindingsArray=(to,ue,eo)=>to?Object.keys(to).reduce((no,ro)=>{if(!ro)return no;let oo={type:"context",runtimeBinding:ro,readableBinding:`${ue}.${ro}`,icon:"Brackets"};return eo&&(oo.category=eo),no.push(oo),no},[]):[],readableToRuntimeMap=(to,ue)=>!to||!ue?{}:Object.keys(ue).reduce((eo,no)=>(eo[no]=readableToRuntimeBinding(to,ue[no]),eo),{}),runtimeToReadableMap=(to,ue)=>!to||!ue?{}:Object.keys(ue).reduce((eo,no)=>(eo[no]=runtimeToReadableBinding(to,ue[no]),eo),{}),getComponentBindableProperties=(to,ue)=>{if(!to||!ue)return[];const eo=findComponent(to.props,ue),no=componentStore.getDefinition(eo==null?void 0:eo._component);if(!(no!=null&&no.context))return[];const ro=Array.isArray(no.context)?no.context:[no.context];return generateComponentContextBindings(to,{component:eo,definition:no,contexts:ro})},getAllComponentContexts=(to,ue,eo,no={includeSelf:!1})=>{if(!to||!ue)return[];let ro={};const oo=findComponentPath(to.props,ue),io=oo.map(co=>co._id),ao=buildContextTreeLookupMap(to.props),so=co=>uo=>{const fo=ao[uo._id];if(fo!=="root"&&!io.includes(fo))return;const po=uo._component;getComponentContexts(po).forEach(_o=>{eo&&_o.type!==eo||(_o.scope||ContextScopes.Global)!==co||isContextCompatibleWithComponent(_o,uo)&&(ro[uo._id]||(ro[uo._id]={component:uo,definition:componentStore.getDefinition(po),contexts:[]}),ro[uo._id].contexts.push(_o))})};return findAllComponents(to.props).forEach(so(ContextScopes.Global)),oo.forEach(so(ContextScopes.Local)),no!=null&&no.includeSelf||delete ro[ue],Object.values(ro).filter(co=>co.contexts.length>0)},getActionProviders=(to,ue,eo,no={includeSelf:!1})=>getAllComponentContexts(to,ue,"action",{includeSelf:no==null?void 0:no.includeSelf}).map(oo=>{var io,ao;return{...oo,action:(ao=(io=oo.contexts[0])==null?void 0:io.actions)==null?void 0:ao.find(so=>so.type===eo)}}).filter(({action:oo})=>oo!=null).map(({component:oo,action:io})=>{let ao=oo._id;return io.suffix&&(ao+=`-${io.suffix}`),{readableBinding:oo._instanceName,runtimeBinding:ao}}),getDatasourceForProvider=(to,ue)=>{const eo=componentStore.getComponentSettings(ue==null?void 0:ue._component),no=eo.find(ao=>ao.type==="dataProvider");if(no){const ao=ue[no.key],so=extractLiteralHandlebarsID(ao),lo=findComponent(to==null?void 0:to.props,so);return getDatasourceForProvider(to,lo)}const ro=["dataSource","table","schema"],oo=eo.find(ao=>ro.includes(ao.type));if(!oo)return null;const io=ue[oo==null?void 0:oo.key];return typeof io=="string"?{tableId:io,type:"table"}:io},getContextBindings=(to,ue)=>getAllComponentContexts(to,ue).map(no=>generateComponentContextBindings(to,no)).flat(),generateComponentContextBindings=(to,ue)=>{const{component:eo,definition:no,contexts:ro}=ue;if(!eo||!no||!(ro!=null&&ro.length))return[];let oo=[];return ro.forEach(io=>{var ho;if(!(io!=null&&io.type))return;let ao,so,lo,co=io.suffix;if(io.type==="form")ao=buildFormSchema(eo,to),lo="Fields";else if(io.type==="static")ao={},(io.values||[]).forEach(go=>{ao[go.key]={name:go.label,type:go.type||"string"}});else if(io.type==="schema"){const _o=getDatasourceForProvider(to,eo);if(!_o)return;const go=getSchemaForDatasource(to,_o);if(ao=go.schema,so=go.table,_o.type==="jsonarray"||_o.type==="queryarray"){const bo=_o.label.split(".");lo=bo[bo.length-1]}else if(_o.type==="viewV2"){const bo=Object.values((so==null?void 0:so.views)||{}).find(vo=>vo.id===_o.id);lo=bo==null?void 0:bo.name}else lo=(ho=go.table)==null?void 0:ho.name}if(!ao)return;const uo=Object.keys(ao).sort();let fo=eo._id;co&&(fo+=`-${co}`);const po=makePropSafe(fo);uo.forEach(_o=>{var ko;const go=ao[_o],bo=_o.split(".").map(makePropSafe).join("."),vo=`${po}.${bo}`;let yo=eo._instanceName;lo&&(yo+=`.${lo}`),yo+=`.${go.name||_o}`;const wo=getComponentBindingCategory(eo,io,no);oo.push({type:"context",runtimeBinding:vo,readableBinding:`${yo}`,fieldSchema:go,providerId:fo,tableId:so==null?void 0:so._id,component:eo._component,category:wo.category,icon:wo.icon,display:{name:`${go.name||_o}`,type:((ko=go.display)==null?void 0:ko.type)||go.type}})})}),oo},isContextCompatibleWithComponent=(to,ue)=>{if(!ue)return!1;const{_component:eo,actionType:no}=ue,{type:ro}=to;return!(eo.endsWith("formblock")&&(no==="Create"&&ro==="schema"||no==="View"&&ro==="form"))},getComponentBindingCategory=(to,ue,eo)=>{let no=eo.icon,ro=to._instanceName;return to._component.endsWith("formblock")&&(ue.type==="form"?(ro=`${to._instanceName} - Fields`,no="Form"):ue.type==="schema"&&(ro=`${to._instanceName} - Row`,no="Data")),{icon:no,category:ro}},getUserBindings=()=>{let to=[];const{schema:ue}=getSchemaForDatasourcePlus(TableNames.USERS);ue.globalId={type:FieldType.STRING};const eo=Object.keys(ue).sort(),no=makePropSafe("user");return to=eo.reduce((ro,oo)=>{const io=ue[oo];return ro.push({type:"context",runtimeBinding:`${no}.${makePropSafe(oo)}`,readableBinding:`Current User.${oo}`,fieldSchema:io,providerId:"user",category:"Current User",icon:"User",display:{name:oo}}),ro},[]),to},getDeviceBindings=()=>{var ue;let to=[];if((ue=get_store_value(appStore).clientFeatures)!=null&&ue.deviceAwareness){const eo=makePropSafe("device");to=[{type:"context",runtimeBinding:`${eo}.${makePropSafe("mobile")}`,readableBinding:"Device.Mobile",category:"Device",icon:"DevicePhone",display:{type:"boolean",name:"mobile"}},{type:"context",runtimeBinding:`${eo}.${makePropSafe("tablet")}`,readableBinding:"Device.Tablet",category:"Device",icon:"DevicePhone",display:{type:"boolean",name:"tablet"}},{type:"context",runtimeBinding:`${eo}.${makePropSafe("theme")}`,readableBinding:"App.Theme",category:"Device",icon:"DevicePhone",display:{type:"string",name:"App Theme"}}]}return to},getSettingBindings=()=>{let to=[];const ue=makePropSafe("settings");return to=[{type:"context",runtimeBinding:`${ue}.${makePropSafe("url")}`,readableBinding:"Settings.url",category:"Settings",icon:"Settings",display:{type:"string",name:"url"}},{type:"context",runtimeBinding:`${ue}.${makePropSafe("logo")}`,readableBinding:"Settings.logo",category:"Settings",icon:"Settings",display:{type:"string",name:"logo"}},{type:"context",runtimeBinding:`${ue}.${makePropSafe("company")}`,readableBinding:"Settings.company",category:"Settings",icon:"Settings",display:{type:"string",name:"company"}}],to},getSelectedRowsBindings=to=>{var eo;let ue=[];if((eo=get_store_value(appStore).clientFeatures)!=null&&eo.rowSelection){let no=findAllMatchingComponents(to==null?void 0:to.props,io=>io._component.endsWith("table"));const ro=makePropSafe("rowSelection");ue=ue.concat(no.map(io=>({type:"context",runtimeBinding:`${ro}.${makePropSafe(io._id)}.${makePropSafe("selectedRows")}`,readableBinding:`${io._instanceName}.Selected Row IDs (deprecated)`,category:"Selected Row IDs (deprecated)",icon:"ViewRow",display:{name:io._instanceName}})));let oo=findAllMatchingComponents(to==null?void 0:to.props,io=>io._component.endsWith("tableblock"));ue=ue.concat(oo.map(io=>({type:"context",runtimeBinding:`${ro}.${makePropSafe(io._id+"-table")}.${makePropSafe("selectedRows")}`,readableBinding:`${io._instanceName}.Selected Row IDs (deprecated)`,category:"Selected Row IDs (deprecated)",icon:"ViewRow",display:{name:io._instanceName}})))}return ue},makeStateBinding=to=>({type:"context",runtimeBinding:`${makePropSafe("state")}.${makePropSafe(to)}`,readableBinding:`State.${to}`,category:"State",icon:"AutomatedSegment",display:{name:to}}),getStateBindings=()=>{var ue;let to=[];return(ue=get_store_value(appStore).clientFeatures)!=null&&ue.state&&(to=getAllStateVariables().map(makeStateBinding)),to},getUrlBindings=to=>{var ao;const eo=(((ao=to==null?void 0:to.routing)==null?void 0:ao.route)??"").split("/");let no=[];eo.forEach(so=>{so.startsWith(":")&&so.length>1&&no.push(so.replace(/:/g,"").replace(/\?/g,""))});const ro=makePropSafe("url"),oo=no.map(so=>({type:"context",runtimeBinding:`${ro}.${makePropSafe(so)}`,readableBinding:`URL.${so}`,category:"URL",icon:"RailTop",display:{type:"string",name:so}})),io={type:"context",runtimeBinding:makePropSafe("query"),readableBinding:"Query params",category:"URL",icon:"RailTop",display:{type:"object",name:"Query params"}};return oo.concat([io])},getRoleBindings=()=>(get_store_value(roles)||[]).map(to=>({type:"context",runtimeBinding:`'${to._id}'`,readableBinding:`Role.${to.uiMetadata.displayName}`,category:"Role",icon:"UserGroup",display:{type:"string",name:to.uiMetadata.displayName}})),getEventContextBindings=({settingKey:to,componentInstance:ue,componentId:eo,componentDefinition:no,asset:ro})=>{var co;let oo=[];ro=ro??get_store_value(selectedScreen);const io=ue??findComponent(ro.props,eo);if(!io)return oo;const ao=no??componentStore.getDefinition(io==null?void 0:io._component),lo=componentStore.getComponentSettings(io==null?void 0:io._component).find(uo=>uo.key===to);return(co=lo==null?void 0:lo.context)!=null&&co.length&&lo.context.forEach(uo=>{oo.push({readableBinding:uo.label,runtimeBinding:`${makePropSafe("eventContext")}.${makePropSafe(uo.key)}`,category:io._instanceName,icon:ao.icon,display:{name:uo.label}})}),oo},getActionBindings=(to,ue)=>{let eo=[];const no=to==null?void 0:to.findIndex(oo=>oo.id===ue);return no==null||no===-1||to.slice(0,no).forEach((oo,io)=>{const ao=ActionDefinitions.actions.find(so=>so.name===oo["##eventHandlerType"]);ao.context&&ao.context.forEach(so=>{eo.push({readableBinding:`Action ${io+1}.${so.label}`,runtimeBinding:`actions.${io}.${so.value}`,category:"Actions",icon:"JourneyAction",display:{name:so.label}})})}),eo},getEmbedBindings=()=>{let to=[];return to=[{type:"context",runtimeBinding:`${makePropSafe("embed")}`,readableBinding:"ParentWindow",category:"Embed",icon:"DistributeVertically"}],to},getSchemaForDatasourcePlus=(to,ue)=>{const no=(to==null?void 0:to.startsWith("view_"))?{type:"viewV2",id:to,tableId:to.split("_").slice(1,3).join("_")}:{type:"table",tableId:to};return getSchemaForDatasource(null,no,ue)},getSchemaForDatasource=(to,ue,eo)=>{var oo,io;eo=eo||{};let no,ro;if(ue){const{type:ao}=ue,so=get_store_value(tables).list;if(ao==="provider"){const ho=findComponent(to==null?void 0:to.props,ue.providerId),_o=getDatasourceForProvider(to,ho);return getSchemaForDatasource(to,_o,eo)}else if(ao==="query")ro=get_store_value(queries).list.find(_o=>_o._id===ue._id);else if(ao==="field"){ro={name:ue.fieldName};const{fieldType:ho}=ue;ho==="attachment"?no={url:{type:"string"},name:{type:"string"}}:ho==="array"&&(no={value:{type:"string"}})}else if(ao==="jsonarray"){ro=so.find(_o=>_o._id===ue.tableId);let ho=ro==null?void 0:ro.schema;no=getJSONArrayDatasourceSchema(ho,ue)}else if(ao==="queryarray"){ro=get_store_value(queries).list.find(bo=>bo._id===ue.tableId);let _o=ro==null?void 0:ro.schema,go=ro==null?void 0:ro.nestedSchemaFields;no=generateQueryArraySchemas(_o,go),no=getJSONArrayDatasourceSchema(no,ue)}else ro=so.find(ho=>ho._id===ue.tableId);if(ro&&!no)if(ao==="view")no=fp$1.cloneDeep((io=(oo=ro.views)==null?void 0:oo[ue.name])==null?void 0:io.schema);else if(ao==="viewV2"){const ho=Object.values(ro.views||{}).find(_o=>_o.id===ue.id);no=fp$1.cloneDeep(ho==null?void 0:ho.schema),Object.keys(no||{}).forEach(_o=>{no[_o].visible||delete no[_o]})}else ao==="query"&&(eo.formSchema||eo.searchableSchema)?(no={},(ro.parameters||[]).forEach(_o=>{_o!=null&&_o.name&&(no[_o.name]={..._o,type:"string"})})):no=fp$1.cloneDeep(ro.schema);if(no){let ho={};Object.keys(no).forEach(_o=>{const go=no[_o];if((go==null?void 0:go.type)==="json"){const bo=convertJSONSchemaToTableSchema(go,{squashObjects:!0});Object.keys(bo).forEach(vo=>{ho[`${_o}.${vo}`]={type:bo[vo].type,nestedJSON:!0}})}}),no={...no,...ho}}const lo=ro&&(ro==null?void 0:ro.sourceType)===DB_TYPE_INTERNAL,co=["table","link","viewV2"].includes(ue.type);let uo=co,fo=co&&lo;eo.formSchema?(uo=!1,fo=!1):eo.searchableSchema&&(uo=co&&lo),no&&(uo&&(no._id={type:"string"}),fo&&(no._rev={type:"string"}));let po={};Object.entries(no||{}).forEach(([ho,_o])=>{const go=Object.values(FIELDS).find(bo=>bo.type===_o.type&&bo.subtype===_o.subtype);typeof _o=="string"?po[ho]={type:_o,name:ho,display:{type:_o}}:po[ho]={..._o,name:ho,display:{type:(go==null?void 0:go.name)||_o.type}}}),no=po}return{schema:no,table:ro}},buildFormSchema=(to,ue)=>{var oo;let eo={};if(!to)return eo;if(to._component.endsWith("formblock")){let io={};const ao=getDatasourceForProvider(ue,to),so=getSchemaForDatasource(to,ao);if(!(so!=null&&so.schema))return io;if(!to.fields)Object.values(so.schema).filter(({autocolumn:lo,name:co})=>!lo&&!["_rev","_id"].includes(co)).forEach(({name:lo})=>{io[lo]={type:so==null?void 0:so.schema[lo].type}});else{const lo=convertOldFieldFormat(to.fields||[]);lo==null||lo.forEach(({field:co,active:uo})=>{uo&&so!=null&&so.schema[co]&&(io[co]={type:so==null?void 0:so.schema[co].type})})}return io}const ro=componentStore.getComponentSettings(to._component).find(io=>io.key==="field"&&io.type.startsWith("field/"));if(ro){const io=ro.type.split("field/")[1],ao=to.field||to._instanceName;io&&ao&&(eo[ao]={type:io})}return(oo=to._children)==null||oo.forEach(io=>{const ao=buildFormSchema(io,ue);eo={...eo,...ao}}),eo},getAllStateVariables=()=>{let to=[];getAllAssets().forEach(eo=>{findAllMatchingComponents(eo.props,no=>{const ro=componentStore.getComponentSettings(no._component),oo=["buttonConfiguration","fieldConfiguration","stepConfiguration"],io=(ao,so)=>{ao!=null&&ao.length&&(ao.filter(lo=>lo.type==="event").forEach(lo=>{to.push(so[lo.key])}),ao.filter(lo=>oo.includes(lo.type)).forEach(lo=>{const co=so[lo.key];Array.isArray(co)&&co.length&&co.forEach(uo=>{let fo=uo==null?void 0:uo._component;lo.type==="stepConfiguration"&&!fo&&(fo="@budibase/standard-components/multistepformblockstep");const po=componentStore.getComponentSettings(fo);io(po,uo)})}))};io(ro,no)})}),get_store_value(screenStore).screens.forEach(eo=>{eo.onLoad&&to.push(eo.onLoad)});let ue=new Set;return to.forEach(eo=>{Array.isArray(eo)&&eo.forEach(no=>{var ro,oo,io;no["##eventHandlerType"]==="Update State"&&((ro=no.parameters)==null?void 0:ro.type)==="set"&&((oo=no.parameters)!=null&&oo.key)&&((io=no.parameters)!=null&&io.value)&&ue.add(no.parameters.key)})}),Array.from(ue)},getAllAssets=()=>{let to=[];return to=to.concat(get_store_value(layoutStore).layouts||[]),to=to.concat(get_store_value(screenStore).screens||[]),to},shouldReplaceBinding=(to,ue,eo,no)=>{if(!(to!=null&&to.includes(ue)))return!1;const ro=no.runtimeBinding.includes(no.readableBinding),oo=eo==="readableBinding",ao=Object.keys(getJsHelperList()).filter(uo=>uo.includes(ue)&&to.includes(uo));if(ao.length>0){const uo=to.indexOf(ue),fo=uo+ue.length;for(let po of ao){const ho=to.indexOf(po),_o=ho+po.length;if(uo>=ho&&fo<=_o)return!1}}if(oo&&!ro)return to.indexOf(no.readableBinding)===-1;if(oo)return!0;const so=to.replace(/\s+/g,""),lo=ue.replace(/\s+/g,"");return![`[${lo}]`,`"${lo}"`,`'${lo}'`].find(uo=>so==null?void 0:so.includes(uo))},replaceBetween=(to,ue,eo,no)=>to.substring(0,ue)+no+to.substring(eo),bindingReplacement=(to,ue,eo)=>{const no=isJSBinding(ue);no&&(ue=decodeJSBinding(ue));const ro=no?CAPTURE_VAR_INSIDE_JS:CAPTURE_VAR_INSIDE_TEMPLATE,oo=eo==="runtimeBinding"?"readableBinding":"runtimeBinding";if(typeof ue!="string")return ue;const io=to.map(lo=>lo[oo]).sort((lo,co)=>co.length-lo.length),ao=ue.match(ro)||[];let so=ue;for(let lo of ao){let co=lo,uo=co;for(let fo of io){const po=to.find(ho=>ho[oo]===fo);if(no||shouldReplaceBinding(co,fo,eo,po)){let ho;do if(ho=uo.indexOf(fo),ho!==-1){let _o=ho+fo.length,go=Array(po[eo].length+1).join("*");uo=replaceBetween(uo,ho,_o,go),co=replaceBetween(co,ho,_o,po[eo])}while(ho!==-1)}}so=so.replace(lo,co)}return no&&(so=encodeJSBinding(so)),so},extractLiteralHandlebarsID=to=>{var ue;return!to||typeof to!="string"?null:(ue=to.match(/{{\s*literal\s*\[+([^\]]+)].*}}/))==null?void 0:ue[1]},readableToRuntimeBinding=(to,ue)=>bindingReplacement(to,ue,"runtimeBinding"),runtimeToReadableBinding=(to,ue)=>bindingReplacement(to,ue,"readableBinding"),updateReferencesInObject=({obj:to,modifiedIndex:ue,action:eo,label:no,originalIndex:ro})=>{const oo=new RegExp(`{{\\s*${no}\\.(\\d+)\\.`,"g"),io=(ao,so,lo)=>ao.replace(`{{ ${no}.${so}.`,`{{ ${no}.${lo}.`);for(const ao in to)if(typeof to[ao]=="string"){let so;for(;(so=oo.exec(to[ao]))!==null;){const lo=parseInt(so[1]);eo===UpdateReferenceAction.ADD&&lo>=ue?to[ao]=io(to[ao],lo,lo+1):eo===UpdateReferenceAction.DELETE&&lo>ue?to[ao]=io(to[ao],lo,lo-1):eo===UpdateReferenceAction.MOVE&&(lo===ro?to[ao]=io(to[ao],lo,ue):ue<=lo&&ue<ro?to[ao]=io(to[ao],lo,lo+1):ue>=lo&&ue>ro&&(to[ao]=io(to[ao],lo,lo-1)))}}else typeof to[ao]=="object"&&to[ao]!==null&&updateReferencesInObject({obj:to[ao],modifiedIndex:ue,action:eo,label:no,originalIndex:ro})},migrateReferencesInObject=({obj:to,label:ue="steps",steps:eo,originalIndex:no})=>{var io;const ro=new RegExp(`{{\\s*${ue}\\.(\\d+)\\.`,"g"),oo=(ao,so,lo)=>ao.replace(`{{ ${ue}.${so}.`,`{{ ${ue}.${lo}.`);for(const ao in to)if(typeof to[ao]=="string"){let so;for(;(so=ro.exec(to[ao]))!==null;){const lo=parseInt(so[1]);to[ao]=oo(to[ao],lo,(io=eo[lo])==null?void 0:io.id)}}else typeof to[ao]=="object"&&to[ao]!==null&&migrateReferencesInObject({obj:to[ao],steps:eo,originalIndex:no})},getComponentFieldOptions=(to,ue,eo,no=!0)=>{const ro=findClosestMatchingComponent(to,ue,so=>so._component==="@budibase/standard-components/form"),oo=getDatasourceForProvider(to,ro),io=getSchemaForDatasource(to,oo,{formSchema:!0}).schema;let ao=[eo];return no&&(eo==="field/options"||eo==="field/longform")&&(ao=[eo,"field/string"]),ao=ao.map(so=>so.slice(so.indexOf("/")+1)),Object.entries(io||{}).filter(so=>ao.includes(so[1].type)).map(so=>so[0])};/*!
|
|
499
499
|
* https://github.com/Starcounter-Jack/JSON-Patch
|
|
500
500
|
* (c) 2017-2022 Joachim Wester
|
|
501
501
|
* MIT licensed
|
|
@@ -515,7 +515,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
515
515
|
enhance user experience.
|
|
516
516
|
|
|
517
517
|
<p>Breaking the form into multiple steps can significantly improve usability by
|
|
518
|
-
making the process more digestible for your users.</p>`},m(eo,no){insert$1(eo,ue,no)},p:noop$6,i:noop$6,o:noop$6,d(eo){eo&&detach(ue)}}}class NewFormSteps extends SvelteComponent{constructor(ue){super(),init$3(this,ue,null,create_fragment$9b,safe_not_equal,{})}}const ONBOARDING_EVENT_PREFIX="onboarding",TOUR_STEP_KEYS={BUILDER_APP_PUBLISH:"builder-app-publish",BUILDER_DATA_SECTION:"builder-data-section",BUILDER_DESIGN_SECTION:"builder-design-section",BUILDER_USER_MANAGEMENT:"builder-user-management",BUILDER_AUTOMATION_SECTION:"builder-automation-section",FEATURE_USER_MANAGEMENT:"feature-user-management",BUILDER_FORM_CREATE_STEPS:"builder-form-create-steps",BUILDER_FORM_VIEW_UPDATE_STEPS:"builder-form-view-update-steps",BUILDER_FORM_ROW_ID:"builder-form-row-id"},TOUR_KEYS={TOUR_BUILDER_ONBOARDING:"builder-onboarding",FEATURE_ONBOARDING:"feature-onboarding",BUILDER_FORM_CREATE:"builder-form-create",BUILDER_FORM_VIEW_UPDATE:"builder-form-view-update"},getCurrentStepIdx=(to,ue)=>{if(to!=null&&to.length)return to!=null&&to.length&&!ue?0:to.findIndex(eo=>eo.id===ue)},endUserOnboarding=async({skipped:to=!1}={})=>{if(get_store_value(auth).user){try{await API.updateSelf({onboardedAt:new Date().toISOString()}),to&&tourEvent("skipped"),await auth.getSelf(),builderStore.endBuilderOnboarding(),builderStore.setTour()}catch(ue){return console.error("Onboarding failed",ue),!1}return!0}},endTour=async({key:to,skipped:ue=!1}={})=>{const{tours:eo={}}=get_store_value(auth).user;eo[to]=new Date().toISOString(),await API.updateSelf({tours:eo}),ue&&tourEvent(to,ue),await auth.getSelf(),builderStore.setTour()},tourEvent=(to,ue)=>{analytics.captureEvent(`${ONBOARDING_EVENT_PREFIX}:${to}`,{eventSource:EventSource.PORTAL,skipped:ue})},getTours=()=>({[TOUR_KEYS.TOUR_BUILDER_ONBOARDING]:{steps:[{id:TOUR_STEP_KEYS.BUILDER_DATA_SECTION,title:"Data",route:"/builder/app/:application/data",layout:OnboardingData,query:".topleftnav .spectrum-Tabs-item#builder-data-tab",onLoad:async()=>{tourEvent(TOUR_STEP_KEYS.BUILDER_DATA_SECTION)},align:"left"},{id:TOUR_STEP_KEYS.BUILDER_DESIGN_SECTION,title:"Design",route:"/builder/app/:application/design",layout:OnboardingDesign,query:".topleftnav .spectrum-Tabs-item#builder-design-tab",onLoad:()=>{tourEvent(TOUR_STEP_KEYS.BUILDER_DESIGN_SECTION)},align:"left"},{id:TOUR_STEP_KEYS.BUILDER_AUTOMATION_SECTION,title:"Automations",route:"/builder/app/:application/automation",query:".topleftnav .spectrum-Tabs-item#builder-automation-tab",body:"Once you have your app screens made, you can set up automations to fit in with your current workflow",onLoad:()=>{tourEvent(TOUR_STEP_KEYS.BUILDER_AUTOMATION_SECTION)},align:"left"},{id:TOUR_STEP_KEYS.BUILDER_USER_MANAGEMENT,title:"Users",query:".toprightnav #builder-app-users-button",body:"Add users to your app and control what level of access they have.",onLoad:()=>{tourEvent(TOUR_STEP_KEYS.BUILDER_USER_MANAGEMENT)}},{id:TOUR_STEP_KEYS.BUILDER_APP_PUBLISH,title:"Publish",layout:OnboardingPublish,route:"/builder/app/:application/design",query:".toprightnav #builder-app-publish-button",onLoad:()=>{tourEvent(TOUR_STEP_KEYS.BUILDER_APP_PUBLISH)},onComplete:endUserOnboarding}],onSkip:async()=>{await endUserOnboarding({skipped:!0})},endRoute:"/builder/app/:application/data"},[TOUR_KEYS.FEATURE_ONBOARDING]:{steps:[{id:TOUR_STEP_KEYS.FEATURE_USER_MANAGEMENT,title:"Users",query:".toprightnav #builder-app-users-button",body:"Add users to your app and control what level of access they have.",onLoad:()=>{tourEvent(TOUR_STEP_KEYS.FEATURE_USER_MANAGEMENT)},onComplete:endUserOnboarding}]},[TOUR_KEYS.BUILDER_FORM_CREATE]:{steps:[{id:TOUR_STEP_KEYS.BUILDER_FORM_CREATE_STEPS,title:"Add multiple steps",layout:NewFormSteps,query:"#steps-prop-control-wrap",onComplete:()=>{builderStore.highlightSetting(),endTour({key:TOUR_KEYS.BUILDER_FORM_CREATE})},onLoad:()=>{tourEvent(TOUR_STEP_KEYS.BUILDER_FORM_CREATE_STEPS),builderStore.highlightSetting("steps","info")},align:"left-outside"}]},[TOUR_KEYS.BUILDER_FORM_VIEW_UPDATE]:{steps:[{id:TOUR_STEP_KEYS.BUILDER_FORM_ROW_ID,title:"Add row ID to update a row",layout:NewViewUpdateFormRowId,query:"#rowId-prop-control-wrap",onLoad:()=>{tourEvent(TOUR_STEP_KEYS.BUILDER_FORM_ROW_ID),builderStore.highlightSetting("rowId","info")},align:"left-outside"},{id:TOUR_STEP_KEYS.BUILDER_FORM_VIEW_UPDATE_STEPS,title:"Add multiple steps",layout:NewFormSteps,query:"#steps-prop-control-wrap",onComplete:()=>{builderStore.highlightSetting(),endTour({key:TOUR_KEYS.BUILDER_FORM_VIEW_UPDATE})},onLoad:()=>{tourEvent(TOUR_STEP_KEYS.BUILDER_FORM_VIEW_UPDATE_STEPS),builderStore.highlightSetting("steps","info")},align:"left-outside",scrollIntoView:!0}],onSkip:async()=>{builderStore.highlightSetting(),endTour({key:TOUR_KEYS.BUILDER_FORM_VIEW_UPDATE,skipped:!0})}}}),TOURS=getTours(),TOURSBYSTEP=Object.keys(TOURS).reduce((to,ue)=>(TOURS[ue].steps.forEach(eo=>{to[eo.id]=eo,to[eo.id].tour=ue}),to),{}),INITIAL_BUILDER_STATE={previousTopNavPath:{},highlightedSetting:null,propertyFocus:null,builderSidePanel:!1,onboarding:!1,tourNodes:null,tourKey:null,tourStepKey:null,hoveredComponentId:null};class BuilderStore extends BudiStore{constructor(){super({...INITIAL_BUILDER_STATE}),this.init=this.init.bind(this),this.refresh=this.refresh.bind(this),this.reset=this.reset.bind(this),this.highlightSetting=this.highlightSetting.bind(this),this.propertyFocus=this.propertyFocus.bind(this),this.hideBuilderSidePanel=this.hideBuilderSidePanel.bind(this),this.showBuilderSidePanel=this.showBuilderSidePanel.bind(this),this.setPreviousTopNavPath=this.setPreviousTopNavPath.bind(this),this.selectResource=this.selectResource.bind(this),this.registerTourNode=this.registerTourNode.bind(this),this.destroyTourNode=this.destroyTourNode.bind(this),this.startBuilderOnboarding=this.startBuilderOnboarding.bind(this)}init(ue){if(!(ue!=null&&ue.appId)){console.error("BuilderStore: No appId supplied for websocket");return}this.websocket||(this.websocket=createBuilderWebsocket(ue.appId))}refresh(){const ue=get_store_value(this.store);this.store.set(ue)}reset(){var ue;this.store.set({...INITIAL_BUILDER_STATE}),(ue=this.websocket)==null||ue.disconnect(),this.websocket=void 0}highlightSetting(ue,eo){this.update(no=>({...no,highlightedSetting:ue?{key:ue,type:eo||"info"}:null}))}propertyFocus(ue){this.update(eo=>({...eo,propertyFocus:ue}))}showBuilderSidePanel(){this.update(ue=>({...ue,builderSidePanel:!0}))}hideBuilderSidePanel(){this.update(ue=>({...ue,builderSidePanel:!1}))}setPreviousTopNavPath(ue,eo){this.update(no=>({...no,previousTopNavPath:{...no.previousTopNavPath||{},[ue]:eo}}))}selectResource(ue){var eo;(eo=this.websocket)==null||eo.emit(BuilderSocketEvent.SelectResource,{resourceId:ue})}registerTourNode(ue,eo){this.update(no=>({...no,tourNodes:{...no.tourNodes,[ue]:eo}}))}destroyTourNode(ue){var no;const eo=get_store_value(this.store);if((no=eo.tourNodes)!=null&&no[ue]){const ro={...eo.tourNodes};delete ro[ue],this.update(oo=>({...oo,tourNodes:ro}))}}startBuilderOnboarding(){this.update(ue=>({...ue,onboarding:!0,tourKey:TOUR_KEYS.TOUR_BUILDER_ONBOARDING}))}endBuilderOnboarding(){this.update(ue=>({...ue,onboarding:!1}))}setTour(ue){this.update(eo=>({...eo,tourStepKey:null,tourNodes:null,tourKey:ue||null}))}}const builderStore=new BuilderStore,INITIAL_HOVER_STATE={componentId:null};class HoverStore extends BudiStore{constructor(){super({...INITIAL_HOVER_STATE}),this.hover=this.hover.bind(this)}hover(ue,eo=!0){clearTimeout(this.hoverTimeout),ue?this.processHover(ue,eo):this.hoverTimeout=setTimeout(()=>{this.processHover(ue,eo)},10)}processHover(ue,eo){ue!==get_store_value(this.store).componentId&&(this.update(no=>(no.componentId=ue,no)),eo&&previewStore.sendEvent("hover-component",ue))}}const hoverStore=new HoverStore,INITIAL_PREVIEW_STATE={previewDevice:"desktop",previewEventHandler:null,showPreview:!1,selectedComponentContext:null};class PreviewStore extends BudiStore{constructor(){super(INITIAL_PREVIEW_STATE),this.setDevice=this.setDevice.bind(this),this.sendEvent=this.sendEvent.bind(this),this.registerEventHandler=this.registerEventHandler.bind(this),this.startDrag=this.startDrag.bind(this),this.stopDrag=this.stopDrag.bind(this),this.showPreview=this.showPreview.bind(this),this.setSelectedComponentContext=this.setSelectedComponentContext.bind(this),this.requestComponentContext=this.requestComponentContext.bind(this)}setDevice(ue){this.update(eo=>({...eo,previewDevice:ue}))}sendEvent(ue,eo){const{previewEventHandler:no}=get_store_value(this.store);no==null||no(ue,eo)}registerEventHandler(ue){this.update(eo=>({...eo,previewEventHandler:ue}))}startDrag(ue){this.sendEvent("dragging-new-component",{dragging:!0,component:ue})}stopDrag(){this.sendEvent("dragging-new-component",{dragging:!1})}showPreview(ue){this.update(eo=>({...eo,showPreview:ue}))}setSelectedComponentContext(ue){this.update(eo=>({...eo,selectedComponentContext:ue}))}requestComponentContext(){this.sendEvent("request-context")}}const previewStore=new PreviewStore,TriggerStepID={ROW_SAVED:"ROW_SAVED",ROW_UPDATED:"ROW_UPDATED",ROW_DELETED:"ROW_DELETED",ROW_ACTION:"ROW_ACTION",WEBHOOK:"WEBHOOK",APP:"APP",CRON:"CRON"},ActionStepID={SEND_EMAIL_SMTP:"SEND_EMAIL_SMTP",CREATE_ROW:"CREATE_ROW",UPDATE_ROW:"UPDATE_ROW",DELETE_ROW:"DELETE_ROW",OUTGOING_WEBHOOK:"OUTGOING_WEBHOOK",EXECUTE_SCRIPT:"EXECUTE_SCRIPT",EXECUTE_QUERY:"EXECUTE_QUERY",SERVER_LOG:"SERVER_LOG",DELAY:"DELAY",FILTER:"FILTER",QUERY_ROWS:"QUERY_ROWS",LOOP:"LOOP",COLLECT:"COLLECT",TRIGGER_AUTOMATION_RUN:"TRIGGER_AUTOMATION_RUN",discord:"discord",slack:"slack",zapier:"zapier",integromat:"integromat",n8n:"n8n"},Features={LOOPING:"LOOPING"};class TableStore extends DerivedBudiStore{constructor(){const ue=eo=>derived(eo,no=>{var ro;return{...no,selected:(ro=no.list)==null?void 0:ro.find(oo=>oo._id===no.selectedTableId)}});super({list:[],selectedTableId:void 0},ue),this.select=this.select.bind(this)}async init(){return this.fetch()}async fetch(){const ue=await API.getTables();this.store.update(eo=>({...eo,list:ue}))}async singleFetch(ue){const eo=await API.getTable(ue);this.store.update(no=>{const ro=[];for(let oo of no.list)eo._id===oo._id?ro.push(eo):ro.push(oo);return no.list=ro,no})}select(ue){this.store.update(eo=>({...eo,selectedTableId:ue}))}async save(ue){var lo;const eo=fp$1.cloneDeep(ue),no=get_store_value(this.store).list.filter(co=>co._id===ue._id)[0],ro=[];for(let co of Object.keys(eo.schema)){if(ro.indexOf(co.toLowerCase())!==-1){delete eo.schema[co];continue}const uo=eo.schema[co],fo=no==null?void 0:no.schema[co];fo!=null&&(fo==null?void 0:fo.type)!==uo.type&&!((lo=SWITCHABLE_TYPES[fo==null?void 0:fo.type])!=null&&lo.includes(uo.type))&&(eo.schema[co]=fo),uo.name&&uo.name!==co&&(eo.schema[uo.name]=uo,eo._rename={old:co,updated:uo.name},delete eo.schema[co]),ro.push(co.toLowerCase())}const oo=await API.saveTable(eo);this.replaceTable(oo._id,oo),this.select(oo._id);let io=[];for(let co of Object.values((eo==null?void 0:eo.schema)||{}))co.type===FieldType.LINK&&io.push(co.tableId);let ao=[];for(let co of Object.values((no==null?void 0:no.schema)||{}))co.type===FieldType.LINK&&ao.push(co.tableId);const so=[...new Set([...io,...ao])];return so.length>3?await this.fetch():await Promise.all(so.map(co=>this.singleFetch(co))),oo}async delete(ue){await API.deleteTable(ue._id,ue._rev),this.replaceTable(ue._id,null)}async saveField({originalName:ue,field:eo,primaryDisplay:no=!1,indexes:ro}){const oo=fp$1.cloneDeep(get_store_value(this.derivedStore).selected);if(ue!=null&&ue!==eo.name&&(delete oo.schema[ue],oo._rename={old:ue,updated:eo.name}),no)oo.primaryDisplay=eo.name;else if(oo.primaryDisplay===ue){const io=Object.keys(oo.schema);oo.primaryDisplay=io.filter(ao=>ao!==ue||ao!==eo.name)[0]}ro&&(oo.indexes=ro),oo.schema={...oo.schema,[eo.name]:fp$1.cloneDeep(eo)},await this.save(oo)}async deleteField(ue){let eo=fp$1.cloneDeep(get_store_value(this.derivedStore).selected);delete eo.schema[ue.name],await this.save(eo)}replaceTable(ue,eo){if(!ue)return;if(!eo){this.store.update(ro=>({...ro,list:ro.list.filter(oo=>oo._id!==ue)}));return}const no=get_store_value(this.store).list.findIndex(ro=>ro._id===eo._id);no===-1?this.store.update(ro=>({...ro,list:[...ro.list,eo]})):eo&&this.store.update(ro=>(ro.list[no]={...eo,type:ro.list[no].type},ro))}removeDatasourceTables(ue){this.store.update(eo=>({...eo,list:eo.list.filter(no=>no.sourceId!==ue)}))}}const tables=new TableStore;class ViewV2Store extends DerivedBudiStore{constructor(){const ue=eo=>derived([eo,tables],([no,ro])=>{var io;let oo=[];return(io=ro.list)==null||io.forEach(ao=>{const so=Object.values((ao==null?void 0:ao.views)||{}).filter(isV2);oo=oo.concat(so)}),{...no,list:oo,selected:oo.find(ao=>ao.id===no.selectedViewId)}});super({selectedViewId:null},ue),this.select=this.select.bind(this)}select(ue){this.store.update(eo=>({...eo,selectedViewId:ue}))}async delete(ue){await API.viewV2.delete(ue.id),this.replaceView(ue.id,null)}async create(ue){const no=(await API.viewV2.create(ue)).data;return this.replaceView(no.id,no),no}async save(ue){const eo=await API.viewV2.update(ue),no=eo==null?void 0:eo.data;this.replaceView(ue.id,no)}replaceView(ue,eo){const no=get_store_value(this.derivedStore).list.find(oo=>oo.id===ue),ro=get_store_value(tables).list.findIndex(oo=>oo._id===(eo==null?void 0:eo.tableId)||oo._id===(no==null?void 0:no.tableId));if(ro!==-1)if(!eo&&no){tables.update(oo=>(delete oo.list[ro].views[no.name],oo));return}else!no&&eo?tables.update(oo=>{var io;return(io=oo.list[ro]).views??(io.views={}),oo.list[ro].views[eo.name]=eo,oo}):no&&eo&&tables.update(oo=>{var io;return(io=oo.list[ro]).views??(io.views={}),delete oo.list[ro].views[no.name],oo.list[ro].views[eo.name]=eo,oo})}}const viewsV2=new ViewV2Store,duplicateName=(to,ue)=>{const eo=new RegExp("\\s(\\d+)$"),no=to.split(eo)[0],ro=new RegExp(`${no}\\s(\\d+)$`),oo=[];ue.filter(ao=>{if(ao===no)return!0;const so=ao.match(ro);return so?(oo.push(parseInt(so[1])),!0):!1}),oo.sort((ao,so)=>ao-so);let io;if(oo.length===0)io=1;else{for(let ao=0;ao<oo.length;ao++)if(oo[ao]!==ao+1){io=ao+1;break}io||(io=oo.length+1)}return`${no} ${io}`},getSequentialName=(to,ue,{getName:eo=ro=>ro,numberFirstItem:no=!1}={})=>{if(!(ue!=null&&ue.length)||!eo)return null;const ro=ue.trim(),oo=no?`${ue}1`:ro;if(!(to!=null&&to.length))return oo;let io=0;return to.forEach(ao=>{const so=eo(ao);if(typeof so!="string"||!so.startsWith(ro))return;const lo=so.split(ro);if(lo.length!==2)return;lo[1].trim()===""&&(lo[1]="1");const co=parseInt(lo[1]);co>io&&(io=co)}),io===0?oo:`${ue}${io+1}`},initialState$1={};class RowActionStore extends BudiStore{constructor(){super(initialState$1),this.reset=()=>{this.set(initialState$1)},this.refreshRowActions=async ue=>{var oo;if(!ue)return;let eo=(oo=get_store_value(tables).list.find(io=>io._id===ue))==null?void 0:oo._id;if(!eo){const io=get_store_value(viewsV2).list.find(ao=>ao.id===ue);eo=io==null?void 0:io.tableId}if(!eo)return;const no=await API.rowActions.fetch(eo),ro=Object.values(no||{});this.update(io=>({...io,[eo]:ro}))},this.createRowAction=async(ue,eo,no)=>{if(!ue)return;if(!no){const oo=get_store_value(this)[ue]||[];no=getSequentialName(oo,"New row action ",{getName:io=>io.name})}if(!no)throw new Error("Failed to generate a unique name for the row action");const ro=await API.rowActions.create(ue,no);return eo?await Promise.all([this.enableView(ue,ro.id,eo),automationStore.actions.fetch()]):await Promise.all([this.refreshRowActions(ue),automationStore.actions.fetch()]),ro},this.enableView=async(ue,eo,no)=>{await API.rowActions.enableView(ue,eo,no),await this.refreshRowActions(ue)},this.disableView=async(ue,eo,no)=>{await API.rowActions.disableView(ue,eo,no),await this.refreshRowActions(ue)},this.delete=async(ue,eo)=>{await API.rowActions.delete(ue,eo),await this.refreshRowActions(ue)},this.trigger=async(ue,eo,no)=>{await API.rowActions.trigger(ue,eo,no)}}}const store=new RowActionStore,derivedStore=derived(store,to=>{const ue={};return Object.keys(to||{}).forEach(eo=>{ue[eo]=to[eo];for(let no of to[eo]){const ro=(no.allowedSources||[]).filter(oo=>oo!==eo);for(let oo of ro)ue[oo]??(ue[oo]=[]),ue[oo].push(no)}}),ue}),rowActions={...store,subscribe:derivedStore.subscribe},getNewStepName=(to,ue)=>{const eo=ue.name,no=oo=>oo.reduce((io,ao)=>(ao.name&&ao.name.startsWith(eo)&&io++,ao.stepId===AutomationActionStepId.BRANCH&&ao.inputs&&ao.inputs.children&&Object.values(ao.inputs.children).forEach(so=>{io+=no(so)}),io),0);let ro=0;return to!=null&&to.definition&&(ro=no(to.definition.steps)),ro===0?eo:`${eo} ${ro+1}`},initialAutomationState={automations:[],testResults:null,showTestPanel:!1,blockDefinitions:{TRIGGER:{},CREATABLE_TRIGGER:{},ACTION:{}},selectedAutomationId:null},getFinalDefinitions=(to,ue)=>{const eo={};return Object.entries(to).forEach(no=>{no[0]!==AutomationTriggerStepId.ROW_ACTION&&(eo[no[0]]=no[1])}),{TRIGGER:to,CREATABLE_TRIGGER:eo,ACTION:ue}},automationActions=to=>({moveBlock:async(ue,eo,no)=>{const ro=ue.at(-1),oo=eo.at(-1),io=(ro==null?void 0:ro.id)===(oo==null?void 0:oo.id),ao=(oo==null?void 0:oo.branchStepId)&&oo.branchIdx===(ro==null?void 0:ro.branchIdx)&&(ro==null?void 0:ro.stepIdx)===0;if(io||ao)return;const{deleted:so,newAutomation:lo}=to.actions.deleteBlock(ue,no),co={};to.actions.traverse(co,lo);let uo;oo!=null&&oo.branchStepId?(uo=co[oo.branchStepId].pathTo,uo.push(oo)):(oo!=null&&oo.id&&(uo=co[oo.id].pathTo),uo.at(-1).stepIdx+=1);const fo=to.actions.updateStep(uo,lo,so,!0);try{await to.actions.save(fo)}catch(po){notifications.error("Error moving automation block"),console.error("Error moving automation block ",po)}},deleteBlock:(ue,eo)=>{let no=fp$1.cloneDeep(eo);const ro=[no.definition.trigger,...no.definition.steps];let oo;return ue.forEach((io,ao,so)=>{const lo=ao===so.length-1,{stepIdx:co,branchIdx:uo}=io,fo=(po,ho)=>{const _o=po[ho],go=[_o.id],bo=[],vo={};po.forEach(wo=>{const{blockToLoop:ko,id:So}=wo;ko&&(vo[ko]=So)});const yo=vo[_o.id];yo&&go.push(yo);for(let wo=po.length-1;wo>=0;wo--)if(go.includes(po[wo].id)){const[ko]=po.splice(wo,1);bo.unshift(ko)}return{deleted:bo,newAutomation:no}};if(!oo){lo?oo=fo(no.definition.steps,co>0?co-1:0):oo=ro[co];return}if(Number.isInteger(uo)){const po=oo.inputs.branches[uo].id,ho=oo.inputs.children[po],_o=ho[co];lo?oo=fo(ho,co):oo=_o}}),oo},registerBlock:(ue,eo,no,ro)=>{ue[eo.id]={...ue[eo.id]||{},pathTo:no,terminating:ro||!1,...eo.blockToLoop?{blockToLoop:eo.blockToLoop}:{}},eo.blockToLoop&&(ue[eo.blockToLoop]={...ue[eo.blockToLoop]||{},looped:eo.id})},getPathSteps:(ue,eo)=>{const no=[eo.definition.trigger,...eo.definition.steps];let ro=[];return ue.forEach(oo=>{const{stepIdx:io,branchIdx:ao}=oo;let so=ro.length?ro[ro.length-1]:[];if(!ro.length){ro=no.slice(0,io+1);return}if(so&&"inputs"in so&&Number.isInteger(ao)){const lo=so.inputs.branches[ao].id,uo=so.inputs.children[lo].slice(0,io+1);ro=ro.concat(uo)}}),ro},updateStep:(ue,eo,no,ro=!1)=>{let oo=fp$1.cloneDeep(eo);const io=(so,lo,co)=>{so.splice(lo,ro?0:Array.isArray(co)?co.length:1,...Array.isArray(co)?co:[co])};let ao=null;return ue.forEach((so,lo,co)=>{const{stepIdx:uo,branchIdx:fo}=so;let po=lo===co.length-1;if(!ao){let ho=Math.max(uo-1,0);if(po){io(oo.definition.steps,ho,no);return}ao=oo.definition.steps[ho]}if(Number.isInteger(fo)){const ho=ao.inputs.branches[fo].id,_o=ao.inputs.children[ho];po?io(_o,uo,no):ao=_o[uo]}}),oo},buildEnvironmentBindings:()=>get_store_value(licensing).environmentVariablesEnabled?getEnvironmentBindings().map(ue=>({...ue,display:{...ue.display,rank:98}})):[],buildUserBindings:()=>getUserBindings().map(ue=>({...ue,category:"User",display:{...ue.display,rank:98}})),buildSettingBindings:()=>getSettingBindings().map(ue=>({...ue,display:{...ue.display,rank:98}})),getPathBindings:ue=>{var no,ro;const eo=(no=get_store_value(selectedAutomation))==null?void 0:no.blockRefs[ue];return to.actions.getAvailableBindings(eo,(ro=get_store_value(selectedAutomation))==null?void 0:ro.data)},traverse:(ue,eo)=>{var oo;let no=[];if(!eo||!ue)return;(oo=eo.definition)!=null&&oo.trigger&&no.push(eo.definition.trigger),no=no.concat(eo.definition.steps||[]);const ro=(io,ao,so,lo,co)=>{var po;const uo=[...ao||[],{...Number.isInteger(lo)?{branchIdx:lo}:{},stepIdx:so,id:io.id}],fo=((po=io.inputs)==null?void 0:po.branches)||[];fo.forEach((ho,_o)=>{var go;(go=io.inputs)==null||go.children[ho.id].forEach((bo,vo,yo)=>{var ko,So;const wo=yo.length-1===vo&&!((So=(ko=bo.inputs)==null?void 0:ko.branches)!=null&&So.length);ro(bo,uo,vo,_o,wo)})}),to.actions.registerBlock(ue,io,uo,co&&!fo.length)};return no.forEach((io,ao,so)=>{ro(io,null,ao,null,so.length-1===ao)}),ue},getAvailableBindings:(ue,eo)=>{var lo,co,uo,fo,po,ho,_o;if(!ue||!(eo!=null&&eo.definition))return[];const no=(lo=get_store_value(selectedAutomation))==null?void 0:lo.blockRefs,ro=to.actions.getPathSteps(ue.pathTo,eo).slice(0,-1),oo=to.actions.getPathSteps(ue.pathTo,eo).at(-1);let io=[];const ao=(go,bo,vo,yo,wo,ko)=>{if(!go)return;const So=to.actions.determineRuntimeBinding(go,yo,wo,ko,eo,oo,ro),Eo=to.actions.determineCategoryName(yo,wo,ko,so);io.push(to.actions.createBindingObject(go,bo,vo,yo,so,wo,So,Eo,ko))};let so=0;for(let go=0;go<ro.length;go++){const bo=ro[go],vo=((co=eo.definition.stepNames)==null?void 0:co[bo.id])||bo.name;let yo=fp$1.cloneDeep((fo=(uo=bo==null?void 0:bo.schema)==null?void 0:uo.outputs)==null?void 0:fo.properties)??{},wo=!1;bo.blockToLoop&&(wo=bo.stepId===ActionStepID.LOOP&&bo.blockToLoop in no);const ko=bo.type===AutomationStepType.TRIGGER;wo&&so==0&&(yo={currentItem:{type:AutomationIOType.STRING,description:"the item currently being executed"}});const So=ko?bo.icon:wo?"Reuse":bo.icon;if(go===0&&ko)if(bo.event===AutomationEventType.ROW_UPDATE||bo.event===AutomationEventType.ROW_SAVE){let Eo=get_store_value(tables).list.find(Io=>Io._id===bo.inputs.tableId);for(const Io in Eo==null?void 0:Eo.schema)yo[Io]={type:Eo.schema[Io].type,subtype:Eo.schema[Io].subtype};delete yo.row}else bo.event===AutomationEventType.APP_TRIGGER&&(yo=Object.fromEntries(Object.keys(bo.inputs.fields||[]).map(Eo=>[Eo,{type:bo.inputs.fields[Eo]}])));if((po=no[bo.id])!=null&&po.looped){so++;const Eo=no[bo.id].looped,Io=ro.find(Ao=>Ao.id===Eo);Io?yo=fp$1.cloneDeep((_o=(ho=Io.schema)==null?void 0:ho.outputs)==null?void 0:_o.properties):console.error("Loop block missing.")}Object.entries(yo).forEach(([Eo,Io])=>{ao(Eo,Io,So,go,wo,vo)})}return ue.looped||(io=io.filter(go=>!go.readableBinding.includes("loop"))),io},determineRuntimeBinding:(ue,eo,no,ro,oo,io,ao)=>{var lo,co,uo;let so;if(eo===0&&((lo=oo.definition.trigger)==null?void 0:lo.event)===AutomationEventType.APP_TRIGGER)return`trigger.fields.${ue}`;if(eo===0&&(((co=oo.definition.trigger)==null?void 0:co.event)===AutomationEventType.ROW_UPDATE||((uo=oo.definition.trigger)==null?void 0:uo.event)===AutomationEventType.ROW_SAVE)&&!["id","revision","oldRow"].includes(ue))return`trigger.row.${ue}`;if(no)so=`loop.${ue}`;else if(eo===0)so=`trigger.${ue}`;else if((io==null?void 0:io.stepId)===AutomationActionStepId.EXECUTE_SCRIPT){const fo=ao[eo].id;if(!fo)return notifications.error("Error generating binding: Step ID not found."),null;so=`steps["${fo}"].${ue}`}else{const fo=ao[eo].id;if(!fo)return notifications.error("Error generating binding: Step ID not found."),null;so=`steps.${fo}.${ue}`}return so},determineCategoryName:(ue,eo,no,ro)=>ue===0?"Trigger outputs":eo?"Loop Outputs":no?`${no} outputs`:`Step ${ue-ro} outputs`,createBindingObject:(ue,eo,no,ro,oo,io,ao,so,lo)=>{const co=Object.values(FIELDS).find(uo=>uo.type===eo.type&&("subtype"in uo?uo.subtype===eo.subtype:!0));return{readableBinding:lo&&!io&&ro!==0?`steps.${lo}.${ue}`:ao,runtimeBinding:ao,type:eo.type,description:eo.description,icon:no,category:so,display:{type:(co==null?void 0:co.name)||eo.type,name:ue,rank:io?ro+1:ro-oo}}},processBlockInputs:async(ue,eo)=>{var io;let no={...ue,inputs:{...ue.inputs,...eo}};Object.keys(no.inputs).forEach(ao=>{const so=no.inputs[ao];(so==null||so==="")&&delete no.inputs[ao]});const ro=(io=get_store_value(selectedAutomation))==null?void 0:io.data;if(!ro)return!1;const oo=to.actions.getUpdatedDefinition(ro,no);return JSON.stringify(oo)===JSON.stringify(ro)?!1:oo},updateBlockInputs:async(ue,eo)=>{const no=await to.actions.processBlockInputs(ue,eo);no!==!1&&await to.actions.save(no)},test:async(ue,eo)=>{var ro,oo;let no;try{no=await API.testAutomation(ue._id,eo)}catch(io){throw`Automation test failed - ${io.message||io.status||JSON.stringify(io)}`}if(!(no!=null&&no.trigger)&&!((ro=no==null?void 0:no.steps)!=null&&ro.length)&&!(no!=null&&no.message))throw((oo=no==null?void 0:no.err)==null?void 0:oo.code)==="usage_limit_exceeded"?"You have exceeded your automation quota":"Something went wrong testing your automation";to.update(io=>(io.testResults=no,io))},getUpdatedDefinition:(ue,eo)=>{var ro;let no;if(((ro=ue.definition.trigger)==null?void 0:ro.id)===eo.id)no=fp$1.cloneDeep(ue),no.definition.trigger=eo;else{const oo=get_store_value(selectedAutomation).blockRefs[eo.id].pathTo;no=to.actions.updateStep(oo,ue,eo)}return no},getLogs:async({automationId:ue,startDate:eo,status:no,page:ro}={})=>await API.getAutomationLogs({automationId:ue,startDate:eo,status:no,page:ro}),clearLogErrors:async({automationId:ue,appId:eo})=>{if(!ue||!eo)throw new Error("automationId and appId are required");return await API.clearAutomationLogErrors(ue,eo)},addTestDataToAutomation:ue=>{var no;let eo=fp$1.cloneDeep((no=get_store_value(selectedAutomation))==null?void 0:no.data);return eo&&(eo.testData={...eo.testData,...ue},eo)},constructBlock:(ue,eo,no)=>{var io;const ro={...no,inputs:no.inputs||{},stepId:eo,type:ue,id:shortid.generate()},oo=getNewStepName((io=get_store_value(selectedAutomation))==null?void 0:io.data,ro);return ro.name=oo,ro},generateBranchBlock:()=>{const ue=get_store_value(to).blockDefinitions.ACTION.BRANCH;return to.actions.constructBlock("ACTION","BRANCH",ue)},addBlockToAutomation:async(ue,eo)=>{var ao;const no=(ao=get_store_value(selectedAutomation))==null?void 0:ao.data;if(!no)return;let ro=fp$1.cloneDeep(no);const oo=[ro.definition.trigger,...ro.definition.steps];let io;eo.forEach((so,lo,co)=>{const{stepIdx:uo,branchIdx:fo}=so,po=lo===co.length-1,ho=(_o,go)=>{const bo=!Number.isInteger(go),vo=ue.blockToLoop||bo?go:go+1;_o.splice(vo,0,ue)};if(!io){po?(ho(ro.definition.steps,uo-1),io=ue):io=oo[uo];return}if(Number.isInteger(fo)){const _o=io.inputs.branches[fo].id,go=io.inputs.children[_o];po?(ho(go,uo),io=go):io=go[uo]}});try{await to.actions.save(ro)}catch(so){notifications.error("Error adding automation block"),console.error("Automation adding block ",so)}},generateDefaultConditions:()=>{const ue={logicalOperator:UILogicalOperator.ALL,onEmptyFilter:EmptyFilterOption.RETURN_NONE,groups:[]};return{condition:buildQuery$1(ue),conditionUI:ue}},branchAutomation:async(ue,eo)=>{var uo;const no=ue.at(-1);let ro=fp$1.cloneDeep(eo),oo,io=!1;const ao=fo=>({name:fo,...to.actions.generateDefaultConditions(),id:shortid.generate()});ue.forEach((fo,po,ho)=>{const{stepIdx:_o,branchIdx:go}=fo,bo=po===ho.length-1;if(oo||(bo?(oo=ro.definition.steps,io=!0):oo=ro.definition.steps[_o-1]),Number.isInteger(go)){const vo=oo.inputs.branches[go].id,yo=oo.inputs.children[vo];oo=bo?yo:yo[_o]}});const so=Math.max(no.stepIdx-1,0),lo=io?so:no.stepIdx;if(((uo=oo[lo])==null?void 0:uo.stepId)=="BRANCH"){let fo=oo[lo].inputs.branches;const po=ao(`Branch ${fo.length+1}`);fo.splice(fo.length,0,po),oo[lo].inputs.children[po.id]=[];try{await to.actions.save(ro)}catch(ho){notifications.error("Error adding branch to automation"),console.error("Error adding automation branch",ho)}return}const co=to.actions.generateBranchBlock();co.inputs.branches=Array.from({length:2}).map((fo,po)=>ao(`Branch ${po+1}`)),co.inputs.children=co.inputs.branches.reduce((fo,po,ho)=>(fo[po.id]=ho==0?oo.slice(lo+1):[],fo),{}),oo.splice(lo+1),oo.push(co);try{await to.actions.save(ro)}catch(fo){notifications.error("Error adding branch to automation"),console.error("Error adding automation branch",fo)}},branchLeft:async(ue,eo,no)=>{const ro=to.actions.shiftBranch(ue,no);if(ro){const oo=to.actions.updateStep(ue.slice(0,-1),eo,ro);await to.actions.save(oo)}},branchRight:async(ue,eo,no)=>{const ro=to.actions.shiftBranch(ue,no,1);if(ro){const oo=to.actions.updateStep(ue.slice(0,-1),eo,ro);await to.actions.save(oo)}},shiftBranch:(ue,eo,no=-1)=>{let ro=fp$1.cloneDeep(eo);const io=ue.at(-1).branchIdx;if(!ro.inputs.branches[io+no]){console.error("Invalid index");return}let[ao]=ro.inputs.branches.splice(io+no,1);return ro.inputs.branches.splice(io,0,ao),ro},deleteBranch:async(ue,eo)=>{let no=fp$1.cloneDeep(eo),ro=[];ue.forEach((oo,io,ao)=>{const{stepIdx:so,branchIdx:lo}=oo,co=io===ao.length-1;if(!ro.length){if(co){ro=no.definition.steps;return}ro=[{node:no.definition.steps[so-1],context:no.definition.steps}]}const uo=ro.at(-1);if(Number.isInteger(lo)){const fo=uo.node.inputs.branches[lo].id,po=uo.node.inputs.children[fo];if(co){const ho=uo.node.inputs.branches.length==2;if(uo.node.inputs.branches.splice(lo,1),delete uo.node.inputs.children[fo],ho){const _o=uo.node.inputs.branches[0].id,go=uo.node.inputs.children[_o],bo=ro.at(-1).context;bo.pop(),bo.splice(bo.length,0,...go)}return}ro.push({node:po[so],context:po})}});try{await to.actions.save(no)}catch(oo){notifications.error("Error deleting automation branch"),console.error("Error deleting automation branch",oo)}},saveAutomationName:async(ue,eo)=>{var io;const no=(io=get_store_value(selectedAutomation))==null?void 0:io.data;let ro=fp$1.cloneDeep(no);if(!ro)return;const oo=eo.trim();ro.definition.stepNames={...ro.definition.stepNames,[ue]:oo},await to.actions.save(ro)},deleteAutomationName:async ue=>{var ro;const eo=(ro=get_store_value(selectedAutomation))==null?void 0:ro.data;let no=fp$1.cloneDeep(eo);!eo||!no||(no!=null&&no.definition.stepNames&&delete no.definition.stepNames[ue],await to.actions.save(no))},deleteAutomationBlock:async ue=>{var ro;const eo=(ro=get_store_value(selectedAutomation))==null?void 0:ro.data;if(!eo)return;const{newAutomation:no}=to.actions.deleteBlock(ue,eo);try{await to.actions.save(no)}catch(oo){notifications.error("Error deleting automation block"),console.error("Automation deleting block ",oo)}},replace:(ue,eo)=>{if(!eo)to.store.update(no=>{var ro;return no.automations=no.automations.filter(oo=>oo._id!==ue),ue===no.selectedAutomationId&&to.actions.select(((ro=no.automations[0])==null?void 0:ro._id)||null),no});else{const no=get_store_value(to.store).automations.findIndex(ro=>ro._id===eo._id);no===-1?to.store.update(ro=>({...ro,automations:[...ro.automations,eo]})):to.store.update(ro=>(ro.automations[no]=eo,ro))}},create:async(ue,eo)=>{const no={name:ue,type:"automation",appId:get_store_value(appStore).appId,definition:{steps:[],trigger:eo},disabled:!1};return await to.actions.save(no)},duplicate:async ue=>await to.actions.save({...ue,name:`${ue.name} - copy`,_id:void 0,_rev:void 0}),toggleDisabled:async ue=>{let eo;try{if(eo=to.actions.getDefinition(ue),!eo)return;eo.disabled=!eo.disabled,await to.actions.save(eo),notifications.success(`Automation ${eo.disabled?"disabled":"enabled"} successfully`)}catch{notifications.error(`Error ${eo!=null&&eo.disabled?"disabling":"enabling"} automation`)}},definitions:async()=>{const ue=await API.getAutomationDefinitions();return to.update(eo=>(eo.blockDefinitions=getFinalDefinitions(ue.trigger,ue.action),eo)),ue},fetch:async()=>{const[ue,eo]=await Promise.all([API.getAutomations(),API.getAutomationDefinitions()]);to.update(no=>(no.automations=ue.automations,no.automations.sort((ro,oo)=>ro.name<oo.name?-1:1),no.blockDefinitions=getFinalDefinitions(eo.trigger,eo.action),no))},select:ue=>{!ue||ue===get_store_value(to).selectedAutomationId||to.update(eo=>(eo.selectedAutomationId=ue,eo.testResults=null,eo.showTestPanel=!1,eo))},getDefinition:ue=>{var eo;return(eo=get_store_value(to.store).automations)==null?void 0:eo.find(no=>no._id===ue)},save:async ue=>{const eo=await API.updateAutomation(ue);return await to.actions.fetch(),to.actions.select(eo.automation._id),eo.automation},delete:async ue=>{isRowAction(ue)?await rowActions.delete(ue.definition.trigger.inputs.tableId,ue.definition.trigger.inputs.rowActionId):await API.deleteAutomation(ue._id,ue._rev),to.update(no=>{var ro;return no.automations=no.automations.filter(oo=>oo._id!==ue._id),ue._id===no.selectedAutomationId&&(no.selectedAutomationId=((ro=no.automations[0])==null?void 0:ro._id)||null),no})}});class AutomationStore extends BudiStore{constructor(){super(initialAutomationState),this.actions=automationActions(this),this.history=createHistoryStore({getDoc:this.actions.getDefinition.bind(this),selectDoc:this.actions.select.bind(this),beforeAction:()=>{},afterAction:()=>{}});const ue=this.actions.save.bind(this.actions),eo=this.actions.delete.bind(this.actions);this.actions.save=this.history.wrapSaveDoc(ue),this.actions.delete=this.history.wrapDeleteDoc(eo)}}const automationStore=new AutomationStore,automationHistoryStore=automationStore.history;class SelectedAutomationStore extends DerivedBudiStore{constructor(ue){const eo=()=>derived(ue,no=>{var ao;if(!no.selectedAutomationId)return{data:null,blockRefs:{},...no};const ro=(ao=no.automations)==null?void 0:ao.find(so=>so._id===no.selectedAutomationId);if(!ro)return{data:null,blockRefs:{},...no};const oo={},io=fp$1.cloneDeep(ro);return io&&(ue.actions.traverse(oo,io),Object.values(oo).filter(so=>so.terminating).forEach(so=>{ue.actions.getPathSteps(so.pathTo,io).forEach((lo,co,uo)=>{migrateReferencesInObject({obj:lo,originalIndex:co,steps:uo})})})),{data:io,blockRefs:oo,...no}});super(initialAutomationState,eo)}}const selectedAutomation=new SelectedAutomationStore(automationStore);class UserStore extends BudiStore{constructor(){super([])}init(ue){this.set(ue)}updateUser(ue){const eo=get_store_value(this);eo.some(no=>no.sessionId===ue.sessionId)?this.update(no=>{const ro=no.findIndex(oo=>oo.sessionId===ue.sessionId);return no[ro]=ue,no.slice()}):this.set([...eo,ue])}removeUser(ue){this.update(eo=>eo.filter(no=>no.sessionId!==ue))}reset(){this.set([])}}const userStore=new UserStore,userSelectedResourceMap=derived(userStore,to=>{let ue={};return to.forEach(eo=>{var ro;const no=(ro=eo.builderMetadata)==null?void 0:ro.selectedResourceId;no&&(ue[no]||(ue[no]=[]),ue[no].push(eo))}),ue}),isOnlyUser=derived(userStore,to=>to.length<2),createDeploymentStore=()=>{let to=writable([]);const ue=async()=>{try{to.set(await API.getAppDeployments())}catch{notifications.error("Error fetching deployments")}};return{subscribe:to.subscribe,load:ue}},deploymentStore=createDeploymentStore(),INITIAL_CONTEXT_MENU_STATE={id:null,items:[],position:{x:0,y:0},visible:!1};function createViewsStore$1(){const to=writable({...INITIAL_CONTEXT_MENU_STATE}),ue=(no,ro,oo)=>{to.set({id:no,items:ro,position:oo,visible:!0})},eo=()=>{to.set({...INITIAL_CONTEXT_MENU_STATE})};return{subscribe:to.subscribe,open:ue,close:eo}}const contextMenuStore=createViewsStore$1();class SnippetStore extends BudiStore{constructor(){super([]),this.syncMetadata=ue=>{this.set((ue==null?void 0:ue.snippets)||[])},this.saveSnippet=async ue=>{const eo=[...get_store_value(this).filter(ro=>ro.name!==ue.name),ue],no=await API.saveAppMetadata(get_store_value(appStore).appId,{snippets:eo});this.syncMetadata(no)},this.deleteSnippet=async ue=>{const eo=get_store_value(this).filter(ro=>ro.name!==ue),no=await API.saveAppMetadata(get_store_value(appStore).appId,{snippets:eo});this.syncMetadata(no)}}}const snippets$1=new SnippetStore;function createViewsStore(){const to=writable({selectedViewName:null}),ue=derived([to,tables],([oo,io])=>{var so;let ao=[];return(so=io.list)==null||so.forEach(lo=>{const co=Object.values((lo==null?void 0:lo.views)||{}).filter(uo=>uo.version!==2);ao=ao.concat(co)}),{...oo,list:ao,selected:ao.find(lo=>lo.name===oo.selectedViewName)}}),eo=oo=>{to.update(io=>({...io,selectedViewName:oo}))},no=async oo=>{await API.deleteView(oo.name),tables.update(io=>{const ao=io.list.find(so=>so._id===oo.tableId);return delete ao.views[oo.name],{...io}})},ro=async oo=>{const io=await API.saveView(oo);eo(oo.name),tables.update(ao=>{const so=ao.list.find(lo=>lo._id===oo.tableId);return so&&(oo.originalName&&delete so.views[oo.originalName],so.views[oo.name]=io),{...ao}})};return{subscribe:ue.subscribe,select:eo,delete:no,save:ro}}const views=createViewsStore();function createPermissionStore(){const{subscribe:to}=writable([]);return{subscribe:to,save:async({level:ue,role:eo,resource:no})=>await API.updatePermissionForResource(no,eo,ue),remove:async({level:ue,role:eo,resource:no})=>await API.removePermissionFromResource(no,eo,ue),forResource:async ue=>(await API.getPermissionForResource(ue)).permissions,forResourceDetailed:async ue=>await API.getPermissionForResource(ue),getDependantsInfo:async ue=>await API.getDependants(ue)}}const permissions=createPermissionStore();class RoleStore extends DerivedBudiStore{constructor(){const ue=eo=>derived(eo,no=>no.map(ro=>{var oo,io,ao;return{...ro,uiMetadata:{displayName:((oo=ro.uiMetadata)==null?void 0:oo.displayName)||ro.name,color:((io=ro.uiMetadata)==null?void 0:io.color)||"var(--spectrum-global-color-magenta-400)",description:((ao=ro.uiMetadata)==null?void 0:ao.description)||"Custom role"}}}));super([],ue),this.setRoles=eo=>{this.set(eo.sort((no,ro)=>{var lo,co;const oo=getRolePriority(no._id),io=getRolePriority(ro._id);if(oo!==io)return oo>io?-1:1;const ao=((lo=no.uiMetadata)==null?void 0:lo.displayName)||no.name,so=((co=ro.uiMetadata)==null?void 0:co.displayName)||ro.name;return ao<so?-1:1}))},this.fetch=async()=>{const eo=await API.getRoles();this.setRoles(eo)},this.fetchByAppId=async eo=>{const{roles:no}=await API.getRolesForApp(eo);this.setRoles(no)},this.delete=async eo=>{!eo._id||!eo._rev||(await API.deleteRole(eo._id,eo._rev),await this.fetch())},this.save=async eo=>{const no=await API.saveRole(eo);return await this.fetch(),no},this.replace=(eo,no)=>{if(!eo)return;if(!no){this.update(oo=>oo.filter(io=>io._id!==eo));return}const ro=get_store_value(this).findIndex(oo=>oo._id===no._id);ro===-1?this.update(oo=>[...oo,no]):no&&this.update(oo=>(oo[ro]=no,[...oo]))}}}const roles=new RoleStore,INITIAL_STATE={},createIntegrationsStore=()=>{const to=writable(INITIAL_STATE);return{...to,init:async()=>{const eo=await API.getIntegrations(),no=Object.entries(eo).reduce((ro,[oo,io])=>(io&&(ro[oo]=io),ro),{});to.set(no)}}},integrations=createIntegrationsStore(),sortQueries=to=>{to.sort((ue,eo)=>ue.name.localeCompare(eo.name))};class QueryStore extends DerivedBudiStore{constructor(){const ue=eo=>derived(eo,no=>{var ro;return{list:no.list,selectedQueryId:no.selectedQueryId,selected:(ro=no.list)==null?void 0:ro.find(oo=>oo._id===no.selectedQueryId)}});super({list:[],selectedQueryId:null},ue),this.init=this.fetch,this.select=this.select.bind(this)}async fetch(){const ue=await API.getQueries();sortQueries(ue),this.store.update(eo=>({...eo,list:ue}))}async save(ue,eo){const no=get_store_value(integrations),ro=get_store_value(datasources).list.filter(io=>io._id===ue);if(ro.length!==0){const ao=no[ro[0].source].query[eo.queryVerb].readable;ao&&(eo.readable=ao)}eo.datasourceId=ue;const oo=await API.saveQuery(eo);return this.store.update(io=>{const ao=io.list.findIndex(lo=>lo._id===oo._id),so=io.list;return ao>=0?so.splice(ao,1,oo):so.push(oo),sortQueries(so),{list:so,selectedQueryId:oo._id||null}}),oo}async importQueries(ue){return await API.importQueries(ue)}select(ue){this.store.update(eo=>({...eo,selectedQueryId:ue}))}async preview(ue){const eo=await API.previewQuery(ue),no={};for(let[ro,oo]of Object.entries(eo.schema))no[ro]=oo||{type:"string"};return{...eo,schema:no,rows:eo.rows||[]}}async delete(ue){if(!ue._id||!ue._rev)throw new Error("Query ID or Revision is missing");await API.deleteQuery(ue._id,ue._rev),this.store.update(eo=>({...eo,list:eo.list.filter(no=>no._id!==ue._id)}))}async duplicate(ue){let eo=get_store_value(this.store).list;const no={...ue},ro=ue.datasourceId;return delete no._id,delete no._rev,no.name=duplicateName(ue.name,eo.map(oo=>oo.name)),await this.save(ro,no)}removeDatasourceQueries(ue){this.store.update(eo=>({...eo,list:eo.list.filter(no=>no.datasourceId!==ue)}))}}const queries=new QueryStore;class TableImportError extends Error{constructor(ue){super(),this.name="TableImportError",this.errors=ue}get description(){let ue="";for(const eo in this.errors)ue+=`${eo}: ${this.errors[eo]}
|
|
518
|
+
making the process more digestible for your users.</p>`},m(eo,no){insert$1(eo,ue,no)},p:noop$6,i:noop$6,o:noop$6,d(eo){eo&&detach(ue)}}}class NewFormSteps extends SvelteComponent{constructor(ue){super(),init$3(this,ue,null,create_fragment$9b,safe_not_equal,{})}}const ONBOARDING_EVENT_PREFIX="onboarding",TOUR_STEP_KEYS={BUILDER_APP_PUBLISH:"builder-app-publish",BUILDER_DATA_SECTION:"builder-data-section",BUILDER_DESIGN_SECTION:"builder-design-section",BUILDER_USER_MANAGEMENT:"builder-user-management",BUILDER_AUTOMATION_SECTION:"builder-automation-section",FEATURE_USER_MANAGEMENT:"feature-user-management",BUILDER_FORM_CREATE_STEPS:"builder-form-create-steps",BUILDER_FORM_VIEW_UPDATE_STEPS:"builder-form-view-update-steps",BUILDER_FORM_ROW_ID:"builder-form-row-id"},TOUR_KEYS={TOUR_BUILDER_ONBOARDING:"builder-onboarding",FEATURE_ONBOARDING:"feature-onboarding",BUILDER_FORM_CREATE:"builder-form-create",BUILDER_FORM_VIEW_UPDATE:"builder-form-view-update"},getCurrentStepIdx=(to,ue)=>{if(to!=null&&to.length)return to!=null&&to.length&&!ue?0:to.findIndex(eo=>eo.id===ue)},endUserOnboarding=async({skipped:to=!1}={})=>{if(get_store_value(auth).user){try{await API.updateSelf({onboardedAt:new Date().toISOString()}),to&&tourEvent("skipped"),await auth.getSelf(),builderStore.endBuilderOnboarding(),builderStore.setTour()}catch(ue){return console.error("Onboarding failed",ue),!1}return!0}},endTour=async({key:to,skipped:ue=!1}={})=>{const{tours:eo={}}=get_store_value(auth).user;eo[to]=new Date().toISOString(),await API.updateSelf({tours:eo}),ue&&tourEvent(to,ue),await auth.getSelf(),builderStore.setTour()},tourEvent=(to,ue)=>{analytics.captureEvent(`${ONBOARDING_EVENT_PREFIX}:${to}`,{eventSource:EventSource.PORTAL,skipped:ue})},getTours=()=>({[TOUR_KEYS.TOUR_BUILDER_ONBOARDING]:{steps:[{id:TOUR_STEP_KEYS.BUILDER_DATA_SECTION,title:"Data",route:"/builder/app/:application/data",layout:OnboardingData,query:".topleftnav .spectrum-Tabs-item#builder-data-tab",onLoad:async()=>{tourEvent(TOUR_STEP_KEYS.BUILDER_DATA_SECTION)},align:"left"},{id:TOUR_STEP_KEYS.BUILDER_DESIGN_SECTION,title:"Design",route:"/builder/app/:application/design",layout:OnboardingDesign,query:".topleftnav .spectrum-Tabs-item#builder-design-tab",onLoad:()=>{tourEvent(TOUR_STEP_KEYS.BUILDER_DESIGN_SECTION)},align:"left"},{id:TOUR_STEP_KEYS.BUILDER_AUTOMATION_SECTION,title:"Automations",route:"/builder/app/:application/automation",query:".topleftnav .spectrum-Tabs-item#builder-automation-tab",body:"Once you have your app screens made, you can set up automations to fit in with your current workflow",onLoad:()=>{tourEvent(TOUR_STEP_KEYS.BUILDER_AUTOMATION_SECTION)},align:"left"},{id:TOUR_STEP_KEYS.BUILDER_USER_MANAGEMENT,title:"Users",query:".toprightnav #builder-app-users-button",body:"Add users to your app and control what level of access they have.",onLoad:()=>{tourEvent(TOUR_STEP_KEYS.BUILDER_USER_MANAGEMENT)}},{id:TOUR_STEP_KEYS.BUILDER_APP_PUBLISH,title:"Publish",layout:OnboardingPublish,route:"/builder/app/:application/design",query:".toprightnav #builder-app-publish-button",onLoad:()=>{tourEvent(TOUR_STEP_KEYS.BUILDER_APP_PUBLISH)},onComplete:endUserOnboarding}],onSkip:async()=>{await endUserOnboarding({skipped:!0})},endRoute:"/builder/app/:application/data"},[TOUR_KEYS.FEATURE_ONBOARDING]:{steps:[{id:TOUR_STEP_KEYS.FEATURE_USER_MANAGEMENT,title:"Users",query:".toprightnav #builder-app-users-button",body:"Add users to your app and control what level of access they have.",onLoad:()=>{tourEvent(TOUR_STEP_KEYS.FEATURE_USER_MANAGEMENT)},onComplete:endUserOnboarding}]},[TOUR_KEYS.BUILDER_FORM_CREATE]:{steps:[{id:TOUR_STEP_KEYS.BUILDER_FORM_CREATE_STEPS,title:"Add multiple steps",layout:NewFormSteps,query:"#steps-prop-control-wrap",onComplete:()=>{builderStore.highlightSetting(),endTour({key:TOUR_KEYS.BUILDER_FORM_CREATE})},onLoad:()=>{tourEvent(TOUR_STEP_KEYS.BUILDER_FORM_CREATE_STEPS),builderStore.highlightSetting("steps","info")},align:"left-outside"}]},[TOUR_KEYS.BUILDER_FORM_VIEW_UPDATE]:{steps:[{id:TOUR_STEP_KEYS.BUILDER_FORM_ROW_ID,title:"Add row ID to update a row",layout:NewViewUpdateFormRowId,query:"#rowId-prop-control-wrap",onLoad:()=>{tourEvent(TOUR_STEP_KEYS.BUILDER_FORM_ROW_ID),builderStore.highlightSetting("rowId","info")},align:"left-outside"},{id:TOUR_STEP_KEYS.BUILDER_FORM_VIEW_UPDATE_STEPS,title:"Add multiple steps",layout:NewFormSteps,query:"#steps-prop-control-wrap",onComplete:()=>{builderStore.highlightSetting(),endTour({key:TOUR_KEYS.BUILDER_FORM_VIEW_UPDATE})},onLoad:()=>{tourEvent(TOUR_STEP_KEYS.BUILDER_FORM_VIEW_UPDATE_STEPS),builderStore.highlightSetting("steps","info")},align:"left-outside",scrollIntoView:!0}],onSkip:async()=>{builderStore.highlightSetting(),endTour({key:TOUR_KEYS.BUILDER_FORM_VIEW_UPDATE,skipped:!0})}}}),TOURS=getTours(),TOURSBYSTEP=Object.keys(TOURS).reduce((to,ue)=>(TOURS[ue].steps.forEach(eo=>{to[eo.id]=eo,to[eo.id].tour=ue}),to),{}),INITIAL_BUILDER_STATE={previousTopNavPath:{},highlightedSetting:null,propertyFocus:null,builderSidePanel:!1,onboarding:!1,tourNodes:null,tourKey:null,tourStepKey:null,hoveredComponentId:null};class BuilderStore extends BudiStore{constructor(){super({...INITIAL_BUILDER_STATE}),this.init=this.init.bind(this),this.refresh=this.refresh.bind(this),this.reset=this.reset.bind(this),this.highlightSetting=this.highlightSetting.bind(this),this.propertyFocus=this.propertyFocus.bind(this),this.hideBuilderSidePanel=this.hideBuilderSidePanel.bind(this),this.showBuilderSidePanel=this.showBuilderSidePanel.bind(this),this.setPreviousTopNavPath=this.setPreviousTopNavPath.bind(this),this.selectResource=this.selectResource.bind(this),this.registerTourNode=this.registerTourNode.bind(this),this.destroyTourNode=this.destroyTourNode.bind(this),this.startBuilderOnboarding=this.startBuilderOnboarding.bind(this)}init(ue){if(!(ue!=null&&ue.appId)){console.error("BuilderStore: No appId supplied for websocket");return}this.websocket||(this.websocket=createBuilderWebsocket(ue.appId))}refresh(){const ue=get_store_value(this.store);this.store.set(ue)}reset(){var ue;this.store.set({...INITIAL_BUILDER_STATE}),(ue=this.websocket)==null||ue.disconnect(),this.websocket=void 0}highlightSetting(ue,eo){this.update(no=>({...no,highlightedSetting:ue?{key:ue,type:eo||"info"}:null}))}propertyFocus(ue){this.update(eo=>({...eo,propertyFocus:ue}))}showBuilderSidePanel(){this.update(ue=>({...ue,builderSidePanel:!0}))}hideBuilderSidePanel(){this.update(ue=>({...ue,builderSidePanel:!1}))}setPreviousTopNavPath(ue,eo){this.update(no=>({...no,previousTopNavPath:{...no.previousTopNavPath||{},[ue]:eo}}))}selectResource(ue){var eo;(eo=this.websocket)==null||eo.emit(BuilderSocketEvent.SelectResource,{resourceId:ue})}registerTourNode(ue,eo){this.update(no=>({...no,tourNodes:{...no.tourNodes,[ue]:eo}}))}destroyTourNode(ue){var no;const eo=get_store_value(this.store);if((no=eo.tourNodes)!=null&&no[ue]){const ro={...eo.tourNodes};delete ro[ue],this.update(oo=>({...oo,tourNodes:ro}))}}startBuilderOnboarding(){this.update(ue=>({...ue,onboarding:!0,tourKey:TOUR_KEYS.TOUR_BUILDER_ONBOARDING}))}endBuilderOnboarding(){this.update(ue=>({...ue,onboarding:!1}))}setTour(ue){this.update(eo=>({...eo,tourStepKey:null,tourNodes:null,tourKey:ue||null}))}}const builderStore=new BuilderStore,INITIAL_HOVER_STATE={componentId:null};class HoverStore extends BudiStore{constructor(){super({...INITIAL_HOVER_STATE}),this.hover=this.hover.bind(this)}hover(ue,eo=!0){clearTimeout(this.hoverTimeout),ue?this.processHover(ue,eo):this.hoverTimeout=setTimeout(()=>{this.processHover(ue,eo)},10)}processHover(ue,eo){ue!==get_store_value(this.store).componentId&&(this.update(no=>(no.componentId=ue,no)),eo&&previewStore.sendEvent("hover-component",ue))}}const hoverStore=new HoverStore,INITIAL_PREVIEW_STATE={previewDevice:"desktop",previewEventHandler:null,showPreview:!1,selectedComponentContext:null};class PreviewStore extends BudiStore{constructor(){super(INITIAL_PREVIEW_STATE),this.setDevice=this.setDevice.bind(this),this.sendEvent=this.sendEvent.bind(this),this.registerEventHandler=this.registerEventHandler.bind(this),this.startDrag=this.startDrag.bind(this),this.stopDrag=this.stopDrag.bind(this),this.showPreview=this.showPreview.bind(this),this.setSelectedComponentContext=this.setSelectedComponentContext.bind(this),this.requestComponentContext=this.requestComponentContext.bind(this)}setDevice(ue){this.update(eo=>({...eo,previewDevice:ue}))}sendEvent(ue,eo){const{previewEventHandler:no}=get_store_value(this.store);no==null||no(ue,eo)}registerEventHandler(ue){this.update(eo=>({...eo,previewEventHandler:ue}))}startDrag(ue){this.sendEvent("dragging-new-component",{dragging:!0,component:ue})}stopDrag(){this.sendEvent("dragging-new-component",{dragging:!1})}showPreview(ue){this.update(eo=>({...eo,showPreview:ue}))}setSelectedComponentContext(ue){this.update(eo=>({...eo,selectedComponentContext:ue}))}requestComponentContext(){this.sendEvent("request-context")}}const previewStore=new PreviewStore,TriggerStepID={ROW_SAVED:"ROW_SAVED",ROW_UPDATED:"ROW_UPDATED",ROW_DELETED:"ROW_DELETED",ROW_ACTION:"ROW_ACTION",WEBHOOK:"WEBHOOK",APP:"APP",CRON:"CRON"},ActionStepID={SEND_EMAIL_SMTP:"SEND_EMAIL_SMTP",CREATE_ROW:"CREATE_ROW",UPDATE_ROW:"UPDATE_ROW",DELETE_ROW:"DELETE_ROW",OUTGOING_WEBHOOK:"OUTGOING_WEBHOOK",EXECUTE_SCRIPT:"EXECUTE_SCRIPT",EXECUTE_QUERY:"EXECUTE_QUERY",SERVER_LOG:"SERVER_LOG",DELAY:"DELAY",FILTER:"FILTER",QUERY_ROWS:"QUERY_ROWS",LOOP:"LOOP",COLLECT:"COLLECT",TRIGGER_AUTOMATION_RUN:"TRIGGER_AUTOMATION_RUN",discord:"discord",slack:"slack",zapier:"zapier",integromat:"integromat",n8n:"n8n"},Features={LOOPING:"LOOPING"};class TableStore extends DerivedBudiStore{constructor(){const ue=eo=>derived(eo,no=>{var ro;return{...no,selected:(ro=no.list)==null?void 0:ro.find(oo=>oo._id===no.selectedTableId)}});super({list:[],selectedTableId:void 0},ue),this.select=this.select.bind(this)}async init(){return this.fetch()}async fetch(){const ue=await API.getTables();this.store.update(eo=>({...eo,list:ue}))}async singleFetch(ue){const eo=await API.getTable(ue);this.store.update(no=>{const ro=[];for(let oo of no.list)eo._id===oo._id?ro.push(eo):ro.push(oo);return no.list=ro,no})}select(ue){this.store.update(eo=>({...eo,selectedTableId:ue}))}async save(ue){var lo;const eo=fp$1.cloneDeep(ue),no=get_store_value(this.store).list.filter(co=>co._id===ue._id)[0],ro=[];for(let co of Object.keys(eo.schema)){if(ro.indexOf(co.toLowerCase())!==-1){delete eo.schema[co];continue}const uo=eo.schema[co],fo=no==null?void 0:no.schema[co];fo!=null&&(fo==null?void 0:fo.type)!==uo.type&&!((lo=SWITCHABLE_TYPES[fo==null?void 0:fo.type])!=null&&lo.includes(uo.type))&&(eo.schema[co]=fo),uo.name&&uo.name!==co&&(eo.schema[uo.name]=uo,eo._rename={old:co,updated:uo.name},delete eo.schema[co]),ro.push(co.toLowerCase())}const oo=await API.saveTable(eo);this.replaceTable(oo._id,oo),this.select(oo._id);let io=[];for(let co of Object.values((eo==null?void 0:eo.schema)||{}))co.type===FieldType.LINK&&io.push(co.tableId);let ao=[];for(let co of Object.values((no==null?void 0:no.schema)||{}))co.type===FieldType.LINK&&ao.push(co.tableId);const so=[...new Set([...io,...ao])];return so.length>3?await this.fetch():await Promise.all(so.map(co=>this.singleFetch(co))),oo}async delete(ue){await API.deleteTable(ue._id,ue._rev),this.replaceTable(ue._id,null)}async saveField({originalName:ue,field:eo,primaryDisplay:no=!1,indexes:ro}){const oo=fp$1.cloneDeep(get_store_value(this.derivedStore).selected);if(ue!=null&&ue!==eo.name&&(delete oo.schema[ue],oo._rename={old:ue,updated:eo.name}),no)oo.primaryDisplay=eo.name;else if(oo.primaryDisplay===ue){const io=Object.keys(oo.schema);oo.primaryDisplay=io.filter(ao=>ao!==ue||ao!==eo.name)[0]}ro&&(oo.indexes=ro),oo.schema={...oo.schema,[eo.name]:fp$1.cloneDeep(eo)},await this.save(oo)}async deleteField(ue){let eo=fp$1.cloneDeep(get_store_value(this.derivedStore).selected);delete eo.schema[ue.name],await this.save(eo)}replaceTable(ue,eo){if(!ue)return;if(!eo){this.store.update(ro=>({...ro,list:ro.list.filter(oo=>oo._id!==ue)}));return}const no=get_store_value(this.store).list.findIndex(ro=>ro._id===eo._id);no===-1?this.store.update(ro=>({...ro,list:[...ro.list,eo]})):eo&&this.store.update(ro=>(ro.list[no]={...eo,type:ro.list[no].type},ro))}removeDatasourceTables(ue){this.store.update(eo=>({...eo,list:eo.list.filter(no=>no.sourceId!==ue)}))}}const tables=new TableStore;class ViewV2Store extends DerivedBudiStore{constructor(){const ue=eo=>derived([eo,tables],([no,ro])=>{var io;let oo=[];return(io=ro.list)==null||io.forEach(ao=>{const so=Object.values((ao==null?void 0:ao.views)||{}).filter(isV2);oo=oo.concat(so)}),{...no,list:oo,selected:oo.find(ao=>ao.id===no.selectedViewId)}});super({selectedViewId:null},ue),this.select=this.select.bind(this)}select(ue){this.store.update(eo=>({...eo,selectedViewId:ue}))}async delete(ue){await API.viewV2.delete(ue.id),this.replaceView(ue.id,null)}async create(ue){const no=(await API.viewV2.create(ue)).data;return this.replaceView(no.id,no),no}async save(ue){const eo=await API.viewV2.update(ue),no=eo==null?void 0:eo.data;this.replaceView(ue.id,no)}replaceView(ue,eo){const no=get_store_value(this.derivedStore).list.find(oo=>oo.id===ue),ro=get_store_value(tables).list.findIndex(oo=>oo._id===(eo==null?void 0:eo.tableId)||oo._id===(no==null?void 0:no.tableId));if(ro!==-1)if(!eo&&no){tables.update(oo=>(delete oo.list[ro].views[no.name],oo));return}else!no&&eo?tables.update(oo=>{var io;return(io=oo.list[ro]).views??(io.views={}),oo.list[ro].views[eo.name]=eo,oo}):no&&eo&&tables.update(oo=>{var io;return(io=oo.list[ro]).views??(io.views={}),delete oo.list[ro].views[no.name],oo.list[ro].views[eo.name]=eo,oo})}}const viewsV2=new ViewV2Store,duplicateName=(to,ue)=>{const eo=new RegExp("\\s(\\d+)$"),no=to.split(eo)[0],ro=new RegExp(`${no}\\s(\\d+)$`),oo=[];ue.filter(ao=>{if(ao===no)return!0;const so=ao.match(ro);return so?(oo.push(parseInt(so[1])),!0):!1}),oo.sort((ao,so)=>ao-so);let io;if(oo.length===0)io=1;else{for(let ao=0;ao<oo.length;ao++)if(oo[ao]!==ao+1){io=ao+1;break}io||(io=oo.length+1)}return`${no} ${io}`},getSequentialName=(to,ue,{getName:eo,numberFirstItem:no}={})=>{if(!(ue!=null&&ue.length))return null;const ro=ue.trim(),oo=no?`${ue}1`:ro;if(!(to!=null&&to.length))return oo;let io=0;return to.forEach(ao=>{const so=(eo==null?void 0:eo(ao))??ao;if(typeof so!="string"||!so.startsWith(ro))return;const lo=so.split(ro);if(lo.length!==2)return;lo[1].trim()===""&&(lo[1]="1");const co=parseInt(lo[1]);co>io&&(io=co)}),io===0?oo:`${ue}${io+1}`},initialState$1={};class RowActionStore extends BudiStore{constructor(){super(initialState$1),this.reset=()=>{this.set(initialState$1)},this.refreshRowActions=async ue=>{var oo;if(!ue)return;let eo=(oo=get_store_value(tables).list.find(io=>io._id===ue))==null?void 0:oo._id;if(!eo){const io=get_store_value(viewsV2).list.find(ao=>ao.id===ue);eo=io==null?void 0:io.tableId}if(!eo)return;const no=await API.rowActions.fetch(eo),ro=Object.values(no||{});this.update(io=>({...io,[eo]:ro}))},this.createRowAction=async(ue,eo,no)=>{if(!ue)return;if(!no){const oo=get_store_value(this)[ue]||[];no=getSequentialName(oo,"New row action ",{getName:io=>io.name})}if(!no)throw new Error("Failed to generate a unique name for the row action");const ro=await API.rowActions.create(ue,no);return eo?await Promise.all([this.enableView(ue,ro.id,eo),automationStore.actions.fetch()]):await Promise.all([this.refreshRowActions(ue),automationStore.actions.fetch()]),ro},this.enableView=async(ue,eo,no)=>{await API.rowActions.enableView(ue,eo,no),await this.refreshRowActions(ue)},this.disableView=async(ue,eo,no)=>{await API.rowActions.disableView(ue,eo,no),await this.refreshRowActions(ue)},this.delete=async(ue,eo)=>{await API.rowActions.delete(ue,eo),await this.refreshRowActions(ue)},this.trigger=async(ue,eo,no)=>{await API.rowActions.trigger(ue,eo,no)}}}const store=new RowActionStore,derivedStore=derived(store,to=>{const ue={};return Object.keys(to||{}).forEach(eo=>{ue[eo]=to[eo];for(let no of to[eo]){const ro=(no.allowedSources||[]).filter(oo=>oo!==eo);for(let oo of ro)ue[oo]??(ue[oo]=[]),ue[oo].push(no)}}),ue}),rowActions={...store,subscribe:derivedStore.subscribe},getNewStepName=(to,ue)=>{const eo=ue.name,no=oo=>oo.reduce((io,ao)=>(ao.name&&ao.name.startsWith(eo)&&io++,ao.stepId===AutomationActionStepId.BRANCH&&ao.inputs&&ao.inputs.children&&Object.values(ao.inputs.children).forEach(so=>{io+=no(so)}),io),0);let ro=0;return to!=null&&to.definition&&(ro=no(to.definition.steps)),ro===0?eo:`${eo} ${ro+1}`},initialAutomationState={automations:[],testResults:null,showTestPanel:!1,blockDefinitions:{TRIGGER:{},CREATABLE_TRIGGER:{},ACTION:{}},selectedAutomationId:null},getFinalDefinitions=(to,ue)=>{const eo={};return Object.entries(to).forEach(no=>{no[0]!==AutomationTriggerStepId.ROW_ACTION&&(eo[no[0]]=no[1])}),{TRIGGER:to,CREATABLE_TRIGGER:eo,ACTION:ue}},automationActions=to=>({moveBlock:async(ue,eo,no)=>{const ro=ue.at(-1),oo=eo.at(-1),io=(ro==null?void 0:ro.id)===(oo==null?void 0:oo.id),ao=(oo==null?void 0:oo.branchStepId)&&oo.branchIdx===(ro==null?void 0:ro.branchIdx)&&(ro==null?void 0:ro.stepIdx)===0;if(io||ao)return;const{deleted:so,newAutomation:lo}=to.actions.deleteBlock(ue,no),co={};to.actions.traverse(co,lo);let uo;oo!=null&&oo.branchStepId?(uo=co[oo.branchStepId].pathTo,uo.push(oo)):(oo!=null&&oo.id&&(uo=co[oo.id].pathTo),uo.at(-1).stepIdx+=1);const fo=to.actions.updateStep(uo,lo,so,!0);try{await to.actions.save(fo)}catch(po){notifications.error("Error moving automation block"),console.error("Error moving automation block ",po)}},deleteBlock:(ue,eo)=>{let no=fp$1.cloneDeep(eo);const ro=[no.definition.trigger,...no.definition.steps];let oo;return ue.forEach((io,ao,so)=>{const lo=ao===so.length-1,{stepIdx:co,branchIdx:uo}=io,fo=(po,ho)=>{const _o=po[ho],go=[_o.id],bo=[],vo={};po.forEach(wo=>{const{blockToLoop:ko,id:So}=wo;ko&&(vo[ko]=So)});const yo=vo[_o.id];yo&&go.push(yo);for(let wo=po.length-1;wo>=0;wo--)if(go.includes(po[wo].id)){const[ko]=po.splice(wo,1);bo.unshift(ko)}return{deleted:bo,newAutomation:no}};if(!oo){lo?oo=fo(no.definition.steps,co>0?co-1:0):oo=ro[co];return}if(Number.isInteger(uo)){const po=oo.inputs.branches[uo].id,ho=oo.inputs.children[po],_o=ho[co];lo?oo=fo(ho,co):oo=_o}}),oo},registerBlock:(ue,eo,no,ro)=>{ue[eo.id]={...ue[eo.id]||{},pathTo:no,terminating:ro||!1,...eo.blockToLoop?{blockToLoop:eo.blockToLoop}:{}},eo.blockToLoop&&(ue[eo.blockToLoop]={...ue[eo.blockToLoop]||{},looped:eo.id})},getPathSteps:(ue,eo)=>{const no=[eo.definition.trigger,...eo.definition.steps];let ro=[];return ue.forEach(oo=>{const{stepIdx:io,branchIdx:ao}=oo;let so=ro.length?ro[ro.length-1]:[];if(!ro.length){ro=no.slice(0,io+1);return}if(so&&"inputs"in so&&Number.isInteger(ao)){const lo=so.inputs.branches[ao].id,uo=so.inputs.children[lo].slice(0,io+1);ro=ro.concat(uo)}}),ro},updateStep:(ue,eo,no,ro=!1)=>{let oo=fp$1.cloneDeep(eo);const io=(so,lo,co)=>{so.splice(lo,ro?0:Array.isArray(co)?co.length:1,...Array.isArray(co)?co:[co])};let ao=null;return ue.forEach((so,lo,co)=>{const{stepIdx:uo,branchIdx:fo}=so;let po=lo===co.length-1;if(!ao){let ho=Math.max(uo-1,0);if(po){io(oo.definition.steps,ho,no);return}ao=oo.definition.steps[ho]}if(Number.isInteger(fo)){const ho=ao.inputs.branches[fo].id,_o=ao.inputs.children[ho];po?io(_o,uo,no):ao=_o[uo]}}),oo},buildEnvironmentBindings:()=>get_store_value(licensing).environmentVariablesEnabled?getEnvironmentBindings().map(ue=>({...ue,display:{...ue.display,rank:98}})):[],buildUserBindings:()=>getUserBindings().map(ue=>({...ue,category:"User",display:{...ue.display,rank:98}})),buildSettingBindings:()=>getSettingBindings().map(ue=>({...ue,display:{...ue.display,rank:98}})),getPathBindings:ue=>{var no,ro;const eo=(no=get_store_value(selectedAutomation))==null?void 0:no.blockRefs[ue];return to.actions.getAvailableBindings(eo,(ro=get_store_value(selectedAutomation))==null?void 0:ro.data)},traverse:(ue,eo)=>{var oo;let no=[];if(!eo||!ue)return;(oo=eo.definition)!=null&&oo.trigger&&no.push(eo.definition.trigger),no=no.concat(eo.definition.steps||[]);const ro=(io,ao,so,lo,co)=>{var po;const uo=[...ao||[],{...Number.isInteger(lo)?{branchIdx:lo}:{},stepIdx:so,id:io.id}],fo=((po=io.inputs)==null?void 0:po.branches)||[];fo.forEach((ho,_o)=>{var go;(go=io.inputs)==null||go.children[ho.id].forEach((bo,vo,yo)=>{var ko,So;const wo=yo.length-1===vo&&!((So=(ko=bo.inputs)==null?void 0:ko.branches)!=null&&So.length);ro(bo,uo,vo,_o,wo)})}),to.actions.registerBlock(ue,io,uo,co&&!fo.length)};return no.forEach((io,ao,so)=>{ro(io,null,ao,null,so.length-1===ao)}),ue},getAvailableBindings:(ue,eo)=>{var lo,co,uo,fo,po,ho,_o;if(!ue||!(eo!=null&&eo.definition))return[];const no=(lo=get_store_value(selectedAutomation))==null?void 0:lo.blockRefs,ro=to.actions.getPathSteps(ue.pathTo,eo).slice(0,-1),oo=to.actions.getPathSteps(ue.pathTo,eo).at(-1);let io=[];const ao=(go,bo,vo,yo,wo,ko)=>{if(!go)return;const So=to.actions.determineRuntimeBinding(go,yo,wo,ko,eo,oo,ro),Eo=to.actions.determineCategoryName(yo,wo,ko,so);io.push(to.actions.createBindingObject(go,bo,vo,yo,so,wo,So,Eo,ko))};let so=0;for(let go=0;go<ro.length;go++){const bo=ro[go],vo=((co=eo.definition.stepNames)==null?void 0:co[bo.id])||bo.name;let yo=fp$1.cloneDeep((fo=(uo=bo==null?void 0:bo.schema)==null?void 0:uo.outputs)==null?void 0:fo.properties)??{},wo=!1;bo.blockToLoop&&(wo=bo.stepId===ActionStepID.LOOP&&bo.blockToLoop in no);const ko=bo.type===AutomationStepType.TRIGGER;wo&&so==0&&(yo={currentItem:{type:AutomationIOType.STRING,description:"the item currently being executed"}});const So=ko?bo.icon:wo?"Reuse":bo.icon;if(go===0&&ko)if(bo.event===AutomationEventType.ROW_UPDATE||bo.event===AutomationEventType.ROW_SAVE){let Eo=get_store_value(tables).list.find(Io=>Io._id===bo.inputs.tableId);for(const Io in Eo==null?void 0:Eo.schema)yo[Io]={type:Eo.schema[Io].type,subtype:Eo.schema[Io].subtype};delete yo.row}else bo.event===AutomationEventType.APP_TRIGGER&&(yo=Object.fromEntries(Object.keys(bo.inputs.fields||[]).map(Eo=>[Eo,{type:bo.inputs.fields[Eo]}])));if((po=no[bo.id])!=null&&po.looped){so++;const Eo=no[bo.id].looped,Io=ro.find(Ao=>Ao.id===Eo);Io?yo=fp$1.cloneDeep((_o=(ho=Io.schema)==null?void 0:ho.outputs)==null?void 0:_o.properties):console.error("Loop block missing.")}Object.entries(yo).forEach(([Eo,Io])=>{ao(Eo,Io,So,go,wo,vo)})}return ue.looped||(io=io.filter(go=>!go.readableBinding.includes("loop"))),io},determineRuntimeBinding:(ue,eo,no,ro,oo,io,ao)=>{var lo,co,uo;let so;if(eo===0&&((lo=oo.definition.trigger)==null?void 0:lo.event)===AutomationEventType.APP_TRIGGER)return`trigger.fields.${ue}`;if(eo===0&&(((co=oo.definition.trigger)==null?void 0:co.event)===AutomationEventType.ROW_UPDATE||((uo=oo.definition.trigger)==null?void 0:uo.event)===AutomationEventType.ROW_SAVE)&&!["id","revision","oldRow"].includes(ue))return`trigger.row.${ue}`;if(no)so=`loop.${ue}`;else if(eo===0)so=`trigger.${ue}`;else if((io==null?void 0:io.stepId)===AutomationActionStepId.EXECUTE_SCRIPT){const fo=ao[eo].id;if(!fo)return notifications.error("Error generating binding: Step ID not found."),null;so=`steps["${fo}"].${ue}`}else{const fo=ao[eo].id;if(!fo)return notifications.error("Error generating binding: Step ID not found."),null;so=`steps.${fo}.${ue}`}return so},determineCategoryName:(ue,eo,no,ro)=>ue===0?"Trigger outputs":eo?"Loop Outputs":no?`${no} outputs`:`Step ${ue-ro} outputs`,createBindingObject:(ue,eo,no,ro,oo,io,ao,so,lo)=>{const co=Object.values(FIELDS).find(uo=>uo.type===eo.type&&("subtype"in uo?uo.subtype===eo.subtype:!0));return{readableBinding:lo&&!io&&ro!==0?`steps.${lo}.${ue}`:ao,runtimeBinding:ao,type:eo.type,description:eo.description,icon:no,category:so,display:{type:(co==null?void 0:co.name)||eo.type,name:ue,rank:io?ro+1:ro-oo}}},processBlockInputs:async(ue,eo)=>{var io;let no={...ue,inputs:{...ue.inputs,...eo}};Object.keys(no.inputs).forEach(ao=>{const so=no.inputs[ao];(so==null||so==="")&&delete no.inputs[ao]});const ro=(io=get_store_value(selectedAutomation))==null?void 0:io.data;if(!ro)return!1;const oo=to.actions.getUpdatedDefinition(ro,no);return JSON.stringify(oo)===JSON.stringify(ro)?!1:oo},updateBlockInputs:async(ue,eo)=>{const no=await to.actions.processBlockInputs(ue,eo);no!==!1&&await to.actions.save(no)},test:async(ue,eo)=>{var ro,oo;let no;try{no=await API.testAutomation(ue._id,eo)}catch(io){throw`Automation test failed - ${io.message||io.status||JSON.stringify(io)}`}if(!(no!=null&&no.trigger)&&!((ro=no==null?void 0:no.steps)!=null&&ro.length)&&!(no!=null&&no.message))throw((oo=no==null?void 0:no.err)==null?void 0:oo.code)==="usage_limit_exceeded"?"You have exceeded your automation quota":"Something went wrong testing your automation";to.update(io=>(io.testResults=no,io))},getUpdatedDefinition:(ue,eo)=>{var ro;let no;if(((ro=ue.definition.trigger)==null?void 0:ro.id)===eo.id)no=fp$1.cloneDeep(ue),no.definition.trigger=eo;else{const oo=get_store_value(selectedAutomation).blockRefs[eo.id].pathTo;no=to.actions.updateStep(oo,ue,eo)}return no},getLogs:async({automationId:ue,startDate:eo,status:no,page:ro}={})=>await API.getAutomationLogs({automationId:ue,startDate:eo,status:no,page:ro}),clearLogErrors:async({automationId:ue,appId:eo})=>{if(!ue||!eo)throw new Error("automationId and appId are required");return await API.clearAutomationLogErrors(ue,eo)},addTestDataToAutomation:ue=>{var no;let eo=fp$1.cloneDeep((no=get_store_value(selectedAutomation))==null?void 0:no.data);return eo&&(eo.testData={...eo.testData,...ue},eo)},constructBlock:(ue,eo,no)=>{var io;const ro={...no,inputs:no.inputs||{},stepId:eo,type:ue,id:shortid.generate()},oo=getNewStepName((io=get_store_value(selectedAutomation))==null?void 0:io.data,ro);return ro.name=oo,ro},generateBranchBlock:()=>{const ue=get_store_value(to).blockDefinitions.ACTION.BRANCH;return to.actions.constructBlock("ACTION","BRANCH",ue)},addBlockToAutomation:async(ue,eo)=>{var ao;const no=(ao=get_store_value(selectedAutomation))==null?void 0:ao.data;if(!no)return;let ro=fp$1.cloneDeep(no);const oo=[ro.definition.trigger,...ro.definition.steps];let io;eo.forEach((so,lo,co)=>{const{stepIdx:uo,branchIdx:fo}=so,po=lo===co.length-1,ho=(_o,go)=>{const bo=!Number.isInteger(go),vo=ue.blockToLoop||bo?go:go+1;_o.splice(vo,0,ue)};if(!io){po?(ho(ro.definition.steps,uo-1),io=ue):io=oo[uo];return}if(Number.isInteger(fo)){const _o=io.inputs.branches[fo].id,go=io.inputs.children[_o];po?(ho(go,uo),io=go):io=go[uo]}});try{await to.actions.save(ro)}catch(so){notifications.error("Error adding automation block"),console.error("Automation adding block ",so)}},generateDefaultConditions:()=>{const ue={logicalOperator:UILogicalOperator.ALL,onEmptyFilter:EmptyFilterOption.RETURN_NONE,groups:[]};return{condition:buildQuery$1(ue),conditionUI:ue}},branchAutomation:async(ue,eo)=>{var uo;const no=ue.at(-1);let ro=fp$1.cloneDeep(eo),oo,io=!1;const ao=fo=>({name:fo,...to.actions.generateDefaultConditions(),id:shortid.generate()});ue.forEach((fo,po,ho)=>{const{stepIdx:_o,branchIdx:go}=fo,bo=po===ho.length-1;if(oo||(bo?(oo=ro.definition.steps,io=!0):oo=ro.definition.steps[_o-1]),Number.isInteger(go)){const vo=oo.inputs.branches[go].id,yo=oo.inputs.children[vo];oo=bo?yo:yo[_o]}});const so=Math.max(no.stepIdx-1,0),lo=io?so:no.stepIdx;if(((uo=oo[lo])==null?void 0:uo.stepId)=="BRANCH"){let fo=oo[lo].inputs.branches;const po=ao(`Branch ${fo.length+1}`);fo.splice(fo.length,0,po),oo[lo].inputs.children[po.id]=[];try{await to.actions.save(ro)}catch(ho){notifications.error("Error adding branch to automation"),console.error("Error adding automation branch",ho)}return}const co=to.actions.generateBranchBlock();co.inputs.branches=Array.from({length:2}).map((fo,po)=>ao(`Branch ${po+1}`)),co.inputs.children=co.inputs.branches.reduce((fo,po,ho)=>(fo[po.id]=ho==0?oo.slice(lo+1):[],fo),{}),oo.splice(lo+1),oo.push(co);try{await to.actions.save(ro)}catch(fo){notifications.error("Error adding branch to automation"),console.error("Error adding automation branch",fo)}},branchLeft:async(ue,eo,no)=>{const ro=to.actions.shiftBranch(ue,no);if(ro){const oo=to.actions.updateStep(ue.slice(0,-1),eo,ro);await to.actions.save(oo)}},branchRight:async(ue,eo,no)=>{const ro=to.actions.shiftBranch(ue,no,1);if(ro){const oo=to.actions.updateStep(ue.slice(0,-1),eo,ro);await to.actions.save(oo)}},shiftBranch:(ue,eo,no=-1)=>{let ro=fp$1.cloneDeep(eo);const io=ue.at(-1).branchIdx;if(!ro.inputs.branches[io+no]){console.error("Invalid index");return}let[ao]=ro.inputs.branches.splice(io+no,1);return ro.inputs.branches.splice(io,0,ao),ro},deleteBranch:async(ue,eo)=>{let no=fp$1.cloneDeep(eo),ro=[];ue.forEach((oo,io,ao)=>{const{stepIdx:so,branchIdx:lo}=oo,co=io===ao.length-1;if(!ro.length){if(co){ro=no.definition.steps;return}ro=[{node:no.definition.steps[so-1],context:no.definition.steps}]}const uo=ro.at(-1);if(Number.isInteger(lo)){const fo=uo.node.inputs.branches[lo].id,po=uo.node.inputs.children[fo];if(co){const ho=uo.node.inputs.branches.length==2;if(uo.node.inputs.branches.splice(lo,1),delete uo.node.inputs.children[fo],ho){const _o=uo.node.inputs.branches[0].id,go=uo.node.inputs.children[_o],bo=ro.at(-1).context;bo.pop(),bo.splice(bo.length,0,...go)}return}ro.push({node:po[so],context:po})}});try{await to.actions.save(no)}catch(oo){notifications.error("Error deleting automation branch"),console.error("Error deleting automation branch",oo)}},saveAutomationName:async(ue,eo)=>{var io;const no=(io=get_store_value(selectedAutomation))==null?void 0:io.data;let ro=fp$1.cloneDeep(no);if(!ro)return;const oo=eo.trim();ro.definition.stepNames={...ro.definition.stepNames,[ue]:oo},await to.actions.save(ro)},deleteAutomationName:async ue=>{var ro;const eo=(ro=get_store_value(selectedAutomation))==null?void 0:ro.data;let no=fp$1.cloneDeep(eo);!eo||!no||(no!=null&&no.definition.stepNames&&delete no.definition.stepNames[ue],await to.actions.save(no))},deleteAutomationBlock:async ue=>{var ro;const eo=(ro=get_store_value(selectedAutomation))==null?void 0:ro.data;if(!eo)return;const{newAutomation:no}=to.actions.deleteBlock(ue,eo);try{await to.actions.save(no)}catch(oo){notifications.error("Error deleting automation block"),console.error("Automation deleting block ",oo)}},replace:(ue,eo)=>{if(!eo)to.store.update(no=>{var ro;return no.automations=no.automations.filter(oo=>oo._id!==ue),ue===no.selectedAutomationId&&to.actions.select(((ro=no.automations[0])==null?void 0:ro._id)||null),no});else{const no=get_store_value(to.store).automations.findIndex(ro=>ro._id===eo._id);no===-1?to.store.update(ro=>({...ro,automations:[...ro.automations,eo]})):to.store.update(ro=>(ro.automations[no]=eo,ro))}},create:async(ue,eo)=>{const no={name:ue,type:"automation",appId:get_store_value(appStore).appId,definition:{steps:[],trigger:eo},disabled:!1};return await to.actions.save(no)},duplicate:async ue=>await to.actions.save({...ue,name:`${ue.name} - copy`,_id:void 0,_rev:void 0}),toggleDisabled:async ue=>{let eo;try{if(eo=to.actions.getDefinition(ue),!eo)return;eo.disabled=!eo.disabled,await to.actions.save(eo),notifications.success(`Automation ${eo.disabled?"disabled":"enabled"} successfully`)}catch{notifications.error(`Error ${eo!=null&&eo.disabled?"disabling":"enabling"} automation`)}},definitions:async()=>{const ue=await API.getAutomationDefinitions();return to.update(eo=>(eo.blockDefinitions=getFinalDefinitions(ue.trigger,ue.action),eo)),ue},fetch:async()=>{const[ue,eo]=await Promise.all([API.getAutomations(),API.getAutomationDefinitions()]);to.update(no=>(no.automations=ue.automations,no.automations.sort((ro,oo)=>ro.name<oo.name?-1:1),no.blockDefinitions=getFinalDefinitions(eo.trigger,eo.action),no))},select:ue=>{!ue||ue===get_store_value(to).selectedAutomationId||to.update(eo=>(eo.selectedAutomationId=ue,eo.testResults=null,eo.showTestPanel=!1,eo))},getDefinition:ue=>{var eo;return(eo=get_store_value(to.store).automations)==null?void 0:eo.find(no=>no._id===ue)},save:async ue=>{const eo=await API.updateAutomation(ue);return await to.actions.fetch(),to.actions.select(eo.automation._id),eo.automation},delete:async ue=>{isRowAction(ue)?await rowActions.delete(ue.definition.trigger.inputs.tableId,ue.definition.trigger.inputs.rowActionId):await API.deleteAutomation(ue._id,ue._rev),to.update(no=>{var ro;return no.automations=no.automations.filter(oo=>oo._id!==ue._id),ue._id===no.selectedAutomationId&&(no.selectedAutomationId=((ro=no.automations[0])==null?void 0:ro._id)||null),no})}});class AutomationStore extends BudiStore{constructor(){super(initialAutomationState),this.actions=automationActions(this),this.history=createHistoryStore({getDoc:this.actions.getDefinition.bind(this),selectDoc:this.actions.select.bind(this),beforeAction:()=>{},afterAction:()=>{}});const ue=this.actions.save.bind(this.actions),eo=this.actions.delete.bind(this.actions);this.actions.save=this.history.wrapSaveDoc(ue),this.actions.delete=this.history.wrapDeleteDoc(eo)}}const automationStore=new AutomationStore,automationHistoryStore=automationStore.history;class SelectedAutomationStore extends DerivedBudiStore{constructor(ue){const eo=()=>derived(ue,no=>{var ao;if(!no.selectedAutomationId)return{data:null,blockRefs:{},...no};const ro=(ao=no.automations)==null?void 0:ao.find(so=>so._id===no.selectedAutomationId);if(!ro)return{data:null,blockRefs:{},...no};const oo={},io=fp$1.cloneDeep(ro);return io&&(ue.actions.traverse(oo,io),Object.values(oo).filter(so=>so.terminating).forEach(so=>{ue.actions.getPathSteps(so.pathTo,io).forEach((lo,co,uo)=>{migrateReferencesInObject({obj:lo,originalIndex:co,steps:uo})})})),{data:io,blockRefs:oo,...no}});super(initialAutomationState,eo)}}const selectedAutomation=new SelectedAutomationStore(automationStore);class UserStore extends BudiStore{constructor(){super([])}init(ue){this.set(ue)}updateUser(ue){const eo=get_store_value(this);eo.some(no=>no.sessionId===ue.sessionId)?this.update(no=>{const ro=no.findIndex(oo=>oo.sessionId===ue.sessionId);return no[ro]=ue,no.slice()}):this.set([...eo,ue])}removeUser(ue){this.update(eo=>eo.filter(no=>no.sessionId!==ue))}reset(){this.set([])}}const userStore=new UserStore,userSelectedResourceMap=derived(userStore,to=>{let ue={};return to.forEach(eo=>{var ro;const no=(ro=eo.builderMetadata)==null?void 0:ro.selectedResourceId;no&&(ue[no]||(ue[no]=[]),ue[no].push(eo))}),ue}),isOnlyUser=derived(userStore,to=>to.length<2),createDeploymentStore=()=>{let to=writable([]);const ue=async()=>{try{to.set(await API.getAppDeployments())}catch{notifications.error("Error fetching deployments")}};return{subscribe:to.subscribe,load:ue}},deploymentStore=createDeploymentStore(),INITIAL_CONTEXT_MENU_STATE={id:null,items:[],position:{x:0,y:0},visible:!1};function createViewsStore$1(){const to=writable({...INITIAL_CONTEXT_MENU_STATE}),ue=(no,ro,oo)=>{to.set({id:no,items:ro,position:oo,visible:!0})},eo=()=>{to.set({...INITIAL_CONTEXT_MENU_STATE})};return{subscribe:to.subscribe,open:ue,close:eo}}const contextMenuStore=createViewsStore$1();class SnippetStore extends BudiStore{constructor(){super([]),this.syncMetadata=ue=>{this.set((ue==null?void 0:ue.snippets)||[])},this.saveSnippet=async ue=>{const eo=[...get_store_value(this).filter(ro=>ro.name!==ue.name),ue],no=await API.saveAppMetadata(get_store_value(appStore).appId,{snippets:eo});this.syncMetadata(no)},this.deleteSnippet=async ue=>{const eo=get_store_value(this).filter(ro=>ro.name!==ue),no=await API.saveAppMetadata(get_store_value(appStore).appId,{snippets:eo});this.syncMetadata(no)}}}const snippets$1=new SnippetStore;function createViewsStore(){const to=writable({selectedViewName:null}),ue=derived([to,tables],([oo,io])=>{var so;let ao=[];return(so=io.list)==null||so.forEach(lo=>{const co=Object.values((lo==null?void 0:lo.views)||{}).filter(uo=>uo.version!==2);ao=ao.concat(co)}),{...oo,list:ao,selected:ao.find(lo=>lo.name===oo.selectedViewName)}}),eo=oo=>{to.update(io=>({...io,selectedViewName:oo}))},no=async oo=>{await API.deleteView(oo.name),tables.update(io=>{const ao=io.list.find(so=>so._id===oo.tableId);return delete ao.views[oo.name],{...io}})},ro=async oo=>{const io=await API.saveView(oo);eo(oo.name),tables.update(ao=>{const so=ao.list.find(lo=>lo._id===oo.tableId);return so&&(oo.originalName&&delete so.views[oo.originalName],so.views[oo.name]=io),{...ao}})};return{subscribe:ue.subscribe,select:eo,delete:no,save:ro}}const views=createViewsStore();function createPermissionStore(){const{subscribe:to}=writable([]);return{subscribe:to,save:async({level:ue,role:eo,resource:no})=>await API.updatePermissionForResource(no,eo,ue),remove:async({level:ue,role:eo,resource:no})=>await API.removePermissionFromResource(no,eo,ue),forResource:async ue=>(await API.getPermissionForResource(ue)).permissions,forResourceDetailed:async ue=>await API.getPermissionForResource(ue),getDependantsInfo:async ue=>await API.getDependants(ue)}}const permissions=createPermissionStore();class RoleStore extends DerivedBudiStore{constructor(){const ue=eo=>derived(eo,no=>no.map(ro=>{var oo,io,ao;return{...ro,uiMetadata:{displayName:((oo=ro.uiMetadata)==null?void 0:oo.displayName)||ro.name,color:((io=ro.uiMetadata)==null?void 0:io.color)||"var(--spectrum-global-color-magenta-400)",description:((ao=ro.uiMetadata)==null?void 0:ao.description)||"Custom role"}}}));super([],ue),this.setRoles=eo=>{this.set(eo.sort((no,ro)=>{var lo,co;const oo=getRolePriority(no._id),io=getRolePriority(ro._id);if(oo!==io)return oo>io?-1:1;const ao=((lo=no.uiMetadata)==null?void 0:lo.displayName)||no.name,so=((co=ro.uiMetadata)==null?void 0:co.displayName)||ro.name;return ao<so?-1:1}))},this.fetch=async()=>{const eo=await API.getRoles();this.setRoles(eo)},this.fetchByAppId=async eo=>{const{roles:no}=await API.getRolesForApp(eo);this.setRoles(no)},this.delete=async eo=>{!eo._id||!eo._rev||(await API.deleteRole(eo._id,eo._rev),await this.fetch())},this.save=async eo=>{const no=await API.saveRole(eo);return await this.fetch(),no},this.replace=(eo,no)=>{if(!eo)return;if(!no){this.update(oo=>oo.filter(io=>io._id!==eo));return}const ro=get_store_value(this).findIndex(oo=>oo._id===no._id);ro===-1?this.update(oo=>[...oo,no]):no&&this.update(oo=>(oo[ro]=no,[...oo]))}}}const roles=new RoleStore,INITIAL_STATE={},createIntegrationsStore=()=>{const to=writable(INITIAL_STATE);return{...to,init:async()=>{const eo=await API.getIntegrations(),no=Object.entries(eo).reduce((ro,[oo,io])=>(io&&(ro[oo]=io),ro),{});to.set(no)}}},integrations=createIntegrationsStore(),sortQueries=to=>{to.sort((ue,eo)=>ue.name.localeCompare(eo.name))};class QueryStore extends DerivedBudiStore{constructor(){const ue=eo=>derived(eo,no=>{var ro;return{list:no.list,selectedQueryId:no.selectedQueryId,selected:(ro=no.list)==null?void 0:ro.find(oo=>oo._id===no.selectedQueryId)}});super({list:[],selectedQueryId:null},ue),this.init=this.fetch,this.select=this.select.bind(this)}async fetch(){const ue=await API.getQueries();sortQueries(ue),this.store.update(eo=>({...eo,list:ue}))}async save(ue,eo){const no=get_store_value(integrations),ro=get_store_value(datasources).list.filter(io=>io._id===ue);if(ro.length!==0){const ao=no[ro[0].source].query[eo.queryVerb].readable;ao&&(eo.readable=ao)}eo.datasourceId=ue;const oo=await API.saveQuery(eo);return this.store.update(io=>{const ao=io.list.findIndex(lo=>lo._id===oo._id),so=io.list;return ao>=0?so.splice(ao,1,oo):so.push(oo),sortQueries(so),{list:so,selectedQueryId:oo._id||null}}),oo}async importQueries(ue){return await API.importQueries(ue)}select(ue){this.store.update(eo=>({...eo,selectedQueryId:ue}))}async preview(ue){const eo=await API.previewQuery(ue),no={};for(let[ro,oo]of Object.entries(eo.schema))no[ro]=oo||{type:"string"};return{...eo,schema:no,rows:eo.rows||[]}}async delete(ue){if(!ue._id||!ue._rev)throw new Error("Query ID or Revision is missing");await API.deleteQuery(ue._id,ue._rev),this.store.update(eo=>({...eo,list:eo.list.filter(no=>no._id!==ue._id)}))}async duplicate(ue){let eo=get_store_value(this.store).list;const no={...ue},ro=ue.datasourceId;return delete no._id,delete no._rev,no.name=duplicateName(ue.name,eo.map(oo=>oo.name)),await this.save(ro,no)}removeDatasourceQueries(ue){this.store.update(eo=>({...eo,list:eo.list.filter(no=>no.datasourceId!==ue)}))}}const queries=new QueryStore;class TableImportError extends Error{constructor(ue){super(),this.name="TableImportError",this.errors=ue}get description(){let ue="";for(const eo in this.errors)ue+=`${eo}: ${this.errors[eo]}
|
|
519
519
|
`;return ue}}class DatasourceStore extends DerivedBudiStore{constructor(){const ue=eo=>derived([eo,tables],([no,ro])=>{var so,lo,co,uo;let oo=(so=no.rawList)==null?void 0:so.find(fo=>fo._id===BUDIBASE_INTERNAL_DB_ID),io=(lo=no.rawList)==null?void 0:lo.filter(fo=>fo._id!==BUDIBASE_INTERNAL_DB_ID);if(oo){const fo=(co=ro.list)==null?void 0:co.filter(po=>po.sourceId===BUDIBASE_INTERNAL_DB_ID&&po._id!==TableNames.USERS);oo={...oo,entities:fo}}let ao=[];return(uo=oo==null?void 0:oo.entities)!=null&&uo.length&&ao.push(oo),ao=ao.concat(io||[]),{...no,list:ao,selected:ao==null?void 0:ao.find(fo=>fo._id===no.selectedDatasourceId),hasDefaultData:ao==null?void 0:ao.some(fo=>fo._id===DEFAULT_BB_DATASOURCE_ID),hasData:(ao==null?void 0:ao.length)>0}});super({rawList:[],selectedDatasourceId:null},ue),this.fetch=this.fetch.bind(this),this.init=this.fetch.bind(this),this.select=this.select.bind(this),this.updateSchema=this.updateSchema.bind(this),this.create=this.create.bind(this),this.delete=this.deleteDatasource.bind(this),this.save=this.save.bind(this),this.replaceDatasource=this.replaceDatasource.bind(this),this.getTableNames=this.getTableNames.bind(this)}async fetch(){const ue=await API.getDatasources();this.store.update(eo=>({...eo,rawList:ue}))}async init(){return this.fetch()}select(ue){this.store.update(eo=>({...eo,selectedDatasourceId:ue}))}updateDatasourceInStore(ue,{ignoreErrors:eo}={}){const{datasource:no,errors:ro}=ue;if(!eo&&ro&&Object.keys(ro).length>0)throw new TableImportError(ro);return this.replaceDatasource(no._id,no),this.select(no._id),no}async updateSchema(ue,eo){const no=await API.buildDatasourceSchema(ue==null?void 0:ue._id,eo);this.updateDatasourceInStore(no)}sourceCount(ue){return get_store_value(this.store).rawList.filter(eo=>eo.source===ue).length}async checkDatasourceValidity(ue,eo){var no;if((no=ue.features)!=null&&no[DatasourceFeature.CONNECTION_CHECKING]){const{connected:ro,error:oo}=await API.validateDatasource(eo);return ro?{valid:!0}:{valid:!1,error:oo}}return{valid:!0}}async create({integration:ue,config:eo}){const no=this.sourceCount(ue.name),ro=no===0?"":` ${no+1}`,oo={type:"datasource",source:ue.name,config:eo,name:`${ue.friendlyName}${ro}`,plus:ue.plus&&ue.name!==IntegrationTypes.REST,isSQL:ue.isSQL},{valid:io,error:ao}=await this.checkDatasourceValidity(ue,oo);if(!io)throw new Error(`Unable to connect - ${ao}`);const so=await API.createDatasource({datasource:oo,fetchSchema:ue.plus});return this.updateDatasourceInStore(so,{ignoreErrors:!0})}async save({integration:ue,datasource:eo}){if(!(await this.checkDatasourceValidity(ue,eo)).valid)throw new Error("Unable to connect");const no=await API.updateDatasource(eo);return this.updateDatasourceInStore(no)}async deleteDatasource(ue){!(ue!=null&&ue._id)||!(ue!=null&&ue._rev)||(await API.deleteDatasource(ue._id,ue._rev),this.replaceDatasource(ue._id))}async delete(ue){return this.deleteDatasource(ue)}replaceDatasource(ue,eo){if(!ue)return;if(!eo){this.store.update(ro=>({...ro,rawList:ro.rawList.filter(oo=>oo._id!==ue)})),tables.removeDatasourceTables(ue),queries.removeDatasourceQueries(ue);return}const no=get_store_value(this.store).rawList.findIndex(ro=>ro._id===eo._id);no===-1?(this.store.update(ro=>({...ro,rawList:[...ro.rawList,eo]})),tables.fetch()):eo&&this.store.update(ro=>(ro.rawList[no]=eo,ro))}async getTableNames(ue){return(await API.fetchInfoForDatasource(ue)).tableNames||[]}}const datasources=new DatasourceStore,getIntegrationOrder=to=>to?to===DatasourceTypes.API?1:to===DatasourceTypes.RELATIONAL?2:to===DatasourceTypes.NON_RELATIONAL?3:to.charCodeAt(0)+4:Number.MAX_SAFE_INTEGER;class SortedIntegrationStore extends BudiStore{constructor(){super([]);const ue=derived(integrations,eo=>Object.entries(eo).map(([oo,io])=>({name:oo,...io})).sort((oo,io)=>{const ao=getIntegrationOrder(oo.type),so=getIntegrationOrder(io.type);return ao===so?oo.friendlyName.localeCompare(io.friendlyName):ao<so?-1:1}));this.subscribe=ue.subscribe}}const sortedIntegrations=new SortedIntegrationStore,INITIAL_FLAGS_STATE={flags:{}};class FlagsStore extends BudiStore{constructor(){super(INITIAL_FLAGS_STATE),this.fetch=this.fetch.bind(this),this.updateFlag=this.updateFlag.bind(this),this.toggleUiFeature=this.toggleUiFeature.bind(this)}async fetch(){const ue=await API.getFlags();this.update(eo=>({...eo,flags:ue}))}async updateFlag(ue,eo){await API.updateFlag(ue,eo),await this.fetch()}async toggleUiFeature(ue){await API.toggleUiFeature(ue)}}const flags=new FlagsStore;class ComponentTreeNodesStore extends BudiStore{constructor(){super({},{persistence:{type:PersistenceType.SESSION,key:"openNodes"}})}toggleNode(ue){this.update(eo=>(eo[`nodeOpen-${ue}`]=!eo[`nodeOpen-${ue}`],eo))}expandNodes(ue){this.update(eo=>{const no=Object.fromEntries(ue.map(ro=>[`nodeOpen-${ro}`,!0]));return{...eo,...no}})}collapseNodes(ue){this.update(eo=>{const no=Object.fromEntries(ue.map(ro=>[`nodeOpen-${ro}`,!1]));return{...eo,...no}})}makeNodeVisible(ue){const eo=get_store_value(selectedScreen),ro=findComponentPath(eo.props,ue).map(oo=>oo._id);this.update(oo=>{const io=Object.fromEntries(ro.map(ao=>[`nodeOpen-${ao}`,!0]));return{...oo,...io}})}isNodeExpanded(ue){return!!get_store_value(this)[`nodeOpen-${ue}`]}}const componentTreeNodesStore=new ComponentTreeNodesStore,appPublished=derived([appStore,appsStore,deploymentStore],([to,ue,eo])=>{const no=ue.apps.find(oo=>oo.devId===to.appId),ro=eo.filter(oo=>oo.status===DeploymentStatus.SUCCESS);return(no==null?void 0:no.status)==="published"&&ro.length>0}),reset=()=>{appStore.reset(),builderStore.reset(),screenStore.reset(),componentStore.reset(),layoutStore.reset(),navigationStore.reset(),rowActions.reset()},refreshBuilderData=async()=>{await Promise.all([automationStore.actions.fetch(),datasources.init(),integrations.init(),queries.init(),tables.init(),roles.fetch(),flags.fetch()])},resetBuilderHistory=()=>{screenStore.history.reset(),automationHistoryStore.reset()},initialise=async to=>{const{application:ue}=to;appStore.syncAppPackage(to),await Promise.all([appStore.syncAppRoutes(),componentStore.refreshDefinitions(ue==null?void 0:ue.appId)]),builderStore.init(ue),navigationStore.syncAppNavigation(ue==null?void 0:ue.navigation),themeStore.syncAppTheme(ue),snippets$1.syncMetadata(ue),screenStore.syncAppScreens(to),layoutStore.syncAppLayouts(to),resetBuilderHistory(),await refreshBuilderData()},API=createAPIClient({attachHeaders:to=>{let ue=get_store_value(appStore).appId;ue&&(to["x-budibase-app-id"]=ue);const eo=get_store_value(auth).user;eo!=null&&eo.csrfToken&&(to["x-csrf-token"]=eo.csrfToken)},onError:to=>{const{url:ue,message:eo,status:no,method:ro,handled:oo}=to||{};if(!oo){console.error("Unhandled error from API client",to);return}console.warn(`[Builder] HTTP ${no} on ${ro}:${ue}
|
|
520
520
|
${eo}`),no===403&&(removeCookie(Cookies.Auth),!ue.includes("self")&&!ue.includes("login")&&location.reload())},onMigrationDetected:to=>{var eo;const ue=`/builder/app/updating/${to}`;window.location.pathname!==ue&&((eo=get_store_value(navigation))==null||eo.goto(`${ue}?returnUrl=${encodeURIComponent(window.location.pathname)}`))}}),Logo$2="/builder/assets/bb-emblem-5d011fde.svg",handleError=to=>{let ue={...to};return Object.keys(ue).reduce((eo,no)=>(ue[no]&&(eo[no]=ue[no]),eo),{})},passwordsMatch=(to,ue)=>{let eo=ue==null?void 0:ue.trim(),no=to==null?void 0:to.trim();return typeof eo=="string"&&typeof no=="string"&&eo==no},index_svelte_svelte_type_style_lang$w="";function create_default_slot_8$F(to){let ue;return{c(){ue=text("Create an admin user")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_7$Q(to){let ue;return{c(){ue=text("The admin user has access to everything in Budibase.")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_6$10(to){let ue,eo,no,ro,oo,io,ao;return ro=new Heading({props:{size:"M",$$slots:{default:[create_default_slot_8$F]},$$scope:{ctx:to}}}),io=new Body({props:{$$slots:{default:[create_default_slot_7$Q]},$$scope:{ctx:to}}}),{c(){ue=element("img"),no=space$1(),create_component(ro.$$.fragment),oo=space$1(),create_component(io.$$.fragment),attr(ue,"alt","logo"),src_url_equal(ue.src,eo=Logo$2)||attr(ue,"src",eo),attr(ue,"class","svelte-1rej6a3")},m(so,lo){insert$1(so,ue,lo),insert$1(so,no,lo),mount_component(ro,so,lo),insert$1(so,oo,lo),mount_component(io,so,lo),ao=!0},p(so,lo){const co={};lo&262144&&(co.$$scope={dirty:lo,ctx:so}),ro.$set(co);const uo={};lo&262144&&(uo.$$scope={dirty:lo,ctx:so}),io.$set(uo)},i(so){ao||(transition_in(ro.$$.fragment,so),transition_in(io.$$.fragment,so),ao=!0)},o(so){transition_out(ro.$$.fragment,so),transition_out(io.$$.fragment,so),ao=!1},d(so){so&&(detach(ue),detach(no),detach(oo)),destroy_component(ro,so),destroy_component(io,so)}}}function create_default_slot_5$1i(to){let ue,eo,no,ro,oo,io;return ue=new FancyInput({props:{label:"Email",value:to[2].email,validate:to[9],disabled:to[3],error:to[1].email}}),ue.$on("change",to[10]),no=new FancyInput({props:{label:"Password",value:to[2].password,type:"password",validate:to[11],error:to[1].password,disabled:to[3]}}),no.$on("change",to[12]),oo=new FancyInput({props:{label:"Repeat Password",value:to[2].confirmationPassword,type:"password",validate:to[13],error:to[1].confirmationPassword,disabled:to[3]}}),oo.$on("change",to[14]),{c(){create_component(ue.$$.fragment),eo=space$1(),create_component(no.$$.fragment),ro=space$1(),create_component(oo.$$.fragment)},m(ao,so){mount_component(ue,ao,so),insert$1(ao,eo,so),mount_component(no,ao,so),insert$1(ao,ro,so),mount_component(oo,ao,so),io=!0},p(ao,so){const lo={};so&4&&(lo.value=ao[2].email),so&6&&(lo.validate=ao[9]),so&8&&(lo.disabled=ao[3]),so&2&&(lo.error=ao[1].email),ue.$set(lo);const co={};so&4&&(co.value=ao[2].password),so&22&&(co.validate=ao[11]),so&2&&(co.error=ao[1].password),so&8&&(co.disabled=ao[3]),no.$set(co);const uo={};so&4&&(uo.value=ao[2].confirmationPassword),so&6&&(uo.validate=ao[13]),so&2&&(uo.error=ao[1].confirmationPassword),so&8&&(uo.disabled=ao[3]),oo.$set(uo)},i(ao){io||(transition_in(ue.$$.fragment,ao),transition_in(no.$$.fragment,ao),transition_in(oo.$$.fragment,ao),io=!0)},o(ao){transition_out(ue.$$.fragment,ao),transition_out(no.$$.fragment,ao),transition_out(oo.$$.fragment,ao),io=!1},d(ao){ao&&(detach(eo),detach(ro)),destroy_component(ue,ao),destroy_component(no,ao),destroy_component(oo,ao)}}}function create_default_slot_4$1H(to){let ue,eo,no={$$slots:{default:[create_default_slot_5$1i]},$$scope:{ctx:to}};return ue=new FancyForm({props:no}),to[15](ue),{c(){create_component(ue.$$.fragment)},m(ro,oo){mount_component(ue,ro,oo),eo=!0},p(ro,oo){const io={};oo&262174&&(io.$$scope={dirty:oo,ctx:ro}),ue.$set(io)},i(ro){eo||(transition_in(ue.$$.fragment,ro),eo=!0)},o(ro){transition_out(ue.$$.fragment,ro),eo=!1},d(ro){to[15](null),destroy_component(ue,ro)}}}function create_default_slot_3$2f(to){let ue;return{c(){ue=text("Create super admin user")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_2$2U(to){let ue,eo;return ue=new Button({props:{cta:!0,size:"L",disabled:Object.keys(to[1]).length>0||to[3],$$slots:{default:[create_default_slot_3$2f]},$$scope:{ctx:to}}}),ue.$on("click",to[5]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&10&&(oo.disabled=Object.keys(no[1]).length>0||no[3]),ro&262144&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot_1$41(to){let ue,eo,no,ro,oo,io;return ue=new Layout$n({props:{justifyItems:"center",noPadding:!0,$$slots:{default:[create_default_slot_6$10]},$$scope:{ctx:to}}}),no=new Layout$n({props:{gap:"S",noPadding:!0,$$slots:{default:[create_default_slot_4$1H]},$$scope:{ctx:to}}}),oo=new Layout$n({props:{gap:"XS",noPadding:!0,justifyItems:"center",$$slots:{default:[create_default_slot_2$2U]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment),eo=space$1(),create_component(no.$$.fragment),ro=space$1(),create_component(oo.$$.fragment)},m(ao,so){mount_component(ue,ao,so),insert$1(ao,eo,so),mount_component(no,ao,so),insert$1(ao,ro,so),mount_component(oo,ao,so),io=!0},p(ao,so){const lo={};so&262144&&(lo.$$scope={dirty:so,ctx:ao}),ue.$set(lo);const co={};so&262175&&(co.$$scope={dirty:so,ctx:ao}),no.$set(co);const uo={};so&262154&&(uo.$$scope={dirty:so,ctx:ao}),oo.$set(uo)},i(ao){io||(transition_in(ue.$$.fragment,ao),transition_in(no.$$.fragment,ao),transition_in(oo.$$.fragment,ao),io=!0)},o(ao){transition_out(ue.$$.fragment,ao),transition_out(no.$$.fragment,ao),transition_out(oo.$$.fragment,ao),io=!1},d(ao){ao&&(detach(eo),detach(ro)),destroy_component(ue,ao),destroy_component(no,ao),destroy_component(oo,ao)}}}function create_default_slot$5J(to){let ue,eo;return ue=new Layout$n({props:{gap:"M",noPadding:!0,$$slots:{default:[create_default_slot_1$41]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&262175&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_fragment$9a(to){let ue,eo,no,ro;return ue=new TestimonialPage({props:{$$slots:{default:[create_default_slot$5J]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(oo,io){mount_component(ue,oo,io),eo=!0,no||(ro=listen(window,"keydown",to[6]),no=!0)},p(oo,[io]){const ao={};io&262175&&(ao.$$scope={dirty:io,ctx:oo}),ue.$set(ao)},i(oo){eo||(transition_in(ue.$$.fragment,oo),eo=!0)},o(oo){transition_out(ue.$$.fragment,oo),eo=!1},d(oo){destroy_component(ue,oo),no=!1,ro()}}}function instance$9c(to,ue,eo){let no,ro,oo,io,ao;component_subscribe(to,goto,ko=>eo(17,oo=ko)),component_subscribe(to,admin,ko=>eo(7,io=ko)),component_subscribe(to,auth,ko=>eo(8,ao=ko));let so,lo={},co={},uo=!1;async function fo(){if(so.validate(),!(Object.keys(lo).length>0)){eo(3,uo=!0);try{let ko={...co,tenantId:no};delete ko.confirmationPassword,await API.createAdminUser(ko),notifications.success("Admin user created"),await admin.init(),await auth.login(co==null?void 0:co.email.trim(),co==null?void 0:co.password),oo("../portal")}catch(ko){eo(3,uo=!1),notifications.error(ko.message||"Failed to create admin user")}}}const po=ko=>{ko.key==="Enter"&&fo()},ho=()=>{let ko={email:co.email?void 0:"Please enter a valid email"};eo(1,lo=handleError({...lo,...ko}))},_o=ko=>{eo(2,co={...co,email:ko.detail})},go=()=>{let ko={};co.password?co.password.length<ro?ko.password=`Password must be at least ${ro} characters`:ko.password=void 0:ko.password="Please enter a password",ko.confirmationPassword=!passwordsMatch(co.password,co.confirmationPassword)&&co.confirmationPassword?"Passwords must match":void 0,eo(1,lo=handleError({...lo,...ko}))},bo=ko=>{eo(2,co={...co,password:ko.detail})},vo=()=>{let ko={confirmationPassword:!passwordsMatch(co.password,co.confirmationPassword)&&co.password?"Passwords must match":void 0};eo(1,lo=handleError({...lo,...ko}))},yo=ko=>{eo(2,co={...co,confirmationPassword:ko.detail})};function wo(ko){binding_callbacks[ko?"unshift":"push"](()=>{so=ko,eo(0,so)})}return to.$$.update=()=>{to.$$.dirty&256&&(no=ao.tenantId),to.$$.dirty&128&&eo(4,ro=io.passwordMinLength??12)},[so,lo,co,uo,ro,fo,po,io,ao,ho,_o,go,bo,vo,yo,wo]}class Admin extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$9c,create_fragment$9a,safe_not_equal,{})}}function create_if_block$4a(to){let ue;const eo=to[4].default,no=create_slot(eo,to,to[3],null);return{c(){no&&no.c()},m(ro,oo){no&&no.m(ro,oo),ue=!0},p(ro,oo){no&&no.p&&(!ue||oo&8)&&update_slot_base(no,eo,ro,ro[3],ue?get_slot_changes(eo,ro[3],oo,null):get_all_dirty_from_scope(ro[3]),null)},i(ro){ue||(transition_in(no,ro),ue=!0)},o(ro){transition_out(no,ro),ue=!1},d(ro){no&&no.d(ro)}}}function create_fragment$99(to){let ue,eo,no=to[0]&&create_if_block$4a(to);return{c(){no&&no.c(),ue=empty$2()},m(ro,oo){no&&no.m(ro,oo),insert$1(ro,ue,oo),eo=!0},p(ro,[oo]){ro[0]?no?(no.p(ro,oo),oo&1&&transition_in(no,1)):(no=create_if_block$4a(ro),no.c(),transition_in(no,1),no.m(ue.parentNode,ue)):no&&(group_outros(),transition_out(no,1,1,()=>{no=null}),check_outros())},i(ro){eo||(transition_in(no),eo=!0)},o(ro){transition_out(no),eo=!1},d(ro){ro&&detach(ue),no&&no.d(ro)}}}function instance$9b(to,ue,eo){let no,ro,oo,io;component_subscribe(to,redirect,co=>eo(6,oo=co)),component_subscribe(to,admin,co=>eo(2,io=co));let{$$slots:ao={},$$scope:so}=ue,lo=!1;return onMount(()=>{var co,uo;(uo=(co=io==null?void 0:io.checklist)==null?void 0:co.adminUser)!=null&&uo.checked||ro?oo("../"):eo(0,lo=!0)}),to.$$set=co=>{"$$scope"in co&&eo(3,so=co.$$scope)},to.$$.update=()=>{to.$$.dirty&4&&eo(1,no=io.cloud),to.$$.dirty&6&&(ro=no&&!io.disableAccountPortal)},[lo,no,io,so,ao]}let Layout$m=class extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$9b,create_fragment$99,safe_not_equal,{})}};function instance$9a(to,ue,eo){let no;return component_subscribe(to,redirect,ro=>eo(0,no=ro)),no("../design"),[]}class Fallback extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$9a,null,safe_not_equal,{})}}function instance$99(to,ue,eo){let no;return component_subscribe(to,redirect,ro=>eo(0,no=ro)),no("./data"),[]}let U5Bapplicationu5D$1=class extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$99,null,safe_not_equal,{})}};function create_fragment$98(to){let ue,eo,no,ro,oo,io;return{c(){ue=svg_element("svg"),eo=svg_element("path"),no=svg_element("path"),ro=svg_element("path"),oo=svg_element("path"),io=svg_element("path"),attr(eo,"d",`M169.341 104.792C168.322 101.71 165.652 99.5637 162.199 99.0487C160.57
|
|
521
521
|
98.8061 158.706 98.9095 156.499 99.3635C152.653 100.156 149.799 100.457
|
|
@@ -884,7 +884,7 @@ and ensure you are accounting for this risk.
|
|
|
884
884
|
</svg>`,buildSectionHeader=(to,ue,eo,no)=>{const ro=document.createElement("div");return ro.classList.add("info-section"),to&&ro.classList.add(to),ro.innerHTML=`${toSpectrumIcon(eo)}<span>${ue}</span>`,{name:ue,header:()=>ro,rank:no}},helpersToCompletion=(to,ue)=>{const{type:eo,name:no,icon:ro}=SECTIONS.HB_HELPER,oo=buildSectionHeader(eo,no,ro,99);return Object.keys(to).reduce((io,ao)=>{let so=to[ao];return io.push({label:ao,info:lo=>buildHelperInfoNode(lo,so),type:"helper",section:oo,detail:"Function",apply:(lo,co,uo,fo)=>{insertBinding(lo,uo,fo,ao,ue)}}),io},[])},getHelperCompletions=to=>{const ue=getManifest();return Object.keys(ue).reduce((eo,no)=>(eo=eo||[],[...eo,...helpersToCompletion(ue[no],to)]),[])},snippetAutoComplete=to=>function(eo){if(!(to!=null&&to.length))return null;const no=eo.matchBefore(/\w*/);return no.from==no.to&&!eo.explicit?null:{from:no.from,options:to.map(ro=>({label:`snippets.${ro.name}`,type:"text",simple:!0,apply:(oo,io,ao,so)=>{insertSnippet(oo,ao,so,io.label)}}))}},bindingFilter=(to,ue)=>to.filter(eo=>{const no=eo.section.name.toLowerCase(),ro=eo.label.toLowerCase(),oo=ue.toLowerCase();return no.includes(oo)||ro.includes(oo)}),hbAutocomplete=to=>{async function ue(eo){let no=eo.matchBefore(EditorModes$1.Handlebars.match),ro=to||[];if(!no)return null;const oo=no.text.match(/{{[\s]*/),io=no.text.replace(oo[0],"");let ao=bindingFilter(ro,io);return{from:no.from+oo[0].length,filter:!1,options:ao}}return ue},jsAutocomplete=to=>{async function ue(eo){let no=eo.matchBefore(/\$\("[\s\w]*/),ro=to||[];if(no){const oo=no.text.match(/\$\("[\s]*/),io=no.text.replace(oo[0],"");let ao=bindingFilter(ro,io);return{from:no.from+oo[0].length,filter:!1,options:ao}}return null}return ue},buildBindingInfoNode=(to,ue)=>{if(!ue.valueHTML||ue.value==null)return null;const eo=document.createElement("div");return eo.classList.add("info-bubble"),eo.innerHTML=`<div class="binding__example">${ue.valueHTML}</div>`,eo},hbInsert=(to,ue,eo,no)=>{let ro="";const oo=ue?to.substring(0,ue):"",io=eo?to.substring(eo):"";return!oo.includes("{{")||!io.includes("}}")?ro=`{{ ${no} }}`:ro=` ${no} `,ro};function jsInsert(to,ue,eo,no,{helper:ro,disableWrapping:oo}={}){let io="";const ao=ue?to.substring(0,ue):"",so=eo?to.substring(eo):"";return oo?io=no:ro?io=`helpers.${no}()`:!ao.includes('$("')||!so.includes('")')?io=`$("${no}")`:io=no,io}const insertBinding=(to,ue,eo,no,ro)=>{var co,uo,fo;let oo;if(ro.name=="javascript")oo=jsInsert((co=to.state.doc)==null?void 0:co.toString(),ue,eo,no);else if(ro.name=="handlebars")oo=hbInsert((uo=to.state.doc)==null?void 0:uo.toString(),ue,eo,no);else{console.warn("Unsupported");return}let io=ro.name=="javascript"?/[\s]*"\)/:/[\s]*}}/;const so=((fo=to.state.doc)==null?void 0:fo.toString().slice(eo)).match(io);let lo=ue+oo.length;so&&(lo=ue+oo.length+so[0].length),to.dispatch({changes:{from:ue,to:eo,insert:oo},selection:{anchor:lo}})},insertSnippet=(to,ue,eo,no)=>{let ro=ue+no.length;to.dispatch({changes:{from:ue,to:eo,insert:no},selection:{anchor:ro}})},bindingsToCompletions=(to,ue)=>{const eo=lodashExports.groupBy(to,"category"),no=to==null?void 0:to.reduce((oo,io)=>{var ao;return oo[io.category]=oo[io.category]||{},io.icon&&(oo[io.category].icon=oo[io.category].icon||io.icon),typeof((ao=io.display)==null?void 0:ao.rank)=="number"&&(oo[io.category].rank=oo[io.category].rank||io.display.rank),oo},{});return Object.keys(eo).reduce((oo,io)=>{const{icon:ao,rank:so}=no[io]||{},lo=buildSectionHeader(eo.type,io,ao||"",typeof so=="number"?so:1);return[...oo,...eo[io].reduce((co,uo)=>{var po,ho,_o;let fo=((po=uo.fieldSchema)==null?void 0:po.type)||((ho=uo.display)==null?void 0:ho.type);return co.push({label:((_o=uo.display)==null?void 0:_o.name)||uo.readableBinding||"NO NAME",info:go=>buildBindingInfoNode(go,uo),type:"binding",detail:fo,section:lo,apply:(go,bo,vo,yo)=>{insertBinding(go,vo,yo,uo.readableBinding,ue)}}),co},[])]},[])},CodeEditor_svelte_svelte_type_style_lang="";function create_if_block$48(to){let ue,eo,no;return eo=new Label({props:{small:!0,$$slots:{default:[create_default_slot$5G]},$$scope:{ctx:to}}}),{c(){ue=element("div"),create_component(eo.$$.fragment)},m(ro,oo){insert$1(ro,ue,oo),mount_component(eo,ue,null),no=!0},p(ro,oo){const io={};oo[0]&1|oo[1]&4&&(io.$$scope={dirty:oo,ctx:ro}),eo.$set(io)},i(ro){no||(transition_in(eo.$$.fragment,ro),no=!0)},o(ro){transition_out(eo.$$.fragment,ro),no=!1},d(ro){ro&&detach(ue),destroy_component(eo)}}}function create_default_slot$5G(to){let ue;return{c(){ue=text(to[0])},m(eo,no){insert$1(eo,ue,no)},p(eo,no){no[0]&1&&set_data(ue,eo[0])},d(eo){eo&&detach(ue)}}}function create_fragment$8Q(to){let ue,eo,no,ro,oo,io=to[0]&&create_if_block$48(to);return{c(){var ao;io&&io.c(),ue=space$1(),eo=element("div"),no=element("div"),attr(no,"tabindex","-1"),attr(no,"class","svelte-dqv15e"),attr(eo,"class",ro=null_to_empty(`code-editor ${((ao=to[1])==null?void 0:ao.name)||""}`)+" svelte-dqv15e")},m(ao,so){io&&io.m(ao,so),insert$1(ao,ue,so),insert$1(ao,eo,so),append$2(eo,no),to[19](no),oo=!0},p(ao,so){var lo;ao[0]?io?(io.p(ao,so),so[0]&1&&transition_in(io,1)):(io=create_if_block$48(ao),io.c(),transition_in(io,1),io.m(ue.parentNode,ue)):io&&(group_outros(),transition_out(io,1,1,()=>{io=null}),check_outros()),(!oo||so[0]&2&&ro!==(ro=null_to_empty(`code-editor ${((lo=ao[1])==null?void 0:lo.name)||""}`)+" svelte-dqv15e"))&&attr(eo,"class",ro)},i(ao){oo||(transition_in(io),oo=!0)},o(ao){transition_out(io),oo=!1},d(ao){ao&&(detach(ue),detach(eo)),io&&io.d(ao),to[19](null)}}}function instance$8Q(to,ue,eo){let no;component_subscribe(to,themeStore$1,Zo=>eo(18,no=Zo));let{label:ro}=ue,{completions:oo=[]}=ue,{mode:io=EditorModes$1.Handlebars}=ue,{value:ao=""}=ue,{placeholder:so=null}=ue,{autocompleteEnabled:lo=!0}=ue,{autofocus:co=!1}=ue,{jsBindingWrapping:uo=!0}=ue,{readonly:fo=!1}=ue,{readonlyLineNumbers:po=!1}=ue;const ho=createEventDispatcher();let _o,go,bo=!1,vo=!1,yo=!1,wo=no==null?void 0:no.theme,ko=!wo.includes("light"),So=new Compartment;const Eo=(Zo,Qo,Yo)=>{if(!Qo||!Yo){yo=!0;return}(go.state.doc.toString()!==Zo||yo)&&(go.dispatch({changes:{from:0,to:go.state.doc.length,insert:Zo}}),yo=!1)},Io=()=>{const Zo=go.state.selection.ranges[0];return{start:Zo.from,end:Zo.to}},Ao=Zo=>{go.dispatch({changes:{from:Zo.start||go.state.doc.length,to:Zo.end||go.state.doc.length,insert:Zo.value},selection:Zo.cursor?{anchor:Zo.start+Zo.value.length}:void 0})},To=new MatchDecorator({regexp:FIND_ANY_HBS_REGEX,decoration:()=>Decoration.mark({tag:"span",attributes:{class:"binding-wrap"}})}),Mo=ViewPlugin.define(Zo=>({decorations:To.createDeco(Zo),update(Qo){this.decorations=To.updateDeco(Qo,this.decorations)}}),{decorations:Zo=>Zo.decorations}),Vo=new MatchDecorator({regexp:/snippets\.[^\s(]+/g,decoration:()=>Decoration.mark({tag:"span",attributes:{class:"snippet-wrap"}})}),Fo=ViewPlugin.define(Zo=>({decorations:Vo.createDeco(Zo),update(Qo){this.decorations=Vo.updateDeco(Qo,this.decorations)}}),{decorations:Zo=>Zo.decorations}),Po={key:"Tab",run:Zo=>completionStatus(Zo.state)==="active"?(acceptCompletion(Zo),!0):(indentMore(Zo),!0),shift:Zo=>(indentLess(Zo),!0)},Ro=()=>[...closeBracketsKeymap,...defaultKeymap,...historyKeymap,...foldKeymap,...completionKeymap,Po],Do=()=>[drawSelection(),dropCursor(),bracketMatching(),closeBrackets(),syntaxHighlighting(oneDarkHighlightStyle,{fallback:!0}),highlightSpecialChars(),EditorView.lineWrapping,So.of([...ko?[oneDark]:[]])],qo=Zo=>{let Qo=[...Zo];return lo&&(Qo.push(autocompletion({override:[...oo],closeOnBlur:!0,icons:!1,optionClass:Yo=>Yo.simple?"autocomplete-option-simple":"autocomplete-option"})),Qo.push(EditorView.inputHandler.of((Yo,Xo,Ko,ra)=>{if(uo&&ra==="$"){let{text:ea}=Yo.state.doc.lineAt(Xo);const ia=Xo?ea.substring(0,Xo):"",Jo=Ko?ea.substring(Ko):"",sa=!ia.includes('$("')||!Jo.includes('")'),Ea=Yo.state.update({changes:[{from:Xo,insert:sa?'$("")':"$"}],selection:{anchor:Xo+(sa?3:1)}},{scrollIntoView:!0,userEvent:"input.type"});return Yo.dispatch(Ea),!0}return!1}))),io.name==="javascript"?(Qo.push(Fo),Qo.push(javascript()),fo||Qo.push(highlightWhitespace())):Qo.push(Mo),so&&Qo.push(placeholder(so)),fo?(Qo.push(EditorState.readOnly.of(!0)),po&&Qo.push(lineNumbers())):Qo=[...Qo,history$1(),highlightActiveLine(),highlightActiveLineGutter(),lineNumbers(),foldGutter(),keymap.of(Ro()),EditorView.domEventHandlers({blur:()=>{ho("blur",go.state.doc.toString())}}),EditorView.updateListener.of(Yo=>{var Ko;const Xo=(Ko=Yo.state.doc)==null?void 0:Ko.toString();Xo!==ao&&ho("change",Xo)})],Qo},Uo=()=>{const Zo=Do();eo(13,go=new EditorView({doc:ao==null?void 0:ao.toString(),extensions:qo(Zo),parent:_o}))};onMount(async()=>{eo(14,bo=!0)}),onDestroy(()=>{go&&go.destroy()});function jo(Zo){binding_callbacks[Zo?"unshift":"push"](()=>{_o=Zo,eo(2,_o)})}return to.$$set=Zo=>{"label"in Zo&&eo(0,ro=Zo.label),"completions"in Zo&&eo(3,oo=Zo.completions),"mode"in Zo&&eo(1,io=Zo.mode),"value"in Zo&&eo(4,ao=Zo.value),"placeholder"in Zo&&eo(5,so=Zo.placeholder),"autocompleteEnabled"in Zo&&eo(6,lo=Zo.autocompleteEnabled),"autofocus"in Zo&&eo(7,co=Zo.autofocus),"jsBindingWrapping"in Zo&&eo(8,uo=Zo.jsBindingWrapping),"readonly"in Zo&&eo(9,fo=Zo.readonly),"readonlyLineNumbers"in Zo&&eo(10,po=Zo.readonlyLineNumbers)},to.$$.update=()=>{to.$$.dirty[0]&49152&&bo&&!vo&&(eo(15,vo=!0),Uo()),to.$$.dirty[0]&41088&&co&&vo&&go.focus(),to.$$.dirty[0]&516096&&bo&&vo&&no!=null&&no.theme&&wo!=(no==null?void 0:no.theme)&&(eo(16,wo=no==null?void 0:no.theme),eo(17,ko=!wo.includes("light")),go.dispatch({effects:So.reconfigure([...ko?[oneDark]:[]])})),to.$$.dirty[0]&49168&&Eo(ao,vo,bo)},[ro,io,_o,oo,ao,so,lo,co,uo,fo,po,Io,Ao,go,bo,vo,wo,ko,no,jo]}class CodeEditor extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$8Q,create_fragment$8Q,safe_not_equal,{label:0,completions:3,mode:1,value:4,placeholder:5,autocompleteEnabled:6,autofocus:7,jsBindingWrapping:8,readonly:9,readonlyLineNumbers:10,getCaretPosition:11,insertAtPos:12},null,[-1,-1])}get getCaretPosition(){return this.$$.ctx[11]}get insertAtPos(){return this.$$.ctx[12]}}var WeakMap$1=_WeakMap,metaMap$2=WeakMap$1&&new WeakMap$1,_metaMap=metaMap$2,identity$3=identity_1,metaMap$1=_metaMap,baseSetData$2=metaMap$1?function(to,ue){return metaMap$1.set(to,ue),to}:identity$3,_baseSetData=baseSetData$2,isObject$5=isObject_1,objectCreate=Object.create,baseCreate$4=function(){function to(){}return function(ue){if(!isObject$5(ue))return{};if(objectCreate)return objectCreate(ue);to.prototype=ue;var eo=new to;return to.prototype=void 0,eo}}(),_baseCreate=baseCreate$4,baseCreate$3=_baseCreate,isObject$4=isObject_1;function createCtor$4(to){return function(){var ue=arguments;switch(ue.length){case 0:return new to;case 1:return new to(ue[0]);case 2:return new to(ue[0],ue[1]);case 3:return new to(ue[0],ue[1],ue[2]);case 4:return new to(ue[0],ue[1],ue[2],ue[3]);case 5:return new to(ue[0],ue[1],ue[2],ue[3],ue[4]);case 6:return new to(ue[0],ue[1],ue[2],ue[3],ue[4],ue[5]);case 7:return new to(ue[0],ue[1],ue[2],ue[3],ue[4],ue[5],ue[6])}var eo=baseCreate$3(to.prototype),no=to.apply(eo,ue);return isObject$4(no)?no:eo}}var _createCtor=createCtor$4,createCtor$3=_createCtor,root$4=_root,WRAP_BIND_FLAG$6=1;function createBind$1(to,ue,eo){var no=ue&WRAP_BIND_FLAG$6,ro=createCtor$3(to);function oo(){var io=this&&this!==root$4&&this instanceof oo?ro:to;return io.apply(no?eo:this,arguments)}return oo}var _createBind=createBind$1;function apply$3(to,ue,eo){switch(eo.length){case 0:return to.call(ue);case 1:return to.call(ue,eo[0]);case 2:return to.call(ue,eo[0],eo[1]);case 3:return to.call(ue,eo[0],eo[1],eo[2])}return to.apply(ue,eo)}var _apply=apply$3,nativeMax$3=Math.max;function composeArgs$2(to,ue,eo,no){for(var ro=-1,oo=to.length,io=eo.length,ao=-1,so=ue.length,lo=nativeMax$3(oo-io,0),co=Array(so+lo),uo=!no;++ao<so;)co[ao]=ue[ao];for(;++ro<io;)(uo||ro<oo)&&(co[eo[ro]]=to[ro]);for(;lo--;)co[ao++]=to[ro++];return co}var _composeArgs=composeArgs$2,nativeMax$2=Math.max;function composeArgsRight$2(to,ue,eo,no){for(var ro=-1,oo=to.length,io=-1,ao=eo.length,so=-1,lo=ue.length,co=nativeMax$2(oo-ao,0),uo=Array(co+lo),fo=!no;++ro<co;)uo[ro]=to[ro];for(var po=ro;++so<lo;)uo[po+so]=ue[so];for(;++io<ao;)(fo||ro<oo)&&(uo[po+eo[io]]=to[ro++]);return uo}var _composeArgsRight=composeArgsRight$2;function countHolders$1(to,ue){for(var eo=to.length,no=0;eo--;)to[eo]===ue&&++no;return no}var _countHolders=countHolders$1;function baseLodash$3(){}var _baseLodash=baseLodash$3,baseCreate$2=_baseCreate,baseLodash$2=_baseLodash,MAX_ARRAY_LENGTH=4294967295;function LazyWrapper$3(to){this.__wrapped__=to,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=MAX_ARRAY_LENGTH,this.__views__=[]}LazyWrapper$3.prototype=baseCreate$2(baseLodash$2.prototype);LazyWrapper$3.prototype.constructor=LazyWrapper$3;var _LazyWrapper=LazyWrapper$3;function noop$4(){}var noop_1=noop$4,metaMap=_metaMap,noop$3=noop_1,getData$2=metaMap?function(to){return metaMap.get(to)}:noop$3,_getData=getData$2,realNames$1={},_realNames=realNames$1,realNames=_realNames,objectProto$5=Object.prototype,hasOwnProperty$5=objectProto$5.hasOwnProperty;function getFuncName$1(to){for(var ue=to.name+"",eo=realNames[ue],no=hasOwnProperty$5.call(realNames,ue)?eo.length:0;no--;){var ro=eo[no],oo=ro.func;if(oo==null||oo==to)return ro.name}return ue}var _getFuncName=getFuncName$1,baseCreate$1=_baseCreate,baseLodash$1=_baseLodash;function LodashWrapper$2(to,ue){this.__wrapped__=to,this.__actions__=[],this.__chain__=!!ue,this.__index__=0,this.__values__=void 0}LodashWrapper$2.prototype=baseCreate$1(baseLodash$1.prototype);LodashWrapper$2.prototype.constructor=LodashWrapper$2;var _LodashWrapper=LodashWrapper$2;function copyArray$4(to,ue){var eo=-1,no=to.length;for(ue||(ue=Array(no));++eo<no;)ue[eo]=to[eo];return ue}var _copyArray=copyArray$4,LazyWrapper$2=_LazyWrapper,LodashWrapper$1=_LodashWrapper,copyArray$3=_copyArray;function wrapperClone$1(to){if(to instanceof LazyWrapper$2)return to.clone();var ue=new LodashWrapper$1(to.__wrapped__,to.__chain__);return ue.__actions__=copyArray$3(to.__actions__),ue.__index__=to.__index__,ue.__values__=to.__values__,ue}var _wrapperClone=wrapperClone$1,LazyWrapper$1=_LazyWrapper,LodashWrapper=_LodashWrapper,baseLodash=_baseLodash,isArray$7=isArray_1,isObjectLike$5=isObjectLike_1,wrapperClone=_wrapperClone,objectProto$4=Object.prototype,hasOwnProperty$4=objectProto$4.hasOwnProperty;function lodash$1(to){if(isObjectLike$5(to)&&!isArray$7(to)&&!(to instanceof LazyWrapper$1)){if(to instanceof LodashWrapper)return to;if(hasOwnProperty$4.call(to,"__wrapped__"))return wrapperClone(to)}return new LodashWrapper(to)}lodash$1.prototype=baseLodash.prototype;lodash$1.prototype.constructor=lodash$1;var wrapperLodash=lodash$1,LazyWrapper=_LazyWrapper,getData$1=_getData,getFuncName=_getFuncName,lodash=wrapperLodash;function isLaziable$1(to){var ue=getFuncName(to),eo=lodash[ue];if(typeof eo!="function"||!(ue in LazyWrapper.prototype))return!1;if(to===eo)return!0;var no=getData$1(eo);return!!no&&to===no[0]}var _isLaziable=isLaziable$1,HOT_COUNT=800,HOT_SPAN=16,nativeNow=Date.now;function shortOut$2(to){var ue=0,eo=0;return function(){var no=nativeNow(),ro=HOT_SPAN-(no-eo);if(eo=no,ro>0){if(++ue>=HOT_COUNT)return arguments[0]}else ue=0;return to.apply(void 0,arguments)}}var _shortOut=shortOut$2,baseSetData$1=_baseSetData,shortOut$1=_shortOut,setData$2=shortOut$1(baseSetData$1),_setData=setData$2,reWrapDetails=/\{\n\/\* \[wrapped with (.+)\] \*/,reSplitDetails=/,? & /;function getWrapDetails$1(to){var ue=to.match(reWrapDetails);return ue?ue[1].split(reSplitDetails):[]}var _getWrapDetails=getWrapDetails$1,reWrapComment=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;function insertWrapDetails$1(to,ue){var eo=ue.length;if(!eo)return to;var no=eo-1;return ue[no]=(eo>1?"& ":"")+ue[no],ue=ue.join(eo>2?", ":" "),to.replace(reWrapComment,`{
|
|
885
885
|
/* [wrapped with `+ue+`] */
|
|
886
886
|
`)}var _insertWrapDetails=insertWrapDetails$1;function constant$5(to){return function(){return to}}var constant_1=constant$5,constant$4=constant_1,defineProperty=_defineProperty$1,identity$2=identity_1,baseSetToString$1=defineProperty?function(to,ue){return defineProperty(to,"toString",{configurable:!0,enumerable:!1,value:constant$4(ue),writable:!0})}:identity$2,_baseSetToString=baseSetToString$1,baseSetToString=_baseSetToString,shortOut=_shortOut,setToString$2=shortOut(baseSetToString),_setToString=setToString$2;function arrayEach$2(to,ue){for(var eo=-1,no=to==null?0:to.length;++eo<no&&ue(to[eo],eo,to)!==!1;);return to}var _arrayEach=arrayEach$2;function baseFindIndex$1(to,ue,eo,no){for(var ro=to.length,oo=eo+(no?1:-1);no?oo--:++oo<ro;)if(ue(to[oo],oo,to))return oo;return-1}var _baseFindIndex=baseFindIndex$1;function baseIsNaN$1(to){return to!==to}var _baseIsNaN=baseIsNaN$1;function strictIndexOf$1(to,ue,eo){for(var no=eo-1,ro=to.length;++no<ro;)if(to[no]===ue)return no;return-1}var _strictIndexOf=strictIndexOf$1,baseFindIndex=_baseFindIndex,baseIsNaN=_baseIsNaN,strictIndexOf=_strictIndexOf;function baseIndexOf$1(to,ue,eo){return ue===ue?strictIndexOf(to,ue,eo):baseFindIndex(to,baseIsNaN,eo)}var _baseIndexOf=baseIndexOf$1,baseIndexOf=_baseIndexOf;function arrayIncludes$1(to,ue){var eo=to==null?0:to.length;return!!eo&&baseIndexOf(to,ue,0)>-1}var _arrayIncludes=arrayIncludes$1,arrayEach$1=_arrayEach,arrayIncludes=_arrayIncludes,WRAP_BIND_FLAG$5=1,WRAP_BIND_KEY_FLAG$4=2,WRAP_CURRY_FLAG$5=8,WRAP_CURRY_RIGHT_FLAG$2=16,WRAP_PARTIAL_FLAG$2=32,WRAP_PARTIAL_RIGHT_FLAG$2=64,WRAP_ARY_FLAG$3=128,WRAP_REARG_FLAG$2=256,WRAP_FLIP_FLAG$1=512,wrapFlags=[["ary",WRAP_ARY_FLAG$3],["bind",WRAP_BIND_FLAG$5],["bindKey",WRAP_BIND_KEY_FLAG$4],["curry",WRAP_CURRY_FLAG$5],["curryRight",WRAP_CURRY_RIGHT_FLAG$2],["flip",WRAP_FLIP_FLAG$1],["partial",WRAP_PARTIAL_FLAG$2],["partialRight",WRAP_PARTIAL_RIGHT_FLAG$2],["rearg",WRAP_REARG_FLAG$2]];function updateWrapDetails$1(to,ue){return arrayEach$1(wrapFlags,function(eo){var no="_."+eo[0];ue&eo[1]&&!arrayIncludes(to,no)&&to.push(no)}),to.sort()}var _updateWrapDetails=updateWrapDetails$1,getWrapDetails=_getWrapDetails,insertWrapDetails=_insertWrapDetails,setToString$1=_setToString,updateWrapDetails=_updateWrapDetails;function setWrapToString$2(to,ue,eo){var no=ue+"";return setToString$1(to,insertWrapDetails(no,updateWrapDetails(getWrapDetails(no),eo)))}var _setWrapToString=setWrapToString$2,isLaziable=_isLaziable,setData$1=_setData,setWrapToString$1=_setWrapToString,WRAP_BIND_FLAG$4=1,WRAP_BIND_KEY_FLAG$3=2,WRAP_CURRY_BOUND_FLAG$1=4,WRAP_CURRY_FLAG$4=8,WRAP_PARTIAL_FLAG$1=32,WRAP_PARTIAL_RIGHT_FLAG$1=64;function createRecurry$2(to,ue,eo,no,ro,oo,io,ao,so,lo){var co=ue&WRAP_CURRY_FLAG$4,uo=co?io:void 0,fo=co?void 0:io,po=co?oo:void 0,ho=co?void 0:oo;ue|=co?WRAP_PARTIAL_FLAG$1:WRAP_PARTIAL_RIGHT_FLAG$1,ue&=~(co?WRAP_PARTIAL_RIGHT_FLAG$1:WRAP_PARTIAL_FLAG$1),ue&WRAP_CURRY_BOUND_FLAG$1||(ue&=~(WRAP_BIND_FLAG$4|WRAP_BIND_KEY_FLAG$3));var _o=[to,ue,ro,po,uo,ho,fo,ao,so,lo],go=eo.apply(void 0,_o);return isLaziable(to)&&setData$1(go,_o),go.placeholder=no,setWrapToString$1(go,to,ue)}var _createRecurry=createRecurry$2;function getHolder$2(to){var ue=to;return ue.placeholder}var _getHolder=getHolder$2,copyArray$2=_copyArray,isIndex=_isIndex,nativeMin$1=Math.min;function reorder$1(to,ue){for(var eo=to.length,no=nativeMin$1(ue.length,eo),ro=copyArray$2(to);no--;){var oo=ue[no];to[no]=isIndex(oo,eo)?ro[oo]:void 0}return to}var _reorder=reorder$1,PLACEHOLDER$1="__lodash_placeholder__";function replaceHolders$3(to,ue){for(var eo=-1,no=to.length,ro=0,oo=[];++eo<no;){var io=to[eo];(io===ue||io===PLACEHOLDER$1)&&(to[eo]=PLACEHOLDER$1,oo[ro++]=eo)}return oo}var _replaceHolders=replaceHolders$3,composeArgs$1=_composeArgs,composeArgsRight$1=_composeArgsRight,countHolders=_countHolders,createCtor$2=_createCtor,createRecurry$1=_createRecurry,getHolder$1=_getHolder,reorder=_reorder,replaceHolders$2=_replaceHolders,root$3=_root,WRAP_BIND_FLAG$3=1,WRAP_BIND_KEY_FLAG$2=2,WRAP_CURRY_FLAG$3=8,WRAP_CURRY_RIGHT_FLAG$1=16,WRAP_ARY_FLAG$2=128,WRAP_FLIP_FLAG=512;function createHybrid$2(to,ue,eo,no,ro,oo,io,ao,so,lo){var co=ue&WRAP_ARY_FLAG$2,uo=ue&WRAP_BIND_FLAG$3,fo=ue&WRAP_BIND_KEY_FLAG$2,po=ue&(WRAP_CURRY_FLAG$3|WRAP_CURRY_RIGHT_FLAG$1),ho=ue&WRAP_FLIP_FLAG,_o=fo?void 0:createCtor$2(to);function go(){for(var bo=arguments.length,vo=Array(bo),yo=bo;yo--;)vo[yo]=arguments[yo];if(po)var wo=getHolder$1(go),ko=countHolders(vo,wo);if(no&&(vo=composeArgs$1(vo,no,ro,po)),oo&&(vo=composeArgsRight$1(vo,oo,io,po)),bo-=ko,po&&bo<lo){var So=replaceHolders$2(vo,wo);return createRecurry$1(to,ue,createHybrid$2,go.placeholder,eo,vo,So,ao,so,lo-bo)}var Eo=uo?eo:this,Io=fo?Eo[to]:to;return bo=vo.length,ao?vo=reorder(vo,ao):ho&&bo>1&&vo.reverse(),co&&so<bo&&(vo.length=so),this&&this!==root$3&&this instanceof go&&(Io=_o||createCtor$2(Io)),Io.apply(Eo,vo)}return go}var _createHybrid=createHybrid$2,apply$2=_apply,createCtor$1=_createCtor,createHybrid$1=_createHybrid,createRecurry=_createRecurry,getHolder=_getHolder,replaceHolders$1=_replaceHolders,root$2=_root;function createCurry$1(to,ue,eo){var no=createCtor$1(to);function ro(){for(var oo=arguments.length,io=Array(oo),ao=oo,so=getHolder(ro);ao--;)io[ao]=arguments[ao];var lo=oo<3&&io[0]!==so&&io[oo-1]!==so?[]:replaceHolders$1(io,so);if(oo-=lo.length,oo<eo)return createRecurry(to,ue,createHybrid$1,ro.placeholder,void 0,io,lo,void 0,void 0,eo-oo);var co=this&&this!==root$2&&this instanceof ro?no:to;return apply$2(co,this,io)}return ro}var _createCurry=createCurry$1,apply$1=_apply,createCtor=_createCtor,root$1=_root,WRAP_BIND_FLAG$2=1;function createPartial$1(to,ue,eo,no){var ro=ue&WRAP_BIND_FLAG$2,oo=createCtor(to);function io(){for(var ao=-1,so=arguments.length,lo=-1,co=no.length,uo=Array(co+so),fo=this&&this!==root$1&&this instanceof io?oo:to;++lo<co;)uo[lo]=no[lo];for(;so--;)uo[lo++]=arguments[++ao];return apply$1(fo,ro?eo:this,uo)}return io}var _createPartial=createPartial$1,composeArgs=_composeArgs,composeArgsRight=_composeArgsRight,replaceHolders=_replaceHolders,PLACEHOLDER="__lodash_placeholder__",WRAP_BIND_FLAG$1=1,WRAP_BIND_KEY_FLAG$1=2,WRAP_CURRY_BOUND_FLAG=4,WRAP_CURRY_FLAG$2=8,WRAP_ARY_FLAG$1=128,WRAP_REARG_FLAG$1=256,nativeMin=Math.min;function mergeData$1(to,ue){var eo=to[1],no=ue[1],ro=eo|no,oo=ro<(WRAP_BIND_FLAG$1|WRAP_BIND_KEY_FLAG$1|WRAP_ARY_FLAG$1),io=no==WRAP_ARY_FLAG$1&&eo==WRAP_CURRY_FLAG$2||no==WRAP_ARY_FLAG$1&&eo==WRAP_REARG_FLAG$1&&to[7].length<=ue[8]||no==(WRAP_ARY_FLAG$1|WRAP_REARG_FLAG$1)&&ue[7].length<=ue[8]&&eo==WRAP_CURRY_FLAG$2;if(!(oo||io))return to;no&WRAP_BIND_FLAG$1&&(to[2]=ue[2],ro|=eo&WRAP_BIND_FLAG$1?0:WRAP_CURRY_BOUND_FLAG);var ao=ue[3];if(ao){var so=to[3];to[3]=so?composeArgs(so,ao,ue[4]):ao,to[4]=so?replaceHolders(to[3],PLACEHOLDER):ue[4]}return ao=ue[5],ao&&(so=to[5],to[5]=so?composeArgsRight(so,ao,ue[6]):ao,to[6]=so?replaceHolders(to[5],PLACEHOLDER):ue[6]),ao=ue[7],ao&&(to[7]=ao),no&WRAP_ARY_FLAG$1&&(to[8]=to[8]==null?ue[8]:nativeMin(to[8],ue[8])),to[9]==null&&(to[9]=ue[9]),to[0]=ue[0],to[1]=ro,to}var _mergeData=mergeData$1,reWhitespace=/\s/;function trimmedEndIndex$1(to){for(var ue=to.length;ue--&&reWhitespace.test(to.charAt(ue)););return ue}var _trimmedEndIndex=trimmedEndIndex$1,trimmedEndIndex=_trimmedEndIndex,reTrimStart=/^\s+/;function baseTrim$1(to){return to&&to.slice(0,trimmedEndIndex(to)+1).replace(reTrimStart,"")}var _baseTrim=baseTrim$1,baseTrim=_baseTrim,isObject$3=isObject_1,isSymbol$2=isSymbol_1,NAN=0/0,reIsBadHex=/^[-+]0x[0-9a-f]+$/i,reIsBinary=/^0b[01]+$/i,reIsOctal=/^0o[0-7]+$/i,freeParseInt=parseInt;function toNumber$1(to){if(typeof to=="number")return to;if(isSymbol$2(to))return NAN;if(isObject$3(to)){var ue=typeof to.valueOf=="function"?to.valueOf():to;to=isObject$3(ue)?ue+"":ue}if(typeof to!="string")return to===0?to:+to;to=baseTrim(to);var eo=reIsBinary.test(to);return eo||reIsOctal.test(to)?freeParseInt(to.slice(2),eo?2:8):reIsBadHex.test(to)?NAN:+to}var toNumber_1=toNumber$1,toNumber=toNumber_1,INFINITY=1/0,MAX_INTEGER=17976931348623157e292;function toFinite$1(to){if(!to)return to===0?to:0;if(to=toNumber(to),to===INFINITY||to===-INFINITY){var ue=to<0?-1:1;return ue*MAX_INTEGER}return to===to?to:0}var toFinite_1=toFinite$1,toFinite=toFinite_1;function toInteger$1(to){var ue=toFinite(to),eo=ue%1;return ue===ue?eo?ue-eo:ue:0}var toInteger_1=toInteger$1,baseSetData=_baseSetData,createBind=_createBind,createCurry=_createCurry,createHybrid=_createHybrid,createPartial=_createPartial,getData=_getData,mergeData=_mergeData,setData=_setData,setWrapToString=_setWrapToString,toInteger=toInteger_1,FUNC_ERROR_TEXT="Expected a function",WRAP_BIND_FLAG=1,WRAP_BIND_KEY_FLAG=2,WRAP_CURRY_FLAG$1=8,WRAP_CURRY_RIGHT_FLAG=16,WRAP_PARTIAL_FLAG=32,WRAP_PARTIAL_RIGHT_FLAG=64,nativeMax$1=Math.max;function createWrap$3(to,ue,eo,no,ro,oo,io,ao){var so=ue&WRAP_BIND_KEY_FLAG;if(!so&&typeof to!="function")throw new TypeError(FUNC_ERROR_TEXT);var lo=no?no.length:0;if(lo||(ue&=~(WRAP_PARTIAL_FLAG|WRAP_PARTIAL_RIGHT_FLAG),no=ro=void 0),io=io===void 0?io:nativeMax$1(toInteger(io),0),ao=ao===void 0?ao:toInteger(ao),lo-=ro?ro.length:0,ue&WRAP_PARTIAL_RIGHT_FLAG){var co=no,uo=ro;no=ro=void 0}var fo=so?void 0:getData(to),po=[to,ue,eo,no,ro,co,uo,oo,io,ao];if(fo&&mergeData(po,fo),to=po[0],ue=po[1],eo=po[2],no=po[3],ro=po[4],ao=po[9]=po[9]===void 0?so?0:to.length:nativeMax$1(po[9]-lo,0),!ao&&ue&(WRAP_CURRY_FLAG$1|WRAP_CURRY_RIGHT_FLAG)&&(ue&=~(WRAP_CURRY_FLAG$1|WRAP_CURRY_RIGHT_FLAG)),!ue||ue==WRAP_BIND_FLAG)var ho=createBind(to,ue,eo);else ue==WRAP_CURRY_FLAG$1||ue==WRAP_CURRY_RIGHT_FLAG?ho=createCurry(to,ue,ao):(ue==WRAP_PARTIAL_FLAG||ue==(WRAP_BIND_FLAG|WRAP_PARTIAL_FLAG))&&!ro.length?ho=createPartial(to,ue,eo,no):ho=createHybrid.apply(void 0,po);var _o=fo?baseSetData:setData;return setWrapToString(_o(ho,po),to,ue)}var _createWrap=createWrap$3,createWrap$2=_createWrap,WRAP_ARY_FLAG=128;function ary(to,ue,eo){return ue=eo?void 0:ue,ue=to&&ue==null?to.length:ue,createWrap$2(to,WRAP_ARY_FLAG,void 0,void 0,void 0,void 0,ue)}var ary_1=ary,baseAssignValue$1=_baseAssignValue,eq=eq_1,objectProto$3=Object.prototype,hasOwnProperty$3=objectProto$3.hasOwnProperty;function assignValue$2(to,ue,eo){var no=to[ue];(!(hasOwnProperty$3.call(to,ue)&&eq(no,eo))||eo===void 0&&!(ue in to))&&baseAssignValue$1(to,ue,eo)}var _assignValue=assignValue$2,assignValue$1=_assignValue,baseAssignValue=_baseAssignValue;function copyObject$4(to,ue,eo,no){var ro=!eo;eo||(eo={});for(var oo=-1,io=ue.length;++oo<io;){var ao=ue[oo],so=no?no(eo[ao],to[ao],ao,eo,to):void 0;so===void 0&&(so=to[ao]),ro?baseAssignValue(eo,ao,so):assignValue$1(eo,ao,so)}return eo}var _copyObject=copyObject$4,copyObject$3=_copyObject,keys$1=keys_1;function baseAssign$1(to,ue){return to&©Object$3(ue,keys$1(ue),to)}var _baseAssign=baseAssign$1;function nativeKeysIn$1(to){var ue=[];if(to!=null)for(var eo in Object(to))ue.push(eo);return ue}var _nativeKeysIn=nativeKeysIn$1,isObject$2=isObject_1,isPrototype$1=_isPrototype,nativeKeysIn=_nativeKeysIn,objectProto$2=Object.prototype,hasOwnProperty$2=objectProto$2.hasOwnProperty;function baseKeysIn$1(to){if(!isObject$2(to))return nativeKeysIn(to);var ue=isPrototype$1(to),eo=[];for(var no in to)no=="constructor"&&(ue||!hasOwnProperty$2.call(to,no))||eo.push(no);return eo}var _baseKeysIn=baseKeysIn$1,arrayLikeKeys=_arrayLikeKeys,baseKeysIn=_baseKeysIn,isArrayLike=isArrayLike_1;function keysIn$3(to){return isArrayLike(to)?arrayLikeKeys(to,!0):baseKeysIn(to)}var keysIn_1=keysIn$3,copyObject$2=_copyObject,keysIn$2=keysIn_1;function baseAssignIn$1(to,ue){return to&©Object$2(ue,keysIn$2(ue),to)}var _baseAssignIn=baseAssignIn$1,_cloneBuffer={exports:{}};_cloneBuffer.exports;(function(to,ue){var eo=_root,no=ue&&!ue.nodeType&&ue,ro=no&&!0&&to&&!to.nodeType&&to,oo=ro&&ro.exports===no,io=oo?eo.Buffer:void 0,ao=io?io.allocUnsafe:void 0;function so(lo,co){if(co)return lo.slice();var uo=lo.length,fo=ao?ao(uo):new lo.constructor(uo);return lo.copy(fo),fo}to.exports=so})(_cloneBuffer,_cloneBuffer.exports);var _cloneBufferExports=_cloneBuffer.exports,copyObject$1=_copyObject,getSymbols$1=_getSymbols;function copySymbols$1(to,ue){return copyObject$1(to,getSymbols$1(to),ue)}var _copySymbols=copySymbols$1,overArg=_overArg,getPrototype$3=overArg(Object.getPrototypeOf,Object),_getPrototype=getPrototype$3,arrayPush$1=_arrayPush,getPrototype$2=_getPrototype,getSymbols=_getSymbols,stubArray=stubArray_1,nativeGetSymbols=Object.getOwnPropertySymbols,getSymbolsIn$2=nativeGetSymbols?function(to){for(var ue=[];to;)arrayPush$1(ue,getSymbols(to)),to=getPrototype$2(to);return ue}:stubArray,_getSymbolsIn=getSymbolsIn$2,copyObject=_copyObject,getSymbolsIn$1=_getSymbolsIn;function copySymbolsIn$1(to,ue){return copyObject(to,getSymbolsIn$1(to),ue)}var _copySymbolsIn=copySymbolsIn$1,baseGetAllKeys=_baseGetAllKeys,getSymbolsIn=_getSymbolsIn,keysIn$1=keysIn_1;function getAllKeysIn$1(to){return baseGetAllKeys(to,keysIn$1,getSymbolsIn)}var _getAllKeysIn=getAllKeysIn$1,objectProto$1=Object.prototype,hasOwnProperty$1=objectProto$1.hasOwnProperty;function initCloneArray$1(to){var ue=to.length,eo=new to.constructor(ue);return ue&&typeof to[0]=="string"&&hasOwnProperty$1.call(to,"index")&&(eo.index=to.index,eo.input=to.input),eo}var _initCloneArray=initCloneArray$1,Uint8Array$1=_Uint8Array;function cloneArrayBuffer$3(to){var ue=new to.constructor(to.byteLength);return new Uint8Array$1(ue).set(new Uint8Array$1(to)),ue}var _cloneArrayBuffer=cloneArrayBuffer$3,cloneArrayBuffer$2=_cloneArrayBuffer;function cloneDataView$1(to,ue){var eo=ue?cloneArrayBuffer$2(to.buffer):to.buffer;return new to.constructor(eo,to.byteOffset,to.byteLength)}var _cloneDataView=cloneDataView$1,reFlags=/\w*$/;function cloneRegExp$1(to){var ue=new to.constructor(to.source,reFlags.exec(to));return ue.lastIndex=to.lastIndex,ue}var _cloneRegExp=cloneRegExp$1,Symbol$2=_Symbol,symbolProto=Symbol$2?Symbol$2.prototype:void 0,symbolValueOf=symbolProto?symbolProto.valueOf:void 0;function cloneSymbol$1(to){return symbolValueOf?Object(symbolValueOf.call(to)):{}}var _cloneSymbol=cloneSymbol$1,cloneArrayBuffer$1=_cloneArrayBuffer;function cloneTypedArray$1(to,ue){var eo=ue?cloneArrayBuffer$1(to.buffer):to.buffer;return new to.constructor(eo,to.byteOffset,to.length)}var _cloneTypedArray=cloneTypedArray$1,cloneArrayBuffer=_cloneArrayBuffer,cloneDataView=_cloneDataView,cloneRegExp=_cloneRegExp,cloneSymbol=_cloneSymbol,cloneTypedArray=_cloneTypedArray,boolTag$1="[object Boolean]",dateTag$1="[object Date]",mapTag$2="[object Map]",numberTag$1="[object Number]",regexpTag$1="[object RegExp]",setTag$2="[object Set]",stringTag$1="[object String]",symbolTag$1="[object Symbol]",arrayBufferTag$1="[object ArrayBuffer]",dataViewTag$1="[object DataView]",float32Tag$1="[object Float32Array]",float64Tag$1="[object Float64Array]",int8Tag$1="[object Int8Array]",int16Tag$1="[object Int16Array]",int32Tag$1="[object Int32Array]",uint8Tag$1="[object Uint8Array]",uint8ClampedTag$1="[object Uint8ClampedArray]",uint16Tag$1="[object Uint16Array]",uint32Tag$1="[object Uint32Array]";function initCloneByTag$1(to,ue,eo){var no=to.constructor;switch(ue){case arrayBufferTag$1:return cloneArrayBuffer(to);case boolTag$1:case dateTag$1:return new no(+to);case dataViewTag$1:return cloneDataView(to,eo);case float32Tag$1:case float64Tag$1:case int8Tag$1:case int16Tag$1:case int32Tag$1:case uint8Tag$1:case uint8ClampedTag$1:case uint16Tag$1:case uint32Tag$1:return cloneTypedArray(to,eo);case mapTag$2:return new no;case numberTag$1:case stringTag$1:return new no(to);case regexpTag$1:return cloneRegExp(to);case setTag$2:return new no;case symbolTag$1:return cloneSymbol(to)}}var _initCloneByTag=initCloneByTag$1,baseCreate=_baseCreate,getPrototype$1=_getPrototype,isPrototype=_isPrototype;function initCloneObject$1(to){return typeof to.constructor=="function"&&!isPrototype(to)?baseCreate(getPrototype$1(to)):{}}var _initCloneObject=initCloneObject$1,getTag$3=_getTag,isObjectLike$4=isObjectLike_1,mapTag$1="[object Map]";function baseIsMap$1(to){return isObjectLike$4(to)&&getTag$3(to)==mapTag$1}var _baseIsMap=baseIsMap$1,baseIsMap=_baseIsMap,baseUnary$1=_baseUnary,nodeUtil$1=_nodeUtilExports,nodeIsMap=nodeUtil$1&&nodeUtil$1.isMap,isMap$2=nodeIsMap?baseUnary$1(nodeIsMap):baseIsMap,isMap_1=isMap$2,getTag$2=_getTag,isObjectLike$3=isObjectLike_1,setTag$1="[object Set]";function baseIsSet$1(to){return isObjectLike$3(to)&&getTag$2(to)==setTag$1}var _baseIsSet=baseIsSet$1,baseIsSet=_baseIsSet,baseUnary=_baseUnary,nodeUtil=_nodeUtilExports,nodeIsSet=nodeUtil&&nodeUtil.isSet,isSet$2=nodeIsSet?baseUnary(nodeIsSet):baseIsSet,isSet_1=isSet$2,Stack=_Stack,arrayEach=_arrayEach,assignValue=_assignValue,baseAssign=_baseAssign,baseAssignIn=_baseAssignIn,cloneBuffer=_cloneBufferExports,copyArray$1=_copyArray,copySymbols=_copySymbols,copySymbolsIn=_copySymbolsIn,getAllKeys=_getAllKeys,getAllKeysIn=_getAllKeysIn,getTag$1=_getTag,initCloneArray=_initCloneArray,initCloneByTag=_initCloneByTag,initCloneObject=_initCloneObject,isArray$6=isArray_1,isBuffer$1=isBufferExports,isMap$1=isMap_1,isObject$1=isObject_1,isSet$1=isSet_1,keys=keys_1,keysIn=keysIn_1,CLONE_DEEP_FLAG$1=1,CLONE_FLAT_FLAG=2,CLONE_SYMBOLS_FLAG$1=4,argsTag="[object Arguments]",arrayTag="[object Array]",boolTag="[object Boolean]",dateTag="[object Date]",errorTag$1="[object Error]",funcTag="[object Function]",genTag="[object GeneratorFunction]",mapTag="[object Map]",numberTag="[object Number]",objectTag$1="[object Object]",regexpTag="[object RegExp]",setTag="[object Set]",stringTag="[object String]",symbolTag="[object Symbol]",weakMapTag$1="[object WeakMap]",arrayBufferTag="[object ArrayBuffer]",dataViewTag="[object DataView]",float32Tag="[object Float32Array]",float64Tag="[object Float64Array]",int8Tag="[object Int8Array]",int16Tag="[object Int16Array]",int32Tag="[object Int32Array]",uint8Tag="[object Uint8Array]",uint8ClampedTag="[object Uint8ClampedArray]",uint16Tag="[object Uint16Array]",uint32Tag="[object Uint32Array]",cloneableTags={};cloneableTags[argsTag]=cloneableTags[arrayTag]=cloneableTags[arrayBufferTag]=cloneableTags[dataViewTag]=cloneableTags[boolTag]=cloneableTags[dateTag]=cloneableTags[float32Tag]=cloneableTags[float64Tag]=cloneableTags[int8Tag]=cloneableTags[int16Tag]=cloneableTags[int32Tag]=cloneableTags[mapTag]=cloneableTags[numberTag]=cloneableTags[objectTag$1]=cloneableTags[regexpTag]=cloneableTags[setTag]=cloneableTags[stringTag]=cloneableTags[symbolTag]=cloneableTags[uint8Tag]=cloneableTags[uint8ClampedTag]=cloneableTags[uint16Tag]=cloneableTags[uint32Tag]=!0;cloneableTags[errorTag$1]=cloneableTags[funcTag]=cloneableTags[weakMapTag$1]=!1;function baseClone$2(to,ue,eo,no,ro,oo){var io,ao=ue&CLONE_DEEP_FLAG$1,so=ue&CLONE_FLAT_FLAG,lo=ue&CLONE_SYMBOLS_FLAG$1;if(eo&&(io=ro?eo(to,no,ro,oo):eo(to)),io!==void 0)return io;if(!isObject$1(to))return to;var co=isArray$6(to);if(co){if(io=initCloneArray(to),!ao)return copyArray$1(to,io)}else{var uo=getTag$1(to),fo=uo==funcTag||uo==genTag;if(isBuffer$1(to))return cloneBuffer(to,ao);if(uo==objectTag$1||uo==argsTag||fo&&!ro){if(io=so||fo?{}:initCloneObject(to),!ao)return so?copySymbolsIn(to,baseAssignIn(io,to)):copySymbols(to,baseAssign(io,to))}else{if(!cloneableTags[uo])return ro?to:{};io=initCloneByTag(to,uo,ao)}}oo||(oo=new Stack);var po=oo.get(to);if(po)return po;oo.set(to,io),isSet$1(to)?to.forEach(function(go){io.add(baseClone$2(go,ue,eo,go,to,oo))}):isMap$1(to)&&to.forEach(function(go,bo){io.set(bo,baseClone$2(go,ue,eo,bo,to,oo))});var ho=lo?so?getAllKeysIn:getAllKeys:so?keysIn:keys,_o=co?void 0:ho(to);return arrayEach(_o||to,function(go,bo){_o&&(bo=go,go=to[bo]),assignValue(io,bo,baseClone$2(go,ue,eo,bo,to,oo))}),io}var _baseClone=baseClone$2,baseClone$1=_baseClone,CLONE_SYMBOLS_FLAG=4;function clone(to){return baseClone$1(to,CLONE_SYMBOLS_FLAG)}var clone_1=clone,createWrap$1=_createWrap,WRAP_CURRY_FLAG=8;function curry(to,ue,eo){ue=eo?void 0:ue;var no=createWrap$1(to,WRAP_CURRY_FLAG,void 0,void 0,void 0,void 0,void 0,ue);return no.placeholder=curry.placeholder,no}curry.placeholder={};var curry_1=curry,baseGetTag$1=_baseGetTag,getPrototype=_getPrototype,isObjectLike$2=isObjectLike_1,objectTag="[object Object]",funcProto=Function.prototype,objectProto=Object.prototype,funcToString=funcProto.toString,hasOwnProperty=objectProto.hasOwnProperty,objectCtorString=funcToString.call(Object);function isPlainObject$1(to){if(!isObjectLike$2(to)||baseGetTag$1(to)!=objectTag)return!1;var ue=getPrototype(to);if(ue===null)return!0;var eo=hasOwnProperty.call(ue,"constructor")&&ue.constructor;return typeof eo=="function"&&eo instanceof eo&&funcToString.call(eo)==objectCtorString}var isPlainObject_1=isPlainObject$1,baseGetTag=_baseGetTag,isObjectLike$1=isObjectLike_1,isPlainObject=isPlainObject_1,domExcTag="[object DOMException]",errorTag="[object Error]";function isError$1(to){if(!isObjectLike$1(to))return!1;var ue=baseGetTag(to);return ue==errorTag||ue==domExcTag||typeof to.message=="string"&&typeof to.name=="string"&&!isPlainObject(to)}var isError_1=isError$1,getTag=_getTag,isObjectLike=isObjectLike_1,weakMapTag="[object WeakMap]";function isWeakMap$1(to){return isObjectLike(to)&&getTag(to)==weakMapTag}var isWeakMap_1=isWeakMap$1,baseClone=_baseClone,baseIteratee=_baseIteratee,CLONE_DEEP_FLAG=1;function iteratee(to){return baseIteratee(typeof to=="function"?to:baseClone(to,CLONE_DEEP_FLAG))}var iteratee_1=iteratee,Symbol$1=_Symbol,isArguments=isArguments_1,isArray$5=isArray_1,spreadableSymbol=Symbol$1?Symbol$1.isConcatSpreadable:void 0;function isFlattenable$1(to){return isArray$5(to)||isArguments(to)||!!(spreadableSymbol&&to&&to[spreadableSymbol])}var _isFlattenable=isFlattenable$1,arrayPush=_arrayPush,isFlattenable=_isFlattenable;function baseFlatten$1(to,ue,eo,no,ro){var oo=-1,io=to.length;for(eo||(eo=isFlattenable),ro||(ro=[]);++oo<io;){var ao=to[oo];ue>0&&eo(ao)?ue>1?baseFlatten$1(ao,ue-1,eo,no,ro):arrayPush(ro,ao):no||(ro[ro.length]=ao)}return ro}var _baseFlatten=baseFlatten$1,baseFlatten=_baseFlatten;function flatten$1(to){var ue=to==null?0:to.length;return ue?baseFlatten(to,1):[]}var flatten_1=flatten$1,apply=_apply,nativeMax=Math.max;function overRest$1(to,ue,eo){return ue=nativeMax(ue===void 0?to.length-1:ue,0),function(){for(var no=arguments,ro=-1,oo=nativeMax(no.length-ue,0),io=Array(oo);++ro<oo;)io[ro]=no[ue+ro];ro=-1;for(var ao=Array(ue+1);++ro<ue;)ao[ro]=no[ro];return ao[ue]=eo(io),apply(to,this,ao)}}var _overRest=overRest$1,flatten=flatten_1,overRest=_overRest,setToString=_setToString;function flatRest$1(to){return setToString(overRest(to,void 0,flatten),to+"")}var _flatRest=flatRest$1,createWrap=_createWrap,flatRest=_flatRest,WRAP_REARG_FLAG=256,rearg=flatRest(function(to,ue){return createWrap(to,WRAP_REARG_FLAG,void 0,void 0,void 0,ue)}),rearg_1=rearg,arrayMap=_arrayMap,copyArray=_copyArray,isArray$4=isArray_1,isSymbol$1=isSymbol_1,stringToPath$1=_stringToPath,toKey=_toKey,toString$3=toString_1;function toPath(to){return isArray$4(to)?arrayMap(to,toKey):isSymbol$1(to)?[to]:copyArray(stringToPath$1(toString$3(to)))}var toPath_1=toPath,_util={ary:ary_1,assign:_baseAssign,clone:clone_1,curry:curry_1,forEach:_arrayEach,isArray:isArray_1,isError:isError_1,isFunction:isFunction_1,isWeakMap:isWeakMap_1,iteratee:iteratee_1,keys:_baseKeys,rearg:rearg_1,toInteger:toInteger_1,toPath:toPath_1},baseConvert=_baseConvert$1,util$e=_util;function convert$1(to,ue,eo){return baseConvert(util$e,to,ue,eo)}var convert_1=convert$1,_arrayAggregator,hasRequired_arrayAggregator;function require_arrayAggregator(){if(hasRequired_arrayAggregator)return _arrayAggregator;hasRequired_arrayAggregator=1;function to(ue,eo,no,ro){for(var oo=-1,io=ue==null?0:ue.length;++oo<io;){var ao=ue[oo];eo(ro,ao,no(ao),ue)}return ro}return _arrayAggregator=to,_arrayAggregator}var _createBaseEach,hasRequired_createBaseEach;function require_createBaseEach(){if(hasRequired_createBaseEach)return _createBaseEach;hasRequired_createBaseEach=1;var to=isArrayLike_1;function ue(eo,no){return function(ro,oo){if(ro==null)return ro;if(!to(ro))return eo(ro,oo);for(var io=ro.length,ao=no?io:-1,so=Object(ro);(no?ao--:++ao<io)&&oo(so[ao],ao,so)!==!1;);return ro}}return _createBaseEach=ue,_createBaseEach}var _baseEach,hasRequired_baseEach;function require_baseEach(){if(hasRequired_baseEach)return _baseEach;hasRequired_baseEach=1;var to=_baseForOwn,ue=require_createBaseEach(),eo=ue(to);return _baseEach=eo,_baseEach}var _baseAggregator,hasRequired_baseAggregator;function require_baseAggregator(){if(hasRequired_baseAggregator)return _baseAggregator;hasRequired_baseAggregator=1;var to=require_baseEach();function ue(eo,no,ro,oo){return to(eo,function(io,ao,so){no(oo,io,ro(io),so)}),oo}return _baseAggregator=ue,_baseAggregator}var _createAggregator,hasRequired_createAggregator;function require_createAggregator(){if(hasRequired_createAggregator)return _createAggregator;hasRequired_createAggregator=1;var to=require_arrayAggregator(),ue=require_baseAggregator(),eo=_baseIteratee,no=isArray_1;function ro(oo,io){return function(ao,so){var lo=no(ao)?to:ue,co=io?io():{};return lo(ao,oo,eo(so),co)}}return _createAggregator=ro,_createAggregator}var groupBy_1,hasRequiredGroupBy;function requireGroupBy(){if(hasRequiredGroupBy)return groupBy_1;hasRequiredGroupBy=1;var to=_baseAssignValue,ue=require_createAggregator(),eo=Object.prototype,no=eo.hasOwnProperty,ro=ue(function(oo,io,ao){no.call(oo,ao)?oo[ao].push(io):to(oo,ao,[io])});return groupBy_1=ro,groupBy_1}var convert=convert_1,func$L=convert("groupBy",requireGroupBy());func$L.placeholder=placeholder$3;var groupBy=func$L;const groupBy$1=getDefaultExportFromCjs$1(groupBy);function handlebarsCompletions(){const to=getManifest();return Object.keys(to).flatMap(ue=>Object.entries(to[ue]).map(([eo,no])=>({text:eo,path:eo,example:no.example,label:eo,displayText:eo,description:no.description,allowsJs:!no.requiresBlock&&!helpersToRemoveForJs.includes(eo)})))}const BindingSidePanel_svelte_svelte_type_style_lang="";function get_each_context$1H(to,ue,eo){const no=to.slice();return no[37]=ue[eo],no}function get_each_context_1$s(to,ue,eo){const no=to.slice();return no[40]=ue[eo],no}function get_each_context_2$8(to,ue,eo){const no=to.slice();return no[43]=ue[eo],no}function get_each_context_3(to,ue,eo){const no=to.slice();return no[46]=ue[eo],no}function create_if_block_13$2(to){let ue,eo=to[8].description+"";return{c(){ue=element("div")},m(no,ro){insert$1(no,ue,ro),ue.innerHTML=eo},p(no,ro){ro[0]&256&&eo!==(eo=no[8].description+"")&&(ue.innerHTML=eo)},d(no){no&&detach(ue)}}}function create_if_block_12$2(to){let ue,eo=to[8].code+"";return{c(){ue=element("pre"),attr(ue,"class","svelte-jofp16")},m(no,ro){insert$1(no,ue,ro),ue.innerHTML=eo},p(no,ro){ro[0]&256&&eo!==(eo=no[8].code+"")&&(ue.innerHTML=eo)},d(no){no&&detach(ue)}}}function create_default_slot_1$3_(to){let ue,eo,no=to[8].description&&create_if_block_13$2(to),ro=to[8].code&&create_if_block_12$2(to);return{c(){ue=element("div"),no&&no.c(),eo=space$1(),ro&&ro.c(),attr(ue,"class","binding-popover svelte-jofp16"),toggle_class(ue,"helper",to[8].helper)},m(oo,io){insert$1(oo,ue,io),no&&no.m(ue,null),append$2(ue,eo),ro&&ro.m(ue,null)},p(oo,io){oo[8].description?no?no.p(oo,io):(no=create_if_block_13$2(oo),no.c(),no.m(ue,eo)):no&&(no.d(1),no=null),oo[8].code?ro?ro.p(oo,io):(ro=create_if_block_12$2(oo),ro.c(),ro.m(ue,null)):ro&&(ro.d(1),ro=null),io[0]&256&&toggle_class(ue,"helper",oo[8].helper)},d(oo){oo&&detach(ue),no&&no.d(),ro&&ro.d()}}}function create_if_block_11$4(to){let ue,eo,no,ro,oo;return eo=new Icon({props:{name:"BackAndroid",hoverable:!0,size:"S"}}),eo.$on("click",to[26]),{c(){ue=element("div"),create_component(eo.$$.fragment),no=space$1(),ro=text(to[4]),attr(ue,"class","header svelte-jofp16")},m(io,ao){insert$1(io,ue,ao),mount_component(eo,ue,null),append$2(ue,no),append$2(ue,ro),oo=!0},p(io,ao){(!oo||ao[0]&16)&&set_data(ro,io[4])},i(io){oo||(transition_in(eo.$$.fragment,io),oo=!0)},o(io){transition_out(eo.$$.fragment,io),oo=!1},d(io){io&&detach(ue),destroy_component(eo)}}}function create_if_block_9$d(to){let ue,eo,no,ro;const oo=[create_if_block_10$7,create_else_block_1$p],io=[];function ao(so,lo){return so[5]?0:1}return eo=ao(to),no=io[eo]=oo[eo](to),{c(){ue=element("div"),no.c(),attr(ue,"class","header svelte-jofp16")},m(so,lo){insert$1(so,ue,lo),io[eo].m(ue,null),ro=!0},p(so,lo){let co=eo;eo=ao(so),eo===co?io[eo].p(so,lo):(group_outros(),transition_out(io[co],1,1,()=>{io[co]=null}),check_outros(),no=io[eo],no?no.p(so,lo):(no=io[eo]=oo[eo](so),no.c()),transition_in(no,1),no.m(ue,null))},i(so){ro||(transition_in(no),ro=!0)},o(so){transition_out(no),ro=!1},d(so){so&&detach(ue),io[eo].d()}}}function create_else_block_1$p(to){let ue,eo,no,ro;return no=new Icon({props:{size:"S",name:"Search",hoverable:!0,newStyles:!0}}),no.$on("click",to[17]),{c(){ue=element("div"),ue.textContent="Bindings",eo=space$1(),create_component(no.$$.fragment),attr(ue,"class","title svelte-jofp16")},m(oo,io){insert$1(oo,ue,io),insert$1(oo,eo,io),mount_component(no,oo,io),ro=!0},p:noop$6,i(oo){ro||(transition_in(no.$$.fragment,oo),ro=!0)},o(oo){transition_out(no.$$.fragment,oo),ro=!1},d(oo){oo&&(detach(ue),detach(eo)),destroy_component(no,oo)}}}function create_if_block_10$7(to){let ue,eo,no,ro,oo,io;function ao(lo){to[27](lo)}let so={placeholder:"Search for bindings",autocomplete:"off",autofocus:!0};return to[3]!==void 0&&(so.value=to[3]),eo=new Input$5({props:so}),binding_callbacks.push(()=>bind$2(eo,"value",ao)),oo=new Icon({props:{size:"S",name:"Close",hoverable:!0,newStyles:!0}}),oo.$on("click",to[18]),{c(){ue=element("div"),create_component(eo.$$.fragment),ro=space$1(),create_component(oo.$$.fragment),attr(ue,"class","search-input svelte-jofp16")},m(lo,co){insert$1(lo,ue,co),mount_component(eo,ue,null),insert$1(lo,ro,co),mount_component(oo,lo,co),io=!0},p(lo,co){const uo={};!no&&co[0]&8&&(no=!0,uo.value=lo[3],add_flush_callback(()=>no=!1)),eo.$set(uo)},i(lo){io||(transition_in(eo.$$.fragment,lo),transition_in(oo.$$.fragment,lo),io=!0)},o(lo){transition_out(eo.$$.fragment,lo),transition_out(oo.$$.fragment,lo),io=!1},d(lo){lo&&(detach(ue),detach(ro)),destroy_component(eo),destroy_component(oo,lo)}}}function create_if_block_8$f(to){let ue,eo,no=ensure_array_like(to[11]),ro=[];for(let io=0;io<no.length;io+=1)ro[io]=create_each_block_3(get_each_context_3(to,no,io));const oo=io=>transition_out(ro[io],1,1,()=>{ro[io]=null});return{c(){ue=element("ul");for(let io=0;io<ro.length;io+=1)ro[io].c();attr(ue,"class","category-list svelte-jofp16")},m(io,ao){insert$1(io,ue,ao);for(let so=0;so<ro.length;so+=1)ro[so]&&ro[so].m(ue,null);eo=!0},p(io,ao){if(ao[0]&6160){no=ensure_array_like(io[11]);let so;for(so=0;so<no.length;so+=1){const lo=get_each_context_3(io,no,so);ro[so]?(ro[so].p(lo,ao),transition_in(ro[so],1)):(ro[so]=create_each_block_3(lo),ro[so].c(),transition_in(ro[so],1),ro[so].m(ue,null))}for(group_outros(),so=no.length;so<ro.length;so+=1)oo(so);check_outros()}},i(io){if(!eo){for(let ao=0;ao<no.length;ao+=1)transition_in(ro[ao]);eo=!0}},o(io){ro=ro.filter(Boolean);for(let ao=0;ao<ro.length;ao+=1)transition_out(ro[ao]);eo=!1},d(io){io&&detach(ue),destroy_each(ro,io)}}}function create_each_block_3(to){let ue,eo,no,ro,oo=to[46]+"",io,ao,so,lo,co,uo,fo,po;eo=new Icon({props:{size:"S",color:"var(--spectrum-global-color-gray-700)",name:to[12][to[46]]}}),lo=new Icon({props:{name:"ChevronRight"}});function ho(){return to[28](to[46])}return{c(){ue=element("li"),create_component(eo.$$.fragment),no=space$1(),ro=element("span"),io=text(oo),ao=space$1(),so=element("span"),create_component(lo.$$.fragment),co=space$1(),attr(ro,"class","category-name svelte-jofp16"),attr(so,"class","category-chevron svelte-jofp16"),attr(ue,"class","svelte-jofp16")},m(_o,go){insert$1(_o,ue,go),mount_component(eo,ue,null),append$2(ue,no),append$2(ue,ro),append$2(ro,io),append$2(ue,ao),append$2(ue,so),mount_component(lo,so,null),append$2(ue,co),uo=!0,fo||(po=listen(ue,"click",ho),fo=!0)},p(_o,go){to=_o;const bo={};go[0]&6144&&(bo.name=to[12][to[46]]),eo.$set(bo),(!uo||go[0]&2048)&&oo!==(oo=to[46]+"")&&set_data(io,oo)},i(_o){uo||(transition_in(eo.$$.fragment,_o),transition_in(lo.$$.fragment,_o),uo=!0)},o(_o){transition_out(eo.$$.fragment,_o),transition_out(lo.$$.fragment,_o),uo=!1},d(_o){_o&&detach(ue),destroy_component(eo),destroy_component(lo),fo=!1,po()}}}function create_if_block$47(to){let ue,eo,no,ro=ensure_array_like(to[10]),oo=[];for(let so=0;so<ro.length;so+=1)oo[so]=create_each_block_1$s(get_each_context_1$s(to,ro,so));const io=so=>transition_out(oo[so],1,1,()=>{oo[so]=null});let ao=(to[4]==="Helpers"||to[3])&&create_if_block_1$2c(to);return{c(){for(let so=0;so<oo.length;so+=1)oo[so].c();ue=space$1(),ao&&ao.c(),eo=empty$2()},m(so,lo){for(let co=0;co<oo.length;co+=1)oo[co]&&oo[co].m(so,lo);insert$1(so,ue,lo),ao&&ao.m(so,lo),insert$1(so,eo,lo),no=!0},p(so,lo){if(lo[0]&46082){ro=ensure_array_like(so[10]);let co;for(co=0;co<ro.length;co+=1){const uo=get_each_context_1$s(so,ro,co);oo[co]?(oo[co].p(uo,lo),transition_in(oo[co],1)):(oo[co]=create_each_block_1$s(uo),oo[co].c(),transition_in(oo[co],1),oo[co].m(ue.parentNode,ue))}for(group_outros(),co=ro.length;co<oo.length;co+=1)io(co);check_outros()}so[4]==="Helpers"||so[3]?ao?ao.p(so,lo):(ao=create_if_block_1$2c(so),ao.c(),ao.m(eo.parentNode,eo)):ao&&(ao.d(1),ao=null)},i(so){if(!no){for(let lo=0;lo<ro.length;lo+=1)transition_in(oo[lo]);no=!0}},o(so){oo=oo.filter(Boolean);for(let lo=0;lo<oo.length;lo+=1)transition_out(oo[lo]);no=!1},d(so){so&&(detach(ue),detach(eo)),destroy_each(oo,so),ao&&ao.d(so)}}}function create_if_block_3$Z(to){let ue,eo,no,ro,oo=to[10].length>1&&create_if_block_7$k(to),io=ensure_array_like(to[40].bindings),ao=[];for(let so=0;so<io.length;so+=1)ao[so]=create_each_block_2$8(get_each_context_2$8(to,io,so));return{c(){ue=element("div"),oo&&oo.c(),eo=space$1(),no=element("ul");for(let so=0;so<ao.length;so+=1)ao[so].c();attr(no,"class","svelte-jofp16"),attr(ue,"class","sub-section svelte-jofp16")},m(so,lo){insert$1(so,ue,lo),oo&&oo.m(ue,null),append$2(ue,eo),append$2(ue,no);for(let co=0;co<ao.length;co+=1)ao[co]&&ao[co].m(no,null);ro=!0},p(so,lo){if(so[10].length>1?oo?(oo.p(so,lo),lo[0]&1024&&transition_in(oo,1)):(oo=create_if_block_7$k(so),oo.c(),transition_in(oo,1),oo.m(ue,eo)):oo&&(group_outros(),transition_out(oo,1,1,()=>{oo=null}),check_outros()),lo[0]&41986){io=ensure_array_like(so[40].bindings);let co;for(co=0;co<io.length;co+=1){const uo=get_each_context_2$8(so,io,co);ao[co]?ao[co].p(uo,lo):(ao[co]=create_each_block_2$8(uo),ao[co].c(),ao[co].m(no,null))}for(;co<ao.length;co+=1)ao[co].d(1);ao.length=io.length}},i(so){ro||(transition_in(oo),ro=!0)},o(so){transition_out(oo),ro=!1},d(so){so&&detach(ue),oo&&oo.d(),destroy_each(ao,so)}}}function create_if_block_7$k(to){let ue,eo,no=to[40].name+"",ro,oo;return eo=new Icon({props:{name:to[12][to[40].name]}}),{c(){ue=element("div"),create_component(eo.$$.fragment),ro=text(no),attr(ue,"class","cat-heading svelte-jofp16")},m(io,ao){insert$1(io,ue,ao),mount_component(eo,ue,null),append$2(ue,ro),oo=!0},p(io,ao){const so={};ao[0]&5120&&(so.name=io[12][io[40].name]),eo.$set(so),(!oo||ao[0]&1024)&&no!==(no=io[40].name+"")&&set_data(ro,no)},i(io){oo||(transition_in(eo.$$.fragment,io),oo=!0)},o(io){transition_out(eo.$$.fragment,io),oo=!1},d(io){io&&detach(ue),destroy_component(eo)}}}function create_else_block$1C(to){let ue=to[43].readableBinding+"",eo;return{c(){eo=text(ue)},m(no,ro){insert$1(no,eo,ro)},p(no,ro){ro[0]&1024&&ue!==(ue=no[43].readableBinding+"")&&set_data(eo,ue)},d(no){no&&detach(eo)}}}function create_if_block_6$n(to){var no;let ue=((no=to[43].fieldSchema)==null?void 0:no.name)+"",eo;return{c(){eo=text(ue)},m(ro,oo){insert$1(ro,eo,oo)},p(ro,oo){var io;oo[0]&1024&&ue!==(ue=((io=ro[43].fieldSchema)==null?void 0:io.name)+"")&&set_data(eo,ue)},d(ro){ro&&detach(eo)}}}function create_if_block_5$w(to){let ue=to[43].display.name+"",eo;return{c(){eo=text(ue)},m(no,ro){insert$1(no,eo,ro)},p(no,ro){ro[0]&1024&&ue!==(ue=no[43].display.name+"")&&set_data(eo,ue)},d(no){no&&detach(eo)}}}function create_if_block_4$I(to){var oo,io;let ue,eo,no=(((oo=to[43].display)==null?void 0:oo.type)||((io=to[43].fieldSchema)==null?void 0:io.type))+"",ro;return{c(){ue=element("span"),eo=element("span"),ro=text(no),attr(eo,"class","binding__type svelte-jofp16"),attr(ue,"class","binding__typeWrap svelte-jofp16")},m(ao,so){insert$1(ao,ue,so),append$2(ue,eo),append$2(eo,ro)},p(ao,so){var lo,co;so[0]&1024&&no!==(no=(((lo=ao[43].display)==null?void 0:lo.type)||((co=ao[43].fieldSchema)==null?void 0:co.type))+"")&&set_data(ro,no)},d(ao){ao&&detach(ue)}}}function create_each_block_2$8(to){var fo,po;let ue,eo,no,ro,oo;function io(ho,_o){var go,bo;return(go=ho[43].display)!=null&&go.name?create_if_block_5$w:(bo=ho[43].fieldSchema)!=null&&bo.name?create_if_block_6$n:create_else_block$1C}let ao=io(to),so=ao(to),lo=(((fo=to[43].display)==null?void 0:fo.type)||((po=to[43].fieldSchema)==null?void 0:po.type))&&create_if_block_4$I(to);function co(...ho){return to[29](to[43],...ho)}function uo(){return to[30](to[43])}return{c(){ue=element("li"),eo=element("span"),so.c(),no=space$1(),lo&&lo.c(),attr(eo,"class","binding__label svelte-jofp16"),attr(ue,"class","binding svelte-jofp16")},m(ho,_o){insert$1(ho,ue,_o),append$2(ue,eo),so.m(eo,null),append$2(ue,no),lo&&lo.m(ue,null),ro||(oo=[listen(ue,"mouseenter",co),listen(ue,"mouseleave",to[15]),listen(ue,"click",uo)],ro=!0)},p(ho,_o){var go,bo;to=ho,ao===(ao=io(to))&&so?so.p(to,_o):(so.d(1),so=ao(to),so&&(so.c(),so.m(eo,null))),(go=to[43].display)!=null&&go.type||(bo=to[43].fieldSchema)!=null&&bo.type?lo?lo.p(to,_o):(lo=create_if_block_4$I(to),lo.c(),lo.m(ue,null)):lo&&(lo.d(1),lo=null)},d(ho){ho&&detach(ue),so.d(),lo&&lo.d(),ro=!1,run_all(oo)}}}function create_each_block_1$s(to){var ro;let ue,eo,no=((ro=to[40].bindings)==null?void 0:ro.length)&&create_if_block_3$Z(to);return{c(){no&&no.c(),ue=empty$2()},m(oo,io){no&&no.m(oo,io),insert$1(oo,ue,io),eo=!0},p(oo,io){var ao;(ao=oo[40].bindings)!=null&&ao.length?no?(no.p(oo,io),io[0]&1024&&transition_in(no,1)):(no=create_if_block_3$Z(oo),no.c(),transition_in(no,1),no.m(ue.parentNode,ue)):no&&(group_outros(),transition_out(no,1,1,()=>{no=null}),check_outros())},i(oo){eo||(transition_in(no),eo=!0)},o(oo){transition_out(no),eo=!1},d(oo){oo&&detach(ue),no&&no.d(oo)}}}function create_if_block_1$2c(to){var no;let ue,eo=((no=to[9])==null?void 0:no.length)&&create_if_block_2$1m(to);return{c(){eo&&eo.c(),ue=empty$2()},m(ro,oo){eo&&eo.m(ro,oo),insert$1(ro,ue,oo)},p(ro,oo){var io;(io=ro[9])!=null&&io.length?eo?eo.p(ro,oo):(eo=create_if_block_2$1m(ro),eo.c(),eo.m(ue.parentNode,ue)):eo&&(eo.d(1),eo=null)},d(ro){ro&&detach(ue),eo&&eo.d(ro)}}}function create_if_block_2$1m(to){let ue,eo,no=ensure_array_like(to[9]),ro=[];for(let oo=0;oo<no.length;oo+=1)ro[oo]=create_each_block$1H(get_each_context$1H(to,no,oo));return{c(){ue=element("div"),eo=element("ul");for(let oo=0;oo<ro.length;oo+=1)ro[oo].c();attr(eo,"class","helpers svelte-jofp16"),attr(ue,"class","sub-section svelte-jofp16")},m(oo,io){insert$1(oo,ue,io),append$2(ue,eo);for(let ao=0;ao<ro.length;ao+=1)ro[ao]&&ro[ao].m(eo,null)},p(oo,io){if(io[0]&49669){no=ensure_array_like(oo[9]);let ao;for(ao=0;ao<no.length;ao+=1){const so=get_each_context$1H(oo,no,ao);ro[ao]?ro[ao].p(so,io):(ro[ao]=create_each_block$1H(so),ro[ao].c(),ro[ao].m(eo,null))}for(;ao<ro.length;ao+=1)ro[ao].d(1);ro.length=no.length}},d(oo){oo&&detach(ue),destroy_each(ro,oo)}}}function create_each_block$1H(to){let ue,eo,no=to[37].displayText+"",ro,oo,io,ao,so,lo;function co(...fo){return to[31](to[37],...fo)}function uo(){return to[32](to[37])}return{c(){ue=element("li"),eo=element("span"),ro=text(no),oo=space$1(),io=element("span"),io.innerHTML='<span class="binding__type svelte-jofp16">function</span>',ao=space$1(),attr(eo,"class","binding__label svelte-jofp16"),attr(io,"class","binding__typeWrap svelte-jofp16"),attr(ue,"class","binding svelte-jofp16")},m(fo,po){insert$1(fo,ue,po),append$2(ue,eo),append$2(eo,ro),append$2(ue,oo),append$2(ue,io),append$2(ue,ao),so||(lo=[listen(ue,"mouseenter",co),listen(ue,"mouseleave",to[15]),listen(ue,"click",uo)],so=!0)},p(fo,po){to=fo,po[0]&512&&no!==(no=to[37].displayText+"")&&set_data(ro,no)},d(fo){fo&&detach(ue),so=!1,run_all(lo)}}}function create_default_slot$5F(to){let ue,eo,no,ro,oo,io=to[4]&&create_if_block_11$4(to),ao=!to[4]&&create_if_block_9$d(to),so=!to[4]&&!to[3]&&create_if_block_8$f(to),lo=(to[4]||to[3])&&create_if_block$47(to);return{c(){io&&io.c(),ue=space$1(),ao&&ao.c(),eo=space$1(),so&&so.c(),no=space$1(),lo&&lo.c(),ro=empty$2()},m(co,uo){io&&io.m(co,uo),insert$1(co,ue,uo),ao&&ao.m(co,uo),insert$1(co,eo,uo),so&&so.m(co,uo),insert$1(co,no,uo),lo&&lo.m(co,uo),insert$1(co,ro,uo),oo=!0},p(co,uo){co[4]?io?(io.p(co,uo),uo[0]&16&&transition_in(io,1)):(io=create_if_block_11$4(co),io.c(),transition_in(io,1),io.m(ue.parentNode,ue)):io&&(group_outros(),transition_out(io,1,1,()=>{io=null}),check_outros()),co[4]?ao&&(group_outros(),transition_out(ao,1,1,()=>{ao=null}),check_outros()):ao?(ao.p(co,uo),uo[0]&16&&transition_in(ao,1)):(ao=create_if_block_9$d(co),ao.c(),transition_in(ao,1),ao.m(eo.parentNode,eo)),!co[4]&&!co[3]?so?(so.p(co,uo),uo[0]&24&&transition_in(so,1)):(so=create_if_block_8$f(co),so.c(),transition_in(so,1),so.m(no.parentNode,no)):so&&(group_outros(),transition_out(so,1,1,()=>{so=null}),check_outros()),co[4]||co[3]?lo?(lo.p(co,uo),uo[0]&24&&transition_in(lo,1)):(lo=create_if_block$47(co),lo.c(),transition_in(lo,1),lo.m(ro.parentNode,ro)):lo&&(group_outros(),transition_out(lo,1,1,()=>{lo=null}),check_outros())},i(co){oo||(transition_in(io),transition_in(ao),transition_in(so),transition_in(lo),oo=!0)},o(co){transition_out(io),transition_out(ao),transition_out(so),transition_out(lo),oo=!1},d(co){co&&(detach(ue),detach(eo),detach(no),detach(ro)),io&&io.d(co),ao&&ao.d(co),so&&so.d(co),lo&&lo.d(co)}}}function create_fragment$8P(to){let ue,eo,no,ro,oo,io={align:"left-outside",anchor:to[7],minWidth:0,maxWidth:480,maxHeight:480,dismissible:!1,$$slots:{default:[create_default_slot_1$3_]},$$scope:{ctx:to}};return ue=new Popover({props:io}),to[25](ue),ue.$on("mouseenter",to[16]),ue.$on("mouseleave",to[15]),ro=new Layout$n({props:{noPadding:!0,gap:"S",$$slots:{default:[create_default_slot$5F]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment),eo=space$1(),no=element("div"),create_component(ro.$$.fragment),attr(no,"class","binding-side-panel svelte-jofp16")},m(ao,so){mount_component(ue,ao,so),insert$1(ao,eo,so),insert$1(ao,no,so),mount_component(ro,no,null),oo=!0},p(ao,so){const lo={};so[0]&128&&(lo.anchor=ao[7]),so[0]&256|so[1]&262144&&(lo.$$scope={dirty:so,ctx:ao}),ue.$set(lo);const co={};so[0]&7743|so[1]&262144&&(co.$$scope={dirty:so,ctx:ao}),ro.$set(co)},i(ao){oo||(transition_in(ue.$$.fragment,ao),transition_in(ro.$$.fragment,ao),oo=!0)},o(ao){transition_out(ue.$$.fragment,ao),transition_out(ro.$$.fragment,ao),oo=!1},d(ao){ao&&(detach(eo),detach(no)),to[25](null),destroy_component(ue,ao),destroy_component(ro)}}}function instance$8P(to,ue,eo){let no,ro,oo,io,ao,so,lo,{addHelper:co}=ue,{addBinding:uo}=ue,{bindings:fo}=ue,{mode:po}=ue,{allowHelpers:ho}=ue,{context:_o=null}=ue,go="",bo=!1,vo,yo,wo,ko=handlebarsCompletions(),So,Eo;const Io=(Ko,ra)=>{let ea=Ko.example||"";return ra&&(ea=convertToJS(ea).split(`
|
|
887
|
-
`)[0].split("= ")[1],ea==="null;"&&(ea="")),ea||""},Ao=Ko=>{let ra=[...Ko.map(ea=>ea[0])];return ho&&ra.push("Helpers"),ra},To=(Ko,ra)=>{!_o||!Ko.value||Ko.value===""||(Fo(),eo(7,yo=ra),eo(8,wo={helper:!1,code:Ko.valueHTML}),vo.show())},Mo=(Ko,ra)=>{Fo(),!(!Ko.displayText&&Ko.description)&&(eo(7,yo=ra),eo(8,wo={helper:!0,description:Ko.description,code:Io(Ko,po.name==="javascript")}),vo.show())},Vo=()=>{Eo=setTimeout(()=>{vo.hide(),eo(7,yo=null),eo(8,wo=null),Eo=null},100)},Fo=()=>{Eo&&(clearTimeout(Eo),Eo=null)},Po=async()=>{eo(5,bo=!0),eo(3,go="")},Ro=Ko=>{Ko.stopPropagation(),eo(5,bo=!1),eo(3,go="")};function Do(Ko){binding_callbacks[Ko?"unshift":"push"](()=>{vo=Ko,eo(6,vo)})}const qo=()=>eo(4,So=null);function Uo(Ko){go=Ko,eo(3,go)}const jo=Ko=>{eo(4,So=Ko)},Zo=(Ko,ra)=>To(Ko,ra.target),Qo=Ko=>uo(Ko),Yo=(Ko,ra)=>Mo(Ko,ra.target),Xo=Ko=>co(Ko,po.name==="javascript");return to.$$set=Ko=>{"addHelper"in Ko&&eo(0,co=Ko.addHelper),"addBinding"in Ko&&eo(1,uo=Ko.addBinding),"bindings"in Ko&&eo(19,fo=Ko.bindings),"mode"in Ko&&eo(2,po=Ko.mode),"allowHelpers"in Ko&&eo(20,ho=Ko.allowHelpers),"context"in Ko&&eo(21,_o=Ko.context)},to.$$.update=()=>{to.$$.dirty[0]&524288&&eo(24,no=fo==null?void 0:fo.reduce((Ko,ra)=>(ra.icon&&(Ko[ra.category]=Ko[ra.category]||ra.icon),Ko),{})),to.$$.dirty[0]&16777216&&eo(12,ro={...no,Helpers:"MagicWand"}),to.$$.dirty[0]&524288&&eo(23,oo=Object.entries(groupBy$1("category",fo))),to.$$.dirty[0]&8388608&&eo(11,io=Ao(oo)),to.$$.dirty[0]&8&&eo(22,ao=new RegExp(go,"ig")),to.$$.dirty[0]&12582936&&eo(10,so=oo.map(([Ko,ra])=>({name:Ko,bindings:ra==null?void 0:ra.filter(ea=>!go||ea.readableBinding.match(ao))})).filter(Ko=>{var ra;return((ra=Ko.bindings)==null?void 0:ra.length)>0&&(So?So===Ko.name:!0)})),to.$$.dirty[0]&4194316&&eo(9,lo=ko==null?void 0:ko.filter(Ko=>(!go||Ko.label.match(ao)||Ko.description.match(ao))&&(po.name!=="javascript"||Ko.allowsJs)))},[co,uo,po,go,So,bo,vo,yo,wo,lo,so,io,ro,To,Mo,Vo,Fo,Po,Ro,fo,ho,_o,ao,oo,no,Do,qo,Uo,jo,Zo,Qo,Yo,Xo]}class BindingSidePanel extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$8P,create_fragment$8P,safe_not_equal,{addHelper:0,addBinding:1,bindings:19,mode:2,allowHelpers:20,context:21},null,[-1,-1])}}var jsonFormatHighlight={exports:{}};(function(to,ue){(function(eo,no){to.exports=no()})(commonjsGlobal$1,function(){var eo={keyColor:"dimgray",numberColor:"lightskyblue",stringColor:"lightcoral",trueColor:"lightseagreen",falseColor:"#f66578",nullColor:"cornflowerblue"},no={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`","=":"="};function ro(io){return String(io).replace(/[&<>"'`=]/g,function(ao){return no[ao]})}function oo(io,ao){ao===void 0&&(ao={});var so=typeof io;so!=="string"&&(io=JSON.stringify(io,null,2)||so);var lo=Object.assign({},eo,ao);return io=io.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),io.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+]?\d+)?)/g,function(co){var uo=lo.numberColor,fo="";return/^"/.test(co)?/:$/.test(co)?uo=lo.keyColor:(uo=lo.stringColor,co='"'+ro(co.substr(1,co.length-2))+'"',fo="word-wrap:break-word;white-space:pre-wrap;"):uo=/true/.test(co)?lo.trueColor:/false/.test(co)?lo.falseColor:/null/.test(co)?lo.nullColor:uo,'<span style="'+fo+"color:"+uo+'">'+co+"</span>"})}return oo})})(jsonFormatHighlight);var jsonFormatHighlightExports=jsonFormatHighlight.exports;const formatHighlight=getDefaultExportFromCjs$1(jsonFormatHighlightExports),EvaluationSidePanel_svelte_svelte_type_style_lang="";function create_else_block_1$o(to){let ue,eo,no,ro,oo,io,ao,so=to[1]&&create_if_block_5$v(),lo=!to[2]&&create_if_block_4$H(to);return{c(){ue=element("div"),ue.textContent="Preview",eo=space$1(),so&&so.c(),no=space$1(),ro=element("span"),oo=space$1(),lo&&lo.c(),io=empty$2(),attr(ro,"class","svelte-1mm33o7")},m(co,uo){insert$1(co,ue,uo),insert$1(co,eo,uo),so&&so.m(co,uo),insert$1(co,no,uo),insert$1(co,ro,uo),insert$1(co,oo,uo),lo&&lo.m(co,uo),insert$1(co,io,uo),ao=!0},p(co,uo){co[1]?so?uo&2&&transition_in(so,1):(so=create_if_block_5$v(),so.c(),transition_in(so,1),so.m(no.parentNode,no)):so&&(group_outros(),transition_out(so,1,1,()=>{so=null}),check_outros()),co[2]?lo&&(group_outros(),transition_out(lo,1,1,()=>{lo=null}),check_outros()):lo?(lo.p(co,uo),uo&4&&transition_in(lo,1)):(lo=create_if_block_4$H(co),lo.c(),transition_in(lo,1),lo.m(io.parentNode,io))},i(co){ao||(transition_in(so),transition_in(lo),ao=!0)},o(co){transition_out(so),transition_out(lo),ao=!1},d(co){co&&(detach(ue),detach(eo),detach(no),detach(ro),detach(oo),detach(io)),so&&so.d(co),lo&&lo.d(co)}}}function create_if_block_2$1l(to){let ue,eo,no,ro,oo,io,ao,so,lo;ue=new Icon({props:{name:"Alert",color:"var(--spectrum-global-color-red-600)"}});let co=to[1]&&create_if_block_3$Y();return so=new Icon({props:{name:"Copy",size:"S",hoverable:!0}}),so.$on("click",to[7]),{c(){create_component(ue.$$.fragment),eo=space$1(),no=element("div"),no.textContent="Error",ro=space$1(),co&&co.c(),oo=space$1(),io=element("span"),ao=space$1(),create_component(so.$$.fragment),attr(io,"class","svelte-1mm33o7")},m(uo,fo){mount_component(ue,uo,fo),insert$1(uo,eo,fo),insert$1(uo,no,fo),insert$1(uo,ro,fo),co&&co.m(uo,fo),insert$1(uo,oo,fo),insert$1(uo,io,fo),insert$1(uo,ao,fo),mount_component(so,uo,fo),lo=!0},p(uo,fo){uo[1]?co?fo&2&&transition_in(co,1):(co=create_if_block_3$Y(),co.c(),transition_in(co,1),co.m(oo.parentNode,oo)):co&&(group_outros(),transition_out(co,1,1,()=>{co=null}),check_outros())},i(uo){lo||(transition_in(ue.$$.fragment,uo),transition_in(co),transition_in(so.$$.fragment,uo),lo=!0)},o(uo){transition_out(ue.$$.fragment,uo),transition_out(co),transition_out(so.$$.fragment,uo),lo=!1},d(uo){uo&&(detach(eo),detach(no),detach(ro),detach(oo),detach(io),detach(ao)),destroy_component(ue,uo),co&&co.d(uo),destroy_component(so,uo)}}}function create_if_block_5$v(to){let ue,eo,no,ro;return eo=new ProgressCircle({props:{size:"S"}}),{c(){ue=element("div"),create_component(eo.$$.fragment)},m(oo,io){insert$1(oo,ue,io),mount_component(eo,ue,null),ro=!0},i(oo){ro||(transition_in(eo.$$.fragment,oo),oo&&add_render_callback(()=>{ro&&(no||(no=create_bidirectional_transition(ue,fade,{duration:130},!0)),no.run(1))}),ro=!0)},o(oo){transition_out(eo.$$.fragment,oo),oo&&(no||(no=create_bidirectional_transition(ue,fade,{duration:130},!1)),no.run(0)),ro=!1},d(oo){oo&&detach(ue),destroy_component(eo),oo&&no&&no.end()}}}function create_if_block_4$H(to){let ue,eo;return ue=new Icon({props:{name:"Copy",newStyles:!0,size:"S",hoverable:!0}}),ue.$on("click",to[7]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p:noop$6,i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block_3$Y(to){let ue,eo,no,ro;return eo=new ProgressCircle({props:{size:"S"}}),{c(){ue=element("div"),create_component(eo.$$.fragment)},m(oo,io){insert$1(oo,ue,io),mount_component(eo,ue,null),ro=!0},i(oo){ro||(transition_in(eo.$$.fragment,oo),oo&&add_render_callback(()=>{ro&&(no||(no=create_bidirectional_transition(ue,fade,{duration:130},!0)),no.run(1))}),ro=!0)},o(oo){transition_out(eo.$$.fragment,oo),oo&&(no||(no=create_bidirectional_transition(ue,fade,{duration:130},!1)),no.run(0)),ro=!1},d(oo){oo&&detach(ue),destroy_component(eo),oo&&no&&no.end()}}}function create_else_block$1B(to){let ue,eo;return{c(){ue=new HtmlTag(!1),eo=empty$2(),ue.a=eo},m(no,ro){ue.m(to[4],no,ro),insert$1(no,eo,ro)},p(no,ro){ro&16&&ue.p(no[4])},d(no){no&&(detach(eo),ue.d())}}}function create_if_block_1$2b(to){let ue=to[6](to[0])+"",eo;return{c(){eo=text(ue)},m(no,ro){insert$1(no,eo,ro)},p(no,ro){ro&1&&ue!==(ue=no[6](no[0])+"")&&set_data(eo,ue)},d(no){no&&detach(eo)}}}function create_if_block$46(to){let ue;return{c(){ue=text("Your expression will be evaluated here")},m(eo,no){insert$1(eo,ue,no)},p:noop$6,d(eo){eo&&detach(ue)}}}function create_fragment$8O(to){let ue,eo,no,ro,oo,io,ao,so;const lo=[create_if_block_2$1l,create_else_block_1$o],co=[];function uo(_o,go){return _o[3]?0:1}ro=uo(to),oo=co[ro]=lo[ro](to);function fo(_o,go){return _o[2]?create_if_block$46:_o[3]?create_if_block_1$2b:create_else_block$1B}let po=fo(to),ho=po(to);return{c(){ue=element("div"),eo=element("div"),no=element("div"),oo.c(),io=space$1(),ao=element("div"),ho.c(),attr(no,"class","header-content svelte-1mm33o7"),attr(eo,"class","header svelte-1mm33o7"),toggle_class(eo,"success",to[5]),toggle_class(eo,"error",to[3]),attr(ao,"class","body svelte-1mm33o7"),attr(ue,"class","evaluation-side-panel svelte-1mm33o7")},m(_o,go){insert$1(_o,ue,go),append$2(ue,eo),append$2(eo,no),co[ro].m(no,null),append$2(ue,io),append$2(ue,ao),ho.m(ao,null),so=!0},p(_o,[go]){let bo=ro;ro=uo(_o),ro===bo?co[ro].p(_o,go):(group_outros(),transition_out(co[bo],1,1,()=>{co[bo]=null}),check_outros(),oo=co[ro],oo?oo.p(_o,go):(oo=co[ro]=lo[ro](_o),oo.c()),transition_in(oo,1),oo.m(no,null)),(!so||go&32)&&toggle_class(eo,"success",_o[5]),(!so||go&8)&&toggle_class(eo,"error",_o[3]),po===(po=fo(_o))&&ho?ho.p(_o,go):(ho.d(1),ho=po(_o),ho&&(ho.c(),ho.m(ao,null)))},i(_o){so||(transition_in(oo),so=!0)},o(_o){transition_out(oo),so=!1},d(_o){_o&&detach(ue),co[ro].d(),ho.d()}}}function instance$8O(to,ue,eo){let no,ro,oo,io,{expressionResult:ao}=ue,{expressionError:so}=ue,{evaluating:lo=!1}=ue,{expression:co=null}=ue;const uo=ho=>ho.code===UserScriptError.code?ho.userScriptError.toString():ho.toString(),fo=ho=>{if(ho==null)return"";try{ho=JSON.stringify(JSON.parse(ho),null,2)}catch{}return formatHighlight(ho,{keyColor:"#e06c75",numberColor:"#e5c07b",stringColor:"#98c379",trueColor:"#d19a66",falseColor:"#d19a66",nullColor:"#c678dd"})},po=()=>{let ho=ao.result;typeof ho=="object"&&(ho=JSON.stringify(ho,null,2)),copyToClipboard(ho),notifications.success("Value copied to clipboard")};return to.$$set=ho=>{"expressionResult"in ho&&eo(8,ao=ho.expressionResult),"expressionError"in ho&&eo(0,so=ho.expressionError),"evaluating"in ho&&eo(1,lo=ho.evaluating),"expression"in ho&&eo(9,co=ho.expression)},to.$$.update=()=>{to.$$.dirty&1&&eo(3,no=so!=null),to.$$.dirty&512&&eo(2,ro=co==null||(co==null?void 0:co.trim())===""),to.$$.dirty&12&&eo(5,oo=!no&&!ro),to.$$.dirty&256&&eo(4,io=fo(ao))},[so,lo,ro,no,io,oo,uo,po,ao,co]}class EvaluationSidePanel extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$8O,create_fragment$8O,safe_not_equal,{expressionResult:8,expressionError:0,evaluating:1,expression:9})}}const SnippetDrawer_svelte_svelte_type_style_lang="";function create_else_block$1A(to){let ue,eo,no,ro,oo,io,ao;function so(uo){to[15](uo)}let lo={};to[1]!==void 0&&(lo.value=to[1]),ro=new Input$5({props:lo}),binding_callbacks.push(()=>bind$2(ro,"value",so));let co=to[6]&&create_if_block_2$1k(to);return{c(){ue=element("div"),eo=element("span"),eo.textContent="Name",no=space$1(),create_component(ro.$$.fragment),io=space$1(),co&&co.c(),attr(ue,"class","name svelte-8n6wau"),toggle_class(ue,"invalid",to[6]!=null)},m(uo,fo){insert$1(uo,ue,fo),append$2(ue,eo),append$2(ue,no),mount_component(ro,ue,null),append$2(ue,io),co&&co.m(ue,null),ao=!0},p(uo,fo){const po={};!oo&&fo&2&&(oo=!0,po.value=uo[1],add_flush_callback(()=>oo=!1)),ro.$set(po),uo[6]?co?(co.p(uo,fo),fo&64&&transition_in(co,1)):(co=create_if_block_2$1k(uo),co.c(),transition_in(co,1),co.m(ue,null)):co&&(group_outros(),transition_out(co,1,1,()=>{co=null}),check_outros()),(!ao||fo&64)&&toggle_class(ue,"invalid",uo[6]!=null)},i(uo){ao||(transition_in(ro.$$.fragment,uo),transition_in(co),ao=!0)},o(uo){transition_out(ro.$$.fragment,uo),transition_out(co),ao=!1},d(uo){uo&&detach(ue),destroy_component(ro),co&&co.d()}}}function create_if_block_1$2a(to){let ue=to[0].name+"",eo;return{c(){eo=text(ue)},m(no,ro){insert$1(no,eo,ro)},p(no,ro){ro&1&&ue!==(ue=no[0].name+"")&&set_data(eo,ue)},i:noop$6,o:noop$6,d(no){no&&detach(eo)}}}function create_if_block_2$1k(to){let ue,eo;return ue=new AbsTooltip({props:{text:to[6],type:TooltipType.Negative,$$slots:{default:[create_default_slot_2$2R]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&64&&(oo.text=no[6]),ro&1048576&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot_2$2R(to){let ue,eo;return ue=new Icon({props:{name:"Help",size:"S",color:"var(--spectrum-global-color-red-400)"}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p:noop$6,i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_title_slot(to){let ue,eo,no,ro;const oo=[create_if_block_1$2a,create_else_block$1A],io=[];function ao(so,lo){return so[0]?0:1}return ue=ao(to),eo=io[ue]=oo[ue](to),{c(){eo.c(),no=empty$2()},m(so,lo){io[ue].m(so,lo),insert$1(so,no,lo),ro=!0},p(so,lo){let co=ue;ue=ao(so),ue===co?io[ue].p(so,lo):(group_outros(),transition_out(io[co],1,1,()=>{io[co]=null}),check_outros(),eo=io[ue],eo?eo.p(so,lo):(eo=io[ue]=oo[ue](so),eo.c()),transition_in(eo,1),eo.m(no.parentNode,no))},i(so){ro||(transition_in(eo),ro=!0)},o(so){transition_out(eo),ro=!1},d(so){so&&detach(no),io[ue].d(so)}}}function create_if_block$45(to){let ue,eo;return ue=new Button({props:{warning:!0,disabled:to[4],$$slots:{default:[create_default_slot_1$3Z]},$$scope:{ctx:to}}}),ue.$on("click",function(){is_function(to[5].show)&&to[5].show.apply(this,arguments)}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){to=no;const oo={};ro&16&&(oo.disabled=to[4]),ro&1048576&&(oo.$$scope={dirty:ro,ctx:to}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot_1$3Z(to){let ue;return{c(){ue=text("Delete")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot$5E(to){let ue;return{c(){ue=text("Save")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_buttons_slot$h(to){let ue,eo,no,ro=to[0]&&create_if_block$45(to);return eo=new Button({props:{cta:!0,disabled:!to[2]||to[4]||to[6],$$slots:{default:[create_default_slot$5E]},$$scope:{ctx:to}}}),eo.$on("click",to[8]),{c(){ro&&ro.c(),ue=space$1(),create_component(eo.$$.fragment)},m(oo,io){ro&&ro.m(oo,io),insert$1(oo,ue,io),mount_component(eo,oo,io),no=!0},p(oo,io){oo[0]?ro?(ro.p(oo,io),io&1&&transition_in(ro,1)):(ro=create_if_block$45(oo),ro.c(),transition_in(ro,1),ro.m(ue.parentNode,ue)):ro&&(group_outros(),transition_out(ro,1,1,()=>{ro=null}),check_outros());const ao={};io&84&&(ao.disabled=!oo[2]||oo[4]||oo[6]),io&1048576&&(ao.$$scope={dirty:io,ctx:oo}),eo.$set(ao)},i(oo){no||(transition_in(ro),transition_in(eo.$$.fragment,oo),no=!0)},o(oo){transition_out(ro),transition_out(eo.$$.fragment,oo),no=!1},d(oo){oo&&detach(ue),ro&&ro.d(oo),destroy_component(eo,oo)}}}function create_tabs_slot(to){let ue,eo,no;return eo=new Input$5({props:{placeholder:"Name"}}),{c(){ue=element("div"),create_component(eo.$$.fragment),attr(ue,"slot","tabs")},m(ro,oo){insert$1(ro,ue,oo),mount_component(eo,ue,null),no=!0},p:noop$6,i(ro){no||(transition_in(eo.$$.fragment,ro),no=!0)},o(ro){transition_out(eo.$$.fragment,ro),no=!1},d(ro){ro&&detach(ue),destroy_component(eo)}}}function create_key_block$i(to){let ue,eo;return ue=new BindingPanel({props:{allowHBS:!1,allowJS:!0,allowSnippets:!1,showTabBar:!1,placeholder:"return function(input) ❴ ... ❵",value:to[2],$$slots:{tabs:[create_tabs_slot]},$$scope:{ctx:to}}}),ue.$on("change",to[14]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&4&&(oo.value=no[2]),ro&1048576&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_body_slot$g(to){let ue=to[7],eo,no,ro=create_key_block$i(to);return{c(){ro.c(),eo=empty$2()},m(oo,io){ro.m(oo,io),insert$1(oo,eo,io),no=!0},p(oo,io){io&128&&safe_not_equal(ue,ue=oo[7])?(group_outros(),transition_out(ro,1,1,noop$6),check_outros(),ro=create_key_block$i(oo),ro.c(),transition_in(ro,1),ro.m(eo.parentNode,eo)):ro.p(oo,io)},i(oo){no||(transition_in(ro),no=!0)},o(oo){transition_out(ro),no=!1},d(oo){oo&&detach(eo),ro.d(oo)}}}function create_fragment$8N(to){var ao;let ue,eo,no,ro,oo={$$slots:{body:[create_body_slot$g],buttons:[create_buttons_slot$h],title:[create_title_slot]},$$scope:{ctx:to}};ue=new Drawer({props:oo}),to[16](ue);let io={title:"Delete snippet",body:`Are you sure you want to delete ${(ao=to[0])==null?void 0:ao.name}?`,onOk:to[9]};return no=new ConfirmDialog({props:io}),to[17](no),{c(){create_component(ue.$$.fragment),eo=space$1(),create_component(no.$$.fragment)},m(so,lo){mount_component(ue,so,lo),insert$1(so,eo,lo),mount_component(no,so,lo),ro=!0},p(so,[lo]){var fo;const co={};lo&1048823&&(co.$$scope={dirty:lo,ctx:so}),ue.$set(co);const uo={};lo&1&&(uo.body=`Are you sure you want to delete ${(fo=so[0])==null?void 0:fo.name}?`),no.$set(uo)},i(so){ro||(transition_in(ue.$$.fragment,so),transition_in(no.$$.fragment,so),ro=!0)},o(so){transition_out(ue.$$.fragment,so),transition_out(no.$$.fragment,so),ro=!1},d(so){so&&detach(eo),to[16](null),destroy_component(ue,so),to[17](null),destroy_component(no,so)}}}const firstCharNumberRegex=/^[0-9].*$/;function instance$8N(to,ue,eo){let no,ro,oo,io,ao;component_subscribe(to,snippets$1,Eo=>eo(13,ao=Eo));let{snippet:so}=ue;const lo=()=>uo.show(),co=()=>uo.hide();let uo,fo="",po="",ho=!1,_o;const go=async()=>{eo(4,ho=!0);try{const Eo={name:fo,code:oo};await snippets$1.saveSnippet(Eo),uo.hide(),notifications.success(`Snippet ${Eo.name} saved`)}catch(Eo){notifications.error(Eo.message||"Error saving snippet")}eo(4,ho=!1)},bo=async()=>{eo(4,ho=!0);try{await snippets$1.deleteSnippet(so.name),uo.hide()}catch{notifications.error("Error deleting snippet")}eo(4,ho=!1)},vo=(Eo,Io)=>Eo!=null&&Eo.length?!(so!=null&&so.name)&&Io.some(Ao=>Ao.name===Eo)?"That name is already in use":firstCharNumberRegex.test(Eo)?"Can't start with a number":ValidSnippetNameRegex.test(Eo)?null:"No special characters or spaces":"Name is required",yo=Eo=>eo(2,po=Eo.detail);function wo(Eo){fo=Eo,eo(1,fo),eo(0,so),eo(12,no),eo(13,ao)}function ko(Eo){binding_callbacks[Eo?"unshift":"push"](()=>{uo=Eo,eo(3,uo)})}function So(Eo){binding_callbacks[Eo?"unshift":"push"](()=>{_o=Eo,eo(5,_o)})}return to.$$set=Eo=>{"snippet"in Eo&&eo(0,so=Eo.snippet)},to.$$.update=()=>{to.$$.dirty&8192&&eo(12,no=getSequentialName(ao,"MySnippet",Eo=>Eo.name)),to.$$.dirty&1&&eo(7,ro=so==null?void 0:so.name),to.$$.dirty&4097&&eo(1,fo=(so==null?void 0:so.name)||no),to.$$.dirty&1&&eo(2,po=so!=null&&so.code?encodeJSBinding(so.code):""),to.$$.dirty&4&&(oo=decodeJSBinding(po)),to.$$.dirty&8194&&eo(6,io=vo(fo,ao))},[so,fo,po,uo,ho,_o,io,ro,go,bo,lo,co,no,ao,yo,wo,ko,So]}class SnippetDrawer extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$8N,create_fragment$8N,safe_not_equal,{snippet:0,show:10,hide:11})}get show(){return this.$$.ctx[10]}get hide(){return this.$$.ctx[11]}}function create_if_block$44(to){let ue,eo,no,ro,oo;const io=[create_if_block_1$29,create_if_block_2$1j],ao=[];function so(lo,co){var uo,fo;return co&6&&(ue=null),lo[1].cloud&&((fo=(uo=lo[2])==null?void 0:uo.user)!=null&&fo.accountPortalAccess)?0:(ue==null&&(ue=!!(!lo[1].cloud&&isAdmin(lo[2].user))),ue?1:-1)}return~(eo=so(to,-1))&&(no=ao[eo]=io[eo](to)),{c(){no&&no.c(),ro=empty$2()},m(lo,co){~eo&&ao[eo].m(lo,co),insert$1(lo,ro,co),oo=!0},p(lo,co){let uo=eo;eo=so(lo,co),eo===uo?~eo&&ao[eo].p(lo,co):(no&&(group_outros(),transition_out(ao[uo],1,1,()=>{ao[uo]=null}),check_outros()),~eo?(no=ao[eo],no?no.p(lo,co):(no=ao[eo]=io[eo](lo),no.c()),transition_in(no,1),no.m(ro.parentNode,ro)):no=null)},i(lo){oo||(transition_in(no),oo=!0)},o(lo){transition_out(no),oo=!1},d(lo){lo&&detach(ro),~eo&&ao[eo].d(lo)}}}function create_if_block_2$1j(to){let ue,eo;return ue=new Button({props:{cta:!0,size:"M",$$slots:{default:[create_default_slot_1$3Y]},$$scope:{ctx:to}}}),ue.$on("click",to[6]),ue.$on("click",to[7]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&256&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block_1$29(to){let ue,eo;return ue=new Button({props:{cta:!0,size:"M",$$slots:{default:[create_default_slot$5D]},$$scope:{ctx:to}}}),ue.$on("click",to[4]),ue.$on("click",to[5]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&256&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot_1$3Y(to){let ue;return{c(){ue=text("Upgrade")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot$5D(to){let ue;return{c(){ue=text("Upgrade")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_fragment$8M(to){let ue,eo,no=!to[0].isEnterprisePlan&&!to[0].isEnterpriseTrial&&create_if_block$44(to);return{c(){no&&no.c(),ue=empty$2()},m(ro,oo){no&&no.m(ro,oo),insert$1(ro,ue,oo),eo=!0},p(ro,[oo]){!ro[0].isEnterprisePlan&&!ro[0].isEnterpriseTrial?no?(no.p(ro,oo),oo&1&&transition_in(no,1)):(no=create_if_block$44(ro),no.c(),transition_in(no,1),no.m(ue.parentNode,ue)):no&&(group_outros(),transition_out(no,1,1,()=>{no=null}),check_outros())},i(ro){eo||(transition_in(no),eo=!0)},o(ro){transition_out(no),eo=!1},d(ro){ro&&detach(ue),no&&no.d(ro)}}}function instance$8M(to,ue,eo){let no,ro,oo,io;component_subscribe(to,licensing,uo=>eo(0,no=uo)),component_subscribe(to,admin,uo=>eo(1,ro=uo)),component_subscribe(to,auth,uo=>eo(2,oo=uo)),component_subscribe(to,goto,uo=>eo(3,io=uo));function ao(uo){bubble.call(this,to,uo)}const so=()=>{window.open(ro.accountPortalUrl+"/portal/upgrade","_blank")},lo=()=>io("/builder/portal/account/upgrade");function co(uo){bubble.call(this,to,uo)}return[no,ro,oo,io,ao,so,lo,co]}class UpgradeButton extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$8M,create_fragment$8M,safe_not_equal,{})}}const SnippetSidePanel_svelte_svelte_type_style_lang="";function get_each_context$1G(to,ue,eo){const no=to.slice();return no[27]=ue[eo],no}function create_else_block_3$2(to){let ue,eo,no,ro;return no=new Tags({props:{$$slots:{default:[create_default_slot_4$1F]},$$scope:{ctx:to}}}),{c(){ue=element("div"),eo=text(`Snippets
|
|
887
|
+
`)[0].split("= ")[1],ea==="null;"&&(ea="")),ea||""},Ao=Ko=>{let ra=[...Ko.map(ea=>ea[0])];return ho&&ra.push("Helpers"),ra},To=(Ko,ra)=>{!_o||!Ko.value||Ko.value===""||(Fo(),eo(7,yo=ra),eo(8,wo={helper:!1,code:Ko.valueHTML}),vo.show())},Mo=(Ko,ra)=>{Fo(),!(!Ko.displayText&&Ko.description)&&(eo(7,yo=ra),eo(8,wo={helper:!0,description:Ko.description,code:Io(Ko,po.name==="javascript")}),vo.show())},Vo=()=>{Eo=setTimeout(()=>{vo.hide(),eo(7,yo=null),eo(8,wo=null),Eo=null},100)},Fo=()=>{Eo&&(clearTimeout(Eo),Eo=null)},Po=async()=>{eo(5,bo=!0),eo(3,go="")},Ro=Ko=>{Ko.stopPropagation(),eo(5,bo=!1),eo(3,go="")};function Do(Ko){binding_callbacks[Ko?"unshift":"push"](()=>{vo=Ko,eo(6,vo)})}const qo=()=>eo(4,So=null);function Uo(Ko){go=Ko,eo(3,go)}const jo=Ko=>{eo(4,So=Ko)},Zo=(Ko,ra)=>To(Ko,ra.target),Qo=Ko=>uo(Ko),Yo=(Ko,ra)=>Mo(Ko,ra.target),Xo=Ko=>co(Ko,po.name==="javascript");return to.$$set=Ko=>{"addHelper"in Ko&&eo(0,co=Ko.addHelper),"addBinding"in Ko&&eo(1,uo=Ko.addBinding),"bindings"in Ko&&eo(19,fo=Ko.bindings),"mode"in Ko&&eo(2,po=Ko.mode),"allowHelpers"in Ko&&eo(20,ho=Ko.allowHelpers),"context"in Ko&&eo(21,_o=Ko.context)},to.$$.update=()=>{to.$$.dirty[0]&524288&&eo(24,no=fo==null?void 0:fo.reduce((Ko,ra)=>(ra.icon&&(Ko[ra.category]=Ko[ra.category]||ra.icon),Ko),{})),to.$$.dirty[0]&16777216&&eo(12,ro={...no,Helpers:"MagicWand"}),to.$$.dirty[0]&524288&&eo(23,oo=Object.entries(groupBy$1("category",fo))),to.$$.dirty[0]&8388608&&eo(11,io=Ao(oo)),to.$$.dirty[0]&8&&eo(22,ao=new RegExp(go,"ig")),to.$$.dirty[0]&12582936&&eo(10,so=oo.map(([Ko,ra])=>({name:Ko,bindings:ra==null?void 0:ra.filter(ea=>!go||ea.readableBinding.match(ao))})).filter(Ko=>{var ra;return((ra=Ko.bindings)==null?void 0:ra.length)>0&&(So?So===Ko.name:!0)})),to.$$.dirty[0]&4194316&&eo(9,lo=ko==null?void 0:ko.filter(Ko=>(!go||Ko.label.match(ao)||Ko.description.match(ao))&&(po.name!=="javascript"||Ko.allowsJs)))},[co,uo,po,go,So,bo,vo,yo,wo,lo,so,io,ro,To,Mo,Vo,Fo,Po,Ro,fo,ho,_o,ao,oo,no,Do,qo,Uo,jo,Zo,Qo,Yo,Xo]}class BindingSidePanel extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$8P,create_fragment$8P,safe_not_equal,{addHelper:0,addBinding:1,bindings:19,mode:2,allowHelpers:20,context:21},null,[-1,-1])}}var jsonFormatHighlight={exports:{}};(function(to,ue){(function(eo,no){to.exports=no()})(commonjsGlobal$1,function(){var eo={keyColor:"dimgray",numberColor:"lightskyblue",stringColor:"lightcoral",trueColor:"lightseagreen",falseColor:"#f66578",nullColor:"cornflowerblue"},no={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`","=":"="};function ro(io){return String(io).replace(/[&<>"'`=]/g,function(ao){return no[ao]})}function oo(io,ao){ao===void 0&&(ao={});var so=typeof io;so!=="string"&&(io=JSON.stringify(io,null,2)||so);var lo=Object.assign({},eo,ao);return io=io.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),io.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+]?\d+)?)/g,function(co){var uo=lo.numberColor,fo="";return/^"/.test(co)?/:$/.test(co)?uo=lo.keyColor:(uo=lo.stringColor,co='"'+ro(co.substr(1,co.length-2))+'"',fo="word-wrap:break-word;white-space:pre-wrap;"):uo=/true/.test(co)?lo.trueColor:/false/.test(co)?lo.falseColor:/null/.test(co)?lo.nullColor:uo,'<span style="'+fo+"color:"+uo+'">'+co+"</span>"})}return oo})})(jsonFormatHighlight);var jsonFormatHighlightExports=jsonFormatHighlight.exports;const formatHighlight=getDefaultExportFromCjs$1(jsonFormatHighlightExports),EvaluationSidePanel_svelte_svelte_type_style_lang="";function create_else_block_1$o(to){let ue,eo,no,ro,oo,io,ao,so=to[1]&&create_if_block_5$v(),lo=!to[2]&&create_if_block_4$H(to);return{c(){ue=element("div"),ue.textContent="Preview",eo=space$1(),so&&so.c(),no=space$1(),ro=element("span"),oo=space$1(),lo&&lo.c(),io=empty$2(),attr(ro,"class","svelte-1mm33o7")},m(co,uo){insert$1(co,ue,uo),insert$1(co,eo,uo),so&&so.m(co,uo),insert$1(co,no,uo),insert$1(co,ro,uo),insert$1(co,oo,uo),lo&&lo.m(co,uo),insert$1(co,io,uo),ao=!0},p(co,uo){co[1]?so?uo&2&&transition_in(so,1):(so=create_if_block_5$v(),so.c(),transition_in(so,1),so.m(no.parentNode,no)):so&&(group_outros(),transition_out(so,1,1,()=>{so=null}),check_outros()),co[2]?lo&&(group_outros(),transition_out(lo,1,1,()=>{lo=null}),check_outros()):lo?(lo.p(co,uo),uo&4&&transition_in(lo,1)):(lo=create_if_block_4$H(co),lo.c(),transition_in(lo,1),lo.m(io.parentNode,io))},i(co){ao||(transition_in(so),transition_in(lo),ao=!0)},o(co){transition_out(so),transition_out(lo),ao=!1},d(co){co&&(detach(ue),detach(eo),detach(no),detach(ro),detach(oo),detach(io)),so&&so.d(co),lo&&lo.d(co)}}}function create_if_block_2$1l(to){let ue,eo,no,ro,oo,io,ao,so,lo;ue=new Icon({props:{name:"Alert",color:"var(--spectrum-global-color-red-600)"}});let co=to[1]&&create_if_block_3$Y();return so=new Icon({props:{name:"Copy",size:"S",hoverable:!0}}),so.$on("click",to[7]),{c(){create_component(ue.$$.fragment),eo=space$1(),no=element("div"),no.textContent="Error",ro=space$1(),co&&co.c(),oo=space$1(),io=element("span"),ao=space$1(),create_component(so.$$.fragment),attr(io,"class","svelte-1mm33o7")},m(uo,fo){mount_component(ue,uo,fo),insert$1(uo,eo,fo),insert$1(uo,no,fo),insert$1(uo,ro,fo),co&&co.m(uo,fo),insert$1(uo,oo,fo),insert$1(uo,io,fo),insert$1(uo,ao,fo),mount_component(so,uo,fo),lo=!0},p(uo,fo){uo[1]?co?fo&2&&transition_in(co,1):(co=create_if_block_3$Y(),co.c(),transition_in(co,1),co.m(oo.parentNode,oo)):co&&(group_outros(),transition_out(co,1,1,()=>{co=null}),check_outros())},i(uo){lo||(transition_in(ue.$$.fragment,uo),transition_in(co),transition_in(so.$$.fragment,uo),lo=!0)},o(uo){transition_out(ue.$$.fragment,uo),transition_out(co),transition_out(so.$$.fragment,uo),lo=!1},d(uo){uo&&(detach(eo),detach(no),detach(ro),detach(oo),detach(io),detach(ao)),destroy_component(ue,uo),co&&co.d(uo),destroy_component(so,uo)}}}function create_if_block_5$v(to){let ue,eo,no,ro;return eo=new ProgressCircle({props:{size:"S"}}),{c(){ue=element("div"),create_component(eo.$$.fragment)},m(oo,io){insert$1(oo,ue,io),mount_component(eo,ue,null),ro=!0},i(oo){ro||(transition_in(eo.$$.fragment,oo),oo&&add_render_callback(()=>{ro&&(no||(no=create_bidirectional_transition(ue,fade,{duration:130},!0)),no.run(1))}),ro=!0)},o(oo){transition_out(eo.$$.fragment,oo),oo&&(no||(no=create_bidirectional_transition(ue,fade,{duration:130},!1)),no.run(0)),ro=!1},d(oo){oo&&detach(ue),destroy_component(eo),oo&&no&&no.end()}}}function create_if_block_4$H(to){let ue,eo;return ue=new Icon({props:{name:"Copy",newStyles:!0,size:"S",hoverable:!0}}),ue.$on("click",to[7]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p:noop$6,i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block_3$Y(to){let ue,eo,no,ro;return eo=new ProgressCircle({props:{size:"S"}}),{c(){ue=element("div"),create_component(eo.$$.fragment)},m(oo,io){insert$1(oo,ue,io),mount_component(eo,ue,null),ro=!0},i(oo){ro||(transition_in(eo.$$.fragment,oo),oo&&add_render_callback(()=>{ro&&(no||(no=create_bidirectional_transition(ue,fade,{duration:130},!0)),no.run(1))}),ro=!0)},o(oo){transition_out(eo.$$.fragment,oo),oo&&(no||(no=create_bidirectional_transition(ue,fade,{duration:130},!1)),no.run(0)),ro=!1},d(oo){oo&&detach(ue),destroy_component(eo),oo&&no&&no.end()}}}function create_else_block$1B(to){let ue,eo;return{c(){ue=new HtmlTag(!1),eo=empty$2(),ue.a=eo},m(no,ro){ue.m(to[4],no,ro),insert$1(no,eo,ro)},p(no,ro){ro&16&&ue.p(no[4])},d(no){no&&(detach(eo),ue.d())}}}function create_if_block_1$2b(to){let ue=to[6](to[0])+"",eo;return{c(){eo=text(ue)},m(no,ro){insert$1(no,eo,ro)},p(no,ro){ro&1&&ue!==(ue=no[6](no[0])+"")&&set_data(eo,ue)},d(no){no&&detach(eo)}}}function create_if_block$46(to){let ue;return{c(){ue=text("Your expression will be evaluated here")},m(eo,no){insert$1(eo,ue,no)},p:noop$6,d(eo){eo&&detach(ue)}}}function create_fragment$8O(to){let ue,eo,no,ro,oo,io,ao,so;const lo=[create_if_block_2$1l,create_else_block_1$o],co=[];function uo(_o,go){return _o[3]?0:1}ro=uo(to),oo=co[ro]=lo[ro](to);function fo(_o,go){return _o[2]?create_if_block$46:_o[3]?create_if_block_1$2b:create_else_block$1B}let po=fo(to),ho=po(to);return{c(){ue=element("div"),eo=element("div"),no=element("div"),oo.c(),io=space$1(),ao=element("div"),ho.c(),attr(no,"class","header-content svelte-1mm33o7"),attr(eo,"class","header svelte-1mm33o7"),toggle_class(eo,"success",to[5]),toggle_class(eo,"error",to[3]),attr(ao,"class","body svelte-1mm33o7"),attr(ue,"class","evaluation-side-panel svelte-1mm33o7")},m(_o,go){insert$1(_o,ue,go),append$2(ue,eo),append$2(eo,no),co[ro].m(no,null),append$2(ue,io),append$2(ue,ao),ho.m(ao,null),so=!0},p(_o,[go]){let bo=ro;ro=uo(_o),ro===bo?co[ro].p(_o,go):(group_outros(),transition_out(co[bo],1,1,()=>{co[bo]=null}),check_outros(),oo=co[ro],oo?oo.p(_o,go):(oo=co[ro]=lo[ro](_o),oo.c()),transition_in(oo,1),oo.m(no,null)),(!so||go&32)&&toggle_class(eo,"success",_o[5]),(!so||go&8)&&toggle_class(eo,"error",_o[3]),po===(po=fo(_o))&&ho?ho.p(_o,go):(ho.d(1),ho=po(_o),ho&&(ho.c(),ho.m(ao,null)))},i(_o){so||(transition_in(oo),so=!0)},o(_o){transition_out(oo),so=!1},d(_o){_o&&detach(ue),co[ro].d(),ho.d()}}}function instance$8O(to,ue,eo){let no,ro,oo,io,{expressionResult:ao}=ue,{expressionError:so}=ue,{evaluating:lo=!1}=ue,{expression:co=null}=ue;const uo=ho=>ho.code===UserScriptError.code?ho.userScriptError.toString():ho.toString(),fo=ho=>{if(ho==null)return"";try{ho=JSON.stringify(JSON.parse(ho),null,2)}catch{}return formatHighlight(ho,{keyColor:"#e06c75",numberColor:"#e5c07b",stringColor:"#98c379",trueColor:"#d19a66",falseColor:"#d19a66",nullColor:"#c678dd"})},po=()=>{let ho=ao.result;typeof ho=="object"&&(ho=JSON.stringify(ho,null,2)),copyToClipboard(ho),notifications.success("Value copied to clipboard")};return to.$$set=ho=>{"expressionResult"in ho&&eo(8,ao=ho.expressionResult),"expressionError"in ho&&eo(0,so=ho.expressionError),"evaluating"in ho&&eo(1,lo=ho.evaluating),"expression"in ho&&eo(9,co=ho.expression)},to.$$.update=()=>{to.$$.dirty&1&&eo(3,no=so!=null),to.$$.dirty&512&&eo(2,ro=co==null||(co==null?void 0:co.trim())===""),to.$$.dirty&12&&eo(5,oo=!no&&!ro),to.$$.dirty&256&&eo(4,io=fo(ao))},[so,lo,ro,no,io,oo,uo,po,ao,co]}class EvaluationSidePanel extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$8O,create_fragment$8O,safe_not_equal,{expressionResult:8,expressionError:0,evaluating:1,expression:9})}}const SnippetDrawer_svelte_svelte_type_style_lang="";function create_else_block$1A(to){let ue,eo,no,ro,oo,io,ao;function so(uo){to[15](uo)}let lo={};to[1]!==void 0&&(lo.value=to[1]),ro=new Input$5({props:lo}),binding_callbacks.push(()=>bind$2(ro,"value",so));let co=to[6]&&create_if_block_2$1k(to);return{c(){ue=element("div"),eo=element("span"),eo.textContent="Name",no=space$1(),create_component(ro.$$.fragment),io=space$1(),co&&co.c(),attr(ue,"class","name svelte-8n6wau"),toggle_class(ue,"invalid",to[6]!=null)},m(uo,fo){insert$1(uo,ue,fo),append$2(ue,eo),append$2(ue,no),mount_component(ro,ue,null),append$2(ue,io),co&&co.m(ue,null),ao=!0},p(uo,fo){const po={};!oo&&fo&2&&(oo=!0,po.value=uo[1],add_flush_callback(()=>oo=!1)),ro.$set(po),uo[6]?co?(co.p(uo,fo),fo&64&&transition_in(co,1)):(co=create_if_block_2$1k(uo),co.c(),transition_in(co,1),co.m(ue,null)):co&&(group_outros(),transition_out(co,1,1,()=>{co=null}),check_outros()),(!ao||fo&64)&&toggle_class(ue,"invalid",uo[6]!=null)},i(uo){ao||(transition_in(ro.$$.fragment,uo),transition_in(co),ao=!0)},o(uo){transition_out(ro.$$.fragment,uo),transition_out(co),ao=!1},d(uo){uo&&detach(ue),destroy_component(ro),co&&co.d()}}}function create_if_block_1$2a(to){let ue=to[0].name+"",eo;return{c(){eo=text(ue)},m(no,ro){insert$1(no,eo,ro)},p(no,ro){ro&1&&ue!==(ue=no[0].name+"")&&set_data(eo,ue)},i:noop$6,o:noop$6,d(no){no&&detach(eo)}}}function create_if_block_2$1k(to){let ue,eo;return ue=new AbsTooltip({props:{text:to[6],type:TooltipType.Negative,$$slots:{default:[create_default_slot_2$2R]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&64&&(oo.text=no[6]),ro&1048576&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot_2$2R(to){let ue,eo;return ue=new Icon({props:{name:"Help",size:"S",color:"var(--spectrum-global-color-red-400)"}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p:noop$6,i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_title_slot(to){let ue,eo,no,ro;const oo=[create_if_block_1$2a,create_else_block$1A],io=[];function ao(so,lo){return so[0]?0:1}return ue=ao(to),eo=io[ue]=oo[ue](to),{c(){eo.c(),no=empty$2()},m(so,lo){io[ue].m(so,lo),insert$1(so,no,lo),ro=!0},p(so,lo){let co=ue;ue=ao(so),ue===co?io[ue].p(so,lo):(group_outros(),transition_out(io[co],1,1,()=>{io[co]=null}),check_outros(),eo=io[ue],eo?eo.p(so,lo):(eo=io[ue]=oo[ue](so),eo.c()),transition_in(eo,1),eo.m(no.parentNode,no))},i(so){ro||(transition_in(eo),ro=!0)},o(so){transition_out(eo),ro=!1},d(so){so&&detach(no),io[ue].d(so)}}}function create_if_block$45(to){let ue,eo;return ue=new Button({props:{warning:!0,disabled:to[4],$$slots:{default:[create_default_slot_1$3Z]},$$scope:{ctx:to}}}),ue.$on("click",function(){is_function(to[5].show)&&to[5].show.apply(this,arguments)}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){to=no;const oo={};ro&16&&(oo.disabled=to[4]),ro&1048576&&(oo.$$scope={dirty:ro,ctx:to}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot_1$3Z(to){let ue;return{c(){ue=text("Delete")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot$5E(to){let ue;return{c(){ue=text("Save")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_buttons_slot$h(to){let ue,eo,no,ro=to[0]&&create_if_block$45(to);return eo=new Button({props:{cta:!0,disabled:!to[2]||to[4]||to[6],$$slots:{default:[create_default_slot$5E]},$$scope:{ctx:to}}}),eo.$on("click",to[8]),{c(){ro&&ro.c(),ue=space$1(),create_component(eo.$$.fragment)},m(oo,io){ro&&ro.m(oo,io),insert$1(oo,ue,io),mount_component(eo,oo,io),no=!0},p(oo,io){oo[0]?ro?(ro.p(oo,io),io&1&&transition_in(ro,1)):(ro=create_if_block$45(oo),ro.c(),transition_in(ro,1),ro.m(ue.parentNode,ue)):ro&&(group_outros(),transition_out(ro,1,1,()=>{ro=null}),check_outros());const ao={};io&84&&(ao.disabled=!oo[2]||oo[4]||oo[6]),io&1048576&&(ao.$$scope={dirty:io,ctx:oo}),eo.$set(ao)},i(oo){no||(transition_in(ro),transition_in(eo.$$.fragment,oo),no=!0)},o(oo){transition_out(ro),transition_out(eo.$$.fragment,oo),no=!1},d(oo){oo&&detach(ue),ro&&ro.d(oo),destroy_component(eo,oo)}}}function create_tabs_slot(to){let ue,eo,no;return eo=new Input$5({props:{placeholder:"Name"}}),{c(){ue=element("div"),create_component(eo.$$.fragment),attr(ue,"slot","tabs")},m(ro,oo){insert$1(ro,ue,oo),mount_component(eo,ue,null),no=!0},p:noop$6,i(ro){no||(transition_in(eo.$$.fragment,ro),no=!0)},o(ro){transition_out(eo.$$.fragment,ro),no=!1},d(ro){ro&&detach(ue),destroy_component(eo)}}}function create_key_block$i(to){let ue,eo;return ue=new BindingPanel({props:{allowHBS:!1,allowJS:!0,allowSnippets:!1,showTabBar:!1,placeholder:"return function(input) ❴ ... ❵",value:to[2],$$slots:{tabs:[create_tabs_slot]},$$scope:{ctx:to}}}),ue.$on("change",to[14]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&4&&(oo.value=no[2]),ro&1048576&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_body_slot$g(to){let ue=to[7],eo,no,ro=create_key_block$i(to);return{c(){ro.c(),eo=empty$2()},m(oo,io){ro.m(oo,io),insert$1(oo,eo,io),no=!0},p(oo,io){io&128&&safe_not_equal(ue,ue=oo[7])?(group_outros(),transition_out(ro,1,1,noop$6),check_outros(),ro=create_key_block$i(oo),ro.c(),transition_in(ro,1),ro.m(eo.parentNode,eo)):ro.p(oo,io)},i(oo){no||(transition_in(ro),no=!0)},o(oo){transition_out(ro),no=!1},d(oo){oo&&detach(eo),ro.d(oo)}}}function create_fragment$8N(to){var ao;let ue,eo,no,ro,oo={$$slots:{body:[create_body_slot$g],buttons:[create_buttons_slot$h],title:[create_title_slot]},$$scope:{ctx:to}};ue=new Drawer({props:oo}),to[16](ue);let io={title:"Delete snippet",body:`Are you sure you want to delete ${(ao=to[0])==null?void 0:ao.name}?`,onOk:to[9]};return no=new ConfirmDialog({props:io}),to[17](no),{c(){create_component(ue.$$.fragment),eo=space$1(),create_component(no.$$.fragment)},m(so,lo){mount_component(ue,so,lo),insert$1(so,eo,lo),mount_component(no,so,lo),ro=!0},p(so,[lo]){var fo;const co={};lo&1048823&&(co.$$scope={dirty:lo,ctx:so}),ue.$set(co);const uo={};lo&1&&(uo.body=`Are you sure you want to delete ${(fo=so[0])==null?void 0:fo.name}?`),no.$set(uo)},i(so){ro||(transition_in(ue.$$.fragment,so),transition_in(no.$$.fragment,so),ro=!0)},o(so){transition_out(ue.$$.fragment,so),transition_out(no.$$.fragment,so),ro=!1},d(so){so&&detach(eo),to[16](null),destroy_component(ue,so),to[17](null),destroy_component(no,so)}}}const firstCharNumberRegex=/^[0-9].*$/;function instance$8N(to,ue,eo){let no,ro,oo,io,ao;component_subscribe(to,snippets$1,Eo=>eo(13,ao=Eo));let{snippet:so}=ue;const lo=()=>uo.show(),co=()=>uo.hide();let uo,fo="",po="",ho=!1,_o;const go=async()=>{eo(4,ho=!0);try{const Eo={name:fo,code:oo};await snippets$1.saveSnippet(Eo),uo.hide(),notifications.success(`Snippet ${Eo.name} saved`)}catch(Eo){notifications.error(Eo.message||"Error saving snippet")}eo(4,ho=!1)},bo=async()=>{eo(4,ho=!0);try{await snippets$1.deleteSnippet(so.name),uo.hide()}catch{notifications.error("Error deleting snippet")}eo(4,ho=!1)},vo=(Eo,Io)=>Eo!=null&&Eo.length?!(so!=null&&so.name)&&Io.some(Ao=>Ao.name===Eo)?"That name is already in use":firstCharNumberRegex.test(Eo)?"Can't start with a number":ValidSnippetNameRegex.test(Eo)?null:"No special characters or spaces":"Name is required",yo=Eo=>eo(2,po=Eo.detail);function wo(Eo){fo=Eo,eo(1,fo),eo(0,so),eo(12,no),eo(13,ao)}function ko(Eo){binding_callbacks[Eo?"unshift":"push"](()=>{uo=Eo,eo(3,uo)})}function So(Eo){binding_callbacks[Eo?"unshift":"push"](()=>{_o=Eo,eo(5,_o)})}return to.$$set=Eo=>{"snippet"in Eo&&eo(0,so=Eo.snippet)},to.$$.update=()=>{to.$$.dirty&8192&&eo(12,no=getSequentialName(ao,"MySnippet",{getName:Eo=>Eo.name})),to.$$.dirty&1&&eo(7,ro=so==null?void 0:so.name),to.$$.dirty&4097&&eo(1,fo=(so==null?void 0:so.name)||no),to.$$.dirty&1&&eo(2,po=so!=null&&so.code?encodeJSBinding(so.code):""),to.$$.dirty&4&&(oo=decodeJSBinding(po)),to.$$.dirty&8194&&eo(6,io=vo(fo,ao))},[so,fo,po,uo,ho,_o,io,ro,go,bo,lo,co,no,ao,yo,wo,ko,So]}class SnippetDrawer extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$8N,create_fragment$8N,safe_not_equal,{snippet:0,show:10,hide:11})}get show(){return this.$$.ctx[10]}get hide(){return this.$$.ctx[11]}}function create_if_block$44(to){let ue,eo,no,ro,oo;const io=[create_if_block_1$29,create_if_block_2$1j],ao=[];function so(lo,co){var uo,fo;return co&6&&(ue=null),lo[1].cloud&&((fo=(uo=lo[2])==null?void 0:uo.user)!=null&&fo.accountPortalAccess)?0:(ue==null&&(ue=!!(!lo[1].cloud&&isAdmin(lo[2].user))),ue?1:-1)}return~(eo=so(to,-1))&&(no=ao[eo]=io[eo](to)),{c(){no&&no.c(),ro=empty$2()},m(lo,co){~eo&&ao[eo].m(lo,co),insert$1(lo,ro,co),oo=!0},p(lo,co){let uo=eo;eo=so(lo,co),eo===uo?~eo&&ao[eo].p(lo,co):(no&&(group_outros(),transition_out(ao[uo],1,1,()=>{ao[uo]=null}),check_outros()),~eo?(no=ao[eo],no?no.p(lo,co):(no=ao[eo]=io[eo](lo),no.c()),transition_in(no,1),no.m(ro.parentNode,ro)):no=null)},i(lo){oo||(transition_in(no),oo=!0)},o(lo){transition_out(no),oo=!1},d(lo){lo&&detach(ro),~eo&&ao[eo].d(lo)}}}function create_if_block_2$1j(to){let ue,eo;return ue=new Button({props:{cta:!0,size:"M",$$slots:{default:[create_default_slot_1$3Y]},$$scope:{ctx:to}}}),ue.$on("click",to[6]),ue.$on("click",to[7]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&256&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block_1$29(to){let ue,eo;return ue=new Button({props:{cta:!0,size:"M",$$slots:{default:[create_default_slot$5D]},$$scope:{ctx:to}}}),ue.$on("click",to[4]),ue.$on("click",to[5]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&256&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot_1$3Y(to){let ue;return{c(){ue=text("Upgrade")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot$5D(to){let ue;return{c(){ue=text("Upgrade")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_fragment$8M(to){let ue,eo,no=!to[0].isEnterprisePlan&&!to[0].isEnterpriseTrial&&create_if_block$44(to);return{c(){no&&no.c(),ue=empty$2()},m(ro,oo){no&&no.m(ro,oo),insert$1(ro,ue,oo),eo=!0},p(ro,[oo]){!ro[0].isEnterprisePlan&&!ro[0].isEnterpriseTrial?no?(no.p(ro,oo),oo&1&&transition_in(no,1)):(no=create_if_block$44(ro),no.c(),transition_in(no,1),no.m(ue.parentNode,ue)):no&&(group_outros(),transition_out(no,1,1,()=>{no=null}),check_outros())},i(ro){eo||(transition_in(no),eo=!0)},o(ro){transition_out(no),eo=!1},d(ro){ro&&detach(ue),no&&no.d(ro)}}}function instance$8M(to,ue,eo){let no,ro,oo,io;component_subscribe(to,licensing,uo=>eo(0,no=uo)),component_subscribe(to,admin,uo=>eo(1,ro=uo)),component_subscribe(to,auth,uo=>eo(2,oo=uo)),component_subscribe(to,goto,uo=>eo(3,io=uo));function ao(uo){bubble.call(this,to,uo)}const so=()=>{window.open(ro.accountPortalUrl+"/portal/upgrade","_blank")},lo=()=>io("/builder/portal/account/upgrade");function co(uo){bubble.call(this,to,uo)}return[no,ro,oo,io,ao,so,lo,co]}class UpgradeButton extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$8M,create_fragment$8M,safe_not_equal,{})}}const SnippetSidePanel_svelte_svelte_type_style_lang="";function get_each_context$1G(to,ue,eo){const no=to.slice();return no[27]=ue[eo],no}function create_else_block_3$2(to){let ue,eo,no,ro;return no=new Tags({props:{$$slots:{default:[create_default_slot_4$1F]},$$scope:{ctx:to}}}),{c(){ue=element("div"),eo=text(`Snippets
|
|
888
888
|
`),create_component(no.$$.fragment),attr(ue,"class","title svelte-10gqizr")},m(oo,io){insert$1(oo,ue,io),append$2(ue,eo),mount_component(no,ue,null),ro=!0},p(oo,io){const ao={};io&1073741824&&(ao.$$scope={dirty:io,ctx:oo}),no.$set(ao)},i(oo){ro||(transition_in(no.$$.fragment,oo),ro=!0)},o(oo){transition_out(no.$$.fragment,oo),ro=!1},d(oo){oo&&detach(ue),destroy_component(no)}}}function create_if_block_2$1i(to){let ue,eo,no,ro;const oo=[create_if_block_3$X,create_else_block_2$7],io=[];function ao(so,lo){return so[3]?0:1}return ue=ao(to),eo=io[ue]=oo[ue](to),{c(){eo.c(),no=empty$2()},m(so,lo){io[ue].m(so,lo),insert$1(so,no,lo),ro=!0},p(so,lo){let co=ue;ue=ao(so),ue===co?io[ue].p(so,lo):(group_outros(),transition_out(io[co],1,1,()=>{io[co]=null}),check_outros(),eo=io[ue],eo?eo.p(so,lo):(eo=io[ue]=oo[ue](so),eo.c()),transition_in(eo,1),eo.m(no.parentNode,no))},i(so){ro||(transition_in(eo),ro=!0)},o(so){transition_out(eo),ro=!1},d(so){so&&detach(no),io[ue].d(so)}}}function create_default_slot_5$1h(to){let ue;return{c(){ue=text("Premium")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_4$1F(to){let ue,eo;return ue=new Tag$1({props:{icon:"LockClosed",$$slots:{default:[create_default_slot_5$1h]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&1073741824&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_else_block_2$7(to){let ue,eo,no,ro,oo,io;return no=new Icon({props:{size:"S",name:"Search",hoverable:!0,newStyles:!0}}),no.$on("click",to[13]),oo=new Icon({props:{size:"S",name:"Add",hoverable:!0,newStyles:!0}}),oo.$on("click",to[15]),{c(){ue=element("div"),ue.textContent="Snippets",eo=space$1(),create_component(no.$$.fragment),ro=space$1(),create_component(oo.$$.fragment),attr(ue,"class","title svelte-10gqizr")},m(ao,so){insert$1(ao,ue,so),insert$1(ao,eo,so),mount_component(no,ao,so),insert$1(ao,ro,so),mount_component(oo,ao,so),io=!0},p:noop$6,i(ao){io||(transition_in(no.$$.fragment,ao),transition_in(oo.$$.fragment,ao),io=!0)},o(ao){transition_out(no.$$.fragment,ao),transition_out(oo.$$.fragment,ao),io=!1},d(ao){ao&&(detach(ue),detach(eo),detach(ro)),destroy_component(no,ao),destroy_component(oo,ao)}}}function create_if_block_3$X(to){let ue,eo,no,ro,oo,io;function ao(lo){to[19](lo)}let so={placeholder:"Search for snippets",autocomplete:"off",autofocus:!0};return to[1]!==void 0&&(so.value=to[1]),eo=new Input$5({props:so}),binding_callbacks.push(()=>bind$2(eo,"value",ao)),oo=new Icon({props:{size:"S",name:"Close",hoverable:!0,newStyles:!0}}),oo.$on("click",to[14]),{c(){ue=element("div"),create_component(eo.$$.fragment),ro=space$1(),create_component(oo.$$.fragment),attr(ue,"class","search-input svelte-10gqizr")},m(lo,co){insert$1(lo,ue,co),mount_component(eo,ue,null),insert$1(lo,ro,co),mount_component(oo,lo,co),io=!0},p(lo,co){const uo={};!no&&co&2&&(no=!0,uo.value=lo[1],add_flush_callback(()=>no=!1)),eo.$set(uo)},i(lo){io||(transition_in(eo.$$.fragment,lo),transition_in(oo.$$.fragment,lo),io=!0)},o(lo){transition_out(eo.$$.fragment,lo),transition_out(oo.$$.fragment,lo),io=!1},d(lo){lo&&(detach(ue),detach(ro)),destroy_component(eo),destroy_component(oo,lo)}}}function create_else_block$1z(to){let ue,eo,no,ro,oo,io;eo=new Body({props:{size:"S",$$slots:{default:[create_default_slot_3$2d]},$$scope:{ctx:to}}});const ao=[create_if_block_1$28,create_else_block_1$n],so=[];function lo(co,uo){return co[2]?0:1}return ro=lo(to),oo=so[ro]=ao[ro](to),{c(){ue=element("div"),create_component(eo.$$.fragment),no=space$1(),oo.c(),attr(ue,"class","upgrade svelte-10gqizr")},m(co,uo){insert$1(co,ue,uo),mount_component(eo,ue,null),append$2(ue,no),so[ro].m(ue,null),io=!0},p(co,uo){const fo={};uo&1073741824&&(fo.$$scope={dirty:uo,ctx:co}),eo.$set(fo);let po=ro;ro=lo(co),ro===po?so[ro].p(co,uo):(group_outros(),transition_out(so[po],1,1,()=>{so[po]=null}),check_outros(),oo=so[ro],oo?oo.p(co,uo):(oo=so[ro]=ao[ro](co),oo.c()),transition_in(oo,1),oo.m(ue,null))},i(co){io||(transition_in(eo.$$.fragment,co),transition_in(oo),io=!0)},o(co){transition_out(eo.$$.fragment,co),transition_out(oo),io=!1},d(co){co&&detach(ue),destroy_component(eo),so[ro].d()}}}function create_if_block$43(to){let ue,eo,no=ensure_array_like(to[9]),ro=[];for(let io=0;io<no.length;io+=1)ro[io]=create_each_block$1G(get_each_context$1G(to,no,io));const oo=io=>transition_out(ro[io],1,1,()=>{ro[io]=null});return{c(){for(let io=0;io<ro.length;io+=1)ro[io].c();ue=empty$2()},m(io,ao){for(let so=0;so<ro.length;so+=1)ro[so]&&ro[so].m(io,ao);insert$1(io,ue,ao),eo=!0},p(io,ao){if(ao&69121){no=ensure_array_like(io[9]);let so;for(so=0;so<no.length;so+=1){const lo=get_each_context$1G(io,no,so);ro[so]?(ro[so].p(lo,ao),transition_in(ro[so],1)):(ro[so]=create_each_block$1G(lo),ro[so].c(),transition_in(ro[so],1),ro[so].m(ue.parentNode,ue))}for(group_outros(),so=no.length;so<ro.length;so+=1)oo(so);check_outros()}},i(io){if(!eo){for(let ao=0;ao<no.length;ao+=1)transition_in(ro[ao]);eo=!0}},o(io){ro=ro.filter(Boolean);for(let ao=0;ao<ro.length;ao+=1)transition_out(ro[ao]);eo=!1},d(io){io&&detach(ue),destroy_each(ro,io)}}}function create_default_slot_3$2d(to){let ue;return{c(){ue=text(`Snippets let you create reusable JS functions and values that can
|
|
889
889
|
all be managed in one place`)},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_else_block_1$n(to){let ue,eo;return ue=new UpgradeButton({}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p:noop$6,i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block_1$28(to){let ue,eo;return ue=new Button({props:{cta:!0,$$slots:{default:[create_default_slot_2$2Q]},$$scope:{ctx:to}}}),ue.$on("click",to[15]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&1073741824&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot_2$2Q(to){let ue;return{c(){ue=text("Create snippet")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_each_block$1G(to){let ue,eo=to[27].name+"",no,ro,oo,io,ao,so,lo;function co(...po){return to[20](to[27],...po)}oo=new Icon({props:{name:"Edit",hoverable:!0,newStyles:!0,size:"S"}}),oo.$on("click",co);function uo(...po){return to[21](to[27],...po)}function fo(){return to[22](to[27])}return{c(){ue=element("div"),no=text(eo),ro=space$1(),create_component(oo.$$.fragment),io=space$1(),attr(ue,"class","snippet svelte-10gqizr")},m(po,ho){insert$1(po,ue,ho),append$2(ue,no),append$2(ue,ro),mount_component(oo,ue,null),append$2(ue,io),ao=!0,so||(lo=[listen(ue,"mouseenter",uo),listen(ue,"mouseleave",to[11]),listen(ue,"click",fo)],so=!0)},p(po,ho){to=po,(!ao||ho&512)&&eo!==(eo=to[27].name+"")&&set_data(no,eo)},i(po){ao||(transition_in(oo.$$.fragment,po),ao=!0)},o(po){transition_out(oo.$$.fragment,po),ao=!1},d(po){po&&detach(ue),destroy_component(oo),so=!1,run_all(lo)}}}function create_default_slot_1$3X(to){let ue,eo,no,ro,oo,io,ao,so;const lo=[create_if_block_2$1i,create_else_block_3$2],co=[];function uo(_o,go){return _o[2]?0:1}eo=uo(to),no=co[eo]=lo[eo](to);const fo=[create_if_block$43,create_else_block$1z],po=[];function ho(_o,go){var bo;return _o[2]&&((bo=_o[9])!=null&&bo.length)?0:1}return io=ho(to),ao=po[io]=fo[io](to),{c(){ue=element("div"),no.c(),ro=space$1(),oo=element("div"),ao.c(),attr(ue,"class","header svelte-10gqizr"),attr(oo,"class","snippet-list svelte-10gqizr")},m(_o,go){insert$1(_o,ue,go),co[eo].m(ue,null),insert$1(_o,ro,go),insert$1(_o,oo,go),po[io].m(oo,null),so=!0},p(_o,go){let bo=eo;eo=uo(_o),eo===bo?co[eo].p(_o,go):(group_outros(),transition_out(co[bo],1,1,()=>{co[bo]=null}),check_outros(),no=co[eo],no?no.p(_o,go):(no=co[eo]=lo[eo](_o),no.c()),transition_in(no,1),no.m(ue,null));let vo=io;io=ho(_o),io===vo?po[io].p(_o,go):(group_outros(),transition_out(po[vo],1,1,()=>{po[vo]=null}),check_outros(),ao=po[io],ao?ao.p(_o,go):(ao=po[io]=fo[io](_o),ao.c()),transition_in(ao,1),ao.m(oo,null))},i(_o){so||(transition_in(no),transition_in(ao),so=!0)},o(_o){transition_out(no),transition_out(ao),so=!1},d(_o){_o&&(detach(ue),detach(ro),detach(oo)),co[eo].d(),po[io].d()}}}function create_key_block$h(to){var no;let ue,eo;return ue=new CodeEditor({props:{value:(no=to[6].code)==null?void 0:no.trim(),mode:EditorModes$1.JS,readonly:!0}}),{c(){create_component(ue.$$.fragment)},m(ro,oo){mount_component(ue,ro,oo),eo=!0},p(ro,oo){var ao;const io={};oo&64&&(io.value=(ao=ro[6].code)==null?void 0:ao.trim()),ue.$set(io)},i(ro){eo||(transition_in(ue.$$.fragment,ro),eo=!0)},o(ro){transition_out(ue.$$.fragment,ro),eo=!1},d(ro){destroy_component(ue,ro)}}}function create_default_slot$5C(to){let ue,eo=to[6],no,ro=create_key_block$h(to);return{c(){ue=element("div"),ro.c(),attr(ue,"class","snippet-popover svelte-10gqizr")},m(oo,io){insert$1(oo,ue,io),ro.m(ue,null),no=!0},p(oo,io){io&64&&safe_not_equal(eo,eo=oo[6])?(group_outros(),transition_out(ro,1,1,noop$6),check_outros(),ro=create_key_block$h(oo),ro.c(),transition_in(ro,1),ro.m(ue,null)):ro.p(oo,io)},i(oo){no||(transition_in(ro),no=!0)},o(oo){transition_out(ro),no=!1},d(oo){oo&&detach(ue),ro.d(oo)}}}function create_fragment$8L(to){let ue,eo,no,ro,oo,io,ao;eo=new Layout$n({props:{noPadding:!0,gap:"S",$$slots:{default:[create_default_slot_1$3X]},$$scope:{ctx:to}}});let so={align:"left-outside",anchor:to[5],minWidth:0,maxWidth:480,maxHeight:480,dismissible:!1,$$slots:{default:[create_default_slot$5C]},$$scope:{ctx:to}};ro=new Popover({props:so}),to[23](ro),ro.$on("mouseenter",to[12]),ro.$on("mouseleave",to[11]);let lo={snippet:to[8]};return io=new SnippetDrawer({props:lo}),to[24](io),{c(){ue=element("div"),create_component(eo.$$.fragment),no=space$1(),create_component(ro.$$.fragment),oo=space$1(),create_component(io.$$.fragment),attr(ue,"class","snippet-side-panel svelte-10gqizr")},m(co,uo){insert$1(co,ue,uo),mount_component(eo,ue,null),insert$1(co,no,uo),mount_component(ro,co,uo),insert$1(co,oo,uo),mount_component(io,co,uo),ao=!0},p(co,[uo]){const fo={};uo&1073742351&&(fo.$$scope={dirty:uo,ctx:co}),eo.$set(fo);const po={};uo&32&&(po.anchor=co[5]),uo&1073741888&&(po.$$scope={dirty:uo,ctx:co}),ro.$set(po);const ho={};uo&256&&(ho.snippet=co[8]),io.$set(ho)},i(co){ao||(transition_in(eo.$$.fragment,co),transition_in(ro.$$.fragment,co),transition_in(io.$$.fragment,co),ao=!0)},o(co){transition_out(eo.$$.fragment,co),transition_out(ro.$$.fragment,co),transition_out(io.$$.fragment,co),ao=!1},d(co){co&&(detach(ue),detach(no),detach(oo)),destroy_component(eo),to[23](null),destroy_component(ro,co),to[24](null),destroy_component(io,co)}}}function instance$8L(to,ue,eo){let no,ro,oo;component_subscribe(to,licensing,Po=>eo(18,oo=Po));let{addSnippet:io}=ue,{snippets:ao}=ue,so="",lo=!1,co,uo,fo,po,ho,_o;const go=(Po,Ro,Do)=>!Po||!(Ro!=null&&Ro.length)?[]:Do!=null&&Do.length?Ro.filter(qo=>qo.name.toLowerCase().includes(Do.toLowerCase())):Ro,bo=(Po,Ro)=>{yo(),eo(5,uo=Ro),eo(6,fo=Po),co.show()},vo=()=>{po=setTimeout(()=>{co.hide(),eo(5,uo=null),eo(6,fo=null),po=null},100)},yo=()=>{po&&(clearTimeout(po),po=null)},wo=()=>{eo(3,lo=!0),eo(1,so="")},ko=()=>{eo(3,lo=!1),eo(1,so="")},So=()=>{eo(8,_o=null),ho.show()},Eo=(Po,Ro)=>{Po.preventDefault(),Po.stopPropagation(),eo(8,_o=Ro),ho.show()};function Io(Po){so=Po,eo(1,so)}const Ao=(Po,Ro)=>Eo(Ro,Po),To=(Po,Ro)=>bo(Po,Ro.target),Mo=Po=>io(Po);function Vo(Po){binding_callbacks[Po?"unshift":"push"](()=>{co=Po,eo(4,co)})}function Fo(Po){binding_callbacks[Po?"unshift":"push"](()=>{ho=Po,eo(7,ho)})}return to.$$set=Po=>{"addSnippet"in Po&&eo(0,io=Po.addSnippet),"snippets"in Po&&eo(17,ao=Po.snippets)},to.$$.update=()=>{to.$$.dirty&262144&&eo(2,no=!oo.isFreePlan),to.$$.dirty&131078&&eo(9,ro=go(no,ao,so))},[io,so,no,lo,co,uo,fo,ho,_o,ro,bo,vo,yo,wo,ko,So,Eo,ao,oo,Io,Ao,To,Mo,Vo,Fo]}class SnippetSidePanel extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$8L,create_fragment$8L,safe_not_equal,{addSnippet:0,snippets:17})}}const BindingType={READABLE:"readableBinding",RUNTIME:"runtimeBinding"};class BindingHelpers{constructor(ue,eo,{disableWrapping:no}={}){this.getCaretPosition=ue,this.insertAtPos=eo,this.disableWrapping=no}onSelectHelper(ue,eo,{js:no,dontDecode:ro}){const oo=this.getCaretPosition(),{start:io,end:ao}=oo;if(no){const so=ro?ue:decodeJSBinding(ue),lo=jsInsert(so,io,ao,eo.text,{helper:!0});this.insertAtPos({start:io,end:ao,value:lo})}else{const so=hbInsert(ue,io,ao,eo.text);this.insertAtPos({start:io,end:ao,value:so})}}onSelectBinding(ue,eo,{js:no,dontDecode:ro,type:oo=BindingType.READABLE}){const{start:io,end:ao}=this.getCaretPosition();if(no){const so=ro?ue:decodeJSBinding(ue),lo=jsInsert(so,io,ao,eo[oo],{disableWrapping:this.disableWrapping});this.insertAtPos({start:io,end:ao,value:lo})}else{const so=hbInsert(ue,io,ao,eo[oo]);this.insertAtPos({start:io,end:ao,value:so})}}onSelectSnippet(ue){const eo=this.getCaretPosition(),{start:no,end:ro}=eo;this.insertAtPos({start:no,end:ro,value:`snippets.${ue.name}`})}}const BindingPanel_svelte_svelte_type_style_lang="";function get_each_context$1F(to,ue,eo){const no=to.slice();return no[62]=ue[eo],no}function get_each_context_1$r(to,ue,eo){const no=to.slice();return no[14]=ue[eo],no}function create_if_block_6$m(to){let ue,eo,no,ro,oo,io=ensure_array_like(to[19]),ao=[];for(let fo=0;fo<io.length;fo+=1)ao[fo]=create_each_block_1$r(get_each_context_1$r(to,io,fo));const so=fo=>transition_out(ao[fo],1,1,()=>{ao[fo]=null});let lo=ensure_array_like(to[12]),co=[];for(let fo=0;fo<lo.length;fo+=1)co[fo]=create_each_block$1F(get_each_context$1F(to,lo,fo));const uo=fo=>transition_out(co[fo],1,1,()=>{co[fo]=null});return{c(){ue=element("div"),eo=element("div");for(let fo=0;fo<ao.length;fo+=1)ao[fo].c();no=space$1(),ro=element("div");for(let fo=0;fo<co.length;fo+=1)co[fo].c();attr(eo,"class","editor-tabs svelte-biform"),attr(ro,"class","side-tabs svelte-biform"),attr(ue,"class","tabs svelte-biform")},m(fo,po){insert$1(fo,ue,po),append$2(ue,eo);for(let ho=0;ho<ao.length;ho+=1)ao[ho]&&ao[ho].m(eo,null);append$2(ue,no),append$2(ue,ro);for(let ho=0;ho<co.length;ho+=1)co[ho]&&co[ho].m(ro,null);oo=!0},p(fo,po){if(po[0]&268959808){io=ensure_array_like(fo[19]);let ho;for(ho=0;ho<io.length;ho+=1){const _o=get_each_context_1$r(fo,io,ho);ao[ho]?(ao[ho].p(_o,po),transition_in(ao[ho],1)):(ao[ho]=create_each_block_1$r(_o),ao[ho].c(),transition_in(ao[ho],1),ao[ho].m(eo,null))}for(group_outros(),ho=io.length;ho<ao.length;ho+=1)so(ho);check_outros()}if(po[0]&1073746048){lo=ensure_array_like(fo[12]);let ho;for(ho=0;ho<lo.length;ho+=1){const _o=get_each_context$1F(fo,lo,ho);co[ho]?(co[ho].p(_o,po),transition_in(co[ho],1)):(co[ho]=create_each_block$1F(_o),co[ho].c(),transition_in(co[ho],1),co[ho].m(ro,null))}for(group_outros(),ho=lo.length;ho<co.length;ho+=1)uo(ho);check_outros()}},i(fo){if(!oo){for(let po=0;po<io.length;po+=1)transition_in(ao[po]);for(let po=0;po<lo.length;po+=1)transition_in(co[po]);oo=!0}},o(fo){ao=ao.filter(Boolean);for(let po=0;po<ao.length;po+=1)transition_out(ao[po]);co=co.filter(Boolean);for(let po=0;po<co.length;po+=1)transition_out(co[po]);oo=!1},d(fo){fo&&detach(ue),destroy_each(ao,fo),destroy_each(co,fo)}}}function create_default_slot_6$$(to){let ue=capitalise(to[14])+"",eo,no;return{c(){eo=text(ue),no=space$1()},m(ro,oo){insert$1(ro,eo,oo),insert$1(ro,no,oo)},p(ro,oo){oo[0]&524288&&ue!==(ue=capitalise(ro[14])+"")&&set_data(eo,ue)},d(ro){ro&&(detach(eo),detach(no))}}}function create_each_block_1$r(to){let ue,eo;function no(){return to[42](to[14])}return ue=new ActionButton({props:{size:"M",quiet:!0,selected:to[6]===to[14],$$slots:{default:[create_default_slot_6$$]},$$scope:{ctx:to}}}),ue.$on("click",no),{c(){create_component(ue.$$.fragment)},m(ro,oo){mount_component(ue,ro,oo),eo=!0},p(ro,oo){to=ro;const io={};oo[0]&524352&&(io.selected=to[6]===to[14]),oo[0]&524288|oo[2]&32&&(io.$$scope={dirty:oo,ctx:to}),ue.$set(io)},i(ro){eo||(transition_in(ue.$$.fragment,ro),eo=!0)},o(ro){transition_out(ue.$$.fragment,ro),eo=!1},d(ro){destroy_component(ue,ro)}}}function create_default_slot_5$1g(to){let ue,eo,no;return ue=new Icon({props:{name:to[62],size:"S"}}),{c(){create_component(ue.$$.fragment),eo=space$1()},m(ro,oo){mount_component(ue,ro,oo),insert$1(ro,eo,oo),no=!0},p(ro,oo){const io={};oo[0]&4096&&(io.name=ro[62]),ue.$set(io)},i(ro){no||(transition_in(ue.$$.fragment,ro),no=!0)},o(ro){transition_out(ue.$$.fragment,ro),no=!1},d(ro){ro&&detach(eo),destroy_component(ue,ro)}}}function create_each_block$1F(to){let ue,eo;function no(){return to[43](to[62])}return ue=new ActionButton({props:{size:"M",quiet:!0,selected:to[7]===to[62],$$slots:{default:[create_default_slot_5$1g]},$$scope:{ctx:to}}}),ue.$on("click",no),{c(){create_component(ue.$$.fragment)},m(ro,oo){mount_component(ue,ro,oo),eo=!0},p(ro,oo){to=ro;const io={};oo[0]&4224&&(io.selected=to[7]===to[62]),oo[0]&4096|oo[2]&32&&(io.$$scope={dirty:oo,ctx:to}),ue.$set(io)},i(ro){eo||(transition_in(ue.$$.fragment,ro),eo=!0)},o(ro){transition_out(ue.$$.fragment,ro),eo=!1},d(ro){destroy_component(ue,ro)}}}function create_if_block_5$u(to){let ue=to[22],eo,no,ro=create_key_block_1(to);return{c(){ro.c(),eo=empty$2()},m(oo,io){ro.m(oo,io),insert$1(oo,eo,io),no=!0},p(oo,io){io[0]&4194304&&safe_not_equal(ue,ue=oo[22])?(group_outros(),transition_out(ro,1,1,noop$6),check_outros(),ro=create_key_block_1(oo),ro.c(),transition_in(ro,1),ro.m(eo.parentNode,eo)):ro.p(oo,io)},i(oo){no||(transition_in(ro),no=!0)},o(oo){transition_out(ro),no=!1},d(oo){oo&&detach(eo),ro.d(oo)}}}function create_if_block_4$G(to){let ue=to[23],eo,no,ro=create_key_block$g(to);return{c(){ro.c(),eo=empty$2()},m(oo,io){ro.m(oo,io),insert$1(oo,eo,io),no=!0},p(oo,io){io[0]&8388608&&safe_not_equal(ue,ue=oo[23])?(group_outros(),transition_out(ro,1,1,noop$6),check_outros(),ro=create_key_block$g(oo),ro.c(),transition_in(ro,1),ro.m(eo.parentNode,eo)):ro.p(oo,io)},i(oo){no||(transition_in(ro),no=!0)},o(oo){transition_out(ro),no=!1},d(oo){oo&&detach(eo),ro.d(oo)}}}function create_key_block_1(to){let ue,eo,no,ro;function oo(so){to[46](so)}function io(so){to[47](so)}let ao={value:decodeJSBinding(to[8]),completions:to[22],mode:EditorModes$1.JS,autofocus:to[3],placeholder:to[4]||"Add bindings by typing $ or use the menu on the right",jsBindingWrapping:!0};return to[10]!==void 0&&(ao.getCaretPosition=to[10]),to[11]!==void 0&&(ao.insertAtPos=to[11]),ue=new CodeEditor({props:ao}),binding_callbacks.push(()=>bind$2(ue,"getCaretPosition",oo)),binding_callbacks.push(()=>bind$2(ue,"insertAtPos",io)),ue.$on("change",to[32]),{c(){create_component(ue.$$.fragment)},m(so,lo){mount_component(ue,so,lo),ro=!0},p(so,lo){const co={};lo[0]&256&&(co.value=decodeJSBinding(so[8])),lo[0]&4194304&&(co.completions=so[22]),lo[0]&8&&(co.autofocus=so[3]),lo[0]&16&&(co.placeholder=so[4]||"Add bindings by typing $ or use the menu on the right"),!eo&&lo[0]&1024&&(eo=!0,co.getCaretPosition=so[10],add_flush_callback(()=>eo=!1)),!no&&lo[0]&2048&&(no=!0,co.insertAtPos=so[11],add_flush_callback(()=>no=!1)),ue.$set(co)},i(so){ro||(transition_in(ue.$$.fragment,so),ro=!0)},o(so){transition_out(ue.$$.fragment,so),ro=!1},d(so){destroy_component(ue,so)}}}function create_key_block$g(to){let ue,eo,no,ro;function oo(so){to[44](so)}function io(so){to[45](so)}let ao={value:to[9],completions:to[23],autofocus:to[3],placeholder:to[4]||"Add bindings by typing {{ or use the menu on the right",jsBindingWrapping:!1};return to[10]!==void 0&&(ao.getCaretPosition=to[10]),to[11]!==void 0&&(ao.insertAtPos=to[11]),ue=new CodeEditor({props:ao}),binding_callbacks.push(()=>bind$2(ue,"getCaretPosition",oo)),binding_callbacks.push(()=>bind$2(ue,"insertAtPos",io)),ue.$on("change",to[31]),{c(){create_component(ue.$$.fragment)},m(so,lo){mount_component(ue,so,lo),ro=!0},p(so,lo){const co={};lo[0]&512&&(co.value=so[9]),lo[0]&8388608&&(co.completions=so[23]),lo[0]&8&&(co.autofocus=so[3]),lo[0]&16&&(co.placeholder=so[4]||"Add bindings by typing {{ or use the menu on the right"),!eo&&lo[0]&1024&&(eo=!0,co.getCaretPosition=so[10],add_flush_callback(()=>eo=!1)),!no&&lo[0]&2048&&(no=!0,co.insertAtPos=so[11],add_flush_callback(()=>no=!1)),ue.$set(co)},i(so){ro||(transition_in(ue.$$.fragment,so),ro=!0)},o(so){transition_out(ue.$$.fragment,so),ro=!1},d(so){destroy_component(ue,so)}}}function create_if_block_3$W(to){let ue,eo,no,ro,oo,io,ao,so,lo,co,uo;return no=new Heading({props:{size:"S",$$slots:{default:[create_default_slot_4$1E]},$$scope:{ctx:to}}}),oo=new Body({props:{$$slots:{default:[create_default_slot_3$2c]},$$scope:{ctx:to}}}),so=new Button({props:{secondary:!0,size:"S",$$slots:{default:[create_default_slot_2$2P]},$$scope:{ctx:to}}}),so.$on("click",to[48]),co=new Button({props:{cta:!0,size:"S",$$slots:{default:[create_default_slot_1$3W]},$$scope:{ctx:to}}}),co.$on("click",to[29]),{c(){ue=element("div"),eo=element("div"),create_component(no.$$.fragment),ro=space$1(),create_component(oo.$$.fragment),io=space$1(),ao=element("div"),create_component(so.$$.fragment),lo=space$1(),create_component(co.$$.fragment),attr(ao,"class","switch-actions svelte-biform"),attr(eo,"class","prompt-body svelte-biform"),attr(ue,"class","mode-overlay svelte-biform")},m(fo,po){insert$1(fo,ue,po),append$2(ue,eo),mount_component(no,eo,null),append$2(eo,ro),mount_component(oo,eo,null),append$2(eo,io),append$2(eo,ao),mount_component(so,ao,null),append$2(ao,lo),mount_component(co,ao,null),uo=!0},p(fo,po){const ho={};po[0]&32768|po[2]&32&&(ho.$$scope={dirty:po,ctx:fo}),no.$set(ho);const _o={};po[2]&32&&(_o.$$scope={dirty:po,ctx:fo}),oo.$set(_o);const go={};po[0]&64|po[2]&32&&(go.$$scope={dirty:po,ctx:fo}),so.$set(go);const bo={};po[0]&64|po[2]&32&&(bo.$$scope={dirty:po,ctx:fo}),co.$set(bo)},i(fo){uo||(transition_in(no.$$.fragment,fo),transition_in(oo.$$.fragment,fo),transition_in(so.$$.fragment,fo),transition_in(co.$$.fragment,fo),uo=!0)},o(fo){transition_out(no.$$.fragment,fo),transition_out(oo.$$.fragment,fo),transition_out(so.$$.fragment,fo),transition_out(co.$$.fragment,fo),uo=!1},d(fo){fo&&detach(ue),destroy_component(no),destroy_component(oo),destroy_component(so),destroy_component(co)}}}function create_default_slot_4$1E(to){let ue,eo,no;return{c(){ue=text("Switch to "),eo=text(to[15]),no=text("?")},m(ro,oo){insert$1(ro,ue,oo),insert$1(ro,eo,oo),insert$1(ro,no,oo)},p(ro,oo){oo[0]&32768&&set_data(eo,ro[15])},d(ro){ro&&(detach(ue),detach(eo),detach(no))}}}function create_default_slot_3$2c(to){let ue;return{c(){ue=text("This will discard anything in your binding")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_2$2P(to){let ue,eo;return{c(){ue=text("No - keep "),eo=text(to[6])},m(no,ro){insert$1(no,ue,ro),insert$1(no,eo,ro)},p(no,ro){ro[0]&64&&set_data(eo,no[6])},d(no){no&&(detach(ue),detach(eo))}}}function create_default_slot_1$3W(to){let ue,eo;return{c(){ue=text("Yes - discard "),eo=text(to[6])},m(no,ro){insert$1(no,ue,ro),insert$1(no,eo,ro)},p(no,ro){ro[0]&64&&set_data(eo,no[6])},d(no){no&&(detach(ue),detach(eo))}}}function create_if_block_2$1h(to){let ue,eo;return ue=new SnippetSidePanel({props:{addSnippet:to[49],snippets:to[2]}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[0]&2097152&&(oo.addSnippet=no[49]),ro[0]&4&&(oo.snippets=no[2]),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block_1$27(to){let ue,eo;return ue=new EvaluationSidePanel({props:{expressionResult:to[16],expressionError:to[17],evaluating:to[18],expression:to[20]}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[0]&65536&&(oo.expressionResult=no[16]),ro[0]&131072&&(oo.expressionError=no[17]),ro[0]&262144&&(oo.evaluating=no[18]),ro[0]&1048576&&(oo.expression=no[20]),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block$42(to){let ue,eo;return ue=new BindingSidePanel({props:{bindings:to[13],allowHelpers:to[0],context:to[1],addHelper:to[26],addBinding:to[27],mode:to[14]}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[0]&8192&&(oo.bindings=no[13]),ro[0]&1&&(oo.allowHelpers=no[0]),ro[0]&2&&(oo.context=no[1]),ro[0]&16384&&(oo.mode=no[14]),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot$5B(to){let ue,eo,no,ro,oo,io,ao,so,lo,co,uo,fo,po=to[5]&&create_if_block_6$m(to);const ho=[create_if_block_4$G,create_if_block_5$u],_o=[];function go(ko,So){return ko[6]===ko[24].Text?0:ko[6]===ko[24].JavaScript?1:-1}~(oo=go(to))&&(io=_o[oo]=ho[oo](to));let bo=to[15]&&create_if_block_3$W(to);const vo=[create_if_block$42,create_if_block_1$27,create_if_block_2$1h],yo=[];function wo(ko,So){return ko[7]===ko[25].Bindings?0:ko[7]===ko[25].Evaluation?1:ko[7]===ko[25].Snippets?2:-1}return~(co=wo(to))&&(uo=yo[co]=vo[co](to)),{c(){ue=element("div"),eo=element("div"),po&&po.c(),no=space$1(),ro=element("div"),io&&io.c(),ao=space$1(),bo&&bo.c(),so=space$1(),lo=element("div"),uo&&uo.c(),attr(ro,"class","editor svelte-biform"),attr(eo,"class","main svelte-biform"),attr(lo,"class","side svelte-biform"),toggle_class(lo,"visible",!!to[7]),attr(ue,"class","binding-panel svelte-biform")},m(ko,So){insert$1(ko,ue,So),append$2(ue,eo),po&&po.m(eo,null),append$2(eo,no),append$2(eo,ro),~oo&&_o[oo].m(ro,null),append$2(ro,ao),bo&&bo.m(ro,null),append$2(ue,so),append$2(ue,lo),~co&&yo[co].m(lo,null),fo=!0},p(ko,So){ko[5]?po?(po.p(ko,So),So[0]&32&&transition_in(po,1)):(po=create_if_block_6$m(ko),po.c(),transition_in(po,1),po.m(eo,no)):po&&(group_outros(),transition_out(po,1,1,()=>{po=null}),check_outros());let Eo=oo;oo=go(ko),oo===Eo?~oo&&_o[oo].p(ko,So):(io&&(group_outros(),transition_out(_o[Eo],1,1,()=>{_o[Eo]=null}),check_outros()),~oo?(io=_o[oo],io?io.p(ko,So):(io=_o[oo]=ho[oo](ko),io.c()),transition_in(io,1),io.m(ro,ao)):io=null),ko[15]?bo?(bo.p(ko,So),So[0]&32768&&transition_in(bo,1)):(bo=create_if_block_3$W(ko),bo.c(),transition_in(bo,1),bo.m(ro,null)):bo&&(group_outros(),transition_out(bo,1,1,()=>{bo=null}),check_outros());let Io=co;co=wo(ko),co===Io?~co&&yo[co].p(ko,So):(uo&&(group_outros(),transition_out(yo[Io],1,1,()=>{yo[Io]=null}),check_outros()),~co?(uo=yo[co],uo?uo.p(ko,So):(uo=yo[co]=vo[co](ko),uo.c()),transition_in(uo,1),uo.m(lo,null)):uo=null),(!fo||So[0]&128)&&toggle_class(lo,"visible",!!ko[7])},i(ko){fo||(transition_in(po),transition_in(io),transition_in(bo),transition_in(uo),fo=!0)},o(ko){transition_out(po),transition_out(io),transition_out(bo),transition_out(uo),fo=!1},d(ko){ko&&detach(ue),po&&po.d(),~oo&&_o[oo].d(),bo&&bo.d(),~co&&yo[co].d()}}}function create_fragment$8K(to){let ue,eo;return ue=new DrawerContent({props:{padding:!1,$$slots:{default:[create_default_slot$5B]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[0]&16777215|ro[2]&32&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function instance$8K(to,ue,eo){var Ha;let no,ro,oo,io,ao,so,lo,co,uo,fo,po,ho,_o;component_subscribe(to,licensing,qa=>eo(41,_o=qa));const go=createEventDispatcher();let{bindings:bo=[]}=ue,{value:vo=""}=ue,{allowHBS:yo=!0}=ue,{allowJS:wo=!1}=ue,{allowHelpers:ko=!0}=ue,{allowSnippets:So=!0}=ue,{context:Eo=null}=ue,{snippets:Io=null}=ue,{autofocusEditor:Ao=!1}=ue,{placeholder:To=null}=ue,{showTabBar:Mo=!0}=ue;const Vo={Text:"Text",JavaScript:"JavaScript"},Fo={Bindings:"FlashOn",Evaluation:"Play",Snippets:"Code"};let Po,Ro,Do=(Ha=vo==null?void 0:vo.startsWith)==null?void 0:Ha.call(vo,"{{ js "),qo=Do?vo:null,Uo=Do?null:vo,jo,Zo,Qo=null,Yo,Xo,Ko=!1;const ra=qa=>[hbAutocomplete([...qa,...getHelperCompletions(EditorModes$1.Handlebars)])],ea=(qa,Ja,ja)=>{const bs=[jsAutocomplete([...qa,...getHelperCompletions(EditorModes$1.JS)])];return ja&&bs.push(snippetAutoComplete(Ja)),bs},ia=(qa,Ja)=>{let ja=[];return qa&&ja.push(Vo.Text),Ja&&ja.push(Vo.JavaScript),ja},Jo=(qa,Ja,ja,bs)=>{let Ss=[];return qa!=null&&qa.length&&Ss.push(Fo.Bindings),Ja&&Object.keys(Ja).length>0&&Ss.push(Fo.Evaluation),ja&&bs===Vo.JavaScript&&Ss.push(Fo.Snippets),Ss},sa=debounce((qa,Ja,ja)=>{try{eo(17,Xo=null),eo(16,Yo=processStringSync(qa||"",{...Ja,snippets:ja},{noThrow:!1}))}catch(bs){eo(16,Yo=null),eo(17,Xo=bs)}eo(18,Ko=!1)},260),Ea=(qa,Ja,ja)=>{eo(18,Ko=!0),sa(qa,Ja,ja)},pa=qa=>formatHighlight(qa,{keyColor:"#e06c75",numberColor:"#e5c07b",stringColor:"#98c379",trueColor:"#d19a66",falseColor:"#d19a66",nullColor:"#c678dd"}),ya=(qa,Ja,ja)=>{const bs=qa.map(Xa=>Xa.runtimeBinding.startsWith('trim "')?`{{ ${Xa.runtimeBinding} }}`:`{{ literal ${Xa.runtimeBinding} }}`),Ss=processObjectSync(bs,{...Ja,snippets:ja});return qa.map((Xa,us)=>{if(!Ja)return Xa;const Bs=JSON.stringify(Ss[us],null,2);return{...Xa,value:Bs,valueHTML:pa(Bs)}})},da=qa=>{const Ja=readableToRuntimeBinding(io,qa);go("change",qa),Ea(Ja,Eo,Io)},Ra=(qa,Ja)=>{fo.onSelectHelper(Ja?qo:Uo,qa,{js:Ja})},Da=(qa,{forceJS:Ja}={})=>{const ja=ao||Ja;fo.onSelectBinding(ja?qo:Uo,qa,{js:ja})},Na=qa=>{if(Qo||qa===Po)return;let Ja=lo;Po===Vo.JavaScript&&(Ja=decodeJSBinding(Ja)),Ja!=null&&Ja.length?eo(15,Qo=qa):eo(6,Po=qa)},ka=()=>{eo(8,qo=null),eo(9,Uo=null),da(null),eo(6,Po=Qo),eo(15,Qo=null)},Aa=qa=>{eo(7,Ro=qa===Ro?null:qa)},ba=qa=>{eo(9,Uo=qa.detail),da(Uo)},ls=qa=>{var Ja;eo(8,qo=encodeJSBinding(qa.detail)),(Ja=qa.detail)!=null&&Ja.trim()?da(qo):da(null)};onMount(()=>{const qa=Do?Vo.JavaScript:Vo.Text;ro.includes(qa)?eo(6,Po=qa):eo(6,Po=ro[0]),eo(7,Ro=oo[0])});const Ia=qa=>Na(qa),ga=qa=>Aa(qa);function $a(qa){jo=qa,eo(10,jo)}function fa(qa){Zo=qa,eo(11,Zo)}function ma(qa){jo=qa,eo(10,jo)}function La(qa){Zo=qa,eo(11,Zo)}const wa=()=>{eo(15,Qo=null)},Fa=qa=>fo.onSelectSnippet(qa);return to.$$set=qa=>{"bindings"in qa&&eo(33,bo=qa.bindings),"value"in qa&&eo(34,vo=qa.value),"allowHBS"in qa&&eo(35,yo=qa.allowHBS),"allowJS"in qa&&eo(36,wo=qa.allowJS),"allowHelpers"in qa&&eo(0,ko=qa.allowHelpers),"allowSnippets"in qa&&eo(37,So=qa.allowSnippets),"context"in qa&&eo(1,Eo=qa.context),"snippets"in qa&&eo(2,Io=qa.snippets),"autofocusEditor"in qa&&eo(3,Ao=qa.autofocusEditor),"placeholder"in qa&&eo(4,To=qa.placeholder),"showTabBar"in qa&&eo(5,Mo=qa.showTabBar)},to.$$.update=()=>{to.$$.dirty[1]&1088&&eo(38,no=So&&!_o.isFreePlan),to.$$.dirty[1]&48&&eo(19,ro=ia(yo,wo)),to.$$.dirty[0]&66|to.$$.dirty[1]&68&&eo(12,oo=Jo(bo,Eo,So,Po)),to.$$.dirty[0]&6|to.$$.dirty[1]&4&&eo(13,io=ya(bo,Eo,Io)),to.$$.dirty[0]&64&&(ao=Po===Vo.JavaScript),to.$$.dirty[0]&64&&eo(14,so=Po===Vo.JavaScript?EditorModes$1.JS:EditorModes$1.Handlebars),to.$$.dirty[0]&17152&&eo(20,lo=so===EditorModes$1.JS?qo:Uo),to.$$.dirty[0]&8192|to.$$.dirty[1]&8&&eo(40,co=readableToRuntimeBinding(io,vo)),to.$$.dirty[0]&6|to.$$.dirty[1]&512&&Ea(co,Eo,Io),to.$$.dirty[0]&24576&&eo(39,uo=bindingsToCompletions(io,so)),to.$$.dirty[0]&3072&&eo(21,fo=new BindingHelpers(jo,Zo)),to.$$.dirty[1]&256&&eo(23,po=ra(uo)),to.$$.dirty[0]&4|to.$$.dirty[1]&384&&eo(22,ho=ea(uo,Io,no)),to.$$.dirty[0]&4224&&Ro&&!oo.includes(Ro)&&eo(7,Ro=oo[0])},[ko,Eo,Io,Ao,To,Mo,Po,Ro,qo,Uo,jo,Zo,oo,io,so,Qo,Yo,Xo,Ko,ro,lo,fo,ho,po,Vo,Fo,Ra,Da,Na,ka,Aa,ba,ls,bo,vo,yo,wo,So,no,uo,co,_o,Ia,ga,$a,fa,ma,La,wa,Fa]}class BindingPanel extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$8K,create_fragment$8K,safe_not_equal,{bindings:33,value:34,allowHBS:35,allowJS:36,allowHelpers:0,allowSnippets:37,context:1,snippets:2,autofocusEditor:3,placeholder:4,showTabBar:5},null,[-1,-1,-1])}}function create_fragment$8J(to){let ue,eo;return ue=new BindingPanel({props:{bindings:to[6],context:{...to[7].selectedComponentContext,...to[5]},snippets:to[8],value:to[0],allowHBS:to[1],allowJS:to[2],allowHelpers:to[3],autofocusEditor:to[4]}}),ue.$on("change",to[10]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,[ro]){const oo={};ro&64&&(oo.bindings=no[6]),ro&160&&(oo.context={...no[7].selectedComponentContext,...no[5]}),ro&256&&(oo.snippets=no[8]),ro&1&&(oo.value=no[0]),ro&2&&(oo.allowHBS=no[1]),ro&4&&(oo.allowJS=no[2]),ro&8&&(oo.allowHelpers=no[3]),ro&16&&(oo.autofocusEditor=no[4]),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function instance$8J(to,ue,eo){let no,ro,oo;component_subscribe(to,previewStore,_o=>eo(7,ro=_o)),component_subscribe(to,snippets$1,_o=>eo(8,oo=_o));let{bindings:io=[]}=ue,{value:ao=""}=ue,{allowHBS:so=!0}=ue,{allowJS:lo=!1}=ue,{allowHelpers:co=!0}=ue,{autofocusEditor:uo=!1}=ue,{context:fo=null}=ue;const po=_o=>_o!=null&&_o.length?_o==null?void 0:_o.map(go=>({...go,type:null})):_o;onMount(previewStore.requestComponentContext);function ho(_o){bubble.call(this,to,_o)}return to.$$set=_o=>{"bindings"in _o&&eo(9,io=_o.bindings),"value"in _o&&eo(0,ao=_o.value),"allowHBS"in _o&&eo(1,so=_o.allowHBS),"allowJS"in _o&&eo(2,lo=_o.allowJS),"allowHelpers"in _o&&eo(3,co=_o.allowHelpers),"autofocusEditor"in _o&&eo(4,uo=_o.autofocusEditor),"context"in _o&&eo(5,fo=_o.context)},to.$$.update=()=>{to.$$.dirty&512&&eo(6,no=po(io))},[ao,so,lo,co,uo,fo,no,ro,oo,io,ho]}class ClientBindingPanel extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$8J,create_fragment$8J,safe_not_equal,{bindings:9,value:0,allowHBS:1,allowJS:2,allowHelpers:3,autofocusEditor:4,context:5})}}const DrawerBindableInput_svelte_svelte_type_style_lang="";function create_if_block$41(to){let ue,eo,no,ro,oo;return eo=new Icon({props:{size:"S",name:"FlashOn"}}),{c(){ue=element("div"),create_component(eo.$$.fragment),attr(ue,"class","icon svelte-570cq4")},m(io,ao){insert$1(io,ue,ao),mount_component(eo,ue,null),no=!0,ro||(oo=listen(ue,"click",to[25]),ro=!0)},p:noop$6,i(io){no||(transition_in(eo.$$.fragment,io),no=!0)},o(io){transition_out(eo.$$.fragment,io),no=!1},d(io){io&&detach(ue),destroy_component(eo),ro=!1,oo()}}}function create_default_slot$5A(to){let ue;return{c(){ue=text("Save")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_buttons_slot$g(to){let ue,eo;return ue=new Button({props:{cta:!0,slot:"buttons",$$slots:{default:[create_default_slot$5A]},$$scope:{ctx:to}}}),ue.$on("click",to[19]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[1]&1&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_body_slot$f(to){let ue,eo,no;var ro=to[0];function oo(io,ao){return{props:{slot:"body",value:io[15],bindings:io[1],allowHBS:io[6],allowJS:io[7],allowHelpers:io[8],context:io[13]}}}return ro&&(ue=construct_svelte_component(ro,oo(to)),ue.$on("change",to[26])),{c(){ue&&create_component(ue.$$.fragment),eo=empty$2()},m(io,ao){ue&&mount_component(ue,io,ao),insert$1(io,eo,ao),no=!0},p(io,ao){if(ao[0]&1&&ro!==(ro=io[0])){if(ue){group_outros();const so=ue;transition_out(so.$$.fragment,1,0,()=>{destroy_component(so,1)}),check_outros()}ro?(ue=construct_svelte_component(ro,oo(io)),ue.$on("change",io[26]),create_component(ue.$$.fragment),transition_in(ue.$$.fragment,1),mount_component(ue,eo.parentNode,eo)):ue=null}else if(ro){const so={};ao[0]&32768&&(so.value=io[15]),ao[0]&2&&(so.bindings=io[1]),ao[0]&64&&(so.allowHBS=io[6]),ao[0]&128&&(so.allowJS=io[7]),ao[0]&256&&(so.allowHelpers=io[8]),ao[0]&8192&&(so.context=io[13]),ue.$set(so)}},i(io){no||(ue&&transition_in(ue.$$.fragment,io),no=!0)},o(io){ue&&transition_out(ue.$$.fragment,io),no=!1},d(io){io&&detach(eo),ue&&destroy_component(ue,io)}}}function create_fragment$8I(to){let ue,eo,no,ro,oo,io;eo=new Input$5({props:{label:to[4],disabled:to[5],readonly:to[18],value:to[18]?"(JavaScript function)":to[15],placeholder:to[3],updateOnChange:to[9],autocomplete:to[14]}}),eo.$on("change",to[24]),eo.$on("blur",to[21]);let ao=!to[5]&&!to[11]&&create_if_block$41(to),so={title:to[2]??to[3]??"Bindings",forceModal:to[12],$$slots:{body:[create_body_slot$f],buttons:[create_buttons_slot$g]},$$scope:{ctx:to}};return oo=new Drawer({props:so}),to[27](oo),oo.$on("drawerHide",to[22]),oo.$on("drawerShow",to[28]),{c(){ue=element("div"),create_component(eo.$$.fragment),no=space$1(),ao&&ao.c(),ro=space$1(),create_component(oo.$$.fragment),attr(ue,"class","control svelte-570cq4"),toggle_class(ue,"disabled",to[5])},m(lo,co){insert$1(lo,ue,co),mount_component(eo,ue,null),append$2(ue,no),ao&&ao.m(ue,null),insert$1(lo,ro,co),mount_component(oo,lo,co),io=!0},p(lo,co){const uo={};co[0]&16&&(uo.label=lo[4]),co[0]&32&&(uo.disabled=lo[5]),co[0]&262144&&(uo.readonly=lo[18]),co[0]&294912&&(uo.value=lo[18]?"(JavaScript function)":lo[15]),co[0]&8&&(uo.placeholder=lo[3]),co[0]&512&&(uo.updateOnChange=lo[9]),co[0]&16384&&(uo.autocomplete=lo[14]),eo.$set(uo),!lo[5]&&!lo[11]?ao?(ao.p(lo,co),co[0]&2080&&transition_in(ao,1)):(ao=create_if_block$41(lo),ao.c(),transition_in(ao,1),ao.m(ue,null)):ao&&(group_outros(),transition_out(ao,1,1,()=>{ao=null}),check_outros()),(!io||co[0]&32)&&toggle_class(ue,"disabled",lo[5]);const fo={};co[0]&12&&(fo.title=lo[2]??lo[3]??"Bindings"),co[0]&4096&&(fo.forceModal=lo[12]),co[0]&172483|co[1]&1&&(fo.$$scope={dirty:co,ctx:lo}),oo.$set(fo)},i(lo){io||(transition_in(eo.$$.fragment,lo),transition_in(ao),transition_in(oo.$$.fragment,lo),io=!0)},o(lo){transition_out(eo.$$.fragment,lo),transition_out(ao),transition_out(oo.$$.fragment,lo),io=!1},d(lo){lo&&(detach(ue),detach(ro)),destroy_component(eo),ao&&ao.d(),to[27](null),destroy_component(oo,lo)}}}function instance$8I(to,ue,eo){let no,ro,oo,{panel:io=ClientBindingPanel}=ue,{value:ao=""}=ue,{bindings:so=[]}=ue,{title:lo}=ue,{placeholder:co}=ue,{label:uo}=ue,{disabled:fo=!1}=ue,{allowHBS:po=!0}=ue,{allowJS:ho=!0}=ue,{allowHelpers:_o=!0}=ue,{updateOnChange:go=!0}=ue,{key:bo}=ue,{disableBindings:vo=!1}=ue,{forceModal:yo=!1}=ue,{context:wo=null}=ue,{autocomplete:ko}=ue;const So=createEventDispatcher();let Eo,Io=ao;const Ao=()=>{To(ro),Mo(),builderStore.propertyFocus(),Eo.hide()};setContext("binding-drawer-actions",{save:Ao});const To=Uo=>{Io=readableToRuntimeBinding(so,Uo),So("change",Io)},Mo=()=>{So("blur",Io)},Vo=Uo=>{builderStore.propertyFocus(),So("drawerHide",Uo.detail)},Fo=Uo=>To(Uo.detail),Po=()=>{builderStore.propertyFocus(bo),Eo.show()},Ro=Uo=>eo(17,ro=Uo.detail);function Do(Uo){binding_callbacks[Uo?"unshift":"push"](()=>{Eo=Uo,eo(16,Eo)})}function qo(Uo){bubble.call(this,to,Uo)}return to.$$set=Uo=>{"panel"in Uo&&eo(0,io=Uo.panel),"value"in Uo&&eo(23,ao=Uo.value),"bindings"in Uo&&eo(1,so=Uo.bindings),"title"in Uo&&eo(2,lo=Uo.title),"placeholder"in Uo&&eo(3,co=Uo.placeholder),"label"in Uo&&eo(4,uo=Uo.label),"disabled"in Uo&&eo(5,fo=Uo.disabled),"allowHBS"in Uo&&eo(6,po=Uo.allowHBS),"allowJS"in Uo&&eo(7,ho=Uo.allowJS),"allowHelpers"in Uo&&eo(8,_o=Uo.allowHelpers),"updateOnChange"in Uo&&eo(9,go=Uo.updateOnChange),"key"in Uo&&eo(10,bo=Uo.key),"disableBindings"in Uo&&eo(11,vo=Uo.disableBindings),"forceModal"in Uo&&eo(12,yo=Uo.forceModal),"context"in Uo&&eo(13,wo=Uo.context),"autocomplete"in Uo&&eo(14,ko=Uo.autocomplete)},to.$$.update=()=>{to.$$.dirty[0]&8388610&&eo(15,no=runtimeToReadableBinding(so,ao)),to.$$.dirty[0]&32768&&eo(17,ro=no),to.$$.dirty[0]&8388608&&eo(18,oo=isJSBinding(ao))},[io,so,lo,co,uo,fo,po,ho,_o,go,bo,vo,yo,wo,ko,no,Eo,ro,oo,Ao,To,Mo,Vo,ao,Fo,Po,Ro,Do,qo]}class DrawerBindableInput extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$8I,create_fragment$8I,safe_not_equal,{panel:0,value:23,bindings:1,title:2,placeholder:3,label:4,disabled:5,allowHBS:6,allowJS:7,allowHelpers:8,updateOnChange:9,key:10,disableBindings:11,forceModal:12,context:13,autocomplete:14},null,[-1,-1])}}const KeyValueBuilder_svelte_svelte_type_style_lang="";function get_each_context$1E(to,ue,eo){const no=to.slice();return no[39]=ue[eo],no[40]=ue,no[41]=eo,no}function get_each_context_1$q(to,ue,eo){const no=to.slice();return no[42]=ue[eo],no}function create_if_block_2$1g(to){let ue,eo,no,ro=to[4]&&create_if_block_10$6(to),oo=ensure_array_like(to[23]),io=[];for(let so=0;so<oo.length;so+=1)io[so]=create_each_block$1E(get_each_context$1E(to,oo,so));const ao=so=>transition_out(io[so],1,1,()=>{io[so]=null});return{c(){ro&&ro.c(),ue=space$1(),eo=element("div");for(let so=0;so<io.length;so+=1)io[so].c();attr(eo,"class","container svelte-1gk02qa"),toggle_class(eo,"container-active",to[6]),toggle_class(eo,"container-menu",to[13]),toggle_class(eo,"readOnly",to[1]),toggle_class(eo,"readOnly-menu",to[1]&&to[13])},m(so,lo){ro&&ro.m(so,lo),insert$1(so,ue,lo),insert$1(so,eo,lo);for(let co=0;co<io.length;co+=1)io[co]&&io[co].m(eo,null);no=!0},p(so,lo){if(so[4]?ro?(ro.p(so,lo),lo[0]&16&&transition_in(ro,1)):(ro=create_if_block_10$6(so),ro.c(),transition_in(ro,1),ro.m(ue.parentNode,ue)):ro&&(group_outros(),transition_out(ro,1,1,()=>{ro=null}),check_outros()),lo[0]&128840162){oo=ensure_array_like(so[23]);let co;for(co=0;co<oo.length;co+=1){const uo=get_each_context$1E(so,oo,co);io[co]?(io[co].p(uo,lo),transition_in(io[co],1)):(io[co]=create_each_block$1E(uo),io[co].c(),transition_in(io[co],1),io[co].m(eo,null))}for(group_outros(),co=oo.length;co<io.length;co+=1)ao(co);check_outros()}(!no||lo[0]&64)&&toggle_class(eo,"container-active",so[6]),(!no||lo[0]&8192)&&toggle_class(eo,"container-menu",so[13]),(!no||lo[0]&2)&&toggle_class(eo,"readOnly",so[1]),(!no||lo[0]&8194)&&toggle_class(eo,"readOnly-menu",so[1]&&so[13])},i(so){if(!no){transition_in(ro);for(let lo=0;lo<oo.length;lo+=1)transition_in(io[lo]);no=!0}},o(so){transition_out(ro),io=io.filter(Boolean);for(let lo=0;lo<io.length;lo+=1)transition_out(io[lo]);no=!1},d(so){so&&(detach(ue),detach(eo)),ro&&ro.d(so),destroy_each(io,so)}}}function create_if_block_10$6(to){let ue,eo,no,ro,oo,io;eo=new Label({props:{tooltip:to[11],$$slots:{default:[create_default_slot_5$1f]},$$scope:{ctx:to}}}),ro=new Label({props:{$$slots:{default:[create_default_slot_4$1D]},$$scope:{ctx:to}}});let ao=to[6]&&create_if_block_11$3(to);return{c(){ue=element("div"),create_component(eo.$$.fragment),no=space$1(),create_component(ro.$$.fragment),oo=space$1(),ao&&ao.c(),attr(ue,"class","container svelte-1gk02qa"),toggle_class(ue,"container-active",to[6])},m(so,lo){insert$1(so,ue,lo),mount_component(eo,ue,null),append$2(ue,no),mount_component(ro,ue,null),append$2(ue,oo),ao&&ao.m(ue,null),io=!0},p(so,lo){const co={};lo[0]&2048&&(co.tooltip=so[11]),lo[0]&1152|lo[1]&16384&&(co.$$scope={dirty:lo,ctx:so}),eo.$set(co);const uo={};lo[0]&768|lo[1]&16384&&(uo.$$scope={dirty:lo,ctx:so}),ro.$set(uo),so[6]?ao?lo[0]&64&&transition_in(ao,1):(ao=create_if_block_11$3(so),ao.c(),transition_in(ao,1),ao.m(ue,null)):ao&&(group_outros(),transition_out(ao,1,1,()=>{ao=null}),check_outros()),(!io||lo[0]&64)&&toggle_class(ue,"container-active",so[6])},i(so){io||(transition_in(eo.$$.fragment,so),transition_in(ro.$$.fragment,so),transition_in(ao),io=!0)},o(so){transition_out(eo.$$.fragment,so),transition_out(ro.$$.fragment,so),transition_out(ao),io=!1},d(so){so&&detach(ue),destroy_component(eo),destroy_component(ro),ao&&ao.d()}}}function create_default_slot_5$1f(to){let ue=(to[10]||to[7])+"",eo;return{c(){eo=text(ue)},m(no,ro){insert$1(no,eo,ro)},p(no,ro){ro[0]&1152&&ue!==(ue=(no[10]||no[7])+"")&&set_data(eo,ue)},d(no){no&&detach(eo)}}}function create_default_slot_4$1D(to){let ue=(to[9]||to[8])+"",eo;return{c(){eo=text(ue)},m(no,ro){insert$1(no,eo,ro)},p(no,ro){ro[0]&768&&ue!==(ue=(no[9]||no[8])+"")&&set_data(eo,ue)},d(no){no&&detach(eo)}}}function create_if_block_11$3(to){let ue,eo;return ue=new Label({props:{$$slots:{default:[create_default_slot_3$2b]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot_3$2b(to){let ue;return{c(){ue=text("Active")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_else_block_2$6(to){let ue,eo,no;function ro(io){to[30](io,to[39])}let oo={readonly:to[1]};return to[39].name!==void 0&&(oo.value=to[39].name),ue=new Input$5({props:oo}),binding_callbacks.push(()=>bind$2(ue,"value",ro)),ue.$on("blur",to[26]),{c(){create_component(ue.$$.fragment)},m(io,ao){mount_component(ue,io,ao),no=!0},p(io,ao){to=io;const so={};ao[0]&2&&(so.readonly=to[1]),!eo&&ao[0]&8388608&&(eo=!0,so.value=to[39].name,add_flush_callback(()=>eo=!1)),ue.$set(so)},i(io){no||(transition_in(ue.$$.fragment,io),no=!0)},o(io){transition_out(ue.$$.fragment,io),no=!1},d(io){destroy_component(ue,io)}}}function create_if_block_9$c(to){let ue,eo;function no(...ro){return to[29](to[39],to[40],to[41],...ro)}return ue=new DrawerBindableInput({props:{bindings:to[14],placeholder:to[7],disabled:to[1],value:to[39].name,allowJS:to[19],allowHelpers:to[16],drawerLeft:to[15]}}),ue.$on("blur",no),{c(){create_component(ue.$$.fragment)},m(ro,oo){mount_component(ue,ro,oo),eo=!0},p(ro,oo){to=ro;const io={};oo[0]&16384&&(io.bindings=to[14]),oo[0]&128&&(io.placeholder=to[7]),oo[0]&2&&(io.disabled=to[1]),oo[0]&8388608&&(io.value=to[39].name),oo[0]&524288&&(io.allowJS=to[19]),oo[0]&65536&&(io.allowHelpers=to[16]),oo[0]&32768&&(io.drawerLeft=to[15]),ue.$set(io)},i(ro){eo||(transition_in(ue.$$.fragment,ro),eo=!0)},o(ro){transition_out(ue.$$.fragment,ro),eo=!1},d(ro){destroy_component(ue,ro)}}}function create_else_block_1$m(to){let ue,eo,no;function ro(io){to[33](io,to[39])}let oo={placeholder:to[8],readonly:to[1]};return to[39].value!==void 0&&(oo.value=to[39].value),ue=new Input$5({props:oo}),binding_callbacks.push(()=>bind$2(ue,"value",ro)),ue.$on("blur",to[26]),{c(){create_component(ue.$$.fragment)},m(io,ao){mount_component(ue,io,ao),no=!0},p(io,ao){to=io;const so={};ao[0]&256&&(so.placeholder=to[8]),ao[0]&2&&(so.readonly=to[1]),!eo&&ao[0]&8388608&&(eo=!0,so.value=to[39].value,add_flush_callback(()=>eo=!1)),ue.$set(so)},i(io){no||(transition_in(ue.$$.fragment,io),no=!0)},o(io){transition_out(ue.$$.fragment,io),no=!1},d(io){destroy_component(ue,io)}}}function create_if_block_8$e(to){let ue,eo;function no(...ro){return to[32](to[39],to[40],to[41],...ro)}return ue=new DrawerBindableInput({props:{bindings:to[14],placeholder:to[8],disabled:to[1],value:to[39].value,allowJS:to[19],allowHelpers:to[16],drawerLeft:to[15]}}),ue.$on("blur",no),{c(){create_component(ue.$$.fragment)},m(ro,oo){mount_component(ue,ro,oo),eo=!0},p(ro,oo){to=ro;const io={};oo[0]&16384&&(io.bindings=to[14]),oo[0]&256&&(io.placeholder=to[8]),oo[0]&2&&(io.disabled=to[1]),oo[0]&8388608&&(io.value=to[39].value),oo[0]&524288&&(io.allowJS=to[19]),oo[0]&65536&&(io.allowHelpers=to[16]),oo[0]&32768&&(io.drawerLeft=to[15]),ue.$set(io)},i(ro){eo||(transition_in(ue.$$.fragment,ro),eo=!0)},o(ro){transition_out(ue.$$.fragment,ro),eo=!1},d(ro){destroy_component(ue,ro)}}}function create_if_block_7$j(to){let ue,eo,no;function ro(io){to[31](io,to[39])}let oo={compare:to[21],options:to[5]};return to[39].value!==void 0&&(oo.value=to[39].value),ue=new Select_1$1({props:oo}),binding_callbacks.push(()=>bind$2(ue,"value",ro)),ue.$on("change",to[26]),{c(){create_component(ue.$$.fragment)},m(io,ao){mount_component(ue,io,ao),no=!0},p(io,ao){to=io;const so={};ao[0]&2097152&&(so.compare=to[21]),ao[0]&32&&(so.options=to[5]),!eo&&ao[0]&8388608&&(eo=!0,so.value=to[39].value,add_flush_callback(()=>eo=!1)),ue.$set(so)},i(io){no||(transition_in(ue.$$.fragment,io),no=!0)},o(io){transition_out(ue.$$.fragment,io),no=!1},d(io){destroy_component(ue,io)}}}function create_if_block_6$l(to){let ue,eo;return ue=new Select_1$1({props:{readonly:!0,value:"Array",options:["Array"]}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p:noop$6,i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block_5$t(to){let ue,eo,no;function ro(io){to[34](io,to[41])}let oo={};return to[24][to[41]]!==void 0&&(oo.value=to[24][to[41]]),ue=new Toggle({props:oo}),binding_callbacks.push(()=>bind$2(ue,"value",ro)),ue.$on("change",to[26]),{c(){create_component(ue.$$.fragment)},m(io,ao){mount_component(ue,io,ao),no=!0},p(io,ao){to=io;const so={};!eo&&ao[0]&16777216&&(eo=!0,so.value=to[24][to[41]],add_flush_callback(()=>eo=!1)),ue.$set(so)},i(io){no||(transition_in(ue.$$.fragment,io),no=!0)},o(io){transition_out(ue.$$.fragment,io),no=!1},d(io){destroy_component(ue,io)}}}function create_if_block_4$F(to){let ue,eo;function no(){return to[35](to[41])}return ue=new Icon({props:{hoverable:!0,name:"Close"}}),ue.$on("click",no),{c(){create_component(ue.$$.fragment)},m(ro,oo){mount_component(ue,ro,oo),eo=!0},p(ro,oo){to=ro},i(ro){eo||(transition_in(ue.$$.fragment,ro),eo=!0)},o(ro){transition_out(ue.$$.fragment,ro),eo=!1},d(ro){destroy_component(ue,ro)}}}function create_if_block_3$V(to){let ue,eo;return ue=new ActionMenu({props:{$$slots:{control:[create_control_slot$6],default:[create_default_slot_1$3V]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[0]&8392704|ro[1]&16384&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot_2$2O(to){let ue=to[42].text+"",eo;return{c(){eo=text(ue)},m(no,ro){insert$1(no,eo,ro)},p(no,ro){ro[0]&4096&&ue!==(ue=no[42].text+"")&&set_data(eo,ue)},d(no){no&&detach(eo)}}}function create_each_block_1$q(to){let ue,eo;function no(){return to[36](to[42],to[39])}return ue=new Item$1({props:{$$slots:{default:[create_default_slot_2$2O]},$$scope:{ctx:to}}}),ue.$on("click",no),{c(){create_component(ue.$$.fragment)},m(ro,oo){mount_component(ue,ro,oo),eo=!0},p(ro,oo){to=ro;const io={};oo[0]&4096|oo[1]&16384&&(io.$$scope={dirty:oo,ctx:to}),ue.$set(io)},i(ro){eo||(transition_in(ue.$$.fragment,ro),eo=!0)},o(ro){transition_out(ue.$$.fragment,ro),eo=!1},d(ro){destroy_component(ue,ro)}}}function create_default_slot_1$3V(to){let ue,eo,no=ensure_array_like(to[12]),ro=[];for(let io=0;io<no.length;io+=1)ro[io]=create_each_block_1$q(get_each_context_1$q(to,no,io));const oo=io=>transition_out(ro[io],1,1,()=>{ro[io]=null});return{c(){for(let io=0;io<ro.length;io+=1)ro[io].c();ue=space$1()},m(io,ao){for(let so=0;so<ro.length;so+=1)ro[so]&&ro[so].m(io,ao);insert$1(io,ue,ao),eo=!0},p(io,ao){if(ao[0]&8392704){no=ensure_array_like(io[12]);let so;for(so=0;so<no.length;so+=1){const lo=get_each_context_1$q(io,no,so);ro[so]?(ro[so].p(lo,ao),transition_in(ro[so],1)):(ro[so]=create_each_block_1$q(lo),ro[so].c(),transition_in(ro[so],1),ro[so].m(ue.parentNode,ue))}for(group_outros(),so=no.length;so<ro.length;so+=1)oo(so);check_outros()}},i(io){if(!eo){for(let ao=0;ao<no.length;ao+=1)transition_in(ro[ao]);eo=!0}},o(io){ro=ro.filter(Boolean);for(let ao=0;ao<ro.length;ao+=1)transition_out(ro[ao]);eo=!1},d(io){io&&detach(ue),destroy_each(ro,io)}}}function create_control_slot$6(to){let ue,eo,no,ro;return eo=new Icon({props:{size:"S",hoverable:!0,name:"MoreSmallList"}}),{c(){ue=element("div"),create_component(eo.$$.fragment),no=space$1(),attr(ue,"slot","control"),attr(ue,"class","control icon svelte-1gk02qa")},m(oo,io){insert$1(oo,ue,io),mount_component(eo,ue,null),append$2(ue,no),ro=!0},p:noop$6,i(oo){ro||(transition_in(eo.$$.fragment,oo),ro=!0)},o(oo){transition_out(eo.$$.fragment,oo),ro=!1},d(oo){oo&&detach(ue),destroy_component(eo)}}}function create_each_block$1E(to){var ko;let ue,eo,no,ro,oo,io,ao,so,lo,co,uo;const fo=[create_if_block_9$c,create_else_block_2$6],po=[];function ho(So,Eo){return So[18]?0:1}ue=ho(to),eo=po[ue]=fo[ue](to);const _o=[create_if_block_6$l,create_if_block_7$j,create_if_block_8$e,create_else_block_1$m],go=[];function bo(So,Eo){return Eo[0]&8388608&&(ro=null),ro==null&&(ro=!!isJsonArray(So[39].value)),ro?0:So[5]?1:So[14]&&So[14].length?2:3}oo=bo(to,[-1,-1]),io=go[oo]=_o[oo](to);let vo=to[6]&&create_if_block_5$t(to),yo=!to[1]&&create_if_block_4$F(to),wo=((ko=to[12])==null?void 0:ko.length)>0&&to[13]&&create_if_block_3$V(to);return{c(){eo.c(),no=space$1(),io.c(),ao=space$1(),vo&&vo.c(),so=space$1(),yo&&yo.c(),lo=space$1(),wo&&wo.c(),co=empty$2()},m(So,Eo){po[ue].m(So,Eo),insert$1(So,no,Eo),go[oo].m(So,Eo),insert$1(So,ao,Eo),vo&&vo.m(So,Eo),insert$1(So,so,Eo),yo&&yo.m(So,Eo),insert$1(So,lo,Eo),wo&&wo.m(So,Eo),insert$1(So,co,Eo),uo=!0},p(So,Eo){var To;let Io=ue;ue=ho(So),ue===Io?po[ue].p(So,Eo):(group_outros(),transition_out(po[Io],1,1,()=>{po[Io]=null}),check_outros(),eo=po[ue],eo?eo.p(So,Eo):(eo=po[ue]=fo[ue](So),eo.c()),transition_in(eo,1),eo.m(no.parentNode,no));let Ao=oo;oo=bo(So,Eo),oo===Ao?go[oo].p(So,Eo):(group_outros(),transition_out(go[Ao],1,1,()=>{go[Ao]=null}),check_outros(),io=go[oo],io?io.p(So,Eo):(io=go[oo]=_o[oo](So),io.c()),transition_in(io,1),io.m(ao.parentNode,ao)),So[6]?vo?(vo.p(So,Eo),Eo[0]&64&&transition_in(vo,1)):(vo=create_if_block_5$t(So),vo.c(),transition_in(vo,1),vo.m(so.parentNode,so)):vo&&(group_outros(),transition_out(vo,1,1,()=>{vo=null}),check_outros()),So[1]?yo&&(group_outros(),transition_out(yo,1,1,()=>{yo=null}),check_outros()):yo?(yo.p(So,Eo),Eo[0]&2&&transition_in(yo,1)):(yo=create_if_block_4$F(So),yo.c(),transition_in(yo,1),yo.m(lo.parentNode,lo)),((To=So[12])==null?void 0:To.length)>0&&So[13]?wo?(wo.p(So,Eo),Eo[0]&12288&&transition_in(wo,1)):(wo=create_if_block_3$V(So),wo.c(),transition_in(wo,1),wo.m(co.parentNode,co)):wo&&(group_outros(),transition_out(wo,1,1,()=>{wo=null}),check_outros())},i(So){uo||(transition_in(eo),transition_in(io),transition_in(vo),transition_in(yo),transition_in(wo),uo=!0)},o(So){transition_out(eo),transition_out(io),transition_out(vo),transition_out(yo),transition_out(wo),uo=!1},d(So){So&&(detach(no),detach(ao),detach(so),detach(lo),detach(co)),po[ue].d(So),go[oo].d(So),vo&&vo.d(So),yo&&yo.d(So),wo&&wo.d(So)}}}function create_if_block$40(to){let ue,eo,no;return eo=new ActionButton({props:{disabled:to[20],icon:"Add",secondary:!0,thin:!0,outline:!0,$$slots:{default:[create_default_slot$5z]},$$scope:{ctx:to}}}),eo.$on("click",to[22]),{c(){ue=element("div"),create_component(eo.$$.fragment)},m(ro,oo){insert$1(ro,ue,oo),mount_component(eo,ue,null),no=!0},p(ro,oo){const io={};oo[0]&1048576&&(io.disabled=ro[20]),oo[0]&131080|oo[1]&16384&&(io.$$scope={dirty:oo,ctx:ro}),eo.$set(io)},i(ro){no||(transition_in(eo.$$.fragment,ro),no=!0)},o(ro){transition_out(eo.$$.fragment,ro),no=!1},d(ro){ro&&detach(ue),destroy_component(eo)}}}function create_else_block$1y(to){let ue=`Add${to[3]?` ${lowercase(to[3])}`:""}`,eo;return{c(){eo=text(ue)},m(no,ro){insert$1(no,eo,ro)},p(no,ro){ro[0]&8&&ue!==(ue=`Add${no[3]?` ${lowercase(no[3])}`:""}`)&&set_data(eo,ue)},d(no){no&&detach(eo)}}}function create_if_block_1$26(to){let ue;return{c(){ue=text(to[17])},m(eo,no){insert$1(eo,ue,no)},p(eo,no){no[0]&131072&&set_data(ue,eo[17])},d(eo){eo&&detach(ue)}}}function create_default_slot$5z(to){let ue;function eo(oo,io){return oo[17]?create_if_block_1$26:create_else_block$1y}let no=eo(to),ro=no(to);return{c(){ro.c(),ue=empty$2()},m(oo,io){ro.m(oo,io),insert$1(oo,ue,io)},p(oo,io){no===(no=eo(oo))&&ro?ro.p(oo,io):(ro.d(1),ro=no(oo),ro&&(ro.c(),ro.m(ue.parentNode,ue)))},d(oo){oo&&detach(ue),ro.d(oo)}}}function create_fragment$8H(to){let ue=Object.keys(to[0]||{}).length>0,eo,no,ro,oo=ue&&create_if_block_2$1g(to),io=!to[1]&&!to[2]&&create_if_block$40(to);return{c(){oo&&oo.c(),eo=space$1(),io&&io.c(),no=empty$2()},m(ao,so){oo&&oo.m(ao,so),insert$1(ao,eo,so),io&&io.m(ao,so),insert$1(ao,no,so),ro=!0},p(ao,so){so[0]&1&&(ue=Object.keys(ao[0]||{}).length>0),ue?oo?(oo.p(ao,so),so[0]&1&&transition_in(oo,1)):(oo=create_if_block_2$1g(ao),oo.c(),transition_in(oo,1),oo.m(eo.parentNode,eo)):oo&&(group_outros(),transition_out(oo,1,1,()=>{oo=null}),check_outros()),!ao[1]&&!ao[2]?io?(io.p(ao,so),so[0]&6&&transition_in(io,1)):(io=create_if_block$40(ao),io.c(),transition_in(io,1),io.m(no.parentNode,no)):io&&(group_outros(),transition_out(io,1,1,()=>{io=null}),check_outros())},i(ao){ro||(transition_in(oo),transition_in(io),ro=!0)},o(ao){transition_out(oo),transition_out(io),ro=!1},d(ao){ao&&(detach(eo),detach(no)),oo&&oo.d(ao),io&&io.d(ao)}}}function isJsonArray(to){return!to||typeof to=="string"?!1:to.type==="array"?!0:to.type==="json"&&to.subtype==="array"}function instance$8H(to,ue,eo){let no=createEventDispatcher(),{defaults:ro}=ue,{object:oo=ro||{}}=ue,{activity:io={}}=ue,{readOnly:ao}=ue,{noAddButton:so}=ue,{name:lo}=ue,{headings:co=!1}=ue,{options:uo}=ue,{toggle:fo}=ue,{keyPlaceholder:po="Key"}=ue,{valuePlaceholder:ho="Value"}=ue,{valueHeading:_o}=ue,{keyHeading:go}=ue,{tooltip:bo}=ue,{menuItems:vo}=ue,{showMenu:yo=!1}=ue,{bindings:wo=[]}=ue,{bindingDrawerLeft:ko}=ue,{allowHelpers:So=!0}=ue,{customButtonText:Eo=null}=ue,{keyBindings:Io=!1}=ue,{allowJS:Ao=!1}=ue,{actionButtonDisabled:To=!1}=ue,{compare:Mo=(ea,ia)=>ea===ia}=ue,Vo=Object.entries(oo||{}).map(([ea,ia])=>({name:ea,value:ia})),Fo=Po(io);function Po(ea){if(!ea||typeof ea!="object")return[];const ia=Array(Vo.length);for(let[Jo,sa]of Object.entries(ea)){const Ea=Vo.find(ya=>ya.name===Jo),pa=Vo.indexOf(Ea);ia[pa]=pa!==-1?sa:!0}return ia}function Ro(){eo(23,Vo=[...Vo,{name:"",value:""}]),eo(24,Fo=[...Fo,!0]),qo()}function Do(ea){Vo.splice(ea,1),Fo.splice(ea,1),qo()}function qo(){eo(23,Vo);const ea={};for(let ia=0;ia<Vo.length;ia++){const Jo=Vo[ia].name;Jo&&(ea[Jo]=Fo[ia])}eo(27,io=ea),no("change",Vo)}const Uo=(ea,ia,Jo,sa)=>{eo(23,ia[Jo].name=sa.detail,Vo),qo()};function jo(ea,ia){to.$$.not_equal(ia.name,ea)&&(ia.name=ea,eo(23,Vo))}function Zo(ea,ia){to.$$.not_equal(ia.value,ea)&&(ia.value=ea,eo(23,Vo))}const Qo=(ea,ia,Jo,sa)=>{eo(23,ia[Jo].value=sa.detail,Vo),qo()};function Yo(ea,ia){to.$$.not_equal(ia.value,ea)&&(ia.value=ea,eo(23,Vo))}function Xo(ea,ia){to.$$.not_equal(Fo[ia],ea)&&(Fo[ia]=ea,eo(24,Fo))}const Ko=ea=>Do(ea),ra=(ea,ia)=>ea.onClick(ia);return to.$$set=ea=>{"defaults"in ea&&eo(28,ro=ea.defaults),"object"in ea&&eo(0,oo=ea.object),"activity"in ea&&eo(27,io=ea.activity),"readOnly"in ea&&eo(1,ao=ea.readOnly),"noAddButton"in ea&&eo(2,so=ea.noAddButton),"name"in ea&&eo(3,lo=ea.name),"headings"in ea&&eo(4,co=ea.headings),"options"in ea&&eo(5,uo=ea.options),"toggle"in ea&&eo(6,fo=ea.toggle),"keyPlaceholder"in ea&&eo(7,po=ea.keyPlaceholder),"valuePlaceholder"in ea&&eo(8,ho=ea.valuePlaceholder),"valueHeading"in ea&&eo(9,_o=ea.valueHeading),"keyHeading"in ea&&eo(10,go=ea.keyHeading),"tooltip"in ea&&eo(11,bo=ea.tooltip),"menuItems"in ea&&eo(12,vo=ea.menuItems),"showMenu"in ea&&eo(13,yo=ea.showMenu),"bindings"in ea&&eo(14,wo=ea.bindings),"bindingDrawerLeft"in ea&&eo(15,ko=ea.bindingDrawerLeft),"allowHelpers"in ea&&eo(16,So=ea.allowHelpers),"customButtonText"in ea&&eo(17,Eo=ea.customButtonText),"keyBindings"in ea&&eo(18,Io=ea.keyBindings),"allowJS"in ea&&eo(19,Ao=ea.allowJS),"actionButtonDisabled"in ea&&eo(20,To=ea.actionButtonDisabled),"compare"in ea&&eo(21,Mo=ea.compare)},to.$$.update=()=>{to.$$.dirty[0]&8388608&&eo(0,oo=Vo.reduce((ea,ia)=>({...ea,[ia.name]:ia.value}),{}))},[oo,ao,so,lo,co,uo,fo,po,ho,_o,go,bo,vo,yo,wo,ko,So,Eo,Io,Ao,To,Mo,Ro,Vo,Fo,Do,qo,io,ro,Uo,jo,Zo,Qo,Yo,Xo,Ko,ra]}class KeyValueBuilder extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$8H,create_fragment$8H,safe_not_equal,{defaults:28,object:0,activity:27,readOnly:1,noAddButton:2,name:3,headings:4,options:5,toggle:6,keyPlaceholder:7,valuePlaceholder:8,valueHeading:9,keyHeading:10,tooltip:11,menuItems:12,showMenu:13,bindings:14,bindingDrawerLeft:15,allowHelpers:16,customButtonText:17,keyBindings:18,allowJS:19,actionButtonDisabled:20,compare:21,addEntry:22},null,[-1,-1])}get addEntry(){return this.$$.ctx[22]}}const Object_svelte_svelte_type_style_lang="";function create_default_slot_1$3U(to){let ue;return{c(){ue=text(to[0])},m(eo,no){insert$1(eo,ue,no)},p(eo,no){no&1&&set_data(ue,eo[0])},d(eo){eo&&detach(ue)}}}function create_default_slot$5y(to){let ue;return{c(){ue=text("Add")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_fragment$8G(to){let ue,eo,no,ro,oo,io,ao;eo=new Label({props:{$$slots:{default:[create_default_slot_1$3U]},$$scope:{ctx:to}}}),ro=new Button({props:{secondary:!0,thin:!0,outline:!0,$$slots:{default:[create_default_slot$5y]},$$scope:{ctx:to}}}),ro.$on("click",function(){is_function(to[2].addEntry())&&to[2].addEntry().apply(this,arguments)});let so={defaults:to[1],noAddButton:!0};return io=new KeyValueBuilder({props:so}),to[3](io),io.$on("change",to[4]),io.$on("blur",to[5]),{c(){ue=element("div"),create_component(eo.$$.fragment),no=space$1(),create_component(ro.$$.fragment),oo=space$1(),create_component(io.$$.fragment),attr(ue,"class","form-row ssl svelte-13q83tn")},m(lo,co){insert$1(lo,ue,co),mount_component(eo,ue,null),append$2(ue,no),mount_component(ro,ue,null),insert$1(lo,oo,co),mount_component(io,lo,co),ao=!0},p(lo,[co]){to=lo;const uo={};co&65&&(uo.$$scope={dirty:co,ctx:to}),eo.$set(uo);const fo={};co&64&&(fo.$$scope={dirty:co,ctx:to}),ro.$set(fo);const po={};co&2&&(po.defaults=to[1]),io.$set(po)},i(lo){ao||(transition_in(eo.$$.fragment,lo),transition_in(ro.$$.fragment,lo),transition_in(io.$$.fragment,lo),ao=!0)},o(lo){transition_out(eo.$$.fragment,lo),transition_out(ro.$$.fragment,lo),transition_out(io.$$.fragment,lo),ao=!1},d(lo){lo&&(detach(ue),detach(oo)),destroy_component(eo),destroy_component(ro),to[3](null),destroy_component(io,lo)}}}function instance$8G(to,ue,eo){let{name:no}=ue,{value:ro}=ue,oo;function io(lo){binding_callbacks[lo?"unshift":"push"](()=>{oo=lo,eo(2,oo)})}function ao(lo){bubble.call(this,to,lo)}function so(lo){bubble.call(this,to,lo)}return to.$$set=lo=>{"name"in lo&&eo(0,no=lo.name),"value"in lo&&eo(1,ro=lo.value)},[no,ro,oo,io,ao,so]}let Object$1=class extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$8G,create_fragment$8G,safe_not_equal,{name:0,value:1})}};const Boolean_svelte_svelte_type_style_lang="";function create_default_slot$5x(to){let ue;return{c(){ue=text(to[1])},m(eo,no){insert$1(eo,ue,no)},p(eo,no){no&2&&set_data(ue,eo[1])},d(eo){eo&&detach(ue)}}}function create_fragment$8F(to){let ue,eo,no,ro,oo;return eo=new Label({props:{$$slots:{default:[create_default_slot$5x]},$$scope:{ctx:to}}}),ro=new Toggle({props:{text:"",value:to[0]}}),ro.$on("blur",to[2]),ro.$on("change",to[3]),{c(){ue=element("div"),create_component(eo.$$.fragment),no=space$1(),create_component(ro.$$.fragment),attr(ue,"class","form-row svelte-9sim75")},m(io,ao){insert$1(io,ue,ao),mount_component(eo,ue,null),append$2(ue,no),mount_component(ro,ue,null),oo=!0},p(io,[ao]){const so={};ao&18&&(so.$$scope={dirty:ao,ctx:io}),eo.$set(so);const lo={};ao&1&&(lo.value=io[0]),ro.$set(lo)},i(io){oo||(transition_in(eo.$$.fragment,io),transition_in(ro.$$.fragment,io),oo=!0)},o(io){transition_out(eo.$$.fragment,io),transition_out(ro.$$.fragment,io),oo=!1},d(io){io&&detach(ue),destroy_component(eo),destroy_component(ro)}}}function instance$8F(to,ue,eo){let{value:no}=ue,{name:ro}=ue;function oo(ao){bubble.call(this,to,ao)}function io(ao){bubble.call(this,to,ao)}return to.$$set=ao=>{"value"in ao&&eo(0,no=ao.value),"name"in ao&&eo(1,ro=ao.name)},[no,ro,oo,io]}let Boolean$1=class extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$8F,create_fragment$8F,safe_not_equal,{value:0,name:1})}};const LongForm_svelte_svelte_type_style_lang="";function create_default_slot$5w(to){let ue;return{c(){ue=text(to[1])},m(eo,no){insert$1(eo,ue,no)},p(eo,no){no&2&&set_data(ue,eo[1])},d(eo){eo&&detach(ue)}}}function create_fragment$8E(to){let ue,eo,no,ro,oo;return eo=new Label({props:{$$slots:{default:[create_default_slot$5w]},$$scope:{ctx:to}}}),ro=new TextArea_1({props:{type:to[0],value:to[2],error:to[3],placeholder:to[4]}}),ro.$on("blur",to[5]),ro.$on("change",to[6]),{c(){ue=element("div"),create_component(eo.$$.fragment),no=space$1(),create_component(ro.$$.fragment),attr(ue,"class","form-row svelte-9sim75")},m(io,ao){insert$1(io,ue,ao),mount_component(eo,ue,null),append$2(ue,no),mount_component(ro,ue,null),oo=!0},p(io,[ao]){const so={};ao&130&&(so.$$scope={dirty:ao,ctx:io}),eo.$set(so);const lo={};ao&1&&(lo.type=io[0]),ao&4&&(lo.value=io[2]),ao&8&&(lo.error=io[3]),ao&16&&(lo.placeholder=io[4]),ro.$set(lo)},i(io){oo||(transition_in(eo.$$.fragment,io),transition_in(ro.$$.fragment,io),oo=!0)},o(io){transition_out(eo.$$.fragment,io),transition_out(ro.$$.fragment,io),oo=!1},d(io){io&&detach(ue),destroy_component(eo),destroy_component(ro)}}}function instance$8E(to,ue,eo){let{type:no}=ue,{name:ro}=ue,{value:oo}=ue,{error:io}=ue,{placeholder:ao}=ue;function so(co){bubble.call(this,to,co)}function lo(co){bubble.call(this,to,co)}return to.$$set=co=>{"type"in co&&eo(0,no=co.type),"name"in co&&eo(1,ro=co.name),"value"in co&&eo(2,oo=co.value),"error"in co&&eo(3,io=co.error),"placeholder"in co&&eo(4,ao=co.placeholder)},[no,ro,oo,io,ao,so,lo]}class LongForm extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$8E,create_fragment$8E,safe_not_equal,{type:0,name:1,value:2,error:3,placeholder:4})}}function get_each_context$1D(to,ue,eo){const no=to.slice();return no[6]=ue[eo],no}function create_each_block$1D(to){let ue,eo;const no=[to[6]];function ro(...io){return to[4](to[6],...io)}let oo={};for(let io=0;io<no.length;io+=1)oo=assign$1(oo,no[io]);return ue=new ConfigInput({props:oo}),ue.$on("change",ro),{c(){create_component(ue.$$.fragment)},m(io,ao){mount_component(ue,io,ao),eo=!0},p(io,ao){to=io;const so=ao&1?get_spread_update(no,[get_spread_object(to[6])]):{};ue.$set(so)},i(io){eo||(transition_in(ue.$$.fragment,io),eo=!0)},o(io){transition_out(ue.$$.fragment,io),eo=!1},d(io){destroy_component(ue,io)}}}function create_default_slot_1$3T(to){let ue,eo,no=ensure_array_like(to[0]),ro=[];for(let io=0;io<no.length;io+=1)ro[io]=create_each_block$1D(get_each_context$1D(to,no,io));const oo=io=>transition_out(ro[io],1,1,()=>{ro[io]=null});return{c(){for(let io=0;io<ro.length;io+=1)ro[io].c();ue=empty$2()},m(io,ao){for(let so=0;so<ro.length;so+=1)ro[so]&&ro[so].m(io,ao);insert$1(io,ue,ao),eo=!0},p(io,ao){if(ao&9){no=ensure_array_like(io[0]);let so;for(so=0;so<no.length;so+=1){const lo=get_each_context$1D(io,no,so);ro[so]?(ro[so].p(lo,ao),transition_in(ro[so],1)):(ro[so]=create_each_block$1D(lo),ro[so].c(),transition_in(ro[so],1),ro[so].m(ue.parentNode,ue))}for(group_outros(),so=no.length;so<ro.length;so+=1)oo(so);check_outros()}},i(io){if(!eo){for(let ao=0;ao<no.length;ao+=1)transition_in(ro[ao]);eo=!0}},o(io){ro=ro.filter(Boolean);for(let ao=0;ao<ro.length;ao+=1)transition_out(ro[ao]);eo=!1},d(io){io&&detach(ue),destroy_each(ro,io)}}}function create_default_slot$5v(to){let ue,eo;return ue=new Layout$n({props:{gap:"S",$$slots:{default:[create_default_slot_1$3T]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&513&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_fragment$8D(to){var no;let ue,eo;return ue=new Accordion({props:{initialOpen:((no=to[2])==null?void 0:no.openByDefault)||Object.values(to[0]).some(func$K),header:to[1],$$slots:{default:[create_default_slot$5v]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(ro,oo){mount_component(ue,ro,oo),eo=!0},p(ro,[oo]){var ao;const io={};oo&5&&(io.initialOpen=((ao=ro[2])==null?void 0:ao.openByDefault)||Object.values(ro[0]).some(func$K)),oo&2&&(io.header=ro[1]),oo&513&&(io.$$scope={dirty:oo,ctx:ro}),ue.$set(io)},i(ro){eo||(transition_in(ue.$$.fragment,ro),eo=!0)},o(ro){transition_out(ue.$$.fragment,ro),eo=!1},d(ro){destroy_component(ue,ro)}}}const func$K=to=>!!to.value;function instance$8D(to,ue,eo){let{value:no}=ue,{name:ro}=ue,{config:oo}=ue,io=createEventDispatcher();const ao=(lo,co)=>{const uo=no.map(fo=>({key:fo.key,value:fo.key===lo?co:fo.value}));io("change",uo)},so=(lo,co)=>ao(lo.key,co.detail);return to.$$set=lo=>{"value"in lo&&eo(0,no=lo.value),"name"in lo&&eo(1,ro=lo.name),"config"in lo&&eo(2,oo=lo.config)},[no,ro,oo,ao,so]}class FieldGroup extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$8D,create_fragment$8D,safe_not_equal,{value:0,name:1,config:2})}}const String_svelte_svelte_type_style_lang="";function create_default_slot$5u(to){let ue;return{c(){ue=text(to[1])},m(eo,no){insert$1(eo,ue,no)},p(eo,no){no&2&&set_data(ue,eo[1])},d(eo){eo&&detach(ue)}}}function create_fragment$8C(to){let ue,eo,no,ro,oo;return eo=new Label({props:{$$slots:{default:[create_default_slot$5u]},$$scope:{ctx:to}}}),ro=new EnvDropdown_1({props:{type:to[0]==="port"?"string":to[0],value:to[2],error:to[3],placeholder:to[4],variables:to[7].variables,environmentVariablesEnabled:to[6].environmentVariablesEnabled,showModal:to[5],handleUpgradePanel:to[8]}}),ro.$on("change",to[9]),ro.$on("blur",to[10]),{c(){ue=element("div"),create_component(eo.$$.fragment),no=space$1(),create_component(ro.$$.fragment),attr(ue,"class","form-row svelte-9sim75")},m(io,ao){insert$1(io,ue,ao),mount_component(eo,ue,null),append$2(ue,no),mount_component(ro,ue,null),oo=!0},p(io,[ao]){const so={};ao&2050&&(so.$$scope={dirty:ao,ctx:io}),eo.$set(so);const lo={};ao&1&&(lo.type=io[0]==="port"?"string":io[0]),ao&4&&(lo.value=io[2]),ao&8&&(lo.error=io[3]),ao&16&&(lo.placeholder=io[4]),ao&128&&(lo.variables=io[7].variables),ao&64&&(lo.environmentVariablesEnabled=io[6].environmentVariablesEnabled),ao&32&&(lo.showModal=io[5]),ro.$set(lo)},i(io){oo||(transition_in(eo.$$.fragment,io),transition_in(ro.$$.fragment,io),oo=!0)},o(io){transition_out(eo.$$.fragment,io),transition_out(ro.$$.fragment,io),oo=!1},d(io){io&&detach(ue),destroy_component(eo),destroy_component(ro)}}}function instance$8C(to,ue,eo){let no,ro;component_subscribe(to,licensing,ho=>eo(6,no=ho)),component_subscribe(to,environment,ho=>eo(7,ro=ho));let{type:oo}=ue,{name:io}=ue,{value:ao}=ue,{error:so}=ue,{placeholder:lo}=ue,{showModal:co=()=>{}}=ue;async function uo(){await environment.upgradePanelOpened(),no.goToUpgradePage()}function fo(ho){bubble.call(this,to,ho)}function po(ho){bubble.call(this,to,ho)}return to.$$set=ho=>{"type"in ho&&eo(0,oo=ho.type),"name"in ho&&eo(1,io=ho.name),"value"in ho&&eo(2,ao=ho.value),"error"in ho&&eo(3,so=ho.error),"placeholder"in ho&&eo(4,lo=ho.placeholder),"showModal"in ho&&eo(5,co=ho.showModal)},[oo,io,ao,so,lo,co,no,ro,uo,fo,po]}let String$1=class extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$8C,create_fragment$8C,safe_not_equal,{type:0,name:1,value:2,error:3,placeholder:4,showModal:5})}};const Select_svelte_svelte_type_style_lang="";function create_default_slot$5t(to){let ue;return{c(){ue=text(to[1])},m(eo,no){insert$1(eo,ue,no)},p(eo,no){no&2&&set_data(ue,eo[1])},d(eo){eo&&detach(ue)}}}function create_fragment$8B(to){let ue,eo,no,ro,oo;return eo=new Label({props:{$$slots:{default:[create_default_slot$5t]},$$scope:{ctx:to}}}),ro=new Select_1$1({props:{options:to[4].options,type:to[0],value:to[2]||void 0,error:to[3],placeholder:to[5]}}),ro.$on("blur",to[6]),ro.$on("change",to[7]),{c(){ue=element("div"),create_component(eo.$$.fragment),no=space$1(),create_component(ro.$$.fragment),attr(ue,"class","form-row svelte-9sim75")},m(io,ao){insert$1(io,ue,ao),mount_component(eo,ue,null),append$2(ue,no),mount_component(ro,ue,null),oo=!0},p(io,[ao]){const so={};ao&258&&(so.$$scope={dirty:ao,ctx:io}),eo.$set(so);const lo={};ao&16&&(lo.options=io[4].options),ao&1&&(lo.type=io[0]),ao&4&&(lo.value=io[2]||void 0),ao&8&&(lo.error=io[3]),ao&32&&(lo.placeholder=io[5]),ro.$set(lo)},i(io){oo||(transition_in(eo.$$.fragment,io),transition_in(ro.$$.fragment,io),oo=!0)},o(io){transition_out(eo.$$.fragment,io),transition_out(ro.$$.fragment,io),oo=!1},d(io){io&&detach(ue),destroy_component(eo),destroy_component(ro)}}}function instance$8B(to,ue,eo){let{type:no}=ue,{name:ro}=ue,{value:oo}=ue,{error:io}=ue,{config:ao}=ue,{placeholder:so}=ue;function lo(uo){bubble.call(this,to,uo)}function co(uo){bubble.call(this,to,uo)}return to.$$set=uo=>{"type"in uo&&eo(0,no=uo.type),"name"in uo&&eo(1,ro=uo.name),"value"in uo&&eo(2,oo=uo.value),"error"in uo&&eo(3,io=uo.error),"config"in uo&&eo(4,ao=uo.config),"placeholder"in uo&&eo(5,so=uo.placeholder)},[no,ro,oo,io,ao,so,lo,co]}class Select_1 extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$8B,create_fragment$8B,safe_not_equal,{type:0,name:1,value:2,error:3,config:4,placeholder:5})}}function create_fragment$8A(to){let ue,eo,no;var ro=to[7];function oo(io,ao){return{props:{type:io[0],value:io[1],error:io[2],name:io[3],config:io[4],showModal:io[5],placeholder:io[6]}}}return ro&&(ue=construct_svelte_component(ro,oo(to)),ue.$on("blur",to[8]),ue.$on("change",to[9])),{c(){ue&&create_component(ue.$$.fragment),eo=empty$2()},m(io,ao){ue&&mount_component(ue,io,ao),insert$1(io,eo,ao),no=!0},p(io,[ao]){if(ao&128&&ro!==(ro=io[7])){if(ue){group_outros();const so=ue;transition_out(so.$$.fragment,1,0,()=>{destroy_component(so,1)}),check_outros()}ro?(ue=construct_svelte_component(ro,oo(io)),ue.$on("blur",io[8]),ue.$on("change",io[9]),create_component(ue.$$.fragment),transition_in(ue.$$.fragment,1),mount_component(ue,eo.parentNode,eo)):ue=null}else if(ro){const so={};ao&1&&(so.type=io[0]),ao&2&&(so.value=io[1]),ao&4&&(so.error=io[2]),ao&8&&(so.name=io[3]),ao&16&&(so.config=io[4]),ao&32&&(so.showModal=io[5]),ao&64&&(so.placeholder=io[6]),ue.$set(so)}},i(io){no||(ue&&transition_in(ue.$$.fragment,io),no=!0)},o(io){ue&&transition_out(ue.$$.fragment,io),no=!1},d(io){io&&detach(eo),ue&&destroy_component(ue,io)}}}function instance$8A(to,ue,eo){let no,{type:ro}=ue,{value:oo}=ue,{error:io}=ue,{name:ao}=ue,{config:so}=ue,{showModal:lo=()=>{}}=ue,{placeholder:co}=ue;const uo=ho=>ho==="object"?Object$1:ho==="boolean"?Boolean$1:ho==="longForm"?LongForm:ho==="fieldGroup"?FieldGroup:ho==="select"?Select_1:String$1;function fo(ho){bubble.call(this,to,ho)}function po(ho){bubble.call(this,to,ho)}return to.$$set=ho=>{"type"in ho&&eo(0,ro=ho.type),"value"in ho&&eo(1,oo=ho.value),"error"in ho&&eo(2,io=ho.error),"name"in ho&&eo(3,ao=ho.name),"config"in ho&&eo(4,so=ho.config),"showModal"in ho&&eo(5,lo=ho.showModal),"placeholder"in ho&&eo(6,co=ho.placeholder)},to.$$.update=()=>{to.$$.dirty&1&&eo(7,no=uo(ro))},[ro,oo,io,ao,so,lo,co,no,fo,po]}class ConfigInput extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$8A,create_fragment$8A,safe_not_equal,{type:0,value:1,error:2,name:3,config:4,showModal:5,placeholder:6})}}const toString$2=Object.prototype.toString,errorToString=Error.prototype.toString,regExpToString=RegExp.prototype.toString,symbolToString=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",SYMBOL_REGEXP=/^Symbol\((.*)\)(.*)$/;function printNumber(to){return to!=+to?"NaN":to===0&&1/to<0?"-0":""+to}function printSimpleValue(to,ue=!1){if(to==null||to===!0||to===!1)return""+to;const eo=typeof to;if(eo==="number")return printNumber(to);if(eo==="string")return ue?`"${to}"`:to;if(eo==="function")return"[Function "+(to.name||"anonymous")+"]";if(eo==="symbol")return symbolToString.call(to).replace(SYMBOL_REGEXP,"Symbol($1)");const no=toString$2.call(to).slice(8,-1);return no==="Date"?isNaN(to.getTime())?""+to:to.toISOString(to):no==="Error"||to instanceof Error?"["+errorToString.call(to)+"]":no==="RegExp"?regExpToString.call(to):null}function printValue(to,ue){let eo=printSimpleValue(to,ue);return eo!==null?eo:JSON.stringify(to,function(no,ro){let oo=printSimpleValue(this[no],ue);return oo!==null?oo:ro},2)}let mixed={default:"${path} is invalid",required:"${path} is a required field",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:to,type:ue,value:eo,originalValue:no})=>{let ro=no!=null&&no!==eo,oo=`${to} must be a \`${ue}\` type, but the final value was: \`${printValue(eo,!0)}\``+(ro?` (cast from the value \`${printValue(no,!0)}\`).`:".");return eo===null&&(oo+='\n If "null" is intended as an empty value be sure to mark the schema as `.nullable()`'),oo},defined:"${path} must be defined"},string={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},number={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},date={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},boolean={isValue:"${path} field must be ${value}"},object={noUnknown:"${path} field has unspecified keys: ${unknown}"},array$1={min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"};Object.assign(Object.create(null),{mixed,string,number,date,object,array:array$1,boolean});const isSchema=to=>to&&to.__isYupSchema__;class Condition{constructor(ue,eo){if(this.fn=void 0,this.refs=ue,this.refs=ue,typeof eo=="function"){this.fn=eo;return}if(!has$7(eo,"is"))throw new TypeError("`is:` is required for `when()` conditions");if(!eo.then&&!eo.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:no,then:ro,otherwise:oo}=eo,io=typeof no=="function"?no:(...ao)=>ao.every(so=>so===no);this.fn=function(...ao){let so=ao.pop(),lo=ao.pop(),co=io(...ao)?ro:oo;if(co)return typeof co=="function"?co(lo):lo.concat(co.resolve(so))}}resolve(ue,eo){let no=this.refs.map(oo=>oo.getValue(eo==null?void 0:eo.value,eo==null?void 0:eo.parent,eo==null?void 0:eo.context)),ro=this.fn.apply(ue,no.concat(ue,eo));if(ro===void 0||ro===ue)return ue;if(!isSchema(ro))throw new TypeError("conditions must return a schema object");return ro.resolve(eo)}}function toArray$1(to){return to==null?[]:[].concat(to)}function _extends$3(){return _extends$3=Object.assign||function(to){for(var ue=1;ue<arguments.length;ue++){var eo=arguments[ue];for(var no in eo)Object.prototype.hasOwnProperty.call(eo,no)&&(to[no]=eo[no])}return to},_extends$3.apply(this,arguments)}let strReg=/\$\{\s*(\w+)\s*\}/g;class ValidationError extends Error{static formatError(ue,eo){const no=eo.label||eo.path||"this";return no!==eo.path&&(eo=_extends$3({},eo,{path:no})),typeof ue=="string"?ue.replace(strReg,(ro,oo)=>printValue(eo[oo])):typeof ue=="function"?ue(eo):ue}static isError(ue){return ue&&ue.name==="ValidationError"}constructor(ue,eo,no,ro){super(),this.value=void 0,this.path=void 0,this.type=void 0,this.errors=void 0,this.params=void 0,this.inner=void 0,this.name="ValidationError",this.value=eo,this.path=no,this.type=ro,this.errors=[],this.inner=[],toArray$1(ue).forEach(oo=>{ValidationError.isError(oo)?(this.errors.push(...oo.errors),this.inner=this.inner.concat(oo.inner.length?oo.inner:oo)):this.errors.push(oo)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0],Error.captureStackTrace&&Error.captureStackTrace(this,ValidationError)}}const once=to=>{let ue=!1;return(...eo)=>{ue||(ue=!0,to(...eo))}};function runTests(to,ue){let{endEarly:eo,tests:no,args:ro,value:oo,errors:io,sort:ao,path:so}=to,lo=once(ue),co=no.length;const uo=[];if(io=io||[],!co)return io.length?lo(new ValidationError(io,oo,so)):lo(null,oo);for(let fo=0;fo<no.length;fo++){const po=no[fo];po(ro,function(_o){if(_o){if(!ValidationError.isError(_o))return lo(_o,oo);if(eo)return _o.value=oo,lo(_o,oo);uo.push(_o)}if(--co<=0){if(uo.length&&(ao&&uo.sort(ao),io.length&&uo.push(...io),io=uo),io.length){lo(new ValidationError(io,oo,so),oo);return}lo(null,oo)}})}}const prefixes$1={context:"$",value:"."};class Reference{constructor(ue,eo={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof ue!="string")throw new TypeError("ref must be a string, got: "+ue);if(this.key=ue.trim(),ue==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===prefixes$1.context,this.isValue=this.key[0]===prefixes$1.value,this.isSibling=!this.isContext&&!this.isValue;let no=this.isContext?prefixes$1.context:this.isValue?prefixes$1.value:"";this.path=this.key.slice(no.length),this.getter=this.path&&propertyExpr.getter(this.path,!0),this.map=eo.map}getValue(ue,eo,no){let ro=this.isContext?no:this.isValue?ue:eo;return this.getter&&(ro=this.getter(ro||{})),this.map&&(ro=this.map(ro)),ro}cast(ue,eo){return this.getValue(ue,eo==null?void 0:eo.parent,eo==null?void 0:eo.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(ue){return ue&&ue.__isYupRef}}Reference.prototype.__isYupRef=!0;function _extends$2(){return _extends$2=Object.assign||function(to){for(var ue=1;ue<arguments.length;ue++){var eo=arguments[ue];for(var no in eo)Object.prototype.hasOwnProperty.call(eo,no)&&(to[no]=eo[no])}return to},_extends$2.apply(this,arguments)}function _objectWithoutPropertiesLoose(to,ue){if(to==null)return{};var eo={},no=Object.keys(to),ro,oo;for(oo=0;oo<no.length;oo++)ro=no[oo],!(ue.indexOf(ro)>=0)&&(eo[ro]=to[ro]);return eo}function createValidation(to){function ue(eo,no){let{value:ro,path:oo="",label:io,options:ao,originalValue:so,sync:lo}=eo,co=_objectWithoutPropertiesLoose(eo,["value","path","label","options","originalValue","sync"]);const{name:uo,test:fo,params:po,message:ho}=to;let{parent:_o,context:go}=ao;function bo(So){return Reference.isRef(So)?So.getValue(ro,_o,go):So}function vo(So={}){const Eo=mapValues$2(_extends$2({value:ro,originalValue:so,label:io,path:So.path||oo},po,So.params),bo),Io=new ValidationError(ValidationError.formatError(So.message||ho,Eo),ro,Eo.path,So.type||uo);return Io.params=Eo,Io}let yo=_extends$2({path:oo,parent:_o,type:uo,createError:vo,resolve:bo,options:ao,originalValue:so},co);if(!lo){try{Promise.resolve(fo.call(yo,ro,yo)).then(So=>{ValidationError.isError(So)?no(So):So?no(null,So):no(vo())}).catch(no)}catch(So){no(So)}return}let wo;try{var ko;if(wo=fo.call(yo,ro,yo),typeof((ko=wo)==null?void 0:ko.then)=="function")throw new Error(`Validation test of type: "${yo.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`)}catch(So){no(So);return}ValidationError.isError(wo)?no(wo):wo?no(null,wo):no(vo())}return ue.OPTIONS=to,ue}let trim=to=>to.substr(0,to.length-1).substr(1);function getIn(to,ue,eo,no=eo){let ro,oo,io;return ue?(propertyExpr.forEach(ue,(ao,so,lo)=>{let co=so?trim(ao):ao;if(to=to.resolve({context:no,parent:ro,value:eo}),to.innerType){let uo=lo?parseInt(co,10):0;if(eo&&uo>=eo.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${ao}, in the path: ${ue}. because there is no value at that index. `);ro=eo,eo=eo&&eo[uo],to=to.innerType}if(!lo){if(!to.fields||!to.fields[co])throw new Error(`The schema does not contain the path: ${ue}. (failed at: ${io} which is a type: "${to._type}")`);ro=eo,eo=eo&&eo[co],to=to.fields[co]}oo=co,io=so?"["+ao+"]":"."+ao}),{schema:to,parent:ro,parentPath:oo}):{parent:ro,parentPath:ue,schema:to}}class ReferenceSet{constructor(){this.list=void 0,this.refs=void 0,this.list=new Set,this.refs=new Map}get size(){return this.list.size+this.refs.size}describe(){const ue=[];for(const eo of this.list)ue.push(eo);for(const[,eo]of this.refs)ue.push(eo.describe());return ue}toArray(){return Array.from(this.list).concat(Array.from(this.refs.values()))}resolveAll(ue){return this.toArray().reduce((eo,no)=>eo.concat(Reference.isRef(no)?ue(no):no),[])}add(ue){Reference.isRef(ue)?this.refs.set(ue.key,ue):this.list.add(ue)}delete(ue){Reference.isRef(ue)?this.refs.delete(ue.key):this.list.delete(ue)}clone(){const ue=new ReferenceSet;return ue.list=new Set(this.list),ue.refs=new Map(this.refs),ue}merge(ue,eo){const no=this.clone();return ue.list.forEach(ro=>no.add(ro)),ue.refs.forEach(ro=>no.add(ro)),eo.list.forEach(ro=>no.delete(ro)),eo.refs.forEach(ro=>no.delete(ro)),no}}function _extends$1(){return _extends$1=Object.assign||function(to){for(var ue=1;ue<arguments.length;ue++){var eo=arguments[ue];for(var no in eo)Object.prototype.hasOwnProperty.call(eo,no)&&(to[no]=eo[no])}return to},_extends$1.apply(this,arguments)}class BaseSchema{constructor(ue){this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this._typeError=void 0,this._whitelist=new ReferenceSet,this._blacklist=new ReferenceSet,this.exclusiveTests=Object.create(null),this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(mixed.notType)}),this.type=(ue==null?void 0:ue.type)||"mixed",this.spec=_extends$1({strip:!1,strict:!1,abortEarly:!0,recursive:!0,nullable:!1,presence:"optional"},ue==null?void 0:ue.spec)}get _type(){return this.type}_typeCheck(ue){return!0}clone(ue){if(this._mutate)return ue&&Object.assign(this.spec,ue),this;const eo=Object.create(Object.getPrototypeOf(this));return eo.type=this.type,eo._typeError=this._typeError,eo._whitelistError=this._whitelistError,eo._blacklistError=this._blacklistError,eo._whitelist=this._whitelist.clone(),eo._blacklist=this._blacklist.clone(),eo.exclusiveTests=_extends$1({},this.exclusiveTests),eo.deps=[...this.deps],eo.conditions=[...this.conditions],eo.tests=[...this.tests],eo.transforms=[...this.transforms],eo.spec=clone$3(_extends$1({},this.spec,ue)),eo}label(ue){let eo=this.clone();return eo.spec.label=ue,eo}meta(...ue){if(ue.length===0)return this.spec.meta;let eo=this.clone();return eo.spec.meta=Object.assign(eo.spec.meta||{},ue[0]),eo}withMutation(ue){let eo=this._mutate;this._mutate=!0;let no=ue(this);return this._mutate=eo,no}concat(ue){if(!ue||ue===this)return this;if(ue.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${ue.type}`);let eo=this,no=ue.clone();const ro=_extends$1({},eo.spec,no.spec);return no.spec=ro,no._typeError||(no._typeError=eo._typeError),no._whitelistError||(no._whitelistError=eo._whitelistError),no._blacklistError||(no._blacklistError=eo._blacklistError),no._whitelist=eo._whitelist.merge(ue._whitelist,ue._blacklist),no._blacklist=eo._blacklist.merge(ue._blacklist,ue._whitelist),no.tests=eo.tests,no.exclusiveTests=eo.exclusiveTests,no.withMutation(oo=>{ue.tests.forEach(io=>{oo.test(io.OPTIONS)})}),no.transforms=[...eo.transforms,...no.transforms],no}isType(ue){return this.spec.nullable&&ue===null?!0:this._typeCheck(ue)}resolve(ue){let eo=this;if(eo.conditions.length){let no=eo.conditions;eo=eo.clone(),eo.conditions=[],eo=no.reduce((ro,oo)=>oo.resolve(ro,ue),eo),eo=eo.resolve(ue)}return eo}cast(ue,eo={}){let no=this.resolve(_extends$1({value:ue},eo)),ro=no._cast(ue,eo);if(ue!==void 0&&eo.assert!==!1&&no.isType(ro)!==!0){let oo=printValue(ue),io=printValue(ro);throw new TypeError(`The value of ${eo.path||"field"} could not be cast to a value that satisfies the schema type: "${no._type}".
|
|
890
890
|
|
|
@@ -1683,7 +1683,7 @@ ${to.map(oo=>{let io=ro[oo];return io=typeof io=="object"&&!(io instanceof Date)
|
|
|
1683
1683
|
Use the toggle to enable/disable row actions for this view.
|
|
1684
1684
|
`),no=element("br")},m(ro,oo){insert$1(ro,ue,oo),insert$1(ro,eo,oo),insert$1(ro,no,oo)},d(ro){ro&&(detach(ue),detach(eo),detach(no))}}}function create_else_block$1b(to){let ue,eo;return ue=new List$2({props:{$$slots:{default:[create_default_slot_5$15]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&536871182&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block$35(to){let ue,eo;return{c(){ue=element("br"),eo=text(`
|
|
1685
1685
|
You haven't created any row actions.`)},m(no,ro){insert$1(no,ue,ro),insert$1(no,eo,ro)},p:noop$6,i:noop$6,o:noop$6,d(no){no&&(detach(ue),detach(eo))}}}function create_if_block_1$1A(to){var oo;let ue,eo,no;function ro(...io){return to[19](to[26],...io)}return eo=new Toggle({props:{value:(oo=to[26].allowedSources)==null?void 0:oo.includes(to[1])}}),eo.$on("change",ro),{c(){ue=element("span"),create_component(eo.$$.fragment),attr(ue,"class","svelte-1xmpyu1")},m(io,ao){insert$1(io,ue,ao),mount_component(eo,ue,null),no=!0},p(io,ao){var lo;to=io;const so={};ao&6&&(so.value=(lo=to[26].allowedSources)==null?void 0:lo.includes(to[1])),eo.$set(so)},i(io){no||(transition_in(eo.$$.fragment,io),no=!0)},o(io){transition_out(eo.$$.fragment,io),no=!1},d(io){io&&detach(ue),destroy_component(eo)}}}function create_right_slot$2(to){let ue,eo,no=to[3]&&create_if_block_1$1A(to);return{c(){no&&no.c(),ue=space$1()},m(ro,oo){no&&no.m(ro,oo),insert$1(ro,ue,oo),eo=!0},p(ro,oo){ro[3]?no?(no.p(ro,oo),oo&8&&transition_in(no,1)):(no=create_if_block_1$1A(ro),no.c(),transition_in(no,1),no.m(ue.parentNode,ue)):no&&(group_outros(),transition_out(no,1,1,()=>{no=null}),check_outros())},i(ro){eo||(transition_in(no),eo=!0)},o(ro){transition_out(no),eo=!1},d(ro){ro&&detach(ue),no&&no.d(ro)}}}function create_each_block$1h(to){let ue,eo;return ue=new ListItem({props:{title:to[26].name,url:to[8](to[26]),showArrow:!0,$$slots:{right:[create_right_slot$2]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&4&&(oo.title=no[26].name),ro&260&&(oo.url=no[8](no[26])),ro&536870926&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot_5$15(to){let ue,eo,no=ensure_array_like(to[2]),ro=[];for(let io=0;io<no.length;io+=1)ro[io]=create_each_block$1h(get_each_context$1h(to,no,io));const oo=io=>transition_out(ro[io],1,1,()=>{ro[io]=null});return{c(){for(let io=0;io<ro.length;io+=1)ro[io].c();ue=empty$2()},m(io,ao){for(let so=0;so<ro.length;so+=1)ro[so]&&ro[so].m(io,ao);insert$1(io,ue,ao),eo=!0},p(io,ao){if(ao&2318){no=ensure_array_like(io[2]);let so;for(so=0;so<no.length;so+=1){const lo=get_each_context$1h(io,no,so);ro[so]?(ro[so].p(lo,ao),transition_in(ro[so],1)):(ro[so]=create_each_block$1h(lo),ro[so].c(),transition_in(ro[so],1),ro[so].m(ue.parentNode,ue))}for(group_outros(),so=no.length;so<ro.length;so+=1)oo(so);check_outros()}},i(io){if(!eo){for(let ao=0;ao<no.length;ao+=1)transition_in(ro[ao]);eo=!0}},o(io){ro=ro.filter(Boolean);for(let ao=0;ao<ro.length;ao+=1)transition_out(ro[ao]);eo=!1},d(io){io&&detach(ue),destroy_each(ro,io)}}}function create_default_slot_4$1o(to){let ue;return{c(){ue=text("Create row action")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_3$1R(to){let ue,eo,no,ro,oo,io,ao,so,lo=to[3]&&rowActions.length&&create_if_block_2$12();const co=[create_if_block$35,create_else_block$1b],uo=[];function fo(po,ho){return po[2].length?1:0}return no=fo(to),ro=uo[no]=co[no](to),ao=new Button({props:{secondary:!0,icon:"Engagement",$$slots:{default:[create_default_slot_4$1o]},$$scope:{ctx:to}}}),ao.$on("click",to[12]),{c(){ue=text(`A row action is a user-triggered automation for a chosen row.
|
|
1686
|
-
`),lo&&lo.c(),eo=space$1(),ro.c(),oo=space$1(),io=element("div"),create_component(ao.$$.fragment)},m(po,ho){insert$1(po,ue,ho),lo&&lo.m(po,ho),insert$1(po,eo,ho),uo[no].m(po,ho),insert$1(po,oo,ho),insert$1(po,io,ho),mount_component(ao,io,null),so=!0},p(po,ho){po[3]&&rowActions.length?lo||(lo=create_if_block_2$12(),lo.c(),lo.m(eo.parentNode,eo)):lo&&(lo.d(1),lo=null);let _o=no;no=fo(po),no===_o?uo[no].p(po,ho):(group_outros(),transition_out(uo[_o],1,1,()=>{uo[_o]=null}),check_outros(),ro=uo[no],ro?ro.p(po,ho):(ro=uo[no]=co[no](po),ro.c()),transition_in(ro,1),ro.m(oo.parentNode,oo));const go={};ho&536870912&&(go.$$scope={dirty:ho,ctx:po}),ao.$set(go)},i(po){so||(transition_in(ro),transition_in(ao.$$.fragment,po),so=!0)},o(po){transition_out(ro),transition_out(ao.$$.fragment,po),so=!1},d(po){po&&(detach(ue),detach(eo),detach(oo),detach(io)),lo&&lo.d(po),uo[no].d(po),destroy_component(ao)}}}function create_default_slot_2$2g(to){let ue,eo=to[7]?`: ${to[7]}`:"",no;return{c(){ue=text("Row actions"),no=text(eo)},m(ro,oo){insert$1(ro,ue,oo),insert$1(ro,no,oo)},p(ro,oo){oo&128&&eo!==(eo=ro[7]?`: ${ro[7]}`:"")&&set_data(no,eo)},d(ro){ro&&(detach(ue),detach(no))}}}function create_anchor_slot$5(to){let ue,eo;return ue=new ActionButton({props:{icon:"Engagement",selected:to[25]||to[7],quiet:!0,accentColor:"#A24400",$$slots:{default:[create_default_slot_2$2g]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&33554560&&(oo.selected=no[25]||no[7]),ro&536871040&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot_1$36(to){let ue,eo,no;function ro(io){to[21](io)}let oo={label:"Name",error:to[6]&&!to[24]?"A row action with this name already exists":null};return to[0]!==void 0&&(oo.value=to[0]),ue=new Input$5({props:oo}),binding_callbacks.push(()=>bind$2(ue,"value",ro)),{c(){create_component(ue.$$.fragment)},m(io,ao){mount_component(ue,io,ao),no=!0},p(io,ao){const so={};ao&16777280&&(so.error=io[6]&&!io[24]?"A row action with this name already exists":null),!eo&&ao&1&&(eo=!0,so.value=io[0],add_flush_callback(()=>eo=!1)),ue.$set(so)},i(io){no||(transition_in(ue.$$.fragment,io),no=!0)},o(io){transition_out(ue.$$.fragment,io),no=!1},d(io){destroy_component(ue,io)}}}function create_default_slot$4e(to){let ue,eo;return ue=new ModalContent({props:{size:"S",title:"Create row action",confirmText:"Create",showCancelButton:!1,showDivider:!1,showCloseIcon:!1,disabled:!to[0]||to[6],onConfirm:to[13],$$slots:{default:[create_default_slot_1$36,({loading:no})=>({24:no}),({loading:no})=>no?16777216:0]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&65&&(oo.disabled=!no[0]||no[6]),ro&553648193&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_fragment$6l(to){let ue,eo,no,ro,oo={title:"Row actions",$$slots:{anchor:[create_anchor_slot$5,({open:ao})=>({25:ao}),({open:ao})=>ao?33554432:0],default:[create_default_slot_3$1R]},$$scope:{ctx:to}};ue=new DetailPopover({props:oo}),to[20](ue);let io={$$slots:{default:[create_default_slot$4e]},$$scope:{ctx:to}};return no=new Modal({props:io}),to[22](no),{c(){create_component(ue.$$.fragment),eo=space$1(),create_component(no.$$.fragment)},m(ao,so){mount_component(ue,ao,so),insert$1(ao,eo,so),mount_component(no,ao,so),ro=!0},p(ao,[so]){const lo={};so&570425742&&(lo.$$scope={dirty:so,ctx:ao}),ue.$set(lo);const co={};so&536870977&&(co.$$scope={dirty:so,ctx:ao}),no.$set(co)},i(ao){ro||(transition_in(ue.$$.fragment,ao),transition_in(no.$$.fragment,ao),ro=!0)},o(ao){transition_out(ue.$$.fragment,ao),transition_out(no.$$.fragment,ao),ro=!1},d(ao){ao&&detach(eo),to[20](null),destroy_component(ue,ao),to[22](null),destroy_component(no,ao)}}}function instance$6i(to,ue,eo){let no,ro,oo,io,ao,so,lo,co,uo,fo,po,ho;component_subscribe(to,goto,Mo=>eo(23,fo=Mo)),component_subscribe(to,rowActions,Mo=>eo(17,po=Mo));const{datasource:_o}=getContext$1("grid");component_subscribe(to,_o,Mo=>eo(18,ho=Mo));let go,bo,vo;const yo=derived([url$3,appStore],([Mo,Vo])=>({automationId:Fo})=>Mo(`/builder/app/${Vo.appId}/automation/${Fo}`));component_subscribe(to,yo,Mo=>eo(8,uo=Mo));const wo=async(Mo,Vo)=>{Vo?await rowActions.enableView(ro,Mo.id,oo):await rowActions.disableView(ro,Mo.id,oo)},ko=()=>{eo(0,vo=null),go.hide(),bo.show()},So=async()=>{try{const Mo=await rowActions.createRowAction(ro,oo,vo);notifications.success("Row action created successfully"),fo(uo(Mo))}catch(Mo){console.error(Mo),notifications.error("Error creating row action")}},Eo=(Mo,Vo)=>wo(Mo,Vo.detail);function Io(Mo){binding_callbacks[Mo?"unshift":"push"](()=>{go=Mo,eo(4,go)})}function Ao(Mo){vo=Mo,eo(0,vo)}function To(Mo){binding_callbacks[Mo?"unshift":"push"](()=>{bo=Mo,eo(5,bo)})}return to.$$.update=()=>{to.$$.dirty&262144&&eo(16,no=ho),to.$$.dirty&65536&&eo(14,ro=no==null?void 0:no.tableId),to.$$.dirty&65536&&eo(1,oo=no==null?void 0:no.id),to.$$.dirty&65536&&eo(3,io=(no==null?void 0:no.type)==="viewV2"),to.$$.dirty&147456&&eo(2,ao=po[ro]||[]),to.$$.dirty&131074&&eo(15,so=po[oo]||[]),to.$$.dirty&32780&&eo(7,lo=io?so.length:ao.length),to.$$.dirty&5&&eo(6,co=vo&&ao.some(Mo=>Mo.name===vo))},[vo,oo,ao,io,go,bo,co,lo,uo,_o,yo,wo,ko,So,ro,so,no,po,ho,Eo,Io,Ao,To]}class GridRowActionsButton extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$6i,create_fragment$6l,safe_not_equal,{})}}const GridViewCalculationButton_svelte_svelte_type_style_lang="";function get_each_context$1g(to,ue,eo){const no=to.slice();return no[27]=ue[eo],no[28]=ue,no[29]=eo,no}function create_if_block$34(to){let ue,eo,no,ro,oo,io,ao,so,lo=ensure_array_like(to[2]),co=[];for(let ho=0;ho<lo.length;ho+=1)co[ho]=create_each_block$1g(get_each_context$1g(to,lo,ho));const uo=ho=>transition_out(co[ho],1,1,()=>{co[ho]=null});function fo(ho){to[18](ho)}let po={options:to[5],placeholder:"None"};return to[3]!==void 0&&(po.value=to[3]),io=new Multiselect_1({props:po}),binding_callbacks.push(()=>bind$2(io,"value",fo)),{c(){ue=element("div");for(let ho=0;ho<co.length;ho+=1)co[ho].c();eo=space$1(),no=element("span"),no.textContent="Group by",ro=space$1(),oo=element("div"),create_component(io.$$.fragment),attr(oo,"class","group-by svelte-1yp5un1"),attr(ue,"class","calculations svelte-1yp5un1")},m(ho,_o){insert$1(ho,ue,_o);for(let go=0;go<co.length;go+=1)co[go]&&co[go].m(ue,null);append$2(ue,eo),append$2(ue,no),append$2(ue,ro),append$2(ue,oo),mount_component(io,oo,null),so=!0},p(ho,_o){if(_o&5637){lo=ensure_array_like(ho[2]);let bo;for(bo=0;bo<lo.length;bo+=1){const vo=get_each_context$1g(ho,lo,bo);co[bo]?(co[bo].p(vo,_o),transition_in(co[bo],1)):(co[bo]=create_each_block$1g(vo),co[bo].c(),transition_in(co[bo],1),co[bo].m(ue,eo))}for(group_outros(),bo=lo.length;bo<co.length;bo+=1)uo(bo);check_outros()}const go={};_o&32&&(go.options=ho[5]),!ao&&_o&8&&(ao=!0,go.value=ho[3],add_flush_callback(()=>ao=!1)),io.$set(go)},i(ho){if(!so){for(let _o=0;_o<lo.length;_o+=1)transition_in(co[_o]);transition_in(io.$$.fragment,ho),so=!0}},o(ho){co=co.filter(Boolean);for(let _o=0;_o<co.length;_o+=1)transition_out(co[_o]);transition_out(io.$$.fragment,ho),so=!1},d(ho){ho&&detach(ue),destroy_each(co,ho),destroy_component(io)}}}function create_each_block$1g(to){let ue,eo,no,ro,oo,io,ao,so,lo,co,uo,fo;function po(vo){to[15](vo,to[27])}let ho={options:to[9](to[27],to[2]),placeholder:!1};to[27].type!==void 0&&(ho.value=to[27].type),no=new Select_1$1({props:ho}),binding_callbacks.push(()=>bind$2(no,"value",po));function _o(vo){to[16](vo,to[27])}let go={options:to[10](to[27],to[2],to[0]),placeholder:"Column"};to[27].field!==void 0&&(go.value=to[27].field),so=new Select_1$1({props:go}),binding_callbacks.push(()=>bind$2(so,"value",_o));function bo(){return to[17](to[29])}return uo=new Icon({props:{hoverable:!0,name:"Delete",size:"S",color:"var(--spectrum-global-color-gray-700)"}}),uo.$on("click",bo),{c(){ue=element("span"),ue.textContent=`${to[29]===0?"Calculate":"and"} the`,eo=space$1(),create_component(no.$$.fragment),oo=space$1(),io=element("span"),io.textContent="of",ao=space$1(),create_component(so.$$.fragment),co=space$1(),create_component(uo.$$.fragment)},m(vo,yo){insert$1(vo,ue,yo),insert$1(vo,eo,yo),mount_component(no,vo,yo),insert$1(vo,oo,yo),insert$1(vo,io,yo),insert$1(vo,ao,yo),mount_component(so,vo,yo),insert$1(vo,co,yo),mount_component(uo,vo,yo),fo=!0},p(vo,yo){to=vo;const wo={};yo&4&&(wo.options=to[9](to[27],to[2])),!ro&&yo&4&&(ro=!0,wo.value=to[27].type,add_flush_callback(()=>ro=!1)),no.$set(wo);const ko={};yo&5&&(ko.options=to[10](to[27],to[2],to[0])),!lo&&yo&4&&(lo=!0,ko.value=to[27].field,add_flush_callback(()=>lo=!1)),so.$set(ko)},i(vo){fo||(transition_in(no.$$.fragment,vo),transition_in(so.$$.fragment,vo),transition_in(uo.$$.fragment,vo),fo=!0)},o(vo){transition_out(no.$$.fragment,vo),transition_out(so.$$.fragment,vo),transition_out(uo.$$.fragment,vo),fo=!1},d(vo){vo&&(detach(ue),detach(eo),detach(oo),detach(io),detach(ao),detach(co)),destroy_component(no,vo),destroy_component(so,vo),destroy_component(uo,vo)}}}function create_default_slot_3$1Q(to){let ue;return{c(){ue=text("Add calculation")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_2$2f(to){let ue;return{c(){ue=text("Save")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_1$35(to){let ue,eo,no,ro,oo,io,ao,so,lo,co=to[2].length&&create_if_block$34(to);return no=new ActionButton({props:{quiet:!0,icon:"Add",disabled:to[2].length>=5,$$slots:{default:[create_default_slot_3$1Q]},$$scope:{ctx:to}}}),no.$on("click",to[11]),oo=new InfoDisplay({props:{icon:"Help",quiet:!0,body:"Most calculations only work with numeric columns and a maximum of 5 calculations can be added at once."}}),so=new Button({props:{cta:!0,disabled:to[4],$$slots:{default:[create_default_slot_2$2f]},$$scope:{ctx:to}}}),so.$on("click",to[13]),{c(){co&&co.c(),ue=space$1(),eo=element("div"),create_component(no.$$.fragment),ro=space$1(),create_component(oo.$$.fragment),io=space$1(),ao=element("div"),create_component(so.$$.fragment),attr(eo,"class","buttons svelte-1yp5un1")},m(uo,fo){co&&co.m(uo,fo),insert$1(uo,ue,fo),insert$1(uo,eo,fo),mount_component(no,eo,null),insert$1(uo,ro,fo),mount_component(oo,uo,fo),insert$1(uo,io,fo),insert$1(uo,ao,fo),mount_component(so,ao,null),lo=!0},p(uo,fo){uo[2].length?co?(co.p(uo,fo),fo&4&&transition_in(co,1)):(co=create_if_block$34(uo),co.c(),transition_in(co,1),co.m(ue.parentNode,ue)):co&&(group_outros(),transition_out(co,1,1,()=>{co=null}),check_outros());const po={};fo&4&&(po.disabled=uo[2].length>=5),fo&1073741824&&(po.$$scope={dirty:fo,ctx:uo}),no.$set(po);const ho={};fo&16&&(ho.disabled=uo[4]),fo&1073741824&&(ho.$$scope={dirty:fo,ctx:uo}),so.$set(ho)},i(uo){lo||(transition_in(co),transition_in(no.$$.fragment,uo),transition_in(oo.$$.fragment,uo),transition_in(so.$$.fragment,uo),lo=!0)},o(uo){transition_out(co),transition_out(no.$$.fragment,uo),transition_out(oo.$$.fragment,uo),transition_out(so.$$.fragment,uo),lo=!1},d(uo){uo&&(detach(ue),detach(eo),detach(ro),detach(io),detach(ao)),co&&co.d(uo),destroy_component(no),destroy_component(oo,uo),destroy_component(so)}}}function create_default_slot$4d(to){let ue,eo=to[6]?`: ${to[6]}`:"",no;return{c(){ue=text("Configure calculations"),no=text(eo)},m(ro,oo){insert$1(ro,ue,oo),insert$1(ro,no,oo)},p(ro,oo){oo&64&&eo!==(eo=ro[6]?`: ${ro[6]}`:"")&&set_data(no,eo)},d(ro){ro&&(detach(ue),detach(no))}}}function create_anchor_slot$4(to){let ue,eo;return ue=new ActionButton({props:{icon:"WebPage",quiet:!0,selected:to[26],$$slots:{default:[create_default_slot$4d]},$$scope:{ctx:to}}}),ue.$on("click",to[8]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&67108864&&(oo.selected=no[26]),ro&1073741888&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_fragment$6k(to){let ue,eo,no={title:"Configure calculations",width:480,$$slots:{anchor:[create_anchor_slot$4,({open:ro})=>({26:ro}),({open:ro})=>ro?67108864:0],default:[create_default_slot_1$35]},$$scope:{ctx:to}};return ue=new DetailPopover({props:no}),to[19](ue),{c(){create_component(ue.$$.fragment)},m(ro,oo){mount_component(ue,ro,oo),eo=!0},p(ro,[oo]){const io={};oo&1140850813&&(io.$$scope={dirty:oo,ctx:ro}),ue.$set(io)},i(ro){eo||(transition_in(ue.$$.fragment,ro),eo=!0)},o(ro){transition_out(ue.$$.fragment,ro),eo=!1},d(ro){to[19](null),destroy_component(ue,ro)}}}function instance$6h(to,ue,eo){let no,ro,oo;const{definition:io,datasource:ao,rows:so}=getContext$1("grid");component_subscribe(to,io,Fo=>eo(14,oo=Fo));const lo=[{label:"Average",value:CalculationType.AVG},{label:"Sum",value:CalculationType.SUM},{label:"Minimum",value:CalculationType.MIN},{label:"Maximum",value:CalculationType.MAX},{label:"Count",value:CalculationType.COUNT}];let co,uo=[],fo=[],po={},ho=!1;const _o=()=>{eo(2,uo=go(po)),eo(3,fo=uo.length?bo(po):[]),co==null||co.show()},go=Fo=>Fo?Object.keys(Fo).filter(Po=>Fo[Po].calculationType!=null).map(Po=>({type:Fo[Po].calculationType,field:Fo[Po].field})):[],bo=Fo=>Fo?Object.keys(Fo).filter(Po=>Fo[Po].calculationType==null&&Fo[Po].visible):[],vo=(Fo,Po)=>lo.filter(Ro=>!Po.some(Do=>Do!==Fo&&Do.field===Fo.field&&Do.type===Ro.value)),yo=(Fo,Po,Ro)=>Object.entries(Ro).filter(([Do,qo])=>qo.calculationType||Fo.type!==CalculationType.COUNT&&!isNumeric$1(qo.type)?!1:!Po.some(Uo=>Uo!==Fo&&Uo.type===Fo.type&&Uo.field===Do)).map(([Do])=>Do),wo=Fo=>Object.entries(Fo).filter(([Po,Ro])=>Ro.calculationType?!1:canGroupBy(Ro.type)).map(([Po])=>Po),ko=()=>{eo(2,uo=[...uo,{type:CalculationType.AVG}])},So=Fo=>{eo(2,uo=uo.toSpliced(Fo,1)),uo.length||eo(3,fo=[])},Eo=async()=>{var Ro;let Fo={};eo(4,ho=!0);for(let Do of uo){if(!Do.type||!Do.field)continue;const Uo=`${lo.find(jo=>jo.value===Do.type).label} ${Do.field}`;Fo[Uo]={calculationType:Do.type,field:Do.field,visible:!0}}for(let Do of Object.keys(po))po[Do].calculationType||(Fo[Do]={...po[Do],visible:fo.includes(Do)});let Po=oo.primaryDisplay;(!Po||!((Ro=Fo[Po])!=null&&Ro.visible))&&(Po=fo[0]);try{await ao.actions.saveDefinition({...oo,primaryDisplay:Po,schema:Fo}),await so.actions.refreshData()}finally{eo(4,ho=!1),co.hide()}};function Io(Fo,Po){to.$$.not_equal(Po.type,Fo)&&(Po.type=Fo,eo(2,uo))}function Ao(Fo,Po){to.$$.not_equal(Po.field,Fo)&&(Po.field=Fo,eo(2,uo))}const To=Fo=>So(Fo);function Mo(Fo){fo=Fo,eo(3,fo)}function Vo(Fo){binding_callbacks[Fo?"unshift":"push"](()=>{co=Fo,eo(1,co)})}return to.$$.update=()=>{to.$$.dirty&16384&&eo(0,po=(oo==null?void 0:oo.schema)||{}),to.$$.dirty&16384&&eo(6,no=go((oo==null?void 0:oo.schema)||{}).length),to.$$.dirty&1&&eo(5,ro=wo(po))},[po,co,uo,fo,ho,ro,no,io,_o,vo,yo,ko,So,Eo,oo,Io,Ao,To,Mo,Vo]}class GridViewCalculationButton extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$6h,create_fragment$6k,safe_not_equal,{})}}function create_default_slot$4c(to){let ue,eo;return ue=new GridCreateEditRowModal({}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block_1$1z(to){let ue,eo;return ue=new GridViewCalculationButton({}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block$33(to){let ue,eo,no,ro,oo,io;return ue=new GridColumnsSettingButton({}),no=new GridRowActionsButton({}),oo=new GridScreensButton({}),oo.$on("generate",to[14]),{c(){create_component(ue.$$.fragment),eo=space$1(),create_component(no.$$.fragment),ro=space$1(),create_component(oo.$$.fragment)},m(ao,so){mount_component(ue,ao,so),insert$1(ao,eo,so),mount_component(no,ao,so),insert$1(ao,ro,so),mount_component(oo,ao,so),io=!0},p:noop$6,i(ao){io||(transition_in(ue.$$.fragment,ao),transition_in(no.$$.fragment,ao),transition_in(oo.$$.fragment,ao),io=!0)},o(ao){transition_out(ue.$$.fragment,ao),transition_out(no.$$.fragment,ao),transition_out(oo.$$.fragment,ao),io=!1},d(ao){ao&&(detach(eo),detach(ro)),destroy_component(ue,ao),destroy_component(no,ao),destroy_component(oo,ao)}}}function create_controls_slot$1(to){let ue,eo,no,ro,oo,io,ao,so,lo,co,uo,fo;ue=new GridManageAccessButton({});let po=to[4]&&create_if_block_1$1z();ro=new GridFilterButton({}),io=new GridSortButton({}),so=new GridSizeButton({});let ho=!to[4]&&create_if_block$33(to),_o={};return uo=new GridGenerateButton({props:_o}),to[15](uo),{c(){create_component(ue.$$.fragment),eo=space$1(),po&&po.c(),no=space$1(),create_component(ro.$$.fragment),oo=space$1(),create_component(io.$$.fragment),ao=space$1(),create_component(so.$$.fragment),lo=space$1(),ho&&ho.c(),co=space$1(),create_component(uo.$$.fragment)},m(go,bo){mount_component(ue,go,bo),insert$1(go,eo,bo),po&&po.m(go,bo),insert$1(go,no,bo),mount_component(ro,go,bo),insert$1(go,oo,bo),mount_component(io,go,bo),insert$1(go,ao,bo),mount_component(so,go,bo),insert$1(go,lo,bo),ho&&ho.m(go,bo),insert$1(go,co,bo),mount_component(uo,go,bo),fo=!0},p(go,bo){go[4]?po?bo&16&&transition_in(po,1):(po=create_if_block_1$1z(),po.c(),transition_in(po,1),po.m(no.parentNode,no)):po&&(group_outros(),transition_out(po,1,1,()=>{po=null}),check_outros()),go[4]?ho&&(group_outros(),transition_out(ho,1,1,()=>{ho=null}),check_outros()):ho?(ho.p(go,bo),bo&16&&transition_in(ho,1)):(ho=create_if_block$33(go),ho.c(),transition_in(ho,1),ho.m(co.parentNode,co));const vo={};uo.$set(vo)},i(go){fo||(transition_in(ue.$$.fragment,go),transition_in(po),transition_in(ro.$$.fragment,go),transition_in(io.$$.fragment,go),transition_in(so.$$.fragment,go),transition_in(ho),transition_in(uo.$$.fragment,go),fo=!0)},o(go){transition_out(ue.$$.fragment,go),transition_out(po),transition_out(ro.$$.fragment,go),transition_out(io.$$.fragment,go),transition_out(so.$$.fragment,go),transition_out(ho),transition_out(uo.$$.fragment,go),fo=!1},d(go){go&&(detach(eo),detach(no),detach(oo),detach(ao),detach(lo),detach(co)),destroy_component(ue,go),po&&po.d(go),destroy_component(ro,go),destroy_component(io,go),destroy_component(so,go),ho&&ho.d(go),to[15](null),destroy_component(uo,go)}}}function create_fragment$6j(to){let ue,eo;return ue=new Grid({props:{API,darkMode:to[1],datasource:to[3],buttons:to[2],allowAddRows:!0,allowDeleteRows:!0,aiEnabled:to[5].BUDIBASE_AI||to[5].AI_CUSTOM_CONFIGS,showAvatars:!1,isCloud:to[6].cloud,buttonsCollapsed:!0,$$slots:{controls:[create_controls_slot$1],default:[create_default_slot$4c]},$$scope:{ctx:to}}}),ue.$on("updatedatasource",to[7]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,[ro]){const oo={};ro&2&&(oo.darkMode=no[1]),ro&8&&(oo.datasource=no[3]),ro&4&&(oo.buttons=no[2]),ro&32&&(oo.aiEnabled=no[5].BUDIBASE_AI||no[5].AI_CUSTOM_CONFIGS),ro&64&&(oo.isCloud=no[6].cloud),ro&131089&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function instance$6g(to,ue,eo){let no,ro,oo,io,ao,so,lo,co,uo,fo,po,ho;component_subscribe(to,themeStore$1,wo=>eo(11,co=wo)),component_subscribe(to,rowActions,wo=>eo(12,uo=wo)),component_subscribe(to,viewsV2,wo=>eo(13,fo=wo)),component_subscribe(to,featureFlags,wo=>eo(5,po=wo)),component_subscribe(to,admin,wo=>eo(6,ho=wo));let _o;const go=wo=>(wo||[]).map(ko=>({text:ko.name,onClick:async So=>{await rowActions.trigger(oo,ko.id,So._id),notifications.success("Row action triggered successfully")}})),bo=async wo=>{viewsV2.replaceView(oo,wo.detail)},vo=()=>_o==null?void 0:_o.show();function yo(wo){binding_callbacks[wo?"unshift":"push"](()=>{_o=wo,eo(0,_o)})}return to.$$.update=()=>{to.$$.dirty&8192&&eo(10,no=fo.selected),to.$$.dirty&1024&&eo(4,ro=(no==null?void 0:no.type)===ViewV2Type.CALCULATION),to.$$.dirty&1024&&eo(8,oo=no==null?void 0:no.id),to.$$.dirty&1280&&eo(3,io={type:"viewV2",id:oo,tableId:no==null?void 0:no.tableId}),to.$$.dirty&4352&&eo(2,ao=go(uo[oo])),to.$$.dirty&256&&rowActions.refreshRowActions(oo),to.$$.dirty&2048&&eo(9,so=co==null?void 0:co.theme),to.$$.dirty&512&&eo(1,lo=!so.includes("light"))},[_o,lo,ao,io,ro,po,ho,bo,oo,so,no,co,uo,fo,vo,yo]}class U5BviewIdu5D extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$6g,create_fragment$6j,safe_not_equal,{})}}function create_fragment$6i(to){let ue;const eo=to[3].default,no=create_slot(eo,to,to[2],null);return{c(){no&&no.c()},m(ro,oo){no&&no.m(ro,oo),ue=!0},p(ro,[oo]){no&&no.p&&(!ue||oo&4)&&update_slot_base(no,eo,ro,ro[2],ue?get_slot_changes(eo,ro[2],oo,null):get_all_dirty_from_scope(ro[2]),null)},i(ro){ue||(transition_in(no,ro),ue=!0)},o(ro){transition_out(no,ro),ue=!1},d(ro){no&&no.d(ro)}}}function instance$6f(to,ue,eo){let no,ro;component_subscribe(to,viewsV2,so=>eo(1,ro=so));let{$$slots:oo={},$$scope:io}=ue;const ao=syncURLToState({urlParam:"viewId",stateKey:"selectedViewId",validate:so=>{var lo;return(lo=ro.list)==null?void 0:lo.some(co=>co.id===so)},update:viewsV2.select,fallbackUrl:"../",store:viewsV2,routify:routify$1,decode:decodeURIComponent});return onDestroy(ao),to.$$set=so=>{"$$scope"in so&&eo(2,io=so.$$scope)},to.$$.update=()=>{to.$$.dirty&2&&eo(0,no=ro.selectedViewId),to.$$.dirty&1&&builderStore.selectResource(no)},[no,ro,io,oo]}let Layout$i=class extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$6f,create_fragment$6i,safe_not_equal,{})}};function getAutoColumnInformation(to=!0){let ue={};for(const[eo,no]of Object.entries(AUTO_COLUMN_SUB_TYPES))no===AUTO_COLUMN_SUB_TYPES.CREATED_AT||no===AUTO_COLUMN_SUB_TYPES.CREATED_BY||(ue[no]={enabled:to,name:AUTO_COLUMN_DISPLAY_NAMES[eo]});return ue}function buildAutoColumn(to,ue,eo){let no,ro;switch(eo){case AUTO_COLUMN_SUB_TYPES.UPDATED_BY:case AUTO_COLUMN_SUB_TYPES.CREATED_BY:no=FieldType.LINK,ro=FIELDS.LINK.constraints;break;case AUTO_COLUMN_SUB_TYPES.AUTO_ID:no=FieldType.NUMBER,ro=FIELDS.NUMBER.constraints;break;case AUTO_COLUMN_SUB_TYPES.UPDATED_AT:case AUTO_COLUMN_SUB_TYPES.CREATED_AT:no=FieldType.DATETIME,ro=FIELDS.DATETIME.constraints;break;default:no=FieldType.STRING,ro=FIELDS.STRING.constraints;break}if(Object.values(AUTO_COLUMN_SUB_TYPES).indexOf(eo)===-1)throw"Cannot build auto column with supplied subtype";const oo={name:ue,type:no,subtype:eo,icon:"ri-magic-line",autocolumn:!0,constraints:ro};return isAutoColumnUserRelationship(eo)&&(oo.tableId=TableNames.USERS,oo.fieldName=`${to}-${ue}`),oo}function get_each_context$1f(to,ue,eo){const no=to.slice();return no[11]=ue[eo],no[12]=ue,no[13]=eo,no}function create_if_block$32(to){let ue,eo,no=ensure_array_like(Object.keys(to[4])),ro=[];for(let io=0;io<no.length;io+=1)ro[io]=create_each_block$1f(get_each_context$1f(to,no,io));const oo=io=>transition_out(ro[io],1,1,()=>{ro[io]=null});return{c(){for(let io=0;io<ro.length;io+=1)ro[io].c();ue=empty$2()},m(io,ao){for(let so=0;so<ro.length;so+=1)ro[so]&&ro[so].m(io,ao);insert$1(io,ue,ao),eo=!0},p(io,ao){if(ao&31){no=ensure_array_like(Object.keys(io[4]));let so;for(so=0;so<no.length;so+=1){const lo=get_each_context$1f(io,no,so);ro[so]?(ro[so].p(lo,ao),transition_in(ro[so],1)):(ro[so]=create_each_block$1f(lo),ro[so].c(),transition_in(ro[so],1),ro[so].m(ue.parentNode,ue))}for(group_outros(),so=no.length;so<ro.length;so+=1)oo(so);check_outros()}},i(io){if(!eo){for(let ao=0;ao<no.length;ao+=1)transition_in(ro[ao]);eo=!0}},o(io){ro=ro.filter(Boolean);for(let ao=0;ao<ro.length;ao+=1)transition_out(ro[ao]);eo=!1},d(io){io&&detach(ue),destroy_each(ro,io)}}}function create_if_block_3$M(to){let ue,eo,no;function ro(io){to[10](io,to[11])}let oo={label:capitalise$1(to[11]),options:to[3]};return to[0][to[11]]!==void 0&&(oo.value=to[0][to[11]]),ue=new Select_1$1({props:oo}),binding_callbacks.push(()=>bind$2(ue,"value",ro)),{c(){create_component(ue.$$.fragment)},m(io,ao){mount_component(ue,io,ao),no=!0},p(io,ao){to=io;const so={};ao&16&&(so.label=capitalise$1(to[11])),ao&8&&(so.options=to[3]),!eo&&ao&17&&(eo=!0,so.value=to[0][to[11]],add_flush_callback(()=>eo=!1)),ue.$set(so)},i(io){no||(transition_in(ue.$$.fragment,io),no=!0)},o(io){transition_out(ue.$$.fragment,io),no=!1},d(io){destroy_component(ue,io)}}}function create_if_block_2$11(to){let ue,eo,no;function ro(io){to[9](io,to[11])}let oo={label:capitalise$1(to[11]),options:to[3]};return to[0][to[11]]!==void 0&&(oo.value=to[0][to[11]]),ue=new Multiselect_1({props:oo}),binding_callbacks.push(()=>bind$2(ue,"value",ro)),{c(){create_component(ue.$$.fragment)},m(io,ao){mount_component(ue,io,ao),no=!0},p(io,ao){to=io;const so={};ao&16&&(so.label=capitalise$1(to[11])),ao&8&&(so.options=to[3]),!eo&&ao&17&&(eo=!0,so.value=to[0][to[11]],add_flush_callback(()=>eo=!1)),ue.$set(so)},i(io){no||(transition_in(ue.$$.fragment,io),no=!0)},o(io){transition_out(ue.$$.fragment,io),no=!1},d(io){destroy_component(ue,io)}}}function create_if_block_1$1y(to){let ue,eo;function no(...ro){return to[8](to[11],...ro)}return ue=new ModalBindableInput({props:{label:capitalise$1(to[11]),panel:ServerBindingPanel,title:"Prompt",value:to[0][to[11]],bindings:to[1],allowJS:!0,context:to[2]}}),ue.$on("change",no),{c(){create_component(ue.$$.fragment)},m(ro,oo){mount_component(ue,ro,oo),eo=!0},p(ro,oo){to=ro;const io={};oo&16&&(io.label=capitalise$1(to[11])),oo&17&&(io.value=to[0][to[11]]),oo&2&&(io.bindings=to[1]),oo&4&&(io.context=to[2]),ue.$set(io)},i(ro){eo||(transition_in(ue.$$.fragment,ro),eo=!0)},o(ro){transition_out(ue.$$.fragment,ro),eo=!1},d(ro){destroy_component(ue,ro)}}}function create_each_block$1f(to){let ue,eo,no,ro;const oo=[create_if_block_1$1y,create_if_block_2$11,create_if_block_3$M],io=[];function ao(so,lo){return so[4][so[11]]===OperationFieldTypes.BINDABLE_TEXT?0:so[4][so[11]]===OperationFieldTypes.MULTI_COLUMN?1:so[4][so[11]]===OperationFieldTypes.COLUMN?2:-1}return~(ue=ao(to))&&(eo=io[ue]=oo[ue](to)),{c(){eo&&eo.c(),no=empty$2()},m(so,lo){~ue&&io[ue].m(so,lo),insert$1(so,no,lo),ro=!0},p(so,lo){let co=ue;ue=ao(so),ue===co?~ue&&io[ue].p(so,lo):(eo&&(group_outros(),transition_out(io[co],1,1,()=>{io[co]=null}),check_outros()),~ue?(eo=io[ue],eo?eo.p(so,lo):(eo=io[ue]=oo[ue](so),eo.c()),transition_in(eo,1),eo.m(no.parentNode,no)):eo=null)},i(so){ro||(transition_in(eo),ro=!0)},o(so){transition_out(eo),ro=!1},d(so){so&&detach(no),~ue&&io[ue].d(so)}}}function create_fragment$6h(to){let ue,eo,no,ro,oo;function io(lo){to[7](lo)}let ao={label:"Operation",options:to[5]};to[0].operation!==void 0&&(ao.value=to[0].operation),ue=new Select_1$1({props:ao}),binding_callbacks.push(()=>bind$2(ue,"value",io));let so=to[0].operation&&create_if_block$32(to);return{c(){create_component(ue.$$.fragment),no=space$1(),so&&so.c(),ro=empty$2()},m(lo,co){mount_component(ue,lo,co),insert$1(lo,no,co),so&&so.m(lo,co),insert$1(lo,ro,co),oo=!0},p(lo,[co]){const uo={};!eo&&co&1&&(eo=!0,uo.value=lo[0].operation,add_flush_callback(()=>eo=!1)),ue.$set(uo),lo[0].operation?so?(so.p(lo,co),co&1&&transition_in(so,1)):(so=create_if_block$32(lo),so.c(),transition_in(so,1),so.m(ro.parentNode,ro)):so&&(group_outros(),transition_out(so,1,1,()=>{so=null}),check_outros())},i(lo){oo||(transition_in(ue.$$.fragment,lo),transition_in(so),oo=!0)},o(lo){transition_out(ue.$$.fragment,lo),transition_out(so),oo=!1},d(lo){lo&&(detach(no),detach(ro)),destroy_component(ue,lo),so&&so.d(lo)}}}function instance$6e(to,ue,eo){let no,ro;const oo=Object.keys(AIOperations).map(ho=>({label:AIOperations[ho].label,value:AIOperations[ho].value}));let{bindings:io}=ue,{context:ao}=ue,{schema:so}=ue,{aiField:lo={}}=ue;function co(ho){to.$$.not_equal(lo.operation,ho)&&(lo.operation=ho,eo(0,lo))}const uo=(ho,_o)=>eo(0,lo[ho]=_o.detail,lo);function fo(ho,_o){to.$$.not_equal(lo[_o],ho)&&(lo[_o]=ho,eo(0,lo))}function po(ho,_o){to.$$.not_equal(lo[_o],ho)&&(lo[_o]=ho,eo(0,lo))}return to.$$set=ho=>{"bindings"in ho&&eo(1,io=ho.bindings),"context"in ho&&eo(2,ao=ho.context),"schema"in ho&&eo(6,so=ho.schema),"aiField"in ho&&eo(0,lo=ho.aiField)},to.$$.update=()=>{to.$$.dirty&1&&eo(4,no=OperationFields[lo.operation]),to.$$.dirty&64&&eo(3,ro=Object.keys(so).filter(ho=>so[ho].type!=="link"))},[lo,io,ao,ro,no,oo,so,co,uo,fo,po]}class AIFieldConfiguration extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$6e,create_fragment$6h,safe_not_equal,{bindings:1,context:2,schema:6,aiField:0})}}const MAX_DEPTH=1,TYPES_TO_SKIP=[FieldType.FORMULA,FieldType.AI,FieldType.LONGFORM,FieldType.SIGNATURE_SINGLE,FieldType.ATTACHMENTS,FieldType.INTERNAL];function getBindings({table:to,path:ue=null,category:eo=null,depth:no=0}){let ro=[];if(!to)return ro;for(let[oo,io]of Object.entries(to.schema)){const ao=io.type===FieldType.LINK;if(TYPES_TO_SKIP.includes(io.type)||ao&&no>=MAX_DEPTH)continue;if(eo=eo??`${to.name} Fields`,ao&&no<MAX_DEPTH){const fo=get_store_value(tables).list.find(ho=>ho._id===io.tableId),po=ro.concat(getBindings({table:fo,path:oo,category:`${oo} Relationships`,depth:no+1}));ro=ro.concat(po.filter(ho=>!ro.find(_o=>_o.path===ho.path)))}const so=Object.values(FIELDS).find(fo=>fo.type===io.type),lo=ue==null?oo:`${ue}.0.${oo}`,co=ue==null?`[${oo}]`:`[${ue}].0.[${oo}]`,uo=ue==null?void 0:'Update the "0" with the index of relationships or use array helpers';ro.push({label:lo,type:so.name===FIELDS.LINK.name?"Array":so.name,category:eo,path:lo,description:uo,readableBinding:lo,runtimeBinding:co,display:{name:lo,type:so.name===FIELDS.LINK.name?"Array":so.name}})}return ro}function baseConversion(to){if(to==="string")return{type:FieldType.STRING};if(to==="boolean")return{type:FieldType.BOOLEAN};if(to==="number")return{type:FieldType.NUMBER}}function recurse(to={},ue){if(!ue)return null;const eo=typeof ue;if(eo!=="object")return baseConversion(eo);for(let[no,ro]of Object.entries(ue)){const oo=typeof ro;if(Array.isArray(ro)){const io=recurse(to[no],ro[0]);io&&(to[no]={type:FieldType.ARRAY,schema:io})}else if(oo==="object"){const io=recurse(to[no],ue[no]);io&&(to[no]=io)}else to[no]=baseConversion(oo)}return to.type?to:{type:FieldType.JSON,schema:to}}function generate(to){return recurse({},to).schema}const JSONSchemaModal_svelte_svelte_type_style_lang="";function get_each_context$1e(to,ue,eo){const no=to.slice();return no[17]=ue[eo],no[18]=ue,no[19]=eo,no}function create_each_block$1e(to){let ue,eo,no,ro,oo,io,ao,so,lo;function co(_o){to[10](_o,to[19])}let uo={outline:!0,label:"Key"};to[2][to[19]]!==void 0&&(uo.value=to[2][to[19]]),eo=new Input$5({props:uo}),binding_callbacks.push(()=>bind$2(eo,"value",co));function fo(_o){to[11](_o,to[19])}let po={label:"Type",options:to[5],getOptionValue:func$B,getOptionLabel:func_1$v};to[3][to[19]]!==void 0&&(po.value=to[3][to[19]]),oo=new Select_1$1({props:po}),binding_callbacks.push(()=>bind$2(oo,"value",fo));function ho(){return to[12](to[19])}return so=new ActionButton({props:{icon:"Close",quiet:!0}}),so.$on("click",ho),{c(){ue=element("div"),create_component(eo.$$.fragment),ro=space$1(),create_component(oo.$$.fragment),ao=space$1(),create_component(so.$$.fragment),attr(ue,"class","horizontal svelte-1foeviw")},m(_o,go){insert$1(_o,ue,go),mount_component(eo,ue,null),append$2(ue,ro),mount_component(oo,ue,null),append$2(ue,ao),mount_component(so,ue,null),lo=!0},p(_o,go){to=_o;const bo={};!no&&go&4&&(no=!0,bo.value=to[2][to[19]],add_flush_callback(()=>no=!1)),eo.$set(bo);const vo={};!io&&go&8&&(io=!0,vo.value=to[3][to[19]],add_flush_callback(()=>io=!1)),oo.$set(vo)},i(_o){lo||(transition_in(eo.$$.fragment,_o),transition_in(oo.$$.fragment,_o),transition_in(so.$$.fragment,_o),lo=!0)},o(_o){transition_out(eo.$$.fragment,_o),transition_out(oo.$$.fragment,_o),transition_out(so.$$.fragment,_o),lo=!1},d(_o){_o&&detach(ue),destroy_component(eo),destroy_component(oo),destroy_component(so)}}}function create_default_slot_6$T(to){let ue;return{c(){ue=text("Add Field")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_5$14(to){let ue,eo,no,ro,oo=ensure_array_like(Array(to[1])),io=[];for(let so=0;so<oo.length;so+=1)io[so]=create_each_block$1e(get_each_context$1e(to,oo,so));const ao=so=>transition_out(io[so],1,1,()=>{io[so]=null});return no=new Button({props:{primary:!0,text:!0,$$slots:{default:[create_default_slot_6$T]},$$scope:{ctx:to}}}),no.$on("click",to[13]),{c(){for(let so=0;so<io.length;so+=1)io[so].c();ue=space$1(),eo=element("div"),create_component(no.$$.fragment),attr(eo,"class","svelte-1foeviw"),toggle_class(eo,"add-field-btn",to[1]!==0)},m(so,lo){for(let co=0;co<io.length;co+=1)io[co]&&io[co].m(so,lo);insert$1(so,ue,lo),insert$1(so,eo,lo),mount_component(no,eo,null),ro=!0},p(so,lo){if(lo&302){oo=ensure_array_like(Array(so[1]));let uo;for(uo=0;uo<oo.length;uo+=1){const fo=get_each_context$1e(so,oo,uo);io[uo]?(io[uo].p(fo,lo),transition_in(io[uo],1)):(io[uo]=create_each_block$1e(fo),io[uo].c(),transition_in(io[uo],1),io[uo].m(ue.parentNode,ue))}for(group_outros(),uo=oo.length;uo<io.length;uo+=1)ao(uo);check_outros()}const co={};lo&1048576&&(co.$$scope={dirty:lo,ctx:so}),no.$set(co),(!ro||lo&2)&&toggle_class(eo,"add-field-btn",so[1]!==0)},i(so){if(!ro){for(let lo=0;lo<oo.length;lo+=1)transition_in(io[lo]);transition_in(no.$$.fragment,so),ro=!0}},o(so){io=io.filter(Boolean);for(let lo=0;lo<io.length;lo+=1)transition_out(io[lo]);transition_out(no.$$.fragment,so),ro=!1},d(so){so&&(detach(ue),detach(eo)),destroy_each(io,so),destroy_component(no)}}}function create_default_slot_4$1n(to){let ue;return{c(){ue=text(`Provide a sample JSON blob here to automatically determine your
|
|
1686
|
+
`),lo&&lo.c(),eo=space$1(),ro.c(),oo=space$1(),io=element("div"),create_component(ao.$$.fragment)},m(po,ho){insert$1(po,ue,ho),lo&&lo.m(po,ho),insert$1(po,eo,ho),uo[no].m(po,ho),insert$1(po,oo,ho),insert$1(po,io,ho),mount_component(ao,io,null),so=!0},p(po,ho){po[3]&&rowActions.length?lo||(lo=create_if_block_2$12(),lo.c(),lo.m(eo.parentNode,eo)):lo&&(lo.d(1),lo=null);let _o=no;no=fo(po),no===_o?uo[no].p(po,ho):(group_outros(),transition_out(uo[_o],1,1,()=>{uo[_o]=null}),check_outros(),ro=uo[no],ro?ro.p(po,ho):(ro=uo[no]=co[no](po),ro.c()),transition_in(ro,1),ro.m(oo.parentNode,oo));const go={};ho&536870912&&(go.$$scope={dirty:ho,ctx:po}),ao.$set(go)},i(po){so||(transition_in(ro),transition_in(ao.$$.fragment,po),so=!0)},o(po){transition_out(ro),transition_out(ao.$$.fragment,po),so=!1},d(po){po&&(detach(ue),detach(eo),detach(oo),detach(io)),lo&&lo.d(po),uo[no].d(po),destroy_component(ao)}}}function create_default_slot_2$2g(to){let ue,eo=to[7]?`: ${to[7]}`:"",no;return{c(){ue=text("Row actions"),no=text(eo)},m(ro,oo){insert$1(ro,ue,oo),insert$1(ro,no,oo)},p(ro,oo){oo&128&&eo!==(eo=ro[7]?`: ${ro[7]}`:"")&&set_data(no,eo)},d(ro){ro&&(detach(ue),detach(no))}}}function create_anchor_slot$5(to){let ue,eo;return ue=new ActionButton({props:{icon:"Engagement",selected:to[25]||to[7],quiet:!0,accentColor:"#A24400",$$slots:{default:[create_default_slot_2$2g]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&33554560&&(oo.selected=no[25]||no[7]),ro&536871040&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot_1$36(to){let ue,eo,no;function ro(io){to[21](io)}let oo={label:"Name",error:to[6]&&!to[24]?"A row action with this name already exists":null};return to[0]!==void 0&&(oo.value=to[0]),ue=new Input$5({props:oo}),binding_callbacks.push(()=>bind$2(ue,"value",ro)),{c(){create_component(ue.$$.fragment)},m(io,ao){mount_component(ue,io,ao),no=!0},p(io,ao){const so={};ao&16777280&&(so.error=io[6]&&!io[24]?"A row action with this name already exists":null),!eo&&ao&1&&(eo=!0,so.value=io[0],add_flush_callback(()=>eo=!1)),ue.$set(so)},i(io){no||(transition_in(ue.$$.fragment,io),no=!0)},o(io){transition_out(ue.$$.fragment,io),no=!1},d(io){destroy_component(ue,io)}}}function create_default_slot$4e(to){let ue,eo;return ue=new ModalContent({props:{size:"S",title:"Create row action",confirmText:"Create",showCancelButton:!1,showDivider:!1,showCloseIcon:!1,disabled:!to[0]||to[6],onConfirm:to[13],$$slots:{default:[create_default_slot_1$36,({loading:no})=>({24:no}),({loading:no})=>no?16777216:0]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&65&&(oo.disabled=!no[0]||no[6]),ro&553648193&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_fragment$6l(to){let ue,eo,no,ro,oo={title:"Row actions",$$slots:{anchor:[create_anchor_slot$5,({open:ao})=>({25:ao}),({open:ao})=>ao?33554432:0],default:[create_default_slot_3$1R]},$$scope:{ctx:to}};ue=new DetailPopover({props:oo}),to[20](ue);let io={$$slots:{default:[create_default_slot$4e]},$$scope:{ctx:to}};return no=new Modal({props:io}),to[22](no),{c(){create_component(ue.$$.fragment),eo=space$1(),create_component(no.$$.fragment)},m(ao,so){mount_component(ue,ao,so),insert$1(ao,eo,so),mount_component(no,ao,so),ro=!0},p(ao,[so]){const lo={};so&570425742&&(lo.$$scope={dirty:so,ctx:ao}),ue.$set(lo);const co={};so&536870977&&(co.$$scope={dirty:so,ctx:ao}),no.$set(co)},i(ao){ro||(transition_in(ue.$$.fragment,ao),transition_in(no.$$.fragment,ao),ro=!0)},o(ao){transition_out(ue.$$.fragment,ao),transition_out(no.$$.fragment,ao),ro=!1},d(ao){ao&&detach(eo),to[20](null),destroy_component(ue,ao),to[22](null),destroy_component(no,ao)}}}function instance$6i(to,ue,eo){let no,ro,oo,io,ao,so,lo,co,uo,fo,po,ho;component_subscribe(to,goto,Mo=>eo(23,fo=Mo)),component_subscribe(to,rowActions,Mo=>eo(17,po=Mo));const{datasource:_o}=getContext$1("grid");component_subscribe(to,_o,Mo=>eo(18,ho=Mo));let go,bo,vo;const yo=derived([url$3,appStore],([Mo,Vo])=>({automationId:Fo})=>Mo(`/builder/app/${Vo.appId}/automation/${Fo}`));component_subscribe(to,yo,Mo=>eo(8,uo=Mo));const wo=async(Mo,Vo)=>{Vo?await rowActions.enableView(ro,Mo.id,oo):await rowActions.disableView(ro,Mo.id,oo)},ko=()=>{eo(0,vo=null),go.hide(),bo.show()},So=async()=>{try{const Mo=await rowActions.createRowAction(ro,oo,vo);notifications.success("Row action created successfully"),fo(uo(Mo))}catch(Mo){console.error(Mo),notifications.error("Error creating row action")}},Eo=(Mo,Vo)=>wo(Mo,Vo.detail);function Io(Mo){binding_callbacks[Mo?"unshift":"push"](()=>{go=Mo,eo(4,go)})}function Ao(Mo){vo=Mo,eo(0,vo)}function To(Mo){binding_callbacks[Mo?"unshift":"push"](()=>{bo=Mo,eo(5,bo)})}return to.$$.update=()=>{to.$$.dirty&262144&&eo(16,no=ho),to.$$.dirty&65536&&eo(14,ro=no==null?void 0:no.tableId),to.$$.dirty&65536&&eo(1,oo=no==null?void 0:no.id),to.$$.dirty&65536&&eo(3,io=(no==null?void 0:no.type)==="viewV2"),to.$$.dirty&147456&&eo(2,ao=po[ro]||[]),to.$$.dirty&131074&&eo(15,so=po[oo]||[]),to.$$.dirty&32780&&eo(7,lo=io?so.length:ao.length),to.$$.dirty&5&&eo(6,co=vo&&ao.some(Mo=>Mo.name===vo))},[vo,oo,ao,io,go,bo,co,lo,uo,_o,yo,wo,ko,So,ro,so,no,po,ho,Eo,Io,Ao,To]}class GridRowActionsButton extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$6i,create_fragment$6l,safe_not_equal,{})}}const GridViewCalculationButton_svelte_svelte_type_style_lang="";function get_each_context$1g(to,ue,eo){const no=to.slice();return no[27]=ue[eo],no[28]=ue,no[29]=eo,no}function create_if_block$34(to){let ue,eo,no,ro,oo,io,ao,so,lo=ensure_array_like(to[2]),co=[];for(let ho=0;ho<lo.length;ho+=1)co[ho]=create_each_block$1g(get_each_context$1g(to,lo,ho));const uo=ho=>transition_out(co[ho],1,1,()=>{co[ho]=null});function fo(ho){to[18](ho)}let po={options:to[5],placeholder:"None"};return to[3]!==void 0&&(po.value=to[3]),io=new Multiselect_1({props:po}),binding_callbacks.push(()=>bind$2(io,"value",fo)),{c(){ue=element("div");for(let ho=0;ho<co.length;ho+=1)co[ho].c();eo=space$1(),no=element("span"),no.textContent="Group by",ro=space$1(),oo=element("div"),create_component(io.$$.fragment),attr(oo,"class","group-by svelte-1yp5un1"),attr(ue,"class","calculations svelte-1yp5un1")},m(ho,_o){insert$1(ho,ue,_o);for(let go=0;go<co.length;go+=1)co[go]&&co[go].m(ue,null);append$2(ue,eo),append$2(ue,no),append$2(ue,ro),append$2(ue,oo),mount_component(io,oo,null),so=!0},p(ho,_o){if(_o&5637){lo=ensure_array_like(ho[2]);let bo;for(bo=0;bo<lo.length;bo+=1){const vo=get_each_context$1g(ho,lo,bo);co[bo]?(co[bo].p(vo,_o),transition_in(co[bo],1)):(co[bo]=create_each_block$1g(vo),co[bo].c(),transition_in(co[bo],1),co[bo].m(ue,eo))}for(group_outros(),bo=lo.length;bo<co.length;bo+=1)uo(bo);check_outros()}const go={};_o&32&&(go.options=ho[5]),!ao&&_o&8&&(ao=!0,go.value=ho[3],add_flush_callback(()=>ao=!1)),io.$set(go)},i(ho){if(!so){for(let _o=0;_o<lo.length;_o+=1)transition_in(co[_o]);transition_in(io.$$.fragment,ho),so=!0}},o(ho){co=co.filter(Boolean);for(let _o=0;_o<co.length;_o+=1)transition_out(co[_o]);transition_out(io.$$.fragment,ho),so=!1},d(ho){ho&&detach(ue),destroy_each(co,ho),destroy_component(io)}}}function create_each_block$1g(to){let ue,eo,no,ro,oo,io,ao,so,lo,co,uo,fo;function po(vo){to[15](vo,to[27])}let ho={options:to[9](to[27],to[2]),placeholder:!1};to[27].type!==void 0&&(ho.value=to[27].type),no=new Select_1$1({props:ho}),binding_callbacks.push(()=>bind$2(no,"value",po));function _o(vo){to[16](vo,to[27])}let go={options:to[10](to[27],to[2],to[0]),placeholder:"Column"};to[27].field!==void 0&&(go.value=to[27].field),so=new Select_1$1({props:go}),binding_callbacks.push(()=>bind$2(so,"value",_o));function bo(){return to[17](to[29])}return uo=new Icon({props:{hoverable:!0,name:"Delete",size:"S",color:"var(--spectrum-global-color-gray-700)"}}),uo.$on("click",bo),{c(){ue=element("span"),ue.textContent=`${to[29]===0?"Calculate":"and"} the`,eo=space$1(),create_component(no.$$.fragment),oo=space$1(),io=element("span"),io.textContent="of",ao=space$1(),create_component(so.$$.fragment),co=space$1(),create_component(uo.$$.fragment)},m(vo,yo){insert$1(vo,ue,yo),insert$1(vo,eo,yo),mount_component(no,vo,yo),insert$1(vo,oo,yo),insert$1(vo,io,yo),insert$1(vo,ao,yo),mount_component(so,vo,yo),insert$1(vo,co,yo),mount_component(uo,vo,yo),fo=!0},p(vo,yo){to=vo;const wo={};yo&4&&(wo.options=to[9](to[27],to[2])),!ro&&yo&4&&(ro=!0,wo.value=to[27].type,add_flush_callback(()=>ro=!1)),no.$set(wo);const ko={};yo&5&&(ko.options=to[10](to[27],to[2],to[0])),!lo&&yo&4&&(lo=!0,ko.value=to[27].field,add_flush_callback(()=>lo=!1)),so.$set(ko)},i(vo){fo||(transition_in(no.$$.fragment,vo),transition_in(so.$$.fragment,vo),transition_in(uo.$$.fragment,vo),fo=!0)},o(vo){transition_out(no.$$.fragment,vo),transition_out(so.$$.fragment,vo),transition_out(uo.$$.fragment,vo),fo=!1},d(vo){vo&&(detach(ue),detach(eo),detach(oo),detach(io),detach(ao),detach(co)),destroy_component(no,vo),destroy_component(so,vo),destroy_component(uo,vo)}}}function create_default_slot_3$1Q(to){let ue;return{c(){ue=text("Add calculation")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_2$2f(to){let ue;return{c(){ue=text("Save")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_1$35(to){let ue,eo,no,ro,oo,io,ao,so,lo,co=to[2].length&&create_if_block$34(to);return no=new ActionButton({props:{quiet:!0,icon:"Add",disabled:to[2].length>=5,$$slots:{default:[create_default_slot_3$1Q]},$$scope:{ctx:to}}}),no.$on("click",to[11]),oo=new InfoDisplay({props:{icon:"Help",quiet:!0,body:"Most calculations only work with numeric columns and a maximum of 5 calculations can be added at once."}}),so=new Button({props:{cta:!0,disabled:to[4],$$slots:{default:[create_default_slot_2$2f]},$$scope:{ctx:to}}}),so.$on("click",to[13]),{c(){co&&co.c(),ue=space$1(),eo=element("div"),create_component(no.$$.fragment),ro=space$1(),create_component(oo.$$.fragment),io=space$1(),ao=element("div"),create_component(so.$$.fragment),attr(eo,"class","buttons svelte-1yp5un1")},m(uo,fo){co&&co.m(uo,fo),insert$1(uo,ue,fo),insert$1(uo,eo,fo),mount_component(no,eo,null),insert$1(uo,ro,fo),mount_component(oo,uo,fo),insert$1(uo,io,fo),insert$1(uo,ao,fo),mount_component(so,ao,null),lo=!0},p(uo,fo){uo[2].length?co?(co.p(uo,fo),fo&4&&transition_in(co,1)):(co=create_if_block$34(uo),co.c(),transition_in(co,1),co.m(ue.parentNode,ue)):co&&(group_outros(),transition_out(co,1,1,()=>{co=null}),check_outros());const po={};fo&4&&(po.disabled=uo[2].length>=5),fo&1073741824&&(po.$$scope={dirty:fo,ctx:uo}),no.$set(po);const ho={};fo&16&&(ho.disabled=uo[4]),fo&1073741824&&(ho.$$scope={dirty:fo,ctx:uo}),so.$set(ho)},i(uo){lo||(transition_in(co),transition_in(no.$$.fragment,uo),transition_in(oo.$$.fragment,uo),transition_in(so.$$.fragment,uo),lo=!0)},o(uo){transition_out(co),transition_out(no.$$.fragment,uo),transition_out(oo.$$.fragment,uo),transition_out(so.$$.fragment,uo),lo=!1},d(uo){uo&&(detach(ue),detach(eo),detach(ro),detach(io),detach(ao)),co&&co.d(uo),destroy_component(no),destroy_component(oo,uo),destroy_component(so)}}}function create_default_slot$4d(to){let ue,eo=to[6]?`: ${to[6]}`:"",no;return{c(){ue=text("Configure calculations"),no=text(eo)},m(ro,oo){insert$1(ro,ue,oo),insert$1(ro,no,oo)},p(ro,oo){oo&64&&eo!==(eo=ro[6]?`: ${ro[6]}`:"")&&set_data(no,eo)},d(ro){ro&&(detach(ue),detach(no))}}}function create_anchor_slot$4(to){let ue,eo;return ue=new ActionButton({props:{icon:"WebPage",quiet:!0,selected:to[26],$$slots:{default:[create_default_slot$4d]},$$scope:{ctx:to}}}),ue.$on("click",to[8]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&67108864&&(oo.selected=no[26]),ro&1073741888&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_fragment$6k(to){let ue,eo,no={title:"Configure calculations",width:480,$$slots:{anchor:[create_anchor_slot$4,({open:ro})=>({26:ro}),({open:ro})=>ro?67108864:0],default:[create_default_slot_1$35]},$$scope:{ctx:to}};return ue=new DetailPopover({props:no}),to[19](ue),{c(){create_component(ue.$$.fragment)},m(ro,oo){mount_component(ue,ro,oo),eo=!0},p(ro,[oo]){const io={};oo&1140850813&&(io.$$scope={dirty:oo,ctx:ro}),ue.$set(io)},i(ro){eo||(transition_in(ue.$$.fragment,ro),eo=!0)},o(ro){transition_out(ue.$$.fragment,ro),eo=!1},d(ro){to[19](null),destroy_component(ue,ro)}}}function instance$6h(to,ue,eo){let no,ro,oo;const{definition:io,datasource:ao,rows:so}=getContext$1("grid");component_subscribe(to,io,Fo=>eo(14,oo=Fo));const lo=[{label:"Average",value:CalculationType.AVG},{label:"Sum",value:CalculationType.SUM},{label:"Minimum",value:CalculationType.MIN},{label:"Maximum",value:CalculationType.MAX},{label:"Count",value:CalculationType.COUNT}];let co,uo=[],fo=[],po={},ho=!1;const _o=()=>{eo(2,uo=go(po)),eo(3,fo=uo.length?bo(po):[]),co==null||co.show()},go=Fo=>Fo?Object.keys(Fo).filter(Po=>Fo[Po].calculationType!=null).map(Po=>({type:Fo[Po].calculationType,field:Fo[Po].field})):[],bo=Fo=>Fo?Object.keys(Fo).filter(Po=>Fo[Po].calculationType==null&&Fo[Po].visible):[],vo=(Fo,Po)=>lo.filter(Ro=>!Po.some(Do=>Do!==Fo&&Do.field===Fo.field&&Do.type===Ro.value)),yo=(Fo,Po,Ro)=>Object.entries(Ro).filter(([Do,qo])=>qo.calculationType||Fo.type!==CalculationType.COUNT&&!isNumeric$1(qo.type)?!1:!Po.some(Uo=>Uo!==Fo&&Uo.type===Fo.type&&Uo.field===Do)).map(([Do])=>Do),wo=Fo=>Object.entries(Fo).filter(([Po,Ro])=>Ro.calculationType?!1:canGroupBy(Ro.type)).map(([Po])=>Po),ko=()=>{eo(2,uo=[...uo,{type:CalculationType.AVG}])},So=Fo=>{eo(2,uo=uo.toSpliced(Fo,1)),uo.length||eo(3,fo=[])},Eo=async()=>{var Ro;let Fo={};eo(4,ho=!0);for(let Do of uo){if(!Do.type||!Do.field)continue;const Uo=`${lo.find(jo=>jo.value===Do.type).label} ${Do.field}`;Fo[Uo]={calculationType:Do.type,field:Do.field,visible:!0}}for(let Do of Object.keys(po))po[Do].calculationType||(Fo[Do]={...po[Do],visible:fo.includes(Do)});let Po=oo.primaryDisplay;(!Po||!((Ro=Fo[Po])!=null&&Ro.visible))&&(Po=fo[0]);try{await ao.actions.saveDefinition({...oo,primaryDisplay:Po,schema:Fo}),await so.actions.refreshData()}finally{eo(4,ho=!1),co.hide()}};function Io(Fo,Po){to.$$.not_equal(Po.type,Fo)&&(Po.type=Fo,eo(2,uo))}function Ao(Fo,Po){to.$$.not_equal(Po.field,Fo)&&(Po.field=Fo,eo(2,uo))}const To=Fo=>So(Fo);function Mo(Fo){fo=Fo,eo(3,fo)}function Vo(Fo){binding_callbacks[Fo?"unshift":"push"](()=>{co=Fo,eo(1,co)})}return to.$$.update=()=>{to.$$.dirty&16384&&eo(0,po=(oo==null?void 0:oo.schema)||{}),to.$$.dirty&16384&&eo(6,no=go((oo==null?void 0:oo.schema)||{}).length),to.$$.dirty&1&&eo(5,ro=wo(po))},[po,co,uo,fo,ho,ro,no,io,_o,vo,yo,ko,So,Eo,oo,Io,Ao,To,Mo,Vo]}class GridViewCalculationButton extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$6h,create_fragment$6k,safe_not_equal,{})}}function create_default_slot$4c(to){let ue,eo;return ue=new GridCreateEditRowModal({}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block_1$1z(to){let ue,eo;return ue=new GridViewCalculationButton({}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block$33(to){let ue,eo,no,ro,oo,io;return ue=new GridColumnsSettingButton({}),no=new GridRowActionsButton({}),oo=new GridScreensButton({}),oo.$on("generate",to[14]),{c(){create_component(ue.$$.fragment),eo=space$1(),create_component(no.$$.fragment),ro=space$1(),create_component(oo.$$.fragment)},m(ao,so){mount_component(ue,ao,so),insert$1(ao,eo,so),mount_component(no,ao,so),insert$1(ao,ro,so),mount_component(oo,ao,so),io=!0},p:noop$6,i(ao){io||(transition_in(ue.$$.fragment,ao),transition_in(no.$$.fragment,ao),transition_in(oo.$$.fragment,ao),io=!0)},o(ao){transition_out(ue.$$.fragment,ao),transition_out(no.$$.fragment,ao),transition_out(oo.$$.fragment,ao),io=!1},d(ao){ao&&(detach(eo),detach(ro)),destroy_component(ue,ao),destroy_component(no,ao),destroy_component(oo,ao)}}}function create_controls_slot$1(to){let ue,eo,no,ro,oo,io,ao,so,lo,co,uo,fo;ue=new GridManageAccessButton({});let po=to[4]&&create_if_block_1$1z();ro=new GridFilterButton({}),io=new GridSortButton({}),so=new GridSizeButton({});let ho=!to[4]&&create_if_block$33(to),_o={};return uo=new GridGenerateButton({props:_o}),to[15](uo),{c(){create_component(ue.$$.fragment),eo=space$1(),po&&po.c(),no=space$1(),create_component(ro.$$.fragment),oo=space$1(),create_component(io.$$.fragment),ao=space$1(),create_component(so.$$.fragment),lo=space$1(),ho&&ho.c(),co=space$1(),create_component(uo.$$.fragment)},m(go,bo){mount_component(ue,go,bo),insert$1(go,eo,bo),po&&po.m(go,bo),insert$1(go,no,bo),mount_component(ro,go,bo),insert$1(go,oo,bo),mount_component(io,go,bo),insert$1(go,ao,bo),mount_component(so,go,bo),insert$1(go,lo,bo),ho&&ho.m(go,bo),insert$1(go,co,bo),mount_component(uo,go,bo),fo=!0},p(go,bo){go[4]?po?bo&16&&transition_in(po,1):(po=create_if_block_1$1z(),po.c(),transition_in(po,1),po.m(no.parentNode,no)):po&&(group_outros(),transition_out(po,1,1,()=>{po=null}),check_outros()),go[4]?ho&&(group_outros(),transition_out(ho,1,1,()=>{ho=null}),check_outros()):ho?(ho.p(go,bo),bo&16&&transition_in(ho,1)):(ho=create_if_block$33(go),ho.c(),transition_in(ho,1),ho.m(co.parentNode,co));const vo={};uo.$set(vo)},i(go){fo||(transition_in(ue.$$.fragment,go),transition_in(po),transition_in(ro.$$.fragment,go),transition_in(io.$$.fragment,go),transition_in(so.$$.fragment,go),transition_in(ho),transition_in(uo.$$.fragment,go),fo=!0)},o(go){transition_out(ue.$$.fragment,go),transition_out(po),transition_out(ro.$$.fragment,go),transition_out(io.$$.fragment,go),transition_out(so.$$.fragment,go),transition_out(ho),transition_out(uo.$$.fragment,go),fo=!1},d(go){go&&(detach(eo),detach(no),detach(oo),detach(ao),detach(lo),detach(co)),destroy_component(ue,go),po&&po.d(go),destroy_component(ro,go),destroy_component(io,go),destroy_component(so,go),ho&&ho.d(go),to[15](null),destroy_component(uo,go)}}}function create_fragment$6j(to){let ue,eo;return ue=new Grid({props:{API,darkMode:to[1],datasource:to[3],buttons:to[2],allowAddRows:!0,allowDeleteRows:!0,aiEnabled:to[5].BUDIBASE_AI||to[5].AI_CUSTOM_CONFIGS,showAvatars:!1,isCloud:to[6].cloud,buttonsCollapsed:!0,$$slots:{controls:[create_controls_slot$1],default:[create_default_slot$4c]},$$scope:{ctx:to}}}),ue.$on("updatedatasource",to[7]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,[ro]){const oo={};ro&2&&(oo.darkMode=no[1]),ro&8&&(oo.datasource=no[3]),ro&4&&(oo.buttons=no[2]),ro&32&&(oo.aiEnabled=no[5].BUDIBASE_AI||no[5].AI_CUSTOM_CONFIGS),ro&64&&(oo.isCloud=no[6].cloud),ro&131089&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function instance$6g(to,ue,eo){let no,ro,oo,io,ao,so,lo,co,uo,fo,po,ho;component_subscribe(to,themeStore$1,wo=>eo(11,co=wo)),component_subscribe(to,rowActions,wo=>eo(12,uo=wo)),component_subscribe(to,viewsV2,wo=>eo(13,fo=wo)),component_subscribe(to,featureFlags,wo=>eo(5,po=wo)),component_subscribe(to,admin,wo=>eo(6,ho=wo));let _o;const go=wo=>(wo||[]).map(ko=>({text:ko.name,onClick:async So=>{await rowActions.trigger(oo,ko.id,So._id),notifications.success("Row action triggered successfully")}})),bo=async wo=>{viewsV2.replaceView(oo,wo.detail)},vo=()=>_o==null?void 0:_o.show();function yo(wo){binding_callbacks[wo?"unshift":"push"](()=>{_o=wo,eo(0,_o)})}return to.$$.update=()=>{to.$$.dirty&8192&&eo(10,no=fo.selected),to.$$.dirty&1024&&eo(4,ro=(no==null?void 0:no.type)===ViewV2Type.CALCULATION),to.$$.dirty&1024&&eo(8,oo=no==null?void 0:no.id),to.$$.dirty&1280&&eo(3,io={type:"viewV2",id:oo,tableId:no==null?void 0:no.tableId}),to.$$.dirty&4352&&eo(2,ao=go(uo[oo])),to.$$.dirty&256&&rowActions.refreshRowActions(oo),to.$$.dirty&2048&&eo(9,so=co==null?void 0:co.theme),to.$$.dirty&512&&eo(1,lo=!so.includes("light"))},[_o,lo,ao,io,ro,po,ho,bo,oo,so,no,co,uo,fo,vo,yo]}class U5BviewIdu5D extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$6g,create_fragment$6j,safe_not_equal,{})}}function create_fragment$6i(to){let ue;const eo=to[3].default,no=create_slot(eo,to,to[2],null);return{c(){no&&no.c()},m(ro,oo){no&&no.m(ro,oo),ue=!0},p(ro,[oo]){no&&no.p&&(!ue||oo&4)&&update_slot_base(no,eo,ro,ro[2],ue?get_slot_changes(eo,ro[2],oo,null):get_all_dirty_from_scope(ro[2]),null)},i(ro){ue||(transition_in(no,ro),ue=!0)},o(ro){transition_out(no,ro),ue=!1},d(ro){no&&no.d(ro)}}}function instance$6f(to,ue,eo){let no,ro;component_subscribe(to,viewsV2,so=>eo(1,ro=so));let{$$slots:oo={},$$scope:io}=ue;const ao=syncURLToState({urlParam:"viewId",stateKey:"selectedViewId",validate:so=>{var lo;return(lo=ro.list)==null?void 0:lo.some(co=>co.id===so)},update:viewsV2.select,fallbackUrl:"../",store:viewsV2,routify:routify$1,decode:decodeURIComponent});return onDestroy(ao),to.$$set=so=>{"$$scope"in so&&eo(2,io=so.$$scope)},to.$$.update=()=>{to.$$.dirty&2&&eo(0,no=ro.selectedViewId),to.$$.dirty&1&&builderStore.selectResource(no)},[no,ro,io,oo]}let Layout$i=class extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$6f,create_fragment$6i,safe_not_equal,{})}};function getAutoColumnInformation(to=!0){const ue={};for(const[eo,no]of Object.entries(AUTO_COLUMN_SUB_TYPES)){if(no===AUTO_COLUMN_SUB_TYPES.CREATED_AT||no===AUTO_COLUMN_SUB_TYPES.CREATED_BY)continue;const ro=eo;ue[no]={enabled:to,name:AUTO_COLUMN_DISPLAY_NAMES[ro]}}return ue}function buildAutoColumn(to,ue,eo){const no={name:ue,icon:"ri-magic-line",autocolumn:!0};switch(eo){case AUTO_COLUMN_SUB_TYPES.UPDATED_BY:case AUTO_COLUMN_SUB_TYPES.CREATED_BY:return{...no,type:FieldType.LINK,subtype:eo,constraints:FIELDS.LINK.constraints,tableId:TableNames.USERS,fieldName:`${to}-${ue}`,relationshipType:RelationshipType.MANY_TO_ONE};case AUTO_COLUMN_SUB_TYPES.AUTO_ID:return{...no,type:FieldType.NUMBER,subtype:eo,constraints:FIELDS.NUMBER.constraints};case AUTO_COLUMN_SUB_TYPES.UPDATED_AT:case AUTO_COLUMN_SUB_TYPES.CREATED_AT:return{...no,type:FieldType.DATETIME,subtype:eo,constraints:FIELDS.DATETIME.constraints};default:throw unreachable(eo,{message:"Cannot build auto column with supplied subtype"})}}function get_each_context$1f(to,ue,eo){const no=to.slice();return no[11]=ue[eo],no[12]=ue,no[13]=eo,no}function create_if_block$32(to){let ue,eo,no=ensure_array_like(Object.keys(to[4])),ro=[];for(let io=0;io<no.length;io+=1)ro[io]=create_each_block$1f(get_each_context$1f(to,no,io));const oo=io=>transition_out(ro[io],1,1,()=>{ro[io]=null});return{c(){for(let io=0;io<ro.length;io+=1)ro[io].c();ue=empty$2()},m(io,ao){for(let so=0;so<ro.length;so+=1)ro[so]&&ro[so].m(io,ao);insert$1(io,ue,ao),eo=!0},p(io,ao){if(ao&31){no=ensure_array_like(Object.keys(io[4]));let so;for(so=0;so<no.length;so+=1){const lo=get_each_context$1f(io,no,so);ro[so]?(ro[so].p(lo,ao),transition_in(ro[so],1)):(ro[so]=create_each_block$1f(lo),ro[so].c(),transition_in(ro[so],1),ro[so].m(ue.parentNode,ue))}for(group_outros(),so=no.length;so<ro.length;so+=1)oo(so);check_outros()}},i(io){if(!eo){for(let ao=0;ao<no.length;ao+=1)transition_in(ro[ao]);eo=!0}},o(io){ro=ro.filter(Boolean);for(let ao=0;ao<ro.length;ao+=1)transition_out(ro[ao]);eo=!1},d(io){io&&detach(ue),destroy_each(ro,io)}}}function create_if_block_3$M(to){let ue,eo,no;function ro(io){to[10](io,to[11])}let oo={label:capitalise$1(to[11]),options:to[3]};return to[0][to[11]]!==void 0&&(oo.value=to[0][to[11]]),ue=new Select_1$1({props:oo}),binding_callbacks.push(()=>bind$2(ue,"value",ro)),{c(){create_component(ue.$$.fragment)},m(io,ao){mount_component(ue,io,ao),no=!0},p(io,ao){to=io;const so={};ao&16&&(so.label=capitalise$1(to[11])),ao&8&&(so.options=to[3]),!eo&&ao&17&&(eo=!0,so.value=to[0][to[11]],add_flush_callback(()=>eo=!1)),ue.$set(so)},i(io){no||(transition_in(ue.$$.fragment,io),no=!0)},o(io){transition_out(ue.$$.fragment,io),no=!1},d(io){destroy_component(ue,io)}}}function create_if_block_2$11(to){let ue,eo,no;function ro(io){to[9](io,to[11])}let oo={label:capitalise$1(to[11]),options:to[3]};return to[0][to[11]]!==void 0&&(oo.value=to[0][to[11]]),ue=new Multiselect_1({props:oo}),binding_callbacks.push(()=>bind$2(ue,"value",ro)),{c(){create_component(ue.$$.fragment)},m(io,ao){mount_component(ue,io,ao),no=!0},p(io,ao){to=io;const so={};ao&16&&(so.label=capitalise$1(to[11])),ao&8&&(so.options=to[3]),!eo&&ao&17&&(eo=!0,so.value=to[0][to[11]],add_flush_callback(()=>eo=!1)),ue.$set(so)},i(io){no||(transition_in(ue.$$.fragment,io),no=!0)},o(io){transition_out(ue.$$.fragment,io),no=!1},d(io){destroy_component(ue,io)}}}function create_if_block_1$1y(to){let ue,eo;function no(...ro){return to[8](to[11],...ro)}return ue=new ModalBindableInput({props:{label:capitalise$1(to[11]),panel:ServerBindingPanel,title:"Prompt",value:to[0][to[11]],bindings:to[1],allowJS:!0,context:to[2]}}),ue.$on("change",no),{c(){create_component(ue.$$.fragment)},m(ro,oo){mount_component(ue,ro,oo),eo=!0},p(ro,oo){to=ro;const io={};oo&16&&(io.label=capitalise$1(to[11])),oo&17&&(io.value=to[0][to[11]]),oo&2&&(io.bindings=to[1]),oo&4&&(io.context=to[2]),ue.$set(io)},i(ro){eo||(transition_in(ue.$$.fragment,ro),eo=!0)},o(ro){transition_out(ue.$$.fragment,ro),eo=!1},d(ro){destroy_component(ue,ro)}}}function create_each_block$1f(to){let ue,eo,no,ro;const oo=[create_if_block_1$1y,create_if_block_2$11,create_if_block_3$M],io=[];function ao(so,lo){return so[4][so[11]]===OperationFieldTypes.BINDABLE_TEXT?0:so[4][so[11]]===OperationFieldTypes.MULTI_COLUMN?1:so[4][so[11]]===OperationFieldTypes.COLUMN?2:-1}return~(ue=ao(to))&&(eo=io[ue]=oo[ue](to)),{c(){eo&&eo.c(),no=empty$2()},m(so,lo){~ue&&io[ue].m(so,lo),insert$1(so,no,lo),ro=!0},p(so,lo){let co=ue;ue=ao(so),ue===co?~ue&&io[ue].p(so,lo):(eo&&(group_outros(),transition_out(io[co],1,1,()=>{io[co]=null}),check_outros()),~ue?(eo=io[ue],eo?eo.p(so,lo):(eo=io[ue]=oo[ue](so),eo.c()),transition_in(eo,1),eo.m(no.parentNode,no)):eo=null)},i(so){ro||(transition_in(eo),ro=!0)},o(so){transition_out(eo),ro=!1},d(so){so&&detach(no),~ue&&io[ue].d(so)}}}function create_fragment$6h(to){let ue,eo,no,ro,oo;function io(lo){to[7](lo)}let ao={label:"Operation",options:to[5]};to[0].operation!==void 0&&(ao.value=to[0].operation),ue=new Select_1$1({props:ao}),binding_callbacks.push(()=>bind$2(ue,"value",io));let so=to[0].operation&&create_if_block$32(to);return{c(){create_component(ue.$$.fragment),no=space$1(),so&&so.c(),ro=empty$2()},m(lo,co){mount_component(ue,lo,co),insert$1(lo,no,co),so&&so.m(lo,co),insert$1(lo,ro,co),oo=!0},p(lo,[co]){const uo={};!eo&&co&1&&(eo=!0,uo.value=lo[0].operation,add_flush_callback(()=>eo=!1)),ue.$set(uo),lo[0].operation?so?(so.p(lo,co),co&1&&transition_in(so,1)):(so=create_if_block$32(lo),so.c(),transition_in(so,1),so.m(ro.parentNode,ro)):so&&(group_outros(),transition_out(so,1,1,()=>{so=null}),check_outros())},i(lo){oo||(transition_in(ue.$$.fragment,lo),transition_in(so),oo=!0)},o(lo){transition_out(ue.$$.fragment,lo),transition_out(so),oo=!1},d(lo){lo&&(detach(no),detach(ro)),destroy_component(ue,lo),so&&so.d(lo)}}}function instance$6e(to,ue,eo){let no,ro;const oo=Object.keys(AIOperations).map(ho=>({label:AIOperations[ho].label,value:AIOperations[ho].value}));let{bindings:io}=ue,{context:ao}=ue,{schema:so}=ue,{aiField:lo={}}=ue;function co(ho){to.$$.not_equal(lo.operation,ho)&&(lo.operation=ho,eo(0,lo))}const uo=(ho,_o)=>eo(0,lo[ho]=_o.detail,lo);function fo(ho,_o){to.$$.not_equal(lo[_o],ho)&&(lo[_o]=ho,eo(0,lo))}function po(ho,_o){to.$$.not_equal(lo[_o],ho)&&(lo[_o]=ho,eo(0,lo))}return to.$$set=ho=>{"bindings"in ho&&eo(1,io=ho.bindings),"context"in ho&&eo(2,ao=ho.context),"schema"in ho&&eo(6,so=ho.schema),"aiField"in ho&&eo(0,lo=ho.aiField)},to.$$.update=()=>{to.$$.dirty&1&&eo(4,no=OperationFields[lo.operation]),to.$$.dirty&64&&eo(3,ro=Object.keys(so).filter(ho=>so[ho].type!=="link"))},[lo,io,ao,ro,no,oo,so,co,uo,fo,po]}class AIFieldConfiguration extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$6e,create_fragment$6h,safe_not_equal,{bindings:1,context:2,schema:6,aiField:0})}}const MAX_DEPTH=1,TYPES_TO_SKIP=[FieldType.FORMULA,FieldType.AI,FieldType.LONGFORM,FieldType.SIGNATURE_SINGLE,FieldType.ATTACHMENTS,FieldType.INTERNAL];function getBindings({table:to,path:ue=null,category:eo=null,depth:no=0}){let ro=[];if(!to)return ro;for(let[oo,io]of Object.entries(to.schema)){const ao=io.type===FieldType.LINK;if(TYPES_TO_SKIP.includes(io.type)||ao&&no>=MAX_DEPTH)continue;if(eo=eo??`${to.name} Fields`,ao&&no<MAX_DEPTH){const fo=get_store_value(tables).list.find(ho=>ho._id===io.tableId),po=ro.concat(getBindings({table:fo,path:oo,category:`${oo} Relationships`,depth:no+1}));ro=ro.concat(po.filter(ho=>!ro.find(_o=>_o.path===ho.path)))}const so=Object.values(FIELDS).find(fo=>fo.type===io.type),lo=ue==null?oo:`${ue}.0.${oo}`,co=ue==null?`[${oo}]`:`[${ue}].0.[${oo}]`,uo=ue==null?void 0:'Update the "0" with the index of relationships or use array helpers';ro.push({label:lo,type:so.name===FIELDS.LINK.name?"Array":so.name,category:eo,path:lo,description:uo,readableBinding:lo,runtimeBinding:co,display:{name:lo,type:so.name===FIELDS.LINK.name?"Array":so.name}})}return ro}function baseConversion(to){if(to==="string")return{type:FieldType.STRING};if(to==="boolean")return{type:FieldType.BOOLEAN};if(to==="number")return{type:FieldType.NUMBER}}function recurse(to={},ue){if(!ue)return null;const eo=typeof ue;if(eo!=="object")return baseConversion(eo);for(let[no,ro]of Object.entries(ue)){const oo=typeof ro;if(Array.isArray(ro)){const io=recurse(to[no],ro[0]);io&&(to[no]={type:FieldType.ARRAY,schema:io})}else if(oo==="object"){const io=recurse(to[no],ue[no]);io&&(to[no]=io)}else to[no]=baseConversion(oo)}return to.type?to:{type:FieldType.JSON,schema:to}}function generate(to){return recurse({},to).schema}const JSONSchemaModal_svelte_svelte_type_style_lang="";function get_each_context$1e(to,ue,eo){const no=to.slice();return no[17]=ue[eo],no[18]=ue,no[19]=eo,no}function create_each_block$1e(to){let ue,eo,no,ro,oo,io,ao,so,lo;function co(_o){to[10](_o,to[19])}let uo={outline:!0,label:"Key"};to[2][to[19]]!==void 0&&(uo.value=to[2][to[19]]),eo=new Input$5({props:uo}),binding_callbacks.push(()=>bind$2(eo,"value",co));function fo(_o){to[11](_o,to[19])}let po={label:"Type",options:to[5],getOptionValue:func$B,getOptionLabel:func_1$v};to[3][to[19]]!==void 0&&(po.value=to[3][to[19]]),oo=new Select_1$1({props:po}),binding_callbacks.push(()=>bind$2(oo,"value",fo));function ho(){return to[12](to[19])}return so=new ActionButton({props:{icon:"Close",quiet:!0}}),so.$on("click",ho),{c(){ue=element("div"),create_component(eo.$$.fragment),ro=space$1(),create_component(oo.$$.fragment),ao=space$1(),create_component(so.$$.fragment),attr(ue,"class","horizontal svelte-1foeviw")},m(_o,go){insert$1(_o,ue,go),mount_component(eo,ue,null),append$2(ue,ro),mount_component(oo,ue,null),append$2(ue,ao),mount_component(so,ue,null),lo=!0},p(_o,go){to=_o;const bo={};!no&&go&4&&(no=!0,bo.value=to[2][to[19]],add_flush_callback(()=>no=!1)),eo.$set(bo);const vo={};!io&&go&8&&(io=!0,vo.value=to[3][to[19]],add_flush_callback(()=>io=!1)),oo.$set(vo)},i(_o){lo||(transition_in(eo.$$.fragment,_o),transition_in(oo.$$.fragment,_o),transition_in(so.$$.fragment,_o),lo=!0)},o(_o){transition_out(eo.$$.fragment,_o),transition_out(oo.$$.fragment,_o),transition_out(so.$$.fragment,_o),lo=!1},d(_o){_o&&detach(ue),destroy_component(eo),destroy_component(oo),destroy_component(so)}}}function create_default_slot_6$T(to){let ue;return{c(){ue=text("Add Field")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_5$14(to){let ue,eo,no,ro,oo=ensure_array_like(Array(to[1])),io=[];for(let so=0;so<oo.length;so+=1)io[so]=create_each_block$1e(get_each_context$1e(to,oo,so));const ao=so=>transition_out(io[so],1,1,()=>{io[so]=null});return no=new Button({props:{primary:!0,text:!0,$$slots:{default:[create_default_slot_6$T]},$$scope:{ctx:to}}}),no.$on("click",to[13]),{c(){for(let so=0;so<io.length;so+=1)io[so].c();ue=space$1(),eo=element("div"),create_component(no.$$.fragment),attr(eo,"class","svelte-1foeviw"),toggle_class(eo,"add-field-btn",to[1]!==0)},m(so,lo){for(let co=0;co<io.length;co+=1)io[co]&&io[co].m(so,lo);insert$1(so,ue,lo),insert$1(so,eo,lo),mount_component(no,eo,null),ro=!0},p(so,lo){if(lo&302){oo=ensure_array_like(Array(so[1]));let uo;for(uo=0;uo<oo.length;uo+=1){const fo=get_each_context$1e(so,oo,uo);io[uo]?(io[uo].p(fo,lo),transition_in(io[uo],1)):(io[uo]=create_each_block$1e(fo),io[uo].c(),transition_in(io[uo],1),io[uo].m(ue.parentNode,ue))}for(group_outros(),uo=oo.length;uo<io.length;uo+=1)ao(uo);check_outros()}const co={};lo&1048576&&(co.$$scope={dirty:lo,ctx:so}),no.$set(co),(!ro||lo&2)&&toggle_class(eo,"add-field-btn",so[1]!==0)},i(so){if(!ro){for(let lo=0;lo<oo.length;lo+=1)transition_in(io[lo]);transition_in(no.$$.fragment,so),ro=!0}},o(so){io=io.filter(Boolean);for(let lo=0;lo<io.length;lo+=1)transition_out(io[lo]);transition_out(no.$$.fragment,so),ro=!1},d(so){so&&(detach(ue),detach(eo)),destroy_each(io,so),destroy_component(no)}}}function create_default_slot_4$1n(to){let ue;return{c(){ue=text(`Provide a sample JSON blob here to automatically determine your
|
|
1687
1687
|
schema.`)},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_3$1P(to){let ue,eo,no,ro;return ue=new Body({props:{size:"S",$$slots:{default:[create_default_slot_4$1n]},$$scope:{ctx:to}}}),no=new QueryEditor({props:{mode:"json",value:to[0]}}),no.$on("change",to[6]),{c(){create_component(ue.$$.fragment),eo=space$1(),create_component(no.$$.fragment)},m(oo,io){mount_component(ue,oo,io),insert$1(oo,eo,io),mount_component(no,oo,io),ro=!0},p(oo,io){const ao={};io&1048576&&(ao.$$scope={dirty:io,ctx:oo}),ue.$set(ao);const so={};io&1&&(so.value=oo[0]),no.$set(so)},i(oo){ro||(transition_in(ue.$$.fragment,oo),transition_in(no.$$.fragment,oo),ro=!0)},o(oo){transition_out(ue.$$.fragment,oo),transition_out(no.$$.fragment,oo),ro=!1},d(oo){oo&&detach(eo),destroy_component(ue,oo),destroy_component(no,oo)}}}function create_default_slot_2$2e(to){let ue,eo;return ue=new Layout$n({props:{noPadding:!0,gap:"XS",$$slots:{default:[create_default_slot_3$1P]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&1048577&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot_1$34(to){let ue,eo,no,ro;return ue=new Tab({props:{title:"Form",$$slots:{default:[create_default_slot_5$14]},$$scope:{ctx:to}}}),no=new Tab({props:{title:"JSON",$$slots:{default:[create_default_slot_2$2e]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment),eo=space$1(),create_component(no.$$.fragment)},m(oo,io){mount_component(ue,oo,io),insert$1(oo,eo,io),mount_component(no,oo,io),ro=!0},p(oo,io){const ao={};io&1048590&&(ao.$$scope={dirty:io,ctx:oo}),ue.$set(ao);const so={};io&1048577&&(so.$$scope={dirty:io,ctx:oo}),no.$set(so)},i(oo){ro||(transition_in(ue.$$.fragment,oo),transition_in(no.$$.fragment,oo),ro=!0)},o(oo){transition_out(ue.$$.fragment,oo),transition_out(no.$$.fragment,oo),ro=!1},d(oo){oo&&detach(eo),destroy_component(ue,oo),destroy_component(no,oo)}}}function create_default_slot$4b(to){let ue,eo;return ue=new Tabs({props:{selected:mode,noPadding:!0,$$slots:{default:[create_default_slot_1$34]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&1048591&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_fragment$6g(to){let ue,eo,no;function ro(io){to[14](io)}let oo={title:"JSON Schema Editor",confirmText:"Save Column",onConfirm:to[7],size:"L",$$slots:{default:[create_default_slot$4b]},$$scope:{ctx:to}};return to[4]!==void 0&&(oo.disabled=to[4]),ue=new ModalContent({props:oo}),binding_callbacks.push(()=>bind$2(ue,"disabled",ro)),{c(){create_component(ue.$$.fragment)},m(io,ao){mount_component(ue,io,ao),no=!0},p(io,[ao]){const so={};ao&1048591&&(so.$$scope={dirty:ao,ctx:io}),!eo&&ao&16&&(eo=!0,so.disabled=io[4],add_flush_callback(()=>eo=!1)),ue.$set(so)},i(io){no||(transition_in(ue.$$.fragment,io),no=!0)},o(io){transition_out(ue.$$.fragment,io),no=!1},d(io){destroy_component(ue,io)}}}let mode="Form";const func$B=to=>to.value,func_1$v=to=>to.label;function instance$6d(to,ue,eo){let{schema:no={}}=ue,{json:ro}=ue,oo=createEventDispatcher(),io=0,ao=[],so=[],lo=[{label:"String",value:FIELDS.STRING.type},{label:"Number",value:FIELDS.NUMBER.type},{label:"Boolean",value:FIELDS.BOOLEAN.type},{label:"Object",value:FIELDS.JSON.type},{label:"Array",value:FIELDS.ARRAY.type}],co=!1;async function uo({detail:wo}){const ko=wo.value;eo(0,ro=ko);try{let So=JSON.parse(ko);eo(9,no=generate(So)),fo(),eo(4,co=!1)}catch{eo(4,co=!0)}}function fo(){no||eo(9,no={});const wo=Object.entries(no).filter(([ko])=>!ao.includes(ko));for(let[ko,So]of wo)ao.push(ko),so.push(So.type);eo(1,io=ao.length)}function po(){const wo={};for(let[ko,So]of ao.entries())wo[So]={...no[So],type:so[ko]};oo("save",{schema:wo,json:ro}),eo(9,no=wo)}function ho(wo){const ko=ao[wo];if(ao[wo+1]!=null&&(eo(2,ao[wo]=ao[wo+1],ao),eo(3,so[wo]=so[wo+1],so)),ao.splice(wo,1),so.splice(wo,1),eo(1,io--,io),ro)try{const So=JSON.parse(ro);delete So[ko],eo(0,ro=JSON.stringify(So,null,2))}catch{}}onMount(()=>{fo()});function _o(wo,ko){to.$$.not_equal(ao[ko],wo)&&(ao[ko]=wo,eo(2,ao))}function go(wo,ko){to.$$.not_equal(so[ko],wo)&&(so[ko]=wo,eo(3,so))}const bo=wo=>ho(wo),vo=()=>eo(1,io++,io);function yo(wo){co=wo,eo(4,co)}return to.$$set=wo=>{"schema"in wo&&eo(9,no=wo.schema),"json"in wo&&eo(0,ro=wo.json)},[ro,io,ao,so,co,lo,uo,po,ho,no,_o,go,bo,vo,yo]}class JSONSchemaModal extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$6d,create_fragment$6g,safe_not_equal,{schema:9,json:0})}}function flip(to,{from:ue,to:eo},no={}){const ro=getComputedStyle(to),oo=ro.transform==="none"?"":ro.transform,[io,ao]=ro.transformOrigin.split(" ").map(parseFloat),so=ue.left+ue.width*io/eo.width-(eo.left+io),lo=ue.top+ue.height*ao/eo.height-(eo.top+ao),{delay:co=0,duration:uo=po=>Math.sqrt(po)*120,easing:fo=cubicOut}=no;return{delay:co,duration:is_function(uo)?uo(Math.sqrt(so*so+lo*lo)):uo,easing:fo,css:(po,ho)=>{const _o=ho*so,go=ho*lo,bo=po+ho*ue.width/eo.width,vo=po+ho*ue.height/eo.height;return`transform: ${oo} translate(${_o}px, ${go}px) scale(${bo}, ${vo});`}}}const FINALIZE_EVENT_NAME="finalize",CONSIDER_EVENT_NAME="consider";function dispatchFinalizeEvent(to,ue,eo){to.dispatchEvent(new CustomEvent(FINALIZE_EVENT_NAME,{detail:{items:ue,info:eo}}))}function dispatchConsiderEvent(to,ue,eo){to.dispatchEvent(new CustomEvent(CONSIDER_EVENT_NAME,{detail:{items:ue,info:eo}}))}const DRAGGED_ENTERED_EVENT_NAME="draggedEntered",DRAGGED_LEFT_EVENT_NAME="draggedLeft",DRAGGED_OVER_INDEX_EVENT_NAME="draggedOverIndex",DRAGGED_LEFT_DOCUMENT_EVENT_NAME="draggedLeftDocument",DRAGGED_LEFT_TYPES={LEFT_FOR_ANOTHER:"leftForAnother",OUTSIDE_OF_ANY:"outsideOfAny"};function dispatchDraggedElementEnteredContainer(to,ue,eo){to.dispatchEvent(new CustomEvent(DRAGGED_ENTERED_EVENT_NAME,{detail:{indexObj:ue,draggedEl:eo}}))}function dispatchDraggedElementLeftContainerForAnother(to,ue,eo){to.dispatchEvent(new CustomEvent(DRAGGED_LEFT_EVENT_NAME,{detail:{draggedEl:ue,type:DRAGGED_LEFT_TYPES.LEFT_FOR_ANOTHER,theOtherDz:eo}}))}function dispatchDraggedElementLeftContainerForNone(to,ue){to.dispatchEvent(new CustomEvent(DRAGGED_LEFT_EVENT_NAME,{detail:{draggedEl:ue,type:DRAGGED_LEFT_TYPES.OUTSIDE_OF_ANY}}))}function dispatchDraggedElementIsOverIndex(to,ue,eo){to.dispatchEvent(new CustomEvent(DRAGGED_OVER_INDEX_EVENT_NAME,{detail:{indexObj:ue,draggedEl:eo}}))}function dispatchDraggedLeftDocument(to){window.dispatchEvent(new CustomEvent(DRAGGED_LEFT_DOCUMENT_EVENT_NAME,{detail:{draggedEl:to}}))}const TRIGGERS={DRAG_STARTED:"dragStarted",DRAGGED_ENTERED:DRAGGED_ENTERED_EVENT_NAME,DRAGGED_ENTERED_ANOTHER:"dragEnteredAnother",DRAGGED_OVER_INDEX:DRAGGED_OVER_INDEX_EVENT_NAME,DRAGGED_LEFT:DRAGGED_LEFT_EVENT_NAME,DRAGGED_LEFT_ALL:"draggedLeftAll",DROPPED_INTO_ZONE:"droppedIntoZone",DROPPED_INTO_ANOTHER:"droppedIntoAnother",DROPPED_OUTSIDE_OF_ANY:"droppedOutsideOfAny",DRAG_STOPPED:"dragStopped"},SOURCES={POINTER:"pointer",KEYBOARD:"keyboard"},SHADOW_ITEM_MARKER_PROPERTY_NAME="isDndShadowItem",SHADOW_ELEMENT_ATTRIBUTE_NAME="data-is-dnd-shadow-item",SHADOW_PLACEHOLDER_ITEM_ID="id:dnd-shadow-placeholder-0000",DRAGGED_ELEMENT_ID="dnd-action-dragged-el";let ITEM_ID_KEY="id",activeDndZoneCount=0;function incrementActiveDropZoneCount(){activeDndZoneCount++}function decrementActiveDropZoneCount(){if(activeDndZoneCount===0)throw new Error("Bug! trying to decrement when there are no dropzones");activeDndZoneCount--}const isOnServer=typeof window>"u";function getBoundingRectNoTransforms(to){let ue;const eo=to.getBoundingClientRect(),no=getComputedStyle(to),ro=no.transform;if(ro){let oo,io,ao,so;if(ro.startsWith("matrix3d("))ue=ro.slice(9,-1).split(/, /),oo=+ue[0],io=+ue[5],ao=+ue[12],so=+ue[13];else if(ro.startsWith("matrix("))ue=ro.slice(7,-1).split(/, /),oo=+ue[0],io=+ue[3],ao=+ue[4],so=+ue[5];else return eo;const lo=no.transformOrigin,co=eo.x-ao-(1-oo)*parseFloat(lo),uo=eo.y-so-(1-io)*parseFloat(lo.slice(lo.indexOf(" ")+1)),fo=oo?eo.width/oo:to.offsetWidth,po=io?eo.height/io:to.offsetHeight;return{x:co,y:uo,width:fo,height:po,top:uo,right:co+fo,bottom:uo+po,left:co}}else return eo}function getAbsoluteRectNoTransforms(to){const ue=getBoundingRectNoTransforms(to);return{top:ue.top+window.scrollY,bottom:ue.bottom+window.scrollY,left:ue.left+window.scrollX,right:ue.right+window.scrollX}}function getAbsoluteRect(to){const ue=to.getBoundingClientRect();return{top:ue.top+window.scrollY,bottom:ue.bottom+window.scrollY,left:ue.left+window.scrollX,right:ue.right+window.scrollX}}function findCenter(to){return{x:(to.left+to.right)/2,y:(to.top+to.bottom)/2}}function calcDistance(to,ue){return Math.sqrt(Math.pow(to.x-ue.x,2)+Math.pow(to.y-ue.y,2))}function isPointInsideRect(to,ue){return to.y<=ue.bottom&&to.y>=ue.top&&to.x>=ue.left&&to.x<=ue.right}function findCenterOfElement(to){return findCenter(getAbsoluteRect(to))}function isCenterOfAInsideB(to,ue){const eo=findCenterOfElement(to),no=getAbsoluteRectNoTransforms(ue);return isPointInsideRect(eo,no)}function calcDistanceBetweenCenters(to,ue){const eo=findCenterOfElement(to),no=findCenterOfElement(ue);return calcDistance(eo,no)}function isElementOffDocument(to){const ue=getAbsoluteRect(to);return ue.right<0||ue.left>document.documentElement.scrollWidth||ue.bottom<0||ue.top>document.documentElement.scrollHeight}function calcInnerDistancesBetweenPointAndSidesOfElement(to,ue){const eo=getAbsoluteRect(ue);return isPointInsideRect(to,eo)?{top:to.y-eo.top,bottom:eo.bottom-to.y,left:to.x-eo.left,right:Math.min(eo.right,document.documentElement.clientWidth)-to.x}:null}let dzToShadowIndexToRect;function resetIndexesCache(){dzToShadowIndexToRect=new Map}resetIndexesCache();function resetIndexesCacheForDz(to){dzToShadowIndexToRect.delete(to)}function cacheShadowRect(to){const ue=Array.from(to.children).findIndex(eo=>eo.getAttribute(SHADOW_ELEMENT_ATTRIBUTE_NAME));if(ue>=0)return dzToShadowIndexToRect.has(to)||dzToShadowIndexToRect.set(to,new Map),dzToShadowIndexToRect.get(to).set(ue,getAbsoluteRectNoTransforms(to.children[ue])),ue}function findWouldBeIndex(to,ue){if(!isCenterOfAInsideB(to,ue))return null;const eo=ue.children;if(eo.length===0)return{index:0,isProximityBased:!0};const no=cacheShadowRect(ue);for(let io=0;io<eo.length;io++)if(isCenterOfAInsideB(to,eo[io])){const ao=dzToShadowIndexToRect.has(ue)&&dzToShadowIndexToRect.get(ue).get(io);return ao&&!isPointInsideRect(findCenterOfElement(to),ao)?{index:no,isProximityBased:!1}:{index:io,isProximityBased:!1}}let ro=Number.MAX_VALUE,oo;for(let io=0;io<eo.length;io++){const ao=calcDistanceBetweenCenters(to,eo[io]);ao<ro&&(ro=ao,oo=io)}return{index:oo,isProximityBased:!0}}const SCROLL_ZONE_PX=25;function makeScroller(){let to;function ue(){to={directionObj:void 0,stepPx:0}}ue();function eo(oo){const{directionObj:io,stepPx:ao}=to;io&&(oo.scrollBy(io.x*ao,io.y*ao),window.requestAnimationFrame(()=>eo(oo)))}function no(oo){return SCROLL_ZONE_PX-oo}function ro(oo,io){if(!io)return!1;const ao=calcInnerDistancesBetweenPointAndSidesOfElement(oo,io);if(ao===null)return ue(),!1;const so=!!to.directionObj;let[lo,co]=[!1,!1];return io.scrollHeight>io.clientHeight&&(ao.bottom<SCROLL_ZONE_PX?(lo=!0,to.directionObj={x:0,y:1},to.stepPx=no(ao.bottom)):ao.top<SCROLL_ZONE_PX&&(lo=!0,to.directionObj={x:0,y:-1},to.stepPx=no(ao.top)),!so&&lo)||io.scrollWidth>io.clientWidth&&(ao.right<SCROLL_ZONE_PX?(co=!0,to.directionObj={x:1,y:0},to.stepPx=no(ao.right)):ao.left<SCROLL_ZONE_PX&&(co=!0,to.directionObj={x:-1,y:0},to.stepPx=no(ao.left)),!so&&co)?(eo(io),!0):(ue(),!1)}return{scrollIfNeeded:ro,resetScrolling:ue}}function toString$1(to){return JSON.stringify(to,null,2)}function getDepth(to){if(!to)throw new Error("cannot get depth of a falsy node");return _getDepth(to,0)}function _getDepth(to,ue=0){return to.parentElement?_getDepth(to.parentElement,ue+1):ue-1}function areObjectsShallowEqual(to,ue){if(Object.keys(to).length!==Object.keys(ue).length)return!1;for(const eo in to)if(!{}.hasOwnProperty.call(ue,eo)||ue[eo]!==to[eo])return!1;return!0}function areArraysShallowEqualSameOrder(to,ue){if(to.length!==ue.length)return!1;for(let eo=0;eo<to.length;eo++)if(to[eo]!==ue[eo])return!1;return!0}const INTERVAL_MS$1=200,TOLERANCE_PX=10,{scrollIfNeeded:scrollIfNeeded$1,resetScrolling:resetScrolling$1}=makeScroller();let next$1;function observe(to,ue,eo=INTERVAL_MS$1){let no,ro,oo=!1,io;const ao=Array.from(ue).sort((lo,co)=>getDepth(co)-getDepth(lo));function so(){const lo=findCenterOfElement(to),co=scrollIfNeeded$1(lo,no);if(!co&&io&&Math.abs(io.x-lo.x)<TOLERANCE_PX&&Math.abs(io.y-lo.y)<TOLERANCE_PX){next$1=window.setTimeout(so,eo);return}if(isElementOffDocument(to)){dispatchDraggedLeftDocument(to);return}io=lo;let uo=!1;for(const fo of ao){co&&resetIndexesCacheForDz(no);const po=findWouldBeIndex(to,fo);if(po===null)continue;const{index:ho}=po;uo=!0,fo!==no?(no&&dispatchDraggedElementLeftContainerForAnother(no,to,fo),dispatchDraggedElementEnteredContainer(fo,po,to),no=fo):ho!==ro&&(dispatchDraggedElementIsOverIndex(fo,po,to),ro=ho);break}!uo&&oo&&no?(dispatchDraggedElementLeftContainerForNone(no,to),no=void 0,ro=void 0,oo=!1):oo=!0,next$1=window.setTimeout(so,eo)}so()}function unobserve(){clearTimeout(next$1),resetScrolling$1(),resetIndexesCache()}const INTERVAL_MS=300;let mousePosition;function updateMousePosition(to){const ue=to.touches?to.touches[0]:to;mousePosition={x:ue.clientX,y:ue.clientY}}const{scrollIfNeeded,resetScrolling}=makeScroller();let next;function loop(){mousePosition&&scrollIfNeeded(mousePosition,document.documentElement)&&resetIndexesCache(),next=window.setTimeout(loop,INTERVAL_MS)}function armWindowScroller(){window.addEventListener("mousemove",updateMousePosition),window.addEventListener("touchmove",updateMousePosition),loop()}function disarmWindowScroller(){window.removeEventListener("mousemove",updateMousePosition),window.removeEventListener("touchmove",updateMousePosition),mousePosition=void 0,window.clearTimeout(next),resetScrolling()}function svelteNodeClone(to){const ue=to.cloneNode(!0),eo=[],no=to.tagName==="SELECT",ro=no?[to]:[...to.querySelectorAll("select")];for(const io of ro)eo.push(io.value);if(ro.length<=0)return ue;const oo=no?[ue]:[...ue.querySelectorAll("select")];for(let io=0;io<oo.length;io++){const ao=oo[io],so=eo[io],lo=ao.querySelector(`option[value="${so}"`);lo&&lo.setAttribute("selected",!0)}return ue}const TRANSITION_DURATION_SECONDS=.2;function trs(to){return`${to} ${TRANSITION_DURATION_SECONDS}s ease`}function createDraggedElementFrom(to,ue){const eo=to.getBoundingClientRect(),no=svelteNodeClone(to);copyStylesFromTo(to,no),no.id=DRAGGED_ELEMENT_ID,no.style.position="fixed";let ro=eo.top,oo=eo.left;if(no.style.top=`${ro}px`,no.style.left=`${oo}px`,ue){const io=findCenter(eo);ro-=io.y-ue.y,oo-=io.x-ue.x,window.setTimeout(()=>{no.style.top=`${ro}px`,no.style.left=`${oo}px`},0)}return no.style.margin="0",no.style.boxSizing="border-box",no.style.height=`${eo.height}px`,no.style.width=`${eo.width}px`,no.style.transition=`${trs("top")}, ${trs("left")}, ${trs("background-color")}, ${trs("opacity")}, ${trs("color")} `,window.setTimeout(()=>no.style.transition+=`, ${trs("width")}, ${trs("height")}`,0),no.style.zIndex="9999",no.style.cursor="grabbing",no}function moveDraggedElementToWasDroppedState(to){to.style.cursor="grab"}function morphDraggedElementToBeLike(to,ue,eo,no){copyStylesFromTo(ue,to);const ro=ue.getBoundingClientRect(),oo=to.getBoundingClientRect(),io=ro.width-oo.width,ao=ro.height-oo.height;if(io||ao){const so={left:(eo-oo.left)/oo.width,top:(no-oo.top)/oo.height};to.style.height=`${ro.height}px`,to.style.width=`${ro.width}px`,to.style.left=`${parseFloat(to.style.left)-so.left*io}px`,to.style.top=`${parseFloat(to.style.top)-so.top*ao}px`}}function copyStylesFromTo(to,ue){const eo=window.getComputedStyle(to);Array.from(eo).filter(no=>no.startsWith("background")||no.startsWith("padding")||no.startsWith("font")||no.startsWith("text")||no.startsWith("align")||no.startsWith("justify")||no.startsWith("display")||no.startsWith("flex")||no.startsWith("border")||no==="opacity"||no==="color"||no==="list-style-type").forEach(no=>ue.style.setProperty(no,eo.getPropertyValue(no),eo.getPropertyPriority(no)))}function styleDraggable(to,ue){to.draggable=!1,to.ondragstart=()=>!1,ue?(to.style.userSelect="",to.style.WebkitUserSelect="",to.style.cursor=""):(to.style.userSelect="none",to.style.WebkitUserSelect="none",to.style.cursor="grab")}function hideElement(to){to.style.display="none",to.style.position="fixed",to.style.zIndex="-5"}function decorateShadowEl(to){to.style.visibility="hidden",to.setAttribute(SHADOW_ELEMENT_ATTRIBUTE_NAME,"true")}function unDecorateShadowElement(to){to.style.visibility="",to.removeAttribute(SHADOW_ELEMENT_ATTRIBUTE_NAME)}function styleActiveDropZones(to,ue=()=>{},eo=()=>[]){to.forEach(no=>{const ro=ue(no);Object.keys(ro).forEach(oo=>{no.style[oo]=ro[oo]}),eo(no).forEach(oo=>no.classList.add(oo))})}function styleInactiveDropZones(to,ue=()=>{},eo=()=>[]){to.forEach(no=>{const ro=ue(no);Object.keys(ro).forEach(oo=>{no.style[oo]=""}),eo(no).forEach(oo=>no.classList.contains(oo)&&no.classList.remove(oo))})}function preventShrinking(to){const ue=to.style.minHeight;to.style.minHeight=window.getComputedStyle(to).getPropertyValue("height");const eo=to.style.minWidth;return to.style.minWidth=window.getComputedStyle(to).getPropertyValue("width"),function(){to.style.minHeight=ue,to.style.minWidth=eo}}const DEFAULT_DROP_ZONE_TYPE$1="--any--",MIN_OBSERVATION_INTERVAL_MS=100,MIN_MOVEMENT_BEFORE_DRAG_START_PX=3,DEFAULT_DROP_TARGET_STYLE$1={outline:"rgba(255, 255, 102, 0.7) solid 2px"};let originalDragTarget,draggedEl,draggedElData,draggedElType,originDropZone,originIndex,shadowElData,shadowElDropZone,dragStartMousePosition,currentMousePosition,isWorkingOnPreviousDrag=!1,finalizingPreviousDrag=!1,unlockOriginDzMinDimensions,isDraggedOutsideOfAnyDz=!1,scheduledForRemovalAfterDrop=[];const typeToDropZones$1=new Map,dzToConfig$1=new Map,elToMouseDownListener=new WeakMap;function registerDropZone$1(to,ue){typeToDropZones$1.has(ue)||typeToDropZones$1.set(ue,new Set),typeToDropZones$1.get(ue).has(to)||(typeToDropZones$1.get(ue).add(to),incrementActiveDropZoneCount())}function unregisterDropZone$1(to,ue){typeToDropZones$1.get(ue).delete(to),decrementActiveDropZoneCount(),typeToDropZones$1.get(ue).size===0&&typeToDropZones$1.delete(ue)}function watchDraggedElement(){armWindowScroller();const to=typeToDropZones$1.get(draggedElType);for(const eo of to)eo.addEventListener(DRAGGED_ENTERED_EVENT_NAME,handleDraggedEntered),eo.addEventListener(DRAGGED_LEFT_EVENT_NAME,handleDraggedLeft),eo.addEventListener(DRAGGED_OVER_INDEX_EVENT_NAME,handleDraggedIsOverIndex);window.addEventListener(DRAGGED_LEFT_DOCUMENT_EVENT_NAME,handleDrop$1);const ue=Math.max(MIN_OBSERVATION_INTERVAL_MS,...Array.from(to.keys()).map(eo=>dzToConfig$1.get(eo).dropAnimationDurationMs));observe(draggedEl,to,ue*1.07)}function unWatchDraggedElement(){disarmWindowScroller();const to=typeToDropZones$1.get(draggedElType);for(const ue of to)ue.removeEventListener(DRAGGED_ENTERED_EVENT_NAME,handleDraggedEntered),ue.removeEventListener(DRAGGED_LEFT_EVENT_NAME,handleDraggedLeft),ue.removeEventListener(DRAGGED_OVER_INDEX_EVENT_NAME,handleDraggedIsOverIndex);window.removeEventListener(DRAGGED_LEFT_DOCUMENT_EVENT_NAME,handleDrop$1),unobserve()}function findShadowPlaceHolderIdx(to){return to.findIndex(ue=>ue[ITEM_ID_KEY]===SHADOW_PLACEHOLDER_ITEM_ID)}function findShadowElementIdx(to){return to.findIndex(ue=>!!ue[SHADOW_ITEM_MARKER_PROPERTY_NAME]&&ue[ITEM_ID_KEY]!==SHADOW_PLACEHOLDER_ITEM_ID)}function handleDraggedEntered(to){let{items:ue,dropFromOthersDisabled:eo}=dzToConfig$1.get(to.currentTarget);if(eo&&to.currentTarget!==originDropZone)return;if(isDraggedOutsideOfAnyDz=!1,ue=ue.filter(io=>io[ITEM_ID_KEY]!==shadowElData[ITEM_ID_KEY]),originDropZone!==to.currentTarget){const ao=dzToConfig$1.get(originDropZone).items.filter(so=>!so[SHADOW_ITEM_MARKER_PROPERTY_NAME]);dispatchConsiderEvent(originDropZone,ao,{trigger:TRIGGERS.DRAGGED_ENTERED_ANOTHER,id:draggedElData[ITEM_ID_KEY],source:SOURCES.POINTER})}else{const io=findShadowPlaceHolderIdx(ue);io!==-1&&ue.splice(io,1)}const{index:no,isProximityBased:ro}=to.detail.indexObj,oo=ro&&no===to.currentTarget.children.length-1?no+1:no;shadowElDropZone=to.currentTarget,ue.splice(oo,0,shadowElData),dispatchConsiderEvent(to.currentTarget,ue,{trigger:TRIGGERS.DRAGGED_ENTERED,id:draggedElData[ITEM_ID_KEY],source:SOURCES.POINTER})}function handleDraggedLeft(to){if(!isWorkingOnPreviousDrag)return;const{items:ue,dropFromOthersDisabled:eo}=dzToConfig$1.get(to.currentTarget);if(eo&&to.currentTarget!==originDropZone&&to.currentTarget!==shadowElDropZone)return;const no=findShadowElementIdx(ue),ro=ue.splice(no,1)[0];shadowElDropZone=void 0;const{type:oo,theOtherDz:io}=to.detail;if(oo===DRAGGED_LEFT_TYPES.OUTSIDE_OF_ANY||oo===DRAGGED_LEFT_TYPES.LEFT_FOR_ANOTHER&&io!==originDropZone&&dzToConfig$1.get(io).dropFromOthersDisabled){isDraggedOutsideOfAnyDz=!0,shadowElDropZone=originDropZone;const ao=dzToConfig$1.get(originDropZone).items;ao.splice(originIndex,0,ro),dispatchConsiderEvent(originDropZone,ao,{trigger:TRIGGERS.DRAGGED_LEFT_ALL,id:draggedElData[ITEM_ID_KEY],source:SOURCES.POINTER})}dispatchConsiderEvent(to.currentTarget,ue,{trigger:TRIGGERS.DRAGGED_LEFT,id:draggedElData[ITEM_ID_KEY],source:SOURCES.POINTER})}function handleDraggedIsOverIndex(to){const{items:ue,dropFromOthersDisabled:eo}=dzToConfig$1.get(to.currentTarget);if(eo&&to.currentTarget!==originDropZone)return;isDraggedOutsideOfAnyDz=!1;const{index:no}=to.detail.indexObj,ro=findShadowElementIdx(ue);ue.splice(ro,1),ue.splice(no,0,shadowElData),dispatchConsiderEvent(to.currentTarget,ue,{trigger:TRIGGERS.DRAGGED_OVER_INDEX,id:draggedElData[ITEM_ID_KEY],source:SOURCES.POINTER})}function handleMouseMove(to){to.preventDefault();const ue=to.touches?to.touches[0]:to;currentMousePosition={x:ue.clientX,y:ue.clientY},draggedEl.style.transform=`translate3d(${currentMousePosition.x-dragStartMousePosition.x}px, ${currentMousePosition.y-dragStartMousePosition.y}px, 0)`}function handleDrop$1(){finalizingPreviousDrag=!0,window.removeEventListener("mousemove",handleMouseMove),window.removeEventListener("touchmove",handleMouseMove),window.removeEventListener("mouseup",handleDrop$1),window.removeEventListener("touchend",handleDrop$1),unWatchDraggedElement(),moveDraggedElementToWasDroppedState(draggedEl),shadowElDropZone||(shadowElDropZone=originDropZone);let{items:to,type:ue}=dzToConfig$1.get(shadowElDropZone);styleInactiveDropZones(typeToDropZones$1.get(ue),ro=>dzToConfig$1.get(ro).dropTargetStyle,ro=>dzToConfig$1.get(ro).dropTargetClasses);let eo=findShadowElementIdx(to);eo===-1&&(eo=originIndex),to=to.map(ro=>ro[SHADOW_ITEM_MARKER_PROPERTY_NAME]?draggedElData:ro);function no(){unlockOriginDzMinDimensions(),dispatchFinalizeEvent(shadowElDropZone,to,{trigger:isDraggedOutsideOfAnyDz?TRIGGERS.DROPPED_OUTSIDE_OF_ANY:TRIGGERS.DROPPED_INTO_ZONE,id:draggedElData[ITEM_ID_KEY],source:SOURCES.POINTER}),shadowElDropZone!==originDropZone&&dispatchFinalizeEvent(originDropZone,dzToConfig$1.get(originDropZone).items,{trigger:TRIGGERS.DROPPED_INTO_ANOTHER,id:draggedElData[ITEM_ID_KEY],source:SOURCES.POINTER}),unDecorateShadowElement(shadowElDropZone.children[eo]),cleanupPostDrop()}animateDraggedToFinalPosition(eo,no)}function animateDraggedToFinalPosition(to,ue){const eo=getBoundingRectNoTransforms(shadowElDropZone.children[to]),no={x:eo.left-parseFloat(draggedEl.style.left),y:eo.top-parseFloat(draggedEl.style.top)},{dropAnimationDurationMs:ro}=dzToConfig$1.get(shadowElDropZone),oo=`transform ${ro}ms ease`;draggedEl.style.transition=draggedEl.style.transition?draggedEl.style.transition+","+oo:oo,draggedEl.style.transform=`translate3d(${no.x}px, ${no.y}px, 0)`,window.setTimeout(ue,ro)}function scheduleDZForRemovalAfterDrop(to,ue){scheduledForRemovalAfterDrop.push({dz:to,destroy:ue}),window.requestAnimationFrame(()=>{hideElement(to),document.body.appendChild(to)})}function cleanupPostDrop(){draggedEl.remove(),originalDragTarget.remove(),scheduledForRemovalAfterDrop.length&&(scheduledForRemovalAfterDrop.forEach(({dz:to,destroy:ue})=>{ue(),to.remove()}),scheduledForRemovalAfterDrop=[]),draggedEl=void 0,originalDragTarget=void 0,draggedElData=void 0,draggedElType=void 0,originDropZone=void 0,originIndex=void 0,shadowElData=void 0,shadowElDropZone=void 0,dragStartMousePosition=void 0,currentMousePosition=void 0,isWorkingOnPreviousDrag=!1,finalizingPreviousDrag=!1,unlockOriginDzMinDimensions=void 0,isDraggedOutsideOfAnyDz=!1}function dndzone$2(to,ue){let eo=!1;const no={items:void 0,type:void 0,flipDurationMs:0,dragDisabled:!1,morphDisabled:!1,dropFromOthersDisabled:!1,dropTargetStyle:DEFAULT_DROP_TARGET_STYLE$1,dropTargetClasses:[],transformDraggedElement:()=>{},centreDraggedOnCursor:!1};let ro=new Map;function oo(){window.addEventListener("mousemove",so,{passive:!1}),window.addEventListener("touchmove",so,{passive:!1,capture:!1}),window.addEventListener("mouseup",ao,{passive:!1}),window.addEventListener("touchend",ao,{passive:!1})}function io(){window.removeEventListener("mousemove",so),window.removeEventListener("touchmove",so),window.removeEventListener("mouseup",ao),window.removeEventListener("touchend",ao)}function ao(){io(),originalDragTarget=void 0,dragStartMousePosition=void 0,currentMousePosition=void 0}function so(fo){fo.preventDefault();const po=fo.touches?fo.touches[0]:fo;currentMousePosition={x:po.clientX,y:po.clientY},(Math.abs(currentMousePosition.x-dragStartMousePosition.x)>=MIN_MOVEMENT_BEFORE_DRAG_START_PX||Math.abs(currentMousePosition.y-dragStartMousePosition.y)>=MIN_MOVEMENT_BEFORE_DRAG_START_PX)&&(io(),co())}function lo(fo){if(fo.target!==fo.currentTarget&&(fo.target.value!==void 0||fo.target.isContentEditable)||fo.button||isWorkingOnPreviousDrag)return;fo.stopPropagation();const po=fo.touches?fo.touches[0]:fo;dragStartMousePosition={x:po.clientX,y:po.clientY},currentMousePosition={...dragStartMousePosition},originalDragTarget=fo.currentTarget,oo()}function co(){isWorkingOnPreviousDrag=!0;const fo=ro.get(originalDragTarget);originIndex=fo,originDropZone=originalDragTarget.parentElement;const po=originDropZone.getRootNode(),ho=po.body||po,{items:_o,type:go,centreDraggedOnCursor:bo}=no;draggedElData={..._o[fo]},draggedElType=go,shadowElData={...draggedElData,[SHADOW_ITEM_MARKER_PROPERTY_NAME]:!0};const vo={...shadowElData,[ITEM_ID_KEY]:SHADOW_PLACEHOLDER_ITEM_ID};draggedEl=createDraggedElementFrom(originalDragTarget,bo&¤tMousePosition);function yo(){draggedEl.parentElement?window.requestAnimationFrame(yo):(ho.appendChild(draggedEl),draggedEl.focus(),watchDraggedElement(),hideElement(originalDragTarget),ho.appendChild(originalDragTarget))}window.requestAnimationFrame(yo),styleActiveDropZones(Array.from(typeToDropZones$1.get(no.type)).filter(wo=>wo===originDropZone||!dzToConfig$1.get(wo).dropFromOthersDisabled),wo=>dzToConfig$1.get(wo).dropTargetStyle,wo=>dzToConfig$1.get(wo).dropTargetClasses),_o.splice(fo,1,vo),unlockOriginDzMinDimensions=preventShrinking(originDropZone),dispatchConsiderEvent(originDropZone,_o,{trigger:TRIGGERS.DRAG_STARTED,id:draggedElData[ITEM_ID_KEY],source:SOURCES.POINTER}),window.addEventListener("mousemove",handleMouseMove,{passive:!1}),window.addEventListener("touchmove",handleMouseMove,{passive:!1,capture:!1}),window.addEventListener("mouseup",handleDrop$1,{passive:!1}),window.addEventListener("touchend",handleDrop$1,{passive:!1})}function uo({items:fo=void 0,flipDurationMs:po=0,type:ho=DEFAULT_DROP_ZONE_TYPE$1,dragDisabled:_o=!1,morphDisabled:go=!1,dropFromOthersDisabled:bo=!1,dropTargetStyle:vo=DEFAULT_DROP_TARGET_STYLE$1,dropTargetClasses:yo=[],transformDraggedElement:wo=()=>{},centreDraggedOnCursor:ko=!1}){no.dropAnimationDurationMs=po,no.type&&ho!==no.type&&unregisterDropZone$1(to,no.type),no.type=ho,registerDropZone$1(to,ho),no.items=[...fo],no.dragDisabled=_o,no.morphDisabled=go,no.transformDraggedElement=wo,no.centreDraggedOnCursor=ko,eo&&isWorkingOnPreviousDrag&&!finalizingPreviousDrag&&(!areObjectsShallowEqual(vo,no.dropTargetStyle)||!areArraysShallowEqualSameOrder(yo,no.dropTargetClasses))&&(styleInactiveDropZones([to],()=>no.dropTargetStyle,()=>yo),styleActiveDropZones([to],()=>vo,()=>yo)),no.dropTargetStyle=vo,no.dropTargetClasses=[...yo];function So(Io,Ao){return dzToConfig$1.get(Io)?dzToConfig$1.get(Io)[Ao]:no[Ao]}eo&&isWorkingOnPreviousDrag&&no.dropFromOthersDisabled!==bo&&(bo?styleInactiveDropZones([to],Io=>So(Io,"dropTargetStyle"),Io=>So(Io,"dropTargetClasses")):styleActiveDropZones([to],Io=>So(Io,"dropTargetStyle"),Io=>So(Io,"dropTargetClasses"))),no.dropFromOthersDisabled=bo,dzToConfig$1.set(to,no);const Eo=findShadowElementIdx(no.items);for(let Io=0;Io<to.children.length;Io++){const Ao=to.children[Io];if(styleDraggable(Ao,_o),Io===Eo){no.transformDraggedElement(draggedEl,draggedElData,Io),go||morphDraggedElementToBeLike(draggedEl,Ao,currentMousePosition.x,currentMousePosition.y),decorateShadowEl(Ao);continue}Ao.removeEventListener("mousedown",elToMouseDownListener.get(Ao)),Ao.removeEventListener("touchstart",elToMouseDownListener.get(Ao)),_o||(Ao.addEventListener("mousedown",lo),Ao.addEventListener("touchstart",lo),elToMouseDownListener.set(Ao,lo)),ro.set(Ao,Io),eo||(eo=!0)}}return uo(ue),{update:fo=>{uo(fo)},destroy:()=>{function fo(){unregisterDropZone$1(to,dzToConfig$1.get(to).type),dzToConfig$1.delete(to)}isWorkingOnPreviousDrag?scheduleDZForRemovalAfterDrop(to,fo):fo()}}}const INSTRUCTION_IDs$1={DND_ZONE_ACTIVE:"dnd-zone-active",DND_ZONE_DRAG_DISABLED:"dnd-zone-drag-disabled"},ID_TO_INSTRUCTION={[INSTRUCTION_IDs$1.DND_ZONE_ACTIVE]:"Tab to one the items and press space-bar or enter to start dragging it",[INSTRUCTION_IDs$1.DND_ZONE_DRAG_DISABLED]:"This is a disabled drag and drop list"},ALERT_DIV_ID="dnd-action-aria-alert";let alertsDiv;function initAriaOnBrowser(){alertsDiv||(alertsDiv=document.createElement("div"),function(){alertsDiv.id=ALERT_DIV_ID,alertsDiv.style.position="fixed",alertsDiv.style.bottom="0",alertsDiv.style.left="0",alertsDiv.style.zIndex="-5",alertsDiv.style.opacity="0",alertsDiv.style.height="0",alertsDiv.style.width="0",alertsDiv.setAttribute("role","alert")}(),document.body.prepend(alertsDiv),Object.entries(ID_TO_INSTRUCTION).forEach(([to,ue])=>document.body.prepend(instructionToHiddenDiv(to,ue))))}function initAria(){return isOnServer?null:(document.readyState==="complete"?initAriaOnBrowser():window.addEventListener("DOMContentLoaded",initAriaOnBrowser),{...INSTRUCTION_IDs$1})}function destroyAria(){isOnServer||!alertsDiv||(Object.keys(ID_TO_INSTRUCTION).forEach(to=>{var ue;return(ue=document.getElementById(to))==null?void 0:ue.remove()}),alertsDiv.remove(),alertsDiv=void 0)}function instructionToHiddenDiv(to,ue){const eo=document.createElement("div");return eo.id=to,eo.innerHTML=`<p>${ue}</p>`,eo.style.display="none",eo.style.position="fixed",eo.style.zIndex="-5",eo}function alertToScreenReader(to){if(isOnServer)return;alertsDiv||initAriaOnBrowser(),alertsDiv.innerHTML="";const ue=document.createTextNode(to);alertsDiv.appendChild(ue),alertsDiv.style.display="none",alertsDiv.style.display="inline"}const DEFAULT_DROP_ZONE_TYPE="--any--",DEFAULT_DROP_TARGET_STYLE={outline:"rgba(255, 255, 102, 0.7) solid 2px"};let isDragging=!1,draggedItemType,focusedDz,focusedDzLabel="",focusedItem,focusedItemId,focusedItemLabel="";const allDragTargets=new WeakSet,elToKeyDownListeners=new WeakMap,elToFocusListeners=new WeakMap,dzToHandles=new Map,dzToConfig=new Map,typeToDropZones=new Map;let INSTRUCTION_IDs;function registerDropZone(to,ue){typeToDropZones.size===0&&(INSTRUCTION_IDs=initAria(),window.addEventListener("keydown",globalKeyDownHandler),window.addEventListener("click",globalClickHandler)),typeToDropZones.has(ue)||typeToDropZones.set(ue,new Set),typeToDropZones.get(ue).has(to)||(typeToDropZones.get(ue).add(to),incrementActiveDropZoneCount())}function unregisterDropZone(to,ue){focusedDz===to&&handleDrop(),typeToDropZones.get(ue).delete(to),decrementActiveDropZoneCount(),typeToDropZones.get(ue).size===0&&typeToDropZones.delete(ue),typeToDropZones.size===0&&(window.removeEventListener("keydown",globalKeyDownHandler),window.removeEventListener("click",globalClickHandler),INSTRUCTION_IDs=void 0,destroyAria())}function globalKeyDownHandler(to){if(isDragging)switch(to.key){case"Escape":{handleDrop();break}}}function globalClickHandler(){isDragging&&(allDragTargets.has(document.activeElement)||handleDrop())}function handleZoneFocus(to){if(!isDragging)return;const ue=to.currentTarget;if(ue===focusedDz)return;focusedDzLabel=ue.getAttribute("aria-label")||"";const{items:eo}=dzToConfig.get(focusedDz),no=eo.find(lo=>lo[ITEM_ID_KEY]===focusedItemId),ro=eo.indexOf(no),oo=eo.splice(ro,1)[0],{items:io,autoAriaDisabled:ao}=dzToConfig.get(ue);ue.getBoundingClientRect().top<focusedDz.getBoundingClientRect().top||ue.getBoundingClientRect().left<focusedDz.getBoundingClientRect().left?(io.push(oo),ao||alertToScreenReader(`Moved item ${focusedItemLabel} to the end of the list ${focusedDzLabel}`)):(io.unshift(oo),ao||alertToScreenReader(`Moved item ${focusedItemLabel} to the beginning of the list ${focusedDzLabel}`)),dispatchFinalizeEvent(focusedDz,eo,{trigger:TRIGGERS.DROPPED_INTO_ANOTHER,id:focusedItemId,source:SOURCES.KEYBOARD}),dispatchFinalizeEvent(ue,io,{trigger:TRIGGERS.DROPPED_INTO_ZONE,id:focusedItemId,source:SOURCES.KEYBOARD}),focusedDz=ue}function triggerAllDzsUpdate(){dzToHandles.forEach(({update:to},ue)=>to(dzToConfig.get(ue)))}function handleDrop(to=!0){dzToConfig.get(focusedDz).autoAriaDisabled||alertToScreenReader(`Stopped dragging item ${focusedItemLabel}`),allDragTargets.has(document.activeElement)&&document.activeElement.blur(),to&&dispatchConsiderEvent(focusedDz,dzToConfig.get(focusedDz).items,{trigger:TRIGGERS.DRAG_STOPPED,id:focusedItemId,source:SOURCES.KEYBOARD}),styleInactiveDropZones(typeToDropZones.get(draggedItemType),ue=>dzToConfig.get(ue).dropTargetStyle,ue=>dzToConfig.get(ue).dropTargetClasses),focusedItem=null,focusedItemId=null,focusedItemLabel="",draggedItemType=null,focusedDz=null,focusedDzLabel="",isDragging=!1,triggerAllDzsUpdate()}function dndzone$1(to,ue){const eo={items:void 0,type:void 0,dragDisabled:!1,zoneTabIndex:0,dropFromOthersDisabled:!1,dropTargetStyle:DEFAULT_DROP_TARGET_STYLE,dropTargetClasses:[],autoAriaDisabled:!1};function no(co,uo,fo){co.length<=1||co.splice(fo,1,co.splice(uo,1,co[fo])[0])}function ro(co){switch(co.key){case"Enter":case" ":{if((co.target.disabled!==void 0||co.target.href||co.target.isContentEditable)&&!allDragTargets.has(co.target))return;co.preventDefault(),co.stopPropagation(),isDragging?handleDrop():oo(co);break}case"ArrowDown":case"ArrowRight":{if(!isDragging)return;co.preventDefault(),co.stopPropagation();const{items:uo}=dzToConfig.get(to),fo=Array.from(to.children),po=fo.indexOf(co.currentTarget);po<fo.length-1&&(eo.autoAriaDisabled||alertToScreenReader(`Moved item ${focusedItemLabel} to position ${po+2} in the list ${focusedDzLabel}`),no(uo,po,po+1),dispatchFinalizeEvent(to,uo,{trigger:TRIGGERS.DROPPED_INTO_ZONE,id:focusedItemId,source:SOURCES.KEYBOARD}));break}case"ArrowUp":case"ArrowLeft":{if(!isDragging)return;co.preventDefault(),co.stopPropagation();const{items:uo}=dzToConfig.get(to),po=Array.from(to.children).indexOf(co.currentTarget);po>0&&(eo.autoAriaDisabled||alertToScreenReader(`Moved item ${focusedItemLabel} to position ${po} in the list ${focusedDzLabel}`),no(uo,po,po-1),dispatchFinalizeEvent(to,uo,{trigger:TRIGGERS.DROPPED_INTO_ZONE,id:focusedItemId,source:SOURCES.KEYBOARD}));break}}}function oo(co){ao(co.currentTarget),focusedDz=to,draggedItemType=eo.type,isDragging=!0;const uo=Array.from(typeToDropZones.get(eo.type)).filter(fo=>fo===focusedDz||!dzToConfig.get(fo).dropFromOthersDisabled);if(styleActiveDropZones(uo,fo=>dzToConfig.get(fo).dropTargetStyle,fo=>dzToConfig.get(fo).dropTargetClasses),!eo.autoAriaDisabled){let fo=`Started dragging item ${focusedItemLabel}. Use the arrow keys to move it within its list ${focusedDzLabel}`;uo.length>1&&(fo+=", or tab to another list in order to move the item into it"),alertToScreenReader(fo)}dispatchConsiderEvent(to,dzToConfig.get(to).items,{trigger:TRIGGERS.DRAG_STARTED,id:focusedItemId,source:SOURCES.KEYBOARD}),triggerAllDzsUpdate()}function io(co){isDragging&&co.currentTarget!==focusedItem&&(co.stopPropagation(),handleDrop(!1),oo(co))}function ao(co){const{items:uo}=dzToConfig.get(to),fo=Array.from(to.children),po=fo.indexOf(co);focusedItem=co,focusedItem.tabIndex=0,focusedItemId=uo[po][ITEM_ID_KEY],focusedItemLabel=fo[po].getAttribute("aria-label")||""}function so({items:co=[],type:uo=DEFAULT_DROP_ZONE_TYPE,dragDisabled:fo=!1,zoneTabIndex:po=0,dropFromOthersDisabled:ho=!1,dropTargetStyle:_o=DEFAULT_DROP_TARGET_STYLE,dropTargetClasses:go=[],autoAriaDisabled:bo=!1}){eo.items=[...co],eo.dragDisabled=fo,eo.dropFromOthersDisabled=ho,eo.zoneTabIndex=po,eo.dropTargetStyle=_o,eo.dropTargetClasses=go,eo.autoAriaDisabled=bo,eo.type&&uo!==eo.type&&unregisterDropZone(to,eo.type),eo.type=uo,registerDropZone(to,uo),bo||(to.setAttribute("aria-disabled",fo),to.setAttribute("role","list"),to.setAttribute("aria-describedby",fo?INSTRUCTION_IDs.DND_ZONE_DRAG_DISABLED:INSTRUCTION_IDs.DND_ZONE_ACTIVE)),dzToConfig.set(to,eo),isDragging?to.tabIndex=to===focusedDz||focusedItem.contains(to)||eo.dropFromOthersDisabled||focusedDz&&eo.type!==dzToConfig.get(focusedDz).type?-1:0:to.tabIndex=eo.zoneTabIndex,to.addEventListener("focus",handleZoneFocus);for(let vo=0;vo<to.children.length;vo++){const yo=to.children[vo];allDragTargets.add(yo),yo.tabIndex=isDragging?-1:0,bo||yo.setAttribute("role","listitem"),yo.removeEventListener("keydown",elToKeyDownListeners.get(yo)),yo.removeEventListener("click",elToFocusListeners.get(yo)),fo||(yo.addEventListener("keydown",ro),elToKeyDownListeners.set(yo,ro),yo.addEventListener("click",io),elToFocusListeners.set(yo,io)),isDragging&&eo.items[vo][ITEM_ID_KEY]===focusedItemId&&(focusedItem=yo,focusedItem.tabIndex=0,yo.focus())}}so(ue);const lo={update:co=>{so(co)},destroy:()=>{unregisterDropZone(to,eo.type),dzToConfig.delete(to),dzToHandles.delete(to)}};return dzToHandles.set(to,lo),lo}function dndzone(to,ue){validateOptions(ue);const eo=dndzone$2(to,ue),no=dndzone$1(to,ue);return{update:ro=>{validateOptions(ro),eo.update(ro),no.update(ro)},destroy:()=>{eo.destroy(),no.destroy()}}}function validateOptions(to){const{items:ue,flipDurationMs:eo,type:no,dragDisabled:ro,morphDisabled:oo,dropFromOthersDisabled:io,zoneTabIndex:ao,dropTargetStyle:so,dropTargetClasses:lo,transformDraggedElement:co,autoAriaDisabled:uo,centreDraggedOnCursor:fo,...po}=to;if(Object.keys(po).length>0&&console.warn("dndzone will ignore unknown options",po),!ue)throw new Error("no 'items' key provided to dndzone");const ho=ue.find(_o=>!{}.hasOwnProperty.call(_o,ITEM_ID_KEY));if(ho)throw new Error(`missing '${ITEM_ID_KEY}' property for item ${toString$1(ho)}`);if(lo&&!Array.isArray(lo))throw new Error(`dropTargetClasses should be an array but instead it is a ${typeof lo}, ${toString$1(lo)}`);if(ao&&!isInt(ao))throw new Error(`zoneTabIndex should be a number but instead it is a ${typeof ao}, ${toString$1(ao)}`)}function isInt(to){return!isNaN(to)&&function(ue){return(ue|0)===ue}(parseFloat(to))}const OptionsEditor_svelte_svelte_type_style_lang$1="";function get_each_context$1d(to,ue,eo){const no=to.slice();return no[23]=ue[eo],no}function get_each_context_1$m(to,ue,eo){const no=to.slice();return no[26]=ue[eo],no}function create_each_block_1$m(to){let ue,eo,no;function ro(){return to[15](to[23],to[26])}return{c(){ue=element("div"),set_style(ue,"--color",to[26]),attr(ue,"class","circle svelte-1yuop98"),toggle_class(ue,"selected",to[26]===to[23].color)},m(oo,io){insert$1(oo,ue,io),eo||(no=listen(ue,"click",ro),eo=!0)},p(oo,io){to=oo,io&17&&toggle_class(ue,"selected",to[26]===to[23].color)},d(oo){oo&&detach(ue),eo=!1,no()}}}function create_default_slot$4a(to){let ue,eo=ensure_array_like(to[4]),no=[];for(let ro=0;ro<eo.length;ro+=1)no[ro]=create_each_block_1$m(get_each_context_1$m(to,eo,ro));return{c(){ue=element("div");for(let ro=0;ro<no.length;ro+=1)no[ro].c();attr(ue,"class","colors svelte-1yuop98"),attr(ue,"data-ignore-click-outside","true")},m(ro,oo){insert$1(ro,ue,oo);for(let io=0;io<no.length;io+=1)no[io]&&no[io].m(ue,null)},p(ro,oo){if(oo&1041){eo=ensure_array_like(ro[4]);let io;for(io=0;io<eo.length;io+=1){const ao=get_each_context_1$m(ro,eo,io);no[io]?no[io].p(ao,oo):(no[io]=create_each_block_1$m(ao),no[io].c(),no[io].m(ue,null))}for(;io<no.length;io+=1)no[io].d(1);no.length=eo.length}},d(ro){ro&&detach(ue),destroy_each(no,ro)}}}function create_each_block$1d(to,ue){let eo,no,ro,oo,io,ao,so,lo,co,uo,fo,po,ho,_o,go,bo,vo=noop$6,yo,wo,ko;ro=new Icon({props:{name:"DragHandle",size:"L"}}),so=new Popover({props:{open:ue[1]===ue[23].id,anchor:ue[2],align:"left",offset:0,animate:!1,resizable:!1,$$slots:{default:[create_default_slot$4a]},$$scope:{ctx:ue}}});function So(){return ue[16](ue[23])}function Eo(...Ao){return ue[17](ue[23],...Ao)}function Io(){return ue[18](ue[23])}return _o=new Icon({props:{name:"Close",hoverable:!0,size:"S"}}),_o.$on("click",Io),{key:to,first:null,c(){eo=element("div"),no=element("div"),create_component(ro.$$.fragment),oo=space$1(),io=element("div"),ao=element("div"),create_component(so.$$.fragment),co=space$1(),uo=element("input"),ho=space$1(),create_component(_o.$$.fragment),go=space$1(),attr(no,"class","drag-handle"),attr(ao,"class","circle svelte-1yuop98"),set_style(ao,"--color",ue[23].color),attr(io,"id",lo="color-"+ue[23].id),attr(io,"class","color-picker svelte-1yuop98"),attr(uo,"class","option-name svelte-1yuop98"),attr(uo,"type","text"),uo.value=fo=ue[23].name,attr(uo,"placeholder","Option name"),attr(uo,"id",po="option-"+ue[23].id),attr(eo,"class","option svelte-1yuop98"),toggle_class(eo,"invalid",!ue[23].valid),this.first=eo},m(Ao,To){insert$1(Ao,eo,To),append$2(eo,no),mount_component(ro,no,null),append$2(eo,oo),append$2(eo,io),append$2(io,ao),mount_component(so,ao,null),append$2(eo,co),append$2(eo,uo),append$2(eo,ho),mount_component(_o,eo,null),append$2(eo,go),yo=!0,wo||(ko=[listen(io,"click",So),listen(uo,"input",Eo)],wo=!0)},p(Ao,To){ue=Ao;const Mo={};To&3&&(Mo.open=ue[1]===ue[23].id),To&4&&(Mo.anchor=ue[2]),To&536870913&&(Mo.$$scope={dirty:To,ctx:ue}),so.$set(Mo),(!yo||To&1)&&set_style(ao,"--color",ue[23].color),(!yo||To&1&&lo!==(lo="color-"+ue[23].id))&&attr(io,"id",lo),(!yo||To&1&&fo!==(fo=ue[23].name)&&uo.value!==fo)&&(uo.value=fo),(!yo||To&1&&po!==(po="option-"+ue[23].id))&&attr(uo,"id",po),(!yo||To&1)&&toggle_class(eo,"invalid",!ue[23].valid)},r(){bo=eo.getBoundingClientRect()},f(){fix_position(eo),vo()},a(){vo(),vo=create_animation(eo,bo,flip,{duration:flipDurationMs$4})},i(Ao){yo||(transition_in(ro.$$.fragment,Ao),transition_in(so.$$.fragment,Ao),transition_in(_o.$$.fragment,Ao),yo=!0)},o(Ao){transition_out(ro.$$.fragment,Ao),transition_out(so.$$.fragment,Ao),transition_out(_o.$$.fragment,Ao),yo=!1},d(Ao){Ao&&detach(eo),destroy_component(ro),destroy_component(so),destroy_component(_o),wo=!1,run_all(ko)}}}function create_fragment$6f(to){let ue,eo,no=[],ro=new Map,oo,io,ao,so,lo,co,uo,fo,po,ho=ensure_array_like(to[0]);const _o=go=>go[23].id;for(let go=0;go<ho.length;go+=1){let bo=get_each_context$1d(to,ho,go),vo=_o(bo);ro.set(vo,no[go]=create_each_block$1d(vo,bo))}return so=new Icon({props:{name:"Add"}}),{c(){ue=element("div"),eo=element("div");for(let go=0;go<no.length;go+=1)no[go].c();io=space$1(),ao=element("div"),create_component(so.$$.fragment),lo=space$1(),co=element("div"),co.textContent="Add option",attr(eo,"class","options svelte-1yuop98"),attr(ao,"class","add-option svelte-1yuop98"),attr(ue,"class","wrapper svelte-1yuop98")},m(go,bo){insert$1(go,ue,bo),append$2(ue,eo);for(let vo=0;vo<no.length;vo+=1)no[vo]&&no[vo].m(eo,null);append$2(ue,io),append$2(ue,ao),mount_component(so,ao,null),append$2(ao,lo),append$2(ao,co),uo=!0,fo||(po=[action_destroyer(oo=dndzone.call(null,eo,{items:to[3],flipDurationMs:flipDurationMs$4,dropTargetStyle:{outline:"none"}})),listen(eo,"consider",to[19]),listen(eo,"finalize",to[20]),listen(ao,"click",to[7])],fo=!0)},p(go,[bo]){if(bo&3863){ho=ensure_array_like(go[0]),group_outros();for(let vo=0;vo<no.length;vo+=1)no[vo].r();no=update_keyed_each(no,bo,_o,1,go,ho,ro,eo,fix_and_outro_and_destroy_block,create_each_block$1d,null,get_each_context$1d);for(let vo=0;vo<no.length;vo+=1)no[vo].a();check_outros()}oo&&is_function(oo.update)&&bo&8&&oo.update.call(null,{items:go[3],flipDurationMs:flipDurationMs$4,dropTargetStyle:{outline:"none"}})},i(go){if(!uo){for(let bo=0;bo<ho.length;bo+=1)transition_in(no[bo]);transition_in(so.$$.fragment,go),uo=!0}},o(go){for(let bo=0;bo<no.length;bo+=1)transition_out(no[bo]);transition_out(so.$$.fragment,go),uo=!1},d(go){go&&detach(ue);for(let bo=0;bo<no.length;bo+=1)no[bo].d();destroy_component(so),fo=!1,run_all(po)}}}const flipDurationMs$4=130;function instance$6c(to,ue,eo){let no,ro,{constraints:oo}=ue,{optionColors:io={}}=ue,{valid:ao=!0}=ue;const{OptionColours:so}=Constants$1,lo=To=>so[To%so.length],co=writable(oo.inclusion.map((To,Mo)=>({id:Math.random(),name:To,color:(io==null?void 0:io[To])||lo(Mo),invalid:!1})));component_subscribe(to,co,To=>eo(3,no=To));const uo=derived(co,To=>{let Mo=[];return To.forEach(Vo=>{Mo.push({...Vo,valid:Vo.name&&!Mo.some(Fo=>Fo.name===Vo.name)})}),Mo});component_subscribe(to,uo,To=>eo(0,ro=To));let fo=null,po=null;const ho=To=>{eo(12,oo.inclusion=To.map(Mo=>Mo.name),oo),eo(13,io=To.reduce((Mo,Vo)=>({...Mo,[Vo.name]:Vo.color}),{}))},_o=async()=>{var Vo;const To=Math.random(),Mo=getSequentialName(no,"Option ",{numberFirstItem:!0,getName:Fo=>Fo.name});co.update(Fo=>[...Fo,{name:Mo,id:To,color:lo(Fo.length)}]),await tick(),(Vo=document.getElementById(`option-${To}`))==null||Vo.focus()},go=To=>{co.update(Mo=>Mo.filter(Vo=>Vo.id!==To))},bo=To=>{eo(2,po=document.getElementById(`color-${To}`)),eo(1,fo=To)},vo=(To,Mo)=>{co.update(Vo=>(Vo.find(Fo=>Fo.id===To).color=Mo,Vo.slice())),eo(1,fo=null)},yo=(To,Mo)=>{co.update(Vo=>(Vo.find(Fo=>Fo.id===To).name=Mo,Vo.slice()))},wo=(To,Mo)=>vo(To.id,Mo),ko=To=>bo(To.id),So=(To,Mo)=>yo(To.id,Mo.target.value),Eo=To=>go(To.id),Io=To=>co.set(To.detail.items),Ao=To=>co.set(To.detail.items);return to.$$set=To=>{"constraints"in To&&eo(12,oo=To.constraints),"optionColors"in To&&eo(13,io=To.optionColors),"valid"in To&&eo(14,ao=To.valid)},to.$$.update=()=>{to.$$.dirty&1&&eo(14,ao=ro.every(To=>To.valid))},co.subscribe(ho),[ro,fo,po,no,so,co,uo,_o,go,bo,vo,yo,oo,io,ao,wo,ko,So,Eo,Io,Ao]}let OptionsEditor$1=class extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$6c,create_fragment$6f,safe_not_equal,{constraints:12,optionColors:13,valid:14})}};const CreateEditColumn_svelte_svelte_type_style_lang="";function get_if_ctx$1(to){const ue=to.slice(),eo=ue[6].type===FieldType.BB_REFERENCE_SINGLE?ue[35]:ue[36];return ue[105]=eo,ue}function create_if_block_21$1(to){var no;let ue,eo;return ue=new Input$5({props:{value:to[6].name,autofocus:!0,disabled:to[13]||to[15]&&to[6].type===FieldType.LINK,error:(no=to[11])==null?void 0:no.name}}),ue.$on("input",to[53]),{c(){create_component(ue.$$.fragment)},m(ro,oo){mount_component(ue,ro,oo),eo=!0},p(ro,oo){var ao;const io={};oo[0]&64&&(io.value=ro[6].name),oo[0]&41024&&(io.disabled=ro[13]||ro[15]&&ro[6].type===FieldType.LINK),oo[0]&2048&&(io.error=(ao=ro[11])==null?void 0:ao.name),ue.$set(io)},i(ro){eo||(transition_in(ue.$$.fragment,ro),eo=!0)},o(ro){transition_out(ue.$$.fragment,ro),eo=!1},d(ro){destroy_component(ue,ro)}}}function create_if_block_20$1(to){let ue,eo;return ue=new Button({props:{primary:!0,text:!0,$$slots:{default:[create_default_slot_17$8]},$$scope:{ctx:to}}}),ue.$on("click",to[43]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[3]&8192&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block_19$1(to){let ue,eo;return ue=new AIFieldConfiguration({props:{aiField:to[6],context:to[33],bindings:getBindings({table:to[37]}),schema:to[37].schema}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[0]&64&&(oo.aiField=no[6]),ro[1]&4&&(oo.context=no[33]),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block_17$1(to){let ue,eo,no,ro,oo,io,ao,so,lo,co,uo,fo,po,ho,_o,go,bo=!to[21]&&create_if_block_18$1(to);ro=new Label({props:{size:"M",$$slots:{default:[create_default_slot_15$9]},$$scope:{ctx:to}}});function vo(wo){to[76](wo)}let yo={options:[FIELDS.STRING,FIELDS.NUMBER,FIELDS.BOOLEAN,FIELDS.DATETIME],getOptionLabel:func_6,getOptionValue:func_7,tooltip:"Formulas by default will return a string - however if you need another type the response can be coerced."};return to[6].responseType!==void 0&&(yo.value=to[6].responseType),ao=new Select_1$1({props:yo}),binding_callbacks.push(()=>bind$2(ao,"value",vo)),fo=new Label({props:{size:"M",$$slots:{default:[create_default_slot_14$a]},$$scope:{ctx:to}}}),_o=new ModalBindableInput({props:{panel:ServerBindingPanel,title:"Formula",value:to[6].formula,bindings:getBindings({table:to[37]}),allowJS:!0,context:to[33]}}),_o.$on("change",to[77]),{c(){bo&&bo.c(),ue=space$1(),eo=element("div"),no=element("div"),create_component(ro.$$.fragment),oo=space$1(),io=element("div"),create_component(ao.$$.fragment),lo=space$1(),co=element("div"),uo=element("div"),create_component(fo.$$.fragment),po=space$1(),ho=element("div"),create_component(_o.$$.fragment),attr(no,"class","label-length svelte-qjv4aj"),attr(io,"class","input-length svelte-qjv4aj"),attr(eo,"class","split-label svelte-qjv4aj"),attr(uo,"class","label-length svelte-qjv4aj"),attr(ho,"class","input-length svelte-qjv4aj"),attr(co,"class","split-label svelte-qjv4aj")},m(wo,ko){bo&&bo.m(wo,ko),insert$1(wo,ue,ko),insert$1(wo,eo,ko),append$2(eo,no),mount_component(ro,no,null),append$2(eo,oo),append$2(eo,io),mount_component(ao,io,null),insert$1(wo,lo,ko),insert$1(wo,co,ko),append$2(co,uo),mount_component(fo,uo,null),append$2(co,po),append$2(co,ho),mount_component(_o,ho,null),go=!0},p(wo,ko){wo[21]?bo&&(group_outros(),transition_out(bo,1,1,()=>{bo=null}),check_outros()):bo?(bo.p(wo,ko),ko[0]&2097152&&transition_in(bo,1)):(bo=create_if_block_18$1(wo),bo.c(),transition_in(bo,1),bo.m(ue.parentNode,ue));const So={};ko[3]&8192&&(So.$$scope={dirty:ko,ctx:wo}),ro.$set(So);const Eo={};!so&&ko[0]&64&&(so=!0,Eo.value=wo[6].responseType,add_flush_callback(()=>so=!1)),ao.$set(Eo);const Io={};ko[3]&8192&&(Io.$$scope={dirty:ko,ctx:wo}),fo.$set(Io);const Ao={};ko[0]&64&&(Ao.value=wo[6].formula),ko[1]&4&&(Ao.context=wo[33]),_o.$set(Ao)},i(wo){go||(transition_in(bo),transition_in(ro.$$.fragment,wo),transition_in(ao.$$.fragment,wo),transition_in(fo.$$.fragment,wo),transition_in(_o.$$.fragment,wo),go=!0)},o(wo){transition_out(bo),transition_out(ro.$$.fragment,wo),transition_out(ao.$$.fragment,wo),transition_out(fo.$$.fragment,wo),transition_out(_o.$$.fragment,wo),go=!1},d(wo){wo&&(detach(ue),detach(eo),detach(lo),detach(co)),bo&&bo.d(wo),destroy_component(ro),destroy_component(ao),destroy_component(fo),destroy_component(_o)}}}function create_if_block_16$1(to){let ue,eo,no,ro,oo,io,ao;function so(ho){to[70](ho)}function lo(ho){to[71](ho)}function co(ho){to[72](ho)}function uo(ho){to[73](ho)}function fo(ho){to[74](ho)}let po={relationshipOpts1:to[7],relationshipOpts2:to[8],linkEditDisabled:to[15],tableOptions:to[26],errors:to[11]};return to[2]!==void 0&&(po.relationshipPart1=to[2]),to[3]!==void 0&&(po.relationshipPart2=to[3]),to[17]!==void 0&&(po.relationshipTableIdPrimary=to[17]),to[4]!==void 0&&(po.relationshipTableIdSecondary=to[4]),to[6]!==void 0&&(po.editableColumn=to[6]),ue=new RelationshipSelector({props:po}),binding_callbacks.push(()=>bind$2(ue,"relationshipPart1",so)),binding_callbacks.push(()=>bind$2(ue,"relationshipPart2",lo)),binding_callbacks.push(()=>bind$2(ue,"relationshipTableIdPrimary",co)),binding_callbacks.push(()=>bind$2(ue,"relationshipTableIdSecondary",uo)),binding_callbacks.push(()=>bind$2(ue,"editableColumn",fo)),{c(){create_component(ue.$$.fragment)},m(ho,_o){mount_component(ue,ho,_o),ao=!0},p(ho,_o){const go={};_o[0]&128&&(go.relationshipOpts1=ho[7]),_o[0]&256&&(go.relationshipOpts2=ho[8]),_o[0]&32768&&(go.linkEditDisabled=ho[15]),_o[0]&67108864&&(go.tableOptions=ho[26]),_o[0]&2048&&(go.errors=ho[11]),!eo&&_o[0]&4&&(eo=!0,go.relationshipPart1=ho[2],add_flush_callback(()=>eo=!1)),!no&&_o[0]&8&&(no=!0,go.relationshipPart2=ho[3],add_flush_callback(()=>no=!1)),!ro&&_o[0]&131072&&(ro=!0,go.relationshipTableIdPrimary=ho[17],add_flush_callback(()=>ro=!1)),!oo&&_o[0]&16&&(oo=!0,go.relationshipTableIdSecondary=ho[4],add_flush_callback(()=>oo=!1)),!io&&_o[0]&64&&(io=!0,go.editableColumn=ho[6],add_flush_callback(()=>io=!1)),ue.$set(go)},i(ho){ao||(transition_in(ue.$$.fragment,ho),ao=!0)},o(ho){transition_out(ue.$$.fragment,ho),ao=!1},d(ho){destroy_component(ue,ho)}}}function create_if_block_15$1(to){let ue,eo,no,ro,oo,io,ao,so,lo,co,uo,fo,po,ho,_o,go;no=new Label({props:{size:"M",$$slots:{default:[create_default_slot_13$d]},$$scope:{ctx:to}}});function bo(ko){to[68](ko)}let vo={type:"number"};to[6].constraints.numericality.greaterThanOrEqualTo!==void 0&&(vo.value=to[6].constraints.numericality.greaterThanOrEqualTo),io=new Input$5({props:vo}),binding_callbacks.push(()=>bind$2(io,"value",bo)),uo=new Label({props:{size:"M",$$slots:{default:[create_default_slot_12$i]},$$scope:{ctx:to}}});function yo(ko){to[69](ko)}let wo={type:"number"};return to[6].constraints.numericality.lessThanOrEqualTo!==void 0&&(wo.value=to[6].constraints.numericality.lessThanOrEqualTo),ho=new Input$5({props:wo}),binding_callbacks.push(()=>bind$2(ho,"value",yo)),{c(){ue=element("div"),eo=element("div"),create_component(no.$$.fragment),ro=space$1(),oo=element("div"),create_component(io.$$.fragment),so=space$1(),lo=element("div"),co=element("div"),create_component(uo.$$.fragment),fo=space$1(),po=element("div"),create_component(ho.$$.fragment),attr(eo,"class","label-length svelte-qjv4aj"),attr(oo,"class","input-length svelte-qjv4aj"),attr(ue,"class","split-label svelte-qjv4aj"),attr(co,"class","label-length svelte-qjv4aj"),attr(po,"class","input-length svelte-qjv4aj"),attr(lo,"class","split-label svelte-qjv4aj")},m(ko,So){insert$1(ko,ue,So),append$2(ue,eo),mount_component(no,eo,null),append$2(ue,ro),append$2(ue,oo),mount_component(io,oo,null),insert$1(ko,so,So),insert$1(ko,lo,So),append$2(lo,co),mount_component(uo,co,null),append$2(lo,fo),append$2(lo,po),mount_component(ho,po,null),go=!0},p(ko,So){const Eo={};So[3]&8192&&(Eo.$$scope={dirty:So,ctx:ko}),no.$set(Eo);const Io={};!ao&&So[0]&64&&(ao=!0,Io.value=ko[6].constraints.numericality.greaterThanOrEqualTo,add_flush_callback(()=>ao=!1)),io.$set(Io);const Ao={};So[3]&8192&&(Ao.$$scope={dirty:So,ctx:ko}),uo.$set(Ao);const To={};!_o&&So[0]&64&&(_o=!0,To.value=ko[6].constraints.numericality.lessThanOrEqualTo,add_flush_callback(()=>_o=!1)),ho.$set(To)},i(ko){go||(transition_in(no.$$.fragment,ko),transition_in(io.$$.fragment,ko),transition_in(uo.$$.fragment,ko),transition_in(ho.$$.fragment,ko),go=!0)},o(ko){transition_out(no.$$.fragment,ko),transition_out(io.$$.fragment,ko),transition_out(uo.$$.fragment,ko),transition_out(ho.$$.fragment,ko),go=!1},d(ko){ko&&(detach(ue),detach(so),detach(lo)),destroy_component(no),destroy_component(io),destroy_component(uo),destroy_component(ho)}}}function create_if_block_12$1(to){let ue,eo,no,ro,oo,io,ao,so,lo,co,uo,fo,po,ho,_o,go,bo,vo;no=new Label({props:{size:"M",$$slots:{default:[create_default_slot_11$o]},$$scope:{ctx:to}}});function yo(Io){to[64](Io)}let wo={enableTime:!to[6].dateOnly,timeOnly:to[6].timeOnly};to[6].constraints.datetime.earliest!==void 0&&(wo.value=to[6].constraints.datetime.earliest),io=new DatePicker_1({props:wo}),binding_callbacks.push(()=>bind$2(io,"value",yo)),uo=new Label({props:{size:"M",$$slots:{default:[create_default_slot_10$r]},$$scope:{ctx:to}}});function ko(Io){to[65](Io)}let So={enableTime:!to[6].dateOnly,timeOnly:to[6].timeOnly};to[6].constraints.datetime.latest!==void 0&&(So.value=to[6].constraints.datetime.latest),ho=new DatePicker_1({props:So}),binding_callbacks.push(()=>bind$2(ho,"value",ko));let Eo=!to[6].timeOnly&&create_if_block_13$1(to);return{c(){ue=element("div"),eo=element("div"),create_component(no.$$.fragment),ro=space$1(),oo=element("div"),create_component(io.$$.fragment),so=space$1(),lo=element("div"),co=element("div"),create_component(uo.$$.fragment),fo=space$1(),po=element("div"),create_component(ho.$$.fragment),go=space$1(),Eo&&Eo.c(),bo=empty$2(),attr(eo,"class","label-length svelte-qjv4aj"),attr(oo,"class","input-length svelte-qjv4aj"),attr(ue,"class","split-label svelte-qjv4aj"),attr(co,"class","label-length svelte-qjv4aj"),attr(po,"class","input-length svelte-qjv4aj"),attr(lo,"class","split-label svelte-qjv4aj")},m(Io,Ao){insert$1(Io,ue,Ao),append$2(ue,eo),mount_component(no,eo,null),append$2(ue,ro),append$2(ue,oo),mount_component(io,oo,null),insert$1(Io,so,Ao),insert$1(Io,lo,Ao),append$2(lo,co),mount_component(uo,co,null),append$2(lo,fo),append$2(lo,po),mount_component(ho,po,null),insert$1(Io,go,Ao),Eo&&Eo.m(Io,Ao),insert$1(Io,bo,Ao),vo=!0},p(Io,Ao){const To={};Ao[3]&8192&&(To.$$scope={dirty:Ao,ctx:Io}),no.$set(To);const Mo={};Ao[0]&64&&(Mo.enableTime=!Io[6].dateOnly),Ao[0]&64&&(Mo.timeOnly=Io[6].timeOnly),!ao&&Ao[0]&64&&(ao=!0,Mo.value=Io[6].constraints.datetime.earliest,add_flush_callback(()=>ao=!1)),io.$set(Mo);const Vo={};Ao[3]&8192&&(Vo.$$scope={dirty:Ao,ctx:Io}),uo.$set(Vo);const Fo={};Ao[0]&64&&(Fo.enableTime=!Io[6].dateOnly),Ao[0]&64&&(Fo.timeOnly=Io[6].timeOnly),!_o&&Ao[0]&64&&(_o=!0,Fo.value=Io[6].constraints.datetime.latest,add_flush_callback(()=>_o=!1)),ho.$set(Fo),Io[6].timeOnly?Eo&&(group_outros(),transition_out(Eo,1,1,()=>{Eo=null}),check_outros()):Eo?(Eo.p(Io,Ao),Ao[0]&64&&transition_in(Eo,1)):(Eo=create_if_block_13$1(Io),Eo.c(),transition_in(Eo,1),Eo.m(bo.parentNode,bo))},i(Io){vo||(transition_in(no.$$.fragment,Io),transition_in(io.$$.fragment,Io),transition_in(uo.$$.fragment,Io),transition_in(ho.$$.fragment,Io),transition_in(Eo),vo=!0)},o(Io){transition_out(no.$$.fragment,Io),transition_out(io.$$.fragment,Io),transition_out(uo.$$.fragment,Io),transition_out(ho.$$.fragment,Io),transition_out(Eo),vo=!1},d(Io){Io&&(detach(ue),detach(so),detach(lo),detach(go),detach(bo)),destroy_component(no),destroy_component(io),destroy_component(uo),destroy_component(ho),Eo&&Eo.d(Io)}}}function create_if_block_11$1(to){let ue,eo,no,ro,oo;function io(co){to[61](co)}function ao(co){to[62](co)}function so(co){to[63](co)}let lo={};return to[6].constraints!==void 0&&(lo.constraints=to[6].constraints),to[6].optionColors!==void 0&&(lo.optionColors=to[6].optionColors),to[9]!==void 0&&(lo.valid=to[9]),ue=new OptionsEditor$1({props:lo}),binding_callbacks.push(()=>bind$2(ue,"constraints",io)),binding_callbacks.push(()=>bind$2(ue,"optionColors",ao)),binding_callbacks.push(()=>bind$2(ue,"valid",so)),{c(){create_component(ue.$$.fragment)},m(co,uo){mount_component(ue,co,uo),oo=!0},p(co,uo){const fo={};!eo&&uo[0]&64&&(eo=!0,fo.constraints=co[6].constraints,add_flush_callback(()=>eo=!1)),!no&&uo[0]&64&&(no=!0,fo.optionColors=co[6].optionColors,add_flush_callback(()=>no=!1)),!ro&&uo[0]&512&&(ro=!0,fo.valid=co[9],add_flush_callback(()=>ro=!1)),ue.$set(fo)},i(co){oo||(transition_in(ue.$$.fragment,co),oo=!0)},o(co){transition_out(ue.$$.fragment,co),oo=!1},d(co){destroy_component(ue,co)}}}function create_if_block_10$3(to){let ue,eo,no,ro,oo,io,ao,so,lo;no=new Label({props:{size:"M",$$slots:{default:[create_default_slot_7$K]},$$scope:{ctx:to}}}),oo=new AbsTooltip({props:{position:"top",type:"info",text:"Rich text includes support for images, link",$$slots:{default:[create_default_slot_6$S]},$$scope:{ctx:to}}});function co(fo){to[60](fo)}let uo={text:"Enable rich text support (markdown)"};return to[6].useRichText!==void 0&&(uo.value=to[6].useRichText),ao=new Toggle({props:uo}),binding_callbacks.push(()=>bind$2(ao,"value",co)),{c(){ue=element("div"),eo=element("div"),create_component(no.$$.fragment),ro=space$1(),create_component(oo.$$.fragment),io=space$1(),create_component(ao.$$.fragment),attr(eo,"class","tooltip-alignment svelte-qjv4aj")},m(fo,po){insert$1(fo,ue,po),append$2(ue,eo),mount_component(no,eo,null),append$2(eo,ro),mount_component(oo,eo,null),append$2(ue,io),mount_component(ao,ue,null),lo=!0},p(fo,po){const ho={};po[3]&8192&&(ho.$$scope={dirty:po,ctx:fo}),no.$set(ho);const _o={};po[3]&8192&&(_o.$$scope={dirty:po,ctx:fo}),oo.$set(_o);const go={};!so&&po[0]&64&&(so=!0,go.value=fo[6].useRichText,add_flush_callback(()=>so=!1)),ao.$set(go)},i(fo){lo||(transition_in(no.$$.fragment,fo),transition_in(oo.$$.fragment,fo),transition_in(ao.$$.fragment,fo),lo=!0)},o(fo){transition_out(no.$$.fragment,fo),transition_out(oo.$$.fragment,fo),transition_out(ao.$$.fragment,fo),lo=!1},d(fo){fo&&detach(ue),destroy_component(no),destroy_component(oo),destroy_component(ao)}}}function create_if_block_9$8(to){let ue,eo,no,ro,oo;function io(co){to[57](co)}function ao(co){to[58](co)}function so(co){to[59](co)}let lo={};return to[6].constraints!==void 0&&(lo.constraints=to[6].constraints),to[6].optionColors!==void 0&&(lo.optionColors=to[6].optionColors),to[9]!==void 0&&(lo.valid=to[9]),ue=new OptionsEditor$1({props:lo}),binding_callbacks.push(()=>bind$2(ue,"constraints",io)),binding_callbacks.push(()=>bind$2(ue,"optionColors",ao)),binding_callbacks.push(()=>bind$2(ue,"valid",so)),{c(){create_component(ue.$$.fragment)},m(co,uo){mount_component(ue,co,uo),oo=!0},p(co,uo){const fo={};!eo&&uo[0]&64&&(eo=!0,fo.constraints=co[6].constraints,add_flush_callback(()=>eo=!1)),!no&&uo[0]&64&&(no=!0,fo.optionColors=co[6].optionColors,add_flush_callback(()=>no=!1)),!ro&&uo[0]&512&&(ro=!0,fo.valid=co[9],add_flush_callback(()=>ro=!1)),ue.$set(fo)},i(co){oo||(transition_in(ue.$$.fragment,co),oo=!0)},o(co){transition_out(ue.$$.fragment,co),oo=!1},d(co){destroy_component(ue,co)}}}function create_if_block_8$a(to){let ue,eo,no;function ro(io){to[56](io)}let oo={type:"number",label:"Max Length"};return to[6].constraints.length.maximum!==void 0&&(oo.value=to[6].constraints.length.maximum),ue=new Input$5({props:oo}),binding_callbacks.push(()=>bind$2(ue,"value",ro)),{c(){create_component(ue.$$.fragment)},m(io,ao){mount_component(ue,io,ao),no=!0},p(io,ao){const so={};!eo&&ao[0]&64&&(eo=!0,so.value=io[6].constraints.length.maximum,add_flush_callback(()=>eo=!1)),ue.$set(so)},i(io){no||(transition_in(ue.$$.fragment,io),no=!0)},o(io){transition_out(ue.$$.fragment,io),no=!1},d(io){destroy_component(ue,io)}}}function create_default_slot_17$8(to){let ue;return{c(){ue=text("Open schema editor")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_if_block_18$1(to){let ue,eo,no,ro,oo,io,ao,so;no=new Label({props:{size:"M",$$slots:{default:[create_default_slot_16$8]},$$scope:{ctx:to}}});function lo(uo){to[75](uo)}let co={options:[{label:"Dynamic",value:"dynamic"},{label:"Static",value:"static"}],disabled:!to[16],getOptionLabel:func_4$3,getOptionValue:func_5$1,tooltip:`Dynamic formula are calculated when retrieved, but cannot be filtered or sorted by,
|
|
1688
1688
|
while static formula are calculated when the row is saved.`};return to[6].formulaType!==void 0&&(co.value=to[6].formulaType),io=new Select_1$1({props:co}),binding_callbacks.push(()=>bind$2(io,"value",lo)),{c(){ue=element("div"),eo=element("div"),create_component(no.$$.fragment),ro=space$1(),oo=element("div"),create_component(io.$$.fragment),attr(eo,"class","label-length svelte-qjv4aj"),attr(oo,"class","input-length svelte-qjv4aj"),attr(ue,"class","split-label svelte-qjv4aj")},m(uo,fo){insert$1(uo,ue,fo),append$2(ue,eo),mount_component(no,eo,null),append$2(ue,ro),append$2(ue,oo),mount_component(io,oo,null),so=!0},p(uo,fo){const po={};fo[3]&8192&&(po.$$scope={dirty:fo,ctx:uo}),no.$set(po);const ho={};fo[0]&65536&&(ho.disabled=!uo[16]),!ao&&fo[0]&64&&(ao=!0,ho.value=uo[6].formulaType,add_flush_callback(()=>ao=!1)),io.$set(ho)},i(uo){so||(transition_in(no.$$.fragment,uo),transition_in(io.$$.fragment,uo),so=!0)},o(uo){transition_out(no.$$.fragment,uo),transition_out(io.$$.fragment,uo),so=!1},d(uo){uo&&detach(ue),destroy_component(no),destroy_component(io)}}}function create_default_slot_16$8(to){let ue;return{c(){ue=text("Formula Type")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_15$9(to){let ue;return{c(){ue=text("Response Type")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_14$a(to){let ue;return{c(){ue=text("Formula")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_13$d(to){let ue;return{c(){ue=text("Min Value")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_12$i(to){let ue;return{c(){ue=text("Max Value")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_11$o(to){let ue;return{c(){ue=text("Earliest")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_10$r(to){let ue;return{c(){ue=text("Latest")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_if_block_13$1(to){var so,lo;let ue,eo,no,ro,oo=((so=to[12])==null?void 0:so.source)!==SourceName.ORACLE&&((lo=to[12])==null?void 0:lo.source)!==SourceName.SQL_SERVER&&!to[6].dateOnly&&create_if_block_14$1(to);function io(co){to[67](co)}let ao={text:"Date only"};return to[6].dateOnly!==void 0&&(ao.value=to[6].dateOnly),eo=new Toggle({props:ao}),binding_callbacks.push(()=>bind$2(eo,"value",io)),{c(){oo&&oo.c(),ue=space$1(),create_component(eo.$$.fragment)},m(co,uo){oo&&oo.m(co,uo),insert$1(co,ue,uo),mount_component(eo,co,uo),ro=!0},p(co,uo){var po,ho;((po=co[12])==null?void 0:po.source)!==SourceName.ORACLE&&((ho=co[12])==null?void 0:ho.source)!==SourceName.SQL_SERVER&&!co[6].dateOnly?oo?(oo.p(co,uo),uo[0]&4160&&transition_in(oo,1)):(oo=create_if_block_14$1(co),oo.c(),transition_in(oo,1),oo.m(ue.parentNode,ue)):oo&&(group_outros(),transition_out(oo,1,1,()=>{oo=null}),check_outros());const fo={};!no&&uo[0]&64&&(no=!0,fo.value=co[6].dateOnly,add_flush_callback(()=>no=!1)),eo.$set(fo)},i(co){ro||(transition_in(oo),transition_in(eo.$$.fragment,co),ro=!0)},o(co){transition_out(oo),transition_out(eo.$$.fragment,co),ro=!1},d(co){co&&detach(ue),oo&&oo.d(co),destroy_component(eo,co)}}}function create_if_block_14$1(to){let ue,eo,no,ro,oo,io,ao,so,lo;no=new Label({props:{$$slots:{default:[create_default_slot_9$v]},$$scope:{ctx:to}}}),oo=new AbsTooltip({props:{position:"top",type:"info",text:to[16]?null:"We recommend not changing how timezones are handled for existing columns, as existing data will not be updated",$$slots:{default:[create_default_slot_8$A]},$$scope:{ctx:to}}});function co(fo){to[66](fo)}let uo={text:"Ignore time zones"};return to[6].ignoreTimezones!==void 0&&(uo.value=to[6].ignoreTimezones),ao=new Toggle({props:uo}),binding_callbacks.push(()=>bind$2(ao,"value",co)),{c(){ue=element("div"),eo=element("div"),create_component(no.$$.fragment),ro=space$1(),create_component(oo.$$.fragment),io=space$1(),create_component(ao.$$.fragment),attr(eo,"class","row svelte-qjv4aj")},m(fo,po){insert$1(fo,ue,po),append$2(ue,eo),mount_component(no,eo,null),append$2(eo,ro),mount_component(oo,eo,null),append$2(ue,io),mount_component(ao,ue,null),lo=!0},p(fo,po){const ho={};po[3]&8192&&(ho.$$scope={dirty:po,ctx:fo}),no.$set(ho);const _o={};po[0]&65536&&(_o.text=fo[16]?null:"We recommend not changing how timezones are handled for existing columns, as existing data will not be updated"),po[3]&8192&&(_o.$$scope={dirty:po,ctx:fo}),oo.$set(_o);const go={};!so&&po[0]&64&&(so=!0,go.value=fo[6].ignoreTimezones,add_flush_callback(()=>so=!1)),ao.$set(go)},i(fo){lo||(transition_in(no.$$.fragment,fo),transition_in(oo.$$.fragment,fo),transition_in(ao.$$.fragment,fo),lo=!0)},o(fo){transition_out(no.$$.fragment,fo),transition_out(oo.$$.fragment,fo),transition_out(ao.$$.fragment,fo),lo=!1},d(fo){fo&&detach(ue),destroy_component(no),destroy_component(oo),destroy_component(ao)}}}function create_default_slot_9$v(to){let ue;return{c(){ue=text("Time zones")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_8$A(to){let ue,eo;return ue=new Icon({props:{size:"XS",name:"InfoOutline"}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p:noop$6,i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot_7$K(to){let ue;return{c(){ue=text("Formatting")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_6$S(to){let ue,eo;return ue=new Icon({props:{size:"XS",name:"InfoOutline"}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p:noop$6,i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block_7$e(to){var no,ro;let ue,eo;return ue=new Select_1$1({props:{label:"Auto column type",value:to[6].subtype,options:Object.entries(to[30]),getOptionLabel:func_8,getOptionValue:func_9,disabled:!((no=to[31])!=null&&no.length)||to[6].autocolumn,error:(ro=to[11])==null?void 0:ro.subtype}}),ue.$on("change",to[78]),{c(){create_component(ue.$$.fragment)},m(oo,io){mount_component(ue,oo,io),eo=!0},p(oo,io){var so,lo;const ao={};io[0]&64&&(ao.value=oo[6].subtype),io[0]&1073741824&&(ao.options=Object.entries(oo[30])),io[0]&64|io[1]&1&&(ao.disabled=!((so=oo[31])!=null&&so.length)||oo[6].autocolumn),io[0]&2048&&(ao.error=(lo=oo[11])==null?void 0:lo.subtype),ue.$set(ao)},i(oo){eo||(transition_in(ue.$$.fragment,oo),eo=!0)},o(oo){transition_out(ue.$$.fragment,oo),eo=!1},d(oo){destroy_component(ue,oo)}}}function create_if_block_5$n(to){let ue,eo,no=to[28]&&create_if_block_6$g(to);return{c(){ue=element("div"),no&&no.c()},m(ro,oo){insert$1(ro,ue,oo),no&&no.m(ue,null),eo=!0},p(ro,oo){ro[28]?no?(no.p(ro,oo),oo[0]&268435456&&transition_in(no,1)):(no=create_if_block_6$g(ro),no.c(),transition_in(no,1),no.m(ue,null)):no&&(group_outros(),transition_out(no,1,1,()=>{no=null}),check_outros())},i(ro){eo||(transition_in(no),eo=!0)},o(ro){transition_out(no),eo=!1},d(ro){ro&&detach(ue),no&&no.d()}}}function create_if_block_6$g(to){let ue,eo;return ue=new Toggle({props:{value:to[10],disabled:to[1]||to[27],thin:!0,text:"Required"}}),ue.$on("change",to[42]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[0]&1024&&(oo.value=no[10]),ro[0]&134217730&&(oo.disabled=no[1]||no[27]),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_else_block_1$i(to){let ue,eo;return ue=new ModalBindableInput({props:{disabled:!to[22],panel:ServerBindingPanel,title:"Default value",label:"Default value",placeholder:"None",value:to[6].default,bindings:to[23],allowJS:!0}}),ue.$on("change",to[82]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[0]&4194304&&(oo.disabled=!no[22]),ro[0]&64&&(oo.value=no[6].default),ro[0]&8388608&&(oo.bindings=no[23]),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block_4$w(to){let ue,eo;function no(...ro){return to[81](to[105],...ro)}return ue=new Toggle({props:{disabled:!to[22],text:"Default to current user",value:to[6].default===to[105]}}),ue.$on("change",no),{c(){create_component(ue.$$.fragment)},m(ro,oo){mount_component(ue,ro,oo),eo=!0},p(ro,oo){to=ro;const io={};oo[0]&4194304&&(io.disabled=!to[22]),oo[0]&64&&(io.value=to[6].default===to[105]),ue.$set(io)},i(ro){eo||(transition_in(ue.$$.fragment,ro),eo=!0)},o(ro){transition_out(ue.$$.fragment,ro),eo=!1},d(ro){destroy_component(ue,ro)}}}function create_if_block_3$L(to){var no;let ue,eo;return ue=new Multiselect_1({props:{disabled:!to[22],options:((no=to[6].constraints)==null?void 0:no.inclusion)||[],label:"Default value",value:to[6].default,placeholder:"None"}}),ue.$on("change",to[80]),{c(){create_component(ue.$$.fragment)},m(ro,oo){mount_component(ue,ro,oo),eo=!0},p(ro,oo){var ao;const io={};oo[0]&4194304&&(io.disabled=!ro[22]),oo[0]&64&&(io.options=((ao=ro[6].constraints)==null?void 0:ao.inclusion)||[]),oo[0]&64&&(io.value=ro[6].default),ue.$set(io)},i(ro){eo||(transition_in(ue.$$.fragment,ro),eo=!0)},o(ro){transition_out(ue.$$.fragment,ro),eo=!1},d(ro){destroy_component(ue,ro)}}}function create_if_block_2$10(to){var no;let ue,eo;return ue=new Select_1$1({props:{disabled:!to[22],options:((no=to[6].constraints)==null?void 0:no.inclusion)||[],label:"Default value",value:to[6].default,placeholder:"None"}}),ue.$on("change",to[79]),{c(){create_component(ue.$$.fragment)},m(ro,oo){mount_component(ue,ro,oo),eo=!0},p(ro,oo){var ao;const io={};oo[0]&4194304&&(io.disabled=!ro[22]),oo[0]&64&&(io.options=((ao=ro[6].constraints)==null?void 0:ao.inclusion)||[]),oo[0]&64&&(io.value=ro[6].default),ue.$set(io)},i(ro){eo||(transition_in(ue.$$.fragment,ro),eo=!0)},o(ro){transition_out(ue.$$.fragment,ro),eo=!1},d(ro){destroy_component(ue,ro)}}}function create_default_slot_5$13(to){let ue,eo,no,ro,oo,io,ao,so,lo,co,uo,fo,po,ho=to[14]&&create_if_block_21$1(to);function _o(To){to[55](To)}let go={placeholder:null,disabled:!to[25],options:to[24],getOptionLabel:func$A,getOptionValue:func_1$u,getOptionIcon:func_2$2,isOptionEnabled:to[54]};to[6].fieldId!==void 0&&(go.value=to[6].fieldId),eo=new Select_1$1({props:go}),binding_callbacks.push(()=>bind$2(eo,"value",_o)),eo.$on("change",to[41]);const bo=[create_if_block_8$a,create_if_block_9$8,create_if_block_10$3,create_if_block_11$1,create_if_block_12$1,create_if_block_15$1,create_if_block_16$1,create_if_block_17$1,create_if_block_19$1,create_if_block_20$1],vo=[];function yo(To,Mo){return To[6].type===FieldType.STRING?0:To[6].type===FieldType.OPTIONS?1:To[6].type===FieldType.LONGFORM?2:To[6].type===FieldType.ARRAY?3:To[6].type===FieldType.DATETIME&&!To[6].autocolumn?4:To[6].type===FieldType.NUMBER&&!To[6].autocolumn?5:To[6].type===FieldType.LINK&&!To[6].autocolumn?6:To[6].type===FieldType.FORMULA?7:To[6].type===FieldType.AI?8:To[6].type===FieldType.JSON?9:-1}~(oo=yo(to))&&(io=vo[oo]=bo[oo](to));let wo=(to[6].type===FieldType.AUTO||to[6].autocolumn)&&create_if_block_7$e(to),ko=(to[28]||to[29])&&create_if_block_5$n(to);const So=[create_if_block_2$10,create_if_block_3$L,create_if_block_4$w,create_else_block_1$i],Eo=[];function Io(To,Mo){return To[6].type===FieldType.OPTIONS?0:To[6].type===FieldType.ARRAY?1:To[6].subtype===BBReferenceFieldSubType.USER?2:3}function Ao(To,Mo){return Mo===2?get_if_ctx$1(To):To}return co=Io(to),uo=Eo[co]=So[co](Ao(to,co)),{c(){ho&&ho.c(),ue=space$1(),create_component(eo.$$.fragment),ro=space$1(),io&&io.c(),ao=space$1(),wo&&wo.c(),so=space$1(),ko&&ko.c(),lo=space$1(),uo.c(),fo=empty$2()},m(To,Mo){ho&&ho.m(To,Mo),insert$1(To,ue,Mo),mount_component(eo,To,Mo),insert$1(To,ro,Mo),~oo&&vo[oo].m(To,Mo),insert$1(To,ao,Mo),wo&&wo.m(To,Mo),insert$1(To,so,Mo),ko&&ko.m(To,Mo),insert$1(To,lo,Mo),Eo[co].m(To,Mo),insert$1(To,fo,Mo),po=!0},p(To,Mo){To[14]?ho?(ho.p(To,Mo),Mo[0]&16384&&transition_in(ho,1)):(ho=create_if_block_21$1(To),ho.c(),transition_in(ho,1),ho.m(ue.parentNode,ue)):ho&&(group_outros(),transition_out(ho,1,1,()=>{ho=null}),check_outros());const Vo={};Mo[0]&33554432&&(Vo.disabled=!To[25]),Mo[0]&16777216&&(Vo.options=To[24]),Mo[1]&1&&(Vo.isOptionEnabled=To[54]),!no&&Mo[0]&64&&(no=!0,Vo.value=To[6].fieldId,add_flush_callback(()=>no=!1)),eo.$set(Vo);let Fo=oo;oo=yo(To),oo===Fo?~oo&&vo[oo].p(To,Mo):(io&&(group_outros(),transition_out(vo[Fo],1,1,()=>{vo[Fo]=null}),check_outros()),~oo?(io=vo[oo],io?io.p(To,Mo):(io=vo[oo]=bo[oo](To),io.c()),transition_in(io,1),io.m(ao.parentNode,ao)):io=null),To[6].type===FieldType.AUTO||To[6].autocolumn?wo?(wo.p(To,Mo),Mo[0]&64&&transition_in(wo,1)):(wo=create_if_block_7$e(To),wo.c(),transition_in(wo,1),wo.m(so.parentNode,so)):wo&&(group_outros(),transition_out(wo,1,1,()=>{wo=null}),check_outros()),To[28]||To[29]?ko?(ko.p(To,Mo),Mo[0]&805306368&&transition_in(ko,1)):(ko=create_if_block_5$n(To),ko.c(),transition_in(ko,1),ko.m(lo.parentNode,lo)):ko&&(group_outros(),transition_out(ko,1,1,()=>{ko=null}),check_outros());let Po=co;co=Io(To),co===Po?Eo[co].p(Ao(To,co),Mo):(group_outros(),transition_out(Eo[Po],1,1,()=>{Eo[Po]=null}),check_outros(),uo=Eo[co],uo?uo.p(Ao(To,co),Mo):(uo=Eo[co]=So[co](Ao(To,co)),uo.c()),transition_in(uo,1),uo.m(fo.parentNode,fo))},i(To){po||(transition_in(ho),transition_in(eo.$$.fragment,To),transition_in(io),transition_in(wo),transition_in(ko),transition_in(uo),po=!0)},o(To){transition_out(ho),transition_out(eo.$$.fragment,To),transition_out(io),transition_out(wo),transition_out(ko),transition_out(uo),po=!1},d(To){To&&(detach(ue),detach(ro),detach(ao),detach(so),detach(lo),detach(fo)),ho&&ho.d(To),destroy_component(eo,To),~oo&&vo[oo].d(To),wo&&wo.d(To),ko&&ko.d(To),Eo[co].d(To)}}}function create_if_block_1$1x(to){let ue,eo;return ue=new Button({props:{quiet:!0,warning:!0,text:!0,$$slots:{default:[create_default_slot_4$1m]},$$scope:{ctx:to}}}),ue.$on("click",to[44]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[3]&8192&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot_4$1m(to){let ue;return{c(){ue=text("Delete")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_default_slot_3$1O(to){let ue;return{c(){ue=text("Cancel")},m(eo,no){insert$1(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_else_block$1a(to){let ue;return{c(){ue=text("Save")},m(eo,no){insert$1(eo,ue,no)},i:noop$6,o:noop$6,d(eo){eo&&detach(ue)}}}function create_if_block$31(to){let ue,eo,no;return eo=new ProgressCircle({props:{overBackground:!0,size:"S"}}),{c(){ue=element("div"),create_component(eo.$$.fragment),attr(ue,"class","save-loading svelte-qjv4aj")},m(ro,oo){insert$1(ro,ue,oo),mount_component(eo,ue,null),no=!0},i(ro){no||(transition_in(eo.$$.fragment,ro),no=!0)},o(ro){transition_out(eo.$$.fragment,ro),no=!1},d(ro){ro&&detach(ue),destroy_component(eo)}}}function create_default_slot_2$2d(to){let ue,eo,no,ro;const oo=[create_if_block$31,create_else_block$1a],io=[];function ao(so,lo){return so[5]?0:1}return ue=ao(to),eo=io[ue]=oo[ue](to),{c(){eo.c(),no=empty$2()},m(so,lo){io[ue].m(so,lo),insert$1(so,no,lo),ro=!0},p(so,lo){let co=ue;ue=ao(so),ue!==co&&(group_outros(),transition_out(io[co],1,1,()=>{io[co]=null}),check_outros(),eo=io[ue],eo||(eo=io[ue]=oo[ue](so),eo.c()),transition_in(eo,1),eo.m(no.parentNode,no))},i(so){ro||(transition_in(eo),ro=!0)},o(so){transition_out(eo),ro=!1},d(so){so&&detach(no),io[ue].d(so)}}}function create_default_slot_1$33(to){let ue,eo;return ue=new JSONSchemaModal({props:{schema:to[6].schema,json:to[6].json}}),ue.$on("save",to[83]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[0]&64&&(oo.schema=no[6].schema),ro[0]&64&&(oo.json=no[6].json),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot$49(to){let ue,eo,no,ro,oo,io,ao,so,lo,co,uo,fo;function po(_o){to[86](_o)}let ho={placeholder:to[0]};return to[19]!==void 0&&(ho.value=to[19]),so=new Input$5({props:ho}),binding_callbacks.push(()=>bind$2(so,"value",po)),{c(){ue=element("p"),eo=text(`Are you sure you wish to delete the column
|
|
1689
1689
|
`),no=element("b"),ro=text(to[0]),oo=text("?"),io=text(`
|