@sisense/sdk-ui 2.1.0 → 2.1.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.
Files changed (35) hide show
  1. package/dist/ai.cjs +1 -1
  2. package/dist/ai.js +4 -4
  3. package/dist/analytics-composer.cjs +1 -1
  4. package/dist/analytics-composer.js +70 -70
  5. package/dist/{derive-chart-family-BNMFblR9.js → derive-chart-family-C8duLtwv.js} +11255 -11244
  6. package/dist/{derive-chart-family-DjbiaKLQ.cjs → derive-chart-family-CQ1Myy0A.cjs} +129 -129
  7. package/dist/{dimensions-DcsEnPSY.cjs → dimensions-BBfnA6e8.cjs} +1 -1
  8. package/dist/{dimensions-DeTiL-EZ.js → dimensions-DOWF8q44.js} +1 -1
  9. package/dist/index.cjs +25 -21
  10. package/dist/index.js +13027 -10033
  11. package/dist/packages/sdk-ui/src/dashboard/components/content-panel.d.ts +1 -1
  12. package/dist/packages/sdk-ui/src/dashboard/components/editable-layout/components/cell-drop-overlay.d.ts +34 -0
  13. package/dist/packages/sdk-ui/src/dashboard/components/editable-layout/components/draggable-line.d.ts +24 -0
  14. package/dist/packages/sdk-ui/src/dashboard/components/editable-layout/components/draggable-widget-wrapper.d.ts +28 -0
  15. package/dist/packages/sdk-ui/src/dashboard/components/editable-layout/components/droppable-zone.d.ts +23 -0
  16. package/dist/packages/sdk-ui/src/dashboard/components/editable-layout/components/resizable-columns.d.ts +31 -0
  17. package/dist/packages/sdk-ui/src/dashboard/components/editable-layout/components/resizable-row.d.ts +39 -0
  18. package/dist/packages/sdk-ui/src/dashboard/components/editable-layout/components/row-drop-overlay.d.ts +30 -0
  19. package/dist/packages/sdk-ui/src/dashboard/components/editable-layout/const.d.ts +11 -0
  20. package/dist/packages/sdk-ui/src/dashboard/components/editable-layout/editable-layout.d.ts +28 -0
  21. package/dist/packages/sdk-ui/src/dashboard/components/editable-layout/helpers.d.ts +42 -0
  22. package/dist/packages/sdk-ui/src/dashboard/components/editable-layout/types.d.ts +78 -0
  23. package/dist/packages/sdk-ui/src/dashboard/components/editable-layout/utils.d.ts +5 -0
  24. package/dist/packages/sdk-ui/src/dashboard/constants.d.ts +0 -2
  25. package/dist/packages/sdk-ui/src/dashboard/types.d.ts +7 -1
  26. package/dist/packages/sdk-ui/src/dashboard/use-dashboard-theme.d.ts +4 -0
  27. package/dist/packages/sdk-ui/src/index.d.ts +1 -1
  28. package/dist/packages/sdk-ui/src/models/dashboard/types.d.ts +29 -17
  29. package/dist/packages/sdk-ui/src/theme-provider/default-theme-settings.d.ts +3 -0
  30. package/dist/packages/sdk-ui/src/types.d.ts +14 -0
  31. package/dist/{use-common-filters-CJNwlbbh.js → use-common-filters--6cyMg9O.js} +2850 -2846
  32. package/dist/{use-common-filters-DcFu4qRs.cjs → use-common-filters-NTIrYvRs.cjs} +5 -5
  33. package/dist/{widget-composer-BEVCXjFv.js → widget-composer-BZwsi1mW.js} +1 -1
  34. package/dist/{widget-composer-fYnr8SDo.cjs → widget-composer-Bv_aqjLX.cjs} +1 -1
  35. package/package.json +10 -7
package/dist/ai.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var Qe=Object.defineProperty,Ve=Object.defineProperties;var _e=Object.getOwnPropertyDescriptors;var _=Object.getOwnPropertySymbols;var ye=Object.prototype.hasOwnProperty,ve=Object.prototype.propertyIsEnumerable;var be=(e,n,o)=>n in e?Qe(e,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[n]=o,b=(e,n)=>{for(var o in n||(n={}))ye.call(n,o)&&be(e,o,n[o]);if(_)for(var o of _(n))ve.call(n,o)&&be(e,o,n[o]);return e},v=(e,n)=>Ve(e,_e(n));var we=(e,n)=>{var o={};for(var s in e)ye.call(e,s)&&n.indexOf(s)<0&&(o[s]=e[s]);if(e!=null&&_)for(var s of _(e))n.indexOf(s)<0&&ve.call(e,s)&&(o[s]=e[s]);return o};var I=(e,n,o)=>new Promise((s,r)=>{var a=c=>{try{u(o.next(c))}catch(h){r(h)}},l=c=>{try{u(o.throw(c))}catch(h){r(h)}},u=c=>c.done?s(c.value):Promise.resolve(c.value).then(a,l);u((o=o.apply(e,n)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./use-common-filters-DcFu4qRs.cjs"),t=require("./derive-chart-family-DjbiaKLQ.cjs"),d=require("react"),z=require("./widget-composer-fYnr8SDo.cjs"),$=require("react/jsx-runtime");function Ue(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const s=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(n,o,s.get?s:{enumerable:!0,get:()=>e[o]})}}return n.default=e,Object.freeze(n)}const F=Ue(d);class Ke extends i.Subscribable{constructor(n,o){super(),this.client=n,this.setOptions(o),this.bindMethods(),this.updateResult()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var o;const s=this.options;this.options=this.client.defaultMutationOptions(n),i.shallowEqualObjects(s,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 n;(n=this.currentMutation)==null||n.removeObserver(this)}}onMutationUpdate(n){this.updateResult();const o={listeners:!0};n.type==="success"?o.onSuccess=!0:n.type==="error"&&(o.onError=!0),this.notify(o)}getCurrentResult(){return this.currentResult}reset(){this.currentMutation=void 0,this.updateResult(),this.notify({listeners:!0})}mutate(n,o){return this.mutateOptions=o,this.currentMutation&&this.currentMutation.removeObserver(this),this.currentMutation=this.client.getMutationCache().build(this.client,v(b({},this.options),{variables:typeof n!="undefined"?n:this.options.variables})),this.currentMutation.addObserver(this),this.currentMutation.execute()}updateResult(){const n=this.currentMutation?this.currentMutation.state:i.getDefaultState(),o=v(b({},n),{isLoading:n.status==="loading",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset});this.currentResult=o}notify(n){i.notifyManager.batch(()=>{if(this.mutateOptions&&this.hasListeners()){if(n.onSuccess){var o,s,r,a;(o=(s=this.mutateOptions).onSuccess)==null||o.call(s,this.currentResult.data,this.currentResult.variables,this.currentResult.context),(r=(a=this.mutateOptions).onSettled)==null||r.call(a,this.currentResult.data,null,this.currentResult.variables,this.currentResult.context)}else if(n.onError){var l,u,c,h;(l=(u=this.mutateOptions).onError)==null||l.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)}}n.listeners&&this.listeners.forEach(({listener:C})=>{C(this.currentResult)})})}}function re(e,n,o){const s=i.parseMutationArgs(e,n),r=i.useQueryClient({context:s.context}),[a]=F.useState(()=>new Ke(r,s));F.useEffect(()=>{a.setOptions(s)},[a,s]);const l=i.useSyncExternalStore(F.useCallback(c=>a.subscribe(i.notifyManager.batchCalls(c)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),u=F.useCallback((c,h)=>{a.mutate(c,h).catch(Je)},[a]);if(l.error&&i.shouldThrowError(a.options.useErrorBoundary,[l.error]))throw l.error;return v(b({},l),{mutate:u,mutateAsync:l.mutate})}function Je(){}class Te{constructor(n,o=!1){this.volatile=o,this.getChatContexts=()=>I(this,null,function*(){return(yield this.httpClient.get("api/datasources//"))||[]}),this.getNlgInsights=s=>this.httpClient.post("api/v2/ai/nlg/queryResult",s),this.getQueryRecommendations=(s,r)=>this.httpClient.get(`api/v2/ai/recommendations/query/${s}/${r.numOfRecommendations}`),this.getNlqResult=(s,r)=>this.httpClient.post(`api/v2/ai/nlq/query/${s}`,r),this.setLlmConfig=s=>this.httpClient.post("api/v2/settings/ai/llmProvider",s).catch(r=>{console.error("Unable to set llm config",r)}),this.getAllChats=()=>I(this,null,function*(){return this.volatile?[]:this.httpClient.get("api/v2/ai/chats")}),this.getChatById=s=>this.httpClient.get(`api/v2/ai/chats/${s}`),this.createChat=(s,r)=>this.httpClient.post("api/v2/ai/chats",{sourceId:s,volatile:this.volatile,contextDetails:r}),this.postChat=(s,r)=>this.httpClient.post(`api/v2/ai/chats/${s}`,r),this.deleteChatHistory=s=>this.httpClient.delete(`api/v2/ai/chats/${s}/history`),this.sendFeedback=s=>this.httpClient.post("api/v2/ai/feedback",s),this.ai={getNlgInsights:this.getNlgInsights,getNlqResult:this.getNlqResult,getQueryRecommendations:this.getQueryRecommendations,setLlmConfig:this.setLlmConfig,sendFeedback:this.sendFeedback,chat:{getAll:this.getAllChats,getById:this.getChatById,create:this.createChat,post:this.postChat,clearHistory:this.deleteChatHistory}},this.httpClient=n}}const Ye=new i.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,refetchOnMount:!1}}}),ie=d.createContext(void 0),T=()=>d.useContext(ie),Xe=({children:e,volatile:n})=>{const{app:o}=t.useSisenseContext(),s=d.useMemo(()=>o?new Te(o.httpClient,n):void 0,[o,n]);return t.jsx(ie.Provider,{value:s,children:t.jsx(i.QueryClientProvider,{client:Ye,children:e})})},Me=d.createContext({}),et=()=>d.useContext(Me),Re=({children:e})=>{const[n,o]=d.useState({}),s=d.useCallback((l,u)=>{var c;return`${l}_${(c=u==null?void 0:u.dashboardId)!=null?c:""}`},[]),r=d.useCallback((l,u,c)=>{o(h=>v(b({},h),{[s(u,c)]:l}))},[s]),a=d.useCallback((l,u)=>n[s(l,u)],[n,s]);return t.jsx(Me.Provider,{value:{saveChatId:r,getChatId:a},children:e})};function tt({children:e,volatile:n}){return t.jsx(Re,{children:t.jsx(Xe,{volatile:n,children:e})})}function Le(e){var n,o;if("jaql"in e)return e;{const s=t.convertJaqlDataSource(e.dataSource),{filters:r=[],relations:a}=t.getFilterListAndRelationsJaql(e.filters),{metadata:l,filterRelations:u}=t.getJaqlQueryPayload({dataSource:e.dataSource,attributes:(n=e.dimensions)!=null?n:[],measures:(o=e.measures)!=null?o:[],filters:r,filterRelations:a,highlights:[]},!0),c={jaql:{datasource:s,metadata:l,filterRelations:u}};return e.verbosity&&(c.verbosity=e.verbosity),c}}const J=(e,n=!0)=>{const o=d.useMemo(()=>Le(e),[e]),s=T(),{data:r,error:a,isError:l,isLoading:u,isSuccess:c,refetch:h}=i.useQuery({queryKey:["getNlgInsights",o,s],queryFn:()=>s==null?void 0:s.ai.getNlgInsights(o),select:C=>{var p;return(p=C==null?void 0:C.data)==null?void 0:p.answer},enabled:!!s&&n});return{isLoading:u,isError:l,isSuccess:c,data:r,error:a,refetch:d.useCallback(()=>{h()},[h])}},nt=e=>{const s=e,{enabled:n}=s,o=we(s,["enabled"]);return J(o,n)},ot=i.withTracking("useGetNlgInsights")(nt),Pe=["indicator","column","line","table","pie","bar"];function Ee(e){const{dataSource:n,query:o,chartTypes:s}=e;return{contextTitle:typeof n=="string"?n:n.title,request:{text:o,timezone:"UTC",chartTypes:s!=null?s:[...Pe]}}}const st=e=>{const{contextTitle:n,request:o}=Ee(e),s=T(),{isLoading:r,isError:a,isSuccess:l,data:u,error:c,refetch:h}=i.useQuery({queryKey:["getNlqResult",n,o,s],queryFn:()=>s==null?void 0:s.ai.getNlqResult(n,o),enabled:!!s&&e.enabled}),C=u?z.toWidgetProps(u,{useCustomizedStyleOptions:e.enableAxisTitlesInWidgetProps||!1}):void 0;return{isLoading:r,isError:a,isSuccess:l,data:C,error:c,refetch:d.useCallback(()=>{h()},[h])}},rt=i.withTracking("useGetNlqResult")(st),Ie=4,Fe=e=>{const{contextTitle:n,count:o,enableAxisTitlesInWidgetProps:s,enabled:r}=e,a=T(),l=o!=null?o:Ie,u=(r===void 0||r===!0)&&l>0,{isLoading:c,isError:h,isSuccess:C,data:p,error:g,refetch:x}=i.useQuery({queryKey:["getQueryRecommendations",n,l,a],queryFn:()=>a==null?void 0:a.ai.getQueryRecommendations(n,{numOfRecommendations:l}),enabled:!!a&&u}),y=d.useMemo(()=>p==null?void 0:p.map(f=>v(b({},f),{widgetProps:f.jaql?z.toWidgetProps(f,{useCustomizedStyleOptions:s}):void 0})),[p,s]);return{isLoading:u?c:!1,isError:h,isSuccess:C,data:y!=null?y:void 0,error:g,refetch:d.useCallback(()=>{x()},[x])}},it=i.withTracking("useGetQueryRecommendations")(Fe),Ne=Object.freeze({enableFollowupQuestions:!1,enableHeader:!0,enableInsights:!0,numOfRecommendations:4,numOfRecentPrompts:5}),Be=d.createContext(b({},Ne)),R=()=>d.useContext(Be),at=({children:e,value:n})=>{const{t:o}=t.useTranslation(),s=Object.entries(n).reduce((r,[a,l])=>(l!==void 0&&(r[a]=l),r),v(b({},Ne),{inputPromptText:o("ai.config.inputPromptText"),welcomeText:o("ai.config.welcomeText"),suggestionsWelcomeText:o("ai.config.suggestionsWelcomeText")}));return t.jsx(Be.Provider,{value:s,children:e})},ae="chatHistory",lt=e=>{const n=T(),{hideHistory:o}=R();return i.useQuery({queryKey:[ae,e,n],queryFn:()=>I(exports,null,function*(){if(!n||!e)return;if(o)return[];const s=yield n.ai.chat.getById(e);return s==null?void 0:s.chatHistory}),enabled:!!n&&!!e})},He=e=>{const n=T(),o=i.useQueryClient();return re({mutationFn:()=>I(exports,null,function*(){if(!(!n||!e))return n.ai.chat.clearHistory(e)}),onError:s=>{console.error("Error when clearing history:",s)},onSettled:()=>{e&&o.setQueriesData([ae,e],[])}})},le=e=>{const{data:n,isLoading:o,isError:s}=lt(e),{mutate:r}=He(e);return d.useEffect(()=>{s&&r()},[s,r]),{history:n,isLoading:o,isError:s}},ct=()=>{const e=T(),{data:n,isLoading:o,fetchStatus:s}=i.useQuery({queryKey:["getDataTopics",e],queryFn:()=>I(exports,null,function*(){if(e)return e.getChatContexts()}),enabled:!!e});return{data:n,isLoading:o,fetchStatus:s}},dt=()=>{const e=T(),{data:n,isLoading:o}=i.useQuery({queryKey:["getAllChats",e],queryFn:()=>e==null?void 0:e.ai.chat.getAll(),enabled:!!e});return{data:n!=null?n:[],isLoading:o}},ut=(e,n,o)=>{const s=i.useQueryClient(),r=T(),a=re({mutationFn:()=>I(exports,null,function*(){if(!(!r||!e))return r.ai.chat.create(e,o)}),onSuccess:()=>s.invalidateQueries(["getAllChats"])});return d.useEffect(()=>{n&&a.isIdle&&a.mutate()},[n,a]),a},ht=(e,n)=>{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(`${n}${JSON.stringify(e)}`)}},pt=(e,n)=>{const o=i.useQueryClient(),s=d.useCallback(c=>{e&&o.setQueriesData([ae,e],h=>h&&[...h,c])},[o,e]),{t:r}=t.useTranslation(),a=T(),{mutate:l,isLoading:u}=re({mutationFn:c=>I(exports,null,function*(){if(!(!a||!e))return a.ai.chat.post(e,{text:c,options:{enableFollowup:n}})}),onMutate:c=>{s({content:c,role:"user"})},onError:c=>{c instanceof Error&&(console.error("Error when sending message:",c.message),s({content:r(`ai.errors.${c.interpolationOptions.errorCode}`,{defaultValue:r("ai.errors.unexpectedChatResponse")}),role:"assistant"}))},onSuccess:c=>{if(!c)return;const h=r("ai.errors.unknownResponse");s(ht(c,h))}});return{mutate:l,isLoading:u}},ce=(e,n,o=!1)=>{var C;const{data:s,isLoading:r}=dt(),a=et(),l=a.getChatId(e,n)||((C=s.find(p=>{var g;return p.contextTitle===e&&((g=p.contextDetails)==null?void 0:g.dashboardId)===(n==null?void 0:n.dashboardId)}))==null?void 0:C.chatId),{isError:u,data:c,isSuccess:h}=ut(e,o&&!r&&!l,n);return d.useEffect(()=>{h&&c&&!l&&a.saveChatId(c.chatId,e,n)},[c,h,e,n,l,a]),{chatId:l,isLoading:r,isError:u}},De=e=>d.useMemo(()=>{if(e!=null&&e.length){const n=e[e.length-1];if(de(n))return JSON.parse(n.content)}return null},[e]),de=e=>!!e&&"type"in e&&e.type==="nlq",Ct=e=>!!e&&"type"in e&&e.type==="text",qe=(e,n)=>{const{t:o}=t.useTranslation(),{enableFollowupQuestions:s}=R(),{chatId:r,isError:a}=ce(e,n,!0),[l,u]=d.useState(null),{history:c,isLoading:h,isError:C}=le(r);d.useEffect(()=>{a?u(new t.TranslatableError("ai.errors.chatUnavailable")):C&&u(new t.TranslatableError("ai.errors.fetchHistory"))},[a,C,o]);const{mutate:p,isLoading:g}=pt(r,s),x=De(c);return{chatId:r,history:c!=null?c:[],lastNlqResponse:x,sendMessage:p,isAwaitingResponse:g,isLoading:h,lastError:l}},gt=({contextTitle:e,contextDetails:n})=>{const{chatId:o}=ce(e,n),{history:s}=le(o);return De(s)},xt=({contextTitle:e,contextDetails:n})=>{const{chatId:o}=ce(e,n),{history:s}=le(o);return d.useMemo(()=>{if(s!=null&&s.length){const r=s.slice().reverse().find(de);if(r)return JSON.parse(r.content)}return null},[s])},ft=500,mt=500,bt=500,yt=900,vt=t.newStyled("div",{target:"e1ldv6710",label:"ChatFrame"})("box-sizing:border-box;position:relative;display:flex;flex-direction:column;border:1px solid #c6c9ce;border-radius:",({theme:e})=>e.aiChat.borderRadius,";background-color:",({theme:e})=>e.aiChat.backgroundColor,";overflow:hidden;min-width:",ft,"px;min-height:",mt,"px;width:",({width:e})=>e?je(e):`${bt}px`,";height:",({height:e})=>e?je(e):`${yt}px`,";",({theme:e})=>t.css`
1
+ "use strict";var Qe=Object.defineProperty,Ve=Object.defineProperties;var _e=Object.getOwnPropertyDescriptors;var _=Object.getOwnPropertySymbols;var ye=Object.prototype.hasOwnProperty,ve=Object.prototype.propertyIsEnumerable;var be=(e,n,o)=>n in e?Qe(e,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[n]=o,b=(e,n)=>{for(var o in n||(n={}))ye.call(n,o)&&be(e,o,n[o]);if(_)for(var o of _(n))ve.call(n,o)&&be(e,o,n[o]);return e},v=(e,n)=>Ve(e,_e(n));var we=(e,n)=>{var o={};for(var s in e)ye.call(e,s)&&n.indexOf(s)<0&&(o[s]=e[s]);if(e!=null&&_)for(var s of _(e))n.indexOf(s)<0&&ve.call(e,s)&&(o[s]=e[s]);return o};var I=(e,n,o)=>new Promise((s,r)=>{var a=c=>{try{u(o.next(c))}catch(h){r(h)}},l=c=>{try{u(o.throw(c))}catch(h){r(h)}},u=c=>c.done?s(c.value):Promise.resolve(c.value).then(a,l);u((o=o.apply(e,n)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./use-common-filters-NTIrYvRs.cjs"),t=require("./derive-chart-family-CQ1Myy0A.cjs"),d=require("react"),z=require("./widget-composer-Bv_aqjLX.cjs"),$=require("react/jsx-runtime");function Ue(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const s=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(n,o,s.get?s:{enumerable:!0,get:()=>e[o]})}}return n.default=e,Object.freeze(n)}const F=Ue(d);class Ke extends i.Subscribable{constructor(n,o){super(),this.client=n,this.setOptions(o),this.bindMethods(),this.updateResult()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var o;const s=this.options;this.options=this.client.defaultMutationOptions(n),i.shallowEqualObjects(s,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 n;(n=this.currentMutation)==null||n.removeObserver(this)}}onMutationUpdate(n){this.updateResult();const o={listeners:!0};n.type==="success"?o.onSuccess=!0:n.type==="error"&&(o.onError=!0),this.notify(o)}getCurrentResult(){return this.currentResult}reset(){this.currentMutation=void 0,this.updateResult(),this.notify({listeners:!0})}mutate(n,o){return this.mutateOptions=o,this.currentMutation&&this.currentMutation.removeObserver(this),this.currentMutation=this.client.getMutationCache().build(this.client,v(b({},this.options),{variables:typeof n!="undefined"?n:this.options.variables})),this.currentMutation.addObserver(this),this.currentMutation.execute()}updateResult(){const n=this.currentMutation?this.currentMutation.state:i.getDefaultState(),o=v(b({},n),{isLoading:n.status==="loading",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset});this.currentResult=o}notify(n){i.notifyManager.batch(()=>{if(this.mutateOptions&&this.hasListeners()){if(n.onSuccess){var o,s,r,a;(o=(s=this.mutateOptions).onSuccess)==null||o.call(s,this.currentResult.data,this.currentResult.variables,this.currentResult.context),(r=(a=this.mutateOptions).onSettled)==null||r.call(a,this.currentResult.data,null,this.currentResult.variables,this.currentResult.context)}else if(n.onError){var l,u,c,h;(l=(u=this.mutateOptions).onError)==null||l.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)}}n.listeners&&this.listeners.forEach(({listener:C})=>{C(this.currentResult)})})}}function re(e,n,o){const s=i.parseMutationArgs(e,n),r=i.useQueryClient({context:s.context}),[a]=F.useState(()=>new Ke(r,s));F.useEffect(()=>{a.setOptions(s)},[a,s]);const l=i.useSyncExternalStore(F.useCallback(c=>a.subscribe(i.notifyManager.batchCalls(c)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),u=F.useCallback((c,h)=>{a.mutate(c,h).catch(Je)},[a]);if(l.error&&i.shouldThrowError(a.options.useErrorBoundary,[l.error]))throw l.error;return v(b({},l),{mutate:u,mutateAsync:l.mutate})}function Je(){}class Te{constructor(n,o=!1){this.volatile=o,this.getChatContexts=()=>I(this,null,function*(){return(yield this.httpClient.get("api/datasources//"))||[]}),this.getNlgInsights=s=>this.httpClient.post("api/v2/ai/nlg/queryResult",s),this.getQueryRecommendations=(s,r)=>this.httpClient.get(`api/v2/ai/recommendations/query/${s}/${r.numOfRecommendations}`),this.getNlqResult=(s,r)=>this.httpClient.post(`api/v2/ai/nlq/query/${s}`,r),this.setLlmConfig=s=>this.httpClient.post("api/v2/settings/ai/llmProvider",s).catch(r=>{console.error("Unable to set llm config",r)}),this.getAllChats=()=>I(this,null,function*(){return this.volatile?[]:this.httpClient.get("api/v2/ai/chats")}),this.getChatById=s=>this.httpClient.get(`api/v2/ai/chats/${s}`),this.createChat=(s,r)=>this.httpClient.post("api/v2/ai/chats",{sourceId:s,volatile:this.volatile,contextDetails:r}),this.postChat=(s,r)=>this.httpClient.post(`api/v2/ai/chats/${s}`,r),this.deleteChatHistory=s=>this.httpClient.delete(`api/v2/ai/chats/${s}/history`),this.sendFeedback=s=>this.httpClient.post("api/v2/ai/feedback",s),this.ai={getNlgInsights:this.getNlgInsights,getNlqResult:this.getNlqResult,getQueryRecommendations:this.getQueryRecommendations,setLlmConfig:this.setLlmConfig,sendFeedback:this.sendFeedback,chat:{getAll:this.getAllChats,getById:this.getChatById,create:this.createChat,post:this.postChat,clearHistory:this.deleteChatHistory}},this.httpClient=n}}const Ye=new i.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,refetchOnMount:!1}}}),ie=d.createContext(void 0),T=()=>d.useContext(ie),Xe=({children:e,volatile:n})=>{const{app:o}=t.useSisenseContext(),s=d.useMemo(()=>o?new Te(o.httpClient,n):void 0,[o,n]);return t.jsx(ie.Provider,{value:s,children:t.jsx(i.QueryClientProvider,{client:Ye,children:e})})},Me=d.createContext({}),et=()=>d.useContext(Me),Re=({children:e})=>{const[n,o]=d.useState({}),s=d.useCallback((l,u)=>{var c;return`${l}_${(c=u==null?void 0:u.dashboardId)!=null?c:""}`},[]),r=d.useCallback((l,u,c)=>{o(h=>v(b({},h),{[s(u,c)]:l}))},[s]),a=d.useCallback((l,u)=>n[s(l,u)],[n,s]);return t.jsx(Me.Provider,{value:{saveChatId:r,getChatId:a},children:e})};function tt({children:e,volatile:n}){return t.jsx(Re,{children:t.jsx(Xe,{volatile:n,children:e})})}function Le(e){var n,o;if("jaql"in e)return e;{const s=t.convertJaqlDataSource(e.dataSource),{filters:r=[],relations:a}=t.getFilterListAndRelationsJaql(e.filters),{metadata:l,filterRelations:u}=t.getJaqlQueryPayload({dataSource:e.dataSource,attributes:(n=e.dimensions)!=null?n:[],measures:(o=e.measures)!=null?o:[],filters:r,filterRelations:a,highlights:[]},!0),c={jaql:{datasource:s,metadata:l,filterRelations:u}};return e.verbosity&&(c.verbosity=e.verbosity),c}}const J=(e,n=!0)=>{const o=d.useMemo(()=>Le(e),[e]),s=T(),{data:r,error:a,isError:l,isLoading:u,isSuccess:c,refetch:h}=i.useQuery({queryKey:["getNlgInsights",o,s],queryFn:()=>s==null?void 0:s.ai.getNlgInsights(o),select:C=>{var p;return(p=C==null?void 0:C.data)==null?void 0:p.answer},enabled:!!s&&n});return{isLoading:u,isError:l,isSuccess:c,data:r,error:a,refetch:d.useCallback(()=>{h()},[h])}},nt=e=>{const s=e,{enabled:n}=s,o=we(s,["enabled"]);return J(o,n)},ot=i.withTracking("useGetNlgInsights")(nt),Pe=["indicator","column","line","table","pie","bar"];function Ee(e){const{dataSource:n,query:o,chartTypes:s}=e;return{contextTitle:typeof n=="string"?n:n.title,request:{text:o,timezone:"UTC",chartTypes:s!=null?s:[...Pe]}}}const st=e=>{const{contextTitle:n,request:o}=Ee(e),s=T(),{isLoading:r,isError:a,isSuccess:l,data:u,error:c,refetch:h}=i.useQuery({queryKey:["getNlqResult",n,o,s],queryFn:()=>s==null?void 0:s.ai.getNlqResult(n,o),enabled:!!s&&e.enabled}),C=u?z.toWidgetProps(u,{useCustomizedStyleOptions:e.enableAxisTitlesInWidgetProps||!1}):void 0;return{isLoading:r,isError:a,isSuccess:l,data:C,error:c,refetch:d.useCallback(()=>{h()},[h])}},rt=i.withTracking("useGetNlqResult")(st),Ie=4,Fe=e=>{const{contextTitle:n,count:o,enableAxisTitlesInWidgetProps:s,enabled:r}=e,a=T(),l=o!=null?o:Ie,u=(r===void 0||r===!0)&&l>0,{isLoading:c,isError:h,isSuccess:C,data:p,error:g,refetch:x}=i.useQuery({queryKey:["getQueryRecommendations",n,l,a],queryFn:()=>a==null?void 0:a.ai.getQueryRecommendations(n,{numOfRecommendations:l}),enabled:!!a&&u}),y=d.useMemo(()=>p==null?void 0:p.map(f=>v(b({},f),{widgetProps:f.jaql?z.toWidgetProps(f,{useCustomizedStyleOptions:s}):void 0})),[p,s]);return{isLoading:u?c:!1,isError:h,isSuccess:C,data:y!=null?y:void 0,error:g,refetch:d.useCallback(()=>{x()},[x])}},it=i.withTracking("useGetQueryRecommendations")(Fe),Ne=Object.freeze({enableFollowupQuestions:!1,enableHeader:!0,enableInsights:!0,numOfRecommendations:4,numOfRecentPrompts:5}),Be=d.createContext(b({},Ne)),R=()=>d.useContext(Be),at=({children:e,value:n})=>{const{t:o}=t.useTranslation(),s=Object.entries(n).reduce((r,[a,l])=>(l!==void 0&&(r[a]=l),r),v(b({},Ne),{inputPromptText:o("ai.config.inputPromptText"),welcomeText:o("ai.config.welcomeText"),suggestionsWelcomeText:o("ai.config.suggestionsWelcomeText")}));return t.jsx(Be.Provider,{value:s,children:e})},ae="chatHistory",lt=e=>{const n=T(),{hideHistory:o}=R();return i.useQuery({queryKey:[ae,e,n],queryFn:()=>I(exports,null,function*(){if(!n||!e)return;if(o)return[];const s=yield n.ai.chat.getById(e);return s==null?void 0:s.chatHistory}),enabled:!!n&&!!e})},He=e=>{const n=T(),o=i.useQueryClient();return re({mutationFn:()=>I(exports,null,function*(){if(!(!n||!e))return n.ai.chat.clearHistory(e)}),onError:s=>{console.error("Error when clearing history:",s)},onSettled:()=>{e&&o.setQueriesData([ae,e],[])}})},le=e=>{const{data:n,isLoading:o,isError:s}=lt(e),{mutate:r}=He(e);return d.useEffect(()=>{s&&r()},[s,r]),{history:n,isLoading:o,isError:s}},ct=()=>{const e=T(),{data:n,isLoading:o,fetchStatus:s}=i.useQuery({queryKey:["getDataTopics",e],queryFn:()=>I(exports,null,function*(){if(e)return e.getChatContexts()}),enabled:!!e});return{data:n,isLoading:o,fetchStatus:s}},dt=()=>{const e=T(),{data:n,isLoading:o}=i.useQuery({queryKey:["getAllChats",e],queryFn:()=>e==null?void 0:e.ai.chat.getAll(),enabled:!!e});return{data:n!=null?n:[],isLoading:o}},ut=(e,n,o)=>{const s=i.useQueryClient(),r=T(),a=re({mutationFn:()=>I(exports,null,function*(){if(!(!r||!e))return r.ai.chat.create(e,o)}),onSuccess:()=>s.invalidateQueries(["getAllChats"])});return d.useEffect(()=>{n&&a.isIdle&&a.mutate()},[n,a]),a},ht=(e,n)=>{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(`${n}${JSON.stringify(e)}`)}},pt=(e,n)=>{const o=i.useQueryClient(),s=d.useCallback(c=>{e&&o.setQueriesData([ae,e],h=>h&&[...h,c])},[o,e]),{t:r}=t.useTranslation(),a=T(),{mutate:l,isLoading:u}=re({mutationFn:c=>I(exports,null,function*(){if(!(!a||!e))return a.ai.chat.post(e,{text:c,options:{enableFollowup:n}})}),onMutate:c=>{s({content:c,role:"user"})},onError:c=>{c instanceof Error&&(console.error("Error when sending message:",c.message),s({content:r(`ai.errors.${c.interpolationOptions.errorCode}`,{defaultValue:r("ai.errors.unexpectedChatResponse")}),role:"assistant"}))},onSuccess:c=>{if(!c)return;const h=r("ai.errors.unknownResponse");s(ht(c,h))}});return{mutate:l,isLoading:u}},ce=(e,n,o=!1)=>{var C;const{data:s,isLoading:r}=dt(),a=et(),l=a.getChatId(e,n)||((C=s.find(p=>{var g;return p.contextTitle===e&&((g=p.contextDetails)==null?void 0:g.dashboardId)===(n==null?void 0:n.dashboardId)}))==null?void 0:C.chatId),{isError:u,data:c,isSuccess:h}=ut(e,o&&!r&&!l,n);return d.useEffect(()=>{h&&c&&!l&&a.saveChatId(c.chatId,e,n)},[c,h,e,n,l,a]),{chatId:l,isLoading:r,isError:u}},De=e=>d.useMemo(()=>{if(e!=null&&e.length){const n=e[e.length-1];if(de(n))return JSON.parse(n.content)}return null},[e]),de=e=>!!e&&"type"in e&&e.type==="nlq",Ct=e=>!!e&&"type"in e&&e.type==="text",qe=(e,n)=>{const{t:o}=t.useTranslation(),{enableFollowupQuestions:s}=R(),{chatId:r,isError:a}=ce(e,n,!0),[l,u]=d.useState(null),{history:c,isLoading:h,isError:C}=le(r);d.useEffect(()=>{a?u(new t.TranslatableError("ai.errors.chatUnavailable")):C&&u(new t.TranslatableError("ai.errors.fetchHistory"))},[a,C,o]);const{mutate:p,isLoading:g}=pt(r,s),x=De(c);return{chatId:r,history:c!=null?c:[],lastNlqResponse:x,sendMessage:p,isAwaitingResponse:g,isLoading:h,lastError:l}},gt=({contextTitle:e,contextDetails:n})=>{const{chatId:o}=ce(e,n),{history:s}=le(o);return De(s)},xt=({contextTitle:e,contextDetails:n})=>{const{chatId:o}=ce(e,n),{history:s}=le(o);return d.useMemo(()=>{if(s!=null&&s.length){const r=s.slice().reverse().find(de);if(r)return JSON.parse(r.content)}return null},[s])},ft=500,mt=500,bt=500,yt=900,vt=t.newStyled("div",{target:"e1ldv6710",label:"ChatFrame"})("box-sizing:border-box;position:relative;display:flex;flex-direction:column;border:1px solid #c6c9ce;border-radius:",({theme:e})=>e.aiChat.borderRadius,";background-color:",({theme:e})=>e.aiChat.backgroundColor,";overflow:hidden;min-width:",ft,"px;min-height:",mt,"px;width:",({width:e})=>e?je(e):`${bt}px`,";height:",({height:e})=>e?je(e):`${yt}px`,";",({theme:e})=>t.css`
2
2
  font-size: ${e.aiChat.primaryFontSize[0]};
3
3
  line-height: ${e.aiChat.primaryFontSize[1]};
4
4
  `," border:",({theme:e})=>e.aiChat.border===!1?"none":e.aiChat.border,";");function je(e){return typeof e=="number"?`${e}px`:e}function wt({spin:e}){return t.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",className:`${e?"csdk-animate-spin":""}`,children:[t.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM12 21C16.9706 21 21 16.9706 21 12C21 7.02944 16.9706 3 12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21Z",fill:"#262E3D",fillOpacity:"0.3"}),t.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20 12C20 16.4183 16.4183 20 12 20C11.2844 20 10.5908 19.906 9.93078 19.7298C9.96227 19.5889 9.97888 19.4423 9.97888 19.2918C9.97888 18.1873 9.08345 17.2918 7.97888 17.2918C6.87431 17.2918 5.97888 18.1873 5.97888 19.2918C5.97888 20.3964 6.87431 21.2918 7.97888 21.2918C8.56576 21.2918 9.0936 21.0391 9.45946 20.6364C10.2652 20.8731 11.1178 21 12 21C16.9706 21 21 16.9706 21 12C21 7.02944 16.9706 3 12 3V4C16.4183 4 20 7.58172 20 12Z",fill:"#22C3C3"})]})}function Y(){return t.jsx("div",{className:"csdk-m-auto","aria-label":"loading spinner",children:t.jsx(wt,{spin:!0})})}function jt({theme:e}){return t.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{d:"M4 14L0 10L24 0L14 24L10 20L8.47667 16.9533L19 6.4L20 4.00001L17.6099 5L7.04354 15.5218L4 14Z",fill:e.aiChat.icons.color})})}function kt({theme:e}){const n=e.aiChat.icons.color;return t.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",children:[t.jsx("path",{d:"M21.4095 11.1195L12.5644 6.0459C12.3247 5.90841 12.0189 5.99143 11.8816 6.23128L10.764 8.18434C10.6275 8.42284 10.709 8.72678 10.9466 8.86491L19.7108 13.9614C19.9464 14.0984 20.2483 14.0215 20.3897 13.7884L21.5883 11.8125C21.734 11.5723 21.6532 11.2592 21.4095 11.1195Z",fill:n}),t.jsx("path",{d:"M18.7329 8.60735L16.1048 7.07819L19.6668 0.928042C19.8041 0.6909 20.1068 0.608502 20.3454 0.743288L22.156 1.7661C22.3992 1.90347 22.4827 2.21344 22.3414 2.45438L18.7329 8.60735Z",fill:n}),t.jsx("path",{d:"M19.8544 14.9048L10.3563 9.43067C10.2184 9.35116 10.0413 9.39515 9.95275 9.52746C7.03423 13.8862 4.07448 15.2337 3.18167 16.0938C3.09276 16.1794 3.08414 16.3141 3.1538 16.416C3.74961 17.2879 5.10497 18.4425 6.05628 19.2048C6.17328 19.2985 6.34145 19.2903 6.44961 19.1865L9.97994 15.7973L7.69329 20.1066C7.61954 20.2456 7.66674 20.4186 7.80041 20.5017C11.6152 22.8708 14.2978 24.0437 16.9604 24.4472C17.1542 24.4766 17.3191 24.3106 17.3033 24.1152C17.007 20.469 19.0807 16.6112 19.8544 14.9048Z",fill:n})]})}const St=t.newStyled("div",{target:"e1q6h1ze0",label:"Section"})("display:flex;flex-direction:column;row-gap:4px;"),Tt=t.newStyled("div",{target:"e1q6h1ze1",label:"SectionHeader"})("font-size:11px;line-height:18px;font-weight:300;color:",({theme:e})=>e.aiChat.dropup.headers.textColor,";cursor:pointer;padding:4px 12px;&:hover{background-color:",({theme:e})=>e.aiChat.dropup.headers.hover.backgroundColor,";}"),Mt=t.newStyled("div",{target:"e1q6h1ze2",label:"DropupItem"})("font-size:",({theme:e})=>e.aiChat.primaryFontSize[0],";line-height:",({theme:e})=>e.aiChat.primaryFontSize[1],";color:",({theme:e})=>e.aiChat.dropup.items.textColor,";cursor:pointer;padding:4px 12px;&:hover{background-color:",({theme:e})=>e.aiChat.dropup.items.hover.backgroundColor,";}");function Rt({title:e,items:n,onSelect:o,alwaysExpanded:s=!1}){const[r,a]=d.useState(!1),{themeSettings:l}=t.useThemeContext();return t.jsxs(St,{children:[t.jsx(Tt,{onClick:()=>a(u=>!u),theme:l,children:e.toUpperCase()}),(r||s)&&n.map((u,c)=>t.jsx(Mt,{onClick:()=>o(u),theme:l,children:u},c))]})}const Lt=t.newStyled("div",{target:"e10x5x4a0",label:"PopupContent"})("font-family:",({theme:e})=>e.typography.fontFamily,";font-size:",({theme:e})=>e.aiChat.primaryFontSize[0],";line-height:",({theme:e})=>e.aiChat.primaryFontSize[1],";background-color:",({theme:e})=>e.aiChat.dropup.backgroundColor,";border-radius:",({theme:e})=>e.aiChat.dropup.borderRadius,";box-shadow:",({theme:e})=>e.aiChat.dropup.boxShadow,";padding-top:8px;padding-bottom:8px;display:flex;flex-direction:column;row-gap:4px;"),Pt=t.newStyled("div",{target:"e10x5x4a1",label:"ErrorMessage"})("font-size:",({theme:e})=>e.aiChat.primaryFontSize[0],";line-height:",({theme:e})=>e.aiChat.primaryFontSize[1],";color:",({theme:e})=>e.aiChat.dropup.items.textColor,";padding:4px 12px;"),oe=e=>e.startsWith("/");function Et({recentPrompts:e,suggestions:n,isLoading:o,onSelection:s,anchorEl:r,text:a,recommendationsError:l}){const c=[{title:"/recent searches",items:e,onSelect:s},{title:"/ai recommendations",items:n,onSelect:s}].filter(g=>g.title.slice(0,a.length)===a),{themeSettings:h}=t.useThemeContext(),{t:C}=t.useTranslation(),p=c.length===1;return t.jsx(i.Popper,{open:oe(a)&&c.length>0,anchorEl:r,placement:"top-start",modifiers:[{name:"offset",options:{offset:[0,4]}}],sx:{zIndex:3},children:t.jsxs(Lt,{style:{width:r==null?void 0:r.offsetWidth},theme:h,children:[o&&t.jsx(Y,{}),!o&&!l&&c.map(g=>t.jsx(Rt,v(b({},g),{alwaysExpanded:p}),g.title)),l&&t.jsx(Pt,{theme:h,children:C("ai.errors.recommendationsNotAvailable")})]})})}function Z({title:e,placement:n="top",children:o}){const{themeSettings:s}=t.useThemeContext();return t.jsx(i.Tooltip,{title:e,placement:n,disableInteractive:!0,componentsProps:{tooltip:{sx:{bgcolor:s.aiChat.tooltips.backgroundColor,color:s.aiChat.tooltips.textColor,paddingX:"16px",paddingY:"12px",fontSize:"13px",fontFamily:s.typography.fontFamily,fontWeight:400,borderRadius:"4px",boxShadow:s.aiChat.tooltips.boxShadow}},arrow:{sx:{color:s.aiChat.tooltips.backgroundColor}}},arrow:!0,children:o})}const It=500,Ft=t.newStyled("div",{target:"e6iwkw10",label:"ChatInputContainer"})("display:flex;flex-direction:row;align-items:flex-end;justify-content:space-between;background-color:",({theme:e})=>e.aiChat.backgroundColor,";"),Nt=t.newStyled("button",{target:"e6iwkw11",label:"ClearHistoryButton"})("height:34px;background-color:inherit;cursor:pointer;border:none;"),Bt=t.newStyled("textarea",{target:"e6iwkw12",label:"TextInput"})("font-size:inherit;line-height:inherit;resize:none;overflow-y:auto;box-sizing:border-box;max-height:88px;width:100%;padding-top:7px;padding-bottom:7px;padding-left:16px;padding-right:16px;margin-left:10px;margin-right:10px;border-width:1px;border-color:rgb(38 46 61 / 0.15);border-radius:0.5rem;&:focus{outline:1px solid ",({theme:e})=>e.aiChat.input.focus.outlineColor,";}font-family:inherit;color:",({theme:e})=>e.aiChat.primaryTextColor,";background-color:",({theme:e})=>e.aiChat.input.backgroundColor,";"),Ht=t.newStyled("button",{target:"e6iwkw13",label:"SendMessageButton"})("height:34px;background-color:inherit;border-style:none;color:",({theme:e})=>e.aiChat.primaryTextColor,";",({disabled:e})=>e?t.css`
package/dist/ai.js CHANGED
@@ -35,12 +35,12 @@ var W = (e, t, o) => new Promise((r, i) => {
35
35
  }, c = (l) => l.done ? r(l.value) : Promise.resolve(l.value).then(s, a);
36
36
  c((o = o.apply(e, t)).next());
37
37
  });
38
- import { bv as yt, bw as vt, bx as Ue, by as wt, bz as oe, bA as kt, bB as St, bC as Mt, ba as Ke, bb as Je, aQ as K, J as Me, aD as Ye, aj as Tt, bD as Lt, am as Rt, al as It, A as he, bE as Et, bF as Nt, ar as _, bG as Xe, C as Bt, aW as Ft, _ as Ht, bH as Dt, y as xe, P as f, D as Pt, bI as qt, aE as et, aA as At, bJ as Ot, ah as te, N as Wt, bK as zt, bL as $t, Q as tt, bM as Zt, b6 as jt, bN as Vt } from "./use-common-filters-CJNwlbbh.js";
39
- import { ah as Gt, $ as n, ap as Qt, k as _t, cr as Ut, ai as S, T as ve, bg as u, bq as I, ax as p, aj as m, a0 as F, a2 as V, av as ot, aY as we, b1 as Kt, cs as Jt, ct as Yt, at as Xt, au as e1, m as t1 } from "./derive-chart-family-BNMFblR9.js";
38
+ import { bv as yt, bw as vt, bx as Ue, by as wt, bz as oe, bA as kt, bB as St, bC as Mt, ba as Ke, bb as Je, aQ as K, J as Me, aD as Ye, aj as Tt, bD as Lt, am as Rt, al as It, A as he, bE as Et, bF as Nt, ar as _, bG as Xe, C as Bt, aW as Ft, _ as Ht, bH as Dt, y as xe, P as f, D as Pt, bI as qt, aE as et, aA as At, bJ as Ot, ah as te, N as Wt, bK as zt, bL as $t, Q as tt, bM as Zt, b6 as jt, bN as Vt } from "./use-common-filters--6cyMg9O.js";
39
+ import { ah as Gt, $ as n, ap as Qt, k as _t, cr as Ut, ai as S, T as ve, bg as u, bq as I, ax as p, aj as m, a0 as F, a2 as V, av as ot, aY as we, b1 as Kt, cs as Jt, ct as Yt, at as Xt, au as e1, m as t1 } from "./derive-chart-family-C8duLtwv.js";
40
40
  import * as z from "react";
41
41
  import { createContext as Te, useContext as Le, useMemo as B, useState as L, useCallback as k, useEffect as ne, useRef as U, useLayoutEffect as de, memo as o1, forwardRef as n1 } from "react";
42
- import { t as pe } from "./widget-composer-BEVCXjFv.js";
43
- import { w as Qn } from "./widget-composer-BEVCXjFv.js";
42
+ import { t as pe } from "./widget-composer-BZwsi1mW.js";
43
+ import { w as Qn } from "./widget-composer-BZwsi1mW.js";
44
44
  import { jsx as ee } from "react/jsx-runtime";
45
45
  class r1 extends yt {
46
46
  constructor(t, o) {
@@ -1,4 +1,4 @@
1
- "use strict";var Fn=Object.defineProperty,Kn=Object.defineProperties;var jn=Object.getOwnPropertyDescriptors;var Qe=Object.getOwnPropertySymbols;var as=Object.prototype.hasOwnProperty,ls=Object.prototype.propertyIsEnumerable;var kt=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e);var os=(e,t,s)=>t in e?Fn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,K=(e,t)=>{for(var s in t||(t={}))as.call(t,s)&&os(e,s,t[s]);if(Qe)for(var s of Qe(t))ls.call(t,s)&&os(e,s,t[s]);return e},J=(e,t)=>Kn(e,jn(t));var cs=(e,t)=>{var s={};for(var n in e)as.call(e,n)&&t.indexOf(n)<0&&(s[n]=e[n]);if(e!=null&&Qe)for(var n of Qe(e))t.indexOf(n)<0&&ls.call(e,n)&&(s[n]=e[n]);return s};var Et=(e,t,s)=>new Promise((n,i)=>{var r=l=>{try{a(s.next(l))}catch(c){i(c)}},o=l=>{try{a(s.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(r,o);a((s=s.apply(e,t)).next())}),qn=function(e,t){this[0]=e,this[1]=t};var d=e=>{var t=e[kt("asyncIterator")],s=!1,n,i={};return t==null?(t=e[kt("iterator")](),n=r=>i[r]=o=>t[r](o)):(t=t.call(e),n=r=>i[r]=o=>{if(s){if(s=!1,r==="throw")throw o;return o}return s=!0,{done:!1,value:new qn(new Promise(a=>{var l=t[r](o);if(!(l instanceof Object))throw TypeError("Object expected");a(l)}),1)}}),i[kt("iterator")]=()=>i,n("next"),"throw"in t?n("throw"):i.throw=r=>{throw r},"return"in t&&n("return"),i};Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("./widget-composer-fYnr8SDo.cjs"),T=require("./derive-chart-family-DjbiaKLQ.cjs"),rt=require("./dimensions-DcsEnPSY.cjs"),zt=Symbol.for("yaml.alias"),Mt=Symbol.for("yaml.document"),ee=Symbol.for("yaml.map"),Is=Symbol.for("yaml.pair"),Z=Symbol.for("yaml.scalar"),Ne=Symbol.for("yaml.seq"),Y=Symbol.for("yaml.node.type"),fe=e=>!!e&&typeof e=="object"&&e[Y]===zt,Te=e=>!!e&&typeof e=="object"&&e[Y]===Mt,Ie=e=>!!e&&typeof e=="object"&&e[Y]===ee,_=e=>!!e&&typeof e=="object"&&e[Y]===Is,L=e=>!!e&&typeof e=="object"&&e[Y]===Z,Ce=e=>!!e&&typeof e=="object"&&e[Y]===Ne;function D(e){if(e&&typeof e=="object")switch(e[Y]){case ee:case Ne:return!0}return!1}function B(e){if(e&&typeof e=="object")switch(e[Y]){case zt:case ee:case Z:case Ne:return!0}return!1}const zn=e=>(L(e)||D(e))&&!!e.anchor,U=Symbol("break visit"),Cs=Symbol("skip children"),H=Symbol("remove node");function te(e,t){const s=Ls(t);Te(e)?me(null,e.contents,s,Object.freeze([e]))===H&&(e.contents=null):me(null,e,s,Object.freeze([]))}te.BREAK=U;te.SKIP=Cs;te.REMOVE=H;function me(e,t,s,n){const i=_s(e,t,s,n);if(B(i)||_(i))return Ms(e,n,i),me(e,i,s,n);if(typeof i!="symbol"){if(D(t)){n=Object.freeze(n.concat(t));for(let r=0;r<t.items.length;++r){const o=me(r,t.items[r],s,n);if(typeof o=="number")r=o-1;else{if(o===U)return U;o===H&&(t.items.splice(r,1),r-=1)}}}else if(_(t)){n=Object.freeze(n.concat(t));const r=me("key",t.key,s,n);if(r===U)return U;r===H&&(t.key=null);const o=me("value",t.value,s,n);if(o===U)return U;o===H&&(t.value=null)}}return i}function ot(e,t){return Et(this,null,function*(){const s=Ls(t);Te(e)?(yield ye(null,e.contents,s,Object.freeze([e])))===H&&(e.contents=null):yield ye(null,e,s,Object.freeze([]))})}ot.BREAK=U;ot.SKIP=Cs;ot.REMOVE=H;function ye(e,t,s,n){return Et(this,null,function*(){const i=yield _s(e,t,s,n);if(B(i)||_(i))return Ms(e,n,i),ye(e,i,s,n);if(typeof i!="symbol"){if(D(t)){n=Object.freeze(n.concat(t));for(let r=0;r<t.items.length;++r){const o=yield ye(r,t.items[r],s,n);if(typeof o=="number")r=o-1;else{if(o===U)return U;o===H&&(t.items.splice(r,1),r-=1)}}}else if(_(t)){n=Object.freeze(n.concat(t));const r=yield ye("key",t.key,s,n);if(r===U)return U;r===H&&(t.key=null);const o=yield ye("value",t.value,s,n);if(o===U)return U;o===H&&(t.value=null)}}return i})}function Ls(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function _s(e,t,s,n){var i,r,o,a,l;if(typeof s=="function")return s(e,t,n);if(Ie(t))return(i=s.Map)==null?void 0:i.call(s,e,t,n);if(Ce(t))return(r=s.Seq)==null?void 0:r.call(s,e,t,n);if(_(t))return(o=s.Pair)==null?void 0:o.call(s,e,t,n);if(L(t))return(a=s.Scalar)==null?void 0:a.call(s,e,t,n);if(fe(t))return(l=s.Alias)==null?void 0:l.call(s,e,t,n)}function Ms(e,t,s){const n=t[t.length-1];if(D(n))n.items[e]=s;else if(_(n))e==="key"?n.key=s:n.value=s;else if(Te(n))n.contents=s;else{const i=fe(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}const Un={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},vn=e=>e.replace(/[!,[\]{}]/g,t=>Un[t]);class z{constructor(t,s){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},z.defaultYaml,t),this.tags=Object.assign({},z.defaultTags,s)}clone(){const t=new z(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){const t=new z(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:z.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},z.defaultTags);break}return t}add(t,s){this.atNextDocument&&(this.yaml={explicit:z.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},z.defaultTags),this.atNextDocument=!1);const n=t.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(s(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 s(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 s(6,`Unsupported YAML version ${r}`,o),!1}}default:return s(0,`Unknown directive ${i}`,!0),!1}}tagName(t,s){if(t==="!")return"!";if(t[0]!=="!")return s(`Not a valid tag: ${t}`),null;if(t[1]==="<"){const o=t.slice(2,-1);return o==="!"||o==="!!"?(s(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&s("Verbatim tags must end with a >"),o)}const[,n,i]=t.match(new RegExp("^(.*!)([^!]*)$","s"));i||s(`The ${t} tag has no suffix`);const r=this.tags[n];if(r)try{return r+decodeURIComponent(i)}catch(o){return s(String(o)),null}return n==="!"?t:(s(`Could not resolve tag: ${t}`),null)}tagString(t){for(const[s,n]of Object.entries(this.tags))if(t.startsWith(n))return s+vn(t.substring(n.length));return t[0]==="!"?t:`!<${t}>`}toString(t){const s=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags);let i;if(t&&n.length>0&&B(t.contents)){const r={};te(t.contents,(o,a)=>{B(a)&&a.tag&&(r[a.tag]=!0)}),i=Object.keys(r)}else i=[];for(const[r,o]of n)r==="!!"&&o==="tag:yaml.org,2002:"||(!t||i.some(a=>a.startsWith(o)))&&s.push(`%TAG ${r} ${o}`);return s.join(`
1
+ "use strict";var Fn=Object.defineProperty,Kn=Object.defineProperties;var jn=Object.getOwnPropertyDescriptors;var Qe=Object.getOwnPropertySymbols;var as=Object.prototype.hasOwnProperty,ls=Object.prototype.propertyIsEnumerable;var kt=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e);var os=(e,t,s)=>t in e?Fn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,K=(e,t)=>{for(var s in t||(t={}))as.call(t,s)&&os(e,s,t[s]);if(Qe)for(var s of Qe(t))ls.call(t,s)&&os(e,s,t[s]);return e},J=(e,t)=>Kn(e,jn(t));var cs=(e,t)=>{var s={};for(var n in e)as.call(e,n)&&t.indexOf(n)<0&&(s[n]=e[n]);if(e!=null&&Qe)for(var n of Qe(e))t.indexOf(n)<0&&ls.call(e,n)&&(s[n]=e[n]);return s};var Et=(e,t,s)=>new Promise((n,i)=>{var r=l=>{try{a(s.next(l))}catch(c){i(c)}},o=l=>{try{a(s.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(r,o);a((s=s.apply(e,t)).next())}),qn=function(e,t){this[0]=e,this[1]=t};var d=e=>{var t=e[kt("asyncIterator")],s=!1,n,i={};return t==null?(t=e[kt("iterator")](),n=r=>i[r]=o=>t[r](o)):(t=t.call(e),n=r=>i[r]=o=>{if(s){if(s=!1,r==="throw")throw o;return o}return s=!0,{done:!1,value:new qn(new Promise(a=>{var l=t[r](o);if(!(l instanceof Object))throw TypeError("Object expected");a(l)}),1)}}),i[kt("iterator")]=()=>i,n("next"),"throw"in t?n("throw"):i.throw=r=>{throw r},"return"in t&&n("return"),i};Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("./widget-composer-Bv_aqjLX.cjs"),T=require("./derive-chart-family-CQ1Myy0A.cjs"),rt=require("./dimensions-BBfnA6e8.cjs"),zt=Symbol.for("yaml.alias"),Mt=Symbol.for("yaml.document"),ee=Symbol.for("yaml.map"),Is=Symbol.for("yaml.pair"),Z=Symbol.for("yaml.scalar"),Ne=Symbol.for("yaml.seq"),Y=Symbol.for("yaml.node.type"),fe=e=>!!e&&typeof e=="object"&&e[Y]===zt,Te=e=>!!e&&typeof e=="object"&&e[Y]===Mt,Ie=e=>!!e&&typeof e=="object"&&e[Y]===ee,_=e=>!!e&&typeof e=="object"&&e[Y]===Is,L=e=>!!e&&typeof e=="object"&&e[Y]===Z,Ce=e=>!!e&&typeof e=="object"&&e[Y]===Ne;function D(e){if(e&&typeof e=="object")switch(e[Y]){case ee:case Ne:return!0}return!1}function B(e){if(e&&typeof e=="object")switch(e[Y]){case zt:case ee:case Z:case Ne:return!0}return!1}const zn=e=>(L(e)||D(e))&&!!e.anchor,U=Symbol("break visit"),Cs=Symbol("skip children"),H=Symbol("remove node");function te(e,t){const s=Ls(t);Te(e)?me(null,e.contents,s,Object.freeze([e]))===H&&(e.contents=null):me(null,e,s,Object.freeze([]))}te.BREAK=U;te.SKIP=Cs;te.REMOVE=H;function me(e,t,s,n){const i=_s(e,t,s,n);if(B(i)||_(i))return Ms(e,n,i),me(e,i,s,n);if(typeof i!="symbol"){if(D(t)){n=Object.freeze(n.concat(t));for(let r=0;r<t.items.length;++r){const o=me(r,t.items[r],s,n);if(typeof o=="number")r=o-1;else{if(o===U)return U;o===H&&(t.items.splice(r,1),r-=1)}}}else if(_(t)){n=Object.freeze(n.concat(t));const r=me("key",t.key,s,n);if(r===U)return U;r===H&&(t.key=null);const o=me("value",t.value,s,n);if(o===U)return U;o===H&&(t.value=null)}}return i}function ot(e,t){return Et(this,null,function*(){const s=Ls(t);Te(e)?(yield ye(null,e.contents,s,Object.freeze([e])))===H&&(e.contents=null):yield ye(null,e,s,Object.freeze([]))})}ot.BREAK=U;ot.SKIP=Cs;ot.REMOVE=H;function ye(e,t,s,n){return Et(this,null,function*(){const i=yield _s(e,t,s,n);if(B(i)||_(i))return Ms(e,n,i),ye(e,i,s,n);if(typeof i!="symbol"){if(D(t)){n=Object.freeze(n.concat(t));for(let r=0;r<t.items.length;++r){const o=yield ye(r,t.items[r],s,n);if(typeof o=="number")r=o-1;else{if(o===U)return U;o===H&&(t.items.splice(r,1),r-=1)}}}else if(_(t)){n=Object.freeze(n.concat(t));const r=yield ye("key",t.key,s,n);if(r===U)return U;r===H&&(t.key=null);const o=yield ye("value",t.value,s,n);if(o===U)return U;o===H&&(t.value=null)}}return i})}function Ls(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function _s(e,t,s,n){var i,r,o,a,l;if(typeof s=="function")return s(e,t,n);if(Ie(t))return(i=s.Map)==null?void 0:i.call(s,e,t,n);if(Ce(t))return(r=s.Seq)==null?void 0:r.call(s,e,t,n);if(_(t))return(o=s.Pair)==null?void 0:o.call(s,e,t,n);if(L(t))return(a=s.Scalar)==null?void 0:a.call(s,e,t,n);if(fe(t))return(l=s.Alias)==null?void 0:l.call(s,e,t,n)}function Ms(e,t,s){const n=t[t.length-1];if(D(n))n.items[e]=s;else if(_(n))e==="key"?n.key=s:n.value=s;else if(Te(n))n.contents=s;else{const i=fe(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}const Un={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},vn=e=>e.replace(/[!,[\]{}]/g,t=>Un[t]);class z{constructor(t,s){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},z.defaultYaml,t),this.tags=Object.assign({},z.defaultTags,s)}clone(){const t=new z(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){const t=new z(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:z.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},z.defaultTags);break}return t}add(t,s){this.atNextDocument&&(this.yaml={explicit:z.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},z.defaultTags),this.atNextDocument=!1);const n=t.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(s(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 s(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 s(6,`Unsupported YAML version ${r}`,o),!1}}default:return s(0,`Unknown directive ${i}`,!0),!1}}tagName(t,s){if(t==="!")return"!";if(t[0]!=="!")return s(`Not a valid tag: ${t}`),null;if(t[1]==="<"){const o=t.slice(2,-1);return o==="!"||o==="!!"?(s(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&s("Verbatim tags must end with a >"),o)}const[,n,i]=t.match(new RegExp("^(.*!)([^!]*)$","s"));i||s(`The ${t} tag has no suffix`);const r=this.tags[n];if(r)try{return r+decodeURIComponent(i)}catch(o){return s(String(o)),null}return n==="!"?t:(s(`Could not resolve tag: ${t}`),null)}tagString(t){for(const[s,n]of Object.entries(this.tags))if(t.startsWith(n))return s+vn(t.substring(n.length));return t[0]==="!"?t:`!<${t}>`}toString(t){const s=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags);let i;if(t&&n.length>0&&B(t.contents)){const r={};te(t.contents,(o,a)=>{B(a)&&a.tag&&(r[a.tag]=!0)}),i=Object.keys(r)}else i=[];for(const[r,o]of n)r==="!!"&&o==="tag:yaml.org,2002:"||(!t||i.some(a=>a.startsWith(o)))&&s.push(`%TAG ${r} ${o}`);return s.join(`
2
2
  `)}}z.defaultYaml={explicit:!1,version:"1.2"};z.defaultTags={"!!":"tag:yaml.org,2002:"};function Ds(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){const s=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(s)}return!0}function $s(e){const t=new Set;return te(e,{Value(s,n){n.anchor&&t.add(n.anchor)}}),t}function Ps(e,t){for(let s=1;;++s){const n=`${e}${s}`;if(!t.has(n))return n}}function Vn(e,t){const s=[],n=new Map;let i=null;return{onAnchor:r=>{s.push(r),i||(i=$s(e));const o=Ps(t,i);return i.add(o),o},setAnchors:()=>{for(const r of s){const o=n.get(r);if(typeof o=="object"&&o.anchor&&(L(o.node)||D(o.node)))o.node.anchor=o.anchor;else{const a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=r,a}}},sourceObjects:n}}function ge(e,t,s,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,r=n.length;i<r;++i){const o=n[i],a=ge(e,n,String(i),o);a===void 0?delete n[i]:a!==o&&(n[i]=a)}else if(n instanceof Map)for(const i of Array.from(n.keys())){const r=n.get(i),o=ge(e,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=ge(e,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=ge(e,n,i,r);o===void 0?delete n[i]:o!==r&&(n[i]=o)}return e.call(t,s,n)}function Q(e,t,s){if(Array.isArray(e))return e.map((n,i)=>Q(n,String(i),s));if(e&&typeof e.toJSON=="function"){if(!s||!zn(e))return e.toJSON(t,s);const n={aliasCount:0,count:1,res:void 0};s.anchors.set(e,n),s.onCreate=r=>{n.res=r,delete s.onCreate};const i=e.toJSON(t,s);return s.onCreate&&s.onCreate(i),i}return typeof e=="bigint"&&!(s!=null&&s.keep)?Number(e):e}class Ut{constructor(t){Object.defineProperty(this,Y,{value:t})}clone(){const t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:s,maxAliasCount:n,onAnchor:i,reviver:r}={}){if(!Te(t))throw new TypeError("A document argument is required");const o={anchors:new Map,doc:t,keep:!0,mapAsMap:s===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=Q(this,"",o);if(typeof i=="function")for(const{count:l,res:c}of o.anchors.values())i(c,l);return typeof r=="function"?ge(r,{"":a},"",a):a}}class at extends Ut{constructor(t){super(zt),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t){let s;return te(t,{Node:(n,i)=>{if(i===this)return te.BREAK;i.anchor===this.source&&(s=i)}}),s}toJSON(t,s){if(!s)return{source:this.source};const{anchors:n,doc:i,maxAliasCount:r}=s,o=this.resolve(i);if(!o){const l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let a=n.get(o);if(a||(Q(o,null,s),a=n.get(o)),!a||a.res===void 0){const l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(r>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=Ge(i,o,n)),a.count*a.aliasCount>r)){const l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return a.res}toString(t,s,n){const i=`*${this.source}`;if(t){if(Ds(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){const r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(t.implicitKey)return`${i} `}return i}}function Ge(e,t,s){if(fe(t)){const n=t.resolve(e),i=s&&n&&s.get(n);return i?i.count*i.aliasCount:0}else if(D(t)){let n=0;for(const i of t.items){const r=Ge(e,i,s);r>n&&(n=r)}return n}else if(_(t)){const n=Ge(e,t.key,s),i=Ge(e,t.value,s);return Math.max(n,i)}return 1}const Bs=e=>!e||typeof e!="function"&&typeof e!="object";class A extends Ut{constructor(t){super(Z),this.value=t}toJSON(t,s){return s!=null&&s.keep?this.value:Q(this.value,t,s)}toString(){return String(this.value)}}A.BLOCK_FOLDED="BLOCK_FOLDED";A.BLOCK_LITERAL="BLOCK_LITERAL";A.PLAIN="PLAIN";A.QUOTE_DOUBLE="QUOTE_DOUBLE";A.QUOTE_SINGLE="QUOTE_SINGLE";const Qn="tag:yaml.org,2002:";function Yn(e,t,s){var n;if(t){const i=s.filter(o=>o.tag===t),r=(n=i.find(o=>!o.format))!=null?n:i[0];if(!r)throw new Error(`Tag ${t} not found`);return r}return s.find(i=>{var r;return((r=i.identify)==null?void 0:r.call(i,e))&&!i.format})}function Re(e,t,s){var u,p,y;if(Te(e)&&(e=e.contents),B(e))return e;if(_(e)){const m=(p=(u=s.schema[ee]).createNode)==null?void 0:p.call(u,s.schema,null,s);return m.items.push(e),m}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt!="undefined"&&e instanceof BigInt)&&(e=e.valueOf());const{aliasDuplicateObjects:n,onAnchor:i,onTagObj:r,schema:o,sourceObjects:a}=s;let l;if(n&&e&&typeof e=="object"){if(l=a.get(e),l)return l.anchor||(l.anchor=i(e)),new at(l.anchor);l={anchor:null,node:null},a.set(e,l)}t!=null&&t.startsWith("!!")&&(t=Qn+t.slice(2));let c=Yn(e,t,o.tags);if(!c){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){const m=new A(e);return l&&(l.node=m),m}c=e instanceof Map?o[ee]:Symbol.iterator in Object(e)?o[Ne]:o[ee]}r&&(r(c),delete s.onTagObj);const h=c!=null&&c.createNode?c.createNode(s.schema,e,s):typeof((y=c==null?void 0:c.nodeClass)==null?void 0:y.from)=="function"?c.nodeClass.from(s.schema,e,s):new A(e);return t?h.tag=t:c.default||(h.tag=c.tag),l&&(l.node=h),h}function tt(e,t,s){let n=s;for(let i=t.length-1;i>=0;--i){const r=t[i];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){const o=[];o[r]=n,n=o}else n=new Map([[r,n]])}return Re(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}const $e=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done;class Rs extends Ut{constructor(t,s){super(t),Object.defineProperty(this,"schema",{value:s,configurable:!0,enumerable:!1,writable:!0})}clone(t){const s=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(s.schema=t),s.items=s.items.map(n=>B(n)||_(n)?n.clone(t):n),this.range&&(s.range=this.range.slice()),s}addIn(t,s){if($e(t))this.add(s);else{const[n,...i]=t,r=this.get(n,!0);if(D(r))r.addIn(i,s);else if(r===void 0&&this.schema)this.set(n,tt(this.schema,i,s));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(t){const[s,...n]=t;if(n.length===0)return this.delete(s);const i=this.get(s,!0);if(D(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${s}. Remaining path: ${n}`)}getIn(t,s){const[n,...i]=t,r=this.get(n,!0);return i.length===0?!s&&L(r)?r.value:r:D(r)?r.getIn(i,s):void 0}hasAllNullValues(t){return this.items.every(s=>{if(!_(s))return!1;const n=s.value;return n==null||t&&L(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(t){const[s,...n]=t;if(n.length===0)return this.has(s);const i=this.get(s,!0);return D(i)?i.hasIn(n):!1}setIn(t,s){const[n,...i]=t;if(i.length===0)this.set(n,s);else{const r=this.get(n,!0);if(D(r))r.setIn(i,s);else if(r===void 0&&this.schema)this.set(n,tt(this.schema,i,s));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}}const Jn=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function X(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}const oe=(e,t,s)=>e.endsWith(`
3
3
  `)?X(s,t):s.includes(`
4
4
  `)?`