@epam/statgpt-conversation-view 0.2.0-rc.2 → 0.2.0-rc.21

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/index.js CHANGED
@@ -1,17 +1,16 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),h=require("react"),de=require("@epam/ai-dial-shared"),j=require("@epam/statgpt-ui-components"),Ee=require("@tabler/icons-react"),V=require("classnames"),re=require("@epam/statgpt-dial-toolkit"),ee=require("@epam/statgpt-shared-toolkit"),kr=require("@epam/statgpt-conversation-list"),lo=require("react-markdown"),ao=require("remark-gfm"),D=require("@epam/statgpt-sdmx-toolkit"),Nr=require("react-window"),Sr=require("react-virtualized-auto-sizer"),ke=require("@floating-ui/react"),so=require("echarts-for-react"),co=require("ag-grid-react"),_t=require("ag-grid-community"),uo=require("lodash"),Rt=require("date-fns");function jr(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const X=jr(h),ho=h.createContext(void 0),Er=({children:e})=>{const[n,t]=h.useState(!1);return i.jsx(ho.Provider,{value:{isOpenedAdvancedView:n,setIsOpenedAdvancedView:t},children:e})},_e=()=>{const e=h.useContext(ho);if(e===void 0)throw new Error("useAdvancedView must be used within a AdvancedViewProvider");return e},fo=h.createContext(void 0),Dr=({children:e})=>{const[n,t]=h.useState(""),[o,r]=h.useState(""),[l,c]=h.useState(),[g,a]=h.useState();return i.jsx(fo.Provider,{value:{onboardingFileName:n,onboardingFilePath:o,isShowOnboarding:l,onboardingFileSchema:g,setOnboardingFileName:t,setOnboardingFilePath:r,setIsShowOnboarding:c,setOnboardingFileSchema:a},children:e})},me=()=>{const e=h.useContext(fo);if(e===void 0)throw new Error("useOnboarding must be used within a OnboardingProvider");return e};var qe=(e=>(e.CHOICE="choice",e.COMPLETION="completion",e))(qe||{}),on=(e=>(e.COMPLETE="complete",e))(on||{}),go=(e=>(e.COMPLETED="completed",e))(go||{}),Xe=(e=>(e.PREVIOUS="previous",e.NEXT="next",e))(Xe||{});const wo=({inProcess:e,containerClasses:n,inputClasses:t,placeholder:o,sendMessageIcon:r,onSendMessage:l,onStopStreaming:c})=>{const[g,a]=h.useState(""),u=h.useCallback(f=>{a(f)},[a]),s=f=>{e||(a(""),l(f))},d=f=>{f.key===j.KeyboardKey.Enter&&!f.shiftKey&&s(g.trim())};return i.jsx(j.InputWithIcon,{inputId:"ask-input",containerClasses:n,placeholder:o,onChange:u,onKeyDown:d,cssClass:V(t,"input-for-ask"),value:g,iconAfterInput:g?e?i.jsx(j.IconButton,{buttonClassName:"input-for-ask-button",onClick:()=>c==null?void 0:c(),icon:i.jsx(Ee.IconPlayerStopFilled,{})}):i.jsx(j.IconButton,{buttonClassName:"input-for-ask-button",onClick:()=>s(g),icon:r}):null})},It=160,Ar=':;,=/{}%&\\"',yr=new RegExp(`[${Ar}]|(\r
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),h=require("react"),se=require("@epam/ai-dial-shared"),E=require("@epam/statgpt-ui-components"),De=require("@tabler/icons-react"),V=require("classnames"),ne=require("@epam/statgpt-dial-toolkit"),q=require("@epam/statgpt-shared-toolkit"),kr=require("@epam/statgpt-conversation-list"),io=require("react-markdown"),lo=require("remark-gfm"),A=require("@epam/statgpt-sdmx-toolkit"),Sr=require("react-window"),Nr=require("react-virtualized-auto-sizer"),pe=require("@floating-ui/react"),so=require("echarts-for-react"),ao=require("ag-grid-react"),Lt=require("ag-grid-community"),co=require("lodash"),Rt=require("date-fns"),jr=require("tailwind-merge");function Er(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const ee=Er(h),uo=h.createContext(void 0),Dr=({children:e})=>{const[n,t]=h.useState(!1);return l.jsx(uo.Provider,{value:{isOpenedAdvancedView:n,setIsOpenedAdvancedView:t},children:e})},Me=()=>{const e=h.useContext(uo);if(e===void 0)throw new Error("useAdvancedView must be used within a AdvancedViewProvider");return e},ho=h.createContext(void 0),Ar=({children:e})=>{const[n,t]=h.useState(""),[o,r]=h.useState(""),[i,u]=h.useState(),[f,s]=h.useState();return l.jsx(ho.Provider,{value:{onboardingFileName:n,onboardingFilePath:o,isShowOnboarding:i,onboardingFileSchema:f,setOnboardingFileName:t,setOnboardingFilePath:r,setIsShowOnboarding:u,setOnboardingFileSchema:s},children:e})},we=()=>{const e=h.useContext(ho);if(e===void 0)throw new Error("useOnboarding must be used within a OnboardingProvider");return e};var Ke=(e=>(e.CHOICE="choice",e.COMPLETION="completion",e))(Ke||{}),nn=(e=>(e.COMPLETE="complete",e))(nn||{}),fo=(e=>(e.COMPLETED="completed",e))(fo||{}),Ze=(e=>(e.PREVIOUS="previous",e.NEXT="next",e))(Ze||{});const go=({inProcess:e,containerClasses:n,inputClasses:t,placeholder:o,sendMessageIcon:r,onSendMessage:i,onStopStreaming:u})=>{const[f,s]=h.useState(""),c=h.useCallback(g=>{s(g)},[s]),a=g=>{e||(s(""),i(g))},d=g=>{g.key===E.KeyboardKey.Enter&&!g.shiftKey&&a(f.trim())};return l.jsx(E.InputWithIcon,{inputId:"ask-input",containerClasses:n,placeholder:o,onChange:c,onKeyDown:d,cssClass:V(t,"input-for-ask"),value:f,iconAfterInput:f?e?l.jsx(E.IconButton,{buttonClassName:"input-for-ask-button",onClick:()=>u==null?void 0:u(),icon:l.jsx(De.IconPlayerStopFilled,{})}):l.jsx(E.IconButton,{buttonClassName:"input-for-ask-button",onClick:()=>a(f),icon:r}):null})},_t=160,yr=':;,=/{}%&\\"',Tr=new RegExp(`[${yr}]|(\r
2
2
  |
3
- |\r| )|[\0-]`,"gm"),Mr=(e,n,t,o)=>({name:Tr(o||`${t} ${new Date().toLocaleDateString()}`),folderId:`${e}/${n}`,prompt:o}),Tr=e=>{const n=(e==null?void 0:e.replace(/\r\n|\r/gm,`
3
+ |\r| )|[\0-]`,"gm"),Mr=(e,n,t,o)=>({name:Or(o||`${t} ${new Date().toLocaleDateString()}`),folderId:`${e}/${n}`,prompt:o}),Or=e=>{const n=(e==null?void 0:e.replace(/\r\n|\r/gm,`
4
4
  `).split(`
5
- `).map(o=>o.replace(yr," ").trim()).filter(Boolean)[0])??"";return(n.length>It?n.substring(0,It):n).trim()},Or=(e,n,t,o,r,l)=>{const c=`${e}/${n}`;return{name:t,folderId:c,prompt:r,id:re.generateConversationId({folderId:c,name:t}),messages:[{role:de.Role.Assistant,content:o}],custom_fields:{configuration:{choice:l}}}},Lr=e=>X.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},X.createElement("path",{d:"M4.16667 17.5C3.70833 17.5 3.31597 17.3368 2.98958 17.0104C2.66319 16.684 2.5 16.2917 2.5 15.8333V4.16667C2.5 3.70833 2.66319 3.31597 2.98958 2.98958C3.31597 2.66319 3.70833 2.5 4.16667 2.5H10V4.16667H4.16667V15.8333H10V17.5H4.16667ZM13.3333 14.1667L12.1875 12.9583L14.3125 10.8333H7.5V9.16667H14.3125L12.1875 7.04167L13.3333 5.83333L17.5 10L13.3333 14.1667Z",fill:"currentColor"})),mo=({userInfo:e,signOutAction:n,title:t})=>{const o=h.useMemo(()=>(e==null?void 0:e.name.split(" ").map(c=>c[0].toUpperCase()).join(""))||"",[e]),r=h.useMemo(()=>i.jsx("div",{className:`cursor-pointer flex items-center justify-center bg-hues-900 h-[44px] w-[44px] rounded-[100px]
6
- p-[10px] text-white h2 border-accent-700 border-[1px]`,children:o}),[o]),l=h.useMemo(()=>i.jsxs("div",{className:"py-1",children:[i.jsxs("div",{className:"py-2 px-3",children:[i.jsx("h4",{className:"text-neutrals-1000",children:e==null?void 0:e.name}),i.jsx("p",{className:"text-neutrals-800 body-3",children:e==null?void 0:e.email})]}),i.jsxs("button",{className:"p-3 items-center flex gap-1 text-primary fill-primary h3",onClick:n,children:[i.jsx(Lr,{width:20,height:20}),t||"Sign out"]})]}),[e,n,t]);if(e)return i.jsx(j.Dropdown,{containerClassName:"transition-opacity ml-3 group-hover:opacity-100",triggerButton:r,content:l,openedClassName:"action-menu-opened"})};var _r=Object.defineProperty,Qe=Object.getOwnPropertySymbols,po=Object.prototype.hasOwnProperty,xo=Object.prototype.propertyIsEnumerable,Pt=(e,n,t)=>n in e?_r(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,hn=(e,n)=>{for(var t in n||(n={}))po.call(n,t)&&Pt(e,t,n[t]);if(Qe)for(var t of Qe(n))xo.call(n,t)&&Pt(e,t,n[t]);return e},fn=(e,n)=>{var t={};for(var o in e)po.call(e,o)&&n.indexOf(o)<0&&(t[o]=e[o]);if(e!=null&&Qe)for(var o of Qe(e))n.indexOf(o)<0&&xo.call(e,o)&&(t[o]=e[o]);return t};/**
5
+ `).map(o=>o.replace(Tr," ").trim()).filter(Boolean)[0])??"";return(n.length>_t?n.substring(0,_t):n).trim()},Lr=(e,n,t,o,r,i)=>{const u=`${e}/${n}`;return{name:t,folderId:u,prompt:r,id:ne.generateConversationId({folderId:u,name:t}),messages:[{role:se.Role.Assistant,content:o}],custom_fields:{configuration:{choice:i}}}};var Rr=Object.defineProperty,qe=Object.getOwnPropertySymbols,wo=Object.prototype.hasOwnProperty,mo=Object.prototype.propertyIsEnumerable,It=(e,n,t)=>n in e?Rr(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,un=(e,n)=>{for(var t in n||(n={}))wo.call(n,t)&&It(e,t,n[t]);if(qe)for(var t of qe(n))mo.call(n,t)&&It(e,t,n[t]);return e},dn=(e,n)=>{var t={};for(var o in e)wo.call(e,o)&&n.indexOf(o)<0&&(t[o]=e[o]);if(e!=null&&qe)for(var o of qe(e))n.indexOf(o)<0&&mo.call(e,o)&&(t[o]=e[o]);return t};/**
7
6
  * @license QR Code generator library (TypeScript)
8
7
  * Copyright (c) Project Nayuki.
9
8
  * SPDX-License-Identifier: MIT
10
- */var Pe;(e=>{const n=class Y{constructor(a,u,s,d){if(this.version=a,this.errorCorrectionLevel=u,this.modules=[],this.isFunction=[],a<Y.MIN_VERSION||a>Y.MAX_VERSION)throw new RangeError("Version value out of range");if(d<-1||d>7)throw new RangeError("Mask value out of range");this.size=a*4+17;let f=[];for(let m=0;m<this.size;m++)f.push(!1);for(let m=0;m<this.size;m++)this.modules.push(f.slice()),this.isFunction.push(f.slice());this.drawFunctionPatterns();const w=this.addEccAndInterleave(s);if(this.drawCodewords(w),d==-1){let m=1e9;for(let b=0;b<8;b++){this.applyMask(b),this.drawFormatBits(b);const p=this.getPenaltyScore();p<m&&(d=b,m=p),this.applyMask(b)}}r(0<=d&&d<=7),this.mask=d,this.applyMask(d),this.drawFormatBits(d),this.isFunction=[]}static encodeText(a,u){const s=e.QrSegment.makeSegments(a);return Y.encodeSegments(s,u)}static encodeBinary(a,u){const s=e.QrSegment.makeBytes(a);return Y.encodeSegments([s],u)}static encodeSegments(a,u,s=1,d=40,f=-1,w=!0){if(!(Y.MIN_VERSION<=s&&s<=d&&d<=Y.MAX_VERSION)||f<-1||f>7)throw new RangeError("Invalid value");let m,b;for(m=s;;m++){const x=Y.getNumDataCodewords(m,u)*8,N=c.getTotalBits(a,m);if(N<=x){b=N;break}if(m>=d)throw new RangeError("Data too long")}for(const x of[Y.Ecc.MEDIUM,Y.Ecc.QUARTILE,Y.Ecc.HIGH])w&&b<=Y.getNumDataCodewords(m,x)*8&&(u=x);let p=[];for(const x of a){t(x.mode.modeBits,4,p),t(x.numChars,x.mode.numCharCountBits(m),p);for(const N of x.getData())p.push(N)}r(p.length==b);const S=Y.getNumDataCodewords(m,u)*8;r(p.length<=S),t(0,Math.min(4,S-p.length),p),t(0,(8-p.length%8)%8,p),r(p.length%8==0);for(let x=236;p.length<S;x^=253)t(x,8,p);let C=[];for(;C.length*8<p.length;)C.push(0);return p.forEach((x,N)=>C[N>>>3]|=x<<7-(N&7)),new Y(m,u,C,f)}getModule(a,u){return 0<=a&&a<this.size&&0<=u&&u<this.size&&this.modules[u][a]}getModules(){return this.modules}drawFunctionPatterns(){for(let s=0;s<this.size;s++)this.setFunctionModule(6,s,s%2==0),this.setFunctionModule(s,6,s%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const a=this.getAlignmentPatternPositions(),u=a.length;for(let s=0;s<u;s++)for(let d=0;d<u;d++)s==0&&d==0||s==0&&d==u-1||s==u-1&&d==0||this.drawAlignmentPattern(a[s],a[d]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(a){const u=this.errorCorrectionLevel.formatBits<<3|a;let s=u;for(let f=0;f<10;f++)s=s<<1^(s>>>9)*1335;const d=(u<<10|s)^21522;r(d>>>15==0);for(let f=0;f<=5;f++)this.setFunctionModule(8,f,o(d,f));this.setFunctionModule(8,7,o(d,6)),this.setFunctionModule(8,8,o(d,7)),this.setFunctionModule(7,8,o(d,8));for(let f=9;f<15;f++)this.setFunctionModule(14-f,8,o(d,f));for(let f=0;f<8;f++)this.setFunctionModule(this.size-1-f,8,o(d,f));for(let f=8;f<15;f++)this.setFunctionModule(8,this.size-15+f,o(d,f));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let a=this.version;for(let s=0;s<12;s++)a=a<<1^(a>>>11)*7973;const u=this.version<<12|a;r(u>>>18==0);for(let s=0;s<18;s++){const d=o(u,s),f=this.size-11+s%3,w=Math.floor(s/3);this.setFunctionModule(f,w,d),this.setFunctionModule(w,f,d)}}drawFinderPattern(a,u){for(let s=-4;s<=4;s++)for(let d=-4;d<=4;d++){const f=Math.max(Math.abs(d),Math.abs(s)),w=a+d,m=u+s;0<=w&&w<this.size&&0<=m&&m<this.size&&this.setFunctionModule(w,m,f!=2&&f!=4)}}drawAlignmentPattern(a,u){for(let s=-2;s<=2;s++)for(let d=-2;d<=2;d++)this.setFunctionModule(a+d,u+s,Math.max(Math.abs(d),Math.abs(s))!=1)}setFunctionModule(a,u,s){this.modules[u][a]=s,this.isFunction[u][a]=!0}addEccAndInterleave(a){const u=this.version,s=this.errorCorrectionLevel;if(a.length!=Y.getNumDataCodewords(u,s))throw new RangeError("Invalid argument");const d=Y.NUM_ERROR_CORRECTION_BLOCKS[s.ordinal][u],f=Y.ECC_CODEWORDS_PER_BLOCK[s.ordinal][u],w=Math.floor(Y.getNumRawDataModules(u)/8),m=d-w%d,b=Math.floor(w/d);let p=[];const S=Y.reedSolomonComputeDivisor(f);for(let x=0,N=0;x<d;x++){let v=a.slice(N,N+b-f+(x<m?0:1));N+=v.length;const E=Y.reedSolomonComputeRemainder(v,S);x<m&&v.push(0),p.push(v.concat(E))}let C=[];for(let x=0;x<p[0].length;x++)p.forEach((N,v)=>{(x!=b-f||v>=m)&&C.push(N[x])});return r(C.length==w),C}drawCodewords(a){if(a.length!=Math.floor(Y.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let u=0;for(let s=this.size-1;s>=1;s-=2){s==6&&(s=5);for(let d=0;d<this.size;d++)for(let f=0;f<2;f++){const w=s-f,b=(s+1&2)==0?this.size-1-d:d;!this.isFunction[b][w]&&u<a.length*8&&(this.modules[b][w]=o(a[u>>>3],7-(u&7)),u++)}}r(u==a.length*8)}applyMask(a){if(a<0||a>7)throw new RangeError("Mask value out of range");for(let u=0;u<this.size;u++)for(let s=0;s<this.size;s++){let d;switch(a){case 0:d=(s+u)%2==0;break;case 1:d=u%2==0;break;case 2:d=s%3==0;break;case 3:d=(s+u)%3==0;break;case 4:d=(Math.floor(s/3)+Math.floor(u/2))%2==0;break;case 5:d=s*u%2+s*u%3==0;break;case 6:d=(s*u%2+s*u%3)%2==0;break;case 7:d=((s+u)%2+s*u%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[u][s]&&d&&(this.modules[u][s]=!this.modules[u][s])}}getPenaltyScore(){let a=0;for(let f=0;f<this.size;f++){let w=!1,m=0,b=[0,0,0,0,0,0,0];for(let p=0;p<this.size;p++)this.modules[f][p]==w?(m++,m==5?a+=Y.PENALTY_N1:m>5&&a++):(this.finderPenaltyAddHistory(m,b),w||(a+=this.finderPenaltyCountPatterns(b)*Y.PENALTY_N3),w=this.modules[f][p],m=1);a+=this.finderPenaltyTerminateAndCount(w,m,b)*Y.PENALTY_N3}for(let f=0;f<this.size;f++){let w=!1,m=0,b=[0,0,0,0,0,0,0];for(let p=0;p<this.size;p++)this.modules[p][f]==w?(m++,m==5?a+=Y.PENALTY_N1:m>5&&a++):(this.finderPenaltyAddHistory(m,b),w||(a+=this.finderPenaltyCountPatterns(b)*Y.PENALTY_N3),w=this.modules[p][f],m=1);a+=this.finderPenaltyTerminateAndCount(w,m,b)*Y.PENALTY_N3}for(let f=0;f<this.size-1;f++)for(let w=0;w<this.size-1;w++){const m=this.modules[f][w];m==this.modules[f][w+1]&&m==this.modules[f+1][w]&&m==this.modules[f+1][w+1]&&(a+=Y.PENALTY_N2)}let u=0;for(const f of this.modules)u=f.reduce((w,m)=>w+(m?1:0),u);const s=this.size*this.size,d=Math.ceil(Math.abs(u*20-s*10)/s)-1;return r(0<=d&&d<=9),a+=d*Y.PENALTY_N4,r(0<=a&&a<=2568888),a}getAlignmentPatternPositions(){if(this.version==1)return[];{const a=Math.floor(this.version/7)+2,u=this.version==32?26:Math.ceil((this.version*4+4)/(a*2-2))*2;let s=[6];for(let d=this.size-7;s.length<a;d-=u)s.splice(1,0,d);return s}}static getNumRawDataModules(a){if(a<Y.MIN_VERSION||a>Y.MAX_VERSION)throw new RangeError("Version number out of range");let u=(16*a+128)*a+64;if(a>=2){const s=Math.floor(a/7)+2;u-=(25*s-10)*s-55,a>=7&&(u-=36)}return r(208<=u&&u<=29648),u}static getNumDataCodewords(a,u){return Math.floor(Y.getNumRawDataModules(a)/8)-Y.ECC_CODEWORDS_PER_BLOCK[u.ordinal][a]*Y.NUM_ERROR_CORRECTION_BLOCKS[u.ordinal][a]}static reedSolomonComputeDivisor(a){if(a<1||a>255)throw new RangeError("Degree out of range");let u=[];for(let d=0;d<a-1;d++)u.push(0);u.push(1);let s=1;for(let d=0;d<a;d++){for(let f=0;f<u.length;f++)u[f]=Y.reedSolomonMultiply(u[f],s),f+1<u.length&&(u[f]^=u[f+1]);s=Y.reedSolomonMultiply(s,2)}return u}static reedSolomonComputeRemainder(a,u){let s=u.map(d=>0);for(const d of a){const f=d^s.shift();s.push(0),u.forEach((w,m)=>s[m]^=Y.reedSolomonMultiply(w,f))}return s}static reedSolomonMultiply(a,u){if(a>>>8||u>>>8)throw new RangeError("Byte out of range");let s=0;for(let d=7;d>=0;d--)s=s<<1^(s>>>7)*285,s^=(u>>>d&1)*a;return r(s>>>8==0),s}finderPenaltyCountPatterns(a){const u=a[1];r(u<=this.size*3);const s=u>0&&a[2]==u&&a[3]==u*3&&a[4]==u&&a[5]==u;return(s&&a[0]>=u*4&&a[6]>=u?1:0)+(s&&a[6]>=u*4&&a[0]>=u?1:0)}finderPenaltyTerminateAndCount(a,u,s){return a&&(this.finderPenaltyAddHistory(u,s),u=0),u+=this.size,this.finderPenaltyAddHistory(u,s),this.finderPenaltyCountPatterns(s)}finderPenaltyAddHistory(a,u){u[0]==0&&(a+=this.size),u.pop(),u.unshift(a)}};n.MIN_VERSION=1,n.MAX_VERSION=40,n.PENALTY_N1=3,n.PENALTY_N2=3,n.PENALTY_N3=40,n.PENALTY_N4=10,n.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],n.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=n;function t(g,a,u){if(a<0||a>31||g>>>a)throw new RangeError("Value out of range");for(let s=a-1;s>=0;s--)u.push(g>>>s&1)}function o(g,a){return(g>>>a&1)!=0}function r(g){if(!g)throw new Error("Assertion error")}const l=class ie{constructor(a,u,s){if(this.mode=a,this.numChars=u,this.bitData=s,u<0)throw new RangeError("Invalid argument");this.bitData=s.slice()}static makeBytes(a){let u=[];for(const s of a)t(s,8,u);return new ie(ie.Mode.BYTE,a.length,u)}static makeNumeric(a){if(!ie.isNumeric(a))throw new RangeError("String contains non-numeric characters");let u=[];for(let s=0;s<a.length;){const d=Math.min(a.length-s,3);t(parseInt(a.substring(s,s+d),10),d*3+1,u),s+=d}return new ie(ie.Mode.NUMERIC,a.length,u)}static makeAlphanumeric(a){if(!ie.isAlphanumeric(a))throw new RangeError("String contains unencodable characters in alphanumeric mode");let u=[],s;for(s=0;s+2<=a.length;s+=2){let d=ie.ALPHANUMERIC_CHARSET.indexOf(a.charAt(s))*45;d+=ie.ALPHANUMERIC_CHARSET.indexOf(a.charAt(s+1)),t(d,11,u)}return s<a.length&&t(ie.ALPHANUMERIC_CHARSET.indexOf(a.charAt(s)),6,u),new ie(ie.Mode.ALPHANUMERIC,a.length,u)}static makeSegments(a){return a==""?[]:ie.isNumeric(a)?[ie.makeNumeric(a)]:ie.isAlphanumeric(a)?[ie.makeAlphanumeric(a)]:[ie.makeBytes(ie.toUtf8ByteArray(a))]}static makeEci(a){let u=[];if(a<0)throw new RangeError("ECI assignment value out of range");if(a<128)t(a,8,u);else if(a<16384)t(2,2,u),t(a,14,u);else if(a<1e6)t(6,3,u),t(a,21,u);else throw new RangeError("ECI assignment value out of range");return new ie(ie.Mode.ECI,0,u)}static isNumeric(a){return ie.NUMERIC_REGEX.test(a)}static isAlphanumeric(a){return ie.ALPHANUMERIC_REGEX.test(a)}getData(){return this.bitData.slice()}static getTotalBits(a,u){let s=0;for(const d of a){const f=d.mode.numCharCountBits(u);if(d.numChars>=1<<f)return 1/0;s+=4+f+d.bitData.length}return s}static toUtf8ByteArray(a){a=encodeURI(a);let u=[];for(let s=0;s<a.length;s++)a.charAt(s)!="%"?u.push(a.charCodeAt(s)):(u.push(parseInt(a.substring(s+1,s+3),16)),s+=2);return u}};l.NUMERIC_REGEX=/^[0-9]*$/,l.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,l.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let c=l;e.QrSegment=l})(Pe||(Pe={}));(e=>{(n=>{const t=class{constructor(r,l){this.ordinal=r,this.formatBits=l}};t.LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),n.Ecc=t})(e.QrCode||(e.QrCode={}))})(Pe||(Pe={}));(e=>{(n=>{const t=class{constructor(r,l){this.modeBits=r,this.numBitsCharCount=l}numCharCountBits(r){return this.numBitsCharCount[Math.floor((r+7)/17)]}};t.NUMERIC=new t(1,[10,12,14]),t.ALPHANUMERIC=new t(2,[9,11,13]),t.BYTE=new t(4,[8,16,16]),t.KANJI=new t(8,[8,10,12]),t.ECI=new t(7,[0,0,0]),n.Mode=t})(e.QrSegment||(e.QrSegment={}))})(Pe||(Pe={}));var Ve=Pe;/**
9
+ */var Re;(e=>{const n=class Z{constructor(s,c,a,d){if(this.version=s,this.errorCorrectionLevel=c,this.modules=[],this.isFunction=[],s<Z.MIN_VERSION||s>Z.MAX_VERSION)throw new RangeError("Version value out of range");if(d<-1||d>7)throw new RangeError("Mask value out of range");this.size=s*4+17;let g=[];for(let m=0;m<this.size;m++)g.push(!1);for(let m=0;m<this.size;m++)this.modules.push(g.slice()),this.isFunction.push(g.slice());this.drawFunctionPatterns();const w=this.addEccAndInterleave(a);if(this.drawCodewords(w),d==-1){let m=1e9;for(let v=0;v<8;v++){this.applyMask(v),this.drawFormatBits(v);const p=this.getPenaltyScore();p<m&&(d=v,m=p),this.applyMask(v)}}r(0<=d&&d<=7),this.mask=d,this.applyMask(d),this.drawFormatBits(d),this.isFunction=[]}static encodeText(s,c){const a=e.QrSegment.makeSegments(s);return Z.encodeSegments(a,c)}static encodeBinary(s,c){const a=e.QrSegment.makeBytes(s);return Z.encodeSegments([a],c)}static encodeSegments(s,c,a=1,d=40,g=-1,w=!0){if(!(Z.MIN_VERSION<=a&&a<=d&&d<=Z.MAX_VERSION)||g<-1||g>7)throw new RangeError("Invalid value");let m,v;for(m=a;;m++){const x=Z.getNumDataCodewords(m,c)*8,N=u.getTotalBits(s,m);if(N<=x){v=N;break}if(m>=d)throw new RangeError("Data too long")}for(const x of[Z.Ecc.MEDIUM,Z.Ecc.QUARTILE,Z.Ecc.HIGH])w&&v<=Z.getNumDataCodewords(m,x)*8&&(c=x);let p=[];for(const x of s){t(x.mode.modeBits,4,p),t(x.numChars,x.mode.numCharCountBits(m),p);for(const N of x.getData())p.push(N)}r(p.length==v);const b=Z.getNumDataCodewords(m,c)*8;r(p.length<=b),t(0,Math.min(4,b-p.length),p),t(0,(8-p.length%8)%8,p),r(p.length%8==0);for(let x=236;p.length<b;x^=253)t(x,8,p);let k=[];for(;k.length*8<p.length;)k.push(0);return p.forEach((x,N)=>k[N>>>3]|=x<<7-(N&7)),new Z(m,c,k,g)}getModule(s,c){return 0<=s&&s<this.size&&0<=c&&c<this.size&&this.modules[c][s]}getModules(){return this.modules}drawFunctionPatterns(){for(let a=0;a<this.size;a++)this.setFunctionModule(6,a,a%2==0),this.setFunctionModule(a,6,a%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const s=this.getAlignmentPatternPositions(),c=s.length;for(let a=0;a<c;a++)for(let d=0;d<c;d++)a==0&&d==0||a==0&&d==c-1||a==c-1&&d==0||this.drawAlignmentPattern(s[a],s[d]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(s){const c=this.errorCorrectionLevel.formatBits<<3|s;let a=c;for(let g=0;g<10;g++)a=a<<1^(a>>>9)*1335;const d=(c<<10|a)^21522;r(d>>>15==0);for(let g=0;g<=5;g++)this.setFunctionModule(8,g,o(d,g));this.setFunctionModule(8,7,o(d,6)),this.setFunctionModule(8,8,o(d,7)),this.setFunctionModule(7,8,o(d,8));for(let g=9;g<15;g++)this.setFunctionModule(14-g,8,o(d,g));for(let g=0;g<8;g++)this.setFunctionModule(this.size-1-g,8,o(d,g));for(let g=8;g<15;g++)this.setFunctionModule(8,this.size-15+g,o(d,g));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let s=this.version;for(let a=0;a<12;a++)s=s<<1^(s>>>11)*7973;const c=this.version<<12|s;r(c>>>18==0);for(let a=0;a<18;a++){const d=o(c,a),g=this.size-11+a%3,w=Math.floor(a/3);this.setFunctionModule(g,w,d),this.setFunctionModule(w,g,d)}}drawFinderPattern(s,c){for(let a=-4;a<=4;a++)for(let d=-4;d<=4;d++){const g=Math.max(Math.abs(d),Math.abs(a)),w=s+d,m=c+a;0<=w&&w<this.size&&0<=m&&m<this.size&&this.setFunctionModule(w,m,g!=2&&g!=4)}}drawAlignmentPattern(s,c){for(let a=-2;a<=2;a++)for(let d=-2;d<=2;d++)this.setFunctionModule(s+d,c+a,Math.max(Math.abs(d),Math.abs(a))!=1)}setFunctionModule(s,c,a){this.modules[c][s]=a,this.isFunction[c][s]=!0}addEccAndInterleave(s){const c=this.version,a=this.errorCorrectionLevel;if(s.length!=Z.getNumDataCodewords(c,a))throw new RangeError("Invalid argument");const d=Z.NUM_ERROR_CORRECTION_BLOCKS[a.ordinal][c],g=Z.ECC_CODEWORDS_PER_BLOCK[a.ordinal][c],w=Math.floor(Z.getNumRawDataModules(c)/8),m=d-w%d,v=Math.floor(w/d);let p=[];const b=Z.reedSolomonComputeDivisor(g);for(let x=0,N=0;x<d;x++){let C=s.slice(N,N+v-g+(x<m?0:1));N+=C.length;const j=Z.reedSolomonComputeRemainder(C,b);x<m&&C.push(0),p.push(C.concat(j))}let k=[];for(let x=0;x<p[0].length;x++)p.forEach((N,C)=>{(x!=v-g||C>=m)&&k.push(N[x])});return r(k.length==w),k}drawCodewords(s){if(s.length!=Math.floor(Z.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let c=0;for(let a=this.size-1;a>=1;a-=2){a==6&&(a=5);for(let d=0;d<this.size;d++)for(let g=0;g<2;g++){const w=a-g,v=(a+1&2)==0?this.size-1-d:d;!this.isFunction[v][w]&&c<s.length*8&&(this.modules[v][w]=o(s[c>>>3],7-(c&7)),c++)}}r(c==s.length*8)}applyMask(s){if(s<0||s>7)throw new RangeError("Mask value out of range");for(let c=0;c<this.size;c++)for(let a=0;a<this.size;a++){let d;switch(s){case 0:d=(a+c)%2==0;break;case 1:d=c%2==0;break;case 2:d=a%3==0;break;case 3:d=(a+c)%3==0;break;case 4:d=(Math.floor(a/3)+Math.floor(c/2))%2==0;break;case 5:d=a*c%2+a*c%3==0;break;case 6:d=(a*c%2+a*c%3)%2==0;break;case 7:d=((a+c)%2+a*c%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[c][a]&&d&&(this.modules[c][a]=!this.modules[c][a])}}getPenaltyScore(){let s=0;for(let g=0;g<this.size;g++){let w=!1,m=0,v=[0,0,0,0,0,0,0];for(let p=0;p<this.size;p++)this.modules[g][p]==w?(m++,m==5?s+=Z.PENALTY_N1:m>5&&s++):(this.finderPenaltyAddHistory(m,v),w||(s+=this.finderPenaltyCountPatterns(v)*Z.PENALTY_N3),w=this.modules[g][p],m=1);s+=this.finderPenaltyTerminateAndCount(w,m,v)*Z.PENALTY_N3}for(let g=0;g<this.size;g++){let w=!1,m=0,v=[0,0,0,0,0,0,0];for(let p=0;p<this.size;p++)this.modules[p][g]==w?(m++,m==5?s+=Z.PENALTY_N1:m>5&&s++):(this.finderPenaltyAddHistory(m,v),w||(s+=this.finderPenaltyCountPatterns(v)*Z.PENALTY_N3),w=this.modules[p][g],m=1);s+=this.finderPenaltyTerminateAndCount(w,m,v)*Z.PENALTY_N3}for(let g=0;g<this.size-1;g++)for(let w=0;w<this.size-1;w++){const m=this.modules[g][w];m==this.modules[g][w+1]&&m==this.modules[g+1][w]&&m==this.modules[g+1][w+1]&&(s+=Z.PENALTY_N2)}let c=0;for(const g of this.modules)c=g.reduce((w,m)=>w+(m?1:0),c);const a=this.size*this.size,d=Math.ceil(Math.abs(c*20-a*10)/a)-1;return r(0<=d&&d<=9),s+=d*Z.PENALTY_N4,r(0<=s&&s<=2568888),s}getAlignmentPatternPositions(){if(this.version==1)return[];{const s=Math.floor(this.version/7)+2,c=this.version==32?26:Math.ceil((this.version*4+4)/(s*2-2))*2;let a=[6];for(let d=this.size-7;a.length<s;d-=c)a.splice(1,0,d);return a}}static getNumRawDataModules(s){if(s<Z.MIN_VERSION||s>Z.MAX_VERSION)throw new RangeError("Version number out of range");let c=(16*s+128)*s+64;if(s>=2){const a=Math.floor(s/7)+2;c-=(25*a-10)*a-55,s>=7&&(c-=36)}return r(208<=c&&c<=29648),c}static getNumDataCodewords(s,c){return Math.floor(Z.getNumRawDataModules(s)/8)-Z.ECC_CODEWORDS_PER_BLOCK[c.ordinal][s]*Z.NUM_ERROR_CORRECTION_BLOCKS[c.ordinal][s]}static reedSolomonComputeDivisor(s){if(s<1||s>255)throw new RangeError("Degree out of range");let c=[];for(let d=0;d<s-1;d++)c.push(0);c.push(1);let a=1;for(let d=0;d<s;d++){for(let g=0;g<c.length;g++)c[g]=Z.reedSolomonMultiply(c[g],a),g+1<c.length&&(c[g]^=c[g+1]);a=Z.reedSolomonMultiply(a,2)}return c}static reedSolomonComputeRemainder(s,c){let a=c.map(d=>0);for(const d of s){const g=d^a.shift();a.push(0),c.forEach((w,m)=>a[m]^=Z.reedSolomonMultiply(w,g))}return a}static reedSolomonMultiply(s,c){if(s>>>8||c>>>8)throw new RangeError("Byte out of range");let a=0;for(let d=7;d>=0;d--)a=a<<1^(a>>>7)*285,a^=(c>>>d&1)*s;return r(a>>>8==0),a}finderPenaltyCountPatterns(s){const c=s[1];r(c<=this.size*3);const a=c>0&&s[2]==c&&s[3]==c*3&&s[4]==c&&s[5]==c;return(a&&s[0]>=c*4&&s[6]>=c?1:0)+(a&&s[6]>=c*4&&s[0]>=c?1:0)}finderPenaltyTerminateAndCount(s,c,a){return s&&(this.finderPenaltyAddHistory(c,a),c=0),c+=this.size,this.finderPenaltyAddHistory(c,a),this.finderPenaltyCountPatterns(a)}finderPenaltyAddHistory(s,c){c[0]==0&&(s+=this.size),c.pop(),c.unshift(s)}};n.MIN_VERSION=1,n.MAX_VERSION=40,n.PENALTY_N1=3,n.PENALTY_N2=3,n.PENALTY_N3=40,n.PENALTY_N4=10,n.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],n.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=n;function t(f,s,c){if(s<0||s>31||f>>>s)throw new RangeError("Value out of range");for(let a=s-1;a>=0;a--)c.push(f>>>a&1)}function o(f,s){return(f>>>s&1)!=0}function r(f){if(!f)throw new Error("Assertion error")}const i=class te{constructor(s,c,a){if(this.mode=s,this.numChars=c,this.bitData=a,c<0)throw new RangeError("Invalid argument");this.bitData=a.slice()}static makeBytes(s){let c=[];for(const a of s)t(a,8,c);return new te(te.Mode.BYTE,s.length,c)}static makeNumeric(s){if(!te.isNumeric(s))throw new RangeError("String contains non-numeric characters");let c=[];for(let a=0;a<s.length;){const d=Math.min(s.length-a,3);t(parseInt(s.substring(a,a+d),10),d*3+1,c),a+=d}return new te(te.Mode.NUMERIC,s.length,c)}static makeAlphanumeric(s){if(!te.isAlphanumeric(s))throw new RangeError("String contains unencodable characters in alphanumeric mode");let c=[],a;for(a=0;a+2<=s.length;a+=2){let d=te.ALPHANUMERIC_CHARSET.indexOf(s.charAt(a))*45;d+=te.ALPHANUMERIC_CHARSET.indexOf(s.charAt(a+1)),t(d,11,c)}return a<s.length&&t(te.ALPHANUMERIC_CHARSET.indexOf(s.charAt(a)),6,c),new te(te.Mode.ALPHANUMERIC,s.length,c)}static makeSegments(s){return s==""?[]:te.isNumeric(s)?[te.makeNumeric(s)]:te.isAlphanumeric(s)?[te.makeAlphanumeric(s)]:[te.makeBytes(te.toUtf8ByteArray(s))]}static makeEci(s){let c=[];if(s<0)throw new RangeError("ECI assignment value out of range");if(s<128)t(s,8,c);else if(s<16384)t(2,2,c),t(s,14,c);else if(s<1e6)t(6,3,c),t(s,21,c);else throw new RangeError("ECI assignment value out of range");return new te(te.Mode.ECI,0,c)}static isNumeric(s){return te.NUMERIC_REGEX.test(s)}static isAlphanumeric(s){return te.ALPHANUMERIC_REGEX.test(s)}getData(){return this.bitData.slice()}static getTotalBits(s,c){let a=0;for(const d of s){const g=d.mode.numCharCountBits(c);if(d.numChars>=1<<g)return 1/0;a+=4+g+d.bitData.length}return a}static toUtf8ByteArray(s){s=encodeURI(s);let c=[];for(let a=0;a<s.length;a++)s.charAt(a)!="%"?c.push(s.charCodeAt(a)):(c.push(parseInt(s.substring(a+1,a+3),16)),a+=2);return c}};i.NUMERIC_REGEX=/^[0-9]*$/,i.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,i.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let u=i;e.QrSegment=i})(Re||(Re={}));(e=>{(n=>{const t=class{constructor(r,i){this.ordinal=r,this.formatBits=i}};t.LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),n.Ecc=t})(e.QrCode||(e.QrCode={}))})(Re||(Re={}));(e=>{(n=>{const t=class{constructor(r,i){this.modeBits=r,this.numBitsCharCount=i}numCharCountBits(r){return this.numBitsCharCount[Math.floor((r+7)/17)]}};t.NUMERIC=new t(1,[10,12,14]),t.ALPHANUMERIC=new t(2,[9,11,13]),t.BYTE=new t(4,[8,16,16]),t.KANJI=new t(8,[8,10,12]),t.ECI=new t(7,[0,0,0]),n.Mode=t})(e.QrSegment||(e.QrSegment={}))})(Re||(Re={}));var _e=Re;/**
11
10
  * @license qrcode.react
12
11
  * Copyright (c) Paul O'Shannessy
13
12
  * SPDX-License-Identifier: ISC
14
- */var Rr={L:Ve.QrCode.Ecc.LOW,M:Ve.QrCode.Ecc.MEDIUM,Q:Ve.QrCode.Ecc.QUARTILE,H:Ve.QrCode.Ecc.HIGH},vo=128,bo="L",Co="#FFFFFF",ko="#000000",No=!1,So=1,Ir=4,Pr=0,Vr=.1;function jo(e,n=0){const t=[];return e.forEach(function(o,r){let l=null;o.forEach(function(c,g){if(!c&&l!==null){t.push(`M${l+n} ${r+n}h${g-l}v1H${l+n}z`),l=null;return}if(g===o.length-1){if(!c)return;l===null?t.push(`M${g+n},${r+n} h1v1H${g+n}z`):t.push(`M${l+n},${r+n} h${g+1-l}v1H${l+n}z`);return}c&&l===null&&(l=g)})}),t.join("")}function Eo(e,n){return e.slice().map((t,o)=>o<n.y||o>=n.y+n.h?t:t.map((r,l)=>l<n.x||l>=n.x+n.w?r:!1))}function Fr(e,n,t,o){if(o==null)return null;const r=e.length+t*2,l=Math.floor(n*Vr),c=r/n,g=(o.width||l)*c,a=(o.height||l)*c,u=o.x==null?e.length/2-g/2:o.x*c,s=o.y==null?e.length/2-a/2:o.y*c,d=o.opacity==null?1:o.opacity;let f=null;if(o.excavate){let m=Math.floor(u),b=Math.floor(s),p=Math.ceil(g+u-m),S=Math.ceil(a+s-b);f={x:m,y:b,w:p,h:S}}const w=o.crossOrigin;return{x:u,y:s,h:a,w:g,excavation:f,opacity:d,crossOrigin:w}}function Br(e,n){return n!=null?Math.max(Math.floor(n),0):e?Ir:Pr}function Do({value:e,level:n,minVersion:t,includeMargin:o,marginSize:r,imageSettings:l,size:c,boostLevel:g}){let a=h.useMemo(()=>{const m=(Array.isArray(e)?e:[e]).reduce((b,p)=>(b.push(...Ve.QrSegment.makeSegments(p)),b),[]);return Ve.QrCode.encodeSegments(m,Rr[n],t,void 0,void 0,g)},[e,n,t,g]);const{cells:u,margin:s,numCells:d,calculatedImageSettings:f}=h.useMemo(()=>{let w=a.getModules();const m=Br(o,r),b=w.length+m*2,p=Fr(w,c,m,l);return{cells:w,margin:m,numCells:b,calculatedImageSettings:p}},[a,c,l,o,r]);return{qrcode:a,margin:s,cells:u,numCells:d,calculatedImageSettings:f}}var Hr=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),Gr=h.forwardRef(function(n,t){const o=n,{value:r,size:l=vo,level:c=bo,bgColor:g=Co,fgColor:a=ko,includeMargin:u=No,minVersion:s=So,boostLevel:d,marginSize:f,imageSettings:w}=o,b=fn(o,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:p}=b,S=fn(b,["style"]),C=w==null?void 0:w.src,x=h.useRef(null),N=h.useRef(null),v=h.useCallback(K=>{x.current=K,typeof t=="function"?t(K):t&&(t.current=K)},[t]),[E,_]=h.useState(!1),{margin:M,cells:y,numCells:k,calculatedImageSettings:A}=Do({value:r,level:c,minVersion:s,boostLevel:d,includeMargin:u,marginSize:f,imageSettings:w,size:l});h.useEffect(()=>{if(x.current!=null){const K=x.current,T=K.getContext("2d");if(!T)return;let I=y;const H=N.current,B=A!=null&&H!==null&&H.complete&&H.naturalHeight!==0&&H.naturalWidth!==0;B&&A.excavation!=null&&(I=Eo(y,A.excavation));const U=window.devicePixelRatio||1;K.height=K.width=l*U;const Z=l/k*U;T.scale(Z,Z),T.fillStyle=g,T.fillRect(0,0,k,k),T.fillStyle=a,Hr?T.fill(new Path2D(jo(I,M))):y.forEach(function(W,q){W.forEach(function(se,ae){se&&T.fillRect(ae+M,q+M,1,1)})}),A&&(T.globalAlpha=A.opacity),B&&T.drawImage(H,A.x+M,A.y+M,A.w,A.h)}}),h.useEffect(()=>{_(!1)},[C]);const O=hn({height:l,width:l},p);let F=null;return C!=null&&(F=h.createElement("img",{src:C,key:C,style:{display:"none"},onLoad:()=>{_(!0)},ref:N,crossOrigin:A==null?void 0:A.crossOrigin})),h.createElement(h.Fragment,null,h.createElement("canvas",hn({style:O,height:l,width:l,ref:v,role:"img"},S)),F)});Gr.displayName="QRCodeCanvas";var Ao=h.forwardRef(function(n,t){const o=n,{value:r,size:l=vo,level:c=bo,bgColor:g=Co,fgColor:a=ko,includeMargin:u=No,minVersion:s=So,boostLevel:d,title:f,marginSize:w,imageSettings:m}=o,b=fn(o,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:p,cells:S,numCells:C,calculatedImageSettings:x}=Do({value:r,level:c,minVersion:s,boostLevel:d,includeMargin:u,marginSize:w,imageSettings:m,size:l});let N=S,v=null;m!=null&&x!=null&&(x.excavation!=null&&(N=Eo(S,x.excavation)),v=h.createElement("image",{href:m.src,height:x.h,width:x.w,x:x.x+p,y:x.y+p,preserveAspectRatio:"none",opacity:x.opacity,crossOrigin:x.crossOrigin}));const E=jo(N,p);return h.createElement("svg",hn({height:l,width:l,viewBox:`0 0 ${C} ${C}`,ref:t,role:"img"},b),!!f&&h.createElement("title",null,f),h.createElement("path",{fill:g,d:`M0,0 h${C}v${C}H0z`,shapeRendering:"crispEdges"}),h.createElement("path",{fill:a,d:E,shapeRendering:"crispEdges"}),v)});Ao.displayName="QRCodeSVG";const vn="share",Ur="onboarding",zr=(e,n)=>({invitationType:re.InvitationType.LINK,resources:[{url:`conversations/${encodeURI(e)}`},...n]}),Wr=e=>{var t;const n=((t=e==null?void 0:e.invitationLink)==null?void 0:t.split("/").at(-1))||"";return`/${vn}/${n}`},$r=(e,n)=>n==null?void 0:n.find(t=>{var l,c,g,a;const o=(c=(l=e==null?void 0:e.id)==null?void 0:l.split("/"))==null?void 0:c.pop(),r=((a=(g=t==null?void 0:t.url)==null?void 0:g.split("/"))==null?void 0:a.pop())||"";return r===o||decodeURI(r)===o}),Jr=e=>{var t,o;const n=(t=e==null?void 0:e.messages)==null?void 0:t.filter(r=>{var l;return!!((l=r==null?void 0:r.custom_content)!=null&&l.attachments)});return((o=n==null?void 0:n.flatMap(r=>{var l,c;return((c=(l=r==null?void 0:r.custom_content)==null?void 0:l.attachments)==null?void 0:c.map(g=>({url:(g==null?void 0:g.url)||""})))||[]}))==null?void 0:o.filter(r=>!!(r!=null&&r.url)))||[]},Yr=({conversation:e,locale:n,onCloseModal:t,modalDividers:o,getConversation:r,generateConversationLink:l,chatExpiration:c,chatExpirationDays:g,close:a,chatWarning:u,shareLink:s,shareCopyLink:d,shareCopiedLink:f,shareDescription:w,shareRemoveAccessToUsers:m,chatName:b,getSharedConversations:p,revokeSharedConversations:S,baseUrl:C,id:x,clientSharedPage:N,clientSharedProp:v})=>{const[E,_]=h.useState(null),[M,y]=h.useState(),[k,A]=h.useState(!1),[O,F]=h.useState(!1),[K,T]=h.useState(),I=h.useMemo(()=>{var q;const W=C||window.location.origin;if(C&&C!==window.location.origin&&N&&v){const se=(q=E==null?void 0:E.split(`/${vn}/`))==null?void 0:q[1];return`${W}/${N}?${v}=${se}`}return`${W}/${n}${E}`},[C,E,n,N,v]);h.useEffect(()=>{(async()=>{try{const q=decodeURI(e?e==null?void 0:e.id:`${x==null?void 0:x[0]}/${n}/${x==null?void 0:x[1]}`),se=`${decodeURI(q)}`,ae=await(r==null?void 0:r(se)),ce=zr(q,Jr(ae)),ue=await(l==null?void 0:l(ce)),he=await(p==null?void 0:p(re.getSharedConversationsRequest(re.ShareTarget.OTHERS)));ue&&he&&(A(!0),_(Wr(ue)),y($r(e,he==null?void 0:he.resources)))}catch(q){A(!1),console.error("Error sharing conversation",q)}})()},[e,l,r,p,x,n]);const H=h.useCallback(()=>{t(),_(null),A(!1),F(!1)},[t]),B=h.useCallback(()=>{F(!0),navigator.clipboard.writeText(I||"")},[I]),U=async()=>{try{T(!0),M&&await(S==null?void 0:S({resources:[M]}))}catch(W){T(!1),console.error("Error revoking shared conversation",W)}},Z=h.useCallback(()=>i.jsx(j.Button,{buttonClassName:O?"text-button-secondary":"text-button-primary",iconBefore:O?i.jsx(Ee.IconCheck,{width:20,height:20}):i.jsx(Ee.IconCopy,{width:20,height:20}),title:O?f??"Copied":d??"Copy link",disabled:O,onClick:B}),[O,B,f,d]);return i.jsxs(j.Popup,{heading:s??"Share link",portalId:"share",size:j.PopUpSize.SM,dividers:o,onClose:H,closeButtonTitle:a??"Close",children:[k?i.jsxs("div",{className:"share flex flex-col gap-y-4 px-6 pb-6 overflow-auto sm:p-0",children:[e!=null&&e.name?i.jsxs("div",{className:"flex share-info w-full",children:[i.jsx("p",{className:"share-info-title text-neutrals-800 mr-1 body-1",children:b??"Chat name:"}),i.jsx("h3",{className:"flex-1 min-w-0 truncate",title:e==null?void 0:e.name,children:e==null?void 0:e.name})]}):null,i.jsxs("div",{className:"flex share-info",children:[i.jsx("p",{className:"share-info-title text-neutrals-800 mr-1 body-1",children:c??"Link expiration date:"}),i.jsxs("h3",{children:["3 ",g??"days"]})]}),i.jsx(Ao,{className:"self-center border border-neutrals-600 p-2 rounded min-h-[200px]",value:I,size:200}),i.jsx("p",{className:"body-2 text-neutrals-1000",children:w??"Your name, special instructions, and any messages you add after sharing remain confidential."}),i.jsx(j.InputWithIcon,{containerClasses:"share-input-container",cssClass:"share-input",readonly:!0,placeholder:I,value:I,inputId:"conversationLink",iconAfterInput:Z()})]}):i.jsx("div",{className:"flex justify-center items-center py-6 px-6",children:i.jsx(j.Loader,{})}),k?e&&M?i.jsx("div",{className:"remove-access",children:i.jsx(j.Button,{title:m??"Remove access to all users",buttonClassName:"remove-access-button py-3 px-4",isSmallButton:!0,disabled:K,onClick:U})}):i.jsx("p",{className:"body-2 text-neutrals-800 share-footer",children:u??"This chat has not been shared with anyone yet."}):i.jsx("div",{})]})},yo=({shareButtonClass:e,shareIcon:n,...t})=>{const[o,r]=h.useState(j.PopUpState.Closed),l=()=>{r(j.PopUpState.Opened)},c=h.useCallback(()=>{r(j.PopUpState.Closed)},[]);return i.jsxs(i.Fragment,{children:[i.jsx(j.Button,{buttonClassName:e||"text-button-secondary",title:(t==null?void 0:t.share)||"Share",iconBefore:n,onClick:l}),o===j.PopUpState.Opened&&i.jsx(Yr,{onCloseModal:c,...t})]})},Mo=({conversation:e,locale:n,isOpenedAdvancedView:t,isShowShareButton:o,isShowUserInfo:r,userInfo:l,signOutTitle:c,shareConversationProps:g,signOutAction:a})=>i.jsx(i.Fragment,{children:i.jsxs("header",{className:V("bg-white border-b px-6 py-2 border-gray-200 flex justify-between items-center sm:hidden","conversation-view-header"),children:[i.jsx("span",{className:V("flex-1 min-w-0 truncate h4","conversation-view-header-text"),title:e==null?void 0:e.name,children:e==null?void 0:e.name}),i.jsxs("div",{className:"flex gap-4",children:[!t&&o&&i.jsx("div",{className:"flex gap-x-2",children:i.jsx(yo,{conversation:e,locale:n,...g})}),r&&i.jsx(mo,{userInfo:l||null,signOutAction:a,title:c})]})]})}),To=({content:e,textColorClass:n})=>{const{isOpenedAdvancedView:t}=_e();return i.jsx("div",{className:V("prose max-w-none break-words",t?"body-2":"body-1",n),children:i.jsx(lo,{remarkPlugins:[ao],components:{strong:o=>i.jsx("strong",{className:n,...o}),a:({href:o,children:r,...l})=>i.jsx("a",{href:o,target:"_blank",...l,children:r})},children:e})})},Oo=({choiceButtons:e,onClick:n})=>e.map(t=>{var o;return i.jsx("div",{className:"mt-4",children:i.jsxs("button",{type:"button",className:"flex flex-col items-start justify-center text-left w-full rounded border-hues-200 hover:bg-hues-100 min-h-[72px] border px-4 py-2",onClick:()=>{var r;return n((r=t[de.DialSchemaProperties.DialWidgetOptions])==null?void 0:r.populateText,t==null?void 0:t.const)},"aria-label":"button",children:[i.jsx("h3",{className:"mb-1",children:t.title}),t.const!==on.COMPLETE&&i.jsx("p",{className:"body-1 text-neutrals-800",children:(o=t[de.DialSchemaProperties.DialWidgetOptions])==null?void 0:o.populateText})]})},t.title)}),Kr=({titles:e,messageContent:n,choiceButtons:t,onClick:o,handleOnboardingSkip:r})=>i.jsxs("div",{className:"onboarding w-full h-full flex flex-col flex-1 overflow-auto",children:[i.jsx(Mo,{conversation:{name:(e==null?void 0:e.onboardingTitle)??"Introducing the AI assistant"}}),i.jsxs("div",{className:"onboarding-content flex flex-col",children:[i.jsx(To,{content:n}),i.jsx("div",{className:"mt-4",children:i.jsx(Oo,{choiceButtons:t,onClick:o})}),i.jsxs("div",{className:"flex mt-8",children:[i.jsx(j.Button,{title:e==null?void 0:e.skipOnboardingNow,buttonClassName:"text-button-secondary mr-4",onClick:()=>r==null?void 0:r(),isSmallButton:!0}),i.jsx(j.Button,{title:e==null?void 0:e.refuseOnboarding,buttonClassName:"text-button-tertiary",onClick:()=>r==null?void 0:r(!0),isSmallButton:!0})]})]})]}),Lo=({titles:e,openNewConversation:n})=>i.jsxs("div",{className:"text-center bg-accent-300 body-3 p-2",children:[i.jsx("span",{className:"mr-2 text-neutrals-900",children:e==null?void 0:e.onboardingFooter}),i.jsxs("span",{onClick:n,className:"cursor-pointer inline-flex align-top",children:[i.jsx(Ee.IconPlus,{width:15,height:15}),i.jsx("p",{className:"ml-1",children:e==null?void 0:e.onboardingFooterLink})]})]}),_o=({firstLine:e,secondLine:n})=>{const t=e!=null&&e.trim()!=="",o=n!=null&&n.trim()!=="";return i.jsxs("div",{className:V("text-center body-3",o?"p-0":t?"p-1":"p-3"),children:[t&&i.jsx("div",{className:"text-neutrals-800",children:e}),o&&i.jsx("div",{className:"text-neutrals-800",children:n})]})},Zr=({suggestionsList:e,welcomeText:n,titleIcon:t,actions:o,titles:r,inputMessageStyles:l,isBottomInputPosition:c,prompt:g,onboardingMessageSchema:a,handleConversationClick:u,setConversations:s,locale:d,setSharedConversations:f,userInfo:w,signOutAction:m})=>{var A,O,F,K;const[b,p]=h.useState(null),[S,C]=h.useState(),{onboardingFileSchema:x,onboardingFileName:N,onboardingFilePath:v,isShowOnboarding:E,setIsShowOnboarding:_,setOnboardingFileSchema:M}=me();h.useEffect(()=>{(async()=>{try{const I=await o.getBucket();p(I.bucket)}catch(I){console.error(I instanceof Error?I.message:"Request error")}})()},[o]);const y=h.useCallback(async(T,I)=>{var H,B,U;C(!0),b||console.error("No bucket");try{const Z=E?Or(b||"",d,(r==null?void 0:r.onboardingTitle)??"Introducing the AI assistant",((B=(H=a==null?void 0:a.properties)==null?void 0:H.choice)==null?void 0:B.description)??"",T,I):Mr(b||"",d,r.newChat??"New chat",T),W=await o.createConversation(Z,d,E),q=await o.getConversations(d),se=await o.getSharedConversations(re.getSharedConversationsRequest(re.ShareTarget.ME));if(a&&x){const ae={...x,isStarted:!0};await((U=o.putOnboardingFile)==null?void 0:U.call(o,N,v,ae)),M==null||M(ae)}s(ee.cleanConversationNames(q)),f(ee.cleanConversationNames(kr.transformSharedConversations(se,d))),u(W.folderId,W.id)}catch(Z){console.error(Z instanceof Error?Z.message:"Creation conversation failed"),C(!1)}},[o,b,u,E,d,N,v,x,a,s,M,f,r.newChat,r==null?void 0:r.onboardingTitle]),k=h.useCallback(async T=>{var I;if(_(!1),T&&x){const H={...x,isSkipped:!0};await((I=o.putOnboardingFile)==null?void 0:I.call(o,N,v,H)),M==null||M(H)}},[o,N,v,x,_,M]);return h.useEffect(()=>{g&&b&&y(g)},[b,g]),i.jsxs("div",{className:"flex flex-col h-full w-full",children:[g||S?i.jsx(j.Loader,{}):E?i.jsx(Kr,{titles:r,messageContent:((O=(A=a==null?void 0:a.properties)==null?void 0:A.choice)==null?void 0:O.description)||"",choiceButtons:((K=(F=a==null?void 0:a.properties)==null?void 0:F.choice)==null?void 0:K.oneOf)||[],handleOnboardingSkip:k,onClick:y}):i.jsxs("div",{className:"flex flex-col h-full items-center justify-center sm:px-4",children:[w&&i.jsx("div",{className:"absolute top-4 right-4",children:i.jsx(mo,{userInfo:w,signOutAction:m,title:r==null?void 0:r.signOut})}),i.jsxs("div",{className:V("flex items-center max-w-full sm-min:px-4",c?"mt-auto mb-8":"mb-6"),children:[t,i.jsx("h1",{className:"text-hues-800 text-center sm:h2",children:n??(r==null?void 0:r.welcomeTitle)??"How can I help you?"})]}),i.jsx(wo,{containerClasses:V(l.inputContainerClass,c&&"order-3 mt-auto"),inputClasses:"mr-2",placeholder:(r==null?void 0:r.askAnything)??"Ask anything...",sendMessageIcon:l.sendMessageIcon,onSendMessage:y}),i.jsx("div",{className:"max-w-full overflow-x-auto no-scrollbar",children:i.jsx("div",{className:V("flex flex-wrap justify-center gap-2 sm:flex-nowrap","tags-container"),children:e.map(T=>{var I;return i.jsx(j.Tag,{title:T.title,text:(I=T[de.DialSchemaProperties.DialWidgetOptions])==null?void 0:I.populateText,onClick:y},T.title)})})})]}),E&&i.jsx(Lo,{titles:r,openNewConversation:()=>_(!1)}),!E&&i.jsx(_o,{firstLine:r.footerFirstLine,secondLine:r.footerSecondLine})]})},bn=e=>X.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},X.createElement("path",{d:"M11.3301 6.25L8.00008 9.75L4.67008 6.25L11.3301 6.25Z",fill:"currentColor"})),qr=e=>X.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},X.createElement("path",{d:"M8.00016 1.33325C4.3135 1.33325 1.3335 4.31325 1.3335 7.99992C1.3335 11.6866 4.3135 14.6666 8.00016 14.6666C11.6868 14.6666 14.6668 11.6866 14.6668 7.99992C14.6668 4.31325 11.6868 1.33325 8.00016 1.33325ZM8.00016 13.3333C5.06016 13.3333 2.66683 10.9399 2.66683 7.99992C2.66683 5.05992 5.06016 2.66659 8.00016 2.66659C10.9402 2.66659 13.3335 5.05992 13.3335 7.99992C13.3335 10.9399 10.9402 13.3333 8.00016 13.3333ZM10.3935 4.66659L8.00016 7.05992L5.60683 4.66659L4.66683 5.60659L7.06016 7.99992L4.66683 10.3933L5.60683 11.3333L8.00016 8.93992L10.3935 11.3333L11.3335 10.3933L8.94016 7.99992L11.3335 5.60659L10.3935 4.66659Z",fill:"currentColor"})),Xr=e=>X.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},X.createElement("path",{d:"M12.8232 7C12.926 7 13.012 7.07201 13.0244 7.16797L13.1807 8.22754C13.4315 8.32754 13.6621 8.46012 13.876 8.62012L14.9004 8.21973C14.9208 8.21186 14.9453 8.20803 14.9697 8.20801C15.0436 8.20801 15.1133 8.24392 15.1504 8.30762L15.9736 9.69238C16.0227 9.7803 16.0018 9.88834 15.9238 9.94824L15.0566 10.6084C15.0731 10.7363 15.085 10.8642 15.085 11C15.085 11.1358 15.0731 11.2637 15.0566 11.3916L15.9238 12.0518C16.0018 12.1117 16.0227 12.2197 15.9736 12.3076L15.1504 13.6924C15.1133 13.7561 15.0434 13.792 14.9736 13.792C14.9492 13.7919 14.9248 13.7881 14.9004 13.7803L13.876 13.3799C13.6621 13.5359 13.4315 13.6725 13.1807 13.7725L13.0244 14.832C13.012 14.928 12.926 15 12.8232 15H11.1787C11.0759 15 10.9889 14.928 10.9766 14.832L10.8203 13.7725C10.5696 13.6725 10.3397 13.5398 10.126 13.3799L9.10156 13.7803C9.08115 13.7882 9.05667 13.792 9.03223 13.792C8.95826 13.792 8.88761 13.7563 8.85059 13.6924L8.02832 12.3076C7.97924 12.2197 8.0001 12.1117 8.07812 12.0518L8.94531 11.3916C8.92889 11.2637 8.91699 11.1319 8.91699 11C8.91699 10.8681 8.92889 10.7363 8.94531 10.6084L8.07812 9.94824C8.0001 9.88832 7.97515 9.78032 8.02832 9.69238L8.85059 8.30762C8.88754 8.24383 8.95763 8.20816 9.02734 8.20801C9.05192 8.20801 9.07699 8.21179 9.10156 8.21973L10.126 8.62012C10.3397 8.46418 10.5696 8.32752 10.8203 8.22754L10.9766 7.16797C10.9889 7.07197 11.0759 7 11.1787 7H12.8232ZM11.7129 7.7998L11.6309 8.33984L11.5654 8.79199L11.1289 8.96387C10.9604 9.03184 10.792 9.12795 10.6152 9.25586L10.2451 9.52832L9.81738 9.36035L9.29492 9.15625L9.00684 9.63965L9.45117 9.97559L9.81738 10.2559L9.75977 10.708C9.74743 10.828 9.73926 10.92 9.73926 11C9.73926 11.08 9.74743 11.1719 9.75977 11.2959L9.81738 11.748L9.45117 12.0283L9.00684 12.3643L9.29492 12.8477L9.81738 12.6436L10.2529 12.4717L10.627 12.752C10.7913 12.8719 10.9561 12.9642 11.1328 13.0361L11.5693 13.208L11.6348 13.6602L11.7129 14.2002H12.2891L12.3711 13.6602L12.4365 13.208L12.873 13.0361C13.0415 12.9681 13.21 12.8721 13.3867 12.7441L13.7568 12.4717L14.1846 12.6396L14.707 12.8438L14.9941 12.3604L14.5508 12.0244L14.1846 11.7441L14.2422 11.292C14.2545 11.172 14.2627 11.084 14.2627 11C14.2627 10.916 14.2586 10.832 14.2422 10.708L14.1846 10.2559L14.5508 9.97559L14.9902 9.63574L14.7021 9.15234L14.1807 9.35645L13.7441 9.52832L13.3701 9.24805C13.2057 9.12808 13.0411 9.03586 12.8643 8.96387L12.4287 8.79199L12.3623 8.33984L12.2842 7.7998H11.7129ZM3.33301 12.6338H2V11.3008H3.33301V12.6338ZM7.00977 11.3008C7.03732 11.7651 7.12864 12.2121 7.27441 12.6338H4.66699V11.3008H7.00977ZM12.001 9.40039C12.9097 9.40043 13.6455 10.116 13.6455 11C13.6455 11.884 12.9097 12.5996 12.001 12.5996C11.0922 12.5996 10.3564 11.884 10.3564 11C10.3564 10.116 11.0922 9.40039 12.001 9.40039ZM12.001 10.2002C11.5486 10.2002 11.1787 10.56 11.1787 11C11.1787 11.44 11.5486 11.7998 12.001 11.7998C12.4533 11.7998 12.8232 11.44 12.8232 11C12.8232 10.56 12.4533 10.2002 12.001 10.2002ZM3.33301 8.63379H2V7.30078H3.33301V8.63379ZM8.63574 7.30078C8.21765 7.68124 7.86483 8.13197 7.59473 8.63379H4.66699V7.30078H8.63574ZM3.33301 4.7334H2V3.40039H3.33301V4.7334ZM14 4.7334H4.66699V3.40039H14V4.7334Z",fill:"currentColor"}));function Ro(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ue={exports:{}},Qr=Ue.exports,Vt;function ei(){return Vt||(Vt=1,(function(e,n){(function(t,o){o(n)})(Qr,(function(t){/*! *****************************************************************************
13
+ */var _r={L:_e.QrCode.Ecc.LOW,M:_e.QrCode.Ecc.MEDIUM,Q:_e.QrCode.Ecc.QUARTILE,H:_e.QrCode.Ecc.HIGH},po=128,xo="L",vo="#FFFFFF",bo="#000000",Co=!1,ko=1,Ir=4,Pr=0,Vr=.1;function So(e,n=0){const t=[];return e.forEach(function(o,r){let i=null;o.forEach(function(u,f){if(!u&&i!==null){t.push(`M${i+n} ${r+n}h${f-i}v1H${i+n}z`),i=null;return}if(f===o.length-1){if(!u)return;i===null?t.push(`M${f+n},${r+n} h1v1H${f+n}z`):t.push(`M${i+n},${r+n} h${f+1-i}v1H${i+n}z`);return}u&&i===null&&(i=f)})}),t.join("")}function No(e,n){return e.slice().map((t,o)=>o<n.y||o>=n.y+n.h?t:t.map((r,i)=>i<n.x||i>=n.x+n.w?r:!1))}function Fr(e,n,t,o){if(o==null)return null;const r=e.length+t*2,i=Math.floor(n*Vr),u=r/n,f=(o.width||i)*u,s=(o.height||i)*u,c=o.x==null?e.length/2-f/2:o.x*u,a=o.y==null?e.length/2-s/2:o.y*u,d=o.opacity==null?1:o.opacity;let g=null;if(o.excavate){let m=Math.floor(c),v=Math.floor(a),p=Math.ceil(f+c-m),b=Math.ceil(s+a-v);g={x:m,y:v,w:p,h:b}}const w=o.crossOrigin;return{x:c,y:a,h:s,w:f,excavation:g,opacity:d,crossOrigin:w}}function Br(e,n){return n!=null?Math.max(Math.floor(n),0):e?Ir:Pr}function jo({value:e,level:n,minVersion:t,includeMargin:o,marginSize:r,imageSettings:i,size:u,boostLevel:f}){let s=h.useMemo(()=>{const m=(Array.isArray(e)?e:[e]).reduce((v,p)=>(v.push(..._e.QrSegment.makeSegments(p)),v),[]);return _e.QrCode.encodeSegments(m,_r[n],t,void 0,void 0,f)},[e,n,t,f]);const{cells:c,margin:a,numCells:d,calculatedImageSettings:g}=h.useMemo(()=>{let w=s.getModules();const m=Br(o,r),v=w.length+m*2,p=Fr(w,u,m,i);return{cells:w,margin:m,numCells:v,calculatedImageSettings:p}},[s,u,i,o,r]);return{qrcode:s,margin:a,cells:c,numCells:d,calculatedImageSettings:g}}var Hr=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),Gr=h.forwardRef(function(n,t){const o=n,{value:r,size:i=po,level:u=xo,bgColor:f=vo,fgColor:s=bo,includeMargin:c=Co,minVersion:a=ko,boostLevel:d,marginSize:g,imageSettings:w}=o,v=dn(o,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:p}=v,b=dn(v,["style"]),k=w==null?void 0:w.src,x=h.useRef(null),N=h.useRef(null),C=h.useCallback(W=>{x.current=W,typeof t=="function"?t(W):t&&(t.current=W)},[t]),[j,R]=h.useState(!1),{margin:M,cells:L,numCells:S,calculatedImageSettings:D}=jo({value:r,level:u,minVersion:a,boostLevel:d,includeMargin:c,marginSize:g,imageSettings:w,size:i});h.useEffect(()=>{if(x.current!=null){const W=x.current,F=W.getContext("2d");if(!F)return;let _=L;const G=N.current,H=D!=null&&G!==null&&G.complete&&G.naturalHeight!==0&&G.naturalWidth!==0;H&&D.excavation!=null&&(_=No(L,D.excavation));const U=window.devicePixelRatio||1;W.height=W.width=i*U;const Y=i/S*U;F.scale(Y,Y),F.fillStyle=f,F.fillRect(0,0,S,S),F.fillStyle=s,Hr?F.fill(new Path2D(So(_,M))):L.forEach(function(J,K){J.forEach(function(re,ce){re&&F.fillRect(ce+M,K+M,1,1)})}),D&&(F.globalAlpha=D.opacity),H&&F.drawImage(G,D.x+M,D.y+M,D.w,D.h)}}),h.useEffect(()=>{R(!1)},[k]);const O=un({height:i,width:i},p);let B=null;return k!=null&&(B=h.createElement("img",{src:k,key:k,style:{display:"none"},onLoad:()=>{R(!0)},ref:N,crossOrigin:D==null?void 0:D.crossOrigin})),h.createElement(h.Fragment,null,h.createElement("canvas",un({style:O,height:i,width:i,ref:C,role:"img"},b)),B)});Gr.displayName="QRCodeCanvas";var Eo=h.forwardRef(function(n,t){const o=n,{value:r,size:i=po,level:u=xo,bgColor:f=vo,fgColor:s=bo,includeMargin:c=Co,minVersion:a=ko,boostLevel:d,title:g,marginSize:w,imageSettings:m}=o,v=dn(o,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:p,cells:b,numCells:k,calculatedImageSettings:x}=jo({value:r,level:u,minVersion:a,boostLevel:d,includeMargin:c,marginSize:w,imageSettings:m,size:i});let N=b,C=null;m!=null&&x!=null&&(x.excavation!=null&&(N=No(b,x.excavation)),C=h.createElement("image",{href:m.src,height:x.h,width:x.w,x:x.x+p,y:x.y+p,preserveAspectRatio:"none",opacity:x.opacity,crossOrigin:x.crossOrigin}));const j=So(N,p);return h.createElement("svg",un({height:i,width:i,viewBox:`0 0 ${k} ${k}`,ref:t,role:"img"},v),!!g&&h.createElement("title",null,g),h.createElement("path",{fill:f,d:`M0,0 h${k}v${k}H0z`,shapeRendering:"crispEdges"}),h.createElement("path",{fill:s,d:j,shapeRendering:"crispEdges"}),C)});Eo.displayName="QRCodeSVG";const zr=(e,n)=>({invitationType:ne.InvitationType.LINK,resources:[{url:`conversations/${encodeURI(e)}`},...n]}),Wr=e=>{var t;const n=((t=e==null?void 0:e.invitationLink)==null?void 0:t.split("/").at(-1))||"";return`/${q.SHARE_CONVERSATION_ROUTE}/${n}`},Ur=(e,n)=>n==null?void 0:n.find(t=>{var i,u,f,s;const o=(u=(i=e==null?void 0:e.id)==null?void 0:i.split("/"))==null?void 0:u.pop(),r=((s=(f=t==null?void 0:t.url)==null?void 0:f.split("/"))==null?void 0:s.pop())||"";return r===o||decodeURI(r)===o}),$r=e=>{var t,o;const n=(t=e==null?void 0:e.messages)==null?void 0:t.filter(r=>{var i;return!!((i=r==null?void 0:r.custom_content)!=null&&i.attachments)});return((o=n==null?void 0:n.flatMap(r=>{var i,u;return((u=(i=r==null?void 0:r.custom_content)==null?void 0:i.attachments)==null?void 0:u.map(f=>({url:(f==null?void 0:f.url)||""})))||[]}))==null?void 0:o.filter(r=>!!(r!=null&&r.url)))||[]},Jr=({conversation:e,locale:n,onCloseModal:t,modalDividers:o,getConversation:r,generateConversationLink:i,chatExpiration:u,chatExpirationDays:f,close:s,chatWarning:c,shareLink:a,shareCopyLink:d,shareCopiedLink:g,shareDescription:w,shareRemoveAccessToUsers:m,chatName:v,getSharedConversations:p,revokeSharedConversations:b,baseUrl:k,id:x,clientSharedPage:N,clientSharedProp:C})=>{const[j,R]=h.useState(null),[M,L]=h.useState(),[S,D]=h.useState(!1),[O,B]=h.useState(!1),[W,F]=h.useState(),_=h.useMemo(()=>{var K;const J=k||window.location.origin;if(k&&k!==window.location.origin&&N&&C){const re=(K=j==null?void 0:j.split(`/${q.SHARE_CONVERSATION_ROUTE}/`))==null?void 0:K[1];return`${J}/${N}?${C}=${re}`}return`${J}/${n}${j}`},[k,j,n,N,C]);h.useEffect(()=>{(async()=>{try{const K=decodeURI(e?e==null?void 0:e.id:`${x==null?void 0:x[0]}/${n}/${x==null?void 0:x[1]}`),re=`${decodeURI(K)}`,ce=await(r==null?void 0:r(re)),ae=zr(K,$r(ce)),de=await(i==null?void 0:i(ae)),le=await(p==null?void 0:p(ne.getSharedConversationsRequest(ne.ShareTarget.OTHERS)));de&&le&&(D(!0),R(Wr(de)),L(Ur(e,le==null?void 0:le.resources)))}catch(K){D(!1),console.error("Error sharing conversation",K)}})()},[e,i,r,p,x,n]);const G=h.useCallback(()=>{t(),R(null),D(!1),B(!1)},[t]),H=h.useCallback(()=>{B(!0),navigator.clipboard.writeText(_||"")},[_]),U=async()=>{try{F(!0),M&&await(b==null?void 0:b({resources:[M]}))}catch(J){F(!1),console.error("Error revoking shared conversation",J)}},Y=h.useCallback(()=>l.jsx(E.Button,{buttonClassName:O?"text-button-secondary":"text-button-primary",iconBefore:O?l.jsx(De.IconCheck,{width:20,height:20}):l.jsx(De.IconCopy,{width:20,height:20}),title:O?g??"Copied":d??"Copy link",disabled:O,onClick:H}),[O,H,g,d]);return l.jsxs(E.Popup,{heading:a??"Share link",portalId:"share",size:E.PopUpSize.SM,dividers:o,onClose:G,closeButtonTitle:s??"Close",children:[S?l.jsxs("div",{className:"share flex flex-col gap-y-4 px-6 pb-6 overflow-auto sm:p-0",children:[e!=null&&e.name?l.jsxs("div",{className:"flex share-info w-full",children:[l.jsx("p",{className:"share-info-title text-neutrals-800 mr-1 body-1",children:v??"Chat name:"}),l.jsx("h3",{className:"flex-1 min-w-0 truncate",title:e==null?void 0:e.name,children:e==null?void 0:e.name})]}):null,l.jsxs("div",{className:"flex share-info",children:[l.jsx("p",{className:"share-info-title text-neutrals-800 mr-1 body-1",children:u??"Link expiration date:"}),l.jsxs("h3",{children:["3 ",f??"days"]})]}),l.jsx(Eo,{className:"self-center border border-neutrals-600 p-2 rounded min-h-[200px]",value:_,size:200}),l.jsx("p",{className:"body-2 text-neutrals-1000",children:w??"Your name, special instructions, and any messages you add after sharing remain confidential."}),l.jsx(E.InputWithIcon,{containerClasses:"share-input-container",cssClass:"share-input",readonly:!0,placeholder:_,value:_,inputId:"conversationLink",iconAfterInput:Y()})]}):l.jsx("div",{className:"flex justify-center items-center py-6 px-6",children:l.jsx(E.Loader,{})}),S?e&&M?l.jsx("div",{className:"remove-access",children:l.jsx(E.Button,{title:m??"Remove access to all users",buttonClassName:"remove-access-button py-3 px-4",isSmallButton:!0,disabled:W,onClick:U})}):l.jsx("p",{className:"body-2 text-neutrals-800 share-footer",children:c??"This chat has not been shared with anyone yet."}):l.jsx("div",{})]})},Do=({shareButtonClass:e,shareIcon:n,...t})=>{const[o,r]=h.useState(E.PopUpState.Closed),i=()=>{r(E.PopUpState.Opened)},u=h.useCallback(()=>{r(E.PopUpState.Closed)},[]);return l.jsxs(l.Fragment,{children:[l.jsx(E.Button,{buttonClassName:e||"text-button-secondary",title:(t==null?void 0:t.share)||"Share",iconBefore:n,onClick:i}),o===E.PopUpState.Opened&&l.jsx(Jr,{onCloseModal:u,...t})]})},Ao=({conversation:e,locale:n,isOpenedAdvancedView:t,isShowShareButton:o,shareConversationProps:r})=>l.jsx(l.Fragment,{children:l.jsxs("header",{className:V("bg-white border-b px-6 py-2 border-gray-200 flex justify-between items-center sm:hidden","conversation-view-header"),children:[l.jsx("span",{className:V("flex-1 min-w-0 truncate h4","conversation-view-header-text"),title:e==null?void 0:e.name,children:e==null?void 0:e.name}),l.jsx("div",{className:"flex gap-4",children:!t&&o&&l.jsx("div",{className:"flex gap-x-2",children:l.jsx(Do,{conversation:e,locale:n,...r})})})]})}),yo=({content:e,textColorClass:n})=>{const{isOpenedAdvancedView:t}=Me();return l.jsx("div",{className:V("prose max-w-none break-words",t?"body-2":"body-1",n),children:l.jsx(io,{remarkPlugins:[lo],components:{strong:o=>l.jsx("strong",{className:n,...o}),a:({href:o,children:r,...i})=>l.jsx("a",{href:o,target:"_blank",...i,children:r})},children:e})})},To=({choiceButtons:e,onClick:n})=>e.map(t=>{var o;return l.jsx("div",{className:"mt-4",children:l.jsxs("button",{type:"button",className:"flex flex-col items-start justify-center text-left w-full rounded border-hues-200 hover:bg-hues-100 min-h-[72px] border px-4 py-2",onClick:()=>{var r;return n((r=t[se.DialSchemaProperties.DialWidgetOptions])==null?void 0:r.populateText,t==null?void 0:t.const)},"aria-label":"button",children:[l.jsx("h3",{className:"mb-1",children:t.title}),t.const!==nn.COMPLETE&&l.jsx("p",{className:"body-1 text-neutrals-800",children:(o=t[se.DialSchemaProperties.DialWidgetOptions])==null?void 0:o.populateText})]})},t.title)}),Yr=({titles:e,messageContent:n,choiceButtons:t,onClick:o,handleOnboardingSkip:r})=>l.jsxs("div",{className:"onboarding w-full h-full flex flex-col flex-1 overflow-auto",children:[l.jsx(Ao,{conversation:{name:(e==null?void 0:e.onboardingTitle)??"Introducing the AI assistant"}}),l.jsxs("div",{className:"onboarding-content flex flex-col",children:[l.jsx(yo,{content:n}),l.jsx("div",{className:"mt-4",children:l.jsx(To,{choiceButtons:t,onClick:o})}),l.jsxs("div",{className:"flex mt-8",children:[l.jsx(E.Button,{title:e==null?void 0:e.skipOnboardingNow,buttonClassName:"text-button-secondary mr-4",onClick:()=>r==null?void 0:r(),isSmallButton:!0}),l.jsx(E.Button,{title:e==null?void 0:e.refuseOnboarding,buttonClassName:"text-button-tertiary",onClick:()=>r==null?void 0:r(!0),isSmallButton:!0})]})]})]}),Mo=({titles:e,openNewConversation:n})=>l.jsxs("div",{className:"text-center bg-accent-300 body-3 p-2",children:[l.jsx("span",{className:"mr-2 text-neutrals-900",children:e==null?void 0:e.onboardingFooter}),l.jsxs("span",{onClick:n,className:"cursor-pointer inline-flex align-top",children:[l.jsx(De.IconPlus,{width:15,height:15}),l.jsx("p",{className:"ml-1",children:e==null?void 0:e.onboardingFooterLink})]})]}),Oo=({firstLine:e,secondLine:n})=>{const t=e!=null&&e.trim()!=="",o=n!=null&&n.trim()!=="";return l.jsxs("div",{className:V("text-center body-3",o?"p-0":t?"p-1":"p-3"),children:[t&&l.jsx("div",{className:"text-neutrals-800",children:e}),o&&l.jsx("div",{className:"text-neutrals-800",children:n})]})},Kr=({suggestionsList:e,welcomeText:n,titleIcon:t,actions:o,titles:r,inputMessageStyles:i,isBottomInputPosition:u,prompt:f,onboardingMessageSchema:s,handleConversationClick:c,setConversations:a,locale:d,setSharedConversations:g})=>{var L,S,D,O;const[w,m]=h.useState(null),[v,p]=h.useState(),{onboardingFileSchema:b,onboardingFileName:k,onboardingFilePath:x,isShowOnboarding:N,setIsShowOnboarding:C,setOnboardingFileSchema:j}=we();h.useEffect(()=>{(async()=>{try{const W=await o.getBucket();m(W.bucket)}catch(W){console.error(W instanceof Error?W.message:"Request error")}})()},[o]);const R=h.useCallback(async(B,W)=>{var F,_,G;p(!0),w||console.error("No bucket");try{const H=N?Lr(w||"",d,(r==null?void 0:r.onboardingTitle)??"Introducing the AI assistant",((_=(F=s==null?void 0:s.properties)==null?void 0:F.choice)==null?void 0:_.description)??"",B,W):Mr(w||"",d,r.newChat??"New chat",B),U=await o.createConversation(H,d,N),Y=await o.getConversations(d),J=await o.getSharedConversations(ne.getSharedConversationsRequest(ne.ShareTarget.ME));if(s&&b){const K={...b,isStarted:!0};await((G=o.putOnboardingFile)==null?void 0:G.call(o,k,x,K)),j==null||j(K)}a(q.cleanConversationNames(Y)),g(q.cleanConversationNames(kr.transformSharedConversations(J,d))),c(U.folderId,U.id)}catch(H){console.error(H instanceof Error?H.message:"Creation conversation failed"),p(!1)}},[o,w,c,N,d,k,x,b,s,a,j,g,r.newChat,r==null?void 0:r.onboardingTitle]),M=h.useCallback(async B=>{var W;if(C(!1),B&&b){const F={...b,isSkipped:!0};await((W=o.putOnboardingFile)==null?void 0:W.call(o,k,x,F)),j==null||j(F)}},[o,k,x,b,C,j]);return h.useEffect(()=>{f&&w&&R(f)},[w,f]),l.jsxs("div",{className:"flex flex-col h-full w-full",children:[f||v?l.jsx(E.Loader,{}):N?l.jsx(Yr,{titles:r,messageContent:((S=(L=s==null?void 0:s.properties)==null?void 0:L.choice)==null?void 0:S.description)||"",choiceButtons:((O=(D=s==null?void 0:s.properties)==null?void 0:D.choice)==null?void 0:O.oneOf)||[],handleOnboardingSkip:M,onClick:R}):l.jsxs("div",{className:"flex flex-col h-full items-center justify-center sm:px-4",children:[l.jsxs("div",{className:V("flex items-center max-w-full sm-min:px-4",u?"mt-auto mb-8":"mb-6"),children:[t,l.jsx("h1",{className:"text-hues-800 text-center sm:h2",children:n??(r==null?void 0:r.welcomeTitle)??"How can I help you?"})]}),l.jsx(go,{containerClasses:V(i.inputContainerClass,u&&"order-3 mt-auto"),inputClasses:"mr-2",placeholder:(r==null?void 0:r.askAnything)??"Ask anything...",sendMessageIcon:i.sendMessageIcon,onSendMessage:R}),l.jsx("div",{className:"max-w-full overflow-x-auto no-scrollbar",children:l.jsx("div",{className:V("flex flex-wrap justify-center gap-2 sm:flex-nowrap","tags-container"),children:e.map(B=>{var W;return l.jsx(E.Tag,{title:B.title,text:(W=B[se.DialSchemaProperties.DialWidgetOptions])==null?void 0:W.populateText,onClick:R},B.title)})})})]}),N&&l.jsx(Mo,{titles:r,openNewConversation:()=>C(!1)}),!N&&l.jsx(Oo,{firstLine:r.footerFirstLine,secondLine:r.footerSecondLine})]})},mn=e=>ee.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},ee.createElement("path",{d:"M11.3301 6.25L8.00008 9.75L4.67008 6.25L11.3301 6.25Z",fill:"currentColor"})),Zr=e=>ee.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},ee.createElement("path",{d:"M8.00016 1.33325C4.3135 1.33325 1.3335 4.31325 1.3335 7.99992C1.3335 11.6866 4.3135 14.6666 8.00016 14.6666C11.6868 14.6666 14.6668 11.6866 14.6668 7.99992C14.6668 4.31325 11.6868 1.33325 8.00016 1.33325ZM8.00016 13.3333C5.06016 13.3333 2.66683 10.9399 2.66683 7.99992C2.66683 5.05992 5.06016 2.66659 8.00016 2.66659C10.9402 2.66659 13.3335 5.05992 13.3335 7.99992C13.3335 10.9399 10.9402 13.3333 8.00016 13.3333ZM10.3935 4.66659L8.00016 7.05992L5.60683 4.66659L4.66683 5.60659L7.06016 7.99992L4.66683 10.3933L5.60683 11.3333L8.00016 8.93992L10.3935 11.3333L11.3335 10.3933L8.94016 7.99992L11.3335 5.60659L10.3935 4.66659Z",fill:"currentColor"})),qr=e=>ee.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},ee.createElement("path",{d:"M12.8232 7C12.926 7 13.012 7.07201 13.0244 7.16797L13.1807 8.22754C13.4315 8.32754 13.6621 8.46012 13.876 8.62012L14.9004 8.21973C14.9208 8.21186 14.9453 8.20803 14.9697 8.20801C15.0436 8.20801 15.1133 8.24392 15.1504 8.30762L15.9736 9.69238C16.0227 9.7803 16.0018 9.88834 15.9238 9.94824L15.0566 10.6084C15.0731 10.7363 15.085 10.8642 15.085 11C15.085 11.1358 15.0731 11.2637 15.0566 11.3916L15.9238 12.0518C16.0018 12.1117 16.0227 12.2197 15.9736 12.3076L15.1504 13.6924C15.1133 13.7561 15.0434 13.792 14.9736 13.792C14.9492 13.7919 14.9248 13.7881 14.9004 13.7803L13.876 13.3799C13.6621 13.5359 13.4315 13.6725 13.1807 13.7725L13.0244 14.832C13.012 14.928 12.926 15 12.8232 15H11.1787C11.0759 15 10.9889 14.928 10.9766 14.832L10.8203 13.7725C10.5696 13.6725 10.3397 13.5398 10.126 13.3799L9.10156 13.7803C9.08115 13.7882 9.05667 13.792 9.03223 13.792C8.95826 13.792 8.88761 13.7563 8.85059 13.6924L8.02832 12.3076C7.97924 12.2197 8.0001 12.1117 8.07812 12.0518L8.94531 11.3916C8.92889 11.2637 8.91699 11.1319 8.91699 11C8.91699 10.8681 8.92889 10.7363 8.94531 10.6084L8.07812 9.94824C8.0001 9.88832 7.97515 9.78032 8.02832 9.69238L8.85059 8.30762C8.88754 8.24383 8.95763 8.20816 9.02734 8.20801C9.05192 8.20801 9.07699 8.21179 9.10156 8.21973L10.126 8.62012C10.3397 8.46418 10.5696 8.32752 10.8203 8.22754L10.9766 7.16797C10.9889 7.07197 11.0759 7 11.1787 7H12.8232ZM11.7129 7.7998L11.6309 8.33984L11.5654 8.79199L11.1289 8.96387C10.9604 9.03184 10.792 9.12795 10.6152 9.25586L10.2451 9.52832L9.81738 9.36035L9.29492 9.15625L9.00684 9.63965L9.45117 9.97559L9.81738 10.2559L9.75977 10.708C9.74743 10.828 9.73926 10.92 9.73926 11C9.73926 11.08 9.74743 11.1719 9.75977 11.2959L9.81738 11.748L9.45117 12.0283L9.00684 12.3643L9.29492 12.8477L9.81738 12.6436L10.2529 12.4717L10.627 12.752C10.7913 12.8719 10.9561 12.9642 11.1328 13.0361L11.5693 13.208L11.6348 13.6602L11.7129 14.2002H12.2891L12.3711 13.6602L12.4365 13.208L12.873 13.0361C13.0415 12.9681 13.21 12.8721 13.3867 12.7441L13.7568 12.4717L14.1846 12.6396L14.707 12.8438L14.9941 12.3604L14.5508 12.0244L14.1846 11.7441L14.2422 11.292C14.2545 11.172 14.2627 11.084 14.2627 11C14.2627 10.916 14.2586 10.832 14.2422 10.708L14.1846 10.2559L14.5508 9.97559L14.9902 9.63574L14.7021 9.15234L14.1807 9.35645L13.7441 9.52832L13.3701 9.24805C13.2057 9.12808 13.0411 9.03586 12.8643 8.96387L12.4287 8.79199L12.3623 8.33984L12.2842 7.7998H11.7129ZM3.33301 12.6338H2V11.3008H3.33301V12.6338ZM7.00977 11.3008C7.03732 11.7651 7.12864 12.2121 7.27441 12.6338H4.66699V11.3008H7.00977ZM12.001 9.40039C12.9097 9.40043 13.6455 10.116 13.6455 11C13.6455 11.884 12.9097 12.5996 12.001 12.5996C11.0922 12.5996 10.3564 11.884 10.3564 11C10.3564 10.116 11.0922 9.40039 12.001 9.40039ZM12.001 10.2002C11.5486 10.2002 11.1787 10.56 11.1787 11C11.1787 11.44 11.5486 11.7998 12.001 11.7998C12.4533 11.7998 12.8232 11.44 12.8232 11C12.8232 10.56 12.4533 10.2002 12.001 10.2002ZM3.33301 8.63379H2V7.30078H3.33301V8.63379ZM8.63574 7.30078C8.21765 7.68124 7.86483 8.13197 7.59473 8.63379H4.66699V7.30078H8.63574ZM3.33301 4.7334H2V3.40039H3.33301V4.7334ZM14 4.7334H4.66699V3.40039H14V4.7334Z",fill:"currentColor"}));function Lo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var He={exports:{}},Xr=He.exports,Pt;function Qr(){return Pt||(Pt=1,(function(e,n){(function(t,o){o(n)})(Xr,(function(t){/*! *****************************************************************************
15
14
  Copyright (c) Microsoft Corporation.
16
15
 
17
16
  Permission to use, copy, modify, and/or distribute this software for any
@@ -24,7 +23,7 @@
24
23
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
25
24
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
26
25
  PERFORMANCE OF THIS SOFTWARE.
27
- ***************************************************************************** */var o=function(){return o=Object.assign||function(ye){for(var $e,sn=1,Cr=arguments.length;sn<Cr;sn++){$e=arguments[sn];for(var cn in $e)Object.prototype.hasOwnProperty.call($e,cn)&&(ye[cn]=$e[cn])}return ye},o.apply(this,arguments)},r=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},l={weekdays:{shorthand:["أحد","اثنين","ثلاثاء","أربعاء","خميس","جمعة","سبت"],longhand:["الأحد","الاثنين","الثلاثاء","الأربعاء","الخميس","الجمعة","السبت"]},months:{shorthand:["1","2","3","4","5","6","7","8","9","10","11","12"],longhand:["يناير","فبراير","مارس","أبريل","مايو","يونيو","يوليو","أغسطس","سبتمبر","أكتوبر","نوفمبر","ديسمبر"]},firstDayOfWeek:6,rangeSeparator:" إلى ",weekAbbreviation:"Wk",scrollTitle:"قم بالتمرير للزيادة",toggleTitle:"اضغط للتبديل",amPM:["ص","م"],yearAriaLabel:"سنة",monthAriaLabel:"شهر",hourAriaLabel:"ساعة",minuteAriaLabel:"دقيقة",time_24hr:!1};r.l10ns.ar=l,r.l10ns;var c=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},g={weekdays:{shorthand:["So","Mo","Di","Mi","Do","Fr","Sa"],longhand:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"]},months:{shorthand:["Jän","Feb","Mär","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"],longhand:["Jänner","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"]},firstDayOfWeek:1,weekAbbreviation:"KW",rangeSeparator:" bis ",scrollTitle:"Zum Ändern scrollen",toggleTitle:"Zum Umschalten klicken",time_24hr:!0};c.l10ns.at=g,c.l10ns;var a=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},u={weekdays:{shorthand:["B.","B.e.","Ç.a.","Ç.","C.a.","C.","Ş."],longhand:["Bazar","Bazar ertəsi","Çərşənbə axşamı","Çərşənbə","Cümə axşamı","Cümə","Şənbə"]},months:{shorthand:["Yan","Fev","Mar","Apr","May","İyn","İyl","Avq","Sen","Okt","Noy","Dek"],longhand:["Yanvar","Fevral","Mart","Aprel","May","İyun","İyul","Avqust","Sentyabr","Oktyabr","Noyabr","Dekabr"]},firstDayOfWeek:1,ordinal:function(){return"."},rangeSeparator:" - ",weekAbbreviation:"Hf",scrollTitle:"Artırmaq üçün sürüşdürün",toggleTitle:"Aç / Bağla",amPM:["GƏ","GS"],time_24hr:!0};a.l10ns.az=u,a.l10ns;var s=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},d={weekdays:{shorthand:["Нд","Пн","Аў","Ср","Чц","Пт","Сб"],longhand:["Нядзеля","Панядзелак","Аўторак","Серада","Чацвер","Пятніца","Субота"]},months:{shorthand:["Сту","Лют","Сак","Кра","Тра","Чэр","Ліп","Жні","Вер","Кас","Ліс","Сне"],longhand:["Студзень","Люты","Сакавік","Красавік","Травень","Чэрвень","Ліпень","Жнівень","Верасень","Кастрычнік","Лістапад","Снежань"]},firstDayOfWeek:1,ordinal:function(){return""},rangeSeparator:" — ",weekAbbreviation:"Тыд.",scrollTitle:"Пракруціце для павелічэння",toggleTitle:"Націсніце для пераключэння",amPM:["ДП","ПП"],yearAriaLabel:"Год",time_24hr:!0};s.l10ns.be=d,s.l10ns;var f=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},w={firstDayOfWeek:1,weekdays:{shorthand:["Ned","Pon","Uto","Sri","Čet","Pet","Sub"],longhand:["Nedjelja","Ponedjeljak","Utorak","Srijeda","Četvrtak","Petak","Subota"]},months:{shorthand:["Jan","Feb","Mar","Apr","Maj","Jun","Jul","Avg","Sep","Okt","Nov","Dec"],longhand:["Januar","Februar","Mart","April","Maj","Juni","Juli","Avgust","Septembar","Oktobar","Novembar","Decembar"]},time_24hr:!0};f.l10ns.bs=w,f.l10ns;var m=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},b={weekdays:{shorthand:["Нд","Пн","Вт","Ср","Чт","Пт","Сб"],longhand:["Неделя","Понеделник","Вторник","Сряда","Четвъртък","Петък","Събота"]},months:{shorthand:["Яну","Фев","Март","Апр","Май","Юни","Юли","Авг","Сеп","Окт","Ное","Дек"],longhand:["Януари","Февруари","Март","Април","Май","Юни","Юли","Август","Септември","Октомври","Ноември","Декември"]},time_24hr:!0,firstDayOfWeek:1};m.l10ns.bg=b,m.l10ns;var p=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},S={weekdays:{shorthand:["রবি","সোম","মঙ্গল","বুধ","বৃহস্পতি","শুক্র","শনি"],longhand:["রবিবার","সোমবার","মঙ্গলবার","বুধবার","বৃহস্পতিবার","শুক্রবার","শনিবার"]},months:{shorthand:["জানু","ফেব্রু","মার্চ","এপ্রিল","মে","জুন","জুলাই","আগ","সেপ্টে","অক্টো","নভে","ডিসে"],longhand:["জানুয়ারী","ফেব্রুয়ারী","মার্চ","এপ্রিল","মে","জুন","জুলাই","আগস্ট","সেপ্টেম্বর","অক্টোবর","নভেম্বর","ডিসেম্বর"]}};p.l10ns.bn=S,p.l10ns;var C=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},x={weekdays:{shorthand:["Dg","Dl","Dt","Dc","Dj","Dv","Ds"],longhand:["Diumenge","Dilluns","Dimarts","Dimecres","Dijous","Divendres","Dissabte"]},months:{shorthand:["Gen","Febr","Març","Abr","Maig","Juny","Jul","Ag","Set","Oct","Nov","Des"],longhand:["Gener","Febrer","Març","Abril","Maig","Juny","Juliol","Agost","Setembre","Octubre","Novembre","Desembre"]},ordinal:function(Q){var ye=Q%100;if(ye>3&&ye<21)return"è";switch(ye%10){case 1:return"r";case 2:return"n";case 3:return"r";case 4:return"t";default:return"è"}},firstDayOfWeek:1,rangeSeparator:" a ",time_24hr:!0};C.l10ns.cat=C.l10ns.ca=x,C.l10ns;var N=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},v={weekdays:{shorthand:["یەکشەممە","دووشەممە","سێشەممە","چوارشەممە","پێنجشەممە","هەینی","شەممە"],longhand:["یەکشەممە","دووشەممە","سێشەممە","چوارشەممە","پێنجشەممە","هەینی","شەممە"]},months:{shorthand:["ڕێبەندان","ڕەشەمە","نەورۆز","گوڵان","جۆزەردان","پووشپەڕ","گەلاوێژ","خەرمانان","ڕەزبەر","گەڵاڕێزان","سەرماوەز","بەفرانبار"],longhand:["ڕێبەندان","ڕەشەمە","نەورۆز","گوڵان","جۆزەردان","پووشپەڕ","گەلاوێژ","خەرمانان","ڕەزبەر","گەڵاڕێزان","سەرماوەز","بەفرانبار"]},firstDayOfWeek:6,ordinal:function(){return""}};N.l10ns.ckb=v,N.l10ns;var E=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},_={weekdays:{shorthand:["Ne","Po","Út","St","Čt","Pá","So"],longhand:["Neděle","Pondělí","Úterý","Středa","Čtvrtek","Pátek","Sobota"]},months:{shorthand:["Led","Ún","Bře","Dub","Kvě","Čer","Čvc","Srp","Zář","Říj","Lis","Pro"],longhand:["Leden","Únor","Březen","Duben","Květen","Červen","Červenec","Srpen","Září","Říjen","Listopad","Prosinec"]},firstDayOfWeek:1,ordinal:function(){return"."},rangeSeparator:" do ",weekAbbreviation:"Týd.",scrollTitle:"Rolujte pro změnu",toggleTitle:"Přepnout dopoledne/odpoledne",amPM:["dop.","odp."],yearAriaLabel:"Rok",time_24hr:!0};E.l10ns.cs=_,E.l10ns;var M=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},y={weekdays:{shorthand:["Sul","Llun","Maw","Mer","Iau","Gwe","Sad"],longhand:["Dydd Sul","Dydd Llun","Dydd Mawrth","Dydd Mercher","Dydd Iau","Dydd Gwener","Dydd Sadwrn"]},months:{shorthand:["Ion","Chwef","Maw","Ebr","Mai","Meh","Gorff","Awst","Medi","Hyd","Tach","Rhag"],longhand:["Ionawr","Chwefror","Mawrth","Ebrill","Mai","Mehefin","Gorffennaf","Awst","Medi","Hydref","Tachwedd","Rhagfyr"]},firstDayOfWeek:1,ordinal:function(Q){return Q===1?"af":Q===2?"ail":Q===3||Q===4?"ydd":Q===5||Q===6?"ed":Q>=7&&Q<=10||Q==12||Q==15||Q==18||Q==20?"fed":Q==11||Q==13||Q==14||Q==16||Q==17||Q==19?"eg":Q>=21&&Q<=39?"ain":""},time_24hr:!0};M.l10ns.cy=y,M.l10ns;var k=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},A={weekdays:{shorthand:["søn","man","tir","ons","tors","fre","lør"],longhand:["søndag","mandag","tirsdag","onsdag","torsdag","fredag","lørdag"]},months:{shorthand:["jan","feb","mar","apr","maj","jun","jul","aug","sep","okt","nov","dec"],longhand:["januar","februar","marts","april","maj","juni","juli","august","september","oktober","november","december"]},ordinal:function(){return"."},firstDayOfWeek:1,rangeSeparator:" til ",weekAbbreviation:"uge",time_24hr:!0};k.l10ns.da=A,k.l10ns;var O=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},F={weekdays:{shorthand:["So","Mo","Di","Mi","Do","Fr","Sa"],longhand:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"]},months:{shorthand:["Jan","Feb","Mär","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"],longhand:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"]},firstDayOfWeek:1,weekAbbreviation:"KW",rangeSeparator:" bis ",scrollTitle:"Zum Ändern scrollen",toggleTitle:"Zum Umschalten klicken",time_24hr:!0};O.l10ns.de=F,O.l10ns;var K={weekdays:{shorthand:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longhand:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},months:{shorthand:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longhand:["January","February","March","April","May","June","July","August","September","October","November","December"]},daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],firstDayOfWeek:0,ordinal:function(Q){var ye=Q%100;if(ye>3&&ye<21)return"th";switch(ye%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},rangeSeparator:" to ",weekAbbreviation:"Wk",scrollTitle:"Scroll to increment",toggleTitle:"Click to toggle",amPM:["AM","PM"],yearAriaLabel:"Year",monthAriaLabel:"Month",hourAriaLabel:"Hour",minuteAriaLabel:"Minute",time_24hr:!1},T=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},I={firstDayOfWeek:1,rangeSeparator:" ĝis ",weekAbbreviation:"Sem",scrollTitle:"Rulumu por pligrandigi la valoron",toggleTitle:"Klaku por ŝalti",weekdays:{shorthand:["Dim","Lun","Mar","Mer","Ĵaŭ","Ven","Sab"],longhand:["dimanĉo","lundo","mardo","merkredo","ĵaŭdo","vendredo","sabato"]},months:{shorthand:["Jan","Feb","Mar","Apr","Maj","Jun","Jul","Aŭg","Sep","Okt","Nov","Dec"],longhand:["januaro","februaro","marto","aprilo","majo","junio","julio","aŭgusto","septembro","oktobro","novembro","decembro"]},ordinal:function(){return"-a"},time_24hr:!0};T.l10ns.eo=I,T.l10ns;var H=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},B={weekdays:{shorthand:["Dom","Lun","Mar","Mié","Jue","Vie","Sáb"],longhand:["Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado"]},months:{shorthand:["Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"],longhand:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"]},ordinal:function(){return"º"},firstDayOfWeek:1,rangeSeparator:" a ",time_24hr:!0};H.l10ns.es=B,H.l10ns;var U=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Z={weekdays:{shorthand:["P","E","T","K","N","R","L"],longhand:["Pühapäev","Esmaspäev","Teisipäev","Kolmapäev","Neljapäev","Reede","Laupäev"]},months:{shorthand:["Jaan","Veebr","Märts","Apr","Mai","Juuni","Juuli","Aug","Sept","Okt","Nov","Dets"],longhand:["Jaanuar","Veebruar","Märts","Aprill","Mai","Juuni","Juuli","August","September","Oktoober","November","Detsember"]},firstDayOfWeek:1,ordinal:function(){return"."},weekAbbreviation:"Näd",rangeSeparator:" kuni ",scrollTitle:"Keri, et suurendada",toggleTitle:"Klõpsa, et vahetada",time_24hr:!0};U.l10ns.et=Z,U.l10ns;var W=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},q={weekdays:{shorthand:["یک","دو","سه","چهار","پنج","جمعه","شنبه"],longhand:["یک‌شنبه","دوشنبه","سه‌شنبه","چهارشنبه","پنچ‌شنبه","جمعه","شنبه"]},months:{shorthand:["ژانویه","فوریه","مارس","آوریل","مه","ژوئن","ژوئیه","اوت","سپتامبر","اکتبر","نوامبر","دسامبر"],longhand:["ژانویه","فوریه","مارس","آوریل","مه","ژوئن","ژوئیه","اوت","سپتامبر","اکتبر","نوامبر","دسامبر"]},firstDayOfWeek:6,ordinal:function(){return""}};W.l10ns.fa=q,W.l10ns;var se=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},ae={firstDayOfWeek:1,weekdays:{shorthand:["su","ma","ti","ke","to","pe","la"],longhand:["sunnuntai","maanantai","tiistai","keskiviikko","torstai","perjantai","lauantai"]},months:{shorthand:["tammi","helmi","maalis","huhti","touko","kesä","heinä","elo","syys","loka","marras","joulu"],longhand:["tammikuu","helmikuu","maaliskuu","huhtikuu","toukokuu","kesäkuu","heinäkuu","elokuu","syyskuu","lokakuu","marraskuu","joulukuu"]},ordinal:function(){return"."},time_24hr:!0};se.l10ns.fi=ae,se.l10ns;var ce=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},ue={weekdays:{shorthand:["Sun","Mán","Týs","Mik","Hós","Frí","Ley"],longhand:["Sunnudagur","Mánadagur","Týsdagur","Mikudagur","Hósdagur","Fríggjadagur","Leygardagur"]},months:{shorthand:["Jan","Feb","Mar","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Des"],longhand:["Januar","Februar","Mars","Apríl","Mai","Juni","Juli","August","Septembur","Oktobur","Novembur","Desembur"]},ordinal:function(){return"."},firstDayOfWeek:1,rangeSeparator:" til ",weekAbbreviation:"vika",scrollTitle:"Rulla fyri at broyta",toggleTitle:"Trýst fyri at skifta",yearAriaLabel:"Ár",time_24hr:!0};ce.l10ns.fo=ue,ce.l10ns;var he=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Ne={firstDayOfWeek:1,weekdays:{shorthand:["dim","lun","mar","mer","jeu","ven","sam"],longhand:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"]},months:{shorthand:["janv","févr","mars","avr","mai","juin","juil","août","sept","oct","nov","déc"],longhand:["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"]},ordinal:function(Q){return Q>1?"":"er"},rangeSeparator:" au ",weekAbbreviation:"Sem",scrollTitle:"Défiler pour augmenter la valeur",toggleTitle:"Cliquer pour basculer",time_24hr:!0};he.l10ns.fr=Ne,he.l10ns;var pe=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},xe={weekdays:{shorthand:["Κυ","Δε","Τρ","Τε","Πέ","Πα","Σά"],longhand:["Κυριακή","Δευτέρα","Τρίτη","Τετάρτη","Πέμπτη","Παρασκευή","Σάββατο"]},months:{shorthand:["Ιαν","Φεβ","Μάρ","Απρ","Μάι","Ιούν","Ιούλ","Αύγ","Σεπ","Οκτ","Νοέ","Δεκ"],longhand:["Ιανουάριος","Φεβρουάριος","Μάρτιος","Απρίλιος","Μάιος","Ιούνιος","Ιούλιος","Αύγουστος","Σεπτέμβριος","Οκτώβριος","Νοέμβριος","Δεκέμβριος"]},firstDayOfWeek:1,ordinal:function(){return""},weekAbbreviation:"Εβδ",rangeSeparator:" έως ",scrollTitle:"Μετακυλήστε για προσαύξηση",toggleTitle:"Κάντε κλικ για αλλαγή",amPM:["ΠΜ","ΜΜ"],yearAriaLabel:"χρόνος",monthAriaLabel:"μήνας",hourAriaLabel:"ώρα",minuteAriaLabel:"λεπτό"};pe.l10ns.gr=xe,pe.l10ns;var fe=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},ve={weekdays:{shorthand:["א","ב","ג","ד","ה","ו","ש"],longhand:["ראשון","שני","שלישי","רביעי","חמישי","שישי","שבת"]},months:{shorthand:["ינו׳","פבר׳","מרץ","אפר׳","מאי","יוני","יולי","אוג׳","ספט׳","אוק׳","נוב׳","דצמ׳"],longhand:["ינואר","פברואר","מרץ","אפריל","מאי","יוני","יולי","אוגוסט","ספטמבר","אוקטובר","נובמבר","דצמבר"]},rangeSeparator:" אל ",time_24hr:!0};fe.l10ns.he=ve,fe.l10ns;var Te=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Se={weekdays:{shorthand:["रवि","सोम","मंगल","बुध","गुरु","शुक्र","शनि"],longhand:["रविवार","सोमवार","मंगलवार","बुधवार","गुरुवार","शुक्रवार","शनिवार"]},months:{shorthand:["जन","फर","मार्च","अप्रेल","मई","जून","जूलाई","अग","सित","अक्ट","नव","दि"],longhand:["जनवरी ","फरवरी","मार्च","अप्रेल","मई","जून","जूलाई","अगस्त ","सितम्बर","अक्टूबर","नवम्बर","दिसम्बर"]}};Te.l10ns.hi=Se,Te.l10ns;var be=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},De={firstDayOfWeek:1,weekdays:{shorthand:["Ned","Pon","Uto","Sri","Čet","Pet","Sub"],longhand:["Nedjelja","Ponedjeljak","Utorak","Srijeda","Četvrtak","Petak","Subota"]},months:{shorthand:["Sij","Velj","Ožu","Tra","Svi","Lip","Srp","Kol","Ruj","Lis","Stu","Pro"],longhand:["Siječanj","Veljača","Ožujak","Travanj","Svibanj","Lipanj","Srpanj","Kolovoz","Rujan","Listopad","Studeni","Prosinac"]},time_24hr:!0};be.l10ns.hr=De,be.l10ns;var Oe=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Ae={firstDayOfWeek:1,weekdays:{shorthand:["V","H","K","Sz","Cs","P","Szo"],longhand:["Vasárnap","Hétfő","Kedd","Szerda","Csütörtök","Péntek","Szombat"]},months:{shorthand:["Jan","Feb","Már","Ápr","Máj","Jún","Júl","Aug","Szep","Okt","Nov","Dec"],longhand:["Január","Február","Március","Április","Május","Június","Július","Augusztus","Szeptember","Október","November","December"]},ordinal:function(){return"."},weekAbbreviation:"Hét",scrollTitle:"Görgessen",toggleTitle:"Kattintson a váltáshoz",rangeSeparator:" - ",time_24hr:!0};Oe.l10ns.hu=Ae,Oe.l10ns;var Ce=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},je={weekdays:{shorthand:["Կիր","Երկ","Երք","Չրք","Հնգ","Ուրբ","Շբթ"],longhand:["Կիրակի","Եկուշաբթի","Երեքշաբթի","Չորեքշաբթի","Հինգշաբթի","Ուրբաթ","Շաբաթ"]},months:{shorthand:["Հնվ","Փտր","Մար","Ապր","Մայ","Հնս","Հլս","Օգս","Սեպ","Հոկ","Նմբ","Դեկ"],longhand:["Հունվար","Փետրվար","Մարտ","Ապրիլ","Մայիս","Հունիս","Հուլիս","Օգոստոս","Սեպտեմբեր","Հոկտեմբեր","Նոյեմբեր","Դեկտեմբեր"]},firstDayOfWeek:1,ordinal:function(){return""},rangeSeparator:" — ",weekAbbreviation:"ՇԲՏ",scrollTitle:"Ոլորեք՝ մեծացնելու համար",toggleTitle:"Սեղմեք՝ փոխելու համար",amPM:["ՄԿ","ԿՀ"],yearAriaLabel:"Տարի",monthAriaLabel:"Ամիս",hourAriaLabel:"Ժամ",minuteAriaLabel:"Րոպե",time_24hr:!0};Ce.l10ns.hy=je,Ce.l10ns;var P=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},G={weekdays:{shorthand:["Min","Sen","Sel","Rab","Kam","Jum","Sab"],longhand:["Minggu","Senin","Selasa","Rabu","Kamis","Jumat","Sabtu"]},months:{shorthand:["Jan","Feb","Mar","Apr","Mei","Jun","Jul","Agu","Sep","Okt","Nov","Des"],longhand:["Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember"]},firstDayOfWeek:1,ordinal:function(){return""},time_24hr:!0,rangeSeparator:" - "};P.l10ns.id=G,P.l10ns;var z=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},ne={weekdays:{shorthand:["Sun","Mán","Þri","Mið","Fim","Fös","Lau"],longhand:["Sunnudagur","Mánudagur","Þriðjudagur","Miðvikudagur","Fimmtudagur","Föstudagur","Laugardagur"]},months:{shorthand:["Jan","Feb","Mar","Apr","Maí","Jún","Júl","Ágú","Sep","Okt","Nóv","Des"],longhand:["Janúar","Febrúar","Mars","Apríl","Maí","Júní","Júlí","Ágúst","September","Október","Nóvember","Desember"]},ordinal:function(){return"."},firstDayOfWeek:1,rangeSeparator:" til ",weekAbbreviation:"vika",yearAriaLabel:"Ár",time_24hr:!0};z.l10ns.is=ne,z.l10ns;var L=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},R={weekdays:{shorthand:["Dom","Lun","Mar","Mer","Gio","Ven","Sab"],longhand:["Domenica","Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato"]},months:{shorthand:["Gen","Feb","Mar","Apr","Mag","Giu","Lug","Ago","Set","Ott","Nov","Dic"],longhand:["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"]},firstDayOfWeek:1,ordinal:function(){return"°"},rangeSeparator:" al ",weekAbbreviation:"Se",scrollTitle:"Scrolla per aumentare",toggleTitle:"Clicca per cambiare",time_24hr:!0};L.l10ns.it=R,L.l10ns;var $=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},J={weekdays:{shorthand:["日","月","火","水","木","金","土"],longhand:["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"]},months:{shorthand:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],longhand:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"]},time_24hr:!0,rangeSeparator:" から ",monthAriaLabel:"月",amPM:["午前","午後"],yearAriaLabel:"年",hourAriaLabel:"時間",minuteAriaLabel:"分"};$.l10ns.ja=J,$.l10ns;var te=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},oe={weekdays:{shorthand:["კვ","ორ","სა","ოთ","ხუ","პა","შა"],longhand:["კვირა","ორშაბათი","სამშაბათი","ოთხშაბათი","ხუთშაბათი","პარასკევი","შაბათი"]},months:{shorthand:["იან","თებ","მარ","აპრ","მაი","ივნ","ივლ","აგვ","სექ","ოქტ","ნოე","დეკ"],longhand:["იანვარი","თებერვალი","მარტი","აპრილი","მაისი","ივნისი","ივლისი","აგვისტო","სექტემბერი","ოქტომბერი","ნოემბერი","დეკემბერი"]},firstDayOfWeek:1,ordinal:function(){return""},rangeSeparator:" — ",weekAbbreviation:"კვ.",scrollTitle:"დასქროლეთ გასადიდებლად",toggleTitle:"დააკლიკეთ გადართვისთვის",amPM:["AM","PM"],yearAriaLabel:"წელი",time_24hr:!0};te.l10ns.ka=oe,te.l10ns;var we=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Le={weekdays:{shorthand:["일","월","화","수","목","금","토"],longhand:["일요일","월요일","화요일","수요일","목요일","금요일","토요일"]},months:{shorthand:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],longhand:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"]},ordinal:function(){return"일"},rangeSeparator:" ~ ",amPM:["오전","오후"]};we.l10ns.ko=Le,we.l10ns;var Mn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Tn={weekdays:{shorthand:["អាទិត្យ","ចន្ទ","អង្គារ","ពុធ","ព្រហស.","សុក្រ","សៅរ៍"],longhand:["អាទិត្យ","ចន្ទ","អង្គារ","ពុធ","ព្រហស្បតិ៍","សុក្រ","សៅរ៍"]},months:{shorthand:["មករា","កុម្ភះ","មីនា","មេសា","ឧសភា","មិថុនា","កក្កដា","សីហា","កញ្ញា","តុលា","វិច្ឆិកា","ធ្នូ"],longhand:["មករា","កុម្ភះ","មីនា","មេសា","ឧសភា","មិថុនា","កក្កដា","សីហា","កញ្ញា","តុលា","វិច្ឆិកា","ធ្នូ"]},ordinal:function(){return""},firstDayOfWeek:1,rangeSeparator:" ដល់ ",weekAbbreviation:"សប្តាហ៍",scrollTitle:"រំកិលដើម្បីបង្កើន",toggleTitle:"ចុចដើម្បីផ្លាស់ប្ដូរ",yearAriaLabel:"ឆ្នាំ",time_24hr:!0};Mn.l10ns.km=Tn,Mn.l10ns;var On=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Ln={weekdays:{shorthand:["Жс","Дс","Сc","Ср","Бс","Жм","Сб"],longhand:["Жексенбi","Дүйсенбi","Сейсенбi","Сәрсенбi","Бейсенбi","Жұма","Сенбi"]},months:{shorthand:["Қаң","Ақп","Нау","Сәу","Мам","Мау","Шiл","Там","Қыр","Қаз","Қар","Жел"],longhand:["Қаңтар","Ақпан","Наурыз","Сәуiр","Мамыр","Маусым","Шiлде","Тамыз","Қыркүйек","Қазан","Қараша","Желтоқсан"]},firstDayOfWeek:1,ordinal:function(){return""},rangeSeparator:" — ",weekAbbreviation:"Апта",scrollTitle:"Үлкейту үшін айналдырыңыз",toggleTitle:"Ауыстыру үшін басыңыз",amPM:["ТД","ТК"],yearAriaLabel:"Жыл"};On.l10ns.kz=Ln,On.l10ns;var _n=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Rn={weekdays:{shorthand:["S","Pr","A","T","K","Pn","Š"],longhand:["Sekmadienis","Pirmadienis","Antradienis","Trečiadienis","Ketvirtadienis","Penktadienis","Šeštadienis"]},months:{shorthand:["Sau","Vas","Kov","Bal","Geg","Bir","Lie","Rgp","Rgs","Spl","Lap","Grd"],longhand:["Sausis","Vasaris","Kovas","Balandis","Gegužė","Birželis","Liepa","Rugpjūtis","Rugsėjis","Spalis","Lapkritis","Gruodis"]},firstDayOfWeek:1,ordinal:function(){return"-a"},rangeSeparator:" iki ",weekAbbreviation:"Sav",scrollTitle:"Keisti laiką pelės rateliu",toggleTitle:"Perjungti laiko formatą",time_24hr:!0};_n.l10ns.lt=Rn,_n.l10ns;var In=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Pn={firstDayOfWeek:1,weekdays:{shorthand:["Sv","Pr","Ot","Tr","Ce","Pk","Se"],longhand:["Svētdiena","Pirmdiena","Otrdiena","Trešdiena","Ceturtdiena","Piektdiena","Sestdiena"]},months:{shorthand:["Jan","Feb","Mar","Apr","Mai","Jūn","Jūl","Aug","Sep","Okt","Nov","Dec"],longhand:["Janvāris","Februāris","Marts","Aprīlis","Maijs","Jūnijs","Jūlijs","Augusts","Septembris","Oktobris","Novembris","Decembris"]},rangeSeparator:" līdz ",time_24hr:!0};In.l10ns.lv=Pn,In.l10ns;var Vn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Fn={weekdays:{shorthand:["Не","По","Вт","Ср","Че","Пе","Са"],longhand:["Недела","Понеделник","Вторник","Среда","Четврток","Петок","Сабота"]},months:{shorthand:["Јан","Фев","Мар","Апр","Мај","Јун","Јул","Авг","Сеп","Окт","Ное","Дек"],longhand:["Јануари","Февруари","Март","Април","Мај","Јуни","Јули","Август","Септември","Октомври","Ноември","Декември"]},firstDayOfWeek:1,weekAbbreviation:"Нед.",rangeSeparator:" до ",time_24hr:!0};Vn.l10ns.mk=Fn,Vn.l10ns;var Bn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Hn={firstDayOfWeek:1,weekdays:{shorthand:["Да","Мя","Лх","Пү","Ба","Бя","Ня"],longhand:["Даваа","Мягмар","Лхагва","Пүрэв","Баасан","Бямба","Ням"]},months:{shorthand:["1-р сар","2-р сар","3-р сар","4-р сар","5-р сар","6-р сар","7-р сар","8-р сар","9-р сар","10-р сар","11-р сар","12-р сар"],longhand:["Нэгдүгээр сар","Хоёрдугаар сар","Гуравдугаар сар","Дөрөвдүгээр сар","Тавдугаар сар","Зургаадугаар сар","Долдугаар сар","Наймдугаар сар","Есдүгээр сар","Аравдугаар сар","Арваннэгдүгээр сар","Арванхоёрдугаар сар"]},rangeSeparator:"-с ",time_24hr:!0};Bn.l10ns.mn=Hn,Bn.l10ns;var xr=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},vr={weekdays:{shorthand:["Aha","Isn","Sel","Rab","Kha","Jum","Sab"],longhand:["Ahad","Isnin","Selasa","Rabu","Khamis","Jumaat","Sabtu"]},months:{shorthand:["Jan","Feb","Mac","Apr","Mei","Jun","Jul","Ogo","Sep","Okt","Nov","Dis"],longhand:["Januari","Februari","Mac","April","Mei","Jun","Julai","Ogos","September","Oktober","November","Disember"]},firstDayOfWeek:1,ordinal:function(){return""}};xr.l10ns;var Gn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Un={weekdays:{shorthand:["နွေ","လာ","ဂါ","ဟူး","ကြာ","သော","နေ"],longhand:["တနင်္ဂနွေ","တနင်္လာ","အင်္ဂါ","ဗုဒ္ဓဟူး","ကြာသပတေး","သောကြာ","စနေ"]},months:{shorthand:["ဇန်","ဖေ","မတ်","ပြီ","မေ","ဇွန်","လိုင်","သြ","စက်","အောက်","နို","ဒီ"],longhand:["ဇန်နဝါရီ","ဖေဖော်ဝါရီ","မတ်","ဧပြီ","မေ","ဇွန်","ဇူလိုင်","သြဂုတ်","စက်တင်ဘာ","အောက်တိုဘာ","နိုဝင်ဘာ","ဒီဇင်ဘာ"]},firstDayOfWeek:1,ordinal:function(){return""},time_24hr:!0};Gn.l10ns.my=Un,Gn.l10ns;var zn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Wn={weekdays:{shorthand:["zo","ma","di","wo","do","vr","za"],longhand:["zondag","maandag","dinsdag","woensdag","donderdag","vrijdag","zaterdag"]},months:{shorthand:["jan","feb","mrt","apr","mei","jun","jul","aug","sept","okt","nov","dec"],longhand:["januari","februari","maart","april","mei","juni","juli","augustus","september","oktober","november","december"]},firstDayOfWeek:1,weekAbbreviation:"wk",rangeSeparator:" t/m ",scrollTitle:"Scroll voor volgende / vorige",toggleTitle:"Klik om te wisselen",time_24hr:!0,ordinal:function(Q){return Q===1||Q===8||Q>=20?"ste":"de"}};zn.l10ns.nl=Wn,zn.l10ns;var $n=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Jn={weekdays:{shorthand:["Sø.","Må.","Ty.","On.","To.","Fr.","La."],longhand:["Søndag","Måndag","Tysdag","Onsdag","Torsdag","Fredag","Laurdag"]},months:{shorthand:["Jan","Feb","Mars","Apr","Mai","Juni","Juli","Aug","Sep","Okt","Nov","Des"],longhand:["Januar","Februar","Mars","April","Mai","Juni","Juli","August","September","Oktober","November","Desember"]},firstDayOfWeek:1,rangeSeparator:" til ",weekAbbreviation:"Veke",scrollTitle:"Scroll for å endre",toggleTitle:"Klikk for å veksle",time_24hr:!0,ordinal:function(){return"."}};$n.l10ns.nn=Jn,$n.l10ns;var Yn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Kn={weekdays:{shorthand:["Søn","Man","Tir","Ons","Tor","Fre","Lør"],longhand:["Søndag","Mandag","Tirsdag","Onsdag","Torsdag","Fredag","Lørdag"]},months:{shorthand:["Jan","Feb","Mar","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Des"],longhand:["Januar","Februar","Mars","April","Mai","Juni","Juli","August","September","Oktober","November","Desember"]},firstDayOfWeek:1,rangeSeparator:" til ",weekAbbreviation:"Uke",scrollTitle:"Scroll for å endre",toggleTitle:"Klikk for å veksle",time_24hr:!0,ordinal:function(){return"."}};Yn.l10ns.no=Kn,Yn.l10ns;var Zn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},qn={weekdays:{shorthand:["ਐਤ","ਸੋਮ","ਮੰਗਲ","ਬੁੱਧ","ਵੀਰ","ਸ਼ੁੱਕਰ","ਸ਼ਨਿੱਚਰ"],longhand:["ਐਤਵਾਰ","ਸੋਮਵਾਰ","ਮੰਗਲਵਾਰ","ਬੁੱਧਵਾਰ","ਵੀਰਵਾਰ","ਸ਼ੁੱਕਰਵਾਰ","ਸ਼ਨਿੱਚਰਵਾਰ"]},months:{shorthand:["ਜਨ","ਫ਼ਰ","ਮਾਰ","ਅਪ੍ਰੈ","ਮਈ","ਜੂਨ","ਜੁਲਾ","ਅਗ","ਸਤੰ","ਅਕ","ਨਵੰ","ਦਸੰ"],longhand:["ਜਨਵਰੀ","ਫ਼ਰਵਰੀ","ਮਾਰਚ","ਅਪ੍ਰੈਲ","ਮਈ","ਜੂਨ","ਜੁਲਾਈ","ਅਗਸਤ","ਸਤੰਬਰ","ਅਕਤੂਬਰ","ਨਵੰਬਰ","ਦਸੰਬਰ"]},time_24hr:!0};Zn.l10ns.pa=qn,Zn.l10ns;var Xn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Qn={weekdays:{shorthand:["Nd","Pn","Wt","Śr","Cz","Pt","So"],longhand:["Niedziela","Poniedziałek","Wtorek","Środa","Czwartek","Piątek","Sobota"]},months:{shorthand:["Sty","Lut","Mar","Kwi","Maj","Cze","Lip","Sie","Wrz","Paź","Lis","Gru"],longhand:["Styczeń","Luty","Marzec","Kwiecień","Maj","Czerwiec","Lipiec","Sierpień","Wrzesień","Październik","Listopad","Grudzień"]},rangeSeparator:" do ",weekAbbreviation:"tydz.",scrollTitle:"Przewiń, aby zwiększyć",toggleTitle:"Kliknij, aby przełączyć",firstDayOfWeek:1,time_24hr:!0,ordinal:function(){return"."}};Xn.l10ns.pl=Qn,Xn.l10ns;var et=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},nt={weekdays:{shorthand:["Dom","Seg","Ter","Qua","Qui","Sex","Sáb"],longhand:["Domingo","Segunda-feira","Terça-feira","Quarta-feira","Quinta-feira","Sexta-feira","Sábado"]},months:{shorthand:["Jan","Fev","Mar","Abr","Mai","Jun","Jul","Ago","Set","Out","Nov","Dez"],longhand:["Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"]},rangeSeparator:" até ",time_24hr:!0};et.l10ns.pt=nt,et.l10ns;var tt=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},ot={weekdays:{shorthand:["Dum","Lun","Mar","Mie","Joi","Vin","Sâm"],longhand:["Duminică","Luni","Marți","Miercuri","Joi","Vineri","Sâmbătă"]},months:{shorthand:["Ian","Feb","Mar","Apr","Mai","Iun","Iul","Aug","Sep","Oct","Noi","Dec"],longhand:["Ianuarie","Februarie","Martie","Aprilie","Mai","Iunie","Iulie","August","Septembrie","Octombrie","Noiembrie","Decembrie"]},firstDayOfWeek:1,time_24hr:!0,ordinal:function(){return""}};tt.l10ns.ro=ot,tt.l10ns;var rt=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},it={weekdays:{shorthand:["Вс","Пн","Вт","Ср","Чт","Пт","Сб"],longhand:["Воскресенье","Понедельник","Вторник","Среда","Четверг","Пятница","Суббота"]},months:{shorthand:["Янв","Фев","Март","Апр","Май","Июнь","Июль","Авг","Сен","Окт","Ноя","Дек"],longhand:["Январь","Февраль","Март","Апрель","Май","Июнь","Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь"]},firstDayOfWeek:1,ordinal:function(){return""},rangeSeparator:" — ",weekAbbreviation:"Нед.",scrollTitle:"Прокрутите для увеличения",toggleTitle:"Нажмите для переключения",amPM:["ДП","ПП"],yearAriaLabel:"Год",time_24hr:!0};rt.l10ns.ru=it,rt.l10ns;var lt=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},at={weekdays:{shorthand:["ඉ","ස","අ","බ","බ්‍ර","සි","සෙ"],longhand:["ඉරිදා","සඳුදා","අඟහරුවාදා","බදාදා","බ්‍රහස්පතින්දා","සිකුරාදා","සෙනසුරාදා"]},months:{shorthand:["ජන","පෙබ","මාර්","අප්‍රේ","මැයි","ජුනි","ජූලි","අගෝ","සැප්","ඔක්","නොවැ","දෙසැ"],longhand:["ජනවාරි","පෙබරවාරි","මාර්තු","අප්‍රේල්","මැයි","ජුනි","ජූලි","අගෝස්තු","සැප්තැම්බර්","ඔක්තෝබර්","නොවැම්බර්","දෙසැම්බර්"]},time_24hr:!0};lt.l10ns.si=at,lt.l10ns;var st=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},ct={weekdays:{shorthand:["Ned","Pon","Ut","Str","Štv","Pia","Sob"],longhand:["Nedeľa","Pondelok","Utorok","Streda","Štvrtok","Piatok","Sobota"]},months:{shorthand:["Jan","Feb","Mar","Apr","Máj","Jún","Júl","Aug","Sep","Okt","Nov","Dec"],longhand:["Január","Február","Marec","Apríl","Máj","Jún","Júl","August","September","Október","November","December"]},firstDayOfWeek:1,rangeSeparator:" do ",time_24hr:!0,ordinal:function(){return"."}};st.l10ns.sk=ct,st.l10ns;var ut=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},dt={weekdays:{shorthand:["Ned","Pon","Tor","Sre","Čet","Pet","Sob"],longhand:["Nedelja","Ponedeljek","Torek","Sreda","Četrtek","Petek","Sobota"]},months:{shorthand:["Jan","Feb","Mar","Apr","Maj","Jun","Jul","Avg","Sep","Okt","Nov","Dec"],longhand:["Januar","Februar","Marec","April","Maj","Junij","Julij","Avgust","September","Oktober","November","December"]},firstDayOfWeek:1,rangeSeparator:" do ",time_24hr:!0,ordinal:function(){return"."}};ut.l10ns.sl=dt,ut.l10ns;var ht=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},ft={weekdays:{shorthand:["Di","Hë","Ma","Më","En","Pr","Sh"],longhand:["E Diel","E Hënë","E Martë","E Mërkurë","E Enjte","E Premte","E Shtunë"]},months:{shorthand:["Jan","Shk","Mar","Pri","Maj","Qer","Kor","Gus","Sht","Tet","Nën","Dhj"],longhand:["Janar","Shkurt","Mars","Prill","Maj","Qershor","Korrik","Gusht","Shtator","Tetor","Nëntor","Dhjetor"]},firstDayOfWeek:1,rangeSeparator:" deri ",weekAbbreviation:"Java",yearAriaLabel:"Viti",monthAriaLabel:"Muaji",hourAriaLabel:"Ora",minuteAriaLabel:"Minuta",time_24hr:!0};ht.l10ns.sq=ft,ht.l10ns;var gt=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},wt={weekdays:{shorthand:["Ned","Pon","Uto","Sre","Čet","Pet","Sub"],longhand:["Nedelja","Ponedeljak","Utorak","Sreda","Četvrtak","Petak","Subota"]},months:{shorthand:["Jan","Feb","Mar","Apr","Maj","Jun","Jul","Avg","Sep","Okt","Nov","Dec"],longhand:["Januar","Februar","Mart","April","Maj","Jun","Jul","Avgust","Septembar","Oktobar","Novembar","Decembar"]},firstDayOfWeek:1,weekAbbreviation:"Ned.",rangeSeparator:" do ",time_24hr:!0};gt.l10ns.sr=wt,gt.l10ns;var mt=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},pt={firstDayOfWeek:1,weekAbbreviation:"v",weekdays:{shorthand:["sön","mån","tis","ons","tor","fre","lör"],longhand:["söndag","måndag","tisdag","onsdag","torsdag","fredag","lördag"]},months:{shorthand:["jan","feb","mar","apr","maj","jun","jul","aug","sep","okt","nov","dec"],longhand:["januari","februari","mars","april","maj","juni","juli","augusti","september","oktober","november","december"]},rangeSeparator:" till ",time_24hr:!0,ordinal:function(){return"."}};mt.l10ns.sv=pt,mt.l10ns;var xt=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},vt={weekdays:{shorthand:["อา","จ","อ","พ","พฤ","ศ","ส"],longhand:["อาทิตย์","จันทร์","อังคาร","พุธ","พฤหัสบดี","ศุกร์","เสาร์"]},months:{shorthand:["ม.ค.","ก.พ.","มี.ค.","เม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค."],longhand:["มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม"]},firstDayOfWeek:1,rangeSeparator:" ถึง ",scrollTitle:"เลื่อนเพื่อเพิ่มหรือลด",toggleTitle:"คลิกเพื่อเปลี่ยน",time_24hr:!0,ordinal:function(){return""}};xt.l10ns.th=vt,xt.l10ns;var bt=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Ct={weekdays:{shorthand:["Paz","Pzt","Sal","Çar","Per","Cum","Cmt"],longhand:["Pazar","Pazartesi","Salı","Çarşamba","Perşembe","Cuma","Cumartesi"]},months:{shorthand:["Oca","Şub","Mar","Nis","May","Haz","Tem","Ağu","Eyl","Eki","Kas","Ara"],longhand:["Ocak","Şubat","Mart","Nisan","Mayıs","Haziran","Temmuz","Ağustos","Eylül","Ekim","Kasım","Aralık"]},firstDayOfWeek:1,ordinal:function(){return"."},rangeSeparator:" - ",weekAbbreviation:"Hf",scrollTitle:"Artırmak için kaydırın",toggleTitle:"Aç/Kapa",amPM:["ÖÖ","ÖS"],time_24hr:!0};bt.l10ns.tr=Ct,bt.l10ns;var kt=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Nt={firstDayOfWeek:1,weekdays:{shorthand:["Нд","Пн","Вт","Ср","Чт","Пт","Сб"],longhand:["Неділя","Понеділок","Вівторок","Середа","Четвер","П'ятниця","Субота"]},months:{shorthand:["Січ","Лют","Бер","Кві","Тра","Чер","Лип","Сер","Вер","Жов","Лис","Гру"],longhand:["Січень","Лютий","Березень","Квітень","Травень","Червень","Липень","Серпень","Вересень","Жовтень","Листопад","Грудень"]},time_24hr:!0};kt.l10ns.uk=Nt,kt.l10ns;var St=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},jt={weekdays:{shorthand:["Якш","Душ","Сеш","Чор","Пай","Жум","Шан"],longhand:["Якшанба","Душанба","Сешанба","Чоршанба","Пайшанба","Жума","Шанба"]},months:{shorthand:["Янв","Фев","Мар","Апр","Май","Июн","Июл","Авг","Сен","Окт","Ноя","Дек"],longhand:["Январ","Феврал","Март","Апрел","Май","Июн","Июл","Август","Сентябр","Октябр","Ноябр","Декабр"]},firstDayOfWeek:1,ordinal:function(){return""},rangeSeparator:" — ",weekAbbreviation:"Ҳафта",scrollTitle:"Катталаштириш учун айлантиринг",toggleTitle:"Ўтиш учун босинг",amPM:["AM","PM"],yearAriaLabel:"Йил",time_24hr:!0};St.l10ns.uz=jt,St.l10ns;var Et=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Dt={weekdays:{shorthand:["Ya","Du","Se","Cho","Pa","Ju","Sha"],longhand:["Yakshanba","Dushanba","Seshanba","Chorshanba","Payshanba","Juma","Shanba"]},months:{shorthand:["Yan","Fev","Mar","Apr","May","Iyun","Iyul","Avg","Sen","Okt","Noy","Dek"],longhand:["Yanvar","Fevral","Mart","Aprel","May","Iyun","Iyul","Avgust","Sentabr","Oktabr","Noyabr","Dekabr"]},firstDayOfWeek:1,ordinal:function(){return""},rangeSeparator:" — ",weekAbbreviation:"Hafta",scrollTitle:"Kattalashtirish uchun aylantiring",toggleTitle:"O‘tish uchun bosing",amPM:["AM","PM"],yearAriaLabel:"Yil",time_24hr:!0};Et.l10ns.uz_latn=Dt,Et.l10ns;var At=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},yt={weekdays:{shorthand:["CN","T2","T3","T4","T5","T6","T7"],longhand:["Chủ nhật","Thứ hai","Thứ ba","Thứ tư","Thứ năm","Thứ sáu","Thứ bảy"]},months:{shorthand:["Th1","Th2","Th3","Th4","Th5","Th6","Th7","Th8","Th9","Th10","Th11","Th12"],longhand:["Tháng một","Tháng hai","Tháng ba","Tháng tư","Tháng năm","Tháng sáu","Tháng bảy","Tháng tám","Tháng chín","Tháng mười","Tháng mười một","Tháng mười hai"]},firstDayOfWeek:1,rangeSeparator:" đến "};At.l10ns.vn=yt,At.l10ns;var Mt=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Tt={weekdays:{shorthand:["周日","周一","周二","周三","周四","周五","周六"],longhand:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},months:{shorthand:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],longhand:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},rangeSeparator:" 至 ",weekAbbreviation:"周",scrollTitle:"滚动切换",toggleTitle:"点击切换 12/24 小时时制"};Mt.l10ns.zh=Tt,Mt.l10ns;var Ot=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Lt={weekdays:{shorthand:["週日","週一","週二","週三","週四","週五","週六"],longhand:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},months:{shorthand:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],longhand:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},rangeSeparator:" 至 ",weekAbbreviation:"週",scrollTitle:"滾動切換",toggleTitle:"點擊切換 12/24 小時時制"};Ot.l10ns.zh_tw=Lt,Ot.l10ns;var br={ar:l,at:g,az:u,be:d,bg:b,bn:S,bs:w,ca:x,ckb:v,cat:x,cs:_,cy:y,da:A,de:F,default:o({},K),en:K,eo:I,es:B,et:Z,fa:q,fi:ae,fo:ue,fr:Ne,gr:xe,he:ve,hi:Se,hr:De,hu:Ae,hy:je,id:G,is:ne,it:R,ja:J,ka:oe,ko:Le,km:Tn,kz:Ln,lt:Rn,lv:Pn,mk:Fn,mn:Hn,ms:vr,my:Un,nl:Wn,nn:Jn,no:Kn,pa:qn,pl:Qn,pt:nt,ro:ot,ru:it,si:at,sk:ct,sl:dt,sq:ft,sr:wt,sv:pt,th:vt,tr:Ct,uk:Nt,vn:yt,zh:Tt,zh_tw:Lt,uz:jt,uz_latn:Dt};t.default=br,Object.defineProperty(t,"__esModule",{value:!0})}))})(Ue,Ue.exports)),Ue.exports}var ni=ei();const ti=Ro(ni);var Ke={exports:{}},oi=Ke.exports,Ft;function ri(){return Ft||(Ft=1,(function(e,n){(function(t,o){e.exports=o()})(oi,(function(){/*! *****************************************************************************
26
+ ***************************************************************************** */var o=function(){return o=Object.assign||function(je){for(var We,ln=1,Cr=arguments.length;ln<Cr;ln++){We=arguments[ln];for(var sn in We)Object.prototype.hasOwnProperty.call(We,sn)&&(je[sn]=We[sn])}return je},o.apply(this,arguments)},r=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},i={weekdays:{shorthand:["أحد","اثنين","ثلاثاء","أربعاء","خميس","جمعة","سبت"],longhand:["الأحد","الاثنين","الثلاثاء","الأربعاء","الخميس","الجمعة","السبت"]},months:{shorthand:["1","2","3","4","5","6","7","8","9","10","11","12"],longhand:["يناير","فبراير","مارس","أبريل","مايو","يونيو","يوليو","أغسطس","سبتمبر","أكتوبر","نوفمبر","ديسمبر"]},firstDayOfWeek:6,rangeSeparator:" إلى ",weekAbbreviation:"Wk",scrollTitle:"قم بالتمرير للزيادة",toggleTitle:"اضغط للتبديل",amPM:["ص","م"],yearAriaLabel:"سنة",monthAriaLabel:"شهر",hourAriaLabel:"ساعة",minuteAriaLabel:"دقيقة",time_24hr:!1};r.l10ns.ar=i,r.l10ns;var u=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},f={weekdays:{shorthand:["So","Mo","Di","Mi","Do","Fr","Sa"],longhand:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"]},months:{shorthand:["Jän","Feb","Mär","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"],longhand:["Jänner","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"]},firstDayOfWeek:1,weekAbbreviation:"KW",rangeSeparator:" bis ",scrollTitle:"Zum Ändern scrollen",toggleTitle:"Zum Umschalten klicken",time_24hr:!0};u.l10ns.at=f,u.l10ns;var s=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},c={weekdays:{shorthand:["B.","B.e.","Ç.a.","Ç.","C.a.","C.","Ş."],longhand:["Bazar","Bazar ertəsi","Çərşənbə axşamı","Çərşənbə","Cümə axşamı","Cümə","Şənbə"]},months:{shorthand:["Yan","Fev","Mar","Apr","May","İyn","İyl","Avq","Sen","Okt","Noy","Dek"],longhand:["Yanvar","Fevral","Mart","Aprel","May","İyun","İyul","Avqust","Sentyabr","Oktyabr","Noyabr","Dekabr"]},firstDayOfWeek:1,ordinal:function(){return"."},rangeSeparator:" - ",weekAbbreviation:"Hf",scrollTitle:"Artırmaq üçün sürüşdürün",toggleTitle:"Aç / Bağla",amPM:["GƏ","GS"],time_24hr:!0};s.l10ns.az=c,s.l10ns;var a=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},d={weekdays:{shorthand:["Нд","Пн","Аў","Ср","Чц","Пт","Сб"],longhand:["Нядзеля","Панядзелак","Аўторак","Серада","Чацвер","Пятніца","Субота"]},months:{shorthand:["Сту","Лют","Сак","Кра","Тра","Чэр","Ліп","Жні","Вер","Кас","Ліс","Сне"],longhand:["Студзень","Люты","Сакавік","Красавік","Травень","Чэрвень","Ліпень","Жнівень","Верасень","Кастрычнік","Лістапад","Снежань"]},firstDayOfWeek:1,ordinal:function(){return""},rangeSeparator:" — ",weekAbbreviation:"Тыд.",scrollTitle:"Пракруціце для павелічэння",toggleTitle:"Націсніце для пераключэння",amPM:["ДП","ПП"],yearAriaLabel:"Год",time_24hr:!0};a.l10ns.be=d,a.l10ns;var g=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},w={firstDayOfWeek:1,weekdays:{shorthand:["Ned","Pon","Uto","Sri","Čet","Pet","Sub"],longhand:["Nedjelja","Ponedjeljak","Utorak","Srijeda","Četvrtak","Petak","Subota"]},months:{shorthand:["Jan","Feb","Mar","Apr","Maj","Jun","Jul","Avg","Sep","Okt","Nov","Dec"],longhand:["Januar","Februar","Mart","April","Maj","Juni","Juli","Avgust","Septembar","Oktobar","Novembar","Decembar"]},time_24hr:!0};g.l10ns.bs=w,g.l10ns;var m=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},v={weekdays:{shorthand:["Нд","Пн","Вт","Ср","Чт","Пт","Сб"],longhand:["Неделя","Понеделник","Вторник","Сряда","Четвъртък","Петък","Събота"]},months:{shorthand:["Яну","Фев","Март","Апр","Май","Юни","Юли","Авг","Сеп","Окт","Ное","Дек"],longhand:["Януари","Февруари","Март","Април","Май","Юни","Юли","Август","Септември","Октомври","Ноември","Декември"]},time_24hr:!0,firstDayOfWeek:1};m.l10ns.bg=v,m.l10ns;var p=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},b={weekdays:{shorthand:["রবি","সোম","মঙ্গল","বুধ","বৃহস্পতি","শুক্র","শনি"],longhand:["রবিবার","সোমবার","মঙ্গলবার","বুধবার","বৃহস্পতিবার","শুক্রবার","শনিবার"]},months:{shorthand:["জানু","ফেব্রু","মার্চ","এপ্রিল","মে","জুন","জুলাই","আগ","সেপ্টে","অক্টো","নভে","ডিসে"],longhand:["জানুয়ারী","ফেব্রুয়ারী","মার্চ","এপ্রিল","মে","জুন","জুলাই","আগস্ট","সেপ্টেম্বর","অক্টোবর","নভেম্বর","ডিসেম্বর"]}};p.l10ns.bn=b,p.l10ns;var k=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},x={weekdays:{shorthand:["Dg","Dl","Dt","Dc","Dj","Dv","Ds"],longhand:["Diumenge","Dilluns","Dimarts","Dimecres","Dijous","Divendres","Dissabte"]},months:{shorthand:["Gen","Febr","Març","Abr","Maig","Juny","Jul","Ag","Set","Oct","Nov","Des"],longhand:["Gener","Febrer","Març","Abril","Maig","Juny","Juliol","Agost","Setembre","Octubre","Novembre","Desembre"]},ordinal:function(Q){var je=Q%100;if(je>3&&je<21)return"è";switch(je%10){case 1:return"r";case 2:return"n";case 3:return"r";case 4:return"t";default:return"è"}},firstDayOfWeek:1,rangeSeparator:" a ",time_24hr:!0};k.l10ns.cat=k.l10ns.ca=x,k.l10ns;var N=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},C={weekdays:{shorthand:["یەکشەممە","دووشەممە","سێشەممە","چوارشەممە","پێنجشەممە","هەینی","شەممە"],longhand:["یەکشەممە","دووشەممە","سێشەممە","چوارشەممە","پێنجشەممە","هەینی","شەممە"]},months:{shorthand:["ڕێبەندان","ڕەشەمە","نەورۆز","گوڵان","جۆزەردان","پووشپەڕ","گەلاوێژ","خەرمانان","ڕەزبەر","گەڵاڕێزان","سەرماوەز","بەفرانبار"],longhand:["ڕێبەندان","ڕەشەمە","نەورۆز","گوڵان","جۆزەردان","پووشپەڕ","گەلاوێژ","خەرمانان","ڕەزبەر","گەڵاڕێزان","سەرماوەز","بەفرانبار"]},firstDayOfWeek:6,ordinal:function(){return""}};N.l10ns.ckb=C,N.l10ns;var j=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},R={weekdays:{shorthand:["Ne","Po","Út","St","Čt","Pá","So"],longhand:["Neděle","Pondělí","Úterý","Středa","Čtvrtek","Pátek","Sobota"]},months:{shorthand:["Led","Ún","Bře","Dub","Kvě","Čer","Čvc","Srp","Zář","Říj","Lis","Pro"],longhand:["Leden","Únor","Březen","Duben","Květen","Červen","Červenec","Srpen","Září","Říjen","Listopad","Prosinec"]},firstDayOfWeek:1,ordinal:function(){return"."},rangeSeparator:" do ",weekAbbreviation:"Týd.",scrollTitle:"Rolujte pro změnu",toggleTitle:"Přepnout dopoledne/odpoledne",amPM:["dop.","odp."],yearAriaLabel:"Rok",time_24hr:!0};j.l10ns.cs=R,j.l10ns;var M=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},L={weekdays:{shorthand:["Sul","Llun","Maw","Mer","Iau","Gwe","Sad"],longhand:["Dydd Sul","Dydd Llun","Dydd Mawrth","Dydd Mercher","Dydd Iau","Dydd Gwener","Dydd Sadwrn"]},months:{shorthand:["Ion","Chwef","Maw","Ebr","Mai","Meh","Gorff","Awst","Medi","Hyd","Tach","Rhag"],longhand:["Ionawr","Chwefror","Mawrth","Ebrill","Mai","Mehefin","Gorffennaf","Awst","Medi","Hydref","Tachwedd","Rhagfyr"]},firstDayOfWeek:1,ordinal:function(Q){return Q===1?"af":Q===2?"ail":Q===3||Q===4?"ydd":Q===5||Q===6?"ed":Q>=7&&Q<=10||Q==12||Q==15||Q==18||Q==20?"fed":Q==11||Q==13||Q==14||Q==16||Q==17||Q==19?"eg":Q>=21&&Q<=39?"ain":""},time_24hr:!0};M.l10ns.cy=L,M.l10ns;var S=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},D={weekdays:{shorthand:["søn","man","tir","ons","tors","fre","lør"],longhand:["søndag","mandag","tirsdag","onsdag","torsdag","fredag","lørdag"]},months:{shorthand:["jan","feb","mar","apr","maj","jun","jul","aug","sep","okt","nov","dec"],longhand:["januar","februar","marts","april","maj","juni","juli","august","september","oktober","november","december"]},ordinal:function(){return"."},firstDayOfWeek:1,rangeSeparator:" til ",weekAbbreviation:"uge",time_24hr:!0};S.l10ns.da=D,S.l10ns;var O=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},B={weekdays:{shorthand:["So","Mo","Di","Mi","Do","Fr","Sa"],longhand:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"]},months:{shorthand:["Jan","Feb","Mär","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"],longhand:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"]},firstDayOfWeek:1,weekAbbreviation:"KW",rangeSeparator:" bis ",scrollTitle:"Zum Ändern scrollen",toggleTitle:"Zum Umschalten klicken",time_24hr:!0};O.l10ns.de=B,O.l10ns;var W={weekdays:{shorthand:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],longhand:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},months:{shorthand:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],longhand:["January","February","March","April","May","June","July","August","September","October","November","December"]},daysInMonth:[31,28,31,30,31,30,31,31,30,31,30,31],firstDayOfWeek:0,ordinal:function(Q){var je=Q%100;if(je>3&&je<21)return"th";switch(je%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},rangeSeparator:" to ",weekAbbreviation:"Wk",scrollTitle:"Scroll to increment",toggleTitle:"Click to toggle",amPM:["AM","PM"],yearAriaLabel:"Year",monthAriaLabel:"Month",hourAriaLabel:"Hour",minuteAriaLabel:"Minute",time_24hr:!1},F=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},_={firstDayOfWeek:1,rangeSeparator:" ĝis ",weekAbbreviation:"Sem",scrollTitle:"Rulumu por pligrandigi la valoron",toggleTitle:"Klaku por ŝalti",weekdays:{shorthand:["Dim","Lun","Mar","Mer","Ĵaŭ","Ven","Sab"],longhand:["dimanĉo","lundo","mardo","merkredo","ĵaŭdo","vendredo","sabato"]},months:{shorthand:["Jan","Feb","Mar","Apr","Maj","Jun","Jul","Aŭg","Sep","Okt","Nov","Dec"],longhand:["januaro","februaro","marto","aprilo","majo","junio","julio","aŭgusto","septembro","oktobro","novembro","decembro"]},ordinal:function(){return"-a"},time_24hr:!0};F.l10ns.eo=_,F.l10ns;var G=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},H={weekdays:{shorthand:["Dom","Lun","Mar","Mié","Jue","Vie","Sáb"],longhand:["Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado"]},months:{shorthand:["Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"],longhand:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"]},ordinal:function(){return"º"},firstDayOfWeek:1,rangeSeparator:" a ",time_24hr:!0};G.l10ns.es=H,G.l10ns;var U=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Y={weekdays:{shorthand:["P","E","T","K","N","R","L"],longhand:["Pühapäev","Esmaspäev","Teisipäev","Kolmapäev","Neljapäev","Reede","Laupäev"]},months:{shorthand:["Jaan","Veebr","Märts","Apr","Mai","Juuni","Juuli","Aug","Sept","Okt","Nov","Dets"],longhand:["Jaanuar","Veebruar","Märts","Aprill","Mai","Juuni","Juuli","August","September","Oktoober","November","Detsember"]},firstDayOfWeek:1,ordinal:function(){return"."},weekAbbreviation:"Näd",rangeSeparator:" kuni ",scrollTitle:"Keri, et suurendada",toggleTitle:"Klõpsa, et vahetada",time_24hr:!0};U.l10ns.et=Y,U.l10ns;var J=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},K={weekdays:{shorthand:["یک","دو","سه","چهار","پنج","جمعه","شنبه"],longhand:["یک‌شنبه","دوشنبه","سه‌شنبه","چهارشنبه","پنچ‌شنبه","جمعه","شنبه"]},months:{shorthand:["ژانویه","فوریه","مارس","آوریل","مه","ژوئن","ژوئیه","اوت","سپتامبر","اکتبر","نوامبر","دسامبر"],longhand:["ژانویه","فوریه","مارس","آوریل","مه","ژوئن","ژوئیه","اوت","سپتامبر","اکتبر","نوامبر","دسامبر"]},firstDayOfWeek:6,ordinal:function(){return""}};J.l10ns.fa=K,J.l10ns;var re=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},ce={firstDayOfWeek:1,weekdays:{shorthand:["su","ma","ti","ke","to","pe","la"],longhand:["sunnuntai","maanantai","tiistai","keskiviikko","torstai","perjantai","lauantai"]},months:{shorthand:["tammi","helmi","maalis","huhti","touko","kesä","heinä","elo","syys","loka","marras","joulu"],longhand:["tammikuu","helmikuu","maaliskuu","huhtikuu","toukokuu","kesäkuu","heinäkuu","elokuu","syyskuu","lokakuu","marraskuu","joulukuu"]},ordinal:function(){return"."},time_24hr:!0};re.l10ns.fi=ce,re.l10ns;var ae=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},de={weekdays:{shorthand:["Sun","Mán","Týs","Mik","Hós","Frí","Ley"],longhand:["Sunnudagur","Mánadagur","Týsdagur","Mikudagur","Hósdagur","Fríggjadagur","Leygardagur"]},months:{shorthand:["Jan","Feb","Mar","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Des"],longhand:["Januar","Februar","Mars","Apríl","Mai","Juni","Juli","August","Septembur","Oktobur","Novembur","Desembur"]},ordinal:function(){return"."},firstDayOfWeek:1,rangeSeparator:" til ",weekAbbreviation:"vika",scrollTitle:"Rulla fyri at broyta",toggleTitle:"Trýst fyri at skifta",yearAriaLabel:"Ár",time_24hr:!0};ae.l10ns.fo=de,ae.l10ns;var le=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},ue={firstDayOfWeek:1,weekdays:{shorthand:["dim","lun","mar","mer","jeu","ven","sam"],longhand:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"]},months:{shorthand:["janv","févr","mars","avr","mai","juin","juil","août","sept","oct","nov","déc"],longhand:["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"]},ordinal:function(Q){return Q>1?"":"er"},rangeSeparator:" au ",weekAbbreviation:"Sem",scrollTitle:"Défiler pour augmenter la valeur",toggleTitle:"Cliquer pour basculer",time_24hr:!0};le.l10ns.fr=ue,le.l10ns;var xe=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},be={weekdays:{shorthand:["Κυ","Δε","Τρ","Τε","Πέ","Πα","Σά"],longhand:["Κυριακή","Δευτέρα","Τρίτη","Τετάρτη","Πέμπτη","Παρασκευή","Σάββατο"]},months:{shorthand:["Ιαν","Φεβ","Μάρ","Απρ","Μάι","Ιούν","Ιούλ","Αύγ","Σεπ","Οκτ","Νοέ","Δεκ"],longhand:["Ιανουάριος","Φεβρουάριος","Μάρτιος","Απρίλιος","Μάιος","Ιούνιος","Ιούλιος","Αύγουστος","Σεπτέμβριος","Οκτώβριος","Νοέμβριος","Δεκέμβριος"]},firstDayOfWeek:1,ordinal:function(){return""},weekAbbreviation:"Εβδ",rangeSeparator:" έως ",scrollTitle:"Μετακυλήστε για προσαύξηση",toggleTitle:"Κάντε κλικ για αλλαγή",amPM:["ΠΜ","ΜΜ"],yearAriaLabel:"χρόνος",monthAriaLabel:"μήνας",hourAriaLabel:"ώρα",minuteAriaLabel:"λεπτό"};xe.l10ns.gr=be,xe.l10ns;var he=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},ie={weekdays:{shorthand:["א","ב","ג","ד","ה","ו","ש"],longhand:["ראשון","שני","שלישי","רביעי","חמישי","שישי","שבת"]},months:{shorthand:["ינו׳","פבר׳","מרץ","אפר׳","מאי","יוני","יולי","אוג׳","ספט׳","אוק׳","נוב׳","דצמ׳"],longhand:["ינואר","פברואר","מרץ","אפריל","מאי","יוני","יולי","אוגוסט","ספטמבר","אוקטובר","נובמבר","דצמבר"]},rangeSeparator:" אל ",time_24hr:!0};he.l10ns.he=ie,he.l10ns;var Ae=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Ce={weekdays:{shorthand:["रवि","सोम","मंगल","बुध","गुरु","शुक्र","शनि"],longhand:["रविवार","सोमवार","मंगलवार","बुधवार","गुरुवार","शुक्रवार","शनिवार"]},months:{shorthand:["जन","फर","मार्च","अप्रेल","मई","जून","जूलाई","अग","सित","अक्ट","नव","दि"],longhand:["जनवरी ","फरवरी","मार्च","अप्रेल","मई","जून","जूलाई","अगस्त ","सितम्बर","अक्टूबर","नवम्बर","दिसम्बर"]}};Ae.l10ns.hi=Ce,Ae.l10ns;var ye=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},ve={firstDayOfWeek:1,weekdays:{shorthand:["Ned","Pon","Uto","Sri","Čet","Pet","Sub"],longhand:["Nedjelja","Ponedjeljak","Utorak","Srijeda","Četvrtak","Petak","Subota"]},months:{shorthand:["Sij","Velj","Ožu","Tra","Svi","Lip","Srp","Kol","Ruj","Lis","Stu","Pro"],longhand:["Siječanj","Veljača","Ožujak","Travanj","Svibanj","Lipanj","Srpanj","Kolovoz","Rujan","Listopad","Studeni","Prosinac"]},time_24hr:!0};ye.l10ns.hr=ve,ye.l10ns;var ke=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},me={firstDayOfWeek:1,weekdays:{shorthand:["V","H","K","Sz","Cs","P","Szo"],longhand:["Vasárnap","Hétfő","Kedd","Szerda","Csütörtök","Péntek","Szombat"]},months:{shorthand:["Jan","Feb","Már","Ápr","Máj","Jún","Júl","Aug","Szep","Okt","Nov","Dec"],longhand:["Január","Február","Március","Április","Május","Június","Július","Augusztus","Szeptember","Október","November","December"]},ordinal:function(){return"."},weekAbbreviation:"Hét",scrollTitle:"Görgessen",toggleTitle:"Kattintson a váltáshoz",rangeSeparator:" - ",time_24hr:!0};ke.l10ns.hu=me,ke.l10ns;var Se=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Ne={weekdays:{shorthand:["Կիր","Երկ","Երք","Չրք","Հնգ","Ուրբ","Շբթ"],longhand:["Կիրակի","Եկուշաբթի","Երեքշաբթի","Չորեքշաբթի","Հինգշաբթի","Ուրբաթ","Շաբաթ"]},months:{shorthand:["Հնվ","Փտր","Մար","Ապր","Մայ","Հնս","Հլս","Օգս","Սեպ","Հոկ","Նմբ","Դեկ"],longhand:["Հունվար","Փետրվար","Մարտ","Ապրիլ","Մայիս","Հունիս","Հուլիս","Օգոստոս","Սեպտեմբեր","Հոկտեմբեր","Նոյեմբեր","Դեկտեմբեր"]},firstDayOfWeek:1,ordinal:function(){return""},rangeSeparator:" — ",weekAbbreviation:"ՇԲՏ",scrollTitle:"Ոլորեք՝ մեծացնելու համար",toggleTitle:"Սեղմեք՝ փոխելու համար",amPM:["ՄԿ","ԿՀ"],yearAriaLabel:"Տարի",monthAriaLabel:"Ամիս",hourAriaLabel:"Ժամ",minuteAriaLabel:"Րոպե",time_24hr:!0};Se.l10ns.hy=Ne,Se.l10ns;var P=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},y={weekdays:{shorthand:["Min","Sen","Sel","Rab","Kam","Jum","Sab"],longhand:["Minggu","Senin","Selasa","Rabu","Kamis","Jumat","Sabtu"]},months:{shorthand:["Jan","Feb","Mar","Apr","Mei","Jun","Jul","Agu","Sep","Okt","Nov","Des"],longhand:["Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember"]},firstDayOfWeek:1,ordinal:function(){return""},time_24hr:!0,rangeSeparator:" - "};P.l10ns.id=y,P.l10ns;var T=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},I={weekdays:{shorthand:["Sun","Mán","Þri","Mið","Fim","Fös","Lau"],longhand:["Sunnudagur","Mánudagur","Þriðjudagur","Miðvikudagur","Fimmtudagur","Föstudagur","Laugardagur"]},months:{shorthand:["Jan","Feb","Mar","Apr","Maí","Jún","Júl","Ágú","Sep","Okt","Nóv","Des"],longhand:["Janúar","Febrúar","Mars","Apríl","Maí","Júní","Júlí","Ágúst","September","Október","Nóvember","Desember"]},ordinal:function(){return"."},firstDayOfWeek:1,rangeSeparator:" til ",weekAbbreviation:"vika",yearAriaLabel:"Ár",time_24hr:!0};T.l10ns.is=I,T.l10ns;var z=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},$={weekdays:{shorthand:["Dom","Lun","Mar","Mer","Gio","Ven","Sab"],longhand:["Domenica","Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato"]},months:{shorthand:["Gen","Feb","Mar","Apr","Mag","Giu","Lug","Ago","Set","Ott","Nov","Dic"],longhand:["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"]},firstDayOfWeek:1,ordinal:function(){return"°"},rangeSeparator:" al ",weekAbbreviation:"Se",scrollTitle:"Scrolla per aumentare",toggleTitle:"Clicca per cambiare",time_24hr:!0};z.l10ns.it=$,z.l10ns;var X=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},ge={weekdays:{shorthand:["日","月","火","水","木","金","土"],longhand:["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"]},months:{shorthand:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],longhand:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"]},time_24hr:!0,rangeSeparator:" から ",monthAriaLabel:"月",amPM:["午前","午後"],yearAriaLabel:"年",hourAriaLabel:"時間",minuteAriaLabel:"分"};X.l10ns.ja=ge,X.l10ns;var Te=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},En={weekdays:{shorthand:["კვ","ორ","სა","ოთ","ხუ","პა","შა"],longhand:["კვირა","ორშაბათი","სამშაბათი","ოთხშაბათი","ხუთშაბათი","პარასკევი","შაბათი"]},months:{shorthand:["იან","თებ","მარ","აპრ","მაი","ივნ","ივლ","აგვ","სექ","ოქტ","ნოე","დეკ"],longhand:["იანვარი","თებერვალი","მარტი","აპრილი","მაისი","ივნისი","ივლისი","აგვისტო","სექტემბერი","ოქტომბერი","ნოემბერი","დეკემბერი"]},firstDayOfWeek:1,ordinal:function(){return""},rangeSeparator:" — ",weekAbbreviation:"კვ.",scrollTitle:"დასქროლეთ გასადიდებლად",toggleTitle:"დააკლიკეთ გადართვისთვის",amPM:["AM","PM"],yearAriaLabel:"წელი",time_24hr:!0};Te.l10ns.ka=En,Te.l10ns;var Dn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},An={weekdays:{shorthand:["일","월","화","수","목","금","토"],longhand:["일요일","월요일","화요일","수요일","목요일","금요일","토요일"]},months:{shorthand:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],longhand:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"]},ordinal:function(){return"일"},rangeSeparator:" ~ ",amPM:["오전","오후"]};Dn.l10ns.ko=An,Dn.l10ns;var yn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Tn={weekdays:{shorthand:["អាទិត្យ","ចន្ទ","អង្គារ","ពុធ","ព្រហស.","សុក្រ","សៅរ៍"],longhand:["អាទិត្យ","ចន្ទ","អង្គារ","ពុធ","ព្រហស្បតិ៍","សុក្រ","សៅរ៍"]},months:{shorthand:["មករា","កុម្ភះ","មីនា","មេសា","ឧសភា","មិថុនា","កក្កដា","សីហា","កញ្ញា","តុលា","វិច្ឆិកា","ធ្នូ"],longhand:["មករា","កុម្ភះ","មីនា","មេសា","ឧសភា","មិថុនា","កក្កដា","សីហា","កញ្ញា","តុលា","វិច្ឆិកា","ធ្នូ"]},ordinal:function(){return""},firstDayOfWeek:1,rangeSeparator:" ដល់ ",weekAbbreviation:"សប្តាហ៍",scrollTitle:"រំកិលដើម្បីបង្កើន",toggleTitle:"ចុចដើម្បីផ្លាស់ប្ដូរ",yearAriaLabel:"ឆ្នាំ",time_24hr:!0};yn.l10ns.km=Tn,yn.l10ns;var Mn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},On={weekdays:{shorthand:["Жс","Дс","Сc","Ср","Бс","Жм","Сб"],longhand:["Жексенбi","Дүйсенбi","Сейсенбi","Сәрсенбi","Бейсенбi","Жұма","Сенбi"]},months:{shorthand:["Қаң","Ақп","Нау","Сәу","Мам","Мау","Шiл","Там","Қыр","Қаз","Қар","Жел"],longhand:["Қаңтар","Ақпан","Наурыз","Сәуiр","Мамыр","Маусым","Шiлде","Тамыз","Қыркүйек","Қазан","Қараша","Желтоқсан"]},firstDayOfWeek:1,ordinal:function(){return""},rangeSeparator:" — ",weekAbbreviation:"Апта",scrollTitle:"Үлкейту үшін айналдырыңыз",toggleTitle:"Ауыстыру үшін басыңыз",amPM:["ТД","ТК"],yearAriaLabel:"Жыл"};Mn.l10ns.kz=On,Mn.l10ns;var Ln=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Rn={weekdays:{shorthand:["S","Pr","A","T","K","Pn","Š"],longhand:["Sekmadienis","Pirmadienis","Antradienis","Trečiadienis","Ketvirtadienis","Penktadienis","Šeštadienis"]},months:{shorthand:["Sau","Vas","Kov","Bal","Geg","Bir","Lie","Rgp","Rgs","Spl","Lap","Grd"],longhand:["Sausis","Vasaris","Kovas","Balandis","Gegužė","Birželis","Liepa","Rugpjūtis","Rugsėjis","Spalis","Lapkritis","Gruodis"]},firstDayOfWeek:1,ordinal:function(){return"-a"},rangeSeparator:" iki ",weekAbbreviation:"Sav",scrollTitle:"Keisti laiką pelės rateliu",toggleTitle:"Perjungti laiko formatą",time_24hr:!0};Ln.l10ns.lt=Rn,Ln.l10ns;var _n=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},In={firstDayOfWeek:1,weekdays:{shorthand:["Sv","Pr","Ot","Tr","Ce","Pk","Se"],longhand:["Svētdiena","Pirmdiena","Otrdiena","Trešdiena","Ceturtdiena","Piektdiena","Sestdiena"]},months:{shorthand:["Jan","Feb","Mar","Apr","Mai","Jūn","Jūl","Aug","Sep","Okt","Nov","Dec"],longhand:["Janvāris","Februāris","Marts","Aprīlis","Maijs","Jūnijs","Jūlijs","Augusts","Septembris","Oktobris","Novembris","Decembris"]},rangeSeparator:" līdz ",time_24hr:!0};_n.l10ns.lv=In,_n.l10ns;var Pn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Vn={weekdays:{shorthand:["Не","По","Вт","Ср","Че","Пе","Са"],longhand:["Недела","Понеделник","Вторник","Среда","Четврток","Петок","Сабота"]},months:{shorthand:["Јан","Фев","Мар","Апр","Мај","Јун","Јул","Авг","Сеп","Окт","Ное","Дек"],longhand:["Јануари","Февруари","Март","Април","Мај","Јуни","Јули","Август","Септември","Октомври","Ноември","Декември"]},firstDayOfWeek:1,weekAbbreviation:"Нед.",rangeSeparator:" до ",time_24hr:!0};Pn.l10ns.mk=Vn,Pn.l10ns;var Fn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Bn={firstDayOfWeek:1,weekdays:{shorthand:["Да","Мя","Лх","Пү","Ба","Бя","Ня"],longhand:["Даваа","Мягмар","Лхагва","Пүрэв","Баасан","Бямба","Ням"]},months:{shorthand:["1-р сар","2-р сар","3-р сар","4-р сар","5-р сар","6-р сар","7-р сар","8-р сар","9-р сар","10-р сар","11-р сар","12-р сар"],longhand:["Нэгдүгээр сар","Хоёрдугаар сар","Гуравдугаар сар","Дөрөвдүгээр сар","Тавдугаар сар","Зургаадугаар сар","Долдугаар сар","Наймдугаар сар","Есдүгээр сар","Аравдугаар сар","Арваннэгдүгээр сар","Арванхоёрдугаар сар"]},rangeSeparator:"-с ",time_24hr:!0};Fn.l10ns.mn=Bn,Fn.l10ns;var xr=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},vr={weekdays:{shorthand:["Aha","Isn","Sel","Rab","Kha","Jum","Sab"],longhand:["Ahad","Isnin","Selasa","Rabu","Khamis","Jumaat","Sabtu"]},months:{shorthand:["Jan","Feb","Mac","Apr","Mei","Jun","Jul","Ogo","Sep","Okt","Nov","Dis"],longhand:["Januari","Februari","Mac","April","Mei","Jun","Julai","Ogos","September","Oktober","November","Disember"]},firstDayOfWeek:1,ordinal:function(){return""}};xr.l10ns;var Hn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Gn={weekdays:{shorthand:["နွေ","လာ","ဂါ","ဟူး","ကြာ","သော","နေ"],longhand:["တနင်္ဂနွေ","တနင်္လာ","အင်္ဂါ","ဗုဒ္ဓဟူး","ကြာသပတေး","သောကြာ","စနေ"]},months:{shorthand:["ဇန်","ဖေ","မတ်","ပြီ","မေ","ဇွန်","လိုင်","သြ","စက်","အောက်","နို","ဒီ"],longhand:["ဇန်နဝါရီ","ဖေဖော်ဝါရီ","မတ်","ဧပြီ","မေ","ဇွန်","ဇူလိုင်","သြဂုတ်","စက်တင်ဘာ","အောက်တိုဘာ","နိုဝင်ဘာ","ဒီဇင်ဘာ"]},firstDayOfWeek:1,ordinal:function(){return""},time_24hr:!0};Hn.l10ns.my=Gn,Hn.l10ns;var zn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Wn={weekdays:{shorthand:["zo","ma","di","wo","do","vr","za"],longhand:["zondag","maandag","dinsdag","woensdag","donderdag","vrijdag","zaterdag"]},months:{shorthand:["jan","feb","mrt","apr","mei","jun","jul","aug","sept","okt","nov","dec"],longhand:["januari","februari","maart","april","mei","juni","juli","augustus","september","oktober","november","december"]},firstDayOfWeek:1,weekAbbreviation:"wk",rangeSeparator:" t/m ",scrollTitle:"Scroll voor volgende / vorige",toggleTitle:"Klik om te wisselen",time_24hr:!0,ordinal:function(Q){return Q===1||Q===8||Q>=20?"ste":"de"}};zn.l10ns.nl=Wn,zn.l10ns;var Un=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},$n={weekdays:{shorthand:["Sø.","Må.","Ty.","On.","To.","Fr.","La."],longhand:["Søndag","Måndag","Tysdag","Onsdag","Torsdag","Fredag","Laurdag"]},months:{shorthand:["Jan","Feb","Mars","Apr","Mai","Juni","Juli","Aug","Sep","Okt","Nov","Des"],longhand:["Januar","Februar","Mars","April","Mai","Juni","Juli","August","September","Oktober","November","Desember"]},firstDayOfWeek:1,rangeSeparator:" til ",weekAbbreviation:"Veke",scrollTitle:"Scroll for å endre",toggleTitle:"Klikk for å veksle",time_24hr:!0,ordinal:function(){return"."}};Un.l10ns.nn=$n,Un.l10ns;var Jn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Yn={weekdays:{shorthand:["Søn","Man","Tir","Ons","Tor","Fre","Lør"],longhand:["Søndag","Mandag","Tirsdag","Onsdag","Torsdag","Fredag","Lørdag"]},months:{shorthand:["Jan","Feb","Mar","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Des"],longhand:["Januar","Februar","Mars","April","Mai","Juni","Juli","August","September","Oktober","November","Desember"]},firstDayOfWeek:1,rangeSeparator:" til ",weekAbbreviation:"Uke",scrollTitle:"Scroll for å endre",toggleTitle:"Klikk for å veksle",time_24hr:!0,ordinal:function(){return"."}};Jn.l10ns.no=Yn,Jn.l10ns;var Kn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Zn={weekdays:{shorthand:["ਐਤ","ਸੋਮ","ਮੰਗਲ","ਬੁੱਧ","ਵੀਰ","ਸ਼ੁੱਕਰ","ਸ਼ਨਿੱਚਰ"],longhand:["ਐਤਵਾਰ","ਸੋਮਵਾਰ","ਮੰਗਲਵਾਰ","ਬੁੱਧਵਾਰ","ਵੀਰਵਾਰ","ਸ਼ੁੱਕਰਵਾਰ","ਸ਼ਨਿੱਚਰਵਾਰ"]},months:{shorthand:["ਜਨ","ਫ਼ਰ","ਮਾਰ","ਅਪ੍ਰੈ","ਮਈ","ਜੂਨ","ਜੁਲਾ","ਅਗ","ਸਤੰ","ਅਕ","ਨਵੰ","ਦਸੰ"],longhand:["ਜਨਵਰੀ","ਫ਼ਰਵਰੀ","ਮਾਰਚ","ਅਪ੍ਰੈਲ","ਮਈ","ਜੂਨ","ਜੁਲਾਈ","ਅਗਸਤ","ਸਤੰਬਰ","ਅਕਤੂਬਰ","ਨਵੰਬਰ","ਦਸੰਬਰ"]},time_24hr:!0};Kn.l10ns.pa=Zn,Kn.l10ns;var qn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Xn={weekdays:{shorthand:["Nd","Pn","Wt","Śr","Cz","Pt","So"],longhand:["Niedziela","Poniedziałek","Wtorek","Środa","Czwartek","Piątek","Sobota"]},months:{shorthand:["Sty","Lut","Mar","Kwi","Maj","Cze","Lip","Sie","Wrz","Paź","Lis","Gru"],longhand:["Styczeń","Luty","Marzec","Kwiecień","Maj","Czerwiec","Lipiec","Sierpień","Wrzesień","Październik","Listopad","Grudzień"]},rangeSeparator:" do ",weekAbbreviation:"tydz.",scrollTitle:"Przewiń, aby zwiększyć",toggleTitle:"Kliknij, aby przełączyć",firstDayOfWeek:1,time_24hr:!0,ordinal:function(){return"."}};qn.l10ns.pl=Xn,qn.l10ns;var Qn=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},et={weekdays:{shorthand:["Dom","Seg","Ter","Qua","Qui","Sex","Sáb"],longhand:["Domingo","Segunda-feira","Terça-feira","Quarta-feira","Quinta-feira","Sexta-feira","Sábado"]},months:{shorthand:["Jan","Fev","Mar","Abr","Mai","Jun","Jul","Ago","Set","Out","Nov","Dez"],longhand:["Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"]},rangeSeparator:" até ",time_24hr:!0};Qn.l10ns.pt=et,Qn.l10ns;var nt=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},tt={weekdays:{shorthand:["Dum","Lun","Mar","Mie","Joi","Vin","Sâm"],longhand:["Duminică","Luni","Marți","Miercuri","Joi","Vineri","Sâmbătă"]},months:{shorthand:["Ian","Feb","Mar","Apr","Mai","Iun","Iul","Aug","Sep","Oct","Noi","Dec"],longhand:["Ianuarie","Februarie","Martie","Aprilie","Mai","Iunie","Iulie","August","Septembrie","Octombrie","Noiembrie","Decembrie"]},firstDayOfWeek:1,time_24hr:!0,ordinal:function(){return""}};nt.l10ns.ro=tt,nt.l10ns;var ot=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},rt={weekdays:{shorthand:["Вс","Пн","Вт","Ср","Чт","Пт","Сб"],longhand:["Воскресенье","Понедельник","Вторник","Среда","Четверг","Пятница","Суббота"]},months:{shorthand:["Янв","Фев","Март","Апр","Май","Июнь","Июль","Авг","Сен","Окт","Ноя","Дек"],longhand:["Январь","Февраль","Март","Апрель","Май","Июнь","Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь"]},firstDayOfWeek:1,ordinal:function(){return""},rangeSeparator:" — ",weekAbbreviation:"Нед.",scrollTitle:"Прокрутите для увеличения",toggleTitle:"Нажмите для переключения",amPM:["ДП","ПП"],yearAriaLabel:"Год",time_24hr:!0};ot.l10ns.ru=rt,ot.l10ns;var it=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},lt={weekdays:{shorthand:["ඉ","ස","අ","බ","බ්‍ර","සි","සෙ"],longhand:["ඉරිදා","සඳුදා","අඟහරුවාදා","බදාදා","බ්‍රහස්පතින්දා","සිකුරාදා","සෙනසුරාදා"]},months:{shorthand:["ජන","පෙබ","මාර්","අප්‍රේ","මැයි","ජුනි","ජූලි","අගෝ","සැප්","ඔක්","නොවැ","දෙසැ"],longhand:["ජනවාරි","පෙබරවාරි","මාර්තු","අප්‍රේල්","මැයි","ජුනි","ජූලි","අගෝස්තු","සැප්තැම්බර්","ඔක්තෝබර්","නොවැම්බර්","දෙසැම්බර්"]},time_24hr:!0};it.l10ns.si=lt,it.l10ns;var st=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},at={weekdays:{shorthand:["Ned","Pon","Ut","Str","Štv","Pia","Sob"],longhand:["Nedeľa","Pondelok","Utorok","Streda","Štvrtok","Piatok","Sobota"]},months:{shorthand:["Jan","Feb","Mar","Apr","Máj","Jún","Júl","Aug","Sep","Okt","Nov","Dec"],longhand:["Január","Február","Marec","Apríl","Máj","Jún","Júl","August","September","Október","November","December"]},firstDayOfWeek:1,rangeSeparator:" do ",time_24hr:!0,ordinal:function(){return"."}};st.l10ns.sk=at,st.l10ns;var ct=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},ut={weekdays:{shorthand:["Ned","Pon","Tor","Sre","Čet","Pet","Sob"],longhand:["Nedelja","Ponedeljek","Torek","Sreda","Četrtek","Petek","Sobota"]},months:{shorthand:["Jan","Feb","Mar","Apr","Maj","Jun","Jul","Avg","Sep","Okt","Nov","Dec"],longhand:["Januar","Februar","Marec","April","Maj","Junij","Julij","Avgust","September","Oktober","November","December"]},firstDayOfWeek:1,rangeSeparator:" do ",time_24hr:!0,ordinal:function(){return"."}};ct.l10ns.sl=ut,ct.l10ns;var dt=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},ht={weekdays:{shorthand:["Di","Hë","Ma","Më","En","Pr","Sh"],longhand:["E Diel","E Hënë","E Martë","E Mërkurë","E Enjte","E Premte","E Shtunë"]},months:{shorthand:["Jan","Shk","Mar","Pri","Maj","Qer","Kor","Gus","Sht","Tet","Nën","Dhj"],longhand:["Janar","Shkurt","Mars","Prill","Maj","Qershor","Korrik","Gusht","Shtator","Tetor","Nëntor","Dhjetor"]},firstDayOfWeek:1,rangeSeparator:" deri ",weekAbbreviation:"Java",yearAriaLabel:"Viti",monthAriaLabel:"Muaji",hourAriaLabel:"Ora",minuteAriaLabel:"Minuta",time_24hr:!0};dt.l10ns.sq=ht,dt.l10ns;var ft=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},gt={weekdays:{shorthand:["Ned","Pon","Uto","Sre","Čet","Pet","Sub"],longhand:["Nedelja","Ponedeljak","Utorak","Sreda","Četvrtak","Petak","Subota"]},months:{shorthand:["Jan","Feb","Mar","Apr","Maj","Jun","Jul","Avg","Sep","Okt","Nov","Dec"],longhand:["Januar","Februar","Mart","April","Maj","Jun","Jul","Avgust","Septembar","Oktobar","Novembar","Decembar"]},firstDayOfWeek:1,weekAbbreviation:"Ned.",rangeSeparator:" do ",time_24hr:!0};ft.l10ns.sr=gt,ft.l10ns;var wt=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},mt={firstDayOfWeek:1,weekAbbreviation:"v",weekdays:{shorthand:["sön","mån","tis","ons","tor","fre","lör"],longhand:["söndag","måndag","tisdag","onsdag","torsdag","fredag","lördag"]},months:{shorthand:["jan","feb","mar","apr","maj","jun","jul","aug","sep","okt","nov","dec"],longhand:["januari","februari","mars","april","maj","juni","juli","augusti","september","oktober","november","december"]},rangeSeparator:" till ",time_24hr:!0,ordinal:function(){return"."}};wt.l10ns.sv=mt,wt.l10ns;var pt=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},xt={weekdays:{shorthand:["อา","จ","อ","พ","พฤ","ศ","ส"],longhand:["อาทิตย์","จันทร์","อังคาร","พุธ","พฤหัสบดี","ศุกร์","เสาร์"]},months:{shorthand:["ม.ค.","ก.พ.","มี.ค.","เม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค."],longhand:["มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม"]},firstDayOfWeek:1,rangeSeparator:" ถึง ",scrollTitle:"เลื่อนเพื่อเพิ่มหรือลด",toggleTitle:"คลิกเพื่อเปลี่ยน",time_24hr:!0,ordinal:function(){return""}};pt.l10ns.th=xt,pt.l10ns;var vt=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},bt={weekdays:{shorthand:["Paz","Pzt","Sal","Çar","Per","Cum","Cmt"],longhand:["Pazar","Pazartesi","Salı","Çarşamba","Perşembe","Cuma","Cumartesi"]},months:{shorthand:["Oca","Şub","Mar","Nis","May","Haz","Tem","Ağu","Eyl","Eki","Kas","Ara"],longhand:["Ocak","Şubat","Mart","Nisan","Mayıs","Haziran","Temmuz","Ağustos","Eylül","Ekim","Kasım","Aralık"]},firstDayOfWeek:1,ordinal:function(){return"."},rangeSeparator:" - ",weekAbbreviation:"Hf",scrollTitle:"Artırmak için kaydırın",toggleTitle:"Aç/Kapa",amPM:["ÖÖ","ÖS"],time_24hr:!0};vt.l10ns.tr=bt,vt.l10ns;var Ct=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},kt={firstDayOfWeek:1,weekdays:{shorthand:["Нд","Пн","Вт","Ср","Чт","Пт","Сб"],longhand:["Неділя","Понеділок","Вівторок","Середа","Четвер","П'ятниця","Субота"]},months:{shorthand:["Січ","Лют","Бер","Кві","Тра","Чер","Лип","Сер","Вер","Жов","Лис","Гру"],longhand:["Січень","Лютий","Березень","Квітень","Травень","Червень","Липень","Серпень","Вересень","Жовтень","Листопад","Грудень"]},time_24hr:!0};Ct.l10ns.uk=kt,Ct.l10ns;var St=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Nt={weekdays:{shorthand:["Якш","Душ","Сеш","Чор","Пай","Жум","Шан"],longhand:["Якшанба","Душанба","Сешанба","Чоршанба","Пайшанба","Жума","Шанба"]},months:{shorthand:["Янв","Фев","Мар","Апр","Май","Июн","Июл","Авг","Сен","Окт","Ноя","Дек"],longhand:["Январ","Феврал","Март","Апрел","Май","Июн","Июл","Август","Сентябр","Октябр","Ноябр","Декабр"]},firstDayOfWeek:1,ordinal:function(){return""},rangeSeparator:" — ",weekAbbreviation:"Ҳафта",scrollTitle:"Катталаштириш учун айлантиринг",toggleTitle:"Ўтиш учун босинг",amPM:["AM","PM"],yearAriaLabel:"Йил",time_24hr:!0};St.l10ns.uz=Nt,St.l10ns;var jt=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Et={weekdays:{shorthand:["Ya","Du","Se","Cho","Pa","Ju","Sha"],longhand:["Yakshanba","Dushanba","Seshanba","Chorshanba","Payshanba","Juma","Shanba"]},months:{shorthand:["Yan","Fev","Mar","Apr","May","Iyun","Iyul","Avg","Sen","Okt","Noy","Dek"],longhand:["Yanvar","Fevral","Mart","Aprel","May","Iyun","Iyul","Avgust","Sentabr","Oktabr","Noyabr","Dekabr"]},firstDayOfWeek:1,ordinal:function(){return""},rangeSeparator:" — ",weekAbbreviation:"Hafta",scrollTitle:"Kattalashtirish uchun aylantiring",toggleTitle:"O‘tish uchun bosing",amPM:["AM","PM"],yearAriaLabel:"Yil",time_24hr:!0};jt.l10ns.uz_latn=Et,jt.l10ns;var Dt=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},At={weekdays:{shorthand:["CN","T2","T3","T4","T5","T6","T7"],longhand:["Chủ nhật","Thứ hai","Thứ ba","Thứ tư","Thứ năm","Thứ sáu","Thứ bảy"]},months:{shorthand:["Th1","Th2","Th3","Th4","Th5","Th6","Th7","Th8","Th9","Th10","Th11","Th12"],longhand:["Tháng một","Tháng hai","Tháng ba","Tháng tư","Tháng năm","Tháng sáu","Tháng bảy","Tháng tám","Tháng chín","Tháng mười","Tháng mười một","Tháng mười hai"]},firstDayOfWeek:1,rangeSeparator:" đến "};Dt.l10ns.vn=At,Dt.l10ns;var yt=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Tt={weekdays:{shorthand:["周日","周一","周二","周三","周四","周五","周六"],longhand:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},months:{shorthand:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],longhand:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},rangeSeparator:" 至 ",weekAbbreviation:"周",scrollTitle:"滚动切换",toggleTitle:"点击切换 12/24 小时时制"};yt.l10ns.zh=Tt,yt.l10ns;var Mt=typeof window<"u"&&window.flatpickr!==void 0?window.flatpickr:{l10ns:{}},Ot={weekdays:{shorthand:["週日","週一","週二","週三","週四","週五","週六"],longhand:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},months:{shorthand:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],longhand:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},rangeSeparator:" 至 ",weekAbbreviation:"週",scrollTitle:"滾動切換",toggleTitle:"點擊切換 12/24 小時時制"};Mt.l10ns.zh_tw=Ot,Mt.l10ns;var br={ar:i,at:f,az:c,be:d,bg:v,bn:b,bs:w,ca:x,ckb:C,cat:x,cs:R,cy:L,da:D,de:B,default:o({},W),en:W,eo:_,es:H,et:Y,fa:K,fi:ce,fo:de,fr:ue,gr:be,he:ie,hi:Ce,hr:ve,hu:me,hy:Ne,id:y,is:I,it:$,ja:ge,ka:En,ko:An,km:Tn,kz:On,lt:Rn,lv:In,mk:Vn,mn:Bn,ms:vr,my:Gn,nl:Wn,nn:$n,no:Yn,pa:Zn,pl:Xn,pt:et,ro:tt,ru:rt,si:lt,sk:at,sl:ut,sq:ht,sr:gt,sv:mt,th:xt,tr:bt,uk:kt,vn:At,zh:Tt,zh_tw:Ot,uz:Nt,uz_latn:Et};t.default=br,Object.defineProperty(t,"__esModule",{value:!0})}))})(He,He.exports)),He.exports}var ei=Qr();const ni=Lo(ei);var Je={exports:{}},ti=Je.exports,Vt;function oi(){return Vt||(Vt=1,(function(e,n){(function(t,o){e.exports=o()})(ti,(function(){/*! *****************************************************************************
28
27
  Copyright (c) Microsoft Corporation.
29
28
 
30
29
  Permission to use, copy, modify, and/or distribute this software for any
@@ -37,5 +36,5 @@
37
36
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
38
37
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39
38
  PERFORMANCE OF THIS SOFTWARE.
40
- ***************************************************************************** */var t=function(){return t=Object.assign||function(u){for(var s,d=1,f=arguments.length;d<f;d++){s=arguments[d];for(var w in s)Object.prototype.hasOwnProperty.call(s,w)&&(u[w]=s[w])}return u},t.apply(this,arguments)},o=function(a,u,s){return s.months[u?"shorthand":"longhand"][a]};function r(a){for(;a.firstChild;)a.removeChild(a.firstChild)}function l(a){try{if(typeof a.composedPath=="function"){var u=a.composedPath();return u[0]}return a.target}catch{return a.target}}var c={shorthand:!1,dateFormat:"F Y",altFormat:"F Y",theme:"light"};function g(a){var u=t(t({},c),a);return function(s){s.config.dateFormat=u.dateFormat,s.config.altFormat=u.altFormat;var d={monthsContainer:null};function f(){if(s.rContainer){r(s.rContainer);for(var k=0;k<s.monthElements.length;k++){var A=s.monthElements[k];A.parentNode&&A.parentNode.removeChild(A)}}}function w(){s.rContainer&&(d.monthsContainer=s._createElement("div","flatpickr-monthSelect-months"),d.monthsContainer.tabIndex=-1,m(),s.rContainer.appendChild(d.monthsContainer),s.calendarContainer.classList.add("flatpickr-monthSelect-theme-"+u.theme))}function m(){if(d.monthsContainer){r(d.monthsContainer);for(var k=document.createDocumentFragment(),A=0;A<12;A++){var O=s.createDay("flatpickr-monthSelect-month",new Date(s.currentYear,A),0,A);O.dateObj.getMonth()===new Date().getMonth()&&O.dateObj.getFullYear()===new Date().getFullYear()&&O.classList.add("today"),O.textContent=o(A,u.shorthand,s.l10n),O.addEventListener("click",C),k.appendChild(O)}d.monthsContainer.appendChild(k),s.config.minDate&&s.currentYear===s.config.minDate.getFullYear()?s.prevMonthNav.classList.add("flatpickr-disabled"):s.prevMonthNav.classList.remove("flatpickr-disabled"),s.config.maxDate&&s.currentYear===s.config.maxDate.getFullYear()?s.nextMonthNav.classList.add("flatpickr-disabled"):s.nextMonthNav.classList.remove("flatpickr-disabled")}}function b(){s._bind(s.prevMonthNav,"click",function(k){k.preventDefault(),k.stopPropagation(),s.changeYear(s.currentYear-1),S(),m()}),s._bind(s.nextMonthNav,"click",function(k){k.preventDefault(),k.stopPropagation(),s.changeYear(s.currentYear+1),S(),m()}),s._bind(d.monthsContainer,"mouseover",function(k){s.config.mode==="range"&&s.onMouseOver(l(k),"flatpickr-monthSelect-month")})}function p(){if(s.rContainer&&s.selectedDates.length){for(var k=s.rContainer.querySelectorAll(".flatpickr-monthSelect-month.selected"),A=0;A<k.length;A++)k[A].classList.remove("selected");var O=s.selectedDates[0].getMonth(),F=s.rContainer.querySelector(".flatpickr-monthSelect-month:nth-child("+(O+1)+")");F&&F.classList.add("selected")}}function S(){var k=s.selectedDates[0];if(k&&(k=new Date(k),k.setFullYear(s.currentYear),s.config.minDate&&k<s.config.minDate&&(k=s.config.minDate),s.config.maxDate&&k>s.config.maxDate&&(k=s.config.maxDate),s.currentYear=k.getFullYear()),s.currentYearElement.value=String(s.currentYear),s.rContainer){var A=s.rContainer.querySelectorAll(".flatpickr-monthSelect-month");A.forEach(function(O){O.dateObj.setFullYear(s.currentYear),s.config.minDate&&O.dateObj<s.config.minDate||s.config.maxDate&&O.dateObj>s.config.maxDate?O.classList.add("flatpickr-disabled"):O.classList.remove("flatpickr-disabled")})}p()}function C(k){k.preventDefault(),k.stopPropagation();var A=l(k);if(A instanceof Element&&!A.classList.contains("flatpickr-disabled")&&!A.classList.contains("notAllowed")&&(x(A.dateObj),s.config.closeOnSelect)){var O=s.config.mode==="single",F=s.config.mode==="range"&&s.selectedDates.length===2;(O||F)&&s.close()}}function x(k){var A=new Date(s.currentYear,k.getMonth(),k.getDate()),O=[];switch(s.config.mode){case"single":O=[A];break;case"multiple":O.push(A);break;case"range":s.selectedDates.length===2?O=[A]:(O=s.selectedDates.concat([A]),O.sort(function(F,K){return F.getTime()-K.getTime()}));break}s.setDate(O,!0),p()}var N={37:-1,39:1,40:3,38:-3};function v(k,A,O,F){var K=N[F.keyCode]!==void 0;if(!(!K&&F.keyCode!==13)&&!(!s.rContainer||!d.monthsContainer)){var T=s.rContainer.querySelector(".flatpickr-monthSelect-month.selected"),I=Array.prototype.indexOf.call(d.monthsContainer.children,document.activeElement);if(I===-1){var H=T||d.monthsContainer.firstElementChild;H.focus(),I=H.$i}K?d.monthsContainer.children[(12+I+N[F.keyCode])%12].focus():F.keyCode===13&&d.monthsContainer.contains(document.activeElement)&&x(document.activeElement.dateObj)}}function E(){var k;((k=s.config)===null||k===void 0?void 0:k.mode)==="range"&&s.selectedDates.length===1&&s.clear(!1),s.selectedDates.length||m()}function _(){u._stubbedCurrentMonth=s._initialDate.getMonth(),s._initialDate.setMonth(u._stubbedCurrentMonth),s.currentMonth=u._stubbedCurrentMonth}function M(){u._stubbedCurrentMonth&&(s._initialDate.setMonth(u._stubbedCurrentMonth),s.currentMonth=u._stubbedCurrentMonth,delete u._stubbedCurrentMonth)}function y(){if(d.monthsContainer!==null)for(var k=d.monthsContainer.querySelectorAll(".flatpickr-monthSelect-month"),A=0;A<k.length;A++)k[A].removeEventListener("click",C)}return{onParseConfig:function(){s.config.enableTime=!1},onValueUpdate:p,onKeyDown:v,onReady:[_,f,w,b,p,function(){s.config.onClose.push(E),s.loadedPlugins.push("monthSelect")}],onDestroy:[M,y,function(){s.config.onClose=s.config.onClose.filter(function(k){return k!==E})}]}}}return g}))})(Ke)),Ke.exports}var ii=ri();const li=Ro(ii),Bt=(e,n,t,o,r=!1,l)=>{const c={...ti[o]},g=li;r&&(c.firstDayOfWeek=1);const a={minDate:t===ee.CalendarResolution.MONTH?new Date(e.getFullYear(),e.getMonth()):e,maxDate:t===ee.CalendarResolution.MONTH?new Date(n.getFullYear(),n.getMonth()):n,locale:c};return t===ee.CalendarResolution.MONTH?{...a,dateFormat:"M Y",plugins:[new g({shorthand:!0,dateFormat:"M Y"})]}:{...a,monthSelectorType:"static",dateFormat:l||"d.m.Y"}},Ht=e=>{e!=null&&e.setMinutes(e.getMinutes()-e.getTimezoneOffset())},ai={year:"numeric",month:"short",day:"numeric"},en=(e,n)=>(e==null?void 0:e.toLocaleDateString(n,ai))||"",si=(e,n)=>{const{startPeriod:t,endPeriod:o}=e;if(!n.startPeriod&&!n.endPeriod&&t&&o)return{startPeriod:new Date(t==null?void 0:t.getTime()),endPeriod:new Date(o==null?void 0:o.getTime())};const r=t?new Date(Math.max(t.getTime(),n.startPeriod.getTime())):n.startPeriod,l=o?new Date(Math.min(o.getTime(),n.endPeriod.getTime())):n.endPeriod;return{startPeriod:r,endPeriod:l}},ci=(e,n)=>{var a;const{endPeriod:t}=e,o=(t==null?void 0:t.getFullYear())||new Date().getFullYear(),r=o+ +n,l=new Date(+n<0?o:r,(t==null?void 0:t.getMonth())||0,(t==null?void 0:t.getDate())||1),c=new Date(+n<0?r:o,0,1);return{startPeriod:new Date(Math.max(c.getTime(),((a=e==null?void 0:e.startPeriod)==null?void 0:a.getTime())||0)),endPeriod:l}},ui=e=>({quarterly:(e==null?void 0:e.quarterly)||"Q",monthly:(e==null?void 0:e.monthly)||"M"}),di=(e,n)=>{const t=ui(n);return D.isQuarterly(e)&&(t!=null&&t.quarterly)?e==null?void 0:e.replace(/Q/g,t==null?void 0:t.quarterly):D.isMonthly(e)&&(t!=null&&t.monthly)?e==null?void 0:e.replace(/M/g,t==null?void 0:t.monthly):e};var Fe=(e=>(e.FLAT_LIST="FLAT_LIST",e.HIERARCHY="HIERARCHY",e))(Fe||{});const hi=(e,n,t,o)=>(e==null?void 0:e.map(r=>{var a;const l=(a=D.findCodelistByDimension(n==null?void 0:n.codelists,n==null?void 0:n.conceptSchemes,r))==null?void 0:a.codes,c=D.getAvailableCodes(r,t,l,o),g=l==null?void 0:l.some(u=>u==null?void 0:u.parent);return{id:r==null?void 0:r.id,title:D.getDimensionTitle(n==null?void 0:n.conceptSchemes,r,o),dimensionValues:c,isTimeDimension:(r==null?void 0:r.type)===D.DimensionType.TIME_DIMENSION,isHierarchical:g,displayMode:g?Fe.HIERARCHY:Fe.FLAT_LIST}}))||[],Gt=(e,n)=>e==null?void 0:e.map(t=>n&&(t==null?void 0:t.id)===(n==null?void 0:n.id)?{...n,isSelectedFilter:!0}:{...t,isSelectedFilter:!1}),fi=(e,n,t)=>e?e.map(o=>(o==null?void 0:o.id)===n?{...o,displayMode:t}:o):[],Io=e=>(e==null?void 0:e.filter(n=>!!(n!=null&&n.isSelectedValue)))||[],Po=e=>e==null?void 0:e.map(n=>({...n,dimensionValues:Io(n==null?void 0:n.dimensionValues)})).filter(n=>{var t,o,r;return((t=n.dimensionValues)==null?void 0:t.length)||((o=n.timeRange)==null?void 0:o.startPeriod)||((r=n.timeRange)==null?void 0:r.endPeriod)}),gi=e=>(e==null?void 0:e.reduce((n,t)=>{var o;return(((o=t==null?void 0:t.dimensionValues)==null?void 0:o.length)??0)+n},0))||0,Vo=e=>{var n;return{...e,dimensionValues:(n=e==null?void 0:e.dimensionValues)==null?void 0:n.map(t=>({...t,isSelectedValue:!1})),timeRange:void 0}},wi=(e,n)=>e==null?void 0:e.map(t=>(t==null?void 0:t.id)===n?Vo(t):t),mi=e=>e==null?void 0:e.map(n=>Vo(n)),pi=(e,n,t)=>e.map(o=>{var c,g;const r=n==null?void 0:n.filters.find(a=>a.componentCode===o.id);let l=[];if(r)if(o.isTimeDimension){const a=r.values.filter(w=>!!w),u=D.getAnnotationPeriod((c=t==null?void 0:t[0])==null?void 0:c.annotations),s=a[0]?ee.getTimePeriod(a[0]):null,d=a[1]?ee.getTimePeriod(a[1]):null;let f=u;return s&&d&&(f=u?si({startPeriod:s,endPeriod:d},u):{startPeriod:s,endPeriod:d}),{...o,timeRange:f}}else l=(g=o==null?void 0:o.dimensionValues)==null?void 0:g.map(u=>{var s;return(s=r==null?void 0:r.values)!=null&&s.includes(u.id)?{...u,isSelectedValue:!0}:u});else l=o.dimensionValues;return{...o,dimensionValues:l}}),Ut=e=>e==null?void 0:e.map(n=>({...n,isDisabled:!0})),xi=e=>new Map(e==null?void 0:e.map(n=>[n.id,{...n,children:[]}])),vi=e=>{if(!e)return[];const n=xi(e),t=[];return e.forEach(o=>{if(o&&o.parent){const r=n.get(o.parent),l=n.get(o.id);r&&r.children&&l&&(r.children=[...r.children,l])}else{const r=n.get(o.id);r&&t.push(r)}}),t},bi=(e,n=!1)=>n?`${e*j.TREE_NODE_PADDING-j.TREE_NODE_ARROW_SIZE}px`:`${e*j.TREE_NODE_PADDING}px`,ze=e=>{var n;return((n=e==null?void 0:e.children)==null?void 0:n.reduce((t,o)=>[...t,o,...ze(o)],[]))||[]},Je=(e,n)=>e?e.map(t=>({...t,isSelectedValue:n})):[],Ci=e=>{var o,r;const n=(o=e.children)==null?void 0:o.every(l=>l.isSelectedValue),t=(r=e.children)==null?void 0:r.every(l=>!l.isSelectedValue);if(e.isSelectedValue){if(e.isSelectedValue&&n)return[{...e,isSelectedValue:!1},...Je(ze(e),!0)]}else{if(t)return[{...e,isSelectedValue:!0},...Je(ze(e),!0)];if(n)return[{...e,isSelectedValue:!0},...Je(ze(e),!1)]}return[{...e,isSelectedValue:!1},...Je(ze(e),!1)]},ki=e=>[{key:Fe.HIERARCHY,title:(e==null?void 0:e.hierarchy)||"Hierarchy"},{key:Fe.FLAT_LIST,title:(e==null?void 0:e.flatList)||"Flat list"}],Ni=({calendarResolution:e,timeRange:n,timeRangeOptions:t,calendarStartFromMonday:o=!0,locale:r=ee.Locale.EN,radioIcon:l,initialConstraints:c,onValueChange:g,calendarIcon:a,dateFormat:u,titles:s,defaultTimeOption:d})=>{var _,M,y,k;const f=D.getAnnotationPeriod(c==null?void 0:c[0].annotations),[w,m]=h.useState(n),b=!n||((_=n==null?void 0:n.startPeriod)==null?void 0:_.getTime())===((M=f==null?void 0:f.startPeriod)==null?void 0:M.getTime())&&((y=n==null?void 0:n.endPeriod)==null?void 0:y.getTime())===((k=f==null?void 0:f.endPeriod)==null?void 0:k.getTime())?0:ee.CUSTOM_PERIOD,[p,S]=h.useState(d??b),C=h.useMemo(()=>{const{startPeriod:A,endPeriod:O}=f,F=A==null?void 0:A.getFullYear(),K=O==null?void 0:O.getFullYear(),T=new Date().getFullYear();return t.filter(I=>I.value===ee.CUSTOM_PERIOD||I.value===0||+I.value>=0&&K-T>=+I.value||+I.value<0&&F-T<+I.value)},[f,t]);h.useEffect(()=>{g(w,p)},[w]);const x=A=>{A&&(Ht(A),m(O=>O?{...O,startPeriod:A||null}:{endPeriod:null,startPeriod:A||null}))},N=A=>{A&&(Ht(A),m(O=>O?{...O,endPeriod:A||null}:{startPeriod:null,endPeriod:A||null}))};if(f==null)return null;const v=Bt(f.startPeriod,(w==null?void 0:w.endPeriod)||f.endPeriod,e,r,o,u),E=Bt((w==null?void 0:w.startPeriod)||f.startPeriod,f.endPeriod,e,r,o,u);return i.jsxs("div",{className:"mt-3 overflow-auto flex flex-col pt-2 pb-2 pr-3 h-full flex-1 min-w-0",children:[i.jsx("div",{className:"w-full",children:C.map(A=>i.jsx(j.Radio,{id:A.value.toString(),checked:p===A.value,label:A.title,onChange:()=>{const{value:O}=A;S(O),O!==ee.CUSTOM_PERIOD&&m(O===0?f:ci(f,O))},radioIcon:l},A.value.toString()))}),i.jsx("div",{className:"w-full",children:p===ee.CUSTOM_PERIOD&&i.jsxs("div",{className:"flex filters-time-period gap-4 mt-3 caption text-neutral-700",children:[i.jsx(j.Calendar,{onChange:x,options:v,value:(w==null?void 0:w.startPeriod)||(f==null?void 0:f.startPeriod),label:(s==null?void 0:s.from)||"From",id:"time-options-start",icon:a}),i.jsx(j.Calendar,{onChange:N,options:E,value:(w==null?void 0:w.endPeriod)||(f==null?void 0:f.endPeriod),label:(s==null?void 0:s.to)||"To",id:"time-options-end",icon:a})]})})]})},Si=e=>X.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},X.createElement("path",{d:"M6.25 4.66668L9.75 8.00001L6.25 11.3333L6.25 4.66668Z",fill:"currentColor"})),Fo=({node:e,level:n=1,checkboxIcon:t,selectFilterValue:o,selectHierarchicalNodes:r,expandHierarchicalValue:l})=>{var s;const[c,g]=h.useState(!1),a="cursor-pointer text-neutrals-1000 w-6 h-6 shrink-0";h.useEffect(()=>{var d;g(!!((d=e==null?void 0:e.children)!=null&&d.length))},[e]);const u=(d,f)=>{var w;(w=e==null?void 0:e.children)!=null&&w.length?r==null||r(Ci(e)):o==null||o(d,f)};return i.jsxs("div",{className:"flex flex-col",children:[i.jsxs("div",{className:"flex items-center",style:{paddingLeft:bi(n,c)},children:[c&&(e!=null&&e.isExpanded?i.jsx(Si,{className:a,onClick:()=>l==null?void 0:l(e)}):i.jsx(bn,{className:a,onClick:()=>l==null?void 0:l(e)})),i.jsx(j.Checkbox,{id:e==null?void 0:e.id,label:e==null?void 0:e.name,checked:!!e.isSelectedValue,checkboxIcon:t,onChange:u})]}),c&&(e==null?void 0:e.isExpanded)&&i.jsx(i.Fragment,{children:(s=e==null?void 0:e.children)==null?void 0:s.map(d=>i.jsx(Fo,{node:d,level:n+1,checkboxIcon:t,selectFilterValue:o,selectHierarchicalNodes:r,expandHierarchicalValue:l},d==null?void 0:d.id))})]},e==null?void 0:e.id)},ji=({filterValues:e,checkboxIcon:n,selectFilterValue:t,selectHierarchicalNodes:o,expandHierarchicalValue:r})=>{const[l,c]=h.useState([]);return h.useEffect(()=>{c(vi(e))},[e]),l==null?void 0:l.map(g=>i.jsx(Fo,{node:g,checkboxIcon:n,selectFilterValue:t,selectHierarchicalNodes:o,expandHierarchicalValue:r},g==null?void 0:g.id))},Ei=({style:e,filterValue:n,checkboxIcon:t,selectFilterValue:o})=>i.jsx("div",{style:e,children:i.jsx(j.Checkbox,{id:n.id,label:n.name,checked:!!n.isSelectedValue,checkboxIcon:t,onChange:o})}),Di=Nr.FixedSizeList,zt=24,Wt=232,Ai=({filterValues:e,checkboxIcon:n,isHierarchicalView:t,isDisableValues:o,selectFilterValue:r,selectHierarchicalNodes:l,expandHierarchicalValue:c})=>{const g=j.useIsMobile();if(!e)return null;const a=e.length*zt,u=a>Wt?Wt:a;return i.jsx("div",{className:V(o&&"pointer-events-none opacity-[0.7]","h-full overflow-auto"),style:{height:g?u+"px":"100%"},children:t?i.jsx(ji,{filterValues:e,checkboxIcon:n,selectFilterValue:r,selectHierarchicalNodes:l,expandHierarchicalValue:c}):i.jsx(Sr,{children:({width:s,height:d})=>i.jsx(Di,{itemCount:e.length,itemSize:zt,width:s,height:d,children:({index:f,style:w})=>i.jsx(Ei,{index:f,style:w,filterValue:e[f],checkboxIcon:n,selectFilterValue:r})})})})},Bo=({selectedFilter:e,filterValuesProps:n,locale:t,isDisableValues:o,timeRangeOptions:r,onTimePeriodChange:l,selectFilterValue:c,titles:g,initialConstraints:a,selectHierarchicalNodes:u,expandHierarchicalValue:s,selectedTimeOption:d})=>{const[f,w]=h.useState(""),[m,b]=h.useState([]),p=(e==null?void 0:e.displayMode)===Fe.HIERARCHY;h.useEffect(()=>{var x;const C=((x=e==null?void 0:e.dimensionValues)==null?void 0:x.filter(N=>{var v,E;return(E=(v=N==null?void 0:N.name)==null?void 0:v.toLowerCase())==null?void 0:E.includes(f==null?void 0:f.toLowerCase())}))||[];b(p?D.getFilteredItemsWithParents(e==null?void 0:e.dimensionValues,C):C)},[p,f,e==null?void 0:e.dimensionValues]),h.useEffect(()=>{w("")},[e]);const S=h.useCallback(C=>{w(C)},[w]);return i.jsx(i.Fragment,{children:e!=null&&e.isTimeDimension&&a?i.jsx(Ni,{titles:g,initialConstraints:a,calendarResolution:ee.CalendarResolution.DAY,timeRange:(e==null?void 0:e.timeRange)||null,timeRangeOptions:r||[],calendarStartFromMonday:!0,locale:t,radioIcon:n==null?void 0:n.radioIcon,onValueChange:l,calendarIcon:n==null?void 0:n.calendarIcon,dateFormat:n==null?void 0:n.dateFormat,defaultTimeOption:d}):i.jsxs("div",{className:V("flex flex-col pt-2 pb-2 h-full flex-1 min-w-0 sm:border-0","filter-values-container"),children:[i.jsx(j.InputWithIcon,{inputId:"filters-search-input",containerClasses:"gap-2 items-center filters-search-input",cssClass:"filters-search-input-text",placeholder:(g==null?void 0:g.searchPlaceholder)??"Search",value:f,onChange:S,iconBeforeInput:i.jsx(Ee.IconSearch,{width:n==null?void 0:n.searchIconSize,height:n==null?void 0:n.searchIconSize,className:"text-primary"})}),i.jsx("div",{className:"flex flex-col mt-3 body-2 overflow-auto flex-1 min-h-0",children:i.jsx(Ai,{filterValues:f?m:e==null?void 0:e.dimensionValues,checkboxIcon:n==null?void 0:n.checkboxIcon,isHierarchicalView:p,isDisableValues:o,selectFilterValue:c,selectHierarchicalNodes:u,expandHierarchicalValue:s})})]})})},yi=({filter:e,onSelectFilter:n,onSelectDisplayMode:t,onDeleteFilter:o,locale:r,titles:l,initialConstraints:c,hideFacetCounterByDefault:g,filterValuesProps:a,isDisableValues:u,timeRangeOptions:s,onTimePeriodChange:d,selectFilterValue:f,selectHierarchicalNodes:w,expandHierarchicalValue:m})=>{var y;const b=j.useIsMobile(),[p,S]=h.useState(0),[C,x]=h.useState(!1),N=(e==null?void 0:e.isTimeDimension)&&(e==null?void 0:e.timeRange),v=h.useMemo(()=>{var k,A,O,F;return(k=e==null?void 0:e.timeRange)!=null&&k.startPeriod&&((A=e==null?void 0:e.timeRange)!=null&&A.endPeriod)?`${en((O=e==null?void 0:e.timeRange)==null?void 0:O.startPeriod,r)} -
41
- ${en((F=e==null?void 0:e.timeRange)==null?void 0:F.endPeriod,r)}`:""},[r,e==null?void 0:e.timeRange]);h.useEffect(()=>{var k;S((k=Io(e==null?void 0:e.dimensionValues))==null?void 0:k.length)},[e==null?void 0:e.dimensionValues]);const E=k=>{t==null||t(e==null?void 0:e.id,k)},_=g?p>0:!0;h.useEffect(()=>{e.isSelectedFilter||x(!1)},[e.isSelectedFilter]);const M=()=>{b&&x(k=>!k),n(e==null?void 0:e.id)};return i.jsxs("div",{className:"flex flex-col",children:[i.jsxs("div",{className:V("flex justify-between items-center p-2 hover:bg-hues-100 py-2 sm:py-4 sm:hover:bg-white","filters-facet-item cursor-pointer",(e==null?void 0:e.isSelectedFilter)&&!b&&"bg-hues-100",(e==null?void 0:e.isDisabled)&&"cursor-default pointer-events-none opacity-[0.7]"),onClick:M,children:[i.jsxs("h3",{className:"w-full truncate flex-1 min-w-0 sm:flex sm:items-center",title:e==null?void 0:e.title,children:[i.jsx("span",{className:"truncate",children:e==null?void 0:e.title}),b&&i.jsx(bn,{className:V("chevron-icon w-6 h-6 shrink-0",C&&"rotate-180")})]}),i.jsxs("div",{className:"ml-2 flex gap-2 items-center text-neutrals-800",children:[N&&i.jsx("span",{className:"filters-facet-item-counter border-none",children:v}),!N&&_&&i.jsx("span",{className:V("px-2 text-center","filters-facet-item-counter"),children:p?`${p}/${((y=e==null?void 0:e.dimensionValues)==null?void 0:y.length)||0}`:(l==null?void 0:l.all)||"All"}),N?null:i.jsxs("div",{className:"flex items-center gap-2 filters-facet-item-settings",children:[i.jsx(j.Dropdown,{triggerButton:i.jsx(j.IconButton,{buttonClassName:V("text-button-tertiary w-4 h-4 border-0 p-0","filters-facet-item-icon"),icon:i.jsx(Xr,{width:16,height:16}),title:(l==null?void 0:l.displayOrder)||"Display Order",disabled:!(e!=null&&e.isHierarchical)}),options:ki(l),selectedOption:e==null?void 0:e.displayMode,disabled:!(e!=null&&e.isHierarchical),onOptionSelect:E}),p>0&&i.jsx(j.IconButton,{buttonClassName:V("text-button-tertiary w-4 h-4 border-0 p-0","filters-facet-item-icon"),icon:i.jsx(qr,{width:16,height:16}),title:(l==null?void 0:l.reset)||"Reset",onClick:k=>{k.stopPropagation(),o==null||o(e==null?void 0:e.id)}})]})]})]}),C&&i.jsx(Bo,{titles:l,selectedFilter:e,locale:r,isDisableValues:u,timeRangeOptions:s,selectFilterValue:f,selectHierarchicalNodes:w,expandHierarchicalValue:m,onTimePeriodChange:d,filterValuesProps:a,initialConstraints:c})]})},Mi=({filtersList:e,hideFacetCounterByDefault:n,locale:t,onSelectFilter:o,onDeleteFilter:r,onSelectDisplayMode:l,filterValuesProps:c,isDisableValues:g,timeRangeOptions:a,initialConstraints:u,onTimePeriodChange:s,selectFilterValue:d,selectHierarchicalNodes:f,titles:w,expandHierarchicalValue:m})=>i.jsx("div",{className:V("overflow-y-auto advanced-view-filters-list min-w-[320px] pr-3 h-full sm:w-full"),children:e==null?void 0:e.map(b=>i.jsx(yi,{titles:w,locale:t,filter:b,onSelectFilter:o,onSelectDisplayMode:l,onDeleteFilter:r,hideFacetCounterByDefault:n,isDisableValues:g,timeRangeOptions:a,selectFilterValue:d,selectHierarchicalNodes:f,expandHierarchicalValue:m,onTimePeriodChange:s,filterValuesProps:c,initialConstraints:u},b==null?void 0:b.id))}),Ti=({filtersList:e,titles:n,selectedFilter:t,modalProps:o,locale:r,isDisableValues:l,timeSeriesCount:c,timeRangeOptions:g,initialConstraints:a,setSelectedFilter:u,onSelectDisplayMode:s,onDeleteFilter:d,updateSelectedFilterValues:f,onTimePeriodChange:w,selectedTimeOption:m})=>{const b=j.useIsMobile(),p=h.useCallback(v=>{u({...e==null?void 0:e.find(E=>(E==null?void 0:E.id)===v),isSelectedFilter:!0})},[e,u]),S=(v,E)=>{var M;const _={...t,dimensionValues:(M=t==null?void 0:t.dimensionValues)==null?void 0:M.map(y=>(y==null?void 0:y.id)===v?{...y,isSelectedValue:E}:y)};u(_),f&&f(_)},C=v=>{var _;const E={...t,dimensionValues:(_=t==null?void 0:t.dimensionValues)==null?void 0:_.map(M=>(v==null?void 0:v.find(k=>(k==null?void 0:k.id)===(M==null?void 0:M.id)))||M)};u(E),f&&f(E)},x=v=>{var E;u({...t,dimensionValues:(E=t==null?void 0:t.dimensionValues)==null?void 0:E.map(_=>(_==null?void 0:_.id)===(v==null?void 0:v.id)?{..._,isExpanded:!(v!=null&&v.isExpanded)}:_)})},N=(v,E)=>{const _={...t,timeRange:v||void 0};w==null||w(E),u(_),f&&f(_)};return i.jsxs("div",{className:V("flex flex-row gap-5 flex-1 min-h-0 sm:p-0","filters-settings"),children:[i.jsxs("div",{className:V("h-full sm:w-full",(o==null?void 0:o.isShowTimeSeriesCount)&&"flex flex-col justify-between"),children:[i.jsx(Mi,{filtersList:e,hideFacetCounterByDefault:o==null?void 0:o.isHideFacetCounterByDefault,locale:r,titles:n,onSelectFilter:p,onSelectDisplayMode:s,onDeleteFilter:d,isDisableValues:l,initialConstraints:a,timeRangeOptions:g,selectFilterValue:S,selectHierarchicalNodes:C,expandHierarchicalValue:x,onTimePeriodChange:N,filterValuesProps:o==null?void 0:o.filterValuesProps}),o!=null&&o.isShowTimeSeriesCount&&c?i.jsxs("h4",{className:"text-neutrals-800 my-4",children:[(n==null?void 0:n.timeSeries)??"Timeseries",": ",c]}):null]}),!b&&i.jsx(Bo,{selectedFilter:t,locale:r,titles:n,isDisableValues:l,timeRangeOptions:g,selectFilterValue:S,selectHierarchicalNodes:C,expandHierarchicalValue:x,onTimePeriodChange:N,filterValuesProps:o==null?void 0:o.filterValuesProps,initialConstraints:a,selectedTimeOption:m})]})},un=(e,n,t,o,r=ee.Locale.EN)=>{const l=n==null?void 0:n.map(c=>{const g=D.findCodelistByDimension(t==null?void 0:t.codelists,t==null?void 0:t.conceptSchemes,c),a=D.getAvailableCodesFromConstrains(g==null?void 0:g.codes,c.id,o,r);return{...c,dimensionValues:a}});return(e==null?void 0:e.map(c=>{var u;const a=(((u=l==null?void 0:l.find(s=>s.id===c.id))==null?void 0:u.dimensionValues)||[]).map(s=>{var f,w;const d=(w=(f=c.dimensionValues)==null?void 0:f.find(m=>(m==null?void 0:m.id)===(s==null?void 0:s.id)))==null?void 0:w.isSelectedValue;return{...s,isSelectedValue:d}});return{...c,isDisabled:!1,dimensionValues:a}}))||[]},$t=e=>{let n=[];return e.filter(t=>{var o;return t.timeRange||((o=t.dimensionValues)==null?void 0:o.some(r=>r.isSelectedValue))}).forEach(t=>{var l;const{id:o,dimensionValues:r}=t;t.isTimeDimension?n=[...n,...Oi(t.timeRange,o)]:n.push({componentCode:o,operator:D.SeriesFilterOperator.EQUALS,value:((l=r==null?void 0:r.filter(c=>c.isSelectedValue))==null?void 0:l.map(c=>c.id).join(D.GET_v3_FILTER_AND))||""})}),n},Oi=(e,n)=>e==null||e.startPeriod==null||e.endPeriod==null?[]:[{componentCode:n,operator:D.SeriesFilterOperator.GREATER_OR_EQUAL,value:Jt(new Date(e.startPeriod))},{componentCode:n,operator:D.SeriesFilterOperator.LESS_OR_EQUAL,value:Jt(new Date(e.endPeriod),1)}],Li=1e3*60*60*24,Jt=(e,n=0)=>{e.setHours(0),e.setMinutes(0),e.setSeconds(0),e.setMinutes(e.getMinutes()-e.getTimezoneOffset());let t=e.getTime();return t+=n?Li-1:0,e=new Date(t),t.toString()},_i=e=>e.map(n=>{var t;return{componentCode:n.id||"",operator:ee.QueryFilterType.IN,values:((t=n.dimensionValues)==null?void 0:t.map(o=>o.id))||[]}}),Ri=(e,n)=>{var l;const t=(l=n==null?void 0:n.timeDimensions)==null?void 0:l[0],o=D.getTimeRangeFromAttachment(e,t)||null;return o?D.getQueryTimePeriodFilters(o,t==null?void 0:t.id):null},Ii=(e,n)=>{const t=Po(e),o=t.find(r=>(r==null?void 0:r.isTimeDimension)&&(r==null?void 0:r.timeRange));return{filterKey:D.getTimeSeriesFilterKey(n||[],_i(t)),timeFilter:D.getQueryTimePeriodFilters(o==null?void 0:o.timeRange,o==null?void 0:o.id)}},Pi=e=>e==null?void 0:e.filter(n=>{var t;return n.timeRange||((t=n.dimensionValues)==null?void 0:t.some(o=>o.isSelectedValue))}).map(n=>{var t,o,r,l;return n!=null&&n.isTimeDimension?{componentCode:n==null?void 0:n.id,operator:ee.QueryFilterType.BETWEEN,values:[Yt(((t=n==null?void 0:n.timeRange)==null?void 0:t.startPeriod)||void 0)||"",Yt(((o=n==null?void 0:n.timeRange)==null?void 0:o.endPeriod)||void 0)||""]}:{componentCode:n==null?void 0:n.id,operator:ee.QueryFilterType.IN,values:((l=(r=n==null?void 0:n.dimensionValues)==null?void 0:r.filter(c=>c.isSelectedValue))==null?void 0:l.map(c=>c.id))||[]}}),Yt=e=>{if(!e)return"";const n=String(e.getDate()).padStart(2,"0"),t=String(e.getMonth()+1).padStart(2,"0"),o=e.getFullYear();return`${t}-${n}-${o}`},Vi=({timeseriesLength:e=0,limitMessages:n})=>{var o,r;const t=!e||j.SERIES_LIMIT>e;return i.jsx("div",{className:"body-3 text-neutrals-800 sm:text-center flex gap-x-[4px] sm:justify-center",children:t?i.jsx("span",{children:(o=n==null?void 0:n.seriesCount)==null?void 0:o.call(n,e)}):i.jsxs(i.Fragment,{children:[i.jsx("span",{children:n==null?void 0:n.warningIcon}),i.jsx("span",{children:(r=n==null?void 0:n.counterLimit)==null?void 0:r.call(n,e,j.SERIES_LIMIT)})]})})},Fi=({modalProps:e,onApply:n,onClearAllFilters:t,onClose:o,titles:r,applyDisabled:l,timeseriesLength:c,limitMessages:g})=>{const a=j.useIsMobile();return i.jsxs("div",{className:V("flex py-4 px-6","modal-footer-wrapper",e!=null&&e.isShowCancelButton?"justify-between":"gap-x-8 flex-row-reverse items-center justify-between sm:flex-col sm:gap-y-4 items-center"),children:[!(e!=null&&e.isShowCancelButton)&&i.jsx(Vi,{timeseriesLength:c,limitMessages:g}),i.jsxs("div",{className:V("flex",e!=null&&e.isShowCancelButton?"justify-between":"gap-x-8 flex-row-reverse justify-end sm:flex-col-reverse sm:gap-y-4 items-center"),children:[i.jsx(j.Button,{iconBefore:a?e==null?void 0:e.resetIcon:void 0,buttonClassName:"text-button-tertiary p-0",title:e!=null&&e.isShowClearIcon?(r==null?void 0:r.clearAllFilters)??"Clear All Filters":(r==null?void 0:r.clearAll)??"Clear All",onClick:()=>t(),isSmallButton:a}),i.jsxs("div",{className:"flex items-center gap-x-3",children:[e!=null&&e.isShowCancelButton?i.jsx(j.Button,{buttonClassName:"text-button-tertiary sm:h8",title:(r==null?void 0:r.cancel)??"Cancel",onClick:o,isSmallButton:a}):null,i.jsx(j.Button,{buttonClassName:"advanced-view-filters-modal-apply-button",title:(r==null?void 0:r.apply)??"Apply",onClick:n,isSmallButton:a,disabled:l})]})]})]})},Bi=e=>X.createElement("svg",{viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",...e},X.createElement("path",{d:"M3.33333 13.3327V8.66602H2V7.33268H6V8.66602H4.66667V13.3327H3.33333ZM3.33333 5.99935V2.66602H4.66667V5.99935H3.33333ZM6 5.99935V4.66602H7.33333V2.66602H8.66667V4.66602H10V5.99935H6ZM7.33333 13.3327V7.33268H8.66667V13.3327H7.33333ZM11.3333 13.3327V11.3327H10V9.99935H14V11.3327H12.6667V13.3327H11.3333ZM11.3333 8.66602V2.66602H12.6667V8.66602H11.3333Z",fill:"currentColor"}));var le=(e=>(e.DATA_GRID="dataGrid",e.METADATA_PER_SERIES="metadataPerSeries",e.CHARTS="charts",e.CHARTS_NAVIGATION="chartsNavigation",e.OPEN_ADVANCED_VIEW="openAdvancedView",e.FILTERS="filters",e.CHART_PER_SERIES="chartPerSeries",e.METADATA_PER_DATASET="metadataPerDataset",e.EXIT_ADVANCED_VIEW="exitAdvancedView",e))(le||{});const Cn=["charts","chartsNavigation"],Kt=["dataGrid","metadataPerSeries",...Cn,"openAdvancedView"],Ho=["filters","chartPerSeries","metadataPerDataset","exitAdvancedView"],Re=(e,n)=>({title:(n==null?void 0:n[`${e}Title`])||"",description:(n==null?void 0:n[`${e}Description`])||""}),gn=(e,n)=>e.find(t=>{var o;return!((o=n.infoElements)!=null&&o[t])})||"",Hi=(e,n)=>{if(!e||!n)return"";if(Kt.includes(n)){const o=gn(Kt,e);if(o)return o}const t=gn(Ho,e);return t||""},Go=(e,n)=>{const t=gn(e,n);return{...n,infoElements:{...n==null?void 0:n.infoElements,[n.lastDisplayedElement]:!1,...t?{[t]:!0}:{}},lastDisplayedElement:t}},Uo=e=>Go(Ho,e),Gi=e=>Go(Cn,e),Ui=e=>{var n,t;return(!((n=e==null?void 0:e.infoElements)!=null&&n.charts)||!((t=e==null?void 0:e.infoElements)!=null&&t.chartsNavigation))&&!Cn.includes(e.lastDisplayedElement)},Me=5,zi=({targetPosition:e,overlayClasses:n,onClose:t})=>i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"overlay overlay-top",style:{height:e.top,top:0-Me,bottom:e.top+Me}}),i.jsx("div",{className:"overlay overlay-bottom",style:{top:e.bottom+Me,bottom:0}}),i.jsx("div",{className:"overlay overlay-left",style:{top:e.top-Me,height:e.height+Me*2,width:e.left,left:0-Me,right:e.left-Me*2}}),i.jsx("div",{className:"overlay overlay-right",style:{top:e.top-Me,left:e.right+Me,height:e.height+Me*2,right:0}}),i.jsx("div",{className:V("outline-block z-10",n),onClick:t,style:{top:e.top,left:e.left,height:e.height,width:e.width}})]}),Ie=({reference:e,title:n,description:t,onReferenceClick:o,shouldCloseTooltip:r,shouldMoveToNextStep:l,supressReferenceClick:c})=>{var y;const[g,a]=h.useState(!0),[u,s]=h.useState(!1),d=h.useRef(null),{isShowOnboarding:f,onboardingFileSchema:w,setOnboardingFileSchema:m}=me(),{refs:b,floatingStyles:p,context:S,placement:C}=ke.useFloating({open:g,onOpenChange:a,placement:"right-start",elements:{reference:e==null?void 0:e.current},middleware:[ke.offset({mainAxis:12,crossAxis:-4}),ke.flip(),ke.shift(),ke.arrow({element:d})],whileElementsMounted:ke.autoUpdate}),x=ke.useClick(S),{getFloatingProps:N}=ke.useInteractions([x]),v=h.useCallback(()=>{if(f){const k=Hi(w,w==null?void 0:w.lastDisplayedElement);m==null||m({...w,infoElements:{...w==null?void 0:w.infoElements,...k?{[k]:!0}:{}},lastDisplayedElement:k})}a==null||a(!1)},[f,w,m]);h.useEffect(()=>{b.setReference((e==null?void 0:e.current)??null)},[e,b]);const E=()=>v(),_=(y=e==null?void 0:e.current)==null?void 0:y.getBoundingClientRect();h.useEffect(()=>{r&&!u&&(v(),s(!0))},[r,v,u]);const M=()=>{var k;o?(o==null||o(),l?v():a(!1)):c||(v(),(k=e==null?void 0:e.current)==null||k.click())};return i.jsx(i.Fragment,{children:g&&i.jsxs(ke.FloatingPortal,{children:[_&&i.jsx(zi,{overlayClasses:c?"cursor-default":"cursor-pointer",targetPosition:_,onClose:M}),i.jsxs("div",{ref:b.setFloating,style:p,...N(),className:"tooltip z-tooltip max-w-[350px]",children:[i.jsxs("div",{className:"tooltip-header",children:[i.jsx("h3",{children:n}),i.jsx(j.CloseButton,{btnClassNames:"w-4 h-4",onClick:E})]}),i.jsx("div",{className:"tooltip-description",children:i.jsx("p",{children:t})}),i.jsx("div",{ref:d,className:V("tooltip-arrow absolute w-3 h-3 rotate-45",C!=null&&C.includes("right")?"left-[-4px]":"right-[-6px]",C!=null&&C.includes("end")?"bottom-2 tooltip-arrow-white":"top-3")})]})]})})},Wi=({buttonProps:e,selectedFiltersCount:n=0,isLoading:t,setModalState:o,titles:r,isModalClosed:l})=>{const c=h.useRef(null),[g,a]=h.useState(""),[u,s]=h.useState(""),[d,f]=h.useState(!1),{onboardingFileSchema:w,isShowOnboarding:m}=me(),b=h.useMemo(()=>e!=null&&e.isShowBadge?e==null?void 0:e.title:`${e==null?void 0:e.title}: ${n}`,[e==null?void 0:e.isShowBadge,e==null?void 0:e.title,n]);return h.useEffect(()=>{if(m){const{title:p,description:S}=Re(le.FILTERS,r);a(p),s(S)}},[r,m]),h.useEffect(()=>{m&&f((w==null?void 0:w.lastDisplayedElement)===le.FILTERS)},[w==null?void 0:w.lastDisplayedElement,m]),i.jsx("div",{className:"relative filter-button-container",ref:c,children:t?i.jsx(j.Loader,{}):i.jsxs(i.Fragment,{children:[i.jsx(j.Button,{iconBefore:i.jsx(Bi,{className:"w-4 h-4"}),title:b,buttonClassName:"text-button-secondary filter-button",isSmallButton:!0,onClick:()=>o(j.PopUpState.Opened)}),(e==null?void 0:e.isShowBadge)&&i.jsx("div",{className:"filter-count-badge",children:i.jsx("h5",{children:n})}),d&&i.jsx(Ie,{reference:c,title:g,description:u,onReferenceClick:()=>o(j.PopUpState.Opened),shouldCloseTooltip:l})]})})},Zt=e=>{var t;const n=[];return(t=e.custom_content)!=null&&t.attachments&&n.push(...e.custom_content.attachments),n};function kn(e){var n;return e.type===re.AttachmentType.MARKDOWN&&e.title!=null&&((n=e.title)==null?void 0:n.startsWith("URL Query"))}function zo(e){var n;return e.type===re.AttachmentType.JSON&&e.title!=null&&((n=e.title)==null?void 0:n.startsWith("Query (JSON)"))}function Wo(e){return e.type===re.AttachmentType.MARKDOWN&&!kn(e)}function $i(e){return e.type===re.AttachmentType.CSV}function wn(e){return e.type===re.AttachmentType.TABLE}function We(e){return e.type===re.AttachmentType.CUSTOM_DATA_GRID}function Ze(e){return e.type===re.AttachmentType.CUSTOM_CHART}function Ji(e){return e.type===re.AttachmentType.PLOTLY}const Yi=(e,n)=>{var t;return(t=e==null?void 0:e.filter((o,r)=>{var l;return((l=o==null?void 0:o.custom_content)==null?void 0:l.attachments)&&r<n}))==null?void 0:t.at(-1)},Ki=e=>e==null?void 0:e.reduce((n,t,o)=>{var r,l;return(l=(r=t==null?void 0:t.custom_content)==null?void 0:r.attachments)!=null&&l.some(c=>zo(c))?o:n},-1),Zi=e=>e==null?void 0:e.reduce((n,t)=>(t==null?void 0:t.role)===de.Role.Assistant?t:n,{}),qi=(e,n,t,o)=>{var r;return{role:de.Role.System,content:"",custom_content:{attachments:(t==null?void 0:t.map(l=>({type:re.AttachmentType.JSON,title:l==null?void 0:l.title,data:JSON.stringify({urn:l==null?void 0:l.urn,metadata:l==null?void 0:l.metadata,filters:(n==null?void 0:n.urn)===(l==null?void 0:l.urn)?e:l==null?void 0:l.filters})})))||[],form_schema:(r=o==null?void 0:o.custom_content)==null?void 0:r.form_schema}}},Xi=(e,n,t,o)=>{if(!e)return[];const r=e==null?void 0:e.at(-1);return r&&r.role===de.Role.System&&(e==null||e.pop()),[...e,qi(n,t,o,Zi(e))]},Qi=(e,n,t)=>(t==null?void 0:t.map(o=>({...o,filters:(n==null?void 0:n.urn)===(o==null?void 0:o.urn)?e:o==null?void 0:o.filters})))||[],el=({actions:e,dimensions:n,structureDimensions:t,structures:o,buttonProps:r,modalProps:l,attachmentsDataQuery:c,dataQueries:g,initialConstraints:a,onFiltersChange:u,locale:s,timeRangeOptions:d,titles:f,conversationKey:w,conversation:m,setConversation:b,updateConversation:p,updateDataQueries:S,limitMessages:C})=>{var Oe,Ae,Ce,je;const[x,N]=h.useState(j.PopUpState.Closed),[v,E]=h.useState([]),[_,M]=h.useState([]),[y,k]=h.useState(),[A,O]=h.useState([]),[F,K]=h.useState(void 0),T=h.useRef(a||[]),[I,H]=h.useState([]),[B,U]=h.useState(),[Z,W]=h.useState(),q=h.useRef(!1),[se,ae]=h.useState(!1),ce=P=>{const G=P?v.map(z=>z.id===P.id?P:z):v;W(!0),E(Ut(G)),U==null||U(!0),ue(P!=null&&P.isTimeDimension?Gt(G,P):G,E,U)};h.useEffect(()=>{x===j.PopUpState.Closed&&H(T.current)},[x]);const ue=h.useCallback((P,G,z)=>{e==null||e.getConstraints(c==null?void 0:c.urn,$t(P).filter(ne=>ne.componentCode!==D.TIME_PERIOD)).then(ne=>{var R;const L=((R=ne==null?void 0:ne.data)==null?void 0:R.dataConstraints)||[];T.current=L,z==null||z(!1),G(un(P,n,o,L,s))}).catch(()=>{T.current=[],z==null||z(!1),G(un(P,n,o,[],s))}).finally(()=>{W(!1)})},[e,c==null?void 0:c.urn,n,s,o]);h.useEffect(()=>{const P=hi(n,o,t,s),G=n==null?void 0:n.map(ne=>{const L=D.findCodelistByDimension(o==null?void 0:o.codelists,o==null?void 0:o.conceptSchemes,ne),R=D.getAvailableCodesFromConstrains(L==null?void 0:L.codes,ne.id,T.current,s);return{...ne,dimensionValues:R}}),z=P.map(ne=>{var R;const L=((R=G==null?void 0:G.find($=>$.id===ne.id))==null?void 0:R.dimensionValues)||[];return{...ne,dimensionValues:L}});if(!q.current){const ne=pi(z,c,T.current);U==null||U(!0),ue(ne,M,U),q.current=!0}},[n,t,o,c,s,a,ue]),h.useEffect(()=>{_!=null&&_.length&&O(Po(_))},[_]),h.useEffect(()=>{E(P=>Gt(P,y))},[y]),h.useEffect(()=>{x===j.PopUpState.Opened&&(k({..._==null?void 0:_[0],isSelectedFilter:!0}),E(_)),x===j.PopUpState.Closed&&k(void 0)},[_,x]);const he=h.useCallback(async P=>{const G=Pi(P),z=m?{...m,messages:Xi(m==null?void 0:m.messages,G,c,g)}:null;b==null||b(z),S==null||S(Qi(G,c,g)),await p(decodeURI(w),{name:z==null?void 0:z.name,messages:(z==null?void 0:z.messages)||[]})},[c,m,w,g,b,p,S]),Ne=h.useCallback((P,G)=>{E(z=>fi(z,P,G)),(y==null?void 0:y.id)===P&&k(z=>({...z,displayMode:G}))},[y==null?void 0:y.id]),pe=h.useCallback(P=>Ii(P,n),[n]),xe=h.useCallback((P,G)=>{const z=un(G,n,o,P,s);T.current=P,k(ne=>(z==null?void 0:z.find(L=>(L==null?void 0:L.id)===(ne==null?void 0:ne.id)))||ne),E(z),W(!1)},[n,s,o]),fe=h.useCallback(P=>{W(!0),E(Ut(P)),e==null||e.getConstraints((c==null?void 0:c.urn)||"",$t(P).filter(G=>G.componentCode!==D.TIME_PERIOD)).then(G=>{var z;xe(((z=G==null?void 0:G.data)==null?void 0:z.dataConstraints)||[],P)}).catch(()=>{xe([],P)})},[e,c==null?void 0:c.urn,xe]),ve=h.useCallback(P=>{const G=wi(v,P);fe(G)},[fe,v]),Te=h.useCallback(()=>{T.current=I,N(j.PopUpState.Closed),ae(!0)},[I]),Se=h.useCallback(()=>{const P=mi(v);fe(P)},[fe,v]),be=h.useCallback(()=>{const P=pe(v);u==null||u(P,T.current,v),M(v),N(j.PopUpState.Closed),ae(!0),h.startTransition(()=>{he(v)})},[pe,v,u,he,T]),De=P=>{K(P)};return i.jsxs("div",{className:"filters-container",children:[i.jsx(Wi,{buttonProps:r,selectedFiltersCount:gi(A),isLoading:B,setModalState:N,titles:f,isModalClosed:se}),i.jsx(i.Fragment,{children:x===j.PopUpState.Opened&&i.jsxs(j.Popup,{heading:(f==null?void 0:f.settings)||"Settings",portalId:"filters",size:j.PopUpSize.LG,containerClassName:"advanced-view-filters-modal h-[80%]",dividers:l==null?void 0:l.isShowDividers,onClose:Te,closeButtonTitle:(f==null?void 0:f.close)||"Close",children:[i.jsx(Ti,{locale:s,titles:f,timeRangeOptions:d,filtersList:v,selectedFilter:y,isDisableValues:Z,modalProps:l,initialConstraints:a,timeSeriesCount:D.getTimeSeriesCount((Ae=(Oe=T.current)==null?void 0:Oe[0])==null?void 0:Ae.annotations),setSelectedFilter:k,onSelectDisplayMode:Ne,onDeleteFilter:ve,updateSelectedFilterValues:ce,onTimePeriodChange:De,selectedTimeOption:F}),i.jsx(Fi,{titles:f,onApply:be,onClose:Te,onClearAllFilters:Se,modalProps:l,applyDisabled:B||Z,timeseriesLength:Number(D.getTimeSeriesCount((je=(Ce=T==null?void 0:T.current)==null?void 0:Ce[0])==null?void 0:je.annotations)),limitMessages:C})]})})]})},nl=({downloadTitles:e,attachment:n,actions:t,className:o=""})=>{const r=n.url,[l,c]=h.useState(null);async function g(a){if(a==null)return;const u=await t.getFile(a);c(u)}return i.jsxs("div",{className:`border rounded-lg p-3 bg-white transition-colors ${o}`,children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"flex-1 min-w-0",children:i.jsx("div",{className:"flex items-center gap-2",children:i.jsx("span",{className:"body-2 text-neutrals-800 truncate",title:n.title,children:n.title})})}),r&&i.jsx("div",{className:"flex-shrink-0",children:i.jsx(j.Button,{title:e??"Download",onClick:()=>g(n.url),buttonClassName:"text-button-tertiary"})})]}),l&&i.jsx("div",{className:"mt-3",children:i.jsx("pre",{className:"bg-white p-3 rounded-md overflow-x-auto",children:i.jsx("code",{children:JSON.stringify(l,null,2)})})})]})},$o="json";function tl(e){return rl(e)?ol(e==null?void 0:e.slice($o.length)):e}function ol(e){let n="";if(e)try{n=JSON.stringify(JSON.parse(e),null,2)}catch{n=e.toString()}return n}function rl(e){return(e==null?void 0:e.startsWith($o))||!1}const il=({attachment:e,className:n=""})=>{const t=tl(e.data);return t?i.jsxs("div",{className:`attachment-json border rounded-lg bg-white ${n}`,children:[i.jsx("div",{className:"flex items-center justify-between px-3 py-2 border-b border-neutrals-200 bg-neutrals-100 rounded-t-lg",children:i.jsx("div",{className:"flex items-center gap-2",children:i.jsx("h3",{className:"text-neutrals-900",children:e.title})})}),i.jsx("div",{className:"p-3",children:i.jsx("pre",{className:"text-neutrals-800 overflow-x-auto whitespace-pre-wrap break-words max-h-96 overflow-y-auto",children:i.jsx("code",{children:t})})})]}):null},ll=e=>{try{const n=new URL(e);return["http:","https:","data:"].includes(n.protocol)}catch{return!1}},al=e=>ll(e)?e:"",sl=e=>X.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},X.createElement("path",{d:"M11.3333 4.66667H8.66659V6.00001H11.3333C12.4333 6.00001 13.3333 6.9 13.3333 8C13.3333 9.1 12.4333 10 11.3333 10H8.66659V11.3333H11.3333C13.1733 11.3333 14.6666 9.84 14.6666 8C14.6666 6.16 13.1733 4.66667 11.3333 4.66667ZM7.33325 10H4.66659C3.56659 10 2.66659 9.1 2.66659 8C2.66659 6.9 3.56659 6.00001 4.66659 6.00001H7.33325V4.66667H4.66659C2.82659 4.66667 1.33325 6.16 1.33325 8C1.33325 9.84 2.82659 11.3333 4.66659 11.3333H7.33325V10ZM5.33325 7.33334H10.6666V8.66667H5.33325V7.33334Z",fill:"currentColor"})),cl=({attachment:e,openLinkTitle:n,className:t=""})=>{const o=al(e.data||"");if(!o)return null;const r=l=>{const c=window.open(l,"_blank");c==null||c.focus()};return i.jsx("div",{className:`border rounded-lg bg-white pl-4 py-3 pr-3 max-w-[500px] ${t}`,children:i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx("span",{className:"text-hues-800 flex-shrink-0 mt-1",role:"img","aria-label":"Link",children:i.jsx(sl,{width:16,height:16})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("div",{className:"mb-1",children:i.jsx(j.Link,{url:o,title:e.title})}),i.jsx("div",{className:"text-neutrals-600 break-all truncate",children:o})]}),i.jsx("div",{className:"flex-shrink-0",children:i.jsx(j.Button,{title:n??"Open link",onClick:()=>r(o),buttonClassName:"text-button-tertiary"})})]})})},Jo=e=>X.createElement("svg",{viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",...e},X.createElement("path",{d:"M2.33325 12.3267L6.33325 8.32001L8.99992 10.9867L14.6666 4.61334L13.7266 3.67334L8.99992 8.98667L6.33325 6.32001L1.33325 11.3267L2.33325 12.3267Z",fill:"currentColor"})),ul=e=>X.createElement("svg",{viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",...e},X.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.50644 4.00043L1.97857 7.52207L1.5 7.99979L1.97857 8.47751L5.50644 11.9991L6.46019 11.0437L3.41088 7.99979L6.46019 4.95587L5.50644 4.00043ZM10.4918 4.00043L14.0197 7.52207L14.4983 7.99979L14.0197 8.47751L10.4918 11.9991L9.53809 11.0437L12.5874 7.99979L9.53809 4.95587L10.4918 4.00043Z",fill:"currentColor"})),dl=e=>X.createElement("svg",{viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",...e},X.createElement("path",{d:"M2.3999 4V12H13.5999V4H2.3999ZM5.7359 10.8H3.5999V5.2H5.7359V10.8ZM9.0639 10.8H6.9359V5.2H9.0719V10.8H9.0639ZM12.3999 10.8H10.2639V5.2H12.3999V10.8Z",fill:"currentColor"})),hl=e=>X.createElement("svg",{viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",...e},X.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.18519 10.4815H7.18116C7.31033 10.9089 7.50501 11.3078 7.7535 11.6667H2.18519C1.53333 11.6667 1 11.1333 1 10.4815V2.18519C1 1.53333 1.53333 1 2.18519 1H10.4815C11.1333 1 11.6667 1.53333 11.6667 2.18519V5.02017C11.5296 5.00683 11.3906 5 11.25 5C10.9876 5 10.7307 5.02378 10.4815 5.06931V2.18519H2.18519V10.4815ZM7.69316 6.92288C7.99945 6.45568 8.39531 6.05248 8.85633 5.73769H3.37044V6.92288H7.69316ZM7 9.25C7 8.8544 7.05405 8.47143 7.15517 8.10807H3.37044V9.29326H7.00022L7 9.25ZM3.37044 4.5525H9.29636V3.36731H3.37044V4.5525ZM11.6624 10.9695C12.5981 10.8087 13.2264 9.91979 13.0656 8.98403C12.9049 8.04827 12.016 7.42002 11.0802 7.58078C10.1444 7.74155 9.51618 8.63046 9.67695 9.56621C9.83771 10.502 10.7266 11.1302 11.6624 10.9695ZM11.8656 12.1521C11.9243 12.142 11.9824 12.1303 12.0396 12.1168L14.5611 15.5477L15.5281 14.8371L13.1449 11.5944C13.9785 10.9558 14.4384 9.88763 14.2483 8.78085C13.9753 7.19192 12.4659 6.12513 10.877 6.39811C9.28808 6.67109 8.22129 8.18047 8.49428 9.7694C8.76726 11.3583 10.2766 12.4251 11.8656 12.1521Z",fill:"currentColor"})),fl=({attachment:e,index:n,selectedAttachmentIndex:t,onSelectedAttachmentChange:o,showTabIcon:r,dataGridTitle:l,titles:c})=>{const g=h.useRef(null),[a,u]=h.useState(""),[s,d]=h.useState(""),[f,w]=h.useState(!1),{onboardingFileSchema:m,isShowOnboarding:b}=me(),p=h.useCallback((C,x="")=>r?Ji(C)||Ze(C)?i.jsx(Jo,{className:x}):We(C)?i.jsx(dl,{className:x}):kn(C)?i.jsx(hl,{className:x}):Wo(C)?i.jsx(ul,{className:x}):null:null,[r]),S=h.useCallback(C=>We(C)?l||"Data Grid":C.title,[l]);return h.useEffect(()=>{if(b&&Ze(e)){const{title:C,description:x}=Re(le.CHARTS,c);u(C),d(x)}},[e,c,b]),h.useEffect(()=>{var C;if(Ze(e)&&b){const x=(m==null?void 0:m.lastDisplayedElement)===le.CHARTS;w(x),x&&((C=g==null?void 0:g.current)==null||C.scrollIntoView({block:"end",behavior:"smooth"}))}},[m==null?void 0:m.lastDisplayedElement,e,b]),i.jsxs("div",{ref:g,className:V("cursor-pointer min-w-30","flex items-center gap-1","attachment-tab",t===n?"attachment-tab-active text-primary":""),onClick:()=>o(n),children:[p(e,"w-4 h-4"),i.jsx("h4",{className:"truncate max-w-[130px]",title:S(e),children:S(e)}),f&&i.jsx(Ie,{reference:g,title:a,description:s})]},e.index||n)},gl=({attachments:e,...n})=>i.jsx("div",{className:"flex items-center w-full flex-wrap attachments-tabs",children:e.map((t,o)=>i.jsx(fl,{attachment:t,index:o,...n},o))}),wl=({setToTitle:e,datasetName:n,datasetIcon:t,isShowDatasetDetails:o,queryFilterDetails:r})=>i.jsxs("div",{children:[n&&o&&i.jsxs("p",{className:"caption mt-4 inline-flex items-center attachment-dataset-name",children:[i.jsx("span",{className:"mr-1 attachment-dataset-icon",children:t}),n]}),r==null?void 0:r.map(l=>{var c;return i.jsxs("p",{className:"body-1 mb-2 last:mb-0",children:[l==null?void 0:l.title,i.jsx("span",{children:e??" set to "}),i.jsx("span",{className:"font-bold",children:(c=l==null?void 0:l.valuesTitles)==null?void 0:c.join(", ")})]},l==null?void 0:l.title)})]}),ml=({titles:e,attachmentInfoList:n,datasetIcon:t})=>i.jsxs("div",{className:"attachment-details flex flex-col",children:[i.jsx("p",{className:V("body-1",n&&n.length<=1&&"mb-2"),children:(e==null?void 0:e.queryUpdatedManuallyTitle)??"Query has been updated manually."}),n==null?void 0:n.map(o=>{var r;return!!((r=o==null?void 0:o.queryFiltersDetails)!=null&&r.length)&&i.jsx(wl,{setToTitle:e==null?void 0:e.setToTitle,datasetName:o==null?void 0:o.datasetName,datasetIcon:t,isShowDatasetDetails:(n==null?void 0:n.length)>1,queryFilterDetails:o==null?void 0:o.queryFiltersDetails},o==null?void 0:o.datasetName)})]}),Yo=({dimensionsInfo:e})=>i.jsx("div",{className:"sidebar flex flex-col w-[176px] gap-3 min-h-0 overflow-auto",children:e.map(n=>i.jsxs("div",{className:"flex flex-col",children:[i.jsx("h5",{className:"text-neutrals-800",children:n.title}),i.jsx("h5",{className:"font-bold",children:n.value})]},n.title))}),pl=({titles:e,chart:n,isOpen:t,onClose:o})=>{const[r,l]=h.useState(j.PopUpState.Closed);h.useEffect(()=>{l(t?j.PopUpState.Opened:j.PopUpState.Closed)},[t]);const c=h.useCallback(()=>{l(j.PopUpState.Closed),o==null||o()},[o]);return i.jsx(i.Fragment,{children:r===j.PopUpState.Opened&&i.jsxs(j.Popup,{heading:i.jsx("h1",{className:"single-chart-popup-heading",children:(e==null?void 0:e.chart)??"Chart"}),containerClassName:"single-chart-popup h-[80%]",portalId:"single-chart",size:j.PopUpSize.LG,dividers:!1,onClose:c,closeButtonTitle:(e==null?void 0:e.close)??"Close",children:[i.jsxs("div",{className:"single-chart-popup-content flex flex-row flex-1 gap-4 min-h-0 h-full",children:[i.jsx("div",{className:"flex flex-col flex-1 min-h-0",children:i.jsx(so,{option:n.config,className:"w-full h-full",style:{width:"100%",height:"100%"}})}),i.jsx(Yo,{dimensionsInfo:n.dimensions})]}),i.jsx("div",{})]})})},Ko=e=>{var p;const[n,t]=h.useState(!1),o=h.useRef(null),[r,l]=h.useState(""),[c,g]=h.useState(""),[a,u]=h.useState(!1),{onboardingFileSchema:s,isShowOnboarding:d}=me(),[f,w]=h.useState(!1),m=h.useCallback(()=>{t(!0)},[]),b=h.useCallback(()=>{t(!1),w(!0)},[]);return h.useEffect(()=>{if(d){const{title:S,description:C}=Re(le.CHART_PER_SERIES,e.titles);l(S),g(C)}},[e.titles,d]),h.useEffect(()=>{d&&u((s==null?void 0:s.lastDisplayedElement)===le.CHART_PER_SERIES&&e.node.rowIndex===0)},[s==null?void 0:s.lastDisplayedElement,e.node.rowIndex,d]),i.jsxs(i.Fragment,{children:[i.jsx("div",{ref:o,children:i.jsx(j.IconButton,{title:((p=e.titles)==null?void 0:p.chart)??"Chart",buttonClassName:"!text-neutrals-1000 !border-none !p-1",icon:i.jsx(Jo,{className:"w-5 h-5"}),onClick:m})}),a&&i.jsx(Ie,{reference:o,title:r,description:c,onReferenceClick:m,shouldCloseTooltip:f}),n&&i.jsx(pl,{chart:e.value,isOpen:n,onClose:b,titles:e.titles})]})},rn=32,Nn=32,xl=16,Sn="padding-0",ln=200,mn={flex:1,minWidth:ln},vl=rn,Zo="observationValueCell",qo="metadataCell",bl="chartCell",nn="Chart_column",Cl=(e,n,t,o,r,l)=>({headerName:"",suppressHeaderMenuButton:!0,suppressNavigable:!0,sortable:!1,editable:!1,pinned:!0,width:32,maxWidth:32,cellClass:Sn,cellRenderer:qo,cellRendererParams:{attributesData:n,dataSetData:e,locale:t,metadataSettings:o,titles:r,action:l}});function kl(e,n,t,o=vl,r,l){return{headerName:"",field:nn,colId:nn,suppressHeaderMenuButton:!0,suppressNavigable:!0,sortable:!1,editable:!1,pinned:"right",width:o,maxWidth:o,minWidth:o,cellClass:Sn,suppressColumnsToolPanel:!0,cellRenderer:Ko,cellRendererParams:{attributesData:n,dataSetData:e,locale:t,titles:r,action:l}}}const pn=["index","value"],Nl=e=>({columns:El(e),data:Sl(e)}),Sl=e=>{const n=e.metadata.time_column,t={};for(const o of e.data.data){const{value:r,...l}=o,c=jl(o,n);t[c]={...t[c]||{},...l,[o[n]]:r}}return Object.values(t)},jl=(e,n)=>Object.keys(e).filter(t=>!pn.includes(t)&&t!==n).map(t=>e[t]).join("."),El=e=>{const{metadata:n,data:t}=e,o=n.time_column,r=n.pinned_columns||[],l=t.schema.fields,c=[],g=t.data.map(f=>f[o]),u=Array.from(new Set(g)).filter(f=>f!=null).map(f=>({field:f,colId:f,headerName:f,cellClass:"text-right",width:ln})),s=r.map(f=>l.find(w=>w.name===f)).filter(f=>f!=null),d=l.filter(f=>!r.includes(f.name)).filter(f=>f!=null);if(s.length>0)for(const f of[...s])f.name===o||pn.includes(f.name)||c.push({colId:f.name,field:f.name,headerName:f.name,pinned:"left",...mn,tooltipValueGetter:w=>w.value});for(const f of[...d])f.name===o||pn.includes(f.name)||c.push({colId:f.name,field:f.name,headerName:f.name,pinned:!1,...mn,tooltipValueGetter:w=>w.value});return c.push(...u),c},Xo=e=>e*Nn+rn+xl,Dl=({attachment:e,actions:n,className:t="",showLimitMessage:o})=>{const[r,l]=h.useState(!1),[c,g]=h.useState([]),[a,u]=h.useState(),[s,d]=h.useState(400);h.useEffect(()=>{e.url!=null&&(l(!0),n.getFile(e.url).then(w=>{if(w==null){g([]),u([]),l(!1);return}const{columns:m,data:b}=Nl(w);g(b),u(m),l(!1)}))},[e.url,n]),h.useEffect(()=>{c?(d(Xo(c.length)),o==null||o(c.length>=j.SERIES_LIMIT)):o==null||o(!1)},[c,o]);const f=h.useMemo(()=>i.jsx(co.AgGridReact,{headerHeight:rn,rowHeight:Nn,rowData:c,columnDefs:a,enableCellTextSelection:!0,domLayout:"normal",tooltipShowDelay:0,tooltipShowMode:"whenTruncated",autoSizeStrategy:{type:a&&(a==null?void 0:a.length)>5?"fitCellContents":"fitGridWidth"}}),[c,a]);return r?i.jsx(j.Loader,{}):i.jsx("div",{className:`w-full ${t}`,children:i.jsx("div",{className:"ag-theme-quartz w-full min-h-[80px] max-h-[400px]",style:{height:s},children:f})})},Al=({icon:e,title:n})=>i.jsx("div",{className:V("px-3 py-4 rounded border mt-3","attachment-collapsed"),children:i.jsxs("p",{className:V("flex body-3 items-center"),children:[e,i.jsxs("span",{className:"ml-2",children:[" ",n]})]})}),xn=e=>X.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},X.createElement("path",{d:"M7.4665 6.39967H8.53317V5.33301H7.4665V6.39967ZM7.4665 10.6663H8.53317V7.46634H7.4665V10.6663ZM7.9945 13.333C5.0505 13.333 2.6665 10.9437 2.6665 7.99967C2.6665 5.05567 5.0505 2.66634 7.9945 2.66634C10.9438 2.66634 13.3332 5.05567 13.3332 7.99967C13.3332 10.9437 10.9438 13.333 7.9945 13.333ZM7.99984 3.73301C5.6425 3.73301 3.73317 5.64234 3.73317 7.99967C3.73317 10.357 5.6425 12.2663 7.99984 12.2663C10.3572 12.2663 12.2665 10.357 12.2665 7.99967C12.2665 5.64234 10.3572 3.73301 7.99984 3.73301Z",fill:"currentColor"})),yl=({title:e,value:n})=>{const t=h.useCallback(()=>Array.isArray(n)?n.join(", "):n,[n]);return i.jsxs("div",{className:"flex gap-x-3 body-3",children:[i.jsxs("p",{title:e,className:"text-neutrals-800",children:[e,":"]}),i.jsx("p",{title:t(),className:"font-semibold truncate pr-3",children:t()})]})},Ml=({title:e,value:n,attachedKeysTitles:t,locale:o})=>{const[r,l]=h.useState(!1),[c,g]=h.useState(!1),a=h.useRef(null),u=h.useCallback(()=>{c&&l(d=>!d)},[l,c]),s=h.useCallback(()=>{var d;return Array.isArray(n)?(d=n==null?void 0:n.map(f=>typeof f=="object"?f==null?void 0:f[o]:f))==null?void 0:d.join(", "):n},[o,n]);return h.useEffect(()=>{var d,f;a!=null&&a.current&&g(((d=a==null?void 0:a.current)==null?void 0:d.scrollHeight)>((f=a==null?void 0:a.current)==null?void 0:f.offsetHeight))},[a]),i.jsxs("div",{className:"metadata-item",children:[t==null?void 0:t.map(d=>i.jsx("div",{title:d,className:"metadata-item-key pr-3 mb-1 text-neutrals-800",children:d},d)),i.jsxs("div",{className:V("flex items-center",c&&"justify-between"),children:[i.jsx("h2",{title:e,className:"metadata-item-title",children:e}),c&&i.jsx(j.IconButton,{buttonClassName:V("border-none p-0 w-6 h-6",r?"rotate-[180deg]":""),isBaseIconStyles:!1,icon:i.jsx(bn,{width:24,height:24}),onClick:u})]}),i.jsx("p",{title:s(),className:V("metadata-item-value pr-3",!r&&"line-clamp-4"),ref:a,children:s()})]})},jn=({metadata:e,metadataDescription:n=[],isOpenMetadata:t,onCloseMetadata:o,titles:r,locale:l})=>{const[c,g]=h.useState(j.PopUpState.Closed);h.useEffect(()=>{g(t?j.PopUpState.Opened:j.PopUpState.Closed)},[t]);const a=h.useCallback(()=>{g(j.PopUpState.Closed),o==null||o()},[o]);return i.jsx(i.Fragment,{children:c===j.PopUpState.Opened&&i.jsxs(j.Popup,{heading:i.jsx("h1",{className:"metadata-heading",children:(r==null?void 0:r.metadata)||"Metadata"}),containerClassName:"metadata h-[80%]",portalId:"metadata",size:j.PopUpSize.LG,dividers:!1,onClose:a,closeButtonTitle:(r==null?void 0:r.close)||"Close",children:[i.jsxs("div",{className:"metadata-content overflow-hidden h-full",children:[(n==null?void 0:n.length)>0&&i.jsx("div",{className:"metadata-description",children:n==null?void 0:n.map(u=>i.jsx(yl,{title:u==null?void 0:u.title,value:u==null?void 0:u.value},u==null?void 0:u.title))}),i.jsx("div",{className:"h-full overflow-y-auto metadata-list",children:e&&(e==null?void 0:e.length)>0?e==null?void 0:e.map(u=>i.jsx(Ml,{title:u==null?void 0:u.title,value:u==null?void 0:u.value,locale:l,attachedKeysTitles:u==null?void 0:u.attachedKeysTitles},(u==null?void 0:u.id)||(u==null?void 0:u.title))):i.jsx("div",{className:"metadata-empty text-neutrals-700 flex h-full justify-center items-center",children:(r==null?void 0:r.noMetadata)||"No metadata"})})]}),i.jsx("div",{})]})})},Tl=e=>{var n,t;return(t=e==null?void 0:e.data[((n=e==null?void 0:e.colDef)==null?void 0:n.field)||0])==null?void 0:t.obsAttributes},Ol=e=>{var n;return(n=e==null?void 0:e.data)==null?void 0:n.attributes},Qo=(e,n)=>Object.entries(e==null?void 0:e.data).filter(([t])=>n==null?void 0:n.get(t)).map(([t,o])=>({name:t,value:String(o)})),qt=(e,n,t)=>{var r;const o=typeof e=="object"?e==null?void 0:e[n]:e;return t?D.getLocalizedName((r=t==null?void 0:t.codes)==null?void 0:r.find(l=>(l==null?void 0:l.id)===e),n)||"":o},tn=(e,n,t)=>(e==null?void 0:e.map(o=>{var a;const r=(o==null?void 0:o.name)||"",l=n==null?void 0:n.get(r),c=(a=l==null?void 0:l.codes)!=null&&a.length?l:void 0,g=Array.isArray(o==null?void 0:o.value)?o==null?void 0:o.value.map(u=>qt(u,t,c)):qt(o==null?void 0:o.value,t,c);return{id:D.getLocalizedName(c,t)||(o==null?void 0:o.name),title:D.getLocalizedName(c||l,t),value:g||(o==null?void 0:o.value)}}))||[],an=(e,n,t)=>({title:(t==null?void 0:t.dataset)||"Dataset",value:D.getLocalizedName(e,n)}),Ll=(e,n,t,o)=>[an(e,t,o),{title:(o==null?void 0:o.agency)??"Agency",value:e==null?void 0:e.agencyID},{title:(o==null?void 0:o.lastUpdated)??"Last updated",value:n}],er=(e,n,t)=>{var o,r;return{title:D.getDimensionTitle(e==null?void 0:e.conceptSchemes,(r=(o=D.getDimensions(e))==null?void 0:o.timeDimensions)==null?void 0:r[0],n),value:(t==null?void 0:t.colId)||""}},nr=(e,n)=>({title:(n==null?void 0:n.observation)||"Observation",value:e}),tr=(e,n,t,o,r,l)=>{var g;const c={title:(o==null?void 0:o.timeSeries)||"Time Series",value:(g=l==null?void 0:l.originalData)==null?void 0:g.name};return t?[er(e,n,r),c,nr(t,o)]:[c]},_l=e=>{var o,r,l,c,g;const n=((r=(o=e==null?void 0:e.dataSets)==null?void 0:o[0])==null?void 0:r.attributes)||[],t=((g=(c=(l=e==null?void 0:e.structures)==null?void 0:l[0])==null?void 0:c.attributes)==null?void 0:g.dataSet)||[];return n!=null&&n.length?t.map((a,u)=>{var s;return((s=a==null?void 0:a.values)==null?void 0:s.length)>0?{...a}:{...a,values:[{value:n==null?void 0:n[u]}]}}):t},Rl=(e,n,t)=>(e==null?void 0:e.map(o=>{var d,f,w,m,b,p,S,C;const r=o==null?void 0:o.id,l=((f=(d=o==null?void 0:o.values)==null?void 0:d[0])==null?void 0:f.value)||((m=(w=o==null?void 0:o.values)==null?void 0:w[0])==null?void 0:m.id),c=(p=(b=o==null?void 0:o.values)==null?void 0:b[0])==null?void 0:p.ids,g=n==null?void 0:n.get(r),a=(S=g==null?void 0:g.codes)!=null&&S.length?g:void 0,u=D.getLocalizedName((C=a==null?void 0:a.codes)==null?void 0:C.find(x=>(x==null?void 0:x.id)===l),t)||l,s=c&&c.map(x=>{var N;return D.getLocalizedName((N=a==null?void 0:a.codes)==null?void 0:N.find(v=>(v==null?void 0:v.id)===x),t)||x});return{id:r,title:D.getLocalizedName(g,t)||r,value:c?s:u}}).filter(({value:o})=>!!o))||[],Il=(e,n)=>{var c,g,a;const t=(c=e==null?void 0:e.dataSets)==null?void 0:c[0],o=(g=e==null?void 0:e.structures)==null?void 0:g[0],r=((a=o==null?void 0:o.attributes)==null?void 0:a.dimensionGroup)||[],l=t==null?void 0:t.dimensionGroupAttributes;return new Map(r.map(u=>{var w;const s=(w=u==null?void 0:u.relationship)==null?void 0:w.dimensions,{codedSeriesKey:d,decodedSeriesKey:f}=Pl(e,n,s);return[u.id,{values:(l==null?void 0:l[d])||[],decodedSeriesKey:f,codedSeriesKey:d}]}))},Pl=(e,n,t)=>{var g,a,u;const o=(g=e==null?void 0:e.structures)==null?void 0:g[0],r=[...(o==null?void 0:o.dimensions.series)||[],...(o==null?void 0:o.dimensions.observation)||[]],l=(a=new Array(r==null?void 0:r.length))==null?void 0:a.fill(""),c=(u=new Array(r==null?void 0:r.length))==null?void 0:u.fill("");return t&&(t==null||t.forEach(s=>{var m,b;const d=(r==null?void 0:r.findIndex(p=>(p==null?void 0:p.id)===s))||0,f=n[d],w=((b=(m=r[d])==null?void 0:m.values)==null?void 0:b.findIndex(p=>(p==null?void 0:p.id)===f||(p==null?void 0:p.value)===f))||0;l[d]=w>=0?w:f,c[d]=f})),{codedSeriesKey:l==null?void 0:l.join(":"),decodedSeriesKey:c==null?void 0:c.join(":")}},Vl=(e,n)=>{var l;if(n==null)return;const t=(l=e==null?void 0:e.values)==null?void 0:l[n],o=typeof n=="object"&&!Array.isArray(n),r=Array.isArray(n);return t||(o||r?{values:n}:{value:n==null?void 0:n.toString()})},Fl=e=>{const n=(e==null?void 0:e.value)||(e==null?void 0:e.id),t=(e==null?void 0:e.values)||(e==null?void 0:e.ids);return n!=null?[n]:t||[null]},or=(e,n,t)=>{var r,l;if(n==null)return n;const o=(l=(r=t==null?void 0:t.get(e||""))==null?void 0:r.codes)==null?void 0:l.find(c=>(c==null?void 0:c.id)===n);return(o==null?void 0:o.name)||n},Bl=(e,n,t,o=ee.Locale.EN)=>{var a;const r=(a=t==null?void 0:t.dataStructureComponents)==null?void 0:a.dimensionList,l=[...(r==null?void 0:r.dimensions)||[],...(r==null?void 0:r.timeDimensions)||[]],c=[],g=(e==null?void 0:e.split(":"))||[];return g==null||g.forEach((u,s)=>{var d;if(u!==""){const f=((d=l==null?void 0:l[s])==null?void 0:d.id)||"",w=D.getLocalizedName(n==null?void 0:n.get(f),o),m=or(f,u,n);c.push(`${w}: ${m}`)}}),c},Hl=(e,n,t,o,r=ee.Locale.EN)=>{var g,a,u,s;if(!e||!n||!o)return[];const l=((u=(a=(g=e==null?void 0:e.structures)==null?void 0:g[0])==null?void 0:a.attributes)==null?void 0:u.dimensionGroup)||[],c=Il(e,o);return((s=l==null?void 0:l.map((d,f)=>{var p;const w=c==null?void 0:c.get(d==null?void 0:d.id),m=t==null?void 0:t.get(d==null?void 0:d.id),b=Fl(Vl(d,(p=w==null?void 0:w.values)==null?void 0:p[f]));return{id:d==null?void 0:d.id,title:D.getLocalizedName(m,r),value:Array.isArray(b)?b==null?void 0:b.map(S=>or(d==null?void 0:d.id,S,t)||""):b,attachedKeysTitles:Bl(w==null?void 0:w.decodedSeriesKey,t,n)}}))==null?void 0:s.filter(({value:d})=>d==null?void 0:d.some(f=>!!f)))||[]},Gl=e=>{var x,N;const[n,t]=h.useState(!1),o=h.useRef(null),[r,l]=h.useState(""),[c,g]=h.useState(""),[a,u]=h.useState(!1),{onboardingFileSchema:s,isShowOnboarding:d}=me(),[f,w]=h.useState(!1),m=h.useMemo(()=>D.getStructureComponentsMap(e==null?void 0:e.dataSetData),[e==null?void 0:e.dataSetData]),b=h.useMemo(()=>{var v,E,_,M,y,k;return[an((E=(v=e==null?void 0:e.dataSetData)==null?void 0:v.dataflows)==null?void 0:E[0],e==null?void 0:e.locale,e.titles),...tn(Qo(e,m),m,e==null?void 0:e.locale),...tn(Ol(e),m,e==null?void 0:e.locale),...Hl(e==null?void 0:e.attributesData,(M=(_=e==null?void 0:e.dataSetData)==null?void 0:_.dataStructures)==null?void 0:M[0],m,(k=(y=e==null?void 0:e.data)==null?void 0:y.originalData)==null?void 0:k.parsedTimeSeriesValue,e==null?void 0:e.locale)]},[e,m]),p=h.useMemo(()=>tr(e==null?void 0:e.dataSetData,e==null?void 0:e.locale,(e==null?void 0:e.valueFormatted)||(e==null?void 0:e.value),e.titles,e==null?void 0:e.colDef,e==null?void 0:e.data),[e]),S=h.useCallback(()=>{t(!0)},[]),C=h.useCallback(()=>{t(!1),w(!0)},[]);return h.useEffect(()=>{if(d){const{title:v,description:E}=Re(le.METADATA_PER_SERIES,e.titles);l(v),g(E)}},[e.titles,d]),h.useEffect(()=>{if(d){const v=(s==null?void 0:s.lastDisplayedElement)===le.METADATA_PER_SERIES&&e.node.rowIndex===0;u(v),v&&setTimeout(()=>{var E;(E=o==null?void 0:o.current)==null||E.scrollIntoView({block:"end",behavior:"smooth"})})}},[s==null?void 0:s.lastDisplayedElement,e.node.rowIndex,d]),i.jsxs(i.Fragment,{children:[i.jsx("div",{ref:o,children:i.jsx(j.IconButton,{title:((x=e.titles)==null?void 0:x.metadata)||"View details",buttonClassName:"!text-neutrals-1000 !border-none !p-1",icon:i.jsx(xn,{className:"w-5 h-5"}),onClick:S})}),a&&i.jsx(Ie,{reference:o,title:r,description:c,onReferenceClick:S,shouldCloseTooltip:f}),n&&i.jsx(jn,{titles:e.titles,locale:e==null?void 0:e.locale,metadata:b,metadataDescription:(N=e==null?void 0:e.metadataSettings)!=null&&N.isMetadataDescription?p:[],isOpenMetadata:n,onCloseMetadata:C})]})},Ul=e=>{var u,s;const[n,t]=h.useState(!1),o=h.useMemo(()=>D.getStructureComponentsMap(e==null?void 0:e.dataSetData),[e==null?void 0:e.dataSetData]),r=h.useMemo(()=>tn(Tl(e),o,e==null?void 0:e.locale),[e,o]),l=h.useMemo(()=>{var d,f,w;return[an((f=(d=e==null?void 0:e.dataSetData)==null?void 0:d.dataflows)==null?void 0:f[0],e==null?void 0:e.locale,e==null?void 0:e.titles),...tn(Qo(e,o),o,e==null?void 0:e.locale),...(w=e==null?void 0:e.metadataSettings)!=null&&w.isMetadataDescription?[]:[er(e==null?void 0:e.dataSetData,e==null?void 0:e.locale,e==null?void 0:e.colDef),nr((e==null?void 0:e.valueFormatted)||(e==null?void 0:e.value),e==null?void 0:e.titles)],...r]},[e,o,r]),c=h.useMemo(()=>tr(e==null?void 0:e.dataSetData,e==null?void 0:e.locale,(e==null?void 0:e.valueFormatted)||(e==null?void 0:e.value),e==null?void 0:e.titles,e==null?void 0:e.colDef,e==null?void 0:e.data),[e]),g=h.useCallback(()=>{t(!0)},[]),a=h.useCallback(()=>{t(!1)},[]);return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"w-full h-full p-2 text-end relative",children:[(e==null?void 0:e.valueFormatted)||(e==null?void 0:e.value),(r==null?void 0:r.length)>0&&i.jsx("div",{className:"metadata-indicator",title:((u=e.titles)==null?void 0:u.metadata)||"View details",onClick:g})]}),n&&i.jsx(jn,{titles:e.titles,locale:e==null?void 0:e.locale,metadata:l,metadataDescription:(s=e==null?void 0:e.metadataSettings)!=null&&s.isMetadataDescription?c:[],isOpenMetadata:n,onCloseMetadata:a})]})},zl=({attachment:e,isDataLoading:n,chartColumn:t,fixHeight:o,titles:r,showLimitMessage:l})=>{const[c,g]=h.useState(!1),[a,u]=h.useState([]),[s,d]=h.useState(),[f,w]=h.useState(400),m=h.useRef(null),[b,p]=h.useState(""),[S,C]=h.useState(""),[x,N]=h.useState(!1),{isShowOnboarding:v,onboardingFileSchema:E,setOnboardingFileSchema:_}=me();h.useEffect(()=>{if(e.grid_data==null)g(!0);else{const y=e.grid_data.columns.map(k=>k.colId===nn?{...k,hide:!t}:k);u(e.grid_data.data),d(y),g(!1)}},[e.grid_data,t]),h.useEffect(()=>{a?(w(Xo(a.length)),l==null||l(a.length>=j.SERIES_LIMIT)):l==null||l(!1)},[a,l]),h.useEffect(()=>{if(v){const{title:y,description:k}=Re(le.DATA_GRID,r);p(y),C(k)}},[r,v]),h.useEffect(()=>{var y;E&&!((y=E==null?void 0:E.infoElements)!=null&&y.dataGrid)&&(_==null||_({...E,infoElements:{...E==null?void 0:E.infoElements,dataGrid:!0},lastDisplayedElement:le.DATA_GRID}))},[E,_]),h.useEffect(()=>{if(v){const y=(E==null?void 0:E.lastDisplayedElement)===le.DATA_GRID;N(y),!c&&!n&&y&&setTimeout(()=>{var k;(k=m==null?void 0:m.current)==null||k.scrollIntoView({block:"end",behavior:"smooth"})})}},[E==null?void 0:E.lastDisplayedElement,v,n,c]);const M=h.useMemo(()=>i.jsx(co.AgGridReact,{headerHeight:rn,rowHeight:Nn,rowData:a,enableCellTextSelection:!0,columnDefs:s,domLayout:"normal",tooltipShowDelay:0,tooltipShowMode:"whenTruncated",components:{[qo]:Gl,[Zo]:Ul,[bl]:Ko}}),[a,s]);return c||n?i.jsx(j.Loader,{}):i.jsxs("div",{className:"w-full h-full",children:[i.jsx("div",{ref:m,className:V("ag-theme-quartz w-full min-h-[80px]",o?"max-h-[400px]":"max-h-full"),style:{height:f},children:M}),x&&i.jsx(Ie,{reference:m,title:b,description:S,supressReferenceClick:!0})]})},Wl=200,$l=8,Jl=2,Yl=({currentIndex:e,totalCount:n,icons:t,titles:o,onPrev:r,onNext:l})=>{const c=h.useRef(null),[g,a]=h.useState(""),[u,s]=h.useState(""),[d,f]=h.useState(!1),{onboardingFileSchema:w,isShowOnboarding:m}=me();h.useEffect(()=>{if(m){const{title:C,description:x}=Re(le.CHARTS_NAVIGATION,o);a(C),s(x)}},[o,m]),h.useEffect(()=>{var C;if(m){const x=(w==null?void 0:w.lastDisplayedElement)===le.CHARTS_NAVIGATION;f(x),x&&((C=c==null?void 0:c.current)==null||C.scrollIntoView({block:"center",behavior:"smooth"}))}},[w==null?void 0:w.lastDisplayedElement,m]);const b=n>0?e/n*100:0,p=n>0?Math.min($l*n,Wl):0,S=n>0?Math.max(p/n,Jl):0;return i.jsxs("div",{className:"w-full flex flex-row items-center gap-2 justify-center",children:[i.jsx("div",{className:V("h-[20px] w-[20px] cursor-pointer",e===0?"text-neutrals-700":"text-primary"),onClick:r,children:t==null?void 0:t[Xe.PREVIOUS]}),i.jsxs("div",{className:"flex flex-col items-center gap-1 pt-[20px]",children:[i.jsx("div",{className:"h-[4px] rounded-full bg-neutral-300 relative",style:{width:`${p}px`},children:i.jsx("div",{className:"h-full rounded-full bg-primary absolute",style:{left:`${b}%`,width:`${S}px`}})}),i.jsxs("h5",{className:"text-neutrals-800",children:[e+1,"/",n]})]}),i.jsx("div",{className:V("h-[20px] w-[20px] cursor-pointer",e+1===n?"text-neutrals-700":"text-primary"),onClick:l,ref:c,children:t==null?void 0:t[Xe.NEXT]}),d&&i.jsx(Ie,{reference:c,title:g,description:u})]})},Kl=({limitAmount:e,titles:n,openAdvancedView:t})=>{const[o,r]=h.useState(!1),{refs:l,floatingStyles:c,context:g}=ke.useFloating({open:o,onOpenChange:r,placement:"top-start"}),a=ke.useHover(g,{handleClose:ke.safePolygon({blockPointerEvents:!0})}),{getReferenceProps:u,getFloatingProps:s}=ke.useInteractions([a]);return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex w-fit",ref:l.setReference,...u(),children:i.jsxs("div",{className:"flex bg-hues-100 w-fit px-4 mt-1 py-2 gap-1",children:[i.jsx("h5",{className:"font-bold",children:(n==null?void 0:n.limits)||"Limited to"}),i.jsxs("h5",{children:[e," ",(n==null?void 0:n.timeseriesLimit)||"Timeseries"]})]})}),o&&i.jsx("div",{className:"floating",ref:l.setFloating,style:c,...s(),children:i.jsxs("div",{className:"flex flex-col bg-white z-10 p-4 rounded shadow w-[300px] mb-2 gap-2",children:[i.jsxs("div",{children:[i.jsxs("h5",{className:"text-neutrals-900",children:[i.jsx("span",{className:"pr-0.5",children:(n==null?void 0:n.limitLinkInfoP1_1)||"The number of timeseries displayed in a single chart i"}),i.jsxs("span",{className:"font-bold pr-0.5",children:[(n==null?void 0:n.limitLinkInfoP1_2)||"limited to"," ",e]}),(n==null?void 0:n.limitLinkInfoP1_3)||"for better clarity and performance."]}),i.jsxs("h5",{className:"text-neutrals-900",children:[i.jsx("span",{className:"pr-0.5",children:(n==null?void 0:n.limitLinkInfoP2_1)||"To visualize specific timeseries"}),i.jsx("span",{className:"font-bold pr-0.5",children:(n==null?void 0:n.limitLinkInfoP2_2)||"filter"}),i.jsx("span",{className:"pr-0.5",children:(n==null?void 0:n.limitLinkInfoP2_3)||"your request, or"}),i.jsx("span",{className:"font-bold pr-0.5",children:(n==null?void 0:n.limitLinkInfoP2_4)||"refine"}),(n==null?void 0:n.limitLinkInfoP2_5)||"it in the chat."]})]}),t&&i.jsx("h4",{className:"cursor-pointer text-primary",onClick:t,children:(n==null?void 0:n.limitLinkInfoLink)||"Open Advanced View"})]})})]})};function Zl(e,n,t){var u,s,d,f;const o=(s=((u=e.getZr())==null?void 0:u.painter).getRenderedCanvas())==null?void 0:s.getContext("2d");if(!o)return 0;const r=((d=t.textStyle)==null?void 0:d.fontSize)??12,l=((f=t.textStyle)==null?void 0:f.fontFamily)??"sans-serif";o.font=`${r}px ${l}`;const c=o.measureText(n).width,g=t.itemWidth??25,a=t.itemGap??10;return c+g+a}const ql=({option:e,style:n})=>{const t=h.useRef(null),[o,r]=h.useState(e);h.useEffect(()=>{r(uo.cloneDeep(e))},[e]);const l=h.useCallback(()=>{var S,C,x;const c=(C=(S=t.current)==null?void 0:S.getEchartsInstance)==null?void 0:C.call(S);if(!c)return;const a=c.getDom().clientWidth,u=e.legend||{},s=u.itemHeight??14,d=((x=u.textStyle)==null?void 0:x.fontSize)??12,f=c.getModel().getComponent("legend").getData()||[];let w=0;f.forEach(N=>{const v=N.option.name||"";w+=Zl(c,v,u)});const b=Math.max(1,Math.ceil(w/a))*(+s+ +d+6),p=20;r(N=>({...N,grid:{...N.grid||{},bottom:b+p}}))},[e.legend]);return h.useEffect(()=>{l();const c=()=>{l()};return window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)}},[e,l]),i.jsx(so,{notMerge:!0,lazyUpdate:!1,ref:t,option:o,style:n})},Xl=({attachment:e,icons:n,isDataLoading:t,openAdvancedView:o,fixHeight:r=!0,titles:l})=>{const[c,g]=h.useState(!0),[a,u]=h.useState([]),[s,d]=h.useState(0),[f,w]=h.useState(void 0),{onboardingFileSchema:m,isShowOnboarding:b,setOnboardingFileSchema:p}=me(),S=h.useRef(null);h.useEffect(()=>{var N;g(e.charting_data==null),u(((N=e.charting_data)==null?void 0:N.units)||[])},[e.charting_data]),h.useEffect(()=>{const N=(a==null?void 0:a.length)>=s;w(!c&&N?a[s]:a[0]),N||d(0)},[c,a,s]),h.useEffect(()=>{var N;m&&b&&!c&&(Ui(m)&&(p==null||p(Gi(m)),(N=S==null?void 0:S.current)==null||N.scrollIntoView({block:"center",behavior:"smooth"})),m.lastDisplayedElement===le.CHART_PER_SERIES&&(p==null||p(Uo(m))))},[c,p,m,b]);const C=h.useCallback(()=>{d(N=>Math.min(N+1,a.length-1))},[a]),x=h.useCallback(()=>{d(N=>Math.max(N-1,0))},[]);return c||t?i.jsx(j.Loader,{}):i.jsx("div",{className:"chart-attachment w-full h-full",ref:S,children:e.charting_data&&i.jsx("div",{className:"flex flex-col w-full h-full gap-4",children:a.length==0||f==null?i.jsx("h4",{className:"ml-1",children:(l==null?void 0:l.chartInfo)||"No data"}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsxs("h3",{className:"chart-attachment-title",children:[(l==null?void 0:l.chart)||"Chart"," ",s+1,"/",a.length]}),i.jsx("span",{className:"text-neutrals-700 h4 chart-attachment-info",children:(l==null?void 0:l.chartInfo)||"Chart Information"})]}),i.jsxs("div",{className:V("chart-area overflow-hidden flex flex-row gap-4 h-full ",r&&"max-h-[400px] min-h-[400px]",!r&&"min-h-[300px]"),children:[i.jsxs("div",{className:"flex flex-col flex-1 min-h-0 min-w-0 gap-4",children:[i.jsx(ql,{option:f.config,style:{width:"100%",height:"100%",minHeight:0}}),f.limitedByRowsAmountTo&&i.jsx(Kl,{limitAmount:f.limitedByRowsAmountTo,openAdvancedView:o,titles:l}),a.length>1&&i.jsx(Yl,{icons:n,currentIndex:s,totalCount:a.length,titles:l,onNext:C,onPrev:x})]}),i.jsx(Yo,{dimensionsInfo:f.dimensions})]})]})})})},Ql=e=>X.createElement("svg",{width:44,height:24,viewBox:"0 0 44 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},X.createElement("rect",{width:44,height:24,rx:12,fill:"currentColor"}),X.createElement("circle",{cx:32,cy:12,r:10,fill:"white"})),ea=e=>X.createElement("svg",{width:44,height:24,viewBox:"0 0 44 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},X.createElement("rect",{width:44,height:24,rx:12,fill:"currentColor"}),X.createElement("circle",{cx:12,cy:12,r:10,fill:"white"})),Xt=[{value:D.SdmxDataFormat.JSON,title:"SDMX-JSON"},{value:D.SdmxDataFormat.XML,title:"SDMX-ML (XML)"},{value:D.SdmxDataFormat.CSV,title:"SDMX-CSV"}],na=e=>[{value:D.FileColumnsAttribute.ID,title:(e==null?void 0:e.idOptions)||"ID",description:e==null?void 0:e.idOptionsDescription},{value:D.FileColumnsAttribute.NAME,title:(e==null?void 0:e.nameOptions)||"Name",description:e==null?void 0:e.nameOptionsDescription},{value:D.FileColumnsAttribute.ID_NAME,title:(e==null?void 0:e.idAndNameOptions)||"Combined ID and Name",description:e==null?void 0:e.idAndNameOptionsDescription}],Qt=({title:e,items:n,selectedValue:t,setSelectedValue:o,infoMessage:r})=>i.jsxs(j.CollapsibleBlock,{title:e,value:t.title,children:[i.jsx("div",{className:"flex flex-col gap-y-1",children:n.map(l=>i.jsx("div",{className:"flex flex-col",children:i.jsx(j.Radio,{id:l.value,checked:t.value===l.value,label:l.title,description:l.description,onChange:()=>{o(l)},radioIcon:i.jsx(Ee.IconCircleFilled,{className:"w-3 h-3"})},l.value)},l.value))}),r]}),ta=(e,n,t,o)=>{if(o!=null&&o.filterKey&&e===D.DownloadType.DATA_IN_TABLE)return o;let r=null,l=null;return n&&t&&e===D.DownloadType.DATA_IN_TABLE&&(r=t==null?null:D.getTimeSeriesFilterKey(t,n.filters),l=D.getTimeQueryFilter(n,D.getTimeDimension(t))),{filterKey:r,timeFilter:l}},oa=({actions:e,dataQuery:n,datasetIcon:t,isDisplayDatasetIcon:o=!0,datasetName:r,onCloseModal:l,type:c=D.DownloadType.FULL_DATASET,locale:g=ee.Locale.EN,dimensions:a,filters:u,urn:s,titles:d,limitMessages:f,showLimitMessage:w,externalLink:m})=>{const b=na(d),[p,S]=h.useState(Xt[0]),[C,x]=h.useState(b[0]),[N,v]=h.useState(!0),E=h.useCallback(()=>{const _=ta(c,n,a,u),M=(n==null?void 0:n.urn)||s||"",y=C.value,k=p.value,A=`${r}.${k}`;e.downloadDataSet(M,k,g,y,_,A,N),l()},[c,n,a,u,s,C.value,p.value,e,g,N,l,r]);return i.jsxs(j.Popup,{heading:i.jsx("p",{className:"download-heading h2",children:(d==null?void 0:d.download)||"Download"}),portalId:"filters",size:j.PopUpSize.LG,containerClassName:"download-popup h-[80%]",dividers:!1,onClose:l,closeButtonTitle:(d==null?void 0:d.close)||"Close",children:[i.jsxs("div",{className:"download-info flex flex-col gap-1 px-6",children:[i.jsxs("div",{className:"download-info-text flex gap-1",children:[i.jsxs("p",{className:"text-neutrals-800 body-3",children:[(d==null?void 0:d.dataset)||"Dataset",":"]}),i.jsxs("span",{className:"h4 flex flex-row gap-x-1 flex-1 min-w-0",children:[o&&t,i.jsx("p",{className:"flex-1 min-w-0 truncate",children:r})]})]}),w&&i.jsx(j.RequestLimitMessage,{limitMessages:f,isDownload:!0,query:m})]}),i.jsxs("div",{className:"download-settings flex flex-col overflow-auto p-6",children:[i.jsx(Qt,{title:(d==null?void 0:d.dataFormat)||"Data Format",selectedValue:p,setSelectedValue:S,items:Xt,infoMessage:i.jsx(j.DownloadFormatMessage,{limitMessages:f,query:m})}),i.jsx(Qt,{title:(d==null?void 0:d.attributes)||"Attributes",selectedValue:C,setSelectedValue:x,items:b}),i.jsx(j.CollapsibleBlock,{title:(d==null?void 0:d.metadata)||"Metadata",value:N?(d==null?void 0:d.all)||"Included":(d==null?void 0:d.none)||"Not included",children:i.jsxs("div",{className:`flex gap-4 cursor-pointer download-metadata ${N?"download-metadata-active":""}`,children:[N?i.jsx(Ql,{width:44,height:24,className:"text-primary",onClick:()=>{v(!N)}}):i.jsx(ea,{width:44,height:24,className:"text-neutrals-500",onClick:()=>{v(!N)}}),i.jsx("div",{children:(d==null?void 0:d.includeMetadata)||"Include Metadata"})]})})]}),i.jsx("div",{className:"download-button flex p-6 mt-auto",children:i.jsx(j.Button,{buttonClassName:"text-button-primary",title:(d==null?void 0:d.download)||"Download",onClick:E})})]})},ra=({id:e,title:n,version:t,agency:o,isActive:r,isSingleTab:l,onSelectDataset:c})=>i.jsx("div",{className:V("dataset-tab truncate last:mr-4",r?"dataset-tab-active":"border-b-transparent",l?"dataset-tab-single cursor-default":"cursor-pointer"),title:n,onClick:()=>{l||c(D.generateShortUrn(e,t,o))},children:i.jsx("h3",{className:"dataset-tab-title truncate",title:n,children:n})}),rr=({datasets:e,locale:n,isHideAdvancedViewButton:t,openAdvancedViewIcon:o,initialSelectedDatasetUrn:r,selectDataset:l,onOpenAdvancedView:c,titles:g})=>{const{isOpenedAdvancedView:a}=_e(),[u,s]=h.useState(),d=h.useRef(null),[f,w]=h.useState(""),[m,b]=h.useState(""),[p,S]=h.useState(!1),{onboardingFileSchema:C,isShowOnboarding:x}=me();h.useEffect(()=>{if(x){const{title:v,description:E}=Re(le.OPEN_ADVANCED_VIEW,g);w(v),b(E)}},[g,x]),h.useEffect(()=>{var v;if(x){const E=(C==null?void 0:C.lastDisplayedElement)===le.OPEN_ADVANCED_VIEW;S(E),E&&((v=d==null?void 0:d.current)==null||v.scrollIntoView({block:"center",behavior:"smooth"}))}},[C==null?void 0:C.lastDisplayedElement,x]),h.useEffect(()=>{if(!r&&!u&&(e!=null&&e[0])){const v=D.generateShortUrn(e[0].id,e[0].version,e[0].agencyID);s(v),l==null||l(v)}else r&&r!==u&&(s(r),l==null||l(r))},[e,l,r,u]);const N=h.useCallback(v=>{s(v),l==null||l(v)},[l]);return i.jsxs("div",{className:V("dataset-tabs flex justify-between items-center w-full",t&&a&&"hide-advance-button"),children:[i.jsx("div",{className:"flex items-center w-full overflow-y-auto gap-4 sm:w-[calc(100%-30px)]",children:e==null?void 0:e.map(v=>i.jsx(ra,{id:v==null?void 0:v.id,title:D.getLocalizedName(v,n||ee.Locale.EN),version:v==null?void 0:v.version,agency:v==null?void 0:v.agencyID,isActive:(e==null?void 0:e.length)>1&&u===D.generateShortUrn(v==null?void 0:v.id,v==null?void 0:v.version,v==null?void 0:v.agencyID),isSingleTab:(e==null?void 0:e.length)===1,onSelectDataset:N},v==null?void 0:v.id))}),!t&&i.jsx("div",{ref:d,children:i.jsx(j.IconButton,{buttonClassName:"advanced-view-button",icon:o,onClick:c})}),p&&i.jsx(Ie,{reference:d,title:f,description:m,onReferenceClick:c,shouldCloseTooltip:a})]})},ia=(e,n,t,o)=>n==null?void 0:n.map(r=>{var d;const l=e==null?void 0:e.find(f=>(f==null?void 0:f.urn)===(r==null?void 0:r.urn)),c=t==null?void 0:t.get(r==null?void 0:r.urn),g=(c==null?void 0:c.conceptSchemes)||[],a=(c==null?void 0:c.codelists)||[],u=D.getDimensions(c),s=[...(u==null?void 0:u.dimensions)||[],...(u==null?void 0:u.timeDimensions)||[]];return{datasetName:D.getLocalizedName((d=c==null?void 0:c.dataflows)==null?void 0:d[0],o),queryFiltersDetails:la(eo((l==null?void 0:l.filters)||[],s,g,a,o),eo(r==null?void 0:r.filters,s,g,a,o))}}),la=(e,n)=>{const t=new Map(e==null?void 0:e.map(o=>[o==null?void 0:o.id,o]));return(n==null?void 0:n.filter(o=>{var r,l,c;return!uo.isEqual((l=(r=t==null?void 0:t.get(o==null?void 0:o.id))==null?void 0:r.valuesTitles)==null?void 0:l.sort(),(c=o==null?void 0:o.valuesTitles)==null?void 0:c.sort())}))||[]},eo=(e,n,t,o,r)=>e==null?void 0:e.map(l=>{var u,s,d;const c=n.find(f=>(f==null?void 0:f.id)===(l==null?void 0:l.componentCode)),g=D.getConcept((c==null?void 0:c.conceptIdentity)||"",t),a=D.findCodelistByDimension(o,t,c);return{id:l==null?void 0:l.componentCode,title:D.getLocalizedName(g,r),valuesTitles:(l==null?void 0:l.operator)===ee.QueryFilterType.BETWEEN?[`${en(ee.getTimePeriod((u=l==null?void 0:l.values)==null?void 0:u[0]),r)} - ${en(ee.getTimePeriod((s=l==null?void 0:l.values)==null?void 0:s[1]),r)}`]:(d=l==null?void 0:l.values)==null?void 0:d.map(f=>{var w;return D.getLocalizedName((w=a==null?void 0:a.codes)==null?void 0:w.find(m=>(m==null?void 0:m.id)===f),r)||f})}}),aa=(e,n,t)=>{var c,g,a;let o="",r="";if(e!=null&&e.timeFilter){const u=(c=decodeURIComponent(e.timeFilter||""))==null?void 0:c.split(":");o=u[1]||"",r=u[3]||""}else if(n){const u=n==null?void 0:n.filters.find(s=>s.componentCode===D.TIME_PERIOD);o=((g=u==null?void 0:u.values)==null?void 0:g[0])||"",r=((a=u==null?void 0:u.values)==null?void 0:a[1])||""}return`&filter=${(e==null?void 0:e.filterKey)||D.getTimeSeriesFilterKey(t||[],(n==null?void 0:n.filters)||[])}&startPeriod=${o}&endPeriod=${r}`},sa=(e,n,t,o)=>{var l;const r=e?aa(n,t,o):"";return((l=t==null?void 0:t.metadata)==null?void 0:l.datasetUrl)+r};_t.ModuleRegistry.registerModules([_t.AllCommunityModule]);const ir=({attachments:e,actions:n,titles:t,messageStyles:o,attachmentsStyles:r,isSystemAttachments:l,isShowAttachments:c,showAdvancedView:g,currentDataQuery:a,dataQueries:u,attachmentInfoList:s,datasets:d,initialSelectedDatasetUrn:f,isDataLoading:w,isDataSetAttachments:m,locale:b,dimensions:p,filters:S,selectDataset:C,onAdvancedViewOpen:x,limitMessages:N,attachmentsConfig:v})=>{const[E,_]=h.useState(0),[M,y]=h.useState(null),{isOpenedAdvancedView:k,setIsOpenedAdvancedView:A}=_e(),[O,F]=h.useState(j.PopUpState.Closed),[K,T]=h.useState(!1),[I,H]=h.useState(),[B,U]=h.useState(),[Z,W]=h.useState(!1),q={downloadDataSet:n.downloadDataSet,getConstraints:n.getConstraints},se=D.DownloadType.DATA_IN_TABLE,ae=pe=>{_(pe)},ce=h.useCallback(()=>{x==null||x(),A(!0),n.updateCurrentDataQuery(a||(u==null?void 0:u[0])),n.updateDataQueries(u),n.updateDatasets(d)},[n,a,u,d,A,x]);h.useEffect(()=>{y(e[E]||null)},[e,E]),h.useEffect(()=>{T(m&&(d==null||(d==null?void 0:d.length)==0))},[d,m]);const ue=h.useCallback(()=>{F(j.PopUpState.Closed)},[F]),he=v==null?void 0:v.isExternaLinkIncludeFilters,Ne=sa(he,S,a||(u==null?void 0:u[0]),p);return!e||e.length===0?null:i.jsx(i.Fragment,{children:k&&!c?i.jsx(Al,{icon:o==null?void 0:o.advanceViewIcon,title:(o==null?void 0:o.openAdvanceViewTitle)??"Opened in Advanced view"}):i.jsxs("div",{className:V("space-y-3 max-w-full max-h-full h-full",!k&&!l?"pt-5":"pt-0"),children:[!k&&K?i.jsx(j.Loader,{}):i.jsxs(i.Fragment,{children:[l&&!k&&i.jsx(ml,{titles:{queryUpdatedManuallyTitle:t==null?void 0:t.queryUpdatedManually,setToTitle:t==null?void 0:t.setTo},datasetIcon:r==null?void 0:r.datasetIcon,attachmentInfoList:s}),!k&&(d==null?void 0:d.length)!=null&&(d==null?void 0:d.length)>0&&i.jsx(rr,{datasets:d,initialSelectedDatasetUrn:f,locale:b,titles:t,isHideAdvancedViewButton:!g,openAdvancedViewIcon:r==null?void 0:r.openAdvancedViewIcon,selectDataset:C,onOpenAdvancedView:ce}),Z&&i.jsx(j.RequestLimitMessage,{limitMessages:N,showAdvancedViewButton:!!M&&wn(M)&&g,onAdvancedViewClick:ce,query:Ne}),i.jsx("div",{className:V(!k&&(d==null?void 0:d.length)&&"attachments-bordered","attachments-wrapper h-full min-h-0"),children:i.jsxs("div",{className:"flex flex-col max-w-full items-center gap-4 h-full",children:[i.jsxs("div",{className:"flex min-w-0 w-full justify-between items-center",children:[i.jsx(gl,{dataGridTitle:r==null?void 0:r.dataGridTitle,attachments:e,selectedAttachmentIndex:E,showTabIcon:r==null?void 0:r.showTabIcon,onSelectedAttachmentChange:ae,titles:t}),i.jsxs("div",{className:"flex gap-x-3 items-center flex-wrap w-full justify-end",children:[M&&We(M)&&he&&i.jsx("a",{href:Ne,target:"_blank",children:i.jsx(j.Button,{title:(N==null?void 0:N.dataExplorer)||"Data explorer",buttonClassName:"text-button-tertiary small-icon-button [&>svg]:h-[16px] [&>svg]:w-[16px] whitespace-nowrap",iconBefore:N==null?void 0:N.dataExplorerIcon})}),M&&We(M)&&i.jsx(j.Button,{title:(r==null?void 0:r.downloadTitle)||"Download",buttonClassName:"text-button-tertiary small-icon-button",onClick:()=>F(j.PopUpState.Opened),iconBefore:r==null?void 0:r.downloadIcon})]})]}),M!=null&&i.jsxs("div",{className:"flex flex-1 w-full justify-center min-h-0",children:[$i(M)&&i.jsx(nl,{actions:n,downloadTitles:r==null?void 0:r.downloadTitle,attachment:M}),wn(M)&&i.jsx(Dl,{actions:n,attachment:M,showLimitMessage:W}),We(M)&&i.jsx(zl,{attachment:M,isDataLoading:w,chartColumn:k,fixHeight:!k,titles:t,showLimitMessage:W}),Ze(M)&&i.jsx(Xl,{titles:t,isDataLoading:w,attachment:M,icons:r==null?void 0:r.chartingIcons,openAdvancedView:k?void 0:ce,fixHeight:!k}),kn(M)&&i.jsx(cl,{attachment:M,openLinkTitle:r==null?void 0:r.openLinkTitle}),Wo(M)&&i.jsx(il,{attachment:M})]})]})})]}),i.jsxs(i.Fragment,{children:[O===j.PopUpState.Opened&&i.jsx(oa,{actions:q,onCloseModal:ue,dataQuery:a,datasetName:(M==null?void 0:M.title)||"",locale:b,type:se,dimensions:p,filters:S,urn:a==null?void 0:a.urn,datasetIcon:r==null?void 0:r.datasetIcon,isDisplayDatasetIcon:r==null?void 0:r.isDisplayDatasetIcon,titles:r==null?void 0:r.downloadTitles,setIsShowDownloadAlert:H,setDownloadAlertDetails:U,limitMessages:N,showLimitMessage:Z,externalLink:Ne}),I&&i.jsx(j.Alert,{alertDetails:B,successIcon:r==null?void 0:r.successDownloadIcon,errorIcon:r==null?void 0:r.errorDownloadIcon,onClose:()=>H(!1),closeButtonTitle:(r==null?void 0:r.closeTitle)||"Close"})]})]})})},ca=({filtersProps:e,actions:n,attachments:t,attachmentsDataQuery:o,dataQueries:r,dimensions:l,locale:c,attachmentsStyles:g,isDataLoading:a,setIsFiltering:u,titles:s,limitMessages:d,attachmentsConfig:f})=>{const[w,m]=h.useState({filterKey:null,timeFilter:null}),b={getConstraints:n.getConstraints},p=(S,C,x)=>{m(S),u==null||u(!0),e&&e.onFiltersChange&&(e==null||e.onFiltersChange(S,C,x))};return h.useEffect(()=>{a||u==null||u(!1)},[a,u]),i.jsx("div",{className:"bg-white rounded h-full min-h-0",children:i.jsxs("div",{className:"flex flex-col gap-4 h-full overflow-x-hidden",children:[i.jsxs("div",{className:"data-details-header flex justify-between items-center",children:[i.jsx("h2",{children:(s==null?void 0:s.content)??"Content"}),i.jsx(el,{attachmentsDataQuery:o,dataQueries:r,updateDataQueries:n==null?void 0:n.updateDataQueries,locale:c,actions:b,dimensions:l,titles:s,...e,onFiltersChange:p,limitMessages:d})]}),i.jsx("div",{className:"advanced-view-attachments-container flex-1 min-h-0",children:i.jsx(ir,{titles:s,attachments:t,attachmentsStyles:g,currentDataQuery:o,dimensions:l,actions:n,isShowAttachments:!0,isDataSetAttachments:!0,isDataLoading:a,locale:c,filters:w,limitMessages:d,attachmentsConfig:f})})]})})},ua=e=>X.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},X.createElement("path",{d:"M10.3333 11.3334V4.66666C10.3333 3.22134 8.19658 2 5.66666 2C3.13675 2 1 3.22134 1 4.66666V11.3334C1 12.7786 3.13675 14 5.66666 14C8.19658 14 10.3333 12.7786 10.3333 11.3334ZM5.66666 3.33333C7.81975 3.33333 9.12641 4.338 9.16666 4.66267C9.12641 4.99533 7.81975 6 5.66666 6C3.51358 6 2.20692 4.99533 2.16667 4.67067C2.20692 4.338 3.51358 3.33333 5.66666 3.33333ZM2.16667 6.40467C3.02942 6.96932 4.28825 7.33334 5.66666 7.33334C7.04508 7.33334 8.30391 6.96932 9.16666 6.40467V7.99598C9.12641 8.32868 7.81975 9.33332 5.66666 9.33332C3.51358 9.33332 2.20692 8.32868 2.16667 8V6.40467ZM2.16667 11.3334V9.73802C3.02942 10.3027 4.28825 10.6666 5.66666 10.6666C7.04508 10.6666 8.30391 10.3027 9.16666 9.73802V11.3293C9.12641 11.662 7.81975 12.6667 5.66666 12.6667C3.51358 12.6667 2.20692 11.662 2.16667 11.3334Z",fill:"currentColor"}),X.createElement("path",{d:"M10.3333 7.30769V8.69231H12.2V10.7692L15 8L12.2 5.23077V7.30769H10.3333Z",fill:"currentColor"}));function dn(e){return(n={})=>{const t=n.width?String(n.width):e.defaultWidth;return e.formats[t]||e.formats[e.defaultWidth]}}function Be(e){return(n,t)=>{const o=t!=null&&t.context?String(t.context):"standalone";let r;if(o==="formatting"&&e.formattingValues){const c=e.defaultFormattingWidth||e.defaultWidth,g=t!=null&&t.width?String(t.width):c;r=e.formattingValues[g]||e.formattingValues[c]}else{const c=e.defaultWidth,g=t!=null&&t.width?String(t.width):e.defaultWidth;r=e.values[g]||e.values[c]}const l=e.argumentCallback?e.argumentCallback(n):n;return r[l]}}function He(e){return(n,t={})=>{const o=t.width,r=o&&e.matchPatterns[o]||e.matchPatterns[e.defaultMatchWidth],l=n.match(r);if(!l)return null;const c=l[0],g=o&&e.parsePatterns[o]||e.parsePatterns[e.defaultParseWidth],a=Array.isArray(g)?ha(g,d=>d.test(c)):da(g,d=>d.test(c));let u;u=e.valueCallback?e.valueCallback(a):a,u=t.valueCallback?t.valueCallback(u):u;const s=n.slice(c.length);return{value:u,rest:s}}}function da(e,n){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&n(e[t]))return t}function ha(e,n){for(let t=0;t<e.length;t++)if(n(e[t]))return t}function fa(e){return(n,t={})=>{const o=n.match(e.matchPattern);if(!o)return null;const r=o[0],l=n.match(e.parsePattern);if(!l)return null;let c=e.valueCallback?e.valueCallback(l[0]):l[0];c=t.valueCallback?t.valueCallback(c):c;const g=n.slice(r.length);return{value:c,rest:g}}}const no=Symbol.for("constructDateFrom");function lr(e,n){return typeof e=="function"?e(n):e&&typeof e=="object"&&no in e?e[no](n):e instanceof Date?new e.constructor(n):new Date(n)}function ga(e,...n){const t=lr.bind(null,e||n.find(o=>typeof o=="object"));return n.map(t)}let wa={};function ma(){return wa}function En(e,n){return lr(n||e,e)}function to(e,n){var g,a,u,s;const t=ma(),o=(n==null?void 0:n.weekStartsOn)??((a=(g=n==null?void 0:n.locale)==null?void 0:g.options)==null?void 0:a.weekStartsOn)??t.weekStartsOn??((s=(u=t.locale)==null?void 0:u.options)==null?void 0:s.weekStartsOn)??0,r=En(e,n==null?void 0:n.in),l=r.getDay(),c=(l<o?7:0)+l-o;return r.setDate(r.getDate()-c),r.setHours(0,0,0,0),r}function ar(e,n,t){const[o,r]=ga(t==null?void 0:t.in,e,n);return+to(o,t)==+to(r,t)}function Ge(e,n){if(e.one!==void 0&&n===1)return e.one;const t=n%10,o=n%100;return t===1&&o!==11?e.singularNominative.replace("{{count}}",String(n)):t>=2&&t<=4&&(o<10||o>20)?e.singularGenitive.replace("{{count}}",String(n)):e.pluralGenitive.replace("{{count}}",String(n))}function ge(e){return(n,t)=>t&&t.addSuffix?t.comparison&&t.comparison>0?e.future?Ge(e.future,n):"за "+Ge(e.regular,n):e.past?Ge(e.past,n):Ge(e.regular,n)+" тому":Ge(e.regular,n)}const pa=(e,n)=>n&&n.addSuffix?n.comparison&&n.comparison>0?"за півхвилини":"півхвилини тому":"півхвилини",xa={lessThanXSeconds:ge({regular:{one:"менше секунди",singularNominative:"менше {{count}} секунди",singularGenitive:"менше {{count}} секунд",pluralGenitive:"менше {{count}} секунд"},future:{one:"менше, ніж за секунду",singularNominative:"менше, ніж за {{count}} секунду",singularGenitive:"менше, ніж за {{count}} секунди",pluralGenitive:"менше, ніж за {{count}} секунд"}}),xSeconds:ge({regular:{singularNominative:"{{count}} секунда",singularGenitive:"{{count}} секунди",pluralGenitive:"{{count}} секунд"},past:{singularNominative:"{{count}} секунду тому",singularGenitive:"{{count}} секунди тому",pluralGenitive:"{{count}} секунд тому"},future:{singularNominative:"за {{count}} секунду",singularGenitive:"за {{count}} секунди",pluralGenitive:"за {{count}} секунд"}}),halfAMinute:pa,lessThanXMinutes:ge({regular:{one:"менше хвилини",singularNominative:"менше {{count}} хвилини",singularGenitive:"менше {{count}} хвилин",pluralGenitive:"менше {{count}} хвилин"},future:{one:"менше, ніж за хвилину",singularNominative:"менше, ніж за {{count}} хвилину",singularGenitive:"менше, ніж за {{count}} хвилини",pluralGenitive:"менше, ніж за {{count}} хвилин"}}),xMinutes:ge({regular:{singularNominative:"{{count}} хвилина",singularGenitive:"{{count}} хвилини",pluralGenitive:"{{count}} хвилин"},past:{singularNominative:"{{count}} хвилину тому",singularGenitive:"{{count}} хвилини тому",pluralGenitive:"{{count}} хвилин тому"},future:{singularNominative:"за {{count}} хвилину",singularGenitive:"за {{count}} хвилини",pluralGenitive:"за {{count}} хвилин"}}),aboutXHours:ge({regular:{singularNominative:"близько {{count}} години",singularGenitive:"близько {{count}} годин",pluralGenitive:"близько {{count}} годин"},future:{singularNominative:"приблизно за {{count}} годину",singularGenitive:"приблизно за {{count}} години",pluralGenitive:"приблизно за {{count}} годин"}}),xHours:ge({regular:{singularNominative:"{{count}} годину",singularGenitive:"{{count}} години",pluralGenitive:"{{count}} годин"}}),xDays:ge({regular:{singularNominative:"{{count}} день",singularGenitive:"{{count}} днi",pluralGenitive:"{{count}} днів"}}),aboutXWeeks:ge({regular:{singularNominative:"близько {{count}} тижня",singularGenitive:"близько {{count}} тижнів",pluralGenitive:"близько {{count}} тижнів"},future:{singularNominative:"приблизно за {{count}} тиждень",singularGenitive:"приблизно за {{count}} тижні",pluralGenitive:"приблизно за {{count}} тижнів"}}),xWeeks:ge({regular:{singularNominative:"{{count}} тиждень",singularGenitive:"{{count}} тижні",pluralGenitive:"{{count}} тижнів"}}),aboutXMonths:ge({regular:{singularNominative:"близько {{count}} місяця",singularGenitive:"близько {{count}} місяців",pluralGenitive:"близько {{count}} місяців"},future:{singularNominative:"приблизно за {{count}} місяць",singularGenitive:"приблизно за {{count}} місяці",pluralGenitive:"приблизно за {{count}} місяців"}}),xMonths:ge({regular:{singularNominative:"{{count}} місяць",singularGenitive:"{{count}} місяці",pluralGenitive:"{{count}} місяців"}}),aboutXYears:ge({regular:{singularNominative:"близько {{count}} року",singularGenitive:"близько {{count}} років",pluralGenitive:"близько {{count}} років"},future:{singularNominative:"приблизно за {{count}} рік",singularGenitive:"приблизно за {{count}} роки",pluralGenitive:"приблизно за {{count}} років"}}),xYears:ge({regular:{singularNominative:"{{count}} рік",singularGenitive:"{{count}} роки",pluralGenitive:"{{count}} років"}}),overXYears:ge({regular:{singularNominative:"більше {{count}} року",singularGenitive:"більше {{count}} років",pluralGenitive:"більше {{count}} років"},future:{singularNominative:"більше, ніж за {{count}} рік",singularGenitive:"більше, ніж за {{count}} роки",pluralGenitive:"більше, ніж за {{count}} років"}}),almostXYears:ge({regular:{singularNominative:"майже {{count}} рік",singularGenitive:"майже {{count}} роки",pluralGenitive:"майже {{count}} років"},future:{singularNominative:"майже за {{count}} рік",singularGenitive:"майже за {{count}} роки",pluralGenitive:"майже за {{count}} років"}})},va=(e,n,t)=>(t=t||{},xa[e](n,t)),ba={full:"EEEE, do MMMM y 'р.'",long:"do MMMM y 'р.'",medium:"d MMM y 'р.'",short:"dd.MM.y"},Ca={full:"H:mm:ss zzzz",long:"H:mm:ss z",medium:"H:mm:ss",short:"H:mm"},ka={full:"{{date}} 'о' {{time}}",long:"{{date}} 'о' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Na={date:dn({formats:ba,defaultWidth:"full"}),time:dn({formats:Ca,defaultWidth:"full"}),dateTime:dn({formats:ka,defaultWidth:"full"})},Dn=["неділю","понеділок","вівторок","середу","четвер","п’ятницю","суботу"];function Sa(e){const n=Dn[e];switch(e){case 0:case 3:case 5:case 6:return"'у минулу "+n+" о' p";case 1:case 2:case 4:return"'у минулий "+n+" о' p"}}function sr(e){return"'у "+Dn[e]+" о' p"}function ja(e){const n=Dn[e];switch(e){case 0:case 3:case 5:case 6:return"'у наступну "+n+" о' p";case 1:case 2:case 4:return"'у наступний "+n+" о' p"}}const Ea=(e,n,t)=>{const o=En(e),r=o.getDay();return ar(o,n,t)?sr(r):Sa(r)},Da=(e,n,t)=>{const o=En(e),r=o.getDay();return ar(o,n,t)?sr(r):ja(r)},Aa={lastWeek:Ea,yesterday:"'вчора о' p",today:"'сьогодні о' p",tomorrow:"'завтра о' p",nextWeek:Da,other:"P"},ya=(e,n,t,o)=>{const r=Aa[e];return typeof r=="function"?r(n,t,o):r},Ma={narrow:["до н.е.","н.е."],abbreviated:["до н. е.","н. е."],wide:["до нашої ери","нашої ери"]},Ta={narrow:["1","2","3","4"],abbreviated:["1-й кв.","2-й кв.","3-й кв.","4-й кв."],wide:["1-й квартал","2-й квартал","3-й квартал","4-й квартал"]},Oa={narrow:["С","Л","Б","К","Т","Ч","Л","С","В","Ж","Л","Г"],abbreviated:["січ.","лют.","берез.","квіт.","трав.","черв.","лип.","серп.","верес.","жовт.","листоп.","груд."],wide:["січень","лютий","березень","квітень","травень","червень","липень","серпень","вересень","жовтень","листопад","грудень"]},La={narrow:["С","Л","Б","К","Т","Ч","Л","С","В","Ж","Л","Г"],abbreviated:["січ.","лют.","берез.","квіт.","трав.","черв.","лип.","серп.","верес.","жовт.","листоп.","груд."],wide:["січня","лютого","березня","квітня","травня","червня","липня","серпня","вересня","жовтня","листопада","грудня"]},_a={narrow:["Н","П","В","С","Ч","П","С"],short:["нд","пн","вт","ср","чт","пт","сб"],abbreviated:["нед","пон","вів","сер","чтв","птн","суб"],wide:["неділя","понеділок","вівторок","середа","четвер","п’ятниця","субота"]},Ra={narrow:{am:"ДП",pm:"ПП",midnight:"півн.",noon:"пол.",morning:"ранок",afternoon:"день",evening:"веч.",night:"ніч"},abbreviated:{am:"ДП",pm:"ПП",midnight:"півн.",noon:"пол.",morning:"ранок",afternoon:"день",evening:"веч.",night:"ніч"},wide:{am:"ДП",pm:"ПП",midnight:"північ",noon:"полудень",morning:"ранок",afternoon:"день",evening:"вечір",night:"ніч"}},Ia={narrow:{am:"ДП",pm:"ПП",midnight:"півн.",noon:"пол.",morning:"ранку",afternoon:"дня",evening:"веч.",night:"ночі"},abbreviated:{am:"ДП",pm:"ПП",midnight:"півн.",noon:"пол.",morning:"ранку",afternoon:"дня",evening:"веч.",night:"ночі"},wide:{am:"ДП",pm:"ПП",midnight:"північ",noon:"полудень",morning:"ранку",afternoon:"дня",evening:"веч.",night:"ночі"}},Pa=(e,n)=>{const t=String(n==null?void 0:n.unit),o=Number(e);let r;return t==="date"?o===3||o===23?r="-є":r="-е":t==="minute"||t==="second"||t==="hour"?r="-а":r="-й",o+r},Va={ordinalNumber:Pa,era:Be({values:Ma,defaultWidth:"wide"}),quarter:Be({values:Ta,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Be({values:Oa,defaultWidth:"wide",formattingValues:La,defaultFormattingWidth:"wide"}),day:Be({values:_a,defaultWidth:"wide"}),dayPeriod:Be({values:Ra,defaultWidth:"any",formattingValues:Ia,defaultFormattingWidth:"wide"})},Fa=/^(\d+)(-?(е|й|є|а|я))?/i,Ba=/\d+/i,Ha={narrow:/^((до )?н\.?\s?е\.?)/i,abbreviated:/^((до )?н\.?\s?е\.?)/i,wide:/^(до нашої ери|нашої ери|наша ера)/i},Ga={any:[/^д/i,/^н/i]},Ua={narrow:/^[1234]/i,abbreviated:/^[1234](-?[иі]?й?)? кв.?/i,wide:/^[1234](-?[иі]?й?)? квартал/i},za={any:[/1/i,/2/i,/3/i,/4/i]},Wa={narrow:/^[слбктчвжг]/i,abbreviated:/^(січ|лют|бер(ез)?|квіт|трав|черв|лип|серп|вер(ес)?|жовт|лис(топ)?|груд)\.?/i,wide:/^(січень|січня|лютий|лютого|березень|березня|квітень|квітня|травень|травня|червня|червень|липень|липня|серпень|серпня|вересень|вересня|жовтень|жовтня|листопад[а]?|грудень|грудня)/i},$a={narrow:[/^с/i,/^л/i,/^б/i,/^к/i,/^т/i,/^ч/i,/^л/i,/^с/i,/^в/i,/^ж/i,/^л/i,/^г/i],any:[/^сі/i,/^лю/i,/^б/i,/^к/i,/^т/i,/^ч/i,/^лип/i,/^се/i,/^в/i,/^ж/i,/^лис/i,/^г/i]},Ja={narrow:/^[нпвсч]/i,short:/^(нд|пн|вт|ср|чт|пт|сб)\.?/i,abbreviated:/^(нед|пон|вів|сер|че?тв|птн?|суб)\.?/i,wide:/^(неділ[яі]|понеділ[ок][ка]|вівтор[ок][ка]|серед[аи]|четвер(га)?|п\W*?ятниц[яі]|субот[аи])/i},Ya={narrow:[/^н/i,/^п/i,/^в/i,/^с/i,/^ч/i,/^п/i,/^с/i],any:[/^н/i,/^п[он]/i,/^в/i,/^с[ер]/i,/^ч/i,/^п\W*?[ят]/i,/^с[уб]/i]},Ka={narrow:/^([дп]п|півн\.?|пол\.?|ранок|ранку|день|дня|веч\.?|ніч|ночі)/i,abbreviated:/^([дп]п|півн\.?|пол\.?|ранок|ранку|день|дня|веч\.?|ніч|ночі)/i,wide:/^([дп]п|північ|полудень|ранок|ранку|день|дня|вечір|вечора|ніч|ночі)/i},Za={any:{am:/^дп/i,pm:/^пп/i,midnight:/^півн/i,noon:/^пол/i,morning:/^р/i,afternoon:/^д[ен]/i,evening:/^в/i,night:/^н/i}},qa={ordinalNumber:fa({matchPattern:Fa,parsePattern:Ba,valueCallback:e=>parseInt(e,10)}),era:He({matchPatterns:Ha,defaultMatchWidth:"wide",parsePatterns:Ga,defaultParseWidth:"any"}),quarter:He({matchPatterns:Ua,defaultMatchWidth:"wide",parsePatterns:za,defaultParseWidth:"any",valueCallback:e=>e+1}),month:He({matchPatterns:Wa,defaultMatchWidth:"wide",parsePatterns:$a,defaultParseWidth:"any"}),day:He({matchPatterns:Ja,defaultMatchWidth:"wide",parsePatterns:Ya,defaultParseWidth:"any"}),dayPeriod:He({matchPatterns:Ka,defaultMatchWidth:"wide",parsePatterns:Za,defaultParseWidth:"any"})},Xa={code:"uk",formatDistance:va,formatLong:Na,formatRelative:ya,localize:Va,match:qa,options:{weekStartsOn:1,firstWeekContainsDate:1}},Qa=e=>e===ee.Locale.UK?"dd MMM, yyyy":" MMM dd, yyyy hh:mm aa",es=(e,n)=>{const t=Qa(n);return e!=null&&e!==""&&t&&Rt.isValid(new Date(e))?Rt.format(new Date(e),t,n===ee.Locale.UK?{locale:Xa}:void 0):""},ns=({isShowAgency:e,dataset:n,data:t,structures:o,metadataSettings:r,locale:l,titles:c,getDatasetUpdatedTime:g,externalLink:a})=>{const[u,s]=h.useState(""),[d,f]=h.useState(!1),w=h.useRef(null),[m,b]=h.useState(""),[p,S]=h.useState(""),[C,x]=h.useState(!1),{onboardingFileSchema:N,isShowOnboarding:v}=me(),[E,_]=h.useState(!1),M=h.useMemo(()=>r!=null&&r.isMetadataDescription?Ll(n,u,l,c):[],[n,u,l,r==null?void 0:r.isMetadataDescription,c]),y=h.useMemo(()=>[...r!=null&&r.isMetadataDescription?[]:[an(n,l,c)],...Rl(_l(t),D.getStructureComponentsMap(o),l)],[t,n,l,r==null?void 0:r.isMetadataDescription,o,c]),k=h.useCallback(()=>{f(!0)},[]),A=h.useCallback(()=>{f(!1),_(!0)},[]);return h.useEffect(()=>{const F=g&&g(y)||es(D.getLastUpdatedTime(n),l);s(F)},[n,l,y,g]),h.useEffect(()=>{if(v){const{title:O,description:F}=Re(le.METADATA_PER_DATASET,c);b(O),S(F)}},[c,v]),h.useEffect(()=>{v&&x((N==null?void 0:N.lastDisplayedElement)===le.METADATA_PER_DATASET)},[N==null?void 0:N.lastDisplayedElement,v]),i.jsxs("div",{className:V("flex flex-col bg-white","dataset-info"),children:[e?i.jsxs(i.Fragment,{children:[i.jsxs("h4",{className:"flex items-center gap-2",children:[i.jsx("div",{ref:w,children:i.jsx(j.IconButton,{title:(c==null?void 0:c.metadata)??"View details",buttonClassName:"!text-neutrals-1000 !border-none !w-5 !h-5 !p-0 shrink-0",icon:i.jsx(xn,{width:20,height:20}),onClick:k})}),n==null?void 0:n.name,a&&i.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",children:i.jsx(Ee.IconExternalLink,{className:"text-primary cursor-pointer w-4 h-4 shrink-0"})})]}),i.jsxs("div",{className:"flex mt-1 text-neutrals-800 body-3 divide-x divide-neutrals-500",children:[i.jsxs("p",{className:"pr-2",children:[(c==null?void 0:c.lastUpdated)??"Agency",":",i.jsx("span",{className:"text-neutrals-1000 pl-1",children:n==null?void 0:n.agencyID})]}),i.jsxs("p",{className:"pl-2",children:[(c==null?void 0:c.lastUpdated)??"Last updated",":",i.jsx("span",{className:"text-neutrals-1000 pl-1",children:u})]})]})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex gap-3 mb-3",children:[i.jsxs("p",{className:"flex gap-1 items-center py-1 px-2 rounded-[20px] bg-accent-500 body-3",children:[i.jsx(ua,{className:"w-4 h-4"}),(c==null?void 0:c.dataset)??"Dataset"]}),i.jsxs("h5",{className:"flex items-center text-neutrals-700",children:[i.jsx(Ee.IconClock,{className:"w-4 h-4 mr-1"}),(c==null?void 0:c.lastUpdated)??"Last updated",":",i.jsx("span",{className:"ml-1",children:u})]})]}),i.jsxs("h3",{className:"flex items-center gap-2",children:[D.getLocalizedName(n,l),i.jsx("div",{ref:w,children:i.jsx(j.IconButton,{title:(c==null?void 0:c.metadata)??"View details",buttonClassName:"!text-neutrals-1000 !border-none !w-5 !h-5 !p-0 shrink-0",icon:i.jsx(xn,{width:20,height:20}),onClick:k})}),a&&i.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",children:i.jsx(Ee.IconArrowUpRight,{className:"cursor-pointer w-6 h-6 shrink-0"})})]})]}),C&&i.jsx(Ie,{reference:w,title:m,description:p,onReferenceClick:k,shouldCloseTooltip:E}),d&&i.jsx(jn,{titles:c,locale:l,metadata:y,metadataDescription:M,isOpenMetadata:d,onCloseMetadata:A})]})},ts=({titles:e,locale:n,isShowShare:t,shareConversationProps:o})=>{const{setIsOpenedAdvancedView:r}=_e(),l=h.useRef(null),[c,g]=h.useState(""),[a,u]=h.useState(""),[s,d]=h.useState(!1),{onboardingFileSchema:f,isShowOnboarding:w}=me();return h.useEffect(()=>{if(w){const{title:m,description:b}=Re(le.EXIT_ADVANCED_VIEW,e);g(m),u(b)}},[e,w]),h.useEffect(()=>{w&&d((f==null?void 0:f.lastDisplayedElement)===le.EXIT_ADVANCED_VIEW)},[f==null?void 0:f.lastDisplayedElement,w]),i.jsxs("header",{className:V("bg-white px-6 py-4 flex justify-between items-center sm:px-0","advanced-view-header"),children:[i.jsxs("div",{className:V("flex gap-3 items-center",!t&&"justify-between w-full","advanced-view-header-title"),children:[i.jsx("div",{ref:l,className:V(!t&&"order-2","flex"),children:i.jsx(j.CloseButton,{btnClassNames:"button-close",onClick:()=>r(!1),title:(e==null?void 0:e.close)||"Close"})}),s&&i.jsx(Ie,{reference:l,title:c,description:a,onReferenceClick:()=>r(!1),shouldMoveToNextStep:!0}),i.jsx("h2",{className:"sm:h-3",children:(e==null?void 0:e.advanceViewTitle)??"Advanced view"})]}),t&&i.jsx(yo,{locale:n,...o})]})};function An(e,n,t){var l;const o=D.getConcept(e.conceptIdentity,n),r=D.getArtifactByUrnWithWildCard((l=o==null?void 0:o.coreRepresentation)==null?void 0:l.enumeration,t);return{concept:o,codeList:r||void 0}}function cr(e,n,t){const o=e.findIndex(r=>r.id===n);return t.originalData.parsedTimeSeriesValue[o]}function ur(e,n,t,o,r){var g;const l=cr(e,n,o),c=(g=t==null?void 0:t.codes)==null?void 0:g.find(a=>a.id===l);return D.getLocalizedName(c,r)}function os(e,n,t,o,r,l,c,g,a){const u=rs(e,t),s=a!=null&&a.startPeriod&&a.endPeriod?D.getAdditionalColumns(g,a):[],d=is(e,n,t,o,r,l,s);return[Cl(e,n==null?void 0:n.data,t,r,l,c),...u,...d,kl(e,n==null?void 0:n.data,t,void 0,l,c)]}function rs(e,n){var l;const t=e.conceptSchemes||[],o=e.codelists||[],r=((l=D.getDimensions(e))==null?void 0:l.dimensions)||[];return r.map(c=>{const{codeList:g,concept:a}=An(c,t,o),u=s=>{const{data:d,colDef:f}=s,w=f.field;return ur(r,w,g,d,n)};return{headerName:D.getLocalizedName(a,n),field:c.id,colId:c.id,valueGetter:u,...mn,tooltipValueGetter:s=>s.value}})}function is(e,n,t,o,r,l,c){const g=c!=null&&c.length?c:D.getTimePeriods(n);return as(g,(u,s)=>ls(u,s||u,o,l),e,t,r,l)}const ls=(e,n,t=ee.defaultFormatNumbers,o)=>({headerName:di(n,o),colId:e,field:e,type:"numericColumn",suppressColumnsToolPanel:!0,sortable:!1,width:ln,cellClass:["justify-end","cell-with-meta"],valueFormatter:r=>ee.formatNumberBySign(r.value,t)}),as=(e,n,t,o,r,l)=>{const c=[];return e.sort((a,u)=>D.sortPeriods(a,u)).forEach(a=>{c.push({headerName:a.toString(),field:a.toString(),...n(a.toString()),valueGetter:u=>{var s,d,f;return((f=(d=(s=u.data[u.column.getColId()])==null?void 0:s.value)==null?void 0:d[0])==null?void 0:f.value)||null},cellClass:Sn,cellRenderer:Zo,width:ln,cellRendererParams:{dataSetData:t,locale:o,metadataSettings:r,titles:l}})}),c};function ss(e,n,t){const o=n.map(l=>l.id).filter(l=>l!=null),r=t.map(l=>l.id).filter(l=>l!=null);return cs(e,o,r,o)}const cs=(e,n,t,o)=>{const r=ds(e,n),l={};for(const c of r){const g=c.rowTime,a=dr(g,o);if(l[a]==null){l[a]={};for(const u of o)l[a][u]=g[u]}l[a]={attributes:c.attributes.filter(({value:u})=>u),...l[a],id:a,originalData:c.originalData,...us(g,t)}}return Object.values(l)},dr=(e,n)=>n.map(t=>e[t]).join("_"),us=(e,n)=>{const t=dr(e,n),{OBS_VALUE:o,obsAttributes:r}=e,l={};return l[t]={value:o,obsAttributes:r},l},ds=(e,n)=>{const t=[];for(const o of e){const r={},l=o.name.split(".");for(let c=0;c<n.length;c+=1)r[n[c]]=l[c];if(!o.values.length){const c={...r};c.TIME_PERIOD=void 0,c.OBS_VALUE=void 0,t.push({rowTime:c,attributes:o.attributes,id:o.name,originalData:o})}o.values.forEach(c=>{var u;const g={...r};g.TIME_PERIOD=c.dimensionAtObservation;const a=hs(o,c);g.OBS_VALUE=a,g.obsAttributes=((u=c==null?void 0:c.obsAttributes)==null?void 0:u.filter(({value:s})=>s))||[],t.push({rowTime:g,attributes:o.attributes,id:o.name,originalData:o})})}return t},hs=(e,n)=>{const o=[...e.attributes,...n.obsAttributes].find(({name:r})=>r==="OBS_VALUE");return o?[o]:n.values},fs="#EEEEEE",gs="#777777";function ws(e,n,t){const o={animation:!1,tooltip:{trigger:"axis",appendToBody:!0,formatter:r=>{let l=r[0].axisValueLabel+"<br/>";return r.forEach(c=>{c.value!==null&&c.value!==void 0&&(l+=c.marker+" "+c.seriesName+": "+c.value+"<br/>")}),l}},legend:{bottom:0},grid:{left:"3%",right:"3%",bottom:"40px",containLabel:!0},xAxis:{...oo(t==null?void 0:t.ticksColor,t==null?void 0:t.labelsColor),type:"category",boundaryGap:!1,data:e},yAxis:{...oo(t==null?void 0:t.ticksColor,t==null?void 0:t.labelsColor),type:"value"},series:n};return(t==null?void 0:t.colors)!=null&&(o.color=t.colors),o}function oo(e=fs,n=gs){return{splitLine:{show:!0,showMaxLine:!1,lineStyle:{color:[e]}},axisTick:{show:!1},axisLabel:{color:n},axisLine:{lineStyle:{color:e}}}}function hr(e,n,t,o){return n.map(l=>{var u;const c=((u=D.getDimensions(t))==null?void 0:u.dimensions)||[],g=c==null?void 0:c.find(s=>s.id===l);if(g==null)return e[l]||"";const{codeList:a}=An(g,t.conceptSchemes||[],t.codelists||[]);return ur(c,l,a,e,o)}).join(" - ")}function ms(e,n){var l,c;const t=[...((l=n==null?void 0:n.metadata)==null?void 0:l.indicatorDimensions)||[]].filter(g=>g!=null),o=(c=D.getDimensions(e))==null?void 0:c.dimensions,r=(o==null?void 0:o.filter(g=>{var a;return g.id!=null&&!t.includes(g.id)&&((a=n==null?void 0:n.metadata)==null?void 0:a.countryDimension)!==g.id}).map(g=>g.id).filter(g=>g!=null))||[];return[...t,...r]}function ps(e,n,t){const o={};return e.forEach(r=>{const l=xs(r,n,t);o[l]||(o[l]={rows:[]}),o[l].rows.push(r)}),Object.keys(o).map(r=>o[r])}function xs(e,n,t){var l,c,g,a;const o=((a=(g=(c=(l=t.dataStructures)==null?void 0:l[0])==null?void 0:c.dataStructureComponents)==null?void 0:g.dimensionList)==null?void 0:a.dimensions)||[];return n.map(u=>(o==null?void 0:o.find(d=>d.id===u))==null?e[u]||"":cr(o,u,e)).join(" - ")}function vs(e,n){const t={};return e.forEach(o=>t[o]=bs(o,n)),{nonUniqDimensions:e.filter(o=>!t[o])}}function bs(e,n){const t=n.map(r=>Cs(e,r));return new Set(t).size===1}function Cs(e,n){return n[e]}const ks="line",Ye=10;function Ns(e,n,t,o,r){const l=gr(n,e,t,o,r),g=D.getTimePeriods(n).sort((d,f)=>D.sortPeriods(d,f)),a=ms(e,t),{nonUniqDimensions:u}=vs(a,l);return{units:ps(l,u,e).map(d=>fr(d,e,t,g,o,r))}}function Ss(e,n,t,o,r,l){return fr({rows:[e]},t,o,n,r,l)}function fr(e,n,t,o,r,l){var u,s,d;const c=Ds(e.rows,n,r),g=(u=c==null?void 0:c.find(f=>D.FREQUENCY_DIMENSION_ID.includes(f==null?void 0:f.id)))==null?void 0:u.id,a=js(e.rows.length>Ye?e.rows.slice(0,Ye):e.rows,n,t,r,ro(o,(s=e==null?void 0:e.rows)==null?void 0:s[0],g));return{rows:e.rows,limitedByRowsAmountTo:e.rows.length>Ye?Ye:void 0,dimensions:c,config:ws(ro(o,(d=e==null?void 0:e.rows)==null?void 0:d[0],g),a,l)}}function ro(e,n,t){if(t){const o=n==null?void 0:n[t];if(o===D.Periods.MONTHLY)return e==null?void 0:e.filter(r=>D.isMonthly(r));if(o===D.Periods.QUARTERLY)return e==null?void 0:e.filter(r=>D.isQuarterly(r));if(o===D.Periods.ANNUAL)return e==null?void 0:e.filter(r=>D.isYearly(r))}return e}function js(e,n,t,o,r){return e.map(l=>{var c,g;return{name:((c=t==null?void 0:t.metadata)==null?void 0:c.countryDimension)==null?"":hr(l,[(g=t==null?void 0:t.metadata)==null?void 0:g.countryDimension],n,o),type:ks,data:r.map(a=>Es(a,l))}})}function Es(e,n){var t,o,r;return((r=(o=(t=n[e])==null?void 0:t.value)==null?void 0:o[0])==null?void 0:r.value)||null}function Ds(e,n,t){var o;return(((o=D.getDimensions(n))==null?void 0:o.dimensions)||[]).map(r=>{if(r.id!=null)return{id:r.id,title:As(r,n,t),value:hr(e[0],[r.id],n,t)}}).filter(r=>r!=null)}function As(e,n,t){const o=n.conceptSchemes||[],r=n.codelists||[],{concept:l}=An(e,o,r);return D.getLocalizedName(l,t)||e.id}function gr(e,n,t,o,r){var u,s;const l=e==null?[]:D.getParsedResponse(e),c=((u=D.getDimensions(n))==null?void 0:u.dimensions)||[],g=((s=D.getDimensions(n))==null?void 0:s.timeDimensions)||[],a=ss(l,c,g);return ys(a,e,n,t,o,r)}function ys(e,n,t,o,r,l){const g=D.getTimePeriods(n).sort((a,u)=>D.sortPeriods(a,u));return e.map(a=>({...a,[nn]:Ss(a,g,t,o,r,l)}))}function Ms(e,n,t,o,r,l,c,g,a,u,s){return{columns:os(e,n,o,r,l,g,a,u,s),data:gr(n,e,t,o,c)}}function wr(e,n,t,o,r,l,c){const[g,a]=h.useState(),[u,s]=h.useState(),[d,f]=h.useState(),[w,m]=h.useState(),[b,p]=h.useState({title:(c==null?void 0:c.dataGrid)||"Data Grid",type:re.AttachmentType.CUSTOM_DATA_GRID}),[S,C]=h.useState({title:(c==null?void 0:c.chart)||"Chart",type:re.AttachmentType.CUSTOM_CHART}),[x,N]=h.useState([]),[v,E]=h.useState([]),[_,M]=h.useState(!1),[y,k]=h.useState({startPeriod:null,endPeriod:null}),A=h.useCallback(async T=>{var H;const I=D.getFiltersDtoFromDataQuery(T);try{const B=await e.getConstraints(T.urn,I),U=((H=B==null?void 0:B.data)==null?void 0:H.dataConstraints)||[];f(U)}catch{f([])}},[e,f]),O=h.useCallback(async T=>{e.getDataSet(T.urn).then(I=>{var H;if(I!=null&&I.data){const B=D.getDimensions(I.data);s(((H=I.data.dataflows)==null?void 0:H[0])||void 0),m(I.data||void 0),N([...(B==null?void 0:B.dimensions)||[],...(B==null?void 0:B.timeDimensions)||[]]);const U=(B==null?void 0:B.dimensions)==null?null:D.getTimeSeriesFilterKey(B==null?void 0:B.dimensions,T.filters),Z=Ri(T,B);e.getDataSetData(T.urn,{filterKey:U,timeFilter:Z}).then(W=>{a(W||void 0),E(D.getStructureDimensions(W))}).finally(()=>M(!1))}})},[e]);h.useEffect(()=>{async function T(I){M(!0);try{await Promise.all([A(I),O(I)])}catch(H){console.error("Error loading dataset details",H)}}t!=null&&T(t)},[e,t,A,O]);const F=h.useCallback((T,I,H)=>{var B;try{M(!0),f(I);const U=(B=H==null?void 0:H.find(Z=>Z.id===D.TIME_PERIOD))==null?void 0:B.timeRange;U&&k(U),e.getDataSetData((t==null?void 0:t.urn)||"",T).then(Z=>{a(Z||void 0),E(D.getStructureDimensions(Z))}).finally(()=>M(!1))}catch(U){console.error("Error loading dataset data",U)}},[e,t]);h.useEffect(()=>{var T,I,H;if(w!=null&&g!=null&&(d!=null&&d.length)){const B=(H=(I=(T=w.dataflows)==null?void 0:T[0])==null?void 0:I.names)==null?void 0:H[n],U=Ms(w,g,t,n,o,l,r,c,e==null?void 0:e.putOnboardingFile,d,y);p(Z=>({...Z,title:B||(c==null?void 0:c.dataGrid)||"Data Grid",grid_data:U}))}},[w,g,c,n,o,t,l,r,d,y,e==null?void 0:e.putOnboardingFile]),h.useEffect(()=>{w!=null&&g!=null&&C(T=>{const I=Ns(w,g,t,n,r);return{...T,charting_data:I}})},[w,g,t,n,r]);const K=h.useMemo(()=>[b,S],[b,S]);return{dataMessage:g,structures:w,dataset:u,dimensions:x,structureDimensions:v,onFiltersChange:F,constraints:d,isLoadingGridData:_,dataSetAttachments:K}}const Ts=({attachmentsProps:e,actions:n,titles:t,shareConversationProps:o,metadataSettings:r,formattingSettings:l,locale:c,advanceViewStyles:g,getDatasetUpdatedTime:a,attachmentsConfig:u,...s})=>{var _,M,y,k,A,O;const{dataMessage:d,dataset:f,dimensions:w,structureDimensions:m,structures:b,dataSetAttachments:p,onFiltersChange:S,isLoadingGridData:C,constraints:x}=wr(n,c,e.currentDataQuery,l,(_=e.styles)==null?void 0:_.chartingStyles,r,t),[N,v]=h.useState(),E=h.useCallback(F=>{var K;F&&(n==null||n.updateCurrentDataQuery(((K=e==null?void 0:e.dataQueries)==null?void 0:K.find(T=>(T==null?void 0:T.urn)===F))||e.currentDataQuery))},[n,e.currentDataQuery,e==null?void 0:e.dataQueries]);return i.jsxs("div",{className:"advanced-view flex flex-col flex-1 h-full min-w-0",children:[i.jsx(ts,{titles:t,locale:c,shareConversationProps:o,isShowShare:g==null?void 0:g.isShowShare}),(M=e==null?void 0:e.datasets)!=null&&M.length?i.jsxs(i.Fragment,{children:[((y=e==null?void 0:e.datasets)==null?void 0:y.length)>1&&i.jsx(rr,{datasets:e==null?void 0:e.datasets,initialSelectedDatasetUrn:(k=e==null?void 0:e.currentDataQuery)==null?void 0:k.urn,locale:c,isHideAdvancedViewButton:!0,selectDataset:E}),C&&!N?i.jsx(j.Loader,{}):i.jsxs(i.Fragment,{children:[i.jsx(ns,{titles:t,isShowAgency:g==null?void 0:g.isShowAgency,locale:c,dataset:f,data:d==null?void 0:d.data,structures:b,metadataSettings:r,getDatasetUpdatedTime:a,externalLink:u!=null&&u.isExternaLinkIncludeFilters?"":(O=(A=e==null?void 0:e.currentDataQuery)==null?void 0:A.metadata)==null?void 0:O.datasetUrl}),i.jsx("div",{className:V("flex-1 min-h-0 overflow-auto","advanced-view-filters"),children:i.jsx(ca,{...s,titles:t,actions:n,attachments:p,attachmentsDataQuery:e.currentDataQuery,dataQueries:e==null?void 0:e.dataQueries,dimensions:w,attachmentsStyles:e.styles,isDataLoading:C,locale:c,filtersProps:{...s==null?void 0:s.filtersProps,structureDimensions:m,structures:b,onFiltersChange:S,initialConstraints:x},setIsFiltering:v,attachmentsConfig:u})})]})]}):i.jsx(j.Loader,{})]})};function Os(e,n){const[t,o]=h.useState([]),[r,l]=h.useState();return h.useEffect(()=>{function c(g){try{Promise.all(g==null?void 0:g.map(a=>e(a==null?void 0:a.urn))).then(a=>{var u;o(((u=a==null?void 0:a.map(s=>{var d,f;return(f=(d=s==null?void 0:s.data)==null?void 0:d.dataflows)==null?void 0:f[0]}))==null?void 0:u.filter(s=>!!s))||[]),l(new Map(a==null?void 0:a.map(s=>{var d,f,w,m,b,p,S,C,x;return[D.generateShortUrn((w=(f=(d=s==null?void 0:s.data)==null?void 0:d.dataflows)==null?void 0:f[0])==null?void 0:w.id,(p=(b=(m=s==null?void 0:s.data)==null?void 0:m.dataflows)==null?void 0:b[0])==null?void 0:p.version,(x=(C=(S=s==null?void 0:s.data)==null?void 0:S.dataflows)==null?void 0:C[0])==null?void 0:x.agencyID),s==null?void 0:s.data]})))})}catch(a){console.error("Error loading datasets",a)}}n&&n.length&&c(n)},[n,e]),{datasets:t,datasetStructuresMap:r}}function io(e){const n=e==null?void 0:e.filter(t=>zo(t));if(n!=null&&n.every(t=>!!(t!=null&&t.data)))return n==null?void 0:n.map(t=>({title:t==null?void 0:t.title,..._s(Ls(t==null?void 0:t.data))}))}function Ls(e){if(e)try{return JSON.parse(e)}catch(n){console.error("Invalid JSON:",n)}return null}function _s(e){var n,t,o,r,l,c;return{...e,filters:(n=e==null?void 0:e.filters)==null?void 0:n.map(g=>({...g,componentCode:(g==null?void 0:g.component_code)||(g==null?void 0:g.componentCode)})),metadata:{datasetUrl:(t=e==null?void 0:e.metadata)==null?void 0:t.datasetUrl,countryDimension:((o=e==null?void 0:e.metadata)==null?void 0:o.country_dimension)||((r=e==null?void 0:e.metadata)==null?void 0:r.countryDimension),indicatorDimensions:((l=e==null?void 0:e.metadata)==null?void 0:l.indicator_dimensions)||((c=e==null?void 0:e.metadata)==null?void 0:c.indicatorDimensions)}}}var mr=(e=>(e.COMPLETED="completed",e))(mr||{});const Rs=({stage:e,stageRef:n,isCurrentStage:t})=>i.jsxs("div",{ref:n,className:"message-stage flex relative pb-8 last:pb-0 last:mb-8",children:[i.jsx("span",{className:"message-stage-line absolute border-l h-full"}),i.jsx(Ee.IconPointFilled,{className:"message-stage-indicator flex shrink-0 z-10"}),i.jsxs("div",{className:"ml-2 w-full",children:[i.jsxs("div",{className:V("flex gap-2 items-center",(e==null?void 0:e.content)&&"mb-4"),children:[t&&i.jsx(j.Loader,{}),i.jsx("h3",{className:"message-stage-name",children:e==null?void 0:e.name})]}),i.jsx("div",{className:"prose max-w-full break-words",children:i.jsx(lo,{remarkPlugins:[ao],components:{strong:o=>i.jsx("strong",{className:"text-neutrals-1000",...o}),a:({href:o,children:r,...l})=>i.jsx("a",{href:o,target:"_blank",...l,children:r}),h1:o=>i.jsx("h1",{className:"h1 text-neutrals-1000",...o}),h2:o=>i.jsx("h2",{className:"h2 text-neutrals-1000",...o}),h3:o=>i.jsx("h3",{className:"h3 text-neutrals-1000",...o}),h4:o=>i.jsx("h4",{className:"h4 text-neutrals-1000",...o}),h5:o=>i.jsx("h5",{className:"h5 text-neutrals-1000",...o}),code:o=>i.jsx("code",{className:"text-neutrals-900",...o}),pre:o=>i.jsx("pre",{className:"bg-neutrals-100 border border-neutrals-600",...o})},children:e==null?void 0:e.content})})]})]}),Is=({stages:e,expandIcon:n,processingTitle:t})=>{const[o,r]=h.useState(),[l,c]=h.useState(),g=h.useRef(null),a=h.useRef(null);h.useEffect(()=>{var s;c((s=e==null?void 0:e.filter(d=>(d==null?void 0:d.status)!==mr.COMPLETED))==null?void 0:s.at(-1))},[e]),h.useEffect(()=>{var s;o&&((s=a==null?void 0:a.current)==null||s.scrollIntoView({block:"nearest",behavior:"smooth"}))},[o]),h.useEffect(()=>{const s=g.current;let d;if(!s)return;const f=new IntersectionObserver(([w])=>{var b;const m=(b=w==null?void 0:w.boundingClientRect)==null?void 0:b.top;d&&!(w!=null&&w.isIntersecting)&&m<d&&r(!1),d=m},{threshold:0});return f.observe(s),()=>f.disconnect()},[]);const u=()=>{r(s=>!s)};return i.jsxs("div",{className:"message-stages",ref:g,children:[i.jsxs("div",{className:V("message-stages-header inline-flex max-w-full items-center cursor-pointer",!(l!=null&&l.name)&&"default-header"),onClick:u,children:[i.jsx("p",{className:"message-stages-title truncate",children:(l==null?void 0:l.name)||t||"Processing..."}),i.jsx("i",{className:V("message-stages-expand-icon",o&&"rotated"),children:n})]}),o&&e&&i.jsx("div",{className:"flex flex-col",children:e==null?void 0:e.map(s=>i.jsx(Rs,{stage:s,stageRef:l?a:null,isCurrentStage:(s==null?void 0:s.index)===(l==null?void 0:l.index)},s.index))})]})},Ps=({message:e,regenerateMessage:n,messageActionsIcons:t,rateResponse:o,isStreaming:r=!1,isReadOnly:l=!1})=>{const c=t==null?void 0:t.copy,g=t==null?void 0:t.regenerate,a=t==null?void 0:t.thumbUp,u=t==null?void 0:t.thumbDown,s=t==null?void 0:t.thumbPressed,[d,f]=h.useState(null),w=m=>{e.responseId&&(f(m),o(e.responseId||"",m))};return i.jsxs("div",{className:V("message-actions","flex gap-x-2 pt-2"),children:[c&&i.jsx("p",{onClick:()=>navigator.clipboard.writeText(e.content),children:c}),g&&!l&&!r&&i.jsx("p",{onClick:()=>{n==null||n(e)},children:g}),a&&!l&&d!==!1&&(d===null?i.jsx("p",{onClick:()=>w(!0),children:a}):i.jsx("p",{children:s})),u&&!l&&d!==!0&&(d===null?i.jsx("p",{onClick:()=>w(!1),children:u}):i.jsx("p",{className:"rotate-180",children:s}))]})},Vs=({message:e,onEditClick:n,messageActionsIcons:t,isStreaming:o=!1,isReadOnly:r=!1})=>{const l=t==null?void 0:t.copy,c=t==null?void 0:t.edit;return i.jsxs("div",{className:V("message-actions","flex gap-x-2 pt-2 ml-12"),children:[l&&i.jsx("p",{onClick:()=>navigator.clipboard.writeText(e.content),children:l}),c&&!o&&!r&&i.jsx("p",{onClick:n,children:c})]})},Fs=({content:e,textColorClass:n,onCancel:t,onEditApply:o,editMessageTitles:r})=>{const{isOpenedAdvancedView:l}=_e(),c=h.useRef(null);h.useEffect(()=>{const a=c.current;g(),a&&(a.focus(),a.setSelectionRange(a.value.length,a.value.length))},[]);const g=()=>{const a=c.current;a&&(a.style.height="auto",a.style.height=a.scrollHeight+"px")};return i.jsxs("div",{className:V("max-w-none break-words",l?"body-2":"body-1",n),children:[i.jsx("textarea",{ref:c,className:"resize-none overflow-hidden outline-none bg-neutrals-300 w-full",defaultValue:e,onInput:g}),i.jsxs("div",{className:V("flex gap-x-2 items-center","edit-buttons-wrapper"),children:[i.jsx(j.Button,{buttonClassName:"text-button-secondary small-icon-button",title:r==null?void 0:r.cancel,isSmallButton:!0,onClick:t}),i.jsx(j.Button,{buttonClassName:"text-button-primary small-icon-button",title:r==null?void 0:r.send,isSmallButton:!0,onClick:()=>{var a;return o(((a=c.current)==null?void 0:a.value)||"")}})]})]})},Bs=({message:e,previousMessage:n,titles:t,actions:o,dataQuery:r,isStreaming:l=!1,isCurrentMessageStreaming:c=!1,messageStyles:g,attachmentsStyles:a,showAdvancedView:u,formattingSettings:s,locale:d,metadataSettings:f,expandStagesIcon:w,onAdvancedViewOpen:m,regenerateMessage:b,selectMessageToSend:p,messageActionsIcons:S,rateResponse:C,editMessage:x,editMessageTitles:N,isReadOnlyConversation:v,isNotLastUserMessage:E,limitMessages:_,attachmentsConfig:M})=>{var Ce,je;const[y,k]=h.useState(),[A,O]=h.useState(),[F,K]=h.useState([]),[T,I]=h.useState([]),[H,B]=h.useState(),[U,Z]=h.useState(!1),W=e.role===de.Role.User,q=e.role===de.Role.System,{datasets:se,datasetStructuresMap:ae}=Os(o==null?void 0:o.getDataSet,y),[ce,ue]=h.useState(!1),[he,Ne]=h.useState([]);h.useEffect(()=>{O(y==null?void 0:y[0])},[y]);const{dataSetAttachments:pe,dimensions:xe,isLoadingGridData:fe}=wr(o,d,A,s,a==null?void 0:a.chartingStyles,f,t),{isOpenedAdvancedView:ve}=_e(),Te=()=>{W&&ue(!0)},Se=()=>{ue(!1)},be=P=>{Se(),x==null||x({...e,content:P})},De=h.useCallback(P=>{P&&(O(y==null?void 0:y.find(G=>(G==null?void 0:G.urn)===P)),B(void 0))},[y]);h.useEffect(()=>{var z,ne,L,R;const P=(ne=(z=e.custom_content)==null?void 0:z.form_schema)==null?void 0:ne.properties,G=E?((L=P==null?void 0:P.choice)==null?void 0:L.oneOf)||((R=P==null?void 0:P.completion)==null?void 0:R.oneOf):[];Ne(G||[])},[e,E]),h.useEffect(()=>{const P=Zt(e),G=io(P),z=P.filter(ne=>wn(ne));k(G),I(z)},[e]),h.useEffect(()=>{Z(y!=null&&y.length>0)},[y]),h.useEffect(()=>{r&&r.urn&&B(r.urn)},[r]),h.useEffect(()=>{if((e==null?void 0:e.role)===de.Role.System&&n){const P=Zt(n),G=io(P)||[];y&&G&&ae&&K(ia(G,y,ae,d))}},[y,A,ae,xe,d,e==null?void 0:e.role,n]);const Oe=h.useCallback(()=>!W&&(g!=null&&g.systemMessageIcon)&&!(ve&&!c)?i.jsx("div",{className:V("flex-shrink-0 rounded-full flex items-center justify-center w-[44px] h-[44px]",c?"text-white absolute":"text-neutrals-400"),children:g.systemMessageIcon}):null,[W,g==null?void 0:g.systemMessageIcon,ve,c]),Ae=h.useMemo(()=>i.jsx(ir,{actions:o,titles:t,attachments:U?pe:T,onAdvancedViewOpen:m,isDataSetAttachments:U,datasets:se,initialSelectedDatasetUrn:H,messageStyles:g,attachmentsStyles:a,showAdvancedView:u,isSystemAttachments:q,isDataLoading:fe,currentDataQuery:A,dataQueries:y,attachmentInfoList:F,locale:d,dimensions:xe,selectDataset:De,limitMessages:_,attachmentsConfig:M}),[o,t,U,pe,T,se,H,g,a,u,q,fe,A,y,F,d,xe,De,m,_,M]);return i.jsx(i.Fragment,{children:!(q&&ve)&&i.jsx("div",{className:V("max-w-full flex",W?"justify-end":"justify-start","message-wrapper"),children:i.jsxs("div",{className:V("flex items-start max-w-full",(q||ce)&&"w-full"),children:[i.jsxs("div",{className:"mr-2 relative",children:[Oe(),c&&i.jsx(j.Loader,{})]}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:V(W?"bg-neutrals-300 px-6":"pt-0",W?"user-message":"system-message",W&&(ce?"w-[100%] ml-0":"ml-12")),children:[!W&&!ve&&((Ce=e==null?void 0:e.custom_content)!=null&&Ce.stages)?i.jsx(Is,{stages:(je=e==null?void 0:e.custom_content)==null?void 0:je.stages,expandIcon:w,processingTitle:g==null?void 0:g.processingTitle}):c&&i.jsx("p",{className:"body-1 text-neutrals-700 loading-message",children:t==null?void 0:t.loading}),ce?i.jsx(Fs,{content:e.content,onCancel:Se,onEditApply:be,editMessageTitles:N}):i.jsx(To,{content:e.content})]}),Ae,!c&&(W?!ce&&i.jsx(Vs,{messageActionsIcons:S,message:e,isStreaming:l,onEditClick:Te,isReadOnly:v}):i.jsx(Ps,{messageActionsIcons:S,message:e,isStreaming:l,regenerateMessage:b,rateResponse:C,isReadOnly:v})),!ve&&!fe&&i.jsx(Oo,{choiceButtons:he,onClick:p})]})]})})})},Hs=({messages:e,isStreaming:n=!1,isReadOnly:t,scrollBottomIcon:o,...r})=>{const l=h.useRef(null),c=h.useRef(null),{isOpenedAdvancedView:g}=_e(),[a,u]=h.useState(null),[s,d]=h.useState(!1),f=()=>{var C;const p=(C=c.current)==null?void 0:C.parentElement,S=l.current;if(p&&S){const x=S.offsetTop-p.offsetTop;p.scrollTo({top:x,behavior:"smooth"})}};h.useEffect(()=>{f()},[e,n]),h.useEffect(()=>{!g&&a!==null&&setTimeout(()=>{var p,S;(S=(p=c==null?void 0:c.current)==null?void 0:p.parentElement)==null||S.scrollTo({top:a,behavior:"smooth"})})},[g,a]);const w=()=>{var S,C;const p=((C=(S=c.current)==null?void 0:S.parentElement)==null?void 0:C.scrollTop)||null;u(p)},m=()=>{var S;const p=(S=c.current)==null?void 0:S.parentElement;if(p){const{scrollTop:C,scrollHeight:x,clientHeight:N}=p;C+N>=x?d(!1):!s&&!g&&d(!0)}};h.useEffect(()=>{g&&d(!1)},[g]);const b=j.useDebounce(m,300);return h.useEffect(()=>{var S;const p=(S=c.current)==null?void 0:S.parentElement;return p==null||p.addEventListener("scroll",b),()=>p==null?void 0:p.removeEventListener("scroll",b)},[b]),i.jsxs("div",{ref:c,className:"h-full w-full",children:[i.jsxs("div",{className:"flex flex-col gap-y-6 max-w-full",children:[e.map((p,S)=>i.jsx(Bs,{message:p,previousMessage:Yi(e,S),onAdvancedViewOpen:w,isStreaming:n,isCurrentMessageStreaming:n&&S===e.length-1&&p.role===de.Role.Assistant,showAdvancedView:S===Ki(e)&&!t,isNotLastUserMessage:S===e.length-1&&p.role!==de.Role.User,...r},p.id||S)),i.jsx("div",{ref:l,className:"h-4"})]}),i.jsx("div",{onClick:f,className:V("fixed right-10 lg:right-6 sm:hidden bottom-[88px] rounded-[50%] border-[2px] w-[40px] h-[40px] border-primary cursor-pointer text-primary bg-white","scroll-button-wrapper",s?"block":"hidden"),children:i.jsx("div",{className:"flex justify-center items-center w-full h-full",children:o})})]})},Gs=e=>{var t,o,r,l,c,g,a,u,s;const n={};return(r=(o=(t=e.choices)==null?void 0:t[0])==null?void 0:o.delta)!=null&&r.content&&(n.content=e.choices[0].delta.content),(g=(c=(l=e.choices)==null?void 0:l[0])==null?void 0:c.delta)!=null&&g.custom_content&&(n.custom_content=e.choices[0].delta.custom_content),(s=(u=(a=e.choices)==null?void 0:a[0])==null?void 0:u.delta)!=null&&s.role&&(n.role=e.choices[0].delta.role),e.id&&(n.responseId=e.id),n},Us="local",zs=e=>{var n;return!((n=e.permissions)!=null&&n.includes(de.SharePermission.WRITE))&&!$s(e)},Ws=(e,n)=>pr(e)!==n,$s=e=>pr(e)===Us,pr=e=>e.id.split("/")[0],Js=(e,n)=>yn([...(n==null?void 0:n.messages)||[],e]),yn=e=>[...e].map(n=>{const t={role:n.role,content:n.content};return(n.role===de.Role.Assistant||n.role===de.Role.System)&&n.custom_content!=null&&(n.custom_content.state!=null||n.custom_content.attachments!=null||n.custom_content.form_schema!=null)&&(t.custom_content={},n.custom_content.state!=null&&(t.custom_content.state=n.custom_content.state),n.custom_content.attachments!=null&&(t.custom_content.attachments=Zs(n.custom_content.attachments)),n.custom_content.form_schema!=null&&(t.custom_content.form_schema=n.custom_content.form_schema)),n.role===de.Role.User&&n.custom_content&&(t.custom_content=n.custom_content),t}),Ys=(e,n)=>{const t=n==null?void 0:n.messages,o=t==null?void 0:t.findIndex(r=>e.id===r.id);return yn((t==null?void 0:t.slice(0,o))||[])},Ks=(e,n)=>{const t=n==null?void 0:n.messages,o=t==null?void 0:t.findIndex(r=>e.id===r.id);return yn([...(t==null?void 0:t.slice(0,o))||[],e])};function Zs(e){return e.map(n=>({type:n.type,title:n.title,data:n.data,url:n.url,reference_type:n.reference_type,reference_url:n.reference_url}))}const qs=(e,n,t,o)=>{if(!t||n)return null;const r={id:`msg-${Date.now()}`,role:de.Role.User,content:e,timestamp:Date.now()};if(o){const l=o===on.COMPLETE?qe.COMPLETION:qe.CHOICE;r.custom_content={form_value:{[l]:o}}}return r},Xs=(e,n,t)=>`/${n}${t}/${ee.getConversationNavPath(e==null?void 0:e.folderId,e==null?void 0:e.id)}`,Qs=(e,n,t)=>{const o=`${n}/${t}`,r=re.generateConversationId({folderId:o,name:e==null?void 0:e.name});return{...e,folderId:o,id:r}},ec="AbortError",nc=({conversationKey:e,conversation:n,actions:t,messageStyles:o,attachmentsStyles:r,inputMessageStyles:l,shareConversationProps:c,showConversationHeaderAdvancedView:g=!0,formattingSettings:a,metadataSettings:u,expandStagesIcon:s,locale:d,conversationsRoute:f,token:w,isShowUserInfo:m,userInfo:b,titles:p,dataQuery:S,handleInvalidStreaming:C,setConversation:x,setConversations:N,openUrl:v,signOutAction:E,messageActionsIcons:_,editMessageTitles:M,scrollBottomIcon:y,isFinalMessage:k,limitMessages:A,attachmentsConfig:O})=>{const[F,K]=h.useState(null),[T,I]=h.useState(!1),[H,B]=h.useState(!0),[U,Z]=h.useState(!1),{isOpenedAdvancedView:W}=_e(),{onboardingFileSchema:q,onboardingFilePath:se,onboardingFileName:ae,isShowOnboarding:ce,setOnboardingFileSchema:ue}=me();h.useEffect(()=>{var L;q&&((L=t.putOnboardingFile)==null||L.call(t,ae,se,q))},[t,q,ae,se]),h.useEffect(()=>{W&&(q==null?void 0:q.lastDisplayedElement)===le.OPEN_ADVANCED_VIEW&&(ue==null||ue(Uo(q)))},[t,W,ue,q]);const he=h.useCallback(()=>{v(`/${d}${f}`)},[d,f,v]),Ne=h.useCallback(async()=>{try{const{bucket:L}=await t.getBucket(),R=Qs(n,L,d);await t.createConversation(R,d);const $=await t.getConversations(d);N(ee.cleanConversationNames($)),v(Xs(R,d,f))}catch(L){console.error("Failed to save conversation:",L)}},[t,n,f,d,v,N]),pe=h.useCallback(async L=>{try{await t.updateConversation(decodeURI(e),{name:L.name,messages:L.messages})}catch(R){console.error("Failed to save conversation:",R)}},[t,e]),xe=h.useCallback(L=>{x(R=>R?{...R,messages:[...(R==null?void 0:R.messages)||[],L]}:null)},[x]),fe=h.useCallback(()=>{const L={id:`msg-${Date.now()+1}`,role:de.Role.Assistant,content:"",timestamp:Date.now()};return x(R=>R?{...R,messages:[...R.messages,L]}:null),L},[x]),ve=h.useCallback((L,R)=>{var J;const $=(J=re.mergeMessages)==null?void 0:J.call(re,L,[R]);if($)return x(te=>te?{...te,messages:te.messages.map(oe=>oe.id===L.id?{...$}:oe)}:null),$},[x]),Te=h.useCallback((L,R)=>{t.rateResponse(L,R)},[t]),Se=h.useCallback(async(L,R,$)=>{var oe;const J=new AbortController;K(J);let te=L;if($)return await((oe=re.streamChatResponse)==null?void 0:oe.call(re,encodeURI($.id),R,{model:$.model,signal:J==null?void 0:J.signal,onMessage:we=>{const Le=Gs(we);(Le.content||Le.role||Le.responseId)&&(te=ve(te,Le))},onError:we=>{if(!Ae(we))throw console.error("Streaming error:",we),we}},w,$==null?void 0:$.custom_fields).catch(we=>{const Le=we.message;C==null||C(Le)})),te},[ve,C,w]),be=h.useCallback(async(L,R,$)=>{if(R){const J={...R,messages:[...R.messages],updatedAt:Date.now()};$&&J.messages.push($),J.messages.push(L),await pe(J)}},[pe]),De=h.useCallback((L,R)=>{x($=>$?{...$,messages:$.messages.filter(J=>J.id!==R.id)}:null)},[x]),Oe=h.useCallback(()=>{F&&!F.signal.aborted&&F.abort()},[F]),Ae=L=>(L==null?void 0:L.name)===ec,Ce=h.useCallback(async(L,R,$,J,te,oe=!0)=>{Ae(te)?await be(J??$,L,oe?R:void 0):De(te,R)},[be,De]),je=h.useCallback(async(L,R,$)=>{if(!R||!L)return;const J=qs(L,U,R,$);let te,oe;if(J){xe(J);try{Z(!0),te=fe();const we=Js(J,R);oe=await Se(te,we,R),await be(oe,R,J)}catch(we){Ce(R,J,te,oe,we)}finally{Z(!1)}}},[U,xe,fe,Se,be,Ce]),P=h.useCallback(async(L,R,$)=>{let J,te;try{Z(!0),J=fe(),te=await Se(J,L,R),await be(te,R)}catch(oe){Ce(R,$,J,te,oe,!1)}finally{Z(!1)}},[be,Ce,Se,fe]),G=h.useCallback(async(L,R)=>{if(!R||!L)return;const $=Ys(L,R),J={...R,messages:R.messages.slice(0,$.length)};x(te=>te?{...te,...J}:null),P($,J,L)},[x,P]),z=h.useCallback(async(L,R)=>{if(!R||!L)return;const $=Ks(L,R),J={...R,messages:[...R.messages.slice(0,$.length-1),L]};x(te=>te?{...te,...J}:null),P($,J,L)},[x,P]);h.useEffect(()=>{async function L(){var R,$,J;try{B(!0);const{bucket:te}=await t.getBucket(),oe=await t.getConversation(decodeURI(e));x(oe),I(zs(oe)&&Ws(oe,te)),(oe.messages.length===0||(($=(R=oe==null?void 0:oe.messages)==null?void 0:R[0])==null?void 0:$.role)===de.Role.Assistant&&((J=oe==null?void 0:oe.messages)==null?void 0:J.length)===1)&&je(oe.prompt,oe)}catch{I(!0)}finally{B(!1)}}e&&L()},[e]);const ne=h.useMemo(()=>({getFile:t.getFile,putOnboardingFile:t.putOnboardingFile,getDataSet:t.getDataSet,getDataSetData:t.getDataSetData,getConstraints:t.getConstraints,updateCurrentDataQuery:t.updateCurrentDataQuery,updateDataQueries:t.updateDataQueries,updateDatasets:t.updateDatasets,downloadDataSet:t.downloadDataSet}),[t]);return H?i.jsx(j.Loader,{}):i.jsxs("div",{className:V("h-full flex flex-col bg-white",W&&!g?"p-4":"pr-2"),children:[W&&!g?null:i.jsx(Mo,{conversation:n,locale:d,isOpenedAdvancedView:W,isShowShareButton:!T&&!ce,shareConversationProps:c,isShowUserInfo:m,userInfo:b,signOutTitle:p==null?void 0:p.signOut,signOutAction:E}),i.jsx("div",{className:V("flex-1 min-h-0 flex flex-col items-end overflow-y-auto",o==null?void 0:o.messagesWrapperClass),children:i.jsx(Hs,{messages:(n==null?void 0:n.messages)||[],actions:ne,isStreaming:U,isReadOnly:T,messageStyles:o,attachmentsStyles:r,formattingSettings:a,metadataSettings:u,expandStagesIcon:s,dataQuery:S,locale:d,titles:p,regenerateMessage:L=>G(L,n),selectMessageToSend:(L,R)=>je(L,n,R),messageActionsIcons:_,rateResponse:Te,editMessage:L=>z(L,n),editMessageTitles:M,scrollBottomIcon:y,isReadOnlyConversation:T||ce,limitMessages:A,attachmentsConfig:O})}),ce?null:T?i.jsx("div",{className:"flex items-center justify-center mt-4",children:i.jsx(j.Button,{iconBefore:i.jsx(Ee.IconCopy,{width:20,height:20}),title:(p==null?void 0:p.duplicate)??"Duplicate Chat",isSmallButton:!0,onClick:Ne,buttonClassName:V("text-button-secondary")})}):i.jsx("div",{className:V(l.inputContainerClass),children:i.jsx(wo,{onSendMessage:L=>je(L,n),onStopStreaming:Oe,inProcess:U,sendMessageIcon:l.sendMessageIcon,placeholder:(p==null?void 0:p.askAnything)??"Ask anything...",containerClasses:"mt-4",inputClasses:"border-neutrals-600 mr-2"})}),ce&&k&&i.jsx(j.Button,{iconBefore:i.jsx(Ee.IconPlus,{width:24,height:24}),title:p==null?void 0:p.onboardingFooterLink,onClick:he,isSmallButton:!0,buttonClassName:"text-button-secondary self-center mb-3"})]})};exports.AdvancedView=Ts;exports.AdvancedViewProvider=Er;exports.CUSTOM_CHOICE_ID=on;exports.ChartingIcon=Xe;exports.ChatFooter=_o;exports.ChatOnboardingFooter=Lo;exports.ConversationView=nc;exports.ConversationWelcome=Zr;exports.CustomContentProperties=qe;exports.ONBOARDING_MODEL_POSTFIX=Ur;exports.OnboardingProvider=Dr;exports.SHARE_CONVERSATION_ROUTE=vn;exports.STAGE_STATUS=go;exports.useAdvancedView=_e;exports.useOnboarding=me;
39
+ ***************************************************************************** */var t=function(){return t=Object.assign||function(c){for(var a,d=1,g=arguments.length;d<g;d++){a=arguments[d];for(var w in a)Object.prototype.hasOwnProperty.call(a,w)&&(c[w]=a[w])}return c},t.apply(this,arguments)},o=function(s,c,a){return a.months[c?"shorthand":"longhand"][s]};function r(s){for(;s.firstChild;)s.removeChild(s.firstChild)}function i(s){try{if(typeof s.composedPath=="function"){var c=s.composedPath();return c[0]}return s.target}catch{return s.target}}var u={shorthand:!1,dateFormat:"F Y",altFormat:"F Y",theme:"light"};function f(s){var c=t(t({},u),s);return function(a){a.config.dateFormat=c.dateFormat,a.config.altFormat=c.altFormat;var d={monthsContainer:null};function g(){if(a.rContainer){r(a.rContainer);for(var S=0;S<a.monthElements.length;S++){var D=a.monthElements[S];D.parentNode&&D.parentNode.removeChild(D)}}}function w(){a.rContainer&&(d.monthsContainer=a._createElement("div","flatpickr-monthSelect-months"),d.monthsContainer.tabIndex=-1,m(),a.rContainer.appendChild(d.monthsContainer),a.calendarContainer.classList.add("flatpickr-monthSelect-theme-"+c.theme))}function m(){if(d.monthsContainer){r(d.monthsContainer);for(var S=document.createDocumentFragment(),D=0;D<12;D++){var O=a.createDay("flatpickr-monthSelect-month",new Date(a.currentYear,D),0,D);O.dateObj.getMonth()===new Date().getMonth()&&O.dateObj.getFullYear()===new Date().getFullYear()&&O.classList.add("today"),O.textContent=o(D,c.shorthand,a.l10n),O.addEventListener("click",k),S.appendChild(O)}d.monthsContainer.appendChild(S),a.config.minDate&&a.currentYear===a.config.minDate.getFullYear()?a.prevMonthNav.classList.add("flatpickr-disabled"):a.prevMonthNav.classList.remove("flatpickr-disabled"),a.config.maxDate&&a.currentYear===a.config.maxDate.getFullYear()?a.nextMonthNav.classList.add("flatpickr-disabled"):a.nextMonthNav.classList.remove("flatpickr-disabled")}}function v(){a._bind(a.prevMonthNav,"click",function(S){S.preventDefault(),S.stopPropagation(),a.changeYear(a.currentYear-1),b(),m()}),a._bind(a.nextMonthNav,"click",function(S){S.preventDefault(),S.stopPropagation(),a.changeYear(a.currentYear+1),b(),m()}),a._bind(d.monthsContainer,"mouseover",function(S){a.config.mode==="range"&&a.onMouseOver(i(S),"flatpickr-monthSelect-month")})}function p(){if(a.rContainer&&a.selectedDates.length){for(var S=a.rContainer.querySelectorAll(".flatpickr-monthSelect-month.selected"),D=0;D<S.length;D++)S[D].classList.remove("selected");var O=a.selectedDates[0].getMonth(),B=a.rContainer.querySelector(".flatpickr-monthSelect-month:nth-child("+(O+1)+")");B&&B.classList.add("selected")}}function b(){var S=a.selectedDates[0];if(S&&(S=new Date(S),S.setFullYear(a.currentYear),a.config.minDate&&S<a.config.minDate&&(S=a.config.minDate),a.config.maxDate&&S>a.config.maxDate&&(S=a.config.maxDate),a.currentYear=S.getFullYear()),a.currentYearElement.value=String(a.currentYear),a.rContainer){var D=a.rContainer.querySelectorAll(".flatpickr-monthSelect-month");D.forEach(function(O){O.dateObj.setFullYear(a.currentYear),a.config.minDate&&O.dateObj<a.config.minDate||a.config.maxDate&&O.dateObj>a.config.maxDate?O.classList.add("flatpickr-disabled"):O.classList.remove("flatpickr-disabled")})}p()}function k(S){S.preventDefault(),S.stopPropagation();var D=i(S);if(D instanceof Element&&!D.classList.contains("flatpickr-disabled")&&!D.classList.contains("notAllowed")&&(x(D.dateObj),a.config.closeOnSelect)){var O=a.config.mode==="single",B=a.config.mode==="range"&&a.selectedDates.length===2;(O||B)&&a.close()}}function x(S){var D=new Date(a.currentYear,S.getMonth(),S.getDate()),O=[];switch(a.config.mode){case"single":O=[D];break;case"multiple":O.push(D);break;case"range":a.selectedDates.length===2?O=[D]:(O=a.selectedDates.concat([D]),O.sort(function(B,W){return B.getTime()-W.getTime()}));break}a.setDate(O,!0),p()}var N={37:-1,39:1,40:3,38:-3};function C(S,D,O,B){var W=N[B.keyCode]!==void 0;if(!(!W&&B.keyCode!==13)&&!(!a.rContainer||!d.monthsContainer)){var F=a.rContainer.querySelector(".flatpickr-monthSelect-month.selected"),_=Array.prototype.indexOf.call(d.monthsContainer.children,document.activeElement);if(_===-1){var G=F||d.monthsContainer.firstElementChild;G.focus(),_=G.$i}W?d.monthsContainer.children[(12+_+N[B.keyCode])%12].focus():B.keyCode===13&&d.monthsContainer.contains(document.activeElement)&&x(document.activeElement.dateObj)}}function j(){var S;((S=a.config)===null||S===void 0?void 0:S.mode)==="range"&&a.selectedDates.length===1&&a.clear(!1),a.selectedDates.length||m()}function R(){c._stubbedCurrentMonth=a._initialDate.getMonth(),a._initialDate.setMonth(c._stubbedCurrentMonth),a.currentMonth=c._stubbedCurrentMonth}function M(){c._stubbedCurrentMonth&&(a._initialDate.setMonth(c._stubbedCurrentMonth),a.currentMonth=c._stubbedCurrentMonth,delete c._stubbedCurrentMonth)}function L(){if(d.monthsContainer!==null)for(var S=d.monthsContainer.querySelectorAll(".flatpickr-monthSelect-month"),D=0;D<S.length;D++)S[D].removeEventListener("click",k)}return{onParseConfig:function(){a.config.enableTime=!1},onValueUpdate:p,onKeyDown:C,onReady:[R,g,w,v,p,function(){a.config.onClose.push(j),a.loadedPlugins.push("monthSelect")}],onDestroy:[M,L,function(){a.config.onClose=a.config.onClose.filter(function(S){return S!==j})}]}}}return f}))})(Je)),Je.exports}var ri=oi();const ii=Lo(ri),Ft=(e,n,t,o,r=!1,i)=>{const u={...ni[o]},f=ii;r&&(u.firstDayOfWeek=1);const s={minDate:t===q.CalendarResolution.MONTH?new Date(e.getFullYear(),e.getMonth()):e,maxDate:t===q.CalendarResolution.MONTH?new Date(n.getFullYear(),n.getMonth()):n,locale:u};return t===q.CalendarResolution.MONTH?{...s,dateFormat:"M Y",plugins:[new f({shorthand:!0,dateFormat:"M Y"})]}:{...s,monthSelectorType:"static",dateFormat:i||"d.m.Y"}},Bt=e=>{e!=null&&e.setMinutes(e.getMinutes()-e.getTimezoneOffset())},li={year:"numeric",month:"short",day:"numeric"},Xe=(e,n)=>(e==null?void 0:e.toLocaleDateString(n,li))||"",si=(e,n)=>{const{startPeriod:t,endPeriod:o}=e;if(!n.startPeriod&&!n.endPeriod&&t&&o)return{startPeriod:new Date(t==null?void 0:t.getTime()),endPeriod:new Date(o==null?void 0:o.getTime())};const r=t?new Date(Math.max(t.getTime(),n.startPeriod.getTime())):n.startPeriod,i=o?new Date(Math.min(o.getTime(),n.endPeriod.getTime())):n.endPeriod;return{startPeriod:r,endPeriod:i}},ai=(e,n)=>{var s;const{endPeriod:t}=e,o=(t==null?void 0:t.getFullYear())||new Date().getFullYear(),r=o+ +n,i=new Date(+n<0?o:r,(t==null?void 0:t.getMonth())||0,(t==null?void 0:t.getDate())||1),u=new Date(+n<0?r:o,0,1);return{startPeriod:new Date(Math.max(u.getTime(),((s=e==null?void 0:e.startPeriod)==null?void 0:s.getTime())||0)),endPeriod:i}},ci=e=>({quarterly:(e==null?void 0:e.quarterly)||"Q",monthly:(e==null?void 0:e.monthly)||"M"}),ui=(e,n)=>{const t=ci(n);return A.isQuarterly(e)&&(t!=null&&t.quarterly)?e==null?void 0:e.replace(/Q/g,t==null?void 0:t.quarterly):A.isMonthly(e)&&(t!=null&&t.monthly)?e==null?void 0:e.replace(/M/g,t==null?void 0:t.monthly):e};var Ie=(e=>(e.FLAT_LIST="FLAT_LIST",e.HIERARCHY="HIERARCHY",e))(Ie||{});const di=(e,n,t,o)=>(e==null?void 0:e.map(r=>{var s;const i=(s=A.findCodelistByDimension(n==null?void 0:n.codelists,n==null?void 0:n.conceptSchemes,r))==null?void 0:s.codes,u=A.getAvailableCodes(r,t,i,o),f=i==null?void 0:i.some(c=>c==null?void 0:c.parent);return{id:r==null?void 0:r.id,title:A.getDimensionTitle(n==null?void 0:n.conceptSchemes,r,o),dimensionValues:u,isTimeDimension:(r==null?void 0:r.type)===A.DimensionType.TIME_DIMENSION,isHierarchical:f,displayMode:f?Ie.HIERARCHY:Ie.FLAT_LIST}}))||[],Ht=(e,n)=>e==null?void 0:e.map(t=>n&&(t==null?void 0:t.id)===(n==null?void 0:n.id)?{...n,isSelectedFilter:!0}:{...t,isSelectedFilter:!1}),hi=(e,n,t)=>e?e.map(o=>(o==null?void 0:o.id)===n?{...o,displayMode:t}:o):[],Ro=e=>(e==null?void 0:e.filter(n=>!!(n!=null&&n.isSelectedValue)))||[],_o=e=>e==null?void 0:e.map(n=>({...n,dimensionValues:Ro(n==null?void 0:n.dimensionValues)})).filter(n=>{var t,o,r;return((t=n.dimensionValues)==null?void 0:t.length)||((o=n.timeRange)==null?void 0:o.startPeriod)||((r=n.timeRange)==null?void 0:r.endPeriod)}),fi=e=>(e==null?void 0:e.reduce((n,t)=>{var o;return(((o=t==null?void 0:t.dimensionValues)==null?void 0:o.length)??0)+n},0))||0,Io=e=>{var n;return{...e,dimensionValues:(n=e==null?void 0:e.dimensionValues)==null?void 0:n.map(t=>({...t,isSelectedValue:!1})),timeRange:void 0}},gi=(e,n)=>e==null?void 0:e.map(t=>(t==null?void 0:t.id)===n?Io(t):t),wi=e=>e==null?void 0:e.map(n=>Io(n)),mi=(e,n,t)=>e.map(o=>{var u,f;const r=n==null?void 0:n.filters.find(s=>s.componentCode===o.id);let i=[];if(r)if(o.isTimeDimension){const s=r.values.filter(w=>!!w),c=A.getAnnotationPeriod((u=t==null?void 0:t[0])==null?void 0:u.annotations),a=s[0]?q.getTimePeriod(s[0]):null,d=s[1]?q.getTimePeriod(s[1]):null;let g=c;return a&&d&&(g=c?si({startPeriod:a,endPeriod:d},c):{startPeriod:a,endPeriod:d}),{...o,timeRange:g}}else i=(f=o==null?void 0:o.dimensionValues)==null?void 0:f.map(c=>{var a;return(a=r==null?void 0:r.values)!=null&&a.includes(c.id)?{...c,isSelectedValue:!0}:c});else i=o.dimensionValues;return{...o,dimensionValues:i}}),Gt=e=>e==null?void 0:e.map(n=>({...n,isDisabled:!0})),pi=e=>new Map(e==null?void 0:e.map(n=>[n.id,{...n,children:[]}])),xi=e=>{if(!e)return[];const n=pi(e),t=[];return e.forEach(o=>{if(o&&o.parent){const r=n.get(o.parent),i=n.get(o.id);r&&r.children&&i&&(r.children=[...r.children,i])}else{const r=n.get(o.id);r&&t.push(r)}}),t},vi=(e,n=!1)=>n?`${e*E.TREE_NODE_PADDING-E.TREE_NODE_ARROW_SIZE}px`:`${e*E.TREE_NODE_PADDING}px`,Ge=e=>{var n;return((n=e==null?void 0:e.children)==null?void 0:n.reduce((t,o)=>[...t,o,...Ge(o)],[]))||[]},Ue=(e,n)=>e?e.map(t=>({...t,isSelectedValue:n})):[],bi=e=>{var o,r;const n=(o=e.children)==null?void 0:o.every(i=>i.isSelectedValue),t=(r=e.children)==null?void 0:r.every(i=>!i.isSelectedValue);if(e.isSelectedValue){if(e.isSelectedValue&&n)return[{...e,isSelectedValue:!1},...Ue(Ge(e),!0)]}else{if(t)return[{...e,isSelectedValue:!0},...Ue(Ge(e),!0)];if(n)return[{...e,isSelectedValue:!0},...Ue(Ge(e),!1)]}return[{...e,isSelectedValue:!1},...Ue(Ge(e),!1)]},Ci=e=>[{key:Ie.HIERARCHY,title:(e==null?void 0:e.hierarchy)||"Hierarchy"},{key:Ie.FLAT_LIST,title:(e==null?void 0:e.flatList)||"Flat list"}],ki=({calendarResolution:e,timeRange:n,timeRangeOptions:t,calendarStartFromMonday:o=!0,locale:r=q.Locale.EN,radioIcon:i,initialConstraints:u,onValueChange:f,calendarIcon:s,dateFormat:c,titles:a,defaultTimeOption:d})=>{var R,M,L,S;const g=A.getAnnotationPeriod(u==null?void 0:u[0].annotations),[w,m]=h.useState(n),v=!n||((R=n==null?void 0:n.startPeriod)==null?void 0:R.getTime())===((M=g==null?void 0:g.startPeriod)==null?void 0:M.getTime())&&((L=n==null?void 0:n.endPeriod)==null?void 0:L.getTime())===((S=g==null?void 0:g.endPeriod)==null?void 0:S.getTime())?0:q.CUSTOM_PERIOD,[p,b]=h.useState(d??v),k=h.useMemo(()=>{const{startPeriod:D,endPeriod:O}=g,B=D==null?void 0:D.getFullYear(),W=O==null?void 0:O.getFullYear(),F=new Date().getFullYear();return t.filter(_=>_.value===q.CUSTOM_PERIOD||_.value===0||+_.value>=0&&W-F>=+_.value||+_.value<0&&B-F<+_.value)},[g,t]);h.useEffect(()=>{f(w,p)},[w]);const x=D=>{D&&(Bt(D),m(O=>O?{...O,startPeriod:D||null}:{endPeriod:null,startPeriod:D||null}))},N=D=>{D&&(Bt(D),m(O=>O?{...O,endPeriod:D||null}:{startPeriod:null,endPeriod:D||null}))};if(g==null)return null;const C=Ft(g.startPeriod,(w==null?void 0:w.endPeriod)||g.endPeriod,e,r,o,c),j=Ft((w==null?void 0:w.startPeriod)||g.startPeriod,g.endPeriod,e,r,o,c);return l.jsxs("div",{className:"mt-3 overflow-auto flex flex-col pt-2 pb-2 pr-3 h-full flex-1 min-w-0",children:[l.jsx("div",{className:"w-full",children:k.map(D=>l.jsx(E.Radio,{id:D.value.toString(),checked:p===D.value,label:D.title,onChange:()=>{const{value:O}=D;b(O),O!==q.CUSTOM_PERIOD&&m(O===0?g:ai(g,O))},radioIcon:i},D.value.toString()))}),l.jsx("div",{className:"w-full",children:p===q.CUSTOM_PERIOD&&l.jsxs("div",{className:"flex filters-time-period gap-4 mt-3 caption text-neutral-700",children:[l.jsx(E.Calendar,{onChange:x,options:C,value:(w==null?void 0:w.startPeriod)||(g==null?void 0:g.startPeriod),label:(a==null?void 0:a.from)||"From",id:"time-options-start",icon:s}),l.jsx(E.Calendar,{onChange:N,options:j,value:(w==null?void 0:w.endPeriod)||(g==null?void 0:g.endPeriod),label:(a==null?void 0:a.to)||"To",id:"time-options-end",icon:s,isEndDate:!0})]})})]})},Si=e=>ee.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},ee.createElement("path",{d:"M6.25 4.66668L9.75 8.00001L6.25 11.3333L6.25 4.66668Z",fill:"currentColor"})),Po=({node:e,level:n=1,checkboxIcon:t,selectFilterValue:o,selectHierarchicalNodes:r,expandHierarchicalValue:i})=>{var a;const[u,f]=h.useState(!1),s="cursor-pointer text-neutrals-1000 w-6 h-6 shrink-0";h.useEffect(()=>{var d;f(!!((d=e==null?void 0:e.children)!=null&&d.length))},[e]);const c=(d,g)=>{var w;(w=e==null?void 0:e.children)!=null&&w.length?r==null||r(bi(e)):o==null||o(d,g)};return l.jsxs("div",{className:"flex flex-col",children:[l.jsxs("div",{className:"flex items-center",style:{paddingLeft:vi(n,u)},children:[u&&(e!=null&&e.isExpanded?l.jsx(Si,{className:s,onClick:()=>i==null?void 0:i(e)}):l.jsx(mn,{className:s,onClick:()=>i==null?void 0:i(e)})),l.jsx(E.Checkbox,{id:e==null?void 0:e.id,label:e==null?void 0:e.name,checked:!!e.isSelectedValue,checkboxIcon:t,onChange:c})]}),u&&(e==null?void 0:e.isExpanded)&&l.jsx(l.Fragment,{children:(a=e==null?void 0:e.children)==null?void 0:a.map(d=>l.jsx(Po,{node:d,level:n+1,checkboxIcon:t,selectFilterValue:o,selectHierarchicalNodes:r,expandHierarchicalValue:i},d==null?void 0:d.id))})]},e==null?void 0:e.id)},Ni=({filterValues:e,checkboxIcon:n,selectFilterValue:t,selectHierarchicalNodes:o,expandHierarchicalValue:r})=>{const[i,u]=h.useState([]);return h.useEffect(()=>{u(xi(e))},[e]),i==null?void 0:i.map(f=>l.jsx(Po,{node:f,checkboxIcon:n,selectFilterValue:t,selectHierarchicalNodes:o,expandHierarchicalValue:r},f==null?void 0:f.id))},ji=({style:e,filterValue:n,checkboxIcon:t,selectFilterValue:o})=>l.jsx("div",{style:e,children:l.jsx(E.Checkbox,{id:n.id,label:n.name,checked:!!n.isSelectedValue,checkboxIcon:t,onChange:o})}),Ei=Sr.FixedSizeList,zt=24,Wt=232,Di=({filterValues:e,checkboxIcon:n,isHierarchicalView:t,isDisableValues:o,selectFilterValue:r,selectHierarchicalNodes:i,expandHierarchicalValue:u})=>{const f=E.useIsMobile();if(!e)return null;const s=e.length*zt,c=s>Wt?Wt:s;return l.jsx("div",{className:V(o&&"pointer-events-none opacity-[0.7]","h-full overflow-auto"),style:{height:f?c+"px":"100%"},children:t?l.jsx(Ni,{filterValues:e,checkboxIcon:n,selectFilterValue:r,selectHierarchicalNodes:i,expandHierarchicalValue:u}):l.jsx(Nr,{children:({width:a,height:d})=>l.jsx(Ei,{itemCount:e.length,itemSize:zt,width:a,height:d,children:({index:g,style:w})=>l.jsx(ji,{index:g,style:w,filterValue:e[g],checkboxIcon:n,selectFilterValue:r})})})})},Vo=({selectedFilter:e,filterValuesProps:n,locale:t,isDisableValues:o,timeRangeOptions:r,onTimePeriodChange:i,selectFilterValue:u,titles:f,initialConstraints:s,selectHierarchicalNodes:c,expandHierarchicalValue:a,selectedTimeOption:d})=>{const[g,w]=h.useState(""),[m,v]=h.useState([]),p=(e==null?void 0:e.displayMode)===Ie.HIERARCHY;h.useEffect(()=>{var x;const k=((x=e==null?void 0:e.dimensionValues)==null?void 0:x.filter(N=>{var C,j;return(j=(C=N==null?void 0:N.name)==null?void 0:C.toLowerCase())==null?void 0:j.includes(g==null?void 0:g.toLowerCase())}))||[];v(p?A.getFilteredItemsWithParents(e==null?void 0:e.dimensionValues,k):k)},[p,g,e==null?void 0:e.dimensionValues]),h.useEffect(()=>{w("")},[e]);const b=h.useCallback(k=>{w(k)},[w]);return l.jsx(l.Fragment,{children:e!=null&&e.isTimeDimension&&s?l.jsx(ki,{titles:f,initialConstraints:s,calendarResolution:q.CalendarResolution.DAY,timeRange:(e==null?void 0:e.timeRange)||null,timeRangeOptions:r||[],calendarStartFromMonday:!0,locale:t,radioIcon:n==null?void 0:n.radioIcon,onValueChange:i,calendarIcon:n==null?void 0:n.calendarIcon,dateFormat:n==null?void 0:n.dateFormat,defaultTimeOption:d}):l.jsxs("div",{className:V("flex flex-col pt-2 pb-2 h-full flex-1 min-w-0 sm:border-0","filter-values-container"),children:[l.jsx(E.InputWithIcon,{inputId:"filters-search-input",containerClasses:"gap-2 items-center filters-search-input",cssClass:"filters-search-input-text",placeholder:(f==null?void 0:f.searchPlaceholder)??"Search",value:g,onChange:b,iconBeforeInput:l.jsx(De.IconSearch,{width:n==null?void 0:n.searchIconSize,height:n==null?void 0:n.searchIconSize,className:"text-primary"})}),l.jsx("div",{className:"flex flex-col mt-3 body-2 overflow-auto flex-1 min-h-0",children:l.jsx(Di,{filterValues:g?m:e==null?void 0:e.dimensionValues,checkboxIcon:n==null?void 0:n.checkboxIcon,isHierarchicalView:p,isDisableValues:o,selectFilterValue:u,selectHierarchicalNodes:c,expandHierarchicalValue:a})})]})})},Ai=({filter:e,onSelectFilter:n,onSelectDisplayMode:t,onDeleteFilter:o,locale:r,titles:i,initialConstraints:u,hideFacetCounterByDefault:f,filterValuesProps:s,isDisableValues:c,timeRangeOptions:a,onTimePeriodChange:d,selectFilterValue:g,selectHierarchicalNodes:w,expandHierarchicalValue:m})=>{var L;const v=E.useIsMobile(),[p,b]=h.useState(0),[k,x]=h.useState(!1),N=(e==null?void 0:e.isTimeDimension)&&(e==null?void 0:e.timeRange),C=h.useMemo(()=>{var S,D,O,B;return(S=e==null?void 0:e.timeRange)!=null&&S.startPeriod&&((D=e==null?void 0:e.timeRange)!=null&&D.endPeriod)?`${Xe((O=e==null?void 0:e.timeRange)==null?void 0:O.startPeriod,r)} -
40
+ ${Xe((B=e==null?void 0:e.timeRange)==null?void 0:B.endPeriod,r)}`:""},[r,e==null?void 0:e.timeRange]);h.useEffect(()=>{var S;b((S=Ro(e==null?void 0:e.dimensionValues))==null?void 0:S.length)},[e==null?void 0:e.dimensionValues]);const j=S=>{t==null||t(e==null?void 0:e.id,S)},R=f?p>0:!0;h.useEffect(()=>{e.isSelectedFilter||x(!1)},[e.isSelectedFilter]);const M=()=>{v&&x(S=>!S),n(e==null?void 0:e.id)};return l.jsxs("div",{className:"flex flex-col",children:[l.jsxs("div",{className:V("flex justify-between items-center p-2 hover:bg-hues-100 py-2 sm:py-4 sm:hover:bg-white","filters-facet-item cursor-pointer",(e==null?void 0:e.isSelectedFilter)&&!v&&"bg-hues-100",(e==null?void 0:e.isDisabled)&&"cursor-default pointer-events-none opacity-[0.7]"),onClick:M,children:[l.jsxs("h3",{className:"w-full truncate flex-1 min-w-0 sm:flex sm:items-center",title:e==null?void 0:e.title,children:[l.jsx("span",{className:"truncate",children:e==null?void 0:e.title}),v&&l.jsx(mn,{className:V("chevron-icon w-6 h-6 shrink-0",k&&"rotate-180")})]}),l.jsxs("div",{className:"ml-2 flex gap-2 items-center text-neutrals-800",children:[N&&l.jsx("span",{className:"filters-facet-item-counter border-none",children:C}),!N&&R&&l.jsx("span",{className:V("px-2 text-center","filters-facet-item-counter"),children:p?`${p}/${((L=e==null?void 0:e.dimensionValues)==null?void 0:L.length)||0}`:(i==null?void 0:i.all)||"All"}),N?null:l.jsxs("div",{className:"flex items-center gap-2 filters-facet-item-settings",children:[l.jsx(E.Dropdown,{triggerButton:l.jsx(E.IconButton,{buttonClassName:V("text-button-tertiary w-4 h-4 border-0 p-0","filters-facet-item-icon"),icon:l.jsx(qr,{width:16,height:16}),title:(i==null?void 0:i.displayOrder)||"Display Order",disabled:!(e!=null&&e.isHierarchical)}),options:Ci(i),selectedOption:e==null?void 0:e.displayMode,disabled:!(e!=null&&e.isHierarchical),onOptionSelect:j}),p>0&&l.jsx(E.IconButton,{buttonClassName:V("text-button-tertiary w-4 h-4 border-0 p-0","filters-facet-item-icon"),icon:l.jsx(Zr,{width:16,height:16}),title:(i==null?void 0:i.reset)||"Reset",onClick:S=>{S.stopPropagation(),o==null||o(e==null?void 0:e.id)}})]})]})]}),k&&l.jsx(Vo,{titles:i,selectedFilter:e,locale:r,isDisableValues:c,timeRangeOptions:a,selectFilterValue:g,selectHierarchicalNodes:w,expandHierarchicalValue:m,onTimePeriodChange:d,filterValuesProps:s,initialConstraints:u})]})},yi=({filtersList:e,hideFacetCounterByDefault:n,locale:t,onSelectFilter:o,onDeleteFilter:r,onSelectDisplayMode:i,filterValuesProps:u,isDisableValues:f,timeRangeOptions:s,initialConstraints:c,onTimePeriodChange:a,selectFilterValue:d,selectHierarchicalNodes:g,titles:w,expandHierarchicalValue:m})=>l.jsx("div",{className:V("overflow-y-auto advanced-view-filters-list min-w-[320px] pr-3 h-full sm:w-full"),children:e==null?void 0:e.map(v=>l.jsx(Ai,{titles:w,locale:t,filter:v,onSelectFilter:o,onSelectDisplayMode:i,onDeleteFilter:r,hideFacetCounterByDefault:n,isDisableValues:f,timeRangeOptions:s,selectFilterValue:d,selectHierarchicalNodes:g,expandHierarchicalValue:m,onTimePeriodChange:a,filterValuesProps:u,initialConstraints:c},v==null?void 0:v.id))}),Ti=({filtersList:e,titles:n,selectedFilter:t,modalProps:o,locale:r,isDisableValues:i,timeSeriesCount:u,timeRangeOptions:f,initialConstraints:s,setSelectedFilter:c,onSelectDisplayMode:a,onDeleteFilter:d,updateSelectedFilterValues:g,onTimePeriodChange:w,selectedTimeOption:m})=>{const v=E.useIsMobile(),p=h.useCallback(C=>{c({...e==null?void 0:e.find(j=>(j==null?void 0:j.id)===C),isSelectedFilter:!0})},[e,c]),b=(C,j)=>{var M;const R={...t,dimensionValues:(M=t==null?void 0:t.dimensionValues)==null?void 0:M.map(L=>(L==null?void 0:L.id)===C?{...L,isSelectedValue:j}:L)};c(R),g&&g(R)},k=C=>{var R;const j={...t,dimensionValues:(R=t==null?void 0:t.dimensionValues)==null?void 0:R.map(M=>(C==null?void 0:C.find(S=>(S==null?void 0:S.id)===(M==null?void 0:M.id)))||M)};c(j),g&&g(j)},x=C=>{var j;c({...t,dimensionValues:(j=t==null?void 0:t.dimensionValues)==null?void 0:j.map(R=>(R==null?void 0:R.id)===(C==null?void 0:C.id)?{...R,isExpanded:!(C!=null&&C.isExpanded)}:R)})},N=(C,j)=>{const R={...t,timeRange:C||void 0};w==null||w(j),c(R),g&&g(R)};return l.jsxs("div",{className:V("flex flex-row gap-5 flex-1 min-h-0 sm:p-0","filters-settings"),children:[l.jsxs("div",{className:V("h-full sm:w-full",(o==null?void 0:o.isShowTimeSeriesCount)&&"flex flex-col justify-between"),children:[l.jsx(yi,{filtersList:e,hideFacetCounterByDefault:o==null?void 0:o.isHideFacetCounterByDefault,locale:r,titles:n,onSelectFilter:p,onSelectDisplayMode:a,onDeleteFilter:d,isDisableValues:i,initialConstraints:s,timeRangeOptions:f,selectFilterValue:b,selectHierarchicalNodes:k,expandHierarchicalValue:x,onTimePeriodChange:N,filterValuesProps:o==null?void 0:o.filterValuesProps}),o!=null&&o.isShowTimeSeriesCount&&u?l.jsxs("h4",{className:"text-neutrals-800 my-4",children:[(n==null?void 0:n.timeSeries)??"Timeseries",": ",u]}):null]}),!v&&l.jsx(Vo,{selectedFilter:t,locale:r,titles:n,isDisableValues:i,timeRangeOptions:f,selectFilterValue:b,selectHierarchicalNodes:k,expandHierarchicalValue:x,onTimePeriodChange:N,filterValuesProps:o==null?void 0:o.filterValuesProps,initialConstraints:s,selectedTimeOption:m})]})},an=(e,n,t,o,r=q.Locale.EN)=>{const i=n==null?void 0:n.map(u=>{const f=A.findCodelistByDimension(t==null?void 0:t.codelists,t==null?void 0:t.conceptSchemes,u),s=A.getAvailableCodesFromConstrains(f==null?void 0:f.codes,u.id,o,r);return{...u,dimensionValues:s}});return(e==null?void 0:e.map(u=>{var c;const s=(((c=i==null?void 0:i.find(a=>a.id===u.id))==null?void 0:c.dimensionValues)||[]).map(a=>{var g,w;const d=(w=(g=u.dimensionValues)==null?void 0:g.find(m=>(m==null?void 0:m.id)===(a==null?void 0:a.id)))==null?void 0:w.isSelectedValue;return{...a,isSelectedValue:d}});return{...u,isDisabled:!1,dimensionValues:s}}))||[]},Ut=e=>{let n=[];return e.filter(t=>{var o;return t.timeRange||((o=t.dimensionValues)==null?void 0:o.some(r=>r.isSelectedValue))}).forEach(t=>{var i;const{id:o,dimensionValues:r}=t;t.isTimeDimension?n=[...n,...Mi(t.timeRange,o)]:n.push({componentCode:o,operator:A.SeriesFilterOperator.EQUALS,value:((i=r==null?void 0:r.filter(u=>u.isSelectedValue))==null?void 0:i.map(u=>u.id).join(A.GET_v3_FILTER_AND))||""})}),n},Mi=(e,n)=>e==null||e.startPeriod==null||e.endPeriod==null?[]:[{componentCode:n,operator:A.SeriesFilterOperator.GREATER_OR_EQUAL,value:$t(new Date(e.startPeriod))},{componentCode:n,operator:A.SeriesFilterOperator.LESS_OR_EQUAL,value:$t(new Date(e.endPeriod),1)}],Oi=1e3*60*60*24,$t=(e,n=0)=>{e.setHours(0),e.setMinutes(0),e.setSeconds(0),e.setMinutes(e.getMinutes()-e.getTimezoneOffset());let t=e.getTime();return t+=n?Oi-1:0,e=new Date(t),t.toString()},Li=e=>e.map(n=>{var t;return{componentCode:n.id||"",operator:q.QueryFilterType.IN,values:((t=n.dimensionValues)==null?void 0:t.map(o=>o.id))||[]}}),Ri=(e,n)=>{var i;const t=(i=n==null?void 0:n.timeDimensions)==null?void 0:i[0],o=A.getTimeRangeFromAttachment(e,t)||null;return o?A.getQueryTimePeriodFilters(o,t==null?void 0:t.id):null},_i=(e,n)=>{const t=_o(e),o=t.find(r=>(r==null?void 0:r.isTimeDimension)&&(r==null?void 0:r.timeRange));return{filterKey:A.getTimeSeriesFilterKey(n||[],Li(t)),timeFilter:A.getQueryTimePeriodFilters(o==null?void 0:o.timeRange,o==null?void 0:o.id)}},Ii=e=>e==null?void 0:e.filter(n=>{var t;return n.timeRange||((t=n.dimensionValues)==null?void 0:t.some(o=>o.isSelectedValue))}).map(n=>{var t,o,r,i;return n!=null&&n.isTimeDimension?{componentCode:n==null?void 0:n.id,operator:q.QueryFilterType.BETWEEN,values:[Jt(((t=n==null?void 0:n.timeRange)==null?void 0:t.startPeriod)||void 0)||"",Jt(((o=n==null?void 0:n.timeRange)==null?void 0:o.endPeriod)||void 0)||""]}:{componentCode:n==null?void 0:n.id,operator:q.QueryFilterType.IN,values:((i=(r=n==null?void 0:n.dimensionValues)==null?void 0:r.filter(u=>u.isSelectedValue))==null?void 0:i.map(u=>u.id))||[]}}),Jt=e=>{if(!e)return"";const n=String(e.getDate()).padStart(2,"0"),t=String(e.getMonth()+1).padStart(2,"0"),o=e.getFullYear();return`${t}-${n}-${o}`},Pi=({timeseriesLength:e=0,limitMessages:n})=>{var o,r;const t=!e||E.SERIES_LIMIT>e;return l.jsx("div",{className:"body-3 text-neutrals-800 sm:text-center flex gap-x-[4px] sm:justify-center items-center",children:t?l.jsx("span",{children:(o=n==null?void 0:n.seriesCount)==null?void 0:o.call(n,e)}):l.jsxs(l.Fragment,{children:[l.jsx("span",{children:n==null?void 0:n.warningIcon}),l.jsx("span",{children:(r=n==null?void 0:n.counterLimit)==null?void 0:r.call(n,e,E.SERIES_LIMIT)})]})})},Vi=({modalProps:e,onApply:n,onClearAllFilters:t,onClose:o,titles:r,applyDisabled:i,timeseriesLength:u,limitMessages:f})=>{const s=E.useIsMobile();return l.jsxs("div",{className:V("flex py-4 px-6","modal-footer-wrapper",e!=null&&e.isShowCancelButton?"justify-between":"gap-x-8 flex-row-reverse items-center justify-between sm:flex-col sm:gap-y-4 items-center"),children:[!(e!=null&&e.isShowCancelButton)&&l.jsx(Pi,{timeseriesLength:u,limitMessages:f}),l.jsxs("div",{className:V("flex",e!=null&&e.isShowCancelButton?"justify-between":"gap-x-8 flex-row-reverse justify-end sm:flex-col-reverse sm:gap-y-4 items-center"),children:[l.jsx(E.Button,{iconBefore:s?e==null?void 0:e.resetIcon:void 0,buttonClassName:"text-button-tertiary p-0",title:e!=null&&e.isShowClearIcon?(r==null?void 0:r.clearAllFilters)??"Clear All Filters":(r==null?void 0:r.clearAll)??"Clear All",onClick:()=>t(),isSmallButton:s}),l.jsxs("div",{className:"flex items-center gap-x-3",children:[e!=null&&e.isShowCancelButton?l.jsx(E.Button,{buttonClassName:"text-button-tertiary sm:h8",title:(r==null?void 0:r.cancel)??"Cancel",onClick:o,isSmallButton:s}):null,l.jsx(E.Button,{buttonClassName:"advanced-view-filters-modal-apply-button",title:(r==null?void 0:r.apply)??"Apply",onClick:n,isSmallButton:s,disabled:i})]})]})]})},Fi=e=>ee.createElement("svg",{viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",...e},ee.createElement("path",{d:"M3.33333 13.3327V8.66602H2V7.33268H6V8.66602H4.66667V13.3327H3.33333ZM3.33333 5.99935V2.66602H4.66667V5.99935H3.33333ZM6 5.99935V4.66602H7.33333V2.66602H8.66667V4.66602H10V5.99935H6ZM7.33333 13.3327V7.33268H8.66667V13.3327H7.33333ZM11.3333 13.3327V11.3327H10V9.99935H14V11.3327H12.6667V13.3327H11.3333ZM11.3333 8.66602V2.66602H12.6667V8.66602H11.3333Z",fill:"currentColor"}));var oe=(e=>(e.DATA_GRID="dataGrid",e.METADATA_PER_SERIES="metadataPerSeries",e.CHARTS="charts",e.CHARTS_NAVIGATION="chartsNavigation",e.OPEN_ADVANCED_VIEW="openAdvancedView",e.FILTERS="filters",e.CHART_PER_SERIES="chartPerSeries",e.METADATA_PER_DATASET="metadataPerDataset",e.EXIT_ADVANCED_VIEW="exitAdvancedView",e))(oe||{});const pn=["charts","chartsNavigation"],Yt=["dataGrid","metadataPerSeries",...pn,"openAdvancedView"],Fo=["filters","chartPerSeries","metadataPerDataset","exitAdvancedView"],Oe=(e,n)=>({title:(n==null?void 0:n[`${e}Title`])||"",description:(n==null?void 0:n[`${e}Description`])||""}),hn=(e,n)=>e.find(t=>{var o;return!((o=n.infoElements)!=null&&o[t])})||"",Bi=(e,n)=>{if(!e||!n)return"";if(Yt.includes(n)){const o=hn(Yt,e);if(o)return o}const t=hn(Fo,e);return t||""},Bo=(e,n)=>{const t=hn(e,n);return{...n,infoElements:{...n==null?void 0:n.infoElements,[n.lastDisplayedElement]:!1,...t?{[t]:!0}:{}},lastDisplayedElement:t}},Ho=e=>Bo(Fo,e),Hi=e=>Bo(pn,e),Gi=e=>{var n,t;return(!((n=e==null?void 0:e.infoElements)!=null&&n.charts)||!((t=e==null?void 0:e.infoElements)!=null&&t.chartsNavigation))&&!pn.includes(e.lastDisplayedElement)},Ee=5,zi=({targetPosition:e,overlayClasses:n,onClose:t})=>l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"overlay overlay-top",style:{height:e.top,top:0-Ee,bottom:e.top+Ee}}),l.jsx("div",{className:"overlay overlay-bottom",style:{top:e.bottom+Ee,bottom:0}}),l.jsx("div",{className:"overlay overlay-left",style:{top:e.top-Ee,height:e.height+Ee*2,width:e.left,left:0-Ee,right:e.left-Ee*2}}),l.jsx("div",{className:"overlay overlay-right",style:{top:e.top-Ee,left:e.right+Ee,height:e.height+Ee*2,right:0}}),l.jsx("div",{className:V("outline-block z-10",n),onClick:t,style:{top:e.top,left:e.left,height:e.height,width:e.width}})]}),Le=({reference:e,title:n,description:t,onReferenceClick:o,shouldCloseTooltip:r,shouldMoveToNextStep:i,supressReferenceClick:u})=>{var L;const[f,s]=h.useState(!0),[c,a]=h.useState(!1),d=h.useRef(null),{isShowOnboarding:g,onboardingFileSchema:w,setOnboardingFileSchema:m}=we(),{refs:v,floatingStyles:p,context:b,placement:k}=pe.useFloating({open:f,onOpenChange:s,placement:"right-start",elements:{reference:e==null?void 0:e.current},middleware:[pe.offset({mainAxis:12,crossAxis:-4}),pe.flip(),pe.shift(),pe.arrow({element:d})],whileElementsMounted:pe.autoUpdate}),x=pe.useClick(b),{getFloatingProps:N}=pe.useInteractions([x]),C=h.useCallback(()=>{if(g){const S=Bi(w,w==null?void 0:w.lastDisplayedElement);m==null||m({...w,infoElements:{...w==null?void 0:w.infoElements,...S?{[S]:!0}:{}},lastDisplayedElement:S})}s==null||s(!1)},[g,w,m]);h.useEffect(()=>{v.setReference((e==null?void 0:e.current)??null)},[e,v]);const j=()=>C(),R=(L=e==null?void 0:e.current)==null?void 0:L.getBoundingClientRect();h.useEffect(()=>{r&&!c&&(C(),a(!0))},[r,C,c]);const M=()=>{var S;o?(o==null||o(),i?C():s(!1)):u||(C(),(S=e==null?void 0:e.current)==null||S.click())};return l.jsx(l.Fragment,{children:f&&l.jsxs(pe.FloatingPortal,{children:[R&&l.jsx(zi,{overlayClasses:u?"cursor-default":"cursor-pointer",targetPosition:R,onClose:M}),l.jsxs("div",{ref:v.setFloating,style:p,...N(),className:"tooltip z-tooltip max-w-[350px]",children:[l.jsxs("div",{className:"tooltip-header",children:[l.jsx("h3",{children:n}),l.jsx(E.CloseButton,{btnClassNames:"w-4 h-4",onClick:j})]}),l.jsx("div",{className:"tooltip-description",children:l.jsx("p",{children:t})}),l.jsx("div",{ref:d,className:V("tooltip-arrow absolute w-3 h-3 rotate-45",k!=null&&k.includes("right")?"left-[-4px]":"right-[-6px]",k!=null&&k.includes("end")?"bottom-2 tooltip-arrow-white":"top-3")})]})]})})},Wi=({buttonProps:e,selectedFiltersCount:n=0,isLoading:t,setModalState:o,titles:r,isModalClosed:i,warningIcon:u,filterIconClassName:f,timeSeriesCount:s})=>{const c=h.useRef(null),[a,d]=h.useState(""),[g,w]=h.useState(""),[m,v]=h.useState(!1),{onboardingFileSchema:p,isShowOnboarding:b}=we(),k=E.SERIES_LIMIT<(s??0),x=h.useMemo(()=>e!=null&&e.isShowBadge?e==null?void 0:e.title:`${e==null?void 0:e.title}: ${n}`,[e==null?void 0:e.isShowBadge,e==null?void 0:e.title,n]);return h.useEffect(()=>{if(b){const{title:N,description:C}=Oe(oe.FILTERS,r);d(N),w(C)}},[r,b]),h.useEffect(()=>{b&&v((p==null?void 0:p.lastDisplayedElement)===oe.FILTERS)},[p==null?void 0:p.lastDisplayedElement,b]),l.jsx("div",{className:"relative filter-button-container",ref:c,children:t?l.jsx(E.Loader,{}):l.jsxs(l.Fragment,{children:[l.jsx(E.Button,{iconBefore:l.jsx(Fi,{className:V("size-4",f)}),iconAfter:k?u:void 0,title:x,buttonClassName:"text-button-secondary filter-button",isSmallButton:!0,onClick:()=>o(E.PopUpState.Opened)}),(e==null?void 0:e.isShowBadge)&&l.jsx("div",{className:"filter-count-badge",children:l.jsx("h5",{children:n})}),m&&l.jsx(Le,{reference:c,title:a,description:g,onReferenceClick:()=>o(E.PopUpState.Opened),shouldCloseTooltip:i})]})})},Kt=e=>{var t;const n=[];return(t=e.custom_content)!=null&&t.attachments&&n.push(...e.custom_content.attachments),n};function xn(e){var n;return e.type===ne.AttachmentType.MARKDOWN&&e.title!=null&&((n=e.title)==null?void 0:n.startsWith("URL Query"))}function Go(e){var n;return e.type===ne.AttachmentType.JSON&&e.title!=null&&((n=e.title)==null?void 0:n.startsWith("Query (JSON)"))}function zo(e){return e.type===ne.AttachmentType.MARKDOWN&&!xn(e)}function Ui(e){return e.type===ne.AttachmentType.CSV}function fn(e){return e.type===ne.AttachmentType.TABLE}function ze(e){return e.type===ne.AttachmentType.CUSTOM_DATA_GRID}function Ye(e){return e.type===ne.AttachmentType.CUSTOM_CHART}function $i(e){return e.type===ne.AttachmentType.PLOTLY}const Ji=(e,n)=>{var t;return(t=e==null?void 0:e.filter((o,r)=>{var i;return((i=o==null?void 0:o.custom_content)==null?void 0:i.attachments)&&r<n}))==null?void 0:t.at(-1)},Yi=e=>e==null?void 0:e.reduce((n,t,o)=>{var r,i;return(i=(r=t==null?void 0:t.custom_content)==null?void 0:r.attachments)!=null&&i.some(u=>Go(u))?o:n},-1),Ki=e=>e==null?void 0:e.reduce((n,t)=>(t==null?void 0:t.role)===se.Role.Assistant?t:n,{}),Zi=(e,n,t,o)=>{var r;return{role:se.Role.System,content:"",custom_content:{attachments:(t==null?void 0:t.map(i=>({type:ne.AttachmentType.JSON,title:i==null?void 0:i.title,data:JSON.stringify({urn:i==null?void 0:i.urn,metadata:i==null?void 0:i.metadata,filters:(n==null?void 0:n.urn)===(i==null?void 0:i.urn)?e:i==null?void 0:i.filters})})))||[],form_schema:(r=o==null?void 0:o.custom_content)==null?void 0:r.form_schema}}},qi=(e,n,t,o)=>{if(!e)return[];const r=e==null?void 0:e.at(-1);return r&&r.role===se.Role.System&&(e==null||e.pop()),[...e,Zi(n,t,o,Ki(e))]},Xi=(e,n,t)=>(t==null?void 0:t.map(o=>({...o,filters:(n==null?void 0:n.urn)===(o==null?void 0:o.urn)?e:o==null?void 0:o.filters})))||[],Qi=({actions:e,dimensions:n,structureDimensions:t,structures:o,buttonProps:r,modalProps:i,attachmentsDataQuery:u,dataQueries:f,initialConstraints:s,onFiltersChange:c,locale:a,timeRangeOptions:d,titles:g,conversationKey:w,conversation:m,setConversation:v,updateConversation:p,updateDataQueries:b,limitMessages:k,filterIconClassName:x})=>{var Se,Ne;const[N,C]=h.useState(E.PopUpState.Closed),[j,R]=h.useState([]),[M,L]=h.useState([]),[S,D]=h.useState(),[O,B]=h.useState([]),[W,F]=h.useState(void 0),_=h.useRef(s||[]),[G,H]=h.useState([]),[U,Y]=h.useState(),[J,K]=h.useState(),re=h.useRef(!1),[ce,ae]=h.useState(!1),de=P=>{const y=P?j.map(T=>T.id===P.id?P:T):j;K(!0),R(Gt(y)),Y==null||Y(!0),le(P!=null&&P.isTimeDimension?Ht(y,P):y,R,Y)};h.useEffect(()=>{N===E.PopUpState.Closed&&H(_.current)},[N]);const le=h.useCallback((P,y,T)=>{e==null||e.getConstraints(u==null?void 0:u.urn,Ut(P).filter(I=>I.componentCode!==A.TIME_PERIOD)).then(I=>{var $;const z=(($=I==null?void 0:I.data)==null?void 0:$.dataConstraints)||[];_.current=z,T==null||T(!1),y(an(P,n,o,z,a))}).catch(()=>{_.current=[],T==null||T(!1),y(an(P,n,o,[],a))}).finally(()=>{K(!1)})},[e,u==null?void 0:u.urn,n,a,o]);h.useEffect(()=>{const P=di(n,o,t,a),y=n==null?void 0:n.map(I=>{const z=A.findCodelistByDimension(o==null?void 0:o.codelists,o==null?void 0:o.conceptSchemes,I),$=A.getAvailableCodesFromConstrains(z==null?void 0:z.codes,I.id,_.current,a);return{...I,dimensionValues:$}}),T=P.map(I=>{var $;const z=(($=y==null?void 0:y.find(X=>X.id===I.id))==null?void 0:$.dimensionValues)||[];return{...I,dimensionValues:z}});if(!re.current){const I=mi(T,u,_.current);Y==null||Y(!0),le(I,L,Y),re.current=!0}},[n,t,o,u,a,s,le]),h.useEffect(()=>{M!=null&&M.length&&B(_o(M))},[M]),h.useEffect(()=>{R(P=>Ht(P,S))},[S]),h.useEffect(()=>{N===E.PopUpState.Opened&&(D({...M==null?void 0:M[0],isSelectedFilter:!0}),R(M)),N===E.PopUpState.Closed&&D(void 0)},[M,N]);const ue=h.useCallback(async P=>{const y=Ii(P),T=m?{...m,messages:qi(m==null?void 0:m.messages,y,u,f)}:null;v==null||v(T),b==null||b(Xi(y,u,f)),await p(decodeURI(w),{name:T==null?void 0:T.name,messages:(T==null?void 0:T.messages)||[]})},[u,m,w,f,v,p,b]),xe=h.useCallback((P,y)=>{R(T=>hi(T,P,y)),(S==null?void 0:S.id)===P&&D(T=>({...T,displayMode:y}))},[S==null?void 0:S.id]),be=h.useCallback(P=>_i(P,n),[n]),he=h.useCallback((P,y)=>{const T=an(y,n,o,P,a);_.current=P,D(I=>(T==null?void 0:T.find(z=>(z==null?void 0:z.id)===(I==null?void 0:I.id)))||I),R(T),K(!1)},[n,a,o]),ie=h.useCallback(P=>{K(!0),R(Gt(P)),e==null||e.getConstraints((u==null?void 0:u.urn)||"",Ut(P).filter(y=>y.componentCode!==A.TIME_PERIOD)).then(y=>{var T;he(((T=y==null?void 0:y.data)==null?void 0:T.dataConstraints)||[],P)}).catch(()=>{he([],P)})},[e,u==null?void 0:u.urn,he]),Ae=h.useCallback(P=>{const y=gi(j,P);ie(y)},[ie,j]),Ce=h.useCallback(()=>{_.current=G,C(E.PopUpState.Closed),ae(!0)},[G]),ye=h.useCallback(()=>{const P=wi(j);ie(P)},[ie,j]),ve=h.useCallback(()=>{const P=be(j);c==null||c(P,_.current,j),L(j),C(E.PopUpState.Closed),ae(!0),h.startTransition(()=>{ue(j)})},[be,j,c,ue,_]),ke=P=>{F(P)},me=Number(A.getTimeSeriesCount((Ne=(Se=_==null?void 0:_.current)==null?void 0:Se[0])==null?void 0:Ne.annotations));return l.jsxs("div",{className:"filters-container",children:[l.jsx(Wi,{buttonProps:r,selectedFiltersCount:fi(O),isLoading:U,setModalState:C,titles:g,isModalClosed:ce,warningIcon:k==null?void 0:k.warningIcon,filterIconClassName:x,timeSeriesCount:me}),l.jsx(l.Fragment,{children:N===E.PopUpState.Opened&&l.jsxs(E.Popup,{heading:(g==null?void 0:g.settings)||"Settings",portalId:"filters",size:E.PopUpSize.LG,containerClassName:"advanced-view-filters-modal h-[80%]",dividers:i==null?void 0:i.isShowDividers,onClose:Ce,closeButtonTitle:(g==null?void 0:g.close)||"Close",children:[l.jsx(Ti,{locale:a,titles:g,timeRangeOptions:d,filtersList:j,selectedFilter:S,isDisableValues:J,modalProps:i,initialConstraints:s,timeSeriesCount:`${me}`,setSelectedFilter:D,onSelectDisplayMode:xe,onDeleteFilter:Ae,updateSelectedFilterValues:de,onTimePeriodChange:ke,selectedTimeOption:W}),l.jsx(Vi,{titles:g,onApply:ve,onClose:Ce,onClearAllFilters:ye,modalProps:i,applyDisabled:U||J,timeseriesLength:me,limitMessages:k})]})})]})},el=({downloadTitles:e,attachment:n,actions:t,className:o=""})=>{const r=n.url,[i,u]=h.useState(null);async function f(s){if(s==null)return;const c=await t.getFile(s);u(c)}return l.jsxs("div",{className:`border rounded-lg p-3 bg-white transition-colors ${o}`,children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("div",{className:"flex-1 min-w-0",children:l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("span",{className:"body-2 text-neutrals-800 truncate",title:n.title,children:n.title})})}),r&&l.jsx("div",{className:"flex-shrink-0",children:l.jsx(E.Button,{title:e??"Download",onClick:()=>f(n.url),buttonClassName:"text-button-tertiary"})})]}),i&&l.jsx("div",{className:"mt-3",children:l.jsx("pre",{className:"bg-white p-3 rounded-md overflow-x-auto",children:l.jsx("code",{children:JSON.stringify(i,null,2)})})})]})},Wo="json";function nl(e){return ol(e)?tl(e==null?void 0:e.slice(Wo.length)):e}function tl(e){let n="";if(e)try{n=JSON.stringify(JSON.parse(e),null,2)}catch{n=e.toString()}return n}function ol(e){return(e==null?void 0:e.startsWith(Wo))||!1}const rl=({attachment:e,className:n=""})=>{const t=nl(e.data);return t?l.jsxs("div",{className:`attachment-json border rounded-lg bg-white ${n}`,children:[l.jsx("div",{className:"flex items-center justify-between px-3 py-2 border-b border-neutrals-200 bg-neutrals-100 rounded-t-lg",children:l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("h3",{className:"text-neutrals-900",children:e.title})})}),l.jsx("div",{className:"p-3",children:l.jsx("pre",{className:"text-neutrals-800 overflow-x-auto whitespace-pre-wrap break-words max-h-96 overflow-y-auto",children:l.jsx("code",{children:t})})})]}):null},il=e=>{try{const n=new URL(e);return["http:","https:","data:"].includes(n.protocol)}catch{return!1}},ll=e=>il(e)?e:"",sl=e=>ee.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},ee.createElement("path",{d:"M11.3333 4.66667H8.66659V6.00001H11.3333C12.4333 6.00001 13.3333 6.9 13.3333 8C13.3333 9.1 12.4333 10 11.3333 10H8.66659V11.3333H11.3333C13.1733 11.3333 14.6666 9.84 14.6666 8C14.6666 6.16 13.1733 4.66667 11.3333 4.66667ZM7.33325 10H4.66659C3.56659 10 2.66659 9.1 2.66659 8C2.66659 6.9 3.56659 6.00001 4.66659 6.00001H7.33325V4.66667H4.66659C2.82659 4.66667 1.33325 6.16 1.33325 8C1.33325 9.84 2.82659 11.3333 4.66659 11.3333H7.33325V10ZM5.33325 7.33334H10.6666V8.66667H5.33325V7.33334Z",fill:"currentColor"})),al=({attachment:e,openLinkTitle:n,className:t=""})=>{const o=ll(e.data||"");if(!o)return null;const r=i=>{const u=window.open(i,"_blank");u==null||u.focus()};return l.jsx("div",{className:`border rounded-lg bg-white pl-4 py-3 pr-3 max-w-[500px] ${t}`,children:l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx("span",{className:"text-hues-800 flex-shrink-0 mt-1",role:"img","aria-label":"Link",children:l.jsx(sl,{width:16,height:16})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"mb-1",children:l.jsx(E.Link,{url:o,title:e.title})}),l.jsx("div",{className:"text-neutrals-600 break-all truncate",children:o})]}),l.jsx("div",{className:"flex-shrink-0",children:l.jsx(E.Button,{title:n??"Open link",onClick:()=>r(o),buttonClassName:"text-button-tertiary"})})]})})},Uo=e=>ee.createElement("svg",{viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",...e},ee.createElement("path",{d:"M2.33325 12.3267L6.33325 8.32001L8.99992 10.9867L14.6666 4.61334L13.7266 3.67334L8.99992 8.98667L6.33325 6.32001L1.33325 11.3267L2.33325 12.3267Z",fill:"currentColor"})),cl=e=>ee.createElement("svg",{viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",...e},ee.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.50644 4.00043L1.97857 7.52207L1.5 7.99979L1.97857 8.47751L5.50644 11.9991L6.46019 11.0437L3.41088 7.99979L6.46019 4.95587L5.50644 4.00043ZM10.4918 4.00043L14.0197 7.52207L14.4983 7.99979L14.0197 8.47751L10.4918 11.9991L9.53809 11.0437L12.5874 7.99979L9.53809 4.95587L10.4918 4.00043Z",fill:"currentColor"})),ul=e=>ee.createElement("svg",{viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",...e},ee.createElement("path",{d:"M2.3999 4V12H13.5999V4H2.3999ZM5.7359 10.8H3.5999V5.2H5.7359V10.8ZM9.0639 10.8H6.9359V5.2H9.0719V10.8H9.0639ZM12.3999 10.8H10.2639V5.2H12.3999V10.8Z",fill:"currentColor"})),dl=e=>ee.createElement("svg",{viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",...e},ee.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.18519 10.4815H7.18116C7.31033 10.9089 7.50501 11.3078 7.7535 11.6667H2.18519C1.53333 11.6667 1 11.1333 1 10.4815V2.18519C1 1.53333 1.53333 1 2.18519 1H10.4815C11.1333 1 11.6667 1.53333 11.6667 2.18519V5.02017C11.5296 5.00683 11.3906 5 11.25 5C10.9876 5 10.7307 5.02378 10.4815 5.06931V2.18519H2.18519V10.4815ZM7.69316 6.92288C7.99945 6.45568 8.39531 6.05248 8.85633 5.73769H3.37044V6.92288H7.69316ZM7 9.25C7 8.8544 7.05405 8.47143 7.15517 8.10807H3.37044V9.29326H7.00022L7 9.25ZM3.37044 4.5525H9.29636V3.36731H3.37044V4.5525ZM11.6624 10.9695C12.5981 10.8087 13.2264 9.91979 13.0656 8.98403C12.9049 8.04827 12.016 7.42002 11.0802 7.58078C10.1444 7.74155 9.51618 8.63046 9.67695 9.56621C9.83771 10.502 10.7266 11.1302 11.6624 10.9695ZM11.8656 12.1521C11.9243 12.142 11.9824 12.1303 12.0396 12.1168L14.5611 15.5477L15.5281 14.8371L13.1449 11.5944C13.9785 10.9558 14.4384 9.88763 14.2483 8.78085C13.9753 7.19192 12.4659 6.12513 10.877 6.39811C9.28808 6.67109 8.22129 8.18047 8.49428 9.7694C8.76726 11.3583 10.2766 12.4251 11.8656 12.1521Z",fill:"currentColor"})),hl=({attachment:e,index:n,selectedAttachmentIndex:t,onSelectedAttachmentChange:o,showTabIcon:r,dataGridTitle:i,titles:u})=>{const f=h.useRef(null),[s,c]=h.useState(""),[a,d]=h.useState(""),[g,w]=h.useState(!1),{onboardingFileSchema:m,isShowOnboarding:v}=we(),p=h.useCallback((k,x="")=>r?$i(k)||Ye(k)?l.jsx(Uo,{className:x}):ze(k)?l.jsx(ul,{className:x}):xn(k)?l.jsx(dl,{className:x}):zo(k)?l.jsx(cl,{className:x}):null:null,[r]),b=h.useCallback(k=>ze(k)?i||"Data Grid":k.title,[i]);return h.useEffect(()=>{if(v&&Ye(e)){const{title:k,description:x}=Oe(oe.CHARTS,u);c(k),d(x)}},[e,u,v]),h.useEffect(()=>{var k;if(Ye(e)&&v){const x=(m==null?void 0:m.lastDisplayedElement)===oe.CHARTS;w(x),x&&((k=f==null?void 0:f.current)==null||k.scrollIntoView({block:"end",behavior:"smooth"}))}},[m==null?void 0:m.lastDisplayedElement,e,v]),l.jsxs("div",{ref:f,className:V("cursor-pointer min-w-30","flex items-center gap-1","attachment-tab",t===n?"attachment-tab-active text-primary":""),onClick:()=>o(n),children:[p(e,"w-4 h-4"),l.jsx("h4",{className:"truncate max-w-[130px]",title:b(e),children:b(e)}),g&&l.jsx(Le,{reference:f,title:s,description:a})]},e.index||n)},fl=({attachments:e,...n})=>l.jsx("div",{className:"flex items-center w-full flex-wrap attachments-tabs",children:e.map((t,o)=>l.jsx(hl,{attachment:t,index:o,...n},o))}),gl=({setToTitle:e,datasetName:n,datasetIcon:t,isShowDatasetDetails:o,queryFilterDetails:r})=>l.jsxs("div",{children:[n&&o&&l.jsxs("p",{className:"caption mt-4 inline-flex items-center attachment-dataset-name",children:[l.jsx("span",{className:"mr-1 attachment-dataset-icon",children:t}),n]}),r==null?void 0:r.map(i=>{var u;return l.jsxs("p",{className:"body-1 mb-2 last:mb-0",children:[i==null?void 0:i.title,l.jsx("span",{children:e??" set to "}),l.jsx("span",{className:"font-bold",children:(u=i==null?void 0:i.valuesTitles)==null?void 0:u.join(", ")})]},i==null?void 0:i.title)})]}),wl=({titles:e,attachmentInfoList:n,datasetIcon:t})=>l.jsxs("div",{className:"attachment-details flex flex-col",children:[l.jsx("p",{className:V("body-1",n&&n.length<=1&&"mb-2"),children:(e==null?void 0:e.queryUpdatedManuallyTitle)??"Query has been updated manually."}),n==null?void 0:n.map(o=>{var r;return!!((r=o==null?void 0:o.queryFiltersDetails)!=null&&r.length)&&l.jsx(gl,{setToTitle:e==null?void 0:e.setToTitle,datasetName:o==null?void 0:o.datasetName,datasetIcon:t,isShowDatasetDetails:(n==null?void 0:n.length)>1,queryFilterDetails:o==null?void 0:o.queryFiltersDetails},o==null?void 0:o.datasetName)})]}),$o=({dimensionsInfo:e})=>l.jsx("div",{className:"sidebar flex flex-col w-[176px] gap-3 min-h-0 overflow-auto",children:e.map(n=>l.jsxs("div",{className:"flex flex-col",children:[l.jsx("h5",{className:"text-neutrals-800",children:n.title}),l.jsx("h5",{className:"font-bold",children:n.value})]},n.title))}),ml=({titles:e,chart:n,isOpen:t,onClose:o})=>{const[r,i]=h.useState(E.PopUpState.Closed);h.useEffect(()=>{i(t?E.PopUpState.Opened:E.PopUpState.Closed)},[t]);const u=h.useCallback(()=>{i(E.PopUpState.Closed),o==null||o()},[o]);return l.jsx(l.Fragment,{children:r===E.PopUpState.Opened&&l.jsxs(E.Popup,{heading:l.jsx("h1",{className:"single-chart-popup-heading",children:(e==null?void 0:e.chart)??"Chart"}),containerClassName:"single-chart-popup h-[80%]",portalId:"single-chart",size:E.PopUpSize.LG,dividers:!1,onClose:u,closeButtonTitle:(e==null?void 0:e.close)??"Close",children:[l.jsxs("div",{className:"single-chart-popup-content flex flex-row flex-1 gap-4 min-h-0 h-full",children:[l.jsx("div",{className:"flex flex-col flex-1 min-h-0",children:l.jsx(so,{option:n.config,className:"w-full h-full",style:{width:"100%",height:"100%"}})}),l.jsx($o,{dimensionsInfo:n.dimensions})]}),l.jsx("div",{})]})})},Jo=e=>{var p;const[n,t]=h.useState(!1),o=h.useRef(null),[r,i]=h.useState(""),[u,f]=h.useState(""),[s,c]=h.useState(!1),{onboardingFileSchema:a,isShowOnboarding:d}=we(),[g,w]=h.useState(!1),m=h.useCallback(()=>{t(!0)},[]),v=h.useCallback(()=>{t(!1),w(!0)},[]);return h.useEffect(()=>{if(d){const{title:b,description:k}=Oe(oe.CHART_PER_SERIES,e.titles);i(b),f(k)}},[e.titles,d]),h.useEffect(()=>{d&&c((a==null?void 0:a.lastDisplayedElement)===oe.CHART_PER_SERIES&&e.node.rowIndex===0)},[a==null?void 0:a.lastDisplayedElement,e.node.rowIndex,d]),l.jsxs(l.Fragment,{children:[l.jsx("div",{ref:o,children:l.jsx(E.IconButton,{title:((p=e.titles)==null?void 0:p.chart)??"Chart",buttonClassName:"!text-neutrals-1000 !border-none !p-1",icon:l.jsx(Uo,{className:"w-5 h-5"}),onClick:m})}),s&&l.jsx(Le,{reference:o,title:r,description:u,onReferenceClick:m,shouldCloseTooltip:g}),n&&l.jsx(ml,{chart:e.value,isOpen:n,onClose:v,titles:e.titles})]})},tn=32,vn=32,pl=16,bn="padding-0",on=200,gn={flex:1,minWidth:on},xl=tn,Yo="observationValueCell",Ko="metadataCell",vl="chartCell",Qe="Chart_column",bl=(e,n,t,o,r,i)=>({headerName:"",suppressHeaderMenuButton:!0,suppressNavigable:!0,sortable:!1,editable:!1,pinned:!0,width:32,maxWidth:32,cellClass:bn,cellRenderer:Ko,cellRendererParams:{attributesData:n,dataSetData:e,locale:t,metadataSettings:o,titles:r,action:i}});function Cl(e,n,t,o=xl,r,i){return{headerName:"",field:Qe,colId:Qe,suppressHeaderMenuButton:!0,suppressNavigable:!0,sortable:!1,editable:!1,pinned:"right",width:o,maxWidth:o,minWidth:o,cellClass:bn,suppressColumnsToolPanel:!0,cellRenderer:Jo,cellRendererParams:{attributesData:n,dataSetData:e,locale:t,titles:r,action:i}}}const wn=["index","value"],kl=e=>({columns:jl(e),data:Sl(e)}),Sl=e=>{const n=e.metadata.time_column,t={};for(const o of e.data.data){const{value:r,...i}=o,u=Nl(o,n);t[u]={...t[u]||{},...i,[o[n]]:r}}return Object.values(t)},Nl=(e,n)=>Object.keys(e).filter(t=>!wn.includes(t)&&t!==n).map(t=>e[t]).join("."),jl=e=>{const{metadata:n,data:t}=e,o=n.time_column,r=n.pinned_columns||[],i=t.schema.fields,u=[],f=t.data.map(g=>g[o]),c=Array.from(new Set(f)).filter(g=>g!=null).map(g=>({field:g,colId:g,headerName:g,cellClass:"text-right",width:on})),a=r.map(g=>i.find(w=>w.name===g)).filter(g=>g!=null),d=i.filter(g=>!r.includes(g.name)).filter(g=>g!=null);if(a.length>0)for(const g of[...a])g.name===o||wn.includes(g.name)||u.push({colId:g.name,field:g.name,headerName:g.name,pinned:"left",...gn,tooltipValueGetter:w=>w.value});for(const g of[...d])g.name===o||wn.includes(g.name)||u.push({colId:g.name,field:g.name,headerName:g.name,pinned:!1,...gn,tooltipValueGetter:w=>w.value});return u.push(...c),u},Zo=e=>e*vn+tn+pl,El=({attachment:e,actions:n,className:t="",showLimitMessage:o})=>{const[r,i]=h.useState(!1),[u,f]=h.useState([]),[s,c]=h.useState(),[a,d]=h.useState(400);h.useEffect(()=>{e.url!=null&&(i(!0),n.getFile(e.url).then(w=>{if(w==null){f([]),c([]),i(!1);return}const{columns:m,data:v}=kl(w);f(v),c(m),i(!1)}))},[e.url,n]),h.useEffect(()=>{u?(d(Zo(u.length)),o==null||o(u.length>=E.SERIES_LIMIT)):o==null||o(!1)},[u,o]);const g=h.useMemo(()=>l.jsx(ao.AgGridReact,{headerHeight:tn,rowHeight:vn,rowData:u,columnDefs:s,enableCellTextSelection:!0,domLayout:"normal",tooltipShowDelay:0,tooltipShowMode:"whenTruncated",autoSizeStrategy:{type:s&&(s==null?void 0:s.length)>5?"fitCellContents":"fitGridWidth"}}),[u,s]);return r?l.jsx(E.Loader,{}):l.jsx("div",{className:`w-full ${t}`,children:l.jsx("div",{className:"ag-theme-quartz w-full min-h-[80px] max-h-[400px]",style:{height:a},children:g})})},Dl=({icon:e,title:n})=>l.jsx("div",{className:V("px-3 py-4 rounded border mt-3","attachment-collapsed"),children:l.jsxs("p",{className:V("flex body-3 items-center"),children:[e,l.jsxs("span",{className:"ml-2",children:[" ",n]})]})}),qo=e=>ee.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},ee.createElement("path",{d:"M7.4665 6.39967H8.53317V5.33301H7.4665V6.39967ZM7.4665 10.6663H8.53317V7.46634H7.4665V10.6663ZM7.9945 13.333C5.0505 13.333 2.6665 10.9437 2.6665 7.99967C2.6665 5.05567 5.0505 2.66634 7.9945 2.66634C10.9438 2.66634 13.3332 5.05567 13.3332 7.99967C13.3332 10.9437 10.9438 13.333 7.9945 13.333ZM7.99984 3.73301C5.6425 3.73301 3.73317 5.64234 3.73317 7.99967C3.73317 10.357 5.6425 12.2663 7.99984 12.2663C10.3572 12.2663 12.2665 10.357 12.2665 7.99967C12.2665 5.64234 10.3572 3.73301 7.99984 3.73301Z",fill:"currentColor"})),Al=({title:e,value:n})=>{const t=h.useCallback(()=>Array.isArray(n)?n.join(", "):n,[n]);return l.jsxs("div",{className:"flex gap-x-3 body-3",children:[l.jsxs("p",{title:e,className:"text-neutrals-800",children:[e,":"]}),l.jsx("p",{title:t(),className:"font-semibold truncate pr-3",children:t()})]})},yl=({title:e,value:n,attachedKeysTitles:t,locale:o})=>{const[r,i]=h.useState(!1),[u,f]=h.useState(!1),s=h.useRef(null),c=h.useCallback(()=>{u&&i(d=>!d)},[i,u]),a=h.useCallback(()=>{var d;return Array.isArray(n)?(d=n==null?void 0:n.map(g=>typeof g=="object"?g==null?void 0:g[o]:g))==null?void 0:d.join(", "):n},[o,n]);return h.useEffect(()=>{var d,g;s!=null&&s.current&&f(((d=s==null?void 0:s.current)==null?void 0:d.scrollHeight)>((g=s==null?void 0:s.current)==null?void 0:g.offsetHeight))},[s]),l.jsxs("div",{className:"metadata-item",children:[t==null?void 0:t.map(d=>l.jsx("div",{title:d,className:"metadata-item-key pr-3 mb-1 text-neutrals-800",children:d},d)),l.jsxs("div",{className:V("flex items-center",u&&"justify-between"),children:[l.jsx("h2",{title:e,className:"metadata-item-title",children:e}),u&&l.jsx(E.IconButton,{buttonClassName:V("border-none p-0 w-6 h-6",r?"rotate-[180deg]":""),isBaseIconStyles:!1,icon:l.jsx(mn,{width:24,height:24}),onClick:c})]}),l.jsx("p",{title:a(),className:V("metadata-item-value pr-3",!r&&"line-clamp-4"),ref:s,children:a()})]})},Cn=({metadata:e,metadataDescription:n=[],isOpenMetadata:t,onCloseMetadata:o,titles:r,locale:i})=>{const[u,f]=h.useState(E.PopUpState.Closed);h.useEffect(()=>{f(t?E.PopUpState.Opened:E.PopUpState.Closed)},[t]);const s=h.useCallback(()=>{f(E.PopUpState.Closed),o==null||o()},[o]);return l.jsx(l.Fragment,{children:u===E.PopUpState.Opened&&l.jsxs(E.Popup,{heading:l.jsx("h1",{className:"metadata-heading",children:(r==null?void 0:r.metadata)||"Metadata"}),containerClassName:"metadata h-[80%]",portalId:"metadata",size:E.PopUpSize.LG,dividers:!1,onClose:s,closeButtonTitle:(r==null?void 0:r.close)||"Close",children:[l.jsxs("div",{className:"metadata-content overflow-hidden h-full",children:[(n==null?void 0:n.length)>0&&l.jsx("div",{className:"metadata-description",children:n==null?void 0:n.map(c=>l.jsx(Al,{title:c==null?void 0:c.title,value:c==null?void 0:c.value},c==null?void 0:c.title))}),l.jsx("div",{className:"h-full overflow-y-auto metadata-list",children:e&&(e==null?void 0:e.length)>0?e==null?void 0:e.map(c=>l.jsx(yl,{title:c==null?void 0:c.title,value:c==null?void 0:c.value,locale:i,attachedKeysTitles:c==null?void 0:c.attachedKeysTitles},(c==null?void 0:c.id)||(c==null?void 0:c.title))):l.jsx("div",{className:"metadata-empty text-neutrals-700 flex h-full justify-center items-center",children:(r==null?void 0:r.noMetadata)||"No metadata"})})]}),l.jsx("div",{})]})})},Tl=e=>{var n,t;return(t=e==null?void 0:e.data[((n=e==null?void 0:e.colDef)==null?void 0:n.field)||0])==null?void 0:t.obsAttributes},Ml=e=>{var n;return(n=e==null?void 0:e.data)==null?void 0:n.attributes},Xo=(e,n)=>Object.entries(e==null?void 0:e.data).filter(([t])=>n==null?void 0:n.get(t)).map(([t,o])=>({name:t,value:String(o)})),Zt=(e,n,t)=>{var r;const o=typeof e=="object"?e==null?void 0:e[n]:e;return t?A.getLocalizedName((r=t==null?void 0:t.codes)==null?void 0:r.find(i=>(i==null?void 0:i.id)===e),n)||"":o},en=(e,n,t)=>(e==null?void 0:e.map(o=>{var s;const r=(o==null?void 0:o.name)||"",i=n==null?void 0:n.get(r),u=(s=i==null?void 0:i.codes)!=null&&s.length?i:void 0,f=Array.isArray(o==null?void 0:o.value)?o==null?void 0:o.value.map(c=>Zt(c,t,u)):Zt(o==null?void 0:o.value,t,u);return{id:A.getLocalizedName(u,t)||(o==null?void 0:o.name),title:A.getLocalizedName(u||i,t),value:f||(o==null?void 0:o.value)}}))||[],rn=(e,n,t)=>({title:(t==null?void 0:t.dataset)||"Dataset",value:A.getLocalizedName(e,n)}),Ol=(e,n,t,o)=>[rn(e,t,o),{title:(o==null?void 0:o.agency)??"Agency",value:e==null?void 0:e.agencyID},{title:(o==null?void 0:o.lastUpdated)??"Last updated",value:n}],Qo=(e,n,t)=>{var o,r;return{title:A.getDimensionTitle(e==null?void 0:e.conceptSchemes,(r=(o=A.getDimensions(e))==null?void 0:o.timeDimensions)==null?void 0:r[0],n),value:(t==null?void 0:t.colId)||""}},er=(e,n)=>({title:(n==null?void 0:n.observation)||"Observation",value:e}),nr=(e,n,t,o,r,i)=>{var f;const u={title:(o==null?void 0:o.timeSeries)||"Time Series",value:(f=i==null?void 0:i.originalData)==null?void 0:f.name};return t?[Qo(e,n,r),u,er(t,o)]:[u]},Ll=e=>{var o,r,i,u,f;const n=((r=(o=e==null?void 0:e.dataSets)==null?void 0:o[0])==null?void 0:r.attributes)||[],t=((f=(u=(i=e==null?void 0:e.structures)==null?void 0:i[0])==null?void 0:u.attributes)==null?void 0:f.dataSet)||[];return n!=null&&n.length?t.map((s,c)=>{var a;return((a=s==null?void 0:s.values)==null?void 0:a.length)>0?{...s}:{...s,values:[{value:n==null?void 0:n[c]}]}}):t},Rl=(e,n,t)=>(e==null?void 0:e.map(o=>{var d,g,w,m,v,p,b,k;const r=o==null?void 0:o.id,i=((g=(d=o==null?void 0:o.values)==null?void 0:d[0])==null?void 0:g.value)||((m=(w=o==null?void 0:o.values)==null?void 0:w[0])==null?void 0:m.id),u=(p=(v=o==null?void 0:o.values)==null?void 0:v[0])==null?void 0:p.ids,f=n==null?void 0:n.get(r),s=(b=f==null?void 0:f.codes)!=null&&b.length?f:void 0,c=A.getLocalizedName((k=s==null?void 0:s.codes)==null?void 0:k.find(x=>(x==null?void 0:x.id)===i),t)||i,a=u&&u.map(x=>{var N;return A.getLocalizedName((N=s==null?void 0:s.codes)==null?void 0:N.find(C=>(C==null?void 0:C.id)===x),t)||x});return{id:r,title:A.getLocalizedName(f,t)||r,value:u?a:c}}).filter(({value:o})=>!!o))||[],_l=(e,n)=>{var u,f,s;const t=(u=e==null?void 0:e.dataSets)==null?void 0:u[0],o=(f=e==null?void 0:e.structures)==null?void 0:f[0],r=((s=o==null?void 0:o.attributes)==null?void 0:s.dimensionGroup)||[],i=t==null?void 0:t.dimensionGroupAttributes;return new Map(r.map(c=>{var w;const a=(w=c==null?void 0:c.relationship)==null?void 0:w.dimensions,{codedSeriesKey:d,decodedSeriesKey:g}=Il(e,n,a);return[c.id,{values:(i==null?void 0:i[d])||[],decodedSeriesKey:g,codedSeriesKey:d}]}))},Il=(e,n,t)=>{var f,s,c;const o=(f=e==null?void 0:e.structures)==null?void 0:f[0],r=[...(o==null?void 0:o.dimensions.series)||[],...(o==null?void 0:o.dimensions.observation)||[]],i=(s=new Array(r==null?void 0:r.length))==null?void 0:s.fill(""),u=(c=new Array(r==null?void 0:r.length))==null?void 0:c.fill("");return t&&(t==null||t.forEach(a=>{var m,v;const d=(r==null?void 0:r.findIndex(p=>(p==null?void 0:p.id)===a))||0,g=n[d],w=((v=(m=r[d])==null?void 0:m.values)==null?void 0:v.findIndex(p=>(p==null?void 0:p.id)===g||(p==null?void 0:p.value)===g))||0;i[d]=w>=0?w:g,u[d]=g})),{codedSeriesKey:i==null?void 0:i.join(":"),decodedSeriesKey:u==null?void 0:u.join(":")}},Pl=(e,n)=>{var i;if(n==null)return;const t=(i=e==null?void 0:e.values)==null?void 0:i[n],o=typeof n=="object"&&!Array.isArray(n),r=Array.isArray(n);return t||(o||r?{values:n}:{value:n==null?void 0:n.toString()})},Vl=e=>{const n=(e==null?void 0:e.value)||(e==null?void 0:e.id),t=(e==null?void 0:e.values)||(e==null?void 0:e.ids);return n!=null?[n]:t||[null]},tr=(e,n,t)=>{var r,i;if(n==null)return n;const o=(i=(r=t==null?void 0:t.get(e||""))==null?void 0:r.codes)==null?void 0:i.find(u=>(u==null?void 0:u.id)===n);return(o==null?void 0:o.name)||n},Fl=(e,n,t,o=q.Locale.EN)=>{var s;const r=(s=t==null?void 0:t.dataStructureComponents)==null?void 0:s.dimensionList,i=[...(r==null?void 0:r.dimensions)||[],...(r==null?void 0:r.timeDimensions)||[]],u=[],f=(e==null?void 0:e.split(":"))||[];return f==null||f.forEach((c,a)=>{var d;if(c!==""){const g=((d=i==null?void 0:i[a])==null?void 0:d.id)||"",w=A.getLocalizedName(n==null?void 0:n.get(g),o),m=tr(g,c,n);u.push(`${w}: ${m}`)}}),u},Bl=(e,n,t,o,r=q.Locale.EN)=>{var f,s,c,a;if(!e||!n||!o)return[];const i=((c=(s=(f=e==null?void 0:e.structures)==null?void 0:f[0])==null?void 0:s.attributes)==null?void 0:c.dimensionGroup)||[],u=_l(e,o);return((a=i==null?void 0:i.map((d,g)=>{var p;const w=u==null?void 0:u.get(d==null?void 0:d.id),m=t==null?void 0:t.get(d==null?void 0:d.id),v=Vl(Pl(d,(p=w==null?void 0:w.values)==null?void 0:p[g]));return{id:d==null?void 0:d.id,title:A.getLocalizedName(m,r),value:Array.isArray(v)?v==null?void 0:v.map(b=>tr(d==null?void 0:d.id,b,t)||""):v,attachedKeysTitles:Fl(w==null?void 0:w.decodedSeriesKey,t,n)}}))==null?void 0:a.filter(({value:d})=>d==null?void 0:d.some(g=>!!g)))||[]},Hl=e=>{var x,N;const[n,t]=h.useState(!1),o=h.useRef(null),[r,i]=h.useState(""),[u,f]=h.useState(""),[s,c]=h.useState(!1),{onboardingFileSchema:a,isShowOnboarding:d}=we(),[g,w]=h.useState(!1),m=h.useMemo(()=>A.getStructureComponentsMap(e==null?void 0:e.dataSetData),[e==null?void 0:e.dataSetData]),v=h.useMemo(()=>{var C,j,R,M,L,S;return[rn((j=(C=e==null?void 0:e.dataSetData)==null?void 0:C.dataflows)==null?void 0:j[0],e==null?void 0:e.locale,e.titles),...en(Xo(e,m),m,e==null?void 0:e.locale),...en(Ml(e),m,e==null?void 0:e.locale),...Bl(e==null?void 0:e.attributesData,(M=(R=e==null?void 0:e.dataSetData)==null?void 0:R.dataStructures)==null?void 0:M[0],m,(S=(L=e==null?void 0:e.data)==null?void 0:L.originalData)==null?void 0:S.parsedTimeSeriesValue,e==null?void 0:e.locale)]},[e,m]),p=h.useMemo(()=>nr(e==null?void 0:e.dataSetData,e==null?void 0:e.locale,(e==null?void 0:e.valueFormatted)||(e==null?void 0:e.value),e.titles,e==null?void 0:e.colDef,e==null?void 0:e.data),[e]),b=h.useCallback(()=>{t(!0)},[]),k=h.useCallback(()=>{t(!1),w(!0)},[]);return h.useEffect(()=>{if(d){const{title:C,description:j}=Oe(oe.METADATA_PER_SERIES,e.titles);i(C),f(j)}},[e.titles,d]),h.useEffect(()=>{if(d){const C=(a==null?void 0:a.lastDisplayedElement)===oe.METADATA_PER_SERIES&&e.node.rowIndex===0;c(C),C&&setTimeout(()=>{var j;(j=o==null?void 0:o.current)==null||j.scrollIntoView({block:"end",behavior:"smooth"})})}},[a==null?void 0:a.lastDisplayedElement,e.node.rowIndex,d]),l.jsxs(l.Fragment,{children:[l.jsx("div",{ref:o,children:l.jsx(E.IconButton,{title:((x=e.titles)==null?void 0:x.metadata)||"View details",buttonClassName:"!text-neutrals-1000 !border-none !p-1",icon:l.jsx(qo,{className:"w-5 h-5"}),onClick:b})}),s&&l.jsx(Le,{reference:o,title:r,description:u,onReferenceClick:b,shouldCloseTooltip:g}),n&&l.jsx(Cn,{titles:e.titles,locale:e==null?void 0:e.locale,metadata:v,metadataDescription:(N=e==null?void 0:e.metadataSettings)!=null&&N.isMetadataDescription?p:[],isOpenMetadata:n,onCloseMetadata:k})]})},Gl=e=>{var c,a;const[n,t]=h.useState(!1),o=h.useMemo(()=>A.getStructureComponentsMap(e==null?void 0:e.dataSetData),[e==null?void 0:e.dataSetData]),r=h.useMemo(()=>en(Tl(e),o,e==null?void 0:e.locale),[e,o]),i=h.useMemo(()=>{var d,g,w;return[rn((g=(d=e==null?void 0:e.dataSetData)==null?void 0:d.dataflows)==null?void 0:g[0],e==null?void 0:e.locale,e==null?void 0:e.titles),...en(Xo(e,o),o,e==null?void 0:e.locale),...(w=e==null?void 0:e.metadataSettings)!=null&&w.isMetadataDescription?[]:[Qo(e==null?void 0:e.dataSetData,e==null?void 0:e.locale,e==null?void 0:e.colDef),er((e==null?void 0:e.valueFormatted)||(e==null?void 0:e.value),e==null?void 0:e.titles)],...r]},[e,o,r]),u=h.useMemo(()=>nr(e==null?void 0:e.dataSetData,e==null?void 0:e.locale,(e==null?void 0:e.valueFormatted)||(e==null?void 0:e.value),e==null?void 0:e.titles,e==null?void 0:e.colDef,e==null?void 0:e.data),[e]),f=h.useCallback(()=>{t(!0)},[]),s=h.useCallback(()=>{t(!1)},[]);return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"w-full h-full p-2 text-end relative",children:[(e==null?void 0:e.valueFormatted)||(e==null?void 0:e.value),(r==null?void 0:r.length)>0&&l.jsx("div",{className:"metadata-indicator",title:((c=e.titles)==null?void 0:c.metadata)||"View details",onClick:f})]}),n&&l.jsx(Cn,{titles:e.titles,locale:e==null?void 0:e.locale,metadata:i,metadataDescription:(a=e==null?void 0:e.metadataSettings)!=null&&a.isMetadataDescription?u:[],isOpenMetadata:n,onCloseMetadata:s})]})},zl=({attachment:e,isDataLoading:n,chartColumn:t,fixHeight:o,titles:r,showLimitMessage:i})=>{const[u,f]=h.useState(!1),[s,c]=h.useState([]),[a,d]=h.useState(),[g,w]=h.useState(400),m=h.useRef(null),[v,p]=h.useState(""),[b,k]=h.useState(""),[x,N]=h.useState(!1),{isShowOnboarding:C,onboardingFileSchema:j,setOnboardingFileSchema:R}=we();h.useEffect(()=>{if(e.grid_data==null)f(!0);else{const L=e.grid_data.columns.map(S=>S.colId===Qe?{...S,hide:!t}:S);c(e.grid_data.data),d(L),f(!1)}},[e.grid_data,t]),h.useEffect(()=>{s?(w(Zo(s.length)),i==null||i(s.length>=E.SERIES_LIMIT)):i==null||i(!1)},[s,i]),h.useEffect(()=>{if(C){const{title:L,description:S}=Oe(oe.DATA_GRID,r);p(L),k(S)}},[r,C]),h.useEffect(()=>{var L;j&&!((L=j==null?void 0:j.infoElements)!=null&&L.dataGrid)&&(R==null||R({...j,infoElements:{...j==null?void 0:j.infoElements,dataGrid:!0},lastDisplayedElement:oe.DATA_GRID}))},[j,R]),h.useEffect(()=>{if(C){const L=(j==null?void 0:j.lastDisplayedElement)===oe.DATA_GRID;N(L),!u&&!n&&L&&setTimeout(()=>{var S;(S=m==null?void 0:m.current)==null||S.scrollIntoView({block:"end",behavior:"smooth"})})}},[j==null?void 0:j.lastDisplayedElement,C,n,u]);const M=h.useMemo(()=>l.jsx(ao.AgGridReact,{headerHeight:tn,rowHeight:vn,rowData:s,enableCellTextSelection:!0,columnDefs:a,domLayout:"normal",tooltipShowDelay:0,tooltipShowMode:"whenTruncated",components:{[Ko]:Hl,[Yo]:Gl,[vl]:Jo}}),[s,a]);return u||n?l.jsx(E.Loader,{}):l.jsxs("div",{className:"w-full h-full",children:[l.jsx("div",{ref:m,className:V("ag-theme-quartz w-full min-h-[80px]",o?"max-h-[400px]":"max-h-full"),style:{height:g},children:M}),x&&l.jsx(Le,{reference:m,title:v,description:b,supressReferenceClick:!0})]})},Wl=200,Ul=8,$l=2,Jl=({currentIndex:e,totalCount:n,icons:t,titles:o,onPrev:r,onNext:i})=>{const u=h.useRef(null),[f,s]=h.useState(""),[c,a]=h.useState(""),[d,g]=h.useState(!1),{onboardingFileSchema:w,isShowOnboarding:m}=we();h.useEffect(()=>{if(m){const{title:k,description:x}=Oe(oe.CHARTS_NAVIGATION,o);s(k),a(x)}},[o,m]),h.useEffect(()=>{var k;if(m){const x=(w==null?void 0:w.lastDisplayedElement)===oe.CHARTS_NAVIGATION;g(x),x&&((k=u==null?void 0:u.current)==null||k.scrollIntoView({block:"center",behavior:"smooth"}))}},[w==null?void 0:w.lastDisplayedElement,m]);const v=n>0?e/n*100:0,p=n>0?Math.min(Ul*n,Wl):0,b=n>0?Math.max(p/n,$l):0;return l.jsxs("div",{className:"w-full flex flex-row items-center gap-2 justify-center",children:[l.jsx("div",{className:V("h-[20px] w-[20px] cursor-pointer",e===0?"text-neutrals-700":"text-primary"),onClick:r,children:t==null?void 0:t[Ze.PREVIOUS]}),l.jsxs("div",{className:"flex flex-col items-center gap-1 pt-[20px]",children:[l.jsx("div",{className:"h-[4px] rounded-full bg-neutral-300 relative",style:{width:`${p}px`},children:l.jsx("div",{className:"h-full rounded-full bg-primary absolute",style:{left:`${v}%`,width:`${b}px`}})}),l.jsxs("h5",{className:"text-neutrals-800",children:[e+1,"/",n]})]}),l.jsx("div",{className:V("h-[20px] w-[20px] cursor-pointer",e+1===n?"text-neutrals-700":"text-primary"),onClick:i,ref:u,children:t==null?void 0:t[Ze.NEXT]}),d&&l.jsx(Le,{reference:u,title:f,description:c})]})},Yl=({limitAmount:e,titles:n,openAdvancedView:t})=>{const[o,r]=h.useState(!1),{refs:i,floatingStyles:u,context:f}=pe.useFloating({open:o,onOpenChange:r,placement:"top-start"}),s=pe.useHover(f,{handleClose:pe.safePolygon({blockPointerEvents:!0})}),{getReferenceProps:c,getFloatingProps:a}=pe.useInteractions([s]);return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"flex w-fit",ref:i.setReference,...c(),children:l.jsxs("div",{className:"flex bg-hues-100 w-fit px-4 mt-1 py-2 gap-1",children:[l.jsx("h5",{className:"font-bold",children:(n==null?void 0:n.limits)||"Limited to"}),l.jsxs("h5",{children:[e," ",(n==null?void 0:n.timeseriesLimit)||"Timeseries"]})]})}),o&&l.jsx("div",{className:"floating",ref:i.setFloating,style:u,...a(),children:l.jsxs("div",{className:"flex flex-col bg-white z-10 p-4 rounded shadow w-[300px] mb-2 gap-2",children:[l.jsxs("div",{children:[l.jsxs("h5",{className:"text-neutrals-900",children:[l.jsx("span",{className:"pr-0.5",children:(n==null?void 0:n.limitLinkInfoP1_1)||"The number of timeseries displayed in a single chart i"}),l.jsxs("span",{className:"font-bold pr-0.5",children:[(n==null?void 0:n.limitLinkInfoP1_2)||"limited to"," ",e]}),(n==null?void 0:n.limitLinkInfoP1_3)||"for better clarity and performance."]}),l.jsxs("h5",{className:"text-neutrals-900",children:[l.jsx("span",{className:"pr-0.5",children:(n==null?void 0:n.limitLinkInfoP2_1)||"To visualize specific timeseries"}),l.jsx("span",{className:"font-bold pr-0.5",children:(n==null?void 0:n.limitLinkInfoP2_2)||"filter"}),l.jsx("span",{className:"pr-0.5",children:(n==null?void 0:n.limitLinkInfoP2_3)||"your request, or"}),l.jsx("span",{className:"font-bold pr-0.5",children:(n==null?void 0:n.limitLinkInfoP2_4)||"refine"}),(n==null?void 0:n.limitLinkInfoP2_5)||"it in the chat."]})]}),t&&l.jsx("h4",{className:"cursor-pointer text-primary",onClick:t,children:(n==null?void 0:n.limitLinkInfoLink)||"Open Advanced View"})]})})]})};function Kl(e,n,t){var c,a,d,g;const o=(a=((c=e.getZr())==null?void 0:c.painter).getRenderedCanvas())==null?void 0:a.getContext("2d");if(!o)return 0;const r=((d=t.textStyle)==null?void 0:d.fontSize)??12,i=((g=t.textStyle)==null?void 0:g.fontFamily)??"sans-serif";o.font=`${r}px ${i}`;const u=o.measureText(n).width,f=t.itemWidth??25,s=t.itemGap??10;return u+f+s}const Zl=({option:e,style:n})=>{const t=h.useRef(null),[o,r]=h.useState(e);h.useEffect(()=>{r(co.cloneDeep(e))},[e]);const i=h.useCallback(()=>{var b,k,x,N,C;const u=(k=(b=t.current)==null?void 0:b.getEchartsInstance)==null?void 0:k.call(b);if(!u)return;const s=u.getDom().clientWidth,c=e.legend||{},a=c.itemHeight??14,d=((x=c.textStyle)==null?void 0:x.fontSize)??12,g=((C=(N=u.getModel())==null?void 0:N.getComponent("legend"))==null?void 0:C.getData())||[];let w=0;g.forEach(j=>{const R=j.option.name||"";w+=Kl(u,R,c)});const v=Math.max(1,Math.ceil(w/s))*(+a+ +d+6),p=20;r(j=>({...j,grid:{...j.grid||{},bottom:v+p}}))},[e.legend]);return h.useEffect(()=>{i();const u=()=>{i()};return window.addEventListener("resize",u),()=>{window.removeEventListener("resize",u)}},[e,i]),l.jsx(so,{notMerge:!0,lazyUpdate:!1,ref:t,option:o,style:n})},ql=({attachment:e,icons:n,isDataLoading:t,openAdvancedView:o,fixHeight:r=!0,titles:i})=>{const[u,f]=h.useState(!0),[s,c]=h.useState([]),[a,d]=h.useState(0),[g,w]=h.useState(void 0),{onboardingFileSchema:m,isShowOnboarding:v,setOnboardingFileSchema:p}=we(),b=h.useRef(null);h.useEffect(()=>{var N;f(e.charting_data==null),c(((N=e.charting_data)==null?void 0:N.units)||[])},[e.charting_data]),h.useEffect(()=>{const N=(s==null?void 0:s.length)>=a;w(!u&&N?s[a]:s[0]),N||d(0)},[u,s,a]),h.useEffect(()=>{var N;m&&v&&!u&&(Gi(m)&&(p==null||p(Hi(m)),(N=b==null?void 0:b.current)==null||N.scrollIntoView({block:"center",behavior:"smooth"})),m.lastDisplayedElement===oe.CHART_PER_SERIES&&(p==null||p(Ho(m))))},[u,p,m,v]);const k=h.useCallback(()=>{d(N=>Math.min(N+1,s.length-1))},[s]),x=h.useCallback(()=>{d(N=>Math.max(N-1,0))},[]);return u||t?l.jsx(E.Loader,{}):l.jsx("div",{className:"chart-attachment w-full h-full",ref:b,children:e.charting_data&&l.jsx("div",{className:"flex flex-col w-full h-full gap-4",children:s.length==0||g==null?l.jsx("h4",{className:"ml-1",children:(i==null?void 0:i.chartInfo)||"No data"}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsxs("h3",{className:"chart-attachment-title",children:[(i==null?void 0:i.chart)||"Chart"," ",a+1,"/",s.length]}),l.jsx("span",{className:"text-neutrals-700 h4 chart-attachment-info",children:(i==null?void 0:i.chartInfo)||"Chart Information"})]}),l.jsxs("div",{className:V("chart-area overflow-hidden flex flex-row gap-4 h-full ",r&&"max-h-[400px] min-h-[400px]",!r&&"min-h-[300px]"),children:[l.jsxs("div",{className:"flex flex-col flex-1 min-h-0 min-w-0 gap-4",children:[l.jsx(Zl,{option:g.config,style:{width:"100%",height:"100%",minHeight:0}}),g.limitedByRowsAmountTo&&l.jsx(Yl,{limitAmount:g.limitedByRowsAmountTo,openAdvancedView:o,titles:i}),s.length>1&&l.jsx(Jl,{icons:n,currentIndex:a,totalCount:s.length,titles:i,onNext:k,onPrev:x})]}),l.jsx($o,{dimensionsInfo:g.dimensions})]})]})})})},Xl=e=>ee.createElement("svg",{width:44,height:24,viewBox:"0 0 44 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},ee.createElement("rect",{width:44,height:24,rx:12,fill:"currentColor"}),ee.createElement("circle",{cx:32,cy:12,r:10,fill:"white"})),Ql=e=>ee.createElement("svg",{width:44,height:24,viewBox:"0 0 44 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},ee.createElement("rect",{width:44,height:24,rx:12,fill:"currentColor"}),ee.createElement("circle",{cx:12,cy:12,r:10,fill:"white"})),qt=[{value:A.SdmxDataFormat.JSON,title:"SDMX-JSON"},{value:A.SdmxDataFormat.XML,title:"SDMX-ML (XML)"},{value:A.SdmxDataFormat.CSV,title:"SDMX-CSV"}],es=e=>[{value:A.FileColumnsAttribute.ID,title:(e==null?void 0:e.idOptions)||"ID",description:e==null?void 0:e.idOptionsDescription},{value:A.FileColumnsAttribute.NAME,title:(e==null?void 0:e.nameOptions)||"Name",description:e==null?void 0:e.nameOptionsDescription},{value:A.FileColumnsAttribute.ID_NAME,title:(e==null?void 0:e.idAndNameOptions)||"Combined ID and Name",description:e==null?void 0:e.idAndNameOptionsDescription}],Xt=({title:e,items:n,selectedValue:t,setSelectedValue:o,infoMessage:r})=>l.jsxs(E.CollapsibleBlock,{title:e,value:t.title,children:[l.jsx("div",{className:"flex flex-col gap-y-1",children:n.map(i=>l.jsx("div",{className:"flex flex-col",children:l.jsx(E.Radio,{id:i.value,checked:t.value===i.value,label:i.title,description:i.description,onChange:()=>{o(i)},radioIcon:l.jsx(De.IconCircleFilled,{className:"w-3 h-3"})},i.value)},i.value))}),r]}),ns=(e,n,t,o)=>{if(o!=null&&o.filterKey&&e===A.DownloadType.DATA_IN_TABLE)return o;let r=null,i=null;return n&&t&&e===A.DownloadType.DATA_IN_TABLE&&(r=t==null?null:A.getTimeSeriesFilterKey(t,n.filters),i=A.getTimeQueryFilter(n,A.getTimeDimension(t))),{filterKey:r,timeFilter:i}},ts=({actions:e,dataQuery:n,datasetIcon:t,isDisplayDatasetIcon:o=!0,datasetName:r,onCloseModal:i,type:u=A.DownloadType.FULL_DATASET,locale:f=q.Locale.EN,dimensions:s,filters:c,urn:a,titles:d,limitMessages:g,showLimitMessage:w,externalLink:m})=>{const v=es(d),[p,b]=h.useState(qt[0]),[k,x]=h.useState(v[0]),[N,C]=h.useState(!0),j=h.useCallback(()=>{const R=ns(u,n,s,c),M=(n==null?void 0:n.urn)||a||"",L=k.value,S=p.value,D=`${r}.${S}`;e.downloadDataSet(M,S,f,L,R,D,N),i()},[u,n,s,c,a,k.value,p.value,e,f,N,i,r]);return l.jsxs(E.Popup,{heading:l.jsx("p",{className:"download-heading h2",children:(d==null?void 0:d.download)||"Download"}),portalId:"filters",size:E.PopUpSize.LG,containerClassName:"download-popup h-[80%]",dividers:!1,onClose:i,closeButtonTitle:(d==null?void 0:d.close)||"Close",children:[l.jsxs("div",{className:"download-info flex flex-col gap-1 px-6",children:[l.jsxs("div",{className:"download-info-text flex gap-1",children:[l.jsxs("p",{className:"text-neutrals-800 body-3",children:[(d==null?void 0:d.dataset)||"Dataset",":"]}),l.jsxs("span",{className:"h4 flex flex-row gap-x-1 flex-1 min-w-0",children:[o&&t,l.jsx("p",{className:"flex-1 min-w-0 truncate",children:r})]})]}),w&&l.jsx(E.RequestLimitMessage,{limitMessages:g,isDownload:!0,query:m})]}),l.jsxs("div",{className:"download-settings flex flex-col overflow-auto p-6",children:[l.jsx(Xt,{title:(d==null?void 0:d.dataFormat)||"Data Format",selectedValue:p,setSelectedValue:b,items:qt,infoMessage:l.jsx(E.DownloadFormatMessage,{limitMessages:g,query:m})}),l.jsx(Xt,{title:(d==null?void 0:d.attributes)||"Attributes",selectedValue:k,setSelectedValue:x,items:v}),l.jsx(E.CollapsibleBlock,{title:(d==null?void 0:d.metadata)||"Metadata",value:N?(d==null?void 0:d.all)||"Included":(d==null?void 0:d.none)||"Not included",children:l.jsxs("div",{className:`flex gap-4 cursor-pointer download-metadata ${N?"download-metadata-active":""}`,children:[N?l.jsx(Xl,{width:44,height:24,className:"text-primary",onClick:()=>{C(!N)}}):l.jsx(Ql,{width:44,height:24,className:"text-neutrals-500",onClick:()=>{C(!N)}}),l.jsx("div",{children:(d==null?void 0:d.includeMetadata)||"Include Metadata"})]})})]}),l.jsx("div",{className:"download-button flex p-6 mt-auto",children:l.jsx(E.Button,{buttonClassName:"text-button-primary",title:(d==null?void 0:d.download)||"Download",onClick:j})})]})},os=({id:e,title:n,version:t,agency:o,isActive:r,isSingleTab:i,onSelectDataset:u})=>l.jsx("div",{className:V("dataset-tab truncate last:mr-4",r?"dataset-tab-active":"border-b-transparent",i?"dataset-tab-single cursor-default":"cursor-pointer"),title:n,onClick:()=>{i||u(A.generateShortUrn(e,t,o))},children:l.jsx("h3",{className:"dataset-tab-title truncate",title:n,children:n})}),or=({datasets:e,locale:n,isHideAdvancedViewButton:t,openAdvancedViewIcon:o,initialSelectedDatasetUrn:r,selectDataset:i,onOpenAdvancedView:u,titles:f})=>{const{isOpenedAdvancedView:s}=Me(),[c,a]=h.useState(),d=h.useRef(null),[g,w]=h.useState(""),[m,v]=h.useState(""),[p,b]=h.useState(!1),{onboardingFileSchema:k,isShowOnboarding:x}=we();h.useEffect(()=>{if(x){const{title:C,description:j}=Oe(oe.OPEN_ADVANCED_VIEW,f);w(C),v(j)}},[f,x]),h.useEffect(()=>{var C;if(x){const j=(k==null?void 0:k.lastDisplayedElement)===oe.OPEN_ADVANCED_VIEW;b(j),j&&((C=d==null?void 0:d.current)==null||C.scrollIntoView({block:"center",behavior:"smooth"}))}},[k==null?void 0:k.lastDisplayedElement,x]),h.useEffect(()=>{if(!r&&!c&&(e!=null&&e[0])){const C=A.generateShortUrn(e[0].id,e[0].version,e[0].agencyID);a(C),i==null||i(C)}else r&&r!==c&&(a(r),i==null||i(r))},[e,i,r,c]);const N=h.useCallback(C=>{a(C),i==null||i(C)},[i]);return l.jsxs("div",{className:V("dataset-tabs flex justify-between items-center w-full",t&&s&&"hide-advance-button"),children:[l.jsx("div",{className:"flex items-center w-full overflow-y-auto gap-4 sm:w-[calc(100%-30px)]",children:e==null?void 0:e.map(C=>l.jsx(os,{id:C==null?void 0:C.id,title:A.getLocalizedName(C,n||q.Locale.EN),version:C==null?void 0:C.version,agency:C==null?void 0:C.agencyID,isActive:(e==null?void 0:e.length)>1&&c===A.generateShortUrn(C==null?void 0:C.id,C==null?void 0:C.version,C==null?void 0:C.agencyID),isSingleTab:(e==null?void 0:e.length)===1,onSelectDataset:N},C==null?void 0:C.id))}),!t&&l.jsx("div",{ref:d,children:l.jsx(E.IconButton,{buttonClassName:"advanced-view-button",icon:o,onClick:u})}),p&&l.jsx(Le,{reference:d,title:g,description:m,onReferenceClick:u,shouldCloseTooltip:s})]})},rs=(e,n,t,o)=>n==null?void 0:n.map(r=>{var d;const i=e==null?void 0:e.find(g=>(g==null?void 0:g.urn)===(r==null?void 0:r.urn)),u=t==null?void 0:t.get(r==null?void 0:r.urn),f=(u==null?void 0:u.conceptSchemes)||[],s=(u==null?void 0:u.codelists)||[],c=A.getDimensions(u),a=[...(c==null?void 0:c.dimensions)||[],...(c==null?void 0:c.timeDimensions)||[]];return{datasetName:A.getLocalizedName((d=u==null?void 0:u.dataflows)==null?void 0:d[0],o),queryFiltersDetails:is(Qt((i==null?void 0:i.filters)||[],a,f,s,o),Qt(r==null?void 0:r.filters,a,f,s,o))}}),is=(e,n)=>{const t=new Map(e==null?void 0:e.map(o=>[o==null?void 0:o.id,o]));return(n==null?void 0:n.filter(o=>{var r,i,u;return!co.isEqual((i=(r=t==null?void 0:t.get(o==null?void 0:o.id))==null?void 0:r.valuesTitles)==null?void 0:i.sort(),(u=o==null?void 0:o.valuesTitles)==null?void 0:u.sort())}))||[]},Qt=(e,n,t,o,r)=>e==null?void 0:e.map(i=>{var c,a,d;const u=n.find(g=>(g==null?void 0:g.id)===(i==null?void 0:i.componentCode)),f=A.getConcept((u==null?void 0:u.conceptIdentity)||"",t),s=A.findCodelistByDimension(o,t,u);return{id:i==null?void 0:i.componentCode,title:A.getLocalizedName(f,r),valuesTitles:(i==null?void 0:i.operator)===q.QueryFilterType.BETWEEN?[`${Xe(q.getTimePeriod((c=i==null?void 0:i.values)==null?void 0:c[0]),r)} - ${Xe(q.getTimePeriod((a=i==null?void 0:i.values)==null?void 0:a[1]),r)}`]:(d=i==null?void 0:i.values)==null?void 0:d.map(g=>{var w;return A.getLocalizedName((w=s==null?void 0:s.codes)==null?void 0:w.find(m=>(m==null?void 0:m.id)===g),r)||g})}}),ls=(e,n,t)=>{var u,f,s;let o="",r="";if(e!=null&&e.timeFilter){const c=(u=decodeURIComponent(e.timeFilter||""))==null?void 0:u.split(":");o=c[1]||"",r=c[3]||""}else if(n){const c=n==null?void 0:n.filters.find(a=>a.componentCode===A.TIME_PERIOD);o=((f=c==null?void 0:c.values)==null?void 0:f[0])||"",r=((s=c==null?void 0:c.values)==null?void 0:s[1])||""}return`&filter=${(e==null?void 0:e.filterKey)||A.getTimeSeriesFilterKey(t||[],(n==null?void 0:n.filters)||[])}&startPeriod=${o}&endPeriod=${r}`},rr=(e,n,t,o)=>{var i;const r=e?ls(n,t,o):"";return((i=t==null?void 0:t.metadata)==null?void 0:i.datasetUrl)+r};Lt.ModuleRegistry.registerModules([Lt.AllCommunityModule]);const ir=({attachments:e,actions:n,titles:t,messageStyles:o,attachmentsStyles:r,isSystemAttachments:i,isShowAttachments:u,showAdvancedView:f,currentDataQuery:s,dataQueries:c,attachmentInfoList:a,datasets:d,initialSelectedDatasetUrn:g,isDataLoading:w,isDataSetAttachments:m,locale:v,dimensions:p,filters:b,selectDataset:k,onAdvancedViewOpen:x,limitMessages:N,attachmentsConfig:C})=>{const[j,R]=h.useState(0),[M,L]=h.useState(null),{isOpenedAdvancedView:S,setIsOpenedAdvancedView:D}=Me(),[O,B]=h.useState(E.PopUpState.Closed),[W,F]=h.useState(!1),[_,G]=h.useState(),[H,U]=h.useState(),[Y,J]=h.useState(!1),K={downloadDataSet:n.downloadDataSet,getConstraints:n.getConstraints},re=A.DownloadType.DATA_IN_TABLE,ce=xe=>{R(xe)},ae=h.useCallback(()=>{x==null||x(),D(!0),n.updateCurrentDataQuery(s||(c==null?void 0:c[0])),n.updateDataQueries(c),n.updateDatasets(d)},[n,s,c,d,D,x]);h.useEffect(()=>{L(e[j]||null)},[e,j]),h.useEffect(()=>{F(m&&(d==null||(d==null?void 0:d.length)==0))},[d,m]);const de=h.useCallback(()=>{B(E.PopUpState.Closed)},[B]),le=C==null?void 0:C.isExternaLinkIncludeFilters,ue=rr(le,b,s||(c==null?void 0:c[0]),p);return!e||e.length===0?null:l.jsx(l.Fragment,{children:S&&!u?l.jsx(Dl,{icon:o==null?void 0:o.advanceViewIcon,title:(o==null?void 0:o.openAdvanceViewTitle)??"Opened in Advanced view"}):l.jsxs("div",{className:V("space-y-3 max-w-full max-h-full h-full",!S&&!i?"pt-5":"pt-0"),children:[!S&&W?l.jsx(E.Loader,{}):l.jsxs(l.Fragment,{children:[i&&!S&&l.jsx(wl,{titles:{queryUpdatedManuallyTitle:t==null?void 0:t.queryUpdatedManually,setToTitle:t==null?void 0:t.setTo},datasetIcon:r==null?void 0:r.datasetIcon,attachmentInfoList:a}),!S&&(d==null?void 0:d.length)!=null&&(d==null?void 0:d.length)>0&&l.jsx(or,{datasets:d,initialSelectedDatasetUrn:g,locale:v,titles:t,isHideAdvancedViewButton:!f,openAdvancedViewIcon:r==null?void 0:r.openAdvancedViewIcon,selectDataset:k,onOpenAdvancedView:ae}),Y&&l.jsx(E.RequestLimitMessage,{limitMessages:N,showAdvancedViewButton:!!M&&fn(M)&&f,onAdvancedViewClick:ae,query:ue}),l.jsx("div",{className:V(!S&&(d==null?void 0:d.length)&&"attachments-bordered","attachments-wrapper h-full min-h-0"),children:l.jsxs("div",{className:"flex flex-col max-w-full items-center gap-4 h-full",children:[l.jsxs("div",{className:"flex min-w-0 w-full justify-between items-center",children:[l.jsx(fl,{dataGridTitle:r==null?void 0:r.dataGridTitle,attachments:e,selectedAttachmentIndex:j,showTabIcon:r==null?void 0:r.showTabIcon,onSelectedAttachmentChange:ce,titles:t}),l.jsxs("div",{className:"flex gap-x-3 items-center flex-wrap w-full justify-end",children:[M&&ze(M)&&le&&l.jsx("a",{href:ue,target:"_blank",children:l.jsx(E.Button,{title:(N==null?void 0:N.dataExplorer)||"Data explorer",buttonClassName:"text-button-tertiary small-icon-button [&>svg]:h-[16px] [&>svg]:w-[16px] whitespace-nowrap",iconBefore:N==null?void 0:N.dataExplorerIcon})}),M&&ze(M)&&l.jsx(E.Button,{title:(r==null?void 0:r.downloadTitle)||"Download",buttonClassName:"text-button-tertiary small-icon-button",onClick:()=>B(E.PopUpState.Opened),iconBefore:r==null?void 0:r.downloadIcon})]})]}),M!=null&&l.jsxs("div",{className:"flex flex-1 w-full justify-center min-h-0",children:[Ui(M)&&l.jsx(el,{actions:n,downloadTitles:r==null?void 0:r.downloadTitle,attachment:M}),fn(M)&&l.jsx(El,{actions:n,attachment:M,showLimitMessage:J}),ze(M)&&l.jsx(zl,{attachment:M,isDataLoading:w,chartColumn:S,fixHeight:!S,titles:t,showLimitMessage:J}),Ye(M)&&l.jsx(ql,{titles:t,isDataLoading:w,attachment:M,icons:r==null?void 0:r.chartingIcons,openAdvancedView:S?void 0:ae,fixHeight:!S}),xn(M)&&l.jsx(al,{attachment:M,openLinkTitle:r==null?void 0:r.openLinkTitle}),zo(M)&&l.jsx(rl,{attachment:M})]})]})})]}),l.jsxs(l.Fragment,{children:[O===E.PopUpState.Opened&&l.jsx(ts,{actions:K,onCloseModal:de,dataQuery:s,datasetName:(M==null?void 0:M.title)||"",locale:v,type:re,dimensions:p,filters:b,urn:s==null?void 0:s.urn,datasetIcon:r==null?void 0:r.datasetIcon,isDisplayDatasetIcon:r==null?void 0:r.isDisplayDatasetIcon,titles:r==null?void 0:r.downloadTitles,setIsShowDownloadAlert:G,setDownloadAlertDetails:U,limitMessages:N,showLimitMessage:Y,externalLink:ue}),_&&l.jsx(E.Alert,{alertDetails:H,successIcon:r==null?void 0:r.successDownloadIcon,errorIcon:r==null?void 0:r.errorDownloadIcon,onClose:()=>G(!1),closeButtonTitle:(r==null?void 0:r.closeTitle)||"Close"})]})]})})},ss=({filtersProps:e,actions:n,attachments:t,attachmentsDataQuery:o,dataQueries:r,dimensions:i,locale:u,attachmentsStyles:f,isDataLoading:s,setIsFiltering:c,titles:a,limitMessages:d,attachmentsConfig:g,filters:w,onFiltersChange:m})=>{const v={getConstraints:n.getConstraints};return h.useEffect(()=>{s||c==null||c(!1)},[s,c]),l.jsx("div",{className:"bg-white rounded h-full min-h-0",children:l.jsxs("div",{className:"flex flex-col gap-4 h-full overflow-x-hidden",children:[l.jsxs("div",{className:"data-details-header flex justify-between items-center",children:[l.jsx("h2",{children:(a==null?void 0:a.content)??"Content"}),l.jsx(Qi,{attachmentsDataQuery:o,dataQueries:r,updateDataQueries:n==null?void 0:n.updateDataQueries,locale:u,actions:v,dimensions:i,titles:a,...e,onFiltersChange:m,limitMessages:d})]}),l.jsx("div",{className:"advanced-view-attachments-container flex-1 min-h-0",children:l.jsx(ir,{titles:a,attachments:t,attachmentsStyles:f,currentDataQuery:o,dimensions:i,actions:n,isShowAttachments:!0,isDataSetAttachments:!0,isDataLoading:s,locale:u,filters:w,limitMessages:d,attachmentsConfig:g})})]})})};function cn(e){return(n={})=>{const t=n.width?String(n.width):e.defaultWidth;return e.formats[t]||e.formats[e.defaultWidth]}}function Pe(e){return(n,t)=>{const o=t!=null&&t.context?String(t.context):"standalone";let r;if(o==="formatting"&&e.formattingValues){const u=e.defaultFormattingWidth||e.defaultWidth,f=t!=null&&t.width?String(t.width):u;r=e.formattingValues[f]||e.formattingValues[u]}else{const u=e.defaultWidth,f=t!=null&&t.width?String(t.width):e.defaultWidth;r=e.values[f]||e.values[u]}const i=e.argumentCallback?e.argumentCallback(n):n;return r[i]}}function Ve(e){return(n,t={})=>{const o=t.width,r=o&&e.matchPatterns[o]||e.matchPatterns[e.defaultMatchWidth],i=n.match(r);if(!i)return null;const u=i[0],f=o&&e.parsePatterns[o]||e.parsePatterns[e.defaultParseWidth],s=Array.isArray(f)?cs(f,d=>d.test(u)):as(f,d=>d.test(u));let c;c=e.valueCallback?e.valueCallback(s):s,c=t.valueCallback?t.valueCallback(c):c;const a=n.slice(u.length);return{value:c,rest:a}}}function as(e,n){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&n(e[t]))return t}function cs(e,n){for(let t=0;t<e.length;t++)if(n(e[t]))return t}function us(e){return(n,t={})=>{const o=n.match(e.matchPattern);if(!o)return null;const r=o[0],i=n.match(e.parsePattern);if(!i)return null;let u=e.valueCallback?e.valueCallback(i[0]):i[0];u=t.valueCallback?t.valueCallback(u):u;const f=n.slice(r.length);return{value:u,rest:f}}}const eo=Symbol.for("constructDateFrom");function lr(e,n){return typeof e=="function"?e(n):e&&typeof e=="object"&&eo in e?e[eo](n):e instanceof Date?new e.constructor(n):new Date(n)}function ds(e,...n){const t=lr.bind(null,e||n.find(o=>typeof o=="object"));return n.map(t)}let hs={};function fs(){return hs}function kn(e,n){return lr(n||e,e)}function no(e,n){var f,s,c,a;const t=fs(),o=(n==null?void 0:n.weekStartsOn)??((s=(f=n==null?void 0:n.locale)==null?void 0:f.options)==null?void 0:s.weekStartsOn)??t.weekStartsOn??((a=(c=t.locale)==null?void 0:c.options)==null?void 0:a.weekStartsOn)??0,r=kn(e,n==null?void 0:n.in),i=r.getDay(),u=(i<o?7:0)+i-o;return r.setDate(r.getDate()-u),r.setHours(0,0,0,0),r}function sr(e,n,t){const[o,r]=ds(t==null?void 0:t.in,e,n);return+no(o,t)==+no(r,t)}function Fe(e,n){if(e.one!==void 0&&n===1)return e.one;const t=n%10,o=n%100;return t===1&&o!==11?e.singularNominative.replace("{{count}}",String(n)):t>=2&&t<=4&&(o<10||o>20)?e.singularGenitive.replace("{{count}}",String(n)):e.pluralGenitive.replace("{{count}}",String(n))}function fe(e){return(n,t)=>t&&t.addSuffix?t.comparison&&t.comparison>0?e.future?Fe(e.future,n):"за "+Fe(e.regular,n):e.past?Fe(e.past,n):Fe(e.regular,n)+" тому":Fe(e.regular,n)}const gs=(e,n)=>n&&n.addSuffix?n.comparison&&n.comparison>0?"за півхвилини":"півхвилини тому":"півхвилини",ws={lessThanXSeconds:fe({regular:{one:"менше секунди",singularNominative:"менше {{count}} секунди",singularGenitive:"менше {{count}} секунд",pluralGenitive:"менше {{count}} секунд"},future:{one:"менше, ніж за секунду",singularNominative:"менше, ніж за {{count}} секунду",singularGenitive:"менше, ніж за {{count}} секунди",pluralGenitive:"менше, ніж за {{count}} секунд"}}),xSeconds:fe({regular:{singularNominative:"{{count}} секунда",singularGenitive:"{{count}} секунди",pluralGenitive:"{{count}} секунд"},past:{singularNominative:"{{count}} секунду тому",singularGenitive:"{{count}} секунди тому",pluralGenitive:"{{count}} секунд тому"},future:{singularNominative:"за {{count}} секунду",singularGenitive:"за {{count}} секунди",pluralGenitive:"за {{count}} секунд"}}),halfAMinute:gs,lessThanXMinutes:fe({regular:{one:"менше хвилини",singularNominative:"менше {{count}} хвилини",singularGenitive:"менше {{count}} хвилин",pluralGenitive:"менше {{count}} хвилин"},future:{one:"менше, ніж за хвилину",singularNominative:"менше, ніж за {{count}} хвилину",singularGenitive:"менше, ніж за {{count}} хвилини",pluralGenitive:"менше, ніж за {{count}} хвилин"}}),xMinutes:fe({regular:{singularNominative:"{{count}} хвилина",singularGenitive:"{{count}} хвилини",pluralGenitive:"{{count}} хвилин"},past:{singularNominative:"{{count}} хвилину тому",singularGenitive:"{{count}} хвилини тому",pluralGenitive:"{{count}} хвилин тому"},future:{singularNominative:"за {{count}} хвилину",singularGenitive:"за {{count}} хвилини",pluralGenitive:"за {{count}} хвилин"}}),aboutXHours:fe({regular:{singularNominative:"близько {{count}} години",singularGenitive:"близько {{count}} годин",pluralGenitive:"близько {{count}} годин"},future:{singularNominative:"приблизно за {{count}} годину",singularGenitive:"приблизно за {{count}} години",pluralGenitive:"приблизно за {{count}} годин"}}),xHours:fe({regular:{singularNominative:"{{count}} годину",singularGenitive:"{{count}} години",pluralGenitive:"{{count}} годин"}}),xDays:fe({regular:{singularNominative:"{{count}} день",singularGenitive:"{{count}} днi",pluralGenitive:"{{count}} днів"}}),aboutXWeeks:fe({regular:{singularNominative:"близько {{count}} тижня",singularGenitive:"близько {{count}} тижнів",pluralGenitive:"близько {{count}} тижнів"},future:{singularNominative:"приблизно за {{count}} тиждень",singularGenitive:"приблизно за {{count}} тижні",pluralGenitive:"приблизно за {{count}} тижнів"}}),xWeeks:fe({regular:{singularNominative:"{{count}} тиждень",singularGenitive:"{{count}} тижні",pluralGenitive:"{{count}} тижнів"}}),aboutXMonths:fe({regular:{singularNominative:"близько {{count}} місяця",singularGenitive:"близько {{count}} місяців",pluralGenitive:"близько {{count}} місяців"},future:{singularNominative:"приблизно за {{count}} місяць",singularGenitive:"приблизно за {{count}} місяці",pluralGenitive:"приблизно за {{count}} місяців"}}),xMonths:fe({regular:{singularNominative:"{{count}} місяць",singularGenitive:"{{count}} місяці",pluralGenitive:"{{count}} місяців"}}),aboutXYears:fe({regular:{singularNominative:"близько {{count}} року",singularGenitive:"близько {{count}} років",pluralGenitive:"близько {{count}} років"},future:{singularNominative:"приблизно за {{count}} рік",singularGenitive:"приблизно за {{count}} роки",pluralGenitive:"приблизно за {{count}} років"}}),xYears:fe({regular:{singularNominative:"{{count}} рік",singularGenitive:"{{count}} роки",pluralGenitive:"{{count}} років"}}),overXYears:fe({regular:{singularNominative:"більше {{count}} року",singularGenitive:"більше {{count}} років",pluralGenitive:"більше {{count}} років"},future:{singularNominative:"більше, ніж за {{count}} рік",singularGenitive:"більше, ніж за {{count}} роки",pluralGenitive:"більше, ніж за {{count}} років"}}),almostXYears:fe({regular:{singularNominative:"майже {{count}} рік",singularGenitive:"майже {{count}} роки",pluralGenitive:"майже {{count}} років"},future:{singularNominative:"майже за {{count}} рік",singularGenitive:"майже за {{count}} роки",pluralGenitive:"майже за {{count}} років"}})},ms=(e,n,t)=>(t=t||{},ws[e](n,t)),ps={full:"EEEE, do MMMM y 'р.'",long:"do MMMM y 'р.'",medium:"d MMM y 'р.'",short:"dd.MM.y"},xs={full:"H:mm:ss zzzz",long:"H:mm:ss z",medium:"H:mm:ss",short:"H:mm"},vs={full:"{{date}} 'о' {{time}}",long:"{{date}} 'о' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},bs={date:cn({formats:ps,defaultWidth:"full"}),time:cn({formats:xs,defaultWidth:"full"}),dateTime:cn({formats:vs,defaultWidth:"full"})},Sn=["неділю","понеділок","вівторок","середу","четвер","п’ятницю","суботу"];function Cs(e){const n=Sn[e];switch(e){case 0:case 3:case 5:case 6:return"'у минулу "+n+" о' p";case 1:case 2:case 4:return"'у минулий "+n+" о' p"}}function ar(e){return"'у "+Sn[e]+" о' p"}function ks(e){const n=Sn[e];switch(e){case 0:case 3:case 5:case 6:return"'у наступну "+n+" о' p";case 1:case 2:case 4:return"'у наступний "+n+" о' p"}}const Ss=(e,n,t)=>{const o=kn(e),r=o.getDay();return sr(o,n,t)?ar(r):Cs(r)},Ns=(e,n,t)=>{const o=kn(e),r=o.getDay();return sr(o,n,t)?ar(r):ks(r)},js={lastWeek:Ss,yesterday:"'вчора о' p",today:"'сьогодні о' p",tomorrow:"'завтра о' p",nextWeek:Ns,other:"P"},Es=(e,n,t,o)=>{const r=js[e];return typeof r=="function"?r(n,t,o):r},Ds={narrow:["до н.е.","н.е."],abbreviated:["до н. е.","н. е."],wide:["до нашої ери","нашої ери"]},As={narrow:["1","2","3","4"],abbreviated:["1-й кв.","2-й кв.","3-й кв.","4-й кв."],wide:["1-й квартал","2-й квартал","3-й квартал","4-й квартал"]},ys={narrow:["С","Л","Б","К","Т","Ч","Л","С","В","Ж","Л","Г"],abbreviated:["січ.","лют.","берез.","квіт.","трав.","черв.","лип.","серп.","верес.","жовт.","листоп.","груд."],wide:["січень","лютий","березень","квітень","травень","червень","липень","серпень","вересень","жовтень","листопад","грудень"]},Ts={narrow:["С","Л","Б","К","Т","Ч","Л","С","В","Ж","Л","Г"],abbreviated:["січ.","лют.","берез.","квіт.","трав.","черв.","лип.","серп.","верес.","жовт.","листоп.","груд."],wide:["січня","лютого","березня","квітня","травня","червня","липня","серпня","вересня","жовтня","листопада","грудня"]},Ms={narrow:["Н","П","В","С","Ч","П","С"],short:["нд","пн","вт","ср","чт","пт","сб"],abbreviated:["нед","пон","вів","сер","чтв","птн","суб"],wide:["неділя","понеділок","вівторок","середа","четвер","п’ятниця","субота"]},Os={narrow:{am:"ДП",pm:"ПП",midnight:"півн.",noon:"пол.",morning:"ранок",afternoon:"день",evening:"веч.",night:"ніч"},abbreviated:{am:"ДП",pm:"ПП",midnight:"півн.",noon:"пол.",morning:"ранок",afternoon:"день",evening:"веч.",night:"ніч"},wide:{am:"ДП",pm:"ПП",midnight:"північ",noon:"полудень",morning:"ранок",afternoon:"день",evening:"вечір",night:"ніч"}},Ls={narrow:{am:"ДП",pm:"ПП",midnight:"півн.",noon:"пол.",morning:"ранку",afternoon:"дня",evening:"веч.",night:"ночі"},abbreviated:{am:"ДП",pm:"ПП",midnight:"півн.",noon:"пол.",morning:"ранку",afternoon:"дня",evening:"веч.",night:"ночі"},wide:{am:"ДП",pm:"ПП",midnight:"північ",noon:"полудень",morning:"ранку",afternoon:"дня",evening:"веч.",night:"ночі"}},Rs=(e,n)=>{const t=String(n==null?void 0:n.unit),o=Number(e);let r;return t==="date"?o===3||o===23?r="-є":r="-е":t==="minute"||t==="second"||t==="hour"?r="-а":r="-й",o+r},_s={ordinalNumber:Rs,era:Pe({values:Ds,defaultWidth:"wide"}),quarter:Pe({values:As,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Pe({values:ys,defaultWidth:"wide",formattingValues:Ts,defaultFormattingWidth:"wide"}),day:Pe({values:Ms,defaultWidth:"wide"}),dayPeriod:Pe({values:Os,defaultWidth:"any",formattingValues:Ls,defaultFormattingWidth:"wide"})},Is=/^(\d+)(-?(е|й|є|а|я))?/i,Ps=/\d+/i,Vs={narrow:/^((до )?н\.?\s?е\.?)/i,abbreviated:/^((до )?н\.?\s?е\.?)/i,wide:/^(до нашої ери|нашої ери|наша ера)/i},Fs={any:[/^д/i,/^н/i]},Bs={narrow:/^[1234]/i,abbreviated:/^[1234](-?[иі]?й?)? кв.?/i,wide:/^[1234](-?[иі]?й?)? квартал/i},Hs={any:[/1/i,/2/i,/3/i,/4/i]},Gs={narrow:/^[слбктчвжг]/i,abbreviated:/^(січ|лют|бер(ез)?|квіт|трав|черв|лип|серп|вер(ес)?|жовт|лис(топ)?|груд)\.?/i,wide:/^(січень|січня|лютий|лютого|березень|березня|квітень|квітня|травень|травня|червня|червень|липень|липня|серпень|серпня|вересень|вересня|жовтень|жовтня|листопад[а]?|грудень|грудня)/i},zs={narrow:[/^с/i,/^л/i,/^б/i,/^к/i,/^т/i,/^ч/i,/^л/i,/^с/i,/^в/i,/^ж/i,/^л/i,/^г/i],any:[/^сі/i,/^лю/i,/^б/i,/^к/i,/^т/i,/^ч/i,/^лип/i,/^се/i,/^в/i,/^ж/i,/^лис/i,/^г/i]},Ws={narrow:/^[нпвсч]/i,short:/^(нд|пн|вт|ср|чт|пт|сб)\.?/i,abbreviated:/^(нед|пон|вів|сер|че?тв|птн?|суб)\.?/i,wide:/^(неділ[яі]|понеділ[ок][ка]|вівтор[ок][ка]|серед[аи]|четвер(га)?|п\W*?ятниц[яі]|субот[аи])/i},Us={narrow:[/^н/i,/^п/i,/^в/i,/^с/i,/^ч/i,/^п/i,/^с/i],any:[/^н/i,/^п[он]/i,/^в/i,/^с[ер]/i,/^ч/i,/^п\W*?[ят]/i,/^с[уб]/i]},$s={narrow:/^([дп]п|півн\.?|пол\.?|ранок|ранку|день|дня|веч\.?|ніч|ночі)/i,abbreviated:/^([дп]п|півн\.?|пол\.?|ранок|ранку|день|дня|веч\.?|ніч|ночі)/i,wide:/^([дп]п|північ|полудень|ранок|ранку|день|дня|вечір|вечора|ніч|ночі)/i},Js={any:{am:/^дп/i,pm:/^пп/i,midnight:/^півн/i,noon:/^пол/i,morning:/^р/i,afternoon:/^д[ен]/i,evening:/^в/i,night:/^н/i}},Ys={ordinalNumber:us({matchPattern:Is,parsePattern:Ps,valueCallback:e=>parseInt(e,10)}),era:Ve({matchPatterns:Vs,defaultMatchWidth:"wide",parsePatterns:Fs,defaultParseWidth:"any"}),quarter:Ve({matchPatterns:Bs,defaultMatchWidth:"wide",parsePatterns:Hs,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Ve({matchPatterns:Gs,defaultMatchWidth:"wide",parsePatterns:zs,defaultParseWidth:"any"}),day:Ve({matchPatterns:Ws,defaultMatchWidth:"wide",parsePatterns:Us,defaultParseWidth:"any"}),dayPeriod:Ve({matchPatterns:$s,defaultMatchWidth:"wide",parsePatterns:Js,defaultParseWidth:"any"})},Ks={code:"uk",formatDistance:ms,formatLong:bs,formatRelative:Es,localize:_s,match:Ys,options:{weekStartsOn:1,firstWeekContainsDate:1}},Zs=e=>e===q.Locale.UK?"dd MMM, yyyy":" MMM dd, yyyy hh:mm aa",qs=(e,n)=>{const t=Zs(n);return e!=null&&e!==""&&t&&Rt.isValid(new Date(e))?Rt.format(new Date(e),t,n===q.Locale.UK?{locale:Ks}:void 0):""},Xs=jr.extendTailwindMerge({extend:{classGroups:{typography:["h1","h2","h3","h4","h5","body-1","body-2","body-3","caption"]}}});function Be(...e){return Xs(V(...e))}const Qs=({isShowAgency:e,isShowDatasetBadge:n,dataset:t,data:o,structures:r,metadataSettings:i,locale:u,titles:f,getDatasetUpdatedTime:s,externalLink:c,datasetIcon:a,externalLinkIcon:d,metadataButtonClassName:g,metadataIconClassName:w,infoSegmentContainerClassName:m,infoSegmentHeaderClassName:v,nameAndMetadataContainerClassName:p})=>{const[b,k]=h.useState(""),[x,N]=h.useState(!1),C=h.useRef(null),[j,R]=h.useState(""),[M,L]=h.useState(""),[S,D]=h.useState(!1),{onboardingFileSchema:O,isShowOnboarding:B}=we(),[W,F]=h.useState(!1),_=h.useMemo(()=>i!=null&&i.isMetadataDescription?Ol(t,b,u,f):[],[t,b,u,i==null?void 0:i.isMetadataDescription,f]),G=h.useMemo(()=>[...i!=null&&i.isMetadataDescription?[]:[rn(t,u,f)],...Rl(Ll(o),A.getStructureComponentsMap(r),u)],[o,t,u,i==null?void 0:i.isMetadataDescription,r,f]),H=h.useCallback(()=>{N(!0)},[]),U=h.useCallback(()=>{N(!1),F(!0)},[]);h.useEffect(()=>{const K=s&&s(G)||qs(A.getLastUpdatedTime(t),u);k(K)},[t,u,G,s]),h.useEffect(()=>{if(B){const{title:J,description:K}=Oe(oe.METADATA_PER_DATASET,f);R(J),L(K)}},[f,B]),h.useEffect(()=>{B&&D((O==null?void 0:O.lastDisplayedElement)===oe.METADATA_PER_DATASET)},[O==null?void 0:O.lastDisplayedElement,B]);const Y=(J,K)=>l.jsxs("div",{className:Be("flex gap-1 text-neutrals-1000",m),children:[l.jsxs("span",{className:Be("text-neutral-800",v),children:[J,":"]}),l.jsx("span",{children:K})]});return l.jsxs("div",{className:"flex flex-col bg-white gap-3 dataset-info",children:[n&&l.jsxs("div",{className:"flex gap-1 items-center py-1 px-2 rounded-[20px] bg-accent-500 body-2 w-fit",children:[a,(f==null?void 0:f.dataset)??"Dataset"]}),l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsxs("div",{className:"flex gap-1 items-center",children:[l.jsxs("div",{role:"heading","aria-level":4,className:Be("flex gap-1 items-center h4",p),children:[l.jsx("div",{ref:C,children:l.jsx(E.IconButton,{title:(f==null?void 0:f.metadata)??"View details",buttonClassName:Be("!text-neutrals-1000 !border-none !w-4 !h-4 !p-0 shrink-0",g),icon:l.jsx(qo,{className:Be("size-4",w)}),onClick:H})}),l.jsx("span",{children:A.getLocalizedName(t,u)})]}),c&&l.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer",children:d||l.jsx(De.IconExternalLink,{className:"text-primary cursor-pointer w-4 h-4 shrink-0"})})]}),l.jsxs("div",{className:"flex gap-2 body-3 items-center",children:[e&&l.jsxs(l.Fragment,{children:[Y((f==null?void 0:f.agency)??"Agency",(t==null?void 0:t.agencyID)??""),l.jsx("div",{"aria-hidden":"true",className:"border-l border-l-neutral-500 h-[14px]"})]}),Y((f==null?void 0:f.lastUpdated)??"Last updated",b)]})]}),S&&l.jsx(Le,{reference:C,title:j,description:M,onReferenceClick:H,shouldCloseTooltip:W}),x&&l.jsx(Cn,{titles:f,locale:u,metadata:G,metadataDescription:_,isOpenMetadata:x,onCloseMetadata:U})]})},ea=({titles:e,locale:n,isShowShare:t,shareConversationProps:o})=>{const{setIsOpenedAdvancedView:r}=Me(),i=h.useRef(null),[u,f]=h.useState(""),[s,c]=h.useState(""),[a,d]=h.useState(!1),{onboardingFileSchema:g,isShowOnboarding:w}=we();return h.useEffect(()=>{if(w){const{title:m,description:v}=Oe(oe.EXIT_ADVANCED_VIEW,e);f(m),c(v)}},[e,w]),h.useEffect(()=>{w&&d((g==null?void 0:g.lastDisplayedElement)===oe.EXIT_ADVANCED_VIEW)},[g==null?void 0:g.lastDisplayedElement,w]),l.jsxs("header",{className:V("bg-white px-6 py-4 flex justify-between items-center sm:px-0","advanced-view-header"),children:[l.jsxs("div",{className:V("flex gap-3 items-center",!t&&"justify-between w-full","advanced-view-header-title"),children:[l.jsx("div",{ref:i,className:V(!t&&"order-2","flex"),children:l.jsx(E.CloseButton,{btnClassNames:"button-close",onClick:()=>r(!1),title:(e==null?void 0:e.close)||"Close"})}),a&&l.jsx(Le,{reference:i,title:u,description:s,onReferenceClick:()=>r(!1),shouldMoveToNextStep:!0}),l.jsx("h2",{className:"sm:h-3",children:(e==null?void 0:e.advanceViewTitle)??"Advanced view"})]}),t&&l.jsx(Do,{locale:n,...o})]})};function Nn(e,n,t){var i;const o=A.getConcept(e.conceptIdentity,n),r=A.getArtifactByUrnWithWildCard((i=o==null?void 0:o.coreRepresentation)==null?void 0:i.enumeration,t);return{concept:o,codeList:r||void 0}}function cr(e,n,t){const o=e.findIndex(r=>r.id===n);return t.originalData.parsedTimeSeriesValue[o]}function ur(e,n,t,o,r){var f;const i=cr(e,n,o),u=(f=t==null?void 0:t.codes)==null?void 0:f.find(s=>s.id===i);return A.getLocalizedName(u,r)}function na(e,n,t,o,r,i,u,f,s){const c=ta(e,t),a=s!=null&&s.startPeriod&&s.endPeriod?A.getAdditionalColumns(f,s):[],d=oa(e,n,t,o,r,i,a);return[bl(e,n==null?void 0:n.data,t,r,i,u),...c,...d,Cl(e,n==null?void 0:n.data,t,void 0,i,u)]}function ta(e,n){var i;const t=e.conceptSchemes||[],o=e.codelists||[],r=((i=A.getDimensions(e))==null?void 0:i.dimensions)||[];return r.map(u=>{const{codeList:f,concept:s}=Nn(u,t,o),c=a=>{const{data:d,colDef:g}=a,w=g.field;return ur(r,w,f,d,n)};return{headerName:A.getLocalizedName(s,n),field:u.id,colId:u.id,valueGetter:c,...gn,tooltipValueGetter:a=>a.value}})}function oa(e,n,t,o,r,i,u){const f=u!=null&&u.length?u:A.getTimePeriods(n);return ia(f,(c,a)=>ra(c,a||c,o,i),e,t,r,i)}const ra=(e,n,t=q.defaultFormatNumbers,o)=>({headerName:ui(n,o),colId:e,field:e,type:"numericColumn",suppressColumnsToolPanel:!0,sortable:!1,width:on,cellClass:["justify-end","cell-with-meta"],valueFormatter:r=>q.formatNumberBySign(r.value,t)}),ia=(e,n,t,o,r,i)=>{const u=[];return e.sort((s,c)=>A.sortPeriods(s,c)).forEach(s=>{u.push({headerName:s.toString(),field:s.toString(),...n(s.toString()),valueGetter:c=>{var a,d,g;return((g=(d=(a=c.data[c.column.getColId()])==null?void 0:a.value)==null?void 0:d[0])==null?void 0:g.value)||null},cellClass:bn,cellRenderer:Yo,width:on,cellRendererParams:{dataSetData:t,locale:o,metadataSettings:r,titles:i}})}),u};function la(e,n,t){const o=n.map(i=>i.id).filter(i=>i!=null),r=t.map(i=>i.id).filter(i=>i!=null);return sa(e,o,r,o)}const sa=(e,n,t,o)=>{const r=ca(e,n),i={};for(const u of r){const f=u.rowTime,s=dr(f,o);if(i[s]==null){i[s]={};for(const c of o)i[s][c]=f[c]}i[s]={attributes:u.attributes.filter(({value:c})=>c),...i[s],id:s,originalData:u.originalData,...aa(f,t)}}return Object.values(i)},dr=(e,n)=>n.map(t=>e[t]).join("_"),aa=(e,n)=>{const t=dr(e,n),{OBS_VALUE:o,obsAttributes:r}=e,i={};return i[t]={value:o,obsAttributes:r},i},ca=(e,n)=>{const t=[];for(const o of e){const r={},i=o.name.split(".");for(let u=0;u<n.length;u+=1)r[n[u]]=i[u];if(!o.values.length){const u={...r};u.TIME_PERIOD=void 0,u.OBS_VALUE=void 0,t.push({rowTime:u,attributes:o.attributes,id:o.name,originalData:o})}o.values.forEach(u=>{var c;const f={...r};f.TIME_PERIOD=u.dimensionAtObservation;const s=ua(o,u);f.OBS_VALUE=s,f.obsAttributes=((c=u==null?void 0:u.obsAttributes)==null?void 0:c.filter(({value:a})=>a))||[],t.push({rowTime:f,attributes:o.attributes,id:o.name,originalData:o})})}return t},ua=(e,n)=>{const o=[...e.attributes,...n.obsAttributes].find(({name:r})=>r==="OBS_VALUE");return o?[o]:n.values},da="#EEEEEE",ha="#777777";function fa(e,n,t){const o={animation:!1,tooltip:{trigger:"axis",appendToBody:!0,formatter:r=>{let i=r[0].axisValueLabel+"<br/>";return r.forEach(u=>{u.value!==null&&u.value!==void 0&&(i+=u.marker+" "+u.seriesName+": "+u.value+"<br/>")}),i}},legend:{bottom:0},grid:{left:"3%",right:"3%",bottom:"40px",containLabel:!0},xAxis:{...to(t==null?void 0:t.ticksColor,t==null?void 0:t.labelsColor),type:"category",boundaryGap:!1,data:e},yAxis:{...to(t==null?void 0:t.ticksColor,t==null?void 0:t.labelsColor),type:"value"},series:n};return(t==null?void 0:t.colors)!=null&&(o.color=t.colors),o}function to(e=da,n=ha){return{splitLine:{show:!0,showMaxLine:!1,lineStyle:{color:[e]}},axisTick:{show:!1},axisLabel:{color:n},axisLine:{lineStyle:{color:e}}}}function hr(e,n,t,o){return n.map(i=>{var c;const u=((c=A.getDimensions(t))==null?void 0:c.dimensions)||[],f=u==null?void 0:u.find(a=>a.id===i);if(f==null)return e[i]||"";const{codeList:s}=Nn(f,t.conceptSchemes||[],t.codelists||[]);return ur(u,i,s,e,o)}).join(" - ")}function ga(e,n){var i,u;const t=[...((i=n==null?void 0:n.metadata)==null?void 0:i.indicatorDimensions)||[]].filter(f=>f!=null),o=(u=A.getDimensions(e))==null?void 0:u.dimensions,r=(o==null?void 0:o.filter(f=>{var s;return f.id!=null&&!t.includes(f.id)&&((s=n==null?void 0:n.metadata)==null?void 0:s.countryDimension)!==f.id}).map(f=>f.id).filter(f=>f!=null))||[];return[...t,...r]}function wa(e,n,t){const o={};return e.forEach(r=>{const i=ma(r,n,t);o[i]||(o[i]={rows:[]}),o[i].rows.push(r)}),Object.keys(o).map(r=>o[r])}function ma(e,n,t){var i,u,f,s;const o=((s=(f=(u=(i=t.dataStructures)==null?void 0:i[0])==null?void 0:u.dataStructureComponents)==null?void 0:f.dimensionList)==null?void 0:s.dimensions)||[];return n.map(c=>(o==null?void 0:o.find(d=>d.id===c))==null?e[c]||"":cr(o,c,e)).join(" - ")}function pa(e,n){const t={};return e.forEach(o=>t[o]=xa(o,n)),{nonUniqDimensions:e.filter(o=>!t[o])}}function xa(e,n){const t=n.map(r=>va(e,r));return new Set(t).size===1}function va(e,n){return n[e]}const ba="line",$e=10;function Ca(e,n,t,o,r){const i=gr(n,e,t,o,r),f=A.getTimePeriods(n).sort((d,g)=>A.sortPeriods(d,g)),s=ga(e,t),{nonUniqDimensions:c}=pa(s,i);return{units:wa(i,c,e).map(d=>fr(d,e,t,f,o,r))}}function ka(e,n,t,o,r,i){return fr({rows:[e]},t,o,n,r,i)}function fr(e,n,t,o,r,i){var c,a,d;const u=ja(e.rows,n,r),f=(c=u==null?void 0:u.find(g=>A.FREQUENCY_DIMENSION_ID.includes(g==null?void 0:g.id)))==null?void 0:c.id,s=Sa(e.rows.length>$e?e.rows.slice(0,$e):e.rows,n,t,r,oo(o,(a=e==null?void 0:e.rows)==null?void 0:a[0],f));return{rows:e.rows,limitedByRowsAmountTo:e.rows.length>$e?$e:void 0,dimensions:u,config:fa(oo(o,(d=e==null?void 0:e.rows)==null?void 0:d[0],f),s,i)}}function oo(e,n,t){if(t){const o=n==null?void 0:n[t];if(o===A.Periods.MONTHLY)return e==null?void 0:e.filter(r=>A.isMonthly(r));if(o===A.Periods.QUARTERLY)return e==null?void 0:e.filter(r=>A.isQuarterly(r));if(o===A.Periods.ANNUAL)return e==null?void 0:e.filter(r=>A.isYearly(r))}return e}function Sa(e,n,t,o,r){return e.map(i=>{var u,f;return{name:((u=t==null?void 0:t.metadata)==null?void 0:u.countryDimension)==null?"":hr(i,[(f=t==null?void 0:t.metadata)==null?void 0:f.countryDimension],n,o),type:ba,data:r.map(s=>Na(s,i))}})}function Na(e,n){var t,o,r;return((r=(o=(t=n[e])==null?void 0:t.value)==null?void 0:o[0])==null?void 0:r.value)||null}function ja(e,n,t){var o;return(((o=A.getDimensions(n))==null?void 0:o.dimensions)||[]).map(r=>{if(r.id!=null)return{id:r.id,title:Ea(r,n,t),value:hr(e[0],[r.id],n,t)}}).filter(r=>r!=null)}function Ea(e,n,t){const o=n.conceptSchemes||[],r=n.codelists||[],{concept:i}=Nn(e,o,r);return A.getLocalizedName(i,t)||e.id}function gr(e,n,t,o,r){var c,a;const i=e==null?[]:A.getParsedResponse(e),u=((c=A.getDimensions(n))==null?void 0:c.dimensions)||[],f=((a=A.getDimensions(n))==null?void 0:a.timeDimensions)||[],s=la(i,u,f);return Da(s,e,n,t,o,r)}function Da(e,n,t,o,r,i){const f=A.getTimePeriods(n).sort((s,c)=>A.sortPeriods(s,c));return e.map(s=>({...s,[Qe]:ka(s,f,t,o,r,i)}))}function Aa(e,n,t,o,r,i,u,f,s,c,a){return{columns:na(e,n,o,r,i,f,s,c,a),data:gr(n,e,t,o,u)}}function wr(e,n,t,o,r,i,u){const[f,s]=h.useState(),[c,a]=h.useState(),[d,g]=h.useState(),[w,m]=h.useState(),[v,p]=h.useState({title:(u==null?void 0:u.dataGrid)||"Data Grid",type:ne.AttachmentType.CUSTOM_DATA_GRID}),[b,k]=h.useState({title:(u==null?void 0:u.chart)||"Chart",type:ne.AttachmentType.CUSTOM_CHART}),[x,N]=h.useState([]),[C,j]=h.useState([]),[R,M]=h.useState(!1),[L,S]=h.useState({startPeriod:null,endPeriod:null}),D=h.useCallback(async F=>{var G;const _=A.getFiltersDtoFromDataQuery(F);try{const H=await e.getConstraints(F.urn,_),U=((G=H==null?void 0:H.data)==null?void 0:G.dataConstraints)||[];g(U)}catch{g([])}},[e,g]),O=h.useCallback(async F=>{e.getDataSet(F.urn).then(_=>{var G;if(_!=null&&_.data){const H=A.getDimensions(_.data);a(((G=_.data.dataflows)==null?void 0:G[0])||void 0),m(_.data||void 0),N([...(H==null?void 0:H.dimensions)||[],...(H==null?void 0:H.timeDimensions)||[]]);const U=(H==null?void 0:H.dimensions)==null?null:A.getTimeSeriesFilterKey(H==null?void 0:H.dimensions,F.filters),Y=Ri(F,H);e.getDataSetData(F.urn,{filterKey:U,timeFilter:Y}).then(J=>{s(J||void 0),j(A.getStructureDimensions(J))}).finally(()=>M(!1))}})},[e]);h.useEffect(()=>{async function F(_){M(!0);try{await Promise.all([D(_),O(_)])}catch(G){console.error("Error loading dataset details",G)}}t!=null&&F(t)},[e,t,D,O]);const B=h.useCallback((F,_,G)=>{var H;try{M(!0),g(_);const U=(H=G==null?void 0:G.find(Y=>Y.id===A.TIME_PERIOD))==null?void 0:H.timeRange;U&&S(U),e.getDataSetData((t==null?void 0:t.urn)||"",F).then(Y=>{s(Y||void 0),j(A.getStructureDimensions(Y))}).finally(()=>M(!1))}catch(U){console.error("Error loading dataset data",U)}},[e,t]);h.useEffect(()=>{var F,_,G;if(w!=null&&f!=null&&(d!=null&&d.length)){const H=(G=(_=(F=w.dataflows)==null?void 0:F[0])==null?void 0:_.names)==null?void 0:G[n],U=Aa(w,f,t,n,o,i,r,u,e==null?void 0:e.putOnboardingFile,d,L);p(Y=>({...Y,title:H||(u==null?void 0:u.dataGrid)||"Data Grid",grid_data:U}))}},[w,f,u,n,o,t,i,r,d,L,e==null?void 0:e.putOnboardingFile]),h.useEffect(()=>{w!=null&&f!=null&&k(F=>{const _=Ca(w,f,t,n,r);return{...F,charting_data:_}})},[w,f,t,n,r]);const W=h.useMemo(()=>[v,b],[v,b]);return{dataMessage:f,structures:w,dataset:c,dimensions:x,structureDimensions:C,onFiltersChange:B,constraints:d,isLoadingGridData:R,dataSetAttachments:W}}const ya=({attachmentsProps:e,actions:n,titles:t,shareConversationProps:o,metadataSettings:r,formattingSettings:i,locale:u,advanceViewStyles:f,getDatasetUpdatedTime:s,attachmentsConfig:c,datasetInfoOptions:a,...d})=>{var O,B,W,F,_;const{dataMessage:g,dataset:w,dimensions:m,structureDimensions:v,structures:p,dataSetAttachments:b,onFiltersChange:k,isLoadingGridData:x,constraints:N}=wr(n,u,e.currentDataQuery,i,(O=e.styles)==null?void 0:O.chartingStyles,r,t),[C,j]=h.useState(),[R,M]=h.useState({filterKey:null,timeFilter:null}),L=h.useCallback((G,H,U)=>{M(G),j(!0),k(G,H,U)},[k]),S=h.useCallback(G=>{var H;G&&(n==null||n.updateCurrentDataQuery(((H=e==null?void 0:e.dataQueries)==null?void 0:H.find(U=>(U==null?void 0:U.urn)===G))||e.currentDataQuery))},[n,e.currentDataQuery,e==null?void 0:e.dataQueries]),D=rr(c==null?void 0:c.isExternaLinkIncludeFilters,R,e.currentDataQuery||((B=e.dataQueries)==null?void 0:B[0]),m);return l.jsxs("div",{className:"advanced-view flex flex-col flex-1 h-full min-w-0",children:[l.jsx(ea,{titles:t,locale:u,shareConversationProps:o,isShowShare:f==null?void 0:f.isShowShare}),(W=e==null?void 0:e.datasets)!=null&&W.length?l.jsxs(l.Fragment,{children:[((F=e==null?void 0:e.datasets)==null?void 0:F.length)>1&&l.jsx(or,{datasets:e==null?void 0:e.datasets,initialSelectedDatasetUrn:(_=e==null?void 0:e.currentDataQuery)==null?void 0:_.urn,locale:u,isHideAdvancedViewButton:!0,selectDataset:S}),x&&!C?l.jsx(E.Loader,{}):l.jsxs(l.Fragment,{children:[l.jsx(Qs,{...a,titles:t,locale:u,dataset:w,data:g==null?void 0:g.data,structures:p,metadataSettings:r,getDatasetUpdatedTime:s,externalLink:D}),l.jsx("div",{className:V("flex-1 min-h-0 overflow-auto","advanced-view-filters"),children:l.jsx(ss,{...d,titles:t,actions:n,attachments:b,attachmentsDataQuery:e.currentDataQuery,dataQueries:e==null?void 0:e.dataQueries,dimensions:m,attachmentsStyles:e.styles,isDataLoading:x,locale:u,filtersProps:{...d==null?void 0:d.filtersProps,structureDimensions:v,structures:p,onFiltersChange:k,initialConstraints:N},setIsFiltering:j,attachmentsConfig:c,filters:R,onFiltersChange:L})})]})]}):l.jsx(E.Loader,{})]})};function Ta(e,n){const[t,o]=h.useState([]),[r,i]=h.useState();return h.useEffect(()=>{function u(f){try{Promise.all(f==null?void 0:f.map(s=>e(s==null?void 0:s.urn))).then(s=>{var c;o(((c=s==null?void 0:s.map(a=>{var d,g;return(g=(d=a==null?void 0:a.data)==null?void 0:d.dataflows)==null?void 0:g[0]}))==null?void 0:c.filter(a=>!!a))||[]),i(new Map(s==null?void 0:s.map(a=>{var d,g,w,m,v,p,b,k,x;return[A.generateShortUrn((w=(g=(d=a==null?void 0:a.data)==null?void 0:d.dataflows)==null?void 0:g[0])==null?void 0:w.id,(p=(v=(m=a==null?void 0:a.data)==null?void 0:m.dataflows)==null?void 0:v[0])==null?void 0:p.version,(x=(k=(b=a==null?void 0:a.data)==null?void 0:b.dataflows)==null?void 0:k[0])==null?void 0:x.agencyID),a==null?void 0:a.data]})))})}catch(s){console.error("Error loading datasets",s)}}n&&n.length&&u(n)},[n,e]),{datasets:t,datasetStructuresMap:r}}function ro(e){const n=e==null?void 0:e.filter(t=>Go(t));if(n!=null&&n.every(t=>!!(t!=null&&t.data)))return n==null?void 0:n.map(t=>({title:t==null?void 0:t.title,...Oa(Ma(t==null?void 0:t.data))}))}function Ma(e){if(e)try{return JSON.parse(e)}catch(n){console.error("Invalid JSON:",n)}return null}function Oa(e){var n,t,o,r,i,u;return{...e,filters:(n=e==null?void 0:e.filters)==null?void 0:n.map(f=>({...f,componentCode:(f==null?void 0:f.component_code)||(f==null?void 0:f.componentCode)})),metadata:{datasetUrl:(t=e==null?void 0:e.metadata)==null?void 0:t.datasetUrl,countryDimension:((o=e==null?void 0:e.metadata)==null?void 0:o.country_dimension)||((r=e==null?void 0:e.metadata)==null?void 0:r.countryDimension),indicatorDimensions:((i=e==null?void 0:e.metadata)==null?void 0:i.indicator_dimensions)||((u=e==null?void 0:e.metadata)==null?void 0:u.indicatorDimensions)}}}var mr=(e=>(e.COMPLETED="completed",e))(mr||{});const La=({stage:e,stageRef:n,isCurrentStage:t})=>l.jsxs("div",{ref:n,className:"message-stage flex relative pb-8 last:pb-0 last:mb-8",children:[l.jsx("span",{className:"message-stage-line absolute border-l h-full"}),l.jsx(De.IconPointFilled,{className:"message-stage-indicator flex shrink-0 z-10"}),l.jsxs("div",{className:"ml-2 w-full",children:[l.jsxs("div",{className:V("flex gap-2 items-center",(e==null?void 0:e.content)&&"mb-4"),children:[t&&l.jsx(E.Loader,{}),l.jsx("h3",{className:"message-stage-name",children:e==null?void 0:e.name})]}),l.jsx("div",{className:"prose max-w-full break-words",children:l.jsx(io,{remarkPlugins:[lo],components:{strong:o=>l.jsx("strong",{className:"text-neutrals-1000",...o}),a:({href:o,children:r,...i})=>l.jsx("a",{href:o,target:"_blank",...i,children:r}),h1:o=>l.jsx("h1",{className:"h1 text-neutrals-1000",...o}),h2:o=>l.jsx("h2",{className:"h2 text-neutrals-1000",...o}),h3:o=>l.jsx("h3",{className:"h3 text-neutrals-1000",...o}),h4:o=>l.jsx("h4",{className:"h4 text-neutrals-1000",...o}),h5:o=>l.jsx("h5",{className:"h5 text-neutrals-1000",...o}),code:o=>l.jsx("code",{className:"text-neutrals-900",...o}),pre:o=>l.jsx("pre",{className:"bg-neutrals-100 border border-neutrals-600",...o})},children:e==null?void 0:e.content})})]})]}),Ra=({stages:e,expandIcon:n,processingTitle:t})=>{const[o,r]=h.useState(),[i,u]=h.useState(),f=h.useRef(null),s=h.useRef(null);h.useEffect(()=>{var a;u((a=e==null?void 0:e.filter(d=>(d==null?void 0:d.status)!==mr.COMPLETED))==null?void 0:a.at(-1))},[e]),h.useEffect(()=>{var a;o&&((a=s==null?void 0:s.current)==null||a.scrollIntoView({block:"nearest",behavior:"smooth"}))},[o]),h.useEffect(()=>{const a=f.current;let d;if(!a)return;const g=new IntersectionObserver(([w])=>{var v;const m=(v=w==null?void 0:w.boundingClientRect)==null?void 0:v.top;d&&!(w!=null&&w.isIntersecting)&&m<d&&r(!1),d=m},{threshold:0});return g.observe(a),()=>g.disconnect()},[]);const c=()=>{r(a=>!a)};return l.jsxs("div",{className:"message-stages",ref:f,children:[l.jsxs("div",{className:V("message-stages-header inline-flex max-w-full items-center cursor-pointer",!(i!=null&&i.name)&&"default-header"),onClick:c,children:[l.jsx("p",{className:"message-stages-title truncate",children:(i==null?void 0:i.name)||t||"Processing..."}),l.jsx("i",{className:V("message-stages-expand-icon",o&&"rotated"),children:n})]}),o&&e&&l.jsx("div",{className:"flex flex-col",children:e==null?void 0:e.map(a=>l.jsx(La,{stage:a,stageRef:i?s:null,isCurrentStage:(a==null?void 0:a.index)===(i==null?void 0:i.index)},a.index))})]})},_a=({message:e,regenerateMessage:n,messageActionsIcons:t,rateResponse:o,isStreaming:r=!1,isReadOnly:i=!1})=>{const u=t==null?void 0:t.copy,f=t==null?void 0:t.regenerate,s=t==null?void 0:t.thumbUp,c=t==null?void 0:t.thumbDown,a=t==null?void 0:t.thumbPressed,[d,g]=h.useState(null),w=m=>{e.responseId&&(g(m),o(e.responseId||"",m))};return l.jsxs("div",{className:V("message-actions","flex gap-x-2 pt-2"),children:[u&&l.jsx("p",{onClick:()=>navigator.clipboard.writeText(e.content),children:u}),f&&!i&&!r&&l.jsx("p",{onClick:()=>{n==null||n(e)},children:f}),s&&!i&&d!==!1&&(d===null?l.jsx("p",{onClick:()=>w(!0),children:s}):l.jsx("p",{children:a})),c&&!i&&d!==!0&&(d===null?l.jsx("p",{onClick:()=>w(!1),children:c}):l.jsx("p",{className:"rotate-180",children:a}))]})},Ia=({message:e,onEditClick:n,messageActionsIcons:t,isStreaming:o=!1,isReadOnly:r=!1})=>{const i=t==null?void 0:t.copy,u=t==null?void 0:t.edit;return l.jsxs("div",{className:V("message-actions","flex gap-x-2 pt-2 ml-12"),children:[i&&l.jsx("p",{onClick:()=>navigator.clipboard.writeText(e.content),children:i}),u&&!o&&!r&&l.jsx("p",{onClick:n,children:u})]})},Pa=({content:e,textColorClass:n,onCancel:t,onEditApply:o,editMessageTitles:r})=>{const{isOpenedAdvancedView:i}=Me(),u=h.useRef(null);h.useEffect(()=>{const s=u.current;f(),s&&(s.focus(),s.setSelectionRange(s.value.length,s.value.length))},[]);const f=()=>{const s=u.current;s&&(s.style.height="auto",s.style.height=s.scrollHeight+"px")};return l.jsxs("div",{className:V("max-w-none break-words",i?"body-2":"body-1",n),children:[l.jsx("textarea",{ref:u,className:"resize-none overflow-hidden outline-none bg-neutrals-300 w-full",defaultValue:e,onInput:f}),l.jsxs("div",{className:V("flex gap-x-2 items-center","edit-buttons-wrapper"),children:[l.jsx(E.Button,{buttonClassName:"text-button-secondary small-icon-button",title:r==null?void 0:r.cancel,isSmallButton:!0,onClick:t}),l.jsx(E.Button,{buttonClassName:"text-button-primary small-icon-button",title:r==null?void 0:r.send,isSmallButton:!0,onClick:()=>{var s;return o(((s=u.current)==null?void 0:s.value)||"")}})]})]})},Va=({message:e,previousMessage:n,titles:t,actions:o,dataQuery:r,isStreaming:i=!1,isCurrentMessageStreaming:u=!1,messageStyles:f,attachmentsStyles:s,showAdvancedView:c,formattingSettings:a,locale:d,metadataSettings:g,expandStagesIcon:w,onAdvancedViewOpen:m,regenerateMessage:v,selectMessageToSend:p,messageActionsIcons:b,rateResponse:k,editMessage:x,editMessageTitles:N,isReadOnlyConversation:C,isNotLastUserMessage:j,limitMessages:R,attachmentsConfig:M})=>{var Se,Ne;const[L,S]=h.useState(),[D,O]=h.useState(),[B,W]=h.useState([]),[F,_]=h.useState([]),[G,H]=h.useState(),[U,Y]=h.useState(!1),J=e.role===se.Role.User,K=e.role===se.Role.System,{datasets:re,datasetStructuresMap:ce}=Ta(o==null?void 0:o.getDataSet,L),[ae,de]=h.useState(!1),[le,ue]=h.useState([]);h.useEffect(()=>{O(L==null?void 0:L[0])},[L]);const{dataSetAttachments:xe,dimensions:be,isLoadingGridData:he}=wr(o,d,D,a,s==null?void 0:s.chartingStyles,g,t),{isOpenedAdvancedView:ie}=Me(),Ae=()=>{J&&de(!0)},Ce=()=>{de(!1)},ye=P=>{Ce(),x==null||x({...e,content:P})},ve=h.useCallback(P=>{P&&(O(L==null?void 0:L.find(y=>(y==null?void 0:y.urn)===P)),H(void 0))},[L]);h.useEffect(()=>{var T,I,z,$;const P=(I=(T=e.custom_content)==null?void 0:T.form_schema)==null?void 0:I.properties,y=j?((z=P==null?void 0:P.choice)==null?void 0:z.oneOf)||(($=P==null?void 0:P.completion)==null?void 0:$.oneOf):[];ue(y||[])},[e,j]),h.useEffect(()=>{const P=Kt(e),y=ro(P),T=P.filter(I=>fn(I));S(y),_(T)},[e]),h.useEffect(()=>{Y(L!=null&&L.length>0)},[L]),h.useEffect(()=>{r&&r.urn&&H(r.urn)},[r]),h.useEffect(()=>{if((e==null?void 0:e.role)===se.Role.System&&n){const P=Kt(n),y=ro(P)||[];L&&y&&ce&&W(rs(y,L,ce,d))}},[L,D,ce,be,d,e==null?void 0:e.role,n]);const ke=h.useCallback(()=>!J&&(f!=null&&f.systemMessageIcon)&&!(ie&&!u)?l.jsx("div",{className:V("flex-shrink-0 rounded-full flex items-center justify-center w-[44px] h-[44px]",u?"text-white absolute":"text-neutrals-400"),children:f.systemMessageIcon}):null,[J,f==null?void 0:f.systemMessageIcon,ie,u]),me=h.useMemo(()=>l.jsx(ir,{actions:o,titles:t,attachments:U?xe:F,onAdvancedViewOpen:m,isDataSetAttachments:U,datasets:re,initialSelectedDatasetUrn:G,messageStyles:f,attachmentsStyles:s,showAdvancedView:c,isSystemAttachments:K,isDataLoading:he,currentDataQuery:D,dataQueries:L,attachmentInfoList:B,locale:d,dimensions:be,selectDataset:ve,limitMessages:R,attachmentsConfig:M}),[o,t,U,xe,F,re,G,f,s,c,K,he,D,L,B,d,be,ve,m,R,M]);return l.jsx(l.Fragment,{children:!(K&&ie)&&l.jsx("div",{className:V("max-w-full flex",J?"justify-end":"justify-start","message-wrapper"),children:l.jsxs("div",{className:V("flex items-start max-w-full",(K||ae)&&"w-full"),children:[l.jsxs("div",{className:"mr-2 relative",children:[ke(),u&&l.jsx(E.Loader,{})]}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:V(J?"bg-neutrals-300 px-6":"pt-0",J?"user-message":"system-message",J&&(ae?"w-[100%] ml-0":"ml-12")),children:[!J&&!ie&&((Se=e==null?void 0:e.custom_content)!=null&&Se.stages)?l.jsx(Ra,{stages:(Ne=e==null?void 0:e.custom_content)==null?void 0:Ne.stages,expandIcon:w,processingTitle:f==null?void 0:f.processingTitle}):u&&l.jsx("p",{className:"body-1 text-neutrals-700 loading-message",children:t==null?void 0:t.loading}),ae?l.jsx(Pa,{content:e.content,onCancel:Ce,onEditApply:ye,editMessageTitles:N}):l.jsx(yo,{content:e.content})]}),me,!u&&(J?!ae&&l.jsx(Ia,{messageActionsIcons:b,message:e,isStreaming:i,onEditClick:Ae,isReadOnly:C}):l.jsx(_a,{messageActionsIcons:b,message:e,isStreaming:i,regenerateMessage:v,rateResponse:k,isReadOnly:C})),!ie&&!he&&l.jsx(To,{choiceButtons:le,onClick:p})]})]})})})},Fa=({messages:e,isStreaming:n=!1,isReadOnly:t,scrollBottomIcon:o,...r})=>{const i=h.useRef(null),u=h.useRef(null),{isOpenedAdvancedView:f}=Me(),[s,c]=h.useState(null),[a,d]=h.useState(!1),g=()=>{var k;const p=(k=u.current)==null?void 0:k.parentElement,b=i.current;if(p&&b){const x=b.offsetTop-p.offsetTop;p.scrollTo({top:x,behavior:"smooth"})}};h.useEffect(()=>{g()},[e,n]),h.useEffect(()=>{!f&&s!==null&&setTimeout(()=>{var p,b;(b=(p=u==null?void 0:u.current)==null?void 0:p.parentElement)==null||b.scrollTo({top:s,behavior:"smooth"})})},[f,s]);const w=()=>{var b,k;const p=((k=(b=u.current)==null?void 0:b.parentElement)==null?void 0:k.scrollTop)||null;c(p)},m=()=>{var b;const p=(b=u.current)==null?void 0:b.parentElement;if(p){const{scrollTop:k,scrollHeight:x,clientHeight:N}=p;k+N>=x?d(!1):!a&&!f&&d(!0)}};h.useEffect(()=>{f&&d(!1)},[f]);const v=E.useDebounce(m,300);return h.useEffect(()=>{var b;const p=(b=u.current)==null?void 0:b.parentElement;return p==null||p.addEventListener("scroll",v),()=>p==null?void 0:p.removeEventListener("scroll",v)},[v]),l.jsxs("div",{ref:u,className:"h-full w-full",children:[l.jsxs("div",{className:"flex flex-col gap-y-6 max-w-full",children:[e.map((p,b)=>l.jsx(Va,{message:p,previousMessage:Ji(e,b),onAdvancedViewOpen:w,isStreaming:n,isCurrentMessageStreaming:n&&b===e.length-1&&p.role===se.Role.Assistant,showAdvancedView:b===Yi(e)&&!t,isNotLastUserMessage:b===e.length-1&&p.role!==se.Role.User,...r},p.id||b)),l.jsx("div",{ref:i,className:"h-4"})]}),l.jsx("div",{onClick:g,className:V("fixed right-10 lg:right-6 sm:hidden bottom-[88px] rounded-[50%] border-[2px] w-[40px] h-[40px] border-primary cursor-pointer text-primary bg-white","scroll-button-wrapper",a?"block":"hidden"),children:l.jsx("div",{className:"flex justify-center items-center w-full h-full",children:o})})]})},Ba=e=>{var t,o,r,i,u,f,s,c,a;const n={};return(r=(o=(t=e.choices)==null?void 0:t[0])==null?void 0:o.delta)!=null&&r.content&&(n.content=e.choices[0].delta.content),(f=(u=(i=e.choices)==null?void 0:i[0])==null?void 0:u.delta)!=null&&f.custom_content&&(n.custom_content=e.choices[0].delta.custom_content),(a=(c=(s=e.choices)==null?void 0:s[0])==null?void 0:c.delta)!=null&&a.role&&(n.role=e.choices[0].delta.role),e.id&&(n.responseId=e.id),n},Ha="local",Ga=e=>{var n;return!((n=e.permissions)!=null&&n.includes(se.SharePermission.WRITE))&&!Wa(e)},za=(e,n)=>pr(e)!==n,Wa=e=>pr(e)===Ha,pr=e=>e.id.split("/")[0],Ua=(e,n)=>jn([...(n==null?void 0:n.messages)||[],e]),jn=e=>[...e].map(n=>{const t={role:n.role,content:n.content};return(n.role===se.Role.Assistant||n.role===se.Role.System)&&n.custom_content!=null&&(n.custom_content.state!=null||n.custom_content.attachments!=null||n.custom_content.form_schema!=null)&&(t.custom_content={},n.custom_content.state!=null&&(t.custom_content.state=n.custom_content.state),n.custom_content.attachments!=null&&(t.custom_content.attachments=Ya(n.custom_content.attachments)),n.custom_content.form_schema!=null&&(t.custom_content.form_schema=n.custom_content.form_schema)),n.role===se.Role.User&&n.custom_content&&(t.custom_content=n.custom_content),t}),$a=(e,n)=>{const t=n==null?void 0:n.messages,o=t==null?void 0:t.findIndex(r=>e.id===r.id);return jn((t==null?void 0:t.slice(0,o))||[])},Ja=(e,n)=>{const t=n==null?void 0:n.messages,o=t==null?void 0:t.findIndex(r=>e.id===r.id);return jn([...(t==null?void 0:t.slice(0,o))||[],e])};function Ya(e){return e.map(n=>({type:n.type,title:n.title,data:n.data,url:n.url,reference_type:n.reference_type,reference_url:n.reference_url}))}const Ka=(e,n,t,o)=>{if(!t||n)return null;const r={id:`msg-${Date.now()}`,role:se.Role.User,content:e,timestamp:Date.now()};if(o){const i=o===nn.COMPLETE?Ke.COMPLETION:Ke.CHOICE;r.custom_content={form_value:{[i]:o}}}return r},Za=(e,n,t)=>`/${n}${t}/${q.getConversationNavPath(e==null?void 0:e.folderId,e==null?void 0:e.id)}`,qa=(e,n,t)=>{const o=`${n}/${t}`,r=ne.generateConversationId({folderId:o,name:e==null?void 0:e.name});return{...e,folderId:o,id:r}},Xa="AbortError",Qa=({conversationKey:e,conversation:n,actions:t,messageStyles:o,attachmentsStyles:r,inputMessageStyles:i,shareConversationProps:u,showConversationHeaderAdvancedView:f=!0,formattingSettings:s,metadataSettings:c,expandStagesIcon:a,locale:d,conversationsRoute:g,token:w,titles:m,dataQuery:v,handleInvalidStreaming:p,setConversation:b,setConversations:k,openUrl:x,messageActionsIcons:N,editMessageTitles:C,scrollBottomIcon:j,isFinalMessage:R,limitMessages:M,attachmentsConfig:L})=>{const[S,D]=h.useState(null),[O,B]=h.useState(!1),[W,F]=h.useState(!0),[_,G]=h.useState(!1),{isOpenedAdvancedView:H}=Me(),{onboardingFileSchema:U,onboardingFilePath:Y,onboardingFileName:J,isShowOnboarding:K,setOnboardingFileSchema:re}=we();h.useEffect(()=>{var y;U&&((y=t.putOnboardingFile)==null||y.call(t,J,Y,U))},[t,U,J,Y]),h.useEffect(()=>{H&&(U==null?void 0:U.lastDisplayedElement)===oe.OPEN_ADVANCED_VIEW&&(re==null||re(Ho(U)))},[t,H,re,U]);const ce=h.useCallback(()=>{x(`/${d}${g}`)},[d,g,x]),ae=h.useCallback(async()=>{try{const{bucket:y}=await t.getBucket(),T=qa(n,y,d);await t.createConversation(T,d);const I=await t.getConversations(d);k(q.cleanConversationNames(I)),x(Za(T,d,g))}catch(y){console.error("Failed to save conversation:",y)}},[t,n,g,d,x,k]),de=h.useCallback(async y=>{try{await t.updateConversation(decodeURI(e),{name:y.name,messages:y.messages})}catch(T){console.error("Failed to save conversation:",T)}},[t,e]),le=h.useCallback(y=>{b(T=>T?{...T,messages:[...(T==null?void 0:T.messages)||[],y]}:null)},[b]),ue=h.useCallback(()=>{const y={id:`msg-${Date.now()+1}`,role:se.Role.Assistant,content:"",timestamp:Date.now()};return b(T=>T?{...T,messages:[...T.messages,y]}:null),y},[b]),xe=h.useCallback((y,T)=>{var z;const I=(z=ne.mergeMessages)==null?void 0:z.call(ne,y,[T]);if(I)return b($=>$?{...$,messages:$.messages.map(X=>X.id===y.id?{...I}:X)}:null),I},[b]),be=h.useCallback((y,T)=>{t.rateResponse(y,T)},[t]),he=h.useCallback(async(y,T,I)=>{var X;const z=new AbortController;D(z);let $=y;if(I)return await((X=ne.streamChatResponse)==null?void 0:X.call(ne,encodeURI(I.id),T,{model:I.model,signal:z==null?void 0:z.signal,onMessage:ge=>{const Te=Ba(ge);(Te.content||Te.role||Te.responseId)&&($=xe($,Te))},onError:ge=>{if(!ye(ge))throw console.error("Streaming error:",ge),ge}},w,I==null?void 0:I.custom_fields).catch(ge=>{const Te=ge.message;p==null||p(Te)})),$},[xe,p,w]),ie=h.useCallback(async(y,T,I)=>{if(T){const z={...T,messages:[...T.messages],updatedAt:Date.now()};I&&z.messages.push(I),z.messages.push(y),await de(z)}},[de]),Ae=h.useCallback((y,T)=>{b(I=>I?{...I,messages:I.messages.filter(z=>z.id!==T.id)}:null)},[b]),Ce=h.useCallback(()=>{S&&!S.signal.aborted&&S.abort()},[S]),ye=y=>(y==null?void 0:y.name)===Xa,ve=h.useCallback(async(y,T,I,z,$,X=!0)=>{ye($)?await ie(z??I,y,X?T:void 0):Ae($,T)},[ie,Ae]),ke=h.useCallback(async(y,T,I)=>{if(!T||!y)return;const z=Ka(y,_,T,I);let $,X;if(z){le(z);try{G(!0),$=ue();const ge=Ua(z,T);X=await he($,ge,T),await ie(X,T,z)}catch(ge){ve(T,z,$,X,ge)}finally{G(!1)}}},[_,le,ue,he,ie,ve]),me=h.useCallback(async(y,T,I)=>{let z,$;try{G(!0),z=ue(),$=await he(z,y,T),await ie($,T)}catch(X){ve(T,I,z,$,X,!1)}finally{G(!1)}},[ie,ve,he,ue]),Se=h.useCallback(async(y,T)=>{if(!T||!y)return;const I=$a(y,T),z={...T,messages:T.messages.slice(0,I.length)};b($=>$?{...$,...z}:null),me(I,z,y)},[b,me]),Ne=h.useCallback(async(y,T)=>{if(!T||!y)return;const I=Ja(y,T),z={...T,messages:[...T.messages.slice(0,I.length-1),y]};b($=>$?{...$,...z}:null),me(I,z,y)},[b,me]);h.useEffect(()=>{async function y(){var T,I,z;try{F(!0);const{bucket:$}=await t.getBucket(),X=await t.getConversation(decodeURI(e));b(X),B(Ga(X)&&za(X,$)),(X.messages.length===0||((I=(T=X==null?void 0:X.messages)==null?void 0:T[0])==null?void 0:I.role)===se.Role.Assistant&&((z=X==null?void 0:X.messages)==null?void 0:z.length)===1)&&ke(X.prompt,X)}catch{B(!0)}finally{F(!1)}}e&&y()},[e]);const P=h.useMemo(()=>({getFile:t.getFile,putOnboardingFile:t.putOnboardingFile,getDataSet:t.getDataSet,getDataSetData:t.getDataSetData,getConstraints:t.getConstraints,updateCurrentDataQuery:t.updateCurrentDataQuery,updateDataQueries:t.updateDataQueries,updateDatasets:t.updateDatasets,downloadDataSet:t.downloadDataSet}),[t]);return W?l.jsx(E.Loader,{}):l.jsxs("div",{className:V("h-full flex flex-col bg-white",H&&!f?"p-4":"pr-2"),children:[H&&!f?null:l.jsx(Ao,{conversation:n,locale:d,isOpenedAdvancedView:H,isShowShareButton:!O&&!K,shareConversationProps:u}),l.jsx("div",{className:V("flex-1 min-h-0 flex flex-col items-end overflow-y-auto",o==null?void 0:o.messagesWrapperClass),children:l.jsx(Fa,{messages:(n==null?void 0:n.messages)||[],actions:P,isStreaming:_,isReadOnly:O,messageStyles:o,attachmentsStyles:r,formattingSettings:s,metadataSettings:c,expandStagesIcon:a,dataQuery:v,locale:d,titles:m,regenerateMessage:y=>Se(y,n),selectMessageToSend:(y,T)=>ke(y,n,T),messageActionsIcons:N,rateResponse:be,editMessage:y=>Ne(y,n),editMessageTitles:C,scrollBottomIcon:j,isReadOnlyConversation:O||K,limitMessages:M,attachmentsConfig:L})}),K?null:O?l.jsx("div",{className:"flex items-center justify-center mt-4",children:l.jsx(E.Button,{iconBefore:l.jsx(De.IconCopy,{width:20,height:20}),title:(m==null?void 0:m.duplicate)??"Duplicate Chat",isSmallButton:!0,onClick:ae,buttonClassName:V("text-button-secondary")})}):l.jsx("div",{className:V(i.inputContainerClass),children:l.jsx(go,{onSendMessage:y=>ke(y,n),onStopStreaming:Ce,inProcess:_,sendMessageIcon:i.sendMessageIcon,placeholder:(m==null?void 0:m.askAnything)??"Ask anything...",containerClasses:"mt-4",inputClasses:"border-neutrals-600 mr-2"})}),K&&R&&l.jsx(E.Button,{iconBefore:l.jsx(De.IconPlus,{width:24,height:24}),title:m==null?void 0:m.onboardingFooterLink,onClick:ce,isSmallButton:!0,buttonClassName:"text-button-secondary self-center mb-3"})]})};exports.AdvancedView=ya;exports.AdvancedViewProvider=Dr;exports.CUSTOM_CHOICE_ID=nn;exports.ChartingIcon=Ze;exports.ChatFooter=Oo;exports.ChatOnboardingFooter=Mo;exports.ConversationView=Qa;exports.ConversationWelcome=Kr;exports.CustomContentProperties=Ke;exports.OnboardingProvider=Ar;exports.STAGE_STATUS=fo;exports.useAdvancedView=Me;exports.useOnboarding=we;