@synnaxlabs/pluto 0.26.0 → 0.26.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Animated-zwHonFIj.cjs → Animated-C-Fn9eLa.cjs} +1 -1
- package/dist/{Animated-DNVDjbp5.js → Animated-DEXyK03s.js} +1 -1
- package/dist/{Keyboard-DIqjeZSO.js → Keyboard-D2y8u-A6.js} +1 -1
- package/dist/{Keyboard-CK96wQ5G.cjs → Keyboard-DkBJ6mo5.cjs} +1 -1
- package/dist/{LinePlot-Cm6T-Agy.cjs → LinePlot-Cgjyihyx.cjs} +4 -4
- package/dist/{LinePlot-Cvi3y24D.js → LinePlot-DYkTuZP2.js} +1 -1
- package/dist/{Link-CRvZcIvR.cjs → Link-BTJDCfSs.cjs} +1 -1
- package/dist/{Link-CfU1takx.js → Link-CBJMkW3j.js} +1 -1
- package/dist/{List-B6hlZNwe.js → List-DQ5KNkbE.js} +2 -2
- package/dist/{List-CBMm9BLf.cjs → List-bpq4WGKS.cjs} +1 -1
- package/dist/{Toggle-_SGawcap.js → Toggle-2UJtIoEe.js} +1 -1
- package/dist/{Toggle-YiHP9pVf.cjs → Toggle-CICqV_L2.cjs} +1 -1
- package/dist/{aggregator-DaNTqAB0.js → aggregator-BTr6vhAN.js} +442 -419
- package/dist/{aggregator-D9ExX_tt.cjs → aggregator-CYlhZeym.cjs} +4 -4
- package/dist/button.cjs +1 -1
- package/dist/button.js +1 -1
- package/dist/color.cjs +1 -1
- package/dist/color.js +1 -1
- package/dist/dropdown.cjs +1 -1
- package/dist/dropdown.js +1 -1
- package/dist/ether.cjs +1 -1
- package/dist/ether.js +4 -4
- package/dist/{external-9st6X3mL.cjs → external-5sM5N2VW.cjs} +1 -1
- package/dist/{external-rzy59VM1.cjs → external-BFMmnG8X.cjs} +1 -1
- package/dist/{external-C4w_40JS.js → external-BT_-8FGY.js} +2 -2
- package/dist/{external-D_dAdIZX.js → external-BW10aqAd.js} +2 -2
- package/dist/{external-ChYLNmOM.js → external-BW4VYEGd.js} +2 -2
- package/dist/{external-C86d--c3.js → external-BqEoRX0C.js} +2 -2
- package/dist/{external-CsAw5Bqm.js → external-C727M7V8.js} +42 -42
- package/dist/{external-r0ozQhkY.cjs → external-CKhZ6pQ5.cjs} +1 -1
- package/dist/{external-CE4wgFJ7.cjs → external-CUKyGhKO.cjs} +1 -1
- package/dist/{external-DSc2y4PB.cjs → external-CjpJQPg2.cjs} +1 -1
- package/dist/{external-DOZ21f-5.cjs → external-Crwp6CSf.cjs} +1 -1
- package/dist/{external-BxUqbUsk.js → external-D3fxB_on.js} +3 -3
- package/dist/{external-D23hMpey.js → external-DDLu6Grz.js} +2 -2
- package/dist/{external-Cja9j84T.cjs → external-DZazAjmw.cjs} +1 -1
- package/dist/{external-CJOE_TDI.js → external-Djw4SjVz.js} +2 -2
- package/dist/{external-CS2UIUPR.js → external-IEF-QKNR.js} +3 -3
- package/dist/{external-ChI4-3Am.cjs → external-aMslGVso.cjs} +1 -1
- package/dist/{external-BgW4t-2y.cjs → external-otevW3YE.cjs} +1 -1
- package/dist/{external-DG3L9UDo.cjs → external-t7zjVyib.cjs} +1 -1
- package/dist/{external-TgztmPvP.js → external-te3uGVrs.js} +5 -5
- package/dist/{external-DfwQACwH.js → external-uvPI2OkG.js} +2 -2
- package/dist/{external-DZohHxSv.cjs → external-wossX6OP.cjs} +1 -1
- package/dist/header.cjs +1 -1
- package/dist/header.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +140 -140
- package/dist/input.cjs +1 -1
- package/dist/input.js +1 -1
- package/dist/list.cjs +1 -1
- package/dist/list.js +1 -1
- package/dist/menu.cjs +1 -1
- package/dist/menu.js +1 -1
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.js +1 -1
- package/dist/text.cjs +1 -1
- package/dist/text.js +2 -2
- package/dist/theming.cjs +1 -1
- package/dist/theming.js +2 -2
- package/dist/tree.cjs +1 -1
- package/dist/tree.js +1 -1
- package/dist/triggers.cjs +1 -1
- package/dist/triggers.js +1 -1
- package/package.json +6 -6
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
`),c(this,"type",Ma.TYPE)}};c(gr,"TYPE",Pe+"unexpected"),c(gr,"matches",de(gr.TYPE));let me=gr;const pr=class Da extends be{constructor(){super(...arguments),c(this,"type",Da.TYPE)}};c(pr,"TYPE",Pe+"query"),c(pr,"matches",de(pr.TYPE));let we=pr;const mr=class Pa extends we{constructor(){super(...arguments),c(this,"type",Pa.TYPE)}};c(mr,"TYPE",we.TYPE+".not_found"),c(mr,"matches",de(mr.TYPE));let xr=mr;const wr=class Ba extends we{constructor(){super(...arguments),c(this,"type",Ba.TYPE)}};c(wr,"TYPE",we.TYPE+".multiple_results"),c(wr,"matches",de(wr.TYPE));let Cr=wr;const br=class Ua extends be{constructor(e,r){super(e),c(this,"type",Ua.TYPE),c(this,"path"),this.path=r}};c(br,"TYPE",Pe+"route"),c(br,"matches",de(br.TYPE));let ni=br;const vr=class La extends be{constructor(){super(...arguments),c(this,"type",La.TYPE)}};c(vr,"TYPE",Pe+"control"),c(vr,"matches",de(vr.TYPE));let jr=vr;const Or=class Ya extends jr{constructor(){super(...arguments),c(this,"type",Ya.TYPE)}};c(Or,"TYPE",jr.TYPE+".unauthorized"),c(Or,"matches",de(Or.TYPE));let si=Or;const on=class qa extends be{constructor(){super(...arguments),c(this,"type",qa.TYPE)}};c(on,"TYPE",Pe+"contiguity"),c(on,"matches",de(on.TYPE));const ud=t=>{if(!t.type.startsWith(Pe))return null;if(t.type.startsWith(G.TYPE)){if(t.type===ri.TYPE){const e=t.data.split(": ");return e.length<2?new G(t.data):new ri(e[0],e[1])}return new G(t.data)}return t.type.startsWith(kr.TYPE)?t.type.startsWith($n.TYPE)?new $n(t.data):new kr(t.data):t.type.startsWith(me.TYPE)?new me(t.data):t.type.startsWith(we.TYPE)?t.type.startsWith(xr.TYPE)?new xr(t.data):t.type.startsWith(Cr.TYPE)?new Cr(t.data):new we(t.data):t.type.startsWith(jr.TYPE)?t.type.startsWith(si.TYPE)?new si(t.data):new jr(t.data):t.type.startsWith(ni.TYPE)?new ni(t.data,t.data):new me(t.data)},hd=()=>{throw new Error("Not implemented")};sa({encode:hd,decode:ud});const dd=async(t,e)=>{const[r,n]=await e(t);return n==null?[r,n]:n instanceof We?[r,new We({message:`Cannot reach cluster at ${n.url.host}:${n.url.port}`,url:n.url})]:[r,n]};class Fa{constructor(e,r){c(this,"key"),c(this,"name"),this.key=r,this.name=e}get ontologyID(){return new he({type:"group",key:this.key})}}const fd=s.z.string().uuid(),_a=s.z.object({key:fd,name:s.z.string()}),Wa=s.z.union([s.z.literal("label"),s.z.literal("builtin"),s.z.literal("cluster"),s.z.literal("channel"),s.z.literal("node"),s.z.literal("group"),s.z.literal("range"),s.z.literal("range-alias"),s.z.literal("user"),s.z.literal("workspace"),s.z.literal("schematic"),s.z.literal("lineplot"),s.z.literal("rack"),s.z.literal("device"),s.z.literal("task"),s.z.literal("policy")]),ye=s.z.object({type:Wa,key:s.z.string()}),yd=s.z.string().transform(t=>{const[e,r]=t.split(":");return{type:e,key:r}}),gd=s.z.union([yd,ye]),Tr=class Ga{constructor(e){if(c(this,"type"),c(this,"key"),e instanceof Ga)this.type=e.type,this.key=e.key;else if(typeof e=="string"){const[r,n]=e.split(":");this.type=r,this.key=n}else this.type=e.type,this.key=e.key}toString(){return`${this.type}:${this.key}`}get payload(){return{type:this.type,key:this.key}}};c(Tr,"z",s.z.union([gd,s.z.instanceof(Tr)]).transform(t=>new Tr(t)));let he=Tr;new he({type:"builtin",key:"root"});const pd=s.z.object({type:s.z.number()}),md=s.z.object({type:Wa,fields:s.z.record(pd)}),wd=s.z.object({id:he.z,name:s.z.string(),schema:md.optional().nullable(),data:s.z.record(s.z.unknown()).optional().nullable()}).transform(t=>({key:t.id.toString(),...t}));s.z.object({from:he.z,type:s.z.string(),to:he.z});const ii=t=>{const[e,r,n]=t.split("->");return{from:new he(e),type:r,to:new he(n)}},bd=s.z.object({group:_a}),vd=s.z.object({parent:ye,key:s.z.string().uuid().optional(),name:s.z.string()}),Od=s.z.object({key:s.z.string(),name:s.z.string()}),Td=s.z.object({keys:s.z.array(s.z.string())});var $e;let Sd=($e=class{constructor(t){c(this,"client"),this.client=t}async create(t,e,r){const[n,i]=await this.client.send($e.ENDPOINT,{parent:t,name:e,key:r},vd,bd);if(i!=null)throw i;return n.group}async rename(t,e){const r={key:t,name:e},[,n]=await this.client.send($e.ENDPOINT_RENAME,r,Od,s.z.object({}));if(n!=null)throw n}async delete(t){const e={keys:t},[,r]=await this.client.send($e.ENDPOINT_DELETE,e,Td,s.z.object({}));if(r!=null)throw r}},c($e,"ENDPOINT","/ontology/create-group"),c($e,"ENDPOINT_RENAME","/ontology/rename-group"),c($e,"ENDPOINT_DELETE","/ontology/delete-group"),$e),zd=class{constructor(t){c(this,"creator"),this.creator=new Sd(t)}async create(t,e,r){return this.sugar(await this.creator.create(t,e,r))}async rename(t,e){return await this.creator.rename(t,e)}async delete(...t){return await this.creator.delete(t)}sugar(t){return new Fa(t.name,t.key)}};const cn={ADD_CHILDREN:"/ontology/add-children",REMOVE_CHILDREN:"/ontology/remove-children",MOVE_CHILDREN:"/ontology/move-children"},ai=s.z.object({id:ye,children:ye.array()}),Nd=s.z.object({from:ye,to:ye,children:ye.array()});let Ed=class{constructor(t){c(this,"client"),this.client=t}async addChildren(t,...e){await v(this.client,cn.ADD_CHILDREN,{id:t,children:e},ai,s.z.object({}))}async removeChildren(t,...e){await v(this.client,cn.REMOVE_CHILDREN,{id:t,children:e},ai,s.z.object({}))}async moveChildren(t,e,...r){const n={from:t,to:e,children:r};await v(this.client,cn.MOVE_CHILDREN,n,Nd,s.z.object({}))}};const Id="/ontology/retrieve",Ad=s.z.object({ids:ye.array().optional(),children:s.z.boolean().optional(),parents:s.z.boolean().optional(),includeSchema:s.z.boolean().optional(),excludeFieldData:s.z.boolean().optional(),term:s.z.string().optional(),limit:s.z.number().optional(),offset:s.z.number().optional()}),kd=s.z.object({resources:wd.array()}),ln=t=>N(t).map(e=>new he(e).payload);let xd=class{constructor(t,e){c(this,"type","ontology"),c(this,"groups"),c(this,"client"),c(this,"writer"),c(this,"framer"),this.client=t,this.writer=new Ed(t),this.groups=new zd(t),this.framer=e}async search(t,e){return await this.execRetrieve({term:t,...e})}async retrieve(t,e){const r=await this.execRetrieve({ids:ln(t),...e});if(Array.isArray(t))return r;if(r.length===0)throw new we(`No resource found with ID ${t.toString()}`);return r[0]}async page(t,e,r){return await this.execRetrieve({offset:t,limit:e,...r})}async retrieveChildren(t,e){return await this.execRetrieve({ids:ln(t),children:!0,...e})}async retrieveParents(t,e){return await this.execRetrieve({ids:ln(t),parents:!0,...e})}async addChildren(t,...e){return await this.writer.addChildren(t,...e)}async removeChildren(t,...e){return await this.writer.removeChildren(t,...e)}async moveChildren(t,e,...r){return await this.writer.moveChildren(t,e,...r)}async openChangeTracker(){return await es.open(this.framer,this)}newSearcherWithOptions(t){return{type:this.type,search:e=>this.search(e,t),retrieve:e=>this.retrieve(e,t),page:(e,r)=>this.page(e,r,t)}}async execRetrieve(t){const{resources:e}=await v(this.client,Id,t,Ad,kd);return e}};const oi="sy_ontology_resource_set",ci="sy_ontology_resource_delete",li="sy_ontology_relationship_set",ui="sy_ontology_relationship_delete";class es{constructor(e,r){c(this,"resourceObs"),c(this,"relationshipObs"),c(this,"relationships"),c(this,"resources"),c(this,"streamer"),c(this,"client"),c(this,"closePromise"),this.relationshipObs=new Cn.Observer,this.relationships=this.relationshipObs,this.resourceObs=new Cn.Observer,this.resources=this.resourceObs,this.client=r,this.streamer=e,this.closePromise=this.start()}async close(){this.streamer.close(),await this.closePromise}async start(){for await(const e of this.streamer)await this.update(e)}async update(e){const r=await this.parseResourceSets(e),n=this.parseResourceDeletes(e);r.concat(n).length>0&&this.resourceObs.notify(r.concat(n));const i=this.parseRelationshipSets(e),a=this.parseRelationshipDeletes(e);i.concat(a).length>0&&this.relationshipObs.notify(i.concat(a))}parseRelationshipSets(e){const r=e.get(li);return r.length===0?[]:Array.from(r.as("string")).map(n=>({variant:"set",key:ii(n),value:void 0}))}parseRelationshipDeletes(e){const r=e.get(ui);return r.length===0?[]:Array.from(r.as("string")).map(n=>({variant:"delete",key:ii(n)}))}async parseResourceSets(e){const r=e.get(oi);if(r.length===0)return[];const n=Array.from(r.as("string")).map(i=>new he(i));try{return(await this.client.retrieve(n)).map(i=>({variant:"set",key:i.id,value:i}))}catch(i){if(i instanceof we)return[];throw i}}parseResourceDeletes(e){const r=e.get(ci);return r.length===0?[]:Array.from(r.as("string")).map(n=>({variant:"delete",key:new he(n)}))}static async open(e,r){const n=await e.openStreamer([oi,ci,li,ui]);return new es(n,r)}}const Be=s.z.number(),Dt=s.z.object({name:s.z.string(),key:s.z.number(),rate:Xn.z,dataType:A.z,leaseholder:s.z.number(),index:s.z.number(),isIndex:s.z.boolean(),internal:s.z.boolean(),alias:s.z.string().optional()}),Za=Dt.extend({key:s.z.number().optional(),leaseholder:s.z.number().optional(),index:s.z.number().optional(),rate:Xn.z.optional().default(0),isIndex:s.z.boolean().optional(),internal:s.z.boolean().optional().default(!1),virtual:s.z.boolean().optional().default(!1)}),Va="channel",Cd=t=>new he({type:Va,key:t.toString()}),jd=new Error("request for lock canceled");var Rd=function(t,e,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function l(f){try{d(n.next(f))}catch(h){o(h)}}function u(f){try{d(n.throw(f))}catch(h){o(h)}}function d(f){f.done?a(f.value):i(f.value).then(l,u)}d((n=n.apply(t,e||[])).next())})};class $d{constructor(e,r=jd){this._value=e,this._cancelError=r,this._queue=[],this._weightedWaiters=[]}acquire(e=1,r=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return new Promise((n,i)=>{const a={resolve:n,reject:i,weight:e,priority:r},o=Ka(this._queue,l=>r<=l.priority);o===-1&&e<=this._value?this._dispatchItem(a):this._queue.splice(o+1,0,a)})}runExclusive(e){return Rd(this,arguments,void 0,function*(r,n=1,i=0){const[a,o]=yield this.acquire(n,i);try{return yield r(a)}finally{o()}})}waitForUnlock(e=1,r=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return this._couldLockImmediately(e,r)?Promise.resolve():new Promise(n=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),Md(this._weightedWaiters[e-1],{resolve:n,priority:r})})}isLocked(){return this._value<=0}getValue(){return this._value}setValue(e){this._value=e,this._dispatchQueue()}release(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);this._value+=e,this._dispatchQueue()}cancel(){this._queue.forEach(e=>e.reject(this._cancelError)),this._queue=[]}_dispatchQueue(){for(this._drainUnlockWaiters();this._queue.length>0&&this._queue[0].weight<=this._value;)this._dispatchItem(this._queue.shift()),this._drainUnlockWaiters()}_dispatchItem(e){const r=this._value;this._value-=e.weight,e.resolve([r,this._newReleaser(e.weight)])}_newReleaser(e){let r=!1;return()=>{r||(r=!0,this.release(e))}}_drainUnlockWaiters(){if(this._queue.length===0)for(let e=this._value;e>0;e--){const r=this._weightedWaiters[e-1];r&&(r.forEach(n=>n.resolve()),this._weightedWaiters[e-1]=[])}else{const e=this._queue[0].priority;for(let r=this._value;r>0;r--){const n=this._weightedWaiters[r-1];if(!n)continue;const i=n.findIndex(a=>a.priority<=e);(i===-1?n:n.splice(0,i)).forEach(a=>a.resolve())}}}_couldLockImmediately(e,r){return(this._queue.length===0||this._queue[0].priority<r)&&e<=this._value}}function Md(t,e){const r=Ka(t,n=>e.priority<=n.priority);t.splice(r+1,0,e)}function Ka(t,e){for(let r=t.length-1;r>=0;r--)if(e(t[r]))return r;return-1}var Dd=function(t,e,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function l(f){try{d(n.next(f))}catch(h){o(h)}}function u(f){try{d(n.throw(f))}catch(h){o(h)}}function d(f){f.done?a(f.value):i(f.value).then(l,u)}d((n=n.apply(t,e||[])).next())})};class Pd{constructor(e){this._semaphore=new $d(1,e)}acquire(){return Dd(this,arguments,void 0,function*(e=0){const[,r]=yield this._semaphore.acquire(1,e);return r})}runExclusive(e,r=0){return this._semaphore.runExclusive(()=>e(),1,r)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(e=0){return this._semaphore.waitForUnlock(1,e)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}}const Yr=(t,e,{convertNumericStrings:r=!0}={})=>{const n=!Array.isArray(t);let i=N(t);const a=i[0],o=typeof a;let l;return o==="string"&&r&&!isNaN(parseInt(a))&&"number"in e?(l=e.number,i=i.map(u=>parseInt(u))):l=e[o],{single:n,variant:l,normalized:i,actual:t}},qr=(t,e,r,n)=>{if(n){if(r.length===0)throw new xr(`${t} not found matching ${JSON.stringify(e)}`);if(r.length>1)throw new Cr(`Expected one ${t} matching ${JSON.stringify(e)}, but found ${r.length}`)}},Qe=t=>s.z.union([s.z.null().transform(()=>[]),t.array()]),Bd=s.z.object({leaseholder:s.z.number().optional(),keys:s.z.number().array().optional(),names:s.z.string().array().optional(),search:s.z.string().optional(),rangeKey:s.z.string().optional(),limit:s.z.number().optional(),offset:s.z.number().optional(),dataTypes:A.z.array().optional(),notDataTypes:A.z.array().optional(),virtual:s.z.boolean().optional(),isIndex:s.z.boolean().optional(),internal:s.z.boolean().optional()}),Ud=s.z.object({channels:Qe(Dt)}),Re=t=>Yr(t,{number:"keys",string:"names"}),Ja=class Ha{constructor(e){c(this,"client"),this.client=e}async search(e,r){return await this.execute({search:e,...r})}async retrieve(e,r){const n=Re(e),{variant:i}=n;let{normalized:a}=n;return i==="keys"&&a.indexOf(0)!==-1&&(a=a.filter(o=>o!==0)),a.length===0?[]:await this.execute({[i]:a,...r})}async page(e,r,n){return await this.execute({offset:e,limit:r,...n})}async execute(e){const[r,n]=await this.client.send(Ha.ENDPOINT,e,Bd,Ud);if(n!=null)throw n;return r.channels}};c(Ja,"ENDPOINT","/channel/retrieve");let ts=Ja;class rs{constructor(e){c(this,"cache"),c(this,"namesToKeys"),c(this,"wrapped"),this.cache=new Map,this.namesToKeys=new Map,this.wrapped=e}async search(e,r){return await this.wrapped.search(e,r)}async page(e,r,n){return await this.wrapped.page(e,r,n)}async retrieve(e,r){const{normalized:n}=Yr(e,{string:"names",number:"keys"}),i=[],a=[];if(n.forEach(l=>{const u=this.get(l);u!=null?i.push(...u):a.push(l)}),a.length===0)return i;const o=await this.wrapped.retrieve(a,r);return this.set(o),i.concat(o)}delete(e){const{variant:r,normalized:n}=Re(e);r==="names"?n.forEach(i=>{const a=this.namesToKeys.get(i);a!=null&&(a.forEach(o=>this.cache.delete(o)),this.namesToKeys.delete(i))}):n.forEach(i=>{const a=this.cache.get(i);a!=null&&(this.cache.delete(i),this.namesToKeys.delete(a.name))})}rename(e,r){e.forEach((n,i)=>{const a=r[i],o=this.cache.get(n);if(o==null)return;this.cache.delete(n);const l=this.namesToKeys.get(o.name);l!=null&&(l.delete(n),l.size===0&&this.namesToKeys.delete(o.name)),o.name=a,this.cache.set(n,o);const u=this.namesToKeys.get(a);u==null?this.namesToKeys.set(a,new Set([n])):u.add(n)})}set(e){e.forEach(r=>{this.cache.set(r.key,r);const n=this.namesToKeys.get(r.name);n==null?this.namesToKeys.set(r.name,new Set([r.key])):n.add(r.key)})}get(e){if(typeof e=="number"){const i=this.cache.get(e);return i==null?void 0:[i]}const r=this.namesToKeys.get(e);if(r==null)return;const n=[];if(r.forEach(i=>{const a=this.cache.get(i);a!=null&&n.push(a)}),n.length!==0)return n}}class Xa{constructor(e,r){c(this,"mu",new Pd),c(this,"requests",new Map),c(this,"wrapped"),c(this,"debouncedRun"),this.wrapped=e,this.debouncedRun=Zh(()=>{this.run()},r)}async search(e,r){return await this.wrapped.search(e,r)}async page(e,r,n){return await this.wrapped.page(e,r,n)}async retrieve(e){const{normalized:r,variant:n}=Re(e);return n==="names"?await this.wrapped.retrieve(r):await new Promise((i,a)=>{this.mu.runExclusive(()=>{this.requests.set(r,{resolve:i,reject:a}),this.debouncedRun()})})}async run(){await this.mu.runExclusive(async()=>{const e=new Set;this.requests.forEach((r,n)=>n.forEach(i=>e.add(i)));try{const r=await this.wrapped.retrieve(Array.from(e));this.requests.forEach((n,i)=>n.resolve(r.filter(a=>i.includes(a.key))))}catch(r){this.requests.forEach(n=>n.reject(r))}finally{this.requests.clear()}})}}const Qa=async(t,e)=>{const{normalized:r}=Re(e),n=await t.retrieve(r),i=[];if(r.forEach(a=>{n.find(o=>o.name===a||o.key===a)==null&&i.push(a)}),i.length>0)throw new we(`Could not find channels: ${JSON.stringify(i)}`);return n};class eo{constructor({dataType:e,rate:r,name:n,leaseholder:i=0,key:a=0,isIndex:o=!1,index:l=0,internal:u=!1,frameClient:d,alias:f}){c(this,"_frameClient"),c(this,"key"),c(this,"name"),c(this,"rate"),c(this,"dataType"),c(this,"leaseholder"),c(this,"index"),c(this,"isIndex"),c(this,"internal"),c(this,"alias"),this.key=a,this.name=n,this.rate=new Xn(r??0),this.dataType=new A(e),this.leaseholder=i,this.index=l,this.isIndex=o,this.internal=u,this.alias=f,this._frameClient=d??null}get framer(){if(this._frameClient==null)throw new G("cannot read from a channel that has not been created");return this._frameClient}get payload(){return Dt.parse({key:this.key,name:this.name,rate:this.rate.valueOf(),dataType:this.dataType.valueOf(),leaseholder:this.leaseholder,index:this.index,isIndex:this.isIndex,internal:this.internal})}get ontologyID(){return new he({type:"channel",key:this.key.toString()})}async read(e){return await this.framer.read(e,this.key)}async write(e,r){return await this.framer.write(e,this.key,r)}}const Ld="/channel/retrieve-group",Yd=s.z.object({}),qd=s.z.object({group:_a});let to=class{constructor(t,e,r,n){c(this,"type","channel"),c(this,"frameClient"),c(this,"client"),c(this,"retriever"),c(this,"writer"),this.frameClient=t,this.retriever=e,this.client=r,this.writer=n}async create(t,e={}){const{retrieveIfNameExists:r=!1}=e,n=!Array.isArray(t);let i=N(t),a=[];if(r){const o=await this.retriever.retrieve(i.map(u=>u.name)),l=new Set(o.map(u=>u.name));i=i.filter(u=>!l.has(u.name)),a=this.sugar(o)}return a=a.concat(this.sugar(await this.writer.create(i))),n?a[0]:a}async retrieve(t,e){const r=!Array.isArray(t),n=this.sugar(await this.retriever.retrieve(t,e));return qr("channel",t,n,r),r?n[0]:n}async search(t,e){return this.sugar(await this.retriever.search(t,e))}async delete(t){const{normalized:e,variant:r}=Re(t);return r==="keys"?await this.writer.delete({keys:e}):await this.writer.delete({names:e})}async rename(t,e){return await this.writer.rename(N(t),N(e))}newSearcherWithOptions(t){return{type:this.type,search:async e=>await this.search(e,t),retrieve:async e=>await this.retrieve(e,t),page:async(e,r)=>await this.page(e,r,t)}}async page(t,e,r){return this.sugar(await this.retriever.page(t,e,r))}createDebouncedBatchRetriever(t=10){return new rs(new Xa(new ts(this.client),t))}sugar(t){const{frameClient:e}=this;return t.map(r=>new eo({...r,frameClient:e}))}async retrieveGroup(){const t=await v(this.client,Ld,{},Yd,qd);return new Fa(t.group.name,t.group.key)}};const Fd=s.z.object({channels:Za.array()}),_d=s.z.object({channels:Dt.array()}),Wd=s.z.object({keys:Be.array().optional(),names:s.z.string().array().optional()}),Gd=s.z.object({}),Zd=s.z.object({keys:Be.array(),names:s.z.string().array()}),Vd=s.z.object({}),Kd="/channel/create",Jd="/channel/delete",Hd="/channel/rename";let ro=class{constructor(t,e){c(this,"client"),c(this,"cache"),this.client=t,this.cache=e}async create(t){const{channels:e}=await v(this.client,Kd,{channels:t},Fd,_d);return this.cache.set(e),e}async delete(t){await v(this.client,Jd,t,Wd,Gd),t.keys!=null&&this.cache.delete(t.keys),t.names!=null&&this.cache.delete(t.names)}async rename(t,e){await v(this.client,Hd,{keys:t,names:e},Zd,Vd),this.cache.rename(t,e)}};const Xd=Object.freeze(Object.defineProperty({__proto__:null,CacheRetriever:rs,Channel:eo,ChannelOntologyType:Va,Client:to,ClusterRetriever:ts,DebouncedBatchRetriever:Xa,Writer:ro,analyzeChannelParams:Re,keyZ:Be,newPayload:Za,ontologyID:Cd,payload:Dt,retrieveRequired:Qa},Symbol.toStringTag,{value:"Module"})),ns=s.z.string().uuid(),ss=s.z.object({key:ns,subjects:ye.array(),objects:ye.array(),actions:s.z.string().array()}),Qd=ss.extend({key:ns.optional()}),ef="/access/policy/create",tf="/access/policy/delete",rf="/access/policy/retrieve",nf=s.z.object({policies:Qd.array()}),sf=s.z.object({policies:ss.array()}),af=s.z.object({keys:ns.array()}),of=s.z.object({}),cf=s.z.object({subject:ye}),lf=s.z.object({policies:ss.array().optional().default([])});let uf=class{constructor(t){c(this,"client"),this.client=t}async create(t){const e=!Array.isArray(t),{policies:r}=await v(this.client,ef,{policies:N(t)},nf,sf);return e?r[0]:r}async retrieve(t){const{policies:e}=await v(this.client,rf,{subject:t},cf,lf);return e}async delete(t){await v(this.client,tf,{keys:N(t)},af,of)}};const hf="/user/register";let df=class{constructor(t){c(this,"client"),this.client=t}async register(t,e){const{user:r}=await v(this.client,hf,{username:t,password:e},no,so);return r}};s.z.string().uuid();const ff=s.z.object({key:s.z.string(),username:s.z.string()}),no=s.z.object({username:s.z.string(),password:s.z.string()}),so=s.z.object({token:s.z.string(),user:ff}),hi="/auth/login",yf=3;let gf=class{constructor(t,e){c(this,"token"),c(this,"client"),c(this,"credentials"),c(this,"authenticating"),c(this,"authenticated"),c(this,"user"),c(this,"retryCount"),this.client=t,this.authenticated=!1,this.credentials=e,this.retryCount=0}middleware(){const t=async(e,r)=>{if(!this.authenticated&&!e.target.endsWith(hi)){this.authenticating==null&&(this.authenticating=new Promise((o,l)=>{this.client.send(hi,this.credentials,no,so).then(([u,d])=>{if(d!=null)return o(d);this.token=u==null?void 0:u.token,this.user=u==null?void 0:u.user,this.authenticated=!0,o(null)}).catch(l)}));const a=await this.authenticating;if(a!=null)return[e,a]}e.params.Authorization=`Bearer ${this.token}`;const[n,i]=await r(e);return $n.matches(i)&&this.retryCount<yf?(this.authenticated=!1,this.authenticating=void 0,this.retryCount+=1,t(e,r)):(this.retryCount=0,[n,i])};return t}};const pf=["disconnected","connecting","connected","failed"],mf=s.z.enum(pf),wf=s.z.object({status:mf,error:s.z.instanceof(Error).optional(),message:s.z.string().optional(),clusterKey:s.z.string()}),bf=s.z.object({clusterKey:s.z.string()}),io={clusterKey:"",status:"disconnected",error:void 0,message:"Disconnected"},Sr=class ao{constructor(e,r=I.seconds(30),n){c(this,"_state"),c(this,"pollFrequency",I.seconds(30)),c(this,"client"),c(this,"name"),c(this,"interval"),c(this,"onChangeHandlers",[]),this._state={...io},this.client=e,this.pollFrequency=r,this.name=n,this.check(),this.startChecking()}stopChecking(){this.interval!=null&&clearInterval(this.interval)}async check(){var e;const r=this._state.status;try{const[n,i]=await this.client.send(ao.ENDPOINT,{},s.z.object({}),bf);if(i!=null)throw i;this._state.status="connected",this._state.message=`Connected to ${this.name??"cluster"}`,this._state.clusterKey=n.clusterKey}catch(n){this._state.status="failed",this._state.error=n,this._state.message=(e=this.state.error)==null?void 0:e.message}return this.onChangeHandlers.length>0&&r!==this._state.status&&this.onChangeHandlers.forEach(n=>n(this.state)),this.state}get state(){return{...this._state}}onChange(e){this.onChangeHandlers.push(e)}startChecking(){this.interval=setInterval(()=>{this.check()},this.pollFrequency.milliseconds)}};c(Sr,"ENDPOINT","/connectivity/check"),c(Sr,"DEFAULT",io),c(Sr,"connectionStateZ",wf);let oo=Sr;const vf=s.z.object({keys:Be.array().optional(),bounds:oe.z,names:s.z.string().array().optional()}),Of=s.z.object({}),Tf="/frame/delete";class Sf{constructor(e){c(this,"client"),this.client=e}async delete(e){await v(this.client,Tf,e,vf,Of)}}const di=t=>{const e=N(t);return e.length===0?null:typeof e[0]=="number"||!isNaN(parseInt(e[0]))?"key":"name"},fi=(t,e)=>{const r=N(t);if(r.length===e.length)return;const n=di(t);throw di===null?new G("[Frame] - channel keys or names must be provided when constructing a frame."):new G(`[Frame] - ${n}s and arrays must be the same length.
|
|
34
34
|
Got ${r.length} ${n}s and ${e.length} arrays.`)};let pe=class Ve{constructor(e=[],r=[]){if(c(this,"columns",[]),c(this,"series",[]),e instanceof Ve){this.columns=e.columns,this.series=e.series;return}if(e instanceof Map){e.forEach((n,i)=>this.push(i,...N(n)));return}if(typeof e=="object"&&!Array.isArray(e)){if("keys"in e&&"series"in e){const n=e,i=n.series.map(a=>lo(a));fi(n.keys,i),n.keys.forEach((a,o)=>this.push(a,i[o]))}else Object.entries(e).forEach(([n,i])=>{const a=parseInt(n);if(isNaN(a))this.push(n,...N(i));else return this.push(a,...N(i))});return}if(Array.isArray(e)||["string","number"].includes(typeof e)){const n=N(r),i=N(e);fi(i,n),n.forEach((a,o)=>this.push(i[o],a));return}throw new G(`[Frame] - invalid frame construction parameters. data parameter ust be a frame
|
|
35
35
|
payload, a list of lazy arrays, a lazy array, a map, or a record keyed by channel
|
|
36
|
-
name. keys parameter must be a set of channel keys or channel names.`)}get colType(){return this.columns.length===0?null:typeof this.columns[0]=="string"?"name":"key"}get keys(){if(this.colType==="name")throw new me("colType is not key");return this.columns??[]}get uniqueKeys(){return ti(this.keys)}get names(){if(this.colType==="key")throw new me("colType is not name");return this.columns??[]}get uniqueNames(){return ti(this.names)}get uniqueColumns(){return this.colType==="key"?this.uniqueKeys:this.uniqueNames}toPayload(){return{series:this.series.map(e=>uo(e)),keys:this.keys}}get isVertical(){return this.uniqueColumns.length===this.columns.length}get isHorizontal(){return this.uniqueColumns.length===1}get isSquare(){return this.isHorizontal&&this.isVertical}get isWeaklyAligned(){if(this.columns.length<=1)return!0;const e=this.timeRanges;return e.every(r=>r.equals(e[0]))}timeRange(e){if(e==null){if(this.columns.length===0)return oe.ZERO;const n=E.min(...this.series.map(a=>a.timeRange.start)),i=E.max(...this.series.map(a=>a.timeRange.end));return new oe(n,i)}const r=this.get(e);return r==null?oe.ZERO:r.timeRange}latest(){return this.at(-1)}get timeRanges(){return this.uniqueColumns.map(e=>this.timeRange(e))}get(e){return Array.isArray(e)?this.filter(r=>e.includes(r)):new Wh(this.series.filter((r,n)=>this.columns[n]===e))}push(e,...r){if(e instanceof Ve){if(this.colType!==null&&e.colType!==this.colType)throw new G("keyVariant must match");this.series.push(...e.series),this.columns.push(...e.columns)}else{if(this.series.push(...r),typeof e=="string"&&this.colType==="key")throw new G("keyVariant must match");if(typeof e!="string"&&this.colType==="name")throw new G("keyVariant must match");this.columns.push(...Array.from({length:r.length},()=>e))}}concat(e){return new Ve([...this.columns,...e.columns],[...this.series,...e.series])}has(e){return typeof e=="string"&&this.colType==="key"||typeof e=="number"&&this.colType==="name"?!1:this.columns.includes(e)}map(e){const r=new Ve;return this.forEach((n,i,a)=>r.push(...e(n,i,a))),r}forEach(e){this.columns.forEach((r,n)=>{const i=this.series[n];e(r,i,n)})}at(e,r=!1){const n={};return this.uniqueColumns.forEach(i=>{n[i]=this.get(i).at(e,r)}),n}filter(e){const r=new Ve;return this.columns.forEach((n,i)=>{const a=this.series[i];e(n,a,i)&&r.push(n,a)}),r}get byteLength(){return new It(this.series.reduce((e,r)=>e.add(r.byteLength),It.ZERO))}get length(){return this.series.reduce((e,r)=>e+r.length,0)}};const co=s.z.object({timeRange:oe.z.optional(),alignment:s.z.bigint().or(s.z.string().transform(t=>BigInt(t))).optional(),dataType:A.z,data:s.z.string().transform(t=>new Uint8Array(atob(t).split("").map(e=>e.charCodeAt(0))).buffer)}),Fr=s.z.object({keys:s.z.union([s.z.null().transform(()=>[]),s.z.number().array().optional().default([])]),series:s.z.union([s.z.null().transform(()=>[]),co.array().optional().default([])])}),lo=t=>{const{dataType:e,data:r,timeRange:n,alignment:i}=t;return new Fe({data:r,dataType:e,timeRange:n,glBufferUsage:"static",alignment:i})},uo=t=>({timeRange:t._timeRange,dataType:t.dataType,data:new Uint8Array(t.data.buffer),alignment:t.alignment});class _r{constructor(e){c(this,"adapter"),c(this,"retriever"),c(this,"keys"),this.retriever=e,this.adapter=null,this.keys=[]}static async open(e,r){const n=new _r(e);return await n.update(r),n}async update(e){const{variant:r,normalized:n}=Re(e);if(r==="keys"){this.adapter=null,this.keys=n;return}const i=await this.retriever.retrieve(n),a=new Map;this.adapter=a,n.forEach(o=>{const l=i.find(u=>u.name===o);if(l==null)throw new Error(`Channel ${o} not found`);a.set(l.key,l.name)}),this.keys=Array.from(this.adapter.keys())}adapt(e){if(this.adapter==null)return e;const r=this.adapter;return e.map((n,i)=>{if(typeof n=="number"){const a=r.get(n);if(a==null)throw new Error(`Channel ${n} not found`);return[a,i]}return[n,i]})}}class is{constructor(e){c(this,"adapter"),c(this,"retriever"),c(this,"keys"),this.retriever=e,this.adapter=null,this.keys=[]}static async open(e,r){const n=new is(e);return await n.update(r),n}async update(e){const r=await Qa(this.retriever,e);this.adapter=new Map(r.map(n=>[n.name,n.key])),this.keys=r.map(n=>n.key)}async fetchChannel(e){const r=await this.retriever.retrieve(e);if(r.length===0)throw new Error(`Channel ${e} not found`);return r[0]}async adapt(e,r){if(typeof e=="string"||typeof e=="number"){if(r==null)throw new G(`
|
|
36
|
+
name. keys parameter must be a set of channel keys or channel names.`)}get colType(){return this.columns.length===0?null:typeof this.columns[0]=="string"?"name":"key"}get keys(){if(this.colType==="name")throw new me("colType is not key");return this.columns??[]}get uniqueKeys(){return ti(this.keys)}get names(){if(this.colType==="key")throw new me("colType is not name");return this.columns??[]}get uniqueNames(){return ti(this.names)}get uniqueColumns(){return this.colType==="key"?this.uniqueKeys:this.uniqueNames}toPayload(){return{series:this.series.map(e=>uo(e)),keys:this.keys}}get isVertical(){return this.uniqueColumns.length===this.columns.length}get isHorizontal(){return this.uniqueColumns.length===1}get isSquare(){return this.isHorizontal&&this.isVertical}get isWeaklyAligned(){if(this.columns.length<=1)return!0;const e=this.timeRanges;return e.every(r=>r.equals(e[0]))}timeRange(e){if(e==null){if(this.columns.length===0)return oe.ZERO;const n=E.min(...this.series.map(a=>a.timeRange.start)),i=E.max(...this.series.map(a=>a.timeRange.end));return new oe(n,i)}const r=this.get(e);return r==null?oe.ZERO:r.timeRange}latest(){return this.at(-1)}get timeRanges(){return this.uniqueColumns.map(e=>this.timeRange(e))}get(e){return Array.isArray(e)?this.filter(r=>e.includes(r)):new Wh(this.series.filter((r,n)=>this.columns[n]===e))}push(e,...r){if(e instanceof Ve){if(this.colType!==null&&e.colType!==this.colType)throw new G("keyVariant must match");this.series.push(...e.series),this.columns.push(...e.columns)}else{if(this.series.push(...r),typeof e=="string"&&this.colType==="key")throw new G("keyVariant must match");if(typeof e!="string"&&this.colType==="name")throw new G("keyVariant must match");this.columns.push(...Array.from({length:r.length},()=>e))}}concat(e){return new Ve([...this.columns,...e.columns],[...this.series,...e.series])}has(e){return typeof e=="string"&&this.colType==="key"||typeof e=="number"&&this.colType==="name"?!1:this.columns.includes(e)}map(e){const r=new Ve;return this.forEach((n,i,a)=>r.push(...e(n,i,a))),r}forEach(e){this.columns.forEach((r,n)=>{const i=this.series[n];e(r,i,n)})}at(e,r=!1){const n={};return this.uniqueColumns.forEach(i=>{n[i]=this.get(i).at(e,r)}),n}filter(e){const r=new Ve;return this.columns.forEach((n,i)=>{const a=this.series[i];e(n,a,i)&&r.push(n,a)}),r}get byteLength(){return new It(this.series.reduce((e,r)=>e.add(r.byteLength),It.ZERO))}get length(){return this.series.reduce((e,r)=>e+r.length,0)}};const co=s.z.object({timeRange:oe.z.optional(),alignment:s.z.bigint().or(s.z.string().transform(t=>BigInt(t))).optional(),dataType:A.z,data:s.z.string().transform(t=>new Uint8Array(atob(t).split("").map(e=>e.charCodeAt(0))).buffer)}),Fr=s.z.object({keys:s.z.union([s.z.null().transform(()=>[]),s.z.number().array().optional().default([])]),series:s.z.union([s.z.null().transform(()=>[]),co.array().optional().default([])])}),lo=t=>{const{dataType:e,data:r,timeRange:n,alignment:i}=t;return new Fe({data:r,dataType:e,timeRange:n,glBufferUsage:"static",alignment:i})},uo=t=>({timeRange:t._timeRange,dataType:t.dataType,data:new Uint8Array(t.data.buffer),alignment:t.alignment});class _r{constructor(e){c(this,"adapter"),c(this,"retriever"),c(this,"keys"),this.retriever=e,this.adapter=null,this.keys=[]}static async open(e,r){const n=new _r(e);return await n.update(r),n}async update(e){const{variant:r,normalized:n}=Re(e);if(r==="keys"){this.adapter=null,this.keys=n;return}const i=await this.retriever.retrieve(n),a=new Map;this.adapter=a,n.forEach(o=>{const l=i.find(u=>u.name===o);if(l==null)throw new Error(`Channel ${o} not found`);a.set(l.key,l.name)}),this.keys=Array.from(this.adapter.keys())}adapt(e){if(this.adapter==null)return e;const r=this.adapter;return e.map((n,i)=>{if(typeof n=="number"){const a=r.get(n);if(a==null)throw new Error(`Channel ${n} not found`);return[a,i]}return[n,i]})}}class is{constructor(e){c(this,"adapter"),c(this,"retriever"),c(this,"keys"),this.retriever=e,this.adapter=null,this.keys=[]}static async open(e,r){const n=new is(e);return await n.update(r),n}async adaptObjectKeys(e){const r={};for(const[n,i]of Object.entries(e))r[await this.adaptToKey(n)]=i;return r}async update(e){const r=await Qa(this.retriever,e);this.adapter=new Map(r.map(n=>[n.name,n.key])),this.keys=r.map(n=>n.key)}async fetchChannel(e){const r=await this.retriever.retrieve(e);if(r.length===0)throw new Error(`Channel ${e} not found`);return r[0]}async adaptToKey(e){return typeof e=="number"?e:(await this.fetchChannel(e)).key}async adapt(e,r){if(typeof e=="string"||typeof e=="number"){if(r==null)throw new G(`
|
|
37
37
|
Received a single channel name or key but no series.
|
|
38
38
|
`);if(Array.isArray(r)){if(r.some(u=>u instanceof Fe||Array.isArray(u)))throw new G(`
|
|
39
39
|
Received a single channel name or key but multiple series.
|
|
@@ -46,6 +46,6 @@
|
|
|
46
46
|
`);const f=new Fe({data:r[u],dataType:d.dataType});o.push(d.key),l.push(f)}return new pe(o,l)}if(e instanceof pe||e instanceof Map){const o=new pe(e);if(this.adapter==null)return o;let l=[];return l=o.columns.map(u=>{var d;const f=typeof u=="string"?(d=this.adapter)==null?void 0:d.get(u):u;if(f==null)throw new G(`
|
|
47
47
|
Channel ${u} was not provided in the list of channels when opening the writer
|
|
48
48
|
`);return f}),new pe(l,o.series)}const n=[],i=[],a=Object.entries(e);for(let o=0;o<a.length;o++){const[l,u]=a[o],d=await this.fetchChannel(l),f=new Fe({data:u,dataType:d.dataType});n.push(d.key),i.push(f)}return new pe(n,i)}}class as{constructor(e,r){c(this,"name"),c(this,"stream"),this.stream=r,this.name=e}async receive(){const[e,r]=await this.stream.receive();if(r!=null)throw r;return e}received(){return this.stream.received()}async closeAndAck(){for(this.stream.closeSend();;){const[e,r]=await this.stream.receive();if(e!=null&&console.warn(`${this.name} received unexpected response on closure.
|
|
49
|
-
Please report this error to the Synnax team. ${JSON.stringify(e)}`),r!=null){if(De.matches(r))return;throw r}}}closeSend(){this.stream.closeSend()}send(e){const r=this.stream.send(e);if(r!=null)throw r}}const Mn=new I(-1);var os=(t=>(t[t.Open=0]="Open",t[t.Next=1]="Next",t[t.Prev=2]="Prev",t[t.SeekFirst=3]="SeekFirst",t[t.SeekLast=4]="SeekLast",t[t.SeekLE=5]="SeekLE",t[t.SeekGE=6]="SeekGE",t[t.Valid=7]="Valid",t[t.Error=8]="Error",t))(os||{}),ho=(t=>(t[t.None=0]="None",t[t.Ack=1]="Ack",t[t.Data=2]="Data",t))(ho||{});const zf=s.z.object({command:s.z.nativeEnum(os),span:I.z.optional(),bounds:oe.z.optional(),stamp:E.z.optional(),keys:s.z.number().array().optional(),chunkSize:s.z.number().optional()}),Nf=s.z.object({variant:s.z.nativeEnum(ho),ack:s.z.boolean(),command:s.z.nativeEnum(os),error:Mt.optional().nullable(),frame:Fr.optional()}),fo=class Dn{constructor(e,r){c(this,"stream"),c(this,"adapter"),c(this,"value"),this.stream=new as("Iterator",e),this.value=new pe,this.adapter=r}static async _open(e,r,n,i,a={}){const o=await _r.open(n,r),l=await i.stream(Dn.ENDPOINT,zf,Nf),u=new Dn(l,o);return await u.execute({command:0,keys:o.keys,bounds:new oe(e),chunkSize:a.chunkSize??1e5}),u}async next(e=Mn){return await this.execute({command:1,span:new I(e)})}async prev(e=Mn){return await this.execute({command:2,span:new I(e)})}async seekFirst(){return await this.execute({command:3})}async seekLast(){return await this.execute({command:4})}async seekLE(e){return await this.execute({command:5,stamp:new E(e)})}async seekGE(e){return await this.execute({command:6,stamp:new E(e)})}async valid(){return await this.execute({command:7})}async close(){await this.stream.closeAndAck()}[Symbol.asyncIterator](){return new Ef(this)}async execute(e){for(this.stream.send(e),this.value=new pe;;){const r=await this.stream.receive();if(r.variant===1)return r.ack;this.value.push(this.adapter.adapt(new pe(r.frame)))}}};c(fo,"ENDPOINT","/frame/iterate");let yo=fo;class Ef{constructor(e){c(this,"iter"),c(this,"open",!1),this.iter=e}async next(){try{let e=!0;return this.open||(await this.iter.seekFirst()||(e=!1),this.open=!0),await this.iter.next()||(e=!1),e||await this.iter.close(),{done:!e,value:this.iter.value}}catch(e){throw await this.iter.close(),e}}}const If=s.z.object({start:E.z.optional(),keys:s.z.number().array()}),Af=s.z.object({frame:Fr,error:Mt.optional().nullable()}),kf="/frame/stream";class Wr{constructor(e,r){c(this,"stream"),c(this,"adapter"),this.stream=new as("Streamer",e),this.adapter=r}get keys(){return this.adapter.keys}static async _open(e,r,{channels:n,from:i}){const a=await _r.open(e,n),o=await r.stream(kf,If,Af),l=new Wr(o,a);return o.send({start:new E(i),keys:a.keys}),l}async next(){try{return{done:!1,value:await this.read()}}catch(e){if(De.matches(e))return{done:!0,value:void 0};throw e}}async read(){return this.adapter.adapt(new pe((await this.stream.receive()).frame))}async update(e){await this.adapter.update(e),this.stream.send({keys:this.adapter.keys})}close(){this.stream.closeSend()}[Symbol.asyncIterator](){return this}}class Pt extends Cn.Observer{constructor(e,r){super(r),c(this,"streamer"),c(this,"closePromise"),this.streamer=e,this.closePromise=this.stream()}async close(){this.streamer.close(),await this.closePromise}async stream(){for await(const e of this.streamer)this.notify(e)}}var cs=(t=>(t[t.Open=0]="Open",t[t.Write=1]="Write",t[t.Commit=2]="Commit",t[t.Error=3]="Error",t[t.SetAuthority=4]="SetAuthority",t))(cs||{}),At=(t=>(t[t.PersistStream=1]="PersistStream",t[t.PersistOnly=2]="PersistOnly",t[t.StreamOnly=3]="StreamOnly",t))(At||{});const xf=new I(-1),Cf=s.z.object({start:E.z.optional(),controlSubject:He.subjectZ.optional(),keys:s.z.number().array().optional(),authorities:He.Authority.z.array().optional(),mode:s.z.nativeEnum(At).optional(),errOnUnauthorized:s.z.boolean().optional(),enableAutoCommit:s.z.boolean().optional(),autoIndexPersistInterval:I.z.optional()}),jf=s.z.object({command:s.z.nativeEnum(cs),config:Cf.optional(),frame:Fr.optional()}),Rf=s.z.object({ack:s.z.boolean(),command:s.z.nativeEnum(cs),error:Mt.optional().nullable()});var nt;let go=(nt=class{constructor(t,e){c(this,"stream"),c(this,"adapter"),this.stream=new as("Writer",t),this.adapter=e}static async _open(t,e,{channels:r,start:n=E.now(),authorities:i=He.Authority.Absolute,controlSubject:a,mode:o=1,errOnUnauthorized:l=!1,enableAutoCommit:u=!1,autoIndexPersistInterval:d=I.SECOND}){const f=await is.open(t,r),h=await e.stream(nt.ENDPOINT,jf,Rf),M=new nt(h,f);return await M.execute({command:0,config:{start:new E(n),keys:f.keys,controlSubject:a,authorities:N(i),mode:o,errOnUnauthorized:l,enableAutoCommit:u,autoIndexPersistInterval:d}}),M}async write(t,e){const r=await this.adapter.adapt(t,e);return this.stream.send({command:1,frame:r.toPayload()}),!0}async setAuthority(t){return(await this.execute({command:4,config:{keys:Object.keys(t).map(e=>Number(e)),authorities:Object.values(t)}})).ack}async commit(){return this.errorAccumulated?!1:(await this.execute({command:2})).ack}async error(){this.stream.send({command:3});const t=await this.execute({command:3});return t.error!=null?Kn(t.error):null}async close(){await this.stream.closeAndAck()}async execute(t){for(this.stream.send(t);;){const e=await this.stream.receive();if(e.command===t.command)return e;console.warn("writer received unexpected response",e)}}get errorAccumulated(){return this.stream.received()}},c(nt,"ENDPOINT","/frame/write"),nt),po=class{constructor(t,e,r){c(this,"streamClient"),c(this,"retriever"),c(this,"deleter"),this.streamClient=t,this.retriever=r,this.deleter=new Sf(e)}async openIterator(t,e,r){return await yo._open(t,e,this.retriever,this.streamClient,r)}async openWriter(t){return(Array.isArray(t)||typeof t!="object")&&(t={channels:t}),await go._open(this.retriever,this.streamClient,t)}async openStreamer(t){return(Array.isArray(t)||typeof t!="object")&&(t={channels:t}),await Wr._open(this.retriever,this.streamClient,t)}async write(t,e,r){if(r==null){const i=e,a=await this.openWriter({start:t,channels:Object.keys(i),mode:At.PersistOnly});try{await a.write(i),await a.commit()}finally{await a.close()}return}const n=await this.openWriter({start:t,channels:e,mode:At.PersistOnly,errOnUnauthorized:!0,enableAutoCommit:!0,autoIndexPersistInterval:I.MAX});try{await n.write(e,r)}finally{await n.close()}}async read(t,e){const{single:r}=Re(e),n=await this.readFrame(t,e);return r?n.get(e):n}async readFrame(t,e){const r=await this.openIterator(t,e),n=new pe;try{for await(const i of r)n.push(i)}finally{await r.close()}return n}async delete(t,e){const{normalized:r,variant:n}=Re(t);return n==="keys"?await this.deleter.delete({keys:r,bounds:e}):await this.deleter.delete({names:r,bounds:e})}};const $f=Object.freeze(Object.defineProperty({__proto__:null,ALWAYS_INDEX_PERSIST_ON_AUTO_COMMIT:xf,AUTO_SPAN:Mn,Client:po,Frame:pe,Iterator:yo,ObservableStreamer:Pt,Streamer:Wr,Writer:go,WriterMode:At,frameZ:Fr,series:co,seriesFromPayload:lo,seriesToPayload:uo},Symbol.toStringTag,{value:"Module"})),Mf=He.Authority,Df=He.stateZ(s.z.number()),Pf=t=>{var e,r;return t.to==null?`${(e=t.from)==null?void 0:e.resource} - ${(r=t.from)==null?void 0:r.subject.name} -> released`:t.from==null?`${t.to.resource} - released -> ${t.to.subject.name} (${t.to.authority.toString()})`:`${t.to.resource} - ${t.from.subject.name} -> ${t.to.subject.name} (${t.to.authority.toString()})`};class mo extends Pt{constructor(e){super(e,r=>{const n=this.codec.decode(r.series[0].buffer);return this.merge(n),[n.transfers,!0]}),c(this,"states"),c(this,"codec"),this.states=new Map,this.codec=new Xe.JSONCodec}subjects(){const e=new Map;return this.states.forEach(r=>e.set(r.subject.key,r.subject)),Array.from(e.values())}merge(e){e.transfers.forEach(r=>{r.from==null&&r.to==null&&console.warn("Invalid transfer: ",r),r.to==null?this.states.delete(r.from.resource):this.states.set(r.to.resource,r.to)})}}const Bf="sy_node_1_control";let wo=class{constructor(t){c(this,"framer"),this.framer=t}async openStateTracker(){const t=await this.framer.openStreamer(Bf);return new mo(t)}};const Uf=Object.freeze(Object.defineProperty({__proto__:null,Authority:Mf,Client:wo,StateTracker:mo,stateZ:Df,transferString:Pf},Symbol.toStringTag,{value:"Module"}));let Lf=class{constructor(t,e,r){c(this,"tasks"),c(this,"racks"),c(this,"devices"),this.tasks=t,this.racks=e,this.devices=r}};const Bt=s.z.number(),ls=s.z.object({key:Bt,name:s.z.string()}),Yf=ls.partial({key:!0}),us=s.z.string(),Gr=s.z.object({key:us,rack:Bt,name:s.z.string(),make:s.z.string(),model:s.z.string(),location:s.z.string(),configured:s.z.boolean().optional(),properties:s.z.record(s.z.unknown()).or(s.z.string().transform(t=>t===""?{}:Xe.JSON_CODEC.decodeString(t)))}),qf=Gr.extend({properties:s.z.unknown().transform(t=>Xe.JSON_CODEC.encodeString(t))}),Ut=async(t,e,r,n)=>{const i=await t.openStreamer([e,r]),a=o=>{const l=[];return r!=null&&l.push(...o.get(r).series.flatMap(u=>n("delete",u))),e!=null&&l.push(...o.get(e).series.flatMap(u=>n("set",u))),[l,l.length>0]};return new Pt(i,a)},Ff="sy_device_set",_f="sy_device_delete",un="/hardware/device/retrieve",Wf="/hardware/device/create",Gf="/hardware/device/delete",Zf=s.z.object({devices:qf.array()}),Vf=s.z.object({devices:Gr.array()}),Kf=s.z.object({keys:us.array()}),Jf=s.z.object({}),hn=s.z.object({search:s.z.string().optional(),limit:s.z.number().optional(),offset:s.z.number().optional(),keys:us.array().optional(),names:s.z.string().array().optional(),makes:s.z.string().array().optional()}),dn=s.z.object({devices:Qe(Gr)});let Hf=class{constructor(t,e){c(this,"type","device"),c(this,"client"),c(this,"frameClient"),this.client=t,this.frameClient=e}async retrieve(t,e){const r=!Array.isArray(t),n=await v(this.client,un,{keys:N(t),...e},hn,dn);return qr("Device",t,n.devices,r),r?n.devices[0]:n.devices}async search(t,e){return(await v(this.client,un,{search:t,...e},hn,dn)).devices}async page(t,e,r){return(await v(this.client,un,{offset:t,limit:e,...r},hn,dn)).devices}async create(t){const e=!Array.isArray(t),r=await v(this.client,Wf,{devices:N(t)},Zf,Vf);return e?r.devices[0]:r.devices}async delete(t){await v(this.client,Gf,{keys:N(t)},Kf,Jf)}async openDeviceTracker(){return await Ut(this.frameClient,Ff,_f,Xf)}newSearcherWithOptions(t){return{type:this.type,search:async e=>await this.search(e,t),retrieve:async e=>await this.retrieve(e,t),page:async(e,r)=>await this.page(e,r,t)}}};const Xf=(t,e)=>t==="delete"?e.toStrings().map(r=>({variant:t,key:r,value:void 0})):e.parseJSON(Gr).map(r=>({variant:t,key:r.key,value:r})),fn="/hardware/rack/retrieve",Qf="/hardware/rack/create",ey="/hardware/rack/delete",yn=s.z.object({keys:Bt.array().optional(),names:s.z.string().array().optional(),search:s.z.string().optional(),offset:s.z.number().optional(),limit:s.z.number().optional()}),gn=s.z.object({racks:Qe(ls)}),ty=s.z.object({racks:Yf.array()}),ry=s.z.object({racks:ls.array()}),ny=s.z.object({keys:Bt.array()}),sy=s.z.object({});let iy=class{constructor(t,e,r){c(this,"type","rack"),c(this,"client"),c(this,"frameClient"),c(this,"tasks"),this.client=t,this.frameClient=e,this.tasks=r}async delete(t){await v(this.client,ey,{keys:N(t)},ny,sy)}async create(t){const e=!Array.isArray(t),r=await v(this.client,Qf,{racks:N(t)},ty,ry),n=this.sugar(r.racks);return e?n[0]:n}async search(t){const e=await v(this.client,fn,{search:t},yn,gn);return this.sugar(e.racks)}async page(t,e){const r=await v(this.client,fn,{offset:t,limit:e},yn,gn);return this.sugar(r.racks)}async retrieve(t){const{variant:e,normalized:r,single:n}=Yr(t,{string:"names",number:"keys"}),i=await v(this.client,fn,{[e]:r},yn,gn),a=this.sugar(i.racks);return qr("Rack",t,a,n),n?a[0]:a}sugar(t){return t.map(({key:e,name:r})=>new ay(e,r,this.tasks))}};class ay{constructor(e,r,n){c(this,"key"),c(this,"name"),c(this,"tasks"),this.key=e,this.name=r,this.tasks=n}async listTasks(){return await this.tasks.retrieve(this.key)}async retrieveTaskByName(e){return await this.tasks.retrieveByName(e,this.key)}async createTask(e){return e.key=((BigInt(this.key)<<32n)+(BigInt(e.key??0)&0xffffffffn)).toString(),await this.tasks.create(e)}async deleteTask(e){await this.tasks.delete([e])}}const Lt=s.z.union([s.z.string(),s.z.bigint().transform(t=>t.toString()),s.z.number().transform(t=>t.toString())]),Rr=s.z.object({task:Lt,variant:s.z.string(),key:s.z.string().optional(),details:s.z.record(s.z.unknown()).or(s.z.string().transform(t=>t===""?{}:JSON.parse(t))).or(s.z.array(s.z.unknown())).or(s.z.null())}),hs=s.z.object({key:Lt,name:s.z.string(),type:s.z.string(),internal:s.z.boolean().optional(),config:s.z.record(s.z.unknown()).or(s.z.string().transform(t=>t===""?{}:Xe.JSON_CODEC.decodeString(t))),state:Rr.optional().nullable()}),oy=hs.omit({key:!0}).extend({key:Lt.transform(t=>t.toString()).optional(),config:s.z.unknown().transform(t=>Xe.JSON_CODEC.encodeString(t))});s.z.object({task:Lt,type:s.z.string(),key:s.z.string(),args:s.z.record(s.z.unknown()).or(s.z.string().transform(t=>t===""?{}:JSON.parse(t)))});const zt="sy_task_state",yi="sy_task_cmd";class cy{constructor(e,r,n,i,a,o=!1,l){c(this,"key"),c(this,"name"),c(this,"internal"),c(this,"type"),c(this,"config"),c(this,"state"),c(this,"frameClient"),this.key=e,this.name=r,this.type=n,this.config=i,this.internal=o,l!==null&&(this.state=l),this.frameClient=a}get payload(){return{key:this.key,name:this.name,type:this.type,config:this.config,state:this.state,internal:this.internal}}async executeCommand(e,r){const n=await this.frameClient.openWriter(yi),i=Uh.id();return await n.write(yi,[{task:this.key,type:e,key:i,args:r}]),await n.close(),i}async executeCommandSync(e,r,n){const i=await this.frameClient.openStreamer(zt),a=await this.executeCommand(e,r);let o;const l=new Promise(u=>setTimeout(()=>u(!1),new I(n).milliseconds));for(;;){const u=await Promise.any([i.read(),l]);if(u===!1)throw new Error("Command timed out");const d=Rr.safeParse(u.at(-1).sy_task_state);if(d.success){if(o=d.data,o.key===a)break}else console.error(d.error)}return i.close(),o}async openStateObserver(){return new Pt(await this.frameClient.openStreamer(zt),e=>{const r=e.get(zt);if(r.length===0)return[null,!1];const n=Rr.safeParse(r.at(-1));if(!n.success)return[null,!1];const i=n.data;return i.task!==this.key?[null,!1]:[i,!0]})}}const ly=s.z.object({rack:Bt.optional(),keys:s.z.string().array().optional(),names:s.z.string().array().optional(),offset:s.z.number().optional(),limit:s.z.number().optional(),includeState:s.z.boolean().optional()}),uy=s.z.object({tasks:Qe(hs)}),hy="/hardware/task/retrieve",dy="/hardware/task/create",fy="/hardware/task/delete",yy=s.z.object({tasks:oy.array()}),gy=s.z.object({tasks:hs.array()}),py=s.z.object({keys:Lt.array()}),my=s.z.object({});let wy=class{constructor(t,e){c(this,"type","task"),c(this,"client"),c(this,"frameClient"),this.client=t,this.frameClient=e}async create(t){const e=!Array.isArray(t),r=await v(this.client,dy,{tasks:N(t)},yy,gy),n=this.sugar(r.tasks);return e?n[0]:n}async delete(t){await v(this.client,fy,{keys:N(t)},py,my)}async search(t){return await this.execRetrieve({keys:[t]})}async page(t,e){return await this.execRetrieve({offset:t,limit:e})}async list(t={}){return this.sugar(await this.execRetrieve(t))}async retrieve(t,e){const{single:r,normalized:n,variant:i}=Yr(t,{number:"rack",string:"keys"},{convertNumericStrings:!1}),a={...e};i==="rack"?a.rack=t:a.keys=n;const o=await this.execRetrieve(a),l=this.sugar(o);return r&&i!=="rack"?l[0]:l}async retrieveByName(t,e){const r=await this.execRetrieve({names:[t],rack:e});return qr("Task",t,r,!0),this.sugar(r)[0]}async execRetrieve(t){return(await v(this.client,hy,t,ly,uy)).tasks}sugar(t){return t.map(({key:e,name:r,type:n,config:i,state:a,internal:o})=>new cy(e,r,n,i,this.frameClient,o,a))}async openTracker(){return await Ut(this.frameClient,"sy_task_set","sy_task_delete",(t,e)=>Array.from(e).map(r=>({variant:t,key:r.toString(),value:r.toString()})))}async openStateObserver(){return new Pt(await this.frameClient.openStreamer(zt),t=>{const e=t.get(zt);if(e.length===0)return[null,!1];const r=Rr.safeParse(e.at(-1));return r.success?[r.data,!0]:[null,!1]})}};const Yt=s.z.string().uuid(),Zr=s.z.object({key:Yt,name:s.z.string().min(1),color:s.z.string()}),by=s.z.object({keys:Yt.array().optional(),for:ye.optional(),search:s.z.string().optional(),offset:s.z.number().optional(),limit:s.z.number().optional()}),vy=s.z.object({labels:Zr.array().optional().default([])});var Kt;let Oy=(Kt=class{constructor(t){c(this,"client"),this.client=t}async retrieve(t){const e=N(t);return await this.execute({keys:e})}async retrieveFor(t){return await this.execute({for:t})}async search(t){return await this.execute({search:t})}async page(t,e){return await this.execute({offset:t,limit:e})}async execute(t){const[e,r]=await this.client.send(Kt.ENDPOINT,t,by,vy);if(r!=null)throw r;return e.labels}},c(Kt,"ENDPOINT","/label/retrieve"),Kt);const Ty=Zr.extend({key:Yt.optional()}),Sy=s.z.object({labels:Ty.array()}),zy=s.z.object({labels:Zr.array()}),Ny=s.z.object({keys:Yt.array()}),bo=s.z.object({id:ye,labels:Yt.array()}),Ey=bo,pn=s.z.object({}),Iy="/label/create",Ay="/label/delete",ky="/label/set",xy="/label/remove";let Cy=class{constructor(t){c(this,"client"),this.client=t}async create(t){return(await v(this.client,Iy,{labels:N(t)},Sy,zy)).labels}async delete(t){await v(this.client,Ay,{keys:N(t)},Ny,pn)}async set(t,e){await v(this.client,ky,{id:t,labels:e},bo,pn)}async remove(t,e){await v(this.client,xy,{id:t,labels:e},Ey,pn)}};const jy="sy_label_set",Ry="sy_label_delete";let $y=class{constructor(t,e){c(this,"type","label"),c(this,"retriever"),c(this,"writer"),c(this,"frameClient"),this.writer=new Cy(t),this.retriever=new Oy(t),this.frameClient=e}async search(t){return await this.retriever.search(t)}async retrieve(t){const e=Array.isArray(t),r=await this.retriever.retrieve(t);return e?r:r[0]}async retrieveFor(t){return await this.retriever.retrieveFor(t)}async label(t,e){await this.writer.set(t,e)}async removeLabels(t,e){await this.writer.remove(t,e)}async page(t,e){return await this.retriever.page(t,e)}async create(t){const e=Array.isArray(t),r=await this.writer.create(t);return e?r:r[0]}async delete(t){await this.writer.delete(t)}async openChangeTracker(){return await Ut(this.frameClient,jy,Ry,My)}};const My=(t,e)=>t==="delete"?e.toUUIDs().map(r=>({variant:t,key:r})):e.parseJSON(Zr).map(r=>({variant:t,key:r.key,value:r})),ce=s.z.string().uuid(),et=s.z.object({key:ce,name:s.z.string().min(1),timeRange:oe.z,color:s.z.string().optional()}),vo=et.extend({key:s.z.string().uuid().optional()}),Oo=t=>{const e=N(t);if(e.length===0)throw new Error("Range params must not be empty");const r=ce.safeParse(e[0]).success;return{single:!Array.isArray(t),variant:r?"keys":"names",normalized:e,actual:t}},To="range",So="range-alias",Dy=t=>new he({type:To,key:t}),Py=t=>new he({type:So,key:t}),By=s.z.object({}),Uy=s.z.object({range:et}),Ly=s.z.object({range:ce}),Yy=s.z.object({range:ce}),qy=s.z.object({}),Fy="/range/set-active",_y="/range/retrieve-active",Wy="/range/clear-active";class Gy{constructor(e){c(this,"client"),this.client=e}async setActive(e){await v(this.client,Fy,{range:e},Ly,By)}async retrieveActive(){const[e,r]=await this.client.send(_y,{},s.z.object({}),Uy);if(we.matches(r))return null;if(r!=null)throw r;return e.range}async clearActive(e){await v(this.client,Wy,{range:e},Yy,qy)}}const Zy="sy_range_alias_set",Vy="sy_range_alias_delete",Ky=s.z.object({range:ce,aliases:s.z.string().array()}),Jy=s.z.object({aliases:s.z.record(s.z.string(),Be)}),Hy=s.z.object({range:ce,aliases:s.z.record(Be.or(s.z.string()),s.z.string())}),Xy=s.z.unknown(),Qy=s.z.object({range:ce,channels:Be.array()}),eg=s.z.unknown(),tg=s.z.object({range:ce}),rg=s.z.object({aliases:s.z.record(s.z.string(),s.z.string())}),mt=class wt{constructor(e,r,n){c(this,"frameClient"),c(this,"cache",new Map),c(this,"client"),c(this,"rangeKey"),this.rangeKey=e,this.cache=new Map,this.client=n,this.frameClient=r}async resolve(e){const r=[],n=typeof e=="string",i={};if(n){const o=this.cache.get(e);if(o!=null)return o;r.push(e)}else e.forEach(o=>{const l=this.cache.get(o);l!=null?i[o]=l:r.push(o)});if(r.length===0)return i;const a=await v(this.client,wt.RESOLVE_ENDPOINT,{range:this.rangeKey,aliases:r},Ky,Jy);return Object.entries(a.aliases).forEach(([o,l])=>this.cache.set(o,l)),n?a.aliases[r[0]]:{...i,...a.aliases}}async set(e){await v(this.client,wt.SET_ENDPOINT,{range:this.rangeKey,aliases:e},Hy,Xy)}async list(){return(await v(this.client,wt.LIST_ENDPOINT,{range:this.rangeKey},tg,rg)).aliases}async delete(e){await v(this.client,wt.DELETE_ENDPOINT,{range:this.rangeKey,channels:e},Qy,eg)}async openChangeTracker(){return await Ut(this.frameClient,Zy,Vy,ag(this.rangeKey))}};c(mt,"SET_ENDPOINT","/range/alias/set"),c(mt,"RESOLVE_ENDPOINT","/range/alias/resolve"),c(mt,"LIST_ENDPOINT","/range/alias/list"),c(mt,"DELETE_ENDPOINT","/range/alias/delete");let ng=mt;const sg=s.z.object({range:ce,channel:Be,alias:s.z.string()}),ig="---",ag=t=>(e,r)=>e==="delete"?r.toStrings().filter(n=>n.split(ig)[0]===t).map(n=>({variant:e,key:n,value:void 0})):r.parseJSON(sg).map(n=>({variant:e,key:n.alias,value:n})),og=s.z.object({range:ce,keys:s.z.string().array()}),cg=s.z.object({pairs:s.z.record(s.z.string(),s.z.string())}),lg=s.z.object({range:ce,pairs:s.z.record(s.z.string(),s.z.string())}),ug=s.z.object({range:ce,keys:s.z.string().array()}),zr=class Nr{constructor(e,r){c(this,"rangeKey"),c(this,"client"),this.rangeKey=e,this.client=r}async get(e){const[r,n]=await this.client.send(Nr.GET_ENDPOINT,{range:this.rangeKey,keys:N(e)},og,cg);if(n!=null)throw n;return Array.isArray(e)?r.pairs:r.pairs[e]}async list(){return this.get([])}async set(e,r=""){await v(this.client,Nr.SET_ENDPOINT,{range:this.rangeKey,pairs:Jn(e)?e:{[e]:r}},lg,s.z.unknown())}async delete(e){await v(this.client,Nr.DELETE_ENDPOINT,{range:this.rangeKey,keys:N(e)},ug,s.z.unknown())}};c(zr,"GET_ENDPOINT","/range/kv/get"),c(zr,"SET_ENDPOINT","/range/kv/set"),c(zr,"DELETE_ENDPOINT","/range/kv/delete");let hg=zr;const mn=t=>new he({type:"range",key:t});class zo{constructor(e,r=oe.ZERO,n,i,a,o,l,u,d){c(this,"key"),c(this,"name"),c(this,"kv"),c(this,"timeRange"),c(this,"color"),c(this,"channels"),c(this,"aliaser"),c(this,"frameClient"),c(this,"labelClient"),this.key=n,this.name=e,this.timeRange=r,this.frameClient=a,this.color=i,this.kv=o,this.aliaser=l,this.channels=u,this.labelClient=d}async setAlias(e,r){const n=await this.channels.retrieve(e);if(n.length===0)throw new we(`Channel ${e} does not exist`);await this.aliaser.set({[n[0].key]:r})}async deleteAlias(...e){await this.aliaser.delete(e)}async listAliases(){return await this.aliaser.list()}async openAliasTracker(){return await this.aliaser.openChangeTracker()}async read(e){return await this.frameClient.read(this.timeRange,e)}async labels(){return await this.labelClient.retrieveFor(mn(this.key))}async addLabel(...e){await this.labelClient.label(mn(this.key),e)}async removeLabel(...e){await this.labelClient.removeLabels(mn(this.key),e)}}const dg=s.z.object({keys:ce.array().optional(),names:s.z.array(s.z.string()).optional(),term:s.z.string().optional(),overlapsWith:oe.z.optional()}),fg="/range/retrieve",yg=s.z.object({ranges:Qe(et)});let No=class{constructor(t,e,r,n,i){c(this,"type","range"),c(this,"frameClient"),c(this,"writer"),c(this,"unaryClient"),c(this,"channels"),c(this,"active"),c(this,"labelClient"),this.frameClient=t,this.writer=e,this.unaryClient=r,this.channels=n,this.active=new Gy(r),this.labelClient=i}async create(t){const e=!Array.isArray(t),r=this.sugar(await this.writer.create(N(t)));return e?r[0]:r}async rename(t,e){await this.writer.rename(t,e)}async delete(t){await this.writer.delete(N(t))}async search(t){return this.sugar(await this.execRetrieve({term:t}))}async page(){return[]}async retrieve(t){if(typeof t=="object"&&"start"in t)return await this.execRetrieve({overlapsWith:new oe(t)});const{single:e,actual:r,variant:n,normalized:i}=Oo(t),a=await this.execRetrieve({[n]:i});if(!e)return a;if(a.length===0)throw new xr(`range matching ${r} not found`);if(a.length>1)throw new Cr(`multiple ranges matching ${r} found`);return a[0]}async execRetrieve(t){const{ranges:e}=await v(this.unaryClient,fg,t,dg,yg);return this.sugar(e)}async setActive(t){await this.active.setActive(t)}async retrieveActive(){const t=await this.active.retrieveActive();return t==null?null:this.sugar([t])[0]}async clearActive(t){await this.active.clearActive(t)}sugar(t){return t.map(e=>new zo(e.name,e.timeRange,e.key,e.color,this.frameClient,new hg(e.key,this.unaryClient),new ng(e.key,this.frameClient,this.unaryClient),this.channels,this.labelClient))}async openTracker(){return await Ut(this.frameClient,"sy_range_set","sy_range_delete",(t,e)=>t==="delete"?e.toStrings().map(r=>({variant:t,key:r,value:void 0})):this.sugar(e.parseJSON(et)).map(r=>({variant:t,key:r.key,value:r})))}};const gg=s.z.object({ranges:et.array()}),pg=s.z.object({ranges:vo.array()}),mg=s.z.object({keys:ce.array()}),wg=s.z.object({}),bg=s.z.object({key:ce,name:s.z.string()}),vg=s.z.object({}),Og="/range/create",Tg="/range/delete",Sg="/range/rename";let Eo=class{constructor(t){c(this,"client"),this.client=t}async rename(t,e){await v(this.client,Sg,{key:t,name:e},bg,vg)}async create(t){return(await v(this.client,Og,{ranges:t},pg,gg)).ranges}async delete(t){await v(this.client,Tg,{keys:t},mg,wg)}};const zg=Object.freeze(Object.defineProperty({__proto__:null,Client:No,Range:zo,RangeAliasOntologyType:So,RangeOntologyType:To,Writer:Eo,analyzeParams:Oo,keyZ:ce,newPayloadZ:vo,payloadZ:et,rangeAliasOntologyID:Py,rangeOntologyID:Dy},Symbol.toStringTag,{value:"Module"})),Ng="/api/v1/";class Eg{constructor(e,r=!1){c(this,"url"),c(this,"unary"),c(this,"stream"),c(this,"secure"),this.secure=r,this.url=e.child(Ng);const n=new Xe.JSONCodec;this.unary=new Lu(this.url,n,this.secure),this.stream=new Ku(this.url,n,this.secure)}use(...e){this.unary.use(...e),this.stream.use(...e)}}const ds=s.z.string().uuid(),fs=s.z.object({key:s.z.string(),name:s.z.string(),data:Qn.or(s.z.string().transform(t=>JSON.parse(t)))}),Ig=s.z.object({keys:s.z.string().array()}),Ag=s.z.object({linePlots:fs.array()});let kg=class{constructor(t){c(this,"ENDPOINT","/workspace/lineplot/retrieve"),c(this,"client"),this.client=t}async retrieve(t){const e=N(t);return(await v(this.client,this.ENDPOINT,{keys:e},Ig,Ag)).linePlots}};const Ge=s.z.string().uuid(),Io=t=>JSON.parse(t),Ao=s.z.object({name:s.z.string(),key:Ge,layout:Qn.or(s.z.string().transform(t=>Io(t)))}),ko=Ao.omit({layout:!0}).extend({layout:s.z.string().transform(t=>Io(t))}),xg=fs.partial({key:!0}).transform(t=>({...t,data:JSON.stringify(t.data)})),Cg=s.z.object({workspace:Ge,linePlots:xg.array()}),jg=s.z.object({linePlots:fs.array()}),Rg=s.z.object({keys:ds.array()}),$g=s.z.object({}),Mg=s.z.object({key:ds,name:s.z.string()}),Dg=s.z.object({}),Pg=s.z.object({key:ds,data:s.z.string()}),Bg=s.z.object({}),Ug="/workspace/lineplot/create",Lg="/workspace/lineplot/delete",Yg="/workspace/lineplot/rename",qg="/workspace/lineplot/set-data";let Fg=class{constructor(t){c(this,"client"),this.client=t}async create(t,e){const r={...e,data:JSON.stringify(e.data)};return(await v(this.client,Ug,{workspace:t,linePlots:[r]},Cg,jg)).linePlots[0]}async delete(t){const e=N(t);await v(this.client,Lg,{keys:e},Rg,$g)}async rename(t,e){await v(this.client,Yg,{key:t,name:e},Mg,Dg)}async setData(t,e){await v(this.client,qg,{key:t,data:JSON.stringify(e)},Pg,Bg)}},_g=class{constructor(t){c(this,"writer"),c(this,"retriever"),this.writer=new Fg(t),this.retriever=new kg(t)}async create(t,e){return await this.writer.create(t,e)}async rename(t,e){await this.writer.rename(t,e)}async setData(t,e){await this.writer.setData(t,e)}async retrieve(t){const e=Array.isArray(t),r=await this.retriever.retrieve(t);return e?r:r[0]}async delete(t){await this.writer.delete(t)}};const Wg=s.z.object({keys:Ge.array().optional(),search:s.z.string().optional(),author:s.z.string().uuid().optional(),offset:s.z.number().optional(),limit:s.z.number().optional()}),Gg=s.z.object({workspaces:Qe(ko)});var Jt;let Zg=(Jt=class{constructor(t){c(this,"client"),this.client=t}async retrieve(t){const e=N(t);return await this.execute({keys:e})}async retrieveByAuthor(t){return await this.execute({author:t})}async search(t){return await this.execute({search:t})}async page(t,e){return await this.execute({offset:t,limit:e})}async execute(t){return(await v(this.client,Jt.ENDPOINT,t,Wg,Gg)).workspaces}},c(Jt,"ENDPOINT","/workspace/retrieve"),Jt);const Vr=s.z.string().uuid(),Vg=s.z.object({key:s.z.string(),name:s.z.string(),data:Qn.or(s.z.string().transform(t=>JSON.parse(t))),snapshot:s.z.boolean()}),ys=s.z.object({key:s.z.string(),name:s.z.string(),snapshot:s.z.boolean(),data:s.z.string().transform(t=>JSON.parse(t))}),Kg=s.z.object({keys:s.z.string().array()}),Jg=s.z.object({schematics:ys.array()});class Hg{constructor(e){c(this,"ENDPOINT","/workspace/schematic/retrieve"),c(this,"client"),this.client=e}async retrieve(e){return(await v(this.client,this.ENDPOINT,{keys:N(e)},Kg,Jg)).schematics}}const Xg=Vg.partial({key:!0,snapshot:!0}).transform(t=>({...t,data:JSON.stringify(t.data)})),Qg=s.z.object({workspace:Ge,schematics:Xg.array()}),ep=s.z.object({schematics:ys.array()}),tp=s.z.object({keys:Vr.array()}),rp=s.z.object({}),np=s.z.object({key:Vr,name:s.z.string()}),gi=s.z.object({}),sp=s.z.object({key:Vr,data:s.z.string()});s.z.object({});const ip=s.z.object({key:Vr,name:s.z.string(),snapshot:s.z.boolean()}),ap=s.z.object({schematic:ys}),op="/workspace/schematic/create",cp="/workspace/schematic/delete",lp="/workspace/schematic/rename",up="/workspace/schematic/set-data",hp="/workspace/schematic/copy";let dp=class{constructor(t){c(this,"client"),this.client=t}async create(t,e){const r={...e,data:JSON.stringify(e.data)};return(await v(this.client,op,{workspace:t,schematics:[r]},Qg,ep)).schematics[0]}async copy(t,e,r){return(await v(this.client,hp,{key:t,name:e,snapshot:r},ip,ap)).schematic}async delete(t){const e=N(t);await v(this.client,cp,{keys:e},tp,rp)}async rename(t,e){await v(this.client,lp,{key:t,name:e},np,gi)}async setData(t,e){await v(this.client,up,{key:t,data:JSON.stringify(e)},sp,gi)}},fp=class{constructor(t){c(this,"writer"),c(this,"retriever"),this.writer=new dp(t),this.retriever=new Hg(t)}async create(t,e){return await this.writer.create(t,e)}async rename(t,e){await this.writer.rename(t,e)}async setData(t,e){await this.writer.setData(t,e)}async retrieve(t){const e=Array.isArray(t),r=await this.retriever.retrieve(t);return e?r:r[0]}async delete(t){await this.writer.delete(t)}async copy(t,e,r){return await this.writer.copy(t,e,r)}};const yp=Ao.partial({key:!0}).transform(t=>({...t,layout:JSON.stringify(t.layout)})),gp=s.z.object({workspaces:yp.array()}),pp=s.z.object({workspaces:ko.array()}),mp=s.z.object({keys:Ge.array()}),wp=s.z.object({}),bp=s.z.object({key:Ge,name:s.z.string()}),vp=s.z.object({}),Op=s.z.object({key:Ge,layout:s.z.string()}),Tp=s.z.object({}),Sp="/workspace/create",zp="/workspace/delete",Np="/workspace/rename",Ep="/workspace/set-layout";class Ip{constructor(e){c(this,"client"),this.client=e}async create(e){return(await v(this.client,Sp,{workspaces:N(e)},gp,pp)).workspaces}async delete(e){await v(this.client,zp,{keys:N(e)},mp,wp)}async rename(e,r){await v(this.client,Np,{key:e,name:r},bp,vp)}async setLayout(e,r){await v(this.client,Ep,{key:e,layout:JSON.stringify(r)},Op,Tp)}}class Ap{constructor(e){c(this,"type","workspace"),c(this,"schematic"),c(this,"linePlot"),c(this,"retriever"),c(this,"writer"),this.schematic=new fp(e),this.linePlot=new _g(e),this.retriever=new Zg(e),this.writer=new Ip(e)}async search(e){return await this.retriever.search(e)}async retrieveByAuthor(e){return await this.retriever.retrieveByAuthor(e)}async retrieve(e){const r=Array.isArray(e),n=await this.retriever.retrieve(e);return r?n:n[0]}async page(e,r){return await this.retriever.page(e,r)}async create(e){const r=Array.isArray(e),n=await this.writer.create(e);return r?n:n[0]}async rename(e,r){await this.writer.rename(e,r)}async setLayout(e,r){await this.writer.setLayout(e,r)}async delete(...e){await this.writer.delete(e)}}const xo=s.z.object({host:s.z.string({required_error:"Host is required"}).min(1,"Host is required"),port:s.z.number({required_error:"Port is required"}).or(s.z.string({required_error:"Port is required"})),username:s.z.string().optional(),password:s.z.string().optional(),connectivityPollFrequency:I.z.default(I.seconds(30)),secure:s.z.boolean().optional().default(!1),name:s.z.string().optional()});class Co extends po{constructor(e){const r=xo.parse(e),{host:n,port:i,username:a,password:o,connectivityPollFrequency:l,secure:u}=r,d=new Eg(new sd({host:n,port:Number(i)}),u);d.use(dd);let f;a!=null&&o!=null&&(f=new gf(d.unary,{username:a,password:o}),d.use(f.middleware()));const h=new rs(new ts(d.unary)),M=new ro(d.unary,h);super(d.stream,d.unary,h),c(this,"createdAt"),c(this,"props"),c(this,"ranges"),c(this,"channels"),c(this,"auth"),c(this,"user"),c(this,"access"),c(this,"connectivity"),c(this,"ontology"),c(this,"workspaces"),c(this,"labels"),c(this,"hardware"),c(this,"control"),c(this,"transport"),this.createdAt=E.now(),this.props=r,this.auth=f,this.transport=d,this.channels=new to(this,h,d.unary,M),this.connectivity=new oo(d.unary,l,r.name),this.control=new wo(this),this.ontology=new xd(d.unary,this);const _=new Eo(this.transport.unary);this.labels=new $y(this.transport.unary,this),this.ranges=new No(this,_,this.transport.unary,h,this.labels),this.access=new uf(this.transport.unary),this.user=new df(this.transport.unary),this.workspaces=new Ap(this.transport.unary);const re=new Hf(this.transport.unary,this),j=new wy(this.transport.unary,this),Ho=new iy(this.transport.unary,this,j);this.hardware=new Lf(j,Ho,re)}get key(){return this.createdAt.valueOf().toString()}close(){this.connectivity.stopChecking()}}c(Co,"connectivity",oo);const kp=He.Authority,Pn=(t,e,r="")=>{try{return t.parse(e)}catch(n){if(n instanceof s.z.ZodError){const i=n.errors.map(a=>a.path.length===0?a.message:`${a.path.join(".")}: ${a.message}`);throw new Error(`${r} - ${i.join(`
|
|
50
|
-
`)}`)}else throw n}};var xp=Object.defineProperty,Cp=(t,e,r)=>e in t?xp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,J=(t,e,r)=>Cp(t,typeof e!="symbol"?e+"":e,r);const Bn=class jo{constructor(e,r,n="",i=!1){J(this,"_noop",!1),J(this,"key"),J(this,"path"),J(this,"serviceName"),this.key=e,this.path=r,this.serviceName=n,this._noop=i}child(e){return new jo(e,this.extendPath(e),this.serviceName,this.noop)}extendPath(e){return`${this.path}.${e}`}get noop(){return this._noop}};J(Bn,"NOOP",new Bn("","",""));let gs=Bn;const Un=["debug","info","warn","error"],jp=t=>{const e=Un.indexOf(t);return({level:r})=>Un.indexOf(r)>=e},Rp=t=>{const{include:e,exclude:r}=t;return({path:n})=>!(e!=null&&!e.some(i=>n.startsWith(i))||r!=null&&r.some(i=>n.startsWith(i)))},Ln=class Ro{constructor(e={}){J(this,"meta",gs.NOOP),J(this,"filters");const{filters:r=[]}=e;this.filters=r}filter(e){return!this.meta.noop&&this.filters.every(r=>r({key:this.meta.key,path:this.meta.path,level:e}))}child(e){const r=new Ro({filters:this.filters});return r.meta=e,r}debug(e,r,n=!1){!this.filter("debug")&&!n||(r==null?console.log("%cDEBUG","color: #8c00f0;",this.meta.path,e):console.log("%cDEBUG","color: #8c00f0;",this.meta.path,e,Ht(r)))}info(e,r,n=!1){!this.filter("info")&&!n||(r==null?console.log("%cINFO","color: #005eff;",this.meta.path,e):console.log("%cINFO","color: #005eff;",this.meta.path,e,Ht(r)))}warn(e,r,n=!1){!this.filter("warn")&&!n||(r==null?console.warn("WARN",this.meta.path,e):console.warn("WARN",this.meta.path,e,Ht(r)))}error(e,r,n=!1){!this.filter("error")&&!n||(r==null?console.error("ERROR",this.meta.path,e):console.error("ERROR",this.meta.path,e,Ht(r)))}};J(Ln,"NOOP",new Ln);let $o=Ln;const Ht=t=>typeof t=="function"?t():t;var $p=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{},_e="1.8.0",pi=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function Mp(t){var e=new Set([t]),r=new Set,n=t.match(pi);if(!n)return function(){return!1};var i={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(i.prerelease!=null)return function(l){return l===t};function a(l){return r.add(l),!1}function o(l){return e.add(l),!0}return function(l){if(e.has(l))return!0;if(r.has(l))return!1;var u=l.match(pi);if(!u)return a(l);var d={major:+u[1],minor:+u[2],patch:+u[3],prerelease:u[4]};return d.prerelease!=null||i.major!==d.major?a(l):i.major===0?i.minor===d.minor&&i.patch<=d.patch?o(l):a(l):i.minor<=d.minor?o(l):a(l)}}var Dp=Mp(_e),Pp=_e.split(".")[0],kt=Symbol.for("opentelemetry.js.api."+Pp),xt=$p;function ps(t,e,r,n){var i;n===void 0&&(n=!1);var a=xt[kt]=(i=xt[kt])!==null&&i!==void 0?i:{version:_e};if(!n&&a[t]){var o=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+t);return r.error(o.stack||o.message),!1}if(a.version!==_e){var o=new Error("@opentelemetry/api: Registration of version v"+a.version+" for "+t+" does not match previously registered API v"+_e);return r.error(o.stack||o.message),!1}return a[t]=e,r.debug("@opentelemetry/api: Registered a global for "+t+" v"+_e+"."),!0}function Ct(t){var e,r,n=(e=xt[kt])===null||e===void 0?void 0:e.version;if(!(!n||!Dp(n)))return(r=xt[kt])===null||r===void 0?void 0:r[t]}function ms(t,e){e.debug("@opentelemetry/api: Unregistering a global for "+t+" v"+_e+".");var r=xt[kt];r&&delete r[t]}var Bp=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,a=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(l){o={error:l}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return a},Up=function(t,e,r){if(arguments.length===2)for(var n=0,i=e.length,a;n<i;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return t.concat(a||Array.prototype.slice.call(e))},Lp=function(){function t(e){this._namespace=e.namespace||"DiagComponentLogger"}return t.prototype.debug=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return st("debug",this._namespace,e)},t.prototype.error=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return st("error",this._namespace,e)},t.prototype.info=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return st("info",this._namespace,e)},t.prototype.warn=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return st("warn",this._namespace,e)},t.prototype.verbose=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return st("verbose",this._namespace,e)},t}();function st(t,e,r){var n=Ct("diag");if(n)return r.unshift(e),n[t].apply(n,Up([],Bp(r),!1))}var fe;(function(t){t[t.NONE=0]="NONE",t[t.ERROR=30]="ERROR",t[t.WARN=50]="WARN",t[t.INFO=60]="INFO",t[t.DEBUG=70]="DEBUG",t[t.VERBOSE=80]="VERBOSE",t[t.ALL=9999]="ALL"})(fe||(fe={}));function Yp(t,e){t<fe.NONE?t=fe.NONE:t>fe.ALL&&(t=fe.ALL),e=e||{};function r(n,i){var a=e[n];return typeof a=="function"&&t>=i?a.bind(e):function(){}}return{error:r("error",fe.ERROR),warn:r("warn",fe.WARN),info:r("info",fe.INFO),debug:r("debug",fe.DEBUG),verbose:r("verbose",fe.VERBOSE)}}var qp=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,a=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(l){o={error:l}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return a},Fp=function(t,e,r){if(arguments.length===2)for(var n=0,i=e.length,a;n<i;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return t.concat(a||Array.prototype.slice.call(e))},_p="diag",jt=function(){function t(){function e(i){return function(){for(var a=[],o=0;o<arguments.length;o++)a[o]=arguments[o];var l=Ct("diag");if(l)return l[i].apply(l,Fp([],qp(a),!1))}}var r=this,n=function(i,a){var o,l,u;if(a===void 0&&(a={logLevel:fe.INFO}),i===r){var d=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return r.error((o=d.stack)!==null&&o!==void 0?o:d.message),!1}typeof a=="number"&&(a={logLevel:a});var f=Ct("diag"),h=Yp((l=a.logLevel)!==null&&l!==void 0?l:fe.INFO,i);if(f&&!a.suppressOverrideMessage){var M=(u=new Error().stack)!==null&&u!==void 0?u:"<failed to generate stacktrace>";f.warn("Current logger will be overwritten from "+M),h.warn("Current logger will overwrite one already registered from "+M)}return ps("diag",h,r,!0)};r.setLogger=n,r.disable=function(){ms(_p,r)},r.createComponentLogger=function(i){return new Lp(i)},r.verbose=e("verbose"),r.debug=e("debug"),r.info=e("info"),r.warn=e("warn"),r.error=e("error")}return t.instance=function(){return this._instance||(this._instance=new t),this._instance},t}(),Wp=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,a=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(l){o={error:l}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return a},Gp=function(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Zp=function(){function t(e){this._entries=e?new Map(e):new Map}return t.prototype.getEntry=function(e){var r=this._entries.get(e);if(r)return Object.assign({},r)},t.prototype.getAllEntries=function(){return Array.from(this._entries.entries()).map(function(e){var r=Wp(e,2),n=r[0],i=r[1];return[n,i]})},t.prototype.setEntry=function(e,r){var n=new t(this._entries);return n._entries.set(e,r),n},t.prototype.removeEntry=function(e){var r=new t(this._entries);return r._entries.delete(e),r},t.prototype.removeEntries=function(){for(var e,r,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var a=new t(this._entries);try{for(var o=Gp(n),l=o.next();!l.done;l=o.next()){var u=l.value;a._entries.delete(u)}}catch(d){e={error:d}}finally{try{l&&!l.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}return a},t.prototype.clear=function(){return new t},t}();jt.instance();function Vp(t){return t===void 0&&(t={}),new Zp(new Map(Object.entries(t)))}function Kp(t){return Symbol.for(t)}var Jp=function(){function t(e){var r=this;r._currentContext=e?new Map(e):new Map,r.getValue=function(n){return r._currentContext.get(n)},r.setValue=function(n,i){var a=new t(r._currentContext);return a._currentContext.set(n,i),a},r.deleteValue=function(n){var i=new t(r._currentContext);return i._currentContext.delete(n),i}}return t}(),Hp=new Jp,Xp={get:function(t,e){if(t!=null)return t[e]},keys:function(t){return t==null?[]:Object.keys(t)}},Qp={set:function(t,e,r){t!=null&&(t[e]=r)}},em=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,a=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(l){o={error:l}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return a},tm=function(t,e,r){if(arguments.length===2)for(var n=0,i=e.length,a;n<i;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return t.concat(a||Array.prototype.slice.call(e))},rm=function(){function t(){}return t.prototype.active=function(){return Hp},t.prototype.with=function(e,r,n){for(var i=[],a=3;a<arguments.length;a++)i[a-3]=arguments[a];return r.call.apply(r,tm([n],em(i),!1))},t.prototype.bind=function(e,r){return r},t.prototype.enable=function(){return this},t.prototype.disable=function(){return this},t}(),nm=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,a=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(l){o={error:l}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return a},sm=function(t,e,r){if(arguments.length===2)for(var n=0,i=e.length,a;n<i;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return t.concat(a||Array.prototype.slice.call(e))},wn="context",im=new rm,Mo=function(){function t(){}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalContextManager=function(e){return ps(wn,e,jt.instance())},t.prototype.active=function(){return this._getContextManager().active()},t.prototype.with=function(e,r,n){for(var i,a=[],o=3;o<arguments.length;o++)a[o-3]=arguments[o];return(i=this._getContextManager()).with.apply(i,sm([e,r,n],nm(a),!1))},t.prototype.bind=function(e,r){return this._getContextManager().bind(e,r)},t.prototype._getContextManager=function(){return Ct(wn)||im},t.prototype.disable=function(){this._getContextManager().disable(),ms(wn,jt.instance())},t}(),Yn;(function(t){t[t.UNSET=0]="UNSET",t[t.OK=1]="OK",t[t.ERROR=2]="ERROR"})(Yn||(Yn={}));var am=Mo.getInstance(),om=function(){function t(){}return t.prototype.inject=function(e,r){},t.prototype.extract=function(e,r){return e},t.prototype.fields=function(){return[]},t}(),ws=Kp("OpenTelemetry Baggage Key");function Do(t){return t.getValue(ws)||void 0}function cm(){return Do(Mo.getInstance().active())}function lm(t,e){return t.setValue(ws,e)}function um(t){return t.deleteValue(ws)}var bn="propagation",hm=new om,dm=function(){function t(){this.createBaggage=Vp,this.getBaggage=Do,this.getActiveBaggage=cm,this.setBaggage=lm,this.deleteBaggage=um}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalPropagator=function(e){return ps(bn,e,jt.instance())},t.prototype.inject=function(e,r,n){return n===void 0&&(n=Qp),this._getGlobalPropagator().inject(e,r,n)},t.prototype.extract=function(e,r,n){return n===void 0&&(n=Xp),this._getGlobalPropagator().extract(e,r,n)},t.prototype.fields=function(){return this._getGlobalPropagator().fields()},t.prototype.disable=function(){ms(bn,jt.instance())},t.prototype._getGlobalPropagator=function(){return Ct(bn)||hm},t}(),fm=dm.getInstance();const mi=["bench","debug","prod"],ym=t=>e=>mi.indexOf(e)>=mi.indexOf(t),qn=class Po{constructor(e,r=ym("debug")){J(this,"meta",gs.NOOP),J(this,"tracer"),J(this,"filter"),this.tracer=e,this.filter=r}child(e){const r=new Po(this.tracer,this.filter);return r.meta=e,r}debug(e,r){return this.trace(e,"debug",r)}bench(e,r){return this.trace(e,"bench",r)}prod(e,r){return this.trace(e,"prod",r)}trace(e,r,n){return this.meta.noop||!this.filter(r)?n(new Lo(e)):this.tracer.startActiveSpan(e,i=>{const a=new Uo(e,i),o=n(a);return i.end(),o})}propagate(e){if(this.meta.noop)return;const r=am.active();fm.inject(r,e,{set:(n,i,a)=>{n[i]=a}})}};J(qn,"NOOP",new qn);let Bo=qn;class Uo{constructor(e,r){J(this,"key"),J(this,"otel"),this.key=e,this.otel=r}set(e,r){this.otel.setAttribute(e,r)}recordError(e){e!=null&&(this.otel.recordException(e),this.otel.setStatus({code:Yn.ERROR}))}}class Lo{constructor(e){J(this,"key"),this.key=e}set(){}recordError(e){}}const Fn=class Yo{constructor({key:e="",serviceName:r="",logger:n=$o.NOOP,tracer:i=Bo.NOOP,noop:a=!1,__meta:o}){J(this,"meta"),J(this,"T"),J(this,"L"),this.meta=o??new gs(e,e,r,a),this.T=i.child(this.meta),this.L=n.child(this.meta)}child(e){const r=this.meta.child(e);return new Yo({__meta:r,tracer:this.T,logger:this.L})}};J(Fn,"NOOP",new Fn({noop:!0}));let bs=Fn;const gm=bs.NOOP,qo=Object.freeze(Object.defineProperty({__proto__:null,Instrumentation:bs,LOG_LEVELS:Un,Logger:$o,NOOP:gm,NoopSpan:Lo,Tracer:Bo,_Span:Uo,logLevelKeyFiler:Rp,logThresholdFilter:jp},Symbol.toStringTag,{value:"Module"})),pm=new Error("request for lock canceled");var mm=function(t,e,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function l(f){try{d(n.next(f))}catch(h){o(h)}}function u(f){try{d(n.throw(f))}catch(h){o(h)}}function d(f){f.done?a(f.value):i(f.value).then(l,u)}d((n=n.apply(t,e||[])).next())})};class wm{constructor(e,r=pm){this._value=e,this._cancelError=r,this._queue=[],this._weightedWaiters=[]}acquire(e=1,r=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return new Promise((n,i)=>{const a={resolve:n,reject:i,weight:e,priority:r},o=Fo(this._queue,l=>r<=l.priority);o===-1&&e<=this._value?this._dispatchItem(a):this._queue.splice(o+1,0,a)})}runExclusive(e){return mm(this,arguments,void 0,function*(r,n=1,i=0){const[a,o]=yield this.acquire(n,i);try{return yield r(a)}finally{o()}})}waitForUnlock(e=1,r=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return this._couldLockImmediately(e,r)?Promise.resolve():new Promise(n=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),bm(this._weightedWaiters[e-1],{resolve:n,priority:r})})}isLocked(){return this._value<=0}getValue(){return this._value}setValue(e){this._value=e,this._dispatchQueue()}release(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);this._value+=e,this._dispatchQueue()}cancel(){this._queue.forEach(e=>e.reject(this._cancelError)),this._queue=[]}_dispatchQueue(){for(this._drainUnlockWaiters();this._queue.length>0&&this._queue[0].weight<=this._value;)this._dispatchItem(this._queue.shift()),this._drainUnlockWaiters()}_dispatchItem(e){const r=this._value;this._value-=e.weight,e.resolve([r,this._newReleaser(e.weight)])}_newReleaser(e){let r=!1;return()=>{r||(r=!0,this.release(e))}}_drainUnlockWaiters(){if(this._queue.length===0)for(let e=this._value;e>0;e--){const r=this._weightedWaiters[e-1];r&&(r.forEach(n=>n.resolve()),this._weightedWaiters[e-1]=[])}else{const e=this._queue[0].priority;for(let r=this._value;r>0;r--){const n=this._weightedWaiters[r-1];if(!n)continue;const i=n.findIndex(a=>a.priority<=e);(i===-1?n:n.splice(0,i)).forEach(a=>a.resolve())}}}_couldLockImmediately(e,r){return(this._queue.length===0||this._queue[0].priority<r)&&e<=this._value}}function bm(t,e){const r=Fo(t,n=>e.priority<=n.priority);t.splice(r+1,0,e)}function Fo(t,e){for(let r=t.length-1;r>=0;r--)if(e(t[r]))return r;return-1}var vm=function(t,e,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function l(f){try{d(n.next(f))}catch(h){o(h)}}function u(f){try{d(n.throw(f))}catch(h){o(h)}}function d(f){f.done?a(f.value):i(f.value).then(l,u)}d((n=n.apply(t,e||[])).next())})};class _o{constructor(e){this._semaphore=new wm(1,e)}acquire(){return vm(this,arguments,void 0,function*(e=0){const[,r]=yield this._semaphore.acquire(1,e);return r})}runExclusive(e,r=0){return this._semaphore.runExclusive(()=>e(),1,r)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(e=0){return this._semaphore.waitForUnlock(1,e)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}}class Kr{constructor(e,r,n=new Map){D(this,"providers");D(this,"registry");D(this,"sender");D(this,"changedKeys");this.providers=n,this.registry=r,this.changedKeys=[],this.sender=e}propagateState(e,r,n=[]){this.sender.send({key:e,state:r},n)}copyAndMerge(e){const r=new Kr(this.sender,this.registry,new Map);return e==null||e.providers.forEach((n,i)=>r.providers.set(i,n)),this.providers.forEach((n,i)=>r.providers.set(i,n)),r.changedKeys=[],r}get changed(){return this.changedKeys.length>0}set(e,r,n=!0){this.providers.set(e,r),n&&this.changedKeys.push(e)}setIfNotHas(e,r){this.providers.has(e)||this.set(e,r)}async create(e){const r=this.registry[e.type];if(r==null)throw new Error(`[AetherRoot.create] - could not find component ${e.type}`);const n=new r(e);return await n.internalUpdate(e),n}getOptional(e){return this.providers.get(e)??null}has(e){return this.providers.has(e)}get(e){const r=this.getOptional(e);if(r==null)throw new Error(`[AetherRoot.get] - could not find provider ${e}`);return r}}class vs{constructor(e){D(this,"type");D(this,"key");D(this,"_ctx");D(this,"_internalState");D(this,"_state");D(this,"_prevState");D(this,"_deleted",!1);D(this,"instrumentation");D(this,"schema");this.type=e.type,this.key=e.path[0],this._ctx=e.ctx,this._internalState={},this.instrumentation=e.instrumentation.child(`${this.type}(${this.key})`)}get _schema(){if(this.schema==null)throw new G(`[AetherLeaf] - expected subclass to define component schema, but none was found.
|
|
51
|
-
Make sure to defne a property 'schema' on the class.`);return this.schema}setState(e){const r=Zn(e,this._state);this._prevState={...this._state},this._state=Pn(this._schema,r,`${this.type}:${this.key}`),this.ctx.propagateState(this.key,r)}get ctx(){if(this._ctx==null)throw new me("context not defined");return this._ctx}get state(){if(this._state==null)throw new me("state not defined");return this._state}get internal(){return this._internalState}get prevState(){return this._prevState}get deleted(){return this._deleted}async internalUpdate({variant:e,path:r,ctx:n,state:i}){if(!this.deleted){if(this._ctx=n,e==="state"){this.validatePath(r);const a=Pn(this._schema,i,`${this.type}:${this.key}`);this._state!=null?this.instrumentation.L.debug("updating state",()=>({diff:Ti.difference(this.state,a)})):this.instrumentation.L.debug("setting initial state",{state:i}),this._prevState=this._state??a,this._state=a}else this.instrumentation.L.debug("updating context");await this.afterUpdate()}}async internalDelete(e){this.validatePath(e),this._deleted=!0,await this.afterDelete()}beforeUpdate(){}async afterUpdate(){}async afterDelete(){}validatePath(e){if(e.length===0)throw new me(`[Leaf.setState] - ${this.type}:${this.key} received an empty path`);const r=e[e.length-1];if(e.length>1)throw new me(`[Leaf.setState] - ${this.type}:${this.key} received a subPath ${e.join(".")} but is a leaf`);if(r!==this.key)throw new me(`[Leaf.setState] - ${this.type}:${this.key} received a key ${r} but expected ${this.key}`)}}class qt extends vs{constructor(r){super(r);D(this,"_children");this._children=new Map}get children(){return Array.from(this._children.values())}async internalUpdate(r){const{variant:n,path:i}=r;if(n==="context")return this._ctx=r.ctx.copyAndMerge(this._ctx),await this.updateContext({...r,ctx:this.ctx});const[a,o]=this.getRequiredKey(i),l={...r,ctx:this.ctx};return o.length===0?await this.updateThis(a,l):await this.updateChild(o,l)}async updateContext(r){await super.internalUpdate(r);for(const n of this.children)await n.internalUpdate({...r,ctx:this.ctx,variant:"context"})}async updateChild(r,n){const i=r[0],a=this.getChild(i);if(a!=null)return await a.internalUpdate({...n,path:r});if(r.length>1)throw new Error(`[Composite.setState] - ${this.type}:${this.key} could not find child with key ${i} while updating `);this._children.set(i,await n.ctx.create({...n,path:r}))}async updateThis(r,n){const i=n.ctx.copyAndMerge(this._ctx);if(r!==this.key)throw new me(`[Composite.update] - ${this.type}:${this.key} received a key ${r} but expected ${this.key}`);if(await super.internalUpdate({...n,ctx:i}),!!i.changed){this.instrumentation.L.debug("context changed",{changedKeys:i.changedKeys});for(const a of this.children)await a.internalUpdate({...n,ctx:this.ctx,variant:"context"})}}async internalDelete(r){const[n,i]=this.getRequiredKey(r);if(i.length===0){if(n!==this.key)throw new Error(`[Composite.delete] - ${this.type}:${this.key} received a key ${n} but expected ${this.key}`);const o=this.children;this._children=new Map;for(const l of o)await l.internalDelete([l.key]);await super.internalDelete([this.key])}const a=this.getChild(i[0]);a!=null&&(i.length>1?await a.internalDelete(i):(this._children.delete(a.key),await a.internalDelete(i)))}getRequiredKey(r,n){const[i,...a]=r;if(i==null)throw new Error(`Composite ${this.type}:${this.key} received an empty path`+(n!=null?` for ${n}`:""));return[i,a]}getChild(r){return this._children.get(r)??null}childrenOfType(...r){return this.children.filter(n=>r.includes(n.type))}}const
|
|
49
|
+
Please report this error to the Synnax team. ${JSON.stringify(e)}`),r!=null){if(De.matches(r))return;throw r}}}closeSend(){this.stream.closeSend()}send(e){const r=this.stream.send(e);if(r!=null)throw r}}const Mn=new I(-1);var os=(t=>(t[t.Open=0]="Open",t[t.Next=1]="Next",t[t.Prev=2]="Prev",t[t.SeekFirst=3]="SeekFirst",t[t.SeekLast=4]="SeekLast",t[t.SeekLE=5]="SeekLE",t[t.SeekGE=6]="SeekGE",t[t.Valid=7]="Valid",t[t.Error=8]="Error",t))(os||{}),ho=(t=>(t[t.None=0]="None",t[t.Ack=1]="Ack",t[t.Data=2]="Data",t))(ho||{});const zf=s.z.object({command:s.z.nativeEnum(os),span:I.z.optional(),bounds:oe.z.optional(),stamp:E.z.optional(),keys:s.z.number().array().optional(),chunkSize:s.z.number().optional()}),Nf=s.z.object({variant:s.z.nativeEnum(ho),ack:s.z.boolean(),command:s.z.nativeEnum(os),error:Mt.optional().nullable(),frame:Fr.optional()}),fo=class Dn{constructor(e,r){c(this,"stream"),c(this,"adapter"),c(this,"value"),this.stream=new as("Iterator",e),this.value=new pe,this.adapter=r}static async _open(e,r,n,i,a={}){const o=await _r.open(n,r),l=await i.stream(Dn.ENDPOINT,zf,Nf),u=new Dn(l,o);return await u.execute({command:0,keys:o.keys,bounds:new oe(e),chunkSize:a.chunkSize??1e5}),u}async next(e=Mn){return await this.execute({command:1,span:new I(e)})}async prev(e=Mn){return await this.execute({command:2,span:new I(e)})}async seekFirst(){return await this.execute({command:3})}async seekLast(){return await this.execute({command:4})}async seekLE(e){return await this.execute({command:5,stamp:new E(e)})}async seekGE(e){return await this.execute({command:6,stamp:new E(e)})}async valid(){return await this.execute({command:7})}async close(){await this.stream.closeAndAck()}[Symbol.asyncIterator](){return new Ef(this)}async execute(e){for(this.stream.send(e),this.value=new pe;;){const r=await this.stream.receive();if(r.variant===1)return r.ack;this.value.push(this.adapter.adapt(new pe(r.frame)))}}};c(fo,"ENDPOINT","/frame/iterate");let yo=fo;class Ef{constructor(e){c(this,"iter"),c(this,"open",!1),this.iter=e}async next(){try{let e=!0;return this.open||(await this.iter.seekFirst()||(e=!1),this.open=!0),await this.iter.next()||(e=!1),e||await this.iter.close(),{done:!e,value:this.iter.value}}catch(e){throw await this.iter.close(),e}}}const If=s.z.object({start:E.z.optional(),keys:s.z.number().array()}),Af=s.z.object({frame:Fr,error:Mt.optional().nullable()}),kf="/frame/stream";class Wr{constructor(e,r){c(this,"stream"),c(this,"adapter"),this.stream=new as("Streamer",e),this.adapter=r}get keys(){return this.adapter.keys}static async _open(e,r,{channels:n,from:i}){const a=await _r.open(e,n),o=await r.stream(kf,If,Af),l=new Wr(o,a);return o.send({start:new E(i),keys:a.keys}),l}async next(){try{return{done:!1,value:await this.read()}}catch(e){if(De.matches(e))return{done:!0,value:void 0};throw e}}async read(){return this.adapter.adapt(new pe((await this.stream.receive()).frame))}async update(e){await this.adapter.update(e),this.stream.send({keys:this.adapter.keys})}close(){this.stream.closeSend()}[Symbol.asyncIterator](){return this}}class Pt extends Cn.Observer{constructor(e,r){super(r),c(this,"streamer"),c(this,"closePromise"),this.streamer=e,this.closePromise=this.stream()}async close(){this.streamer.close(),await this.closePromise}async stream(){for await(const e of this.streamer)this.notify(e)}}var cs=(t=>(t[t.Open=0]="Open",t[t.Write=1]="Write",t[t.Commit=2]="Commit",t[t.Error=3]="Error",t[t.SetAuthority=4]="SetAuthority",t))(cs||{}),At=(t=>(t[t.PersistStream=1]="PersistStream",t[t.Persist=2]="Persist",t[t.Stream=3]="Stream",t))(At||{});const xf=t=>{switch(t){case"persist":return 2;case"stream":return 3;case"persistStream":return 1;default:return t}},Cf=new I(-1),jf=s.z.object({start:E.z.optional(),controlSubject:He.subjectZ.optional(),keys:s.z.number().array().optional(),authorities:He.Authority.z.array().optional(),mode:s.z.nativeEnum(At).optional(),errOnUnauthorized:s.z.boolean().optional(),enableAutoCommit:s.z.boolean().optional(),autoIndexPersistInterval:I.z.optional()}),Rf=s.z.object({command:s.z.nativeEnum(cs),config:jf.optional(),frame:Fr.optional()}),$f=s.z.object({ack:s.z.boolean(),command:s.z.nativeEnum(cs),error:Mt.optional().nullable()});var nt;let go=(nt=class{constructor(t,e){c(this,"stream"),c(this,"adapter"),this.stream=new as("Writer",t),this.adapter=e}static async _open(t,e,{channels:r,start:n=E.now(),authorities:i=He.Authority.Absolute,controlSubject:a,mode:o=1,errOnUnauthorized:l=!1,enableAutoCommit:u=!1,autoIndexPersistInterval:d=I.SECOND}){const f=await is.open(t,r),h=await e.stream(nt.ENDPOINT,Rf,$f),M=new nt(h,f);return await M.execute({command:0,config:{start:new E(n),keys:f.keys,controlSubject:a,authorities:N(i),mode:xf(o),errOnUnauthorized:l,enableAutoCommit:u,autoIndexPersistInterval:d}}),M}async write(t,e){const r=await this.adapter.adapt(t,e);return this.stream.send({command:1,frame:r.toPayload()}),!0}async setAuthority(t,e){let r={keys:[],authorities:[]};if(typeof t=="number"&&e==null)r={keys:[],authorities:[t]};else{let n;typeof t=="string"||typeof t=="number"?n={[t]:e}:n=t,n=await this.adapter.adaptObjectKeys(n),r={keys:Object.keys(n).map(i=>Number(i)),authorities:Object.values(n)}}return(await this.execute({command:4,config:r})).ack}async commit(){return this.errorAccumulated?!1:(await this.execute({command:2})).ack}async error(){this.stream.send({command:3});const t=await this.execute({command:3});return t.error!=null?Kn(t.error):null}async close(){await this.stream.closeAndAck()}async execute(t){for(this.stream.send(t);;){const e=await this.stream.receive();if(e.command===t.command)return e;console.warn("writer received unexpected response",e)}}get errorAccumulated(){return this.stream.received()}},c(nt,"ENDPOINT","/frame/write"),nt),po=class{constructor(t,e,r){c(this,"streamClient"),c(this,"retriever"),c(this,"deleter"),this.streamClient=t,this.retriever=r,this.deleter=new Sf(e)}async openIterator(t,e,r){return await yo._open(t,e,this.retriever,this.streamClient,r)}async openWriter(t){return(Array.isArray(t)||typeof t!="object")&&(t={channels:t}),await go._open(this.retriever,this.streamClient,t)}async openStreamer(t){return(Array.isArray(t)||typeof t!="object")&&(t={channels:t}),await Wr._open(this.retriever,this.streamClient,t)}async write(t,e,r){if(r==null){const i=e,a=await this.openWriter({start:t,channels:Object.keys(i),mode:At.Persist});try{await a.write(i),await a.commit()}finally{await a.close()}return}const n=await this.openWriter({start:t,channels:e,mode:At.Persist,errOnUnauthorized:!0,enableAutoCommit:!0,autoIndexPersistInterval:I.MAX});try{await n.write(e,r)}finally{await n.close()}}async read(t,e){const{single:r}=Re(e),n=await this.readFrame(t,e);return r?n.get(e):n}async readFrame(t,e){const r=await this.openIterator(t,e),n=new pe;try{for await(const i of r)n.push(i)}finally{await r.close()}return n}async delete(t,e){const{normalized:r,variant:n}=Re(t);return n==="keys"?await this.deleter.delete({keys:r,bounds:e}):await this.deleter.delete({names:r,bounds:e})}};const Mf=Object.freeze(Object.defineProperty({__proto__:null,ALWAYS_INDEX_PERSIST_ON_AUTO_COMMIT:Cf,AUTO_SPAN:Mn,Client:po,Frame:pe,Iterator:yo,ObservableStreamer:Pt,Streamer:Wr,Writer:go,WriterMode:At,frameZ:Fr,series:co,seriesFromPayload:lo,seriesToPayload:uo},Symbol.toStringTag,{value:"Module"})),Df=He.Authority,Pf=He.stateZ(s.z.number()),Bf=t=>{var e,r;return t.to==null?`${(e=t.from)==null?void 0:e.resource} - ${(r=t.from)==null?void 0:r.subject.name} -> released`:t.from==null?`${t.to.resource} - released -> ${t.to.subject.name} (${t.to.authority.toString()})`:`${t.to.resource} - ${t.from.subject.name} -> ${t.to.subject.name} (${t.to.authority.toString()})`};class mo extends Pt{constructor(e){super(e,r=>{const n=this.codec.decode(r.series[0].buffer);return this.merge(n),[n.transfers,!0]}),c(this,"states"),c(this,"codec"),this.states=new Map,this.codec=new Xe.JSONCodec}subjects(){const e=new Map;return this.states.forEach(r=>e.set(r.subject.key,r.subject)),Array.from(e.values())}merge(e){e.transfers.forEach(r=>{r.from==null&&r.to==null&&console.warn("Invalid transfer: ",r),r.to==null?this.states.delete(r.from.resource):this.states.set(r.to.resource,r.to)})}}const Uf="sy_node_1_control";let wo=class{constructor(t){c(this,"framer"),this.framer=t}async openStateTracker(){const t=await this.framer.openStreamer(Uf);return new mo(t)}};const Lf=Object.freeze(Object.defineProperty({__proto__:null,Authority:Df,Client:wo,StateTracker:mo,stateZ:Pf,transferString:Bf},Symbol.toStringTag,{value:"Module"}));let Yf=class{constructor(t,e,r){c(this,"tasks"),c(this,"racks"),c(this,"devices"),this.tasks=t,this.racks=e,this.devices=r}};const Bt=s.z.number(),ls=s.z.object({key:Bt,name:s.z.string()}),qf=ls.partial({key:!0}),us=s.z.string(),Gr=s.z.object({key:us,rack:Bt,name:s.z.string(),make:s.z.string(),model:s.z.string(),location:s.z.string(),configured:s.z.boolean().optional(),properties:s.z.record(s.z.unknown()).or(s.z.string().transform(t=>t===""?{}:Xe.JSON_CODEC.decodeString(t)))}),Ff=Gr.extend({properties:s.z.unknown().transform(t=>Xe.JSON_CODEC.encodeString(t))}),Ut=async(t,e,r,n)=>{const i=await t.openStreamer([e,r]),a=o=>{const l=[];return r!=null&&l.push(...o.get(r).series.flatMap(u=>n("delete",u))),e!=null&&l.push(...o.get(e).series.flatMap(u=>n("set",u))),[l,l.length>0]};return new Pt(i,a)},_f="sy_device_set",Wf="sy_device_delete",un="/hardware/device/retrieve",Gf="/hardware/device/create",Zf="/hardware/device/delete",Vf=s.z.object({devices:Ff.array()}),Kf=s.z.object({devices:Gr.array()}),Jf=s.z.object({keys:us.array()}),Hf=s.z.object({}),hn=s.z.object({search:s.z.string().optional(),limit:s.z.number().optional(),offset:s.z.number().optional(),keys:us.array().optional(),names:s.z.string().array().optional(),makes:s.z.string().array().optional()}),dn=s.z.object({devices:Qe(Gr)});let Xf=class{constructor(t,e){c(this,"type","device"),c(this,"client"),c(this,"frameClient"),this.client=t,this.frameClient=e}async retrieve(t,e){const r=!Array.isArray(t),n=await v(this.client,un,{keys:N(t),...e},hn,dn);return qr("Device",t,n.devices,r),r?n.devices[0]:n.devices}async search(t,e){return(await v(this.client,un,{search:t,...e},hn,dn)).devices}async page(t,e,r){return(await v(this.client,un,{offset:t,limit:e,...r},hn,dn)).devices}async create(t){const e=!Array.isArray(t),r=await v(this.client,Gf,{devices:N(t)},Vf,Kf);return e?r.devices[0]:r.devices}async delete(t){await v(this.client,Zf,{keys:N(t)},Jf,Hf)}async openDeviceTracker(){return await Ut(this.frameClient,_f,Wf,Qf)}newSearcherWithOptions(t){return{type:this.type,search:async e=>await this.search(e,t),retrieve:async e=>await this.retrieve(e,t),page:async(e,r)=>await this.page(e,r,t)}}};const Qf=(t,e)=>t==="delete"?e.toStrings().map(r=>({variant:t,key:r,value:void 0})):e.parseJSON(Gr).map(r=>({variant:t,key:r.key,value:r})),fn="/hardware/rack/retrieve",ey="/hardware/rack/create",ty="/hardware/rack/delete",yn=s.z.object({keys:Bt.array().optional(),names:s.z.string().array().optional(),search:s.z.string().optional(),offset:s.z.number().optional(),limit:s.z.number().optional()}),gn=s.z.object({racks:Qe(ls)}),ry=s.z.object({racks:qf.array()}),ny=s.z.object({racks:ls.array()}),sy=s.z.object({keys:Bt.array()}),iy=s.z.object({});let ay=class{constructor(t,e,r){c(this,"type","rack"),c(this,"client"),c(this,"frameClient"),c(this,"tasks"),this.client=t,this.frameClient=e,this.tasks=r}async delete(t){await v(this.client,ty,{keys:N(t)},sy,iy)}async create(t){const e=!Array.isArray(t),r=await v(this.client,ey,{racks:N(t)},ry,ny),n=this.sugar(r.racks);return e?n[0]:n}async search(t){const e=await v(this.client,fn,{search:t},yn,gn);return this.sugar(e.racks)}async page(t,e){const r=await v(this.client,fn,{offset:t,limit:e},yn,gn);return this.sugar(r.racks)}async retrieve(t){const{variant:e,normalized:r,single:n}=Yr(t,{string:"names",number:"keys"}),i=await v(this.client,fn,{[e]:r},yn,gn),a=this.sugar(i.racks);return qr("Rack",t,a,n),n?a[0]:a}sugar(t){return t.map(({key:e,name:r})=>new oy(e,r,this.tasks))}};class oy{constructor(e,r,n){c(this,"key"),c(this,"name"),c(this,"tasks"),this.key=e,this.name=r,this.tasks=n}async listTasks(){return await this.tasks.retrieve(this.key)}async retrieveTaskByName(e){return await this.tasks.retrieveByName(e,this.key)}async createTask(e){return e.key=((BigInt(this.key)<<32n)+(BigInt(e.key??0)&0xffffffffn)).toString(),await this.tasks.create(e)}async deleteTask(e){await this.tasks.delete([e])}}const Lt=s.z.union([s.z.string(),s.z.bigint().transform(t=>t.toString()),s.z.number().transform(t=>t.toString())]),Rr=s.z.object({task:Lt,variant:s.z.string(),key:s.z.string().optional(),details:s.z.record(s.z.unknown()).or(s.z.string().transform(t=>t===""?{}:JSON.parse(t))).or(s.z.array(s.z.unknown())).or(s.z.null())}),hs=s.z.object({key:Lt,name:s.z.string(),type:s.z.string(),internal:s.z.boolean().optional(),config:s.z.record(s.z.unknown()).or(s.z.string().transform(t=>t===""?{}:Xe.JSON_CODEC.decodeString(t))),state:Rr.optional().nullable()}),cy=hs.omit({key:!0}).extend({key:Lt.transform(t=>t.toString()).optional(),config:s.z.unknown().transform(t=>Xe.JSON_CODEC.encodeString(t))});s.z.object({task:Lt,type:s.z.string(),key:s.z.string(),args:s.z.record(s.z.unknown()).or(s.z.string().transform(t=>t===""?{}:JSON.parse(t)))});const zt="sy_task_state",yi="sy_task_cmd";class ly{constructor(e,r,n,i,a,o=!1,l){c(this,"key"),c(this,"name"),c(this,"internal"),c(this,"type"),c(this,"config"),c(this,"state"),c(this,"frameClient"),this.key=e,this.name=r,this.type=n,this.config=i,this.internal=o,l!==null&&(this.state=l),this.frameClient=a}get payload(){return{key:this.key,name:this.name,type:this.type,config:this.config,state:this.state,internal:this.internal}}async executeCommand(e,r){const n=await this.frameClient.openWriter(yi),i=Uh.id();return await n.write(yi,[{task:this.key,type:e,key:i,args:r}]),await n.close(),i}async executeCommandSync(e,r,n){const i=await this.frameClient.openStreamer(zt),a=await this.executeCommand(e,r);let o;const l=new Promise(u=>setTimeout(()=>u(!1),new I(n).milliseconds));for(;;){const u=await Promise.any([i.read(),l]);if(u===!1)throw new Error("Command timed out");const d=Rr.safeParse(u.at(-1).sy_task_state);if(d.success){if(o=d.data,o.key===a)break}else console.error(d.error)}return i.close(),o}async openStateObserver(){return new Pt(await this.frameClient.openStreamer(zt),e=>{const r=e.get(zt);if(r.length===0)return[null,!1];const n=Rr.safeParse(r.at(-1));if(!n.success)return[null,!1];const i=n.data;return i.task!==this.key?[null,!1]:[i,!0]})}}const uy=s.z.object({rack:Bt.optional(),keys:s.z.string().array().optional(),names:s.z.string().array().optional(),offset:s.z.number().optional(),limit:s.z.number().optional(),includeState:s.z.boolean().optional()}),hy=s.z.object({tasks:Qe(hs)}),dy="/hardware/task/retrieve",fy="/hardware/task/create",yy="/hardware/task/delete",gy=s.z.object({tasks:cy.array()}),py=s.z.object({tasks:hs.array()}),my=s.z.object({keys:Lt.array()}),wy=s.z.object({});let by=class{constructor(t,e){c(this,"type","task"),c(this,"client"),c(this,"frameClient"),this.client=t,this.frameClient=e}async create(t){const e=!Array.isArray(t),r=await v(this.client,fy,{tasks:N(t)},gy,py),n=this.sugar(r.tasks);return e?n[0]:n}async delete(t){await v(this.client,yy,{keys:N(t)},my,wy)}async search(t){return await this.execRetrieve({keys:[t]})}async page(t,e){return await this.execRetrieve({offset:t,limit:e})}async list(t={}){return this.sugar(await this.execRetrieve(t))}async retrieve(t,e){const{single:r,normalized:n,variant:i}=Yr(t,{number:"rack",string:"keys"},{convertNumericStrings:!1}),a={...e};i==="rack"?a.rack=t:a.keys=n;const o=await this.execRetrieve(a),l=this.sugar(o);return r&&i!=="rack"?l[0]:l}async retrieveByName(t,e){const r=await this.execRetrieve({names:[t],rack:e});return qr("Task",t,r,!0),this.sugar(r)[0]}async execRetrieve(t){return(await v(this.client,dy,t,uy,hy)).tasks}sugar(t){return t.map(({key:e,name:r,type:n,config:i,state:a,internal:o})=>new ly(e,r,n,i,this.frameClient,o,a))}async openTracker(){return await Ut(this.frameClient,"sy_task_set","sy_task_delete",(t,e)=>Array.from(e).map(r=>({variant:t,key:r.toString(),value:r.toString()})))}async openStateObserver(){return new Pt(await this.frameClient.openStreamer(zt),t=>{const e=t.get(zt);if(e.length===0)return[null,!1];const r=Rr.safeParse(e.at(-1));return r.success?[r.data,!0]:[null,!1]})}};const Yt=s.z.string().uuid(),Zr=s.z.object({key:Yt,name:s.z.string().min(1),color:s.z.string()}),vy=s.z.object({keys:Yt.array().optional(),for:ye.optional(),search:s.z.string().optional(),offset:s.z.number().optional(),limit:s.z.number().optional()}),Oy=s.z.object({labels:Zr.array().optional().default([])});var Kt;let Ty=(Kt=class{constructor(t){c(this,"client"),this.client=t}async retrieve(t){const e=N(t);return await this.execute({keys:e})}async retrieveFor(t){return await this.execute({for:t})}async search(t){return await this.execute({search:t})}async page(t,e){return await this.execute({offset:t,limit:e})}async execute(t){const[e,r]=await this.client.send(Kt.ENDPOINT,t,vy,Oy);if(r!=null)throw r;return e.labels}},c(Kt,"ENDPOINT","/label/retrieve"),Kt);const Sy=Zr.extend({key:Yt.optional()}),zy=s.z.object({labels:Sy.array()}),Ny=s.z.object({labels:Zr.array()}),Ey=s.z.object({keys:Yt.array()}),bo=s.z.object({id:ye,labels:Yt.array()}),Iy=bo,pn=s.z.object({}),Ay="/label/create",ky="/label/delete",xy="/label/set",Cy="/label/remove";let jy=class{constructor(t){c(this,"client"),this.client=t}async create(t){return(await v(this.client,Ay,{labels:N(t)},zy,Ny)).labels}async delete(t){await v(this.client,ky,{keys:N(t)},Ey,pn)}async set(t,e){await v(this.client,xy,{id:t,labels:e},bo,pn)}async remove(t,e){await v(this.client,Cy,{id:t,labels:e},Iy,pn)}};const Ry="sy_label_set",$y="sy_label_delete";let My=class{constructor(t,e){c(this,"type","label"),c(this,"retriever"),c(this,"writer"),c(this,"frameClient"),this.writer=new jy(t),this.retriever=new Ty(t),this.frameClient=e}async search(t){return await this.retriever.search(t)}async retrieve(t){const e=Array.isArray(t),r=await this.retriever.retrieve(t);return e?r:r[0]}async retrieveFor(t){return await this.retriever.retrieveFor(t)}async label(t,e){await this.writer.set(t,e)}async removeLabels(t,e){await this.writer.remove(t,e)}async page(t,e){return await this.retriever.page(t,e)}async create(t){const e=Array.isArray(t),r=await this.writer.create(t);return e?r:r[0]}async delete(t){await this.writer.delete(t)}async openChangeTracker(){return await Ut(this.frameClient,Ry,$y,Dy)}};const Dy=(t,e)=>t==="delete"?e.toUUIDs().map(r=>({variant:t,key:r})):e.parseJSON(Zr).map(r=>({variant:t,key:r.key,value:r})),ce=s.z.string().uuid(),et=s.z.object({key:ce,name:s.z.string().min(1),timeRange:oe.z,color:s.z.string().optional()}),vo=et.extend({key:s.z.string().uuid().optional()}),Oo=t=>{const e=N(t);if(e.length===0)throw new Error("Range params must not be empty");const r=ce.safeParse(e[0]).success;return{single:!Array.isArray(t),variant:r?"keys":"names",normalized:e,actual:t}},To="range",So="range-alias",Py=t=>new he({type:To,key:t}),By=t=>new he({type:So,key:t}),Uy=s.z.object({}),Ly=s.z.object({range:et}),Yy=s.z.object({range:ce}),qy=s.z.object({range:ce}),Fy=s.z.object({}),_y="/range/set-active",Wy="/range/retrieve-active",Gy="/range/clear-active";class Zy{constructor(e){c(this,"client"),this.client=e}async setActive(e){await v(this.client,_y,{range:e},Yy,Uy)}async retrieveActive(){const[e,r]=await this.client.send(Wy,{},s.z.object({}),Ly);if(we.matches(r))return null;if(r!=null)throw r;return e.range}async clearActive(e){await v(this.client,Gy,{range:e},qy,Fy)}}const Vy="sy_range_alias_set",Ky="sy_range_alias_delete",Jy=s.z.object({range:ce,aliases:s.z.string().array()}),Hy=s.z.object({aliases:s.z.record(s.z.string(),Be)}),Xy=s.z.object({range:ce,aliases:s.z.record(Be.or(s.z.string()),s.z.string())}),Qy=s.z.unknown(),eg=s.z.object({range:ce,channels:Be.array()}),tg=s.z.unknown(),rg=s.z.object({range:ce}),ng=s.z.object({aliases:s.z.record(s.z.string(),s.z.string())}),mt=class wt{constructor(e,r,n){c(this,"frameClient"),c(this,"cache",new Map),c(this,"client"),c(this,"rangeKey"),this.rangeKey=e,this.cache=new Map,this.client=n,this.frameClient=r}async resolve(e){const r=[],n=typeof e=="string",i={};if(n){const o=this.cache.get(e);if(o!=null)return o;r.push(e)}else e.forEach(o=>{const l=this.cache.get(o);l!=null?i[o]=l:r.push(o)});if(r.length===0)return i;const a=await v(this.client,wt.RESOLVE_ENDPOINT,{range:this.rangeKey,aliases:r},Jy,Hy);return Object.entries(a.aliases).forEach(([o,l])=>this.cache.set(o,l)),n?a.aliases[r[0]]:{...i,...a.aliases}}async set(e){await v(this.client,wt.SET_ENDPOINT,{range:this.rangeKey,aliases:e},Xy,Qy)}async list(){return(await v(this.client,wt.LIST_ENDPOINT,{range:this.rangeKey},rg,ng)).aliases}async delete(e){await v(this.client,wt.DELETE_ENDPOINT,{range:this.rangeKey,channels:e},eg,tg)}async openChangeTracker(){return await Ut(this.frameClient,Vy,Ky,og(this.rangeKey))}};c(mt,"SET_ENDPOINT","/range/alias/set"),c(mt,"RESOLVE_ENDPOINT","/range/alias/resolve"),c(mt,"LIST_ENDPOINT","/range/alias/list"),c(mt,"DELETE_ENDPOINT","/range/alias/delete");let sg=mt;const ig=s.z.object({range:ce,channel:Be,alias:s.z.string()}),ag="---",og=t=>(e,r)=>e==="delete"?r.toStrings().filter(n=>n.split(ag)[0]===t).map(n=>({variant:e,key:n,value:void 0})):r.parseJSON(ig).map(n=>({variant:e,key:n.alias,value:n})),cg=s.z.object({range:ce,keys:s.z.string().array()}),lg=s.z.object({pairs:s.z.record(s.z.string(),s.z.string())}),ug=s.z.object({range:ce,pairs:s.z.record(s.z.string(),s.z.string())}),hg=s.z.object({range:ce,keys:s.z.string().array()}),zr=class Nr{constructor(e,r){c(this,"rangeKey"),c(this,"client"),this.rangeKey=e,this.client=r}async get(e){const[r,n]=await this.client.send(Nr.GET_ENDPOINT,{range:this.rangeKey,keys:N(e)},cg,lg);if(n!=null)throw n;return Array.isArray(e)?r.pairs:r.pairs[e]}async list(){return this.get([])}async set(e,r=""){await v(this.client,Nr.SET_ENDPOINT,{range:this.rangeKey,pairs:Jn(e)?e:{[e]:r}},ug,s.z.unknown())}async delete(e){await v(this.client,Nr.DELETE_ENDPOINT,{range:this.rangeKey,keys:N(e)},hg,s.z.unknown())}};c(zr,"GET_ENDPOINT","/range/kv/get"),c(zr,"SET_ENDPOINT","/range/kv/set"),c(zr,"DELETE_ENDPOINT","/range/kv/delete");let dg=zr;const mn=t=>new he({type:"range",key:t});class zo{constructor(e,r=oe.ZERO,n,i,a,o,l,u,d){c(this,"key"),c(this,"name"),c(this,"kv"),c(this,"timeRange"),c(this,"color"),c(this,"channels"),c(this,"aliaser"),c(this,"frameClient"),c(this,"labelClient"),this.key=n,this.name=e,this.timeRange=r,this.frameClient=a,this.color=i,this.kv=o,this.aliaser=l,this.channels=u,this.labelClient=d}async setAlias(e,r){const n=await this.channels.retrieve(e);if(n.length===0)throw new we(`Channel ${e} does not exist`);await this.aliaser.set({[n[0].key]:r})}async deleteAlias(...e){await this.aliaser.delete(e)}async listAliases(){return await this.aliaser.list()}async openAliasTracker(){return await this.aliaser.openChangeTracker()}async read(e){return await this.frameClient.read(this.timeRange,e)}async labels(){return await this.labelClient.retrieveFor(mn(this.key))}async addLabel(...e){await this.labelClient.label(mn(this.key),e)}async removeLabel(...e){await this.labelClient.removeLabels(mn(this.key),e)}}const fg=s.z.object({keys:ce.array().optional(),names:s.z.array(s.z.string()).optional(),term:s.z.string().optional(),overlapsWith:oe.z.optional()}),yg="/range/retrieve",gg=s.z.object({ranges:Qe(et)});let No=class{constructor(t,e,r,n,i){c(this,"type","range"),c(this,"frameClient"),c(this,"writer"),c(this,"unaryClient"),c(this,"channels"),c(this,"active"),c(this,"labelClient"),this.frameClient=t,this.writer=e,this.unaryClient=r,this.channels=n,this.active=new Zy(r),this.labelClient=i}async create(t){const e=!Array.isArray(t),r=this.sugar(await this.writer.create(N(t)));return e?r[0]:r}async rename(t,e){await this.writer.rename(t,e)}async delete(t){await this.writer.delete(N(t))}async search(t){return this.sugar(await this.execRetrieve({term:t}))}async page(){return[]}async retrieve(t){if(typeof t=="object"&&"start"in t)return await this.execRetrieve({overlapsWith:new oe(t)});const{single:e,actual:r,variant:n,normalized:i}=Oo(t),a=await this.execRetrieve({[n]:i});if(!e)return a;if(a.length===0)throw new xr(`range matching ${r} not found`);if(a.length>1)throw new Cr(`multiple ranges matching ${r} found`);return a[0]}async execRetrieve(t){const{ranges:e}=await v(this.unaryClient,yg,t,fg,gg);return this.sugar(e)}async setActive(t){await this.active.setActive(t)}async retrieveActive(){const t=await this.active.retrieveActive();return t==null?null:this.sugar([t])[0]}async clearActive(t){await this.active.clearActive(t)}sugar(t){return t.map(e=>new zo(e.name,e.timeRange,e.key,e.color,this.frameClient,new dg(e.key,this.unaryClient),new sg(e.key,this.frameClient,this.unaryClient),this.channels,this.labelClient))}async openTracker(){return await Ut(this.frameClient,"sy_range_set","sy_range_delete",(t,e)=>t==="delete"?e.toStrings().map(r=>({variant:t,key:r,value:void 0})):this.sugar(e.parseJSON(et)).map(r=>({variant:t,key:r.key,value:r})))}};const pg=s.z.object({ranges:et.array()}),mg=s.z.object({ranges:vo.array()}),wg=s.z.object({keys:ce.array()}),bg=s.z.object({}),vg=s.z.object({key:ce,name:s.z.string()}),Og=s.z.object({}),Tg="/range/create",Sg="/range/delete",zg="/range/rename";let Eo=class{constructor(t){c(this,"client"),this.client=t}async rename(t,e){await v(this.client,zg,{key:t,name:e},vg,Og)}async create(t){return(await v(this.client,Tg,{ranges:t},mg,pg)).ranges}async delete(t){await v(this.client,Sg,{keys:t},wg,bg)}};const Ng=Object.freeze(Object.defineProperty({__proto__:null,Client:No,Range:zo,RangeAliasOntologyType:So,RangeOntologyType:To,Writer:Eo,analyzeParams:Oo,keyZ:ce,newPayloadZ:vo,payloadZ:et,rangeAliasOntologyID:By,rangeOntologyID:Py},Symbol.toStringTag,{value:"Module"})),Eg="/api/v1/";class Ig{constructor(e,r=!1){c(this,"url"),c(this,"unary"),c(this,"stream"),c(this,"secure"),this.secure=r,this.url=e.child(Eg);const n=new Xe.JSONCodec;this.unary=new Lu(this.url,n,this.secure),this.stream=new Ku(this.url,n,this.secure)}use(...e){this.unary.use(...e),this.stream.use(...e)}}const ds=s.z.string().uuid(),fs=s.z.object({key:s.z.string(),name:s.z.string(),data:Qn.or(s.z.string().transform(t=>JSON.parse(t)))}),Ag=s.z.object({keys:s.z.string().array()}),kg=s.z.object({linePlots:fs.array()});let xg=class{constructor(t){c(this,"ENDPOINT","/workspace/lineplot/retrieve"),c(this,"client"),this.client=t}async retrieve(t){const e=N(t);return(await v(this.client,this.ENDPOINT,{keys:e},Ag,kg)).linePlots}};const Ge=s.z.string().uuid(),Io=t=>JSON.parse(t),Ao=s.z.object({name:s.z.string(),key:Ge,layout:Qn.or(s.z.string().transform(t=>Io(t)))}),ko=Ao.omit({layout:!0}).extend({layout:s.z.string().transform(t=>Io(t))}),Cg=fs.partial({key:!0}).transform(t=>({...t,data:JSON.stringify(t.data)})),jg=s.z.object({workspace:Ge,linePlots:Cg.array()}),Rg=s.z.object({linePlots:fs.array()}),$g=s.z.object({keys:ds.array()}),Mg=s.z.object({}),Dg=s.z.object({key:ds,name:s.z.string()}),Pg=s.z.object({}),Bg=s.z.object({key:ds,data:s.z.string()}),Ug=s.z.object({}),Lg="/workspace/lineplot/create",Yg="/workspace/lineplot/delete",qg="/workspace/lineplot/rename",Fg="/workspace/lineplot/set-data";let _g=class{constructor(t){c(this,"client"),this.client=t}async create(t,e){const r={...e,data:JSON.stringify(e.data)};return(await v(this.client,Lg,{workspace:t,linePlots:[r]},jg,Rg)).linePlots[0]}async delete(t){const e=N(t);await v(this.client,Yg,{keys:e},$g,Mg)}async rename(t,e){await v(this.client,qg,{key:t,name:e},Dg,Pg)}async setData(t,e){await v(this.client,Fg,{key:t,data:JSON.stringify(e)},Bg,Ug)}},Wg=class{constructor(t){c(this,"writer"),c(this,"retriever"),this.writer=new _g(t),this.retriever=new xg(t)}async create(t,e){return await this.writer.create(t,e)}async rename(t,e){await this.writer.rename(t,e)}async setData(t,e){await this.writer.setData(t,e)}async retrieve(t){const e=Array.isArray(t),r=await this.retriever.retrieve(t);return e?r:r[0]}async delete(t){await this.writer.delete(t)}};const Gg=s.z.object({keys:Ge.array().optional(),search:s.z.string().optional(),author:s.z.string().uuid().optional(),offset:s.z.number().optional(),limit:s.z.number().optional()}),Zg=s.z.object({workspaces:Qe(ko)});var Jt;let Vg=(Jt=class{constructor(t){c(this,"client"),this.client=t}async retrieve(t){const e=N(t);return await this.execute({keys:e})}async retrieveByAuthor(t){return await this.execute({author:t})}async search(t){return await this.execute({search:t})}async page(t,e){return await this.execute({offset:t,limit:e})}async execute(t){return(await v(this.client,Jt.ENDPOINT,t,Gg,Zg)).workspaces}},c(Jt,"ENDPOINT","/workspace/retrieve"),Jt);const Vr=s.z.string().uuid(),Kg=s.z.object({key:s.z.string(),name:s.z.string(),data:Qn.or(s.z.string().transform(t=>JSON.parse(t))),snapshot:s.z.boolean()}),ys=s.z.object({key:s.z.string(),name:s.z.string(),snapshot:s.z.boolean(),data:s.z.string().transform(t=>JSON.parse(t))}),Jg=s.z.object({keys:s.z.string().array()}),Hg=s.z.object({schematics:ys.array()});class Xg{constructor(e){c(this,"ENDPOINT","/workspace/schematic/retrieve"),c(this,"client"),this.client=e}async retrieve(e){return(await v(this.client,this.ENDPOINT,{keys:N(e)},Jg,Hg)).schematics}}const Qg=Kg.partial({key:!0,snapshot:!0}).transform(t=>({...t,data:JSON.stringify(t.data)})),ep=s.z.object({workspace:Ge,schematics:Qg.array()}),tp=s.z.object({schematics:ys.array()}),rp=s.z.object({keys:Vr.array()}),np=s.z.object({}),sp=s.z.object({key:Vr,name:s.z.string()}),gi=s.z.object({}),ip=s.z.object({key:Vr,data:s.z.string()});s.z.object({});const ap=s.z.object({key:Vr,name:s.z.string(),snapshot:s.z.boolean()}),op=s.z.object({schematic:ys}),cp="/workspace/schematic/create",lp="/workspace/schematic/delete",up="/workspace/schematic/rename",hp="/workspace/schematic/set-data",dp="/workspace/schematic/copy";let fp=class{constructor(t){c(this,"client"),this.client=t}async create(t,e){const r={...e,data:JSON.stringify(e.data)};return(await v(this.client,cp,{workspace:t,schematics:[r]},ep,tp)).schematics[0]}async copy(t,e,r){return(await v(this.client,dp,{key:t,name:e,snapshot:r},ap,op)).schematic}async delete(t){const e=N(t);await v(this.client,lp,{keys:e},rp,np)}async rename(t,e){await v(this.client,up,{key:t,name:e},sp,gi)}async setData(t,e){await v(this.client,hp,{key:t,data:JSON.stringify(e)},ip,gi)}},yp=class{constructor(t){c(this,"writer"),c(this,"retriever"),this.writer=new fp(t),this.retriever=new Xg(t)}async create(t,e){return await this.writer.create(t,e)}async rename(t,e){await this.writer.rename(t,e)}async setData(t,e){await this.writer.setData(t,e)}async retrieve(t){const e=Array.isArray(t),r=await this.retriever.retrieve(t);return e?r:r[0]}async delete(t){await this.writer.delete(t)}async copy(t,e,r){return await this.writer.copy(t,e,r)}};const gp=Ao.partial({key:!0}).transform(t=>({...t,layout:JSON.stringify(t.layout)})),pp=s.z.object({workspaces:gp.array()}),mp=s.z.object({workspaces:ko.array()}),wp=s.z.object({keys:Ge.array()}),bp=s.z.object({}),vp=s.z.object({key:Ge,name:s.z.string()}),Op=s.z.object({}),Tp=s.z.object({key:Ge,layout:s.z.string()}),Sp=s.z.object({}),zp="/workspace/create",Np="/workspace/delete",Ep="/workspace/rename",Ip="/workspace/set-layout";class Ap{constructor(e){c(this,"client"),this.client=e}async create(e){return(await v(this.client,zp,{workspaces:N(e)},pp,mp)).workspaces}async delete(e){await v(this.client,Np,{keys:N(e)},wp,bp)}async rename(e,r){await v(this.client,Ep,{key:e,name:r},vp,Op)}async setLayout(e,r){await v(this.client,Ip,{key:e,layout:JSON.stringify(r)},Tp,Sp)}}class kp{constructor(e){c(this,"type","workspace"),c(this,"schematic"),c(this,"linePlot"),c(this,"retriever"),c(this,"writer"),this.schematic=new yp(e),this.linePlot=new Wg(e),this.retriever=new Vg(e),this.writer=new Ap(e)}async search(e){return await this.retriever.search(e)}async retrieveByAuthor(e){return await this.retriever.retrieveByAuthor(e)}async retrieve(e){const r=Array.isArray(e),n=await this.retriever.retrieve(e);return r?n:n[0]}async page(e,r){return await this.retriever.page(e,r)}async create(e){const r=Array.isArray(e),n=await this.writer.create(e);return r?n:n[0]}async rename(e,r){await this.writer.rename(e,r)}async setLayout(e,r){await this.writer.setLayout(e,r)}async delete(...e){await this.writer.delete(e)}}const xo=s.z.object({host:s.z.string({required_error:"Host is required"}).min(1,"Host is required"),port:s.z.number({required_error:"Port is required"}).or(s.z.string({required_error:"Port is required"})),username:s.z.string().optional(),password:s.z.string().optional(),connectivityPollFrequency:I.z.default(I.seconds(30)),secure:s.z.boolean().optional().default(!1),name:s.z.string().optional()});class Co extends po{constructor(e){const r=xo.parse(e),{host:n,port:i,username:a,password:o,connectivityPollFrequency:l,secure:u}=r,d=new Ig(new sd({host:n,port:Number(i)}),u);d.use(dd);let f;a!=null&&o!=null&&(f=new gf(d.unary,{username:a,password:o}),d.use(f.middleware()));const h=new rs(new ts(d.unary)),M=new ro(d.unary,h);super(d.stream,d.unary,h),c(this,"createdAt"),c(this,"props"),c(this,"ranges"),c(this,"channels"),c(this,"auth"),c(this,"user"),c(this,"access"),c(this,"connectivity"),c(this,"ontology"),c(this,"workspaces"),c(this,"labels"),c(this,"hardware"),c(this,"control"),c(this,"transport"),this.createdAt=E.now(),this.props=r,this.auth=f,this.transport=d,this.channels=new to(this,h,d.unary,M),this.connectivity=new oo(d.unary,l,r.name),this.control=new wo(this),this.ontology=new xd(d.unary,this);const _=new Eo(this.transport.unary);this.labels=new My(this.transport.unary,this),this.ranges=new No(this,_,this.transport.unary,h,this.labels),this.access=new uf(this.transport.unary),this.user=new df(this.transport.unary),this.workspaces=new kp(this.transport.unary);const re=new Xf(this.transport.unary,this),j=new by(this.transport.unary,this),Ho=new ay(this.transport.unary,this,j);this.hardware=new Yf(j,Ho,re)}get key(){return this.createdAt.valueOf().toString()}close(){this.connectivity.stopChecking()}}c(Co,"connectivity",oo);const xp=He.Authority,Pn=(t,e,r="")=>{try{return t.parse(e)}catch(n){if(n instanceof s.z.ZodError){const i=n.errors.map(a=>a.path.length===0?a.message:`${a.path.join(".")}: ${a.message}`);throw new Error(`${r} - ${i.join(`
|
|
50
|
+
`)}`)}else throw n}};var Cp=Object.defineProperty,jp=(t,e,r)=>e in t?Cp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,J=(t,e,r)=>jp(t,typeof e!="symbol"?e+"":e,r);const Bn=class jo{constructor(e,r,n="",i=!1){J(this,"_noop",!1),J(this,"key"),J(this,"path"),J(this,"serviceName"),this.key=e,this.path=r,this.serviceName=n,this._noop=i}child(e){return new jo(e,this.extendPath(e),this.serviceName,this.noop)}extendPath(e){return`${this.path}.${e}`}get noop(){return this._noop}};J(Bn,"NOOP",new Bn("","",""));let gs=Bn;const Un=["debug","info","warn","error"],Rp=t=>{const e=Un.indexOf(t);return({level:r})=>Un.indexOf(r)>=e},$p=t=>{const{include:e,exclude:r}=t;return({path:n})=>!(e!=null&&!e.some(i=>n.startsWith(i))||r!=null&&r.some(i=>n.startsWith(i)))},Ln=class Ro{constructor(e={}){J(this,"meta",gs.NOOP),J(this,"filters");const{filters:r=[]}=e;this.filters=r}filter(e){return!this.meta.noop&&this.filters.every(r=>r({key:this.meta.key,path:this.meta.path,level:e}))}child(e){const r=new Ro({filters:this.filters});return r.meta=e,r}debug(e,r,n=!1){!this.filter("debug")&&!n||(r==null?console.log("%cDEBUG","color: #8c00f0;",this.meta.path,e):console.log("%cDEBUG","color: #8c00f0;",this.meta.path,e,Ht(r)))}info(e,r,n=!1){!this.filter("info")&&!n||(r==null?console.log("%cINFO","color: #005eff;",this.meta.path,e):console.log("%cINFO","color: #005eff;",this.meta.path,e,Ht(r)))}warn(e,r,n=!1){!this.filter("warn")&&!n||(r==null?console.warn("WARN",this.meta.path,e):console.warn("WARN",this.meta.path,e,Ht(r)))}error(e,r,n=!1){!this.filter("error")&&!n||(r==null?console.error("ERROR",this.meta.path,e):console.error("ERROR",this.meta.path,e,Ht(r)))}};J(Ln,"NOOP",new Ln);let $o=Ln;const Ht=t=>typeof t=="function"?t():t;var Mp=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{},_e="1.8.0",pi=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function Dp(t){var e=new Set([t]),r=new Set,n=t.match(pi);if(!n)return function(){return!1};var i={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(i.prerelease!=null)return function(l){return l===t};function a(l){return r.add(l),!1}function o(l){return e.add(l),!0}return function(l){if(e.has(l))return!0;if(r.has(l))return!1;var u=l.match(pi);if(!u)return a(l);var d={major:+u[1],minor:+u[2],patch:+u[3],prerelease:u[4]};return d.prerelease!=null||i.major!==d.major?a(l):i.major===0?i.minor===d.minor&&i.patch<=d.patch?o(l):a(l):i.minor<=d.minor?o(l):a(l)}}var Pp=Dp(_e),Bp=_e.split(".")[0],kt=Symbol.for("opentelemetry.js.api."+Bp),xt=Mp;function ps(t,e,r,n){var i;n===void 0&&(n=!1);var a=xt[kt]=(i=xt[kt])!==null&&i!==void 0?i:{version:_e};if(!n&&a[t]){var o=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+t);return r.error(o.stack||o.message),!1}if(a.version!==_e){var o=new Error("@opentelemetry/api: Registration of version v"+a.version+" for "+t+" does not match previously registered API v"+_e);return r.error(o.stack||o.message),!1}return a[t]=e,r.debug("@opentelemetry/api: Registered a global for "+t+" v"+_e+"."),!0}function Ct(t){var e,r,n=(e=xt[kt])===null||e===void 0?void 0:e.version;if(!(!n||!Pp(n)))return(r=xt[kt])===null||r===void 0?void 0:r[t]}function ms(t,e){e.debug("@opentelemetry/api: Unregistering a global for "+t+" v"+_e+".");var r=xt[kt];r&&delete r[t]}var Up=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,a=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(l){o={error:l}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return a},Lp=function(t,e,r){if(arguments.length===2)for(var n=0,i=e.length,a;n<i;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return t.concat(a||Array.prototype.slice.call(e))},Yp=function(){function t(e){this._namespace=e.namespace||"DiagComponentLogger"}return t.prototype.debug=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return st("debug",this._namespace,e)},t.prototype.error=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return st("error",this._namespace,e)},t.prototype.info=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return st("info",this._namespace,e)},t.prototype.warn=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return st("warn",this._namespace,e)},t.prototype.verbose=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return st("verbose",this._namespace,e)},t}();function st(t,e,r){var n=Ct("diag");if(n)return r.unshift(e),n[t].apply(n,Lp([],Up(r),!1))}var fe;(function(t){t[t.NONE=0]="NONE",t[t.ERROR=30]="ERROR",t[t.WARN=50]="WARN",t[t.INFO=60]="INFO",t[t.DEBUG=70]="DEBUG",t[t.VERBOSE=80]="VERBOSE",t[t.ALL=9999]="ALL"})(fe||(fe={}));function qp(t,e){t<fe.NONE?t=fe.NONE:t>fe.ALL&&(t=fe.ALL),e=e||{};function r(n,i){var a=e[n];return typeof a=="function"&&t>=i?a.bind(e):function(){}}return{error:r("error",fe.ERROR),warn:r("warn",fe.WARN),info:r("info",fe.INFO),debug:r("debug",fe.DEBUG),verbose:r("verbose",fe.VERBOSE)}}var Fp=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,a=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(l){o={error:l}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return a},_p=function(t,e,r){if(arguments.length===2)for(var n=0,i=e.length,a;n<i;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return t.concat(a||Array.prototype.slice.call(e))},Wp="diag",jt=function(){function t(){function e(i){return function(){for(var a=[],o=0;o<arguments.length;o++)a[o]=arguments[o];var l=Ct("diag");if(l)return l[i].apply(l,_p([],Fp(a),!1))}}var r=this,n=function(i,a){var o,l,u;if(a===void 0&&(a={logLevel:fe.INFO}),i===r){var d=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return r.error((o=d.stack)!==null&&o!==void 0?o:d.message),!1}typeof a=="number"&&(a={logLevel:a});var f=Ct("diag"),h=qp((l=a.logLevel)!==null&&l!==void 0?l:fe.INFO,i);if(f&&!a.suppressOverrideMessage){var M=(u=new Error().stack)!==null&&u!==void 0?u:"<failed to generate stacktrace>";f.warn("Current logger will be overwritten from "+M),h.warn("Current logger will overwrite one already registered from "+M)}return ps("diag",h,r,!0)};r.setLogger=n,r.disable=function(){ms(Wp,r)},r.createComponentLogger=function(i){return new Yp(i)},r.verbose=e("verbose"),r.debug=e("debug"),r.info=e("info"),r.warn=e("warn"),r.error=e("error")}return t.instance=function(){return this._instance||(this._instance=new t),this._instance},t}(),Gp=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,a=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(l){o={error:l}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return a},Zp=function(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Vp=function(){function t(e){this._entries=e?new Map(e):new Map}return t.prototype.getEntry=function(e){var r=this._entries.get(e);if(r)return Object.assign({},r)},t.prototype.getAllEntries=function(){return Array.from(this._entries.entries()).map(function(e){var r=Gp(e,2),n=r[0],i=r[1];return[n,i]})},t.prototype.setEntry=function(e,r){var n=new t(this._entries);return n._entries.set(e,r),n},t.prototype.removeEntry=function(e){var r=new t(this._entries);return r._entries.delete(e),r},t.prototype.removeEntries=function(){for(var e,r,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var a=new t(this._entries);try{for(var o=Zp(n),l=o.next();!l.done;l=o.next()){var u=l.value;a._entries.delete(u)}}catch(d){e={error:d}}finally{try{l&&!l.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}return a},t.prototype.clear=function(){return new t},t}();jt.instance();function Kp(t){return t===void 0&&(t={}),new Vp(new Map(Object.entries(t)))}function Jp(t){return Symbol.for(t)}var Hp=function(){function t(e){var r=this;r._currentContext=e?new Map(e):new Map,r.getValue=function(n){return r._currentContext.get(n)},r.setValue=function(n,i){var a=new t(r._currentContext);return a._currentContext.set(n,i),a},r.deleteValue=function(n){var i=new t(r._currentContext);return i._currentContext.delete(n),i}}return t}(),Xp=new Hp,Qp={get:function(t,e){if(t!=null)return t[e]},keys:function(t){return t==null?[]:Object.keys(t)}},em={set:function(t,e,r){t!=null&&(t[e]=r)}},tm=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,a=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(l){o={error:l}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return a},rm=function(t,e,r){if(arguments.length===2)for(var n=0,i=e.length,a;n<i;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return t.concat(a||Array.prototype.slice.call(e))},nm=function(){function t(){}return t.prototype.active=function(){return Xp},t.prototype.with=function(e,r,n){for(var i=[],a=3;a<arguments.length;a++)i[a-3]=arguments[a];return r.call.apply(r,rm([n],tm(i),!1))},t.prototype.bind=function(e,r){return r},t.prototype.enable=function(){return this},t.prototype.disable=function(){return this},t}(),sm=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,a=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(l){o={error:l}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return a},im=function(t,e,r){if(arguments.length===2)for(var n=0,i=e.length,a;n<i;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return t.concat(a||Array.prototype.slice.call(e))},wn="context",am=new nm,Mo=function(){function t(){}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalContextManager=function(e){return ps(wn,e,jt.instance())},t.prototype.active=function(){return this._getContextManager().active()},t.prototype.with=function(e,r,n){for(var i,a=[],o=3;o<arguments.length;o++)a[o-3]=arguments[o];return(i=this._getContextManager()).with.apply(i,im([e,r,n],sm(a),!1))},t.prototype.bind=function(e,r){return this._getContextManager().bind(e,r)},t.prototype._getContextManager=function(){return Ct(wn)||am},t.prototype.disable=function(){this._getContextManager().disable(),ms(wn,jt.instance())},t}(),Yn;(function(t){t[t.UNSET=0]="UNSET",t[t.OK=1]="OK",t[t.ERROR=2]="ERROR"})(Yn||(Yn={}));var om=Mo.getInstance(),cm=function(){function t(){}return t.prototype.inject=function(e,r){},t.prototype.extract=function(e,r){return e},t.prototype.fields=function(){return[]},t}(),ws=Jp("OpenTelemetry Baggage Key");function Do(t){return t.getValue(ws)||void 0}function lm(){return Do(Mo.getInstance().active())}function um(t,e){return t.setValue(ws,e)}function hm(t){return t.deleteValue(ws)}var bn="propagation",dm=new cm,fm=function(){function t(){this.createBaggage=Kp,this.getBaggage=Do,this.getActiveBaggage=lm,this.setBaggage=um,this.deleteBaggage=hm}return t.getInstance=function(){return this._instance||(this._instance=new t),this._instance},t.prototype.setGlobalPropagator=function(e){return ps(bn,e,jt.instance())},t.prototype.inject=function(e,r,n){return n===void 0&&(n=em),this._getGlobalPropagator().inject(e,r,n)},t.prototype.extract=function(e,r,n){return n===void 0&&(n=Qp),this._getGlobalPropagator().extract(e,r,n)},t.prototype.fields=function(){return this._getGlobalPropagator().fields()},t.prototype.disable=function(){ms(bn,jt.instance())},t.prototype._getGlobalPropagator=function(){return Ct(bn)||dm},t}(),ym=fm.getInstance();const mi=["bench","debug","prod"],gm=t=>e=>mi.indexOf(e)>=mi.indexOf(t),qn=class Po{constructor(e,r=gm("debug")){J(this,"meta",gs.NOOP),J(this,"tracer"),J(this,"filter"),this.tracer=e,this.filter=r}child(e){const r=new Po(this.tracer,this.filter);return r.meta=e,r}debug(e,r){return this.trace(e,"debug",r)}bench(e,r){return this.trace(e,"bench",r)}prod(e,r){return this.trace(e,"prod",r)}trace(e,r,n){return this.meta.noop||!this.filter(r)?n(new Lo(e)):this.tracer.startActiveSpan(e,i=>{const a=new Uo(e,i),o=n(a);return i.end(),o})}propagate(e){if(this.meta.noop)return;const r=om.active();ym.inject(r,e,{set:(n,i,a)=>{n[i]=a}})}};J(qn,"NOOP",new qn);let Bo=qn;class Uo{constructor(e,r){J(this,"key"),J(this,"otel"),this.key=e,this.otel=r}set(e,r){this.otel.setAttribute(e,r)}recordError(e){e!=null&&(this.otel.recordException(e),this.otel.setStatus({code:Yn.ERROR}))}}class Lo{constructor(e){J(this,"key"),this.key=e}set(){}recordError(e){}}const Fn=class Yo{constructor({key:e="",serviceName:r="",logger:n=$o.NOOP,tracer:i=Bo.NOOP,noop:a=!1,__meta:o}){J(this,"meta"),J(this,"T"),J(this,"L"),this.meta=o??new gs(e,e,r,a),this.T=i.child(this.meta),this.L=n.child(this.meta)}child(e){const r=this.meta.child(e);return new Yo({__meta:r,tracer:this.T,logger:this.L})}};J(Fn,"NOOP",new Fn({noop:!0}));let bs=Fn;const pm=bs.NOOP,qo=Object.freeze(Object.defineProperty({__proto__:null,Instrumentation:bs,LOG_LEVELS:Un,Logger:$o,NOOP:pm,NoopSpan:Lo,Tracer:Bo,_Span:Uo,logLevelKeyFiler:$p,logThresholdFilter:Rp},Symbol.toStringTag,{value:"Module"})),mm=new Error("request for lock canceled");var wm=function(t,e,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function l(f){try{d(n.next(f))}catch(h){o(h)}}function u(f){try{d(n.throw(f))}catch(h){o(h)}}function d(f){f.done?a(f.value):i(f.value).then(l,u)}d((n=n.apply(t,e||[])).next())})};class bm{constructor(e,r=mm){this._value=e,this._cancelError=r,this._queue=[],this._weightedWaiters=[]}acquire(e=1,r=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return new Promise((n,i)=>{const a={resolve:n,reject:i,weight:e,priority:r},o=Fo(this._queue,l=>r<=l.priority);o===-1&&e<=this._value?this._dispatchItem(a):this._queue.splice(o+1,0,a)})}runExclusive(e){return wm(this,arguments,void 0,function*(r,n=1,i=0){const[a,o]=yield this.acquire(n,i);try{return yield r(a)}finally{o()}})}waitForUnlock(e=1,r=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return this._couldLockImmediately(e,r)?Promise.resolve():new Promise(n=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),vm(this._weightedWaiters[e-1],{resolve:n,priority:r})})}isLocked(){return this._value<=0}getValue(){return this._value}setValue(e){this._value=e,this._dispatchQueue()}release(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);this._value+=e,this._dispatchQueue()}cancel(){this._queue.forEach(e=>e.reject(this._cancelError)),this._queue=[]}_dispatchQueue(){for(this._drainUnlockWaiters();this._queue.length>0&&this._queue[0].weight<=this._value;)this._dispatchItem(this._queue.shift()),this._drainUnlockWaiters()}_dispatchItem(e){const r=this._value;this._value-=e.weight,e.resolve([r,this._newReleaser(e.weight)])}_newReleaser(e){let r=!1;return()=>{r||(r=!0,this.release(e))}}_drainUnlockWaiters(){if(this._queue.length===0)for(let e=this._value;e>0;e--){const r=this._weightedWaiters[e-1];r&&(r.forEach(n=>n.resolve()),this._weightedWaiters[e-1]=[])}else{const e=this._queue[0].priority;for(let r=this._value;r>0;r--){const n=this._weightedWaiters[r-1];if(!n)continue;const i=n.findIndex(a=>a.priority<=e);(i===-1?n:n.splice(0,i)).forEach(a=>a.resolve())}}}_couldLockImmediately(e,r){return(this._queue.length===0||this._queue[0].priority<r)&&e<=this._value}}function vm(t,e){const r=Fo(t,n=>e.priority<=n.priority);t.splice(r+1,0,e)}function Fo(t,e){for(let r=t.length-1;r>=0;r--)if(e(t[r]))return r;return-1}var Om=function(t,e,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function l(f){try{d(n.next(f))}catch(h){o(h)}}function u(f){try{d(n.throw(f))}catch(h){o(h)}}function d(f){f.done?a(f.value):i(f.value).then(l,u)}d((n=n.apply(t,e||[])).next())})};class _o{constructor(e){this._semaphore=new bm(1,e)}acquire(){return Om(this,arguments,void 0,function*(e=0){const[,r]=yield this._semaphore.acquire(1,e);return r})}runExclusive(e,r=0){return this._semaphore.runExclusive(()=>e(),1,r)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(e=0){return this._semaphore.waitForUnlock(1,e)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}}class Kr{constructor(e,r,n=new Map){D(this,"providers");D(this,"registry");D(this,"sender");D(this,"changedKeys");this.providers=n,this.registry=r,this.changedKeys=[],this.sender=e}propagateState(e,r,n=[]){this.sender.send({key:e,state:r},n)}copyAndMerge(e){const r=new Kr(this.sender,this.registry,new Map);return e==null||e.providers.forEach((n,i)=>r.providers.set(i,n)),this.providers.forEach((n,i)=>r.providers.set(i,n)),r.changedKeys=[],r}get changed(){return this.changedKeys.length>0}set(e,r,n=!0){this.providers.set(e,r),n&&this.changedKeys.push(e)}setIfNotHas(e,r){this.providers.has(e)||this.set(e,r)}async create(e){const r=this.registry[e.type];if(r==null)throw new Error(`[AetherRoot.create] - could not find component ${e.type}`);const n=new r(e);return await n.internalUpdate(e),n}getOptional(e){return this.providers.get(e)??null}has(e){return this.providers.has(e)}get(e){const r=this.getOptional(e);if(r==null)throw new Error(`[AetherRoot.get] - could not find provider ${e}`);return r}}class vs{constructor(e){D(this,"type");D(this,"key");D(this,"_ctx");D(this,"_internalState");D(this,"_state");D(this,"_prevState");D(this,"_deleted",!1);D(this,"instrumentation");D(this,"schema");this.type=e.type,this.key=e.path[0],this._ctx=e.ctx,this._internalState={},this.instrumentation=e.instrumentation.child(`${this.type}(${this.key})`)}get _schema(){if(this.schema==null)throw new G(`[AetherLeaf] - expected subclass to define component schema, but none was found.
|
|
51
|
+
Make sure to defne a property 'schema' on the class.`);return this.schema}setState(e){const r=Zn(e,this._state);this._prevState={...this._state},this._state=Pn(this._schema,r,`${this.type}:${this.key}`),this.ctx.propagateState(this.key,r)}get ctx(){if(this._ctx==null)throw new me("context not defined");return this._ctx}get state(){if(this._state==null)throw new me("state not defined");return this._state}get internal(){return this._internalState}get prevState(){return this._prevState}get deleted(){return this._deleted}async internalUpdate({variant:e,path:r,ctx:n,state:i}){if(!this.deleted){if(this._ctx=n,e==="state"){this.validatePath(r);const a=Pn(this._schema,i,`${this.type}:${this.key}`);this._state!=null?this.instrumentation.L.debug("updating state",()=>({diff:Ti.difference(this.state,a)})):this.instrumentation.L.debug("setting initial state",{state:i}),this._prevState=this._state??a,this._state=a}else this.instrumentation.L.debug("updating context");await this.afterUpdate()}}async internalDelete(e){this.validatePath(e),this._deleted=!0,await this.afterDelete()}beforeUpdate(){}async afterUpdate(){}async afterDelete(){}validatePath(e){if(e.length===0)throw new me(`[Leaf.setState] - ${this.type}:${this.key} received an empty path`);const r=e[e.length-1];if(e.length>1)throw new me(`[Leaf.setState] - ${this.type}:${this.key} received a subPath ${e.join(".")} but is a leaf`);if(r!==this.key)throw new me(`[Leaf.setState] - ${this.type}:${this.key} received a key ${r} but expected ${this.key}`)}}class qt extends vs{constructor(r){super(r);D(this,"_children");this._children=new Map}get children(){return Array.from(this._children.values())}async internalUpdate(r){const{variant:n,path:i}=r;if(n==="context")return this._ctx=r.ctx.copyAndMerge(this._ctx),await this.updateContext({...r,ctx:this.ctx});const[a,o]=this.getRequiredKey(i),l={...r,ctx:this.ctx};return o.length===0?await this.updateThis(a,l):await this.updateChild(o,l)}async updateContext(r){await super.internalUpdate(r);for(const n of this.children)await n.internalUpdate({...r,ctx:this.ctx,variant:"context"})}async updateChild(r,n){const i=r[0],a=this.getChild(i);if(a!=null)return await a.internalUpdate({...n,path:r});if(r.length>1)throw new Error(`[Composite.setState] - ${this.type}:${this.key} could not find child with key ${i} while updating `);this._children.set(i,await n.ctx.create({...n,path:r}))}async updateThis(r,n){const i=n.ctx.copyAndMerge(this._ctx);if(r!==this.key)throw new me(`[Composite.update] - ${this.type}:${this.key} received a key ${r} but expected ${this.key}`);if(await super.internalUpdate({...n,ctx:i}),!!i.changed){this.instrumentation.L.debug("context changed",{changedKeys:i.changedKeys});for(const a of this.children)await a.internalUpdate({...n,ctx:this.ctx,variant:"context"})}}async internalDelete(r){const[n,i]=this.getRequiredKey(r);if(i.length===0){if(n!==this.key)throw new Error(`[Composite.delete] - ${this.type}:${this.key} received a key ${n} but expected ${this.key}`);const o=this.children;this._children=new Map;for(const l of o)await l.internalDelete([l.key]);await super.internalDelete([this.key])}const a=this.getChild(i[0]);a!=null&&(i.length>1?await a.internalDelete(i):(this._children.delete(a.key),await a.internalDelete(i)))}getRequiredKey(r,n){const[i,...a]=r;if(i==null)throw new Error(`Composite ${this.type}:${this.key} received an empty path`+(n!=null?` for ${n}`:""));return[i,a]}getChild(r){return this._children.get(r)??null}childrenOfType(...r){return this.children.filter(n=>r.includes(n.type))}}const Tm=s.z.object({}),Ee=class Ee extends qt{constructor({worker:r,registry:n,instrumentation:i=qo.Instrumentation.NOOP}){const o={ctx:new Kr(r,n,new Map),...Ee.ZERO_UPDATE,instrumentation:i};super(o);D(this,"wrap");D(this,"schema",Ee.schema);D(this,"mu",new _o);this.mu.runExclusive(async()=>await this.internalUpdate(o)),this.wrap=r,this.wrap.handle(l=>{this.mu.runExclusive(async()=>await this.handle(l))})}async handle(r){if(r.variant==="delete")await this.internalDelete(r.path);else{const n={...r,variant:"state",ctx:this.ctx,instrumentation:this.instrumentation};await this.internalUpdate(n)}}};D(Ee,"TYPE","root"),D(Ee,"KEY","root"),D(Ee,"ZERO_UPDATE",{path:[Ee.KEY],type:Ee.TYPE,variant:"state",state:{}}),D(Ee,"schema",Tm);let $r=Ee;const Wo=t=>new $r(t),Sm=Object.freeze(Object.defineProperty({__proto__:null,Composite:qt,Context:Kr,Leaf:vs,Root:$r,render:Wo},Symbol.toStringTag,{value:"Module"})),Go="pluto-theming-context",zm=s.z.object({theme:Ui}),Nt=class Nt extends qt{constructor(){super(...arguments);D(this,"schema",Nt.z)}async afterUpdate(){this.ctx.set(Go,this.state.theme)}};D(Nt,"TYPE","theming.Provider"),D(Nt,"z",zm);let Rt=Nt;const Nm=t=>t.get(Go),Em={[Rt.TYPE]:Rt},Zo=["success","error","warning","info","loading","disabled","secondary"],Vo=s.z.enum(Zo),Ko=s.z.object({key:s.z.string(),variant:Vo,message:s.z.string(),description:s.z.string().optional(),time:F.z,data:s.z.record(s.z.unknown()).optional()}),Jo=s.z.object({statuses:Ko.array()}),Os="status.aggregator";class Mr extends qt{constructor(){super(...arguments);D(this,"schema",Jo)}async afterUpdate(){this.ctx.set(Os,this)}add(r){const n=F.now();this.setState(i=>({...i,statuses:[...i.statuses,{time:n,key:n.toString(),...r}]}))}}D(Mr,"TYPE","status.Aggregator");const Im=t=>{const e=t.get(Os);return e.add.bind(e)},Am=t=>{const e=t.getOptional(Os);return e!=null?e.add.bind(e):()=>{}},km={[Mr.TYPE]:Mr};exports.$=$c;exports.A=Zc;exports.Aggregator=Mr;exports.B=bs;exports.C=fl;exports.C$1=Pr;exports.ComponentSizeLevels=Bi;exports.Composite=qt;exports.E=mc;exports.Ee=me;exports.G=hl;exports.I=ae;exports.Ie=Fe;exports.L=dl;exports.LEVELS=Pi;exports.Leaf=vs;exports.LevelComponentSizes=ml;exports.Mutex=_o;exports.N=Ei;exports.N$1=ll;exports.O=E;exports.P=G;exports.Provider=Rt;exports.Q=we;exports.REGISTRY=Em;exports.REGISTRY$1=km;exports.S=I;exports.S$1=cc;exports.SYNNAX_DARK=Yi;exports.SYNNAX_LIGHT=Li;exports.SYNNAX_THEMES=El;exports.U=Et;exports.V=oe;exports.VARIANTS=Zo;exports.Zy=Xd;exports._=Ti;exports._y=Lf;exports.ad=Ng;exports.aether=Sm;exports.aggregatorStateZ=Jo;exports.c=vi;exports.commonjsGlobal=ec;exports.dd=xp;exports.dimensions=bl;exports.executeInitialSetter=$t;exports.executeSetter=Zn;exports.fontString=xl;exports.g=$;exports.g$1=qo;exports.getAugmentedNamespace=rc;exports.getDefaultExportFromCjs=tc;exports.gy=Co;exports.i=Wn;exports.isSetter=Gn;exports.l=rl;exports.levelZ=pl;exports.m=F;exports.mt=Rc;exports.n=Kc;exports.o=Vc;exports.o$1=wc;exports.prettyParse=Pn;exports.py=xo;exports.r=bc;exports.render=Wo;exports.specZ=Me;exports.specZ$1=Ko;exports.state=gl;exports.themeZ=Ui;exports.use=Nm;exports.useAggregate=Im;exports.useOptionalAggregate=Am;exports.usePassthrough=Mi;exports.usePurePassthrough=Di;exports.variantZ=Vo;exports.w=W;exports.w$1=ki;exports.wt=Mc;exports.yt=Yc;exports.zy=Mf;
|
package/dist/button.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./external-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./external-DZazAjmw.cjs");exports.Button=e.external;
|
package/dist/button.js
CHANGED
package/dist/color.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./external-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./external-BFMmnG8X.cjs");exports.Color=e.external;
|
package/dist/color.js
CHANGED
package/dist/dropdown.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./Toggle-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./Toggle-CICqV_L2.cjs");exports.Dropdown=e.Dropdown;
|
package/dist/dropdown.js
CHANGED
package/dist/ether.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./aggregator-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./aggregator-CYlhZeym.cjs"),n=require("./css-DY1Oedjj.cjs"),e=require("./LinePlot-Cgjyihyx.cjs"),l=Object.freeze(Object.defineProperty({__proto__:null,Provider:t.Provider,REGISTRY:t.REGISTRY,SYNNAX_DARK:t.SYNNAX_DARK,SYNNAX_LIGHT:t.SYNNAX_LIGHT,SYNNAX_THEMES:t.SYNNAX_THEMES,fontString:t.fontString,themeZ:t.themeZ,use:t.use},Symbol.toStringTag,{value:"Module"})),a=Object.freeze(Object.defineProperty({__proto__:null,Context:e.Context,Controller:e.Controller,Eraser:e.Eraser,GLProgram:e.GLProgram,Loop:e.Loop,REASON_DATA:e.REASON_DATA,REASON_LAYOUT:e.REASON_LAYOUT,REASON_TOOL:e.REASON_TOOL},Symbol.toStringTag,{value:"Module"})),i=()=>{const r=new t.l((R,S)=>postMessage(R,S));onmessage=r.handle.bind(r);const o={...e.REGISTRY,...e.REGISTRY$1,...e.REGISTRY$2,...e.REGISTRY$3,...e.REGISTRY$4,...e.REGISTRY$5,...e.REGISTRY$6,...e.REGISTRY$7,...e.REGISTRY$8,...e.REGISTRY$9,...e.REGISTRY$10,...e.REGISTRY$11,...t.REGISTRY$1,...e.REGISTRY$12,...e.REGISTRY$13,...t.REGISTRY,...e.REGISTRY$14,...e.REGISTRY$15,...e.REGISTRY$16};t.render({worker:r.route("vis"),registry:o})},T=Object.freeze(Object.defineProperty({__proto__:null,render:i},Symbol.toStringTag,{value:"Module"})),s=Object.freeze(Object.defineProperty({__proto__:null,LinePlot:e.LinePlot,REGISTRY:e.REGISTRY$7,XAxis:e.XAxis,YAxis:e.YAxis,linePlotStateZ:e.linePlotStateZ,xAxisStateZ:e.xAxisStateZ,yAxisStateZ:e.yAxisStateZ},Symbol.toStringTag,{value:"Module"}));exports.aether=t.aether;exports.color=n.color;exports.canvas=e.canvas;exports.diagram=e.Diagram;exports.measure=e.measure;exports.rule=e.aether;exports.synnax=e.provider;exports.telem=e.external;exports.tooltip=e.tooltip;exports.value=e.value;exports.lineplot=s;exports.pluto=T;exports.render=a;exports.theming=l;
|
package/dist/ether.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { P as R, R as a, S as n, a as S, b as l, f as T, t as E, u as i, l as Y, c as G, r as $ } from "./aggregator-
|
|
2
|
-
import { d as ae } from "./aggregator-
|
|
1
|
+
import { P as R, R as a, S as n, a as S, b as l, f as T, t as E, u as i, l as Y, c as G, r as $ } from "./aggregator-BTr6vhAN.js";
|
|
2
|
+
import { d as ae } from "./aggregator-BTr6vhAN.js";
|
|
3
3
|
import { d as te } from "./css-DEMSADUS.js";
|
|
4
|
-
import { C as I, a as _, E as c, G as p, L as u, R as d, b as m, c as f, d as g, e as b, f as x, g as A, h as O, i as y, j, k as s, l as v, m as N, n as P, o as L, p as h, q as M, r as z, s as X, t as w, B as C, X as Z, Y as D, F as H, H as k, I as q } from "./LinePlot-
|
|
5
|
-
import { w as re, D as Re, y as ne, z as Se, u as le, v as Te, x as Ee, A as ie } from "./LinePlot-
|
|
4
|
+
import { C as I, a as _, E as c, G as p, L as u, R as d, b as m, c as f, d as g, e as b, f as x, g as A, h as O, i as y, j, k as s, l as v, m as N, n as P, o as L, p as h, q as M, r as z, s as X, t as w, B as C, X as Z, Y as D, F as H, H as k, I as q } from "./LinePlot-DYkTuZP2.js";
|
|
5
|
+
import { w as re, D as Re, y as ne, z as Se, u as le, v as Te, x as Ee, A as ie } from "./LinePlot-DYkTuZP2.js";
|
|
6
6
|
const U = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
7
7
|
__proto__: null,
|
|
8
8
|
Provider: R,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const s=require("./Toggle-
|
|
1
|
+
"use strict";const s=require("./Toggle-CICqV_L2.cjs"),n=require("./jsx-runtime-Cek9Ww4S.cjs"),o=require("./aggregator-CYlhZeym.cjs"),R=require("react"),l=require("./css-DY1Oedjj.cjs"),p=require("./Pack-BM_LmeO7.cjs"),D=({value:t,onChange:r,onBlur:e,...a})=>{const g=new o.m(t,"UTC"),[m,S]=R.useState(g.fString("ISO","local").slice(0,-1)),[d,x]=R.useState(!0),j=u=>{let c=u.toString();S(c);let i=new o.m(u,"UTC");c.length<23&&(c+=".000"),i=i.add(BigInt(o.m.now().date().getTimezoneOffset()-i.date().getTimezoneOffset())*o.w.MINUTE.valueOf());let C=!1;try{C=i.fString("ISO","local").slice(0,-1)===c}catch{console.error("e")}if(!C){x(!1);return}r(Number(i.valueOf())),x(!0)},f=u=>{x(!0),S(new o.m(t,"UTC").fString("ISO","local").slice(0,-1)),e==null||e(u)};return n.jsxRuntimeExports.jsx(s.Text$1,{type:"datetime-local",onBlur:f,required:!1,value:d?new o.m(t,"UTC").fString("ISO","local").slice(0,-1):m,onChange:j,...a})},T=({className:t,variant:r="error",...e})=>n.jsxRuntimeExports.jsx(s.Text,{className:l.CSS(l.CSS.B("input-help-text"),l.CSS.BM("input-help-text",r),t),level:"small",...e}),E=({className:t,required:r=!1,children:e,...a})=>n.jsxRuntimeExports.jsxs("label",{className:l.CSS(l.CSS.B("input-label"),t),...a,children:[e," ",r&&n.jsxRuntimeExports.jsx("span",{className:l.CSS.B("required-indicator"),children:"*"})]}),O=(t,r="x")=>t??(l.g.construct(r)==="y"?"stretch":"center"),h=({label:t,showLabel:r=!0,helpText:e,direction:a="y",className:g,children:m,required:S,align:d,size:x="small",padHelpText:j=!1,helpTextVariant:f,showHelpText:u=!0,...c})=>{let i;return u===!1&&r===!1?n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{children:m}):(a==="x"?i=n.jsxRuntimeExports.jsxs(p.Space,{direction:"y",size:"small",children:[m,(j||e!=null&&e.length>0)&&n.jsxRuntimeExports.jsx(T,{variant:f,children:e})]}):i=n.jsxRuntimeExports.jsxs(p.Space,{direction:"y",size:1/3,children:[m,(j||e!=null&&e.length>0)&&n.jsxRuntimeExports.jsx(T,{variant:f,children:e})]}),n.jsxRuntimeExports.jsxs(p.Space,{className:l.CSS(l.CSS.B("input-item"),g),direction:a,size:x,align:O(d,a),...c,children:[r&&n.jsxRuntimeExports.jsx(E,{required:S,children:t}),i]}))},b=Object.freeze(Object.defineProperty({__proto__:null,Date:s.Date,DateTime:D,DragButton:s.DragButton,HelpText:T,Item:h,Label:E,Numeric:s.Numeric,Switch:s.Switch$1,Text:s.Text$1,TextArea:s.TextArea,Time:s.Time,combineDateAndTimeValue:s.combineDateAndTimeValue,useDate:s.useDate,useTime:s.useTime},Symbol.toStringTag,{value:"Module"}));exports.Item=h;exports.external=b;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("./css-DY1Oedjj.cjs"),l=require("./jsx-runtime-Cek9Ww4S.cjs"),r=require("./Toggle-
|
|
1
|
+
"use strict";const e=require("./css-DY1Oedjj.cjs"),l=require("./jsx-runtime-Cek9Ww4S.cjs"),r=require("./Toggle-CICqV_L2.cjs"),b=require("react");require("./aggregator-CYlhZeym.cjs");require("./Pack-BM_LmeO7.cjs");const d=({value:o,onChange:t,...u})=>{const i=s=>{s.hex==="transparent"&&t(e.ZERO),t(new e.Color(s.hex,s.rgb.a))};return l.jsxRuntimeExports.jsx(r.SketchPicker,{className:e.CSS.B("color-picker"),color:new e.Color(o).hex,onChange:i,presetColors:[],...u})},x="color",g=({value:o,onChange:t,className:u,size:i="medium",onVisibleChange:s,initialVisible:m,draggable:h=!0,...j})=>{const{visible:k,open:y,close:C}=r.use$1({onVisibleChange:s,initialVisible:m}),f=r.use().colors.gray.l0,c=new e.Color(o),w=r.useDraggingState(),S=b.useCallback(({items:a})=>{const[n]=r.filterByType(x,a);return n!=null&&n.key!==c.hex},[c.hex]),{startDrag:R,...E}=r.useDragAndDrop({type:"Color.Swatch",onDrop:({items:a})=>{const n=r.filterByType(x,a);return a.length>0&&(t==null||t(new e.Color(n[0].key))),n},canDrop:S}),p=l.jsxRuntimeExports.jsx(r.Button,{className:e.CSS(e.CSS.B("color-swatch"),e.CSS.size(i),c.contrast(f)>1.5&&c.a>.5&&e.CSS.M("no-border"),e.CSS.dropRegion(S(w)),u),draggable:h,onDragStart:()=>R([{type:x,key:c.hex}]),style:{backgroundColor:e.cssString(o)},variant:"text",onClick:y,size:i,tooltip:t!=null?l.jsxRuntimeExports.jsx(r.Text,{level:"small",children:"Click to change color"}):void 0,...E,...j});return t==null?p:l.jsxRuntimeExports.jsxs(r.Dialog,{close:C,visible:k,className:e.CSS.BE("color-swatch","dropdown"),keepMounted:!1,variant:"floating",children:[p,l.jsxRuntimeExports.jsx(d,{value:o,onChange:t})]})},D=Object.freeze(Object.defineProperty({__proto__:null,Color:e.Color,Picker:d,Swatch:g,ZERO:e.ZERO,crudeZ:e.crudeZ,cssString:e.cssString,fromHSLA:e.fromHSLA,toHex:e.toHex},Symbol.toStringTag,{value:"Module"}));exports.Swatch=g;exports.external=D;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { j as a } from "./jsx-runtime-B6kdoens.js";
|
|
2
|
-
import { A as u, g as d } from "./aggregator-
|
|
2
|
+
import { A as u, g as d } from "./aggregator-BTr6vhAN.js";
|
|
3
3
|
import { createContext as v, useContext as j, isValidElement as f, Fragment as h } from "react";
|
|
4
4
|
import { S as m } from "./Pack-E_3LSkGG.js";
|
|
5
|
-
import { I as B, p as C, B as S, W as b } from "./Toggle-
|
|
5
|
+
import { I as B, p as C, B as S, W as b } from "./Toggle-2UJtIoEe.js";
|
|
6
6
|
import { C as n } from "./css-DEMSADUS.js";
|
|
7
7
|
const x = v({
|
|
8
8
|
divided: !1,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as e, a as t, b as a, t as r } from "./aggregator-
|
|
2
|
-
import { P as s, S as o, t as S, u, a as i, b as n, c as m } from "./Toggle-
|
|
1
|
+
import { S as e, a as t, b as a, t as r } from "./aggregator-BTr6vhAN.js";
|
|
2
|
+
import { P as s, S as o, t as S, u, a as i, b as n, c as m } from "./Toggle-2UJtIoEe.js";
|
|
3
3
|
const p = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4
4
|
__proto__: null,
|
|
5
5
|
Provider: s,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { j as o } from "./jsx-runtime-B6kdoens.js";
|
|
2
|
-
import { y as M, I as T, k as _, W as S, e as L, Q as O } from "./Toggle-
|
|
2
|
+
import { y as M, I as T, k as _, W as S, e as L, Q as O } from "./Toggle-2UJtIoEe.js";
|
|
3
3
|
import { createContext as R, useCallback as v, useContext as Z } from "react";
|
|
4
4
|
import { S as P, P as z } from "./Pack-E_3LSkGG.js";
|
|
5
5
|
import { C as c, g as A } from "./css-DEMSADUS.js";
|
|
6
|
-
import { j as Q, C as q } from "./aggregator-
|
|
6
|
+
import { j as Q, C as q } from "./aggregator-BTr6vhAN.js";
|
|
7
7
|
import { z as p } from "zod";
|
|
8
8
|
const F = (l = "", s = []) => {
|
|
9
9
|
var n;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ak as O, e as b, al as C, am as N, an as v, ao as w, ap as D, aq as z, ar as B, as as U, at as V } from "./Toggle-
|
|
1
|
+
import { ak as O, e as b, al as C, am as N, an as v, ao as w, ap as D, aq as z, ar as B, as as U, at as V } from "./Toggle-2UJtIoEe.js";
|
|
2
2
|
import { j as a } from "./jsx-runtime-B6kdoens.js";
|
|
3
|
-
import { m as u, w as _ } from "./aggregator-
|
|
3
|
+
import { m as u, w as _ } from "./aggregator-BTr6vhAN.js";
|
|
4
4
|
import { useState as I } from "react";
|
|
5
5
|
import { C as n, g as A } from "./css-DEMSADUS.js";
|
|
6
6
|
import { S as j } from "./Pack-E_3LSkGG.js";
|