@memberjunction/ng-realtime-widget 6.2.0-edge.8 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/element/chunks/{chunk-YES54RPF.js → chunk-FS5E33YU.js} +5 -5
- package/dist/element/chunks/{chunk-FDR3HREB.js → chunk-IYFE6AC7.js} +2 -2
- package/dist/element/chunks/{chunk-FDR3HREB.js.map → chunk-IYFE6AC7.js.map} +2 -2
- package/dist/element/chunks/{dist-4BLL2YRV.js → dist-6QB6LKFP.js} +2 -2
- package/dist/element/chunks/{interactive-chunk-entry-WGFKDSQQ.js → interactive-chunk-entry-EYXXXLJN.js} +2 -2
- package/dist/element/meta.json +1 -1
- package/dist/element/mj-realtime-widget-session.js +3 -3
- package/dist/element/sizes.json +10 -10
- package/package.json +13 -13
- /package/dist/element/chunks/{chunk-YES54RPF.js.map → chunk-FS5E33YU.js.map} +0 -0
- /package/dist/element/chunks/{dist-4BLL2YRV.js.map → dist-6QB6LKFP.js.map} +0 -0
- /package/dist/element/chunks/{interactive-chunk-entry-WGFKDSQQ.js.map → interactive-chunk-entry-EYXXXLJN.js.map} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{$b as Y,Ab as x,Bb as y,Cb as z,Db as A,Eb as B,Fb as C,Gb as D,Hb as E,Ib as F,Jb as G,Kb as H,Lb as I,Mb as J,Nb as K,Ob as L,Pb as M,Qb as N,Rb as O,Sb as P,Tb as Q,Ub as R,Vb as S,Wb as T,Xb as U,Yb as V,Zb as W,_b as X,eb as b,fb as c,gb as d,ha as a,hb as e,ib as f,jb as g,kb as h,lb as i,mb as j,nb as k,ob as l,pb as m,qb as n,rb as o,sb as p,tb as q,ub as r,vb as s,wb as t,xb as u,yb as v,zb as w}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=dist-
|
|
1
|
+
import{$b as Y,Ab as x,Bb as y,Cb as z,Db as A,Eb as B,Fb as C,Gb as D,Hb as E,Ib as F,Jb as G,Kb as H,Lb as I,Mb as J,Nb as K,Ob as L,Pb as M,Qb as N,Rb as O,Sb as P,Tb as Q,Ub as R,Vb as S,Wb as T,Xb as U,Yb as V,Zb as W,_b as X,eb as b,fb as c,gb as d,ha as a,hb as e,ib as f,jb as g,kb as h,lb as i,mb as j,nb as k,ob as l,pb as m,qb as n,rb as o,sb as p,tb as q,ub as r,vb as s,wb as t,xb as u,yb as v,zb as w}from"./chunk-IYFE6AC7.js";import"./chunk-V4OMOOLJ.js";import"./chunk-ZQVZ37WB.js";import"./chunk-AHHY6OJ6.js";import"./chunk-UVYWEABP.js";export{A as ActionItemInput,C as ActionItemOutput,h as BrowserIndexedDBStorageProvider,g as BrowserStorageProviderBase,t as ConnectGraphQLClient,n as ExtractGraphQLOperationName,b as FieldMapper,d as FireAndForgetHelper,m as FirstGraphQLOperationKind,E as GetDataOutput,e as GraphQLAIClient,I as GraphQLActionClient,O as GraphQLClassifyClient,L as GraphQLClusterClient,Q as GraphQLComponentRegistryClient,V as GraphQLConversationClient,r as GraphQLDataProvider,K as GraphQLEncryptionClient,S as GraphQLFileStorageClient,N as GraphQLHandoffClient,U as GraphQLIntegrationClient,J as GraphQLListsClient,M as GraphQLLiveKitClient,Y as GraphQLMeetingClient,q as GraphQLProviderConfigData,X as GraphQLRealtimeSessionClient,T as GraphQLSearchClient,D as GraphQLSystemUserClient,P as GraphQLTestingClient,c as GraphQLTransactionGroup,R as GraphQLVersionHistoryClient,l as IsGraphQLMutation,W as IsKnownRealtimeSessionVerificationErrorCode,f as PACKAGE_VERSION,o as RegisterNetworkDiagnosticObserver,p as RegisterResponseHeaderObserver,w as RoleInput,y as RolesAndUsersInput,i as SafeGraphQLError,k as SanitizeGraphQLError,s as SetupGraphQLClient,G as SimpleRemoteEntity,H as SimpleRemoteEntityField,F as SimpleRemoteEntityOutput,z as SyncDataAction,B as SyncDataResult,v as SyncRolesAndUsersResult,j as ToSafeGraphQLError,x as UserInput,a as gql,u as setupGraphQLClient};
|
|
2
|
+
//# sourceMappingURL=dist-6QB6LKFP.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{$a as Re,A as k,Aa as ae,Ba as oe,Ca as _,Da as p,Dc as de,Ea as f,Ec as D,Fa as B,Fc as me,Lb as xe,Ma as H,Nc as $e,Oa as P,Oc as je,Pc as I,Qa as g,Qc as T,Rc as b,Sc as ue,Tc as ke,Ua as Pe,Uc as M,Va as De,Vc as v,Wa as Ae,X as y,cb as E,d as j,db as Ee,eb as ce,g as _e,ga as L,h as R,ic as Ve,l as w,la as Se,m as S,s as ne,ua as F,va as ie,wa as re,xa as se,z as we}from"./chunk-YES54RPF.js";import{a as pe}from"./chunk-3MGVBZOH.js";import{Ma as le,Na as Oe}from"./chunk-FDR3HREB.js";import"./chunk-V4OMOOLJ.js";import{Xa as m,Ya as J,o as N}from"./chunk-ZQVZ37WB.js";import{Oa as Te,Qa as Me,T as G,V as Ne,c as be,ha as U,ia as x}from"./chunk-AHHY6OJ6.js";import{a as c}from"./chunk-UVYWEABP.js";var Ue=new Set([...Object.values(b),...Object.values(ue),"open"]);function he(s){let e=s.trim().toLowerCase().replace(/\s+/g," ");return e==="string"?{type:"string"}:e==="number"||e==="float"||e==="double"?{type:"number"}:e==="integer"||e==="int"?{type:"integer"}:e==="boolean"||e==="bool"?{type:"boolean"}:e==="date"||e==="datetime"?{type:"string",format:"date-time"}:e==="array"||e.startsWith("array<")||e.endsWith("[]")?{type:"array"}:e==="object"||e.startsWith("record<")||e.startsWith("{")?{type:"object"}:e==="function"?null:{}}c(he,"schemaForTypeName");function Je(s){return s.name.trim().endsWith("?")||/\bundefined\b/i.test(s.type)||/^\s*optional\b/i.test(s.description??"")}c(Je,"isOptionalParameter");function Ke(s){return s.name.trim().replace(/\?$/,"")}c(Ke,"parameterName");function ze(s){let e={},t=[],n=[];for(let r of s.parameters??[]){let a=Ke(r),o=he(r.type??""),l=Je(r);if(o===null){if(!l)return{Problem:`parameter "${a}" is a function, which an agent cannot pass`};continue}let u={...o,description:r.description??`${a} (${r.type})`};Object.keys(o).length===0&&(u.description=`${r.description??a} (declared type: ${r.type})`),e[a]=u,n.push(a),l||t.push(a)}let i={type:"object",properties:e,additionalProperties:!1};return t.length>0&&(i.required=t),{Schema:i,Names:n}}c(ze,"buildParametersSchema");function qe(s,e){let t=s;return(Ue.has(t.toLowerCase())||e.has(t.toLowerCase()))&&(t=`custom_${s}`),e.add(t.toLowerCase()),t}c(qe,"customVerbName");function Xe(s,e,t){let n=[];for(let i of s.methods?.customMethods??[]){if(typeof i?.name!="string"||i.name.trim().length===0){t.push({Name:"(unnamed)",Reason:"a custom method has no name"});continue}let r=ze(i);if("Problem"in r){t.push({Name:i.name,Reason:r.Problem});continue}let a=i.returnType&&i.returnType!=="void"?` Returns ${i.returnType}.`:"";n.push({Verb:{Name:qe(i.name,e),Description:`${i.description||`Calls the component's ${i.name} method.`}${a}`,ParametersSchema:r.Schema,InvokableBy:"both",...Ye(i)?{ReturnsChannelData:"state"}:{}},Binding:{Kind:"custom",Method:i.name,ParameterNames:r.Names}})}return n}c(Xe,"deriveCustomVerbs");var We=new Set(["","void","undefined","null","never","promise<void>","promise<undefined>"]);function Ye(s){return!We.has((s.returnType??"").trim().toLowerCase())}c(Ye,"returnsData");function K(){return{type:"object",properties:{},additionalProperties:!1}}c(K,"noParameters");function Qe(s){let e=s.methods?.standardMethodsSupported??{},t=c((i,r,a=K(),o)=>({Verb:{Name:ue[i],Description:r,ParametersSchema:a,InvokableBy:"both",...o?{ReturnsChannelData:o}:{}},Binding:{Kind:"standard",Standard:i}}),"standard"),n=[];return e.refresh&&n.push(t("Refresh","Reloads the component's data.")),e.getCurrentDataState&&n.push(t("GetDataState","Reads what the component is showing right now (its data state: tables, rows, filters). Use it when you need detail the state notes do not carry.",K(),"state")),e.validate&&n.push(t("Validate","Checks whether what the user entered is valid; reports the problems.",K(),"state")),e.isDirty&&n.push(t("IsDirty","Reports whether the user has unsaved changes in the component.",K(),"state")),e.reset&&n.push(t("Reset","Discards the user's changes and returns the component to its initial state.")),e.print&&n.push(t("Print","Opens the browser's print dialog for the component.")),e.scrollTo&&n.push(t("ScrollTo","Scrolls the component to an element (a CSS selector) or position.",{type:"object",properties:{target:{type:"string",description:"A CSS selector of the element to scroll to."},top:{type:"number",description:"Vertical scroll offset in pixels (instead of a target)."},left:{type:"number",description:"Horizontal scroll offset in pixels (instead of a target)."}},additionalProperties:!1})),e.focus&&n.push(t("Focus","Moves keyboard focus to an element inside the component.",{type:"object",properties:{target:{type:"string",description:"A CSS selector of the element to focus (default: the component's first focusable element)."}},additionalProperties:!1})),n}c(Qe,"deriveStandardVerbs");function Ze(s){let e=[];for(let t of s.events??[]){if(typeof t?.name!="string"||t.name.length===0)continue;let n={};for(let i of t.parameters??[]){let r=he(i.type??"any")??{};n[i.name]={...r,description:i.description}}e.push({Name:t.name,Description:t.description,PayloadSchema:{type:"object",properties:n}})}return e}c(Ze,"deriveEvents");function et(s){let e={},t=[];for(let i of s.properties??[]){let r=he(i.type??"any");if(r===null||typeof i.name!="string"||i.name.length===0)continue;let a={...r,description:i.description};Array.isArray(i.possibleValues)&&i.possibleValues.length>0&&r.type==="string"&&(a.enum=i.possibleValues),e[i.name]=a,i.required&&t.push(i.name)}let n={type:"object",properties:e};return t.length>0&&(n.required=t),n}c(et,"deriveInputsSchema");function V(s){let e=[],t=Qe(s),n=new Set(t.map(i=>i.Verb.Name.toLowerCase()));return{Verbs:[...t,...Xe(s,n,e)],Events:Ze(s),InputsSchema:et(s),SupportsDataState:s.methods?.standardMethodsSupported?.getCurrentDataState===!0,Skipped:e}}c(V,"DeriveComponentContract");function Le(s){let e=s.ParametersSchema.properties;return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:{}}c(Le,"schemaProperties");function Fe(s){if(s.length===1)return{...s[0].Verb};let e={};for(let r of s)for(let[a,o]of Object.entries(Le(r.Verb)))a in e||(e[a]=o);let t=s.map(r=>r.Verb.ReturnsChannelData),n=t.every(r=>r!==void 0)?t.includes("state")?"state":"pixels":void 0,i=s.map(r=>`${r.Component}: ${Object.keys(Le(r.Verb)).join(", ")||"(no parameters)"}`);return{Name:s[0].Verb.Name,Description:`${s[0].Verb.Description} Several open components have this action; pass the instance you mean. Parameters per component \u2014 ${i.join("; ")}.`,ParametersSchema:{type:"object",properties:e,additionalProperties:!1},InvokableBy:"both",...n?{ReturnsChannelData:n}:{}}}c(Fe,"MergeVerbOffers");var tt="[omitted]";function z(s){return s!==null&&typeof s=="object"&&!Array.isArray(s)}c(z,"isRecord");function C(s,e=0,t=new WeakSet){if(s==null)return null;switch(typeof s){case"string":return s.length>200?`${s.slice(0,200)}\u2026 (${s.length} chars)`:s;case"number":return Number.isFinite(s)?s:null;case"boolean":return s;case"bigint":return s.toString();case"function":case"symbol":return tt;default:break}return nt(s,e,t)}c(C,"ToBoundedJson");function nt(s,e,t){if(s instanceof Date)return Number.isNaN(s.getTime())?null:s.toISOString();if(t.has(s))return"[circular]";if(e>=5)return"[too deep]";t.add(s);try{if(Array.isArray(s)){let i=s.slice(0,30).map(r=>C(r,e+1,t));return s.length>30?[...i,`\u2026 ${s.length-30} more`]:i}let n={};for(let i of Object.keys(s).slice(0,30))i==="__proto__"||i==="constructor"||i==="prototype"||(n[i]=C(s[i],e+1,t));return n}finally{t.delete(s)}}c(nt,"objectToBoundedJson");function it(s,e,t){if(!z(s))return{name:`table ${e+1}`,rowCount:0};let n=Array.isArray(s.rows)?s.rows:[],r=(Array.isArray(s.columns)?s.columns:[]).map(o=>typeof o=="string"?o:z(o)&&typeof o.name=="string"?o.name:null).filter(o=>o!==null).slice(0,40),a={name:typeof s.name=="string"?s.name:`table ${e+1}`,rowCount:n.length,columns:r,rows:n.slice(0,t).map(o=>C(o,1))};return n.length>t&&(a.rowsOmitted=n.length-t),a}c(it,"summarizeTable");function Be(s,e){let t={};for(let n of["title","activeTab","searchText","interpretation"]){let i=s[n];typeof i=="string"&&i.length>0&&(t[n]=C(i))}return Array.isArray(s.drillPath)&&s.drillPath.length>0&&(t.drillPath=C(s.drillPath)),Array.isArray(s.tables)&&(t.tables=s.tables.slice(0,30).map((n,i)=>it(n,i,e))),z(s.custom)&&Object.keys(s.custom).length>0&&(t.custom=C(s.custom)),t}c(Be,"buildSummary");function fe(s,e){if(!z(s))return null;let t=Math.max(0,Math.floor(e.MaxRows)),n=Be(s,t);for(;t>0&&JSON.stringify(n).length>e.MaxChars;)t=Math.floor(t/2),n=Be(s,t);return JSON.stringify(n).length>e.MaxChars?{truncated:!0,note:`The data state is larger than ${e.MaxChars} characters; ask for specifics.`}:n}c(fe,"SummarizeDataState");var O=class extends Error{static{c(this,"InstanceLimitError")}Limit;constructor(e){super(`At most ${e} component${e===1?" is":"s are"} open at once. Close one first.`),this.Limit=e,this.name="InstanceLimitError"}},q=class{static{c(this,"ComponentInstanceEngine")}maxInstances;records=new Map;changedSubject=new be;activeId=null;instanceSeq=0;eventSeq=0;constructor(e){this.maxInstances=e}Changed$=this.changedSubject.asObservable();SetMaxInstances(e){this.maxInstances=e}get Instances(){return[...this.records.values()]}get ActiveID(){return this.activeId}Get(e){return this.records.get(e)}FindByArtifact(e){return this.Instances.find(t=>t.Artifact.ArtifactID.toLowerCase()===e.toLowerCase())}Add(e,t){if(this.records.size>=this.maxInstances)throw new O(this.maxInstances);let n={InstanceID:`c${++this.instanceSeq}`,Artifact:e,Contract:V(e.Spec),Inputs:t,LastEvent:null,Handle:null};return this.records.set(n.InstanceID,n),this.changedSubject.next({Kind:"added",InstanceID:n.InstanceID}),this.SetActive(n.InstanceID),n}Remove(e){if(!this.records.delete(e))return!1;if(this.changedSubject.next({Kind:"removed",InstanceID:e}),this.activeId===e){let t=this.Instances;this.activeId=null,this.SetActive(t.length>0?t[t.length-1].InstanceID:null)}return!0}SwapVersion(e,t){let n=this.records.get(e);return n?(n.Artifact=t,n.Contract=V(t.Spec),n.LastEvent=null,n.Handle=null,this.changedSubject.next({Kind:"version",InstanceID:e}),!0):!1}SetActive(e){return e!==null&&!this.records.has(e)?!1:(this.activeId!==e&&(this.activeId=e,this.changedSubject.next({Kind:"active",InstanceID:e})),!0)}AttachHandle(e,t){let n=this.records.get(e);n&&(n.Handle=t)}RecordEvent(e,t,n){let i=this.records.get(e);return i?(i.LastEvent={Type:t,Payload:n,Seq:++this.eventSeq},this.changedSubject.next({Kind:"event",InstanceID:e}),!0):!1}Dispose(){this.records.clear(),this.activeId=null,this.changedSubject.complete()}};function ve(s,e,t,n,i,r){let a=s[e];return a===void 0?t:typeof a=="number"&&Number.isInteger(a)&&a>=n&&a<=i?a:(r.push(`"${e}" must be a whole number from ${n} to ${i}; using ${t}.`),t)}c(ve,"readBoundedInteger");function He(s,e,t,n){let i=s[e];return i===void 0?t:typeof i=="boolean"?i:(n.push(`"${e}" must be true or false; using ${t}.`),t)}c(He,"readBoolean");function Ce(s){let e=M;if(!G(s))return{Config:{...e},Problems:[]};let t=s,n=[];return{Config:{AutoOpenDelegatedComponents:He(t,"autoOpenDelegatedComponents",e.AutoOpenDelegatedComponents,n),SwapToNewerVersions:He(t,"swapToNewerVersions",e.SwapToNewerVersions,n),MaxInstances:ve(t,"maxInstances",e.MaxInstances,1,ke,n),MaxStateRows:ve(t,"maxStateRows",e.MaxStateRows,1,500,n),MaxStateChars:ve(t,"maxStateChars",e.MaxStateChars,500,5e4,n)},Problems:n}}c(Ce,"ParseInteractiveComponentConfig");var X=class{static{c(this,"ReactComponentHandle")}react;IsReady;constructor(e,t=!0){this.react=e,this.IsReady=t}HasMethod(e){return this.react.HasMethod(e)}InvokeMethod(e,t){return Promise.resolve(this.react.InvokeMethod(e,...t))}GetCurrentDataState(){return this.react.GetCurrentDataState()}Refresh(){this.react.Refresh()}Print(){this.react.Print()}Validate(){return this.react.validate()}IsDirty(){return this.react.IsDirty()}Reset(){this.react.Reset()}ScrollTo(e){this.react.ScrollTo(e)}Focus(e){this.react.Focus(e)}};var st=["react"],W=class s{static{c(this,"InteractiveComponentHostComponent")}_spec;set Spec(e){this._spec!==void 0&&e!==this._spec&&this.HandleChange.emit(null),this._spec=e}get Spec(){return this._spec}Inputs={};Provider=null;Activity=new ne;HandleChange=new ne;react;hostRef=R(k);get Element(){return this.hostRef.nativeElement}OnInitialized(){this.react&&this.HandleChange.emit(new X(this.react)),this.Activity.emit({Kind:"initialized"})}OnComponentEvent(e){this.Activity.emit({Kind:"event",Name:e.type,Payload:e.payload})}static \u0275fac=c(function(t){return new(t||s)},"InteractiveComponentHostComponent_Factory");static \u0275cmp=L({type:s,selectors:[["mj-interactive-component-host"]],viewQuery:c(function(t,n){if(t&1&&Pe(st,5),t&2){let i;De(i=Ae())&&(n.react=i.first)}},"InteractiveComponentHostComponent_Query"),inputs:{Spec:"Spec",Inputs:"Inputs",Provider:"Provider"},outputs:{Activity:"Activity",HandleChange:"HandleChange"},decls:2,vars:3,consts:[["react",""],[1,"ic-host__component",3,"ComponentEvent","StateChange","Initialized","Component","ComponentProps","Provider"]],template:c(function(t,n){t&1&&(p(0,"mj-react-component",1,0),P("ComponentEvent",c(function(r){return n.OnComponentEvent(r)},"InteractiveComponentHostComponent_Template_mj_react_component_ComponentEvent_0_listener"))("StateChange",c(function(){return n.Activity.emit({Kind:"state"})},"InteractiveComponentHostComponent_Template_mj_react_component_StateChange_0_listener"))("Initialized",c(function(){return n.OnInitialized()},"InteractiveComponentHostComponent_Template_mj_react_component_Initialized_0_listener")),f()),t&2&&_("Component",n.Spec)("ComponentProps",n.Inputs)("Provider",n.Provider)},"InteractiveComponentHostComponent_Template"),dependencies:[je,$e],styles:[`[_nghost-%COMP%] {
|
|
1
|
+
import{$a as Re,A as k,Aa as ae,Ba as oe,Ca as _,Da as p,Dc as de,Ea as f,Ec as D,Fa as B,Fc as me,Lb as xe,Ma as H,Nc as $e,Oa as P,Oc as je,Pc as I,Qa as g,Qc as T,Rc as b,Sc as ue,Tc as ke,Ua as Pe,Uc as M,Va as De,Vc as v,Wa as Ae,X as y,cb as E,d as j,db as Ee,eb as ce,g as _e,ga as L,h as R,ic as Ve,l as w,la as Se,m as S,s as ne,ua as F,va as ie,wa as re,xa as se,z as we}from"./chunk-FS5E33YU.js";import{a as pe}from"./chunk-3MGVBZOH.js";import{Ma as le,Na as Oe}from"./chunk-IYFE6AC7.js";import"./chunk-V4OMOOLJ.js";import{Xa as m,Ya as J,o as N}from"./chunk-ZQVZ37WB.js";import{Oa as Te,Qa as Me,T as G,V as Ne,c as be,ha as U,ia as x}from"./chunk-AHHY6OJ6.js";import{a as c}from"./chunk-UVYWEABP.js";var Ue=new Set([...Object.values(b),...Object.values(ue),"open"]);function he(s){let e=s.trim().toLowerCase().replace(/\s+/g," ");return e==="string"?{type:"string"}:e==="number"||e==="float"||e==="double"?{type:"number"}:e==="integer"||e==="int"?{type:"integer"}:e==="boolean"||e==="bool"?{type:"boolean"}:e==="date"||e==="datetime"?{type:"string",format:"date-time"}:e==="array"||e.startsWith("array<")||e.endsWith("[]")?{type:"array"}:e==="object"||e.startsWith("record<")||e.startsWith("{")?{type:"object"}:e==="function"?null:{}}c(he,"schemaForTypeName");function Je(s){return s.name.trim().endsWith("?")||/\bundefined\b/i.test(s.type)||/^\s*optional\b/i.test(s.description??"")}c(Je,"isOptionalParameter");function Ke(s){return s.name.trim().replace(/\?$/,"")}c(Ke,"parameterName");function ze(s){let e={},t=[],n=[];for(let r of s.parameters??[]){let a=Ke(r),o=he(r.type??""),l=Je(r);if(o===null){if(!l)return{Problem:`parameter "${a}" is a function, which an agent cannot pass`};continue}let u={...o,description:r.description??`${a} (${r.type})`};Object.keys(o).length===0&&(u.description=`${r.description??a} (declared type: ${r.type})`),e[a]=u,n.push(a),l||t.push(a)}let i={type:"object",properties:e,additionalProperties:!1};return t.length>0&&(i.required=t),{Schema:i,Names:n}}c(ze,"buildParametersSchema");function qe(s,e){let t=s;return(Ue.has(t.toLowerCase())||e.has(t.toLowerCase()))&&(t=`custom_${s}`),e.add(t.toLowerCase()),t}c(qe,"customVerbName");function Xe(s,e,t){let n=[];for(let i of s.methods?.customMethods??[]){if(typeof i?.name!="string"||i.name.trim().length===0){t.push({Name:"(unnamed)",Reason:"a custom method has no name"});continue}let r=ze(i);if("Problem"in r){t.push({Name:i.name,Reason:r.Problem});continue}let a=i.returnType&&i.returnType!=="void"?` Returns ${i.returnType}.`:"";n.push({Verb:{Name:qe(i.name,e),Description:`${i.description||`Calls the component's ${i.name} method.`}${a}`,ParametersSchema:r.Schema,InvokableBy:"both",...Ye(i)?{ReturnsChannelData:"state"}:{}},Binding:{Kind:"custom",Method:i.name,ParameterNames:r.Names}})}return n}c(Xe,"deriveCustomVerbs");var We=new Set(["","void","undefined","null","never","promise<void>","promise<undefined>"]);function Ye(s){return!We.has((s.returnType??"").trim().toLowerCase())}c(Ye,"returnsData");function K(){return{type:"object",properties:{},additionalProperties:!1}}c(K,"noParameters");function Qe(s){let e=s.methods?.standardMethodsSupported??{},t=c((i,r,a=K(),o)=>({Verb:{Name:ue[i],Description:r,ParametersSchema:a,InvokableBy:"both",...o?{ReturnsChannelData:o}:{}},Binding:{Kind:"standard",Standard:i}}),"standard"),n=[];return e.refresh&&n.push(t("Refresh","Reloads the component's data.")),e.getCurrentDataState&&n.push(t("GetDataState","Reads what the component is showing right now (its data state: tables, rows, filters). Use it when you need detail the state notes do not carry.",K(),"state")),e.validate&&n.push(t("Validate","Checks whether what the user entered is valid; reports the problems.",K(),"state")),e.isDirty&&n.push(t("IsDirty","Reports whether the user has unsaved changes in the component.",K(),"state")),e.reset&&n.push(t("Reset","Discards the user's changes and returns the component to its initial state.")),e.print&&n.push(t("Print","Opens the browser's print dialog for the component.")),e.scrollTo&&n.push(t("ScrollTo","Scrolls the component to an element (a CSS selector) or position.",{type:"object",properties:{target:{type:"string",description:"A CSS selector of the element to scroll to."},top:{type:"number",description:"Vertical scroll offset in pixels (instead of a target)."},left:{type:"number",description:"Horizontal scroll offset in pixels (instead of a target)."}},additionalProperties:!1})),e.focus&&n.push(t("Focus","Moves keyboard focus to an element inside the component.",{type:"object",properties:{target:{type:"string",description:"A CSS selector of the element to focus (default: the component's first focusable element)."}},additionalProperties:!1})),n}c(Qe,"deriveStandardVerbs");function Ze(s){let e=[];for(let t of s.events??[]){if(typeof t?.name!="string"||t.name.length===0)continue;let n={};for(let i of t.parameters??[]){let r=he(i.type??"any")??{};n[i.name]={...r,description:i.description}}e.push({Name:t.name,Description:t.description,PayloadSchema:{type:"object",properties:n}})}return e}c(Ze,"deriveEvents");function et(s){let e={},t=[];for(let i of s.properties??[]){let r=he(i.type??"any");if(r===null||typeof i.name!="string"||i.name.length===0)continue;let a={...r,description:i.description};Array.isArray(i.possibleValues)&&i.possibleValues.length>0&&r.type==="string"&&(a.enum=i.possibleValues),e[i.name]=a,i.required&&t.push(i.name)}let n={type:"object",properties:e};return t.length>0&&(n.required=t),n}c(et,"deriveInputsSchema");function V(s){let e=[],t=Qe(s),n=new Set(t.map(i=>i.Verb.Name.toLowerCase()));return{Verbs:[...t,...Xe(s,n,e)],Events:Ze(s),InputsSchema:et(s),SupportsDataState:s.methods?.standardMethodsSupported?.getCurrentDataState===!0,Skipped:e}}c(V,"DeriveComponentContract");function Le(s){let e=s.ParametersSchema.properties;return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:{}}c(Le,"schemaProperties");function Fe(s){if(s.length===1)return{...s[0].Verb};let e={};for(let r of s)for(let[a,o]of Object.entries(Le(r.Verb)))a in e||(e[a]=o);let t=s.map(r=>r.Verb.ReturnsChannelData),n=t.every(r=>r!==void 0)?t.includes("state")?"state":"pixels":void 0,i=s.map(r=>`${r.Component}: ${Object.keys(Le(r.Verb)).join(", ")||"(no parameters)"}`);return{Name:s[0].Verb.Name,Description:`${s[0].Verb.Description} Several open components have this action; pass the instance you mean. Parameters per component \u2014 ${i.join("; ")}.`,ParametersSchema:{type:"object",properties:e,additionalProperties:!1},InvokableBy:"both",...n?{ReturnsChannelData:n}:{}}}c(Fe,"MergeVerbOffers");var tt="[omitted]";function z(s){return s!==null&&typeof s=="object"&&!Array.isArray(s)}c(z,"isRecord");function C(s,e=0,t=new WeakSet){if(s==null)return null;switch(typeof s){case"string":return s.length>200?`${s.slice(0,200)}\u2026 (${s.length} chars)`:s;case"number":return Number.isFinite(s)?s:null;case"boolean":return s;case"bigint":return s.toString();case"function":case"symbol":return tt;default:break}return nt(s,e,t)}c(C,"ToBoundedJson");function nt(s,e,t){if(s instanceof Date)return Number.isNaN(s.getTime())?null:s.toISOString();if(t.has(s))return"[circular]";if(e>=5)return"[too deep]";t.add(s);try{if(Array.isArray(s)){let i=s.slice(0,30).map(r=>C(r,e+1,t));return s.length>30?[...i,`\u2026 ${s.length-30} more`]:i}let n={};for(let i of Object.keys(s).slice(0,30))i==="__proto__"||i==="constructor"||i==="prototype"||(n[i]=C(s[i],e+1,t));return n}finally{t.delete(s)}}c(nt,"objectToBoundedJson");function it(s,e,t){if(!z(s))return{name:`table ${e+1}`,rowCount:0};let n=Array.isArray(s.rows)?s.rows:[],r=(Array.isArray(s.columns)?s.columns:[]).map(o=>typeof o=="string"?o:z(o)&&typeof o.name=="string"?o.name:null).filter(o=>o!==null).slice(0,40),a={name:typeof s.name=="string"?s.name:`table ${e+1}`,rowCount:n.length,columns:r,rows:n.slice(0,t).map(o=>C(o,1))};return n.length>t&&(a.rowsOmitted=n.length-t),a}c(it,"summarizeTable");function Be(s,e){let t={};for(let n of["title","activeTab","searchText","interpretation"]){let i=s[n];typeof i=="string"&&i.length>0&&(t[n]=C(i))}return Array.isArray(s.drillPath)&&s.drillPath.length>0&&(t.drillPath=C(s.drillPath)),Array.isArray(s.tables)&&(t.tables=s.tables.slice(0,30).map((n,i)=>it(n,i,e))),z(s.custom)&&Object.keys(s.custom).length>0&&(t.custom=C(s.custom)),t}c(Be,"buildSummary");function fe(s,e){if(!z(s))return null;let t=Math.max(0,Math.floor(e.MaxRows)),n=Be(s,t);for(;t>0&&JSON.stringify(n).length>e.MaxChars;)t=Math.floor(t/2),n=Be(s,t);return JSON.stringify(n).length>e.MaxChars?{truncated:!0,note:`The data state is larger than ${e.MaxChars} characters; ask for specifics.`}:n}c(fe,"SummarizeDataState");var O=class extends Error{static{c(this,"InstanceLimitError")}Limit;constructor(e){super(`At most ${e} component${e===1?" is":"s are"} open at once. Close one first.`),this.Limit=e,this.name="InstanceLimitError"}},q=class{static{c(this,"ComponentInstanceEngine")}maxInstances;records=new Map;changedSubject=new be;activeId=null;instanceSeq=0;eventSeq=0;constructor(e){this.maxInstances=e}Changed$=this.changedSubject.asObservable();SetMaxInstances(e){this.maxInstances=e}get Instances(){return[...this.records.values()]}get ActiveID(){return this.activeId}Get(e){return this.records.get(e)}FindByArtifact(e){return this.Instances.find(t=>t.Artifact.ArtifactID.toLowerCase()===e.toLowerCase())}Add(e,t){if(this.records.size>=this.maxInstances)throw new O(this.maxInstances);let n={InstanceID:`c${++this.instanceSeq}`,Artifact:e,Contract:V(e.Spec),Inputs:t,LastEvent:null,Handle:null};return this.records.set(n.InstanceID,n),this.changedSubject.next({Kind:"added",InstanceID:n.InstanceID}),this.SetActive(n.InstanceID),n}Remove(e){if(!this.records.delete(e))return!1;if(this.changedSubject.next({Kind:"removed",InstanceID:e}),this.activeId===e){let t=this.Instances;this.activeId=null,this.SetActive(t.length>0?t[t.length-1].InstanceID:null)}return!0}SwapVersion(e,t){let n=this.records.get(e);return n?(n.Artifact=t,n.Contract=V(t.Spec),n.LastEvent=null,n.Handle=null,this.changedSubject.next({Kind:"version",InstanceID:e}),!0):!1}SetActive(e){return e!==null&&!this.records.has(e)?!1:(this.activeId!==e&&(this.activeId=e,this.changedSubject.next({Kind:"active",InstanceID:e})),!0)}AttachHandle(e,t){let n=this.records.get(e);n&&(n.Handle=t)}RecordEvent(e,t,n){let i=this.records.get(e);return i?(i.LastEvent={Type:t,Payload:n,Seq:++this.eventSeq},this.changedSubject.next({Kind:"event",InstanceID:e}),!0):!1}Dispose(){this.records.clear(),this.activeId=null,this.changedSubject.complete()}};function ve(s,e,t,n,i,r){let a=s[e];return a===void 0?t:typeof a=="number"&&Number.isInteger(a)&&a>=n&&a<=i?a:(r.push(`"${e}" must be a whole number from ${n} to ${i}; using ${t}.`),t)}c(ve,"readBoundedInteger");function He(s,e,t,n){let i=s[e];return i===void 0?t:typeof i=="boolean"?i:(n.push(`"${e}" must be true or false; using ${t}.`),t)}c(He,"readBoolean");function Ce(s){let e=M;if(!G(s))return{Config:{...e},Problems:[]};let t=s,n=[];return{Config:{AutoOpenDelegatedComponents:He(t,"autoOpenDelegatedComponents",e.AutoOpenDelegatedComponents,n),SwapToNewerVersions:He(t,"swapToNewerVersions",e.SwapToNewerVersions,n),MaxInstances:ve(t,"maxInstances",e.MaxInstances,1,ke,n),MaxStateRows:ve(t,"maxStateRows",e.MaxStateRows,1,500,n),MaxStateChars:ve(t,"maxStateChars",e.MaxStateChars,500,5e4,n)},Problems:n}}c(Ce,"ParseInteractiveComponentConfig");var X=class{static{c(this,"ReactComponentHandle")}react;IsReady;constructor(e,t=!0){this.react=e,this.IsReady=t}HasMethod(e){return this.react.HasMethod(e)}InvokeMethod(e,t){return Promise.resolve(this.react.InvokeMethod(e,...t))}GetCurrentDataState(){return this.react.GetCurrentDataState()}Refresh(){this.react.Refresh()}Print(){this.react.Print()}Validate(){return this.react.validate()}IsDirty(){return this.react.IsDirty()}Reset(){this.react.Reset()}ScrollTo(e){this.react.ScrollTo(e)}Focus(e){this.react.Focus(e)}};var st=["react"],W=class s{static{c(this,"InteractiveComponentHostComponent")}_spec;set Spec(e){this._spec!==void 0&&e!==this._spec&&this.HandleChange.emit(null),this._spec=e}get Spec(){return this._spec}Inputs={};Provider=null;Activity=new ne;HandleChange=new ne;react;hostRef=R(k);get Element(){return this.hostRef.nativeElement}OnInitialized(){this.react&&this.HandleChange.emit(new X(this.react)),this.Activity.emit({Kind:"initialized"})}OnComponentEvent(e){this.Activity.emit({Kind:"event",Name:e.type,Payload:e.payload})}static \u0275fac=c(function(t){return new(t||s)},"InteractiveComponentHostComponent_Factory");static \u0275cmp=L({type:s,selectors:[["mj-interactive-component-host"]],viewQuery:c(function(t,n){if(t&1&&Pe(st,5),t&2){let i;De(i=Ae())&&(n.react=i.first)}},"InteractiveComponentHostComponent_Query"),inputs:{Spec:"Spec",Inputs:"Inputs",Provider:"Provider"},outputs:{Activity:"Activity",HandleChange:"HandleChange"},decls:2,vars:3,consts:[["react",""],[1,"ic-host__component",3,"ComponentEvent","StateChange","Initialized","Component","ComponentProps","Provider"]],template:c(function(t,n){t&1&&(p(0,"mj-react-component",1,0),P("ComponentEvent",c(function(r){return n.OnComponentEvent(r)},"InteractiveComponentHostComponent_Template_mj_react_component_ComponentEvent_0_listener"))("StateChange",c(function(){return n.Activity.emit({Kind:"state"})},"InteractiveComponentHostComponent_Template_mj_react_component_StateChange_0_listener"))("Initialized",c(function(){return n.OnInitialized()},"InteractiveComponentHostComponent_Template_mj_react_component_Initialized_0_listener")),f()),t&2&&_("Component",n.Spec)("ComponentProps",n.Inputs)("Provider",n.Provider)},"InteractiveComponentHostComponent_Template"),dependencies:[je,$e],styles:[`[_nghost-%COMP%] {
|
|
2
2
|
display: block;
|
|
3
3
|
height: 100%;
|
|
4
4
|
min-height: 0;
|
|
@@ -142,4 +142,4 @@ import{$a as Re,A as k,Aa as ae,Ba as oe,Ca as _,Da as p,Dc as de,Ea as f,Ec as
|
|
|
142
142
|
}`],changeDetection:0})};var A=class s{static{c(this,"CollectionPermissionService")}_provider=null;set Provider(e){this._provider=e}get Provider(){return this._provider??J.Provider}async LoadPermissions(e,t){let i=await m.FromMetadataProvider(this.Provider).RunView({EntityName:"MJ: Collection Permissions",ExtraFilter:`CollectionID='${e}'`,OrderBy:"__mj_CreatedAt ASC",ResultType:"entity_object"},t);return i.Success&&i.Results?i.Results.map(r=>this.mapToPermission(r)):[]}async loadPermissions(e,t){return this.LoadPermissions(e,t)}async CheckPermission(e,t,n){let r=await m.FromMetadataProvider(this.Provider).RunView({EntityName:"MJ: Collection Permissions",ExtraFilter:`CollectionID='${e}' AND UserID='${t}'`,MaxRows:1,SkipTotalRowCount:!0,ResultType:"entity_object"},n);return r.Success&&r.Results&&r.Results.length>0?this.mapToPermission(r.Results[0]):null}async checkPermission(e,t,n){return this.CheckPermission(e,t,n)}async CheckBulkPermissions(e,t,n){let i=new Map;if(e.length===0)return i;let r=e.map(l=>`CollectionID='${l}'`).join(" OR "),o=await m.FromMetadataProvider(this.Provider).RunView({EntityName:"MJ: Collection Permissions",ExtraFilter:`(${r}) AND UserID='${t}'`,ResultType:"entity_object"},n);if(o.Success&&o.Results)for(let l of o.Results){let u=this.mapToPermission(l);i.set(l.CollectionID,u)}return i}async checkBulkPermissions(e,t,n){return this.CheckBulkPermissions(e,t,n)}async GrantPermission(e,t,n,i,r){let o=await this.Provider.GetEntityObject("MJ: Collection Permissions",r);if(o.CollectionID=e,o.UserID=t,o.CanRead=n.canRead,o.CanShare=n.canShare,o.CanEdit=n.canEdit,o.CanDelete=n.canDelete,o.SharedByUserID=i,!await o.Save())throw new Error(o.LatestResult?.Message||"Failed to grant permission");return o}async grantPermission(e,t,n,i,r){return this.GrantPermission(e,t,n,i,r)}async GrantPermissionCascade(e,t,n,i,r){await this.GrantPermission(e,t,n,i,r),await this.grantChildPermissions(e,t,n,i,r)}async grantPermissionCascade(e,t,n,i,r){return this.GrantPermissionCascade(e,t,n,i,r)}async grantChildPermissions(e,t,n,i,r){let o=await m.FromMetadataProvider(this.Provider).RunView({EntityName:"MJ: Collections",ExtraFilter:`ParentID='${e}'`,ResultType:"entity_object"},r);if(o.Success&&o.Results)for(let l of o.Results){let u=await this.CheckPermission(l.ID,t,r);u?await this.UpdatePermission(u.id,n,r):await this.GrantPermission(l.ID,t,n,i,r),await this.grantChildPermissions(l.ID,t,n,i,r)}}async UpdatePermission(e,t,n){let r=await this.Provider.GetEntityObject("MJ: Collection Permissions",n);return await r.Load(e),r.CanRead=t.canRead,r.CanShare=t.canShare,r.CanEdit=t.canEdit,r.CanDelete=t.canDelete,await r.Save()}async updatePermission(e,t,n){return this.UpdatePermission(e,t,n)}async UpdatePermissionCascade(e,t,n,i){let r=await this.CheckPermission(e,t,i);r&&await this.UpdatePermission(r.id,n,i),await this.updateChildPermissions(e,t,n,i)}async updatePermissionCascade(e,t,n,i){return this.UpdatePermissionCascade(e,t,n,i)}async updateChildPermissions(e,t,n,i){let a=await m.FromMetadataProvider(this.Provider).RunView({EntityName:"MJ: Collections",ExtraFilter:`ParentID='${e}'`,ResultType:"entity_object"},i);if(a.Success&&a.Results)for(let o of a.Results){let l=await this.CheckPermission(o.ID,t,i);l&&await this.UpdatePermission(l.id,n,i),await this.updateChildPermissions(o.ID,t,n,i)}}async RevokePermission(e,t){let i=await this.Provider.GetEntityObject("MJ: Collection Permissions",t);return await i.Load(e),await i.Delete()}async revokePermission(e,t){return this.RevokePermission(e,t)}async RevokePermissionCascade(e,t,n){let i=await this.CheckPermission(e,t,n);i&&await this.RevokePermission(i.id,n),await this.revokeChildPermissions(e,t,n)}async revokePermissionCascade(e,t,n){return this.RevokePermissionCascade(e,t,n)}async revokeChildPermissions(e,t,n){let r=await m.FromMetadataProvider(this.Provider).RunView({EntityName:"MJ: Collections",ExtraFilter:`ParentID='${e}'`,ResultType:"entity_object"},n);if(r.Success&&r.Results)for(let a of r.Results){let o=await this.CheckPermission(a.ID,t,n);o&&await this.RevokePermission(o.id,n),await this.revokeChildPermissions(a.ID,t,n)}}ValidatePermissions(e,t,n){return n?!0:!(e.canShare&&!t.canShare||e.canEdit&&!t.canEdit||e.canDelete&&!t.canDelete)}validatePermissions(e,t,n){return this.ValidatePermissions(e,t,n)}GetAvailablePermissions(e,t){if(t)return["Read","Share","Edit","Delete"];let n=["Read"];return e.canShare&&n.push("Share"),e.canEdit&&n.push("Edit"),e.canDelete&&n.push("Delete"),n}getAvailablePermissions(e,t){return this.GetAvailablePermissions(e,t)}async CopyParentPermissions(e,t,n){let i=await this.LoadPermissions(e,n);for(let r of i){if(await this.CheckPermission(t,r.userId,n)){console.log(`Skipping duplicate permission for user ${r.userId} on collection ${t}`);continue}await this.GrantPermission(t,r.userId,{canRead:r.canRead,canShare:r.canShare,canEdit:r.canEdit,canDelete:r.canDelete},r.sharedByUserId||n.ID,n)}}async copyParentPermissions(e,t,n){return this.CopyParentPermissions(e,t,n)}async DeleteAllPermissions(e,t){let n=await this.LoadPermissions(e,t);for(let i of n)await this.RevokePermission(i.id,t)}async deleteAllPermissions(e,t){return this.DeleteAllPermissions(e,t)}async CreateOwnerPermission(e,t,n){await this.GrantPermission(e,t,{canRead:!0,canShare:!0,canEdit:!0,canDelete:!0},t,n)}async createOwnerPermission(e,t,n){return this.CreateOwnerPermission(e,t,n)}mapToPermission(e){return{id:e.ID,collectionId:e.CollectionID,userId:e.UserID,userName:e.User||"",canRead:e.CanRead,canShare:e.CanShare,canEdit:e.CanEdit,canDelete:e.CanDelete,sharedByUserId:e.SharedByUserID||null,sharedByUserName:e.SharedByUser||null,sharedAt:e.__mj_CreatedAt}}static \u0275fac=c(function(t){return new(t||s)},"CollectionPermissionService_Factory");static \u0275prov=j({token:s,factory:s.\u0275fac,providedIn:"root"})};var Q=class s{static{c(this,"ArtifactPermissionService")}collectionPermissionService;_provider=null;constructor(e){this.collectionPermissionService=e}get Provider(){return this._provider??J.Provider}set Provider(e){this._provider=e,e!==null&&(this.collectionPermissionService.Provider=e)}async LoadPermissions(e,t){let i=await m.FromMetadataProvider(this.Provider).RunView({EntityName:"MJ: Artifact Permissions",ExtraFilter:`ArtifactID='${e}'`,OrderBy:"__mj_CreatedAt ASC",ResultType:"entity_object"},t);return i.Success&&i.Results?i.Results.map(r=>this.mapToPermission(r)):[]}async loadPermissions(e,t){return this.LoadPermissions(e,t)}async CheckPermission(e,t,n,i){let r=await this.getArtifact(e,i);if(r&&x(r.UserID,t))return!0;let a=await this.GetExplicitPermission(e,t,i);if(a)return this.hasPermission(a,n);let o=await this.getArtifactCollections(e,i);for(let l of o){let u=await this.collectionPermissionService.checkPermission(l.CollectionID,t,i);if(u&&this.hasCollectionPermission(u,n))return!0}return!1}async checkPermission(e,t,n,i){return this.CheckPermission(e,t,n,i)}async GetExplicitPermission(e,t,n){let r=await m.FromMetadataProvider(this.Provider).RunView({EntityName:"MJ: Artifact Permissions",ExtraFilter:`ArtifactID='${e}' AND UserID='${t}'`,MaxRows:1,SkipTotalRowCount:!0,ResultType:"entity_object"},n);return r.Success&&r.Results&&r.Results.length>0?this.mapToPermission(r.Results[0]):null}async getExplicitPermission(e,t,n){return this.GetExplicitPermission(e,t,n)}async GetEffectiveUsers(e,t){let n=[],i=new Set,r=await this.getArtifact(e,t);r&&r.UserID&&(n.push({id:"",artifactId:e,userId:r.UserID,userName:r.User||"Owner",canRead:!0,canEdit:!0,canShare:!0,sharedByUserId:null,sharedByUserName:null,sharedAt:r.__mj_CreatedAt,source:"owner"}),i.add(r.UserID));let a=await this.LoadPermissions(e,t);for(let l of a)i.has(l.userId)||(n.push({...l,source:"explicit"}),i.add(l.userId));let o=await this.getArtifactCollections(e,t);for(let l of o){let u=await this.collectionPermissionService.loadPermissions(l.CollectionID,t);for(let h of u)i.has(h.userId)||(n.push({id:"",artifactId:e,userId:h.userId,userName:h.userName,canRead:h.canRead,canEdit:h.canEdit,canShare:h.canShare,sharedByUserId:h.sharedByUserId,sharedByUserName:h.sharedByUserName,sharedAt:h.sharedAt,source:"collection",collectionName:l.Collection||"Unknown Collection"}),i.add(h.userId))}return n}async getEffectiveUsers(e,t){return this.GetEffectiveUsers(e,t)}async GrantPermission(e,t,n,i,r){let o=await this.Provider.GetEntityObject("MJ: Artifact Permissions",r);if(o.ArtifactID=e,o.UserID=t,o.CanRead=n.canRead,o.CanEdit=n.canEdit,o.CanShare=n.canShare,o.SharedByUserID=i,!await o.Save())throw new Error(o.LatestResult?.Message||"Failed to grant permission");return o}async grantPermission(e,t,n,i,r){return this.GrantPermission(e,t,n,i,r)}async UpdatePermission(e,t,n){let r=await this.Provider.GetEntityObject("MJ: Artifact Permissions",n);return await r.Load(e),r.CanRead=t.canRead,r.CanEdit=t.canEdit,r.CanShare=t.canShare,await r.Save()}async updatePermission(e,t,n){return this.UpdatePermission(e,t,n)}async RevokePermission(e,t){let i=await this.Provider.GetEntityObject("MJ: Artifact Permissions",t);return await i.Load(e),await i.Delete()}async revokePermission(e,t){return this.RevokePermission(e,t)}ValidatePermissions(e,t,n){return n?!0:!(e.canEdit&&!t.canEdit||e.canShare&&!t.canShare)}validatePermissions(e,t,n){return this.ValidatePermissions(e,t,n)}GetAvailablePermissions(e,t){if(t)return["Read","Edit","Share"];let n=["Read"];return e.canEdit&&n.push("Edit"),e.canShare&&n.push("Share"),n}getAvailablePermissions(e,t){return this.GetAvailablePermissions(e,t)}async IsOwner(e,t,n){let i=await this.getArtifact(e,n);return i?x(i.UserID,t):!1}async isOwner(e,t,n){return this.IsOwner(e,t,n)}async GetUserPermissions(e,t){let[n,i,r]=await Promise.all([this.CheckPermission(e,t.ID,"read",t),this.CheckPermission(e,t.ID,"edit",t),this.CheckPermission(e,t.ID,"share",t)]);return{canRead:n,canEdit:i,canShare:r}}async getUserPermissions(e,t){return this.GetUserPermissions(e,t)}async GetReadableArtifactsFilter(e,t){let n=`(UserID='${e}')`,i=m.FromMetadataProvider(this.Provider),[r,a]=await i.RunViews([{EntityName:"MJ: Artifact Permissions",ExtraFilter:`UserID='${e}'`,Fields:["ArtifactID","CanRead"],ResultType:"simple"},{EntityName:"MJ: Collection Permissions",ExtraFilter:`UserID='${e}' AND CanRead=1`,Fields:["CollectionID"],ResultType:"simple"}],t);if(!r.Success)return console.error("Failed to load artifact grants:",r.ErrorMessage),n;let o=r.Results??[],l=a.Success?(a.Results??[]).map(te=>te.CollectionID):[],u=await this.getArtifactIdsInCollections(l,t),h=this.resolveReadableArtifactIds(o,u);return h.length>0?`(UserID='${e}' OR ID IN (${h.map(te=>`'${te}'`).join(",")}))`:n}async getArtifactIdsInCollections(e,t){if(e.length===0)return[];let n=m.FromMetadataProvider(this.Provider),i=await n.RunView({EntityName:"MJ: Collection Artifacts",ExtraFilter:`CollectionID IN (${e.map(o=>`'${o}'`).join(",")})`,Fields:["ArtifactVersionID"],ResultType:"simple"},t),r=i.Success?(i.Results??[]).map(o=>o.ArtifactVersionID):[];if(r.length===0)return[];let a=await n.RunView({EntityName:"MJ: Artifact Versions",ExtraFilter:`ID IN (${r.map(o=>`'${o}'`).join(",")})`,Fields:["ArtifactID"],ResultType:"simple"},t);return a.Success?(a.Results??[]).map(o=>o.ArtifactID):[]}resolveReadableArtifactIds(e,t){let n=new Map;for(let r of e){let a=U(r.ArtifactID),o=(n.get(a)?.canRead??!1)||!!r.CanRead;n.set(a,{id:r.ArtifactID,canRead:o})}let i=new Map;for(let{id:r,canRead:a}of n.values())a&&i.set(U(r),r);for(let r of t){let a=U(r);!n.has(a)&&!i.has(a)&&i.set(a,r)}return[...i.values()]}async getArtifact(e,t){let i=await m.FromMetadataProvider(this.Provider).RunView({EntityName:"MJ: Artifacts",ExtraFilter:`ID='${e}'`,MaxRows:1,SkipTotalRowCount:!0,ResultType:"entity_object"},t);return i.Success&&i.Results&&i.Results.length>0?i.Results[0]:null}async getArtifactCollections(e,t){let i=await m.FromMetadataProvider(this.Provider).RunView({EntityName:"MJ: Collection Artifacts",ExtraFilter:`ArtifactVersionID IN (
|
|
143
143
|
SELECT ID FROM [__mj].[vwArtifactVersions] WHERE ArtifactID='${e}'
|
|
144
144
|
)`,ResultType:"entity_object"},t);return i.Success&&i.Results?i.Results:[]}hasPermission(e,t){switch(t){case"read":return e.canRead;case"edit":return e.canEdit;case"share":return e.canShare;default:return!1}}hasCollectionPermission(e,t){switch(t){case"read":return e.canRead;case"edit":return e.canEdit;case"share":return e.canShare;default:return!1}}mapToPermission(e){return{id:e.ID,artifactId:e.ArtifactID,userId:e.UserID,userName:e.User||"",canRead:e.CanRead,canEdit:e.CanEdit,canShare:e.CanShare,sharedByUserId:e.SharedByUserID||null,sharedByUserName:e.SharedByUser||null,sharedAt:e.__mj_CreatedAt}}static \u0275fac=c(function(t){return new(t||s)(_e(A))},"ArtifactPermissionService_Factory");static \u0275prov=j({token:s,factory:s.\u0275fac,providedIn:"root"})};function ut(s){return s!==null&&typeof s=="object"&&!Array.isArray(s)}c(ut,"isRecord");function Ge(s,e){if(typeof s!="string"||s.trim().length===0)throw new v("unreadable",`${e} has no inline content to render (content stored as a file is not supported by the Interactive Component channel).`);let t=Ne(s);if(!ut(t)||typeof t.name!="string")throw new v("not_a_component",`${e} is not an interactive component (its content is not a component specification).`);let n=typeof t.code=="string"&&t.code.trim().length>0,i=typeof t.namespace=="string"&&t.namespace.length>0;if(!n&&!i)throw new v("not_a_component",`${e} is a component specification with no executable code yet, so it cannot be shown.`);return t}c(Ge,"ParseComponentSpecContent");var pt=/^\{?[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\}?$/i,ht="Component";function ye(s,e){let t=s.trim();if(!pt.test(t))throw new v("invalid_id",`"${s}" is not a valid ${e} id.`);return t.replace(/[{}]/g,"")}c(ye,"requireUuid");var Z=class{static{c(this,"RunViewComponentArtifactSource")}provider;user;permissions;constructor(e,t){this.provider=e,this.user=t,this.permissions=new Q(new A),this.permissions.Provider=e}async LoadVersion(e){let t=ye(e,"artifact version"),n=await this.queryOne("MJ: Artifact Versions",`ID='${t}'`,"artifact version");return this.resolve(n)}async LoadLatest(e){let t=ye(e,"artifact"),n=await this.queryOne("MJ: Artifact Versions",`ArtifactID='${t}'`,"artifact","VersionNumber DESC");return this.resolve(n)}async queryOne(e,t,n,i){let a=await m.FromMetadataProvider(this.provider).RunView({EntityName:e,ExtraFilter:t,OrderBy:i,MaxRows:1,SkipTotalRowCount:!0,ResultType:"entity_object"},this.user);if(!a.Success)throw N(`[InteractiveComponent] Loading ${n} failed: ${a.ErrorMessage}`),new v("load_failed",`The ${n} could not be loaded.`);if(!a.Results||a.Results.length===0)throw new v("not_found",`No ${n} with that id exists, or you cannot see it.`);return a.Results[0]}async resolve(e){let t=e.ArtifactID;if(!await this.permissions.CheckPermission(t,this.user.ID,"read",this.user))throw new v("access_denied","You do not have access to that artifact.");let i=await this.queryOne("MJ: Artifacts",`ID='${ye(t,"artifact")}'`,"artifact");if(!x(i.ID,t)||i.Type!==ht)throw new v("not_a_component",`"${i.Name}" is a ${i.Type} artifact, not an interactive component.`);let r=e.Name??i.Name;return{ArtifactID:i.ID,VersionID:e.ID,VersionNumber:e.VersionNumber,Name:r,Spec:Ge(e.Content,`"${r}"`)}}};var ft=function(s,e,t,n){var i=arguments.length,r=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,e,t,n);else for(var o=s.length-1;o>=0;o--)(a=s[o])&&(r=(i<3?a(r):i>3?a(e,t,r):a(e,t))||r);return i>3&&r&&Object.defineProperty(e,t,r),r},vt=100,Ct=80,gt=1200,It=[{Name:"opened",Description:"A component was opened. Carries the inputs it was opened with."},{Name:"closed",Description:"A component was closed."},{Name:"version_changed",Description:"A component now shows a different version of its artifact (you asked for it, or a newer version appeared).",PayloadSchema:{type:"object",properties:{from:{type:"string",description:"The version id it showed."},to:{type:"string",description:"The version id it shows now."},reason:{type:"string",enum:["agent","newer-version"]}}}},{Name:"newer_version_available",Description:"A newer version of an open component exists, and this session is not set to swap to it automatically.",PayloadSchema:{type:"object",properties:{current:{type:"string"},available:{type:"string"}}}}];function d(s,e,t){return t?{Success:!1,ErrorCode:s,Error:e,Details:t}:{Success:!1,ErrorCode:s,Error:e}}c(d,"failure");function $(s,e){let t=s[e];return typeof t=="string"&&t.trim().length>0?t.trim():void 0}c($,"readString");var ee=class extends D{static{c(this,"InteractiveComponentChannel")}Engine=new q(M.MaxInstances);Config={...M};HandlePollIntervalMs=vt;DataSettleMs=gt;artifactSource=null;surface=null;settleTimer=null;get ChannelName(){return I}get InstanceId(){return"all"}get TabTitle(){return"Components"}get TabIcon(){return"fa-solid fa-cubes"}GetToolDefinitions(){return[]}SetArtifactSource(e){this.artifactSource=e}GetDescriptor(){return{Key:this.ChannelName,Version:Oe,DisplayName:"Interactive Components",OwningPackage:"@memberjunction/ng-conversations",Instructions:'Shows the user an interactive component (a dashboard, report, chart or form) built as an artifact, next to the conversation. Open one with action "open" and an artifactId (its latest version) or an artifactVersionId. The result lists the actions THAT component supports and the events it reports; use them as actions of this channel. Several components can be open: pass the instance id to say which, otherwise the one the user is looking at is used. You can open components other agents built (they come back as artifacts). You are told what the user is looking at and what they do in it; do not narrate routine changes.',Nouns:[{Name:"components",Description:"The open components keyed by instance id: which artifact version each shows, whether it is the one the user is looking at, what the user last did in it, and (when the component reports one) a bounded summary of its data.",Schema:{type:"object",additionalProperties:{type:"object"}}}],Verbs:this.collectVerbs(),Inputs:{type:"object",properties:{artifactId:{type:"string",description:"The artifact to open (its latest version is shown)."},artifactVersionId:{type:"string",description:"A specific artifact version to open (instead of artifactId)."},inputs:{type:"object",description:"Values for the component's own properties, as its spec declares them."}},additionalProperties:!1},Events:this.collectEvents(),DisplayPolicy:"on-demand",DefaultAvailability:"opt-in",MaxExposure:"pixels",MultiInstance:!0}}collectVerbs(){let e=[{Name:b.ShowVersion,Description:"Shows another version of an open component's own artifact in place (the instance stays open and keeps its id).",ParametersSchema:{type:"object",properties:{versionId:{type:"string",description:"The artifact version to show."}},required:["versionId"],additionalProperties:!1},InvokableBy:"agent"},{Name:b.Close,Description:"Closes an open component.",ParametersSchema:{type:"object",properties:{},additionalProperties:!1},InvokableBy:"agent"}],t=new Map;for(let n of this.Engine.Instances)for(let i of n.Contract.Verbs){let r=i.Verb.Name.toLowerCase(),a=t.get(r)??[];a.push({Component:n.Artifact.Name,Verb:i.Verb}),t.set(r,a)}return[...e,...[...t.values()].map(n=>Fe(n))]}collectEvents(){let e=new Map(It.map(t=>[t.Name.toLowerCase(),t]));for(let t of this.Engine.Instances)for(let n of t.Contract.Events)e.has(n.Name.toLowerCase())||e.set(n.Name.toLowerCase(),n);return[...e.values()]}GetOnboardingDetails(){return{Heading:"Interactive components",Description:"The agent can open an interactive component \u2014 a dashboard, report or form \u2014 right here during the call, and work with it alongside you.",Tips:["Switch between open components using the tabs along the top.",'The agent sees what you select and change, so you can say "this one" and point.','Use the "Agent can see" control to limit what the agent perceives.'],IconClass:"fa-solid fa-cubes"}}OnInitialize(){let e=Ce(this.Context?.ChannelConfig);this.Config=e.Config,this.Engine.SetMaxInstances(this.Config.MaxInstances);for(let t of e.Problems)console.warn(`[RealtimeChannel:${I}] Configuration: ${t}`);if(!this.artifactSource){let t=this.Context?.Provider,n=t?.CurrentUser;t&&n&&(this.artifactSource=new Z(t,n))}this.enableVisualPerceptionIfAvailable()}enableVisualPerceptionIfAvailable(){pe.Instance.Capturer&&this.EnableVisualPerception({GetLatestFrame:c(()=>this.CaptureActiveFrame(),"GetLatestFrame")})}async CaptureActiveFrame(){let e=pe.Instance.Capturer;if(!e||this.Exposure!=="pixels"||!this.Context?.Client?.IsTrackEstablished("video","inbound"))return null;let t=this.surface?.GetActiveElement()??null;if(!t)return null;try{return await e(t)}catch(n){return N(`[RealtimeChannel:${I}] Capturing a component frame failed: ${n instanceof Error?n.message:String(n)}`),null}}GetSurfaceComponent(){return Y}BindSurface(e){this.surface=e,e.Engine=this.Engine,e.AgentName=this.Context?.AgentName??"The agent",e.Provider=this.Context?.Provider??null,e.ActivityHandler=(t,n)=>this.OnComponentActivity(t,n)}UnbindSurface(){this.surface=null}Dispose(){this.settleTimer!==null&&(clearTimeout(this.settleTimer),this.settleTimer=null),this.surface=null,this.Engine.Dispose(),super.Dispose()}SerializeState(){return null}RestoreState(e){return!1}GetState(){let e={};for(let t of this.Engine.Instances)e[t.InstanceID]=this.describeForState(t);return{components:e}}describeForState(e){let t={name:e.Artifact.Name,artifactId:e.Artifact.ArtifactID,artifactVersionId:e.Artifact.VersionID,versionNumber:e.Artifact.VersionNumber,active:this.Engine.ActiveID===e.InstanceID};if(Object.keys(e.Inputs).length>0&&(t.inputs=C(e.Inputs)),e.LastEvent&&(t.lastEvent={type:e.LastEvent.Type,payload:e.LastEvent.Payload,seq:e.LastEvent.Seq}),e.Contract.SupportsDataState&&e.Handle?.IsReady){let n=fe(e.Handle.GetCurrentDataState(),{MaxRows:this.Config.MaxStateRows,MaxChars:this.Config.MaxStateChars});n&&(t.data=n)}return t}async OnOpen(e){let t=$(e,"artifactId"),n=$(e,"artifactVersionId");if(t===void 0==(n===void 0))return d("invalid_params","Provide exactly one of artifactId (the latest version) or artifactVersionId (a specific version).");let i=this.artifactSource;if(!i)return d("open_failed","Components cannot be loaded in this session (no signed-in user to load them for).");let r;try{r=n?await i.LoadVersion(n):await i.LoadLatest(t)}catch(o){return this.mapLoadFailure(o)}let a=this.Engine.FindByArtifact(r.ArtifactID);return a?this.reuseOpenInstance(a,r):this.addInstance(r,e)}addInstance(e,t){let n=G(t.inputs)?t.inputs:{},i=le(n,this.inputsSchemaFor(e),"$.inputs");if(i.length>0)return d("invalid_params",`The inputs for "${e.Name}" are invalid.`,i);try{let r=this.Engine.Add(e,n);return{Success:!0,Instance:r.InstanceID,Result:this.describeOpened(r)}}catch(r){if(r instanceof O)return d("open_failed",r.message,[`open: ${this.Engine.Instances.map(a=>`${a.InstanceID} (${a.Artifact.Name})`).join(", ")}`]);throw r}}inputsSchemaFor(e){return V(e.Spec).InputsSchema}async reuseOpenInstance(e,t){return this.Engine.SetActive(e.InstanceID),e.Artifact.VersionID!==t.VersionID&&this.swapVersion(e,t,"agent"),{Success:!0,Instance:e.InstanceID,Result:{...this.describeOpened(e),alreadyOpen:!0}}}describeOpened(e){return{artifactId:e.Artifact.ArtifactID,artifactVersionId:e.Artifact.VersionID,versionNumber:e.Artifact.VersionNumber,name:e.Artifact.Name,actions:e.Contract.Verbs.map(t=>`${t.Verb.Name}(${me(t.Verb.ParametersSchema)}) \u2014 ${t.Verb.Description}`),events:e.Contract.Events.map(t=>t.Name),...e.Contract.Skipped.length>0?{unavailable:e.Contract.Skipped.map(t=>`${t.Name}: ${t.Reason}`)}:{}}}mapLoadFailure(e){return e instanceof v?d(e.Code==="invalid_id"?"invalid_params":"open_failed",e.message,[e.Code]):(N(`[RealtimeChannel:${I}] Loading a component artifact failed: ${e instanceof Error?e.message:String(e)}`),d("open_failed","That artifact could not be loaded."))}AcceptsDelegationArtifacts(e,t){return e.some(n=>this.Engine.FindByArtifact(n.ArtifactID))?!0:e.length>0&&Ce(t).Config.AutoOpenDelegatedComponents}async OnDelegationArtifacts(e){for(let t of e){let n=this.Engine.FindByArtifact(t.ArtifactID);n?await this.takeNewerVersion(n,t):this.Config.AutoOpenDelegatedComponents&&await this.autoOpen(t)}}async autoOpen(e){let t=await this.Open({artifactVersionId:e.ArtifactVersionID});!t.Success&&!(t.Details??[]).includes("not_a_component")&&console.warn(`[RealtimeChannel:${I}] Could not open delegated artifact "${e.Name}": ${t.Error??t.ErrorCode}`)}async takeNewerVersion(e,t){if(e.Artifact.VersionID.toLowerCase()===t.ArtifactVersionID.toLowerCase()||!this.artifactSource)return;let n;try{n=await this.artifactSource.LoadVersion(t.ArtifactVersionID)}catch(i){console.warn(`[RealtimeChannel:${I}] Could not load the newer version of "${e.Artifact.Name}": ${i instanceof Error?i.message:String(i)}`);return}n.VersionNumber<=e.Artifact.VersionNumber||(this.Config.SwapToNewerVersions?this.swapVersion(e,n,"newer-version"):(this.EmitChannelEvent("newer_version_available",{current:e.Artifact.VersionID,available:n.VersionID},void 0,e.InstanceID),this.Exposure!=="none"&&this.Context?.SendContextNote(de(I,e.InstanceID,"newer_version_available",{current:e.Artifact.VersionID,available:n.VersionID}))))}swapVersion(e,t,n){let i=e.Artifact.VersionID;this.Engine.SwapVersion(e.InstanceID,t);let r={from:i,to:t.VersionID,reason:n};this.EmitChannelEvent("version_changed",r,void 0,e.InstanceID),n==="newer-version"&&this.Exposure!=="none"&&this.Context?.SendContextNote(de(I,e.InstanceID,"version_changed",{...r,actions:e.Contract.Verbs.map(a=>a.Verb.Name)})),this.RecordChange({Author:n==="agent"?"agent":"system"})}async ApplyVerb(e,t,n,i){let r=e.trim().toLowerCase(),a=this.resolveInstance(r,i);if("Success"in a)return a;let o=n==="agent"?this.refuseForExposure(a,r):null;return o||(r===b.ShowVersion?this.showVersion(a,t):r===b.Close?this.closeInstance(a):this.invokeDerived(a,r,t,n))}refuseForExposure(e,t){let n=e.Contract.Verbs.find(r=>r.Verb.Name.toLowerCase()===t),i=n?this.RefuseVerbForExposure(n.Verb):null;return i?d("exposure_restricted",i,[...this.ExposureReasons]):null}resolveInstance(e,t){let n=c(a=>e===b.ShowVersion||e===b.Close||a.Contract.Verbs.some(o=>o.Verb.Name.toLowerCase()===e),"supports");if(t!==void 0){let a=this.Engine.Get(t);return a?n(a)?a:d("verb_failed",`"${a.Artifact.Name}" has no action "${e}".`):d("unknown_instance",`No component "${t}" is open.`,[`open: ${this.listOpen()}`])}let i=this.Engine.Instances.filter(n),r=i.find(a=>a.InstanceID===this.Engine.ActiveID);return r||(i.length===1?i[0]:i.length===0?d("verb_failed",`No open component has an action "${e}".`,[`open: ${this.listOpen()||"nothing"}`]):d("ambiguous_instance",`Several open components have "${e}"; say which with the instance.`,[`open: ${this.listOpen()}`]))}listOpen(){return this.Engine.Instances.map(e=>`${e.InstanceID} (${e.Artifact.Name})`).join(", ")}async showVersion(e,t){let n=$(t,"versionId");if(!n||!this.artifactSource)return d("invalid_params",n?"Components cannot be loaded in this session.":"show_version needs a versionId.");let i;try{i=await this.artifactSource.LoadVersion(n)}catch(r){return this.mapLoadFailure(r)}return i.ArtifactID.toLowerCase()!==e.Artifact.ArtifactID.toLowerCase()?d("verb_failed",`That version belongs to a different artifact ("${i.Name}"). Open it with "open" instead.`):i.VersionID.toLowerCase()===e.Artifact.VersionID.toLowerCase()?{Success:!0,Result:{changed:!1,instance:e.InstanceID,versionNumber:i.VersionNumber}}:(this.swapVersion(e,i,"agent"),{Success:!0,Result:{changed:!0,instance:e.InstanceID,...this.describeOpened(e)}})}closeInstance(e){let t=e.Artifact.Name;return this.Engine.Remove(e.InstanceID),this.EmitChannelEvent("closed",{name:t},void 0,e.InstanceID),this.RecordChange({Author:"agent"}),{Success:!0,Result:{closed:!0,instance:e.InstanceID}}}async invokeDerived(e,t,n,i){let r=e.Contract.Verbs.find(l=>l.Verb.Name.toLowerCase()===t);if(!r)return d("verb_failed",`"${e.Artifact.Name}" has no action "${t}".`);let a=le(n,r.Verb.ParametersSchema);if(a.length>0)return d("invalid_params",`The parameters for ${r.Verb.Name} on "${e.Artifact.Name}" are invalid. Expected ${r.Verb.Name}(${me(r.Verb.ParametersSchema)}).`,a);let o=await this.waitForHandle(e);if(!o)return d("verb_failed",`"${e.Artifact.Name}" is still loading. Try again in a moment.`);try{let l=await this.runBinding(e,o,r,n);return this.afterAction(e,r,i),{Success:!0,Result:{instance:e.InstanceID,...l}}}catch(l){return console.error(`[RealtimeChannel:${I}] ${r.Verb.Name} on "${e.Artifact.Name}" threw:`,l),d("verb_failed",`${r.Verb.Name} failed: ${l instanceof Error?l.message:String(l)}`)}}async waitForHandle(e){for(let t=0;t<Ct;t++){if(e.Handle?.IsReady)return e.Handle;if(!this.Engine.Get(e.InstanceID))return null;await new Promise(n=>setTimeout(n,this.HandlePollIntervalMs))}return e.Handle?.IsReady?e.Handle:null}async runBinding(e,t,n,i){let r=n.Binding;if(r.Kind==="custom"){if(!t.HasMethod(r.Method))throw new Error(`the component does not implement ${r.Method}`);let a=r.ParameterNames.map(l=>i[l]),o=await t.InvokeMethod(r.Method,a);return{result:C(o)}}switch(r.Standard){case"Refresh":return t.Refresh(),{refreshed:!0};case"Print":return t.Print(),{printing:!0};case"Validate":return{validation:C(t.Validate())};case"IsDirty":return{dirty:t.IsDirty()};case"Reset":return t.Reset(),{reset:!0};case"ScrollTo":return this.scrollTo(t,i);case"Focus":return t.Focus($(i,"target")),{focused:!0};case"GetDataState":{let a=fe(t.GetCurrentDataState(),{MaxRows:this.Config.MaxStateRows,MaxChars:this.Config.MaxStateChars});return a?{data:a}:{data:null,note:"The component has no data state yet."}}default:throw new Error(`unsupported standard action ${String(r.Standard)} on ${e.Artifact.Name}`)}}scrollTo(e,t){let n=$(t,"target");if(n!==void 0)return e.ScrollTo(n),{scrolledTo:n};let i=typeof t.top=="number"?t.top:void 0,r=typeof t.left=="number"?t.left:void 0;if(i===void 0&&r===void 0)throw new Error("scroll_to needs a target selector or a top/left offset");return e.ScrollTo({top:i,left:r}),{scrolled:!0}}afterAction(e,t,n){t.Binding.Kind==="standard"&&(t.Binding.Standard==="GetDataState"||t.Binding.Standard==="IsDirty"||t.Binding.Standard==="Validate"||t.Binding.Standard==="Print")||(this.Engine.SetActive(e.InstanceID),this.RecordChange({Author:n}),this.scheduleSettle(n),this.ConfirmVisualChange())}OnComponentActivity(e,t){let n=this.Engine.Get(e);if(!n)return;if(t.Kind==="closed"){this.userClosed(n);return}if(t.Kind==="selected"){this.Engine.ActiveID!==e&&(this.Engine.SetActive(e),this.RecordChange({Author:"user"}),this.NotifyVisualChange());return}t.Kind==="event"&&t.Name&&this.Engine.RecordEvent(e,t.Name,C(t.Payload));let i=this.RecordChange({Author:t.Kind==="initialized"?"system":"user"});t.Kind==="event"&&t.Name&&this.EmitChannelEvent(t.Name,{payload:C(t.Payload)},i,e),this.scheduleSettle("user"),this.NotifyVisualChange()}userClosed(e){let t=e.Artifact.Name;this.Engine.Remove(e.InstanceID),this.EmitChannelEvent("closed",{name:t,by:"user"},void 0,e.InstanceID),this.RecordChange({Author:"user"})}scheduleSettle(e){this.settleTimer!==null||this.Exposure==="none"||(this.settleTimer=setTimeout(()=>{this.settleTimer=null,this.RecordChange({Author:e})},this.DataSettleMs))}};ee=ft([Me(D,T)],ee);function kn(){let s=Te.Instance.ClassFactory;s.GetRegistration(D,T)===null&&s.Register(D,ee,T)}c(kn,"EnsureInteractiveComponentChannelRegistered");export{kn as EnsureInteractiveComponentChannelRegistered};
|
|
145
|
-
//# sourceMappingURL=interactive-chunk-entry-
|
|
145
|
+
//# sourceMappingURL=interactive-chunk-entry-EYXXXLJN.js.map
|