@jointhedots/core 2.0.22 → 2.0.24

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.
@@ -1 +1 @@
1
- import{A as d,Q as p,x as u}from"./chunk.H26D4GQC.js";var y=(i=>(i[i.Default=0]="Default",i[i.Reset=1]="Reset",i[i.Temporary=2]="Temporary",i))(y||{}),l=class{constructor(e){this.name=e;this.key=`settings://${this.name}`;try{let t=localStorage.getItem(this.key);this.restore(JSON.parse(t).stores)}catch{}try{window.addEventListener("storage",t=>{let{key:i,newValue:s}=t;if(i===this.key)try{this.restore(JSON.parse(s).stores)}catch{}})}catch(t){console.error(t.message)}}key=null;stores=S();temporaries=S();settings=S();get(e,t){let i=this.settings[e][t];if(!i){let s=this.temporaries[e][t]||this.stores[e][t];s&&(i=JSON.parse(s),this.settings[e][t]=i)}return i}set(e,t,i,s=0){let n=JSON.stringify(i);return this.write(e,t,n,s)?(this.settings[e][t]=i,m(this,e,t),!0):!1}list(e){return Object.keys(this.temporaries[e]).length>0?Object.keys(Object.assign({},this.stores[e],this.temporaries[e])):Object.keys(this.stores[e])}read(e){return this.stores[e]}write(e,t,i,s){if(s!==1&&this.temporaries[e][t]!==void 0&&(s=2),s===2){if(this.temporaries[e][t]!==i)return this.temporaries[e][t]=i,this.settings[e][t]=null,!0}else if(this.stores[e][t]!==i)return this.stores[e][t]=i,this.settings[e][t]=null,s===0&&localStorage.setItem(this.key,JSON.stringify({stores:this.stores})),!0;return!1}restore(e){for(let t in e)for(let i in e[t])this.write(t,i,e[t][i],1)&&m(this,t,i)}},h=new Set,P=new l("default");function c(){return P}function I(r){return h.add(r),r}function b(r){h.delete(r)}function m(r,e,t){if(r===P&&r.settings[e][t]!==void 0)for(let i of h)i(e,t)}function S(){return{service_points:{},components:{},shareds:{}}}var a=new Map,g=new Set,v=class{constructor(e){this.descriptor=e;let[t,i]=e.id.split("/");this.service=t,this.name=i}service="";name="";services=[];loading=null;ready=!1;failure=null;get id(){return this.descriptor.id}get multiple(){return this.descriptor?.properties?.multiple||!1}async fetch(){return this.ready?this.services:(this.loading||(this.loading=new Promise(async e=>{let{descriptor:t}=this,{providers:i}=this.descriptor,s=await x(i,this.service,this.id,this);t===this.descriptor?(this.services=s,this.ready=!0,this.loading=null,e(this.services)):e(this.fetch())})),this.loading)}async reset(e){return this.descriptor!==e&&(this.descriptor=e,(this.loading||this.ready||this.failure)&&(this.failure=null,this.loading=null,this.ready=!1,g.forEach(t=>t(this)),await this.fetch()),g.forEach(t=>t(this))),this}override(e){let t=c(),i=t.get("service_points",this.id);t.set("service_points",this.id,{...i,providers:e},2)}notifyError(e){this.failure=e,p.error(e)}notifyObject(e){p.send(e)}};function G(r){return g.add(r),r}function H(r){g.delete(r)}u.listen(r=>{for(let e of a.values())e.descriptor.providers?.includes(r.id)&&g.forEach(t=>t(e))});async function x(r,e,t,i){let s=[];if(Array.isArray(r)&&r.length>0)for(let n of r){let o=d(n);if(await o.fetch()){let f=await o.acquireResource(e).fetch();f?s.push(f):i.notifyError(new Error(`ServicePoint '${t}': component '${n}' not implement service '${e}'`))}else i.notifyError(new Error(`ServicePoint '${t}': component '${n}' not found`))}return s}function C(r){let t=c().get("service_points",r);return t||(t={id:r,providers:[],properties:{}}),t}function w(r,e){let t=c(),i=t.get("service_points",r);if(i){let s=!1;for(let n in e){let o=e[n];o!==void 0&&i[n]!=o&&(i[n]=o,s=!0)}s&&t.set("service_points",r,i)}else i={id:r,providers:[],properties:e},t.set("service_points",r,i);return i}I((r,e)=>{if(r==="service_points"){let t=a.get(e);if(t){let i=c().get("service_points",e);t.reset(i),console.log("[Update Service Point]",e)}}});function L(r){return a.get(r)}function D(r){let e=a.get(r);return e||(e=new v(C(r)),a.set(e.id,e)),e}function j(r,e,t){let i=r.resource+"/"+e;return w(i,t),D(i)}export{y as a,l as b,c,I as d,b as e,a as f,v as g,G as h,H as i,C as j,w as k,L as l,D as m,j as n};
1
+ import{A as d,Q as p,x as u}from"./chunk.UGWDPVMV.js";var y=(i=>(i[i.Default=0]="Default",i[i.Reset=1]="Reset",i[i.Temporary=2]="Temporary",i))(y||{}),l=class{constructor(e){this.name=e;this.key=`settings://${this.name}`;try{let t=localStorage.getItem(this.key);this.restore(JSON.parse(t).stores)}catch{}try{window.addEventListener("storage",t=>{let{key:i,newValue:s}=t;if(i===this.key)try{this.restore(JSON.parse(s).stores)}catch{}})}catch(t){console.error(t.message)}}key=null;stores=S();temporaries=S();settings=S();get(e,t){let i=this.settings[e][t];if(!i){let s=this.temporaries[e][t]||this.stores[e][t];s&&(i=JSON.parse(s),this.settings[e][t]=i)}return i}set(e,t,i,s=0){let n=JSON.stringify(i);return this.write(e,t,n,s)?(this.settings[e][t]=i,m(this,e,t),!0):!1}list(e){return Object.keys(this.temporaries[e]).length>0?Object.keys(Object.assign({},this.stores[e],this.temporaries[e])):Object.keys(this.stores[e])}read(e){return this.stores[e]}write(e,t,i,s){if(s!==1&&this.temporaries[e][t]!==void 0&&(s=2),s===2){if(this.temporaries[e][t]!==i)return this.temporaries[e][t]=i,this.settings[e][t]=null,!0}else if(this.stores[e][t]!==i)return this.stores[e][t]=i,this.settings[e][t]=null,s===0&&localStorage.setItem(this.key,JSON.stringify({stores:this.stores})),!0;return!1}restore(e){for(let t in e)for(let i in e[t])this.write(t,i,e[t][i],1)&&m(this,t,i)}},h=new Set,P=new l("default");function c(){return P}function I(r){return h.add(r),r}function b(r){h.delete(r)}function m(r,e,t){if(r===P&&r.settings[e][t]!==void 0)for(let i of h)i(e,t)}function S(){return{service_points:{},components:{},shareds:{}}}var a=new Map,g=new Set,v=class{constructor(e){this.descriptor=e;let[t,i]=e.id.split("/");this.service=t,this.name=i}service="";name="";services=[];loading=null;ready=!1;failure=null;get id(){return this.descriptor.id}get multiple(){return this.descriptor?.properties?.multiple||!1}async fetch(){return this.ready?this.services:(this.loading||(this.loading=new Promise(async e=>{let{descriptor:t}=this,{providers:i}=this.descriptor,s=await x(i,this.service,this.id,this);t===this.descriptor?(this.services=s,this.ready=!0,this.loading=null,e(this.services)):e(this.fetch())})),this.loading)}async reset(e){return this.descriptor!==e&&(this.descriptor=e,(this.loading||this.ready||this.failure)&&(this.failure=null,this.loading=null,this.ready=!1,g.forEach(t=>t(this)),await this.fetch()),g.forEach(t=>t(this))),this}override(e){let t=c(),i=t.get("service_points",this.id);t.set("service_points",this.id,{...i,providers:e},2)}notifyError(e){this.failure=e,p.error(e)}notifyObject(e){p.send(e)}};function G(r){return g.add(r),r}function H(r){g.delete(r)}u.listen(r=>{for(let e of a.values())e.descriptor.providers?.includes(r.id)&&g.forEach(t=>t(e))});async function x(r,e,t,i){let s=[];if(Array.isArray(r)&&r.length>0)for(let n of r){let o=d(n);if(await o.fetch()){let f=await o.acquireResource(e).fetch();f?s.push(f):i.notifyError(new Error(`ServicePoint '${t}': component '${n}' not implement service '${e}'`))}else i.notifyError(new Error(`ServicePoint '${t}': component '${n}' not found`))}return s}function C(r){let t=c().get("service_points",r);return t||(t={id:r,providers:[],properties:{}}),t}function w(r,e){let t=c(),i=t.get("service_points",r);if(i){let s=!1;for(let n in e){let o=e[n];o!==void 0&&i[n]!=o&&(i[n]=o,s=!0)}s&&t.set("service_points",r,i)}else i={id:r,providers:[],properties:e},t.set("service_points",r,i);return i}I((r,e)=>{if(r==="service_points"){let t=a.get(e);if(t){let i=c().get("service_points",e);t.reset(i),console.log("[Update Service Point]",e)}}});function L(r){return a.get(r)}function D(r){let e=a.get(r);return e||(e=new v(C(r)),a.set(e.id,e)),e}function j(r,e,t){let i=r.resource+"/"+e;return w(i,t),D(i)}export{y as a,l as b,c,I as d,b as e,a as f,v as g,G as h,H as i,C as j,w as k,L as l,D as m,j as n};
@@ -0,0 +1 @@
1
+ import{A as h,C as V,a as w}from"./chunk.UGWDPVMV.js";var S={stringify(n,r){let e=new URLSearchParams;for(let[t,o]of Object.entries(n||{}))if(!(r?.skipNull&&o===null)&&!(r?.skipEmptyString&&o===""))if(Array.isArray(o))for(let s of o)e.append(t,String(s));else e.set(t,String(o));return e.toString()},parse(n,r){let e={},t=new URLSearchParams(n);for(let[o,s]of t.entries())e[o]=s;return e}},I=w.About("view");function g(n){if(!n)return"";if(n instanceof Object){let r=[];for(;n;){let e=S.stringify(n.params,{skipNull:!1,skipEmptyString:!1});e?r.push(`${n.name}?${e}`):r.push(n.name),n=n.nested}return r.join("/")}return n.startsWith("#")?n.slice(1):n}function a(n,r){if(!n)return null;if(n instanceof Object)return n;let e=null,t=null;n=n.startsWith("#")?n.slice(1):n;for(let o of n.split("/"))if(o){let[s,u]=o.split("?"),c={};u&&(c=S.parse(u,{parseNumbers:!1,parseBooleans:!1}));let f={name:s,params:c};t?t.nested=f:e=f,t=f}return t&&(t.content=r),e}function R(n,r){if(n==="safe")return null;if(n){let e=typeof n=="string"?n:n?.rule,t=V(e).get();if(t)try{return t.check(r,n instanceof Object?n:null)}catch(o){return o}else return new Error("Data security guard not found")}else return new Error("Data cannot be securised")}function k(n,r,e){if(r!==void 0){if(e!==!0){let t=R(n?.security,r);if(t)throw t}return r}else return n.default}function d(n,r,e,t){let o={},s=I.spec(n),u=t==="safe",c=s?.properties;if(c instanceof Object){let{content:f}=e,l=e.params||{},y=s.aliases;if(y){let i={};for(let p in l){let m=y?.[p]||p;i[m]=l[p]}l=i}for(let i in c){let p=c[i],m=l[i];f!==void 0&&p?.binding?.source==="content"&&(m=f);try{o[i]=k(p,m,u)}catch(b){throw new Error(`Invalid param '${i}' : ${b.message}`)}}}return o}async function N(n,r){typeof n=="string"&&(n=a(n));let e=h(n.name),t=await e.fetch();if(e.valid){let o=d(e,t,n,r||"unknown");return{component:e,properties:o}}else throw new Error(`Component '${e.id}' is invalid`)}function O(n,r){let{origin:e,pathname:t}=window.location;typeof n=="string"&&(n=a(n)),r&&(typeof r=="string"&&(r=a(e)),n={...r,nested:n});let o="#"+g(n);return`${e}${t}${o}`}function $(n,r){let{origin:e}=window.location;typeof n=="string"&&(n=a(n)),r&&(typeof r=="string"&&(r=a(e)),n={...r,nested:n});let t="#"+g(n);window.location.assign(t)}function C(n){typeof n=="string"&&(n=a(n));let r=a(window.location.hash),e="#"+g({...n,params:{...r.params,...n.params}});window.location.replace(e)}export{I as a,g as b,a as c,N as d,O as e,$ as f,C as g};
@@ -0,0 +1 @@
1
+ import{URI as q}from"vscode-uri";import{URI as me,Utils as ue}from"vscode-uri";var l=class t{constructor(e,n){this.resource=e;this.definition=n}get(e){return e.getResource(this.resource)?.get()}fetch(e){return e.fetchResource(this.resource)}spec(e){return e.acquireResource(this.resource)?.spec}subservice(e){return t.About(`${this.resource}.${e}`)}static About(e,n=null){return new t(e,n)}};var L=l.About("component"),_e=l.About("editor");var P={object:{async read(t){let e=await t.text();return JSON.parse(e)},async write(t){let e=JSON.stringify(t);return new Blob([e],{type:"application/json"})}},text:{async read(t){return t.text()},async write(t){return new Blob([t],{type:"text/plain"})}}};function O(t){let[e,n]=t.split(","),o=e.match(/data:([^;]+)/),r=o?o[1]:"application/octet-stream",s=atob(n),i=new Uint8Array(s.length);for(let c=0;c<s.length;c++)i[c]=s.charCodeAt(c);return new Blob([i],{type:r})}function U(t){let e=t.match(/data:([^;]+)/);return e?e[1]:"application/octet-stream"}async function B(t){return new Promise((e,n)=>{let o=new FileReader;o.onloadend=()=>e(o.result),o.onerror=n,o.readAsDataURL(t)})}import{URI as D}from"vscode-uri";function v(t){if(t.startsWith("./")){let e=D.parse(window.location.href),n=e.path.split("/");return n[n.length-1]=t.slice(2),e.with({path:n.join("/"),query:"",fragment:""})}else return t.startsWith("/")?D.parse(window.location.href).with({path:t,query:"",fragment:""}):D.parse(t)}async function z(t){let e=t.services?Object.keys(t.services):[];if(t.type){let n=await u(t.type)?.fetch();if(n){for(let o in n?.services)if(o.startsWith("component.")){let r=o.slice(10);e.includes(r)||e.push(r)}}else throw new Error("Cannot create publiction properly")}return e}async function w(t){let{$id:e}=t;return{id:e,type:t.type,icon:t.icon,title:t.title||e,description:t.description||"",keywords:t.keywords,tags:t.tags,services:await z(t)}}function we(t){let e={query:t?.query||"",pattern:t?.pattern||null,tags:t?.tags||[],keywords:t?.keywords||[],services:t?.services||[],types:t?.types||[]};if(e.query.length>0)for(let n of e.query.split(/\s/))n.length>0&&!e.keywords.includes(n)&&e.keywords.push(n);return e.keywords.length>0&&(e.pattern=new RegExp(`(${e.keywords.join(").*(")})`)),e}function h(t,e){function n(s,i){return i?s?!i||i.test(s):!1:!0}function o(s,i){return!!(i.length===0||s&&i.includes(s))}function r(s,i){if(i.length===0)return!0;if(s){for(let c of s)if(i.includes(c))return!0}return!1}return!(!n(t.title||t.id,e.pattern)&&!n(t.description,e.pattern)||!r(t.services,e.services)||!r(t.keywords,e.keywords)||!r(t.tags,e.tags)||!o(t.type,e.types))}function F(t){if(typeof t=="string"){let[e,n]=t.split("#",2),o={type:"module",location:e};if(n){let[r,s]=n.split("?",2);if(o.identifier=r,s)for(let i of s.split("&")){let[c,p]=i.split("=");o[c]=p===void 0?!0:p}}return o}return t}var x=class{constructor(e){this.storage=e}modules_exports=new Map;baseUrl=X(import.meta.url);async load_resource(e){if(this.modules_exports.has(e))return this.modules_exports.get(e);let n=v(e);switch(await this.storage.check_content(n)){case"application/json":case"text/json":return this.import_module_json(e,n);default:return this.import_module_esm(e,n)}}async import_module_json(e,n){let o=await this.storage.load_content(n);return P.object.read(o)}async import_module_esm(e,n){let o=n.toString();try{let r=await import(o);return this.modules_exports.set(e,r),r}catch(r){throw r.message=`Cannot import '${o}': ${r.message}`,r}}};function X(t){let e=t.split("/");return e.pop(),e.join("/")}import{URI as Y}from"vscode-uri";var I=class{async check_url_content(e){let n=await fetch(e,{method:"HEAD"});if(n.ok){let o=n.headers.get("content-type");return o?o.split(";")[0].trim():"application/octet-stream"}return null}async load_url_content(e){let n=await fetch(e);if(n.ok)return n.blob();throw new Error(`Fetch failed ${n.statusText} ${n.status} '${e}'`)}async check_content(e){if(e.scheme==="local"){let n=e.toString(),o=localStorage.getItem(n);if(o)return U(o);throw new Error(`Unsupported local content uri: ${e}`)}else return this.check_url_content(e.toString())}async load_content(e){if(e.scheme==="local"){let n=e.toString();if(localStorage.getItem(n))return O(localStorage.getItem(n));throw new Error(`Unsupported local content uri: ${e}`)}else return this.load_url_content(e.toString())}async store_content(e,n){if(n.scheme==="local"){let o=n.toString(),r=await B(e);return localStorage.setItem(o,r),!0}return!1}};function je(t,e,n){let o=n?`/${e}/${n}`:`/${e}`;return Y.from({scheme:"local",authority:t,path:o})}var _=class{pubs=new Map;constructor(e=[]){for(let n of e)this.pubs.set(n.id,n)}async get_component_publication(e){return this.pubs.get(e)}async search_component_publications(e){let n=[];for(let o of this.pubs.values())h(o,e)&&n.push(o);return n}},S=class extends _{manifests=new Map;async add_component(e){let n=await w(e);return this.manifests.set(n.id,e),this.pubs.set(n.id,n),n}async delete_component(e){return this.manifests.delete(e),this.pubs.delete(e),!0}async get_component_manifest(e){return this.manifests.get(e)}async set_component_manifest(e,n){return!1}};var R=class{constructor(e){this.content_provider=e}manifest=null;catalog=null;async get_provider_bundle(){return this.manifest||(this.manifest=await(await fetch("./bundle.manifest.json")).json()),this.manifest}async get_component_catalog(){if(!this.catalog){let e=await this.get_provider_bundle();this.catalog=new _(e.data?.components)}return this.catalog}async get_component_publication(e){return(await this.get_component_catalog()).get_component_publication(e)}async search_component_publications(e){return(await this.get_component_catalog()).search_component_publications(e)}async get_component_manifest(e){try{let o=(await this.get_provider_bundle()).data.components.find(r=>r.id===e);if(o){let r=v(o.ref?`./${o.ref}`:`./${e}.json`),s=await this.content_provider.load_content(r);if(s)return P.object.read(s)}}catch{}return null}async set_component_manifest(e,n){return!1}async add_component(e){return null}async delete_component(e){return!1}};var M=class{constructor(e=[]){this.providers=e}add_provider(e){this.providers.push(e)}async get_component_publication(e){for(let n of this.providers){let o=await n.get_component_publication(e);if(o)return o}return null}async search_component_publications(e){let n=[];for(let o of this.providers){let r=await o.search_component_publications(e);r&&n.push(...r)}return n}async get_component_manifest(e){for(let n of this.providers){let o=await n.get_component_manifest(e);if(o)return o}return null}async set_component_manifest(e,n){for(let o of this.providers)if(await o.set_component_manifest(e,n))return!0;return!1}async add_component(e){for(let n of this.providers){let o=await n.add_component(e);if(o)return o}return null}async delete_component(e){for(let n of this.providers)if(await n.delete_component(e))return!0;return!1}};var A=5;function Z(){return new Promise((t,e)=>{let n=window.indexedDB.open("LocalComponents",A);n.onerror=o=>{console.error("Database error:",o.target.error),e(o.target.error)},n.onupgradeneeded=()=>{console.log("Upgrade LocalComponents to ",A);debugger;let o=n.result;o.objectStoreNames.contains("components_manifests")&&o.deleteObjectStore("components_manifests"),o.objectStoreNames.contains("components_services")&&o.deleteObjectStore("components_services"),o.objectStoreNames.contains("components")&&o.deleteObjectStore("components"),o.createObjectStore("components",{keyPath:"id"}).createIndex("title","title",{unique:!1});let s=o.createObjectStore("components_services",{keyPath:["component_id","service"]});s.createIndex("component_id","component_id",{unique:!1}),s.createIndex("service","service",{unique:!1}),o.createObjectStore("components_manifests",{keyPath:"component_id"}).createIndex("component_id","component_id",{unique:!1})},n.onsuccess=()=>{let o=n.result;o.onerror=r=>{console.error("Database error:",r)},t(n.result)}})}function ee(t,e){return new Promise((n,o)=>{let r=[],c=t.transaction(["components_manifests"],"readonly").objectStore("components_manifests").getAll(e);c.onsuccess=()=>{n(c.result?.[0]?.manifest)},c.onerror=p=>{o(p.target.error)}})}function te(t,e){let o=t.transaction(["components","components_services"],"readonly").objectStore("components");return new Promise((r,s)=>{let i=o.get(e);i.onsuccess=()=>{r(i.result)},i.onerror=c=>{s(c.target.error)}})}function N(t,e){let o=t.transaction(["components","components_services"],"readonly").objectStore("components"),r=[];for(let s of e)r.push(new Promise((i,c)=>{let p=o.get(s);p.onsuccess=()=>{i(p.result)},p.onerror=m=>{c(m.target.error)}}));return Promise.all(r)}function ne(t,e){return new Promise((n,o)=>{let i=t.transaction(["components"],"readonly").objectStore("components").openCursor(),c=[];i.onsuccess=()=>{let p=i.result;if(p){let m=p.value;e(m)&&c.push(p.value),p.continue()}else n(c)},i.onerror=()=>{o(i.error)}})}function oe(t,e,n){let s=t.transaction(["components_services"],"readonly").objectStore("components_services").index("service"),i=[];for(let c of e)i.push(new Promise((p,m)=>{let d=s.getAll(c);d.onsuccess=async()=>{for(let b of d.result)b.service===c&&n.add(b.component_id);p(void 0)},d.onerror=b=>{m(b.target.error)}}));return Promise.all(i)}async function re(t,e){let{services:n}=e;if(n&&n.length>0){let o=[],r=new Set;await oe(t,n,r);for(let s of await N(t,Array.from(r)))h(s,e)&&o.push(s);return o}else return ne(t,o=>h(o,e))}function se(t,e){return new Promise(async(n,o)=>{let r=await w(e),s=t.transaction(["components","components_services","components_manifests"],"readwrite");s.objectStore("components").put(r);let c=s.objectStore("components_services");for(let m of r.services)c.put({component_id:r.id,service:m});s.objectStore("components_manifests").put({component_id:r.id,manifest:e}),s.onerror=m=>o(m.target.error),s.oncomplete=()=>n(r),s.commit()})}function ie(t,e){return new Promise(async(n,o)=>{let r=await te(t,e);if(r){let s=t.transaction(["components","components_services","components_manifests"],"readwrite");s.objectStore("components").delete(e);let c=s.objectStore("components_services");for(let m of r.services)c.delete([e,m]);s.objectStore("components_manifests").delete(e),s.onerror=m=>o(m.target.error),s.oncomplete=()=>n(!0),s.commit()}else n(!1)})}var T=class{db=Z();async get_component_publication(e){return(await N(await this.db,[e]))[0]}async search_component_publications(e){return re(await this.db,e)}async get_component_manifest(e){return ee(await this.db,e)}async set_component_manifest(e,n){return!1}async add_component(e){return se(await this.db,e)}async delete_component(e){return ie(await this.db,e)}};function J(){try{if(window)return new T}catch{}return new S}var $=class{notifyError(e,n){console.error(e),this.notifyObject(pe(e,n))}notifyObject(e){f.push(e),console.log(e)}},E=new Set,f=[],K=0,ce=new $;ae(ce);function W(){return K++,"id-"+Date.now().toString(36)+"-"+K.toString(2)}function ae(t){E.add(t)}function Je(t){E.delete(t)}function Ke(){return f.length}function Q(t,e){let n=[];for(let o of f)if(e===void 0||e===o.component_id){if(n.length>=t)return{objects:n,hasMore:!0};n.push(o)}return{objects:n,hasMore:!1}}function G(t){return f.reduce((e,n)=>{if(t===void 0||t===n.component_id)switch(n.status){case"error":e.error_count++,e.warn_count++,e.notify_count++,e.info_count++;break;case"warn":e.warn_count++,e.notify_count++,e.info_count++;break;case"notify":e.notify_count++,e.info_count++;break;case"info":e.info_count++;break}return e},{action_expected_count:0,error_count:0,warn_count:0,notify_count:0,info_count:0})}var y={send(t){setTimeout(()=>{for(let e of E)e.notifyObject(t)},0)},error(t,e){setTimeout(()=>{for(let n of E)n.notifyError(t,e)},0)},event(t,e){let n=g(t),o=W();y.send({...e,kind:"event",status:e.status||"error",message:e.message||`Issue with component: ${o}`,component_id:n.id,id:o})},openTicket(t,e,n){let o=g(t),r=`${o.id}/${e}`;y.send({...n,kind:"ticket",status:n.status||"error",message:n.message||`Issue with component: ${r}`,component_id:o.id,id:r})},closeTicket(t,e){let o=`${g(t).id}/${e}`,r=f.findIndex(s=>s.id===o);if(r>=0){let s=f[r];f.splice(r,1),y.event(t,{...s,kind:"event",status:"info",icon:"[success]bi:check-circle",message:`[closed] ${s.message}`,actions:void 0,doc_uri:void 0})}}};function pe(t,e){return{id:W(),kind:"event",status:"error",component_id:g(e).id,message:t.message}}var C=class{constructor(e){this.id=e}__instance__=void 0;manifest=void 0;get title(){return this.id}get namespace(){let e=this.id.indexOf(":");switch(e){case-1:return"std";case 0:return"";default:return this.id.slice(0,e)}}get valid(){return this.manifest!==void 0&&this.manifest.type!=="<error>"}get loaded(){return this.manifest!==void 0}get installed(){return this.__instance__!==void 0}get instance(){return this.__instance__}set instance(e){if(this.__instance__=e,e instanceof Object)a.datamap.set(e,this);else if(e!==null)throw this.__instance__=null,new Error("Component instance shall be an object")}get(){if(this.manifest===void 0)throw new Error("Cannot get manifest of not loaded module");return this.manifest}set(e){return this.manifest=e,this}fetch(){let e=a.loadings.get(this);return e||(this.manifest===void 0?e=a.components_provider.get_component_manifest(this.id).then(async n=>{if(n)n.type&&await u(n.type).fetch(),this.manifest=n;else throw new Error(`Component '${this.id}' not found`);return this.manifest}).catch(n=>(y.error(n,this),this.set({$id:this.id,type:"<error>",message:n.message,stack:n.stack}),this.__instance__=new Error(n.message),this.manifest)):e=Promise.resolve(this.manifest),a.loadings.set(this,e),e)}async install(){let e=a.installings.get(this);return e||(this.instance===void 0?(this.instance=null,e=new Promise(async n=>{try{this.loaded===!1&&await this.fetch();let o=this.manifest?.type;if(o){let r=u(o);await(await L.fetch(r)).createComponent(this,this.manifest)}}catch(o){y.error(o,this)}n(this)})):e=Promise.resolve(this),a.installings.set(this,e),e)}acquireResource(e){let n=`${this.id}#${e}`,o=a.resources.get(n);return o||(o=new j(this,e),a.resources.set(n,o)),o}getResource(e){return this.hasResource(e)?this.acquireResource(e):null}hasResource(e){let{manifest:n}=this;if(n?.services?.[e])return!0;if(n?.type){let o=u(n.type);if(o)return o?.hasResource(`component.${e}`)}return!1}async getResourceAsync(e){return this.manifest===void 0&&await this.fetch(),this.getResource(e)}async fetchResource(e){return this.manifest===void 0&&await this.fetch(),this.getResource(e)?.fetch()}getLogStats(){return G(this.id)}getLogs(e){return Q(e,this.id)}},j=class{constructor(e,n){this.component=e;this.resource=n;e.fetch()}entry=void 0;identifier=void 0;get valid(){return this.identifier!==void 0&&this.component.valid}get loaded(){return this.identifier!==void 0}async fetch(){if(this.identifier===void 0){let e=a.loadings.get(this);return e||(e=new Promise(async n=>{let{component:o}=this;try{o.installed===!1&&await o.install();let{manifest:r}=o,s=F(r.services?.[this.resource]),i=s?.type;if(i==="module")this.entry=await a.resources_loader.load_resource(s.location),this.identifier=s.identifier;else if(i==="api.rest")this.entry=V(s,o),this.identifier=null;else if(r.type){let m=u(r.type).getResource(`component.${this.resource}`);if(m){let d=await m.fetch();d?this.entry=await d(this.component):this.entry=null,this.identifier=null}else throw new Error(`Cannot provide resource '${this.resource}'`)}else throw new Error(`Cannot load resource '${this.resource}': ${JSON.stringify(s)}`);let c=this.get();c instanceof Object&&a.datamap.set(c,this)}catch(r){console.error(`Cannot install service '${this.resource}' of '${o.id}':`,r),this.entry=null,this.identifier=null}n(this.get()),a.loadings.set(this,null)}),a.loadings.set(this,e),e)}else return this.get()}get(){if(this.entry)return this.identifier!==null?this.entry?.[this.identifier]:this.entry}set(e){this.entry=e,this.identifier=null}get spec(){let e=this.resource.split(".")[0];return this.component.manifest?.specs?.[e]}get url(){let e=this.component.manifest?.services?.[this.resource];if(typeof e=="string"){let n=me.parse(window.location.href).with({fragment:null});return ue.joinPath(n,"..",e.split("#")[0]).toString()}return null}},k=class{components=new Map;resources=new Map;datamap=new WeakMap;loadings=new Map;installings=new Map;listeners=new Set;components_provider=new M([]);resources_loader=null;content_provider=null;constructor(){this.content_provider=new I,this.components_provider.add_provider(new R(this.content_provider)),this.components_provider.add_provider(J()),this.resources_loader=new x(this.content_provider)}listen(e){return this.listeners.add(e),e}unlisten(e){this.listeners.delete(e)}notifyError(e,n){}},a=new k;u("<error>").set({$id:"<error>",icon:"bi:house",title:"Define invalid component"});function le(){return u("log:application")}function g(t,e){if(t instanceof Object){let n=a.datamap.get(t)||t;if(n instanceof C)return n;if(n instanceof j)return n.component;if(!e&&t.getComponent instanceof Function)return g(t.getComponent(),!0)}return le()}function u(t){let e=a.components.get(t);return!e&&typeof t=="string"&&(e=new C(t),a.components.set(t,e)),e}function nt(t){let e=t.$id,n=a.components.get(e);return!n&&typeof e=="string"&&(n=new C(e),n.manifest=t,n.instance=null,a.components.set(e,n)),n}function ot(t){let e=t.split("#");return e.length===2?u(e[0])?.acquireResource(e[1]):null}function rt(t,e){return e&&t.startsWith("/")?u(`${e?.id}${t}`):null}async function st(t){let e=u(t.$id);return a.loadings.delete(e),e.manifest=t,fe(e)}async function fe(t){console.log("[Update Component]",t.id);let e=await t.fetch();if(await a.components_provider.add_component(e),t.loaded&&e.type&&t.installed){let o=await L.fetch(u(e.type));o&&(t.instance?await o.updateComponent(t,e):(t.__instance__=void 0,await o.createComponent(t,e))),t.instance instanceof Object&&a.datamap.set(t.instance,t),a.listeners.forEach(r=>r(t))}return t}async function it(t){console.log("deleteComponent",t),await a.components_provider.delete_component(t)&&de(t)}function de(t){let e=a.components.get(t);e&&(e.set({$id:e.id,type:"<error>",message:"Component deleted"}),a.listeners.forEach(n=>n(e)),a.components.delete(t))}async function ct(t){return a.components_provider.search_component_publications(t)}async function at(t){let e=[];for(let n of t){let o=await a.components_provider.get_component_publication(n);o?e.push(o):e.push(ge(n))}return e}function ge(t,e){return{id:t,title:e||"! Not found: "+t}}var H=l.About("api.rest");function V(t,e){let n=t.endpoint+(t.path||"");return{invoke(o,r){return globalThis.fetch(n+o,r)},getUrl(o){return n+o}}}var dt={async fetch(t,e){if(typeof t=="string"&&(t=q.parse(t)),t.scheme==="jtd"){let n=u(t.authority),o=await H.fetch(n);if(o){let r=t.query?`${t.path}?${t.query}`:t.path;return o.invoke(r,e)}else return Response.error()}else return fetch(t.toString(),e)},async getUri(t){if(typeof t=="string"&&(t=q.parse(t)),t.scheme==="jtd"){let e=u(t.authority),n=await H.fetch(e);if(n){let o=t.query?`${t.path}?${t.query}`:t.path;t=q.parse(n.getUrl(o))}else throw new Error(`Unknown component '${t.authority}'`)}return t}};export{l as a,L as b,_e as c,v as d,z as e,w as f,we as g,h,F as i,x as j,I as k,je as l,_ as m,S as n,R as o,M as p,J as q,H as r,V as s,dt as t,C as u,j as v,k as w,a as x,le as y,g as z,u as A,nt as B,ot as C,rt as D,st as E,fe as F,it as G,de as H,ct as I,at as J,ge as K,ae as L,Je as M,Ke as N,Q as O,G as P,y as Q,pe as R};
@@ -1 +1 @@
1
- import{A as o,Q as r}from"./chunk.H26D4GQC.js";import{URI as d}from"vscode-uri";async function l(t){console.log("executeCommand:",t.target);let a=d.parse(t.target),i=o(a.authority);if(a.scheme==="command")try{let e=await i.fetchResource("commands");if(e?.execute instanceof Function)e.execute(a.path,t.payload);else throw new Error("Invalid commands service")}catch(e){r.error(e)}}export{l as executeCommand};
1
+ import{A as o,Q as r}from"./chunk.UGWDPVMV.js";import{URI as d}from"vscode-uri";async function l(t){console.log("executeCommand:",t.target);let a=d.parse(t.target),i=o(a.authority);if(a.scheme==="command")try{let e=await i.fetchResource("commands");if(e?.execute instanceof Function)e.execute(a.path,t.payload);else throw new Error("Invalid commands service")}catch(e){r.error(e)}}export{l as executeCommand};
package/export.js CHANGED
@@ -1,2 +1,2 @@
1
- import{a as dn,b as wn,c as bn,d as xn,e as vn,f as Tn,g as En,h as kn,i as An,j as On,k as In,l as Nn,m as Pn,n as Cn}from"./chunk.LFHCE3KB.js";import{a as jn,b as zn,c as Jn,d as Ln,e as Vn,f as Dn,g as Fn,h as $n,i as Rn,j as Mn,k as Bn,l as _n,m as qn,n as Un}from"./chunk.3AAAY44Q.js";import{A as Xt,B as en,C as tn,D as nn,E as rn,F as on,G as an,H as sn,I as ln,J as un,K as pn,L as cn,M as fn,N as yn,O as mn,P as hn,Q as Sn,R as gn,a as Pt,b as Ct,c as jt,d as zt,e as Jt,f as Lt,g as Vt,h as Dt,i as Ft,j as $t,k as Rt,l as Mt,m as Bt,n as _t,o as qt,p as Ut,q as Gt,u as Kt,v as Yt,w as Wt,x as Ht,y as Zt,z as Qt}from"./chunk.H26D4GQC.js";function Gn(e,t){for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(e[n]!==t[n])return!1;return!0}function*Kn(e){if(Array.isArray(e))for(let t of e)yield t;else e&&(yield e)}var G=Symbol("__observable__"),K=Symbol("__status__");var O=class{observers;state;image;constructor(){this.observers=null,this.state={},this.image=new Proxy(this.state,this)}subscribe(t,n){this.observers===null&&(this.observers=[]),this.observers.push(t,n)}unsubscribe(t){}notify(t){if(this.observers)for(let n=0;n<this.observers.length;n+=2){let r=this.observers[n];r(this.image,t)}}async use(t){return this.image}get(t,n){return n===G?this:Reflect.get(this.state,n)}set(t,n,r){return this.state[n]!==r&&(this.state[n]=r,this.notify(n)),!0}ownKeys(t){return Reflect.ownKeys(this.state)}has(t,n){return Reflect.has(this.state,n)}};var m=null,I=class{".events";".listeners";addEventListener(){let t=this[".listeners"];if(t?m===t&&(this[".listeners"]=t=t.slice()):this[".listeners"]=t=[],arguments.length===1)return arguments[0]?(t.push(arguments[0]),t.push(null),!0):!1;if(arguments.length===2)return arguments[1]?(t.push(arguments[1]),t.push(arguments[0]),!0):!1}removeEventListener(){let t=this[".listeners"];if(t)m===t&&(this[".listeners"]=t=t.slice());else return!1;if(arguments.length===1){let n=arguments[0],r=0;for(;;)if(r=t.indexOf(n,r),r>=0)t.splice(r,2),r++;else return!0}else if(arguments.length===2){let n=arguments[0],r=arguments[1],a=0;for(;;)if(a=t.indexOf(r,a),a>=0){if(t[a+1]===n)return t.splice(a,2),!0;a++}else return console.warn(`removeEventListener(${n}) failed on:`,this),!1}return!1}synchronizeStateInContext(t,n,r,a){return this}addStateListener(t,n){return this.addEventListener("change",t)}removeStateListener(t){return this.removeEventListener("change",t)}setState(){if(arguments.length===0)this[".events"]?this[".events"][0]||(this[".events"][0]={}):(this[".events"]=[{}],setTimeout(z.bind(this)));else if(arguments.length===1)for(let t in arguments[0])Y.call(this,t,arguments[0][t]);else arguments.length===2&&Y.call(this,arguments[0],arguments[1])}dispatchEvent(t,n){this[".events"]||(this[".events"]=[null],setTimeout(z.bind(this))),t==="change"?this[".events"][0]=Object.assign(this[".events"][0]||{},n):(this[".events"].push(t),this[".events"].push(n))}executeEvent(t,n){let r=this[".listeners"],a=r?r.length:0;if(!a)return;m===null?m=r:r=r.slice();let i=[];for(let u=1;u<a;u+=2)try{let p,f=r[u];f?f===t&&(p=r[u-1](n,this)):p=r[u-1](t,n,this),p instanceof Promise&&i.push(p)}catch(p){console.error(p)}return m===r&&(m=null),Promise.all(i)}static setState(){}};I.setState=I.prototype.setState;function Y(e,t){if(this[e]!==t){this[".events"]||(this[".events"]=[null],setTimeout(z.bind(this)));let n=this[".events"][0];n?n.hasOwnProperty(e)||(n[e]=this[e]):this[".events"][0]={[e]:t},this[e]=t}}function z(){let e=this[".listeners"],t=this[".events"],n=e?e.length:0;if(this[".events"]=null,!n)return;m===null?m=e:e=e.slice();let r=t[0];if(r)for(let a=1;a<n;a+=2)try{let i=e[a];if(!i)e[a-1]("change",this,r);else if(i==="change")e[a-1](this,r);else if(Array.isArray(i)){for(let u of i)if(r.hasOwnProperty(u)){e[a-1](this,r);break}}}catch(i){console.error(i)}for(let a=2;a<t.length;a+=2){let i=t[a-1],u=t[a];for(let p=1;p<n;p+=2)try{let f=e[p];f?f===i&&e[p-1](u,this):e[p-1](i,u,this)}catch(f){console.error(f)}}m===e&&(m=null)}var W={log:console.log,debug:console.info,warning:console.warn,error:console.error,success:console.info,title:console.info,info:console.info,exception:console.error};var H=class extends O{constructor(n){super();this.url=n}loaded=!1;query=null;status=0;async use(){return this.loaded===!1?(this.query===null&&(this.query=fetch(this.url).then(async n=>{let r=await n.json();return Object.assign(this.state,r),this.status=n.status,this.query=null,this.loaded=!0,this.notify(),this.image},n=>(W.error(n),this.loaded=!0,this.image))),this.query):this.image}get(n,r){if(typeof r=="string"){if(this.loaded===!1)return this.use().then(()=>this.state[r])}else if(r===K)return this.status;return super.get(n,r)}set(n,r,a){return this.loaded===!1?(console.error(`Resource '${this.url}' not ready for assignement`),!0):super.set(this.state,r,a)}};var h={boolean:{type:"boolean"},string:{type:"string"},number:{type:"number"},object:{type:"object"},view:{type:"view"},display:{type:"display"},function:{type:"function"},null:{type:"null"},unknown:{type:"null"},any:{}},ur={enums(e,...t){return{...e,enum:t}},array(e){return{type:"array",items:e}},record(e){return{type:"object",properties:e}},collection(e){return{type:"object",additionalProperties:e}},event_fn(e){return{type:"function",args:[e||h.any]}}},w={invalid:{$error:"Cannot determine the type"}};function re(e,t){if(!t)return w.invalid;let n=t.properties?.[e];if(n)return n;let{patternProperties:r}=t;for(let a in r)if(e.match(a))return r[a];return t.$error?w.invalid:t.additionalProperties||h.any}function oe(e,t){return t?Array.isArray(t.items)?t.items?.[e]||w.invalid:t.items?t.items:t.type==="element"?t:t.$error?w.invalid:t.additionalProperties||h.any:w.invalid}function J(e){switch(typeof e){case"undefined":return h.null;case"boolean":return h.boolean;case"symbol":case"string":return h.string;case"bigint":case"number":return h.number;case"function":return h.function;case"object":{if(Array.isArray(e))return{type:"array",items:e.map(J)};if(e!==null){let t={};for(let n in t)t[n]=J(t[n]);return{type:"array",properties:t}}return h.null}default:return w.invalid}}function ae(e,t){let{type:n}=e;return Array.isArray(n)?n.includes(t):n===t}function se(e){return Array.isArray(e)?e.join(","):e}function N(e){if(e.type==="object"){let t=[];for(let n in e.properties)t.push(`${n}: ${N(e.properties[n])}`);for(let n in e.additionalProperties)t.push(`${n}?: ${N(e.additionalProperties[n])}`);for(let n in e.patternProperties)t.push(`[${n}: ${N(e.patternProperties[n])}]`);return t.join(`
2
- `)}else if(e.type)return e.type;return"any"}var pr={getPropertyTyping:re,getItemTyping:oe,getValueTyping:J,isType:ae,typeAsString:se,generateTypescript:N};import{z as o}from"zod";var ie=o.enum(["string","number","integer","boolean","object","array","null"]),le=o.enum(["module","function","service"]),P=o.union([o.string(),o.number(),o.boolean(),o.null(),o.record(o.string(),o.any()),o.array(o.any())]),ue=o.object({title:o.string().optional(),properties:o.array(o.string()).optional(),secondaryProperties:o.array(o.string()).optional(),patternProperties:o.array(o.string()).optional(),additionalProperties:o.boolean().optional()}),pe=o.object({description:o.string().optional(),chapters:o.array(ue).optional(),additionalChapter:o.boolean().optional()}),ce=o.object({source:o.string()}),fe=o.object({type:o.string()}).passthrough(),c=o.lazy(()=>b),ye=o.object({title:o.string().optional(),icon:o.string().optional(),description:o.string().optional(),args:o.array(c).optional(),content:fe}),me=o.object({view:o.string(),properties:o.record(o.string(),c).optional()}),yr=o.object({check:o.any()}),he=o.union([o.literal("safe"),o.string(),o.object({rule:o.string()}).passthrough()]),Se=o.string(),ge=o.union([Se,o.object({type:o.string(),data:o.any().optional()})]),L=o.object({$id:o.string().optional(),$ref:o.string().optional(),$schema:o.string().optional(),$comment:o.string().optional(),$defs:o.record(o.string(),o.lazy(()=>c)).optional(),type:o.union([ie,le]).optional(),enum:o.array(P).optional(),const:P.optional(),multipleOf:o.number().optional(),maximum:o.number().optional(),exclusiveMaximum:o.number().optional(),minimum:o.number().optional(),exclusiveMinimum:o.number().optional(),maxLength:o.number().optional(),minLength:o.number().optional(),pattern:o.string().optional(),items:o.union([o.lazy(()=>c),o.array(o.lazy(()=>c))]).optional(),additionalItems:o.lazy(()=>c).optional(),maxItems:o.number().optional(),minItems:o.number().optional(),uniqueItems:o.boolean().optional(),contains:o.lazy(()=>c).optional(),maxProperties:o.number().optional(),minProperties:o.number().optional(),required:o.array(o.string()).optional(),properties:o.record(o.string(),o.lazy(()=>c)).optional(),patternProperties:o.record(o.string(),o.lazy(()=>c)).optional(),additionalProperties:o.lazy(()=>c).optional(),dependencies:o.record(o.string(),o.union([o.lazy(()=>c),o.array(o.string())])).optional(),propertyNames:o.lazy(()=>c).optional(),if:o.lazy(()=>c).optional(),then:o.lazy(()=>c).optional(),else:o.lazy(()=>c).optional(),allOf:o.array(o.lazy(()=>c)).optional(),anyOf:o.array(o.lazy(()=>c)).optional(),oneOf:o.array(o.lazy(()=>c)).optional(),not:o.lazy(()=>c).optional(),format:o.string().optional(),contentMediaType:o.string().optional(),contentEncoding:o.string().optional(),definitions:o.record(o.string(),o.lazy(()=>c)).optional(),title:o.string().optional(),description:o.string().optional(),default:P.optional(),readOnly:o.boolean().optional(),writeOnly:o.boolean().optional(),examples:P.optional()}),V=o.object({title:o.string().optional(),icon:o.string().optional(),doc:pe.optional(),$error:o.union([o.string(),o.instanceof(Error)]).optional(),args:o.array(o.lazy(()=>b)).optional(),placeholder:o.boolean().optional(),resources:o.record(o.string(),ge).optional(),security:he.optional(),"allow-origin":o.string().optional(),docking:me.optional(),templates:o.array(ye).optional(),binding:ce.optional(),aliases:o.record(o.string(),o.string()).optional()}),de=L.merge(V).extend({type:o.literal("service"),$spec:o.string(),version:o.string().optional()}),mr=L.merge(V).extend({type:o.literal("function"),input:o.union([o.lazy(()=>b),o.array(o.lazy(()=>b))]).optional(),output:o.union([o.lazy(()=>b),o.array(o.lazy(()=>b))]).optional()}),b=o.lazy(()=>o.union([L.merge(V),de]));var S=class{constructor(t,n,r={}){this.$parentScope=t;this.$thisScope=n;this.locals=r}getThis(){return this.$thisScope}getValue(t){if(Object.hasOwn(this.locals,t))return this.locals[t];if(this.$parentScope)return this.$parentScope.getValue(t)}setValue(t,n){if(Object.hasOwn(this.locals,t)){this.locals[t]=n;return}this.$parentScope?.setValue(t,n)}setArguments(t,n){this.locals.arguments=t;let r=Math.min(t.length,n.length);for(let a=0;a<r;a++){let i=n[a];this.locals[i.name]=t[a]}}},Er=new S(null,null),x=Symbol("return"),C=Symbol("break"),R=Symbol("continue"),D=class{constructor(t){this.value=t}symbol=x},F=class{symbol=C},$=class{symbol=R};function v(e){return e!==null&&typeof e=="object"&&"symbol"in e&&(e.symbol===x||e.symbol===C||e.symbol===R)}var Z=new Map([["+",(e,t)=>e+t],["-",(e,t)=>e-t],["*",(e,t)=>e*t],["/",(e,t)=>e/t],["%",(e,t)=>e%t],["==",(e,t)=>e==t],["!=",(e,t)=>e!=t],["===",(e,t)=>e===t],["!==",(e,t)=>e!==t],["<",(e,t)=>e<t],["<=",(e,t)=>e<=t],[">",(e,t)=>e>t],[">=",(e,t)=>e>=t]]),we=new Map([["-",e=>-e],["+",e=>+e],["!",e=>!e],["~",e=>~e],["typeof",e=>typeof e],["void",e=>{}]]),Q=new Map([["=",(e,t)=>t],["+=",(e,t)=>e+t],["-=",(e,t)=>e-t],["*=",(e,t)=>e*t],["/=",(e,t)=>e/t],["%=",(e,t)=>e%t]]);function be(e){return e.value}function xe(e,t){return t.getValue(e.name)}function ve(e){return e.getThis()}function Te(e,t){let n=s(e.left,t),r=s(e.right,t),a=Z.get(e.operator);if(!a)throw new Error(`Unsupported binary operator: ${e.operator}`);return a(n,r)}function Ee(e,t){let n=s(e.left,t);if(e.operator==="&&")return n&&s(e.right,t);if(e.operator==="||")return n||s(e.right,t);throw new Error(`Unsupported logical operator: ${e.operator}`)}function ke(e,t){if(e.operator==="delete"){if(e.argument.type==="MemberExpression"){let a=e.argument,i=s(a.object,t),u=a.computed?s(a.property,t):a.property.name;return delete i[u]}throw new Error(`Unsupported delete operation on type: ${e.argument.type}`)}let n=s(e.argument,t),r=we.get(e.operator);if(!r)throw new Error(`Unsupported unary operator: ${e.operator}`);return r(n)}function Ae(e,t){if(e.argument.type!=="Identifier")throw new Error("Update expression only supports identifiers");let n=e.argument,r=t.getValue(n.name);if(e.operator==="++"){let a=r+1;return t.setValue(n.name,a),e.prefix?a:r}if(e.operator==="--"){let a=r-1;return t.setValue(n.name,a),e.prefix?a:r}throw new Error(`Unsupported update operator: ${e.operator}`)}function Oe(e,t){if(e.left.type!=="Identifier")throw new Error("Assignment only supports identifier left-hand side");let n=e.left,r=s(e.right,t),a=t.getValue(n.name),i=Q.get(e.operator);if(!i)throw new Error(`Unsupported assignment operator: ${e.operator}`);let u=i(a,r);return t.setValue(n.name,u),u}function Ie(e,t){let n=s(e.callee,t);if(typeof n!="function")throw new Error("Attempt to call a non-function");let r=new Array(e.arguments.length);for(let a=0;a<e.arguments.length;a++)r[a]=s(e.arguments[a],t);return n.apply(t.getThis(),r)}function Ne(e,t){let n=s(e.object,t),r=e.computed?s(e.property,t):e.property.name,a=n[r];return typeof a=="function"?a.bind(n):a}function Pe(e,t){let n=s(e.test,t);return s(n?e.consequent:e.alternate,t)}function Ce(e,t){let n=new Array(e.elements.length);for(let r=0;r<e.elements.length;r++)n[r]=s(e.elements[r],t);return n}function je(e,t){let n={};for(let r of e.properties){let a=r,i=a.key.type==="Literal"?a.key.value:a.key.name;n[String(i)]=s(a.value,t)}return n}function ze(e,t){return function(...n){let r=new S(t,this);r.setArguments(n,e.params);try{return s(e.body,r)}catch(a){if(v(a)&&a.symbol===x)return a.value;throw a}}}function Je(e,t){return function(...n){let r=new S(t,t.getThis());r.setArguments(n,e.params);try{return s(e.body,r)}catch(a){if(v(a)&&a.symbol===x)return a.value;throw a}}}function Le(e,t){let n;for(let r of e.body)n=s(r,t);return n}function Ve(e,t){return s(e.expression,t)}function De(e,t){let n;for(let r of e.declarations){let a=r.id.name,i=r.init?s(r.init,t):void 0;t.setValue(a,i),n=i}return n}function Fe(e,t){let n=e.argument?s(e.argument,t):void 0;throw new D(n)}function $e(e,t){if(s(e.test,t))return s(e.consequent,t);if(e.alternate)return s(e.alternate,t)}function k(e,t){if(v(e)){if(e.symbol===C)return{shouldBreak:!0,shouldContinue:!1,result:t};if(e.symbol===R)return{shouldBreak:!1,shouldContinue:!0,result:t};if(e.symbol===x)throw e}throw e}function Re(e,t){let n;for(;s(e.test,t);)try{n=s(e.body,t)}catch(r){let a=k(r,n);if(a.shouldBreak)break;if(a.shouldContinue)continue;n=a.result}return n}function Me(e,t){let n;for(e.init&&s(e.init,t);!e.test||s(e.test,t);){try{n=s(e.body,t)}catch(r){let a=k(r,n);if(a.shouldBreak)break;if(a.shouldContinue){e.update&&s(e.update,t);continue}n=a.result}e.update&&s(e.update,t)}return n}var l=new Map([["Literal",be],["Identifier",xe],["ThisExpression",(e,t)=>ve(t)],["BinaryExpression",Te],["LogicalExpression",Ee],["UnaryExpression",ke],["UpdateExpression",Ae],["AssignmentExpression",Oe],["CallExpression",Ie],["MemberExpression",Ne],["ConditionalExpression",Pe],["ArrayExpression",Ce],["ObjectExpression",je],["FunctionExpression",ze],["ArrowFunctionExpression",Je],["BlockStatement",Le],["ExpressionStatement",Ve],["VariableDeclaration",De],["ReturnStatement",Fe],["IfStatement",$e],["WhileStatement",Re],["ForStatement",Me],["BreakStatement",()=>{throw new F}],["ContinueStatement",()=>{throw new $}],["EmptyStatement",()=>{}]]);function Be(e,t){let n;do try{n=s(e.body,t)}catch(r){let a=k(r,n);if(a.shouldBreak)break;if(a.shouldContinue)continue;n=a.result}while(s(e.test,t));return n}function _e(e,t){let n=s(e.right,t),r;for(let a in n)if(Object.prototype.hasOwnProperty.call(n,a)){X(e.left,a,t);try{r=s(e.body,t)}catch(i){let u=k(i,r);if(u.shouldBreak)break;if(u.shouldContinue)continue;r=u.result}}return r}function qe(e,t){let n=s(e.right,t),r;for(let a of n){X(e.left,a,t);try{r=s(e.body,t)}catch(i){let u=k(i,r);if(u.shouldBreak)break;if(u.shouldContinue)continue;r=u.result}}return r}function X(e,t,n){if(e.type==="VariableDeclaration"){let r=e.declarations[0].id.name;n.setValue(r,t)}else e.type==="Identifier"&&n.setValue(e.name,t)}function Ue(e,t){let n=s(e.discriminant,t),r=!1,a;for(let i of e.cases)if(!r&&i.test&&s(i.test,t)===n&&(r=!0),r||!i.test&&!r)for(let u of i.consequent)try{a=s(u,t)}catch(p){if(v(p)&&p.symbol===C)return a;throw p}return a}function Ge(e,t){throw s(e.argument,t)}function Ke(e,t){let n;try{n=s(e.block,t)}catch(r){if(e.handler){let a=e.handler.param?e.handler.param.name:void 0,i=new S(t,t.getThis());a&&i.setValue(a,r),n=s(e.handler.body,i)}else throw r}finally{e.finalizer&&s(e.finalizer,t)}return n}function Ye(e,t){return s(e.body,t)}function We(e,t){let n;for(let r of e.body)n=s(r,t);return n}function He(e,t){let n=function(...r){let a=new S(t,this);a.setArguments(r,e.params);try{return s(e.body,a)}catch(i){if(v(i)&&i.symbol===x)return i.value;throw i}};return e.id&&t.setValue(e.id.name,n),n}function Ze(e,t){let n=s(e.callee,t);if(typeof n!="function")throw new Error("Attempt to construct a non-function");let r=new Array(e.arguments.length);for(let a=0;a<e.arguments.length;a++)r[a]=s(e.arguments[a],t);return new n(...r)}function Qe(e,t){let n;for(let r of e.expressions)n=s(r,t);return n}function Xe(e,t){let n=e.argument?s(e.argument,t):void 0;if(e.delegate)throw new Error("yield* delegation not implemented");return n}function et(e,t){let n="";for(let r=0;r<e.quasis.length;r++)if(n+=e.quasis[r].value.cooked||e.quasis[r].value.raw,r<e.expressions.length){let a=s(e.expressions[r],t);n+=String(a)}return n}function tt(e,t){let n=s(e.tag,t);if(typeof n!="function")throw new Error("Template tag must be a function");let r=e.quasi.quasis.map(i=>i.value.cooked||i.value.raw);Object.defineProperty(r,"raw",{value:e.quasi.quasis.map(i=>i.value.raw)});let a=e.quasi.expressions.map(i=>s(i,t));return n(r,...a)}function nt(e,t){let n=s(e.argument,t);if(typeof n=="string"||Array.isArray(n))return[...n];if(n&&typeof n=="object")return{...n};throw new Error("Invalid spread operation")}function rt(e,t){throw new Error("ObjectPattern evaluation requires assignment context")}function ot(e,t){throw new Error("ArrayPattern evaluation requires assignment context")}function at(e,t){throw new Error("RestElement evaluation requires destructuring context")}function st(e,t){return s(e.right,t)}function it(e,t){let n=ee(e,t);return e.id&&t.setValue(e.id.name,n),n}function ee(e,t){let n=e.superClass?s(e.superClass,t):null,r=function(...a){let i=e.body.body.find(u=>u.type==="MethodDefinition"&&u.kind==="constructor");if(i)return s(i.value,t).apply(this,a);if(n)return n.apply(this,a)};n&&(Object.setPrototypeOf(r.prototype,n.prototype),Object.setPrototypeOf(r,n));for(let a of e.body.body)if(a.type==="MethodDefinition"&&a.kind!=="constructor"){let i=a,u=s(i.value,t),p=i.computed?s(i.key,t):i.key.name;i.static?r[p]=u:r.prototype[p]=u}return r}function lt(e,t){return s(e.value,t)}function ut(e,t){throw new Error("Super can only be used in class methods")}function pt(e,t){if(!(e.meta.name==="new"&&e.property.name==="target")){if(e.meta.name==="import"&&e.property.name==="meta")return{};throw new Error(`Unsupported meta property: ${e.meta.name}.${e.property.name}`)}}function ct(e,t){let n=s(e.argument,t);if(n&&typeof n=="object"&&"then"in n)throw new Error("Async/await requires async context");return n}function ft(e,t){try{return s(e.expression,t)}catch{return}}function yt(e,t){throw new Error("Dynamic import not supported in this interpreter")}function mt(e,t){return s(e.expression,t)}function ht(e,t){throw new Error("Private identifiers require class context")}function St(e,t){throw new Error("Import declarations require module system")}function gt(e,t){if(e.declaration)return s(e.declaration,t)}function dt(e,t){return s(e.declaration,t)}function wt(e,t){throw new Error("Export all declarations require module system")}var bt=new Map([...Z,["<<",(e,t)=>e<<t],[">>",(e,t)=>e>>t],[">>>",(e,t)=>e>>>t],["|",(e,t)=>e|t],["^",(e,t)=>e^t],["&",(e,t)=>e&t],["in",(e,t)=>e in t],["instanceof",(e,t)=>e instanceof t],["**",(e,t)=>e**t]]),xt=new Map([...Q,["<<=",(e,t)=>e<<t],[">>=",(e,t)=>e>>t],[">>>=",(e,t)=>e>>>t],["|=",(e,t)=>e|t],["^=",(e,t)=>e^t],["&=",(e,t)=>e&t],["**=",(e,t)=>e**t],["||=",(e,t)=>e||t],["&&=",(e,t)=>e&&t],["??=",(e,t)=>e??t]]),vt=new Map([["||",(e,t,n)=>e||s(t,n)],["&&",(e,t,n)=>e&&s(t,n)],["??",(e,t,n)=>e??s(t,n)]]);function Tt(e,t){let n=s(e.left,t),r=s(e.right,t),a=bt.get(e.operator);if(!a)throw new Error(`Unsupported binary operator: ${e.operator}`);return a(n,r)}function Et(e,t){let n=s(e.left,t),r=vt.get(e.operator);if(!r)throw new Error(`Unsupported logical operator: ${e.operator}`);return r(n,e.right,t)}function kt(e,t){if(e.left.type!=="Identifier")throw new Error("Assignment only supports identifier left-hand side");let n=e.left,r=s(e.right,t),a=t.getValue(n.name),i=xt.get(e.operator);if(!i)throw new Error(`Unsupported assignment operator: ${e.operator}`);let u=i(a,r);return t.setValue(n.name,u),u}l.set("Program",We);l.set("FunctionDeclaration",He);l.set("NewExpression",Ze);l.set("SequenceExpression",Qe);l.set("YieldExpression",Xe);l.set("TemplateLiteral",et);l.set("TaggedTemplateExpression",tt);l.set("SpreadElement",nt);l.set("ObjectPattern",rt);l.set("ArrayPattern",ot);l.set("RestElement",at);l.set("AssignmentPattern",st);l.set("ClassDeclaration",it);l.set("ClassExpression",ee);l.set("MethodDefinition",lt);l.set("Super",ut);l.set("MetaProperty",pt);l.set("AwaitExpression",ct);l.set("ChainExpression",ft);l.set("ImportExpression",yt);l.set("ParenthesizedExpression",mt);l.set("PrivateIdentifier",ht);l.set("ImportDeclaration",St);l.set("ExportNamedDeclaration",gt);l.set("ExportDefaultDeclaration",dt);l.set("ExportAllDeclaration",wt);l.set("BinaryExpression",Tt);l.set("LogicalExpression",Et);l.set("AssignmentExpression",kt);l.set("DoWhileStatement",Be);l.set("ForInStatement",_e);l.set("ForOfStatement",qe);l.set("SwitchStatement",Ue);l.set("ThrowStatement",Ge);l.set("TryStatement",Ke);l.set("LabeledStatement",Ye);l.set("DebuggerStatement",()=>{});l.set("WithStatement",()=>{throw new Error("WithStatement is not supported for security reasons")});l.set("VariableDeclarator",(e,t)=>{let n=e.init?s(e.init,t):void 0;return e.id.type==="Identifier"&&t.setValue(e.id.name,n),n});l.set("SwitchCase",(e,t)=>{let n;for(let r of e.consequent)n=s(r,t);return n});l.set("CatchClause",(e,t)=>s(e.body,t));l.set("Property",(e,t)=>s(e.value,t));l.set("TemplateElement",e=>e.value.cooked||e.value.raw);function s(e,t){if(!e||!e.type)throw new Error("Invalid node: missing type");let n=l.get(e.type);if(n)try{return n(e,t)}catch(r){throw v(r)?r:new Error(`Error evaluating ${e.type}: ${r instanceof Error?r.message:String(r)}`)}throw new Error(`Unsupported node type: ${e.type}`)}import*as te from"acorn";import*as q from"astring";var At=(r=>(r[r.DollarBracket=0]="DollarBracket",r[r.DollarCurly=1]="DollarCurly",r[r.CurlyCurly=2]="CurlyCurly",r))(At||{}),B=class{constructor(t,n,r){this.start=t;this.end=n;this.node=r}evaluate(t){return s(this.node,t)}toString(){return q.generate(this.node)}},_=class{constructor(t,n,r){this.pattern=t;this.bindings=n;this.issues=r}evaluate(t){let{pattern:n,bindings:r}=this,a=new S(null,null,t.vars),i=n,u=t.encoder||Nt;for(let p in r){let f=r[p];try{let g=f.evaluate(a);i=i.replace(p,u(g))}catch(g){let T=q.generate(f.node);throw console.log(`Invalid binding '${T}':`,g),new Error(`Invalid binding '${T}': ${g.message}`)}}return i}getBindingAt(t){for(let n in this.bindings){let r=this.bindings[n];if(t>=r.start&&t<r.end)return r}return null}toString(){let{pattern:t,bindings:n}=this,r=t;for(let a in n){let i=n[a];r=r.replace(a,i.toString())}return r}};function M(e,t,n){return{startToken:e,endToken:t,escapeChar:n,escapeCode:n.charCodeAt(0)}}var Ot=[M("$(",")","\\"),M("${","}","\\"),M("{{","}}","\\")];function Or(e,t,n=It){let{startToken:r,endToken:a,escapeCode:i}=Ot[t],u={ecmaVersion:2020},p={},f=n(e),g=0,T=[],A=[],E=0,y=0;for(;y=e.indexOf(r,y),!(y<0);)if(e.charCodeAt(y-1)===i)A.push(e.slice(E,y-1),r),E=y=y+r.length;else try{let d=te.parseExpressionAt(e,y+r.length,u),j=e.indexOf(a,d.end);if(j>0&&e.slice(d.end,j).trim()===""){let U=f(g);p[U]=new B(d.start,d.end,d),A.push(e.slice(E,y),U),E=y=j+a.length,g++}else throw new Error(`Embedding shall end with '${a}'`)}catch(d){T.push(d),y++}A.push(e.slice(E,e.length));let ne=A.join("");return new _(ne,p,T)}function It(e){let t="$";for(;e.includes(t);)t+="_";return n=>t+n}function Nt(e){return e===void 0||e===null?"":e.toString()}export{Q as ASSIGNMENT_OPERATIONS,zn as AccountSettings,Z as BINARY_OPERATIONS,ce as BindingSchema,ue as ChapterSchema,Ut as CombinedComponentProvider,ur as CommonMakers,$t as CommonResourceProvider,h as CommonTypes,Ct as ComponentControllerKey,Kt as ComponentEntry,Yt as ComponentResource,Wt as ComponentsManifold,Ht as ComponentsRegistry,me as DockingSchema,pe as DocumentationSchema,xt as ENHANCED_ASSIGNMENT_OPERATIONS,bt as ENHANCED_BINARY_OPERATIONS,vt as ENHANCED_LOGICAL_OPERATIONS,jt as EditorKey,At as EmbedSyntax,Er as EmptyScope,w as ErrorTypes,fe as ExpressionSchema,mr as FunctionSchemaSchema,K as HttpStatusAttribute,_t as InMemComponentProvider,Bt as InMemComponentPublisher,c as JSONSchema7DefinitionSchema,le as JSONSchema7TypeNameCustomSchema,ie as JSONSchema7TypeNameSchema,P as JSONSchema7TypeSchema,V as JSONSchemaCustomSchema,b as JSONSchemaSchema,L as JSONSchemaStandardSchema,I as Listenable,S as LocalScope,Sn as Log,O as Observable,G as ObservableAttribute,ge as ResourceEntrySchema,Se as ResourceLinkSchema,H as RestResource,pr as Schema,he as SecurityGuardSchema,yr as SecurityRuleSchema,Pt as ServiceEntry,Fn as ServicePoint,Dn as ServicePoints,de as ServiceSchemaSchema,qt as StaticComponentProvider,Rt as StaticContentProvider,ye as TemplateSchema,B as TextBinding,_ as TextTemplate,we as UNARY_OPERATIONS,jn as WriteMode,wn as ZodService,Xt as acquireComponent,en as acquireFutureComponent,tn as acquireResource,qn as acquireServicePoint,Mn as acquireServicePointDescriptor,Gn as areSimilarObjects,An as checkVersionCompatibility,Mt as contentLocalURI,Vt as createComponentFilter,Lt as createComponentPublication,Gt as createLocalComponentProvider,gn as createLogFromError,Un as createServicePoint,On as defineServiceSpec,an as deleteComponent,s as evaluateExpression,pn as failedComponentPublication,un as fetchComponentsPublications,kn as generateTypeScript,Qt as getComponentFromData,Jt as getComponentServicesList,Zt as getDefaultComponent,_n as getServicePoint,Nn as getServiceSchema,Pn as getServiceSchemaFromSpec,In as getServiceZod,Jn as getSettings,vn as jsonSchemaToZod,Kn as listOneOrMany,$n as listenServicePoints,Ln as listenSettings,Dt as matchComponentFilter,Cn as matchesSpecification,zt as parseComponentURI,Ft as parseResourceEntry,Or as parseTextTemplate,yn as queryLogCount,hn as queryLogInfos,mn as queryLogObjects,cn as registerLogCollector,nn as resolveRelativeComponent,on as saveComponent,rn as saveComponentManifest,ln as searchComponentsPublications,Rn as unlistenServicePoints,Vn as unlistenSettings,sn as unregisterComponent,fn as unregisterLogCollector,Bn as updateServicePointDescriptor,Tn as validate,En as validateOrThrow,dn as z,bn as zService,xn as zodToJSONSchema};
1
+ import{a as dn,b as wn,c as bn,d as xn,e as vn,f as Tn,g as En,h as kn,i as An,j as On,k as In,l as Nn,m as Pn,n as Cn}from"./chunk.LFHCE3KB.js";import{a as jn,b as zn,c as Jn,d as Ln,e as Vn,f as Dn,g as Fn,h as $n,i as Rn,j as Mn,k as Bn,l as _n,m as qn,n as Un}from"./chunk.CFIED3LN.js";import{A as Xt,B as en,C as tn,D as nn,E as rn,F as on,G as an,H as sn,I as ln,J as un,K as pn,L as cn,M as fn,N as yn,O as mn,P as hn,Q as Sn,R as gn,a as Pt,b as Ct,c as jt,d as zt,e as Jt,f as Lt,g as Vt,h as Dt,i as Ft,j as $t,k as Rt,l as Mt,m as Bt,n as _t,o as qt,p as Ut,q as Gt,u as Kt,v as Yt,w as Wt,x as Ht,y as Zt,z as Qt}from"./chunk.UGWDPVMV.js";function Gn(e,t){for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(e[n]!==t[n])return!1;return!0}function*Kn(e){if(Array.isArray(e))for(let t of e)yield t;else e&&(yield e)}var G=Symbol("__observable__"),K=Symbol("__status__");var O=class{observers;state;image;constructor(){this.observers=null,this.state={},this.image=new Proxy(this.state,this)}subscribe(t,n){this.observers===null&&(this.observers=[]),this.observers.push(t,n)}unsubscribe(t){}notify(t){if(this.observers)for(let n=0;n<this.observers.length;n+=2){let r=this.observers[n];r(this.image,t)}}async use(t){return this.image}get(t,n){return n===G?this:Reflect.get(this.state,n)}set(t,n,r){return this.state[n]!==r&&(this.state[n]=r,this.notify(n)),!0}ownKeys(t){return Reflect.ownKeys(this.state)}has(t,n){return Reflect.has(this.state,n)}};var m=null,I=class{".events";".listeners";addEventListener(){let t=this[".listeners"];if(t?m===t&&(this[".listeners"]=t=t.slice()):this[".listeners"]=t=[],arguments.length===1)return arguments[0]?(t.push(arguments[0]),t.push(null),!0):!1;if(arguments.length===2)return arguments[1]?(t.push(arguments[1]),t.push(arguments[0]),!0):!1}removeEventListener(){let t=this[".listeners"];if(t)m===t&&(this[".listeners"]=t=t.slice());else return!1;if(arguments.length===1){let n=arguments[0],r=0;for(;;)if(r=t.indexOf(n,r),r>=0)t.splice(r,2),r++;else return!0}else if(arguments.length===2){let n=arguments[0],r=arguments[1],a=0;for(;;)if(a=t.indexOf(r,a),a>=0){if(t[a+1]===n)return t.splice(a,2),!0;a++}else return console.warn(`removeEventListener(${n}) failed on:`,this),!1}return!1}synchronizeStateInContext(t,n,r,a){return this}addStateListener(t,n){return this.addEventListener("change",t)}removeStateListener(t){return this.removeEventListener("change",t)}setState(){if(arguments.length===0)this[".events"]?this[".events"][0]||(this[".events"][0]={}):(this[".events"]=[{}],setTimeout(z.bind(this)));else if(arguments.length===1)for(let t in arguments[0])Y.call(this,t,arguments[0][t]);else arguments.length===2&&Y.call(this,arguments[0],arguments[1])}dispatchEvent(t,n){this[".events"]||(this[".events"]=[null],setTimeout(z.bind(this))),t==="change"?this[".events"][0]=Object.assign(this[".events"][0]||{},n):(this[".events"].push(t),this[".events"].push(n))}executeEvent(t,n){let r=this[".listeners"],a=r?r.length:0;if(!a)return;m===null?m=r:r=r.slice();let i=[];for(let u=1;u<a;u+=2)try{let p,f=r[u];f?f===t&&(p=r[u-1](n,this)):p=r[u-1](t,n,this),p instanceof Promise&&i.push(p)}catch(p){console.error(p)}return m===r&&(m=null),Promise.all(i)}static setState(){}};I.setState=I.prototype.setState;function Y(e,t){if(this[e]!==t){this[".events"]||(this[".events"]=[null],setTimeout(z.bind(this)));let n=this[".events"][0];n?n.hasOwnProperty(e)||(n[e]=this[e]):this[".events"][0]={[e]:t},this[e]=t}}function z(){let e=this[".listeners"],t=this[".events"],n=e?e.length:0;if(this[".events"]=null,!n)return;m===null?m=e:e=e.slice();let r=t[0];if(r)for(let a=1;a<n;a+=2)try{let i=e[a];if(!i)e[a-1]("change",this,r);else if(i==="change")e[a-1](this,r);else if(Array.isArray(i)){for(let u of i)if(r.hasOwnProperty(u)){e[a-1](this,r);break}}}catch(i){console.error(i)}for(let a=2;a<t.length;a+=2){let i=t[a-1],u=t[a];for(let p=1;p<n;p+=2)try{let f=e[p];f?f===i&&e[p-1](u,this):e[p-1](i,u,this)}catch(f){console.error(f)}}m===e&&(m=null)}var W={log:console.log,debug:console.info,warning:console.warn,error:console.error,success:console.info,title:console.info,info:console.info,exception:console.error};var H=class extends O{constructor(n){super();this.url=n}loaded=!1;query=null;status=0;async use(){return this.loaded===!1?(this.query===null&&(this.query=fetch(this.url).then(async n=>{let r=await n.json();return Object.assign(this.state,r),this.status=n.status,this.query=null,this.loaded=!0,this.notify(),this.image},n=>(W.error(n),this.loaded=!0,this.image))),this.query):this.image}get(n,r){if(typeof r=="string"){if(this.loaded===!1)return this.use().then(()=>this.state[r])}else if(r===K)return this.status;return super.get(n,r)}set(n,r,a){return this.loaded===!1?(console.error(`Resource '${this.url}' not ready for assignement`),!0):super.set(this.state,r,a)}};var h={boolean:{type:"boolean"},string:{type:"string"},number:{type:"number"},object:{type:"object"},view:{type:"view"},display:{type:"display"},function:{type:"function"},null:{type:"null"},unknown:{type:"null"},any:{}},ur={enums(e,...t){return{...e,enum:t}},array(e){return{type:"array",items:e}},record(e){return{type:"object",properties:e}},collection(e){return{type:"object",additionalProperties:e}},event_fn(e){return{type:"function",args:[e||h.any]}}},w={invalid:{$error:"Cannot determine the type"}};function re(e,t){if(!t)return w.invalid;let n=t.properties?.[e];if(n)return n;let{patternProperties:r}=t;for(let a in r)if(e.match(a))return r[a];return t.$error?w.invalid:t.additionalProperties||h.any}function oe(e,t){return t?Array.isArray(t.items)?t.items?.[e]||w.invalid:t.items?t.items:t.type==="element"?t:t.$error?w.invalid:t.additionalProperties||h.any:w.invalid}function J(e){switch(typeof e){case"undefined":return h.null;case"boolean":return h.boolean;case"symbol":case"string":return h.string;case"bigint":case"number":return h.number;case"function":return h.function;case"object":{if(Array.isArray(e))return{type:"array",items:e.map(J)};if(e!==null){let t={};for(let n in t)t[n]=J(t[n]);return{type:"array",properties:t}}return h.null}default:return w.invalid}}function ae(e,t){let{type:n}=e;return Array.isArray(n)?n.includes(t):n===t}function se(e){return Array.isArray(e)?e.join(","):e}function N(e){if(e.type==="object"){let t=[];for(let n in e.properties)t.push(`${n}: ${N(e.properties[n])}`);for(let n in e.additionalProperties)t.push(`${n}?: ${N(e.additionalProperties[n])}`);for(let n in e.patternProperties)t.push(`[${n}: ${N(e.patternProperties[n])}]`);return t.join(`
2
+ `)}else if(e.type)return e.type;return"any"}var pr={getPropertyTyping:re,getItemTyping:oe,getValueTyping:J,isType:ae,typeAsString:se,generateTypescript:N};import{z as o}from"zod";var ie=o.enum(["string","number","integer","boolean","object","array","null"]),le=o.enum(["module","function","service"]),P=o.union([o.string(),o.number(),o.boolean(),o.null(),o.record(o.string(),o.any()),o.array(o.any())]),ue=o.object({title:o.string().optional(),properties:o.array(o.string()).optional(),secondaryProperties:o.array(o.string()).optional(),patternProperties:o.array(o.string()).optional(),additionalProperties:o.boolean().optional()}),pe=o.object({description:o.string().optional(),chapters:o.array(ue).optional(),additionalChapter:o.boolean().optional()}),ce=o.object({source:o.string()}),fe=o.object({type:o.string()}).passthrough(),c=o.lazy(()=>b),ye=o.object({title:o.string().optional(),icon:o.string().optional(),description:o.string().optional(),args:o.array(c).optional(),content:fe}),me=o.object({view:o.string(),properties:o.record(o.string(),c).optional()}),yr=o.object({check:o.any()}),he=o.union([o.literal("safe"),o.string(),o.object({rule:o.string()}).passthrough()]),Se=o.string(),ge=o.union([Se,o.object({type:o.string(),data:o.any().optional()})]),L=o.object({$id:o.string().optional(),$ref:o.string().optional(),$schema:o.string().optional(),$comment:o.string().optional(),$defs:o.record(o.string(),o.lazy(()=>c)).optional(),type:o.union([ie,le]).optional(),enum:o.array(P).optional(),const:P.optional(),multipleOf:o.number().optional(),maximum:o.number().optional(),exclusiveMaximum:o.number().optional(),minimum:o.number().optional(),exclusiveMinimum:o.number().optional(),maxLength:o.number().optional(),minLength:o.number().optional(),pattern:o.string().optional(),items:o.union([o.lazy(()=>c),o.array(o.lazy(()=>c))]).optional(),additionalItems:o.lazy(()=>c).optional(),maxItems:o.number().optional(),minItems:o.number().optional(),uniqueItems:o.boolean().optional(),contains:o.lazy(()=>c).optional(),maxProperties:o.number().optional(),minProperties:o.number().optional(),required:o.array(o.string()).optional(),properties:o.record(o.string(),o.lazy(()=>c)).optional(),patternProperties:o.record(o.string(),o.lazy(()=>c)).optional(),additionalProperties:o.lazy(()=>c).optional(),dependencies:o.record(o.string(),o.union([o.lazy(()=>c),o.array(o.string())])).optional(),propertyNames:o.lazy(()=>c).optional(),if:o.lazy(()=>c).optional(),then:o.lazy(()=>c).optional(),else:o.lazy(()=>c).optional(),allOf:o.array(o.lazy(()=>c)).optional(),anyOf:o.array(o.lazy(()=>c)).optional(),oneOf:o.array(o.lazy(()=>c)).optional(),not:o.lazy(()=>c).optional(),format:o.string().optional(),contentMediaType:o.string().optional(),contentEncoding:o.string().optional(),definitions:o.record(o.string(),o.lazy(()=>c)).optional(),title:o.string().optional(),description:o.string().optional(),default:P.optional(),readOnly:o.boolean().optional(),writeOnly:o.boolean().optional(),examples:P.optional()}),V=o.object({title:o.string().optional(),icon:o.string().optional(),doc:pe.optional(),$error:o.union([o.string(),o.instanceof(Error)]).optional(),args:o.array(o.lazy(()=>b)).optional(),placeholder:o.boolean().optional(),resources:o.record(o.string(),ge).optional(),security:he.optional(),"allow-origin":o.string().optional(),docking:me.optional(),templates:o.array(ye).optional(),binding:ce.optional(),aliases:o.record(o.string(),o.string()).optional()}),de=L.merge(V).extend({type:o.literal("service"),$spec:o.string(),version:o.string().optional()}),mr=L.merge(V).extend({type:o.literal("function"),input:o.union([o.lazy(()=>b),o.array(o.lazy(()=>b))]).optional(),output:o.union([o.lazy(()=>b),o.array(o.lazy(()=>b))]).optional()}),b=o.lazy(()=>o.union([L.merge(V),de]));var S=class{constructor(t,n,r={}){this.$parentScope=t;this.$thisScope=n;this.locals=r}getThis(){return this.$thisScope}getValue(t){if(Object.hasOwn(this.locals,t))return this.locals[t];if(this.$parentScope)return this.$parentScope.getValue(t)}setValue(t,n){if(Object.hasOwn(this.locals,t)){this.locals[t]=n;return}this.$parentScope?.setValue(t,n)}setArguments(t,n){this.locals.arguments=t;let r=Math.min(t.length,n.length);for(let a=0;a<r;a++){let i=n[a];this.locals[i.name]=t[a]}}},Er=new S(null,null),x=Symbol("return"),C=Symbol("break"),R=Symbol("continue"),D=class{constructor(t){this.value=t}symbol=x},F=class{symbol=C},$=class{symbol=R};function v(e){return e!==null&&typeof e=="object"&&"symbol"in e&&(e.symbol===x||e.symbol===C||e.symbol===R)}var Z=new Map([["+",(e,t)=>e+t],["-",(e,t)=>e-t],["*",(e,t)=>e*t],["/",(e,t)=>e/t],["%",(e,t)=>e%t],["==",(e,t)=>e==t],["!=",(e,t)=>e!=t],["===",(e,t)=>e===t],["!==",(e,t)=>e!==t],["<",(e,t)=>e<t],["<=",(e,t)=>e<=t],[">",(e,t)=>e>t],[">=",(e,t)=>e>=t]]),we=new Map([["-",e=>-e],["+",e=>+e],["!",e=>!e],["~",e=>~e],["typeof",e=>typeof e],["void",e=>{}]]),Q=new Map([["=",(e,t)=>t],["+=",(e,t)=>e+t],["-=",(e,t)=>e-t],["*=",(e,t)=>e*t],["/=",(e,t)=>e/t],["%=",(e,t)=>e%t]]);function be(e){return e.value}function xe(e,t){return t.getValue(e.name)}function ve(e){return e.getThis()}function Te(e,t){let n=s(e.left,t),r=s(e.right,t),a=Z.get(e.operator);if(!a)throw new Error(`Unsupported binary operator: ${e.operator}`);return a(n,r)}function Ee(e,t){let n=s(e.left,t);if(e.operator==="&&")return n&&s(e.right,t);if(e.operator==="||")return n||s(e.right,t);throw new Error(`Unsupported logical operator: ${e.operator}`)}function ke(e,t){if(e.operator==="delete"){if(e.argument.type==="MemberExpression"){let a=e.argument,i=s(a.object,t),u=a.computed?s(a.property,t):a.property.name;return delete i[u]}throw new Error(`Unsupported delete operation on type: ${e.argument.type}`)}let n=s(e.argument,t),r=we.get(e.operator);if(!r)throw new Error(`Unsupported unary operator: ${e.operator}`);return r(n)}function Ae(e,t){if(e.argument.type!=="Identifier")throw new Error("Update expression only supports identifiers");let n=e.argument,r=t.getValue(n.name);if(e.operator==="++"){let a=r+1;return t.setValue(n.name,a),e.prefix?a:r}if(e.operator==="--"){let a=r-1;return t.setValue(n.name,a),e.prefix?a:r}throw new Error(`Unsupported update operator: ${e.operator}`)}function Oe(e,t){if(e.left.type!=="Identifier")throw new Error("Assignment only supports identifier left-hand side");let n=e.left,r=s(e.right,t),a=t.getValue(n.name),i=Q.get(e.operator);if(!i)throw new Error(`Unsupported assignment operator: ${e.operator}`);let u=i(a,r);return t.setValue(n.name,u),u}function Ie(e,t){let n=s(e.callee,t);if(typeof n!="function")throw new Error("Attempt to call a non-function");let r=new Array(e.arguments.length);for(let a=0;a<e.arguments.length;a++)r[a]=s(e.arguments[a],t);return n.apply(t.getThis(),r)}function Ne(e,t){let n=s(e.object,t),r=e.computed?s(e.property,t):e.property.name,a=n[r];return typeof a=="function"?a.bind(n):a}function Pe(e,t){let n=s(e.test,t);return s(n?e.consequent:e.alternate,t)}function Ce(e,t){let n=new Array(e.elements.length);for(let r=0;r<e.elements.length;r++)n[r]=s(e.elements[r],t);return n}function je(e,t){let n={};for(let r of e.properties){let a=r,i=a.key.type==="Literal"?a.key.value:a.key.name;n[String(i)]=s(a.value,t)}return n}function ze(e,t){return function(...n){let r=new S(t,this);r.setArguments(n,e.params);try{return s(e.body,r)}catch(a){if(v(a)&&a.symbol===x)return a.value;throw a}}}function Je(e,t){return function(...n){let r=new S(t,t.getThis());r.setArguments(n,e.params);try{return s(e.body,r)}catch(a){if(v(a)&&a.symbol===x)return a.value;throw a}}}function Le(e,t){let n;for(let r of e.body)n=s(r,t);return n}function Ve(e,t){return s(e.expression,t)}function De(e,t){let n;for(let r of e.declarations){let a=r.id.name,i=r.init?s(r.init,t):void 0;t.setValue(a,i),n=i}return n}function Fe(e,t){let n=e.argument?s(e.argument,t):void 0;throw new D(n)}function $e(e,t){if(s(e.test,t))return s(e.consequent,t);if(e.alternate)return s(e.alternate,t)}function k(e,t){if(v(e)){if(e.symbol===C)return{shouldBreak:!0,shouldContinue:!1,result:t};if(e.symbol===R)return{shouldBreak:!1,shouldContinue:!0,result:t};if(e.symbol===x)throw e}throw e}function Re(e,t){let n;for(;s(e.test,t);)try{n=s(e.body,t)}catch(r){let a=k(r,n);if(a.shouldBreak)break;if(a.shouldContinue)continue;n=a.result}return n}function Me(e,t){let n;for(e.init&&s(e.init,t);!e.test||s(e.test,t);){try{n=s(e.body,t)}catch(r){let a=k(r,n);if(a.shouldBreak)break;if(a.shouldContinue){e.update&&s(e.update,t);continue}n=a.result}e.update&&s(e.update,t)}return n}var l=new Map([["Literal",be],["Identifier",xe],["ThisExpression",(e,t)=>ve(t)],["BinaryExpression",Te],["LogicalExpression",Ee],["UnaryExpression",ke],["UpdateExpression",Ae],["AssignmentExpression",Oe],["CallExpression",Ie],["MemberExpression",Ne],["ConditionalExpression",Pe],["ArrayExpression",Ce],["ObjectExpression",je],["FunctionExpression",ze],["ArrowFunctionExpression",Je],["BlockStatement",Le],["ExpressionStatement",Ve],["VariableDeclaration",De],["ReturnStatement",Fe],["IfStatement",$e],["WhileStatement",Re],["ForStatement",Me],["BreakStatement",()=>{throw new F}],["ContinueStatement",()=>{throw new $}],["EmptyStatement",()=>{}]]);function Be(e,t){let n;do try{n=s(e.body,t)}catch(r){let a=k(r,n);if(a.shouldBreak)break;if(a.shouldContinue)continue;n=a.result}while(s(e.test,t));return n}function _e(e,t){let n=s(e.right,t),r;for(let a in n)if(Object.prototype.hasOwnProperty.call(n,a)){X(e.left,a,t);try{r=s(e.body,t)}catch(i){let u=k(i,r);if(u.shouldBreak)break;if(u.shouldContinue)continue;r=u.result}}return r}function qe(e,t){let n=s(e.right,t),r;for(let a of n){X(e.left,a,t);try{r=s(e.body,t)}catch(i){let u=k(i,r);if(u.shouldBreak)break;if(u.shouldContinue)continue;r=u.result}}return r}function X(e,t,n){if(e.type==="VariableDeclaration"){let r=e.declarations[0].id.name;n.setValue(r,t)}else e.type==="Identifier"&&n.setValue(e.name,t)}function Ue(e,t){let n=s(e.discriminant,t),r=!1,a;for(let i of e.cases)if(!r&&i.test&&s(i.test,t)===n&&(r=!0),r||!i.test&&!r)for(let u of i.consequent)try{a=s(u,t)}catch(p){if(v(p)&&p.symbol===C)return a;throw p}return a}function Ge(e,t){throw s(e.argument,t)}function Ke(e,t){let n;try{n=s(e.block,t)}catch(r){if(e.handler){let a=e.handler.param?e.handler.param.name:void 0,i=new S(t,t.getThis());a&&i.setValue(a,r),n=s(e.handler.body,i)}else throw r}finally{e.finalizer&&s(e.finalizer,t)}return n}function Ye(e,t){return s(e.body,t)}function We(e,t){let n;for(let r of e.body)n=s(r,t);return n}function He(e,t){let n=function(...r){let a=new S(t,this);a.setArguments(r,e.params);try{return s(e.body,a)}catch(i){if(v(i)&&i.symbol===x)return i.value;throw i}};return e.id&&t.setValue(e.id.name,n),n}function Ze(e,t){let n=s(e.callee,t);if(typeof n!="function")throw new Error("Attempt to construct a non-function");let r=new Array(e.arguments.length);for(let a=0;a<e.arguments.length;a++)r[a]=s(e.arguments[a],t);return new n(...r)}function Qe(e,t){let n;for(let r of e.expressions)n=s(r,t);return n}function Xe(e,t){let n=e.argument?s(e.argument,t):void 0;if(e.delegate)throw new Error("yield* delegation not implemented");return n}function et(e,t){let n="";for(let r=0;r<e.quasis.length;r++)if(n+=e.quasis[r].value.cooked||e.quasis[r].value.raw,r<e.expressions.length){let a=s(e.expressions[r],t);n+=String(a)}return n}function tt(e,t){let n=s(e.tag,t);if(typeof n!="function")throw new Error("Template tag must be a function");let r=e.quasi.quasis.map(i=>i.value.cooked||i.value.raw);Object.defineProperty(r,"raw",{value:e.quasi.quasis.map(i=>i.value.raw)});let a=e.quasi.expressions.map(i=>s(i,t));return n(r,...a)}function nt(e,t){let n=s(e.argument,t);if(typeof n=="string"||Array.isArray(n))return[...n];if(n&&typeof n=="object")return{...n};throw new Error("Invalid spread operation")}function rt(e,t){throw new Error("ObjectPattern evaluation requires assignment context")}function ot(e,t){throw new Error("ArrayPattern evaluation requires assignment context")}function at(e,t){throw new Error("RestElement evaluation requires destructuring context")}function st(e,t){return s(e.right,t)}function it(e,t){let n=ee(e,t);return e.id&&t.setValue(e.id.name,n),n}function ee(e,t){let n=e.superClass?s(e.superClass,t):null,r=function(...a){let i=e.body.body.find(u=>u.type==="MethodDefinition"&&u.kind==="constructor");if(i)return s(i.value,t).apply(this,a);if(n)return n.apply(this,a)};n&&(Object.setPrototypeOf(r.prototype,n.prototype),Object.setPrototypeOf(r,n));for(let a of e.body.body)if(a.type==="MethodDefinition"&&a.kind!=="constructor"){let i=a,u=s(i.value,t),p=i.computed?s(i.key,t):i.key.name;i.static?r[p]=u:r.prototype[p]=u}return r}function lt(e,t){return s(e.value,t)}function ut(e,t){throw new Error("Super can only be used in class methods")}function pt(e,t){if(!(e.meta.name==="new"&&e.property.name==="target")){if(e.meta.name==="import"&&e.property.name==="meta")return{};throw new Error(`Unsupported meta property: ${e.meta.name}.${e.property.name}`)}}function ct(e,t){let n=s(e.argument,t);if(n&&typeof n=="object"&&"then"in n)throw new Error("Async/await requires async context");return n}function ft(e,t){try{return s(e.expression,t)}catch{return}}function yt(e,t){throw new Error("Dynamic import not supported in this interpreter")}function mt(e,t){return s(e.expression,t)}function ht(e,t){throw new Error("Private identifiers require class context")}function St(e,t){throw new Error("Import declarations require module system")}function gt(e,t){if(e.declaration)return s(e.declaration,t)}function dt(e,t){return s(e.declaration,t)}function wt(e,t){throw new Error("Export all declarations require module system")}var bt=new Map([...Z,["<<",(e,t)=>e<<t],[">>",(e,t)=>e>>t],[">>>",(e,t)=>e>>>t],["|",(e,t)=>e|t],["^",(e,t)=>e^t],["&",(e,t)=>e&t],["in",(e,t)=>e in t],["instanceof",(e,t)=>e instanceof t],["**",(e,t)=>e**t]]),xt=new Map([...Q,["<<=",(e,t)=>e<<t],[">>=",(e,t)=>e>>t],[">>>=",(e,t)=>e>>>t],["|=",(e,t)=>e|t],["^=",(e,t)=>e^t],["&=",(e,t)=>e&t],["**=",(e,t)=>e**t],["||=",(e,t)=>e||t],["&&=",(e,t)=>e&&t],["??=",(e,t)=>e??t]]),vt=new Map([["||",(e,t,n)=>e||s(t,n)],["&&",(e,t,n)=>e&&s(t,n)],["??",(e,t,n)=>e??s(t,n)]]);function Tt(e,t){let n=s(e.left,t),r=s(e.right,t),a=bt.get(e.operator);if(!a)throw new Error(`Unsupported binary operator: ${e.operator}`);return a(n,r)}function Et(e,t){let n=s(e.left,t),r=vt.get(e.operator);if(!r)throw new Error(`Unsupported logical operator: ${e.operator}`);return r(n,e.right,t)}function kt(e,t){if(e.left.type!=="Identifier")throw new Error("Assignment only supports identifier left-hand side");let n=e.left,r=s(e.right,t),a=t.getValue(n.name),i=xt.get(e.operator);if(!i)throw new Error(`Unsupported assignment operator: ${e.operator}`);let u=i(a,r);return t.setValue(n.name,u),u}l.set("Program",We);l.set("FunctionDeclaration",He);l.set("NewExpression",Ze);l.set("SequenceExpression",Qe);l.set("YieldExpression",Xe);l.set("TemplateLiteral",et);l.set("TaggedTemplateExpression",tt);l.set("SpreadElement",nt);l.set("ObjectPattern",rt);l.set("ArrayPattern",ot);l.set("RestElement",at);l.set("AssignmentPattern",st);l.set("ClassDeclaration",it);l.set("ClassExpression",ee);l.set("MethodDefinition",lt);l.set("Super",ut);l.set("MetaProperty",pt);l.set("AwaitExpression",ct);l.set("ChainExpression",ft);l.set("ImportExpression",yt);l.set("ParenthesizedExpression",mt);l.set("PrivateIdentifier",ht);l.set("ImportDeclaration",St);l.set("ExportNamedDeclaration",gt);l.set("ExportDefaultDeclaration",dt);l.set("ExportAllDeclaration",wt);l.set("BinaryExpression",Tt);l.set("LogicalExpression",Et);l.set("AssignmentExpression",kt);l.set("DoWhileStatement",Be);l.set("ForInStatement",_e);l.set("ForOfStatement",qe);l.set("SwitchStatement",Ue);l.set("ThrowStatement",Ge);l.set("TryStatement",Ke);l.set("LabeledStatement",Ye);l.set("DebuggerStatement",()=>{});l.set("WithStatement",()=>{throw new Error("WithStatement is not supported for security reasons")});l.set("VariableDeclarator",(e,t)=>{let n=e.init?s(e.init,t):void 0;return e.id.type==="Identifier"&&t.setValue(e.id.name,n),n});l.set("SwitchCase",(e,t)=>{let n;for(let r of e.consequent)n=s(r,t);return n});l.set("CatchClause",(e,t)=>s(e.body,t));l.set("Property",(e,t)=>s(e.value,t));l.set("TemplateElement",e=>e.value.cooked||e.value.raw);function s(e,t){if(!e||!e.type)throw new Error("Invalid node: missing type");let n=l.get(e.type);if(n)try{return n(e,t)}catch(r){throw v(r)?r:new Error(`Error evaluating ${e.type}: ${r instanceof Error?r.message:String(r)}`)}throw new Error(`Unsupported node type: ${e.type}`)}import*as te from"acorn";import*as q from"astring";var At=(r=>(r[r.DollarBracket=0]="DollarBracket",r[r.DollarCurly=1]="DollarCurly",r[r.CurlyCurly=2]="CurlyCurly",r))(At||{}),B=class{constructor(t,n,r){this.start=t;this.end=n;this.node=r}evaluate(t){return s(this.node,t)}toString(){return q.generate(this.node)}},_=class{constructor(t,n,r){this.pattern=t;this.bindings=n;this.issues=r}evaluate(t){let{pattern:n,bindings:r}=this,a=new S(null,null,t.vars),i=n,u=t.encoder||Nt;for(let p in r){let f=r[p];try{let g=f.evaluate(a);i=i.replace(p,u(g))}catch(g){let T=q.generate(f.node);throw console.log(`Invalid binding '${T}':`,g),new Error(`Invalid binding '${T}': ${g.message}`)}}return i}getBindingAt(t){for(let n in this.bindings){let r=this.bindings[n];if(t>=r.start&&t<r.end)return r}return null}toString(){let{pattern:t,bindings:n}=this,r=t;for(let a in n){let i=n[a];r=r.replace(a,i.toString())}return r}};function M(e,t,n){return{startToken:e,endToken:t,escapeChar:n,escapeCode:n.charCodeAt(0)}}var Ot=[M("$(",")","\\"),M("${","}","\\"),M("{{","}}","\\")];function Or(e,t,n=It){let{startToken:r,endToken:a,escapeCode:i}=Ot[t],u={ecmaVersion:2020},p={},f=n(e),g=0,T=[],A=[],E=0,y=0;for(;y=e.indexOf(r,y),!(y<0);)if(e.charCodeAt(y-1)===i)A.push(e.slice(E,y-1),r),E=y=y+r.length;else try{let d=te.parseExpressionAt(e,y+r.length,u),j=e.indexOf(a,d.end);if(j>0&&e.slice(d.end,j).trim()===""){let U=f(g);p[U]=new B(d.start,d.end,d),A.push(e.slice(E,y),U),E=y=j+a.length,g++}else throw new Error(`Embedding shall end with '${a}'`)}catch(d){T.push(d),y++}A.push(e.slice(E,e.length));let ne=A.join("");return new _(ne,p,T)}function It(e){let t="$";for(;e.includes(t);)t+="_";return n=>t+n}function Nt(e){return e===void 0||e===null?"":e.toString()}export{Q as ASSIGNMENT_OPERATIONS,zn as AccountSettings,Z as BINARY_OPERATIONS,ce as BindingSchema,ue as ChapterSchema,Ut as CombinedComponentProvider,ur as CommonMakers,$t as CommonResourceProvider,h as CommonTypes,Ct as ComponentControllerKey,Kt as ComponentEntry,Yt as ComponentResource,Wt as ComponentsManifold,Ht as ComponentsRegistry,me as DockingSchema,pe as DocumentationSchema,xt as ENHANCED_ASSIGNMENT_OPERATIONS,bt as ENHANCED_BINARY_OPERATIONS,vt as ENHANCED_LOGICAL_OPERATIONS,jt as EditorKey,At as EmbedSyntax,Er as EmptyScope,w as ErrorTypes,fe as ExpressionSchema,mr as FunctionSchemaSchema,K as HttpStatusAttribute,_t as InMemComponentProvider,Bt as InMemComponentPublisher,c as JSONSchema7DefinitionSchema,le as JSONSchema7TypeNameCustomSchema,ie as JSONSchema7TypeNameSchema,P as JSONSchema7TypeSchema,V as JSONSchemaCustomSchema,b as JSONSchemaSchema,L as JSONSchemaStandardSchema,I as Listenable,S as LocalScope,Sn as Log,O as Observable,G as ObservableAttribute,ge as ResourceEntrySchema,Se as ResourceLinkSchema,H as RestResource,pr as Schema,he as SecurityGuardSchema,yr as SecurityRuleSchema,Pt as ServiceAccessor,Fn as ServicePoint,Dn as ServicePoints,de as ServiceSchemaSchema,qt as StaticComponentProvider,Rt as StaticContentProvider,ye as TemplateSchema,B as TextBinding,_ as TextTemplate,we as UNARY_OPERATIONS,jn as WriteMode,wn as ZodService,Xt as acquireComponent,en as acquireFutureComponent,tn as acquireResource,qn as acquireServicePoint,Mn as acquireServicePointDescriptor,Gn as areSimilarObjects,An as checkVersionCompatibility,Mt as contentLocalURI,Vt as createComponentFilter,Lt as createComponentPublication,Gt as createLocalComponentProvider,gn as createLogFromError,Un as createServicePoint,On as defineServiceSpec,an as deleteComponent,s as evaluateExpression,pn as failedComponentPublication,un as fetchComponentsPublications,kn as generateTypeScript,Qt as getComponentFromData,Jt as getComponentServicesList,Zt as getDefaultComponent,_n as getServicePoint,Nn as getServiceSchema,Pn as getServiceSchemaFromSpec,In as getServiceZod,Jn as getSettings,vn as jsonSchemaToZod,Kn as listOneOrMany,$n as listenServicePoints,Ln as listenSettings,Dt as matchComponentFilter,Cn as matchesSpecification,zt as parseComponentURI,Ft as parseResourceEntry,Or as parseTextTemplate,yn as queryLogCount,hn as queryLogInfos,mn as queryLogObjects,cn as registerLogCollector,nn as resolveRelativeComponent,on as saveComponent,rn as saveComponentManifest,ln as searchComponentsPublications,Rn as unlistenServicePoints,Vn as unlistenSettings,sn as unregisterComponent,fn as unregisterLogCollector,Bn as updateServicePointDescriptor,Tn as validate,En as validateOrThrow,dn as z,bn as zService,xn as zodToJSONSchema};
package/export.react.js CHANGED
@@ -1,4 +1,4 @@
1
- import{h as g,i as U,m as k}from"./chunk.3AAAY44Q.js";import{a as v,c as y,d as L}from"./chunk.YVZWYQZG.js";import"./chunk.H26D4GQC.js";import{z as a}from"zod";function Ie(r){let e=r||a.record(a.string(),a.any());return{$spec:"spec://jointhedots.org/view.react",version:"0.0",properties:a.object({props:e,requirements:a.object({servicePoints:a.record(a.string(),a.object({service:a.string().optional(),cardinality:a.number().optional()})).optional()}).optional()}),isAssignable(t){return t.$spec=this.$spec}}}var q=v.subservice("react"),Ve=v.subservice("webc");import{useEffect as z,useState as _}from"react";function ke(r,e,t){let[i,o]=_(e);return z(()=>{r().then(o,console.error)},t),i}import w from"react";import{jsx as f}from"react/jsx-runtime";var x=class{constructor(e,t){this.value=e;this.updateTimeout=t}promise=null;dispatch=null;updateTimer=null;shallUpdate=!0;updater;deps;use(e,t){if(this.updater=e,t!==this.deps){let i=this.deps;if(this.deps=t,t?.length===i?.length){if(t){for(let o=0;o<t.length;o++)if(t[o]!==i[o])return this.update()}}else return this.update()}}initiate(e){this.dispatch=e,this.dispatch(this.value)}cancelAutoUpdate(){this.updateTimer&&(clearTimeout(this.updateTimer),this.updateTimer=null)}scheduleAutoUpdate(){this.cancelAutoUpdate(),this.shallUpdate?this.update():this.updateTimeout>0&&(this.updateTimer=setTimeout(()=>{this.updateTimer=null,this.update()},this.updateTimeout))}get isWaiting(){return this.promise!==null}get hasState(){return this.value!==void 0}get autoUpdate(){return this.updateTimeout}set autoUpdate(e){this.updateTimeout=e,this.cancelAutoUpdate(),this.update()}set(e){this.value!==e&&(this.value=e,this.dispatch&&this.dispatch(e))}get(){return this.value}update(){try{if(this.promise)this.shallUpdate=!0,this.cancelAutoUpdate();else{let e=this.updater();this.shallUpdate=!1,e instanceof Promise?(this.promise=e,e.then(t=>{this.promise=null,this.set(t),this.scheduleAutoUpdate()},t=>{this.promise=null,this.scheduleAutoUpdate(),console.log(t)})):this.scheduleAutoUpdate()}}catch(e){this.scheduleAutoUpdate(),console.log(e)}}cancel(){this.dispatch=null,this.promise=null,this.updateTimeout=0,this.cancelAutoUpdate()}waiting(e){return this.isWaiting==!0?f(h,{}):e(this.value)}using(e){return this.hasState==!1?f(h,{}):e(this.value)}};function Ne(r,e,t,i){let[o]=w.useState(()=>new x(t,i)),[s,n]=w.useState(t);return o.use(r,e),w.useEffect(()=>(o.initiate(n),()=>o.cancel()),null),o}function Ae(r,...e){for(let t of e)if(t.isWaiting==!0)return f(h,{});return r()}function Me(r,...e){for(let t of e)if(t.hasState==!1)return f(h,{});return r()}function h(){return f("div",{children:"..."})}import I,{useContext as ee,useEffect as H,useMemo as te,useState as re}from"react";import{Spinner as O}from"react-lightning-design-system";import P,{createContext as X}from"react";var Q=`.JDT-ErrorBoundary {
1
+ import{h as y,i as U,m as L}from"./chunk.CFIED3LN.js";import{a as v,c as w,d as q}from"./chunk.TW6GNY3I.js";import"./chunk.UGWDPVMV.js";import{z as a}from"zod";function Ve(t){let e=t||a.record(a.string(),a.any());return{$spec:"spec://jointhedots.org/view.react",version:"0.0",properties:a.object({props:e,requirements:a.object({servicePoints:a.record(a.string(),a.object({service:a.string().optional(),cardinality:a.number().optional()})).optional()}).optional()}),isAssignable(r){return r.$spec=this.$spec}}}var N=v.subservice("react"),ke=v.subservice("webc");import{useEffect as K,useState as z}from"react";function qe(t,e,r){let[o,i]=z(e);return K(()=>{t().then(i,console.error)},r),o}import T from"react";import{jsx as f}from"react/jsx-runtime";var x=class{constructor(e,r){this.value=e;this.updateTimeout=r}promise=null;dispatch=null;updateTimer=null;shallUpdate=!0;updater;deps;use(e,r){if(this.updater=e,r!==this.deps){let o=this.deps;if(this.deps=r,r?.length===o?.length){if(r){for(let i=0;i<r.length;i++)if(r[i]!==o[i])return this.update()}}else return this.update()}}initiate(e){this.dispatch=e,this.dispatch(this.value)}cancelAutoUpdate(){this.updateTimer&&(clearTimeout(this.updateTimer),this.updateTimer=null)}scheduleAutoUpdate(){this.cancelAutoUpdate(),this.shallUpdate?this.update():this.updateTimeout>0&&(this.updateTimer=setTimeout(()=>{this.updateTimer=null,this.update()},this.updateTimeout))}get isWaiting(){return this.promise!==null}get hasState(){return this.value!==void 0}get autoUpdate(){return this.updateTimeout}set autoUpdate(e){this.updateTimeout=e,this.cancelAutoUpdate(),this.update()}set(e){this.value!==e&&(this.value=e,this.dispatch&&this.dispatch(e))}get(){return this.value}update(){try{if(this.promise)this.shallUpdate=!0,this.cancelAutoUpdate();else{let e=this.updater();this.shallUpdate=!1,e instanceof Promise?(this.promise=e,e.then(r=>{this.promise=null,this.set(r),this.scheduleAutoUpdate()},r=>{this.promise=null,this.scheduleAutoUpdate(),console.log(r)})):this.scheduleAutoUpdate()}}catch(e){this.scheduleAutoUpdate(),console.log(e)}}cancel(){this.dispatch=null,this.promise=null,this.updateTimeout=0,this.cancelAutoUpdate()}waiting(e){return this.isWaiting==!0?f(m,{}):e(this.value)}using(e){return this.hasState==!1?f(m,{}):e(this.value)}};function Me(t,e,r,o){let[i]=T.useState(()=>new x(r,o)),[s,n]=T.useState(r);return i.use(t,e),T.useEffect(()=>(i.initiate(n),()=>i.cancel()),null),i}function Ae(t,...e){for(let r of e)if(r.isWaiting==!0)return f(m,{});return t()}function _e(t,...e){for(let r of e)if(r.hasState==!1)return f(m,{});return t()}function m(){return f("div",{children:"..."})}import D,{useContext as ie,useEffect as A,useMemo as oe,useState as ne}from"react";import G,{createContext as X,useContext as Y,useMemo as ee}from"react";var Q=`.JDT-ErrorBoundary {
2
2
  background-color: rgb(216, 59, 59);
3
3
  padding: 5px;
4
4
  overflow: hidden;
@@ -14,4 +14,39 @@ import{h as g,i as U,m as k}from"./chunk.3AAAY44Q.js";import{a as v,c as y,d as
14
14
  }
15
15
  .JDT-ErrorBoundary > .btn:hover {
16
16
  background-color: rgb(255, 142, 142);
17
- }`;document.head.appendChild(document.createElement("style")).appendChild(document.createTextNode(Q));import{jsx as T,jsxs as G}from"react/jsx-runtime";var p=class extends P.Component{render(){let{error:e,onRetry:t}=this.props,i=`${e.name}: ${e.message}`;return G("div",{className:"JDT-ErrorBoundary",title:i,children:[T("pre",{className:"msg",children:i}),t&&T("button",{className:"btn",onClick:t,children:"Retry"})]})}},M=X(null),N=class extends P.Component{static contextType=M;state={};componentDidCatch(e){let{context:t}=this,i=t?.getErrorDisplayer(e)||Y(e);this.setState({error:e,displayer:i})}render(){let{error:e}=this.state;if(e){let t=this.state.displayer;return T(t,{error:e,onRetry:()=>this.setState({error:void 0})})}else return this.props.children||null}},A=class extends P.Component{static contextType=M;getErrorDisplayer(e){for(let t=e;t;t=Object.getPrototypeOf(t)){let i=t.constructor;for(let o=this;o;o=o.context)if(o.props.errorClass===i)return o.props.errorDisplayer}return null}render(){return this.props.children||null}};function Y(r){for(let e=r;e;e=Object.getPrototypeOf(e)){let t=e.constructor,i=C.get(t);if(i)return i}return null}var C=new Map;C.set(Error,p);function Ze(r,e){C.set(r,e)}import{jsx as m,jsxs as ce}from"react/jsx-runtime";var oe=(o=>(o[o.NotReady=0]="NotReady",o[o.Loading=1]="Loading",o[o.Ready=2]="Ready",o[o.Failed=3]="Failed",o))(oe||{}),d=class extends Error{constructor(t,i){super(`Missing service point: ${t.map(o=>o.id).join(", ")}`);this.missings=t;this.requireds=i}},R=class{consumers=new Set;getService(e){return e.services}addController(e){this.consumers.add(e)}removeController(e){return this.consumers.delete(e)}onServiceChangeHandler=e=>{for(let t of this.consumers)t.notifyChange(e)}},b=class{constructor(e){this.controller=e}getService(e){return this.controller.getService(e)}},E=class{constructor(e,t,i,o){this.support=e;this.requireds=t;this.requirements=i;this.onUpdate=o;e.addController(this)}services=new Map;provider=null;state=null;get status(){return this.state instanceof Promise?1:this.state instanceof d?3:this.state===null?0:2}get error(){if(this.state instanceof d)return this.state}getService(e){let t=this.services.get(e);return!t&&this.support&&(t=this.support.getService(e),this.services.set(e,this.support.getService(e))),e.services}notifyChange(e){this.services.has(e)&&this.update()}updateState(e){let t=this.state;t!==e&&(this.state=e,this.onUpdate?.(e,t,this))}update(){let{requireds:e,requirements:t}=this,i=[],o=null;function s(n){o||(o=new d([])),o.missings.includes(n)||o.missings.push(n)}if(e)for(let n of e)if(n.ready){let c=n.services;c&&this.services.set(n,c)}else i.push(n.fetch());if(t){let{servicePoints:n}=t;for(let c in n){let u=k(c);if(u.ready){let D=u.services,S=n[c];S.service&&u.service!==S.service||D.length<(S.cardinality||1)?s(u):this.services.set(u,D)}else i.push(u.fetch())}}if(i.length>0){let n=Promise.all(i).then(()=>this.update());return this.updateState(n),n}else o?this.updateState(o):(this.provider=new b(this),this.updateState(this.provider));return null}dispose(){this.support&&(this.support.removeController(this),this.support=null)}},V=new R;g(V.onServiceChangeHandler);var ie=I.createContext(V),J=I.createContext(V);function Xe(r){H(()=>{let e=g(r);return()=>U(e)},[r])}function ne(r,e){let t=I.useContext(J);if(!t)return console.error("Wrap in <MountServicePoints> before using service point:",r.id),null;let i=t.getService(r);if(i.length<(e===void 0?1:e))throw new d([r],[r]);return i}function Ye(r,e){return ne(r,e?0:1)[0]}function se(r,e){let t=ee(ie),[,i]=re(null),o=te(()=>new E(t,r,e,i),[r,e]);return H(()=>(o.update(),()=>o?.dispose()),[o]),o}function W(r){let{requireds:e,requirements:t,children:i}=r,o=se(e,t),{provider:s,error:n}=o;if(n){let c=r.configurator;return c?m(c,{services:n.missings}):m(p,{error:n})}else return s?ce(J.Provider,{value:s,children:[i,o.status===1&&m(O,{})]}):m(O,{})}import{useState as F,useEffect as Z}from"react";function rt(){let[r,e]=F(window.location);return Z(()=>{let t=()=>{e(window.location)};return window.addEventListener("popstate",t),window.addEventListener("hashchange",t),()=>{window.removeEventListener("popstate",t),window.removeEventListener("hashchange",t)}},[]),r}function $(){let[r,e]=F(window.location.hash);return Z(()=>{let t=()=>{e(window.location.hash)};return window.addEventListener("hashchange",t),()=>{window.removeEventListener("hashchange",t)}},[]),r}function ot(){let{search:r}=window.location,e={};if(r.startsWith("?"))for(let t of r.slice(1).split("&")){let i=t.split("=");e[i[0]]=decodeURIComponent(i[1])}return e}import{useCallback as ae,useState as le}from"react";function ue(r,e){try{let t=window.localStorage.getItem(r);if(typeof t=="string")return JSON.parse(t)}catch{}return e instanceof Function?e():e}function pe(r,e){return e===void 0?window.localStorage.removeItem(r):window.localStorage.setItem(r,JSON.stringify(e)),e}function st(r,e){let[t,i]=le(ue(r,e)),o=ae(s=>i(pe(r,s)),[r]);return[t,o]}import{useCallback as de,useState as ve}from"react";function fe(r,e){try{let t=window.sessionStorage.getItem(r);if(typeof t=="string")return JSON.parse(t)}catch{}return e instanceof Function?e():e}function he(r,e){return e===void 0?window.sessionStorage.removeItem(r):window.sessionStorage.setItem(r,JSON.stringify(e)),e}function lt(r,e){let[t,i]=ve(fe(r,e)),o=de(s=>i(he(r,s)),[r]);return[t,o]}import{useState as me,useCallback as Se}from"react";function dt(){let[,r]=me(0);return Se(()=>{r(t=>t+1)},[])}import ge,{useContext as ye,useEffect as we,useMemo as j,useState as xe}from"react";import{jsx as l}from"react/jsx-runtime";var K=ge.createContext(null);async function Te(r,e,t){if(r)try{let{component:i,properties:o}=await L(r,e),s=v.spec(i),n=await q.fetch(i);if(!n)throw new Error(`Component '${r.name}' has no 'view.react' service`);let c=l(K.Provider,{value:r,children:l(n,{...o})});return s?.requirements&&(c=l(W,{requirements:s?.requirements,configurator:null,children:c})),c}catch(i){return l(p,{error:i})}return t}function Pe(){return ye(K)}function B(r){let{view:e,origin:t,fallback:i}=r,[o,s]=xe(null),n=j(()=>typeof e!="string"?e:y(e),[e]);return we(()=>{Te(n,t,i).then(s)},[n]),o||null}function Ce(r){let{hash:e,fallback:t}=r,i=j(()=>y(e),[e]);return l(B,{view:i,origin:"url",fallback:t})}function Re(r){let e=$();return l(Ce,{hash:e,fallback:r.fallback})}function wt(r){let e=Pe();return e?e?.nested?l(B,{view:e?.nested,origin:"url",fallback:r.fallback}):r.fallback||null:l(Re,{fallback:r.fallback})}export{x as AsyncState,N as ErrorBoundary,p as ErrorDisplayer,A as ErrorReconcilier,wt as InvokeNestedView,Re as InvokeURLView,Ce as InvokeUrlHashView,B as InvokeView,d as MissingServiceError,Ie as ReactComponentSchema,J as ServicePointsProviderContext,ie as ServicePointsSupportContext,oe as ServiceStatus,W as UseServicePoints,q as ViewReactKey,Ve as ViewWebComponentKey,ot as getLocationQuery,Ze as registerErrorDisplayer,ke as useAsyncMemo,Ne as useAsyncState,Pe as useCurrentView,dt as useForceUpdate,st as useLocalStorage,rt as useLocation,$ as useLocationHash,Ye as useService,ne as useServices,se as useServicesController,Xe as useServicesListener,lt as useSessionStorage,Me as using,Ae as waiting};
17
+ }
18
+
19
+ .JDT-Spinner {
20
+ display: inline-flex;
21
+ align-items: center;
22
+ gap: 6px;
23
+ padding: 8px 0;
24
+ justify-content: center;
25
+ width: 100%;
26
+ }
27
+
28
+ .JDT-Spinner__dot {
29
+ width: 8px;
30
+ height: 8px;
31
+ border-radius: 50%;
32
+ background-color: currentColor;
33
+ opacity: 0.6;
34
+ animation: JDT-SpinnerBounce 1.4s ease-in-out infinite both;
35
+ }
36
+ .JDT-Spinner__dot:nth-child(1) {
37
+ animation-delay: -0.32s;
38
+ }
39
+ .JDT-Spinner__dot:nth-child(2) {
40
+ animation-delay: -0.16s;
41
+ }
42
+
43
+ @keyframes JDT-SpinnerBounce {
44
+ 0%, 80%, 100% {
45
+ transform: scale(0.4);
46
+ opacity: 0.4;
47
+ }
48
+ 40% {
49
+ transform: scale(1);
50
+ opacity: 1;
51
+ }
52
+ }`;document.head.appendChild(document.createElement("style")).appendChild(document.createTextNode(Q));import{jsx as S,jsxs as re}from"react/jsx-runtime";function h({error:t,onRetry:e}){let r=`${t.name}: ${t.message}`;return re("div",{className:"JDT-ErrorBoundary",title:r,children:[S("pre",{className:"msg",children:r}),e&&S("button",{className:"btn",onClick:e,children:"Retry"})]})}var P=X(null),R=class extends G.Component{},J=class extends R{static contextType=P;state={};componentDidCatch(e){let{context:r}=this,o=r?.getErrorDisplayer(e)||te(e);this.setState({error:e,displayer:o})}render(){let{error:e}=this.state;if(e){let r=this.state.displayer;return S(r,{error:e,onRetry:()=>this.setState({error:void 0})})}return this.props.children||null}};function Ze({errorClass:t,errorDisplayer:e,children:r}){let o=Y(P),i=ee(()=>({getErrorDisplayer(s){for(let n=s;n;n=Object.getPrototypeOf(n))if(n.constructor===t)return e;return o?.getErrorDisplayer(s)??null}}),[o,t,e]);return S(P.Provider,{value:i,children:r})}function te(t){for(let e=t;e;e=Object.getPrototypeOf(e)){let r=e.constructor,o=b.get(r);if(o)return o}return null}var b=new Map;b.set(Error,h);function $e(t,e){b.set(t,e)}import{jsx as p,jsxs as H}from"react/jsx-runtime";function M(){return H("div",{className:"JDT-Spinner",children:[p("div",{className:"JDT-Spinner__dot"}),p("div",{className:"JDT-Spinner__dot"}),p("div",{className:"JDT-Spinner__dot"})]})}var se=(i=>(i[i.NotReady=0]="NotReady",i[i.Loading=1]="Loading",i[i.Ready=2]="Ready",i[i.Failed=3]="Failed",i))(se||{}),d=class extends Error{constructor(r,o){super(`Missing service point: ${r.map(i=>i.id).join(", ")}`);this.missings=r;this.requireds=o}},C=class{consumers=new Set;getService(e){return e.services}addController(e){this.consumers.add(e)}removeController(e){return this.consumers.delete(e)}onServiceChangeHandler=e=>{for(let r of this.consumers)r.notifyChange(e)}},E=class{constructor(e){this.controller=e}getService(e){return this.controller.getService(e)}},I=class{constructor(e,r,o,i){this.support=e;this.requireds=r;this.requirements=o;this.onUpdate=i;e.addController(this)}services=new Map;provider=null;state=null;get status(){return this.state instanceof Promise?1:this.state instanceof d?3:this.state===null?0:2}get error(){if(this.state instanceof d)return this.state}getService(e){let r=this.services.get(e);return!r&&this.support&&(r=this.support.getService(e),this.services.set(e,this.support.getService(e))),e.services}notifyChange(e){this.services.has(e)&&this.update()}updateState(e){let r=this.state;r!==e&&(this.state=e,this.onUpdate?.(e,r,this))}update(){let{requireds:e,requirements:r}=this,o=[],i=null;function s(n){i||(i=new d([])),i.missings.includes(n)||i.missings.push(n)}if(e)for(let n of e)if(n.ready){let c=n.services;c&&this.services.set(n,c)}else o.push(n.fetch());if(r){let{servicePoints:n}=r;for(let c in n){let u=L(c);if(u.ready){let k=u.services,g=n[c];g.service&&u.service!==g.service||k.length<(g.cardinality||1)?s(u):this.services.set(u,k)}else o.push(u.fetch())}}if(o.length>0){let n=Promise.all(o).then(()=>this.update());return this.updateState(n),n}else i?this.updateState(i):(this.provider=new E(this),this.updateState(this.provider));return null}dispose(){this.support&&(this.support.removeController(this),this.support=null)}},V=new C;y(V.onServiceChangeHandler);var ce=D.createContext(V),_=D.createContext(V);function Ye(t){A(()=>{let e=y(t);return()=>U(e)},[t])}function ae(t,e){let r=D.useContext(_);if(!r)return console.error("Wrap in <MountServicePoints> before using service point:",t.id),null;let o=r.getService(t);if(o.length<(e===void 0?1:e))throw new d([t],[t]);return o}function et(t,e){return ae(t,e?0:1)[0]}function le(t,e){let r=ie(ce),[,o]=ne(null),i=oe(()=>new I(r,t,e,o),[t,e]);return A(()=>(i.update(),()=>i?.dispose()),[i]),i}function O(t){let{requireds:e,requirements:r,children:o}=t,i=le(e,r),{provider:s,error:n}=i;if(n){let c=t.configurator;return c?p(c,{services:n.missings}):p(h,{error:n})}else return s?H(_.Provider,{value:s,children:[o,i.status===1&&p(M,{})]}):p(M,{})}import{useState as W,useEffect as j}from"react";function ot(){let[t,e]=W(window.location);return j(()=>{let r=()=>{e(window.location)};return window.addEventListener("popstate",r),window.addEventListener("hashchange",r),()=>{window.removeEventListener("popstate",r),window.removeEventListener("hashchange",r)}},[]),t}function F(){let[t,e]=W(window.location.hash);return j(()=>{let r=()=>{e(window.location.hash)};return window.addEventListener("hashchange",r),()=>{window.removeEventListener("hashchange",r)}},[]),t}function nt(){let{search:t}=window.location,e={};if(t.startsWith("?"))for(let r of t.slice(1).split("&")){let o=r.split("=");e[o[0]]=decodeURIComponent(o[1])}return e}import{useCallback as ue,useState as pe}from"react";function de(t,e){try{let r=window.localStorage.getItem(t);if(typeof r=="string")return JSON.parse(r)}catch{}return e instanceof Function?e():e}function ve(t,e){return e===void 0?window.localStorage.removeItem(t):window.localStorage.setItem(t,JSON.stringify(e)),e}function at(t,e){let[r,o]=pe(de(t,e)),i=ue(s=>o(ve(t,s)),[t]);return[r,i]}import{useCallback as fe,useState as he}from"react";function me(t,e){try{let r=window.sessionStorage.getItem(t);if(typeof r=="string")return JSON.parse(r)}catch{}return e instanceof Function?e():e}function Se(t,e){return e===void 0?window.sessionStorage.removeItem(t):window.sessionStorage.setItem(t,JSON.stringify(e)),e}function pt(t,e){let[r,o]=he(me(t,e)),i=fe(s=>o(Se(t,s)),[t]);return[r,i]}import{useState as ge,useCallback as ye}from"react";function ft(){let[,t]=ge(0);return ye(()=>{t(r=>r+1)},[])}import we,{useContext as Te,useEffect as xe,useMemo as Z,useState as Pe}from"react";import{jsx as l}from"react/jsx-runtime";var $=we.createContext(null);async function Re(t,e,r){if(t)try{let{component:o,properties:i}=await q(t,e),s=v.spec(o),n=await N.fetch(o);if(!n)throw new Error(`Component '${t.name}' has no 'view.react' service`);let c=l($.Provider,{value:t,children:l(n,{...i})});return s?.requirements&&(c=l(O,{requirements:s?.requirements,configurator:null,children:c})),c}catch(o){return l(h,{error:o})}return r}function be(){return Te($)}function B(t){let{view:e,origin:r,fallback:o}=t,[i,s]=Pe(null),n=Z(()=>typeof e!="string"?e:w(e),[e]);return xe(()=>{Re(n,r,o).then(s)},[n]),i||null}function Ce(t){let{hash:e,fallback:r}=t,o=Z(()=>w(e),[e]);return l(B,{view:o,origin:"url",fallback:r})}function Ee(t){let e=F();return l(Ce,{hash:e,fallback:t.fallback})}function xt(t){let e=be();return e?e?.nested?l(B,{view:e?.nested,origin:"url",fallback:t.fallback}):t.fallback||null:l(Ee,{fallback:t.fallback})}export{x as AsyncState,J as ErrorBoundary,h as ErrorDisplayer,Ze as ErrorReconcilier,xt as InvokeNestedView,Ee as InvokeURLView,Ce as InvokeUrlHashView,B as InvokeView,d as MissingServiceError,Ve as ReactComponentSchema,_ as ServicePointsProviderContext,ce as ServicePointsSupportContext,se as ServiceStatus,O as UseServicePoints,N as ViewReactKey,ke as ViewWebComponentKey,nt as getLocationQuery,$e as registerErrorDisplayer,qe as useAsyncMemo,Me as useAsyncState,be as useCurrentView,ft as useForceUpdate,at as useLocalStorage,ot as useLocation,F as useLocationHash,et as useService,ae as useServices,le as useServicesController,Ye as useServicesListener,pt as useSessionStorage,_e as using,Ae as waiting};
package/export.rest.js CHANGED
@@ -1 +1 @@
1
- import{r as a,s as b,t as c}from"./chunk.H26D4GQC.js";export{c as REST,a as RESTServiceKey,b as __import_RESTService};
1
+ import{r as a,s as b,t as c}from"./chunk.UGWDPVMV.js";export{c as REST,a as RESTServiceKey,b as __import_RESTService};
package/export.storage.js CHANGED
@@ -1 +1 @@
1
- import"./chunk.LFHCE3KB.js";import"./chunk.3AAAY44Q.js";import{a as e}from"./chunk.H26D4GQC.js";var r=new e("storage");export{r as StorageServiceKey};
1
+ import"./chunk.LFHCE3KB.js";import"./chunk.CFIED3LN.js";import{a as e}from"./chunk.UGWDPVMV.js";var r=e.About("storage");export{r as StorageServiceKey};
package/export.view.js CHANGED
@@ -1 +1 @@
1
- import{a,b,c,d,e,f,g}from"./chunk.YVZWYQZG.js";import"./chunk.H26D4GQC.js";export{a as ViewServiceKey,d as evaluateViewInfos,c as getViewInfosFrom,b as getViewReferenceFrom,e as getViewURL,f as gotoURLView,g as updateURLView};
1
+ import{a,b,c,d,e,f,g}from"./chunk.TW6GNY3I.js";import"./chunk.UGWDPVMV.js";export{a as ViewServiceKey,d as evaluateViewInfos,c as getViewInfosFrom,b as getViewReferenceFrom,e as getViewURL,f as gotoURLView,g as updateURLView};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jointhedots/core",
3
- "version": "2.0.22",
3
+ "version": "2.0.24",
4
4
  "type": "module",
5
5
  "singleton": true,
6
6
  "exports": {
@@ -34,7 +34,6 @@
34
34
  "astring": "^1.9.0",
35
35
  "json-schema": "^0.4.0",
36
36
  "query-string": "^9.1.0",
37
- "react-lightning-design-system": "^5.9.1",
38
37
  "vscode-uri": "^3.1.0",
39
38
  "yaml": "^2.8.2",
40
39
  "zod": "^4.2.1"
@@ -42,10 +41,5 @@
42
41
  "peerDependencies": {
43
42
  "react": "^18.2.0",
44
43
  "react-dom": "^18.2.0"
45
- },
46
- "overrides": {
47
- "react-lightning-design-system": {
48
- "react-relative-portal": "../../deps/react-relative-portal-1.3.1.tgz"
49
- }
50
44
  }
51
45
  }
package/types.d.ts CHANGED
@@ -389,18 +389,23 @@ declare module '@jointhedots/core/src/schema/schema' {
389
389
  export type JSONSchema = z.infer<typeof JSONSchemaSchema>;
390
390
  }
391
391
 
392
- declare module '@jointhedots/core/src/services/service-entry' {
392
+ declare module '@jointhedots/core/src/services/service-accessor' {
393
393
  import type { ComponentEntry } from '@jointhedots/core/src/components/manifold';
394
394
  export type ServiceType = string;
395
- export class ServiceEntry<Instance extends any, Spec extends any> {
395
+ export class ServiceAccessor<Instance extends any, Spec extends any> {
396
396
  resource: string;
397
397
  definition: any;
398
- constructor(resource: string, definition?: any);
399
- defintiion(): void;
398
+ private constructor();
399
+ /** Synchronously retrieves the service instance from the given component entry. Returns undefined if the resource is not available. */
400
400
  get(entry: ComponentEntry): Instance;
401
+ /** Asynchronously fetches the service instance from the given component entry, waiting until the resource becomes available. */
401
402
  fetch(entry: ComponentEntry): Promise<Instance>;
403
+ /** Returns the specification/configuration associated with this service from the given component entry. */
402
404
  spec(entry: ComponentEntry): Spec;
403
- subservice<T extends any>(name: string): ServiceEntry<T, Spec>;
405
+ /** Creates a child service accessor scoped under this service's resource path. */
406
+ subservice<T extends any>(name: string): ServiceAccessor<T, Spec>;
407
+ /** Factory method that creates a new ServiceAccessor for the given resource name and optional definition. */
408
+ static About<Instance extends any, Spec extends any>(resource: string, definition?: any): ServiceAccessor<Instance, Spec>;
404
409
  }
405
410
  }
406
411
 
@@ -408,7 +413,8 @@ declare module '@jointhedots/core/src/components/components' {
408
413
  import { URI } from 'vscode-uri';
409
414
  import type { DocumentationSchema, JSONSchema, ResourceEntry } from '@jointhedots/core/src/schema/schema';
410
415
  import type { ComponentEntry } from '@jointhedots/core/src/components/manifold';
411
- import { ServiceEntry, type ServiceType } from '@jointhedots/core/src/services/service-entry';
416
+ import { ServiceAccessor, type ServiceType } from '@jointhedots/core/src/services/service-accessor';
417
+ import React from 'react';
412
418
  export type ComponentID = string;
413
419
  export interface ComponentPublication {
414
420
  id: ComponentID;
@@ -477,7 +483,7 @@ declare module '@jointhedots/core/src/components/components' {
477
483
  updateComponent(component: ComponentEntry, descriptor: ComponentManifest): Promise<void>;
478
484
  checkDescriptor(descriptor: ComponentManifest): Promise<ComponentChecking>;
479
485
  }
480
- export const ComponentControllerKey: ServiceEntry<ComponentController, ComponentSchema>;
486
+ export const ComponentControllerKey: ServiceAccessor<ComponentController, ComponentSchema>;
481
487
  export type ComponentEditorProps<T extends ComponentManifest = ComponentManifest> = {
482
488
  descriptor: ComponentSchema;
483
489
  schema: JSONSchema;
@@ -495,7 +501,7 @@ declare module '@jointhedots/core/src/components/components' {
495
501
  editor: React.ComponentType<ComponentEditorProps<T>>;
496
502
  preview?: React.ComponentType<ComponentPreviewProps<T>>;
497
503
  };
498
- export const EditorKey: ServiceEntry<ComponentEditor<ComponentManifest<unknown>>, unknown>;
504
+ export const EditorKey: ServiceAccessor<ComponentEditor<ComponentManifest<unknown>>, unknown>;
499
505
  export type ComponentFilter = {
500
506
  query: string;
501
507
  pattern: RegExp;
@@ -639,12 +645,12 @@ declare module '@jointhedots/core/src/providers/components/LocalComponentProvide
639
645
  declare module '@jointhedots/core/rest' {
640
646
  import { URI } from 'vscode-uri';
641
647
  import { ComponentEntry } from '@jointhedots/core/src/components/manifold';
642
- import { ServiceEntry } from '@jointhedots/core/src/services/service-entry';
648
+ import { ServiceAccessor } from '@jointhedots/core/src/services/service-accessor';
643
649
  export interface RESTService {
644
650
  getUrl(path: string): string;
645
651
  invoke(path: string, init?: RequestInit): Promise<Response>;
646
652
  }
647
- export const RESTServiceKey: ServiceEntry<RESTService, unknown>;
653
+ export const RESTServiceKey: ServiceAccessor<RESTService, unknown>;
648
654
  export type RESTServiceImport = {
649
655
  type?: "api.rest";
650
656
  endpoint?: string;
@@ -1138,7 +1144,7 @@ declare module '@jointhedots/core/src/services/settings' {
1138
1144
  declare module '@jointhedots/core/src/services/service-points' {
1139
1145
  import { type ComponentID } from '@jointhedots/core/src/components/components';
1140
1146
  import { type ILogDispatcher, type LogObject } from 'src/logging';
1141
- import { ServiceEntry, type ServiceType } from '@jointhedots/core/src/services/service-entry';
1147
+ import { ServiceAccessor, type ServiceType } from '@jointhedots/core/src/services/service-accessor';
1142
1148
  export const ServicePoints: Map<string, ServicePoint>;
1143
1149
  export type ServicePointID = string;
1144
1150
  export type ServicePointProperties = {
@@ -1175,14 +1181,14 @@ declare module '@jointhedots/core/src/services/service-points' {
1175
1181
  export function updateServicePointDescriptor(id: string, properties: ServicePointProperties): ServicePointSetting;
1176
1182
  export function getServicePoint<IService>(id: string): ServicePoint<IService>;
1177
1183
  export function acquireServicePoint<IService>(id: string): ServicePoint<IService>;
1178
- export function createServicePoint<S extends any, D extends any>(service: ServiceEntry<S, D>, name: ServicePointID, properties?: ServicePointProperties): ServicePoint<S>;
1184
+ export function createServicePoint<S extends any, D extends any>(service: ServiceAccessor<S, D>, name: ServicePointID, properties?: ServicePointProperties): ServicePoint<S>;
1179
1185
  }
1180
1186
 
1181
1187
  declare module 'src/services' {
1182
1188
  export * from '@jointhedots/core/src/services/service-definitions';
1183
1189
  export * from '@jointhedots/core/src/services/service-points';
1184
1190
  export * from '@jointhedots/core/src/services/service-specification';
1185
- export * from '@jointhedots/core/src/services/service-entry';
1191
+ export * from '@jointhedots/core/src/services/service-accessor';
1186
1192
  export * from '@jointhedots/core/src/services/settings';
1187
1193
  }
1188
1194
 
@@ -1549,41 +1555,44 @@ declare module '@jointhedots/core/src/interfaces/react/ErrorBoundary' {
1549
1555
  error: E;
1550
1556
  onRetry?: () => void;
1551
1557
  }>;
1552
- export class ErrorDisplayer extends React.Component<{
1558
+ export function ErrorDisplayer({ error, onRetry }: {
1553
1559
  error: Error;
1554
1560
  onRetry?: () => void;
1555
- }> {
1556
- render(): import( 'react/jsx-runtime').JSX.Element;
1557
- }
1558
- export class ErrorBoundary extends React.Component<{
1561
+ }): any;
1562
+ interface IErrorReconcilier {
1563
+ getErrorDisplayer(error: Error): ErrorDisplayerType | null;
1564
+ } class Component<P = {}, S = {}> extends React.Component<P, S> {
1565
+ props: Readonly<P>;
1566
+ setState: React.Component<P, S>['setState'];
1567
+ }
1568
+ export class ErrorBoundary extends Component<{
1559
1569
  children: React.ReactNode;
1570
+ }, {
1571
+ error?: Error;
1572
+ displayer?: ErrorDisplayerType;
1560
1573
  }> {
1561
- static contextType: React.Context<ErrorReconcilier>;
1562
- context: ErrorReconcilier;
1574
+ static contextType: any;
1575
+ context: IErrorReconcilier;
1563
1576
  state: {
1564
1577
  error?: Error;
1565
1578
  displayer?: ErrorDisplayerType;
1566
1579
  };
1567
1580
  componentDidCatch(error: Error): void;
1568
- render(): string | number | true | Iterable<React.ReactNode> | import( 'react/jsx-runtime').JSX.Element;
1581
+ render(): any;
1569
1582
  }
1570
- export class ErrorReconcilier extends React.Component<{
1583
+ export function ErrorReconcilier({ errorClass, errorDisplayer, children }: {
1571
1584
  errorClass: new () => Error;
1572
1585
  errorDisplayer: ErrorDisplayerType;
1573
1586
  children: React.ReactNode;
1574
- }> {
1575
- static contextType: React.Context<ErrorReconcilier>;
1576
- context: ErrorReconcilier;
1577
- getErrorDisplayer(error: Error): ErrorDisplayerType<Error>;
1578
- render(): string | number | true | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode>;
1579
- }
1587
+ }): any;
1580
1588
  export function registerErrorDisplayer<E extends Error>(errorClass: new (...args: any[]) => E, displayer: ErrorDisplayerType<E>): void;
1589
+ export {};
1581
1590
  }
1582
1591
 
1583
1592
  declare module '@jointhedots/core/view' {
1584
1593
  import { ComponentEntry } from '@jointhedots/core/src/components/manifold';
1585
- import { ServiceEntry } from '@jointhedots/core/src/services/service-entry';
1586
- export const ViewServiceKey: ServiceEntry<any, any>;
1594
+ import { ServiceAccessor } from '@jointhedots/core/src/services/service-accessor';
1595
+ export const ViewServiceKey: ServiceAccessor<any, any>;
1587
1596
  export type ViewInfos = {
1588
1597
  name: string;
1589
1598
  params?: Record<string, ViewParam | ViewParam[] | Record<string, ViewParam>>;
@@ -1611,7 +1620,8 @@ declare module '@jointhedots/core/src/interfaces/react/useLocation' {
1611
1620
 
1612
1621
  declare module '@jointhedots/core/src/interfaces/react/interface' {
1613
1622
  import { z, type ZodObject, type ZodRawShape } from 'zod';
1614
- import { ServiceEntry, type ServiceDefinition, type ServiceInterface } from 'src/services';
1623
+ import { type ServiceDefinition, type ServiceInterface } from 'src/services';
1624
+ import React from 'react';
1615
1625
  export type ViewServicePoint = {
1616
1626
  service?: string;
1617
1627
  cardinality?: number;
@@ -1710,9 +1720,9 @@ declare module '@jointhedots/core/src/interfaces/react/interface' {
1710
1720
  requirements?: ViewRequirements;
1711
1721
  };
1712
1722
  export type ViewReactService<T = any> = React.ComponentType<T>;
1713
- export const ViewReactKey: ServiceEntry<ViewReactService<any>, any>;
1723
+ export const ViewReactKey: import( '@jointhedots/core').ServiceAccessor<React.ComponentType<T>, any>;
1714
1724
  export type ViewWebComponentService = new (...props: any[]) => HTMLElement;
1715
- export const ViewWebComponentKey: ServiceEntry<ViewWebComponentService, any>;
1725
+ export const ViewWebComponentKey: import( '@jointhedots/core').ServiceAccessor<ViewWebComponentService, any>;
1716
1726
  }
1717
1727
 
1718
1728
  declare module '@jointhedots/core/src/interfaces/react/useServices' {
@@ -1760,28 +1770,28 @@ declare module '@jointhedots/core/src/interfaces/react/useServices' {
1760
1770
  requirements?: ViewRequirements;
1761
1771
  configurator: ServiceConfiguratorComponent;
1762
1772
  children: any;
1763
- }): import( 'react/jsx-runtime').JSX.Element;
1773
+ }): any;
1764
1774
  }
1765
1775
 
1766
1776
  declare module '@jointhedots/core/src/interfaces/react/ViewUrl' {
1767
- import React, { type ReactElement } from 'react';
1777
+ import { type ReactElement } from 'react';
1768
1778
  import { type ViewInfos } from '@jointhedots/core/view';
1769
- export function useCurrentView(): ViewInfos;
1779
+ export function useCurrentView(): any;
1770
1780
  export function InvokeView(props: {
1771
1781
  view: string | ViewInfos;
1772
1782
  origin?: string;
1773
1783
  fallback?: ReactElement;
1774
- }): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
1784
+ }): any;
1775
1785
  export function InvokeUrlHashView(props: {
1776
1786
  hash: string;
1777
1787
  fallback?: ReactElement;
1778
- }): import( 'react/jsx-runtime').JSX.Element;
1788
+ }): any;
1779
1789
  export function InvokeURLView(props: {
1780
1790
  fallback?: ReactElement;
1781
- }): import( 'react/jsx-runtime').JSX.Element;
1791
+ }): any;
1782
1792
  export function InvokeNestedView(props: {
1783
1793
  fallback?: ReactElement;
1784
- }): import( 'react/jsx-runtime').JSX.Element;
1794
+ }): any;
1785
1795
  }
1786
1796
 
1787
1797
  declare module '@jointhedots/core/src/interfaces/react/useAsyncMemo' {
@@ -1833,7 +1843,7 @@ declare module '@jointhedots/core/src/interfaces/react/useSessionStorage' {
1833
1843
  }
1834
1844
 
1835
1845
  declare module '@jointhedots/core/src/interfaces/react/useForceUpdate' {
1836
- export function useForceUpdate(): () => void;
1846
+ export function useForceUpdate(): any;
1837
1847
  }
1838
1848
 
1839
1849
  declare module '@jointhedots/core/react' {
@@ -1884,7 +1894,7 @@ declare module '@jointhedots/core/src/interfaces/rest/decorators' {
1884
1894
  }
1885
1895
 
1886
1896
  declare module '@jointhedots/core/storage' {
1887
- import { ServiceEntry } from 'src/services';
1897
+ import { ServiceAccessor } from 'src/services';
1888
1898
  export type NameSpaceId = string;
1889
1899
  export type FileKey = string;
1890
1900
  export type ChangeSetId = string;
@@ -1946,7 +1956,7 @@ declare module '@jointhedots/core/storage' {
1946
1956
  getFileLog(key: FileKey): Promise<StorageChangeLog>;
1947
1957
  }
1948
1958
  export type StorageDescriptor = void;
1949
- export const StorageServiceKey: ServiceEntry<StorageService, void>;
1959
+ export const StorageServiceKey: ServiceAccessor<StorageService, void>;
1950
1960
  }
1951
1961
 
1952
1962
  declare module '@jointhedots/core/src/scripting/graph/log' {
@@ -1964,6 +1974,7 @@ declare module '@jointhedots/core/src/scripting/graph/log' {
1964
1974
  declare module '@jointhedots/core/src/scripting/graph/uses' {
1965
1975
  import type { AST } from '@jointhedots/core/src/scripting/ast/api';
1966
1976
  import { type Node, type ContextInstance, type FeatureID } from '@jointhedots/core/src/scripting/graph/model';
1977
+ import React from 'react';
1967
1978
  export type ValueRecast = (x: any) => any;
1968
1979
  export class ValueType {
1969
1980
  accept(ty: ValueType): boolean;
package/chunk.H26D4GQC.js DELETED
@@ -1 +0,0 @@
1
- import{URI as q}from"vscode-uri";import{URI as me,Utils as ue}from"vscode-uri";var l=class t{constructor(e,n=null){this.resource=e;this.definition=n}defintiion(){}get(e){return e.getResource(this.resource)?.get()}fetch(e){return e.fetchResource(this.resource)}spec(e){return e.acquireResource(this.resource)?.spec}subservice(e){return new t(`${this.resource}.${e}`)}};var L=new l("component"),_e=new l("editor");var P={object:{async read(t){let e=await t.text();return JSON.parse(e)},async write(t){let e=JSON.stringify(t);return new Blob([e],{type:"application/json"})}},text:{async read(t){return t.text()},async write(t){return new Blob([t],{type:"text/plain"})}}};function O(t){let[e,n]=t.split(","),o=e.match(/data:([^;]+)/),r=o?o[1]:"application/octet-stream",s=atob(n),i=new Uint8Array(s.length);for(let c=0;c<s.length;c++)i[c]=s.charCodeAt(c);return new Blob([i],{type:r})}function U(t){let e=t.match(/data:([^;]+)/);return e?e[1]:"application/octet-stream"}async function B(t){return new Promise((e,n)=>{let o=new FileReader;o.onloadend=()=>e(o.result),o.onerror=n,o.readAsDataURL(t)})}import{URI as D}from"vscode-uri";function w(t){if(t.startsWith("./")){let e=D.parse(window.location.href),n=e.path.split("/");return n[n.length-1]=t.slice(2),e.with({path:n.join("/"),query:"",fragment:""})}else return t.startsWith("/")?D.parse(window.location.href).with({path:t,query:"",fragment:""}):D.parse(t)}async function z(t){let e=t.services?Object.keys(t.services):[];if(t.type){let n=await u(t.type)?.fetch();if(n){for(let o in n?.services)if(o.startsWith("component.")){let r=o.slice(10);e.includes(r)||e.push(r)}}else throw new Error("Cannot create publiction properly")}return e}async function v(t){let{$id:e}=t;return{id:e,type:t.type,icon:t.icon,title:t.title||e,description:t.description||"",keywords:t.keywords,tags:t.tags,services:await z(t)}}function ve(t){let e={query:t?.query||"",pattern:t?.pattern||null,tags:t?.tags||[],keywords:t?.keywords||[],services:t?.services||[],types:t?.types||[]};if(e.query.length>0)for(let n of e.query.split(/\s/))n.length>0&&!e.keywords.includes(n)&&e.keywords.push(n);return e.keywords.length>0&&(e.pattern=new RegExp(`(${e.keywords.join(").*(")})`)),e}function h(t,e){function n(s,i){return i?s?!i||i.test(s):!1:!0}function o(s,i){return!!(i.length===0||s&&i.includes(s))}function r(s,i){if(i.length===0)return!0;if(s){for(let c of s)if(i.includes(c))return!0}return!1}return!(!n(t.title||t.id,e.pattern)&&!n(t.description,e.pattern)||!r(t.services,e.services)||!r(t.keywords,e.keywords)||!r(t.tags,e.tags)||!o(t.type,e.types))}function F(t){if(typeof t=="string"){let[e,n]=t.split("#",2),o={type:"module",location:e};if(n){let[r,s]=n.split("?",2);if(o.identifier=r,s)for(let i of s.split("&")){let[c,p]=i.split("=");o[c]=p===void 0?!0:p}}return o}return t}var x=class{constructor(e){this.storage=e}modules_exports=new Map;baseUrl=X(import.meta.url);async load_resource(e){if(this.modules_exports.has(e))return this.modules_exports.get(e);let n=w(e);switch(await this.storage.check_content(n)){case"application/json":case"text/json":return this.import_module_json(e,n);default:return this.import_module_esm(e,n)}}async import_module_json(e,n){let o=await this.storage.load_content(n);return P.object.read(o)}async import_module_esm(e,n){let o=n.toString();try{let r=await import(o);return this.modules_exports.set(e,r),r}catch(r){throw r.message=`Cannot import '${o}': ${r.message}`,r}}};function X(t){let e=t.split("/");return e.pop(),e.join("/")}import{URI as Y}from"vscode-uri";var I=class{async check_url_content(e){let n=await fetch(e,{method:"HEAD"});if(n.ok){let o=n.headers.get("content-type");return o?o.split(";")[0].trim():"application/octet-stream"}return null}async load_url_content(e){let n=await fetch(e);if(n.ok)return n.blob();throw new Error(`Fetch failed ${n.statusText} ${n.status} '${e}'`)}async check_content(e){if(e.scheme==="local"){let n=e.toString(),o=localStorage.getItem(n);if(o)return U(o);throw new Error(`Unsupported local content uri: ${e}`)}else return this.check_url_content(e.toString())}async load_content(e){if(e.scheme==="local"){let n=e.toString();if(localStorage.getItem(n))return O(localStorage.getItem(n));throw new Error(`Unsupported local content uri: ${e}`)}else return this.load_url_content(e.toString())}async store_content(e,n){if(n.scheme==="local"){let o=n.toString(),r=await B(e);return localStorage.setItem(o,r),!0}return!1}};function je(t,e,n){let o=n?`/${e}/${n}`:`/${e}`;return Y.from({scheme:"local",authority:t,path:o})}var _=class{pubs=new Map;constructor(e=[]){for(let n of e)this.pubs.set(n.id,n)}async get_component_publication(e){return this.pubs.get(e)}async search_component_publications(e){let n=[];for(let o of this.pubs.values())h(o,e)&&n.push(o);return n}},S=class extends _{manifests=new Map;async add_component(e){let n=await v(e);return this.manifests.set(n.id,e),this.pubs.set(n.id,n),n}async delete_component(e){return this.manifests.delete(e),this.pubs.delete(e),!0}async get_component_manifest(e){return this.manifests.get(e)}async set_component_manifest(e,n){return!1}};var R=class{constructor(e){this.content_provider=e}manifest=null;catalog=null;async get_provider_bundle(){return this.manifest||(this.manifest=await(await fetch("./bundle.manifest.json")).json()),this.manifest}async get_component_catalog(){if(!this.catalog){let e=await this.get_provider_bundle();this.catalog=new _(e.data?.components)}return this.catalog}async get_component_publication(e){return(await this.get_component_catalog()).get_component_publication(e)}async search_component_publications(e){return(await this.get_component_catalog()).search_component_publications(e)}async get_component_manifest(e){try{let o=(await this.get_provider_bundle()).data.components.find(r=>r.id===e);if(o){let r=w(o.ref?`./${o.ref}`:`./${e}.json`),s=await this.content_provider.load_content(r);if(s)return P.object.read(s)}}catch{}return null}async set_component_manifest(e,n){return!1}async add_component(e){return null}async delete_component(e){return!1}};var M=class{constructor(e=[]){this.providers=e}add_provider(e){this.providers.push(e)}async get_component_publication(e){for(let n of this.providers){let o=await n.get_component_publication(e);if(o)return o}return null}async search_component_publications(e){let n=[];for(let o of this.providers){let r=await o.search_component_publications(e);r&&n.push(...r)}return n}async get_component_manifest(e){for(let n of this.providers){let o=await n.get_component_manifest(e);if(o)return o}return null}async set_component_manifest(e,n){for(let o of this.providers)if(await o.set_component_manifest(e,n))return!0;return!1}async add_component(e){for(let n of this.providers){let o=await n.add_component(e);if(o)return o}return null}async delete_component(e){for(let n of this.providers)if(await n.delete_component(e))return!0;return!1}};var N=5;function Z(){return new Promise((t,e)=>{let n=window.indexedDB.open("LocalComponents",N);n.onerror=o=>{console.error("Database error:",o.target.error),e(o.target.error)},n.onupgradeneeded=()=>{console.log("Upgrade LocalComponents to ",N);debugger;let o=n.result;o.objectStoreNames.contains("components_manifests")&&o.deleteObjectStore("components_manifests"),o.objectStoreNames.contains("components_services")&&o.deleteObjectStore("components_services"),o.objectStoreNames.contains("components")&&o.deleteObjectStore("components"),o.createObjectStore("components",{keyPath:"id"}).createIndex("title","title",{unique:!1});let s=o.createObjectStore("components_services",{keyPath:["component_id","service"]});s.createIndex("component_id","component_id",{unique:!1}),s.createIndex("service","service",{unique:!1}),o.createObjectStore("components_manifests",{keyPath:"component_id"}).createIndex("component_id","component_id",{unique:!1})},n.onsuccess=()=>{let o=n.result;o.onerror=r=>{console.error("Database error:",r)},t(n.result)}})}function ee(t,e){return new Promise((n,o)=>{let r=[],c=t.transaction(["components_manifests"],"readonly").objectStore("components_manifests").getAll(e);c.onsuccess=()=>{n(c.result?.[0]?.manifest)},c.onerror=p=>{o(p.target.error)}})}function te(t,e){let o=t.transaction(["components","components_services"],"readonly").objectStore("components");return new Promise((r,s)=>{let i=o.get(e);i.onsuccess=()=>{r(i.result)},i.onerror=c=>{s(c.target.error)}})}function A(t,e){let o=t.transaction(["components","components_services"],"readonly").objectStore("components"),r=[];for(let s of e)r.push(new Promise((i,c)=>{let p=o.get(s);p.onsuccess=()=>{i(p.result)},p.onerror=m=>{c(m.target.error)}}));return Promise.all(r)}function ne(t,e){return new Promise((n,o)=>{let i=t.transaction(["components"],"readonly").objectStore("components").openCursor(),c=[];i.onsuccess=()=>{let p=i.result;if(p){let m=p.value;e(m)&&c.push(p.value),p.continue()}else n(c)},i.onerror=()=>{o(i.error)}})}function oe(t,e,n){let s=t.transaction(["components_services"],"readonly").objectStore("components_services").index("service"),i=[];for(let c of e)i.push(new Promise((p,m)=>{let d=s.getAll(c);d.onsuccess=async()=>{for(let b of d.result)b.service===c&&n.add(b.component_id);p(void 0)},d.onerror=b=>{m(b.target.error)}}));return Promise.all(i)}async function re(t,e){let{services:n}=e;if(n&&n.length>0){let o=[],r=new Set;await oe(t,n,r);for(let s of await A(t,Array.from(r)))h(s,e)&&o.push(s);return o}else return ne(t,o=>h(o,e))}function se(t,e){return new Promise(async(n,o)=>{let r=await v(e),s=t.transaction(["components","components_services","components_manifests"],"readwrite");s.objectStore("components").put(r);let c=s.objectStore("components_services");for(let m of r.services)c.put({component_id:r.id,service:m});s.objectStore("components_manifests").put({component_id:r.id,manifest:e}),s.onerror=m=>o(m.target.error),s.oncomplete=()=>n(r),s.commit()})}function ie(t,e){return new Promise(async(n,o)=>{let r=await te(t,e);if(r){let s=t.transaction(["components","components_services","components_manifests"],"readwrite");s.objectStore("components").delete(e);let c=s.objectStore("components_services");for(let m of r.services)c.delete([e,m]);s.objectStore("components_manifests").delete(e),s.onerror=m=>o(m.target.error),s.oncomplete=()=>n(!0),s.commit()}else n(!1)})}var T=class{db=Z();async get_component_publication(e){return(await A(await this.db,[e]))[0]}async search_component_publications(e){return re(await this.db,e)}async get_component_manifest(e){return ee(await this.db,e)}async set_component_manifest(e,n){return!1}async add_component(e){return se(await this.db,e)}async delete_component(e){return ie(await this.db,e)}};function J(){try{if(window)return new T}catch{}return new S}var $=class{notifyError(e,n){console.error(e),this.notifyObject(pe(e,n))}notifyObject(e){f.push(e),console.log(e)}},E=new Set,f=[],K=0,ce=new $;ae(ce);function W(){return K++,"id-"+Date.now().toString(36)+"-"+K.toString(2)}function ae(t){E.add(t)}function Je(t){E.delete(t)}function Ke(){return f.length}function Q(t,e){let n=[];for(let o of f)if(e===void 0||e===o.component_id){if(n.length>=t)return{objects:n,hasMore:!0};n.push(o)}return{objects:n,hasMore:!1}}function G(t){return f.reduce((e,n)=>{if(t===void 0||t===n.component_id)switch(n.status){case"error":e.error_count++,e.warn_count++,e.notify_count++,e.info_count++;break;case"warn":e.warn_count++,e.notify_count++,e.info_count++;break;case"notify":e.notify_count++,e.info_count++;break;case"info":e.info_count++;break}return e},{action_expected_count:0,error_count:0,warn_count:0,notify_count:0,info_count:0})}var y={send(t){setTimeout(()=>{for(let e of E)e.notifyObject(t)},0)},error(t,e){setTimeout(()=>{for(let n of E)n.notifyError(t,e)},0)},event(t,e){let n=g(t),o=W();y.send({...e,kind:"event",status:e.status||"error",message:e.message||`Issue with component: ${o}`,component_id:n.id,id:o})},openTicket(t,e,n){let o=g(t),r=`${o.id}/${e}`;y.send({...n,kind:"ticket",status:n.status||"error",message:n.message||`Issue with component: ${r}`,component_id:o.id,id:r})},closeTicket(t,e){let o=`${g(t).id}/${e}`,r=f.findIndex(s=>s.id===o);if(r>=0){let s=f[r];f.splice(r,1),y.event(t,{...s,kind:"event",status:"info",icon:"[success]bi:check-circle",message:`[closed] ${s.message}`,actions:void 0,doc_uri:void 0})}}};function pe(t,e){return{id:W(),kind:"event",status:"error",component_id:g(e).id,message:t.message}}var C=class{constructor(e){this.id=e}__instance__=void 0;manifest=void 0;get title(){return this.id}get namespace(){let e=this.id.indexOf(":");switch(e){case-1:return"std";case 0:return"";default:return this.id.slice(0,e)}}get valid(){return this.manifest!==void 0&&this.manifest.type!=="<error>"}get loaded(){return this.manifest!==void 0}get installed(){return this.__instance__!==void 0}get instance(){return this.__instance__}set instance(e){if(this.__instance__=e,e instanceof Object)a.datamap.set(e,this);else if(e!==null)throw this.__instance__=null,new Error("Component instance shall be an object")}get(){if(this.manifest===void 0)throw new Error("Cannot get manifest of not loaded module");return this.manifest}set(e){return this.manifest=e,this}fetch(){let e=a.loadings.get(this);return e||(this.manifest===void 0?e=a.components_provider.get_component_manifest(this.id).then(async n=>{if(n)n.type&&await u(n.type).fetch(),this.manifest=n;else throw new Error(`Component '${this.id}' not found`);return this.manifest}).catch(n=>(y.error(n,this),this.set({$id:this.id,type:"<error>",message:n.message,stack:n.stack}),this.__instance__=new Error(n.message),this.manifest)):e=Promise.resolve(this.manifest),a.loadings.set(this,e),e)}async install(){let e=a.installings.get(this);return e||(this.instance===void 0?(this.instance=null,e=new Promise(async n=>{try{this.loaded===!1&&await this.fetch();let o=this.manifest?.type;if(o){let r=u(o);await(await L.fetch(r)).createComponent(this,this.manifest)}}catch(o){y.error(o,this)}n(this)})):e=Promise.resolve(this),a.installings.set(this,e),e)}acquireResource(e){let n=`${this.id}#${e}`,o=a.resources.get(n);return o||(o=new j(this,e),a.resources.set(n,o)),o}getResource(e){return this.hasResource(e)?this.acquireResource(e):null}hasResource(e){let{manifest:n}=this;if(n?.services?.[e])return!0;if(n?.type){let o=u(n.type);if(o)return o?.hasResource(`component.${e}`)}return!1}async getResourceAsync(e){return this.manifest===void 0&&await this.fetch(),this.getResource(e)}async fetchResource(e){return this.manifest===void 0&&await this.fetch(),this.getResource(e)?.fetch()}getLogStats(){return G(this.id)}getLogs(e){return Q(e,this.id)}},j=class{constructor(e,n){this.component=e;this.resource=n;e.fetch()}entry=void 0;identifier=void 0;get valid(){return this.identifier!==void 0&&this.component.valid}get loaded(){return this.identifier!==void 0}async fetch(){if(this.identifier===void 0){let e=a.loadings.get(this);return e||(e=new Promise(async n=>{let{component:o}=this;try{o.installed===!1&&await o.install();let{manifest:r}=o,s=F(r.services?.[this.resource]),i=s?.type;if(i==="module")this.entry=await a.resources_loader.load_resource(s.location),this.identifier=s.identifier;else if(i==="api.rest")this.entry=V(s,o),this.identifier=null;else if(r.type){let m=u(r.type).getResource(`component.${this.resource}`);if(m){let d=await m.fetch();d?this.entry=await d(this.component):this.entry=null,this.identifier=null}else throw new Error(`Cannot provide resource '${this.resource}'`)}else throw new Error(`Cannot load resource '${this.resource}': ${JSON.stringify(s)}`);let c=this.get();c instanceof Object&&a.datamap.set(c,this)}catch(r){console.error(`Cannot install service '${this.resource}' of '${o.id}':`,r),this.entry=null,this.identifier=null}n(this.get()),a.loadings.set(this,null)}),a.loadings.set(this,e),e)}else return this.get()}get(){if(this.entry)return this.identifier!==null?this.entry?.[this.identifier]:this.entry}set(e){this.entry=e,this.identifier=null}get spec(){let e=this.resource.split(".")[0];return this.component.manifest?.specs?.[e]}get url(){let e=this.component.manifest?.services?.[this.resource];if(typeof e=="string"){let n=me.parse(window.location.href).with({fragment:null});return ue.joinPath(n,"..",e.split("#")[0]).toString()}return null}},k=class{components=new Map;resources=new Map;datamap=new WeakMap;loadings=new Map;installings=new Map;listeners=new Set;components_provider=new M([]);resources_loader=null;content_provider=null;constructor(){this.content_provider=new I,this.components_provider.add_provider(new R(this.content_provider)),this.components_provider.add_provider(J()),this.resources_loader=new x(this.content_provider)}listen(e){return this.listeners.add(e),e}unlisten(e){this.listeners.delete(e)}notifyError(e,n){}},a=new k;u("<error>").set({$id:"<error>",icon:"bi:house",title:"Define invalid component"});function le(){return u("log:application")}function g(t,e){if(t instanceof Object){let n=a.datamap.get(t)||t;if(n instanceof C)return n;if(n instanceof j)return n.component;if(!e&&t.getComponent instanceof Function)return g(t.getComponent(),!0)}return le()}function u(t){let e=a.components.get(t);return!e&&typeof t=="string"&&(e=new C(t),a.components.set(t,e)),e}function nt(t){let e=t.$id,n=a.components.get(e);return!n&&typeof e=="string"&&(n=new C(e),n.manifest=t,n.instance=null,a.components.set(e,n)),n}function ot(t){let e=t.split("#");return e.length===2?u(e[0])?.acquireResource(e[1]):null}function rt(t,e){return e&&t.startsWith("/")?u(`${e?.id}${t}`):null}async function st(t){let e=u(t.$id);return a.loadings.delete(e),e.manifest=t,fe(e)}async function fe(t){console.log("[Update Component]",t.id);let e=await t.fetch();if(await a.components_provider.add_component(e),t.loaded&&e.type&&t.installed){let o=await L.fetch(u(e.type));o&&(t.instance?await o.updateComponent(t,e):(t.__instance__=void 0,await o.createComponent(t,e))),t.instance instanceof Object&&a.datamap.set(t.instance,t),a.listeners.forEach(r=>r(t))}return t}async function it(t){console.log("deleteComponent",t),await a.components_provider.delete_component(t)&&de(t)}function de(t){let e=a.components.get(t);e&&(e.set({$id:e.id,type:"<error>",message:"Component deleted"}),a.listeners.forEach(n=>n(e)),a.components.delete(t))}async function ct(t){return a.components_provider.search_component_publications(t)}async function at(t){let e=[];for(let n of t){let o=await a.components_provider.get_component_publication(n);o?e.push(o):e.push(ge(n))}return e}function ge(t,e){return{id:t,title:e||"! Not found: "+t}}var H=new l("api.rest");function V(t,e){let n=t.endpoint+(t.path||"");return{invoke(o,r){return globalThis.fetch(n+o,r)},getUrl(o){return n+o}}}var dt={async fetch(t,e){if(typeof t=="string"&&(t=q.parse(t)),t.scheme==="jtd"){let n=u(t.authority),o=await H.fetch(n);if(o){let r=t.query?`${t.path}?${t.query}`:t.path;return o.invoke(r,e)}else return Response.error()}else return fetch(t.toString(),e)},async getUri(t){if(typeof t=="string"&&(t=q.parse(t)),t.scheme==="jtd"){let e=u(t.authority),n=await H.fetch(e);if(n){let o=t.query?`${t.path}?${t.query}`:t.path;t=q.parse(n.getUrl(o))}else throw new Error(`Unknown component '${t.authority}'`)}return t}};export{l as a,L as b,_e as c,w as d,z as e,v as f,ve as g,h,F as i,x as j,I as k,je as l,_ as m,S as n,R as o,M as p,J as q,H as r,V as s,dt as t,C as u,j as v,k as w,a as x,le as y,g as z,u as A,nt as B,ot as C,rt as D,st as E,fe as F,it as G,de as H,ct as I,at as J,ge as K,ae as L,Je as M,Ke as N,Q as O,G as P,y as Q,pe as R};
package/chunk.YVZWYQZG.js DELETED
@@ -1 +0,0 @@
1
- import{A as h,C as V,a as w}from"./chunk.H26D4GQC.js";var S={stringify(n,r){let e=new URLSearchParams;for(let[t,o]of Object.entries(n||{}))if(!(r?.skipNull&&o===null)&&!(r?.skipEmptyString&&o===""))if(Array.isArray(o))for(let s of o)e.append(t,String(s));else e.set(t,String(o));return e.toString()},parse(n,r){let e={},t=new URLSearchParams(n);for(let[o,s]of t.entries())e[o]=s;return e}},b=new w("view");function g(n){if(!n)return"";if(n instanceof Object){let r=[];for(;n;){let e=S.stringify(n.params,{skipNull:!1,skipEmptyString:!1});e?r.push(`${n.name}?${e}`):r.push(n.name),n=n.nested}return r.join("/")}return n.startsWith("#")?n.slice(1):n}function a(n,r){if(!n)return null;if(n instanceof Object)return n;let e=null,t=null;n=n.startsWith("#")?n.slice(1):n;for(let o of n.split("/"))if(o){let[s,u]=o.split("?"),c={};u&&(c=S.parse(u,{parseNumbers:!1,parseBooleans:!1}));let f={name:s,params:c};t?t.nested=f:e=f,t=f}return t&&(t.content=r),e}function R(n,r){if(n==="safe")return null;if(n){let e=typeof n=="string"?n:n?.rule,t=V(e).get();if(t)try{return t.check(r,n instanceof Object?n:null)}catch(o){return o}else return new Error("Data security guard not found")}else return new Error("Data cannot be securised")}function k(n,r,e){if(r!==void 0){if(e!==!0){let t=R(n?.security,r);if(t)throw t}return r}else return n.default}function d(n,r,e,t){let o={},s=b.spec(n),u=t==="safe",c=s?.properties;if(c instanceof Object){let{content:f}=e,l=e.params||{},y=s.aliases;if(y){let i={};for(let p in l){let m=y?.[p]||p;i[m]=l[p]}l=i}for(let i in c){let p=c[i],m=l[i];f!==void 0&&p?.binding?.source==="content"&&(m=f);try{o[i]=k(p,m,u)}catch(I){throw new Error(`Invalid param '${i}' : ${I.message}`)}}}return o}async function N(n,r){typeof n=="string"&&(n=a(n));let e=h(n.name),t=await e.fetch();if(e.valid){let o=d(e,t,n,r||"unknown");return{component:e,properties:o}}else throw new Error(`Component '${e.id}' is invalid`)}function O(n,r){let{origin:e,pathname:t}=window.location;typeof n=="string"&&(n=a(n)),r&&(typeof r=="string"&&(r=a(e)),n={...r,nested:n});let o="#"+g(n);return`${e}${t}${o}`}function $(n,r){let{origin:e}=window.location;typeof n=="string"&&(n=a(n)),r&&(typeof r=="string"&&(r=a(e)),n={...r,nested:n});let t="#"+g(n);window.location.assign(t)}function C(n){typeof n=="string"&&(n=a(n));let r=a(window.location.hash),e="#"+g({...n,params:{...r.params,...n.params}});window.location.replace(e)}export{b as a,g as b,a as c,N as d,O as e,$ as f,C as g};