@sisense/sdk-ui 1.27.0 → 1.27.1
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/ai.cjs +1 -1
- package/dist/ai.js +3 -3
- package/dist/analytics-composer.cjs +1 -1
- package/dist/analytics-composer.js +3 -3
- package/dist/{derive-chart-family-BXkBWhAA.cjs → derive-chart-family-DDkQybGb.cjs} +1 -1
- package/dist/{derive-chart-family-DRBbYXus.js → derive-chart-family-H_RlUbXY.js} +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +5 -5
- package/dist/{useQuery-BWxPQevB.js → useQuery-DOgANgSI.js} +35913 -33820
- package/dist/useQuery-KI9icU5_.cjs +915 -0
- package/dist/{widget-composer-BBhoRRAJ.js → widget-composer-NNyD6tF2.js} +1 -1
- package/dist/{widget-composer-Dwta0nDD.cjs → widget-composer-ldmqMCC4.cjs} +1 -1
- package/package.json +7 -7
- package/dist/useQuery-DHk01evX.cjs +0 -882
package/dist/ai.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var Be=Object.defineProperty,Ne=Object.defineProperties;var Ie=Object.getOwnPropertyDescriptors;var G=Object.getOwnPropertySymbols;var he=Object.prototype.hasOwnProperty,pe=Object.prototype.propertyIsEnumerable;var ee=(e,t,o)=>t in e?Be(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,y=(e,t)=>{for(var o in t||(t={}))he.call(t,o)&&ee(e,o,t[o]);if(G)for(var o of G(t))pe.call(t,o)&&ee(e,o,t[o]);return e},k=(e,t)=>Ne(e,Ie(t));var Ce=(e,t)=>{var o={};for(var r in e)he.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&G)for(var r of G(e))t.indexOf(r)<0&&pe.call(e,r)&&(o[r]=e[r]);return o};var M=(e,t,o)=>(ee(e,typeof t!="symbol"?t+"":t,o),o);var N=(e,t,o)=>new Promise((r,i)=>{var l=c=>{try{u(o.next(c))}catch(h){i(h)}},a=c=>{try{u(o.throw(c))}catch(h){i(h)}},u=c=>c.done?r(c.value):Promise.resolve(c.value).then(l,a);u((o=o.apply(e,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./useQuery-DHk01evX.cjs"),n=require("react/jsx-runtime"),d=require("react"),x=require("./derive-chart-family-BXkBWhAA.cjs"),me=require("./widget-composer-Dwta0nDD.cjs");function We(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const r=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,r.get?r:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const D=We(d);function Oe(e){return s.generateUtilityClass("MuiDialog",e)}const te=s.generateUtilityClasses("MuiDialog",["root","scrollPaper","scrollBody","container","paper","paperScrollPaper","paperScrollBody","paperWidthFalse","paperWidthXs","paperWidthSm","paperWidthMd","paperWidthLg","paperWidthXl","paperFullWidth","paperFullScreen"]),be=D.createContext({});process.env.NODE_ENV!=="production"&&(be.displayName="DialogContext");const qe=["aria-describedby","aria-labelledby","BackdropComponent","BackdropProps","children","className","disableEscapeKeyDown","fullScreen","fullWidth","maxWidth","onBackdropClick","onClick","onClose","open","PaperComponent","PaperProps","scroll","TransitionComponent","transitionDuration","TransitionProps"],ze=s.styled(s.Backdrop,{name:"MuiDialog",slot:"Backdrop",overrides:(e,t)=>t.backdrop})({zIndex:-1}),Ae=e=>{const{classes:t,scroll:o,maxWidth:r,fullWidth:i,fullScreen:l}=e,a={root:["root"],container:["container",`scroll${s.capitalize(o)}`],paper:["paper",`paperScroll${s.capitalize(o)}`,`paperWidth${s.capitalize(String(r))}`,i&&"paperFullWidth",l&&"paperFullScreen"]};return s.composeClasses(a,Oe,t)},Ze=s.styled(s.Modal,{name:"MuiDialog",slot:"Root",overridesResolver:(e,t)=>t.root})({"@media print":{position:"absolute !important"}}),Qe=s.styled("div",{name:"MuiDialog",slot:"Container",overridesResolver:(e,t)=>{const{ownerState:o}=e;return[t.container,t[`scroll${s.capitalize(o.scroll)}`]]}})(({ownerState:e})=>s._extends({height:"100%","@media print":{height:"auto"},outline:0},e.scroll==="paper"&&{display:"flex",justifyContent:"center",alignItems:"center"},e.scroll==="body"&&{overflowY:"auto",overflowX:"hidden",textAlign:"center","&::after":{content:'""',display:"inline-block",verticalAlign:"middle",height:"100%",width:"0"}})),Ve=s.styled(s.Paper,{name:"MuiDialog",slot:"Paper",overridesResolver:(e,t)=>{const{ownerState:o}=e;return[t.paper,t[`scrollPaper${s.capitalize(o.scroll)}`],t[`paperWidth${s.capitalize(String(o.maxWidth))}`],o.fullWidth&&t.paperFullWidth,o.fullScreen&&t.paperFullScreen]}})(({theme:e,ownerState:t})=>s._extends({margin:32,position:"relative",overflowY:"auto","@media print":{overflowY:"visible",boxShadow:"none"}},t.scroll==="paper"&&{display:"flex",flexDirection:"column",maxHeight:"calc(100% - 64px)"},t.scroll==="body"&&{display:"inline-block",verticalAlign:"middle",textAlign:"left"},!t.maxWidth&&{maxWidth:"calc(100% - 64px)"},t.maxWidth==="xs"&&{maxWidth:e.breakpoints.unit==="px"?Math.max(e.breakpoints.values.xs,444):`max(${e.breakpoints.values.xs}${e.breakpoints.unit}, 444px)`,[`&.${te.paperScrollBody}`]:{[e.breakpoints.down(Math.max(e.breakpoints.values.xs,444)+32*2)]:{maxWidth:"calc(100% - 64px)"}}},t.maxWidth&&t.maxWidth!=="xs"&&{maxWidth:`${e.breakpoints.values[t.maxWidth]}${e.breakpoints.unit}`,[`&.${te.paperScrollBody}`]:{[e.breakpoints.down(e.breakpoints.values[t.maxWidth]+32*2)]:{maxWidth:"calc(100% - 64px)"}}},t.fullWidth&&{width:"calc(100% - 64px)"},t.fullScreen&&{margin:0,width:"100%",maxWidth:"100%",height:"100%",maxHeight:"none",borderRadius:0,[`&.${te.paperScrollBody}`]:{margin:0,maxWidth:"100%"}})),ye=D.forwardRef(function(t,o){const r=s.useDefaultProps({props:t,name:"MuiDialog"}),i=s.useTheme(),l={enter:i.transitions.duration.enteringScreen,exit:i.transitions.duration.leavingScreen},{"aria-describedby":a,"aria-labelledby":u,BackdropComponent:c,BackdropProps:h,children:p,className:g,disableEscapeKeyDown:C=!1,fullScreen:f=!1,fullWidth:R=!1,maxWidth:v="sm",onBackdropClick:b,onClick:P,onClose:L,open:m,PaperComponent:F=s.Paper,PaperProps:w={},scroll:q="paper",TransitionComponent:S=s.Fade,transitionDuration:z=l,TransitionProps:Y}=r,X=s._objectWithoutPropertiesLoose(r,qe),I=s._extends({},r,{disableEscapeKeyDown:C,fullScreen:f,fullWidth:R,maxWidth:v,scroll:q}),W=Ae(I),O=D.useRef(),H=T=>{O.current=T.target===T.currentTarget},V=T=>{P&&P(T),O.current&&(O.current=null,b&&b(T),L&&L(T,"backdropClick"))},A=s.useId(u),j=D.useMemo(()=>({titleId:A}),[A]);return n.jsx(Ze,s._extends({className:s.clsx(W.root,g),closeAfterTransition:!0,components:{Backdrop:ze},componentsProps:{backdrop:s._extends({transitionDuration:z,as:c},h)},disableEscapeKeyDown:C,onClose:L,open:m,ref:o,onClick:V,ownerState:I},X,{children:n.jsx(S,s._extends({appear:!0,in:m,timeout:z,role:"presentation"},Y,{children:n.jsx(Qe,{className:s.clsx(W.container),onMouseDown:H,ownerState:I,children:n.jsx(Ve,s._extends({as:F,elevation:24,role:"dialog","aria-describedby":a,"aria-labelledby":A},w,{className:s.clsx(W.paper,w.className),ownerState:I,children:n.jsx(be.Provider,{value:j,children:p})}))})}))}))});process.env.NODE_ENV!=="production"&&(ye.propTypes={"aria-describedby":s.PropTypes.string,"aria-labelledby":s.PropTypes.string,BackdropComponent:s.PropTypes.elementType,BackdropProps:s.PropTypes.object,children:s.PropTypes.node,classes:s.PropTypes.object,className:s.PropTypes.string,disableEscapeKeyDown:s.PropTypes.bool,fullScreen:s.PropTypes.bool,fullWidth:s.PropTypes.bool,maxWidth:s.PropTypes.oneOfType([s.PropTypes.oneOf(["xs","sm","md","lg","xl",!1]),s.PropTypes.string]),onBackdropClick:s.PropTypes.func,onClick:s.PropTypes.func,onClose:s.PropTypes.func,open:s.PropTypes.bool.isRequired,PaperComponent:s.PropTypes.elementType,PaperProps:s.PropTypes.object,scroll:s.PropTypes.oneOf(["body","paper"]),sx:s.PropTypes.oneOfType([s.PropTypes.arrayOf(s.PropTypes.oneOfType([s.PropTypes.func,s.PropTypes.object,s.PropTypes.bool])),s.PropTypes.func,s.PropTypes.object]),TransitionComponent:s.PropTypes.elementType,transitionDuration:s.PropTypes.oneOfType([s.PropTypes.number,s.PropTypes.shape({appear:s.PropTypes.number,enter:s.PropTypes.number,exit:s.PropTypes.number})]),TransitionProps:s.PropTypes.object});class Ge extends s.Subscribable{constructor(t,o){super(),this.client=t,this.setOptions(o),this.bindMethods(),this.updateResult()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var o;const r=this.options;this.options=this.client.defaultMutationOptions(t),s.shallowEqualObjects(r,this.options)||this.client.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.currentMutation,observer:this}),(o=this.currentMutation)==null||o.setOptions(this.options)}onUnsubscribe(){if(!this.hasListeners()){var t;(t=this.currentMutation)==null||t.removeObserver(this)}}onMutationUpdate(t){this.updateResult();const o={listeners:!0};t.type==="success"?o.onSuccess=!0:t.type==="error"&&(o.onError=!0),this.notify(o)}getCurrentResult(){return this.currentResult}reset(){this.currentMutation=void 0,this.updateResult(),this.notify({listeners:!0})}mutate(t,o){return this.mutateOptions=o,this.currentMutation&&this.currentMutation.removeObserver(this),this.currentMutation=this.client.getMutationCache().build(this.client,k(y({},this.options),{variables:typeof t!="undefined"?t:this.options.variables})),this.currentMutation.addObserver(this),this.currentMutation.execute()}updateResult(){const t=this.currentMutation?this.currentMutation.state:s.getDefaultState(),o=k(y({},t),{isLoading:t.status==="loading",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset});this.currentResult=o}notify(t){s.notifyManager.batch(()=>{if(this.mutateOptions&&this.hasListeners()){if(t.onSuccess){var o,r,i,l;(o=(r=this.mutateOptions).onSuccess)==null||o.call(r,this.currentResult.data,this.currentResult.variables,this.currentResult.context),(i=(l=this.mutateOptions).onSettled)==null||i.call(l,this.currentResult.data,null,this.currentResult.variables,this.currentResult.context)}else if(t.onError){var a,u,c,h;(a=(u=this.mutateOptions).onError)==null||a.call(u,this.currentResult.error,this.currentResult.variables,this.currentResult.context),(c=(h=this.mutateOptions).onSettled)==null||c.call(h,void 0,this.currentResult.error,this.currentResult.variables,this.currentResult.context)}}t.listeners&&this.listeners.forEach(({listener:p})=>{p(this.currentResult)})})}}function se(e,t,o){const r=s.parseMutationArgs(e,t),i=s.useQueryClient({context:r.context}),[l]=D.useState(()=>new Ge(i,r));D.useEffect(()=>{l.setOptions(r)},[l,r]);const a=s.useSyncExternalStore(D.useCallback(c=>l.subscribe(s.notifyManager.batchCalls(c)),[l]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),u=D.useCallback((c,h)=>{l.mutate(c,h).catch(_e)},[l]);if(a.error&&s.shouldThrowError(l.options.useErrorBoundary,[a.error]))throw a.error;return k(y({},a),{mutate:u,mutateAsync:a.mutate})}function _e(){}class Ue{constructor(t){M(this,"httpClient");M(this,"getChatContexts",()=>N(this,null,function*(){return(yield this.httpClient.get("api/datasources//"))||[]}));M(this,"getNlgQueryResult",t=>this.httpClient.post("api/v2/ai/nlg/queryResult",t));M(this,"getQueryRecommendations",(t,o)=>this.httpClient.get(`api/v2/ai/recommendations/query/${t}/${o.numOfRecommendations}`));M(this,"setLlmConfig",t=>this.httpClient.post("api/v2/settings/ai/llmProvider",t).catch(o=>{console.error("Unable to set llm config",o)}));M(this,"getAllChats",()=>this.httpClient.get("api/v2/ai/chats"));M(this,"getChatById",t=>this.httpClient.get(`api/v2/ai/chats/${t}`));M(this,"createChat",t=>this.httpClient.post("api/v2/ai/chats",{sourceId:t}));M(this,"postChat",(t,o)=>this.httpClient.post(`api/v2/ai/chats/${t}`,o));M(this,"deleteChatHistory",t=>this.httpClient.delete(`api/v2/ai/chats/${t}/history`));M(this,"sendFeedback",t=>this.httpClient.post("api/v2/ai/feedback",t));M(this,"getDataSourceFields",t=>this.httpClient.post(`api/datasources/${encodeURIComponent(t)}/fields/search`,{offset:0,count:9999}));M(this,"ai",{getNlgQueryResult:this.getNlgQueryResult,getQueryRecommendations:this.getQueryRecommendations,setLlmConfig:this.setLlmConfig,sendFeedback:this.sendFeedback,getDataSourceFields:this.getDataSourceFields,chat:{getAll:this.getAllChats,getById:this.getChatById,create:this.createChat,post:this.postChat,clearHistory:this.deleteChatHistory}});this.httpClient=t}}const Ke=new s.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,refetchOnMount:!1}}}),ve=d.createContext(void 0),$=()=>d.useContext(ve),Je=({children:e})=>{const{app:t}=s.useSisenseContext(),o=d.useMemo(()=>t?new Ue(t.httpClient):void 0,[t]);return n.jsx(ve.Provider,{value:o,children:n.jsx(s.QueryClientProvider,{client:Ke,children:e})})};function Ye({children:e}){return n.jsx(Je,{children:e})}const K=(e,t=!0)=>{const o=d.useMemo(()=>{var p,g;if("jaql"in e)return e;{const C=x.convertJaqlDataSource(e.dataSource),{filters:f=[],relations:R}=x.getFilterListAndRelationsJaql(e.filters),{metadata:v,filterRelations:b}=s.getJaqlQueryPayload({dataSource:e.dataSource,attributes:(p=e.dimensions)!=null?p:[],measures:(g=e.measures)!=null?g:[],filters:f,filterRelations:R,highlights:[]},!0);return{jaql:{datasource:C,metadata:v,filterRelations:b}}}},[e]),r=$(),{data:i,error:l,isError:a,isLoading:u,isSuccess:c,refetch:h}=s.useQuery({queryKey:["getNlgQueryResult",o,r],queryFn:()=>r==null?void 0:r.ai.getNlgQueryResult(o),select:p=>{var g;return(g=p==null?void 0:p.data)==null?void 0:g.answer},enabled:!!r&&t});return{isLoading:u,isError:a,isSuccess:c,data:i,error:l,refetch:d.useCallback(()=>{h()},[h])}},Xe=e=>{const r=e,{enabled:t}=r,o=Ce(r,["enabled"]);return K(o,t)},et=s.withTracking("useGetNlgQueryResult")(Xe),we=Object.freeze({enableFollowupQuestions:!1,enableHeader:!0,enableInsights:!0,numOfRecommendations:4,numOfRecentPrompts:5}),je=d.createContext(y({},we)),E=()=>d.useContext(je),tt=({children:e,value:t})=>{const{t:o}=x.useTranslation(),r=Object.entries(t).reduce((i,[l,a])=>(a!==void 0&&(i[l]=a),i),k(y({},we),{inputPromptText:o("ai.config.inputPromptText"),welcomeText:o("ai.config.welcomeText"),suggestionsWelcomeText:o("ai.config.suggestionsWelcomeText")}));return n.jsx(je.Provider,{value:r,children:e})},ke=e=>{const{contextTitle:t,count:o}=e,r=$(),{numOfRecommendations:i}=E(),l=o!=null?o:i,a=l>0,{isLoading:u,isError:c,isSuccess:h,data:p,error:g,refetch:C}=s.useQuery({queryKey:["getQueryRecommendations",t,l,r],queryFn:()=>r==null?void 0:r.ai.getQueryRecommendations(t,{numOfRecommendations:l}),enabled:!!r&&a});return{isLoading:a?u:!1,isError:a?c:!1,isSuccess:a?h:!1,data:a&&p?p:[],error:a?g:null,refetch:d.useCallback(()=>{a&&C()},[C,a])}},nt=s.withTracking("useGetQueryRecommendations")(ke),re="chatHistory",ot=e=>{const t=$(),{hideHistory:o}=E();return s.useQuery({queryKey:[re,e,t],queryFn:()=>N(exports,null,function*(){if(!t||!e)return;if(o)return[];const r=yield t.ai.chat.getById(e);return r==null?void 0:r.chatHistory}),enabled:!!t&&!!e})},Se=e=>{const t=$(),o=s.useQueryClient();return se({mutationFn:()=>N(exports,null,function*(){if(!(!t||!e))return t.ai.chat.clearHistory(e)}),onError:r=>{console.error("Error when clearing history:",r)},onSettled:()=>{e&&o.setQueriesData([re,e],[])}})},Te=e=>{const{data:t,isLoading:o,isError:r}=ot(e),{mutate:i}=Se(e);return d.useEffect(()=>{r&&i()},[r,i]),{history:t,isLoading:o,isError:r}},Me=()=>{const e=$(),{data:t,isLoading:o,fetchStatus:r}=s.useQuery({queryKey:["getDataTopics",e],queryFn:()=>N(exports,null,function*(){if(e)return e.getChatContexts()}),enabled:!!e});return{data:t,isLoading:o,fetchStatus:r}},Re=()=>{const e=$(),{data:t,isLoading:o}=s.useQuery({queryKey:["getAllChats",e],queryFn:()=>e==null?void 0:e.ai.chat.getAll(),enabled:!!e});return{data:t!=null?t:[],isLoading:o}},st=(e,t)=>{const o=s.useQueryClient(),r=$(),i=se({mutationFn:()=>N(exports,null,function*(){if(!(!r||!e))return r.ai.chat.create(e)}),onSuccess:()=>o.invalidateQueries(["getAllChats"])});return d.useEffect(()=>{t&&i.isIdle&&i.mutate()},[t,i]),i},rt=(e,t)=>{switch(e.responseType=e.responseType.toLowerCase(),e.responseType){case"nlq":return{content:JSON.stringify(e.data),role:"assistant",type:"nlq"};case"text":case"error":return{content:e.data.answer,role:"assistant"};default:throw Error(`${t}${JSON.stringify(e)}`)}},it=e=>{const t=s.useQueryClient(),o=d.useCallback(c=>{e&&t.setQueriesData([re,e],h=>h&&[...h,c])},[t,e]),{enableFollowupQuestions:r}=E(),{t:i}=x.useTranslation(),l=$(),{mutate:a,isLoading:u}=se({mutationFn:c=>N(exports,null,function*(){if(!(!l||!e))return l.ai.chat.post(e,{text:c,options:{enableFollowup:r}})}),onMutate:c=>{o({content:c,role:"user"})},onError:c=>{c instanceof Error&&(console.error("Error when sending message:",c.message),o({content:i("errors.unexpectedChatResponse"),role:"assistant"}))},onSuccess:c=>{if(!c)return;const h=i("ai.errors.unknownResponse");o(rt(c,h))}});return{mutate:a,isLoading:u}},ie=e=>!!e&&"type"in e&&e.type==="nlq",at=e=>!!e&&"type"in e&&e.type==="text",Le=e=>{var m,F;const{t}=x.useTranslation(),{data:o,isLoading:r}=Me(),{data:i,isLoading:l}=Re(),a=(m=o==null?void 0:o.find(w=>w.title===e))==null?void 0:m.title,u=(F=i.find(w=>w.contextTitle===a))==null?void 0:F.chatId,c=r||!!a,h=l||!!u,[p,g]=d.useState(null),{isError:C}=st(a,c&&!h),{history:f,isLoading:R,isError:v}=Te(u);d.useEffect(()=>{C?g(new x.TranslatableError("ai.errors.chatUnavailable")):v&&g(new x.TranslatableError("ai.errors.fetchHistory"))},[C,v,t]);const{mutate:b,isLoading:P}=it(u),L=d.useMemo(()=>{if(f!=null&&f.length){const w=f[f.length-1];if(ie(w))return JSON.parse(w.content)}return null},[f]);return{chatId:u,history:f!=null?f:[],lastNlqResponse:L,sendMessage:b,isAwaitingResponse:P,isLoading:R,lastError:p}},lt=({contextTitle:e})=>{var i;const{data:t}=Re(),o=(i=t.find(l=>l.contextTitle===e))==null?void 0:i.chatId,{history:r}=Te(o);return d.useMemo(()=>{if(r!=null&&r.length){const l=r[r.length-1];if(ie(l))return JSON.parse(l.content)}return null},[r])},ct=e=>{const t=$(),{data:o,isLoading:r}=s.useQuery({queryKey:["getDataSourceFields",e,t],queryFn:()=>e?t==null?void 0:t.ai.getDataSourceFields(e):void 0,select:i=>i,enabled:!!t&&!!e});return{data:o,isLoading:r}},dt=500,ut=500,ht=500,pt=900,Ct=s.newStyled.div`
|
|
1
|
+
"use strict";var Be=Object.defineProperty,Ne=Object.defineProperties;var Ie=Object.getOwnPropertyDescriptors;var G=Object.getOwnPropertySymbols;var he=Object.prototype.hasOwnProperty,pe=Object.prototype.propertyIsEnumerable;var ee=(e,t,o)=>t in e?Be(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,y=(e,t)=>{for(var o in t||(t={}))he.call(t,o)&&ee(e,o,t[o]);if(G)for(var o of G(t))pe.call(t,o)&&ee(e,o,t[o]);return e},k=(e,t)=>Ne(e,Ie(t));var Ce=(e,t)=>{var o={};for(var r in e)he.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&G)for(var r of G(e))t.indexOf(r)<0&&pe.call(e,r)&&(o[r]=e[r]);return o};var M=(e,t,o)=>(ee(e,typeof t!="symbol"?t+"":t,o),o);var N=(e,t,o)=>new Promise((r,i)=>{var l=c=>{try{u(o.next(c))}catch(h){i(h)}},a=c=>{try{u(o.throw(c))}catch(h){i(h)}},u=c=>c.done?r(c.value):Promise.resolve(c.value).then(l,a);u((o=o.apply(e,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./useQuery-KI9icU5_.cjs"),n=require("react/jsx-runtime"),d=require("react"),x=require("./derive-chart-family-DDkQybGb.cjs"),me=require("./widget-composer-ldmqMCC4.cjs");function We(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const r=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,r.get?r:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const D=We(d);function Oe(e){return s.generateUtilityClass("MuiDialog",e)}const te=s.generateUtilityClasses("MuiDialog",["root","scrollPaper","scrollBody","container","paper","paperScrollPaper","paperScrollBody","paperWidthFalse","paperWidthXs","paperWidthSm","paperWidthMd","paperWidthLg","paperWidthXl","paperFullWidth","paperFullScreen"]),be=D.createContext({});process.env.NODE_ENV!=="production"&&(be.displayName="DialogContext");const qe=["aria-describedby","aria-labelledby","BackdropComponent","BackdropProps","children","className","disableEscapeKeyDown","fullScreen","fullWidth","maxWidth","onBackdropClick","onClick","onClose","open","PaperComponent","PaperProps","scroll","TransitionComponent","transitionDuration","TransitionProps"],ze=s.styled(s.Backdrop,{name:"MuiDialog",slot:"Backdrop",overrides:(e,t)=>t.backdrop})({zIndex:-1}),Ae=e=>{const{classes:t,scroll:o,maxWidth:r,fullWidth:i,fullScreen:l}=e,a={root:["root"],container:["container",`scroll${s.capitalize(o)}`],paper:["paper",`paperScroll${s.capitalize(o)}`,`paperWidth${s.capitalize(String(r))}`,i&&"paperFullWidth",l&&"paperFullScreen"]};return s.composeClasses(a,Oe,t)},Ze=s.styled(s.Modal,{name:"MuiDialog",slot:"Root",overridesResolver:(e,t)=>t.root})({"@media print":{position:"absolute !important"}}),Qe=s.styled("div",{name:"MuiDialog",slot:"Container",overridesResolver:(e,t)=>{const{ownerState:o}=e;return[t.container,t[`scroll${s.capitalize(o.scroll)}`]]}})(({ownerState:e})=>s._extends({height:"100%","@media print":{height:"auto"},outline:0},e.scroll==="paper"&&{display:"flex",justifyContent:"center",alignItems:"center"},e.scroll==="body"&&{overflowY:"auto",overflowX:"hidden",textAlign:"center","&::after":{content:'""',display:"inline-block",verticalAlign:"middle",height:"100%",width:"0"}})),Ve=s.styled(s.Paper,{name:"MuiDialog",slot:"Paper",overridesResolver:(e,t)=>{const{ownerState:o}=e;return[t.paper,t[`scrollPaper${s.capitalize(o.scroll)}`],t[`paperWidth${s.capitalize(String(o.maxWidth))}`],o.fullWidth&&t.paperFullWidth,o.fullScreen&&t.paperFullScreen]}})(({theme:e,ownerState:t})=>s._extends({margin:32,position:"relative",overflowY:"auto","@media print":{overflowY:"visible",boxShadow:"none"}},t.scroll==="paper"&&{display:"flex",flexDirection:"column",maxHeight:"calc(100% - 64px)"},t.scroll==="body"&&{display:"inline-block",verticalAlign:"middle",textAlign:"left"},!t.maxWidth&&{maxWidth:"calc(100% - 64px)"},t.maxWidth==="xs"&&{maxWidth:e.breakpoints.unit==="px"?Math.max(e.breakpoints.values.xs,444):`max(${e.breakpoints.values.xs}${e.breakpoints.unit}, 444px)`,[`&.${te.paperScrollBody}`]:{[e.breakpoints.down(Math.max(e.breakpoints.values.xs,444)+32*2)]:{maxWidth:"calc(100% - 64px)"}}},t.maxWidth&&t.maxWidth!=="xs"&&{maxWidth:`${e.breakpoints.values[t.maxWidth]}${e.breakpoints.unit}`,[`&.${te.paperScrollBody}`]:{[e.breakpoints.down(e.breakpoints.values[t.maxWidth]+32*2)]:{maxWidth:"calc(100% - 64px)"}}},t.fullWidth&&{width:"calc(100% - 64px)"},t.fullScreen&&{margin:0,width:"100%",maxWidth:"100%",height:"100%",maxHeight:"none",borderRadius:0,[`&.${te.paperScrollBody}`]:{margin:0,maxWidth:"100%"}})),ye=D.forwardRef(function(t,o){const r=s.useDefaultProps({props:t,name:"MuiDialog"}),i=s.useTheme(),l={enter:i.transitions.duration.enteringScreen,exit:i.transitions.duration.leavingScreen},{"aria-describedby":a,"aria-labelledby":u,BackdropComponent:c,BackdropProps:h,children:p,className:g,disableEscapeKeyDown:C=!1,fullScreen:f=!1,fullWidth:R=!1,maxWidth:v="sm",onBackdropClick:b,onClick:P,onClose:L,open:m,PaperComponent:F=s.Paper,PaperProps:w={},scroll:q="paper",TransitionComponent:S=s.Fade,transitionDuration:z=l,TransitionProps:Y}=r,X=s._objectWithoutPropertiesLoose(r,qe),I=s._extends({},r,{disableEscapeKeyDown:C,fullScreen:f,fullWidth:R,maxWidth:v,scroll:q}),W=Ae(I),O=D.useRef(),H=T=>{O.current=T.target===T.currentTarget},V=T=>{P&&P(T),O.current&&(O.current=null,b&&b(T),L&&L(T,"backdropClick"))},A=s.useId(u),j=D.useMemo(()=>({titleId:A}),[A]);return n.jsx(Ze,s._extends({className:s.clsx(W.root,g),closeAfterTransition:!0,components:{Backdrop:ze},componentsProps:{backdrop:s._extends({transitionDuration:z,as:c},h)},disableEscapeKeyDown:C,onClose:L,open:m,ref:o,onClick:V,ownerState:I},X,{children:n.jsx(S,s._extends({appear:!0,in:m,timeout:z,role:"presentation"},Y,{children:n.jsx(Qe,{className:s.clsx(W.container),onMouseDown:H,ownerState:I,children:n.jsx(Ve,s._extends({as:F,elevation:24,role:"dialog","aria-describedby":a,"aria-labelledby":A},w,{className:s.clsx(W.paper,w.className),ownerState:I,children:n.jsx(be.Provider,{value:j,children:p})}))})}))}))});process.env.NODE_ENV!=="production"&&(ye.propTypes={"aria-describedby":s.PropTypes.string,"aria-labelledby":s.PropTypes.string,BackdropComponent:s.PropTypes.elementType,BackdropProps:s.PropTypes.object,children:s.PropTypes.node,classes:s.PropTypes.object,className:s.PropTypes.string,disableEscapeKeyDown:s.PropTypes.bool,fullScreen:s.PropTypes.bool,fullWidth:s.PropTypes.bool,maxWidth:s.PropTypes.oneOfType([s.PropTypes.oneOf(["xs","sm","md","lg","xl",!1]),s.PropTypes.string]),onBackdropClick:s.PropTypes.func,onClick:s.PropTypes.func,onClose:s.PropTypes.func,open:s.PropTypes.bool.isRequired,PaperComponent:s.PropTypes.elementType,PaperProps:s.PropTypes.object,scroll:s.PropTypes.oneOf(["body","paper"]),sx:s.PropTypes.oneOfType([s.PropTypes.arrayOf(s.PropTypes.oneOfType([s.PropTypes.func,s.PropTypes.object,s.PropTypes.bool])),s.PropTypes.func,s.PropTypes.object]),TransitionComponent:s.PropTypes.elementType,transitionDuration:s.PropTypes.oneOfType([s.PropTypes.number,s.PropTypes.shape({appear:s.PropTypes.number,enter:s.PropTypes.number,exit:s.PropTypes.number})]),TransitionProps:s.PropTypes.object});class Ge extends s.Subscribable{constructor(t,o){super(),this.client=t,this.setOptions(o),this.bindMethods(),this.updateResult()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var o;const r=this.options;this.options=this.client.defaultMutationOptions(t),s.shallowEqualObjects(r,this.options)||this.client.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.currentMutation,observer:this}),(o=this.currentMutation)==null||o.setOptions(this.options)}onUnsubscribe(){if(!this.hasListeners()){var t;(t=this.currentMutation)==null||t.removeObserver(this)}}onMutationUpdate(t){this.updateResult();const o={listeners:!0};t.type==="success"?o.onSuccess=!0:t.type==="error"&&(o.onError=!0),this.notify(o)}getCurrentResult(){return this.currentResult}reset(){this.currentMutation=void 0,this.updateResult(),this.notify({listeners:!0})}mutate(t,o){return this.mutateOptions=o,this.currentMutation&&this.currentMutation.removeObserver(this),this.currentMutation=this.client.getMutationCache().build(this.client,k(y({},this.options),{variables:typeof t!="undefined"?t:this.options.variables})),this.currentMutation.addObserver(this),this.currentMutation.execute()}updateResult(){const t=this.currentMutation?this.currentMutation.state:s.getDefaultState(),o=k(y({},t),{isLoading:t.status==="loading",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset});this.currentResult=o}notify(t){s.notifyManager.batch(()=>{if(this.mutateOptions&&this.hasListeners()){if(t.onSuccess){var o,r,i,l;(o=(r=this.mutateOptions).onSuccess)==null||o.call(r,this.currentResult.data,this.currentResult.variables,this.currentResult.context),(i=(l=this.mutateOptions).onSettled)==null||i.call(l,this.currentResult.data,null,this.currentResult.variables,this.currentResult.context)}else if(t.onError){var a,u,c,h;(a=(u=this.mutateOptions).onError)==null||a.call(u,this.currentResult.error,this.currentResult.variables,this.currentResult.context),(c=(h=this.mutateOptions).onSettled)==null||c.call(h,void 0,this.currentResult.error,this.currentResult.variables,this.currentResult.context)}}t.listeners&&this.listeners.forEach(({listener:p})=>{p(this.currentResult)})})}}function se(e,t,o){const r=s.parseMutationArgs(e,t),i=s.useQueryClient({context:r.context}),[l]=D.useState(()=>new Ge(i,r));D.useEffect(()=>{l.setOptions(r)},[l,r]);const a=s.useSyncExternalStore(D.useCallback(c=>l.subscribe(s.notifyManager.batchCalls(c)),[l]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),u=D.useCallback((c,h)=>{l.mutate(c,h).catch(_e)},[l]);if(a.error&&s.shouldThrowError(l.options.useErrorBoundary,[a.error]))throw a.error;return k(y({},a),{mutate:u,mutateAsync:a.mutate})}function _e(){}class Ue{constructor(t){M(this,"httpClient");M(this,"getChatContexts",()=>N(this,null,function*(){return(yield this.httpClient.get("api/datasources//"))||[]}));M(this,"getNlgQueryResult",t=>this.httpClient.post("api/v2/ai/nlg/queryResult",t));M(this,"getQueryRecommendations",(t,o)=>this.httpClient.get(`api/v2/ai/recommendations/query/${t}/${o.numOfRecommendations}`));M(this,"setLlmConfig",t=>this.httpClient.post("api/v2/settings/ai/llmProvider",t).catch(o=>{console.error("Unable to set llm config",o)}));M(this,"getAllChats",()=>this.httpClient.get("api/v2/ai/chats"));M(this,"getChatById",t=>this.httpClient.get(`api/v2/ai/chats/${t}`));M(this,"createChat",t=>this.httpClient.post("api/v2/ai/chats",{sourceId:t}));M(this,"postChat",(t,o)=>this.httpClient.post(`api/v2/ai/chats/${t}`,o));M(this,"deleteChatHistory",t=>this.httpClient.delete(`api/v2/ai/chats/${t}/history`));M(this,"sendFeedback",t=>this.httpClient.post("api/v2/ai/feedback",t));M(this,"getDataSourceFields",t=>this.httpClient.post(`api/datasources/${encodeURIComponent(t)}/fields/search`,{offset:0,count:9999}));M(this,"ai",{getNlgQueryResult:this.getNlgQueryResult,getQueryRecommendations:this.getQueryRecommendations,setLlmConfig:this.setLlmConfig,sendFeedback:this.sendFeedback,getDataSourceFields:this.getDataSourceFields,chat:{getAll:this.getAllChats,getById:this.getChatById,create:this.createChat,post:this.postChat,clearHistory:this.deleteChatHistory}});this.httpClient=t}}const Ke=new s.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,refetchOnMount:!1}}}),ve=d.createContext(void 0),$=()=>d.useContext(ve),Je=({children:e})=>{const{app:t}=s.useSisenseContext(),o=d.useMemo(()=>t?new Ue(t.httpClient):void 0,[t]);return n.jsx(ve.Provider,{value:o,children:n.jsx(s.QueryClientProvider,{client:Ke,children:e})})};function Ye({children:e}){return n.jsx(Je,{children:e})}const K=(e,t=!0)=>{const o=d.useMemo(()=>{var p,g;if("jaql"in e)return e;{const C=x.convertJaqlDataSource(e.dataSource),{filters:f=[],relations:R}=x.getFilterListAndRelationsJaql(e.filters),{metadata:v,filterRelations:b}=s.getJaqlQueryPayload({dataSource:e.dataSource,attributes:(p=e.dimensions)!=null?p:[],measures:(g=e.measures)!=null?g:[],filters:f,filterRelations:R,highlights:[]},!0);return{jaql:{datasource:C,metadata:v,filterRelations:b}}}},[e]),r=$(),{data:i,error:l,isError:a,isLoading:u,isSuccess:c,refetch:h}=s.useQuery({queryKey:["getNlgQueryResult",o,r],queryFn:()=>r==null?void 0:r.ai.getNlgQueryResult(o),select:p=>{var g;return(g=p==null?void 0:p.data)==null?void 0:g.answer},enabled:!!r&&t});return{isLoading:u,isError:a,isSuccess:c,data:i,error:l,refetch:d.useCallback(()=>{h()},[h])}},Xe=e=>{const r=e,{enabled:t}=r,o=Ce(r,["enabled"]);return K(o,t)},et=s.withTracking("useGetNlgQueryResult")(Xe),we=Object.freeze({enableFollowupQuestions:!1,enableHeader:!0,enableInsights:!0,numOfRecommendations:4,numOfRecentPrompts:5}),je=d.createContext(y({},we)),E=()=>d.useContext(je),tt=({children:e,value:t})=>{const{t:o}=x.useTranslation(),r=Object.entries(t).reduce((i,[l,a])=>(a!==void 0&&(i[l]=a),i),k(y({},we),{inputPromptText:o("ai.config.inputPromptText"),welcomeText:o("ai.config.welcomeText"),suggestionsWelcomeText:o("ai.config.suggestionsWelcomeText")}));return n.jsx(je.Provider,{value:r,children:e})},ke=e=>{const{contextTitle:t,count:o}=e,r=$(),{numOfRecommendations:i}=E(),l=o!=null?o:i,a=l>0,{isLoading:u,isError:c,isSuccess:h,data:p,error:g,refetch:C}=s.useQuery({queryKey:["getQueryRecommendations",t,l,r],queryFn:()=>r==null?void 0:r.ai.getQueryRecommendations(t,{numOfRecommendations:l}),enabled:!!r&&a});return{isLoading:a?u:!1,isError:a?c:!1,isSuccess:a?h:!1,data:a&&p?p:[],error:a?g:null,refetch:d.useCallback(()=>{a&&C()},[C,a])}},nt=s.withTracking("useGetQueryRecommendations")(ke),re="chatHistory",ot=e=>{const t=$(),{hideHistory:o}=E();return s.useQuery({queryKey:[re,e,t],queryFn:()=>N(exports,null,function*(){if(!t||!e)return;if(o)return[];const r=yield t.ai.chat.getById(e);return r==null?void 0:r.chatHistory}),enabled:!!t&&!!e})},Se=e=>{const t=$(),o=s.useQueryClient();return se({mutationFn:()=>N(exports,null,function*(){if(!(!t||!e))return t.ai.chat.clearHistory(e)}),onError:r=>{console.error("Error when clearing history:",r)},onSettled:()=>{e&&o.setQueriesData([re,e],[])}})},Te=e=>{const{data:t,isLoading:o,isError:r}=ot(e),{mutate:i}=Se(e);return d.useEffect(()=>{r&&i()},[r,i]),{history:t,isLoading:o,isError:r}},Me=()=>{const e=$(),{data:t,isLoading:o,fetchStatus:r}=s.useQuery({queryKey:["getDataTopics",e],queryFn:()=>N(exports,null,function*(){if(e)return e.getChatContexts()}),enabled:!!e});return{data:t,isLoading:o,fetchStatus:r}},Re=()=>{const e=$(),{data:t,isLoading:o}=s.useQuery({queryKey:["getAllChats",e],queryFn:()=>e==null?void 0:e.ai.chat.getAll(),enabled:!!e});return{data:t!=null?t:[],isLoading:o}},st=(e,t)=>{const o=s.useQueryClient(),r=$(),i=se({mutationFn:()=>N(exports,null,function*(){if(!(!r||!e))return r.ai.chat.create(e)}),onSuccess:()=>o.invalidateQueries(["getAllChats"])});return d.useEffect(()=>{t&&i.isIdle&&i.mutate()},[t,i]),i},rt=(e,t)=>{switch(e.responseType=e.responseType.toLowerCase(),e.responseType){case"nlq":return{content:JSON.stringify(e.data),role:"assistant",type:"nlq"};case"text":case"error":return{content:e.data.answer,role:"assistant"};default:throw Error(`${t}${JSON.stringify(e)}`)}},it=e=>{const t=s.useQueryClient(),o=d.useCallback(c=>{e&&t.setQueriesData([re,e],h=>h&&[...h,c])},[t,e]),{enableFollowupQuestions:r}=E(),{t:i}=x.useTranslation(),l=$(),{mutate:a,isLoading:u}=se({mutationFn:c=>N(exports,null,function*(){if(!(!l||!e))return l.ai.chat.post(e,{text:c,options:{enableFollowup:r}})}),onMutate:c=>{o({content:c,role:"user"})},onError:c=>{c instanceof Error&&(console.error("Error when sending message:",c.message),o({content:i("errors.unexpectedChatResponse"),role:"assistant"}))},onSuccess:c=>{if(!c)return;const h=i("ai.errors.unknownResponse");o(rt(c,h))}});return{mutate:a,isLoading:u}},ie=e=>!!e&&"type"in e&&e.type==="nlq",at=e=>!!e&&"type"in e&&e.type==="text",Le=e=>{var m,F;const{t}=x.useTranslation(),{data:o,isLoading:r}=Me(),{data:i,isLoading:l}=Re(),a=(m=o==null?void 0:o.find(w=>w.title===e))==null?void 0:m.title,u=(F=i.find(w=>w.contextTitle===a))==null?void 0:F.chatId,c=r||!!a,h=l||!!u,[p,g]=d.useState(null),{isError:C}=st(a,c&&!h),{history:f,isLoading:R,isError:v}=Te(u);d.useEffect(()=>{C?g(new x.TranslatableError("ai.errors.chatUnavailable")):v&&g(new x.TranslatableError("ai.errors.fetchHistory"))},[C,v,t]);const{mutate:b,isLoading:P}=it(u),L=d.useMemo(()=>{if(f!=null&&f.length){const w=f[f.length-1];if(ie(w))return JSON.parse(w.content)}return null},[f]);return{chatId:u,history:f!=null?f:[],lastNlqResponse:L,sendMessage:b,isAwaitingResponse:P,isLoading:R,lastError:p}},lt=({contextTitle:e})=>{var i;const{data:t}=Re(),o=(i=t.find(l=>l.contextTitle===e))==null?void 0:i.chatId,{history:r}=Te(o);return d.useMemo(()=>{if(r!=null&&r.length){const l=r[r.length-1];if(ie(l))return JSON.parse(l.content)}return null},[r])},ct=e=>{const t=$(),{data:o,isLoading:r}=s.useQuery({queryKey:["getDataSourceFields",e,t],queryFn:()=>e?t==null?void 0:t.ai.getDataSourceFields(e):void 0,select:i=>i,enabled:!!t&&!!e});return{data:o,isLoading:r}},dt=500,ut=500,ht=500,pt=900,Ct=s.newStyled.div`
|
|
2
2
|
box-sizing: border-box;
|
|
3
3
|
position: relative;
|
|
4
4
|
display: flex;
|
package/dist/ai.js
CHANGED
|
@@ -36,12 +36,12 @@ var Q = (e, t, n) => new Promise((r, i) => {
|
|
|
36
36
|
}, c = (l) => l.done ? r(l.value) : Promise.resolve(l.value).then(a, s);
|
|
37
37
|
c((n = n.apply(e, t)).next());
|
|
38
38
|
});
|
|
39
|
-
import {
|
|
39
|
+
import { k as ht, j as pt, s as ue, be as Ct, bf as gt, o as _, _ as V, bg as We, D as ft, bh as mt, l as bt, bi as xt, m as me, P as f, p as yt, bj as vt, bk as wt, bl as kt, bm as Pe, bn as St, bo as oe, bp as Mt, bq as $t, br as Lt, aQ as Rt, M as Tt, aR as Et, g as Ht, b2 as Y, T as Oe, am as u, aB as H, Y as b, az as Ze, av as Bt, bs as Dt, aC as Ae, bt as Ft, ax as Nt, ap as te, aE as It, bu as Wt, X as qe, aM as Pt } from "./useQuery-DOgANgSI.js";
|
|
40
40
|
import { jsx as o, jsxs as h, Fragment as D } from "react/jsx-runtime";
|
|
41
41
|
import * as q from "react";
|
|
42
42
|
import { createContext as ze, useMemo as N, useContext as Qe, useCallback as E, useEffect as ne, useState as L, useRef as K, useLayoutEffect as ce, memo as Ot, forwardRef as Zt, createElement as At } from "react";
|
|
43
|
-
import { n as qt, bc as zt, ac as v, T as xe, u as Ve, ag as ye, Y as Qt, bd as Vt, q as jt, r as Gt, b1 as Ut } from "./derive-chart-family-
|
|
44
|
-
import { t as je } from "./widget-composer-
|
|
43
|
+
import { n as qt, bc as zt, ac as v, T as xe, u as Ve, ag as ye, Y as Qt, bd as Vt, q as jt, r as Gt, b1 as Ut } from "./derive-chart-family-H_RlUbXY.js";
|
|
44
|
+
import { t as je } from "./widget-composer-NNyD6tF2.js";
|
|
45
45
|
function _t(e) {
|
|
46
46
|
return pt("MuiDialog", e);
|
|
47
47
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var Js=Object.defineProperty,Ys=Object.defineProperties;var Gs=Object.getOwnPropertyDescriptors;var ve=Object.getOwnPropertySymbols;var qt=Object.prototype.hasOwnProperty,Kt=Object.prototype.propertyIsEnumerable;var ot=(s,e)=>(e=Symbol[s])?e:Symbol.for("Symbol."+s);var lt=(s,e,t)=>e in s?Js(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,U=(s,e)=>{for(var t in e||(e={}))qt.call(e,t)&<(s,t,e[t]);if(ve)for(var t of ve(e))Kt.call(e,t)&<(s,t,e[t]);return s},W=(s,e)=>Ys(s,Gs(e));var Ft=(s,e)=>{var t={};for(var n in s)qt.call(s,n)&&e.indexOf(n)<0&&(t[n]=s[n]);if(s!=null&&ve)for(var n of ve(s))e.indexOf(n)<0&&Kt.call(s,n)&&(t[n]=s[n]);return t};var at=(s,e,t)=>(lt(s,typeof e!="symbol"?e+"":e,t),t);var ct=(s,e,t)=>new Promise((n,i)=>{var r=a=>{try{l(t.next(a))}catch(c){i(c)}},o=a=>{try{l(t.throw(a))}catch(c){i(c)}},l=a=>a.done?n(a.value):Promise.resolve(a.value).then(r,o);l((t=t.apply(s,e)).next())}),Ws=function(s,e){this[0]=s,this[1]=e};var d=s=>{var e=s[ot("asyncIterator")],t=!1,n,i={};return e==null?(e=s[ot("iterator")](),n=r=>i[r]=o=>e[r](o)):(e=e.call(s),n=r=>i[r]=o=>{if(t){if(t=!1,r==="throw")throw o;return o}return t=!0,{done:!1,value:new Ws(new Promise(l=>{var a=e[r](o);if(!(a instanceof Object))throw TypeError("Object expected");l(a)}),1)}}),i[ot("iterator")]=()=>i,n("next"),"throw"in e?n("throw"):i.throw=r=>{throw r},"return"in e&&n("return"),i};Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./widget-composer-
|
|
1
|
+
"use strict";var Js=Object.defineProperty,Ys=Object.defineProperties;var Gs=Object.getOwnPropertyDescriptors;var ve=Object.getOwnPropertySymbols;var qt=Object.prototype.hasOwnProperty,Kt=Object.prototype.propertyIsEnumerable;var ot=(s,e)=>(e=Symbol[s])?e:Symbol.for("Symbol."+s);var lt=(s,e,t)=>e in s?Js(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,U=(s,e)=>{for(var t in e||(e={}))qt.call(e,t)&<(s,t,e[t]);if(ve)for(var t of ve(e))Kt.call(e,t)&<(s,t,e[t]);return s},W=(s,e)=>Ys(s,Gs(e));var Ft=(s,e)=>{var t={};for(var n in s)qt.call(s,n)&&e.indexOf(n)<0&&(t[n]=s[n]);if(s!=null&&ve)for(var n of ve(s))e.indexOf(n)<0&&Kt.call(s,n)&&(t[n]=s[n]);return t};var at=(s,e,t)=>(lt(s,typeof e!="symbol"?e+"":e,t),t);var ct=(s,e,t)=>new Promise((n,i)=>{var r=a=>{try{l(t.next(a))}catch(c){i(c)}},o=a=>{try{l(t.throw(a))}catch(c){i(c)}},l=a=>a.done?n(a.value):Promise.resolve(a.value).then(r,o);l((t=t.apply(s,e)).next())}),Ws=function(s,e){this[0]=s,this[1]=e};var d=s=>{var e=s[ot("asyncIterator")],t=!1,n,i={};return e==null?(e=s[ot("iterator")](),n=r=>i[r]=o=>e[r](o)):(e=e.call(s),n=r=>i[r]=o=>{if(t){if(t=!1,r==="throw")throw o;return o}return t=!0,{done:!1,value:new Ws(new Promise(l=>{var a=e[r](o);if(!(a instanceof Object))throw TypeError("Object expected");l(a)}),1)}}),i[ot("iterator")]=()=>i,n("next"),"throw"in e?n("throw"):i.throw=r=>{throw r},"return"in e&&n("return"),i};Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./widget-composer-ldmqMCC4.cjs"),Oe=require("./derive-chart-family-DDkQybGb.cjs"),Ot=Symbol.for("yaml.alias"),gt=Symbol.for("yaml.document"),H=Symbol.for("yaml.map"),Zt=Symbol.for("yaml.pair"),G=Symbol.for("yaml.scalar"),ye=Symbol.for("yaml.seq"),R=Symbol.for("yaml.node.type"),ie=s=>!!s&&typeof s=="object"&&s[R]===Ot,ge=s=>!!s&&typeof s=="object"&&s[R]===gt,be=s=>!!s&&typeof s=="object"&&s[R]===H,A=s=>!!s&&typeof s=="object"&&s[R]===Zt,I=s=>!!s&&typeof s=="object"&&s[R]===G,we=s=>!!s&&typeof s=="object"&&s[R]===ye;function C(s){if(s&&typeof s=="object")switch(s[R]){case H:case ye:return!0}return!1}function M(s){if(s&&typeof s=="object")switch(s[R]){case Ot:case H:case G:case ye:return!0}return!1}const Hs=s=>(I(s)||C(s))&&!!s.anchor,q=Symbol("break visit"),es=Symbol("skip children"),J=Symbol("remove node");function X(s,e){const t=ts(e);ge(s)?ae(null,s.contents,t,Object.freeze([s]))===J&&(s.contents=null):ae(null,s,t,Object.freeze([]))}X.BREAK=q;X.SKIP=es;X.REMOVE=J;function ae(s,e,t,n){const i=ss(s,e,t,n);if(M(i)||A(i))return ns(s,n,i),ae(s,i,t,n);if(typeof i!="symbol"){if(C(e)){n=Object.freeze(n.concat(e));for(let r=0;r<e.items.length;++r){const o=ae(r,e.items[r],t,n);if(typeof o=="number")r=o-1;else{if(o===q)return q;o===J&&(e.items.splice(r,1),r-=1)}}}else if(A(e)){n=Object.freeze(n.concat(e));const r=ae("key",e.key,t,n);if(r===q)return q;r===J&&(e.key=null);const o=ae("value",e.value,t,n);if(o===q)return q;o===J&&(e.value=null)}}return i}function Ye(s,e){return ct(this,null,function*(){const t=ts(e);ge(s)?(yield ce(null,s.contents,t,Object.freeze([s])))===J&&(s.contents=null):yield ce(null,s,t,Object.freeze([]))})}Ye.BREAK=q;Ye.SKIP=es;Ye.REMOVE=J;function ce(s,e,t,n){return ct(this,null,function*(){const i=yield ss(s,e,t,n);if(M(i)||A(i))return ns(s,n,i),ce(s,i,t,n);if(typeof i!="symbol"){if(C(e)){n=Object.freeze(n.concat(e));for(let r=0;r<e.items.length;++r){const o=yield ce(r,e.items[r],t,n);if(typeof o=="number")r=o-1;else{if(o===q)return q;o===J&&(e.items.splice(r,1),r-=1)}}}else if(A(e)){n=Object.freeze(n.concat(e));const r=yield ce("key",e.key,t,n);if(r===q)return q;r===J&&(e.key=null);const o=yield ce("value",e.value,t,n);if(o===q)return q;o===J&&(e.value=null)}}return i})}function ts(s){return typeof s=="object"&&(s.Collection||s.Node||s.Value)?Object.assign({Alias:s.Node,Map:s.Node,Scalar:s.Node,Seq:s.Node},s.Value&&{Map:s.Value,Scalar:s.Value,Seq:s.Value},s.Collection&&{Map:s.Collection,Seq:s.Collection},s):s}function ss(s,e,t,n){var i,r,o,l,a;if(typeof t=="function")return t(s,e,n);if(be(e))return(i=t.Map)==null?void 0:i.call(t,s,e,n);if(we(e))return(r=t.Seq)==null?void 0:r.call(t,s,e,n);if(A(e))return(o=t.Pair)==null?void 0:o.call(t,s,e,n);if(I(e))return(l=t.Scalar)==null?void 0:l.call(t,s,e,n);if(ie(e))return(a=t.Alias)==null?void 0:a.call(t,s,e,n)}function ns(s,e,t){const n=e[e.length-1];if(C(n))n.items[s]=t;else if(A(n))s==="key"?n.key=t:n.value=t;else if(ge(n))n.contents=t;else{const i=ie(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}const Xs={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},zs=s=>s.replace(/[!,[\]{}]/g,e=>Xs[e]);class D{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},D.defaultYaml,e),this.tags=Object.assign({},D.defaultTags,t)}clone(){const e=new D(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){const e=new D(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:D.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},D.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:D.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},D.defaultTags),this.atNextDocument=!1);const n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;const[r,o]=n;return this.tags[r]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;const[r]=n;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{const o=/^\d+\.\d+$/.test(r);return t(6,`Unsupported YAML version ${r}`,o),!1}}default:return t(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){const o=e.slice(2,-1);return o==="!"||o==="!!"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),o)}const[,n,i]=e.match(new RegExp("^(.*!)([^!]*)$","s"));i||t(`The ${e} tag has no suffix`);const r=this.tags[n];if(r)try{return r+decodeURIComponent(i)}catch(o){return t(String(o)),null}return n==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(const[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+zs(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){const t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags);let i;if(e&&n.length>0&&M(e.contents)){const r={};X(e.contents,(o,l)=>{M(l)&&l.tag&&(r[l.tag]=!0)}),i=Object.keys(r)}else i=[];for(const[r,o]of n)r==="!!"&&o==="tag:yaml.org,2002:"||(!e||i.some(l=>l.startsWith(o)))&&t.push(`%TAG ${r} ${o}`);return t.join(`
|
|
2
2
|
`)}}D.defaultYaml={explicit:!1,version:"1.2"};D.defaultTags={"!!":"tag:yaml.org,2002:"};function is(s){if(/[\x00-\x19\s,[\]{}]/.test(s)){const t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;throw new Error(t)}return!0}function rs(s){const e=new Set;return X(s,{Value(t,n){n.anchor&&e.add(n.anchor)}}),e}function os(s,e){for(let t=1;;++t){const n=`${s}${t}`;if(!e.has(n))return n}}function xs(s,e){const t=[],n=new Map;let i=null;return{onAnchor:r=>{t.push(r),i||(i=rs(s));const o=os(e,i);return i.add(o),o},setAnchors:()=>{for(const r of t){const o=n.get(r);if(typeof o=="object"&&o.anchor&&(I(o.node)||C(o.node)))o.node.anchor=o.anchor;else{const l=new Error("Failed to resolve repeated object (this should not happen)");throw l.source=r,l}}},sourceObjects:n}}function fe(s,e,t,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,r=n.length;i<r;++i){const o=n[i],l=fe(s,n,String(i),o);l===void 0?delete n[i]:l!==o&&(n[i]=l)}else if(n instanceof Map)for(const i of Array.from(n.keys())){const r=n.get(i),o=fe(s,n,i,r);o===void 0?n.delete(i):o!==r&&n.set(i,o)}else if(n instanceof Set)for(const i of Array.from(n)){const r=fe(s,n,i,i);r===void 0?n.delete(i):r!==i&&(n.delete(i),n.add(r))}else for(const[i,r]of Object.entries(n)){const o=fe(s,n,i,r);o===void 0?delete n[i]:o!==r&&(n[i]=o)}return s.call(e,t,n)}function F(s,e,t){if(Array.isArray(s))return s.map((n,i)=>F(n,String(i),t));if(s&&typeof s.toJSON=="function"){if(!t||!Hs(s))return s.toJSON(e,t);const n={aliasCount:0,count:1,res:void 0};t.anchors.set(s,n),t.onCreate=r=>{n.res=r,delete t.onCreate};const i=s.toJSON(e,t);return t.onCreate&&t.onCreate(i),i}return typeof s=="bigint"&&!(t!=null&&t.keep)?Number(s):s}class Tt{constructor(e){Object.defineProperty(this,R,{value:e})}clone(){const e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:i,reviver:r}={}){if(!ge(e))throw new TypeError("A document argument is required");const o={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},l=F(this,"",o);if(typeof i=="function")for(const{count:a,res:c}of o.anchors.values())i(c,a);return typeof r=="function"?fe(r,{"":l},"",l):l}}class Ge extends Tt{constructor(e){super(Ot),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e){let t;return X(e,{Node:(n,i)=>{if(i===this)return X.BREAK;i.anchor===this.source&&(t=i)}}),t}toJSON(e,t){if(!t)return{source:this.source};const{anchors:n,doc:i,maxAliasCount:r}=t,o=this.resolve(i);if(!o){const a=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(a)}let l=n.get(o);if(l||(F(o,null,t),l=n.get(o)),!l||l.res===void 0){const a="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(a)}if(r>=0&&(l.count+=1,l.aliasCount===0&&(l.aliasCount=qe(i,o,n)),l.count*l.aliasCount>r)){const a="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(a)}return l.res}toString(e,t,n){const i=`*${this.source}`;if(e){if(is(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){const r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(e.implicitKey)return`${i} `}return i}}function qe(s,e,t){if(ie(e)){const n=e.resolve(s),i=t&&n&&t.get(n);return i?i.count*i.aliasCount:0}else if(C(e)){let n=0;for(const i of e.items){const r=qe(s,i,t);r>n&&(n=r)}return n}else if(A(e)){const n=qe(s,e.key,t),i=qe(s,e.value,t);return Math.max(n,i)}return 1}const ls=s=>!s||typeof s!="function"&&typeof s!="object";class N extends Tt{constructor(e){super(G),this.value=e}toJSON(e,t){return t!=null&&t.keep?this.value:F(this.value,e,t)}toString(){return String(this.value)}}N.BLOCK_FOLDED="BLOCK_FOLDED";N.BLOCK_LITERAL="BLOCK_LITERAL";N.PLAIN="PLAIN";N.QUOTE_DOUBLE="QUOTE_DOUBLE";N.QUOTE_SINGLE="QUOTE_SINGLE";const Zs="tag:yaml.org,2002:";function en(s,e,t){var n;if(e){const i=t.filter(o=>o.tag===e),r=(n=i.find(o=>!o.format))!=null?n:i[0];if(!r)throw new Error(`Tag ${e} not found`);return r}return t.find(i=>{var r;return((r=i.identify)==null?void 0:r.call(i,s))&&!i.format})}function Ae(s,e,t){var f,p,m;if(ge(s)&&(s=s.contents),M(s))return s;if(A(s)){const y=(p=(f=t.schema[H]).createNode)==null?void 0:p.call(f,t.schema,null,t);return y.items.push(s),y}(s instanceof String||s instanceof Number||s instanceof Boolean||typeof BigInt!="undefined"&&s instanceof BigInt)&&(s=s.valueOf());const{aliasDuplicateObjects:n,onAnchor:i,onTagObj:r,schema:o,sourceObjects:l}=t;let a;if(n&&s&&typeof s=="object"){if(a=l.get(s),a)return a.anchor||(a.anchor=i(s)),new Ge(a.anchor);a={anchor:null,node:null},l.set(s,a)}e!=null&&e.startsWith("!!")&&(e=Zs+e.slice(2));let c=en(s,e,o.tags);if(!c){if(s&&typeof s.toJSON=="function"&&(s=s.toJSON()),!s||typeof s!="object"){const y=new N(s);return a&&(a.node=y),y}c=s instanceof Map?o[H]:Symbol.iterator in Object(s)?o[ye]:o[H]}r&&(r(c),delete t.onTagObj);const h=c!=null&&c.createNode?c.createNode(t.schema,s,t):typeof((m=c==null?void 0:c.nodeClass)==null?void 0:m.from)=="function"?c.nodeClass.from(t.schema,s,t):new N(s);return e?h.tag=e:c.default||(h.tag=c.tag),a&&(a.node=h),h}function Ue(s,e,t){let n=t;for(let i=e.length-1;i>=0;--i){const r=e[i];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){const o=[];o[r]=n,n=o}else n=new Map([[r,n]])}return Ae(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:s,sourceObjects:new Map})}const Ee=s=>s==null||typeof s=="object"&&!!s[Symbol.iterator]().next().done;class as extends Tt{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){const t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(n=>M(n)||A(n)?n.clone(e):n),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(Ee(e))this.add(t);else{const[n,...i]=e,r=this.get(n,!0);if(C(r))r.addIn(i,t);else if(r===void 0&&this.schema)this.set(n,Ue(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){const[t,...n]=e;if(n.length===0)return this.delete(t);const i=this.get(t,!0);if(C(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){const[n,...i]=e,r=this.get(n,!0);return i.length===0?!t&&I(r)?r.value:r:C(r)?r.getIn(i,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!A(t))return!1;const n=t.value;return n==null||e&&I(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){const[t,...n]=e;if(n.length===0)return this.has(t);const i=this.get(t,!0);return C(i)?i.hasIn(n):!1}setIn(e,t){const[n,...i]=e;if(i.length===0)this.set(n,t);else{const r=this.get(n,!0);if(C(r))r.setIn(i,t);else if(r===void 0&&this.schema)this.set(n,Ue(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}}const tn=s=>s.replace(/^(?!$)(?: $)?/gm,"#");function Y(s,e){return/^\n+$/.test(s)?s.substring(1):e?s.replace(/^(?! *$)/gm,e):s}const ee=(s,e,t)=>s.endsWith(`
|
|
3
3
|
`)?Y(t,e):t.includes(`
|
|
4
4
|
`)?`
|
|
@@ -60,9 +60,9 @@ var d = (s) => {
|
|
|
60
60
|
throw r;
|
|
61
61
|
}, "return" in e && n("return"), i;
|
|
62
62
|
};
|
|
63
|
-
import { s as Zs, E as Ft, c as en, p as tn, v as sn, a as es, b as at, d as nn, e as ts, g as ss } from "./widget-composer-
|
|
64
|
-
import { f as Bi, h as Pi, i as ji, w as Di } from "./widget-composer-
|
|
65
|
-
import { a9 as rn, aT as Rt, co as on, d1 as ln } from "./derive-chart-family-
|
|
63
|
+
import { s as Zs, E as Ft, c as en, p as tn, v as sn, a as es, b as at, d as nn, e as ts, g as ss } from "./widget-composer-NNyD6tF2.js";
|
|
64
|
+
import { f as Bi, h as Pi, i as ji, w as Di } from "./widget-composer-NNyD6tF2.js";
|
|
65
|
+
import { a9 as rn, aT as Rt, co as on, d1 as ln } from "./derive-chart-family-H_RlUbXY.js";
|
|
66
66
|
const Nt = Symbol.for("yaml.alias"), yt = Symbol.for("yaml.document"), W = Symbol.for("yaml.map"), ns = Symbol.for("yaml.pair"), Y = Symbol.for("yaml.scalar"), me = Symbol.for("yaml.seq"), F = Symbol.for("yaml.node.type"), ne = (s) => !!s && typeof s == "object" && s[F] === Nt, ye = (s) => !!s && typeof s == "object" && s[F] === yt, ge = (s) => !!s && typeof s == "object" && s[F] === W, E = (s) => !!s && typeof s == "object" && s[F] === ns, A = (s) => !!s && typeof s == "object" && s[F] === Y, be = (s) => !!s && typeof s == "object" && s[F] === me;
|
|
67
67
|
function $(s) {
|
|
68
68
|
if (s && typeof s == "object")
|